Changeset 3371
- Timestamp:
- May 27, 2007, 8:37:38 AM (18 years ago)
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/libc-0.6/src/emx/src/lib/sys/logstrict.c
r2796 r3371 611 611 static void __libc_logWrite(__LIBC_PLOGINST pInst, unsigned fGroupAndFlags, const char *pszMsg, size_t cch, int fStdErr) 612 612 { 613 APIRET rc; 613 APIRET rcSem; 614 APIRET rcMC; 615 ULONG ulIgnore = 0; 614 616 ULONG cb = 0; 615 617 HMTX hmtx = pInst->hmtx; … … 619 621 /* 620 622 * Aquire mutex ownership. 621 */ 622 rc = DosRequestMutexSem(hmtx, SEM_INDEFINITE_WAIT); 623 switch (rc) 624 { 625 case 0: 623 * We enter a must-complete section here to avoid getting interrupted 624 * while writing and creating deadlocks. 625 */ 626 rcMC = DosEnterMustComplete(&ulIgnore); 627 rcSem = DosRequestMutexSem(hmtx, 5000); 628 switch (rcSem) 629 { 630 case NO_ERROR: 626 631 break; 632 627 633 /* recreate the semaphore for some odd. */ 628 634 case ERROR_INVALID_HANDLE: … … 630 636 { 631 637 HMTX hmtxNew; 632 rc = DosCreateMutexSem(NULL, &hmtxNew, 0, TRUE);633 if (!rc )638 rcSem = DosCreateMutexSem(NULL, &hmtxNew, 0, TRUE); 639 if (!rcSem) 634 640 { 635 641 hmtx = __lxchg((int*)&pInst->hmtx, hmtxNew); … … 647 653 if (fGroupAndFlags & __LIBC_LOG_MSGF_FLUSH) 648 654 DosResetBuffer(pInst->hFile); 649 if (!rc )655 if (!rcSem) 650 656 DosReleaseMutexSem(pInst->hmtx); 657 if (!rcMC) 658 DosExitMustComplete(&ulIgnore); 651 659 FS_RESTORE(); 652 660 -
trunk/libc/src/kNIX/os2/logstrict.c
r2929 r3371 592 592 static void __libc_logWrite(__LIBC_PLOGINST pInst, unsigned fGroupAndFlags, const char *pszMsg, size_t cch, int fStdErr) 593 593 { 594 APIRET rc; 594 APIRET rcSem; 595 APIRET rcMC; 596 ULONG ulIgnore = 0; 595 597 ULONG cb = 0; 596 598 HMTX hmtx = pInst->hmtx; … … 600 602 /* 601 603 * Aquire mutex ownership. 602 */ 603 rc = DosRequestMutexSem(hmtx, SEM_INDEFINITE_WAIT); 604 switch (rc) 605 { 606 case 0: 604 * We enter a must-complete section here to avoid getting interrupted 605 * while writing and creating deadlocks. 606 */ 607 rcMC = DosEnterMustComplete(&ulIgnore); 608 rcSem = DosRequestMutexSem(hmtx, 5000); 609 switch (rcSem) 610 { 611 case NO_ERROR: 607 612 break; 613 608 614 /* recreate the semaphore for some odd. */ 609 615 case ERROR_INVALID_HANDLE: … … 611 617 { 612 618 HMTX hmtxNew; 613 rc = DosCreateMutexSem(NULL, &hmtxNew, 0, TRUE);614 if (!rc )619 rcSem = DosCreateMutexSem(NULL, &hmtxNew, 0, TRUE); 620 if (!rcSem) 615 621 { 616 622 hmtx = __lxchg((int*)&pInst->hmtx, hmtxNew); … … 628 634 if (fGroupAndFlags & __LIBC_LOG_MSGF_FLUSH) 629 635 DosResetBuffer(pInst->hFile); 630 if (!rc )636 if (!rcSem) 631 637 DosReleaseMutexSem(pInst->hmtx); 638 if (!rcMC) 639 DosExitMustComplete(&ulIgnore); 632 640 FS_RESTORE(); 633 641
Note:
See TracChangeset
for help on using the changeset viewer.