diff options
Diffstat (limited to 'hurd/hurd/signal.h')
-rw-r--r-- | hurd/hurd/signal.h | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/hurd/hurd/signal.h b/hurd/hurd/signal.h index d4079efe00..e3e2790a98 100644 --- a/hurd/hurd/signal.h +++ b/hurd/hurd/signal.h @@ -129,15 +129,17 @@ extern struct hurd_sigstate *_hurd_self_sigstate (void) #define _HURD_SIGNAL_H_EXTERN_INLINE __extern_inline #endif +#if defined __USE_EXTERN_INLINES && defined _LIBC && !defined NOT_IN_libc _HURD_SIGNAL_H_EXTERN_INLINE struct hurd_sigstate * _hurd_self_sigstate (void) { - struct hurd_sigstate **location = + struct hurd_sigstate **location = (struct hurd_sigstate **) (void *) __hurd_threadvar_location (_HURD_THREADVAR_SIGSTATE); if (*location == NULL) *location = _hurd_thread_sigstate (__mach_thread_self ()); return *location; } +#endif /* Thread listening on our message port; also called the "signal thread". */ @@ -164,10 +166,13 @@ extern int _hurd_core_limit; interrupted lest the signal handler try to take the same lock and deadlock result. */ +void *_hurd_critical_section_lock (void); + +#if defined __USE_EXTERN_INLINES && defined _LIBC && !defined NOT_IN_libc _HURD_SIGNAL_H_EXTERN_INLINE void * _hurd_critical_section_lock (void) { - struct hurd_sigstate **location = + struct hurd_sigstate **location = (struct hurd_sigstate **) (void *) __hurd_threadvar_location (_HURD_THREADVAR_SIGSTATE); struct hurd_sigstate *ss = *location; if (ss == NULL) @@ -189,7 +194,11 @@ _hurd_critical_section_lock (void) _hurd_critical_section_unlock to unlock it. */ return ss; } +#endif +void _hurd_critical_section_unlock (void *our_lock); + +#if defined __USE_EXTERN_INLINES && defined _LIBC && !defined NOT_IN_libc _HURD_SIGNAL_H_EXTERN_INLINE void _hurd_critical_section_unlock (void *our_lock) { @@ -199,7 +208,7 @@ _hurd_critical_section_unlock (void *our_lock) else { /* It was us who acquired the critical section lock. Unlock it. */ - struct hurd_sigstate *ss = our_lock; + struct hurd_sigstate *ss = (struct hurd_sigstate *) our_lock; sigset_t pending; __spin_lock (&ss->lock); __spin_unlock (&ss->critical_section_lock); @@ -212,6 +221,7 @@ _hurd_critical_section_unlock (void *our_lock) __msg_sig_post (_hurd_msgport, 0, 0, __mach_task_self ()); } } +#endif /* Convenient macros for simple uses of critical sections. These two must be used as a pair at the same C scoping level. */ |