Click here to Skip to main content
15,905,682 members
Home / Discussions / C#
   

C#

 
AnswerRe: Generic Collection class question Pin
Christian Graus22-Nov-05 11:48
protectorChristian Graus22-Nov-05 11:48 
GeneralRe: Generic Collection class question Pin
akyriako7822-Nov-05 12:30
akyriako7822-Nov-05 12:30 
GeneralRe: Generic Collection class question Pin
Christian Graus22-Nov-05 12:39
protectorChristian Graus22-Nov-05 12:39 
AnswerRe: Generic Collection class question Pin
smh123-Nov-05 8:58
smh123-Nov-05 8:58 
QuestionXmlValidatingReader problem with xs:date Pin
IsaacB22-Nov-05 6:51
IsaacB22-Nov-05 6:51 
QuestionDynamically Add Textboxes to datagrid Pin
tadhg8822-Nov-05 6:36
tadhg8822-Nov-05 6:36 
AnswerRe: Dynamically Add Textboxes to datagrid Pin
Stanciu Vlad22-Nov-05 9:08
Stanciu Vlad22-Nov-05 9:08 
QuestionProblem with Mutex in multithreading Application Pin
Alexandr Sergeevich Ilyin22-Nov-05 6:16
Alexandr Sergeevich Ilyin22-Nov-05 6:16 
I have application, that creates 2 threads, Both threads use the same resources and I want, they to be synchronised using Mutex.
I am using code like this

public class Test
{
protected Mutex mutex;
public Test()
{
mutex = new Mutex(false);
Thread A = new Thread(new ThreadStart(TF1));
Thread B = new Thread(new ThreadStart(TF2));
A.Start();
B.Start();
}
void TF1()
{
while(true)
{
mutex.WaitOne();
Console.Write("do some work 1");
mutex.Release();
Thread.Sleep(100);
}
}
void TF2()
{
while(true)
{
mutex.WaitOne();
Console.Write("do some work 2");
mutex.Release();
Thread.Sleep(100);
}
}
}
--------------------------------------------
It works fine some time, but one moment
both Threads are waiting for something, for example
Console Input or Window Resize.
And I do not understand why.

(Of course, I am not using "Console.Read" function in a Thread functions. )




AnswerRe: Problem with Mutex in multithreading Application Pin
whizzs22-Nov-05 8:57
whizzs22-Nov-05 8:57 
GeneralRe: Problem with Mutex in multithreading Application Pin
Alexandr Sergeevich Ilyin22-Nov-05 17:24
Alexandr Sergeevich Ilyin22-Nov-05 17:24 
GeneralRe: Problem with Mutex in multithreading Application Pin
S. Senthil Kumar22-Nov-05 19:34
S. Senthil Kumar22-Nov-05 19:34 
AnswerRe: Problem with Mutex in multithreading Application Pin
S. Senthil Kumar22-Nov-05 19:36
S. Senthil Kumar22-Nov-05 19:36 
GeneralRe: Problem with Mutex in multithreading Application Pin
Alexandr Sergeevich Ilyin22-Nov-05 19:53
Alexandr Sergeevich Ilyin22-Nov-05 19:53 
AnswerRe: Problem with Mutex in multithreading Application Pin
mcljava29-Nov-05 12:57
mcljava29-Nov-05 12:57 
QuestionHow do i get directx to play a video, without opening a new window? Pin
Anthony Mushrow22-Nov-05 6:01
professionalAnthony Mushrow22-Nov-05 6:01 
AnswerRe: How do i get directx to play a video, without opening a new window? Pin
leppie22-Nov-05 19:00
leppie22-Nov-05 19:00 
QuestionCapture console output Pin
Kash22-Nov-05 5:42
Kash22-Nov-05 5:42 
AnswerRe: Capture console output Pin
S. Senthil Kumar22-Nov-05 5:57
S. Senthil Kumar22-Nov-05 5:57 
GeneralRe: Capture console output Pin
Kash22-Nov-05 23:40
Kash22-Nov-05 23:40 
QuestionHow to playback file wave by tapi Pin
sharapova22-Nov-05 4:51
sharapova22-Nov-05 4:51 
QuestionHash Code calculation Pin
J4amieC22-Nov-05 4:20
J4amieC22-Nov-05 4:20 
AnswerRe: Hash Code calculation Pin
Stanciu Vlad22-Nov-05 6:08
Stanciu Vlad22-Nov-05 6:08 
GeneralRe: Hash Code calculation Pin
J4amieC22-Nov-05 6:23
J4amieC22-Nov-05 6:23 
GeneralRe: Hash Code calculation Pin
Stanciu Vlad22-Nov-05 7:40
Stanciu Vlad22-Nov-05 7:40 
GeneralRe: Hash Code calculation Pin
Leslie Sanford22-Nov-05 9:57
Leslie Sanford22-Nov-05 9:57 

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.