Click here to Skip to main content
15,917,631 members
Home / Discussions / C#
   

C#

 
QuestionCustom Sinks Pin
esjq30-Aug-05 5:58
esjq30-Aug-05 5:58 
AnswerRe: Custom Sinks Pin
esjq30-Aug-05 21:37
esjq30-Aug-05 21:37 
QuestionTransparency not just in forms Pin
if_mel_yes_else_no30-Aug-05 5:57
if_mel_yes_else_no30-Aug-05 5:57 
QuestionInstalling application using C# Pin
Samar Aarkotti30-Aug-05 5:53
Samar Aarkotti30-Aug-05 5:53 
AnswerRe: Installing application using C# Pin
Guinness4Strength30-Aug-05 9:31
Guinness4Strength30-Aug-05 9:31 
GeneralRe: Installing application using C# Pin
Anonymous30-Aug-05 12:19
Anonymous30-Aug-05 12:19 
GeneralRe: Installing application using C# Pin
Guinness4Strength31-Aug-05 3:54
Guinness4Strength31-Aug-05 3:54 
QuestionQuestion about Mutex Pin
Alex Cutovoi30-Aug-05 5:17
Alex Cutovoi30-Aug-05 5:17 
Hi for all

I'm studying Threads, Mutex and so on. About Mutex, I've readed that Mutex is to synchronize threads and processes. When a thread releases the Mutex, another thread can obtain it and do something. But when I was seeing some source codes the reality isn't this. I'll explain. When a Thread creates the Mutex and set itself like the ownership, the current thread is the creator and the owner. When the Mutex is released to some waiting thread, these waiting thread only just receive a signal and then do something, and it doesn't have exclusive access to the resource Mad | :mad: . A sample:

class Myclass
{
Mutex newMutex = new Mutex(true);
public static void Main()
{
Thread newThread = new Thread(new ThreadStart(AccessMutex));
Thread newThread2 = new Thread(new ThreadStart(OtherAccessMutex));
newThread.Start();
newThread2.Start();
Thread.Sleep(2000);
newMutex.ReleaseMutex();
}
public void AccessMutex()
{
newMutex.WaitOne();
Console.WriteLine("Done");
}
public void OtherAccessMutex()
{
newMutex.WaitOne();
Console.WriteLine("Done");
}
}

Other doubt: If two threads have call the WaitOne method of Mutex's object, who will access the resource first? Confused | :confused: Confused | :confused:

Thanks a lot for help, threads are a great challenge.
AnswerRe: Question about Mutex Pin
Andy Brummer30-Aug-05 8:15
sitebuilderAndy Brummer30-Aug-05 8:15 
GeneralRe: Question about Mutex Pin
Alex Cutovoi30-Aug-05 9:25
Alex Cutovoi30-Aug-05 9:25 
GeneralRe: Question about Mutex Pin
Andy Brummer30-Aug-05 10:30
sitebuilderAndy Brummer30-Aug-05 10:30 
GeneralRe: Question about Mutex Pin
Alex Cutovoi30-Aug-05 14:17
Alex Cutovoi30-Aug-05 14:17 
GeneralRe: Question about Mutex Pin
Andy Brummer30-Aug-05 19:30
sitebuilderAndy Brummer30-Aug-05 19:30 
GeneralRe: Question about Mutex Pin
Alex Cutovoi31-Aug-05 2:53
Alex Cutovoi31-Aug-05 2:53 
GeneralRe: Question about Mutex Pin
Alex Cutovoi31-Aug-05 2:56
Alex Cutovoi31-Aug-05 2:56 
QuestionMDI Child with flicker Pin
enricrt30-Aug-05 5:15
enricrt30-Aug-05 5:15 
QuestionListView with column and images Pin
Sasuko30-Aug-05 4:36
Sasuko30-Aug-05 4:36 
AnswerRe: ListView with column and images Pin
Luis Alonso Ramos30-Aug-05 6:43
Luis Alonso Ramos30-Aug-05 6:43 
GeneralRe: ListView with column and images Pin
Sasuko30-Aug-05 7:56
Sasuko30-Aug-05 7:56 
GeneralRe: ListView with column and images Pin
Luis Alonso Ramos30-Aug-05 8:22
Luis Alonso Ramos30-Aug-05 8:22 
QuestionImage dislaying and processing in C# Pin
silka_c#30-Aug-05 4:21
silka_c#30-Aug-05 4:21 
AnswerRe: Image dislaying and processing in C# Pin
Andrew Kirillov30-Aug-05 4:59
Andrew Kirillov30-Aug-05 4:59 
QuestionRe: Image dislaying and processing in C# Pin
silka_c#31-Aug-05 0:50
silka_c#31-Aug-05 0:50 
Answer[Message Deleted] Pin
Judah Gabriel Himango30-Aug-05 5:01
sponsorJudah Gabriel Himango30-Aug-05 5:01 
AnswerRe: Image dislaying and processing in C# Pin
HumanOsc30-Aug-05 7:33
HumanOsc30-Aug-05 7:33 

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.