diff options
author | David Herrmann <dh.herrmann@googlemail.com> | 2013-01-13 11:42:04 +0100 |
---|---|---|
committer | David Herrmann <dh.herrmann@googlemail.com> | 2013-01-13 11:42:04 +0100 |
commit | 5ee2338b6095c5fa996f4d77a6cd9103f1d589d3 (patch) | |
tree | 873b33dcbb46de4df171268f89ba95ba44a4c159 /src/uterm_video.c | |
parent | 8fa28926cbe8fdcf0ec8f96d932e160399a1ac8a (diff) |
shl: hook: add 'oneshot' flag
If an entry is marked as 'oneshot' then it will get deleted after it has
been called once. Note that the entry is unlinked _before_ the callback is
called.
If you use 'oneshot'-entries and normal entries with the same cb+data
combination, then you will probably get unexpected behavior. It is not
recommended to do that. In detail, you cannot control which entry is
deleted via a shl_hook_rm() call so you can never be sure whether the
oneshot entry or a normal entry is deleted.
Do not mix oneshot entries with normal entries!
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Diffstat (limited to 'src/uterm_video.c')
-rw-r--r-- | src/uterm_video.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/uterm_video.c b/src/uterm_video.c index e7d6691..1b76d68 100644 --- a/src/uterm_video.c +++ b/src/uterm_video.c @@ -324,7 +324,7 @@ int uterm_display_register_cb(struct uterm_display *disp, uterm_display_cb cb, if (!disp) return -EINVAL; - return shl_hook_add_cast(disp->hook, cb, data); + return shl_hook_add_cast(disp->hook, cb, data, false); } void uterm_display_unregister_cb(struct uterm_display *disp, @@ -589,7 +589,7 @@ int uterm_video_register_cb(struct uterm_video *video, uterm_video_cb cb, if (!video || !cb) return -EINVAL; - return shl_hook_add_cast(video->hook, cb, data); + return shl_hook_add_cast(video->hook, cb, data, false); } void uterm_video_unregister_cb(struct uterm_video *video, uterm_video_cb cb, |