Skip to content

Unable to receive on multiple thread safe buses at the same time #394

@tigershadowclaw

Description

@tigershadowclaw

In thread_safe_bus.py because the send/receive locks are begin setup in the class and not in the init function any threadSafeBus object that is created will block any other threadSafeBus when waiting for new messages because they are using the same locks . Moving line 57 and 58 in side the init function solves this.

For example if you have a program with two separate physical can ports and each are setup as threadsafe buses, bus 1 will block bus 2 while is waiting for a new message and vice versa

original line 56 through 61 in thread_safe_bus.py

    # init locks for sending and receiving separately
    _lock_send = RLock()
    _lock_recv = RLock()

def __init__(self, *args, **kwargs):
    if import_exc is not None:

new line 51 through 58 in thread_safe_bus.py


def __init__(self, *args, **kwargs):
    # init locks for sending and receiving separately
    self._lock_send = RLock()
    self._lock_recv = RLock()   
     
    if import_exc is not None:

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions