• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/3

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

3 Cards in this Set

  • Front
  • Back
What is the problem with this code, and how to fix it?


 

What is the problem with this code, and how to fix it?


If cout throws an exception, our mutex will be locked forever, use RAII to fix it.


 

If cout throws an exception, our mutex will be locked forever, use RAII to fix it.


There is still a problem here, what is it?

There is still a problem here, what is it?

cout is a global resource, other processes could write to it as well. 


Here is a way you could approach to handling this.

cout is a global resource, other processes could write to it as well.


Here is a way you could approach to handling this.

What is the problem with this class, assuming synchronization is handled correctly?

What is the problem with this class, assuming synchronization is handled correctly?

The interface of this class is not thread safe.  top and pop should be combined(and still it would not be safe if there is an exception, that is why STL is not thread safe).

The interface of this class is not thread safe. top and pop should be combined(and still it would not be safe if there is an exception, that is why STL is not thread safe).