/usr/include/c_icap/ci_threads.h is in libicapapi-dev 1:0.4.4-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | /*
* Copyright (C) 2004-2008 Christos Tsantilas
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA.
*/
#ifndef __CI_THREADS_H
#define __CI_THREADS_H
#include "c-icap.h"
#ifdef __cplusplus
extern "C"
{
#endif
#ifndef _WIN32
#include <pthread.h>
#define ci_thread_mutex_t pthread_mutex_t
#define ci_thread_cond_t pthread_cond_t
#define ci_thread_t pthread_t
CI_DECLARE_FUNC(int) ci_thread_mutex_init(ci_thread_mutex_t *pmutex);
CI_DECLARE_FUNC(int) ci_thread_mutex_destroy(ci_thread_mutex_t *pmutex);
#define ci_thread_mutex_lock(pmutex) pthread_mutex_lock(pmutex)
#define ci_thread_mutex_unlock(pmutex) pthread_mutex_unlock(pmutex)
#define ci_thread_self pthread_self
#ifdef USE_PTHREADS_RWLOCK
#define ci_thread_rwlock_t pthread_rwlock_t
CI_DECLARE_FUNC(int) ci_thread_rwlock_init(ci_thread_rwlock_t *);
CI_DECLARE_FUNC(int) ci_thread_rwlock_destroy(ci_thread_rwlock_t *);
#define ci_thread_rwlock_rdlock(rwlock) pthread_rwlock_rdlock(rwlock)
#define ci_thread_rwlock_wrlock(rwlock) pthread_rwlock_wrlock(rwlock)
#define ci_thread_rwlock_unlock(rwlock) pthread_rwlock_unlock(rwlock)
#else
#define ci_thread_rwlock_t pthread_mutex_t
CI_DECLARE_FUNC(int) ci_thread_rwlock_init(ci_thread_rwlock_t *);
CI_DECLARE_FUNC(int) ci_thread_rwlock_destroy(ci_thread_rwlock_t *);
CI_DECLARE_FUNC(int) ci_thread_rwlock_rdlock(ci_thread_rwlock_t *);
CI_DECLARE_FUNC(int) ci_thread_rwlock_wrlock(ci_thread_rwlock_t *);
CI_DECLARE_FUNC(int) ci_thread_rwlock_unlock(ci_thread_rwlock_t *);
#endif
CI_DECLARE_FUNC(int) ci_thread_cond_init(ci_thread_cond_t *pcond);
CI_DECLARE_FUNC(int) ci_thread_cond_destroy(ci_thread_cond_t *pcond);
#define ci_thread_cond_wait(pcond,pmutex) pthread_cond_wait(pcond,pmutex)
#define ci_thread_cond_broadcast(pcond) pthread_cond_broadcast(pcond)
#define ci_thread_cond_signal(pcond) pthread_cond_signal(pcond)
CI_DECLARE_FUNC(int) ci_thread_create(ci_thread_t *pthread_id, void *(*pfunc)(void *), void *parg);
CI_DECLARE_FUNC(int) ci_thread_join(ci_thread_t thread_id);
#else /*ifdef _WIN32*/
#include <windows.h>
#define ci_thread_mutex_t CRITICAL_SECTION
#define ci_thread_rwlock_t CRITICAL_SECTION
#define ci_thread_cond_t HANDLE
#define ci_thread_t DWORD
CI_DECLARE_FUNC(int) ci_thread_mutex_init(ci_thread_mutex_t *pmutex);
CI_DECLARE_FUNC(int) ci_thread_mutex_destroy(ci_thread_mutex_t *pmutex);
CI_DECLARE_FUNC(int) ci_thread_mutex_lock(ci_thread_mutex_t *pmutex);
CI_DECLARE_FUNC(int) ci_thread_mutex_unlock(ci_thread_mutex_t *pmutex);
CI_DECLARE_FUNC(int) ci_thread_rwlock_init(ci_thread_rwlock_t *);
CI_DECLARE_FUNC(int) ci_thread_rwlock_destroy(ci_thread_rwlock_t *);
CI_DECLARE_FUNC(int) ci_thread_rwlock_rdlock(ci_thread_rwlock_t *);
CI_DECLARE_FUNC(int) ci_thread_rwlock_wrlock(ci_thread_rwlock_t *);
CI_DECLARE_FUNC(int) ci_thread_rwlock_unlock(ci_thread_rwlock_t *);
CI_DECLARE_FUNC(int) ci_thread_cond_init(ci_thread_cond_t *pcond);
CI_DECLARE_FUNC(int) ci_thread_cond_destroy(ci_thread_cond_t *pcond);
CI_DECLARE_FUNC(int) ci_thread_cond_wait(ci_thread_cond_t *pcond,ci_thread_mutex_t *pmutex);
CI_DECLARE_FUNC(int) ci_thread_cond_broadcast(ci_thread_cond_t *pcond);
CI_DECLARE_FUNC(int) ci_thread_cond_signal(ci_thread_cond_t *pcond);
CI_DECLARE_FUNC(int) ci_thread_create(ci_thread_t *thread_id, void *(*pfunc)(void *), void *parg);
CI_DECLARE_FUNC(int) ci_thread_join(ci_thread_t thread_id);
#endif
#ifdef __cplusplus
}
#endif
#endif /*__CI_THREADS_H */
|