- A Concurrent Affair - https://www.concurrentaffair.org -

Thread.run, not Thread.start

I am reusing code written for the other instrumentors (and in my previous posts was definitely influenced by them), and one of the instrumentors that I copied and modified was CompactThreadStartStrategy. It now inserts a call to SyncPointBuffer.delayThreadStart towards the end of Thread.start. That sort of works.

However, I just realized that Thread.start is executed by the parent thread that is starting the other thread, not by the thread actually started. I think what I really want is a delay at the beginning of the Thread.run method. It may make sense to delay thread start as well, though, so I will keep DelayThreadStartStrategy and add DelayThreadRunStrategy.

[1] [2]Share [3]