vlib: add error checks to thread pinning