pzl / statbar

A Linux status bar, supporting multiple lightweight clients (multi-head)
MIT License
16 stars 1 forks source link

shared mem cleanup #9

Open pzl opened 7 years ago

pzl commented 7 years ago

Sometimes, on crashes, /dev/shm/statbar is left behind, and not appropriately detected as "dead" on next run. Client will hang waiting for data

pzl commented 7 years ago

I read here that

if the key is removed (via the shm_unlink(2) system call), the object persists until all handles are destroyed.

It sounds like after server and client have connected over the SHM, we might be able to immediately unlink it, and the conn will stay around until the program dies (or crashes). This might prevent other clients from opening it, if it's been unlinked (though possibly not, if it's not been cleaned up yet?). Testing is needed