Laboratory 6Please sign your name with your attendance
Laboratory 6 Please sign your name with your attendance
Multi-threadSingle ThreadJob1,job2,job3Job1job2job3Job1Job1Job2Job2Job3Job3
Job 1 Job 2 Job 3 Single Thread Job 2 Job 1 Job 3 Multi-thread Job1,job2,job3 Job1,job2,job3
Some functions_beginthread()- To create a new thread;- uintptr_t_beginthread( void( *start address )( void *)unsigned stack_size, void *arglist );void(*start address)(void*):apointtothefunctionlunsigned stack size:specifythesizeof thestackforthecreatedthreadvoid*arglist:the pointerof arguments list
Some functions • _beginthread() – To create a new thread; – uintptr_t _beginthread( void( *start_address )( void * ), unsigned stack_size, void *arglist ); • void( *start_address )( void * ): a point to the function/ • unsigned stack_size: specify the size of the stack for the created thread • void *arglist: the pointer of arguments list
Some functions. fflush()- To clean the buffer,int fflush( FILE *stream );·FILE *stream: a pointer to FILE structure, this FILEstructure will base on a buffer. When fflush try to clean the buffer, thesystem will first conduct the commands totreat the data in bufferIntuitively, fflushO) after printfO means thatdisplay the printfoO result without delay
Some functions • fflush() – To clean the buffer, – int fflush( FILE *stream ); • FILE *stream: a pointer to FILE structure, this FILE structure will base on a buffer • When fflush try to clean the buffer, the system will first conduct the commands to treat the data in buffer • Intuitively, fflush() after printf() means that display the printf() result without delay