<commit_before>#include <signal.h>
#include "syscall.h"

int raise(int sig)
{
	return __syscall_kill(__syscall_getpid(), sig);
}
<commit_msg>fix raise semantics with threads.<commit_after>#include <signal.h>
#include <errno.h>
#include "syscall.h"

int raise(int sig)
{
	int pid, tid, ret;
	/* Getting the pid/tid pair is not atomic, and could give wrong
	 * result if a fork occurs in a signal handler between the two
	 * syscalls. Use the tgkill syscall's ESRCH semantics to detect
	 * this condition and retry. */
	do {
		tid = syscall0(__NR_gettid);
		pid = syscall0(__NR_getpid);
		ret = syscall3(__NR_tgkill, pid, tid, sig);
	} while (ret<0 && errno == ESRCH);
	return ret;
}

{'fraction_non_alphanumeric': 0.12023460410557185, 'fraction_numerical': 0.005865102639296188, 'mean_word_length': 4.377952755905512, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6915935', 'n_tokens_mistral': 261, 'n_tokens_neox': 229, 'n_words': 79}