1 /*
2  *  @copyright
3  *  Copyright (C) 2009-2013, Intel Corporation
4  *  All rights reserved.
5  *
6  *  @copyright
7  *  Redistribution and use in source and binary forms, with or without
8  *  modification, are permitted provided that the following conditions
9  *  are met:
10  *
11  *    * Redistributions of source code must retain the above copyright
12  *      notice, this list of conditions and the following disclaimer.
13  *    * Redistributions in binary form must reproduce the above copyright
14  *      notice, this list of conditions and the following disclaimer in
15  *      the documentation and/or other materials provided with the
16  *      distribution.
17  *    * Neither the name of Intel Corporation nor the names of its
18  *      contributors may be used to endorse or promote products derived
19  *      from this software without specific prior written permission.
20  *
21  *  @copyright
22  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25  *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26  *  HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
29  *  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
30  *  AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
32  *  WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33  *  POSSIBILITY OF SUCH DAMAGE.
34  *
35  ******************************************************************************
36  *
37  * cilk_undocumented.h
38  *
39  * This file defines exported functions that are not included in the standard
40  * documentation.
41  */
42 
43 #ifndef INCLUDED_CILK_UNDOCUMENTED_H
44 #define INCLUDED_CILK_UNDOCUMENTED_H
45 
46 #include <cilk/common.h>
47 
48 #ifndef CILK_STUB
49 
50 __CILKRTS_BEGIN_EXTERN_C
51 
52 /*
53  * __cilkrts_synched
54  *
55  * Allows an application to determine if there are any outstanding children at
56  * this instant. This function will examine the current full frame to
57  * determine this. This function will return a valid result only when called
58  * within a spawn continuation, within the stack frame of the continuation
59  * itself.
60  */
61 
62 CILK_EXPORT __CILKRTS_NOTHROW
63 int __cilkrts_synched(void);
64 
65 /*
66  * __cilkrts_cilkscreen_puts
67  *
68  * Allows an application to write a string to the Cilkscreen log.
69  * The standard error stream will be flushed after the write.
70  */
71 
72 CILK_EXPORT __CILKRTS_NOTHROW
73 void __cilkrts_cilkscreen_puts(const char *);
74 
75 /*
76  * __cilkrts_get_sf
77  *
78  * A debugging aid that allows an application to get the __cilkrts_stack_frame
79  * for the current function.  Only compiled into the DLL in debug builds.
80  */
81 
82 CILK_EXPORT __CILKRTS_NOTHROW
83 void *__cilkrts_get_sf(void);
84 
85 /**
86  * Returns the size of stacks created by Cilk.
87  */
88 CILK_EXPORT __CILKRTS_NOTHROW
89 size_t __cilkrts_get_stack_size(void);
90 
91 /**
92  * Dumps runtime statistics to stderr.
93  * Undocumented API for debugging.
94  */
95 CILK_EXPORT __CILKRTS_NOTHROW
96 void __cilkrts_dump_stats(void);
97 
98 CILK_EXPORT __CILKRTS_NOTHROW
99 int __cilkrts_irml_version(void);
100 
101 struct __cilk_tbb_unwatch_thunk;
102 struct __cilk_tbb_stack_op_thunk;
103 
104 CILK_EXPORT __CILKRTS_NOTHROW
105 int __cilkrts_watch_stack(struct __cilk_tbb_unwatch_thunk *u,
106                           struct __cilk_tbb_stack_op_thunk o);
107 
108 #ifndef IN_CILK_RUNTIME
109 #ifdef _WIN32
110 /* Do not use CILK_API because __cilkrts_worker_stub must be __stdcall */
111 CILK_EXPORT unsigned __CILKRTS_NOTHROW __stdcall
112 __cilkrts_worker_stub(void *arg);
113 #else
114 /* Do not use CILK_API because __cilkrts_worker_stub have default visibility */
115 CILK_EXPORT void* __CILKRTS_NOTHROW
116 __cilkrts_worker_stub(void *arg);
117 #endif /* _WIN32 */
118 #endif /* IN_CILK_RUNTIME */
119 
120 __CILKRTS_END_EXTERN_C
121 
122 #else /* CILK_STUB */
123 
124 /* Stubs for the api functions */
125 
126 #define __cilkrts_get_stack_size() (0)
127 #define __cilkrts_synched() (1)
128 
129 #endif /* CILK_STUB */
130 
131 #endif /* INCLUDED_CILK_UNDOCUMENTED_H */
132