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

C#

 
AnswerRe: Help needed converting string hash values into binary... Pin
Guffa6-Jan-07 13:45
Guffa6-Jan-07 13:45 
GeneralRe: Help needed converting string hash values into binary... Pin
rvp717y6-Jan-07 14:59
rvp717y6-Jan-07 14:59 
GeneralRe: Help needed converting string hash values into binary... Pin
Luc Pattyn6-Jan-07 18:39
sitebuilderLuc Pattyn6-Jan-07 18:39 
GeneralRe: Help needed converting string hash values into binary... Pin
rvp717y7-Jan-07 5:02
rvp717y7-Jan-07 5:02 
GeneralRe: Help needed converting string hash values into binary... Pin
rvp717y7-Jan-07 5:44
rvp717y7-Jan-07 5:44 
Question[Message Deleted] Pin
code_wiz6-Jan-07 11:51
code_wiz6-Jan-07 11:51 
AnswerRe: ListView/TreeView controls vs. Databinding in .NET 2.0 Pin
Nader Elshehabi7-Jan-07 2:46
Nader Elshehabi7-Jan-07 2:46 
QuestionC# Monitors [modified] Pin
manustone6-Jan-07 10:27
manustone6-Jan-07 10:27 
Hi all
I'm new to C# multithreading and I read that to resolve deadlock it is best to use monitor with timeout.With this in mind I used the following code to see what happens to the deadlocking generated.
The result is the following exception

Unhandled Exception: System.Threading.SynchronizationLockException: Object synchronization method was called from an unsynchronized block of code.

Why this? What's wrong with my code or my approach?
Regards
manuStone

class ThreadFoos
{
public static void First()
{

Monitor.TryEnter(ResourceA, 1000);
try{
Thread.Sleep(500);
Monitor.TryEnter(ResourceB, 1000);
try{
Console.WriteLine("First");
}
finally{
Monitor.Exit(ResourceB);
}
}
finally{
Monitor.Exit(ResourceA);
}
}

public static void Second()
{
Monitor.TryEnter(ResourceB, 1000);
try{
Thread.Sleep(500);
Monitor.TryEnter(ResourceA, 1000);
try{
Console.WriteLine("Second");
}
finally{
Monitor.Exit(ResourceA);
}
}
finally{
Monitor.Exit(ResourceB);
}
}

private static object ResourceA = new Object();
private static object ResourceB = new Object();
}
AnswerRe: C# Monitors Pin
gnadeem6-Jan-07 11:42
gnadeem6-Jan-07 11:42 
GeneralRe: C# Monitors Pin
manustone8-Jan-07 4:06
manustone8-Jan-07 4:06 
QuestionHow do I send cmds to a dvd drive in C#? Pin
try{}catch{}6-Jan-07 10:06
try{}catch{}6-Jan-07 10:06 
AnswerRe: How do I send cmds to a dvd drive in C#? Pin
Ed.Poore6-Jan-07 11:13
Ed.Poore6-Jan-07 11:13 
GeneralRe: How do I send cmds to a dvd drive in C#? Pin
tophor26-Jan-07 15:44
tophor26-Jan-07 15:44 
GeneralRe: How do I send cmds to a dvd drive in C#? Pin
Ed.Poore6-Jan-07 18:45
Ed.Poore6-Jan-07 18:45 
GeneralRe: How do I send cmds to a dvd drive in C#? Pin
try{}catch{}7-Jan-07 15:18
try{}catch{}7-Jan-07 15:18 
QuestionWhich coding convention do you use? Pin
cebyrjoe26-Jan-07 10:03
cebyrjoe26-Jan-07 10:03 
AnswerRe: Which coding convention do you use? Pin
Christian Graus6-Jan-07 11:12
protectorChristian Graus6-Jan-07 11:12 
AnswerRe: Which coding convention do you use? Pin
gnadeem6-Jan-07 11:19
gnadeem6-Jan-07 11:19 
GeneralRe: Which coding convention do you use? Pin
gnadeem6-Jan-07 11:22
gnadeem6-Jan-07 11:22 
QuestionRemoting + Video Capturing Pin
aliG46-Jan-07 9:52
aliG46-Jan-07 9:52 
AnswerRe: Remoting + Video Capturing Pin
Ed.Poore6-Jan-07 11:15
Ed.Poore6-Jan-07 11:15 
AnswerRe: New interface question (properly this time) Pin
Ed.Poore6-Jan-07 11:16
Ed.Poore6-Jan-07 11:16 
QuestionHow to change remote registries that have a username/pw? Pin
Spydre6-Jan-07 7:56
Spydre6-Jan-07 7:56 
AnswerRe: How to change remote registries that have a username/pw? Pin
Ed.Poore6-Jan-07 11:18
Ed.Poore6-Jan-07 11:18 
GeneralRe: How to change remote registries that have a username/pw? Pin
Spydre7-Jan-07 10:11
Spydre7-Jan-07 10:11 

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.