event_pipe: added event_pipe_emit_fast()
event_pipe_emit_fast() is aimed for use in signal handlers: it doesn't lock the mutex, and doesn't log on error. That makes it potentially lossy, but for its intended use, that does not matter.
This commit is contained in:
parent
ecb20c5f7e
commit
e93136ef0f
@ -137,6 +137,14 @@ void event_pipe_emit(enum pipe_event event)
|
||||
g_error("error writing to pipe: %s", strerror(errno));
|
||||
}
|
||||
|
||||
void event_pipe_emit_fast(enum pipe_event event)
|
||||
{
|
||||
assert((unsigned)event < PIPE_EVENT_MAX);
|
||||
|
||||
pipe_events[event] = true;
|
||||
write(event_pipe[1], "", 1);
|
||||
}
|
||||
|
||||
void event_pipe_signal(void)
|
||||
{
|
||||
event_pipe_emit(PIPE_EVENT_SIGNAL);
|
||||
|
@ -56,6 +56,13 @@ event_pipe_register(enum pipe_event event, event_pipe_callback_t callback);
|
||||
|
||||
void event_pipe_emit(enum pipe_event event);
|
||||
|
||||
/**
|
||||
* Similar to event_pipe_emit(), but aimed for use in signal handlers:
|
||||
* it doesn't lock the mutex, and doesn't log on error. That makes it
|
||||
* potentially lossy, but for its intended use, that does not matter.
|
||||
*/
|
||||
void event_pipe_emit_fast(enum pipe_event event);
|
||||
|
||||
void event_pipe_signal(void);
|
||||
|
||||
void event_pipe_wait(void);
|
||||
|
Loading…
Reference in New Issue
Block a user