summaryrefslogtreecommitdiff
path: root/firmware/target/hosted/sdl/system-sdl.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/hosted/sdl/system-sdl.c')
-rw-r--r--firmware/target/hosted/sdl/system-sdl.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/firmware/target/hosted/sdl/system-sdl.c b/firmware/target/hosted/sdl/system-sdl.c
index 9ea25c1014..1cc9b2c919 100644
--- a/firmware/target/hosted/sdl/system-sdl.c
+++ b/firmware/target/hosted/sdl/system-sdl.c
@@ -184,7 +184,9 @@ static int sdl_event_thread(void * param)
184 184
185 /* Order here is relevent to prevent deadlocks and use of destroyed 185 /* Order here is relevent to prevent deadlocks and use of destroyed
186 sync primitives by kernel threads */ 186 sync primitives by kernel threads */
187 sim_thread_shutdown(); 187#ifdef HAVE_SDL_THREADS
188 sim_thread_shutdown(); /* not needed for native threads */
189#endif
188 sim_kernel_shutdown(); 190 sim_kernel_shutdown();
189 191
190 return 0; 192 return 0;
@@ -199,9 +201,13 @@ void sim_do_exit(void)
199 exit(EXIT_SUCCESS); 201 exit(EXIT_SUCCESS);
200} 202}
201 203
204uintptr_t *stackbegin;
205uintptr_t *stackend;
202void system_init(void) 206void system_init(void)
203{ 207{
204 SDL_sem *s; 208 SDL_sem *s;
209 /* fake stack, OS manages size (and growth) */
210 stackbegin = stackend = (uintptr_t*)&s;
205 211
206#if (CONFIG_PLATFORM & PLATFORM_MAEMO) 212#if (CONFIG_PLATFORM & PLATFORM_MAEMO)
207 /* Make glib thread safe */ 213 /* Make glib thread safe */
@@ -219,21 +225,24 @@ void system_init(void)
219 /* wait for sdl_event_thread to run so that it can initialize the surfaces 225 /* wait for sdl_event_thread to run so that it can initialize the surfaces
220 * and video subsystem needed for SDL events */ 226 * and video subsystem needed for SDL events */
221 SDL_SemWait(s); 227 SDL_SemWait(s);
222
223 /* cleanup */ 228 /* cleanup */
224 SDL_DestroySemaphore(s); 229 SDL_DestroySemaphore(s);
225} 230}
226 231
227void system_exception_wait(void)
228{
229 sim_thread_exception_wait();
230}
231 232
232void system_reboot(void) 233void system_reboot(void)
233{ 234{
235#ifdef HAVE_SDL_THREADS
234 sim_thread_exception_wait(); 236 sim_thread_exception_wait();
237#else
238 sim_do_exit();
239#endif
235} 240}
236 241
242void system_exception_wait(void)
243{
244 system_reboot();
245}
237 246
238void sys_handle_argv(int argc, char *argv[]) 247void sys_handle_argv(int argc, char *argv[])
239{ 248{