Fixed binary search: no more infinite loops when vendor is unknown.
[tangerine.git] / workbench / libs / thread / waitallthreads.c
blob23b0e373ff6fde7aec030468f5295b0bc32e0b82
1 /*
2 * thread.library - threading and synchronisation primitives
4 * Copyright © 2007 Robert Norris
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 #include <exec/lists.h>
13 #include <proto/thread.h>
15 /*****************************************************************************
17 NAME */
18 AROS_LH0(void, WaitAllThreads,
20 /* SYNOPSIS */
22 /* LOCATION */
23 struct ThreadBase *, ThreadBase, 7, Thread)
25 /* FUNCTION
26 Blocks the current task until all threads exit.
28 INPUTS
29 None.
31 RESULT
32 This function always succeeds.
34 NOTES
35 This function will ignore detached threads.
37 EXAMPLE
38 WaitAllThreads();
40 BUGS
42 SEE ALSO
43 CreateThread(), CurrentThread(), DetachThread(), WaitThread()
45 INTERNALS
47 *****************************************************************************/
49 AROS_LIBFUNC_INIT
51 struct _Thread *thread, *next;
53 ForeachNodeSafe(&ThreadBase->threads, thread, next)
54 WaitThread(thread->id, NULL);
56 AROS_LIBFUNC_EXIT
57 } /* WaitAllThreads */