diff --git a/src/atomic.h b/src/atomic.h
index 8a790a7f6cbbf190c3d87d590f10c6f1676c2d24..0916497efc5afccac1a91f541a827e21ca8a7742 100644
--- a/src/atomic.h
+++ b/src/atomic.h
@@ -121,6 +121,27 @@ __attribute__((always_inline)) INLINE static void atomic_min_d(
} while (test_val.as_long_long != old_val.as_long_long);
}
+/**
+ * @brief Atomic max operation on chars.
+ *
+ * This is a text-book implementation based on an atomic CAS.
+ *
+ * @param address The address to update.
+ * @param y The value to update the address with.
+ */
+__attribute__((always_inline)) INLINE static void atomic_max_c(
+ volatile char *const address, const char y) {
+
+ char test_val, old_val, new_val;
+ old_val = *address;
+
+ do {
+ test_val = old_val;
+ new_val = max(old_val, y);
+ old_val = atomic_cas(address, test_val, new_val);
+ } while (test_val != old_val);
+}
+
/**
* @brief Atomic max operation on floats.
*