RE: [GD-Windows] TryEnterCriticalSection
Brought to you by:
vexxed72
From: Brian H. <bri...@py...> - 2002-01-03 20:40:14
|
> I've used mutexes (mutices?) a lot, for instance when walking > common data structures like network message queues (receive > messages on worker thread, process messages on main thread). That's pretty much exactly what I'm going to be using them for. I need to have synchronized access to my event queue, which may be written to by an external network thread. I don't NEED TryEnterCriticalSection at this point, but I'm trying to make sure that I leave that option open later. Right now I have my HMutex and HCriticalSection class, but the latter can really just be removed if I switch to mutices exclusively (not pun intended). Then again, the HCriticalSection class is all of 30 lines of code, so keeping it around wouldn't hurt. > Maybe more details about how many threads you have going, > what they're doing, how many different places the critical > section is currently being used, etc. would help get answers > that are more useful to you. At this point I'm just trying to get a semblance of a general synchronization architecture in place that can be used for a bunch of different things. The only two concrete areas I have, however, are an audio thread and a network pump. The audio thread presumably needs synchronized access to my direct sound object and buffers, but a hard wait is fine. Same goes with the network pump feeding an event queue -- it's not going to hold a lock for a very long time by any means. -Brian |