Commit 46b0edc4 authored by unknown's avatar unknown

Remove use of non-portable gettimeofday() in thr_lock.c (Bug #12100)


mysys/thr_lock.c:
  Use set_timespec() macro instead of calling gettimeofday()
parent 03fb8276
...@@ -388,7 +388,6 @@ wait_for_lock(struct st_lock_list *wait, THR_LOCK_DATA *data, ...@@ -388,7 +388,6 @@ wait_for_lock(struct st_lock_list *wait, THR_LOCK_DATA *data,
{ {
struct st_my_thread_var *thread_var= my_thread_var; struct st_my_thread_var *thread_var= my_thread_var;
pthread_cond_t *cond= &thread_var->suspend; pthread_cond_t *cond= &thread_var->suspend;
struct timeval now;
struct timespec wait_timeout; struct timespec wait_timeout;
enum enum_thr_lock_result result= THR_LOCK_ABORTED; enum enum_thr_lock_result result= THR_LOCK_ABORTED;
my_bool can_deadlock= test(data->owner->info->n_cursors); my_bool can_deadlock= test(data->owner->info->n_cursors);
...@@ -406,11 +405,7 @@ wait_for_lock(struct st_lock_list *wait, THR_LOCK_DATA *data, ...@@ -406,11 +405,7 @@ wait_for_lock(struct st_lock_list *wait, THR_LOCK_DATA *data,
data->cond= cond; data->cond= cond;
if (can_deadlock) if (can_deadlock)
{ set_timespec(wait_timeout, table_lock_wait_timeout);
gettimeofday(&now, 0);
wait_timeout.tv_sec= now.tv_sec + table_lock_wait_timeout;
wait_timeout.tv_nsec= now.tv_usec * 1000;
}
while (!thread_var->abort || in_wait_list) while (!thread_var->abort || in_wait_list)
{ {
int rc= can_deadlock ? pthread_cond_timedwait(cond, &data->lock->mutex, int rc= can_deadlock ? pthread_cond_timedwait(cond, &data->lock->mutex,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment