src/os/linux/vm/os_linux.cpp

Print this page
rev 4205 : Fix non-PCH build on Linux, Windows and MacOS X

*** 3459,3469 **** Thread* thread = Thread::current(); OSThread* osthread = thread->osthread(); assert(thread->is_VM_thread(), "Must be VMThread"); // read current suspend action int action = osthread->sr.suspend_action(); ! if (action == SR_SUSPEND) { suspend_save_context(osthread, siginfo, context); // Notify the suspend action is about to be completed. do_suspend() // waits until SR_SUSPENDED is set and then returns. We will wait // here for a resume signal and that completes the suspend-other --- 3459,3469 ---- Thread* thread = Thread::current(); OSThread* osthread = thread->osthread(); assert(thread->is_VM_thread(), "Must be VMThread"); // read current suspend action int action = osthread->sr.suspend_action(); ! if (action == os::Linux::SuspendResume::SR_SUSPEND) { suspend_save_context(osthread, siginfo, context); // Notify the suspend action is about to be completed. do_suspend() // waits until SR_SUSPENDED is set and then returns. We will wait // here for a resume signal and that completes the suspend-other
*** 3481,3496 **** // wait here until we are resumed do { sigsuspend(&suspend_set); // ignore all returns until we get a resume signal ! } while (osthread->sr.suspend_action() != SR_CONTINUE); resume_clear_context(osthread); } else { ! assert(action == SR_CONTINUE, "unexpected sr action"); // nothing special to do - just leave the handler } errno = old_errno; } --- 3481,3496 ---- // wait here until we are resumed do { sigsuspend(&suspend_set); // ignore all returns until we get a resume signal ! } while (osthread->sr.suspend_action() != os::Linux::SuspendResume::SR_CONTINUE); resume_clear_context(osthread); } else { ! assert(action == os::Linux::SuspendResume::SR_CONTINUE, "unexpected sr action"); // nothing special to do - just leave the handler } errno = old_errno; }
*** 3540,3580 **** // returns true on success and false on error - really an error is fatal // but this seems the normal response to library errors static bool do_suspend(OSThread* osthread) { // mark as suspended and send signal ! osthread->sr.set_suspend_action(SR_SUSPEND); int status = pthread_kill(osthread->pthread_id(), SR_signum); assert_status(status == 0, status, "pthread_kill"); // check status and wait until notified of suspension if (status == 0) { for (int i = 0; !osthread->sr.is_suspended(); i++) { os::yield_all(i); } ! osthread->sr.set_suspend_action(SR_NONE); return true; } else { ! osthread->sr.set_suspend_action(SR_NONE); return false; } } static void do_resume(OSThread* osthread) { assert(osthread->sr.is_suspended(), "thread should be suspended"); ! osthread->sr.set_suspend_action(SR_CONTINUE); int status = pthread_kill(osthread->pthread_id(), SR_signum); assert_status(status == 0, status, "pthread_kill"); // check status and wait unit notified of resumption if (status == 0) { for (int i = 0; osthread->sr.is_suspended(); i++) { os::yield_all(i); } } ! osthread->sr.set_suspend_action(SR_NONE); } //////////////////////////////////////////////////////////////////////////////// // interrupt support --- 3540,3580 ---- // returns true on success and false on error - really an error is fatal // but this seems the normal response to library errors static bool do_suspend(OSThread* osthread) { // mark as suspended and send signal ! osthread->sr.set_suspend_action(os::Linux::SuspendResume::SR_SUSPEND); int status = pthread_kill(osthread->pthread_id(), SR_signum); assert_status(status == 0, status, "pthread_kill"); // check status and wait until notified of suspension if (status == 0) { for (int i = 0; !osthread->sr.is_suspended(); i++) { os::yield_all(i); } ! osthread->sr.set_suspend_action(os::Linux::SuspendResume::SR_NONE); return true; } else { ! osthread->sr.set_suspend_action(os::Linux::SuspendResume::SR_NONE); return false; } } static void do_resume(OSThread* osthread) { assert(osthread->sr.is_suspended(), "thread should be suspended"); ! osthread->sr.set_suspend_action(os::Linux::SuspendResume::SR_CONTINUE); int status = pthread_kill(osthread->pthread_id(), SR_signum); assert_status(status == 0, status, "pthread_kill"); // check status and wait unit notified of resumption if (status == 0) { for (int i = 0; osthread->sr.is_suspended(); i++) { os::yield_all(i); } } ! osthread->sr.set_suspend_action(os::Linux::SuspendResume::SR_NONE); } //////////////////////////////////////////////////////////////////////////////// // interrupt support