wrapping FFI calls inside tasks