2021-06-27 21:25:29 +00:00
|
|
|
/***
|
|
|
|
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
|
|
|
|
File: IProcess.hpp
|
|
|
|
Date: 2021-6-9
|
|
|
|
Author: Reece
|
|
|
|
***/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
namespace Aurora::Threading
|
|
|
|
{
|
|
|
|
class IWaitable;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace Aurora::Processes
|
|
|
|
{
|
|
|
|
class IProcess
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
///
|
|
|
|
/// @return the waitable of a waitable child process or thread leader
|
2021-09-06 10:58:08 +00:00
|
|
|
virtual AuSPtr<Threading::IWaitable> AsWaitable() = 0;
|
|
|
|
|
2021-06-27 21:25:29 +00:00
|
|
|
/// Assuming AsWaitable()->TryLock() && Spawn != SpawnType::kSpawnAtomicOvermap,
|
|
|
|
/// returns the true return value of the process
|
|
|
|
/// otherwise returns zero
|
|
|
|
virtual AuSInt GetExitCode() = 0;
|
|
|
|
|
2022-01-26 00:01:06 +00:00
|
|
|
virtual AuUInt GetProcessId() = 0;
|
|
|
|
|
2021-06-27 21:25:29 +00:00
|
|
|
///
|
2021-11-05 17:34:23 +00:00
|
|
|
// TODO(Reece): what in the hell this is ugly
|
2021-06-27 21:25:29 +00:00
|
|
|
virtual bool Start(enum ESpawnType, bool fwdOut, bool fwdErr, bool fwdIn) = 0;
|
|
|
|
|
|
|
|
virtual bool Terminate() = 0;
|
|
|
|
virtual bool TryKill() = 0;
|
|
|
|
|
|
|
|
virtual bool Read(bool error, void *buffer, AuUInt32 &len) = 0;
|
2022-01-17 15:21:36 +00:00
|
|
|
virtual bool Read(void *buffer, AuUInt32 &len, bool errorStream = false, bool nonblock = true) = 0;
|
2021-06-27 21:25:29 +00:00
|
|
|
virtual bool Write(const void *buffer, AuUInt32 len) = 0;
|
|
|
|
};
|
|
|
|
}
|