channels in function loop