Problem 214 solution pg 46 this exercise

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: d Kill(pid_t pid, int signum) { int rc; if ((rc = kill(pid, signum)) < 0) unix_error("Kill error"); } code/src/csapp.c Figure A.3: Wrapper for Unix-style kill function. code/src/csapp.c 1 2 3 4 5 6 7 void Pthread_mutex_lock(pthread_mutex_t *mutex) { int rc; if ((rc = pthread_mutex_lock(mutex)) != 0) posix_error(rc, "Pthread_mutex_lock error"); } code/src/csapp.c Figure A.4: Wrapper for Posix-style pthread mutex lock function. code/src/csapp.c 1 2 3 4 5 6 7 8 9 10 int Pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, struct timespec *abstime) { int rc = pthread_cond_timedwait(cond, mutex, abstime); if ((rc != 0) && (rc != ETIMEDOUT)) posix_error(rc, "Pthread_cond_timedwait error"); return rc; } code/src/csapp.c Figure A.5: Wrapper for Posix-style pthread cond timedwait function. 670 APPENDIX A. ERROR HANDLING DNS-style error-handling wrappers Figure A.6 shows the error-handling wrapper for the DNS-style gethostbyname function. code/src/csapp.c...
View Full Document

This note was uploaded on 09/02/2010 for the course ELECTRICAL 360 taught by Professor Schultz during the Spring '10 term at BYU.

Ask a homework question - tutors are online