threads.cxx: Add AbstractThreadPtr parameter to thread's lambda
to remove the addReference()/removeReference() dance.