Deal of the Day

Home » Main » Manning Forums » 2008 » C++ Concurrency in Action

Thread: looks like there is no "semaphore" key word in std::thread

Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 1 - Pages: 1 - Last Post: Jul 12, 2010 4:42 PM by: anthony.williams
botaojia

Posts: 10
From: NC
Registered: 7/12/10
looks like there is no "semaphore" key word in std::thread
Posted: Jul 12, 2010 4:32 PM
  Click to reply to this thread Reply

i didn't dig deep enough by myself yet. Could any one or the author explain briefly why there is no such key word? or something equivalent can be used in std::thread?
Thanks.

anthony.williams

Posts: 175
Registered: 6/6/08
Re: looks like there is no "semaphore" key word in std::thread
Posted: Jul 12, 2010 4:42 PM   in response to: botaojia in response to: botaojia
  Click to reply to this thread Reply

A semaphore is a low-level, multi-purpose synchronization tool. As such it is hard to use correctly.

The C++ thread library does not provide a semaphore. Instead it provides the things you would build with semaphores --- mutexes, condition variables and futures.

Legend
Gold: 300 + pts
Silver: 100 - 299 pts
Bronze: 25 - 99 pts
Manning Author
Manning Staff
Manning Developmental Editor