|
I have developed a VC++ program based on communication(online program). In
the application,i have used two threads for computation. The working time
of two threads is very less. my query is ...
1)If the thread is opened and closed each time for computation, will
the program memory grow??? or what is the drawback??
OR
Is it advisable to run the thread with sleep mode without closing the
thread??
Help me......
Empty mind is Devils-Workshop
|
|
|
|
|
madhu_v wrote: 1)If the thread is opened and closed each time for computation, will
the program memory grow??? or what is the drawback??
OR
every time when thread is created it will take some memory.. i.e. overhead.., if computation take less time , then why creating thread , why not include in main program!
madhu_v wrote: s it advisable to run the thread with sleep mode without closing the
thread??
yes and no! wholly depend upon the software design.. you can use event or waitforsingleobject to make thread wait
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Thread creation is a relatively expensive operation, both in space and time. If you spawn a thread and let it run to completion nothing is permanently lost however - assuming of course that your code doesn't contain any memory (or other resource) leaks.
If you’ve got lots of small tasks you want to run in another thread and you spawn a thread for each task you could easily find that the thread creation and destruction time dominates and causes performance problems. One solution to this is to use a thread pool. See the QueueUserWorkItem API.
Steve
|
|
|
|
|
Hi Folks,
I am getting this linker error :
error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xran(void)const " (?_Xran@_String_base@std@@$$FQBEXXZ)
Does any of you encountered this before ?? am using VS2003 IDE...
Please let me know if you have the solution..
Thanks,
Hariharan.T
|
|
|
|
|
I'm using without problem
<br />
#include <list><br />
using namespace std;<br />
...<br />
std::_String_base a;<br />
a._Xran();<br />
|
|
|
|
|
Hi WhiteSky,
Actualy i dont use this _Xran function...
The problem is i have used Vectors in an unmanaged Dll which am trying to consume in a managed C++ Dll. this is where i get the linker error. any ideas why ??
Hariharan.T
|
|
|
|
|
It is possible to detect from the OS when file is being opened / run?
E.g. double clicking on a desktop / folder icon, or executing through the run command.
Thanks for any help.
|
|
|
|
|
|
i want make a dll by vc6 , and call it by vb6(because the wmi in vc timeout faster than vb, or i can use multithread in vc to cut the wmi connection when time is over)
the program is no err complied and linked
but when i call the fun in vb6, i got an error 0X80010106 when Initialized COM
"Cannot change thread mode after it is set."
i searched it on internet ,i can't understand clearly with "COM CDO STA",
how can i do ? please help me !
---------------------------code------------------------------
__declspec(dllexport) long __stdcall CheckWMI(char * HostIP, char * userName, char * passWord)
{
mainCRTStartup();
HRESULT hres;
// Step 1: --------------------------------------------------
// Initialize COM. ------------------------------------------
hres = CoInitializeEx(0, COINIT_MULTITHREADED);
if (FAILED(hres))
{
........
-------------------------------code---------------------------------------
|
|
|
|
|
this[^] article may be useful for your need.
|
|
|
|
|
difference between the copy constructor and assignment operator
|
|
|
|
|
is this supposed to be a question ? i mean, grammaticaly speaking, you missed the punctuation and the fundamentals of "how to well form a sentence"...
i think you wanted to say : "What is the difference between copy constructors and assignment operators for a know type ?".
well, if yes, the answer is simple. the copy constructor can be called once in an object life (at the beginning), when the operator can be called anytime.
technically, they do what you tell them to do, so the object can result in being in the same state after both operations, but all depends on what you coded there...
|
|
|
|
|
MY QUESTION IS
What the copy constructor is doing we can do the same thing through assignment operator.So what is the advantage of copy constructor
class A
A a;
A b;
a=b;
|
|
|
|
|
sarojkumarjena wrote: MY QUESTION IS
Dont use caps while expecting others to help.
sarojkumarjena wrote: What the copy constructor is doing we can do the same thing through assignment operator.So what is the advantage of copy constructor
copy constructor is called when object is function argument , passed by value.
when object is returning by value, and object is initializing using other object. i.e.
class A
A a;
A b=a;
|
|
|
|
|
copy constructors are sometimes called implicitely when using templates containers, or things like this.
if you don't provide one, you'll get a compiler error saying that no copy constructor were found for the type xxx...
moreover, when passing objects by value to/from functions, the objects are duplicated, thus the copy constructor
|
|
|
|
|
sarojkumarjena wrote: What the copy constructor is doing we can do the same thing through assignment operator.So what is the advantage of copy constructor
The assignment operator destroys/replaces an existing object. The copy constructor creates an object as copy of another object.
|
|
|
|
|
SilentSilent wrote: The assignment operator destroys an existing object
false in the sense that it doesn't call the object's destructor, but true in the sense that it modifies the object integrity
|
|
|
|
|
Any constructor, including a copy constructor, builds the object from uninitialized memory. Once the object is "built" all the class's invariants have been established.
An assignment operator sets the state of the object but the class invariants have already been established by a constructor.
Steve
|
|
|
|
|
You might what to implement the copy construtor or assignment operator to do a deep copy instead of shallow copy and also if you want to do any specific thing while doing the copy.
-Prakash
|
|
|
|
|
Hi all,
sorry for posting this question here, but I know that VC++ developers are the best.
Does Windows Media Player Mobile supports audio plug-ins? I want to develop an equalizer and I wonder if there is a support for this.
Plz also, I wonder if I can email microsoft for programming questions, is there an email for microsoft to give such support??
Regards
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
Mohammad A Gdeisat wrote: Does Windows Media Player Mobile supports audio plug-ins? I want to develop an equalizer and I wonder if there is a support for this.
yes they do! you have to visit MSDN.microsoft.com and search MEDIA player!
Mohammad A Gdeisat wrote: Plz also, I wonder if I can email microsoft for programming questions, is there an email for microsoft to give such support??
for that you have to own the MSDN library, they are equiped with 5 support instance
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Thanks for your reply,
I was taking a tour in media player sdk, and I read the following about windows media player mobile:
ThatsAlok wrote:
Windows Media Player 10 Mobile uses the same UI plug-in model as the desktop Windows Media Player. However, Windows Media Player 10 Mobile can only interact with background UI plug-ins. Because of the similar plug-in models, the same API calls that apply to background UI plug-ins on the desktop also apply to background UI plug-ins on a Windows Mobile device.
In the sdk, microsoft divided plug-ins into four classes:
1. Custom visualizations
2. User interface plugins.
3. DSP plug-ins
4. Rendering plug-ins.
so, can I conclude that WMP mobile does not support dsp plug-ins?? in other words, does this mean I cant develop an equalizer for Pocket WMP??
Thank you
Mohammad
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
Mohammad A Gdeisat wrote: the sdk, microsoft divided plug-ins into four classes:
Mohammad A Gdeisat wrote: n the sdk, microsoft divided plug-ins into four classes:
1. Custom visualizations
2. User interface plugins.
3. DSP plug-ins
4. Rendering plug-ins
Mohammad A Gdeisat wrote: o, can I conclude that WMP mobile does not support dsp plug-ins??
isn't above two statement are contradictory!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
sorry, but what I mean here is that the desktop version of Windows Media Player supports the above four plugin classes, however, a subset of this support is included in the Mobile (PDA) version of media player which is the user interface plug-ins.. please re-read the SDK quote and tell me what you think...
Thanks alot for your time
Mohammad
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
Mohammad A Gdeisat wrote: please re-read the SDK quote and tell me what you think...
could you point me exact SDK link!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|