[Fix] Reset internal callback after submission
authorDongju Chae <dongju.chae@samsung.com>
Mon, 18 Oct 2021 03:47:15 +0000 (12:47 +0900)
committer채동주/On-Device Lab(SR)/Staff Engineer/삼성전자 <dongju.chae@samsung.com>
Mon, 18 Oct 2021 06:38:05 +0000 (15:38 +0900)
This patch resets the internal callback for a blocking request
after its request sumission.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
src/core/ne-handler.cc

index aa1f7ba..f0a5ecd 100644 (file)
@@ -1427,6 +1427,7 @@ TrinityVision2::submitRequest (int req_id) {
       if (req->getCallback () != nullptr)
         logwarn (TAG, "Blocking call don't use user callback...\n");
 
+      /* set an internal callback temporally */
       req->setCallback (std::bind (&TrinityVision2::callback, this, req,
                                    (npuOutputNotify) callbackSync::callback,
                                    static_cast<void *> (&sync)));
@@ -1434,6 +1435,9 @@ TrinityVision2::submitRequest (int req_id) {
       status = scheduler_->submitRequest (req);
       if (status >= 0)
         sync.wait ();
+
+      /* remove the internal callback */
+      req->setCallback (nullptr);
     } break;
     case NPU_INFER_NON_BLOCKING:
       if (req->getCallback () == nullptr) {