[RFC] Fixes and improvements for jobs/streams/events

This PR does three things:

- Add code for dealing with msgpack parse failures(those are very rare but can happen as I experienced while running some manual tests)
- Enable transfering big amounts of data through WStream instances
- Use a single method of "locking" on a set of event sources, which is useful for #807  or the python ex command which will come after this.

@aktau, this should simplify the implementation of a job_sync function, it should be something like this:

```c
job = job_start(...); // start a job
job_write(job, data); // write all data to the job
job_set_defer(job, false); // disable event deferral, we want to process job events inside `event_poll`
while (!exited) { // exited can be a flag set when the job exits
  event_poll(-1);
}
```

I have not tested the above code but it should work, let me know if you have any questions.