Skip to content

Instantly share code, notes, and snippets.

@Araq
Created February 27, 2016 01:51
Show Gist options
  • Select an option

  • Save Araq/5c1db2d505a9094e185d to your computer and use it in GitHub Desktop.

Select an option

Save Araq/5c1db2d505a9094e185d to your computer and use it in GitHub Desktop.
const CacheLineSize = 32 # true for most archs
type
Barrier = object
entered: int
cv: Semaphore # Semaphore takes 3 words at least
when sizeof(int) < 8:
cacheAlign: array[CacheLineSize-4*sizeof(int), byte]
left: int
cacheAlign2: array[CacheLineSize-sizeof(int), byte]
interest: bool ## wether the master is interested in the "all done" event
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment