当前位置: 首页>>代码示例>>C++>>正文


C++ xTaskGetCurrentTaskHandle函数代码示例

本文整理汇总了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;
	}
开发者ID:Alexander-Wilms,项目名称:STM3240G-EVAL,代码行数:9,代码来源:port.c

示例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;
  }
}
开发者ID:Joe-Merten,项目名称:Stm32-Tools-Evaluation,代码行数:14,代码来源:cpu_utils.c

示例3: MPU_xTaskGetCurrentTaskHandle

	xTaskHandle MPU_xTaskGetCurrentTaskHandle( void )
	{
	xTaskHandle xReturn;
    portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();

		xReturn = xTaskGetCurrentTaskHandle();
        portRESET_PRIVILEGE( xRunningPrivileged );
		return xReturn;
	}
开发者ID:Adilla,项目名称:openwsn-fw,代码行数:9,代码来源:port.c

示例4: MPU_xTaskGetCurrentTaskHandle

	TaskHandle_t MPU_xTaskGetCurrentTaskHandle( void )
	{
	TaskHandle_t xReturn;
	BaseType_t xRunningPrivileged = xPortRaisePrivilege();

		xReturn = xTaskGetCurrentTaskHandle();
		vPortResetPrivilege( xRunningPrivileged );
		return xReturn;
	}
开发者ID:sean93park,项目名称:freertos,代码行数:9,代码来源:mpu_wrappers.c

示例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 );
		}
	}
}
开发者ID:moussu,项目名称:GLiP,代码行数:44,代码来源:port.c

示例6: xDoIOwnTheMutex

signed portBASE_TYPE xDoIOwnTheMutex( xMutexHandle pxMutex )
{
    portBASE_TYPE c;

    portENTER_CRITICAL( );
    c = pxMutex->pxOwner == xTaskGetCurrentTaskHandle( );
    portEXIT_CRITICAL( );

    return c;
}
开发者ID:119,项目名称:bcm-wiced-sdk,代码行数:10,代码来源:Mutex_FreeRTOS.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;
}
开发者ID:loboris,项目名称:Espruino,代码行数:10,代码来源:rtosutil.c

示例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);
}
开发者ID:AriZuu,项目名称:micropython,代码行数:10,代码来源:mpthreadport.c

示例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);
}
开发者ID:AriZuu,项目名称:micropython,代码行数:11,代码来源:mpthreadport.c

示例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];
}
开发者ID:wosayttn,项目名称:aos,代码行数:11,代码来源:aos_freertos.c

示例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() ) );
}
开发者ID:ICRS,项目名称:OpenPilot-Clone,代码行数:11,代码来源:port.c

示例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)
  {
  }
}
开发者ID:IvanOrfanidi,项目名称:STM32-Tests-Project,代码行数:17,代码来源:stm32f10x_it.c

示例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;
}
开发者ID:wosayttn,项目名称:aos,代码行数:12,代码来源:aos_freertos.c

示例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;
	
}
开发者ID:simonliu009,项目名称:MaixPy,代码行数:53,代码来源:mpthreadport.c

示例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;
}
开发者ID:119,项目名称:bcm-wiced-sdk,代码行数:39,代码来源:Mutex_FreeRTOS.c


注:本文中的xTaskGetCurrentTaskHandle函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。