Changeset 3641 for trunk


Ignore:
Timestamp:
May 18, 2008, 2:11:03 PM (18 years ago)
Author:
bird
Message:

Moved the spawn wait hack into spm and made it a passive wait.

Location:
trunk/libc
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/libc/include/InnoTekLIBC/sharedpm.h

    r2937 r3641  
    697697
    698698/**
     699
     700
     701
     702
     703
     704
     705
     706
     707
    699708 * Searches for a process given by pid.
    700709 *
  • trunk/libc/src/kNIX/os2/__spawnve.c

    r3635 r3641  
    531531                 * If we figure that it's a libc child, we can wait a good deal longer.
    532532                 */
    533                 /** @todo add a SPM notification for when inherit is completed. */
    534                 __LIBC_SPMLOADAVG LoadAvg;
    535                 unsigned uLoadAvgTS;
    536                 int fDoneInherit;
    537                 ULONG ulStart = fibGetMsCount();
    538                 rc = 0;
    539                 while (     (fDoneInherit = pEmbryo->enmState >= __LIBC_PROCSTATE_ALIVE
    540                                          || (pEmbryo->pInherit == NULL && pEmbryo->pInheritLocked == NULL)
    541                             ) == 0
    542                        &&   fibGetMsCount() - ulStart <= 8)
    543                 {
    544                     DosSleep(rc++ > 4);
    545                     __libc_spmGetLoadAvg(&LoadAvg, &uLoadAvgTS); /* SMP HACK */
    546                 }
    547                 if (    !fDoneInherit
    548                     &&  pEmbryo->enmState == __LIBC_PROCSTATE_ALIVE)
    549                 {
    550                     LIBCLOG_MSG("libc child - wait some more (rc=%d)\n", rc);
    551                     rc = 0;
    552                     __libc_spmGetLoadAvg(&LoadAvg, &uLoadAvgTS); /* SMP HACK */
    553                     while (     (fDoneInherit = pEmbryo->enmState >= __LIBC_PROCSTATE_ALIVE
    554                                              || (pEmbryo->pInherit == NULL && pEmbryo->pInheritLocked == NULL)
    555                                 ) == 0
    556                            &&   fibGetMsCount() - ulStart <= 100)
    557                     {
    558                         DosSleep(rc++ > 4);
    559                         __libc_spmGetLoadAvg(&LoadAvg, &uLoadAvgTS); /* SMP HACK */
    560                     }
    561                 }
    562                 LIBCLOG_MSG("fDoneInherit=%d rc=%d enmState=%d inh=%p,%p - waited %d ms\n",
    563                             fDoneInherit, rc, pEmbryo->enmState, pEmbryo->pInherit, pEmbryo->pInheritLocked, fibGetMsCount() - ulStart);
     533                int fDoneInherit = __libc_spmWaitForChildToBecomeAlive(pEmbryo);
     534                LIBCLOG_MSG("fDoneInherit=%d enmState=%d inh=%p,%p\n",
     535                            fDoneInherit, pEmbryo->enmState, pEmbryo->pInherit, pEmbryo->pInheritLocked);
    564536
    565537                /*
     
    634606                        {
    635607                            LIBCLOG_MSG("waiting some more...\n");
    636                             do
    637                             {
    638                                 DosSleep(!(rc++ % 3));
    639                                 __libc_spmGetLoadAvg(&LoadAvg, &uLoadAvgTS); /* SMP HACK */
    640                                 fDoneInherit = pEmbryo->enmState > __LIBC_PROCSTATE_ALIVE
    641                                             || (pEmbryo->pInherit == NULL && pEmbryo->pInheritLocked == NULL);
    642                             } while (!fDoneInherit
    643                                   && fibGetMsCount() - ulStart <= 200);
    644                             LIBCLOG_MSG("fDoneInherit=%d rc=%d enmState=%d inh=%p,%p - waited %d ms\n",
    645                                         fDoneInherit, rc, pEmbryo->enmState, pEmbryo->pInherit, pEmbryo->pInheritLocked, fibGetMsCount() - ulStart);
     608                            fDoneInherit = __libc_spmWaitForChildToBecomeAlive(pEmbryo);
     609                            LIBCLOG_MSG("fDoneInherit=%d enmState=%d inh=%p,%p\n",
     610                                        fDoneInherit, pEmbryo->enmState, pEmbryo->pInherit, pEmbryo->pInheritLocked);
    646611                        }
    647612
  • trunk/libc/src/kNIX/os2/sharedpm.c

    r3373 r3641  
    2525 *
    2626 */
     27
    2728
    2829/** @todo
     
    461462            LIBC_ASSERTM(!gpSPMSelf->pInheritLocked, "Trying to free a locked inherit struct!\n");
    462463
    463             spmReleaseMutex(&RegRec);
     464            LIBCLOG_MSG("posting %#lx\n", gpSPMHdr->hevNotify);
     465            APIRET rc2 = DosPostEventSem(gpSPMHdr->hevNotify);
     466            spmReleaseMutex(&RegRec);
     467            LIBC_ASSERTM(!rc2, "rc2=%ld!\n", rc2); rc2 = rc2;
    464468        }
    465469    }
     
    596600
    597601/**
     602
     603
     604
     605
     606
     607
     608
     609
     610
     611
     612
     613
     614
     615
     616
     617
     618
     619
     620
     621
     622
     623
     624
     625
     626
     627
     628
     629
     630
     631
     632
     633
     634
     635
     636
     637
     638
     639
     640
     641
     642
     643
     644
     645
     646
     647
     648
     649
     650
     651
     652
     653
     654
     655
     656
     657
     658
     659
     660
     661
     662
     663
     664
     665
     666
     667
     668
     669
     670
     671
     672
     673
     674
     675
     676
     677
     678
     679
     680
     681
     682
     683
     684
     685
     686
     687
     688
     689
     690
    598691 * Searches for a process given by pid.
    599692 *
     
    22822375            if (!gpSPMHdr->cSigMaxActive)
    22832376                gpSPMHdr->cSigMaxActive = 1024;
     2377
     2378
     2379
     2380
    22842381        }
    22852382        else
     
    23432440        {
    23442441            /*
    2345              * Register the current process and increment open counter.
     2442             * Register the current process, increment open counter,
     2443             * and notify everyone that spm data has changed.
    23462444             */
    23472445            PLINFOSEG pLIS = GETLINFOSEG();
    23482446            spmRegisterSelf(pPib->pib_ulpid, pPib->pib_ulppid, pLIS->sgCurrent);
    23492447            if (gpSPMSelf)
     2448
    23502449                gpSPMSelf->cSPMOpens++;
     2450
     2451
     2452
     2453
     2454
    23512455
    23522456            /*
     
    25292633                    *pParent->ppChildNotifyTail = pTerm;
    25302634                    pParent->ppChildNotifyTail = &pTerm->pNext;
    2531                     DosPostEventSem(gpSPMHdr->hevNotify);
     2635                   
     2636                    LIBCLOG_MSG("posting %#lx\n", gpSPMHdr->hevNotify);
     2637                    APIRET rc2 = DosPostEventSem(gpSPMHdr->hevNotify);
     2638                    LIBC_ASSERTM(!rc2, "rc2=%ld!\n", rc2); rc2 = rc2;
    25322639                }
    25332640                else
     
    31513258
    31523259                /* post notification sem. */
    3153                 DosPostEventSem(gpSPMHdr->hevNotify);
     3260                LIBCLOG_MSG("posting %#lx\n", gpSPMHdr->hevNotify);
     3261                APIRET rc2 = DosPostEventSem(gpSPMHdr->hevNotify);
     3262                LIBC_ASSERTM(!rc2, "rc2=%ld!\n", rc2); rc2 = rc2;
    31543263            }
    31553264            else
     
    33533462                    spmFreeProcess(pProcess);
    33543463                    pProcess = pProcessNext;
     3464
     3465
     3466
     3467
     3468
    33553469                    continue;
    33563470                }
     
    34443558                        spmFreeProcess(pProcess);
    34453559                        pProcess = pProcessNext;
     3560
     3561
     3562
     3563
     3564
    34463565                        continue;
    34473566                    }
Note: See TracChangeset for help on using the changeset viewer.