|
I believe they are the same thing.
Worker threads are child threads if they are in the same process.
A child thread closes when the main thread of the program closes.
this is this.
|
|
|
|
|
Conceptually, in MFC we got two type of threads:-
UI threads and worker threads.
Have a look at AfxBeginThread(...) documentation.
Vipin - MVP
|
|
|
|
|
Vipin Aravind wrote: Conceptually, in MFC we got two type of threads:-
UI threads and worker threads.
Specifically, however, they are thread with message pump, and thread without message pump.
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|
|
david, can you explain it a little more? you mean UI->with msg pump and worker without Msg pmup?
VuNic
|
|
|
|
|
one thread (with the message pump ) receives messages from Windows, the other not.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
A "worker thread" can do some UI stuff (e.g., PostMessage() and an occasional SendMessage() ), and a "UI thread" can do worker stuff, so the terms are mostly meaningless.
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|
|
vikas,
What are you working on? I have noticed that you have been posting very basic questions. one or two is fine, but you have posted many of them.
The questions you ask are generally asked my collage students, we can understand about them but you are a working professional working in Embin Technology.
You should really buy a good book and read it nicely and read it again so that you get good knowledge w.r.t windows development.
Take this as an advice, it will help you in your development career too.
coming to ur question,
Worker thread is (generally) a child thread of a process.
Windows actually has the concept of UI Thread (contains windows message queue and a message pump) and worker thread does not have a message queue.
Threads can be created using CreateThread(...) api, All threads that are created are always created as a worker thread i.e. no message queue, whenever someone posts a message to the thread or the thread creates a window, etc (anything that requires the thread to have a message queue) the message queue is created for the worker thread so effectivly the worker thread is now a UI Thread.
why windows does this?
Well the reason is very basic, to save memory, a worker thread which does not deal with any windows message do not need a message queue and so the memory is saved for the thread.
-Prakash
|
|
|
|
|
hmm..you are really caring
VuNic
|
|
|
|
|
I second what he said. I am really surprised too that someone employed somewhere to write such code actually does know so little about the subject.
~RaGE();
|
|
|
|
|
we can create UI(user interface) thread with the CreateThread() or AfxBeginThread ()api
we have to pass the class as a parameter to this function which is derived from the CWinThread and should be able to provide RUNTIME_CLASS.
CWinThread handles the Message pump.
and what we normaly create the threads are worker threads
(i.e passing the threadproc to AfxBeginThread() function)
Thanks and Regards
Laxman
FAILURE is the first step towards SUCCESS
|
|
|
|
|
Hi,
Can anybody tell me how to control the main form. I want to make the main form appear depending on a check that i am going to make. For example when running the exe, i need to check first if the username and password is already present in the Registry. If it is present then i wont show the login. If the login is not correct, i shouldn't get the main form but the login again.In which event of the main form should i do this check so as to make the main form appear depending on the result of this check.
Many Thanks,
Priya
|
|
|
|
|
Why the Borland question in a VC++ forum?
I think you need to tweak the ShowWindow() call in the app's InitInstance() method.
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|
|
I think i gave you the link to borland c++ forum a few days back.
-Prakash
|
|
|
|
|
Hello Experts,
i have a owner draw listctrl. Now for every line in that listctrl the function DrawItem is called. i.e. if 5 lines need to be redrawn i get 5 calls to DrawItem. I would like to have also two notifications before the first call to DrawItem and after all invalid items are redrawn. I could not find anything. Can anyone help me?
Thanks,
Patrick
|
|
|
|
|
How do I convert html to.doc or pdf format?
|
|
|
|
|
|
Hi,
The CListBox::OnNcCalcSize() is not called when the list box does not have vertical scrollbar in its style.
What could be wrong?
I need to customize the border of listbox, but vertical scrollbar cannot be allowed.
Waiting for replies...
Thank you.
- NS -
|
|
|
|
|
In a variable out of the class, we say like
int a[10]={1,2,3,4,..10}.. right?
but we cannot do the same inside the class declaration. ie
class test
{
<code>int a[10]={1,2,3,4,..10}
}
but in the consturctor we cannot say
test()
{
a={1,2,3,4..10};
}
.. how to go about here?
VuNic
|
|
|
|
|
array initialization is not possipble at the time of class declaration because memory for class member is allocat at the time object declaration.
so only in contructor you can initialize as follows :
a[]={1,2,3,...10};
Bankey Khandelwal
Software Engineer
|
|
|
|
|
you still cannot do that
error C2059: syntax error : ']'
VuNic
|
|
|
|
|
because the initialisation is not made as the same time as the declaration (in a class), you cannot use such a thing.
i advise you to do it like this :
<font color=blue>class</font> test {
<font color=blue>int</font> a[10];
<font color=blue>public</font>:
test();
};
<code>--------------------</code>
test::test() {
a[0] = 1;
a[1] = 2;
<font color=green>
a[9] = 10;
}
now, if you have a very long list of values, then you can do the following as better practice :
<font color=blue>class</font> test {
<font color=blue>int</font> a[100];
<font color=blue>public</font>:
test();
};
<code>--------------------</code>
test::test() {
<font color=blue>int</font> tab[100] = {<font color=gray>...val array...</font>};
<font color=blue>for</font> (<font color=blue>int</font> i = 0; i < 100; i++) {
<font color=blue>this</font>->a[i] = tab[i];
}
}
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VCalc 3.0 soon...]
|
|
|
|
|
how about good old memcopy?
its faster too.
|
|
|
|
|
yeah, but what i suggested was to have a local array of the valued into the constructor...
then yes, he could memcpy() the array into this->a
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VCalc 3.0 soon...]
|
|
|
|
|
toxcct wrote: yeah, but what i suggested was to have a local array of the valued into the constructor...then yes, he could memcpy() the array into this->a
yes, that is what i meant.
|
|
|
|
|
hmm.. but do you find OOP a bit hand cuffed here?
VuNic
|
|
|
|