47 Commits
Author SHA1 Message Date
Patrick Pelissier 505e2c4a62 Fix spelling 2025-05-07 21:02:24 +02:00
Patrick Pelissier 6d621703eb Copyright go to 2025 year 2025-03-01 11:03:38 +01:00
Patrick Pelissier 26cec1591a * Remove some obsolete macros
* Fix spelling
* A little bit of refactoring
2024-01-19 21:37:47 +01:00
Patrick Pelissier 52b58c5a51 Happy new year 2024 2024-01-19 21:37:47 +01:00
Patrick Pelissier d9401371a6 Fix warnings reported by CLANG,
the C warning generator.
2023-12-23 13:16:42 +01:00
Patrick Pelissier b50813713a Define internal M_INLINE:
it is used to control the inline semantics.
By combining it with optimize option "-fno-inline"
for the internal M*LIB function (using _Pragma optimize)
we can control easily if we want to use an inline version
or call of an external function.

Define new user API:
* M_USE_EXTERN_DECL : define it before including any MLIB header to requests to call the M*LIB functions and don't inline then.
* M_USE_EXTERN_DEF  : define it once in a translation unit to define the M*LIB functions. This translation unit shall contain all templated macro too.
If you use one option, you need to use the other one too for another translation unit.
2023-06-11 23:32:02 +02:00
Patrick Pelissier 91f3174a36 Rename m-mutex header into m-thread
as it is not just about mutex but about thread functions
just like the header pthread or thread.h
2023-02-16 00:09:06 +01:00
Patrick Pelissier a2ae209992 Happy new year 2023-01-02 12:57:41 +01:00
Patrick Pelissier 19b01b404d Migrate to 2022 2022-03-12 20:25:45 +01:00
Patrick Pelissier 25fe26deaa Happy new year 2021-01-13 20:18:01 +01:00
Patrick Pelissier fffd1702a5 CLANG 3.8 stdatomic works. Update minimun version 2020-12-24 07:35:45 +01:00
Patrick Pelissier 54d4b80368 Reformat macro to 80 characters 2020-10-21 23:23:40 +02:00
Patrick Pelissier b396b42808 Update comments 2020-10-03 14:07:14 +02:00
Patrick Pelissier 5f9feb833c Replace TAB by SPACE 2020-07-25 19:17:25 +02:00
Patrick Pelissier 2529d4ae49 Update comments & remove warning about _Atomic 2020-07-12 22:52:36 +02:00
Patrick Pelissier 71cec5155a Fix uncompliant m-atomic support
if __STDC_NO_ATOMICS__ is defined, then in C11, there is no stdatomic header
2020-07-04 23:34:24 +02:00
Patrick Pelissier f2a06ede62 Add mechanism to disable temporary compiler warnings in a sequence of code. 2020-07-01 11:47:55 +02:00
Patrick Pelissier 3b347f2ba5 Reduce some warnings using the atomic compatibility layer (cannot fix all) 2020-07-01 11:06:58 +02:00
Patrick Pelissier f6483cbb30 It seems GNUC is force to 4 for APPLE/CLANG 2020-06-27 01:00:46 +02:00
Patrick Pelissier f742707699 Always use atomic in C++ 2020-06-27 00:31:58 +02:00
Patrick Pelissier aee02d86ab Workaround issue with CLANG++ on MAC 2020-06-27 00:10:40 +02:00
Patrick Pelissier 8335bc525b Add comments 2020-05-23 16:09:18 +02:00
Patrick Pelissier 4668476c6a Fix issue with old version of ICC 2020-05-16 14:47:30 +02:00
Patrick Pelissier 4f7b0b9455 Happy new year 2020 2020-01-04 15:41:06 +01:00
Patrick Pelissier 4642e0b506 Workaround issue of stdatomic on MSYS2/GCC 2019-01-05 00:19:09 +01:00
Patrick Pelissier 60f1454550 Fix incorrect qualifier position for emulation layer (issue for atomic pointer definition) 2019-01-02 22:15:47 +01:00
Patrick Pelissier 8b3a4a802c Happy new year! 2019-01-02 18:12:07 +01:00
Patrick Pelissier 48a970ceb9 Avoid using '__' within words.
It seems to be a reserved naming of C++.
2018-08-19 11:31:09 +02:00
Patrick Pelissier 96202aa78f Do not use reserved identifiers of the C standard (See 7.1.3 Reserved identifiers) 2018-07-14 14:35:14 +02:00
Patrick Pelissier b1597f6f61 Rewrite comments. 2018-05-02 23:57:24 +02:00
Patrick Pelissier 7fa1c2264e Fix issue for C++ layer (memory order constants have to be put in the current namespace too). 2018-04-20 19:34:22 +02:00
Patrick Pelissier 928d6bafcb Fix issue if there is no working stdatomic / atomic header:
definition of atomic_compare_exchange_strong_explicit was wrong.
Same for atomic_compare_exchange_weak_explicit
2018-04-19 22:14:16 +02:00
Patrick Pelissier 7082a4dc24 Fix wrong initialization of ATOMIC_VAR_INIT for the emulation layer
(wrong since the simplication of the atomic structure).
2018-03-31 10:04:41 +02:00
Patrick Pelissier 210e05f7fc Update copyright to 2018 2018-01-29 20:28:30 +01:00
Patrick Pelissier 2e5ca1cc1f Fix issue when atomic_store is called with atomic_load and
there was locks.
the lock taking of atomic_load was performed within the lock
of atomic_store, performing a dead lock.
Fix this by perfoming an evaluation of val before setting
it in atomic_store.
2017-12-28 13:55:13 +01:00
Patrick Pelissier 217c31d6a7 Optimization for the atomic layer with locks:
do not perform any lock for amd64 (and x86) architecture
if the word length is less than 8 bytes (or 4 bytes)
as the targeted architecture support it directly.
(strong order)
2017-12-28 13:37:37 +01:00
Patrick Pelissier 985870452c Remove field _cmp 2017-12-28 12:00:37 +01:00
Patrick Pelissier 55156d2f12 Update comment 2017-12-07 23:06:08 +01:00
Patrick Pelissier 11962bf747 Minor comment update. 2017-11-11 20:30:23 +01:00
Patrick Pelissier e9f5e9b94d Update comments 2017-11-01 09:37:14 +01:00
Patrick Pelissier eb75157fd8 Fix comment 2017-10-25 22:13:06 +02:00
Patrick Pelissier c9e321228f Fix indentation. 2017-10-04 22:11:47 +02:00
Patrick Pelissier 670502fc2d Fix issue with GCC < 4.9 2017-08-11 19:51:52 +02:00
Patrick Pelissier a8f124ed9b Fix issue with C++ & G++ 4.9 2017-08-08 20:11:13 +02:00
Patrick Pelissier b63313dfcc Added a new wrapper. 2017-08-08 20:02:39 +02:00
Patrick Pelissier 57ac0d8ae4 Add implementation of atomic based on mutex. 2017-07-10 20:50:52 +02:00
Patrick Pelissier 72c5c3f371 Replace stdatomic.h (C11 standard compliant header) by a custom one
to increase C++ compatibility as stdatomic.h doesn't work in C++!

(I would like to thanks the one(s) who thought it was a good idea
***not*** to include stdatomic.h -and thread.h- in the C++ standard!)
2017-04-13 21:50:16 +02:00