Allow threads to attach and detach more easily
Array.indexOf/lastIndexOf implementation (refs HaxeFoundation/haxe#1242)