Boost logo

Boost :

Subject: Re: [boost] Boost.log: set_channel name dynamically for a basic_composite_logger
From: syvyi (alexander.svk_at_[hidden])
Date: 2012-10-15 16:48:34


manster_logging_test.rar
<http://boost.2283326.n4.nabble.com/file/n4637182/manster_logging_test.rar>
Andrey, I am using v.1.1 in code attached in file. It is a test of 2 files.
Please, take a look at those files, tell if you succeed to compile them.
This is the same code as above but without adapter, which worked.

Info:

after tracing I get

Here is the problem, WatForSingleObject is called and after one BOOST_LOG
macros app. is frozen.

basic_time_mutex.cpp
void lock()
            {
                if(try_lock())
                {
                    return;
                }
                long old_count=active_count;
                mark_waiting_and_try_lock(old_count);

                if(old_count&lock_flag_value)
                {
                    bool lock_acquired=false;
                    void* const sem=get_event();

                    do
                    {
                        BOOST_VERIFY(win32::WaitForSingleObject(
                                        
sem,::boost::detail::win32::infinite)==0);
                        clear_waiting_and_try_lock(old_count);
                        lock_acquired=!(old_count&lock_flag_value);
                    }
                    while(!lock_acquired);
                }
            }

Then function below returns false.

sink_frontends.cpp
template< typename CharT >
BOOST_LOG_EXPORT bool synchronous_frontend< CharT >::try_consume(record_type
const& record)
{
    register implementation* pImpl = this->BOOST_NESTED_TEMPLATE get_impl<
implementation >();
    try
    {
        unique_lock< mutex > lock(pImpl->m_BackendMutex, try_to_lock);
        if (lock.owns_lock())
        {
            (pImpl->m_Consume)(pImpl->m_pBackend.get(), record);
            return true;
        }
        else
            return false; // returns
    }

in locks.hpp

 bool try_lock()
        {
            if(m==0)
            {
               
boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted,
"boost unique_lock has no mutex"));
            }
            if(owns_lock()) // failed
is_locked=false;

--
View this message in context: http://boost.2283326.n4.nabble.com/Boost-log-set-channel-name-dynamically-for-a-basic-composite-logger-tp4637012p4637182.html
Sent from the Boost - Dev mailing list archive at Nabble.com.

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk