equal
deleted
inserted
replaced
37 Tickspan _sleep_time; |
37 Tickspan _sleep_time; |
38 uint _spins; |
38 uint _spins; |
39 uint _yields; |
39 uint _yields; |
40 uint _spin_limit; |
40 uint _spin_limit; |
41 uint _yield_limit; |
41 uint _yield_limit; |
|
42 uint _sleep_ns; |
42 |
43 |
43 void yield_or_sleep(); |
44 void yield_or_sleep(); |
44 |
45 |
45 public: |
46 public: |
46 static const uint default_spin_limit = 4096; |
47 static const uint default_spin_limit = 4096; |
47 static const uint default_yield_limit = 64; |
48 static const uint default_yield_limit = 64; |
|
49 static const uint default_sleep_ns = 1000; |
48 |
50 |
49 // spin_limit is ignored (treated as zero) when !os::is_MP(). |
51 // spin_limit is ignored (treated as zero) when !os::is_MP(). |
50 explicit SpinYield(uint spin_limit = default_spin_limit, |
52 explicit SpinYield(uint spin_limit = default_spin_limit, |
51 uint yield_limit = default_yield_limit); |
53 uint yield_limit = default_yield_limit, |
|
54 uint sleep_ns = default_sleep_ns); |
52 |
55 |
53 // Perform next round of delay. |
56 // Perform next round of delay. |
54 void wait() { |
57 void wait() { |
55 // Simple policy: return immediately (spinning) configured number |
58 // Simple policy: return immediately (spinning) configured number |
56 // of times, then switch to yield/sleep. Future work might |
59 // of times, then switch to yield/sleep. Future work might |