Added e_event_loop_quit() which will cause the event loop to drop out, this

means that clients can clean up properly.


SVN revision: 5278
This commit is contained in:
boris 2001-08-25 19:05:04 +00:00 committed by boris
parent 42ca47106d
commit 7cec80e83e
4 changed files with 16 additions and 1 deletions

View File

@ -1,3 +1,4 @@
The Rasterman <raster@rasterman.com>
Tom Gilbert <tom@linuxbrit.co.uk>
Burra <burra@colorado.edu>
Chris Ross <chris@darkrock.co.uk>

View File

@ -732,6 +732,7 @@ void e_add_event_ipc(int ipc, void (*func) (int ipc));
void e_del_event_ipc(int ipc);
void e_event_loop(void);
void e_event_loop_quit(void);
void e_add_event_timer(char *name, double in,
void (*func) (int val, void *data),

View File

@ -94,11 +94,14 @@ e_event_filter_idle_handle(void)
h->func(h->data);
}
extern int __quit_ev_loop;
void
e_event_filter_init(void)
{
int i;
__quit_ev_loop = 0;
for (i = 0; i < EV_MAX; i++)
handler[i] = NULL;
}

View File

@ -14,6 +14,8 @@ Ev_Timer *timers = NULL;
Eevent *events = NULL;
Eevent *last_event = NULL;
int __quit_ev_loop = 0;
/* local functions for event handling */
static void e_handle_event_timer(void);
static void e_handle_zero_event_timer(void);
@ -177,7 +179,7 @@ e_event_loop(void)
time1 = e_get_time();
time2 = time1 - prev_time;
prev_time = time1;
for (;;)
while( __quit_ev_loop == 0 )
{
/* state setup */
timed_out = 0;
@ -313,6 +315,14 @@ e_event_loop(void)
}
}
/* set a flag to 0 so that we can quit the event loop and shutdown
* properly */
void
e_event_loop_quit(void)
{
__quit_ev_loop = 1;
}
/* add a timeout funcitont o be called in "in" seconds with name name */
void
e_add_event_timer(char *name, double in, void (*func) (int val, void *data),