Implemenation of an ITK ScopedLock class to simplify the synchronization of the DataStorage object
Synchronization of the DataStorage by using the itk::ScopedLock class and the itk::SimpleFastMutexLock class
• woerner | |
Aug 10 2009, 3:26 PM |
F279: DataStorageSynchronization.patch | |
Aug 31 2009, 1:19 PM |
Implemenation of an ITK ScopedLock class to simplify the synchronization of the DataStorage object
Synchronization of the DataStorage by using the itk::ScopedLock class and the itk::SimpleFastMutexLock class
Status | Assigned | Task | ||
---|---|---|---|---|
Wontfix | kislinsk | T3238 Write unit tests for asynchronous DataStorage access | ||
Resolved | None | T2369 synchronization of the mitk DataStorage in multi threaded scenarios |
The Qt Newsletter has a nice example of a Read/Write Mutex that allows multiple readers, but just one writer and blocks all readers during write access:
http://doc.trolltech.com/qq/qq11-mutex.html
should be quite easy to re-implement with itk::Semaphore and itk::Mutex.
A very nice article covering exactly our problem. Seems easy engough to adapt the code to use itk mutex and semaphore classes.
synchronization was successfully tested on linux. Final synchronization with itk mutexes was commited at revision 18758.
For additional information have a look at http://mitk.org/wiki/internal/Requirements/DataStorageSynchronization
to be sure that no further modifications are necessary the bug remains open for a little while
please extend the unit test to include some testcases for multithreaded access to the datastorage.
Unit tests for multihreaded code are really really hard to do since asynchronous code is non-deterministic by nature. The only thing one could do is to try to provoke deadlocks, but which will not be easily reproducible.
We should definitely try to test *something*, maybe we should discuss this shortly in the MITK meeting.
The DataStorage methods are synchronized, closing this bug. See #3238 for progress on unit testing.
File new bug reports for any new bugs.