Using multithreading
The multithreaded API permits applications to create multiple sessions with the Tivoli® Storage Manager server within the same process. The API can be entered again. Any calls can run in parallel from within different threads.
To run the API in multithreaded mode, set the mtflag value to DSM_MULTITHREAD on the dsmSetUp call. The dsmSetUp call must be the first call after the dsmQueryAPIVersionEx call. This call must return before any thread calls the dsmInitEx call. When all threads complete processing, enter a call to dsmCleanUp. The primary process should not end before all the threads complete processing. See callmt1.c in the sample application.
Restriction: The default for the API is single-thread mode. If an application does not call dsmSetUp with the mtflag value set to DSM_MULTITHREAD, the API permits only one session for each process.
For UNIX or Linux for versions 3.1.6 through version 4.1.2, you cannot use the Trusted Communication Agent in multithread mode. If you want to set the passwordaccess option to generate, you must be an -Authorized user. For version 4.2 and beyond, this is no longer true.
Once dsmSetUp successfully completes, the application can begin multiple threads and enter multiple dsmInitEx calls. Each dsmInitEx call returns a handle for that session. Any subsequent calls on that thread for that session must use that handle value. Certain values are process-wide, environmental variables (values that are set on dsmSetUp). Each dsmInitEx call parses options again. Each thread can run with different options by specifying an overwrite file or an options string on the dsmInitEx call. This enables different threads to go to different servers, or use different node names.
Recommendation: On HP, set the thread stack to 64K or greater. The default value of the thread stack (32K) might not be sufficient
To permit application users to have a LAN-free session, use dsmSetUp mtFlag DSM_MULTITHREAD in your application. This is necessary even if the application is single threaded. This flag activates the threading necessary for the Tivoli Storage Manager LAN-free interface.