Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some (bundled) minor changes (take 2) #176

Merged
merged 26 commits into from
Oct 31, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
3bff6f8
improved solaris 11 support
Dec 1, 2015
6cec721
fix problem with std io when using ACE_OSTREAM_TYPE
Dec 1, 2015
502c6fc
added support for CancelIoEx() (Win32)
Dec 1, 2015
aeb68c0
fixed an issue with (exported) template specializations (Win32)
Dec 2, 2015
de13b79
fix potential memory leak when using the Win32 Proactor (part1)
Dec 2, 2015
7acfc9e
repaired include strategy for ace/Synch.h (prerequisite to solving te…
Dec 3, 2015
6d66024
fixed an issue with (exported) template specializations (Win32) (part2)
Dec 3, 2015
b1d83ea
fixed an issue with (exported) template specializations (Win32) (part2)
Dec 3, 2015
6dba799
Merge branch 'master' of github.com:esohns/ATCD
Dec 3, 2015
c717bec
fix potential memory leak when using the Win32 Proactor (part2a)
Dec 3, 2015
733efc7
fixed an issue with (exported) template specializations (Win32) (part3)
Dec 3, 2015
4155a8c
fixed an issue with (exported) template specializations (Win32)
Dec 4, 2015
9ca4697
fixed an issue with (exported) template specializations (Win32)
Dec 4, 2015
2609c79
Merge branch 'master' of github.com:esohns/ATCD
Dec 4, 2015
1280574
fix potential memory leak when using the Win32 Proactor (part2a)
Dec 4, 2015
b695f27
fixed an issue with (exported) template specializations (Win32)
Dec 4, 2015
39aeb7f
fixed an issue with (exported) template specializations (Win32)
Dec 4, 2015
5a757dd
fixed an issue with (exported) template specializations (Win32)
Dec 4, 2015
a255354
repaired include strategy for ace/Synch.h (prerequisite to solving te…
Dec 4, 2015
dee50e8
added support for CancelIoEx() (Win32) (update passes travis-ci build)
Dec 13, 2015
219ae58
reuse current timestamp to compute wait delay
May 29, 2016
7ad5360
Merge branch 'master' of https://github.com/DOCGroup/ACE_TAO
Jul 14, 2016
d5fbc0d
Merge branch 'master' of https://github.com/DOCGroup/ACE_TAO
Oct 23, 2016
8dbd724
repaired integration build failure
Oct 23, 2016
53bbf4b
removed now-obsolete template instantiation left over from an earlier…
Oct 24, 2016
4bb4047
updated NEWS
Oct 30, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
*S_T.h
*S_T.inl

*.iobj
*.ipdb

.depend.*
GNUmakefile*
*.ior
Expand All @@ -38,3 +41,4 @@ ipch/
*.res
*.opendb
*.VC.db
build
22 changes: 22 additions & 0 deletions ACE/NEWS
Original file line number Diff line number Diff line change
@@ -1,6 +1,28 @@
USER VISIBLE CHANGES BETWEEN ACE-6.4.1 and ACE-6.4.2
====================================================

. Added support for getpwnam_r on Solaris 11

. ACE_OSTREAM_TYPE uses the std namespace where applicable

. ACE_WIN32_Asynch_Operation::cancel() uses CancelIOEx on Windows Vista and
above

. Bugfix of exported template specializations on Win32 platforms
(specifically, ACE_Condition_Recursive_Thread_Mutex)

. Fixed potential memory leak when using the ACE_WIN32_Proactor

. Header sanitizations (specifically, ace/Synch.h)

. Fixed a race condition in ACE_Thread_Manager::task_wait() on Win32

. A (major) cleanup of timer queue code

. Repaired the ACE_Timer_Hash class. This class code was unused for a while
and essentially broken due to bit-rot. It is now another (meta-)implementation
that can be used stand-alone, or with the other timer queue implementations

USER VISIBLE CHANGES BETWEEN ACE-6.4.0 and ACE-6.4.1
====================================================

Expand Down
38 changes: 10 additions & 28 deletions ACE/ace/Condition_Recursive_Thread_Mutex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@

#if defined (ACE_HAS_THREADS)

#if !defined (__ACE_INLINE__)
#include "ace/Condition_Recursive_Thread_Mutex.inl"
#endif /* __ACE_INLINE__ */

#include "ace/Log_Category.h"

ACE_BEGIN_VERSIONED_NAMESPACE_DECL

int
ACE_Condition<ACE_Recursive_Thread_Mutex>::remove (void)
{
return ACE_OS::cond_destroy (&this->cond_);
}
ACE_ALLOC_HOOK_DEFINE (ACE_Condition<ACE_Recursive_Thread_Mutex>)

void
ACE_Condition<ACE_Recursive_Thread_Mutex>::dump (void) const
Expand All @@ -37,11 +37,6 @@ ACE_Condition<ACE_Recursive_Thread_Mutex>::dump (void) const
#endif /* ACE_HAS_DUMP */
}

ACE_Condition<ACE_Recursive_Thread_Mutex>::~ACE_Condition (void)
{
this->remove ();
}

ACE_Condition<ACE_Recursive_Thread_Mutex>::ACE_Condition (ACE_Recursive_Thread_Mutex &m)
: mutex_ (m)
{
Expand All @@ -60,6 +55,11 @@ ACE_Condition<ACE_Recursive_Thread_Mutex>::ACE_Condition (ACE_Recursive_Thread_M
ACE_TEXT ("ACE_Condition<ACE_Recursive_Thread_Mutex>::ACE_Condition<ACE_Recursive_Thread_Mutex>")));
}

ACE_Condition<ACE_Recursive_Thread_Mutex>::~ACE_Condition (void)
{
this->remove ();
}

int
ACE_Condition<ACE_Recursive_Thread_Mutex>::wait (const ACE_Time_Value *abstime)
{
Expand Down Expand Up @@ -108,24 +108,6 @@ ACE_Condition<ACE_Recursive_Thread_Mutex>::wait (ACE_Recursive_Thread_Mutex &mut
return result;
}

int
ACE_Condition<ACE_Recursive_Thread_Mutex>::signal (void)
{
return ACE_OS::cond_signal (&this->cond_);
}

int
ACE_Condition<ACE_Recursive_Thread_Mutex>::broadcast (void)
{
return ACE_OS::cond_broadcast (&this->cond_);
}

ACE_Recursive_Thread_Mutex &
ACE_Condition<ACE_Recursive_Thread_Mutex>::mutex (void)
{
return this->mutex_;
}

ACE_END_VERSIONED_NAMESPACE_DECL

#endif /* ACE_HAS_THREADS */
19 changes: 19 additions & 0 deletions ACE/ace/Condition_Recursive_Thread_Mutex.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,16 @@
#if !defined (ACE_HAS_THREADS)
# include "ace/Null_Condition.h"
#else /* ACE_HAS_THREADS */
// ACE platform supports some form of threading.

#include "ace/Recursive_Thread_Mutex.h"
#include "ace/Condition_Attributes.h"
#include "ace/Condition_T.h"

ACE_BEGIN_VERSIONED_NAMESPACE_DECL

class ACE_Time_Value;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this one needed?

Copy link
Contributor Author

@esohns esohns Oct 30, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a 'forward declaration'; the header does not #include ace/Time_Value.h, even though it is referencing ACE_Time_Value*. Depending on what the other #includes pull in, this may not be needed (but the header is more consistent this way). As I was changing the header, I cleaned it up a little bit.


/**
* @brief ACE_Condition template specialization written using
* @a ACE_Recursive_Thread_Mutex. This allows threads to block until
Expand Down Expand Up @@ -86,6 +90,9 @@ class ACE_Export ACE_Condition<ACE_Recursive_Thread_Mutex>
/// Dump the state of an object.
void dump (void) const;

/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;

private:

// = Prevent assignment and copying.
Expand All @@ -101,11 +108,23 @@ class ACE_Export ACE_Condition<ACE_Recursive_Thread_Mutex>
ACE_Recursive_Thread_Mutex &mutex_;

};
// prevent implicit instantiations by includers to relieve the linker
#if defined (ACE_HAS_CPP11_EXTERN_TEMPLATES)
# if defined (ACE_LACKS_CPP11_EXTERN_TEMPLATE_ATTRIBUTES)
extern template class ACE_Condition<ACE_Recursive_Thread_Mutex>;
# else
extern template ACE_Export class ACE_Condition<ACE_Recursive_Thread_Mutex>;
# endif /* ACE_LACKS_CPP11_EXTERN_TEMPLATE_ATTRIBUTES */
#endif /* ACE_HAS_CPP11_EXTERN_TEMPLATES */

typedef ACE_Condition<ACE_Recursive_Thread_Mutex> ACE_Condition_Recursive_Thread_Mutex;

ACE_END_VERSIONED_NAMESPACE_DECL

#if defined (__ACE_INLINE__)
#include "ace/Condition_Recursive_Thread_Mutex.inl"
#endif /* __ACE_INLINE__ */

#endif /* !ACE_HAS_THREADS */

#include /**/ "ace/post.h"
Expand Down
28 changes: 28 additions & 0 deletions ACE/ace/Condition_Recursive_Thread_Mutex.inl
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// -*- C++ -*-
ACE_BEGIN_VERSIONED_NAMESPACE_DECL

ACE_INLINE int
ACE_Condition<ACE_Recursive_Thread_Mutex>::remove (void)
{
return ACE_OS::cond_destroy (&this->cond_);
}

ACE_INLINE ACE_Recursive_Thread_Mutex &
ACE_Condition<ACE_Recursive_Thread_Mutex>::mutex (void)
{
return this->mutex_;
}

ACE_INLINE int
ACE_Condition<ACE_Recursive_Thread_Mutex>::signal (void)
{
return ACE_OS::cond_signal (&this->cond_);
}

ACE_INLINE int
ACE_Condition<ACE_Recursive_Thread_Mutex>::broadcast (void)
{
return ACE_OS::cond_broadcast (&this->cond_);
}

ACE_END_VERSIONED_NAMESPACE_DECL
2 changes: 0 additions & 2 deletions ACE/ace/Future.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
#if defined (ACE_HAS_THREADS)

#include "ace/Synch_Traits.h"
#include "ace/Recursive_Thread_Mutex.h"
#include "ace/Condition_Recursive_Thread_Mutex.h"

ACE_BEGIN_VERSIONED_NAMESPACE_DECL

Expand Down
8 changes: 8 additions & 0 deletions ACE/ace/OS_NS_pwd.inl
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ ACE_OS::getpwnam_r (const char *name,
}
*result = pwd;
return 0;
#elif defined (ACE_HAS_SOLARIS11_GETPWNAM_R)
if (::getpwnam_r (name, pwd, buffer, bufsize) == 0)
{
*result = 0;
return -1;
}
*result = pwd;
return 0;
#elif defined (ACE_HAS_STHREADS)
if (::getpwnam_r (name, pwd, buffer, bufsize) != 0)
{
Expand Down
4 changes: 4 additions & 0 deletions ACE/ace/Synch.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

// *NOTE*: never never never ever #include this file in a header
// --> #include "ace/Synch_Traits.h" instead and #include "ace/Synch.h"
// in the .cpp. This prevents multiple implicit template
// instantiations (linker errors on MSVC)
#if !defined (DO_NOT_INCLUDE_SYNCH_H)

/* All the classes have been moved out into their own headers as part of
Expand Down
2 changes: 1 addition & 1 deletion ACE/ace/Timer_Queue_Adapters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ ACE_Thread_Timer_Queue_Adapter<TQ, TYPE>::svc (void)
{
// The earliest time on the Timer_Queue lies in future;
// convert the tv to an absolute time.
ACE_Time_Value const tv = this->timer_queue_->gettimeofday () + (tv_earl - tv_curr);
ACE_Time_Value const tv = tv_curr + (tv_earl - tv_curr);
// ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("waiting until %u.%3.3u secs\n"),
// tv.sec(), tv.msec()));
this->condition_.wait (&tv);
Expand Down
2 changes: 1 addition & 1 deletion ACE/ace/Timer_Queue_Adapters.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#include "ace/Signal.h"
#include "ace/Sig_Handler.h"
#include "ace/Condition_Recursive_Thread_Mutex.h"
#include "ace/Synch_Traits.h"

#if defined (ACE_HAS_DEFERRED_TIMER_COMMANDS)
# include "ace/Unbounded_Queue.h"
Expand Down
5 changes: 5 additions & 0 deletions ACE/ace/WIN32_Asynch_IO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,12 @@ ACE_WIN32_Asynch_Operation::cancel (void)

// @@ This API returns 0 on failure. So, I am returning -1 in that
// case. Is that right? (Alex).
#if (_WIN32_WINNT < 0x0600)
int const result = (int) ::CancelIo (this->handle_);
#else
int const result = (int) ::CancelIoEx (this->handle_,
0);
#endif /* _WIN32_WINNT < 0x0600 */

if (result == 0)
// Couldn't cancel the operations.
Expand Down
6 changes: 6 additions & 0 deletions ACE/ace/WIN32_Proactor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,12 @@ ACE_WIN32_Proactor::application_specific_code (ACE_WIN32_Asynch_Result *asynch_r
const void *completion_key,
u_long error)
{
// *NOTE*: on Win32 with MSVC (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS set), this
// needs to be compiled with '/EHa' to work properly, otherwise
// 'finally' is skipped, leaking memory
// *TODO*: the default (auto-)generated MPC MSVC project files do not enforce
// this (uses '/EHsc', see $MPC_ROOT/templates/nmakedll.mpt:36)
// *WORKAROUND*: #undef(ine) ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS in config.h
ACE_SEH_TRY
{
// Call completion hook
Expand Down
6 changes: 6 additions & 0 deletions ACE/ace/ace.mpc
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,9 @@ project(ACE) : ace_output, acedefaults, install, other, codecs, token, svcconf,

Inline_Files {
Bound_Ptr.inl
Condition_Recursive_Thread_Mutex.inl
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably similar changes have to be made in ace_for_tao.mpc

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I noticed there are other files missing in the lists.

I don't really want to repair the ACE project configurations at this time, partly because I don't yet understand very much about MPC

Condition_T.inl
Condition_Thread_Mutex.inl
Guard_T.inl
Handle_Gobbler.inl
Intrusive_Auto_Ptr.inl
Expand All @@ -392,6 +394,7 @@ project(ACE) : ace_output, acedefaults, install, other, codecs, token, svcconf,
Reverse_Lock_T.inl
TSS_T.inl
Time_Value_T.inl
Timer_Queue_Adapters.inl
}

Header_Files {
Expand All @@ -404,7 +407,9 @@ project(ACE) : ace_output, acedefaults, install, other, codecs, token, svcconf,
Codeset_Symbols.h
CORBA_macros.h
Codeset_Symbols.h
Condition_Recursive_Thread_Mutex.h
Condition_T.h
Condition_Thread_Mutex.h
Countdown_Time.h
Default_Constants.h
Event_Base.h
Expand Down Expand Up @@ -459,6 +464,7 @@ project(ACE) : ace_output, acedefaults, install, other, codecs, token, svcconf,
Timer_Heap.h
Timer_List.h
Timer_Queue.h
Timer_Queue_Adapters.h
Timer_Queuefwd.h
Timer_Wheel.h
Truncate.h
Expand Down
17 changes: 16 additions & 1 deletion ACE/ace/config-g++-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,22 @@
# if __cplusplus > 201103L
# define ACE_HAS_CPP14
# endif
#endif
#endif /* __GNUC__ >= 4.7 */

// *NOTE*: this feature may go back further, see e.g.:
// https://gcc.gnu.org/projects/cxx0x.html
#if defined (ACE_HAS_CPP11)
# if (__GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
# define ACE_HAS_CPP11_EXTERN_TEMPLATES
# endif /* __GNUC__ >= 4.3 */

// *NOTE*: suppress a warning, g++ 5.2.1 does not support attributes on template
// instantiation declarations
// *TODO*: this probably goes back further than 5.2
# if (__GNUC__ >= 6 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 2))
# define ACE_LACKS_CPP11_EXTERN_TEMPLATE_ATTRIBUTES
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about gcc 6.x, still needed? Your remark is just about 5.2.1

Copy link
Contributor Author

@esohns esohns Oct 30, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this needs to be tested against newer versions of gcc and adjusted when it integrates the C++11 extern template attributes feature in the future. Also, the targeted version range needs tuning, as the patch applies to earlier versions of gcc as well (see TODO: this probably goes back as far as gcc 4.3 when ACE_HAS_CPP11_EXTERN_TEMPLATES was introduced (not verified)).
I don't have access to any other versions of gcc, so I cannot test this exhaustively. However, as this feature merely introduces/suppresses a compiler warning, the impact ought to be minimal, while timely feedback from other users on different platforms is likely.

# endif /* __GNUC__ >= 5.2 */
#endif /* ACE_HAS_CPP11 */

#if (defined (i386) || defined (__i386__)) && !defined (ACE_SIZEOF_LONG_DOUBLE)
# define ACE_SIZEOF_LONG_DOUBLE 12
Expand Down
4 changes: 4 additions & 0 deletions ACE/ace/config-macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@
# if defined (ACE_LACKS_IOSTREAM_TOTALLY)
# define ACE_OSTREAM_TYPE FILE
# else /* ! ACE_LACKS_IOSTREAM_TOTALLY */
# if defined ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB
# define ACE_OSTREAM_TYPE std::ostream
# else
# define ACE_OSTREAM_TYPE ostream
# endif /* ! ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */
# endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */
#endif /* ! ACE_OSTREAM_TYPE */

Expand Down
3 changes: 3 additions & 0 deletions ACE/ace/config-sunos5.11.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@
// #include the SunOS 5.10 config, then add any SunOS 5.11 updates below.
#include "ace/config-sunos5.10.h"

// *TODO*: find out how far this also hold for previous solaris releases
#define ACE_HAS_SOLARIS11_GETPWNAM_R

#endif /* ACE_CONFIG_H */
4 changes: 4 additions & 0 deletions ACE/ace/config-win32-msvc-14.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@
// Visual Studio 2015 has adequate C++11 support
#define ACE_HAS_CPP11

// *TODO*: this C++11-feature goes back further (at least to MSVC 2010), see:
// https://msdn.microsoft.com/en-us/library/hh567368.aspx#featurelist
#define ACE_HAS_CPP11_EXTERN_TEMPLATES

#define ACE_PUTENV_EQUIVALENT ::_putenv
#define ACE_TEMPNAM_EQUIVALENT ::_tempnam
#define ACE_STRDUP_EQUIVALENT ::_strdup
Expand Down
4 changes: 2 additions & 2 deletions ACE/apps/JAWS3/http/HTTP_Service_Handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
#ifndef JAWS_HTTP_SERVICE_HANDLER_H
#define JAWS_HTTP_SERVICE_HANDLER_H

#include "ace/Synch.h"
#include "ace/Acceptor.h"
#include "ace/Svc_Handler.h"
#include "ace/SOCK_Acceptor.h"
#include "ace/Svc_Handler.h"
#include "ace/Synch_Traits.h"

#include "jaws3/Protocol_Handler.h"

Expand Down
4 changes: 2 additions & 2 deletions ACE/apps/JAWS3/jaws3/Cached_Allocator_T.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
#define JAWS_CACHED_ALLOCATOR_T_H

#include "ace/ACE.h"
#include "ace/Synch.h"
#include "ace/Malloc.h"
#include "ace/Free_List.h"
#include "ace/Malloc.h"
#include "ace/Synch_Traits.h"

#define JAWS_DEFAULT_ALLOCATOR_CHUNKS 10
#define JAWS_CACHED_ALLOCATOR(T) \
Expand Down
Loading