comparison src/os/linux/vm/os_linux.cpp @ 8675:63e54c37ac64

8008959: Fix non-PCH build on Linux, Windows and MacOS X Summary: Fix the build without precompiled headers by either including the missing ".inline.hpp" files into the appropriate files or by turning inline-functions declared in header files into ordinary functions in ".cpp" files. Reviewed-by: coleenp, stefank, dholmes
author simonis
date Wed, 27 Feb 2013 09:40:30 +0100
parents 4c1d8002ffb1
children 9058789475af
comparison
equal deleted inserted replaced
8105:94478a033036 8675:63e54c37ac64
3459 Thread* thread = Thread::current(); 3459 Thread* thread = Thread::current();
3460 OSThread* osthread = thread->osthread(); 3460 OSThread* osthread = thread->osthread();
3461 assert(thread->is_VM_thread(), "Must be VMThread"); 3461 assert(thread->is_VM_thread(), "Must be VMThread");
3462 // read current suspend action 3462 // read current suspend action
3463 int action = osthread->sr.suspend_action(); 3463 int action = osthread->sr.suspend_action();
3464 if (action == SR_SUSPEND) { 3464 if (action == os::Linux::SuspendResume::SR_SUSPEND) {
3465 suspend_save_context(osthread, siginfo, context); 3465 suspend_save_context(osthread, siginfo, context);
3466 3466
3467 // Notify the suspend action is about to be completed. do_suspend() 3467 // Notify the suspend action is about to be completed. do_suspend()
3468 // waits until SR_SUSPENDED is set and then returns. We will wait 3468 // waits until SR_SUSPENDED is set and then returns. We will wait
3469 // here for a resume signal and that completes the suspend-other 3469 // here for a resume signal and that completes the suspend-other
3481 3481
3482 // wait here until we are resumed 3482 // wait here until we are resumed
3483 do { 3483 do {
3484 sigsuspend(&suspend_set); 3484 sigsuspend(&suspend_set);
3485 // ignore all returns until we get a resume signal 3485 // ignore all returns until we get a resume signal
3486 } while (osthread->sr.suspend_action() != SR_CONTINUE); 3486 } while (osthread->sr.suspend_action() != os::Linux::SuspendResume::SR_CONTINUE);
3487 3487
3488 resume_clear_context(osthread); 3488 resume_clear_context(osthread);
3489 3489
3490 } else { 3490 } else {
3491 assert(action == SR_CONTINUE, "unexpected sr action"); 3491 assert(action == os::Linux::SuspendResume::SR_CONTINUE, "unexpected sr action");
3492 // nothing special to do - just leave the handler 3492 // nothing special to do - just leave the handler
3493 } 3493 }
3494 3494
3495 errno = old_errno; 3495 errno = old_errno;
3496 } 3496 }
3540 3540
3541 // returns true on success and false on error - really an error is fatal 3541 // returns true on success and false on error - really an error is fatal
3542 // but this seems the normal response to library errors 3542 // but this seems the normal response to library errors
3543 static bool do_suspend(OSThread* osthread) { 3543 static bool do_suspend(OSThread* osthread) {
3544 // mark as suspended and send signal 3544 // mark as suspended and send signal
3545 osthread->sr.set_suspend_action(SR_SUSPEND); 3545 osthread->sr.set_suspend_action(os::Linux::SuspendResume::SR_SUSPEND);
3546 int status = pthread_kill(osthread->pthread_id(), SR_signum); 3546 int status = pthread_kill(osthread->pthread_id(), SR_signum);
3547 assert_status(status == 0, status, "pthread_kill"); 3547 assert_status(status == 0, status, "pthread_kill");
3548 3548
3549 // check status and wait until notified of suspension 3549 // check status and wait until notified of suspension
3550 if (status == 0) { 3550 if (status == 0) {
3551 for (int i = 0; !osthread->sr.is_suspended(); i++) { 3551 for (int i = 0; !osthread->sr.is_suspended(); i++) {
3552 os::yield_all(i); 3552 os::yield_all(i);
3553 } 3553 }
3554 osthread->sr.set_suspend_action(SR_NONE); 3554 osthread->sr.set_suspend_action(os::Linux::SuspendResume::SR_NONE);
3555 return true; 3555 return true;
3556 } 3556 }
3557 else { 3557 else {
3558 osthread->sr.set_suspend_action(SR_NONE); 3558 osthread->sr.set_suspend_action(os::Linux::SuspendResume::SR_NONE);
3559 return false; 3559 return false;
3560 } 3560 }
3561 } 3561 }
3562 3562
3563 static void do_resume(OSThread* osthread) { 3563 static void do_resume(OSThread* osthread) {
3564 assert(osthread->sr.is_suspended(), "thread should be suspended"); 3564 assert(osthread->sr.is_suspended(), "thread should be suspended");
3565 osthread->sr.set_suspend_action(SR_CONTINUE); 3565 osthread->sr.set_suspend_action(os::Linux::SuspendResume::SR_CONTINUE);
3566 3566
3567 int status = pthread_kill(osthread->pthread_id(), SR_signum); 3567 int status = pthread_kill(osthread->pthread_id(), SR_signum);
3568 assert_status(status == 0, status, "pthread_kill"); 3568 assert_status(status == 0, status, "pthread_kill");
3569 // check status and wait unit notified of resumption 3569 // check status and wait unit notified of resumption
3570 if (status == 0) { 3570 if (status == 0) {
3571 for (int i = 0; osthread->sr.is_suspended(); i++) { 3571 for (int i = 0; osthread->sr.is_suspended(); i++) {
3572 os::yield_all(i); 3572 os::yield_all(i);
3573 } 3573 }
3574 } 3574 }
3575 osthread->sr.set_suspend_action(SR_NONE); 3575 osthread->sr.set_suspend_action(os::Linux::SuspendResume::SR_NONE);
3576 } 3576 }
3577 3577
3578 //////////////////////////////////////////////////////////////////////////////// 3578 ////////////////////////////////////////////////////////////////////////////////
3579 // interrupt support 3579 // interrupt support
3580 3580