win32.cc (WSAEventWrapper): Implemented default constructor and init() methods.

* win32.cc (WSAEventWrapper): Implemented default
	constructor and init() methods.
	(_Jv_select): Removed.
	* gnu/java/nio/natSelectorImplWin32.cc
	(helper_put_filedescriptors): Removed.
	(helper_get_filedescriptors): Removed.
	(implSelect): Implemented in terms of WSAEventWrapper
	and WSAWaitForMultipleEvents instead of _Jv_select().
	Added support for thread interruption.
	* include/win32.h (WSAEventWrapper): Minor formatting
	changes; added default constructor declaration, init(),
	getFD() and getEventHandle() methods.
	(_Jv_select): Removed.

From-SVN: r74715
This commit is contained in:
Mohan Embar
2003-12-16 22:54:22 +00:00
committed by Mohan Embar
parent 027e655b6e
commit 5cd4d463f9
4 changed files with 122 additions and 94 deletions

View File

@@ -93,25 +93,36 @@ extern jstring _Jv_Win32NewString (LPCTSTR pcsz);
/* Useful helper classes and methods. */
/* A C++ wrapper around a WSAEVENT which closes the event
in its destructor. If dwSelFlags is non-zero, we also
issue an WSAEventSelect on the socket descriptor with
the given flags; this is undone by a corresponding call
to WSAEventSelect(fd, 0, 0) in our destructor. */
in its destructor. If dwSelFlags is non-zero, we also
issue an WSAEventSelect on the socket descriptor with
the given flags; this is undone by a corresponding call
to WSAEventSelect(fd, 0, 0) in our destructor. */
class WSAEventWrapper
{
public:
WSAEventWrapper(int fd, DWORD dwSelFlags);
~WSAEventWrapper();
// Default constructor. Call init() after this.
WSAEventWrapper();
WSAEventWrapper(int fd, DWORD dwSelFlags);
~WSAEventWrapper();
WSAEVENT getEventHandle()
{
return m_hEvent;
}
// Used for two-step initialization after calling
// default constructor.
void init(int fd, DWORD dwSelFlags);
int getFD()
{
return m_fd;
}
WSAEVENT getEventHandle()
{
return m_hEvent;
}
private:
WSAEVENT m_hEvent;
int m_fd;
DWORD m_dwSelFlags;
WSAEVENT m_hEvent;
int m_fd;
DWORD m_dwSelFlags;
};
// Error string text. The int argument is compatible
@@ -141,7 +152,6 @@ _Jv_ThrowSocketException ();
extern void _Jv_platform_initialize (void);
extern void _Jv_platform_initProperties (java::util::Properties*);
extern jlong _Jv_platform_gettimeofday ();
extern int _Jv_select (int n, fd_set *, fd_set *, fd_set *, struct timeval *);
extern int _Jv_pipe (int filedes[2]);
extern void