/[libspopc]/mutex.h
ViewVC logotype

Annotation of /mutex.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 25 - (hide annotations)
Wed Apr 11 14:06:48 2012 UTC (8 years, 6 months ago) by ben
File MIME type: text/plain
File size: 1693 byte(s)
Removed old homepage reference in docs and headers

1 ben 1 /* this is mutex.h file, part of the libspopc library sources
2     * copyright © 2002- Benoit Rouits <brouits@free.fr>
3     * released under the terms of the GNU Lesser General Public Licence.
4     *
5     * libspopc offers simple API for a pop3 client.
6     * See RFC 1725 for pop3 specifications.
7     *
8     * This library is free software; you can redistribute it and/or
9     * modify it under the terms of the GNU Lesser General Public
10     * License as published by the Free Software Foundation; either
11     * version 2.1 of the License, or (at your option) any later version.
12     *
13     * This library is distributed in the hope that it will be useful,
14     * but WITHOUT ANY WARRANTY; without even the implied warranty of
15     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16     * Lesser General Public License for more details.
17     *
18     * You should have received a copy of the GNU Lesser General Public
19     * License along with this library; if not, write to the Free Software
20     * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21     */
22    
23     #ifndef MUTEX_H
24     #define MUTEX_H
25    
26 ben 4 #ifdef USE_SEM /* no posix thread mutex */
27     #include <semaphore.h>
28     typedef sem_t mutex; /* use unix rt semaphores from librt */
29     #else
30     #ifdef USE_PMUTEX
31     #include <pthread.h>
32     typedef pthread_mutex_t mutex; /* use posix thread mutexes */
33     #else
34     typedef int mutex;
35     #endif
36     #endif
37 ben 1
38     /* initializes a thread-wide mutex */
39     int mutex_init(mutex* id);
40    
41     /* acquire the given mutex to enter in a critical section */
42     int mutex_in (mutex* id);
43    
44     /* quit the critical section, by releasing the given mutex */
45     int mutex_out (mutex* id);
46    
47     /* clean the mutex, thus re-initable by mutex_init() */
48     int mutex_clean(mutex* id);
49    
50     #endif

  ViewVC Help
Powered by ViewVC 1.1.26