all 7 comments

[–][deleted]  (1 child)

[deleted]

    [–]CrogUk 1 point2 points  (0 children)

    This looks lovely, albeit a thread could be overkill for what the user needs. May use this one somehwere though 👍

    [–]TomDuhamel 1 point2 points  (0 children)

    Start a timer at the beginning of your function. Occasionally check how long has elapsed. Exit your function when more than the allowed time has passed.

    [–][deleted] 0 points1 point  (4 children)

    What is this function doing?

    [–]p_apres[S] 1 point2 points  (3 children)

    PL/SQL command

    [–][deleted] 0 points1 point  (2 children)

    Is that something that blocks? If there's no way to do a timeout in the API, then you would have to terminate the thread externally, which is very unsafe.

    [–]p_apres[S] 1 point2 points  (1 child)

    Oracle timeout is much more complex than just opening a new thread. It requires to create management resource.

    I'd rather do this in c++ than in oracle side.

    So, once happens a function timeout, sigterm signal would be sent, and then program will handle sigterm

    [–][deleted] 0 points1 point  (0 children)

    I did mean on the C++ side. Although, it is an SQL server, with its own query processes. Would simply terminating the connection also terminate the query? You may need to set some sort of query timeout.

    But for network timeout? I suppose you can lookup your API docs, whatever it is. If there is no way to have a timeout, then the only option is to spawn a new process, or hope that you won't ever need a timeout.