     end
   end
 
-  defp spawn_requires([], [], _callback, _schedulers, result), do: result
+  defp spawn_requires([], [], _callbacks, _schedulers, result), do: result
 
-  defp spawn_requires([], waiting, callback, schedulers, result) do
-    wait_for_messages([], waiting, callback, schedulers, result)
+  defp spawn_requires([], waiting, callbacks, schedulers, result) do
+    wait_for_messages([], waiting, callbacks, schedulers, result)
   end
 
-  defp spawn_requires(files, waiting, callback, schedulers, result) when length(waiting) >= schedulers do
-    wait_for_messages(files, waiting, callback, schedulers, result)
+  defp spawn_requires(files, waiting, callbacks, schedulers, result) when length(waiting) >= schedulers do
+    wait_for_messages(files, waiting, callbacks, schedulers, result)
   end
 
-  defp spawn_requires([h | t], waiting, callback, schedulers, result) do
+  defp spawn_requires([h | t], waiting, callbacks, schedulers, result) do
     parent = self()
     {pid, ref} = :erlang.spawn_monitor fn ->
       :erlang.put(:elixir_compiler_pid, parent)

      end)
    end

    spawn_requires(t, [{pid, ref} | waiting], callback, schedulers, result)
  end

  defp wait_for_messages(files, waiting, callback, schedulers, result) do
    receive do
      {:DOWN, ref, :process, pid, status} ->
        tuple = {pid, ref}

  @doc """
  Requires the given files.

  A callback that will be invoked with each file, or a keyword list of `callbacks` can be provided:

    * `:each_file` - invoked with each file

    * `:each_module` - invoked with file, module name, and binary code

  Returns the modules generated by each required file.
  """
  def files(files, callbacks \\ [])

  def files(files, callback) when is_function(callback, 1) do
    files(files, [each_file: callback])
  end

  def files(files, callbacks) when is_list(callbacks) do
    compiler_pid = self()
    :elixir_code_server.cast({:reset_warnings, compiler_pid})
    schedulers = max(:erlang.system_info(:schedulers_online), 2)
    result = spawn_requires(files, [], callbacks, schedulers, [])

    # In case --warning-as-errors is enabled and there was a warning,
    # compilation status will be set to error.
