diff options
Diffstat (limited to 'ace')
-rw-r--r-- | ace/ACE.cpp | 294 | ||||
-rw-r--r-- | ace/Dump.cpp | 25 | ||||
-rw-r--r-- | ace/Future.cpp | 55 | ||||
-rw-r--r-- | ace/Local_Name_Space.cpp | 42 | ||||
-rw-r--r-- | ace/Local_Tokens.cpp | 131 | ||||
-rw-r--r-- | ace/Log_Msg.cpp | 279 | ||||
-rw-r--r-- | ace/Malloc.cpp | 21 | ||||
-rw-r--r-- | ace/Message_Block.cpp | 144 | ||||
-rw-r--r-- | ace/Naming_Context.cpp | 142 | ||||
-rw-r--r-- | ace/Object_Manager.cpp | 9 | ||||
-rw-r--r-- | ace/Parse_Node.cpp | 88 | ||||
-rw-r--r-- | ace/Reactor.cpp | 312 | ||||
-rw-r--r-- | ace/Remote_Tokens.cpp | 62 | ||||
-rw-r--r-- | ace/Service_Config.cpp | 83 | ||||
-rw-r--r-- | ace/Service_Record.cpp | 61 | ||||
-rw-r--r-- | ace/Signal.cpp | 88 | ||||
-rw-r--r-- | ace/Synch.cpp | 138 | ||||
-rw-r--r-- | ace/System_Time.cpp | 22 | ||||
-rw-r--r-- | ace/Task.cpp | 40 | ||||
-rw-r--r-- | ace/Timer_Hash.cpp | 79 | ||||
-rw-r--r-- | ace/Timer_Heap.cpp | 8 | ||||
-rw-r--r-- | ace/Timer_List.cpp | 8 | ||||
-rw-r--r-- | ace/Timer_Queue.cpp | 12 | ||||
-rw-r--r-- | ace/Timer_Wheel.cpp | 8 | ||||
-rw-r--r-- | ace/Token.cpp | 74 | ||||
-rw-r--r-- | ace/Token_Collection.cpp | 27 | ||||
-rw-r--r-- | ace/Token_Invariants.cpp | 42 | ||||
-rw-r--r-- | ace/Token_Manager.cpp | 35 |
28 files changed, 1282 insertions, 1047 deletions
diff --git a/ace/ACE.cpp b/ace/ACE.cpp index 2df2424173d..e08d97c978c 100644 --- a/ace/ACE.cpp +++ b/ace/ACE.cpp @@ -17,9 +17,9 @@ // Size of a VM page. size_t ACE::pagesize_ = 0; -void +void ACE::unique_name (const void *object, - LPTSTR name, + LPTSTR name, size_t length) { // The process ID will provide uniqueness between processes on the @@ -27,7 +27,7 @@ ACE::unique_name (const void *object, // uniqueness between other "live" objects in the same process. The // uniqueness of this name is therefore only valid for the life of // <object>. - TCHAR temp_name[ACE_UNIQUE_NAME_LEN]; + TCHAR temp_name[ACE_UNIQUE_NAME_LEN]; ACE_OS::sprintf (temp_name, __TEXT ("%d %d"), ACE_OS::getpid (), object); ACE_OS::strncpy (name, temp_name, length); } @@ -37,7 +37,7 @@ ACE::terminate_process (pid_t pid) { #if defined (ACE_WIN32) // Create a handle for the given process id. - ACE_HANDLE process_handle = + ACE_HANDLE process_handle = ::OpenProcess (PROCESS_TERMINATE, FALSE, // New handle is not inheritable. pid); @@ -82,7 +82,7 @@ ACE::process_active (pid_t pid) ACE_HANDLE process_handle = ::OpenProcess (PROCESS_QUERY_INFORMATION, FALSE, pid); - if (process_handle == ACE_INVALID_HANDLE + if (process_handle == ACE_INVALID_HANDLE || process_handle == NULL) return 0; else @@ -104,14 +104,14 @@ ACE::register_stdin_handler (ACE_Event_Handler *eh, ACE_Reactor *reactor, ACE_Thread_Manager *thr_mgr, int flags) -{ +{ #if defined (ACE_WIN32) ACE_Stdin_Args *args = 0; ACE_NEW_RETURN (args, ACE_Stdin_Args, -1); args->handler_ = eh; - args->thr_mgr_ = thr_mgr; + args->thr_mgr_ = thr_mgr; return thr_mgr->spawn (&ACE::read_adapter, args, flags); -#else +#else // Keep compilers happy. ACE_UNUSED_ARG (flags); ACE_UNUSED_ARG (thr_mgr); @@ -132,8 +132,8 @@ ACE::register_stdin_handler (ACE_Event_Handler *eh, void * ACE::read_adapter (void *args) { - ACE_Stdin_Args *stdin_adapter_args = (ACE_Stdin_Args *) args; - ACE_Thread_Control tc (stdin_adapter_args->thr_mgr_); + ACE_Stdin_Args *stdin_adapter_args = (ACE_Stdin_Args *) args; + ACE_Thread_Control tc (stdin_adapter_args->thr_mgr_); ACE_Event_Handler *this_ptr = stdin_adapter_args->handler_; ACE_HANDLE handle = ACE_STDIN; @@ -142,7 +142,7 @@ ACE::read_adapter (void *args) continue; this_ptr->handle_close (handle, ACE_Event_Handler::READ_MASK); - + delete stdin_adapter_args; return 0; } @@ -156,7 +156,7 @@ ACE::execname (const char *old_name) char *new_name; ACE_NEW_RETURN (new_name, char[ACE_OS::strlen (old_name) + - ACE_OS::strlen (".exe") + + ACE_OS::strlen (".exe") + 1], -1); char *end = new_name; end = ACE::strecpy (new_name, old_name); @@ -172,7 +172,7 @@ u_long ACE::hash_pjw (const char *str) { u_long hash = 0; - + for (const char *temp = str; *temp != 0; temp++) { hash = (hash << 4) + (*temp * 13); @@ -193,7 +193,7 @@ u_long ACE::hash_pjw (const ACE_USHORT16 *str) { u_long hash = 0; - + for (const ACE_USHORT16 *temp = str; *temp != 0; temp++) { hash = (hash << 4) + (*temp * 13); @@ -251,7 +251,7 @@ netsvc netsvc.dll libnetsvc.so (PATH will be evaluated) (LD_LIBRARY_PATH evaluated) libnetsvc.dll libnetsvc.dll libnetsvc.dll + warning -netsvc.so netsvc.so + warning libnetsvc.so +netsvc.so netsvc.so + warning libnetsvc.so ..\../libs/netsvc ..\..\libs\netsvc.dll ../../libs/netsvc.so (absolute path used) (absolute path used) @@ -260,11 +260,11 @@ netsvc.so netsvc.so + warning libnetsvc.so int ACE::ldfind (const char filename[], - char pathname[], + char pathname[], size_t maxpathnamelen) { ACE_TRACE ("ACE::ldfind"); - + char tempcopy[MAXPATHLEN]; char searchpathname[MAXPATHLEN]; char searchfilename[MAXPATHLEN]; @@ -294,7 +294,7 @@ ACE::ldfind (const char filename[], { searchpathname[0] = '\0'; ACE_OS::strcpy (searchfilename, tempcopy); - } + } else // This is an absolute path. { ACE_OS::strcpy (searchfilename, separator_ptr + 1); @@ -314,30 +314,30 @@ ACE::ldfind (const char filename[], if (ACE_OS::strcmp (s, ACE_DLL_SUFFIX) == 0) got_suffix = 1; else - ACE_ERROR ((LM_WARNING, - "Warning: improper suffix for a shared library on this platform: %s\n", + ACE_ERROR ((LM_WARNING, + "Warning: improper suffix for a shared library on this platform: %s\n", s)); } // Make sure we've got enough space in searchfilename. - if (ACE_OS::strlen (searchfilename) + - ACE_OS::strlen (ACE_DLL_PREFIX) + + if (ACE_OS::strlen (searchfilename) + + ACE_OS::strlen (ACE_DLL_PREFIX) + got_suffix ? 0 : ACE_OS::strlen (ACE_DLL_SUFFIX) >= (sizeof searchfilename / sizeof (char))) { errno = ENOMEM; return -1; - } + } // Use absolute pathname if there is one. if (ACE_OS::strlen (searchpathname) > 0) { - if (ACE_OS::strlen (searchfilename) - + ACE_OS::strlen (searchpathname) >= maxpathnamelen) + if (ACE_OS::strlen (searchfilename) + + ACE_OS::strlen (searchpathname) >= maxpathnamelen) { errno = ENOMEM; return -1; - } - else + } + else { if (ACE_DIRECTORY_SEPARATOR_CHAR != '/') // Revert to native path name separators @@ -347,16 +347,16 @@ ACE::ldfind (const char filename[], // prefix. ACE_OS::sprintf (pathname, "%s%s%s", searchpathname, - searchfilename, + searchfilename, got_suffix ? "" : ACE_DLL_SUFFIX); if (ACE_OS::access (pathname, F_OK) == 0) return 0; // Second, try matching the filename *with* adding a prefix. - ACE_OS::sprintf (pathname, "%s%s%s%s", + ACE_OS::sprintf (pathname, "%s%s%s%s", searchpathname, ACE_DLL_PREFIX, - searchfilename, + searchfilename, got_suffix ? "" : ACE_DLL_SUFFIX); if (ACE_OS::access (pathname, F_OK) == 0) return 0; @@ -365,21 +365,21 @@ ACE::ldfind (const char filename[], // Use relative filenames via LD_LIBRARY_PATH or PATH (depending on // OS platform). - else + else { char *ld_path = ACE_OS::getenv (ACE_LD_SEARCH_PATH); if (ld_path != 0 && (ld_path = ACE_OS::strdup (ld_path)) != 0) { // Look at each dynamic lib directory in the search path. - char *path_entry = ACE_OS::strtok + char *path_entry = ACE_OS::strtok (ld_path, ACE_LD_SEARCH_PATH_SEPARATOR_STR); - + int result = 0; while (path_entry != 0) { - if (ACE_OS::strlen (path_entry) + if (ACE_OS::strlen (path_entry) + 1 + ACE_OS::strlen (searchfilename) >= maxpathnamelen) { errno = ENOMEM; @@ -391,7 +391,7 @@ ACE::ldfind (const char filename[], // prefix. ACE_OS::sprintf (pathname, "%s%c%s", path_entry, - ACE_DIRECTORY_SEPARATOR_CHAR, + ACE_DIRECTORY_SEPARATOR_CHAR, searchfilename); if (ACE_OS::access (pathname, F_OK) == 0) break; @@ -400,13 +400,13 @@ ACE::ldfind (const char filename[], // prefix. ACE_OS::sprintf (pathname, "%s%c%s%s", path_entry, - ACE_DIRECTORY_SEPARATOR_CHAR, + ACE_DIRECTORY_SEPARATOR_CHAR, ACE_DLL_PREFIX, searchfilename); if (ACE_OS::access (pathname, F_OK) == 0) break; - path_entry = ACE_OS::strtok + path_entry = ACE_OS::strtok (0, ACE_LD_SEARCH_PATH_SEPARATOR_STR); } @@ -436,7 +436,7 @@ ACE::basename (const char *pathname, char delim) { ACE_TRACE ("ACE::basename"); const char *temp = ::strrchr (pathname, delim); - + if (temp == 0) return pathname; else @@ -449,7 +449,7 @@ ACE::basename (const wchar_t *pathname, wchar_t delim) { ACE_TRACE ("ACE::basename"); const wchar_t *temp = ACE_OS::strrchr (pathname, delim); - + if (temp == 0) return pathname; else @@ -468,7 +468,7 @@ ACE::send_n (ACE_HANDLE handle, const void *buf, size_t len) for (bytes_written = 0; bytes_written < len; bytes_written += n) { - n = ACE::send (handle, (const char *) buf + bytes_written, + n = ACE::send (handle, (const char *) buf + bytes_written, len - bytes_written); if (n == -1) { @@ -483,9 +483,9 @@ ACE::send_n (ACE_HANDLE handle, const void *buf, size_t len) } ssize_t -ACE::send_n (ACE_HANDLE handle, - const void *buf, - size_t len, +ACE::send_n (ACE_HANDLE handle, + const void *buf, + size_t len, int flags) { ACE_TRACE ("ACE::send_n"); @@ -494,9 +494,9 @@ ACE::send_n (ACE_HANDLE handle, for (bytes_written = 0; bytes_written < len; bytes_written += n) { - n = ACE_OS::send (handle, (const char *) buf + bytes_written, + n = ACE_OS::send (handle, (const char *) buf + bytes_written, len - bytes_written, flags); - + if (n == -1) { if (errno != EWOULDBLOCK) @@ -512,9 +512,9 @@ ACE::send_n (ACE_HANDLE handle, // Receive <len> bytes into <buf> from <handle> (uses the <write> // system call on UNIX and the <WriteFile> call on Win32). -ssize_t -ACE::write_n (ACE_HANDLE handle, - const void *buf, +ssize_t +ACE::write_n (ACE_HANDLE handle, + const void *buf, size_t len) { ACE_TRACE ("ACE::write_n"); @@ -524,7 +524,7 @@ ACE::write_n (ACE_HANDLE handle, for (bytes_written = 0; bytes_written < len; bytes_written += n) { - n = ACE_OS::write (handle, (const char *) buf + bytes_written, + n = ACE_OS::write (handle, (const char *) buf + bytes_written, len - bytes_written); if (n == -1) { @@ -559,7 +559,7 @@ ACE::recv_n (ACE_HANDLE handle, void *buf, size_t len) else if (n == 0) break; } - return bytes_read; + return bytes_read; } ssize_t @@ -584,15 +584,15 @@ ACE::recv_n (ACE_HANDLE handle, void *buf, size_t len, int flags) break; } - return bytes_read; + return bytes_read; } // Receive <len> bytes into <buf> from <handle> (uses the <read> // system call on UNIX and the <ReadFile> call on Win32). -ssize_t -ACE::read_n (ACE_HANDLE handle, - void *buf, +ssize_t +ACE::read_n (ACE_HANDLE handle, + void *buf, size_t len) { ACE_TRACE ("ACE::read_n"); @@ -615,14 +615,14 @@ ACE::read_n (ACE_HANDLE handle, break; } - return bytes_read; + return bytes_read; } // Format buffer into printable format. This is useful for debugging. // Portions taken from mdump by J.P. Knight (J.P.Knight@lut.ac.uk) // Modifications by Todd Montgomery. -int +int ACE::format_hexdump (const char *buffer, int size, char *obuf, int obuf_sz) { ACE_TRACE ("ACE::format_hexdump"); @@ -641,7 +641,7 @@ ACE::format_hexdump (const char *buffer, int size, char *obuf, int obuf_sz) { int j; - for (j = 0 ; j < 16; j++) + for (j = 0 ; j < 16; j++) { c = buffer[(i << 4) + j]; ACE_OS::sprintf (obuf, "%02x ", c); @@ -658,13 +658,13 @@ ACE::format_hexdump (const char *buffer, int size, char *obuf, int obuf_sz) ACE_OS::sprintf (obuf, " %s\n", textver); - while (*obuf != '\0') + while (*obuf != '\0') obuf++; } if (size % 16) { - for (i = 0 ; i < size % 16; i++) + for (i = 0 ; i < size % 16; i++) { c = buffer[size - size % 16 + i]; ACE_OS::sprintf (obuf,"%02x ",c); @@ -677,12 +677,12 @@ ACE::format_hexdump (const char *buffer, int size, char *obuf, int obuf_sz) textver[i] = (c < 0x20 || c > 0x7e) ? '.' : c; } - for (i = size % 16; i < 16; i++) + for (i = size % 16; i < 16; i++) { ACE_OS::sprintf (obuf, " "); obuf += 3; textver[i] = ' '; - } + } textver[i] = 0; ACE_OS::sprintf (obuf, " %s\n", textver); @@ -729,7 +729,7 @@ ACE::timestamp (char date_and_time[], int date_and_timelen) ACE_OS::strncpy (date_and_time, timebuf, date_and_timelen); ACE_OS::sprintf (&date_and_time[19], ".%06d", cur_time.usec ()); #endif /* WIN32 */ - date_and_time[26] = '\0'; + date_and_time[26] = '\0'; return &date_and_time[11]; } @@ -759,7 +759,7 @@ ACE::round_to_pagesize (off_t len) return (len + (ACE::pagesize_ - 1)) & ~(ACE::pagesize_ - 1); } -ACE_HANDLE +ACE_HANDLE ACE::handle_timed_complete (ACE_HANDLE h, ACE_Time_Value *timeout) { @@ -775,15 +775,15 @@ ACE::handle_timed_complete (ACE_HANDLE h, wr_handles.set_bit (h); #if defined (ACE_WIN32) - int n = ACE_OS::select (int (h) + 1, + int n = ACE_OS::select (int (h) + 1, rd_handles, wr_handles, ex_handles, timeout); #else - int n = ACE_OS::select (int (h) + 1, + int n = ACE_OS::select (int (h) + 1, rd_handles, - wr_handles, + wr_handles, 0, timeout); #endif /* ACE_WIN32 */ @@ -823,13 +823,13 @@ ACE::handle_timed_complete (ACE_HANDLE h, // 1. The HANDLE is ready for writing or 2. recv() returned that // there are data to be read, which indicates the connection was // successfully established. - return h; + return h; } ACE_HANDLE ACE::handle_timed_open (ACE_Time_Value *timeout, LPCTSTR name, - int flags, + int flags, int perms) { ACE_TRACE ("ACE::handle_timed_open"); @@ -837,11 +837,11 @@ ACE::handle_timed_open (ACE_Time_Value *timeout, if (timeout != 0) { // Open the named pipe or file using non-blocking mode... - ACE_HANDLE handle = ACE_OS::open (name, - flags | ACE_NONBLOCK, + ACE_HANDLE handle = ACE_OS::open (name, + flags | ACE_NONBLOCK, perms); if (handle == ACE_INVALID_HANDLE - && (errno == EWOULDBLOCK + && (errno == EWOULDBLOCK && (timeout->sec () > 0 || timeout->usec () > 0))) // This expression checks if we were polling. errno = ETIMEDOUT; @@ -854,8 +854,8 @@ ACE::handle_timed_open (ACE_Time_Value *timeout, // Wait up to <timeout> amount of time to accept a connection. -int -ACE::handle_timed_accept (ACE_HANDLE listener, +int +ACE::handle_timed_accept (ACE_HANDLE listener, ACE_Time_Value *timeout, int restart) { @@ -872,8 +872,8 @@ ACE::handle_timed_accept (ACE_HANDLE listener, for (;;) { - switch (ACE_OS::select (int (listener) + 1, - rd_handle, 0, 0, + switch (ACE_OS::select (int (listener) + 1, + rd_handle, 0, 0, timeout)) { case -1: @@ -938,15 +938,15 @@ ACE::bind_port (ACE_HANDLE handle) else { upper_limit--; - + // Wrap back around when we reach the bottom. if (upper_limit <= lower_limit) upper_limit = ACE_MAX_DEFAULT_PORT; - - // See if we have already gone around once! + + // See if we have already gone around once! if (upper_limit == round_trip) { - errno = EAGAIN; + errno = EAGAIN; return -1; } } @@ -1014,7 +1014,7 @@ ACE::max_handles (void) // If NEW_LIMIT == -1 set the limit to the maximum allowable. // Otherwise, set it to be the value of NEW_LIMIT. -int +int ACE::set_handle_limit (int new_limit) { ACE_TRACE ("ACE::set_handle_limit"); @@ -1045,7 +1045,7 @@ ACE::set_flags (ACE_HANDLE handle, int flags) switch (flags) { case ACE_NONBLOCK: - // nonblocking argument (1) + // nonblocking argument (1) // blocking: (0) { u_long nonblock = 1; @@ -1061,7 +1061,7 @@ ACE::set_flags (ACE_HANDLE handle, int flags) return -1; // Turn on flags. - ACE_SET_BITS (val, flags); + ACE_SET_BITS (val, flags); if (ACE_OS::fcntl (handle, F_SETFL, val) == -1) return -1; @@ -1081,7 +1081,7 @@ ACE::clr_flags (ACE_HANDLE handle, int flags) switch (flags) { case ACE_NONBLOCK: - // nonblocking argument (1) + // nonblocking argument (1) // blocking: (0) { u_long nonblock = 0; @@ -1097,7 +1097,7 @@ ACE::clr_flags (ACE_HANDLE handle, int flags) return -1; // Turn flags off. - ACE_CLR_BITS (val, flags); + ACE_CLR_BITS (val, flags); if (ACE_OS::fcntl (handle, F_SETFL, val) == -1) return -1; @@ -1121,10 +1121,10 @@ ACE::map_errno (int error) } ssize_t -ACE::send (ACE_HANDLE handle, - const void *buf, - size_t n, - int flags, +ACE::send (ACE_HANDLE handle, + const void *buf, + size_t n, + int flags, const ACE_Time_Value *timeout) { if (timeout == 0) @@ -1178,9 +1178,9 @@ ACE::send (ACE_HANDLE handle, } ssize_t -ACE::send (ACE_HANDLE handle, - const void *buf, - size_t n, +ACE::send (ACE_HANDLE handle, + const void *buf, + size_t n, const ACE_Time_Value *timeout) { if (timeout == 0) @@ -1239,10 +1239,10 @@ ACE::send (ACE_HANDLE handle, } ssize_t -ACE::send_n (ACE_HANDLE handle, - const void *buf, - size_t n, - int flags, +ACE::send_n (ACE_HANDLE handle, + const void *buf, + size_t n, + int flags, const ACE_Time_Value *timeout) { size_t bytes_written; @@ -1252,7 +1252,7 @@ ACE::send_n (ACE_HANDLE handle, for (bytes_written = 0; bytes_written < n; bytes_written += i) { - i = ACE::send (handle, (char *) buf + bytes_written, + i = ACE::send (handle, (char *) buf + bytes_written, n - bytes_written, flags, timeout); if (i == -1) break; @@ -1262,10 +1262,10 @@ ACE::send_n (ACE_HANDLE handle, } ssize_t -ACE::recv (ACE_HANDLE handle, - void *buf, - size_t n, - int flags, +ACE::recv (ACE_HANDLE handle, + void *buf, + size_t n, + int flags, const ACE_Time_Value *timeout) { if (timeout == 0) @@ -1295,10 +1295,10 @@ ACE::recv (ACE_HANDLE handle, } ssize_t -ACE::recv_n (ACE_HANDLE handle, - void *buf, - size_t n, - int flags, +ACE::recv_n (ACE_HANDLE handle, + void *buf, + size_t n, + int flags, const ACE_Time_Value *timeout) { size_t bytes_received; @@ -1308,7 +1308,7 @@ ACE::recv_n (ACE_HANDLE handle, for (bytes_received = 0; bytes_received < n; bytes_received += i) { - i = ACE::recv (handle, (char *) buf + bytes_received, + i = ACE::recv (handle, (char *) buf + bytes_received, n - bytes_received, flags, timeout); if (i == -1 || i == 0) @@ -1442,7 +1442,7 @@ ACE::sock_error (int error) int ACE::get_bcast_addr (ACE_UINT32 &bcast_addr, const char *host_name, - ACE_UINT32 host_addr, + ACE_UINT32 host_addr, ACE_HANDLE handle) { ACE_TRACE ("ACE::get_bcast_addr"); @@ -1482,19 +1482,19 @@ ACE::get_bcast_addr (ACE_UINT32 &bcast_addr, return -1; else ACE_OS::memcpy ((char *) &ip_addr.sin_addr.s_addr, - (char *) hp->h_addr, + (char *) hp->h_addr, hp->h_length); } else { ACE_OS::memset ((void *) &ip_addr, 0, sizeof ip_addr); - ACE_OS::memcpy ((void *) &ip_addr.sin_addr, - (void*) &host_addr, + ACE_OS::memcpy ((void *) &ip_addr.sin_addr, + (void*) &host_addr, sizeof ip_addr.sin_addr); } for (int n = ifc.ifc_len / sizeof (struct ifreq); - n > 0; + n > 0; n--, ifr++) { struct sockaddr_in if_addr; @@ -1538,12 +1538,12 @@ ACE::get_bcast_addr (ACE_UINT32 &bcast_addr, ACE_ERROR ((LM_ERROR, "%p\n", "ACE::get_bcast_addr: ioctl (get broadaddr)")); else - { + { ACE_OS::memcpy ((struct sockaddr_in *) &ip_addr, (struct sockaddr_in *) &if_req.ifr_broadaddr, sizeof if_req.ifr_broadaddr); - ACE_OS::memcpy ((void *) &host_addr, + ACE_OS::memcpy ((void *) &host_addr, (void *) &ip_addr.sin_addr, sizeof host_addr); @@ -1577,12 +1577,12 @@ ACE::get_bcast_addr (ACE_UINT32 &bcast_addr, // put into own subroutine. perform some ioctls to retrieve ifconf // list of ifreq structs. -int -ACE::count_interfaces (ACE_HANDLE handle, +int +ACE::count_interfaces (ACE_HANDLE handle, size_t &how_many) { #if defined (sparc) && defined (SIOCGIFNUM) - if (ACE_OS::ioctl (handle, SIOCGIFNUM, (caddr_t) &how_many) == -1) + if (ACE_OS::ioctl (handle, SIOCGIFNUM, (caddr_t) &how_many) == -1) ACE_ERROR_RETURN ((LM_ERROR, "ACE::get_ip_interfaces:ioctl - SIOCGIFNUM failed"), -1); return 0; #elif defined (unix) @@ -1599,7 +1599,7 @@ ACE::count_interfaces (ACE_HANDLE handle, ifreq_size = num_ifs * sizeof (struct ifreq); p_ifs = (struct ifreq *) ACE_OS::malloc (ifreq_size); - if (!p_ifs) + if (!p_ifs) { errno = ENOMEM; return -1; @@ -1608,20 +1608,20 @@ ACE::count_interfaces (ACE_HANDLE handle, ACE_OS::memset (p_ifs, 0, ifreq_size); ACE_OS::memset (&ifcfg, 0, sizeof (struct ifconf)); ifcfg.ifc_req = p_ifs; - ifcfg.ifc_len = ifreq_size; - - if (ACE_OS::ioctl (handle, SIOCGIFCONF, (caddr_t) &ifcfg) == -1) + ifcfg.ifc_len = ifreq_size; + + if (ACE_OS::ioctl (handle, SIOCGIFCONF, (caddr_t) &ifcfg) == -1) { ACE_OS::free (ifcfg.ifc_req); ACE_ERROR_RETURN ((LM_ERROR, "count_interfaces:ioctl - SIOCGIFCONF failed"), -1); - } + } int if_count = 0, i ; // get if address out of ifreq buffers. // ioctl puts a blank-named interface to mark the end of the // returned interfaces. - for (i = 0; i < num_ifs; p_ifs++, i++) + for (i = 0; i < num_ifs; p_ifs++, i++) { if (p_ifs->ifr_name[0] == '\0') break; @@ -1659,25 +1659,25 @@ ACE::get_handle (void) // Return value in buffer for a key/name pair from the Windows // Registry up to buf_len size. -static int +static int get_reg_value (const TCHAR *key, const TCHAR *name, TCHAR *buffer, DWORD &buf_len) { - HKEY hk; + HKEY hk; DWORD buf_type; LONG rc = RegOpenKeyEx (HKEY_LOCAL_MACHINE, key, 0, KEY_READ, &hk); // 1. open key that defines the interfaces used for TCP/IP? - if (rc != ERROR_SUCCESS) - // print_error_string(TEXT("RegOpenKeyEx"), rc); + if (rc != ERROR_SUCCESS) + // print_error_string(TEXT("RegOpenKeyEx"), rc); return -1; - rc = RegQueryValueEx (hk, name, 0, &buf_type, + rc = RegQueryValueEx (hk, name, 0, &buf_type, (unsigned char *) buffer, &buf_len); - if (rc != ERROR_SUCCESS) + if (rc != ERROR_SUCCESS) { // print_error_string(TEXT("RegEnumKeyEx"), rc); RegCloseKey (hk); @@ -1693,7 +1693,7 @@ get_reg_value (const TCHAR *key, // rc = 0 on success (count == number of interfaces else -1 caller is // responsible for calling delete [] on parray -int +int ACE::get_ip_interfaces (size_t &count, ACE_INET_Addr *&addrs) { @@ -1721,8 +1721,8 @@ ACE::get_ip_interfaces (size_t &count, raw_buflen)) return -1; // return buffer contains NULL delimited strings - - ACE_Tokenizer dev_names (raw_buffer); + + ACE_Tokenizer dev_names (raw_buffer); dev_names.delimiter (__TEXT('\0')); int n_interfaces = 0; @@ -1737,24 +1737,24 @@ ACE::get_ip_interfaces (size_t &count, ACE_NEW_RETURN (addrs, ACE_INET_Addr[n_interfaces], -2); count = 0; - for (int i = 0; i < n_interfaces; i++) + for (int i = 0; i < n_interfaces; i++) { - // a. construct name to access IPAddress for this interface + // a. construct name to access IPAddress for this interface ACE_TEXT_STRING ifdevkey (SVCS_KEY1); ACE_TEXT_STRING the_dev = dev_names.next (); // chop off the "\Device" and keep last name. if (the_dev.length() < 8) return -3; // Something's wrong - else + else { the_dev = the_dev.substring (8); // rest of string from offset 8 ifdevkey += the_dev; ifdevkey += TCP_PARAM_SUBKEY; - // b. extract value - if (get_reg_value (ifdevkey.rep(), IPADDR_NAME_ID, buffer, buf_len)) + // b. extract value + if (get_reg_value (ifdevkey.rep(), IPADDR_NAME_ID, buffer, buf_len)) return -4; if (ACE_OS::strcmp (buffer, INVALID_TCPIP_DEVICE_ADDR) == 0) @@ -1773,7 +1773,7 @@ ACE::get_ip_interfaces (size_t &count, ACE_HANDLE handle = get_handle(); // call specific routine as necessary - if (handle == ACE_INVALID_HANDLE) + if (handle == ACE_INVALID_HANDLE) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE::get_ip_interfaces:open"), -1); if (ACE::count_interfaces (handle, num_ifs)) @@ -1791,19 +1791,19 @@ ACE::get_ip_interfaces (size_t &count, ACE_OS::memset (ifs, 0, num_ifs * sizeof (struct ifreq)); auto_array_ptr<struct ifreq> p_ifs (ifs); - if (p_ifs.get() == 0) + if (p_ifs.get() == 0) { ACE_OS::close (handle); errno = ENOMEM; return -1; } - - struct ifconf ifcfg; + + struct ifconf ifcfg; ACE_OS::memset (&ifcfg, 0, sizeof (struct ifconf)); ifcfg.ifc_req = p_ifs.get (); - ifcfg.ifc_len = num_ifs * sizeof (struct ifreq); + ifcfg.ifc_len = num_ifs * sizeof (struct ifreq); - if (ACE_OS::ioctl (handle, SIOCGIFCONF, (caddr_t) &ifcfg) == -1) + if (ACE_OS::ioctl (handle, SIOCGIFCONF, (caddr_t) &ifcfg) == -1) { ACE_OS::close (handle); ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "is_address_local:ioctl - SIOCGIFCONF failed"), -1); @@ -1821,7 +1821,7 @@ ACE::get_ip_interfaces (size_t &count, // note that the 3rd arg (0) says to leave the byte order (already in net // byte order from the interface structure) as is. count = 0; - for (size_t i = 0; i < num_ifs; pcur++, i++) + for (size_t i = 0; i < num_ifs; pcur++, i++) { if (pcur->ifr_addr.sa_family == AF_INET) { @@ -1830,7 +1830,7 @@ ACE::get_ip_interfaces (size_t &count, count++; } } - return 0; + return 0; #else ACE_UNUSED_ARG (count); ACE_UNUSED_ARG (addrs); @@ -1871,7 +1871,11 @@ ACE_Object_Manager_Destroyer::~ACE_Object_Manager_Destroyer () /////////////////////////////////////////////////////////////////////////////// -#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class auto_array_ptr<struct ifreq>; template class auto_basic_array_ptr<struct ifreq>; -#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#pragma instantiate auto_array_ptr<struct ifreq> +#pragma instantiate auto_basic_array_ptr<struct ifreq> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + diff --git a/ace/Dump.cpp b/ace/Dump.cpp index b84c61c380c..57e8aae7ac6 100644 --- a/ace/Dump.cpp +++ b/ace/Dump.cpp @@ -24,23 +24,23 @@ ACE_Dumpable::ACE_Dumpable (const void *this_ptr) } ACE_Dumpable_Ptr::ACE_Dumpable_Ptr (const ACE_Dumpable *dumper) - : dumper_ (dumper) + : dumper_ (dumper) { ACE_TRACE ("ACE_Dumpable_Ptr::ACE_Dumpable_Ptr"); } const ACE_Dumpable * ACE_Dumpable_Ptr::operator->() const -{ +{ ACE_TRACE ("ACE_Dumpable_Ptr::operator->"); - return this->dumper_; + return this->dumper_; } -void +void ACE_Dumpable_Ptr::operator= (const ACE_Dumpable *dumper) const { ACE_TRACE ("ACE_Dumpable_Ptr::operator="); - if (this->dumper_ != dumper) + if (this->dumper_ != dumper) { delete (ACE_Dumpable *) this->dumper_; ((ACE_Dumpable_Ptr *) this)->dumper_ = dumper; @@ -68,7 +68,7 @@ ACE_ODB::instance (void) return ACE_ODB::instance_; } -void +void ACE_ODB::dump_objects (void) { ACE_TRACE ("ACE_ODB::dump_objects"); @@ -83,7 +83,7 @@ ACE_ODB::dump_objects (void) // This method registers a new <dumper>. It detects // duplicates and simply overwrites them. -void +void ACE_ODB::register_object (const ACE_Dumpable *dumper) { ACE_TRACE ("ACE_ODB::register_object"); @@ -110,7 +110,7 @@ ACE_ODB::register_object (const ACE_Dumpable *dumper) this->object_table_[slot].dumper_ = dumper; } -void +void ACE_ODB::remove_object (const void *this_ptr) { ACE_TRACE ("ACE_ODB::remove_object"); @@ -131,6 +131,11 @@ ACE_ODB::remove_object (const void *this_ptr) ACE_ODB *ACE_ODB::instance_ = 0; -#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) ACE_MT (template class ACE_Guard<ACE_Thread_Mutex>); -#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) +#pragma instantiate ACE_Guard<ACE_Thread_Mutex> +#endif /* ACE_MT_SAFE */ +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + diff --git a/ace/Future.cpp b/ace/Future.cpp index eccf2ef6e0b..75eee48a85f 100644 --- a/ace/Future.cpp +++ b/ace/Future.cpp @@ -12,7 +12,7 @@ // Dump the state of an object. -template <class T> void +template <class T> void ACE_Future_Rep<T>::dump (void) const { ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); @@ -39,7 +39,7 @@ ACE_Future_Rep<T>::create (void) return new ACE_Future_Rep<T>(); } -template <class T> ACE_Future_Rep<T> * +template <class T> ACE_Future_Rep<T> * ACE_Future_Rep<T>::attach (ACE_Future_Rep<T>*& rep) { ACE_ASSERT (rep != 0); @@ -49,13 +49,13 @@ ACE_Future_Rep<T>::attach (ACE_Future_Rep<T>*& rep) return rep; } -template <class T> void +template <class T> void ACE_Future_Rep<T>::detach (ACE_Future_Rep<T>*& rep) { ACE_ASSERT(rep != 0); // Use value_ready_mutex_ for both condition and ref count management ACE_MT (ACE_GUARD (ACE_Thread_Mutex, r_mon, rep->value_ready_mutex_)); - + if (rep->ref_count_-- == 0) { r_mon.release (); @@ -66,17 +66,17 @@ ACE_Future_Rep<T>::detach (ACE_Future_Rep<T>*& rep) } } -template <class T> void +template <class T> void ACE_Future_Rep<T>::assign (ACE_Future_Rep<T>*& rep, ACE_Future_Rep<T>* new_rep) { ACE_ASSERT(rep != 0); ACE_ASSERT(new_rep != 0); // Use value_ready_mutex_ for both condition and ref count management ACE_MT (ACE_GUARD (ACE_Thread_Mutex, r_mon, rep->value_ready_mutex_)); - + ACE_Future_Rep<T>* old = rep; rep = new_rep; - + // detached old last for exception safety if (old->ref_count_-- == 0) { @@ -88,7 +88,7 @@ ACE_Future_Rep<T>::assign (ACE_Future_Rep<T>*& rep, ACE_Future_Rep<T>* new_rep) } } -template <class T> +template <class T> ACE_Future_Rep<T>::ACE_Future_Rep (void) : value_ (0), ref_count_ (0), @@ -96,7 +96,7 @@ ACE_Future_Rep<T>::ACE_Future_Rep (void) { } -template <class T> +template <class T> ACE_Future_Rep<T>::~ACE_Future_Rep (void) { delete this->value_; @@ -141,7 +141,7 @@ ACE_Future_Rep<T>::get (T &value, // If the value is not yet defined we must block until the // producer writes to it. - while (this->value_ == 0) + while (this->value_ == 0) // Perform a timed wait. if (this->value_ready_.wait (tv) == -1) return -1; @@ -167,12 +167,12 @@ ACE_Future_Rep<T>::operator T () // Wait ``forever.'' - while (this->value_ == 0) + while (this->value_ == 0) if (this->value_ready_.wait () == -1) // What to do in this case since we've got to indicate // failure somehow? Exceptions would be nice, but they're // not portable... - return 0; + return 0; // Destructor releases the mutex } @@ -180,7 +180,7 @@ ACE_Future_Rep<T>::operator T () return *this->value_; } -template <class T> +template <class T> ACE_Future<T>::ACE_Future (void) : future_rep_ (FUTURE_REP::create ()) { @@ -200,19 +200,19 @@ ACE_Future<T>::ACE_Future (const T &r) this->future_rep_->set (r); } -template <class T> +template <class T> ACE_Future<T>::~ACE_Future (void) { FUTURE_REP::detach (future_rep_); } -template <class T> int +template <class T> int ACE_Future<T>::operator== (const ACE_Future<T> &r) const { return r.future_rep_ == this->future_rep_; } -template <class T> int +template <class T> int ACE_Future<T>::operator!= (const ACE_Future<T> &r) const { return r.future_rep_ != this->future_rep_; @@ -227,7 +227,7 @@ ACE_Future<T>::cancel (const T &r) template <class T> int ACE_Future<T>::cancel (void) -{ +{ // If this ACE_Future is already attached to a ACE_Future_Rep, // detach it (maybe delete the ACE_Future_Rep). FUTURE_REP::assign (this->future_rep_, FUTURE_REP::create ()); @@ -235,7 +235,7 @@ ACE_Future<T>::cancel (void) } template <class T> int -ACE_Future<T>::set (const T &r) +ACE_Future<T>::set (const T &r) { // Give the pointer to the result to the ACE_Future_Rep. return this->future_rep_->set (r); @@ -257,7 +257,7 @@ ACE_Future<T>::get (T &value, ACE_Time_Value *tv) template <class T> ACE_Future<T>::operator T () { - // note that this will fail (and COREDUMP!) + // note that this will fail (and COREDUMP!) // if future_rep_ == 0 ! // // but... @@ -273,7 +273,7 @@ ACE_Future<T>::operator T () } template <class T> void -ACE_Future<T>::operator = (const ACE_Future<T> &rhs) +ACE_Future<T>::operator = (const ACE_Future<T> &rhs) { // assignment: // @@ -281,11 +281,11 @@ ACE_Future<T>::operator = (const ACE_Future<T> &rhs) // This will work if &r == this, by first increasing the ref count ACE_Future<T> &r = ( ACE_Future<T> &) rhs; - FUTURE_REP::assign (this->future_rep_, + FUTURE_REP::assign (this->future_rep_, FUTURE_REP::attach (r.future_rep_)); } -template <class T> void +template <class T> void ACE_Future<T>::dump (void) const { ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); @@ -301,7 +301,7 @@ ACE_Future<T>::operator new (size_t) return 0; } -template <class T> void +template <class T> void ACE_Future<T>::operator delete (void *) { } @@ -311,11 +311,16 @@ ACE_Future<T>::operator &() { } -#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) // This should probably be moved elsewhere now that ACE_Atomic_Op<> // isn't used. template class ACE_Atomic_Op<ACE_Thread_Mutex, int>; -#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +// This should probably be moved elsewhere now that ACE_Atomic_Op<> +// isn't used. +#pragma instantiate ACE_Atomic_Op<ACE_Thread_Mutex, int> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + #endif /* ACE_HAS_THREADS */ #endif /* ACE_FUTURE_CPP */ diff --git a/ace/Local_Name_Space.cpp b/ace/Local_Name_Space.cpp index 0ba1c5dc0f2..9cdaa126261 100644 --- a/ace/Local_Name_Space.cpp +++ b/ace/Local_Name_Space.cpp @@ -66,7 +66,7 @@ ACE_NS_String::strstr (const ACE_NS_String &s) const // They're smaller than we are... size_t len = (this->len_ - s.len_) / sizeof (ACE_USHORT16); size_t pat_len = s.len_ / sizeof (ACE_USHORT16) - 1; - + for (size_t i = 0; i <= len; i++) { size_t j; @@ -74,12 +74,12 @@ ACE_NS_String::strstr (const ACE_NS_String &s) const for (j = 0; j < pat_len; j++) if (this->rep_[i + j] != s.rep_[j]) break; - + if (j == pat_len) // Found a match! Return the index. return i; } - + return -1; } } @@ -89,7 +89,7 @@ ACE_NS_String::operator == (const ACE_NS_String &s) const { ACE_TRACE ("ACE_NS_String::operator =="); return this->len_ == s.len_ - && ACE_OS::memcmp ((void *) this->rep_, + && ACE_OS::memcmp ((void *) this->rep_, (void *) s.rep_, this->len_) == 0; } @@ -100,17 +100,17 @@ ACE_NS_String::operator != (const ACE_NS_String &s) const return !this->operator == (s); } -ACE_NS_String::ACE_NS_String (ACE_USHORT16 *dst, - const ACE_USHORT16 *src, +ACE_NS_String::ACE_NS_String (ACE_USHORT16 *dst, + const ACE_USHORT16 *src, size_t bytes) - : len_ (bytes), + : len_ (bytes), rep_ (dst) { ACE_TRACE ("ACE_NS_String::ACE_NS_String"); ACE_OS::memcpy (this->rep_, src, bytes); } -size_t +size_t ACE_NS_String::hash (void) const { return ACE::hash_pjw (this->rep_); @@ -129,7 +129,7 @@ ACE_NS_Internal::ACE_NS_Internal (ACE_NS_String &value, const char *type) int ACE_NS_Internal::operator == (const ACE_NS_Internal &s) const -{ +{ ACE_TRACE ("ACE_NS_Internal::operator =="); return this->value_ == s.value_; } @@ -148,7 +148,7 @@ ACE_NS_Internal::type (void) return this->type_; } -#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) #if (1) template class ACE_Hash_Map_Manager<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex>; template class ACE_Hash_Map_Iterator<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex>; @@ -167,5 +167,25 @@ template class ACE_Node<ACE_Name_Binding>; template class ACE_Guard<ACE_RW_Process_Mutex>; template class ACE_Read_Guard<ACE_RW_Process_Mutex>; template class ACE_Write_Guard<ACE_RW_Process_Mutex>; -#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#if (1) +#pragma instantiate ACE_Hash_Map_Manager<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Iterator<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Entry <ACE_NS_String, ACE_NS_Internal> +#else +#pragma instantiate ACE_Map_Manager<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex> +#pragma instantiate ACE_Map_Iterator<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex> +#pragma instantiate ACE_Map_Entry <ACE_NS_String, ACE_NS_Internal> +#endif +#pragma instantiate ACE_Unbounded_Set<ACE_Name_Binding> +#pragma instantiate ACE_Unbounded_Set_Iterator<ACE_Name_Binding> +#pragma instantiate ACE_Unbounded_Set<ACE_WString> +#pragma instantiate ACE_Unbounded_Set_Iterator<ACE_WString> +#pragma instantiate ACE_Node<ACE_WString> +#pragma instantiate ACE_Node<ACE_Name_Binding> +#pragma instantiate ACE_Guard<ACE_RW_Process_Mutex> +#pragma instantiate ACE_Read_Guard<ACE_RW_Process_Mutex> +#pragma instantiate ACE_Write_Guard<ACE_RW_Process_Mutex> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + #endif /* ACE_LOCAL_NAME_SPACE_C */ diff --git a/ace/Local_Tokens.cpp b/ace/Local_Tokens.cpp index 374582dc70a..755ef5cb0cf 100644 --- a/ace/Local_Tokens.cpp +++ b/ace/Local_Tokens.cpp @@ -21,7 +21,7 @@ ACE_Tokens::dump (void) const reference_count_, token_name_)); ACE_DEBUG ((LM_DEBUG, "waiters_\n")); this->waiters_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); } ACE_Tokens::ACE_Tokens (void) @@ -48,7 +48,7 @@ ACE_TPQ_Entry::dump (void) const { ACE_TRACE ("ACE_TPQ_Entry::dump"); ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, + ACE_DEBUG ((LM_DEBUG, "ACE_TPQ_Entry::dump:\n" " nesting_level_ = %d\n" " client_id_ = %s\n", @@ -62,10 +62,10 @@ ACE_TPQ_Entry::dump (void) const } ACE_DEBUG ((LM_DEBUG, "ACE_TPQ_Entry::dump end.\n")); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); } -ACE_TPQ_Entry::ACE_TPQ_Entry (const ACE_Token_Proxy *new_proxy, +ACE_TPQ_Entry::ACE_TPQ_Entry (const ACE_Token_Proxy *new_proxy, const char *client_id) : cond_var_ (lock_), next_ (0), @@ -86,9 +86,9 @@ ACE_TPQ_Entry::ACE_TPQ_Entry (const ACE_Token_Proxy *new_proxy, ACE_OS::hostname (host_name, sizeof host_name); ACE_OS::sprintf (name, - "/%s/%u/%u", - host_name, - ACE_OS::getpid (), + "/%s/%u/%u", + host_name, + ACE_OS::getpid (), ACE_Thread::self ()); this->client_id (name); @@ -159,7 +159,7 @@ ACE_TSS_TPQ_Entry::dump (void) const client_id_ == 0 ? "0" : client_id_)); ACE_DEBUG ((LM_DEBUG, "base:\n")); ACE_TPQ_ENTRY::dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); } ACE_TSS_TPQ_Entry::ACE_TSS_TPQ_Entry (const ACE_Token_Proxy *proxy, @@ -175,7 +175,7 @@ ACE_TSS_TPQ_Entry::make_TSS_TYPE (void) const { ACE_TRACE ("ACE_TSS_TPQ_Entry::make_TSS_TYPE"); ACE_TPQ_Entry *temp; - + ACE_NEW_RETURN (temp, ACE_TPQ_Entry (this->proxy_, this->client_id_), 0); return temp; } @@ -185,7 +185,7 @@ ACE_TSS_TPQ_Entry::operator ACE_TPQ_Entry * (void) ACE_TRACE ("ACE_TSS_TPQ_Entry::operator"); return (ACE_TPQ_Entry *) (*((ACE_TSS<ACE_TPQ_Entry> *) this)); } - + // ************************************************************ // ************************************************************ // ************************************************************ @@ -202,7 +202,7 @@ ACE_TPQ_Iterator::next (ACE_TPQ_Entry *&next_item) ACE_TRACE ("ACE_TPQ_Iterator::next"); next_item = this->current_; - + return current_ != 0; } @@ -232,7 +232,7 @@ ACE_TPQ_Iterator::dump (void) const " current_ = %d\n", (long) this->current_)); ACE_DEBUG ((LM_DEBUG, "head_ and tail_\n")); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); } // ************************************************************ @@ -252,7 +252,7 @@ ACE_Token_Proxy_Queue::dump (void) const this->head_->dump (); ACE_DEBUG ((LM_DEBUG, "ACE_Token_Proxy_Queue::dump end.\n")); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); } ACE_Token_Proxy_Queue::ACE_Token_Proxy_Queue (void) @@ -320,9 +320,9 @@ ACE_Token_Proxy_Queue::dequeue (void) if (head_ == 0) return; - + ACE_TPQ_Entry *temp = this->head_; - + this->head_ = this->head_->next_; temp->next_ = 0; @@ -410,7 +410,7 @@ ACE_Mutex_Token::dump (void) const ACE_DEBUG ((LM_DEBUG, "base:\n")); ACE_Tokens::dump (); ACE_DEBUG ((LM_DEBUG, "ACE_Mutex_Token::dump end.\n")); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); } ACE_Mutex_Token::ACE_Mutex_Token (const char *name) @@ -431,7 +431,7 @@ ACE_Mutex_Token::~ACE_Mutex_Token (void) ACE_TRACE ("ACE_Mutex_Token::~ACE_Mutex_Token"); } -int +int ACE_Mutex_Token::acquire (ACE_TPQ_Entry *caller, int ignore_deadlock, int notify) @@ -462,7 +462,7 @@ ACE_Mutex_Token::acquire (ACE_TPQ_Entry *caller, } // Check for deadlock. - if (!ignore_deadlock + if (!ignore_deadlock && ACE_Token_Manager::instance ()->check_deadlock (caller->proxy ()) == 1) { errno = EDEADLK; @@ -480,7 +480,7 @@ ACE_Mutex_Token::acquire (ACE_TPQ_Entry *caller, ACE_RETURN (-1); } -int +int ACE_Mutex_Token::tryacquire (ACE_TPQ_Entry *caller) { ACE_TRACE ("ACE_Mutex_Token::tryacquire"); @@ -491,7 +491,7 @@ ACE_Mutex_Token::tryacquire (ACE_TPQ_Entry *caller) // that this order is crucial too. It's resource coloring for other // threads which may be calling this same token. ACE_GUARD_RETURN (ACE_TOKEN_CONST::MUTEX, ace_mon2, ACE_Token_Manager::instance ()->mutex (), -1); - + // Does _anyone_ own the token? if (this->owner () == 0) { @@ -510,7 +510,7 @@ ACE_Mutex_Token::tryacquire (ACE_TPQ_Entry *caller) { errno = EWOULDBLOCK; ACE_RETURN (-1); - } + } } int @@ -519,7 +519,7 @@ ACE_Mutex_Token::renew (ACE_TPQ_Entry *caller, { ACE_TRACE ("ACE_Mutex_Token::renew"); ACE_GUARD_RETURN (ACE_TOKEN_CONST::MUTEX, ace_mon, this->lock_, -1); - + // Verify that the caller is the owner. if (this->is_owner (caller->client_id ()) == 0) { @@ -583,7 +583,7 @@ ACE_Mutex_Token::release (ACE_TPQ_Entry *caller) return 0; } -int +int ACE_Mutex_Token::owners (OWNER_STACK &stack, const char *id) { @@ -592,15 +592,15 @@ ACE_Mutex_Token::owners (OWNER_STACK &stack, { stack.push (this->owner ()); // If an <id> is specified, return whether it is the owner being - // returned. + // returned. if (id != 0) return this->owner ()->equal_client_id (id); } - + return 0; } -int +int ACE_Mutex_Token::is_waiting_for (const char *id) { ACE_TRACE ("ACE_Mutex_Token::is_waiting_for"); @@ -622,7 +622,7 @@ ACE_Mutex_Token::is_waiting_for (const char *id) return 0; } -int +int ACE_Mutex_Token::is_owner (const char *id) { ACE_TRACE ("ACE_Mutex_Token::is_owner"); @@ -650,7 +650,7 @@ ACE_RW_Token::dump (void) const ACE_DEBUG ((LM_DEBUG, "base:\n")); ACE_Tokens::dump (); ACE_DEBUG ((LM_DEBUG, "ACE_RW_Token::dump end.\n")); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); } ACE_RW_Token::ACE_RW_Token (const char *name) @@ -672,7 +672,7 @@ ACE_RW_Token::~ACE_RW_Token (void) ACE_TRACE ("ACE_RW_Token::~ACE_RW_Token"); } -int +int ACE_RW_Token::acquire (ACE_TPQ_Entry *caller, int ignore_deadlock, int notify) @@ -685,7 +685,7 @@ ACE_RW_Token::acquire (ACE_TPQ_Entry *caller, // that this order is crucial too. It's resource coloring for other // threads which may be calling this same token. ACE_GUARD_RETURN (ACE_TOKEN_CONST::MUTEX, ace_mon2, ACE_Token_Manager::instance ()->mutex (), -1); - + if (caller->proxy ()->type () == ACE_RW_Token::WRITER) this->num_writers_++; @@ -720,7 +720,7 @@ ACE_RW_Token::acquire (ACE_TPQ_Entry *caller, // Failure code. // Check for deadlock. - if (!ignore_deadlock && + if (!ignore_deadlock && ACE_Token_Manager::instance ()->check_deadlock (caller->proxy ()) == 1) { if (caller->proxy ()->type () == ACE_RW_Token::WRITER) @@ -746,7 +746,7 @@ ACE_RW_Token::acquire (ACE_TPQ_Entry *caller, temp->call_sleep_hook (); temp = temp->next_; } - while (temp != 0 && + while (temp != 0 && temp->proxy ()->type () == ACE_RW_Token::READER); } } @@ -755,7 +755,7 @@ ACE_RW_Token::acquire (ACE_TPQ_Entry *caller, ACE_RETURN (-1); } -int +int ACE_RW_Token::tryacquire (ACE_TPQ_Entry *caller) { ACE_TRACE ("ACE_RW_Token::tryacquire"); @@ -816,7 +816,7 @@ ACE_RW_Token::renew (ACE_TPQ_Entry *caller, { ACE_TRACE ("ACE_RW_Token::renew"); ACE_GUARD_RETURN (ACE_TOKEN_CONST::MUTEX, ace_mon, this->lock_, -1); - + // Werify that the caller is the owner if (this->is_owner (caller->client_id ()) == 0) { @@ -861,7 +861,7 @@ ACE_RW_Token::release (ACE_TPQ_Entry *caller) ACE_GUARD_RETURN (ACE_TOKEN_CONST::MUTEX, ace_mon, this->lock_, -1); // Check for errors. - if ((this->owner () == 0) || + if ((this->owner () == 0) || (this->is_owner (caller->client_id ()) == 0)) { errno = EACCES; @@ -919,7 +919,7 @@ ACE_RW_Token::notify_new_owner (ACE_TPQ_Entry *old_owner) } -int +int ACE_RW_Token::owners (OWNER_STACK &stack, const char *id) { @@ -935,8 +935,8 @@ ACE_RW_Token::owners (OWNER_STACK &stack, { stack.push (this->owner ()); // If an <id> is specified, return whether it is the owner being - // returned. - if ((id != 0) && + // returned. + if ((id != 0) && (ACE_OS::strcmp (id, this->owner ()->client_id ()) == 0)) id_is_owner = 1; } @@ -955,7 +955,7 @@ ACE_RW_Token::owners (OWNER_STACK &stack, stack.push (temp); - if (!id_is_owner && (id != 0) && + if (!id_is_owner && (id != 0) && (ACE_OS::strcmp (id, temp->client_id ()) == 0)) id_is_owner = 1; } @@ -964,7 +964,7 @@ ACE_RW_Token::owners (OWNER_STACK &stack, return id_is_owner; } -int +int ACE_RW_Token::is_waiting_for (const char *id) { ACE_TRACE ("ACE_RW_Token::is_waiting_for"); @@ -987,7 +987,7 @@ ACE_RW_Token::is_waiting_for (const char *id) return 0; } -int +int ACE_RW_Token::is_owner (const char *id) { ACE_TRACE ("ACE_Mutex_Token::is_owner"); @@ -1038,7 +1038,7 @@ ACE_Token_Proxy::dump (void) const this->waiter_.dump (); ACE_DEBUG ((LM_DEBUG, "ACE_Token_Proxy::dump end.\n")); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); } const char* @@ -1104,7 +1104,7 @@ ACE_Token_Proxy::~ACE_Token_Proxy (void) ACE_Token_Manager::instance ()->release_token (token_); } -int +int ACE_Token_Proxy::open (const char *token_name, int ignore_deadlock, int debug) @@ -1139,7 +1139,7 @@ ACE_Token_Proxy::open (const char *token_name, return 0; } -int +int ACE_Token_Proxy::acquire (int notify, void (*sleep_hook)(void *), ACE_Synch_Options &options) @@ -1177,7 +1177,7 @@ ACE_Token_Proxy::acquire (int notify, case EWOULDBLOCK : if (this->debug_) - ACE_DEBUG ((LM_DEBUG, + ACE_DEBUG ((LM_DEBUG, "(%t) waiting for %s, owner is %s, " "total waiters == %d\n", this->name (), @@ -1198,7 +1198,7 @@ ACE_Token_Proxy::acquire (int notify, default : waiter_->cond_var_.mutex ().release (); - ACE_ERROR_RETURN ((LM_ERROR, + ACE_ERROR_RETURN ((LM_ERROR, "%p\n","Token Proxy acquire."), -1); } } @@ -1214,7 +1214,7 @@ ACE_Token_Proxy::acquire (int notify, return 0; } -int +int ACE_Token_Proxy::tryacquire (void (*sleep_hook)(void *)) { ACE_TRACE ("ACE_Token_Proxy::tryacquire"); @@ -1229,7 +1229,7 @@ ACE_Token_Proxy::tryacquire (void (*sleep_hook)(void *)) return this->token_->tryacquire (waiter_); } -int +int ACE_Token_Proxy::renew (int requeue_position, ACE_Synch_Options &options) { @@ -1248,11 +1248,11 @@ ACE_Token_Proxy::renew (int requeue_position, { // check for error if (errno != EWOULDBLOCK) - ACE_ERROR_RETURN ((LM_ERROR, + ACE_ERROR_RETURN ((LM_ERROR, "%p renew failed\n", "ACE_Token_Proxy"), -1); - + if (this->debug_) - ACE_DEBUG ((LM_DEBUG, "(%t) renew blocking for %s, owner is %s\n", + ACE_DEBUG ((LM_DEBUG, "(%t) renew blocking for %s, owner is %s\n", this->name (), token_->owner_id ())); @@ -1263,7 +1263,7 @@ ACE_Token_Proxy::renew (int requeue_position, // we have the token { if (this->debug_) - ACE_DEBUG ((LM_DEBUG, "(%t) renewed %s\n", + ACE_DEBUG ((LM_DEBUG, "(%t) renewed %s\n", this->name ())); waiter_->cond_var_.mutex ().release (); return 0; @@ -1306,14 +1306,14 @@ ACE_Token_Proxy::handle_options (ACE_Synch_Options &options, } if (this->debug_) - ACE_DEBUG ((LM_DEBUG, "(%t) unblocking.\n", + ACE_DEBUG ((LM_DEBUG, "(%t) unblocking.\n", this->client_id ())); cv.mutex ().release (); return 0; // operation succeeded } } -int +int ACE_Token_Proxy::release (ACE_Synch_Options &) { ACE_TRACE ("ACE_Token_Proxy::release"); @@ -1337,7 +1337,7 @@ ACE_Token_Proxy::release (ACE_Synch_Options &) else { if (this->debug_) - ACE_DEBUG ((LM_DEBUG, "(%t) released %s, owner is %s\n", + ACE_DEBUG ((LM_DEBUG, "(%t) released %s, owner is %s\n", this->name (), token_->owner_id ())); @@ -1345,14 +1345,14 @@ ACE_Token_Proxy::release (ACE_Synch_Options &) } } -int +int ACE_Token_Proxy::remove (ACE_Synch_Options &) { ACE_TRACE ("ACE_Token_Proxy::remove"); return 0; } -void +void ACE_Token_Proxy::sleep_hook (void) { ACE_TRACE ("ACE_Token_Proxy::sleep_hook"); @@ -1360,7 +1360,7 @@ ACE_Token_Proxy::sleep_hook (void) return; } -void +void ACE_Token_Proxy::token_acquired (ACE_TPQ_Entry *e) { ACE_TRACE ("ACE_Token_Proxy::token_acquired"); @@ -1378,7 +1378,7 @@ ACE_Token_Proxy::token_acquired (ACE_TPQ_Entry *e) // ************************************************************ ACE_Token_Name::ACE_Token_Name (const char *token_name) -{ +{ ACE_TRACE ("ACE_Token_Name::ACE_Token_Name"); this->name (token_name); } @@ -1402,14 +1402,21 @@ ACE_Token_Name::dump (void) const ACE_DEBUG ((LM_DEBUG, "ACE_Token_Name::dump:\n" " token_name_ = %s\n", token_name_ == 0 ? "no name" : token_name_)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); } -#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) #if !defined (ACE_NO_TSS_TOKENS) template class ACE_TSS <ACE_TPQ_Entry>; #endif /* ACE_NO_TSS_TOKENS */ template class ACE_Unbounded_Stack <ACE_TPQ_Entry *>; template class ACE_Node <ACE_TPQ_Entry *>; -#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#if !defined (ACE_NO_TSS_TOKENS) +#pragma instantiate ACE_TSS <ACE_TPQ_Entry> +#endif /* ACE_NO_TSS_TOKENS */ +#pragma instantiate ACE_Unbounded_Stack <ACE_TPQ_Entry *> +#pragma instantiate ACE_Node <ACE_TPQ_Entry *> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + diff --git a/ace/Log_Msg.cpp b/ace/Log_Msg.cpp index fb90ea66eaa..6d03c38e362 100644 --- a/ace/Log_Msg.cpp +++ b/ace/Log_Msg.cpp @@ -179,7 +179,7 @@ ACE_Log_Msg_Manager::close (void) { // The program is exiting, so delete all ACE_Log_Msg instances. - ACE_Unbounded_Set_Iterator <ACE_Log_Msg *> i + ACE_Unbounded_Set_Iterator <ACE_Log_Msg *> i (*ACE_Log_Msg_Manager::instances_); for (ACE_Log_Msg **log_msg; @@ -211,7 +211,7 @@ ACE_Log_Msg_Manager::close (void) /* static */ #if defined (ACE_HAS_THR_C_FUNC) -extern "C" +extern "C" #endif /* ACE_HAS_THR_C_FUNC */ void ACE_TSS_cleanup (void *ptr) @@ -221,7 +221,7 @@ ACE_TSS_cleanup (void *ptr) #endif /* ACE_MT_SAFE */ /* static */ -int +int ACE_Log_Msg::exists (void) { #if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) @@ -242,13 +242,13 @@ ACE_Log_Msg::exists (void) #else ACE_Log_Msg *tss_log_msg = 0; - // Get the tss_log_msg from thread-specific storage. + // Get the tss_log_msg from thread-specific storage. return key_created_ && ACE_OS::thr_getspecific (key_, (void **) &tss_log_msg) != -1 && tss_log_msg; #endif /* VXWORKS || ACE_HAS_THREAD_SPECIFIC_STORAGE */ -#else +#else return 1; #endif /* defined (ACE_MT_SAFE) */ } @@ -325,8 +325,8 @@ ACE_Log_Msg::instance (void) ACE_Log_Msg *tss_log_msg = 0; - // Get the tss_log_msg from thread-specific storage. - if (ACE_OS::thr_getspecific (key_, + // Get the tss_log_msg from thread-specific storage. + if (ACE_OS::thr_getspecific (key_, (void **) &tss_log_msg) == -1) return 0; // This should not happen! @@ -359,7 +359,7 @@ ACE_Log_Msg::instance (void) return tss_log_msg; #endif /* VXWORKS || ACE_HAS_THREAD_SPECIFIC_STORAGE */ -#else +#else // Singleton implementation. static ACE_Log_Msg log_msg; @@ -371,13 +371,13 @@ ACE_Log_Msg::instance (void) // Name of the local host. const char *ACE_Log_Msg::local_host_ = 0; -// Records the program name. +// Records the program name. const char *ACE_Log_Msg::program_name_ = 0; // Default is to use stderr. u_long ACE_Log_Msg::flags_ = ACE_Log_Msg::STDERR; -// Process id of the current process. +// Process id of the current process. pid_t ACE_Log_Msg::pid_ = -1; // Current offset of msg_[]. @@ -405,13 +405,13 @@ ACE_Log_Msg::sync (const char *prog_name) // Heap checking state will be restored when the block is left. { ACE_NO_HEAP_CHECK; - + ACE_Log_Msg::program_name_ = ACE_OS::strdup (prog_name); - } + } } #endif /* VXWORKS */ - ACE_Log_Msg::pid_ = ACE_OS::getpid (); + ACE_Log_Msg::pid_ = ACE_OS::getpid (); ACE_Log_Msg::msg_off_ = 0; } @@ -456,7 +456,7 @@ ACE_Log_Msg::acquire (void) } u_long -ACE_Log_Msg::priority_mask (u_long n_mask) +ACE_Log_Msg::priority_mask (u_long n_mask) { u_long o_mask = this->priority_mask_; this->priority_mask_ = n_mask; @@ -493,7 +493,7 @@ ACE_Log_Msg::ACE_Log_Msg (void) tracing_enabled_ (1), // On by default? thr_state_ (0), priority_mask_ (LM_SHUTDOWN // By default, all priorities are enabled. - | LM_TRACE + | LM_TRACE | LM_DEBUG | LM_INFO | LM_NOTICE @@ -515,17 +515,17 @@ ACE_Log_Msg::~ACE_Log_Msg (void) // when the last thread in the program exits. #if !defined (VXWORKS) && defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) ACE_MT (ACE_GUARD (ACE_Thread_Mutex, ace_mon, *ACE_Log_Msg_Manager::get_lock ())); - + // If this is the last instance then cleanup. if (ACE_Log_Msg_Manager::remove (this) == 0) { - if (ACE_Log_Msg::program_name_) + if (ACE_Log_Msg::program_name_) { ACE_OS::free ((void *) ACE_Log_Msg::program_name_); ACE_Log_Msg::program_name_ = 0; } - if (ACE_Log_Msg::local_host_) + if (ACE_Log_Msg::local_host_) { ACE_OS::free ((void *) ACE_Log_Msg::local_host_); ACE_Log_Msg::local_host_ = 0; @@ -537,8 +537,8 @@ ACE_Log_Msg::~ACE_Log_Msg (void) // Open the sender-side of the Message ACE_Queue. int -ACE_Log_Msg::open (const char *prog_name, - u_long flags, +ACE_Log_Msg::open (const char *prog_name, + u_long flags, LPCTSTR logger_key) { ACE_TRACE ("ACE_Log_Msg::open"); @@ -556,7 +556,7 @@ ACE_Log_Msg::open (const char *prog_name, // Stop heap checking, block will be freed by the ACE_Object_Manager. { ACE_NO_HEAP_CHECK; - + ACE_Log_Msg::program_name_ = ACE_OS::strdup (prog_name); } } @@ -567,7 +567,7 @@ ACE_Log_Msg::open (const char *prog_name, // Note that if we fail to open the message queue the default action // is to use stderr (set via static initialization in the // ACE_Log_Msg.C file). - + if (ACE_BIT_ENABLED (flags, ACE_Log_Msg::LOGGER)) { if (logger_key == 0) @@ -592,8 +592,8 @@ ACE_Log_Msg::open (const char *prog_name, ACE_SET_BITS (ACE_Log_Msg::flags_, ACE_Log_Msg::LOGGER); } - // Remember, ACE_Log_Msg::STDERR bit is on by default... - if (status != -1 + // Remember, ACE_Log_Msg::STDERR bit is on by default... + if (status != -1 && ACE_BIT_ENABLED (flags, ACE_Log_Msg::STDERR) == 0) ACE_CLR_BITS (ACE_Log_Msg::flags_, ACE_Log_Msg::STDERR); @@ -633,16 +633,16 @@ ACE_Log_Msg::open (const char *prog_name, // 't': print thread id (1 if single-threaded) // 'u': print as unsigned int // 'X', 'x': print as a hex number -// '%': format a single percent sign, '%' +// '%': format a single percent sign, '%' ssize_t -ACE_Log_Msg::log (ACE_Log_Priority log_priority, +ACE_Log_Msg::log (ACE_Log_Priority log_priority, const char *format_str, ...) -{ +{ ACE_TRACE ("ACE_Log_Msg::log"); - // Start of variable args section. - va_list argp; + // Start of variable args section. + va_list argp; va_start (argp, format_str); @@ -655,11 +655,11 @@ ACE_Log_Msg::log (ACE_Log_Priority log_priority, ssize_t ACE_Log_Msg::log (const char *format_str, - ACE_Log_Priority log_priority, + ACE_Log_Priority log_priority, va_list argp) -{ +{ ACE_TRACE ("ACE_Log_Msg::log"); - // External decls. + // External decls. extern int sys_nerr; typedef void (*PTF)(...); @@ -670,7 +670,7 @@ ACE_Log_Msg::log (const char *format_str, if (ACE_BIT_DISABLED (this->priority_mask_, log_priority)) return 0; - ACE_Log_Record log_record (log_priority, + ACE_Log_Record log_record (log_priority, ACE_OS::gettimeofday (), this->getpid ()); char *bp = this->msg (); @@ -685,7 +685,7 @@ ACE_Log_Msg::log (const char *format_str, if (ACE_BIT_ENABLED (ACE_Log_Msg::flags_, ACE_Log_Msg::VERBOSE)) { - // Prepend the program name onto this message + // Prepend the program name onto this message if (ACE_Log_Msg::program_name_ != 0) { @@ -699,43 +699,43 @@ ACE_Log_Msg::log (const char *format_str, while (*format != '\0') { // Copy input to output until we encounter a %, however a - // % followed by another % is not a format specification. + // % followed by another % is not a format specification. if (*format != '%') *bp++ = *format++; else if (format[1] == '%') // An "escaped" '%' (just print one '%'). { - *bp++ = *format++; // Store first % - format++; // but skip second % + *bp++ = *format++; // Store first % + format++; // but skip second % } else { - char c; // high use character - char *fp; // local format pointer - int wpc; // width/precision cnt + char c; // high use character + char *fp; // local format pointer + int wpc; // width/precision cnt const int CONTINUE = 0; - const int SKIP_SPRINTF = -1; // We must skip the sprintf phase - const int SKIP_NUL_LOCATE = -2; // Skip locating the NUL character - int type = CONTINUE; // conversion type - int w[2]; // width/precision vals + const int SKIP_SPRINTF = -1; // We must skip the sprintf phase + const int SKIP_NUL_LOCATE = -2; // Skip locating the NUL character + int type = CONTINUE; // conversion type + int w[2]; // width/precision vals // % starts a format specification that ends with one of // "arnPpSsdciIouxXfFeEgG". An optional width and/or precision // (indicated by an "*") may be encountered prior to the // nend of the specification, each consumes an int arg. - // A call to sprintf() does the actual conversion. + // A call to sprintf() does the actual conversion. - fp = format++; // Remember beginning of format. - wpc = 0; // Assume no width/precision seen. + fp = format++; // Remember beginning of format. + wpc = 0; // Assume no width/precision seen. while (type == CONTINUE) { switch (*format++) { - case 'a': // Abort program after handling all of format string. + case 'a': // Abort program after handling all of format string. type = SKIP_SPRINTF; - abort_prog = 1; - exit_value = va_arg (argp, int); + abort_prog = 1; + exit_value = va_arg (argp, int); ACE_OS::sprintf (bp, ""); // Make sure to NUL-terminate this... break; case 'l': @@ -750,28 +750,28 @@ ACE_Log_Msg::log (const char *format_str, type = SKIP_SPRINTF; break; } - case 'n': // Print the name of the program. + case 'n': // Print the name of the program. type = SKIP_SPRINTF; // @@ UNICODE - ACE_OS::strcpy (bp, ACE_Log_Msg::program_name_ ? + ACE_OS::strcpy (bp, ACE_Log_Msg::program_name_ ? ACE_Log_Msg::program_name_ : "<unknown>"); break; case 'P': // Format the current process id. type = SKIP_SPRINTF; ACE_OS::sprintf (bp, "%d", this->getpid ()); break; - case 'p': // Format the string assocated with the value of errno. + case 'p': // Format the string assocated with the value of errno. { type = SKIP_SPRINTF; errno = ACE::map_errno (this->errnum ()); if (errno >= 0 && errno < sys_nerr) - ACE_OS::sprintf (bp, "%s: %s", + ACE_OS::sprintf (bp, "%s: %s", va_arg (argp, char *), strerror (errno)); else { -#if defined (ACE_WIN32) +#if defined (ACE_WIN32) LPTSTR lpMsgBuf = 0; - + ::FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, errno, @@ -789,12 +789,12 @@ ACE_Log_Msg::log (const char *format_str, if (lpMsgBuf == 0) { const char *message = ACE::sock_error (errno); - ACE_OS::sprintf (bp, "%s: %s", + ACE_OS::sprintf (bp, "%s: %s", va_arg (argp, const char *), message); } else { - ACE_OS::sprintf (bp, "%s: %s", + ACE_OS::sprintf (bp, "%s: %s", va_arg (argp, char *), lpMsgBuf); // Free the buffer. ::LocalFree (lpMsgBuf); @@ -802,7 +802,7 @@ ACE_Log_Msg::log (const char *format_str, #else ACE_OS::sprintf (bp, "%s: <unknown error> = %d", va_arg (argp, char *), errno); -#endif /* ACE_WIN32 */ +#endif /* ACE_WIN32 */ } break; } @@ -820,18 +820,18 @@ ACE_Log_Msg::log (const char *format_str, *bp = '\0'; break; - case 'r': // Run (invoke) this subroutine. + case 'r': // Run (invoke) this subroutine. { int osave = ACE_Log_Msg::msg_off_; - + if (ACE_BIT_ENABLED (ACE_Log_Msg::flags_, ACE_Log_Msg::SILENT)) *bp++ = '{'; ACE_Log_Msg::msg_off_ = bp - this->msg_; - + type = SKIP_SPRINTF; - (*va_arg (argp, PTF))(); + (*va_arg (argp, PTF))(); - if (ACE_BIT_ENABLED (ACE_Log_Msg::flags_, ACE_Log_Msg::SILENT)) + if (ACE_BIT_ENABLED (ACE_Log_Msg::flags_, ACE_Log_Msg::SILENT)) { bp += ACE_OS::strlen (bp); *bp++ = '}'; @@ -841,7 +841,7 @@ ACE_Log_Msg::log (const char *format_str, ACE_Log_Msg::msg_off_ = osave; break; } - case 'S': // format the string associated with this signal number. + case 'S': // format the string associated with this signal number. { int sig = va_arg (argp, int); type = SKIP_SPRINTF; @@ -859,12 +859,12 @@ ACE_Log_Msg::log (const char *format_str, { type = SKIP_SPRINTF; char day_and_time[35]; - ACE_OS::sprintf (bp, "%s", - ACE::timestamp (day_and_time, + ACE_OS::sprintf (bp, "%s", + ACE::timestamp (day_and_time, sizeof day_and_time)); - break; + break; } - case 't': // Format thread id. + case 't': // Format thread id. type = SKIP_SPRINTF; #if defined (ACE_WIN32) ACE_OS::sprintf (bp, "%u", ACE_Thread::self ()); @@ -875,31 +875,31 @@ ACE_Log_Msg::log (const char *format_str, #endif /* ACE_WIN32 */ break; case 's': - type = 1 + wpc; // 1, 2, 3 + type = 1 + wpc; // 1, 2, 3 break; case 'W': // @@ UNICODE - case 'd': case 'c': case 'i': case 'o': - case 'u': case 'x': case 'X': - type = 4 + wpc; // 4, 5, 6 + case 'd': case 'c': case 'i': case 'o': + case 'u': case 'x': case 'X': + type = 4 + wpc; // 4, 5, 6 break; case 'F': case 'f': case 'e': case 'E': case 'g': case 'G': - type = 7 + wpc; // 7, 8, 9 + type = 7 + wpc; // 7, 8, 9 break; - case '*': // consume width/precision + case '*': // consume width/precision w[wpc++] = va_arg (argp, int); break; default: - // ? + // ? break; } } if (type != SKIP_SPRINTF) { - c = *format; // Remember char before we overwrite. - *format = 0; // Overwrite, terminating format. + c = *format; // Remember char before we overwrite. + *format = 0; // Overwrite, terminating format. switch (type) { @@ -935,11 +935,11 @@ ACE_Log_Msg::log (const char *format_str, ACE_OS::sprintf (bp, fp, w[0], w[1], va_arg (argp, double)); break; } - *format = c; // Restore char we overwrote. + *format = c; // Restore char we overwrote. } if (type != SKIP_NUL_LOCATE) - while (*bp != '\0') // Locate end of bp. + while (*bp != '\0') // Locate end of bp. bp++; } } @@ -965,22 +965,22 @@ ACE_Log_Msg::log (const char *format_str, // Make sure that the lock is held during all this. ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, *ACE_Log_Msg_Manager::get_lock (), -1)); - if (ACE_BIT_ENABLED (ACE_Log_Msg::flags_, ACE_Log_Msg::STDERR) + if (ACE_BIT_ENABLED (ACE_Log_Msg::flags_, ACE_Log_Msg::STDERR) && abort_prog == 0) // We'll get this further down. log_record.print (ACE_Log_Msg::local_host_, ACE_BIT_ENABLED (ACE_Log_Msg::flags_, ACE_Log_Msg::VERBOSE), stderr); if (ACE_BIT_ENABLED (ACE_Log_Msg::flags_, ACE_Log_Msg::LOGGER)) { - ACE_Str_Buf log_msg ((void *) &log_record, + ACE_Str_Buf log_msg ((void *) &log_record, int (log_record.length ())); #if defined (ACE_HAS_STREAM_PIPES) - result = message_queue_.send (int (log_record.type ()), + result = message_queue_.send (int (log_record.type ()), &log_msg); #elif !defined (ACE_WIN32) result = message_queue_.send (log_msg); #else - result = message_queue_.send ((const ACE_Str_Buf *) &log_msg, + result = message_queue_.send ((const ACE_Str_Buf *) &log_msg, (const ACE_Str_Buf *) 0); #endif /* ACE_HAS_STREAM_PIPES */ } @@ -1012,9 +1012,9 @@ ACE_Log_Msg::log (const char *format_str, // Calls log to do the actual print, but formats first. -int -ACE_Log_Msg::log_hexdump (ACE_Log_Priority log_priority, - const char *buffer, +int +ACE_Log_Msg::log_hexdump (ACE_Log_Priority log_priority, + const char *buffer, int size, const char *text) { @@ -1043,10 +1043,10 @@ ACE_Log_Msg::log_hexdump (ACE_Log_Priority log_priority, } void -ACE_Log_Msg::set (const char *filename, +ACE_Log_Msg::set (const char *filename, int line, - int status, - int err, + int status, + int err, int rs, ostream *os) { @@ -1086,36 +1086,36 @@ ACE_Log_Msg::dump (void) const message_queue_.dump (); #if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) ACE_Log_Msg_Manager::get_lock ()->dump (); - // Synchronize output operations. + // Synchronize output operations. #endif /* ACE_MT_SAFE */ ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); } -void +void ACE_Log_Msg::op_status (int status) { this->status_ = status; } -int +int ACE_Log_Msg::op_status (void) { return this->status_; } -void +void ACE_Log_Msg::restart (int r) { this->restart_ = r; } -int +int ACE_Log_Msg::restart (void) { return this->restart_; } -int +int ACE_Log_Msg::errnum (void) { return this->errnum_; @@ -1127,7 +1127,7 @@ ACE_Log_Msg::errnum (int e) this->errnum_ = e; } -int +int ACE_Log_Msg::linenum (void) { return this->linenum_; @@ -1139,73 +1139,73 @@ ACE_Log_Msg::linenum (int l) this->linenum_ = l; } -int -ACE_Log_Msg::inc (void) -{ - return this->trace_depth_++; +int +ACE_Log_Msg::inc (void) +{ + return this->trace_depth_++; } -int -ACE_Log_Msg::dec (void) -{ - return --this->trace_depth_; +int +ACE_Log_Msg::dec (void) +{ + return --this->trace_depth_; } -int -ACE_Log_Msg::trace_active (void) -{ - return this->trace_active_; +int +ACE_Log_Msg::trace_active (void) +{ + return this->trace_active_; } -void -ACE_Log_Msg::trace_active (int value) -{ - this->trace_active_ = value; +void +ACE_Log_Msg::trace_active (int value) +{ + this->trace_active_ = value; } ACE_Thread_State * -ACE_Log_Msg::thr_state (void) -{ - return this->thr_state_; +ACE_Log_Msg::thr_state (void) +{ + return this->thr_state_; } -void +void ACE_Log_Msg::thr_state (ACE_Thread_State *ts) -{ - this->thr_state_ = ts; +{ + this->thr_state_ = ts; } ACE_hthread_t * -ACE_Log_Msg::thr_handle (void) -{ - return this->thr_handle_; +ACE_Log_Msg::thr_handle (void) +{ + return this->thr_handle_; } -void +void ACE_Log_Msg::thr_handle (ACE_hthread_t *th) -{ - this->thr_handle_ = th; +{ + this->thr_handle_ = th; } // Enable the tracing facility on a per-thread basis. -void -ACE_Log_Msg::start_tracing (void) -{ +void +ACE_Log_Msg::start_tracing (void) +{ this->tracing_enabled_ = 1; } // Disable the tracing facility on a per-thread basis. -void -ACE_Log_Msg::stop_tracing (void) -{ - this->tracing_enabled_ = 0; +void +ACE_Log_Msg::stop_tracing (void) +{ + this->tracing_enabled_ = 0; } int ACE_Log_Msg::tracing_enabled (void) -{ +{ return this->tracing_enabled_; } @@ -1218,7 +1218,7 @@ ACE_Log_Msg::file (void) void ACE_Log_Msg::file (const char *s) { - ACE_OS::strncpy (this->file_, s, + ACE_OS::strncpy (this->file_, s, (sizeof this->file_ / sizeof (char))); } @@ -1231,7 +1231,7 @@ ACE_Log_Msg::msg (void) void ACE_Log_Msg::msg (char *m) { - ACE_OS::strncpy (this->msg_, m, + ACE_OS::strncpy (this->msg_, m, (sizeof this->msg_ / sizeof (char))); } @@ -1283,9 +1283,14 @@ ACE_Log_Msg::getpid (void) const } -#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Node<ACE_Log_Msg *>; template class ACE_Unbounded_Set<ACE_Log_Msg *>; template class ACE_Unbounded_Set_Iterator<ACE_Log_Msg *>; -#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#pragma instantiate ACE_Node<ACE_Log_Msg *> +#pragma instantiate ACE_Unbounded_Set<ACE_Log_Msg *> +#pragma instantiate ACE_Unbounded_Set_Iterator<ACE_Log_Msg *> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + diff --git a/ace/Malloc.cpp b/ace/Malloc.cpp index 74d6fb4b8ee..715e9b539a1 100644 --- a/ace/Malloc.cpp +++ b/ace/Malloc.cpp @@ -37,10 +37,10 @@ ACE_Name_Node::ACE_Name_Node (void) ACE_TRACE ("ACE_Name_Node::ACE_Name_Node"); } -ACE_Name_Node::ACE_Name_Node (const char *name, - void *ptr, +ACE_Name_Node::ACE_Name_Node (const char *name, + void *ptr, ACE_Name_Node *next) - : pointer_ (ptr), + : pointer_ (ptr), next_ (next) { ACE_TRACE ("ACE_Name_Node::ACE_Name_Node"); @@ -51,7 +51,7 @@ void ACE_Name_Node::dump (void) const { ACE_TRACE ("ACE_Name_Node"); - + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); ACE_DEBUG ((LM_DEBUG, "pointer = %x", this->pointer_)); ACE_DEBUG ((LM_DEBUG, "\nnext_ = %x", this->next_)); @@ -120,9 +120,9 @@ ACE_Allocator::~ACE_Allocator (void) #if defined (ACE_MALLOC_STATS) ACE_Malloc_Stats::ACE_Malloc_Stats (void) - : nblocks_ (0), - nchunks_ (0), - ninuse_ (0) + : nblocks_ (0), + nchunks_ (0), + ninuse_ (0) { ACE_TRACE ("ACE_Malloc_Stats::ACE_Malloc_Stats"); } @@ -144,9 +144,12 @@ ACE_Malloc_Stats::dump (void) const ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); } -#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Atomic_Op<ACE_PROCESS_MUTEX, int>; -#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#pragma instantiate ACE_Atomic_Op<ACE_PROCESS_MUTEX, int> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + #endif /* ACE_MALLOC_STATS */ #endif /* ACE_MALLOC_C */ diff --git a/ace/Message_Block.cpp b/ace/Message_Block.cpp index e29561e55a8..50d4bea84e7 100644 --- a/ace/Message_Block.cpp +++ b/ace/Message_Block.cpp @@ -66,7 +66,7 @@ ACE_Data_Block::dump (void) const { ACE_TRACE ("ACE_Data_Block::dump"); ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, + ACE_DEBUG ((LM_DEBUG, "-----( Data Block )-----\n" "type_ = %d\n" "cur_size_ = %u\n" @@ -76,10 +76,10 @@ ACE_Data_Block::dump (void) const "locking_strategy_ = %u\n" "reference_count_ = %u\n" "---------------------------\n", - this->type_, - this->cur_size_, + this->type_, + this->cur_size_, this->max_size_, - this->flags_, + this->flags_, this->base_, this->locking_strategy_, this->reference_count_)); @@ -92,20 +92,20 @@ ACE_Message_Block::dump (void) const { ACE_TRACE ("ACE_Message_Block::dump"); ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, + ACE_DEBUG ((LM_DEBUG, "-----( Message Block )-----\n" "priority_ = %d\n" "next_ = %u\n" "prev_ = %u\n" - "cont_ = %u\n" + "cont_ = %u\n" "rd_ptr_ = %u\n" "wr_ptr_ = %u\n" "---------------------------\n", - this->priority_, - this->next_, + this->priority_, + this->next_, this->prev_, this->cont_, - this->rd_ptr_, + this->rd_ptr_, this->wr_ptr_)); this->data_block ()->dump (); ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); @@ -118,12 +118,12 @@ ACE_Data_Block::size (size_t length) if (length <= this->max_size_) this->cur_size_ = length; - else + else { // We need to resize! char *buf; - ACE_ALLOCATOR_RETURN (buf, - (char *) this->allocator_strategy_->malloc (length), + ACE_ALLOCATOR_RETURN (buf, + (char *) this->allocator_strategy_->malloc (length), -1); ACE_OS::memcpy (buf, this->base_, this->cur_size_); @@ -180,7 +180,7 @@ ACE_Data_Block::ACE_Data_Block (void) ACE_Data_Block::ACE_Data_Block (size_t size, ACE_Message_Block::ACE_Message_Type msg_type, - const char *msg_data, + const char *msg_data, ACE_Allocator *allocator_strategy, ACE_Lock *locking_strategy, ACE_Message_Block::Message_Flags flags) @@ -201,7 +201,7 @@ ACE_Data_Block::ACE_Data_Block (size_t size, ACE_ALLOCATOR (this->allocator_strategy_, ACE_Allocator::instance ()); if (msg_data == 0) - ACE_ALLOCATOR (this->base_, + ACE_ALLOCATOR (this->base_, (char *) this->allocator_strategy_->malloc (size)); else this->base_ = (char *) msg_data; @@ -242,19 +242,19 @@ ACE_Message_Block::ACE_Message_Block (void) ACE_Message_Block::ACE_Message_Block (size_t size, ACE_Message_Type msg_type, - ACE_Message_Block *msg_cont, - const char *msg_data, + ACE_Message_Block *msg_cont, + const char *msg_data, ACE_Allocator *allocator_strategy, ACE_Lock *locking_strategy, u_long priority) { ACE_TRACE ("ACE_Message_Block::ACE_Message_Block"); - if (this->init_i (size, - msg_type, - msg_cont, - msg_data, - allocator_strategy, + if (this->init_i (size, + msg_type, + msg_cont, + msg_data, + allocator_strategy, locking_strategy, msg_data ? ACE_Message_Block::DONT_DELETE : 0, priority, @@ -263,9 +263,9 @@ ACE_Message_Block::ACE_Message_Block (size_t size, } int -ACE_Message_Block::init (size_t size, - ACE_Message_Type msg_type, - ACE_Message_Block *msg_cont, +ACE_Message_Block::init (size_t size, + ACE_Message_Type msg_type, + ACE_Message_Block *msg_cont, const char *msg_data, ACE_Allocator *allocator_strategy, ACE_Lock *locking_strategy, @@ -273,11 +273,11 @@ ACE_Message_Block::init (size_t size, { ACE_TRACE ("ACE_Message_Block::init"); - return this->init_i (size, - msg_type, - msg_cont, + return this->init_i (size, + msg_type, + msg_cont, msg_data, - allocator_strategy, + allocator_strategy, locking_strategy, msg_data ? ACE_Message_Block::DONT_DELETE : 0, priority, @@ -302,9 +302,9 @@ ACE_Message_Block::init (const char *data, 0); // data block } -ACE_Message_Block::ACE_Message_Block (size_t size, - ACE_Message_Type msg_type, - ACE_Message_Block *msg_cont, +ACE_Message_Block::ACE_Message_Block (size_t size, + ACE_Message_Type msg_type, + ACE_Message_Block *msg_cont, const char *msg_data, ACE_Allocator *allocator_strategy, ACE_Lock *locking_strategy, @@ -314,11 +314,11 @@ ACE_Message_Block::ACE_Message_Block (size_t size, { ACE_TRACE ("ACE_Message_Block::ACE_Message_Block"); - if (this->init_i (size, - msg_type, - msg_cont, + if (this->init_i (size, + msg_type, + msg_cont, msg_data, - allocator_strategy, + allocator_strategy, locking_strategy, flags, priority, @@ -329,7 +329,7 @@ ACE_Message_Block::ACE_Message_Block (size_t size, ACE_Message_Block::ACE_Message_Block (ACE_Data_Block *data_block) { ACE_TRACE ("ACE_Message_Block::ACE_Message_Block"); - + if (this->init_i (0, // size MB_NORMAL, // type 0, // cont @@ -343,9 +343,9 @@ ACE_Message_Block::ACE_Message_Block (ACE_Data_Block *data_block) } int -ACE_Message_Block::init_i (size_t size, - ACE_Message_Type msg_type, - ACE_Message_Block *msg_cont, +ACE_Message_Block::init_i (size_t size, + ACE_Message_Type msg_type, + ACE_Message_Block *msg_cont, const char *msg_data, ACE_Allocator *allocator_strategy, ACE_Lock *locking_strategy, @@ -397,18 +397,18 @@ ACE_Data_Block * ACE_Data_Block::release_i (void) { ACE_TRACE ("ACE_Data_Block::release_i"); - + ACE_ASSERT (this->reference_count_ > 0); - + ACE_Data_Block *result = 0; // decrement reference count this->reference_count_--; - + if (this->reference_count_ == 0) // this will cause deletion of this result = 0; - else + else result = this; return result; @@ -445,60 +445,60 @@ ACE_Data_Block::release (ACE_Lock *lock) if (lock_to_be_used != 0) { ACE_GUARD_RETURN (ACE_Lock, ace_mon, *lock_to_be_used, 0); - + result = this->release_i (); } else result = this->release_i (); - + // We must delete this outside the scope of the locking_strategy_ // since otherwise we'd be trying to "release" through a deleted // pointer! if (result == 0) delete this; - return result; + return result; } ACE_Message_Block * ACE_Message_Block::release (void) { ACE_TRACE ("ACE_Message_Block::release"); - + ACE_Message_Block *result = 0; ACE_Lock *lock = 0; - + // Do we have a valid data block if (this->data_block ()) { // Grab the lock that belongs to my data block lock = this->data_block ()->locking_strategy (); - + // if we have a lock if (lock != 0) { // One guard for all - ACE_GUARD_RETURN (ACE_Lock, ace_mon, *lock, 0); - + ACE_GUARD_RETURN (ACE_Lock, ace_mon, *lock, 0); + // Call non-guarded release with <lock> result = this->release_i (lock); } // This is the case when we have a valid data block but no lock else - // Call non-guarded release with no lock - result = this->release_i (0); + // Call non-guarded release with no lock + result = this->release_i (0); } else // This is the case when we don't even have a valid data block result = this->release_i (0); - + return result; } ACE_Message_Block * ACE_Message_Block::release_i (ACE_Lock *lock) { - ACE_TRACE ("ACE_Message_Block::release_i"); + ACE_TRACE ("ACE_Message_Block::release_i"); // Free up all the continuation messages. if (this->cont_) @@ -512,7 +512,7 @@ ACE_Message_Block::release_i (ACE_Lock *lock) this->data_block ()->release (lock); this->data_block_ = 0; } - + // We will now commit suicide: this object *must* have come from the heap delete this; @@ -542,7 +542,7 @@ ACE_Message_Block::~ACE_Message_Block (void) } ACE_Data_Block * -ACE_Data_Block::duplicate (void) +ACE_Data_Block::duplicate (void) { ACE_TRACE ("ACE_Data_Block::duplicate"); @@ -570,7 +570,7 @@ ACE_Message_Block::duplicate (void) const // Create a new <ACE_Message_Block> that contains unique copies of // the message block fields, but a reference counted duplicate of // the <ACE_Data_Block>. - ACE_NEW_RETURN (nb, + ACE_NEW_RETURN (nb, ACE_Message_Block (0, // size ACE_Message_Type (0), // type 0, // cont @@ -627,12 +627,12 @@ ACE_Data_Block::clone (ACE_Message_Block::Message_Flags mask) const // You always want to clear this one to prevent memory leaks but you // might add some others later. - const ACE_Message_Block::Message_Flags always_clear = - ACE_Message_Block::DONT_DELETE; + const ACE_Message_Block::Message_Flags always_clear = + ACE_Message_Block::DONT_DELETE; ACE_Data_Block *nb; - ACE_NEW_RETURN (nb, + ACE_NEW_RETURN (nb, ACE_Data_Block (this->max_size_, // size this->type_, // type 0, // data @@ -653,16 +653,16 @@ ACE_Message_Block * ACE_Message_Block::clone (Message_Flags mask) const { ACE_TRACE ("ACE_Message_Block::clone"); - + // Get a pointer to a "cloned" <ACE_Data_Block> (will copy the // values rather than increment the reference count). ACE_Data_Block *db = this->data_block ()->clone (mask); - + if (db == 0) return 0; - ACE_Message_Block *nb = + ACE_Message_Block *nb = new ACE_Message_Block (0, // size ACE_Message_Type (0), // type 0, // cont @@ -677,14 +677,14 @@ ACE_Message_Block::clone (Message_Flags mask) const db->release (); return 0; } - + // Set the read and write pointers in the new <Message_Block> to the // same relative offset as in the existing <Message_Block>. nb->rd_ptr (this->rd_ptr_ - this->data_block ()->base ()); nb->wr_ptr (this->wr_ptr_ - this->data_block ()->base ()); // Clone all the continuation messages if necessary. - if (nb->cont_ != 0 + if (nb->cont_ != 0 && (nb->cont_ = nb->cont_->clone (mask)) == 0) { nb->release (); @@ -701,11 +701,19 @@ ACE_Message_Block::operator= (const ACE_Message_Block &) return *this; } -#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) // These specializations aren't needed for the ACE library because // Service_Config.cpp has them: // // template class ACE_Malloc <ACE_LOCAL_MEMORY_POOL, ACE_Null_Mutex>; // template class ACE_Allocator_Adapter <ACE_Malloc <ACE_LOCAL_MEMORY_POOL, ACE_Null_Mutex> >; template class ACE_Guard<ACE_Lock>; -#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +// These specializations aren't needed for the ACE library because +// Service_Config.cpp has them: +// +// #pragma instantiate ACE_Malloc <ACE_LOCAL_MEMORY_POOL, ACE_Null_Mutex> +// #pragma instantiate ACE_Allocator_Adapter <ACE_Malloc <ACE_LOCAL_MEMORY_POOL, ACE_Null_Mutex> > +#pragma instantiate ACE_Guard<ACE_Lock> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + diff --git a/ace/Naming_Context.cpp b/ace/Naming_Context.cpp index 34e8f93fba8..56130bd3a37 100644 --- a/ace/Naming_Context.cpp +++ b/ace/Naming_Context.cpp @@ -29,7 +29,7 @@ ACE_STATIC_SVC_DEFINE (ACE_Naming_Context, ACE_STATIC_SVC_REQUIRE (ACE_Naming_Context) int -ACE_Naming_Context::info (char **strp, +ACE_Naming_Context::info (char **strp, size_t length) const { ACE_TRACE ("ACE_Naming_Context::info"); @@ -52,13 +52,13 @@ ACE_Naming_Context::local (void) ACE_TRACE ("ACE_Naming_Context::local"); return ACE_OS::strcmp (this->netnameserver_host_, "localhost") == 0 || ACE_OS::strcmp (this->netnameserver_host_, this->hostname_) == 0; -} +} int ACE_Naming_Context::open (Context_Scope_Type scope_in, int lite) { ACE_TRACE ("ACE_Naming_Context::open"); - ACE_OS::hostname (this->hostname_, + ACE_OS::hostname (this->hostname_, (sizeof this->hostname_ / sizeof (char))); this->netnameserver_host_ = this->name_options_->nameserver_host (); @@ -69,7 +69,7 @@ ACE_Naming_Context::open (Context_Scope_Type scope_in, int lite) #if (defined (ACE_WIN32) && defined (UNICODE)) // This only works on Win32 platforms when UNICODE is turned on - + if (this->name_options_->use_registry ()) // Use ACE_Registry ACE_NEW_RETURN (this->name_space_, ACE_Registry_Name_Space (this->name_options_), -1); @@ -78,7 +78,7 @@ ACE_Naming_Context::open (Context_Scope_Type scope_in, int lite) if (scope_in == ACE_Naming_Context::NET_LOCAL && this->local () == 0) { // Use NET_LOCAL name space, set up connection with remote server. - ACE_NEW_RETURN (this->name_space_, + ACE_NEW_RETURN (this->name_space_, ACE_Remote_Name_Space (this->netnameserver_host_, this->netnameserver_port_), -1); @@ -90,9 +90,9 @@ ACE_Naming_Context::open (Context_Scope_Type scope_in, int lite) else ACE_NEW_RETURN (this->name_space_, LOCAL_NAME_SPACE (scope_in, this->name_options_), -1); } - + if (ACE_LOG_MSG->op_status () != 0 || this->name_space_ == 0) - ACE_ERROR_RETURN ((LM_ERROR, "NAME_SPACE::NAME_SPACE\n"), -1); + ACE_ERROR_RETURN ((LM_ERROR, "NAME_SPACE::NAME_SPACE\n"), -1); return 0; } @@ -138,44 +138,44 @@ ACE_Naming_Context::name_options (void) return this->name_options_; } -int -ACE_Naming_Context::bind (const ACE_WString &name_in, - const ACE_WString &value_in, +int +ACE_Naming_Context::bind (const ACE_WString &name_in, + const ACE_WString &value_in, const char *type_in) { ACE_TRACE ("ACE_Naming_Context::bind"); return this->name_space_->bind (name_in, value_in, type_in); } -int -ACE_Naming_Context::bind (const char *name_in, - const char *value_in, +int +ACE_Naming_Context::bind (const char *name_in, + const char *value_in, const char *type_in) { ACE_TRACE ("ACE_Naming_Context::bind"); return this->bind (ACE_WString (name_in), ACE_WString (value_in), type_in); } -int -ACE_Naming_Context::rebind (const ACE_WString &name_in, - const ACE_WString &value_in, +int +ACE_Naming_Context::rebind (const ACE_WString &name_in, + const ACE_WString &value_in, const char *type_in) { ACE_TRACE ("ACE_Naming_Context::rebind"); return this->name_space_->rebind (name_in, value_in, type_in); } -int -ACE_Naming_Context::rebind (const char *name_in, - const char *value_in, +int +ACE_Naming_Context::rebind (const char *name_in, + const char *value_in, const char *type_in) { ACE_TRACE ("ACE_Naming_Context::rebind"); return rebind (ACE_WString (name_in), ACE_WString (value_in), type_in); } -int -ACE_Naming_Context::resolve (const ACE_WString &name_in, +int +ACE_Naming_Context::resolve (const ACE_WString &name_in, ACE_WString &value_out, char *&type_out) { @@ -183,8 +183,8 @@ ACE_Naming_Context::resolve (const ACE_WString &name_in, return this->name_space_->resolve (name_in, value_out, type_out); } -int -ACE_Naming_Context::resolve (const char *name_in, +int +ACE_Naming_Context::resolve (const char *name_in, ACE_WString &value_out, char *&type_out) { @@ -192,9 +192,9 @@ ACE_Naming_Context::resolve (const char *name_in, return this->resolve (ACE_WString (name_in), value_out, type_out); } -int -ACE_Naming_Context::resolve (const char *name_in, - char *&value_out, +int +ACE_Naming_Context::resolve (const char *name_in, + char *&value_out, char *&type_out) { ACE_TRACE ("ACE_Naming_Context::resolve"); @@ -210,110 +210,110 @@ ACE_Naming_Context::resolve (const char *name_in, return value_out == 0 ? -1 : 0; } -int +int ACE_Naming_Context::unbind (const ACE_WString &name_in) { ACE_TRACE ("ACE_Naming_Context::unbind"); return this->name_space_->unbind (name_in); } -int +int ACE_Naming_Context::unbind (const char *name_in) { ACE_TRACE ("ACE_Naming_Context::unbind"); return this->unbind (ACE_WString (name_in)); } -int -ACE_Naming_Context::list_names (ACE_PWSTRING_SET &set_out, +int +ACE_Naming_Context::list_names (ACE_PWSTRING_SET &set_out, const ACE_WString &pattern_in) { ACE_TRACE ("ACE_Naming_Context::list_names"); return this->name_space_->list_names (set_out, pattern_in); } -int -ACE_Naming_Context::list_names (ACE_PWSTRING_SET &set_out, +int +ACE_Naming_Context::list_names (ACE_PWSTRING_SET &set_out, const char *pattern_in) { ACE_TRACE ("ACE_Naming_Context::list_names"); return this->list_names (set_out, ACE_WString (pattern_in)); } -int -ACE_Naming_Context::list_values (ACE_PWSTRING_SET &set_out, +int +ACE_Naming_Context::list_values (ACE_PWSTRING_SET &set_out, const ACE_WString &pattern_in) { ACE_TRACE ("ACE_Naming_Context::list_values"); return this->name_space_->list_values (set_out, pattern_in); } -int -ACE_Naming_Context::list_values (ACE_PWSTRING_SET &set_out, +int +ACE_Naming_Context::list_values (ACE_PWSTRING_SET &set_out, const char *pattern_in) { ACE_TRACE ("ACE_Naming_Context::list_values"); return this->list_values (set_out, ACE_WString (pattern_in)); } -int -ACE_Naming_Context::list_types (ACE_PWSTRING_SET &set_out, +int +ACE_Naming_Context::list_types (ACE_PWSTRING_SET &set_out, const ACE_WString &pattern_in) { ACE_TRACE ("ACE_Naming_Context::list_types"); return this->name_space_->list_types (set_out, pattern_in); } -int -ACE_Naming_Context::list_types (ACE_PWSTRING_SET &set_out, +int +ACE_Naming_Context::list_types (ACE_PWSTRING_SET &set_out, const char *pattern_in) { ACE_TRACE ("ACE_Naming_Context::list_types"); return this->list_types (set_out, ACE_WString (pattern_in)); } -int -ACE_Naming_Context::list_name_entries (ACE_BINDING_SET &set_out, +int +ACE_Naming_Context::list_name_entries (ACE_BINDING_SET &set_out, const ACE_WString &pattern_in) { ACE_TRACE ("ACE_Naming_Context::list_name_entries"); return this->name_space_->list_name_entries (set_out, pattern_in); } -int -ACE_Naming_Context::list_name_entries (ACE_BINDING_SET &set_out, +int +ACE_Naming_Context::list_name_entries (ACE_BINDING_SET &set_out, const char *pattern_in) { ACE_TRACE ("ACE_Naming_Context::list_name_entries"); return this->list_name_entries (set_out, ACE_WString (pattern_in)); } -int -ACE_Naming_Context::list_value_entries (ACE_BINDING_SET &set_out, +int +ACE_Naming_Context::list_value_entries (ACE_BINDING_SET &set_out, const ACE_WString &pattern_in) { ACE_TRACE ("ACE_Naming_Context::list_value_entries"); return this->name_space_->list_value_entries (set_out, pattern_in); } -int -ACE_Naming_Context::list_value_entries (ACE_BINDING_SET &set_out, +int +ACE_Naming_Context::list_value_entries (ACE_BINDING_SET &set_out, const char *pattern_in) { ACE_TRACE ("ACE_Naming_Context::list_value_entries"); return this->list_value_entries (set_out, ACE_WString (pattern_in)); } -int -ACE_Naming_Context::list_type_entries (ACE_BINDING_SET &set_out, +int +ACE_Naming_Context::list_type_entries (ACE_BINDING_SET &set_out, const ACE_WString &pattern_in) { ACE_TRACE ("ACE_Naming_Context::list_type_entries"); return this->name_space_->list_type_entries (set_out, pattern_in); } -int -ACE_Naming_Context::list_type_entries (ACE_BINDING_SET &set_out, +int +ACE_Naming_Context::list_type_entries (ACE_BINDING_SET &set_out, const char *pattern_in) { ACE_TRACE ("ACE_Naming_Context::list_type_entries"); @@ -335,7 +335,7 @@ ACE_Naming_Context::dump () this->name_space_->dump(); } -int +int ACE_Naming_Context::init (int argc, char *argv[]) { ACE_DEBUG ((LM_DEBUG, "ACE_Naming_Context::init\n")); @@ -343,7 +343,7 @@ ACE_Naming_Context::init (int argc, char *argv[]) return this->open (this->name_options_->context ()); } -int +int ACE_Naming_Context::fini (void) { ACE_DEBUG ((LM_DEBUG, "ACE_Naming_Context::fini\n")); @@ -377,7 +377,7 @@ ACE_Name_Options::~ACE_Name_Options (void) ACE_OS::free ((void *) this->database_ ); } -void +void ACE_Name_Options::nameserver_port (int port) { ACE_TRACE ("ACE_Name_Options::nameserver_port"); @@ -391,7 +391,7 @@ ACE_Name_Options::nameserver_port (void) return this->nameserver_port_; } -void +void ACE_Name_Options::namespace_dir (LPCTSTR dir) { ACE_TRACE ("ACE_Name_Options::namespace_dir"); @@ -399,7 +399,7 @@ ACE_Name_Options::namespace_dir (LPCTSTR dir) this->namespace_dir_ = ACE_OS::strdup (dir); } -void +void ACE_Name_Options::process_name (LPCTSTR pname) { ACE_TRACE ("ACE_Name_Options::process_name"); @@ -408,7 +408,7 @@ ACE_Name_Options::process_name (LPCTSTR pname) this->process_name_ = ACE_OS::strdup (t); } -void +void ACE_Name_Options::nameserver_host (const char *host) { ACE_TRACE ("ACE_Name_Options::nameserver_host"); @@ -430,7 +430,7 @@ ACE_Name_Options::database (void) return this->database_; } -void +void ACE_Name_Options::database (LPCTSTR db) { ACE_TRACE ("ACE_Name_Options::database"); @@ -445,7 +445,7 @@ ACE_Name_Options::base_address (void) return this->base_address_; } -void +void ACE_Name_Options::base_address (char *base_address) { ACE_TRACE ("ACE_Name_Options::base_address"); @@ -459,7 +459,7 @@ ACE_Name_Options::context (void) return this->context_; } -void +void ACE_Name_Options::context (ACE_Naming_Context::Context_Scope_Type context) { ACE_TRACE ("ACE_Name_Options::context"); @@ -480,14 +480,14 @@ ACE_Name_Options::namespace_dir (void) return this->namespace_dir_; } -int +int ACE_Name_Options::debug (void) { ACE_TRACE ("ACE_Name_Options::debug"); return this->debugging_; } -int +int ACE_Name_Options::use_registry (void) { ACE_TRACE ("ACE_Name_Options::use_registry"); @@ -501,7 +501,7 @@ ACE_Name_Options::use_registry (int x) this->use_registry_ = x; } -int +int ACE_Name_Options::verbose (void) { ACE_TRACE ("ACE_Name_Options::verbose"); @@ -588,7 +588,7 @@ ACE_Name_Options::parse_args (int argc, char *argv[]) } } -#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Local_Name_Space <ACE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex>; template class ACE_Local_Name_Space <ACE_LITE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex>; template class ACE_Malloc<ACE_LITE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex>; @@ -597,4 +597,14 @@ template class ACE_Allocator_Adapter<ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_RW_Pro template class ACE_Allocator_Adapter<ACE_Malloc<ACE_LITE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex> >; template class ACE_Name_Space_Map <ACE_Allocator_Adapter <ACE_Malloc <ACE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex> > >; template class ACE_Name_Space_Map <ACE_Allocator_Adapter <ACE_Malloc <ACE_LITE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex> > >; -#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#pragma instantiate ACE_Local_Name_Space <ACE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex> +#pragma instantiate ACE_Local_Name_Space <ACE_LITE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex> +#pragma instantiate ACE_Malloc<ACE_LITE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex> +#pragma instantiate ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex> +#pragma instantiate ACE_Allocator_Adapter<ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex> > +#pragma instantiate ACE_Allocator_Adapter<ACE_Malloc<ACE_LITE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex> > +#pragma instantiate ACE_Name_Space_Map <ACE_Allocator_Adapter <ACE_Malloc <ACE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex> > > +#pragma instantiate ACE_Name_Space_Map <ACE_Allocator_Adapter <ACE_Malloc <ACE_LITE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex> > > +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + diff --git a/ace/Object_Manager.cpp b/ace/Object_Manager.cpp index 601cd96be50..b0b0cd21de3 100644 --- a/ace/Object_Manager.cpp +++ b/ace/Object_Manager.cpp @@ -77,8 +77,13 @@ ACE_Object_Manager::at_exit_i (void *object, return registered_objects_.enqueue_head (new_info); } -#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Unbounded_Queue<ACE_Object_Manager::object_info_t>; template class ACE_Unbounded_Queue_Iterator<ACE_Object_Manager::object_info_t>; template class ACE_Node<ACE_Object_Manager::object_info_t>; -#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#pragma instantiate ACE_Unbounded_Queue<ACE_Object_Manager::object_info_t> +#pragma instantiate ACE_Unbounded_Queue_Iterator<ACE_Object_Manager::object_info_t> +#pragma instantiate ACE_Node<ACE_Object_Manager::object_info_t> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + diff --git a/ace/Parse_Node.cpp b/ace/Parse_Node.cpp index 95de6ac8663..f7b5158d26b 100644 --- a/ace/Parse_Node.cpp +++ b/ace/Parse_Node.cpp @@ -34,12 +34,12 @@ ACE_Stream_Node::apply (void) { ACE_TRACE ("ACE_Stream_Node::apply"); - if (ACE_Service_Config::initialize (this->node_->record (), + if (ACE_Service_Config::initialize (this->node_->record (), this->node_->parameters ()) == -1) ace_yyerrno++; - ACE_DEBUG ((LM_DEBUG, "did stream on %s, error = %d\n", - this->node_->name (), + ACE_DEBUG ((LM_DEBUG, "did stream on %s, error = %d\n", + this->node_->name (), ace_yyerrno)); } @@ -65,18 +65,18 @@ ACE_Parse_Node::link (void) const return this->next_; } -void +void ACE_Parse_Node::link (ACE_Parse_Node *n) { ACE_TRACE ("ACE_Parse_Node::link"); this->next_ = n; } -ACE_Stream_Node::ACE_Stream_Node (const ACE_Static_Node *str_ops, +ACE_Stream_Node::ACE_Stream_Node (const ACE_Static_Node *str_ops, const ACE_Parse_Node *str_mods) : ACE_Parse_Node (str_ops->name ()), - node_ (str_ops), - mods_ (str_mods) + node_ (str_ops), + mods_ (str_mods) { ACE_TRACE ("ACE_Stream_Node::ACE_Stream_Node"); } @@ -97,7 +97,7 @@ ACE_Parse_Node::ACE_Parse_Node (void) ACE_Parse_Node::ACE_Parse_Node (const char *nm) - : name_ (nm), + : name_ (nm), next_ (0) { ACE_TRACE ("ACE_Parse_Node::ACE_Parse_Node"); @@ -154,7 +154,7 @@ ACE_Suspend_Node::apply (void) if (ACE_Service_Config::suspend (this->name ()) == -1) ace_yyerrno++; - ACE_DEBUG ((LM_DEBUG, "did suspend on %s, error = %d\n", + ACE_DEBUG ((LM_DEBUG, "did suspend on %s, error = %d\n", this->name (), ace_yyerrno)); } @@ -165,7 +165,7 @@ ACE_Resume_Node::apply (void) if (ACE_Service_Config::resume (this->name ()) == -1) ace_yyerrno++; - ACE_DEBUG ((LM_DEBUG, "did resume on %s, error = %d\n", + ACE_DEBUG ((LM_DEBUG, "did resume on %s, error = %d\n", this->name (), ace_yyerrno)); } @@ -190,7 +190,7 @@ ACE_Remove_Node::apply (void) if (ACE_Service_Config::remove (this->name ()) == -1) ace_yyerrno++; - ACE_DEBUG ((LM_DEBUG, "did remove on %s, error = %d\n", + ACE_DEBUG ((LM_DEBUG, "did remove on %s, error = %d\n", this->name (), ace_yyerrno)); } @@ -215,11 +215,11 @@ void ACE_Dynamic_Node::apply (void) { ACE_TRACE ("ACE_Dynamic_Node::apply"); - if (ACE_Service_Config::initialize (this->record (), + if (ACE_Service_Config::initialize (this->record (), this->parameters ()) == -1) ace_yyerrno++; - - ACE_DEBUG ((LM_DEBUG, "did dynamic on %s, error = %d\n", + + ACE_DEBUG ((LM_DEBUG, "did dynamic on %s, error = %d\n", this->name (), ace_yyerrno)); } @@ -245,9 +245,9 @@ ACE_Static_Node::dump (void) const ACE_TRACE ("ACE_Static_Node::dump"); } -ACE_Static_Node::ACE_Static_Node (const char *nm, +ACE_Static_Node::ACE_Static_Node (const char *nm, char *params) - : ACE_Parse_Node (nm), + : ACE_Parse_Node (nm), parameters_ (params) { ACE_TRACE ("ACE_Static_Node::ACE_Static_Node"); @@ -259,7 +259,7 @@ ACE_Static_Node::record (void) const ACE_TRACE ("ACE_Static_Node::record"); ACE_Service_Record *sr; - if (ACE_Service_Repository::instance()->find (this->name (), + if (ACE_Service_Repository::instance()->find (this->name (), (const ACE_Service_Record **) &sr) == -1) return 0; else @@ -277,11 +277,11 @@ void ACE_Static_Node::apply (void) { ACE_TRACE ("ACE_Static_Node::apply"); - if (ACE_Service_Config::initialize (this->name (), + if (ACE_Service_Config::initialize (this->name (), this->parameters ()) == -1) ace_yyerrno++; - - ACE_DEBUG ((LM_DEBUG, "did static on %s, error = %d\n", + + ACE_DEBUG ((LM_DEBUG, "did static on %s, error = %d\n", this->name (), ace_yyerrno)); } @@ -300,8 +300,8 @@ ACE_Location_Node::dump (void) const } ACE_Location_Node::ACE_Location_Node (void) - : handle_ (0), - symbol_ (0), + : handle_ (0), + symbol_ (0), pathname_ (0) { ACE_TRACE ("ACE_Location_Node::ACE_Location_Node"); @@ -319,14 +319,14 @@ ACE_Location_Node::pathname (void) const return this->pathname_; } -void +void ACE_Location_Node::pathname (const char *p) { ACE_TRACE ("ACE_Location_Node::pathname"); this->pathname_ = p; } -void +void ACE_Location_Node::handle (const ACE_SHLIB_HANDLE h) { ACE_TRACE ("ACE_Location_Node::handle"); @@ -340,7 +340,7 @@ ACE_Location_Node::handle (void) const return this->handle_; } -void +void ACE_Location_Node::set_symbol (const void *s) { ACE_TRACE ("ACE_Location_Node::set_symbol"); @@ -363,10 +363,10 @@ ACE_Location_Node::open_handle (void) // Transform the pathname into the appropriate dynamic link library // by searching the ACE_LD_SEARCH_PATH. - ACE::ldfind (this->pathname (), - dl_pathname, + ACE::ldfind (this->pathname (), + dl_pathname, (sizeof dl_pathname / sizeof (char))); - + this->handle (ACE_OS::dlopen (dl_pathname)); if (this->handle () == 0) @@ -394,7 +394,7 @@ ACE_Object_Node::dump (void) const ACE_TRACE ("ACE_Object_Node::dump"); } -ACE_Object_Node::ACE_Object_Node (const char *path, +ACE_Object_Node::ACE_Object_Node (const char *path, const char *obj_name) : object_name_ (obj_name) { @@ -409,7 +409,7 @@ ACE_Object_Node::symbol (void) ACE_TRACE ("ACE_Object_Node::symbol"); if (this->open_handle () != 0) { - this->symbol_ = (const void *) + this->symbol_ = (const void *) ACE_OS::dlsym ((ACE_SHLIB_HANDLE) this->handle (), (char *) this->object_name_); @@ -417,12 +417,12 @@ ACE_Object_Node::symbol (void) { ace_yyerrno++; - ACE_ERROR ((LM_ERROR, - "dlsym failed for object %s\n", + ACE_ERROR ((LM_ERROR, + "dlsym failed for object %s\n", this->object_name_)); char *errmsg = ACE_OS::dlerror (); - + if (errmsg != 0) ACE_ERROR_RETURN ((LM_ERROR, ": %s\n", errmsg), 0); else @@ -447,7 +447,7 @@ ACE_Function_Node::dump (void) const ACE_TRACE ("ACE_Function_Node::dump"); } -ACE_Function_Node::ACE_Function_Node (const char *path, +ACE_Function_Node::ACE_Function_Node (const char *path, const char *func_name) : function_name_ (func_name) { @@ -468,8 +468,8 @@ ACE_Function_Node::symbol (void) // Locate the factory function <function_name> in the shared // object. - func = (const void *(*)(void)) - ACE_OS::dlsym ((ACE_SHLIB_HANDLE) this->handle (), + func = (const void *(*)(void)) + ACE_OS::dlsym ((ACE_SHLIB_HANDLE) this->handle (), (ACE_DL_TYPE) this->function_name_); if (func == 0) @@ -480,11 +480,11 @@ ACE_Function_Node::symbol (void) { ace_yyerrno++; - ACE_ERROR ((LM_ERROR, "dlsym failed for function %s\n", + ACE_ERROR ((LM_ERROR, "dlsym failed for function %s\n", this->function_name_)); char *errmsg = ACE_OS::dlerror (); - + if (errmsg != 0) ACE_ERROR_RETURN ((LM_ERROR, ": %s\n", errmsg), 0); else @@ -516,10 +516,10 @@ ACE_Dummy_Node::dump (void) const ACE_TRACE ("ACE_Dummy_Node::dump"); } -ACE_Dummy_Node::ACE_Dummy_Node (const ACE_Static_Node *static_node, +ACE_Dummy_Node::ACE_Dummy_Node (const ACE_Static_Node *static_node, const ACE_Parse_Node *str_mods) : ACE_Parse_Node (static_node->name ()), - node_ (static_node), + node_ (static_node), mods_ (str_mods) { ACE_TRACE ("ACE_Dummy_Node::ACE_Dummy_Node"); @@ -529,7 +529,7 @@ void ACE_Dummy_Node::apply (void) { ACE_TRACE ("ACE_Dummy_Node::apply"); - ACE_DEBUG ((LM_DEBUG, "did operations on stream %s, error = %d\n", + ACE_DEBUG ((LM_DEBUG, "did operations on stream %s, error = %d\n", this->name (), ace_yyerrno)); } @@ -540,5 +540,7 @@ ACE_Dummy_Node::~ACE_Dummy_Node (void) delete (ACE_Parse_Node *) this->mods_; } -#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) -#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + diff --git a/ace/Reactor.cpp b/ace/Reactor.cpp index 6d864504a3f..5c8a0dc72c6 100644 --- a/ace/Reactor.cpp +++ b/ace/Reactor.cpp @@ -91,9 +91,9 @@ ACE_Reactor_Handler_Repository::open (size_t size) this->max_handlep1_ = 0; #if defined (ACE_WIN32) - // Try to allocate the memory. - ACE_NEW_RETURN (this->event_handlers_, - ACE_NT_EH_Record[size], + // Try to allocate the memory. + ACE_NEW_RETURN (this->event_handlers_, + ACE_NT_EH_Record[size], -1); // Initialize the ACE_Event_Handler * to { ACE_INVALID_HANDLE, 0 }. @@ -103,9 +103,9 @@ ACE_Reactor_Handler_Repository::open (size_t size) ACE_REACTOR_EVENT_HANDLER (this, h) = 0; } #else - // Try to allocate the memory. - ACE_NEW_RETURN (this->event_handlers_, - ACE_Event_Handler *[size], + // Try to allocate the memory. + ACE_NEW_RETURN (this->event_handlers_, + ACE_Event_Handler *[size], -1); // Initialize the ACE_Event_Handler * to NULL. @@ -119,7 +119,7 @@ ACE_Reactor_Handler_Repository::open (size_t size) ACE_Reactor_Handler_Repository::ACE_Reactor_Handler_Repository (ACE_Reactor &reactor) : reactor_ (reactor), - max_size_ (0), + max_size_ (0), max_handlep1_ (0), event_handlers_ (0) { @@ -130,8 +130,8 @@ int ACE_Reactor_Handler_Repository::unbind_all (void) { // Unbind all of the <handle, ACE_Event_Handler>s. - for (int handle = 0; - handle < this->max_handlep1_; + for (int handle = 0; + handle < this->max_handlep1_; handle++) this->unbind (ACE_REACTOR_HANDLE (handle), ACE_Event_Handler::ALL_EVENTS_MASK); @@ -187,7 +187,7 @@ ACE_Reactor_Handler_Repository::find (ACE_HANDLE handle, // g++ can't figure out that i won't be used below if the handle // is out of range, so keep it happy by defining i here . . . i = 0; - + if (eh != 0 && index_p != 0) *index_p = i; else @@ -198,8 +198,8 @@ ACE_Reactor_Handler_Repository::find (ACE_HANDLE handle, // Bind the <ACE_Event_Handler *> to the <ACE_HANDLE>. -int -ACE_Reactor_Handler_Repository::bind (ACE_HANDLE handle, +int +ACE_Reactor_Handler_Repository::bind (ACE_HANDLE handle, ACE_Event_Handler *event_handler, ACE_Reactor_Mask mask) { @@ -236,7 +236,7 @@ ACE_Reactor_Handler_Repository::bind (ACE_HANDLE handle, } else if (this->max_handlep1_ < this->max_size_) { - // Insert at the end of the active portion. + // Insert at the end of the active portion. ACE_REACTOR_HANDLE (this->max_handlep1_) = handle; ACE_REACTOR_EVENT_HANDLER (this, this->max_handlep1_) = event_handler; this->max_handlep1_++; @@ -255,8 +255,8 @@ ACE_Reactor_Handler_Repository::bind (ACE_HANDLE handle, #endif /* ACE_WIN32 */ // Add the <mask> for this <handle> in the Reactor's wait_set. - this->reactor_.bit_ops (handle, - mask, + this->reactor_.bit_ops (handle, + mask, this->reactor_.wait_set_, ACE_Reactor::ADD_MASK); @@ -272,7 +272,7 @@ ACE_Reactor_Handler_Repository::bind (ACE_HANDLE handle, // Remove the binding of <ACE_HANDLE>. -int +int ACE_Reactor_Handler_Repository::unbind (ACE_HANDLE handle, ACE_Reactor_Mask mask) { @@ -285,8 +285,8 @@ ACE_Reactor_Handler_Repository::unbind (ACE_HANDLE handle, return -1; // Clear out the <mask> bits in the Reactor's wait_set. - this->reactor_.bit_ops (handle, - mask, + this->reactor_.bit_ops (handle, + mask, this->reactor_.wait_set_, ACE_Reactor::CLR_MASK); @@ -303,7 +303,7 @@ ACE_Reactor_Handler_Repository::unbind (ACE_HANDLE handle, // If there are no longer any outstanding events on this <handle> // then we can totally shut down the Event_Handler. if (this->reactor_.wait_set_.rd_mask_.is_set (handle) == 0 - && this->reactor_.wait_set_.wr_mask_.is_set (handle) == 0 + && this->reactor_.wait_set_.wr_mask_.is_set (handle) == 0 && this->reactor_.wait_set_.ex_mask_.is_set (handle) == 0) #if defined (ACE_WIN32) { @@ -311,7 +311,7 @@ ACE_Reactor_Handler_Repository::unbind (ACE_HANDLE handle, ACE_REACTOR_EVENT_HANDLER (this, index) = 0; if (this->max_handlep1_ == (int) index + 1) - { + { // We've deleted the last entry (i.e., i + 1 == the current // size of the array), so we need to figure out the last // valid place in the array that we should consider in @@ -321,14 +321,14 @@ ACE_Reactor_Handler_Repository::unbind (ACE_HANDLE handle, i >= 0 && ACE_REACTOR_HANDLE (i) == ACE_INVALID_HANDLE; i--) continue; - + this->max_handlep1_ = i + 1; } } #else - { + { ACE_REACTOR_EVENT_HANDLER (this, handle) = 0; - + if (this->max_handlep1_ == handle + 1) { // We've deleted the last entry, so we need to figure out @@ -352,7 +352,7 @@ ACE_Reactor_Handler_Repository::unbind (ACE_HANDLE handle, return 0; } -ACE_Reactor_Handler_Repository_Iterator::ACE_Reactor_Handler_Repository_Iterator +ACE_Reactor_Handler_Repository_Iterator::ACE_Reactor_Handler_Repository_Iterator (const ACE_Reactor_Handler_Repository *s) : rep_ (s), current_ (-1) @@ -363,7 +363,7 @@ ACE_Reactor_Handler_Repository_Iterator::ACE_Reactor_Handler_Repository_Iterator // Pass back the <next_item> that hasn't been seen in the Set. // Returns 0 when all items have been seen, else 1. -int +int ACE_Reactor_Handler_Repository_Iterator::next (ACE_Event_Handler *&next_item) { int result = 1; @@ -371,12 +371,12 @@ ACE_Reactor_Handler_Repository_Iterator::next (ACE_Event_Handler *&next_item) if (this->current_ >= this->rep_->max_handlep1_) result = 0; else - next_item = ACE_REACTOR_EVENT_HANDLER (this->rep_, + next_item = ACE_REACTOR_EVENT_HANDLER (this->rep_, this->current_); return result; } -int +int ACE_Reactor_Handler_Repository_Iterator::done (void) const { return this->current_ >= this->rep_->max_handlep1_; @@ -384,7 +384,7 @@ ACE_Reactor_Handler_Repository_Iterator::done (void) const // Move forward by one element in the set. -int +int ACE_Reactor_Handler_Repository_Iterator::advance (void) { if (this->current_ < this->rep_->max_handlep1_) @@ -396,12 +396,12 @@ ACE_Reactor_Handler_Repository_Iterator::advance (void) else this->current_++; - return this->current_ < this->rep_->max_handlep1_; + return this->current_ < this->rep_->max_handlep1_; } // Dump the state of an object. -void +void ACE_Reactor_Handler_Repository_Iterator::dump (void) const { ACE_TRACE ("ACE_Reactor_Handler_Repository_Iterator::dump"); @@ -409,7 +409,7 @@ ACE_Reactor_Handler_Repository_Iterator::dump (void) const ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); ACE_DEBUG ((LM_DEBUG, "rep_ = %u", this->rep_)); ACE_DEBUG ((LM_DEBUG, "current_ = %d", this->current_)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); } void @@ -418,9 +418,9 @@ ACE_Reactor_Handler_Repository::dump (void) const ACE_TRACE ("ACE_Reactor_Handler_Repository::dump"); ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, + ACE_DEBUG ((LM_DEBUG, "(%t) max_handlep1_ = %d, max_size_ = %d\n", - this->max_handlep1_, this->max_size_)); + this->max_handlep1_, this->max_size_)); ACE_DEBUG ((LM_DEBUG, "[")); ACE_Event_Handler *eh = 0; @@ -428,16 +428,16 @@ ACE_Reactor_Handler_Repository::dump (void) const for (ACE_Reactor_Handler_Repository_Iterator iter (this); iter.next (eh) != 0; iter.advance ()) - ACE_DEBUG ((LM_DEBUG, " (eh = %x, eh->handle_ = %d)", + ACE_DEBUG ((LM_DEBUG, " (eh = %x, eh->handle_ = %d)", eh, eh->get_handle ())); ACE_DEBUG ((LM_DEBUG, " ]")); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); } ACE_ALLOC_HOOK_DEFINE(ACE_Reactor_Handler_Repository_Iterator) -int +int ACE_Reactor::any_ready (ACE_Reactor_Handle_Set &wait_set) { ACE_TRACE ("ACE_Reactor::fill_in_ready"); @@ -447,7 +447,7 @@ ACE_Reactor::any_ready (ACE_Reactor_Handle_Set &wait_set) ACE_Sig_Guard sb; #endif /* ACE_WIN32 */ - int number_ready = this->ready_set_.rd_mask_.num_set () + int number_ready = this->ready_set_.rd_mask_.num_set () + this->ready_set_.wr_mask_.num_set () + this->ready_set_.ex_mask_.num_set (); @@ -465,7 +465,7 @@ ACE_Reactor::any_ready (ACE_Reactor_Handle_Set &wait_set) return number_ready; } -int +int ACE_Reactor::handler_i (int signum, ACE_Event_Handler **eh) { ACE_TRACE ("ACE_Reactor::handler_i"); @@ -496,7 +496,7 @@ ACE_Reactor::owner (ACE_thread_t tid, ACE_thread_t *o_id) *o_id = this->owner_; this->owner_ = tid; - + return 0; } @@ -509,7 +509,7 @@ ACE_Reactor::owner (ACE_thread_t *t_id) return 0; } -void +void ACE_Reactor::requeue_position (int rp) { ACE_TRACE ("ACE_Reactor::requeue_position"); @@ -522,7 +522,7 @@ ACE_Reactor::requeue_position (int rp) #endif /* ACE_WIN32 */ } -int +int ACE_Reactor::requeue_position (void) { ACE_TRACE ("ACE_Reactor::requeue_position"); @@ -530,7 +530,7 @@ ACE_Reactor::requeue_position (void) return this->requeue_position_; } -void +void ACE_Reactor::max_notify_iterations (int iterations) { ACE_TRACE ("ACE_Reactor::max_notify_iterations"); @@ -543,7 +543,7 @@ ACE_Reactor::max_notify_iterations (int iterations) this->max_notify_iterations_ = iterations; } -int +int ACE_Reactor::max_notify_iterations (void) { ACE_TRACE ("ACE_Reactor::max_notify_iterations"); @@ -553,7 +553,7 @@ ACE_Reactor::max_notify_iterations (void) #if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) // Enqueue ourselves into the list of waiting threads. -void +void ACE_Reactor::renew (void) { ACE_TRACE ("ACE_Reactor::renew"); @@ -567,7 +567,7 @@ ACE_Reactor_Token::dump (void) const ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); ACE_DEBUG ((LM_DEBUG, "\n")); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); } ACE_Reactor_Token::ACE_Reactor_Token (ACE_Reactor &r) @@ -597,7 +597,7 @@ ACE_Reactor_Notify::dump (void) const ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); ACE_DEBUG ((LM_DEBUG, "reactor_ = %x", this->reactor_)); this->notification_pipe_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); } int @@ -612,11 +612,11 @@ ACE_Reactor_Notify::open (ACE_Reactor *r) // There seems to be a Win32 bug with this... Set this into // non-blocking mode. - if (ACE::set_flags (this->notification_pipe_.read_handle (), + if (ACE::set_flags (this->notification_pipe_.read_handle (), ACE_NONBLOCK) == -1) return -1; - else - return this->reactor_->register_handler + else + return this->reactor_->register_handler (this->notification_pipe_.read_handle (), this, ACE_Event_Handler::READ_MASK); @@ -630,8 +630,8 @@ ACE_Reactor_Notify::close (void) } ssize_t -ACE_Reactor_Notify::notify (ACE_Event_Handler *eh, - ACE_Reactor_Mask mask, +ACE_Reactor_Notify::notify (ACE_Event_Handler *eh, + ACE_Reactor_Mask mask, ACE_Time_Value *timeout) { ACE_TRACE ("ACE_Reactor_Notify::notify"); @@ -639,7 +639,7 @@ ACE_Reactor_Notify::notify (ACE_Event_Handler *eh, ACE_Notification_Buffer buffer (eh, mask); ssize_t n = ACE::send (this->notification_pipe_.write_handle (), - (char *) &buffer, + (char *) &buffer, sizeof buffer, timeout); return n == -1 ? -1 : 0; @@ -654,7 +654,7 @@ ACE_Reactor_Notify::dispatch_notifications (int &number_of_active_handles, { ACE_TRACE ("ACE_Reactor_Notify::handle_notification"); - ACE_HANDLE read_handle = + ACE_HANDLE read_handle = this->notification_pipe_.read_handle (); if (rd_mask.is_set (read_handle)) @@ -685,7 +685,7 @@ ACE_Reactor_Notify::handle_input (ACE_HANDLE handle) while ((n = ACE::recv (handle, (char *) &buffer, sizeof buffer)) > 0) { // Check to see if we've got a short read. - if (n != sizeof buffer) + if (n != sizeof buffer) { ssize_t remainder = sizeof buffer - n; @@ -722,7 +722,7 @@ ACE_Reactor_Notify::handle_input (ACE_HANDLE handle) ACE_ERROR ((LM_ERROR, "invalid mask = %d\n", buffer.mask_)); } if (result == -1) - buffer.eh_->handle_close (ACE_INVALID_HANDLE, + buffer.eh_->handle_close (ACE_INVALID_HANDLE, ACE_Event_Handler::EXCEPT_MASK); } @@ -750,7 +750,7 @@ ACE_Reactor_Notify::handle_input (ACE_HANDLE handle) #endif /* ACE_MT_SAFE */ int -ACE_Reactor::notify (ACE_Event_Handler *eh, +ACE_Reactor::notify (ACE_Event_Handler *eh, ACE_Reactor_Mask mask, ACE_Time_Value *timeout) { @@ -821,7 +821,7 @@ ACE_Reactor::resume_handlers (void) } int -ACE_Reactor::register_handler (ACE_Event_Handler *handler, +ACE_Reactor::register_handler (ACE_Event_Handler *handler, ACE_Reactor_Mask mask) { ACE_TRACE ("ACE_Reactor::register_handler"); @@ -830,8 +830,8 @@ ACE_Reactor::register_handler (ACE_Event_Handler *handler, } int -ACE_Reactor::register_handler (ACE_HANDLE handle, - ACE_Event_Handler *handler, +ACE_Reactor::register_handler (ACE_HANDLE handle, + ACE_Event_Handler *handler, ACE_Reactor_Mask mask) { ACE_TRACE ("ACE_Reactor::register_handler"); @@ -840,8 +840,8 @@ ACE_Reactor::register_handler (ACE_HANDLE handle, } int -ACE_Reactor::register_handler (const ACE_Handle_Set &handles, - ACE_Event_Handler *handler, +ACE_Reactor::register_handler (const ACE_Handle_Set &handles, + ACE_Event_Handler *handler, ACE_Reactor_Mask mask) { ACE_TRACE ("ACE_Reactor::register_handler"); @@ -850,8 +850,8 @@ ACE_Reactor::register_handler (const ACE_Handle_Set &handles, } int -ACE_Reactor::handler (ACE_HANDLE handle, - ACE_Reactor_Mask mask, +ACE_Reactor::handler (ACE_HANDLE handle, + ACE_Reactor_Mask mask, ACE_Event_Handler **handler) { ACE_TRACE ("ACE_Reactor::handler"); @@ -860,7 +860,7 @@ ACE_Reactor::handler (ACE_HANDLE handle, } int -ACE_Reactor::remove_handler (const ACE_Handle_Set &handles, +ACE_Reactor::remove_handler (const ACE_Handle_Set &handles, ACE_Reactor_Mask mask) { ACE_TRACE ("ACE_Reactor::remove_handler"); @@ -869,7 +869,7 @@ ACE_Reactor::remove_handler (const ACE_Handle_Set &handles, } int -ACE_Reactor::remove_handler (ACE_Event_Handler *handler, +ACE_Reactor::remove_handler (ACE_Event_Handler *handler, ACE_Reactor_Mask mask) { ACE_TRACE ("ACE_Reactor::remove_handler"); @@ -878,7 +878,7 @@ ACE_Reactor::remove_handler (ACE_Event_Handler *handler, } int -ACE_Reactor::remove_handler (ACE_HANDLE handle, +ACE_Reactor::remove_handler (ACE_HANDLE handle, ACE_Reactor_Mask mask) { ACE_TRACE ("ACE_Reactor::remove_handler"); @@ -889,13 +889,13 @@ ACE_Reactor::remove_handler (ACE_HANDLE handle, // Performs operations on the "ready" bits. int -ACE_Reactor::ready_ops (ACE_HANDLE handle, - ACE_Reactor_Mask mask, +ACE_Reactor::ready_ops (ACE_HANDLE handle, + ACE_Reactor_Mask mask, int ops) { ACE_TRACE ("ACE_Reactor::ready_ops"); ACE_MT (ACE_GUARD_RETURN (ACE_REACTOR_MUTEX, ace_mon, this->token_, -1)); - return this->bit_ops (handle, + return this->bit_ops (handle, mask, this->ready_set_, ops); @@ -905,16 +905,16 @@ ACE_Reactor * ACE_Reactor::instance (size_t size /* = ACE_Reactor::DEFAULT_SIZE */) { ACE_TRACE ("ACE_Reactor::instance"); - + if (ACE_Reactor::reactor_ == 0) { // Perform Double-Checked Locking Optimization. ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, *ACE_Static_Object_Lock::instance (), 0)); - + if (ACE_Reactor::reactor_ == 0) { - ACE_NEW_RETURN (ACE_Reactor::reactor_, ACE_Reactor (size), NULL); + ACE_NEW_RETURN (ACE_Reactor::reactor_, ACE_Reactor (size), NULL); ACE_Reactor::delete_reactor_ = 1; } } @@ -1007,7 +1007,7 @@ ACE_Reactor::end_event_loop (void) // Send a notification, but don't block if there's no one to receive // it. - return ACE_Reactor::instance ()->notify + return ACE_Reactor::instance ()->notify (0, ACE_Event_Handler::NULL_MASK, (ACE_Time_Value *) &ACE_Time_Value::zero); } @@ -1022,8 +1022,8 @@ ACE_Reactor::event_loop_done (void) // Initialize the ACE_Reactor int -ACE_Reactor::open (size_t size, - int restart, +ACE_Reactor::open (size_t size, + int restart, ACE_Sig_Handler *sh, ACE_Timer_Queue *tq) { @@ -1045,7 +1045,7 @@ ACE_Reactor::open (size_t size, if (this->signal_handler_ == 0) { this->signal_handler_ = new ACE_Sig_Handler; - + if (this->signal_handler_ == 0) result = -1; else @@ -1101,8 +1101,8 @@ ACE_Reactor::ACE_Reactor (ACE_Sig_Handler *sh, // Initialize ACE_Reactor. -ACE_Reactor::ACE_Reactor (size_t size, - int rs, +ACE_Reactor::ACE_Reactor (size_t size, + int rs, ACE_Sig_Handler *sh, ACE_Timer_Queue *tq) : handler_rep_ (*this), @@ -1148,7 +1148,7 @@ ACE_Reactor::close (void) #endif /* ACE_MT_SAFE */ this->initialized_ = 0; } - + ACE_Reactor::~ACE_Reactor (void) { ACE_TRACE ("ACE_Reactor::~ACE_Reactor"); @@ -1168,12 +1168,12 @@ ACE_Reactor::remove_handler_i (const ACE_Handle_Set &handles, if (this->remove_handler_i (h, mask) == -1) return -1; - return 0; + return 0; } int -ACE_Reactor::register_handler_i (const ACE_Handle_Set &handles, - ACE_Event_Handler *handler, +ACE_Reactor::register_handler_i (const ACE_Handle_Set &handles, + ACE_Event_Handler *handler, ACE_Reactor_Mask mask) { ACE_TRACE ("ACE_Reactor::register_handler_i"); @@ -1184,11 +1184,11 @@ ACE_Reactor::register_handler_i (const ACE_Handle_Set &handles, if (this->register_handler_i (h, handler, mask) == -1) return -1; - return 0; + return 0; } int -ACE_Reactor::register_handler (const ACE_Sig_Set &sigset, +ACE_Reactor::register_handler (const ACE_Sig_Set &sigset, ACE_Event_Handler *new_sh, ACE_Sig_Action *new_disp) { @@ -1199,9 +1199,9 @@ ACE_Reactor::register_handler (const ACE_Sig_Set &sigset, #if (NSIG > 0) for (int s = 1; s < NSIG; s++) - if (sigset.is_member (s) - && this->signal_handler_->register_handler (s, new_sh, - new_disp) == -1) + if (sigset.is_member (s) + && this->signal_handler_->register_handler (s, new_sh, + new_disp) == -1) result = -1; #endif /* NSIG */ return result; @@ -1215,35 +1215,35 @@ ACE_Reactor::remove_handler (const ACE_Sig_Set &sigset) #if (NSIG == 0) for (int s = 1; s < NSIG; s++) - if (sigset.is_member (s) + if (sigset.is_member (s) && this->signal_handler_->remove_handler (s) == -1) result = -1; #else ACE_UNUSED_ARG (sigset); #endif /* NSIG */ - return result; + return result; } -// Note the queue handles its own locking. +// Note the queue handles its own locking. long -ACE_Reactor::schedule_timer (ACE_Event_Handler *handler, +ACE_Reactor::schedule_timer (ACE_Event_Handler *handler, const void *arg, - const ACE_Time_Value &delta_time, + const ACE_Time_Value &delta_time, const ACE_Time_Value &interval) { ACE_TRACE ("ACE_Reactor::schedule_timer"); ACE_MT (ACE_GUARD_RETURN (ACE_REACTOR_MUTEX, ace_mon, this->token_, -1)); - return this->timer_queue_->schedule + return this->timer_queue_->schedule (handler, arg, timer_queue_->gettimeofday () + delta_time, interval); } // Main event loop driver that blocks for <max_wait_time> before // returning (will return earlier if I/O or signal events occur). -int +int ACE_Reactor::handle_events (ACE_Time_Value &max_wait_time) { ACE_TRACE ("ACE_Reactor::handle_events"); @@ -1264,8 +1264,8 @@ ACE_Reactor::handle_error (void) } void -ACE_Reactor::notify_handle (ACE_HANDLE handle, - ACE_Reactor_Mask mask, +ACE_Reactor::notify_handle (ACE_HANDLE handle, + ACE_Reactor_Mask mask, ACE_Handle_Set &ready_mask, ACE_Event_Handler *event_handler, ACE_EH_PTMF ptmf) @@ -1288,10 +1288,10 @@ ACE_Reactor::notify_handle (ACE_HANDLE handle, // GET = 1, Retrieve current value // SET = 2, Set value of bits to new mask (changes the entire mask) // ADD = 3, Bitwise "or" the value into the mask (only changes -// enabled bits) +// enabled bits) // CLR = 4 Bitwise "and" the negation of the value out of the mask -// (only changes enabled bits) -// +// (only changes enabled bits) +// // Returns the original mask. Must be called with locks held. int @@ -1305,7 +1305,7 @@ ACE_Reactor::bit_ops (ACE_HANDLE handle, return -1; #if !defined (ACE_WIN32) - ACE_Sig_Guard sb; // Block out all signals until method returns. + ACE_Sig_Guard sb; // Block out all signals until method returns. #endif /* ACE_WIN32 */ ACE_FDS_PTMF ptmf = &ACE_Handle_Set::set_bit; @@ -1361,32 +1361,32 @@ ACE_Reactor::bit_ops (ACE_HANDLE handle, else if (ops == ACE_Reactor::SET_MASK) handle_set.ex_mask_.clr_bit (handle); break; - default: + default: return -1; } return omask; } // Perform GET, CLR, SET, and ADD operations on the select() -// Handle_Sets. +// Handle_Sets. // // GET = 1, Retrieve current value -// SET = 2, Set value of bits to new mask (changes the entire mask) +// SET = 2, Set value of bits to new mask (changes the entire mask) // ADD = 3, Bitwise "or" the value into the mask (only changes -// enabled bits) +// enabled bits) // CLR = 4 Bitwise "and" the negation of the value out of the mask -// (only changes enabled bits) +// (only changes enabled bits) // // Returns the original mask. int -ACE_Reactor::mask_ops (ACE_HANDLE handle, - ACE_Reactor_Mask mask, +ACE_Reactor::mask_ops (ACE_HANDLE handle, + ACE_Reactor_Mask mask, int ops) { ACE_TRACE ("ACE_Reactor::mask_ops"); ACE_MT (ACE_GUARD_RETURN (ACE_REACTOR_MUTEX, ace_mon, this->token_, -1)); - return this->bit_ops (handle, mask, + return this->bit_ops (handle, mask, this->wait_set_, ops); } @@ -1394,9 +1394,9 @@ ACE_Reactor::mask_ops (ACE_HANDLE handle, // Must be called with locks held. int -ACE_Reactor::handler_i (ACE_HANDLE handle, - ACE_Reactor_Mask mask, - ACE_Event_Handler **handler) +ACE_Reactor::handler_i (ACE_HANDLE handle, + ACE_Reactor_Mask mask, + ACE_Event_Handler **handler) { ACE_TRACE ("ACE_Reactor::handler_i"); ACE_Event_Handler *h = this->handler_rep_.find (handle); @@ -1413,7 +1413,7 @@ ACE_Reactor::handler_i (ACE_HANDLE handle, && this->wait_set_.wr_mask_.is_set (handle) == 0) return -1; if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::EXCEPT_MASK) - && this->wait_set_.ex_mask_.is_set (handle) == 0) + && this->wait_set_.ex_mask_.is_set (handle) == 0) return -1; } @@ -1430,7 +1430,7 @@ ACE_Reactor::resume_i (ACE_HANDLE handle) ACE_TRACE ("ACE_Reactor::resume"); if (this->handler_rep_.find (handle) == 0) return -1; - + this->wait_set_.rd_mask_.set_bit (handle); this->wait_set_.wr_mask_.set_bit (handle); this->wait_set_.ex_mask_.set_bit (handle); @@ -1455,7 +1455,7 @@ ACE_Reactor::suspend_i (ACE_HANDLE handle) // Must be called with locks held int -ACE_Reactor::register_handler_i (ACE_HANDLE handle, +ACE_Reactor::register_handler_i (ACE_HANDLE handle, ACE_Event_Handler *event_handler, ACE_Reactor_Mask mask) { @@ -1467,7 +1467,7 @@ ACE_Reactor::register_handler_i (ACE_HANDLE handle, } int -ACE_Reactor::remove_handler_i (ACE_HANDLE handle, +ACE_Reactor::remove_handler_i (ACE_HANDLE handle, ACE_Reactor_Mask mask) { ACE_TRACE ("ACE_Reactor::remove_handler_i"); @@ -1478,7 +1478,7 @@ ACE_Reactor::remove_handler_i (ACE_HANDLE handle, // Must be called with lock held. -int +int ACE_Reactor::wait_for_multiple_events (ACE_Reactor_Handle_Set &dispatch_set, ACE_Time_Value *max_wait_time) { @@ -1500,19 +1500,19 @@ ACE_Reactor::wait_for_multiple_events (ACE_Reactor_Handle_Set &dispatch_set, this_timeout) == 0) { this_timeout = 0 ; } - + width = (u_long) this->handler_rep_.max_handlep1 (); dispatch_set.rd_mask_ = this->wait_set_.rd_mask_; dispatch_set.wr_mask_ = this->wait_set_.wr_mask_; dispatch_set.ex_mask_ = this->wait_set_.ex_mask_; - number_of_active_handles = ACE_OS::select (int (width), - dispatch_set.rd_mask_, - dispatch_set.wr_mask_, - dispatch_set.ex_mask_, + number_of_active_handles = ACE_OS::select (int (width), + dispatch_set.rd_mask_, + dispatch_set.wr_mask_, + dispatch_set.ex_mask_, this_timeout); - } + } while (number_of_active_handles == -1 && this->handle_error () > 0); if (number_of_active_handles > 0) @@ -1527,7 +1527,7 @@ ACE_Reactor::wait_for_multiple_events (ACE_Reactor_Handle_Set &dispatch_set, } // Return the number of events to dispatch. - return number_of_active_handles; + return number_of_active_handles; } int @@ -1547,9 +1547,9 @@ ACE_Reactor::dispatch_notification_handlers (int &number_of_active_handles, // other threads are trying to update the ACE_Reactor's internal // tables. We'll handle all these threads and then break out to // continue the event loop. - - int number_dispatched = - this->notify_handler_.dispatch_notifications (number_of_active_handles, + + int number_dispatched = + this->notify_handler_.dispatch_notifications (number_of_active_handles, dispatch_set.rd_mask_); return this->state_changed_ ? -1 : number_dispatched; #else @@ -1582,9 +1582,9 @@ ACE_Reactor::dispatch_io_handlers (int &number_of_active_handles, number_dispatched++; this->notify_handle (handle, ACE_Event_Handler::WRITE_MASK, - this->ready_set_.wr_mask_, + this->ready_set_.wr_mask_, this->handler_rep_.find (handle), - &ACE_Event_Handler::handle_output); + &ACE_Event_Handler::handle_output); } } @@ -1605,15 +1605,15 @@ ACE_Reactor::dispatch_io_handlers (int &number_of_active_handles, ACE_Handle_Set_Iterator handle_iter_ex (dispatch_set.ex_mask_); - while ((handle = handle_iter_ex ()) != ACE_INVALID_HANDLE + while ((handle = handle_iter_ex ()) != ACE_INVALID_HANDLE && number_dispatched < number_of_active_handles && this->state_changed_ == 0) { this->notify_handle (handle, ACE_Event_Handler::EXCEPT_MASK, - this->ready_set_.ex_mask_, + this->ready_set_.ex_mask_, this->handler_rep_.find (handle), - &ACE_Event_Handler::handle_exception); + &ACE_Event_Handler::handle_exception); number_dispatched++; } } @@ -1635,15 +1635,15 @@ ACE_Reactor::dispatch_io_handlers (int &number_of_active_handles, ACE_Handle_Set_Iterator handle_iter_rd (dispatch_set.rd_mask_); - while ((handle = handle_iter_rd ()) != ACE_INVALID_HANDLE + while ((handle = handle_iter_rd ()) != ACE_INVALID_HANDLE && number_dispatched < number_of_active_handles && this->state_changed_ == 0) { this->notify_handle (handle, ACE_Event_Handler::READ_MASK, - this->ready_set_.rd_mask_, + this->ready_set_.rd_mask_, this->handler_rep_.find (handle), - &ACE_Event_Handler::handle_input); + &ACE_Event_Handler::handle_input); number_dispatched++; } } @@ -1660,7 +1660,7 @@ ACE_Reactor::dispatch_io_handlers (int &number_of_active_handles, } int -ACE_Reactor::dispatch (int number_of_active_handles, +ACE_Reactor::dispatch (int number_of_active_handles, ACE_Reactor_Handle_Set &dispatch_set) { ACE_TRACE ("ACE_Reactor::dispatch"); @@ -1694,14 +1694,14 @@ ACE_Reactor::dispatch (int number_of_active_handles, if (this->dispatch_timer_handlers () == -1) // State has changed or timer queue has failed, exit inner // loop. - break; + break; else if (number_of_active_handles <= 0) // Bail out since we got here since select() was interrupted. { if (ACE_Sig_Handler::sig_pending () != 0) { ACE_Sig_Handler::sig_pending (0); - + // If any HANDLES in the <ready_set_> are activated as a // result of signals they should be dispatched since // they may be time critical... @@ -1710,13 +1710,13 @@ ACE_Reactor::dispatch (int number_of_active_handles, else return number_of_active_handles; } - else if (this->dispatch_notification_handlers + else if (this->dispatch_notification_handlers (number_of_active_handles, dispatch_set) == -1) break; // State has changed, exit inner loop. - else if (this->dispatch_io_handlers + else if (this->dispatch_io_handlers (number_of_active_handles, dispatch_set) == -1) // State has changed, so exit the inner loop. - break; + break; } while (number_of_active_handles > 0); @@ -1735,7 +1735,7 @@ ACE_Reactor::release_token (void) #endif /* ACE_WIN32 */ } -int +int ACE_Reactor::handle_events (ACE_Time_Value *max_wait_time) { ACE_TRACE ("ACE_Reactor::handle_events"); @@ -1758,7 +1758,7 @@ ACE_Reactor::handle_events (ACE_Time_Value *max_wait_time) return this->handle_events_i (max_wait_time); } -int +int ACE_Reactor::handle_events_i (ACE_Time_Value *max_wait_time) { int result; @@ -1766,9 +1766,9 @@ ACE_Reactor::handle_events_i (ACE_Time_Value *max_wait_time) ACE_SEH_TRY { ACE_Reactor_Handle_Set dispatch_set; - int number_of_active_handles = - this->wait_for_multiple_events (dispatch_set, - max_wait_time); + int number_of_active_handles = + this->wait_for_multiple_events (dispatch_set, + max_wait_time); result = this->dispatch (number_of_active_handles, dispatch_set); } @@ -1805,12 +1805,12 @@ ACE_Reactor::check_handles (void) rd_mask.set_bit (handle); - if (ACE_OS::select (int (handle) + 1, - rd_mask, 0, 0, + if (ACE_OS::select (int (handle) + 1, + rd_mask, 0, 0, &time_poll) < 0) { result = 1; - this->remove_handler_i (handle, + this->remove_handler_i (handle, ACE_Event_Handler::ALL_EVENTS_MASK); } rd_mask.clr_bit (handle); @@ -1829,8 +1829,8 @@ ACE_Reactor::dump (void) const this->timer_queue_->dump (); this->handler_rep_.dump (); this->signal_handler_->dump (); - ACE_DEBUG ((LM_DEBUG, - "delete_signal_handler_ = %d\n", + ACE_DEBUG ((LM_DEBUG, + "delete_signal_handler_ = %d\n", this->delete_signal_handler_)); ACE_HANDLE h; @@ -1875,10 +1875,16 @@ ACE_Reactor::dump (void) const this->token_.dump (); #endif /* ACE_MT_SAFE */ - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); } -#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) ACE_MT (template class ACE_Guard<ACE_REACTOR_MUTEX>); template class ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>; -#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) +#pragma instantiate ACE_Guard<ACE_REACTOR_MUTEX> +#endif /* ACE_MT_SAFE */ +#pragma instantiate ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + diff --git a/ace/Remote_Tokens.cpp b/ace/Remote_Tokens.cpp index 1165136669b..fbc37ae5165 100644 --- a/ace/Remote_Tokens.cpp +++ b/ace/Remote_Tokens.cpp @@ -16,7 +16,7 @@ typedef ACE_Null_Mutex ACE_TSS_CONNECTION_MUTEX; #endif /* ACE_MT_SAFE */ // Make a typedef to simplify access to the Singleton below. -typedef ACE_Singleton<ACE_TSS_Connection, ACE_TSS_CONNECTION_MUTEX> +typedef ACE_Singleton<ACE_TSS_Connection, ACE_TSS_CONNECTION_MUTEX> ACE_Token_Connections; // Initialize the statics from ACE_TSS_Connection; @@ -24,7 +24,7 @@ ACE_INET_Addr ACE_TSS_Connection::server_address_; // ************************************************************ -void +void ACE_TSS_Connection::set_server_address (const ACE_INET_Addr &server_address) { ACE_TRACE ("ACE_TSS_Connection::set_server_address"); @@ -85,7 +85,7 @@ ACE_TSS_Connection::dump (void) const server_address_.dump (); ACE_DEBUG ((LM_DEBUG, "base:\n")); ACE_TSS<ACE_SOCK_Stream>::dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); } // ************************************************************ @@ -119,7 +119,7 @@ ACE_Remote_Token_Proxy::set_server_address (const ACE_INET_Addr &server_address) ACE_Token_Connections::instance ()->set_server_address (server_address); } -int +int ACE_Remote_Token_Proxy::initiate_connection (void) { ACE_TRACE ("ACE_Remote_Token_Proxy::initiate_connection"); @@ -144,7 +144,7 @@ ACE_Remote_Token_Proxy::request_reply (ACE_Token_Request &request, ssize_t length; if ((length = request.encode (buffer)) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "encode failed"), -1); + ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "encode failed"), -1); ACE_SOCK_Stream *peer = ACE_Token_Connections::instance ()->get_connection (); @@ -158,7 +158,7 @@ ACE_Remote_Token_Proxy::request_reply (ACE_Token_Request &request, else { ACE_Token_Reply reply; - + // Receive reply via blocking read. if (peer->recv (&reply, sizeof reply) == -1) @@ -175,7 +175,7 @@ ACE_Remote_Token_Proxy::request_reply (ACE_Token_Request &request, } } -int +int ACE_Remote_Token_Proxy::acquire (int notify, void (*sleep_hook)(void *), ACE_Synch_Options &options) @@ -183,8 +183,8 @@ ACE_Remote_Token_Proxy::acquire (int notify, ACE_TRACE ("ACE_Remote_Token_Proxy::acquire"); // First grab the local shadow mutex. - if (ACE_Token_Proxy::acquire (notify, - sleep_hook, + if (ACE_Token_Proxy::acquire (notify, + sleep_hook, ACE_Synch_Options::asynch) == -1) { // Acquire failed, deal with it... @@ -211,9 +211,9 @@ ACE_Remote_Token_Proxy::acquire (int notify, } default : - ACE_ERROR_RETURN ((LM_ERROR, + ACE_ERROR_RETURN ((LM_ERROR, "(%t) %p shadow acquire failed\n", - "ACE_Remote_Token_Proxy"), + "ACE_Remote_Token_Proxy"), -1); } } @@ -222,7 +222,7 @@ ACE_Remote_Token_Proxy::acquire (int notify, this->type (), ACE_Token_Request::ACQUIRE, this->name (), - this->client_id (), + this->client_id (), options); request.notify (notify); @@ -249,7 +249,7 @@ ACE_Remote_Token_Proxy::acquire (int notify, return result; } -int +int ACE_Remote_Token_Proxy::tryacquire (void (*sleep_hook)(void *)) { ACE_TRACE ("ACE_Remote_Token_Proxy::tryacquire"); @@ -270,12 +270,12 @@ ACE_Remote_Token_Proxy::tryacquire (void (*sleep_hook)(void *)) ACE_Token_Request request (token_->type (), this->type (), - ACE_Token_Request::RELEASE, + ACE_Token_Request::RELEASE, this->name (), this->client_id (), ACE_Synch_Options::synch); - return this->request_reply (request, + return this->request_reply (request, ACE_Synch_Options::synch); } @@ -285,23 +285,23 @@ ACE_Remote_Token_Proxy::renew (int requeue_position, { ACE_TRACE ("ACE_Remote_Token_Proxy::renew"); - if (ACE_Token_Proxy::renew (requeue_position, + if (ACE_Token_Proxy::renew (requeue_position, ACE_Synch_Options::asynch) == -1) { // Check for error. if (errno != EWOULDBLOCK) return -1; else if (debug_) - ACE_DEBUG ((LM_DEBUG, + ACE_DEBUG ((LM_DEBUG, "(%t) shadow: renew would block. owner %s.\n", this->token_->owner_id ())); } ACE_Token_Request request (token_->type (), this->type (), - ACE_Token_Request::RENEW, + ACE_Token_Request::RENEW, this->name (), - this->client_id (), + this->client_id (), options); request.requeue_position (requeue_position); @@ -333,9 +333,9 @@ ACE_Remote_Token_Proxy::release (ACE_Synch_Options &options) ACE_Token_Request request (token_->type (), this->type (), - ACE_Token_Request::RELEASE, + ACE_Token_Request::RELEASE, this->name (), - this->client_id (), + this->client_id (), options); int result = this->request_reply (request, options); @@ -351,7 +351,7 @@ ACE_Remote_Token_Proxy::release (ACE_Synch_Options &options) return result; } -int +int ACE_Remote_Token_Proxy::remove (ACE_Synch_Options &) { ACE_TRACE ("ACE_Remote_Token_Proxy::remove"); @@ -383,11 +383,11 @@ ACE_Remote_Token_Proxy::dump (void) const ACE_TRACE ("ACE_Remote_Token_Proxy::owner_id"); ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); ACE_DEBUG ((LM_DEBUG, "ACE_Tokens::dump:\n" - " ignore_shadow_deadlock_ = %d\n", + " ignore_shadow_deadlock_ = %d\n", ignore_shadow_deadlock_)); ACE_DEBUG ((LM_DEBUG, "base:\n")); ACE_Token_Proxy::dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); } // ************************************************************ @@ -402,7 +402,7 @@ ACE_Remote_Mutex::dump (void) const ACE_DEBUG ((LM_DEBUG, "ACE_Remote_Mutex::dump:\n")); ACE_DEBUG ((LM_DEBUG, "base:\n")); ACE_Remote_Token_Proxy::dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); } // ************************************************************ @@ -417,7 +417,7 @@ ACE_Remote_RLock::dump (void) const ACE_DEBUG ((LM_DEBUG, "ACE_Remote_RLock::dump:\n")); ACE_DEBUG ((LM_DEBUG, "base:\n")); ACE_Remote_Token_Proxy::dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); } // ************************************************************ @@ -432,11 +432,15 @@ ACE_Remote_WLock::dump (void) const ACE_DEBUG ((LM_DEBUG, "ACE_Remote_WLock::dump:\n")); ACE_DEBUG ((LM_DEBUG, "base:\n")); ACE_Remote_Token_Proxy::dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); } -#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_TSS <ACE_SOCK_Stream>; template class ACE_Singleton <ACE_TSS_Connection, ACE_TSS_CONNECTION_MUTEX>; -#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#pragma instantiate ACE_TSS <ACE_SOCK_Stream> +#pragma instantiate ACE_Singleton <ACE_TSS_Connection, ACE_TSS_CONNECTION_MUTEX> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + diff --git a/ace/Service_Config.cpp b/ace/Service_Config.cpp index 4e9429b6a11..9958af3ee82 100644 --- a/ace/Service_Config.cpp +++ b/ace/Service_Config.cpp @@ -46,7 +46,7 @@ ACE_Sig_Adapter ACE_Service_Config::signal_handler_ (&ACE_Service_Config::handle // Trigger a reconfiguration. sig_atomic_t ACE_Service_Config::reconfig_occurred_ = 0; - // = Set by command-line options. + // = Set by command-line options. char ACE_Service_Config::debug_ = 0; char ACE_Service_Config::be_a_daemon_ = 0; char ACE_Service_Config::no_static_svcs_ = 0; @@ -54,7 +54,7 @@ char ACE_Service_Config::no_static_svcs_ = 0; // Number of the signal used to trigger reconfiguration. int ACE_Service_Config::signum_ = SIGHUP; -// Name of the service configuration file. +// Name of the service configuration file. const char *ACE_Service_Config::service_config_file_ = ACE_DEFAULT_SVC_CONF; // Name of file used to store messages. @@ -189,7 +189,7 @@ ACE_Service_Config::suspend (const char svc_name[]) } // Resume a SVC_NAME that was previously suspended or has not yet -// been resumed (e.g., a static service). +// been resumed (e.g., a static service). int ACE_Service_Config::resume (const char svc_name[]) @@ -201,10 +201,10 @@ ACE_Service_Config::resume (const char svc_name[]) // Initialize the Service Repository. Note that this *must* // be performed in the constructor (rather than open()) since // otherwise the repository will not be properly initialized -// to allow static configuration of services... +// to allow static configuration of services... -ACE_Service_Config::ACE_Service_Config (int ignore_static_svcs, - size_t size, +ACE_Service_Config::ACE_Service_Config (int ignore_static_svcs, + size_t size, int signum) { ACE_TRACE ("ACE_Service_Config::ACE_Service_Config"); @@ -223,7 +223,7 @@ ACE_Service_Config::ACE_Service_Config (int ignore_static_svcs, #if !defined (ACE_LACKS_UNIX_SIGNALS) // This really ought to be a Singleton I suspect... - if (ACE_Reactor::instance ()->register_handler (ACE_Service_Config::signum_, + if (ACE_Reactor::instance ()->register_handler (ACE_Service_Config::signum_, &ACE_Service_Config::signal_handler_) == -1) ACE_ERROR ((LM_ERROR, "can't register signal handler\n")); #endif /* ACE_LACKS_UNIX_SIGNALS */ @@ -244,7 +244,7 @@ ACE_Service_Config::parse_args (int argc, char *argv[]) case 'b': ACE_Service_Config::be_a_daemon_ = 1; break; - case 'd': + case 'd': ACE_Service_Config::debug_ = 1; break; case 'f': @@ -260,8 +260,8 @@ ACE_Service_Config::parse_args (int argc, char *argv[]) #if !defined (ACE_LACKS_UNIX_SIGNALS) ACE_Service_Config::signum_ = ACE_OS::atoi (getopt.optarg); - if (ACE_Reactor::instance()->register_handler - (ACE_Service_Config::signum_, + if (ACE_Reactor::instance()->register_handler + (ACE_Service_Config::signum_, &ACE_Service_Config::signal_handler_) == -1) ACE_ERROR ((LM_ERROR, "cannot obtain signal handler\n")); #endif /* ACE_LACKS_UNIX_SIGNALS */ @@ -273,10 +273,10 @@ ACE_Service_Config::parse_args (int argc, char *argv[]) } } -// Initialize and activate a statically linked service. +// Initialize and activate a statically linked service. int -ACE_Service_Config::initialize (const char svc_name[], +ACE_Service_Config::initialize (const char svc_name[], char *parameters) { ACE_TRACE ("ACE_Service_Config::initialize"); @@ -285,12 +285,12 @@ ACE_Service_Config::initialize (const char svc_name[], ACE_DEBUG ((LM_DEBUG, "opening static service %s\n", svc_name)); - if (ACE_Service_Repository::instance()->find (svc_name, + if (ACE_Service_Repository::instance()->find (svc_name, (const ACE_Service_Record **) &srp) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%s not found\n", svc_name), -1); + ACE_ERROR_RETURN ((LM_ERROR, "%s not found\n", svc_name), -1); else if (srp->type ()->init (args.argc (), args.argv ()) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "static initialization failed, %p\n", + ACE_ERROR_RETURN ((LM_ERROR, "static initialization failed, %p\n", svc_name), -1); else { @@ -315,7 +315,7 @@ ACE_Service_Config::initialize (const ACE_Service_Record *sr, ACE_ERROR_RETURN ((LM_ERROR, "insertion failed, %p\n", sr->name ()), -1); else if (sr->type ()->init (args.argc (), args.argv ()) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "dynamic initialization failed for %s\n", + ACE_ERROR_RETURN ((LM_ERROR, "dynamic initialization failed for %s\n", sr->name ()), -1); else return 0; @@ -324,7 +324,7 @@ ACE_Service_Config::initialize (const ACE_Service_Record *sr, // Process service configuration requests as indicated in the // <service_config_file>. -int +int ACE_Service_Config::process_directives (void) { ACE_TRACE ("ACE_Service_Config::process_directives"); @@ -342,7 +342,7 @@ ACE_Service_Config::process_directives (void) ace_yyerrno = 0; ace_yylineno = 1; - + // Use an auto_ptr to make sure that we release this memory // regardless of how we exit... ACE_NEW_RETURN (ace_obstack, ACE_Obstack, -1); @@ -353,7 +353,7 @@ ACE_Service_Config::process_directives (void) if (ace_yyerrno > 0) { - errno = EINVAL; // This is a hack, better errors should be provided... + errno = EINVAL; // This is a hack, better errors should be provided... return ace_yyerrno; } else @@ -378,17 +378,17 @@ ACE_Service_Config::load_static_svcs (void) { ACE_Static_Svc_Descriptor *ssd = *ssdp; - ACE_Service_Type *stp = - ace_create_service_type (ssd->name_, - ssd->type_, - (const void *) (*ssd->alloc_)(), + ACE_Service_Type *stp = + ace_create_service_type (ssd->name_, + ssd->type_, + (const void *) (*ssd->alloc_)(), ssd->flags_); if (stp == 0) continue; ACE_Service_Record *sr; - ACE_NEW_RETURN (sr, ACE_Service_Record (ssd->name_, stp, + ACE_NEW_RETURN (sr, ACE_Service_Record (ssd->name_, stp, 0, ssd->active_), -1); if (ACE_Service_Repository::instance()->insert (sr) == -1) @@ -401,15 +401,15 @@ ACE_Service_Config::load_static_svcs (void) int ACE_Service_Config::open (const char program_name[]) -{ +{ ACE_TRACE ("ACE_Service_Config::open"); // Become a daemon before doing anything else. if (ACE_Service_Config::be_a_daemon_) - ACE_Service_Config::start_daemon (); + ACE_Service_Config::start_daemon (); // Only use STDERR if the users hasn't already set the flags. - if (ACE_LOG_MSG->open (program_name, + if (ACE_LOG_MSG->open (program_name, ACE_LOG_MSG->flags () ? ACE_LOG_MSG->flags () : (u_long) ACE_Log_Msg::STDERR, ACE_Service_Config::logger_key_) == -1) return -1; @@ -426,7 +426,7 @@ ACE_Service_Config::open (const char program_name[]) // Register ourselves to receive reconfiguration requests via // signals! - if (ACE_Service_Config::no_static_svcs_ == 0 + if (ACE_Service_Config::no_static_svcs_ == 0 && ACE_Service_Config::load_static_svcs () == -1) return -1; else @@ -437,10 +437,10 @@ ACE_Service_Config::ACE_Service_Config (const char program_name[]) { ACE_TRACE ("ACE_Service_Config::ACE_Service_Config"); - if (this->open (program_name) == -1 - && errno != ENOENT) + if (this->open (program_name) == -1 + && errno != ENOENT) // Only print out an error if it wasn't the svc.conf file that was - // missing. + // missing. ACE_ERROR ((LM_ERROR, "%p\n", program_name)); } @@ -452,8 +452,8 @@ ACE_Service_Config::handle_signal (int sig, siginfo_t *, ucontext_t *) ACE_TRACE ("ACE_Service_Config::handle_signal"); if (ACE_Service_Config::signum_ != sig) - ACE_ERROR ((LM_ERROR, - "error, signal %S does match %S\n", + ACE_ERROR ((LM_ERROR, + "error, signal %S does match %S\n", sig, ACE_Service_Config::signum_)); if (ACE_Service_Config::debug_) @@ -566,9 +566,9 @@ ACE_Service_Config::close_singletons (void) return 0; } -// Perform user-specified close activities and remove dynamic memory. +// Perform user-specified close activities and remove dynamic memory. + - ACE_Service_Config::~ACE_Service_Config (void) { ACE_TRACE ("ACE_Service_Config::~ACE_Service_Config"); @@ -664,7 +664,7 @@ ACE_Service_Config::start_daemon (void) return ACE::daemonize (); } -#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Node<ACE_Static_Svc_Descriptor *>; template class ACE_Unbounded_Set<ACE_Static_Svc_Descriptor *>; template class ACE_Unbounded_Set_Iterator<ACE_Static_Svc_Descriptor *>; @@ -672,4 +672,13 @@ template class ACE_Malloc<ACE_LOCAL_MEMORY_POOL, ACE_Null_Mutex>; template class ACE_Allocator_Adapter<ACE_Malloc<ACE_LOCAL_MEMORY_POOL, ACE_Null_Mutex> >; template class auto_ptr<ACE_Obstack>; template class auto_basic_ptr<ACE_Obstack>; -#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#pragma instantiate ACE_Node<ACE_Static_Svc_Descriptor *> +#pragma instantiate ACE_Unbounded_Set<ACE_Static_Svc_Descriptor *> +#pragma instantiate ACE_Unbounded_Set_Iterator<ACE_Static_Svc_Descriptor *> +#pragma instantiate ACE_Malloc<ACE_LOCAL_MEMORY_POOL, ACE_Null_Mutex> +#pragma instantiate ACE_Allocator_Adapter<ACE_Malloc<ACE_LOCAL_MEMORY_POOL, ACE_Null_Mutex> > +#pragma instantiate auto_ptr<ACE_Obstack> +#pragma instantiate auto_basic_ptr<ACE_Obstack> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + diff --git a/ace/Service_Record.cpp b/ace/Service_Record.cpp index a2534c7a6a4..d6bd5b0e453 100644 --- a/ace/Service_Record.cpp +++ b/ace/Service_Record.cpp @@ -8,8 +8,8 @@ #include "ace/Service_Record.i" #endif /* __ACE_INLINE__ */ -ACE_Service_Object_Type::ACE_Service_Object_Type (ACE_Service_Object *so, - const char *s_name, +ACE_Service_Object_Type::ACE_Service_Object_Type (ACE_Service_Object *so, + const char *s_name, unsigned int f) : ACE_Service_Type ((const void *) so, s_name, f) { @@ -37,8 +37,8 @@ ACE_Module_Type::dump (void) const ACE_TRACE ("ACE_Module_Type::dump"); } -ACE_Module_Type::ACE_Module_Type (MT_Module *m, - const char *m_name, +ACE_Module_Type::ACE_Module_Type (MT_Module *m, + const char *m_name, u_int f) : ACE_Service_Type ((const void *) m, m_name, f) { @@ -114,7 +114,7 @@ ACE_Module_Type::fini (void) const // Close the module and delete the memory. mod->close (MT_Module::M_DELETE); - return ACE_Service_Type::fini (); + return ACE_Service_Type::fini (); } int @@ -181,10 +181,10 @@ ACE_Stream_Type::resume (void) const return 0; } -ACE_Stream_Type::ACE_Stream_Type (MT_Stream *s, - const char *s_name, +ACE_Stream_Type::ACE_Stream_Type (MT_Stream *s, + const char *s_name, unsigned int f) - : ACE_Service_Type ((const void *) s, s_name, f), + : ACE_Service_Type ((const void *) s, s_name, f), head_ (0) { ACE_TRACE ("ACE_Stream_Type::ACE_Stream_Type"); @@ -249,16 +249,16 @@ ACE_Stream_Type::remove (ACE_Module_Type *mod) { if (prev == 0) this->head_ = next; - else + else prev->link (next); // Final arg is an indication to *not* delete the Module. if (str->remove (m->name (), MT_Module::M_DELETE_NONE) == -1) - result = -1; + result = -1; // This call may end up deleting m, which is ok since we // don't access it again! - m->fini (); + m->fini (); } else prev = m; @@ -287,8 +287,8 @@ ACE_Stream_Type::find (const char *mod_name) const { ACE_TRACE ("ACE_Stream_Type::find"); - for (ACE_Module_Type *m = this->head_; - m != 0; + for (ACE_Module_Type *m = this->head_; + m != 0; m = m->link ()) if (ACE_OS::strcmp (m->name (), mod_name) == 0) return m; @@ -304,13 +304,13 @@ ACE_Service_Record::dump (void) const ACE_TRACE ("ACE_Service_Record::dump"); } -ACE_Service_Record::ACE_Service_Record (const char *n, - ACE_Service_Type *t, - const ACE_SHLIB_HANDLE h, +ACE_Service_Record::ACE_Service_Record (const char *n, + ACE_Service_Type *t, + const ACE_SHLIB_HANDLE h, int active) : name_ (0), - type_ (t), - handle_ (h), + type_ (t), + handle_ (h), active_ (active) { ACE_TRACE ("ACE_Service_Record::ACE_Service_Record"); @@ -326,7 +326,7 @@ ACE_Service_Record::~ACE_Service_Record (void) delete [] (char *) this->name_; } -void +void ACE_Service_Record::suspend (void) const { ACE_TRACE ("ACE_Service_Record::suspend"); @@ -334,7 +334,7 @@ ACE_Service_Record::suspend (void) const this->type_->suspend (); } -void +void ACE_Service_Record::resume (void) const { ACE_TRACE ("ACE_Service_Record::resume"); @@ -353,7 +353,7 @@ ACE_Service_Object_Type::fini (void) const return ACE_Service_Type::fini (); } -#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Message_Queue<ACE_SYNCH>; template class ACE_Module<ACE_SYNCH>; template class ACE_Stream<ACE_SYNCH>; @@ -369,4 +369,21 @@ template class ACE_Thru_Task<ACE_SYNCH>; template class ACE_Task<ACE_NULL_SYNCH>; template class ACE_Thru_Task<ACE_NULL_SYNCH>; #endif /* ACE_HAS_THREADS */ -#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#pragma instantiate ACE_Message_Queue<ACE_SYNCH> +#pragma instantiate ACE_Module<ACE_SYNCH> +#pragma instantiate ACE_Stream<ACE_SYNCH> +#pragma instantiate ACE_Stream_Head<ACE_SYNCH> +#pragma instantiate ACE_Stream_Tail<ACE_SYNCH> +#pragma instantiate ACE_Task<ACE_SYNCH> +#pragma instantiate ACE_Thru_Task<ACE_SYNCH> + +// Even with threads, these ACE_NULL_SYNCH specializations are necessary. +#if defined (ACE_HAS_THREADS) + #pragma instantiate ACE_Message_Queue<ACE_NULL_SYNCH> + #pragma instantiate ACE_Module<ACE_NULL_SYNCH> + #pragma instantiate ACE_Task<ACE_NULL_SYNCH> + #pragma instantiate ACE_Thru_Task<ACE_NULL_SYNCH> +#endif /* ACE_HAS_THREADS */ +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + diff --git a/ace/Signal.cpp b/ace/Signal.cpp index ad96314cc5a..b1b7a2315d8 100644 --- a/ace/Signal.cpp +++ b/ace/Signal.cpp @@ -12,7 +12,7 @@ // Static definitions. #if defined (ACE_HAS_SIG_C_FUNC) -extern "C" void +extern "C" void ace_sig_handler_dispatch (int signum, siginfo_t *info, ucontext_t *context) { ACE_TRACE ("ace_signal_handler_dispatch"); @@ -22,7 +22,7 @@ ace_sig_handler_dispatch (int signum, siginfo_t *info, ucontext_t *context) static ACE_SignalHandler ace_signal_handler_dispatcher = ACE_SignalHandler (ace_sig_handler_dispatch); #if !defined (ACE_HAS_BROKEN_HPUX_TEMPLATES) -extern "C" void +extern "C" void ace_sig_handlers_dispatch (int signum, siginfo_t *info, ucontext_t *context) { ACE_TRACE ("ace_signal_handlers_dispatch"); @@ -100,9 +100,9 @@ ACE_Sig_Action::ACE_Sig_Action (ACE_SignalHandler sig_handler, else this->sa_.sa_mask = *sig_mask; // Structure assignment... -#if !defined(ACE_HAS_TANDEM_SIGNALS) +#if !defined(ACE_HAS_TANDEM_SIGNALS) this->sa_.sa_handler = ACE_SignalHandlerV (sig_handler); -#else +#else this->sa_.sa_handler = (void (*)()) ACE_SignalHandlerV (sig_handler); #endif /* !ACE_HAS_TANDEM_SIGNALS */ } @@ -120,9 +120,9 @@ ACE_Sig_Action::ACE_Sig_Action (ACE_SignalHandler sig_handler, else this->sa_.sa_mask = *sig_mask; // Structure assignment... -#if !defined(ACE_HAS_TANDEM_SIGNALS) +#if !defined(ACE_HAS_TANDEM_SIGNALS) this->sa_.sa_handler = ACE_SignalHandlerV (sig_handler); -#else +#else this->sa_.sa_handler = (void (*)()) ACE_SignalHandlerV (sig_handler); #endif /* !ACE_HAS_TANDEM_SIGNALS */ ACE_OS::sigaction (signum, &this->sa_, 0); @@ -144,7 +144,7 @@ ACE_Sig_Handler::sig_pending (void) return ACE_Sig_Handler::sig_pending_; } -void +void ACE_Sig_Handler::sig_pending (sig_atomic_t pending) { ACE_TRACE ("ACE_Sig_Handler::sig_pending"); @@ -172,9 +172,9 @@ ACE_Sig_Handler::handler (int signum, ACE_Event_Handler *new_sh) if (ACE_Sig_Handler::in_range (signum)) { - ACE_Event_Handler *sh = ACE_Sig_Handler::signal_handlers_[signum]; + ACE_Event_Handler *sh = ACE_Sig_Handler::signal_handlers_[signum]; - ACE_Sig_Handler::signal_handlers_[signum] = new_sh; + ACE_Sig_Handler::signal_handlers_[signum] = new_sh; return sh; } else @@ -184,9 +184,9 @@ ACE_Sig_Handler::handler (int signum, ACE_Event_Handler *new_sh) // Register an ACE_Event_Handler along with the corresponding SIGNUM. int -ACE_Sig_Handler::register_handler (int signum, - ACE_Event_Handler *new_sh, - ACE_Sig_Action *new_disp, +ACE_Sig_Handler::register_handler (int signum, + ACE_Event_Handler *new_sh, + ACE_Sig_Action *new_disp, ACE_Event_Handler **old_sh, ACE_Sig_Action *old_disp) { @@ -196,18 +196,18 @@ ACE_Sig_Handler::register_handler (int signum, if (ACE_Sig_Handler::in_range (signum)) { ACE_Sig_Action sa; // Define a "null" action. - ACE_Event_Handler *sh = this->handler (signum, new_sh); + ACE_Event_Handler *sh = this->handler (signum, new_sh); // Stack the old ACE_Sig_Handler if the user gives us a pointer - // to a object. + // to a object. if (old_sh != 0) *old_sh = sh; // Make sure that new_disp points to a valid location if the - // user doesn't care... + // user doesn't care... if (new_disp == 0) new_disp = &sa; - + new_disp->handler (ace_signal_handler_dispatcher); new_disp->flags (new_disp->flags () | SA_SIGINFO); return new_disp->register_action (signum, old_disp); @@ -219,7 +219,7 @@ ACE_Sig_Handler::register_handler (int signum, // Remove an ACE_Event_Handler. int -ACE_Sig_Handler::remove_handler (int signum, +ACE_Sig_Handler::remove_handler (int signum, ACE_Sig_Action *new_disp, ACE_Sig_Action *old_disp, int) @@ -247,8 +247,8 @@ ACE_Sig_Handler::remove_handler (int signum, // dispatches one handler... void -ACE_Sig_Handler::dispatch (int signum, - siginfo_t *siginfo, +ACE_Sig_Handler::dispatch (int signum, + siginfo_t *siginfo, ucontext_t *ucontext) { ACE_TRACE ("ACE_Sig_Handler::dispatch"); @@ -262,12 +262,12 @@ ACE_Sig_Handler::dispatch (int signum, // Darn well better be in range since the OS dispatched this... ACE_ASSERT (ACE_Sig_Handler::in_range (signum)); - ACE_Event_Handler *eh = ACE_Sig_Handler::signal_handlers_[signum]; + ACE_Event_Handler *eh = ACE_Sig_Handler::signal_handlers_[signum]; if (eh != 0 && eh->handle_signal (signum, siginfo, ucontext) == -1) { // Define the default disposition. - ACE_Sig_Action sa (SIG_DFL); + ACE_Sig_Action sa (SIG_DFL); ACE_Sig_Handler::signal_handlers_[signum] = 0; @@ -314,8 +314,8 @@ ACE_Sig_Adapter::sigkey (void) } int -ACE_Sig_Adapter::handle_signal (int signum, - siginfo_t *siginfo, +ACE_Sig_Adapter::handle_signal (int signum, + siginfo_t *siginfo, ucontext_t *ucontext) { ACE_TRACE ("ACE_Sig_Adapter::handle_signal"); @@ -364,20 +364,20 @@ ACE_Sig_Adapter::handle_signal (int signum, int ACE_Sig_Handlers::sigkey_ = 0; // If this is > 0 then a 3rd party library has registered a -// handler... +// handler... int ACE_Sig_Handlers::third_party_sig_handler_ = 0; // Make life easier by defining typedefs... -typedef ACE_Fixed_Set <ACE_Event_Handler *, ACE_MAX_SIGNAL_HANDLERS> +typedef ACE_Fixed_Set <ACE_Event_Handler *, ACE_MAX_SIGNAL_HANDLERS> ACE_SIG_HANDLERS_SET; -typedef ACE_Fixed_Set_Iterator <ACE_Event_Handler *, ACE_MAX_SIGNAL_HANDLERS> +typedef ACE_Fixed_Set_Iterator <ACE_Event_Handler *, ACE_MAX_SIGNAL_HANDLERS> ACE_SIG_HANDLERS_ITERATOR; class ACE_Sig_Handlers_Set { public: static ACE_SIG_HANDLERS_SET *instance (int signum); - + private: static ACE_SIG_HANDLERS_SET *sig_handlers_[NSIG]; }; @@ -410,9 +410,9 @@ ACE_Sig_Handlers::dump (void) const // (beckerd@erlh.siemens.de). int -ACE_Sig_Handlers::register_handler (int signum, - ACE_Event_Handler *new_sh, - ACE_Sig_Action *new_disp, +ACE_Sig_Handlers::register_handler (int signum, + ACE_Event_Handler *new_sh, + ACE_Sig_Action *new_disp, ACE_Event_Handler **, ACE_Sig_Action *old_disp) { @@ -423,7 +423,7 @@ ACE_Sig_Handlers::register_handler (int signum, { ACE_Sig_Adapter *ace_sig_adapter = 0; // Our signal handler. ACE_Sig_Adapter *extern_sh = 0; // An external signal handler. - ACE_Sig_Action sa; + ACE_Sig_Action sa; // Get current signal disposition. sa.retrieve_action (signum); @@ -444,7 +444,7 @@ ACE_Sig_Handlers::register_handler (int signum, && ACE_Sig_Handlers::third_party_sig_handler_) // Toggling is disallowed since we might break 3rd party // code. - return -1; + return -1; // Note that we've seen a 3rd party handler... ACE_Sig_Handlers::third_party_sig_handler_ = 1; @@ -528,7 +528,7 @@ ACE_Sig_Handlers::register_handler (int signum, // -1 if <signum> is invalid. int -ACE_Sig_Handlers::remove_handler (int signum, +ACE_Sig_Handlers::remove_handler (int signum, ACE_Sig_Action *new_disp, ACE_Sig_Action *old_disp, int sigkey) @@ -545,8 +545,8 @@ ACE_Sig_Handlers::remove_handler (int signum, // Iterate through the set of handlers for this signal. - for (ACE_Event_Handler **eh; - handler_iterator.next (eh) != 0; + for (ACE_Event_Handler **eh; + handler_iterator.next (eh) != 0; handler_iterator.advance ()) { // Type-safe downcast would be nice here... @@ -586,8 +586,8 @@ ACE_Sig_Handlers::remove_handler (int signum, // dispatches *all* the handlers... void -ACE_Sig_Handlers::dispatch (int signum, - siginfo_t *siginfo, +ACE_Sig_Handlers::dispatch (int signum, + siginfo_t *siginfo, ucontext_t *ucontext) { ACE_TRACE ("ACE_Sig_Handlers::dispatch"); @@ -607,7 +607,7 @@ ACE_Sig_Handlers::dispatch (int signum, ACE_SIG_HANDLERS_ITERATOR handler_iterator (*handler_set); for (ACE_Event_Handler **eh = 0; - handler_iterator.next (eh) != 0; + handler_iterator.next (eh) != 0; handler_iterator.advance ()) { if ((*eh)->handle_signal (signum, siginfo, ucontext) == -1) @@ -668,10 +668,18 @@ ACE_Sig_Handlers::handler (int signum, ACE_Event_Handler *new_sh) return *eh; } -#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) ACE_MT (template class ACE_TSS_Guard<ACE_Recursive_Thread_Mutex>); ACE_MT (template class ACE_Guard<ACE_Recursive_Thread_Mutex>); template class ACE_Fixed_Set<ACE_Event_Handler *, ACE_MAX_SIGNAL_HANDLERS>; template class ACE_Fixed_Set_Iterator<ACE_Event_Handler *, ACE_MAX_SIGNAL_HANDLERS>; -#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) +#pragma instantiate ACE_TSS_Guard<ACE_Recursive_Thread_Mutex> +#pragma instantiate ACE_Guard<ACE_Recursive_Thread_Mutex> +#endif /* ACE_MT_SAFE */ +#pragma instantiate ACE_Fixed_Set<ACE_Event_Handler *, ACE_MAX_SIGNAL_HANDLERS> +#pragma instantiate ACE_Fixed_Set_Iterator<ACE_Event_Handler *, ACE_MAX_SIGNAL_HANDLERS> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + #endif /* ACE_HAS_BROKEN_HPUX_TEMPLATES */ diff --git a/ace/Synch.cpp b/ace/Synch.cpp index 62cd07b8016..8401788fae4 100644 --- a/ace/Synch.cpp +++ b/ace/Synch.cpp @@ -44,9 +44,9 @@ ACE_TSS_C_cleanup (void *object) { ACE_TSS_Adapter *tss_adapter = (ACE_TSS_Adapter *) object; // Perform cleanup on the real TS object. - tss_adapter->cleanup (); + tss_adapter->cleanup (); // Delete the adapter object. - delete tss_adapter; + delete tss_adapter; } } @@ -86,35 +86,35 @@ ACE_Process_Mutex::~ACE_Process_Mutex (void) } // Explicitly destroy the mutex. -int +int ACE_Process_Mutex::remove (void) { return this->lock_->remove (); } // Acquire lock ownership (wait on priority queue if necessary). -int +int ACE_Process_Mutex::acquire (void) { return this->lock_->acquire (); } // Conditionally acquire lock (i.e., don't wait on queue). -int +int ACE_Process_Mutex::tryacquire (void) { return this->lock_->tryacquire (); } // Release lock and unblock a thread at head of priority queue. -int +int ACE_Process_Mutex::release (void) { return this->lock_->release (); } // Acquire lock ownership (wait on priority queue if necessary). -int +int ACE_Process_Mutex::acquire_read (void) { return this->lock_->acquire_read (); @@ -127,20 +127,20 @@ int ACE_Process_Mutex::acquire_write (void) } // Conditionally acquire a lock (i.e., won't block). -int +int ACE_Process_Mutex::tryacquire_read (void) { return this->lock_->tryacquire_read (); } // Conditionally acquire a lock (i.e., won't block). -int +int ACE_Process_Mutex::tryacquire_write (void) { return this->lock_->tryacquire_write (); } -ACE_RW_Process_Mutex::ACE_RW_Process_Mutex (LPCTSTR name, +ACE_RW_Process_Mutex::ACE_RW_Process_Mutex (LPCTSTR name, void *arg) : ACE_Process_Mutex (name, arg) { @@ -189,14 +189,14 @@ ACE_Semaphore::dump (void) const ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); } -ACE_Semaphore::ACE_Semaphore (u_int count, - int type, - LPCTSTR name, +ACE_Semaphore::ACE_Semaphore (u_int count, + int type, + LPCTSTR name, void *arg, int max) { // ACE_TRACE ("ACE_Semaphore::ACE_Semaphore"); - if (ACE_OS::sema_init (&this->semaphore_, count, type, + if (ACE_OS::sema_init (&this->semaphore_, count, type, name, arg, max) != 0) ACE_ERROR ((LM_ERROR, "%p\n", "ACE_Semaphore::ACE_Semaphore")); } @@ -225,8 +225,8 @@ ACE_File_Lock::ACE_File_Lock (ACE_HANDLE h) this->set_handle (h); } -ACE_File_Lock::ACE_File_Lock (LPCTSTR name, - int flags, +ACE_File_Lock::ACE_File_Lock (LPCTSTR name, + int flags, mode_t perms) { // ACE_TRACE ("ACE_File_Lock::ACE_File_Lock"); @@ -236,8 +236,8 @@ ACE_File_Lock::ACE_File_Lock (LPCTSTR name, } int -ACE_File_Lock::open (LPCTSTR name, - int flags, +ACE_File_Lock::open (LPCTSTR name, + int flags, mode_t perms) { // ACE_TRACE ("ACE_File_Lock::open"); @@ -260,8 +260,8 @@ ACE_Process_Semaphore::dump (void) const ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); } -ACE_Process_Semaphore::ACE_Process_Semaphore (u_int count, - LPCTSTR name, +ACE_Process_Semaphore::ACE_Process_Semaphore (u_int count, + LPCTSTR name, void *arg, int max) #if defined (ACE_WIN32) || defined (ACE_HAS_POSIX_SEM) @@ -284,7 +284,7 @@ ACE_Process_Semaphore::~ACE_Process_Semaphore (void) // Explicitly destroy the semaphore. -int +int ACE_Process_Semaphore::remove (void) { // ACE_TRACE ("ACE_Process_Semaphore::remove"); @@ -294,17 +294,17 @@ ACE_Process_Semaphore::remove (void) // Block the thread until the semaphore count becomes // greater than 0, then decrement it. -int +int ACE_Process_Semaphore::acquire (void) { // ACE_TRACE ("ACE_Process_Semaphore::acquire"); return this->lock_.acquire (); } -// Conditionally decrement the semaphore if count is greater +// Conditionally decrement the semaphore if count is greater // than 0 (i.e., won't block). -int +int ACE_Process_Semaphore::tryacquire (void) { // ACE_TRACE ("ACE_Process_Semaphore::tryacquire"); @@ -314,7 +314,7 @@ ACE_Process_Semaphore::tryacquire (void) // Increment the semaphore, potentially unblocking // a waiting thread. -int +int ACE_Process_Semaphore::release (void) { // ACE_TRACE ("ACE_Process_Semaphore::release"); @@ -347,16 +347,16 @@ ACE_Mutex::~ACE_Mutex (void) this->remove (); } -ACE_Event::ACE_Event (int manual_reset, +ACE_Event::ACE_Event (int manual_reset, int initial_state, - int type, + int type, LPCTSTR name, void *arg) { if (ACE_OS::event_init (&this->handle_, - manual_reset, + manual_reset, initial_state, - type, + type, name, arg) != 0) ACE_ERROR ((LM_ERROR, "%p\n", "ACE_Event::ACE_Event")); @@ -367,50 +367,50 @@ ACE_Event::~ACE_Event (void) this->remove (); } -int +int ACE_Event::remove (void) { return ACE_OS::event_destroy (&this->handle_); } -ACE_event_t +ACE_event_t ACE_Event::handle (void) const { return this->handle_; } void -ACE_Event::handle (ACE_event_t new_handle) +ACE_Event::handle (ACE_event_t new_handle) { this->handle_ = new_handle; } -int +int ACE_Event::wait (void) { return ACE_OS::event_wait (&this->handle_); } -int +int ACE_Event::wait (const ACE_Time_Value *abstime) { return ACE_OS::event_timedwait (&this->handle_, (ACE_Time_Value *) abstime); } -int +int ACE_Event::signal (void) { return ACE_OS::event_signal (&this->handle_); } -int +int ACE_Event::pulse (void) { return ACE_OS::event_pulse (&this->handle_); } -int +int ACE_Event::reset (void) { return ACE_OS::event_reset (&this->handle_); @@ -424,12 +424,12 @@ ACE_Event::dump (void) const } ACE_Manual_Event::ACE_Manual_Event (int initial_state, - int type, + int type, LPCTSTR name, void *arg) : ACE_Event (1, initial_state, - type, + type, name, arg) { @@ -442,12 +442,12 @@ ACE_Manual_Event::dump (void) const } ACE_Auto_Event::ACE_Auto_Event (int initial_state, - int type, + int type, LPCTSTR name, void *arg) : ACE_Event (0, initial_state, - type, + type, name, arg) { @@ -472,8 +472,8 @@ ACE_Thread_Semaphore::dump (void) const ACE_Semaphore::dump (); } -ACE_Thread_Semaphore::ACE_Thread_Semaphore (u_int count, - LPCTSTR name, +ACE_Thread_Semaphore::ACE_Thread_Semaphore (u_int count, + LPCTSTR name, void *arg, int max) : ACE_Semaphore (count, USYNC_THREAD, name, arg, max) @@ -491,7 +491,7 @@ ACE_Thread_Mutex_Guard::dump (void) const ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); } -ACE_thread_t +ACE_thread_t ACE_Recursive_Thread_Mutex::get_thread_id (void) { // ACE_TRACE ("ACE_Recursive_Thread_Mutex::get_thread_id"); @@ -516,7 +516,7 @@ ACE_Recursive_Thread_Mutex::ACE_Recursive_Thread_Mutex (LPCTSTR name, void *arg) : nesting_mutex_ (name, arg), lock_available_ (nesting_mutex_, name, arg), - nesting_level_ (0), + nesting_level_ (0), owner_id_ (ACE_OS::NULL_thread) { #if defined (ACE_HAS_FSU_PTHREADS) @@ -541,11 +541,11 @@ ACE_Recursive_Thread_Mutex::acquire (void) // Acquire the guard. ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->nesting_mutex_, -1); - + // If there's no contention, just grab the lock immediately (since // this is the common case we'll optimize for it). if (this->nesting_level_ == 0) - this->set_thread_id (t_id); + this->set_thread_id (t_id); // If we already own the lock, then increment the nesting level and // return. else if (ACE_OS::thr_equal (t_id, this->owner_id_) == 0) @@ -556,7 +556,7 @@ ACE_Recursive_Thread_Mutex::acquire (void) this->lock_available_.wait (); // Note that at this point the nesting_mutex_ is held... - this->set_thread_id (t_id); + this->set_thread_id (t_id); } // At this point, we can safely increment the nesting_level_ no @@ -575,7 +575,7 @@ ACE_Recursive_Thread_Mutex::release (void) ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->nesting_mutex_, -1); #if !defined (ACE_NDEBUG) - if (this->nesting_level_ == 0 + if (this->nesting_level_ == 0 || ACE_OS::thr_equal (t_id, this->owner_id_) == 0) { errno = EINVAL; @@ -603,11 +603,11 @@ ACE_Recursive_Thread_Mutex::tryacquire (void) ACE_thread_t t_id = ACE_Thread::self (); ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->nesting_mutex_, -1); - + // If there's no contention, just grab the lock immediately. if (this->nesting_level_ == 0) { - this->set_thread_id (t_id); + this->set_thread_id (t_id); this->nesting_level_ = 1; } // If we already own the lock, then increment the nesting level and @@ -649,7 +649,7 @@ ACE_Condition_Thread_Mutex::dump (void) const ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); ACE_DEBUG ((LM_DEBUG, "\n")); #if defined (ACE_WIN32) - ACE_DEBUG ((LM_DEBUG, + ACE_DEBUG ((LM_DEBUG, "waiters = %d\n", this->cond_.waiters ())); #endif /* ACE_WIN32 */ @@ -670,7 +670,7 @@ ACE_Condition_Thread_Mutex::ACE_Condition_Thread_Mutex (const ACE_Thread_Mutex & // ACE_TRACE ("ACE_Condition_Thread_Mutex::ACE_Condition_Thread_Mutex"); if (ACE_OS::cond_init (&this->cond_, USYNC_THREAD, name, arg) != 0) - ACE_ERROR ((LM_ERROR, "%p\n", + ACE_ERROR ((LM_ERROR, "%p\n", "ACE_Condition_Thread_Mutex::ACE_Condition_Thread_Mutex")); } @@ -701,7 +701,7 @@ ACE_Condition_Thread_Mutex::wait (ACE_Thread_Mutex &mutex, if (abstime == 0) return ACE_OS::cond_wait (&this->cond_, &mutex_.lock_); else - return ACE_OS::cond_timedwait (&this->cond_, + return ACE_OS::cond_timedwait (&this->cond_, &mutex.lock_, (ACE_Time_Value *) abstime); } @@ -772,7 +772,7 @@ ACE_Barrier::dump (void) const ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); } -ACE_Barrier::ACE_Barrier (u_int count, +ACE_Barrier::ACE_Barrier (u_int count, LPCTSTR name, void *arg) : lock_ (name, arg), @@ -792,7 +792,7 @@ ACE_Barrier::wait (void) // ACE_TRACE ("ACE_Barrier::wait"); ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1); - ACE_Sub_Barrier *sbp = + ACE_Sub_Barrier *sbp = this->sub_barrier_[this->current_generation_]; // Check for shutdown... @@ -858,7 +858,7 @@ ACE_Process_Condition<MUTEX>::dump (void) const } template <class MUTEX> -ACE_Process_Condition<MUTEX>::ACE_Process_Condition (MUTEX &m, +ACE_Process_Condition<MUTEX>::ACE_Process_Condition (MUTEX &m, LPCTSTR name, void *arg) : ACE_Condition<MUTEX> (m, USYNC_PROCESS, name, arg) @@ -895,7 +895,7 @@ ACE_Thread_Mutex::ACE_Thread_Mutex (LPCTSTR name, void *arg) ACE_ALLOC_HOOK_DEFINE(ACE_RW_Thread_Mutex) -ACE_RW_Thread_Mutex::ACE_RW_Thread_Mutex (LPCTSTR name, +ACE_RW_Thread_Mutex::ACE_RW_Thread_Mutex (LPCTSTR name, void *arg) : ACE_RW_Mutex (USYNC_THREAD, name, arg) { @@ -913,7 +913,7 @@ ACE_RW_Thread_Mutex::dump (void) const #include "ace/Malloc.h" #if defined (ACE_HAS_SIG_C_FUNC) -extern "C" static void +extern "C" static void ace_static_object_lock_atexit (void) { ACE_Static_Object_Lock::atexit (); @@ -943,18 +943,30 @@ ACE_Static_Object_Lock::instance (void) return ACE_Static_Object_Lock::mutex_; } -#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) // These are only specialized with ACE_HAS_THREADS. template class ACE_Guard<ACE_SYNCH_RW_MUTEX>; template class ACE_Read_Guard<ACE_SYNCH_RW_MUTEX>; template class ACE_Write_Guard<ACE_SYNCH_RW_MUTEX>; -#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +// These are only specialized with ACE_HAS_THREADS. +#pragma instantiate ACE_Guard<ACE_SYNCH_RW_MUTEX> +#pragma instantiate ACE_Read_Guard<ACE_SYNCH_RW_MUTEX> +#pragma instantiate ACE_Write_Guard<ACE_SYNCH_RW_MUTEX> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + #endif /* ACE_HAS_THREADS */ -#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) // These are specialized both with and without ACE_HAS_THREADS. template class ACE_Guard<ACE_Null_Mutex>; template class ACE_Read_Guard<ACE_Null_Mutex>; template class ACE_Write_Guard<ACE_Null_Mutex>; -#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +// These are specialized both with and without ACE_HAS_THREADS. +#pragma instantiate ACE_Guard<ACE_Null_Mutex> +#pragma instantiate ACE_Read_Guard<ACE_Null_Mutex> +#pragma instantiate ACE_Write_Guard<ACE_Null_Mutex> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + #endif /* ACE_SYNCH_C */ diff --git a/ace/System_Time.cpp b/ace/System_Time.cpp index ac2a824b607..dc2389fb5d2 100644 --- a/ace/System_Time.cpp +++ b/ace/System_Time.cpp @@ -6,20 +6,20 @@ ACE_System_Time::ACE_System_Time (LPCTSTR poolname) : delta_time_ (0) -{ +{ ACE_TRACE ("ACE_System_Time::ACE_System_Time"); ACE_NEW (this->shmem_, ALLOCATOR (poolname)); } ACE_System_Time::~ACE_System_Time (void) -{ +{ delete this->shmem_; ACE_TRACE ("ACE_System_Time::~ACE_System_Time"); } // Get the local system time. -int +int ACE_System_Time::get_local_system_time (ACE_UINT32 &time_out) { ACE_TRACE ("ACE_System_Time::get_local_system_time"); @@ -27,7 +27,7 @@ ACE_System_Time::get_local_system_time (ACE_UINT32 &time_out) return 0; } -int +int ACE_System_Time::get_local_system_time (ACE_Time_Value &time_out) { ACE_TRACE ("ACE_System_Time::get_local_system_time"); @@ -37,7 +37,7 @@ ACE_System_Time::get_local_system_time (ACE_Time_Value &time_out) // Get the system time of the central time server. -int +int ACE_System_Time::get_master_system_time (ACE_UINT32 &time_out) { ACE_TRACE ("ACE_System_Time::get_master_system_time"); @@ -76,7 +76,7 @@ ACE_System_Time::get_master_system_time (ACE_UINT32 &time_out) return 0; } -int +int ACE_System_Time::get_master_system_time (ACE_Time_Value &time_out) { ACE_TRACE ("ACE_System_Time::get_master_system_time"); @@ -90,14 +90,18 @@ ACE_System_Time::get_master_system_time (ACE_Time_Value &time_out) // Synchronize local system time with the central time server using // specified mode (currently unimplemented). -int +int ACE_System_Time::sync_local_system_time (ACE_System_Time::Sync_Mode) { ACE_TRACE ("ACE_System_Time::sync_local_system_time"); ACE_NOTSUP_RETURN (-1); } -#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex>; template class ACE_Allocator_Adapter<ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex> >; -#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#pragma instantiate ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex> +#pragma instantiate ACE_Allocator_Adapter<ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex> > +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + diff --git a/ace/Task.cpp b/ace/Task.cpp index d0995abe77b..c4ab1a39048 100644 --- a/ace/Task.cpp +++ b/ace/Task.cpp @@ -10,12 +10,13 @@ #include "ace/Task.i" #endif /* __ACE_INLINE__ */ -#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) || defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #if (defined (ACE_HAS_THREADS) && defined (ACE_HAS_THREAD_SPECIFIC_STORAGE)) // For template specializations at end of this file. #include "ace/Dynamic.h" #endif /* ACE_HAS_THREADS && ACE_HAS_THREAD_SPECIFIC_STORAGE */ -#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ +#endif /* ACE_HAS_EXPLICT_TEMPLATE_INSTANTIATION */ + #if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) // Lock the creation of the Singleton. @@ -31,7 +32,7 @@ ACE_Task_Exit::instance (void) { ACE_TRACE ("ACE_Task_Exit::instance"); - // Determines if we were dynamically allocated. + // Determines if we were dynamically allocated. static ACE_TSS_TYPE (ACE_Task_Exit) *instance_; // Implement the Double Check pattern. @@ -54,7 +55,7 @@ ACE_Task_Exit::instance (void) // destructor. ACE_Task_Exit::ACE_Task_Exit (void) - : t_ (0), + : t_ (0), status_ ((void *) -1) { ACE_TRACE ("ACE_Task_Exit::ACE_Task_Exit"); @@ -125,7 +126,7 @@ ACE_Task_Base::ACE_Task_Base (ACE_Thread_Manager *thr_man) } // Wait for all threads running in a task to exit. -int +int ACE_Task_Base::wait (void) { ACE_TRACE ("ACE_Task_Base::wait"); @@ -138,7 +139,7 @@ ACE_Task_Base::wait (void) } // Suspend a task. -int +int ACE_Task_Base::suspend (void) { ACE_TRACE ("ACE_Task_Base::suspend"); @@ -150,7 +151,7 @@ ACE_Task_Base::suspend (void) } // Resume a suspended task. -int +int ACE_Task_Base::resume (void) { ACE_TRACE ("ACE_Task_Base::resume"); @@ -162,8 +163,8 @@ ACE_Task_Base::resume (void) } int -ACE_Task_Base::activate (long flags, - int n_threads, +ACE_Task_Base::activate (long flags, + int n_threads, int force_active, long priority, int grp_id, @@ -173,7 +174,7 @@ ACE_Task_Base::activate (long flags, #if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1); - + // If the task passed in is zero, we will use <this> if (task == 0) task = this; @@ -186,12 +187,12 @@ ACE_Task_Base::activate (long flags, // Use the ACE_Thread_Manager singleton if we're running as an // active object and the caller didn't supply us with a // Thread_Manager. - if (this->thr_mgr_ == 0) + if (this->thr_mgr_ == 0) this->thr_mgr_ = ACE_Thread_Manager::instance (); - this->grp_id_ = this->thr_mgr_->spawn_n (n_threads, + this->grp_id_ = this->thr_mgr_->spawn_n (n_threads, ACE_THR_FUNC (&ACE_Task_Base::svc_run), - (void *) this, + (void *) this, flags, priority, grp_id, @@ -280,16 +281,23 @@ ACE_Task_Base::svc_run (void *args) // Forward the call to close() so that existing applications don't // break. -int +int ACE_Task_Base::module_closed (void) { return this->close (1); } -#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) #if (defined (ACE_HAS_THREADS) && defined (ACE_HAS_THREAD_SPECIFIC_STORAGE)) template class ACE_TSS<ACE_Task_Exit>; // This doesn't necessarily belong here, but it's a convenient place for it. template class ACE_TSS<ACE_Dynamic>; #endif /* ACE_HAS_THREADS && ACE_HAS_THREAD_SPECIFIC_STORAGE */ -#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#if (defined (ACE_HAS_THREADS) && defined (ACE_HAS_THREAD_SPECIFIC_STORAGE)) + #pragma instantiate ACE_TSS<ACE_Task_Exit> + // This doesn't necessarily belong here, but it's a convenient place for it. + #pragma instantiate ACE_TSS<ACE_Dynamic> +#endif /* ACE_HAS_THREADS && ACE_HAS_THREAD_SPECIFIC_STORAGE */ +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + diff --git a/ace/Timer_Hash.cpp b/ace/Timer_Hash.cpp index 23e6d9082eb..6482e1051d7 100644 --- a/ace/Timer_Hash.cpp +++ b/ace/Timer_Hash.cpp @@ -10,11 +10,11 @@ #include "ace/config.h" #include "ace/Timer_Hash.h" -#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Free_List<ACE_Timer_Node_T<ACE_Event_Handler *> >; template class ACE_Locked_Free_List<ACE_Timer_Node_T<ACE_Event_Handler *>, ACE_Null_Mutex>; -template class ACE_Timer_Hash_Upcall <ACE_Event_Handler *, +template class ACE_Timer_Hash_Upcall <ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, ACE_SYNCH_RECURSIVE_MUTEX>; @@ -26,7 +26,7 @@ template class ACE_Timer_Queue_Iterator_T <ACE_Event_Handler *, ACE_Hash_Upcall, ACE_Null_Mutex>; -template class ACE_Timer_List_T <ACE_Event_Handler *, +template class ACE_Timer_List_T <ACE_Event_Handler *, ACE_Hash_Upcall, ACE_Null_Mutex>; @@ -34,7 +34,7 @@ template class ACE_Timer_List_Iterator_T <ACE_Event_Handler *, ACE_Hash_Upcall, ACE_Null_Mutex>; -template class ACE_Timer_Heap_T <ACE_Event_Handler *, +template class ACE_Timer_Heap_T <ACE_Event_Handler *, ACE_Hash_Upcall, ACE_Null_Mutex>; @@ -42,26 +42,79 @@ template class ACE_Timer_Heap_Iterator_T <ACE_Event_Handler *, ACE_Hash_Upcall, ACE_Null_Mutex>; -template class ACE_Timer_Hash_T<ACE_Event_Handler *, - ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, +template class ACE_Timer_Hash_T<ACE_Event_Handler *, + ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, ACE_SYNCH_RECURSIVE_MUTEX, ACE_Hash_Timer_List>; -template class ACE_Timer_Hash_Iterator_T<ACE_Event_Handler *, - ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, +template class ACE_Timer_Hash_Iterator_T<ACE_Event_Handler *, + ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, ACE_SYNCH_RECURSIVE_MUTEX, ACE_Hash_Timer_List>; -template class ACE_Timer_Hash_T<ACE_Event_Handler *, - ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, +template class ACE_Timer_Hash_T<ACE_Event_Handler *, + ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, ACE_SYNCH_RECURSIVE_MUTEX, ACE_Hash_Timer_Heap>; -template class ACE_Timer_Hash_Iterator_T<ACE_Event_Handler *, - ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, +template class ACE_Timer_Hash_Iterator_T<ACE_Event_Handler *, + ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, ACE_SYNCH_RECURSIVE_MUTEX, ACE_Hash_Timer_Heap>; -#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#pragma instantiate ACE_Free_List<ACE_Timer_Node_T<ACE_Event_Handler *> > +#pragma instantiate ACE_Locked_Free_List<ACE_Timer_Node_T<ACE_Event_Handler *>, \ + ACE_Null_Mutex> +#pragma instantiate ACE_Timer_Hash_Upcall <ACE_Event_Handler *, \ + ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, \ + ACE_SYNCH_RECURSIVE_MUTEX> + +#pragma instantiate ACE_Timer_Queue_T <ACE_Event_Handler *, \ + ACE_Hash_Upcall, \ + ACE_Null_Mutex> + +#pragma instantiate ACE_Timer_Queue_Iterator_T <ACE_Event_Handler *, \ + ACE_Hash_Upcall, \ + ACE_Null_Mutex> + +#pragma instantiate ACE_Timer_List_T <ACE_Event_Handler *, \ + ACE_Hash_Upcall, \ + ACE_Null_Mutex> + +#pragma instantiate ACE_Timer_List_Iterator_T <ACE_Event_Handler *, \ + ACE_Hash_Upcall, \ + ACE_Null_Mutex> + +#pragma instantiate ACE_Timer_Heap_T <ACE_Event_Handler *, \ + ACE_Hash_Upcall, \ + ACE_Null_Mutex> + +#pragma instantiate ACE_Timer_Heap_Iterator_T <ACE_Event_Handler *, \ + ACE_Hash_Upcall, \ + ACE_Null_Mutex> + +#pragma instantiate ACE_Timer_Hash_T<ACE_Event_Handler *, \ + ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, \ + ACE_SYNCH_RECURSIVE_MUTEX, \ + ACE_Hash_Timer_List> + +#pragma instantiate ACE_Timer_Hash_Iterator_T<ACE_Event_Handler *, \ + ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, \ + ACE_SYNCH_RECURSIVE_MUTEX, \ + ACE_Hash_Timer_List> + +#pragma instantiate ACE_Timer_Hash_T<ACE_Event_Handler *, \ + ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, \ + ACE_SYNCH_RECURSIVE_MUTEX, \ + ACE_Hash_Timer_Heap> + +#pragma instantiate ACE_Timer_Hash_Iterator_T<ACE_Event_Handler *, \ + ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, \ + ACE_SYNCH_RECURSIVE_MUTEX, \ + ACE_Hash_Timer_Heap> + +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + #endif /* ACE_TIMER_HASH_C */ diff --git a/ace/Timer_Heap.cpp b/ace/Timer_Heap.cpp index 9f3202c3d4d..7f18e85a699 100644 --- a/ace/Timer_Heap.cpp +++ b/ace/Timer_Heap.cpp @@ -8,9 +8,13 @@ #include "ace/config.h" #include "ace/Timer_Heap.h" -#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Timer_Heap_T<ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, ACE_SYNCH_RECURSIVE_MUTEX>; template class ACE_Timer_Heap_Iterator_T<ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, ACE_SYNCH_RECURSIVE_MUTEX>; -#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#pragma instantiate ACE_Timer_Heap_T<ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, ACE_SYNCH_RECURSIVE_MUTEX> +#pragma instantiate ACE_Timer_Heap_Iterator_T<ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, ACE_SYNCH_RECURSIVE_MUTEX> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + #endif /* ACE_TIMER_HEAP_C */ diff --git a/ace/Timer_List.cpp b/ace/Timer_List.cpp index 3ad874857c1..8bae22eb456 100644 --- a/ace/Timer_List.cpp +++ b/ace/Timer_List.cpp @@ -8,9 +8,13 @@ #include "ace/config.h" #include "ace/Timer_List.h" -#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Timer_List_T<ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, ACE_SYNCH_RECURSIVE_MUTEX>; template class ACE_Timer_List_Iterator_T<ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, ACE_SYNCH_RECURSIVE_MUTEX>; -#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#pragma instantiate ACE_Timer_List_T<ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, ACE_SYNCH_RECURSIVE_MUTEX> +#pragma instantiate ACE_Timer_List_Iterator_T<ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, ACE_SYNCH_RECURSIVE_MUTEX> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + #endif /* ACE_TIMER_LIST_C */ diff --git a/ace/Timer_Queue.cpp b/ace/Timer_Queue.cpp index cf3cc833ec0..ff6471efdf8 100644 --- a/ace/Timer_Queue.cpp +++ b/ace/Timer_Queue.cpp @@ -9,13 +9,21 @@ #include "ace/Containers.h" #include "ace/Timer_Queue.h" -#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Unbounded_Set<ACE_Timer_Node_T<ACE_Event_Handler *> *>; template class ACE_Node<ACE_Timer_Node_T<ACE_Event_Handler *> *>; template class ACE_Unbounded_Set_Iterator<ACE_Timer_Node_T<ACE_Event_Handler *> *>; template class ACE_Timer_Node_T<ACE_Event_Handler *>; template class ACE_Timer_Queue_T<ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, ACE_SYNCH_RECURSIVE_MUTEX>; template class ACE_Timer_Queue_Iterator_T<ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, ACE_SYNCH_RECURSIVE_MUTEX>; -#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#pragma instantiate ACE_Unbounded_Set<ACE_Timer_Node_T<ACE_Event_Handler *> *> +#pragma instantiate ACE_Node<ACE_Timer_Node_T<ACE_Event_Handler *> *> +#pragma instantiate ACE_Unbounded_Set_Iterator<ACE_Timer_Node_T<ACE_Event_Handler *> *> +#pragma instantiate ACE_Timer_Node_T<ACE_Event_Handler *> +#pragma instantiate ACE_Timer_Queue_T<ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, ACE_SYNCH_RECURSIVE_MUTEX> +#pragma instantiate ACE_Timer_Queue_Iterator_T<ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, ACE_SYNCH_RECURSIVE_MUTEX> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + #endif /* ACE_TIMER_QUEUE_C */ diff --git a/ace/Timer_Wheel.cpp b/ace/Timer_Wheel.cpp index 9366f7ca190..53f1cd236df 100644 --- a/ace/Timer_Wheel.cpp +++ b/ace/Timer_Wheel.cpp @@ -8,9 +8,13 @@ #include "ace/config.h" #include "ace/Timer_Wheel.h" -#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Timer_Wheel_T<ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, ACE_SYNCH_RECURSIVE_MUTEX>; template class ACE_Timer_Wheel_Iterator_T<ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, ACE_SYNCH_RECURSIVE_MUTEX>; -#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#pragma instantiate ACE_Timer_Wheel_T<ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, ACE_SYNCH_RECURSIVE_MUTEX> +#pragma instantiate ACE_Timer_Wheel_Iterator_T<ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, ACE_SYNCH_RECURSIVE_MUTEX> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + #endif /* ACE_TIMER_WHEEL_C */ diff --git a/ace/Token.cpp b/ace/Token.cpp index 6ab6495501f..1ba979496c3 100644 --- a/ace/Token.cpp +++ b/ace/Token.cpp @@ -20,7 +20,7 @@ ACE_Token::dump (void) const ACE_TRACE ("ACE_Token::dump"); } -ACE_Token::ACE_Queue_Entry::ACE_Queue_Entry (ACE_Thread_Mutex &m, +ACE_Token::ACE_Queue_Entry::ACE_Queue_Entry (ACE_Thread_Mutex &m, ACE_thread_t t_id) : next_ (0), thread_id_ (t_id), @@ -31,10 +31,10 @@ ACE_Token::ACE_Queue_Entry::ACE_Queue_Entry (ACE_Thread_Mutex &m, } ACE_Token::ACE_Token (LPCTSTR name, void *any) - : head_ (0), - tail_ (0), + : head_ (0), + tail_ (0), lock_ (name, any), - in_use_ (0), + in_use_ (0), waiters_ (0), nesting_level_ (0) { @@ -46,7 +46,7 @@ ACE_Token::~ACE_Token (void) ACE_TRACE ("ACE_Token::~ACE_Token"); } -// Remove an entry from the list. Must be +// Remove an entry from the list. Must be // called with locks held. void @@ -65,21 +65,21 @@ ACE_Token::remove_entry (ACE_Token::ACE_Queue_Entry *entry) prev = curr; if (curr == 0) // Didn't find the entry... - return; + return; else if (prev == 0) // Delete at the head. this->head_ = this->head_->next_; else // Delete in the middle. prev->next_ = curr->next_; - // We need to update the tail of the list - // if we've deleted the last entry. + // We need to update the tail of the list + // if we've deleted the last entry. if (curr->next_ == 0) this->tail_ = curr; } -int -ACE_Token::shared_acquire (void (*sleep_hook_func)(void *), +int +ACE_Token::shared_acquire (void (*sleep_hook_func)(void *), void *arg, ACE_Time_Value *timeout) { @@ -96,9 +96,9 @@ ACE_Token::shared_acquire (void (*sleep_hook_func)(void *), #endif /* DEBUGGING */ if (this->in_use_) // Someone already holds the token. - { + { if (ACE_OS::thr_equal (thr_id, this->owner_)) // I own it! - { + { this->nesting_level_++; return 0; } @@ -117,7 +117,7 @@ ACE_Token::shared_acquire (void (*sleep_hook_func)(void *), int ret = 0; if (this->head_ == 0) // I'm first and only waiter in line... - { + { this->head_ = &my_entry; this->tail_ = &my_entry; } @@ -125,13 +125,13 @@ ACE_Token::shared_acquire (void (*sleep_hook_func)(void *), { this->tail_->next_ = &my_entry; this->tail_ = &my_entry; - } + } this->waiters_++; // Execute appropriate <sleep_hook> callback. // (@@ should these methods return a success/failure - // status, and if so, what should we do with it?) + // status, and if so, what should we do with it?) if (sleep_hook_func) { @@ -154,8 +154,8 @@ ACE_Token::shared_acquire (void (*sleep_hook_func)(void *), continue; #if defined (DEBUGGING) cerr << '(' << ACE_Thread::self () << ')' - << " acquire: " - << (errno == ETIME ? "timed out" : "error occurred") + << " acquire: " + << (errno == ETIME ? "timed out" : "error occurred") << endl; #endif /* DEBUGGING */ // We come here if a timeout occurs or some serious @@ -175,7 +175,7 @@ ACE_Token::shared_acquire (void (*sleep_hook_func)(void *), else { this->in_use_ = 1; - this->owner_ = thr_id; // Its mine! + this->owner_ = thr_id; // Its mine! return 0; } } @@ -189,7 +189,7 @@ ACE_Token::sleep_hook (void) ACE_TRACE ("ACE_Token::sleep_hook"); } -int +int ACE_Token::acquire (ACE_Time_Value *timeout) { ACE_TRACE ("ACE_Token::acquire"); @@ -199,8 +199,8 @@ ACE_Token::acquire (ACE_Time_Value *timeout) // Acquire the token, sleeping until it is obtained or until // <timeout> expires. -int -ACE_Token::acquire (void (*sleep_hook_func)(void *), +int +ACE_Token::acquire (void (*sleep_hook_func)(void *), void *arg, ACE_Time_Value *timeout) { @@ -218,8 +218,8 @@ ACE_Token::renew (int requeue_position, ACE_Time_Value *timeout) #if defined (DEBUGGING) cerr << '(' << ACE_Thread::self () << ')' - << " renew: owner_ thr = " << this->owner_ - << ", owner_ addr = " << &this->owner_ + << " renew: owner_ thr = " << this->owner_ + << ", owner_ addr = " << &this->owner_ << ", nesting level = " << this->nesting_level_ << endl; #endif /* DEBUGGING */ ACE_ASSERT (ACE_OS::thr_equal (ACE_Thread::self (), this->owner_)); @@ -239,11 +239,11 @@ ACE_Token::renew (int requeue_position, ACE_Time_Value *timeout) this->head_ = this->head_->next_; - if (this->head_ == 0) // No other threads - just add me - { + if (this->head_ == 0) // No other threads - just add me + { this->head_ = &my_entry; this->tail_ = &my_entry; - } + } else if (requeue_position == -1) // Insert at the end of the queue. { this->tail_->next_ = &my_entry; @@ -259,7 +259,7 @@ ACE_Token::renew (int requeue_position, ACE_Time_Value *timeout) ACE_Token::ACE_Queue_Entry *insert_after = this->head_; // Determine where our thread should go in the queue of - // waiters. + // waiters. while (requeue_position-- && insert_after->next_ != 0) insert_after = insert_after->next_; @@ -282,10 +282,10 @@ ACE_Token::renew (int requeue_position, ACE_Time_Value *timeout) continue; #if defined (DEBUGGING) cerr << '(' << ACE_Thread::self () << ')' - << " renew: " + << " renew: " << (errno == ETIME ? "timed out" : "error occurred") << endl; #endif /* DEBUGGING */ - // We come here if a timeout occurs or + // We come here if a timeout occurs or // some serious ACE_Condition object error. this->remove_entry (&my_entry); return -1; @@ -311,18 +311,18 @@ ACE_Token::release (void) #if defined (DEBUGGING) cerr << '(' << ACE_Thread::self () << ')' - << " release: owner_ thr = " << this->owner_ - << ", owner_ addr = " << &this->owner_ + << " release: owner_ thr = " << this->owner_ + << ", owner_ addr = " << &this->owner_ << ", nesting level = " << this->nesting_level_ << endl; #endif /* DEBUGGING */ if (this->nesting_level_ > 0) --this->nesting_level_; - else + else { if (this->head_ == 0) this->in_use_ = 0; // No more waiters... - else + else { this->owner_ = this->head_->thread_id_; --this->waiters_; @@ -335,12 +335,14 @@ ACE_Token::release (void) if (this->head_ == 0) this->tail_ = 0; - } + } } return 0; } #endif /* ACE_HAS_THREADS */ -#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) -#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + diff --git a/ace/Token_Collection.cpp b/ace/Token_Collection.cpp index ac349124673..24025952a41 100644 --- a/ace/Token_Collection.cpp +++ b/ace/Token_Collection.cpp @@ -73,7 +73,7 @@ ACE_Token_Collection::is_member (const ACE_Token_Proxy &token) return collection_.find (token_name) == 0; } -int +int ACE_Token_Collection::acquire (int notify, void (*sleep_hook)(void *), ACE_Synch_Options &options) @@ -101,7 +101,7 @@ ACE_Token_Collection::acquire (int notify, return 0; } -int +int ACE_Token_Collection::acquire (const char *token_name, int notify, void (*sleep_hook)(void *), @@ -120,7 +120,7 @@ ACE_Token_Collection::acquire (const char *token_name, } -int +int ACE_Token_Collection::tryacquire (const char *token_name, void (*sleep_hook)(void *)) { @@ -137,7 +137,7 @@ ACE_Token_Collection::tryacquire (const char *token_name, return temp->tryacquire (sleep_hook); } -int +int ACE_Token_Collection::tryacquire (void (*sleep_hook)(void *)) { ACE_TRACE ("ACE_Token_Collection::tryacquire"); @@ -159,7 +159,7 @@ ACE_Token_Collection::tryacquire (void (*sleep_hook)(void *)) return 0; } -int +int ACE_Token_Collection::renew (int requeue_position, ACE_Synch_Options &options) { @@ -181,7 +181,7 @@ ACE_Token_Collection::renew (int requeue_position, return 0; } -int +int ACE_Token_Collection::renew (const char *token_name, int requeue_position, ACE_Synch_Options &options) @@ -202,7 +202,7 @@ ACE_Token_Collection::renew (const char *token_name, return temp->renew (requeue_position, options); } -int +int ACE_Token_Collection::release (ACE_Synch_Options &) { @@ -222,7 +222,7 @@ ACE_Token_Collection::release (ACE_Synch_Options &) return 0; } -int +int ACE_Token_Collection::release (const char *token_name, ACE_Synch_Options &options) { @@ -281,11 +281,16 @@ ACE_Token_Collection::dump (void) const collection_.dump (); ACE_DEBUG ((LM_DEBUG, "base:\n")); ACE_Token_Proxy::dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); } -#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Map_Manager<ACE_Token_Name, ACE_Token_Proxy *, ACE_Null_Mutex>; template class ACE_Map_Iterator<ACE_Token_Name, ACE_Token_Proxy *, ACE_Null_Mutex>; template class ACE_Map_Entry<ACE_Token_Name, ACE_Token_Proxy *>; -#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#pragma instantiate ACE_Map_Manager<ACE_Token_Name, ACE_Token_Proxy *, ACE_Null_Mutex> +#pragma instantiate ACE_Map_Iterator<ACE_Token_Name, ACE_Token_Proxy *, ACE_Null_Mutex> +#pragma instantiate ACE_Map_Entry<ACE_Token_Name, ACE_Token_Proxy *> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + diff --git a/ace/Token_Invariants.cpp b/ace/Token_Invariants.cpp index a9a18f7b5f8..098be4fea43 100644 --- a/ace/Token_Invariants.cpp +++ b/ace/Token_Invariants.cpp @@ -47,7 +47,7 @@ ACE_Token_Invariant_Manager::mutex_acquired (const char *token_name) else return inv->acquired (); } - + int ACE_Token_Invariant_Manager::acquired (const ACE_Token_Proxy *proxy) { @@ -64,7 +64,7 @@ ACE_Token_Invariant_Manager::acquired (const ACE_Token_Proxy *proxy) return this->writer_acquired (proxy->name ()); } } - + void ACE_Token_Invariant_Manager::releasing (const ACE_Token_Proxy *proxy) { @@ -76,7 +76,7 @@ ACE_Token_Invariant_Manager::releasing (const ACE_Token_Proxy *proxy) else // ACE_Tokens::RWLOCK. this->rwlock_releasing (proxy->name ()); } - + void ACE_Token_Invariant_Manager::mutex_releasing (const char *token_name) { @@ -136,7 +136,7 @@ ACE_Token_Invariant_Manager::dump (void) const mutex_collection_.dump (); ACE_DEBUG ((LM_DEBUG, "rwlock_collection_:\n")); rwlock_collection_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); } @@ -150,7 +150,7 @@ ACE_Token_Invariant_Manager::get_mutex (const char *token_name, // We did not find one in the collection. { ACE_Mutex_Invariants *new_invariant; - + ACE_NEW_RETURN (new_invariant, ACE_Mutex_Invariants, -1); if (mutex_collection_.bind (name, new_invariant) == -1) @@ -177,7 +177,7 @@ ACE_Token_Invariant_Manager::get_rwlock (const char *token_name, // We did not find one in the collection. { ACE_RWLock_Invariants *new_invariant; - + ACE_NEW_RETURN (new_invariant, ACE_RWLock_Invariants, -1); if (rwlock_collection_.bind (name, new_invariant) == -1) @@ -219,7 +219,7 @@ ACE_Mutex_Invariants::ACE_Mutex_Invariants (void) { } -int +int ACE_Mutex_Invariants::acquired (void) { if (++owners_ > 1) @@ -231,7 +231,7 @@ ACE_Mutex_Invariants::acquired (void) return 1; } -void +void ACE_Mutex_Invariants::releasing (void) { if (owners_ == 1) @@ -243,7 +243,7 @@ ACE_Mutex_Invariants::ACE_Mutex_Invariants (const ACE_Mutex_Invariants &rhs) { } -void +void ACE_Mutex_Invariants::operator= (const ACE_Mutex_Invariants &rhs) { owners_ = rhs.owners_; @@ -255,7 +255,7 @@ ACE_Mutex_Invariants::dump (void) const ACE_TRACE ("ACE_Mutex_Invariants::dump"); ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); ACE_DEBUG ((LM_DEBUG, "owners_ = %d\n", owners_)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); } // ************************************************** @@ -268,7 +268,7 @@ ACE_RWLock_Invariants::ACE_RWLock_Invariants (void) { } -int +int ACE_RWLock_Invariants::writer_acquired (void) { if (readers_ > 0) @@ -285,7 +285,7 @@ ACE_RWLock_Invariants::writer_acquired (void) return 1; } -int +int ACE_RWLock_Invariants::reader_acquired (void) { if (writers_ > 0) @@ -300,7 +300,7 @@ ACE_RWLock_Invariants::reader_acquired (void) } } -void +void ACE_RWLock_Invariants::releasing (void) { if (writers_ == 1) @@ -315,7 +315,7 @@ ACE_RWLock_Invariants::ACE_RWLock_Invariants (const ACE_RWLock_Invariants &rhs) { } -void +void ACE_RWLock_Invariants::operator= (const ACE_RWLock_Invariants &rhs) { writers_ = rhs.writers_; @@ -330,14 +330,22 @@ ACE_RWLock_Invariants::dump (void) const ACE_DEBUG ((LM_DEBUG, "writers_ = %d\n", "readers_ = %d\n", writers_, readers_)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); } -#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Map_Manager<ACE_Token_Name, ACE_Mutex_Invariants *, ACE_Null_Mutex>; template class ACE_Map_Iterator<ACE_Token_Name, ACE_Mutex_Invariants *, ACE_Null_Mutex>; template class ACE_Map_Entry<ACE_Token_Name, ACE_Mutex_Invariants *>; template class ACE_Map_Manager<ACE_Token_Name, ACE_RWLock_Invariants *, ACE_Null_Mutex>; template class ACE_Map_Iterator<ACE_Token_Name, ACE_RWLock_Invariants *, ACE_Null_Mutex>; template class ACE_Map_Entry<ACE_Token_Name, ACE_RWLock_Invariants *>; -#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#pragma instantiate ACE_Map_Manager<ACE_Token_Name, ACE_Mutex_Invariants *, ACE_Null_Mutex> +#pragma instantiate ACE_Map_Iterator<ACE_Token_Name, ACE_Mutex_Invariants *, ACE_Null_Mutex> +#pragma instantiate ACE_Map_Entry<ACE_Token_Name, ACE_Mutex_Invariants *> +#pragma instantiate ACE_Map_Manager<ACE_Token_Name, ACE_RWLock_Invariants *, ACE_Null_Mutex> +#pragma instantiate ACE_Map_Iterator<ACE_Token_Name, ACE_RWLock_Invariants *, ACE_Null_Mutex> +#pragma instantiate ACE_Map_Entry<ACE_Token_Name, ACE_RWLock_Invariants *> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + diff --git a/ace/Token_Manager.cpp b/ace/Token_Manager.cpp index fcaa86d805c..0a0106e5a5b 100644 --- a/ace/Token_Manager.cpp +++ b/ace/Token_Manager.cpp @@ -48,24 +48,24 @@ ACE_Token_Manager::instance (void) if (token_manager_ == 0) ACE_NEW_RETURN (token_manager_, ACE_Token_Manager, 0); - } + } return token_manager_; } void -ACE_Token_Manager::get_token (ACE_Token_Proxy *proxy, - const char *token_name) +ACE_Token_Manager::get_token (ACE_Token_Proxy *proxy, + const char *token_name) { ACE_TRACE ("ACE_Token_Manager::get"); // Hmm. I think this makes sense. We perform our own locking here // (see safe_acquire.) We have to make sure that only one thread // uses the collection at a time. - + ACE_GUARD (ACE_TOKEN_CONST::MUTEX, ace_mon, this->lock_); TOKEN_NAME name (token_name); - + if (collection_.find (name, proxy->token_) == -1) // We did not find one in the collection. { @@ -84,7 +84,7 @@ ACE_Token_Manager::get_token (ACE_Token_Proxy *proxy, proxy->token_->inc_reference (); // We may be returning proxy->token_ == 0 if new failed, caller must - // check. + // check. } // 0. check_deadlock (TOKEN) @@ -97,7 +97,7 @@ ACE_Token_Manager::get_token (ACE_Token_Proxy *proxy, // 7. else, if check_deadlock (NEW_TOKEN) == 1, return *DEADLOCK* // 8. return 0. -int +int ACE_Token_Manager::check_deadlock (ACE_Token_Proxy *proxy) { ACE_TRACE ("ACE_Token_Manager::check_deadlock"); @@ -116,7 +116,7 @@ ACE_Token_Manager::check_deadlock (ACE_Token_Proxy *proxy) return result; } -int +int ACE_Token_Manager::check_deadlock (ACE_Tokens *token, ACE_Token_Proxy *proxy) { ACE_TRACE ("ACE_Token_Manager::check_deadlock"); @@ -127,7 +127,7 @@ ACE_Token_Manager::check_deadlock (ACE_Tokens *token, ACE_Token_Proxy *proxy) token->visit (1); ACE_Tokens::OWNER_STACK owners; - + int is_owner = token->owners (owners, proxy->client_id ()); switch (is_owner) @@ -140,10 +140,10 @@ ACE_Token_Manager::check_deadlock (ACE_Tokens *token, ACE_Token_Proxy *proxy) if (debug_) { ACE_DEBUG ((LM_DEBUG, "(%t) Deadlock detected.\n")); - ACE_DEBUG ((LM_DEBUG, "%s owns %s and is waiting for %s.\n", + ACE_DEBUG ((LM_DEBUG, "%s owns %s and is waiting for %s.\n", proxy->client_id (), token->name (), - proxy->token_->name ())); + proxy->token_->name ())); } return 1; @@ -161,7 +161,7 @@ ACE_Token_Manager::check_deadlock (ACE_Tokens *token, ACE_Token_Proxy *proxy) { if (debug_) { - ACE_DEBUG ((LM_DEBUG, + ACE_DEBUG ((LM_DEBUG, "%s owns %s and is waiting for %s.\n", e->client_id (), token->name (), @@ -248,11 +248,16 @@ ACE_Token_Manager::dump (void) const lock_.dump (); ACE_DEBUG ((LM_DEBUG, "collection_\n")); collection_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); } -#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Map_Manager <ACE_Token_Name, ACE_Tokens *, ACE_Null_Mutex>; template class ACE_Map_Iterator<ACE_Token_Name, ACE_Tokens *, ACE_Null_Mutex>; template class ACE_Map_Entry <ACE_Token_Name, ACE_Tokens *>; -#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#pragma instantiate ACE_Map_Manager <ACE_Token_Name, ACE_Tokens *, ACE_Null_Mutex> +#pragma instantiate ACE_Map_Iterator<ACE_Token_Name, ACE_Tokens *, ACE_Null_Mutex> +#pragma instantiate ACE_Map_Entry <ACE_Token_Name, ACE_Tokens *> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + |