[Question] HW 7 reason for having atomicUsize type in hazard field
thekioskman opened this issue · 2 comments
thekioskman commented
From my understanding, it seems the hazard: atomicUsize field is meant for storing the pointers to the actual data. But why usize used, when we can just use an atomicPointer? Is there any reasons for this. Or maybe I am misunderstanding the role of hazard: AtomicUsize.
kingdoctor123 commented
AtomicPtr<T>
is associated with the data type T
. But we want to use hazard: atomicUsize
field to store the address of any data with arbitrary type. For this reason, we use atomicUsize.
p.s. please elaborate your question in your title from next time.
thekioskman commented
thank you and will do 👍