BlockingCollection(T) performance

There are a couple of potential possibilities, here. First, BlockingCollection<T> in the Reactive Extensions is a backport, and not exactly the same as the .NET 4 final version. I wouldn’t be surprised if the performance of this backport differs from .NET 4 RTM (though I haven’t profiled this collection, specifically). Much of the TPL performs … Read more

Behavior of sleep and select in go

That’s a very interesting question, so I did cd into my Go source to start looking. time.Sleep time.Sleep is defined like this: // src/time/sleep.go // Sleep pauses the current goroutine for at least the duration d. // A negative or zero duration causes Sleep to return immediately. func Sleep(d Duration) No body, no definition in … Read more

What’s the differences between blocking with synchronous, nonblocking and asynchronous? [duplicate]

Blocking may or may not be the same as synchronous, depending on the context. When we talk about method calls, then a synchronous call can also be said to be blocking (I’ll get back to this in a bit), because the thread calling the method cannot proceed forward until the method returns. The antonym in … Read more

Go project’s main goroutine sleep forever?

“Sleeping” You can use numerous constructs that block forever without “eating” up your CPU. For example a select without any case (and no default): select{} Or receiving from a channel where nobody sends anything: <-make(chan int) Or receiving from a nil channel also blocks forever: <-(chan int)(nil) Or sending on a nil channel also blocks … Read more

Linux Blocking vs. non Blocking Serial Read

The code you mention is IMO poorly coded and commented. That code does not conform to POSIX practices for portability as described in Setting Terminal Modes Properly and Serial Programming Guide for POSIX Operating Systems. That code does not mention that it uses non-canonical (aka raw) mode, and reuses the “blocking” and “nonblocking” terminology to … Read more

tech