Uh oh!
There was an error while loading. Please reload this page.
rust: thread: Add Thread wrapper - #109
Open
fbq wants to merge 2 commits into
Open
Conversation
Loading
Uh oh!
There was an error while loading. Please reload this page.
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It's working (on my machine), but sure, a lot to improve.
Updates (v9):
RawThreadandThread<ThreadArg>, each thread struct has its owntry_newfunction.try_new_closureis nowkernel::thread::spawn.Updates (v8):
Updates (v7):
Updates (v6):
try_new_closure()is slightly more appropriate thantry_new().ThreadArgparameter oftry_new()should have'staticlifetime, because the new thread may live longer.Updates (v5):
ThreadArgmore easily to merge withPointerWrappertry_prefixes, as that indicates the return type isKernelResultnotThreadtry_new_closure, so that the users will know the current drawbacks.Updates (v4):
try_new_c_style.Updates (v3):
Thread::newtoThread::try_newbecause as the return type suggests the creation may fail.Thread::try_new_c_styleto allow people use C function pointer for thread creation.nameparameter as the first parameter ofThread::try_newUpdate:
Thread::stopis added, to support waiting for a thread to finish.task_struct. duringThread::newandThread::drop.Thread::newacceptsFnOnce() -> KernelResult<()>as the closure for kernel threads.