7.3.1. Python API Reference

7.3.1.1. Thread-Safety

The functions and objects of the Python API are (in difference to the corresponding objects of the C and C++ API) not thread-safe.

That means it is not possible to create and use objects from it from different threads, unless you make sure that only one thread accesses each object at the same time.

The latter can be done by using a lock for each object, and lock it each time the object is accessed.

Tip

If your program uses several threads, you should consider to split it into several processes which communicate.

7.3.1.2. os.fork() calls

Calling the os.fork() system function is not supported by the LN library. This means that os.fork() should not be called when any LN client instance is active. Otherwise, strange things can happen.

7.3.1.4. Private (Internal API)

private!

Attributes commonly exposed by Python port wrapper objects include:

  • topic_name: name of the topic

  • msg_def_name: message definition name used by the port

  • msg_def_hash: hash of the flattened message definition

  • packet: the wrapped message object used for reading or writing payload data

  • client: owning client instance

inport() : port_base
private!

inport instances additionally expose timestamp as a floating-point value. After a successful inport.read(), it contains the publisher timestamp received with the current packet.

private!
*timestamp* is set to ``clock_gettime(CLOCK_REALTIME)`` if not provided.

7.3.1.5. Relevant Source Code Files for further Reference

python/links_and_nodes/_ln.cpp

python/links_and_nodes/ln_wrappers.py

libln/include/ln/cpp_wrapper.h

libln/include/ln/cpp_wrapper_impl.h

libln/include/ln/ln.h