VirtualBox

Changeset 26721 in vbox for trunk/include


Ignore:
Timestamp:
Feb 23, 2010 4:48:30 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
57968
Message:

iprt/poll.h,iprt/types.h: more poll and some pipe work

Location:
trunk/include/iprt
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/poll.h

    r26703 r26721  
    4141 */
    4242
     43/** @name Poll events
     44 * @{ */
     45/** Readable without blocking. */
     46#define RTPOLL_EVT_READ     RT_BIT_32(0)
     47/** Writable without blocking. */
     48#define RTPOLL_EVT_WRITE    RT_BIT_32(1)
     49/** Error condition, hangup, exception or similar. */
     50#define RTPOLL_EVT_ERROR    RT_BIT_32(2)
     51/** @} */
     52
    4353/**
    44  * Polls on the specified poll set until timeout or one of them becomes ready.
     54 * Polls on the specified poll set until an event occures on one of the handles
     55 * or the timeout expires.
    4556 *
    4657 * @returns IPRT status code.
     
    4859 * @param   cMillies        Number of milliseconds to wait.  Use
    4960 *                          RT_INDEFINITE_WAIT to wait for ever.
    50  * @param   pHandle         Where to return the info for the read handle.
    51  * @param   pfWhy           Where to return details about why the handle is
    52  *                          considered ready.
     61 * @param   pHandle         Where to return the info about the handle.
     62 * @param   pfEvent         Where to return details about the events that
     63 *                          occured.
    5364 */
    54 RTDECL(int) RTPoll(RTPIPE hPipe, RTMSINTERVAL cMillies);
     65RTDECL(int) RTPoll(RTPIPE hPipe, RTMSINTERVAL cMillies, uint32_t *pfEvent);
    5566
    5667/**
     
    6172 * @param   cHandles        The number of initial members.
    6273 * @param   paHandles       Array with the initial members.
     74 * @param   pafEvents       Which events to poll for.  This is an array running
     75 *                          parallel to @a paHandles.  If NULL, we assume
     76 *                          RTPOLL_EVT_READ and RTPOLL_EVT_ERROR.
    6377 */
    64 RTDECL(int)  RTPollCreateSet(PRTPOLLSET hPollSet, size_t cHandles, PCRTHANDLE paHandles);
     78RTDECL(int)  RTPollSetCreate(PRTPOLLSET hPollSet, size_t cHandles, PCRTHANDLE paHandles, uint32_t const *pafEvents);
    6579
    6680/**
     
    7185 *                          ignored (VINF_SUCCESS).
    7286 */
    73 RTDECL(int)  RTPollDestroySet(RTPOLLSET hPollSet);
     87RTDECL(int)  RTPollSetDestroy(RTPOLLSET hPollSet);
    7488
    7589/**
    76  * Adds a handle to the poll set.
     90 * Adds a generic handle to the poll set.
    7791 *
    7892 * @returns IPRT status code
    7993 * @param   hPollSet        The poll set to modify.
    8094 * @param   pHandle         The handle to add.
     95 * @param   fEvents         Which events to poll for.
    8196 */
    82 RTDECL(int) RTPollAddToSet(RTPOLLSET hPollSet, PCRTHANDLE pHandle);
     97RTDECL(int) RTPollSetAdd(RTPOLLSET hPollSet, PCRTHANDLE pHandle, uint32_t fEvents);
    8398
    8499/**
    85  * Removes a handle from the poll set.
     100 * Removes a generic handle from the poll set.
    86101 *
    87102 * @returns IPRT status code
     
    89104 * @param   pHandle         The handle to remove.
    90105 */
    91 RTDECL(int) RTPollRemoveFromSet(RTPOLLSET hPollSet, PCRTHANDLE pHandle);
     106RTDECL(int) RTPollSetRemove(RTPOLLSET hPollSet, PCRTHANDLE pHandle);
     107
     108/**
     109 * Adds a pipe handle to the set.
     110 *
     111 * @returns IPRT status code.
     112 * @param   hPollSet        The poll set.
     113 * @param   hPipe           The pipe handle.
     114 * @param   fEvents         Which events to poll for.
     115 *
     116 * @todo    Maybe we could figure out what to poll for depending on the kind of
     117 *          pipe we're dealing with.
     118 */
     119DECLINLINE(int) RTPollSetAddPipe(RTPOLLSET hPollSet, RTPIPE hPipe, uint32_t fEvents)
     120{
     121    RTHANDLE Handle;
     122    Handle.enmType = RTHANDLETYPE_PIPE;
     123    Handle.u.hPipe = hPipe;
     124    return RTPollSetAdd(hPollSet, &Handle, fEvents);
     125}
     126
     127/**
     128 * Adds a socket handle to the set.
     129 *
     130 * @returns IPRT status code.
     131 * @param   hPollSet        The poll set.
     132 * @param   hSocket         The socket handle.
     133 * @param   fEvents         Which events to poll for.
     134 */
     135DECLINLINE(int) RTPollSetAddSocket(RTPOLLSET hPollSet, RTSOCKET hSocket, uint32_t fEvents)
     136{
     137    RTHANDLE Handle;
     138    Handle.enmType   = RTHANDLETYPE_SOCKET;
     139    Handle.u.hSocket = hSocket;
     140    return RTPollSetAdd(hPollSet, &Handle, fEvents);
     141}
    92142
    93143/** @} */
     
    97147#endif
    98148
    99 
    100 
  • trunk/include/iprt/types.h

    r26702 r26721  
    11561156
    11571157/** Pipe handle. */
    1158 typedef RTHCUINTPTR                                 RTPIPE;
     1158typedef R3R0PTRTYPE(struct RTPIPEINTERNAL *)        RTPIPE;
    11591159/** Pointer to a pipe handle. */
    11601160typedef RTPIPE                                     *PRTPIPE;
    11611161/** Nil pipe handle.
    1162  * @remarks This is not 0 because because of UNIX and OS/2 handle values.
    1163  *          Take care! */
     1162 * @remarks This is not 0 because of UNIX and OS/2 handle values. Take care! */
    11641163#define NIL_RTPIPE                                 (~(RTPIPE)0)
    11651164
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette