OSDN Git Service

* path.cc (conv_path_list): Take cygwin_conv_path_t as third parameter.
[pf3gnuchains/pf3gnuchains4x.git] / winsup / cygwin / select.h
1 /* select.h
2
3    Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4    2005, 2006, 2007, 2008, 2009, 2010 Red Hat, Inc.
5
6 This file is part of Cygwin.
7
8 This software is a copyrighted work licensed under the terms of the
9 Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
10 details. */
11
12 #ifndef _SELECT_H_
13 #define _SELECT_H_
14
15 struct select_record
16 {
17   int fd;
18   HANDLE h;
19   fhandler_base *fh;
20   int thread_errno;
21   bool windows_handle;
22   bool read_ready, write_ready, except_ready;
23   bool read_selected, write_selected, except_selected;
24   bool except_on_write;
25   int (*startup) (select_record *me, class select_stuff *stuff);
26   int (*peek) (select_record *, bool);
27   int (*verify) (select_record *me, fd_set *readfds, fd_set *writefds,
28                  fd_set *exceptfds);
29   void (*cleanup) (select_record *me, class select_stuff *stuff);
30   struct select_record *next;
31   void set_select_errno () {__seterrno (); thread_errno = errno;}
32   int saw_error () {return thread_errno;}
33   select_record () {}
34   select_record (int): fd (0), h (NULL), fh (NULL), thread_errno (0),
35     windows_handle (false), read_ready (false), write_ready (false),
36     except_ready (false), read_selected (false), write_selected (false),
37     except_selected (false), except_on_write (false),
38     startup (NULL), peek (NULL), verify (NULL), cleanup (NULL),
39     next (NULL) {}
40 };
41
42 struct select_info
43 {
44   cygthread *thread;
45   bool stop_thread;
46   select_record *start;
47   select_info () {}
48 };
49
50 struct select_pipe_info: public select_info
51 {
52 };
53
54 struct select_socket_info: public select_info
55 {
56   int num_w4;
57   LONG *ser_num;
58   HANDLE *w4;
59 };
60
61 struct select_serial_info: public select_info
62 {
63 };
64
65 struct select_mailslot_info: public select_info
66 {
67 };
68
69 class select_stuff
70 {
71 public:
72   ~select_stuff ();
73   bool always_ready, windows_used;
74   select_record start;
75
76   select_pipe_info *device_specific_pipe;
77   select_socket_info *device_specific_socket;
78   select_serial_info *device_specific_serial;
79   select_mailslot_info *device_specific_mailslot;
80
81   bool test_and_set (int i, fd_set *readfds, fd_set *writefds,
82                      fd_set *exceptfds);
83   int poll (fd_set *readfds, fd_set *writefds, fd_set *exceptfds);
84   int wait (fd_set *readfds, fd_set *writefds, fd_set *exceptfds, DWORD ms);
85   void cleanup ();
86   void destroy ();
87   select_stuff (): always_ready (0), windows_used (0), start (0),
88                    device_specific_pipe (0),
89                    device_specific_socket (0),
90                    device_specific_serial (0),
91                    device_specific_mailslot (0) {}
92 };
93 #endif /* _SELECT_H_ */