SPRAAK
|
Shared Resource Management. More...
Data Structures | |
struct | SprSrmDir |
Return structure for the spr_srm_dir() function. More... | |
Namespaces | |
xref_spr_sec_srm_code | |
Typical usage scenarios of shared resources | |
Typedefs | |
typedef struct SprSrmEl | SprSrmEl |
typedef void(* | SprSrmFree )(SprSrmEl *srm_el, SprMsgId *routine) |
Prototype of a function to free the content of a resource. More... | |
Enumerations | |
enum | { SPR_SRM_EXPORT, SPR_SRM_RELEASE, SPR_SRM_RELEASE2, SPR_SRM_RELEASE_DELAYED, SPR_SRM_CHECK_RELEASE, SPR_SRM_AD_ENLIST, SPR_SRM_AD_DELIST, SPR_SRM_RELEASE_UNLOCKED } |
Possible actions for the spr_srm_release() routine. More... | |
enum | { SPR_SRM_CID_CLASSID, SPR_SRM_CID_DATATYPE, SPR_SRM_CID_DTCVT, SPR_SRM_CID_DYNLIB, SPR_SRM_CID_GLOBVAR, SPR_SRM_CID_VFS_OPEN, SPR_SRM_CID_VFS_EXT, SPR_SRM_CID_VFS_DEV, SPR_SRM_CID_VFS_MEM, SPR_SRM_CID_RESERVED } |
Functions | |
SprSrmEl * | spr_srm_check (const SprSrmEl *srm_el) |
SprSrmEl * | spr_srm_retrieve (unsigned int class_id, const char *name) |
SprSrmEl * | spr_srm_retrieve_alt (unsigned int class_id, const char *name, size_t sz) |
SprSrmEl * | spr_srm_get (unsigned int class_id, const char *name) |
SprSrmEl * | spr_srm_create (unsigned int class_id, const char *name, int name_is_persistent) |
SprSrmEl * | spr_srm_retrieve_or_create (unsigned int class_id, const char *name, int name_is_persistent) |
int | spr_srm_release (SprSrmEl *srm_el, int action) |
void | spr_srm_release_quick (SprSrmEl *srm_el) |
void | spr_srm_release_nocheck (SprSrmEl *srm_el) |
SprSrmDir * | spr_srm_dir (unsigned int class_id) |
int | spr_srm_check_initialized (SprSrmEl *srm_el) |
int | spr_srm_set_free_routine (SprSrmEl *srm_el, SprSrmFree free_func) |
int | spr_srm_set_info_val1_ptr (SprSrmEl *srm_el, void *val) |
int | spr_srm_set_info_val1_ndx (SprSrmEl *srm_el, unsigned int val) |
int | spr_srm_set_info_val2_ptr (SprSrmEl *srm_el, void *val) |
int | spr_srm_set_info_val2_ndx (SprSrmEl *srm_el, unsigned int val) |
void * | spr_srm_get_info_val1_ptr (const SprSrmEl *srm_el, int *err) |
unsigned int | spr_srm_get_info_val1_ndx (const SprSrmEl *srm_el, int *err) |
void * | spr_srm_get_info_val2_ptr (const SprSrmEl *srm_el, int *err) |
unsigned int | spr_srm_get_info_val2_ndx (const SprSrmEl *srm_el, int *err) |
Variables | |
const char | spr_str_srm_cid_classid [] |
const char | spr_str_srm_cid_datatype [] |
const char | spr_str_srm_cid_datatype_cvt [] |
const char | spr_str_srm_cid_dynlib [] |
const char | spr_str_srm_cid_globvar [] |
const char | spr_str_srm_cid_vfs_open [] |
const char | spr_str_srm_cid_vfs_ext [] |
const char | spr_str_srm_cid_vfs_dev [] |
const char | spr_str_srm_cid_vfs_mem [] |
Shared Resource Management.
This module provides routines for the management of shared resources. It allows you to register (make public) some resource or functionality so that other parts of the system can use it.
Examples:
Each resource must have a unique label. The labels are tuples containing the class-id (a number) and the name of the resource (a string). The class-id's are shared resources by themselves, so all class-id's have a uniquely name as well.
Resources are write once read many objects. I.e. a resource can be created once and is unmodifiable hence forth until it is destroyed. However, the content the resource is referring to (e.g. the content of the global variable) is modifiable. When using modifiable content, it is up to the provider and user of that information to make it MT-safe (provide the necessary mutexes, locks, ...).
The management of resoures is MT-safe. If one thread is creating a resource, the other thread will be forced to wait until the resource is ready (released for usage or destroyed).
Some Typical usage scenarios of shared resources typical usage scenarios are: