reef-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <tcondie.apa...@gmail.com>
Subject ITask and IDisposable
Date Sun, 08 Jul 2018 18:21:08 GMT
Now that I've been digging deeper into the existing REEF.Net implementation,
I have come across something that concerns me. Presently, ITask implements
IDisposable, which from my understand should be the last call any C# object
should receive i.e., the object is effectively dead after its Dispose method
is called. Unfortunately, this is presently violated in REEF.Net.
Specifically, when a task is explicitly closed by the driver, the C#
TaskRuntime will call the task's Dispose method. After which, the call
method (ideally) returns and the TaskRuntime subsequently calls the stop
handlers, which based on my implementation (and many other existing
applications) calls the task object that was previously disposed. 

 

My question then is why are we having ITask implement IDisposable when we
have perfectly good event handlers for cleanup e.g., StopEvent? I'm fine
with keeping IDisosable as long as we ensure that Dispose is the absolute
last call ever made to an object that could belong to the application.
However, if there's no good reason for having Dispose over existing handlers
then perhaps we should remove it. In general, I also find it confusing to
have methods with overlapping semantics i.e., what should I put into my stop
handler vs. what should go into Dispose. they seem to serve the same
purpose. 

 

Bottom line, I do not know the right answer here but I do feel that we
should avoid calling any methods on an object that has had its Dispose
method already called. Presently, this is not the case in REEF.Net

 

-Tyson


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message