When you call
VixDiskLib_Open() and
VixDiskLib_Close(), VDDK
initializes and uninitializes a number of libraries, some of which do not work
if called from multiple threads. For example, this fails:
Thread 1: VixDiskLib_Open ...... VixDiskLib_Close
Thread 2: ................................... VixDiskLib_Open ...... VixDiskLib_Close
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.
Open/Close Thread:
VixDiskLib_Open ...... VixDiskLib_Open ...... VixDiskLib_Close ...... VixDiskLib_Close ......
(handle1) (handle2) (handle1) (handle2)
I/O Thread 1:
(owns handle1) VixDiskLib_Read ... VixDiskLib_Read ...
I/O Thread 2:
(owns handle2) VixDiskLib_Read ... VixDiskLib_Read ...
|