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

C#

 
GeneralGreat,,,,,,,,,,,,,, Pin
r aa j7-Aug-08 18:29
r aa j7-Aug-08 18:29 
Questioncheck for updates Button Pin
laziale6-Aug-08 20:33
laziale6-Aug-08 20:33 
AnswerRe: check for updates Button Pin
Programm3r6-Aug-08 20:45
Programm3r6-Aug-08 20:45 
QuestionThread Question Pin
Programm3r6-Aug-08 20:28
Programm3r6-Aug-08 20:28 
AnswerRe: Thread Question Pin
MarkB7776-Aug-08 21:19
MarkB7776-Aug-08 21:19 
QuestionRe: Thread Question Pin
Programm3r6-Aug-08 21:52
Programm3r6-Aug-08 21:52 
AnswerRe: Thread Question Pin
GeorgeBerry7-Aug-08 0:43
GeorgeBerry7-Aug-08 0:43 
AnswerRe: Thread Question Pin
MarkB7776-Aug-08 23:36
MarkB7776-Aug-08 23:36 
Hi,

Programm3r wrote:
I want to create two threads and declare an enumeration to store some thread states (not referring to ThreadState). I.E:


No this is not a good approach, as it is not promoting code reuse.

Programm3r wrote:
When the one thread wants to do some processing, it first check the state of the other thread before proceeding. Should the state be in threadSleeping state the one thread puts the other one in a Suspend state and can continue processing, thus the following can be prevented:

A thread may be performing a system-wide-synchronized operation like locking a range of bytes in a file, writing to those bytes, unlocking those bytes, then closing the file. A thread is suspended before the unlock, that range of bytes will remain locked for an indeterminate amount of time until the thread is resumed or the process terminates


If I've read correctly your process is fine. The usual approach when dealing with two threads that are sharing one resource is to use a mutex semaphore to block one thread while the other is doing some work.

I believe that .NET has classes (Mutex, Semaphore) in System.Threading that support this.


I hope this helps,


Cheers,


QuestionThe .Net C# Give Me the Exeption For Serialisation Pin
Thaer Hamael6-Aug-08 19:53
Thaer Hamael6-Aug-08 19:53 
AnswerRe: The .Net C# Give Me the Exeption For Serialisation Pin
stancrm6-Aug-08 20:17
stancrm6-Aug-08 20:17 
GeneralRe: The .Net C# Give Me the Exeption For Serialisation Pin
Thaer Hamael6-Aug-08 20:24
Thaer Hamael6-Aug-08 20:24 
GeneralRe: The .Net C# Give Me the Exeption For Serialisation Pin
Thaer Hamael6-Aug-08 20:24
Thaer Hamael6-Aug-08 20:24 
GeneralRe: The .Net C# Give Me the Exeption For Serialisation Pin
leppie6-Aug-08 22:33
leppie6-Aug-08 22:33 
QuestionRead null value(s) from cell of DataGridView Pin
M Riaz Bashir6-Aug-08 19:52
M Riaz Bashir6-Aug-08 19:52 
AnswerRe: Read null value(s) from cell of DataGridView Pin
Judah Gabriel Himango6-Aug-08 19:58
sponsorJudah Gabriel Himango6-Aug-08 19:58 
GeneralRe: Read null value(s) from cell of DataGridView Pin
M Riaz Bashir6-Aug-08 20:10
M Riaz Bashir6-Aug-08 20:10 
GeneralRe: Read null value(s) from cell of DataGridView Pin
Kjetil Svendsen6-Aug-08 22:17
Kjetil Svendsen6-Aug-08 22:17 
GeneralRe: Read null value(s) from cell of DataGridView Pin
leppie7-Aug-08 3:09
leppie7-Aug-08 3:09 
GeneralRe: Read null value(s) from cell of DataGridView Pin
leppie7-Aug-08 2:58
leppie7-Aug-08 2:58 
QuestionGet Default Printer name Pin
magy6-Aug-08 19:50
magy6-Aug-08 19:50 
AnswerRe: Get Default Printer name Pin
Judah Gabriel Himango6-Aug-08 19:57
sponsorJudah Gabriel Himango6-Aug-08 19:57 
QuestionVB.NET over C#.net Pin
alda winnona6-Aug-08 19:36
alda winnona6-Aug-08 19:36 
AnswerRe: VB.NET over C#.net Pin
rah_sin6-Aug-08 19:50
professionalrah_sin6-Aug-08 19:50 
AnswerRe: VB.NET over C#.net Pin
Judah Gabriel Himango6-Aug-08 19:56
sponsorJudah Gabriel Himango6-Aug-08 19:56 
AnswerRe: VB.NET over C#.net Pin
dan!sh 6-Aug-08 22:28
professional dan!sh 6-Aug-08 22:28 

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.