Closed Norgerman closed 7 years ago
pr #46
Hi, do you have full stack trace for this?
I believe it might be a better option to just do the schedule, then wait for the loop to start and process. e.g. wait for the loop in a run state where it is guaranteed not to be null.
Let me change it a bit and let you to have a look at it.
the error's stack trace,just use the loopthread example
Loop thread error System.NullReferenceException: Object reference not set to an instance of an object.
at NetUV.Core.Channels.EventLoop.Schedule(Action`1 action) in C:\Users\XXX\Desktop\NetUV\src\NetUV.Core\Channels\EventLoop.cs:line 94
at LoopThread.Program.Main(String[] args) in C:\Users\XXX\Desktop\NetUV\examples\LoopThread\Program.cs:line 31.
line 94:
this.asyncHandle.Send();
I see, thanks.
Well, the intention is that await RunLoopAsync(); then call eventLoop.Schedule
I will fix the example.
The code shows that await RunLoopAsync();
will block util the loop is closed,so eventLoop.Schedule
will not be called properly....
There are a few places need to be guarded properly. Let me change it first.
The EventLoop class is kind of experimental, forget to put some attribute on it.
:smile:
works~ 👍
PR #48
RunLoop
is called later thanSchedule
(sometimes maybe), and then will cause aNullReferenceException