1 /* 2 * Copyright 2012, Ingo Weinhold, ingo_weinhold@gmx.de. 3 * Distributed under the terms of the MIT License. 4 */ 5 6 7 #include "CliContinueCommand.h" 8 9 #include <stdio.h> 10 11 #include <AutoLocker.h> 12 13 #include "CliContext.h" 14 #include "MessageCodes.h" 15 #include "Team.h" 16 #include "UserInterface.h" 17 18 CliContinueCommand::CliContinueCommand() 19 : 20 CliCommand("continue the current thread", 21 "%s\n" 22 "Continues the current thread.") 23 { 24 } 25 26 27 void 28 CliContinueCommand::Execute(int argc, const char* const* argv, 29 CliContext& context) 30 { 31 AutoLocker<Team> teamLocker(context.GetTeam()); 32 Thread* thread = context.CurrentThread(); 33 if (thread == NULL) { 34 printf("Error: No current thread.\n"); 35 return; 36 } 37 38 if (thread->State() != THREAD_STATE_STOPPED) { 39 printf("Error: The current thread is not stopped.\n"); 40 return; 41 } 42 43 context.GetUserInterfaceListener()->ThreadActionRequested(thread->ID(), 44 MSG_THREAD_RUN); 45 } 46