Explore tweets tagged as #SemaphoreSlim
@marcgravell
Marc Gravell
7 years
woohoo, an idea I had for my "make SemaphoreSlim not suck" replacement (long story, will blog) turned out to crank all the right dials; very pleased with this - I was aiming for similar perf (but sane behavior in corner case)
2
14
84
@mjovanovictech
Milan Jovanović
2 years
How can you lock inside an async method? You'll run into a compiler error if you try using the lock statement. What you can do is use a Semaphore or SemaphoreSlim. There are also many other synchronization primitives available in C#. Two remarks:
6
17
131
@marcgravell
Marc Gravell
7 years
Still trying to fix-up a SemaphoreSlim landmine we stumbled into when trying to fix something for @davidfowl - definitely moving in the right direction (assuming it actually works...):
3
1
20
@STeplyakov
Sergiy Teplyakov 🇺🇦 🇺🇸
1 year
On using the right sync primitives. Just found a case, when switching from `SpinLock` to `SemaphoreSlim` improved the throughput almost 3-x! In this case, we had a bunch of threads, and spinning a lot was detrminental for perf!
1
0
49
@noseratio
Andrew Nosenko 🇺🇦 🇦🇺
4 years
A thread-safe, concurrency-friendly implementation of IAsyncDisposable.DisposeAsync without using SemaphoreSlim: https://t.co/arkcyxL3bR Do I even understand this piece I've come up with? 😅 Maybe I should I blog about it. #dotnet #csharp
1
3
5
@mjovanovictech
Milan Jovanović
2 years
C# supports locking with the `lock` statement. You can use it to define a code block only one thread can access. However, it doesn't work in an asynchronous context. So you'll have to use some other C# concurrency primitive. - Semaphore - SemaphoreSlim - Monitor - Mutex
2
15
131
@overflow_meme
Meme Overflow
4 years
Does SemaphoreSlim act as a gatekeeper or as a batchkeeper? https://t.co/GjqiLZhOMd #csharp #semaphore #asynchronous
0
0
0
@sinclairinat0r
Jeremy Sinclair #ฺNET
3 years
Hmm, I told ChatGPT to create a MusicDatabase using C# with ValueTask<T> and ReadOnlySpan<T>. It looked pretty. Then I told it to add concurrency. It decided to use SemaphoreSlim and added an async void method🤔🤔 @davidfowl
2
2
34
@stebets
Stefán Jökull Sigurðarson
5 years
Oh wow... SemaphoreSlim.Wait(0) vs CurrentCount == 0 is REALLY slow on .NET Framework.... did not expect such a massive diff. Would checking CurrentCount be open for race conditions if I'm only checking to see if the Semaphore is "signaled" or not? @ben_a_adams @marcgravell
1
0
0
@overflow_meme
Meme Overflow
4 years
Nito.AsyncEx.LockAsync - Does it work as same as SemaphoreSlim's synchronization? https://t.co/WWfSXiqoVJ #nitoasyncex #csharp #synchronization #dotnetcore
0
0
0
@elliot1one
Elliot One
1 year
SemaphoreSlim offers efficient, lightweight synchronization for concurrent systems. Ideal for thread-safe, asynchronous tasks. Have you used it? 🤔 #softwareengineering #csharp #dotnet
1
0
4
@CsharpCorner
C# Corner
2 years
Learn SemaphoreSlim with @chaudharyhit! 🎓 It's basically your code's personal assistant, managing tasks smartly to avoid jams & delays. Read more here: https://t.co/kJBSsRugkH #Dotnet #TechExplained #Csharp #ParallelProgramming #SemaphoreSlim #ResourcePooling
0
23
33
@marcgravell
Marc Gravell
7 years
Blogged: "Fun with the Spiral of Death" - the tale of my recent exploits with async code, and in particular SemaphoreSlim:
15
55
153
@mjovanovictech
Milan Jovanović
10 months
If you need to control concurrency in your code, the SemaphoreSlim class is one of the simplest solutions in C#. Another option is the new Lock class, but that's available from C# 13. Learn more about locking in C# here: https://t.co/VJoFxOCKnE
5
26
187
@sandayuu
牛尾剛『世界一流エンジニアの思考法』(文藝春秋)🎸Tsuyoshi Ushio
1 year
Interesting to see the comparison between lock, Interlocked, and SemaphoreSlim.WaitAsync(). lock is faster on .NetFramework, SemaphoreSlim is very much improved on .Net 8
0
1
1
@q_hayari
Qiita人気記事/執筆者紹介
17 days
【Qiita】本日のすごい人 [ C# .NET lock SemaphoreSlim Interlocked ]に関する記事を書いた @___sakai__ さん :
0
2
6
@nursel_altinn
Nursel Altın
2 years
Thread/Multithread ve Asenkron/Senkron kavramları ile ilgili notlarımı paylaştığım medium yazı serime devam ediyorum. 4. yazım 'Thread Senkron.;Semaphore ve SemaphoreSlim Notlar' yazım sizlerle. https://t.co/AWfgpkUs4j #buildinpublic
0
0
1
@mehrandvd
🏴 uɒɹɥəɯ
4 years
Why `ReaderWriterLockSlim` doesn't support async just like `SemaphoreSlim` in #dotnet #csharp? something like: await lock.EnterReaderLockAsync();
1
1
4
@ChaseAucoin
Chase Aucoin
6 years
Programmer Shower Thoughts: Why's it called a SemaphoreSlim and not a Slimaphore?
0
0
1