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

Fix time of day skew update and store almost all time related stuff in Atomic #3336

Closed
wants to merge 1 commit into from

Conversation

est31
Copy link
Contributor

@est31 est31 commented Nov 4, 2015

Store almost every time related variable in Atomic or GenericAtomic:

* Store the time of day into a storage Atomic<u64> so that
  the integral time of day doesn't get set differently than the
  float time of day in a race.

* Only the skew needs a lock now, there is no other way however
  than to use a lock, except removing the lock and hoping the best.
  floats can't get non-generic atomic operations, not with the
  current support of gcc. C++11 has an abstraction layer for them,
  but there is no widespread implementation in hardware.

Fix the skew update so that it is added too, not just substracted from.
This has been a regression since commit [1].

atomic.h changes:
* Add GenericAtomic class for non-integral types like floats.

* Remove some last remainders from atomic.h of the volatile use.

[1] f9b0936 "Time: Remove serverside getter, and use atomic operations"

Store almost every time related variable in Atomic or GenericAtomic:
	* Store the time of day into a storage Atomic<u64> so that
	  the integral time of day doesn't get set differently than
	  the float time of day in a race.

	* Only the skew needs a lock now. There is no other way however
	  than to use a lock, except removing the lock and hoping the best.
	  floats can't get non-generic atomic operations, not with the
	  current support of gcc. C++11 has an abstraction layer for them,
	  but there is no widespread implementation in hardware, so the
	  abstraction layer uses some "bad" mechanism as well like a lock
	  or similar.

Fix the skew update so that it is added to as well, not just substracted
from. This has been a regression of commit [1].

atomic.h changes:
	* Add GenericAtomic<T> class for non-integral types like floats.

	* Remove some last remainders from atomic.h of the volatile use.

[1] f9b0936 "Time: Remove serverside getter, and use atomic operations"
@est31 est31 force-pushed the time_of_day_almost_lock_free branch from ad937b6 to d3cd30b Compare November 4, 2015 01:28
@est31 est31 added Bug Issues that were confirmed to be a bug enhancement labels Nov 4, 2015
@est31
Copy link
Contributor Author

est31 commented Nov 4, 2015

The bug got fixed in 8f03995, and the atomics implemented in this PR are very much against KISS for no reason, performance is not this strict here.

@est31 est31 closed this Nov 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Issues that were confirmed to be a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant