[svn:parrot] r39477 - trunk/src/pmc

NotFound at svn.parrot.org NotFound at svn.parrot.org
Tue Jun 9 20:46:12 UTC 2009


Author: NotFound
Date: Tue Jun  9 20:46:11 2009
New Revision: 39477
URL: https://trac.parrot.org/parrot/changeset/39477

Log:
[pmc] add close method to Socket

Modified:
   trunk/src/pmc/socket.pmc

Modified: trunk/src/pmc/socket.pmc
==============================================================================
--- trunk/src/pmc/socket.pmc	Tue Jun  9 20:00:03 2009	(r39476)
+++ trunk/src/pmc/socket.pmc	Tue Jun  9 20:46:11 2009	(r39477)
@@ -196,6 +196,28 @@
 
 /*
 
+=item C<close>
+
+Close a socket.
+
+=cut
+
+*/
+
+    METHOD close() {
+        INTVAL result = -1;
+        if (PARROT_SOCKET(SELF)) {
+            Parrot_Socket_attributes *data_struct = PARROT_SOCKET(SELF);
+
+            if(data_struct->os_handle != PIO_INVALID_HANDLE)
+                result = Parrot_io_close_piohandle(interp, data_struct->os_handle);
+            data_struct->os_handle = PIO_INVALID_HANDLE;
+        }
+	RETURN(INTVAL result);
+    }
+
+/*
+
 =item C<recv>
 
 Receives a message from a connected socket object. It returns


More information about the parrot-commits mailing list