Click here to Skip to main content
15,926,939 members
Home / Discussions / C#
   

C#

 
GeneralCPU Usage and thread problem Pin
aswanee31-Dec-04 9:37
aswanee31-Dec-04 9:37 
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 
HI
"Unless a method also calls lock(this) or otherwise locks whatever object this refers to, the method can run in a separate thread (not in the current thread, of course, since you're already executing a method)."

That means if a class like this below:

Class class1<br />
{<br />
public void MethodA(){<br />
lock(this)<br />
{<br />
...<br />
}<br />
}<br />
<br />
public void MethodB()<br />
{<br />
...<br />
}<br />
}


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?

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

Is lock useless for single thread programming?

Thanks

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.