jfcmacro

BorrarSemFumadores.cpp

Mar 22nd, 2019
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.48 KB | None | 0 0
  1. #include <fcntl.h>           /* For O_* constants */
  2. #include <sys/stat.h>        /* For mode constants */
  3. #include <semaphore.h>
  4. #include <iostream>
  5. #include <cstdlib>
  6. #include <cstring>
  7. #include <cerrno>
  8.  
  9. using namespace std;
  10.  
  11. int
  12. main(void) {
  13.   const char *nombres[] = { "notabaco", "nopapel", "nocerilla" };
  14.  
  15.   for (int i = 0; i < 3; ++i) {
  16.     if (sem_unlink(nombres[i]) == -1) {
  17.       cerr << "Error borrando los semaforos: " << strerror(errno) << endl;
  18.     }
  19.   }
  20.  
  21.   return EXIT_SUCCESS;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment