Closed explosion-mental closed 2 years ago
Using this would get rid of the child process, but timing the intervals accurately would be hard.
I'll have a look but AFAIK, using alarm() in the parent will lead to some inaccuracies. If it's within acceptable bounds, then implementing it would be worth it.
yeah no need for the timer loop. I've implemented this in my dwm https://github.com/explosion-mental/Dwm/blob/d056028b8df0d7286df0cf29effa5c296bcbd0d9/dwm.c#L3461 with the same logic of dwmblocks-async
I'll have a look but AFAIK, using alarm() in the parent will lead to some inaccuracies.
Like? I have an interval of 10
seconds. Havent tested with less time. The less you can go is with 1
second, but probably if you have a block update every second would mean to send a signal every seconds and im not sure if thats 'safe' at all.
That's safe, because signals are queued. What's going to be difficult is only executing alarm() once per interval inside the while loop.
calling alarm in the handler, func I showed u above, and before the loop should do the trick
oh and off topic but, thought about using poll
? only reason being portability I guess
Thank you for the suggestion @explosion-mental . I have redone the timer logic using alarm()
through 23e1d5732a8c9eb0d811a49cea151c066627edcb due to which the codebase is a bit simpler now. Moreover, there won't be any need to apply the pgrep
modification to the dwm
source now.
Regarding your suggestion about poll
. I'd stick to epoll
for now and wait until an issue pops up in the future, if at all.
I am closing this issue, please feel free to reopen it.
@explosion-mental I did a rewrite for this project utilising POSIX-compliant features. Let me know if that does the job for you.
Hello, what about using
alarm
to notify the parent?