Click here to Skip to main content
16,012,223 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionProblems with Sleep() in thread Pin
acerunner3164-Jan-07 11:42
acerunner3164-Jan-07 11:42 
AnswerRe: Problems with Sleep() in thread Pin
Stephen Hewitt4-Jan-07 12:00
Stephen Hewitt4-Jan-07 12:00 
GeneralRe: Problems with Sleep() in thread Pin
acerunner3164-Jan-07 12:09
acerunner3164-Jan-07 12:09 
GeneralRe: Problems with Sleep() in thread Pin
Stephen Hewitt4-Jan-07 12:19
Stephen Hewitt4-Jan-07 12:19 
GeneralRe: Problems with Sleep() in thread Pin
acerunner3164-Jan-07 14:09
acerunner3164-Jan-07 14:09 
GeneralRe: Problems with Sleep() in thread Pin
Stephen Hewitt4-Jan-07 14:13
Stephen Hewitt4-Jan-07 14:13 
GeneralRe: Problems with Sleep() in thread Pin
acerunner3164-Jan-07 14:18
acerunner3164-Jan-07 14:18 
GeneralRe: Problems with Sleep() in thread Pin
Stephen Hewitt4-Jan-07 14:26
Stephen Hewitt4-Jan-07 14:26 
There are a number of approaches I'd consider:

The first is to abandon the idea of having “super accurate” callbacks. Instead just use a reasonably accurate mechanism, such as SetTimer or your current scheme, but record the time of each sample along with the sample data.

The second would be to use a high priority thread like I described earlier to do all the sampling and fill buffers which can be accessed by the UI thread – with appropriate synchronization.

On a side note be aware that posting messages from another thread is probably only marginally more accurate then using SetTimer.


Steve

GeneralRe: Problems with Sleep() in thread Pin
acerunner3164-Jan-07 14:43
acerunner3164-Jan-07 14:43 
GeneralRe: Problems with Sleep() in thread Pin
Stephen Hewitt4-Jan-07 14:58
Stephen Hewitt4-Jan-07 14:58 
GeneralRe: Problems with Sleep() in thread Pin
Chris Losinger4-Jan-07 12:21
professionalChris Losinger4-Jan-07 12:21 
GeneralRe: Problems with Sleep() in thread Pin
Jörgen Sigvardsson4-Jan-07 14:09
Jörgen Sigvardsson4-Jan-07 14:09 
GeneralRe: Problems with Sleep() in thread Pin
Chris Losinger4-Jan-07 14:28
professionalChris Losinger4-Jan-07 14:28 
GeneralRe: Problems with Sleep() in thread Pin
Jörgen Sigvardsson5-Jan-07 2:13
Jörgen Sigvardsson5-Jan-07 2:13 
GeneralRe: Problems with Sleep() in thread Pin
Chris Losinger5-Jan-07 2:43
professionalChris Losinger5-Jan-07 2:43 
GeneralRe: Problems with Sleep() in thread Pin
acerunner3165-Jan-07 8:47
acerunner3165-Jan-07 8:47 
GeneralRe: Problems with Sleep() in thread Pin
Chris Losinger5-Jan-07 8:59
professionalChris Losinger5-Jan-07 8:59 
GeneralRe: Problems with Sleep() in thread Pin
acerunner3165-Jan-07 14:38
acerunner3165-Jan-07 14:38 
GeneralRe: Problems with Sleep() in thread Pin
Chris Losinger5-Jan-07 17:19
professionalChris Losinger5-Jan-07 17:19 
GeneralRe: Problems with Sleep() in thread Pin
acerunner3168-Jan-07 8:41
acerunner3168-Jan-07 8:41 
GeneralRe: Problems with Sleep() in thread Pin
Chris Losinger8-Jan-07 8:55
professionalChris Losinger8-Jan-07 8:55 
GeneralRe: Problems with Sleep() in thread Pin
acerunner3168-Jan-07 9:11
acerunner3168-Jan-07 9:11 
GeneralRe: Problems with Sleep() in thread Pin
Chris Losinger8-Jan-07 10:32
professionalChris Losinger8-Jan-07 10:32 
AnswerRe: Problems with Sleep() in thread Pin
Mark Salsbery4-Jan-07 12:55
Mark Salsbery4-Jan-07 12:55 
AnswerRe: Problems with Sleep() in thread Pin
ThatsAlok4-Jan-07 18:02
ThatsAlok4-Jan-07 18:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.