File:  [DVB] / dietlibc / libpthread / pthread_rwlock_unlock.c
Revision 1.1: download - view: text, annotated - select for diffs
Sat Aug 27 17:35:14 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_unlock(pthread_rwlock_t *rwlock) {
  unsigned int cur,next;
  do {
    cur=rwlock->n;
    if (cur==0x80000000)
      next=0;
    else if (cur>0)
      next=cur-1;
    else {
      errno=EPERM;
      return -1;
    }
  } while (!__sync_bool_compare_and_swap(&rwlock->n,cur,next));
  return 0;
}

LinuxTV legacy CVS <linuxtv.org/cvs>