LCOV - code coverage report
Current view: top level - wirestead/wrapper - send_retry.hpp (source / functions) Coverage Total Hit
Test: Wirestead Coverage Report Lines: 100.0 % 4 4
Test Date: 2026-10-29 11:36:05 Functions: 100.0 % 1 1
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: - 0 0

             Branch data     Line data    Source code
       1                 :             : /*
       2                 :             :  * Copyright 2025 Jinwoo Sung
       3                 :             :  *
       4                 :             :  * Licensed under the Apache License, Version 2.0 (the "License");
       5                 :             :  * you may not use this file except in compliance with the License.
       6                 :             :  * You may obtain a copy of the License at
       7                 :             :  *
       8                 :             :  *     http://www.apache.org/licenses/LICENSE-2.0
       9                 :             :  *
      10                 :             :  * Unless required by applicable law or agreed to in writing, software
      11                 :             :  * distributed under the License is distributed on an "AS IS" BASIS,
      12                 :             :  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      13                 :             :  * See the License for the specific language governing permissions and
      14                 :             :  * limitations under the License.
      15                 :             :  */
      16                 :             : 
      17                 :             : #pragma once
      18                 :             : 
      19                 :             : #include <chrono>
      20                 :             : #include <condition_variable>
      21                 :             : #include <mutex>
      22                 :             : 
      23                 :             : namespace wirestead::wrapper::detail {
      24                 :             : // A ready capacity snapshot is not a reservation. Concurrent senders can win
      25                 :             : // admission first; briefly release the CPU before polling the original pin again.
      26                 :             : // No wrapper/session lock may be held here. Callback callers never reach retries.
      27                 :         256 : inline void pause_send_retry(std::condition_variable& cv, std::mutex& mutex) {
      28                 :         256 :   std::unique_lock<std::mutex> lock(mutex);
      29                 :         256 :   cv.wait_for(lock, std::chrono::milliseconds(1));
      30                 :         256 : }
      31                 :             : }  // namespace wirestead::wrapper::detail
        

Generated by: LCOV version 2.0-1