I'm writing some code where the UI thread need to communicate with the background thread doing network communication. The code works, but would it be considered thread safe?
I would feel a lot better if someone experienced could lead me on to the right path on this...
static Mutex^ mut_currentPage = gcnew Mutex;
static array<unsigned char>^ m_currentPage;
property array<unsigned char>^ Write
{
void set(array<unsigned char>^ value)
{
mut_currentPage->WaitOne();
m_currentPage = value;
mut_currentPage->ReleaseMutex();
}
}
This is .NET C++ code... :)