Re: Anything I should know about thread safety and fprintf?
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; bh=/UN5F2Sr3C65s7m1Bn9kaQHfQPnu7yiuOMVn89JrFXE=; b=fowA6FbUGLsRQi9cOVdFt42W6SsPXx54kVnZTXOTtV3ndMDD6JxOwseSEA7uDDDh46hfzdFzj+vobShr8TSw+BrvanUqncdu4mkHHI5g6iyziE0xe3vpnuBfrl+cu/WchoLwXD0F+SlVbTgfX/yBRrdsz/gAtGly/7H+TVcuBdw= Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=UvrWNLPT4d2p8XD/nXrwxd7WMhEx2fEfFMOBDDOjj9PtHXNulPXj+rWaG42HAn5G3QbtKnxx471trmy5UGpdkfUGZpKxa3R+Xn8cINLWpPK9l07VO4F9aQ7L48j5qH2vp5OnKr81urGhzHpJ0g961Fp74rApvN2AohqXgV8d9w4= On Jan 24, 2008 1:42 PM, Jonathan del Strother <maillist@steelskies.com> wrote:
On Jan 24, 2008 1:12 PM, Terry Lambert <tlambert@apple.com> wrote:
Please see my other posting. You are not fixing your underlying problem here.
My personal suggested fix would be to marshal the data to a single thread for disposition. Then your limit will be however much data you can jam down the drain pipe plus however much data you are willing to internally queue in your application in the marshalling process.
I'm only logging a few lines - maybe 500 characters in total - so I can't see how I'd be overloading the queue. Even if I did, presumably the write() call ought to return eventually?
I haven't yet been able to reproduce this outside of Xcode - it's tempting to blame it on an oddity in Xcode's run log and forget about it...
*Finally* found the problem, and am feeling dumb for not spotting the pattern before. Obviously it was nothing to do with fprintf and/or threads. In certain conditions, my application relaunches itself. When it does so, the new process would manage a few log messages, then the original process would quit, and the new process would block the next time it tried to write to stderr. So, I assume that the file handles created for the original process are getting inherited through to the new process, but not surviving once the old process exits. Looks like I need to find a better way of relaunching... Thanks for all the help and suggestions, Jon _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com
participants (1)
-
Jonathan del Strother