Make QNR_IODeviceStream thread-safe