Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] HW 7 reason for having atomicUsize type in hazard field #963

Closed
thekioskman opened this issue Jun 14, 2024 · 2 comments
Closed
Assignees
Labels
homework - hazard_pointer hazard_pointer/{mod,hazard,retire}.rs question Further information is requested

Comments

@thekioskman
Copy link

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.

@thekioskman thekioskman added the question Further information is requested label Jun 14, 2024
@kingdoctor123 kingdoctor123 changed the title [Question} HW 7 Hazard Pointers: [Question] HW 7 reason for having atomicUsize type in hazard field Jun 14, 2024
@kingdoctor123
Copy link
Member

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.

@kingdoctor123 kingdoctor123 added the homework - hazard_pointer hazard_pointer/{mod,hazard,retire}.rs label Jun 14, 2024
@thekioskman
Copy link
Author

thank you and will do 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
homework - hazard_pointer hazard_pointer/{mod,hazard,retire}.rs question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants