|
From: Andy C. <ac...@ll...> - 2003-06-24 20:45:23
|
My apologies ahead of time for being rusty enough that I'm not sure I'm using the correct term (re-entrant) nor that I'm not asking an obvious question one way or the other... I am trying to extend/modify (I'm cheating: I'm extending the class, but I'm extending it by copying the source of the method that I want to change and then changing it... I'm not exactly sure where that sits in the OO pantheon but it's probably not a good idea in general as a rewrite of the parent class would now invalidate my extension) the Schedule stuff in Repast to test some ideas we are working on. I'm modifying the method "preExecute" in ScheduleBase: just before the routine ends, I make a method call on another object. Now, here's the trick: somewhere in the processing of that other method call, the flow of control may come *back* to the current Schedule and try to add events, albeit *after* the current tick. Like I said, my mind is drawing a blank, but I'm calling that "re-entrant", in the sense that I don't think such a thing was anticipated by the original developers. I've tried to follow the source enough to determine whether that should be "safe", that is, would the addition of events to the schedule be ok in the state that the schedule is in just before "pre execute" ends? It's a little like a threading question but I'm only assuming a single thread of control here. It *looks* safe, because basically what preExecute does is set aside a set of actions to be performed during "execute", and changes to the priority queue once that is done should not effect that set, and the existence of that set shouldn't effect the state of the priority queue. However, I thought I'd check in with the development team to find out for sure... Thanks, Andy ============================================ Andrew J. Cleary, Software Engineer/Computational Scientist Lawrence Livermore National Labs, 925-424-5890. ============================================ |