Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
IPC - Use SHM when available to notify of pending events
When SHM is available use it to notify other processes and threads that there are pending events. How this works: The shm holds a string, with an initial value. Each thread/proc tracks what it thinks the last value of the shm is. Whenever an event is sent via IPC it will change the shm value. Any thread/proc that then reads shm will see that it is out of sync and knows it should cull. It does not matter if other procs/threads also change the shm value as that still results in a difference, so long as all values are unique. For this to be effective shm should always be set to a unique value. In this case the Files driver filenames must always be unique, so we set the shm to the event filename. If something screws up and a proc or thread fails to see that there are pending events (because the shm value is repeated?) then the consequences are pretty minimal. Anything that depends on an event being read at a specific time should call cull() directly, which reads files without consulting the shm value. At the end of the test all hubs call cull() directly as well so all events will still be seen, just later than ideal. If an shm cannot be obtained, or is not avaialable then cull simply always polls alays assuming there are pending events.
- Loading branch information
Showing
5 changed files
with
149 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
oops, the return -1 should just be return, doesn't matter a lot as the return from this sub is ignored.