#include <iostream>
#include <fcntl.h>
#include <sys/stat.h>
#include <semaphore.h>
#include <unistd.h>
#include <cstdlib>
#include <cstring>
#include <cerrno>
using namespace std;
static void usage(char *progname);
int
main(int argc, char *argv[]) {
if (argc != 2) usage(argv[0]);
sem_t *sem;
if (sem_unlink(argv[1]) == -1) {
cerr << "Error borrando el semaforo: " <<
strerror(errno) << endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
static void usage(char *progname) {
cerr << "Uso: " << progname
<< " <nombresem> "
<< endl;
exit(EXIT_FAILURE);
}
Comments