diff options
author | Sergei Golubchik <serg@mysql.com> | 2008-09-01 21:43:11 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mysql.com> | 2008-09-01 21:43:11 +0200 |
commit | 27dadbd89577e8ff80c926cfb3fbd36cf0fb48a4 (patch) | |
tree | 58664cd91e50a30abd69134062c4a7c130146cdd /mysys/waiting_threads.c | |
parent | 533deb0ac4ecb9ca802034459120ce725006e4f1 (diff) | |
download | mariadb-git-27dadbd89577e8ff80c926cfb3fbd36cf0fb48a4.tar.gz |
wt: don't support a key as a union { ulonglong, void* }. Although convenient,
it forces the user to bzero a key before setting it as a pointer, otherwise
it'll have random content on architectures where
sizeof(void*) < sizeof(ulonglong).
Declaring a key as ulonglong only (not a union) makes this user mistake
impossible.
include/waiting_threads.h:
WT_RESOURCE_ID::value is an ulonglong, not a union
mysys/waiting_threads.c:
WT_RESOURCE_ID::value is an ulonglong, not a union
storage/maria/ma_write.c:
WT_RESOURCE_ID::value is an ulonglong, not a union
storage/maria/trnman.c:
WT_RESOURCE_ID::value is an ulonglong, not a union
unittest/mysys/waiting_threads-t.c:
WT_RESOURCE_ID::value is an ulonglong, not a union
Diffstat (limited to 'mysys/waiting_threads.c')
-rw-r--r-- | mysys/waiting_threads.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/mysys/waiting_threads.c b/mysys/waiting_threads.c index 49b41111311..255317ea4cc 100644 --- a/mysys/waiting_threads.c +++ b/mysys/waiting_threads.c @@ -30,8 +30,7 @@ A resource is represented by a WT_RESOURCE structure. a resource identifier - a pair of {resource type, value}. A value is - either a ulonglong number or a pointer (it's a union). - WT_RESOURCE_ID structure. + an ulonglong number. Represented by a WT_RESOURCE_ID structure. a resource type - a pointer to a statically defined instance of WT_RESOURCE_TYPE structure. This structure contains a pointer to @@ -169,20 +168,20 @@ static my_atomic_rwlock_t cycle_stats_lock, wait_stats_lock, success_stats_lock; #define rc_rdlock(X) \ do { \ WT_RESOURCE *R=(X); \ - DBUG_PRINT("wt", ("LOCK resid=%lld for READ", R->id.value.num)); \ - rw_rdlock(&R->lock); \ + DBUG_PRINT("wt", ("LOCK resid=%lld for READ", R->id.value)); \ + rw_rdlock(&R->lock); \ } while (0) #define rc_wrlock(X) \ do { \ WT_RESOURCE *R=(X); \ - DBUG_PRINT("wt", ("LOCK resid=%lld for WRITE", R->id.value.num)); \ - rw_wrlock(&R->lock); \ + DBUG_PRINT("wt", ("LOCK resid=%lld for WRITE", R->id.value)); \ + rw_wrlock(&R->lock); \ } while (0) #define rc_unlock(X) \ do { \ WT_RESOURCE *R=(X); \ - DBUG_PRINT("wt", ("UNLOCK resid=%lld", R->id.value.num)); \ - rw_unlock(&R->lock); \ + DBUG_PRINT("wt", ("UNLOCK resid=%lld", R->id.value)); \ + rw_unlock(&R->lock); \ } while (0) /* @@ -688,7 +687,7 @@ int wt_thd_will_wait_for(WT_THD *thd, WT_THD *blocker, WT_RESOURCE_ID *resid) LF_REQUIRE_PINS(3); DBUG_PRINT("wt", ("enter: thd=%s, blocker=%s, resid=%llu", - thd->name, blocker->name, resid->value.num)); + thd->name, blocker->name, resid->value)); if (fix_thd_pins(thd)) DBUG_RETURN(WT_DEADLOCK); |