File:  [DVB] / dietlibc / libpthread / pthread_rwlock_trywrlock.c
Revision 1.1: download - view: text, annotated - select for diffs
Sat Aug 27 17:35:13 2016 UTC (7 years, 9 months ago) by leitner
Branches: MAIN
CVS tags: HEAD
  add really crappy pthread_rwclock implementation for openssl 1.1

#include <pthread.h>
#include <errno.h>

int pthread_rwlock_trywrlock(pthread_rwlock_t *rwlock) {
  do {
    unsigned int cur=rwlock->n;
    if (cur)
      return EBUSY;
  } while (!__sync_bool_compare_and_swap(&rwlock->n,0,0x80000000));
  return 0;
}

LinuxTV legacy CVS <linuxtv.org/cvs>