[mapguide][MG35][Modified] Improve tile service thread-safety

Walt Welton-Lair walt.welton-lair at autodesk.com
Tue Feb 28 03:00:13 EST 2006


You can view the artifact detail at the following URL:

    https://mapguide.osgeo.org/servlets/Scarab/id/MG35

Type:
OS:Issue

Artifact ID:
MG35 (Improve tile service thread-safety)

Modified by:
Walt Welton-Lair
waltweltonlair (walt.welton-lair at autodesk.com)

The following modifications were made to this artifact:
---------------------------------------------------------------------

-- OS:Resolution Description set to new value:
Old value:
The fix for this is easy, and also cleans up the code.  ACE defines an ACE_RW_Mutex class, which is used to synchronize read /write operations.  In particular, multiple simultaneous reads are allowed, but only one write can occur at any one time.  Also, no reads are allowed while a write is active.

So in MgTileCache::GetTile, we simply acquire a read lock.  This blocks if a write lock is already active.  And then in SetTile and ClearCache we acquire a write lock.  This blocks if there are any read locks or a write lock active.
New value:
The fix for this is easy and also cleans up the code.  ACE defines an ACE_RW_Mutex class, which is used to synchronize read /write operations.  In particular, multiple simultaneous reads are allowed, but only one write can occur at any one time.  Also, no reads are allowed while a write is active.

So in MgTileCache::GetTile we now simply acquire a read lock.  This blocks if a write lock is already active.  And then in SetTile and ClearCache we simply acquire a write lock.  This blocks if there are any read locks or a write lock active.




---------------------------------------------------------------------
This message was automatically generated by Project Tracker.








More information about the Mapguide_issues mailing list