add thread functionds and active/inactive list