"edwwsw" <(E-Mail Removed)> wrote in message
news:3AE7438F-6C07-43AF-A2B5-(E-Mail Removed)...
>$ Thread Safety
> $ This type is safe for multithreaded read operations. You must
> synchronize
> any write operations.
>
> I am trying to figure out exactly what this statement means.
>
> So if I have multiple threads accessing an ADO.Net dataset and only one of
> those threads ever writes to the database but multiple threads are reading
> from it. Do I have to write code to synchronize access to the ADO.Net
> dataset or is that built into the Ado.Net dataset? Basically are updates
> atomic and are the events guarentteed to fire in the UI thread?
Updates are not atomic, and you must have exclusive access to the DataSet to
update it.
But winforms events are guaranteed to fire in the UI thread. When a user
clicks a button or hits a key this queues a message in the window's message
queue. The UI thread dequeues these messages one at a time and dispatches
to the event handler. So UI events are guaranteed to run on the UI thread,
and are therefore serialized.
David
|