mirror of
https://github.com/love2d/love.git
synced 2026-08-15 07:41:11 +02:00
Disable signal handling in threads (see issue #1042)
I don't necessarily like having to do these extra calls whenever threads are spawned (and what happens to signals during the time signal delivery is disabled?) but it seems to fully fix os.execute. NOTE: Also disables signals when loading openal, as it or one of its backends spawns threads internally, and does not disable signals itself. --HG-- branch : minor
This commit is contained in:
@@ -42,20 +42,6 @@
|
||||
#include <spawn.h>
|
||||
#endif
|
||||
|
||||
#if defined(LOVE_LINUX)
|
||||
static void sigchld_handler(int sig)
|
||||
{
|
||||
// Because waitpid can set errno, we need to save it.
|
||||
auto old = errno;
|
||||
|
||||
// Reap whilst there are children waiting to be reaped.
|
||||
while (waitpid(-1, nullptr, WNOHANG) > 0)
|
||||
;
|
||||
|
||||
errno = old;
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace system
|
||||
@@ -63,18 +49,6 @@ namespace system
|
||||
|
||||
System::System()
|
||||
{
|
||||
#if defined(LOVE_LINUX)
|
||||
// Enable automatic cleanup of zombie processes
|
||||
// NOTE: We're using our own handler, instead of SA_NOCLDWAIT because the
|
||||
// latter breaks wait, and thus os.execute.
|
||||
// NOTE: This isn't perfect, due to multithreading our SIGCHLD can happen
|
||||
// on a different thread than the one calling wait(), thus causing a race.
|
||||
struct sigaction act = {0};
|
||||
sigemptyset(&act.sa_mask);
|
||||
act.sa_handler = sigchld_handler;
|
||||
act.sa_flags = SA_RESTART;
|
||||
sigaction(SIGCHLD, &act, nullptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
std::string System::getOS() const
|
||||
|
||||
Reference in New Issue
Block a user