threaded control primitive code