Rewrite the notification code to use smart pointers. This fixes several

fatal race conditions in notifications. This makes failure to remove a
notification non-fatal (it will remove itself harmlessly when an attempt is
made to notify it).
This commit is contained in:
JoelKatz
2013-02-26 00:11:23 -08:00
parent 5fb29bb859
commit c570cca15e
8 changed files with 209 additions and 140 deletions

View File

@@ -16,12 +16,12 @@
class BookListeners
{
boost::unordered_set<InfoSub*> mListeners;
boost::unordered_map<uint64, InfoSub::wptr> mListeners;
public:
typedef boost::shared_ptr<BookListeners> pointer;
void addSubscriber(InfoSub* sub);
void removeSubscriber(InfoSub* sub);
void addSubscriber(InfoSub::ref sub);
void removeSubscriber(uint64 sub);
void publish(Json::Value& jvObj);
};