You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tend to use std::thread because it supports functional static polymorphism with parameter packs. In other words, I can create a thread from an arbitrary function by providing arguments to the function, with full type checking, rather than casting through a single void *.
This support could probably be generically bolted on in Env by wrapping a target with parameters in a heap-allocated std::function<void()>*, cast to void *, and in an unwrapper, cast back, executed, and deleted.
The text was updated successfully, but these errors were encountered:
Summary:
- Add class `FunctorWrapper` to invoke the function with given parameters
- Implement `StartThreadTyped` which wraps `StartThread` with type checking cover
- Demonstrate `StartThreadTyped` in test `util/thread_local_test.cc`
#8285
Pull Request resolved: #8303
Reviewed By: ajkr
Differential Revision: D28539318
Pulled By: pdillinger
fbshipit-source-id: 624789c236bde31163deda95c1e1471aee68933e
I tend to use
std::thread
because it supports functional static polymorphism with parameter packs. In other words, I can create a thread from an arbitrary function by providing arguments to the function, with full type checking, rather than casting through a single void *.Filed at request of @mrambacher in #8225
This support could probably be generically bolted on in Env by wrapping a target with parameters in a heap-allocated std::function<void()>*, cast to void *, and in an unwrapper, cast back, executed, and deleted.
The text was updated successfully, but these errors were encountered: