기술 관련 글2016. 8. 9. 14:25

아무래도 개인적인 취향으로 Windows에서 개발하는게 너무 편하다고 느끼고 있다.


그래서 Windows에서도 git을 사용하게 되는데, git-diff를 하게 되면 ^M이 골칫거리가 될 수 있다.


물론 core.autocrlf를 true로 설정하면, checkout 할 때는 Windows style(CRLF)로, push할 때는 UNIX style(LF)로 처리해 주는 옵션이 있는데, 기존의 repository를 이용하거나 기타 상황에서는 불편한 경우가 생기기도 한다.


그래서 찾아봤더니 core.whitespace라는 옵션이 있고, 값에 cr-at-eol을 추가 해 주면 ^M으로 표시되는 CR이 git-diff에서 무시된다.


git config에 대한 help 페이지를 보면, 아래와 같이 설명이 되어 있다.

core.autocrlf

Setting this variable to "true" is almost the same as setting the text attribute to "auto" on all files except that text files are not guaranteed to be normalized: files that contain CRLF in the repository will not be touched. Use this setting if you want to have CRLF line endings in your working directory even though the repository does not have normalized line endings. This variable can be set to input, in which case no output conversion is performed.


Console에서 아래와 같이 입력하면 설정이 가능하다.

git config --global core.whitespace cr-at-eol


자세한 설명은 google로 검색했던 다음 사이트를 참고하면 된다.

https://lostechies.com/keithdahlby/2011/04/06/windows-git-tip-hide-carriage-return-in-diff/


Posted by 세월의돌
프로그래밍 언어2016. 7. 25. 16:47

Boost libarary를 공부하고 있는데,

Chapter 10: Concurrency with Boost 부분을 마치고, reference에 Herb Sutter의 강연 동영상 링크가 있길래 호기심에 찾았다가, 좋은 내용인것 같아서 이틀에 걸쳐 시청을 완료했다.

Lock-free programming에 대해 친절하게 설명해 주고 있어, 나중에 다시 참고할 필요가 있을 것 같아 갈무리 해 둔다. (시간이 지나면 또 잊어 버릴 수 있으니... oTL)


Multi-threaded programming을 많이 하지 않다보니, 취약한 부분인데 많은 도움이 되었던 것 같고, 중요(?) 키워드는 다음과 같다.

  • std::atomic 또는 std::atomic_xxx()
  • ABA problem - 첫 번째 thread가 최초 참조한 object가, 두 번째 thread에 의해 변경(삭제 후 다시 생성하였지만, 동일한 주소 또는 위치를 유지)되었지만, 실제로는 다른 object로 변경된 경우 발생하는 문제
  • Linearizability - concurrent programming에서, 두 operation이 겹쳐진 경우(overlapped)에도, 결과적으로는 순차적으로 실행된 것처럼 동작하는 성질(?)
  • Constructor와 destructor는 concurrency관련 이슈가 없다. (instance의 lifetime은 destructor가 호출 되는 순간 끝난다)


다음에 짬 내서, "Herb Sutter - atomic<> Weapons"도 봐야겠다.









Posted by 세월의돌