Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read SiteMap

Tags: , , , ,

Sponsored Links



What is _beginthread() function? : C

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 29-01-2010
Member
 
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.
Reply With Quote
  #2  
Old 29-01-2010
Praetor's Avatar
Member
 
Join Date: Apr 2008
Posts: 1,937
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
);
Reply With Quote
  #3  
Old 29-01-2010
Member
 
Join Date: May 2008
Posts: 1,990
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.
Reply With Quote
  #4  
Old 29-01-2010
kelfro's Avatar
Member
 
Join Date: Apr 2008
Posts: 1,976
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.
Reply With Quote
  #5  
Old 29-01-2010
Zecho's Avatar
Member
 
Join Date: May 2008
Posts: 2,267
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 );
}
}
Reply With Quote
Reply

  TechArena Community > Software > Software Development


Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "What is _beginthread() function? : C"
Thread Thread Starter Forum Replies Last Post
c++ equivalent function to the c-function 'sprintf Dilbert Software Development 6 13-12-2011 04:03 PM
c# function equivalent to gettime function in javascript Omaar Software Development 4 10-03-2010 10:44 PM
How to pass function with parameters to another function in PHP? Linoo Software Development 5 27-02-2010 07:52 PM
How does abstract function differs from virtual function? Maddox G Software Development 5 29-01-2010 11:32 AM
Function keys don't function under windows XP GunFighter Hardware Peripherals 3 09-04-2009 12:07 AM


All times are GMT +5.5. The time now is 05:15 AM.