OpenCores
URL https://opencores.org/ocsvn/c0or1k/c0or1k/trunk

Subversion Repositories c0or1k

[/] [c0or1k/] [trunk/] [conts/] [libl4/] [include/] [l4lib/] [lib/] [thread.h] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 drasko
#ifndef __THREAD_H__
2
#define __THREAD_H__
3
 
4
#include <l4lib/macros.h>
5
#include L4LIB_INC_ARCH(syslib.h)
6
#include L4LIB_INC_ARCH(syscalls.h)
7
#include <l4lib/exregs.h>
8
#include <l4lib/mutex.h>
9
#include <l4/api/thread.h>
10
#include <l4/lib/list.h>
11
 
12
/*
13
 * Library specific-flags for thread creation
14
 */
15
#define TC_USER_FLAGS_MASK      0x000F0000
16
#define TC_NOSTART              0x00010000
17
 
18
/* For same space */
19
#define STACK_SIZE                      PAGE_SIZE
20
 
21
/* Total threads the library supports */
22
#define THREADS_TOTAL                   10
23
 
24
/*
25
 * Keeps track of threads in the system
26
 * created by the pager
27
 */
28
struct l4_thread_list {
29
        int total;               /* Total number of threads */
30
        struct l4_mutex lock;    /* Threads list lock */
31
        struct link thread_list; /* Threads list */
32
        struct mem_cache *thread_cache; /* Cache for thread structures */
33
};
34
 
35
struct l4_thread {
36
        struct task_ids ids;            /* Thread ids */
37
        struct l4_mutex lock;           /* Lock for thread struct */
38
        struct link list;               /* Link to list of threads */
39
        unsigned long *stack;           /* Stack (grows downwards) */
40
        struct utcb *utcb;              /* UTCB address */
41
};
42
 
43
/*
44
 * These are thread calls that are meant to be
45
 * called by library users
46
 */
47
int thread_create(int (*func)(void *), void *args, unsigned int flags,
48
                  struct l4_thread **tptr);
49
int thread_wait(struct l4_thread *t);
50
void thread_exit(int exitcode);
51
 
52
/*
53
 * This is to be called only if to-be-destroyed thread is in
54
 * sane condition for destruction
55
 */
56
int thread_destroy(struct l4_thread *thread);
57
 
58
/* Library init function called by __container_init */
59
void __l4_threadlib_init(void);
60
void l4_parent_thread_init(void);
61
extern struct mem_cache *utcb_cache, *stack_cache;
62
extern struct l4_thread_list l4_thread_list;
63
extern void setup_new_thread(void);
64
 
65
#endif /* __THREAD_H__ */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.