From e4407cd7e9b9313f6fde24ff503e011823129680 Mon Sep 17 00:00:00 2001 From: François Revel Date: Thu, 16 Oct 2008 20:49:12 +0000 Subject: Had to split main() into parts to have netsurf_init() called from one thread, and the loop in another to avoid a deadlock in replicants... hope nobody minds. svn path=/trunk/netsurf/; revision=5586 --- desktop/netsurf.c | 20 +++++++++++++++----- desktop/netsurf.h | 3 +++ 2 files changed, 18 insertions(+), 5 deletions(-) (limited to 'desktop') diff --git a/desktop/netsurf.c b/desktop/netsurf.c index 4e6b6e085..afefd50be 100644 --- a/desktop/netsurf.c +++ b/desktop/netsurf.c @@ -43,9 +43,7 @@ bool netsurf_quit = false; bool netsurf_embedded = true; bool verbose_log = false; -static void netsurf_init(int argc, char** argv); static void netsurf_poll(void); -static void netsurf_exit(void); static void lib_init(void); @@ -55,6 +53,7 @@ static void lib_init(void); int main(int argc, char** argv) { + setbuf(stderr, NULL); netsurf_embedded = false; return netsurf_main(argc, argv); } @@ -66,11 +65,9 @@ int main(int argc, char** argv) int netsurf_main(int argc, char** argv) { - setbuf(stderr, NULL); netsurf_init(argc, argv); - while (!netsurf_quit) - netsurf_poll(); + netsurf_main_loop(); netsurf_exit(); @@ -78,6 +75,19 @@ int netsurf_main(int argc, char** argv) } +/** + * Gui NetSurf main loop. + */ + +int netsurf_main_loop(void) +{ + while (!netsurf_quit) + netsurf_poll(); + + return 0; +} + + /** * Initialise components used by gui NetSurf. */ diff --git a/desktop/netsurf.h b/desktop/netsurf.h index bfb97c539..e25934234 100644 --- a/desktop/netsurf.h +++ b/desktop/netsurf.h @@ -28,6 +28,9 @@ extern const char * const netsurf_version; extern const int netsurf_version_major; extern const int netsurf_version_minor; +extern void netsurf_init(int argc, char** argv); +extern void netsurf_exit(void); extern int netsurf_main(int argc, char** argv); +extern int netsurf_main_loop(void); #endif -- cgit v1.2.3