Sync call with timeout
-
Hi all,
I new to Qt and I'm facing a problem that I'm sure it is very simple for you dear experts.
I want to obtain a synch call for a method that perform an async operation.
I used mutex to serialize the call to the method and want the sync call to return either when the operation has been terminated or when a timeout expired. For the timeout control I'm using QTimer.I tried many solution, with different threads combination but I always get blocked for one of the following reasones:
- The Qtimer thread affinity is not respected
- The Qtimer's timeout is not delivered since it seems that the event loop is blocked due to different mutexed call.
I have no code to provide in this instant but if it is needed I can redo one of my attemps and copy here. My belief, anyway is that it is not a matter of code, I need to understand how Qt works under the hood first. Am I rx?
Could you please help me to understand how to architecture the solution in the correct way?
Thanks in advance
Best Regards -
Hi all,
I new to Qt and I'm facing a problem that I'm sure it is very simple for you dear experts.
I want to obtain a synch call for a method that perform an async operation.
I used mutex to serialize the call to the method and want the sync call to return either when the operation has been terminated or when a timeout expired. For the timeout control I'm using QTimer.I tried many solution, with different threads combination but I always get blocked for one of the following reasones:
- The Qtimer thread affinity is not respected
- The Qtimer's timeout is not delivered since it seems that the event loop is blocked due to different mutexed call.
I have no code to provide in this instant but if it is needed I can redo one of my attemps and copy here. My belief, anyway is that it is not a matter of code, I need to understand how Qt works under the hood first. Am I rx?
Could you please help me to understand how to architecture the solution in the correct way?
Thanks in advance
Best Regards@The-Kid-77 said in Sync call with timeout:
with different threads
Why threads? You want to make an assync function block, right?
How do you know the assync operation has finished? Is there a callback or signal?