AXCEL C++ Framework
Elegance through abstraction
Classes | Functions
axcel::proc Namespace Reference

Process and runtime. More...

Classes

class  thread
 Multithreading. More...
class  library
 Dynamic library loading. More...
class  mutex
 Mutex. More...
class  semaphore
 Semaphore. More...
class  pstream
 Pipe stdin and stdout of a process. More...
class  environment
 Build an environment block. More...

Functions

string lsproc ()
 List processes.
pid_t run (const char *program, const char *argv, void *envp)
 Spawn new process.
bool killp (size_t pid)
 Kill process.
bool killp (const char *name)
 Kill process.
bool freeze (size_t pid)
 Suspend process.
bool freeze (const char *name)
 Suspend process.
bool cont (size_t pid)
 Resume process.
bool cont (const char *name)
 Resume process.
void delay (size_t ms)
 Sleep current thread.
bool envset (const char *name, const char *value)
 Set environment variable.
string envget (const char *name)
 Get environment variable.
sem_t * mksem (const char *name, size_t count)
bool rmsem (const char *name)

Detailed Description

Process and runtime.


Function Documentation

bool axcel::proc::cont ( size_t  pid)

Resume process.

Parameters:
pidProcess ID of process
Returns:
true success, false failure

Definition at line 6124 of file axcel.cpp.

bool axcel::proc::cont ( const char *  name)

Resume process.

Parameters:
nameName of process
Returns:
true success, false failure

Definition at line 6125 of file axcel.cpp.

void axcel::proc::delay ( size_t  ms)

Sleep current thread.

Parameters:
msNumber of milliseconds to sleep

Definition at line 6158 of file axcel.cpp.

string axcel::proc::envget ( const char *  name)

Get environment variable.

Parameters:
nameName of variable
Returns:
string object containing value of variable

Definition at line 6168 of file axcel.cpp.

bool axcel::proc::envset ( const char *  name,
const char *  value 
)

Set environment variable.

Parameters:
nameName of variable
valueValue to set (If NULL, variable is deleted)
Returns:
true success, false failure

Definition at line 6164 of file axcel.cpp.

bool axcel::proc::freeze ( size_t  pid)

Suspend process.

Parameters:
pidProcess ID of process
Returns:
true success, false failure

Definition at line 6090 of file axcel.cpp.

bool axcel::proc::freeze ( const char *  name)

Suspend process.

Parameters:
nameName of process
Returns:
true success, false failure

Definition at line 6091 of file axcel.cpp.

bool axcel::proc::killp ( size_t  pid)

Kill process.

Parameters:
pidProcess ID of process
Returns:
true success, false failure

Definition at line 6053 of file axcel.cpp.

bool axcel::proc::killp ( const char *  name)

Kill process.

Parameters:
nameName of process
Returns:
true success, false failure

Definition at line 6057 of file axcel.cpp.

string axcel::proc::lsproc ( )

List processes.

Returns:
string containing each process on a new line in the form "PID:NAME"

Definition at line 6008 of file axcel.cpp.

axcel::proc::mksem ( const char *  name,
size_t  count 
)
Parameters:
nameName of semaphore initial value of semaphore
Returns:
Handle to semaphore

Definition at line 6624 of file axcel.cpp.

bool axcel::proc::rmsem ( const char *  name)
Parameters:
nameName of semaphore to remove
Returns:
true success, false failure

Definition at line 6635 of file axcel.cpp.

pid_t axcel::proc::run ( const char *  program,
const char *  argv,
void *  envp 
)

Spawn new process.

Returns:
pid of new process

Forks and executes the program pointed to by program. program must be either a binary executable, or a script starting with a line of the form:

#! interpreter [optional-arg]

See execve(2) from man pages for details on the script. argv should point to the command line to pass to this program if specified. envp should point to a null-terminated array of C-strings, each of which in the form "NAME=VALUE" for the process's environment if specified.

Definition at line 6031 of file axcel.cpp.

 All Classes Namespaces Files Functions Variables Typedefs Enumerator Defines