c++ - Multithreading in VS2010 -


i have c++ dll created in vs2010. dll responsible generating report , sending server. dll called application creates data. since sending file server takes time so, don't want calling application wait till dll busy in sending file server.

to deal above-mentioned issue, want assign task of sending file server (just 1 small function) separate thread , not want wait thread complete (otherwise no benefit).

while(usershutdowntheapp) {     - main app gather data      - main app call data management dll , pass data         - datamanagementdll: generate report         - datamanagementdll: start thread , send report server thread. not wait thread complete     - main app finishes iteration , going enter next iteration.     } 

since, not have control on main calling application, can make modifications inside dll. confused how should implement logic? mean, happens if thread has not completed task of sending file server , meanwhile main calling application has called dll second time.

you should add bit more logic dll. first of all, call dll should not directly sends data server, queue task (simply add passed data internal queue). dll can have internal worker thread should responsible processing queue of tasks.

how internal implementation , architecture should like, depends on existing api (is modifiable or not).

hint - please take @ dllmain() https://msdn.microsoft.com/en-us/library/windows/desktop/ms682583(v=vs.85).aspx - should helpful entry point.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -