/* If we are last thread, signal the waiting destructor. */
if (silc_list_count(tp->threads) == 0)
- silc_cond_signal(pool_signal);
+ silc_cond_broadcast(pool_signal);
/* Release pool reference. Releases lock also. */
silc_thread_pool_unref(tp);
silc_list_start(tp->threads);
while ((t = silc_list_get(tp->threads)))
t->stop = TRUE;
- silc_cond_signal(tp->pool_signal);
+ silc_cond_broadcast(tp->pool_signal);
if (wait_unfinished) {
SILC_LOG_DEBUG(("Wait threads to finish"));
silc_list_del(tp->free_threads, t);
/* Signal threads */
- silc_cond_signal(tp->pool_signal);
+ silc_cond_broadcast(tp->pool_signal);
silc_mutex_unlock(tp->lock);
return TRUE;
silc_mutex_lock(tp->lock);
if (silc_list_count(tp->free_threads) <= tp->min_threads) {
+ SILC_LOG_DEBUG(("No threads to purge"));
silc_mutex_unlock(tp->lock);
return;
}
}
/* Signal threads to stop */
- silc_cond_signal(tp->pool_signal);
+ silc_cond_broadcast(tp->pool_signal);
silc_mutex_unlock(tp->lock);
}
SILC_LOG_DEBUG(("Popping"));
silc_stack_stats(stack);
+ SILC_LOG_DEBUG(("Current alignment: %d", silc_stack_get_alignment(stack)));
+ SILC_LOG_DEBUG(("Set alignemtn to 16"));
+ silc_stack_set_alignment(stack, 16);
+ SILC_LOG_DEBUG(("Current alignment: %d", silc_stack_get_alignment(stack)));
+ SILC_LOG_DEBUG(("Allocate 1 byte"));
+ ptr = silc_smalloc(stack, 1);
+ SILC_LOG_DEBUG(("Allocate 1 byte, check alignment"));
+ ptr2 = silc_smalloc(stack, 1);
+ if (ptr2 - ptr < 16) {
+ SILC_LOG_DEBUG(("Bad alignment"));
+ goto err;
+ }
+ SILC_LOG_DEBUG(("Alignment (ptr, ptr2) is %d", ptr2 - ptr));
+ SILC_LOG_DEBUG(("Allocate 1 byte, check alignment"));
+ ptr2 = silc_smalloc(stack, 1);
+ if (ptr2 - ptr < 32) {
+ SILC_LOG_DEBUG(("Bad alignment"));
+ goto err;
+ }
+ SILC_LOG_DEBUG(("Alignment (ptr, ptr2) is %d", ptr2 - ptr));
+
SILC_LOG_DEBUG(("Freeing the stack"));
silc_stack_free(stack);