Kdelphinus / 42born2code

42 Seoul의 프로젝트들
6 stars 0 forks source link

이게 뭔가요 #3

Closed hyobb109 closed 1 year ago

hyobb109 commented 1 year ago

https://github.com/Kdelphinus/42born2code/blob/b5dc56f95607689a4913783fe3a870cfdf21ca1e/Philosophers/philo/src/philo_dining.c#L45-L55

destroy 실패하면 언락하는게 뭐죠? 이래도 되는건가요?

Kdelphinus commented 1 year ago

destory가 실패할 때가 1) 뮤텍스가 잘못 만들어졌거나 2) lock이 되어있는 상태일 때인데 1번의 경우는 create할 때 걸렀기 때문에 무조건 2번 경우라 생각하고 예외처리했습니다 ㅎㅎ

Kdelphinus commented 1 year ago

문 닫겠습니닼ㅋㅋㅋ

hyobb109 commented 1 year ago

언락을 미리 했어야하는거 아닌가여 리트 하십쇼 ㅋㅋㅋㅋㅋㅋ

Kdelphinus commented 1 year ago

중간에 스레드의 동작이 멈출수도 있잖아요. 예를 들어 식사 도중에 급하게 끝내야 하거나 뭐 그런거? ㅋㅋㅋㅋㅋㅋ 그래서 했습니다. 언락은 잘 되요. ㅎㅎㅎㅎ