8b9b85e7f5
Former-commit-id: 172c8e3c300b39d5785c7a3e8dfb08ebdbc1a99b
37 lines
539 B
C#
37 lines
539 B
C#
using System;
|
|
using System.Threading.Tasks;
|
|
using System.Threading;
|
|
|
|
struct Struct
|
|
{
|
|
object m_member;
|
|
public Struct (object member)
|
|
{
|
|
m_member = member;
|
|
}
|
|
|
|
public async Task<bool> AsyncMethod ()
|
|
{
|
|
bool b = (string)m_member == "1";
|
|
await Task.Factory.StartNew (() => -3);
|
|
b &= (string)m_member == "1";
|
|
return b;
|
|
}
|
|
}
|
|
|
|
class C
|
|
{
|
|
public static int Main ()
|
|
{
|
|
Struct s = new Struct ("1");
|
|
var t = s.AsyncMethod ();
|
|
if (!Task.WaitAll (new[] { t }, 2000))
|
|
return 1;
|
|
|
|
if (!t.Result)
|
|
return 2;
|
|
|
|
return 0;
|
|
}
|
|
}
|