             schedule_migrate_shutdown(context, state)
           else
             spawn fn() ->
-                :thread.sleep(500)
+                Process.sleep(500)
                 @server.worker_terminate!(ref, nil, context)
               end
             state

          {initialized, inner_state} = @worker_state_entity.transfer(ref, initial_state.inner_state)

          if unquote(MapSet.member?(features, :inactivity_check)) do
            state = %Noizu.SimplePool.Worker.State{initial_state| initialized: initialized, worker_ref: ref, inner_state: inner_state, last_activity: :os.system_time(:seconds)}
            state = schedule_inactivity_check(nil, state)
            {:ok, state}
          else
            {:ok, %Noizu.SimplePool.Worker.State{initial_state| initialized: initialized, worker_ref: ref, inner_state: inner_state}}
          end

          case @worker_state_entity.load(state.worker_ref, context) do
            nil -> {:reply, :initilization_failed, state}
            inner_state ->
              handle_call(call, from, %Noizu.SimplePool.Worker.State{state| initialized: true, inner_state: inner_state})
          end
        end # end handle_call

