1/* 2 * Copyright 2008, Ingo Weinhold, ingo_weinhold@gmx.de. 3 * Distributed under the terms of the MIT License. 4 */ 5#ifndef _LIBROOT_USER_THREAD_H 6#define _LIBROOT_USER_THREAD_H 7 8#include <OS.h> 9#include <TLS.h> 10 11#include <tls.h> 12#include <user_thread_defs.h> 13 14 15static inline struct user_thread* 16get_user_thread() 17{ 18 return (struct user_thread*)tls_get(TLS_USER_THREAD_SLOT); 19} 20 21 22static void inline 23defer_signals() 24{ 25 get_user_thread()->defer_signals++; 26} 27 28 29static void inline 30undefer_signals() 31{ 32 struct user_thread* thread = get_user_thread(); 33 if (--thread->defer_signals == 0 && thread->pending_signals != 0) { 34 // signals shall no longer be deferred -- call a dummy syscall to handle 35 // the pending ones 36 is_computer_on(); 37 } 38} 39 40 41#endif /* _LIBROOT_USER_THREAD_H */ 42