ft_thread_link,(1)

NAME
ft_thread_link, ft_thread_unlink - link and unlink a thread

  SYNOPSIS

#include <fthread.h>
int ft_thread_unlink (void);
int ft_thread_link   (ft_scheduler_t sched);

  DESCRIPTION
ft_thread_unlink unlinks the calling thread from the scheduler which is running it. Execution of the thread suspends until the begining of the next instant of the scheduler. At that point, the thread turns into a standard thread, not linked to any scheduler, and it resumes execution autonomously. Initialy, a fair thread is automatically linked to the scheduler in which it is created (by ft_thread_create). ft_thread_link links the calling thread to the scheduler sched. The thread must be unlinked. Execution suspends until sched gives the control to the thread; then, the thread resumes execution, being scheduled by sched.

  RETURN VALUES
On success, the value 0 is returned. On error, a non-zero error code is returned.

  ERRORS

    BADCREATE
        The scheduler sched is not correctly created.

    BADLINK
        The calling thread is already linked while running ft_thread_link, or it is unlinked while running ft_thread_unlink.

    BADMEM
        Not enough memory (the scheduler cannot store the link/unlink order).

  SEE ALSO
ft_thread_create (3).

AUTHOR