Fixed binary search: no more infinite loops when vendor is unknown.
[tangerine.git] / workbench / libs / thread / exitthread.c
blobf48ed3a7e0d5071ea849112e43b50e648c694ff6
1 /*
2 * thread.library - threading and synchronisation primitives
4 * Copyright © 2008 Markus Weiss
6 * This program is free software; you can redistribute it and/or modify it
7 * under the same terms as AROS itself.
8 */
10 #include "thread_intern.h"
12 /*****************************************************************************
14 NAME */
15 AROS_LH1(void, ExitThread,
17 /* SYNOPSIS */
18 AROS_LHA(void *, result, A0),
20 /* LOCATION */
21 struct ThreadBase *, ThreadBase, 20, Thread)
23 /* FUNCTION
24 Exits the calling thread.
26 INPUTS
27 result - pointer to storage for the thread's return value. You can
28 pass NULL here if you don't care about the return value.
30 RESULT
31 None, this function never returns.
33 NOTES
34 This function is similar to the exit() function of arosc library.
36 EXAMPLE
37 ExitThread(5);
39 BUGS
41 SEE ALSO
42 WaitThread(), WaitAllThreads(), exit()
44 INTERNALS
46 *****************************************************************************/
48 AROS_LIBFUNC_INIT
50 struct _Thread *thread = _getthreadbytask(FindTask(NULL), ThreadBase);
51 if (thread == NULL)
52 /* if called from a task that is not a thread */
53 return;
55 thread->result = result;
57 longjmp(thread->jmp, 1);
59 AROS_LIBFUNC_EXIT
60 } /* ExitThread */