libosmocore 1.9.0.196-9975
Osmocom core library
osmo_talloc_contexts Struct Reference

per-thread talloc contexts. More...

#include <talloc.h>

Data Fields

void * global
 global per-thread talloc context. More...
 
void * select
 volatile select-dispatch context. More...
 

Detailed Description

per-thread talloc contexts.

This works around the problem that talloc is not thread-safe. However, one can simply have a different set of talloc contexts for each thread, and ensure that allocations made on one thread are always only free'd on that very same thread. WARNING: Users must make sure they free() on the same thread as they allocate!!

Field Documentation

◆ global

void* osmo_talloc_contexts::global

global per-thread talloc context.

Referenced by osmo_ctx_init().

◆ select

void* osmo_talloc_contexts::select

volatile select-dispatch context.

This context is completely free'd and re-created every time the main select loop in osmo_select_main() returns from select(2) and calls per-fd callback functions. This allows users of this facility to allocate temporary objects like string buffers, message buffers and the like which are automatically free'd when going into the next select() system call

Referenced by osmo_ctx_init().


The documentation for this struct was generated from the following file: