rem: thread->sig_pending |= SIGNAL_TO_MASK(signal);
add: atomic_or(&thread->sig_pending, SIGNAL_TO_MASK(signal));
context: deliver_signal(struct thread *thread, uint signal, uint32 flags){	if (flags & B_CHECK_PERMISSION) {		// ToDo: introduce euid & uid fields to the team and check permission	}	if (thread->team == team_get_kernel_team()) {		// Signals to kernel threads will only wake them up		if (thread->state == B_THREAD_SUSPENDED) {			thread->state = thread->next_state = B_THREAD_READY;			scheduler_enqueue_in_run_queue(thread);		}		return B_OK;	}	thread->sig_pending |= SIGNAL_TO_MASK(signal);	switch (signal) {		case SIGKILL:		{			struct thread *mainThread = thread->team->main_thread;			// Forward KILLTHR to the main thread of the team			mainThread->sig_pending |= SIGNAL_TO_MASK(SIGKILLTHR);			// Wake up main thread			if (mainThread->state == B_THREAD_SUSPENDED) {				mainThread->state = mainThread->next_state = B_THREAD_READY;				scheduler_enqueue_in_run_queue(mainThread);			} else if (mainThread->state == B_THREAD_WAITING)				sem_interrupt_thread(mainThread);			// Supposed to fall through		}		case SIGKILLTHR:			// Wake up suspended threads and interrupt waiting ones			if (thread->state == B_THREAD_SUSPENDED) {				thread->state = thread->next_state = B_THREAD_READY;				scheduler_enqueue_in_run_queue(thread);			} else if (thread->state == B_THREAD_WAITING)				sem_interrupt_thread(thread);			break;		case SIGCONT:			// Wake up thread if it was suspended			if (thread->state == B_THREAD_SUSPENDED) {				thread->state = thread->next_state = B_THREAD_READY;				scheduler_enqueue_in_run_queue(thread);			}			break;		default:			if (thread->sig_pending & (~thread->sig_block_mask | SIGNAL_TO_MASK(SIGCHLD))) {				// Interrupt thread if it was waiting				if (thread->state == B_THREAD_WAITING)					sem_interrupt_thread(thread);			}			break;	}	return B_OK;}