chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] All threads are blocking by I/O


From: Pedro Melendez
Subject: Re: [Chicken-users] All threads are blocking by I/O
Date: Wed, 25 Sep 2013 05:21:57 -0700

Hi Peter!

Thank you so much for your response!

I don't understand then what I am doing wrong, this is what I have so
far:

https://github.com/pmelendez/scheme-test-server/blob/master/mini-tcp-server.scm

Please notice that the code is dirty because it is a work in progress
and I am kinda stuck.

One detail I forgot to mention is that I am testing this on windows.
Now after your explanation... Is it possible that the behavior is
platform-specific?

Thanks again for the help!

Cheers,

Pedro

Sent from my Windows Phone From: Peter Bex
Sent: 2013-09-25 7:50 AM
To: Pedro Melendez
Cc: chicken-users
Subject: Re: [Chicken-users] All threads are blocking by I/O
On Wed, Sep 25, 2013 at 07:40:39AM -0400, Pedro Melendez wrote:
> After some experimentation I came out to the realization that the reading
> thread is blocking all other threads. And I actually just found that stated
> on the TCP Unit documentation:
>
>    - Blocking I/O will block all threads, except for some socket operations
>    (see the section about the tcp unit). An exception is the
>    read-eval-print loop on UNIX platforms: waiting for input will not block
>    other threads, provided the current input port reads input from a console.
>
> So, I guess my question is if there is a way to workaround this or I have
> to combine my code with some C++ code to achieve what I want to do?

Hi Pedro!

By default, the tcp unit's procedures will create nonblocking I/O ports, and
the srfi-18 scheduler will multiplex threads over all open sockets using
POSIX poll().  In other words, it should Just Work if you read in one thread
and write in the other thread.

Maybe I'm misunderstanding what you're trying to do?  If so, could you
please send us some sample code to avoid further confusion?

Cheers,
Peter
-- 
http://www.more-magic.net



reply via email to

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