summaryrefslogtreecommitdiff
path: root/include/my_pthread.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/my_pthread.h')
-rw-r--r--include/my_pthread.h57
1 files changed, 24 insertions, 33 deletions
diff --git a/include/my_pthread.h b/include/my_pthread.h
index 1b35d0fdd0d..17813047ce5 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -312,6 +312,8 @@ int my_pthread_mutex_trylock(pthread_mutex_t *mutex);
#endif
#endif
+size_t my_setstacksize(pthread_attr_t *attr, size_t stacksize);
+
/*
The defines set_timespec and set_timespec_nsec should be used
for calculating an absolute time at which
@@ -581,36 +583,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;
@@ -719,22 +698,34 @@ extern void my_mutex_end(void);
#define INSTRUMENT_ME 0
+/*
+ Thread specific variables
+
+ Aria key cache is using the following variables for keeping track of
+ state:
+ suspend, next, prev, keycache_link, keycache_file, suspend, lock_type
+
+ MariaDB uses the following to
+ mutex, current_mutex, current_cond, abort
+*/
+
struct st_my_thread_var
{
int thr_errno;
mysql_cond_t suspend;
mysql_mutex_t mutex;
+ struct st_my_thread_var *next,**prev;
mysql_mutex_t * volatile current_mutex;
mysql_cond_t * volatile current_cond;
+ void *keycache_link;
+ void *keycache_file;
+ void *stack_ends_here;
+ safe_mutex_t *mutex_in_use;
pthread_t pthread_self;
my_thread_id id, dbug_id;
int volatile abort;
+ uint lock_type; /* used by conditional release the queue */
my_bool init;
- struct st_my_thread_var *next,**prev;
- void *keycache_link;
- uint lock_type; /* used by conditional release the queue */
- void *stack_ends_here;
- safe_mutex_t *mutex_in_use;
#ifndef DBUG_OFF
void *dbug;
char name[THREAD_NAME_SIZE+1];