projects
/
silc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added SILC errno API. Added SilcResult, generic error code and
[silc.git]
/
lib
/
silcutil
/
silcthread.c
diff --git
a/lib/silcutil/silcthread.c
b/lib/silcutil/silcthread.c
index 3ada012c14e86c3c264c0f275a0476fbd1f2d523..8e51a15d13ef4c182382cf029f3b0f41512c3deb 100644
(file)
--- a/
lib/silcutil/silcthread.c
+++ b/
lib/silcutil/silcthread.c
@@
-319,10
+319,16
@@
SilcThreadPool silc_thread_pool_alloc(SilcStack stack,
SilcThreadPool tp;
int i;
SilcThreadPool tp;
int i;
- if (max_threads < min_threads)
+ if (max_threads < min_threads) {
+ silc_set_errno_reason(SILC_ERR_INVALID_ARGUMENT,
+ "Max threads is smaller than min threads (%d < %d)",
+ max_threads, min_threads);
return NULL;
return NULL;
- if (!max_threads)
+ }
+ if (!max_threads) {
+ silc_set_errno_reason(SILC_ERR_INVALID_ARGUMENT, "Max threads is 0");
return NULL;
return NULL;
+ }
if (stack)
stack = silc_stack_alloc(0, stack);
if (stack)
stack = silc_stack_alloc(0, stack);
@@
-411,6
+417,7
@@
SilcBool silc_thread_pool_run(SilcThreadPool tp,
if (tp->destroy) {
silc_mutex_unlock(tp->lock);
if (tp->destroy) {
silc_mutex_unlock(tp->lock);
+ silc_set_errno(SILC_ERR_NOT_VALID);
return FALSE;
}
return FALSE;
}
@@
-422,6
+429,7
@@
SilcBool silc_thread_pool_run(SilcThreadPool tp,
/* Maximum threads reached */
if (!queuable) {
silc_mutex_unlock(tp->lock);
/* Maximum threads reached */
if (!queuable) {
silc_mutex_unlock(tp->lock);
+ silc_set_errno(SILC_ERR_LIMIT);
return FALSE;
}
return FALSE;
}