]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/gthr-gnat.c
Licensing changes to GPLv3 resp. GPLv3 with GCC Runtime Exception.
[thirdparty/gcc.git] / gcc / gthr-gnat.c
CommitLineData
6d412a7b
VC
1/* Threads compatibility routines for libgcc2. */
2/* Compile this one with gcc. */
748086b7 3/* Copyright (C) 2003, 2004, 2009 Free Software Foundation, Inc.
6d412a7b
VC
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
748086b7 9Software Foundation; either version 3, or (at your option) any later
6d412a7b
VC
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
748086b7
JJ
17Under Section 7 of GPL version 3, you are granted additional
18permissions described in the GCC Runtime Library Exception, version
193.1, as published by the Free Software Foundation.
20
21You should have received a copy of the GNU General Public License and
22a copy of the GCC Runtime Library Exception along with this program;
23see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
24<http://www.gnu.org/licenses/>. */
6d412a7b 25
6d412a7b
VC
26#include "gthr-gnat.h"
27
7370bebd 28#ifndef HIDE_EXPORTS
3fc1f660 29#pragma GCC visibility push(default)
7370bebd 30#endif
3fc1f660 31
6d412a7b
VC
32#ifdef __cplusplus
33#define UNUSED(x)
34#else
35#define UNUSED(x) x __attribute__((unused))
36#endif
37
8fdf7668
MK
38void __gnat_default_lock (void);
39void __gnat_default_unlock (void);
40
6d412a7b
VC
41void
42__gnat_default_lock (void)
43{
44 return;
45}
46
47void
48__gnat_default_unlock (void)
49{
50 return;
51}
52
8fdf7668
MK
53static void (*__gnat_task_lock) (void) = *__gnat_default_lock;
54static void (*__gnat_task_unlock) (void) = *__gnat_default_unlock;
6d412a7b
VC
55
56 void
8fdf7668 57__gnat_install_locks (void (*lock) (void), void (*unlock) (void))
6d412a7b
VC
58{
59 __gnat_task_lock = lock;
60 __gnat_task_unlock = unlock;
6d412a7b
VC
61}
62
63int
64__gthread_active_p (void)
65{
66 return 0;
67}
68
69int
70__gthread_mutex_lock (__gthread_mutex_t * UNUSED (mutex))
71{
72 __gnat_task_lock ();
73 return 0;
74}
75
76int
77__gthread_mutex_unlock (__gthread_mutex_t * UNUSED (mutex))
78{
79 __gnat_task_unlock ();
80 return 0;
81}
3fc1f660 82
7370bebd 83#ifndef HIDE_EXPORTS
3fc1f660 84#pragma GCC visibility pop
7370bebd 85#endif