socketpair

2015-12-30 Thread sanjayss via Digitalmars-d-learn
std.socket supports the socketpair() function, but it seems like this api is not really usable in any of the concurrency primitives supported by D. So what is the purpose of the socketpair() support? Basically I am trying to create two threads and am trying to use socketpair() to create two

Re: socketpair

2015-12-30 Thread Rikki Cattermole via Digitalmars-d-learn
On 31/12/15 3:22 PM, sanjayss wrote: std.socket supports the socketpair() function, but it seems like this api is not really usable in any of the concurrency primitives supported by D. So what is the purpose of the socketpair() support? Basically I am trying to create two threads and am trying

Re: socketpair

2015-12-30 Thread sanjayss via Digitalmars-d-learn
On Thursday, 31 December 2015 at 02:26:23 UTC, Rikki Cattermole wrote: On 31/12/15 3:22 PM, sanjayss wrote: std.socket supports the socketpair() function, but it seems like this api is not really usable in any of the concurrency primitives supported by D. So what is the purpose of the

Re: socketpair

2015-12-30 Thread sanjayss via Digitalmars-d-learn
(and in C socketpair is one way you would achieve this using one thread to listen for keypresses -- see http://stackoverflow.com/questions/11461106/socketpair-in-c-unix). How do you suggest I achieve this in D? OK; one way I realized was to put the network socket select in one thread an

Re: socketpair

2015-12-30 Thread Vladimir Panteleev via Digitalmars-d-learn
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

Re: socketpair

2015-12-31 Thread sanjayss via Digitalmars-d-learn
ample, 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...