File Synchronization across two different Browser sessions connected to Streamlit App

Can someone please tell how to do file synchronisation for two different Browser sessions connected to Streamlit App, My use case is My app allows users to upload/view the files , Now I don’t want both the users Saving the file at same time , Can we use some thread locks to ensure that it doesn’t happen using ctx.session_id

I tried the following thing , I found that streamlit is also using threading module , so I done the following in session_state

import streamlit.report_thread as ReportThread
from streamlit.server.server import Server
import threading


class SessionState(object):
    def __init__(self, **kwargs):
        for key, val in kwargs.items():
            setattr(self, key, val)


def get(**kwargs):

    ctx = ReportThread.get_report_ctx()
    current_server = Server.get_current()

    if not hasattr(current_server, 'my_state'):
        current_server.my_state = {}

    if not hasattr(current_server,'custom_lock'):
        current_server.custom_lock = threading.Lock()

    kwargs['lock'] = current_server.custom_lock
    if str(ctx.session_id) not in current_server.my_state.keys():
        current_server.my_state[str(ctx.session_id)] = SessionState(**kwargs)

    return current_server.my_state[str(ctx.session_id)]

So by this we get state.lock for every thread which is common to all threads and we can do state.lock.acquire() and state.lock.release() for synchronisation, is this proper way?