lib/socket: `PollFD` is `FinalizableOnce`
authorAlexis Laferrière <alexis.laf@xymus.net>
Fri, 26 Dec 2014 22:03:06 +0000 (17:03 -0500)
committerAlexis Laferrière <alexis.laf@xymus.net>
Sat, 27 Dec 2014 17:19:53 +0000 (12:19 -0500)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

lib/socket/socket_c.nit

index 793b1c5..ba76860 100644 (file)
@@ -37,6 +37,7 @@ in "C" `{
 
 # Wrapper for the data structure PollFD used for polling on a socket
 class PollFD
+       super FinalizableOnce
 
        # The PollFD object
        private var poll_struct: NativeSocketPollFD
@@ -76,6 +77,10 @@ class PollFD
                return response & mask;
        `}
 
+       redef fun finalize_once
+       do
+               poll_struct.free
+       end
 end
 
 # Data structure used by the poll function