Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Terminate processing Callback
#1
Is there anyway to terminate a processing Callback(or async event) on a TIWAppForm? My callback function takes a long time to finish, I can't navigate to other page when the callback is still running.
the below sample simulate that I can't leave the page until Callback is done processing.

.zip   IWTerminateCallback.zip (Size: 8.19 KB / Downloads: 3)

Intraweb version: 15.4
Delphi version: 11.3

Thanks
Reply
#2
You can, if you spawn a thread and let it handle the slow task.

In your example, you can't basically because the session is locked responding to that request that takes a long time to return. Remember that althought the server can handle mulitiple requests at the same time from different sessions, it needs to finish one request from one session before working on another request from the same session. This is the only way to keep the coherency of the session (i.e. 2 different conflicting actions won't interefere with each other).

So, the option is to run the process within a thread and let the server respond to the request. The issue that you will have with this approach is that later you will need to check the server for the completion of the request.

If you give me more details about your requirements we can expand it a bit more
Reply
#3
(10-16-2023, 11:22 PM)Alexandre Machado Wrote: You can, if you spawn a thread and let it handle the slow task.

In your example, you can't basically because the session is locked responding to that request that takes a long time to return. Remember that althought the server can handle mulitiple requests at the same time from different sessions, it needs to finish one request from one session before working on another request from the same session. This is the only way to keep the coherency of the session (i.e. 2 different conflicting actions won't interefere with each other).

So, the option is to run the process within a thread and let the server respond to the request. The issue that you will have with this approach is that later you will need to check the server for the completion of the request.

If you give me more details about your requirements we can expand it a bit more

Oh, thank you for your reply. I see, currently I got code that doesn't work properly in thread, so will think of workaround for now.
Reply
#4
What exactly do you want to accomplish (if you don't mind sharing) and why your code doesn't work in threads? Consider that whatever your code is doing it should - at least - work well inside the thread that IW creates to execute it...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)