From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ulrich Klauer Newsgroups: gmane.comp.audio.sox.devel Subject: Re: Sox with multiple threads? Date: Mon, 05 Aug 2013 19:29:09 +0200 Message-ID: <20130805192909.Horde.shFoKtY3aZLr6gNjs7trXw2@webmail.df.eu> References: <003001ce912d$0eaf7a20$2c0e6e60$@symonics.com> Reply-To: sox-devel@lists.sourceforge.net NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1375723772 14226 80.91.229.3 (5 Aug 2013 17:29:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 5 Aug 2013 17:29:32 +0000 (UTC) To: sox-devel@lists.sourceforge.net Original-X-From: sox-devel-bounces@lists.sourceforge.net Mon Aug 05 19:29:34 2013 Return-path: Envelope-to: gcasd-sox-devel@m.gmane.org Received-SPF: pass (sog-mx-2.v43.ch3.sourceforge.com: domain of chirlu.de designates 80.67.31.93 as permitted sender) client-ip=80.67.31.93; envelope-from=ulrich@chirlu.de; helo=smtprelay05.ispgateway.de; In-Reply-To: <003001ce912d$0eaf7a20$2c0e6e60$@symonics.com> User-Agent: Internet Messaging Program (IMP) H5 (6.0.4) Content-Disposition: inline X-Df-Sender: dWtsYXVlckBjaGlybHUuZGU= X-Spam-Score: -1.5 (-) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [80.67.31.93 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record X-Headers-End: 1V6Oat-0001dz-TB X-BeenThere: sox-devel@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: sox-devel-bounces@lists.sourceforge.net Xref: news.gmane.org gmane.comp.audio.sox.devel:307 Archived-At: Received: from lists.sourceforge.net ([216.34.181.88]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1V6Ob6-0004Lv-Bb for gcasd-sox-devel@m.gmane.org; Mon, 05 Aug 2013 19:29:32 +0200 Received: from localhost ([127.0.0.1] helo=sfs-ml-4.v29.ch3.sourceforge.com) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1V6Ob4-0006VD-Eg; Mon, 05 Aug 2013 17:29:30 +0000 Received: from sog-mx-2.v43.ch3.sourceforge.com ([172.29.43.192] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1V6Ob3-0006UR-5Y for sox-devel@lists.sourceforge.net; Mon, 05 Aug 2013 17:29:29 +0000 Received: from smtprelay05.ispgateway.de ([80.67.31.93]) by sog-mx-2.v43.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) id 1V6Oat-0001dz-TB for sox-devel@lists.sourceforge.net; Mon, 05 Aug 2013 17:29:29 +0000 Received: from [80.67.16.118] (helo=webmailfront01.ispgateway.de) by smtprelay05.ispgateway.de with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.68) (envelope-from ) id 1V6Oaj-0003uS-SX; Mon, 05 Aug 2013 19:29:09 +0200 Received: from 77-20-34-201-dynip.superkabel.de (77-20-34-201-dynip.superkabel.de [77.20.34.201]) by webmail.df.eu (Horde Framework) with HTTP; Mon, 05 Aug 2013 19:29:09 +0200 Christian Hoene wrote: > One question. Is sox reentrant. Can I fork a sox program and run two > sox chains in parallel? When you call fork(), the address space is duplicated, so unless there are already open files, the processes are completely independent. Re-entrancy, on the other hand, is hardly relevant. I guess what you really mean is thread safety. Unfortunately, libSoX uses some global state and is thus not completely thread-safe; even running two different chains in parallel in a single thread may lead to problems. However, if you a) use the same settings (buffer size etc.) for all chains, b) don't rely on the "subsystem" information in the message handler (either set verbosity to 0 or use a custom handler that doesn't read the subsystem value), c) don't mind a bit of extra randomness (read: race conditions) in the pseudo-random number generator, then it will probably work. Ulrich ------------------------------------------------------------------------------ Get your SQL database under version control now! Version control is standard for application code, but databases havent caught up. So what steps can you take to put your SQL databases under version control? Why should you start doing it? Read more to find out. http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk