mirror of
https://github.com/MariaDB/server.git
synced 2025-01-22 14:54:20 +01:00
Addresses #1296
Global mutexes are now initialized in toku_ydb_init, destroyed in toku_ydb_destroy. Globals in tdbtrace.c (not default) are not yet initialized. git-svn-id: file:///svn/toku/tokudb.1032b@8149 c7de825b-a66e-492c-adef-691d508d4ae1
This commit is contained in:
parent
373892cbda
commit
ca79f7aed3
4 changed files with 31 additions and 0 deletions
|
@ -46,6 +46,14 @@ static void maybe_preallocate_in_file (int fd, u_int64_t size) {
|
|||
static toku_pthread_mutex_t pwrite_mutex = TOKU_PTHREAD_MUTEX_INITIALIZER;
|
||||
static int pwrite_is_locked=0;
|
||||
|
||||
void toku_pwrite_lock_init(void) {
|
||||
int r = toku_pthread_mutex_init(&pwrite_mutex, NULL); assert(r == 0);
|
||||
}
|
||||
|
||||
void toku_pwrite_lock_destroy(void) {
|
||||
int r = toku_pthread_mutex_destroy(&pwrite_mutex); assert(r == 0);
|
||||
}
|
||||
|
||||
static inline void
|
||||
lock_for_pwrite (void) {
|
||||
// Locks the pwrite_mutex.
|
||||
|
|
17
newbrt/brt.c
17
newbrt/brt.c
|
@ -4282,3 +4282,20 @@ int toku_brt_truncate (BRT brt) {
|
|||
|
||||
return r;
|
||||
}
|
||||
|
||||
static void toku_brt_lock_init(void) {
|
||||
toku_pwrite_lock_init();
|
||||
}
|
||||
|
||||
static void toku_brt_lock_destroy(void) {
|
||||
toku_pwrite_lock_destroy();
|
||||
}
|
||||
|
||||
void toku_brt_init(void) {
|
||||
toku_brt_lock_init();
|
||||
}
|
||||
|
||||
void toku_brt_destroy(void) {
|
||||
toku_brt_lock_destroy();
|
||||
}
|
||||
|
||||
|
|
|
@ -113,4 +113,8 @@ int toku_brt_keyrange (BRT brt, DBT *key, u_int64_t *less, u_int64_t *equal, u
|
|||
|
||||
void extend_block_translation (BLOCKNUM blocknum, struct brt_header *h);
|
||||
|
||||
void toku_brt_init(void);
|
||||
void toku_brt_destroy(void);
|
||||
void toku_pwrite_lock_init(void);
|
||||
void toku_pwrite_lock_destroy(void);
|
||||
#endif
|
||||
|
|
|
@ -42,10 +42,12 @@ const char *toku_copyright_string = "Copyright (c) 2007, 2008 Tokutek Inc. All
|
|||
const u_int32_t __toku_env_default_max_locks = 1000;
|
||||
|
||||
void toku_ydb_init(void) {
|
||||
toku_brt_init();
|
||||
toku_ydb_lock_init();
|
||||
}
|
||||
|
||||
void toku_ydb_destroy(void) {
|
||||
toku_brt_destroy();
|
||||
toku_ydb_lock_destroy();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue