I'm pretty new to SlimDX/DirectX so bare with me. I have this application (programmed using Visual Studio 2008, .NET2, C#) that gets map tiles from an online service and then renders them on the screen. Tiles are fetched asynchronously (using multiple threads, core count - 1).
The problem is that when I call Texture.LockRectangle(0, LockFlags.None) the application freezes when I pan or zoom the chart. New tiles are fetched from the online service depending on how the map is panned/zoomed (like in e.g. Googe Maps). If I have gotten this right DirectX's Map is equivalent to LockRectangle and Unmap to UnlockRectangle. I have read some DirectX documentation but haven't found anything about blocking the calling thread.
I haven't programmed this application but I have to fix so I cannot provide you with any thorough description how it works. I'm just wondering is there a situation where LockRectangle blocks the calling thread until the previous lock/unlock has been processed? The method that uses LockRectangle also uses UnlockRectangle at the end. I've also put the code between inside try/catch but it never catches anythig - i.e. everything should be okay when it comes to calling this particular method. I've also used Console.WriteLine to ouput "lock" and "unlock" to see that there are event count of both. Natually the outputting ends in "lock" because the application freezes.
I've gone through the code for a couple of days and there are a lot of "lock" keywords so thread synchronization is at least considered. Not sure if it works completely because most of the time the tile object itself is locked instead of dedicated Object instance. Well anyway, let's assume that the thread related code works...
One thing to mention is that there is this Tile class that holds the actual SlimDX Texture object and the texture object is disposed from Tile's finalizer ("destructor"). When I comment out the line where the texture object is disposed the application does not freeze. Naturally the texture object then does not get released from the memory.
So, here's something to begin with. Ask away if you need to know something and naturally try to keep your question/answers as simple as possible.
Thanks in advance.