1132718Skan/* Threads compatibility routines for libgcc2. */ 2132718Skan/* Compile this one with gcc. */ 3169689Skan/* Copyright (C) 2003, 2004 Free Software Foundation, Inc. 4132718Skan 5132718SkanThis file is part of GCC. 6132718Skan 7132718SkanGCC is free software; you can redistribute it and/or modify it under 8132718Skanthe terms of the GNU General Public License as published by the Free 9132718SkanSoftware Foundation; either version 2, or (at your option) any later 10132718Skanversion. 11132718Skan 12132718SkanGCC is distributed in the hope that it will be useful, but WITHOUT ANY 13132718SkanWARRANTY; without even the implied warranty of MERCHANTABILITY or 14132718SkanFITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15132718Skanfor more details. 16132718Skan 17132718SkanYou should have received a copy of the GNU General Public License 18132718Skanalong with GCC; see the file COPYING. If not, write to the Free 19169689SkanSoftware Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 20169689Skan02110-1301, USA. */ 21132718Skan 22132718Skan/* As a special exception, if you link this library with other files, 23132718Skan some of which are compiled with GCC, to produce an executable, 24132718Skan this library does not by itself cause the resulting executable 25132718Skan to be covered by the GNU General Public License. 26132718Skan This exception does not however invalidate any other reasons why 27132718Skan the executable file might be covered by the GNU General Public License. */ 28132718Skan 29132718Skan#include "gthr-gnat.h" 30132718Skan 31169689Skan#ifndef HIDE_EXPORTS 32169689Skan#pragma GCC visibility push(default) 33169689Skan#endif 34169689Skan 35132718Skan#ifdef __cplusplus 36132718Skan#define UNUSED(x) 37132718Skan#else 38132718Skan#define UNUSED(x) x __attribute__((unused)) 39132718Skan#endif 40132718Skan 41132718Skanvoid __gnat_default_lock (void); 42132718Skanvoid __gnat_default_unlock (void); 43132718Skan 44132718Skanvoid 45132718Skan__gnat_default_lock (void) 46132718Skan{ 47132718Skan return; 48132718Skan} 49132718Skan 50132718Skanvoid 51132718Skan__gnat_default_unlock (void) 52132718Skan{ 53132718Skan return; 54132718Skan} 55132718Skan 56132718Skanstatic void (*__gnat_task_lock) (void) = *__gnat_default_lock; 57132718Skanstatic void (*__gnat_task_unlock) (void) = *__gnat_default_unlock; 58132718Skan 59132718Skan void 60132718Skan__gnat_install_locks (void (*lock) (void), void (*unlock) (void)) 61132718Skan{ 62132718Skan __gnat_task_lock = lock; 63132718Skan __gnat_task_unlock = unlock; 64132718Skan} 65132718Skan 66132718Skanint 67132718Skan__gthread_active_p (void) 68132718Skan{ 69132718Skan return 0; 70132718Skan} 71132718Skan 72132718Skanint 73132718Skan__gthread_mutex_lock (__gthread_mutex_t * UNUSED (mutex)) 74132718Skan{ 75132718Skan __gnat_task_lock (); 76132718Skan return 0; 77132718Skan} 78132718Skan 79132718Skanint 80132718Skan__gthread_mutex_unlock (__gthread_mutex_t * UNUSED (mutex)) 81132718Skan{ 82132718Skan __gnat_task_unlock (); 83132718Skan return 0; 84132718Skan} 85169689Skan 86169689Skan#ifndef HIDE_EXPORTS 87169689Skan#pragma GCC visibility pop 88169689Skan#endif 89