Sause
Sause

Reputation:

Read/write synchronization

I have a data structure whose operations can be categorized as read operations (e.g. lookup) and write operations (e.g. insertion, removal). These operations should be synchronized so that:

How can this kind of synchronization be implemented?

The platform is win-api so the api's synchronization objects and interlocked functions are the basic building blocks.

Upvotes: 2

Views: 1485

Answers (1)

Steve Jessop
Steve Jessop

Reputation: 279215

Microsoft's recommended implementation of a Reader/Writer lock is here (you'll have to scroll a bit, to the header "Reader/Writer locks"):

http://msdn.microsoft.com/en-us/library/ms810427.aspx

For reference, for those who have the same question but who have the luxury of .NET:

http://msdn.microsoft.com/en-us/library/system.threading.readerwriterlock.aspx

Upvotes: 3

Related Questions