October 8th, 2003 — Object-Oriented Multithreading in C++ — Bartosz Milewski

Published: Wed 01 October 2003
By nwcpp

In 2003.


6464 185th Avenue NE
Redmond, WA 98052


Traditional procedural approach to thread programming is to create a thread and pass it a function to execute. But a function operates on data. The data is most likely shared with other threads. In the object-oriented world data comes first. You create an ActiveObject whose state develops asynchronously. There is a captive thread inside an Active Object, but it’s only an implementation detail.

I will describe a C++ implementation of Active Object using Windows API and I will discuss multiple uses of ActiveObject in our own commercial product, including various synchronization techniques.

A similar concept in Java is called the Runnable interface.


Bartosz Milewski is the author of C++ In Action, Industrial-Strength Programming Techniques (Addison-Wesley, 2001). He is the founder of Reliable Software (www.relisoft.com), a Seattle-based company that makes a peer-to-peer version control system, Code Co-op. He was one of the architects of the Microsoft Index Server.

Click here to download the source code and slides from the presentation