Ticket #3107: bug.cpp

File bug.cpp, 795 bytes (added by Dmitry, 13 years ago)

minimal test

Line 
1#include <iostream>
2#include <boost/asio.hpp>
3
4struct simple_handler
5{
6 void operator()(const boost::system::error_code& ec) {
7 std::cout << "tick!" << std::endl;
8 }
9};
10
11inline void* asio_handler_allocate(std::size_t size, simple_handler* handler)
12{
13 void* res = ::operator new(size);
14 std::cout << "allocate " << res << std::endl;
15 return res;
16}
17
18inline void asio_handler_deallocate(void* pointer, std::size_t size, simple_handler* handler)
19{
20 std::cout << "deallocate " << pointer << std::endl;
21 ::operator delete(pointer);
22}
23
24int main(int argc, char* argv[])
25{
26 boost::asio::io_service ios;
27 boost::asio::deadline_timer timer(ios, boost::posix_time::milliseconds(1000));
28 timer.async_wait(simple_handler());
29 ios.run();
30}