TotalView Reference Guide : Part I: CLI Commands : Creating Type Transformations : C++View : Multithreading
Multithreading
Accessing shared data in multithreaded environments will usually need some sort of access control mechanism to protect its consistency and correctness. Your TV_ttf_display_type functions must be coded carefully if they need to access data that are usually protected by a lock or mutex. Attempting to take the lock or mutex may result in deadlock if the mutex is already locked.
Usually the threads in the program will have been stopped when TotalView calls the TV_ttf_display_type function. If the mutex is locked before TotalView calls TV_ttf_display_type, then an attempt by TV_ttf_display_type to lock the mutex will result in deadlock.
If you are designing a TV_ttf_display_type that needs to access data usually protected by a lock or mutex, consider whether you are able to determine whether the data are in a consistent state without having to take the lock. It might be enough to be able to determine whether the mutex is locked. If the data cannot be accessed safely, have the TV_ttf_display_type return TV_ttf_format_failed or TV_ttf_format_raw according to what fits best with your requirements.