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
11class ThreadedProcessNode : public AbstractProcessNode {
12public:
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
22private:
23			void				_RunProcessStart();
24			void				_RunProcessExit();
25	static	status_t			_RunProcessThreadEntry(void* cookie);
26	static	void				_RunProcessThreadExit(void* cookie);
27
28			thread_id			fWorker;
29			int32				fStartTimeoutSeconds;
30};
31
32#endif // THREADED_PROCESS_NODE_H
33