1 | /* $Id: pipe.h 56290 2015-06-09 14:01:31Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * IPRT - Internal RTPipe header.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2010-2015 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * The contents of this file may alternatively be used under the terms
|
---|
18 | * of the Common Development and Distribution License Version 1.0
|
---|
19 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
20 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
21 | * CDDL are applicable instead of those of the GPL.
|
---|
22 | *
|
---|
23 | * You may elect to license modified versions of this file under the
|
---|
24 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
25 | */
|
---|
26 |
|
---|
27 | #ifndef ___internal_pipe_h
|
---|
28 | #define ___internal_pipe_h
|
---|
29 |
|
---|
30 | #include <iprt/pipe.h>
|
---|
31 |
|
---|
32 | RT_C_DECLS_BEGIN
|
---|
33 |
|
---|
34 | /**
|
---|
35 | * Internal RTPollSetAdd helper that returns the handle that should be added to
|
---|
36 | * the pollset.
|
---|
37 | *
|
---|
38 | * @returns Valid handle on success, INVALID_HANDLE_VALUE on failure.
|
---|
39 | * @param hPipe The pipe handle.
|
---|
40 | * @param fEvents The events we're polling for.
|
---|
41 | * @param phNative Where to put the primary handle.
|
---|
42 | */
|
---|
43 | int rtPipePollGetHandle(RTPIPE hPipe, uint32_t fEvents, PRTHCINTPTR phNative);
|
---|
44 |
|
---|
45 | /**
|
---|
46 | * Internal RTPoll helper that polls the pipe handle and, if @a fNoWait is
|
---|
47 | * clear, starts whatever actions we've got running during the poll call.
|
---|
48 | *
|
---|
49 | * @returns 0 if no pending events, actions initiated if @a fNoWait is clear.
|
---|
50 | * Event mask (in @a fEvents) and no actions if the handle is ready
|
---|
51 | * already.
|
---|
52 | * UINT32_MAX (asserted) if the pipe handle is busy in I/O or a
|
---|
53 | * different poll set.
|
---|
54 | *
|
---|
55 | * @param hPipe The pipe handle.
|
---|
56 | * @param hPollSet The poll set handle (for access checks).
|
---|
57 | * @param fEvents The events we're polling for.
|
---|
58 | * @param fFinalEntry Set if this is the final entry for this handle
|
---|
59 | * in this poll set. This can be used for dealing
|
---|
60 | * with duplicate entries.
|
---|
61 | * @param fNoWait Set if it's a zero-wait poll call. Clear if
|
---|
62 | * we'll wait for an event to occur.
|
---|
63 | */
|
---|
64 | uint32_t rtPipePollStart(RTPIPE hPipe, RTPOLLSET hPollSet, uint32_t fEvents, bool fFinalEntry, bool fNoWait);
|
---|
65 |
|
---|
66 | /**
|
---|
67 | * Called after a WaitForMultipleObjects returned in order to check for pending
|
---|
68 | * events and stop whatever actions that rtPipePollStart() initiated.
|
---|
69 | *
|
---|
70 | * @returns Event mask or 0.
|
---|
71 | *
|
---|
72 | * @param hPipe The pipe handle.
|
---|
73 | * @param fEvents The events we're polling for.
|
---|
74 | * @param fFinalEntry Set if this is the final entry for this handle
|
---|
75 | * in this poll set. This can be used for dealing
|
---|
76 | * with duplicate entries. Only keep in mind that
|
---|
77 | * this method is called in reverse order, so the
|
---|
78 | * first call will have this set (when the entire
|
---|
79 | * set was processed).
|
---|
80 | * @param fHarvestEvents Set if we should check for pending events.
|
---|
81 | */
|
---|
82 | uint32_t rtPipePollDone(RTPIPE hPipe, uint32_t fEvents, bool fFinalEntry, bool fHarvestEvents);
|
---|
83 |
|
---|
84 | RT_C_DECLS_END
|
---|
85 |
|
---|
86 | #endif
|
---|
87 |
|
---|