-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rwmutex block #39
Closed
Closed
Rwmutex block #39
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… a global way, this converts the cache size limit to per dataset
… once the dataset is deleted.
…with RasterBands that do not have a dataset.
…heMax in various spots in the code. In many situations this should be pulling the size of the non global cache size in the situation where a dataset specific cache size was specified. Added methods to access the RBM from the Dataset and RasterBand as well.
…heMax in various spots in the code. In many situations this should be pulling the size of the non global cache size in the situation where a dataset specific cache size was specified. Added methods to access the RBM from the Dataset and RasterBand as well.
…ible order all to fix a very small problem
…ng protected object.
…r during driver destruction.
…es during rasterio operations.
… a global way, this converts the cache size limit to per dataset
… once the dataset is deleted.
…with RasterBands that do not have a dataset.
…heMax in various spots in the code. In many situations this should be pulling the size of the non global cache size in the situation where a dataset specific cache size was specified. Added methods to access the RBM from the Dataset and RasterBand as well.
…heMax in various spots in the code. In many situations this should be pulling the size of the non global cache size in the situation where a dataset specific cache size was specified. Added methods to access the RBM from the Dataset and RasterBand as well.
…ng protected object.
…r during driver destruction.
…es during rasterio operations.
…eventing a segfault when destroying a mutex that was already NULL.
…atasets in a multi-threaded manner.
… a global way, this converts the cache size limit to per dataset
… once the dataset is deleted.
…with RasterBands that do not have a dataset.
…heMax in various spots in the code. In many situations this should be pulling the size of the non global cache size in the situation where a dataset specific cache size was specified. Added methods to access the RBM from the Dataset and RasterBand as well.
For more details on this change please see: |
…le prior to the adding the lock for it on another thread. This could cause the block to be deleted while another thread was still attempting to operate on the block
…if a block was added to the Band block array prior to being read, it could cause the block to be empty when read via TryGetLockedBlockRef
@@ -1127,6 +1130,11 @@ static void *CPLCreateMutexInternal(int bAlreadyInGlobalLock); | |||
int CPLCreateOrAcquireMutex( void **phMutex, double dfWaitInSeconds ) | |||
|
|||
{ | |||
// Check before going into the global lock, otherwise | |||
// we risk using the global lock too often. | |||
if ( NULL != *phMutex ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Write a test to make sure that this isn't occuring http://en.wikipedia.org/wiki/Double-checked_locking
…to be intialized.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
ZOMG THE CHANGES!
This is a pull requests of a different way of dealing with caching, and reads and writes in GDAL. The biggest part of this change is the addition of a different way to do IReadBlock, IWriteBlock, IRasterIO, etc. There is now a mutex being passed as well as the data, so that the source data might be protected during writing. It also prevents deadlocks by being very picky in the drivers when it locks and when it does not. The downside is obvious. LOTS OF CHANGES, lots to go wrong.
I haven't fully tested everything yet, but wanted to put this here so we can compare against the other ways doing the locking.