From 6bced73998312f7ddb68f5d572fef2214ddbe4f4 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Wed, 16 Feb 2011 21:29:39 +0000 Subject: Modify scheduler to use a binary heap (using libpbl). Scheduled events are now in event time order, so schedule_run simply takes the top event off the heap and runs it (if we're polling, rather than having received a signal that the next event is due to be run, we check first that we have passed the scheduled time). This should provide performance benefits as we are no longer trawling the entire list of scheduled events (potentially hundreds) every time an event is signalled or the schedule list is polled. svn path=/trunk/netsurf/; revision=11703 --- amiga/gui.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'amiga/gui.c') diff --git a/amiga/gui.c b/amiga/gui.c index daaafe681..1db49bb27 100755 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -457,8 +457,8 @@ void gui_init(int argc, char** argv) plot=amiplot; if(option_context_menu) ami_context_menu_init(); + ami_schedule_create(); - schedule_list = NewObjList(); window_list = NewObjList(); urldb_load(option_url_file); @@ -1919,7 +1919,7 @@ void ami_get_msg(void) while(timermsg = GetMsg(msgport)) { ReplyMsg(timermsg); - schedule_run(); + schedule_run(FALSE); } } } @@ -1947,7 +1947,7 @@ void gui_poll(bool active) if(active) { gui_multitask(); - schedule_run(); + schedule_run(TRUE); } else { @@ -2140,7 +2140,8 @@ void gui_quit(void) FreeSysObject(ASOT_IOREQUEST,tioreq); FreeSysObject(ASOT_PORT,msgport); - FreeObjList(schedule_list); + ami_schedule_free(); + FreeObjList(window_list); } -- cgit v1.2.3