Skip to content

FFI Doc: Chapter about callbacks #11486

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

Merged
merged 4 commits into from
Jan 21, 2014
Merged

FFI Doc: Chapter about callbacks #11486

merged 4 commits into from
Jan 21, 2014

Conversation

Matthias247
Copy link
Contributor

I wrote a chapter for the FFI tutorial that describes how to perform callbacks from C code to Rust and gives some hints about what to consider and synchronization.

I just needed that for my own wrapper and thought it would be helpful for others.

unsafe {
register_callback(callback);
}
... // Do sth. and wait for callbacks
Copy link
Member

Choose a reason for hiding this comment

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

s/sth./something/

Simplified the first examples to demonstrate callbacks without other threads involved and shortened the elaboration about async callbacks.
@Matthias247
Copy link
Contributor Author

I made an update where I focus more on the simple case -> Callbacks that are invoked as a direct reaction to a call on the library.
I now wrapped up the whole async and background thread related things to a short chapter which only gives some hints about what to consider in such scenarios.

@Matthias247
Copy link
Contributor Author

@cmr This is not in the current version :-)

@emberian
Copy link
Member

Oops. The peril of commit-at-a-time review!

bors added a commit that referenced this pull request Jan 21, 2014
I wrote a chapter for the FFI tutorial that describes how to perform callbacks from C code to Rust and gives some hints about what to consider and synchronization.

I just needed that for my own wrapper and thought it would be helpful for others.
@bors bors closed this Jan 21, 2014
@bors bors merged commit 112d01a into rust-lang:master Jan 21, 2014
@Matthias247 Matthias247 deleted the doc branch January 25, 2014 16:57
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.

6 participants