Can anyone tell me how to use multitasks???
Please?
Can anyone tell me how to use multitasks???
Please?
Sauron a few seconds before his defeat:
"What? A 'division by 0' error?!?"
In all of my years of living on this fine planet;
Of all of the knowledge that I have acquired;
Among all of the arts that have been taught;
Never was there one such as multi---tasking;
Multi---tasking is the art of doing more than one tasks at a time.
For some the art takes a lifetime to master for me, I have know it sense birth. When I was first born I knew how to cry and yet burp at the same time. When I was eight I knew how to fall from my bike and scream. My greatest accomplishment of all was when I first Burped, Farted, Cried, and Hiccupped all at the exact same moment. That was the pinnacle of my accomplishments. Now it is ok for me to call myself a true master of this art of: Multi---tasking.
try _beginthread
ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.
And how do I use that _beginthread -thing???
Sorry , to dissapoint you , but it is not possible using just the C standard ibraries , the solution will be OS -specific .
repost,
if you have MSVC use the MSDN, borland builder has a library that has it.
if you don't have those,
unsigned long _beginthread( void( __cdecl *start_address )( void * ), unsigned stack_size, void *arglist );
Paramaters:
start_address
Start address of routine that begins execution of new thread
stack_size
Stack size for new thread or 0
arglist
Argument list to be passed to new thread or NULL
void _endthread(void)
used to terminate the thread created by begin thread.
use them like so
Code:int counter = 0; // this functio must be declaread in this format void myfunc(void*) void ThreadFunc(void* v) { while(counter < 10000); _endthread(); // must be called to cleanup after thread } main() { bool done = false; // do not include the parentheses when passing the function to beginthread _beginthread(ThreadFunc,0,NULL); while(!done) { if(counter%1000) printf("Counter:%d",counter); } return 0; }
this shuld print the value of counter ten times
ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.
Can u be more specific. It depends on what environment u are running on eg Solaris, Linux, Vxworks. In Solaris, Linux, Multitasks refer to Mutithreaded enviroment it can also refer to multiple processed with different scheduling policies set. For details to refer to any book on Inter process Communications.
In case of VXWORKS, u can have many tasks( similar to processes in Unix flavours) running with same prioritys of different priority. I hope I could help u in this regard. If want to know u need to be more specific.
If you have any other questions please contact me at
[email protected]
[email protected]
Thankyou for answering.
I truely appreciate it.
Btw.
How should I spell the word "appreciate"???
Sauron a few seconds before his defeat:
"What? A 'division by 0' error?!?"