mirror of
https://github.com/CCExtractor/ccextractor.git
synced 2024-12-25 04:11:38 +00:00
Rework signals
This commit is contained in:
parent
71dffd6eb3
commit
ec9a0985ce
@ -27,6 +27,13 @@ struct lib_ccx_ctx *signal_ctx;
|
||||
|
||||
volatile int terminate_asap = 0;
|
||||
|
||||
void sigusr1_handler(int sig)
|
||||
{
|
||||
mprint("Caught SIGUSR1. Filename Change Requested\n");
|
||||
change_filename_requested = 1;
|
||||
}
|
||||
|
||||
|
||||
void sigterm_handler(int sig)
|
||||
{
|
||||
printf("Received SIGTERM, terminating as soon as possible.\n");
|
||||
@ -151,7 +158,7 @@ int main(int argc, char *argv[])
|
||||
signal_ctx = ctx;
|
||||
m_signal(SIGINT, sigint_handler);
|
||||
m_signal(SIGTERM, sigterm_handler);
|
||||
create_signal(SIGINT);
|
||||
m_signal(SIGUSR1, sigusr1_handler);
|
||||
#endif
|
||||
terminate_asap = 0;
|
||||
|
||||
|
@ -249,7 +249,6 @@ void timestamp_to_srttime(uint64_t timestamp, char *buffer);
|
||||
void timestamp_to_smptetttime(uint64_t timestamp, char *buffer);
|
||||
int levenshtein_dist (const uint64_t *s1, const uint64_t *s2, unsigned s1len, unsigned s2len);
|
||||
void millis_to_date (uint64_t timestamp, char *buffer, enum ccx_output_date_format date_format, char millis_separator);
|
||||
void create_signal(int sigtype);
|
||||
void signal_handler(int sig_type);
|
||||
struct encoder_ctx* change_filename(struct encoder_ctx*);
|
||||
#ifndef _WIN32
|
||||
|
@ -411,22 +411,6 @@ void m_signal(int sig, void (*func)(int))
|
||||
return;
|
||||
}
|
||||
|
||||
void create_signal(int sigtype)
|
||||
{
|
||||
if (signal(sigtype, signal_handler) == SIG_ERR)
|
||||
mprint("Can't catch signal %d.\n", sigtype);
|
||||
}
|
||||
|
||||
void signal_handler(int sig_type)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (sig_type == SIGUSR1)
|
||||
{
|
||||
mprint("Caught SIGUSR1. Filename Change Requested\n");
|
||||
change_filename_requested = 1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
struct encoder_ctx *change_filename(struct encoder_ctx *enc_ctx)
|
||||
|
Loading…
Reference in New Issue
Block a user