projects
/
crypto.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
acadd61
)
Optimized locking.
author
Pekka Riikonen
<priikone@silcnet.org>
Mon, 9 Jul 2007 17:28:46 +0000
(17:28 +0000)
committer
Pekka Riikonen
<priikone@silcnet.org>
Mon, 9 Jul 2007 17:28:46 +0000
(17:28 +0000)
lib/silcutil/silcstack.c
patch
|
blob
|
history
diff --git
a/lib/silcutil/silcstack.c
b/lib/silcutil/silcstack.c
index d22fba3f5b1d544f1129cfb8ba1ee4d52ee786bf..03b18b5cf2c9af62b868a6b2a88717a9ec0e1eb3 100644
(file)
--- a/
lib/silcutil/silcstack.c
+++ b/
lib/silcutil/silcstack.c
@@
-95,25
+95,22
@@
static SilcStackDataEntry silc_stack_ref_stack(SilcStack stack,
return e;
}
return e;
}
+ silc_mutex_unlock(stack->lock);
+
/* If we are child, get block from parent */
/* If we are child, get block from parent */
- if (stack->parent) {
- silc_mutex_unlock(stack->lock);
+ if (stack->parent)
return silc_stack_ref_stack(stack->parent, size, ret_si, ret_bsize);
return silc_stack_ref_stack(stack->parent, size, ret_si, ret_bsize);
- }
SILC_ST_DEBUG(("Allocate new stack blocks"));
/* Allocate new stack blocks */
e = silc_calloc(1, sizeof(*e));
SILC_ST_DEBUG(("Allocate new stack blocks"));
/* Allocate new stack blocks */
e = silc_calloc(1, sizeof(*e));
- if (!e) {
- silc_mutex_unlock(stack->lock);
+ if (!e)
return NULL;
return NULL;
- }
e->data[si] = silc_malloc(bsize + SILC_STACK_ALIGN(sizeof(*e->data[0]),
stack->alignment));
if (!e->data[si]) {
silc_free(e);
e->data[si] = silc_malloc(bsize + SILC_STACK_ALIGN(sizeof(*e->data[0]),
stack->alignment));
if (!e->data[si]) {
silc_free(e);
- silc_mutex_unlock(stack->lock);
return NULL;
}
e->data[si]->bytes_left = bsize;
return NULL;
}
e->data[si]->bytes_left = bsize;
@@
-122,7
+119,6
@@
static SilcStackDataEntry silc_stack_ref_stack(SilcStack stack,
SILC_ST_DEBUG(("Got stack blocks %p from stack %p", e->data, stack));
SILC_ST_DEBUG(("Got stack blocks %p from stack %p", e->data, stack));
- silc_mutex_unlock(stack->lock);
return e;
}
return e;
}