Skip to content

Commit

Permalink
Merge pull request #161 from mochi-hpc/dev-eventual-memory
Browse files Browse the repository at this point in the history
modify MARGO_EVENTUAL_FREE macro to reset eventual
  • Loading branch information
carns authored Oct 13, 2021
2 parents 2ad8de6 + 078dd8f commit e05e166
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/margo-abt-macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,16 @@ static inline int __margo_eventual_create(margo_eventual_t* ev)

#define MARGO_EVENTUAL_CREATE(__ev__) __margo_eventual_create(__ev__)

#define MARGO_EVENTUAL_FREE(__ev__)
/* NOTE: we don't need to literally "reset" the eventual when freeing it.
* The point of calling reset() in this path is that it will force
* Argobots to acquire an internal lock in the eventual, which in turn
* ensures that the set() caller is done before we destroy the eventual
* and allow it to pass out of scope. This makes the margo_eventual_t
* safe to use on ephemeral function call stacks. See discussion at
* https://github.com/pmodels/argobots/issues/367 for details.
*/
#define MARGO_EVENTUAL_FREE(__ev__) \
ABT_eventual_reset(ABT_EVENTUAL_MEMORY_GET_HANDLE(__ev__))

#else // ABT_EVENTUAL_INITIALIZED not defined

Expand Down

0 comments on commit e05e166

Please sign in to comment.