Where the x-kernel is embedded in another operating system, there may be asynchronous threads representing device drivers or user requests that want to enter the x-kernel . These threads must, in general, acquire the x-kernel master lock (i.e., enter the x-kernel monitor) with
xk_master_lock before performing any x-kernel operations, including other thread synchronization operations. (This isn't necessary for normal x-kernel threads because threads started by evSchedule acquire the master lock automatically when they start running.) Unless a call is explicitly documented otherwise, threads may not make x-kernel system or library calls without holding the master lock.
A thread acquires and releases the master x-kernel lock with the following operations.
void xk_master_lock(void)
void xk_master_unlock(void)
Note that normal protocols should not use these operations. The only place that they are meaningful is in anchor protocols, such as device drivers, and application-level interfaces, that have to transition between the x-kernel and the host OS. Also note that this interface is not part of the official x-kernel interface; it is internal to the current implementation of the x-kernel .