Multitask

This is a discussion on Multitask within the C Programming forums, part of the General Programming Boards category; Can anyone tell me how to use multitasks??? Please?...

  1. #1
    Registered User
    Join Date
    Aug 2001
    Posts
    100

    Question Multitask

    Can anyone tell me how to use multitasks???

    Please?
    Sauron a few seconds before his defeat:
    "What? A 'division by 0' error?!?"

  2. #2
    A man of little sense
    Guest

    Lightbulb The art of multi-tasking

    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.

  3. #3
    Has a Masters in B.S.
    Join Date
    Aug 2001
    Posts
    2,267
    try _beginthread
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

  4. #4
    Registered User
    Join Date
    Aug 2001
    Posts
    100

    Unhappy ???

    And how do I use that _beginthread -thing???

  5. #5
    Registered User pinko_liberal's Avatar
    Join Date
    Oct 2001
    Posts
    284
    Sorry , to dissapoint you , but it is not possible using just the C standard ibraries , the solution will be OS -specific .

  6. #6
    Has a Masters in B.S.
    Join Date
    Aug 2001
    Posts
    2,267
    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.

  7. #7
    Unregistered
    Guest
    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
    venu_m_j@yahoo.com
    venumadhavj@hotmail.com

  8. #8
    Registered User
    Join Date
    Aug 2001
    Posts
    100

    Thanx

    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?!?"

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Multitask
    By vnrabbit in forum C Programming
    Replies: 4
    Last Post: 12-13-2002, 03:04 PM
  2. multitask
    By madsmile in forum C++ Programming
    Replies: 1
    Last Post: 03-18-2002, 09:30 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21