1
0
mirror of https://github.com/godotengine/godot.git synced 2026-01-06 19:41:11 +00:00

race condition fixed

Ariel Manzur
2014-05-05 00:06:08 -03:00
parent 39b21de647
commit dfcc953a32

@@ -80,13 +80,21 @@ func get_resource(path):
if path in pending:
if pending[path] extends ResourceInteractiveLoader:
var res = pending[path]
_unlock("wait")
if res == queue[0]:
# this will restart the load, while the resource is halfway loading onn the other thread
# however the sub-resources that are already loaded will be used here
var ret = ResourceLoader.load(path)
pending.erase(path)
queue.remove(0)
_unlock("get_resource")
return ret
var ret = res.wait()
if ret != ERR_FILE_EOF:
# error loading
_unlock("wait_error")
return null
res = res.get_resource()
_lock("fix_queue")
pending.erase(path)
_unlock("return")
return res