1 /* System thread definitions
2 Copyright (C) 2012, 2013 Free Software Foundation, Inc.
4 This file is part of GNU Emacs.
6 GNU Emacs is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 GNU Emacs is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
22 #ifdef THREADS_ENABLED
28 /* A system mutex is just a pthread mutex. This is only used for the
30 typedef pthread_mutex_t sys_mutex_t
;
32 typedef pthread_cond_t sys_cond_t
;
34 /* A system thread. */
35 typedef pthread_t sys_thread_t
;
37 #else /* HAVE_PTHREAD */
41 #endif /* HAVE_PTHREAD */
43 #else /* THREADS_ENABLED */
45 /* For the no-threads case we can simply use dummy definitions. */
46 typedef int sys_mutex_t
;
47 typedef int sys_cond_t
;
48 typedef int sys_thread_t
;
50 #endif /* THREADS_ENABLED */
52 typedef void *(thread_creation_function
) (void *);
54 extern void sys_mutex_init (sys_mutex_t
*);
55 extern void sys_mutex_lock (sys_mutex_t
*);
56 extern void sys_mutex_unlock (sys_mutex_t
*);
57 extern void sys_mutex_destroy (sys_mutex_t
*);
59 extern void sys_cond_init (sys_cond_t
*);
60 extern void sys_cond_wait (sys_cond_t
*, sys_mutex_t
*);
61 extern void sys_cond_signal (sys_cond_t
*);
62 extern void sys_cond_broadcast (sys_cond_t
*);
63 extern void sys_cond_destroy (sys_cond_t
*);
65 extern sys_thread_t
sys_thread_self (void);
66 extern int sys_thread_equal (sys_thread_t
, sys_thread_t
);
68 extern int sys_thread_create (sys_thread_t
*, const char *,
69 thread_creation_function
*,
72 extern void sys_thread_yield (void);
74 #endif /* SYSTHREAD_H */