-
Notifications
You must be signed in to change notification settings - Fork 564
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #284 Add support for Thread.onSpinWait() while spinning #285
base: master
Are you sure you want to change the base?
Conversation
This is fixing MpqBurstCost and QueueBurstCost multi-consumer scenario and will make both to look similar.
Fixes JCTools#272 BurstCost aren't handling multi-consumers correctly
+ javadoc + tweak visibility of methods
…CTools#281) QueueSanityTest::testSize with chunkSize = 1 and 1 recycled chunks was failing with a blocked poll because it wasn't handling ccChunkIndex == ciChunkIndex as an isFirstElementOfNextChunk case
e0f5288
to
6ecf6b9
Compare
Probably |
Here LMAX-Exchange/disruptor#183 (comment) some more information on how we could bring this in with 1.6, if it worths doing it |
If I understand correctly you want public class ThreadShim {
public static void onSpinWait() {
// do nothing
}
} In another directory e.g. /** will load this one from META-INF/versions/9 in any JDK >= JDK9*/
public class ThreadShim {
public static void onSpinWait() {
Thread.onSpinWait();
}
} You now need to ensure that the JDK9+ implementation is in a special place in the jar ( There is an example of how to do this for a JDK9+ vectorised |
} | ||
|
||
// prevent construction... | ||
private ThreadHints() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used to do this too, but my current thinking is that it is pointless. The class is final, it has no fields, no methods that are not static. If some idiot wants to instantiate it, so what?
In its current state this will not fly with building on 8 with JDK6 compatibility. |
I know, I've yet to work on this to make it possible, but still not sure what to do: the idea of @richardstartin seems reasonable to me, but probably will need to support Multi-Release jar. |
@nitsanw Nitsan, bud, I cannot add any label to this PR, can you do it for me? is "DON'T MERGE IT YET" in red; I will change it accordly when I've a bit of time and will proceed on this 👍 |
There's a demo of how to do this with Maven here. |
I've opened this for discussion: I'll push different commits to propose places where
onSpinWait
could be welcome, if I'll solve first the compilation error: