07.03.2013 Views

Multithreading Multi-Threaded Programming

Multithreading Multi-Threaded Programming

Multithreading Multi-Threaded Programming

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Example of using CCriticalSection<br />

} Thread functions<br />

// Global Critical section<br />

CCriticalSection c_s;<br />

static int g_C;<br />

//Thread 1, just replace 1 with 2 for ThreadFunction2<br />

UINT ThreadFunction1(LPVOID lParam)<br />

{<br />

CSingleLock lock(&c_s); // Create object for Single Lock<br />

lock.Lock();<br />

for(int i=0;i

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!