Threads: Implemented a sequential thread id