xp_wait_loop

xp_wait_loop()

Begins the XPSPL event wait loop.

The event loop must be started to allow execution of time, networking or complex loop based signals.

Note

XPSPL provides an executable xpspl in the bin directory for automatically loading code into the event loop.

Warning

This is a BLOCKING function.

Any code underneath the function call will NOT be executed until the processor halts execution.

Return type:void

Example #1 Basic Usage

Basic usage example demonstrating using the loop for time based code.

<?php

// Import time module
xp_import('time');

xp_time\awake(10, function(){
    echo '10 seconds passed';
});

xp_wait_loop();

Automatic shutdown

The processor loop has built in support for automatically shutting down when it detects there is nothing else it will ever do.

This example demonstrates the loop shutting down after emitting 5 time based signals.

Read the Docs v: v5.0.1
Versions
latest
v5.0.1
v5.0.0
v4.0.1
v4.0.0
v3.1.1
v3.1.0
v3.0.0
Downloads
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.