/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 libssts/Thread.h

* Merged in new Main Loop branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
void
41
41
s_usleep (slong us);
42
42
 
 
43
/** @brief
 
44
 * The status of the thread.
 
45
 *
 
46
 * These values are equivalent to the value defined my the threads.h. They are
 
47
 * offten used as return values for different fuctions.
 
48
 */
 
49
typedef enum {
 
50
  S_THREAD_STATUS_SUCCESS    = thrd_success, /*< Succes*/
 
51
  S_THREAD_STATUS_TIMEOUT    = thrd_timeout, /*< Timeout*/
 
52
  S_THREAD_STATUS_ERROR      = thrd_error,   /*< Error */
 
53
  S_THREAD_STATUS_BUSY       = thrd_busy,    /*< Busy */
 
54
  S_THREAD_STATUS_NO_MEM     = thrd_nomem,   /*< No memory*/
 
55
  S_THREAD_STATUS_LAST                       /*< Not used */
 
56
} SThreadStatus;
 
57
 
 
58
/**
 
59
 * @see SThreadStatus
 
60
 */
 
61
S_UNUSED static
 
62
schar * SThreadStatusName[] = {
 
63
  "Succes",
 
64
  "Timeout",
 
65
  "Error",
 
66
  "Busy",
 
67
  "No Momory",
 
68
  "INVALID",
 
69
  0x0,
 
70
  0x0
 
71
};
 
72
 
 
73
/** @brief
 
74
 * Get the status name.
 
75
 *
 
76
 * For use in bindings.
 
77
 *
 
78
 * @see SThreadStatus
 
79
 * @see SThreadStatusName
 
80
 */
 
81
 
 
82
char *
 
83
s_thread_status_get_name (SThreadStatus status);
43
84
 
44
85
/* ****************************************************************************
45
86
 ********************************** SMutex ************************************
46
87
 **************************************************************************** */
47
88
 
48
89
/**
49
 
 * @defgroup Mutex Mutex
50
 
 * @addtogroup Mutex
 
90
 * @defgroup SMutex SMutex
 
91
 * @addtogroup SMutex
51
92
 * @{
52
93
 */
53
94
 
 
95
 
54
96
/**
55
97
 * An SMutex is an opaque data type that handles the platform specifics of the
56
98
 * Mutex, if it exists. If not we roll our own.
74
116
 *
75
117
 * Returns a key used to unlock the mutex.
76
118
 */
77
 
sint
 
119
SThreadStatus
78
120
s_mutex_lock (SMutex * self);
79
121
 
80
122
/**
83
125
 * @param self The mutex to unlock;
84
126
 * @param key The key used to unlock the mutex.
85
127
 */
86
 
sint
 
128
SThreadStatus
87
129
s_mutex_unlock (SMutex * self);
88
130
 
89
131
/**
91
133
 *
92
134
 * Note that this operation is non-atomic and may be wrong. 
93
135
 */
94
 
sboolean
 
136
SThreadStatus
95
137
s_mutex_check_lock (SMutex * self);
96
138
 
97
139
/** @} */