Give each element a serial number #22
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "element-serial"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Address issue #20 by giving each
Element
a serial number, which identifies it uniquely (until the serial number wraps around). The serial number assigned by theElement::new
constructor.For future thread-safety, the next serial number is stored in a static atomic variable (
assembly::NEXT_ELEMENT_SERIAL
), as suggested in this StackOverflow answer. Since the overhead for keeping track of memory ordering should be minimal, we're using the strongest available ordering: sequentially consistent.I think the app prototype should be single-threaded for now, so for parsimony we could instead store the next serial number in a thread-local cell, as suggested in this other StackOverflow answer. The thread-local version is ready to go, so let me know which version you'd prefer to review.
As discussed over e-mail, we'll go with the thread-local version for now. Ready to review!
Checkout
From your project repository, check out a new branch and test the changes.