Re: [LAD] Noob Q: Pthreads the way to go?

From: Jussi Laako <jussi@email-addr-hidden>
Date: Fri Nov 13 2009 - 13:48:22 EET

Harry Van Haaren wrote:
> That's the background to this question: Is mutex locking the only way to
> ensure that variables are only
> being accessed by one thread at a time? Is it the "right" way to go
> about it?

No, there are also semaphores and read-write locks. RW-locks are
especially useful in cases where there's a single writer but multiple
readers (typically any data distribution).

In general, threading is a wrong way to go if you find sharing and
locking a lot of data between the threads. Threads should be able to
execute fairly independently to properly utilize resources. Naturally
there are typically scatter-gather points which are supposed to be short
compared to overall thread execution time.
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-dev
Received on Fri Nov 13 16:15:01 2009

This archive was generated by hypermail 2.1.8 : Fri Nov 13 2009 - 16:15:02 EET