1 /*
2   This file is part of Deadbeef Player source code
3   http://deadbeef.sourceforge.net
4 
5   threading functions wrapper
6 
7   Copyright (C) 2009-2013 Alexey Yakovenko
8 
9   This software is provided 'as-is', without any express or implied
10   warranty.  In no event will the authors be held liable for any damages
11   arising from the use of this software.
12 
13   Permission is granted to anyone to use this software for any purpose,
14   including commercial applications, and to alter it and redistribute it
15   freely, subject to the following restrictions:
16 
17   1. The origin of this software must not be misrepresented; you must not
18      claim that you wrote the original software. If you use this software
19      in a product, an acknowledgment in the product documentation would be
20      appreciated but is not required.
21   2. Altered source versions must be plainly marked as such, and must not be
22      misrepresented as being the original software.
23   3. This notice may not be removed or altered from any source distribution.
24 
25   Alexey Yakovenko waker@users.sourceforge.net
26 */
27 #ifndef __THREADING_H
28 #define __THREADING_H
29 
30 #include <stdint.h>
31 
32 intptr_t
33 thread_start (void (*fn)(void *ctx), void *ctx);
34 
35 intptr_t
36 thread_start_low_priority (void (*fn)(void *ctx), void *ctx);
37 
38 int
39 thread_join (intptr_t tid);
40 
41 int
42 thread_detach (intptr_t tid);
43 
44 void
45 thread_exit (void *retval);
46 
47 uintptr_t
48 mutex_create (void);
49 
50 uintptr_t
51 mutex_create_nonrecursive (void);
52 
53 void
54 mutex_free (uintptr_t mtx);
55 
56 int
57 mutex_lock (uintptr_t mtx);
58 
59 int
60 mutex_unlock (uintptr_t mtx);
61 
62 uintptr_t
63 cond_create (void);
64 
65 void
66 cond_free (uintptr_t cond);
67 
68 int
69 cond_wait (uintptr_t cond, uintptr_t mutex);
70 
71 int
72 cond_signal (uintptr_t cond);
73 
74 int
75 cond_broadcast (uintptr_t cond);
76 
77 #endif
78 
79