summaryrefslogtreecommitdiff
path: root/src/itocondition.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/itocondition.h')
-rw-r--r--src/itocondition.h33
1 files changed, 18 insertions, 15 deletions
diff --git a/src/itocondition.h b/src/itocondition.h
index 1793f81..517dd5f 100644
--- a/src/itocondition.h
+++ b/src/itocondition.h
@@ -10,9 +10,9 @@ namespace Bu
10 /** 10 /**
11 * Ito condition. This is a fairly simple condition mechanism. As you may 11 * Ito condition. This is a fairly simple condition mechanism. As you may
12 * notice this class inherits from the ItoMutex class, this is because all 12 * notice this class inherits from the ItoMutex class, this is because all
13 * conditions must be within a locked block. The standard usage of a condition 13 * conditions must be within a locked block. The standard usage of a
14 * is to pause one thread, perhaps indefinately, until another thread signals 14 * condition is to pause one thread, perhaps indefinately, until another
15 * that it is alright to procede. 15 * thread signals that it is alright to procede.
16 * <br> 16 * <br>
17 * Standard usage for the thread that wants to wait is as follows: 17 * Standard usage for the thread that wants to wait is as follows:
18 * <pre> 18 * <pre>
@@ -24,10 +24,11 @@ namespace Bu
24 * ... // Take care of what you have to. 24 * ... // Take care of what you have to.
25 * cond.unlock(); 25 * cond.unlock();
26 * </pre> 26 * </pre>
27 * The usage for the triggering thread is much simpler, when it needs to tell 27 * The usage for the triggering thread is much simpler, when it needs to
28 * the others that it's time to grab some data it calls either signal or 28 * tell the others that it's time to grab some data it calls either signal
29 * broadcast. See both of those functions for the difference. 29 * or broadcast. See both of those functions for the difference.
30 *@author Mike Buland 30 *@author Mike Buland
31 *@ingroup Threading
31 */ 32 */
32 class ItoCondition : public ItoMutex 33 class ItoCondition : public ItoMutex
33 { 34 {
@@ -43,9 +44,9 @@ namespace Bu
43 ~ItoCondition(); 44 ~ItoCondition();
44 45
45 /** 46 /**
46 * Wait forever, or until signalled. This has to be called from within a 47 * Wait forever, or until signalled. This has to be called from within
47 * locked section, i.e. before calling this this object's lock function 48 * a locked section, i.e. before calling this this object's lock
48 * should be called. 49 * function should be called.
49 */ 50 */
50 int wait(); 51 int wait();
51 52
@@ -60,16 +61,18 @@ namespace Bu
60 int wait( int nSec, int nUSec ); 61 int wait( int nSec, int nUSec );
61 62
62 /** 63 /**
63 * Notify the next thread waiting on this condition that they can go ahead. 64 * Notify the next thread waiting on this condition that they can go
64 * This only signals one thread, the next one in the condition queue, that 65 * ahead. This only signals one thread, the next one in the condition
65 * it is safe to procede with whatever operation was being waited on. 66 * queue, that it is safe to procede with whatever operation was being
67 * waited on.
66 */ 68 */
67 int signal(); 69 int signal();
68 70
69 /** 71 /**
70 * Notify all threads waiting on this condition that they can go ahead now. 72 * Notify all threads waiting on this condition that they can go ahead
71 * This function is slower than signal, but more effective in certain 73 * now. This function is slower than signal, but more effective in
72 * situations where you may not know how many threads should be activated. 74 * certain situations where you may not know how many threads should be
75 * activated.
73 */ 76 */
74 int broadcast(); 77 int broadcast();
75 78