1 /* 2 * Copyright (C) 2011 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 /** 17 ************************************************************************ 18 * @file M4OSA_Thread_priv.h 19 * @ingroup OSAL 20 * @brief Thread private for Android 21 * @note 22 ************************************************************************ 23 */ 24 25 #ifndef M4OSA_THREAD_PRIV_H 26 #define M4OSA_THREAD_PRIV_H 27 28 29 #include "M4OSA_Types.h" 30 31 32 /* Context for the thread */ 33 typedef struct M4OSA_ThreadContext { 34 M4OSA_UInt32 coreID; /* thread context identifiant */ 35 pthread_t threadID; /* thread identifier. */ 36 M4OSA_Char* name; /* thread name */ 37 M4OSA_UInt32 stackSize; /* thread stackSize in bytes */ 38 M4OSA_ThreadDoIt func; /* thread function */ 39 M4OSA_Void* param; /* thread parameter */ 40 /* 41 M4OSA_Void* userData; / * thread user data * / 42 */ 43 M4OSA_ThreadState state; /* thread automaton state */ 44 M4OSA_Context stateMutex; /* mutex for thread state management */ 45 /* 46 M4OSA_ThreadCallBack startCallBack; / * starting thread call back * / 47 M4OSA_ThreadCallBack stopCallBack; / * stopping thread call back * / 48 */ 49 M4OSA_Context semStartStop; /* semaphore for start and stop do_it */ 50 M4OSA_ThreadPriorityLevel priority; /* thread priority level */ 51 } M4OSA_ThreadContext ; 52 53 54 /** Those define enable/disable option ID*/ 55 #define M4OSA_OPTIONID_THREAD_STARTED M4OSA_TRUE 56 #define M4OSA_OPTIONID_THREAD_STOPPED M4OSA_TRUE 57 #define M4OSA_OPTIONID_THREAD_PRIORITY M4OSA_TRUE 58 #define M4OSA_OPTIONID_THREAD_STACK_SIZE M4OSA_TRUE 59 #define M4OSA_OPTIONID_THREAD_NAME M4OSA_TRUE 60 #define M4OSA_OPTIONID_THREAD_USER_DATA M4OSA_TRUE 61 62 #endif /*M4OSA_THREAD_PRIV_H*/ 63 64