Changeset 123 for trunk/src/helpers/threads.c
- Timestamp:
- Dec 14, 2001, 11:41:33 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/helpers/threads.c
r116 r123 40 40 // as unsigned char 41 41 42 #define INCL_WINMESSAGEMGR 42 43 #define INCL_DOSPROCESS 43 44 #define INCL_DOSSEMAPHORES … … 130 131 if (pti) 131 132 { 133 HEV hevExitComplete; 134 132 135 if (pti->flFlags & THRF_WAIT) 133 136 // "Wait" flag set: thrCreate is then … … 168 171 } 169 172 173 // copy event sem before freeing pti 174 hevExitComplete = pti->hevExitComplete; 175 170 176 // set exit flags 171 177 // V0.9.7 (2000-12-20) [umoeller] 172 pti->fExitComplete = TRUE;173 178 pti->tid = NULLHANDLE; 174 179 … … 180 185 if (pti->flFlags & THRF_TRANSIENT) 181 186 free(pti); 187 188 if (hevExitComplete) 189 // caller wants notification: 190 DosPostEventSem(hevExitComplete); 191 // V0.9.16 (2001-12-08) [umoeller] 182 192 } 183 193 … … 394 404 *@@added V0.9.5 (2000-08-26) [umoeller] 395 405 *@@changed V0.9.9 (2001-03-07) [umoeller]: added pcszThreadName 406 *@@changed V0.9.16 (2001-12-08) [umoeller]: fixed hang with thrWait 396 407 */ 397 408 … … 417 428 { 418 429 THREADINFO ti = {0}; 430 volatile unsigned long tidRunning = 0; 419 431 thrCreate(&ti, 420 432 pfn, 421 NULL,433 &tidRunning, 422 434 pcszThreadName, 423 435 THRF_PMMSGQUEUE, 424 436 ulData); 425 437 ti.hwndNotify = hwndNotify; 438 // create event sem to wait on V0.9.16 (2001-12-08) [umoeller] 439 DosCreateEventSem(NULL, 440 &ti.hevExitComplete, 441 0, 442 FALSE); // not posted 426 443 427 444 while (WinGetMsg(hab, … … 445 462 // otherwise THREADINFO is deleted from the stack 446 463 // before the thread exits... will crash! 447 thrWait(&ti); 464 // thrWait(&ti); 465 // now using event sem V0.9.16 (2001-12-08) [umoeller] 466 WinWaitEventSem(ti.hevExitComplete, 5000); 467 DosCloseEventSem(ti.hevExitComplete); 448 468 449 469 WinDestroyWindow(hwndNotify); … … 481 501 PLISTNODE pNode; 482 502 *pcThreads = lstCountItems(&G_llThreadInfos); 483 _Pmpf((__FUNCTION__ ": got %d threads", *pcThreads));484 503 pArray = (PTHREADINFO)malloc(*pcThreads * sizeof(THREADINFO)); 485 504 pThis = pArray; … … 561 580 * the thread will actually terminate. 562 581 * 582 * Update V0.9.16: Do not use this with PM theads at 583 * all. DosWaitThread can hang the system then. 584 * 563 585 * Returns FALSE if the thread wasn't running or TRUE 564 586 * if it was and has terminated. … … 631 653 { 632 654 if (pti) 633 if (!(pti->fExitComplete)) 634 return (pti->tid); 655 return (pti->tid); 635 656 636 657 return (NULLHANDLE);
Note:
See TracChangeset
for help on using the changeset viewer.