www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - select, poll, epoll from D

reply Russel Winder <russel winder.org.uk> writes:
Hi,

Has anyone got any examples of using (select|poll|epoll) directly from
D. Yes I can work it out from first principles, but it would be great
to see what others have done in the past so as to make use of their
work.

--=20
Russel.
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Dr Russel Winder      t: +44 20 7585 2200
41 Buckmaster Road    m: +44 7770 465 077
London SW11 1EN, UK   w: www.russel.org.uk
Feb 02 2018
next sibling parent reply Seb <seb wilzba.ch> writes:
On Friday, 2 February 2018 at 18:00:45 UTC, Russel Winder wrote:
 Hi,

 Has anyone got any examples of using (select|poll|epoll) 
 directly from D. Yes I can work it out from first principles, 
 but it would be great to see what others have done in the past 
 so as to make use of their work.
Do you know about vibe.d's eventcore? https://github.com/vibe-d/eventcore
Feb 02 2018
parent Russel Winder <russel winder.org.uk> writes:
On Fri, 2018-02-02 at 18:02 +0000, Seb via Digitalmars-d-learn wrote:
 On Friday, 2 February 2018 at 18:00:45 UTC, Russel Winder wrote:
 Hi,
=20
 Has anyone got any examples of using (select|poll|epoll)=20
 directly from D. Yes I can work it out from first principles,=20
 but it would be great to see what others have done in the past=20
 so as to make use of their work.
=20 Do you know about vibe.d's eventcore? =20 https://github.com/vibe-d/eventcore
No. I looked at dlang-libevent (which is packaged on Debian) and dlang- libev (which is not packaged for Debian) and realised I don't need another full on event loop in this application. I really do just need a seemingly infinite loop alternately testing one fd for readability with a timeout and then a receiveTimeout on the input channel of the thread. To do anything else is to have too much infrastructure doing nothing. The problem is going to be that DInotify isn't going to let me get at the file descripter to sue with select, poll, or epoll. --=20 Russel. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Dr Russel Winder t: +44 20 7585 2200 41 Buckmaster Road m: +44 7770 465 077 London SW11 1EN, UK w: www.russel.org.uk
Feb 02 2018
prev sibling parent reply Adam D. Ruppe <destructionator gmail.com> writes:
On Friday, 2 February 2018 at 18:00:45 UTC, Russel Winder wrote:
 Has anyone got any examples of using (select|poll|epoll) 
 directly from D. Yes I can work it out from first principles, 
 but it would be great to see what others have done in the past 
 so as to make use of their work.
I don't have a simplified example but I did use it in my simpledisplay.d https://github.com/adamdruppe/arsd/blob/master/simpledisplay.d#L2526 and my really bad eventloop.d https://github.com/adamdruppe/arsd/blob/master/eventloop.d#L540 it is basically the same as you'd use it in C.
Feb 02 2018
parent reply Russel Winder <russel winder.org.uk> writes:
On Fri, 2018-02-02 at 18:03 +0000, Adam D. Ruppe via Digitalmars-d-
learn wrote:
 On Friday, 2 February 2018 at 18:00:45 UTC, Russel Winder wrote:
 Has anyone got any examples of using (select|poll|epoll)=20
 directly from D. Yes I can work it out from first principles,=20
 but it would be great to see what others have done in the past=20
 so as to make use of their work.
=20 I don't have a simplified example but I did use it in my=20 simpledisplay.d =20 https://github.com/adamdruppe/arsd/blob/master/simpledisplay.d#L2526 =20 and my really bad eventloop.d =20 https://github.com/adamdruppe/arsd/blob/master/eventloop.d#L540 =20 =20 it is basically the same as you'd use it in C.
The online documentation doesn't seem to acknowledge the existence of core.sys package! So how to find core.sys.linux.epoll? --=20 Russel. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Dr Russel Winder t: +44 20 7585 2200 41 Buckmaster Road m: +44 7770 465 077 London SW11 1EN, UK w: www.russel.org.uk
Feb 02 2018
parent Adam D. Ruppe <destructionator gmail.com> writes:
On Friday, 2 February 2018 at 19:30:32 UTC, Russel Winder wrote:
 The online documentation doesn't seem to acknowledge the 
 existence of core.sys package! So how to find 
 core.sys.linux.epoll?
The core.sys stuff just includes operating system headers. But I think I grepped it. My documentation site lists the names too http://dpldocs.info/experimental-docs/core.sys.linux.epoll.html though it doesn't show the actual functions (since they lack doc comments in the original D source), they are the same as C, so the man page link in that page will show you a bit more. You might want to browse the site there to see a bit more, there's some nice stuff hidden in the core namespace the main site doesn't mention (yikes).
Feb 02 2018