New thread prototype for distance algorithm.

Signed-off-by: Yuriy Rusinov <yrusinov@gmail.com>