Reputation: 37259
I have an API call in my application where I am checking the time taken for a single call. I have put this in a FOR loop and using 10000 calls to get the average times of all calls. Now the issue which came up was that the actual application using the API, is multi-threaded. If I wish to make my application also do the same, how would I go about doing this?
The platform is REL and my aim is to send multiple calls in the same time with either the same parameters or different parameters. Can this be implemented in C++ and if so, what library functions to use and can an example be provided for the same?
Upvotes: 0
Views: 727
Reputation: 19704
As of C++11 there is no need to use Boost anymore. C++11 includes std::thread
, supporting mutexes, conditions variables, etc., very much in the way Boost does.
You can have a look at what C++11 provides in terms of threading in the C++ reference.
Upvotes: 0
Reputation: 1727
I don't know the REL platform.
I may suggest the OMP alternative, it's not exactly Threads per say, but it does the job and it's quite easy to use for this kind of scenario. Apparently it run on quite some compilers.
Upvotes: 1
Reputation: 20041
I'm not familiar with the REL platform. In general, I prefer Intel's TBB for threading, but it only runs on x86 chips right now.
Upvotes: 0
Reputation: 349
If you read the Miranda IM source code, it should get you started. It's very well done and there are some nice hints in the code for how to rebase the memory offsets of other executables (on Windows) to make them load faster.
http://www.miranda-im.org/development/
Upvotes: 1
Reputation: 40309
Pthreads is how you'd do it with Linux. Solaris Threads for Solaris.
Upvotes: 0
Reputation: 67178
In what platform? Just about every one supports threads, and I imagine they all have documentation on how to create a thread. Under Windows you'd call the CreateThread API.
Upvotes: 0
Reputation: 14516
Probably the best C++ library to use for threading is the thread library in Boost, but like all C++ threading, you will be forced to manually do your synchronization. You will need to use mutex and lock types to make it work properly. Your question isn't very clear, so I can't really help you any more (though I think you don't actually need threading, but I could be completely misunderstanding).
Upvotes: 7