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

C / C++ / MFC

 
AnswerRe: Using multiple cores within a single thread in C++ and MFC Pin
Patrice T22-Nov-16 10:54
mvePatrice T22-Nov-16 10:54 
AnswerRe: Using multiple cores within a single thread in C++ and MFC Pin
Randor 22-Nov-16 12:27
professional Randor 22-Nov-16 12:27 
AnswerRe: Using multiple cores within a single thread in C++ and MFC Pin
David Crow22-Nov-16 12:48
David Crow22-Nov-16 12:48 
AnswerRe: Using multiple cores within a single thread in C++ and MFC Pin
leon de boer22-Nov-16 19:15
leon de boer22-Nov-16 19:15 
QuestionRun time validation in .RC file in VC++ Mfc application Pin
rajmohanpatel21-Nov-16 23:50
rajmohanpatel21-Nov-16 23:50 
AnswerRe: Run time validation in .RC file in VC++ Mfc application Pin
Jochen Arndt22-Nov-16 0:11
professionalJochen Arndt22-Nov-16 0:11 
QuestionTCP server handle Clients, std::map or array? Pin
bestbear20-Nov-16 5:03
bestbear20-Nov-16 5:03 
AnswerRe: TCP server handle Clients, std::map or array? Pin
Afzaal Ahmad Zeeshan20-Nov-16 21:36
professionalAfzaal Ahmad Zeeshan20-Nov-16 21:36 
Quote:
use a std:map, and a mutex over all map operation
Only understandable way to do this. But has some constraints. My assumptions won't consider that using a mutex is necessary unless your application allows asynchronous processing + write access for connected devices. If writing process is maintained by your server program, then you know how to do that — Hint: create a condition inside function and don't make it visible in threads, abstract the implementation.
Quote:
use a C array. and assign an ID(0-10239) for each client if connected,If disconnected,the Id would be recycled.
How about you don't use this. Suppose if there are only 10 clients connected, C array will still allocate all of the areas in RAM. Totally not worth it, and as you said — Id would be recycled —, how? What is your algorithm for that?

There are many parts missing in your post, such as, what data will they access, are they going to write data too, to same file or not — mutex and thread-safety makes sense if something is happening on same time at different threads, if not then don't worry about this.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~

GeneralRe: TCP server handle Clients, std::map or array? Pin
bestbear20-Nov-16 22:23
bestbear20-Nov-16 22:23 
AnswerRe: TCP server handle Clients, std::map or array? Pin
Jochen Arndt21-Nov-16 0:22
professionalJochen Arndt21-Nov-16 0:22 
GeneralRe: TCP server handle Clients, std::map or array? Pin
bestbear21-Nov-16 1:11
bestbear21-Nov-16 1:11 
GeneralRe: TCP server handle Clients, std::map or array? Pin
Jochen Arndt21-Nov-16 2:35
professionalJochen Arndt21-Nov-16 2:35 
GeneralRe: TCP server handle Clients, std::map or array? Pin
bestbear21-Nov-16 2:48
bestbear21-Nov-16 2:48 
QuestionSimple WaitForSingleObject question Pin
ForNow19-Nov-16 16:14
ForNow19-Nov-16 16:14 
AnswerRe: Simple WaitForSingleObject question Pin
Midi_Mick19-Nov-16 17:09
professionalMidi_Mick19-Nov-16 17:09 
GeneralRe: Simple WaitForSingleObject question Pin
ForNow20-Nov-16 10:48
ForNow20-Nov-16 10:48 
AnswerRe: Simple WaitForSingleObject question Pin
Midi_Mick20-Nov-16 14:17
professionalMidi_Mick20-Nov-16 14:17 
QuestionComponent "Assimp" and Export 3D Scene into Graphical File Pin
Onic77719-Nov-16 11:47
Onic77719-Nov-16 11:47 
AnswerRe: Component "Assimp" and Export 3D Scene into Graphical File Pin
leon de boer19-Nov-16 19:17
leon de boer19-Nov-16 19:17 
Questionpkg_config ?? Pin
Vaclav_18-Nov-16 14:27
Vaclav_18-Nov-16 14:27 
AnswerRe: pkg_config ?? Pin
Richard MacCutchan18-Nov-16 21:55
mveRichard MacCutchan18-Nov-16 21:55 
GeneralRe: pkg_config ?? Pin
Jochen Arndt18-Nov-16 22:54
professionalJochen Arndt18-Nov-16 22:54 
GeneralRe: pkg_config ?? Pin
Richard MacCutchan19-Nov-16 1:21
mveRichard MacCutchan19-Nov-16 1:21 
GeneralRe: pkg_config ?? Pin
Vaclav_19-Nov-16 9:29
Vaclav_19-Nov-16 9:29 
GeneralRe: pkg_config ?? Pin
Richard MacCutchan19-Nov-16 12:03
mveRichard MacCutchan19-Nov-16 12:03 

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.