1 /* 2 * Copyright 2021-2022, Andrew Lindesay <apl@lindesay.co.nz>. 3 * All rights reserved. Distributed under the terms of the MIT License. 4 */ 5 #ifndef THREADED_PROCESS_NODE_H 6 #define THREADED_PROCESS_NODE_H 7 8 #include "AbstractProcessNode.h" 9 10 11 class ThreadedProcessNode : public AbstractProcessNode { 12 public: 13 ThreadedProcessNode(AbstractProcess* process, 14 int32 startTimeoutSeconds); 15 ThreadedProcessNode(AbstractProcess* process); 16 virtual ~ThreadedProcessNode(); 17 18 virtual status_t Start(); 19 virtual status_t RequestStop(); 20 virtual bool IsRunning(); 21 22 private: 23 void _RunProcessStart(); 24 void _RunProcessExit(); 25 static status_t _RunProcessThreadEntry(void* cookie); 26 static void _RunProcessThreadExit(void* cookie); 27 28 private: 29 thread_id fWorker; 30 int32 fStartTimeoutSeconds; 31 }; 32 33 #endif // THREADED_PROCESS_NODE_H 34