Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Stackoverflow 28125983
//Title of this code //Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using System.Threading; namespace Rextester { public class Program { static object obj = new object(); static void m1() { lock(obj) { Monitor.Enter(obj); Console.WriteLine("m1"); } Console.WriteLine("m1 has lock on obj: ", Monitor.IsEntered(obj)); } static void m2() { lock (obj) { Console.WriteLine("m2"); Monitor.Pulse(obj); } } public static void Main(string[] args) { Thread t1 = new Thread(m1); Thread t2 = new Thread(m2); t1.Start(); t2.Start(); t1.Join(); Console.WriteLine("t1 ended"); t2.Join(); Console.WriteLine("t2 ended"); //Your code goes here Console.WriteLine("mainthread ended"); } } }
run
|
edit
|
history
|
help
0
BankAccount
cs002
Evo Ivana da budes fancy :D
C# Bubble Sort
Merging and sorting 2 arrays using LINQ
One liner recursive prime generator
PrivateConstructorToCreateSingleObject
Collection_ basic datastructure brushup
Random number maker block (better version)
Programmes