Re: [go-nuts] Cgo: using syscall.Select

2018-05-17 Thread Ian Lance Taylor
On Thu, May 17, 2018 at 9:56 AM, Juliusz Chroboczek wrote: >> If you do this in Go, you should use golang.org/x/sys/unix package >> rather than the syscall package. > > What's the advantage? (In this particular case, not in general.) The advantage in this particular case is likely minimal. The

Re: [go-nuts] Cgo: using syscall.Select

2018-05-17 Thread Juliusz Chroboczek
> If you do this in Go, you should use golang.org/x/sys/unix package > rather than the syscall package. What's the advantage? (In this particular case, not in general.) > But since you have to call C anyhow, I would suggest just doing it in C. Yeah, I guess it's simpler. > There isn't any way

Re: [go-nuts] Cgo: using syscall.Select

2018-05-16 Thread Ian Lance Taylor
On Wed, May 16, 2018 at 8:07 PM, Juliusz Chroboczek wrote: > > I'm interfacing with a C library that expects to do its own I/O, but > wants to be called after a file descriptor is ready for read. My code > currently looks roughly like this: > > var fdset syscall.FdSet > var bits = unsafe.

[go-nuts] Cgo: using syscall.Select

2018-05-16 Thread Juliusz Chroboczek
I'm interfacing with a C library that expects to do its own I/O, but wants to be called after a file descriptor is ready for read. My code currently looks roughly like this: var fdset syscall.FdSet var bits = unsafe.Sizeof(fdset.Bits[0]) * 8 fdset.Bits[uintptr(fd)/bits] |= (1 << (fd %