1 2 3 4 5 6 7 8 9 10 11 12
13 14 15
16 import xdc.runtime.Error;
17 import xdc.runtime.Assert;
18 import xdc.runtime.knl.ISync;
19
20 /*!
21 * ======== Sync ========
22 * Provides synchronization APIs when an ISync.Handle is available.
23 *
24 * The application must first obtain an ISync.Handle.
25 * It can get such a handle by directly calling {@link SyncGeneric#create} or
26 * {@link SyncSemThread#create}. Then the application can use the generic
27 * APIs provided by this module.
28 */
29
30 module Sync
31 {
32 /*!
33 * Proxy used for optimization.
34 *
35 * If ALL ISync.Handles were created using the same module
36 * (e.g SyncSemProcess) then setting this Proxy to SyncSemProcess and
37 * setting Sync.Proxy.abstractInstances$ = false,
38 * Sync APIs can have better performance.
39 */
40 proxy Proxy inherits ISync;
41
42 /*!
43 * ======== query ========
44 * Query for a particular quality.
45 *
46 * FALSE is returned if quality not supported.
47 *
48 * @param(sync) sync handle
49 * @param(qual) quality
50 * @b(returns) TRUE or FALSE.
51 */
52 Bool query(ISync.Handle sync, Int qual);
53
54 /*!
55 * ======== signal ========
56 * Called at completion of an activity.
57 *
58 * This function is non-blocking. It is also required that the underlying
59 * sync be binary in nature.
60 *
61 * @param(sync) sync handle
62 */
63 Void signal(ISync.Handle sync);
64
65 /*!
66 * ======== wait ========
67 * Called to wait/poll for completion of an activity.
68 *
69 * This function can block. Non-blocking implementations should return
70 * false;
71 *
72 * @param(sync) sync handle
73 * @param(timeout) timeout
74 * @b(returns) 1 for success; 0 for timeout; -1 for error
75 */
76 Int wait(ISync.Handle sync, UInt timeout, Error.Block *eb);
77 }
78
79 80
81 82 83
84