Skip to content

TaskGroup not removing ended Tasks. #14

@NotArchon

Description

@NotArchon
    TaskGroup g = new TaskGroup();
    Field f = TaskGroup.class.getDeclaredField("addedTasksMB");
    f.setAccessible(true);

    Mailbox<Task> mb = (Mailbox<Task>) f.get(g);

    g.add(Task.fork(() -> System.err.println(1)));
    g.add(Task.fork(() -> System.err.println(2)));
    g.joinb();

    System.err.println("--> SIZE: " + mb.size()); //0, which is expected.

    g.add(Task.fork(() -> System.err.println(3)));
    g.add(Task.fork(() -> System.err.println(4)));
    g.joinb();

    System.err.println("--> SIZE: " + mb.size()); //2, but shouldn't this be 0?

I'm trying to reuse a TaskGroup instance. This may not be the intended usage, but if it is it seems that the number of tasks stored in the group doesn't correctly get removed when being reused.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions