weixin_42322084
Ηζℑ
采纳率100%
2019-08-12 15:54

求助!!!将C++代码用C#的语法表示

怎样把这段C++代码转成C#代码

    std::mutex mutexCompletedCount;
    std::condition_variable conditionCompletedCount;
    auto completedCount = 0;

    auto onCompleted = [&](bool status)
    {
        {
            std::unique_lock<std::mutex> lock(mutexCompletedCount);
            completedCount += 1;
        }
        conditionCompletedCount.notify_one();
    };

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

  • alongname alongname 2年前
    static object locker = new object(); 
    var completedCount = 0;
    
    //...
    {
        //获取锁
        Monitor.Enter(locker);
        completedCount++;
    
        //释放锁
        Monitor.Exit(locker);
    }
    
    点赞 评论 复制链接分享