yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
f65d756bf
master
1// slang-process.h 2#ifndef SLANG_PROCESS_H 3#define SLANG_PROCESS_H 4 5#include "slang-command-line.h" 6#include "slang-io.h" 7#include "slang-list.h" 8#include "slang-stream.h" 9#include "slang-string-escape-util.h" 10#include "slang-string.h" 11 12namespace Slang 13{ 14 15class Process :public RefObject 16{ 17public : 18typedef uint32_t Flags ; 19struct Flag 20 { 21enum Enum :Flags 22 { 23// Ignored on non-Windows platforms 24AttachDebugger = 0x01 , 25DisableStdErrRedirection = 0x02 26 }; 27 }; 28 29/// Get the stream for the type 30Stream * getStream (StdStreamType type )const {return m_streams [Index (type )]; } 31 32/// Get the value returned from the process when it exited/returned. 33int32_t getReturnValue ()const {return m_returnValue ; } 34 35/// True if the process has terminated 36virtual bool isTerminated ()= 0 ; 37 38/// Blocks until the process has terminated or the timeout completes 39/// Can optionally supply a timeout time. -1 means 'infinite' and is the default. 40/// Note that the timeOut is only used approximately. 41/// Returns true if has terminated. 42virtual bool waitForTermination (Int timeOutInMs = -1 )= 0 ; 43 44/// Terminate the process gracefully. 45/// After calling it may take time before the process actually terminates 46/// Ie calling isTerminated directly after `terminate` may return false. 47/// The return code depending on implementation/termination style, may not be set. 48virtual void terminate (int32_t returnCode )= 0 ; 49 50/// Kill the process - attempt to terminate immediately. 51virtual void kill (int32_t returnCode )= 0 ; 52 53/// The quoting style used for the command line on this target. Currently just uses Space, 54/// but in future may take into account platform sec 55static StringEscapeHandler * getEscapeHandler (); 56 57/// Get the suffix used on this platform 58static UnownedStringSlice getExecutableSuffix (); 59 60/// Create a process using the executable/args defined from the commandLine 61static SlangResult create ( 62const CommandLine & commandLine , 63Process ::Flags flags , 64RefPtr < Process >& outProcess ); 65 66/// Sleep the current thread for time specified in milliseconds. 0 indicates to OS ok to yield 67/// this thread. 68static void sleepCurrentThread (Int timeInMs ); 69 70/// Get a standard stream 71static SlangResult getStdStream (StdStreamType type ,RefPtr < Stream >& out ); 72 73/// Get the clock frequency 74static uint64_t getClockFrequency (); 75 76/// Get the clock tick. 77static uint64_t getClockTick (); 78 79static uint32_t getId (); 80 81protected : 82int32_t m_returnValue = 0 ;///< Value returned if process terminated 83RefPtr < Stream > 84m_streams [Index (StdStreamType ::CountOf )];///< Streams to communicate with the process 85}; 86 87}// namespace Slang 88 89#endif // SLANG_PROCESS_H