version 1.10, 2007/06/05 09:44:14
|
version 1.10.8.1, 2007/11/09 18:59:30
|
|
|
| |
//============================================================================== | //============================================================================== |
// | // |
// Thread id TSD: |
|
// |
|
//============================================================================== |
|
|
|
static Once _once = PEGASUS_ONCE_INITIALIZER; |
|
static TSDKeyType _key; |
|
|
|
static void _create_key() |
|
{ |
|
TSDKey::create(&_key); |
|
} |
|
|
|
static inline void _set_id_tsd(Uint32 id) |
|
{ |
|
once(&_once, _create_key); |
|
TSDKey::set_thread_specific(_key, (void*)(long)id); |
|
} |
|
|
|
static inline Uint32 _get_id_tsd() |
|
{ |
|
once(&_once, _create_key); |
|
void* ptr = TSDKey::get_thread_specific(_key); |
|
|
|
if (!ptr) |
|
{ |
|
// Main thread's id is 1! |
|
return 1; |
|
} |
|
|
|
return (Uint32)(long)ptr; |
|
} |
|
|
|
//============================================================================== |
|
// |
|
// _get_stack_multiplier() | // _get_stack_multiplier() |
// | // |
//============================================================================== | //============================================================================== |
|
|
} | } |
| |
return _multiplier; | return _multiplier; |
#else |
#elif defined(PEGASUS_PLATFORM_HPUX_PARISC_ACC) |
return 2; | return 2; |
|
#else |
|
return 1; |
#endif | #endif |
} | } |
| |
|
|
| |
// Stack size: | // Stack size: |
| |
#if defined(PEGASUS_PLATFORM_HPUX_PARISC_ACC) || defined(PEGASUS_OS_VMS) |
int multiplier = _get_stack_multiplier(); |
|
|
|
if (multiplier != 1) |
{ | { |
size_t stacksize; | size_t stacksize; |
| |
if (pthread_attr_getstacksize(&attr, &stacksize) == 0) | if (pthread_attr_getstacksize(&attr, &stacksize) == 0) |
{ | { |
int m = _get_stack_multiplier(); |
int rc = pthread_attr_setstacksize(&attr, stacksize * multiplier); |
int rc = pthread_attr_setstacksize(&attr, stacksize * m); |
|
PEGASUS_ASSERT(rc == 0); | PEGASUS_ASSERT(rc == 0); |
} | } |
} | } |
#endif |
|
| |
// Scheduling policy: | // Scheduling policy: |
| |