error: ‘class boost::mutex’ has no member named ‘try_lock_for’

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

error: ‘class boost::mutex’ has no member named ‘try_lock_for’

Boost - Users mailing list
Hi,
I face this error, in linux, does this indicates that I have not build the library correctly?
the error is in that line:
boost/thread/lock_types.hpp:162:45


#ifdef BOOST_THREAD_USES_CHRONO
    template <class Clock, class Duration>
    unique_lock(Mutex& mtx, const chrono::time_point<Clock, Duration>& t)
    : m(&mtx), is_locked(mtx.try_lock_until(t))
    {
    }
    template <class Rep, class Period>
    unique_lock(Mutex& mtx, const chrono::duration<Rep, Period>& d)
    : m(&mtx), is_locked(mtx.try_lock_for(d))  <--- here is the error
    {
    }
#endif

Thanks,
Antonis



_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: error: ‘class boost::mutex’ has no member named ‘try_lock_for’

Boost - Users mailing list
On 26/09/2018 01:30, Antonis Polykratis wrote:

> I face this error, in linux, does this indicates that I have not build
> the library correctly?
> the error is in that line:
> boost/thread/lock_types.hpp:162:45
>
>
> #ifdef BOOST_THREAD_USES_CHRONO
>      template <class Clock, class Duration>
>      unique_lock(Mutex& mtx, const chrono::time_point<Clock, Duration>& t)
>      : m(&mtx), is_locked(mtx.try_lock_until(t))
>      {
>      }
>      template <class Rep, class Period>
>      unique_lock(Mutex& mtx, const chrono::duration<Rep, Period>& d)
>      : m(&mtx), is_locked(mtx.try_lock_for(d))  <--- here is the error
>      {
>      }
> #endif

This is a header-level error, so the issue is presumably in your
compiler settings.

(Both unique_lock::try_lock_until and mutex::try_lock_until only exist
when BOOST_THREAD_USES_CHRONO is defined, but that shouldn't normally be
different in two headers within the same translation unit.)

Make sure that your include paths are picking up the expected version of
Boost and that you're not accidentally mixing system Boost with local Boost.

You can also try generating a preprocessed file by copying the full
command line which is currently being used to compile the source with
the error, then changing the -c parameter to -E and changing the -o
parameter's extension from .o to .i.  Then examine the contents of the
file to see where it is picking up the various definitions from; this
may help locate the source of the issue.
_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users