1/* Threads compatibility routines for libgcc2.  */
2/* Compile this one with gcc.  */
3/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify it under
8the terms of the GNU General Public License as published by the Free
9Software Foundation; either version 2, or (at your option) any later
10version.
11
12GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13WARRANTY; without even the implied warranty of MERCHANTABILITY or
14FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15for more details.
16
17You should have received a copy of the GNU General Public License
18along with GCC; see the file COPYING.  If not, write to the Free
19Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
2002110-1301, USA.  */
21
22/* As a special exception, if you link this library with other files,
23   some of which are compiled with GCC, to produce an executable,
24   this library does not by itself cause the resulting executable
25   to be covered by the GNU General Public License.
26   This exception does not however invalidate any other reasons why
27   the executable file might be covered by the GNU General Public License.  */
28
29#include "gthr-gnat.h"
30
31#ifndef HIDE_EXPORTS
32#pragma GCC visibility push(default)
33#endif
34
35#ifdef __cplusplus
36#define UNUSED(x)
37#else
38#define UNUSED(x) x __attribute__((unused))
39#endif
40
41void __gnat_default_lock (void);
42void __gnat_default_unlock (void);
43
44void
45__gnat_default_lock (void)
46{
47  return;
48}
49
50void
51__gnat_default_unlock (void)
52{
53  return;
54}
55
56static void (*__gnat_task_lock) (void) = *__gnat_default_lock;
57static void (*__gnat_task_unlock) (void) = *__gnat_default_unlock;
58
59 void
60__gnat_install_locks (void (*lock) (void), void (*unlock) (void))
61{
62  __gnat_task_lock = lock;
63  __gnat_task_unlock = unlock;
64}
65
66int
67__gthread_active_p (void)
68{
69  return 0;
70}
71
72int
73__gthread_mutex_lock (__gthread_mutex_t * UNUSED (mutex))
74{
75  __gnat_task_lock ();
76  return 0;
77}
78
79int
80__gthread_mutex_unlock (__gthread_mutex_t * UNUSED (mutex))
81{
82  __gnat_task_unlock ();
83  return 0;
84}
85
86#ifndef HIDE_EXPORTS
87#pragma GCC visibility pop
88#endif
89