stopWorkLoop() public method

Terminate the work thread.
public stopWorkLoop ( ) : void
return void
Example #1
0
    		public void testBackgroundJob()
    		{
      		Worker w = new Worker("localhost");
			w.registerFunction("bgtest", bgtest);
			w.workLoop();
			
			Client c = new Client("localhost"); 
			byte[] data = new ASCIIEncoding().GetBytes("");
			string jobhandle = c.submitJobInBackground("bgtest", data, Client.JobPriority.HIGH);
		
			while(!c.checkIsDone(jobhandle))
			{
				Console.WriteLine("Still not done!");
				Thread.Sleep(1500);
			}
			
			w.stopWorkLoop();
	    }
Example #2
0
		public void testWordCountIPv6()
		{
		    Worker w = new Worker("::1");
			w.registerFunction("wc", wctest);
			w.workLoop();
			
			Client c = new Client("::1");
			byte[] data = new ASCIIEncoding().GetBytes("zzz\nyyy\napple\nbaz\nfoo\nnarf\nquiddle\n");
			byte[] result = c.submitJob("wc", data);
		
			Assert.IsNotNull(result);
			
			int resultasint = BitConverter.ToInt32(result, 0);
			
			Assert.AreEqual(resultasint, 7);
			
			w.stopWorkLoop();			
		}
Example #3
0
    		public void testTimeout()
    		{
      		Worker w = new Worker("localhost");
			w.registerFunction("infinite", infinite);
			w.workLoop();
		
			
			DateTime start = DateTime.Now;
			Console.WriteLine("Started: {0}", start);
			
			Client c = new Client("localhost");
			byte[] data = new ASCIIEncoding().GetBytes("zzz\nyyy\napple\nbaz\nfoo\nnarf\nquiddle\n");
			c.submitJob("infinite", data);
			DateTime stop = DateTime.Now;
			
			Console.WriteLine("Connection died at {1}", stop);
						
			w.stopWorkLoop();
	    }