Are you really back? and check the types and state of new_state and old_state. if you used: int new_state; and in the function compare_exchange (size_t & state, size_t new_state, size_t old_state) you will get this error, well I did :)
state_data const current_state = interlocked_compare_exchange(&state,new_state,old_state);
add:
return new_state;
source share