Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

butex_wake*支持nosignal的需求 #1749

Closed
yanglimingcn opened this issue Apr 24, 2022 · 3 comments
Closed

butex_wake*支持nosignal的需求 #1749

yanglimingcn opened this issue Apr 24, 2022 · 3 comments

Comments

@yanglimingcn
Copy link
Contributor

yanglimingcn commented Apr 24, 2022

有些场景,在butex_wake*的时候不希望被唤醒的bthread和现在的bthread马上交换并投入执行,比如,execution_queue是一个多生产者单消费者的队列,多生产者生成任务然后等待消费者将任务处理完成(比如:调用CountdownEvent::wait),消费者处理完任务唤醒生产者(比如:调用CountdownEvent::wait),在此过程中会频繁的触发协程的exchange。
需求:因为消费者是单线程,往往是性能的瓶颈点,需要最快的完成任务,如果消费者在处理完每个任务,只将消费者投入运行队列,并且能批量执行signal,这样性能应该会好很多。

@wwbmmm
Copy link
Contributor

wwbmmm commented Apr 24, 2022

你是希望提供类似butex_wake_urgent/butex_wake_background这样的函数吗?

@yanglimingcn
Copy link
Contributor Author

是的,类似这样的功能,我现在改了一下 int butex_wake_all(void* arg, bool nodelay),加个了参数,如果nodelay = false就统一走ready_to_run_general,不走下边的TaskGroup::exchange。
但是这个改动不一定优雅,可能需要你们的综合设计。

@wwbmmm
Copy link
Contributor

wwbmmm commented Apr 24, 2022

可以提个PR看看

@yanglimingcn yanglimingcn changed the title butex_wake*的需求 butex_wake*支持nosignal的需求 May 17, 2022
@wwbmmm wwbmmm closed this as completed Jun 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants