提交 1f126476 编写于 作者: Y YuQing

fc_atomic.h: add FC_ATOMIC_SET

上级 3b2b9d61
Version 1.47 2021-01-11
* fc_atomic.h: add FC_ATOMIC_SET
Version 1.46 2020-12-29
* add function get_time_item_from_conf_ex
* INI_FIND_ITEM just break instead of return
......
......@@ -62,5 +62,5 @@ rm -rf %{buildroot}
/usr/include/fastcommon/*
%changelog
* Mon Jun 23 2014 Zaixue Liao <liaozaixue@yongche.com>
* Mon Jun 23 2014 Zaixue Liao
- first RPM release (1.0)
......@@ -28,6 +28,18 @@ extern "C" {
old_value = __sync_add_and_fetch(&var, 0); \
} while (new_value != old_value)
#define FC_ATOMIC_SET(var, new_value) \
do { \
typeof(var) _old_value; \
_old_value = var; \
do { \
if (__sync_bool_compare_and_swap(&var, _old_value, new_value)) { \
break; \
} \
_old_value = __sync_add_and_fetch(&var, 0); \
} while (new_value != _old_value); \
} while (0)
#ifdef __cplusplus
}
#endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册