notify: protect notify->pending with the mutex

There was a known deadlocking bug in the notify library: when the
other thread set notify->pending after the according check in
notify_wait(), the latter thread was deadlocked.  Resolve this by
synchronizing all accesses to notify->pending with the notify object's
mutex.  Since notify_signal_sync() was never used, we can remove it.
As a consequence, we don't need notify_enter() and notify_leave()
anymore; eliminate them, too.
This commit is contained in:
Max Kellermann
2008-09-26 09:57:11 +02:00
parent 323e86489f
commit 58554e14f9
6 changed files with 4 additions and 41 deletions

View File

@@ -36,17 +36,6 @@ void notify_init(struct notify *notify);
void notify_deinit(struct notify *notify);
/**
* The thread which shall be notified by this object must call this
* function before any notify_wait() invocation. It locks the mutex.
*/
void notify_enter(struct notify *notify);
/**
* Neutralize notify_leave().
*/
void notify_leave(struct notify *notify);
/**
* Wait for a notification. Return immediately if we have already
* been notified since we last returned from notify_wait().
@@ -58,10 +47,4 @@ void notify_wait(struct notify *notify);
*/
void notify_signal(struct notify *notify);
/**
* Notify the thread synchonously, i.e. wait until it has received the
* notification.
*/
void notify_signal_sync(struct notify *notify);
#endif