Csound Csound-dev Csound-tekno Search About

[Cs-dev] threading issues

Date2005-11-29 11:35
FromVictor Lazzarini
Subject[Cs-dev] threading issues
I have noticed that if we build csound with noFLTKThreads=1, somehow the
threading functions of the API get affected. I have not looked at the code, but
with that option, the resulting csound lib does not seem to spawn any threads.
I discovered that just now building on OSX 10.4, where FLTK only works in
a non-threading way. After building it that way, the TclCsound csPlay 
command (which
runs a csound performance in a separate thread, does not work (nothing
happens). Then just to make sure the problem was not with the Tcl core, I
run a Java multithreading app and that did not work as well.

Re-built csound with FLTK threads and it's all back working. Is this the
expected behaviour. I shouldn't think that disabling FLTK threads should 
disable
all threading in Csound, but what do I know?

Otherwise, the build is working perfectly on 10.4. There are some warnings
from csmodule.c, which I thought I had fixed and committed, bu they
seem to be back.

Victor

Victor Lazzarini
Music Technology Laboratory
Music Department
National University of Ireland, Maynooth 



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-11-29 12:48
FromIstvan Varga
SubjectRe: [Cs-dev] threading issues
AttachmentsNone  

Date2005-11-29 13:12
FromVictor Lazzarini
SubjectRe: [Cs-dev] threading issues
If I delete libwidgets.dylib, csPlay works. Would it be something
to do with the setting of the yield callback in winFLTK.cpp?

At 12:48 29/11/2005, you wrote:
>The noFLTKThreads=1 option does not affect anything that is not
>in the widgets plugin. This may be a Mac-specific issue. What happens
>if you delete the plugin ?
>By the way, note that using the same CSOUND* instance from multiple
>threads at the same time is often unsafe (for example, if one thread
>performs and another tries to create a note event, sometimes a crash
>may occur). You may need to synchronize access to the Csound API.

Victor Lazzarini
Music Technology Laboratory
Music Department
National University of Ireland, Maynooth 



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-11-29 14:27
FromVictor Lazzarini
SubjectRe: [Cs-dev] threading issues
I identified the problem and it is in winFLTK.c. For some reason,
setting the csoundYield callback in line 78 before check if it is
graphable etc causes the problem. If I remove that function call
and the ifdefs NO_FLTK_THREADS etc, it solves the problem.

The question is, does it have any other undesirable effect?

Victor


Victor Lazzarini
Music Technology Laboratory
Music Department
National University of Ireland, Maynooth 



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-11-29 14:48
FromIstvan Varga
SubjectRe: [Cs-dev] threading issues
AttachmentsNone  

Date2005-11-29 14:53
FromIstvan Varga
SubjectRe: [Cs-dev] threading issues
AttachmentsNone  

Date2005-11-29 15:10
FromVictor Lazzarini
SubjectRe: [Cs-dev] threading issues
What seems to be happening is that the yield callback
does not seem to be ever returning, making the
process stuck.

If the setting of the call back is done in line 87, it will not
happen if -d is used. Then it's fine with -d, but of course
with FLTK graphs it does not work anyway.

What I asked is whether we can retain the call on line 87
for all cases, no threads or else. Take it off line 78 altogether.
Can we do it?

The problem is definitely related to FLTK not working with
threads on OSX. It seems that is a probable bug with that
library.

Victor


At 14:53 29/11/2005, you wrote:
>On Tuesday 29 November 2005 15:27, Victor Lazzarini wrote:
>
> > I identified the problem and it is in winFLTK.c. For some reason,
> > setting the csoundYield callback in line 78 before check if it is
> > graphable etc causes the problem. If I remove that function call
> > and the ifdefs NO_FLTK_THREADS etc, it solves the problem.
> >
> > The question is, does it have any other undesirable effect?
>
>Yes, as the widget opcodes need Fl::wait() to be called somewhere,
>and if you remove the setting of a yield callback, the opcodes will
>probably not work unless graphs are also used at the same time.
>Also, this issue seems to be Mac-specific, and I do not really
>understand why setting the yield callback interferes with the
>creation of other threads that do not even use FLTK.
>
>
>-------------------------------------------------------
>This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
>for problems?  Stop!  Download the new AJAX search engine that makes
>searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
>http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
>_______________________________________________
>Csound-devel mailing list
>Csound-devel@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/csound-devel

Victor Lazzarini
Music Technology Laboratory
Music Department
National University of Ireland, Maynooth 



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-11-29 15:25
FromIstvan Varga
SubjectRe: [Cs-dev] threading issues
AttachmentsNone  

Date2005-11-29 15:36
FromVictor Lazzarini
SubjectRe: [Cs-dev] threading issues
Could the callback be enabled somewhere else just for
widgets? Fl_run() for instance?

At 15:25 29/11/2005, you wrote:
>On Tuesday 29 November 2005 16:10, Victor Lazzarini wrote:
>
> > What seems to be happening is that the yield callback
> > does not seem to be ever returning, making the
> > process stuck.
> >
> > If the setting of the call back is done in line 87, it will not
> > happen if -d is used. Then it's fine with -d, but of course
> > with FLTK graphs it does not work anyway.
> >
> > What I asked is whether we can retain the call on line 87
> > for all cases, no threads or else. Take it off line 78 altogether.
> > Can we do it?
>
>Again, the widget opcodes require the callback regardless of whether
>graph displays are enabled or not, so making changes that affect
>non-Mac platforms might not be a good idea. However, the main question
>is why the yield callback gets stuck ? Is it caused by the calls to
>Fl::lock() and Fl::unlock() ? If so, then those particular functions
>can be #ifdef'd out for OS X, especially given that locking is not
>needed if there is only one thread that uses FLTK.
>
>
>-------------------------------------------------------
>This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
>for problems?  Stop!  Download the new AJAX search engine that makes
>searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
>http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
>_______________________________________________
>Csound-devel mailing list
>Csound-devel@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/csound-devel

Victor Lazzarini
Music Technology Laboratory
Music Department
National University of Ireland, Maynooth 



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-11-29 15:50
FromVictor Lazzarini
SubjectRe: [Cs-dev] threading issues
The thread gets stuck in the call to Fl_wait(0.0); I suspect that is
the same problem that prevents us run FLTK in a separate thread
to csound.

Victor

At 15:25 29/11/2005, you wrote:


>Again, the widget opcodes require the callback regardless of whether
>graph displays are enabled or not, so making changes that affect
>non-Mac platforms might not be a good idea. However, the main question
>is why the yield callback gets stuck ? Is it caused by the calls to
>Fl::lock() and Fl::unlock() ? If so, then those particular functions
>can be #ifdef'd out for OS X, especially given that locking is not
>needed if there is only one thread that uses FLTK.

Victor Lazzarini
Music Technology Laboratory
Music Department
National University of Ireland, Maynooth 



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-11-29 15:50
FromIstvan Varga
SubjectRe: [Cs-dev] threading issues
AttachmentsNone  

Date2005-11-29 18:55
FromIstvan Varga
SubjectRe: [Cs-dev] threading issues
AttachmentsNone  

Date2005-11-29 21:01
Fromjpff@codemist.co.uk
SubjectRe: [Cs-dev] threading issues
Have you tried Fl_wait() ?
==John ffitch


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-11-30 09:32
FromVictor Lazzarini
SubjectRe: [Cs-dev] threading issues
I can't find this function anywhere.

At 21:01 29/11/2005, you wrote:
>Have you tried Fl_wait() ?
>==John ffitch
>
>
>-------------------------------------------------------
>This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
>for problems?  Stop!  Download the new AJAX search engine that makes
>searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
>http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
>_______________________________________________
>Csound-devel mailing list
>Csound-devel@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/csound-devel

Victor Lazzarini
Music Technology Laboratory
Music Department
National University of Ireland, Maynooth 



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net