I'm using V100:R2 camera, and MFC program.
I made program like this.
i) Initializing the cameras in main thread
ii) Making another thread, and getting the camera data by the thread
iii) On OnTimer, using the Sleep(100) command in the main thread
In this program, I can't get camera data in some frame.
Would you tell me advice to solve this problem, and would you tell me the reason why this program doesn't work correct?
Thanks.
Sleep() in main thread
-
- Posts: 46
- Joined: Thu Oct 21, 2010 2:02 am
- Location: Japan
Re: Sleep() in main thread
Hey Cat,
This is certainly a valid arrangement for an application that utilizes the Camera SDK.
However, you don't want to put a Sleep() in the OnTimer() function. The goal for an OnTimer() function is to do what you need to do and exit the function. By putting a Sleep(100) in the OnTimer() function you're stalling execution for 1/10th of a second, which is a deal breaker. I would suggest removing the Sleep() function in this case.
This is the opposite of the other situation we discussed where you had a tight While() loop, which requires you put a Sleep() in the function in order to yield to other processes or else you'll drive the CPU to 100% and starve the Camera SDK and other processes.
This is certainly a valid arrangement for an application that utilizes the Camera SDK.
However, you don't want to put a Sleep() in the OnTimer() function. The goal for an OnTimer() function is to do what you need to do and exit the function. By putting a Sleep(100) in the OnTimer() function you're stalling execution for 1/10th of a second, which is a deal breaker. I would suggest removing the Sleep() function in this case.
This is the opposite of the other situation we discussed where you had a tight While() loop, which requires you put a Sleep() in the function in order to yield to other processes or else you'll drive the CPU to 100% and starve the Camera SDK and other processes.
-
- Posts: 46
- Joined: Thu Oct 21, 2010 2:02 am
- Location: Japan
Re: Sleep() in main thread
Thank you for replying ma question.
I tested some condition about getting the camera data by making the another thread.
I found that it can't be get frame, if it isn't executed message dispatching.
Would you tell me how long can the camera wait message dispatching about V100:R2 camera and S250e camera?
Thanks
I tested some condition about getting the camera data by making the another thread.
I found that it can't be get frame, if it isn't executed message dispatching.
Would you tell me how long can the camera wait message dispatching about V100:R2 camera and S250e camera?
Thanks