1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
6 * Moonlight List (moonlight-list@lists.ximian.com)
8 * Copyright 2009 Novell, Inc. (http://www.novell.com)
10 * See the LICENSE file included with the distribution for details.
13 #ifndef __MOON_MUTEX_H__
14 #define __MOON_MUTEX_H__
20 pthread_mutex_t mutex
;
25 pthread_mutex_init (&mutex
, NULL
);
27 Mutex (bool recursive
)
29 pthread_mutexattr_t attribs
;
30 pthread_mutexattr_init (&attribs
);
31 pthread_mutexattr_settype (&attribs
, recursive
? PTHREAD_MUTEX_RECURSIVE
: PTHREAD_MUTEX_DEFAULT
);
32 pthread_mutex_init (&mutex
, &attribs
);
33 pthread_mutexattr_destroy (&attribs
);
37 pthread_mutex_destroy (&mutex
);
41 pthread_mutex_lock (&mutex
);
45 pthread_mutex_unlock (&mutex
);
49 #endif /* __MOON_MUTEX_H */