The class CounterThread extends Thread and overrides the run function. The function increments the counter variable in a loop.
class CounterThread : Thread() {
override fun run() {
var counter: Long = 0
while (true) {
counter++
}
}
}
As it is now, the loop works infinitely. You should fix it by adding interruption handling.
If another thread interrupts this thread, it must print "It was interrupted" and stop.
Please do not remove the loop. Otherwise, your solution may not pass the tests.