您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ xTaskGetCurrentTaskHandle函数代码示例

51自学网 2021-06-03 10:14:37
  C++
这篇教程C++ xTaskGetCurrentTaskHandle函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中xTaskGetCurrentTaskHandle函数的典型用法代码示例。如果您正苦于以下问题:C++ xTaskGetCurrentTaskHandle函数的具体用法?C++ xTaskGetCurrentTaskHandle怎么用?C++ xTaskGetCurrentTaskHandle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了xTaskGetCurrentTaskHandle函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例16: mp_thread_init

void mp_thread_init(void) {    mp_thread_mutex_init(&thread_mutex);    mp_thread_set_state(&mp_state_ctx.thread);    // create first entry in linked list of all threads    thread = &thread_entry0;    thread->id = xTaskGetCurrentTaskHandle();    thread->ready = 1;    thread->arg = NULL;    thread->stack = mpTaskStack;    thread->stack_len = MICROPY_TASK_STACK_LEN;    thread->next = NULL;}
开发者ID:AriZuu,项目名称:micropython,代码行数:13,


示例17: mp_thread_init

void mp_thread_init(void *stack, uint32_t stack_len) {    mp_thread_set_state(&mp_state_ctx.thread);    // create the first entry in the linked list of all threads    thread = &thread_entry0;    thread->id = xTaskGetCurrentTaskHandle();    thread->ready = 1;    thread->arg = NULL;    thread->stack = stack;    thread->stack_len = stack_len;    thread->next = NULL;    mp_thread_mutex_init(&thread_mutex);   // MP_THREAD_GIL_EXIT();}
开发者ID:simonliu009,项目名称:MaixPy,代码行数:13,


示例18: test_task_get_state

void test_task_get_state(void* arg){    //Current task should return eRunning    TEST_ASSERT(eTaskGetState(xTaskGetCurrentTaskHandle()) == eRunning);    //Idle task of current core should return eReady    TEST_ASSERT(eTaskGetState(xTaskGetIdleTaskHandle()) == eReady);    //Blocked Task should return eBlocked    TEST_ASSERT(eTaskGetState(blocked_task_handle) == eBlocked);    //Suspended Task should return eSuspended    TEST_ASSERT(eTaskGetState(suspended_task_handle) == eSuspended);    xSemaphoreGive(done_sem);    vTaskDelete(NULL);}
开发者ID:altran-nl,项目名称:esp-idf,代码行数:14,


示例19: mp_thread_finish

void mp_thread_finish(void) {    mp_thread_mutex_lock(&thread_mutex, 1);    thread_t *th = thread;    thread_t *pre_th = NULL;    for (th = thread; th != NULL; th = th->next) {        if (th->id == xTaskGetCurrentTaskHandle()) {            th->ready = 0;            //mp_thread_delete(pre_th,th);//TODO:wether need to delete threand to free memory            break;        }        pre_th = th;    }    mp_thread_mutex_unlock(&thread_mutex);}
开发者ID:simonliu009,项目名称:MaixPy,代码行数:14,


示例20: sys_arch_thread_current

/* * Returns the thread control block for the currently active task. In case * of an error the functions returns NULL. */sys_thread_tsys_arch_thread_current( void ){    sys_tcb_t      *p = tasks;    xTaskHandle     pid = xTaskGetCurrentTaskHandle(  );    vPortEnterCritical(  );    while( ( p != NULL ) && ( p->pid != pid ) )    {        p = p->next;    }    vPortExitCritical(  );    return p;}
开发者ID:darknesmonk,项目名称:freertos-5.1.2-lpc23xx,代码行数:18,


示例21: vHelloWorld

static void vHelloWorld( void *pvParameters ) {	xTaskHandle thisTask = xTaskGetCurrentTaskHandle();	char buf[64];	/* The parameters are not used. */	( void ) pvParameters;	consoleInit();	vTaskList(buf);	printf("%s", buf);	for( ;; ) {		printf("Running: %u/r/n", xTaskGetTickCount());		vTaskDelay( 5000 );	}}
开发者ID:kelledge,项目名称:payload-software,代码行数:15,


示例22: mp_thread_gc_others

void 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);}
开发者ID:AriZuu,项目名称:micropython,代码行数:15,


示例23: mqtt_task

static inline void mqtt_task(){    struct Network network;    char client_id[20];    uint8_t mqtt_buf[100];    uint8_t mqtt_readbuf[100];    MQTTPacket_connectData data = MQTTPacket_connectData_initializer;    NewNetwork( &network );    strcpy(client_id, "esp-gizmo-ir");    if (ConnectNetwork(&network, config_get_mqtt_host(),                config_get_mqtt_port()) != 0) {        printf("Connect to MQTT server failed/n");        return;    }    NewMQTTClient(&mqtt_client, &network, 5000, mqtt_buf, 100, mqtt_readbuf, 100);    data.willFlag       = 0;    data.MQTTVersion    = 3;    data.clientID.cstring   = client_id;    data.username.cstring   = NULL;    data.password.cstring   = NULL;    data.keepAliveInterval  = 10;    data.cleansession   = 0;    printf("Send MQTT connect ... /n");    if (MQTTConnect(&mqtt_client, &data) != 0) {        printf("MQTT connect failed/n");        return;    }    const char *topic = config_get_cmd_topic();    printf("Sibscribe to topic: %s/n", topic);    if (MQTTSubscribe(&mqtt_client, topic, QOS1, topic_received) != 0) {        printf("Subscription failed/n");        return;    }    while (MQTTYield(&mqtt_client, 1000) != DISCONNECTED) {        printf("free heap: %d bytes/n", xPortGetFreeHeapSize());        uint16_t free_stack = uxTaskGetStackHighWaterMark(xTaskGetCurrentTaskHandle());        printf("minimum free stack: %d bytes/n", free_stack);    };    printf("Connection dropped, request restart/n");}
开发者ID:sheinz,项目名称:esp-gizmo-ir-remote,代码行数:48,


示例24: CreatorThread_GetThreadID

uint CreatorThread_GetThreadID(CreatorThread self){    uint result = 0;    xTaskHandle currentTask;    if (self)    {        ThreadInfo *threadInfo = (ThreadInfo*)self;        currentTask = threadInfo->ThreadID;    }    else    {        currentTask = xTaskGetCurrentTaskHandle();    }    result = (uint)uxTaskGetTaskNumber(currentTask);    return result;}
开发者ID:CreatorDev,项目名称:creator-wifire-app,代码行数:16,


示例25: vSerialPutString

void vSerialPutString( xComPortHandle pxPort, const signed char * const pcString, unsigned short usStringLength ){const TickType_t xMaxBlockTime = pdMS_TO_TICKS( 150UL );	( void ) pxPort;	/* Note this is the currently sending task. */	xUARTSendingTask = xTaskGetCurrentTaskHandle();	/* Output uxStringLength bytes starting from pcString. */	XUartLite_Send( &xUartLiteInstance, ( unsigned char * ) pcString, usStringLength );	/* Wait in the Blocked state (so not using any CPU time) for the Tx to	complete. */	ulTaskNotifyTake( pdTRUE, xMaxBlockTime );}
开发者ID:Darma,项目名称:freertos,代码行数:16,


示例26: xTaskGetCurrentTaskHandle

/* * Returns the thread control block for the currently active task. In case * of an error the functions returns NULL. */sys_tcb_t*sys_arch_thread_current( void ){	OS_SR_SAVE_VAR	sys_tcb_t      *p = tasks;	sys_thread_t   pid = xTaskGetCurrentTaskHandle();    // Enter Critical Section    OSEnterCritical();    while( ( p != NULL ) && ( p->pid != pid ) )    {        p = p->next;    }    // Exit Critical Section    OSExitCritical();    return p;}
开发者ID:GBeckerRS,项目名称:brtos,代码行数:21,


示例27: mp_thread_deinit

void mp_thread_deinit(void) {    mp_thread_mutex_lock(&thread_mutex, 1);    for (thread_t *th = thread; th != NULL; th = th->next) {        // don't delete the current task        if (th->id == xTaskGetCurrentTaskHandle()) {            continue;        }        vTaskDelete(th->id);        // m_del_obj(thread_t,th);        free(th);    }    mp_thread_mutex_unlock(&thread_mutex);    // allow FreeRTOS to clean-up the threads    vTaskDelay(2);}
开发者ID:simonliu009,项目名称:MaixPy,代码行数:17,


示例28: CreatorThread_SleepTicks

bool CreatorThread_SleepTicks(CreatorThread self, uint ticks){    bool result = false;    if (ticks > 0)    {        if (self)        {            ThreadInfo *threadInfo = (ThreadInfo*)self;            xTaskHandle currentTask = xTaskGetCurrentTaskHandle();            result = (currentTask == threadInfo->ThreadID);        }        else        result = true;        if (result)        vTaskDelay(ticks);    }    return result;}
开发者ID:CreatorDev,项目名称:creator-wifire-app,代码行数:18,


示例29: aos_task_key_create

int aos_task_key_create(aos_task_key_t *key){    AosStaticTask_t *task = (AosStaticTask_t *)xTaskGetCurrentTaskHandle();    int i;    if (task->magic != AOS_MAGIC)        return -1;    for (i=0;i<4;i++) {        if (task->key_bitmap & (1 << i))            continue;        task->key_bitmap |= 1 << i;        *key = i;        return 0;    }    return -1;}
开发者ID:wosayttn,项目名称:aos,代码行数:19,



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


C++ xTaskGetSchedulerState函数代码示例
C++ xTaskCreate函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。