|
Ultralight C API 2.0.0
|
User-defined factory for creating new threads.
#include <Ultralight/CAPI/CAPI_ThreadFactory.h>
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).
The factory covers the threads that run page content: script workers, the JavaScript compiler and garbage collector, networking, and resource loading. The library starts a few threads outside the factory (media playback and some background rendering work), and the libraries it links start their own, so a factory won't account for every thread in the process.
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).
Classes | |
| struct | ULCreateThreadResult |
| Result of creating a new thread. More... | |
| struct | ULThreadFactory |
| User-defined factory for creating new threads. More... | |
Typedefs | |
| typedef unsigned int | ULThreadId |
| Unique id of the thread, used for referencing the created thread later. | |
| typedef unsigned long long | ULThreadHandle |
| Platform-specific handle. | |
| typedef void(*) | ULThreadEntryPoint(void *) |
| Entry point for the thread, this function should be called by the thread once it is active and should be passed entry_point_data as the argument. | |
| typedef bool(*) | ULThreadFactoryCreateThreadCallback(void *user_data, const char *name, ULThreadType type, ULThreadEntryPoint entry_point, void *entry_point_data, ULCreateThreadResult *result) |
| The callback invoked when the library wants to create a new thread. | |
| typedef void(*) ULThreadEntryPoint(void *) |
Entry point for the thread, this function should be called by the thread once it is active and should be passed entry_point_data as the argument.
| typedef bool(*) ULThreadFactoryCreateThreadCallback(void *user_data, const char *name, ULThreadType type, ULThreadEntryPoint entry_point, void *entry_point_data, ULCreateThreadResult *result) |
The callback invoked when the library wants to create a new thread.
| user_data | A user-defined pointer, see ULThreadFactory. |
| name | The name of the thread (can be NULL). |
| 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. |
| typedef unsigned long long ULThreadHandle |
Platform-specific handle.
| typedef unsigned int ULThreadId |
Unique id of the thread, used for referencing the created thread later.