Click here to Skip to main content
15,887,214 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Compilation Error Pin
Richard MacCutchan14-Nov-10 23:07
mveRichard MacCutchan14-Nov-10 23:07 
QuestionHow can access the same port by diffreant threads at same time? Pin
Le@rner14-Nov-10 20:12
Le@rner14-Nov-10 20:12 
AnswerRe: How can access the same port by diffreant threads at same time? PinPopular
Cedric Moonen14-Nov-10 20:49
Cedric Moonen14-Nov-10 20:49 
GeneralRe: How can access the same port by diffreant threads at same time? Pin
Le@rner14-Nov-10 21:22
Le@rner14-Nov-10 21:22 
GeneralRe: How can access the same port by diffreant threads at same time? Pin
Cedric Moonen14-Nov-10 21:31
Cedric Moonen14-Nov-10 21:31 
GeneralRe: How can access the same port by diffreant threads at same time? Pin
Le@rner14-Nov-10 21:33
Le@rner14-Nov-10 21:33 
GeneralRe: How can access the same port by diffreant threads at same time? Pin
CPallini14-Nov-10 21:53
mveCPallini14-Nov-10 21:53 
GeneralRe: How can access the same port by diffreant threads at same time? Pin
Cedric Moonen14-Nov-10 21:59
Cedric Moonen14-Nov-10 21:59 
Ok, it is for writing the port, not reading the port then. In that case, I think it is a bit more easier. Anyway, you still need to same principle: the thread that writes to the port creates a queue in which the other threads can push their messages. The access to the queue is protected by critical sections, so that multiple threads cannot write data at the same time in the queue.

To make things a bit easier, you will first need to wrap the SMS data into a specific class (makes it easier to manipulate). Then, you will need to create the queue class: to make things a bit more simple for now, this queue wraps a std::queue with the type of your SMS class. You'll then need to secure the access to the internal queue by using critical section.

After a bit of googling, I found this implementation[^] of a thread-safe queue. Try to understand the code first, then come here and ask specific questions about which part you didn't understand. Then, once you really understood how the code work, you can implement your own version of the queue.
Cédric Moonen
Software developer

Charting control [v3.0]
OpenGL game tutorial in C++

GeneralRe: How can access the same port by diffreant threads at same time? Pin
CPallini14-Nov-10 21:22
mveCPallini14-Nov-10 21:22 
Questionhow to display contents of a text file in EditBox?? [modified] Pin
MahaKh14-Nov-10 19:45
MahaKh14-Nov-10 19:45 
QuestionRe: how to display contents of a text file in EditBox?? Pin
CPallini14-Nov-10 21:28
mveCPallini14-Nov-10 21:28 
AnswerRe: how to display contents of a text file in EditBox?? Pin
Cool_Dev14-Nov-10 21:42
Cool_Dev14-Nov-10 21:42 
QuestionReadDirectoryChangesW failing Pin
Subrat Patnaik14-Nov-10 19:25
Subrat Patnaik14-Nov-10 19:25 
AnswerRe: ReadDirectoryChangesW failing Pin
Richard MacCutchan14-Nov-10 23:05
mveRichard MacCutchan14-Nov-10 23:05 
QuestionOpengl Multithreading (wglMakeCurrent() & wglShareLists() ) issue Pin
James_72214-Nov-10 18:32
James_72214-Nov-10 18:32 
QuestionHow to get the whole view's screen shot when the view has scroll bar ? Pin
wangningyu14-Nov-10 17:34
wangningyu14-Nov-10 17:34 
AnswerRe: How to get the whole view's screen shot when the view has scroll bar ? Pin
Dr.Walt Fair, PE14-Nov-10 18:16
professionalDr.Walt Fair, PE14-Nov-10 18:16 
GeneralRe: How to get the whole view's screen shot when the view has scroll bar ? Pin
wangningyu14-Nov-10 18:49
wangningyu14-Nov-10 18:49 
GeneralRe: How to get the whole view's screen shot when the view has scroll bar ? Pin
Dr.Walt Fair, PE14-Nov-10 19:02
professionalDr.Walt Fair, PE14-Nov-10 19:02 
GeneralRe: How to get the whole view's screen shot when the view has scroll bar ? Pin
wangningyu14-Nov-10 19:06
wangningyu14-Nov-10 19:06 
AnswerRe: How to get the whole view's screen shot when the view has scroll bar ? Pin
Randor 14-Nov-10 19:25
professional Randor 14-Nov-10 19:25 
GeneralRe: How to get the whole view's screen shot when the view has scroll bar ? Pin
wangningyu14-Nov-10 19:27
wangningyu14-Nov-10 19:27 
QuestionHow can find List item click or checkbox click? Pin
Le@rner12-Nov-10 22:22
Le@rner12-Nov-10 22:22 
AnswerRe: How can find List item click or checkbox click? Pin
Richard MacCutchan12-Nov-10 23:36
mveRichard MacCutchan12-Nov-10 23:36 
GeneralRe: How can find List item click or checkbox click? Pin
Le@rner12-Nov-10 23:48
Le@rner12-Nov-10 23:48 

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.