Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

more::cf Namespace Reference

Control flow. More...



Detailed Description

Control flow.

Exception infrastructure, signals, threads and nondeterminism. Also in this category, if added later, are event loops and scheduling. Depends on: The gen and util packages.

Function Documentation

bool caller_is_canceled  

True iff cancel is requested for this thread.

void checkpoint   [inline]

Check for signals, thread cancels and such at this point.

The actual code that is run by checkpoint is registered with register_pointchecker. It is typically used to throw exceptions upon signals or thread cancel.

void enable_delayed_interrupt  

Handle SIGINT so that it does not quit the program at once but allows the application to clean up.

After the first SIGINT, a message is printed to the screen saying that CTRL-C must be pressed once more for immediate termination, and that is what happens if the program receives another SIGINT. If checkpoint() is called before that, an exception is thrown, giving the application a chance to make a breathtaking exit.

template<typename SignalException>
void handle_signal SignalException const &    xc

Handle the signal that will cause xc to be thrown.

void handle_signal int    sig

Install a pointchecker to throw an exception upon the signal sig.

void notify_foreign_thread  

Report that there is one more fereign thread running.

By foreign thread is meant one that is not created by libmore. This function must be called _before_ the thread is started. If you run foreign threads and don't want to bother, just call notify_foreign_thread() once at startup. If you don't need to access the libmore objects from these foreign threads, you don't need to call this function at all.

void register_pointchecker void(*   )()

Register a function to be run by checkpoint.

It is important to the efficiency to keep the number of registered pointcheckers at an absolute minimum, as checkpoint must call them all. Therefore, the intention is that each library using libmore registers only one pointchecker if reeded, and does all checks there. There is an arbitrary limit of to the number of pointcheckers that can be registered, and an exception is thrown if this limit is exceeded.

bool there_are_only_threads   [inline]

True iff the caller is the only thread.

This provides a quick check whether mutex locking is needed.

thread thread_of_caller  

The thread descriptor of the thread from which this function is called.

The main thread returns an undefined descriptor at the moment, though this may change.

void unnotify_foreign_thread  

Report that there is one less foreign (not created by libmore) thread running.

This must be called _after_ the thread is stopped.

void unregister_pointchecker void(*   )()

Unregister a function registered by register_pointchecker.

Generated on Sat Sep 7 19:12:01 2002 for more with Doxygen Doxygen is written and copyright 1997-2002 by Dimitri van Heesch.