Run "While loop" in background [closed] - c++

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I have a Credential Provider dll application in C++. Inside this dll i create a process that will write some data in a file. I need somehow to read that data from file till the value is > -1. I can not use a while loop because my dll will stop loading till the while loop will end. Can i use a separate thread to do this and to get a notification to run a function from my dll when the while loop end? How can i do this? Is there a simple way to do this?
Thank you.

The only really practical way to achieve concurrency is using threads. Take a look at boost threads.

If your compiler implements C++0x thread, then you can make use of it.
Read this extensive tutorial on C++0x multi-threading : Multithreading in C++0x part 1: Starting Threads

Related

Multithreaded Webserver in C++ [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I want to do a multithreaded Webserver with scheduling and synchronization in C++.This is an assignment problem and I am not asking the code.I have done till the socket connection in server but I dont know how to proceed.I just want some hints or flow for the program.
Here are the few questions I have
1) I have done till socket accept().So when new connection comes I have to fork() and then close the connections of the child process.Is that right?
2) How must I make sure the program is synchronized wth so many threads running?
3) I must have 2 thread pools.1 pool of workers and in the other 2,1 each for acepting connection and inserting the request to ready queue.How can this be done?
I am not asking the code.I just need some hints and guidance.Thanks a lot.
Very interesting course work , if you get you head around this one a lot of concepts will become clear namely concurrency and one of its major use cases I.e. networking!
I used the following article myself to get a quick summary of my options in network concurrency in Linux
http://m.linuxjournal.com/content/three-ways-web-server-concurrency?page=0,0
This article give very high level intros to concepts tha thou will need like copy on write for forked processes and as a result separate address spaces negating sync in certain cases, once you have read this you will have more specific question that you can as once you start getting your hands dirty starting with the code in this article.

Sequential and running in one thread time difference c++ [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
Here is my source code for testing multithread performance in C++. Please tell me why is time about 5x smaller for ONE thread running(WaitForMultipleObject()) then first sequential performance. I expect almost same result for sequential performance and running with only one thread. Thanks
http://pastebin.com/EeJ5qW03
OS will decide when will your thread start running and it will also decide if there's a need for dispatching, perhaps. Add to that, it also has to create a separate stack for your thread, perhaps.
Read about the overhead on thread creation. All in all, the overhead is system specific.

when use DLL in c++? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
For the last 3 weeks I've been trying to create a code generator and my boss told me to put into a plugin DLL so we can call it next time when we want to reuse it !
So I searched the web for a Dll meaning but it still kind of vague , so if you have a better simple definition or a clear idea about DLL in C++ for beginners please enlighten me.
Another thing : I noticed that some uses QT to create plugin , so what's in QT that give us the possibility to do that that we can't find in any other IDE ?
PS: I've never used QT!
DLL-Dynamic Link Library is classes, methods and procedures packaged up into a compiled file to be used in conjunction with other programs. Its similar to an executable .exe file except you don't need a main method.

C++ multiple process shared memory implementation [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
Here's what I am trying to accomplish.
I want program1 to create a shared memory segment where I store various arrays.
Then, I want program2 to read in the arrays and modify them.
This sounds pretty simple, but for some reason, I cannot find a single example online that shows how this is done. Every example I have found uses a single program (e.g the initialize, read and write are both done by program1).
If somebody can provide an example here, I'm sure this would be hugely beneficial for pretty much everybody that wants to use IPC in C++.
Boost.Interprocess has a guide for the impatient.

How to start programming with threads in MFC C++? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
i need to create new thread (diffrent class) using cwinthread or afxbeginthreads. i have no idea how to start and which one of them i need to use. help please...
thanks
There are two types of thread in MFC:
worker threads simply perform a task in the background then exit
user-interface threads which have a message pump i.e. you can PostMessage to it
When I used it in MFC a long time ago I very much disliked not being able to create the class because they force you to do it with their factory, and thus you cannot initialise it with parameters it needs to use to execute, as InitInstance() on it also takes no parameters (I think). In other words you really cannot pass them any context data unless you create them suspended, which I found I always had to do.
Worker-threads are the kind of thing I also would prefer to do without MFC since I intensely disliked the intrusiveness of MFC into non-GUI code, i.e. I didn't mind it so much as a Widgets library but found once you put it your project you were "stuck" with it.
I have had to support MFC projects but any new code areas within the project I would stay away from MFC and even use Win32API if possible.
Hi you can read this article http://msdn.microsoft.com/en-us/library/69644x60(v=vs.80).aspx and this one in class