Операционные системы. Процессы и потоки. Илюшкин Б.И. - 42 стр.

UptoLike

Составители: 

/**********************************************************
thread2.c
This program creates two new threads, one to print Y’s and the other to
print N’s.
* Code listing from "Advanced Linux Programming," by CodeSourcery
LLC *
* Copyright (C) 2001 by New Riders Publishing *
* Modified 2005 by Boris Ilyushkin
to compile: gcc -o thread2 thread2.c -lpthread *
http://www.advancedlinuxprogramming.com
*********************************************************/
#include <pthread.h>
#include <stdio.h>
/* Parameters to print_function. */
struct char_print_parms
{
char character; /* The character to print */
int count; /* The number of times to print it */
};
/* Prints a number of characters to stderr, as given by PARAMETERS,
which is a pointer to a struct char_print_parms. */
void* char_print (void* parameters)
{
/* Cast the cookie pointer to the right type. */
42