/*****************************************************************************1* win32thread.h: windows threading2*****************************************************************************3* Copyright (C) 2010-2016 x264 project4*5* Authors: Steven Walters <[email protected]>6*7* This program is free software; you can redistribute it and/or modify8* it under the terms of the GNU General Public License as published by9* the Free Software Foundation; either version 2 of the License, or10* (at your option) any later version.11*12* This program is distributed in the hope that it will be useful,13* but WITHOUT ANY WARRANTY; without even the implied warranty of14* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the15* GNU General Public License for more details.16*17* You should have received a copy of the GNU General Public License18* along with this program; if not, write to the Free Software19* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.20*21* This program is also available under a commercial proprietary license.22* For more information, contact us at [email protected].23*****************************************************************************/2425#ifndef X264_WIN32THREAD_H26#define X264_WIN32THREAD_H2728#include <windows.h>29/* the following macro is used within x264 */30#undef ERROR3132typedef struct33{34void *handle;35void *(*func)( void* arg );36void *arg;37void **p_ret;38void *ret;39} x264_pthread_t;40#define x264_pthread_attr_t int4142/* the conditional variable api for windows 6.0+ uses critical sections and not mutexes */43typedef CRITICAL_SECTION x264_pthread_mutex_t;44#define X264_PTHREAD_MUTEX_INITIALIZER {0}45#define x264_pthread_mutexattr_t int4647/* This is the CONDITIONAL_VARIABLE typedef for using Window's native conditional variables on kernels 6.0+.48* MinGW does not currently have this typedef. */49typedef struct50{51void *ptr;52} x264_pthread_cond_t;53#define x264_pthread_condattr_t int5455int x264_pthread_create( x264_pthread_t *thread, const x264_pthread_attr_t *attr,56void *(*start_routine)( void* ), void *arg );57int x264_pthread_join( x264_pthread_t thread, void **value_ptr );5859int x264_pthread_mutex_init( x264_pthread_mutex_t *mutex, const x264_pthread_mutexattr_t *attr );60int x264_pthread_mutex_destroy( x264_pthread_mutex_t *mutex );61int x264_pthread_mutex_lock( x264_pthread_mutex_t *mutex );62int x264_pthread_mutex_unlock( x264_pthread_mutex_t *mutex );6364int x264_pthread_cond_init( x264_pthread_cond_t *cond, const x264_pthread_condattr_t *attr );65int x264_pthread_cond_destroy( x264_pthread_cond_t *cond );66int x264_pthread_cond_broadcast( x264_pthread_cond_t *cond );67int x264_pthread_cond_wait( x264_pthread_cond_t *cond, x264_pthread_mutex_t *mutex );68int x264_pthread_cond_signal( x264_pthread_cond_t *cond );6970#define x264_pthread_attr_init(a) 071#define x264_pthread_attr_destroy(a) 07273int x264_win32_threading_init( void );74void x264_win32_threading_destroy( void );7576int x264_pthread_num_processors_np( void );7778#endif798081