In multithreaded programs, disk requests should be serialized by the client program. Disk handles are not bound to a thread and may be used across threads. You can open a disk in one thread and use its handle in another thread, provided you serialize disk access. Alternatively you can use a designated open-close thread, as shown in the workaround below.
■ VixDiskLib_InitEx() or VixDiskLib_Init() should be called only once per process. VMware recommends that you call them from the main thread.
■ In the VixDiskLib_InitEx() or VixDiskLib_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 call VixDiskLib_Open() and VixDiskLib_Close(), VDDK initializes and uninitializes a number of libraries. Some of these libraries fail to work if called from multiple threads. For example, the following call sequence does not work: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.