Skip to content

Commit d7eb451

Browse files
committed
Raise FiberError if pthread resources is unavailable.
1 parent b141c77 commit d7eb451

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

machine/builtin/fiber.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,17 @@ namespace rubinius {
6262
pthread_attr_setstacksize(&attrs, stack_size()->to_native());
6363
pthread_attr_setdetachstate(&attrs, PTHREAD_CREATE_DETACHED);
6464

65-
pthread_create(&vm()->os_thread(), &attrs,
65+
int status = pthread_create(&vm()->os_thread(), &attrs,
6666
Fiber::run, (void*)vm());
6767

6868
pthread_attr_destroy(&attrs);
6969

70+
if(status != 0) {
71+
char buf[RBX_STRERROR_BUFSIZE];
72+
char* err = RBX_STRERROR(status, buf, RBX_STRERROR_BUFSIZE);
73+
Exception::raise_fiber_error(state, err);
74+
}
75+
7076
// Wait for Fiber thread to start up and pause.
7177
while(!vm()->suspended_p()) {
7278
; // spin wait

0 commit comments

Comments
 (0)