summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <ramil/ram@ramil.myoffice.izhnet.ru>2008-02-24 16:24:53 +0400
committerunknown <ramil/ram@ramil.myoffice.izhnet.ru>2008-02-24 16:24:53 +0400
commit197b41196dcf861db87dac40996bec5ecf191b95 (patch)
tree79ebcefc272bb5a51fa96f2383209fea614aa7e5
parentc3a5c0a076a77a6ae9e17c94a090b55e9f08858c (diff)
parent38354149c87dcb16a97c79de34ab48c80c10c499 (diff)
downloadmariadb-git-197b41196dcf861db87dac40996bec5ecf191b95.tar.gz
Merge mysql.com:/home/ram/work/mysql-5.0-engines
into mysql.com:/home/ram/work/b33304/b33304.5.0
-rw-r--r--sql/item_func.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 639e069d24e..e20b0762ea2 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -3729,6 +3729,18 @@ 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);