Data Communications and Networking COMP 2330 Laboratory 6 Mr. Wilman ZOU Please sign your name with...

4
Data Communications and Networking COMP 2330 Laboratory 6 Mr. Wilman ZOU Please sign your name with your attendance

Transcript of Data Communications and Networking COMP 2330 Laboratory 6 Mr. Wilman ZOU Please sign your name with...

Page 1: Data Communications and Networking COMP 2330 Laboratory 6 Mr. Wilman ZOU Please sign your name with your attendance.

Data Communications and Networking COMP 2330

Laboratory 6

Mr. Wilman ZOU

Please sign your name with your attendance

Page 2: Data Communications and Networking COMP 2330 Laboratory 6 Mr. Wilman ZOU Please sign your name with your attendance.

Job 1

Job 2

Job 3

Single Thread

Job 2Job 1Job 3

Multi-thread

Job1,job2,job3

Job1,job2,job3

Page 3: Data Communications and Networking COMP 2330 Laboratory 6 Mr. Wilman ZOU Please sign your name with your attendance.

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

Page 4: Data Communications and Networking COMP 2330 Laboratory 6 Mr. Wilman ZOU Please sign your name with your attendance.

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