Click here to Skip to main content
15,886,362 members
Home / Discussions / C#
   

C#

 
GeneralRe: Do u find c# descent? Pin
BobJanova11-Apr-12 23:52
BobJanova11-Apr-12 23:52 
GeneralRe: Do u find c# descent? Pin
Mark Kruger12-Apr-12 1:29
Mark Kruger12-Apr-12 1:29 
AnswerRe: Do u find c# descent? Pin
V.11-Apr-12 21:04
professionalV.11-Apr-12 21:04 
Questionsolid edge programming Pin
issSTE11-Apr-12 3:48
issSTE11-Apr-12 3:48 
AnswerRe: solid edge programming Pin
Richard MacCutchan11-Apr-12 5:06
mveRichard MacCutchan11-Apr-12 5:06 
JokeRe: solid edge programming Pin
ZurdoDev11-Apr-12 8:34
professionalZurdoDev11-Apr-12 8:34 
JokeRe: solid edge programming Pin
Richard MacCutchan11-Apr-12 21:54
mveRichard MacCutchan11-Apr-12 21:54 
Questionfind solution for deadlock Pin
numeracy11-Apr-12 0:21
numeracy11-Apr-12 0:21 
can anybody help me in solving this deadlock?
C#
class Program
    {
        readonly static object obj1 = new object();
        readonly static object obj2 = new object();

        static void F1()
        {
            lock (obj1)
                lock (obj2)
                {
                    Console.Write("1");
                }
        }
        static void F2()
        {
            lock (obj2)
                lock (obj1)
                {
                    Console.Write("2");
                }
        }

        static void Main(string[] args)
        {
            Task[] tasks = new[]
            {
                Task.Factory.StartNew(() => { for (int i = 0; i < 100; i++) F1(); }),
                Task.Factory.StartNew(() => { for (int i = 0; i < 100; i++) F2(); }),
            };
            Task.WaitAll(tasks);
            Console.WriteLine();
            Console.WriteLine("all done");
        }
    }

AnswerRe: find solution for deadlock Pin
Pete O'Hanlon11-Apr-12 0:28
mvePete O'Hanlon11-Apr-12 0:28 
GeneralRe: find solution for deadlock Pin
numeracy11-Apr-12 0:34
numeracy11-Apr-12 0:34 
GeneralRe: find solution for deadlock Pin
Wes Aday11-Apr-12 0:45
professionalWes Aday11-Apr-12 0:45 
GeneralRe: find solution for deadlock Pin
numeracy11-Apr-12 0:47
numeracy11-Apr-12 0:47 
GeneralRe: find solution for deadlock Pin
Pete O'Hanlon11-Apr-12 0:51
mvePete O'Hanlon11-Apr-12 0:51 
GeneralRe: find solution for deadlock Pin
numeracy11-Apr-12 1:00
numeracy11-Apr-12 1:00 
GeneralRe: find solution for deadlock Pin
Pete O'Hanlon11-Apr-12 1:40
mvePete O'Hanlon11-Apr-12 1:40 
GeneralRe: find solution for deadlock Pin
numeracy11-Apr-12 1:05
numeracy11-Apr-12 1:05 
GeneralRe: find solution for deadlock Pin
Pete O'Hanlon11-Apr-12 1:06
mvePete O'Hanlon11-Apr-12 1:06 
GeneralRe: find solution for deadlock Pin
numeracy11-Apr-12 1:11
numeracy11-Apr-12 1:11 
GeneralRe: find solution for deadlock Pin
Pete O'Hanlon11-Apr-12 1:13
mvePete O'Hanlon11-Apr-12 1:13 
AnswerRe: find solution for deadlock Pin
Luc Pattyn11-Apr-12 3:39
sitebuilderLuc Pattyn11-Apr-12 3:39 
AnswerRe: find solution for deadlock PinPopular
BobJanova11-Apr-12 1:12
BobJanova11-Apr-12 1:12 
AnswerRe: find solution for deadlock Pin
numeracy11-Apr-12 12:29
numeracy11-Apr-12 12:29 
QuestionHow to destroy a child WinForm after operation? Pin
fantasy121511-Apr-12 0:20
fantasy121511-Apr-12 0:20 
AnswerRe: How to destroy a child WinForm after operation? Pin
Wes Aday11-Apr-12 0:46
professionalWes Aday11-Apr-12 0:46 
QuestionHow to make label font auto fit Pin
stevenlei10-Apr-12 23:39
stevenlei10-Apr-12 23:39 

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.