Extend the thread storage API such that a custom initialization function can

be called for each thread specific object after they are allocated.  Note that
there was already the ability to define a custom cleanup function.  Also, if
the custom cleanup function is used, it *MUST* call free on the thread
specific object at the end.  There is no way to have this magically done that
I can think of because the cleanup function registered with the pthread
implementation will only call the function back with a pointer to the
thread specific object, not the parent ast_threadstorage object.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@45623 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Russell Bryant
2006-10-19 01:00:57 +00:00
parent 71c67605ca
commit bd53e7ee4c
10 changed files with 48 additions and 28 deletions

View File

@@ -101,10 +101,10 @@ struct eventqent *master_eventq = NULL;
* has one event in it (Placeholder) in init_manager().
*/
AST_THREADSTORAGE(manager_event_buf, manager_event_buf_init);
AST_THREADSTORAGE(manager_event_buf);
#define MANAGER_EVENT_BUF_INITSIZE 256
AST_THREADSTORAGE(astman_append_buf, astman_append_buf_init);
AST_THREADSTORAGE(astman_append_buf);
#define ASTMAN_APPEND_BUF_INITSIZE 256
/*! \brief Descriptor for an AMI session, either a regular one