finish vs force -output

View: New views
2 Messages — Rating Filter:   Alert me  

finish vs force -output

by Don Cohen-12 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I have some web serving code that does a close on the socket stream.
I noticed that the browser would continue "spinning" indicating that
it was still loading the page.
Adding a finish-output after the close solves this problem as
expected.  I also expected that force-output would solve the problem
but this seems not to be the case.  
clhs:
  force-output initiates the emptying of any internal buffers but does
  not wait for completion or acknowledgment to return.
To me the term "emptying" implies that the process that is begun by
force-output will at least do what finish-output would have done
(though it might end up doing more if additional output is sent after
the force output returns but before the finish output would have
returned).

Does anyone have any other opinions on this?

I wonder how force and finish are implemented for socket streams.
and how they should be.  Does it make any difference whether the
stream has been closed?

It occurs to me that in a multithreaded build I might replace force
with finish in a new thread.  That seems to correspond to what I think
force should do.  Is this likely to work?  In general what is to be
expected from attempts to use the same stream in two different
threads?  For example what does it mean for one to finish or force
-output while another is writing?

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
clisp-list mailing list
clisp-list@...
https://lists.sourceforge.net/lists/listinfo/clisp-list

Re: finish vs force -output

by Sam Steingold :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> * Don Cohen <qba-fbheprsbetr-kkm@...> [2009-11-06 14:38:49 -0800]:
>
> I wonder how force and finish are implemented for socket streams.
> and how they should be.

the buffer (if any) is flushed.
then fsync(2) is called.

> Does it make any difference whether the
> stream has been closed?

close flushes buffers too and then calls close(3) which should calls fsync.

--
Sam Steingold (http://sds.podval.org/) on Ubuntu 9.04 (jaunty)
http://camera.org http://ffii.org http://pmw.org.il http://dhimmi.com
http://iris.org.il http://thereligionofpeace.com http://palestinefacts.org
When you are arguing with an idiot, your opponent is doing the same.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
clisp-list mailing list
clisp-list@...
https://lists.sourceforge.net/lists/listinfo/clisp-list