Sunday, June 28, 2009

Synchronization of multiple reader and writer processes using Mutex

void CServer::WriteToMemory()
{
mutex.Lock();
switch memory page
...
...
write something
...
...
mutex.Unlock();
}
void CServer::ReadFromMemory()
{
mutex.Lock();
get last writen memory page
mutex.Unlock();
...
...
read something
...
...
}

No comments:

Post a Comment