Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

线程标志设计可能存在问题 #3

Open
Ryan-CW-Code opened this issue Sep 10, 2022 · 0 comments
Open

线程标志设计可能存在问题 #3

Ryan-CW-Code opened this issue Sep 10, 2022 · 0 comments

Comments

@Ryan-CW-Code
Copy link

`
ccmBss uint8_t testThread1_stack[256 * 4];
static osThreadId_t testThread1Handle;
static const osThreadAttr_t testThread1_attributes = {
.name = "testThread1",
.stack_size = 256 * 4,
.stack_mem = (void *)testThread1_stack,
.priority = (osPriority_t)osPriorityNormal7,

};

ccmBss uint8_t testThread2_stack[256 * 4];
static osThreadId_t testThread2Handle;
static const osThreadAttr_t testThread2_attributes = {
.name = "testThread1",
.stack_size = 256 * 4,
.stack_mem = (void *)testThread2_stack,
.priority = (osPriority_t)osPriorityLow7,

};

void testThread1(void *argument)
{
while (1)
{

    osThreadFlagsSet(testThread2Handle, BIT2);
    printf("已发送........\r\n");

    osDelay(2000);
}

}

void testThread2(void *argument)
{
while (1)
{

    uint32_t res = osThreadFlagsWait(BIT2, osFlagsWaitAny, 4000);
    ulog_w(TAG, "res: %d", res);
}

}`

这是我的代码,线程1发送线程标志位给线程2,线程2接受。正常情况应该线程1设置标志位后,线程2立即响应。下面是我的打印信息
image

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant