Add Russian translation provided by Валерий Крувялис <valkru@mail.ru>
[xiph-mirror.git] / ogg2 / src / mutex.h
blobcf3fb40909794c156264a0da6eb6c0730abbee8a
1 /********************************************************************
2 * *
3 * THIS FILE IS PART OF THE Ogg Reference Library SOURCE CODE. *
4 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7 * *
8 * THE Ogg Reference Library SOURCE CODE IS (C) COPYRIGHT 1994-2004 *
9 * by the Xiph.Org Foundation http://www.xiph.org/ *
10 * *
11 ********************************************************************
13 function: #ifdef jail for basic thread mutexing
14 last mod: $Id$
16 ********************************************************************/
18 /* the thread mutexing here is for internal Ogg use only; the
19 zero-copy code in libogg2 centralizes buffer management in one
20 place where libogg1 spreads it across abstraction layers.
22 Mutexing code isn't requird for a platform, it's only required to
23 use threads with libogg and oggfile. */
25 #ifndef _OGG2_MUTEX_H_
26 #define _OGG2_MUTEX_H_
28 #ifdef USE_POSIX_THREADS
29 #define _REENTRANT 1
30 #include <pthread.h>
31 typedef pthread_mutex_t ogg2_mutex_t;
32 #define ogg2_mutex_init(m) (pthread_mutex_init((m),NULL))
33 #define ogg2_mutex_clear(m) (pthread_mutex_destroy(m))
34 #define ogg2_mutex_lock(m) (pthread_mutex_lock(m))
35 #define ogg2_mutex_unlock(m) (pthread_mutex_unlock(m))
37 #elif USE_NO_THREADS
38 typedef int ogg2_mutex_t;
39 #define noop() do {} while(0)
40 #define ogg2_mutex_init(m) noop()
41 #define ogg2_mutex_clear(m) noop()
42 #define ogg2_mutex_lock(m) noop()
43 #define ogg2_mutex_unlock(m) noop()
45 #else
46 #error "configure proper threading wrappers for this platform, or compile with -DUSE_NO_THREADS to build without threading support."
48 #endif
50 #endif /*_OGG2_MUTEX_H_*/