Reply to comment

Pthreads in C++

Reshmi, the simplest meaningful example that I was able to come up with was the one I wrote for the pthreads article I have on this page: http://blog.emptycrate.com/node/270.

However, I don't recommend using pthreads in C++. It has several disadvantages, mostly in that it was written to work with C more than C++, so you must use a static or global function to launch your C++ code. The pthreads article linked above describes that in more detail.

I strongly recommend using a higher level abstraction such as boost::threads as this article describes or building or using some even higher level abstraction.

Reply

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote>
  • Lines and paragraphs break automatically.
  • You may post PHP code. You should include <?php ?> tags.
  • Web page addresses and e-mail addresses turn into links automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>. The supported tag styles are: <foo>, [foo]. PHP source code can also be enclosed in <?php ... ?> or <% ... %>.
  • Images can be added to this post.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.