ReactOS 0.4.15-dev-7924-g5949c20
bench-thread.c File Reference
#include <stdio.h>
#include <windows.h>
Include dependency graph for bench-thread.c:

Go to the source code of this file.

Macros

#define NR_THREADS   (30)
 

Functions

DWORD WINAPI thread_main1 (LPVOID param)
 
DWORD WINAPI thread_main2 (LPVOID param)
 
int main (void)
 

Macro Definition Documentation

◆ NR_THREADS

#define NR_THREADS   (30)

Definition at line 4 of file bench-thread.c.

Function Documentation

◆ main()

int main ( void  )

Definition at line 25 of file bench-thread.c.

26{
27 DWORD i=0;
28 DWORD id;
29
30#if 1
31 printf("Creating %d threads...\n",NR_THREADS*2);
32 for (i=0;i<NR_THREADS;i++)
33 {
35 0,
38 0,
39 &id);
40
41/* CreateThread(NULL,
42 0,
43 thread_main2,
44 (LPVOID)i,
45 0,
46 &id);*/
47 }
48
49 printf("All threads created...\n");
50
51 /*
52 * Waiting for threads is not implemented yet.
53 * If you want to see all threads running, uncomment the
54 * call to SuspendThread(). The test application will
55 * freeze after all threads are created.
56 */
57/* SuspendThread (GetCurrentThread()); */
58
59#else
60
61 printf("Creating thread...\n");
62
64 0,
66 (LPVOID)i,
67 0,
68 &id);
69
70 printf("Thread created. Waiting for termination...\n");
71
73 -1);
74
76
77 printf("Thread terminated...\n");
78#endif
79 printf("Exiting\n");
80 return 0;
81}
DWORD WINAPI thread_main1(LPVOID param)
Definition: bench-thread.c:8
#define NR_THREADS
Definition: bench-thread.c:4
#define NULL
Definition: types.h:112
#define CloseHandle
Definition: compat.h:739
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:137
unsigned long DWORD
Definition: ntddk_ex.h:95
#define printf
Definition: freeldr.h:93
GLuint id
Definition: glext.h:5910
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
HANDLE hThread
Definition: wizard.c:28
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
uint32_t ULONG_PTR
Definition: typedefs.h:65

◆ thread_main1()

DWORD WINAPI thread_main1 ( LPVOID  param)

Definition at line 8 of file bench-thread.c.

9{
10 printf("Thread 1 running (Counter %lu)\n", PtrToUlong(param));
12 return 0;
13}
#define TRUE
Definition: types.h:120
#define INFINITE
Definition: serial.h:102
#define PtrToUlong(u)
Definition: config.h:107
GLfloat param
Definition: glext.h:5796
DWORD WINAPI SleepEx(IN DWORD dwMilliseconds, IN BOOL bAlertable)
Definition: synch.c:802

Referenced by main().

◆ thread_main2()

DWORD WINAPI thread_main2 ( LPVOID  param)

Definition at line 17 of file bench-thread.c.

18{
19 printf("Thread 2 running (Counter %lu)\n", PtrToUlong(param));
21 return 0;
22}
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790