diff options
Diffstat (limited to 'src/context.h')
-rw-r--r-- | src/context.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/context.h b/src/context.h index d65bf9b5..076d0731 100644 --- a/src/context.h +++ b/src/context.h @@ -21,6 +21,8 @@ #ifndef CONTEXT_H #define CONTEXT_H +#include <stdint.h> + #include "gpgme.h" #include "engine.h" #include "wait.h" @@ -78,6 +80,12 @@ struct gpgme_context { DECLARE_LOCK (lock); + /* The unique serial number of this context object. This is used + * for a weak reference of the context. Using the address of the + * context is not always possible becuase it might have already been + * freed and reused. */ + uint64_t serial; + /* True if the context was canceled asynchronously. */ int canceled; @@ -186,4 +194,9 @@ struct gpgme_context struct gpgme_io_cbs io_cbs; }; + +/* Macro to retrieve the serial number. Returns 0 if CTX is NULL. */ +#define CTXSERIAL(ctx) (ctx? (unsigned long)ctx->serial : 0) + + #endif /* CONTEXT_H */ |