diff --git a/src/rx/rx.h b/src/rx/rx.h index 6d7ab24717..51a2f01df8 100644 --- a/src/rx/rx.h +++ b/src/rx/rx.h @@ -1053,13 +1053,17 @@ typedef struct rx_interface_stat { #define rx_MutexDecrement(object, mutex) InterlockedDecrement(&object) #define rx_MutexAdd1Increment2(object1, addend, object2, mutex) \ do { \ - InterlockedAdd(&object1, addend); \ + MUTEX_ENTER(&mutex); \ + object1 += addend; \ InterlockedIncrement(&object2); \ + MUTEX_EXIT(&mutex); \ } while (0) #define rx_MutexAdd1Decrement2(object1, addend, object2, mutex) \ do { \ - InterlockedAdd(&object1, addend); \ + MUTEX_ENTER(&mutex); \ + object1 += addend; \ InterlockedDecrement(&object2); \ + MUTEX_EXIT(&mutex); \ } while (0) #else #define rx_MutexIncrement(object, mutex) \