Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into shared-ptr
Browse files Browse the repository at this point in the history
  • Loading branch information
pepone committed Feb 8, 2024
2 parents b36b50d + d939b57 commit 2c7857c
Show file tree
Hide file tree
Showing 47 changed files with 156 additions and 2,341 deletions.
109 changes: 3 additions & 106 deletions cpp/include/IceUtil/Cond.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,6 @@
#include <IceUtil/Time.h>
#include <IceUtil/ThreadException.h>

#if defined(_WIN32) && !defined(ICE_HAS_WIN32_CONDVAR)
# include <IceUtil/Mutex.h>

namespace IceUtilInternal
{
//
// Needed for implementation.
//
class Semaphore
{
public:

Semaphore(long = 0);
ICE_API ~Semaphore();

void wait() const;
bool timedWait(const IceUtil::Time&) const;
void post(int = 1) const;

private:

mutable HANDLE _sem;
};
}
#endif

namespace IceUtil
{

Expand Down Expand Up @@ -79,7 +53,7 @@ class ICE_API Cond : private noncopyable
//
// wait atomically unlocks the mutex and waits for the condition
// variable to be signaled. Before returning to the calling thread
// the mutex is reaquired.
// the mutex is reacquired.
//
template <typename Lock> inline void
wait(const Lock& lock) const
Expand All @@ -94,7 +68,7 @@ class ICE_API Cond : private noncopyable
//
// wait atomically unlocks the mutex and waits for the condition
// variable to be signaled for up to the given timeout. Before
// returning to the calling thread the mutex is reaquired. Returns
// returning to the calling thread the mutex is reacquired. Returns
// true if the condition variable was signaled, false on a
// timeout.
//
Expand All @@ -113,85 +87,11 @@ class ICE_API Cond : private noncopyable
friend class Monitor<Mutex>;
friend class Monitor<RecMutex>;

//
// The Monitor implementation uses waitImpl & timedWaitImpl.
//
#if defined(_WIN32) && !defined(ICE_HAS_WIN32_CONDVAR)

template <typename M> void
waitImpl(const M& mutex) const
{
preWait();

typedef typename M::LockState LockState;

LockState state;
mutex.unlock(state);

try
{
dowait();
mutex.lock(state);
}
catch(...)
{
mutex.lock(state);
throw;
}
}
template <typename M> bool
timedWaitImpl(const M& mutex, const Time& timeout) const
{
preWait();

typedef typename M::LockState LockState;

LockState state;
mutex.unlock(state);

try
{
bool rc = timedDowait(timeout);
mutex.lock(state);
return rc;
}
catch(...)
{
mutex.lock(state);
throw;
}
}

#else

template <typename M> void waitImpl(const M&) const;
template <typename M> bool timedWaitImpl(const M&, const Time&) const;

#endif

#ifdef _WIN32
# ifdef ICE_HAS_WIN32_CONDVAR
mutable CONDITION_VARIABLE _cond;
# else
void wake(bool);
void preWait() const;
void postWait(bool) const;
bool timedDowait(const Time&) const;
void dowait() const;

Mutex _internal;
IceUtilInternal::Semaphore _gate;
IceUtilInternal::Semaphore _queue;
mutable long _blocked;
mutable long _unblocked;
enum State
{
StateIdle,
StateSignal,
StateBroadcast
};
mutable State _state;
# endif
#else
mutable pthread_cond_t _cond;
#endif
Expand All @@ -200,8 +100,6 @@ class ICE_API Cond : private noncopyable

#ifdef _WIN32

# ifdef ICE_HAS_WIN32_CONDVAR

template <typename M> inline void
Cond::waitImpl(const M& mutex) const
{
Expand Down Expand Up @@ -247,9 +145,8 @@ Cond::timedWaitImpl(const M& mutex, const Time& timeout) const
return true;
}

# endif

#else

template <typename M> inline void
Cond::waitImpl(const M& mutex) const
{
Expand Down
1 change: 0 additions & 1 deletion cpp/include/IceUtil/IceUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include <IceUtil/Monitor.h>
#include <IceUtil/MutexProtocol.h>
#include <IceUtil/Mutex.h>
#include <IceUtil/RecMutex.h>
#include <IceUtil/Shared.h>
#include <IceUtil/StringConverter.h>
#include <IceUtil/Thread.h>
Expand Down
3 changes: 0 additions & 3 deletions cpp/include/IceUtil/Options.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#define ICE_UTIL_OPTIONS_H

#include <IceUtil/Config.h>
#include <IceUtil/RecMutex.h>
#include <IceUtil/Shared.h>
#include <IceUtil/Handle.h>
#include <IceUtil/Exception.h>
Expand Down Expand Up @@ -108,8 +107,6 @@ class ICE_API Options

bool parseCalled;

IceUtil::RecMutex _m;

Options(const Options&); // Not allowed.
void operator=(const Options&); // Not allowed.

Expand Down
107 changes: 0 additions & 107 deletions cpp/include/IceUtil/RecMutex.h

This file was deleted.

17 changes: 0 additions & 17 deletions cpp/msbuild/ice.test.sln
Original file line number Diff line number Diff line change
Expand Up @@ -529,13 +529,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "client", "..\test\IceUtil\s
{C7223CC8-0AAA-470B-ACB3-12B9DE75525C} = {C7223CC8-0AAA-470B-ACB3-12B9DE75525C}
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "priority", "priority", "{3CEFD8CF-0E59-4614-A7BB-AD25F220FAB4}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "client", "..\test\IceUtil\priority\msbuild\client.vcxproj", "{2C646634-969C-4A25-B9F2-ACE22302A89C}"
ProjectSection(ProjectDependencies) = postProject
{C7223CC8-0AAA-470B-ACB3-12B9DE75525C} = {C7223CC8-0AAA-470B-ACB3-12B9DE75525C}
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "inputUtil", "inputUtil", "{47D78666-F196-4700-B4B7-D83B75EA23DC}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "client", "..\test\IceUtil\inputUtil\msbuild\client.vcxproj", "{2D412D9D-49F4-4259-A175-D6BBA1E8DFFD}"
Expand Down Expand Up @@ -1882,14 +1875,6 @@ Global
{15F7115E-5CD1-4CC9-9B8C-9C9357801302}.Release|Win32.Build.0 = Release|Win32
{15F7115E-5CD1-4CC9-9B8C-9C9357801302}.Release|x64.ActiveCfg = Release|x64
{15F7115E-5CD1-4CC9-9B8C-9C9357801302}.Release|x64.Build.0 = Release|x64
{2C646634-969C-4A25-B9F2-ACE22302A89C}.Debug|Win32.ActiveCfg = Debug|Win32
{2C646634-969C-4A25-B9F2-ACE22302A89C}.Debug|Win32.Build.0 = Debug|Win32
{2C646634-969C-4A25-B9F2-ACE22302A89C}.Debug|x64.ActiveCfg = Debug|x64
{2C646634-969C-4A25-B9F2-ACE22302A89C}.Debug|x64.Build.0 = Debug|x64
{2C646634-969C-4A25-B9F2-ACE22302A89C}.Release|Win32.ActiveCfg = Release|Win32
{2C646634-969C-4A25-B9F2-ACE22302A89C}.Release|Win32.Build.0 = Release|Win32
{2C646634-969C-4A25-B9F2-ACE22302A89C}.Release|x64.ActiveCfg = Release|x64
{2C646634-969C-4A25-B9F2-ACE22302A89C}.Release|x64.Build.0 = Release|x64
{2D412D9D-49F4-4259-A175-D6BBA1E8DFFD}.Debug|Win32.ActiveCfg = Debug|Win32
{2D412D9D-49F4-4259-A175-D6BBA1E8DFFD}.Debug|Win32.Build.0 = Debug|Win32
{2D412D9D-49F4-4259-A175-D6BBA1E8DFFD}.Debug|x64.ActiveCfg = Debug|x64
Expand Down Expand Up @@ -2882,8 +2867,6 @@ Global
{66CF01A0-7BE5-482E-8D27-6294E691B084} = {5988D9A8-57AD-4D79-8214-E0C4385224B3}
{9A5024F6-703B-4A4A-A4CC-ED14F77158FF} = {39AA1944-6915-43F5-B219-EC2DA22F6CBC}
{15F7115E-5CD1-4CC9-9B8C-9C9357801302} = {9A5024F6-703B-4A4A-A4CC-ED14F77158FF}
{3CEFD8CF-0E59-4614-A7BB-AD25F220FAB4} = {39AA1944-6915-43F5-B219-EC2DA22F6CBC}
{2C646634-969C-4A25-B9F2-ACE22302A89C} = {3CEFD8CF-0E59-4614-A7BB-AD25F220FAB4}
{47D78666-F196-4700-B4B7-D83B75EA23DC} = {39AA1944-6915-43F5-B219-EC2DA22F6CBC}
{2D412D9D-49F4-4259-A175-D6BBA1E8DFFD} = {47D78666-F196-4700-B4B7-D83B75EA23DC}
{DE878A39-59DE-4F36-B669-68C84D60C93B} = {39AA1944-6915-43F5-B219-EC2DA22F6CBC}
Expand Down
2 changes: 0 additions & 2 deletions cpp/src/Ice/CommunicatorI.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
#ifndef ICE_COMMUNICATOR_I_H
#define ICE_COMMUNICATOR_I_H

#include <IceUtil/RecMutex.h>

#include <Ice/DynamicLibraryF.h>
#include <Ice/Initialize.h>
#include <Ice/Communicator.h>
Expand Down
Loading

0 comments on commit 2c7857c

Please sign in to comment.