# Empty Tasks

You might need a task that does not do anything but wait for its children to complete. The header `task.h` defines class `empty_task` for this purpose. Its definition is as follows:

    // Task that does nothing. Useful for synchronization.
    class empty_task: public task {
        /*override*/ task* execute() {
            return NULL;
        }
    };

A good example of `empty_task` in action is provided in `tbb/parallel_for`.`h`, in method start_for::execute(). The code there uses continuation-passing style. It creates two child tasks, and uses an `empty_task` as the continuation when the child tasks complete. The top level routine `parallel_for` (in `tbb/parallel_for`.`h`) waits on the root.

Parent topic: Useful Task Techniques