You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2026-01-06 19:41:11 +00:00
race condition fixed
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user