Ensure ResourceMgr::LookupOrCreate calls create fn just once
This addresses a race condition where LookupOrCreate is called at the same time from two threads, and both Lookup()s fail, so the creator() function is run twice, even though only a single Create() will then succeed.
The motivation is that some creator() functions have side-effects, e.g. tf.contrib.summary.create_file_writer()'s init op opens an events file. This change ensures that if two init ops for file writers with the same resource name are run in the same session.run() call, only one events file will be created. (Current behavior will often open two files; typically the second one overwrites the first but this won't happen if the filename_suffix values are different or the timestamps happen to straddle a second boundary.)
PiperOrigin-RevId:
197940607