ARPDAS_QNX6 1.0
|
00001 /** 00002 * \file Selectee.cc 00003 */ 00004 #include <unistd.h> 00005 #include "Selector.h" 00006 #include "nortlib.h" 00007 00008 /** 00009 * When fd and flags are known before construction. 00010 */ 00011 Selectee::Selectee(int fd_in, int flag) { 00012 flags = flag; 00013 fd = fd_in; 00014 Stor = 0; 00015 } 00016 00017 /** 00018 * When fd is opened in the constructor. 00019 */ 00020 Selectee::Selectee() { 00021 flags = 0; 00022 fd = -1; 00023 } 00024 00025 /** 00026 * Closes the fd if it is non-negative. Hence the fd value should be set to -1 00027 * if the fd is closed for any reason. And the fd should not be closed for any 00028 * reason until the event loop has terminated. This is clearly a feature that 00029 * needs updating. 00030 */ 00031 Selectee::~Selectee() { 00032 if ( fd >= 0 ) { 00033 close(fd); 00034 fd = -1; 00035 } 00036 } 00037 00038 /** 00039 * Virtual method to allow Selectee to bid on the select() timeout 00040 * along with the Selector. The minimum timeout value is used. 00041 * @return a Timeout * indicating the requested timeout value or NULL. 00042 */ 00043 Timeout *Selectee::GetTimeout() { 00044 return NULL; 00045 }