stdlib: Fix race condition in creating of resource dir

Found via a failing weekly test:
https://jenkins.gem5.org/job/weekly/46/

The following exception was thrown:

```
FileExistsError: [Errno 17] File exists: '/nobackup/jenkins/workspace/weekly/tests/gem5/resources'

At:
  /usr/lib/python3.8/os.py(228): makedirs
  build/GCN3_X86/python/gem5/resources/resource.py(156): __init__
  /nobackup/jenkins/workspace/weekly/tests/gem5/configs/x86_boot_exit_run.py(192): <module>
  build/GCN3_X86/python/m5/main.py(440): main
```

It was found that, in cases where the resource directory does not exist,
there is a race condition between gem5 threads to create the directory.
This patch fixes this so threads that lose this race continue normally.

Change-Id: Ie3323c4df0b247e7830c5d3ab93a4d7f9224fe36
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/59090
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
1 file changed