Mbed OS Reference
Loading...
Searching...
No Matches
mbed_poll.h
1
/* mbed Microcontroller Library
2
* Copyright (c) 2017-2019 ARM Limited
3
* SPDX-License-Identifier: Apache-2.0
4
*
5
* Licensed under the Apache License, Version 2.0 (the "License");
6
* you may not use this file except in compliance with the License.
7
* You may obtain a copy of the License at
8
*
9
* http://www.apache.org/licenses/LICENSE-2.0
10
*
11
* Unless required by applicable law or agreed to in writing, software
12
* distributed under the License is distributed on an "AS IS" BASIS,
13
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
* See the License for the specific language governing permissions and
15
* limitations under the License.
16
*/
17
#ifndef MBED_POLL_H
18
#define MBED_POLL_H
19
20
#define POLLIN 0x0001
///< Data may be read without blocking
21
#define POLLOUT 0x0010
///< Data may be written without blocking
22
#define POLLERR 0x1000
///< An error has occurred on the device or stream
23
#define POLLHUP 0x2000
///< The device has been disconnected
24
#define POLLNVAL 0x4000
///< The specified file handle value is invalid
25
26
namespace
mbed {
27
28
class
FileHandle;
29
30
/** \addtogroup platform-public-api */
31
/** @{*/
32
33
/**
34
* \defgroup platform_poll poll functions
35
* @{
36
*/
37
38
struct
pollfh
{
39
FileHandle
*fh;
40
short
events;
41
short
revents;
42
};
43
44
/** A mechanism to multiplex input/output over a set of file handles(file descriptors).
45
* For every file handle provided, poll() examines it for any events registered for that particular
46
* file handle.
47
*
48
* @param fhs an array of PollFh struct carrying a FileHandle and bitmasks of events
49
* @param nfhs number of file handles
50
* @param timeout timer value to timeout or -1 for loop forever
51
*
52
* @return number of file handles selected (for which revents is non-zero). 0 if timed out with nothing selected. -1 for error.
53
*/
54
int
poll
(
pollfh
fhs[],
unsigned
nfhs,
int
timeout);
55
56
/**@}*/
57
58
/**@}*/
59
60
}
// namespace mbed
61
62
#endif
//MBED_POLL_H
mbed::FileHandle
Class FileHandle.
Definition:
FileHandle.h:46
mbed::poll
int poll(pollfh fhs[], unsigned nfhs, int timeout)
A mechanism to multiplex input/output over a set of file handles(file descriptors).
mbed::pollfh
Definition:
mbed_poll.h:38
platform
include
platform
mbed_poll.h
Generated by
1.9.5