Browse Source

Fixed more locking issues in love.thread

Bart van Strien 14 years ago
parent
commit
31f8c68b4b
1 changed files with 4 additions and 4 deletions
  1. 4 4
      src/modules/thread/sdl/wrap_Thread.cpp

+ 4 - 4
src/modules/thread/sdl/wrap_Thread.cpp

@@ -78,13 +78,13 @@ namespace sdl
 		std::string name = luax_checklstring(L, 2);
 		t->lock();
 		ThreadVariant *v = t->receive(name);
+		t->clear(name);
+		t->unlock();
 		if (!v)
 		{
 			lua_pushnil(L);
 			return 1;
 		}
-		t->clear(name);
-		t->unlock();
 		switch(v->type)
 		{
 			case BOOLEAN:
@@ -123,13 +123,13 @@ namespace sdl
 		std::string name = luax_checklstring(L, 2);
 		t->lock();
 		ThreadVariant *v = t->demand(name);
+		t->clear(name);
+		t->unlock();
 		if (!v)
 		{
 			lua_pushnil(L);
 			return 1;
 		}
-		t->clear(name);
-		t->unlock();
 		switch(v->type)
 		{
 			case BOOLEAN: