mirror of
https://github.com/love2d/love.git
synced 2026-08-16 08:11:02 +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:
@@ -20,6 +20,10 @@
|
||||
|
||||
#include "threads.h"
|
||||
|
||||
#if defined(LOVE_LINUX)
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace thread
|
||||
@@ -153,5 +157,21 @@ Conditional *ConditionalRef::operator->() const
|
||||
return conditional;
|
||||
}
|
||||
|
||||
#if defined(LOVE_LINUX)
|
||||
static sigset_t oldset;
|
||||
|
||||
void disableSignals()
|
||||
{
|
||||
sigset_t newset;
|
||||
sigfillset(&newset);
|
||||
pthread_sigmask(SIG_SETMASK, &newset, &oldset);
|
||||
}
|
||||
|
||||
void reenableSignals()
|
||||
{
|
||||
pthread_sigmask(SIG_SETMASK, &oldset, nullptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
} // thread
|
||||
} // love
|
||||
|
||||
Reference in New Issue
Block a user