Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #392, Make OS_STREAM_STATE available with APIs #393

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions src/os/inc/osapi-os-core.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,21 @@ typedef struct
uint8 object_ids[(OS_MAX_NUM_OPEN_FILES + 7) / 8];
} OS_FdSet;

/**
* @brief For the OS_SelectSingle() function's in/out StateFlags parameter,
* the state(s) of the stream and the result of the select is a combination
* of one or more of these states.
*
* @sa OS_SelectSingle()
*/
typedef enum
{
OS_STREAM_STATE_BOUND = 0x01, /**< @brief whether the stream is bound */
OS_STREAM_STATE_CONNECTED = 0x02, /**< @brief whether the stream is connected */
OS_STREAM_STATE_READABLE = 0x04, /**< @brief whether the stream is readable */
OS_STREAM_STATE_WRITABLE = 0x08, /**< @brief whether the stream is writable */
} OS_StreamState_t;

/**
* @brief For the @ref OS_GetErrorName() function, to ensure
* everyone is making an array of the same length.
Expand Down Expand Up @@ -1409,9 +1424,9 @@ int32 OS_SelectMultiple(OS_FdSet *ReadSet, OS_FdSet *WriteSet, int32 msecs);
*
* This function can be used to wait for a single OSAL stream ID
* to become readable or writable. On entry, the "StateFlags"
* parameter should be set to the desired state (readble or writable)
* and upon return the flags will be set to the state actually
* detected.
* parameter should be set to the desired state (OS_STREAM_STATE_READABLE
* and/or OS_STREAM_STATE_WRITABLE) and upon return the flags
* will be set to the state actually detected.
*
* As this operates on a single ID, the filehandle is protected
* during this call, such that another thread accessing the same
Expand Down
8 changes: 0 additions & 8 deletions src/os/shared/os-impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,6 @@ typedef struct
uint16 flags;
}OS_common_record_t;

typedef enum
{
OS_STREAM_STATE_BOUND = 0x01,
OS_STREAM_STATE_CONNECTED = 0x02,
OS_STREAM_STATE_READABLE = 0x04,
OS_STREAM_STATE_WRITABLE = 0x08,
} OS_StreamState_t;

/*tasks */
typedef struct
{
Expand Down