/usr/include/strigi/strigi_thread.h is in libstreamanalyzer-dev 0.7.8-1.2+b2.
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 | /* This file is part of Strigi Desktop Search
*
* Copyright (C) 2006 Jos van den Oever <jos@vandenoever.info>
* Ben van Klinken <bvanklinken@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef STRIGI_THREAD_H
#define STRIGI_THREAD_H
#define CMAKE_USE_PTHREADS_INIT 1
/* #undef CMAKE_USE_WIN32_THREADS_INIT */
#if defined(CMAKE_USE_PTHREADS_INIT)
#include <pthread.h>
#define STRIGI_MUTEX_DEFINE(x) pthread_mutex_t x
#define STRIGI_MUTEX_INIT(x) pthread_mutex_init(x, 0)
#define STRIGI_MUTEX_DESTROY(x) pthread_mutex_destroy(x)
#define STRIGI_MUTEX_LOCK(x) pthread_mutex_lock(x)
#define STRIGI_MUTEX_TRY_LOCK(x) pthread_mutex_trylock(x)
#define STRIGI_MUTEX_UNLOCK(x) pthread_mutex_unlock(x)
#define STRIGI_THREAD_DEFINE(x) pthread_t x
#define STRIGI_THREAD_TYPE pthread_t
#define STRIGI_THREAD_CREATE(threadObject, function, data) pthread_create(threadObject, NULL, function, data)
#define STRIGI_THREAD_FUNCTION(functionName, param) void* functionName(void *param)
#define STRIGI_THREAD_JOIN(object) pthread_join(object,0)
#define STRIGI_THREAD_EXIT(ret) pthread_exit(ret)
#define STRIGI_THREAD_SELF() pthread_self()
#elif defined(CMAKE_USE_WIN32_THREADS_INIT)
#include <windows.h>
#define STRIGI_MUTEX_DEFINE(x) CRITICAL_SECTION x;
#define STRIGI_MUTEX_INIT(x) InitializeCriticalSection(x)
#define STRIGI_MUTEX_DESTROY(x) DeleteCriticalSection(x)
#define STRIGI_MUTEX_LOCK(x) EnterCriticalSection(x)
#define STRIGI_MUTEX_TRY_LOCK(x) TryEnterCriticalSection(x)
#define STRIGI_MUTEX_UNLOCK(x) LeaveCriticalSection(x)
#define STRIGI_THREAD_DEFINE(x) HANDLE x
#define STRIGI_THREAD_TYPE HANDLE
#define STRIGI_THREAD_CREATE(threadObject, rfunction, data) ((*(threadObject)=CreateThread( NULL, 0, (LPTHREAD_START_ROUTINE)rfunction, data, 0, NULL))==NULL?-1:0)
#define STRIGI_THREAD_FUNCTION(functionName, param) DWORD WINAPI functionName(LPVOID param)
#define STRIGI_THREAD_JOIN(object) WaitForSingleObject (object, INFINITE)
#define STRIGI_THREAD_EXIT(ret) ExitThread(ret)
#define STRIGI_THREAD_SELF() GetCurrentThread()
#endif //mutex types
#undef CMAKE_USE_PTHREADS_INIT
#undef CMAKE_USE_WIN32_THREADS_INIT
class StrigiMutex{
private:
STRIGI_MUTEX_DEFINE(m_lock);
public:
StrigiMutex(){
STRIGI_MUTEX_INIT(&m_lock);
}
~StrigiMutex(){
STRIGI_MUTEX_DESTROY(&m_lock);
}
void lock() {
STRIGI_MUTEX_LOCK(&m_lock);
}
void unlock() {
STRIGI_MUTEX_UNLOCK(&m_lock);
}
};
#endif
|