DTS Application Library  0.2.3
Application library containing referenced objects and interfaces to common libraries
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages

Referenced Lockable Objects. More...

#include <pthread.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include "include/dtsapp.h"

Go to the source code of this file.

Data Structures

struct  ref_obj
 Internal structure of all referenced objects. More...
 
struct  blist_obj
 Entry in a bucket list. More...
 
struct  bucket_list
 Bucket list, hold hashed objects in buckets. More...
 
struct  bucket_loop
 Bucket iterator. More...
 

Macros

#define REFOBJ_MAGIC   0xdeadc0de
 Magic number stored as first field of all referenced objects. More...
 
#define refobj_offset   sizeof(struct ref_obj);
 The size of ref_obj is the offset for the data. More...
 

Functions

void * objalloc (int size, objdestroy destructor)
 Allocate a referenced lockable object. More...
 
int objref (void *data)
 Reference a object. More...
 
int objunref (void *data)
 Drop reference held. More...
 
int objcnt (void *data)
 Return current reference count. More...
 
int objsize (void *data)
 Size requested for data. More...
 
int objlock (void *data)
 Lock the reference. More...
 
int objtrylock (void *data)
 Try lock a reference. More...
 
int objunlock (void *data)
 Unlock a reference. More...
 
void * objchar (const char *orig)
 Return a reference to copy of a buffer. More...
 
void * create_bucketlist (int bitmask, blisthash hash_function)
 
int addtobucket (struct bucket_list *blist, void *data)
 Add a reference to the bucketlist. More...
 
void remove_bucket_item (struct bucket_list *blist, void *data)
 Remove and unreference a item from the list. More...
 
int bucket_list_cnt (struct bucket_list *blist)
 Return number of items in the list. More...
 
void * bucket_list_find_key (struct bucket_list *blist, const void *key)
 Find and return a reference to a item matching supplied key. More...
 
void bucketlist_callback (struct bucket_list *blist, blist_cb callback, void *data2)
 Run a callback function on all items in the list. More...
 
struct bucket_loopinit_bucket_loop (struct bucket_list *blist)
 Create a bucket list iterator to safely iterate the list. More...
 
void * next_bucket_loop (struct bucket_loop *bloop)
 Return a reference to the next item in the list this could be the first item. More...
 
void remove_bucket_loop (struct bucket_loop *bloop)
 Safely remove a item from a list while iterating in a loop. More...
 

Detailed Description

Referenced Lockable Objects.

Definition in file refobj.c.