Bart van Strien avatar Bart van Strien committed 88536de

Threads get/set instead of send/receive (issue #166)

Comments (0)

Files changed (4)

src/modules/thread/sdl/Thread.cpp

 		return name;
 	}
 
-	ThreadVariant *Thread::receive(const std::string & name)
+	ThreadVariant *Thread::get(const std::string & name)
 	{
 		lock();
 		ThreadVariant *v = comm->getValue(name);
 		unlock();
 	}
 
-	void Thread::send(const std::string & name, ThreadVariant *v)
+	void Thread::set(const std::string & name, ThreadVariant *v)
 	{
 		lock();
 		comm->setValue(name, v);

src/modules/thread/sdl/Thread.h

 		void kill();
 		void wait();
 		std::string getName();
-		ThreadVariant *receive(const std::string & name);
+		ThreadVariant *get(const std::string & name);
 		ThreadVariant *demand(const std::string & name);
 		void clear(const std::string & name);
-		void send(const std::string & name, ThreadVariant *v);
+		void set(const std::string & name, ThreadVariant *v);
 		void lock();
 		void unlock();
 	}; // Thread

src/modules/thread/sdl/wrap_Thread.cpp

 		return 1;
 	}
 
-	int w_Thread_receive(lua_State *L)
+	int w_Thread_get(lua_State *L)
 	{
 		Thread *t = luax_checkthread(L, 1);
 		std::string name = luax_checklstring(L, 2);
-		ThreadVariant *v = t->receive(name);
+		ThreadVariant *v = t->get(name);
 		if (!v)
 		{
 			lua_pushnil(L);
 	{
 		Thread *t = luax_checkthread(L, 1);
 		std::string name = luax_checklstring(L, 2);
-		ThreadVariant *v = t->receive(name);
+		ThreadVariant *v = t->get(name);
 		if (!v)
 		{
 			lua_pushnil(L);
 		return t;
 	}
 
-	int w_Thread_send(lua_State *L)
+	int w_Thread_set(lua_State *L)
 	{
 		Thread *t = luax_checkthread(L, 1);
 		std::string name = luax_checklstring(L, 2);
 		{
 			return luaL_error(L, "Expected boolean, number, string or userdata");
 		}
-		t->send(name, v);
+		t->set(name, v);
 		v->release();
 		return 0;
 	}
 		{ "kill", w_Thread_kill },
 		{ "wait", w_Thread_wait },
 		{ "getName", w_Thread_getName },
-		{ "receive", w_Thread_receive },
+		{ "get", w_Thread_get },
 		{ "demand", w_Thread_demand },
 		{ "peek", w_Thread_peek },
-		{ "send", w_Thread_send },
+		{ "set", w_Thread_set },
 		{ 0, 0 }
 	};
 

src/modules/thread/sdl/wrap_Thread.h

 	int w_Thread_kill(lua_State *L);
 	int w_Thread_wait(lua_State *L);
 	int w_Thread_getName(lua_State *L);
-	int w_Thread_receive(lua_State *L);
+	int w_Thread_get(lua_State *L);
 	int w_Thread_demand(lua_State *L);
 	int w_Thread_peek(lua_State *L);
-	int w_Thread_send(lua_State *L);
+	int w_Thread_set(lua_State *L);
 
 	int luaopen_thread(lua_State *L);
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.