Возможно, стоит пояснить разницу между синхронизацией из thread/process-safe и синхронизацией с помощью Lock🤔
Наша задача — заставить разные процессы и потоки обращаться к базе данных (или любым другим ресурсам) последовательно. Чтобы не случилось так называемого race condition, то есть состояние гонки. Это когда разные потоки или процессы пытаются одновременно что-то сделать с одним и тем же ресурсом.
В этом случае нам нужна какая-то логика ограничения. Пока один процесс не завершил своё действие, другие не могут получить доступ к ресурсу.
Так вот, thread-safe и process-safe означает что отдельно взятые операции записи в БД гарантированно будут последовательны. Запросы из разных процессов или потоков выстроятся в очередь и не будут мешать друг другу. Лучше всего когда этот блок реализован на уровне БД в виде атомарных операций или ещё как-то.
Но зачем нам тогда еще дополнительный Lock?
Этот способ синхронизации используется когда процесс никак не укладывается в одно действие и должен сделать множество операций прежде чем дать доступ следующему. В этом случае процесс ставит некий глобальный Lock на ресурс и никто другой, даже получив законное право на доступ, не может ничего сделать. Все ждут пока этот Lock не будет снят.
Это решается на уровне приложения и правильность реализации полностью в вашей ответственности. Например, если забыли разблокировать или сделали перекрёстный Lock (Deadlock как на картинке), то всё зависнет в бесконечном ожидании.
#basic
🌊 GuAsia Winner Has Arrived at Songkran. Congratulation winners!🇹🇭
From the leaderboard to the land of water fights and tradition, our GuAsia winners have officially landed in Bangkok to experience the legendary Songkran Water Festival - live and in person! 🛫💧
A round-trip ticket to Bangkok from April 13 to April 15 to experience one of the most iconic cultural events on Earth has already been sent straight to the winner’s wallet, along with a personal notification. ✈️
🏆 As part of Gumart’s biggest campaign ever, Gu Go Global, this was Asia’s turn to shine—and the energy was real.
🏁With more giveaways coming to every continent, your chance might be just around the corner!
#GuGoGlobal#GuAsia
⏱ 2 DAYS LEFT — Don’t Miss This! 🚨
💥 The clock is ticking. Only 48 hours remain before our GuAsia Mini-Game officially closes.
❗️ What’s at stake?
Top 5 players on the leaderboard will secure exclusive rewards, including real-world travel experiences, not just digital prizes.
🌍 This isn’t just a game.
It’s your chance to turn activity into real movement, rewards into real journeys, and rankings into real recognition. 👀
🔥 Final push starts NOW:
1️⃣ Invite more friends
2️⃣Climb the leaderboard
3️⃣Lock in your spot
⏰ 2 days left.
Once it’s over — it’s over.
#GuGoGlobal#GuAsia#FinalCountdown
🌊 Gumart in Songkran – Thailand 🇹🇭
🌐#GuGoGlobal Campaign – Taking Web3 to the Heart of Culture!
📍 Checkpoint: Songkran Festival, Bangkok, Thailand
One of our GuAsia winners has just shared their unforgettable journey at the legendary Songkran Festival in Bangkok - after receiving their exclusive reward from the #GuGoGlobal giveaway. 😱
From vibrant street parades to joyful water fights, this was more than just a trip - it was a moment where Web3 met real-world celebration, and Gumart became part of the experience.⭐️
💡 This is what Gu Go Global is all about: bringing crypto utility to real life, through people, places, and culture.
🎉And yes - more giveaways are coming to every continent. Your city might be next.
#GuGoGlobal#GuAsia#Songkran
🎉 GuAsia Activation: Fly to Songkran Festival with Gumart!🇹🇭
As part of Gumart’s biggest-ever global campaign, Gu Go Global (April–May 2025), we’re bringing the celebration to Asia with a special giveaway!📈
✈️ Prize: Round-trip flight ticket to Bangkok, Thailand, to experience the iconic Songkran Water Festival live! 💧
🗓 Duration: April 8 - April 13
📌 How to join: Top 3 referral leaderboard in Asia will receive special prizes – including a flight to Songkran!
Be bold, be global. This is your moment. See you in Asia!🔼
#GuGoGlobal#GuAsia#SongkranFestival