Interrupting an unknown long-running function after a certain time period

petranaya

I am using an OpenCV function in a compiled library on Android. It regularly runs for more than 10 seconds until it fails. A success will take approximately 2 seconds. I want to be able to interrupt the function if it takes more than 2 seconds.

At first, I tried using a thread and interrupting it after 2 seconds, but I realized after awhile that the function itself has to cooperate with the interrupt in order for it to work.

Is there any way to do this without modifying the OpenCV code itself and recompiling the libraries? Can I run this function on another process or service and interrupt it there?

Evgeniy Dorofeev

If a running code is not designed to react to attempts to interrupt it, then we can do nothing about it. As a workaround we can run it in a separate process and cancel it with Process.destroy()

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

Swift iOS- How to hide label then make it appear after a certain time period

分類Dev

Monitors "sleep" after no external input for a period of time

分類Dev

Function not waiting for intended period of time - Python Selenium

分類Dev

How to record network throughput per port for long period of time

分類Dev

Why is MATLAB job taking a long time running?

分類Dev

Fiware Orion Context Broker-Send notifications after a period of time

分類Dev

SQL Query taking long time with STUFF function

分類Dev

Is keeping a lock on a record for a long period of time common practice with modern database systems?

分類Dev

git-remote-http.exe is running for a long time

分類Dev

Understanding ps elapsed time format for long running processes

分類Dev

running function after res.send

分類Dev

after using parenthesis () my function not running?

分類Dev

Check if Time Period Overlaps

分類Dev

iOS takes long time to update view after HTTP request?

分類Dev

Shutdown after certain time since start-up

分類Dev

Canvas .fillText function not working after the first time

分類Dev

Javascript execute a function after some time elapse

分類Dev

real-time search in terminal output stream; after running a command

分類Dev

R time series period subtract?

分類Dev

How come matlab run slower and slower when running a program that takes long time to execute?

分類Dev

Kafka Offset after retention period

分類Dev

How to train model with remaining epochs after long running session has ended in Google Colaboratory.?

分類Dev

How can i set custom retry_after for long running jobs | laravel

分類Dev

How can I create a BackGround service that runs a function every given period of time ? Using C# (asp.net core 3.1.1)

分類Dev

React doesn't update DOM during `render` when there is a long running function in `componentDidUpdate`

分類Dev

mysql long time query

分類Dev

Android canceling timeout function after time has started

分類Dev

Convert frequency to java.time.Period type

分類Dev

Laravel - caching external data in a model for a period of time

Related 関連記事

  1. 1

    Swift iOS- How to hide label then make it appear after a certain time period

  2. 2

    Monitors "sleep" after no external input for a period of time

  3. 3

    Function not waiting for intended period of time - Python Selenium

  4. 4

    How to record network throughput per port for long period of time

  5. 5

    Why is MATLAB job taking a long time running?

  6. 6

    Fiware Orion Context Broker-Send notifications after a period of time

  7. 7

    SQL Query taking long time with STUFF function

  8. 8

    Is keeping a lock on a record for a long period of time common practice with modern database systems?

  9. 9

    git-remote-http.exe is running for a long time

  10. 10

    Understanding ps elapsed time format for long running processes

  11. 11

    running function after res.send

  12. 12

    after using parenthesis () my function not running?

  13. 13

    Check if Time Period Overlaps

  14. 14

    iOS takes long time to update view after HTTP request?

  15. 15

    Shutdown after certain time since start-up

  16. 16

    Canvas .fillText function not working after the first time

  17. 17

    Javascript execute a function after some time elapse

  18. 18

    real-time search in terminal output stream; after running a command

  19. 19

    R time series period subtract?

  20. 20

    How come matlab run slower and slower when running a program that takes long time to execute?

  21. 21

    Kafka Offset after retention period

  22. 22

    How to train model with remaining epochs after long running session has ended in Google Colaboratory.?

  23. 23

    How can i set custom retry_after for long running jobs | laravel

  24. 24

    How can I create a BackGround service that runs a function every given period of time ? Using C# (asp.net core 3.1.1)

  25. 25

    React doesn't update DOM during `render` when there is a long running function in `componentDidUpdate`

  26. 26

    mysql long time query

  27. 27

    Android canceling timeout function after time has started

  28. 28

    Convert frequency to java.time.Period type

  29. 29

    Laravel - caching external data in a model for a period of time

ホットタグ

アーカイブ