Skip to Content

Working with multi-threaded applications on HP-UX

Estimated Reading Time: 1 Minutes

Every thread created on the system has a separate stack. The size of a thread's stack is usually fixed in a POSIX thread implementation. Some systems such as HP-UX have a default stack size which does not accommodate common Adobe PDF Library or DLI workflows.

To increase the stack size in a C/C++ program, call pthread_attr_setstacksize for the pthread_attr_t used to create the thread.

For example:

  pthread_t threadHandle;
           pthread_attr_t threadAttr;
           size_t defaultStackSize;
 
           pthread_attr_init(&threadAttr);
           pthread_attr_getstacksize(&threadAttr, &defaultStackSize);
           if (defaultStackSize < 262144) /* 256KB stack */
           {
               pthread_attr_setstacksize(&threadAttr, 262144);
           }
           pthread_create(&threadHandle, &threadAttr,
               [Function to execute], [Data pointer]);
           pthread_attr_destroy(&threadAttr);

 

In Java, use the -Xss parameter to set the default thread stack size when executing the Java VM. For example, try setting Xss to 262144 or larger, like this:

 -Xss 262144

Working with multi-threaded applications on HP-UX
  • COMMENT