ChimeraTK / ControlSystemAdapter

An adapter layer which allows to use control applications with different control system software environments.
GNU Lesser General Public License v3.0
3 stars 2 forks source link

Remove misleading comment in ProcessArray.h #10

Closed smarsching closed 7 years ago

smarsching commented 7 years ago

In ProcessArray.h we have a comment that says:

We do not use an spsc_queue for this queue, because might want to take elements from the sending thread, so there are two threads which might consume elements and thus an spsc_queue is not safe.

Funnily, this comment is right above the declaration of _fullBufferQueue, which is an spsc_queue. I actually think that this comment is not valid any longer, because we do not consume elements in the sending thread any longer.

This has to be verified and if true, the comment should be modified to say that we can use an spsc_queue because we do not consume elements in the sending thread.

killenb commented 7 years ago

You are right, the comment is outdated and wrong. If I am not mistaken it has to be an spsc queue now. The scheme for queue overflow has changed so an extra buffer is used, and the read operation has to compare the extra buffer and the queue without popping the first element from the queue. This "peek" is only possible with an spsc queue.

smarsching commented 7 years ago

I have made some changes to the comment (and also some other comments which I believe were outdated). @killenb Could you review my changes please and have a look whether the comments are now clearer?

mhier commented 7 years ago

@smarsching Thanks for correcting the comments. I forgot to update them when changing the code. I just added one detail explaining why we have to use an spsc_queue (an mpmc queue would still be preferred but is not possible due to technical restrictions).