src/server/systhr.h

changeset 1
3c066d52342d
child 9
30e51941a673
equal deleted inserted replaced
0:4c89c7683fb6 1:3c066d52342d
1 /*
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 *
4 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
5 *
6 * THE BSD LICENSE
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are met:
10 *
11 * Redistributions of source code must retain the above copyright notice, this
12 * list of conditions and the following disclaimer.
13 * Redistributions in binary form must reproduce the above copyright notice,
14 * this list of conditions and the following disclaimer in the documentation
15 * and/or other materials provided with the distribution.
16 *
17 * Neither the name of the nor the names of its contributors may be
18 * used to endorse or promote products derived from this software without
19 * specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
25 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
28 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
30 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
31 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */
33
34 #ifndef BASE_SYSTHR_H
35 #define BASE_SYSTHR_H
36
37 #ifndef NOINTNSAPI
38 #define INTNSAPI
39 #endif /* !NOINTNSAPI */
40
41 /*
42 * systhr.h: Abstracted threading mechanisms
43 *
44 * Rob McCool
45 */
46
47 #ifndef NETSITE_H
48 #include "netsite.h"
49 #include "nsapi.h"
50 #include "nspr.h"
51 #endif /* !NETSITE_H */
52
53 #define THREAD_ANY
54 #ifdef THREAD_ANY
55
56 /* --- Begin function prototypes --- */
57
58 #define INTNSAPI
59 #ifdef INTNSAPI
60
61 NSPR_BEGIN_EXTERN_C
62
63 typedef void (*thrstartfunc)(void *);
64 NSAPI_PUBLIC
65 SYS_THREAD INTsysthread_start(int prio, int stksz, thrstartfunc fn, void *arg);
66
67 NSAPI_PUBLIC SYS_THREAD INTsysthread_current(void);
68
69 NSAPI_PUBLIC void INTsysthread_yield(void);
70
71 NSAPI_PUBLIC SYS_THREAD INTsysthread_attach(void);
72
73 NSAPI_PUBLIC void INTsysthread_detach(SYS_THREAD thr);
74
75 NSAPI_PUBLIC void INTsysthread_terminate(SYS_THREAD thr);
76
77 NSAPI_PUBLIC void INTsysthread_sleep(int milliseconds);
78
79 NSAPI_PUBLIC void INTsysthread_init(char *name);
80
81 NSAPI_PUBLIC void INTsysthread_timerset(int usec);
82
83 NSAPI_PUBLIC int INTsysthread_newkey(void);
84
85 NSAPI_PUBLIC void *INTsysthread_getdata(int key);
86
87 NSAPI_PUBLIC void INTsysthread_setdata(int key, void *data);
88
89 NSAPI_PUBLIC
90 void INTsysthread_set_default_stacksize(unsigned long size);
91
92 NSPR_END_EXTERN_C
93
94 /* --- End function prototypes --- */
95
96 #define systhread_start INTsysthread_start
97 #define systhread_current INTsysthread_current
98 #define systhread_yield INTsysthread_yield
99 #define systhread_attach INTsysthread_attach
100 #define systhread_detach INTsysthread_detach
101 #define systhread_terminate INTsysthread_terminate
102 #define systhread_sleep INTsysthread_sleep
103 #define systhread_init INTsysthread_init
104 #define systhread_timerset INTsysthread_timerset
105 #define systhread_newkey INTsysthread_newkey
106 #define systhread_getdata INTsysthread_getdata
107 #define systhread_setdata INTsysthread_setdata
108 #define systhread_set_default_stacksize INTsysthread_set_default_stacksize
109
110 #endif /* INTNSAPI */
111
112 #endif /* THREAD_ANY */
113
114 #endif /* !BASE_SYSTHR_H */

mercurial