[cmake-developers] kwsysProcess threadsafety

clinton at elemtech.com clinton at elemtech.com
Fri Jan 5 15:00:30 EST 2018


Cool.  I'd like to have parallel automoc and uic.

How about this 4th option?
Don't use threads.  A single thread is able to spawn multiple processes, and wait on multiple processes, and react when 1 or more processes change state.  I'm probably not familiar enough with kwsysProcess to know if this approach will work, but it might be easier and simpler(?) than making it thread safe.

Clint

----- On Jan 5, 2018, at 12:34 PM, Sebastian Holtermann seblist at xwmw.org wrote:

> Hello!
> 
> As you might have noticed I tried to parallelize AUTOMOC/UIC.
> https://gitlab.kitware.com/cmake/cmake/merge_requests/1632
> The issue that's blocking it now is that the kwsysProcess framework
> isn't thread safe. As a consequence it is not possible for threads to
> start processes concurrently using the kwsysProcess framework.
> 
> There are three options I see
> 
> 1) Make kwsysProcess thread safe
> 
> I don't think it's impossible but it's not a small task.
> Looking through the code I found a few issues that
> would block the whole idea for me.
>  - OpenVMS: I have little to no knowledge about OpenVMS.
>    Wikipedia says it is basically abandoned.
>    Can the OpenVMS code be removed? I couldn't test it anyway.
> 
>  - C vs. C++
>    There's a lot of C in processUNIX.c (list allocation etc.).
>    I would prefer to use C++11 (or higher), especially
>    std::array, std::vector, std::thread,  std::mutex, etc..
>    Is C++11 acceptable in kwsysProcess?
>    This would make processUNIX.c processUNIX.cpp?
> 
> 2) Use libuv instead
> 
> Using the libuv event loop is overkill and would probably imply that
> more threads are started than necessary
> (the libuv thread pool will be started anyway).
> But it would allow to start multiple concurrent  (moc/uic) processes.
> Is there a reason to not use libuv?
> 
> 3) Abandon the idea to parallelize AUTOMOC/UIC
> 
> Well, I liked the idea.
> 
> 
> Any thoughts?
> 
> -Sebastian
> 
> --
> 
> Powered by www.kitware.com
> 
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
> 
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
> 
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
> 
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> 
> Follow this link to subscribe/unsubscribe:
> https://cmake.org/mailman/listinfo/cmake-developers


More information about the cmake-developers mailing list