version 1.23, 2012/07/09 09:01:47
|
version 1.24, 2012/12/10 12:57:28
|
|
|
// Acquire mutex to enter critical section. | // Acquire mutex to enter critical section. |
pthread_mutex_lock(&_rep.mutex); | pthread_mutex_lock(&_rep.mutex); |
| |
// Push cleanup function onto cleanup stack |
|
// The mutex will unlock if the thread is killed early |
|
#if defined(PEGASUS_PLATFORM_AIX_RS_IBMCXX) \ |
|
|| defined(PEGASUS_PLATFORM_PASE_ISERIES_IBMCXX) |
|
Threads::cleanup_push(&semaphore_cleanup, &_rep); |
|
#endif |
|
|
|
// Keep track of the number of waiters so that <sema_post> works correctly. | // Keep track of the number of waiters so that <sema_post> works correctly. |
_rep.waiters++; | _rep.waiters++; |
| |
|
|
// Since we push an unlock onto the cleanup stack | // Since we push an unlock onto the cleanup stack |
// We will pop it off to release the mutex when leaving the critical | // We will pop it off to release the mutex when leaving the critical |
// section. | // section. |
#if defined(PEGASUS_PLATFORM_AIX_RS_IBMCXX) \ |
|
|| defined(PEGASUS_PLATFORM_PASE_ISERIES_IBMCXX) |
|
Threads::cleanup_pop(1); |
|
#endif |
|
// Release mutex to leave critical section. | // Release mutex to leave critical section. |
pthread_mutex_unlock(&_rep.mutex); | pthread_mutex_unlock(&_rep.mutex); |
} | } |
|
|
pthread_mutex_lock(&_rep.mutex); | pthread_mutex_lock(&_rep.mutex); |
Boolean timedOut = false; | Boolean timedOut = false; |
| |
#if defined(PEGASUS_PLATFORM_AIX_RS_IBMCXX) \ |
|
|| defined(PEGASUS_PLATFORM_PASE_ISERIES_IBMCXX) |
|
// Push cleanup function onto cleanup stack |
|
// The mutex will unlock if the thread is killed early |
|
Threads::cleanup_push(&semaphore_cleanup, &_rep); |
|
#endif |
|
|
|
// Keep track of the number of waiters so that <sema_post> works correctly. | // Keep track of the number of waiters so that <sema_post> works correctly. |
_rep.waiters++; | _rep.waiters++; |
| |
|
|
// Decrement the waiters count. | // Decrement the waiters count. |
_rep.waiters--; | _rep.waiters--; |
| |
#if defined(PEGASUS_PLATFORM_AIX_RS_IBMCXX) \ |
|
|| defined(PEGASUS_PLATFORM_PASE_ISERIES_IBMCXX) |
|
// Since we push an unlock onto the cleanup stack |
|
// We will pop it off to release the mutex when leaving the critical |
|
// section. |
|
Threads::cleanup_pop(1); |
|
#endif |
|
|
|
// Release mutex to leave critical section. | // Release mutex to leave critical section. |
pthread_mutex_unlock(&_rep.mutex); | pthread_mutex_unlock(&_rep.mutex); |
| |