Click here to Skip to main content
16,004,882 members
Home / Discussions / C#
   

C#

 
GeneralPlease check back later!! Pin
Muammar©19-Dec-06 21:25
Muammar©19-Dec-06 21:25 
GeneralRe: Please check back later!! Pin
szukuro20-Dec-06 5:05
szukuro20-Dec-06 5:05 
GeneralRe: Please check back later!! Pin
Muammar©23-Dec-06 21:15
Muammar©23-Dec-06 21:15 
QuestionContour Chart Pin
mariarajakumar19-Dec-06 20:01
mariarajakumar19-Dec-06 20:01 
AnswerRe: Contour Chart Pin
Paul Conrad26-Dec-06 17:12
professionalPaul Conrad26-Dec-06 17:12 
QuestionCan we use Forms instead of UserControls Pin
quiteSmart19-Dec-06 19:39
quiteSmart19-Dec-06 19:39 
AnswerRe: Can we use Forms instead of UserControls Pin
Tarakeshwar Reddy19-Dec-06 19:45
professionalTarakeshwar Reddy19-Dec-06 19:45 
Questionlock statements - backstage... Pin
Shy Agam19-Dec-06 19:28
Shy Agam19-Dec-06 19:28 
Hello experts,

I'm having a hard time understanding how locking occurs.
How does using the lock statement, or any other synchronization mechanism for that matter, solves the following issue:

Lets say there are 2 threads running the following code:
bool busy = false;

void foo()
{
    if (!busy)
    {
        busy = true;

        // Critical section

        busy = false;
    }
}
if the 1st thread enters the function it will evaluate the !busy statement and succeed in entering the conditioned code block.
However, if it didn't yet perform the busy = true; statement, there's a chance that the 2nd thread, if started at that moment, could also evaluate the !busy statement, thus also entering the conditioned block.
So now both threads are running the critical section.

Any ideas regarding how .NET implements locking? Obviously the above code is not the way... Smile | :)
AnswerRe: lock statements - backstage... Pin
Tarakeshwar Reddy19-Dec-06 19:42
professionalTarakeshwar Reddy19-Dec-06 19:42 
GeneralRe: lock statements - backstage... Pin
Shy Agam19-Dec-06 19:49
Shy Agam19-Dec-06 19:49 
GeneralRe: lock statements - backstage... Pin
Tarakeshwar Reddy19-Dec-06 19:59
professionalTarakeshwar Reddy19-Dec-06 19:59 
GeneralRe: lock statements - backstage... Pin
Shy Agam19-Dec-06 20:23
Shy Agam19-Dec-06 20:23 
GeneralRe: lock statements - backstage... Pin
S. Senthil Kumar19-Dec-06 21:17
S. Senthil Kumar19-Dec-06 21:17 
GeneralRe: lock statements - backstage... Pin
Shy Agam19-Dec-06 21:25
Shy Agam19-Dec-06 21:25 
AnswerRe: lock statements - backstage... Pin
Mairaaj Khan19-Dec-06 21:09
professionalMairaaj Khan19-Dec-06 21:09 
AnswerRe: lock statements - backstage... Pin
Guffa19-Dec-06 23:22
Guffa19-Dec-06 23:22 
Questiondeletion in listview Pin
dsl/fahk19-Dec-06 18:55
dsl/fahk19-Dec-06 18:55 
AnswerRe: deletion in listview Pin
jdkulkarni19-Dec-06 19:21
jdkulkarni19-Dec-06 19:21 
QuestionGetting reference of calling Assembly. Pin
Syed Muhammad Kamran19-Dec-06 18:45
Syed Muhammad Kamran19-Dec-06 18:45 
GeneralRe: Getting reference of calling Assembly. Pin
Guffa19-Dec-06 19:17
Guffa19-Dec-06 19:17 
AnswerRe: Getting reference of calling Assembly. Pin
Nader Elshehabi19-Dec-06 20:43
Nader Elshehabi19-Dec-06 20:43 
GeneralRe: Getting reference of calling Assembly. [modified] Pin
Syed Muhammad Kamran19-Dec-06 20:53
Syed Muhammad Kamran19-Dec-06 20:53 
GeneralRe: Getting reference of calling Assembly. Pin
Nader Elshehabi21-Dec-06 0:06
Nader Elshehabi21-Dec-06 0:06 
QuestionPlz help me How client should identify Server ? Pin
Sanjib Raj19-Dec-06 17:43
Sanjib Raj19-Dec-06 17:43 
AnswerRe: Plz help me How client should identify Server ? Pin
Tarakeshwar Reddy19-Dec-06 18:19
professionalTarakeshwar Reddy19-Dec-06 18:19 

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.