diff options
author | Mike Buland <eichlan@xagasoft.com> | 2012-08-28 18:08:19 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2012-08-28 18:08:19 +0000 |
commit | f8fd3e94111d164bf7d3ac88c10a1069d2e7e83a (patch) | |
tree | 4ee6da62cd9d850c18adbbe3264ad1b43a57f614 /src | |
parent | 411cdf39fc2b961a970a0ae91b9059614251247e (diff) | |
download | libbu++-f8fd3e94111d164bf7d3ac88c10a1069d2e7e83a.tar.gz libbu++-f8fd3e94111d164bf7d3ac88c10a1069d2e7e83a.tar.bz2 libbu++-f8fd3e94111d164bf7d3ac88c10a1069d2e7e83a.tar.xz libbu++-f8fd3e94111d164bf7d3ac88c10a1069d2e7e83a.zip |
Made a function that should be private private, and documented yield. Also,
tested everything just to be safe :).
Diffstat (limited to 'src')
-rw-r--r-- | src/stable/thread.h | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/stable/thread.h b/src/stable/thread.h index f0456f3..920807b 100644 --- a/src/stable/thread.h +++ b/src/stable/thread.h | |||
@@ -102,15 +102,23 @@ namespace Bu | |||
102 | /** | 102 | /** |
103 | * The workhorse of the Thread class. This is the function that will | 103 | * The workhorse of the Thread class. This is the function that will |
104 | * run in the thread, when this function exits the thread dies and is | 104 | * run in the thread, when this function exits the thread dies and is |
105 | * cleaned up by the system. Make sure to read up on ThreadMutex, | 105 | * cleaned up by the system. Make sure to read up on Bu::Mutex, |
106 | * ThreadCondition, and cancel to see how to control and protect | 106 | * Bu::Condition, and the Bu::Synchro* classes to see how to control |
107 | * everything you do in a safe way within this function. | 107 | * and protect everything you do in a safe way within this function. |
108 | *@returns I'm not sure right now, but this is the posix standard form. | 108 | *@returns I'm not sure right now, but this is the posix standard form. |
109 | */ | 109 | */ |
110 | virtual void run()=0; | 110 | virtual void run()=0; |
111 | 111 | ||
112 | /** | 112 | /** |
113 | * This is the hidden-heard of the thread system. While run is what the | 113 | * Gives up some cpu-time in the currently running thread. If a thread |
114 | * is working hard, but you want to give other threads on the system | ||
115 | * some time to do some work, call yield. | ||
116 | */ | ||
117 | void yield(); | ||
118 | |||
119 | private: | ||
120 | /** | ||
121 | * This is the hidden-heart of the thread system. While run is what the | ||
114 | * user gets to override, and everything said about it is true, this is | 122 | * user gets to override, and everything said about it is true, this is |
115 | * the function that actually makes up the thread, it simply calls the | 123 | * the function that actually makes up the thread, it simply calls the |
116 | * run member function in an OO-friendly way. This is what allows us to | 124 | * run member function in an OO-friendly way. This is what allows us to |
@@ -119,8 +127,6 @@ namespace Bu | |||
119 | *@returns This is specified by posix, I'm not sure yet. | 127 | *@returns This is specified by posix, I'm not sure yet. |
120 | */ | 128 | */ |
121 | static void *threadRunner( void *pThread ); | 129 | static void *threadRunner( void *pThread ); |
122 | |||
123 | void yield(); | ||
124 | }; | 130 | }; |
125 | } | 131 | } |
126 | 132 | ||