Возможно, стоит пояснить разницу между синхронизацией из thread/process-safe и синхронизацией с помощью Lock🤔
Наша задача — заставить разные процессы и потоки обращаться к базе данных (или любым другим ресурсам) последовательно. Чтобы не случилось так называемого race condition, то есть состояние гонки. Это когда разные потоки или процессы пытаются одновременно что-то сделать с одним и тем же ресурсом.
В этом случае нам нужна какая-то логика ограничения. Пока один процесс не завершил своё действие, другие не могут получить доступ к ресурсу.
Так вот, thread-safe и process-safe означает что отдельно взятые операции записи в БД гарантированно будут последовательны. Запросы из разных процессов или потоков выстроятся в очередь и не будут мешать друг другу. Лучше всего когда этот блок реализован на уровне БД в виде атомарных операций или ещё как-то.
Но зачем нам тогда еще дополнительный Lock?
Этот способ синхронизации используется когда процесс никак не укладывается в одно действие и должен сделать множество операций прежде чем дать доступ следующему. В этом случае процесс ставит некий глобальный Lock на ресурс и никто другой, даже получив законное право на доступ, не может ничего сделать. Все ждут пока этот Lock не будет снят.
Это решается на уровне приложения и правильность реализации полностью в вашей ответственности. Например, если забыли разблокировать или сделали перекрёстный Lock (Deadlock как на картинке), то всё зависнет в бесконечном ожидании.
#basic
https://docs.python.org/3/library/marshal.html#module-marshal
marshal — Internal Python #object_serialization
This module contains functions that can read and write Python values in a binary format. The format is specific to Python, but independent of machine architecture issues (e.g., you can write a #Python value to a #file on a PC, transport the file to a Sun, and read it back there). Details of the format are undocumented on purpose; it may change between Python versions (although it rarely does).
@thefavbot
Qué puede hacer este bot?
Este bot puede recopilar todos sus medios en un solo lugar.
Usted puede acceder a sus medios favoritos en cualquier chat!
Para eso debes escribir @thefavbot en el chat que deseas. Soporta:
Foto, video, archivo, audio, voz, gif.
Para agregar cualquier medio a su colección, solo necesita enviarlo o reenviarlo al bot.
Idioma: Inglés
(visto en @BotsGram_cu)
#gift, #video, #image, #file
#Musicopy#Music#File#Transfer
Join the Musicopy: Music File Transfer beta on ✈️#TestFlight
🔗 Link: https://testflight.apple.com/join/Ck9KaZVR
Shared by Dimitri
Sharing
Share files and apps on android to other devices using browser
Share files and apps over HTTP.
You need the other device to be connected to the same network. just toggle on the server and scan the QR Code on other device and you're good to go. Files sent from browser to the app can be found in Sharing/ folder in your internal storage. You can always disable uploads in the app settings.
https://github.com/Ammar64/Sharing
Download
https://github.com/Ammar64/Sharing/releases/latest
https://f-droid.org/packages/com.ammar.sharing/
#share#file#Transfer#Android#qr
@warlockpublicurl_bot
Qué puede hacer este bot?
Envíale cualquier Archivo Multimedia de Telegram y generará un enlace directo para ello
Los Archivos Porno están Estrictamente Prohibidos.
Idioma: Inglés
(visto en @BotsGram_cu)
#file, #upload, #link, #url, #public, #telegram