Refactor core functions to enable thread-safety in the API

- Remove lazy initialization of helper properties
- Add 'interrupt' method to the stream class, which allows other threads to
  call API functions while another one is blocking on `next_event`
- Synchronize access to `next_event`/`msgpack_rpc_call`