diff options
author | istruewing@stella.local <> | 2008-03-26 10:27:00 +0100 |
---|---|---|
committer | istruewing@stella.local <> | 2008-03-26 10:27:00 +0100 |
commit | 44fbe74e1e7c6055f10f5eb7ab6f467e0c4aa966 (patch) | |
tree | 69df040c98a9edd26de9be04066dff14eb50319e /sql/item_func.cc | |
parent | bc683c6450a40a148e3cb321de26c35fca5749b6 (diff) | |
parent | 97531cadc9fb1df270b435cc15a19b7f9b0195a8 (diff) | |
download | mariadb-git-44fbe74e1e7c6055f10f5eb7ab6f467e0c4aa966.tar.gz |
Merge stella.local:/home2/mydev/mysql-5.1-amain
into stella.local:/home2/mydev/mysql-5.1-axmrg
Diffstat (limited to 'sql/item_func.cc')
-rw-r--r-- | sql/item_func.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc index 02b15461c22..c938bf5ebe1 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -3715,11 +3715,24 @@ longlong Item_func_sleep::val_int() DBUG_ASSERT(fixed == 1); double time= args[0]->val_real(); + /* + On 64-bit OSX pthread_cond_timedwait() waits forever + if passed abstime time has already been exceeded by + the system time. + When given a very short timeout (< 10 mcs) just return + immediately. + We assume that the lines between this test and the call + to pthread_cond_timedwait() will be executed in less than 0.00001 sec. + */ + if (time < 0.00001) + return 0; + set_timespec_nsec(abstime, (ulonglong)(time * ULL(1000000000))); pthread_cond_init(&cond, NULL); pthread_mutex_lock(&LOCK_user_locks); + thd_proc_info(thd, "User sleep"); thd->mysys_var->current_mutex= &LOCK_user_locks; thd->mysys_var->current_cond= &cond; @@ -3731,6 +3744,7 @@ longlong Item_func_sleep::val_int() break; error= 0; } + thd_proc_info(thd, 0); pthread_mutex_unlock(&LOCK_user_locks); pthread_mutex_lock(&thd->mysys_var->mutex); thd->mysys_var->current_mutex= 0; |