Documentation for concurrent and small improvements

git-svn-id: svn://db.shs.com.ru/pip@868 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
7 changed files with 87 additions and 26 deletions

View File

@@ -9,15 +9,29 @@
#include <functional>
#include "piinit.h"
#define PICONDITION_RELIABLE true
/**
* @brief A condition variable is an object able to block the calling thread until notified to resume.
*
* It uses a PIConditionLock to lock the thread when one of its wait functions is called. The thread remains
* blocked until woken up by another thread that calls a notification function on the same PIConditionVariable object.
*/
class PIP_EXPORT PIConditionVariable {
public:
explicit PIConditionVariable();
virtual ~PIConditionVariable();
/**
* @brief Unblocks one of the threads currently waiting for this condition. If no threads are waiting, the function
* does nothing. If more than one, it is unspecified which of the threads is selected.
*/
virtual void notifyOne();
/**
* @brief Unblocks all threads currently waiting for this condition. If no threads are waiting, the function does
* nothing.
*/
virtual void notifyAll();
virtual void wait(PIConditionLock& lk);
virtual void wait(PIConditionLock& lk, const std::function<bool()>& condition);
virtual bool waitFor(PIConditionLock& lk, int timeoutMs);