~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/thr_alarm.c

  • Committer: Brian Aker
  • Date: 2008-08-10 22:14:13 UTC
  • Revision ID: brian@tangent.org-20080810221413-ablfnyr3wgu6fjaw
ulong conversion. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
55
55
 
56
56
static sig_handler thread_alarm(int sig __attribute__((unused)));
57
57
 
58
 
static int compare_ulong(void *not_used __attribute__((unused)),
 
58
static int compare_uint32_t(void *not_used __attribute__((unused)),
59
59
                         uchar *a_ptr,uchar* b_ptr)
60
60
{
61
 
  ulong a=*((ulong*) a_ptr),b= *((ulong*) b_ptr);
 
61
  uint32_t a=*((uint32_t*) a_ptr),b= *((uint32_t*) b_ptr);
62
62
  return (a < b) ? -1  : (a == b) ? 0 : 1;
63
63
}
64
64
 
68
68
  alarm_aborted=0;
69
69
  next_alarm_expire_time= ~ (time_t) 0;
70
70
  init_queue(&alarm_queue,max_alarms+1,offsetof(ALARM,expire_time),0,
71
 
             compare_ulong,NullS);
 
71
             compare_uint32_t,NullS);
72
72
  sigfillset(&full_signal_set);                 /* Neaded to block signals */
73
73
  pthread_mutex_init(&LOCK_alarm,MY_MUTEX_INIT_FAST);
74
74
  pthread_cond_init(&COND_alarm,NULL);
184
184
    }
185
185
    max_used_alarms=alarm_queue.elements+1;
186
186
  }
187
 
  reschedule= (ulong) next_alarm_expire_time > (ulong) now + sec;
 
187
  reschedule= (uint32_t) next_alarm_expire_time > (uint32_t) now + sec;
188
188
  if (!alarm_data)
189
189
  {
190
190
    if (!(alarm_data=(ALARM*) my_malloc(sizeof(ALARM),MYF(MY_WME))))
343
343
    }
344
344
    else
345
345
    {
346
 
      ulong now=(ulong) my_time(0);
347
 
      ulong next=now+10-(now%10);
 
346
      uint32_t now=(uint32_t) my_time(0);
 
347
      uint32_t next=now+10-(now%10);
348
348
      while ((alarm_data=(ALARM*) queue_top(&alarm_queue))->expire_time <= now)
349
349
      {
350
350
        alarm_data->alarmed=1;                  /* Info to thread */
474
474
  info->max_used_alarms= max_used_alarms;
475
475
  if ((info->active_alarms=  alarm_queue.elements))
476
476
  {
477
 
    ulong now=(ulong) my_time(0);
 
477
    uint32_t now=(uint32_t) my_time(0);
478
478
    long time_diff;
479
479
    ALARM *alarm_data= (ALARM*) queue_top(&alarm_queue);
480
480
    time_diff= (long) (alarm_data->expire_time - now);
481
 
    info->next_alarm_time= (ulong) (time_diff < 0 ? 0 : time_diff);
 
481
    info->next_alarm_time= (uint32_t) (time_diff < 0 ? 0 : time_diff);
482
482
  }
483
483
  pthread_mutex_unlock(&LOCK_alarm);
484
484
}
522
522
  {
523
523
    if (alarm_queue.elements)
524
524
    {
525
 
      ulong sleep_time,now= my_time(0);
 
525
      uint32_t sleep_time,now= my_time(0);
526
526
      if (alarm_aborted)
527
527
        sleep_time=now+1;
528
528
      else