120bc3710SIngo Weinhold /* 220bc3710SIngo Weinhold * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. 320bc3710SIngo Weinhold * Distributed under the terms of the MIT License. 420bc3710SIngo Weinhold */ 520bc3710SIngo Weinhold #ifndef THREAD_H 620bc3710SIngo Weinhold #define THREAD_H 720bc3710SIngo Weinhold 820bc3710SIngo Weinhold #include <OS.h> 920bc3710SIngo Weinhold 1020bc3710SIngo Weinhold 11*4535495dSIngo Weinhold namespace BKernel { 12*4535495dSIngo Weinhold struct Thread; 13*4535495dSIngo Weinhold } 14*4535495dSIngo Weinhold 15*4535495dSIngo Weinhold using BKernel::Thread; 1620bc3710SIngo Weinhold 1720bc3710SIngo Weinhold 18*4535495dSIngo Weinhold static inline Thread* get_current_thread()1920bc3710SIngo Weinholdget_current_thread() 2020bc3710SIngo Weinhold { 21*4535495dSIngo Weinhold return (Thread*)(addr_t)find_thread(NULL); 2220bc3710SIngo Weinhold } 2320bc3710SIngo Weinhold 2420bc3710SIngo Weinhold 2520bc3710SIngo Weinhold static inline thread_id get_thread_id(Thread * thread)26*4535495dSIngo Weinholdget_thread_id(Thread* thread) 2720bc3710SIngo Weinhold { 28*4535495dSIngo Weinhold return (thread_id)(addr_t)thread; 2920bc3710SIngo Weinhold } 3020bc3710SIngo Weinhold 3120bc3710SIngo Weinhold 3220bc3710SIngo Weinhold #endif // THREAD_H 33