Skip to content
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

리팩토링 시 고려사항 #4

Open
6 tasks
Giromi opened this issue Aug 17, 2022 · 3 comments
Open
6 tasks

리팩토링 시 고려사항 #4

Giromi opened this issue Aug 17, 2022 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@Giromi
Copy link
Contributor

Giromi commented Aug 17, 2022

!!!!

  • atexit사용 시 릭이 없어야 함. (멘데토리는 exit함수가 허용함수가 아니기 때문에 return으로만 끝남. 릭이 발생한다는건 문제가 있다고 생각)
  • 시간의 자료형은 int고, 시각의 자료형 size_t로 통일 시키는 것이 좋다고 생각.
  • must_eat count가 0일 때에는 어떻게 하면 좋을 지 각자 디펜스 준비하면 좋다고 생각.
    (필자는 필로 수, 시간, 먹는 수에 0을 준다는 것은 에러처리라고 생각)
    => 시간에 0을 주면 join이 안되고 끝나지 않음... 1이상주면 잘 작동 됨.
  • 에러 출력이 printf으로 출력하면 디펜스에서 곤란해짐. 표준에러로 write로 출력하는 것이 바람직하다고 생각.
  • 평가자가 만약에 mutex자체를 왜 fork로 만들었는 지 물어본다면, 이에 대한 디펜스는 준비가 되어 있어야 함.
  • philo_print strstr함수 따로 만들어야 함

[출처] - 42 philosophers subject p.8
Screen Shot 2022-08-17 at 10 24 29 AM
(평가자에 따라 서브젝트에서 fork 상태를 mutex로 감싸는 방식으로 사용해야 한다고 해석할 수도 있음)

@Giromi Giromi added the bug Something isn't working label Aug 17, 2022
@Giromi Giromi self-assigned this Aug 17, 2022
@Giromi
Copy link
Contributor Author

Giromi commented Aug 17, 2022

실행 케이스 정리

minsuki2 노션

https://www.notion.so/Philosophers-47f8ce49460349708b4981e776095e21

상황별로 정리해놨으니 코드블럭 우측상단에 copy해서 실행시켜보세유~

@Giromi
Copy link
Contributor Author

Giromi commented Aug 17, 2022

참고사항

eat_status로 만들면 strstr함수 만들필요 없음
Screen Shot 2022-08-17 at 11 17 50 AM

@joonseong11
Copy link
Contributor

민수키 최고!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants