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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:42:41+00:00 2026-05-30T18:42:41+00:00

Examples of boost::this_thread::sleep() seem to use objects of boost::posix_time::milliseconds . I’ve tried that and

  • 0

Examples of boost::this_thread::sleep() seem to use objects of boost::posix_time::milliseconds. I’ve tried that and it works, but I am using boost::chrono for checking the system clock etcetera. It seems to me I should be able to pass sleep() a chrono::duration like this:

boost::this_thread::sleep( boost::chrono::duration(10) );

But the compiler is giving me the following error:

… boost_1_49_0\boost/thread/win32/thread_data.hpp(171) : error C2039: ‘total_milliseconds’ : is not a member of ‘boost::chrono::duration’

Which I find confusing. Am I right in thinking I should be able to do this? Will it be necessary to convert to a posix_time?

  • 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-30T18:42:43+00:00Added an answer on May 30, 2026 at 6:42 pm

    Like this, use sleep_for and seconds

    boost::this_thread::sleep_for( boost::chrono::seconds(10) );
    

    EDIT

    After verification this feature is not yet available in boost 1.49.0. All my apologies. This is only working in the trunk version of boost.

    That means that it is not possible to call a sleep-like function without converting to a boost.datetime format.

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

Sidebar

Related Questions

I was trying to implement small time delays in multithreading code using boost::this_thread::sleep. Here
I wanted to use boost::thread in my program, but get the following compiler error
I'm using Boost 1.51 under OS X 10.7.4 and I've found that linking against
I found a threadpool which doesn't seem to be in boost yet, but I
So I know that the boost libraries are primarily header-only but there are a
I read at multiple places that Boost.Signals is not threadsafe but I haven't found
I started using boost::thread recently (WinXP, VS10, BoostPro) and found that mutex can be
I have a thread pool that is using shared mutexes from the boost library.
I find such examples in Boost code. namespace boost { namespace { extern C
I am trying to run blocking_udp_echo_server.cpp from Boost asio example on MacOSX 10.5. But

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.