Question for --> itsmeandnobodyelse: Continued help with shared mutex for multiple thread application
Posted on 2006-04-28
Taking my final comments from the last question which I closed, I'd like to apply them to the general idea you proposed below. My threads are going to have this behavior:
1) Obtain data by constantly reading sockets
2) As the data is obtained they will access the Queue
3) Once they have possesion to access the Queue they will seek out the head position and update it
4) The main thread will make a decision as to whether the head of the queue has enough information to go on
5) If all is well the head structure is removed/landed, otherwise it is moved to the end.
An alternative to the approach above is that each thread stores their own data structures and these data structures are globally accessed/shared so that information may be pulled into the queue by the primary thread/tower.
At any rate, I'd like to put something into my project today and see that something, anything, compiles which is related to a mutex library. At this point, I don't have anything to make a header file with that supports mutex functions. I need to see that I'm making that kind of headway - thank you.
Mutex m_cs; // how is the variable type 'Mutex' supported ? what # include <> ?
void updateAircraftData(int aircraftID)
// if we come here we have exclusive access
Aircraft& cur = m_aircrafts[aircraftID];
// make the update
// Now the resource is unlocked