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

Document thread-safety issues in C callbacks #5657

Merged
merged 1 commit into from
Feb 13, 2014
Merged

Document thread-safety issues in C callbacks #5657

merged 1 commit into from
Feb 13, 2014

Conversation

timholy
Copy link
Member

@timholy timholy commented Feb 3, 2014

The main reason I made this a PR is to ask: should we export SingleAsyncWork? The only other place I see the manual making use of an unexported function/type is in networking-and-streams.rst, which uses Base.getaddrinfo.

On balance I suspect things are fine as they are, just thought I should raise the issue.

@JeffBezanson
Copy link
Member

This is great documentation to have --- unfortunately highlighting how ugly the current available workaround is :)

@loladiro is this writeup correct?

getaddrinfo is now exported.

@Keno
Copy link
Member

Keno commented Feb 5, 2014

Yes, this looks correct.

@timholy
Copy link
Member Author

timholy commented Feb 5, 2014

The fact that this is correct is entirely due to @vtjnash, who on julia-users provided the clue to use uv_async_send.

Should we merge this, or should we wait for a cleaner interface? At the cost of an additional export, I could probably write a function (which would have an eval or two) that would simplify this a bit. But it would be pretty limited: the user-supplied callback would have to be a thunk. That means that even if the C callback supplies some data, it couldn't get to the Julia callback. (That's officially true now, but if you are willing to experiment with danger I'm guessing you could stash stuff in a pre-allocated global buffer before calling uv_async_send.)

I dug into this in the context of needing a "wakeup" callback, so for my usage a thunk is fine. But I wonder if it would be too limiting to deserve a nice wrapper, and that at this point we're better off just documenting an ugly interface.

timholy added a commit that referenced this pull request Feb 13, 2014
Document thread-safety issues in C callbacks
@timholy timholy merged commit eb641c2 into JuliaLang:master Feb 13, 2014
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.

4 participants