chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] readline blocks threads


From: Shawn Rutledge
Subject: Re: [Chicken-users] readline blocks threads
Date: Wed, 5 Mar 2008 23:50:38 -0700

On Tue, Mar 4, 2008 at 4:22 PM, Graham Fawcett <address@hidden> wrote:
>  Just curious, does the nbstdin egg help at all? I know it helps when
>  I'm running a REPL inside a Web app.

Thanks for the suggestion.  The relevant part of that seems to be this:

  int val = fcntl(fd, F_GETFL, 0);
  if(val == -1) return(0);
  return(fcntl(fd, F_SETFL, val | O_NONBLOCK) != -1);

so I tried doing that myself:

int ufd, sfd;
dbus_connection_get_unix_fd(conn, &ufd);
dbus_connection_get_socket(conn, &sfd);
printf(\"unix FD %d, socket %d\\n\", ufd, sfd);
int val = fcntl(sfd, F_GETFL, 0);
printf(\"existing flags: 0x%X\\n\", val);
if(val != -1)
        printf(\"fctntl returns %d\\n\",
              fcntl(sfd, F_SETFL, val | O_NONBLOCK));

out of which I see

unix FD 4, socket 4
existing flags: 0x802
fctntl returns 0

so according to the existing flags gotten from F_GETFL, it's already a
non-blocking fd.  lsof gives me this

csi       15457 rutledge    4u  unix 0xd935e860            292124 socket

So they're using Unix sockets.  It's already non-blocking, so F_SETFL
doesn't change the behavior.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]