Fixed Bugzilla bug #205
Removed SDL_KillThread() from the API, as it isn't safe on many platforms. --HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403240
This commit is contained in:
parent
35c71403d7
commit
ad347d4a12
14 changed files with 15 additions and 106 deletions
|
@ -48,8 +48,5 @@ extern void SDL_SYS_SetupThread(void);
|
|||
*/
|
||||
extern void SDL_SYS_WaitThread(SDL_Thread * thread);
|
||||
|
||||
/* This function kills the thread and returns */
|
||||
extern void SDL_SYS_KillThread(SDL_Thread * thread);
|
||||
|
||||
#endif /* _SDL_systhread_h */
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
|
|
@ -306,10 +306,7 @@ SDL_GetThreadID(SDL_Thread * thread)
|
|||
void
|
||||
SDL_KillThread(SDL_Thread * thread)
|
||||
{
|
||||
if (thread) {
|
||||
SDL_SYS_KillThread(thread);
|
||||
SDL_WaitThread(thread, NULL);
|
||||
}
|
||||
/* This is a no-op in SDL 1.3 and later. */
|
||||
}
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
|
|
@ -98,10 +98,4 @@ SDL_SYS_WaitThread(SDL_Thread * thread)
|
|||
wait_for_thread(thread->handle, &the_status);
|
||||
}
|
||||
|
||||
void
|
||||
SDL_SYS_KillThread(SDL_Thread * thread)
|
||||
{
|
||||
kill_thread(thread->handle);
|
||||
}
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
|
|
@ -58,10 +58,4 @@ SDL_SYS_WaitThread(SDL_Thread * thread)
|
|||
thd_wait(thread->handle);
|
||||
}
|
||||
|
||||
void
|
||||
SDL_SYS_KillThread(SDL_Thread * thread)
|
||||
{
|
||||
thd_destroy(thread->handle);
|
||||
}
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
|
|
@ -51,10 +51,4 @@ SDL_SYS_WaitThread(SDL_Thread * thread)
|
|||
return;
|
||||
}
|
||||
|
||||
void
|
||||
SDL_SYS_KillThread(SDL_Thread * thread)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
|
|
@ -81,11 +81,4 @@ SDL_WaitThread(SDL_Thread * thread, int *status)
|
|||
}
|
||||
}
|
||||
|
||||
/* WARNING: This may not work for systems with 64-bit pid_t */
|
||||
void
|
||||
SDL_KillThread(SDL_Thread * thread)
|
||||
{
|
||||
kill(thread->handle, SIGKILL);
|
||||
}
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
|
|
@ -102,14 +102,4 @@ SDL_SYS_WaitThread(SDL_Thread * thread)
|
|||
DosWaitThread(&tid, DCWW_WAIT);
|
||||
}
|
||||
|
||||
/* WARNING: This function is really a last resort.
|
||||
* Threads should be signaled and then exit by themselves.
|
||||
* TerminateThread() doesn't perform stack and DLL cleanup.
|
||||
*/
|
||||
void
|
||||
SDL_SYS_KillThread(SDL_Thread * thread)
|
||||
{
|
||||
DosKillThread(thread->handle);
|
||||
}
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
|
|
@ -101,11 +101,4 @@ SDL_SYS_WaitThread(SDL_Thread * thread)
|
|||
pth_join(thread->handle, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
SDL_SYS_KillThread(SDL_Thread * thread)
|
||||
{
|
||||
pth_cancel(thread->handle);
|
||||
pth_join(thread->handle, NULL);
|
||||
}
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
|
|
@ -112,17 +112,4 @@ SDL_SYS_WaitThread(SDL_Thread * thread)
|
|||
pthread_join(thread->handle, 0);
|
||||
}
|
||||
|
||||
void
|
||||
SDL_SYS_KillThread(SDL_Thread * thread)
|
||||
{
|
||||
#ifdef PTHREAD_CANCEL_ASYNCHRONOUS
|
||||
pthread_cancel(thread->handle);
|
||||
#else
|
||||
#ifdef __FREEBSD__
|
||||
#warning For some reason, this doesnt actually kill a thread - FreeBSD 3.2
|
||||
#endif
|
||||
pthread_kill(thread->handle, SIGKILL);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
|
|
@ -54,12 +54,6 @@ SDL_SYS_WaitThread(SDL_Thread * thread)
|
|||
return;
|
||||
}
|
||||
|
||||
void
|
||||
SDL_SYS_KillThread(SDL_Thread * thread)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#include <signal.h>
|
||||
|
@ -143,15 +137,5 @@ SDL_SYS_WaitThread(SDL_Thread * thread)
|
|||
pthread_join(thread->handle, 0);
|
||||
}
|
||||
|
||||
void
|
||||
SDL_SYS_KillThread(SDL_Thread * thread)
|
||||
{
|
||||
#ifdef PTHREAD_CANCEL_ASYNCHRONOUS
|
||||
pthread_cancel(thread->handle);
|
||||
#else
|
||||
pthread_kill(thread->handle, SIGKILL);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
|
|
@ -164,14 +164,4 @@ SDL_SYS_WaitThread(SDL_Thread * thread)
|
|||
CloseHandle(thread->handle);
|
||||
}
|
||||
|
||||
/* WARNING: This function is really a last resort.
|
||||
* Threads should be signaled and then exit by themselves.
|
||||
* TerminateThread() doesn't perform stack and DLL cleanup.
|
||||
*/
|
||||
void
|
||||
SDL_SYS_KillThread(SDL_Thread * thread)
|
||||
{
|
||||
TerminateThread(thread->handle, FALSE);
|
||||
}
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue