diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 1997-11-08 22:18:50 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 1997-11-08 22:18:50 +0000 |
commit | 986bdc3a758f0e5033fd08e247af58d44dcb0d65 (patch) | |
tree | 03394aa8ab965a84f6827e4ab840861a029ed0d1 /ace | |
parent | 46aec2e166665eb1af90231035c95f553377970e (diff) | |
download | ATCD-986bdc3a758f0e5033fd08e247af58d44dcb0d65.tar.gz |
*** empty log message ***
Diffstat (limited to 'ace')
-rw-r--r-- | ace/ACE.cpp | 42 | ||||
-rw-r--r-- | ace/Select_Reactor.cpp | 2 | ||||
-rw-r--r-- | ace/Thread_Manager.h | 10 | ||||
-rw-r--r-- | ace/Timer_Queue_Adapters.cpp | 10 |
4 files changed, 39 insertions, 25 deletions
diff --git a/ace/ACE.cpp b/ace/ACE.cpp index 2c49d5724e7..53668c04fda 100644 --- a/ace/ACE.cpp +++ b/ace/ACE.cpp @@ -1494,25 +1494,41 @@ int ACE::set_handle_limit (int new_limit) { ACE_TRACE ("ACE::set_handle_limit"); -#if defined (RLIMIT_NOFILE) && !defined (ACE_LACKS_RLIMIT) - struct rlimit rl; + ACE_TRACE ("ACE::set_handle_limit"); + int cur_limit = ACE::max_handles (); - if (ACE_OS::getrlimit (RLIMIT_NOFILE, &rl) != -1) - { - int max_handles = rl.rlim_cur; + if (cur_limit == -1) + return -1; - if (new_limit < 0 || new_limit > max_handles) - rl.rlim_cur = max_handles; - else - rl.rlim_cur = new_limit; + if (new_limit < 0) + { + errno = EINVAL; + return -1; + } + if (new_limit > cur_limit) + { +#if !defined (ACE_LACKS_RLIMIT) + struct rlimit rl; + ACE_OS::memset ((void *) &rl, 0, sizeof rl); + rl.rlim_cur = new_limit; return ACE_OS::setrlimit (RLIMIT_NOFILE, &rl); +#else + // Must be return EINVAL errno. + ACE_NOTSUP_RETURN (-1); +#endif /* ACE_LACKS_RLIMIT */ } else - return -1; + { +#if !defined (ACE_LACKS_RLIMIT) + struct rlimit rl; + ACE_OS::memset ((void *) &rl, 0, sizeof rl); + rl.rlim_cur = new_limit; + return ACE_OS::setrlimit (RLIMIT_NOFILE, &rl); #else - new_limit = new_limit; - ACE_NOTSUP_RETURN (-1); -#endif /* defined (RLIMIT_NOFILE) && !defined (ACE_LACKS_RLIMIT) */ + // We give a chance to platforms with not RLIMIT to work. + ACE_NOTSUP_RETURN (0); +#endif /* ACE_LACKS_RLIMIT */ + } } // Flags are file status flags to turn on. diff --git a/ace/Select_Reactor.cpp b/ace/Select_Reactor.cpp index 80481ec560c..9df2d53c871 100644 --- a/ace/Select_Reactor.cpp +++ b/ace/Select_Reactor.cpp @@ -112,13 +112,11 @@ ACE_Select_Reactor_Handler_Repository::open (size_t size) errno = ERANGE; return -1; } -#if defined (RLIMIT_NOFILE) && !defined (ACE_LACKS_RLIMIT) // Increase the number of handles if <size> is greater than the // current limit. if (size < (size_t) ACE::max_handles ()) return ACE::set_handle_limit (size); else -#endif /* defined (RLIMIT_NOFILE) && !defined (ACE_LACKS_RLIMIT) */ return 0; } diff --git a/ace/Thread_Manager.h b/ace/Thread_Manager.h index c4fe8196bed..ea6468db2d4 100644 --- a/ace/Thread_Manager.h +++ b/ace/Thread_Manager.h @@ -114,9 +114,9 @@ class ACE_Thread_Control; // problems on g++/VxWorks/i960 with -g. Note that // ACE_Thread_Manager::THR_FUNC is only used internally in // ACE_Thread_Manager, so it's not useful for anyone else. -#if defined (VXWORKS) +#if defined (VXWORKS) || defined (IRIX5) typedef int (ACE_Thread_Manager::*ACE_THR_MEMBER_FUNC)(ACE_Thread_Descriptor *, int); -#endif /* VXWORKS */ +#endif /* VXWORKS || IRIX5 */ class ACE_Export ACE_Thread_Manager // = TITLE @@ -127,9 +127,9 @@ class ACE_Export ACE_Thread_Manager { friend class ACE_Thread_Control; public: -#if !defined (VXWORKS) - typedef int (ACE_Thread_Manager::*ACE_THR_MEMBER_FUNC)(ACE_Thread_Descriptor *, int); -#endif /* !VXWORKS */ +#if !defined (VXWORKS) && !defined (IRIX5) + typedef int (*ACE_THR_MEMBER_FUNC)(ACE_Thread_Descriptor *, int); +#endif /* !VXWORKS && !IRIX5 */ // = Initialization and termination methods. ACE_Thread_Manager (size_t size = 0); diff --git a/ace/Timer_Queue_Adapters.cpp b/ace/Timer_Queue_Adapters.cpp index bef4d4af92b..ccc956ff944 100644 --- a/ace/Timer_Queue_Adapters.cpp +++ b/ace/Timer_Queue_Adapters.cpp @@ -142,7 +142,7 @@ ACE_Async_Timer_Queue_Adapter<TQ>::handle_signal (int signum, template<class TQ> ACE_Thread_Timer_Queue_Adapter<TQ>::ACE_Thread_Timer_Queue_Adapter (ACE_Thread_Manager *tm) : ACE_Task_Base (tm), - condition_ (lock_), + condition_ (mutex_), active_ (1), // Assume that we start in active mode. thr_id_ (ACE_OS::NULL_thread) { @@ -161,7 +161,7 @@ ACE_Thread_Timer_Queue_Adapter<TQ>::schedule const ACE_Time_Value &delay, const ACE_Time_Value &interval) { - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1); + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->mutex_, -1); long result = this->timer_queue_.schedule (handler, act, delay, interval); this->condition_.signal (); @@ -172,7 +172,7 @@ template<class TQ> int ACE_Thread_Timer_Queue_Adapter<TQ>::cancel (long timer_id, const void **act) { - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1); + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->mutex_, -1); int result = this->timer_queue_.cancel (timer_id, act); condition_.signal (); @@ -182,7 +182,7 @@ ACE_Thread_Timer_Queue_Adapter<TQ>::cancel (long timer_id, template<class TQ> void ACE_Thread_Timer_Queue_Adapter<TQ>::deactivate (void) { - ACE_GUARD (ACE_SYNCH_MUTEX, ace_mon, this->lock_); + ACE_GUARD (ACE_SYNCH_MUTEX, ace_mon, this->mutex_); this->active_ = 0; this->condition_.signal (); @@ -191,7 +191,7 @@ ACE_Thread_Timer_Queue_Adapter<TQ>::deactivate (void) template<class TQ> int ACE_Thread_Timer_Queue_Adapter<TQ>::svc (void) { - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1); + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->mutex_, -1); this->thr_id_ = ACE_Thread::self (); |