1 /*        $NetBSD: thread.h,v 1.3 2023/08/10 20:36:28 mrg Exp $       */
2 
3 /*-
4  * Copyright (c) 2006 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by Anon Ymous.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 #ifdef THREAD_SUPPORT
33 
34 #ifndef __THREAD_H__
35 #define __THREAD_H__
36 
37 #if 0
38 #define NDEBUG      /* disable the asserts */
39 #endif
40 
41 /*
42  * The core message control routines.  Without thread support, they
43  * live in fio.c.
44  */
45 struct message *next_message(struct message *);
46 struct message *prev_message(struct message *);
47 struct message *get_message(int);
48 int        get_msgnum(struct message *);
49 int        get_msgCount(void);
50 
51 /* These give special access to the message array needed in lex.c */
52 struct message *get_abs_message(int);
53 struct message *next_abs_message(struct message *);
54 int        get_abs_msgCount(void);
55 
56 /*
57  * Support hooks used by other modules.
58  */
59 void       thread_fix_old_links(struct message *, ptrdiff_t, int);
60 void       thread_fix_new_links(struct message *, int, int);
61 int        thread_hidden(void);
62 int        thread_depth(void);
63 int        do_recursion(void);
64 int        thread_recursion(struct message *, int (*)(struct message *, void *), void *);
65 const char *thread_next_key_name(const void **);
66 
67 /*
68  * Commands.
69  */
70 /* thread setup */
71 int        flattencmd(void *);
72 int        reversecmd(void *v);
73 int        sortcmd(void *);
74 int        threadcmd(void *);
75 int        unthreadcmd(void *);
76 
77 /* thread navigation */
78 int        downcmd(void *);
79 int        tsetcmd(void *);
80 int        upcmd(void *);
81 
82 /* thread display */
83 int        exposecmd(void *);
84 int        hidecmd(void *);
85 
86 /* tag commands */
87 int        invtagscmd(void *);
88 int        tagbelowcmd(void *);
89 int        tagcmd(void *);
90 int        untagcmd(void *);
91 
92 /* tag display */
93 int        hidetagscmd(void *);
94 int        showtagscmd(void *);
95 
96 /* something special */
97 int        deldupscmd(void *);
98 
99 #define ENAME_RECURSIVE_CMDS  "recursive-commands"
100 
101 /*
102  * Debugging stuff that should go away.
103  */
104 #define THREAD_DEBUG
105 #ifdef THREAD_DEBUG
106 int        thread_showcmd(void *);
107 #endif /* THREAD_DEBUG */
108 
109 #endif /* __THREAD_H__ */
110 #endif /* THREAD_SUPPORT */
111