[DGD] Kernel library question
bart at wotf.org
bart at wotf.org
Wed Aug 22 13:36:41 CEST 2018
On Wed, 22 Aug 2018 04:19:18 -0700, Raymond Jennings wrote
> Felix:
>
> Concerning how you originally designed the kernel library, what
> happens if a callout goes off while callouts are suspended?
>
> Inspecting the source code, it would appear that the callout is
> requeued at LONG_TIME
>
> But I noticed a potential oversight:
>
> 1. The handle of the requeued callout might change
> 2. What happens if we try to remove_call_out(old_handle)?
>
> If a suspended callout's handle changes, should the "real" handle be
> hidden from higher layers?
While I cannot answer what Felix' intention was, this is the exact solution I
implemented in the wotf kernel to handle this situation.
The wotf kernel 'emulates' the classic lpmud find/remove_callout functions,
which do not return a handle, but simply a 'time left', and use status() to do
a lookup of call_outs by name. The disadvantage is obviously that you can only
find/remove the first call_out with a given name (and have to rinse and repeat
to remove all with a given name), but that is also a consequence of a desire
to be compatible with a pre-existing api, this could be implemented
differently so it returns an array with call_outs and lets you specify which
instance you want to remove (which would be subject to race conditions unless
the find and remove are done in the same 'thread'.
Bart.
--
https://www.bartsplace.net/
https://wotf.org/
https://www.flickr.com/photos/mrobjective/
More information about the DGD
mailing list