This commit is contained in:
jfrijters 2005-03-17 14:27:18 +00:00
Родитель 9a62c6f197
Коммит 1f34f23be7
4 изменённых файлов: 78 добавлений и 29 удалений

Просмотреть файл

@ -141,7 +141,12 @@ public class VMSystemProperties
// TODO get this info from somewhere else
arch = "x86";
}
if(arch.equals("AMD64"))
{
arch = "amd64";
}
p.setProperty("os.arch", arch);
p.setProperty("sun.arch.data.model", "" + (cli.System.IntPtr.get_Size() * 8));
p.setProperty("file.separator", "" + cli.System.IO.Path.DirectorySeparatorChar);
p.setProperty("file.encoding", "8859_1");
p.setProperty("path.separator", "" + cli.System.IO.Path.PathSeparator);

Просмотреть файл

@ -389,7 +389,14 @@ final class VMThread
cli.System.Threading.Thread nativeThread = (cli.System.Threading.Thread)nativeThreadReference.get_Target();
if(nativeThread != null)
{
nativeThread.Suspend();
try
{
if(false) throw new cli.System.Threading.ThreadStateException();
nativeThread.Suspend();
}
catch(cli.System.Threading.ThreadStateException x)
{
}
}
}
@ -398,8 +405,15 @@ final class VMThread
cli.System.Threading.Thread nativeThread = (cli.System.Threading.Thread)nativeThreadReference.get_Target();
if(nativeThread != null)
{
nativeThread.Resume();
}
try
{
if(false) throw new cli.System.Threading.ThreadStateException();
nativeThread.Resume();
}
catch(cli.System.Threading.ThreadStateException x)
{
}
}
}
void nativeSetPriority(int priority)
@ -451,12 +465,27 @@ final class VMThread
cli.System.Threading.Thread nativeThread = (cli.System.Threading.Thread)nativeThreadReference.get_Target();
if(nativeThread != null)
{
nativeThread.Abort(t);
int suspend = cli.System.Threading.ThreadState.Suspended | cli.System.Threading.ThreadState.SuspendRequested;
if((nativeThread.get_ThreadState().Value & suspend) != 0)
{
nativeThread.Resume();
}
try
{
if(false) throw new cli.System.Threading.ThreadStateException();
nativeThread.Abort(t);
}
catch(cli.System.Threading.ThreadStateException x)
{
// .NET 2.0 throws a ThreadStateException if the target thread is currently suspended
}
try
{
if(false) throw new cli.System.Threading.ThreadStateException();
int suspend = cli.System.Threading.ThreadState.Suspended | cli.System.Threading.ThreadState.SuspendRequested;
while((nativeThread.get_ThreadState().Value & suspend) != 0)
{
nativeThread.Resume();
}
}
catch(cli.System.Threading.ThreadStateException x)
{
}
}
}
}

Просмотреть файл

@ -170,6 +170,7 @@ namespace IKVM.Runtime
internal void Leave(ClassLoaderWrapper prev)
{
pJNIEnv->classLoader.Target = prev;
Leave();
}
public IntPtr Enter(RuntimeMethodHandle method)
@ -427,9 +428,16 @@ namespace IKVM.Runtime
{
Tracer.Info(Tracer.Jni, "Calling JNI_OnLoad on: {0}", filename);
JNI.Frame f = new JNI.Frame();
int version;
ClassLoaderWrapper prevLoader = f.Enter(loader);
int version = ikvm_CallOnLoad(onload, JavaVM.pJavaVM, null);
f.Leave(prevLoader);
try
{
version = ikvm_CallOnLoad(onload, JavaVM.pJavaVM, null);
}
finally
{
f.Leave(prevLoader);
}
if(!JNI.IsSupportedJniVersion(version))
{
throw JavaException.UnsatisfiedLinkError("Unsupported JNI version 0x{0:X} required by {1}", version, filename);

Просмотреть файл

@ -1310,29 +1310,36 @@ namespace IKVM.NativeCode.gnu.java.nio.channels
// NOTE this method implements a platform specific way to flush the underlying OS file buffers to disk
public static bool flush(FileStream fs)
{
if(mono_1_0_Flush != null)
try
{
object[] args = new object[] { fs.Handle, null };
mono_1_0_Flush.Invoke(null, args);
return ((IConvertible)args[1]).ToInt32(null) == 0;
}
else if(mono_1_1_Flush != null)
{
object[] args = new object[] { fs.Handle.ToInt32() };
return (int)mono_1_1_Flush.Invoke(null, args) == 0;
}
else
{
try
if(mono_1_0_Flush != null)
{
return FlushFileBuffers(fs.Handle);
object[] args = new object[] { fs.Handle, null };
mono_1_0_Flush.Invoke(null, args);
return ((IConvertible)args[1]).ToInt32(null) == 0;
}
catch(TypeLoadException)
else if(mono_1_1_Flush != null)
{
// we're apparently running on a alternate runtime, so we'll just pretend that flush succeeded
Tracer.Warning(Tracer.Runtime, "FlushFileBuffers/fsync not supported on this runtime");
return true;
object[] args = new object[] { fs.Handle.ToInt32() };
return (int)mono_1_1_Flush.Invoke(null, args) == 0;
}
else
{
try
{
return FlushFileBuffers(fs.Handle);
}
catch(TypeLoadException)
{
// we're apparently running on an alternate runtime, so we'll just pretend that flush succeeded
Tracer.Warning(Tracer.Runtime, "FlushFileBuffers/fsync not supported on this runtime");
return true;
}
}
}
finally
{
GC.KeepAlive(fs);
}
}