RAD Studio
ContentsIndex
PreviousUpNext
process.h

The following functions, macros, and classes are provided in process.h:

Name 
Description 
Header File
process.h
Description
Modes used by the spawn... functions.  
Header File
process.h
Category
Process Control Routines
Prototype
_PTHREAD_ADOPTION_DATA _adopt_thread(void (_USERENTRY *__start_address)(void *), void * __arglist, int free_flag );
Description
“Adopts” a thread, created with the Windows API CreateThread function, to the C++Builder RTL by hooking up the necessary internal data (exceptions, stack info, and so forth). _adopt_thread thereby allows the RTL to handle exception issues in that thread. The execution path of this thread is then transferred to another function (the adoptive thread function). From the RTL's perspective, during the execution of this adoptive thread function, the thread appears as if it had been created by a call to... more 
Header File
process.h
Category
Process Control Routines
Prototype
unsigned long _beginthread(void (_USERENTRY *__start)(void *), unsigned __stksize, void *__arg);
Description
Starts execution of a new thread.
Note: The start_address must be declared to be _USERENTRY.
The _beginthread function creates and starts a new thread. The thread starts execution at start_address.
The size of its stack in bytes is stack_size; the stack is allocated by the operating system after the stack size is rounded up to the next multiple of 4096. The thread is passed arglist as its only parameter; it can be NULL, but must be present. The thread function should... more 
Header File
process.h
Category
Process Control Routines
Prototype
unsigned long _beginthreadNT(void (_USERENTRY *start_address)(void *), unsigned stack_size, void *arglist, void *security_attrib, unsigned long create_flags, unsigned long *thread_id);
Description
Starts execution of a new thread under Windows NT.
Note: The start_address must be declared to be _USERENTRY.
All multithread Windows NT programs must use _beginthreadNT or the _beginthread function instead of the operating system thread-creation API function because these functions perform initialization required for correct operation of the runtime library functions. The _beginthreadNT function provides support for the operating system security. These functions are available only in the multithread libraries.
The _beginthreadNT... more 
Header File
process.h
Category
Process Control Routines
Prototype
unsigned long _beginthreadex(void *__security_attr, unsigned __stksize, unsigned (__stdcall *__start)(void *), void *__arg, unsigned __create_flags, unsigned *__thread_id);
Description
Creates a thread and allows specifying the other parameters of the OS API CreateThread (such as security and thread creation flags). The _endthreadex function will be called automatically when the thread function terminates. The value returned from your thread function will be passed along to _endthreadex, which in turn will pass it along to the ExitThread API. The return value can then be retrieved using the GetExitCodeThread API.
Unlike _endthread, the _endthreadex function does not... more 
Header File
process.h
Category
Process Control Routines
Prototype
void _c_exit(void);
Description
Performs _exit cleanup without terminating the program.
_c_exit performs the same cleanup as _exit, except that it does not terminate the calling process.
Return Value
None.
Example  
Header File
process.h
Category
Process Control Routines
Prototype
void _cexit(void);
Description
Performs exit cleanup without terminating the program.
_cexit performs the same cleanup as exit, closing all files but without terminating the calling process. The _cexit function calls any registered "exit functions" (posted with atexit). Before _cexit returns, it flushes all input/output buffers and closes all streams that were open.
Return Value
None.
Example  
Header File
process.h
Category
Process Control Routines
Prototype
void _endthread(void);
Description
Terminates execution of a thread.
The _endthread function terminates the currently executing thread by closing the thread handle and calling the ExitThread API. The thread must have been started by an earlier call to _beginthread or _beginthreadNT.. _endthread is called automatically by the runtime library when your thread function terminates.
This function is available in the multithread libraries; it is not in the single-threaded libraries.
Return Value
The function does not return a value. 
Header File
process.h
Category
Process Control Routines
Prototype
void _endthreadex(unsigned thread_retval);
Description
Terminates execution of the current thread by calling the ExitThread API, but without closing the handle. The thread must have been created by an earlier call to _beginthreadex. The runtime library will call _endthreadex autotmatically, when your thread function terminates. _endthreadex receives the return value of your thread function in thread_retval, and will pass it along to the Win32 ExitThread API.
Note: Note: Performs the same operation as _endthread(), but does not close the thread handle.
Return Value
None. 
Header File
process.h
Category
Memory Routines
Prototype
void *_expand(void *block, size_t size);
Description
Grows or shrinks a heap block in place.
This function attempts to change the size of an allocated memory block without moving the block's location in the heap. The data in the block are not changed, up to the smaller of the old and new sizes of the block. The block must have been allocated earlier with malloc, calloc, or realloc, and must not have been freed.
Return Value
If _expand is able to resize the block without moving it, _expand returns a pointer to the block,... more 
Header File
process.h
Category
Process Control Routines
Prototype
void _unadopt_thread(_PTHREAD_ADOPTION_DATA thd);
Description
Frees the RTL thread-specific data associated with a previous call to _adopt_thread.
Return Value
None.
Portability  
Header File
process.h
Category
Process Control Routines
Prototype
int cwait(int *statloc, int pid, int action);
Description
Waits for child process to terminate.
The cwait function waits for a child process to terminate. The process ID of the child to wait for is pid. If statloc is not NULL, it points to the location where cwait will store the termination status. The action specifies whether to wait for the process alone, or for the process and all of its children.
If the child process terminated normally (by calling exit, or returning from main), the termination status word is defined as follows:... more 
Header File
process.h
Category
Process Control Routines
Prototype
int execl(char *path, char *arg0 *arg1, ..., *argn, NULL);
int _wexecl(wchar_t *path, wchar_t *arg0 *arg1, ..., *argn, NULL);
int execle(char *path, char *arg0, *arg1, ..., *argn, NULL, char **env);
int _wexecle(wchar_t *path, wchar_t *arg0, *arg1, ..., *argn, NULL, wchar_t **env);
int execlp(char *path, char *arg0,*arg1, ..., *argn, NULL);
int _wexeclp(wchar_t *path, wchar_t *arg0,*arg1, ..., *argn, NULL);
int execlpe(char *path, char *arg0, *arg1, ..., *argn, NULL, char **env);
int _wexeclpe(wchar_t *path, wchar_t *arg0, *arg1, ..., *argn, NULL, wchar_t **env);
int execv(char *path, char *argv[]);
int _wexecv(wchar_t *path, wchar_t *argv[]);
int execve(char *path, char... more 
Header File
process.h
Category
Process Control Routines
Prototype
unsigned getpid(void)

Description
Gets the process ID of a program.
This function returns the current process ID--an integer that uniquely identifies the process.
Return Value
getpid returns the current process' ID.
Example  
Header File
process.h
Category
Process Control Routines
Prototype
int spawnl(int mode, char *path, char *arg0, arg1, ..., argn, NULL);
int _wspawnl(int mode, wchar_t *path, wchar_t *arg0, arg1, ..., argn, NULL);
int spawnle(int mode, char *path, char *arg0, arg1, ..., argn, NULL, char *envp[]);
int _wspawnle(int mode, wchar_t *path, wchar_t *arg0, arg1, ..., argn, NULL, wchar_t *envp[]);
int spawnlp(int mode, char *path, char *arg0, arg1, ..., argn, NULL);
int _wspawnlp(int mode, wchar_t *path, wchar_t *arg0, arg1, ..., argn, NULL);
int spawnlpe(int mode, char *path, char *arg0, arg1, ..., argn, NULL, char *envp[]);
int _wspawnlpe(int mode, wchar_t *path, wchar_t *arg0, arg1, ...,... more 
wait 
Header File
process.h
Category
Process Control Routines
Prototype
int wait(int *statloc);

Description
Waits for one or more child processes to terminate.
The wait function waits for one or more child processes to terminate. The child processes must be those created by the calling program; wait cannot wait for grandchildren (processes spawned by child processes). If statloc is not NULL, it points to location where wait will store the termination status.
If the child process terminated normally (by calling exit, or returning from main), the termination status word is defined as follows:  

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!