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

async: fix re_async_cancel mqueue handling #995

Merged
merged 3 commits into from
Oct 31, 2023
Merged

Conversation

sreimers
Copy link
Member

@sreimers sreimers commented Oct 31, 2023

Since we can't clear/revert a mqueue_push, free list handling has always be done by async queueh and not within re_async_cancel. Otherwise job is reused and maybe executed twice or early.

fixes #992

Since we can't clear/revert a mqueue_push, free list handling has always be
done by async queueh and not within re_async_cancel.
@sreimers sreimers merged commit 4bb4a34 into main Oct 31, 2023
43 checks passed
@sreimers sreimers deleted the re_async_cb_cleanup branch October 31, 2023 12:26
@@ -351,7 +351,8 @@ void re_async_cancel(struct re_async *async, intptr_t id)
w->workh = NULL;
w->cb = NULL;
w->arg = mem_deref(w->arg);
list_move(&w->le, &async->freel);
/* No move to free list since queueh must always handled if
* mqueue_push is called */
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't see why this change has something to do if the pipe is read or not.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pipe queueh is always executed (since it's FIFO), so the free list move must be done there.

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

Successfully merging this pull request may close these issues.

async_work: worker callback is called twice
2 participants