aboutsummaryrefslogtreecommitdiff
path: root/libjava/gnu/java/nio/natSelectorImplWin32.cc
diff options
context:
space:
mode:
authorGary Benson <gbenson@redhat.com>2007-01-18 11:32:40 +0000
committerGary Benson <gary@gcc.gnu.org>2007-01-18 11:32:40 +0000
commit463c03f1bc2380d46a39e63efd00df157a18fee2 (patch)
treee8c12f9ab8dda0b6fb574b15c7043c09001acb33 /libjava/gnu/java/nio/natSelectorImplWin32.cc
parent3253eafbda8e4af9522ecb9316bd8a2b1c853888 (diff)
downloadgcc-463c03f1bc2380d46a39e63efd00df157a18fee2.zip
gcc-463c03f1bc2380d46a39e63efd00df157a18fee2.tar.gz
gcc-463c03f1bc2380d46a39e63efd00df157a18fee2.tar.bz2
natVMPipeEcos.cc: Renamed from gnu/java/nio/natPipeImplEcos.cc.
2007-01-18 Gary Benson <gbenson@redhat.com> * gnu/java/nio/natVMPipeEcos.cc: Renamed from gnu/java/nio/natPipeImplEcos.cc. * gnu/java/nio/natVMPipePosix.cc: Renamed from gnu/java/nio/natPipeImplPosix.cc. * gnu/java/nio/natVMPipeWin32.cc: Renamed from gnu/java/nio/natPipeImplWin32.cc. * gnu/java/nio/natVMSelectorEcos.cc: Renamed from gnu/java/nio/natSelectorImplEcos.cc. * gnu/java/nio/natVMSelectorPosix.cc: Renamed from gnu/java/nio/natSelectorImplPosix.cc. * gnu/java/nio/natVMSelectorWin32.cc: Renamed from gnu/java/nio/natSelectorImplWin32.cc. * java/io/natVMObjectInputStream.cc: Renamed from java/io/natObjectInputStream.cc. * java/lang/natVMDouble.cc: Renamed from java/lang/natDouble.cc. * java/lang/natVMFloat.cc: Renamed from java/lang/natFloat.cc. * Makefile.am, configure.ac: Reflect the above. * Makefile.in, configure: Rebuilt. From-SVN: r120895
Diffstat (limited to 'libjava/gnu/java/nio/natSelectorImplWin32.cc')
-rw-r--r--libjava/gnu/java/nio/natSelectorImplWin32.cc93
1 files changed, 0 insertions, 93 deletions
diff --git a/libjava/gnu/java/nio/natSelectorImplWin32.cc b/libjava/gnu/java/nio/natSelectorImplWin32.cc
deleted file mode 100644
index 860f654..0000000
--- a/libjava/gnu/java/nio/natSelectorImplWin32.cc
+++ /dev/null
@@ -1,93 +0,0 @@
-// natSelectorImplWin32.cc
-
-/* Copyright (C) 2003, 2004 Free Software Foundation
-
- This file is part of libgcj.
-
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
-
-#include <config.h>
-#include <platform.h>
-
-#include <gnu/java/nio/VMSelector.h>
-#include <java/lang/Thread.h>
-
-jint
-gnu::java::nio::VMSelector::select (jintArray read, jintArray write,
- jintArray except, jlong timeout)
-{
- // FIXME: The API for implSelect is biased towards POSIX implementations.
- jint* pReadFD = elements (read);
- int nNbReadFDs = JvGetArrayLength (read);
-
- jint* pWriteFD = elements (write);
- int nNbWriteFDs = JvGetArrayLength (write);
-
- int nNbEvents = nNbReadFDs + nNbWriteFDs;
-
- // Create and initialize our event wrapper array
-
- // FIXME: We're creating fresh WSAEVENTs for each call.
- // This is inefficient. It would probably be better to cache these
- // in the Win32 socket implementation class.
- WSAEventWrapper aArray[nNbEvents];
-
- int nCurIndex = 0;
- for (int i=0; i < nNbReadFDs; ++i)
- aArray[nCurIndex++].init(pReadFD[i], FD_ACCEPT | FD_READ);
-
- for (int i=0; i < nNbWriteFDs; ++i)
- aArray[nCurIndex++].init(pWriteFD[i], FD_WRITE);
-
- // Build our array of WSAEVENTs to wait on. Also throw in our thread's
- // interrupt event in order to detect thread interruption.
- HANDLE arh[nNbEvents + 1];
- for (int i=0; i < nNbEvents; ++i)
- arh[i] = aArray[i].getEventHandle();
- arh[nNbEvents] = _Jv_Win32GetInterruptEvent ();
-
- // A timeout value of 0 needs to be treated as infinite.
- if (timeout <= 0)
- timeout = WSA_INFINITE;
-
- // Do the select.
- DWORD dwRet = WSAWaitForMultipleEvents (nNbEvents+1, arh, 0, timeout, false);
-
- if (dwRet == WSA_WAIT_FAILED)
- _Jv_ThrowIOException ();
-
- // Before we do anything else, clear output file descriptor arrays.
- memset(pReadFD, 0, sizeof(jint) * nNbReadFDs);
- memset(pWriteFD, 0, sizeof(jint) * nNbWriteFDs);
- memset(elements (except), 0, sizeof(jint) * JvGetArrayLength (except));
-
- if (dwRet == DWORD(WSA_WAIT_EVENT_0 + nNbEvents))
- {
- // We were interrupted. Set the current thread's interrupt
- // status and get out of here, with nothing selected..
- ::java::lang::Thread::currentThread ()->interrupt ();
- return 0;
- }
- else if (dwRet < DWORD(WSA_WAIT_EVENT_0 + nNbEvents))
- {
- int nSelectedEventIndex = dwRet - WSA_WAIT_EVENT_0;
-
- // Record the selected file descriptor.
- // FIXME: This implementation only allows one file descriptor
- // to be selected at a time. Remedy this by looping on
- // WSAWaitForMultipleEvents 'til nothing more is selected.
- jint fd = aArray[nSelectedEventIndex].getFD();
- if (nSelectedEventIndex < nNbReadFDs)
- pReadFD[0] = fd;
- else
- pWriteFD[0] = fd;
-
- return 1;
- }
- else
- // None of the event objects was signalled, so nothing was
- // selected.
- return 0;
-}