Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GHI #32 Add options.h header
Browse files Browse the repository at this point in the history
doodspav committed Mar 6, 2024

Verified

This commit was signed with the committer’s verified signature. The key has expired.
doodspav doodspav
1 parent a1e5685 commit 05f0b71
Showing 2 changed files with 48 additions and 0 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -41,6 +41,7 @@ target_sources(
# include/types
include/patomic/types/align.h
include/patomic/types/ids.h
include/patomic/types/options.h
include/patomic/types/memory_order.h
)

47 changes: 47 additions & 0 deletions include/patomic/types/options.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#ifndef PATOMIC_OPTIONS_H
#define PATOMIC_OPTIONS_H

#ifdef __cplusplus
extern "C" {
#endif


/**
* @addtogroup options
*
* @brief
* Enum constants providing hints to implementations that allow them to
* optimize how they implement certain atomic operations.
*
* @details
* Options do NOT affect the correctness of any implementation. Any atomic
* operation that is obtained both when passing and not passing an option is
* equally correct in terms of thread-safety and memory ordering. \n
* However options MAY affect constraints that are unrelated to thread-safety
* and memory ordering, namely alignment requirements and the quality of the
* implementation
*
* @warning
* You should be cautious about using an atomic operation obtained without
* an option in the same place as one obtained with the option (and vice
* versa). Options are allowed to relax alignment requirements, and you could
* end up with misaligned memory accesses by mistake.
*
* @note
* Options are merely hints to an implementation; they may be completely
* ignored.
*/

typedef enum {

/** brief The empty option hinting nothing */
patomic_option_NONE = 0x0

} patomic_option_t;


#ifdef __cplusplus
} /* extern "C" */
#endif

#endif /* PATOMIC_OPTIONS_H */

0 comments on commit 05f0b71

Please sign in to comment.