pthread lock and conditional initialization semantics
do not require that the lock structure be zeroed before
pthread_xxxx_init() functions are called. Since the Windows
CriticalSection initialization does require that the memory
be zeroed, the pthread_xxxx_init() functions must zero the
memory just in case before performing the CriticalSection
initialization.
Reviewed-on: http://gerrit.openafs.org/3904
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
(cherry picked from commit
ae11ef7898ecffe8eb2a38151602572c24e32a76)
Change-Id: I71092131183daa0627c21c328bd5e5bf182a0fc2
Reviewed-on: http://gerrit.openafs.org/3915
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
int rc = 0;
if ((mp != NULL) && (attr == NULL)) {
+ memset(mp, 0, sizeof(*mp));
InitializeCriticalSection(&mp->cs);
mp->isLocked = 0;
mp->tid = 0;
* attr parameter.
*/
if ((attr == NULL) && (cond != NULL)) {
+ memset(cond, 0, sizeof(*cond));
InitializeCriticalSection(&cond->cs);
queue_Init(&cond->waiting_threads);
} else {
static pthread_once_t waiter_cache_once = PTHREAD_ONCE_INIT;
static void init_waiter_cache(void) {
+ if (waiter_cache_init)
+ return;
+
+ memset(&waiter_cache_cs, 0, sizeof(waiter_cache_cs));
InitializeCriticalSection(&waiter_cache_cs);
queue_Init(&waiter_cache);
waiter_cache_init = 1;