mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-24 18:34:06 +00:00
60a0ba4280
- I haven't found a good way of including external dependencies to VS projects yet. Win32-pthreads is assumed to be found at the same level as kvazaar dir and has the files x86/pthreadVC2.lib and x64/pthreadVC2.lib. - Win32-pthreads also requires the pthreadVC2.dll to be in PATH when running the program. Not sure what to do about that yet. We might need an installer for windows to handle that. - Disable openmp as it's no longer used. - Stop linking Ws2_32.lib as that hasn't been used for ages.
43 lines
1.5 KiB
C
43 lines
1.5 KiB
C
#ifndef THREADS_H_
|
|
#define THREADS_H_
|
|
/*****************************************************************************
|
|
* This file is part of Kvazaar HEVC encoder.
|
|
*
|
|
* Copyright (C) 2013-2014 Tampere University of Technology and others (see
|
|
* COPYING file).
|
|
*
|
|
* Kvazaar is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as published
|
|
* by the Free Software Foundation.
|
|
*
|
|
* Kvazaar 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 General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with Kvazaar. If not, see <http://www.gnu.org/licenses/>.
|
|
****************************************************************************/
|
|
|
|
#include <pthread.h>
|
|
|
|
#ifdef __GNUC__
|
|
#include <unistd.h>
|
|
|
|
#define ATOMIC_INC(ptr) __sync_add_and_fetch((volatile int32_t*)ptr, 1)
|
|
#define ATOMIC_DEC(ptr) __sync_add_and_fetch((volatile int32_t*)ptr, -1)
|
|
#define SLEEP() usleep(0)
|
|
|
|
#else //__GNUC__
|
|
//TODO: we assume !GCC => Windows... this may be bad
|
|
#include <Windows.h>
|
|
|
|
#define ATOMIC_INC(ptr) InterlockedIncrement((volatile LONG*)ptr)
|
|
#define ATOMIC_DEC(ptr) InterlockedDecrement((volatile LONG*)ptr)
|
|
#define SLEEP() Sleep(0)
|
|
|
|
|
|
#endif //__GNUC__
|
|
|
|
#endif //THREADS_H_
|