Function v8::new_default_platform

source ·
pub fn new_default_platform(
    thread_pool_size: u32,
    idle_task_support: bool
) -> UniqueRef<Platform>
Expand description

Returns a new instance of the default v8::Platform implementation.

|thread_pool_size| is the number of worker threads to allocate for background jobs. If a value of zero is passed, a suitable default based on the current number of processors online will be chosen. If |idle_task_support| is enabled then the platform will accept idle tasks (IdleTasksEnabled will return true) and will rely on the embedder calling v8::platform::RunIdleTasks to process the idle tasks.

The default platform for v8 may include restrictions and caveats on thread creation and initialization. This platform should only be used in cases where v8 can be reliably initialized on the application’s main thread, or the parent thread to all threads in the system that will use v8.

One example of a restriction is the use of Memory Protection Keys (pkeys) on modern Linux systems using modern Intel/AMD processors. This particular technology requires that all threads using v8 are created as descendent threads of the thread that called v8::Initialize.