Commit 4f4ae662 authored by Andreas Schmidt's avatar Andreas Schmidt

Add thread pinning to Python API.

parent 52fdeea0
Pipeline #1342 passed with stages
in 1 minute and 12 seconds
......@@ -11,6 +11,9 @@ cdef extern from "pthread.h" nogil:
ctypedef struct pthread_cond_t:
pass
cdef extern from "py_defines.h":
pass
cdef extern from "proto/vdmcode/block_code.h":
cdef struct prrtCoder:
pass
......@@ -120,6 +123,8 @@ cdef extern from "proto/socket.h":
int32_t PrrtSocket_timedrecv(PrrtSocket *sock_ptr, void *buf_ptr, const uint32_t wait_time) nogil
bint PrrtSocket_set_sock_opt(PrrtSocket *sock_ptr, const_char *name, const uint32_t value)
uint32_t PrrtSocket_get_sock_opt(PrrtSocket *sock_ptr, const_char *name)
bint PrrtSocket_uses_thread_pinning(PrrtSocket *socket)
cdef extern from "util/bptree.h":
ctypedef struct BPTreeNode:
......
......@@ -427,3 +427,11 @@ bool PrrtSocket_cleanup(PrrtSocket *socket) {
}
return true;
}
bool PrrtSocket_uses_thread_pinning(PrrtSocket *socket) {
#ifdef THREAD_PINNING
return true;
#else
return false;
#endif
}
......@@ -94,4 +94,6 @@ bool PrrtSocket_cleanup(PrrtSocket *socket);
bool PrrtSocket_closing(PrrtSocket *socket);
bool PrrtSocket_uses_thread_pinning(PrrtSocket *socket);
#endif // PRRT_SOCKET_H
......@@ -79,6 +79,11 @@ cdef class PrrtSocket:
self.isSender = isSender
property thread_pinning:
def __get__(self):
return cprrt.PrrtSocket_uses_thread_pinning(self._c_socket)
property target_delay:
def __get__(self):
......
#ifndef PRRT_PY_DEFINES_H
#define PRRT_PY_DEFINES_H
#define THREAD_PINNING
#endif //PRRT_PY_DEFINES_H
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment