本文整理汇总了C++中xTaskGetCurrentTaskHandle函数的典型用法代码示例。如果您正苦于以下问题:C++ xTaskGetCurrentTaskHandle函数的具体用法?C++ xTaskGetCurrentTaskHandle怎么用?C++ xTaskGetCurrentTaskHandle使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xTaskGetCurrentTaskHandle函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MPU_xTaskGetCurrentTaskHandle
TaskHandle_t MPU_xTaskGetCurrentTaskHandle( void )
{
TaskHandle_t xReturn;
BaseType_t xRunningPrivileged = prvRaisePrivilege();
xReturn = xTaskGetCurrentTaskHandle();
portRESET_PRIVILEGE( xRunningPrivileged );
return xReturn;
}
示例2: EndIdleMonitor
/**
* @brief Stop Idle monitor
* @param None
* @retval None
*/
void EndIdleMonitor (void)
{
if( xTaskGetCurrentTaskHandle() == xIdleHandle )
{
/* Store the handle to the idle task. */
osCPU_IdleSpentTime = xTaskGetTickCountFromISR() - osCPU_IdleStartTime;
osCPU_TotalIdleTime += osCPU_IdleSpentTime;
}
}
示例3: MPU_xTaskGetCurrentTaskHandle
xTaskHandle MPU_xTaskGetCurrentTaskHandle( void )
{
xTaskHandle xReturn;
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
xReturn = xTaskGetCurrentTaskHandle();
portRESET_PRIVILEGE( xRunningPrivileged );
return xReturn;
}
示例4: MPU_xTaskGetCurrentTaskHandle
TaskHandle_t MPU_xTaskGetCurrentTaskHandle( void )
{
TaskHandle_t xReturn;
BaseType_t xRunningPrivileged = xPortRaisePrivilege();
xReturn = xTaskGetCurrentTaskHandle();
vPortResetPrivilege( xRunningPrivileged );
return xReturn;
}
示例5: vPortForciblyEndThread
void vPortForciblyEndThread( void *pxTaskToDelete )
{
xTaskHandle hTaskToDelete = ( xTaskHandle )pxTaskToDelete;
pthread_t xTaskToDelete;
pthread_t xTaskToResume;
if ( 0 == pthread_mutex_lock( &xSingleThreadMutex ) )
{
xTaskToDelete = prvGetThreadHandle( hTaskToDelete );
xTaskToResume = prvGetThreadHandle( xTaskGetCurrentTaskHandle() );
if ( xTaskToResume == xTaskToDelete )
{
/* This is a suicidal thread, need to select a different task to run. */
vTaskSwitchContext();
xTaskToResume = prvGetThreadHandle( xTaskGetCurrentTaskHandle() );
}
if ( pthread_self() != xTaskToDelete )
{
/* Cancelling a thread that is not me. */
if ( xTaskToDelete != ( pthread_t )NULL )
{
/* Send a signal to wake the task so that it definitely cancels. */
pthread_testcancel();
pthread_cancel( xTaskToDelete );
/* Pthread Clean-up function will note the cancellation. */
}
(void)pthread_mutex_unlock( &xSingleThreadMutex );
}
else
{
/* Resume the other thread. */
prvResumeThread( xTaskToResume );
/* Pthread Clean-up function will note the cancellation. */
/* Release the execution. */
uxCriticalNesting = 0;
vPortEnableInterrupts();
(void)pthread_mutex_unlock( &xSingleThreadMutex );
/* Commit suicide */
pthread_exit( (void *)1 );
}
}
}
示例6: xDoIOwnTheMutex
signed portBASE_TYPE xDoIOwnTheMutex( xMutexHandle pxMutex )
{
portBASE_TYPE c;
portENTER_CRITICAL( );
c = pxMutex->pxOwner == xTaskGetCurrentTaskHandle( );
portEXIT_CRITICAL( );
return c;
}
示例7: xTaskGetCurrentTaskHandle
int *task_getCurrentIndex(){
int i;TaskHandle_t handle;
handle = xTaskGetCurrentTaskHandle();
for(i = 0; i < taskMax; i++){
if(RTOStasks[i].handle == handle){
return i;
}
}
return NULL;
}
示例8: mp_thread_start
void mp_thread_start(void) {
mp_thread_mutex_lock(&thread_mutex, 1);
for (thread_t *th = thread; th != NULL; th = th->next) {
if (th->id == xTaskGetCurrentTaskHandle()) {
th->ready = 1;
break;
}
}
mp_thread_mutex_unlock(&thread_mutex);
}
示例9: mp_thread_finish
void mp_thread_finish(void) {
mp_thread_mutex_lock(&thread_mutex, 1);
// TODO unlink from list
for (thread_t *th = thread; th != NULL; th = th->next) {
if (th->id == xTaskGetCurrentTaskHandle()) {
th->ready = 0;
break;
}
}
mp_thread_mutex_unlock(&thread_mutex);
}
示例10:
void *aos_task_getspecific(aos_task_key_t key)
{
AosStaticTask_t *task = (AosStaticTask_t *)xTaskGetCurrentTaskHandle();
if (key >= 4)
return NULL;
if (task->magic != AOS_MAGIC)
return NULL;
return task->keys[key];
}
示例11: vPortStartFirstTask
void vPortStartFirstTask( void )
{
/* Initialise the critical nesting count ready for the first task. */
uxCriticalNesting = 0;
/* Start the first task. */
vPortEnableInterrupts();
/* Start the first task. */
prvResumeThread( prvGetThreadHandle( xTaskGetCurrentTaskHandle() ) );
}
示例12: HardFault_Handler
/**
* @brief This function handles Hard Fault exception.
* @param None
* @retval None
*/
void HardFault_Handler(void)
{
#ifdef FREERTOS_CONFIG_H
CurrentTaskHandle = xTaskGetCurrentTaskHandle();
pNameCurrentTask = pcTaskGetTaskName(CurrentTaskHandle);
#endif
/* Go to infinite loop when Hard Fault exception occurs */
while (1)
{
}
}
示例13: aos_task_setspecific
int aos_task_setspecific(aos_task_key_t key, void *vp)
{
AosStaticTask_t *task = (AosStaticTask_t *)xTaskGetCurrentTaskHandle();
if (key >= 4)
return -1;
if (task->magic != AOS_MAGIC)
return -1;
task->keys[key] = vp;
return 0;
}
示例14: mp_thread_gc_others
int mp_thread_gc_others(void) {
/* mp_thread_mutex_lock(&thread_mutex, 1);
for (thread_t *th = thread; th != NULL; th = th->next) {
gc_collect_root((void**)&th, 1);
gc_collect_root(&th->arg, 1); // probably not needed
if (th->id == xTaskGetCurrentTaskHandle()) {
continue;
}
if (!th->ready) {
continue;
}
gc_collect_root(th->stack, th->stack_len); // probably not needed
}
mp_thread_mutex_unlock(&thread_mutex);
*/
int n_th = 0;
void **ptrs;
mp_state_thread_t *state;
mp_thread_mutex_lock(&thread_mutex, 1);
for (thread_t *th = thread; th != NULL; th = th->next) {
if (!th->ready) continue; // thread not ready
//if (th->type == THREAD_TYPE_SERVICE) continue; // Only scan PYTHON threads
if (th->id == xTaskGetCurrentTaskHandle()) continue; // Do not process the running thread
//state = (mp_state_thread_t *)th->state_thread;
n_th++;
// Mark the root pointers on thread
//gc_collect_root((void **)state->dict_locals, 1);
if (th->arg) {
// Mark the pointers on thread arguments
ptrs = (void**)(void*)&th->arg;
gc_collect_root(ptrs, 1);
}
#if MICROPY_ENABLE_PYSTACK
// Mark the pointers on thread pystack
//ptrs = (void**)(void*)state->pystack_start;
//gc_collect_root(ptrs, (state->pystack_cur - state->pystack_start) / sizeof(void*));
#endif
// If PyStack is used, no pointers to MPy heap are placed on tasks stack
#if !MICROPY_ENABLE_PYSTACK
// Mark the pointers on thread stack
//gc_collect_root(th->curr_sp, ((void *)state->stack_top - th->curr_sp) / sizeof(void*)); // probably not needed
#endif
}
mp_thread_mutex_unlock(&thread_mutex);
return n_th;
}
示例15: xMutexTake
signed portBASE_TYPE xMutexTake( xMutexHandle pxMutex, portTickType xTicksToWait )
{
portENTER_CRITICAL( );
if ( pxMutex->pxOwner == xTaskGetCurrentTaskHandle( ) )
{
pxMutex->uxCount++;
portEXIT_CRITICAL( );
return pdTRUE;
}
if ( ( xTicksToWait > ( portTickType ) 0 ) && ( pxMutex->pxOwner != NULL ) )
{
vTaskPlaceOnEventList( &( pxMutex->xTasksWaitingToTake ), xTicksToWait );
taskYIELD( );
if ( pxMutex->pxOwner == xTaskGetCurrentTaskHandle( ) )
{
pxMutex->uxCount = 1;
portEXIT_CRITICAL( );
return pdTRUE;
}
else
{
portEXIT_CRITICAL( );
return pdFALSE;
}
}
if ( pxMutex->pxOwner == NULL )
{
pxMutex->pxOwner = xTaskGetCurrentTaskHandle( );
pxMutex->uxCount = 1;
portEXIT_CRITICAL( );
return pdTRUE;
}
portEXIT_CRITICAL( );
return pdFALSE;
}