Hi Krzysztof,

On Fri, 19 Jun 2009, Krzysztof Foltman wrote:

> Gabriel M. Beddingfield wrote:
>> I'm proposing that we change it to:
>>
>>      void lock();
>>      bool try_lock();
>>
>> Approve?  Object?  Thoughts?  Comments?  Don't know?  :-)
>>
> const char *? With sugar on top?
>
> (with restriction that it can ONLY be set to global static strings, not
> something out of string::c_str() or equivalent)

If someone objected, this is exactly what I was going to propose.  But I 
would rather not do it if I don't have to.  :-)

Here's what I had in mind as proposal B:

    void lock(const char*, int);

    #define FILE_LINE __FILENAME__, __LINE__

Then things would be used like this:

    AudioEngine::get_instance()->lock( FILE_LINE );

And then allow tracing to be turned on or off at run time like this:

    void AudioEngine::lock(const char* file, int line)
    {
        AELOCKLOG(file, line);    // New macro for Logger
        pthread_mutex_lock(...);
    }

That macro could use a QString if audio engine lock logging is turned 
on... with a performance hit if logging is enabled.

...or the logger thread would quickly copy the pointer and the integer and 
resolve it later.  This would have very good performance, but it doesn't 
sound like fun to integrate into the logging queue.  :-)

Peace,
Gabriel

------------------------------------------------------------------------------
Are you an open source citizen? Join us for the Open Source Bridge conference!
Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250.
Need another reason to go? 24-hour hacker lounge. Register today!
http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
_______________________________________________
Hydrogen-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hydrogen-devel

Reply via email to