opdenkamp/xbmc — comment on commit 685069db175b0548696f54a0a383fa519a922a30
File:  line 0
By FernetMenta:

Just for completeness:
cas returns the previous value which is not casted. This would have done the trick as well.

```
void CPVRManager::SetState(ManagerState state)
{
long oldstate = m_managerState;
while(oldstate != (ManagerState)cas((volatile long*)(&m_managerState), oldstate, state))
oldstate = m_managerState;
return;
}
```