Queue solution to cooperating threads