elast0ny / shared_memory

A Rust wrapper around native shared memory for Linux and Windows
382 stars 51 forks source link

Using AtomicPtr like AtomicBool in raw example? #36

Closed serzhiio closed 5 years ago

serzhiio commented 5 years ago

Is it possible?

asajeffrey commented 5 years ago

The problem with AtomicPtr is that it uses the process address space, and different processes have different address spaces. You can't send pointers between processes.

elast0ny commented 5 years ago

It would be possible but @asajeffrey highlighted why it would not be useful/valid to do so. Even the shared memory itself doesnt get mapped at the same address in two different processes that use it.

If you need pointer sized values to live in the shmem, you could use Atomic[U/I]size