Codename Pineapple

Home page | Mailing list | Docs

Last updated: Sat Feb 3 05:01:57 2007

Asterisk developer's documentation :: Codename Pineapple


threadstorage.h File Reference


Detailed Description

Definitions to aid in the use of thread local storage.

Author:
Russell Bryant <russell@digium.com>

Definition in file threadstorage.h.

#include <pthread.h>
#include "asterisk/utils.h"
#include "asterisk/inline_api.h"

Include dependency graph for threadstorage.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ast_threadstorage
 data for a thread locally stored variable More...

Defines

#define AST_THREADSTORAGE(name)   AST_THREADSTORAGE_CUSTOM(name, NULL, ast_free)
 Define a thread storage variable.
#define AST_THREADSTORAGE_CUSTOM(name, c_init, c_cleanup)
 Define a thread storage variable, with custom initialization and cleanup.


Define Documentation

#define AST_THREADSTORAGE name   )     AST_THREADSTORAGE_CUSTOM(name, NULL, ast_free)
 

Define a thread storage variable.

  • name The name of the thread storage object
This macro would be used to declare an instance of thread storage in a file.

Example usage:

Definition at line 83 of file threadstorage.h.

#define AST_THREADSTORAGE_CUSTOM name,
c_init,
c_cleanup   ) 
 

Define a thread storage variable, with custom initialization and cleanup.

  • name The name of the thread storage object
  • init This is a custom function that will be called after each thread specific object is allocated, with the allocated block of memory passed as the argument.
  • cleanup This is a custom function that will be called instead of ast_free when the thread goes away. Note that if this is used, it *MUST* call free on the allocated memory.
Example usage:
 AST_THREADSTORAGE_CUSTOM(my_buf, my_init, my_cleanup);

Definition at line 103 of file threadstorage.h.


Asterisk is a trademark for Digium, inc.. | Edvina.net | Asterisk.org | This documentation was generated with Doxygen