PC Review


Reply
Thread Tools Rate Thread

Question about threads?

 
 
Fekkai
Guest
Posts: n/a
 
      5th Oct 2004
I have a question about threads:
In the TCPClient help page I find the following explanation

"Thread Safety
Any public static (Shared in Visual Basic) members of this type are
safe for multithreaded operations. Any instance members are not
guaranteed to be thread safe."

What does it mean, I need an example of something that is not safe.

Tia
 
Reply With Quote
 
 
 
 
=?Utf-8?B?Qm9uag==?=
Guest
Posts: n/a
 
      6th Oct 2004
By members, it means methods. i.e. if you intend to call the same method of
the same *object* from two threads, you need to provide synchronisation. If
you only intend to call two static methods of the same *type* from different
threads, then you probably won't need to provide synchronisation as all the
data will be largley stack based.

"Fekkai" wrote:

> I have a question about threads:
> In the TCPClient help page I find the following explanation
>
> "Thread Safety
> Any public static (Shared in Visual Basic) members of this type are
> safe for multithreaded operations. Any instance members are not
> guaranteed to be thread safe."
>
> What does it mean, I need an example of something that is not safe.
>
> Tia
>

 
Reply With Quote
 
 
 
 
=?Utf-8?B?UnVmdXNHb29mdXM=?=
Guest
Posts: n/a
 
      17th Nov 2004
I'm not sure I agree with the last statement. Static methods can only access
static data members (right?), and the latter can not be implemented on a stack
because then they wouldn't be shared.
So, it must be that the class implementor knows that the static data members
are accessed using a monitor or some other mechanism that ensures thread
safety, no?

"Bonj" wrote:

> By members, it means methods. i.e. if you intend to call the same method of
> the same *object* from two threads, you need to provide synchronisation. If
> you only intend to call two static methods of the same *type* from different
> threads, then you probably won't need to provide synchronisation as all the
> data will be largley stack based.
>
> "Fekkai" wrote:
>
> > I have a question about threads:
> > In the TCPClient help page I find the following explanation
> >
> > "Thread Safety
> > Any public static (Shared in Visual Basic) members of this type are
> > safe for multithreaded operations. Any instance members are not
> > guaranteed to be thread safe."
> >
> > What does it mean, I need an example of something that is not safe.
> >
> > Tia
> >

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
between question, question 1 is a 3, question 3 is a 1 Jose Cortez Microsoft Access 1 16th Jul 2009 07:45 AM
Perhaps and off topic question....but could use some help with video question.....I don't need codec help, just a general question. Bret Miller DIY PC 0 13th Oct 2006 12:23 AM
Registry question and a certificates question John C Windows XP Performance 0 23rd Apr 2004 01:58 PM
Re: Question; strange things happening, please read inside [2/2] - "question.txt" yEnc (1/1) roger Windows XP Help 4 15th Apr 2004 05:06 PM
Question; strange things happening, please read inside(??] [2/2] - question.txt (1/1) exgi Windows XP Help 4 14th Apr 2004 12:39 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:42 PM.