summaryrefslogtreecommitdiff
path: root/include/my_pthread.h
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2019-06-17 21:54:44 +0100
committerVladislav Vaintroub <wlad@mariadb.com>2019-06-18 00:37:09 +0100
commit73be875c8ec65744a56465bf88ad99e336dcd62a (patch)
treead07e919d9e76073267176e1b378696ca07d42de /include/my_pthread.h
parent4156b1a2602915d6adf983e5c8efaa4f41df3d21 (diff)
downloadmariadb-git-73be875c8ec65744a56465bf88ad99e336dcd62a.tar.gz
MDEV-19773 : simplify implementation of Windows rwlock
No need to do dynamic loading and fallbacks anymore. We can safely assume Windows 7, and availability of all SRWLock functions.
Diffstat (limited to 'include/my_pthread.h')
-rw-r--r--include/my_pthread.h33
1 files changed, 5 insertions, 28 deletions
diff --git a/include/my_pthread.h b/include/my_pthread.h
index 8650ed626c3..ff892863800 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -581,36 +581,13 @@ extern int rw_pr_destroy(rw_pr_lock_t *);
/**
Implementation of Windows rwlock.
- We use native (slim) rwlocks on Win7 and later, and fallback to portable
- implementation on earlier Windows.
-
- slim rwlock are also available on Vista/WS2008, but we do not use it
- ("trylock" APIs are missing on Vista)
+ We use native (slim) rwlocks on Windows, which requires Win7
+ or later.
*/
-typedef union
+typedef struct _my_rwlock_t
{
- /* Native rwlock (is_srwlock == TRUE) */
- struct
- {
- SRWLOCK srwlock; /* native reader writer lock */
- BOOL have_exclusive_srwlock; /* used for unlock */
- };
-
- /*
- Portable implementation (is_srwlock == FALSE)
- Fields are identical with Unix my_rw_lock_t fields.
- */
- struct
- {
- pthread_mutex_t lock; /* lock for structure */
- pthread_cond_t readers; /* waiting readers */
- pthread_cond_t writers; /* waiting writers */
- int state; /* -1:writer,0:free,>0:readers */
- int waiters; /* number of waiting writers */
-#ifdef SAFE_MUTEX
- pthread_t write_thread;
-#endif
- };
+ SRWLOCK srwlock; /* native reader writer lock */
+ BOOL have_exclusive_srwlock; /* used for unlock */
} my_rw_lock_t;