mirror of
https://github.com/commaai/msgq.git
synced 2026-06-08 05:54:44 +08:00
misc gc pass (#690)
This commit is contained in:
10
SConscript
10
SConscript
@@ -1,4 +1,4 @@
|
||||
Import('env', 'envCython', 'arch', 'common')
|
||||
Import('env', 'envCython', 'common')
|
||||
|
||||
|
||||
visionipc_dir = Dir('msgq/visionipc')
|
||||
@@ -12,11 +12,11 @@ msgq_objects = env.SharedObject([
|
||||
'msgq/msgq.cc',
|
||||
])
|
||||
msgq = env.Library('msgq', msgq_objects)
|
||||
msgq_python = envCython.Program('msgq/ipc_pyx.so', 'msgq/ipc_pyx.pyx', LIBS=envCython["LIBS"]+[msgq, common])
|
||||
msgq_python = envCython.Program('msgq/ipc_pyx.so', 'msgq/ipc_pyx.pyx', LIBS=envCython["LIBS"]+[msgq]+common)
|
||||
|
||||
# Build Vision IPC
|
||||
vipc_files = ['visionipc.cc', 'visionipc_server.cc', 'visionipc_client.cc']
|
||||
if arch == "larch64":
|
||||
if File('/dev/ion').exists():
|
||||
vipc_files += ['visionbuf_ion.cc']
|
||||
else:
|
||||
vipc_files += ['visionbuf.cc']
|
||||
@@ -26,11 +26,11 @@ vipc_objects = env.SharedObject(vipc_sources)
|
||||
visionipc = env.Library('visionipc', vipc_objects)
|
||||
|
||||
|
||||
vipc_libs = envCython["LIBS"] + [visionipc, msgq, common]
|
||||
vipc_libs = envCython["LIBS"] + [visionipc, msgq] + common
|
||||
envCython.Program(f'{visionipc_dir.abspath}/visionipc_pyx.so', f'{visionipc_dir.abspath}/visionipc_pyx.pyx',
|
||||
LIBS=vipc_libs)
|
||||
|
||||
if GetOption('extras'):
|
||||
env.Program('msgq/test_runner', ['msgq/test_runner.cc', 'msgq/msgq_tests.cc'], LIBS=[msgq, common])
|
||||
env.Program('msgq/test_runner', ['msgq/test_runner.cc', 'msgq/msgq_tests.cc'], LIBS=[msgq]+common)
|
||||
|
||||
Export('visionipc', 'msgq', 'msgq_python')
|
||||
|
||||
@@ -8,11 +8,11 @@ arch = subprocess.check_output(["uname", "-m"], encoding='utf8').rstrip()
|
||||
if platform.system() == "Darwin":
|
||||
arch = "Darwin"
|
||||
|
||||
common = ''
|
||||
common = []
|
||||
|
||||
cpppath = [
|
||||
catch2.INCLUDE_DIR,
|
||||
f"#/",
|
||||
"#/",
|
||||
'#msgq/',
|
||||
'/usr/lib/include',
|
||||
sysconfig.get_paths()['include'],
|
||||
|
||||
@@ -5,13 +5,26 @@ from msgq.ipc_pyx import MultiplePublishersError, IpcError
|
||||
|
||||
from typing import Optional, List, Union
|
||||
|
||||
assert MultiplePublishersError
|
||||
assert IpcError
|
||||
assert toggle_fake_events
|
||||
assert set_fake_prefix
|
||||
assert get_fake_prefix
|
||||
assert delete_fake_prefix
|
||||
assert wait_for_one_event
|
||||
__all__ = [
|
||||
"Context",
|
||||
"Poller",
|
||||
"SubSocket",
|
||||
"PubSocket",
|
||||
"SocketEventHandle",
|
||||
"MultiplePublishersError",
|
||||
"IpcError",
|
||||
"toggle_fake_events",
|
||||
"set_fake_prefix",
|
||||
"get_fake_prefix",
|
||||
"delete_fake_prefix",
|
||||
"wait_for_one_event",
|
||||
"NO_TRAVERSAL_LIMIT",
|
||||
"context",
|
||||
"fake_event_handle",
|
||||
"pub_sock",
|
||||
"sub_sock",
|
||||
"drain_sock_raw",
|
||||
]
|
||||
|
||||
NO_TRAVERSAL_LIMIT = 2**64-1
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
# distutils: language = c++
|
||||
# cython: c_string_encoding=ascii, language_level=3
|
||||
|
||||
import sys
|
||||
import time
|
||||
from libcpp.string cimport string
|
||||
from libcpp.vector cimport vector
|
||||
@@ -56,9 +55,6 @@ def wait_for_one_event(list events, int timeout=-1):
|
||||
cdef class Event:
|
||||
cdef cppEvent event;
|
||||
|
||||
def __cinit__(self):
|
||||
pass
|
||||
|
||||
cdef setEvent(self, cppEvent event):
|
||||
self.event = event
|
||||
|
||||
|
||||
@@ -79,8 +79,6 @@ void msgq_wait_for_subscriber(msgq_queue_t *q){
|
||||
while (*q->num_readers == 0){
|
||||
// wait for subscriber
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
int msgq_new_queue(msgq_queue_t * q, const char * path, size_t size){
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
from msgq.visionipc.visionipc_pyx import VisionBuf, VisionIpcClient, VisionIpcServer, VisionStreamType, get_endpoint_name
|
||||
assert VisionBuf
|
||||
assert VisionIpcClient
|
||||
assert VisionIpcServer
|
||||
assert VisionStreamType
|
||||
assert get_endpoint_name
|
||||
|
||||
__all__ = [
|
||||
"VisionBuf",
|
||||
"VisionIpcClient",
|
||||
"VisionIpcServer",
|
||||
"VisionStreamType",
|
||||
"get_endpoint_name",
|
||||
]
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
# distutils: language = c++
|
||||
# cython: c_string_encoding=ascii, language_level=3
|
||||
|
||||
import sys
|
||||
from libc.string cimport memcpy
|
||||
from libc.stdint cimport uint32_t, uint64_t
|
||||
from libcpp cimport bool
|
||||
|
||||
@@ -38,13 +38,9 @@ void VisionIpcServer::create_buffers(VisionStreamType type, size_t num_buffers,
|
||||
// TODO: assert that this type is not created yet
|
||||
assert(num_buffers < VISIONIPC_MAX_FDS);
|
||||
|
||||
size_t size = 0;
|
||||
size_t stride = 0;
|
||||
size_t uv_offset = 0;
|
||||
|
||||
size = width * height * 3 / 2;
|
||||
stride = width;
|
||||
uv_offset = width * height;
|
||||
size_t size = width * height * 3 / 2;
|
||||
size_t stride = width;
|
||||
size_t uv_offset = width * height;
|
||||
|
||||
create_buffers_with_sizes(type, num_buffers, width, height, size, stride, uv_offset);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[project]
|
||||
name = "msgq"
|
||||
version = "0.0.1"
|
||||
description = "Code powering the comma.ai panda"
|
||||
description = "Lock-free IPC pub/sub message queue"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.11,<3.13"
|
||||
license = {text = "MIT"}
|
||||
|
||||
Reference in New Issue
Block a user