pthread: Fixed child pump not being joined right after a fork.

Fixes #125.
This commit is contained in:
Snaipe 2016-06-17 11:53:55 +02:00
parent 69f7e20c35
commit 6cbe26c2a2
3 changed files with 12 additions and 1 deletions

View file

@ -176,13 +176,21 @@ void init_proc_compat(void) {
#endif
}
void free_proc_compat(void) {
void reset_proc_compat(void) {
#ifndef VANILLA_WIN32
child_pump_running = false;
pthread_join(child_pump, NULL);
#endif
}
void free_proc_compat(void) {
#ifndef VANILLA_WIN32
if (child_pump_running) {
reset_proc_compat();
}
#endif
}
#ifdef VANILLA_WIN32
struct wait_context {
HANDLE wait_handle;

View file

@ -62,5 +62,6 @@ unsigned long long get_process_id_of(s_proc_handle *proc);
void init_proc_compat(void);
void free_proc_compat(void);
void reset_proc_compat(void);
#endif /* !COMPAT_PROCESS_H_ */

View file

@ -78,6 +78,8 @@ struct event *worker_read_event(struct worker_set *workers, s_pipe_file_handle *
}
void run_worker(struct worker_context *ctx) {
reset_proc_compat();
cr_redirect_stdin();
g_event_pipe = pipe_out_handle(ctx->pipe, PIPE_CLOSE);