/[livstidsfanger]/trunk/livstidsfanger.c
ViewVC logotype

Diff of /trunk/livstidsfanger.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 13 by trond, 2014-11-09T15:15:31Z Revision 15 by trond, 2014-11-19T19:32:53Z
# Line 9  Line 9 
9    
10  #include <errno.h>  #include <errno.h>
11  #include <pthread.h>  #include <pthread.h>
12    #include <sched.h>
13  #include <signal.h>  #include <signal.h>
14  #include <stdbool.h>  #include <stdbool.h>
15  #include <stdio.h>  #include <stdio.h>
# Line 17  Line 18 
18  #include <time.h>  #include <time.h>
19  #include <unistd.h>  #include <unistd.h>
20    
21    #if _POSIX_THREADS < 200112L
22    #error her mangler det støtte for POSIX Threads anno 2001
23    #endif
24    
25  #if __STDC_VERSION__ >= 201112L  #if __STDC_VERSION__ >= 201112L
26  #include <stdnoreturn.h>  #include <stdnoreturn.h>
27  #else  #else
# Line 177  noreturn void *livstidsfange(void *arg) Line 182  noreturn void *livstidsfange(void *arg)
182      printf("livstidsfange %2zu låser opp mutex\n", i + 1);      printf("livstidsfange %2zu låser opp mutex\n", i + 1);
183      pthread_mutex_unlock(&mutex);      pthread_mutex_unlock(&mutex);
184      printf("livstidsfange %2zu har låst opp mutex\n", i + 1);      printf("livstidsfange %2zu har låst opp mutex\n", i + 1);
185    
186    #ifdef _POSIX_PRIORITY_SCHEDULING
187        sched_yield();
188    #endif
189    } // while    } // while
190  } // livstidsfange()  } // livstidsfange()
191    


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

svn@ximalas.info
ViewVC Help
Powered by ViewVC 1.3.0-beta1