Mistake on this page?
Report an issue in GitHub or email us
mbed_poll.h
1 /* mbed Microcontroller Library
2  * Copyright (c) 2017 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 */
31 /** @{*/
32 /**
33  * \defgroup platform_poll poll functions
34  * @{
35  */
36 
37 struct pollfh {
38  FileHandle *fh;
39  short events;
40  short revents;
41 };
42 
43 /** A mechanism to multiplex input/output over a set of file handles(file descriptors).
44  * For every file handle provided, poll() examines it for any events registered for that particular
45  * file handle.
46  *
47  * @param fhs an array of PollFh struct carrying a FileHandle and bitmasks of events
48  * @param nfhs number of file handles
49  * @param timeout timer value to timeout or -1 for loop forever
50  *
51  * @return number of file handles selected (for which revents is non-zero). 0 if timed out with nothing selected. -1 for error.
52  */
53 int poll(pollfh fhs[], unsigned nfhs, int timeout);
54 
55 /**@}*/
56 
57 /**@}*/
58 
59 } // namespace mbed
60 
61 #endif //MBED_POLL_H
int poll(pollfh fhs[], unsigned nfhs, int timeout)
A mechanism to multiplex input/output over a set of file handles(file descriptors).
Class FileHandle.
Definition: FileHandle.h:46
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.