--- title: "Locking" slug: "locking" updated: 2022-01-14T20:55:00Z published: 2022-01-14T20:55:00Z canonical: "docs.echo.stream/locking" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.echo.stream/llms.txt > Use this file to discover all available pages before exploring further. # Locking In most cases, your function will be executed concurrently inside of your Node, once per received message. If you need to protect certain sections of your function from concurrent execution, you may use the Context object itself as a Python [Lock](https://docs.python.org/3/library/threading.html#lock-objects) object. For example, using a `processor` function: ``` def processor(*, context, message, source, **kwargs): with context: # perform non-concurrent code here return message ``` > NOTE - always make sure that you release the lock prior to exiting your function or your Node will stop processing messages!! The best way to do this is shown above by using a Python `with` clause. This is generally necessary when you decide that you wish to [add additional attributes](/v1/docs/adding-additional-attributes) to the Context object.