Ultralight C++ API 1.4.0
|
#include <Ultralight/platform/Thread.h>
User-defined factory for creating new threads.
You can implement this interface so that the library will use your own implementation for creating threads (useful for tracking thread creation, setting thread names, etc).
When no factory is defined, the library will create threads using the default platform-specific thread creation functions (eg, _beginthreadex()
on Windows, pthread_create()
on POSIX).
To provide your own custom ThreadFactory implementation, you should inherit from this class, handle the virtual member functions, and then pass an instance to Platform::set_thread_factory().
Public Member Functions | |
virtual | ~ThreadFactory ()=default |
virtual bool | CreateThread (const char *name, ThreadType type, ThreadEntryPoint entry_point, void *entry_point_data, CreateThreadResult &result)=0 |
Create a new thread. | |
|
virtualdefault |
|
pure virtual |
Create a new thread.
name | The name of the thread (can be nullptr). |
type | The type of thread. |
entry_point | The entry point for the thread. |
entry_point_data | The data to pass to the entry point. |
result | The resulting id and handle of the thread creation. |