kilim icon indicating copy to clipboard operation
kilim copied to clipboard

TaskGroup not removing ended Tasks.

Open NotArchon opened this issue 5 years ago • 0 comments

    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.

NotArchon avatar Jun 23 '19 01:06 NotArchon