2002-10-05 16:50:56 +00:00
|
|
|
/*
|
|
|
|
SDL - Simple DirectMedia Layer
|
2006-02-01 06:32:25 +00:00
|
|
|
Copyright (C) 1997-2006 Sam Lantinga
|
2002-10-05 16:50:56 +00:00
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
2006-02-01 06:32:25 +00:00
|
|
|
modify it under the terms of the GNU Lesser General Public
|
2002-10-05 16:50:56 +00:00
|
|
|
License as published by the Free Software Foundation; either
|
2006-02-01 06:32:25 +00:00
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
2002-10-05 16:50:56 +00:00
|
|
|
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2006-02-01 06:32:25 +00:00
|
|
|
Lesser General Public License for more details.
|
2002-10-05 16:50:56 +00:00
|
|
|
|
2006-02-01 06:32:25 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
|
|
License along with this library; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
2002-10-05 16:50:56 +00:00
|
|
|
|
|
|
|
Sam Lantinga
|
|
|
|
slouken@libsdl.org
|
|
|
|
*/
|
2006-02-21 08:46:50 +00:00
|
|
|
#include "SDL_config.h"
|
2002-10-05 16:50:56 +00:00
|
|
|
|
|
|
|
/* Thread management routines for SDL */
|
|
|
|
|
|
|
|
#include "SDL_thread.h"
|
2006-03-02 13:16:02 +00:00
|
|
|
#include "../SDL_thread_c.h"
|
2006-02-16 10:11:48 +00:00
|
|
|
#include "../SDL_systhread.h"
|
2002-10-05 16:50:56 +00:00
|
|
|
|
|
|
|
#include <kos/thread.h>
|
|
|
|
|
|
|
|
int SDL_SYS_CreateThread(SDL_Thread *thread, void *args)
|
|
|
|
{
|
|
|
|
thread->handle = thd_create(SDL_RunThread,args);
|
|
|
|
if (thread->handle == NULL) {
|
|
|
|
SDL_SetError("Not enough resources to create thread");
|
|
|
|
return(-1);
|
|
|
|
}
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SDL_SYS_SetupThread(void)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
Uint32 SDL_ThreadID(void)
|
|
|
|
{
|
|
|
|
return (Uint32)thd_get_current();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SDL_SYS_WaitThread(SDL_Thread *thread)
|
|
|
|
{
|
|
|
|
thd_wait(thread->handle);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SDL_SYS_KillThread(SDL_Thread *thread)
|
|
|
|
{
|
|
|
|
thd_destroy(thread->handle);
|
|
|
|
}
|