Stable version [copy window from device to host when creating a new thread
and the pre-allocated memory can still be used by the code within
while()].