mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-25 02:06:04 +02:00
integrated changes for 1.2.3
This commit is contained in:
@@ -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 {
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user