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 8208437
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T09:22:09+00:00 2026-06-07T09:22:09+00:00

Process during its lifetime has 1 main thread and from 1 to 50 other

  • 0

Process during its lifetime has 1 main thread and from 1 to 50 other worker threads.
When main thread accepts new connection it saves it in boost::unordered_map, lets call it “new con container”. Worker threads time to time check “new con container” for new connections. For sync purposes there is one boost::mutex. When main thread writes to “new con container” it locks this mutex. Worker threads while checking this container also lock the mutex.

Is there way for worker threads not to lock the mutex and thread-safely read from “new con container” ? Worker threads do real-time operations on sockets, so locking mutex beats on performance.

  • 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-06-07T09:22:10+00:00Added an answer on June 7, 2026 at 9:22 am

    If you have a single writer and multiple readers consider using shared_mutex:

    The class boost::shared_mutex provides an implementation of a
    multiple-reader / single-writer mutex.

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

Sidebar

Related Questions

Is it possible to prevent MainForm from loading fully during the process of starting
I have an Android Service running in a separate process from its client, and
During the runtime of a process I would like to read its stdout and
During the lifetime of a .NET process, does the handle of a System.Windows.Forms.Form ,
I have a java client which is managing its server calls in new threads
i have application who use specific process during running and i want to sample
During compilation process many errors are thrown on the screen. To start resolving them
During the process of building software applications, you would start testing what you have
I'm using WF 3.5 and during the process of spinning up a couple of
During our build process, we run sqlldr to populate our database with some sample

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.