Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6340637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:52:23+00:00 2026-05-24T19:52:23+00:00

So we have class with functions a and b . Thread one calls a

  • 0

So we have class with functions a and b. Thread one calls a and no other thread can call a or b untill one would call b. Meaning thread one would be capable to call a and than a and … and than a, and while one had not called b other threads that want to call a or b stand waiting. is it possible to do such thing with boost::mutex and how to do it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T19:52:24+00:00Added an answer on May 24, 2026 at 7:52 pm

    The mutex is not a problem; it’s the lock. The simplest solution is
    just to call mutex::lock() and mutex::unlock() manually, and forget
    about the mutex::scoped_lock; after all, you don’t want the lock to
    respect scope. The problem with this is the usual one; you probably
    want to free the lock in case of an exception. One solution would be to
    allocate the mutex::scoped_lock dynamically, and use a std::auto_ptr
    or a boost::shared_ptr to manage it. (Curiously enough, neither
    boost::mutex::scoped_lock nor std::lock_guard are movable, so you
    need dynamic allocation in order to transfer ownership.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Class that calls at least one thread. The Class can have
I want the Windows thread pool (QueueUserWorkItem()) to call my class' member functions. Unfortunately
I have a class with the following member functions: /// caller pid virtual pid_t
I have a class which has many small functions. By small functions, I mean
I have a class isSearching with a single boolean property in a 'functions' file
I know python functions are virtual by default. Let's say I have this: class
I have two functions in an ActionScript class, they are: private function loaderCompleteHandler(event:Event):void {
I have a couple of functions inside a class that essentially do the same
I have seen member functions programed both inside of the class they belong to
I have in my javascript these 2 functions classes: // product class function Product()

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.