Changeset 2798
- Timestamp:
- Aug 28, 2006, 4:01:31 AM (19 years ago)
- Location:
- branches/libc-0.6/src/emx
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified branches/libc-0.6/src/emx/ChangeLog.LIBC ¶
r2796 r2798 5 5 2006-08-27: knut st. osmundsen <bird-gccos2-spam@anduin.net> 6 6 - libc: 7 o Lock the thread database before forking. Fixes #102. 7 8 o Fixed log problem in fork() child. Fixes #119. 8 9 o Corrected DosSetFHState mask. Fixes #118. -
TabularUnified branches/libc-0.6/src/emx/src/lib/process/thread_internals.c ¶
r2254 r2798 28 28 * Header Files * 29 29 *******************************************************************************/ 30 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_THREAD 30 31 #include "libc-alias.h" 31 32 #undef NDEBUG 32 #include < 386/builtin.h>33 #include <sys/builtin.h> 33 34 #include <assert.h> 34 35 #include <string.h> … … 63 64 /** Number of threads in the zombie thread database. (Protected gmtxThrdDB.) */ 64 65 static unsigned gcThrdDBZombies; 66 /** Fork cleanup indicator. */ 67 static unsigned gfForkCleanupDone; 65 68 66 69 /** Head of the thread termination callback list. */ … … 510 513 LIBCLOG_RETURN_VOID(); 511 514 } 515 516 517 #undef __LIBC_LOG_GROUP 518 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_FORK 519 520 521 /** 522 * Fork completion callback used to release the thread db lock. 523 * 524 * @param pvArg NULL. 525 * @param rc The fork() result. Negative on failure. 526 * @param enmCtx The calling context. 527 */ 528 static void threadForkCompletion(void *pvArg, int rc, __LIBC_FORKCTX enmCtx) 529 { 530 LIBCLOG_ENTER("pvArg=%p rc=%d enmCtx=%d - gfForkCleanupDone=%d\n", pvArg, rc, enmCtx, gfForkCleanupDone); 531 532 if (!gfForkCleanupDone) 533 { 534 LIBCLOG_MSG("Unlocking the thread DB.\n"); 535 if (enmCtx == __LIBC_FORK_CTX_PARENT) 536 _fmutex_release(&gmtxThrdDB); 537 else 538 _fmutex_release_fork(&gmtxThrdDB); 539 gfForkCleanupDone = 1; 540 } 541 LIBCLOG_RETURN_VOID(); 542 } 543 544 545 /** 546 * Parent fork callback for locking down the thread db while forking. 547 * 548 * @returns 0 on success. 549 * @returns -errno on failure. 550 * @param pForkHandle Pointer to fork handle. 551 * @param enmOperation Fork operation. 552 */ 553 static int threadForkParent1(__LIBC_PFORKHANDLE pForkHandle, __LIBC_FORKOP enmOperation) 554 { 555 LIBCLOG_ENTER("pForkHandle=%p enmOperation=%d\n", (void *)pForkHandle, enmOperation); 556 557 if (enmOperation != __LIBC_FORK_OP_EXEC_PARENT) 558 LIBCLOG_RETURN_INT(0); 559 560 /* 561 * Lock the thread database before fork() and schedule an unlocking completion callback. 562 */ 563 LIBCLOG_MSG("Locking the thead DB.\n"); 564 if (_fmutex_request(&gmtxThrdDB, 0)) 565 LIBCLOG_ERROR_RETURN_INT(-EDEADLK); 566 567 gfForkCleanupDone = 0; 568 int rc = pForkHandle->pfnCompletionCallback(pForkHandle, threadForkCompletion, NULL, __LIBC_FORK_CTX_BOTH); 569 if (rc >= 0) 570 LIBCLOG_RETURN_INT(rc); 571 572 _fmutex_release(&gmtxThrdDB); 573 LIBCLOG_ERROR_RETURN_INT(rc); 574 } 575 576 577 _FORK_PARENT1(0xffffff02, threadForkParent1) 578
Note:
See TracChangeset
for help on using the changeset viewer.