1 // src/select.hh
2 // This file is part of libpbe; see http://decimail.org
3 // (C) 2004 Philip Endecott
4 
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 #ifndef libpbe_select_hh
19 #define libpbe_select_hh
20 
21 // User-friendly wrappers around select().
22 // Take various numbers of file descriptors and an optional timeout.
23 // Naming scheme is "r" for "readable", "t" for "timeout".
24 // i.e. select_rr waits for either of two fds to be readable.
25 // The return value is the file descriptor that has become useable,
26 // i.e. select_rr(4,9) can return 4 or 9.  If the timeout expires,
27 // -1 is returned.  -2 can also be returned but I can't recall when.
28 
29 int select_r (int fd1);
30 int select_rr(int fd1, int fd2);
31 int select_rt(int fd1, float timeout);
32 
33 
34 #endif
35