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

C / C++ / MFC

 
QuestionAccessing file from a remote location Pin
_AnsHUMAN_ 6-Dec-11 1:12
_AnsHUMAN_ 6-Dec-11 1:12 
AnswerRe: Accessing file from a remote location Pin
Code-o-mat6-Dec-11 1:34
Code-o-mat6-Dec-11 1:34 
QuestionRe: Accessing file from a remote location Pin
Rajesh R Subramanian6-Dec-11 2:46
professionalRajesh R Subramanian6-Dec-11 2:46 
AnswerRe: Accessing file from a remote location Pin
_AnsHUMAN_ 6-Dec-11 16:52
_AnsHUMAN_ 6-Dec-11 16:52 
GeneralRe: Accessing file from a remote location Pin
Rajesh R Subramanian6-Dec-11 18:15
professionalRajesh R Subramanian6-Dec-11 18:15 
GeneralRe: Accessing file from a remote location Pin
pix_programmer6-Dec-11 19:30
pix_programmer6-Dec-11 19:30 
AnswerRe: Accessing file from a remote location Pin
Rajesh R Subramanian6-Dec-11 20:03
professionalRajesh R Subramanian6-Dec-11 20:03 
GeneralRe: Accessing file from a remote location Pin
KjellKod.cc6-Dec-11 20:16
KjellKod.cc6-Dec-11 20:16 
I think the producer consumer example is the way to go, but maybe a version of that using asynchronous workers would help the most. What I have in mind would limit the threaded complexity to a minimum while still achieving very good performance.

If you are using Qt then my answer would be slightly different but in short I would do like this

Assuming I understood you correct and you do not have access
to c++11 or concurrency library features like future or asynch run., I am also assuming that it is OK that the zip files are unzipped in a non-deterministic order.

1. A thread, maybe the main thread, tells a worker to start downloading one or several zip files.

2. As soon as a zip file is downloaded it is handed over to another worker that is unzipping the file at the wanted location

3. When a zip file is downloaded and unzipped then this is communicated back to the original calling thread

4. Communication between "participants" is done solely through message queues. No shared memory except the queue, that way data sharing and thread synchronization issues are minimal.

5. The "design pattern" I have in mind for this is the active object. There is plenty of material if you google for it. My favourite is Herb Sutters take on it.
I wrote my version of active object, which should be easy to use, maybe after making minimal change to use whatever thread library you use.

Another example., although more of the fire and forget nature than your scenario., is the asynchronous logger g2log
that I recently wrote about. Check in the code how the messages are passed from the g2logworker to it's thread internal and you will see how easy it is

modified 7-Dec-11 2:55am.

SuggestionRe: Accessing file from a remote location Pin
David Crow7-Dec-11 6:24
David Crow7-Dec-11 6:24 
Questionconvert from 'LPCTSTR' to 'const char *' Pin
Le@rner6-Dec-11 0:31
Le@rner6-Dec-11 0:31 
AnswerRe: convert from 'LPCTSTR' to 'const char *' Pin
Code-o-mat6-Dec-11 1:31
Code-o-mat6-Dec-11 1:31 
AnswerRe: convert from 'LPCTSTR' to 'const char *' Pin
Richard MacCutchan6-Dec-11 1:48
mveRichard MacCutchan6-Dec-11 1:48 
AnswerRe: convert from 'LPCTSTR' to 'const char *' Pin
Rajesh R Subramanian6-Dec-11 2:00
professionalRajesh R Subramanian6-Dec-11 2:00 
QuestionSendMessage with WM_SETFOCUS and SetFocus() function Pin
msr_codeproject5-Dec-11 23:45
msr_codeproject5-Dec-11 23:45 
AnswerRe: SendMessage with WM_SETFOCUS and SetFocus() function Pin
Richard MacCutchan5-Dec-11 23:50
mveRichard MacCutchan5-Dec-11 23:50 
AnswerRe: SendMessage with WM_SETFOCUS and SetFocus() function Pin
Albert Holguin6-Dec-11 3:34
professionalAlbert Holguin6-Dec-11 3:34 
Questionwhy pApplication.CreateInstance( _T("Excel.Application") ) FAILED? Pin
Le@rner5-Dec-11 19:45
Le@rner5-Dec-11 19:45 
AnswerRe: why pApplication.CreateInstance( _T("Excel.Application") ) FAILED? Pin
CPallini5-Dec-11 21:47
mveCPallini5-Dec-11 21:47 
GeneralRe: why pApplication.CreateInstance( _T("Excel.Application") ) FAILED? Pin
Le@rner5-Dec-11 22:17
Le@rner5-Dec-11 22:17 
GeneralRe: why pApplication.CreateInstance( _T("Excel.Application") ) FAILED? Pin
Richard MacCutchan5-Dec-11 22:35
mveRichard MacCutchan5-Dec-11 22:35 
GeneralRe: why pApplication.CreateInstance( _T("Excel.Application") ) FAILED? Pin
CPallini5-Dec-11 22:38
mveCPallini5-Dec-11 22:38 
GeneralRe: why pApplication.CreateInstance( _T("Excel.Application") ) FAILED? Pin
Richard MacCutchan5-Dec-11 23:47
mveRichard MacCutchan5-Dec-11 23:47 
GeneralRe: why pApplication.CreateInstance( _T("Excel.Application") ) FAILED? Pin
CPallini5-Dec-11 22:36
mveCPallini5-Dec-11 22:36 
GeneralRe: why pApplication.CreateInstance( _T("Excel.Application") ) FAILED? Pin
Le@rner17-Jan-12 1:17
Le@rner17-Jan-12 1:17 
GeneralRe: why pApplication.CreateInstance( _T("Excel.Application") ) FAILED? Pin
CPallini17-Jan-12 1:36
mveCPallini17-Jan-12 1:36 

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.