Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(421)

Side by Side Diff: mojo/public/c/system/functions.h

Issue 293383007: Mojo: Move common/basic functions declarations from mojo/public/c/system/core.h to .../functions.h. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « mojo/public/c/system/core.h ('k') | mojo/public/c/system/types.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // This file contains basic functions common to different Mojo system APIs.
6 //
7 // Note: This header should be compilable as C.
8
9 #ifndef MOJO_PUBLIC_C_SYSTEM_FUNCTIONS_H_
10 #define MOJO_PUBLIC_C_SYSTEM_FUNCTIONS_H_
11
12 // Note: This header should be compilable as C.
13
14 #include "mojo/public/c/system/system_export.h"
15 #include "mojo/public/c/system/types.h"
16
17 // Note: Pointer parameters that are labelled "optional" may be null (at least
18 // under some circumstances). Non-const pointer parameters are also labeled
19 // "in", "out", or "in/out", to indicate how they are used. (Note that how/if
20 // such a parameter is used may depend on other parameters or the requested
21 // operation's success/failure. E.g., a separate |flags| parameter may control
22 // whether a given "in/out" parameter is used for input, output, or both.)
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28 // Platform-dependent monotonically increasing tick count representing "right
29 // now." The resolution of this clock is ~1-15ms. Resolution varies depending
30 // on hardware/operating system configuration.
31 MOJO_SYSTEM_EXPORT MojoTimeTicks MojoGetTimeTicksNow();
32
33 // Closes the given |handle|.
34 //
35 // Returns:
36 // |MOJO_RESULT_OK| on success.
37 // |MOJO_RESULT_INVALID_ARGUMENT| if |handle| is not a valid handle.
38 //
39 // Concurrent operations on |handle| may succeed (or fail as usual) if they
40 // happen before the close, be cancelled with result |MOJO_RESULT_CANCELLED| if
41 // they properly overlap (this is likely the case with |MojoWait()|, etc.), or
42 // fail with |MOJO_RESULT_INVALID_ARGUMENT| if they happen after.
43 MOJO_SYSTEM_EXPORT MojoResult MojoClose(MojoHandle handle);
44
45 // Waits on the given handle until the state indicated by |flags| is satisfied
46 // or until |deadline| has passed.
47 //
48 // Returns:
49 // |MOJO_RESULT_OK| if some flag in |flags| was satisfied (or is already
50 // satisfied).
51 // |MOJO_RESULT_INVALID_ARGUMENT| if |handle| is not a valid handle (e.g., if
52 // it has already been closed).
53 // |MOJO_RESULT_DEADLINE_EXCEEDED| if the deadline has passed without any of
54 // the flags being satisfied.
55 // |MOJO_RESULT_FAILED_PRECONDITION| if it is or becomes impossible that any
56 // flag in |flags| will ever be satisfied.
57 //
58 // If there are multiple waiters (on different threads, obviously) waiting on
59 // the same handle and flag and that flag becomes set, all waiters will be
60 // awoken.
61 MOJO_SYSTEM_EXPORT MojoResult MojoWait(MojoHandle handle,
62 MojoWaitFlags flags,
63 MojoDeadline deadline);
64
65 // Waits on |handles[0]|, ..., |handles[num_handles-1]| for at least one of them
66 // to satisfy the state indicated by |flags[0]|, ..., |flags[num_handles-1]|,
67 // respectively, or until |deadline| has passed.
68 //
69 // Returns:
70 // The index |i| (from 0 to |num_handles-1|) if |handle[i]| satisfies
71 // |flags[i]|.
72 // |MOJO_RESULT_INVALID_ARGUMENT| if some |handle[i]| is not a valid handle
73 // (e.g., if it has already been closed).
74 // |MOJO_RESULT_DEADLINE_EXCEEDED| if the deadline has passed without any of
75 // handles satisfying any of its flags.
76 // |MOJO_RESULT_FAILED_PRECONDITION| if it is or becomes impossible that SOME
77 // |handle[i]| will ever satisfy any of its flags |flags[i]|.
78 MOJO_SYSTEM_EXPORT MojoResult MojoWaitMany(const MojoHandle* handles,
79 const MojoWaitFlags* flags,
80 uint32_t num_handles,
81 MojoDeadline deadline);
82
83 #ifdef __cplusplus
84 } // extern "C"
85 #endif
86
87 #endif // MOJO_PUBLIC_C_SYSTEM_FUNCTIONS_H_
OLDNEW
« no previous file with comments | « mojo/public/c/system/core.h ('k') | mojo/public/c/system/types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698