<div dir="ltr"><div>Hi Jonathan,<br><br>I don't understand how std::future::wait_for 
would allow me to cancel a running libclang operation.<br><br></div>I'm not asking how to do this asynchronously - I 
already have that working.  I need a way to stop performing work when 
the results become obsolete. I could always 
shutdown the thread its on but that would leave things in an undefined 
state.<br><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 12, 2015 at 6:04 PM, Jonathan Roelofs <span dir="ltr"><<a href="mailto:jonathan@codesourcery.com" target="_blank">jonathan@codesourcery.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">John,<br>
<br>
It should be fairly straightforward for you to implement this behavior in your application using std::future::wait_for.<br>
<br>
<br>
Jon<span class=""><br>
<br>
On 1/12/15 6:33 PM, John Sully wrote:<br>
</span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
Yes it already runs on a separate thread; however when its known the<br>
result is no longer necessary (for example the user changed the cursor<br>
location - negating the need for autocomplete at the previous location)<br>
the separate thread still runs consuming resources.<br>
<br>
On slower devices like laptops these operations can take a long time.<br>
Even if we are willing to accept the waste of cycles (and battery<br>
life!), the processor has a limited number of cores and responsiveness<br>
will be poor if too many "zombie" jobs are still running.<br>
<br>
I'm willing to add this functionality and submit it upstream if<br>
necessary, but prior to doing so I wanted to reach out to current<br>
developers.  It would be unfortunate to invest significant effort only<br>
to find my patch can't be accepted for an avoidable reason.<br>
<br>
<br>
On Mon, Jan 12, 2015 at 4:09 PM, Sean Silva <<a href="mailto:chisophugis@gmail.com" target="_blank">chisophugis@gmail.com</a><br></span><span class="">
<mailto:<a href="mailto:chisophugis@gmail.com" target="_blank">chisophugis@gmail.com</a>><u></u>> wrote:<br>
<br>
    Have you tried running libclang on a separate thread?<br>
<br>
    On Sun, Jan 11, 2015 at 7:59 PM, John Sully <<a href="mailto:john@csquare.ca" target="_blank">john@csquare.ca</a><br></span><span class="">
    <mailto:<a href="mailto:john@csquare.ca" target="_blank">john@csquare.ca</a>>> wrote:<br>
<br>
        I'm in the process of writing an editor based upon libclang, and<br>
        a major issue I'm hitting is the inability to cancel long<br>
        running tasks.  The primary tasks are parsing and creation of<br>
        auto-complete results.<br>
<br>
        Is there already functionality to do this that I've missed?<br>
<br>
        If not, I would like to implement this as its a requirement to<br>
        get good responsiveness out of my editor.  Has there been any<br>
        prior discussions on how this should be implemented?<br>
<br>
        ______________________________<u></u>_________________<br>
        cfe-dev mailing list<br></span>
        <a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a> <mailto:<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a>><br>
        <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/cfe-dev</a><span class=""><br>
<br>
<br>
<br>
<br>
<br>
______________________________<u></u>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/cfe-dev</a><br>
<br>
</span></blockquote><span class="HOEnZb"><font color="#888888">
<br>
-- <br>
Jon Roelofs<br>
<a href="mailto:jonathan@codesourcery.com" target="_blank">jonathan@codesourcery.com</a><br>
CodeSourcery / Mentor Embedded<br>
</font></span></blockquote></div><br></div>