add an example and switch to non-blocking to avoid deadloack