diff --git a/Makefile.wii b/Makefile.wii index f961a0afb7..c0da196745 100644 --- a/Makefile.wii +++ b/Makefile.wii @@ -39,7 +39,7 @@ CFLAGS += -DHAVE_FILE_LOGGER CFLAGS += -Iconsole/logger endif -CFLAGS += -std=gnu99 -DHAVE_DEFAULT_RETROPAD_INPUT -DHAVE_RGUI -DRARCH_CONSOLE -DHAVE_LIBRETRO_MANAGEMENT -DHAVE_RARCH_EXEC -DHAVE_CONFIGFILE=1 -DGEKKO -DHW_RVL -DHAVE_ZLIB -DHAVE_RARCH_MAIN_WRAP -DHAVE_GRIFFIN=1 -DPACKAGE_VERSION=\"0.9.7-rc1\" -Dmain=rarch_main -Wno-char-subscripts +CFLAGS += -std=gnu99 -DHAVE_DEFAULT_RETROPAD_INPUT -DHAVE_RGUI -DHAVE_THREAD -DRARCH_CONSOLE -DHAVE_LIBRETRO_MANAGEMENT -DHAVE_RARCH_EXEC -DHAVE_CONFIGFILE=1 -DGEKKO -DHW_RVL -DHAVE_ZLIB -DHAVE_RARCH_MAIN_WRAP -DHAVE_GRIFFIN=1 -DPACKAGE_VERSION=\"0.9.7-rc1\" -Dmain=rarch_main -Wno-char-subscripts ifeq ($(DEBUG), 1) CFLAGS += -O0 -g diff --git a/gx/gx_pthread.h b/gx/gx_pthread.h new file mode 100644 index 0000000000..739759a990 --- /dev/null +++ b/gx/gx_pthread.h @@ -0,0 +1,79 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2010-2012 - Hans-Kristian Arntzen + * Copyright (C) 2011-2012 - Daniel De Matteis + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch 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 RetroArch. + * If not, see . + */ + +#ifndef _GX_PTHREAD_WRAP_GX_ +#define _GX_PTHREAD_WRAP_GX_ + +#include +#include +#include + +#define STACKSIZE 8*1024 + +typedef lwp_t pthread_t; +typedef mutex_t pthread_mutex_t; +typedef void* pthread_mutexattr_t; +typedef int pthread_attr_t; +typedef cond_t pthread_cond_t; +typedef cond_t pthread_condattr_t; + +static inline int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void*), void *arg) +{ + *thread = 0; + return LWP_CreateThread(thread, start_routine, arg, 0, STACKSIZE, 64); +} + +static inline int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr) +{ + return LWP_MutexInit(mutex, 0); +} + +static inline int pthread_mutex_destroy(pthread_mutex_t *mutex){ return LWP_MutexDestroy(*mutex);} + +static inline int pthread_mutex_lock(pthread_mutex_t *mutex) { return LWP_MutexLock(*mutex); } + +static inline int pthread_mutex_unlock(pthread_mutex_t *mutex) { return LWP_MutexUnlock(*mutex); } + +static inline int pthread_join(pthread_t thread, void**retval) { return LWP_JoinThread(thread, NULL); } + +static inline int pthread_mutex_trylock(pthread_mutex_t *mutex){ return LWP_MutexTryLock(*mutex);} + +static inline int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex) +{ + return LWP_CondWait(*(cond), *(mutex)); +} + +static inline int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, const struct timespec *abstime) +{ + return LWP_CondWait(*(cond), *(mutex)); +} + +static inline int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr) +{ + return LWP_CondInit(cond); +} + +static inline int pthread_cond_signal(pthread_cond_t *cond) +{ + return LWP_CondSignal(*(cond)); +} + +static inline int pthread_cond_destroy(pthread_cond_t *cond) +{ + return LWP_CondDestroy(*(cond)); +} + +#endif diff --git a/thread.c b/thread.c index 0a068e829f..93d93a168e 100644 --- a/thread.c +++ b/thread.c @@ -21,6 +21,8 @@ #include #elif defined(_XBOX) #include +#elif defined(GEKKO) +#include "gx/gx_pthread.h" #else #include #include