Table of Contents

Name

qthread_disable_shepherd, qthread_enable_shepherd - enable or disable a shepherd for thread scheduling

Synopsis

#include <qthread.h>

int
qthread_disable_shepherd (qthread_shepherd_id_t shep);

void
qthread_enable_shepherd (qthread_shepherd_id_t shep);

Description

These functions allow shepherds to be either enabled or disabled. All shepherds start in the enabled state.

Disabled shepherds cannot execute threads, and thus threads are actively migrated away from disabled shepherds. The migration is based on both distance and an estimate to "busyness" (based on the shepherd’s active queue length). Disabling a shepherd affects thread-placement decisions immediately, but the disabled shepherd may continue executing its current thread until it either blocks, yields, or exits. Once that thread stops executing, the disabled shepherd monitors its queue and rather than execute runnable threads, migrates runnable threads to nearby shepherds.

When a shepherd is re-enabled, it becomes available to run threads.

Return Value

On success, the specified shepherd is marked as disabled and the value QTHREAD_SUCCESS is returned. On failure, an error code is returned.

Errors

QTHREAD_NOT_ALLOWED
The first shepherd, shepherd 0, cannot be disabled.


Table of Contents