src/fiber_thread.cpp
branchNewGRF_ports
changeset 10991 d8811e327d12
parent 10211 c1391c8ed5c6
child 10861 7954a0043e05
child 11095 a0da321a39b3
equal deleted inserted replaced
10731:67db0d431d5e 10991:d8811e327d12
   107 
   107 
   108 private:
   108 private:
   109 	/**
   109 	/**
   110 	 * First function which is called within the fiber.
   110 	 * First function which is called within the fiber.
   111 	 */
   111 	 */
   112 	static void * CDECL stFiberProc(void *fiber)
   112 	static void stFiberProc(void *fiber)
   113 	{
   113 	{
   114 		Fiber_Thread *cur = (Fiber_Thread *)fiber;
   114 		Fiber_Thread *cur = (Fiber_Thread *)fiber;
   115 		/* Now suspend the thread until we get SwitchToFiber() for the first time */
   115 		/* Now suspend the thread until we get SwitchToFiber() for the first time */
   116 		cur->m_sem->Wait();
   116 		cur->m_sem->Wait();
   117 		/* If we continue, we are the current thread */
   117 		/* If we continue, we are the current thread */
   122 		} catch (...) {
   122 		} catch (...) {
   123 			/* Unlock the main thread */
   123 			/* Unlock the main thread */
   124 			s_main->m_sem->Set();
   124 			s_main->m_sem->Set();
   125 			throw;
   125 			throw;
   126 		}
   126 		}
   127 
       
   128 		return NULL;
       
   129 	}
   127 	}
   130 };
   128 };
   131 
   129 
   132 /* Initialize the static member of Fiber_Thread */
   130 /* Initialize the static member of Fiber_Thread */
   133 /* static */ Fiber_Thread *Fiber_Thread::s_current = NULL;
   131 /* static */ Fiber_Thread *Fiber_Thread::s_current = NULL;