Removes threadqueue, now based on function pointers

This commit removes dependency on threadqueue. New implementation does not really on any queue, just needs function pointers to be set. The less dependencies the better. Also removes an extra buffer copy.