Include lock performance (bug #3234)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@4700 f38db490-d61c-443f-a65b-d21fe96a405b
This commit is contained in:
parent
1396ee108a
commit
b85757dc7b
1 changed files with 29 additions and 6 deletions
|
@ -161,6 +161,16 @@ extern "C" {
|
||||||
ASTOBJ_CONTAINER_UNLOCK(container); \
|
ASTOBJ_CONTAINER_UNLOCK(container); \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
|
#define ASTOBJ_CONTAINER_FIND(container,namestr) \
|
||||||
|
({ \
|
||||||
|
typeof((container)->head) found = NULL; \
|
||||||
|
ASTOBJ_CONTAINER_TRAVERSE(container, !found, do { \
|
||||||
|
if (!(strcasecmp(iterator->name, (namestr)))) \
|
||||||
|
found = ASTOBJ_REF(iterator); \
|
||||||
|
} while (0)); \
|
||||||
|
found; \
|
||||||
|
})
|
||||||
|
|
||||||
#define ASTOBJ_CONTAINER_FIND_FULL(container,data,field,hashfunc,hashoffset,comparefunc) \
|
#define ASTOBJ_CONTAINER_FIND_FULL(container,data,field,hashfunc,hashoffset,comparefunc) \
|
||||||
({ \
|
({ \
|
||||||
typeof((container)->head) found = NULL; \
|
typeof((container)->head) found = NULL; \
|
||||||
|
@ -186,6 +196,25 @@ extern "C" {
|
||||||
ASTOBJ_CONTAINER_UNLOCK(container); \
|
ASTOBJ_CONTAINER_UNLOCK(container); \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
|
#define ASTOBJ_CONTAINER_FIND_UNLINK(container,namestr) \
|
||||||
|
({ \
|
||||||
|
typeof((container)->head) found = NULL; \
|
||||||
|
typeof((container)->head) prev = NULL; \
|
||||||
|
ASTOBJ_CONTAINER_TRAVERSE(container, !found, do { \
|
||||||
|
if (!(strcasecmp(iterator->name, (namestr)))) { \
|
||||||
|
found = iterator; \
|
||||||
|
ASTOBJ_CONTAINER_WRLOCK(container); \
|
||||||
|
if (prev) \
|
||||||
|
prev->next[0] = next; \
|
||||||
|
else \
|
||||||
|
(container)->head = next; \
|
||||||
|
ASTOBJ_CONTAINER_UNLOCK(container); \
|
||||||
|
} \
|
||||||
|
prev = iterator; \
|
||||||
|
} while (0)); \
|
||||||
|
found; \
|
||||||
|
})
|
||||||
|
|
||||||
#define ASTOBJ_CONTAINER_FIND_UNLINK_FULL(container,data,field,hashfunc,hashoffset,comparefunc) \
|
#define ASTOBJ_CONTAINER_FIND_UNLINK_FULL(container,data,field,hashfunc,hashoffset,comparefunc) \
|
||||||
({ \
|
({ \
|
||||||
typeof((container)->head) found = NULL; \
|
typeof((container)->head) found = NULL; \
|
||||||
|
@ -252,12 +281,6 @@ extern "C" {
|
||||||
#define ASTOBJ_CONTAINER_DESTROY(container) \
|
#define ASTOBJ_CONTAINER_DESTROY(container) \
|
||||||
ASTOBJ_CONTAINER_DESTROY_FULL(container,1,ASTOBJ_DEFAULT_BUCKETS)
|
ASTOBJ_CONTAINER_DESTROY_FULL(container,1,ASTOBJ_DEFAULT_BUCKETS)
|
||||||
|
|
||||||
#define ASTOBJ_CONTAINER_FIND(container,namestr) \
|
|
||||||
ASTOBJ_CONTAINER_FIND_FULL(container,namestr,name,ASTOBJ_DEFAULT_HASH,0,strcasecmp)
|
|
||||||
|
|
||||||
#define ASTOBJ_CONTAINER_FIND_UNLINK(container,namestr) \
|
|
||||||
ASTOBJ_CONTAINER_FIND_UNLINK_FULL(container,namestr,name,ASTOBJ_DEFAULT_HASH,0,strcasecmp)
|
|
||||||
|
|
||||||
#define ASTOBJ_CONTAINER_LINK(container,newobj) \
|
#define ASTOBJ_CONTAINER_LINK(container,newobj) \
|
||||||
ASTOBJ_CONTAINER_LINK_FULL(container,newobj,(newobj)->name,name,ASTOBJ_DEFAULT_HASH,0,strcasecmp)
|
ASTOBJ_CONTAINER_LINK_FULL(container,newobj,(newobj)->name,name,ASTOBJ_DEFAULT_HASH,0,strcasecmp)
|
||||||
|
|
||||||
|
|
Reference in a new issue