This patch updates the signal API to avoid raw pointers, and replaces the Context_already_in_use and Context_not_associated exceptions by diagnostic messages. Fixes #5247