1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 2 <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> 3 <title>oscl_thread.h Source File</title> 4 <link href="doxygen.css" rel="stylesheet" type="text/css"> 5 </head><body> 6 <!-- Generated by Doxygen 1.2.18 --> 7 <center> 8 <a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="modules.html">Modules</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="annotated.html">Data Structures</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Data Fields</a> <a class="qindex" href="globals.html">Globals</a> </center> 9 <hr><h1>oscl_thread.h</h1><a href="oscl__thread_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">// -*- c++ -*-</span> 10 00002 <span class="comment">// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =</span> 11 00003 12 00004 <span class="comment">// OSCL_T H R E A D (T H R E A D I M P L E M E N T A T I O N)</span> 13 00005 14 00006 <span class="comment">// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =</span> 15 00007 16 00013 <span class="comment">// Definition file for OSCL Threads</span> 17 00014 <span class="preprocessor">#ifndef OSCL_THREAD_H_INCLUDED</span> 18 00015 <span class="preprocessor"></span><span class="preprocessor">#define OSCL_THREAD_H_INCLUDED</span> 19 00016 <span class="preprocessor"></span> 20 00017 <span class="preprocessor">#ifndef OSCLCONFIG_PROC_H_INCLUDED</span> 21 00018 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="osclconfig__proc_8h.html">osclconfig_proc.h</a>"</span> 22 00019 <span class="preprocessor">#endif</span> 23 00020 <span class="preprocessor"></span> 24 00021 <span class="preprocessor">#ifndef OSCL_PROCSTATUS_H_INCLUDED</span> 25 00022 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="oscl__procstatus_8h.html">oscl_procstatus.h</a>"</span> 26 00023 <span class="preprocessor">#endif</span> 27 00024 <span class="preprocessor"></span> 28 00025 <span class="preprocessor">#ifndef OSCL_BASE_H_INCLUDED</span> 29 00026 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="oscl__base_8h.html">oscl_base.h</a>"</span> 30 00027 <span class="preprocessor">#endif</span> 31 00028 <span class="preprocessor"></span> 32 00029 33 00030 <span class="comment">// Thread state on creation</span> 34 <a name="l00031"></a><a class="code" href="oscl__thread_8h.html#a10">00031</a> <span class="keyword">enum</span> <a class="code" href="oscl__thread_8h.html#a10">OsclThread_State</a> 35 00032 { 36 00033 <a class="code" href="oscl__thread_8h.html#a10a1">Start_on_creation</a> 37 00034 , <a class="code" href="oscl__thread_8h.html#a10a2">Suspend_on_creation</a> 38 00035 }; 39 00036 40 00037 <span class="comment">// Enumerated Priority Values</span> 41 <a name="l00038"></a><a class="code" href="oscl__thread_8h.html#a11">00038</a> <span class="keyword">enum</span> <a class="code" href="oscl__thread_8h.html#a11">OsclThreadPriority</a> 42 00039 { 43 00040 <a class="code" href="oscl__thread_8h.html#a11a3">ThreadPriorityLowest</a> 44 00041 , <a class="code" href="oscl__thread_8h.html#a11a4">ThreadPriorityLow</a> 45 00042 , <a class="code" href="oscl__thread_8h.html#a11a5">ThreadPriorityBelowNormal</a> 46 00043 , <a class="code" href="oscl__thread_8h.html#a11a6">ThreadPriorityNormal</a> 47 00044 , <a class="code" href="oscl__thread_8h.html#a11a7">ThreadPriorityAboveNormal</a> 48 00045 , <a class="code" href="oscl__thread_8h.html#a11a8">ThreadPriorityHighest</a> 49 00046 , <a class="code" href="oscl__thread_8h.html#a11a9">ThreadPriorityTimeCritical</a> 50 00047 }; 51 00048 52 00049 <span class="comment">//thread function pointer type.</span> 53 <a name="l00050"></a><a class="code" href="oscl__thread_8h.html#a0">00050</a> <span class="keyword">typedef</span> <a class="code" href="osclconfig__proc__unix__android_8h.html#a8">TOsclThreadFuncRet</a>(OSCL_THREAD_DECL *<a class="code" href="oscl__thread_8h.html#a0">TOsclThreadFuncPtr</a>)(TOsclThreadFuncArg); 54 00051 55 <a name="l00058"></a><a class="code" href="classOsclThread.html">00058</a> <span class="keyword">class </span><a class="code" href="classOsclThread.html">OsclThread</a> 56 00059 { 57 00060 58 00061 <span class="keyword">public</span>: 59 00062 60 00066 OSCL_IMPORT_REF <a class="code" href="classOsclThread.html#a0">OsclThread</a>(); 61 00067 62 00071 OSCL_IMPORT_REF <a class="code" href="classOsclThread.html#a1">~OsclThread</a>(); 63 00072 64 00089 OSCL_IMPORT_REF <a class="code" href="classOsclProcStatus.html#s35">OsclProcStatus::eOsclProcError</a> <a class="code" href="classOsclThread.html#a2">Create</a>(<a class="code" href="oscl__thread_8h.html#a0">TOsclThreadFuncPtr</a> func, 65 00090 int32 stack_size, 66 00091 TOsclThreadFuncArg argument, 67 00092 <a class="code" href="oscl__thread_8h.html#a10">OsclThread_State</a> state = <a class="code" href="oscl__thread_8h.html#a10a1">Start_on_creation</a>); 68 00093 69 00102 OSCL_IMPORT_REF <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classOsclThread.html#d0">Exit</a>(<a class="code" href="group__osclbase.html#a25">OsclAny</a>* exitcode); 70 00103 71 00114 OSCL_IMPORT_REF <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classOsclThread.html#d1">EnableKill</a>(); 72 00115 73 00123 OSCL_IMPORT_REF <a class="code" href="classOsclProcStatus.html#s35">OsclProcStatus::eOsclProcError</a> <a class="code" href="classOsclThread.html#a3">GetPriority</a>(<a class="code" href="oscl__thread_8h.html#a11">OsclThreadPriority</a>& refThreadPriority); 74 00124 75 00134 OSCL_IMPORT_REF <a class="code" href="classOsclProcStatus.html#s35">OsclProcStatus::eOsclProcError</a> <a class="code" href="classOsclThread.html#a4">SetPriority</a>(<a class="code" href="oscl__thread_8h.html#a11">OsclThreadPriority</a> ePriority); 76 00135 77 00144 OSCL_IMPORT_REF <a class="code" href="classOsclProcStatus.html#s35">OsclProcStatus::eOsclProcError</a> <a class="code" href="classOsclThread.html#a5">Suspend</a>(); 78 00145 79 00153 OSCL_IMPORT_REF <a class="code" href="classOsclProcStatus.html#s35">OsclProcStatus::eOsclProcError</a> <a class="code" href="classOsclThread.html#a6">Resume</a>(); 80 00154 81 00168 OSCL_IMPORT_REF <a class="code" href="classOsclProcStatus.html#s35">OsclProcStatus::eOsclProcError</a> <a class="code" href="classOsclThread.html#a7">Terminate</a>(<a class="code" href="group__osclbase.html#a25">OsclAny</a>* exitcode); 82 00169 83 00170 84 00176 OSCL_IMPORT_REF <span class="keyword">static</span> <a class="code" href="classOsclProcStatus.html#s35">OsclProcStatus::eOsclProcError</a> <a class="code" href="classOsclThread.html#d2">GetId</a>(TOsclThreadId& refThreadId); 85 00177 86 00183 OSCL_IMPORT_REF <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="classOsclThread.html#d3">CompareId</a>(TOsclThreadId &t1, TOsclThreadId &t2); 87 00184 88 00189 OSCL_IMPORT_REF <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classOsclThread.html#d4">SleepMillisec</a>(<span class="keyword">const</span> int32 msec); 89 00190 90 00191 <span class="keyword">private</span>: 91 00192 92 00200 <a class="code" href="classOsclProcStatus.html#s35">OsclProcStatus::eOsclProcError</a> MapOsclError(int16 error); 93 00201 94 00202 95 00203 TOsclMutexObject mutex; 96 00204 TOsclConditionObject condition; 97 00205 uint8 suspend; 98 00206 99 00207 100 00208 101 00209 TOsclThreadObject ObjThread; 102 00210 <span class="keywordtype">bool</span> bCreated; 103 00211 104 00212 }; 105 00213 106 00214 <span class="preprocessor">#endif</span> 107 00215 <span class="preprocessor"></span> 108 </pre></div><hr size="1"><img src="pvlogo_small.jpg"><address style="align: right;"><small>OSCL API</small> 109 <address style="align: left;"><small>Posting Version: OPENCORE_20090310 </small> 110 </small></address> 111 </body> 112 </html> 113