Ignore:
Timestamp:
Feb 7, 2001, 7:30:59 PM (25 years ago)
Author:
umoeller
Message:

misc. changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/helpers/threads.c

    r22 r33  
    182182 *         to the caller.
    183183 *
     184 *      This now (V0.9.9) returns the TID of the new thread or
     185 *      null on errors.
     186 *
    184187 *@@changed V0.9.0 [umoeller]: default stack size raised for Watcom (thanks, Rdiger Ihle)
    185188 *@@changed V0.9.0 [umoeller]: _beginthread is now only called after all variables have been set (thanks, Rdiger Ihle)
     
    190193 *@@changed V0.9.5 (2000-08-26) [umoeller]: now using PTHREADINFO
    191194 *@@changed V0.9.7 (2000-12-18) [lafaix]: THRF_TRANSIENT support added
    192  */
    193 
    194 BOOL thrCreate(PTHREADINFO pti,     // out: THREADINFO data
    195                PTHREADFUNC pfn,     // in: _Optlink thread function
    196                PBOOL pfRunning,     // out: variable set to TRUE while thread is running;
    197                                     // ptr can be NULL
    198                ULONG flFlags,       // in: THRF_* flags
    199                ULONG ulData)        // in: user data to be stored in THREADINFO
    200 {
    201     BOOL            rc = FALSE;
     195 *@@changed V0.9.9 (2000-02-06) [umoeller]: now returning TID
     196 */
     197
     198ULONG thrCreate(PTHREADINFO pti,     // out: THREADINFO data
     199                PTHREADFUNC pfn,     // in: _Optlink thread function
     200                PBOOL pfRunning,     // out: variable set to TRUE while thread is running;
     201                                     // ptr can be NULL
     202                ULONG flFlags,       // in: THRF_* flags
     203                ULONG ulData)        // in: user data to be stored in THREADINFO
     204{
     205    ULONG ulrc = 0;     // V0.9.9 (2000-02-06) [umoeller]
    202206
    203207    // (2000-12-18) [lafaix] TRANSIENT
     
    206210        if (pti == NULL)
    207211            pti = (PTHREADINFO) malloc(sizeof(THREADINFO));
    208         else
    209             return (rc);
    210212    }
    211213
     
    223225        pti->ulData = ulData;
    224226
    225         rc = TRUE;
    226 
    227227        if (flFlags & THRF_WAIT)
    228228            // "Wait" flag set: create an event semaphore which
     
    233233                                  FALSE)    // not posted (reset)
    234234                    != NO_ERROR)
    235                 rc = FALSE;
    236 
    237         pti->fExit = FALSE;
    238 
    239         if (rc)
     235            {
     236                if (flFlags & THRF_TRANSIENT)
     237                    free(pti);
     238
     239                // stop right here
     240                pti = NULL;
     241            }
     242
     243        if (pti)
    240244        {
    241245            pti->tid = _beginthread(        // moved, V0.9.0 (hint: Rdiger Ihle)
     
    244248                                    3*96000, // plenty of stack
    245249                                    pti);   // parameter passed to thread
    246             rc = (pti->tid != 0);
    247 
    248             if (rc)
     250            ulrc = pti->tid;
     251
     252            if (ulrc)
    249253                if (flFlags & THRF_WAIT)
    250254                {
     
    257261    }
    258262
    259     return (rc);
     263    return (ulrc);
    260264}
    261265
Note: See TracChangeset for help on using the changeset viewer.