The following code will go into an infinite loop until all resources on the system are consumed and crash random processes on the system with out of memory errors until the game engine finally crashes.
```
void TestThread() {
Sleep(100);
for (int j = 0; j < 1000; ++j) {
Print("TestThread " + j);
Sleep(100);
}
}
modded class DayZGame {
void DayZGame() {
for (int i = 0; i < 2; ++i) {
Print("Starting TestThread " + i);
thread TestThread();
}
}
}```
Script log shows the following:
```
SCRIPT : Registered 367 temporary action enum(s), UAN==367
SCRIPT : ... Backlit Effects Enabled
SCRIPT : Starting TestThread 0
SCRIPT : Starting TestThread 1
SCRIPT : Starting TestThread 1
SCRIPT : Starting TestThread 1
SCRIPT : Starting TestThread 1
SCRIPT : Starting TestThread 1
SCRIPT : Starting TestThread 1
SCRIPT : Starting TestThread 1
SCRIPT : Starting TestThread 1
SCRIPT : Starting TestThread 1
SCRIPT : Starting TestThread 1
SCRIPT : Starting TestThread 1
SCRIPT : Starting TestThread 1
SCRIPT : Starting TestThread 1
SCRIPT : Starting TestThread 1
SCRIPT : Starting TestThread 1
```
Edit:
Editing the thread to the following works correctly.
```void TestThread() {
Sleep(100);
while(true) {
Print("TestThread");
Sleep(100);
}
}```