Example #1
0
 public void Reset()
 {
     AsyncType      = EAsyncType.Normal;
     PostAction     = null;
     Awaiter        = null;
     ContinueThread = null;
     AsyncTarget    = null;
     Tag            = null;
     ExceptionInfo  = null;
     CallStackTrace = null;
 }
Example #2
0
        public async System.Threading.Tasks.Task AwaitSemaphore(ASyncSemaphore smp)
        {
            if (smp == null)
            {
                Profiler.Log.WriteLine(Profiler.ELogTag.Error, "", $"AwaitSemaphore is null");
                return;
            }
            var eh = new PostEvent();

            eh.PostAction     = null;
            eh.AsyncTarget    = null;
            eh.ContinueThread = ContextThread.CurrentContext;
            eh.AsyncType      = EAsyncType.Semaphore;
            eh.Tag            = smp;
            smp.PostEvent     = eh;

            var source = new System.Threading.Tasks.TaskCompletionSource <object>();
            await source.Task.AwaitPost(eh);

            smp = null;
        }