/// <summary> /// Adds a single chunk of output to the buffer. /// </summary> public void outputPush( ConsoleCommand cmd ) { lock( _mutex ) { use( true ); _pendingOutput.Enqueue( cmd ); _pendingOutputEvent.Set(); } }
public JsonResult PushCheck() { // Wait for new output, and fail if we don't get any by 25 seconds. ConsoleCommand command; try { if( !_user.outputWait( 25000 ) ) command = new ConsoleCommand(); else { // Get what's there, if anything is left. command = _user.outputPop(); } } catch( Exception e ) { command = new ConsoleCommand() { text = e.ToString() }; // newText = e.Message; } return Json( command, JsonRequestBehavior.AllowGet ); }