haproxy/include/proto/signal.h
Willy Tarreau 3f567e4949 REORG: include: split hathreads into haproxy/thread.h and haproxy/thread-t.h
This splits the hathreads.h file into types+macros and functions. Given
that most users of this file used to include it only to get the definition
of THREAD_LOCAL and MAXTHREADS, the bare minimum was placed into thread-t.h
(i.e. types and macros).

All the thread management was left to haproxy/thread.h. It's worth noting
the drop of the trailing "s" in the name, to remove the permanent confusion
that arises between this one and the system implementation (no "s") and the
makefile's option (no "s").

For consistency, src/hathreads.c was also renamed thread.c.

A number of files were updated to only include thread-t which is the one
they really needed.

Some future improvements are possible like replacing empty inlined
functions with macros for the thread-less case, as building at -O0 disables
inlining and causes these ones to be emitted. But this really is cosmetic.
2020-06-11 10:18:56 +02:00

48 lines
1.2 KiB
C

/*
* include/proto/signal.h
* Asynchronous signal delivery functions.
*
* Copyright 2000-2010 Willy Tarreau <w@1wt.eu>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
*/
#include <signal.h>
#include <common/standard.h>
#include <haproxy/thread.h>
#include <types/signal.h>
#include <types/task.h>
extern int signal_queue_len;
extern struct signal_descriptor signal_state[];
__decl_hathreads(extern HA_SPINLOCK_T signals_lock);
void signal_handler(int sig);
void __signal_process_queue();
void deinit_signals();
struct sig_handler *signal_register_fct(int sig, void (*fct)(struct sig_handler *), int arg);
struct sig_handler *signal_register_task(int sig, struct task *task, int reason);
void signal_unregister_handler(struct sig_handler *handler);
void signal_unregister_target(int sig, void *target);
void signal_unregister(int sig);
void haproxy_unblock_signals();
static inline void signal_process_queue()
{
if (unlikely(signal_queue_len > 0))
__signal_process_queue();
}
/*
* Local variables:
* c-indent-level: 8
* c-basic-offset: 8
* End:
*/