integrated changes for 1.2.3

This commit is contained in:
Guenter Obiltschnig
2006-09-14 16:46:36 +00:00
parent 0a517d5e30
commit a01116ca11
25 changed files with 550 additions and 136 deletions

View File

@@ -1,7 +1,7 @@
//
// NamedMutex_UNIX.cpp
//
// $Id: //poco/1.2/Foundation/src/NamedMutex_UNIX.cpp#1 $
// $Id: //poco/1.2/Foundation/src/NamedMutex_UNIX.cpp#2 $
//
// Library: Foundation
// Package: Processes
@@ -38,6 +38,7 @@
#include "Poco/Exception.h"
#include <fcntl.h>
#include <sys/stat.h>
#include <errno.h>
#if defined(sun) || defined(__APPLE__) || defined(__osf__)
#include <semaphore.h>
#else
@@ -45,7 +46,6 @@
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>
#include <errno.h>
#endif
@@ -114,15 +114,25 @@ NamedMutexImpl::~NamedMutexImpl()
void NamedMutexImpl::lockImpl()
{
#if defined(sun) || defined(__APPLE__) || defined(__osf__) || defined(__QNX__)
if (sem_wait(_sem) != 0)
throw SystemException("cannot lock named mutex", _name);
int err;
do
{
err = sem_wait(_sem);
}
while (err && errno == EINTR);
if (err) throw SystemException("cannot lock named mutex", _name);
#else
struct sembuf op;
op.sem_num = 0;
op.sem_op = -1;
op.sem_flg = SEM_UNDO;
if (semop(_semid, &op, 1) != 0)
throw SystemException("cannot lock named mutex", _name);
int err;
do
{
err = semop(_semid, &op, 1);
}
while (err && errno == EINTR);
if (err) throw SystemException("cannot lock named mutex", _name);
#endif
}