@@ -205,17 +205,17 @@ defmodule Code do
205
205
end
206
206
207
207
@ doc """
208
- Requires the given `file`. Accepts `relative_to` as an argument
209
- to tell where the file is located. If the file was already
210
- required/loaded, loads it again. It returns all the modules
211
- defined in the file.
208
+ Requires the given `file`. Accepts `relative_to` as an argument to tell where
209
+ the file is located. It returns all the modules defined in the file. If the
210
+ file was already required/loaded, doesn't do anything and returns nil.
211
+
212
+ Notice that if `require_file` is invoked by different processes concurrently,
213
+ the first process to invoke `require_file` acquires a lock and the remaining
214
+ ones will block until the file is available. I.e. if `require_file` is called
215
+ N times with a given file, it will be loaded only once. The first process to
216
+ call `require_file` will get the list of loaded modules, others will get nil.
212
217
213
- Notice that if `require_file` is invoked by different processes
214
- concurrently, the first process to invoke `require_file` acquires
215
- a lock and the remaining ones will block until the file is
216
- available. I.e. if `require_file` is called N times with a given
217
- file, the given file will be loaded only once. Check `load_file`
218
- if you want a file to be loaded concurrently.
218
+ Check `load_file` if you want a file to be loaded concurrently.
219
219
"""
220
220
def require_file ( file , relative_to // nil ) when is_binary ( file ) do
221
221
file = find_file ( file , relative_to )
0 commit comments