Csound Csound-dev Csound-tekno Search About

[Cs-dev] pthreads and perfThread

Date2014-11-05 19:08
FromAndres Cabrera
Subject[Cs-dev] pthreads and perfThread
AttachmentsNone  None  
Hi,

I was thinking about the pthreads dependency for the perfThread class, which seems to have caused some issues. I'm using raw pthreads because I need a wait condition that is signalled to tell the audio file recording thread (yes, there is now an audio recording function that is part of perfthread :) ) that there is data available on the ring buffer:

https://github.com/csound/csound/blob/develop/interfaces/csPerfThread.cpp#L126

I know there are the thread notifier functions in the API, which seem to do a similar thing, but I am unsure that they actually do, as I don't know enough about these condition variables and how they should be used (for instance, why do they always need to go together with a mutex?)

https://github.com/csound/csound/blob/develop/include/csound.h#L1845

Should I replace the condition variables I am using in perfThread with Csound's ones, or should a new set of condition variable functions be added to the csound API?

Cheers,
Andrés

Date2014-11-05 19:10
FromOeyvind Brandtsegg
SubjectRe: [Cs-dev] pthreads and perfThread
could this be related to the multithread issue I reported today?

2014-11-05 20:08 GMT+01:00 Andres Cabrera :
> Hi,
>
> I was thinking about the pthreads dependency for the perfThread class, which
> seems to have caused some issues. I'm using raw pthreads because I need a
> wait condition that is signalled to tell the audio file recording thread
> (yes, there is now an audio recording function that is part of perfthread :)
> ) that there is data available on the ring buffer:
>
> https://github.com/csound/csound/blob/develop/interfaces/csPerfThread.cpp#L126
>
> I know there are the thread notifier functions in the API, which seem to do
> a similar thing, but I am unsure that they actually do, as I don't know
> enough about these condition variables and how they should be used (for
> instance, why do they always need to go together with a mutex?)
>
> https://github.com/csound/csound/blob/develop/include/csound.h#L1845
>
> Should I replace the condition variables I am using in perfThread with
> Csound's ones, or should a new set of condition variable functions be added
> to the csound API?
>
> Cheers,
> Andrés
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>



-- 

Oeyvind Brandtsegg
Professor of Music Technology
NTNU
7491 Trondheim
Norway
Cell: +47 92 203 205

http://flyndresang.no/
http://www.partikkelaudio.com/
http://soundcloud.com/brandtsegg
http://soundcloud.com/t-emp

------------------------------------------------------------------------------
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2014-11-05 19:16
FromRory Walsh
SubjectRe: [Cs-dev] pthreads and perfThread
Audio recording from the performance thread. Nice.

On 5 November 2014 19:10, Oeyvind Brandtsegg  wrote:
> could this be related to the multithread issue I reported today?
>
> 2014-11-05 20:08 GMT+01:00 Andres Cabrera :
>> Hi,
>>
>> I was thinking about the pthreads dependency for the perfThread class, which
>> seems to have caused some issues. I'm using raw pthreads because I need a
>> wait condition that is signalled to tell the audio file recording thread
>> (yes, there is now an audio recording function that is part of perfthread :)
>> ) that there is data available on the ring buffer:
>>
>> https://github.com/csound/csound/blob/develop/interfaces/csPerfThread.cpp#L126
>>
>> I know there are the thread notifier functions in the API, which seem to do
>> a similar thing, but I am unsure that they actually do, as I don't know
>> enough about these condition variables and how they should be used (for
>> instance, why do they always need to go together with a mutex?)
>>
>> https://github.com/csound/csound/blob/develop/include/csound.h#L1845
>>
>> Should I replace the condition variables I am using in perfThread with
>> Csound's ones, or should a new set of condition variable functions be added
>> to the csound API?
>>
>> Cheers,
>> Andrés
>>
>> ------------------------------------------------------------------------------
>>
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>
>
>
> --
>
> Oeyvind Brandtsegg
> Professor of Music Technology
> NTNU
> 7491 Trondheim
> Norway
> Cell: +47 92 203 205
>
> http://flyndresang.no/
> http://www.partikkelaudio.com/
> http://soundcloud.com/brandtsegg
> http://soundcloud.com/t-emp
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel

------------------------------------------------------------------------------
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https:/

Date2014-11-05 19:34
FromAndres Cabrera
SubjectRe: [Cs-dev] pthreads and perfThread
AttachmentsNone  None  
No, I think it isn't, are you using perfThread? (In any case, I can't see how my changes could affect the global API lock)

It's more related to Rory having to statically link pthreads (and some issues Steven had to fix on the build system to have the perfThread.

Cheers,
Andrés

On Wed, Nov 5, 2014 at 11:10 AM, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:
could this be related to the multithread issue I reported today?

2014-11-05 20:08 GMT+01:00 Andres Cabrera <mantaraya36@gmail.com>:
> Hi,
>
> I was thinking about the pthreads dependency for the perfThread class, which
> seems to have caused some issues. I'm using raw pthreads because I need a
> wait condition that is signalled to tell the audio file recording thread
> (yes, there is now an audio recording function that is part of perfthread :)
> ) that there is data available on the ring buffer:
>
> https://github.com/csound/csound/blob/develop/interfaces/csPerfThread.cpp#L126
>
> I know there are the thread notifier functions in the API, which seem to do
> a similar thing, but I am unsure that they actually do, as I don't know
> enough about these condition variables and how they should be used (for
> instance, why do they always need to go together with a mutex?)
>
> https://github.com/csound/csound/blob/develop/include/csound.h#L1845
>
> Should I replace the condition variables I am using in perfThread with
> Csound's ones, or should a new set of condition variable functions be added
> to the csound API?
>
> Cheers,
> Andrés
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>



--

Oeyvind Brandtsegg
Professor of Music Technology
NTNU
7491 Trondheim
Norway
Cell: +47 92 203 205

http://flyndresang.no/
http://www.partikkelaudio.com/
http://soundcloud.com/brandtsegg
http://soundcloud.com/t-emp

------------------------------------------------------------------------------
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel