A really quick example of implementing a timer via a loadable function based on a requested by Unicon user Michael Meehan (https://sourceforge.net/p/unicon/mailman/message/35484499/)
This is more of a draft, please fee free to use/improve as you see fit and probably contribute back :-)
global count
procedure sigalrm(s)
count +:= 1
write ("fire timer ", count)
end
procedure sigint(s)
stop ("you just pressed ctrl-c")
end
procedure main()
count := 0
timer := loadfunc("./time.so", "setTimer")
#start after 5 seconds, fire the time every seconds
timer(5000, 1000)
trap("SIGALRM", sigalrm)
trap("SIGINT", sigint)
write("Press Ctrl+c to exit...")
repeat {}
end
A really quick example of implementing a timer via a loadable function based on a requested by Unicon user Michael Meehan (https://sourceforge.net/p/unicon/mailman/message/35484499/)
This is more of a draft, please fee free to use/improve as you see fit and probably contribute back :-)
Sample Run: