SharedLockable Concept ( навеяло от boost::mutex )
От: Аноним  
Дата: 03.05.10 09:28
Оценка:
Не понятна суть, что значит Shared Lock, это уже не мьютех, а семафор чтоли ?

SharedLockable Concept
void lock_shared()
bool try_lock_shared()
bool timed_lock_shared(boost::system_time const& abs_time)
void unlock_shared()
The SharedLockable concept is a refinement of the TimedLockable concept that allows for shared ownership as well as exclusive ownership. This is the standard multiple-reader / single-write model: at most one thread can have exclusive ownership, and if any thread does have exclusive ownership, no other threads can have shared or exclusive ownership. Alternatively, many threads may have shared ownership.



Например использование мьютекса обычно выглядит как
Mutex m;

void Foo1()
{
   m.lock();

   m.unlock();
}

begin_thread( Foo1 );
begin_thread( Foo1 );


Что тут может быть еще Shared ? Мьютех он и так Shared — глобальный объект.
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.