2011-09-19 05:48:43 +00:00
|
|
|
// This file is part of BOINC.
|
|
|
|
// http://boinc.berkeley.edu
|
|
|
|
// Copyright (C) 2011 University of California
|
|
|
|
//
|
|
|
|
// BOINC 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 3 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// BOINC 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 BOINC. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
#else
|
|
|
|
#include <pthread.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
struct THREAD {
|
|
|
|
void* arg;
|
|
|
|
bool quit_flag;
|
2011-09-19 05:57:53 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
int run(LPTHREAD_START_ROUTINE, void*);
|
|
|
|
#else
|
2011-09-19 05:48:43 +00:00
|
|
|
int run(void*(*func)(void*), void*);
|
2011-09-19 05:57:53 +00:00
|
|
|
#endif
|
2011-09-19 05:48:43 +00:00
|
|
|
void quit();
|
|
|
|
};
|
|
|
|
|
|
|
|
struct THREAD_LOCK {
|
|
|
|
#ifdef _WIN32
|
|
|
|
CRITICAL_SECTION mutex;
|
|
|
|
#else
|
|
|
|
pthread_mutex_t mutex;
|
|
|
|
#endif
|
|
|
|
void lock();
|
|
|
|
void unlock();
|
|
|
|
|
|
|
|
THREAD_LOCK();
|
|
|
|
};
|