Results 1 to 5 of 5

Thread: What is _beginthread() function? : C

  1. #1
    Join Date
    Dec 2009
    Posts
    23

    What is _beginthread() function? : C

    Hi, I am working in the MNC company from last week. In company, I working on the C programming language. I recently joined the company so, till now I don't know how they can work in the company. I have to complete the project that is they given by my executive, within week. So, I have to complete project using the coding that has Beginthread function. But I don't know about the Beginthread function. So, can anyone tell me about the Beginthread function.

  2. #2
    Join Date
    Apr 2008
    Posts
    1,948

    Beginthread() : C

    In programming language like C, the beginthread function can be declared in the header file process.h. The beginthread function is a function that can creates a new thread of execution within the current process. A thread of execution means that from a fork of a computer program in more than two concurrently running tasks. The following is the Syntax of the beginthread function :
    uintptr_t _beginthread(
    void( *start_address )( void * ),
    unsigned stack_size,
    void *arglist
    );

  3. #3
    Join Date
    May 2008
    Posts
    2,012

    Re: What is _beginthread() function? : C

    The following are the parameters of the beginthread function :
    1. start_address : It starts the start address of a routine that begins execution of a new thread.
    2. stack_size : It scan be used for stack size of a new thread or 0.
    3. arglist : It can be used to pass Argument list to new thread or NULL.
    4. security : It can be used to determines whether the returned handle can be inherited by child processes.
    5. initflag : It can be used for to determine initial state of a new thread.
    6. thrdaddr : It can be used for Pointing to a 32-bit variable that receives the thread identifier.

  4. #4
    Join Date
    Apr 2008
    Posts
    2,005

    Re: What is _beginthread() function? : C

    I think the begin thread function can be used to create the thread. The _beginthread function can be used to create a thread that can starts the execution of a routine at starting of the address. The __cdecl calling convention must be used for the routine at start_address and The _beginthread function can not have return value. The _beginthread function can be terminated automatically when the thread returns from that routine. The _beginthread can returns -1L on an error.

  5. #5
    Join Date
    May 2008
    Posts
    2,297

    Re: What is _beginthread() function? : C

    The following example helps you to know about the _beginthread() function :
    #include <windows.h>
    #include <process.h>
    #include <stddef.h>
    #include <stdlib.h>
    #include <conio.h>
    int main()
    {
    CHAR cr = 'B';
    hStdO = GetStdHandle( STD_OUTPUT_HANDLE );
    GetConsoleScreenBufferInfo( hStdO, &csbi );
    _beginthread( ChkKey, 0, NULL );
    while( repeat )
    {
    _beginthread( Bounce, 0, (void *) (cr++) );
    Sleep( 2000L );
    }
    }

Similar Threads

  1. c++ equivalent function to the c-function 'sprintf
    By Dilbert in forum Software Development
    Replies: 6
    Last Post: 13-12-2011, 04:03 PM
  2. c# function equivalent to gettime function in javascript
    By Omaar in forum Software Development
    Replies: 4
    Last Post: 10-03-2010, 10:44 PM
  3. Replies: 5
    Last Post: 27-02-2010, 07:52 PM
  4. How does abstract function differs from virtual function?
    By Maddox G in forum Software Development
    Replies: 5
    Last Post: 29-01-2010, 11:32 AM
  5. Function keys don't function under windows XP
    By GunFighter in forum Hardware Peripherals
    Replies: 3
    Last Post: 08-04-2009, 11:07 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,176,172.31083 seconds with 16 queries