Skip to content

Commit

Permalink
Raise FiberError if pthread resources is unavailable.
Browse files Browse the repository at this point in the history
  • Loading branch information
brixen committed Jun 21, 2016
1 parent b141c77 commit d7eb451
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion machine/builtin/fiber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,17 @@ namespace rubinius {
pthread_attr_setstacksize(&attrs, stack_size()->to_native());
pthread_attr_setdetachstate(&attrs, PTHREAD_CREATE_DETACHED);

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

pthread_attr_destroy(&attrs);

if(status != 0) {
char buf[RBX_STRERROR_BUFSIZE];
char* err = RBX_STRERROR(status, buf, RBX_STRERROR_BUFSIZE);
Exception::raise_fiber_error(state, err);
}

// Wait for Fiber thread to start up and pause.
while(!vm()->suspended_p()) {
; // spin wait
Expand Down

0 comments on commit d7eb451

Please sign in to comment.