Mutex in C++ and Java

Summary In this post, I will introduce the correct way to use mutex in C++, compared to Java. Conclusion Try not to use std::mutex directly. Use std::unique_lock, std::lock_guard, or std::scoped_lock (since C++17) to manage locking in a more exception-safe manner. Undefined behaviors will happen if a). A mutex is destroyed while still owned by any…

DependencyManagement and Dependencies in Maven

Summary In this post, I will introduce the key difference between Maven’s <dependencyManagement> and <dependencies>. Conclusion In pom inheritance, artifacts specified <dependencies> will ALWAYS be included as a dependency of the child module(s). However, artifacts specified in <dependencyManagement> will only be included if child modules explicitly specify them in <dependencies>. <dependencyManagement> is good for centralized…