What language? C# has async support, for example.

In general it's not recommended to do any cross machine/network calls in the UI 
thread, not only with Thrift.

Have fun,
Jens
________________________________
Von: Alex Shtof
Gesendet: 01.09.2013 14:48
An: [email protected]
Betreff: RE: Cancellation of a blocking read operation

I am more concerned about client-side cancellation. For example, I would like 
to be able to hit "Cancel" in the UI of my application and all communications 
with the server will cease. I believe I am not the first to encounter the need 
to cancel thrift-based communications. Is there any other solution you might 
think of? I haven't seen any support for cancellation thrift/async headers 
either.

Alex.

-----Original Message-----
From: Ben Craig [mailto:[email protected]]
Sent: Thursday, August 29, 2013 5:09 PM
To: [email protected]
Subject: Re: Cancellation of a blocking read operation

There is not a safe, portable way to do that as far as I know.

One common way that this is mitigated is by using a framed transport. Most 
transports just send data as soon as it is available.  The framed transport 
puts the size of a message as the first four bytes.

On the server side, the framed transport is used by TNonBlockingServer to set 
up a state machine, such that you can call interrupt() on the server to tear 
things down.

There is a good reason that Thrift doesn't support cancellation of individual 
transport.  The typical way to implement cancellation is to change every 
"read()" call into both a "select()" and a "read()".  This double the number of 
system calls that need to be made, and does horrible things to performance.



From:   Alex Shtof <[email protected]>
To:     "[email protected]" <[email protected]>,
Date:   08/29/2013 02:39 AM
Subject:        Cancellation of a blocking read operation



Hi all.
I would like to ask for your help with cancellation of a blocking read 
operation that is in progress. The read operation (for example –
TProtocol::readByte) is blocked until the data is received. When I close the 
transport from another thread, I get a failed assertion about a null pointer.

Is there any other way to cancel a blocked read operation?

Alex.

This email and any files transmitted with it are confidential and contain 
proprietary information belonging to VisionMap Ltd. VisionMap Ltd. asserts in 
respect of this email and any files transmitted with it all rights for 
confidentiality and proprietary interests to the fullest extent permitted by 
law. If you are not the intended recipient you are notified that disclosing, 
copying, distributing or taking any action in reliance on the contents of this 
information is strictly prohibited. Thank you.



This email and any files transmitted with it are confidential and contain 
proprietary information belonging to VisionMap Ltd. VisionMap Ltd. asserts in 
respect of this email and any files transmitted with it all rights for 
confidentiality and proprietary interests to the fullest extent permitted by 
law. If you are not the intended recipient you are notified that disclosing, 
copying, distributing or taking any action in reliance on the contents of this 
information is strictly prohibited. Thank you.

Reply via email to