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.

Thanks!

Recommended Answers

All 4 Replies

csy>will it thread safed ?

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

commented: useless -1
commented: serkan is retarded +1
commented: i agree about serkan. here's your rep points back. +10

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.