On 04/05 02:21:36, Dmitry Eremin-Solenikov wrote: > On 05.04.2017 00:25, Brian Brooks wrote: > > On 04/04 23:23:33, Dmitry Eremin-Solenikov wrote: > >> On 04.04.2017 22:25, Maxim Uvarov wrote: > >>> it's better to have 2 separate files for that. One for ODP_CONFIG_LLDSCD > >>> defined and one for not. > >> > >> Seconding that. At least LLDSCD and non-LLDSCD code should not be > >> interleaved. > > > > Can you explain your judgement? > > Consider reading two intermixed books of technical recipes. It is just > my opinion, but I'd prefer to have two separate code blocks: one for > LLDSCD, one for non-LLDSCD cases.
I highly recommend that you read the books in this case! Especially since this is not a concurrent queue that you can find in a book or in a paper (to my limited knowledge). I found it helpful to sort the code _first_ by operation (enq / deq), and _next_ by variation (lock / LL/SC). E.g. understand the enqueue operation for the lock case (simple) and then for the LL/SC variant (not as simple). If the two were separated, you would have to jump around a lot more which also increase the chance of "fixed a bug here, missed the bug over there." > -- > With best wishes > Dmitry