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 @@
//
// Observer.cpp
// AbstractObserver.cpp
//
// $Id: //poco/1.2/Foundation/src/Observer.cpp#1 $
// $Id: //poco/1.2/Foundation/src/AbstractObserver.cpp#1 $
//
// Library: Foundation
// Package: Notifications
@@ -34,7 +34,7 @@
//
#include "Poco/Observer.h"
#include "Poco/AbstractObserver.h"
namespace Poco {

View File

@@ -1,7 +1,7 @@
//
// NamedEvent_UNIX.cpp
//
// $Id: //poco/1.2/Foundation/src/NamedEvent_UNIX.cpp#1 $
// $Id: //poco/1.2/Foundation/src/NamedEvent_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__) || defined(__QNX__)
#include <semaphore.h>
#else
@@ -45,7 +46,6 @@
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>
#include <errno.h>
#endif
@@ -120,7 +120,7 @@ void NamedEventImpl::setImpl()
struct sembuf op;
op.sem_num = 0;
op.sem_op = 1;
op.sem_flg = SEM_UNDO;
op.sem_flg = 0;
if (semop(_semid, &op, 1) != 0)
throw SystemException("cannot set named event", _name);
#endif
@@ -130,15 +130,25 @@ void NamedEventImpl::setImpl()
void NamedEventImpl::waitImpl()
{
#if defined(sun) || defined(__APPLE__) || defined(__osf__) || defined(__QNX__)
if (sem_wait(_sem) != 0)
throw SystemException("cannot wait for named event", _name);
int err;
do
{
err = sem_wait(_sem);
}
while (err && errno == EINTR);
if (err) throw SystemException("cannot wait for named event", _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 wait for named event", _name);
op.sem_flg = 0;
int err;
do
{
err = semop(_semid, &op, 1);
}
while (err && errno == EINTR);
if (err) throw SystemException("cannot wait for named event", _name);
#endif
}

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
}

View File

@@ -1,7 +1,7 @@
//
// PipeImpl_POSIX.cpp
//
// $Id: //poco/1.2/Foundation/src/PipeImpl_POSIX.cpp#1 $
// $Id: //poco/1.2/Foundation/src/PipeImpl_POSIX.cpp#2 $
//
// Library: Foundation
// Package: Processes
@@ -67,7 +67,12 @@ int PipeImpl::writeBytes(const void* buffer, int length)
{
poco_assert (_writefd != -1);
int n = write(_writefd, buffer, length);
int n;
do
{
n = write(_writefd, buffer, length);
}
while (n < 0 && errno == EINTR);
if (n >= 0)
return n;
else
@@ -79,7 +84,12 @@ int PipeImpl::readBytes(void* buffer, int length)
{
poco_assert (_readfd != -1);
int n = read(_readfd, buffer, length);
int n;
do
{
n = read(_readfd, buffer, length);
}
while (n < 0 && errno == EINTR);
if (n >= 0)
return n;
else

View File

@@ -1,7 +1,7 @@
//
// Process_UNIX.cpp
//
// $Id: //poco/1.2/Foundation/src/Process_UNIX.cpp#1 $
// $Id: //poco/1.2/Foundation/src/Process_UNIX.cpp#2 $
//
// Library: Foundation
// Package: Processes
@@ -79,7 +79,13 @@ pid_t ProcessHandleImpl::id() const
int ProcessHandleImpl::wait() const
{
int status;
if (waitpid(_pid, &status, 0) != _pid)
int rc;
do
{
rc = waitpid(_pid, &status, 0);
}
while (rc < 0 && errno == EINTR);
if (rc != _pid)
throw SystemException("Cannot wait for process", NumberFormatter::format(_pid));
return WEXITSTATUS(status);
}

View File

@@ -1,7 +1,7 @@
//
// Random.cpp
//
// $Id: //poco/1.2/Foundation/src/Random.cpp#1 $
// $Id: //poco/1.2/Foundation/src/Random.cpp#2 $
//
// Library: Foundation
// Package: Crypt
@@ -182,7 +182,7 @@ Random::Random(int stateSize)
Random::~Random()
{
delete _pBuffer;
delete [] _pBuffer;
}