I used a dataset in multiple-reader and single-writer design in my application , but the 'read' and 'write' is possible happend at a same time .
will it thread safed ? or I need to apply any locking mechanism?
but i don't wish to lock the 'read' to be single thread being.


8 Years
Discussion Span
Last Post by Stinomus

csy>will it thread safed ?

This type is safe for multithreaded read operations. You must synchronize any write operations. Read MSDN Documentation.

Votes + Comments
i agree about serkan. here's your rep points back.
serkan is retarded

Thanks adatapost,Serkan Sendur for the replies.

1.) data read in dirty is acceptable for me, i just afraid exception thrown when read dataset once it is updating the dataset, will it? or this is thread safe for read and write, and only write by multiple just will cause the exception?

2.That mean even this is only single-writer, I still need to synchronize (e.g apply lock ) both of read and write?

can you embody it?

Thank for help!


It won't cause an exception, though reading from a dataset whilst it is being written to can cause serious race-conditions.
Consider the case where 1/2 the data has been written to, then the writer is scheduled off, the reader is scheduled on and reads the data. It will get 1/2 the old data and 1/2 the new data, the repercusions of this vary depending on the datatype.

EDIT: by 'data' I mean a single object in the dataset.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.