-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
implement thread::detach() #69
Comments
Right, I remember by the time I wrote it I had no idea what to do. But the documentation must be updated anyway. Do you have a use case where you need functionality added to it? |
When you start a thread as fire-and-forget you don't want to keep a handle to the thread. So you call Another option would be to implement |
I guess this makes more sense in C with POSIX threads, but in C++, if the thread is a local (stack) object, and you exit the scope, the object is destroyed anyway. If the thread was allocated somewhere else (dynamically or statically), it is alive as long as that scope is alive, so detach again has not much to do. Am I missing something? |
I would say it's as if you would "move" the thread into the scheduler: Once you detach, the thread continue running until it exits. The destructor doesn't have any effect anymore in that situation. Ressources are freed once the thread exits (see cpp reference). |
That's probably possible with |
I don't know how to implement this, but for example CMSIS-RTOS seems to able to do that |
Ok, will do. |
it's currently not implemented (silently returns) but there is no note in the documentation about it
The text was updated successfully, but these errors were encountered: