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
This is not needed anymore due to the rootmap facility which automatically loads the needed libraries.
void *handle(void *ptr)
{
long nr = (long) ptr;
for (
int i = 0;
i < 10;
i++) {
}
return 0;
}
void threads()
{
printf("Starting Thread 1\n");
printf("Starting Thread 2\n");
printf("Starting Thread 3\n");
}
<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.