Boost logo

Boost :

From: Andy Little (andy_at_[hidden])
Date: 2005-12-10 09:29:08


"Christopher Kohlhoff" wrote
> Hi Andy,
>
> --- Andy Little wrote:
>> Attempting to compile the synchronous timer example. I get the
>> message
>> xx\boost\asio\detail\socket_types.hpp "sys/ioctl.h" no such file or
>> directory.
>> compiler VC7.1 in Windows XP.
>> Any thoughts?
>
> It can only get into the #else branch that includes sys/ioctl.h if
> BOOST_WINDOWS is not defined. This would occur if BOOST_DISABLE_WIN32
> is being defined somewhere, such as when compiling with the /Za option.
> If you are please try removing it.

That worked! :-)

I am currently looking at the asynchromous timer tutorial example. I'm not clear
where the timer thread starts.
Does it start with the call to t.async_wait(print); in the code below?

#include <iostream>
#include <boost/asio.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/timer.hpp>

void print(const boost::asio::error& /*e*/);

// some thing to keep the main thread busy
void long_main_process_function();

int main()
{
    boost::asio::demuxer d;
    boost::asio::deadline_timer t(d, boost::posix_time::seconds(5));

    // Is the timer thread starting in this call?
    t.async_wait(print);

    long_main_process_function();

    d.run();

}

void long_main_process_function()
{
     std::cout << "main process long function beginning\n";
    boost::timer t1;
    int temp = 1;
    while(t1.elapsed() < 3){
        if ( t1.elapsed() >= temp){
            std::cout << " tick " << temp << " s\n";
            temp += 1;
        }
    }
    std::cout << "main process long function done\n";
}

void print(const boost::asio::error& /*e*/)
{
  std::cout << "thread finished\n";
}


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk