00001 00012 #ifndef OSCL_SCHEDULER_THREAD_CONTEXT_H_INCLUDED 00013 #define OSCL_SCHEDULER_THREAD_CONTEXT_H_INCLUDED 00014 00015 #ifndef OSCL_AOSTATUS_H_INCLUDED 00016 #include "oscl_aostatus.h" 00017 #endif 00018 00019 #ifndef OSCL_DOUBLE_LIST_H_INCLUDED 00020 #include "oscl_double_list.h" 00021 #endif 00022 00023 #ifndef OSCL_MUTEX_H_INCLUDED 00024 #include "oscl_mutex.h" 00025 #endif 00026 00030 enum TPVThreadContext 00031 { 00032 EPVThreadContext_InThread //context is in-thread 00033 , EPVThreadContext_OsclThread //some other thread that has Oscl initialized 00034 , EPVThreadContext_NonOsclThread //some thread that does not have Oscl initialized 00035 , EPVThreadContext_Undetermined 00036 }; 00037 00043 class OsclExecSchedulerCommonBase; 00044 class PVActiveBase; 00045 class OsclBrewThreadYield; 00046 class PVThreadContext 00047 { 00048 public: 00049 00050 OSCL_IMPORT_REF PVThreadContext(); 00051 OSCL_IMPORT_REF ~PVThreadContext(); 00055 OSCL_IMPORT_REF bool IsSameThreadContext(); 00056 00061 OSCL_IMPORT_REF static uint32 Id(); 00062 00066 OSCL_IMPORT_REF void EnterThreadContext(); 00067 OSCL_IMPORT_REF void ExitThreadContext(); 00068 00074 OSCL_IMPORT_REF static bool ThreadHasScheduler(); 00075 00076 private: 00077 00082 static void LeaveIfWrongThread(PVThreadContext &a); 00083 00084 00085 bool iOpen; 00086 00090 void PendComplete(PVActiveBase*, int32 aReason, TPVThreadContext aCallingContext); 00091 00092 00093 OsclExecSchedulerCommonBase *iScheduler; 00094 00098 TOsclThreadId iThreadId; 00099 00100 friend class PVActiveBase; 00101 friend class OsclActiveObject; 00102 friend class OsclTimerObject; 00103 friend class OsclExecScheduler; 00104 friend class OsclCoeActiveScheduler; 00105 friend class OsclExecSchedulerCommonBase; 00106 friend class OsclExecSchedulerBase; 00107 friend class OsclCoeActiveSchedulerBase; 00108 }; 00109 00110 00111 00112 00113 #endif // 00114 00115