[vmkit-commits] [vmkit] r121325 - in /vmkit/branches/multi-vm: include/mvm/Threads/Thread.h include/mvm/VMKit.h include/mvm/VirtualMachine.h lib/J3/Classpath/ClasspathVMThread.inc lib/J3/Compiler/JavaAOTCompiler.cpp lib/J3/VMCore/Jnjvm.cpp lib/J3/VMCore/Jnjvm.h lib/Mvm/CommonThread/ctthread.cpp lib/Mvm/Compiler/mvm-runtime.ll lib/Mvm/Runtime/SystemThreads.cpp lib/Mvm/Runtime/VMKit.cpp lib/Mvm/Runtime/VirtualMachine.cpp

Gael Thomas gael.thomas at lip6.fr
Wed Dec 8 16:16:33 PST 2010


Author: gthomas
Date: Wed Dec  8 18:16:33 2010
New Revision: 121325

URL: http://llvm.org/viewvc/llvm-project?rev=121325&view=rev
Log:
manage non daemon threads directly in vmkit

Modified:
    vmkit/branches/multi-vm/include/mvm/Threads/Thread.h
    vmkit/branches/multi-vm/include/mvm/VMKit.h
    vmkit/branches/multi-vm/include/mvm/VirtualMachine.h
    vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThread.inc
    vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp
    vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp
    vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h
    vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp
    vmkit/branches/multi-vm/lib/Mvm/Compiler/mvm-runtime.ll
    vmkit/branches/multi-vm/lib/Mvm/Runtime/SystemThreads.cpp
    vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp
    vmkit/branches/multi-vm/lib/Mvm/Runtime/VirtualMachine.cpp

Modified: vmkit/branches/multi-vm/include/mvm/Threads/Thread.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/Threads/Thread.h?rev=121325&r1=121324&r2=121325&view=diff
==============================================================================
--- vmkit/branches/multi-vm/include/mvm/Threads/Thread.h (original)
+++ vmkit/branches/multi-vm/include/mvm/Threads/Thread.h Wed Dec  8 18:16:33 2010
@@ -152,6 +152,9 @@
 	virtual ~VMThreadData() {} // force the construction of a VT
 };
 
+#define THREAD_RUNNING 1
+#define THREAD_DAEMON  2
+
 /// Thread - This class is the base of custom virtual machines' Thread classes.
 /// It provides static functions to manage threads. An instance of this class
 /// contains all thread-specific informations.
@@ -205,12 +208,24 @@
   /// allVmsData - the array of thread specific data.
 	VMThreadData** allVmsData;                             // 13
 
+private:
+  /// state - daemon, running
+	uint32 state;                                          // 14
 
 protected:
   Thread(VMKit* vmk);
 
 public:
 
+	/// setDaemon - the thread is a daemon
+	void setDaemon();
+
+	/// setDaemon - the thread is not a daemon
+	void setNonDaemon();
+
+	/// getDaemon - get the daemon flag of the thread
+	uint32 getState() { return state; }
+
   /// yield - Yield the processor to another thread.
   ///
   static void yield(void);

Modified: vmkit/branches/multi-vm/include/mvm/VMKit.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/VMKit.h?rev=121325&r1=121324&r2=121325&view=diff
==============================================================================
--- vmkit/branches/multi-vm/include/mvm/VMKit.h (original)
+++ vmkit/branches/multi-vm/include/mvm/VMKit.h Wed Dec  8 18:16:33 2010
@@ -45,6 +45,41 @@
   FunctionMap();
 };
 
+
+class NonDaemonThreadManager {
+	friend class Thread;
+public:
+	NonDaemonThreadManager() { nonDaemonThreads = 0; }
+
+private:
+  /// nonDaemonThreads - Number of threads in the system that are not daemon
+  /// threads.
+  //
+  uint16 nonDaemonThreads;
+
+  /// nonDaemonLock - Protection lock for the nonDaemonThreads variable.
+  ///
+  mvm::LockNormal nonDaemonLock;
+
+  /// nonDaemonVar - Condition variable to wake up the initial thread when it
+  /// waits for other non-daemon threads to end. The non-daemon thread that
+  /// decrements the nonDaemonThreads variable to zero wakes up the initial
+  /// thread.
+  ///
+  mvm::Cond nonDaemonVar;
+  
+  /// leave - A thread calls this function when it leaves the thread system.
+  ///
+  void leaveNonDaemonMode();
+
+  /// enter - A thread calls this function when it enters the thread system.
+  ///
+  void enterNonDaemonMode();
+
+public:
+	void waitNonDaemonThreads();
+};
+
 class VMKit : public mvm::PermanentObject {
 public:
   /// allocator - Bump pointer allocator to allocate permanent memory of VMKit
@@ -91,6 +126,9 @@
 	///
   size_t                       numberOfRunningThreads;
 
+	// nonDaemonThreadsManager - manager of the non daemon threads
+	NonDaemonThreadManager       nonDaemonThreadsManager;
+
   /// rendezvous - The rendezvous implementation for garbage collection.
   ///
 #ifdef WITH_LLVM_GCC

Modified: vmkit/branches/multi-vm/include/mvm/VirtualMachine.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/VirtualMachine.h?rev=121325&r1=121324&r2=121325&view=diff
==============================================================================
--- vmkit/branches/multi-vm/include/mvm/VirtualMachine.h (original)
+++ vmkit/branches/multi-vm/include/mvm/VirtualMachine.h Wed Dec  8 18:16:33 2010
@@ -52,43 +52,24 @@
 	///
 	virtual VMThreadData* buildVMThreadData(Thread* mut) = 0; //{ return new VMThreadData(this, mut); }
 
-  /// nbNonDaemonThreads - Number of threads in the system that are not daemon
-  /// threads.
-  uint16 nbNonDaemonThreads;
-
-  /// nonDaemonLock - Protection lock for the nonDaemonThreads variable.
-  mvm::LockNormal nonDaemonLock;
-
-  /// nonDaemonVar - Condition variable to wake up the initial thread when it
-  /// waits for other non-daemon threads to end. The non-daemon thread that
-  /// decrements the nonDaemonThreads variable to zero wakes up the initial
-  /// thread.
-  mvm::Cond nonDaemonVar;
-  
-  /// enter - A thread calls this function when it enters the thread system.
-  virtual void enterNonDeamonMode();
-
-  /// leave - A thread calls this function when it leaves the thread system.
-  virtual void leaveNonDeamonMode();
-
 	virtual void runApplicationImpl(int argc, char** argv) {};
 
-  /// runInNonDeamonThread - start a non deamon thread a begin the code with start if != 0 and runApplicationImpl otherwise
-	/// the thread leaves the deamon mode when it finishs.
-	void runInNonDeamonThread(void (*start)(VirtualMachine*, int, char**), int argc, char** argv);
-
-  /// runInNonDeamonThread - start a non deamon thread a begin the code with runApplicationImpl, 
-	void runInNonDeamonThread(int argc, char **argv) { runInNonDeamonThread(0, argc, argv); }
-
-  /// waitNonDeamonThreads - wait until all the non deamon threads are terminated.
-	void waitForNonDeamonThreads();
-
-  /// runApplication - Run an application. The application name is in
-  /// the arguments, hence it is the virtual machine's job to parse them.
-  virtual void runApplication(int argc, char** argv) = 0;
+//   /// runInNonDeamonThread - start a non deamon thread a begin the code with start if != 0 and runApplicationImpl otherwise
+// 	/// the thread leaves the deamon mode when it finishs.
+// 	void runInNonDeamonThread(void (*start)(VirtualMachine*, int, char**), int argc, char** argv);
+
+//   /// runInNonDeamonThread - start a non deamon thread a begin the code with runApplicationImpl, 
+// 	void runInNonDeamonThread(int argc, char **argv) { runInNonDeamonThread(0, argc, argv); }
+
+//   /// waitNonDeamonThreads - wait until all the non deamon threads are terminated.
+// 	void waitForNonDeamonThreads();
+
+//   /// runApplication - Run an application. The application name is in
+//   /// the arguments, hence it is the virtual machine's job to parse them.
+//   virtual void runApplication(int argc, char** argv) = 0;
   
-  /// waitForExit - Wait until the virtual machine stops its execution.
-  virtual void waitForExit() = 0;
+//   /// waitForExit - Wait until the virtual machine stops its execution.
+//   virtual void waitForExit() = 0;
 
 //===----------------------------------------------------------------------===//
 // (2) GC-related methods.

Modified: vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThread.inc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThread.inc?rev=121325&r1=121324&r2=121325&view=diff
==============================================================================
--- vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThread.inc (original)
+++ vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThread.inc Wed Dec  8 18:16:33 2010
@@ -60,19 +60,13 @@
   // wait until exit.
   bool isDaemon = vm->upcalls->daemon->getInstanceInt8Field(javaThread);
 
-  if (!isDaemon) {
-    vm->enterNonDaemonMode();
-  }
- 
+  if (isDaemon)
+		mut->setDaemon();
+	
   assert(vmThread->getVirtualTable());
   assert(javaThread->getVirtualTable());
   // Run the VMThread::run function
   vm->upcalls->runVMThread->invokeIntSpecial(vmthClass, vmThread);
- 
-  // Remove the thread from the list.
-  if (!isDaemon) {
-    vm->leaveNonDaemonMode();
-  }
 }
 
 JNIEXPORT void JNICALL Java_java_lang_VMThread_start(

Modified: vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp?rev=121325&r1=121324&r2=121325&view=diff
==============================================================================
--- vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp (original)
+++ vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp Wed Dec  8 18:16:33 2010
@@ -2084,7 +2084,7 @@
     M->CreateStaticInitializer();
 
 end:
-	vm->leaveNonDaemonMode();
+		return;
 }
 
 void JavaAOTCompiler::compileFile(Jnjvm* vm, const char* n) {

Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp?rev=121325&r1=121324&r2=121325&view=diff
==============================================================================
--- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp (original)
+++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp Wed Dec  8 18:16:33 2010
@@ -1246,14 +1246,7 @@
 }
 
 void Jnjvm::waitForExit() { 
-  
-  nonDaemonLock.lock();
-  
-  while (nonDaemonThreads) {
-    nonDaemonVar.wait(&nonDaemonLock);
-  }
-  
-  nonDaemonLock.unlock();
+	vmkit->nonDaemonThreadsManager.waitNonDaemonThreads();
 }
 
 void Jnjvm::mainJavaStart(mvm::Thread* thread) {
@@ -1273,10 +1266,8 @@
   Jnjvm* vm = JavaThread::j3Thread(thread)->getJVM();
   vm->bootstrapLoader->analyseClasspathEnv(vm->bootstrapLoader->bootClasspathEnv);
   vm->argumentsInfo.readArgs(vm);
-  if (vm->argumentsInfo.className == NULL) {
-    vm->leaveNonDaemonMode();
+  if (vm->argumentsInfo.className == NULL)
     return;
-  }
 
   int pos = vm->argumentsInfo.appArgumentsPos;  
   vm->argumentsInfo.argv = vm->argumentsInfo.argv + pos - 1;
@@ -1313,20 +1304,6 @@
 
     vm->executeClass(info.className, args);
   }
-  vm->leaveNonDaemonMode();
-}
-
-void Jnjvm::leaveNonDaemonMode() {
-  nonDaemonLock.lock();
-  --nonDaemonThreads;
-  if (nonDaemonThreads == 0) nonDaemonVar.signal();
-  nonDaemonLock.unlock();  
-}
-
-void Jnjvm::enterNonDaemonMode() {
-  nonDaemonLock.lock();
-  ++nonDaemonThreads;
-  nonDaemonLock.unlock();  
 }
 
 void Jnjvm::runApplication(int argc, char** argv) {
@@ -1340,7 +1317,6 @@
 	VirtualMachine(Alloc, vmkit), 
 	lockSystem(Alloc) {
 
-	nonDaemonThreads = 1;
   bootstrapLoader = new(Alloc, "bootstrap loader") JnjvmBootstrapLoader(Alloc, this, Comp);
   
   upcalls = new(allocator, "Classpath") Classpath(bootstrapLoader, dlLoad);

Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h?rev=121325&r1=121324&r2=121325&view=diff
==============================================================================
--- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h (original)
+++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h Wed Dec  8 18:16:33 2010
@@ -116,31 +116,6 @@
   static void mainJavaStart(mvm::Thread* thread);
   
 public:
-
-  /// nonDaemonThreads - Number of threads in the system that are not daemon
-  /// threads.
-  //
-  uint16 nonDaemonThreads;
-
-  /// nonDaemonLock - Protection lock for the nonDaemonThreads variable.
-  ///
-  mvm::LockNormal nonDaemonLock;
-
-  /// nonDaemonVar - Condition variable to wake up the initial thread when it
-  /// waits for other non-daemon threads to end. The non-daemon thread that
-  /// decrements the nonDaemonThreads variable to zero wakes up the initial
-  /// thread.
-  ///
-  mvm::Cond nonDaemonVar;
-  
-  /// leave - A thread calls this function when it leaves the thread system.
-  ///
-  void leaveNonDaemonMode();
-
-  /// enter - A thread calls this function when it enters the thread system.
-  ///
-  void enterNonDaemonMode();
-
   
   /// tracer - Traces instances of this class.
   ///

Modified: vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp?rev=121325&r1=121324&r2=121325&view=diff
==============================================================================
--- vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp (original)
+++ vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp Wed Dec  8 18:16:33 2010
@@ -41,9 +41,22 @@
 	lastKnownFrame = 0;
 	pendingException = 0;
 	allVmsData = 0;
+	state = 0;             // not daemon, not running
 	vmk->registerPreparedThread(this);
 }
 
+void Thread::setDaemon() {
+	if((state & THREAD_RUNNING) && !(state & THREAD_DAEMON))
+		vmkit->nonDaemonThreadsManager.leaveNonDaemonMode();
+	state |= THREAD_DAEMON;
+}
+
+void Thread::setNonDaemon() {
+	if((state & THREAD_RUNNING) && (state & THREAD_DAEMON))
+		vmkit->nonDaemonThreadsManager.enterNonDaemonMode();
+	state &= ~THREAD_DAEMON;
+}
+
 void Thread::attach(VirtualMachine* vm) {
 	vmData = allVmsData[vm->vmID];
 
@@ -470,11 +483,12 @@
 
   th->vmkit->rendezvous.prepareForJoin();
   th->routine(th);
+	th->state &= ~THREAD_RUNNING;
+	if(!(th->state & THREAD_DAEMON))
+		th->vmkit->nonDaemonThreadsManager.leaveNonDaemonMode();
   th->vmkit->unregisterRunningThread(th);
 }
 
-
-
 /// start - Called by the creator of the thread to run the new thread.
 /// The thread is in a detached state, because each virtual machine has
 /// its own way of waiting for created threads.
@@ -485,6 +499,9 @@
   routine = fct;
   // Make sure to add it in the list of threads before leaving this function:
   // the garbage collector wants to trace this thread.
+	state |= THREAD_RUNNING;
+	if(!(state & THREAD_DAEMON))
+		vmkit->nonDaemonThreadsManager.enterNonDaemonMode();
   vmkit->registerRunningThread(this);
   int res = pthread_create((pthread_t*)(void*)(&internalThreadID), &attributs,
                            (void* (*)(void *))internalThreadStart, this);
@@ -493,7 +510,6 @@
   return res;
 }
 
-
 /// operator new - Get a stack from the stack manager. The Thread object
 /// will be placed in the first page at the bottom of the stack. Hence
 /// Thread objects can not exceed a page.

Modified: vmkit/branches/multi-vm/lib/Mvm/Compiler/mvm-runtime.ll
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Compiler/mvm-runtime.ll?rev=121325&r1=121324&r2=121325&view=diff
==============================================================================
--- vmkit/branches/multi-vm/lib/Mvm/Compiler/mvm-runtime.ll (original)
+++ vmkit/branches/multi-vm/lib/Mvm/Compiler/mvm-runtime.ll Wed Dec  8 18:16:33 2010
@@ -8,20 +8,21 @@
 %CircularBase = type { %VT*, %CircularBase*, %CircularBase* }
 
 ;;; Field 0:  the parent (circular base)
-;;; Field 1:  bool   doYield
-;;; field 2:  void*  lastExceptionBuffer/internalPendingException
-;;; field 3:  void*  vmData
-;;; field 4:  gc*    pendingException
-;;; field 5:  VMkit* vmkit
-;;; Field 6:  void*  baseSP
-;;; Field 7:  bool   inRV
-;;; Field 8:  bool   joinedRV
-;;; Field 9: void*  lastSP
-;;; Field 10: void*  internalThreadID
-;;; field 11: void*  routine
-;;; field 12: void*  lastKnownFrame
-;;; field 13: void*  allVMDatas
-%Thread       = type { %CircularBase, i1, i8*, i8*, i8*, i8*, i8*, i1, i1, i8*, i8*, i8*, i8*, i8* }
+;;; Field 1:  bool    doYield
+;;; field 2:  void*   lastExceptionBuffer/internalPendingException
+;;; field 3:  void*   vmData
+;;; field 4:  gc*     pendingException
+;;; field 5:  VMkit*  vmkit
+;;; Field 6:  void*   baseSP
+;;; Field 7:  bool    inRV
+;;; Field 8:  bool    joinedRV
+;;; Field 9:  void*   lastSP
+;;; Field 10: void*   internalThreadID
+;;; field 11: void*   routine
+;;; field 12: void*   lastKnownFrame
+;;; field 13: void*   allVMDatas
+;;; field 14: uint32  state
+%Thread       = type { %CircularBase, i1, i8*, i8*, i8*, i8*, i8*, i1, i1, i8*, i8*, i8*, i8*, i8*, i32 }
 
 ;;; field 0: VT
 ;;; field 1: mvm::MutatorThread*  mut

Modified: vmkit/branches/multi-vm/lib/Mvm/Runtime/SystemThreads.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Runtime/SystemThreads.cpp?rev=121325&r1=121324&r2=121325&view=diff
==============================================================================
--- vmkit/branches/multi-vm/lib/Mvm/Runtime/SystemThreads.cpp (original)
+++ vmkit/branches/multi-vm/lib/Mvm/Runtime/SystemThreads.cpp Wed Dec  8 18:16:33 2010
@@ -13,6 +13,8 @@
   ToEnqueue = new mvm::gc*[INITIAL_QUEUE_SIZE];
   ToEnqueueLength = INITIAL_QUEUE_SIZE;
   ToEnqueueIndex = 0;
+
+	setDaemon();
 }
 
 mvm::gc** getReferent(mvm::gc* obj) {
@@ -150,6 +152,8 @@
   ToBeFinalized = new mvm::gc*[INITIAL_QUEUE_SIZE];
   ToBeFinalizedLength = INITIAL_QUEUE_SIZE;
   CurrentFinalizedIndex = 0;
+
+	setDaemon();
 }
 
 void FinalizerThread::growFinalizationQueue() {

Modified: vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp?rev=121325&r1=121324&r2=121325&view=diff
==============================================================================
--- vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp (original)
+++ vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp Wed Dec  8 18:16:33 2010
@@ -200,3 +200,26 @@
 	th->appendTo(&preparedThreads);
 	vmkitUnlock();
 }
+
+void NonDaemonThreadManager::leaveNonDaemonMode() {
+  nonDaemonLock.lock();
+  --nonDaemonThreads;
+  if (nonDaemonThreads == 0) nonDaemonVar.signal();
+  nonDaemonLock.unlock();  
+}
+
+void NonDaemonThreadManager::enterNonDaemonMode() {
+  nonDaemonLock.lock();
+  ++nonDaemonThreads;
+  nonDaemonLock.unlock();  
+}
+
+void NonDaemonThreadManager::waitNonDaemonThreads() {
+  nonDaemonLock.lock();
+
+  while (nonDaemonThreads) {
+    nonDaemonVar.wait(&nonDaemonLock);
+  }
+  
+  nonDaemonLock.unlock();
+}

Modified: vmkit/branches/multi-vm/lib/Mvm/Runtime/VirtualMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Runtime/VirtualMachine.cpp?rev=121325&r1=121324&r2=121325&view=diff
==============================================================================
--- vmkit/branches/multi-vm/lib/Mvm/Runtime/VirtualMachine.cpp (original)
+++ vmkit/branches/multi-vm/lib/Mvm/Runtime/VirtualMachine.cpp Wed Dec  8 18:16:33 2010
@@ -12,53 +12,31 @@
 	vmkit->removeVM(vmID);
 }
 
-void VirtualMachine::leaveNonDeamonMode() {
-  nonDaemonLock.lock();
-  --nbNonDaemonThreads;
-  if (nbNonDaemonThreads == 0) nonDaemonVar.signal();
-  nonDaemonLock.unlock();  
-}
-
-void VirtualMachine::enterNonDeamonMode() {
-  nonDaemonLock.lock();
-  ++nbNonDaemonThreads;
-  nonDaemonLock.unlock();  
-}
-
-void VirtualMachine::waitForNonDeamonThreads() { 
-	nonDaemonLock.lock();
-  
-  while (nbNonDaemonThreads) {
-    nonDaemonVar.wait(&nonDaemonLock);
-  }
-  
-  nonDaemonLock.unlock();
-}
 
-class LauncherThread : public Thread {
-public:
-	void (*realStart)(VirtualMachine*, int, char**);
-	VirtualMachine *vm;
-	int argc;
-	char** argv;
-
-	LauncherThread(VMKit* vmkit, void (*s)(VirtualMachine*, int, char**), VirtualMachine* v, int ac, char** av) : Thread(vmkit) {
-		realStart = s;
-		vm = v;
-		argc = ac;
-		argv = av;
-	}
-
-	static void launch(LauncherThread* th) {
-		if(th->realStart)
-			th->realStart(th->vm, th->argc, th->argv);
-		else
-			th->vm->runApplicationImpl(th->argc, th->argv);
-		th->vm->leaveNonDeamonMode();
-	}
-};
-
-void VirtualMachine::runInNonDeamonThread(void (*start)(VirtualMachine*, int, char**), int argc, char **argv) {
-  enterNonDeamonMode();
-  (new LauncherThread(vmkit, start, this, argc, argv))->start((void (*)(Thread*))LauncherThread::launch);
-}
+// class LauncherThread : public Thread {
+// public:
+// 	void (*realStart)(VirtualMachine*, int, char**);
+// 	VirtualMachine *vm;
+// 	int argc;
+// 	char** argv;
+
+// 	LauncherThread(VMKit* vmkit, void (*s)(VirtualMachine*, int, char**), VirtualMachine* v, int ac, char** av) : Thread(vmkit) {
+// 		realStart = s;
+// 		vm = v;
+// 		argc = ac;
+// 		argv = av;
+// 	}
+
+// 	static void launch(LauncherThread* th) {
+// 		if(th->realStart)
+// 			th->realStart(th->vm, th->argc, th->argv);
+// 		else
+// 			th->vm->runApplicationImpl(th->argc, th->argv);
+// 		th->vm->leaveNonDeamonMode();
+// 	}
+// };
+
+// void VirtualMachine::runInNonDeamonThread(void (*start)(VirtualMachine*, int, char**), int argc, char **argv) {
+//   enterNonDeamonMode();
+//   (new LauncherThread(vmkit, start, this, argc, argv))->start((void (*)(Thread*))LauncherThread::launch);
+// }





More information about the vmkit-commits mailing list