comparison src/thread/dc/SDL_systhread.c @ 509:dad72daf44b3

Added initial support for Dreamcast (thanks HERO!)
author Sam Lantinga <slouken@libsdl.org>
date Sat, 05 Oct 2002 16:50:56 +0000
parents
children b8d311d90021
comparison
equal deleted inserted replaced
508:9ff7e90aaa94 509:dad72daf44b3
1 /*
2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public
16 License along with this library; if not, write to the Free
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 BERO
20 bero@geocities.co.jp
21
22 based on generic/SDL_thread.c
23
24 Sam Lantinga
25 slouken@libsdl.org
26 */
27
28 #ifdef SAVE_RCSID
29 static char rcsid =
30 "@(#) $Id$";
31 #endif
32
33 /* Thread management routines for SDL */
34
35 #include "SDL_error.h"
36 #include "SDL_thread.h"
37 #include "SDL_systhread.h"
38
39 #include <kos/thread.h>
40
41 #ifdef DISABLE_THREADS
42 int SDL_SYS_CreateThread(SDL_Thread *thread, void *args)
43 {
44 SDL_SetError("Threads are not supported on this platform");
45 return(-1);
46 }
47
48 void SDL_SYS_SetupThread(void)
49 {
50 return;
51 }
52
53 Uint32 SDL_ThreadID(void)
54 {
55 return(0);
56 }
57
58 void SDL_SYS_WaitThread(SDL_Thread *thread)
59 {
60 return;
61 }
62
63 void SDL_SYS_KillThread(SDL_Thread *thread)
64 {
65 return;
66 }
67
68 #else
69 int SDL_SYS_CreateThread(SDL_Thread *thread, void *args)
70 {
71 thread->handle = thd_create(SDL_RunThread,args);
72 if (thread->handle == NULL) {
73 SDL_SetError("Not enough resources to create thread");
74 return(-1);
75 }
76 return(0);
77 }
78
79 void SDL_SYS_SetupThread(void)
80 {
81 return;
82 }
83
84 Uint32 SDL_ThreadID(void)
85 {
86 return (Uint32)thd_get_current();
87 }
88
89 void SDL_SYS_WaitThread(SDL_Thread *thread)
90 {
91 thd_wait(thread->handle);
92 }
93
94 void SDL_SYS_KillThread(SDL_Thread *thread)
95 {
96 thd_destroy(thread->handle);
97 }
98 #endif