Community
cancel
Showing results for 
Search instead for 
Did you mean: 
chentianran
Beginner
43 Views

A basic question on task reference count

I still have trouble understanding the role of task reference count: suppose a parent task created 3 children task and wait for them to finish, then according to the examples, I should set the reference count of the parent task to 3+1=4. But what if I want to have the parent task discarded as soon as it spawns the children tasks, how should I set its reference counter? I'm thinking 0. Wrong answer?
0 Kudos
1 Reply
RafSchietekat
Black Belt
43 Views

Then they should be root tasks instead of child tasks, so they won't try to decrement a reference count that no longer exists, and quite likely you might want to enqueue them instead, but that's difficult to say without knowing why you would want the creating task to be discarded (have you considered a continuation instead?).
Reply