根據Boost文檔boost::mutex
和boost::timed_mutex
應該是不同的。第一個實施Lockable Concept
,第二個 - TimedLockable Concept
。boost :: mutex和boost :: timed_mutex之間的區別
但是,如果你看看源代碼,你可以看到它們基本上是一樣的東西。唯一的區別是鎖定typedefs。您可以撥打timed_lock
,電話boost::mutex
或使用boost::unique_lock
超時。
typedef ::boost::detail::basic_timed_mutex underlying_mutex;
class mutex:
public ::boost::detail::underlying_mutex
class timed_mutex:
public ::boost::detail::basic_timed_mutex
這背後的理由是什麼?這是否是過去的殘餘,是否使用boost::mutex
作爲TimedLockable
?畢竟它沒有證件。
因此,如果同一標的互斥*會發生什麼*實現對*你*的平臺這兩個概念。他們*被允許*是不同的,但不是*必需的*! –
@BoPersson:是的,我得到的,但它不是像所產生的額外功能是隱藏在一些「細節」的命名空間。公開的方法是正確的。我發現它並不是Boost庫的特徵。 –