Skip to main content
9 events
when toggle format what by license comment
Oct 19, 2015 at 6:20 comment added sun Unfortunately I am in vs 2013 so I can't use constexpr.
Oct 19, 2015 at 4:13 comment added sun Thanks. I suppose you mean the __mm_pause() intrinsics. A requirement I forgot the mention is writes need to happen as fast as they can but it can overwrite the last written slot if no slot is available. And the sequence of writes need to be mainaintained in increasing order. So it can go from 1-2-3 to 1-2-4 but not 1-4-3.
Oct 15, 2015 at 14:37 comment added Surt Depending on your usage you could add code like I added at the end to both your read and write. Using mutex and condition vars is sure to bring about a task switch at some point costing from 1200ns to 50K ns + any duration before it gets switch in again.
Oct 15, 2015 at 14:35 history edited Surt CC BY-SA 3.0
added 303 characters in body
Oct 15, 2015 at 14:29 comment added sun True. It is a lossy buffer and it can fail reads and writes. Does it make sense?
Oct 15, 2015 at 14:25 comment added Surt I meant one will return without it having been able to read respectively write a buffer.
Oct 15, 2015 at 14:14 comment added sun Thanks for your comments and for catching the leak I missed. I thought a lot about the wait-freeness of the buffer but kind of forgot about allocations and readable code :). I don't understand your comment about "At some point the 2 threads will come so much out of synch that one will fail.". Can you elaborate?
Oct 15, 2015 at 13:26 vote accept sun
Oct 14, 2015 at 18:02 history answered Surt CC BY-SA 3.0