Click here to Skip to main content
15,915,603 members
Home / Discussions / C#
   

C#

 
GeneralRe: CPU Usage and thread problem Pin
leppie31-Dec-04 10:23
leppie31-Dec-04 10:23 
GeneralSending an email message through windows C#... Pin
new_phoenix31-Dec-04 6:21
new_phoenix31-Dec-04 6:21 
GeneralRe: Sending an email message through windows C#... Pin
Dennis C. Dietrich31-Dec-04 6:36
Dennis C. Dietrich31-Dec-04 6:36 
GeneralRe: Sending an email message through windows C#... Pin
new_phoenix31-Dec-04 6:47
new_phoenix31-Dec-04 6:47 
GeneralRe: Sending an email message through windows C#... Pin
Heath Stewart31-Dec-04 6:57
protectorHeath Stewart31-Dec-04 6:57 
GeneralRe: Sending an email message through windows C#... Pin
new_phoenix31-Dec-04 7:57
new_phoenix31-Dec-04 7:57 
GeneralRe: Sending an email message through windows C#... Pin
Heath Stewart31-Dec-04 8:10
protectorHeath Stewart31-Dec-04 8:10 
GeneralRe: Sending an email message through windows C#... Pin
Heath Stewart1-Jan-05 7:06
protectorHeath Stewart1-Jan-05 7:06 
GeneralMicrophone Input Level Indicator Pin
GTWebb31-Dec-04 3:50
GTWebb31-Dec-04 3:50 
GeneralRe: Microphone Input Level Indicator Pin
Heath Stewart31-Dec-04 7:44
protectorHeath Stewart31-Dec-04 7:44 
GeneralRe: Microphone Input Level Indicator Pin
GTWebb2-Jan-05 12:04
GTWebb2-Jan-05 12:04 
GeneralCardinal Splines Pin
thepersonof30-Dec-04 23:59
thepersonof30-Dec-04 23:59 
GeneralRe: Cardinal Splines Pin
Heath Stewart31-Dec-04 7:59
protectorHeath Stewart31-Dec-04 7:59 
Generalload data's from a xml file into a dataset for a single field alone Pin
dhol30-Dec-04 23:59
dhol30-Dec-04 23:59 
GeneralRe: load data's from a xml file into a dataset for a single field alone Pin
Heath Stewart31-Dec-04 6:52
protectorHeath Stewart31-Dec-04 6:52 
GeneralRe: load data's from a xml file into a dataset for a single field alone Pin
dhol31-Dec-04 16:58
dhol31-Dec-04 16:58 
GeneralAdding dll to the workspace Pin
Md Saleem Navalur30-Dec-04 23:21
Md Saleem Navalur30-Dec-04 23:21 
GeneralRe: Adding dll to the workspace Pin
Heath Stewart31-Dec-04 6:38
protectorHeath Stewart31-Dec-04 6:38 
GeneralRe: Adding dll to the workspace Pin
Md Saleem Navalur31-Dec-04 21:29
Md Saleem Navalur31-Dec-04 21:29 
GeneralRe: Adding dll to the workspace Pin
Heath Stewart31-Dec-04 22:49
protectorHeath Stewart31-Dec-04 22:49 
Questionhow to lock a method in class Pin
ting66830-Dec-04 22:11
ting66830-Dec-04 22:11 
AnswerRe: how to lock a method in class Pin
Robert Rohde30-Dec-04 22:19
Robert Rohde30-Dec-04 22:19 
AnswerRe: how to lock a method in class Pin
Heath Stewart31-Dec-04 6:26
protectorHeath Stewart31-Dec-04 6:26 
GeneralRe: how to lock a method in class Pin
ting6682-Jan-05 15:13
ting6682-Jan-05 15:13 
GeneralRe: how to lock a method in class Pin
Heath Stewart2-Jan-05 21:18
protectorHeath Stewart2-Jan-05 21:18 
ting668 wrote:
Then using the same reference of a instance of class1, after calling MethodA and MethodA not yet finished executing within the lock, MethodB still can be called unless lock(this) is also used in MethodB?

That is correct. Just try it. The majority of code snippets I post here in this forum I simply type in a simple text editor and compile on the command line, then run. Simple.

ting668 wrote:
Also is that the static method will be automatically synchronized and special keyword and code (e.g lock) is not needed to be implemented?

A single static method is synchronized by the CLR. If you want to synchronize different static methods you will need to use lock or some equivalent.

ting668 wrote:
Is lock useless for single thread programming?

Yes. Within a single thread you can only execute one statement at a time. With that in mind there's no way you could execute the same method (or act on the same context, like getting or setting a serial number) at the same time.

This posting is provided "AS IS" with no warranties, and confers no rights.

Software Design Engineer
Developer Division Sustained Engineering
Microsoft

[My Articles] [My Blog]

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.