Skip to main content

Module thread_proxy

Module thread_proxy 

Source
Expand description

The threads of the module: the id of the calling thread, and a call made on another one.

Not from upstream, where the runtime carries a call from one thread to another. A module built with threads runs each thread in a web worker, and a worker only does what arrives at its event loop: a call for another thread is put into a queue of the module and the thread is notified. The two uses are the wake-up of the dispatcher from the render thread and the frame out of turn the thread of the user interface asks the render thread for (docs/porting/browser-render-worker.md, section 3 and “B2.3”).

The work only carries what is Send: no object of the page crosses.

The runtime itself carries calls too, from any thread to the main thread: the functions of the C library that only the main thread can serve. Those make the calling thread wait; [proxied_calls] is their count.

In a build without threads there is one thread, its id is 0 and no call is ever queued.

Functions§

current_thread
The id of the calling thread: the key of its worker in the table of threads of the module. 0 in a build without threads.