summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Chapman <dave@dchapman.com>2007-03-24 01:27:29 +0000
committerDave Chapman <dave@dchapman.com>2007-03-24 01:27:29 +0000
commit467651ae763107d478799586a1061693cafe6dab (patch)
tree9c65e8bf3ac593acc184e10ba2f1fa44cc153b53
parent5242cff2b8a1d0060866f4db6f8e3d8257fbc831 (diff)
downloadrockbox-467651ae763107d478799586a1061693cafe6dab.tar.gz
rockbox-467651ae763107d478799586a1061693cafe6dab.zip
Make the sim create_thread() function slightly closer to the real thing. #include "thread.h" in thread-sdl.c to ensure function prototypes are consistent. This now allows mpegplayer to run in the sim.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12901 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--uisimulator/sdl/thread-sdl.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/uisimulator/sdl/thread-sdl.c b/uisimulator/sdl/thread-sdl.c
index 21697699a5..809897da01 100644
--- a/uisimulator/sdl/thread-sdl.c
+++ b/uisimulator/sdl/thread-sdl.c
@@ -23,6 +23,7 @@
23#include <stdlib.h> 23#include <stdlib.h>
24#include "thread-sdl.h" 24#include "thread-sdl.h"
25#include "kernel.h" 25#include "kernel.h"
26#include "thread.h"
26#include "debug.h" 27#include "debug.h"
27 28
28SDL_Thread *threads[256]; 29SDL_Thread *threads[256];
@@ -58,21 +59,29 @@ int runthread(void *data)
58 return 0; 59 return 0;
59} 60}
60 61
61int create_thread(void (*fp)(void), void* sp, int stk_size) 62struct thread_entry*
63 create_thread(void (*function)(void), void* stack, int stack_size,
64 const char *name)
62{ 65{
63 /** Avoid compiler warnings */ 66 /** Avoid compiler warnings */
64 (void)sp; 67 (void)stack;
65 (void)stk_size; 68 (void)stack_size;
69 (void)name;
70 SDL_Thread* t;
66 71
67 if (threadCount == 256) { 72 if (threadCount == 256) {
68 return -1; 73 return NULL;
69 } 74 }
70 75
71 threads[threadCount++] = SDL_CreateThread(runthread, fp); 76 t = SDL_CreateThread(runthread, function);
77 threads[threadCount++] = t;
72 78
73 yield(); 79 yield();
74 80
75 return 0; 81 /* The return value is never de-referenced outside thread.c so this
82 nastiness should be fine. However, a better solution would be nice.
83 */
84 return (struct thread_entry*)t;
76} 85}
77 86
78void init_threads(void) 87void init_threads(void)