Was bored today so I started playing with boost::thread. Made a little producer/consumer example with 2 threads and a thread-safe BlockingQueue, sort of a simple version of what Java provides in the standard API. I had fun using as many boost features as I could squeeze in - boost::shared_ptr, boost::posix_time, boost::bind (really cool by the way and much more powerful than std::mem_fun/std::bind1st, etc).
I'm surprised boost hasn't yet added thread-safe containers to their libraries. According to Google, lots of people seem to think they're a bad idea, even going so far as to say they were a mistake in Java. Really? Is everybody expected to reinvent the wheel here and start from scratch? Doesn't make sense to me. Here's my version of the wheel if anybody doesn't already have one.
Sunday, January 10, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment