anchor.diff:  %% Handling cast messages
   %% @end
   %%--------------------------------------------------------------------
  -handle_cast({register_task, TaskDesc}, #state{tasks=Tasks}) ->
  +handle_cast({register_task, TaskDesc}, State = #state{tid=Tid}) ->
       TaskName = TaskDesc#task.name,
  -    {noreply, #state{tasks=register_task(TaskName, TaskDesc, Tasks)}};
  -handle_cast({unregister_task, TaskName}, #state{tasks=Tasks}) ->
  -    {noreply, #state{tasks=unregister_task(TaskName, Tasks)}};
  +    register_task(Tid, TaskName, TaskDesc),
  +    {noreply, State};
  +handle_cast({unregister_task, TaskName}, State = #state{tid=Tid}) ->
  +    unregister_task(Tid, TaskName),
  +    {noreply, State};
   handle_cast(shutdown, _) ->
       exit(normal).
   
   %%--------------------------------------------------------------------
  +%% @doc
  +%% Handling all non call/cast messages
  +%%
   %% @spec handle_info(Info, State) -> {noreply, State} |
   %%                                       {noreply, State, Timeout} |
  -%%                                       {stop, Reason, State}.
  -%%
  -%% @doc
  -%% Handling all non call/cast messages
  +%%                                       {stop, Reason, State}
  +%%
   %% @end
   %%--------------------------------------------------------------------
   handle_info(_Info, State) ->
       {noreply, State}.
   
   %%--------------------------------------------------------------------
  -%% @spec terminate(Reason, State) -> void().
  -%%
   %% @doc
   %% This function is called by a gen_server when it is about to
   %% terminate. It should be the opposite of Module:init/1 and do any necessary
   %% cleaning up. When it returns, the gen_server terminates with Reason.
   %% The return value is ignored.
  +%%
  +%% @spec terminate(Reason, State) -> void()
   %% @end
   %%--------------------------------------------------------------------
   terminate(_Reason, _State) ->
       ok.
   
   %%--------------------------------------------------------------------
  -%% @spec code_change(OldVsn, State, Extra) -> {ok, NewState}.
  -%%
   %% @doc
   %% Convert process state when code is changed
  +%%
  +%% @spec code_change(OldVsn, State, Extra) -> {ok, NewState}
   %% @end
   %%--------------------------------------------------------------------
   code_change(_OldVsn, State, _Extra) ->
  
positive.code:     end.
  
  %%--------------------------------------------------------------------
  %% @spec resolve_tasks(TaskName::list(), Tasks::gb_trees(), Acc::list()) -> TaskImpls::list()
  %%
  %% @doc
  %%  Given a list of tasks names that may include the dummy task 'NONE' resolve the implementations
  %%  coresponding to said names.
  %% @end
  %%--------------------------------------------------------------------
  resolve_tasks(['NONE' | Tail], Tasks, Acc) ->
      resolve_tasks(Tail, Tasks, Acc);
  resolve_tasks([Task | Tail], Tasks, Acc) ->
      Impl = get_impl(gb_trees:lookup(Task, Tasks)),
      resolve_tasks(Tail, Tasks, [Impl | Acc]);
  resolve_tasks([], _Tasks, Acc) ->
      lists:reverse(Acc).
  
  %%--------------------------------------------------------------------
  %% @spec get_deps(TaskDesc::tuple()) -> Deps::list()
  %%
  %% @doc
  %%  Retrieve the deps from the task tuple.
  %% @end
  %%--------------------------------------------------------------------
  get_deps({value, TaskDesc}) ->
      TaskDesc#task.deps;
  get_deps(none) ->
      none.
  
  
  %%--------------------------------------------------------------------
  %% @spec get_impl(TaskDesc::tuple()) -> Impl::atom()
  %%
  %% @doc
  %%  Get the task implementation from the lyst
  %% @end
  %%--------------------------------------------------------------------
  get_impl({value, TaskDesc}) ->
      TaskDesc#task.task_impl;
  get_impl(none) ->
      none.
  
  %%--------------------------------------------------------------------
  %% @doc
  %%  Get the opts for the system.
  %% @spec get_opts(TaskDesc::tuple()) -> Opts
  %% @end
  %%--------------------------------------------------------------------
  get_opts({value, {_, _, _, _, Opts}}) ->
      Opts;
  get_opts(none) ->
      [].
  
  
  %%====================================================================
  %%% Tests
  %%====================================================================
  gen_deps_test() ->
      Trees = register_task(task1, {task1_impl, [task2, task3], true, ""}, gb_trees:empty()),
      Trees1 = register_task(task2, {task2_impl, [task3, task4], true, ""}, Trees),
      Trees2 = register_task(task3, {task3_impl, [], true, ""}, Trees1),
      Trees3 = register_task(task4, {task4_impl, [task3], true, ""}, Trees2),
      TaskList = resolve_tasks(reorder_tasks(gather_tasks(Trees3, task1, [])), Trees3, []),
      [task3_impl, task4_impl, task2_impl, task1_impl] == TaskList.
  
  gen_server_test() ->
      %% Give the server a chance to shut down. wait 100 millis
      timer:sleep(100),
      {ok, _} = start_link(),
      register_task(task1, task1_impl, [task2, task3], true, ""),
      register_task(task2, task2_impl, [task3, task4], true, ""),
      register_task(task3, task3_impl, [], true, ""),
      register_task(task4, task4_impl, [task3], true, ""),
      TaskList = gen_task_chain(task1),
      shutdown(),
      [task3_impl, task4_impl, task2_impl, task1_impl] ==  TaskList.
  
  
  get_task_def_test() ->
      %% Give the server a chance to shut down. wait 100 millis
      timer:sleep(100),
      {ok, _} = start_link(),
      register_task(task1, task1_impl, [task2, task3], true, ""),
      register_task(task2, task2_impl, [task3, task4], true, ""),
      register_task(task3, task3_impl, [], true, ""),
      register_task(task4, task4_impl, [task3], true, ""),
      TaskDef = get_task_def(task1),
      shutdown(),
      {value, {task1_impl, [task2, task3], true, ""}} = TaskDef.
  
negative.code: %%%---------------------------------------------------------------------------
  %%% @author Eric Merritt <cyberlync@gmail.com>
  %%% @doc
  %%%  This module manages tasks, task descriptions and task relationships.
  %%%
  %%%  @type tid() = term(). The ets id for the ets storage table for this gen_server.
  %%%  @type task_name() = atom(). The name of the task. The public global name of the system.
  %%%  @type task_impl() = atom() | function(). The implementation of the task. Either
  %%%    a module that implements the {@link eta_gen_task} behavior or a function that takes
  %%%    two args.
  %%%  @type deps() = [task_name()]. The list of dependent tasks for the task being described.
  %%%  @type desc() = string(). A string description of the task, used in help among other things.
  %%%  @type opts() = [{string(), string(), bool()}]. An option description, in the form of ewl_get_opts.
  %%% @end
  %%% @copyright (C) 2007, Erlware
  %%% Created : 18 Oct 2007 by Eric Merritt <cyberlync@gmail.com>
  