Changeset 70 for trunk/src/helpers/threads.c
- Timestamp:
- May 20, 2001, 5:38:55 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/helpers/threads.c
r52 r70 130 130 if (pti) 131 131 { 132 if (pti->pfRunning)133 // set "running" flag134 *(pti->pfRunning) = TRUE;135 136 132 if (pti->flFlags & THRF_WAIT) 137 133 // "Wait" flag set: thrCreate is then … … 174 170 } 175 171 176 // for non-transient threads:set exit flags172 // set exit flags 177 173 // V0.9.7 (2000-12-20) [umoeller] 178 174 pti->fExitComplete = TRUE; 179 175 pti->tid = NULLHANDLE; 180 176 181 if (pti->p fRunning)177 if (pti->ptidRunning) 182 178 // clear "running" flag 183 *(pti->p fRunning) = FALSE;179 *(pti->ptidRunning) = 0; 184 180 185 181 // (2000-12-18) [lafaix] clean up pti if thread is transient. … … 213 209 * The thread's ptiMyself is then a pointer to the 214 210 * THREADINFO structure passed to this function. 215 * ulData may be obtained like this:211 * In your thread function, ulData may be obtained like this: 216 212 * 217 213 + ULONG ulData = ptiMyself->ulData; 218 214 * 219 * The THREADINFO structure passed to this function must 220 * be accessible all the time while the thread is running 221 * because the thr* functions will use it for maintenance. 222 * 223 * This function does NOT check whether a thread is 224 * already running in *pti. Do not use the same THREADINFO 225 * for several threads. 226 * 227 * If you do not want to manage the structure yourself, 228 * you can pass the THRF_TRANSIENT flag (see below). 229 * 230 * thrCreate does not call your thread func directly, 215 * thrCreate does not start your thread func directly, 231 216 * but only through the thr_fntGeneric wrapper to 232 217 * provide additional functionality. As a consequence, … … 235 220 * (cleanup) in thr_fntGeneric. Instead, just fall out of 236 221 * your thread function, or return(). 222 * 223 * The THREADINFO structure passed to this function must 224 * be accessible all the time while the thread is running 225 * because the thr* functions will use it for maintenance. 226 * This function does NOT check whether a thread is 227 * already running in *pti. Do not use the same THREADINFO 228 * for several threads. 229 * 230 * If you do not want to manage the structure yourself, 231 * you can pass the THRF_TRANSIENT flag (see below). 232 * 233 * ptidRunning is an optional parameter and can be NULL. 234 * If non-null, it must point to a ULONG which will contain 235 * the thread's TID while the thread is still running. 236 * Once the thread exits, the ULONG will automatically 237 * be set to zero; this is useful for a quick check whether 238 * the thread is currently busy. 239 * 240 * Note: ptidRunning is only reliable if you set the 241 * THRF_WAIT or THRF_WAIT_EXPLICIT flags. 237 242 * 238 243 * flFlags can be any combination of the following: … … 252 257 * 253 258 * -- THRF_WAIT_EXPLICIT: like THRF_WAIT, but in this case, 254 * your thread function mustpost THREADINFO.hevRunning259 * your thread function _must_ post THREADINFO.hevRunning 255 260 * yourself (thr_fntGeneric will not automatically 256 261 * post it). Useful for waiting until your own thread … … 282 287 *@@changed V0.9.9 (2001-03-07) [umoeller]: added pcszThreadName 283 288 *@@changed V0.9.9 (2001-03-14) [umoeller]: added THRF_WAIT_EXPLICIT 289 *@@changed V0.9.12 (2001-05-20) [umoeller]: changed pfRunning to ptidRunning 284 290 */ 285 291 286 292 ULONG thrCreate(PTHREADINFO pti, // out: THREADINFO data 287 293 PTHREADFUNC pfn, // in: _Optlink thread function 288 P BOOL pfRunning, // out: variable set to TRUEwhile thread is running;294 PULONG ptidRunning, // out: variable set to TID while thread is running; 289 295 // ptr can be NULL 290 296 const char *pcszThreadName, // in: thread name (for identification) … … 307 313 pti->cbStruct = sizeof(THREADINFO); 308 314 pti->pThreadFunc = (PVOID)pfn; 309 pti->p fRunning = pfRunning;315 pti->ptidRunning = ptidRunning; 310 316 pti->pcszThreadName = pcszThreadName; // V0.9.9 (2001-03-07) [umoeller] 311 317 pti->flFlags = flFlags; … … 336 342 pti); // parameter passed to thread 337 343 ulrc = pti->tid; 344 345 if (pti->ptidRunning) 346 // set "running" flag // V0.9.12 (2001-05-20) [umoeller] 347 *(pti->ptidRunning) = pti->tid; 338 348 339 349 if (ulrc)
Note:
See TracChangeset
for help on using the changeset viewer.