Fixed resource leaks the child pump thread
This commit is contained in:
parent
c5b4ca27d7
commit
00d3ef7ad8
1 changed files with 2 additions and 5 deletions
|
@ -169,11 +169,7 @@ static void *chld_pump_thread_main(void *nil) {
|
||||||
|
|
||||||
void init_proc_compat(void) {
|
void init_proc_compat(void) {
|
||||||
#ifndef VANILLA_WIN32
|
#ifndef VANILLA_WIN32
|
||||||
pthread_attr_t attr;
|
int err = pthread_create(&child_pump, NULL, chld_pump_thread_main, NULL);
|
||||||
int err = pthread_attr_init(&attr)
|
|
||||||
|| pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED)
|
|
||||||
|| pthread_create(&child_pump, &attr, chld_pump_thread_main, NULL)
|
|
||||||
|| pthread_attr_destroy(&attr);
|
|
||||||
if (err) {
|
if (err) {
|
||||||
perror(0);
|
perror(0);
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -184,6 +180,7 @@ void init_proc_compat(void) {
|
||||||
void free_proc_compat(void) {
|
void free_proc_compat(void) {
|
||||||
#ifndef VANILLA_WIN32
|
#ifndef VANILLA_WIN32
|
||||||
child_pump_running = false;
|
child_pump_running = false;
|
||||||
|
pthread_join(child_pump, NULL);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue