gthr-posix.c revision 225736
1145132Sanholt/* POSIX threads dummy routines for systems without weak definitions. */ 2145132Sanholt/* Compile this one with gcc. */ 3145132Sanholt/* Copyright (C) 2003, 2004, 2005, 2007 Free Software Foundation, Inc. 4145132Sanholt 5145132SanholtThis file is part of GCC. 6145132Sanholt 7145132SanholtGCC is free software; you can redistribute it and/or modify it under 8145132Sanholtthe terms of the GNU General Public License as published by the Free 9145132SanholtSoftware Foundation; either version 2, or (at your option) any later 10145132Sanholtversion. 11145132Sanholt 12145132SanholtGCC is distributed in the hope that it will be useful, but WITHOUT ANY 13145132SanholtWARRANTY; without even the implied warranty of MERCHANTABILITY or 14145132SanholtFITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15145132Sanholtfor more details. 16145132Sanholt 17145132SanholtYou should have received a copy of the GNU General Public License 18145132Sanholtalong with GCC; see the file COPYING. If not, write to the Free 19145132SanholtSoftware Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 20145132Sanholt02110-1301, USA. */ 21145132Sanholt 22145132Sanholt/* As a special exception, if you link this library with other files, 23145132Sanholt some of which are compiled with GCC, to produce an executable, 24152909Sanholt this library does not by itself cause the resulting executable 25152909Sanholt to be covered by the GNU General Public License. 26152909Sanholt This exception does not however invalidate any other reasons why 27182080Srnoland the executable file might be covered by the GNU General Public License. */ 28182080Srnoland 29182080Srnoland#include "tconfig.h" 30182080Srnoland#include "tm.h" 31182080Srnoland# define __gthrw_pragma(pragma) _Pragma (#pragma) 32145132Sanholt/* Define so we provide weak definitions of functions used by libobjc only. */ 33145132Sanholt#define _LIBOBJC_WEAK 34145132Sanholt#include "gthr.h" 35145132Sanholt 36145132Sanholtint 37145132Sanholtpthread_once (pthread_once_t *once ATTRIBUTE_UNUSED, 38145132Sanholt void (*func) (void) ATTRIBUTE_UNUSED) 39145132Sanholt{ 40145132Sanholt return -1; 41194759Srnoland} 42145132Sanholt 43145132Sanholtint 44145132Sanholtpthread_key_create (pthread_key_t *key ATTRIBUTE_UNUSED, 45145132Sanholt void (*dtor) (void *) ATTRIBUTE_UNUSED) 46145132Sanholt{ 47145132Sanholt return -1; 48145132Sanholt} 49145132Sanholt 50145132Sanholtint 51194759Srnolandpthread_key_delete (pthread_key_t key ATTRIBUTE_UNUSED) 52145132Sanholt{ 53145132Sanholt return 0; 54145132Sanholt} 55145132Sanholt 56145132Sanholtvoid * 57145132Sanholtpthread_getspecific (pthread_key_t key ATTRIBUTE_UNUSED) 58145132Sanholt{ 59145132Sanholt return 0; 60182080Srnoland} 61145132Sanholt 62145132Sanholtint 63145132Sanholtpthread_setspecific (pthread_key_t key ATTRIBUTE_UNUSED, 64145132Sanholt const void *ptr ATTRIBUTE_UNUSED) 65145132Sanholt{ 66145132Sanholt return 0; 67183833Srnoland} 68145132Sanholt 69145132Sanholtint 70145132Sanholtpthread_create (pthread_t *thread ATTRIBUTE_UNUSED, 71145132Sanholt const pthread_attr_t *attr ATTRIBUTE_UNUSED, 72145132Sanholt void *(*start_routine) (void *) ATTRIBUTE_UNUSED, 73145132Sanholt void *arg ATTRIBUTE_UNUSED) 74145132Sanholt{ 75145132Sanholt return 0; 76145132Sanholt} 77145132Sanholt 78145132Sanholtint 79145132Sanholtpthread_cancel (pthread_t thread ATTRIBUTE_UNUSED) 80145132Sanholt{ 81145132Sanholt return 0; 82145132Sanholt} 83145132Sanholt 84145132Sanholtint 85145132Sanholtpthread_mutex_lock (pthread_mutex_t *mutex ATTRIBUTE_UNUSED) 86145132Sanholt{ 87145132Sanholt return 0; 88145132Sanholt} 89145132Sanholt 90145132Sanholtint 91145132Sanholtpthread_mutex_trylock (pthread_mutex_t *mutex ATTRIBUTE_UNUSED) 92145132Sanholt{ 93145132Sanholt return 0; 94145132Sanholt} 95145132Sanholt 96145132Sanholtint 97145132Sanholtpthread_mutex_unlock (pthread_mutex_t *mutex ATTRIBUTE_UNUSED) 98220979Skib{ 99145132Sanholt return 0; 100145132Sanholt} 101145132Sanholt 102145132Sanholtint 103145132Sanholtpthread_mutexattr_init (pthread_mutexattr_t *attr ATTRIBUTE_UNUSED) 104145132Sanholt{ 105145132Sanholt return 0; 106145132Sanholt} 107145132Sanholt 108145132Sanholtint 109145132Sanholtpthread_mutexattr_settype (pthread_mutexattr_t *attr ATTRIBUTE_UNUSED, 110145132Sanholt int type ATTRIBUTE_UNUSED) 111145132Sanholt{ 112145132Sanholt return 0; 113145132Sanholt} 114182080Srnoland 115145132Sanholtint 116145132Sanholtpthread_mutexattr_destroy (pthread_mutexattr_t *attr ATTRIBUTE_UNUSED) 117145132Sanholt{ 118145132Sanholt return 0; 119183833Srnoland} 120145132Sanholt 121145132Sanholtint 122145132Sanholtpthread_cond_broadcast (pthread_cond_t *cond ATTRIBUTE_UNUSED) 123145132Sanholt{ 124145132Sanholt return 0; 125145132Sanholt} 126145132Sanholt 127145132Sanholtint 128145132Sanholtpthread_cond_destroy (pthread_cond_t *cond ATTRIBUTE_UNUSED) 129145132Sanholt{ 130145132Sanholt return 0; 131145132Sanholt} 132145132Sanholt 133145132Sanholtint 134145132Sanholtpthread_cond_init (pthread_cond_t *cond ATTRIBUTE_UNUSED, 135182080Srnoland const pthread_condattr_t *attr ATTRIBUTE_UNUSED) 136145132Sanholt{ 137145132Sanholt return 0; 138145132Sanholt} 139145132Sanholt 140183573Srnolandint 141145132Sanholtpthread_cond_signal (pthread_cond_t *cond ATTRIBUTE_UNUSED) 142145132Sanholt{ 143145132Sanholt return 0; 144145132Sanholt} 145145132Sanholt 146145132Sanholtint 147145132Sanholtpthread_cond_wait (pthread_cond_t *cond ATTRIBUTE_UNUSED, 148145132Sanholt pthread_mutex_t *mutex ATTRIBUTE_UNUSED) 149145132Sanholt{ 150145132Sanholt return 0; 151145132Sanholt} 152145132Sanholt 153145132Sanholtvoid 154145132Sanholtpthread_exit (void *value_ptr ATTRIBUTE_UNUSED) 155145132Sanholt{ 156145132Sanholt} 157145132Sanholt 158145132Sanholtint 159145132Sanholtpthread_mutex_init (pthread_mutex_t *mutex ATTRIBUTE_UNUSED, 160182080Srnoland const pthread_mutexattr_t *attr ATTRIBUTE_UNUSED) 161145132Sanholt{ 162145132Sanholt return 0; 163145132Sanholt} 164145132Sanholt 165145132Sanholtint 166145132Sanholtpthread_mutex_destroy (pthread_mutex_t *mutex ATTRIBUTE_UNUSED) 167145132Sanholt{ 168145132Sanholt return 0; 169145132Sanholt} 170145132Sanholt 171145132Sanholtpthread_t 172145132Sanholtpthread_self (void) 173145132Sanholt{ 174145132Sanholt return (pthread_t) 0; 175145132Sanholt} 176145132Sanholt#ifdef _POSIX_PRIORITY_SCHEDULING 177183833Srnoland#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING 178183833Srnolandint 179145132Sanholtsched_get_priority_max (int policy ATTRIBUTE_UNUSED) 180145132Sanholt{ 181145132Sanholt return 0; 182145132Sanholt} 183145132Sanholt 184145132Sanholtint 185145132Sanholtsched_get_priority_min (int policy ATTRIBUTE_UNUSED) 186145132Sanholt{ 187145132Sanholt return 0; 188145132Sanholt} 189145132Sanholt#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */ 190189562Srnoland#endif /* _POSIX_PRIORITY_SCHEDULING */ 191207066Srnoland 192145132Sanholtint 193145132Sanholtsched_yield (void) 194145132Sanholt{ 195145132Sanholt return 0; 196145132Sanholt} 197145132Sanholt 198145132Sanholtint 199145132Sanholtpthread_attr_destroy (pthread_attr_t *attr ATTRIBUTE_UNUSED) 200145132Sanholt{ 201145132Sanholt return 0; 202145132Sanholt} 203145132Sanholt 204145132Sanholtint 205145132Sanholtpthread_attr_init (pthread_attr_t *attr ATTRIBUTE_UNUSED) 206145132Sanholt{ 207207066Srnoland return 0; 208207066Srnoland} 209207066Srnoland 210207066Srnolandint 211207066Srnolandpthread_attr_setdetachstate (pthread_attr_t *attr ATTRIBUTE_UNUSED, 212145132Sanholt int detachstate ATTRIBUTE_UNUSED) 213145132Sanholt{ 214145132Sanholt return 0; 215145132Sanholt} 216183833Srnoland 217145132Sanholt#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING 218145132Sanholtint 219145132Sanholtpthread_getschedparam (pthread_t thread ATTRIBUTE_UNUSED, 220145132Sanholt int *policy ATTRIBUTE_UNUSED, 221145132Sanholt struct sched_param *param ATTRIBUTE_UNUSED) 222182080Srnoland{ 223145132Sanholt return 0; 224145132Sanholt} 225145132Sanholt 226145132Sanholtint 227145132Sanholtpthread_setschedparam (pthread_t thread ATTRIBUTE_UNUSED, 228145132Sanholt int policy ATTRIBUTE_UNUSED, 229145132Sanholt const struct sched_param *param ATTRIBUTE_UNUSED) 230145132Sanholt{ 231145132Sanholt return 0; 232145132Sanholt} 233145132Sanholt#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */ 234145132Sanholt 235145132Sanholt