public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Matt Jerdonek <maj1224@yahoo.com>
Cc: Discussion eCos <ecos-discuss@sources.redhat.com>
Subject: Re: [ECOS] TCP close(...) action
Date: Tue, 21 Oct 2003 18:35:00 -0000	[thread overview]
Message-ID: <20031021183547.GI1165@lunn.ch> (raw)
In-Reply-To: <20031018182440.65740.qmail@web14206.mail.yahoo.com>

On Sat, Oct 18, 2003 at 11:24:40AM -0700, Matt Jerdonek wrote:
> Hi Folks,
> 
> I have a simple program with two threads that send /
> recv from a single TCP socket.  One thread blocks on a
> recv call while the other thread sends data on the
> same socket.
> 
> I put a close call in the send thread.  The expected
> behavior was for the recv thread to wake (with 0 bytes
> of data) and a FIN to be sent on the ethernet.  The
> actual behavior was that the recv thread never woke
> and the FIN was not sent.  (Is this intended or a
> bug?).  I found the soclose function would not be
> invoked because the recv was still using the file
> handle.  Once the recv released the file handle, the
> FIN flowed on the ethernet.
> 
> I worked around this issue by calling
> cyg_thread_release from my application, which woke up
> the recv thread.  But I wonder if there is better
> solution?  Could (or should) the close call be made to
> wake up blocked threads?  If so, any suggestions?

I think what its currently doing is at least sensible. Should close
cause other calls using the socket to fail and return an error? What
error should it return? To answer these questions i think you need to
look at the standards and see what other multithreaded OS's do in the
same situation. If you re-write your test program to use POSIX
threads, it should then be possible to run it on linux, SunOS, *BSD
etc. We can then decide if this is right or wrong.

     Andrew

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

  parent reply	other threads:[~2003-10-21 18:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-18 18:24 Matt Jerdonek
2003-10-18 18:30 ` Gary Thomas
2003-10-20 15:25   ` Matt Jerdonek
2003-10-21 17:38     ` Christoph Csebits
2003-10-21 18:35 ` Andrew Lunn [this message]
2003-10-22 16:06   ` Matt Jerdonek
2003-10-22 17:14     ` Nick Garnett
2003-10-22 16:17 Jay Foster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20031021183547.GI1165@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=ecos-discuss@sources.redhat.com \
    --cc=maj1224@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).