update DI disc code
[libogc.git] / libogc / lwp_threads.inl
bloba3b960ff82dfe7c7d6634e3ba14785fd28a4bc52
1 #ifndef __LWP_INL__
2 #define __LWP_INL__
4 static __inline__ u32 __lwp_thread_isexec(lwp_cntrl *thethread)
6         return (thethread==_thr_executing);
9 static __inline__ u32 __lwp_thread_isheir(lwp_cntrl *thethread)
11         return (thethread==_thr_heir);
14 static __inline__ void __lwp_thread_calcheir()
16         _thr_heir = (lwp_cntrl*)_lwp_thr_ready[__lwp_priomap_highest()].first;
17 #ifdef _LWPTHREADS_DEBUG
18         printf("__lwp_thread_calcheir(%p)\n",_thr_heir);
19 #endif
22 static __inline__ u32 __lwp_thread_isallocatedfp(lwp_cntrl *thethread)
24         return (thethread==_thr_allocated_fp);
27 static __inline__ void __lwp_thread_deallocatefp()
29         _thr_allocated_fp = NULL;
32 static __inline__ void __lwp_thread_dispatchinitialize()
34         _thread_dispatch_disable_level = 1;
37 static __inline__ void __lwp_thread_dispatchenable()
39         if((--_thread_dispatch_disable_level)==0)
40                 __thread_dispatch();
43 static __inline__ void __lwp_thread_dispatchdisable()
45         ++_thread_dispatch_disable_level;
48 static __inline__ void __lwp_thread_dispatchunnest()
50         --_thread_dispatch_disable_level;
53 static __inline__ void __lwp_thread_unblock(lwp_cntrl *thethread)
55         __lwp_thread_clearstate(thethread,LWP_STATES_BLOCKED);
58 static __inline__ void** __lwp_thread_getlibcreent()
60         return __lwp_thr_libc_reent;
63 static __inline__ void __lwp_thread_setlibcreent(void **libc_reent)
65         __lwp_thr_libc_reent = libc_reent;
68 static __inline__ bool __lwp_thread_isswitchwant()
71         return _context_switch_want;
74 static __inline__ bool __lwp_thread_isdispatchenabled()
76         return (_thread_dispatch_disable_level==0);
79 static __inline__ void __lwp_thread_inittimeslice()
81         __lwp_wd_initialize(&_lwp_wd_timeslice,__lwp_thread_tickle_timeslice,LWP_TIMESLICE_TIMER_ID,NULL);
84 static __inline__ void __lwp_thread_starttimeslice()
86         __lwp_wd_insert_ticks(&_lwp_wd_timeslice,millisecs_to_ticks(1));
89 static __inline__ void __lwp_thread_stoptimeslice()
91         __lwp_wd_remove_ticks(&_lwp_wd_timeslice);
93 #endif