Category: Technology

Best way in .NET to manage queue of tasks on a separate (single) thread

http://stackoverflow.com/questions/20056727/need-to-understand-the-usage-of-semaphoreslim http://stackoverflow.com/questions/20904328/c-sharp-async-tasks-in-a-queue-or-waiting-list http://stackoverflow.com/questions/25691679/best-way-in-net-to-manage-queue-of-tasks-on-a-separate-single-thread To create an asynchronous single degree of parallelism queue of work you can simply create a SemaphoreSlim, initialized to one, and then have the enqueing method await…

Delayed Expansion

http://stackoverflow.com/questions/14347038/dos-batch-why-are-my-set-commands-resulting-in-nothing-getting-stored You found the bbb (batch beginner bug), but not the variable is empty, it’s the expansion that doesn’t work as expected. Percent expansion is done when a line or…

Throttling Go routines

Source: https://stackoverflow.com/questions/15715605/multiple-goroutines-listening-on-one-channel#15721380 Yes, it’s complicated, But there are a couple of rules of thumb that should make things feel much more straightforward. prefer using formal arguments for the channels you…

Variable captured by func literal

Source: https://stackoverflow.com/questions/40326723/go-vet-range-variable-captured-by-func-literal-when-using-go-routine-inside-of-f#40326812 it’s a common mistake for new comers in Go, and yes the var currentProcess changes for each loop, so your goroutines will use the last process in the…