Previous | Next --- Slide 36 of 40
Back to Lecture Thumbnails
placebo

For those familiar with Java, the Java synchronized keyword is a good example for the second point on this slide. When you declare a synchronized Java method, you're guaranteed that only at most one thread will ever be executing in that method at any given time.

sfackler

You can declare synchronized blocks as well!

synchronized (someObjectToUseAsTheLock) {
    // critical section
}