future_thread |
A future thread can be used to process information and store the value for later use when it is done processing. This permits the application to be independent of when the thread actually will finish processing and to retrieve the return value anytime after it is available. This feature enables support for asynchronous operations.
To create a new future thread, construct an os_future_thread
with the address of a function, an optional pointer to an argument, and an
optional address of a callback function. This creates a thread that executes the
specified function with the supplied pointer as its argument and the specified
callback function with the pointer to the return value as its argument. The
functions must be able to take a void* argument and
return a void* .
Once constructed, an os_future_thread
object contains functions for starting, changing the user functions, and
retrieving the value. The new thread executes concurrently with other threads in
the process and can be restarted again.
Thread<ToolKit>
#include <ospace/thread/futurthd.h>
class os_future_thread
0 ), and with a pointer to the
callback function, cb_func (default 0
).0
). The void* run() method of runnable
is invoked when the thread is started. Note that the compiler must be able
to support member templates and OS_ENABLE_MEMBER_TEMPLATE_FEATURES must be
defined to use this member function.os_future_thread
constructor.os_future_thread
constructor. Note that the compiler must be able to support member templates
and OS_ENABLE_MEMBER_TEMPLATE_FEATURES must be defined to use this member
function.Throws: os_thread_toolkit_error
Copyright©1994-2026 Recursion
Software LLC
All Rights Reserved - For use by licensed users only.