[PATCH rdma-core 02/19] pyverbs: Unify close functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Instead of a declaring both cdef and def function, use a single
cpdef close(). The main drawback of such an apporoach is a potential
performance degradation, but it will be visible only during objects
teardown, which don't have performance constraints anyway.

Signed-off-by: Noa Osherovich <noaos@xxxxxxxxxxxx>
---
 pyverbs/device.pxd |  2 +-
 pyverbs/device.pyx | 11 ++---------
 2 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/pyverbs/device.pxd b/pyverbs/device.pxd
index 31d243a80dd5..7a6489da11bf 100644
--- a/pyverbs/device.pxd
+++ b/pyverbs/device.pxd
@@ -8,7 +8,7 @@ cimport pyverbs.libibverbs as v
 cdef class Context(PyverbsObject):
     cdef v.ibv_context *context
     cdef object name
-    cdef _close(self)
+    cpdef close(self)
 
 cdef class DeviceAttr(PyverbsObject):
     cdef v.ibv_device_attr dev_attr
diff --git a/pyverbs/device.pyx b/pyverbs/device.pyx
index 3fad6af41ecc..cb3baed38afa 100644
--- a/pyverbs/device.pyx
+++ b/pyverbs/device.pyx
@@ -102,16 +102,9 @@ cdef class Context(PyverbsObject):
         Closes the inner IB device.
         :return: None
         """
-        self._close()
+        self.close()
 
-    def close(self):
-        """
-        Closes the inner IB device.
-        :return: None
-        """
-        self._close()
-
-    cdef _close(self):
+    cpdef close(self):
         self.logger.debug('Closing Context')
         if self.context != NULL:
             rc = v.ibv_close_device(self.context)
-- 
2.17.2




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux