Boost.Fiber Class fiber


Class fiber

기본 생성자 - Default constructor

• Effects: Not-a-Fiber를 참조하는 Fiber 인스턴스를 생성합니다.
• Postconditions: this->get_id() == fiber::id()
• Throws: Nothing

생성자 - Constructor

  • Preconditions: Fn은 복사 가능하거나 이동 가능해야 합니다.
  • Effects: fn은 새 파이버에서 액세스할 수 있도록 내부 저장소로 복사되거나 이동됩니다.   'post'가 지정(또는 기본값)된 경우 새 파이버는 "준비(ready)"로 표시되고 다음 기회에 입력됩니다.   'dispatch'로 지정되면 호출 파이버가 일시 중단되고 새 파이버가 즉시 입력됩니다.
  • Postconditions: *this는 새로 생성된 실행 파이버를 나타냅니다.
  • Throws: 오류가 발생하면 fiber_error.
  • Note: 내부 '__econtext__'에 스택을 할당하려면 'StackAllocator'가 필요합니다.   'StackAllocator'가 명시적으로 전달되지 않으면 기본 스택 할당자는 'BOOST_USE_SEGMENTED_STACKS'에 따라 달라집니다.   정의된 경우에는 'segmented_stack'을 얻게 되고, 그렇지 않으면 고정된 크기의 스택을 얻게 됩니다.
  • See also: std::allocator_arg_t, Stack allocation

Move constructor

  • Effects: other의 파이버 소유권을 새로 구성된 Fiber 인스턴스로 이전합니다.
  • Postconditions: other.get_id() == fibre::id() 및 get_id()는 생성 전에 other.get_id()의 값을 반환합니다.
  • Throws: Nothing

Move assignment operator

  • Effects: other(있는 경우)의 파이버의 소유권을 *this로 이전합니다.
  • Postconditions: other->get_id() == fibre::id() 및 get_id()는 할당 이전에 other.get_id()의 값을 반환합니다.
  • Throws: Nothing

파괴자 - Destructor

  • Effects: 파이버가 fibre::joinable()인 경우 std::terminate를 호출합니다. *this를 파괴합니다.
  • Note: 프로그래머는 파이버가 여전히 Fiber::joinable()인 동안 소멸자가 실행되지 않도록 해야 합니다.   Fiber가 완료되었음을 알고 있더라도 Fiber 객체를 삭제하기 전에 fiber::join() 또는 fiber::detach()를 호출해야 합니다.

Member function joinable()

  • Returns: *this 완료되었거나 완료되지 않았을 수 있는 실행 파이버를 나타내는 경우 true입니다. 그렇지 않으면 거짓입니다.
  • Throws: Nothing

Member function join()

  • Preconditions: 파이버는 fiber::joinable()입니다.
  • Effects: 참조된 실행 파이버가 완료될 때까지 기다립니다.
  • Postconditions: 항목에 참조된 실행 파이버가 완료되었습니다.
    *this는 더 이상 실행 파이버를 의미하지 않습니다.
  • Throws: fiber_error
  • Error Conditions
    resource_deadlock_would_occur: if this->get_id() == boost::this_fiber::get_id().
    invalid_argument: if the fiber is not fiber::joinable().

Member function detach()

  • Preconditions: 파이버는 fiber::joinable()입니다.
  • Effects: 실행 파이버가 분리되고 더 이상 연관된 파이버 개체가 없습니다.
  • Postconditions: *this는 더 이상 실행 파이버를 의미(refers)하지 않습니다.
  • Throws: fiber_error
  • Error Conditions: invalid_argument: if the fiber is not fiber::joinable().

Member function get_id()

  • Returns: *this가 실행 파이버를 나타내는 경우 해당 파이버를 나타내는 fiber::id 인스턴스입니다. 그렇지 않으면 기본으로 구성된 fiber::id를 반환합니다.
  • Throws: Nothing
  • See also: this_fiber::get_id()

Templated member function properties()

  • Preconditions: *this은 실행 파이버를 의미합니다. use_scheduling_algorithm()은 동일한 템플릿 인수 PROPS를 사용하는 algorithm_with_properties<>의 하위 클래스를 사용하여 이 스레드에서 호출되었습니다.
  • Returns: *this에 대한 스케줄러 속성 인스턴스에 대한 참조입니다.
  • Throws: std::bad_cast use_scheduling_algorithm()이 PROPS가 아닌 다른 템플릿 매개변수를 사용하여 algorithm_with_properties 하위 클래스와 함께 호출된 경우.
  • Note: algorithm_with_properties<>는 사용자 코딩 스케줄러가 우선 순위와 같은 확장 속성을 Fiber 인스턴스와 연결하는 방법을 제공합니다. 이 방법을 사용하면 사용자가 제공한 속성에 액세스할 수 있습니다.
  • See also: Customization

Member function swap()

  • Effects: *this와 다른 것과 연관된 실행 파이버를 교환하므로 *this는 이전에 다른 것과 연관된 섬유와 연관되고 그 반대의 경우도 마찬가지입니다.
  • Postconditions: this->get_id() returns the same value as other.get_id() prior to the call.
    other.get_id() returns the same value as this->get_id() prior to the call.
  • Throws: Nothing

Non-member function swap()

  • Effects: Same as l.swap( r).
  • Throws: Nothing

Non-member function operator<()

  • Returns: true if l.get_id() < r.get_id() is true, false otherwise.
  • Throws: Nothing.

Non-member function use_scheduling_algorithm()

  • Effects: 현재 스레드의 모든 파이버에 대한 스케줄링 알고리즘으로 알고리즘의 구체적인 하위 클래스여야 하는 'SchedAlgo'를 사용하도록 Boost.Fiber에 지시합니다.   필요한 SchedAlgo 생성자 인수를 args로 전달합니다.
  • Note: 지정된 스레드가 기본이 아닌 스케줄링 알고리즘을 사용하도록 하려면 다른 Boost.Fiber 진입점 전에 해당 스레드가 use_scheduling_algorithm()을 호출하도록 만드세요.   Boost.Fiber가 이를 사용해야 할 때까지 현재 스레드에 대해 스케줄러가 설정되지 않은 경우 라이브러리는 이 스레드에 대한 기본 round_robin 인스턴스를 생성합니다.
  • Throws: Nothing
  • See also: Scheduling, Customization

Non-member function has_ready_fibers()

  • Returns: 스케줄러에 실행할 준비가 된 파이버가 있으면 true입니다.
  • Throws: Nothing
  • Note: 유휴 스케줄러를 찾기 위해 작업을 훔치는(work-stealing) 데 사용할 수 있습니다.
⚛ 원문

Email 답글이 올라오면 이메일로 알려드리겠습니다.

혹시 처음이세요?
레디스게이트에는 레디스에 대한 많은 정보가 있습니다.
레디스 소개, 명령어, SQL, 클라이언트, 서버, 센티널, 클러스터 등이 있습니다.
혹시 필요한 정보를 찾기 어려우시면 redisgate@gmail.com로 메일 주세요.
제가 찾아서 알려드리겠습니다.
 
close
IP를 기반으로 보여집니다.