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

[refactor] introduce a new Corethread Event consume method #585

Closed
lidaobing opened this issue May 15, 2024 · 0 comments · Fixed by #587
Closed

[refactor] introduce a new Corethread Event consume method #585

lidaobing opened this issue May 15, 2024 · 0 comments · Fixed by #587
Assignees

Comments

@lidaobing
Copy link
Member

Currently, the only way to consume corethread event is registering callback on CoreThread.signalEvent. Example:

thread->signalEvent.connect(
[=](shared_ptr<const Event> event) { processEvent(thread, event); });

But it's not suitable for UI(which has its own mainloop). so we need to use an adaptor to queue it in the mainloop, which make things too complex. Example:

void EventAdaptor::processEvent(std::shared_ptr<const Event> event) {
EventData* callback = new EventData(this, event);
g_idle_add(processEventCallback, callback);
}

we need to add some methods to corethread, to make the consumer easier to write.

CoreThread.CountEvent
CoreThread.HasEvent
CoreThread.PopEvent
@lidaobing lidaobing self-assigned this May 15, 2024
@lidaobing lidaobing linked a pull request May 15, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant