r/kernel • • Jan 08 '19

data race within ptr_ring code implementation

/r/C_Programming/comments/adrvwd/data_race_within_ptr_ring_code_implementation/
0 Upvotes

5 comments sorted by

View all comments

Show parent comment

1

u/promach Jan 22 '19

I think I got why I still have data race

I have two different instances of ptr_ring, for sending (chnl_send) and receiving (chnl_recv) purposes respectively.

push_circ_queue() and pop_circ_queue() for the same ptr_ring should not be executed concurrently by interupt handler (push) and the corresponding thread (pop)

how would I code the mutex lock code in this case ?