From fa935276536ffa3ca5126a2f698e0b57f5a5634f Mon Sep 17 00:00:00 2001 From: batrick Date: Sat, 21 Jun 2008 18:52:08 +0000 Subject: [PATCH] Changed waiting2running to push threads to the back of running, it caused some nasty bugs when a thread would yield and pop front (a thread just added). --- nse_main.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/nse_main.cc b/nse_main.cc index d10177931..84d8ca7f2 100644 --- a/nse_main.cc +++ b/nse_main.cc @@ -358,9 +358,9 @@ int process_mainloop(lua_State *L) { } - while(running_scripts.begin() != running_scripts.end()){ + while (!running_scripts.empty()) { current = *(running_scripts.begin()); - + if (current.rr->host->timedOut(&now)) state = LUA_ERRRUN; else @@ -468,7 +468,8 @@ int process_waiting2running(lua_State* L, int resume_arguments) { // put the thread back into the running // queue - running_scripts.push_front((*iter)); + //running_scripts.push_front((*iter)); + running_scripts.push_back((*iter)); waiting_scripts.erase(iter); return SCRIPT_ENGINE_SUCCESS;