From 8c6d1642f5fbf1d55edb324e35e9fa6e89da25a1 Mon Sep 17 00:00:00 2001
From: Xuning Tan <me@xuning.eu.org>
Date: 星期三, 01 十月 2025 14:45:45 +0800
Subject: [PATCH] fix: correct the deepspeed_config path reference in the finetuning script (#2680)

---
 runtime/http/bin/asr_sessions.h |   36 +++++++++++++++++++++++++++++++++++-
 1 files changed, 35 insertions(+), 1 deletions(-)

diff --git a/runtime/http/bin/asr_sessions.h b/runtime/http/bin/asr_sessions.h
index 0e1c54d..cbbf9c1 100644
--- a/runtime/http/bin/asr_sessions.h
+++ b/runtime/http/bin/asr_sessions.h
@@ -2,13 +2,41 @@
  * Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights
  * Reserved. MIT License  (https://opensource.org/licenses/MIT)
  */
-/* 2023-2024 by zhaomingwork@qq.com */
+/* 2023-2025 by zhaomingwork@qq.com */
 // FUNASR_MESSAGE define the needed message between funasr engine and http server
 #ifndef HTTP_SERVER2_SESSIONS_HPP
 #define HTTP_SERVER2_SESSIONS_HPP
 #include "funasrruntime.h"
 #include "nlohmann/json.hpp"
+#include <iostream>
+#include <thread>
 #include <atomic>
+#include <mutex>
+#include <condition_variable>
+
+class Semaphore {
+public:
+    explicit Semaphore(int count = 0) : count_(count) {}
+
+    
+    void acquire() {
+        std::unique_lock<std::mutex> lock(mutex_);
+        cv_.wait(lock, [this]() { return count_ > 0; });
+        --count_;
+    }
+
+ 
+    void release() {
+        std::lock_guard<std::mutex> lock(mutex_);
+        ++count_;
+        cv_.notify_one();
+    }
+
+private:
+    int count_;
+    std::mutex mutex_;
+    std::condition_variable cv_;
+};
 typedef struct {
   nlohmann::json msg;
   std::shared_ptr<std::vector<char>> samples;
@@ -16,5 +44,11 @@
  
   FUNASR_DEC_HANDLE decoder_handle=nullptr;
   std::atomic<int> status;
+  //std::counting_semaphore<3> sem(0);
+  Semaphore sem_resultok; 
 } FUNASR_MESSAGE;
+
+
+
+
 #endif // HTTP_SERVER2_REQUEST_PARSER_HPP
\ No newline at end of file

--
Gitblit v1.9.1