forked
Embed:
(wiki syntax)
Show/hide line numbers
mbed_poll.h
00001 /* mbed Microcontroller Library 00002 * Copyright (c) 2017 ARM Limited 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 #ifndef MBED_POLL_H 00017 #define MBED_POLL_H 00018 00019 #define POLLIN 0x0001 ///< Data may be read without blocking 00020 #define POLLOUT 0x0010 ///< Data may be written without blocking 00021 #define POLLERR 0x1000 ///< An error has occurred on the device or stream 00022 #define POLLHUP 0x2000 ///< The device has been disconnected 00023 #define POLLNVAL 0x4000 ///< The specified file handle value is invalid 00024 00025 namespace mbed { 00026 00027 class FileHandle; 00028 00029 /** \addtogroup platform */ 00030 00031 00032 struct pollfh { 00033 FileHandle *fh; 00034 short events; 00035 short revents; 00036 }; 00037 00038 /** A mechanism to multiplex input/output over a set of file handles(file descriptors). 00039 * For every file handle provided, poll() examines it for any events registered for that particular 00040 * file handle. 00041 * 00042 * @param fhs an array of PollFh struct carrying a FileHandle and bitmasks of events 00043 * @param nfhs number of file handles 00044 * @param timeout timer value to timeout or -1 for loop forever 00045 * 00046 * @return number of file handles selected (for which revents is non-zero). 0 if timed out with nothing selected. -1 for error. 00047 */ 00048 int poll(pollfh fhs[], unsigned nfhs, int timeout); 00049 00050 } // namespace mbed 00051 00052 #endif //MBED_POLL_H
Generated on Tue Jul 12 2022 16:02:32 by 1.7.2