18.07.2013 Views

Mutual Exclusion dan Sinkronisasi - Komputasi

Mutual Exclusion dan Sinkronisasi - Komputasi

Mutual Exclusion dan Sinkronisasi - Komputasi

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Instruksi Compare&Swap<br />

int compare_and_swap (int *word, int testval, int newval)<br />

{<br />

int oldval;<br />

oldval = *word;<br />

if (oldval == testval) *word = newval;<br />

return oldval;<br />

}<br />

21

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

Saved successfully!

Ooh no, something went wrong!