1 2 3 4 5 6 7 8 9 10 11 12
13 14 15
16
17 package xdc.runtime;
18
19 /*!
20 * ======== Main ========
21 * Configuration "stand-in" for application code.
22 *
23 * This module is used to enable "module" configuration of application code
24 * that is not part of a module. Configuration of this `Main` module is
25 * used for all code not in a module.
26 *
27 * For example, an `ILogger` "service provider" for all code that is not in
28 * a RTSC module can be configured by setting this module's `logger`; when
29 * code that is not in a module calls `Log_print()`, for example, this
30 * module's `ILogger` handles the event.
31 *
32 * Since this module is "gated", the user can also assign a gate to this
33 * module for use by any code that is not in a module. This gate can be used
34 * to serialize access to global data by multiple threads in the system.
35 * @p(code)
36 * #include <xdc/runtime/Main.h>
37 * #include <xdc/runtime/Gate.h>
38 * :
39 * int global = 0;
40 * int main() {
41 * : // create a bunch of threads
42 * }
43 *
44 * void thread() {
45 * IArg key = Gate_enterModule(); // enter critical section
46 * global++; // safely update global data
47 * Gate_leaveModule(key); // leave critical section
48 * }
49 * @p
50 */
51 @Gated module Main {
52
53 };
54
55 56 57
58