Example #1
0
 static bool DoAcquire(WaitHandle[] waitObjs, int waitCount, bool waitAll,
                       java.lang.Thread thread)
 {
     if (!CanAcquire(waitObjs, waitCount, waitAll, thread))
     {
         return(false);
     }
     javaLock.@lock();
     try
     {
         if (!CanAcquire(waitObjs, waitCount, waitAll, thread))
         {
             return(false);
         }
         for (int i = 0; i < waitCount; i++)
         {
             waitObjs[i].DoAcquire(thread);
         }
         return(true);
     }
     finally
     {
         javaLock.@unlock();
     }
 }
 protected override void DoAcquire(java.lang.Thread thread)
 {
     if (autoReset)
     {
         signalled = 0;
     }
 }
Example #3
0
        public static int Main(string[] args)
        {
            int num = 0;

            try
            {
                Startup.enterMainThread();

                RunWeka.main(args);

                //weka.Run.main(args);
                //weka.gui.GUIChooser.main(Startup.glob());
            }
            catch (Exception exception1)
            {
                Exception        exception = Util.mapException(exception1);
                java.lang.Thread thread    = java.lang.Thread.currentThread();
                thread.getThreadGroup().uncaughtException(thread, exception);
                num = 1;
            }
            finally
            {
                Startup.exitMainThread();
            }
            return(num);
        }
Example #4
0
 public Mutex(bool initialState)
 {
     if (initialState)
     {
         owner = java.lang.Thread.currentThread();
         count = 1;
     }
 }
Example #5
0
 void java.lang.Thread.UncaughtExceptionHandler.uncaughtException(java.lang.Thread arg0, java.lang.Throwable arg1)
 {
     global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
     if (!IsClrObject)
     {
         @__env.CallVoidMethod(this.JvmHandle, global::java.lang.Thread.UncaughtExceptionHandler_._uncaughtException13328, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1));
     }
     else
     {
         @__env.CallNonVirtualVoidMethod(this.JvmHandle, global::java.lang.Thread.UncaughtExceptionHandler_.staticClass, global::java.lang.Thread.UncaughtExceptionHandler_._uncaughtException13328, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1));
     }
 }
Example #6
0
 public void ReleaseMutex()
 {
     if (owner != java.lang.Thread.currentThread())
     {
         throw new System.ApplicationException("Mutex not held");
     }
     if (--count == 0)
     {
         owner = null;
         base.Signal();
     }
 }
Example #7
0
 public virtual void timedJoin(java.lang.Thread arg0, long arg1)
 {
     global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
     if (!IsClrObject)
     {
         @__env.CallVoidMethod(this.JvmHandle, global::java.util.concurrent.TimeUnit._timedJoin15740, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1));
     }
     else
     {
         @__env.CallNonVirtualVoidMethod(this.JvmHandle, global::java.util.concurrent.TimeUnit.staticClass, global::java.util.concurrent.TimeUnit._timedJoin15740, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1));
     }
 }
Example #8
0
        private void _UnhandledExceptionHandler(java.lang.Thread thread,
                                                java.lang.Throwable exc)
        {
            exc = system.Util.TranslateException(exc);
            var evt = _UnhandledExceptionEvent;

            if (evt != null)
            {
                var args = new UnhandledExceptionEventArgs(exc, true);
                evt(theInstance, args);
            }
            exc.printStackTrace();
        }
Example #9
0
 public __Thread(global::System.Threading.ParameterizedThreadStart t)
 {
     InternalValue = new_java_lang_Thread(
         new RunnableHandler
     {
         Handler =
             delegate
         {
             t(InternalParameterizedThreadStart);
         }
     }
         );
 }
Example #10
0
 static bool CanAcquire(WaitHandle[] waitObjs, int waitCount, bool waitAll,
                        java.lang.Thread thread)
 {
     for (int i = 0; i < waitCount; i++)
     {
         if (waitObjs[i].CanAcquire(thread))
         {
             if (!waitAll)
             {
                 return(true);
             }
         }
         else
         {
             if (waitAll)
             {
                 return(false);
             }
         }
     }
     return(true);
 }
 internal Node(java.lang.Thread thread, java.util.concurrent.locks.AbstractQueuedSynchronizer
               .Node mode)
 {
     throw new System.NotImplementedException();
 }
 public bool isQueued(java.lang.Thread thread)
 {
     throw new System.NotImplementedException();
 }
Example #13
0
 protected abstract void DoAcquire(java.lang.Thread thread);
Example #14
0
 protected abstract bool CanAcquire(java.lang.Thread thread);
Example #15
0
 public java.lang.Thread newThread(java.lang.Runnable r)
 {
     java.lang.Thread result = defaultThreadFactory.newThread(r);
     result.setDaemon(true);
     return(result);
 }
Example #16
0
        protected override bool CanAcquire(java.lang.Thread thread)
        {
            var owner = this.owner;

            return(owner == null || owner == thread);
        }
Example #17
0
 protected override bool CanAcquire(java.lang.Thread thread) => (current.get() > 0);
Example #18
0
 protected override void DoAcquire(java.lang.Thread thread) => current.decrementAndGet();
Example #19
0
 public Thread(System.Threading.ThreadStart start)
 {
     java.lang.Runnable.Delegate runnable = () => start();
     JavaThread = new java.lang.Thread(runnable.AsInterface());
     SetThreadId();
 }
Example #20
0
 public static void set(java.lang.Thread thread, android.os.Looper looper)
 {
     throw new System.NotImplementedException();
 }
Example #21
0
 protected override bool CanAcquire(java.lang.Thread thread)
 => signalled != 0;
 internal Node(java.lang.Thread thread, int waitStatus)
 {
     throw new System.NotImplementedException();
 }
Example #23
0
 public virtual void onSyncCanceled(java.lang.Thread thread)
 {
     throw new System.NotImplementedException();
 }
Example #24
0
		internal void attach(android.content.Context context, android.app.ActivityThread 
			aThread, android.app.Instrumentation instr, android.os.IBinder token, int ident, 
			android.app.Application application, android.content.Intent intent, android.content.pm.ActivityInfo
			 info, java.lang.CharSequence title, android.app.Activity parent, string id, android.app.Activity
			.NonConfigurationInstances lastNonConfigurationInstances, android.content.res.Configuration
			 config)
		{
			attachBaseContext(context);
			mFragments.attachActivity(this);
			mWindow = [email protected](this);
			mWindow.setCallback(this);
			mWindow.getLayoutInflater().setPrivateFactory(this);
			if (info.softInputMode != android.view.WindowManagerClass.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED)
			{
				mWindow.setSoftInputMode(info.softInputMode);
			}
			if (info.uiOptions != 0)
			{
				mWindow.setUiOptions(info.uiOptions);
			}
			mUiThread = java.lang.Thread.currentThread();
			mMainThread = aThread;
			mInstrumentation = instr;
			mToken = token;
			mIdent = ident;
			mApplication = application;
			mIntent = intent;
			mComponent = intent.getComponent();
			mActivityInfo = info;
			mTitle = title;
			mParent = parent;
			mEmbeddedID = id;
			mLastNonConfigurationInstances = lastNonConfigurationInstances;
			mWindow.setWindowManager(null, mToken, mComponent.flattenToString(), (info.flags 
				& android.content.pm.ActivityInfo.FLAG_HARDWARE_ACCELERATED) != 0);
			if (mParent != null)
			{
				mWindow.setContainer(mParent.getWindow());
			}
			mWindowManager = mWindow.getWindowManager();
			mCurrentConfig = config;
		}
Example #25
0
 protected override void DoAcquire(java.lang.Thread thread)
 {
     owner = thread;
     ++count;
 }
Example #26
0
 public __Thread(global::System.Threading.ParameterizedThreadStart t)
 {
     InternalValue = new_java_lang_Thread(
               new RunnableHandler
     {
         Handler =
                       delegate
         {
             t(InternalParameterizedThreadStart);
         }
     }
           );
 }
Example #27
0
 private Thread()
 {
     JavaThread = java.lang.Thread.currentThread();
     SetThreadId();
 }