On 04/20/2013 05:59 AM, Alan Corey wrote:
I've
just got hold of a card and looking into this.
Do you mean a dongle? I got one of the $20 ones, which works pretty
well in Windows with SDR# and RTL1090, so I bought a second one.
>
> By specification, pthread_mutex_unlock() has undefined behaviour when
> unlocking a mutex which is already unlocked.
Note also that rtl_fm uses mutexes as semaphores/condition variables,
it locks mutexes in one thread and unlocks them in another thread -
which is undefined behavior (Except if the mutex is recursive or error
checking, in which case pthread_mutex_unlock must
detect this situation and return an error).
You're only supposed to unlock a mutex by the same thread that locked
it, and it's possible OpenBSD bails out if you do otherwise.
Is there a reason for doing it this way rather than using sem_post
and sem_wait?