Skip to content

Commit 1dbc6c8

Browse files
aykevldeadprogram
authored andcommitted
internal/task: add SA_RESTART flag to GC interrupts
This makes sure system calls like read don't return EINTR but instead restart the call on an interrupt. This is by far the more sensible option, the default POSIX behavior of returning EINTR is extremely error-prone. Found this bug while trying to use the upstream testing package instead of our own.
1 parent 9a60719 commit 1dbc6c8

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/internal/task/task_threads.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ void tinygo_task_init(void *mainTask, pthread_t *thread, int *numCPU, void *cont
5858
// Using pthread_kill, we can still send the signal to a specific thread.
5959
struct sigaction act = { 0 };
6060
act.sa_handler = tinygo_task_gc_pause;
61+
act.sa_flags = SA_RESTART;
6162
sigaction(taskPauseSignal, &act, NULL);
6263

6364
// Obtain the number of CPUs available on program start (for NumCPU).

0 commit comments

Comments
 (0)