| Your point about multi-processors is well taken. I will attempt to
implement your conditional code in csound5.
Original Message:
-----------------
From: ramsdell@mitre.org (John D. Ramsdell)
Date: 27 Dec 2004 10:21:26 -0500
To: csound-dev@eartha.mills.edu
Subject: [CSOUND-DEV:5593] RE: FLTK threading rules and Csound4
"gogins@pipeline.com" writes:
> This is interesting, because my experience with CsoundVST is different.
>
> CsoundVST is uses FLTK. CsoundVST runs Csound in a spawned thread, and
FLTK
> from the main thread. FLTK is compiled for multi-threading.
>
> Both threads call Fl::lock();Fl::wait(0);Fl::unlock(); with no problem. I
> never call Fl::awake() (this is the first I've heard of it).
I'm was confident that CsoundVST correctly used FLTK and followed its
rules for multi-threaded applications. The focus of my comments is
what's csound/widgets.cpp. It's a fluke if the FLTK opcodes defined
in this file correctly worked with CsoundVST, because one can plainly
see they do not follow the rules for multi-threaded applications.
A key point I would like to emphasize, is that just because the
opcodes seem to work, that does not mean the implementation is
correct. Very soon, nearly all machines that will be used to run
Csound will contain more than one processor. On these machines,
unprotected shared state will be accessed and modified by multiple
threads in very unpredictable ways, ways not available on uniprocessor
machines.
To read more about why the age of the uniprocessor is dead, see Gibbs,
W. Wayt, "A Split at the Core", Scientific American, Volume 291,
Number 5, Pages 96-100.
Also note that I updated Csound4's configure.ac file so that it probes
the FLTK library to see if it was compiled with thread support
enabled. When it is, it defines HAVE_FL__LOCK. The configuration
system for Csound5 should make an equivalent check. The file
flcsound/src/main.cpp contains the code that generates a version of
flCsound that is either single or multi-threaded, based on
HAVE_FL__LOCK.
To fix the threading problem, I suspect csound/widgets.cpp will have
to changed so that the code in it employs the same tricks used by
flCsound's main routine, that is, the code will have to be
conditionalized on HAVE_FL__LOCK.
John
--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ . |