|
From: <cr...@us...> - 2008-04-06 06:22:50
|
Revision: 3938
http://jnode.svn.sourceforge.net/jnode/?rev=3938&view=rev
Author: crawley
Date: 2008-04-05 23:22:46 -0700 (Sat, 05 Apr 2008)
Log Message:
-----------
Tidy up the IOContext set/reset methods and add minimal javadoc
Modified Paths:
--------------
trunk/core/src/core/org/jnode/vm/VmSystem.java
Modified: trunk/core/src/core/org/jnode/vm/VmSystem.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/VmSystem.java 2008-04-06 05:51:50 UTC (rev 3937)
+++ trunk/core/src/core/org/jnode/vm/VmSystem.java 2008-04-06 06:22:46 UTC (rev 3938)
@@ -1063,8 +1063,6 @@
}
//io context related
- // private static final IOContext vmIoContext = new VmIOContext();
- // private static IOContext ioContext = vmIoContext;
public static IOContext getIOContext() {
return VmIsolate.currentIsolate().getIOContext();
@@ -1102,17 +1100,28 @@
return getIOContext().getGlobalOutStream();
}
- public static void switchToExternalIOContext(IOContext context){
- if (hasVmIOContext()){
+ /**
+ * Switch the current Isolate from the initial IOContext to an external one.
+ * If the Isolate already has an external IOContext, this is a no-op.
+ *
+ * @param context
+ */
+ public static synchronized void switchToExternalIOContext(IOContext context){
+ if (hasVmIOContext()) {
+ getIOContext().exitContext();
VmIsolate.currentIsolate().setIOContext(context);
context.enterContext();
}
}
- public static void resetIOContext(){
+ /**
+ * Reset to the current Isolate to its initial IOContext.
+ */
+ public static synchronized void resetIOContext(){
if (!hasVmIOContext()){
getIOContext().exitContext();
VmIsolate.currentIsolate().resetIOContext();
+ getIOContext().enterContext();
} else {
throw new RuntimeException("IO Context cannot be reset");
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|