본문 바로가기

Graphics Programming

검색하기
Graphics Programming
프로필사진 minseoklee

  • -전체목록- (140)
    • Season 2 (33)
    • Season 1 (107)
      • OpenGL (26)
      • 수학 (15)
      • 플래시 (29)
      • 하스켈 (21)
      • Problem solving (8)
      • Misc (8)
Guestbook
Notice
  • Haskell 레퍼런스
  • 컴퓨터 그래픽스 레퍼런스
Recent Posts
Recent Comments
Link
  • 엔비디아 개발자 센터
  • AMD GPUOpen
  • IBM developerWorks
  • 마이크로소프트 리서치
  • SIGGRAPH (real time rendering)
  • Morgan McGuire
  • Wolfram MathWorld
  • LaTeX 수식입력기
  • Famous Curves
관리 메뉴
  • 글쓰기
  • 방명록
  • RSS
  • 관리

목록2019/03/09 (1)

Graphics Programming

맨날 까먹는 std 컨테이너 resize와 reallocate

멀티쓰레딩 하려고 쓰레드 풀 만들다가 또 당했다. // std::vector queue; bool ThreadPool::PopWork(ThreadPoolWork& work){ bool ret = true; queueLock.lock(); if(queue.size() == 0) { ret = false; } else { work = queue[queue.size() - 1]; queue.pop_back(); } queueLock.unlock(); return ret;} 얼핏 아무 문제 없어보였는데 pop_back()을 하면서 queue의 크기가 변하고, reallocate되어버렸다. 쓰레드 엔트리 함수에 work에 대한 포인터를 인자로 넘길 건데, 컨테이너가 재할당돼서 메모리 위치가 바뀌어버렸고 작업 쓰레..

Season 2 2019. 3. 9. 15:45
이전 Prev 1 Next 다음

Blog is powered by kakao / Designed by Tistory

티스토리툴바