completion.h 1.05 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
/*
 * (C) 2017 The University of Chicago
 * 
 * See COPYRIGHT in top-level directory.
 */
#ifndef __MOBJECT_COMPLETION_H
#define __MOBJECT_COMPLETION_H

#include <abt.h>
#include "mobject-store-config.h"

12 13 14 15 16 17 18 19 20
/**
 * The mobject_store_completion object is used for asynchronous
 * functions. It contains the callbacks to call when the data is
 * safe and when the operation has completed, as well as potential
 * user data and required mechanism to be able to block on the
 * completion object.
 * mobject_store_completion* is typedef-ed as mobject_store_completion_t
 * in libmobject-store.h.
 */
21 22 23 24 25 26 27 28 29 30 31
struct mobject_store_completion {
	mobject_store_callback_t cb_complete;    // completion callback
	mobject_store_callback_t cb_safe;        // safe callback
	void*                    cb_arg;         // arguments for callbacks
	ABT_eventual             eventual;       // eventual used to notify completion
	int*                     ret_value_ptr;  // pointer to eventual's internal value
	ABT_rwlock               lock;           // lock protecting access to this structure
};

#endif