Skip to content

file_lock can't be used with scoped_lock because file_lock::internal_mutex_type is not defined #235

@Tails86

Description

@Tails86

For Boost version: 1.86.0

The documentation here states:
"A file lock, is a mutual exclusion utility similar to a mutex using a file. A file lock has sharable and exclusive locking capabilities and can be used with scoped_lock and sharable_lock classes."

When I try to use a scoped_lock with a file_lock like so:

boost::interprocess::file_lock* flk = nullptr; // Just for compilation testing purposes
boost::interprocess::scoped_lock<boost::interprocess::file_lock> lock(*flk);

I run into the following compile error:

include/boost/interprocess/sync/detail/locks.hpp:35:60: error: no type named ‘internal_mutex_type’ in ‘boost::interprocess::scoped_lock<boost::interprocess::file_lock>::mutex_type’ {aka ‘class boost::interprocess::file_lock’}
   35 |    typedef typename Lock::mutex_type::internal_mutex_type  mutex_type;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions