Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/include/fibril.h

    rd73d992 r3b1cc8d  
    3636#define LIBC_FIBRIL_H_
    3737
     38#include <context.h>
    3839#include <types/common.h>
     40#include <adt/list.h>
     41#include <libarch/tls.h>
    3942
    40 typedef struct fibril fibril_t;
     43#define FIBRIL_WRITER   1
     44
     45struct fibril;
    4146
    4247typedef struct {
    43         fibril_t *owned_by;
     48        struct fibril *owned_by;
    4449} fibril_owner_info_t;
    4550
     51typedef enum {
     52        FIBRIL_PREEMPT,
     53        FIBRIL_TO_MANAGER,
     54        FIBRIL_FROM_MANAGER,
     55        FIBRIL_FROM_DEAD
     56} fibril_switch_type_t;
     57
    4658typedef sysarg_t fid_t;
     59
     60typedef struct fibril {
     61        link_t link;
     62        link_t all_link;
     63        context_t ctx;
     64        void *stack;
     65        void *arg;
     66        errno_t (*func)(void *);
     67        tcb_t *tcb;
     68
     69        struct fibril *clean_after_me;
     70        errno_t retval;
     71        int flags;
     72
     73        fibril_owner_info_t *waits_for;
     74} fibril_t;
    4775
    4876/** Fibril-local variable specifier */
     
    5381extern fid_t fibril_create_generic(errno_t (*func)(void *), void *arg, size_t);
    5482extern void fibril_destroy(fid_t fid);
     83extern fibril_t *fibril_setup(void);
     84extern void fibril_teardown(fibril_t *f, bool locked);
     85extern int fibril_switch(fibril_switch_type_t stype);
    5586extern void fibril_add_ready(fid_t fid);
     87extern void fibril_add_manager(fid_t fid);
     88extern void fibril_remove_manager(void);
    5689extern fid_t fibril_get_id(void);
    57 extern void fibril_yield(void);
    5890
    5991static inline fid_t fibril_create(errno_t (*func)(void *), void *arg)
     
    6294}
    6395
     96static inline int fibril_yield(void)
     97{
     98        return fibril_switch(FIBRIL_PREEMPT);
     99}
     100
    64101#endif
    65102
Note: See TracChangeset for help on using the changeset viewer.