On Fri, February 20, 2009 8:02 am, Sebastian Moors wrote:
> has anyone an explanation why it is useful to use a seperate thread for
> logging? Ok, we can safe messages in a queue and write them to a file

I think the idea is that only one thread should be writing to
stdout/file/console.

Inside the audio callback, we must be "realtime safe."  We can't call any
functions that could wait (such as malloc(), printf(), new, cin, cout,
etc.)  This means that you can't have any logging or messages from within
the audio code.  However, with a well-buffered logger -- we can.  (Note: 
I don't know if H2's logger is implemented realtime safe... but it *could*
be.)

> easily ( no need to reopen the file often). But the queue seems to be
> not really useful for debugging, sometimes it's confusing because you
> can't see the output of INFOLOG or something in the terminal because it
> segfaulted before the logger thread got active, but the program flow

While it doesn't help with debugging a segfault, it's been the *only* way
for me to get debugging feedback while working on the audio stuff
(especially transport issues).  If you single-step through that stuff, the
audio servers (i.e. jack) will see that you are taking too long and cut
you off.  And you can only single-step through one thread, to boot.

> reached a line or two *after* the output. No a big problem when you do
> step-by-step debugging with a compiler, but it can confuse you

what about a logging *daemon*??  <gabe ducks>

> sometimes. And the logfile, well, i haven't used this feature or saw
> anyone using it.

I don't think I use the logfile.  I usually redirect stdout and stderr (so
that I can get jack messages, too).

-- 
               G a b r i e l   M   B e d d i n g f i e l d


------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Hydrogen-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hydrogen-devel

Reply via email to