summaryrefslogtreecommitdiffstats
path: root/lib/libthr/arch/i386/i386/_setcurthread.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libthr/arch/i386/i386/_setcurthread.c')
-rw-r--r--lib/libthr/arch/i386/i386/_setcurthread.c11
1 files changed, 8 insertions, 3 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.
OpenPOWER on IntegriCloud