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

Atomic distinct ptr doesn't work #11

Open
planetis-m opened this issue Jul 7, 2021 · 0 comments
Open

Atomic distinct ptr doesn't work #11

planetis-m opened this issue Jul 7, 2021 · 0 comments

Comments

@planetis-m
Copy link
Owner

import sync

type
  FooObj = object
    x: int
  Foo = distinct ptr FooObj

proc `=destroy`*(x: var FooObj) =
  echo "destroy ", x.x

proc main =
  var
    a: Atomic[Foo]
    b = create(FooObj).Foo
  (ptr FooObj)(b).x = 1
  a.store(b, Relaxed)

main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant