[saga-rg] context problem

Andre Merzky andre at merzky.net
Fri Jul 14 09:46:33 CDT 2006


Hi folx, 

I realised that we are running into some problems with our
current session and context handling.  For example:

  
  ------------------------------------------------------------
  saga::task    t;
  saga::session s;

  {
    saga::context c (saga::context::GSI);

    s.add_context (c);

    saga::file f (s, url);

    t = f.copy <saga::task::Task> (target);

    s.remove_context (c);
  }
  // as it leaves the scope, the gsi context gets destroyed.

  t.run (); 
  // the task can not use the GSI context, although the file
  // object and the copy task have been created in a session
  // with a valid GSI context.
  ------------------------------------------------------------


The problem really is that, as a context gets removed, no
assumption is made about the fact that the session might
have active objects which are currently using that context.

The example above is harmless - image a context getting
removed between two subsequent read calls, or while a task
is _running_.


I would propose to change the semantics of remove_context to
be advisory, i.e. to allow existing objects and tasks to
continue to use the context if (and only if) it was already
used by them before.  The session SHOULD free context
related resources as soon as no object uses it anymore.
list_context() MUST NOT list the removed context anymore.

We have similar mechanisms in place to keep sessions alive
if they are needed by objects, and to keep objects alive if
they are needed by tasks.  So that would be a somewhat
coherent approach.

The downside of course is that, at one more place, resource
deallocation is out of sync with the appearent object
destruction.  

Any opinion?

Cheers, Andre.



-- 
"So much time, so little to do..."  -- Garfield





More information about the saga-rg mailing list