summaryrefslogtreecommitdiff
path: root/ace
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>1996-11-20 04:11:25 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>1996-11-20 04:11:25 +0000
commit2e694cc1441a667d366395b889df4d30abe071c9 (patch)
tree0747106206d87c13e6e936a7846a68949abce9bf /ace
parent6de6d532e993dc815715c1b0db5b77bb12fef96b (diff)
downloadATCD-2e694cc1441a667d366395b889df4d30abe071c9.tar.gz
*** empty log message ***
Diffstat (limited to 'ace')
-rw-r--r--ace/Activation_Queue.cpp18
-rw-r--r--ace/Log_Msg.h1
-rw-r--r--ace/Malloc_T.cpp26
-rw-r--r--ace/Malloc_T.h8
-rw-r--r--ace/Message_Queue.h4
-rw-r--r--ace/OS.cpp5
-rw-r--r--ace/OS.h21
-rw-r--r--ace/Pipe.cpp8
-rw-r--r--ace/SOCK_Dgram.cpp3
-rw-r--r--ace/TTY_IO.h2
-rw-r--r--ace/Time_Value.h4
11 files changed, 59 insertions, 41 deletions
diff --git a/ace/Activation_Queue.cpp b/ace/Activation_Queue.cpp
index e536bfb030f..091a8b3c7bd 100644
--- a/ace/Activation_Queue.cpp
+++ b/ace/Activation_Queue.cpp
@@ -44,17 +44,20 @@ ACE_Method_Object *
ACE_Activation_Queue::dequeue (ACE_Time_Value *tv)
{
ACE_Message_Block *mb;
- ACE_Method_Object *mo;
// Dequeue the message.
- this->queue_->dequeue_head (mb, tv);
+ if (this->queue_->dequeue_head (mb, tv) != -1)
+ {
- // Get the method object.
- mo = (ACE_Method_Object *) mb->base ();
+ // Get the method object.
+ ACE_Method_Object *mo = (ACE_Method_Object *) mb->base ();
- // Delete the message block.
- delete mb;
- return mo;
+ // Delete the message block.
+ delete mb;
+ return mo;
+ }
+ else
+ return 0;
}
int
@@ -67,4 +70,3 @@ ACE_Activation_Queue::enqueue (ACE_Method_Object *mo,
return this->queue_->enqueue (mb, tv);
}
-
diff --git a/ace/Log_Msg.h b/ace/Log_Msg.h
index 3c4a784754d..3563c5570db 100644
--- a/ace/Log_Msg.h
+++ b/ace/Log_Msg.h
@@ -1,7 +1,6 @@
/* -*- C++ -*- */
// $Id$
-
// ============================================================================
//
// = LIBRARY
diff --git a/ace/Malloc_T.cpp b/ace/Malloc_T.cpp
index d3f3ebe3313..ee524474e9f 100644
--- a/ace/Malloc_T.cpp
+++ b/ace/Malloc_T.cpp
@@ -454,29 +454,31 @@ ACE_Malloc<ACE_MEM_POOL_2, LOCK>::find (const char *name, void *&pointer)
}
// Returns a count of the number of available chunks that can hold
-// <size> byte allocations.
+// <size> byte allocations. Function can be used to determine if you
+// have reached a water mark. This implies a fixed amount of allocated
+// memory.
+//
+// @param size - the chunk size of that you would like a count of
+// @return function returns the number of chunks of the given size
+// that would fit in the currently allocated memory
template <ACE_MEM_POOL_1, class LOCK> size_t
ACE_Malloc<ACE_MEM_POOL_2, LOCK>::avail_chunks (size_t size) const
{
- ACE_READ_GUARD_RETURN (LOCK, ace_mon, (LOCK &) this->lock_, 0);
+ ACE_TRACE ("ACE_Malloc<ACE_MEM_POOL_2, LOCK>::avail_chunks");
+
+ ACE_READ_GUARD_RETURN (LOCK, ace_mon, (LOCK &) this->lock_, -1);
size_t count = 0;
// Avoid dividing by 0...
size = size == 0 ? 1 : size;
- const size_t sizeof_oversize = sizeof (ACE_Malloc_Header) / size;
for (ACE_Malloc_Header *currp = this->cb_ptr_->freep_->s_.next_block_;
- ;
+ currp != this->cb_ptr_->freep_;
currp = currp->s_.next_block_)
- {
- if (currp->s_.size_ * sizeof (ACE_Malloc_Header) >= sizeof_oversize)
- // How many will fit in this block.
- count += currp->s_.size_ * sizeof_oversize;
-
- if (currp == this->cb_ptr_->freep_)
- break;
- }
+ // calculate how many will fit in this block.
+ if (currp->s_.size_ * sizeof (ACE_Malloc_Header) >= size)
+ count += currp->s_.size_ * sizeof (ACE_Malloc_Header) / size;
return count;
}
diff --git a/ace/Malloc_T.h b/ace/Malloc_T.h
index 7573a05fba7..287117dac1f 100644
--- a/ace/Malloc_T.h
+++ b/ace/Malloc_T.h
@@ -264,7 +264,13 @@ public:
size_t avail_chunks (size_t size) const;
// Returns a count of the number of available chunks that can hold
- // <size> byte allocations.
+ // <size> byte allocations. Function can be used to determine if you
+ // have reached a water mark. This implies a fixed amount of allocated
+ // memory.
+ //
+ // @param size - the chunk size of that you would like a count of
+ // @return function returns the number of chunks of the given size
+ // that would fit in the currently allocated memory.
#if defined (ACE_MALLOC_STATS)
void print_stats (void);
diff --git a/ace/Message_Queue.h b/ace/Message_Queue.h
index 84a96159302..b91a56fda1a 100644
--- a/ace/Message_Queue.h
+++ b/ace/Message_Queue.h
@@ -243,7 +243,7 @@ public:
// Declare the dynamic allocation hooks.
private:
- ACE_Message_Queue <ACE_SYNCH_1> &queue_;
+ ACE_Message_Queue <ACE_SYNCH_2> &queue_;
// Message_Queue we are iterating over.
ACE_Message_Block *curr_;
@@ -276,7 +276,7 @@ public:
// Declare the dynamic allocation hooks.
private:
- ACE_Message_Queue <ACE_SYNCH_1> &queue_;
+ ACE_Message_Queue <ACE_SYNCH_2> &queue_;
// Message_Queue we are iterating over.
ACE_Message_Block *curr_;
diff --git a/ace/OS.cpp b/ace/OS.cpp
index 454309f1c11..e1536cb94e1 100644
--- a/ace/OS.cpp
+++ b/ace/OS.cpp
@@ -52,6 +52,7 @@ ACE_OS::mutex_lock_cleanup (void *mutex)
// guarantees that we've got a "zero'd" thread id even when ACE_thread_t
// is implemented as a structure...
ACE_thread_t ACE_OS::NULL_thread;
+ACE_hthread_t ACE_OS::NULL_hthread;
ACE_OS::ACE_OS (void)
{
@@ -755,7 +756,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
int, -1, result);
::pthread_attr_delete (&attr);
if (thr_handle != 0)
- *thr_handle = (ACE_hthread_t) 0;
+ *thr_handle = ACE_OS::NULL_hthread;
#else /* !ACE_HAS_SETKIND_NP */
ACE_OSCALL (ACE_ADAPT_RETVAL (::pthread_create (p_thr, &attr, func, args),
result),
@@ -769,7 +770,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
*thr_handle = *thr_id;
#else
if (thr_handle != 0)
- thr_handle = (ACE_hthread_t *) 0;
+ *thr_handle = ACE_OS::NULL_hthread;
#endif /* ACE_HAS_STHREADS */
#endif /* ACE_HAS_SETKIND_NP */
return result;
diff --git a/ace/OS.h b/ace/OS.h
index 03a8cec1089..fa268a0ba6b 100644
--- a/ace/OS.h
+++ b/ace/OS.h
@@ -562,10 +562,6 @@ typedef pthread_mutex_t ACE_mutex_t;
typedef pthread_cond_t ACE_cond_t;
typedef pthread_mutex_t ACE_thread_mutex_t;
-#if (!defined (timespec) && !defined (m88k))
-#define timestruc_t struct timespec
-#endif /* timespec */
-
#if !defined (PTHREAD_CANCEL_DISABLE)
#define PTHREAD_CANCEL_DISABLE 0
#endif /* PTHREAD_CANCEL_DISABLE */
@@ -1421,10 +1417,6 @@ extern "C" int sigwait (sigset_t *set);
#include <tiuser.h>
#endif /* ACE_HAS_TIUSER_H */
-#if defined (ACE_HAS_BROKEN_T_ERRNO)
-undef t_errno
-#endif /* ACE_HAS_BROKEN_T_ERRNO */
-
#if defined (ACE_HAS_SVR4_DYNAMIC_LINKING)
#include <dlfcn.h>
#endif /* ACE_HAS_SVR4_DYNAMIC_LINKING */
@@ -1434,6 +1426,7 @@ undef t_errno
#endif /* ACE_HAS_SOCKIO_ */
// There must be a better way to do this...
+#if !defined (RLIMIT_NOFILE)
#if defined (Linux) || defined (AIX) || defined (SCO)
#if defined (RLIMIT_OFILE)
#define RLIMIT_NOFILE RLIMIT_OFILE
@@ -1441,6 +1434,7 @@ undef t_errno
#define RLIMIT_NOFILE 200
#endif /* RLIMIT_OFILE */
#endif /* defined (Linux) || defined (AIX) || defined (SCO) */
+#endif /* RLIMIT_NOFILE */
#if !defined (ACE_HAS_TLI_PROTOTYPES)
// Define ACE_TLI headers for systems that don't prototype them....
@@ -1803,6 +1797,10 @@ typedef int ucontext_t;
#include <tli/timod.h>
#endif /* ACE_HAS_TIMOD_H */
+#if defined (ACE_HAS_BROKEN_T_ERRNO)
+undef t_errno
+#endif /* ACE_HAS_BROKEN_T_ERRNO */
+
// Type of the extended signal handler.
typedef void (*ACE_Sig_Handler_Ex) (int, siginfo_t *siginfo, ucontext_t *ucontext);
@@ -2287,7 +2285,12 @@ public:
static void thr_yield (void);
static ACE_thread_t NULL_thread;
- // This is necessary to deal with POSIX pthreads insanity...
+ // This is necessary to deal with POSIX pthreads and their use of
+ // structures for thread ids.
+
+ static ACE_hthread_t NULL_hthread;
+ // This is necessary to deal with POSIX pthreads and their use of
+ // structures for thread handles.
#if defined (ACE_WIN32)
static int socket_initialized_;
diff --git a/ace/Pipe.cpp b/ace/Pipe.cpp
index 5979e56fb77..89058740368 100644
--- a/ace/Pipe.cpp
+++ b/ace/Pipe.cpp
@@ -53,10 +53,10 @@ ACE_Pipe::open (void)
int one = 1;
// Make sure that the TCP stack doesn't try to buffer small writes.
- if (this->ACE_SOCK::set_option (IPPROTO_TCP,
- TCP_NODELAY,
- &one,
- sizeof one) == -1)
+ // Since this communication is purely local to the host it doesn't
+ // affect network performance.
+ if (writer.set_option (IPPROTO_TCP, TCP_NODELAY,
+ &one, sizeof one) == -1)
return -1;
// Close down the acceptor endpoint since we don't need it anymore.
diff --git a/ace/SOCK_Dgram.cpp b/ace/SOCK_Dgram.cpp
index 95a2cbed7dd..201f8759a72 100644
--- a/ace/SOCK_Dgram.cpp
+++ b/ace/SOCK_Dgram.cpp
@@ -34,7 +34,8 @@ ACE_SOCK_Dgram::recv (iovec *io_vec, ACE_Addr &addr, int flags) const
return -1;
else if (inlen > 0)
{
- io_vec->iov_base = new char[inlen];
+ ACE_NEW_RETURN (io_vec->iov_base, char[inlen], -1);
+
io_vec->iov_len = ACE_OS::recvfrom (this->get_handle (),
io_vec->iov_base,
inlen,
diff --git a/ace/TTY_IO.h b/ace/TTY_IO.h
index 0e348f244cb..f0cbee7d1e5 100644
--- a/ace/TTY_IO.h
+++ b/ace/TTY_IO.h
@@ -26,7 +26,7 @@
#include "ace/DEV_Connector.h"
#include "ace/DEV_IO.h"
-class ACE_TTY_IO : public ACE_DEV_IO
+class ACE_Export ACE_TTY_IO : public ACE_DEV_IO
// = TITLE
// Class definitions for TTY-specific features.
//
diff --git a/ace/Time_Value.h b/ace/Time_Value.h
index 7091d2c1e92..e4cdb1223ae 100644
--- a/ace/Time_Value.h
+++ b/ace/Time_Value.h
@@ -112,6 +112,10 @@ typedef struct timespec
#include <sys/timers.h>
#endif /* ACE_HAS_POSIX_TIME */
+// #if (!defined (timespec) && !defined (m88k))
+// #define timestruc_t struct timespec
+// #endif /* timespec */
+
#if !defined (ACE_HAS_SVR4_TIME)
// Definition per SVr4.
typedef struct timespec timestruc_t;