Diff

net/server_event.lua @ 3000:43a4cb707fe4

net.server_select, net.server_event: Support for :pause() and :resume() on connections
author Matthew Wild <mwild1@gmail.com>
date Wed, 05 May 2010 15:21:17 +0100
parent 2988:0c61f73ac0fb
child 3001:fa00c6f563b4
line wrap: on
line diff
--- a/net/server_event.lua	Wed May 05 11:24:45 2010 +0100
+++ b/net/server_event.lua	Wed May 05 15:21:17 2010 +0100
@@ -282,8 +282,21 @@
 			return nointerface, noreading, nowriting
 	end
 	
+	--TODO: Deprecate
 	function interface_mt:lock_read(switch)
-		return self:_lock(self.nointerface, switch, self.nowriting);
+		if switch then
+			return self:pause();
+		else
+			return self:resume();
+		end
+	end
+
+	function interface_mt:pause()
+		return self:_lock(self.nointerface, true, self.nowriting);
+	end
+
+	function interface_mt:resume()
+		return self:_lock(self.nointerface, false, self.nowriting);
 	end
 
 	function interface_mt:counter(c)