Swiftorial Logo
Home
Swift Lessons
Tutorials
Learn More
Career
Resources

Java FAQ: Top Questions

57. What is the LockSupport class in Java?

LockSupport in java.util.concurrent.locks provides low-level thread-blocking primitives, used internally by concurrency utilities like ReentrantLock .

  • Methods: park (block thread), unpark (resume thread).
  • Permits: Each thread has a permit; unpark grants one, park consumes it or blocks.
  • Flexibility: No need for locks or monitors, unlike wait/notify .
  • Use Case: Building custom synchronizers or advanced concurrency constructs.