From 448f6003f922e0bfc7010bb2733421f76bbd8808 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 15 Feb 2007 14:08:21 +0100 Subject: Bug#25042 OPTIMIZE TABLE cause race condition in IO CACHE SHARE - The condition variable implementation "lost" a signal to WaitOnSingleObject when a semaphore was released. - The signal could be consumed by a new call to pthread_cond_wait before all waiting threads had awoken. - The new implementation of pthread_cond_* uses events instead of semaphores. It also uses an extra lock to protect entry into new cond wait before the broadcast has finished. include/my_pthread.h: - New implementatin of pthread_cond_init. This version uses events instead of semaphores mysys/my_wincond.c: - New implementatin of pthread_cond_init. This version uses events instead of semaphores --- include/my_pthread.h | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/my_pthread.h b/include/my_pthread.h index f5c7ad62a16..6552c9a265e 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -80,11 +80,17 @@ typedef struct st_pthread_link { typedef struct { uint32 waiting; -#ifdef OS2 - HEV semaphore; -#else - HANDLE semaphore; -#endif + CRITICAL_SECTION lock_waiting; + + enum { + SIGNAL= 0, + BROADCAST= 1, + MAX_EVENTS= 2 + } EVENTS; + + HANDLE events[MAX_EVENTS]; + HANDLE broadcast_block_event; + } pthread_cond_t; typedef int pthread_mutexattr_t; -- cgit v1.2.1