Changeset 26 for trunk/threads-tsl.c


Ignore:
Timestamp:
Apr 18, 2014, 8:10:14 AM (10 years ago)
Author:
Mattia Monga
Message:

Programmi 2014

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/threads-tsl.c

    r15 r26  
    11/* Copyright (C) 2009 by Mattia Monga <mattia.monga@unimi.it> */
    22/* $Id$ */
     3#define _GNU_SOURCE
    34
    45#include <unistd.h>
     
    1819                printf("Processo figlio (%d). s = %d\n",
    1920                       getpid(), shared[0]);
     21                fflush(stdout);
    2022                if (!(shared[0] < 10)){
    2123                        printf("Corsa critica!!!!\n");
     
    2527                leave_section(&shared[1]);
    2628                sched_yield();
     29                usleep(50);
    2730        }
    2831        leave_section(&shared[1]); // il test nel while \`e dopo enter\_section
     
    7174                       shared[2],
    7275                       shared[3]);
     76                fflush(stdout);
    7377        }
    7478        return 0;
Note: See TracChangeset for help on using the changeset viewer.