2 Jul
2021
2 Jul
'21
2:59 p.m.
Hi, Il 02/07/21 00:35, Zebediah Figura ha scritto:
static BOOL wined3d_cs_queue_is_empty(const struct wined3d_cs *cs, const struct wined3d_cs_queue *queue) { - wined3d_from_cs(cs); + wined3d_from_cs(cs->c.device); return *(volatile LONG *)&queue->head == queue->tail; }
That's not related to this patch, but it caught my attention: why are we using "volatile" here? My understanding is that "volatile" should only be used to deal with special memory (like MMIO), but I don't think this it is the case here. (or is it?) Here it seems that "volatile" is using to do inter-thread communication, but that's in general wrong: it doesn't protect from data races and it doesn't ensure atomicity. What am I missing? Giovanni.