diff options
author | unknown <heikki@hundin.mysql.fi> | 2003-06-02 13:11:20 +0300 |
---|---|---|
committer | unknown <heikki@hundin.mysql.fi> | 2003-06-02 13:11:20 +0300 |
commit | 0ae3a4dcc134e97e48d266d4d1260d6c8c268659 (patch) | |
tree | 2c5725cba5b986c6857be7be12c3220e06d81809 /innobase/include/os0sync.h | |
parent | 3f7dfc4df3a9bdfc01e5b84c3297fff61b791f9b (diff) | |
download | mariadb-git-0ae3a4dcc134e97e48d266d4d1260d6c8c268659.tar.gz |
os0thread.h, os0sync.ic, os0sync.h, os0thread.c, os0sync.c, os0file.c:
Release all event semaphores at shutdown also in Windows
srv0start.c, srv0srv.c:
make test sometimes failed because lock timeout thread exited without decrementing the InnoDB thread counter
innobase/srv/srv0srv.c:
make test sometimes failed because lock timeout thread exited without decrementing the InnoDB thread counter
innobase/srv/srv0start.c:
make test sometimes failed because lock timeout thread exited without decrementing the InnoDB thread counter
innobase/os/os0file.c:
Release all event semaphores at shutdown also in Windows
innobase/os/os0sync.c:
Release all event semaphores at shutdown also in Windows
innobase/os/os0thread.c:
Release all event semaphores at shutdown also in Windows
innobase/include/os0sync.h:
Release all event semaphores at shutdown also in Windows
innobase/include/os0sync.ic:
Release all event semaphores at shutdown also in Windows
innobase/include/os0thread.h:
Release all event semaphores at shutdown also in Windows
Diffstat (limited to 'innobase/include/os0sync.h')
-rw-r--r-- | innobase/include/os0sync.h | 51 |
1 files changed, 33 insertions, 18 deletions
diff --git a/innobase/include/os0sync.h b/innobase/include/os0sync.h index bad8e6e120a..634507467f9 100644 --- a/innobase/include/os0sync.h +++ b/innobase/include/os0sync.h @@ -13,13 +13,26 @@ Created 9/6/1995 Heikki Tuuri #include "ut0lst.h" #ifdef __WIN__ + #define os_fast_mutex_t CRITICAL_SECTION -typedef HANDLE os_event_t; + +typedef HANDLE os_native_event_t; + +typedef struct os_event_struct os_event_struct_t; +typedef os_event_struct_t* os_event_t; + +struct os_event_struct { + os_native_event_t handle; + /* Windows event */ + UT_LIST_NODE_T(os_event_struct_t) os_event_list; + /* list of all created events */ +}; #else typedef pthread_mutex_t os_fast_mutex_t; typedef struct os_event_struct os_event_struct_t; typedef os_event_struct_t* os_event_t; + struct os_event_struct { os_fast_mutex_t os_mutex; /* this mutex protects the next fields */ @@ -39,16 +52,16 @@ typedef os_mutex_str_t* os_mutex_t; #define OS_SYNC_TIME_EXCEEDED 1 -/* Mutex protecting the thread count and event and OS 'slow' mutex lists */ +/* Mutex protecting counts and the event and OS 'slow' mutex lists */ extern os_mutex_t os_sync_mutex; /* This is incremented by 1 in os_thread_create and decremented by 1 in os_thread_exit */ extern ulint os_thread_count; -/* The following are approximate counters for debugging in Unix */ extern ulint os_event_count; extern ulint os_mutex_count; +extern ulint os_fast_mutex_count; /************************************************************* Initializes global event and OS 'slow' mutex lists. */ @@ -57,15 +70,14 @@ void os_sync_init(void); /*==============*/ /************************************************************* -Frees created events (not in Windows) and OS 'slow' mutexes. */ +Frees created events and OS 'slow' mutexes. */ void os_sync_free(void); /*==============*/ -/************************************************************* -Creates an event semaphore, i.e., a semaphore which may -just have two states: signaled and nonsignaled. -The created event is manual reset: it must be reset +/************************************************************* +Creates an event semaphore, i.e., a semaphore which may just have two states: +signaled and nonsignaled. The created event is manual reset: it must be reset explicitly by calling sync_os_reset_event. */ os_event_t @@ -74,10 +86,10 @@ os_event_create( /* out: the event handle */ char* name); /* in: the name of the event, if NULL the event is created without a name */ +#ifdef __WIN__ /************************************************************* -Creates an auto-reset event semaphore, i.e., an event -which is automatically reset when a single thread is -released. */ +Creates an auto-reset event semaphore, i.e., an event which is automatically +reset when a single thread is released. Works only in Windows. */ os_event_t os_event_create_auto( @@ -85,6 +97,7 @@ os_event_create_auto( /* out: the event handle */ char* name); /* in: the name of the event, if NULL the event is created without a name */ +#endif /************************************************************** Sets an event semaphore to the signaled state: lets waiting threads proceed. */ @@ -120,7 +133,7 @@ os_event_wait( os_event_t event); /* in: event to wait */ /************************************************************** Waits for an event object until it is in the signaled state or -a timeout is exceeded. */ +a timeout is exceeded. In Unix the timeout is always infinite. */ ulint os_event_wait_time( @@ -131,8 +144,9 @@ os_event_wait_time( os_event_t event, /* in: event to wait */ ulint time); /* in: timeout in microseconds, or OS_SYNC_INFINITE_TIME */ +#ifdef __WIN__ /************************************************************** -Waits for any event in an event array. Returns if even a single +Waits for any event in an OS native event array. Returns if even a single one is signaled or becomes signaled. */ ulint @@ -140,14 +154,15 @@ os_event_wait_multiple( /*===================*/ /* out: index of the event which was signaled */ - ulint n, /* in: number of events in the + ulint n, /* in: number of events in the array */ - os_event_t* event_array); /* in: pointer to an array of event + os_native_event_t* native_event_array); + /* in: pointer to an array of event handles */ +#endif /************************************************************* -Creates an operating system mutex semaphore. -Because these are slow, the mutex semaphore of the database -itself (sync_mutex_t) should be used where possible. */ +Creates an operating system mutex semaphore. Because these are slow, the +mutex semaphore of InnoDB itself (mutex_t) should be used where possible. */ os_mutex_t os_mutex_create( |