This post shows an example of a bad practice I saw in one of my Java projects seven years ago. It also has a naive implementation of concurrency in Java, wherein it waits for all threads to complete. Moreover, it
Java – Block main thread until another Thread completes
Given a simple Java application with a Thread object, we want to block the main thread until the Thread object completes its execution. The main thread is where the Thread object is created and its start method invoked.
ExecutorService, AutoCloseable, and Try-With-Resources In Java
This post demonstrates how to use Java ExecutorService and AutoCloseable with try-with-resources. With ExecutorService, we need to call the shutdown method all the time. However, call the shutdown method means we are writing more codes than we should. There has
Rust – Thread Synchronization using Barrier
This post is about Rust thread synchronization with Barrier using std::sync::Barrier which is part of Rust’s standard library. Therefore, we do not need external dependencies to make things work. Basic Idea of Barrier The basic idea of using barriers is
Using TimeUnit instead of Thread.sleep()
This post demonstrates how to use TimeUnit as a replacement to the usual and out-dated way to pausing thread via Thread.sleep().
Create Threads That Work With Data in Rust
Rust supports the creation of threads to run code simultaneously using the spawn function and a closure argument.