Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Pubnub_c_core by
pubnub_alloc.h@0:d13755cfb705, 2016-11-10 (annotated)
- Committer:
- sveljko
- Date:
- Thu Nov 10 22:20:11 2016 +0000
- Revision:
- 0:d13755cfb705
Initial commit of Pubnub C-core
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| sveljko | 0:d13755cfb705 | 1 | /* -*- c-file-style:"stroustrup"; indent-tabs-mode: nil -*- */ |
| sveljko | 0:d13755cfb705 | 2 | #if !defined INC_PUBNUB_ALLOC |
| sveljko | 0:d13755cfb705 | 3 | #define INC_PUBNUB_ALLOC |
| sveljko | 0:d13755cfb705 | 4 | |
| sveljko | 0:d13755cfb705 | 5 | |
| sveljko | 0:d13755cfb705 | 6 | #include "pubnub_api_types.h" |
| sveljko | 0:d13755cfb705 | 7 | |
| sveljko | 0:d13755cfb705 | 8 | |
| sveljko | 0:d13755cfb705 | 9 | /** Returns an allocated context. After successful allocation, please |
| sveljko | 0:d13755cfb705 | 10 | call pubnub_init() to prepare the context for regular use. |
| sveljko | 0:d13755cfb705 | 11 | |
| sveljko | 0:d13755cfb705 | 12 | Do not make a context on your own - always get a context pointer |
| sveljko | 0:d13755cfb705 | 13 | by calling this funciton. |
| sveljko | 0:d13755cfb705 | 14 | |
| sveljko | 0:d13755cfb705 | 15 | @return Context pointer on success, NULL on error |
| sveljko | 0:d13755cfb705 | 16 | */ |
| sveljko | 0:d13755cfb705 | 17 | pubnub_t *pubnub_alloc(void); |
| sveljko | 0:d13755cfb705 | 18 | |
| sveljko | 0:d13755cfb705 | 19 | /** Frees a previously allocated context, if it is not in a |
| sveljko | 0:d13755cfb705 | 20 | transaction. If a context is in a transaction, first cancel it |
| sveljko | 0:d13755cfb705 | 21 | (call pubnub_cancel()), then wait for the context to finish the |
| sveljko | 0:d13755cfb705 | 22 | cancelling. |
| sveljko | 0:d13755cfb705 | 23 | |
| sveljko | 0:d13755cfb705 | 24 | It's OK to call this function on a context whose transaction is |
| sveljko | 0:d13755cfb705 | 25 | not over and done, it will just fail, but will not affect the |
| sveljko | 0:d13755cfb705 | 26 | transaction in any way. |
| sveljko | 0:d13755cfb705 | 27 | |
| sveljko | 0:d13755cfb705 | 28 | You don't have to free a context when you finish a transaction. |
| sveljko | 0:d13755cfb705 | 29 | Just start a new one. Free a context if you're done doing Pubnub |
| sveljko | 0:d13755cfb705 | 30 | transactions for a long time. |
| sveljko | 0:d13755cfb705 | 31 | |
| sveljko | 0:d13755cfb705 | 32 | @param pb Pointer to a context which to free |
| sveljko | 0:d13755cfb705 | 33 | @return 0: OK, context freed; else: error, context untouched |
| sveljko | 0:d13755cfb705 | 34 | */ |
| sveljko | 0:d13755cfb705 | 35 | int pubnub_free(pubnub_t *pb); |
| sveljko | 0:d13755cfb705 | 36 | |
| sveljko | 0:d13755cfb705 | 37 | |
| sveljko | 0:d13755cfb705 | 38 | #endif /* !defined INC_PUBNUB_ALLOC */ |
