Tidy up object event API, implement asynchronous event callbacks

Replaced the signalled member of object_event_t with a flags field.
This has a signalled flag, as well as a new OBJECT_EVENT_ERROR flag
which is set to indicate which event caused the error when an error is
returned from kern_object_wait().

Also added is OBJECT_EVENT_EDGE which will implement edge-triggered
wait semantics. The current level-triggered behaviour will signal an
event immediately if the event condition is true at the time that
kern_object_wait() is called. In edge-triggered mode the event will
only be signalled on a change of the event condition from false to
true. This is not implemented completely by this commit, it is added
in following commits.

Finally, implemented asynchronous event callbacks. Threads can register
a callback function for an object event which will be executed when the
event occurs via a thread interrupt. They are registered with an
interrupt priority, which means that they can be temporarily blocked by
changing the IPL. Callbacks work in edge-triggered mode only for the
moment, as supporting level-triggered mode for them would be somewhat
more complex.