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

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

Issue 2042363003: Allow data pipe producer/consumer handles to be transferred during two-phase operations. (Closed) Base URL: https://github.com/domokit/mojo.git@work790_dp_cancel_two_phase
Patch Set: Created 4 years, 6 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/edk/system/handle_table.cc ('k') | mojo/public/c/system/handle.h » ('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 2014 The Chromium Authors. All rights reserved. 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 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 types/constants and functions specific to data pipes. 5 // This file contains types/constants and functions specific to data pipes.
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_DATA_PIPE_H_ 9 #ifndef MOJO_PUBLIC_C_SYSTEM_DATA_PIPE_H_
10 #define MOJO_PUBLIC_C_SYSTEM_DATA_PIPE_H_ 10 #define MOJO_PUBLIC_C_SYSTEM_DATA_PIPE_H_
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 // During a two-phase write, |data_pipe_producer_handle| is *not* writable. 259 // During a two-phase write, |data_pipe_producer_handle| is *not* writable.
260 // E.g., if another thread tries to write to it, it will get |MOJO_RESULT_BUSY|; 260 // E.g., if another thread tries to write to it, it will get |MOJO_RESULT_BUSY|;
261 // that thread can then wait for |data_pipe_producer_handle| to become writable 261 // that thread can then wait for |data_pipe_producer_handle| to become writable
262 // again. 262 // again.
263 // 263 //
264 // When |MojoBeginWriteData()| returns |MOJO_RESULT_OK|, and the caller has 264 // When |MojoBeginWriteData()| returns |MOJO_RESULT_OK|, and the caller has
265 // finished writing data to |*buffer|, it should call |MojoEndWriteData()| to 265 // finished writing data to |*buffer|, it should call |MojoEndWriteData()| to
266 // specify the amount written and to complete the two-phase write. 266 // specify the amount written and to complete the two-phase write.
267 // |MojoEndWriteData()| need not be called for other return values. 267 // |MojoEndWriteData()| need not be called for other return values.
268 // 268 //
269 // Note: After a successful |MojoBeginWriteData()| on a given handle and before
270 // a corresponding |MojoEndWriteData()|, any operation that invalidates the
271 // handle (such as closing the handle, replacing the handle with one with
272 // reduced rights, or transferring the handle over a message pipe) will abort
273 // the two-phase write. That is, the behavior is equivalent to ending the
274 // two-phase write with no data written. That operation will also invalidate the
275 // buffer pointer: the behavior if data continues to be written to the buffer is
276 // undefined.
277 //
269 // Returns: 278 // Returns:
270 // |MOJO_RESULT_OK| on success. 279 // |MOJO_RESULT_OK| on success.
271 // |MOJO_RESULT_INVALID_ARGUMENT| if some argument was invalid (e.g., 280 // |MOJO_RESULT_INVALID_ARGUMENT| if some argument was invalid (e.g.,
272 // |data_pipe_producer_handle| is not a handle to a data pipe producer or 281 // |data_pipe_producer_handle| is not a handle to a data pipe producer or
273 // flags has |MOJO_WRITE_DATA_FLAG_ALL_OR_NONE| set). 282 // flags has |MOJO_WRITE_DATA_FLAG_ALL_OR_NONE| set).
274 // |MOJO_RESULT_PERMISSION_DENIED| if |data_pipe_producer_handle| does not 283 // |MOJO_RESULT_PERMISSION_DENIED| if |data_pipe_producer_handle| does not
275 // have the |MOJO_HANDLE_RIGHT_WRITE| right. 284 // have the |MOJO_HANDLE_RIGHT_WRITE| right.
276 // |MOJO_RESULT_FAILED_PRECONDITION| if the data pipe consumer handle has been 285 // |MOJO_RESULT_FAILED_PRECONDITION| if the data pipe consumer handle has been
277 // closed. 286 // closed.
278 // |MOJO_RESULT_BUSY| if |data_pipe_producer_handle| is currently in use in 287 // |MOJO_RESULT_BUSY| if |data_pipe_producer_handle| is currently in use in
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 // 442 //
434 // During a two-phase read, |data_pipe_consumer_handle| is *not* readable. 443 // During a two-phase read, |data_pipe_consumer_handle| is *not* readable.
435 // E.g., if another thread tries to read from it, it will get 444 // E.g., if another thread tries to read from it, it will get
436 // |MOJO_RESULT_BUSY|; that thread can then wait for |data_pipe_consumer_handle| 445 // |MOJO_RESULT_BUSY|; that thread can then wait for |data_pipe_consumer_handle|
437 // to become readable again. 446 // to become readable again.
438 // 447 //
439 // Once the caller has finished reading data from |*buffer|, it should call 448 // Once the caller has finished reading data from |*buffer|, it should call
440 // |MojoEndReadData()| to specify the amount read and to complete the two-phase 449 // |MojoEndReadData()| to specify the amount read and to complete the two-phase
441 // read. 450 // read.
442 // 451 //
452 // Note: After a successful |MojoBeginReadData()| on a given handle and before a
453 // corresponding |MojoEndReadData()|, any operation that invalidates the handle
454 // (such as closing the handle, replacing the handle with one with reduced
455 // rights, or transferring the handle over a message pipe) will abort the
456 // two-phase read. That is, the behavior is equivalent to ending the two-phase
457 // read with no data consumed. That operation will also invalidate the buffer
458 // pointer: the behavior if data continues to be read from the buffer is
459 // undefined.
460 //
443 // Returns: 461 // Returns:
444 // |MOJO_RESULT_OK| on success. 462 // |MOJO_RESULT_OK| on success.
445 // |MOJO_RESULT_INVALID_ARGUMENT| if some argument was invalid (e.g., 463 // |MOJO_RESULT_INVALID_ARGUMENT| if some argument was invalid (e.g.,
446 // |data_pipe_consumer_handle| is not a handle to a data pipe consumer, 464 // |data_pipe_consumer_handle| is not a handle to a data pipe consumer,
447 // or |flags| has invalid flags set). 465 // or |flags| has invalid flags set).
448 // |MOJO_RESULT_PERMISSION_DENIED| if |data_pipe_consumer_handle| does not 466 // |MOJO_RESULT_PERMISSION_DENIED| if |data_pipe_consumer_handle| does not
449 // have the |MOJO_HANDLE_RIGHT_READ| right. 467 // have the |MOJO_HANDLE_RIGHT_READ| right.
450 // |MOJO_RESULT_FAILED_PRECONDITION| if the data pipe producer handle has been 468 // |MOJO_RESULT_FAILED_PRECONDITION| if the data pipe producer handle has been
451 // closed. 469 // closed.
452 // |MOJO_RESULT_BUSY| if |data_pipe_consumer_handle| is currently in use in 470 // |MOJO_RESULT_BUSY| if |data_pipe_consumer_handle| is currently in use in
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 // |MojoEndReadData()| has already been called). 502 // |MojoEndReadData()| has already been called).
485 // |MOJO_RESULT_BUSY| if |data_pipe_consumer_handle| is currently in use in 503 // |MOJO_RESULT_BUSY| if |data_pipe_consumer_handle| is currently in use in
486 // some transaction (that, e.g., may result in it being invalidated, such 504 // some transaction (that, e.g., may result in it being invalidated, such
487 // as being sent in a message). 505 // as being sent in a message).
488 MojoResult MojoEndReadData(MojoHandle data_pipe_consumer_handle, // In. 506 MojoResult MojoEndReadData(MojoHandle data_pipe_consumer_handle, // In.
489 uint32_t num_bytes_read); // In. 507 uint32_t num_bytes_read); // In.
490 508
491 MOJO_END_EXTERN_C 509 MOJO_END_EXTERN_C
492 510
493 #endif // MOJO_PUBLIC_C_SYSTEM_DATA_PIPE_H_ 511 #endif // MOJO_PUBLIC_C_SYSTEM_DATA_PIPE_H_
OLDNEW
« no previous file with comments | « mojo/edk/system/handle_table.cc ('k') | mojo/public/c/system/handle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698