ImmediateReturnWaitStrategy

56 views
Skip to first unread message

Magno Yu

unread,
Aug 9, 2023, 4:08:48 AM8/9/23
to Disruptor
Hi, 

     Has anyon explored a WaitStrategy that returns immediately whether there's work or not? (And have the busy loop outside of the WaitStrategy) In this scenario, then presumably we have to check barrier alert somewhere else but the use case is then my thread can do/check something else, as opposed to stuck inside the waitFor.

Thanks,
- Mag 

olivier...@gmail.com

unread,
Aug 9, 2023, 7:10:18 AM8/9/23
to Disruptor
Hello.

I suspect you could simply use a TimeoutBlockingWaitStrategy with a timeout of zero.

Olivier

Olivier Coanet

unread,
Aug 9, 2023, 7:34:30 AM8/9/23
to lmax-di...@googlegroups.com
I also think the EventPoller might be an interesting option if your goal is to avoid blocking the consumer thread.

--
You received this message because you are subscribed to the Google Groups "Disruptor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lmax-disrupto...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/lmax-disruptor/c356f5e5-9154-4715-9c00-1719eeed98edn%40googlegroups.com.

Magno Yu

unread,
Aug 9, 2023, 9:49:39 AM8/9/23
to lmax-di...@googlegroups.com
Let me try with 

public long waitFor(.....) {
       return dependentSequence.get()
}

I will do the < sequence and barrier.checkAlert check outside while my main thread could be used to check some other things. 

- Mag

You received this message because you are subscribed to a topic in the Google Groups "Disruptor" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/lmax-disruptor/oOM9b0Q0HmE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to lmax-disrupto...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/lmax-disruptor/CABT80xg6NUT6113gsisj%3DFJ1TRktyU74cnZi1QAwTPYR3Xrm8g%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages