Click here to Skip to main content
14,691,559 members
Home » Discussions » C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Thread synchronization problem Pin
samzcs10-Sep-18 11:09
Membersamzcs10-Sep-18 11:09 
GeneralRe: Thread synchronization problem Pin
Richard Andrew x6410-Sep-18 11:11
professionalRichard Andrew x6410-Sep-18 11:11 
GeneralRe: Thread synchronization problem Pin
samzcs10-Sep-18 11:28
Membersamzcs10-Sep-18 11:28 
QuestionRe: Thread synchronization problem Pin
CPallini10-Sep-18 22:02
mveCPallini10-Sep-18 22:02 
AnswerRe: Thread synchronization problem Pin
samzcs11-Sep-18 3:45
Membersamzcs11-Sep-18 3:45 
GeneralRe: Thread synchronization problem Pin
CPallini11-Sep-18 4:23
mveCPallini11-Sep-18 4:23 
AnswerRe: Thread synchronization problem Pin
leon de boer10-Sep-18 23:08
Memberleon de boer10-Sep-18 23:08 
GeneralRe: Thread synchronization problem Pin
samzcs11-Sep-18 3:50
Membersamzcs11-Sep-18 3:50 
Thank you very much for the answer.

But the C program is in an embedded device, it's not a pre-emptive task environment, just a forever loop cycle, in which, some functions be called in 10 ms cycle, some functions be called in 5 ms cycle.
each cycle I called it a task.

The structure like a simple scheduler using while(1) loop.

Task A (or Cycle A) is a 10 ms cycle, and Task B is a 5 ms cycle, just use a counter to implemented the 10 ms , 5 ms cycle, like
while(1) 
{
  count ++;
  if (count == 5)
  {
     task B be called
  }
  if (count == 10) 
  {
    count = 0;
    task A be called.
  }
}



Thanks
GeneralRe: Thread synchronization problem Pin
leon de boer11-Sep-18 6:05
Memberleon de boer11-Sep-18 6:05 
GeneralRe: Thread synchronization problem Pin
11917640 Member 11-Sep-18 20:53
Member11917640 Member 11-Sep-18 20:53 
GeneralRe: Thread synchronization problem Pin
samzcs12-Sep-18 9:12
Membersamzcs12-Sep-18 9:12 
GeneralRe: Thread synchronization problem Pin
leon de boer12-Sep-18 19:31
Memberleon de boer12-Sep-18 19:31 
GeneralRe: Thread synchronization problem Pin
11917640 Member 12-Sep-18 19:58
Member11917640 Member 12-Sep-18 19:58 
AnswerRe: Thread synchronization problem Pin
«_Superman_»23-Sep-18 23:26
professional«_Superman_»23-Sep-18 23:26 
QuestionBreak when address reading Pin
Member 130813699-Sep-18 16:47
MemberMember 130813699-Sep-18 16:47 
AnswerRe: Break when address reading Pin
Victor Nijegorodov10-Sep-18 3:04
MemberVictor Nijegorodov10-Sep-18 3:04 
GeneralRe: Break when address reading Pin
Member 1308136910-Sep-18 16:45
MemberMember 1308136910-Sep-18 16:45 
AnswerRe: Break when address reading Pin
leon de boer10-Sep-18 3:12
Memberleon de boer10-Sep-18 3:12 
GeneralRe: Break when address reading Pin
Member 1308136910-Sep-18 16:49
MemberMember 1308136910-Sep-18 16:49 
AnswerRe: Break when address reading Pin
Richard Andrew x6410-Sep-18 9:17
professionalRichard Andrew x6410-Sep-18 9:17 
GeneralRe: Break when address reading Pin
Member 1308136910-Sep-18 16:50
MemberMember 1308136910-Sep-18 16:50 
AnswerRe: Break when address reading Pin
«_Superman_»23-Sep-18 23:30
professional«_Superman_»23-Sep-18 23:30 
Questionconfusion about fonts in Windows Pin
Alexander Kindel6-Sep-18 9:43
MemberAlexander Kindel6-Sep-18 9:43 
AnswerRe: confusion about fonts in Windows Pin
leon de boer6-Sep-18 18:12
Memberleon de boer6-Sep-18 18:12 
GeneralRe: confusion about fonts in Windows Pin
Alexander Kindel6-Sep-18 19:21
MemberAlexander Kindel6-Sep-18 19:21 

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.