며칠 전 개발하면서 겪었던 상황인데,
fork 된 child process에서는 localtime_r 과 같은 시간관련 함수를 사용할때 유의해야 한다.
이 블로그 검색
2017년 12월 3일 일요일
2011년 9월 20일 화요일
protothread : Duff's device
protothread 란 것을 보던중에 아래와 같은 소스를 발견.
그동안 몰랐던 이상야릇한 C언어 switch 구문형태이다~
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | int counter = 0; int n = 0; int somefun() { switch(n){ case 0: while(1){ n = 12; case 12: if(!(counter == 1000)) return 0; printf("Threshold reached\n"); counter = 0; } } n = 0; return 2; } int _tmain(int argc, _TCHAR* argv[]) { somefun(); // case 0 somefun(); // case 12 return 0; } |
피드 구독하기:
글 (Atom)