caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] file descriptor leaks?
@ 2004-05-03 23:32 Ker Lutyn
  2004-05-04  7:46 ` Basile Starynkevitch local
  0 siblings, 1 reply; 4+ messages in thread
From: Ker Lutyn @ 2004-05-03 23:32 UTC (permalink / raw)
  To: caml-list

Suppose the central loop of my server looks like this:

while true do
  let fd, _ = Unix.accept sock in
  ignore (Thread.create f fd)
done

Assuming f does not close the fd when it's done, is this a fd leak? And is this
better?

while true do
  let fd, _ = Unix.accept sock in
  let g fd = try f fd; Unix.close fd with e -> Unix.close fd; raise e in
  ignore (Thread.create g fd)
done

Thanks -


	
		
__________________________________
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs  
http://hotjobs.sweepstakes.yahoo.com/careermakeover 

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-05-04  9:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-03 23:32 [Caml-list] file descriptor leaks? Ker Lutyn
2004-05-04  7:46 ` Basile Starynkevitch local
2004-05-04  9:15   ` Henri DF
2004-05-04  9:31     ` Richard Jones

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 NNTP newsgroup(s).