/simpletypesystem/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/simpletypesystem/trunk

« back to all changes in this revision

Viewing changes to src/Thread.h

  • Committer: Gustav Hartvigsson
  • Date: 2015-09-15 15:18:49 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20150915151849-vpns3lv2c30qwjga
* More work on SStream... Requiers Mutex suppert :-)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
#ifndef __H_THREAD__
 
3
#define __H_THREAD__
 
4
 
 
5
#include "defs.h"
 
6
#include "utils.h"
 
7
 
 
8
/**
 
9
 * @defgroup Threading Threading
 
10
 * @addtogroup Threading
 
11
 * @{
 
12
 */
 
13
 
 
14
 
 
15
/**
 
16
 * Sleep for a set amount of mucro seconds.
 
17
 */
 
18
void
 
19
s_usleep (slong us);
 
20
 
 
21
/**
 
22
 * @defgroup Mutex Mutex
 
23
 * @addtogroup Mutex
 
24
 * @{
 
25
 */
 
26
 
 
27
/**
 
28
 * An SMutex is an opaque data type that handles the platform specifics of the
 
29
 * Mutex, if it exists. If not we roll our own.
 
30
 */
 
31
typedef struct SMutex SMutex;
 
32
 
 
33
/**
 
34
 * Create a new SMutex;
 
35
 */
 
36
SMutex *
 
37
s_mutex_new ();
 
38
 
 
39
/**
 
40
 * Free the mutex.
 
41
 */
 
42
void
 
43
s_mutex_free (SMutex * self);
 
44
 
 
45
/**
 
46
 * Lock the mutex.
 
47
 *
 
48
 * Returns a key used to unlock the mutex.
 
49
 */
 
50
suint
 
51
s_mutex_lock (SMutex * self);
 
52
 
 
53
/**
 
54
 * unlock the mutex.
 
55
 *
 
56
 * @param self The mutex to unlock;
 
57
 * @param key The key used to unlock the mutex.
 
58
 */
 
59
void
 
60
s_mutex_unlock (SMutex * self, suint key);
 
61
 
 
62
/**
 
63
 * 
 
64
 */
 
65
sboolean
 
66
s_mutex_check_lock (SMutex * self);
 
67
 
 
68
/** @} */
 
69
 
 
70
/** @} */
 
71
 
 
72
 
 
73
#endif /* __H_THREAD__ */