6dc155ab7ade6477dbb0e679532d35e99d653cec
[public/netxms.git] / src / libstrophe / thread.h
1 /* thread.h
2 ** strophe XMPP client library -- thread abstraction header
3 **
4 ** Copyright (C) 2005-2009 Collecta, Inc.
5 **
6 ** This software is provided AS-IS with no warranty, either express
7 ** or implied.
8 **
9 ** This software is distributed under license and may not be copied,
10 ** modified or distributed except as expressly authorized under the
11 ** terms of the license contained in the file LICENSE.txt in this
12 ** distribution.
13 */
14
15 /** @file
16 * Threading abstraction API.
17 */
18
19 #ifndef __LIBSTROPHE_THREAD_H__
20 #define __LIBSTROPHE_THREAD_H__
21
22 #include <stdio.h>
23 #include <stdlib.h>
24
25 #ifdef _WIN32
26 #include <windows.h>
27 #else
28 #include <pthread.h>
29 #endif
30
31 #include "strophe.h"
32
33 typedef struct _mutex_t mutex_t;
34
35 /* mutex functions */
36
37 mutex_t *mutex_create(const xmpp_ctx_t *ctx);
38 int mutex_destroy(mutex_t *mutex);
39 int mutex_lock(mutex_t *mutex);
40 int mutex_trylock(mutex_t *mutex);
41 int mutex_unlock(mutex_t *mutex);
42
43 #endif /* __LIBSTROPHE_THREAD_H__ */