Example of a simple script creating 3 threads.
This script can only be executed via ACliC: .x threads.C++. Before executing the script, load the Thread library with:
R__EXTERN TSystem * gSystem
virtual int Load(const char *module, const char *entry="", Bool_t system=kFALSE)
Load a shared library.
This is not needed anymore due to the rootmap facility which automatically loads the needed libraries.
void *handle(void *ptr)
{
for (int i = 0; i < 10; i++) {
}
return 0;
}
{
printf(
"Starting Thread 1\n");
printf(
"Starting Thread 2\n");
printf(
"Starting Thread 3\n");
}
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
virtual void Sleep(UInt_t milliSec)
Sleep milliSec milli seconds.
<div class="legacybox"><h2>Legacy Code</h2> TThread is a legacy interface: there will be no bug fixes...
static void Ps()
Static method listing the existing threads.
static void Printf(const char *fmt,...)
Static method providing a thread safe printf. Appends a newline.
- Author
- Victor Perevovchikov
Definition in file threads.C.