1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Trivial cleanups and whitespace change in Event Scheduler code.

A larger patch is to come, this is to exclude rudimentary changes
from it.
This commit is contained in:
kostja@bodhi.local
2007-03-23 18:14:03 +03:00
parent f017117d84
commit 094612854d
10 changed files with 65 additions and 86 deletions

View File

@ -32,16 +32,6 @@
#define LOCK_QUEUE_DATA() lock_data(SCHED_FUNC, __LINE__)
#define UNLOCK_QUEUE_DATA() unlock_data(SCHED_FUNC, __LINE__)
struct event_queue_param
{
THD *thd;
Event_queue *queue;
pthread_mutex_t LOCK_loaded;
pthread_cond_t COND_loaded;
bool loading_finished;
};
/*
Compares the execute_at members of two Event_queue_element instances.
Used as callback for the prioritized queue when shifting
@ -62,7 +52,7 @@ struct event_queue_param
execute_at.second_part is not considered during comparison
*/
static int
static int
event_queue_element_compare_q(void *vptr, byte* a, byte *b)
{
my_time_t lhs = ((Event_queue_element *)a)->execute_at;
@ -183,7 +173,7 @@ Event_queue::deinit_queue()
}
/*
/**
Adds an event to the queue.
SYNOPSIS
@ -209,7 +199,7 @@ Event_queue::create_event(THD *thd, Event_queue_element *new_element)
LOCK_QUEUE_DATA();
queue_insert_safe(&queue, (byte *) new_element);
dbug_dump_queue(thd->query_start());
pthread_cond_broadcast(&COND_queue_state);
pthread_cond_broadcast(&COND_queue_state);
UNLOCK_QUEUE_DATA();
}
DBUG_VOID_RETURN;
@ -256,7 +246,7 @@ Event_queue::update_event(THD *thd, LEX_STRING dbname, LEX_STRING name,
{
DBUG_PRINT("info", ("new event in the queue: 0x%lx", (long) new_element));
queue_insert_safe(&queue, (byte *) new_element);
pthread_cond_broadcast(&COND_queue_state);
pthread_cond_broadcast(&COND_queue_state);
}
dbug_dump_queue(thd->query_start());
@ -287,7 +277,7 @@ Event_queue::drop_event(THD *thd, LEX_STRING dbname, LEX_STRING name)
find_n_remove_event(dbname, name);
dbug_dump_queue(thd->query_start());
UNLOCK_QUEUE_DATA();
/*
We don't signal here because the scheduler will catch the change
next time it wakes up.
@ -309,7 +299,7 @@ Event_queue::drop_event(THD *thd, LEX_STRING dbname, LEX_STRING name)
RETURN VALUE
>=0 Number of dropped events
NOTE
Expected is the caller to acquire lock on LOCK_event_queue
*/
@ -341,7 +331,7 @@ Event_queue::drop_matching_events(THD *thd, LEX_STRING pattern,
i++;
}
/*
We don't call pthread_cond_broadcast(&COND_queue_state);
We don't call pthread_cond_broadcast(&COND_queue_state);
If we remove the top event:
1. The queue is empty. The scheduler will wake up at some time and
realize that the queue is empty. If create_event() comes inbetween