CORBA 2.6.1 Programmer's Guide for C++

To retrieve the value of a 32–bit entry in the table, call the specific_get() method, passing the associated key returned by
specific_key_create().
Terminating Execution of a Thread
In a multithreaded process, you must explicitly exit each thread created by the process. This must be done because an application process can
be designed to run for an extended period of time, and the threads will be present as long as the process is running.
Use
Fw_Thread::Exit to terminate the execution of a thread.
Detaching a Thread
Detaching a thread notifies the system that it can reclaim the resources it has allocated to the thread as soon as the thread is terminated.
Detaching a thread has no immediate effect on a running thread. Your application should call the
Fw_Thread::detach(threadId) function when it
determines it does not need to know when a thread completes and has no interest in any context returned by the thread on exit.
Note:
When the system takes ownership of the thread, a caller to the create method should destroy the thread pointer using
a delete command.
Error Reporting from vthread Methods
The methods in the vthread API return error status in the OSS errno variable. If the result of any method is null, your application should check
errno.
Using a Timer for a Thread
The NonStop CORBA portability and event framework includes a timer mechanism that can be used in multithreaded programs. This
mechanism allows a thread to put itself to sleep for a specified period. At the end of the set period, the thread becomes ready to run.
This timer mechanism is implemented by the
NSDEFw_Timer class, defined in the header file timer.h in the $NSD_ROOT/include/nsdevent product
subdirectory. It uses methods from the thread package (
vthread.h) internally.
To create and use a timer for a thread, perform the following steps:
1. Include the
$NSD_ROOT/include/nsdevent/timer.h header file in your program:
#include <nsdevent/timer.h>
2. Declare and initialize a timer, as in the following example that sets a five-second timer:
NSDEFw_Timer::my_app_timer (5*Fw_Time_Stamp::Ticks_Per_Second);
3. At the point in the thread where a pause is required, call the NSDEFw_Timer.wait() function to wait for the set time period:
my_app_timer.wait();
Note:
The
timer.h header file contains additional classes and methods; however, HP recommends you use only
NSDEFW_Timer.wait(). The other classes and methods in timer.h are useful primarily to NonStop CORBA internal
code.
Chapter 7. Managing Transactions Chapter 9. Designing Advanced Applications