define LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE

From liblfds.org
Jump to navigation Jump to search

Source File

└───liblfds700
    └───inc
        └───liblfds700
                lfds700_misc.h

Define

#define LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE

Notes

When a liblfds data structure is initialized, by the calling of its init function, the work done by that function is and only is valid upon the logical core where the calling thread executed. By valid it is meant to say that the stores (writing initial values to the various variables in the state structure) performed by the init work are not guaranteed to be visible to any other logical core. As such, if threads on other logical cores attempt to use this state structure, rather than seeing sane initial values, they could be reading anything, and then all bets are off.

To make those initial values valid (which is to say, visible) upon other logical cores, threads on those cores need to issue the define LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE, which does that which it says; any init calls, which have completed (i.e. returned) on any other logical cores will now be valid (visible) on this logical core.

This define is also needed for the one-time library init function, lfds700_misc_library_init_valid_on_current_logical_core to be valid on other logical cores. Only one thread should call this function, the library init function, but all other threads still need to make that work valid for their logical cores.

See Also