ext/iodine/fio.c
/** locks a connection's protocol returns a pointer that need to be unlocked. */
locks a connection's protocol returns a pointer that need to be unlocked.
locks a connection ' s protocol returns a pointer that need to be unlocked .
inline static fio_protocol_s *protocol_try_lock(intptr_t fd,
                                                enum fio_protocol_lock_e type) {
  errno = 0;
  if (fio_trylock(&fd_data(fd).protocol_lock))
    goto would_block;
  fio_protocol_s *pr = fd_data(fd).protocol;
  if (!pr) {
    fio_unlock(&fd_data(fd).protocol_lock);
    goto invalid;
  }
  if (fio_trylock(&prt_meta(pr).locks[type])) {
    fio_unlock(&fd_data(fd).protocol_lock);
    goto would_block;
  }
  fio_unlock(&fd_data(fd).protocol_lock);
  return pr;
would_block:
  errno = EWOULDBLOCK;
  return NULL;
invalid:
  errno = EBADF;
  return NULL;
}
inline static fio_protocol_s * protocol_try_lock ( intptr_t fd , enum fio_protocol_lock_e type ) { errno = 0 ; if ( fio_trylock ( & fd_data ( fd ) . protocol_lock ) ) goto would_block ; fio_protocol_s * pr = fd_data ( fd ) . protocol ; if ( ! pr ) { fio_unlock ( & fd_data ( fd ) . protocol_lock ) ; goto invalid ; } if ( fio_trylock ( & prt_meta ( pr ) . locks [ type ] ) ) { fio_unlock ( & fd_data ( fd ) . protocol_lock ) ; goto would_block ; } fio_unlock ( & fd_data ( fd ) . protocol_lock ) ; return pr ; would_block : errno = EWOULDBLOCK ; return NULL ; invalid : errno = EBADF ; return NULL ; }
locks a connection's protocol returns a pointer that need to be unlocked.
locks a connection ' s protocol returns a pointer that need to be unlocked .