[cfe-dev] FW: [libc++] Porting libc++ to Windows
Fulvio Esposito
fulvio.esposito at live.it
Wed Aug 5 12:49:40 PDT 2015
Hi David, all. It’s been quite a hectic month and unfortunately I’ve been side-tracked to other matters, but at least I managed to refactor pthread usage in libcxx to support/pthread. My current work is held at https://github.com/espositofulvio/libcxx/tree/thread_os_abstract_layer. I’m planning to start from this branch (which should be up-to-date with the libcxx master branch) to implement the threading stuff for win32.I’m really interested in reviews from all of you guys. Here’s a description of what I’ve done. There are two new directories: include/support/pthread and src/support/pthread were the pthread code has been isolated. std::mutex and std::recursive_mutex have been moved to support under the __libcxx_support namespace and then un __mutex_base two using declaration makes them visible in the std::namespace (I’ve found this two good candidates as an abstraction layer as they are) std::thread and std::condition_variable now derive from their counterpart in the __libcxx_support. Part of the implementation can be shared across platforms as they are not dependent on platform specific things. __call_once has been moved to the __libcxx_support namespace as well as it’s implementation is platform dependent (not so call_once). Other classes like std::timed_mutex, std::recursive_times_mutex, std::condition_variable_any, etc. are implemented entirely in terms of the above classes, so they can stay the same. I’ve also done minor modification to algorithm.cpp and memory.cpp that were using pthread directly. I’ve run the test suite successfully on ArchLinux, building in-tree but using clang/llvm from the Arch repos (I’m using a VM as my laptop has Win10) without errors except a few warnings because I don’t have all the required locales installed. I’m downloading Visual Studio 2015 Community Edition and have possibly a bit of time before next Wednesday to start cracking on the windows implementation if anything of the above sounds good.Best regards,Fulvio From: David ChisnallSent: 02 July 2015 10:25To: Fulvio EspositoCc: Dan Albert;clang developer listSubject: Re: [cfe-dev] [libc++] Porting libc++ to Windows On 2 Jul 2015, at 10:19, Fulvio Esposito fulvio.esposito at live.it wrote: I like your idea and am willing to give it a try. In this case I think it would be more helpful to first define the thin wrapper around pthread and reimplement std:: stuff on top of that, and then to provide the Win32 implementation. How does it sound? Yes, that’s what I’d do: first factor out all of the pthread-using stuff into a support/pthread (or similar) file that exposes the pthread functionality via some generic name, and then implement the same with win32 threads. When you do the second part, don’t be afraid to go back and modify what the abstraction layer looks like if there are some idioms that are hard to support with win32 threads but easy with pthreads (or vice versa).You may end up finding that the abstraction layer really looks like the C++ standard library, in which case you may end up just having a using directive in the std namespace for the platform-specific implementation of some classes (mutex comes to mind - thread may have some implementation shared between platforms).Please feel free to sign me up as a reviewer,David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150805/df90862d/attachment.html>
More information about the cfe-dev
mailing list