class Runtime (View source)

Methods

static bool
enableCoroutine(int|bool $enable = true, int $flags = SWOOLE_HOOK_ALL)

To enable/disable runtime hooks in coroutines.

static int
getHookFlags()

No description

static bool
setHookFlags(int $flags)

No description

Details

static bool enableCoroutine(int|bool $enable = true, int $flags = SWOOLE_HOOK_ALL)

To enable/disable runtime hooks in coroutines.

For backward-compatible reason, there are four different ways to call this method:

1. Swoole\Runtime::enableCoroutine(); // Enable runtime hooks represented by constant SWOOLE_HOOK_ALL.

2. Swoole\Runtime::enableCoroutine($flags); // Enable specified runtime hooks.

3. Swoole\Runtime::enableCoroutine(true, $flags); // Enable specified runtime hooks.

4. Swoole\Runtime::enableCoroutine(false); // Disable runtime hooks.

Following statements are of the same (when used to disable runtime hooks): Swoole\Runtime::enableCoroutine(0); // #2 Swoole\Runtime::enableCoroutine(true, 0); // #3 Swoole\Runtime::enableCoroutine(false); // #4

Parameters

int|bool $enable
int $flags

Return Value

bool

TRUE on success, or FALSE on failure.

static int getHookFlags()

No description

Return Value

int

static bool setHookFlags(int $flags)

No description

Parameters

int $flags

Return Value

bool

true on success or false on failure