cuoo/prop.h: Thread-Safe Properties
[cuoo: Dynamic Objects and Operations]

Data Structures

struct  cuoo_prop

Functions

void cuoo_prop_cct (cuoo_prop_t prop)
cuoo_prop_t cuoo_prop_new (void)
cu_bool_t cuoo_prop_replace_ptr (cuoo_prop_t key, cuex_t ex, void *value)
cu_bool_t cuoo_prop_condset_ptr (cuoo_prop_t key, cuex_t ex, void *value)
void cuoo_prop_define_ptr (cuoo_prop_t key, cuex_t ex, void *value)
void * cuoo_prop_get_ptr (cuoo_prop_t key, cuex_t ex)
cu_bool_t cuoo_prop_set_mem_lock (cuoo_prop_t key, cuex_t ex, size_t size, cu_ptr_ptr_t slot)
cu_bool_t cuoo_prop_set_mem_condlock (cuoo_prop_t key, cuex_t ex, size_t size, cu_ptr_ptr_t slot)
void cuoo_prop_set_mem_unlock (cuoo_prop_t key, cuex_t ex)
void * cuoo_prop_get_mem_lock (cuoo_prop_t key, cuex_t ex)
void * cuoo_prop_get_mem_condlock (cuoo_prop_t key, cuex_t ex)
void cuoo_prop_get_mem_unlock (cuoo_prop_t key, cuex_t ex)

Detailed Description

Note:
Storing the property globally will prevent the expressions and values from being recycled by the garbage collector. For variables the alternative is to use cuex_pvar_t which has internally stored properties. Local properties which is used within a single thread are more efficiently stored in a cucon_pmap_t.

Function Documentation

cu_bool_t cuoo_prop_condset_ptr ( cuoo_prop_t  key,
cuex_t  ex,
void *  value 
)

Sets a pointer value for prop of ex and returns true iff the property did not exist in advance for ex.

void cuoo_prop_define_ptr ( cuoo_prop_t  key,
cuex_t  ex,
void *  value 
)

Sets a pointer value for prop of ex. Fails with an error if property exists for ex.

void* cuoo_prop_get_mem_condlock ( cuoo_prop_t  key,
cuex_t  ex 
)

If ex has a property key, (read-)lock it and return a pointer to its slot.

void* cuoo_prop_get_mem_lock ( cuoo_prop_t  key,
cuex_t  ex 
)

Return property key of ex and lock key for reading even if NULL is returned.

void cuoo_prop_get_mem_unlock ( cuoo_prop_t  key,
cuex_t  ex 
)

Call this after reading a slot returned by a call to cuoo_prop_get_mem_condlock which returned non-NULL.

void* cuoo_prop_get_ptr ( cuoo_prop_t  key,
cuex_t  ex 
)

Returns the value for prop of ex, assuming the slot contains a pointer.

cu_bool_t cuoo_prop_replace_ptr ( cuoo_prop_t  key,
cuex_t  ex,
void *  value 
)

Sets a pointer value for prop of ex. Returns true iff the property did not exist in advance for ex.

cu_bool_t cuoo_prop_set_mem_condlock ( cuoo_prop_t  key,
cuex_t  ex,
size_t  size,
cu_ptr_ptr_t  slot 
)

Set '*slot' to point to the property prop of ex, allocating a slot of size size if it does not yet exist. Returns true and locks prop iff the property does not exists.

cu_bool_t cuoo_prop_set_mem_lock ( cuoo_prop_t  key,
cuex_t  ex,
size_t  size,
cu_ptr_ptr_t  slot 
)

Set '*slot' to point to the property prop of ex, allocating a slot of size size if it does not yet exist. Returns true iff the property does not exist, but locks prop in either case.

void cuoo_prop_set_mem_unlock ( cuoo_prop_t  key,
cuex_t  ex 
)

Call this when you are done modifying a slot obtained by a call to cuoo_prop_set_mem_lock or a true-returning call to cuoo_prop_set_mem_condlock.

Generated 2009-11-23 for culibs-0.25 using Doxygen. Maintained by Petter Urkedal.