You can check boost::asio (http://asio.sourceforge.net/)
Here you can find pretty simple examples for boost::asio::deadline_timer which is (I think so) answer on both of your questions.

HTH,
Sergey

2007/6/17, Meryl Silverburgh <silverburgh.meryl@gmail.com>:
Hi,

Can you please tell me if i can do this with boost::thread library?

1. create a timer (say 5 seconds) which execute a function in a
different thread when it expires.
2. the creator can cancel the timer before it expires.

Thank you.
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users