Many times when you are running a multi-process or multi-threaded program, you want to synchronize execution to the same place. You can do this manually using a hold command, or automatically by setting a barrier point.
When a process or a thread is held, it ignores any command to resume executing. For example, assume that you place a hold on a process in a control group that contains three processes. If you select Group > Go, two of the three processes resume executing. The held process ignores the Go command.
Use the Release command to remove the hold. When you release a process or a thread, it can resume execution, but you still need to tell it to do so. That is, you must resume execution with a command such as Go, Out, or Step.
Manually holding and releasing processes and threads is useful when:
• You need to run a subset of the processes and threads. You can manually hold all but the ones you want to run.
• A process or thread is held at a barrier point and you want to run it without first running all the other processes or threads in the group to that barrier. In this case, you release the process or the thread manually and then run it.
See "Setting Barrier Points" for more information on manually holding and releasing barrier breakpoints.
When TotalView is holding a process, the Root Window displays Stopped, and the Process Window displays a held indicator, which is the uppercase letter H. When TotalView is holding a thread, it displays a lowercase h.
You can hold or release a thread, process, or group of processes in one of the following ways:
• You can hold a group of processes using the Group > Hold command.
• You can release a group of processes using the Group > Release command.
• You can toggle the hold/release state of a process by selecting and clearing the Process > Hold command.
• You can toggle the hold/release state of a thread by selecting and clearing the Thread > Hold command.
If a process or a thread is running when you use a hold or release command, TotalView stops the process or thread and then holds it. TotalView lets you hold and release processes independently from threads.
The Process pulldown menu contains the commands Hold Threads and Release Threads, which act on all the threads in a multi-process program. The result is seldom what you actually want as you really do want something to run. You can select one or more threads and use the Thread > Hold toggle command to clear them so that TotalView lets them run. This may appear awkward, but it is actually an easy way to run just one or more threads when your program has a lot of threads. You can verify that you’re doing the right thing by looking at the thread status in the Root Window.
CLI: dhold -thread
dhold -process
dunhold -thread
Here are some examples of using hold commands:
Held/Release State
What Can Be Run Using Process > Go
This figure shows a process with three threads. Before you do anything, all threads in the process can be run.
Select the Process > Hold toggle. The blue shading indicates that you held the process.
Nothing runs when you select Process > Go.
Go to the Threads menu. The button next to the Hold command isn’t selected. This is because the thread hold state is independent from the process hold state.
Select it. The circle indicates that thread 1 is held. At this time, there are two different holds on thread 1. One is at the process level; the other is at thread level.
Nothing will run when you select Process > Go.
Select the Process > Hold command.
Select Process > Go. The second and third threads run.
Select Process > Release Threads. This releases the hold placed on the first thread by the Thread > Hold command. You could also release the thread individually with Thread > Hold.