Subversion Repositories HelenOS-historic

Rev

Rev 1128 | Rev 1392 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1128 Rev 1129
Line 29... Line 29...
29
#ifndef __LIBC__PSTHREAD_H__
29
#ifndef __LIBC__PSTHREAD_H__
30
#define __LIBC__PSTHREAD_H__
30
#define __LIBC__PSTHREAD_H__
31
 
31
 
32
#include <libarch/psthread.h>
32
#include <libarch/psthread.h>
33
#include <libadt/list.h>
33
#include <libadt/list.h>
-
 
34
#include <libarch/thread.h>
34
 
35
 
35
#ifndef context_set
36
#ifndef context_set
36
#define context_set(c, _pc, stack, size, ptls)          \
37
#define context_set(c, _pc, stack, size, ptls)          \
37
    (c)->pc = (sysarg_t) (_pc);             \
38
    (c)->pc = (sysarg_t) (_pc);             \
38
    (c)->sp = ((sysarg_t) (stack)) + (size) - SP_DELTA;     \
39
    (c)->sp = ((sysarg_t) (stack)) + (size) - SP_DELTA;     \
Line 40... Line 41...
40
#endif /* context_set */
41
#endif /* context_set */
41
 
42
 
42
typedef sysarg_t pstid_t;
43
typedef sysarg_t pstid_t;
43
 
44
 
44
struct psthread_data {
45
struct psthread_data {
45
    struct psthread_data *self; /* ia32, amd64 needs to get self address */
-
 
46
 
-
 
47
    link_t link;
46
    link_t link;
48
    context_t ctx;
47
    context_t ctx;
49
    void *stack;
48
    void *stack;
50
    void *arg;
49
    void *arg;
51
    int (*func)(void *);
50
    int (*func)(void *);
-
 
51
    tcb_t *tcb;
52
 
52
 
53
    struct psthread_data *waiter;
53
    struct psthread_data *waiter;
54
    int finished;
54
    int finished;
55
    int retval;
55
    int retval;
56
    int flags;
56
    int flags;
Line 61... Line 61...
61
extern void context_restore(context_t *c) __attribute__ ((noreturn));
61
extern void context_restore(context_t *c) __attribute__ ((noreturn));
62
 
62
 
63
pstid_t psthread_create(int (*func)(void *), void *arg);
63
pstid_t psthread_create(int (*func)(void *), void *arg);
64
int psthread_schedule_next(void);
64
int psthread_schedule_next(void);
65
int psthread_join(pstid_t psthrid);
65
int psthread_join(pstid_t psthrid);
-
 
66
psthread_data_t * psthread_setup(tcb_t *tcb);
-
 
67
void psthread_teardown(psthread_data_t *pt);
-
 
68
 
66
 
69
 
67
#endif
70
#endif