Microsoft Application Blocks for .NET - Data Access

  • Thread starter Thread starter Dan
  • Start date Start date
D

Dan

Hi

Is Microsoft's Sqlhelper.cs (Microsoft Application Blocks for .NET -
Data Access) Thread safe?

The documentation has no references to threads.

Thanks

Dan
 
Dan,

I would say probably not. For most of the classes in the framework (and
those classes outside of it, but still written by microsoft, like the Data
Block), the instances are not guaranteed to be thread safe (but the static
methods usually are).

Hope this helps.
 
What exactly does it mean for a class to be thread safe? My guess would be
something along the lines of whether you can create two instances of the
same class in two different threads. But why exactly would this ever be a
problem??

Thanks!

mark

Nicholas Paldino said:
Dan,

I would say probably not. For most of the classes in the framework (and
those classes outside of it, but still written by microsoft, like the Data
Block), the instances are not guaranteed to be thread safe (but the static
methods usually are).

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Dan said:
Hi

Is Microsoft's Sqlhelper.cs (Microsoft Application Blocks for .NET -
Data Access) Thread safe?

The documentation has no references to threads.

Thanks

Dan
 
Hi Mark,

Thread safe means that you can invoke any method or read/write any
field/property from whatever thread and don't be concerned about integrity
of data (IOW it don't make kaboooom when two threads access the same data
).

--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com

Mark said:
What exactly does it mean for a class to be thread safe? My guess would be
something along the lines of whether you can create two instances of the
same class in two different threads. But why exactly would this ever be a
problem??

Thanks!

mark

message news:[email protected]...
Dan,

I would say probably not. For most of the classes in the framework (and
those classes outside of it, but still written by microsoft, like the Data
Block), the instances are not guaranteed to be thread safe (but the static
methods usually are).

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Dan said:
Hi

Is Microsoft's Sqlhelper.cs (Microsoft Application Blocks for .NET -
Data Access) Thread safe?

The documentation has no references to threads.

Thanks

Dan
 
Got it. Could you briefly describe a senario when that might occur? Thanks
again.

Mark


Miha Markic said:
Hi Mark,

Thread safe means that you can invoke any method or read/write any
field/property from whatever thread and don't be concerned about integrity
of data (IOW it don't make kaboooom when two threads access the same data
).

--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com

Mark said:
What exactly does it mean for a class to be thread safe? My guess would be
something along the lines of whether you can create two instances of the
same class in two different threads. But why exactly would this ever be a
problem??

Thanks!

mark

message news:[email protected]...
Dan,

I would say probably not. For most of the classes in the
framework
(and
those classes outside of it, but still written by microsoft, like the Data
Block), the instances are not guaranteed to be thread safe (but the static
methods usually are).

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Hi

Is Microsoft's Sqlhelper.cs (Microsoft Application Blocks for .NET -
Data Access) Thread safe?

The documentation has no references to threads.

Thanks

Dan
 
Hi Mark,

Imagine that a not thread-safe class having a string public property.
Imagine one thread that tries to set new value (setting string is done in
several procesor operations - thus is not atomic).
Imagine thread context switching to another thread (while string setting is
not ended - left at the middle) that starts reading the same property.
Boooom.
 
This only applies if both threads have a reference to the same object, or
the property is static.

Willy.
 
Back
Top