Changeset 36596 in vbox for trunk/src/VBox/Runtime/common
- Timestamp:
- Apr 6, 2011 7:45:34 PM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 71041
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/misc/thread.cpp
r36555 r36596 84 84 static RTSPINLOCK g_ThreadSpinlock = NIL_RTSPINLOCK; 85 85 #endif 86 /** Indicates whether we've been initialized or not. */ 87 static bool g_frtThreadInitialized; 86 88 87 89 … … 146 148 rc = rtSchedNativeCalcDefaultPriority(RTTHREADTYPE_DEFAULT); 147 149 if (RT_SUCCESS(rc)) 150 { 151 g_frtThreadInitialized = true; 148 152 return VINF_SUCCESS; 153 } 149 154 150 155 /* failed, clear out */ … … 165 170 rc = rtThreadNativeInit(); 166 171 if (RT_SUCCESS(rc)) 172 { 173 g_frtThreadInitialized = true; 167 174 return VINF_SUCCESS; 175 } 168 176 169 177 /* failed, clear out */ … … 994 1002 995 1003 1004 RTDECL(bool) RTThreadIsSelfAlive(void) 1005 { 1006 if (g_frtThreadInitialized) 1007 { 1008 RTTHREAD hSelf = RTThreadSelf(); 1009 if (hSelf != NIL_RTTHREAD) 1010 { 1011 /* 1012 * Inspect the thread state. ASSUMES thread state order. 1013 */ 1014 RTTHREADSTATE enmState = rtThreadGetState(hSelf); 1015 if ( enmState >= RTTHREADSTATE_RUNNING 1016 && enmState <= RTTHREADSTATE_END) 1017 return true; 1018 } 1019 } 1020 return false; 1021 } 1022 RT_EXPORT_SYMBOL(RTThreadIsSelfAlive); 1023 1024 1025 RTDECL(bool) RTThreadIsSelfKnown(void) 1026 { 1027 if (g_frtThreadInitialized) 1028 { 1029 RTTHREAD hSelf = RTThreadSelf(); 1030 if (hSelf != NIL_RTTHREAD) 1031 return true; 1032 } 1033 return false; 1034 } 1035 RT_EXPORT_SYMBOL(RTThreadIsSelfKnown); 1036 1037 1038 RTDECL(bool) RTThreadIsInitialized(void) 1039 { 1040 return g_frtThreadInitialized; 1041 } 1042 RT_EXPORT_SYMBOL(RTThreadIsInitialized); 1043 1044 996 1045 /** 997 1046 * Signal the user event.
Note:
See TracChangeset
for help on using the changeset viewer.