Chapter 1. Java Threads
KEY TOPICS
What Is a Thread?
Creating and Running Threads in Java
Synchronization
Using wait() and notify()
The Java Event Model
When to Use Threads
When Not to Use Threads
Sum It Up: Thread Pools
Summary
It's lunchtime, and you decide to treat yourself to a meal at your favorite restaurant. You take a seat and look around—the place is pretty empty. There's one waiter, one customer eating, and you.
The waiter is helping the other customer, but oddly, you're being ignored. Even when you ask for a menu, the waiter acts as if you're not there and just refills the other customer's beverage. Finally, after the other customer leaves, the waiter acknowledges your existence and helps you.
So what is the problem? The waiter hasn't been fired, ...
Get Developing Games in Java™ now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.