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

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

Issue 1783623005: Add mojo/c/system/{time.h,wait.h}. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « mojo/public/c/system/functions.h ('k') | mojo/public/c/system/tests/core_perftest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file contains the handle-related definitions/declarations. 5 // This file contains Mojo system handle-related declarations/definitions.
6 // 6 //
7 // Note: This header should be compilable as C. 7 // Note: This header should be compilable as C.
8 8
9 #ifndef MOJO_PUBLIC_C_SYSTEM_HANDLE_H_ 9 #ifndef MOJO_PUBLIC_C_SYSTEM_HANDLE_H_
10 #define MOJO_PUBLIC_C_SYSTEM_HANDLE_H_ 10 #define MOJO_PUBLIC_C_SYSTEM_HANDLE_H_
11 11
12 #include <stdint.h> 12 #include <stdint.h>
13 13
14 #include "mojo/public/c/system/macros.h" 14 #include "mojo/public/c/system/macros.h"
15 #include "mojo/public/c/system/result.h"
15 16
16 // |MojoHandle|: Handles to Mojo objects. 17 // |MojoHandle|: Handles to Mojo objects.
17 // |MOJO_HANDLE_INVALID| - A value that is never a valid handle. 18 // |MOJO_HANDLE_INVALID| - A value that is never a valid handle.
18 19
19 typedef uint32_t MojoHandle; 20 typedef uint32_t MojoHandle;
20 21
21 #define MOJO_HANDLE_INVALID ((MojoHandle)0) 22 #define MOJO_HANDLE_INVALID ((MojoHandle)0)
22 23
23 // |MojoHandleSignals|: Used to specify signals that can be waited on for a 24 // |MojoHandleSignals|: Used to specify signals that can be waited on for a
24 // handle (and which can be triggered), e.g., the ability to read or write to 25 // handle (and which can be triggered), e.g., the ability to read or write to
(...skipping 22 matching lines...) Expand all
47 // Note: This struct is not extensible (and only has 32-bit quantities), so it's 48 // Note: This struct is not extensible (and only has 32-bit quantities), so it's
48 // 32-bit-aligned. 49 // 32-bit-aligned.
49 MOJO_STATIC_ASSERT(MOJO_ALIGNOF(uint32_t) == 4, "uint32_t has weird alignment"); 50 MOJO_STATIC_ASSERT(MOJO_ALIGNOF(uint32_t) == 4, "uint32_t has weird alignment");
50 struct MOJO_ALIGNAS(4) MojoHandleSignalsState { 51 struct MOJO_ALIGNAS(4) MojoHandleSignalsState {
51 MojoHandleSignals satisfied_signals; 52 MojoHandleSignals satisfied_signals;
52 MojoHandleSignals satisfiable_signals; 53 MojoHandleSignals satisfiable_signals;
53 }; 54 };
54 MOJO_STATIC_ASSERT(sizeof(MojoHandleSignalsState) == 8, 55 MOJO_STATIC_ASSERT(sizeof(MojoHandleSignalsState) == 8,
55 "MojoHandleSignalsState has wrong size"); 56 "MojoHandleSignalsState has wrong size");
56 57
58 #ifdef __cplusplus
jamesr 2016/03/11 18:36:42 maybe this should go in macros.h - i forsee it bei
viettrungluu 2016/03/11 20:38:31 Will think about doing so (separately).
59 extern "C" {
60 #endif
61
62 // Closes the given |handle|.
63 //
64 // Returns:
65 // |MOJO_RESULT_OK| on success.
66 // |MOJO_RESULT_INVALID_ARGUMENT| if |handle| is not a valid handle.
67 //
68 // Concurrent operations on |handle| may succeed (or fail as usual) if they
69 // happen before the close, be cancelled with result |MOJO_RESULT_CANCELLED| if
70 // they properly overlap (this is likely the case with |MojoWait()|, etc.), or
71 // fail with |MOJO_RESULT_INVALID_ARGUMENT| if they happen after.
72 MojoResult MojoClose(MojoHandle handle);
73
74 #ifdef __cplusplus
75 } // extern "C"
76 #endif
77
57 #endif // MOJO_PUBLIC_C_SYSTEM_HANDLE_H_ 78 #endif // MOJO_PUBLIC_C_SYSTEM_HANDLE_H_
OLDNEW
« no previous file with comments | « mojo/public/c/system/functions.h ('k') | mojo/public/c/system/tests/core_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698