Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] file descriptor leaks?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Ker Lutyn <ker527mail@y...>
Subject: [Caml-list] file descriptor leaks?
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