Boost logo

Boost Users :

From: Steven Wooding (steve.apo_at_[hidden])
Date: 2006-05-24 13:05:34


Hi Ion,

I'm on 64-bit Linux (SuSe 10.0) using the Intel compiler 9.0 or gcc 4.0.2.

Here is some rough code that may better explain what I'm trying to do:

int Fun1( bufferIndex, expectedProgressState, newProgressState, timeoutTime)

{

            boost::shmem::shared_timed_mutex::scoped_timed_lock lock( mutex,
timeoutTime)

            if (lock.locked() == true)

            {

                        while ( mp_bufferIndex[bufferIndex].m_progressState
!= expectedProgressState)

                        {

                                    if (
mp_bufferIndex[bufferIndex].m_bufferCondition.timed_wait( lock, timeoutTime)
== false)

                                    {

                                                // Timed out on condition

                                                return timedOut;

                                    }

                        }

                        // Change the progress state

            {

else

{

            // mutex timed out

            return timedOut;

}

return success;

}

I hope this makes sense. In this test, the value of the
expectedProgressState is never true, in order to force the timeout.
Basically I obtain the mutex before we even wait on the condition variable.
Let me know if I've gone wrong with the pattern I'm using.

Cheers,

Steve.

On 24/05/06, Ion Gaztañaga <igaztanaga_at_[hidden]> wrote:
>
> Hi Steve,
>
> Can you give me some more information about this? Platform, OS,
> compiler... If you could do a small test case it would be even better.
>
> Regards,
>
> Ion
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net