summaryrefslogtreecommitdiff
path: root/innobase/sync
diff options
context:
space:
mode:
authorunknown <heikki@hundin.mysql.fi>2002-08-06 22:59:13 +0300
committerunknown <heikki@hundin.mysql.fi>2002-08-06 22:59:13 +0300
commita3edc742b94a94ff455ff549d7e2a9f5faa346a0 (patch)
tree0ed7a5d28436450a6e79787357c337dfae761d1d /innobase/sync
parentcbb0dc14ccd3ff932edf5a29aa6af0ac210be4b9 (diff)
downloadmariadb-git-a3edc742b94a94ff455ff549d7e2a9f5faa346a0.tar.gz
Many files:
Merge InnoDB-3.23.52d innobase/btr/btr0sea.c: Merge InnoDB-3.23.52d innobase/buf/buf0buf.c: Merge InnoDB-3.23.52d innobase/buf/buf0lru.c: Merge InnoDB-3.23.52d innobase/include/buf0buf.h: Merge InnoDB-3.23.52d innobase/include/ha0ha.h: Merge InnoDB-3.23.52d innobase/include/log0log.h: Merge InnoDB-3.23.52d innobase/include/os0file.h: Merge InnoDB-3.23.52d innobase/include/os0thread.h: Merge InnoDB-3.23.52d innobase/include/ha0ha.ic: Merge InnoDB-3.23.52d innobase/include/os0sync.ic: Merge InnoDB-3.23.52d innobase/include/srv0start.h: Merge InnoDB-3.23.52d innobase/include/sync0rw.ic: Merge InnoDB-3.23.52d innobase/include/sync0sync.ic: Merge InnoDB-3.23.52d innobase/include/ut0dbg.h: Merge InnoDB-3.23.52d innobase/include/univ.i: Merge InnoDB-3.23.52d innobase/lock/lock0lock.c: Merge InnoDB-3.23.52d innobase/log/log0log.c: Merge InnoDB-3.23.52d innobase/mem/mem0pool.c: Merge InnoDB-3.23.52d innobase/os/os0file.c: Merge InnoDB-3.23.52d innobase/os/os0thread.c: Merge InnoDB-3.23.52d innobase/srv/srv0srv.c: Merge InnoDB-3.23.52d innobase/srv/srv0start.c: Merge InnoDB-3.23.52d innobase/sync/sync0arr.c: Merge InnoDB-3.23.52d innobase/sync/sync0rw.c: Merge InnoDB-3.23.52d innobase/sync/sync0sync.c: Merge InnoDB-3.23.52d innobase/thr/thr0loc.c: Merge InnoDB-3.23.52d innobase/trx/trx0trx.c: Merge InnoDB-3.23.52d innobase/configure.in: Merge InnoDB-3.23.52d sql/ha_innobase.cc: Merge InnoDB-3.23.52d
Diffstat (limited to 'innobase/sync')
-rw-r--r--innobase/sync/sync0arr.c23
-rw-r--r--innobase/sync/sync0rw.c23
-rw-r--r--innobase/sync/sync0sync.c22
3 files changed, 36 insertions, 32 deletions
diff --git a/innobase/sync/sync0arr.c b/innobase/sync/sync0arr.c
index 81b5b7de195..ad3ac84b6eb 100644
--- a/innobase/sync/sync0arr.c
+++ b/innobase/sync/sync0arr.c
@@ -454,7 +454,7 @@ sync_array_cell_print(
buf += sprintf(buf,
"--Thread %lu has waited at %s line %lu for %.2f seconds the semaphore:\n",
- (ulint)cell->thread, cell->file, cell->line,
+ os_thread_pf(cell->thread), cell->file, cell->line,
difftime(time(NULL), cell->reservation_time));
if (type == SYNC_MUTEX) {
@@ -486,7 +486,7 @@ sync_array_cell_print(
if (rwlock->writer != RW_LOCK_NOT_LOCKED) {
buf += sprintf(buf,
"a writer (thread id %lu) has reserved it in mode",
- (ulint)rwlock->writer_thread);
+ os_thread_pf(rwlock->writer_thread));
if (rwlock->writer == RW_LOCK_EX) {
buf += sprintf(buf, " exclusive\n");
} else {
@@ -535,8 +535,8 @@ sync_array_find_thread(
cell = sync_array_get_nth_cell(arr, i);
- if ((cell->wait_object != NULL)
- && (cell->thread == thread)) {
+ if (cell->wait_object != NULL
+ && os_thread_eq(cell->thread, thread)) {
return(cell); /* Found */
}
@@ -651,9 +651,9 @@ sync_array_detect_deadlock(
sync_array_cell_print(buf, cell);
printf(
"Mutex %lx owned by thread %lu file %s line %lu\n%s",
- (ulint)mutex, mutex->thread_id,
- mutex->file_name, mutex->line,
- buf);
+ (ulint)mutex, os_thread_pf(mutex->thread_id),
+ mutex->file_name, mutex->line, buf);
+
return(TRUE);
}
}
@@ -671,9 +671,9 @@ sync_array_detect_deadlock(
thread = debug->thread_id;
if (((debug->lock_type == RW_LOCK_EX)
- && (thread != cell->thread))
+ && !os_thread_eq(thread, cell->thread))
|| ((debug->lock_type == RW_LOCK_WAIT_EX)
- && (thread != cell->thread))
+ && !os_thread_eq(thread, cell->thread))
|| (debug->lock_type == RW_LOCK_SHARED)) {
/* The (wait) x-lock request can block infinitely
@@ -771,7 +771,7 @@ sync_arr_cell_can_wake_up(
if (rw_lock_get_reader_count(lock) == 0
&& rw_lock_get_writer(lock) == RW_LOCK_WAIT_EX
- && lock->writer_thread == cell->thread) {
+ && os_thread_eq(lock->writer_thread, cell->thread)) {
return(TRUE);
}
@@ -927,7 +927,7 @@ sync_array_print_long_waits(void)
&& difftime(time(NULL), cell->reservation_time) > 420) {
fprintf(stderr,
-"InnoDB: Error: semaphore wait has lasted > 420 seconds\n"
+"InnoDB: Error: semaphore wait has lasted > 600 seconds\n"
"InnoDB: We intentionally crash the server, because it appears to be hung.\n"
);
@@ -1011,3 +1011,4 @@ sync_array_print_info(
sync_array_exit(arr);
}
+
diff --git a/innobase/sync/sync0rw.c b/innobase/sync/sync0rw.c
index 1ef2920618f..93db9b9d507 100644
--- a/innobase/sync/sync0rw.c
+++ b/innobase/sync/sync0rw.c
@@ -223,7 +223,7 @@ lock_loop:
if (srv_print_latch_waits) {
printf(
"Thread %lu spin wait rw-s-lock at %lx cfile %s cline %lu rnds %lu\n",
- os_thread_get_curr_id(), (ulint)lock,
+ os_thread_pf(os_thread_get_curr_id()), (ulint)lock,
lock->cfile_name, lock->cline, i);
}
@@ -253,7 +253,7 @@ lock_loop:
if (srv_print_latch_waits) {
printf(
"Thread %lu OS wait rw-s-lock at %lx cfile %s cline %lu\n",
- os_thread_get_curr_id(), (ulint)lock,
+ os_thread_pf(os_thread_get_curr_id()), (ulint)lock,
lock->cfile_name, lock->cline);
}
@@ -343,7 +343,8 @@ rw_lock_x_lock_low(
}
} else if ((rw_lock_get_writer(lock) == RW_LOCK_WAIT_EX)
- && (lock->writer_thread == os_thread_get_curr_id())) {
+ && os_thread_eq(lock->writer_thread,
+ os_thread_get_curr_id())) {
if (rw_lock_get_reader_count(lock) == 0) {
@@ -368,7 +369,8 @@ rw_lock_x_lock_low(
return(RW_LOCK_WAIT_EX);
} else if ((rw_lock_get_writer(lock) == RW_LOCK_EX)
- && (lock->writer_thread == os_thread_get_curr_id())
+ && os_thread_eq(lock->writer_thread,
+ os_thread_get_curr_id())
&& (lock->pass == 0)
&& (pass == 0)) {
@@ -469,7 +471,7 @@ lock_loop:
if (srv_print_latch_waits) {
printf(
"Thread %lu spin wait rw-x-lock at %lx cfile %s cline %lu rnds %lu\n",
- os_thread_get_curr_id(), (ulint)lock,
+ os_thread_pf(os_thread_get_curr_id()), (ulint)lock,
lock->cfile_name, lock->cline, i);
}
@@ -502,8 +504,8 @@ lock_loop:
if (srv_print_latch_waits) {
printf(
"Thread %lu OS wait for rw-x-lock at %lx cfile %s cline %lu\n",
- os_thread_get_curr_id(), (ulint)lock, lock->cfile_name,
- lock->cline);
+ os_thread_pf(os_thread_get_curr_id()), (ulint)lock,
+ lock->cfile_name, lock->cline);
}
rw_x_system_call_count++;
@@ -621,7 +623,8 @@ rw_lock_remove_debug_info(
while (info != NULL) {
if ((pass == info->pass)
&& ((pass != 0)
- || (info->thread_id == os_thread_get_curr_id()))
+ || os_thread_eq(info->thread_id,
+ os_thread_get_curr_id()))
&& (info->lock_type == lock_type)) {
/* Found! */
@@ -676,7 +679,7 @@ rw_lock_own(
while (info != NULL) {
- if ((info->thread_id == os_thread_get_curr_id())
+ if (os_thread_eq(info->thread_id, os_thread_get_curr_id())
&& (info->pass == 0)
&& (info->lock_type == lock_type)) {
@@ -834,7 +837,7 @@ rw_lock_debug_print(
rwt = info->lock_type;
printf("Locked: thread %ld file %s line %ld ",
- info->thread_id, info->file_name, info->line);
+ os_thread_pf(info->thread_id), info->file_name, info->line);
if (rwt == RW_LOCK_SHARED) {
printf("S-LOCK");
} else if (rwt == RW_LOCK_EX) {
diff --git a/innobase/sync/sync0sync.c b/innobase/sync/sync0sync.c
index c070e97f692..61bd8e587e6 100644
--- a/innobase/sync/sync0sync.c
+++ b/innobase/sync/sync0sync.c
@@ -230,7 +230,6 @@ mutex_create_func(
mutex->magic_n = MUTEX_MAGIC_N;
mutex->line = 0;
mutex->file_name = "not yet reserved";
- mutex->thread_id = ULINT_UNDEFINED;
mutex->level = SYNC_LEVEL_NONE;
mutex->cfile_name = cfile_name;
mutex->cline = cline;
@@ -392,8 +391,8 @@ spin_loop:
if (srv_print_latch_waits) {
printf(
"Thread %lu spin wait mutex at %lx cfile %s cline %lu rnds %lu\n",
- os_thread_get_curr_id(), (ulint)mutex, mutex->cfile_name,
- mutex->cline, i);
+ os_thread_pf(os_thread_get_curr_id()), (ulint)mutex,
+ mutex->cfile_name, mutex->cline, i);
}
mutex_spin_round_count += i;
@@ -458,7 +457,7 @@ spin_loop:
if (srv_print_latch_waits) {
printf(
"Thread %lu spin wait succeeds at 2: mutex at %lx\n",
- os_thread_get_curr_id(), (ulint)mutex);
+ os_thread_pf(os_thread_get_curr_id()), (ulint)mutex);
}
return;
@@ -476,8 +475,8 @@ spin_loop:
if (srv_print_latch_waits) {
printf(
"Thread %lu OS wait mutex at %lx cfile %s cline %lu rnds %lu\n",
- os_thread_get_curr_id(), (ulint)mutex, mutex->cfile_name,
- mutex->cline, i);
+ os_thread_pf(os_thread_get_curr_id()), (ulint)mutex,
+ mutex->cfile_name, mutex->cline, i);
}
mutex_system_call_count++;
@@ -572,7 +571,7 @@ mutex_own(
return(FALSE);
}
- if (mutex->thread_id != os_thread_get_curr_id()) {
+ if (!os_thread_eq(mutex->thread_id, os_thread_get_curr_id())) {
return(FALSE);
}
@@ -611,7 +610,8 @@ mutex_list_print_info(void)
&thread_id);
printf(
"Locked mutex: addr %lx thread %ld file %s line %ld\n",
- (ulint)mutex, thread_id, file_name, line);
+ (ulint)mutex, os_thread_pf(thread_id),
+ file_name, line);
}
mutex = UT_LIST_GET_NEXT(list, mutex);
@@ -716,7 +716,7 @@ sync_thread_level_arrays_find_slot(void)
slot = sync_thread_level_arrays_get_nth(i);
- if (slot->levels && (slot->id == id)) {
+ if (slot->levels && os_thread_eq(slot->id, id)) {
return(slot);
}
@@ -780,7 +780,7 @@ sync_thread_levels_g(
{
char* file_name;
ulint line;
- ulint thread_id;
+ os_thread_id_t thread_id;
sync_level_t* slot;
rw_lock_t* lock;
mutex_t* mutex;
@@ -810,7 +810,7 @@ sync_thread_levels_g(
&file_name, &line, &thread_id);
printf("InnoDB: Locked mutex: addr %lx thread %ld file %s line %ld\n",
- (ulint)mutex, thread_id,
+ (ulint)mutex, os_thread_pf(thread_id),
file_name, line);
} else {
printf("Not locked\n");