[libdispatch-dev] Fully functional libdispatch port for Windows and Linux

Marius Zwicker marius at mlba-team.de
Fri Feb 11 10:56:40 PST 2011


Wow, thanks to Kevin and Davez for your quick reply.

I am fully aware of the fact that the original implementation of 
libdispatch outperforms mine in many ways. Unfortunately I somehow 
missed the open accessable subversion repository when getting in contact 
with the libdispatch sources for the first time (Actually I found a 
gzipped file only at that time whereas it seems to have vanished right 
now). Thus I did not realize your efforts concerning linux and windows 
at that time. That's where my decision to start from scratch came from.

I'd be happy to contribute to the primary sources in form of patches. 
First thing to talk about certainly is the support for C++0x lambdas and 
my Qt interface. Whereas the Qt interface certainly should be kept 
independently from the rest I consider the C++0x support very important. 
My goal is to be able to use Microsofts compilers as well which 
certainly will never get clang's block support.

As far as I can see the Win32 support is using automake, thus it is 
using cygwin or mingw. As soon as I have some sparetime (unfortunately I 
did not do the port just for fun) I will try to build the primary 
sources and develop some patches. Concerning the MS support, I will try 
to develop some CMake files for that if you don't mind.

Concerning Davez' annotations I assume that they concern my C++ API 
only. My main intend was to integrate the Qt Main Event loop with the 
dispatch main queue, quite similar to the way you guys did in Cocoa. 
Some of the getter methods (such as the mentioned isSuspended()) were 
obviously introduced without much thinking as they do not reflect the 
balanced need of release and suspend calls you describe within your api 
documentation. I will omit them as soon as possible. Concerning type() I 
will have a look at ways to avoid this.

Thanks a lot for your comments and have a nice weekend.

Marius

Am 11.02.2011 19:24, schrieb Kevin Van Vechten:
> Hi Marius,
>
> It's great that you have enough interest in the libdispatch project to work on a port to Linux and Win32. If you weren't aware, we already have Linux and partial Win32 support in the primary libdispatch source repository. I would encourage you to contribute modifications to the primary project rather than attempt a complete rewrite.
>
> I reviewed some of the sources of "libxdispatch" and I can see that this does approximate the libdisptach API at a high level, but it's important to keep in mind some of the aspects of the libdispatch implementation that set it apart — specifically thread safety and wait-free algorithms — which allow it to scale well with large numbers of cores and heavy load. I noted several places in the libxdispatch/core/queue.c implementation where thread safety was questionable and other cases where simple spin locks (waiting) were in use.
>
> I'd be happy to answer any specific questions you may have about the libdispatch implementation or scalability goals.
>
> Kevin
>
> On Feb 11, 2011, at 10:06 AM, Marius Zwicker wrote:
>
>> Hi everyone,
>>
>> I'm glad to announce that I finished a port of libdispatch to Linux and Windows during the last days. Except the source interfaces (which differ too much between Windows and Linux) the API should be fully operational. The majority of your original tests is passing - some of them still need to be ported to build and run on all platforms. As I did not manage to understand your code completely, I did a complete rewrite and merely reused your api and general ideas.
>>
>> For achieving "blocks support" on the majority of the used compilers I added lambda support from the upcoming C++0x standard.
>>
>> Additionally I implemented (for those who need and use it) an interface to integrate libdispatch into applications developed using the Qt framework.
>>
>> As my port is a bit more than a patch, I named it libxdispatch and it is currently available by going to http://opensource.mlba-team.de/xdispatch - I'm really curious about your comments.
>>
>> Regards,
>>
>> Marius Zwicker



More information about the libdispatch-dev mailing list