socketpair

sanjayss via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Dec 31 23:51:11 PST 2015


On Thursday, 31 December 2015 at 07:48:03 UTC, Vladimir Panteleev 
wrote:
> On Thursday, 31 December 2015 at 02:37:07 UTC, sanjayss wrote:
>> OK; one way I realized was to put the network socket select in 
>> one thread and the watching for keypress in another thread and 
>> then use the concurrency primitives to message pass events to 
>> the main thread -- may be a little expensive, but it probably 
>> will achieve the effect I desire.
>
> Here is my implementation of this idea:
>
> https://github.com/CyberShadow/ae/blob/master/net/sync.d

Thanks, Vladimir...though I didn't fully understand your code 
example, it gave me the idea to use delegates to capture one of 
the socketpair sockets for use in a thread where I could write to 
it and read the other socket to read from in the main task. Just 
beginning to use D and am getting used to the various features...


More information about the Digitalmars-d-learn mailing list