From 57dc12563f099c7802ea8eaeb0c52ac4082de67a Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 23 Mar 2007 18:14:03 +0300 Subject: Trivial cleanups and whitespace change in Event Scheduler code. A larger patch is to come, this is to exclude rudimentary changes from it. sql/event_data_objects.cc: Whitespace change. sql/event_data_objects.h: Remove debug allocators - we have safemalloc. sql/event_db_repository.cc: Whitespace change. sql/event_db_repository.h: Whitespace change. sql/event_queue.cc: Remove an unused structure. Whitespace change. sql/event_queue.h: Whitespace. sql/event_scheduler.cc: Whitespace change. sql/event_scheduler.h: Add comments. Whitespace change. sql/events.cc: Whitespace change. sql/events.h: Trivial cleanups. --- sql/event_queue.cc | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) (limited to 'sql/event_queue.cc') diff --git a/sql/event_queue.cc b/sql/event_queue.cc index ef9dddf9195..7832a0337e7 100644 --- a/sql/event_queue.cc +++ b/sql/event_queue.cc @@ -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 -- cgit v1.2.1