using System;
using System.Diagnostics ;
using System.Threading .Tasks ;
class Program {
static volatile int s_x;
static volatile int s_xa;
static volatile int s_y;
static volatile int s_ya;
static void Main( string[ ] args) {
while ( true ) {
s_x = 0 ; s_xa = 0 ; s_y = 0 ; s_ya = 0 ;
Task A = Task.Factory .StartNew ( ( ) => {
s_x = 1 ; // W
s_ya = s_y; // W, R
} ) ;
Task B = Task.Factory .StartNew ( ( ) => {
s_y = 1 ; // W
s_xa = s_x; // W, R
} ) ;
Task.WaitAll ( A, B) ;
if ( ! ( s_xa == 1 || s_ya == 1 ) ) Console.WriteLine ( "* {0}, {1}" , s_xa, s_ya) ;
}
}
}
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uRGlhZ25vc3RpY3M7CnVzaW5nIFN5c3RlbS5UaHJlYWRpbmcuVGFza3M7CgpjbGFzcyBQcm9ncmFtIHsgCiAgc3RhdGljIHZvbGF0aWxlIGludCBzX3g7IAogIHN0YXRpYyB2b2xhdGlsZSBpbnQgc194YTsgCiAgc3RhdGljIHZvbGF0aWxlIGludCBzX3k7IAogIHN0YXRpYyB2b2xhdGlsZSBpbnQgc195YTsgCgogIHN0YXRpYyB2b2lkIE1haW4oc3RyaW5nW10gYXJncykgeyAKICAgIHdoaWxlICh0cnVlKSB7IAogICAgICBzX3ggPSAwOyBzX3hhID0gMDsgc195ID0gMDsgc195YSA9IDA7CiAgICAgIFRhc2sgQSA9IFRhc2suRmFjdG9yeS5TdGFydE5ldygoKSA9PiB7IAogICAgICAgICAgICAgICAgICAgIHNfeCA9IDE7IC8vIFcKICAgICAgICAgICAgICAgICAgICBzX3lhID0gc195OyAvLyBXLCBSCiAgICAgICAgICAgICAgIH0pOyAKICAgICAgVGFzayBCID0gVGFzay5GYWN0b3J5LlN0YXJ0TmV3KCgpID0+IHsgCiAgICAgICAgICAgICAgICAgICAgc195ID0gMTsgLy8gVwogICAgICAgICAgICAgICAgICAgIHNfeGEgPSBzX3g7IC8vIFcsIFIKICAgICAgICAgICAgICAgfSk7IAogICAgICBUYXNrLldhaXRBbGwoQSwgQik7IAogICAgICBpZiAoIShzX3hhID09IDEgfHwgc195YSA9PSAxKSkgQ29uc29sZS5Xcml0ZUxpbmUoIiogezB9LCB7MX0iLCBzX3hhLCBzX3lhKTsgCiAgICB9IAogIH0gCn0KCg==
compilation info
prog.cs(3,24): error CS0234: The type or namespace name `Tasks' does not exist in the namespace `System.Threading'. Are you missing an assembly reference?
Compilation failed: 1 error(s), 0 warnings
stdout