cland and multi-threading

Hi All,

I have another question, which I couldn't readily find the answer for.

Given a single CXIndex, is it possible to run two (or more) parses using the
clang API in parallel? That is, could I create two threads and have two
clang_parseTranslationUnit() calls running in different threads, using
different translation units, concurrently?

Thanks,

I have another question, which I couldn't readily find the answer for.

Given a single CXIndex, is it possible to run two (or more) parses
using the clang API in parallel? That is, could I create two threads
and have two
clang_parseTranslationUnit() calls running in different threads, using
different translation units, concurrently?

...and just to clarify, I create the threads externally, I don't expect the
clang C API to create them...

Yes. Just don't access the same CXTranslation unit in two different threads concurrently.

  - Doug

Hi Doug,

> I have another question, which I couldn't readily find the answer
for.
>
> Given a single CXIndex, is it possible to run two (or more) parses
> using the clang API in parallel? That is, could I create two threads
> and have two
> clang_parseTranslationUnit() calls running in different threads,
using
> different translation units, concurrently?

Yes. Just don't access the same CXTranslation unit in two different
threads concurrently.

I twigged this one by looking at the implementation of part of the API
implementation. :slight_smile:

Thanks for the help,

-- Paul.