Multiple Threads and
VixDiskLibLast Updated December 19, 2024
VDDK supports concurrent I/O to multiple
virtual disks, with certain limitations:
- VixDiskLib_InitEx()orVixDiskLib_Init()should be called once per process, from the main thread.
- In theVixDiskLib_InitEx()orVixDiskLib_Init()function call, do not specify logging callbacks as NULL. This causes VixDiskLib to provide its default logging functions, which are not thread safe. If you are using VDDK in a multithreaded environment, you must provide your own thread-safe log functions.
- When you callVixDiskLib_Open()andVixDiskLib_Close(), VDDK initializes and uninitializes a number of libraries, some of which do not work if called from multiple threads. For example, this fails:The workaround is to use one designated thread to do all opens and closes, and to have other worker threads doing reads and writes. This diagram shows concurrent reads on two separate disk handles. Concurrent reads on the same disk handles are not allowed.