mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-01-20 01:52:49 +08:00
add a JOIN_THREADS_BEFORE_FORK preprocessor flag to help debug locking problems
This commit is contained in:
parent
214ef3dd0b
commit
c6e5987480
|
@ -9,6 +9,10 @@
|
||||||
#include "iothread.h"
|
#include "iothread.h"
|
||||||
#include "exec.h"
|
#include "exec.h"
|
||||||
|
|
||||||
|
#ifndef JOIN_THREADS_BEFORE_FORK
|
||||||
|
#define JOIN_THREADS_BEFORE_FORK 0
|
||||||
|
#endif
|
||||||
|
|
||||||
/** The number of times to try to call fork() before giving up */
|
/** The number of times to try to call fork() before giving up */
|
||||||
#define FORK_LAPS 5
|
#define FORK_LAPS 5
|
||||||
|
|
||||||
|
@ -319,7 +323,7 @@ pid_t execute_fork(bool wait_for_threads_to_die)
|
||||||
{
|
{
|
||||||
ASSERT_IS_MAIN_THREAD();
|
ASSERT_IS_MAIN_THREAD();
|
||||||
|
|
||||||
if (wait_for_threads_to_die)
|
if (wait_for_threads_to_die || JOIN_THREADS_BEFORE_FORK)
|
||||||
{
|
{
|
||||||
/* Make sure we have no outstanding threads before we fork. This is a pretty sketchy thing to do here, both because exec.cpp shouldn't have to know about iothreads, and because the completion handlers may do unexpected things. */
|
/* Make sure we have no outstanding threads before we fork. This is a pretty sketchy thing to do here, both because exec.cpp shouldn't have to know about iothreads, and because the completion handlers may do unexpected things. */
|
||||||
iothread_drain_all();
|
iothread_drain_all();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user