Graphite
Version 3
An experimental 3D geometry processing program
|
Abstraction layer for process management and multi-threading. More...
Classes | |
class | BasicSpinLockArray |
An array of light-weight synchronisation primitives (spinlocks). More... | |
class | CompactSpinLockArray |
An array of light-weight synchronisation primitives (spinlocks). More... | |
Typedefs | |
typedef std::atomic_flag | spinlock |
A lightweight synchronization structure. More... | |
typedef CompactSpinLockArray | SpinLockArray |
Functions | |
void | initialize (int flags) |
Initializes GeogramLib. More... | |
void | terminate () |
Terminates GeogramLib. More... | |
void | sleep (index_t microseconds) |
Sleeps for a period of time. More... | |
void | show_stats () |
Displays statistics about the current process. More... | |
void | brute_force_kill () |
Terminates the current process. | |
index_t | maximum_concurrent_threads () |
Returns the maximum number of threads that can be running simultaneously. More... | |
void | run_threads (ThreadGroup &threads) |
Runs a set of threads simultaneously. More... | |
index_t | number_of_cores () |
Gets the number of available cores. More... | |
void | set_thread_manager (ThreadManager *thread_manager) |
Sets the thread manager (internal use). More... | |
bool | is_running_threads () |
Checks whether threads are running. More... | |
void | enable_FPE (bool flag) |
Enables/disables floating point exceptions. More... | |
bool | FPE_enabled () |
Gets the status of floating point exceptions. More... | |
void | enable_multithreading (bool flag) |
Enables/disables multi-threaded computations Multi-threading can also be configured by setting the value of the property "sys:multithread" with Environment::set_value(). More... | |
bool | multithreading_enabled () |
Gets the status of multi-threading. More... | |
void | set_max_threads (index_t num_threads) |
Limits the number of concurrent threads to use. More... | |
index_t | max_threads () |
Gets the number of allowed concurrent threads. More... | |
void | enable_cancel (bool flag) |
Enables interruption of cancelable tasks. More... | |
bool | cancel_enabled () |
Gets the status of the cancel mode. More... | |
size_t | used_memory () |
Gets the currently used memory. More... | |
size_t | max_used_memory () |
Gets the maximum used memory. More... | |
std::string | executable_filename () |
Gets the full path to the currently running program. | |
void | print_stack_trace () |
Prints a stack trace to the standard error. | |
bool | os_init_threads () |
index_t | os_number_of_cores () |
size_t | os_used_memory () |
size_t | os_max_used_memory () |
bool | os_enable_FPE (bool flag) |
bool | os_enable_cancel (bool flag) |
void | os_install_signal_handlers () |
std::string | os_executable_filename () |
void | os_brute_force_kill () |
void | os_print_stack_trace () |
void | acquire_spinlock (volatile spinlock &x) |
Loops until x is available then reserves it. More... | |
void | release_spinlock (volatile spinlock &x) |
Makes x available to other threads. More... | |
Abstraction layer for process management and multi-threading.
typedef std::atomic_flag GEO::Process::spinlock |
|
inline |
Loops until x
is available then reserves it.
[in] | x | a spinlock |
Definition at line 155 of file thread_sync.h.
bool GEO::Process::cancel_enabled | ( | ) |
Gets the status of the cancel mode.
true | if the cancel mode is enabled |
false | otherwise |
void GEO::Process::enable_cancel | ( | bool | flag | ) |
Enables interruption of cancelable tasks.
This allows to interrupt cancelable tasks by typing CTRL-C in the terminal. This sets a specific handler on the interrupt signal that calls Progress::cancel() is there is a running cancelable task. If no task is running, the program is interrupted. The cancel mode can also be configured by setting the value of the property "sys:cancel" with Environment::set_value().
[in] | flag | set to true to enable cancel mode, false to disable. |
void GEO::Process::enable_FPE | ( | bool | flag | ) |
Enables/disables floating point exceptions.
If FPEs are enabled, then floating point exceptions raise a SIGFPE signal, otherwise they generate NaNs. FPEs can also be configured by setting the value of the property "sys:FPE" with Environment::set_value().
[in] | flag | set to true to enable FPEs, false to disable. |
void GEO::Process::enable_multithreading | ( | bool | flag | ) |
Enables/disables multi-threaded computations Multi-threading can also be configured by setting the value of the property "sys:multithread" with Environment::set_value().
[in] | flag | set to true to enable multi-threading, false to disable. |
bool GEO::Process::FPE_enabled | ( | ) |
Gets the status of floating point exceptions.
true | if FPE are enabled |
false | otherwise |
void GEO::Process::initialize | ( | int | flags | ) |
Initializes GeogramLib.
[in] | flags | the flags passed to GEO::initialize() |
This function must be called once before using any functionality of GeogramLib.
bool GEO::Process::is_running_threads | ( | ) |
Checks whether threads are running.
true | if concurrent threads are currently running as an effect to Process::run_threads(). |
false | otherwise. |
index_t GEO::Process::max_threads | ( | ) |
Gets the number of allowed concurrent threads.
size_t GEO::Process::max_used_memory | ( | ) |
Gets the maximum used memory.
index_t GEO::Process::maximum_concurrent_threads | ( | ) |
Returns the maximum number of threads that can be running simultaneously.
The | number of cores if multi-threading is supported |
1 | otherwise. |
bool GEO::Process::multithreading_enabled | ( | ) |
Gets the status of multi-threading.
true | if multi-threading is enabled |
false | otherwise |
index_t GEO::Process::number_of_cores | ( | ) |
Gets the number of available cores.
|
inline |
Makes x
available to other threads.
[in] | x | a spinlock |
Definition at line 173 of file thread_sync.h.
void GEO::Process::run_threads | ( | ThreadGroup & | threads | ) |
Runs a set of threads simultaneously.
Launches the execution of the threads contained in the vector threads
and waits for the completion of all of them.
void GEO::Process::set_max_threads | ( | index_t | num_threads | ) |
Limits the number of concurrent threads to use.
The number of threads can also be configured by setting the value of the property "sys:max_threads" with Environment::set_value().
[in] | num_threads | maximum number of threads to use. |
void GEO::Process::set_thread_manager | ( | ThreadManager * | thread_manager | ) |
Sets the thread manager (internal use).
This sets the ThreadManager to use for concurrent thread execution. This function is called internally by Process::initialize() and should not be called explicitly.
void GEO::Process::show_stats | ( | ) |
Displays statistics about the current process.
Displays the maximum used amount of memory.
void GEO::Process::sleep | ( | index_t | microseconds | ) |
Sleeps for a period of time.
[in] | microseconds | the time to sleep, in microseconds. |
void GEO::Process::terminate | ( | ) |
Terminates GeogramLib.
This function is called automatically when the program exits, so it should never be called directly.
size_t GEO::Process::used_memory | ( | ) |
Gets the currently used memory.