You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
#include "ztask.h"
#define TAG "ztask"
/*
* @brief: uart�ص�����״̬ת����������ʱ������������֪ͨ * */ void Task_init(Task_t* task){ if(task->TaskNotify){ task->TaskNotify--; if(task->m_tasktransition){ task->m_status = working; //ZLOGI(TAG, "task_init");
if(task->m_taskfunc) task->m_taskfunc(); task->m_status = end; } else{ task->m_status = idle; } } }
/*
* @brief �ص�����ע�� * * * *�ж�����״̬ *��������:״̬ת���� * ״̬ת������1.�ص������Ǽ�ע�� * 2.����֪ͨ * *�����ǿ��У�״̬ת���� * ״̬ת���أ�1.��ע�� * 2.����֪ͨ�ȴ�����״̬���� */ void Task_start(taskfuction cb, Task_t* task){
if(task->m_status != idle){ task->m_tasktransition = false;//״̬: �ǿ��У�״̬ת����
task->TaskNotify++; //֪ͨ����
} else{ task->m_taskfunc = cb; task->m_tasktransition = true;//״̬: ���У�״̬ת����
task->TaskNotify++; //֪ͨ����
} //ZLOGI(TAG, "TaskNotify: %d", task->TaskNotify);
}
|