Skip to content

Move implementation for threads to Rust #10290

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 1 commit into from
Nov 5, 2013
Merged

Move implementation for threads to Rust #10290

merged 1 commit into from
Nov 5, 2013

Conversation

dbussink
Copy link
Contributor

@dbussink dbussink commented Nov 5, 2013

This binds to the appropriate pthreads_* and Windows specific functions
and calls them from Rust. This allows for removal of the C++ support
code for threads.

This needs to be reviewed for the Windows parts, I've tested on OS X and Linux.

Fixes #10162

unsafe {
let ptr: LPVOID = cast::transmute(tramp);
let routine: LPTHREAD_START_ROUTINE = cast::transmute(thread_start);
CreateThread(ptr::null(), 1024*1024, routine, tramp, 0, ptr::null())
Copy link
Member

Choose a reason for hiding this comment

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

Should this constant be a static somewhere? (DEFAULT_THREAD_STACK_SIZE or something?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, good point, what is exactly the convention here?

This binds to the appropriate pthreads_* and Windows specific functions
and calls them from Rust. This allows for removal of the C++ support
code for threads.

Fixes #10162
bors added a commit that referenced this pull request Nov 5, 2013
This binds to the appropriate pthreads_* and Windows specific functions
and calls them from Rust. This allows for removal of the C++ support
code for threads.

This needs to be reviewed for the Windows parts, I've tested on OS X and Linux.

Fixes #10162
@bors bors closed this Nov 5, 2013
@bors bors merged commit 47e0bd4 into rust-lang:master Nov 5, 2013
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.

Rewrite std::rt::thread in Rust
3 participants