diff options
-rw-r--r-- | apps/plugins/sdl/src/thread/rockbox/SDL_systhread.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/apps/plugins/sdl/src/thread/rockbox/SDL_systhread.c b/apps/plugins/sdl/src/thread/rockbox/SDL_systhread.c index b9bd8735d3..d393e50e14 100644 --- a/apps/plugins/sdl/src/thread/rockbox/SDL_systhread.c +++ b/apps/plugins/sdl/src/thread/rockbox/SDL_systhread.c | |||
@@ -42,20 +42,25 @@ static void rbsdl_runthread(void) | |||
42 | SDL_RunThread(args); | 42 | SDL_RunThread(args); |
43 | } | 43 | } |
44 | 44 | ||
45 | #define RBSDL_THREAD_STACK_SIZE (DEFAULT_STACK_SIZE * 4) | ||
45 | #define MAX_THREAD 4 | 46 | #define MAX_THREAD 4 |
46 | static char names[MAX_THREAD][16]; | 47 | static char names[MAX_THREAD][16]; |
47 | static long stacks[MAX_THREAD][DEFAULT_STACK_SIZE / sizeof(long)]; | 48 | static long stacks[MAX_THREAD][RBSDL_THREAD_STACK_SIZE / sizeof(long)]; |
48 | 49 | ||
49 | int SDL_SYS_CreateThread(SDL_Thread *thread, void *args) | 50 | int SDL_SYS_CreateThread(SDL_Thread *thread, void *args) |
50 | { | 51 | { |
51 | static int threadnum = 0; | 52 | static int threadnum = 0; |
53 | |||
54 | if(threadnum >= MAX_THREAD) | ||
55 | return -1; | ||
56 | |||
52 | snprintf(names[threadnum], 16, "sdl_%d", threadnum); | 57 | snprintf(names[threadnum], 16, "sdl_%d", threadnum); |
53 | 58 | ||
54 | while(global_args) rb->yield(); /* busy wait, pray that this works */ | 59 | while(global_args) rb->yield(); /* busy wait, pray that this works */ |
55 | 60 | ||
56 | global_args = args; | 61 | global_args = args; |
57 | 62 | ||
58 | thread->handle = rb->create_thread(rbsdl_runthread, stacks[threadnum], DEFAULT_STACK_SIZE, | 63 | thread->handle = rb->create_thread(rbsdl_runthread, stacks[threadnum], RBSDL_THREAD_STACK_SIZE, |
59 | 0, names[threadnum] /* collisions allowed? */ | 64 | 0, names[threadnum] /* collisions allowed? */ |
60 | IF_PRIO(, PRIORITY_BUFFERING) // this is used for sound mixing | 65 | IF_PRIO(, PRIORITY_BUFFERING) // this is used for sound mixing |
61 | IF_COP(, CPU)); | 66 | IF_COP(, CPU)); |