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

  • Home
  • SEARCH
  • 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 7895929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:45:45+00:00 2026-06-03T07:45:45+00:00

I have many different threads ( boost::thread_pool ) to a boost::asio::io_service . The io_service

  • 0

I have many different threads (boost::thread_pool) to a boost::asio::io_service. The io_service will call a function which will trigger async_read, which will trigger yet another async_read, from which many functions might be called. This is all done within two classes: threads spawn from a Server class, and async_read is called from a Client class.

Provided I throw from those functions called by async_read (from the Client class), who will get to catch the exception? Server? if so, is there any way to disregard the error and resume regular execution?.

  • 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-03T07:45:46+00:00Added an answer on June 3, 2026 at 7:45 am

    Did you read this part of the Boost.Asio manual?

    Summary:
    “If an exception is thrown from a handler, the exception is allowed to propagate through the throwing thread’s invocation of run(), run_one(), poll() or poll_one(). No other threads that are calling any of these functions are affected. It is then the responsibility of the application to catch the exception.”

    So it depends on where you have your catch statement.

    UPDATE

    The generic way that exceptions work is that upon an error the function creating the error will throw an exception. Any calling function will have to try the worker function it calls, and catch the exception to resolve the error. Optionally, you could re-throw the caught exception (or any other exception) to any calling functions higher up the chain.

    void some_function()
    {
        // do some work
    
        if (error_occurred) 
            // don't know context, so pass the buck to calling function
            throw std::exception;
    }
    
    void some_calling_function()
    {
        try {
            some_function(); // could throw
        } catch (std::exception& e) {
            // do some error handling depending in context
        }
        // code will resume here
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've read many different articles/threads on this, but have yet to determine the best
I have a shared memory pool from which many different threads may request an
I have many different small classes which have a few fields each, e.g. this:
I have many layers in the Documents that will be displayed on different user
I have an application which creates 300-400 threads. Every thread has a different job
I have a wxPython app which has many worker threads, idle event cycles, and
I am making a game on android which will have three threads. These will
I have a situation where, in a multithreaded application, many different threads are accessing
I want to submit a form that have many checkboxes with different values, using
I have an application with many different parts, it runs on OSGi, so there's

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.