diff options
Diffstat (limited to 'storage/innobase/os/os0sync.cc')
-rw-r--r-- | storage/innobase/os/os0sync.cc | 45 |
1 files changed, 18 insertions, 27 deletions
diff --git a/storage/innobase/os/os0sync.cc b/storage/innobase/os/os0sync.cc index c2e2e7e477f..392dbe0d7a7 100644 --- a/storage/innobase/os/os0sync.cc +++ b/storage/innobase/os/os0sync.cc @@ -38,7 +38,7 @@ Created 9/6/1995 Heikki Tuuri #include "srv0srv.h" /* Type definition for an operating system mutex struct */ -struct os_mutex_struct{ +struct os_mutex_t{ os_event_t event; /*!< Used by sync0arr.cc for queing threads */ void* handle; /*!< OS handle to mutex */ ulint count; /*!< we use this counter to check @@ -47,12 +47,12 @@ struct os_mutex_struct{ do not assume that the OS mutex supports recursive locking, though NT seems to do that */ - UT_LIST_NODE_T(os_mutex_str_t) os_mutex_list; + UT_LIST_NODE_T(os_mutex_t) os_mutex_list; /* list of all 'slow' OS mutexes created */ }; /** Mutex protecting counts and the lists of OS mutexes and events */ -UNIV_INTERN os_mutex_t os_sync_mutex; +UNIV_INTERN os_ib_mutex_t os_sync_mutex; /** TRUE if os_sync_mutex has been initialized */ static ibool os_sync_mutex_inited = FALSE; /** TRUE when os_sync_free() is being executed */ @@ -63,10 +63,10 @@ os_thread_exit */ UNIV_INTERN ulint os_thread_count = 0; /** The list of all events created */ -static UT_LIST_BASE_NODE_T(os_event_struct_t) os_event_list; +static UT_LIST_BASE_NODE_T(os_event) os_event_list; /** The list of all OS 'slow' mutexes */ -static UT_LIST_BASE_NODE_T(os_mutex_str_t) os_mutex_list; +static UT_LIST_BASE_NODE_T(os_mutex_t) os_mutex_list; UNIV_INTERN ulint os_event_count = 0; UNIV_INTERN ulint os_mutex_count = 0; @@ -329,7 +329,7 @@ os_sync_free(void) /*==============*/ { os_event_t event; - os_mutex_t mutex; + os_ib_mutex_t mutex; os_sync_free_called = TRUE; event = UT_LIST_GET_FIRST(os_event_list); @@ -365,10 +365,8 @@ must be reset explicitly by calling sync_os_reset_event. @return the event handle */ UNIV_INTERN os_event_t -os_event_create( -/*============*/ - const char* name) /*!< in: the name of the event, if NULL - the event is created without a name */ +os_event_create(void) +/*==================*/ { os_event_t event; @@ -377,10 +375,7 @@ os_event_create( event = static_cast<os_event_t>(ut_malloc(sizeof(*event))); - event->handle = CreateEvent(NULL, - TRUE, - FALSE, - (LPCTSTR) name); + event->handle = CreateEvent(NULL, TRUE, FALSE, NULL); if (!event->handle) { fprintf(stderr, "InnoDB: Could not create a Windows event" @@ -390,10 +385,7 @@ os_event_create( } else /* Windows with condition variables */ #endif { - UT_NOT_USED(name); - - event = static_cast<os_event_struct_t*>( - ut_malloc(sizeof(struct os_event_struct))); + event = static_cast<os_event_t>(ut_malloc(sizeof *event)); #ifndef PFS_SKIP_EVENT_MUTEX os_fast_mutex_init(event_os_mutex_key, &event->os_mutex); @@ -739,27 +731,26 @@ os_event_wait_time_low( /*********************************************************//** Creates an operating system mutex semaphore. Because these are slow, the -mutex semaphore of InnoDB itself (mutex_t) should be used where possible. +mutex semaphore of InnoDB itself (ib_mutex_t) should be used where possible. @return the mutex handle */ UNIV_INTERN -os_mutex_t +os_ib_mutex_t os_mutex_create(void) /*=================*/ { os_fast_mutex_t* mutex; - os_mutex_t mutex_str; + os_ib_mutex_t mutex_str; mutex = static_cast<os_fast_mutex_t*>( ut_malloc(sizeof(os_fast_mutex_t))); os_fast_mutex_init(os_mutex_key, mutex); - mutex_str = static_cast<os_mutex_t>( - ut_malloc(sizeof(os_mutex_str_t))); + mutex_str = static_cast<os_ib_mutex_t>(ut_malloc(sizeof *mutex_str)); mutex_str->handle = mutex; mutex_str->count = 0; - mutex_str->event = os_event_create(NULL); + mutex_str->event = os_event_create(); if (UNIV_LIKELY(os_sync_mutex_inited)) { /* When creating os_sync_mutex itself we cannot reserve it */ @@ -783,7 +774,7 @@ UNIV_INTERN void os_mutex_enter( /*===========*/ - os_mutex_t mutex) /*!< in: mutex to acquire */ + os_ib_mutex_t mutex) /*!< in: mutex to acquire */ { os_fast_mutex_lock(static_cast<os_fast_mutex_t*>(mutex->handle)); @@ -798,7 +789,7 @@ UNIV_INTERN void os_mutex_exit( /*==========*/ - os_mutex_t mutex) /*!< in: mutex to release */ + os_ib_mutex_t mutex) /*!< in: mutex to release */ { ut_a(mutex); @@ -814,7 +805,7 @@ UNIV_INTERN void os_mutex_free( /*==========*/ - os_mutex_t mutex) /*!< in: mutex to free */ + os_ib_mutex_t mutex) /*!< in: mutex to free */ { ut_a(mutex); |