[cfe-dev] libclang cancellation of long running tasks

John Sully john at csquare.ca
Tue Jan 13 11:40:21 PST 2015


Thanks for the help everyone.  I'll check back in a few days when I've had
a chance to prototype it.

One other question, does anybody know the rationale for libclang spawning
new threads to do the work on?  I plan to change this at least for my own
builds, but if its something that could be changed upstream that would be
much better.
Spawning a separate thread causes it to ignore the thread priority of the
thread making the original call.  It also has non-trivial overhead.

On Tue, Jan 13, 2015 at 6:16 AM, Jonathan Roelofs <jonathan at codesourcery.com
> wrote:

>
>
> On 1/12/15 7:34 PM, John Sully wrote:
>
>> Hi Jonathan,
>>
>> I don't understand how std::future::wait_for would allow me to cancel a
>> running libclang operation.
>>
>> 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.
>>
>
> Sorry, for some reason I thought std::future had a way to kill the task.
> The idea was to loop on the future's wait_for, giving it some small
> interval, then to kill the future if the result is no longer needed.
>
> Jon
>
>
> --
> Jon Roelofs
> jonathan at codesourcery.com
> CodeSourcery / Mentor Embedded
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150113/07090487/attachment.html>


More information about the cfe-dev mailing list