Changeset 1882 for trunk


Ignore:
Timestamp:
Apr 24, 2005, 1:21:09 AM (20 years ago)
Author:
bird
Message:

Minimum and default stack sizes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/src/lib/process/beginthr.c

    • Property cvs2svn:cvs-rev changed from 1.13 to 1.14
    r1881 r1882  
    1515#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_THREAD
    1616#include <InnoTekLIBC/logstrict.h>
     17#include <386/builtin.h>
    1718
    1819/**
     
    5556    __LIBC_PTHREAD  pThrd;
    5657    FS_VAR();
     58
     59    /*
     60     * Initialize the minimum stack mark on the first call run.
     61     */
     62    static size_t   cbStackMin;
     63    if (!cbStackMin)
     64    {
     65        const char *psz = getenv("LIBC_THREAD_MIN_STACK_SIZE");
     66        int cb = 4096;
     67        if (psz)
     68        {
     69            cb = atol(psz);
     70            if (!cb)
     71                cb = 512*1024;
     72        }
     73        __atomic_xchg((unsigned volatile *)&cbStackMin, cb);
     74    }
     75
     76    /*
     77     * Adjust the stack size.
     78     */
     79    if (!cbStack)
     80        cbStack = 512*1024;             /* Default stack size is 512 KB. */
     81    if (cbStack < cbStackMin)
     82        cbStack = cbStackMin;
    5783
    5884    /*
Note: See TracChangeset for help on using the changeset viewer.