-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: 코드 리뷰 테스트 #31
test: 코드 리뷰 테스트 #31
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package woowa.team4.bff.review; | ||
|
||
public class ReviewThis { | ||
|
||
private static int value = 0; | ||
private static boolean flag = false; | ||
|
||
public static void main(String[] args) { | ||
new Thread(() -> { | ||
while (!flag) { | ||
} | ||
System.out.println("value: " + value); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. c: |
||
}).start(); | ||
|
||
new Thread(() -> { | ||
value = 42; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. c: |
||
flag = true; | ||
}).start(); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r:
while (!flag)
루프는 무한 루프가 될 수 있으며,flag
가 변경될 때까지 대기하는 것은 비효율적입니다.flag
가 변경될 때까지 대기하는 방법을 개선해야 합니다.