On Wed, Mar 3, 2021 at 2:00 PM Florian Weimer <f...@deneb.enyo.de> wrote:
>
> Do I have to tell the runtime that a system call is blocking?  For
> example, I use this code snippet to perform a blocking ioctl:
>
>         conn, err := file.SyscallConn()
>         if err != nil {
>                 return
>         }
>         err1 := conn.Control(func(fd uintptr) {
>                 _, _, err2 := syscall.Syscall(syscall.SYS_IOCTL,
>                         fd, uintptr(req), 0)
>                 if err2 != 0 {
>                         err = err2
>                 }
>
>         })
>
> And the syscall can block until some hardware timeout occurs.  The
> file descriptor has already been transitioned to blocking mode using
> file.FD().  Is there anything else left to do, so that the runtime
> knows it may have to spawn a new worker thread or something like that?

You do not have to tell the runtime anything special.  This kind of
code will work as is.

You may want to consider using the golang.org/x/sys/unix package and
functions like IoctlGetInt, but the above should also work.

Ian

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcXyuHv%2BxGrbTjR1NE7rwG4t%3D0AaPWLK4ZEiGeJxj%2BjF8w%40mail.gmail.com.

Reply via email to