diff options
author | mtm <mtm@FreeBSD.org> | 2003-05-25 22:40:57 +0000 |
---|---|---|
committer | mtm <mtm@FreeBSD.org> | 2003-05-25 22:40:57 +0000 |
commit | d8e0ed54e351db48278bd6693dde605fcda057df (patch) | |
tree | 8bc5a970789c8f2762484249a02b9ccd0ccb6ef6 /lib/libthr/arch | |
parent | 54155a49a5a2b84f07b579c8e6af7e5f9c8e1d88 (diff) | |
download | FreeBSD-src-d8e0ed54e351db48278bd6693dde605fcda057df.zip FreeBSD-src-d8e0ed54e351db48278bd6693dde605fcda057df.tar.gz |
Return gracefully, rather than aborting, when the maximum concurrent
threads per process has been reached. Return EAGAIN, as per spec.
Approved by: re/blanket libthr
Diffstat (limited to 'lib/libthr/arch')
-rw-r--r-- | lib/libthr/arch/i386/i386/_setcurthread.c | 11 | ||||
-rw-r--r-- | lib/libthr/arch/ia64/ia64/_curthread.c | 4 | ||||
-rw-r--r-- | lib/libthr/arch/sparc64/sparc64/_setcurthread.c | 4 |
3 files changed, 12 insertions, 7 deletions
diff --git a/lib/libthr/arch/i386/i386/_setcurthread.c b/lib/libthr/arch/i386/i386/_setcurthread.c index 0483120..2cd27ca 100644 --- a/lib/libthr/arch/i386/i386/_setcurthread.c +++ b/lib/libthr/arch/i386/i386/_setcurthread.c @@ -87,13 +87,15 @@ _retire_thread(void *entry) } void * -_set_curthread(ucontext_t *uc, struct pthread *thr) +_set_curthread(ucontext_t *uc, struct pthread *thr, int *err) { union descriptor desc; void **ldt_entry; int ldt_index; int error; + *err = 0; + /* * If we are setting up the initial thread, the gs register * won't be setup for the current thread. In any case, we @@ -106,8 +108,11 @@ _set_curthread(ucontext_t *uc, struct pthread *thr) if (ldt_inited == NULL) ldt_init(); - if (ldt_free == NULL) - abort(); + if (ldt_free == NULL) { + /* Concurrent thread limit reached */ + *err = curthread->error = EAGAIN; + return (NULL); + } /* * Pull one off of the free list and update the free list pointer. diff --git a/lib/libthr/arch/ia64/ia64/_curthread.c b/lib/libthr/arch/ia64/ia64/_curthread.c index 3744f7c..6c3de0e 100644 --- a/lib/libthr/arch/ia64/ia64/_curthread.c +++ b/lib/libthr/arch/ia64/ia64/_curthread.c @@ -48,9 +48,9 @@ _retire_thread(void *v) } void * -_set_curthread(ucontext_t *uc, struct pthread *thread) +_set_curthread(ucontext_t *uc, struct pthread *thread, int *err) { - + *err = 0; if (uc != NULL) uc->uc_mcontext.mc_special.tp = (uint64_t)thread; else diff --git a/lib/libthr/arch/sparc64/sparc64/_setcurthread.c b/lib/libthr/arch/sparc64/sparc64/_setcurthread.c index 4f1a303..4c0fb88 100644 --- a/lib/libthr/arch/sparc64/sparc64/_setcurthread.c +++ b/lib/libthr/arch/sparc64/sparc64/_setcurthread.c @@ -48,9 +48,9 @@ _retire_thread(void *v) } void * -_set_curthread(ucontext_t *uc, struct pthread *thread) +_set_curthread(ucontext_t *uc, struct pthread *thread, int *err) { - + *err = 0; if (uc != NULL) uc->uc_mcontext.mc_global[6] = (uint64_t)thread; else |