On Dec 8, 2011, at 6:00 AM, Manu wrote:
> 
> Quite seriously. I'm trying to work out how D's threading/thread safety 
> architecture can help me here.. Also since there's no collections, I'm using 
> the associative arrays. How do I manage thread safety when accessing those? 
> Is there a generic lock mechanism that I've missed along the way without 
> manually creating semaphores? Networking does seem to be pretty bare, I'm 
> basically writing C sockets code.

That's really the issue more than threading.  Socket programming support is 
rather weak in Phobos so any serious network programming falls back on C API 
calls.  And typically you'll se some async IO method and not much in the way of 
threading.  I've thought about integrating socket IO with the messaging system 
in std.concurrency, but there are issues with supporting both Windows 
(IOCP/proactor) and non-Windows (poll/reactor) systems as invisibly as 
possible.  There are also weird issues that arise when ownership of sockets is 
passed between threads, which you'll find mention of if you look into socket 
programming in Erlang.  Longer term what I'd like is to have a standalone 
networking API (std.net or whatever) plus a shim to integrate it with the 
messaging API for people who want this level of simplicity, but it's not 
something I'd want to force on people.

Reply via email to