aboutsummaryrefslogtreecommitdiff
path: root/dep/ACE_wrappers
diff options
context:
space:
mode:
Diffstat (limited to 'dep/ACE_wrappers')
-rw-r--r--dep/ACE_wrappers/README61
-rw-r--r--dep/ACE_wrappers/VERSION3
-rw-r--r--dep/ACE_wrappers/ace/ACE.cpp431
-rw-r--r--dep/ACE_wrappers/ace/ACE.h144
-rw-r--r--dep/ACE_wrappers/ace/ACE.inl34
-rw-r--r--dep/ACE_wrappers/ace/ACE_crc32.cpp18
-rw-r--r--dep/ACE_wrappers/ace/ACE_crc_ccitt.cpp18
-rw-r--r--dep/ACE_wrappers/ace/ACE_export.h9
-rw-r--r--dep/ACE_wrappers/ace/ARGV.h46
-rw-r--r--dep/ACE_wrappers/ace/ARGV.inl20
-rw-r--r--dep/ACE_wrappers/ace/ATM_Acceptor.cpp45
-rw-r--r--dep/ACE_wrappers/ace/ATM_Acceptor.h26
-rw-r--r--dep/ACE_wrappers/ace/ATM_Acceptor.inl6
-rw-r--r--dep/ACE_wrappers/ace/ATM_Addr.cpp79
-rw-r--r--dep/ACE_wrappers/ace/ATM_Addr.h36
-rw-r--r--dep/ACE_wrappers/ace/ATM_Addr.inl4
-rw-r--r--dep/ACE_wrappers/ace/ATM_Connector.cpp22
-rw-r--r--dep/ACE_wrappers/ace/ATM_Connector.h21
-rw-r--r--dep/ACE_wrappers/ace/ATM_Connector.inl15
-rw-r--r--dep/ACE_wrappers/ace/ATM_Params.cpp9
-rw-r--r--dep/ACE_wrappers/ace/ATM_Params.h50
-rw-r--r--dep/ACE_wrappers/ace/ATM_Params.inl28
-rw-r--r--dep/ACE_wrappers/ace/ATM_QoS.cpp93
-rw-r--r--dep/ACE_wrappers/ace/ATM_QoS.h21
-rw-r--r--dep/ACE_wrappers/ace/ATM_QoS.inl5
-rw-r--r--dep/ACE_wrappers/ace/ATM_Stream.cpp42
-rw-r--r--dep/ACE_wrappers/ace/ATM_Stream.h24
-rw-r--r--dep/ACE_wrappers/ace/ATM_Stream.inl13
-rw-r--r--dep/ACE_wrappers/ace/Acceptor.h111
-rw-r--r--dep/ACE_wrappers/ace/Activation_Queue.cpp20
-rw-r--r--dep/ACE_wrappers/ace/Activation_Queue.h33
-rw-r--r--dep/ACE_wrappers/ace/Activation_Queue.inl6
-rw-r--r--dep/ACE_wrappers/ace/Active_Map_Manager.cpp3
-rw-r--r--dep/ACE_wrappers/ace/Active_Map_Manager.h26
-rw-r--r--dep/ACE_wrappers/ace/Active_Map_Manager.inl15
-rw-r--r--dep/ACE_wrappers/ace/Active_Map_Manager_T.h45
-rw-r--r--dep/ACE_wrappers/ace/Active_Map_Manager_T.inl60
-rw-r--r--dep/ACE_wrappers/ace/Addr.cpp17
-rw-r--r--dep/ACE_wrappers/ace/Addr.h29
-rw-r--r--dep/ACE_wrappers/ace/Addr.inl14
-rw-r--r--dep/ACE_wrappers/ace/Arg_Shifter.h35
-rw-r--r--dep/ACE_wrappers/ace/Argv_Type_Converter.cpp27
-rw-r--r--dep/ACE_wrappers/ace/Argv_Type_Converter.h32
-rw-r--r--dep/ACE_wrappers/ace/Argv_Type_Converter.inl8
-rw-r--r--dep/ACE_wrappers/ace/Array.h5
-rw-r--r--dep/ACE_wrappers/ace/Array_Base.h53
-rw-r--r--dep/ACE_wrappers/ace/Array_Base.inl23
-rw-r--r--dep/ACE_wrappers/ace/Array_Map.h48
-rw-r--r--dep/ACE_wrappers/ace/Array_Map.inl20
-rw-r--r--dep/ACE_wrappers/ace/Assert.cpp7
-rw-r--r--dep/ACE_wrappers/ace/Assert.h9
-rw-r--r--dep/ACE_wrappers/ace/Asynch_Acceptor.h44
-rw-r--r--dep/ACE_wrappers/ace/Asynch_Connector.h31
-rw-r--r--dep/ACE_wrappers/ace/Asynch_IO.cpp209
-rw-r--r--dep/ACE_wrappers/ace/Asynch_IO.h252
-rw-r--r--dep/ACE_wrappers/ace/Asynch_IO_Impl.cpp32
-rw-r--r--dep/ACE_wrappers/ace/Asynch_IO_Impl.h109
-rw-r--r--dep/ACE_wrappers/ace/Asynch_IO_Impl.inl18
-rw-r--r--dep/ACE_wrappers/ace/Asynch_Pseudo_Task.cpp27
-rw-r--r--dep/ACE_wrappers/ace/Asynch_Pseudo_Task.h18
-rw-r--r--dep/ACE_wrappers/ace/Atomic_Op.cpp26
-rw-r--r--dep/ACE_wrappers/ace/Atomic_Op.h67
-rw-r--r--dep/ACE_wrappers/ace/Atomic_Op.inl44
-rw-r--r--dep/ACE_wrappers/ace/Atomic_Op_Sparc.c18
-rw-r--r--dep/ACE_wrappers/ace/Atomic_Op_Sparc.h3
-rw-r--r--dep/ACE_wrappers/ace/Atomic_Op_T.h80
-rw-r--r--dep/ACE_wrappers/ace/Atomic_Op_T.inl45
-rw-r--r--dep/ACE_wrappers/ace/Auto_Event.cpp8
-rw-r--r--dep/ACE_wrappers/ace/Auto_Event.h14
-rw-r--r--dep/ACE_wrappers/ace/Auto_Event.inl3
-rw-r--r--dep/ACE_wrappers/ace/Auto_Functor.h31
-rw-r--r--dep/ACE_wrappers/ace/Auto_Functor.inl21
-rw-r--r--dep/ACE_wrappers/ace/Auto_IncDec_T.h19
-rw-r--r--dep/ACE_wrappers/ace/Auto_IncDec_T.inl6
-rw-r--r--dep/ACE_wrappers/ace/Auto_Ptr.h41
-rw-r--r--dep/ACE_wrappers/ace/Auto_Ptr.inl25
-rw-r--r--dep/ACE_wrappers/ace/Barrier.cpp36
-rw-r--r--dep/ACE_wrappers/ace/Barrier.h41
-rw-r--r--dep/ACE_wrappers/ace/Barrier.inl5
-rw-r--r--dep/ACE_wrappers/ace/Base_Thread_Adapter.cpp24
-rw-r--r--dep/ACE_wrappers/ace/Base_Thread_Adapter.h37
-rw-r--r--dep/ACE_wrappers/ace/Base_Thread_Adapter.inl7
-rw-r--r--dep/ACE_wrappers/ace/Based_Pointer_Repository.cpp21
-rw-r--r--dep/ACE_wrappers/ace/Based_Pointer_Repository.h22
-rw-r--r--dep/ACE_wrappers/ace/Based_Pointer_T.h40
-rw-r--r--dep/ACE_wrappers/ace/Based_Pointer_T.inl21
-rw-r--r--dep/ACE_wrappers/ace/Basic_Stats.cpp14
-rw-r--r--dep/ACE_wrappers/ace/Basic_Stats.h18
-rw-r--r--dep/ACE_wrappers/ace/Basic_Stats.inl7
-rw-r--r--dep/ACE_wrappers/ace/Basic_Types.cpp13
-rw-r--r--dep/ACE_wrappers/ace/Basic_Types.h103
-rw-r--r--dep/ACE_wrappers/ace/Basic_Types.inl172
-rw-r--r--dep/ACE_wrappers/ace/Bound_Ptr.h83
-rw-r--r--dep/ACE_wrappers/ace/Bound_Ptr.inl80
-rw-r--r--dep/ACE_wrappers/ace/CDR_Base.cpp95
-rw-r--r--dep/ACE_wrappers/ace/CDR_Base.h45
-rw-r--r--dep/ACE_wrappers/ace/CDR_Base.inl16
-rw-r--r--dep/ACE_wrappers/ace/CDR_Size.cpp30
-rw-r--r--dep/ACE_wrappers/ace/CDR_Size.h36
-rw-r--r--dep/ACE_wrappers/ace/CDR_Size.inl57
-rw-r--r--dep/ACE_wrappers/ace/CDR_Stream.cpp235
-rw-r--r--dep/ACE_wrappers/ace/CDR_Stream.h191
-rw-r--r--dep/ACE_wrappers/ace/CDR_Stream.inl245
-rw-r--r--dep/ACE_wrappers/ace/CE_Screen_Output.h30
-rw-r--r--dep/ACE_wrappers/ace/CORBA_macros.h96
-rw-r--r--dep/ACE_wrappers/ace/Cache_Map_Manager_T.h93
-rw-r--r--dep/ACE_wrappers/ace/Cache_Map_Manager_T.inl37
-rw-r--r--dep/ACE_wrappers/ace/Cached_Connect_Strategy_T.h45
-rw-r--r--dep/ACE_wrappers/ace/Caching_Strategies_T.h129
-rw-r--r--dep/ACE_wrappers/ace/Caching_Strategies_T.inl84
-rw-r--r--dep/ACE_wrappers/ace/Caching_Utility_T.h69
-rw-r--r--dep/ACE_wrappers/ace/Capabilities.cpp54
-rw-r--r--dep/ACE_wrappers/ace/Capabilities.h47
-rw-r--r--dep/ACE_wrappers/ace/Capabilities.inl9
-rw-r--r--dep/ACE_wrappers/ace/Cleanup.cpp33
-rw-r--r--dep/ACE_wrappers/ace/Cleanup.h28
-rw-r--r--dep/ACE_wrappers/ace/Cleanup.inl3
-rw-r--r--dep/ACE_wrappers/ace/Cleanup_Strategies_T.h24
-rw-r--r--dep/ACE_wrappers/ace/Codecs.cpp32
-rw-r--r--dep/ACE_wrappers/ace/Codecs.h26
-rw-r--r--dep/ACE_wrappers/ace/Codeset_IBM1047.cpp51
-rw-r--r--dep/ACE_wrappers/ace/Codeset_IBM1047.h20
-rw-r--r--dep/ACE_wrappers/ace/Codeset_Registry.cpp12
-rw-r--r--dep/ACE_wrappers/ace/Codeset_Registry.h16
-rw-r--r--dep/ACE_wrappers/ace/Codeset_Registry.inl6
-rw-r--r--dep/ACE_wrappers/ace/Codeset_Registry_db.cpp5
-rw-r--r--dep/ACE_wrappers/ace/Codeset_Symbols.h3
-rw-r--r--dep/ACE_wrappers/ace/Condition_Recursive_Thread_Mutex.cpp21
-rw-r--r--dep/ACE_wrappers/ace/Condition_Recursive_Thread_Mutex.h26
-rw-r--r--dep/ACE_wrappers/ace/Condition_T.h31
-rw-r--r--dep/ACE_wrappers/ace/Condition_T.inl10
-rw-r--r--dep/ACE_wrappers/ace/Condition_Thread_Mutex.cpp20
-rw-r--r--dep/ACE_wrappers/ace/Condition_Thread_Mutex.h37
-rw-r--r--dep/ACE_wrappers/ace/Condition_Thread_Mutex.inl13
-rw-r--r--dep/ACE_wrappers/ace/Configuration.cpp310
-rw-r--r--dep/ACE_wrappers/ace/Configuration.h140
-rw-r--r--dep/ACE_wrappers/ace/Configuration.inl3
-rw-r--r--dep/ACE_wrappers/ace/Configuration_Import_Export.cpp48
-rw-r--r--dep/ACE_wrappers/ace/Configuration_Import_Export.h27
-rw-r--r--dep/ACE_wrappers/ace/Connection_Recycling_Strategy.cpp4
-rw-r--r--dep/ACE_wrappers/ace/Connection_Recycling_Strategy.h16
-rw-r--r--dep/ACE_wrappers/ace/Connector.h91
-rw-r--r--dep/ACE_wrappers/ace/Containers.cpp4
-rw-r--r--dep/ACE_wrappers/ace/Containers.h18
-rw-r--r--dep/ACE_wrappers/ace/Containers.inl4
-rw-r--r--dep/ACE_wrappers/ace/Containers_T.h344
-rw-r--r--dep/ACE_wrappers/ace/Containers_T.inl77
-rw-r--r--dep/ACE_wrappers/ace/Copy_Disabled.cpp5
-rw-r--r--dep/ACE_wrappers/ace/Copy_Disabled.h12
-rw-r--r--dep/ACE_wrappers/ace/Countdown_Time.cpp10
-rw-r--r--dep/ACE_wrappers/ace/Countdown_Time.h20
-rw-r--r--dep/ACE_wrappers/ace/DEV.cpp12
-rw-r--r--dep/ACE_wrappers/ace/DEV.h16
-rw-r--r--dep/ACE_wrappers/ace/DEV.inl3
-rw-r--r--dep/ACE_wrappers/ace/DEV_Addr.cpp27
-rw-r--r--dep/ACE_wrappers/ace/DEV_Addr.h25
-rw-r--r--dep/ACE_wrappers/ace/DEV_Addr.inl14
-rw-r--r--dep/ACE_wrappers/ace/DEV_Connector.cpp11
-rw-r--r--dep/ACE_wrappers/ace/DEV_Connector.h15
-rw-r--r--dep/ACE_wrappers/ace/DEV_Connector.inl5
-rw-r--r--dep/ACE_wrappers/ace/DEV_IO.cpp25
-rw-r--r--dep/ACE_wrappers/ace/DEV_IO.h33
-rw-r--r--dep/ACE_wrappers/ace/DEV_IO.inl19
-rw-r--r--dep/ACE_wrappers/ace/DLL.cpp58
-rw-r--r--dep/ACE_wrappers/ace/DLL.h30
-rw-r--r--dep/ACE_wrappers/ace/DLL_Manager.cpp110
-rw-r--r--dep/ACE_wrappers/ace/DLL_Manager.h55
-rw-r--r--dep/ACE_wrappers/ace/Date_Time.cpp3
-rw-r--r--dep/ACE_wrappers/ace/Date_Time.h31
-rw-r--r--dep/ACE_wrappers/ace/Date_Time.inl26
-rw-r--r--dep/ACE_wrappers/ace/Default_Constants.h104
-rw-r--r--dep/ACE_wrappers/ace/Dev_Poll_Reactor.cpp511
-rw-r--r--dep/ACE_wrappers/ace/Dev_Poll_Reactor.h219
-rw-r--r--dep/ACE_wrappers/ace/Dev_Poll_Reactor.inl43
-rw-r--r--dep/ACE_wrappers/ace/Dirent.cpp2
-rw-r--r--dep/ACE_wrappers/ace/Dirent.h20
-rw-r--r--dep/ACE_wrappers/ace/Dirent.inl17
-rw-r--r--dep/ACE_wrappers/ace/Dirent_Selector.cpp12
-rw-r--r--dep/ACE_wrappers/ace/Dirent_Selector.h17
-rw-r--r--dep/ACE_wrappers/ace/Dirent_Selector.inl4
-rw-r--r--dep/ACE_wrappers/ace/Dump.cpp24
-rw-r--r--dep/ACE_wrappers/ace/Dump.h27
-rw-r--r--dep/ACE_wrappers/ace/Dump_T.h14
-rw-r--r--dep/ACE_wrappers/ace/Dynamic.cpp8
-rw-r--r--dep/ACE_wrappers/ace/Dynamic.h15
-rw-r--r--dep/ACE_wrappers/ace/Dynamic.inl6
-rw-r--r--dep/ACE_wrappers/ace/Dynamic_Message_Strategy.cpp35
-rw-r--r--dep/ACE_wrappers/ace/Dynamic_Message_Strategy.h43
-rw-r--r--dep/ACE_wrappers/ace/Dynamic_Message_Strategy.inl10
-rw-r--r--dep/ACE_wrappers/ace/Dynamic_Service.h21
-rw-r--r--dep/ACE_wrappers/ace/Dynamic_Service.inl8
-rw-r--r--dep/ACE_wrappers/ace/Dynamic_Service_Base.cpp19
-rw-r--r--dep/ACE_wrappers/ace/Dynamic_Service_Base.h16
-rw-r--r--dep/ACE_wrappers/ace/Dynamic_Service_Dependency.cpp7
-rw-r--r--dep/ACE_wrappers/ace/Dynamic_Service_Dependency.h12
-rw-r--r--dep/ACE_wrappers/ace/Encoding_Converter.cpp3
-rw-r--r--dep/ACE_wrappers/ace/Encoding_Converter.h13
-rw-r--r--dep/ACE_wrappers/ace/Encoding_Converter_Factory.cpp8
-rw-r--r--dep/ACE_wrappers/ace/Encoding_Converter_Factory.h12
-rw-r--r--dep/ACE_wrappers/ace/Env_Value_T.h33
-rw-r--r--dep/ACE_wrappers/ace/Env_Value_T.inl9
-rw-r--r--dep/ACE_wrappers/ace/Event.cpp15
-rw-r--r--dep/ACE_wrappers/ace/Event.h24
-rw-r--r--dep/ACE_wrappers/ace/Event.inl4
-rw-r--r--dep/ACE_wrappers/ace/Event_Handler.cpp75
-rw-r--r--dep/ACE_wrappers/ace/Event_Handler.h74
-rw-r--r--dep/ACE_wrappers/ace/Event_Handler.inl3
-rw-r--r--dep/ACE_wrappers/ace/Event_Handler_T.h40
-rw-r--r--dep/ACE_wrappers/ace/Event_Handler_T.inl21
-rw-r--r--dep/ACE_wrappers/ace/Exception_Macros.h9
-rw-r--r--dep/ACE_wrappers/ace/FIFO.cpp16
-rw-r--r--dep/ACE_wrappers/ace/FIFO.h18
-rw-r--r--dep/ACE_wrappers/ace/FIFO.inl5
-rw-r--r--dep/ACE_wrappers/ace/FIFO_Recv.cpp15
-rw-r--r--dep/ACE_wrappers/ace/FIFO_Recv.h20
-rw-r--r--dep/ACE_wrappers/ace/FIFO_Recv.inl5
-rw-r--r--dep/ACE_wrappers/ace/FIFO_Recv_Msg.cpp14
-rw-r--r--dep/ACE_wrappers/ace/FIFO_Recv_Msg.h18
-rw-r--r--dep/ACE_wrappers/ace/FIFO_Recv_Msg.inl17
-rw-r--r--dep/ACE_wrappers/ace/FIFO_Send.cpp10
-rw-r--r--dep/ACE_wrappers/ace/FIFO_Send.h18
-rw-r--r--dep/ACE_wrappers/ace/FIFO_Send.inl5
-rw-r--r--dep/ACE_wrappers/ace/FIFO_Send_Msg.cpp15
-rw-r--r--dep/ACE_wrappers/ace/FIFO_Send_Msg.h19
-rw-r--r--dep/ACE_wrappers/ace/FIFO_Send_Msg.inl8
-rw-r--r--dep/ACE_wrappers/ace/FILE.cpp34
-rw-r--r--dep/ACE_wrappers/ace/FILE.h29
-rw-r--r--dep/ACE_wrappers/ace/FILE.inl3
-rw-r--r--dep/ACE_wrappers/ace/FILE_Addr.cpp22
-rw-r--r--dep/ACE_wrappers/ace/FILE_Addr.h23
-rw-r--r--dep/ACE_wrappers/ace/FILE_Addr.inl9
-rw-r--r--dep/ACE_wrappers/ace/FILE_Connector.cpp18
-rw-r--r--dep/ACE_wrappers/ace/FILE_Connector.h15
-rw-r--r--dep/ACE_wrappers/ace/FILE_Connector.inl5
-rw-r--r--dep/ACE_wrappers/ace/FILE_IO.cpp25
-rw-r--r--dep/ACE_wrappers/ace/FILE_IO.h37
-rw-r--r--dep/ACE_wrappers/ace/FILE_IO.inl24
-rw-r--r--dep/ACE_wrappers/ace/File_Lock.cpp13
-rw-r--r--dep/ACE_wrappers/ace/File_Lock.h30
-rw-r--r--dep/ACE_wrappers/ace/File_Lock.inl15
-rw-r--r--dep/ACE_wrappers/ace/Filecache.cpp113
-rw-r--r--dep/ACE_wrappers/ace/Filecache.h71
-rw-r--r--dep/ACE_wrappers/ace/Flag_Manip.cpp18
-rw-r--r--dep/ACE_wrappers/ace/Flag_Manip.h14
-rw-r--r--dep/ACE_wrappers/ace/Flag_Manip.inl5
-rw-r--r--dep/ACE_wrappers/ace/Framework_Component.cpp53
-rw-r--r--dep/ACE_wrappers/ace/Framework_Component.h48
-rw-r--r--dep/ACE_wrappers/ace/Framework_Component.inl7
-rw-r--r--dep/ACE_wrappers/ace/Framework_Component_T.h13
-rw-r--r--dep/ACE_wrappers/ace/Free_List.h31
-rw-r--r--dep/ACE_wrappers/ace/Functor.cpp6
-rw-r--r--dep/ACE_wrappers/ace/Functor.h53
-rw-r--r--dep/ACE_wrappers/ace/Functor.inl45
-rw-r--r--dep/ACE_wrappers/ace/Functor_String.cpp2
-rw-r--r--dep/ACE_wrappers/ace/Functor_String.h18
-rw-r--r--dep/ACE_wrappers/ace/Functor_String.inl10
-rw-r--r--dep/ACE_wrappers/ace/Functor_T.h22
-rw-r--r--dep/ACE_wrappers/ace/Functor_T.inl6
-rw-r--r--dep/ACE_wrappers/ace/Future.h70
-rw-r--r--dep/ACE_wrappers/ace/Future_Set.h28
-rw-r--r--dep/ACE_wrappers/ace/Get_Opt.cpp71
-rw-r--r--dep/ACE_wrappers/ace/Get_Opt.h64
-rw-r--r--dep/ACE_wrappers/ace/Get_Opt.inl10
-rw-r--r--dep/ACE_wrappers/ace/Global_Macros.h99
-rw-r--r--dep/ACE_wrappers/ace/Guard_T.h88
-rw-r--r--dep/ACE_wrappers/ace/Guard_T.inl26
-rw-r--r--dep/ACE_wrappers/ace/Handle_Gobbler.h15
-rw-r--r--dep/ACE_wrappers/ace/Handle_Gobbler.inl15
-rw-r--r--dep/ACE_wrappers/ace/Handle_Ops.cpp10
-rw-r--r--dep/ACE_wrappers/ace/Handle_Ops.h12
-rw-r--r--dep/ACE_wrappers/ace/Handle_Set.cpp80
-rw-r--r--dep/ACE_wrappers/ace/Handle_Set.h49
-rw-r--r--dep/ACE_wrappers/ace/Handle_Set.inl34
-rw-r--r--dep/ACE_wrappers/ace/Hash_Cache_Map_Manager_T.h36
-rw-r--r--dep/ACE_wrappers/ace/Hash_Cache_Map_Manager_T.inl11
-rw-r--r--dep/ACE_wrappers/ace/Hash_Map_Manager.h8
-rw-r--r--dep/ACE_wrappers/ace/Hash_Map_Manager_T.h231
-rw-r--r--dep/ACE_wrappers/ace/Hash_Map_Manager_T.inl211
-rw-r--r--dep/ACE_wrappers/ace/Hash_Map_With_Allocator_T.h20
-rw-r--r--dep/ACE_wrappers/ace/Hash_Map_With_Allocator_T.inl10
-rw-r--r--dep/ACE_wrappers/ace/Hash_Multi_Map_Manager_T.h182
-rw-r--r--dep/ACE_wrappers/ace/Hash_Multi_Map_Manager_T.inl181
-rw-r--r--dep/ACE_wrappers/ace/Hashable.cpp9
-rw-r--r--dep/ACE_wrappers/ace/Hashable.h18
-rw-r--r--dep/ACE_wrappers/ace/Hashable.inl3
-rw-r--r--dep/ACE_wrappers/ace/High_Res_Timer.cpp73
-rw-r--r--dep/ACE_wrappers/ace/High_Res_Timer.h44
-rw-r--r--dep/ACE_wrappers/ace/High_Res_Timer.inl22
-rw-r--r--dep/ACE_wrappers/ace/ICMP_Socket.cpp31
-rw-r--r--dep/ACE_wrappers/ace/ICMP_Socket.h27
-rw-r--r--dep/ACE_wrappers/ace/INET_Addr.cpp135
-rw-r--r--dep/ACE_wrappers/ace/INET_Addr.h69
-rw-r--r--dep/ACE_wrappers/ace/INET_Addr.inl30
-rw-r--r--dep/ACE_wrappers/ace/IOStream.cpp117
-rw-r--r--dep/ACE_wrappers/ace/IOStream.h67
-rw-r--r--dep/ACE_wrappers/ace/IOStream_T.h36
-rw-r--r--dep/ACE_wrappers/ace/IOStream_T.inl19
-rw-r--r--dep/ACE_wrappers/ace/IO_Cntl_Msg.cpp15
-rw-r--r--dep/ACE_wrappers/ace/IO_Cntl_Msg.h28
-rw-r--r--dep/ACE_wrappers/ace/IO_Cntl_Msg.inl11
-rw-r--r--dep/ACE_wrappers/ace/IO_SAP.cpp17
-rw-r--r--dep/ACE_wrappers/ace/IO_SAP.h21
-rw-r--r--dep/ACE_wrappers/ace/IO_SAP.inl10
-rw-r--r--dep/ACE_wrappers/ace/IPC_SAP.cpp18
-rw-r--r--dep/ACE_wrappers/ace/IPC_SAP.h22
-rw-r--r--dep/ACE_wrappers/ace/IPC_SAP.inl9
-rw-r--r--dep/ACE_wrappers/ace/If_Then_Else.h11
-rw-r--r--dep/ACE_wrappers/ace/Init_ACE.cpp10
-rw-r--r--dep/ACE_wrappers/ace/Init_ACE.h13
-rw-r--r--dep/ACE_wrappers/ace/Intrusive_Auto_Ptr.h39
-rw-r--r--dep/ACE_wrappers/ace/Intrusive_Auto_Ptr.inl25
-rw-r--r--dep/ACE_wrappers/ace/Intrusive_List.h27
-rw-r--r--dep/ACE_wrappers/ace/Intrusive_List.inl8
-rw-r--r--dep/ACE_wrappers/ace/Intrusive_List_Node.h13
-rw-r--r--dep/ACE_wrappers/ace/Intrusive_List_Node.inl6
-rw-r--r--dep/ACE_wrappers/ace/LOCK_SOCK_Acceptor.h12
-rw-r--r--dep/ACE_wrappers/ace/LSOCK.cpp27
-rw-r--r--dep/ACE_wrappers/ace/LSOCK.h21
-rw-r--r--dep/ACE_wrappers/ace/LSOCK.inl10
-rw-r--r--dep/ACE_wrappers/ace/LSOCK_Acceptor.cpp29
-rw-r--r--dep/ACE_wrappers/ace/LSOCK_Acceptor.h20
-rw-r--r--dep/ACE_wrappers/ace/LSOCK_CODgram.cpp14
-rw-r--r--dep/ACE_wrappers/ace/LSOCK_CODgram.h17
-rw-r--r--dep/ACE_wrappers/ace/LSOCK_CODgram.inl6
-rw-r--r--dep/ACE_wrappers/ace/LSOCK_Connector.cpp12
-rw-r--r--dep/ACE_wrappers/ace/LSOCK_Connector.h16
-rw-r--r--dep/ACE_wrappers/ace/LSOCK_Connector.inl3
-rw-r--r--dep/ACE_wrappers/ace/LSOCK_Dgram.cpp16
-rw-r--r--dep/ACE_wrappers/ace/LSOCK_Dgram.h17
-rw-r--r--dep/ACE_wrappers/ace/LSOCK_Dgram.inl4
-rw-r--r--dep/ACE_wrappers/ace/LSOCK_Stream.cpp26
-rw-r--r--dep/ACE_wrappers/ace/LSOCK_Stream.h19
-rw-r--r--dep/ACE_wrappers/ace/LSOCK_Stream.inl5
-rw-r--r--dep/ACE_wrappers/ace/Lib_Find.cpp104
-rw-r--r--dep/ACE_wrappers/ace/Lib_Find.h19
-rw-r--r--dep/ACE_wrappers/ace/Local_Memory_Pool.cpp25
-rw-r--r--dep/ACE_wrappers/ace/Local_Memory_Pool.h27
-rw-r--r--dep/ACE_wrappers/ace/Local_Name_Space.cpp25
-rw-r--r--dep/ACE_wrappers/ace/Local_Name_Space.h33
-rw-r--r--dep/ACE_wrappers/ace/Local_Name_Space_T.h46
-rw-r--r--dep/ACE_wrappers/ace/Local_Tokens.cpp240
-rw-r--r--dep/ACE_wrappers/ace/Local_Tokens.h203
-rw-r--r--dep/ACE_wrappers/ace/Local_Tokens.inl51
-rw-r--r--dep/ACE_wrappers/ace/Lock.cpp18
-rw-r--r--dep/ACE_wrappers/ace/Lock.h24
-rw-r--r--dep/ACE_wrappers/ace/Lock.inl3
-rw-r--r--dep/ACE_wrappers/ace/Lock_Adapter_T.h26
-rw-r--r--dep/ACE_wrappers/ace/Lock_Adapter_T.inl3
-rw-r--r--dep/ACE_wrappers/ace/Log_Msg.cpp301
-rw-r--r--dep/ACE_wrappers/ace/Log_Msg.h127
-rw-r--r--dep/ACE_wrappers/ace/Log_Msg.inl35
-rw-r--r--dep/ACE_wrappers/ace/Log_Msg_Backend.cpp5
-rw-r--r--dep/ACE_wrappers/ace/Log_Msg_Backend.h14
-rw-r--r--dep/ACE_wrappers/ace/Log_Msg_Callback.cpp4
-rw-r--r--dep/ACE_wrappers/ace/Log_Msg_Callback.h10
-rw-r--r--dep/ACE_wrappers/ace/Log_Msg_IPC.cpp19
-rw-r--r--dep/ACE_wrappers/ace/Log_Msg_IPC.h14
-rw-r--r--dep/ACE_wrappers/ace/Log_Msg_NT_Event_Log.cpp22
-rw-r--r--dep/ACE_wrappers/ace/Log_Msg_NT_Event_Log.h17
-rw-r--r--dep/ACE_wrappers/ace/Log_Msg_UNIX_Syslog.cpp33
-rw-r--r--dep/ACE_wrappers/ace/Log_Msg_UNIX_Syslog.h18
-rw-r--r--dep/ACE_wrappers/ace/Log_Priority.h21
-rw-r--r--dep/ACE_wrappers/ace/Log_Record.cpp48
-rw-r--r--dep/ACE_wrappers/ace/Log_Record.h50
-rw-r--r--dep/ACE_wrappers/ace/Log_Record.inl17
-rw-r--r--dep/ACE_wrappers/ace/Logging_Strategy.cpp68
-rw-r--r--dep/ACE_wrappers/ace/Logging_Strategy.h32
-rw-r--r--dep/ACE_wrappers/ace/MEM_Acceptor.cpp44
-rw-r--r--dep/ACE_wrappers/ace/MEM_Acceptor.h36
-rw-r--r--dep/ACE_wrappers/ace/MEM_Acceptor.inl14
-rw-r--r--dep/ACE_wrappers/ace/MEM_Addr.cpp35
-rw-r--r--dep/ACE_wrappers/ace/MEM_Addr.h40
-rw-r--r--dep/ACE_wrappers/ace/MEM_Addr.inl24
-rw-r--r--dep/ACE_wrappers/ace/MEM_Connector.cpp25
-rw-r--r--dep/ACE_wrappers/ace/MEM_Connector.h23
-rw-r--r--dep/ACE_wrappers/ace/MEM_Connector.inl7
-rw-r--r--dep/ACE_wrappers/ace/MEM_IO.cpp86
-rw-r--r--dep/ACE_wrappers/ace/MEM_IO.h52
-rw-r--r--dep/ACE_wrappers/ace/MEM_IO.inl50
-rw-r--r--dep/ACE_wrappers/ace/MEM_SAP.cpp24
-rw-r--r--dep/ACE_wrappers/ace/MEM_SAP.h40
-rw-r--r--dep/ACE_wrappers/ace/MEM_SAP.inl12
-rw-r--r--dep/ACE_wrappers/ace/MEM_Stream.cpp12
-rw-r--r--dep/ACE_wrappers/ace/MEM_Stream.h31
-rw-r--r--dep/ACE_wrappers/ace/MEM_Stream.inl21
-rw-r--r--dep/ACE_wrappers/ace/MMAP_Memory_Pool.cpp85
-rw-r--r--dep/ACE_wrappers/ace/MMAP_Memory_Pool.h66
-rw-r--r--dep/ACE_wrappers/ace/MMAP_Memory_Pool.inl4
-rw-r--r--dep/ACE_wrappers/ace/Malloc.cpp27
-rw-r--r--dep/ACE_wrappers/ace/Malloc.h66
-rw-r--r--dep/ACE_wrappers/ace/Malloc.inl5
-rw-r--r--dep/ACE_wrappers/ace/Malloc_Allocator.cpp62
-rw-r--r--dep/ACE_wrappers/ace/Malloc_Allocator.h21
-rw-r--r--dep/ACE_wrappers/ace/Malloc_Allocator.inl3
-rw-r--r--dep/ACE_wrappers/ace/Malloc_Base.h38
-rw-r--r--dep/ACE_wrappers/ace/Malloc_T.h149
-rw-r--r--dep/ACE_wrappers/ace/Malloc_T.inl27
-rw-r--r--dep/ACE_wrappers/ace/Managed_Object.h26
-rw-r--r--dep/ACE_wrappers/ace/Managed_Object.inl4
-rw-r--r--dep/ACE_wrappers/ace/Manual_Event.cpp8
-rw-r--r--dep/ACE_wrappers/ace/Manual_Event.h14
-rw-r--r--dep/ACE_wrappers/ace/Manual_Event.inl3
-rw-r--r--dep/ACE_wrappers/ace/Map.h8
-rw-r--r--dep/ACE_wrappers/ace/Map_Manager.h157
-rw-r--r--dep/ACE_wrappers/ace/Map_Manager.inl137
-rw-r--r--dep/ACE_wrappers/ace/Map_T.h326
-rw-r--r--dep/ACE_wrappers/ace/Map_T.inl66
-rw-r--r--dep/ACE_wrappers/ace/Mem_Map.cpp47
-rw-r--r--dep/ACE_wrappers/ace/Mem_Map.h51
-rw-r--r--dep/ACE_wrappers/ace/Mem_Map.inl46
-rw-r--r--dep/ACE_wrappers/ace/Memory_Pool.h6
-rw-r--r--dep/ACE_wrappers/ace/Message_Block.cpp170
-rw-r--r--dep/ACE_wrappers/ace/Message_Block.h147
-rw-r--r--dep/ACE_wrappers/ace/Message_Block.inl72
-rw-r--r--dep/ACE_wrappers/ace/Message_Block_T.h16
-rw-r--r--dep/ACE_wrappers/ace/Message_Block_T.inl4
-rw-r--r--dep/ACE_wrappers/ace/Message_Queue.cpp8
-rw-r--r--dep/ACE_wrappers/ace/Message_Queue.h47
-rw-r--r--dep/ACE_wrappers/ace/Message_Queue.inl3
-rw-r--r--dep/ACE_wrappers/ace/Message_Queue_NT.cpp28
-rw-r--r--dep/ACE_wrappers/ace/Message_Queue_NT.h45
-rw-r--r--dep/ACE_wrappers/ace/Message_Queue_NT.inl23
-rw-r--r--dep/ACE_wrappers/ace/Message_Queue_T.h209
-rw-r--r--dep/ACE_wrappers/ace/Message_Queue_Vx.cpp63
-rw-r--r--dep/ACE_wrappers/ace/Message_Queue_Vx.h52
-rw-r--r--dep/ACE_wrappers/ace/Message_Queue_Vx.inl5
-rw-r--r--dep/ACE_wrappers/ace/Method_Object.h8
-rw-r--r--dep/ACE_wrappers/ace/Method_Request.cpp7
-rw-r--r--dep/ACE_wrappers/ace/Method_Request.h18
-rw-r--r--dep/ACE_wrappers/ace/Metrics_Cache.h20
-rw-r--r--dep/ACE_wrappers/ace/Metrics_Cache_T.h60
-rw-r--r--dep/ACE_wrappers/ace/Metrics_Cache_T.inl30
-rw-r--r--dep/ACE_wrappers/ace/Min_Max.h13
-rw-r--r--dep/ACE_wrappers/ace/Module.h43
-rw-r--r--dep/ACE_wrappers/ace/Module.inl11
-rw-r--r--dep/ACE_wrappers/ace/Monitor_Admin.cpp19
-rw-r--r--dep/ACE_wrappers/ace/Monitor_Admin.h20
-rw-r--r--dep/ACE_wrappers/ace/Monitor_Admin_Manager.cpp10
-rw-r--r--dep/ACE_wrappers/ace/Monitor_Admin_Manager.h17
-rw-r--r--dep/ACE_wrappers/ace/Monitor_Base.cpp71
-rw-r--r--dep/ACE_wrappers/ace/Monitor_Base.h42
-rw-r--r--dep/ACE_wrappers/ace/Monitor_Base.inl9
-rw-r--r--dep/ACE_wrappers/ace/Monitor_Control_Action.cpp12
-rw-r--r--dep/ACE_wrappers/ace/Monitor_Control_Action.h14
-rw-r--r--dep/ACE_wrappers/ace/Monitor_Control_Types.cpp16
-rw-r--r--dep/ACE_wrappers/ace/Monitor_Control_Types.h23
-rw-r--r--dep/ACE_wrappers/ace/Monitor_Point_Registry.cpp38
-rw-r--r--dep/ACE_wrappers/ace/Monitor_Point_Registry.h25
-rw-r--r--dep/ACE_wrappers/ace/Monitor_Size.cpp12
-rw-r--r--dep/ACE_wrappers/ace/Monitor_Size.h15
-rw-r--r--dep/ACE_wrappers/ace/Msg_WFMO_Reactor.cpp16
-rw-r--r--dep/ACE_wrappers/ace/Msg_WFMO_Reactor.h19
-rw-r--r--dep/ACE_wrappers/ace/Msg_WFMO_Reactor.inl8
-rw-r--r--dep/ACE_wrappers/ace/Multihomed_INET_Addr.cpp55
-rw-r--r--dep/ACE_wrappers/ace/Multihomed_INET_Addr.h33
-rw-r--r--dep/ACE_wrappers/ace/Multihomed_INET_Addr.inl3
-rw-r--r--dep/ACE_wrappers/ace/Mutex.cpp15
-rw-r--r--dep/ACE_wrappers/ace/Mutex.h36
-rw-r--r--dep/ACE_wrappers/ace/Mutex.inl15
-rw-r--r--dep/ACE_wrappers/ace/NT_Service.cpp99
-rw-r--r--dep/ACE_wrappers/ace/NT_Service.h62
-rw-r--r--dep/ACE_wrappers/ace/NT_Service.inl9
-rw-r--r--dep/ACE_wrappers/ace/Name_Proxy.cpp33
-rw-r--r--dep/ACE_wrappers/ace/Name_Proxy.h22
-rw-r--r--dep/ACE_wrappers/ace/Name_Request_Reply.cpp90
-rw-r--r--dep/ACE_wrappers/ace/Name_Request_Reply.h59
-rw-r--r--dep/ACE_wrappers/ace/Name_Space.cpp12
-rw-r--r--dep/ACE_wrappers/ace/Name_Space.h35
-rw-r--r--dep/ACE_wrappers/ace/Naming_Context.cpp87
-rw-r--r--dep/ACE_wrappers/ace/Naming_Context.h81
-rw-r--r--dep/ACE_wrappers/ace/Naming_Context.inl6
-rw-r--r--dep/ACE_wrappers/ace/Netlink_Addr.cpp16
-rw-r--r--dep/ACE_wrappers/ace/Netlink_Addr.h24
-rw-r--r--dep/ACE_wrappers/ace/Netlink_Addr.inl12
-rw-r--r--dep/ACE_wrappers/ace/Node.h15
-rw-r--r--dep/ACE_wrappers/ace/Notification_Queue.cpp51
-rw-r--r--dep/ACE_wrappers/ace/Notification_Queue.h26
-rw-r--r--dep/ACE_wrappers/ace/Notification_Queue.inl8
-rw-r--r--dep/ACE_wrappers/ace/Notification_Strategy.cpp6
-rw-r--r--dep/ACE_wrappers/ace/Notification_Strategy.h17
-rw-r--r--dep/ACE_wrappers/ace/Notification_Strategy.inl6
-rw-r--r--dep/ACE_wrappers/ace/Null_Barrier.h12
-rw-r--r--dep/ACE_wrappers/ace/Null_Condition.h20
-rw-r--r--dep/ACE_wrappers/ace/Null_Mutex.h40
-rw-r--r--dep/ACE_wrappers/ace/Null_Semaphore.h22
-rw-r--r--dep/ACE_wrappers/ace/Numeric_Limits.h41
-rw-r--r--dep/ACE_wrappers/ace/OS.h58
-rw-r--r--dep/ACE_wrappers/ace/OS.inl17
-rw-r--r--dep/ACE_wrappers/ace/OS_Dirent.h7
-rw-r--r--dep/ACE_wrappers/ace/OS_Errno.cpp11
-rw-r--r--dep/ACE_wrappers/ace/OS_Errno.h18
-rw-r--r--dep/ACE_wrappers/ace/OS_Errno.inl9
-rw-r--r--dep/ACE_wrappers/ace/OS_Log_Msg_Attributes.cpp3
-rw-r--r--dep/ACE_wrappers/ace/OS_Log_Msg_Attributes.h18
-rw-r--r--dep/ACE_wrappers/ace/OS_Log_Msg_Attributes.inl3
-rw-r--r--dep/ACE_wrappers/ace/OS_Memory.h31
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_Thread.cpp512
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_Thread.inl311
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_arpa_inet.cpp7
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_arpa_inet.h18
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_arpa_inet.inl17
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_ctype.cpp4
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_ctype.h31
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_ctype.inl18
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_dirent.cpp40
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_dirent.h30
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_dirent.inl18
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_dlfcn.cpp4
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_dlfcn.h17
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_dlfcn.inl33
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_errno.cpp4
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_errno.h22
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_errno.inl13
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_fcntl.cpp34
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_fcntl.h16
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_fcntl.inl4
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_macros.h21
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_math.cpp4
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_math.h23
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_math.inl7
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_netdb.cpp88
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_netdb.h29
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_netdb.inl57
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_poll.cpp4
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_poll.h16
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_poll.inl7
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_pwd.cpp4
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_pwd.h20
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_pwd.inl11
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_regex.cpp4
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_regex.h15
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_regex.inl7
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_signal.cpp6
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_signal.h35
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_signal.inl19
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_stdio.cpp52
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_stdio.h101
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_stdio.inl113
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_stdlib.cpp102
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_stdlib.h70
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_stdlib.inl50
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_string.cpp52
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_string.h85
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_string.inl56
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_strings.cpp15
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_strings.h20
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_strings.inl7
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_stropts.cpp23
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_stropts.h31
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_stropts.inl21
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_sys_mman.cpp4
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_sys_mman.h20
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_sys_mman.inl28
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_sys_msg.cpp4
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_sys_msg.h17
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_sys_msg.inl11
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_sys_resource.cpp4
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_sys_resource.h16
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_sys_resource.inl12
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_sys_select.cpp4
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_sys_select.h17
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_sys_select.inl6
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_sys_sendfile.cpp12
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_sys_sendfile.h15
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_sys_sendfile.inl4
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_sys_shm.cpp4
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_sys_shm.h17
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_sys_shm.inl11
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_sys_socket.cpp17
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_sys_socket.h50
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_sys_socket.inl81
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_sys_stat.cpp4
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_sys_stat.h27
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_sys_stat.inl26
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_sys_time.cpp4
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_sys_time.h14
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_sys_time.inl14
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_sys_uio.cpp26
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_sys_uio.h17
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_sys_uio.inl5
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_sys_utsname.cpp19
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_sys_utsname.h14
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_sys_wait.cpp3
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_sys_wait.h16
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_sys_wait.inl12
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_time.cpp96
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_time.h46
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_time.inl52
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_unistd.cpp140
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_unistd.h88
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_unistd.inl93
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_wchar.cpp57
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_wchar.h37
-rw-r--r--dep/ACE_wrappers/ace/OS_NS_wchar.inl16
-rw-r--r--dep/ACE_wrappers/ace/OS_QoS.cpp51
-rw-r--r--dep/ACE_wrappers/ace/OS_QoS.h86
-rw-r--r--dep/ACE_wrappers/ace/OS_String.h5
-rw-r--r--dep/ACE_wrappers/ace/OS_TLI.cpp3
-rw-r--r--dep/ACE_wrappers/ace/OS_TLI.h46
-rw-r--r--dep/ACE_wrappers/ace/OS_TLI.inl53
-rw-r--r--dep/ACE_wrappers/ace/OS_Thread_Adapter.cpp25
-rw-r--r--dep/ACE_wrappers/ace/OS_Thread_Adapter.h13
-rw-r--r--dep/ACE_wrappers/ace/OS_main.cpp28
-rw-r--r--dep/ACE_wrappers/ace/OS_main.h49
-rw-r--r--dep/ACE_wrappers/ace/Obchunk.cpp9
-rw-r--r--dep/ACE_wrappers/ace/Obchunk.h17
-rw-r--r--dep/ACE_wrappers/ace/Obchunk.inl3
-rw-r--r--dep/ACE_wrappers/ace/Object_Manager.cpp124
-rw-r--r--dep/ACE_wrappers/ace/Object_Manager.h62
-rw-r--r--dep/ACE_wrappers/ace/Object_Manager.inl5
-rw-r--r--dep/ACE_wrappers/ace/Object_Manager_Base.cpp67
-rw-r--r--dep/ACE_wrappers/ace/Object_Manager_Base.h45
-rw-r--r--dep/ACE_wrappers/ace/Obstack.h8
-rw-r--r--dep/ACE_wrappers/ace/Obstack_T.h29
-rw-r--r--dep/ACE_wrappers/ace/Obstack_T.inl4
-rw-r--r--dep/ACE_wrappers/ace/PI_Malloc.cpp25
-rw-r--r--dep/ACE_wrappers/ace/PI_Malloc.h49
-rw-r--r--dep/ACE_wrappers/ace/PI_Malloc.inl7
-rw-r--r--dep/ACE_wrappers/ace/POSIX_Asynch_IO.cpp392
-rw-r--r--dep/ACE_wrappers/ace/POSIX_Asynch_IO.h210
-rw-r--r--dep/ACE_wrappers/ace/POSIX_CB_Proactor.cpp35
-rw-r--r--dep/ACE_wrappers/ace/POSIX_CB_Proactor.h22
-rw-r--r--dep/ACE_wrappers/ace/POSIX_Proactor.cpp328
-rw-r--r--dep/ACE_wrappers/ace/POSIX_Proactor.h113
-rw-r--r--dep/ACE_wrappers/ace/POSIX_Proactor.inl3
-rw-r--r--dep/ACE_wrappers/ace/Pagefile_Memory_Pool.cpp50
-rw-r--r--dep/ACE_wrappers/ace/Pagefile_Memory_Pool.h44
-rw-r--r--dep/ACE_wrappers/ace/Pagefile_Memory_Pool.inl11
-rw-r--r--dep/ACE_wrappers/ace/Pair.h8
-rw-r--r--dep/ACE_wrappers/ace/Pair_T.h29
-rw-r--r--dep/ACE_wrappers/ace/Pair_T.inl15
-rw-r--r--dep/ACE_wrappers/ace/Parse_Node.cpp156
-rw-r--r--dep/ACE_wrappers/ace/Parse_Node.h101
-rw-r--r--dep/ACE_wrappers/ace/Ping_Socket.cpp61
-rw-r--r--dep/ACE_wrappers/ace/Ping_Socket.h36
-rw-r--r--dep/ACE_wrappers/ace/Ping_Socket.inl3
-rw-r--r--dep/ACE_wrappers/ace/Pipe.cpp49
-rw-r--r--dep/ACE_wrappers/ace/Pipe.h39
-rw-r--r--dep/ACE_wrappers/ace/Pipe.inl22
-rw-r--r--dep/ACE_wrappers/ace/Priority_Reactor.cpp40
-rw-r--r--dep/ACE_wrappers/ace/Priority_Reactor.h21
-rw-r--r--dep/ACE_wrappers/ace/Proactor.cpp170
-rw-r--r--dep/ACE_wrappers/ace/Proactor.h123
-rw-r--r--dep/ACE_wrappers/ace/Proactor.inl20
-rw-r--r--dep/ACE_wrappers/ace/Proactor_Impl.cpp7
-rw-r--r--dep/ACE_wrappers/ace/Proactor_Impl.h41
-rw-r--r--dep/ACE_wrappers/ace/Process.cpp158
-rw-r--r--dep/ACE_wrappers/ace/Process.h121
-rw-r--r--dep/ACE_wrappers/ace/Process.inl56
-rw-r--r--dep/ACE_wrappers/ace/Process_Manager.cpp187
-rw-r--r--dep/ACE_wrappers/ace/Process_Manager.h65
-rw-r--r--dep/ACE_wrappers/ace/Process_Manager.inl3
-rw-r--r--dep/ACE_wrappers/ace/Process_Mutex.cpp10
-rw-r--r--dep/ACE_wrappers/ace/Process_Mutex.h32
-rw-r--r--dep/ACE_wrappers/ace/Process_Mutex.inl13
-rw-r--r--dep/ACE_wrappers/ace/Process_Semaphore.cpp18
-rw-r--r--dep/ACE_wrappers/ace/Process_Semaphore.h27
-rw-r--r--dep/ACE_wrappers/ace/Process_Semaphore.inl12
-rw-r--r--dep/ACE_wrappers/ace/Profile_Timer.cpp77
-rw-r--r--dep/ACE_wrappers/ace/Profile_Timer.h34
-rw-r--r--dep/ACE_wrappers/ace/Profile_Timer.inl26
-rw-r--r--dep/ACE_wrappers/ace/RB_Tree.h180
-rw-r--r--dep/ACE_wrappers/ace/RB_Tree.inl218
-rw-r--r--dep/ACE_wrappers/ace/RW_Mutex.cpp12
-rw-r--r--dep/ACE_wrappers/ace/RW_Mutex.h30
-rw-r--r--dep/ACE_wrappers/ace/RW_Mutex.inl12
-rw-r--r--dep/ACE_wrappers/ace/RW_Process_Mutex.cpp12
-rw-r--r--dep/ACE_wrappers/ace/RW_Process_Mutex.h26
-rw-r--r--dep/ACE_wrappers/ace/RW_Process_Mutex.inl12
-rw-r--r--dep/ACE_wrappers/ace/RW_Thread_Mutex.cpp11
-rw-r--r--dep/ACE_wrappers/ace/RW_Thread_Mutex.h16
-rw-r--r--dep/ACE_wrappers/ace/RW_Thread_Mutex.inl4
-rw-r--r--dep/ACE_wrappers/ace/Reactor.cpp85
-rw-r--r--dep/ACE_wrappers/ace/Reactor.h116
-rw-r--r--dep/ACE_wrappers/ace/Reactor.inl84
-rw-r--r--dep/ACE_wrappers/ace/Reactor_Impl.cpp5
-rw-r--r--dep/ACE_wrappers/ace/Reactor_Impl.h95
-rw-r--r--dep/ACE_wrappers/ace/Reactor_Notification_Strategy.cpp8
-rw-r--r--dep/ACE_wrappers/ace/Reactor_Notification_Strategy.h16
-rw-r--r--dep/ACE_wrappers/ace/Reactor_Notification_Strategy.inl4
-rw-r--r--dep/ACE_wrappers/ace/Reactor_Timer_Interface.cpp5
-rw-r--r--dep/ACE_wrappers/ace/Reactor_Timer_Interface.h17
-rw-r--r--dep/ACE_wrappers/ace/Reactor_Token_T.h15
-rw-r--r--dep/ACE_wrappers/ace/Read_Buffer.cpp32
-rw-r--r--dep/ACE_wrappers/ace/Read_Buffer.h29
-rw-r--r--dep/ACE_wrappers/ace/Read_Buffer.inl7
-rw-r--r--dep/ACE_wrappers/ace/Recursive_Thread_Mutex.cpp17
-rw-r--r--dep/ACE_wrappers/ace/Recursive_Thread_Mutex.h34
-rw-r--r--dep/ACE_wrappers/ace/Recursive_Thread_Mutex.inl15
-rw-r--r--dep/ACE_wrappers/ace/Recyclable.cpp6
-rw-r--r--dep/ACE_wrappers/ace/Recyclable.h20
-rw-r--r--dep/ACE_wrappers/ace/Recyclable.inl4
-rw-r--r--dep/ACE_wrappers/ace/Refcountable.h8
-rw-r--r--dep/ACE_wrappers/ace/Refcountable_T.h16
-rw-r--r--dep/ACE_wrappers/ace/Refcountable_T.inl6
-rw-r--r--dep/ACE_wrappers/ace/Refcounted_Auto_Ptr.h45
-rw-r--r--dep/ACE_wrappers/ace/Refcounted_Auto_Ptr.inl29
-rw-r--r--dep/ACE_wrappers/ace/Registry.cpp130
-rw-r--r--dep/ACE_wrappers/ace/Registry.h116
-rw-r--r--dep/ACE_wrappers/ace/Registry_Name_Space.cpp44
-rw-r--r--dep/ACE_wrappers/ace/Registry_Name_Space.h29
-rw-r--r--dep/ACE_wrappers/ace/Remote_Name_Space.cpp44
-rw-r--r--dep/ACE_wrappers/ace/Remote_Name_Space.h28
-rw-r--r--dep/ACE_wrappers/ace/Remote_Tokens.cpp81
-rw-r--r--dep/ACE_wrappers/ace/Remote_Tokens.h56
-rw-r--r--dep/ACE_wrappers/ace/Remote_Tokens.inl10
-rw-r--r--dep/ACE_wrappers/ace/Reverse_Lock_T.h27
-rw-r--r--dep/ACE_wrappers/ace/Reverse_Lock_T.inl4
-rw-r--r--dep/ACE_wrappers/ace/Rtems_init.c43
-rw-r--r--dep/ACE_wrappers/ace/SOCK.cpp29
-rw-r--r--dep/ACE_wrappers/ace/SOCK.h25
-rw-r--r--dep/ACE_wrappers/ace/SOCK.inl7
-rw-r--r--dep/ACE_wrappers/ace/SOCK_Acceptor.cpp53
-rw-r--r--dep/ACE_wrappers/ace/SOCK_Acceptor.h25
-rw-r--r--dep/ACE_wrappers/ace/SOCK_Acceptor.inl3
-rw-r--r--dep/ACE_wrappers/ace/SOCK_CODgram.cpp16
-rw-r--r--dep/ACE_wrappers/ace/SOCK_CODgram.h17
-rw-r--r--dep/ACE_wrappers/ace/SOCK_CODgram.inl4
-rw-r--r--dep/ACE_wrappers/ace/SOCK_Connector.cpp37
-rw-r--r--dep/ACE_wrappers/ace/SOCK_Connector.h24
-rw-r--r--dep/ACE_wrappers/ace/SOCK_Connector.inl7
-rw-r--r--dep/ACE_wrappers/ace/SOCK_Dgram.cpp85
-rw-r--r--dep/ACE_wrappers/ace/SOCK_Dgram.h36
-rw-r--r--dep/ACE_wrappers/ace/SOCK_Dgram.inl21
-rw-r--r--dep/ACE_wrappers/ace/SOCK_Dgram_Bcast.cpp64
-rw-r--r--dep/ACE_wrappers/ace/SOCK_Dgram_Bcast.h28
-rw-r--r--dep/ACE_wrappers/ace/SOCK_Dgram_Bcast.inl8
-rw-r--r--dep/ACE_wrappers/ace/SOCK_Dgram_Mcast.cpp133
-rw-r--r--dep/ACE_wrappers/ace/SOCK_Dgram_Mcast.h40
-rw-r--r--dep/ACE_wrappers/ace/SOCK_Dgram_Mcast.inl8
-rw-r--r--dep/ACE_wrappers/ace/SOCK_IO.cpp26
-rw-r--r--dep/ACE_wrappers/ace/SOCK_IO.h27
-rw-r--r--dep/ACE_wrappers/ace/SOCK_IO.inl14
-rw-r--r--dep/ACE_wrappers/ace/SOCK_Netlink.cpp22
-rw-r--r--dep/ACE_wrappers/ace/SOCK_Netlink.h19
-rw-r--r--dep/ACE_wrappers/ace/SOCK_Netlink.inl8
-rw-r--r--dep/ACE_wrappers/ace/SOCK_SEQPACK_Acceptor.cpp75
-rw-r--r--dep/ACE_wrappers/ace/SOCK_SEQPACK_Acceptor.h33
-rw-r--r--dep/ACE_wrappers/ace/SOCK_SEQPACK_Acceptor.inl3
-rw-r--r--dep/ACE_wrappers/ace/SOCK_SEQPACK_Association.cpp56
-rw-r--r--dep/ACE_wrappers/ace/SOCK_SEQPACK_Association.h34
-rw-r--r--dep/ACE_wrappers/ace/SOCK_SEQPACK_Association.inl18
-rw-r--r--dep/ACE_wrappers/ace/SOCK_SEQPACK_Connector.cpp54
-rw-r--r--dep/ACE_wrappers/ace/SOCK_SEQPACK_Connector.h29
-rw-r--r--dep/ACE_wrappers/ace/SOCK_SEQPACK_Connector.inl7
-rw-r--r--dep/ACE_wrappers/ace/SOCK_Stream.cpp9
-rw-r--r--dep/ACE_wrappers/ace/SOCK_Stream.h29
-rw-r--r--dep/ACE_wrappers/ace/SOCK_Stream.inl18
-rw-r--r--dep/ACE_wrappers/ace/SPIPE.cpp18
-rw-r--r--dep/ACE_wrappers/ace/SPIPE.h19
-rw-r--r--dep/ACE_wrappers/ace/SPIPE.inl3
-rw-r--r--dep/ACE_wrappers/ace/SPIPE_Acceptor.cpp47
-rw-r--r--dep/ACE_wrappers/ace/SPIPE_Acceptor.h22
-rw-r--r--dep/ACE_wrappers/ace/SPIPE_Addr.cpp32
-rw-r--r--dep/ACE_wrappers/ace/SPIPE_Addr.h33
-rw-r--r--dep/ACE_wrappers/ace/SPIPE_Addr.inl13
-rw-r--r--dep/ACE_wrappers/ace/SPIPE_Connector.cpp23
-rw-r--r--dep/ACE_wrappers/ace/SPIPE_Connector.h15
-rw-r--r--dep/ACE_wrappers/ace/SPIPE_Connector.inl3
-rw-r--r--dep/ACE_wrappers/ace/SPIPE_Stream.cpp19
-rw-r--r--dep/ACE_wrappers/ace/SPIPE_Stream.h36
-rw-r--r--dep/ACE_wrappers/ace/SPIPE_Stream.inl31
-rw-r--r--dep/ACE_wrappers/ace/SString.cpp95
-rw-r--r--dep/ACE_wrappers/ace/SString.h87
-rw-r--r--dep/ACE_wrappers/ace/SString.inl54
-rw-r--r--dep/ACE_wrappers/ace/SStringfwd.h14
-rw-r--r--dep/ACE_wrappers/ace/SUN_Proactor.cpp60
-rw-r--r--dep/ACE_wrappers/ace/SUN_Proactor.h22
-rw-r--r--dep/ACE_wrappers/ace/SV_Message.cpp7
-rw-r--r--dep/ACE_wrappers/ace/SV_Message.h17
-rw-r--r--dep/ACE_wrappers/ace/SV_Message.inl7
-rw-r--r--dep/ACE_wrappers/ace/SV_Message_Queue.cpp10
-rw-r--r--dep/ACE_wrappers/ace/SV_Message_Queue.h24
-rw-r--r--dep/ACE_wrappers/ace/SV_Message_Queue.inl13
-rw-r--r--dep/ACE_wrappers/ace/SV_Semaphore_Complex.cpp45
-rw-r--r--dep/ACE_wrappers/ace/SV_Semaphore_Complex.h27
-rw-r--r--dep/ACE_wrappers/ace/SV_Semaphore_Complex.inl13
-rw-r--r--dep/ACE_wrappers/ace/SV_Semaphore_Simple.cpp37
-rw-r--r--dep/ACE_wrappers/ace/SV_Semaphore_Simple.h37
-rw-r--r--dep/ACE_wrappers/ace/SV_Semaphore_Simple.inl22
-rw-r--r--dep/ACE_wrappers/ace/SV_Shared_Memory.cpp15
-rw-r--r--dep/ACE_wrappers/ace/SV_Shared_Memory.h29
-rw-r--r--dep/ACE_wrappers/ace/SV_Shared_Memory.inl20
-rw-r--r--dep/ACE_wrappers/ace/Sample_History.cpp12
-rw-r--r--dep/ACE_wrappers/ace/Sample_History.h20
-rw-r--r--dep/ACE_wrappers/ace/Sample_History.inl6
-rw-r--r--dep/ACE_wrappers/ace/Sbrk_Memory_Pool.cpp25
-rw-r--r--dep/ACE_wrappers/ace/Sbrk_Memory_Pool.h26
-rw-r--r--dep/ACE_wrappers/ace/Sched_Params.cpp27
-rw-r--r--dep/ACE_wrappers/ace/Sched_Params.h35
-rw-r--r--dep/ACE_wrappers/ace/Sched_Params.inl21
-rw-r--r--dep/ACE_wrappers/ace/Select_Reactor.h13
-rw-r--r--dep/ACE_wrappers/ace/Select_Reactor_Base.cpp178
-rw-r--r--dep/ACE_wrappers/ace/Select_Reactor_Base.h118
-rw-r--r--dep/ACE_wrappers/ace/Select_Reactor_Base.inl22
-rw-r--r--dep/ACE_wrappers/ace/Select_Reactor_T.h120
-rw-r--r--dep/ACE_wrappers/ace/Select_Reactor_T.inl38
-rw-r--r--dep/ACE_wrappers/ace/Semaphore.cpp12
-rw-r--r--dep/ACE_wrappers/ace/Semaphore.h30
-rw-r--r--dep/ACE_wrappers/ace/Semaphore.inl19
-rw-r--r--dep/ACE_wrappers/ace/Service_Config.cpp102
-rw-r--r--dep/ACE_wrappers/ace/Service_Config.h98
-rw-r--r--dep/ACE_wrappers/ace/Service_Config.inl27
-rw-r--r--dep/ACE_wrappers/ace/Service_Gestalt.cpp191
-rw-r--r--dep/ACE_wrappers/ace/Service_Gestalt.h76
-rw-r--r--dep/ACE_wrappers/ace/Service_Gestalt.inl13
-rw-r--r--dep/ACE_wrappers/ace/Service_Manager.cpp76
-rw-r--r--dep/ACE_wrappers/ace/Service_Manager.h25
-rw-r--r--dep/ACE_wrappers/ace/Service_Object.cpp32
-rw-r--r--dep/ACE_wrappers/ace/Service_Object.h40
-rw-r--r--dep/ACE_wrappers/ace/Service_Object.inl13
-rw-r--r--dep/ACE_wrappers/ace/Service_Repository.cpp100
-rw-r--r--dep/ACE_wrappers/ace/Service_Repository.h58
-rw-r--r--dep/ACE_wrappers/ace/Service_Repository.inl10
-rw-r--r--dep/ACE_wrappers/ace/Service_Templates.h5
-rw-r--r--dep/ACE_wrappers/ace/Service_Types.cpp88
-rw-r--r--dep/ACE_wrappers/ace/Service_Types.h42
-rw-r--r--dep/ACE_wrappers/ace/Service_Types.inl7
-rw-r--r--dep/ACE_wrappers/ace/Shared_Memory.cpp5
-rw-r--r--dep/ACE_wrappers/ace/Shared_Memory.h12
-rw-r--r--dep/ACE_wrappers/ace/Shared_Memory_MM.cpp22
-rw-r--r--dep/ACE_wrappers/ace/Shared_Memory_MM.h24
-rw-r--r--dep/ACE_wrappers/ace/Shared_Memory_MM.inl6
-rw-r--r--dep/ACE_wrappers/ace/Shared_Memory_Pool.cpp75
-rw-r--r--dep/ACE_wrappers/ace/Shared_Memory_Pool.h46
-rw-r--r--dep/ACE_wrappers/ace/Shared_Memory_SV.cpp17
-rw-r--r--dep/ACE_wrappers/ace/Shared_Memory_SV.h21
-rw-r--r--dep/ACE_wrappers/ace/Shared_Memory_SV.inl6
-rw-r--r--dep/ACE_wrappers/ace/Shared_Object.cpp14
-rw-r--r--dep/ACE_wrappers/ace/Shared_Object.h17
-rw-r--r--dep/ACE_wrappers/ace/Shared_Object.inl3
-rw-r--r--dep/ACE_wrappers/ace/Sig_Adapter.cpp13
-rw-r--r--dep/ACE_wrappers/ace/Sig_Adapter.h18
-rw-r--r--dep/ACE_wrappers/ace/Sig_Handler.cpp108
-rw-r--r--dep/ACE_wrappers/ace/Sig_Handler.h38
-rw-r--r--dep/ACE_wrappers/ace/Sig_Handler.inl2
-rw-r--r--dep/ACE_wrappers/ace/Signal.cpp38
-rw-r--r--dep/ACE_wrappers/ace/Signal.h57
-rw-r--r--dep/ACE_wrappers/ace/Signal.inl36
-rw-r--r--dep/ACE_wrappers/ace/Singleton.h50
-rw-r--r--dep/ACE_wrappers/ace/Singleton.inl9
-rw-r--r--dep/ACE_wrappers/ace/Sock_Connect.cpp220
-rw-r--r--dep/ACE_wrappers/ace/Sock_Connect.h20
-rw-r--r--dep/ACE_wrappers/ace/Stack_Trace.cpp112
-rw-r--r--dep/ACE_wrappers/ace/Stack_Trace.h13
-rw-r--r--dep/ACE_wrappers/ace/Static_Object_Lock.h19
-rw-r--r--dep/ACE_wrappers/ace/Stats.cpp55
-rw-r--r--dep/ACE_wrappers/ace/Stats.h44
-rw-r--r--dep/ACE_wrappers/ace/Stats.inl15
-rw-r--r--dep/ACE_wrappers/ace/Strategies.h6
-rw-r--r--dep/ACE_wrappers/ace/Strategies_T.h210
-rw-r--r--dep/ACE_wrappers/ace/Strategies_T.inl28
-rw-r--r--dep/ACE_wrappers/ace/Stream.h52
-rw-r--r--dep/ACE_wrappers/ace/Stream.inl8
-rw-r--r--dep/ACE_wrappers/ace/Stream_Modules.h29
-rw-r--r--dep/ACE_wrappers/ace/String_Base.h72
-rw-r--r--dep/ACE_wrappers/ace/String_Base.inl27
-rw-r--r--dep/ACE_wrappers/ace/String_Base_Const.cpp4
-rw-r--r--dep/ACE_wrappers/ace/String_Base_Const.h12
-rw-r--r--dep/ACE_wrappers/ace/Svc_Conf.h25
-rw-r--r--dep/ACE_wrappers/ace/Svc_Conf_Lexer.cpp58
-rw-r--r--dep/ACE_wrappers/ace/Svc_Conf_Lexer.h13
-rw-r--r--dep/ACE_wrappers/ace/Svc_Conf_Param.h31
-rw-r--r--dep/ACE_wrappers/ace/Svc_Conf_Token_Table.h11
-rw-r--r--dep/ACE_wrappers/ace/Svc_Conf_Tokens.h6
-rw-r--r--dep/ACE_wrappers/ace/Svc_Conf_y.cpp309
-rw-r--r--dep/ACE_wrappers/ace/Svc_Handler.h65
-rw-r--r--dep/ACE_wrappers/ace/Synch.h11
-rw-r--r--dep/ACE_wrappers/ace/Synch_Options.cpp21
-rw-r--r--dep/ACE_wrappers/ace/Synch_Options.h29
-rw-r--r--dep/ACE_wrappers/ace/Synch_T.h9
-rw-r--r--dep/ACE_wrappers/ace/Synch_Traits.h24
-rw-r--r--dep/ACE_wrappers/ace/System_Time.cpp21
-rw-r--r--dep/ACE_wrappers/ace/System_Time.h22
-rw-r--r--dep/ACE_wrappers/ace/TLI.cpp37
-rw-r--r--dep/ACE_wrappers/ace/TLI.h25
-rw-r--r--dep/ACE_wrappers/ace/TLI.inl8
-rw-r--r--dep/ACE_wrappers/ace/TLI_Acceptor.cpp77
-rw-r--r--dep/ACE_wrappers/ace/TLI_Acceptor.h26
-rw-r--r--dep/ACE_wrappers/ace/TLI_Connector.cpp39
-rw-r--r--dep/ACE_wrappers/ace/TLI_Connector.h17
-rw-r--r--dep/ACE_wrappers/ace/TLI_Connector.inl4
-rw-r--r--dep/ACE_wrappers/ace/TLI_Stream.cpp38
-rw-r--r--dep/ACE_wrappers/ace/TLI_Stream.h32
-rw-r--r--dep/ACE_wrappers/ace/TLI_Stream.inl5
-rw-r--r--dep/ACE_wrappers/ace/TP_Reactor.cpp131
-rw-r--r--dep/ACE_wrappers/ace/TP_Reactor.h57
-rw-r--r--dep/ACE_wrappers/ace/TP_Reactor.inl18
-rw-r--r--dep/ACE_wrappers/ace/TSS_Adapter.cpp7
-rw-r--r--dep/ACE_wrappers/ace/TSS_Adapter.h12
-rw-r--r--dep/ACE_wrappers/ace/TSS_T.h33
-rw-r--r--dep/ACE_wrappers/ace/TSS_T.inl11
-rw-r--r--dep/ACE_wrappers/ace/TTY_IO.cpp55
-rw-r--r--dep/ACE_wrappers/ace/TTY_IO.h12
-rw-r--r--dep/ACE_wrappers/ace/Task.cpp46
-rw-r--r--dep/ACE_wrappers/ace/Task.h44
-rw-r--r--dep/ACE_wrappers/ace/Task.inl13
-rw-r--r--dep/ACE_wrappers/ace/Task_Ex_T.h42
-rw-r--r--dep/ACE_wrappers/ace/Task_Ex_T.inl15
-rw-r--r--dep/ACE_wrappers/ace/Task_T.h43
-rw-r--r--dep/ACE_wrappers/ace/Task_T.inl15
-rw-r--r--dep/ACE_wrappers/ace/Test_and_Set.h15
-rw-r--r--dep/ACE_wrappers/ace/Thread.cpp15
-rw-r--r--dep/ACE_wrappers/ace/Thread.h41
-rw-r--r--dep/ACE_wrappers/ace/Thread.inl45
-rw-r--r--dep/ACE_wrappers/ace/Thread_Adapter.cpp34
-rw-r--r--dep/ACE_wrappers/ace/Thread_Adapter.h20
-rw-r--r--dep/ACE_wrappers/ace/Thread_Adapter.inl3
-rw-r--r--dep/ACE_wrappers/ace/Thread_Control.cpp19
-rw-r--r--dep/ACE_wrappers/ace/Thread_Control.h21
-rw-r--r--dep/ACE_wrappers/ace/Thread_Control.inl10
-rw-r--r--dep/ACE_wrappers/ace/Thread_Exit.cpp29
-rw-r--r--dep/ACE_wrappers/ace/Thread_Exit.h22
-rw-r--r--dep/ACE_wrappers/ace/Thread_Hook.cpp8
-rw-r--r--dep/ACE_wrappers/ace/Thread_Hook.h14
-rw-r--r--dep/ACE_wrappers/ace/Thread_Manager.cpp355
-rw-r--r--dep/ACE_wrappers/ace/Thread_Manager.h181
-rw-r--r--dep/ACE_wrappers/ace/Thread_Manager.inl44
-rw-r--r--dep/ACE_wrappers/ace/Thread_Mutex.cpp14
-rw-r--r--dep/ACE_wrappers/ace/Thread_Mutex.h30
-rw-r--r--dep/ACE_wrappers/ace/Thread_Mutex.inl14
-rw-r--r--dep/ACE_wrappers/ace/Thread_Semaphore.cpp13
-rw-r--r--dep/ACE_wrappers/ace/Thread_Semaphore.h18
-rw-r--r--dep/ACE_wrappers/ace/Thread_Semaphore.inl3
-rw-r--r--dep/ACE_wrappers/ace/Throughput_Stats.cpp29
-rw-r--r--dep/ACE_wrappers/ace/Throughput_Stats.h16
-rw-r--r--dep/ACE_wrappers/ace/Time_Value.cpp40
-rw-r--r--dep/ACE_wrappers/ace/Time_Value.h74
-rw-r--r--dep/ACE_wrappers/ace/Time_Value.inl69
-rw-r--r--dep/ACE_wrappers/ace/Timeprobe.cpp6
-rw-r--r--dep/ACE_wrappers/ace/Timeprobe.h40
-rw-r--r--dep/ACE_wrappers/ace/Timeprobe.inl3
-rw-r--r--dep/ACE_wrappers/ace/Timeprobe_T.h50
-rw-r--r--dep/ACE_wrappers/ace/Timer_Hash.h17
-rw-r--r--dep/ACE_wrappers/ace/Timer_Hash_T.h63
-rw-r--r--dep/ACE_wrappers/ace/Timer_Heap.h10
-rw-r--r--dep/ACE_wrappers/ace/Timer_Heap_T.h59
-rw-r--r--dep/ACE_wrappers/ace/Timer_List.h10
-rw-r--r--dep/ACE_wrappers/ace/Timer_List_T.h43
-rw-r--r--dep/ACE_wrappers/ace/Timer_Queue.h13
-rw-r--r--dep/ACE_wrappers/ace/Timer_Queue_Adapters.h52
-rw-r--r--dep/ACE_wrappers/ace/Timer_Queue_Adapters.inl5
-rw-r--r--dep/ACE_wrappers/ace/Timer_Queue_T.h107
-rw-r--r--dep/ACE_wrappers/ace/Timer_Queue_T.inl30
-rw-r--r--dep/ACE_wrappers/ace/Timer_Queuefwd.h11
-rw-r--r--dep/ACE_wrappers/ace/Timer_Wheel.h10
-rw-r--r--dep/ACE_wrappers/ace/Timer_Wheel_T.h41
-rw-r--r--dep/ACE_wrappers/ace/Token.cpp96
-rw-r--r--dep/ACE_wrappers/ace/Token.h81
-rw-r--r--dep/ACE_wrappers/ace/Token.inl30
-rw-r--r--dep/ACE_wrappers/ace/Token_Collection.cpp45
-rw-r--r--dep/ACE_wrappers/ace/Token_Collection.h39
-rw-r--r--dep/ACE_wrappers/ace/Token_Collection.inl5
-rw-r--r--dep/ACE_wrappers/ace/Token_Invariants.cpp61
-rw-r--r--dep/ACE_wrappers/ace/Token_Invariants.h55
-rw-r--r--dep/ACE_wrappers/ace/Token_Manager.cpp44
-rw-r--r--dep/ACE_wrappers/ace/Token_Manager.h32
-rw-r--r--dep/ACE_wrappers/ace/Token_Manager.inl6
-rw-r--r--dep/ACE_wrappers/ace/Token_Request_Reply.cpp34
-rw-r--r--dep/ACE_wrappers/ace/Token_Request_Reply.h63
-rw-r--r--dep/ACE_wrappers/ace/Token_Request_Reply.inl35
-rw-r--r--dep/ACE_wrappers/ace/Trace.cpp27
-rw-r--r--dep/ACE_wrappers/ace/Trace.h23
-rw-r--r--dep/ACE_wrappers/ace/Truncate.h128
-rw-r--r--dep/ACE_wrappers/ace/Typed_SV_Message.h27
-rw-r--r--dep/ACE_wrappers/ace/Typed_SV_Message.inl14
-rw-r--r--dep/ACE_wrappers/ace/Typed_SV_Message_Queue.h20
-rw-r--r--dep/ACE_wrappers/ace/Typed_SV_Message_Queue.inl15
-rw-r--r--dep/ACE_wrappers/ace/UNIX_Addr.cpp32
-rw-r--r--dep/ACE_wrappers/ace/UNIX_Addr.h33
-rw-r--r--dep/ACE_wrappers/ace/UNIX_Addr.inl13
-rw-r--r--dep/ACE_wrappers/ace/UPIPE_Acceptor.cpp28
-rw-r--r--dep/ACE_wrappers/ace/UPIPE_Acceptor.h23
-rw-r--r--dep/ACE_wrappers/ace/UPIPE_Acceptor.inl3
-rw-r--r--dep/ACE_wrappers/ace/UPIPE_Addr.h10
-rw-r--r--dep/ACE_wrappers/ace/UPIPE_Connector.cpp20
-rw-r--r--dep/ACE_wrappers/ace/UPIPE_Connector.h18
-rw-r--r--dep/ACE_wrappers/ace/UPIPE_Connector.inl4
-rw-r--r--dep/ACE_wrappers/ace/UPIPE_Stream.cpp42
-rw-r--r--dep/ACE_wrappers/ace/UPIPE_Stream.h35
-rw-r--r--dep/ACE_wrappers/ace/UPIPE_Stream.inl3
-rw-r--r--dep/ACE_wrappers/ace/UTF16_Encoding_Converter.cpp37
-rw-r--r--dep/ACE_wrappers/ace/UTF16_Encoding_Converter.h18
-rw-r--r--dep/ACE_wrappers/ace/UTF16_Encoding_Converter.inl10
-rw-r--r--dep/ACE_wrappers/ace/UTF32_Encoding_Converter.cpp28
-rw-r--r--dep/ACE_wrappers/ace/UTF32_Encoding_Converter.h13
-rw-r--r--dep/ACE_wrappers/ace/UTF8_Encoding_Converter.cpp12
-rw-r--r--dep/ACE_wrappers/ace/UTF8_Encoding_Converter.h14
-rw-r--r--dep/ACE_wrappers/ace/UUID.cpp71
-rw-r--r--dep/ACE_wrappers/ace/UUID.h58
-rw-r--r--dep/ACE_wrappers/ace/UUID.inl28
-rw-r--r--dep/ACE_wrappers/ace/Unbounded_Queue.h59
-rw-r--r--dep/ACE_wrappers/ace/Unbounded_Queue.inl5
-rw-r--r--dep/ACE_wrappers/ace/Unbounded_Set.h21
-rw-r--r--dep/ACE_wrappers/ace/Unbounded_Set.inl11
-rw-r--r--dep/ACE_wrappers/ace/Unbounded_Set_Ex.h72
-rw-r--r--dep/ACE_wrappers/ace/Unbounded_Set_Ex.inl5
-rw-r--r--dep/ACE_wrappers/ace/Value_Ptr.h33
-rw-r--r--dep/ACE_wrappers/ace/Vector_T.h45
-rw-r--r--dep/ACE_wrappers/ace/Vector_T.inl19
-rw-r--r--dep/ACE_wrappers/ace/Version.h1
-rw-r--r--dep/ACE_wrappers/ace/Versioned_Namespace.h11
-rw-r--r--dep/ACE_wrappers/ace/WFMO_Reactor.cpp386
-rw-r--r--dep/ACE_wrappers/ace/WFMO_Reactor.h240
-rw-r--r--dep/ACE_wrappers/ace/WFMO_Reactor.inl193
-rw-r--r--dep/ACE_wrappers/ace/WIN32_Asynch_IO.cpp579
-rw-r--r--dep/ACE_wrappers/ace/WIN32_Asynch_IO.h355
-rw-r--r--dep/ACE_wrappers/ace/WIN32_Proactor.cpp88
-rw-r--r--dep/ACE_wrappers/ace/WIN32_Proactor.h52
-rw-r--r--dep/ACE_wrappers/ace/XML_Svc_Conf.cpp6
-rw-r--r--dep/ACE_wrappers/ace/XML_Svc_Conf.h16
-rw-r--r--dep/ACE_wrappers/ace/XTI_ATM_Mcast.cpp15
-rw-r--r--dep/ACE_wrappers/ace/XTI_ATM_Mcast.h19
-rw-r--r--dep/ACE_wrappers/ace/XTI_ATM_Mcast.inl5
-rw-r--r--dep/ACE_wrappers/ace/ace.rc2
-rw-r--r--dep/ACE_wrappers/ace/ace_wchar.cpp5
-rw-r--r--dep/ACE_wrappers/ace/ace_wchar.h49
-rw-r--r--dep/ACE_wrappers/ace/ace_wchar.inl25
-rw-r--r--dep/ACE_wrappers/ace/checked_iterator.h5
-rw-r--r--dep/ACE_wrappers/ace/config-WinCE.h48
-rw-r--r--dep/ACE_wrappers/ace/config-aix-5.x.h68
-rw-r--r--dep/ACE_wrappers/ace/config-all.h17
-rw-r--r--dep/ACE_wrappers/ace/config-borland-common.h8
-rw-r--r--dep/ACE_wrappers/ace/config-cray.h67
-rw-r--r--dep/ACE_wrappers/ace/config-cxx-common.h13
-rw-r--r--dep/ACE_wrappers/ace/config-cygwin32.h51
-rw-r--r--dep/ACE_wrappers/ace/config-doxygen.h27
-rw-r--r--dep/ACE_wrappers/ace/config-freebsd.h67
-rw-r--r--dep/ACE_wrappers/ace/config-g++-common.h20
-rw-r--r--dep/ACE_wrappers/ace/config-ghs-common.h9
-rw-r--r--dep/ACE_wrappers/ace/config-hpux-11.00.h102
-rw-r--r--dep/ACE_wrappers/ace/config-icc-common.h16
-rw-r--r--dep/ACE_wrappers/ace/config-integritySCA.h33
-rw-r--r--dep/ACE_wrappers/ace/config-irix6.5.x-sgic++.h5
-rw-r--r--dep/ACE_wrappers/ace/config-irix6.x-common.h67
-rw-r--r--dep/ACE_wrappers/ace/config-irix6.x-g++.h6
-rw-r--r--dep/ACE_wrappers/ace/config-irix6.x-sgic++.h8
-rw-r--r--dep/ACE_wrappers/ace/config-linux-common.h86
-rw-r--r--dep/ACE_wrappers/ace/config-linux.h18
-rw-r--r--dep/ACE_wrappers/ace/config-lite.h25
-rw-r--r--dep/ACE_wrappers/ace/config-lynxos.h18
-rw-r--r--dep/ACE_wrappers/ace/config-macosx-leopard.h60
-rw-r--r--dep/ACE_wrappers/ace/config-macosx-panther.h53
-rw-r--r--dep/ACE_wrappers/ace/config-macosx-tiger.h58
-rw-r--r--dep/ACE_wrappers/ace/config-macosx.h54
-rw-r--r--dep/ACE_wrappers/ace/config-macros.h85
-rw-r--r--dep/ACE_wrappers/ace/config-minimal.h9
-rw-r--r--dep/ACE_wrappers/ace/config-mvs.h16
-rw-r--r--dep/ACE_wrappers/ace/config-netbsd.h14
-rw-r--r--dep/ACE_wrappers/ace/config-openbsd.h65
-rw-r--r--dep/ACE_wrappers/ace/config-openvms.h28
-rw-r--r--dep/ACE_wrappers/ace/config-pharlap.h15
-rw-r--r--dep/ACE_wrappers/ace/config-posix-nonetworking.h8
-rw-r--r--dep/ACE_wrappers/ace/config-posix.h11
-rw-r--r--dep/ACE_wrappers/ace/config-qnx-neutrino.h9
-rw-r--r--dep/ACE_wrappers/ace/config-qnx-rtp-62x.h7
-rw-r--r--dep/ACE_wrappers/ace/config-qnx-rtp-common.h8
-rw-r--r--dep/ACE_wrappers/ace/config-qnx-rtp-pre62x.h13
-rw-r--r--dep/ACE_wrappers/ace/config-qnx-rtp.h2
-rw-r--r--dep/ACE_wrappers/ace/config-rtems.h19
-rw-r--r--dep/ACE_wrappers/ace/config-sco-5.0.0-nothread.h4
-rw-r--r--dep/ACE_wrappers/ace/config-sco-5.0.0.h26
-rw-r--r--dep/ACE_wrappers/ace/config-suncc-common.h9
-rw-r--r--dep/ACE_wrappers/ace/config-sunos5.10.h13
-rw-r--r--dep/ACE_wrappers/ace/config-sunos5.11.h5
-rw-r--r--dep/ACE_wrappers/ace/config-sunos5.4-g++.h55
-rw-r--r--dep/ACE_wrappers/ace/config-sunos5.4-sunc++-4.x.h59
-rw-r--r--dep/ACE_wrappers/ace/config-sunos5.5.h91
-rw-r--r--dep/ACE_wrappers/ace/config-sunos5.6.h19
-rw-r--r--dep/ACE_wrappers/ace/config-sunos5.7.h21
-rw-r--r--dep/ACE_wrappers/ace/config-sunos5.8.h11
-rw-r--r--dep/ACE_wrappers/ace/config-sunos5.9.h6
-rw-r--r--dep/ACE_wrappers/ace/config-tandem-nsk-mips-v2.h107
-rw-r--r--dep/ACE_wrappers/ace/config-tandem-nsk-mips-v3.h125
-rw-r--r--dep/ACE_wrappers/ace/config-tandem.h45
-rw-r--r--dep/ACE_wrappers/ace/config-tru64.h22
-rw-r--r--dep/ACE_wrappers/ace/config-unixware-7.1.0.h120
-rw-r--r--dep/ACE_wrappers/ace/config-unixware-7.1.0.udk.h130
-rw-r--r--dep/ACE_wrappers/ace/config-visualage.h4
-rw-r--r--dep/ACE_wrappers/ace/config-vxworks.h6
-rw-r--r--dep/ACE_wrappers/ace/config-vxworks5.x.h36
-rw-r--r--dep/ACE_wrappers/ace/config-vxworks6.2.h29
-rw-r--r--dep/ACE_wrappers/ace/config-vxworks6.3.h25
-rw-r--r--dep/ACE_wrappers/ace/config-vxworks6.4.h26
-rw-r--r--dep/ACE_wrappers/ace/config-vxworks6.5.h7
-rw-r--r--dep/ACE_wrappers/ace/config-vxworks6.6.h8
-rw-r--r--dep/ACE_wrappers/ace/config-win32-borland.h22
-rw-r--r--dep/ACE_wrappers/ace/config-win32-common.h97
-rw-r--r--dep/ACE_wrappers/ace/config-win32-dmc.h15
-rw-r--r--dep/ACE_wrappers/ace/config-win32-ghs.h15
-rw-r--r--dep/ACE_wrappers/ace/config-win32-interix.h14
-rw-r--r--dep/ACE_wrappers/ace/config-win32-mingw.h17
-rw-r--r--dep/ACE_wrappers/ace/config-win32-msvc-7.h29
-rw-r--r--dep/ACE_wrappers/ace/config-win32-msvc-8.h32
-rw-r--r--dep/ACE_wrappers/ace/config-win32-msvc-9.h32
-rw-r--r--dep/ACE_wrappers/ace/config-win32-msvc.h19
-rw-r--r--dep/ACE_wrappers/ace/config-win32.h16
-rw-r--r--dep/ACE_wrappers/ace/gethrtime.cpp10
-rw-r--r--dep/ACE_wrappers/ace/iosfwd.h18
-rw-r--r--dep/ACE_wrappers/ace/os_include/arpa/os_inet.h14
-rw-r--r--dep/ACE_wrappers/ace/os_include/net/os_if.h16
-rw-r--r--dep/ACE_wrappers/ace/os_include/netinet/os_in.h33
-rw-r--r--dep/ACE_wrappers/ace/os_include/netinet/os_tcp.h10
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_aio.h11
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_assert.h10
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_byteswap.h9
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_complex.h9
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_cpio.h9
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_ctype.h10
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_dirent.h22
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_dlfcn.h16
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_errno.h26
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_fcntl.h18
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_fenv.h9
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_float.h9
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_fmtmsg.h9
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_fnmatch.h9
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_ftw.h10
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_glob.h9
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_grp.h10
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_iconv.h10
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_intrin.h12
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_inttypes.h11
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_iso646.h9
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_kstat.h10
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_langinfo.h10
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_libgen.h9
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_local.h10
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_math.h10
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_monetary.h10
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_mqueue.h10
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_ndbm.h10
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_netdb.h16
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_nl_types.h9
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_pdh.h10
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_pdhmsg.h9
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_poll.h9
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_pthread.h49
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_pwd.h12
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_regex.h11
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_sched.h11
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_search.h10
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_semaphore.h16
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_setjmp.h9
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_signal.h41
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_spawn.h10
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_stdarg.h10
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_stdbool.h9
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_stddef.h15
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_stdint.h26
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_stdio.h14
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_stdlib.h17
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_string.h14
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_strings.h12
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_stropts.h22
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_syslog.h9
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_tar.h9
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_termios.h10
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_tgmath.h10
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_time.h19
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_trace.h10
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_ucontext.h11
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_ulimit.h9
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_unistd.h34
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_utime.h10
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_utmpx.h10
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_wchar.h10
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_wctype.h10
-rw-r--r--dep/ACE_wrappers/ace/os_include/os_wordexp.h10
-rw-r--r--dep/ACE_wrappers/ace/os_include/sys/os_ipc.h17
-rw-r--r--dep/ACE_wrappers/ace/os_include/sys/os_loadavg.h9
-rw-r--r--dep/ACE_wrappers/ace/os_include/sys/os_mman.h20
-rw-r--r--dep/ACE_wrappers/ace/os_include/sys/os_msg.h12
-rw-r--r--dep/ACE_wrappers/ace/os_include/sys/os_pstat.h9
-rw-r--r--dep/ACE_wrappers/ace/os_include/sys/os_resource.h19
-rw-r--r--dep/ACE_wrappers/ace/os_include/sys/os_select.h12
-rw-r--r--dep/ACE_wrappers/ace/os_include/sys/os_sem.h19
-rw-r--r--dep/ACE_wrappers/ace/os_include/sys/os_shm.h11
-rw-r--r--dep/ACE_wrappers/ace/os_include/sys/os_socket.h60
-rw-r--r--dep/ACE_wrappers/ace/os_include/sys/os_stat.h28
-rw-r--r--dep/ACE_wrappers/ace/os_include/sys/os_statvfs.h9
-rw-r--r--dep/ACE_wrappers/ace/os_include/sys/os_sysctl.h9
-rw-r--r--dep/ACE_wrappers/ace/os_include/sys/os_sysinfo.h9
-rw-r--r--dep/ACE_wrappers/ace/os_include/sys/os_time.h12
-rw-r--r--dep/ACE_wrappers/ace/os_include/sys/os_timeb.h11
-rw-r--r--dep/ACE_wrappers/ace/os_include/sys/os_times.h10
-rw-r--r--dep/ACE_wrappers/ace/os_include/sys/os_types.h28
-rw-r--r--dep/ACE_wrappers/ace/os_include/sys/os_uio.h16
-rw-r--r--dep/ACE_wrappers/ace/os_include/sys/os_un.h11
-rw-r--r--dep/ACE_wrappers/ace/os_include/sys/os_utsname.h9
-rw-r--r--dep/ACE_wrappers/ace/os_include/sys/os_wait.h20
-rw-r--r--dep/ACE_wrappers/ace/post.h2
-rw-r--r--dep/ACE_wrappers/ace/pre.h2
-rw-r--r--dep/ACE_wrappers/ace/streams.h25
-rw-r--r--dep/ACE_wrappers/ace/svc_export.h8
1195 files changed, 45132 insertions, 3 deletions
diff --git a/dep/ACE_wrappers/README b/dep/ACE_wrappers/README
index f560fdda82c..1b46d7fd6f4 100644
--- a/dep/ACE_wrappers/README
+++ b/dep/ACE_wrappers/README
@@ -1,11 +1,18 @@
This document is also available at the following URL:
+
http://www.cs.wustl.edu/~schmidt/ACE.html
+
All software and documentation is available via both anonymous ftp and
the World Wide Web.]
+
THE ADAPTIVE COMMUNICATION ENVIRONMENT (ACE)
+
An Object-Oriented Network Programming Toolkit
+
----------------------------------------
+
Overview of ACE
+
The ADAPTIVE Communication Environment (ACE) is an object-oriented
(OO) toolkit that implements fundamental design patterns for
communication software. ACE provides a rich set of reusable C++
@@ -15,12 +22,14 @@ versions of UNIX (e.g., SunOS, HP-UX , AIX, Linux, NetBSD, and FreeBSD),
real-time operating systems (e.g., VxWorks, Chorus, LynxOS, and QNX),
OpenVMS, and MVS OpenEdition. A single source tree is used for all
these platforms and porting ACE to other platforms is relatively easy.
+
The communication software components provided by ACE include event
demultiplexing and event handler dispatching, service initialization,
interprocess communication, shared memory management, message routing,
dynamic (re)configuration of distributed services, multi-threading,
and concurrency control. There are both C++ and Java versions of ACE
available.
+
ACE is targeted for developers of high-performance and real-time
communication services and applications on UNIX, POSIX, and Win32
platforms. ACE simplifies the development of OO network applications
@@ -29,83 +38,115 @@ demultiplexing, explicit dynamic linking, and concurrency. ACE
automates system configuration and reconfiguration by dynamically
linking services into applications at run-time and executing these
services in one or more processes or threads.
+
ACE is currently used in commercial projects and products by dozens of
companies including Ericsson, Bellcore, Siemens, Motorola, Kodak,
Boeing, Lucent, DEC, Lockheed Martin, and SAIC. Commercial support
for ACE is available from several companies as listed at
http://www.cs.wustl.edu/~schmidt/commercial-support.html
+
----------------------------------------
+
C++ Wrappers for OS Interfaces
+
The lower-level portions of ACE provide a set of portable and
type-secure C++ wrappers that encapsulate the following C language OS
interfaces:
+
. IPC mechanisms
-- e.g., Internet- and UNIX-domain sockets, TLI, Named
Pipes (for UNIX and Win32) and STREAM pipes;
+
. Event demultiplexing
-- e.g., select(), poll(), and Win32
WaitForMultipleObjects and I/O completion ports;
+
. Multi-threading and synchronization
-- e.g., Solaris threads, POSIX Pthreads, and Win32
threads;
+
. Explicit dynamic linking
-- e.g., dlopen/dlsym on UNIX and LoadLibrary/GetProc
on Win32;
+
. Memory-mapped files and shared memory management
-- e.g., BSD mmap(), SYSV shared memory, and Win32
shared memory;
+
. System V IPC
-- e.g., shared memory, semaphores, message queues.
+
The OS Adaptation Layer shields the upper levels of ACE from platform
dependencies associated with the underlying OS interfaces.
+
----------------------------------------
+
Frameworks and Class Categories
+
ACE also contains a higher-level network programming framework that
integrates and enhances the lower-level C++ wrappers. This framework
supports the dynamic configuration of concurrent distributed services
into applications. The framework portion of ACE contains the
following class categories:
+
. The Reactor
-- Supports both Reactive and Proactive I/O;
+
. The Service Configurator
-- Support dynamic (re)configuration of objects;
+
. The ADAPTIVE Service Executive
-- A user-level implementation of System V STREAMS,
that supports modular integration of
hierarchically-related communicaion services;
+
. Concurrency
-- Various types of higher-level concurrency
control and synchronization patterns (such as
Polymorphic Futures and Active Objects);
+
. Shared Malloc
-- Components for managing dynamically allocation
of shared and local memory;
+
----------------------------------------
+
Distributed Services and Components
+
Finally, ACE provides a standard library of distributed services that
are packaged as components. These service components play two roles
in ACE:
+
1. They provide reusable components for common distributed
system tasks such as logging, naming, locking, and time
synchronization.
+
2. They illustrate how to utilize ACE features such as the
Reactor, Service Configurator, Service Initialization,
Concurrency, and IPC components.
+
----------------------------------------
+
Middleware Applications
+
ACE has been used in research and development projects at many
universities and companies. For instance, it has been used to build
avionics systems at Boeing, telecommunication systems at Bellcore,
Ericsson, Motorola, and Lucent; medical imaging systems at Siemens and
Kodak; and many academic research projects. Two example middleware
applications provided with the ACE release include:
+
1. The ACE ORB (TAO) -- TAO is a real-time implementation of
CORBA built using the framework components and patterns
provided by ACE.
+
2. JAWS -- JAWS is a high-performance, adaptive Web server
built using the components in ACE.
+
----------------------------------------
+
OBTAINING ACE
+
The current ACE release is provided as a tar file that is around 3 Meg
compressed using GNU gzip. ACE may be obtained electronically from
http://www.cs.wustl.edu/~schmidt/ACE-obtain.html. This release
@@ -114,25 +155,36 @@ contains the source code, test drivers, and example applications
network programming framework developed as part of the ADAPTIVE
project at the University of California, Irvine and at Washington
University, St. Louis.
+
You can get The ACE ORB (TAO) in a companion release at
http://www.cs.wustl.edu/~schmidt/TAO.html.
+
----------------------------------------
+
ACE DOCUMENTATION AND TUTORIALS
+
Many of the C++ wrappers and higher-level components have been
described in issues of the C++ Report, as well as in proceedings of
many journals, conferences, and workshops.
+
A collection of white papers and tutorial handouts are included at
ftp://wuarchive.wustl.edu/languages/c++/ACE/ACE-documentation. This
directory contains postscript versions of various papers that describe
different aspects of ACE.
+
I update these papers periodically to reflect changes to the ACE
architecture. Therefore, you might want to check the date on the
files to make sure that you have read the most recent versions of
these papers.
+
This material is also available available via the WWW at URL:
+
http://www.cs.wustl.edu/~schmidt/ACE.html
+
----------------------------------------
+
ACE MAILING LIST AND NEWSGROUP
+
A mailing list, ace-users@list.isis.vanderbilt.edu, is available for discussing
bug fixes, enhancements, and porting issues regarding ACE. Please
send mail to me at the ace-users-request@list.isis.vanderbilt.edu
@@ -140,22 +192,31 @@ if you'd like to join the mailing list. There is also a USENET newsgroup
called comp.soft-sys.ace. Please see
http://www.cs.wustl.edu/~schmidt/ACE-mail.html for details on how to
subscribe to the mailing list.
+
----------------------------------------
+
BUILDING AND INSTALLING ACE
+
Please refer to the http://www.cs.wustl.edu/~schmidt/ACE-install.html
file for information on how to build and test the ACE wrappers. The
BIBLIOGRAPHY file contains information on where to obtain articles
that describe the ACE wrappers and the ADAPTIVE system in more detail.
+
The current release has been tested extensively, but if you find any
bugs, please report them to the ACE mailing list
ace-users@cs.wustl.edu using the $ACE_ROOT/PROBLEM-REPORT-FORM.
Please use the same form to submit questions, comments, etc.
To ensure that you see responses, please do one of the following:
+
1) Subscribe to the ace-users mail list, by sending email with
contents "subscribe ace-users" to
ace-users-request@list.isis.vanderbilt.edu.
+
2) Or, monitor the comp.soft-sys.ace newsgroup for responses.
+
----------------------------------------
+
ACKNOWLEDGEMENTS
+
Please see the file `$ACE_ROOT/THANKS' for a list of the thousands of
people who've contributed to ACE and TAO over the years.
diff --git a/dep/ACE_wrappers/VERSION b/dep/ACE_wrappers/VERSION
index 5b1b3ee8ea6..0c1423ad06d 100644
--- a/dep/ACE_wrappers/VERSION
+++ b/dep/ACE_wrappers/VERSION
@@ -1,8 +1,11 @@
This is ACE version 5.6.6, released Mon Sep 15 06:08:04 CDT 2008
+
If you have any problems with or questions about ACE, please send
email to the ACE mailing list (ace-users@cs.wustl.edu), using the form
found in the file PROBLEM-REPORT-FORM. To ensure that you see responses,
please do one of the following:
+
1) Subscribe to the ace-users mail list, by sending email with
contents "subscribe ace-users" to majordomo@cs.wustl.edu.
+
2) Or, monitor the comp.soft-sys.ace newsgroup for responses.
diff --git a/dep/ACE_wrappers/ace/ACE.cpp b/dep/ACE_wrappers/ace/ACE.cpp
index 2f1fa64ba4e..7ccf15ed341 100644
--- a/dep/ACE_wrappers/ace/ACE.cpp
+++ b/dep/ACE_wrappers/ace/ACE.cpp
@@ -1,5 +1,7 @@
// $Id: ACE.cpp 82581 2008-08-11 08:58:24Z johnnyw $
+
#include "ace/ACE.h"
+
#include "ace/Basic_Types.h"
#include "ace/Handle_Set.h"
#include "ace/Auto_Ptr.h"
@@ -22,35 +24,45 @@
#include "ace/OS_NS_fcntl.h"
#include "ace/OS_TLI.h"
#include "ace/Truncate.h"
+
#if defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x620)
extern "C" int maxFiles;
#endif /* ACE_VXWORKS */
+
#if !defined (__ACE_INLINE__)
#include "ace/ACE.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_HAS_POLL) && defined (ACE_HAS_LIMITED_SELECT)
# include "ace/OS_NS_poll.h"
#endif /* ACE_HAS_POLL && ACE_HAS_LIMITED_SELECT */
+
ACE_RCSID (ace,
ACE,
"$Id: ACE.cpp 82581 2008-08-11 08:58:24Z johnnyw $")
+
// Open versioned namespace, if enabled by the user.
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE
{
// private:
// Used internally so not exported.
+
// Size of allocation granularity.
size_t allocation_granularity_ = 0;
+
// Size of a VM page.
size_t pagesize_ = 0;
+
// Are we debugging ACE?
// Keeps track of whether we're in some global debug mode.
char debug_;
}
+
int
ACE::out_of_handles (int error)
{
@@ -92,21 +104,25 @@ ACE::out_of_handles (int error)
else
return 0;
}
+
u_int
ACE::major_version (void)
{
return ACE_MAJOR_VERSION;
}
+
u_int
ACE::minor_version (void)
{
return ACE_MINOR_VERSION;
}
+
u_int
ACE::beta_version (void)
{
return ACE_BETA_VERSION;
}
+
const ACE_TCHAR *
ACE::compiler_name (void)
{
@@ -116,6 +132,7 @@ ACE::compiler_name (void)
return ACE_TEXT ("");
#endif
}
+
u_int
ACE::compiler_major_version (void)
{
@@ -125,6 +142,7 @@ ACE::compiler_major_version (void)
return 0;
#endif
}
+
u_int
ACE::compiler_minor_version (void)
{
@@ -134,6 +152,7 @@ ACE::compiler_minor_version (void)
return 0;
#endif
}
+
u_int
ACE::compiler_beta_version (void)
{
@@ -143,17 +162,20 @@ ACE::compiler_beta_version (void)
return 0;
#endif
}
+
bool
ACE::debug (void)
{
static const char* debug = ACE_OS::getenv ("ACE_DEBUG");
return (ACE::debug_ != 0) ? ACE::debug_ : (debug != 0 ? (*debug != '0'): false);
}
+
void
ACE::debug (bool onoff)
{
ACE::debug_ = onoff;
}
+
int
ACE::select (int width,
ACE_Handle_Set *readfds,
@@ -180,6 +202,7 @@ ACE::select (int width,
}
return result;
}
+
int
ACE::select (int width,
ACE_Handle_Set &readfds,
@@ -190,12 +213,14 @@ ACE::select (int width,
0,
0,
timeout);
+
#if !defined (ACE_WIN32)
if (result > 0)
readfds.sync ((ACE_HANDLE) width);
#endif /* ACE_WIN32 */
return result;
}
+
int
ACE::terminate_process (pid_t pid)
{
@@ -208,6 +233,7 @@ ACE::terminate_process (pid_t pid)
::OpenProcess (PROCESS_TERMINATE,
FALSE, // New handle is not inheritable.
pid);
+
if (process_handle == ACE_INVALID_HANDLE
|| process_handle == 0)
return -1;
@@ -224,6 +250,7 @@ ACE::terminate_process (pid_t pid)
return ACE_OS::kill (pid, 9);
#endif /* ACE_HAS_PHARLAP */
}
+
int
ACE::process_active (pid_t pid)
{
@@ -248,11 +275,13 @@ ACE::process_active (pid_t pid)
&status) == 0
|| status != STILL_ACTIVE)
result = 0;
+
::CloseHandle (process_handle);
return result;
}
#endif /* !ACE_WIN32 */
}
+
const ACE_TCHAR *
ACE::execname (const ACE_TCHAR *old_name)
{
@@ -261,110 +290,142 @@ ACE::execname (const ACE_TCHAR *old_name)
if (suffix == 0 || ACE_OS::strcasecmp (suffix, ACE_TEXT (".exe")) != 0)
{
ACE_TCHAR *new_name = 0;
+
size_t size =
ACE_OS::strlen (old_name)
+ ACE_OS::strlen (ACE_TEXT (".exe"))
+ 1;
+
ACE_NEW_RETURN (new_name,
ACE_TCHAR[size],
0);
ACE_TCHAR *end = new_name;
+
end = ACE_OS::strecpy (new_name, old_name);
+
// Concatenate the .exe suffix onto the end of the executable.
// end points _after_ the terminating nul.
ACE_OS::strcpy (end - 1, ACE_TEXT (".exe"));
+
return new_name;
}
#endif /* ACE_WIN32 */
return old_name;
}
+
u_long
ACE::hash_pjw (const char *str, size_t len)
{
u_long hash = 0;
+
for (size_t i = 0; i < len; i++)
{
const char temp = str[i];
hash = (hash << 4) + (temp * 13);
+
u_long g = hash & 0xf0000000;
+
if (g)
{
hash ^= (g >> 24);
hash ^= g;
}
}
+
return hash;
}
+
u_long
ACE::hash_pjw (const char *str)
{
return ACE::hash_pjw (str, ACE_OS::strlen (str));
}
+
#if defined (ACE_HAS_WCHAR)
u_long
ACE::hash_pjw (const wchar_t *str, size_t len)
{
u_long hash = 0;
+
for (size_t i = 0; i < len; i++)
{
// @@ UNICODE: Does this function do the correct thing with wchar's?
+
const wchar_t temp = str[i];
hash = (hash << 4) + (temp * 13);
+
u_long g = hash & 0xf0000000;
+
if (g)
{
hash ^= (g >> 24);
hash ^= g;
}
}
+
return hash;
}
+
u_long
ACE::hash_pjw (const wchar_t *str)
{
return ACE::hash_pjw (str, ACE_OS::strlen (str));
}
#endif /* ACE_HAS_WCHAR */
+
#if !defined (ACE_HAS_WINCE)
ACE_TCHAR *
ACE::strenvdup (const ACE_TCHAR *str)
{
ACE_TRACE ("ACE::strenvdup");
+
return ACE_OS::strenvdup (str);
}
#endif /* ACE_HAS_WINCE */
+
/*
+
Examples:
+
Source NT UNIX
==================================================================
netsvc netsvc.dll libnetsvc.so
(PATH will be (LD_LIBRARY_PATH
evaluated) evaluated)
+
libnetsvc.dll libnetsvc.dll libnetsvc.dll + warning
netsvc.so netsvc.so + warning libnetsvc.so
+
..\../libs/netsvc ..\..\libs\netsvc.dll ../../libs/netsvc.so
(absolute path used) (absolute path used)
+
*/
+
const ACE_TCHAR *
ACE::basename (const ACE_TCHAR *pathname, ACE_TCHAR delim)
{
ACE_TRACE ("ACE::basename");
const ACE_TCHAR *temp = ACE_OS::strrchr (pathname, delim);
+
if (temp == 0)
return pathname;
else
return temp + 1;
}
+
const ACE_TCHAR *
ACE::dirname (const ACE_TCHAR *pathname, ACE_TCHAR delim)
{
ACE_TRACE ("ACE::dirname");
static ACE_TCHAR return_dirname[MAXPATHLEN + 1];
+
const ACE_TCHAR *temp = ACE_OS::strrchr (pathname, delim);
+
if (temp == 0)
{
return_dirname[0] = '.';
return_dirname[1] = '\0';
+
return return_dirname;
}
else
@@ -374,12 +435,14 @@ ACE::dirname (const ACE_TCHAR *pathname, ACE_TCHAR delim)
size_t len = temp - pathname + 1;
if (len > (sizeof return_dirname / sizeof (ACE_TCHAR)))
len = sizeof return_dirname / sizeof (ACE_TCHAR);
+
ACE_OS::strsncpy (return_dirname,
pathname,
len);
return return_dirname;
}
}
+
ssize_t
ACE::recv (ACE_HANDLE handle,
void *buf,
@@ -403,7 +466,9 @@ ACE::recv (ACE_HANDLE handle,
}
}
}
+
#if defined (ACE_HAS_TLI)
+
ssize_t
ACE::t_rcv (ACE_HANDLE handle,
void *buf,
@@ -427,7 +492,9 @@ ACE::t_rcv (ACE_HANDLE handle,
}
}
}
+
#endif /* ACE_HAS_TLI */
+
ssize_t
ACE::recv (ACE_HANDLE handle,
void *buf,
@@ -449,6 +516,7 @@ ACE::recv (ACE_HANDLE handle,
}
}
}
+
ssize_t
ACE::recvmsg (ACE_HANDLE handle,
struct msghdr *msg,
@@ -470,6 +538,7 @@ ACE::recvmsg (ACE_HANDLE handle,
}
}
}
+
ssize_t
ACE::recvfrom (ACE_HANDLE handle,
char *buf,
@@ -495,6 +564,7 @@ ACE::recvfrom (ACE_HANDLE handle,
}
}
}
+
ssize_t
ACE::recv_n_i (ACE_HANDLE handle,
void *buf,
@@ -505,6 +575,7 @@ ACE::recv_n_i (ACE_HANDLE handle,
size_t temp;
size_t &bytes_transferred = bt == 0 ? temp : *bt;
ssize_t n;
+
for (bytes_transferred = 0;
bytes_transferred < len;
bytes_transferred += n)
@@ -517,6 +588,7 @@ ACE::recv_n_i (ACE_HANDLE handle,
// Check EOF.
if (n == 0)
return 0;
+
// Check for other errors.
if (n == -1)
{
@@ -525,6 +597,7 @@ ACE::recv_n_i (ACE_HANDLE handle,
{
// Wait for the blocking to subside.
int const result = ACE::handle_read_ready (handle, 0);
+
// Did select() succeed?
if (result != -1)
{
@@ -533,12 +606,15 @@ ACE::recv_n_i (ACE_HANDLE handle,
continue;
}
}
+
// Other data transfer or select() failures.
return -1;
}
}
+
return static_cast<ssize_t> (bytes_transferred);
}
+
ssize_t
ACE::recv_n_i (ACE_HANDLE handle,
void *buf,
@@ -552,8 +628,10 @@ ACE::recv_n_i (ACE_HANDLE handle,
ssize_t n;
ssize_t result = 0;
int error = 0;
+
int val = 0;
ACE::record_and_set_non_blocking_mode (handle, val);
+
for (bytes_transferred = 0;
bytes_transferred < len;
bytes_transferred += n)
@@ -565,6 +643,7 @@ ACE::recv_n_i (ACE_HANDLE handle,
static_cast <char *> (buf) + bytes_transferred,
len - bytes_transferred,
flags);
+
// Check for errors.
if (n == 0 ||
n == -1)
@@ -576,6 +655,7 @@ ACE::recv_n_i (ACE_HANDLE handle,
// Wait upto <timeout> for the blocking to subside.
int rtn = ACE::handle_read_ready (handle,
timeout);
+
// Did select() succeed?
if (rtn != -1)
{
@@ -585,6 +665,7 @@ ACE::recv_n_i (ACE_HANDLE handle,
continue;
}
}
+
// Wait in select() timed out or other data transfer or
// select() failures.
error = 1;
@@ -592,13 +673,17 @@ ACE::recv_n_i (ACE_HANDLE handle,
break;
}
}
+
ACE::restore_non_blocking_mode (handle, val);
+
if (error)
return result;
else
return static_cast<ssize_t> (bytes_transferred);
}
+
#if defined (ACE_HAS_TLI)
+
ssize_t
ACE::t_rcv_n_i (ACE_HANDLE handle,
void *buf,
@@ -609,6 +694,7 @@ ACE::t_rcv_n_i (ACE_HANDLE handle,
size_t temp;
size_t &bytes_transferred = bt == 0 ? temp : *bt;
ssize_t n;
+
for (bytes_transferred = 0;
bytes_transferred < len;
bytes_transferred += n)
@@ -621,6 +707,7 @@ ACE::t_rcv_n_i (ACE_HANDLE handle,
// Check EOF.
if (n == 0)
return 0;
+
// Check for other errors.
if (n == -1)
{
@@ -630,6 +717,7 @@ ACE::t_rcv_n_i (ACE_HANDLE handle,
// Wait for the blocking to subside.
int result = ACE::handle_read_ready (handle,
0);
+
// Did select() succeed?
if (result != -1)
{
@@ -638,12 +726,15 @@ ACE::t_rcv_n_i (ACE_HANDLE handle,
continue;
}
}
+
// Other data transfer or select() failures.
return -1;
}
}
+
return bytes_transferred;
}
+
ssize_t
ACE::t_rcv_n_i (ACE_HANDLE handle,
void *buf,
@@ -657,8 +748,10 @@ ACE::t_rcv_n_i (ACE_HANDLE handle,
ssize_t n;
ssize_t result = 0;
int error = 0;
+
int val = 0;
ACE::record_and_set_non_blocking_mode (handle, val);
+
for (bytes_transferred = 0;
bytes_transferred < len;
bytes_transferred += n)
@@ -670,6 +763,7 @@ ACE::t_rcv_n_i (ACE_HANDLE handle,
(char *) buf + bytes_transferred,
len - bytes_transferred,
flags);
+
// Check for errors.
if (n == 0 ||
n == -1)
@@ -681,6 +775,7 @@ ACE::t_rcv_n_i (ACE_HANDLE handle,
// Wait upto <timeout> for the blocking to subside.
int rtn = ACE::handle_read_ready (handle,
timeout);
+
// Did select() succeed?
if (rtn != -1)
{
@@ -690,6 +785,7 @@ ACE::t_rcv_n_i (ACE_HANDLE handle,
continue;
}
}
+
// Wait in select() timed out or other data transfer or
// select() failures.
error = 1;
@@ -697,13 +793,17 @@ ACE::t_rcv_n_i (ACE_HANDLE handle,
break;
}
}
+
ACE::restore_non_blocking_mode (handle, val);
+
if (error)
return result;
else
return bytes_transferred;
}
+
#endif /* ACE_HAS_TLI */
+
ssize_t
ACE::recv_n_i (ACE_HANDLE handle,
void *buf,
@@ -713,6 +813,7 @@ ACE::recv_n_i (ACE_HANDLE handle,
size_t temp;
size_t &bytes_transferred = bt == 0 ? temp : *bt;
ssize_t n;
+
for (bytes_transferred = 0;
bytes_transferred < len;
bytes_transferred += n)
@@ -735,6 +836,7 @@ ACE::recv_n_i (ACE_HANDLE handle,
// Wait for the blocking to subside.
int result = ACE::handle_read_ready (handle,
0);
+
// Did select() succeed?
if (result != -1)
{
@@ -743,12 +845,15 @@ ACE::recv_n_i (ACE_HANDLE handle,
continue;
}
}
+
// Other data transfer or select() failures.
return -1;
}
}
+
return static_cast<ssize_t> (bytes_transferred);
}
+
ssize_t
ACE::recv_n_i (ACE_HANDLE handle,
void *buf,
@@ -761,8 +866,10 @@ ACE::recv_n_i (ACE_HANDLE handle,
ssize_t n;
ssize_t result = 0;
int error = 0;
+
int val = 0;
ACE::record_and_set_non_blocking_mode (handle, val);
+
for (bytes_transferred = 0;
bytes_transferred < len;
bytes_transferred += n)
@@ -773,6 +880,7 @@ ACE::recv_n_i (ACE_HANDLE handle,
n = ACE::recv_i (handle,
static_cast <char *> (buf) + bytes_transferred,
len - bytes_transferred);
+
// Check for errors.
if (n == 0 ||
n == -1)
@@ -784,6 +892,7 @@ ACE::recv_n_i (ACE_HANDLE handle,
// Wait upto <timeout> for the blocking to subside.
int rtn = ACE::handle_read_ready (handle,
timeout);
+
// Did select() succeed?
if (rtn != -1)
{
@@ -793,6 +902,7 @@ ACE::recv_n_i (ACE_HANDLE handle,
continue;
}
}
+
// Wait in select() timed out or other data transfer or
// select() failures.
error = 1;
@@ -800,17 +910,21 @@ ACE::recv_n_i (ACE_HANDLE handle,
break;
}
}
+
ACE::restore_non_blocking_mode (handle, val);
+
if (error)
return result;
else
return static_cast<ssize_t> (bytes_transferred);
}
+
// This is basically an interface to ACE_OS::readv, that doesn't use
// the struct iovec explicitly. The ... can be passed as an arbitrary
// number of (char *ptr, int len) tuples. However, the count N is the
// *total* number of trailing arguments, *not* a couple of the number
// of tuple pairs!
+
ssize_t
ACE::recv (ACE_HANDLE handle, size_t n, ...)
{
@@ -824,12 +938,15 @@ ACE::recv (ACE_HANDLE handle, size_t n, ...)
iovec[total_tuples],
-1);
#endif /* !defined (ACE_HAS_ALLOCA) */
+
va_start (argp, n);
+
for (int i = 0; i < total_tuples; i++)
{
iovp[i].iov_base = va_arg (argp, char *);
iovp[i].iov_len = va_arg (argp, int);
}
+
ssize_t result = ACE_OS::recvv (handle, iovp, total_tuples);
#if !defined (ACE_HAS_ALLOCA)
delete [] iovp;
@@ -837,6 +954,7 @@ ACE::recv (ACE_HANDLE handle, size_t n, ...)
va_end (argp);
return result;
}
+
ssize_t
ACE::recvv (ACE_HANDLE handle,
iovec *iov,
@@ -858,6 +976,7 @@ ACE::recvv (ACE_HANDLE handle,
}
}
}
+
ssize_t
ACE::recvv_n_i (ACE_HANDLE handle,
iovec *iov,
@@ -867,6 +986,7 @@ ACE::recvv_n_i (ACE_HANDLE handle,
size_t temp;
size_t &bytes_transferred = bt == 0 ? temp : *bt;
bytes_transferred = 0;
+
for (int s = 0;
s < iovcnt;
)
@@ -878,6 +998,7 @@ ACE::recvv_n_i (ACE_HANDLE handle,
// Check EOF.
if (n == 0)
return 0;
+
// Check for other errors.
if (n == -1)
{
@@ -887,6 +1008,7 @@ ACE::recvv_n_i (ACE_HANDLE handle,
// Wait for the blocking to subside.
int result = ACE::handle_read_ready (handle,
0);
+
// Did select() succeed?
if (result != -1)
{
@@ -895,14 +1017,17 @@ ACE::recvv_n_i (ACE_HANDLE handle,
continue;
}
}
+
// Other data transfer or select() failures.
return -1;
}
+
for (bytes_transferred += n;
s < iovcnt
&& n >= static_cast<ssize_t> (iov[s].iov_len);
s++)
n -= iov[s].iov_len;
+
if (n != 0)
{
char *base = static_cast<char *> (iov[s].iov_base);
@@ -910,8 +1035,10 @@ ACE::recvv_n_i (ACE_HANDLE handle,
iov[s].iov_len = iov[s].iov_len - n;
}
}
+
return ACE_Utils::truncate_cast<ssize_t> (bytes_transferred);
}
+
ssize_t
ACE::recvv_n_i (ACE_HANDLE handle,
iovec *iov,
@@ -924,8 +1051,10 @@ ACE::recvv_n_i (ACE_HANDLE handle,
bytes_transferred = 0;
ssize_t result = 0;
int error = 0;
+
int val = 0;
ACE::record_and_set_non_blocking_mode (handle, val);
+
for (int s = 0;
s < iovcnt;
)
@@ -936,6 +1065,7 @@ ACE::recvv_n_i (ACE_HANDLE handle,
ssize_t n = ACE_OS::recvv (handle,
iov + s,
iovcnt - s);
+
// Check for errors.
if (n == 0 ||
n == -1)
@@ -947,6 +1077,7 @@ ACE::recvv_n_i (ACE_HANDLE handle,
// Wait upto <timeout> for the blocking to subside.
int rtn = ACE::handle_read_ready (handle,
timeout);
+
// Did select() succeed?
if (rtn != -1)
{
@@ -956,17 +1087,20 @@ ACE::recvv_n_i (ACE_HANDLE handle,
continue;
}
}
+
// Wait in select() timed out or other data transfer or
// select() failures.
error = 1;
result = n;
break;
}
+
for (bytes_transferred += n;
s < iovcnt
&& n >= static_cast<ssize_t> (iov[s].iov_len);
s++)
n -= iov[s].iov_len;
+
if (n != 0)
{
char *base = reinterpret_cast<char *> (iov[s].iov_base);
@@ -974,7 +1108,9 @@ ACE::recvv_n_i (ACE_HANDLE handle,
iov[s].iov_len = iov[s].iov_len - n;
}
}
+
ACE::restore_non_blocking_mode (handle, val);
+
if (error)
{
return result;
@@ -984,6 +1120,7 @@ ACE::recvv_n_i (ACE_HANDLE handle,
return ACE_Utils::truncate_cast<ssize_t> (bytes_transferred);
}
}
+
ssize_t
ACE::recv_n (ACE_HANDLE handle,
ACE_Message_Block *message_block,
@@ -993,30 +1130,37 @@ ACE::recv_n (ACE_HANDLE handle,
size_t temp;
size_t &bytes_transferred = bt == 0 ? temp : *bt;
bytes_transferred = 0;
+
iovec iov[ACE_IOV_MAX];
int iovcnt = 0;
+
while (message_block != 0)
{
// Our current message block chain.
const ACE_Message_Block *current_message_block = message_block;
+
while (current_message_block != 0)
{
size_t current_message_block_length =
current_message_block->length ();
char *this_rd_ptr = current_message_block->rd_ptr ();
+
// Check if this block has any space for incoming data.
while (current_message_block_length > 0)
{
u_long const this_chunk_length =
ACE_Utils::truncate_cast<u_long> (
current_message_block_length);
+
// Collect the data in the iovec.
iov[iovcnt].iov_base = this_rd_ptr;
iov[iovcnt].iov_len = this_chunk_length;
current_message_block_length -= this_chunk_length;
this_rd_ptr += this_chunk_length;
+
// Increment iovec counter.
++iovcnt;
+
// The buffer is full make a OS call. @@ TODO find a way to
// find ACE_IOV_MAX for platforms that do not define it rather
// than simply setting ACE_IOV_MAX to some arbitrary value such
@@ -1024,47 +1168,59 @@ ACE::recv_n (ACE_HANDLE handle,
if (iovcnt == ACE_IOV_MAX)
{
size_t current_transfer = 0;
+
ssize_t const result = ACE::recvv_n (handle,
iov,
iovcnt,
timeout,
&current_transfer);
+
// Add to total bytes transferred.
bytes_transferred += current_transfer;
+
// Errors.
if (result == -1 || result == 0)
return result;
+
// Reset iovec counter.
iovcnt = 0;
}
}
+
// Select the next message block in the chain.
current_message_block = current_message_block->cont ();
}
+
// Selection of the next message block chain.
message_block = message_block->next ();
}
+
// Check for remaining buffers to be sent. This will happen when
// ACE_IOV_MAX is not a multiple of the number of message blocks.
if (iovcnt != 0)
{
size_t current_transfer = 0;
+
ssize_t const result = ACE::recvv_n (handle,
iov,
iovcnt,
timeout,
&current_transfer);
+
// Add to total bytes transferred.
bytes_transferred += current_transfer;
+
// Errors.
if (result == -1 || result == 0)
{
return result;
}
}
+
// Return total bytes transferred.
return ACE_Utils::truncate_cast<ssize_t> (bytes_transferred);
}
+
ssize_t
ACE::send (ACE_HANDLE handle,
const void *buf,
@@ -1087,7 +1243,9 @@ ACE::send (ACE_HANDLE handle,
}
}
}
+
#if defined (ACE_HAS_TLI)
+
ssize_t
ACE::t_snd (ACE_HANDLE handle,
const void *buf,
@@ -1110,7 +1268,9 @@ ACE::t_snd (ACE_HANDLE handle,
}
}
}
+
#endif /* ACE_HAS_TLI */
+
ssize_t
ACE::send (ACE_HANDLE handle,
const void *buf,
@@ -1132,6 +1292,7 @@ ACE::send (ACE_HANDLE handle,
}
}
}
+
ssize_t
ACE::sendmsg (ACE_HANDLE handle,
const struct msghdr *msg,
@@ -1153,6 +1314,7 @@ ACE::sendmsg (ACE_HANDLE handle,
}
}
}
+
ssize_t
ACE::sendto (ACE_HANDLE handle,
const char *buf,
@@ -1178,6 +1340,7 @@ ACE::sendto (ACE_HANDLE handle,
}
}
}
+
ssize_t
ACE::send_n_i (ACE_HANDLE handle,
const void *buf,
@@ -1188,6 +1351,7 @@ ACE::send_n_i (ACE_HANDLE handle,
size_t temp;
size_t &bytes_transferred = bt == 0 ? temp : *bt;
ssize_t n;
+
for (bytes_transferred = 0;
bytes_transferred < len;
bytes_transferred += n)
@@ -1200,6 +1364,7 @@ ACE::send_n_i (ACE_HANDLE handle,
// Check EOF.
if (n == 0)
return 0;
+
// Check for other errors.
if (n == -1)
{
@@ -1213,6 +1378,7 @@ ACE::send_n_i (ACE_HANDLE handle,
// Wait for the blocking to subside.
int result = ACE::handle_write_ready (handle,
0);
+
// Did select() succeed?
if (result != -1)
{
@@ -1221,12 +1387,15 @@ ACE::send_n_i (ACE_HANDLE handle,
continue;
}
}
+
// Other data transfer or select() failures.
return -1;
}
}
+
return ACE_Utils::truncate_cast<ssize_t> (bytes_transferred);
}
+
ssize_t
ACE::send_n_i (ACE_HANDLE handle,
const void *buf,
@@ -1240,8 +1409,10 @@ ACE::send_n_i (ACE_HANDLE handle,
ssize_t n;
ssize_t result = 0;
int error = 0;
+
int val = 0;
ACE::record_and_set_non_blocking_mode (handle, val);
+
for (bytes_transferred = 0;
bytes_transferred < len;
bytes_transferred += n)
@@ -1253,6 +1424,7 @@ ACE::send_n_i (ACE_HANDLE handle,
(char *) buf + bytes_transferred,
len - bytes_transferred,
flags);
+
// Check for errors.
if (n == 0 ||
n == -1)
@@ -1264,6 +1436,7 @@ ACE::send_n_i (ACE_HANDLE handle,
// Wait upto <timeout> for the blocking to subside.
int rtn = ACE::handle_write_ready (handle,
timeout);
+
// Did select() succeed?
if (rtn != -1)
{
@@ -1273,6 +1446,7 @@ ACE::send_n_i (ACE_HANDLE handle,
continue;
}
}
+
// Wait in select() timed out or other data transfer or
// select() failures.
error = 1;
@@ -1280,7 +1454,9 @@ ACE::send_n_i (ACE_HANDLE handle,
break;
}
}
+
ACE::restore_non_blocking_mode (handle, val);
+
if (error)
{
return result;
@@ -1290,7 +1466,9 @@ ACE::send_n_i (ACE_HANDLE handle,
return ACE_Utils::truncate_cast<ssize_t> (bytes_transferred);
}
}
+
#if defined (ACE_HAS_TLI)
+
ssize_t
ACE::t_snd_n_i (ACE_HANDLE handle,
const void *buf,
@@ -1301,6 +1479,7 @@ ACE::t_snd_n_i (ACE_HANDLE handle,
size_t temp;
size_t &bytes_transferred = bt == 0 ? temp : *bt;
ssize_t n;
+
for (bytes_transferred = 0;
bytes_transferred < len;
bytes_transferred += n)
@@ -1313,6 +1492,7 @@ ACE::t_snd_n_i (ACE_HANDLE handle,
// Check EOF.
if (n == 0)
return 0;
+
// Check for other errors.
if (n == -1)
{
@@ -1322,6 +1502,7 @@ ACE::t_snd_n_i (ACE_HANDLE handle,
// Wait for the blocking to subside.
int result = ACE::handle_write_ready (handle,
0);
+
// Did select() succeed?
if (result != -1)
{
@@ -1330,12 +1511,15 @@ ACE::t_snd_n_i (ACE_HANDLE handle,
continue;
}
}
+
// Other data transfer or select() failures.
return -1;
}
}
+
return bytes_transferred;
}
+
ssize_t
ACE::t_snd_n_i (ACE_HANDLE handle,
const void *buf,
@@ -1349,8 +1533,10 @@ ACE::t_snd_n_i (ACE_HANDLE handle,
ssize_t n;
ssize_t result = 0;
int error = 0;
+
int val = 0;
ACE::record_and_set_non_blocking_mode (handle, val);
+
for (bytes_transferred = 0;
bytes_transferred < len;
bytes_transferred += n)
@@ -1362,6 +1548,7 @@ ACE::t_snd_n_i (ACE_HANDLE handle,
(char *) buf + bytes_transferred,
len - bytes_transferred,
flags);
+
// Check for errors.
if (n == 0 ||
n == -1)
@@ -1373,6 +1560,7 @@ ACE::t_snd_n_i (ACE_HANDLE handle,
// Wait upto <timeout> for the blocking to subside.
int rtn = ACE::handle_write_ready (handle,
timeout);
+
// Did select() succeed?
if (rtn != -1)
{
@@ -1382,6 +1570,7 @@ ACE::t_snd_n_i (ACE_HANDLE handle,
continue;
}
}
+
// Wait in select() timed out or other data transfer or
// select() failures.
error = 1;
@@ -1389,13 +1578,17 @@ ACE::t_snd_n_i (ACE_HANDLE handle,
break;
}
}
+
ACE::restore_non_blocking_mode (handle, val);
+
if (error)
return result;
else
return bytes_transferred;
}
+
#endif /* ACE_HAS_TLI */
+
ssize_t
ACE::send_n_i (ACE_HANDLE handle,
const void *buf,
@@ -1405,6 +1598,7 @@ ACE::send_n_i (ACE_HANDLE handle,
size_t temp;
size_t &bytes_transferred = bt == 0 ? temp : *bt;
ssize_t n;
+
for (bytes_transferred = 0;
bytes_transferred < len;
bytes_transferred += n)
@@ -1418,6 +1612,7 @@ ACE::send_n_i (ACE_HANDLE handle,
{
return 0;
}
+
// Check for other errors.
if (n == -1)
{
@@ -1427,6 +1622,7 @@ ACE::send_n_i (ACE_HANDLE handle,
// Wait for the blocking to subside.
int result = ACE::handle_write_ready (handle,
0);
+
// Did select() succeed?
if (result != -1)
{
@@ -1435,12 +1631,15 @@ ACE::send_n_i (ACE_HANDLE handle,
continue;
}
}
+
// Other data transfer or select() failures.
return -1;
}
}
+
return ACE_Utils::truncate_cast<ssize_t> (bytes_transferred);
}
+
ssize_t
ACE::send_n_i (ACE_HANDLE handle,
const void *buf,
@@ -1453,8 +1652,10 @@ ACE::send_n_i (ACE_HANDLE handle,
ssize_t n;
ssize_t result = 0;
int error = 0;
+
int val = 0;
ACE::record_and_set_non_blocking_mode (handle, val);
+
for (bytes_transferred = 0;
bytes_transferred < len;
bytes_transferred += n)
@@ -1465,6 +1666,7 @@ ACE::send_n_i (ACE_HANDLE handle,
n = ACE::send_i (handle,
(char *) buf + bytes_transferred,
len - bytes_transferred);
+
// Check for errors.
if (n == 0 ||
n == -1)
@@ -1476,6 +1678,7 @@ ACE::send_n_i (ACE_HANDLE handle,
// Wait upto <timeout> for the blocking to subside.
int rtn = ACE::handle_write_ready (handle,
timeout);
+
// Did select() succeed?
if (rtn != -1)
{
@@ -1485,6 +1688,7 @@ ACE::send_n_i (ACE_HANDLE handle,
continue;
}
}
+
// Wait in select() timed out or other data transfer or
// select() failures.
error = 1;
@@ -1492,7 +1696,9 @@ ACE::send_n_i (ACE_HANDLE handle,
break;
}
}
+
ACE::restore_non_blocking_mode (handle, val);
+
if (error)
{
return result;
@@ -1502,10 +1708,12 @@ ACE::send_n_i (ACE_HANDLE handle,
return ACE_Utils::truncate_cast<ssize_t> (bytes_transferred);
}
}
+
// Send N char *ptrs and int lengths. Note that the char *'s precede
// the ints (basically, an varargs version of writev). The count N is
// the *total* number of trailing arguments, *not* a couple of the
// number of tuple pairs!
+
ssize_t
ACE::send (ACE_HANDLE handle, size_t n, ...)
{
@@ -1519,12 +1727,15 @@ ACE::send (ACE_HANDLE handle, size_t n, ...)
iovec[total_tuples],
-1);
#endif /* !defined (ACE_HAS_ALLOCA) */
+
va_start (argp, n);
+
for (int i = 0; i < total_tuples; i++)
{
iovp[i].iov_base = va_arg (argp, char *);
iovp[i].iov_len = va_arg (argp, int);
}
+
ssize_t result = ACE_OS::sendv (handle, iovp, total_tuples);
#if !defined (ACE_HAS_ALLOCA)
delete [] iovp;
@@ -1532,6 +1743,7 @@ ACE::send (ACE_HANDLE handle, size_t n, ...)
va_end (argp);
return result;
}
+
ssize_t
ACE::sendv (ACE_HANDLE handle,
const iovec *iov,
@@ -1553,6 +1765,7 @@ ACE::sendv (ACE_HANDLE handle,
}
}
}
+
ssize_t
ACE::sendv_n_i (ACE_HANDLE handle,
const iovec *i,
@@ -1562,7 +1775,9 @@ ACE::sendv_n_i (ACE_HANDLE handle,
size_t temp;
size_t &bytes_transferred = bt == 0 ? temp : *bt;
bytes_transferred = 0;
+
iovec *iov = const_cast<iovec *> (i);
+
for (int s = 0;
s < iovcnt;
)
@@ -1574,6 +1789,7 @@ ACE::sendv_n_i (ACE_HANDLE handle,
// Check EOF.
if (n == 0)
return 0;
+
// Check for other errors.
if (n == -1)
{
@@ -1583,6 +1799,7 @@ ACE::sendv_n_i (ACE_HANDLE handle,
// Wait for the blocking to subside.
int result = ACE::handle_write_ready (handle,
0);
+
// Did select() succeed?
if (result != -1)
{
@@ -1591,14 +1808,17 @@ ACE::sendv_n_i (ACE_HANDLE handle,
continue;
}
}
+
// Other data transfer or select() failures.
return -1;
}
+
for (bytes_transferred += n;
s < iovcnt
&& n >= static_cast<ssize_t> (iov[s].iov_len);
s++)
n -= iov[s].iov_len;
+
if (n != 0)
{
char *base = reinterpret_cast<char *> (iov[s].iov_base);
@@ -1606,8 +1826,10 @@ ACE::sendv_n_i (ACE_HANDLE handle,
iov[s].iov_len = iov[s].iov_len - n;
}
}
+
return ACE_Utils::truncate_cast<ssize_t> (bytes_transferred);
}
+
ssize_t
ACE::sendv_n_i (ACE_HANDLE handle,
const iovec *i,
@@ -1620,9 +1842,12 @@ ACE::sendv_n_i (ACE_HANDLE handle,
bytes_transferred = 0;
ssize_t result = 0;
int error = 0;
+
int val = 0;
ACE::record_and_set_non_blocking_mode (handle, val);
+
iovec *iov = const_cast<iovec *> (i);
+
for (int s = 0;
s < iovcnt;
)
@@ -1633,6 +1858,7 @@ ACE::sendv_n_i (ACE_HANDLE handle,
ssize_t n = ACE_OS::sendv (handle,
iov + s,
iovcnt - s);
+
// Check for errors.
if (n == 0 ||
n == -1)
@@ -1644,6 +1870,7 @@ ACE::sendv_n_i (ACE_HANDLE handle,
// Wait upto <timeout> for the blocking to subside.
int rtn = ACE::handle_write_ready (handle,
timeout);
+
// Did select() succeed?
if (rtn != -1)
{
@@ -1653,17 +1880,20 @@ ACE::sendv_n_i (ACE_HANDLE handle,
continue;
}
}
+
// Wait in select() timed out or other data transfer or
// select() failures.
error = 1;
result = n;
break;
}
+
for (bytes_transferred += n;
s < iovcnt
&& n >= static_cast<ssize_t> (iov[s].iov_len);
s++)
n -= iov[s].iov_len;
+
if (n != 0)
{
char *base = reinterpret_cast<char *> (iov[s].iov_base);
@@ -1671,7 +1901,9 @@ ACE::sendv_n_i (ACE_HANDLE handle,
iov[s].iov_len = iov[s].iov_len - n;
}
}
+
ACE::restore_non_blocking_mode (handle, val);
+
if (error)
{
return result;
@@ -1681,6 +1913,7 @@ ACE::sendv_n_i (ACE_HANDLE handle,
return ACE_Utils::truncate_cast<ssize_t> (bytes_transferred);
}
}
+
ssize_t
ACE::write_n (ACE_HANDLE handle,
const ACE_Message_Block *message_block,
@@ -1689,30 +1922,37 @@ ACE::write_n (ACE_HANDLE handle,
size_t temp;
size_t &bytes_transferred = bt == 0 ? temp : *bt;
bytes_transferred = 0;
+
iovec iov[ACE_IOV_MAX];
int iovcnt = 0;
+
while (message_block != 0)
{
// Our current message block chain.
const ACE_Message_Block *current_message_block = message_block;
+
while (current_message_block != 0)
{
size_t current_message_block_length =
current_message_block->length ();
char *this_block_ptr = current_message_block->rd_ptr ();
+
// Check if this block has any data to be sent.
while (current_message_block_length > 0)
{
u_long const this_chunk_length =
ACE_Utils::truncate_cast<u_long> (
current_message_block_length);
+
// Collect the data in the iovec.
iov[iovcnt].iov_base = this_block_ptr;
iov[iovcnt].iov_len = this_chunk_length;
current_message_block_length -= this_chunk_length;
this_block_ptr += this_chunk_length;
+
// Increment iovec counter.
++iovcnt;
+
// The buffer is full make a OS call. @@ TODO find a way to
// find ACE_IOV_MAX for platforms that do not define it rather
// than simply setting ACE_IOV_MAX to some arbitrary value such
@@ -1720,43 +1960,55 @@ ACE::write_n (ACE_HANDLE handle,
if (iovcnt == ACE_IOV_MAX)
{
size_t current_transfer = 0;
+
ssize_t const result = ACE::writev_n (handle,
iov,
iovcnt,
&current_transfer);
+
// Add to total bytes transferred.
bytes_transferred += current_transfer;
+
// Errors.
if (result == -1 || result == 0)
return result;
+
// Reset iovec counter.
iovcnt = 0;
}
}
+
// Select the next message block in the chain.
current_message_block = current_message_block->cont ();
}
+
// Selection of the next message block chain.
message_block = message_block->next ();
}
+
// Check for remaining buffers to be sent. This will happen when
// ACE_IOV_MAX is not a multiple of the number of message blocks.
if (iovcnt != 0)
{
size_t current_transfer = 0;
+
ssize_t const result = ACE::writev_n (handle,
iov,
iovcnt,
&current_transfer);
+
// Add to total bytes transferred.
bytes_transferred += current_transfer;
+
// Errors.
if (result == -1 || result == 0)
return result;
}
+
// Return total bytes transferred.
return ACE_Utils::truncate_cast<ssize_t> (bytes_transferred);
}
+
ssize_t
ACE::send_n (ACE_HANDLE handle,
const ACE_Message_Block *message_block,
@@ -1766,30 +2018,37 @@ ACE::send_n (ACE_HANDLE handle,
size_t temp;
size_t &bytes_transferred = bt == 0 ? temp : *bt;
bytes_transferred = 0;
+
iovec iov[ACE_IOV_MAX];
int iovcnt = 0;
+
while (message_block != 0)
{
// Our current message block chain.
const ACE_Message_Block *current_message_block = message_block;
+
while (current_message_block != 0)
{
char *this_block_ptr = current_message_block->rd_ptr ();
size_t current_message_block_length =
current_message_block->length ();
+
// Check if this block has any data to be sent.
while (current_message_block_length > 0)
{
u_long const this_chunk_length =
ACE_Utils::truncate_cast<u_long> (
current_message_block_length);
+
// Collect the data in the iovec.
iov[iovcnt].iov_base = this_block_ptr;
iov[iovcnt].iov_len = this_chunk_length;
current_message_block_length -= this_chunk_length;
this_block_ptr += this_chunk_length;
+
// Increment iovec counter.
++iovcnt;
+
// The buffer is full make a OS call. @@ TODO find a way to
// find ACE_IOV_MAX for platforms that do not define it rather
// than simply setting ACE_IOV_MAX to some arbitrary value such
@@ -1797,47 +2056,59 @@ ACE::send_n (ACE_HANDLE handle,
if (iovcnt == ACE_IOV_MAX)
{
size_t current_transfer = 0;
+
ssize_t const result = ACE::sendv_n (handle,
iov,
iovcnt,
timeout,
&current_transfer);
+
// Add to total bytes transferred.
bytes_transferred += current_transfer;
+
// Errors.
if (result == -1 || result == 0)
return result;
+
// Reset iovec counter.
iovcnt = 0;
}
}
+
// Select the next message block in the chain.
current_message_block = current_message_block->cont ();
}
+
// Selection of the next message block chain.
message_block = message_block->next ();
}
+
// Check for remaining buffers to be sent. This will happen when
// ACE_IOV_MAX is not a multiple of the number of message blocks.
if (iovcnt != 0)
{
size_t current_transfer = 0;
+
ssize_t const result = ACE::sendv_n (handle,
iov,
iovcnt,
timeout,
&current_transfer);
+
// Add to total bytes transferred.
bytes_transferred += current_transfer;
+
// Errors.
if (result == -1 || result == 0)
{
return result;
}
}
+
// Return total bytes transferred.
return ACE_Utils::truncate_cast<ssize_t> (bytes_transferred);
}
+
ssize_t
ACE::readv_n (ACE_HANDLE handle,
iovec *iov,
@@ -1847,6 +2118,7 @@ ACE::readv_n (ACE_HANDLE handle,
size_t temp;
size_t &bytes_transferred = bt == 0 ? temp : *bt;
bytes_transferred = 0;
+
for (int s = 0;
s < iovcnt;
)
@@ -1854,13 +2126,16 @@ ACE::readv_n (ACE_HANDLE handle,
ssize_t n = ACE_OS::readv (handle,
iov + s,
iovcnt - s);
+
if (n == -1 || n == 0)
return n;
+
for (bytes_transferred += n;
s < iovcnt
&& n >= static_cast<ssize_t> (iov[s].iov_len);
s++)
n -= iov[s].iov_len;
+
if (n != 0)
{
char *base = reinterpret_cast<char *> (iov[s].iov_base);
@@ -1868,8 +2143,10 @@ ACE::readv_n (ACE_HANDLE handle,
iov[s].iov_len = iov[s].iov_len - n;
}
}
+
return ACE_Utils::truncate_cast<ssize_t> (bytes_transferred);
}
+
ssize_t
ACE::writev_n (ACE_HANDLE handle,
const iovec *i,
@@ -1879,7 +2156,9 @@ ACE::writev_n (ACE_HANDLE handle,
size_t temp;
size_t &bytes_transferred = bt == 0 ? temp : *bt;
bytes_transferred = 0;
+
iovec *iov = const_cast<iovec *> (i);
+
for (int s = 0;
s < iovcnt;
)
@@ -1887,15 +2166,18 @@ ACE::writev_n (ACE_HANDLE handle,
ssize_t n = ACE_OS::writev (handle,
iov + s,
iovcnt - s);
+
if (n == -1 || n == 0)
{
return n;
}
+
for (bytes_transferred += n;
s < iovcnt
&& n >= static_cast<ssize_t> (iov[s].iov_len);
s++)
n -= iov[s].iov_len;
+
if (n != 0)
{
char *base = reinterpret_cast<char *> (iov[s].iov_base);
@@ -1903,8 +2185,10 @@ ACE::writev_n (ACE_HANDLE handle,
iov[s].iov_len = iov[s].iov_len - n;
}
}
+
return ACE_Utils::truncate_cast<ssize_t> (bytes_transferred);
}
+
int
ACE::handle_ready (ACE_HANDLE handle,
const ACE_Time_Value *timeout,
@@ -1915,14 +2199,18 @@ ACE::handle_ready (ACE_HANDLE handle,
#if defined (ACE_HAS_POLL) && defined (ACE_HAS_LIMITED_SELECT)
ACE_UNUSED_ARG (write_ready);
ACE_UNUSED_ARG (exception_ready);
+
struct pollfd fds;
+
fds.fd = handle;
fds.events = read_ready ? POLLIN : POLLOUT;
fds.revents = 0;
+
int result = ACE_OS::poll (&fds, 1, timeout);
#else
ACE_Handle_Set handle_set;
handle_set.set_bit (handle);
+
// Wait for data or for the timeout to elapse.
int select_width;
# if defined (ACE_WIN32)
@@ -1937,7 +2225,9 @@ ACE::handle_ready (ACE_HANDLE handle,
write_ready ? handle_set.fdset () : 0, // write_fds.
exception_ready ? handle_set.fdset () : 0, // exception_fds.
timeout);
+
#endif /* ACE_HAS_POLL && ACE_HAS_LIMITED_SELECT */
+
switch (result)
{
case 0: // Timer expired.
@@ -1952,6 +2242,7 @@ ACE::handle_ready (ACE_HANDLE handle,
return result;
}
}
+
int
ACE::enter_recv_timedwait (ACE_HANDLE handle,
const ACE_Time_Value *timeout,
@@ -1959,12 +2250,16 @@ ACE::enter_recv_timedwait (ACE_HANDLE handle,
{
int result = ACE::handle_read_ready (handle,
timeout);
+
if (result == -1)
return -1;
+
ACE::record_and_set_non_blocking_mode (handle,
val);
+
return result;
}
+
int
ACE::enter_send_timedwait (ACE_HANDLE handle,
const ACE_Time_Value *timeout,
@@ -1972,12 +2267,16 @@ ACE::enter_send_timedwait (ACE_HANDLE handle,
{
int result = ACE::handle_write_ready (handle,
timeout);
+
if (result == -1)
return -1;
+
ACE::record_and_set_non_blocking_mode (handle,
val);
+
return result;
}
+
void
ACE::record_and_set_non_blocking_mode (ACE_HANDLE handle,
int &val)
@@ -1985,11 +2284,13 @@ ACE::record_and_set_non_blocking_mode (ACE_HANDLE handle,
// We need to record whether we are already *in* nonblocking mode,
// so that we can correctly reset the state when we're done.
val = ACE::get_flags (handle);
+
if (ACE_BIT_DISABLED (val, ACE_NONBLOCK))
// Set the handle into non-blocking mode if it's not already in
// it.
ACE::set_flags (handle, ACE_NONBLOCK);
}
+
void
ACE::restore_non_blocking_mode (ACE_HANDLE handle,
int val)
@@ -2005,9 +2306,11 @@ ACE::restore_non_blocking_mode (ACE_HANDLE handle,
}
}
+
// 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.
+
size_t
ACE::format_hexdump (const char *buffer,
size_t size,
@@ -2015,17 +2318,23 @@ ACE::format_hexdump (const char *buffer,
size_t obuf_sz)
{
ACE_TRACE ("ACE::format_hexdump");
+
u_char c;
ACE_TCHAR textver[16 + 1];
+
// We can fit 16 bytes output in text mode per line, 4 chars per byte.
size_t maxlen = (obuf_sz / 68) * 16;
+
if (size > maxlen)
size = maxlen;
+
size_t i;
+
size_t lines = size / 16;
for (i = 0; i < lines; i++)
{
size_t j;
+
for (j = 0 ; j < 16; j++)
{
c = (u_char) buffer[(i << 4) + j]; // or, buffer[i*16+j]
@@ -2041,13 +2350,17 @@ ACE::format_hexdump (const char *buffer,
}
textver[j] = ACE_OS::ace_isprint (c) ? c : '.';
}
+
textver[j] = 0;
+
ACE_OS::sprintf (obuf,
ACE_TEXT (" %s\n"),
textver);
+
while (*obuf != '\0')
++obuf;
}
+
if (size % 16)
{
for (i = 0 ; i < size % 16; i++)
@@ -2065,6 +2378,7 @@ ACE::format_hexdump (const char *buffer,
}
textver[i] = ACE_OS::ace_isprint (c) ? c : '.';
}
+
for (i = size % 16; i < 16; i++)
{
ACE_OS::sprintf (obuf,
@@ -2078,6 +2392,7 @@ ACE::format_hexdump (const char *buffer,
}
textver[i] = ' ';
}
+
textver[i] = 0;
ACE_OS::sprintf (obuf,
ACE_TEXT (" %s\n"),
@@ -2085,20 +2400,24 @@ ACE::format_hexdump (const char *buffer,
}
return size;
}
+
// Returns the current timestamp in the form
// "hour:minute:second:microsecond." The month, day, and year are
// also stored in the beginning of the date_and_time array.
+
ACE_TCHAR *
ACE::timestamp (ACE_TCHAR date_and_time[],
size_t date_and_timelen,
bool return_pointer_to_first_digit)
{
//ACE_TRACE ("ACE::timestamp");
+
if (date_and_timelen < 35)
{
errno = EINVAL;
return 0;
}
+
#if defined (WIN32)
// Emulate Unix. Win32 does NOT support all the UNIX versions
// below, so DO we need this ifdef.
@@ -2112,6 +2431,7 @@ ACE::timestamp (ACE_TCHAR date_and_time[],
ACE_TEXT ("Fri"),
ACE_TEXT ("Sat")
};
+
static const ACE_TCHAR *month_name[] =
{
ACE_TEXT ("Jan"),
@@ -2127,8 +2447,10 @@ ACE::timestamp (ACE_TCHAR date_and_time[],
ACE_TEXT ("Nov"),
ACE_TEXT ("Dec")
};
+
SYSTEMTIME local;
::GetLocalTime (&local);
+
ACE_OS::sprintf (date_and_time,
ACE_TEXT ("%3s %3s %2d %04d %02d:%02d:%02d.%06d"),
day_of_week_name[local.wDayOfWeek],
@@ -2144,6 +2466,7 @@ ACE::timestamp (ACE_TCHAR date_and_time[],
ACE_TCHAR timebuf[26]; // This magic number is based on the ctime(3c) man page.
ACE_Time_Value cur_time = ACE_OS::gettimeofday ();
time_t secs = cur_time.sec ();
+
ACE_OS::ctime_r (&secs,
timebuf,
sizeof timebuf / sizeof (ACE_TCHAR));
@@ -2172,48 +2495,64 @@ ACE::timestamp (ACE_TCHAR date_and_time[],
return &date_and_time[15 + (return_pointer_to_first_digit != 0)];
#endif /* WIN32 */
}
+
// This function rounds the request to a multiple of the page size.
+
size_t
ACE::round_to_pagesize (size_t len)
{
ACE_TRACE ("ACE::round_to_pagesize");
+
if (ACE::pagesize_ == 0)
ACE::pagesize_ = ACE_OS::getpagesize ();
+
return (len + (ACE::pagesize_ - 1)) & ~(ACE::pagesize_ - 1);
}
+
size_t
ACE::round_to_allocation_granularity (size_t len)
{
ACE_TRACE ("ACE::round_to_allocation_granularity");
+
if (ACE::allocation_granularity_ == 0)
ACE::allocation_granularity_ = ACE_OS::allocation_granularity ();
+
return (len + (ACE::allocation_granularity_ - 1)) & ~(ACE::allocation_granularity_ - 1);
}
+
ACE_HANDLE
ACE::handle_timed_complete (ACE_HANDLE h,
const ACE_Time_Value *timeout,
int is_tli)
{
ACE_TRACE ("ACE::handle_timed_complete");
+
#if !defined (ACE_WIN32) && defined (ACE_HAS_POLL) && defined (ACE_HAS_LIMITED_SELECT)
+
struct pollfd fds;
+
fds.fd = h;
fds.events = POLLIN | POLLOUT;
fds.revents = 0;
+
#else
ACE_Handle_Set rd_handles;
ACE_Handle_Set wr_handles;
+
rd_handles.set_bit (h);
wr_handles.set_bit (h);
#endif /* !ACE_WIN32 && ACE_HAS_POLL && ACE_HAS_LIMITED_SELECT */
+
#if defined (ACE_WIN32)
// Winsock is different - it sets the exception bit for failed connect,
// unlike other platforms, where the read bit is set.
ACE_Handle_Set ex_handles;
ex_handles.set_bit (h);
#endif /* ACE_WIN32 */
+
bool need_to_check = false;
bool known_failure = false;
+
#if defined (ACE_WIN32)
int n = ACE_OS::select (0, // Ignored on Windows: int (h) + 1,
0,
@@ -2222,7 +2561,9 @@ ACE::handle_timed_complete (ACE_HANDLE h,
timeout);
#else
# if defined (ACE_HAS_POLL) && defined (ACE_HAS_LIMITED_SELECT)
+
int n = ACE_OS::poll (&fds, 1, timeout);
+
# else
int n = ACE_OS::select (int (h) + 1,
rd_handles,
@@ -2231,6 +2572,7 @@ ACE::handle_timed_complete (ACE_HANDLE h,
timeout);
# endif /* ACE_HAS_POLL && ACE_HAS_LIMITED_SELECT */
#endif /* ACE_WIN32 */
+
// If we failed to connect within the time period allocated by the
// caller, then we fail (e.g., the remote host might have been too
// busy to accept our call).
@@ -2240,6 +2582,7 @@ ACE::handle_timed_complete (ACE_HANDLE h,
errno = ETIME;
return ACE_INVALID_HANDLE;
}
+
// Usually, a ready-for-write handle is successfully connected, and
// ready-for-read (exception on Win32) is a failure. On fails, we
// need to grab the error code via getsockopt. On possible success for
@@ -2247,6 +2590,7 @@ ACE::handle_timed_complete (ACE_HANDLE h,
// we also need to check for success/fail.
#if defined (ACE_WIN32)
ACE_UNUSED_ARG (is_tli);
+
// On Win32, ex_handle set indicates a failure. We'll do the check
// to try and get an errno value, but the connect failed regardless of
// what getsockopt says about the error.
@@ -2257,17 +2601,20 @@ ACE::handle_timed_complete (ACE_HANDLE h,
}
#elif defined (ACE_VXWORKS)
ACE_UNUSED_ARG (is_tli);
+
// Force the check on VxWorks. The read handle for "h" is not set,
// so "need_to_check" is false at this point. The write handle is
// set, for what it's worth.
need_to_check = true;
#else
if (is_tli)
+
# if defined (ACE_HAS_POLL) && defined (ACE_HAS_LIMITED_SELECT)
need_to_check = (fds.revents & POLLIN) && !(fds.revents & POLLOUT);
# else
need_to_check = rd_handles.is_set (h) && !wr_handles.is_set (h);
# endif /* ACE_HAS_POLL && ACE_HAS_LIMITED_SELECT */
+
else
#if defined(AIX)
// AIX is broken... both success and failed connect will set the
@@ -2281,6 +2628,7 @@ ACE::handle_timed_complete (ACE_HANDLE h,
# endif /* ACE_HAS_POLL && ACE_HAS_LIMITED_SELECT */
#endif /* AIX */
#endif /* ACE_WIN32 */
+
if (need_to_check)
{
#if defined (SOL_SOCKET) && defined (SO_ERROR)
@@ -2292,6 +2640,7 @@ ACE::handle_timed_complete (ACE_HANDLE h,
{
h = ACE_INVALID_HANDLE;
}
+
if (sock_err != 0 || known_failure)
{
h = ACE_INVALID_HANDLE;
@@ -2299,9 +2648,11 @@ ACE::handle_timed_complete (ACE_HANDLE h,
}
#else
char dummy;
+
// The following recv() won't block provided that the
// ACE_NONBLOCK flag has not been turned off .
n = ACE::recv (h, &dummy, 1, MSG_PEEK);
+
// If no data was read/peeked at, check to see if it's because
// of a non-connected socket (and therefore an error) or there's
// just no data yet.
@@ -2317,13 +2668,16 @@ ACE::handle_timed_complete (ACE_HANDLE h,
}
#endif
}
+
// 1. The HANDLE is ready for writing and doesn't need to be checked or
// 2. recv() returned an indication of the state of the socket - if there is
// either data present, or a recv is legit but there's no data yet,
// the connection was successfully established.
return h;
}
+
// Wait up to <timeout> amount of time to accept a connection.
+
int
ACE::handle_timed_accept (ACE_HANDLE listener,
ACE_Time_Value *timeout,
@@ -2333,21 +2687,29 @@ ACE::handle_timed_accept (ACE_HANDLE listener,
// Make sure we don't bomb out on erroneous values.
if (listener == ACE_INVALID_HANDLE)
return -1;
+
#if defined (ACE_HAS_POLL) && defined (ACE_HAS_LIMITED_SELECT)
+
struct pollfd fds;
+
fds.fd = listener;
fds.events = POLLIN;
fds.revents = 0;
+
#else
// Use the select() implementation rather than poll().
ACE_Handle_Set rd_handle;
rd_handle.set_bit (listener);
#endif /* ACE_HAS_POLL && ACE_HAS_LIMITED_SELECT */
+
// We need a loop here if <restart> is enabled.
+
for (;;)
{
#if defined (ACE_HAS_POLL) && defined (ACE_HAS_LIMITED_SELECT)
+
int n = ACE_OS::poll (&fds, 1, timeout);
+
#else
int select_width;
# if defined (ACE_WIN32)
@@ -2361,6 +2723,7 @@ ACE::handle_timed_accept (ACE_HANDLE listener,
rd_handle, 0, 0,
timeout);
#endif /* ACE_HAS_POLL && ACE_HAS_LIMITED_SELECT */
+
switch (n)
{
case -1:
@@ -2388,8 +2751,10 @@ ACE::handle_timed_accept (ACE_HANDLE listener,
}
}
}
+
// Make the current process a UNIX daemon. This is based on Stevens
// code from APUE.
+
int
ACE::daemonize (const ACE_TCHAR pathname[],
bool close_all_handles,
@@ -2398,44 +2763,58 @@ ACE::daemonize (const ACE_TCHAR pathname[],
ACE_TRACE ("ACE::daemonize");
#if !defined (ACE_LACKS_FORK)
pid_t pid = ACE_OS::fork ();
+
if (pid == -1)
return -1;
else if (pid != 0)
ACE_OS::exit (0); // Parent exits.
+
// 1st child continues.
ACE_OS::setsid (); // Become session leader.
+
ACE_OS::signal (SIGHUP, SIG_IGN);
+
pid = ACE_OS::fork (program_name);
+
if (pid != 0)
ACE_OS::exit (0); // First child terminates.
+
// Second child continues.
+
if (pathname != 0)
// change working directory.
ACE_OS::chdir (pathname);
+
ACE_OS::umask (0); // clear our file mode creation mask.
+
// Close down the I/O handles.
if (close_all_handles)
{
for (int i = ACE::max_handles () - 1; i >= 0; i--)
ACE_OS::close (i);
+
int fd = ACE_OS::open ("/dev/null", O_RDWR, 0);
if (fd != -1)
{
ACE_OS::dup2 (fd, ACE_STDIN);
ACE_OS::dup2 (fd, ACE_STDOUT);
ACE_OS::dup2 (fd, ACE_STDERR);
+
if (fd > ACE_STDERR)
ACE_OS::close (fd);
}
}
+
return 0;
#else
ACE_UNUSED_ARG (pathname);
ACE_UNUSED_ARG (close_all_handles);
ACE_UNUSED_ARG (program_name);
+
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_LACKS_FORK */
}
+
pid_t
ACE::fork (const ACE_TCHAR *program_name,
int avoid_zombies)
@@ -2452,6 +2831,7 @@ ACE::fork (const ACE_TCHAR *program_name,
//
// Another way to avoid zombies is to ignore or catch the
// SIGCHLD signal; we don't use that approach here.
+
pid_t pid = ACE_OS::fork ();
if (pid == 0)
{
@@ -2466,10 +2846,12 @@ ACE::fork (const ACE_TCHAR *program_name,
ACE_OS::_exit (0);
}
}
+
// Parent process waits for child to terminate.
ACE_exitcode status;
if (pid < 0 || ACE_OS::waitpid (pid, &status, 0) < 0)
return -1;
+
// child terminated by calling exit()?
if (WIFEXITED ((status)))
{
@@ -2482,9 +2864,11 @@ ACE::fork (const ACE_TCHAR *program_name,
else
// child didn't call exit(); perhaps it received a signal?
errno = EINTR;
+
return -1;
}
}
+
int
ACE::max_handles (void)
{
@@ -2501,6 +2885,7 @@ ACE::max_handles (void)
// If == RLIM_INFINITY, fall through to the ACE_LACKS_RLIMIT sections
# endif /* RLIM_INFINITY */
#endif /* RLIMIT_NOFILE && !ACE_LACKS_RLIMIT */
+
#if defined (_SC_OPEN_MAX)
return ACE_OS::sysconf (_SC_OPEN_MAX);
#elif defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x620)
@@ -2511,10 +2896,12 @@ ACE::max_handles (void)
ACE_NOTSUP_RETURN (-1);
#endif /* _SC_OPEN_MAX */
}
+
// Set the number of currently open handles in the process.
//
// If NEW_LIMIT == -1 set the limit to the maximum allowable.
// Otherwise, set it to be the value of NEW_LIMIT.
+
int
ACE::set_handle_limit (int new_limit,
int increase_limit_only)
@@ -2522,17 +2909,22 @@ ACE::set_handle_limit (int new_limit,
ACE_TRACE ("ACE::set_handle_limit");
int cur_limit = ACE::max_handles ();
int max_limit = cur_limit;
+
if (cur_limit == -1)
return -1;
+
#if !defined (ACE_LACKS_RLIMIT) && defined (RLIMIT_NOFILE)
struct rlimit rl;
+
ACE_OS::memset ((void *) &rl, 0, sizeof rl);
int r = ACE_OS::getrlimit (RLIMIT_NOFILE, &rl);
if (r == 0)
max_limit = rl.rlim_max;
#endif /* ACE_LACKS_RLIMIT */
+
if (new_limit == -1)
new_limit = max_limit;
+
if (new_limit < 0)
{
errno = EINVAL;
@@ -2564,8 +2956,10 @@ ACE::set_handle_limit (int new_limit,
return 0;
#endif /* ACE_LACKS_RLIMIT */
}
+
return 0;
}
+
// Euclid's greatest common divisor algorithm.
u_long
ACE::gcd (u_long x, u_long y)
@@ -2576,9 +2970,11 @@ ACE::gcd (u_long x, u_long y)
x = y;
y = r;
}
+
return x;
}
+
// Calculates the minimum enclosing frame size for the given values.
u_long
ACE::minimum_frame_size (u_long period1, u_long period2)
@@ -2593,8 +2989,10 @@ ACE::minimum_frame_size (u_long period1, u_long period2)
{
return period1;
}
+
// if neither is zero, find the greatest common divisor of the two periods
u_long greatest_common_divisor = ACE::gcd (period1, period2);
+
// explicitly consider cases to reduce risk of possible overflow errors
if (greatest_common_divisor == 1)
{
@@ -2620,6 +3018,7 @@ ACE::minimum_frame_size (u_long period1, u_long period2)
}
}
+
u_long
ACE::is_prime (const u_long n,
const u_long min_factor,
@@ -2631,13 +3030,16 @@ ACE::is_prime (const u_long n,
++factor)
if (n / factor * factor == n)
return factor;
+
return 0;
}
+
const ACE_TCHAR *
ACE::sock_error (int error)
{
#if defined (ACE_WIN32)
static ACE_TCHAR unknown_msg[64];
+
switch (error)
{
case WSAVERNOTSUPPORTED:
@@ -2783,6 +3185,7 @@ ACE::sock_error (int error)
ACE_NOTSUP_RETURN (0);
#endif /* ACE_WIN32 */
}
+
bool
ACE::is_sock_error (int error)
{
@@ -2841,35 +3244,43 @@ ACE::is_sock_error (int error)
#endif /* ACE_WIN32 */
return false;
}
+
char *
ACE::strndup (const char *str, size_t n)
{
const char *t = str;
size_t len;
+
// Figure out how long this string is (remember, it might not be
// NUL-terminated).
+
for (len = 0;
len < n && *t++ != '\0';
len++)
continue;
+
char *s;
ACE_ALLOCATOR_RETURN (s,
(char *) ACE_OS::malloc (len + 1),
0);
return ACE_OS::strsncpy (s, str, len + 1);
}
+
#if defined (ACE_HAS_WCHAR)
wchar_t *
ACE::strndup (const wchar_t *str, size_t n)
{
const wchar_t *t = str;
size_t len;
+
// Figure out how long this string is (remember, it might not be
// NUL-terminated).
+
for (len = 0;
len < n && *t++ != '\0';
len++)
continue;
+
wchar_t *s;
ACE_ALLOCATOR_RETURN (s,
static_cast<wchar_t *> (
@@ -2878,35 +3289,43 @@ ACE::strndup (const wchar_t *str, size_t n)
return ACE_OS::strsncpy (s, str, len + 1);
}
#endif /* ACE_HAS_WCHAR */
+
char *
ACE::strnnew (const char *str, size_t n)
{
const char *t = str;
size_t len;
+
// Figure out how long this string is (remember, it might not be
// NUL-terminated).
+
for (len = 0;
len < n && *t++ != L'\0';
len++)
continue;
+
char *s;
ACE_NEW_RETURN (s,
char[len + 1],
0);
return ACE_OS::strsncpy (s, str, len + 1);
}
+
#if defined (ACE_HAS_WCHAR)
wchar_t *
ACE::strnnew (const wchar_t *str, size_t n)
{
const wchar_t *t = str;
size_t len;
+
// Figure out how long this string is (remember, it might not be
// NUL-terminated).
+
for (len = 0;
len < n && *t++ != ACE_TEXT_WIDE ('\0');
len++)
continue;
+
wchar_t *s;
ACE_NEW_RETURN (s,
wchar_t[len + 1],
@@ -2914,22 +3333,27 @@ ACE::strnnew (const wchar_t *str, size_t n)
return ACE_OS::strsncpy (s, str, len + 1);
}
#endif /* ACE_HAS_WCHAR */
+
const char *
ACE::strend (const char *s)
{
while (*s++ != '\0')
continue;
+
return s;
}
+
#if defined ACE_HAS_WCHAR
const wchar_t *
ACE::strend (const wchar_t *s)
{
while (*s++ != ACE_TEXT_WIDE ('\0'))
continue;
+
return s;
}
#endif
+
char *
ACE::strnew (const char *s)
{
@@ -2944,6 +3368,7 @@ ACE::strnew (const char *s)
else
return ACE_OS::strcpy (t, s);
}
+
#if defined (ACE_HAS_WCHAR)
wchar_t *
ACE::strnew (const wchar_t *s)
@@ -2960,12 +3385,14 @@ ACE::strnew (const wchar_t *s)
return ACE_OS::strcpy (t, s);
}
#endif /* ACE_HAS_WCHAR */
+
inline static bool equal_char(char a, char b, bool case_sensitive)
{
if (case_sensitive)
return a == b;
return ACE_OS::ace_tolower(a) == ACE_OS::ace_tolower(b);
}
+
bool
ACE::wild_match(const char* str, const char* pat, bool case_sensitive)
{
@@ -2973,6 +3400,7 @@ ACE::wild_match(const char* str, const char* pat, bool case_sensitive)
return true;
if (pat == 0 || str == 0)
return false;
+
bool star = false;
const char* s = str;
const char* p = pat;
@@ -2983,6 +3411,7 @@ ACE::wild_match(const char* str, const char* pat, bool case_sensitive)
star = true;
pat = p;
while (*++pat == '*') {}
+
if (*pat == '\0')
return true;
p = pat;
@@ -3007,8 +3436,10 @@ ACE::wild_match(const char* str, const char* pat, bool case_sensitive)
}
if (*p == '*')
while (*++p == '*') {}
+
return *p == '\0';
}
+
// Close versioned namespace, if enabled by the user.
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/ACE.h b/dep/ACE_wrappers/ace/ACE.h
index 15c05da00de..ea7a3fa02e4 100644
--- a/dep/ACE_wrappers/ace/ACE.h
+++ b/dep/ACE_wrappers/ace/ACE.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file ACE.h
@@ -15,13 +16,18 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_ACE_H
#define ACE_ACE_H
+
#include /**/ "ace/pre.h"
+
#include "ace/config-lite.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/OS_NS_math.h"
#include "ace/Flag_Manip.h"
#include "ace/Handle_Ops.h"
@@ -29,16 +35,20 @@
#include "ace/Init_ACE.h"
#include "ace/Sock_Connect.h"
#include "ace/Default_Constants.h"
+
#if defined (ACE_EXPORT_MACRO)
# undef ACE_EXPORT_MACRO
#endif
#define ACE_EXPORT_MACRO ACE_Export
+
// Open versioned namespace, if enabled by the user.
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward declarations.
class ACE_Time_Value;
class ACE_Message_Block;
class ACE_Handle_Set;
+
/**
* @namespace ACE
*
@@ -53,26 +63,35 @@ namespace ACE
// = ACE version information.
/// e.g., the "5" in ACE 5.1.12.
extern ACE_Export u_int major_version (void);
+
/// e.g., the "1" in ACE 5.1.12.
extern ACE_Export u_int minor_version (void);
+
/// e.g., the "12" in ACE 5.1.12.
/// Returns 0 for "stable" (non-beta) releases.
extern ACE_Export u_int beta_version (void);
+
// = C++ compiler version information.
/// E.g., the "SunPro C++" in SunPro C++ 4.32.0
extern ACE_Export const ACE_TCHAR * compiler_name (void);
+
/// E.g., the "4" in SunPro C++ 4.32.0
extern ACE_Export u_int compiler_major_version (void);
+
/// E.g., the "32" in SunPro C++ 4.32.0
extern ACE_Export u_int compiler_minor_version (void);
+
/// E.g., the "0" in SunPro C++ 4.32.0
extern ACE_Export u_int compiler_beta_version (void);
+
/// Check if error indicates the process being out of handles (file
/// descriptors).
extern ACE_Export int out_of_handles (int error);
+
/// Simple wildcard matching function supporting '*' and '?'
/// return true if string s matches pattern.
extern ACE_Export bool wild_match(const char* s, const char* pattern, bool case_sensitive = true);
+
/**
* @name I/O operations
*
@@ -127,21 +146,27 @@ namespace ACE
size_t len,
int flags,
const ACE_Time_Value *timeout = 0);
+
#if defined (ACE_HAS_TLI)
+
extern ACE_Export ssize_t t_rcv (ACE_HANDLE handle,
void *buf,
size_t len,
int *flags,
const ACE_Time_Value *timeout = 0);
+
#endif /* ACE_HAS_TLI */
+
extern ACE_Export ssize_t recv (ACE_HANDLE handle,
void *buf,
size_t len,
const ACE_Time_Value *timeout = 0);
+
extern ACE_Export ssize_t recvmsg (ACE_HANDLE handle,
struct msghdr *msg,
int flags,
const ACE_Time_Value *timeout = 0);
+
extern ACE_Export ssize_t recvfrom (ACE_HANDLE handle,
char *buf,
int len,
@@ -149,6 +174,7 @@ namespace ACE
struct sockaddr *addr,
int *addrlen,
const ACE_Time_Value *timeout = 0);
+
ACE_NAMESPACE_INLINE_FUNCTION
ssize_t recv_n (ACE_HANDLE handle,
void *buf,
@@ -156,7 +182,9 @@ namespace ACE
int flags,
const ACE_Time_Value *timeout = 0,
size_t *bytes_transferred = 0);
+
#if defined (ACE_HAS_TLI)
+
ACE_NAMESPACE_INLINE_FUNCTION
ssize_t t_rcv_n (ACE_HANDLE handle,
void *buf,
@@ -164,13 +192,16 @@ namespace ACE
int *flags,
const ACE_Time_Value *timeout = 0,
size_t *bytes_transferred = 0);
+
#endif /* ACE_HAS_TLI */
+
ACE_NAMESPACE_INLINE_FUNCTION
ssize_t recv_n (ACE_HANDLE handle,
void *buf,
size_t len,
const ACE_Time_Value *timeout = 0,
size_t *bytes_transferred = 0);
+
/// Receive into a variable number of pieces.
/**
* Accepts a variable, caller-specified, number of pointer/length
@@ -182,40 +213,50 @@ namespace ACE
* @return -1 on error, else total number of bytes received.
*/
extern ACE_Export ssize_t recv (ACE_HANDLE handle, size_t n, ...);
+
extern ACE_Export ssize_t recvv (ACE_HANDLE handle,
iovec *iov,
int iovcnt,
const ACE_Time_Value *timeout = 0);
+
ACE_NAMESPACE_INLINE_FUNCTION
ssize_t recvv_n (ACE_HANDLE handle,
iovec *iov,
int iovcnt,
const ACE_Time_Value *timeout = 0,
size_t *bytes_transferred = 0);
+
extern ACE_Export ssize_t recv_n (ACE_HANDLE handle,
ACE_Message_Block *message_block,
const ACE_Time_Value *timeout = 0,
size_t *bytes_transferred = 0);
+
extern ACE_Export ssize_t send (ACE_HANDLE handle,
const void *buf,
size_t len,
int flags,
const ACE_Time_Value *timeout = 0);
+
#if defined (ACE_HAS_TLI)
+
extern ACE_Export ssize_t t_snd (ACE_HANDLE handle,
const void *buf,
size_t len,
int flags,
const ACE_Time_Value *timeout = 0);
+
#endif /* ACE_HAS_TLI */
+
extern ACE_Export ssize_t send (ACE_HANDLE handle,
const void *buf,
size_t len,
const ACE_Time_Value *timeout = 0);
+
extern ACE_Export ssize_t sendmsg (ACE_HANDLE handle,
const struct msghdr *msg,
int flags,
const ACE_Time_Value *timeout = 0);
+
extern ACE_Export ssize_t sendto (ACE_HANDLE handle,
const char *buf,
int len,
@@ -223,6 +264,7 @@ namespace ACE
const struct sockaddr *addr,
int addrlen,
const ACE_Time_Value *timeout = 0);
+
ACE_NAMESPACE_INLINE_FUNCTION
ssize_t send_n (ACE_HANDLE handle,
const void *buf,
@@ -230,7 +272,9 @@ namespace ACE
int flags,
const ACE_Time_Value *timeout = 0,
size_t *bytes_transferred = 0);
+
#if defined (ACE_HAS_TLI)
+
ACE_NAMESPACE_INLINE_FUNCTION
ssize_t t_snd_n (ACE_HANDLE handle,
const void *buf,
@@ -238,25 +282,31 @@ namespace ACE
int flags,
const ACE_Time_Value *timeout = 0,
size_t *bytes_transferred = 0);
+
#endif /* ACE_HAS_TLI */
+
ACE_NAMESPACE_INLINE_FUNCTION
ssize_t send_n (ACE_HANDLE handle,
const void *buf,
size_t len,
const ACE_Time_Value *timeout = 0,
size_t *bytes_transferred = 0);
+
/// Varargs variant.
extern ACE_Export ssize_t send (ACE_HANDLE handle, size_t n, ...);
+
extern ACE_Export ssize_t sendv (ACE_HANDLE handle,
const iovec *iov,
int iovcnt,
const ACE_Time_Value *timeout = 0);
+
ACE_NAMESPACE_INLINE_FUNCTION
ssize_t sendv_n (ACE_HANDLE handle,
const iovec *iov,
int iovcnt,
const ACE_Time_Value *timeout = 0,
size_t *bytes_transferred = 0);
+
/// Send all the @a message_blocks chained through their @c next and
/// @c cont pointers. This call uses the underlying OS gather-write
/// operation to reduce the domain-crossing penalty.
@@ -264,32 +314,39 @@ namespace ACE
const ACE_Message_Block *message_block,
const ACE_Time_Value *timeout = 0,
size_t *bytes_transferred = 0);
+
// = File system I/O functions (these don't support timeouts).
+
ACE_NAMESPACE_INLINE_FUNCTION
ssize_t read_n (ACE_HANDLE handle,
void *buf,
size_t len,
size_t *bytes_transferred = 0);
+
ACE_NAMESPACE_INLINE_FUNCTION
ssize_t write_n (ACE_HANDLE handle,
const void *buf,
size_t len,
size_t *bytes_transferred = 0);
+
/// Write all the @a message_blocks chained through their @c next
/// and @c cont pointers. This call uses the underlying OS
/// gather-write operation to reduce the domain-crossing penalty.
extern ACE_Export ssize_t write_n (ACE_HANDLE handle,
const ACE_Message_Block *message_block,
size_t *bytes_transferred = 0);
+
extern ACE_Export ssize_t readv_n (ACE_HANDLE handle,
iovec *iov,
int iovcnt,
size_t *bytes_transferred = 0);
+
extern ACE_Export ssize_t writev_n (ACE_HANDLE handle,
const iovec *iov,
int iovcnt,
size_t *bytes_transferred = 0);
//@}
+
/**
* Wait up to @a timeout amount of time to passively establish a
* connection. This method doesn't perform the @c accept, it just
@@ -298,6 +355,7 @@ namespace ACE
extern ACE_Export int handle_timed_accept (ACE_HANDLE listener,
ACE_Time_Value *timeout,
int restart);
+
/**
* Wait up to @a timeout amount of time to complete an actively
* established non-blocking connection. If @a is_tli is non-0 then
@@ -308,6 +366,7 @@ namespace ACE
ACE_HANDLE listener,
const ACE_Time_Value *timeout,
int is_tli = 0);
+
/**
* Reset the limit on the number of open handles. If @a new_limit
* == -1 set the limit to the maximum allowable. Otherwise, set
@@ -316,12 +375,14 @@ namespace ACE
*/
extern ACE_Export int set_handle_limit (int new_limit = -1,
int increase_limit_only = 0);
+
/**
* Returns the maximum number of open handles currently permitted in
* this process. This maximum may be extended using
* @c ACE::set_handle_limit.
*/
extern ACE_Export int max_handles (void);
+
// = String functions
#if !defined (ACE_HAS_WINCE)
/**
@@ -332,28 +393,40 @@ namespace ACE
*/
extern ACE_Export ACE_TCHAR *strenvdup (const ACE_TCHAR *str);
#endif /* ACE_HAS_WINCE */
+
/// Returns a pointer to the "end" of the string, i.e., the character
/// past the '\0'.
extern ACE_Export const char *strend (const char *s);
+
/// This method is just like @c strdup, except that it uses
/// @c operator @c new rather than @c malloc. If @a s is NULL
/// returns NULL rather than segfaulting.
extern ACE_Export char *strnew (const char *s);
+
/// Delete the memory allocated by @c strnew.
ACE_NAMESPACE_INLINE_FUNCTION void strdelete (char *s);
+
/// Create a fresh new copy of @a str, up to @a n chars long. Uses
/// @c ACE_OS::malloc to allocate the new string.
extern ACE_Export char *strndup (const char *str, size_t n);
+
/// Create a fresh new copy of @a str, up to @a n chars long. Uses
/// @c ACE_OS::malloc to allocate the new string.
extern ACE_Export char *strnnew (const char *str, size_t n);
+
#if defined (ACE_HAS_WCHAR)
extern ACE_Export const wchar_t *strend (const wchar_t *s);
+
extern ACE_Export wchar_t *strnew (const wchar_t *s);
+
ACE_NAMESPACE_INLINE_FUNCTION void strdelete (wchar_t *s);
+
extern ACE_Export wchar_t *strndup (const wchar_t *str, size_t n);
+
extern ACE_Export wchar_t *strnnew (const wchar_t *str, size_t n);
+
#endif /* ACE_HAS_WCHAR */
+
/**
* On Windows, determines if a specified pathname ends with ".exe"
* (not case sensitive). If on Windows and there is no ".exe" suffix,
@@ -371,6 +444,7 @@ namespace ACE
* memory using delete [].
*/
extern ACE_Export const ACE_TCHAR *execname (const ACE_TCHAR *pathname);
+
/**
* Returns the "basename" of a @a pathname separated by @a delim.
* For instance, the basename of "/tmp/foo.cpp" is "foo.cpp" when
@@ -379,6 +453,7 @@ namespace ACE
extern ACE_Export const ACE_TCHAR *basename (const ACE_TCHAR *pathname,
ACE_TCHAR delim =
ACE_DIRECTORY_SEPARATOR_CHAR);
+
/**
* Returns the "dirname" of a @a pathname. For instance, the
* dirname of "/tmp/foo.cpp" is "/tmp" when @a delim is @a '/'. If
@@ -388,6 +463,7 @@ namespace ACE
extern ACE_Export const ACE_TCHAR *dirname (const ACE_TCHAR *pathname,
ACE_TCHAR delim =
ACE_DIRECTORY_SEPARATOR_CHAR);
+
/**
* Returns the current timestamp in the form
* "hour:minute:second:microsecond." The month, day, and year are
@@ -402,6 +478,7 @@ namespace ACE
extern ACE_Export ACE_TCHAR *timestamp (ACE_TCHAR date_and_time[],
size_t time_len,
bool return_pointer_to_first_digit = false);
+
/**
* if @a avoid_zombies == 0 call @c ACE_OS::fork directly, else
* create an orphan process that's inherited by the init process;
@@ -414,6 +491,7 @@ namespace ACE
extern ACE_Export pid_t fork (
const ACE_TCHAR *program_name = ACE_TEXT ("<unknown>"),
int avoid_zombies = 0);
+
/**
* Become a daemon process using the algorithm in Richard Stevens
* "Advanced Programming in the UNIX Environment." If
@@ -424,47 +502,63 @@ namespace ACE
const ACE_TCHAR pathname[] = ACE_TEXT ("/"),
bool close_all_handles = ACE_DEFAULT_CLOSE_ALL_HANDLES,
const ACE_TCHAR program_name[] = ACE_TEXT ("<unknown>"));
+
// = Miscellaneous functions.
/// Rounds the request to a multiple of the page size.
extern ACE_Export size_t round_to_pagesize (size_t len);
+
/// Rounds the request to a multiple of the allocation granularity.
extern ACE_Export size_t round_to_allocation_granularity (size_t len);
+
// @@ UNICODE what about buffer?
/// Format buffer into printable format. This is useful for
/// debugging.
extern ACE_Export size_t format_hexdump (const char *buffer, size_t size,
ACE_TCHAR *obuf, size_t obuf_sz);
+
/// Computes the hash value of {str} using the "Hash PJW" routine.
extern ACE_Export u_long hash_pjw (const char *str);
+
/// Computes the hash value of {str} using the "Hash PJW" routine.
extern ACE_Export u_long hash_pjw (const char *str, size_t len);
+
#if defined (ACE_HAS_WCHAR)
/// Computes the hash value of {str} using the "Hash PJW" routine.
extern ACE_Export u_long hash_pjw (const wchar_t *str);
+
/// Computes the hash value of {str} using the "Hash PJW" routine.
extern ACE_Export u_long hash_pjw (const wchar_t *str, size_t len);
#endif /* ACE_HAS_WCHAR */
+
/// Computes CRC-CCITT for the string.
extern ACE_Export ACE_UINT16 crc_ccitt(const char *str);
+
/// Computes CRC-CCITT for the buffer.
extern ACE_Export ACE_UINT16 crc_ccitt(const void *buf, size_t len,
ACE_UINT16 crc = 0);
+
/// Computes CRC-CCITT for the @ len iovec buffers.
extern ACE_Export ACE_UINT16 crc_ccitt(const iovec *iov, int len,
ACE_UINT16 crc = 0);
+
/// Computes the ISO 8802-3 standard 32 bits CRC for the string.
extern ACE_Export ACE_UINT32 crc32 (const char *str);
+
/// Computes the ISO 8802-3 standard 32 bits CRC for the buffer.
extern ACE_Export ACE_UINT32 crc32 (const void *buf, size_t len,
ACE_UINT32 crc = 0);
+
/// Computes the ISO 8802-3 standard 32 bits CRC for the
/// @ len iovec buffers.
extern ACE_Export ACE_UINT32 crc32 (const iovec *iov, int len,
ACE_UINT32 crc = 0);
+
/// Euclid's greatest common divisor algorithm.
extern ACE_Export u_long gcd (u_long x, u_long y);
+
/// Calculates the minimum enclosing frame size for the given values.
extern ACE_Export u_long minimum_frame_size (u_long period1, u_long period2);
+
/**
* Function that can burn up noticeable CPU time: brute-force
* determination of whether number @a n is prime. Returns 0 if
@@ -476,23 +570,28 @@ namespace ACE
extern ACE_Export u_long is_prime (const u_long n,
const u_long min_factor,
const u_long max_factor);
+
/// Map troublesome win32 errno values to values that standard C
/// strerr function understands. Thank you Microsoft.
extern ACE_Export int map_errno (int error);
+
/// Returns a string containing the error message corresponding to a
/// WinSock error. This works around an omission in the Win32 API.
/// @internal
extern ACE_Export const ACE_TCHAR * sock_error (int error);
+
/// Determins whether the given error code corresponds to to a
/// WinSock error. If so returns true, false otherwise.
/// @internal
extern ACE_Export bool is_sock_error (int error);
+
/**
* Checks if process with {pid} is still alive. Returns 1 if it is
* still alive, 0 if it isn't alive, and -1 if something weird
* happened.
*/
extern ACE_Export int process_active (pid_t pid);
+
/**
* Terminate the process abruptly with id @a pid. On Win32 platforms
* this uses {TerminateProcess} and on POSIX platforms is uses
@@ -502,6 +601,7 @@ namespace ACE
* cleanup before it shuts down.
*/
extern ACE_Export int terminate_process (pid_t pid);
+
/**
* This method uses process id and object pointer to come up with a
* machine wide unique name. The process ID will provide uniqueness
@@ -513,169 +613,213 @@ namespace ACE
ACE_NAMESPACE_INLINE_FUNCTION void unique_name (const void *object,
ACE_TCHAR *name,
size_t length);
+
/// Computes the base 2 logarithm of {num}.
ACE_NAMESPACE_INLINE_FUNCTION u_long log2 (u_long num);
+
/// Hex conversion utility.
ACE_NAMESPACE_INLINE_FUNCTION ACE_TCHAR nibble2hex (u_int n);
+
/// Convert a hex character to its byte representation.
ACE_NAMESPACE_INLINE_FUNCTION u_char hex2byte (ACE_TCHAR c);
+
// = Set/get the debug level.
extern ACE_Export bool debug (void);
extern ACE_Export void debug (bool onoff);
+
/// Wrapper facade for @c select that uses @c ACE_Handle_Sets.
extern ACE_Export int select (int width,
ACE_Handle_Set *readfds,
ACE_Handle_Set *writefds = 0,
ACE_Handle_Set *exceptfds = 0,
const ACE_Time_Value *timeout = 0);
+
/// Wrapper facade for the most common use of @c select that uses
/// @c ACE_Handle_Sets.
extern ACE_Export int select (int width,
ACE_Handle_Set &readfds,
const ACE_Time_Value *timeout = 0);
+
/// Timed wait for handle to get read ready.
ACE_NAMESPACE_INLINE_FUNCTION
int handle_read_ready (ACE_HANDLE handle,
const ACE_Time_Value *timeout);
+
/// Timed wait for handle to get write ready.
ACE_NAMESPACE_INLINE_FUNCTION
int handle_write_ready (ACE_HANDLE handle,
const ACE_Time_Value *timeout);
+
/// Timed wait for handle to get exception ready.
ACE_NAMESPACE_INLINE_FUNCTION
int handle_exception_ready (ACE_HANDLE handle,
const ACE_Time_Value *timeout);
+
/// Timed wait for handle to get read, write, or exception ready.
extern ACE_Export int handle_ready (ACE_HANDLE handle,
const ACE_Time_Value *timeout,
int read_ready,
int write_ready,
int exception_ready);
+
/// Wait for @a timeout before proceeding to a @c recv operation.
/// @a val keeps track of whether we're in non-blocking mode or
/// not.
extern ACE_Export int enter_recv_timedwait (ACE_HANDLE handle,
const ACE_Time_Value *timeout,
int &val);
+
/// Wait for @a timeout before proceeding to a @c send operation.
/// @a val keeps track of whether we're in non-blocking mode or
/// not.
extern ACE_Export int enter_send_timedwait (ACE_HANDLE handle,
const ACE_Time_Value* timeout,
int &val);
+
/// This makes sure that @a handle is set into non-blocking mode.
/// @a val keeps track of whether were in non-blocking mode or not.
extern ACE_Export void record_and_set_non_blocking_mode (ACE_HANDLE handle,
int &val);
+
/// Cleanup after a timed operation, restore the appropriate
/// non-blocking status of @a handle.
extern ACE_Export void restore_non_blocking_mode (ACE_HANDLE handle,
int val);
+
// private:
// These functions aren't meant to be used internally, so they are
// not exported.
+
//
// = Recv_n helpers
//
+
ACE_NAMESPACE_INLINE_FUNCTION ssize_t recv_i (ACE_HANDLE handle,
void *buf,
size_t len);
+
extern ACE_Export ssize_t recv_n_i (ACE_HANDLE handle,
void *buf,
size_t len,
int flags,
size_t *bytes_transferred);
+
extern ACE_Export ssize_t recv_n_i (ACE_HANDLE handle,
void *buf,
size_t len,
int flags,
const ACE_Time_Value *timeout,
size_t *bytes_transferred);
+
#if defined (ACE_HAS_TLI)
+
extern ACE_Export ssize_t t_rcv_n_i (ACE_HANDLE handle,
void *buf,
size_t len,
int *flags,
size_t *bytes_transferred);
+
extern ACE_Export ssize_t t_rcv_n_i (ACE_HANDLE handle,
void *buf,
size_t len,
int *flags,
const ACE_Time_Value *timeout,
size_t *bytes_transferred);
+
#endif /* ACE_HAS_TLI */
+
extern ACE_Export ssize_t recv_n_i (ACE_HANDLE handle,
void *buf,
size_t len,
size_t *bytes_transferred);
+
extern ACE_Export ssize_t recv_n_i (ACE_HANDLE handle,
void *buf,
size_t len,
const ACE_Time_Value *timeout,
size_t *bytes_transferred);
+
extern ACE_Export ssize_t recvv_n_i (ACE_HANDLE handle,
iovec *iov,
int iovcnt,
size_t *bytes_transferred);
+
extern ACE_Export ssize_t recvv_n_i (ACE_HANDLE handle,
iovec *iov,
int iovcnt,
const ACE_Time_Value *timeout,
size_t *bytes_transferred);
+
//
// = Send_n helpers
//
+
ACE_NAMESPACE_INLINE_FUNCTION ssize_t send_i (ACE_HANDLE handle,
const void *buf,
size_t len);
+
extern ACE_Export ssize_t send_n_i (ACE_HANDLE handle,
const void *buf,
size_t len,
int flags,
size_t *bytes_transferred);
+
extern ACE_Export ssize_t send_n_i (ACE_HANDLE handle,
const void *buf,
size_t len,
int flags,
const ACE_Time_Value *timeout,
size_t *bytes_transferred);
+
#if defined (ACE_HAS_TLI)
+
extern ACE_Export ssize_t t_snd_n_i (ACE_HANDLE handle,
const void *buf,
size_t len,
int flags,
size_t *bytes_transferred);
+
extern ACE_Export ssize_t t_snd_n_i (ACE_HANDLE handle,
const void *buf,
size_t len,
int flags,
const ACE_Time_Value *timeout,
size_t *bytes_transferred);
+
#endif /* ACE_HAS_TLI */
+
extern ACE_Export ssize_t send_n_i (ACE_HANDLE handle,
const void *buf,
size_t len,
size_t *bytes_transferred);
+
extern ACE_Export ssize_t send_n_i (ACE_HANDLE handle,
const void *buf,
size_t len,
const ACE_Time_Value *timeout,
size_t *bytes_transferred);
+
extern ACE_Export ssize_t sendv_n_i (ACE_HANDLE handle,
const iovec *iov,
int iovcnt,
size_t *bytes_transferred);
+
extern ACE_Export ssize_t sendv_n_i (ACE_HANDLE handle,
const iovec *iov,
int iovcnt,
const ACE_Time_Value *timeout,
size_t *bytes_transferred);
+
}
+
// Close versioned namespace, if enabled by the user.
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/ACE.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_ACE_H */
diff --git a/dep/ACE_wrappers/ace/ACE.inl b/dep/ACE_wrappers/ace/ACE.inl
index 0df84c2c08c..f800ac80a32 100644
--- a/dep/ACE_wrappers/ace/ACE.inl
+++ b/dep/ACE_wrappers/ace/ACE.inl
@@ -1,14 +1,18 @@
// -*- C++ -*-
//
// $Id: ACE.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_unistd.h"
#include "ace/OS_NS_Thread.h"
#include "ace/OS_NS_ctype.h"
#include "ace/OS_NS_sys_socket.h"
+
// Open versioned namespace, if enabled by the user.
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Wrappers for methods that have been moved to ACE_OS.
+
ACE_INLINE ssize_t
ACE::read_n (ACE_HANDLE handle,
void *buf,
@@ -20,6 +24,7 @@ ACE::read_n (ACE_HANDLE handle,
len,
bytes_transferred);
}
+
ACE_INLINE ssize_t
ACE::write_n (ACE_HANDLE handle,
const void *buf,
@@ -31,6 +36,7 @@ ACE::write_n (ACE_HANDLE handle,
len,
bytes_transferred);
}
+
ACE_INLINE ssize_t
ACE::recv_n (ACE_HANDLE handle,
void *buf,
@@ -53,7 +59,9 @@ ACE::recv_n (ACE_HANDLE handle,
timeout,
bytes_transferred);
}
+
#if defined (ACE_HAS_TLI)
+
ACE_INLINE ssize_t
ACE::t_rcv_n (ACE_HANDLE handle,
void *buf,
@@ -76,7 +84,9 @@ ACE::t_rcv_n (ACE_HANDLE handle,
timeout,
bytes_transferred);
}
+
#endif /* ACE_HAS_TLI */
+
ACE_INLINE ssize_t
ACE::recv_n (ACE_HANDLE handle,
void *buf,
@@ -96,6 +106,7 @@ ACE::recv_n (ACE_HANDLE handle,
timeout,
bytes_transferred);
}
+
ACE_INLINE ssize_t
ACE::recvv_n (ACE_HANDLE handle,
iovec *iov,
@@ -115,6 +126,7 @@ ACE::recvv_n (ACE_HANDLE handle,
timeout,
bytes_transferred);
}
+
ACE_INLINE ssize_t
ACE::send_n (ACE_HANDLE handle,
const void *buf,
@@ -137,7 +149,9 @@ ACE::send_n (ACE_HANDLE handle,
timeout,
bytes_transferred);
}
+
#if defined (ACE_HAS_TLI)
+
ACE_INLINE ssize_t
ACE::t_snd_n (ACE_HANDLE handle,
const void *buf,
@@ -160,7 +174,9 @@ ACE::t_snd_n (ACE_HANDLE handle,
timeout,
bytes_transferred);
}
+
#endif /* ACE_HAS_TLI */
+
ACE_INLINE ssize_t
ACE::send_n (ACE_HANDLE handle,
const void *buf,
@@ -180,6 +196,7 @@ ACE::send_n (ACE_HANDLE handle,
timeout,
bytes_transferred);
}
+
ACE_INLINE ssize_t
ACE::sendv_n (ACE_HANDLE handle,
const iovec *iov,
@@ -199,6 +216,7 @@ ACE::sendv_n (ACE_HANDLE handle,
timeout,
bytes_transferred);
}
+
ACE_INLINE ssize_t
ACE::send_i (ACE_HANDLE handle, const void *buf, size_t len)
{
@@ -208,6 +226,7 @@ ACE::send_i (ACE_HANDLE handle, const void *buf, size_t len)
return ACE_OS::write (handle, (const char *) buf, len);
#endif /* ACE_WIN32 */
}
+
ACE_INLINE ssize_t
ACE::recv_i (ACE_HANDLE handle, void *buf, size_t len)
{
@@ -217,6 +236,7 @@ ACE::recv_i (ACE_HANDLE handle, void *buf, size_t len)
return ACE_OS::read (handle, (char *) buf, len);
#endif /* ACE_WIN32 */
}
+
ACE_INLINE int
ACE::handle_read_ready (ACE_HANDLE handle,
const ACE_Time_Value *timeout)
@@ -227,6 +247,7 @@ ACE::handle_read_ready (ACE_HANDLE handle,
0,
0);
}
+
ACE_INLINE int
ACE::handle_write_ready (ACE_HANDLE handle,
const ACE_Time_Value *timeout)
@@ -237,6 +258,7 @@ ACE::handle_write_ready (ACE_HANDLE handle,
1,
0);
}
+
ACE_INLINE int
ACE::handle_exception_ready (ACE_HANDLE handle,
const ACE_Time_Value *timeout)
@@ -247,11 +269,13 @@ ACE::handle_exception_ready (ACE_HANDLE handle,
0,
1);
}
+
ACE_INLINE void
ACE::strdelete (char *s)
{
delete [] s;
}
+
#if defined (ACE_HAS_WCHAR)
ACE_INLINE void
ACE::strdelete (wchar_t *s)
@@ -259,6 +283,7 @@ ACE::strdelete (wchar_t *s)
delete [] s;
}
#endif /* ACE_HAS_WCHAR */
+
ACE_INLINE void
ACE::unique_name (const void *object,
ACE_TCHAR *name,
@@ -266,14 +291,18 @@ ACE::unique_name (const void *object,
{
ACE_OS::unique_name (object, name, length);
}
+
ACE_INLINE u_long
ACE::log2 (u_long num)
{
u_long log = 0;
+
for (; num > 1; ++log)
num >>= 1;
+
return log;
}
+
ACE_INLINE ACE_TCHAR
ACE::nibble2hex (u_int n)
{
@@ -287,9 +316,11 @@ ACE::nibble2hex (u_int n)
#else
static const ACE_TCHAR hex_chars[] = ACE_TEXT ("0123456789abcdef");
#endif
+
// Yes, this works for UNICODE
return hex_chars[n & 0x0f];
}
+
ACE_INLINE int
ACE::map_errno (int error)
{
@@ -300,8 +331,10 @@ ACE::map_errno (int error)
return EAGAIN; // Same as UNIX errno EWOULDBLOCK.
}
#endif /* ACE_WIN32 */
+
return error;
}
+
ACE_INLINE u_char
ACE::hex2byte (ACE_TCHAR c)
{
@@ -312,5 +345,6 @@ ACE::hex2byte (ACE_TCHAR c)
else
return (u_char) (10 + c - ACE_TEXT ('A'));
}
+
// Close versioned namespace, if enabled by the user.
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/ACE_crc32.cpp b/dep/ACE_wrappers/ace/ACE_crc32.cpp
index 9439f5641f3..e29a6426187 100644
--- a/dep/ACE_wrappers/ace/ACE_crc32.cpp
+++ b/dep/ACE_wrappers/ace/ACE_crc32.cpp
@@ -1,9 +1,12 @@
// $Id: ACE_crc32.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/ACE.h"
+
ACE_RCSID (ace,
ACE_crc32,
"$Id: ACE_crc32.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
namespace
{
/*****************************************************************/
@@ -25,6 +28,7 @@ namespace
/* in the FTP archive "ftp.adelaide.edu.au/pub/rocksoft". */
/* */
/*****************************************************************/
+
const ACE_UINT32 crc_table[] =
{
0x00000000L, 0x77073096L, 0xEE0E612CL, 0x990951BAL,
@@ -92,29 +96,37 @@ namespace
0xB3667A2EL, 0xC4614AB8L, 0x5D681B02L, 0x2A6F2B94L,
0xB40BBE37L, 0xC30C8EA1L, 0x5A05DF1BL, 0x2D02EF8DL
};
+
/*****************************************************************/
/* End of CRC Lookup Table */
/*****************************************************************/
}
+
#define COMPUTE(var, ch) (var) = (crc_table[(var ^ ch) & 0xFF] ^ (var >> 8))
+
// Open versioned namespace, if enabled by the user.
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_UINT32
ACE::crc32 (const char *string)
{
ACE_UINT32 crc = 0xFFFFFFFF;
+
for (const char *p = string;
*p != 0;
++p)
{
COMPUTE (crc, *p);
}
+
return ~crc;
}
+
ACE_UINT32
ACE::crc32 (const void *buffer, size_t len, ACE_UINT32 crc)
{
crc = ~crc;
+
for (const char *p = (const char *) buffer,
*e = (const char *) buffer + len;
p != e;
@@ -122,12 +134,15 @@ ACE::crc32 (const void *buffer, size_t len, ACE_UINT32 crc)
{
COMPUTE (crc, *p);
}
+
return ~crc;
}
+
ACE_UINT32
ACE::crc32 (const iovec *iov, int len, ACE_UINT32 crc)
{
crc = ~crc;
+
for (int i = 0; i < len; ++i)
{
for (const char *p = (const char *) iov[i].iov_base,
@@ -136,9 +151,12 @@ ACE::crc32 (const iovec *iov, int len, ACE_UINT32 crc)
++p)
COMPUTE (crc, *p);
}
+
return ~crc;
}
+
// Close versioned namespace, if enabled by the user.
ACE_END_VERSIONED_NAMESPACE_DECL
+
#undef COMPUTE
diff --git a/dep/ACE_wrappers/ace/ACE_crc_ccitt.cpp b/dep/ACE_wrappers/ace/ACE_crc_ccitt.cpp
index 58ec401d004..4e9b4a2f98e 100644
--- a/dep/ACE_wrappers/ace/ACE_crc_ccitt.cpp
+++ b/dep/ACE_wrappers/ace/ACE_crc_ccitt.cpp
@@ -1,8 +1,11 @@
// $Id: ACE_crc_ccitt.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/ACE.h"
+
ACE_RCSID (ace,
ACE_crc_ccitt,
"$Id: ACE_crc_ccitt.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
namespace
{
/*****************************************************************/
@@ -24,6 +27,7 @@ namespace
/* in the FTP archive "ftp.adelaide.edu.au/pub/rocksoft". */
/* */
/*****************************************************************/
+
const ACE_UINT16 crc_table[] =
{
0x0000, 0x1189, 0x2312, 0x329B, 0x4624, 0x57AD, 0x6536, 0x74BF,
@@ -59,29 +63,37 @@ namespace
0xF78F, 0xE606, 0xD49D, 0xC514, 0xB1AB, 0xA022, 0x92B9, 0x8330,
0x7BC7, 0x6A4E, 0x58D5, 0x495C, 0x3DE3, 0x2C6A, 0x1EF1, 0x0F78
};
+
/*****************************************************************/
/* End of CRC Lookup Table */
/*****************************************************************/
}
+
#define COMPUTE(var, ch) (var) = (crc_table[(var ^ ch) & 0xFF] ^ (var >> 8))
+
// Open versioned namespace, if enabled by the user.
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_UINT16
ACE::crc_ccitt (const char *string)
{
ACE_UINT16 crc = 0xFFFF;
+
for (const char *p = string;
*p != 0;
++p)
{
COMPUTE (crc, *p);
}
+
return ~crc;
}
+
ACE_UINT16
ACE::crc_ccitt (const void *buffer, size_t len, ACE_UINT16 crc)
{
crc = ~crc;
+
for (const char *p = (const char *) buffer,
*e = (const char *) buffer + len;
p != e;
@@ -89,12 +101,15 @@ ACE::crc_ccitt (const void *buffer, size_t len, ACE_UINT16 crc)
{
COMPUTE (crc, *p);
}
+
return ~crc;
}
+
ACE_UINT16
ACE::crc_ccitt (const iovec *iov, int len, ACE_UINT16 crc)
{
crc = ~crc;
+
for (int i = 0; i < len; ++i)
{
for (const char *p = (const char *) iov[i].iov_base,
@@ -103,9 +118,12 @@ ACE::crc_ccitt (const iovec *iov, int len, ACE_UINT16 crc)
++p)
COMPUTE (crc, *p);
}
+
return ~crc;
}
+
// Close versioned namespace, if enabled by the user.
ACE_END_VERSIONED_NAMESPACE_DECL
+
#undef COMPUTE
diff --git a/dep/ACE_wrappers/ace/ACE_export.h b/dep/ACE_wrappers/ace/ACE_export.h
index 94708a2f38b..60e79b01f1f 100644
--- a/dep/ACE_wrappers/ace/ACE_export.h
+++ b/dep/ACE_wrappers/ace/ACE_export.h
@@ -4,10 +4,14 @@
// This file is generated automatically by
// generate_export_file.pl
// ------------------------------
+
#ifndef ACE_EXPORT_H
#define ACE_EXPORT_H
+
#include "ace/config-lite.h"
+
#if defined (ACE_AS_STATIC_LIBS)
+
# if !defined (ACE_HAS_DLL)
# define ACE_HAS_DLL 0
# endif /* ! ACE_HAS_DLL */
@@ -16,6 +20,7 @@
# define ACE_HAS_DLL 1
# endif /* ! ACE_HAS_DLL */
#endif /* ACE_AS_STATIC_LIB */
+
#if defined (ACE_HAS_DLL)
# if (ACE_HAS_DLL == 1)
# if defined (ACE_BUILD_DLL)
@@ -37,12 +42,14 @@
# define ACE_SINGLETON_DECLARATION(T)
# define ACE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
#endif /* ACE_HAS_DLL */
+
// Added by hand to help with ACE_OS namespace
#if defined (__TANDEM) && defined (USE_EXPLICIT_EXPORT)
#define ACE_NAMESPACE_STORAGE_CLASS ACE_EXPORT_MACRO extern
#else
#define ACE_NAMESPACE_STORAGE_CLASS extern ACE_EXPORT_MACRO
#endif
+
#if defined (__ACE_INLINE__)
# if defined (_MSC_VER) || defined (__MINGW32__) || defined (CYGWIN32) || \
(defined (__SUNPRO_CC) && __SUNPRO_CC >= 0x560) || \
@@ -63,6 +70,8 @@
# define ACE_INLINE_TEMPLATE_FUNCTION
# endif
#endif
+
#endif /* ACE_EXPORT_H */
+
// End of auto generated file.
diff --git a/dep/ACE_wrappers/ace/ARGV.h b/dep/ACE_wrappers/ace/ARGV.h
index 3d98f53909d..c2995a451f2 100644
--- a/dep/ACE_wrappers/ace/ARGV.h
+++ b/dep/ACE_wrappers/ace/ARGV.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file ARGV.h
@@ -9,17 +10,23 @@
* @author Everett Anderson <eea1@cs.wustl.edu>
*/
//==========================================================================
+
#ifndef ACE_ARGUMENT_VECTOR_H
#define ACE_ARGUMENT_VECTOR_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Global_Macros.h"
#include "ace/Unbounded_Queue.h"
+
// Open versioned namespace, if enabled by the user.
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_ARGV_Queue_Entry_T
*
@@ -32,6 +39,7 @@ public:
// = Initialization and termination.
/// Initialize a ACE_ARGV_Queue_Entry_T.
ACE_ARGV_Queue_Entry_T (void);
+
/**
* Initialize a ACE_ARGV_Queue_Entry_T.
*
@@ -42,24 +50,31 @@ public:
*/
ACE_ARGV_Queue_Entry_T (const CHAR_TYPE *arg,
bool quote_arg);
+
/**
* Initialize a ACE_ARGV_Queue_Entry_T.
*
* @param entry Pointer to a queue entry
*/
ACE_ARGV_Queue_Entry_T (const ACE_ARGV_Queue_Entry_T<CHAR_TYPE> &entry);
+
/// We need this destructor to keep some compilers from complaining.
/// It's just a no-op, however.
~ACE_ARGV_Queue_Entry_T (void);
+
/// Dump the state of this object.
void dump (void) const;
+
// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
/// Pointer to the argument.
const CHAR_TYPE * arg_;
+
/// The argument need to be quoted while adding to the vector.
bool quote_arg_;
};
+
/**
* @class ACE_ARGV_T
*
@@ -97,6 +112,7 @@ public:
*/
explicit ACE_ARGV_T (const CHAR_TYPE buf[],
bool substitute_env_args = true);
+
/**
* Initializes the argument vector from a set of arguments. Any environment
* variable references are translated (if applicable) during execution of
@@ -123,6 +139,7 @@ public:
CHAR_TYPE *argv[],
bool substitute_env_args = true,
bool quote_args = false);
+
/**
* Initializes the argument vector from a set of arguments. Any environment
* variable references are translated (if applicable) during execution of
@@ -145,6 +162,7 @@ public:
explicit ACE_ARGV_T (CHAR_TYPE *argv[],
bool substitute_env_args = true,
bool quote_args = false);
+
/**
* Initializes the argument vector from two combined argument vectors.
*
@@ -167,14 +185,17 @@ public:
CHAR_TYPE *second_argv[],
bool substitute_env_args = true,
bool quote_args = false);
+
/**
* Initialize this object so arguments can be added later using one
* of the add methods. This is referred to as the @i iterative method
* of adding arguments to this object.
*/
explicit ACE_ARGV_T (bool substitute_env_args = true);
+
/// Destructor.
~ACE_ARGV_T (void);
+
/** @name Accessor methods
*
* These methods access the argument vector contained in this object.
@@ -189,25 +210,32 @@ public:
* @retval 0 if @a index is out of bounds.
*/
const CHAR_TYPE *operator[] (size_t index);
+
/**
* Returns the current argument vector. The returned pointers are to data
* maintained internally to this class. Do not change or delete either the
* pointers or the memory to which they refer.
*/
CHAR_TYPE **argv (void);
+
/// Returns the current number of arguments.
int argc (void) const;
+
/**
* Returns a single string form of the current arguments. The returned
* pointer refers to memory maintained internally to this class. Do not
* change or delete it.
*/
const CHAR_TYPE *buf (void);
+
//@}
+
/// Dump the state of this object.
void dump (void) const;
+
// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
/**
* Add another argument. This only works in the iterative mode.
*
@@ -226,6 +254,7 @@ public:
* - ENOMEM: Not enough memory available to save @a next_arg.
*/
int add (const CHAR_TYPE *next_arg, bool quote_arg = false);
+
/**
* Add an array of arguments. This only works in the iterative mode.
*
@@ -245,44 +274,61 @@ public:
* - ENOMEM: Not enough memory available to save @a next_arg.
*/
int add (CHAR_TYPE *argv[], bool quote_args = false);
+
private:
/// Copy constructor not implemented.
ACE_UNIMPLEMENTED_FUNC (ACE_ARGV_T (const ACE_ARGV_T<CHAR_TYPE>&))
+
/// Assignment operator not implemented.
ACE_UNIMPLEMENTED_FUNC (ACE_ARGV_T operator= (const ACE_ARGV_T<CHAR_TYPE>&))
+
/// Creates buf_ from the queue of added args, deletes previous buf_.
int create_buf_from_queue (void);
+
/// Converts buf_ into the CHAR_TYPE *argv[] format.
int string_to_argv (void);
+
/// Replace args with environment variable values?
bool substitute_env_args_;
+
bool iterative_;
+
/// Number of arguments in the ARGV array.
int argc_;
+
/// The array of string arguments.
CHAR_TYPE **argv_;
+
/// Buffer containing the <argv> contents.
CHAR_TYPE *buf_;
+
/// Total length of the arguments in the queue, not counting
/// separating spaces
size_t length_;
+
/// Queue which keeps user supplied arguments. This is only
/// active in the "iterative" mode.
ACE_Unbounded_Queue<ACE_ARGV_Queue_Entry_T<CHAR_TYPE> > queue_;
};
+
typedef ACE_ARGV_Queue_Entry_T<ACE_TCHAR> ACE_ARGV_Queue_Entry;
typedef ACE_ARGV_T<ACE_TCHAR> ACE_ARGV;
+
// Close versioned namespace, if enabled by the user.
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/ARGV.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/ARGV.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("ARGV.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
#endif /* ACE_ARGUMENT_VECTOR_H */
diff --git a/dep/ACE_wrappers/ace/ARGV.inl b/dep/ACE_wrappers/ace/ARGV.inl
index 07e598eb57c..fdc5b13d7c3 100644
--- a/dep/ACE_wrappers/ace/ARGV.inl
+++ b/dep/ACE_wrappers/ace/ARGV.inl
@@ -1,8 +1,11 @@
/* -*- C++ -*- */
// $Id: ARGV.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Global_Macros.h"
+
// Open versioned namespace, if enabled by the user.
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template <typename CHAR_TYPE> ACE_INLINE
ACE_ARGV_Queue_Entry_T<CHAR_TYPE>::ACE_ARGV_Queue_Entry_T (void)
: arg_(0),
@@ -10,6 +13,7 @@ ACE_ARGV_Queue_Entry_T<CHAR_TYPE>::ACE_ARGV_Queue_Entry_T (void)
{
// No-op
}
+
template <typename CHAR_TYPE> ACE_INLINE
ACE_ARGV_Queue_Entry_T<CHAR_TYPE>::ACE_ARGV_Queue_Entry_T (const CHAR_TYPE *arg,
bool quote_arg)
@@ -18,6 +22,7 @@ ACE_ARGV_Queue_Entry_T<CHAR_TYPE>::ACE_ARGV_Queue_Entry_T (const CHAR_TYPE *arg,
{
// No-op
}
+
template <typename CHAR_TYPE> ACE_INLINE
ACE_ARGV_Queue_Entry_T<CHAR_TYPE>::ACE_ARGV_Queue_Entry_T (const ACE_ARGV_Queue_Entry_T<CHAR_TYPE> &entry)
: arg_(entry.arg_),
@@ -25,11 +30,13 @@ ACE_ARGV_Queue_Entry_T<CHAR_TYPE>::ACE_ARGV_Queue_Entry_T (const ACE_ARGV_Queue_
{
// No-op
}
+
template <typename CHAR_TYPE> ACE_INLINE
ACE_ARGV_Queue_Entry_T<CHAR_TYPE>::~ACE_ARGV_Queue_Entry_T (void)
{
// No-op just to keep some compilers happy...
}
+
// Return the number of args
template <typename CHAR_TYPE>
ACE_INLINE int
@@ -42,43 +49,56 @@ ACE_ARGV_T<CHAR_TYPE>::argc (void) const
(void) nonconst_this->argv ();
return this->argc_;
}
+
// Return the arguments in a space-separated string
template <typename CHAR_TYPE>
ACE_INLINE const CHAR_TYPE *
ACE_ARGV_T<CHAR_TYPE>::buf (void)
{
ACE_TRACE ("ACE_ARGV_T::buf");
+
if (this->buf_ == 0 && this->iterative_)
this->create_buf_from_queue ();
+
return (const CHAR_TYPE *) this->buf_;
}
+
// Return the arguments in an entry-per-argument array
+
template <typename CHAR_TYPE>
ACE_INLINE CHAR_TYPE **
ACE_ARGV_T<CHAR_TYPE>::argv (void)
{
ACE_TRACE ("ACE_ARGV_T::argv");
+
// Try to create the argv_ if it isn't there
if (this->argv_ == 0)
{
if (this->iterative_ && this->buf_ == 0)
this->create_buf_from_queue ();
+
// Convert buf_ to argv_
if (this->string_to_argv () == -1)
return (CHAR_TYPE **) 0;
}
+
return (CHAR_TYPE **) this->argv_;
}
+
// Subscript operator.
+
template <typename CHAR_TYPE>
ACE_INLINE const CHAR_TYPE *
ACE_ARGV_T<CHAR_TYPE>::operator[] (size_t i)
{
ACE_TRACE ("ACE_ARGV_T::operator[]");
+
// Don't go out of bounds.
if (i >= static_cast<size_t> (this->argc_))
return 0;
+
return (const CHAR_TYPE *) this->argv ()[i];
}
+
// Close versioned namespace, if enabled by the user.
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/ATM_Acceptor.cpp b/dep/ACE_wrappers/ace/ATM_Acceptor.cpp
index 39a37a63c5f..0a58b7f3b1f 100644
--- a/dep/ACE_wrappers/ace/ATM_Acceptor.cpp
+++ b/dep/ACE_wrappers/ace/ATM_Acceptor.cpp
@@ -1,36 +1,49 @@
// $Id: ATM_Acceptor.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/ATM_Acceptor.h"
+
ACE_RCSID(ace, ATM_Acceptor, "$Id: ATM_Acceptor.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if defined (ACE_HAS_ATM)
+
#if defined (ACE_HAS_LINUX_ATM)
#include /**/ "linux/atmdev.h"
#endif /* ACE_HAS_LINUX_ATM */
+
#if !defined (__ACE_INLINE__)
#include "ace/ATM_Acceptor.inl"
#endif /* __ACE_INLINE__ */
+
// Open versioned namespace, if enabled by the user.
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Put the actual definitions of the ACE_ATM_Request and
// ACE_ATM_Request_Queue classes here to hide them from clients...
+
ACE_ALLOC_HOOK_DEFINE(ACE_ATM_Acceptor)
+
ACE_ATM_Acceptor::ACE_ATM_Acceptor (void)
{
ACE_TRACE ("ACE_ATM_Acceptor::ACE_ATM_Acceptor");
}
+
ACE_ATM_Acceptor::~ACE_ATM_Acceptor (void)
{
ACE_TRACE ("ACE_ATM_Acceptor::~ACE_ATM_Acceptor");
}
+
int
ACE_ATM_Acceptor::get_local_addr (ACE_ATM_Addr &local_addr)
{
ACE_TRACE ("ACE_ATM_Acceptor::get_local_addr");
+
#if defined (ACE_HAS_FORE_ATM_WS2)
unsigned long ret = 0;
DWORD deviceID = 0;
ATM_ADDRESS addr;
struct sockaddr_atm *laddr;
+
if (::WSAIoctl ((int) ((ACE_SOCK_Acceptor *)this) -> get_handle (),
SIO_GET_ATM_ADDRESS,
(LPVOID) &deviceID,
@@ -44,17 +57,21 @@ ACE_ATM_Acceptor::get_local_addr (ACE_ATM_Addr &local_addr)
::WSAGetLastError ());
return -1;
}
+
laddr = (struct sockaddr_atm *)local_addr.get_addr ();
ACE_OS::memcpy ((void *)& (laddr -> satm_number),
(void *)&addr,
ATM_ADDR_SIZE - 1);
+
return 0;
#elif defined (ACE_HAS_FORE_ATM_XTI)
ACE_UNUSED_ARG (local_addr);
+
return 0;
#elif defined (ACE_HAS_LINUX_ATM)
ATM_Addr *myaddr = (ATM_Addr *)local_addr.get_addr ();
int addrlen = sizeof (myaddr->sockaddratmsvc);
+
if (ACE_OS::getsockname (acceptor_.get_handle (),
(struct sockaddr *) & (myaddr->sockaddratmsvc),
&addrlen) < 0) {
@@ -63,12 +80,15 @@ ACE_ATM_Acceptor::get_local_addr (ACE_ATM_Addr &local_addr)
errno));
return -1;
}
+
return (0);
#else
ACE_UNUSED_ARG (local_addr);
+
return 0;
#endif /* ACE_HAS_FORE_ATM_WS2 && ACE_HAS_FORE_ATM_XTI */
}
+
ACE_HANDLE
ACE_ATM_Acceptor::open (const ACE_Addr &remote_sap,
int backlog,
@@ -87,9 +107,12 @@ ACE_ATM_Acceptor::open (const ACE_Addr &remote_sap,
struct sockaddr_atm local_atm_addr;
ACE_HANDLE ret;
DWORD flags = 0;
+
/* Create a local endpoint of communication */
+
// Only leaves can listen.
flags = ACE_FLAG_MULTIPOINT_C_LEAF | ACE_FLAG_MULTIPOINT_D_LEAF;
+
if ((ret = ACE_OS::socket (AF_ATM,
SOCK_RAW,
ATMPROTO_AAL5,
@@ -101,7 +124,9 @@ ACE_ATM_Acceptor::open (const ACE_Addr &remote_sap,
::WSAGetLastError ());
return (ret);
}
+
((ACE_SOCK_Acceptor *)this) -> set_handle (ret);
+
/* Set up the address information to become a server */
ACE_OS::memset ((void *) &local_atm_addr, 0, sizeof local_atm_addr);
local_atm_addr.satm_family = AF_ATM;
@@ -111,6 +136,7 @@ ACE_ATM_Acceptor::open (const ACE_Addr &remote_sap,
local_atm_addr.satm_blli.Layer2Protocol = SAP_FIELD_ANY;
local_atm_addr.satm_blli.Layer3Protocol = SAP_FIELD_ABSENT;
local_atm_addr.satm_bhli.HighLayerInfoType = SAP_FIELD_ABSENT;
+
/* Associate address with endpoint */
if (ACE_OS::bind (((ACE_SOCK_Acceptor *)this) -> get_handle (),
reinterpret_cast<struct sockaddr *> (&local_atm_addr),
@@ -118,6 +144,7 @@ ACE_ATM_Acceptor::open (const ACE_Addr &remote_sap,
ACE_OS::printf ("Acceptor (open): bind %d\n", ::WSAGetLastError ());
return (ACE_INVALID_HANDLE);
}
+
/* Make endpoint listen for service requests */
if (ACE_OS::listen (( (ACE_SOCK_Acceptor *)this) -> get_handle (),
backlog)
@@ -125,14 +152,17 @@ ACE_ATM_Acceptor::open (const ACE_Addr &remote_sap,
ACE_OS::printf ("Acceptor (open): listen %d\n", ::WSAGetLastError ());
return (ACE_INVALID_HANDLE);
}
+
return 0;
#elif defined (ACE_HAS_LINUX_ATM)
//we need to set the qos before binding to the socket
//use remote_sap as local_sap
+
ACE_ATM_Addr local_sap;
ATM_Addr *local_sap_addr = (ATM_Addr*)local_sap.get_addr ();
ACE_ATM_QoS def_qos;
ATM_QoS qos = def_qos.get_qos ();
+
ACE_HANDLE handle;
if ((handle = ACE_OS::socket (params.get_protocol_family (),
params.get_type (),
@@ -147,6 +177,7 @@ ACE_ATM_Acceptor::open (const ACE_Addr &remote_sap,
errno);
return (ACE_INVALID_HANDLE);
}
+
((ACE_SOCK_Acceptor *)this) -> set_handle (handle);
if (ACE_OS::setsockopt (handle,
SOL_ATM,
@@ -156,8 +187,10 @@ ACE_ATM_Acceptor::open (const ACE_Addr &remote_sap,
ACE_OS::printf ("Acceptor (setsockopt): setsockopt:%d\n",
errno);
}
+
struct atmif_sioc req;
struct sockaddr_atmsvc aux_addr[1024];
+
req.number = 0;
req.arg = aux_addr;
req.length = sizeof (aux_addr);
@@ -170,6 +203,7 @@ ACE_ATM_Acceptor::open (const ACE_Addr &remote_sap,
local_sap_addr->sockaddratmsvc = aux_addr[0];
}
local_sap.set_selector (( (ACE_ATM_Addr*)&remote_sap)->get_selector ());
+
if (ACE_OS::bind (handle,
reinterpret_cast<struct sockaddr *> (
&(local_sap_addr->sockaddratmsvc)),
@@ -189,6 +223,7 @@ ACE_ATM_Acceptor::open (const ACE_Addr &remote_sap,
errno);
return -1;
}
+
return 0;
#else
ACE_UNUSED_ARG (remote_sap);
@@ -196,6 +231,7 @@ ACE_ATM_Acceptor::open (const ACE_Addr &remote_sap,
ACE_UNUSED_ARG (params);
#endif /* ACE_HAS_FORE_ATM_XTI/ACE_HAS_FORE_ATM_WS2/ACE_HAS_LINUX_ATM */
}
+
int
ACE_ATM_Acceptor::accept (ACE_ATM_Stream &new_sap,
ACE_Addr *remote_addr,
@@ -208,6 +244,7 @@ ACE_ATM_Acceptor::accept (ACE_ATM_Stream &new_sap,
ACE_TRACE ("ACE_ATM_Acceptor::accept");
#if defined (ACE_HAS_FORE_ATM_XTI)
ATM_QoS optbuf = qos.get_qos ();
+
return (acceptor_.accept (new_sap.get_stream (),
remote_addr,
timeout,
@@ -222,19 +259,24 @@ ACE_ATM_Acceptor::accept (ACE_ATM_Stream &new_sap,
struct sockaddr_atm *cli_addr
= (struct sockaddr_atm *)remote_addr -> get_addr ();
int caddr_len = sizeof (struct sockaddr_atm);
+
do {
n_handle = ACE_OS::accept (s_handle,
reinterpret_cast<struct sockaddr *> (cli_addr),
&caddr_len);
} while (n_handle == ACE_INVALID_HANDLE && errno == EINTR);
+
((ACE_ATM_Addr *)remote_addr) -> set (cli_addr,
((ACE_ATM_Addr *)remote_addr) -> get_selector ());
((ACE_IPC_SAP *)&new_sap) -> set_handle (n_handle);
+
return 0;
#elif defined (ACE_HAS_LINUX_ATM)
ACE_UNUSED_ARG (params);
+
ACE_HANDLE s_handle = ((ACE_SOCK_Acceptor *) this) -> get_handle ();
struct atm_qos accept_qos = qos.get_qos ();
+
if (ACE_OS::setsockopt (s_handle,
SOL_ATM,
SO_ATMQOS,
@@ -242,6 +284,7 @@ ACE_ATM_Acceptor::accept (ACE_ATM_Stream &new_sap,
sizeof (accept_qos)) < 0) {
ACE_OS::printf ("Acceptor (accept): error setting Qos");
}
+
return (acceptor_.accept (new_sap.get_stream (),
remote_addr,
timeout,
@@ -258,8 +301,10 @@ ACE_ATM_Acceptor::accept (ACE_ATM_Stream &new_sap,
return (0);
#endif /* ACE_HAS_FORE_ATM_XTI */
}
+
// Close versioned namespace, if enabled by the user.
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_ATM */
diff --git a/dep/ACE_wrappers/ace/ATM_Acceptor.h b/dep/ACE_wrappers/ace/ATM_Acceptor.h
index dc18425f25e..900cec098c5 100644
--- a/dep/ACE_wrappers/ace/ATM_Acceptor.h
+++ b/dep/ACE_wrappers/ace/ATM_Acceptor.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file ATM_Acceptor.h
@@ -9,20 +10,27 @@
*/
//=============================================================================
+
#ifndef ACE_ATM_ACCEPTOR_H
#define ACE_ATM_ACCEPTOR_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_ATM)
+
#include "ace/ATM_Stream.h"
#include "ace/ATM_Params.h"
#include "ace/ATM_QoS.h"
+
#if defined (ACE_HAS_LINUX_ATM)
#include /**/ "atm.h"
#endif /* ACE_HAS_LINUX_ATM */
+
#if defined (ACE_HAS_FORE_ATM_WS2) || defined (ACE_HAS_LINUX_ATM)
#include "ace/SOCK_Acceptor.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -34,10 +42,13 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
typedef ACE_TLI_Acceptor ATM_Acceptor;
ACE_END_VERSIONED_NAMESPACE_DECL
#endif // ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM
+
// Open versioned namespace, if enabled by the user.
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward declarations.
class ACE_Time_Value;
+
/**
* @class ACE_ATM_Acceptor
*
@@ -48,22 +59,29 @@ class ACE_Time_Value;
*/
class ACE_Export ACE_ATM_Acceptor
{
+
public:
// = Initialization and termination methods.
/// Default constructor.
ACE_ATM_Acceptor (void);
+
~ACE_ATM_Acceptor ();
+
/// Initiate a passive mode connection.
ACE_ATM_Acceptor (const ACE_Addr &remote_sap,
int backlog = ACE_DEFAULT_BACKLOG,
ACE_ATM_Params params = ACE_ATM_Params());
+
/// Initiate a passive mode socket.
ACE_HANDLE open (const ACE_Addr &remote_sap,
int backlog = ACE_DEFAULT_BACKLOG,
ACE_ATM_Params params = ACE_ATM_Params());
+
/// Close down the acceptor and release resources.
int close (void);
+
// = Passive connection acceptance method.
+
/// Accept a new data transfer connection. A @a timeout of 0 means
/// block forever, a @a timeout of {0, 0} means poll. @a restart == 1
/// means "restart if interrupted."
@@ -74,24 +92,32 @@ public:
int reset_new_handle = 0,
ACE_ATM_Params params = ACE_ATM_Params(),
ACE_ATM_QoS qos = ACE_ATM_QoS());
+
/// Get the local address currently listening on
int get_local_addr( ACE_ATM_Addr &local_addr );
+
// = Meta-type info
typedef ACE_ATM_Addr PEER_ADDR;
typedef ACE_ATM_Stream PEER_STREAM;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
ATM_Acceptor acceptor_;
};
+
// Close versioned namespace, if enabled by the user.
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/ATM_Acceptor.inl"
#endif /* __ACE_INLINE__ */
+
#endif /* ACE_HAS_ATM */
#include /**/ "ace/post.h"
#endif /* ACE_ATM_ACCEPTOR_H */
diff --git a/dep/ACE_wrappers/ace/ATM_Acceptor.inl b/dep/ACE_wrappers/ace/ATM_Acceptor.inl
index e1b38a713f7..fa60c4ad89a 100644
--- a/dep/ACE_wrappers/ace/ATM_Acceptor.inl
+++ b/dep/ACE_wrappers/ace/ATM_Acceptor.inl
@@ -1,8 +1,10 @@
// -*- C++ -*-
//
// $Id: ATM_Acceptor.inl 80826 2008-03-04 14:51:23Z wotte $
+
// Open versioned namespace, if enabled by the user.
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE void
ACE_ATM_Acceptor::dump (void) const
{
@@ -10,12 +12,14 @@ ACE_ATM_Acceptor::dump (void) const
ACE_TRACE ("ACE_ATM_Acceptor::dump");
#endif /* ACE_HAS_DUMP */
}
+
ACE_INLINE
ACE_ATM_Acceptor::ACE_ATM_Acceptor (const ACE_Addr &remote_sap,
int backlog,
ACE_ATM_Params params)
{
ACE_TRACE ("ACE_ATM_Acceptor::ACE_ATM_Acceptor");
+
//FUZZ: disable check_for_lack_ACE_OS
if (open (remote_sap, backlog, params) < 0)
//FUZZ: enable check_for_lack_ACE_OS
@@ -23,6 +27,7 @@ ACE_ATM_Acceptor::ACE_ATM_Acceptor (const ACE_Addr &remote_sap,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_ATM_Acceptor::ACE_ATM_Acceptor")));
}
+
ACE_INLINE
int
ACE_ATM_Acceptor::close (void)
@@ -33,5 +38,6 @@ ACE_ATM_Acceptor::close (void)
return 0;
#endif // ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM
}
+
// Close versioned namespace, if enabled by the user.
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/ATM_Addr.cpp b/dep/ACE_wrappers/ace/ATM_Addr.cpp
index 8e09eb9d355..8b4781c5e80 100644
--- a/dep/ACE_wrappers/ace/ATM_Addr.cpp
+++ b/dep/ACE_wrappers/ace/ATM_Addr.cpp
@@ -1,17 +1,26 @@
// $Id: ATM_Addr.cpp 80826 2008-03-04 14:51:23Z wotte $
+
// Defines the Internet domain address family address format.
+
#include "ace/ATM_Addr.h"
#if defined (ACE_HAS_ATM)
+
#include "ace/Log_Msg.h"
+
#if defined (ACE_HAS_FORE_ATM_WS2)
#include /**/ "forews2.h"
#endif /* ACE_HAS_FORE_ATM_WS2 */
+
#if !defined (__ACE_INLINE__)
#include "ace/ATM_Addr.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace, ATM_Addr, "$Id: ATM_Addr.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_ATM_Addr)
+
#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2)
#define BHLI_MAGIC "FORE_ATM"
// This is line rate in cells/s for an OC-3 MM interface.
@@ -33,7 +42,9 @@ const int ACE_ATM_Addr::OPT_FLAGS_CPID = 0;
const int ACE_ATM_Addr::OPT_FLAGS_PMP = 0;
const int ACE_ATM_Addr::DEFAULT_SELECTOR = 0x0;
#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */
+
// Default constructor
+
ACE_ATM_Addr::ACE_ATM_Addr (u_char selector)
#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2)
: ACE_Addr (AF_ATM,
@@ -50,7 +61,9 @@ ACE_ATM_Addr::ACE_ATM_Addr (u_char selector)
sizeof this->atm_addr_);
this->init (selector);
}
+
// Copy constructor.
+
ACE_ATM_Addr::ACE_ATM_Addr (const ACE_ATM_Addr &sap,
u_char selector)
#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2)
@@ -71,6 +84,7 @@ ACE_ATM_Addr::ACE_ATM_Addr (const ACE_ATM_Addr &sap,
this->atm_addr_.atmsap.bhli.hl_type = ATM_HL_NONE;
#endif /* ACE_HAS_LINUX_ATM */
}
+
ACE_ATM_Addr::ACE_ATM_Addr (const ATM_Addr *sap,
u_char selector)
#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2)
@@ -86,6 +100,7 @@ ACE_ATM_Addr::ACE_ATM_Addr (const ATM_Addr *sap,
this->set (sap, selector);
}
+
ACE_ATM_Addr::ACE_ATM_Addr (const ACE_TCHAR sap[],
u_char selector)
#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2)
@@ -100,16 +115,20 @@ ACE_ATM_Addr::ACE_ATM_Addr (const ACE_TCHAR sap[],
ACE_TRACE ("ACE_ATM_Addr::ACE_ATM_Addr");
this->set (sap, selector);
}
+
ACE_ATM_Addr::~ACE_ATM_Addr (void)
{
}
+
// Return the address.
+
void *
ACE_ATM_Addr::get_addr (void) const
{
ACE_TRACE ("ACE_ATM_Addr::get_addr");
return (void *) &this->atm_addr_;
}
+
void
ACE_ATM_Addr::init (u_char selector)
{
@@ -119,16 +138,22 @@ ACE_ATM_Addr::init (u_char selector)
// selector (i.e. address[19]) is used by the TP. The rest of the
// local address is filled in by the TP and can be obtained via the
// 'ret' parameter or with t_getname ()/t_getprotaddr ().
+
atm_addr_.addressType = (u_int16_t) AF_ATM;
+
atm_addr_.sap.t_atm_sap_addr.SVE_tag_addr = (int8_t) T_ATM_ABSENT;
atm_addr_.sap.t_atm_sap_addr.SVE_tag_selector = (int8_t) T_ATM_PRESENT;
+
atm_addr_.sap.t_atm_sap_addr.address_format = (u_int8_t) T_ATM_ENDSYS_ADDR;
atm_addr_.sap.t_atm_sap_addr.address_length = ATMNSAP_ADDR_LEN;
atm_addr_.sap.t_atm_sap_addr.address[ATMNSAP_ADDR_LEN - 1] = selector;
+
atm_addr_.sap.t_atm_sap_layer2.SVE_tag = (int8_t) T_ATM_ABSENT;
atm_addr_.sap.t_atm_sap_layer3.SVE_tag = (int8_t) T_ATM_ABSENT;
+
atm_addr_.sap.t_atm_sap_appl.SVE_tag = (int8_t) T_ATM_PRESENT;
atm_addr_.sap.t_atm_sap_appl.ID_type = (u_int8_t) T_ATM_USER_APP_ID;
+
ACE_OS::memcpy (atm_addr_.sap.t_atm_sap_appl.ID.user_defined_ID,
BHLI_MAGIC,
sizeof atm_addr_.sap.t_atm_sap_appl.ID);
@@ -141,6 +166,7 @@ ACE_ATM_Addr::init (u_char selector)
atm_addr_.satm_blli.Layer2Protocol = SAP_FIELD_ABSENT;
atm_addr_.satm_blli.Layer3Protocol = SAP_FIELD_ABSENT;
atm_addr_.satm_bhli.HighLayerInfoType = SAP_FIELD_ABSENT;
+
// Need to know the correspondence.
//atm_addr_.sap.t_atm_sap_appl.SVE_tag = (int8_t) T_ATM_PRESENT;
//atm_addr_.sap.t_atm_sap_appl.ID_type = (u_int8_t) T_ATM_USER_APP_ID;
@@ -157,30 +183,38 @@ ACE_ATM_Addr::init (u_char selector)
ACE_UNUSED_ARG (selector);
#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */
}
+
int
ACE_ATM_Addr::set (const ACE_ATM_Addr &sap,
u_char selector)
{
ACE_TRACE ("ACE_ATM_Addr::set");
+
this->init (selector);
+
this->ACE_Addr::base_set (sap.get_type (),
sap.get_size ());
+
#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2)
ACE_ASSERT (sap.get_type () == AF_ATM);
#elif defined (ACE_HAS_LINUX_ATM)
ACE_ASSERT (sap.get_type () == PF_ATMSVC);
#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 */
+
(void) ACE_OS::memcpy ((void *) &this->atm_addr_,
(void *) &sap.atm_addr_,
sizeof this->atm_addr_);
return 0;
}
+
int
ACE_ATM_Addr::set (const ATM_Addr *sap,
u_char selector)
{
ACE_TRACE ("ACE_ATM_Addr::set");
+
this->init (selector);
+
#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2)
this->ACE_Addr::base_set (AF_ATM,
#elif defined (ACE_HAS_LINUX_ATM)
@@ -189,31 +223,39 @@ ACE_ATM_Addr::set (const ATM_Addr *sap,
this->ACE_Addr::base_set (AF_UNSPEC,
#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 */
sizeof (*sap));
+
(void) ACE_OS::memcpy ((void *) &this->atm_addr_,
(void *) sap,
sizeof this->atm_addr_);
return 0;
}
+
int
ACE_ATM_Addr::set (const ACE_TCHAR address[],
u_char selector)
{
ACE_TRACE ("ACE_ATM_Addr::set");
int ret;
+
this->init (selector);
+
#if defined (ACE_HAS_FORE_ATM_XTI)
atm_addr_.sap.t_atm_sap_addr.SVE_tag_addr =
(int8_t) T_ATM_PRESENT;
#endif /* ACE_HAS_FORE_ATM_XTI */
+
ret = this -> string_to_addr (address);
this -> set_selector (selector);
return ret;
}
+
// Transform the string into the current addressing format.
+
int
ACE_ATM_Addr::string_to_addr (const ACE_TCHAR sap[])
{
ACE_TRACE ("ACE_ATM_Addr::string_to_addr");
+
#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2)
this->ACE_Addr::base_set (AF_ATM,
#elif defined (ACE_HAS_LINUX_ATM)
@@ -225,6 +267,7 @@ ACE_ATM_Addr::string_to_addr (const ACE_TCHAR sap[])
#if defined (ACE_HAS_FORE_ATM_XTI)
struct hostent *entry;
struct atmnsap_addr *nsap;
+
// Yow, someone gave us a NULL ATM address!
if (sap == 0)
{
@@ -253,11 +296,14 @@ ACE_ATM_Addr::string_to_addr (const ACE_TCHAR sap[])
WSAQUERYSETW qsRestrictions;
CSADDR_INFO csaBuffer;
WCHAR tmpWStr[100];
+
MultiByteToWideChar (CP_ACP, MB_PRECOMPOSED, sap, -1, tmpWStr, 100);
+
csaBuffer.LocalAddr.iSockaddrLength = sizeof (struct sockaddr_atm);
csaBuffer.LocalAddr.lpSockaddr = (struct sockaddr *)&atm_addr_;
csaBuffer.RemoteAddr.iSockaddrLength = sizeof (struct sockaddr_atm);
csaBuffer.RemoteAddr.lpSockaddr = (struct sockaddr *)&atm_addr_;
+
qsRestrictions.dwSize = sizeof (WSAQUERYSETW);
qsRestrictions.lpszServiceInstanceName = 0;
qsRestrictions.lpServiceClassId = &FORE_NAME_CLASS;
@@ -272,13 +318,16 @@ ACE_ATM_Addr::string_to_addr (const ACE_TCHAR sap[])
qsRestrictions.dwNumberOfCsAddrs = 1;
qsRestrictions.lpcsaBuffer = &csaBuffer;
qsRestrictions.lpBlob = 0; //&blob;
+
if (::WSALookupServiceBeginW (&qsRestrictions, LUP_RETURN_ALL, &hLookup)
== SOCKET_ERROR) {
ACE_OS::printf ("Error: WSALookupServiceBeginW failed! %d\n",
::WSAGetLastError ());
return -1;
}
+
dwValue = sizeof (WSAQUERYSETW);
+
if (::WSALookupServiceNextW (hLookup, 0, &dwValue, &qsRestrictions)
== SOCKET_ERROR) {
if (WSAGetLastError () != WSA_E_NO_MORE) {
@@ -287,6 +336,7 @@ ACE_ATM_Addr::string_to_addr (const ACE_TCHAR sap[])
return -1;
}
}
+
if (WSALookupServiceEnd (hLookup) == SOCKET_ERROR) {
ACE_OS::printf ("Error : WSALookupServiceEnd failed! %d \n",
::WSAGetLastError ());
@@ -298,6 +348,7 @@ ACE_ATM_Addr::string_to_addr (const ACE_TCHAR sap[])
errno = EINVAL;
return -1;
}
+
if (text2atm ((ACE_TCHAR *)sap,
(struct sockaddr *)& (atm_addr_.sockaddratmsvc),
sizeof (atm_addr_.sockaddratmsvc),
@@ -309,18 +360,23 @@ ACE_ATM_Addr::string_to_addr (const ACE_TCHAR sap[])
}
#else
ACE_UNUSED_ARG (sap);
+
return 0;
#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */
+
#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) || defined (ACE_HAS_LINUX_ATM)
return 0;
#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 */
}
+
// Transform the current address into string format.
+
int
ACE_ATM_Addr::addr_to_string (ACE_TCHAR addr[],
size_t addrlen) const
{
ACE_TRACE ("ACE_ATM_Addr::addr_to_string");
+
#if defined (ACE_HAS_FORE_ATM_XTI)
ACE_TCHAR buffer[MAXNAMELEN + 1];
struct atmnsap_addr nsap;
@@ -330,25 +386,32 @@ ACE_ATM_Addr::addr_to_string (ACE_TCHAR addr[],
ACE_OS::sprintf (buffer,
ACE_TEXT ("%s"),
atmnsap_ntoa (nsap));
+
size_t total_len = ACE_OS::strlen (buffer) + sizeof ('\0');
+
if (addrlen < total_len)
return -1;
else
ACE_OS::strcpy (addr, buffer);
+
return 0;
#elif defined (ACE_HAS_FORE_ATM_WS2)
ACE_TCHAR buffer[MAXNAMELEN + 1];
int i;
+
if (addrlen < ATM_ADDR_SIZE + 1)
return -1;
+
for (i = 0; i < ATM_ADDR_SIZE; i++) {
buffer[ i * 3 ] = '\0';
ACE_OS::sprintf (buffer, ACE_TEXT ("%s%02x."),
buffer,
atm_addr_.satm_number.Addr[ i ]);
}
+
buffer[ ATM_ADDR_SIZE * 3 - 1 ] = '\0';
ACE_OS::strcpy (addr, buffer);
+
return 0;
#elif defined (ACE_HAS_LINUX_ATM)
ACE_TCHAR buffer[MAX_ATM_ADDR_LEN + 1];
@@ -365,6 +428,7 @@ ACE_ATM_Addr::addr_to_string (ACE_TCHAR addr[],
else
ACE_OS::strcpy (addr,
buffer);
+
return 0;
#else
ACE_UNUSED_ARG (addr);
@@ -372,21 +436,26 @@ ACE_ATM_Addr::addr_to_string (ACE_TCHAR addr[],
return -1;
#endif /* ACE_HAS_FORE_ATM_XTI && ACE_HAS_FORE_ATM_WS2 */
}
+
const ACE_TCHAR *
ACE_ATM_Addr::addr_to_string (void) const
{
ACE_TRACE ("ACE_ATM_Addr::addr_to_string");
+
static ACE_TCHAR addr[MAXHOSTNAMELEN + 1];
if (this->addr_to_string (addr,
MAXHOSTNAMELEN + 1) < 0)
return 0;
+
return addr;
}
+
// Set a pointer to the address.
void
ACE_ATM_Addr::set_addr (void *addr, int len)
{
ACE_TRACE ("ACE_ATM_Addr::set_addr");
+
#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2)
this->ACE_Addr::base_set (AF_ATM,
#elif defined (ACE_HAS_LINUX_ATM)
@@ -398,18 +467,23 @@ ACE_ATM_Addr::set_addr (void *addr, int len)
ACE_OS::memcpy ((void *) &this->atm_addr_,
(void *) addr, len);
}
+
// Compare two addresses for inequality.
+
bool
ACE_ATM_Addr::operator != (const ACE_ATM_Addr &sap) const
{
ACE_TRACE ("ACE_ATM_Addr::operator !=");
return ! ((*this) == sap);
}
+
// Compare two addresses for equality.
+
bool
ACE_ATM_Addr::operator == (const ACE_ATM_Addr &sap) const
{
ACE_TRACE ("ACE_ATM_Addr::operator ==");
+
#if defined (ACE_HAS_LINUX_ATM)
return (atm_equal ((const struct sockaddr *)& (this->atm_addr_.sockaddratmsvc),
(const struct sockaddr *)& (sap.atm_addr_.sockaddratmsvc),
@@ -425,12 +499,15 @@ ACE_ATM_Addr::operator == (const ACE_ATM_Addr &sap) const
sizeof (ATM_Addr)) == 0;
#endif /* ACE_HAS_LINUX_ATM */
}
+
void
ACE_ATM_Addr::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_ATM_Addr::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
+
ACE_TCHAR s[ACE_MAX_FULLY_QUALIFIED_NAME_LEN + 16];
ACE_OS::sprintf (s,
ACE_TEXT ("%s"),
@@ -439,6 +516,8 @@ ACE_ATM_Addr::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_ATM */
diff --git a/dep/ACE_wrappers/ace/ATM_Addr.h b/dep/ACE_wrappers/ace/ATM_Addr.h
index 594ceddce2f..c111aa44843 100644
--- a/dep/ACE_wrappers/ace/ATM_Addr.h
+++ b/dep/ACE_wrappers/ace/ATM_Addr.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file ATM_Addr.h
@@ -8,16 +9,22 @@
* @author Joe Hoffert <joeh@cs.wustl.edu>
*/
//==========================================================================
+
#ifndef ACE_ATM_ADDR_H
#define ACE_ATM_ADDR_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_ATM)
+
#include /**/ "ace/ACE_export.h"
#include "ace/Addr.h"
+
#if defined (ACE_HAS_FORE_ATM_XTI)
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
typedef ATMSAPAddress ATM_Addr;
@@ -28,9 +35,12 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
typedef struct sockaddr_atm ATM_Addr;
ACE_END_VERSIONED_NAMESPACE_DECL
#elif defined (ACE_HAS_LINUX_ATM)
+
#include /**/ "atm.h"
+
// Open versioned namespace, if enabled by the user.
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
//pbrandao:as Linux has this 2 structs separeted we "link it" here
typedef struct _linux_atm_addr
{
@@ -40,6 +50,7 @@ typedef struct _linux_atm_addr
#else
typedef int ATM_Addr;
#endif /* ACE_HAS_FORE_ATM_XTI/ACE_HAS_FORE_ATM_WS2/ACE_HAS_LINUX_ATM */
+
/**
* @class ACE_ATM_Addr
*
@@ -53,12 +64,15 @@ public:
static const int OPT_FLAGS_CPID;
static const int OPT_FLAGS_PMP;
static const int DEFAULT_SELECTOR;
+
// = Initialization methods.
/// Default constructor.
ACE_ATM_Addr (u_char selector = DEFAULT_SELECTOR);
+
/// Copy constructor.
ACE_ATM_Addr (const ACE_ATM_Addr &,
u_char selector = DEFAULT_SELECTOR);
+
/**
* Creates an ACE_ATM_Addr from an ATMSAPAddress structure. This
* is vendor specific (FORE systems). May need to change when other
@@ -66,6 +80,7 @@ public:
*/
ACE_ATM_Addr (const ATM_Addr *,
u_char selector = DEFAULT_SELECTOR);
+
/**
* Initializes an ACE_ATM_Addr from the <sap> which can be
* "atm-address" (e.g.,
@@ -74,15 +89,19 @@ public:
*/
ACE_ATM_Addr (const ACE_TCHAR sap[],
u_char selector = DEFAULT_SELECTOR);
+
/// Default dtor.
~ACE_ATM_Addr (void);
+
// = Initialization methods (useful after object construction).
/// Default initialization for non-address values (e.g.,
/// t_atm_sap_addr.SVE_tag_addr, t_atm_sap_addr.SVE_tag_selector)
void init (u_char selector = DEFAULT_SELECTOR);
+
/// Initializes from another ACE_ATM_Addr.
int set (const ACE_ATM_Addr &,
u_char selector = DEFAULT_SELECTOR);
+
/**
* Initializes an ACE_ATM_Addr from an ATMSAPAddress/sockaddr_atm
* structure. This is vendor specific (FORE systems). May need to
@@ -90,6 +109,7 @@ public:
*/
int set (const ATM_Addr *,
u_char selector = DEFAULT_SELECTOR);
+
/**
* Initializes an ACE_ATM_Addr from the <sap> which can be
* "atm-address" (e.g.,
@@ -98,6 +118,7 @@ public:
*/
int set (const ACE_TCHAR sap[],
u_char selector = DEFAULT_SELECTOR);
+
/**
* Initializes an ACE_ATM_Addr from the <sap> which can be
* "atm-address" (e.g.,
@@ -105,6 +126,7 @@ public:
* (e.g., "frisbee.cs.wustl.edu").
*/
virtual int string_to_addr (const ACE_TCHAR sap[]);
+
/**
* Return the character representation of the ATM address (e.g.,
* "47.0005.80.ffe100.0000.f20f.2200.0020480694f9.00") storing it in
@@ -114,6 +136,7 @@ public:
*/
virtual int addr_to_string (ACE_TCHAR addr[],
size_t addrlen) const;
+
/**
* Return the character representation of the ATM address (e.g.,
* "47.0005.80.ffe100.0000.f20f.2200.0020480694f9.00"). Returns -1
@@ -122,40 +145,53 @@ public:
* area.)
*/
const ACE_TCHAR *addr_to_string (void) const;
+
/// Return a pointer to the underlying network address.
virtual void *get_addr (void) const;
+
/// Set a pointer to the address.
virtual void set_addr (void *, int);
+
/// Return the selector for network address.
u_char get_selector (void) const;
+
/// Set the selector for the network address.
void set_selector (u_char selector);
+
/**
* Compare two addresses for equality. The addresses are considered
* equal if they contain the same ATM address. Q: Is there any
* other check for equality needed for ATM?
*/
bool operator == (const ACE_ATM_Addr &SAP) const;
+
/// Compare two addresses for inequality.
bool operator != (const ACE_ATM_Addr &SAP) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
// char *construct_options (ACE_HANDLE fd,
// int qos_kb,
// int flags,
// long *optsize);
// // Construct options for ATM connections
+
private:
ATM_Addr atm_addr_;
};
+
// Close versioned namespace, if enabled by the user.
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/ATM_Addr.inl"
#endif /* __ACE_INLINE__ */
+
#endif /* ACE_HAS_ATM */
#include /**/ "ace/post.h"
#endif /* ACE_ATM_ADDR_H */
diff --git a/dep/ACE_wrappers/ace/ATM_Addr.inl b/dep/ACE_wrappers/ace/ATM_Addr.inl
index 4aa694a21bf..55f43d6613a 100644
--- a/dep/ACE_wrappers/ace/ATM_Addr.inl
+++ b/dep/ACE_wrappers/ace/ATM_Addr.inl
@@ -1,7 +1,9 @@
// -*- C++ -*-
//
// $Id: ATM_Addr.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE u_char
ACE_ATM_Addr::get_selector (void) const
{
@@ -16,6 +18,7 @@ ACE_ATM_Addr::get_selector (void) const
return 0;
#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */
}
+
ACE_INLINE void
ACE_ATM_Addr::set_selector (u_char selector)
{
@@ -30,4 +33,5 @@ ACE_ATM_Addr::set_selector (u_char selector)
ACE_UNUSED_ARG (selector);
#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/ATM_Connector.cpp b/dep/ACE_wrappers/ace/ATM_Connector.cpp
index ad466ed20f2..7d68ed88bd2 100644
--- a/dep/ACE_wrappers/ace/ATM_Connector.cpp
+++ b/dep/ACE_wrappers/ace/ATM_Connector.cpp
@@ -1,22 +1,31 @@
// ATM_Connector.cpp
// $Id: ATM_Connector.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/ATM_Connector.h"
#if defined (ACE_HAS_ATM)
+
#include "ace/Handle_Set.h"
+
ACE_RCSID(ace, ATM_Connector, "$Id: ATM_Connector.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if !defined (__ACE_INLINE__)
#include "ace/ATM_Connector.inl"
#endif /* __ACE_INLINE__ */
+
// Open versioned namespace, if enabled by the user.
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_ATM_Connector)
+
ACE_ATM_Connector::ACE_ATM_Connector (void)
{
ACE_TRACE ("ACE_ATM_Connector::ACE_ATM_Connector");
}
+
// Actively connect and produce a new ACE_ATM_Stream if things go well...
// Connect the <new_stream> to the <remote_sap>, waiting up to
// <timeout> amount of time if necessary.
+
int
ACE_ATM_Connector::connect (ACE_ATM_Stream &new_stream,
const ACE_ATM_Addr &remote_sap,
@@ -45,23 +54,29 @@ ACE_ATM_Connector::connect (ACE_ATM_Stream &new_stream,
#elif defined (ACE_HAS_FORE_ATM_WS2)
ACE_DEBUG(LM_DEBUG,
ACE_TEXT ("ATM_Connector(connect): set QoS parameters\n" ));
+
ACE_HANDLE s = new_stream.get_handle();
struct sockaddr_atm *saddr = ( struct sockaddr_atm *)remote_sap.get_addr();
ACE_QoS cqos = options.get_qos();
+
ACE_QoS_Params qos_params = ACE_QoS_Params(0,
0,
&cqos,
0,
0);
+
ACE_DEBUG(LM_DEBUG,
ACE_TEXT ("ATM_Connector(connect): connecting...\n"));
+
int result = ACE_OS::connect( s,
( struct sockaddr *)saddr,
sizeof( struct sockaddr_atm ),
qos_params );
+
if ( result != 0 )
ACE_OS::printf( "ATM_Connector(connect): connection failed, %d\n",
::WSAGetLastError());
+
return result;
#elif defined (ACE_HAS_LINUX_ATM)
ACE_UNUSED_ARG (params);
@@ -69,10 +84,12 @@ ACE_ATM_Connector::connect (ACE_ATM_Stream &new_stream,
ACE_UNUSED_ARG (reuse_addr);
ACE_UNUSED_ARG (perms);
ACE_UNUSED_ARG (flags);
+
ACE_HANDLE handle = new_stream.get_handle();
ATM_QoS qos =options.get_qos();
ATM_Addr *local_addr=(ATM_Addr*)local_sap.get_addr(),
*remote_addr=(ATM_Addr*)remote_sap.get_addr();
+
if (ACE_OS::setsockopt(handle,
SOL_ATM,
SO_ATMSAP,
@@ -90,13 +107,16 @@ ACE_ATM_Connector::connect (ACE_ATM_Stream &new_stream,
errno));
return -1;
}
+
int result = ACE_OS::connect(handle,
(struct sockaddr *)&(remote_addr->sockaddratmsvc),
sizeof( remote_addr->sockaddratmsvc));
+
if ( result != 0 )
ACE_DEBUG(LM_DEBUG,
ACE_TEXT ("ATM_Connector(connect): connection failed, %d\n"),
errno);
+
return result;
#else
ACE_UNUSED_ARG (new_stream);
@@ -111,7 +131,9 @@ ACE_ATM_Connector::connect (ACE_ATM_Stream &new_stream,
return 0;
#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */
}
+
// Close versioned namespace, if enabled by the user.
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_ATM */
diff --git a/dep/ACE_wrappers/ace/ATM_Connector.h b/dep/ACE_wrappers/ace/ATM_Connector.h
index f45d5c5521f..e8657e91a23 100644
--- a/dep/ACE_wrappers/ace/ATM_Connector.h
+++ b/dep/ACE_wrappers/ace/ATM_Connector.h
@@ -1,4 +1,5 @@
/* -*- C++ -*- */
+
//=============================================================================
/**
* @file ATM_Connector.h
@@ -8,17 +9,23 @@
* @author Joe Hoffert <joeh@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_ATM_CONNECTOR_H
#define ACE_ATM_CONNECTOR_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_ATM)
+
#include "ace/ATM_Stream.h"
#include "ace/ATM_Params.h"
#include "ace/ATM_QoS.h"
+
#if defined (ACE_WIN32) || defined (ACE_HAS_LINUX_ATM)
#include "ace/SOCK_Connector.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -31,8 +38,10 @@ typedef ACE_XTI_ATM_Mcast ATM_Connector;
// Open versioned namespace, if enabled by the user.
ACE_END_VERSIONED_NAMESPACE_DECL
#endif
+
// Open versioned namespace, if enabled by the user.
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_ATM_Connector
*
@@ -45,6 +54,7 @@ public:
// = Initialization methods.
/// Default constructor.
ACE_ATM_Connector (void);
+
/**
* Actively connect and produce a @a new_stream if things go well.
* The @a remote_sap is the address that we are trying to connect
@@ -74,6 +84,7 @@ public:
int flags = O_RDWR,
#endif /* ACE_WIN32 */
int perms = 0);
+
/**
* Actively connect and produce a @a new_stream if things go well.
* The @a remote_sap is the address that we are trying to connect
@@ -104,6 +115,7 @@ public:
int flags = O_RDWR,
#endif /* ACE_WIN32 */
int perms = 0);
+
/**
* Try to complete a non-blocking connection.
* If connection completion is successful then @a new_stream contains
@@ -113,6 +125,7 @@ public:
int complete (ACE_ATM_Stream &new_stream,
ACE_ATM_Addr *remote_sap,
ACE_Time_Value *tv);
+
/**
* Actively add a leaf to the root (i.e., point-to-multipoint). The
* @a remote_sap is the address of the leaf that we
@@ -121,23 +134,31 @@ public:
int add_leaf (ACE_ATM_Stream &current_stream,
const ACE_Addr &remote_sap,
ACE_ATM_QoS &qos);
+
/// Resets any event associations on this handle
int reset_new_handle (ACE_HANDLE handle);
+
// = Meta-type info
typedef ACE_ATM_Addr PEER_ADDR;
typedef ACE_ATM_Stream PEER_STREAM;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
ATM_Connector connector_;
};
+
// Open versioned namespace, if enabled by the user.
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/ATM_Connector.inl"
#endif /* __ACE_INLINE__ */
+
#endif /* ACE_HAS_ATM */
#include /**/ "ace/post.h"
#endif /* ACE_ATM_CONNECTOR_H */
diff --git a/dep/ACE_wrappers/ace/ATM_Connector.inl b/dep/ACE_wrappers/ace/ATM_Connector.inl
index 85d61406bde..0b89cbf0828 100644
--- a/dep/ACE_wrappers/ace/ATM_Connector.inl
+++ b/dep/ACE_wrappers/ace/ATM_Connector.inl
@@ -1,8 +1,10 @@
// -*- C++ -*-
//
// $Id: ATM_Connector.inl 80826 2008-03-04 14:51:23Z wotte $
+
// Open versioned namespace, if enabled by the user.
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE void
ACE_ATM_Connector::dump (void) const
{
@@ -10,6 +12,7 @@ ACE_ATM_Connector::dump (void) const
ACE_TRACE ("ACE_ATM_Connector::dump");
#endif /* ACE_HAS_DUMP */
}
+
ACE_INLINE
ACE_ATM_Connector::ACE_ATM_Connector (ACE_ATM_Stream &new_stream,
const ACE_ATM_Addr &remote_sap,
@@ -35,7 +38,9 @@ ACE_ATM_Connector::ACE_ATM_Connector (ACE_ATM_Stream &new_stream,
ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_ATM_Stream::ACE_ATM_Stream")));
}
+
// Try to complete a non-blocking connection.
+
ACE_INLINE
int
ACE_ATM_Connector::complete (ACE_ATM_Stream &new_stream,
@@ -54,6 +59,7 @@ ACE_ATM_Connector::complete (ACE_ATM_Stream &new_stream,
return 0;
#endif
}
+
ACE_INLINE
int
ACE_ATM_Connector::add_leaf (ACE_ATM_Stream &current_stream,
@@ -70,26 +76,33 @@ ACE_ATM_Connector::add_leaf (ACE_ATM_Stream &current_stream,
struct sockaddr_atm *saddr = (struct sockaddr_atm *)remote_sap.get_addr();
ACE_QoS cqos = qos.get_qos();
int addr_len = sizeof( struct sockaddr_atm );
+
ACE_QoS_Params qos_params(0,
0,
&cqos,
0,
(JL_SENDER_ONLY));
+
ACE_OS::printf( "ATM_Connector::add_leaf: connecting...\n" );
+
ACE_HANDLE result = ACE_OS::join_leaf(current_stream.get_handle(),
(struct sockaddr *)saddr,
addr_len,
qos_params);
+
if ( result == ACE_INVALID_HANDLE )
ACE_OS::printf( "ATM_Connector(add_leaf): connection failed, %d\n",
::WSAGetLastError());
+
return (result != ACE_INVALID_HANDLE);
#elif defined (ACE_HAS_LINUX_ATM)
ACE_OS::printf("ATM_Connector(add_leaf): not yet implemented in Linux \n");
+
ACE_UNUSED_ARG(current_stream);
ACE_UNUSED_ARG(remote_sap);
ACE_UNUSED_ARG(leaf_id);
ACE_UNUSED_ARG(timeout);
+
return 0;
#else
ACE_UNUSED_ARG(current_stream);
@@ -99,6 +112,7 @@ ACE_ATM_Connector::add_leaf (ACE_ATM_Stream &current_stream,
return 0;
#endif
}
+
ACE_INLINE
int
ACE_ATM_Connector::reset_new_handle (ACE_HANDLE handle)
@@ -113,5 +127,6 @@ ACE_ATM_Connector::reset_new_handle (ACE_HANDLE handle)
return 0;
#endif /* ACE_WIN32 */
}
+
// Close versioned namespace, if enabled by the user.
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/ATM_Params.cpp b/dep/ACE_wrappers/ace/ATM_Params.cpp
index ffa018ff645..d3e5116b0f8 100644
--- a/dep/ACE_wrappers/ace/ATM_Params.cpp
+++ b/dep/ACE_wrappers/ace/ATM_Params.cpp
@@ -1,12 +1,21 @@
// $Id: ATM_Params.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/ATM_Params.h"
+
#if defined (ACE_HAS_ATM)
+
ACE_RCSID(ace, ATM_Params, "$Id: ATM_Params.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if !defined (__ACE_INLINE__)
#include "ace/ATM_Params.inl"
#endif /* __ACE_INLINE__ */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_ATM_Params)
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_ATM */
+
diff --git a/dep/ACE_wrappers/ace/ATM_Params.h b/dep/ACE_wrappers/ace/ATM_Params.h
index 93c36d9b8ba..a244644915d 100644
--- a/dep/ACE_wrappers/ace/ATM_Params.h
+++ b/dep/ACE_wrappers/ace/ATM_Params.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file ATM_Params.h
@@ -9,15 +10,21 @@
*/
//==========================================================================
+
#ifndef ACE_ATM_PARAMS_H
#define ACE_ATM_PARAMS_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_ATM)
+
#include /**/ "ace/ACE_export.h"
+
#if defined (ACE_HAS_FORE_ATM_XTI)
#include "ace/TLI.h"
#define ATM_PROTOCOL_DEFAULT 0
@@ -41,7 +48,9 @@ typedef int Param_Udata;
typedef int Param_Info;
typedef int Param_Udata;
#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_ATM_Params
*
@@ -77,88 +86,129 @@ public:
= ACE_FLAG_MULTIPOINT_C_ROOT
| ACE_FLAG_MULTIPOINT_D_ROOT, // connector by default
int reuse_addr = 0);
+
/// Destructor.
~ACE_ATM_Params ();
+
/// Get protocol family.
int get_protocol_family (void) const;
+
/// Set protocol family.
void set_protocol_family (int);
+
/// Get protocol.
int get_protocol (void) const;
+
/// Set protocol.
void set_protocol (int);
+
/// Get type.
int get_type (void) const;
+
/// Set type.
void set_type (int);
+
/// Get protocol info.
ACE_Protocol_Info *get_protocol_info( void );
+
/// Set protocol info.
void set_protocol_info( ACE_Protocol_Info *);
+
/// Get socket group.
ACE_SOCK_GROUP get_sock_group( void );
+
/// Set socket group.
void set_sock_group( ACE_SOCK_GROUP );
+
/// Get socket flags.
u_long get_flags( void );
+
/// Set socket flags.
void set_flags( u_long );
+
/// Get reuse_addr flag.
int get_reuse_addr (void) const;
+
/// Set reuse_addr flag.
void set_reuse_addr (int);
+
/// Get device.
const char* get_device (void) const;
+
/// Get info.
Param_Info* get_info (void) const;
+
/// Set info.
void set_info (Param_Info *);
+
/// Get r/w flag.
int get_rw_flag (void) const;
+
/// Set r/w flag.
void set_rw_flag (int);
+
/// Get user data.
Param_Udata* get_user_data (void) const;
+
/// Set user data.
void set_user_data (Param_Udata*);
+
/// Get open flag.
int get_oflag (void) const;
+
/// Set open flag.
void set_oflag (int);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Protocol family for sockets connections.
int protocol_family_;
+
/// Protocol for sockets connections.
int protocol_;
+
/// Type for opening sockets.
int type_;
+
/// Information about the protocol.
ACE_Protocol_Info *protocol_info_;
+
/// Socket group used (for sockets only).
ACE_SOCK_GROUP group_;
+
/// Flags for sockets (for sockets only).
u_long flags_;
+
/// Flag for reusing address for opening sockets.
int reuse_addr_;
+
/// Device name for XTI/ATM connections.
const char *device_;
+
/// Info for XTI/ATM connections.
Param_Info *info_;
+
/// R/W flag for XTI/ATM connections.
int rw_flag_;
+
/// User data for XTI/ATM connections.
Param_Udata *udata_;
+
/// Open flag for XTI/ATM connections.
int oflag_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/ATM_Params.inl"
#endif /* __ACE_INLINE__ */
+
#endif /* ACE_HAS_ATM */
#include /**/ "ace/post.h"
#endif /* ACE_ATM_PARAMS_H */
diff --git a/dep/ACE_wrappers/ace/ATM_Params.inl b/dep/ACE_wrappers/ace/ATM_Params.inl
index 0118ac392d6..de2a4d45127 100644
--- a/dep/ACE_wrappers/ace/ATM_Params.inl
+++ b/dep/ACE_wrappers/ace/ATM_Params.inl
@@ -1,7 +1,9 @@
// -*- C++ -*-
//
// $Id: ATM_Params.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE void
ACE_ATM_Params::dump (void) const
{
@@ -9,6 +11,7 @@ ACE_ATM_Params::dump (void) const
ACE_TRACE ("ACE_ATM_Params::dump");
#endif /* ACE_HAS_DUMP */
}
+
ACE_INLINE
ACE_ATM_Params::ACE_ATM_Params (int rw_flag,
const char device[],
@@ -37,12 +40,14 @@ ACE_ATM_Params::ACE_ATM_Params (int rw_flag,
{
ACE_TRACE ("ACE_ATM_Params::ACE_ATM_Params");
}
+
// Default dtor.
ACE_INLINE
ACE_ATM_Params::~ACE_ATM_Params (void)
{
ACE_TRACE ("ACE_ATM_Params::~ACE_ATM_Params");
}
+
ACE_INLINE
int
ACE_ATM_Params::get_protocol_family (void) const
@@ -50,6 +55,7 @@ ACE_ATM_Params::get_protocol_family (void) const
ACE_TRACE ("ACE_ATM_Params::get_protocol_family");
return protocol_family_;
}
+
ACE_INLINE
void
ACE_ATM_Params::set_protocol_family (int family)
@@ -57,6 +63,7 @@ ACE_ATM_Params::set_protocol_family (int family)
ACE_TRACE ("ACE_ATM_Params::set_protocol_family");
protocol_family_ = family;
}
+
ACE_INLINE
int
ACE_ATM_Params::get_protocol (void) const
@@ -64,6 +71,7 @@ ACE_ATM_Params::get_protocol (void) const
ACE_TRACE ("ACE_ATM_Params::get_protocol");
return protocol_;
}
+
ACE_INLINE
void
ACE_ATM_Params::set_protocol (int protocol)
@@ -71,6 +79,7 @@ ACE_ATM_Params::set_protocol (int protocol)
ACE_TRACE ("ACE_ATM_Params::set_protocol");
protocol_ = protocol;
}
+
ACE_INLINE
int
ACE_ATM_Params::get_type (void) const
@@ -78,6 +87,7 @@ ACE_ATM_Params::get_type (void) const
ACE_TRACE ("ACE_ATM_Params::get_type");
return type_;
}
+
ACE_INLINE
void
ACE_ATM_Params::set_type (int type)
@@ -85,6 +95,7 @@ ACE_ATM_Params::set_type (int type)
ACE_TRACE ("ACE_ATM_Params::set_type");
type_ = type;
}
+
ACE_INLINE
ACE_Protocol_Info*
ACE_ATM_Params::get_protocol_info( void )
@@ -92,6 +103,7 @@ ACE_ATM_Params::get_protocol_info( void )
ACE_TRACE ("ACE_ATM_Params::get_protocol_info");
return protocol_info_;
}
+
ACE_INLINE
void
ACE_ATM_Params::set_protocol_info( ACE_Protocol_Info *protocol_info )
@@ -99,6 +111,7 @@ ACE_ATM_Params::set_protocol_info( ACE_Protocol_Info *protocol_info )
ACE_TRACE ("ACE_ATM_Params::set_protocol_info");
protocol_info_ = protocol_info;
}
+
ACE_INLINE
ACE_SOCK_GROUP
ACE_ATM_Params::get_sock_group( void )
@@ -106,6 +119,7 @@ ACE_ATM_Params::get_sock_group( void )
ACE_TRACE ("ACE_ATM_Params::get_sock_group");
return group_;
}
+
ACE_INLINE
void
ACE_ATM_Params::set_sock_group( ACE_SOCK_GROUP g )
@@ -113,6 +127,7 @@ ACE_ATM_Params::set_sock_group( ACE_SOCK_GROUP g )
ACE_TRACE ("ACE_ATM_Params::set_sock_group");
group_ = g;
}
+
ACE_INLINE
u_long
ACE_ATM_Params::get_flags( void )
@@ -120,6 +135,7 @@ ACE_ATM_Params::get_flags( void )
ACE_TRACE ("ACE_ATM_Params::get_flags");
return flags_;
}
+
ACE_INLINE
void
ACE_ATM_Params::set_flags( u_long flags)
@@ -127,6 +143,7 @@ ACE_ATM_Params::set_flags( u_long flags)
ACE_TRACE ("ACE_ATM_Params::set_flags");
flags_ = flags;
}
+
ACE_INLINE
int
ACE_ATM_Params::get_reuse_addr (void) const
@@ -134,6 +151,7 @@ ACE_ATM_Params::get_reuse_addr (void) const
ACE_TRACE ("ACE_ATM_Params::get_reuse_addr");
return reuse_addr_;
}
+
ACE_INLINE
void
ACE_ATM_Params::set_reuse_addr (int reuse_addr)
@@ -141,6 +159,7 @@ ACE_ATM_Params::set_reuse_addr (int reuse_addr)
ACE_TRACE ("ACE_ATM_Params::set_reuse_addr");
reuse_addr_ = reuse_addr;
}
+
ACE_INLINE
const char*
ACE_ATM_Params::get_device (void) const
@@ -148,6 +167,7 @@ ACE_ATM_Params::get_device (void) const
ACE_TRACE ("ACE_ATM_Params::get_device");
return device_;
}
+
ACE_INLINE
Param_Info*
ACE_ATM_Params::get_info (void) const
@@ -155,6 +175,7 @@ ACE_ATM_Params::get_info (void) const
ACE_TRACE ("ACE_ATM_Params::get_info");
return info_;
}
+
ACE_INLINE
void
ACE_ATM_Params::set_info (Param_Info* info)
@@ -162,6 +183,7 @@ ACE_ATM_Params::set_info (Param_Info* info)
ACE_TRACE ("ACE_ATM_Params::set_info");
info_ = info;
}
+
ACE_INLINE
int
ACE_ATM_Params::get_rw_flag (void) const
@@ -169,6 +191,7 @@ ACE_ATM_Params::get_rw_flag (void) const
ACE_TRACE ("ACE_ATM_Params::get_rw_flag");
return rw_flag_;
}
+
ACE_INLINE
void
ACE_ATM_Params::set_rw_flag (int rw_flag)
@@ -176,6 +199,7 @@ ACE_ATM_Params::set_rw_flag (int rw_flag)
ACE_TRACE ("ACE_ATM_Params::set_rw_flag");
rw_flag_ = rw_flag;
}
+
ACE_INLINE
Param_Udata*
ACE_ATM_Params::get_user_data (void) const
@@ -183,6 +207,7 @@ ACE_ATM_Params::get_user_data (void) const
ACE_TRACE ("ACE_ATM_Params::get_user_data");
return udata_;
}
+
ACE_INLINE
void
ACE_ATM_Params::set_user_data (Param_Udata *udata)
@@ -190,6 +215,7 @@ ACE_ATM_Params::set_user_data (Param_Udata *udata)
ACE_TRACE ("ACE_ATM_Params::set_user_data");
udata_ = udata;
}
+
ACE_INLINE
int
ACE_ATM_Params::get_oflag (void) const
@@ -197,6 +223,7 @@ ACE_ATM_Params::get_oflag (void) const
ACE_TRACE ("ACE_ATM_Params::get_oflag");
return oflag_;
}
+
ACE_INLINE
void
ACE_ATM_Params::set_oflag (int oflag)
@@ -204,4 +231,5 @@ ACE_ATM_Params::set_oflag (int oflag)
ACE_TRACE ("ACE_ATM_Params::set_oflag");
oflag_ = oflag;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/ATM_QoS.cpp b/dep/ACE_wrappers/ace/ATM_QoS.cpp
index 5d4ea5ae673..60e4cafad3f 100644
--- a/dep/ACE_wrappers/ace/ATM_QoS.cpp
+++ b/dep/ACE_wrappers/ace/ATM_QoS.cpp
@@ -1,11 +1,17 @@
// $Id: ATM_QoS.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/ATM_QoS.h"
+
ACE_RCSID(ace, ATM_QoS, "$Id: ATM_QoS.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if defined (ACE_HAS_ATM)
+
#if !defined (__ACE_INLINE__)
#include "ace/ATM_QoS.inl"
#endif /* __ACE_INLINE__ */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2)
#define BHLI_MAGIC "FORE_ATM"
// This is line rate in cells/s for an OC-3 MM interface.
@@ -30,7 +36,9 @@ const int ACE_ATM_QoS::OPT_FLAGS_PMP = 0;
const int ACE_ATM_QoS::DEFAULT_SELECTOR = 0x0;
const int ACE_ATM_QoS::DEFAULT_PKT_SIZE = 0;
#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */
+
ACE_ALLOC_HOOK_DEFINE(ACE_ATM_QoS)
+
ACE_ATM_QoS::ACE_ATM_QoS (int pktSize)
{
ACE_TRACE ("ACE_ATM_QoS::ACE_ATM_QoS");
@@ -45,6 +53,7 @@ ACE_ATM_QoS::ACE_ATM_QoS (int pktSize)
ACE_UNUSED_ARG (pktSize);
#endif /* ACE_HAS_LINUX_ATM */
}
+
ACE_ATM_QoS::ACE_ATM_QoS(int rate,
int pktSize)
{
@@ -56,6 +65,7 @@ ACE_ATM_QoS::ACE_ATM_QoS(int rate,
ATM_QOS_CLASS_IE ie_qos;
Q2931_IE *ie_ptr;
int size;
+
// Setting up cbr parameters ...
ie_aalparams.AALType = AALTYPE_5;
ie_aalparams.AALSpecificParameters.AAL5Parameters.ForwardMaxCPCSSDUSize
@@ -64,7 +74,9 @@ ACE_ATM_QoS::ACE_ATM_QoS(int rate,
= pktSize; // was 1516;
ie_aalparams.AALSpecificParameters.AAL5Parameters.Mode = AAL5_MODE_MESSAGE;
ie_aalparams.AALSpecificParameters.AAL5Parameters.SSCSType = AAL5_SSCS_NULL;
+
size = sizeof(Q2931_IE_TYPE) + sizeof(ULONG) + sizeof(AAL_PARAMETERS_IE);
+
ie_td.Forward.PeakCellRate_CLP0 = SAP_FIELD_ABSENT;
ie_td.Forward.PeakCellRate_CLP01 = rate;
ie_td.Forward.SustainableCellRate_CLP0 = SAP_FIELD_ABSENT;
@@ -72,6 +84,7 @@ ACE_ATM_QoS::ACE_ATM_QoS(int rate,
ie_td.Forward.MaxBurstSize_CLP0 = SAP_FIELD_ABSENT;
ie_td.Forward.MaxBurstSize_CLP01 = SAP_FIELD_ABSENT;
ie_td.Forward.Tagging = SAP_FIELD_ABSENT;
+
ie_td.Backward.PeakCellRate_CLP0 = SAP_FIELD_ABSENT;
ie_td.Backward.PeakCellRate_CLP01 = rate;
ie_td.Backward.SustainableCellRate_CLP0 = SAP_FIELD_ABSENT;
@@ -79,22 +92,29 @@ ACE_ATM_QoS::ACE_ATM_QoS(int rate,
ie_td.Backward.MaxBurstSize_CLP0 = SAP_FIELD_ABSENT;
ie_td.Backward.MaxBurstSize_CLP01 = SAP_FIELD_ABSENT;
ie_td.Backward.Tagging = SAP_FIELD_ABSENT;
+
ie_td.BestEffort = 0; // Note: this must be set to zero for CBR.
+
size += sizeof( Q2931_IE_TYPE )
+ sizeof( ULONG )
+ sizeof( ATM_TRAFFIC_DESCRIPTOR_IE );
+
ie_bbc.BearerClass = BCOB_X;
ie_bbc.TrafficType = TT_CBR;
ie_bbc.TimingRequirements = TR_END_TO_END;
ie_bbc.ClippingSusceptability = CLIP_NOT;
ie_bbc.UserPlaneConnectionConfig = UP_P2P;
+
size += sizeof( Q2931_IE_TYPE )
+ sizeof( ULONG )
+ sizeof( ATM_BROADBAND_BEARER_CAPABILITY_IE );
+
ie_qos.QOSClassForward = QOS_CLASS1;
ie_qos.QOSClassBackward = QOS_CLASS1; // This may not be really used
// since we do only simplex data xfer.
+
size += sizeof(Q2931_IE_TYPE) + sizeof(ULONG) + sizeof(ATM_QOS_CLASS_IE);
+
qos_.ProviderSpecific.buf = (char *) ACE_OS::malloc(size);
if (qos_.ProviderSpecific.buf == 0) {
ACE_ERROR((LM_ERROR,
@@ -104,18 +124,21 @@ ACE_ATM_QoS::ACE_ATM_QoS(int rate,
}
qos_.ProviderSpecific.len = size;
ACE_OS::memset(qos_.ProviderSpecific.buf, 0, size);
+
ie_ptr = (Q2931_IE *) qos_.ProviderSpecific.buf;
ie_ptr->IEType = IE_AALParameters;
ie_ptr->IELength = sizeof( Q2931_IE_TYPE )
+ sizeof( ULONG )
+ sizeof( AAL_PARAMETERS_IE );
ACE_OS::memcpy(ie_ptr->IE, &ie_aalparams, sizeof(AAL_PARAMETERS_IE));
+
ie_ptr = (Q2931_IE *) ((char *)ie_ptr + ie_ptr->IELength);
ie_ptr->IEType = IE_TrafficDescriptor;
ie_ptr->IELength = sizeof( Q2931_IE_TYPE )
+ sizeof( ULONG )
+ sizeof( ATM_TRAFFIC_DESCRIPTOR_IE );
ACE_OS::memcpy(ie_ptr->IE, &ie_td, sizeof(ATM_TRAFFIC_DESCRIPTOR_IE));
+
ie_ptr = (Q2931_IE *) ((char *)ie_ptr + ie_ptr->IELength);
ie_ptr->IEType = IE_BroadbandBearerCapability;
ie_ptr->IELength = sizeof( Q2931_IE_TYPE )
@@ -124,12 +147,14 @@ ACE_ATM_QoS::ACE_ATM_QoS(int rate,
ACE_OS::memcpy(ie_ptr->IE,
&ie_bbc,
sizeof(ATM_BROADBAND_BEARER_CAPABILITY_IE));
+
ie_ptr = (Q2931_IE *) ((char *)ie_ptr + ie_ptr->IELength);
ie_ptr->IEType = IE_QOSClass;
ie_ptr->IELength = sizeof( Q2931_IE_TYPE )
+ sizeof( ULONG )
+ sizeof( ATM_QOS_CLASS_IE );
ACE_OS::memcpy(ie_ptr->IE, &ie_qos, sizeof(ATM_QOS_CLASS_IE));
+
// qos_.SendingFlowspec.TokenRate = 0xffffffff;
// qos_.SendingFlowspec.TokenBucketSize = 0xffffffff;
// qos_.SendingFlowspec.PeakBandwidth = 0xffffffff;
@@ -139,6 +164,7 @@ ACE_ATM_QoS::ACE_ATM_QoS(int rate,
// This will most probably be ignored by the service provider.
// qos_.SendingFlowspec.MaxSduSize = 0xffffffff;
// qos_.SendingFlowspec.MinimumPolicedSize = 0xffffffff;
+
// qos_.ReceivingFlowspec.TokenRate = 0xffffffff;
// qos_.ReceivingFlowspec.TokenBucketSize = 0xffffffff;
// qos_.ReceivingFlowspec.PeakBandwidth = 0xffffffff;
@@ -148,6 +174,7 @@ ACE_ATM_QoS::ACE_ATM_QoS(int rate,
// This will most probably be ignored by the service provider.
// qos_.ReceivingFlowspec.MaxSduSize = 0xffffffff;
// qos_.ReceivingFlowspec.MinimumPolicedSize = 0;
+
ACE_Flow_Spec send_fspec( 0xffffffff,
0xffffffff,
0xffffffff,
@@ -170,6 +197,7 @@ ACE_ATM_QoS::ACE_ATM_QoS(int rate,
0,
15,
ACE_DEFAULT_THREAD_PRIORITY );
+
qos_.sending_flowspec (send_fspec);
qos_.receiving_flowspec (recv_fspec);
#elif defined (ACE_HAS_FORE_ATM_XTI)
@@ -181,6 +209,7 @@ ACE_ATM_QoS::ACE_ATM_QoS(int rate,
sizeof(qos_));
qos_.aal = ATM_PROTOCOL_DEFAULT;
qos_.rxtp.max_sdu = pktSize;
+
if (rate > 0) {
qos_.rxtp.pcr = rate;
qos_.rxtp.traffic_class = ATM_CBR;
@@ -191,11 +220,13 @@ ACE_ATM_QoS::ACE_ATM_QoS(int rate,
qos_.rxtp.traffic_class = ATM_UBR;
qos_.txtp.traffic_class = ATM_UBR;
}
+
qos_.txtp.max_sdu = pktSize;
#else
ACE_UNUSED_ARG (rate);
#endif /* ACE_HAS_FORE_ATM_WS2 || ACE_HAS_FORE_ATM_XTI || ACE_HAS_LINUX_ATM */
}
+
void
ACE_ATM_QoS::set_cbr_rate (int rate,
int pktSize)
@@ -210,7 +241,9 @@ ACE_ATM_QoS::set_cbr_rate (int rate,
Q2931_IE *ie_ptr;
int size;
*/
+
ACE_OS::printf( "ATM_QoS(set_cbr_rate): set rate to %d c/s\n", rate );
+
// Setting up cbr parameters ...
/*
FORE has changed this - we no longer specify QoS this way
@@ -221,7 +254,9 @@ ACE_ATM_QoS::set_cbr_rate (int rate,
= pktSize; // was 1516;
ie_aalparams.AALSpecificParameters.AAL5Parameters.Mode = AAL5_MODE_MESSAGE;
ie_aalparams.AALSpecificParameters.AAL5Parameters.SSCSType = AAL5_SSCS_NULL;
+
size = sizeof(Q2931_IE_TYPE) + sizeof(ULONG) + sizeof(AAL_PARAMETERS_IE);
+
ie_td.Forward.PeakCellRate_CLP0 = SAP_FIELD_ABSENT;
ie_td.Forward.PeakCellRate_CLP01 = rate;
ie_td.Forward.SustainableCellRate_CLP0 = SAP_FIELD_ABSENT;
@@ -229,6 +264,7 @@ ACE_ATM_QoS::set_cbr_rate (int rate,
ie_td.Forward.MaxBurstSize_CLP0 = SAP_FIELD_ABSENT;
ie_td.Forward.MaxBurstSize_CLP01 = SAP_FIELD_ABSENT;
ie_td.Forward.Tagging = SAP_FIELD_ABSENT;
+
ie_td.Backward.PeakCellRate_CLP0 = SAP_FIELD_ABSENT;
ie_td.Backward.PeakCellRate_CLP01 = rate;
ie_td.Backward.SustainableCellRate_CLP0 = SAP_FIELD_ABSENT;
@@ -236,22 +272,29 @@ ACE_ATM_QoS::set_cbr_rate (int rate,
ie_td.Backward.MaxBurstSize_CLP0 = SAP_FIELD_ABSENT;
ie_td.Backward.MaxBurstSize_CLP01 = SAP_FIELD_ABSENT;
ie_td.Backward.Tagging = SAP_FIELD_ABSENT;
+
ie_td.BestEffort = 0; // Note: this must be set to zero for CBR.
+
size += sizeof( Q2931_IE_TYPE ) +
sizeof( ULONG ) +
sizeof( ATM_TRAFFIC_DESCRIPTOR_IE );
+
ie_bbc.BearerClass = BCOB_X;
ie_bbc.TrafficType = TT_CBR;
ie_bbc.TimingRequirements = TR_END_TO_END;
ie_bbc.ClippingSusceptability = CLIP_NOT;
ie_bbc.UserPlaneConnectionConfig = UP_P2P;
+
size += sizeof(Q2931_IE_TYPE) +
sizeof(ULONG) +
sizeof(ATM_BROADBAND_BEARER_CAPABILITY_IE);
+
ie_qos.QOSClassForward = QOS_CLASS1;
ie_qos.QOSClassBackward = QOS_CLASS1; // This may not be really used
// since we only simplex data xfer.
+
size += sizeof(Q2931_IE_TYPE) + sizeof(ULONG) + sizeof(ATM_QOS_CLASS_IE);
+
qos_.ProviderSpecific.buf = (char *) ACE_OS::malloc(size);
if (qos_.ProviderSpecific.buf == 0) {
ACE_ERROR((LM_ERROR,
@@ -261,18 +304,21 @@ ACE_ATM_QoS::set_cbr_rate (int rate,
}
qos_.ProviderSpecific.len = size;
ACE_OS::memset(qos_.ProviderSpecific.buf, 0, size);
+
ie_ptr = (Q2931_IE *) qos_.ProviderSpecific.buf;
ie_ptr->IEType = IE_AALParameters;
ie_ptr->IELength = sizeof( Q2931_IE_TYPE ) +
sizeof( ULONG ) +
sizeof( AAL_PARAMETERS_IE );
ACE_OS::memcpy(ie_ptr->IE, &ie_aalparams, sizeof(AAL_PARAMETERS_IE));
+
ie_ptr = (Q2931_IE *) ((char *)ie_ptr + ie_ptr->IELength);
ie_ptr->IEType = IE_TrafficDescriptor;
ie_ptr->IELength = sizeof( Q2931_IE_TYPE ) +
sizeof( ULONG ) +
sizeof( ATM_TRAFFIC_DESCRIPTOR_IE );
ACE_OS::memcpy(ie_ptr->IE, &ie_td, sizeof(ATM_TRAFFIC_DESCRIPTOR_IE));
+
ie_ptr = (Q2931_IE *) ((char *)ie_ptr + ie_ptr->IELength);
ie_ptr->IEType = IE_BroadbandBearerCapability;
ie_ptr->IELength = sizeof( Q2931_IE_TYPE ) +
@@ -281,12 +327,14 @@ ACE_ATM_QoS::set_cbr_rate (int rate,
ACE_OS::memcpy( ie_ptr->IE,
&ie_bbc,
sizeof( ATM_BROADBAND_BEARER_CAPABILITY_IE ));
+
ie_ptr = (Q2931_IE *) ((char *)ie_ptr + ie_ptr->IELength);
ie_ptr->IEType = IE_QOSClass;
ie_ptr->IELength = sizeof(Q2931_IE_TYPE) + sizeof(ULONG) +
sizeof(ATM_QOS_CLASS_IE);
ACE_OS::memcpy(ie_ptr->IE, &ie_qos, sizeof(ATM_QOS_CLASS_IE));
*/
+
const int BYTES_PER_ATM_CELL = 53;
ACE_OS::memset(&qos_, 0, sizeof(ATM_QoS));
// Setting the token rate sets the minimum rate. 3 Mbits/sec seems too high.
@@ -306,6 +354,7 @@ ACE_ATM_QoS::set_cbr_rate (int rate,
qos_.ProviderSpecific.buf=0;
qos_.ProviderSpecific.len=0;
// unidirectional P2MP; we don't need to setup the Receiving flowspec
+
//qos_.SendingFlowspec.TokenRate = 0xffffffff;
//qos_.SendingFlowspec.TokenBucketSize = 0xffffffff;
//qos_.SendingFlowspec.PeakBandwidth = 0xffffffff;
@@ -315,6 +364,7 @@ ACE_ATM_QoS::set_cbr_rate (int rate,
// This will most probably be ignored by the service provider.
//qos_.SendingFlowspec.MaxSduSize = 0xffffffff;
//qos_.SendingFlowspec.MinimumPolicedSize = 0xffffffff;
+
//qos_.ReceivingFlowspec.TokenRate = 0xffffffff;
//qos_.ReceivingFlowspec.TokenBucketSize = 0xffffffff;
//qos_.ReceivingFlowspec.PeakBandwidth = 0xffffffff;
@@ -324,6 +374,7 @@ ACE_ATM_QoS::set_cbr_rate (int rate,
// This will most probably be ignored by the service provider.
//qos_.ReceivingFlowspec.MaxSduSize = 0xffffffff;
//qos_.ReceivingFlowspec.MinimumPolicedSize = 0;
+
/*
ACE_Flow_Spec send_fspec( 0xffffffff,
0xffffffff,
@@ -347,6 +398,7 @@ ACE_ATM_QoS::set_cbr_rate (int rate,
0,
15,
ACE_DEFAULT_THREAD_PRIORITY );
+
qos_.sending_flowspec( send_fspec );
qos_.receiving_flowspec( recv_fspec );
*/
@@ -355,6 +407,7 @@ ACE_ATM_QoS::set_cbr_rate (int rate,
ACE_UNUSED_ARG (pktSize);
#elif defined (ACE_HAS_LINUX_ATM)
ACE_UNUSED_ARG (pktSize);
+
qos_.rxtp.traffic_class = ATM_CBR;
qos_.rxtp.pcr = rate;
qos_.txtp.traffic_class = ATM_CBR;
@@ -363,6 +416,7 @@ ACE_ATM_QoS::set_cbr_rate (int rate,
ACE_UNUSED_ARG (rate);
#endif /* ACE_HAS_FORE_ATM_WS2 || ACE_HAS_FORE_ATM_XTI || ACE_HAS_LINUX_ATM */
}
+
void
ACE_ATM_QoS::set_rate (ACE_HANDLE fd,
int rate,
@@ -371,6 +425,7 @@ ACE_ATM_QoS::set_rate (ACE_HANDLE fd,
ACE_TRACE ("ACE_ATM_QoS::set_rate");
#if defined (ACE_HAS_FORE_ATM_WS2) || defined (ACE_HAS_LINUX_ATM)
set_cbr_rate( rate );
+
ACE_UNUSED_ARG( fd );
ACE_UNUSED_ARG( flags );
#elif defined (ACE_HAS_FORE_ATM_XTI)
@@ -384,6 +439,7 @@ ACE_ATM_QoS::set_rate (ACE_HANDLE fd,
ACE_UNUSED_ARG (rate);
#endif /* ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM || ACE_HAS_FORE_ATM_XTI */
}
+
char*
ACE_ATM_QoS::construct_options (ACE_HANDLE fd,
int rate,
@@ -401,35 +457,46 @@ ACE_ATM_QoS::construct_options (ACE_HANDLE fd,
char *buf;
int qos_cells;
struct t_info info;
+
if (ACE_OS::t_getinfo (fd, &info) == -1)
{
ACE_OS::t_error ("t_getinfo");
return 0;
}
+
buf = (char *) ACE_OS::malloc (info.options);
+
if (buf == 0)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("Unable to allocate %d bytes for options\n"),
info.options),
0);
+
popt = (struct t_opthdr *) buf;
+
if (flags & OPT_FLAGS_CPID)
{
// This constructs the T_ATM_ORIG_ADDR option, which is used to
// signal the UNI 3.1 Calling Party ID Information Element.
t_atm_addr *source_addr;
+
popt->len = sizeof (struct t_opthdr) + sizeof (t_atm_addr);
popt->level = T_ATM_SIGNALING;
popt->name = T_ATM_ORIG_ADDR;
popt->status = 0;
+
source_addr =
(t_atm_addr *)((char *) popt + sizeof (struct t_opthdr));
+
source_addr->address_format = T_ATM_ENDSYS_ADDR;
source_addr->address_length = ATMNSAP_ADDR_LEN;
+
ATMSAPAddress local_addr;
struct t_bind boundaddr;
+
boundaddr.addr.maxlen = sizeof(local_addr);
boundaddr.addr.buf = (char *) &local_addr;
+
//if (ACE_OS::t_getprotaddr(fd, &boundaddr, 0) < 0) {
if (ACE_OS::t_getname(fd,
&boundaddr.addr,
@@ -441,30 +508,39 @@ ACE_ATM_QoS::construct_options (ACE_HANDLE fd,
ACE_OS::free (buf);
return 0;
}
+
ACE_OS::memcpy(source_addr->address,
local_addr.sap.t_atm_sap_addr.address,
ATMNSAP_ADDR_LEN);
+
popt = T_OPT_NEXTHDR (buf, info.options , popt);
}
+
// This constructs all options necessary (bearer cap., QoS, and
// Traffic Descriptor) to signal for a CBR connection with the
// specified QoS in kbit/sec., and/or specify a PMP connection.
+
// For FORE 200e cards, the adapter shapes traffic to CBR with rate
// equal to PCR CLP=0+1 (traffic.forward.PCR_all_traffic)
+
qos_cells = (rate * 1000) / (48*8);
+
if ((qos_cells > 0 && qos_cells < LINE_RATE)
|| (ACE_BIT_ENABLED (flags, OPT_FLAGS_PMP)))
{
struct t_atm_bearer *bearer;
struct t_atm_traffic *traffic;
+
// T_ATM_BEARER_CAP: Broadband bearer capability
popt->len = sizeof (struct t_opthdr) + sizeof (struct t_atm_bearer);
popt->level = T_ATM_SIGNALING;
popt->name = T_ATM_BEARER_CAP;
popt->status = 0;
+
bearer = (struct t_atm_bearer *)((char *) popt +
sizeof (struct t_opthdr));
bearer->bearer_class = T_ATM_CLASS_X;
+
if (qos_cells)
{
bearer->traffic_type = T_ATM_CBR;
@@ -476,18 +552,23 @@ ACE_ATM_QoS::construct_options (ACE_HANDLE fd,
bearer->timing_requirements = 0;
}
bearer->clipping_susceptibility = T_ATM_NULL;
+
if (ACE_BIT_ENABLED (flags, OPT_FLAGS_PMP))
bearer->connection_configuration = T_ATM_1_TO_MANY;
else
bearer->connection_configuration = T_ATM_1_TO_1;
+
popt = T_OPT_NEXTHDR (buf, info.options, popt);
+
// T_ATM_TRAFFIC: traffic descriptor
popt->len = sizeof (struct t_opthdr) + sizeof (struct t_atm_traffic);
popt->level = T_ATM_SIGNALING;
popt->name = T_ATM_TRAFFIC;
popt->status = 0;
+
traffic = (struct t_atm_traffic *)((char *) popt +
sizeof (struct t_opthdr));
+
traffic->forward.PCR_high_priority = T_ATM_ABSENT;
traffic->forward.PCR_all_traffic = qos_cells ? qos_cells : LINE_RATE;
traffic->forward.SCR_high_priority = T_ATM_ABSENT;
@@ -495,6 +576,7 @@ ACE_ATM_QoS::construct_options (ACE_HANDLE fd,
traffic->forward.MBS_high_priority = T_ATM_ABSENT;
traffic->forward.MBS_all_traffic = T_ATM_ABSENT;
traffic->forward.tagging = T_NO;
+
traffic->backward.PCR_high_priority = T_ATM_ABSENT;
traffic->backward.PCR_all_traffic =
(ACE_BIT_ENABLED (flags, OPT_FLAGS_PMP))
@@ -504,27 +586,35 @@ ACE_ATM_QoS::construct_options (ACE_HANDLE fd,
traffic->backward.MBS_high_priority = T_ATM_ABSENT;
traffic->backward.MBS_all_traffic = T_ATM_ABSENT;
traffic->backward.tagging = T_NO;
+
traffic->best_effort = qos_cells ? T_NO : T_YES;
+
popt = T_OPT_NEXTHDR (buf,
info.options,
popt);
}
+
if (qos_cells > 0 && qos_cells < LINE_RATE)
{
struct t_atm_qos *qos;
+
// T_ATM_QOS: Quality of Service
popt->len = sizeof (struct t_opthdr) + sizeof (struct t_atm_qos);
popt->level = T_ATM_SIGNALING;
popt->name = T_ATM_QOS;
popt->status = 0;
+
qos = (struct t_atm_qos *)((char *) popt + sizeof (struct t_opthdr));
qos->coding_standard = T_ATM_ITU_CODING;
qos->forward.qos_class = T_ATM_QOS_CLASS_1;
qos->backward.qos_class = T_ATM_QOS_CLASS_1;
+
popt = T_OPT_NEXTHDR (buf, info.options, popt);
}
+
// Return actual size of options and option buffer to user.
*len = (char *) popt - buf;
+
return buf;
#else
ACE_UNUSED_ARG (fd);
@@ -534,6 +624,9 @@ ACE_ATM_QoS::construct_options (ACE_HANDLE fd,
return (0);
#endif /* ACE_HAS_FORE_ATM_WS2 */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_ATM */
+
diff --git a/dep/ACE_wrappers/ace/ATM_QoS.h b/dep/ACE_wrappers/ace/ATM_QoS.h
index 48b5bae5bb7..3e839fb50d1 100644
--- a/dep/ACE_wrappers/ace/ATM_QoS.h
+++ b/dep/ACE_wrappers/ace/ATM_QoS.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file ATM_QoS.h
@@ -9,14 +10,19 @@
*/
//==========================================================================
+
#ifndef ACE_ATM_QoS_H
#define ACE_ATM_QoS_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined(ACE_LACKS_PRAGMA_ONCE)
#pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_ATM)
+
#if defined (ACE_HAS_FORE_ATM_WS2)
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
// just map to WS2 GQOS struct
@@ -37,7 +43,9 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
typedef int ATM_QoS;
ACE_END_VERSIONED_NAMESPACE_DECL
#endif /* ACE_HAS_FORE_ATM_WS2 || ACE_HAS_FORE_ATM_XTI || ACE_HAS_LINUX_ATM */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_ATM_QoS
*
@@ -56,39 +64,52 @@ public:
static const int OPT_FLAGS_PMP;
static const int DEFAULT_SELECTOR;
static const int DEFAULT_PKT_SIZE;
+
// = Initializattion and termination methods.
/// Default constructor.
ACE_ATM_QoS(int = DEFAULT_PKT_SIZE);
+
/// Constructor with a CBR rate.
ACE_ATM_QoS(int,
int = DEFAULT_PKT_SIZE);
+
~ACE_ATM_QoS ();
+
/// Set the rate.
void set_rate (ACE_HANDLE,
int,
int);
+
/// Set CBR rate in cells per second.
void set_cbr_rate (int,
int = DEFAULT_PKT_SIZE);
+
/// Get ATM_QoS struct.
ATM_QoS get_qos (void);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
/// Construct QoS options.
char* construct_options(ACE_HANDLE,
int,
int,
long*);
+
private:
ATM_QoS qos_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/ATM_QoS.inl"
#endif /* __ACE_INLINE__ */
+
#endif /* ACE_HAS_ATM */
#include /**/ "ace/post.h"
#endif /* ACE_ATM_QoS_H */
diff --git a/dep/ACE_wrappers/ace/ATM_QoS.inl b/dep/ACE_wrappers/ace/ATM_QoS.inl
index 90097eeae01..52b5211190d 100644
--- a/dep/ACE_wrappers/ace/ATM_QoS.inl
+++ b/dep/ACE_wrappers/ace/ATM_QoS.inl
@@ -1,7 +1,9 @@
// -*- C++ -*-
//
// $Id: ATM_QoS.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE void
ACE_ATM_QoS::dump (void) const
{
@@ -9,11 +11,13 @@ ACE_ATM_QoS::dump (void) const
ACE_TRACE ("ACE_ATM_QoS::dump");
#endif /* ACE_HAS_DUMP */
}
+
ACE_INLINE
ACE_ATM_QoS::~ACE_ATM_QoS ()
{
ACE_TRACE ("ACE_ATM_QoS::~ACE_ATM_QoS");
}
+
ACE_INLINE
ATM_QoS
ACE_ATM_QoS::get_qos (void)
@@ -21,4 +25,5 @@ ACE_ATM_QoS::get_qos (void)
ACE_TRACE ("ACE_ATM_QoS::get_qos");
return qos_;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/ATM_Stream.cpp b/dep/ACE_wrappers/ace/ATM_Stream.cpp
index ef0d32304fb..83b4625436d 100644
--- a/dep/ACE_wrappers/ace/ATM_Stream.cpp
+++ b/dep/ACE_wrappers/ace/ATM_Stream.cpp
@@ -1,12 +1,19 @@
// $Id: ATM_Stream.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/ATM_Stream.h"
+
ACE_RCSID (ace, ATM_Stream, "$Id: ATM_Stream.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if defined (ACE_HAS_ATM)
+
#if !defined (__ACE_INLINE__)
#include "ace/ATM_Stream.inl"
#endif /* __ACE_INLINE__ */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE (ACE_ATM_Stream)
+
char*
ACE_ATM_Stream::get_peer_name (void) const
{
@@ -24,6 +31,7 @@ ACE_ATM_Stream::get_peer_name (void) const
// ::t_getprotaddr (get_handle (),
// localaddr,
// peeraddr);
+
// char* connected_name = (char*) ACE_OS::malloc (peeraddr->addr.len + 1);
// ACE_OS::strcpy (connected_name,
// peeraddr->addr.buf);
@@ -32,8 +40,10 @@ ACE_ATM_Stream::get_peer_name (void) const
// ACE_OS::t_free ((char *) peeraddr,
// T_BIND);
// return (connected_name);
+
#error "This doesn't seem to work. May need to jimmy-rig something with the"
#error "/etc/xti_hosts file - Ugh!"
+
ACE_ATM_Addr sa;
struct netbuf name;
name.maxlen = sa.get_size ();
@@ -43,16 +53,19 @@ ACE_ATM_Stream::get_peer_name (void) const
// TI_GETPEERNAME,
// &name);
return (name.buf);
+
#elif defined (ACE_HAS_FORE_ATM_WS2)
// Use getpeername for WinSock2.
struct sockaddr_atm name;
ACE_OS::memset (&name, 0, sizeof (name));
int nameSize = sizeof (name);
+
if (ACE_OS::getpeername (this->get_handle (),
(struct sockaddr *) &name,
&nameSize) != 0) {
return 0;
}
+
char buffer[256];
for (unsigned int index = 0; index < ATM_ADDR_SIZE - 1; index++) {
buffer[ index * 3 ] = '\0';
@@ -63,8 +76,10 @@ ACE_ATM_Stream::get_peer_name (void) const
buffer[ ATM_ADDR_SIZE * 3 - 1 ] = '\0';
for (index = 0; index < ACE_OS::strlen (buffer); ++index)
buffer[index] = ACE_OS::ace_tolower (buffer[index]);
+
ifstream atm_hosts ("C:/WINNT/atmhosts");
assert (atm_hosts.is_open ());
+
// Find the host address in the ATM hosts file and return the
// host name
char line[256];
@@ -85,16 +100,19 @@ ACE_ATM_Stream::get_peer_name (void) const
break;
}
}
+
return host_name;
#elif defined (ACE_HAS_LINUX_ATM)
ATM_Addr name;
int nameSize = sizeof (name.sockaddratmsvc);
+
if (ACE_OS::getpeername (this->get_handle (),
(struct sockaddr *) & (name.sockaddratmsvc),
&nameSize) < 0) {
ACE_OS::perror ("ACE_ATM_Stream (get_peer_name) : ");
return 0;
}
+
static ACE_TCHAR buffer[MAX_ATM_ADDR_LEN + 1];
int total_len;
if ((total_len = atm2text (buffer,sizeof buffer,
@@ -103,11 +121,13 @@ ACE_ATM_Stream::get_peer_name (void) const
ACE_DEBUG ((LM_DEBUG,ACE_TEXT ("ACE_ATM_Stream (get_peer_name) :%d"),errno));
return 0;
}
+
return (char*) buffer;
#else
return 0;
#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */
}
+
ACE_HANDLE
ACE_ATM_Stream::get_handle (void) const
{
@@ -118,6 +138,7 @@ ACE_ATM_Stream::get_handle (void) const
return 0;
#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */
}
+
int
ACE_ATM_Stream::get_vpi_vci (ACE_UINT16 &vpi,
ACE_UINT16 &vci) const
@@ -129,12 +150,14 @@ ACE_ATM_Stream::get_vpi_vci (ACE_UINT16 &vpi,
int opt_size = sizeof (t_atm_conn_prop);
struct t_info info;
struct t_optmgmt opt_req, opt_ret;
+
if (ACE_OS::t_getinfo (stream_.get_handle (),
&info) < 0)
{
ACE_OS::t_error ("t_getinfo");
return -1;
}
+
char *buf_req = (char *) ACE_OS::malloc (info.options);
if (buf_req == 0)
{
@@ -143,6 +166,7 @@ ACE_ATM_Stream::get_vpi_vci (ACE_UINT16 &vpi,
info.options);
return -1;
}
+
char *buf_ret = (char *) ACE_OS::malloc (info.options);
if (buf_ret == 0)
{
@@ -151,41 +175,52 @@ ACE_ATM_Stream::get_vpi_vci (ACE_UINT16 &vpi,
info.options);
return -1;
}
+
ACE_OS::memset (&opt_req, 0, sizeof (opt_req));
ACE_OS::memset (&opt_ret, 0, sizeof (opt_ret));
+
struct t_opthdr *popt = (struct t_opthdr *) buf_req;
struct t_opthdr *popt_ret = (struct t_opthdr *) buf_ret;
+
popt->len= sizeof (struct t_opthdr) + opt_size;
+
// We are only concerned with SVCs so no other check or values are needed
// here.
popt->level = T_ATM_SIGNALING;
popt->name = T_ATM_CONN_PROP;
popt->status = 0;
+
opt_req.opt.len = popt->len;
opt_req.opt.buf = (char *) popt;
opt_req.flags = T_CURRENT;
+
popt = T_OPT_NEXTHDR (buf_req,
info.options,
popt);
opt_ret.opt.maxlen = info.options;
opt_ret.opt.buf = (char *) popt_ret;
+
if (ACE_OS::t_optmgmt (stream_.get_handle (),
&opt_req,
&opt_ret) < 0) {
ACE_OS::t_error ("t_optmgmt");
return -1;
}
+
ACE_OS::memcpy (connect_opts,
(char *) popt_ret + sizeof (struct t_opthdr),
opt_size);
+
ACE_OS::free (buf_ret);
ACE_OS::free (buf_req);
+
vpi = conn_prop.vpi;
vci = conn_prop.vci;
return (0);
#elif defined (ACE_HAS_FORE_ATM_WS2)
ATM_CONNECTION_ID connID;
DWORD bytes = 0;
+
if (::WSAIoctl ((int) this -> get_handle (),
SIO_GET_ATM_CONNECTION_ID,
0,
@@ -198,8 +233,10 @@ ACE_ATM_Stream::get_vpi_vci (ACE_UINT16 &vpi,
== SOCKET_ERROR) {
ACE_OS::printf ("Error: WSAIoctl %d\n", WSAGetLastError ());
}
+
vpi = (ACE_UINT16) connID.VPI;
vci = (ACE_UINT16) connID.VCI;
+
return 0;
#elif defined (ACE_HAS_LINUX_ATM)
#if defined (SO_ATMPVC) /* atm version>=0.62 */
@@ -217,6 +254,7 @@ ACE_ATM_Stream::get_vpi_vci (ACE_UINT16 &vpi,
}
vpi = (ACE_UINT16) mypvcaddr.sap_addr.vpi;
vci = (ACE_UINT16) mypvcaddr.sap_addr.vci;
+
return 0;
#elif defined (SO_VCID) /* patch for atm version 0.59 */
struct atm_vcid mypvcid;
@@ -232,18 +270,22 @@ ACE_ATM_Stream::get_vpi_vci (ACE_UINT16 &vpi,
}
vpi = (ACE_UINT16) mypvcid.vpi;
vci = (ACE_UINT16) mypvcid.vci;
+
return 0;
#else
ACE_DEBUG (LM_DEBUG,
ACE_TEXT ("ACE_ATM_Stream::get_vpi_vci: Not implemented in this ATM version. Update to >= 0.62\n Or patch 0.59"));
ACE_UNUSED_ARG (vci);
ACE_UNUSED_ARG (vpi);
+
return (-1);
#endif /* SO_ATMPVC || SO_VCID */
#else
return (-1);
#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_ATM */
diff --git a/dep/ACE_wrappers/ace/ATM_Stream.h b/dep/ACE_wrappers/ace/ATM_Stream.h
index 5c68845d5c6..e880f7197d4 100644
--- a/dep/ACE_wrappers/ace/ATM_Stream.h
+++ b/dep/ACE_wrappers/ace/ATM_Stream.h
@@ -1,4 +1,5 @@
/* -*- C++ -*- */
+
//=============================================================================
/**
* @file ATM_Stream.h
@@ -9,16 +10,22 @@
*/
//=============================================================================
+
#ifndef ACE_ATM_STREAM_H
#define ACE_ATM_STREAM_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_ATM)
+
#include "ace/ATM_Addr.h"
#include "ace/ATM_Params.h"
+
#if defined (ACE_WIN32)
#include "ace/SOCK_Stream.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -30,7 +37,9 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
typedef ACE_TLI_Stream ATM_Stream;
ACE_END_VERSIONED_NAMESPACE_DECL
#endif
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_ATM_Stream
*
@@ -42,42 +51,57 @@ public:
// = Initialization and termination methods.
/// Default constructor.
ACE_ATM_Stream (void);
+
// = ATM-specific open and shutdown operations.
/// open the stream.
int open (ACE_ATM_Params params = ACE_ATM_Params());
+
/// Close down and release resources.
int close (void);
+
/// Get the underlying handle.
ACE_HANDLE get_handle (void) const;
+
/// Get the underlying stream.
ATM_Stream& get_stream (void);
+
/// Get the name of the connected host.
char* get_peer_name (void) const;
+
/// Get the VPI and VCI of the stream.
int get_vpi_vci (ACE_UINT16 &vpi,
ACE_UINT16 &vci) const;
+
/// Recv an n byte buffer from the connected transport mechanism.
ssize_t recv (void *buf,
size_t n,
int *flags = 0) const;
+
/// Send exactly n bytes to the connected transport mechanism.
ssize_t send_n (const void *buf,
size_t n,
int flags) const;
+
// = Meta-type info
typedef ACE_ATM_Addr PEER_ADDR;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Typedef'd to the appropriate stream mechanism above.
ATM_Stream stream_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/ATM_Stream.inl"
#endif /* __ACE_INLINE__ */
+
#endif /* ACE_HAS_ATM */
#include /**/ "ace/post.h"
#endif /* ACE_ATM_STREAM_H */
diff --git a/dep/ACE_wrappers/ace/ATM_Stream.inl b/dep/ACE_wrappers/ace/ATM_Stream.inl
index 8d00a413f05..087c1ed440b 100644
--- a/dep/ACE_wrappers/ace/ATM_Stream.inl
+++ b/dep/ACE_wrappers/ace/ATM_Stream.inl
@@ -1,7 +1,9 @@
// -*- C++ -*-
//
// $Id: ATM_Stream.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE void
ACE_ATM_Stream::dump (void) const
{
@@ -9,11 +11,13 @@ ACE_ATM_Stream::dump (void) const
ACE_TRACE ("ACE_ATM_Stream::dump");
#endif /* ACE_HAS_DUMP */
}
+
ACE_INLINE
ACE_ATM_Stream::ACE_ATM_Stream (void)
{
ACE_TRACE ("ACE_ATM_Stream::ACE_ATM_Stream");
}
+
ACE_INLINE
int
ACE_ATM_Stream::open (ACE_ATM_Params params)
@@ -26,6 +30,7 @@ ACE_ATM_Stream::open (ACE_ATM_Params params)
return (handle == ACE_INVALID_HANDLE ? -1 : 0);
#elif defined (ACE_HAS_FORE_ATM_WS2)
params.set_flags( ACE_FLAG_MULTIPOINT_C_ROOT | ACE_FLAG_MULTIPOINT_D_ROOT );
+
int retval = stream_.open (params.get_type(),
params.get_protocol_family(),
params.get_protocol(),
@@ -35,7 +40,9 @@ ACE_ATM_Stream::open (ACE_ATM_Params params)
params.get_reuse_addr());
if (retval == -1)
return -1;
+
struct sockaddr_atm sock_addr;
+
ACE_OS::memset(&sock_addr, 0, sizeof(struct sockaddr_atm));
sock_addr.satm_family = AF_ATM;
sock_addr.satm_number.AddressType=ADDR_ANY;
@@ -50,12 +57,14 @@ ACE_ATM_Stream::open (ACE_ATM_Params params)
ACE_OS::printf("Error binding local address: %d",WSAGetLastError());
return -1;
}
+
return 0;
#else
ACE_UNUSED_ARG(params);
return 0;
#endif /* ACE_HAS_FORE_ATM_XTI */
}
+
ACE_INLINE
int
ACE_ATM_Stream::close (void)
@@ -67,6 +76,7 @@ ACE_ATM_Stream::close (void)
return 0;
#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 */
}
+
ACE_INLINE
ATM_Stream&
ACE_ATM_Stream::get_stream (void)
@@ -74,6 +84,7 @@ ACE_ATM_Stream::get_stream (void)
ACE_TRACE ("ACE_ATM_Stream::get_stream");
return stream_;
}
+
ACE_INLINE
ssize_t
ACE_ATM_Stream::recv (void *buf,
@@ -95,6 +106,7 @@ ACE_ATM_Stream::recv (void *buf,
return (0);
#endif /* ACE_HAS_FORE_ATM_XTI */
}
+
ACE_INLINE
ssize_t
ACE_ATM_Stream::send_n (const void *buf,
@@ -117,4 +129,5 @@ ACE_ATM_Stream::send_n (const void *buf,
return (0);
#endif /* ACE_HAS_FORE_ATM_XTI */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Acceptor.h b/dep/ACE_wrappers/ace/Acceptor.h
index 4e3ad904517..855b2f877a3 100644
--- a/dep/ACE_wrappers/ace/Acceptor.h
+++ b/dep/ACE_wrappers/ace/Acceptor.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Acceptor.h
@@ -8,16 +9,23 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_ACCEPTOR_H
#define ACE_ACCEPTOR_H
+
#include /**/ "ace/pre.h"
+
#include "ace/Service_Object.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Strategies_T.h"
#include "ace/Synch_Options.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Acceptor
*
@@ -45,14 +53,17 @@ template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1>
class ACE_Acceptor : public ACE_Service_Object
{
public:
+
// Useful STL-style traits.
typedef ACE_PEER_ACCEPTOR_ADDR addr_type;
typedef ACE_PEER_ACCEPTOR acceptor_type;
typedef SVC_HANDLER handler_type;
typedef typename SVC_HANDLER::stream_type stream_type;
+
/// "Do-nothing" constructor.
ACE_Acceptor (ACE_Reactor * = 0,
int use_select = 1);
+
/**
* Open the contained @c PEER_ACCEPTOR object to begin listening, and
* register with the specified reactor for accept events. An
@@ -91,6 +102,7 @@ public:
int flags = 0,
int use_select = 1,
int reuse_addr = 1);
+
/**
* Open the contained @c PEER_ACCEPTOR object to begin listening, and
* register with the specified reactor for accept events. An
@@ -132,27 +144,37 @@ public:
int flags = 0,
int use_select = 1,
int reuse_addr = 1);
+
/// Close down the Acceptor's resources.
virtual ~ACE_Acceptor (void);
+
/// Return the underlying PEER_ACCEPTOR object.
virtual operator ACE_PEER_ACCEPTOR &() const;
+
/// Return the underlying PEER_ACCEPTOR object.
virtual ACE_PEER_ACCEPTOR &acceptor (void) const;
+
/// Returns the listening acceptor's {ACE_HANDLE}.
virtual ACE_HANDLE get_handle (void) const;
+
/// Close down the Acceptor
virtual int close (void);
+
/// In the event that an accept fails, this method will be called and
/// the return value will be returned from handle_input().
virtual int handle_accept_error (void);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
// = The following three methods define the Acceptor's strategies
// for creating, accepting, and activating SVC_HANDLER's,
// respectively.
+
/**
* Bridge method for creating a SVC_HANDLER. The default is to
* create a new {SVC_HANDLER} if {sh} == 0, else {sh} is unchanged.
@@ -162,12 +184,14 @@ protected:
* linking the handler, etc.). Returns -1 on failure, else 0.
*/
virtual int make_svc_handler (SVC_HANDLER *&sh);
+
/**
* Bridge method for accepting the new connection into the
* <svc_handler>. The default behavior delegates to the
* PEER_ACCEPTOR::accept.
*/
virtual int accept_svc_handler (SVC_HANDLER *svc_handler);
+
/**
* Bridge method for activating a {svc_handler} with the appropriate
* concurrency strategy. The default behavior of this method is to
@@ -179,33 +203,43 @@ protected:
* multi-processing).
*/
virtual int activate_svc_handler (SVC_HANDLER *svc_handler);
+
// = Demultiplexing hooks.
/// Perform termination activities when {this} is removed from the
/// {reactor}.
virtual int handle_close (ACE_HANDLE = ACE_INVALID_HANDLE,
ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK);
+
/// Accepts all pending connections from clients, and creates and
/// activates SVC_HANDLERs.
virtual int handle_input (ACE_HANDLE);
+
// = Dynamic linking hooks.
/// Default version does no work and returns -1. Must be overloaded
/// by application developer to do anything meaningful.
virtual int init (int argc, ACE_TCHAR *argv[]);
+
/// Calls {handle_close}.
virtual int fini (void);
+
/// Default version returns address info in {buf}.
virtual int info (ACE_TCHAR **buf, size_t) const;
+
public:
// = Service management hooks.
/// This method calls {Reactor::suspend}.
virtual int suspend (void);
+
/// This method calls {Reactor::resume}.
virtual int resume (void);
+
protected:
/// Concrete factory for accepting connections from clients...
ACE_PEER_ACCEPTOR peer_acceptor_;
+
/// Needed to reopen the socket if {accept} fails.
ACE_PEER_ACCEPTOR_ADDR peer_acceptor_addr_;
+
/**
* Flags that indicate how {SVC_HANDLER}'s should be initialized
* prior to being activated. Right now, the only flag that is
@@ -213,12 +247,15 @@ protected:
* the {SVC_HANDLER} when it is opened.
*/
int flags_;
+
/// Flag that indicates whether it shall use {select} in the
/// {accept}-loop.
int use_select_;
+
/// Needed to reopen the socket if {accept} fails.
int reuse_addr_;
};
+
/**
* @class ACE_Strategy_Acceptor
*
@@ -238,6 +275,7 @@ class ACE_Strategy_Acceptor
: public ACE_Acceptor <SVC_HANDLER, ACE_PEER_ACCEPTOR_2>
{
public:
+
// Useful STL-style traits.
typedef ACE_Creation_Strategy<SVC_HANDLER>
creation_strategy_type;
@@ -248,17 +286,21 @@ public:
typedef ACE_Scheduling_Strategy<SVC_HANDLER> scheduling_strategy_type;
typedef ACE_Acceptor <SVC_HANDLER, ACE_PEER_ACCEPTOR_2>
base_type;
+
// = Define some useful (old style) traits.
typedef ACE_Creation_Strategy<SVC_HANDLER> CREATION_STRATEGY;
typedef ACE_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2> ACCEPT_STRATEGY;
typedef ACE_Concurrency_Strategy<SVC_HANDLER> CONCURRENCY_STRATEGY;
typedef ACE_Scheduling_Strategy<SVC_HANDLER> SCHEDULING_STRATEGY;
+
+
/// Default constructor.
ACE_Strategy_Acceptor (const ACE_TCHAR service_name[] = 0,
const ACE_TCHAR service_description[] = 0,
int use_select = 1,
int reuse_addr = 1);
+
/**
* Initialize the appropriate strategies for creation, passive
* connection acceptance, and concurrency, and then register {this}
@@ -275,6 +317,7 @@ public:
const ACE_TCHAR service_description[] = 0,
int use_select = 1,
int reuse_addr = 1);
+
/**
* Open the contained @c PEER_ACCEPTOR object to begin listening, and
* register with the specified reactor for accept events.
@@ -314,6 +357,7 @@ public:
int flags = 0,
int use_select = 1,
int reuse_addr = 1);
+
/**
* Initialize the appropriate strategies for creation, passive
* connection acceptance, and concurrency, and then register {this}
@@ -330,33 +374,47 @@ public:
const ACE_TCHAR *service_description = 0,
int use_select = 1,
int reuse_addr = 1);
+
/// Close down the Strategy_Acceptor's resources.
virtual ~ACE_Strategy_Acceptor (void);
+
/// Return the underlying PEER_ACCEPTOR object.
virtual operator ACE_PEER_ACCEPTOR &() const;
+
/// Return the underlying PEER_ACCEPTOR object.
virtual ACE_PEER_ACCEPTOR &acceptor (void) const;
+
/// Returns the listening acceptor's {ACE_HANDLE}.
virtual ACE_HANDLE get_handle (void) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
// = Service management hooks.
+
/// This method delegates to the {Scheduling_Strategy}'s {suspend}
/// method.
virtual int suspend (void);
+
/// This method delegates to the {Scheduling_Strategy}'s {resume}
/// method.
virtual int resume (void);
+
protected:
+
/// Calls {handle_close} when dynamically unlinked.
virtual int fini (void);
+
/// Default version returns address info in {buf}.
virtual int info (ACE_TCHAR **buf, size_t) const;
+
// = The following three methods define the {Acceptor}'s strategies
// for creating, accepting, and activating {SVC_HANDLER}'s,
// respectively.
+
/**
* Bridge method for creating a {SVC_HANDLER}. The strategy for
* creating a {SVC_HANDLER} are configured into the Acceptor via
@@ -368,12 +426,14 @@ protected:
* linking the handler, etc.). Returns -1 on failure, else 0.
*/
virtual int make_svc_handler (SVC_HANDLER *&);
+
/**
* Bridge method for accepting the new connection into the
* {SVC_HANDLER}. The default behavior delegates to the
* {PEER_ACCEPTOR::accept} in the {Acceptor_Strategy}.
*/
virtual int accept_svc_handler (SVC_HANDLER *svc_handler);
+
/**
* Bridge method for activating a {SVC_HANDLER} with the appropriate
* concurrency strategy. The default behavior of this method is to
@@ -385,45 +445,62 @@ protected:
* multi-processing).
*/
virtual int activate_svc_handler (SVC_HANDLER *svc_handler);
+
// = Demultiplexing hooks.
/// Perform termination activities when {this} is removed from the
/// {Reactor}.
virtual int handle_close (ACE_HANDLE = ACE_INVALID_HANDLE,
ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK);
+
/// Handle SIGINT.
virtual int handle_signal (int signum, siginfo_t *, ucontext_t *);
+
// = These data members are "logically private" but are put in the
// protected part in case subclasses want to access them.
+
// = Strategy objects.
+
/// Creation strategy for an Acceptor.
CREATION_STRATEGY *creation_strategy_;
+
/// true if {Acceptor} created the creation strategy and thus should
/// delete it, else false.
bool delete_creation_strategy_;
+
/// Accept strategy for an {Acceptor}.
ACCEPT_STRATEGY *accept_strategy_;
+
/// true if {Acceptor} created the accept strategy and thus should delete
/// it, else false.
bool delete_accept_strategy_;
+
/// Concurrency strategy for an {Acceptor}.
CONCURRENCY_STRATEGY *concurrency_strategy_;
+
/// true if {Acceptor} created the concurrency strategy and thus should
/// delete it, else false.
bool delete_concurrency_strategy_;
+
/// Scheduling strategy for an {Acceptor}.
SCHEDULING_STRATEGY *scheduling_strategy_;
+
/// true if {Acceptor} created the scheduling strategy and thus should
/// delete it, else false.
bool delete_scheduling_strategy_;
+
// = Service information objects.
+
/// Name of the service.
ACE_TCHAR *service_name_;
+
/// Description of the service.
ACE_TCHAR *service_description_;
+
/// Address that the {Strategy_Acceptor} uses to listen for
/// connections.
ACE_PEER_ACCEPTOR_ADDR service_addr_;
};
+
/**
* @class ACE_Oneshot_Acceptor
*
@@ -448,13 +525,16 @@ template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1>
class ACE_Oneshot_Acceptor : public ACE_Service_Object
{
public:
+
// Useful STL-style traits.
typedef ACE_PEER_ACCEPTOR_ADDR addr_type;
typedef ACE_PEER_ACCEPTOR acceptor_type;
typedef SVC_HANDLER handler_type;
typedef typename SVC_HANDLER::stream_type stream_type;
+
/// Constructor.
ACE_Oneshot_Acceptor (void);
+
/**
* Initialize the appropriate strategies for concurrency and then
* open the {peer_acceptor} at the designated {local_addr}. Note
@@ -466,6 +546,7 @@ public:
ACE_Oneshot_Acceptor (const ACE_PEER_ACCEPTOR_ADDR &local_addr,
ACE_Reactor *reactor = ACE_Reactor::instance (),
ACE_Concurrency_Strategy<SVC_HANDLER> * = 0);
+
/**
* Initialize the appropriate strategies for concurrency and then
* open the {peer_acceptor} at the designated {local_addr}. Note
@@ -477,8 +558,10 @@ public:
int open (const ACE_PEER_ACCEPTOR_ADDR &,
ACE_Reactor *reactor = ACE_Reactor::instance (),
ACE_Concurrency_Strategy<SVC_HANDLER> * = 0);
+
/// Close down the {Oneshot_Acceptor}.
virtual ~ACE_Oneshot_Acceptor (void);
+
// = Explicit factory operation.
/// Create a {SVC_HANDLER}, accept the connection into the
/// {SVC_HANDLER}, and activate the {SVC_HANDLER}.
@@ -487,18 +570,25 @@ public:
const ACE_Synch_Options &synch_options = ACE_Synch_Options::defaults,
int restart = 1,
int reset_new_handle = 0);
+
/// Cancel a oneshot acceptor that was started asynchronously.
virtual int cancel (void);
+
/// Return the underlying {PEER_ACCEPTOR} object.
virtual operator ACE_PEER_ACCEPTOR &() const;
+
/// Return the underlying {PEER_ACCEPTOR} object.
virtual ACE_PEER_ACCEPTOR &acceptor (void) const;
+
/// Close down the {Oneshot_Acceptor}.
virtual int close (void);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
/**
* Bridge method for activating a {svc_handler} with the appropriate
@@ -509,6 +599,7 @@ protected:
* object" via multi-threading or multi-processing).
*/
virtual int activate_svc_handler (SVC_HANDLER *svc_handler);
+
/// Factors out the code shared between the {accept} and
/// {handle_input} methods.
int shared_accept (SVC_HANDLER *svc_handler,
@@ -516,35 +607,45 @@ protected:
ACE_Time_Value *timeout,
int restart,
int reset_new_handle);
+
// = Demultiplexing hooks.
/// Returns the listening acceptor's {ACE_HANDLE}.
virtual ACE_HANDLE get_handle (void) const;
+
/// Perform termination activities when {this} is removed from the
/// {reactor}.
virtual int handle_close (ACE_HANDLE = ACE_INVALID_HANDLE,
ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK);
+
/// Accept one connection from a client and activates the
/// SVC_HANDLER.
virtual int handle_input (ACE_HANDLE);
+
/// Called when an acceptor times out...
virtual int handle_timeout (const ACE_Time_Value &tv,
const void *arg);
+
// = Dynamic linking hooks.
/// Default version does no work and returns -1. Must be overloaded
/// by application developer to do anything meaningful.
virtual int init (int argc, ACE_TCHAR *argv[]);
+
/// Default version does no work and returns -1. Must be overloaded
/// by application developer to do anything meaningful.
virtual int fini (void);
+
/// Default version returns address info in {buf}.
virtual int info (ACE_TCHAR **, size_t) const;
+
// = Service management hooks.
/// Default version does no work and returns -1. Must be overloaded
/// by application developer to do anything meaningful.
virtual int suspend (void);
+
/// Default version does no work and returns -1. Must be overloaded
/// by application developer to do anything meaningful.
virtual int resume (void);
+
private:
/**
* Insert ourselves into the {ACE_Reactor} so that we can continue
@@ -554,25 +655,35 @@ private:
int register_handler (SVC_HANDLER *svc_handler,
const ACE_Synch_Options &options,
int restart);
+
/// Hold the svc_handler_ across asynchrony boundaries.
SVC_HANDLER *svc_handler_;
+
/// Hold the restart flag across asynchrony boundaries.
int restart_;
+
/// Factory that establishes connections passively.
ACE_PEER_ACCEPTOR peer_acceptor_;
+
/// Concurrency strategy for an Acceptor.
ACE_Concurrency_Strategy<SVC_HANDLER> *concurrency_strategy_;
+
/// true if Acceptor created the concurrency strategy and thus should
/// delete it, else false.
bool delete_concurrency_strategy_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Acceptor.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Acceptor.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_ACCEPTOR_H */
diff --git a/dep/ACE_wrappers/ace/Activation_Queue.cpp b/dep/ACE_wrappers/ace/Activation_Queue.cpp
index f7596987d16..9701af2e236 100644
--- a/dep/ACE_wrappers/ace/Activation_Queue.cpp
+++ b/dep/ACE_wrappers/ace/Activation_Queue.cpp
@@ -1,15 +1,20 @@
#include "ace/Activation_Queue.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Activation_Queue.inl"
#endif /* __ACE_INLINE__ */
+
#include "ace/Log_Msg.h"
#include "ace/Method_Request.h"
#include "ace/Malloc_Base.h"
#include "ace/Time_Value.h"
+
ACE_RCSID (ace,
Activation_Queue,
"$Id: Activation_Queue.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
void
ACE_Activation_Queue::dump (void) const
{
@@ -25,9 +30,11 @@ ACE_Activation_Queue::dump (void) const
//FUZZ: disable check_for_NULL
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(NULL)\n")));
//FUZZ: enable check_for_NULL
+
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
ACE_Activation_Queue::ACE_Activation_Queue (ACE_Message_Queue<ACE_SYNCH> *new_queue,
ACE_Allocator *alloc,
ACE_Allocator *db_alloc)
@@ -37,6 +44,7 @@ ACE_Activation_Queue::ACE_Activation_Queue (ACE_Message_Queue<ACE_SYNCH> *new_qu
{
if (this->allocator_ == 0)
this->allocator_ = ACE_Allocator::instance ();
+
if (new_queue)
this->queue_ = new_queue;
else
@@ -46,6 +54,7 @@ ACE_Activation_Queue::ACE_Activation_Queue (ACE_Message_Queue<ACE_SYNCH> *new_qu
this->delete_queue_ = true;
}
}
+
void
ACE_Activation_Queue::queue (ACE_Message_Queue<ACE_SYNCH> *q)
{
@@ -54,6 +63,7 @@ ACE_Activation_Queue::queue (ACE_Message_Queue<ACE_SYNCH> *q)
{
// Destroy the current queue.
delete this->queue_;
+
// Set the flag to false. NOTE that the delete_queue_ flag is a
// flag used to only indicate whether or not if an internal
// ACE_Message_Queue has been created, therefore, it will not
@@ -62,17 +72,21 @@ ACE_Activation_Queue::queue (ACE_Message_Queue<ACE_SYNCH> *q)
// function.
this->delete_queue_ = false;
}
+
queue_ = q;
}
+
ACE_Activation_Queue::~ACE_Activation_Queue (void)
{
if (this->delete_queue_)
delete this->queue_;
}
+
ACE_Method_Request *
ACE_Activation_Queue::dequeue (ACE_Time_Value *tv)
{
ACE_Message_Block *mb = 0;
+
// Dequeue the message.
if (this->queue_->dequeue_head (mb, tv) != -1)
{
@@ -86,11 +100,13 @@ ACE_Activation_Queue::dequeue (ACE_Time_Value *tv)
else
return 0;
}
+
int
ACE_Activation_Queue::enqueue (ACE_Method_Request *mr,
ACE_Time_Value *tv)
{
ACE_Message_Block *mb = 0;
+
// We pass sizeof (*mr) here so that flow control will work
// correctly. Since we also pass <mr> note that no unnecessary
// memory is actually allocated -- just the size field is set.
@@ -108,12 +124,16 @@ ACE_Activation_Queue::enqueue (ACE_Method_Request *mr,
this->data_block_allocator_, // data_block allocator
this->allocator_), // message_block allocator
-1);
+
// Enqueue in priority order.
int const result = this->queue_->enqueue_prio (mb, tv);
+
// Free ACE_Message_Block if enqueue_prio failed.
if (result == -1)
ACE_DES_FREE (mb, this->allocator_->free, ACE_Message_Block);
+
return result;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Activation_Queue.h b/dep/ACE_wrappers/ace/Activation_Queue.h
index cd250bd556f..69197c1b72d 100644
--- a/dep/ACE_wrappers/ace/Activation_Queue.h
+++ b/dep/ACE_wrappers/ace/Activation_Queue.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Activation_Queue.h
@@ -9,19 +10,28 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_ACTIVATION_QUEUE_H
#define ACE_ACTIVATION_QUEUE_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Message_Queue.h"
#include "ace/Condition_Thread_Mutex.h"
+
/// Define to be compatible with the terminology in the POSA2 book!
#define ACE_Activation_List ACE_Activation_Queue
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Method_Request;
+
/**
* @class ACE_Activation_Queue
*
@@ -66,9 +76,12 @@ public:
ACE_Activation_Queue (ACE_Message_Queue<ACE_SYNCH> *new_queue = 0,
ACE_Allocator *alloc = 0,
ACE_Allocator *db_alloc = 0);
+
/// Destructor.
virtual ~ACE_Activation_Queue (void);
+
// = Activate Queue operations.
+
/// Dequeue the next available ACE_Method_Request.
/**
* @param tv If 0, the method will block until a method request is
@@ -82,6 +95,7 @@ public:
* the specified timeout elapses, errno will be @c EWOULDBLOCK.
*/
ACE_Method_Request *dequeue (ACE_Time_Value *tv = 0);
+
/// Enqueue the ACE_Method_Request in priority order.
/**
* The priority of the method request is obtained via the @c priority()
@@ -103,39 +117,58 @@ public:
* the specified timeout elapses, errno will be @c EWOULDBLOCK.
*/
int enqueue (ACE_Method_Request *new_method_request, ACE_Time_Value *tv = 0);
+
/// Get the current number of method objects in the queue.
size_t method_count (void) const;
+
/// Returns 1 if the queue is empty, 0 otherwise.
int is_empty (void) const;
+
/// Returns 1 if the queue is full, 0 otherwise.
int is_full (void) const;
+
/// Dump the state of an request.
void dump (void) const;
+
/// Get a pointer to the underlying queue.
ACE_Message_Queue<ACE_SYNCH> *queue (void) const;
+
/// Set the pointer to the underlying queue.
void queue (ACE_Message_Queue<ACE_SYNCH> *q);
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
+
// = Prevent copying and assignment.
ACE_Activation_Queue (const ACE_Activation_Queue &);
void operator= (const ACE_Activation_Queue &);
+
protected:
+
/// Stores the Method_Requests.
ACE_Message_Queue<ACE_SYNCH> *queue_;
+
/// Keeps track of whether we need to delete the queue.
bool delete_queue_;
+
private:
+
/// Allocation strategy of the queue.
ACE_Allocator *allocator_;
+
/// Allocation strategy of the message blocks.
ACE_Allocator *data_block_allocator_;
+
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Activation_Queue.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_ACTIVATION_QUEUE_H */
diff --git a/dep/ACE_wrappers/ace/Activation_Queue.inl b/dep/ACE_wrappers/ace/Activation_Queue.inl
index 1fcaf0bfce2..4c0ffc049d3 100644
--- a/dep/ACE_wrappers/ace/Activation_Queue.inl
+++ b/dep/ACE_wrappers/ace/Activation_Queue.inl
@@ -1,25 +1,31 @@
// -*- C++ -*-
//
// $Id: Activation_Queue.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE size_t
ACE_Activation_Queue::method_count (void) const
{
return queue_->message_count ();
}
+
ACE_INLINE int
ACE_Activation_Queue::is_full (void) const
{
return queue_->is_full ();
}
+
ACE_INLINE int
ACE_Activation_Queue::is_empty (void) const
{
return queue_->is_empty ();
}
+
ACE_INLINE ACE_Message_Queue<ACE_SYNCH> *
ACE_Activation_Queue::queue (void) const
{
return queue_;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Active_Map_Manager.cpp b/dep/ACE_wrappers/ace/Active_Map_Manager.cpp
index 3ebe4c7c87c..0f3d5485cde 100644
--- a/dep/ACE_wrappers/ace/Active_Map_Manager.cpp
+++ b/dep/ACE_wrappers/ace/Active_Map_Manager.cpp
@@ -1,6 +1,9 @@
// $Id: Active_Map_Manager.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Active_Map_Manager.h"
+
ACE_RCSID(ace, Active_Map_Manager, "$Id: Active_Map_Manager.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if !defined (__ACE_INLINE__)
#include "ace/Active_Map_Manager.inl"
#endif /* __ACE_INLINE__ */
diff --git a/dep/ACE_wrappers/ace/Active_Map_Manager.h b/dep/ACE_wrappers/ace/Active_Map_Manager.h
index 1ad95757379..174009910a6 100644
--- a/dep/ACE_wrappers/ace/Active_Map_Manager.h
+++ b/dep/ACE_wrappers/ace/Active_Map_Manager.h
@@ -1,4 +1,5 @@
/* -*- C++ -*- */
+
//=============================================================================
/**
* @file Active_Map_Manager.h
@@ -9,15 +10,21 @@
*/
//=============================================================================
+
#ifndef ACE_ACTIVE_MAP_MANAGER_H
#define ACE_ACTIVE_MAP_MANAGER_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Basic_Types.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Active_Map_Manager_Key
*
@@ -32,6 +39,7 @@ class ACE_Export ACE_Active_Map_Manager_Key
public:
/// Default constructor.
ACE_Active_Map_Manager_Key (void);
+
/**
* Constructor given the @a slot_index and @a slot_generation number.
* This is useful once the user has somehow recovered the
@@ -39,30 +47,42 @@ public:
*/
ACE_Active_Map_Manager_Key (ACE_UINT32 slot_index,
ACE_UINT32 slot_generation);
+
/// Get the slot_index.
ACE_UINT32 slot_index (void) const;
+
/// Set the slot_index.
void slot_index (ACE_UINT32 i);
+
/// Get the slot_generation number.
ACE_UINT32 slot_generation (void) const;
+
/// Set the slot_generation number.
void slot_generation (ACE_UINT32 g);
+
/// Size required to store information about active key.
static size_t size (void);
+
/// Recover state of active key from @a data. User must make sure
/// that @a data encoded using the encode() method.
void decode (const void *data);
+
/// Encode state of the active key into @a data. @a data must be as
/// big as the value returned from <size>.
void encode (void *data) const;
+
/// Compare keys.
bool operator== (const ACE_Active_Map_Manager_Key &rhs) const;
bool operator!= (const ACE_Active_Map_Manager_Key &rhs) const;
+
// = This really should be protected but because of template
// friends, they are not.
+
/// Increment the <slot_generation> number.
void increment_slot_generation_count (void);
+
private:
+
/**
* @brief Data for the Active Object Map Key.
*
@@ -74,18 +94,24 @@ private:
{
/// Slot index in the active map.
ACE_UINT32 slot_index_;
+
/// Slot generation number of <slot_index_> slot in the active map.
ACE_UINT32 slot_generation_;
};
+
/// Data for the Active Object Map Key.
key_data key_data_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Active_Map_Manager.inl"
#endif /* __ACE_INLINE__ */
+
// Include the templates here.
#include "ace/Active_Map_Manager_T.h"
+
#include /**/ "ace/post.h"
#endif /* ACE_ACTIVE_MAP_MANAGER_H */
diff --git a/dep/ACE_wrappers/ace/Active_Map_Manager.inl b/dep/ACE_wrappers/ace/Active_Map_Manager.inl
index 522dada40ff..df90ada6a00 100644
--- a/dep/ACE_wrappers/ace/Active_Map_Manager.inl
+++ b/dep/ACE_wrappers/ace/Active_Map_Manager.inl
@@ -1,8 +1,11 @@
// -*- C++ -*-
//
// $Id: Active_Map_Manager.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_string.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_Active_Map_Manager_Key::ACE_Active_Map_Manager_Key (void)
{
@@ -11,6 +14,7 @@ ACE_Active_Map_Manager_Key::ACE_Active_Map_Manager_Key (void)
this->key_data_.slot_index_ = (ACE_UINT32) ~0;
this->key_data_.slot_generation_ = 0;
}
+
ACE_INLINE
ACE_Active_Map_Manager_Key::ACE_Active_Map_Manager_Key (ACE_UINT32 slot_index,
ACE_UINT32 slot_generation)
@@ -18,16 +22,19 @@ ACE_Active_Map_Manager_Key::ACE_Active_Map_Manager_Key (ACE_UINT32 slot_index,
this->key_data_.slot_index_ = slot_index;
this->key_data_.slot_generation_ = slot_generation;
}
+
ACE_INLINE ACE_UINT32
ACE_Active_Map_Manager_Key::slot_index (void) const
{
return this->key_data_.slot_index_;
}
+
ACE_INLINE ACE_UINT32
ACE_Active_Map_Manager_Key::slot_generation (void) const
{
return this->key_data_.slot_generation_;
}
+
ACE_INLINE bool
ACE_Active_Map_Manager_Key::operator== (const ACE_Active_Map_Manager_Key &rhs) const
{
@@ -35,32 +42,38 @@ ACE_Active_Map_Manager_Key::operator== (const ACE_Active_Map_Manager_Key &rhs) c
this->key_data_.slot_index_ == rhs.key_data_.slot_index_ &&
this->key_data_.slot_generation_ == rhs.key_data_.slot_generation_;
}
+
ACE_INLINE bool
ACE_Active_Map_Manager_Key::operator!= (const ACE_Active_Map_Manager_Key &rhs) const
{
return !this->operator== (rhs);
}
+
ACE_INLINE void
ACE_Active_Map_Manager_Key::slot_index (ACE_UINT32 i)
{
this->key_data_.slot_index_ = i;
}
+
ACE_INLINE void
ACE_Active_Map_Manager_Key::slot_generation (ACE_UINT32 g)
{
this->key_data_.slot_generation_ = g;
}
+
ACE_INLINE void
ACE_Active_Map_Manager_Key::increment_slot_generation_count (void)
{
++this->key_data_.slot_generation_;
}
+
/* static */
ACE_INLINE size_t
ACE_Active_Map_Manager_Key::size (void)
{
return sizeof (ACE_UINT32) + sizeof (ACE_UINT32);
}
+
ACE_INLINE void
ACE_Active_Map_Manager_Key::decode (const void *data)
{
@@ -69,6 +82,7 @@ ACE_Active_Map_Manager_Key::decode (const void *data)
data,
sizeof this->key_data_);
}
+
ACE_INLINE void
ACE_Active_Map_Manager_Key::encode (void *data) const
{
@@ -77,4 +91,5 @@ ACE_Active_Map_Manager_Key::encode (void *data) const
&this->key_data_,
sizeof this->key_data_);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Active_Map_Manager_T.h b/dep/ACE_wrappers/ace/Active_Map_Manager_T.h
index 9e109f85deb..7930628dc94 100644
--- a/dep/ACE_wrappers/ace/Active_Map_Manager_T.h
+++ b/dep/ACE_wrappers/ace/Active_Map_Manager_T.h
@@ -1,4 +1,5 @@
/* -*- C++ -*- */
+
//=============================================================================
/**
* @file Active_Map_Manager_T.h
@@ -9,16 +10,22 @@
*/
//=============================================================================
+
#ifndef ACE_ACTIVE_MAP_MANAGER_T_H
#define ACE_ACTIVE_MAP_MANAGER_T_H
#include /**/ "ace/pre.h"
+
#include "ace/Map_Manager.h"
#include "ace/Active_Map_Manager.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Null_Mutex.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Active_Map_Manager
*
@@ -32,37 +39,48 @@ template <class T>
class ACE_Active_Map_Manager : public ACE_Map_Manager<ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex>
{
public:
+
// = Traits.
typedef ACE_Active_Map_Manager_Key key_type;
typedef T mapped_type;
+
typedef ACE_Map_Entry<ACE_Active_Map_Manager_Key, T> ENTRY;
typedef ACE_Map_Iterator<ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex> ITERATOR;
typedef ACE_Map_Reverse_Iterator<ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex> REVERSE_ITERATOR;
+
typedef ENTRY entry;
typedef ITERATOR iterator;
typedef REVERSE_ITERATOR reverse_iterator;
+
// = Initialization and termination methods.
/// Initialize a <Active_Map_Manager> with the ACE_DEFAULT_MAP_SIZE.
ACE_Active_Map_Manager (ACE_Allocator *alloc = 0);
+
/// Initialize a <Active_Map_Manager> with @a size entries.
ACE_Active_Map_Manager (size_t size,
ACE_Allocator *alloc = 0);
+
/// Close down a <Active_Map_Manager> and release dynamically
/// allocated resources.
~ACE_Active_Map_Manager (void);
+
/// Initialize a <Active_Map_Manager> with size @a length.
int open (size_t length = ACE_DEFAULT_MAP_SIZE,
ACE_Allocator *alloc = 0);
+
/// Close down a <Active_Map_Manager> and release dynamically
/// allocated resources.
int close (void);
+
/// Add @a value to the map, and the corresponding key produced by the
/// Active_Map_Manager is returned through @a key.
int bind (const T &value,
ACE_Active_Map_Manager_Key &key);
+
/// Add @a value to the map. The user does not care about the
/// corresponding key produced by the Active_Map_Manager.
int bind (const T &value);
+
/**
* Reserves a slot in the internal structure and returns the key and
* a pointer to the value. User should place their @a value into
@@ -74,10 +92,12 @@ public:
*/
int bind (ACE_Active_Map_Manager_Key &key,
T *&internal_value);
+
/// Reassociate @a key with @a value. The function fails if @a key is
/// not in the map.
int rebind (const ACE_Active_Map_Manager_Key &key,
const T &value);
+
/**
* Reassociate @a key with @a value, storing the old value into the
* "out" parameter @a old_value. The function fails if @a key is not
@@ -86,6 +106,7 @@ public:
int rebind (const ACE_Active_Map_Manager_Key &key,
const T &value,
T &old_value);
+
/**
* Reassociate @a key with @a value, storing the old key and value
* into the "out" parameter @a old_key and @a old_value. The function
@@ -95,11 +116,14 @@ public:
const T &value,
ACE_Active_Map_Manager_Key &old_key,
T &old_value);
+
/// Locate @a value associated with @a key.
int find (const ACE_Active_Map_Manager_Key &key,
T &value) const;
+
/// Is @a key in the map?
int find (const ACE_Active_Map_Manager_Key &key) const;
+
/**
* Locate @a value associated with @a key. The value is returned via
* <internal_value> and hence a copy is saved. Note that
@@ -109,15 +133,19 @@ public:
*/
int find (const ACE_Active_Map_Manager_Key &key,
T *&internal_value) const;
+
// Creates a key. User should place their @a value into
// <*internal_value>. This method is useful in reducing the number
// of copies required in some cases.
+
/// Remove @a key from the map.
int unbind (const ACE_Active_Map_Manager_Key &key);
+
/// Remove @a key from the map, and return the @a value associated with
/// @a key.
int unbind (const ACE_Active_Map_Manager_Key &key,
T &value);
+
/**
* Locate @a value associated with @a key. The value is returned via
* <internal_value> and hence a copy is saved. Note that
@@ -127,41 +155,58 @@ public:
*/
int unbind (const ACE_Active_Map_Manager_Key &key,
T *&internal_value);
+
/// Return the current size of the map.
size_t current_size (void) const;
+
/// Return the total size of the map.
size_t total_size (void) const;
+
/// Returns a key that cannot be found in the map.
static const ACE_Active_Map_Manager_Key npos (void);
+
/// Dump the state of an object.
void dump (void) const;
+
// = STL styled iterator factory functions.
+
/// Return forward iterator.
ACE_Map_Iterator<ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex> begin (void);
ACE_Map_Iterator<ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex> end (void);
+
/// Return reverse iterator.
ACE_Map_Reverse_Iterator<ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex> rbegin (void);
ACE_Map_Reverse_Iterator<ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex> rend (void);
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
+
/// Private base class
typedef ACE_Map_Manager<ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex> ACE_AMM_BASE;
+
private:
+
// = Disallow these operations.
ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Active_Map_Manager<T> &))
ACE_UNIMPLEMENTED_FUNC (ACE_Active_Map_Manager (const ACE_Active_Map_Manager<T> &))
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Active_Map_Manager_T.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Active_Map_Manager_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Active_Map_Manager_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
#endif /* ACE_ACTIVE_MAP_MANAGER_T_H */
diff --git a/dep/ACE_wrappers/ace/Active_Map_Manager_T.inl b/dep/ACE_wrappers/ace/Active_Map_Manager_T.inl
index b5731b5ef66..647b55ebd56 100644
--- a/dep/ACE_wrappers/ace/Active_Map_Manager_T.inl
+++ b/dep/ACE_wrappers/ace/Active_Map_Manager_T.inl
@@ -1,29 +1,38 @@
// -*- C++ -*-
//
// $Id: Active_Map_Manager_T.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template <class T> ACE_INLINE int
ACE_Active_Map_Manager<T>::bind (ACE_Active_Map_Manager_Key &key,
T *&internal_value)
{
ACE_UINT32 slot_index;
int result = this->next_free (slot_index);
+
if (result == 0)
{
// Move from free list to occupied list
this->move_from_free_list_to_occupied_list (slot_index);
+
// Reset the key.
this->search_structure_[slot_index].ext_id_.increment_slot_generation_count ();
this->search_structure_[slot_index].ext_id_.slot_index (slot_index);
+
// Copy the key for the user.
key = this->search_structure_[slot_index].ext_id_;
+
// This is where the user should place the value.
internal_value = &this->search_structure_[slot_index].int_id_;
+
// Update the current size.
++this->cur_size_;
}
+
return result;
}
+
template <class T> ACE_INLINE int
ACE_Active_Map_Manager<T>::bind (const T &value,
ACE_Active_Map_Manager_Key &key)
@@ -31,25 +40,30 @@ ACE_Active_Map_Manager<T>::bind (const T &value,
T *internal_value = 0;
int result = this->bind (key,
internal_value);
+
if (result == 0)
{
// Store new value.
*internal_value = value;
}
+
return result;
}
+
template <class T> ACE_INLINE int
ACE_Active_Map_Manager<T>::bind (const T &value)
{
ACE_Active_Map_Manager_Key key;
return this->bind (value, key);
}
+
template <class T> ACE_INLINE int
ACE_Active_Map_Manager<T>::find (const ACE_Active_Map_Manager_Key &key,
T *&internal_value) const
{
ACE_UINT32 slot_index = key.slot_index ();
ACE_UINT32 slot_generation = key.slot_generation ();
+
if (slot_index > this->total_size_ ||
#if defined (ACE_HAS_LAZY_MAP_MANAGER)
this->search_structure_[slot_index].free_ ||
@@ -65,8 +79,10 @@ ACE_Active_Map_Manager<T>::find (const ACE_Active_Map_Manager_Key &key,
// This is where the user value is.
internal_value = &this->search_structure_[slot_index].int_id_;
}
+
return 0;
}
+
template <class T> ACE_INLINE int
ACE_Active_Map_Manager<T>::find (const ACE_Active_Map_Manager_Key &key) const
{
@@ -74,6 +90,7 @@ ACE_Active_Map_Manager<T>::find (const ACE_Active_Map_Manager_Key &key) const
return this->find (key,
internal_value);
}
+
template <class T> ACE_INLINE int
ACE_Active_Map_Manager<T>::find (const ACE_Active_Map_Manager_Key &key,
T &value) const
@@ -81,37 +98,47 @@ ACE_Active_Map_Manager<T>::find (const ACE_Active_Map_Manager_Key &key,
T *internal_value = 0;
int result = this->find (key,
internal_value);
+
if (result == 0)
value = *internal_value;
+
return result;
}
+
template <class T> ACE_INLINE int
ACE_Active_Map_Manager<T>::rebind (const ACE_Active_Map_Manager_Key &key,
const T &value)
{
int result = this->find (key);
+
if (result == 0)
{
// Store new value.
this->search_structure_[key.slot_index ()].int_id_ = value;
}
+
return result;
}
+
template <class T> ACE_INLINE int
ACE_Active_Map_Manager<T>::rebind (const ACE_Active_Map_Manager_Key &key,
const T &value,
T &old_value)
{
int result = this->find (key);
+
if (result == 0)
{
// Copy old value.
old_value = this->search_structure_[key.slot_index ()].int_id_;
+
// Store new value.
this->search_structure_[key.slot_index ()].int_id_ = value;
}
+
return result;
}
+
template <class T> ACE_INLINE int
ACE_Active_Map_Manager<T>::rebind (const ACE_Active_Map_Manager_Key &key,
const T &value,
@@ -119,44 +146,60 @@ ACE_Active_Map_Manager<T>::rebind (const ACE_Active_Map_Manager_Key &key,
T &old_value)
{
int result = this->find (key);
+
if (result == 0)
{
// Copy old key.
old_key = this->search_structure_[key.slot_index ()].ext_id_;
+
// Copy old value.
old_value = this->search_structure_[key.slot_index ()].int_id_;
+
// Store new value.
this->search_structure_[key.slot_index ()].int_id_ = value;
}
+
return result;
}
+
template <class T> ACE_INLINE int
ACE_Active_Map_Manager<T>::unbind (const ACE_Active_Map_Manager_Key &key,
T *&internal_value)
{
int result = this->find (key,
internal_value);
+
if (result == 0)
{
ACE_UINT32 slot_index = key.slot_index ();
+
#if defined (ACE_HAS_LAZY_MAP_MANAGER)
+
//
// In the case of lazy map managers, the movement of free slots
// from the occupied list to the free list is delayed until we
// run out of free slots in the free list.
//
+
this->search_structure_[slot_index].free_ = 1;
+
#else
+
// Move from occupied list to free list.
this->move_from_occupied_list_to_free_list (slot_index);
+
#endif /* ACE_HAS_LAZY_MAP_MANAGER */
+
// Reset the slot_index. This will tell us that this entry is free.
this->search_structure_[slot_index].ext_id_.slot_index (this->free_list_id ());
+
// Update the current size.
--this->cur_size_;
}
+
return result;
}
+
template <class T> ACE_INLINE int
ACE_Active_Map_Manager<T>::unbind (const ACE_Active_Map_Manager_Key &key,
T &value)
@@ -164,13 +207,16 @@ ACE_Active_Map_Manager<T>::unbind (const ACE_Active_Map_Manager_Key &key,
T *internal_value;
int result = this->unbind (key,
internal_value);
+
if (result == 0)
{
// Copy old value.
value = *internal_value;
}
+
return result;
}
+
template <class T> ACE_INLINE int
ACE_Active_Map_Manager<T>::unbind (const ACE_Active_Map_Manager_Key &key)
{
@@ -178,11 +224,13 @@ ACE_Active_Map_Manager<T>::unbind (const ACE_Active_Map_Manager_Key &key)
return this->unbind (key,
internal_value);
}
+
template <class T> ACE_INLINE
ACE_Active_Map_Manager<T>::ACE_Active_Map_Manager (ACE_Allocator *alloc)
: ACE_AMM_BASE (alloc)
{
}
+
template <class T> ACE_INLINE
ACE_Active_Map_Manager<T>::ACE_Active_Map_Manager (size_t size,
ACE_Allocator *alloc)
@@ -190,37 +238,44 @@ ACE_Active_Map_Manager<T>::ACE_Active_Map_Manager (size_t size,
alloc)
{
}
+
template <class T> ACE_INLINE
ACE_Active_Map_Manager<T>::~ACE_Active_Map_Manager (void)
{
}
+
template <class T> ACE_INLINE int
ACE_Active_Map_Manager<T>::open (size_t length,
ACE_Allocator *alloc)
{
return ACE_AMM_BASE::open (length, alloc);
}
+
template <class T> ACE_INLINE int
ACE_Active_Map_Manager<T>::close (void)
{
return ACE_AMM_BASE::close ();
}
+
template <class T> ACE_INLINE size_t
ACE_Active_Map_Manager<T>::current_size (void) const
{
return ACE_AMM_BASE::current_size ();
}
+
template <class T> ACE_INLINE size_t
ACE_Active_Map_Manager<T>::total_size (void) const
{
return ACE_AMM_BASE::total_size ();
}
+
/* static */
template <class T> ACE_INLINE const ACE_Active_Map_Manager_Key
ACE_Active_Map_Manager<T>::npos (void)
{
return ACE_Active_Map_Manager_Key (~0, ~0);
}
+
template <class T> ACE_INLINE void
ACE_Active_Map_Manager<T>::dump (void) const
{
@@ -228,24 +283,29 @@ ACE_Active_Map_Manager<T>::dump (void) const
ACE_AMM_BASE::dump ();
#endif /* ACE_HAS_DUMP */
}
+
template <class T> ACE_Map_Iterator<ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex>
ACE_Active_Map_Manager<T>::begin (void)
{
return ACE_AMM_BASE::begin ();
}
+
template <class T> ACE_INLINE ACE_Map_Iterator<ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex>
ACE_Active_Map_Manager<T>::end (void)
{
return ACE_AMM_BASE::end ();
}
+
template <class T> ACE_INLINE ACE_Map_Reverse_Iterator<ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex>
ACE_Active_Map_Manager<T>::rbegin (void)
{
return ACE_AMM_BASE::rbegin ();
}
+
template <class T> ACE_INLINE ACE_Map_Reverse_Iterator<ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex>
ACE_Active_Map_Manager<T>::rend (void)
{
return ACE_AMM_BASE::rend ();
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Addr.cpp b/dep/ACE_wrappers/ace/Addr.cpp
index c8e88524da3..db6e29c7273 100644
--- a/dep/ACE_wrappers/ace/Addr.cpp
+++ b/dep/ACE_wrappers/ace/Addr.cpp
@@ -1,57 +1,74 @@
// $Id: Addr.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Addr.h"
+
ACE_RCSID (ace,
Addr,
"$Id: Addr.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if !defined (__ACE_INLINE__)
#include "ace/Addr.inl"
#endif /* __ACE_INLINE__ */
+
#include "ace/Log_Msg.h"
#include "ace/os_include/sys/os_socket.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Note: this object requires static construction and destruction.
/* static */
const ACE_Addr ACE_Addr::sap_any (AF_ANY, -1);
+
ACE_ALLOC_HOOK_DEFINE(ACE_Addr)
+
// Initializes instance variables. Note that 0 is an unspecified
// protocol family type...
+
ACE_Addr::ACE_Addr (int type, int size) :
addr_type_ (type),
addr_size_ (size)
{
}
+
ACE_Addr::~ACE_Addr (void)
{
}
+
void *
ACE_Addr::get_addr (void) const
{
return 0;
}
+
void
ACE_Addr::set_addr (void *, int)
{
}
+
// Initializes instance variables.
+
void
ACE_Addr::base_set (int type, int size)
{
this->addr_type_ = type;
this->addr_size_ = size;
}
+
void
ACE_Addr::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_Addr::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("addr_type_ = %d"), this->addr_type_));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\naddr_size_ = %d"), this->addr_size_));
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Addr.h b/dep/ACE_wrappers/ace/Addr.h
index fbc0df0d547..fa9b5d757b6 100644
--- a/dep/ACE_wrappers/ace/Addr.h
+++ b/dep/ACE_wrappers/ace/Addr.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Addr.h
@@ -8,14 +9,20 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_ADDR_H
#define ACE_ADDR_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Addr
*
@@ -28,48 +35,70 @@ public:
// = Initialization and termination methods.
/// Initializes instance variables.
ACE_Addr (int type = -1, int size = -1);
+
/// Destructor.
virtual ~ACE_Addr (void);
+
// = Get/set the size of the address.
+
/// Return the size of the address.
int get_size (void) const;
+
/// Sets the size of the address.
void set_size (int size);
+
// = Get/set the type of the address.
+
/// Get the type of the address.
int get_type (void) const;
+
/// Set the type of the address.
void set_type (int type);
+
/// Return a pointer to the address.
virtual void *get_addr (void) const;
+
/// Set a pointer to the address.
virtual void set_addr (void *, int len);
+
// = Equality/inequality tests
/// Check for address equality.
bool operator == (const ACE_Addr &sap) const;
+
/// Check for address inequality.
bool operator != (const ACE_Addr &sap) const;
+
/// Initializes instance variables.
void base_set (int type, int size);
+
/// Wild-card address.
static const ACE_Addr sap_any;
+
/// Returns a hash value. This should be overwritten by a subclass
/// that can produce a better hash value.
virtual unsigned long hash (void) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
/// e.g., AF_UNIX, AF_INET, AF_SPIPE, etc.
int addr_type_;
+
/// Number of bytes in the address.
int addr_size_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Addr.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_ADDR_H */
diff --git a/dep/ACE_wrappers/ace/Addr.inl b/dep/ACE_wrappers/ace/Addr.inl
index 6cc9e27c4cd..44fd495a6e9 100644
--- a/dep/ACE_wrappers/ace/Addr.inl
+++ b/dep/ACE_wrappers/ace/Addr.inl
@@ -1,47 +1,61 @@
// -*- C++ -*-
//
// $Id: Addr.inl 80826 2008-03-04 14:51:23Z wotte $
+
// Return the address of the address.
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE bool
ACE_Addr::operator == (const ACE_Addr &sap) const
{
return (sap.addr_type_ == this->addr_type_ &&
sap.addr_size_ == this->addr_size_ );
}
+
ACE_INLINE bool
ACE_Addr::operator != (const ACE_Addr &sap) const
{
return (sap.addr_type_ != this->addr_type_ ||
sap.addr_size_ != this->addr_size_ );
}
+
// Return the size of the address.
+
ACE_INLINE int
ACE_Addr::get_size (void) const
{
return this->addr_size_;
}
+
// Sets the size of the address.
+
ACE_INLINE void
ACE_Addr::set_size (int size)
{
this->addr_size_ = size;
}
+
// Return the type of the address.
+
ACE_INLINE int
ACE_Addr::get_type (void) const
{
return this->addr_type_;
}
+
// Set the type of the address.
+
ACE_INLINE void
ACE_Addr::set_type (int type)
{
this->addr_type_ = type;
}
+
ACE_INLINE unsigned long
ACE_Addr::hash (void) const
{
return 0;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Arg_Shifter.h b/dep/ACE_wrappers/ace/Arg_Shifter.h
index cd043a60886..b5700c9f98f 100644
--- a/dep/ACE_wrappers/ace/Arg_Shifter.h
+++ b/dep/ACE_wrappers/ace/Arg_Shifter.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Arg_Shifter.h
@@ -8,15 +9,22 @@
* @author Seth Widoff
*/
//=============================================================================
+
#ifndef ACE_ARG_SHIFTER_H
#define ACE_ARG_SHIFTER_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Global_Macros.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Arg_Shifter_T
*
@@ -62,15 +70,19 @@ public:
ACE_Arg_Shifter_T (int& argc,
const CHAR_TYPE **argv,
const CHAR_TYPE **temp = 0);
+
/// Same behavior as the preceding constructor, but without the
/// "const" qualifier.
ACE_Arg_Shifter_T (int& argc,
CHAR_TYPE **argv,
CHAR_TYPE **temp = 0);
+
/// Destructor.
~ACE_Arg_Shifter_T (void);
+
/// Get the current head of the vector.
const CHAR_TYPE *get_current (void) const;
+
/**
* If the @a flag matches the current_arg of arg shifter
* this method will attempt to return the associated
@@ -104,6 +116,7 @@ public:
* and the cur arg is left pointing to the entire flag/value pair
*/
const CHAR_TYPE *get_the_parameter (const CHAR_TYPE* flag);
+
/**
* Check if the current argument matches (case insensitive) <flag>
*
@@ -134,54 +147,76 @@ public:
* then -1 is returned
*/
int cur_arg_strncasecmp (const CHAR_TYPE *flag);
+
/// Consume @a number argument(s) by sticking them/it on the end of
/// the vector.
int consume_arg (int number = 1);
+
/// Place @a number arguments in the same relative order ahead of the
/// known arguments in the vector.
int ignore_arg (int number = 1);
+
/// Returns the number of args left to see in the vector.
int is_anything_left (void) const;
+
/// Returns 1 if there's a next item in the vector and it begins with
/// '-'.
int is_option_next (void) const;
+
/// Returns 1 if there's a next item in the vector and it doesn't
/// begin with '-'.
int is_parameter_next (void) const;
+
/// Returns the number of irrelevant args seen.
int num_ignored_args (void) const;
+
private:
/// Copy Constructor should not be used.
ACE_UNIMPLEMENTED_FUNC (ACE_Arg_Shifter_T (const ACE_Arg_Shifter_T<CHAR_TYPE>&))
+
/// Assignment '=' operator should not be used.
ACE_UNIMPLEMENTED_FUNC (ACE_Arg_Shifter_T operator= (const ACE_Arg_Shifter_T<CHAR_TYPE>&))
+
/// Refactor the constructor logic.
void init (void);
+
/// The size of the argument vector.
int& argc_;
+
/// The size of argv_.
int total_size_;
+
/// The temporary array over which we traverse.
const CHAR_TYPE **temp_;
+
/// The array in which the arguments are reordered.
const CHAR_TYPE **argv_;
+
/// The element in <temp_> we're currently examining.
int current_index_;
+
/// The index of <argv_> in which we'll stick the next unknown
/// argument.
int back_;
+
/// The index of <argv_> in which we'll stick the next known
/// argument.
int front_;
};
+
typedef ACE_Arg_Shifter_T<ACE_TCHAR> ACE_Arg_Shifter;
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Arg_Shifter.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Arg_Shifter.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_ARG_SHIFTER_H */
diff --git a/dep/ACE_wrappers/ace/Argv_Type_Converter.cpp b/dep/ACE_wrappers/ace/Argv_Type_Converter.cpp
index 2b4aa1ac5d6..6b0860caaee 100644
--- a/dep/ACE_wrappers/ace/Argv_Type_Converter.cpp
+++ b/dep/ACE_wrappers/ace/Argv_Type_Converter.cpp
@@ -1,14 +1,20 @@
// $Id: Argv_Type_Converter.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Argv_Type_Converter.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Argv_Type_Converter.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID (ace,
Argv_Type_Converter,
"$Id: Argv_Type_Converter.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#include "ace/OS_NS_string.h"
#include "ace/OS_Errno.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_USES_WCHAR)
ACE_Argv_Type_Converter::ACE_Argv_Type_Converter (int &argc, wchar_t** argv)
: saved_argc_ (argc),
@@ -20,11 +26,13 @@ ACE_Argv_Type_Converter::ACE_Argv_Type_Converter (int &argc, wchar_t** argv)
char_passed_ (false)
{
this->initialize ();
+
for (int i = 0; i < argc; ++i)
this->char_argv_[i] = ACE_OS::strdup (ACE_TEXT_ALWAYS_CHAR (argv[i]));
}
#endif // ACE_USES_WCHAR
+
ACE_Argv_Type_Converter::ACE_Argv_Type_Converter (int &argc, char **argv)
: saved_argc_(argc),
char_argv_(argv)
@@ -36,6 +44,7 @@ ACE_Argv_Type_Converter::ACE_Argv_Type_Converter (int &argc, char **argv)
char_passed_(false)
{
this->initialize();
+
for (int i = 0; i < argc; ++i)
this->wchar_argv_[i] = ACE_OS::strdup (ACE_TEXT_ANTI_TO_TCHAR (argv[i]));
}
@@ -43,6 +52,7 @@ ACE_Argv_Type_Converter::ACE_Argv_Type_Converter (int &argc, char **argv)
{
}
#endif // ACE_USES_WCHAR
+
ACE_Argv_Type_Converter::~ACE_Argv_Type_Converter (void)
{
#if defined (ACE_USES_WCHAR)
@@ -52,8 +62,10 @@ ACE_Argv_Type_Converter::~ACE_Argv_Type_Converter (void)
// if original type is wchar_t
if (this->char_passed_)
this->align_wchar_with_char ();
+
for (int i = 0; i < this->before_pass_argc_; ++i)
ACE_OS::free (this->char_argv_[i]);
+
delete [] this->char_argv_;
}
else
@@ -61,12 +73,15 @@ ACE_Argv_Type_Converter::~ACE_Argv_Type_Converter (void)
// if original type is char
if (this->wchar_passed_)
this->align_char_with_wchar ();
+
for (int i = 0; i < this->before_pass_argc_; ++i)
ACE_OS::free (this->wchar_argv_[i]);
+
delete [] this->wchar_argv_;
}
#endif // ACE_USES_WCHAR
}
+
#if defined (ACE_USES_WCHAR)
void
ACE_Argv_Type_Converter::initialize (void)
@@ -89,11 +104,13 @@ ACE_Argv_Type_Converter::initialize (void)
}
}
+
void
ACE_Argv_Type_Converter::align_char_with_wchar (void)
{
int wchar_argv_index = 0;
wchar_t* match_argv = this->wchar_argv_[0]; // pick the initial entry
+
while (wchar_argv_index < this->saved_argc_)
{
// if n'th entries of both argv lists are different
@@ -115,16 +132,20 @@ ACE_Argv_Type_Converter::align_char_with_wchar (void)
}
}
}
+
// move to the next wchar argv list entry
match_argv = this->wchar_argv_[++wchar_argv_index];
}
+
this->cleanup ();
}
+
void
ACE_Argv_Type_Converter::align_wchar_with_char (void)
{
int char_argv_index = 0;
char* match_argv = this->char_argv_[0]; // pick the initial entry
+
while (char_argv_index < saved_argc_)
{
// if n'th entries of both argv lists are different
@@ -147,11 +168,14 @@ ACE_Argv_Type_Converter::align_wchar_with_char (void)
}
}
}
+
// move to the next wchar argv list entry
match_argv = this->char_argv_[++char_argv_index];
}
+
this->cleanup();
}
+
void
ACE_Argv_Type_Converter::cleanup (void)
{
@@ -169,10 +193,13 @@ ACE_Argv_Type_Converter::cleanup (void)
this->wchar_argv_[i] = 0;
}
}
+
this->before_pass_argc_ = this->saved_argc_;
+
this->wchar_passed_ = false;
this->char_passed_ = false;
}
#endif // ACE_USES_WCHAR
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Argv_Type_Converter.h b/dep/ACE_wrappers/ace/Argv_Type_Converter.h
index d8de2b84b4b..957a431a6c3 100644
--- a/dep/ACE_wrappers/ace/Argv_Type_Converter.h
+++ b/dep/ACE_wrappers/ace/Argv_Type_Converter.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Argv_Type_Converter.h
@@ -8,15 +9,21 @@
* @author Si Mong Park <spark@ociweb.com>
*/
//=============================================================================
+
#ifndef ACE_ARGV_TYPE_CONVERTER_H
#define ACE_ARGV_TYPE_CONVERTER_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
#include "ace/OS_Memory.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Argv_Type_Converter
*
@@ -32,57 +39,82 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
class ACE_Export ACE_Argv_Type_Converter
{
public:
+
ACE_Argv_Type_Converter (int &argc, char** argv);
+
#if defined (ACE_USES_WCHAR)
ACE_Argv_Type_Converter (int &argc, wchar_t** argv);
#endif // ACE_USES_WCHAR
+
~ACE_Argv_Type_Converter (void);
+
/// Returns the pointer of converted command line.
ACE_TCHAR** get_TCHAR_argv (void);
+
/// Returns the pointer of ASCII (char) command line.
char** get_ASCII_argv (void);
+
/// Returns the number of sub paramters (argc).
int& get_argc (void);
+
private:
+
/// Copy Constructor should not be used.
ACE_Argv_Type_Converter (const ACE_Argv_Type_Converter&);
+
/// Assignment '=' operator should not be used.
ACE_Argv_Type_Converter operator= (const ACE_Argv_Type_Converter&);
+
#if defined (ACE_USES_WCHAR)
+
/// Perform common initialization for two Ctor's.
void initialize (void);
+
/// Align all entries in the char type argv list with wchar_t type
/// argv list.
void align_char_with_wchar (void);
+
/// Align all entries in the wchar_t type argv list with char type
/// argv list.
void align_wchar_with_char (void);
+
/// Clean up removed (comsumed) argv entries and reset the pass flags.
void cleanup (void);
#endif // ACE_USES_WCHAR
+
private:
/// Original number of input paramter, same as 'argc'.
int &saved_argc_;
+
/// Data member pointer that contains converted argv in ACE_ANTI_TCHAR.
char** char_argv_;
+
#if defined (ACE_USES_WCHAR)
/// Data member pointer that contains converted argv in ACE_TCHAR.
wchar_t** wchar_argv_;
+
/// argc value before any argv has been passed.
int before_pass_argc_;
+
/// false represents original argv passed in is char, and true
/// represents wchar_t.
bool const original_type_;
+
/// true indicates wchar_t type argv has been passed.
bool wchar_passed_;
+
/// true indicates char type argv has been passed.
bool char_passed_;
#endif /* ACE_USES_WCHAR */
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Argv_Type_Converter.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_ARGV_TYPE_CONVERTER_H */
diff --git a/dep/ACE_wrappers/ace/Argv_Type_Converter.inl b/dep/ACE_wrappers/ace/Argv_Type_Converter.inl
index b9946d7ea8c..e4b0ed5a059 100644
--- a/dep/ACE_wrappers/ace/Argv_Type_Converter.inl
+++ b/dep/ACE_wrappers/ace/Argv_Type_Converter.inl
@@ -1,7 +1,9 @@
// -*- C++ -*-
//
// $Id: Argv_Type_Converter.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE ACE_TCHAR**
ACE_Argv_Type_Converter::get_TCHAR_argv (void)
{
@@ -10,12 +12,14 @@ ACE_Argv_Type_Converter::get_TCHAR_argv (void)
{
this->align_wchar_with_char ();
}
+
this->wchar_passed_ = true;
return this->wchar_argv_;
#else
return this->char_argv_;
#endif // ACE_USES_WCHAR
}
+
ACE_INLINE char**
ACE_Argv_Type_Converter::get_ASCII_argv (void)
{
@@ -24,13 +28,17 @@ ACE_Argv_Type_Converter::get_ASCII_argv (void)
{
this->align_char_with_wchar ();
}
+
this->char_passed_ = true;
#endif // ACE_USES_WCHAR
+
return this->char_argv_;
}
+
ACE_INLINE int&
ACE_Argv_Type_Converter::get_argc (void)
{
return this->saved_argc_;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Array.h b/dep/ACE_wrappers/ace/Array.h
index a6b2008e462..8ef7f094ac8 100644
--- a/dep/ACE_wrappers/ace/Array.h
+++ b/dep/ACE_wrappers/ace/Array.h
@@ -1,4 +1,5 @@
/* -*- C++ -*- */
+
//=============================================================================
/**
* @file Array.h
@@ -13,13 +14,17 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_ARRAY_H
#define ACE_ARRAY_H
#include /**/ "ace/pre.h"
+
#include "ace/Containers_T.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include /**/ "ace/post.h"
#endif /* ACE_ARRAY_H */
diff --git a/dep/ACE_wrappers/ace/Array_Base.h b/dep/ACE_wrappers/ace/Array_Base.h
index fbd8695d5a6..feef89eda01 100644
--- a/dep/ACE_wrappers/ace/Array_Base.h
+++ b/dep/ACE_wrappers/ace/Array_Base.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Array_Base.h
@@ -8,19 +9,27 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_ARRAY_BASE_H
#define ACE_ARRAY_BASE_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Global_Macros.h"
#include "ace/Malloc_Base.h"
#include <iterator> /* For reverse_iterator adapters */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward declaration.
template <class T> class ACE_Array_Iterator;
+
/**
* @class ACE_Array_Base
*
@@ -34,9 +43,11 @@ template<class T>
class ACE_Array_Base
{
public:
+
// Old/ACE-style traits.
typedef T TYPE;
typedef ACE_Array_Iterator<T> ITERATOR;
+
// STL-style typedefs/traits.
typedef T value_type;
typedef value_type * iterator;
@@ -47,21 +58,27 @@ public:
typedef value_type const * const_pointer;
typedef ptrdiff_t difference_type;
typedef ACE_Allocator::size_type size_type;
+
ACE_DECLARE_STL_REVERSE_ITERATORS
+
// = Initialization and termination methods.
+
/// Dynamically create an uninitialized array.
ACE_Array_Base (size_type size = 0,
ACE_Allocator * the_allocator = 0);
+
/// Dynamically initialize the entire array to the <default_value>.
ACE_Array_Base (size_type size,
T const & default_value,
ACE_Allocator * the_allocator = 0);
+
/**
* The copy constructor performs initialization by making an exact
* copy of the contents of parameter <s>, i.e., *this == s will
* return true.
*/
ACE_Array_Base (ACE_Array_Base<T> const & s);
+
/**
* Assignment operator performs an assignment by making an exact
* copy of the contents of parameter <s>, i.e., *this == s will
@@ -71,18 +88,24 @@ public:
* reallocate a new <array_>, and then copy the contents of <s>.
*/
void operator= (ACE_Array_Base<T> const & s);
+
/// Clean up the array (e.g., delete dynamically allocated memory).
~ACE_Array_Base (void);
+
// = Set/get methods.
+
/// Set item in the array at location @a slot. Doesn't
/// perform range checking.
T & operator[] (size_type slot);
+
/// Get item in the array at location @a slot. Doesn't
/// perform range checking.
T const & operator[] (size_type slot) const;
+
/// Set an item in the array at location @a slot. Returns
/// -1 if @a slot is not in range, else returns 0.
int set (T const & new_item, size_type slot);
+
/**
* Get an item in the array at location @a slot. Returns -1 if
* @a slot is not in range, else returns 0. Note that this function
@@ -90,16 +113,20 @@ public:
* the const operator [], but then you'll be responsible for range checking.
*/
int get (T & item, size_type slot) const;
+
/// Returns the <cur_size_> of the array.
size_type size (void) const;
+
/**
* Changes the size of the array to match <new_size>.
* It copies the old contents into the new array.
* Return -1 on failure.
*/
int size (size_type new_size);
+
/// Returns the <max_size_> of the array.
size_type max_size (void) const;
+
/**
* Changes the size of the array to match <new_size>.
* It copies the old contents into the new array.
@@ -107,6 +134,7 @@ public:
* It does not affect new_size
*/
int max_size (size_type new_size);
+
/**
* @name Forward Iterator Accessors
*
@@ -118,6 +146,7 @@ public:
const_iterator begin (void) const;
const_iterator end (void) const;
//@}
+
/**
* @name Reverse Iterator Accessors
*
@@ -129,16 +158,21 @@ public:
const_reverse_iterator rbegin (void) const;
const_reverse_iterator rend (void) const;
//@}
+
/// Swap the contents of this array with the given @a array in
/// an exception-safe manner.
void swap (ACE_Array_Base<T> & array);
+
protected:
+
/// Returns 1 if @a slot is within range, i.e., 0 >= @a slot <
/// <cur_size_>, else returns 0.
bool in_range (size_type slot) const;
+
/// Maximum size of the array, i.e., the total number of <T> elements
/// in <array_>.
size_type max_size_;
+
/**
* Current size of the array. This starts out being == to
* <max_size_>. However, if we are assigned a smaller array, then
@@ -147,13 +181,18 @@ protected:
* don't have to.
*/
size_type cur_size_;
+
/// Pointer to the array's storage buffer.
value_type * array_;
+
/// Allocation strategy of the ACE_Array_Base.
ACE_Allocator * allocator_;
+
friend class ACE_Array_Iterator<T>;
};
+
// ****************************************************************
+
/**
* @class ACE_Array_Iterator
*
@@ -170,35 +209,49 @@ class ACE_Array_Iterator
public:
// = Initialization method.
ACE_Array_Iterator (ACE_Array_Base<T> &);
+
// = Iteration methods.
+
/// Pass back the <next_item> that hasn't been seen in the Array.
/// Returns 0 when all items have been seen, else 1.
int next (T *&next_item);
+
/// Move forward by one element in the Array. Returns 0 when all the
/// items in the Array have been seen, else 1.
int advance (void);
+
/// Returns 1 when all items have been seen, else 0.
int done (void) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Pointer to the current item in the iteration.
size_t current_;
+
/// Pointer to the Array we're iterating over.
ACE_Array_Base<T> &array_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Array_Base.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Array_Base.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Array_Base.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_ARRAY_BASE_H */
diff --git a/dep/ACE_wrappers/ace/Array_Base.inl b/dep/ACE_wrappers/ace/Array_Base.inl
index b92e0177a85..046c1bffc89 100644
--- a/dep/ACE_wrappers/ace/Array_Base.inl
+++ b/dep/ACE_wrappers/ace/Array_Base.inl
@@ -1,7 +1,9 @@
// -*- C++ -*-
//
// $Id: Array_Base.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Clean up the array (e.g., delete dynamically allocated memory).
template <class T> ACE_INLINE
ACE_Array_Base<T>::~ACE_Array_Base (void)
@@ -11,80 +13,95 @@ ACE_Array_Base<T>::~ACE_Array_Base (void)
this->allocator_->free,
T);
}
+
template <class T>
ACE_INLINE typename ACE_Array_Base<T>::iterator
ACE_Array_Base<T>::begin (void)
{
return this->array_;
}
+
template <class T>
ACE_INLINE typename ACE_Array_Base<T>::iterator
ACE_Array_Base<T>::end (void)
{
return this->array_ + this->cur_size_;
}
+
template <class T>
ACE_INLINE typename ACE_Array_Base<T>::const_iterator
ACE_Array_Base<T>::begin (void) const
{
return this->array_;
}
+
template <class T>
ACE_INLINE typename ACE_Array_Base<T>::const_iterator
ACE_Array_Base<T>::end (void) const
{
return this->array_ + this->cur_size_;
}
+
template <class T>
ACE_INLINE typename ACE_Array_Base<T>::reverse_iterator
ACE_Array_Base<T>::rbegin (void)
{
return reverse_iterator (this->end ());
}
+
template <class T>
ACE_INLINE typename ACE_Array_Base<T>::reverse_iterator
ACE_Array_Base<T>::rend (void)
{
return reverse_iterator (this->begin ());
}
+
template <class T>
ACE_INLINE typename ACE_Array_Base<T>::const_reverse_iterator
ACE_Array_Base<T>::rbegin (void) const
{
return const_reverse_iterator (this->end ());
}
+
template <class T>
ACE_INLINE typename ACE_Array_Base<T>::const_reverse_iterator
ACE_Array_Base<T>::rend (void) const
{
return const_reverse_iterator (this->begin ());
}
+
template <class T> ACE_INLINE typename ACE_Array_Base<T>::size_type
ACE_Array_Base<T>::size (void) const
{
return this->cur_size_;
}
+
template <class T> ACE_INLINE typename ACE_Array_Base<T>::size_type
ACE_Array_Base<T>::max_size (void) const
{
return this->max_size_;
}
+
template <class T> ACE_INLINE bool
ACE_Array_Base<T>::in_range (typename ACE_Array_Base<T>::size_type index) const
{
return index < this->cur_size_;
}
+
template <class T> ACE_INLINE T &
ACE_Array_Base<T>::operator[] (typename ACE_Array_Base<T>::size_type index)
{
return this->array_[index];
}
+
template <class T> ACE_INLINE const T &
ACE_Array_Base<T>::operator[] (typename ACE_Array_Base<T>::size_type index) const
{
return this->array_[index];
}
+
// ****************************************************************
+
template <class T> ACE_INLINE void
ACE_Array_Iterator<T>::dump (void) const
{
@@ -92,6 +109,7 @@ ACE_Array_Iterator<T>::dump (void) const
// ACE_TRACE ("ACE_Array_Iterator<T>::dump");
#endif /* ACE_HAS_DUMP */
}
+
template <class T> ACE_INLINE
ACE_Array_Iterator<T>::ACE_Array_Iterator (ACE_Array_Base<T> &a)
: current_ (0),
@@ -99,10 +117,12 @@ ACE_Array_Iterator<T>::ACE_Array_Iterator (ACE_Array_Base<T> &a)
{
// ACE_TRACE ("ACE_Array_Iterator<T>::ACE_Array_Iterator");
}
+
template <class T> ACE_INLINE int
ACE_Array_Iterator<T>::advance (void)
{
// ACE_TRACE ("ACE_Array_Iterator<T>::advance");
+
if (this->current_ < array_.size ())
{
++this->current_;
@@ -114,10 +134,13 @@ ACE_Array_Iterator<T>::advance (void)
return 0;
}
}
+
template <class T> ACE_INLINE int
ACE_Array_Iterator<T>::done (void) const
{
ACE_TRACE ("ACE_Array_Iterator<T>::done");
+
return this->current_ >= array_.size ();
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Array_Map.h b/dep/ACE_wrappers/ace/Array_Map.h
index 435154217a8..18c0dbe1b39 100644
--- a/dep/ACE_wrappers/ace/Array_Map.h
+++ b/dep/ACE_wrappers/ace/Array_Map.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Array_Map.h
@@ -15,17 +16,24 @@
*/
//=============================================================================
+
#ifndef ACE_ARRAY_MAP_H
#define ACE_ARRAY_MAP_H
+
#include /**/ "ace/pre.h"
+
#include "ace/config-lite.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include <utility>
#include <iterator>
#include <functional>
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Array_Map
*
@@ -80,6 +88,7 @@ template<typename Key, typename Value, class EqualTo = std::equal_to<Key> >
class ACE_Array_Map
{
public:
+
// STL-style typedefs/traits.
typedef Key key_type;
typedef Value data_type;
@@ -92,22 +101,28 @@ public:
typedef value_type const * const_pointer;
typedef ptrdiff_t difference_type;
typedef size_t size_type;
+
ACE_DECLARE_STL_REVERSE_ITERATORS
+
/// Default Constructor.
/**
* Create an empty map with a preallocated buffer of size @a s.
*/
ACE_Array_Map (size_type s = 0);
+
#ifndef ACE_LACKS_MEMBER_TEMPLATES
template<typename InputIterator>
ACE_Array_Map (InputIterator f, InputIterator l);
#else
ACE_Array_Map (const_iterator f, const_iterator l);
#endif /* !ACE_LACKS_MEMBER_TEMPLATES */
+
ACE_Array_Map (ACE_Array_Map const & map);
ACE_Array_Map & operator= (ACE_Array_Map const & map);
+
/// Destructor.
~ACE_Array_Map (void);
+
/**
* @name Forward Iterator Accessors
*
@@ -119,6 +134,7 @@ public:
const_iterator begin (void) const;
const_iterator end (void) const;
//@}
+
/**
* @name Reverse Iterator Accessors
*
@@ -130,24 +146,30 @@ public:
const_reverse_iterator rbegin (void) const;
const_reverse_iterator rend (void) const;
//@}
+
/// Return current size of map.
/**
* @return The number of elements in the map.
*/
size_type size (void) const;
+
/// Maximum number of elements the map can hold.
size_type max_size (void) const;
+
/// Return @c true if the map is empty, else @c false.
bool is_empty (void) const; // ACE style
+
/**
* Return @c true if the map is empty, else @c false. We recommend
* using @c is_empty() instead since it's more consistent with the
* ACE container naming conventions.
*/
bool empty (void) const; // STL style
+
/// Swap the contents of this map with the given @a map in an
/// exception-safe manner.
void swap (ACE_Array_Map & map);
+
/// Insert the value @a x into the map.
/**
* STL-style map insertion method.
@@ -158,6 +180,7 @@ public:
* contains a value with the same key as @a x.
*/
std::pair<iterator, bool> insert (value_type const & x);
+
#ifndef ACE_LACKS_MEMBER_TEMPLATES
/// Insert range of elements into map.
template<typename InputIterator>
@@ -166,23 +189,28 @@ public:
/// Insert range of elements into map.
void insert (const_iterator f, const_iterator l);
#endif /* ACE_LACKS_MEMBER_TEMPLATES */
+
/// Remove element at position @a pos from the map.
void erase (iterator pos);
+
/// Remove element corresponding to key @a k from the map.
/**
* @return Number of elements that were erased.
*/
size_type erase (key_type const & k);
+
/// Remove range of elements [@a first, @a last) from the map.
/**
* @note [@a first, @a last) must be valid range within the map.
*/
void erase (iterator first, iterator last);
+
/// Clear contents of map.
/**
* @note This a constant time (O(1)) operation.
*/
void clear (void);
+
/**
* @name Search Operations
*
@@ -194,18 +222,21 @@ public:
* map.
*/
iterator find (key_type const & k);
+
/**
* @return @c end() if data corresponding to key @a k is not in the
* map.
*/
const_iterator find (key_type const & k) const;
//@}
+
/// Count the number of elements corresponding to key @a k.
/**
* @return In the case of this map, the count will always be one if
* such exists in the map.
*/
size_type count (key_type const & k);
+
/// Convenience array index operator.
/**
* Array index operator that allows insertion and retrieval of
@@ -214,40 +245,57 @@ public:
* map["Foo"] = 12;
*/
data_type & operator[] (key_type const & k);
+
private:
+
/// Increase size of underlying buffer by @a s.
void grow (size_type s);
+
private:
+
/// Number of elements in the map.
size_type size_;
+
/// Current size of underlying array.
/**
* @note @c capacity_ is always greater than or equal to @c size_;
*/
size_type capacity_;
+
/// Underlying array containing keys and data.
value_type * nodes_;
+
};
+
// --------------------------------------------------------------
+
/// @c ACE_Array_Map equality operator.
template <typename Key, typename Value, class EqualTo>
bool operator== (ACE_Array_Map<Key, Value, EqualTo> const & lhs,
ACE_Array_Map<Key, Value, EqualTo> const & rhs);
+
/// @c ACE_Array_Map lexicographical comparison operator.
template <typename Key, typename Value, class EqualTo>
bool operator< (ACE_Array_Map<Key, Value, EqualTo> const & lhs,
ACE_Array_Map<Key, Value, EqualTo> const & rhs);
+
// --------------------------------------------------------------
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#ifdef __ACE_INLINE__
# include "ace/Array_Map.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
# include "ace/Array_Map.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Array_Map.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_ARRAY_MAP_H */
diff --git a/dep/ACE_wrappers/ace/Array_Map.inl b/dep/ACE_wrappers/ace/Array_Map.inl
index 66abdb26f98..b053dc0a441 100644
--- a/dep/ACE_wrappers/ace/Array_Map.inl
+++ b/dep/ACE_wrappers/ace/Array_Map.inl
@@ -1,7 +1,9 @@
// -*- C++ -*-
//
// $Id: Array_Map.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template<typename Key, typename Value, class EqualTo>
ACE_INLINE
ACE_Array_Map<Key, Value, EqualTo>::ACE_Array_Map (
@@ -11,89 +13,105 @@ ACE_Array_Map<Key, Value, EqualTo>::ACE_Array_Map (
, nodes_ (s == 0 ? 0 : new value_type[s])
{
}
+
template<typename Key, typename Value, class EqualTo>
ACE_INLINE ACE_Array_Map<Key, Value, EqualTo> &
ACE_Array_Map<Key, Value, EqualTo>::operator= (
ACE_Array_Map<Key, Value, EqualTo> const & map)
{
// Strongly exception-safe assignment.
+
ACE_Array_Map<Key, Value, EqualTo> temp (map);
this->swap (temp);
return *this;
}
+
template<typename Key, typename Value, class EqualTo>
ACE_INLINE typename ACE_Array_Map<Key, Value, EqualTo>::iterator
ACE_Array_Map<Key, Value, EqualTo>::begin (void)
{
return this->nodes_;
}
+
template<typename Key, typename Value, class EqualTo>
ACE_INLINE typename ACE_Array_Map<Key, Value, EqualTo>::iterator
ACE_Array_Map<Key, Value, EqualTo>::end (void)
{
return this->nodes_ + this->size_;
}
+
template<typename Key, typename Value, class EqualTo>
ACE_INLINE typename ACE_Array_Map<Key, Value, EqualTo>::const_iterator
ACE_Array_Map<Key, Value, EqualTo>::begin (void) const
{
return this->nodes_;
}
+
template<typename Key, typename Value, class EqualTo>
ACE_INLINE typename ACE_Array_Map<Key, Value, EqualTo>::const_iterator
ACE_Array_Map<Key, Value, EqualTo>::end (void) const
{
return this->nodes_ + this->size_;
}
+
template<typename Key, typename Value, class EqualTo>
ACE_INLINE typename ACE_Array_Map<Key, Value, EqualTo>::reverse_iterator
ACE_Array_Map<Key, Value, EqualTo>::rbegin (void)
{
return reverse_iterator (this->end ());
}
+
template<typename Key, typename Value, class EqualTo>
ACE_INLINE typename ACE_Array_Map<Key, Value, EqualTo>::reverse_iterator
ACE_Array_Map<Key, Value, EqualTo>::rend (void)
{
return reverse_iterator (this->begin ());
}
+
template<typename Key, typename Value, class EqualTo>
ACE_INLINE typename ACE_Array_Map<Key, Value, EqualTo>::const_reverse_iterator
ACE_Array_Map<Key, Value, EqualTo>::rbegin (void) const
{
return const_reverse_iterator (this->end ());
}
+
template<typename Key, typename Value, class EqualTo>
ACE_INLINE typename ACE_Array_Map<Key, Value, EqualTo>::const_reverse_iterator
ACE_Array_Map<Key, Value, EqualTo>::rend (void) const
{
return const_reverse_iterator (this->begin ());
}
+
template<typename Key, typename Value, class EqualTo>
ACE_INLINE typename ACE_Array_Map<Key, Value, EqualTo>::size_type
ACE_Array_Map<Key, Value, EqualTo>::size (void) const
{
return this->size_;
}
+
template<typename Key, typename Value, class EqualTo>
ACE_INLINE typename ACE_Array_Map<Key, Value, EqualTo>::size_type
ACE_Array_Map<Key, Value, EqualTo>::max_size (void) const
{
return size_type (-1) / sizeof (value_type);
}
+
template<typename Key, typename Value, class EqualTo>
ACE_INLINE bool
ACE_Array_Map<Key, Value, EqualTo>::is_empty (void) const
{
return this->size_ == 0;
}
+
// The following method is deprecated.
+
template<typename Key, typename Value, class EqualTo>
ACE_INLINE bool
ACE_Array_Map<Key, Value, EqualTo>::empty (void) const
{
return this->is_empty ();
}
+
template<typename Key, typename Value, class EqualTo>
ACE_INLINE typename ACE_Array_Map<Key, Value, EqualTo>::size_type
ACE_Array_Map<Key, Value, EqualTo>::count (
@@ -102,6 +120,7 @@ ACE_Array_Map<Key, Value, EqualTo>::count (
return
(this->find (k) == this->end () ? 0 : 1); // Only one datum per key.
}
+
template<typename Key, typename Value, class EqualTo>
ACE_INLINE typename ACE_Array_Map<Key, Value, EqualTo>::data_type &
ACE_Array_Map<Key, Value, EqualTo>::operator[] (
@@ -110,4 +129,5 @@ ACE_Array_Map<Key, Value, EqualTo>::operator[] (
iterator i = (this->insert (value_type (k, data_type ()))).first;
return (*i).second;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Assert.cpp b/dep/ACE_wrappers/ace/Assert.cpp
index 8d39c3b7291..3faf3426d07 100644
--- a/dep/ACE_wrappers/ace/Assert.cpp
+++ b/dep/ACE_wrappers/ace/Assert.cpp
@@ -1,8 +1,12 @@
// $Id: Assert.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Assert.h"
#include "ace/Log_Msg.h"
+
ACE_RCSID(ace, Assert, "$Id: Assert.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// The following ASSERT macro is courtesy of Alexandre Karev
// <akg@na47sun05.cern.ch>.
void
@@ -10,9 +14,12 @@ __ace_assert(const char *file, int line, const ACE_TCHAR *expression)
{
int error = ACE_Log_Msg::last_error_adapter ();
ACE_Log_Msg *log = ACE_Log_Msg::instance ();
+
log->set (file, line, -1, error, log->restart (),
log->msg_ostream (), log->msg_callback ());
+
log->log (LM_ERROR, ACE_TEXT ("ACE_ASSERT: file %N, line %l assertion failed for '%s'.%a\n"), expression, -1);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Assert.h b/dep/ACE_wrappers/ace/Assert.h
index f3bf9f3c335..5bdf56f0531 100644
--- a/dep/ACE_wrappers/ace/Assert.h
+++ b/dep/ACE_wrappers/ace/Assert.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Assert.h
@@ -8,14 +9,20 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_ASSERT_H
#define ACE_ASSERT_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#include /**/ "ace/config-all.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_Export void __ace_assert(const char *file, int line, const ACE_TCHAR *expression);
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_NDEBUG)
#define ACE_ASSERT(x) \
(static_cast<void>(0))
@@ -25,6 +32,8 @@ ACE_END_VERSIONED_NAMESPACE_DECL
? static_cast<void>(0) \
: ACE_VERSIONED_NAMESPACE_NAME::__ace_assert(__FILE__, __LINE__, ACE_TEXT_CHAR_TO_TCHAR (#X)))
#endif /* ACE_NDEBUG */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_ASSERT */
diff --git a/dep/ACE_wrappers/ace/Asynch_Acceptor.h b/dep/ACE_wrappers/ace/Asynch_Acceptor.h
index 46761275202..e14126d3f1f 100644
--- a/dep/ACE_wrappers/ace/Asynch_Acceptor.h
+++ b/dep/ACE_wrappers/ace/Asynch_Acceptor.h
@@ -1,4 +1,5 @@
/* -*- C++ -*- */
+
//=============================================================================
/**
* @file Asynch_Acceptor.h
@@ -8,21 +9,29 @@
* @author Irfan Pyarali (irfan@cs.wustl.edu)
*/
//=============================================================================
+
#ifndef ACE_ASYNCH_ACCEPTOR_H
#define ACE_ASYNCH_ACCEPTOR_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS)
// This only works on platforms that support async i/o.
+
#include "ace/Default_Constants.h"
#include "ace/Asynch_IO.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward declarations
class ACE_Message_Block;
class ACE_INET_Addr;
+
/**
* @class ACE_Asynch_Acceptor
*
@@ -39,8 +48,10 @@ class ACE_Asynch_Acceptor : public ACE_Handler
public:
/// A do nothing constructor.
ACE_Asynch_Acceptor (void);
+
/// Virtual destruction
virtual ~ACE_Asynch_Acceptor (void);
+
/**
* @c open starts one or more asynchronous accept requests on a
* @a address. Each accept operation may optionally read an
@@ -104,8 +115,10 @@ public:
bool validate_new_connection = false,
int reissue_accept = 1,
int number_of_initial_accepts = -1);
+
/// Get the underlying handle.
virtual ACE_HANDLE get_handle (void) const;
+
/**
* Set the underlying listen handle. It is the user's responsibility
* to make sure that the old listen handle has been appropriately
@@ -113,12 +126,14 @@ public:
* either completed or have been canceled on the old listen handle.
*/
virtual int set_handle (ACE_HANDLE handle);
+
/// This initiates a new asynchronous accept operation.
/**
* You need only call this method if the @a reissue_accept argument
* passed to @c open() was 0.
*/
virtual int accept (size_t bytes_to_read = 0, const void *act = 0);
+
/**
* Cancels all pending accepts operations issued by this object.
*
@@ -126,6 +141,7 @@ public:
* are canceled.
*/
virtual int cancel (void);
+
/**
* Template method to validate peer before service is opened.
* This method is called after a new connection is accepted if the
@@ -149,6 +165,7 @@ public:
virtual int validate_connection (const ACE_Asynch_Accept::Result& result,
const ACE_INET_Addr &remote,
const ACE_INET_Addr& local);
+
/**
* Template method for deciding whether to reissue accept.
*
@@ -161,77 +178,104 @@ public:
* be changed using the @c reissue_accept() method.
*/
virtual int should_reissue_accept (void);
+
//
// These are low level tweaking methods
//
+
/// Get flag that indicates if parsing and passing of addresses to
/// the service_handler is necessary.
virtual bool pass_addresses (void) const;
+
/// Set flag that indicates if parsing and passing of addresses to
/// the service_handler is necessary.
virtual void pass_addresses (bool new_value);
+
/// Get flag that indicates if address validation is required.
virtual bool validate_new_connection (void) const;
+
/// Set flag that indicates if address validation is required.
virtual void validate_new_connection (bool new_value);
+
/// Get flag that indicates if a new accept should be reissued when a accept
/// completes.
virtual int reissue_accept (void) const;
+
/// Set flag that indicates if a new accept should be reissued when a accept
/// completes.
virtual void reissue_accept (int new_value);
+
/// Get bytes to be read with the <accept> call.
virtual size_t bytes_to_read (void) const;
+
/// Set bytes to be read with the <accept> call.
virtual void bytes_to_read (size_t new_value);
+
/// @deprecated address_size() assumes IPv4 use, so is not always valid.
/// This method will be removed after ACE 5.5. Internal uses have been
/// changes to base needed sizes on the addr_family_ member.
static size_t address_size (void);
+
protected:
+
/// This is called when an outstanding accept completes.
virtual void handle_accept (const ACE_Asynch_Accept::Result &result);
+
/// Return the listen handle.
ACE_HANDLE handle (void) const;
/// Set the listen handle.
void handle (ACE_HANDLE h);
+
/// This parses the address from read buffer.
void parse_address (const ACE_Asynch_Accept::Result &result,
ACE_INET_Addr &remote_address,
ACE_INET_Addr &local_address);
+
/// Return the asynch accept object.
ACE_Asynch_Accept &asynch_accept (void);
+
/**
* This is the template method used to create new handler.
* Subclasses must overwrite this method if a new handler creation
* strategy is required.
*/
virtual HANDLER *make_handler (void);
+
private:
/// Handle used to listen for new connections.
ACE_HANDLE listen_handle_;
+
/// Asynch_Accept used to make life easier :-)
ACE_Asynch_Accept asynch_accept_;
+
/// Flag that indicates if parsing of addresses is necessary.
bool pass_addresses_;
+
/// Flag that indicates if address validation is required.
bool validate_new_connection_;
+
/// Flag that indicates if a new accept should be reissued when a
/// accept completes.
int reissue_accept_;
+
/// Bytes to be read with the <accept> call.
size_t bytes_to_read_;
+
/// Address family used to open this object. Obtained from @a address passed
/// to @c open().
int addr_family_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Asynch_Acceptor.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Asynch_Acceptor.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */
#include /**/ "ace/post.h"
#endif /* ACE_ASYNCH_ACCEPTOR_H */
diff --git a/dep/ACE_wrappers/ace/Asynch_Connector.h b/dep/ACE_wrappers/ace/Asynch_Connector.h
index 1882bf98a6a..64781ad36a5 100644
--- a/dep/ACE_wrappers/ace/Asynch_Connector.h
+++ b/dep/ACE_wrappers/ace/Asynch_Connector.h
@@ -1,4 +1,5 @@
/* -*- C++ -*- */
+
//=============================================================================
/**
* @file Asynch_Connector.h
@@ -8,20 +9,28 @@
* @author Alexander Libman <alibman@ihug.com.au>
*/
//=============================================================================
+
#ifndef ACE_ASYNCH_CONNECTOR_H
#define ACE_ASYNCH_CONNECTOR_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if (defined (ACE_WIN32) || defined (ACE_HAS_AIO_CALLS)) && !defined(ACE_HAS_WINCE)
// This only works on platforms that support async i/o.
+
#include "ace/Asynch_IO.h"
#include "ace/INET_Addr.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward declarations
class ACE_Message_Block;
+
/**
* @class ACE_Asynch_Connector
*
@@ -32,26 +41,31 @@ class ACE_Message_Block;
* Unlike the ACE_Connector, however, this class is designed to
* be used asynchronously with the ACE Proactor framework.
*/
+
template <class HANDLER>
class ACE_Asynch_Connector : public ACE_Handler
{
public:
/// A do nothing constructor.
ACE_Asynch_Connector (void);
+
/// Virtual destruction
virtual ~ACE_Asynch_Connector (void);
+
/**
* This opens asynch connector
*/
virtual int open (bool pass_addresses = false,
ACE_Proactor *proactor = 0,
bool validate_new_connection = true);
+
/// This initiates a new asynchronous connect
virtual int connect (const ACE_INET_Addr &remote_sap,
const ACE_INET_Addr &local_sap =
(const ACE_INET_Addr &)ACE_Addr::sap_any,
int reuse_addr = 1,
const void *act = 0);
+
/**
* This cancels all pending accepts operations that were issued by
* the calling thread.
@@ -63,6 +77,7 @@ public:
*/
virtual int cancel (void);
+
/**
* Template method to validate peer before service is opened.
* This method is called when the connection attempt completes,
@@ -93,48 +108,64 @@ public:
virtual int validate_connection (const ACE_Asynch_Connect::Result& result,
const ACE_INET_Addr &remote,
const ACE_INET_Addr& local);
+
//
// These are low level tweaking methods
//
+
/// Set and get flag that indicates if parsing and passing of
/// addresses to the service_handler is necessary.
virtual bool pass_addresses (void) const;
virtual void pass_addresses (bool new_value);
+
/// Set and get flag that indicates if address validation is
/// required.
virtual bool validate_new_connection (void) const;
virtual void validate_new_connection (bool new_value);
+
protected:
+
/// This is called when an outstanding accept completes.
virtual void handle_connect (const ACE_Asynch_Connect::Result &result);
+
/// This parses the address from read buffer.
void parse_address (const ACE_Asynch_Connect::Result &result,
ACE_INET_Addr &remote_address,
ACE_INET_Addr &local_address);
+
/// Return the asynch Connect object.
ACE_Asynch_Connect & asynch_connect (void);
+
/**
* This is the template method used to create new handler.
* Subclasses must overwrite this method if a new handler creation
* strategy is required.
*/
virtual HANDLER *make_handler (void);
+
private:
+
/// Asynch_Connect used to make life easier :-)
ACE_Asynch_Connect asynch_connect_;
+
/// Flag that indicates if parsing of addresses is necessary.
bool pass_addresses_;
+
/// Flag that indicates if address validation is required.
bool validate_new_connection_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Asynch_Connector.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Asynch_Connector.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#endif /* ACE_WIN32 || ACE_HAS_AIO_CALLS */
#include /**/ "ace/post.h"
#endif /* ACE_ASYNCH_CONNECTOR_H */
diff --git a/dep/ACE_wrappers/ace/Asynch_IO.cpp b/dep/ACE_wrappers/ace/Asynch_IO.cpp
index a4a254d91d6..f004fb0d234 100644
--- a/dep/ACE_wrappers/ace/Asynch_IO.cpp
+++ b/dep/ACE_wrappers/ace/Asynch_IO.cpp
@@ -1,79 +1,99 @@
// $Id: Asynch_IO.cpp 82559 2008-08-07 20:23:07Z parsons $
+
#include "ace/Asynch_IO.h"
+
ACE_RCSID(ace, Asynch_IO, "$Id: Asynch_IO.cpp 82559 2008-08-07 20:23:07Z parsons $")
+
#if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS)
// This only works on platforms with Asynchronous IO
+
#include "ace/Proactor.h"
#include "ace/Message_Block.h"
#include "ace/INET_Addr.h"
#include "ace/Asynch_IO_Impl.h"
#include "ace/os_include/os_errno.h"
#include "ace/Truncate.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
size_t
ACE_Asynch_Result::bytes_transferred (void) const
{
return this->implementation ()->bytes_transferred ();
}
+
const void *
ACE_Asynch_Result::act (void) const
{
return this->implementation ()->act ();
}
+
int
ACE_Asynch_Result::success (void) const
{
return this->implementation ()->success ();
}
+
const void *
ACE_Asynch_Result::completion_key (void) const
{
return this->implementation ()->completion_key ();
}
+
unsigned long
ACE_Asynch_Result::error (void) const
{
return this->implementation ()->error ();
}
+
ACE_HANDLE
ACE_Asynch_Result::event (void) const
{
return this->implementation ()->event ();
}
+
unsigned long
ACE_Asynch_Result::offset (void) const
{
return this->implementation ()->offset ();
}
+
unsigned long
ACE_Asynch_Result::offset_high (void) const
{
return this->implementation ()->offset_high ();
}
+
int
ACE_Asynch_Result::priority (void) const
{
return this->implementation ()->priority ();
}
+
int
ACE_Asynch_Result::signal_number (void) const
{
return this->implementation ()->signal_number ();
}
+
ACE_Asynch_Result::ACE_Asynch_Result (ACE_Asynch_Result_Impl *implementation)
: implementation_ (implementation)
{
}
+
ACE_Asynch_Result::~ACE_Asynch_Result (void)
{
// Proactor deletes the implementation when the <complete> finishes.
}
+
ACE_Asynch_Result_Impl *
ACE_Asynch_Result::implementation (void) const
{
return this->implementation_;
}
+
// *********************************************************************
+
int
ACE_Asynch_Operation::open (ACE_Handler &handler,
ACE_HANDLE handle,
@@ -85,6 +105,7 @@ ACE_Asynch_Operation::open (ACE_Handler &handler,
completion_key,
proactor);
}
+
int
ACE_Asynch_Operation::cancel (void)
{
@@ -95,6 +116,7 @@ ACE_Asynch_Operation::cancel (void)
}
return this->implementation ()->cancel ();
}
+
ACE_Proactor *
ACE_Asynch_Operation::proactor (void) const
{
@@ -105,12 +127,15 @@ ACE_Asynch_Operation::proactor (void) const
}
return this->implementation ()->proactor ();
}
+
ACE_Asynch_Operation::ACE_Asynch_Operation (void)
{
}
+
ACE_Asynch_Operation::~ACE_Asynch_Operation (void)
{
}
+
ACE_Proactor *
ACE_Asynch_Operation::get_proactor (ACE_Proactor *user_proactor,
ACE_Handler &handler) const
@@ -122,19 +147,24 @@ ACE_Asynch_Operation::get_proactor (ACE_Proactor *user_proactor,
if (user_proactor == 0)
user_proactor = ACE_Proactor::instance ();
}
+
return user_proactor;
}
+
// ************************************************************
+
ACE_Asynch_Read_Stream::ACE_Asynch_Read_Stream (void)
: implementation_ (0)
{
}
+
ACE_Asynch_Read_Stream::~ACE_Asynch_Read_Stream (void)
{
// Delete the implementation.
delete this->implementation_;
this->implementation_ = 0;
}
+
int
ACE_Asynch_Read_Stream::open (ACE_Handler &handler,
ACE_HANDLE handle,
@@ -143,15 +173,18 @@ ACE_Asynch_Read_Stream::open (ACE_Handler &handler,
{
// Get a proactor for/from the user.
proactor = this->get_proactor (proactor, handler);
+
// Now let us get the implementation initialized.
if ((this->implementation_ = proactor->create_asynch_read_stream ()) == 0)
return -1;
+
// Call the <open> method of the base class.
return ACE_Asynch_Operation::open (handler,
handle,
completion_key,
proactor);
}
+
int
ACE_Asynch_Read_Stream::read (ACE_Message_Block &message_block,
size_t bytes_to_read,
@@ -170,6 +203,7 @@ ACE_Asynch_Read_Stream::read (ACE_Message_Block &message_block,
priority,
signal_number);
}
+
#if defined (ACE_HAS_WIN32_OVERLAPPED_IO)
int
ACE_Asynch_Read_Stream::readv (ACE_Message_Block &message_block,
@@ -190,53 +224,65 @@ ACE_Asynch_Read_Stream::readv (ACE_Message_Block &message_block,
signal_number);
}
#endif /* ACE_HAS_WIN32_OVERLAPPED_IO */
+
ACE_Asynch_Operation_Impl *
ACE_Asynch_Read_Stream::implementation (void) const
{
return this->implementation_;
}
+
// ************************************************************
+
size_t
ACE_Asynch_Read_Stream::Result::bytes_to_read (void) const
{
return this->implementation ()->bytes_to_read ();
}
+
ACE_Message_Block &
ACE_Asynch_Read_Stream::Result::message_block (void) const
{
return this->implementation ()->message_block ();
}
+
ACE_HANDLE
ACE_Asynch_Read_Stream::Result::handle (void) const
{
return this->implementation ()->handle ();
}
+
ACE_Asynch_Read_Stream::Result::Result (ACE_Asynch_Read_Stream_Result_Impl *implementation)
: ACE_Asynch_Result (implementation),
implementation_ (implementation)
{
}
+
ACE_Asynch_Read_Stream::Result::~Result (void)
{
// Proactor will delete the implementation after <complete> is
// finished.
}
+
ACE_Asynch_Read_Stream_Result_Impl *
ACE_Asynch_Read_Stream::Result::implementation (void) const
{
return this->implementation_;
}
+
// ***************************************************
+
ACE_Asynch_Write_Stream::ACE_Asynch_Write_Stream (void)
: implementation_ (0)
{
}
+
ACE_Asynch_Write_Stream::~ACE_Asynch_Write_Stream (void)
{
// Delete the implementation.
delete this->implementation_;
this->implementation_ = 0;
}
+
int
ACE_Asynch_Write_Stream::open (ACE_Handler &handler,
ACE_HANDLE handle,
@@ -245,15 +291,18 @@ ACE_Asynch_Write_Stream::open (ACE_Handler &handler,
{
// Get a proactor for/from the user.
proactor = this->get_proactor (proactor, handler);
+
// Now let us get the implementation initialized.
if ((this->implementation_ = proactor->create_asynch_write_stream ()) == 0)
return -1;
+
// Call the <open> method of the base class.
return ACE_Asynch_Operation::open (handler,
handle,
completion_key,
proactor);
}
+
int
ACE_Asynch_Write_Stream::write (ACE_Message_Block &message_block,
size_t bytes_to_write,
@@ -272,6 +321,7 @@ ACE_Asynch_Write_Stream::write (ACE_Message_Block &message_block,
priority,
signal_number);
}
+
#if defined (ACE_HAS_WIN32_OVERLAPPED_IO)
int
ACE_Asynch_Write_Stream::writev (ACE_Message_Block &message_block,
@@ -292,53 +342,65 @@ ACE_Asynch_Write_Stream::writev (ACE_Message_Block &message_block,
signal_number);
}
#endif /* ACE_HAS_WIN32_OVERLAPPED_IO */
+
ACE_Asynch_Operation_Impl *
ACE_Asynch_Write_Stream::implementation (void) const
{
return this->implementation_;
}
+
// ************************************************************
+
size_t
ACE_Asynch_Write_Stream::Result::bytes_to_write (void) const
{
return this->implementation ()->bytes_to_write ();
}
+
ACE_Message_Block &
ACE_Asynch_Write_Stream::Result::message_block (void) const
{
return this->implementation ()->message_block ();
}
+
ACE_HANDLE
ACE_Asynch_Write_Stream::Result::handle (void) const
{
return this->implementation ()->handle ();
}
+
ACE_Asynch_Write_Stream::Result::Result (ACE_Asynch_Write_Stream_Result_Impl *implementation)
: ACE_Asynch_Result (implementation),
implementation_ (implementation)
{
}
+
ACE_Asynch_Write_Stream::Result::~Result (void)
{
// Proactor will delte the implementation when the <complete> call
// finishes.
}
+
ACE_Asynch_Write_Stream_Result_Impl *
ACE_Asynch_Write_Stream::Result::implementation (void) const
{
return this->implementation_;
}
+
// ************************************************************
+
ACE_Asynch_Read_File::ACE_Asynch_Read_File (void)
: implementation_ (0)
{
}
+
ACE_Asynch_Read_File::~ACE_Asynch_Read_File (void)
{
// Delete the implementation.
delete this->implementation_;
this->implementation_ = 0;
}
+
int
ACE_Asynch_Read_File::open (ACE_Handler &handler,
ACE_HANDLE handle,
@@ -347,15 +409,18 @@ ACE_Asynch_Read_File::open (ACE_Handler &handler,
{
// Get a proactor for/from the user.
proactor = this->get_proactor (proactor, handler);
+
// Now let us get the implementation initialized.
if ((this->implementation_ = proactor->create_asynch_read_file ()) == 0)
return -1;
+
// Call the <open> method of the base class.
return ACE_Asynch_Operation::open (handler,
handle,
completion_key,
proactor);
}
+
int
ACE_Asynch_Read_File::read (ACE_Message_Block &message_block,
size_t bytes_to_read,
@@ -378,6 +443,7 @@ ACE_Asynch_Read_File::read (ACE_Message_Block &message_block,
priority,
signal_number);
}
+
#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE))
int
ACE_Asynch_Read_File::readv (ACE_Message_Block &message_block,
@@ -402,38 +468,47 @@ ACE_Asynch_Read_File::readv (ACE_Message_Block &message_block,
signal_number);
}
#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */
+
ACE_Asynch_Operation_Impl *
ACE_Asynch_Read_File::implementation (void) const
{
return this->implementation_;
}
+
// ************************************************************
+
ACE_Asynch_Read_File::Result::Result (ACE_Asynch_Read_File_Result_Impl *implementation)
: ACE_Asynch_Read_Stream::Result (implementation),
implementation_ (implementation)
{
}
+
ACE_Asynch_Read_File::Result::~Result (void)
{
// Proactor will delete the implementation when <complete> call
// completes.
}
+
ACE_Asynch_Read_File_Result_Impl *
ACE_Asynch_Read_File::Result::implementation (void) const
{
return this->implementation_;
}
+
// ************************************************************
+
ACE_Asynch_Write_File::ACE_Asynch_Write_File (void)
: implementation_ (0)
{
}
+
ACE_Asynch_Write_File::~ACE_Asynch_Write_File (void)
{
// Delete the implementation.
delete this->implementation_;
this->implementation_ = 0;
}
+
int
ACE_Asynch_Write_File::open (ACE_Handler &handler,
ACE_HANDLE handle,
@@ -442,15 +517,18 @@ ACE_Asynch_Write_File::open (ACE_Handler &handler,
{
// Get a proactor for/from the user.
proactor = this->get_proactor (proactor, handler);
+
// Now let us get the implementation initialized.
if ((this->implementation_ = proactor->create_asynch_write_file ()) == 0)
return -1;
+
// Call the <open> method of the base class.
return ACE_Asynch_Operation::open (handler,
handle,
completion_key,
proactor);
}
+
int
ACE_Asynch_Write_File::write (ACE_Message_Block &message_block,
size_t bytes_to_write,
@@ -473,6 +551,7 @@ ACE_Asynch_Write_File::write (ACE_Message_Block &message_block,
priority,
signal_number);
}
+
#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE))
int
ACE_Asynch_Write_File::writev (ACE_Message_Block &message_block,
@@ -497,38 +576,47 @@ ACE_Asynch_Write_File::writev (ACE_Message_Block &message_block,
signal_number);
}
#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */
+
ACE_Asynch_Operation_Impl *
ACE_Asynch_Write_File::implementation (void) const
{
return this->implementation_;
}
+
// ************************************************************
+
ACE_Asynch_Write_File::Result::Result (ACE_Asynch_Write_File_Result_Impl *implementation)
: ACE_Asynch_Write_Stream::Result (implementation),
implementation_ (implementation)
{
}
+
ACE_Asynch_Write_File::Result::~Result (void)
{
// Proactor will delete the implementation when the <complete> call
// completes.
}
+
ACE_Asynch_Write_File_Result_Impl *
ACE_Asynch_Write_File::Result::implementation (void) const
{
return this->implementation_;
}
+
// *********************************************************************
+
ACE_Asynch_Accept::ACE_Asynch_Accept (void)
: implementation_ (0)
{
}
+
ACE_Asynch_Accept::~ACE_Asynch_Accept (void)
{
// Delete the implementation.
delete this->implementation_;
this->implementation_ = 0;
}
+
int
ACE_Asynch_Accept::open (ACE_Handler &handler,
ACE_HANDLE handle,
@@ -537,15 +625,18 @@ ACE_Asynch_Accept::open (ACE_Handler &handler,
{
// Get a proactor for/from the user.
proactor = this->get_proactor (proactor, handler);
+
// Now let us get the implementation initialized.
if ((this->implementation_ = proactor->create_asynch_accept ()) == 0)
return -1;
+
// Call the <open> method of the base class.
return ACE_Asynch_Operation::open (handler,
handle,
completion_key,
proactor);
}
+
int
ACE_Asynch_Accept::accept (ACE_Message_Block &message_block,
size_t bytes_to_read,
@@ -568,59 +659,73 @@ ACE_Asynch_Accept::accept (ACE_Message_Block &message_block,
signal_number,
addr_family);
}
+
ACE_Asynch_Operation_Impl *
ACE_Asynch_Accept::implementation (void) const
{
return this->implementation_;
}
+
// ************************************************************
+
size_t
ACE_Asynch_Accept::Result::bytes_to_read (void) const
{
return this->implementation ()->bytes_to_read ();
}
+
ACE_Message_Block &
ACE_Asynch_Accept::Result::message_block (void) const
{
return this->implementation ()->message_block ();
}
+
ACE_HANDLE
ACE_Asynch_Accept::Result::listen_handle (void) const
{
return this->implementation ()->listen_handle ();
}
+
ACE_HANDLE
ACE_Asynch_Accept::Result::accept_handle (void) const
{
return this->implementation ()->accept_handle ();
}
+
ACE_Asynch_Accept::Result::Result (ACE_Asynch_Accept_Result_Impl *implementation)
: ACE_Asynch_Result (implementation),
implementation_ (implementation)
{
}
+
ACE_Asynch_Accept::Result::~Result (void)
{
// Proactor will delete the implementation when the <complete> call
// completes.
}
+
ACE_Asynch_Accept_Result_Impl *
ACE_Asynch_Accept::Result::implementation (void) const
{
return this->implementation_;
}
+
+
// *********************************************************************
+
ACE_Asynch_Connect::ACE_Asynch_Connect (void)
: implementation_ (0)
{
}
+
ACE_Asynch_Connect::~ACE_Asynch_Connect (void)
{
// Delete the implementation.
delete this->implementation_;
this->implementation_ = 0;
}
+
int
ACE_Asynch_Connect::open (ACE_Handler &handler,
ACE_HANDLE handle,
@@ -629,15 +734,18 @@ ACE_Asynch_Connect::open (ACE_Handler &handler,
{
// Get a proactor for/from the user.
proactor = this->get_proactor (proactor, handler);
+
// Now let us get the implementation initialized.
if ((this->implementation_ = proactor->create_asynch_connect ()) == 0)
return -1;
+
// Call the <open> method of the base class.
return ACE_Asynch_Operation::open (handler,
handle,
completion_key,
proactor);
}
+
int
ACE_Asynch_Connect::connect (ACE_HANDLE connect_handle,
const ACE_Addr & remote_sap,
@@ -660,44 +768,54 @@ ACE_Asynch_Connect::connect (ACE_HANDLE connect_handle,
priority,
signal_number);
}
+
ACE_Asynch_Operation_Impl *
ACE_Asynch_Connect::implementation (void) const
{
return this->implementation_;
}
+
// ************************************************************
+
ACE_Asynch_Connect::Result::Result (ACE_Asynch_Connect_Result_Impl *implementation)
: ACE_Asynch_Result (implementation),
implementation_ (implementation)
{
}
+
ACE_Asynch_Connect::Result::~Result (void)
{
// Proactor will delete the implementation when the <complete> call
// completes.
}
+
ACE_HANDLE
ACE_Asynch_Connect::Result::connect_handle (void) const
{
return this->implementation ()->connect_handle ();
}
+
ACE_Asynch_Connect_Result_Impl *
ACE_Asynch_Connect::Result::implementation (void) const
{
return this->implementation_;
}
+
// ************************************************************
+
ACE_Asynch_Transmit_File::ACE_Asynch_Transmit_File (void)
: implementation_ (0)
{
}
+
ACE_Asynch_Transmit_File::~ACE_Asynch_Transmit_File (void)
{
// Delete the implementation.
delete this->implementation_;
this->implementation_ = 0;
}
+
int
ACE_Asynch_Transmit_File::open (ACE_Handler &handler,
ACE_HANDLE handle,
@@ -706,15 +824,18 @@ ACE_Asynch_Transmit_File::open (ACE_Handler &handler,
{
// Get a proactor for/from the user.
proactor = this->get_proactor (proactor, handler);
+
// Now let us get the implementation initialized.
if ((this->implementation_ = proactor->create_asynch_transmit_file ()) == 0)
return -1;
+
// Call the <open> method of the base class.
return ACE_Asynch_Operation::open (handler,
handle,
completion_key,
proactor);
}
+
int
ACE_Asynch_Transmit_File::transmit_file (ACE_HANDLE file,
Header_And_Trailer *header_and_trailer,
@@ -743,56 +864,69 @@ ACE_Asynch_Transmit_File::transmit_file (ACE_HANDLE file,
priority,
signal_number);
}
+
ACE_Asynch_Operation_Impl *
ACE_Asynch_Transmit_File::implementation (void) const
{
return this->implementation_;
}
+
// ****************************************************************************
+
ACE_HANDLE
ACE_Asynch_Transmit_File::Result::socket (void) const
{
return this->implementation ()->socket ();
}
+
ACE_HANDLE
ACE_Asynch_Transmit_File::Result::file (void) const
{
return this->implementation ()->file ();
}
+
ACE_Asynch_Transmit_File::Header_And_Trailer *
ACE_Asynch_Transmit_File::Result::header_and_trailer (void) const
{
return this->implementation ()->header_and_trailer ();
}
+
size_t
ACE_Asynch_Transmit_File::Result::bytes_to_write (void) const
{
return this->implementation ()->bytes_to_write ();
}
+
size_t
ACE_Asynch_Transmit_File::Result::bytes_per_send (void) const
{
return this->implementation ()->bytes_per_send ();
}
+
unsigned long
ACE_Asynch_Transmit_File::Result::flags (void) const
{
return this->implementation ()->flags ();
}
+
ACE_Asynch_Transmit_File::Result::Result (ACE_Asynch_Transmit_File_Result_Impl *implementation)
: ACE_Asynch_Result (implementation),
implementation_ (implementation)
{
}
+
ACE_Asynch_Transmit_File::Result::~Result (void)
{
}
+
ACE_Asynch_Transmit_File_Result_Impl *
ACE_Asynch_Transmit_File::Result::implementation (void) const
{
return this->implementation_;
}
+
// ************************************************************
+
ACE_Asynch_Transmit_File::Header_And_Trailer::Header_And_Trailer (ACE_Message_Block *header,
size_t header_bytes,
ACE_Message_Block *trailer,
@@ -803,9 +937,11 @@ ACE_Asynch_Transmit_File::Header_And_Trailer::Header_And_Trailer (ACE_Message_Bl
trailer_bytes_ (trailer_bytes)
{
}
+
ACE_Asynch_Transmit_File::Header_And_Trailer::~Header_And_Trailer (void)
{
}
+
void
ACE_Asynch_Transmit_File::Header_And_Trailer::header_and_trailer (ACE_Message_Block *header,
size_t header_bytes,
@@ -817,46 +953,55 @@ ACE_Asynch_Transmit_File::Header_And_Trailer::header_and_trailer (ACE_Message_Bl
this->trailer (trailer);
this->trailer_bytes (trailer_bytes);
}
+
ACE_Message_Block *
ACE_Asynch_Transmit_File::Header_And_Trailer::header (void) const
{
return this->header_;
}
+
void
ACE_Asynch_Transmit_File::Header_And_Trailer::header (ACE_Message_Block *message_block)
{
this->header_ = message_block;
}
+
size_t
ACE_Asynch_Transmit_File::Header_And_Trailer::header_bytes (void) const
{
return this->header_bytes_;
}
+
void
ACE_Asynch_Transmit_File::Header_And_Trailer::header_bytes (size_t bytes)
{
this->header_bytes_ = bytes;
}
+
ACE_Message_Block *
ACE_Asynch_Transmit_File::Header_And_Trailer::trailer (void) const
{
return this->trailer_;
}
+
void
ACE_Asynch_Transmit_File::Header_And_Trailer::trailer (ACE_Message_Block *message_block)
{
this->trailer_ = message_block;
}
+
size_t
ACE_Asynch_Transmit_File::Header_And_Trailer::trailer_bytes (void) const
{
return this->trailer_bytes_;
}
+
void
ACE_Asynch_Transmit_File::Header_And_Trailer::trailer_bytes (size_t bytes)
{
this->trailer_bytes_ = bytes;
}
+
ACE_LPTRANSMIT_FILE_BUFFERS
ACE_Asynch_Transmit_File::Header_And_Trailer::transmit_buffers (void)
{
@@ -868,6 +1013,7 @@ ACE_Asynch_Transmit_File::Header_And_Trailer::transmit_buffers (void)
else
{
// Something is valid
+
// If header is valid, set the fields
if (this->header_ != 0)
{
@@ -884,6 +1030,7 @@ ACE_Asynch_Transmit_File::Header_And_Trailer::transmit_buffers (void)
this->transmit_buffers_.Head = 0;
this->transmit_buffers_.HeadLength = 0;
}
+
// If trailer is valid, set the fields
if (this->trailer_ != 0)
{
@@ -900,11 +1047,14 @@ ACE_Asynch_Transmit_File::Header_And_Trailer::transmit_buffers (void)
this->transmit_buffers_.Tail = 0;
this->transmit_buffers_.TailLength = 0;
}
+
// Return the transmit buffers
return &this->transmit_buffers_;
}
}
+
// *********************************************************************
+
ACE_Handler::ACE_Handler (void)
: proactor_ (0), handle_ (ACE_INVALID_HANDLE)
{
@@ -912,6 +1062,7 @@ ACE_Handler::ACE_Handler (void)
ACE_NEW (p, ACE_Handler::Proxy (this));
this->proxy_.reset (p);
}
+
ACE_Handler::ACE_Handler (ACE_Proactor *d)
: proactor_ (d), handle_ (ACE_INVALID_HANDLE)
{
@@ -919,115 +1070,142 @@ ACE_Handler::ACE_Handler (ACE_Proactor *d)
ACE_NEW (p, ACE_Handler::Proxy (this));
this->proxy_.reset (p);
}
+
ACE_Handler::~ACE_Handler (void)
{
ACE_Handler::Proxy *p = this->proxy_.get ();
if (p)
p->reset ();
}
+
void
ACE_Handler::handle_read_stream (const ACE_Asynch_Read_Stream::Result & /* result */)
{
}
+
void
ACE_Handler::handle_write_stream (const ACE_Asynch_Write_Stream::Result & /* result */)
{
}
+
void
ACE_Handler::handle_write_dgram (const ACE_Asynch_Write_Dgram::Result & /* result */)
{
}
+
void
ACE_Handler::handle_read_dgram (const ACE_Asynch_Read_Dgram::Result & /* result */)
{
}
+
void
ACE_Handler::handle_accept (const ACE_Asynch_Accept::Result & /* result */)
{
}
+
void
ACE_Handler::handle_connect (const ACE_Asynch_Connect::Result & /* result */)
{
}
+
void
ACE_Handler::handle_transmit_file (const ACE_Asynch_Transmit_File::Result & /* result */)
{
}
+
void
ACE_Handler::handle_read_file (const ACE_Asynch_Read_File::Result & /* result */)
{
}
+
void
ACE_Handler::handle_write_file (const ACE_Asynch_Write_File::Result & /* result */)
{
}
+
void
ACE_Handler::handle_time_out (const ACE_Time_Value & /* tv */,
const void * /* act */)
{
}
+
void
ACE_Handler::handle_wakeup (void)
{
}
+
ACE_Proactor *
ACE_Handler::proactor (void)
{
return this->proactor_;
}
+
void
ACE_Handler::proactor (ACE_Proactor *p)
{
this->proactor_ = p;
}
+
ACE_HANDLE
ACE_Handler::handle (void) const
{
return this->handle_;
}
+
void
ACE_Handler::handle (ACE_HANDLE h)
{
this->handle_ = h;
}
+
ACE_Refcounted_Auto_Ptr<ACE_Handler::Proxy, ACE_SYNCH_MUTEX> &
ACE_Handler::proxy (void)
{
return this->proxy_;
}
+
// ************************************************************
+
ACE_Service_Handler::ACE_Service_Handler (void)
{
}
+
ACE_Service_Handler::~ACE_Service_Handler (void)
{
}
+
void
ACE_Service_Handler::addresses (const ACE_INET_Addr & /* remote_address */,
const ACE_INET_Addr & /* local_address */ )
{
}
+
void
ACE_Service_Handler::act (const void *)
{
}
+
void
ACE_Service_Handler::open (ACE_HANDLE,
ACE_Message_Block &)
{
}
+
// ************************************************************
+
ACE_Asynch_Read_Dgram::ACE_Asynch_Read_Dgram (void)
: implementation_ (0)
{
}
+
ACE_Asynch_Read_Dgram::~ACE_Asynch_Read_Dgram (void)
{
// Delete the implementation.
delete this->implementation_;
this->implementation_ = 0;
}
+
int
ACE_Asynch_Read_Dgram::open (ACE_Handler &handler,
ACE_HANDLE handle,
@@ -1036,15 +1214,18 @@ ACE_Asynch_Read_Dgram::open (ACE_Handler &handler,
{
// Get a proactor for/from the user.
proactor = this->get_proactor (proactor, handler);
+
// Now let us get the implementation initialized.
if ((this->implementation_ = proactor->create_asynch_read_dgram ()) == 0)
return -1;
+
// Call the <open> method of the base class.
return ACE_Asynch_Operation::open (handler,
handle,
completion_key,
proactor);
}
+
ssize_t
ACE_Asynch_Read_Dgram::recv (ACE_Message_Block *message_block,
size_t &number_of_bytes_recvd,
@@ -1067,62 +1248,76 @@ ACE_Asynch_Read_Dgram::recv (ACE_Message_Block *message_block,
priority,
signal_number);
}
+
ACE_Asynch_Operation_Impl *
ACE_Asynch_Read_Dgram::implementation (void) const
{
return this->implementation_;
}
+
// ************************************************************
+
int
ACE_Asynch_Read_Dgram::Result::remote_address (ACE_Addr& addr) const
{
return this->implementation ()->remote_address (addr);
}
+
ACE_Message_Block*
ACE_Asynch_Read_Dgram::Result::message_block (void) const
{
return this->implementation ()->message_block ();
}
+
int
ACE_Asynch_Read_Dgram::Result::flags (void) const
{
return this->implementation ()->flags ();
}
+
size_t
ACE_Asynch_Read_Dgram::Result::bytes_to_read (void) const
{
return this->implementation ()->bytes_to_read ();
}
+
ACE_HANDLE
ACE_Asynch_Read_Dgram::Result::handle (void) const
{
return this->implementation ()->handle();
}
+
ACE_Asynch_Read_Dgram::Result::Result (ACE_Asynch_Read_Dgram_Result_Impl *implementation)
: ACE_Asynch_Result (implementation),
implementation_ (implementation)
{
}
+
ACE_Asynch_Read_Dgram::Result::~Result (void)
{
}
+
ACE_Asynch_Read_Dgram_Result_Impl *
ACE_Asynch_Read_Dgram::Result::implementation (void) const
{
return this->implementation_;
}
+
// ************************************************************
+
ACE_Asynch_Write_Dgram::ACE_Asynch_Write_Dgram (void)
: implementation_ (0)
{
}
+
ACE_Asynch_Write_Dgram::~ACE_Asynch_Write_Dgram (void)
{
// Delete the implementation.
delete this->implementation_;
this->implementation_ = 0;
}
+
int
ACE_Asynch_Write_Dgram::open (ACE_Handler &handler,
ACE_HANDLE handle,
@@ -1131,15 +1326,18 @@ ACE_Asynch_Write_Dgram::open (ACE_Handler &handler,
{
// Get a proactor for/from the user.
proactor = this->get_proactor (proactor, handler);
+
// Now let us get the implementation initialized.
if ((this->implementation_ = proactor->create_asynch_write_dgram ()) == 0)
return -1;
+
// Call the <open> method of the base class.
return ACE_Asynch_Operation::open (handler,
handle,
completion_key,
proactor);
}
+
ssize_t
ACE_Asynch_Write_Dgram::send (ACE_Message_Block *message_block,
size_t &number_of_bytes_sent,
@@ -1162,45 +1360,56 @@ ACE_Asynch_Write_Dgram::send (ACE_Message_Block *message_block,
priority,
signal_number);
}
+
ACE_Asynch_Operation_Impl *
ACE_Asynch_Write_Dgram::implementation (void) const
{
return this->implementation_;
}
+
// ************************************************************
+
size_t
ACE_Asynch_Write_Dgram::Result::bytes_to_write (void) const
{
return this->implementation ()->bytes_to_write ();
}
+
ACE_Message_Block*
ACE_Asynch_Write_Dgram::Result::message_block () const
{
return this->implementation ()->message_block ();
}
+
int
ACE_Asynch_Write_Dgram::Result::flags (void) const
{
return this->implementation ()->flags ();
}
+
ACE_HANDLE
ACE_Asynch_Write_Dgram::Result::handle (void) const
{
return this->implementation ()->handle ();
}
+
ACE_Asynch_Write_Dgram_Result_Impl *
ACE_Asynch_Write_Dgram::Result::implementation (void) const
{
return this->implementation_;
}
+
ACE_Asynch_Write_Dgram::Result::Result (ACE_Asynch_Write_Dgram_Result_Impl *implementation)
: ACE_Asynch_Result (implementation),
implementation_ (implementation)
{
}
+
ACE_Asynch_Write_Dgram::Result::~Result (void)
{
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */
diff --git a/dep/ACE_wrappers/ace/Asynch_IO.h b/dep/ACE_wrappers/ace/Asynch_IO.h
index ce28f64ae1a..3b5004ce46e 100644
--- a/dep/ACE_wrappers/ace/Asynch_IO.h
+++ b/dep/ACE_wrappers/ace/Asynch_IO.h
@@ -1,4 +1,5 @@
/* -*- C++ -*- */
+
//=============================================================================
/**
* @file Asynch_IO.h
@@ -21,14 +22,19 @@
* @author Alexander Libman <alibman@ihug.com.au>
*/
//=============================================================================
+
#ifndef ACE_ASYNCH_IO_H
#define ACE_ASYNCH_IO_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
#pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS)
+
#include "ace/Synch_Traits.h"
#if defined (ACE_HAS_THREADS)
# include "ace/Thread_Mutex.h"
@@ -36,14 +42,18 @@
# include "ace/Null_Mutex.h"
#endif /* ACE_HAS_THREADS */
#include "ace/Refcounted_Auto_Ptr.h"
+
#include "ace/os_include/os_signal.h"
#include "ace/os_include/sys/os_socket.h"
#include "ace/os_include/sys/os_types.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
# if defined (ACE_HAS_WIN32_OVERLAPPED_IO)
typedef TRANSMIT_FILE_BUFFERS ACE_TRANSMIT_FILE_BUFFERS;
typedef LPTRANSMIT_FILE_BUFFERS ACE_LPTRANSMIT_FILE_BUFFERS;
typedef PTRANSMIT_FILE_BUFFERS ACE_PTRANSMIT_FILE_BUFFERS;
+
# define ACE_INFINITE INFINITE
# define ACE_STATUS_TIMEOUT STATUS_TIMEOUT
# define ACE_WAIT_FAILED WAIT_FAILED
@@ -58,6 +68,7 @@ struct ACE_TRANSMIT_FILE_BUFFERS
};
typedef ACE_TRANSMIT_FILE_BUFFERS* ACE_PTRANSMIT_FILE_BUFFERS;
typedef ACE_TRANSMIT_FILE_BUFFERS* ACE_LPTRANSMIT_FILE_BUFFERS;
+
# if !defined (ACE_INFINITE)
# define ACE_INFINITE LONG_MAX
# endif /* ACE_INFINITE */
@@ -65,15 +76,18 @@ typedef ACE_TRANSMIT_FILE_BUFFERS* ACE_LPTRANSMIT_FILE_BUFFERS;
# define ACE_WAIT_FAILED LONG_MAX
# define ACE_WAIT_TIMEOUT LONG_MAX
# endif /* ACE_HAS_WIN32_OVERLAPPED_IO */
+
// Forward declarations
class ACE_Proactor;
class ACE_Handler;
class ACE_Message_Block;
class ACE_INET_Addr;
class ACE_Addr;
+
// Forward declarations
class ACE_Asynch_Result_Impl;
class ACE_Time_Value;
+
/**
* @class ACE_Asynch_Result
*
@@ -89,13 +103,17 @@ class ACE_Time_Value;
*/
class ACE_Export ACE_Asynch_Result
{
+
public:
/// Number of bytes transferred by the operation.
size_t bytes_transferred (void) const;
+
/// ACT associated with the operation.
const void *act (void) const;
+
/// Did the operation succeed?
int success (void) const;
+
/**
* This is the ACT associated with the handle on which the
* Asynch_Operation takes place.
@@ -106,8 +124,10 @@ public:
* @@ This is not implemented for POSIX4 platforms. Returns 0.
*/
const void *completion_key (void) const;
+
/// Error value if the operation fails.
unsigned long error (void) const;
+
/**
* On WIN32, this returns the event associated with the OVERLAPPED
* structure.
@@ -115,6 +135,7 @@ public:
* This returns ACE_INVALID_HANDLE on POSIX4-Unix platforms.
*/
ACE_HANDLE event (void) const;
+
/**
* This really makes sense only when doing file I/O.
*
@@ -125,6 +146,7 @@ public:
*/
unsigned long offset (void) const;
unsigned long offset_high (void) const;
+
/**
* Priority of the operation.
*
@@ -136,6 +158,7 @@ public:
* On Win32, this is a no-op.
*/
int priority (void) const;
+
/**
* POSIX4 real-time signal number to be used for the
* operation. {signal_number} ranges from ACE_SIGRTMIN to ACE_SIGRTMAX. By
@@ -144,19 +167,25 @@ public:
*/
int signal_number (void) const;
+
/// Destructor.
virtual ~ACE_Asynch_Result (void);
+
protected:
/// Constructor. This implementation will not be deleted. The
/// implementation will be deleted by the Proactor.
ACE_Asynch_Result (ACE_Asynch_Result_Impl *implementation);
+
/// Get the implementation class.
ACE_Asynch_Result_Impl *implementation (void) const;
+
/// Implementation class.
ACE_Asynch_Result_Impl *implementation_;
};
+
// Forward declarations
class ACE_Asynch_Operation_Impl;
+
/**
* @class ACE_Asynch_Operation
*
@@ -171,6 +200,7 @@ class ACE_Asynch_Operation_Impl;
*/
class ACE_Export ACE_Asynch_Operation
{
+
public:
/**
* Initializes the factory with information which will be used with
@@ -182,6 +212,7 @@ public:
ACE_HANDLE handle,
const void *completion_key,
ACE_Proactor *proactor);
+
/**
* (Attempts to) cancel the asynchronous operation pending against
* the {handle} registered with this Operation.
@@ -219,23 +250,31 @@ public:
*/
int cancel (void);
+
// = Access methods.
+
/// Return the underlying proactor.
ACE_Proactor* proactor (void) const;
+
/// Destructor.
virtual ~ACE_Asynch_Operation (void);
+
protected:
/// Constructor.
ACE_Asynch_Operation (void);
+
/// Return the underlying implementation class.
virtual ACE_Asynch_Operation_Impl *implementation (void) const = 0;
+
/// Get a proactor for/from the user
ACE_Proactor *get_proactor (ACE_Proactor *user_proactor,
ACE_Handler &handler) const;
};
+
// Forward declarations
class ACE_Asynch_Read_Stream_Result_Impl;
class ACE_Asynch_Read_Stream_Impl;
+
/**
* @class ACE_Asynch_Read_Stream
*
@@ -251,11 +290,14 @@ class ACE_Asynch_Read_Stream_Impl;
*/
class ACE_Export ACE_Asynch_Read_Stream : public ACE_Asynch_Operation
{
+
public:
/// A do nothing constructor.
ACE_Asynch_Read_Stream (void);
+
/// Destructor
virtual ~ACE_Asynch_Read_Stream (void);
+
/**
* Initializes the factory with information which will be used with
* each asynchronous call.
@@ -274,6 +316,7 @@ public:
ACE_HANDLE handle = ACE_INVALID_HANDLE,
const void *completion_key = 0,
ACE_Proactor *proactor = 0);
+
/**
* Initiate an asynchronous read operation.
*
@@ -303,6 +346,7 @@ public:
const void *act = 0,
int priority = 0,
int signal_number = ACE_SIGRTMIN);
+
#if defined (ACE_HAS_WIN32_OVERLAPPED_IO)
/**
* Same as above but with scatter support, through chaining of composite
@@ -314,12 +358,15 @@ public:
int priority = 0,
int signal_number = ACE_SIGRTMIN);
#endif /* defined (ACE_HAS_WIN32_OVERLAPPED_IO) */
+
/// Return the underlying implementation class.
// (this should be protected...)
virtual ACE_Asynch_Operation_Impl *implementation (void) const;
+
protected:
/// Implementation class that all methods will be forwarded to.
ACE_Asynch_Read_Stream_Impl *implementation_;
+
public:
/**
* @class Result
@@ -334,32 +381,42 @@ public:
*/
class ACE_Export Result : public ACE_Asynch_Result
{
+
/// The concrete implementation result classes only construct this
/// class.
friend class ACE_POSIX_Asynch_Read_Stream_Result;
friend class ACE_WIN32_Asynch_Read_Stream_Result;
+
public:
/// The number of bytes which were requested at the start of the
/// asynchronous read.
size_t bytes_to_read (void) const;
+
/// Message block which contains the read data.
ACE_Message_Block &message_block (void) const;
+
/// I/O handle used for reading.
ACE_HANDLE handle (void) const;
+
/// Get the implementation class.
ACE_Asynch_Read_Stream_Result_Impl *implementation (void) const;
+
protected:
/// Constructor.
Result (ACE_Asynch_Read_Stream_Result_Impl *implementation);
+
/// Destructor.
virtual ~Result (void);
+
/// The implementation class.
ACE_Asynch_Read_Stream_Result_Impl *implementation_;
};
};
+
// Forward declarations
class ACE_Asynch_Write_Stream_Impl;
class ACE_Asynch_Write_Stream_Result_Impl;
+
/**
* @class ACE_Asynch_Write_Stream
*
@@ -374,11 +431,14 @@ class ACE_Asynch_Write_Stream_Result_Impl;
*/
class ACE_Export ACE_Asynch_Write_Stream : public ACE_Asynch_Operation
{
+
public:
/// A do nothing constructor.
ACE_Asynch_Write_Stream (void);
+
/// Destructor.
virtual ~ACE_Asynch_Write_Stream (void);
+
/**
* Initializes the factory with information which will be used with
* each asynchronous operation.
@@ -403,6 +463,7 @@ public:
ACE_HANDLE handle = ACE_INVALID_HANDLE,
const void *completion_key = 0,
ACE_Proactor *proactor = 0);
+
/**
* Initiates an asynchronous write on a socket. If the operation completes
* the ACE_Handler object registered in open() will receive a completion
@@ -438,6 +499,7 @@ public:
const void *act = 0,
int priority = 0,
int signal_number = ACE_SIGRTMIN);
+
#if defined (ACE_HAS_WIN32_OVERLAPPED_IO)
/**
* Same as above but with gather support, through chaining of composite
@@ -449,12 +511,15 @@ public:
int priority = 0,
int signal_number = ACE_SIGRTMIN);
#endif /* defined (ACE_HAS_WIN32_OVERLAPPED_IO) */
+
/// Return the underlying implementation class.
/// @todo (this should be protected...)
virtual ACE_Asynch_Operation_Impl *implementation (void) const;
+
protected:
/// Implementation class that all methods will be forwarded to.
ACE_Asynch_Write_Stream_Impl *implementation_;
+
public:
/**
* @class Result
@@ -469,32 +534,42 @@ public:
*/
class ACE_Export Result : public ACE_Asynch_Result
{
+
/// The concrete implementation result classes only construct this
/// class.
friend class ACE_POSIX_Asynch_Write_Stream_Result;
friend class ACE_WIN32_Asynch_Write_Stream_Result;
+
public:
/// The number of bytes which were requested at the start of the
/// asynchronous write.
size_t bytes_to_write (void) const;
+
/// Message block that contains the data to be written.
ACE_Message_Block &message_block (void) const;
+
/// I/O handle used for writing.
ACE_HANDLE handle (void) const;
+
/// Get the implementation class.
ACE_Asynch_Write_Stream_Result_Impl *implementation (void) const;
+
protected:
/// Constructor.
Result (ACE_Asynch_Write_Stream_Result_Impl *implementation);
+
/// Destructor.
virtual ~Result (void);
+
/// Implementation class.
ACE_Asynch_Write_Stream_Result_Impl *implementation_;
};
};
+
// Forward declarations
class ACE_Asynch_Read_File_Impl;
class ACE_Asynch_Read_File_Result_Impl;
+
/**
* @class ACE_Asynch_Read_File
*
@@ -512,11 +587,14 @@ class ACE_Asynch_Read_File_Result_Impl;
*/
class ACE_Export ACE_Asynch_Read_File : public ACE_Asynch_Read_Stream
{
+
public:
/// A do nothing constructor.
ACE_Asynch_Read_File (void);
+
/// Destructor.
virtual ~ACE_Asynch_Read_File (void);
+
/**
* Initializes the factory with information which will be used with
* each asynchronous operation.
@@ -542,6 +620,7 @@ public:
ACE_HANDLE handle = ACE_INVALID_HANDLE,
const void *completion_key = 0,
ACE_Proactor *proactor = 0);
+
/**
* This starts off an asynchronous read. Upto {bytes_to_read} will
* be read and stored in the {message_block}. The read will start
@@ -562,6 +641,7 @@ public:
const void *act = 0,
int priority = 0,
int signal_number = ACE_SIGRTMIN);
+
#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE))
/**
* Same as above but with scatter support, through chaining of composite
@@ -577,13 +657,16 @@ public:
int priority = 0,
int signal_number = ACE_SIGRTMIN);
#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */
+
/// Return the underlying implementation class.
// (this should be protected...)
virtual ACE_Asynch_Operation_Impl *implementation (void) const;
+
protected:
/// Delegation/implementation class that all methods will be
/// forwarded to.
ACE_Asynch_Read_File_Impl *implementation_;
+
public:
/**
* @class Result
@@ -604,29 +687,37 @@ public:
*/
class ACE_Export Result : public ACE_Asynch_Read_Stream::Result
{
+
/// The concrete implementation result classes only construct this
/// class.
friend class ACE_POSIX_Asynch_Read_File_Result;
friend class ACE_WIN32_Asynch_Read_File_Result;
+
public:
/// Get the implementation class.
ACE_Asynch_Read_File_Result_Impl *implementation (void) const;
+
protected:
/// Constructor. This implementation will not be deleted.
Result (ACE_Asynch_Read_File_Result_Impl *implementation);
+
/// Destructor.
virtual ~Result (void);
+
/// The implementation class.
ACE_Asynch_Read_File_Result_Impl *implementation_;
+
private:
/// Here just to provide an dummpy implementation, since the
/// one auto generated by MSVC is flagged as infinitely recursive
void operator= (Result &) {}
};
};
+
// Forward declarations
class ACE_Asynch_Write_File_Impl;
class ACE_Asynch_Write_File_Result_Impl;
+
/**
* @class ACE_Asynch_Write_File
*
@@ -644,11 +735,14 @@ class ACE_Asynch_Write_File_Result_Impl;
*/
class ACE_Export ACE_Asynch_Write_File : public ACE_Asynch_Write_Stream
{
+
public:
/// A do nothing constructor.
ACE_Asynch_Write_File (void);
+
/// Destructor.
virtual ~ACE_Asynch_Write_File (void);
+
/**
* Initializes the factory with information which will be used with
* each asynchronous call. If ({handle} == ACE_INVALID_HANDLE),
@@ -659,6 +753,7 @@ public:
ACE_HANDLE handle = ACE_INVALID_HANDLE,
const void *completion_key = 0,
ACE_Proactor *proactor = 0);
+
/**
* This starts off an asynchronous write. Upto {bytes_to_write}
* will be written from the {message_block}, starting at the
@@ -680,6 +775,7 @@ public:
const void *act = 0,
int priority = 0,
int signal_number = ACE_SIGRTMIN);
+
#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE))
/**
* Same as above but with gather support, through chaining of composite
@@ -695,12 +791,15 @@ public:
int priority = 0,
int signal_number = ACE_SIGRTMIN);
#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */
+
/// Return the underlying implementation class.
// (this should be protected...)
virtual ACE_Asynch_Operation_Impl *implementation (void) const;
+
protected:
/// Implementation object.
ACE_Asynch_Write_File_Impl *implementation_;
+
public:
/**
* @class Result
@@ -721,29 +820,37 @@ public:
*/
class ACE_Export Result : public ACE_Asynch_Write_Stream::Result
{
+
/// The concrete implementation result classes only construct this
/// class.
friend class ACE_POSIX_Asynch_Write_File_Result;
friend class ACE_WIN32_Asynch_Write_File_Result;
+
public:
/// Get the implementation class.
ACE_Asynch_Write_File_Result_Impl *implementation (void) const;
+
protected:
/// Constructor. This implementation will not be deleted.
Result (ACE_Asynch_Write_File_Result_Impl *implementation);
+
/// Destructor.
virtual ~Result (void);
+
/// The implementation class.
ACE_Asynch_Write_File_Result_Impl *implementation_;
+
private:
/// Here just to provide an dummpy implementation, since the
/// one auto generated by MSVC is flagged as infinitely recursive
void operator= (Result &) {};
};
};
+
// Forward declarations
class ACE_Asynch_Accept_Result_Impl;
class ACE_Asynch_Accept_Impl;
+
/**
* @class ACE_Asynch_Accept
*
@@ -759,11 +866,14 @@ class ACE_Asynch_Accept_Impl;
*/
class ACE_Export ACE_Asynch_Accept : public ACE_Asynch_Operation
{
+
public:
/// A do nothing constructor.
ACE_Asynch_Accept (void);
+
/// Destructor.
virtual ~ACE_Asynch_Accept (void);
+
/**
* Initializes the factory with information which will be used with
* each asynchronous call. If ({handle} == ACE_INVALID_HANDLE),
@@ -774,6 +884,7 @@ public:
ACE_HANDLE handle = ACE_INVALID_HANDLE,
const void *completion_key = 0,
ACE_Proactor *proactor = 0);
+
/**
* This starts off an asynchronous accept. The asynchronous accept
* call also allows any initial data to be returned to the
@@ -815,13 +926,16 @@ public:
int priority = 0,
int signal_number = ACE_SIGRTMIN,
int addr_family = AF_INET);
+
/// Return the underlying implementation class.
// (this should be protected...)
virtual ACE_Asynch_Operation_Impl *implementation (void) const;
+
protected:
/// Delegation/implementation class that all methods will be
/// forwarded to.
ACE_Asynch_Accept_Impl *implementation_;
+
public:
/**
* @class Result
@@ -835,27 +949,36 @@ public:
*/
class ACE_Export Result : public ACE_Asynch_Result
{
+
/// The concrete implementation result classes only construct this
/// class.
friend class ACE_POSIX_Asynch_Accept_Result;
friend class ACE_WIN32_Asynch_Accept_Result;
+
public:
/// The number of bytes which were requested at the start of the
/// asynchronous accept.
size_t bytes_to_read (void) const;
+
/// Message block which contains the read data.
ACE_Message_Block &message_block (void) const;
+
/// I/O handle used for accepting new connections.
ACE_HANDLE listen_handle (void) const;
+
/// I/O handle for the new connection.
ACE_HANDLE accept_handle (void) const;
+
/// Get the implementation.
ACE_Asynch_Accept_Result_Impl *implementation (void) const;
+
protected:
/// Contructor. Implementation will not be deleted.
Result (ACE_Asynch_Accept_Result_Impl *implementation);
+
/// Destructor.
virtual ~Result (void);
+
/// Impelmentation class.
ACE_Asynch_Accept_Result_Impl *implementation_;
};
@@ -863,6 +986,7 @@ public:
// Forward declarations
class ACE_Asynch_Connect_Result_Impl;
class ACE_Asynch_Connect_Impl;
+
/**
* @class ACE_Asynch_Connect
*
@@ -876,11 +1000,14 @@ class ACE_Asynch_Connect_Impl;
*/
class ACE_Export ACE_Asynch_Connect : public ACE_Asynch_Operation
{
+
public:
/// A do nothing constructor.
ACE_Asynch_Connect (void);
+
/// Destructor.
virtual ~ACE_Asynch_Connect (void);
+
/**
* Initializes the factory with information which will be used with
* each asynchronous call.
@@ -891,6 +1018,7 @@ public:
ACE_HANDLE handle = ACE_INVALID_HANDLE,
const void *completion_key = 0,
ACE_Proactor *proactor = 0);
+
/**
* This starts off an asynchronous Connect.
*/
@@ -901,13 +1029,16 @@ public:
const void *act=0,
int priority = 0,
int signal_number = ACE_SIGRTMIN);
+
/// Return the underlying implementation class.
// (this should be protected...)
virtual ACE_Asynch_Operation_Impl *implementation (void) const;
+
protected:
/// Delegation/implementation class that all methods will be
/// forwarded to.
ACE_Asynch_Connect_Impl *implementation_;
+
public:
/**
* @class Result
@@ -921,27 +1052,36 @@ public:
*/
class ACE_Export Result : public ACE_Asynch_Result
{
+
/// The concrete implementation result classes only construct this
/// class.
friend class ACE_POSIX_Asynch_Connect_Result;
friend class ACE_WIN32_Asynch_Connect_Result;
+
public:
+
/// I/O handle for the connection.
ACE_HANDLE connect_handle (void) const;
+
/// Get the implementation.
ACE_Asynch_Connect_Result_Impl *implementation (void) const;
+
protected:
/// Contructor. Implementation will not be deleted.
Result (ACE_Asynch_Connect_Result_Impl *implementation);
+
/// Destructor.
virtual ~Result (void);
+
/// Impelmentation class.
ACE_Asynch_Connect_Result_Impl *implementation_;
};
};
+
// Forward declarations
class ACE_Asynch_Transmit_File_Result_Impl;
class ACE_Asynch_Transmit_File_Impl;
+
/**
* @class ACE_Asynch_Transmit_File
*
@@ -962,13 +1102,17 @@ class ACE_Asynch_Transmit_File_Impl;
*/
class ACE_Export ACE_Asynch_Transmit_File : public ACE_Asynch_Operation
{
+
public:
// Forward declarations
class Header_And_Trailer;
+
/// A do nothing constructor.
ACE_Asynch_Transmit_File (void);
+
/// Destructor.
virtual ~ACE_Asynch_Transmit_File (void);
+
/**
* Initializes the factory with information which will be used with
* each asynchronous call. If ({handle} == ACE_INVALID_HANDLE),
@@ -979,6 +1123,7 @@ public:
ACE_HANDLE handle = ACE_INVALID_HANDLE,
const void *completion_key = 0,
ACE_Proactor *proactor = 0);
+
/**
* This starts off an asynchronous transmit file. The {file} is a
* handle to an open file. {header_and_trailer} is a pointer to a
@@ -1008,12 +1153,15 @@ public:
const void *act = 0,
int priority = 0,
int signal_number = ACE_SIGRTMIN);
+
/// Return the underlying implementation class.
// (this should be protected...)
virtual ACE_Asynch_Operation_Impl *implementation (void) const;
+
protected:
/// The implementation class.
ACE_Asynch_Transmit_File_Impl *implementation_;
+
public:
/**
* @class Result
@@ -1027,35 +1175,47 @@ public:
*/
class ACE_Export Result : public ACE_Asynch_Result
{
+
/// The concrete implementation result classes only construct this
/// class.
friend class ACE_POSIX_Asynch_Transmit_File_Result;
friend class ACE_WIN32_Asynch_Transmit_File_Result;
+
public:
/// Socket used for transmitting the file.
ACE_HANDLE socket (void) const;
+
/// File from which the data is read.
ACE_HANDLE file (void) const;
+
/// Header and trailer data associated with this transmit file.
Header_And_Trailer *header_and_trailer (void) const;
+
/// The number of bytes which were requested at the start of the
/// asynchronous transmit file.
size_t bytes_to_write (void) const;
+
/// Number of bytes per send requested at the start of the transmit
/// file.
size_t bytes_per_send (void) const;
+
/// Flags which were passed into transmit file.
unsigned long flags (void) const;
+
/// Get the implementation class.
ACE_Asynch_Transmit_File_Result_Impl *implementation (void) const;
+
protected:
/// Constructor.
Result (ACE_Asynch_Transmit_File_Result_Impl *implementation);
+
/// Destructor.
virtual ~Result (void);
+
/// The implementation class.
ACE_Asynch_Transmit_File_Result_Impl *implementation_;
};
+
/**
* @class Header_And_Trailer
*
@@ -1067,55 +1227,74 @@ public:
*/
class ACE_Export Header_And_Trailer
{
+
public:
/// Constructor.
Header_And_Trailer (ACE_Message_Block *header = 0,
size_t header_bytes = 0,
ACE_Message_Block *trailer = 0,
size_t trailer_bytes = 0);
+
/// Destructor
virtual ~Header_And_Trailer (void);
+
/// This method allows all the member to be set in one fell swoop.
void header_and_trailer (ACE_Message_Block *header = 0,
size_t header_bytes = 0,
ACE_Message_Block *trailer = 0,
size_t trailer_bytes = 0);
+
/// Get header which goes before the file data.
ACE_Message_Block *header (void) const;
+
/// Set header which goes before the file data.
void header (ACE_Message_Block *message_block);
+
/// Get size of the header data.
size_t header_bytes (void) const;
+
/// Set size of the header data.
void header_bytes (size_t bytes);
+
/// Get trailer which goes after the file data.
ACE_Message_Block *trailer (void) const;
+
/// Set trailer which goes after the file data.
void trailer (ACE_Message_Block *message_block);
+
/// Get size of the trailer data.
size_t trailer_bytes (void) const;
+
/// Set size of the trailer data.
void trailer_bytes (size_t bytes);
+
/// Conversion routine.
ACE_LPTRANSMIT_FILE_BUFFERS transmit_buffers (void);
+
protected:
/// Header data.
ACE_Message_Block *header_;
+
/// Size of header data.
size_t header_bytes_;
+
/// Trailer data.
ACE_Message_Block *trailer_;
+
/// Size of trailer data.
size_t trailer_bytes_;
+
/// Target data structure.
ACE_TRANSMIT_FILE_BUFFERS transmit_buffers_;
};
};
+
// Forward declarations
class ACE_Asynch_Read_Dgram_Result_Impl;
class ACE_Asynch_Read_Dgram_Impl;
class ACE_Addr;
+
/**
* @class ACE_Asynch_Read_Dgram
*
@@ -1131,11 +1310,14 @@ class ACE_Addr;
*/
class ACE_Export ACE_Asynch_Read_Dgram : public ACE_Asynch_Operation
{
+
public:
/// A do nothing constructor.
ACE_Asynch_Read_Dgram (void);
+
/// Destructor
virtual ~ACE_Asynch_Read_Dgram (void);
+
/**
* Initializes the factory with information which will be used with
* each asynchronous call. If ({handle} == ACE_INVALID_HANDLE),
@@ -1146,6 +1328,7 @@ public:
ACE_HANDLE handle = ACE_INVALID_HANDLE,
const void *completion_key = 0,
ACE_Proactor *proactor = 0);
+
/** This starts off an asynchronous read. Upto
* {message_block->total_size()} will be read and stored in the
* {message_block}. {message_block}'s {wr_ptr} will be updated to reflect
@@ -1179,12 +1362,15 @@ public:
const void *act = 0,
int priority = 0,
int signal_number = ACE_SIGRTMIN);
+
/// Return the underlying implementation class.
// (this should be protected...)
virtual ACE_Asynch_Operation_Impl *implementation (void) const;
+
protected:
/// Implementation class that all methods will be forwarded to.
ACE_Asynch_Read_Dgram_Impl *implementation_;
+
public:
/**
* @class Result
@@ -1199,36 +1385,49 @@ public:
*/
class ACE_Export Result : public ACE_Asynch_Result
{
+
/// The concrete implementation result classes only construct this
/// class.
friend class ACE_POSIX_Asynch_Read_Dgram_Result;
friend class ACE_WIN32_Asynch_Read_Dgram_Result;
+
public:
+
/// The number of bytes which were requested at the start of the
/// asynchronous read.
size_t bytes_to_read (void) const;
+
/// Message block which contains the read data
ACE_Message_Block *message_block (void) const;
+
/// The flags used in the read
int flags (void) const;
+
/// The address of where the packet came from
int remote_address (ACE_Addr& addr) const;
+
/// I/O handle used for reading.
ACE_HANDLE handle (void) const;
+
/// Get the implementation class.
ACE_Asynch_Read_Dgram_Result_Impl *implementation (void) const;
+
protected:
/// Constructor.
Result (ACE_Asynch_Read_Dgram_Result_Impl *implementation);
+
/// Destructor.
virtual ~Result (void);
+
/// The implementation class.
ACE_Asynch_Read_Dgram_Result_Impl *implementation_;
};
};
+
// Forward declarations
class ACE_Asynch_Write_Dgram_Impl;
class ACE_Asynch_Write_Dgram_Result_Impl;
+
/**
* @class ACE_Asynch_Write_Dgram
*
@@ -1244,11 +1443,14 @@ class ACE_Asynch_Write_Dgram_Result_Impl;
*/
class ACE_Export ACE_Asynch_Write_Dgram : public ACE_Asynch_Operation
{
+
public:
/// A do nothing constructor.
ACE_Asynch_Write_Dgram (void);
+
/// Destructor.
virtual ~ACE_Asynch_Write_Dgram (void);
+
/**
* Initializes the factory with information which will be used with
* each asynchronous call. If ({handle} == ACE_INVALID_HANDLE),
@@ -1259,6 +1461,7 @@ public:
ACE_HANDLE handle = ACE_INVALID_HANDLE,
const void *completion_key = 0,
ACE_Proactor *proactor = 0);
+
/** This starts off an asynchronous send. Upto
* {message_block->total_length()} will be sent. {message_block}'s
* {rd_ptr} will be updated to reflect the sent bytes if the send operation
@@ -1292,12 +1495,15 @@ public:
const void *act = 0,
int priority = 0,
int signal_number = ACE_SIGRTMIN);
+
/// Return the underlying implementation class.
// (this should be protected...)
virtual ACE_Asynch_Operation_Impl *implementation (void) const;
+
protected:
/// Implementation class that all methods will be forwarded to.
ACE_Asynch_Write_Dgram_Impl *implementation_;
+
public:
/**
* @class Result
@@ -1312,32 +1518,43 @@ public:
*/
class ACE_Export Result : public ACE_Asynch_Result
{
+
/// The concrete implementation result classes only construct this
/// class.
friend class ACE_POSIX_Asynch_Write_Dgram_Result;
friend class ACE_WIN32_Asynch_Write_Dgram_Result;
+
public:
+
/// The number of bytes which were requested at the start of the
/// asynchronous write.
size_t bytes_to_write (void) const;
+
/// Message block which contains the sent data
ACE_Message_Block *message_block (void) const;
+
/// The flags using in the write
int flags (void) const;
+
/// I/O handle used for writing.
ACE_HANDLE handle (void) const;
+
/// Get the implementation class.
ACE_Asynch_Write_Dgram_Result_Impl *implementation (void) const;
+
protected:
/// Constructor.
Result (ACE_Asynch_Write_Dgram_Result_Impl *implementation);
+
/// Destructor.
virtual ~Result (void);
+
/// Implementation class.
ACE_Asynch_Write_Dgram_Result_Impl *implementation_;
};
};
+
/**
* @class ACE_Handler
*
@@ -1351,57 +1568,75 @@ class ACE_Export ACE_Handler
public:
/// A do nothing constructor.
ACE_Handler (void);
+
/// A do nothing constructor which allows proactor to be set to \<p\>.
ACE_Handler (ACE_Proactor *p);
+
/// Virtual destruction.
virtual ~ACE_Handler (void);
+
/// This method will be called when an asynchronous read completes on
/// a stream.
virtual void handle_read_stream (const ACE_Asynch_Read_Stream::Result &result);
+
/// This method will be called when an asynchronous write completes
/// on a UDP socket.
virtual void handle_write_dgram (const ACE_Asynch_Write_Dgram::Result &result);
+
/// This method will be called when an asynchronous read completes on
/// a UDP socket.
virtual void handle_read_dgram (const ACE_Asynch_Read_Dgram::Result &result);
+
/// This method will be called when an asynchronous write completes
/// on a stream.
virtual void handle_write_stream (const ACE_Asynch_Write_Stream::Result &result);
+
/// This method will be called when an asynchronous read completes on
/// a file.
virtual void handle_read_file (const ACE_Asynch_Read_File::Result &result);
+
/// This method will be called when an asynchronous write completes
/// on a file.
virtual void handle_write_file (const ACE_Asynch_Write_File::Result &result);
+
/// This method will be called when an asynchronous accept completes.
virtual void handle_accept (const ACE_Asynch_Accept::Result &result);
+
/// This method will be called when an asynchronous connect completes.
virtual void handle_connect (const ACE_Asynch_Connect::Result &result);
+
/// This method will be called when an asynchronous transmit file
/// completes.
virtual void handle_transmit_file (const ACE_Asynch_Transmit_File::Result &result);
+
/// Called when timer expires. {tv} was the requested time value and
/// {act} is the ACT passed when scheduling the timer.
virtual void handle_time_out (const ACE_Time_Value &tv,
const void *act = 0);
+
/**
* This is method works with the {run_event_loop} of the
* ACE_Proactor. A special {Wake_Up_Completion} is used to wake up
* all the threads that are blocking for completions.
*/
virtual void handle_wakeup (void);
+
/// Get the proactor associated with this handler.
ACE_Proactor *proactor (void);
+
/// Set the proactor.
void proactor (ACE_Proactor *p);
+
/**
* Get the I/O handle used by this {handler}. This method will be
* called by the ACE_Asynch_* classes when an ACE_INVALID_HANDLE is
* passed to {open}.
*/
virtual ACE_HANDLE handle (void) const;
+
/// Set the ACE_HANDLE value for this Handler.
virtual void handle (ACE_HANDLE);
+
/**
* @class Proxy
*
@@ -1422,22 +1657,30 @@ public:
};
typedef ACE_Refcounted_Auto_Ptr<Proxy, ACE_SYNCH_MUTEX>
Proxy_Ptr;
+
Proxy_Ptr &proxy (void);
+
protected:
/// The proactor associated with this handler.
ACE_Proactor *proactor_;
+
/// The ACE_HANDLE in use with this handler.
ACE_HANDLE handle_;
+
/// Refers to proxy for this handler.
ACE_Refcounted_Auto_Ptr<Proxy, ACE_SYNCH_MUTEX> proxy_;
+
ACE_UNIMPLEMENTED_FUNC (ACE_Handler (const ACE_Handler &))
ACE_UNIMPLEMENTED_FUNC (ACE_Handler operator= (const ACE_Handler &))
};
+
// Forward declarations
class ACE_INET_Addr;
+
// Forward declarations
template <class HANDLER>
class ACE_Asynch_Acceptor;
+
/**
* @class ACE_Service_Handler
*
@@ -1450,14 +1693,18 @@ class ACE_Asynch_Acceptor;
*/
class ACE_Export ACE_Service_Handler : public ACE_Handler
{
+
/// The Acceptor is the factory and therefore should have special
/// privileges.
friend class ACE_Asynch_Acceptor<ACE_Service_Handler>;
+
public:
/// A do nothing constructor.
ACE_Service_Handler (void);
+
/// Virtual destruction.
virtual ~ACE_Service_Handler (void);
+
/**
* {open} is called by ACE_Asynch_Acceptor to initialize a new
* instance of ACE_Service_Handler that has been created after the
@@ -1466,17 +1713,22 @@ public:
*/
virtual void open (ACE_HANDLE new_handle,
ACE_Message_Block &message_block);
+
// protected:
// This should be corrected after the correct semantics of the
// friend has been figured out.
+
/// Called by ACE_Asynch_Acceptor to pass the addresses of the new
/// connections.
virtual void addresses (const ACE_INET_Addr &remote_address,
const ACE_INET_Addr &local_address);
+
/// Called by ACE_Asynch_Acceptor to pass the act.
virtual void act (const void *);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_WIN32 || ACE_HAS_AIO_CALLS*/
#include /**/ "ace/post.h"
#endif /* ACE_ASYNCH_IO_H */
diff --git a/dep/ACE_wrappers/ace/Asynch_IO_Impl.cpp b/dep/ACE_wrappers/ace/Asynch_IO_Impl.cpp
index b705e4461e2..5bfc8b4c749 100644
--- a/dep/ACE_wrappers/ace/Asynch_IO_Impl.cpp
+++ b/dep/ACE_wrappers/ace/Asynch_IO_Impl.cpp
@@ -1,86 +1,118 @@
// $Id: Asynch_IO_Impl.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Asynch_IO_Impl.h"
+
#if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS)
// This only works on Win32 platforms and on Unix platforms supporting
// aio calls.
+
#if !defined (__ACE_INLINE__)
#include "ace/Asynch_IO_Impl.inl"
#endif /* __ACE_INLINE__ */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_Asynch_Result_Impl::~ACE_Asynch_Result_Impl (void)
{
}
+
ACE_Asynch_Operation_Impl::~ACE_Asynch_Operation_Impl (void)
{
}
+
ACE_Asynch_Read_Stream_Impl::~ACE_Asynch_Read_Stream_Impl (void)
{
}
+
ACE_Asynch_Read_Stream_Result_Impl::~ACE_Asynch_Read_Stream_Result_Impl (void)
{
}
+
ACE_Asynch_Write_Stream_Impl::~ACE_Asynch_Write_Stream_Impl (void)
{
}
+
ACE_Asynch_Write_Stream_Result_Impl::~ACE_Asynch_Write_Stream_Result_Impl (void)
{
}
+
ACE_Asynch_Read_File_Impl::~ACE_Asynch_Read_File_Impl (void)
{
}
+
ACE_Asynch_Write_File_Impl::~ACE_Asynch_Write_File_Impl (void)
{
}
+
ACE_Asynch_Read_File_Result_Impl::~ACE_Asynch_Read_File_Result_Impl (void)
{
}
+
ACE_Asynch_Write_File_Result_Impl::~ACE_Asynch_Write_File_Result_Impl (void)
{
}
+
ACE_Asynch_Accept_Result_Impl::~ACE_Asynch_Accept_Result_Impl (void)
{
}
+
ACE_Asynch_Connect_Result_Impl::~ACE_Asynch_Connect_Result_Impl (void)
{
}
+
ACE_Asynch_Accept_Impl::~ACE_Asynch_Accept_Impl (void)
{
}
+
ACE_Asynch_Connect_Impl::~ACE_Asynch_Connect_Impl (void)
{
}
+
ACE_Asynch_Transmit_File_Impl::~ACE_Asynch_Transmit_File_Impl (void)
{
}
+
ACE_Asynch_Transmit_File_Result_Impl::~ACE_Asynch_Transmit_File_Result_Impl (void)
{
}
+
ACE_Asynch_Read_Dgram_Impl::~ACE_Asynch_Read_Dgram_Impl (void)
{
}
+
ACE_Asynch_Read_Dgram_Impl::ACE_Asynch_Read_Dgram_Impl (void)
{
}
+
ACE_Asynch_Write_Dgram_Impl::~ACE_Asynch_Write_Dgram_Impl (void)
{
}
+
ACE_Asynch_Write_Dgram_Impl::ACE_Asynch_Write_Dgram_Impl (void)
{
}
+
//***********************************************
+
ACE_Asynch_Read_Dgram_Result_Impl::~ACE_Asynch_Read_Dgram_Result_Impl (void)
{
}
+
ACE_Asynch_Read_Dgram_Result_Impl::ACE_Asynch_Read_Dgram_Result_Impl (void)
{
}
+
//***********************************************
+
ACE_Asynch_Write_Dgram_Result_Impl::~ACE_Asynch_Write_Dgram_Result_Impl (void)
{
}
+
ACE_Asynch_Write_Dgram_Result_Impl::ACE_Asynch_Write_Dgram_Result_Impl (void)
{
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */
diff --git a/dep/ACE_wrappers/ace/Asynch_IO_Impl.h b/dep/ACE_wrappers/ace/Asynch_IO_Impl.h
index 18f719ee425..9e6652e7e8e 100644
--- a/dep/ACE_wrappers/ace/Asynch_IO_Impl.h
+++ b/dep/ACE_wrappers/ace/Asynch_IO_Impl.h
@@ -1,4 +1,5 @@
/* -*- C++ -*- */
+
//=============================================================================
/**
* @file Asynch_IO_Impl.h
@@ -18,20 +19,28 @@
* @author Alexander Libman <alibman@ihug.com.au>
*/
//=============================================================================
+
#ifndef ACE_ASYNCH_IO_IMPL_H
#define ACE_ASYNCH_IO_IMPL_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
#pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS)
// This only works on Win32 platforms and on Unix platforms supporting
// aio calls.
+
#include "ace/Asynch_IO.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward declaration.
class ACE_Proactor_Impl;
+
/**
* @class ACE_Asynch_Result_Impl
*
@@ -43,24 +52,33 @@ class ACE_Export ACE_Asynch_Result_Impl
{
public:
virtual ~ACE_Asynch_Result_Impl (void);
+
/// Number of bytes transferred by the operation.
virtual size_t bytes_transferred (void) const = 0;
+
/// ACT associated with the operation.
virtual const void *act (void) const = 0;
+
/// Did the operation succeed?
virtual int success (void) const = 0;
+
/// This ACT is not the same as the ACT associated with the
/// asynchronous operation.
virtual const void *completion_key (void) const = 0;
+
/// Error value if the operation fail.
virtual u_long error (void) const = 0;
+
/// Event associated with the OVERLAPPED structure.
virtual ACE_HANDLE event (void) const = 0;
+
/// This really make sense only when doing file I/O.
virtual u_long offset (void) const = 0;
virtual u_long offset_high (void) const = 0;
+
/// Priority of the operation.
virtual int priority (void) const = 0;
+
/**
* POSIX4 real-time signal number to be used for the
* operation. <signal_number> ranges from SIGRTMIN to SIGRTMAX. By
@@ -68,6 +86,7 @@ public:
* on non-POSIX4 systems and returns 0.
*/
virtual int signal_number (void) const = 0;
+
// protected:
//
// These two should really be protected. But sometimes it
@@ -77,12 +96,15 @@ public:
int success,
const void *completion_key,
u_long error = 0) = 0;
+
/// Post @c this to the Proactor's completion port.
virtual int post_completion (ACE_Proactor_Impl *proactor) = 0;
+
protected:
/// Do-nothing constructor.
ACE_Asynch_Result_Impl (void);
};
+
/**
* @class ACE_Asynch_Operation_Impl
*
@@ -94,6 +116,7 @@ class ACE_Export ACE_Asynch_Operation_Impl
{
public:
virtual ~ACE_Asynch_Operation_Impl (void);
+
/**
* Initializes the factory with information which will be used with
* each asynchronous call. If @a handle == ACE_INVALID_HANDLE,
@@ -104,19 +127,24 @@ public:
ACE_HANDLE handle,
const void *completion_key,
ACE_Proactor *proactor) = 0;
+
/**
* This cancels all pending accepts operations that were issued by
* the calling thread. The function does not cancel asynchronous
* operations issued by other threads.
*/
virtual int cancel (void) = 0;
+
// = Access methods.
+
/// Return the underlying proactor.
virtual ACE_Proactor* proactor (void) const = 0;
+
protected:
/// Do-nothing constructor.
ACE_Asynch_Operation_Impl (void);
};
+
/**
* @class ACE_Asynch_Read_Stream_Impl
*
@@ -129,6 +157,7 @@ class ACE_Export ACE_Asynch_Read_Stream_Impl : public virtual ACE_Asynch_Operati
{
public:
virtual ~ACE_Asynch_Read_Stream_Impl (void);
+
/// This starts off an asynchronous read. Upto @a bytes_to_read will
/// be read and stored in the @a message_block.
virtual int read (ACE_Message_Block &message_block,
@@ -136,6 +165,7 @@ public:
const void *act,
int priority,
int signal_number) = 0;
+
#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE))
/**
* Same as above but with scatter support, through chaining of composite
@@ -147,10 +177,12 @@ public:
int priority,
int signal_number) = 0;
#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */
+
protected:
/// Do-nothing constructor.
ACE_Asynch_Read_Stream_Impl (void);
};
+
/**
* @class ACE_Asynch_Read_Stream_Result_Impl
*
@@ -163,17 +195,22 @@ class ACE_Export ACE_Asynch_Read_Stream_Result_Impl : public virtual ACE_Asynch_
{
public:
virtual ~ACE_Asynch_Read_Stream_Result_Impl (void);
+
/// The number of bytes which were requested at the start of the
/// asynchronous read.
virtual size_t bytes_to_read (void) const = 0;
+
/// Message block which contains the read data.
virtual ACE_Message_Block &message_block (void) const = 0;
+
/// I/O handle used for reading.
virtual ACE_HANDLE handle (void) const = 0;
+
protected:
/// Do-nothing constructor.
ACE_Asynch_Read_Stream_Result_Impl (void);
};
+
/**
* @class ACE_Asynch_Write_Stream_Impl
*
@@ -186,6 +223,7 @@ class ACE_Export ACE_Asynch_Write_Stream_Impl : public virtual ACE_Asynch_Operat
{
public:
virtual ~ACE_Asynch_Write_Stream_Impl (void);
+
/// This starts off an asynchronous write. Upto @a bytes_to_write
/// will be written from the @a message_block.
virtual int write (ACE_Message_Block &message_block,
@@ -193,6 +231,7 @@ public:
const void *act,
int priority,
int signal_number) = 0;
+
#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE))
/**
* Same as above but with gather support, through chaining of composite
@@ -204,10 +243,12 @@ public:
int priority,
int signal_number) = 0;
#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */
+
protected:
/// Do-nothing constructor.
ACE_Asynch_Write_Stream_Impl (void);
};
+
/**
* @class ACE_Asynch_Write_Stream_Result_Impl
*
@@ -220,17 +261,22 @@ class ACE_Export ACE_Asynch_Write_Stream_Result_Impl : public virtual ACE_Asynch
{
public:
virtual ~ACE_Asynch_Write_Stream_Result_Impl (void);
+
/// The number of bytes which were requested at the start of the
/// asynchronous write.
virtual size_t bytes_to_write (void) const = 0;
+
/// Message block that contains the data to be written.
virtual ACE_Message_Block &message_block (void) const = 0;
+
/// I/O handle used for writing.
virtual ACE_HANDLE handle (void) const = 0;
+
protected:
/// Do-nothing constructor.
ACE_Asynch_Write_Stream_Result_Impl (void);
};
+
/**
* @class ACE_Asynch_Read_File_Impl
*
@@ -243,6 +289,7 @@ class ACE_Export ACE_Asynch_Read_File_Impl : public virtual ACE_Asynch_Read_Stre
{
public:
virtual ~ACE_Asynch_Read_File_Impl (void);
+
/**
* This starts off an asynchronous read. Upto @a bytes_to_read will
* be read and stored in the @a message_block. The read will start
@@ -255,6 +302,7 @@ public:
const void *act,
int priority,
int signal_number) = 0;
+
#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE))
/**
* Same as above but with scatter support, through chaining of composite
@@ -270,6 +318,7 @@ public:
int priority,
int signal_number) = 0;
#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */
+
/// This starts off an asynchronous read. Upto @a bytes_to_read will
/// be read and stored in the @a message_block.
virtual int read (ACE_Message_Block &message_block,
@@ -277,6 +326,7 @@ public:
const void *act,
int priority,
int signal_number) = 0;
+
#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE))
/**
* Same as above but with scatter support, through chaining of composite
@@ -288,10 +338,12 @@ public:
int priority,
int signal_number) = 0;
#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */
+
protected:
/// Do-nothing constructor.
ACE_Asynch_Read_File_Impl (void);
};
+
/**
* @class ACE_Asynch_Read_File_Result_Impl
*
@@ -304,10 +356,12 @@ class ACE_Export ACE_Asynch_Read_File_Result_Impl : public virtual ACE_Asynch_Re
public:
/// Destructor.
virtual ~ACE_Asynch_Read_File_Result_Impl (void);
+
protected:
/// Do-nothing constructor.
ACE_Asynch_Read_File_Result_Impl (void);
};
+
/**
* @class ACE_Asynch_Write_File_Impl
*
@@ -320,6 +374,7 @@ class ACE_Export ACE_Asynch_Write_File_Impl : public virtual ACE_Asynch_Write_St
{
public:
virtual ~ACE_Asynch_Write_File_Impl (void);
+
/**
* This starts off an asynchronous write. Upto @a bytes_to_write
* will be write and stored in the @a message_block. The write will
@@ -332,6 +387,7 @@ public:
const void *act,
int priority,
int signal_number) = 0;
+
#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE))
/**
* Same as above but with gather support, through chaining of composite
@@ -347,6 +403,7 @@ public:
int priority,
int signal_number) = 0;
#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */
+
/// This starts off an asynchronous write. Upto @a bytes_to_write
/// will be written from the @a message_block.
virtual int write (ACE_Message_Block &message_block,
@@ -354,6 +411,7 @@ public:
const void *act,
int priority,
int signal_number) = 0;
+
#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE))
/**
* Same as above but with gather support, through chaining of composite
@@ -365,10 +423,12 @@ public:
int priority,
int signal_number) = 0;
#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */
+
protected:
/// Do-nothing constructor.
ACE_Asynch_Write_File_Impl (void);
};
+
/**
* @class ACE_Asynch_Write_File_Result_Impl
*
@@ -381,10 +441,12 @@ class ACE_Export ACE_Asynch_Write_File_Result_Impl : public virtual ACE_Asynch_W
{
public:
virtual ~ACE_Asynch_Write_File_Result_Impl (void);
+
protected:
/// Do-nothing constructor.
ACE_Asynch_Write_File_Result_Impl (void);
};
+
/**
* @class ACE_Asynch_Accept_Impl
*
@@ -397,6 +459,7 @@ class ACE_Export ACE_Asynch_Accept_Impl : public virtual ACE_Asynch_Operation_Im
{
public:
virtual ~ACE_Asynch_Accept_Impl (void);
+
/**
* This starts off an asynchronous accept. The asynchronous accept
* call also allows any initial data to be returned to the
@@ -415,10 +478,12 @@ public:
int priority,
int signal_number,
int addr_family) = 0;
+
protected:
/// Do-nothing constructor.
ACE_Asynch_Accept_Impl (void);
};
+
/**
* @class ACE_Asynch_Accept_Result_Impl
*
@@ -431,20 +496,26 @@ class ACE_Export ACE_Asynch_Accept_Result_Impl : public virtual ACE_Asynch_Resul
{
public:
virtual ~ACE_Asynch_Accept_Result_Impl (void);
+
/// The number of bytes which were requested at the start of the
/// asynchronous accept.
virtual size_t bytes_to_read (void) const = 0;
+
/// Message block which contains the read data.
virtual ACE_Message_Block &message_block (void) const = 0;
+
/// I/O handle used for accepting new connections.
virtual ACE_HANDLE listen_handle (void) const = 0;
+
/// I/O handle for the new connection.
virtual ACE_HANDLE accept_handle (void) const = 0;
+
protected:
/// Do-nothing constructor.
ACE_Asynch_Accept_Result_Impl (void);
};
+
/**
* @class ACE_Asynch_Connect_Impl
*
@@ -457,6 +528,7 @@ class ACE_Export ACE_Asynch_Connect_Impl : public virtual ACE_Asynch_Operation_I
{
public:
virtual ~ACE_Asynch_Connect_Impl (void);
+
/**
* This starts off an asynchronous connect
*/
@@ -467,10 +539,12 @@ public:
const void *act,
int priority,
int signal_number) = 0;
+
protected:
/// Do-nothing constructor.
ACE_Asynch_Connect_Impl (void);
};
+
/**
* @class ACE_Asynch_Connect_Result_Impl
*
@@ -483,13 +557,16 @@ class ACE_Export ACE_Asynch_Connect_Result_Impl : public virtual ACE_Asynch_Resu
{
public:
virtual ~ACE_Asynch_Connect_Result_Impl (void);
+
/// I/O handle for the connection.
virtual ACE_HANDLE connect_handle (void) const = 0;
+
protected:
/// Do-nothing constructor.
ACE_Asynch_Connect_Result_Impl (void);
};
+
/**
* @class ACE_Asynch_Transmit_File_Impl
*
@@ -502,6 +579,7 @@ class ACE_Asynch_Transmit_File_Impl : public virtual ACE_Asynch_Operation_Impl
{
public:
virtual ~ACE_Asynch_Transmit_File_Impl (void);
+
/// This starts off an asynchronous transmit file.
virtual int transmit_file (ACE_HANDLE file,
ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer,
@@ -513,10 +591,12 @@ public:
const void *act,
int priority,
int signal_number) = 0;
+
protected:
/// Do-nothing constructor.
ACE_Asynch_Transmit_File_Impl (void);
};
+
/**
* @class ACE_Asynch_Transmit_File_Result_Impl
*
@@ -529,25 +609,33 @@ class ACE_Export ACE_Asynch_Transmit_File_Result_Impl : public virtual ACE_Async
{
public:
virtual ~ACE_Asynch_Transmit_File_Result_Impl (void);
+
/// Socket used for transmitting the file.
virtual ACE_HANDLE socket (void) const = 0;
+
/// File from which the data is read.
virtual ACE_HANDLE file (void) const = 0;
+
/// Header and trailer data associated with this transmit file.
virtual ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer (void) const = 0;
+
/// The number of bytes which were requested at the start of the
/// asynchronous transmit file.
virtual size_t bytes_to_write (void) const = 0;
+
/// Number of bytes per send requested at the start of the transmit
/// file.
virtual size_t bytes_per_send (void) const = 0;
+
/// Flags which were passed into transmit file.
virtual u_long flags (void) const = 0;
+
protected:
/// Do-nothing constructor.
ACE_Asynch_Transmit_File_Result_Impl (void);
};
+
/**
* @class ACE_Asynch_Read_Dgram_Impl
*
@@ -560,6 +648,7 @@ class ACE_Export ACE_Asynch_Read_Dgram_Impl : public virtual ACE_Asynch_Operatio
{
public:
virtual ~ACE_Asynch_Read_Dgram_Impl (void);
+
/** This starts off an asynchronous read. Upto
* <message_block->total_size()> will be read and stored in the
* @a message_block. @a message_block's <wr_ptr> will be updated to reflect
@@ -593,10 +682,12 @@ public:
const void *act,
int priority,
int signal_number) = 0;
+
protected:
/// Do-nothing constructor.
ACE_Asynch_Read_Dgram_Impl (void);
};
+
/**
* @class ACE_Asynch_Read_Dgram_Result_Impl
*
@@ -609,21 +700,28 @@ class ACE_Export ACE_Asynch_Read_Dgram_Result_Impl : public virtual ACE_Asynch_R
{
public:
virtual ~ACE_Asynch_Read_Dgram_Result_Impl (void);
+
/// Message block which contains the read data
virtual ACE_Message_Block *message_block (void) const = 0;
+
/// The number of bytes which were requested at the start of the
/// asynchronous read.
virtual size_t bytes_to_read (void) const = 0;
+
/// The address of where the packet came from
virtual int remote_address (ACE_Addr& addr) const = 0;
+
/// The flags used in the read
virtual int flags (void) const = 0;
+
/// I/O handle used for reading.
virtual ACE_HANDLE handle (void) const = 0;
+
protected:
/// Do-nothing constructor.
ACE_Asynch_Read_Dgram_Result_Impl (void);
};
+
/**
* @class ACE_Asynch_Write_Dgram_Impl
*
@@ -636,6 +734,7 @@ class ACE_Export ACE_Asynch_Write_Dgram_Impl : public virtual ACE_Asynch_Operati
{
public:
virtual ~ACE_Asynch_Write_Dgram_Impl (void);
+
/** This starts off an asynchronous send. Upto
* <message_block->total_length()> will be sent. @a message_block's
* <rd_ptr> will be updated to reflect the sent bytes if the send operation
@@ -669,10 +768,12 @@ public:
const void *act,
int priority,
int signal_number) = 0;
+
protected:
/// Do-nothing constructor.
ACE_Asynch_Write_Dgram_Impl (void);
};
+
/**
* @class ACE_Asynch_Write_Dgram_Result_Impl
*
@@ -685,23 +786,31 @@ class ACE_Export ACE_Asynch_Write_Dgram_Result_Impl : public virtual ACE_Asynch_
{
public:
virtual ~ACE_Asynch_Write_Dgram_Result_Impl (void);
+
/// The number of bytes which were requested at the start of the
/// asynchronous write.
virtual size_t bytes_to_write (void) const = 0;
+
/// Message block which contains the sent data
virtual ACE_Message_Block *message_block (void) const = 0;
+
/// The flags using in the write
virtual int flags (void) const = 0;
+
/// I/O handle used for writing.
virtual ACE_HANDLE handle (void) const = 0;
+
protected:
/// Do-nothing constructor.
ACE_Asynch_Write_Dgram_Result_Impl (void);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Asynch_IO_Impl.inl"
#endif /* __ACE_INLINE__ */
+
#endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */
#include /**/ "ace/post.h"
#endif /* ACE_ASYNCH_IO_IMPL_H */
diff --git a/dep/ACE_wrappers/ace/Asynch_IO_Impl.inl b/dep/ACE_wrappers/ace/Asynch_IO_Impl.inl
index 1ebbb929407..60dc69dfb31 100644
--- a/dep/ACE_wrappers/ace/Asynch_IO_Impl.inl
+++ b/dep/ACE_wrappers/ace/Asynch_IO_Impl.inl
@@ -1,88 +1,106 @@
// -*- C++ -*-
//
// $Id: Asynch_IO_Impl.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_Asynch_Result_Impl::ACE_Asynch_Result_Impl (void)
{
}
+
ACE_INLINE
ACE_Asynch_Operation_Impl::ACE_Asynch_Operation_Impl (void)
{
}
+
ACE_INLINE
ACE_Asynch_Read_Stream_Impl::ACE_Asynch_Read_Stream_Impl (void)
: ACE_Asynch_Operation_Impl ()
{
}
+
ACE_INLINE
ACE_Asynch_Read_Stream_Result_Impl::ACE_Asynch_Read_Stream_Result_Impl (void)
: ACE_Asynch_Result_Impl ()
{
}
+
ACE_INLINE
ACE_Asynch_Write_Stream_Impl::ACE_Asynch_Write_Stream_Impl (void)
: ACE_Asynch_Operation_Impl ()
{
}
+
ACE_INLINE
ACE_Asynch_Write_Stream_Result_Impl::ACE_Asynch_Write_Stream_Result_Impl (void)
: ACE_Asynch_Result_Impl ()
{
}
+
ACE_INLINE
ACE_Asynch_Read_File_Impl::ACE_Asynch_Read_File_Impl (void)
: ACE_Asynch_Operation_Impl (),
ACE_Asynch_Read_Stream_Impl ()
{
}
+
ACE_INLINE
ACE_Asynch_Read_File_Result_Impl::ACE_Asynch_Read_File_Result_Impl (void)
: ACE_Asynch_Result_Impl (),
ACE_Asynch_Read_Stream_Result_Impl ()
{
}
+
ACE_INLINE
ACE_Asynch_Write_File_Impl::ACE_Asynch_Write_File_Impl (void)
: ACE_Asynch_Operation_Impl (),
ACE_Asynch_Write_Stream_Impl ()
{
}
+
ACE_INLINE
ACE_Asynch_Write_File_Result_Impl::ACE_Asynch_Write_File_Result_Impl (void)
: ACE_Asynch_Result_Impl (),
ACE_Asynch_Write_Stream_Result_Impl ()
{
}
+
ACE_INLINE
ACE_Asynch_Accept_Impl::ACE_Asynch_Accept_Impl (void)
: ACE_Asynch_Operation_Impl ()
{
}
+
ACE_INLINE
ACE_Asynch_Accept_Result_Impl::ACE_Asynch_Accept_Result_Impl (void)
: ACE_Asynch_Result_Impl ()
{
}
+
ACE_INLINE
ACE_Asynch_Connect_Impl::ACE_Asynch_Connect_Impl (void)
: ACE_Asynch_Operation_Impl ()
{
}
+
ACE_INLINE
ACE_Asynch_Connect_Result_Impl::ACE_Asynch_Connect_Result_Impl (void)
: ACE_Asynch_Result_Impl ()
{
}
+
ACE_INLINE
ACE_Asynch_Transmit_File_Impl::ACE_Asynch_Transmit_File_Impl (void)
: ACE_Asynch_Operation_Impl ()
{
}
+
ACE_INLINE
ACE_Asynch_Transmit_File_Result_Impl::ACE_Asynch_Transmit_File_Result_Impl (void)
: ACE_Asynch_Result_Impl ()
{
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Asynch_Pseudo_Task.cpp b/dep/ACE_wrappers/ace/Asynch_Pseudo_Task.cpp
index c0d059f0aaf..34715c2bba4 100644
--- a/dep/ACE_wrappers/ace/Asynch_Pseudo_Task.cpp
+++ b/dep/ACE_wrappers/ace/Asynch_Pseudo_Task.cpp
@@ -1,18 +1,25 @@
// $Id: Asynch_Pseudo_Task.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Asynch_Pseudo_Task.h"
+
#include "ace/OS_NS_errno.h"
#include "ace/OS_NS_signal.h"
+
ACE_RCSID(ace, Asynch_Pseudo_Task, "$Id: Asynch_Pseudo_Task.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_Asynch_Pseudo_Task::ACE_Asynch_Pseudo_Task ()
: select_reactor_ (), // should be initialized before reactor_
reactor_ (&select_reactor_, 0) // don't delete implementation
{
}
+
ACE_Asynch_Pseudo_Task::~ACE_Asynch_Pseudo_Task ()
{
this->stop ();
}
+
int
ACE_Asynch_Pseudo_Task::start (void)
{
@@ -21,37 +28,49 @@ ACE_Asynch_Pseudo_Task::start (void)
ACE_TEXT ("%N:%l:%p\n"),
ACE_TEXT ("start reactor is not initialized")),
-1);
+
return this->activate () == -1 ? -1 : 0; // If started, return 0
}
+
int
ACE_Asynch_Pseudo_Task::stop (void)
{
if (this->thr_count () == 0) // already stopped
return 0;
+
if (this->reactor_.end_reactor_event_loop () == -1)
return -1;
+
this->wait ();
this->reactor_.close ();
return 0;
}
+
int
ACE_Asynch_Pseudo_Task::svc (void)
{
#if !defined (ACE_WIN32)
+
sigset_t RT_signals;
+
sigemptyset (&RT_signals);
for (int si = ACE_SIGRTMIN; si <= ACE_SIGRTMAX; si++)
sigaddset (&RT_signals, si);
+
if (ACE_OS::pthread_sigmask (SIG_BLOCK, &RT_signals, 0) != 0)
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("Error:(%P | %t):%p\n"),
ACE_TEXT ("pthread_sigmask")));
#endif
+
reactor_.owner (ACE_Thread::self ());
reactor_.run_reactor_event_loop ();
+
return 0;
}
+
+
int
ACE_Asynch_Pseudo_Task::register_io_handler (ACE_HANDLE handle,
ACE_Event_Handler *handler,
@@ -61,8 +80,10 @@ ACE_Asynch_Pseudo_Task::register_io_handler (ACE_HANDLE handle,
// Register the handler with the reactor.
if (-1 == this->reactor_.register_handler (handle, handler, mask))
return -1;
+
if (flg_suspend == 0)
return 0;
+
// Suspend the handle now. Enable only when the accept is issued
// by the application.
if (this->reactor_.suspend_handler (handle) == -1)
@@ -75,8 +96,10 @@ ACE_Asynch_Pseudo_Task::register_io_handler (ACE_HANDLE handle,
| ACE_Event_Handler::DONT_CALL);
return -1;
}
+
return 0;
}
+
int
ACE_Asynch_Pseudo_Task::remove_io_handler (ACE_HANDLE handle)
{
@@ -84,21 +107,25 @@ ACE_Asynch_Pseudo_Task::remove_io_handler (ACE_HANDLE handle)
ACE_Event_Handler::ALL_EVENTS_MASK
| ACE_Event_Handler::DONT_CALL);
}
+
int
ACE_Asynch_Pseudo_Task::remove_io_handler (ACE_Handle_Set &set)
{
return this->reactor_.remove_handler (set, ACE_Event_Handler::ALL_EVENTS_MASK
| ACE_Event_Handler::DONT_CALL);
}
+
int
ACE_Asynch_Pseudo_Task::suspend_io_handler (ACE_HANDLE handle)
{
return this->reactor_.suspend_handler (handle);
}
+
int
ACE_Asynch_Pseudo_Task::resume_io_handler (ACE_HANDLE handle)
{
return this->reactor_.resume_handler (handle);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Asynch_Pseudo_Task.h b/dep/ACE_wrappers/ace/Asynch_Pseudo_Task.h
index ec37579be7f..4c5a94feca4 100644
--- a/dep/ACE_wrappers/ace/Asynch_Pseudo_Task.h
+++ b/dep/ACE_wrappers/ace/Asynch_Pseudo_Task.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Asynch_Pseudo_Task.h
@@ -8,23 +9,31 @@
* @author Alexander Libman <alibman@ihug.com.au>
*/
//=============================================================================
+
#ifndef ACE_ASYNCH_PSEUDO_TASK_H
#define ACE_ASYNCH_PSEUDO_TASK_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
#pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Reactor.h"
#include "ace/Select_Reactor.h"
#include "ace/Task.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/*
* Specialization hook to replace the Reactor with the
* concrete Reactor implementation, e.g., select_st,
* select_mt etc.
*/
//@@ REACTOR_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK
+
/**
* @class ACE_Asynch_Pseudo_Task
*
@@ -34,23 +43,32 @@ class ACE_Export ACE_Asynch_Pseudo_Task : public ACE_Task<ACE_NULL_SYNCH>
public:
ACE_Asynch_Pseudo_Task();
virtual ~ACE_Asynch_Pseudo_Task();
+
int start (void);
int stop (void);
+
int register_io_handler (ACE_HANDLE handle,
ACE_Event_Handler *handler,
ACE_Reactor_Mask mask,
int flg_suspend);
+
int remove_io_handler (ACE_HANDLE handle);
int remove_io_handler (ACE_Handle_Set &set);
int resume_io_handler (ACE_HANDLE handle);
int suspend_io_handler (ACE_HANDLE handle);
+
protected:
virtual int svc (void);
+
/// Should be initialized before reactor_
ACE_Select_Reactor select_reactor_;
+
ACE_Reactor reactor_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
+
#endif /* ACE_ASYNCH_PSEUDO_TASK_H */
diff --git a/dep/ACE_wrappers/ace/Atomic_Op.cpp b/dep/ACE_wrappers/ace/Atomic_Op.cpp
index 3646093924f..473c482adcd 100644
--- a/dep/ACE_wrappers/ace/Atomic_Op.cpp
+++ b/dep/ACE_wrappers/ace/Atomic_Op.cpp
@@ -1,23 +1,31 @@
// $Id: Atomic_Op.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Atomic_Op.h"
#include "ace/OS_NS_unistd.h"
+
ACE_RCSID (ace,
Atomic_Op,
"$Id: Atomic_Op.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if !defined (__ACE_INLINE__)
#include "ace/Atomic_Op.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_HAS_BUILTIN_ATOMIC_OP)
+
#if defined (ACE_INCLUDE_ATOMIC_OP_SPARC)
# include "ace/Atomic_Op_Sparc.h"
#endif /* ACE_INCLUDE_ATOMIC_OP_SPARC */
+
namespace {
+
#if defined (_MSC_VER)
// Disable "no return value" warning, as we will be putting
// the return values directly into the EAX register.
#pragma warning (push)
#pragma warning (disable: 4035)
#endif /* _MSC_VER */
+
long
single_cpu_increment (volatile long *value)
{
@@ -41,6 +49,7 @@ single_cpu_increment (volatile long *value)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_INTEL_ASSEMBLY*/
}
+
long
single_cpu_decrement (volatile long *value)
{
@@ -64,6 +73,7 @@ single_cpu_decrement (volatile long *value)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_INTEL_ASSEMBLY*/
}
+
long
single_cpu_exchange (volatile long *value, long rhs)
{
@@ -86,6 +96,7 @@ single_cpu_exchange (volatile long *value, long rhs)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_INTEL_ASSEMBLY*/
}
+
long
single_cpu_exchange_add (volatile long *value, long rhs)
{
@@ -127,6 +138,7 @@ single_cpu_exchange_add (volatile long *value, long rhs)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_INTEL_ASSEMBLY*/
}
+
long
multi_cpu_increment (volatile long *value)
{
@@ -144,6 +156,7 @@ multi_cpu_increment (volatile long *value)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_INTEL_ASSEMBLY*/
}
+
long
multi_cpu_decrement (volatile long *value)
{
@@ -161,6 +174,7 @@ multi_cpu_decrement (volatile long *value)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_INTEL_ASSEMBLY*/
}
+
long
multi_cpu_exchange (volatile long *value, long rhs)
{
@@ -179,6 +193,7 @@ multi_cpu_exchange (volatile long *value, long rhs)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_INTEL_ASSEMBLY*/
}
+
long
multi_cpu_exchange_add (volatile long *value, long rhs)
{
@@ -215,15 +230,20 @@ multi_cpu_exchange_add (volatile long *value, long rhs)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_INTEL_ASSEMBLY*/
}
+
#if defined (_MSC_VER)
#pragma warning (pop)
#endif /* _MSC_VER */
+
} // end namespace
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
long (*ACE_Atomic_Op<ACE_Thread_Mutex, long>::increment_fn_) (volatile long *) = multi_cpu_increment;
long (*ACE_Atomic_Op<ACE_Thread_Mutex, long>::decrement_fn_) (volatile long *) = multi_cpu_decrement;
long (*ACE_Atomic_Op<ACE_Thread_Mutex, long>::exchange_fn_) (volatile long *, long) = multi_cpu_exchange;
long (*ACE_Atomic_Op<ACE_Thread_Mutex, long>::exchange_add_fn_) (volatile long *, long) = multi_cpu_exchange_add;
+
void
ACE_Atomic_Op<ACE_Thread_Mutex, long>::init_functions (void)
{
@@ -242,6 +262,7 @@ ACE_Atomic_Op<ACE_Thread_Mutex, long>::init_functions (void)
exchange_add_fn_ = multi_cpu_exchange_add;
}
}
+
void
ACE_Atomic_Op<ACE_Thread_Mutex, long>::dump (void) const
{
@@ -250,10 +271,12 @@ ACE_Atomic_Op<ACE_Thread_Mutex, long>::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
long (*ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::increment_fn_) (volatile long *) = multi_cpu_increment;
long (*ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::decrement_fn_) (volatile long *) = multi_cpu_decrement;
long (*ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::exchange_fn_) (volatile long *, long) = multi_cpu_exchange;
long (*ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::exchange_add_fn_) (volatile long *, long) = multi_cpu_exchange_add;
+
void
ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::init_functions (void)
{
@@ -272,6 +295,7 @@ ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::init_functions (void)
exchange_add_fn_ = multi_cpu_exchange_add;
}
}
+
void
ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::dump (void) const
{
@@ -280,6 +304,8 @@ ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_BUILTIN_ATOMIC_OP */
diff --git a/dep/ACE_wrappers/ace/Atomic_Op.h b/dep/ACE_wrappers/ace/Atomic_Op.h
index 33a90819fbd..c750999af4c 100644
--- a/dep/ACE_wrappers/ace/Atomic_Op.h
+++ b/dep/ACE_wrappers/ace/Atomic_Op.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Atomic_Op.h
@@ -8,16 +9,22 @@
* @author Douglas C. Schmidt <schmidt@uci.edu>
*/
//=============================================================================
+
#ifndef ACE_ATOMIC_OP_H
#define ACE_ATOMIC_OP_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Thread_Mutex.h"
+
// Include the templates here.
#include "ace/Atomic_Op_T.h"
+
// Determine whether builtin atomic op support is
// available on this platform.
#if defined (ACE_HAS_THREADS)
@@ -38,8 +45,11 @@
# define ACE_HAS_BUILTIN_ATOMIC_OP
# endif /* WIN32 */
#endif /* ACE_HAS_THREADS */
+
#if defined (ACE_HAS_BUILTIN_ATOMIC_OP)
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Atomic_Op<ACE_Thread_Mutex, long>
*
@@ -55,63 +65,90 @@ class ACE_Export ACE_Atomic_Op<ACE_Thread_Mutex, long>
public:
/// Initialize <value_> to 0.
ACE_Atomic_Op (void);
+
/// Initialize <value_> to c.
ACE_Atomic_Op (long c);
+
/// Manage copying...
ACE_Atomic_Op (const ACE_Atomic_Op<ACE_Thread_Mutex, long> &c);
+
/// Atomically pre-increment <value_>.
long operator++ (void);
+
/// Atomically post-increment <value_>.
long operator++ (int);
+
/// Atomically increment <value_> by rhs.
long operator+= (long rhs);
+
/// Atomically pre-decrement <value_>.
long operator-- (void);
+
/// Atomically post-decrement <value_>.
long operator-- (int);
+
/// Atomically decrement <value_> by rhs.
long operator-= (long rhs);
+
/// Atomically compare <value_> with rhs.
bool operator== (long rhs) const;
+
/// Atomically compare <value_> with rhs.
bool operator!= (long rhs) const;
+
/// Atomically check if <value_> greater than or equal to rhs.
bool operator>= (long rhs) const;
+
/// Atomically check if <value_> greater than rhs.
bool operator> (long rhs) const;
+
/// Atomically check if <value_> less than or equal to rhs.
bool operator<= (long rhs) const;
+
/// Atomically check if <value_> less than rhs.
bool operator< (long rhs) const;
+
/// Atomically assign rhs to <value_>.
ACE_Atomic_Op<ACE_Thread_Mutex, long> &operator= (long rhs);
+
/// Atomically assign <rhs> to <value_>.
ACE_Atomic_Op<ACE_Thread_Mutex, long> &operator= (const ACE_Atomic_Op<ACE_Thread_Mutex, long> &rhs);
+
/// Explicitly return <value_>.
long value (void) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Explicitly return <value_> (by reference).
volatile long &value_i (void);
+
// ACE_ALLOC_HOOK_DECLARE;
// Declare the dynamic allocation hooks.
+
/// Used during ACE object manager initialization to optimize the fast
/// atomic op implementation according to the number of CPUs.
static void init_functions (void);
+
private:
+
// This function cannot be supported by this template specialization.
// If you need access to an underlying lock, use the ACE_Atomic_Op_Ex
// template instead.
ACE_Thread_Mutex &mutex (void);
+
private:
+
/// Current object decorated by the atomic op.
volatile long value_;
+
// Pointers to selected atomic op implementations.
static long (*increment_fn_) (volatile long *);
static long (*decrement_fn_) (volatile long *);
static long (*exchange_fn_) (volatile long *, long);
static long (*exchange_add_fn_) (volatile long *, long);
};
+
/**
* @class ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>
*
@@ -127,68 +164,98 @@ class ACE_Export ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>
public:
/// Initialize <value_> to 0.
ACE_Atomic_Op (void);
+
/// Initialize <value_> to c.
ACE_Atomic_Op (unsigned long c);
+
/// Manage copying...
ACE_Atomic_Op (const ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long> &c);
+
/// Atomically pre-increment <value_>.
unsigned long operator++ (void);
+
/// Atomically post-increment <value_>.
unsigned long operator++ (int);
+
/// Atomically increment <value_> by rhs.
unsigned long operator+= (unsigned long rhs);
+
/// Atomically pre-decrement <value_>.
unsigned long operator-- (void);
+
/// Atomically post-decrement <value_>.
unsigned long operator-- (int);
+
/// Atomically decrement <value_> by rhs.
unsigned long operator-= (unsigned long rhs);
+
/// Atomically compare <value_> with rhs.
bool operator== (unsigned long rhs) const;
+
/// Atomically compare <value_> with rhs.
bool operator!= (unsigned long rhs) const;
+
/// Atomically check if <value_> greater than or equal to rhs.
bool operator>= (unsigned long rhs) const;
+
/// Atomically check if <value_> greater than rhs.
bool operator> (unsigned long rhs) const;
+
/// Atomically check if <value_> less than or equal to rhs.
bool operator<= (unsigned long rhs) const;
+
/// Atomically check if <value_> less than rhs.
bool operator< (unsigned long rhs) const;
+
/// Atomically assign rhs to <value_>.
ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long> &operator= (unsigned long rhs);
+
/// Atomically assign <rhs> to <value_>.
ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long> &operator= (const ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long> &rhs);
+
/// Explicitly return <value_>.
unsigned long value (void) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Explicitly return <value_> (by reference).
volatile unsigned long &value_i (void);
+
// ACE_ALLOC_HOOK_DECLARE;
// Declare the dynamic allocation hooks.
+
/// Used during ACE object manager initialization to optimize the fast
/// atomic op implementation according to the number of CPUs.
static void init_functions (void);
+
private:
+
// This function cannot be supported by this template specialization.
// If you need access to an underlying lock, use the ACE_Atomic_Op_Ex
// template instead.
ACE_Thread_Mutex &mutex (void);
+
private:
+
/// Current object decorated by the atomic op.
volatile unsigned long value_;
+
// Pointers to selected atomic op implementations.
static long (*increment_fn_) (volatile long *);
static long (*decrement_fn_) (volatile long *);
static long (*exchange_fn_) (volatile long *, long);
static long (*exchange_add_fn_) (volatile long *, long);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_BUILTIN_ATOMIC_OP */
+
#if defined (__ACE_INLINE__)
#include "ace/Atomic_Op.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /*ACE_ATOMIC_OP_H*/
diff --git a/dep/ACE_wrappers/ace/Atomic_Op.inl b/dep/ACE_wrappers/ace/Atomic_Op.inl
index ae51db7d115..ed6bfbdbc1b 100644
--- a/dep/ACE_wrappers/ace/Atomic_Op.inl
+++ b/dep/ACE_wrappers/ace/Atomic_Op.inl
@@ -1,28 +1,36 @@
// -*- C++ -*-
//
// $Id: Atomic_Op.inl 80826 2008-03-04 14:51:23Z wotte $
+
#if defined (ACE_HAS_BUILTIN_ATOMIC_OP)
+
#if defined (ACE_HAS_INTRINSIC_INTERLOCKED)
# include "ace/os_include/os_intrin.h"
+
#pragma intrinsic (_InterlockedExchange, _InterlockedExchangeAdd, _InterlockedIncrement, _InterlockedDecrement)
#endif /* ACE_HAS_INTRINSIC_INTERLOCKED */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_Atomic_Op<ACE_Thread_Mutex, long>::ACE_Atomic_Op (void)
: value_ (0)
{
}
+
ACE_INLINE
ACE_Atomic_Op<ACE_Thread_Mutex, long>::ACE_Atomic_Op (long c)
: value_ (c)
{
}
+
ACE_INLINE
ACE_Atomic_Op<ACE_Thread_Mutex, long>::ACE_Atomic_Op (
const ACE_Atomic_Op<ACE_Thread_Mutex, long> &rhs)
: value_ (rhs.value_)
{
}
+
ACE_INLINE long
ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator++ (void)
{
@@ -34,11 +42,13 @@ ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator++ (void)
return (*increment_fn_) (&this->value_);
#endif /* WIN32 */
}
+
ACE_INLINE long
ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator++ (int)
{
return ++*this - 1;
}
+
ACE_INLINE long
ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator-- (void)
{
@@ -50,11 +60,13 @@ ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator-- (void)
return (*decrement_fn_) (&this->value_);
#endif /* WIN32 */
}
+
ACE_INLINE long
ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator-- (int)
{
return --*this + 1;
}
+
ACE_INLINE long
ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator+= (long rhs)
{
@@ -68,6 +80,7 @@ ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator+= (long rhs)
return (*exchange_add_fn_) (&this->value_, rhs) + rhs;
#endif /* WIN32 && ACE_HAS_INTERLOCKED_EXCHANGEADD */
}
+
ACE_INLINE long
ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator-= (long rhs)
{
@@ -81,36 +94,43 @@ ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator-= (long rhs)
return (*exchange_add_fn_) (&this->value_, -rhs) - rhs;
#endif /* WIN32 && ACE_HAS_INTERLOCKED_EXCHANGEADD */
}
+
ACE_INLINE bool
ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator== (long rhs) const
{
return (this->value_ == rhs);
}
+
ACE_INLINE bool
ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator!= (long rhs) const
{
return (this->value_ != rhs);
}
+
ACE_INLINE bool
ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator>= (long rhs) const
{
return (this->value_ >= rhs);
}
+
ACE_INLINE bool
ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator> (long rhs) const
{
return (this->value_ > rhs);
}
+
ACE_INLINE bool
ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator<= (long rhs) const
{
return (this->value_ <= rhs);
}
+
ACE_INLINE bool
ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator< (long rhs) const
{
return (this->value_ < rhs);
}
+
ACE_INLINE ACE_Atomic_Op<ACE_Thread_Mutex, long> &
ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator= (long rhs)
{
@@ -123,6 +143,7 @@ ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator= (long rhs)
#endif /* WIN32 */
return *this;
}
+
ACE_INLINE ACE_Atomic_Op<ACE_Thread_Mutex, long> &
ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator= (
const ACE_Atomic_Op<ACE_Thread_Mutex, long> &rhs)
@@ -136,33 +157,39 @@ ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator= (
#endif /* WIN32 */
return *this;
}
+
ACE_INLINE long
ACE_Atomic_Op<ACE_Thread_Mutex, long>::value (void) const
{
return this->value_;
}
+
ACE_INLINE volatile long &
ACE_Atomic_Op<ACE_Thread_Mutex, long>::value_i (void)
{
return this->value_;
}
+
ACE_INLINE
ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::ACE_Atomic_Op (void)
: value_ (0)
{
}
+
ACE_INLINE
ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::ACE_Atomic_Op (unsigned long c)
: value_ (c)
{
}
+
ACE_INLINE
ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::ACE_Atomic_Op (
const ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long> &rhs)
: value_ (rhs.value_)
{
}
+
ACE_INLINE unsigned long
ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::operator++ (void)
{
@@ -174,11 +201,13 @@ ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::operator++ (void)
return static_cast<unsigned long> ((*increment_fn_) (reinterpret_cast<volatile long *> (&this->value_)));
#endif /* WIN32 */
}
+
ACE_INLINE unsigned long
ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::operator++ (int)
{
return ++*this - 1;
}
+
ACE_INLINE unsigned long
ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::operator-- (void)
{
@@ -190,11 +219,13 @@ ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::operator-- (void)
return static_cast<unsigned long> ((*decrement_fn_) (reinterpret_cast<volatile long *> (&this->value_)));
#endif /* WIN32 */
}
+
ACE_INLINE unsigned long
ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::operator-- (int)
{
return --*this + 1;
}
+
ACE_INLINE unsigned long
ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::operator+= (unsigned long rhs)
{
@@ -208,6 +239,7 @@ ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::operator+= (unsigned long rhs)
return static_cast<unsigned long> ((*exchange_add_fn_) (reinterpret_cast<volatile long *> (&this->value_), rhs)) + rhs;
#endif /* WIN32 && ACE_HAS_INTERLOCKED_EXCHANGEADD */
}
+
ACE_INLINE unsigned long
ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::operator-= (unsigned long rhs)
{
@@ -222,36 +254,43 @@ ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::operator-= (unsigned long rhs)
return static_cast<unsigned long> ((*exchange_add_fn_) (reinterpret_cast<volatile long *> (&this->value_), -l_rhs)) - rhs;
#endif /* WIN32 && ACE_HAS_INTERLOCKED_EXCHANGEADD */
}
+
ACE_INLINE bool
ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::operator== (unsigned long rhs) const
{
return (this->value_ == rhs);
}
+
ACE_INLINE bool
ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::operator!= (unsigned long rhs) const
{
return (this->value_ != rhs);
}
+
ACE_INLINE bool
ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::operator>= (unsigned long rhs) const
{
return (this->value_ >= rhs);
}
+
ACE_INLINE bool
ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::operator> (unsigned long rhs) const
{
return (this->value_ > rhs);
}
+
ACE_INLINE bool
ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::operator<= (unsigned long rhs) const
{
return (this->value_ <= rhs);
}
+
ACE_INLINE bool
ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::operator< (unsigned long rhs) const
{
return (this->value_ < rhs);
}
+
ACE_INLINE ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long> &
ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::operator= (unsigned long rhs)
{
@@ -264,6 +303,7 @@ ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::operator= (unsigned long rhs)
#endif /* WIN32 */
return *this;
}
+
ACE_INLINE ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long> &
ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::operator= (
const ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long> &rhs)
@@ -277,15 +317,19 @@ ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::operator= (
#endif /* WIN32 */
return *this;
}
+
ACE_INLINE unsigned long
ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::value (void) const
{
return this->value_;
}
+
ACE_INLINE volatile unsigned long &
ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::value_i (void)
{
return this->value_;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_BUILTIN_ATOMIC_OP */
diff --git a/dep/ACE_wrappers/ace/Atomic_Op_Sparc.c b/dep/ACE_wrappers/ace/Atomic_Op_Sparc.c
index e5dd4407261..842673e58cc 100644
--- a/dep/ACE_wrappers/ace/Atomic_Op_Sparc.c
+++ b/dep/ACE_wrappers/ace/Atomic_Op_Sparc.c
@@ -6,7 +6,9 @@
* Portions of this code are based on atomic operations found in the
* linux kernel source code.
*/
+
#if defined (ACE_INCLUDE_ATOMIC_OP_SPARC)
+
#if defined(__i386) && defined(__SUNPRO_C)
static void
__sunpro_asm_code() {
@@ -21,6 +23,7 @@ ace_atomic_add_long: \n\
addl 0x00000008(%esp), %eax \n\
ret \n\
");
+
__asm("\n\
.globl ace_atomic_swap_long \n\
.type ace_atomic_swap_long,@function \n\
@@ -31,6 +34,7 @@ ace_atomic_swap_long: \n\
xchg %eax, (%edx) \n\
ret \n\
");
+
__asm("\n\
.globl ace_atomic_swap_add_long \n\
.type ace_atomic_swap_add_long,@function \n\
@@ -42,7 +46,9 @@ ace_atomic_swap_add_long: \n\
ret \n\
");
}
+
#elif defined(__x86_64) && defined(__SUNPRO_C)
+
static void
__sunpro_asm_code() {
__asm("\n\
@@ -55,6 +61,7 @@ ace_atomic_add_long: \n\
addq %rsi, %rax \n\
ret \n\
");
+
__asm("\n\
.globl ace_atomic_swap_long \n\
.type ace_atomic_swap_long,@function \n\
@@ -64,6 +71,7 @@ ace_atomic_swap_long: \n\
movq %rsi, %rax \n\
ret \n\
");
+
__asm("\n\
.globl ace_atomic_swap_add_long \n\
.type ace_atomic_swap_add_long,@function \n\
@@ -74,7 +82,9 @@ ace_atomic_swap_add_long: \n\
ret \n\
");
}
+
#elif defined (__sparcv9)
+
unsigned long
ace_atomic_add_long (volatile unsigned long *dest, long rhs)
{
@@ -89,6 +99,7 @@ ace_atomic_add_long (volatile unsigned long *dest, long rhs)
"retl\n"
"add %o2, %o1, %o0\n");
}
+
unsigned long
ace_atomic_swap_long (volatile unsigned long *dest, unsigned long rhs)
{
@@ -103,6 +114,7 @@ ace_atomic_swap_long (volatile unsigned long *dest, unsigned long rhs)
"retl\n"
"mov %o3, %o0\n");
}
+
unsigned long
ace_atomic_swap_add_long (volatile unsigned long *dest, long rhs)
{
@@ -118,7 +130,9 @@ ace_atomic_swap_add_long (volatile unsigned long *dest, long rhs)
"retl\n"
"mov %o4, %o0\n");
}
+
#else
+
unsigned long
ace_atomic_add_long (volatile unsigned long *dest, long rhs)
{
@@ -133,6 +147,7 @@ ace_atomic_add_long (volatile unsigned long *dest, long rhs)
"retl\n"
"add %o2, %o1, %o0\n");
}
+
unsigned long
ace_atomic_swap_long (volatile unsigned long *dest, unsigned long rhs)
{
@@ -147,6 +162,7 @@ ace_atomic_swap_long (volatile unsigned long *dest, unsigned long rhs)
"retl\n"
"mov %o3, %o0\n");
}
+
unsigned long
ace_atomic_swap_add_long (volatile unsigned long *dest, long rhs)
{
@@ -162,7 +178,9 @@ ace_atomic_swap_add_long (volatile unsigned long *dest, long rhs)
"retl\n"
"mov %o4, %o0\n");
}
+
# endif /* __sparcv9 */
+
#elif !defined (__GNUC__) && !defined (__INTEL_COMPILER)
/* Make compilers stop complaining about an empty translation unit */
static int shut_up_compiler = 0;
diff --git a/dep/ACE_wrappers/ace/Atomic_Op_Sparc.h b/dep/ACE_wrappers/ace/Atomic_Op_Sparc.h
index 1c748753d55..d521520c9ec 100644
--- a/dep/ACE_wrappers/ace/Atomic_Op_Sparc.h
+++ b/dep/ACE_wrappers/ace/Atomic_Op_Sparc.h
@@ -1,12 +1,15 @@
/* -*- C++ -*- */
// $Id: Atomic_Op_Sparc.h 80826 2008-03-04 14:51:23Z wotte $
+
#ifndef ACE_ATOMIC_OP_SPARC_H
#define ACE_ATOMIC_OP_SPARC_H
+
extern "C"
{
unsigned long ace_atomic_add_long (volatile unsigned long *dest, long rhs);
unsigned long ace_atomic_swap_long (volatile unsigned long *dest, unsigned long rhs);
unsigned long ace_atomic_swap_add_long (volatile unsigned long *dest, long rhs);
}
+
#endif /* ACE_ATOMIC_OP_SPARC_H */
diff --git a/dep/ACE_wrappers/ace/Atomic_Op_T.h b/dep/ACE_wrappers/ace/Atomic_Op_T.h
index 326c1df2c8b..afd163c58e9 100644
--- a/dep/ACE_wrappers/ace/Atomic_Op_T.h
+++ b/dep/ACE_wrappers/ace/Atomic_Op_T.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Atomic_Op_T.h
@@ -8,69 +9,85 @@
* @author Douglas C. Schmidt <schmidt@uci.edu>
*/
//=============================================================================
+
#ifndef ACE_ATOMIC_OP_T_H
#define ACE_ATOMIC_OP_T_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template<typename TYPE>
struct ACE_Type_Traits
{
typedef TYPE const & parameter_type;
};
+
template<>
struct ACE_Type_Traits<bool>
{
typedef bool parameter_type;
};
+
template<>
struct ACE_Type_Traits<char>
{
typedef char parameter_type;
};
+
template<>
struct ACE_Type_Traits<signed char>
{
typedef signed char parameter_type;
};
+
template<>
struct ACE_Type_Traits<unsigned char>
{
typedef unsigned char parameter_type;
};
+
template<>
struct ACE_Type_Traits<short>
{
typedef short parameter_type;
};
+
template<>
struct ACE_Type_Traits<unsigned short>
{
typedef unsigned short parameter_type;
};
+
template<>
struct ACE_Type_Traits<int>
{
typedef int parameter_type;
};
+
template<>
struct ACE_Type_Traits<unsigned int>
{
typedef unsigned int parameter_type;
};
+
template<>
struct ACE_Type_Traits<long>
{
typedef long parameter_type;
};
+
template<>
struct ACE_Type_Traits<unsigned long>
{
typedef unsigned long parameter_type;
};
+
#ifndef ACE_LACKS_LONGLONG_T
template<>
struct ACE_Type_Traits<long long>
@@ -78,6 +95,7 @@ struct ACE_Type_Traits<long long>
typedef long long parameter_type;
};
#endif /* !ACE_LACKS_LONGLONG_T */
+
#if !defined (ACE_LACKS_LONGLONG_T) \
&& !defined (ACE_LACKS_UNSIGNEDLONGLONG_T)
template<>
@@ -86,26 +104,31 @@ struct ACE_Type_Traits<unsigned long long>
typedef unsigned long long parameter_type;
};
#endif /* !ACE_LACKS_LONGLONG_T && !ACE_LACKS_UNSIGNEDLONGLONG_T */
+
template<>
struct ACE_Type_Traits<float>
{
typedef float parameter_type;
};
+
template<>
struct ACE_Type_Traits<double>
{
typedef double parameter_type;
};
+
template<>
struct ACE_Type_Traits<long double>
{
typedef long double parameter_type;
};
+
template<typename TYPE>
struct ACE_Type_Traits<TYPE*>
{
typedef TYPE* parameter_type;
};
+
/**
* @class ACE_Atomic_Op_Ex
*
@@ -128,50 +151,74 @@ template <class ACE_LOCK, typename TYPE>
class ACE_Atomic_Op_Ex
{
public:
+
typedef typename ACE_Type_Traits<TYPE>::parameter_type arg_type;
+
// = Initialization methods.
+
/// Initialize @c value_ to 0.
ACE_Atomic_Op_Ex (ACE_LOCK & mtx);
+
/// Initialize @c value_ to c.
ACE_Atomic_Op_Ex (ACE_LOCK & mtx, arg_type c);
+
// = Accessors.
+
/// Atomically pre-increment @c value_.
TYPE operator++ (void);
+
/// Atomically post-increment @c value_.
TYPE operator++ (int);
+
/// Atomically increment @c value_ by rhs.
TYPE operator+= (arg_type rhs);
+
/// Atomically pre-decrement @c value_.
TYPE operator-- (void);
+
/// Atomically post-decrement @c value_.
TYPE operator-- (int);
+
/// Atomically decrement @c value_ by rhs.
TYPE operator-= (arg_type rhs);
+
/// Atomically compare @c value_ with rhs.
bool operator== (arg_type rhs) const;
+
/// Atomically compare @c value_ with rhs.
bool operator!= (arg_type rhs) const;
+
/// Atomically check if @c value_ greater than or equal to rhs.
bool operator>= (arg_type rhs) const;
+
/// Atomically check if @c value_ greater than rhs.
bool operator> (arg_type rhs) const;
+
/// Atomically check if @c value_ less than or equal to rhs.
bool operator<= (arg_type rhs) const;
+
/// Atomically check if @c value_ less than rhs.
bool operator< (arg_type rhs) const;
+
/// Atomically assign rhs to @c value_.
ACE_Atomic_Op_Ex<ACE_LOCK, TYPE> &operator= (arg_type rhs);
+
/// Atomically assign <rhs> to @c value_.
ACE_Atomic_Op_Ex<ACE_LOCK, TYPE> &operator= (
ACE_Atomic_Op_Ex<ACE_LOCK, TYPE> const & rhs);
+
/// Explicitly return @c value_.
TYPE value (void) const;
+
/// Dump the state of an object.
void dump (void) const;
+
// ACE_ALLOC_HOOK_DECLARE;
// Declare the dynamic allocation hooks.
+
/// Manage copying...
ACE_Atomic_Op_Ex (ACE_Atomic_Op_Ex<ACE_LOCK, TYPE> const &);
+
/**
* Returns a reference to the underlying <ACE_LOCK>. This makes it
* possible to acquire the lock explicitly, which can be useful in
@@ -180,6 +227,7 @@ public:
* name would be lock_, but HP/C++ will choke on that!
*/
ACE_LOCK & mutex (void);
+
/**
* Explicitly return @c value_ (by reference). This gives the user
* full, unrestricted access to the underlying value. This method
@@ -187,12 +235,15 @@ public:
* lock. Use with care ;-)
*/
TYPE & value_i (void);
+
private:
/// Type of synchronization mechanism.
ACE_LOCK & mutex_;
+
/// Current object decorated by the atomic op.
TYPE value_;
};
+
/**
* @class ACE_Atomic_Op
*
@@ -211,46 +262,67 @@ template <class ACE_LOCK, typename TYPE>
class ACE_Atomic_Op
{
public:
+
typedef typename ACE_Type_Traits<TYPE>::parameter_type arg_type;
+
/// Initialize @c value_ to 0.
ACE_Atomic_Op (void);
+
/// Initialize @c value_ to c.
ACE_Atomic_Op (arg_type c);
+
/// Manage copying...
ACE_Atomic_Op (ACE_Atomic_Op<ACE_LOCK, TYPE> const & c);
+
/// Atomically assign rhs to @c value_.
ACE_Atomic_Op<ACE_LOCK, TYPE> & operator= (arg_type rhs);
+
/// Atomically assign <rhs> to @c value_.
ACE_Atomic_Op<ACE_LOCK, TYPE> & operator= (
ACE_Atomic_Op<ACE_LOCK, TYPE> const & rhs);
+
/// Atomically pre-increment @c value_.
TYPE operator++ (void);
+
/// Atomically post-increment @c value_.
TYPE operator++ (int);
+
/// Atomically increment @c value_ by rhs.
TYPE operator+= (arg_type rhs);
+
/// Atomically pre-decrement @c value_.
TYPE operator-- (void);
+
/// Atomically post-decrement @c value_.
TYPE operator-- (int);
+
/// Atomically decrement @c value_ by rhs.
TYPE operator-= (arg_type rhs);
+
/// Atomically compare @c value_ with rhs.
bool operator== (arg_type rhs) const;
+
/// Atomically compare @c value_ with rhs.
bool operator!= (arg_type rhs) const;
+
/// Atomically check if @c value_ greater than or equal to rhs.
bool operator>= (arg_type rhs) const;
+
/// Atomically check if @c value_ greater than rhs.
bool operator> (arg_type rhs) const;
+
/// Atomically check if @c value_ less than or equal to rhs.
bool operator<= (arg_type rhs) const;
+
/// Atomically check if @c value_ less than rhs.
bool operator< (arg_type rhs) const;
+
/// Explicitly return @c value_.
TYPE value (void) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/**
* Returns a reference to the underlying <ACE_LOCK>. This makes it
* possible to acquire the lock explicitly, which can be useful in
@@ -262,6 +334,7 @@ public:
* using the ACE_Atomic_Op_Ex template instead.
*/
ACE_LOCK & mutex (void);
+
/**
* Explicitly return @c value_ (by reference). This gives the user
* full, unrestricted access to the underlying value. This method
@@ -269,22 +342,29 @@ public:
* lock. Use with care ;-)
*/
TYPE & value_i (void);
+
private:
/// Type of synchronization mechanism.
ACE_LOCK own_mutex_;
+
/// Underlying atomic op implementation.
ACE_Atomic_Op_Ex <ACE_LOCK, TYPE> impl_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Atomic_Op_T.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Atomic_Op_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Atomic_Op_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
#endif /*ACE_ATOMIC_OP_T_H*/
diff --git a/dep/ACE_wrappers/ace/Atomic_Op_T.inl b/dep/ACE_wrappers/ace/Atomic_Op_T.inl
index fbbdc7711d8..ff051b0cbce 100644
--- a/dep/ACE_wrappers/ace/Atomic_Op_T.inl
+++ b/dep/ACE_wrappers/ace/Atomic_Op_T.inl
@@ -1,12 +1,17 @@
// -*- C++ -*-
//
// $Id: Atomic_Op_T.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Guard_T.h"
+
#include <algorithm>
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
//
// ACE_Atomic_Op_Ex inline functions
//
+
template <class ACE_LOCK, class TYPE>
ACE_INLINE TYPE
ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator++ (void)
@@ -15,6 +20,7 @@ ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator++ (void)
ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_);
return ++this->value_;
}
+
template <class ACE_LOCK, class TYPE>
ACE_INLINE TYPE
ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator+= (
@@ -24,6 +30,7 @@ ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator+= (
ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_);
return this->value_ += rhs;
}
+
template <class ACE_LOCK, class TYPE>
ACE_INLINE TYPE
ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator-- (void)
@@ -32,6 +39,7 @@ ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator-- (void)
ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_);
return --this->value_;
}
+
template <class ACE_LOCK, class TYPE>
ACE_INLINE TYPE
ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator-= (
@@ -41,6 +49,7 @@ ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator-= (
ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_);
return this->value_ -= rhs;
}
+
template <class ACE_LOCK, class TYPE>
ACE_INLINE
ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::ACE_Atomic_Op_Ex (
@@ -50,6 +59,7 @@ ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::ACE_Atomic_Op_Ex (
{
// ACE_TRACE ("ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::ACE_Atomic_Op_Ex");
}
+
template <class ACE_LOCK, class TYPE>
ACE_INLINE TYPE
ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator++ (int)
@@ -58,6 +68,7 @@ ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator++ (int)
ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_);
return this->value_++;
}
+
template <class ACE_LOCK, class TYPE>
ACE_INLINE TYPE
ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator-- (int)
@@ -66,6 +77,7 @@ ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator-- (int)
ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_);
return this->value_--;
}
+
template <class ACE_LOCK, class TYPE>
ACE_INLINE bool
ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator== (
@@ -75,6 +87,7 @@ ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator== (
ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, false);
return this->value_ == rhs;
}
+
template <class ACE_LOCK, class TYPE>
ACE_INLINE bool
ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator!= (
@@ -83,6 +96,7 @@ ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator!= (
// ACE_TRACE ("ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator!=");
return !(*this == rhs);
}
+
template <class ACE_LOCK, class TYPE>
ACE_INLINE bool
ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator>= (
@@ -92,6 +106,7 @@ ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator>= (
ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, false);
return this->value_ >= rhs;
}
+
template <class ACE_LOCK, class TYPE>
ACE_INLINE bool
ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator> (
@@ -101,6 +116,7 @@ ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator> (
ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, false);
return this->value_ > rhs;
}
+
template <class ACE_LOCK, class TYPE>
ACE_INLINE bool
ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator<= (
@@ -110,6 +126,7 @@ ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator<= (
ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, false);
return this->value_ <= rhs;
}
+
template <class ACE_LOCK, class TYPE>
ACE_INLINE bool
ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator< (
@@ -119,17 +136,22 @@ ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator< (
ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, false);
return this->value_ < rhs;
}
+
template <class ACE_LOCK, class TYPE>
ACE_INLINE ACE_Atomic_Op_Ex<ACE_LOCK, TYPE> &
ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator= (
ACE_Atomic_Op_Ex<ACE_LOCK, TYPE> const & rhs)
{
// ACE_TRACE ("ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator=");
+
ACE_Atomic_Op_Ex<ACE_LOCK, TYPE> tmp (rhs);
+
ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, *this);
std::swap (this->value_, tmp.value_);
+
return *this;
}
+
template <class ACE_LOCK, class TYPE>
ACE_INLINE TYPE
ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::value (void) const
@@ -138,6 +160,7 @@ ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::value (void) const
ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_);
return this->value_;
}
+
template <class ACE_LOCK, class TYPE>
ACE_INLINE TYPE &
ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::value_i (void)
@@ -148,6 +171,7 @@ ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::value_i (void)
// lock. Use with care ;-)
return this->value_;
}
+
template <class ACE_LOCK, class TYPE>
ACE_INLINE ACE_Atomic_Op_Ex<ACE_LOCK, TYPE> &
ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator= (
@@ -158,9 +182,11 @@ ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator= (
this->value_ = rhs;
return *this;
}
+
//
// ACE_Atomic_Op inline functions
//
+
template <class ACE_LOCK, class TYPE> ACE_INLINE
ACE_Atomic_Op<ACE_LOCK, TYPE>::ACE_Atomic_Op (
ACE_Atomic_Op<ACE_LOCK, TYPE> const & rhs)
@@ -169,6 +195,7 @@ ACE_Atomic_Op<ACE_LOCK, TYPE>::ACE_Atomic_Op (
// ACE_TRACE ("ACE_Atomic_Op<ACE_LOCK, TYPE>::ACE_Atomic_Op");
}
+
template <class ACE_LOCK, class TYPE>
ACE_INLINE ACE_Atomic_Op<ACE_LOCK, TYPE> &
ACE_Atomic_Op<ACE_LOCK, TYPE>::operator= (
@@ -177,6 +204,7 @@ ACE_Atomic_Op<ACE_LOCK, TYPE>::operator= (
this->impl_ = i;
return *this;
}
+
template <class ACE_LOCK, class TYPE>
ACE_INLINE ACE_Atomic_Op<ACE_LOCK, TYPE> &
ACE_Atomic_Op<ACE_LOCK, TYPE>::operator= (
@@ -185,18 +213,21 @@ ACE_Atomic_Op<ACE_LOCK, TYPE>::operator= (
this->impl_ = rhs.impl_;
return *this;
}
+
template <class ACE_LOCK, class TYPE>
ACE_INLINE TYPE
ACE_Atomic_Op<ACE_LOCK, TYPE>::operator++ (void)
{
return ++this->impl_;
}
+
template <class ACE_LOCK, class TYPE>
ACE_INLINE TYPE
ACE_Atomic_Op<ACE_LOCK, TYPE>::operator++ (int)
{
return this->impl_++;
}
+
template <class ACE_LOCK, class TYPE>
ACE_INLINE TYPE
ACE_Atomic_Op<ACE_LOCK, TYPE>::operator+= (
@@ -204,18 +235,21 @@ ACE_Atomic_Op<ACE_LOCK, TYPE>::operator+= (
{
return this->impl_ += rhs;
}
+
template <class ACE_LOCK, class TYPE>
ACE_INLINE TYPE
ACE_Atomic_Op<ACE_LOCK, TYPE>::operator-- (void)
{
return --this->impl_;
}
+
template <class ACE_LOCK, class TYPE>
ACE_INLINE TYPE
ACE_Atomic_Op<ACE_LOCK, TYPE>::operator-- (int)
{
return this->impl_--;
}
+
template <class ACE_LOCK, class TYPE>
ACE_INLINE TYPE
ACE_Atomic_Op<ACE_LOCK, TYPE>::operator-= (
@@ -223,6 +257,7 @@ ACE_Atomic_Op<ACE_LOCK, TYPE>::operator-= (
{
return this->impl_ -= rhs;
}
+
template <class ACE_LOCK, class TYPE>
ACE_INLINE bool
ACE_Atomic_Op<ACE_LOCK, TYPE>::operator== (
@@ -230,6 +265,7 @@ ACE_Atomic_Op<ACE_LOCK, TYPE>::operator== (
{
return this->impl_ == rhs;
}
+
template <class ACE_LOCK, class TYPE>
ACE_INLINE bool
ACE_Atomic_Op<ACE_LOCK, TYPE>::operator!= (
@@ -237,6 +273,7 @@ ACE_Atomic_Op<ACE_LOCK, TYPE>::operator!= (
{
return this->impl_ != rhs;
}
+
template <class ACE_LOCK, class TYPE>
ACE_INLINE bool
ACE_Atomic_Op<ACE_LOCK, TYPE>::operator>= (
@@ -244,6 +281,7 @@ ACE_Atomic_Op<ACE_LOCK, TYPE>::operator>= (
{
return this->impl_ >= rhs;
}
+
template <class ACE_LOCK, class TYPE>
ACE_INLINE bool
ACE_Atomic_Op<ACE_LOCK, TYPE>::operator> (
@@ -251,6 +289,7 @@ ACE_Atomic_Op<ACE_LOCK, TYPE>::operator> (
{
return this->impl_ > rhs;
}
+
template <class ACE_LOCK, class TYPE>
ACE_INLINE bool
ACE_Atomic_Op<ACE_LOCK, TYPE>::operator<= (
@@ -258,6 +297,7 @@ ACE_Atomic_Op<ACE_LOCK, TYPE>::operator<= (
{
return this->impl_ <= rhs;
}
+
template <class ACE_LOCK, class TYPE>
ACE_INLINE bool
ACE_Atomic_Op<ACE_LOCK, TYPE>::operator< (
@@ -265,12 +305,14 @@ ACE_Atomic_Op<ACE_LOCK, TYPE>::operator< (
{
return this->impl_ < rhs;
}
+
template <class ACE_LOCK, class TYPE>
ACE_INLINE TYPE
ACE_Atomic_Op<ACE_LOCK, TYPE>::value (void) const
{
return this->impl_.value ();
}
+
template <class ACE_LOCK, class TYPE>
ACE_INLINE void
ACE_Atomic_Op<ACE_LOCK, TYPE>::dump (void) const
@@ -280,16 +322,19 @@ ACE_Atomic_Op<ACE_LOCK, TYPE>::dump (void) const
#endif /* ACE_HAS_DUMP */
return;
}
+
template <class ACE_LOCK, class TYPE>
ACE_INLINE ACE_LOCK &
ACE_Atomic_Op<ACE_LOCK, TYPE>::mutex (void)
{
return this->own_mutex_;
}
+
template <class ACE_LOCK, class TYPE>
ACE_INLINE TYPE &
ACE_Atomic_Op<ACE_LOCK, TYPE>::value_i (void)
{
return this->impl_.value_i ();
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Auto_Event.cpp b/dep/ACE_wrappers/ace/Auto_Event.cpp
index ffe5c9450c0..875b7ad05cd 100644
--- a/dep/ACE_wrappers/ace/Auto_Event.cpp
+++ b/dep/ACE_wrappers/ace/Auto_Event.cpp
@@ -1,12 +1,17 @@
// $Id: Auto_Event.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Auto_Event.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Auto_Event.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID (ace,
Auto_Event,
"$Id: Auto_Event.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_Auto_Event::ACE_Auto_Event (int initial_state,
int type,
const char *name,
@@ -18,6 +23,7 @@ ACE_Auto_Event::ACE_Auto_Event (int initial_state,
arg)
{
}
+
#if defined (ACE_HAS_WCHAR)
ACE_Auto_Event::ACE_Auto_Event (int initial_state,
int type,
@@ -31,6 +37,7 @@ ACE_Auto_Event::ACE_Auto_Event (int initial_state,
{
}
#endif /* ACE_HAS_WCHAR */
+
void
ACE_Auto_Event::dump (void) const
{
@@ -38,5 +45,6 @@ ACE_Auto_Event::dump (void) const
ACE_Event::dump ();
#endif /* ACE_HAS_DUMP */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Auto_Event.h b/dep/ACE_wrappers/ace/Auto_Event.h
index 9d29771cc02..307c89cddae 100644
--- a/dep/ACE_wrappers/ace/Auto_Event.h
+++ b/dep/ACE_wrappers/ace/Auto_Event.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file Auto_Event.h
@@ -10,15 +11,21 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//==========================================================================
+
#ifndef ACE_AUTO_EVENT_H
#define ACE_AUTO_EVENT_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Event.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Auto_Event
*
@@ -37,6 +44,7 @@ public:
int type = USYNC_THREAD,
const char *name = 0,
void *arg = 0);
+
#if defined (ACE_HAS_WCHAR)
/// Constructor which will create auto event (wchar_t version)
ACE_Auto_Event (int initial_state,
@@ -44,17 +52,23 @@ public:
const wchar_t *name,
void *arg = 0);
#endif /* ACE_HAS_WCHAR */
+
/// Default dtor.
~ACE_Auto_Event (void);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks
ACE_ALLOC_HOOK_DECLARE;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Auto_Event.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_AUTO_EVENT_H */
diff --git a/dep/ACE_wrappers/ace/Auto_Event.inl b/dep/ACE_wrappers/ace/Auto_Event.inl
index fb5d4e857a1..b614e0b0d77 100644
--- a/dep/ACE_wrappers/ace/Auto_Event.inl
+++ b/dep/ACE_wrappers/ace/Auto_Event.inl
@@ -1,9 +1,12 @@
// -*- C++ -*-
//
// $Id: Auto_Event.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_Auto_Event::~ACE_Auto_Event (void)
{
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Auto_Functor.h b/dep/ACE_wrappers/ace/Auto_Functor.h
index 2c8a963fcd7..339054506be 100644
--- a/dep/ACE_wrappers/ace/Auto_Functor.h
+++ b/dep/ACE_wrappers/ace/Auto_Functor.h
@@ -11,12 +11,17 @@
#ifndef ACE_AUTO_FUNCTOR_H
#define ACE_AUTO_FUNCTOR_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Global_Macros.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE_Utils
{
/**
@@ -30,8 +35,10 @@ struct Auto_Functor_Ref
{
X * p_;
Functor f_;
+
Auto_Functor_Ref(X * p, Functor f);
};
+
/**
* @class Auto_Functor
*
@@ -53,45 +60,69 @@ class Auto_Functor
public:
typedef X element_type;
typedef Functor functor_type;
+
/// Constructor
explicit Auto_Functor (X * p = 0,
Functor functor = Functor()); // throw()
+
Auto_Functor (Auto_Functor & rhs); // throw()
+
Auto_Functor<X,Functor>& operator= (Auto_Functor & rhs); // throw()
+
#if !defined(ACE_LACKS_MEMBER_TEMPLATES)
template<typename Y>
Auto_Functor(Auto_Functor<Y,Functor>& rhs); // throw()
+
template<typename Y>
Auto_Functor<X,Functor>& operator= (Auto_Functor<Y,Functor>& rhs); // throw()
#endif /* ACE_LACKS_MEMBER_TEMPLATES */
+
~Auto_Functor(); // throw()
+
X & operator*() const; // throw()
+
X * operator->() const; // throw()
+
X * get(); // throw()
+
X * release(); // throw()
+
void reset (X * p = 0); // throw()
+
void reset (X * p, Functor f); // throw()
+
Functor const & functor() const; // throw()
+
Auto_Functor(Auto_Functor_Ref<X,Functor> rhs); // throw()
+
Auto_Functor<X,Functor> & operator=(Auto_Functor_Ref<X,Functor> rhs); // throw()
+
#if !defined(ACE_LACKS_MEMBER_TEMPLATES)
template<typename Y> operator Auto_Functor_Ref<Y,Functor>(); // throw()
+
template<typename Y> operator Auto_Functor<Y,Functor>(); // throw()
#else
operator Auto_Functor_Ref<X,Functor>(); // throw()
#endif /* ACE_LACKS_MEMBER_TEMPLATES */
+
private:
X * p_;
+
Functor f_;
};
+
} // namespace ACE_Utils
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined(__ACE_INLINE__)
# include "ace/Auto_Functor.inl"
#endif /* __ACE_INLINE__ */
+
#if defined(ACE_TEMPLATES_REQUIRE_SOURCE)
# include "ace/Auto_Functor.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#include /**/ "ace/post.h"
#endif /* ACE_AUTO_FUNCTOR_H*/
diff --git a/dep/ACE_wrappers/ace/Auto_Functor.inl b/dep/ACE_wrappers/ace/Auto_Functor.inl
index 898f60ff2a9..d4cb2cc0473 100644
--- a/dep/ACE_wrappers/ace/Auto_Functor.inl
+++ b/dep/ACE_wrappers/ace/Auto_Functor.inl
@@ -1,7 +1,9 @@
// -*- C++ -*-
//
// $Id: Auto_Functor.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template<typename X, typename Functor> ACE_INLINE
ACE_Utils::Auto_Functor_Ref<X,Functor>::
Auto_Functor_Ref(X * p, Functor f)
@@ -9,18 +11,21 @@ Auto_Functor_Ref(X * p, Functor f)
, f_(f)
{
}
+
template<typename X, typename Functor> ACE_INLINE
ACE_Utils::Auto_Functor<X,Functor>::Auto_Functor(X * p, Functor f)
: p_(p)
, f_(f)
{
}
+
template<typename X, typename Functor> ACE_INLINE
ACE_Utils::Auto_Functor<X,Functor>::Auto_Functor(Auto_Functor & rhs)
: p_(rhs.release())
, f_(rhs.f_)
{
}
+
template<typename X, typename Functor>
ACE_INLINE ACE_Utils::Auto_Functor<X,Functor>&
ACE_Utils::Auto_Functor<X,Functor>:: operator=(Auto_Functor & rhs)
@@ -29,6 +34,7 @@ ACE_Utils::Auto_Functor<X,Functor>:: operator=(Auto_Functor & rhs)
f_ = rhs.f_;
return *this;
}
+
#if !defined(ACE_LACKS_MEMBER_TEMPLATES)
template<typename X, typename Functor> template<typename Y> ACE_INLINE
ACE_Utils::Auto_Functor<X,Functor>::Auto_Functor(Auto_Functor<Y,Functor>& rhs)
@@ -36,6 +42,7 @@ ACE_Utils::Auto_Functor<X,Functor>::Auto_Functor(Auto_Functor<Y,Functor>& rhs)
, f_(rhs.f_)
{
}
+
template<typename X, typename Functor> template<typename Y>
ACE_INLINE ACE_Utils::Auto_Functor<X,Functor>&
ACE_Utils::Auto_Functor<X,Functor>::operator=(Auto_Functor<Y,Functor>& rhs)
@@ -44,23 +51,27 @@ ACE_Utils::Auto_Functor<X,Functor>::operator=(Auto_Functor<Y,Functor>& rhs)
return *this;
}
#endif /* ACE_LACKS_MEMBER_TEMPLATES */
+
template<typename X, typename Functor> ACE_INLINE X &
ACE_Utils::Auto_Functor<X,Functor>::operator*() const
{
return *p_;
}
+
template<typename X, typename Functor>
ACE_INLINE X *
ACE_Utils::Auto_Functor<X,Functor>::operator->() const
{
return p_;
}
+
template<typename X, typename Functor>
ACE_INLINE X *
ACE_Utils::Auto_Functor<X,Functor>::get()
{
return p_;
}
+
template<typename X, typename Functor>
ACE_INLINE X *
ACE_Utils::Auto_Functor<X,Functor>::release()
@@ -69,18 +80,21 @@ ACE_Utils::Auto_Functor<X,Functor>::release()
p_ = 0;
return tmp;
}
+
template<typename X, typename Functor>
ACE_INLINE Functor const &
ACE_Utils::Auto_Functor<X,Functor>::functor() const
{
return f_;
}
+
template<typename X, typename Functor> ACE_INLINE
ACE_Utils::Auto_Functor<X,Functor>::Auto_Functor(Auto_Functor_Ref<X,Functor> rhs)
: p_(rhs.p_)
, f_(rhs.f_)
{
}
+
template<typename X, typename Functor>
ACE_INLINE ACE_Utils::Auto_Functor<X,Functor> &
ACE_Utils::Auto_Functor<X,Functor>::operator=(Auto_Functor_Ref<X,Functor> rhs)
@@ -92,22 +106,29 @@ ACE_Utils::Auto_Functor<X,Functor>::operator=(Auto_Functor_Ref<X,Functor> rhs)
}
return *this;
}
+
#if !defined(ACE_LACKS_MEMBER_TEMPLATES)
+
template<typename X, typename Functor> template<typename Y> ACE_INLINE
ACE_Utils::Auto_Functor<X,Functor>::operator ACE_Utils::Auto_Functor_Ref<Y,Functor>()
{
return ACE_Utils::Auto_Functor_Ref<Y,Functor>(release(), f_);
}
+
template<typename X, typename Functor> template<typename Y> ACE_INLINE
ACE_Utils::Auto_Functor<X,Functor>::operator ACE_Utils::Auto_Functor<Y,Functor>()
{
return ACE_Utils::Auto_Functor<Y,Functor>(release(), f_);
}
+
#else
+
template<typename X, typename Functor>ACE_INLINE
ACE_Utils::Auto_Functor<X,Functor>::operator ACE_Utils::Auto_Functor_Ref<X,Functor>()
{
return ACE_Utils::Auto_Functor_Ref<X,Functor>(release(), f_);
}
+
#endif /* ACE_LACKS_MEMBER_TEMPLATES */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Auto_IncDec_T.h b/dep/ACE_wrappers/ace/Auto_IncDec_T.h
index 745a83a100e..bc46b8b2f50 100644
--- a/dep/ACE_wrappers/ace/Auto_IncDec_T.h
+++ b/dep/ACE_wrappers/ace/Auto_IncDec_T.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Auto_IncDec_T.h
@@ -9,15 +10,22 @@
*/
//=============================================================================
+
#ifndef ACE_AUTO_INCDEC_T_H
#define ACE_AUTO_INCDEC_T_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Global_Macros.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Auto_IncDec
*
@@ -33,16 +41,21 @@ template <class ACE_SAFELY_INCREMENTABLE_DECREMENTABLE>
class ACE_Auto_IncDec
{
public:
+
/// Implicitly increment the counter.
ACE_Auto_IncDec (ACE_SAFELY_INCREMENTABLE_DECREMENTABLE &counter);
+
/// Implicitly decrement the counter.
~ACE_Auto_IncDec (void);
+
/// Dump the state of an object.
void dump (void) const;
+
protected:
/// Reference to the <ACE_SAFELY_INCREMENTABLE_DECREMENTABLE> counter
/// we're incrementing/decrementing.
ACE_SAFELY_INCREMENTABLE_DECREMENTABLE &counter_;
+
private:
// = Prevent assignment and initialization.
ACE_UNIMPLEMENTED_FUNC (void operator= (const
@@ -50,10 +63,13 @@ private:
ACE_UNIMPLEMENTED_FUNC (ACE_Auto_IncDec (const
ACE_Auto_IncDec<ACE_SAFELY_INCREMENTABLE_DECREMENTABLE> &))
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Auto_IncDec_T.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Auto_IncDec_T.cpp"
// On Win32 platforms, this code will be included as template source
@@ -65,9 +81,12 @@ ACE_END_VERSIONED_NAMESPACE_DECL
// specialization code. Also, the specialization code *must* be
// inlined or the compiler will ignore the specializations.
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Auto_IncDec_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_AUTO_INCDEC_T_H */
diff --git a/dep/ACE_wrappers/ace/Auto_IncDec_T.inl b/dep/ACE_wrappers/ace/Auto_IncDec_T.inl
index b7f91b1cb66..e61980e7192 100644
--- a/dep/ACE_wrappers/ace/Auto_IncDec_T.inl
+++ b/dep/ACE_wrappers/ace/Auto_IncDec_T.inl
@@ -1,8 +1,11 @@
// -*- C++ -*-
//
// $Id: Auto_IncDec_T.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Implicitly and automatically increment the counter.
+
template <class ACE_SAFELY_INCREMENTABLE_DECREMENTABLE> ACE_INLINE
ACE_Auto_IncDec<ACE_SAFELY_INCREMENTABLE_DECREMENTABLE>::ACE_Auto_IncDec
(ACE_SAFELY_INCREMENTABLE_DECREMENTABLE &counter)
@@ -10,10 +13,13 @@ ACE_Auto_IncDec<ACE_SAFELY_INCREMENTABLE_DECREMENTABLE>::ACE_Auto_IncDec
{
++this->counter_;
}
+
// Implicitly and automatically decrement the counter.
+
template <class ACE_SAFELY_INCREMENTABLE_DECREMENTABLE> ACE_INLINE
ACE_Auto_IncDec<ACE_SAFELY_INCREMENTABLE_DECREMENTABLE>::~ACE_Auto_IncDec (void)
{
--this->counter_;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Auto_Ptr.h b/dep/ACE_wrappers/ace/Auto_Ptr.h
index 5fbe5647fdd..d7547c440e2 100644
--- a/dep/ACE_wrappers/ace/Auto_Ptr.h
+++ b/dep/ACE_wrappers/ace/Auto_Ptr.h
@@ -1,4 +1,5 @@
/* -*- C++ -*- */
+
//=============================================================================
/**
* @file Auto_Ptr.h
@@ -11,13 +12,17 @@
* @author Dr. Harald M. Mueller <mueller@garwein.hai.siemens.co.at>
*/
//=============================================================================
+
#ifndef ACE_AUTO_PTR_H
#define ACE_AUTO_PTR_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (_MSC_VER)
// Suppress warning e.g. "return type for
// 'ACE_Auto_Array_Pointer<type>::operator ->' is 'type *' (i.e., not a UDT
@@ -27,7 +32,9 @@
# pragma warning(disable: 4284)
#endif /* _MSC_VER */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Auto_Basic_Ptr
*
@@ -39,24 +46,32 @@ class ACE_Auto_Basic_Ptr
{
public:
typedef X element_type;
+
// = Initialization and termination methods
explicit ACE_Auto_Basic_Ptr (X * p = 0) : p_ (p) {}
+
ACE_Auto_Basic_Ptr (ACE_Auto_Basic_Ptr<X> & ap);
ACE_Auto_Basic_Ptr<X> &operator= (ACE_Auto_Basic_Ptr<X> & rhs);
~ACE_Auto_Basic_Ptr (void);
+
// = Accessor methods.
X &operator *() const;
X *get (void) const;
X *release (void);
void reset (X * p = 0);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
X *p_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if !defined (ACE_LACKS_AUTO_PTR) && \
defined (ACE_HAS_STANDARD_CPP_LIBRARY) && \
(ACE_HAS_STANDARD_CPP_LIBRARY != 0)
@@ -66,6 +81,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
using std::auto_ptr;
#endif /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */
#else /* ACE_HAS_STANDARD_CPP_LIBRARY */
+
/**
* @class auto_ptr
*
@@ -76,13 +92,18 @@ class auto_ptr : public ACE_Auto_Basic_Ptr<X>
{
public:
typedef X element_type;
+
// = Initialization and termination methods
explicit auto_ptr (X * p = 0) : ACE_Auto_Basic_Ptr<X> (p) {}
auto_ptr (auto_ptr<X> & ap) : ACE_Auto_Basic_Ptr<X> (ap.release ()) {}
+
X *operator-> () const;
};
+
#endif /* ACE_HAS_STANDARD_CPP_LIBRARY */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @brief Implements the draft C++ standard auto_ptr abstraction.
* This version can be used instead of auto_ptr<T>, and obviates
@@ -94,10 +115,13 @@ class ACE_Auto_Ptr : public ACE_Auto_Basic_Ptr <X>
{
public:
typedef X element_type;
+
// = Initialization and termination methods
explicit ACE_Auto_Ptr (X * p = 0) : ACE_Auto_Basic_Ptr<X> (p) {}
+
X *operator-> () const;
};
+
/**
* @class ACE_Auto_Basic_Array_Ptr
*
@@ -111,24 +135,31 @@ class ACE_Auto_Basic_Array_Ptr
{
public:
typedef X element_type;
+
// = Initialization and termination methods.
explicit ACE_Auto_Basic_Array_Ptr (X * p = 0) : p_ (p) {}
+
ACE_Auto_Basic_Array_Ptr (ACE_Auto_Basic_Array_Ptr<X> & ap);
ACE_Auto_Basic_Array_Ptr<X> &operator= (ACE_Auto_Basic_Array_Ptr<X> & rhs);
~ACE_Auto_Basic_Array_Ptr (void);
+
// = Accessor methods.
X & operator* () const;
X & operator[] (int i) const;
X * get (void) const;
X * release (void);
void reset (X * p = 0);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
X * p_;
};
+
/**
* @class ACE_Auto_Array_Ptr
*
@@ -140,12 +171,15 @@ class ACE_Auto_Array_Ptr : public ACE_Auto_Basic_Array_Ptr<X>
{
public:
typedef X element_type;
+
// = Initialization and termination methods.
explicit ACE_Auto_Array_Ptr (X *p = 0)
: ACE_Auto_Basic_Array_Ptr<X> (p) {}
+
X *operator-> () const;
};
+
/**
* @brief Reset given @c auto_ptr element to new element.
*
@@ -172,7 +206,9 @@ ACE_auto_ptr_reset (AUTO_PTR_TYPE & ap,
ap.reset (p);
#endif /* ACE_AUTO_PTR_LACKS_RESET */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
// Some platforms have an older version of auto_ptr
// support, which lacks reset, and cannot be disabled
// easily. Portability to these platforms requires
@@ -184,19 +220,24 @@ ACE_END_VERSIONED_NAMESPACE_DECL
// ACE_AUTO_PTR_RESET.
# define ACE_AUTO_PTR_RESET(AUTOPTR,NEWPTR,TYPE) \
ACE_auto_ptr_reset (AUTOPTR, NEWPTR);
+
#if defined (__ACE_INLINE__)
#include "ace/Auto_Ptr.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Auto_Ptr.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Auto_Ptr.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#if defined (_MSC_VER)
// Restore the warning state to what it was before entry.
# pragma warning(pop)
#endif /* _MSC_VER */
+
#include /**/ "ace/post.h"
#endif /* ACE_AUTO_PTR_H */
diff --git a/dep/ACE_wrappers/ace/Auto_Ptr.inl b/dep/ACE_wrappers/ace/Auto_Ptr.inl
index 6a801bfc2ad..9ea47c3f208 100644
--- a/dep/ACE_wrappers/ace/Auto_Ptr.inl
+++ b/dep/ACE_wrappers/ace/Auto_Ptr.inl
@@ -1,8 +1,11 @@
// -*- C++ -*-
//
// $Id: Auto_Ptr.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Global_Macros.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template<class X> ACE_INLINE void
ACE_Auto_Basic_Ptr<X>::dump (void) const
{
@@ -10,6 +13,7 @@ ACE_Auto_Basic_Ptr<X>::dump (void) const
ACE_TRACE ("ACE_Auto_Basic_Ptr<X>::dump");
#endif /* ACE_HAS_DUMP */
}
+
template<class X> ACE_INLINE void
ACE_Auto_Basic_Array_Ptr<X>::dump (void) const
{
@@ -17,18 +21,21 @@ ACE_Auto_Basic_Array_Ptr<X>::dump (void) const
ACE_TRACE ("ACE_Auto_Basic_Array_Ptr<X>::dump");
#endif /* ACE_HAS_DUMP */
}
+
template<class X> ACE_INLINE
ACE_Auto_Basic_Ptr<X>::ACE_Auto_Basic_Ptr (ACE_Auto_Basic_Ptr<X> &rhs)
: p_ (rhs.release ())
{
ACE_TRACE ("ACE_Auto_Basic_Ptr<X>::ACE_Auto_Basic_Ptr");
}
+
template<class X> ACE_INLINE X *
ACE_Auto_Basic_Ptr<X>::get (void) const
{
ACE_TRACE ("ACE_Auto_Basic_Ptr<X>::get");
return this->p_;
}
+
template<class X> ACE_INLINE X *
ACE_Auto_Basic_Ptr<X>::release (void)
{
@@ -37,6 +44,7 @@ ACE_Auto_Basic_Ptr<X>::release (void)
this->p_ = 0;
return old;
}
+
template<class X> ACE_INLINE void
ACE_Auto_Basic_Ptr<X>::reset (X *p)
{
@@ -45,6 +53,7 @@ ACE_Auto_Basic_Ptr<X>::reset (X *p)
delete this->get ();
this->p_ = p;
}
+
template<class X> ACE_INLINE ACE_Auto_Basic_Ptr<X> &
ACE_Auto_Basic_Ptr<X>::operator= (ACE_Auto_Basic_Ptr<X> &rhs)
{
@@ -55,40 +64,48 @@ ACE_Auto_Basic_Ptr<X>::operator= (ACE_Auto_Basic_Ptr<X> &rhs)
}
return *this;
}
+
template<class X> ACE_INLINE
ACE_Auto_Basic_Ptr<X>::~ACE_Auto_Basic_Ptr (void)
{
ACE_TRACE ("ACE_Auto_Basic_Ptr<X>::~ACE_Auto_Basic_Ptr");
delete this->get ();
}
+
template<class X> ACE_INLINE X &
ACE_Auto_Basic_Ptr<X>::operator *() const
{
ACE_TRACE ("ACE_Auto_Basic_Ptr<X>::operator *()");
return *this->get ();
}
+
#if defined (ACE_LACKS_AUTO_PTR) || \
!defined (ACE_HAS_STANDARD_CPP_LIBRARY) || \
(ACE_HAS_STANDARD_CPP_LIBRARY == 0)
+
template<class X> ACE_INLINE X *
auto_ptr<X>::operator-> () const
{
ACE_TRACE ("auto_ptr<X>::operator->");
return this->get ();
}
+
#endif /* ACE_HAS_STANDARD_CPP_LIBRARY */
+
template<class X> ACE_INLINE X *
ACE_Auto_Ptr<X>::operator-> () const
{
ACE_TRACE ("ACE_Auto_Ptr<X>::operator->");
return this->get ();
}
+
template<class X> ACE_INLINE X *
ACE_Auto_Basic_Array_Ptr<X>::get (void) const
{
ACE_TRACE ("ACE_Auto_Basic_Array_Ptr<X>::get");
return this->p_;
}
+
template<class X> ACE_INLINE X *
ACE_Auto_Basic_Array_Ptr<X>::release (void)
{
@@ -97,6 +114,7 @@ ACE_Auto_Basic_Array_Ptr<X>::release (void)
this->p_ = 0;
return old;
}
+
template<class X> ACE_INLINE void
ACE_Auto_Basic_Array_Ptr<X>::reset (X *p)
{
@@ -105,12 +123,14 @@ ACE_Auto_Basic_Array_Ptr<X>::reset (X *p)
delete [] this->get ();
this->p_ = p;
}
+
template<class X> ACE_INLINE
ACE_Auto_Basic_Array_Ptr<X>::ACE_Auto_Basic_Array_Ptr (ACE_Auto_Basic_Array_Ptr<X> &rhs)
: p_ (rhs.release ())
{
ACE_TRACE ("ACE_Auto_Basic_Array_Ptr<X>::ACE_Auto_Basic_Array_Ptr");
}
+
template<class X> ACE_INLINE ACE_Auto_Basic_Array_Ptr<X> &
ACE_Auto_Basic_Array_Ptr<X>::operator= (ACE_Auto_Basic_Array_Ptr<X> &rhs)
{
@@ -121,26 +141,31 @@ ACE_Auto_Basic_Array_Ptr<X>::operator= (ACE_Auto_Basic_Array_Ptr<X> &rhs)
}
return *this;
}
+
template<class X> ACE_INLINE
ACE_Auto_Basic_Array_Ptr<X>::~ACE_Auto_Basic_Array_Ptr (void)
{
ACE_TRACE ("ACE_Auto_Basic_Array_Ptr<X>::~ACE_Auto_Basic_Array_Ptr");
delete [] this->get ();
}
+
template<class X> ACE_INLINE X &
ACE_Auto_Basic_Array_Ptr<X>::operator *() const
{
return *this->get ();
}
+
template<class X> ACE_INLINE X &
ACE_Auto_Basic_Array_Ptr<X>::operator[](int i) const
{
X *array = this->get ();
return array[i];
}
+
template<class X> ACE_INLINE X *
ACE_Auto_Array_Ptr<X>::operator->() const
{
return this->get ();
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Barrier.cpp b/dep/ACE_wrappers/ace/Barrier.cpp
index 5597ea34c3c..515a73f95a9 100644
--- a/dep/ACE_wrappers/ace/Barrier.cpp
+++ b/dep/ACE_wrappers/ace/Barrier.cpp
@@ -1,24 +1,34 @@
// $Id: Barrier.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Barrier.h"
+
#if defined (ACE_HAS_THREADS)
+
#if !defined (__ACE_INLINE__)
#include "ace/Barrier.inl"
#endif /* __ACE_INLINE__ */
+
#include "ace/Guard_T.h"
#include "ace/OS_NS_errno.h"
+
#if defined (ACE_HAS_DUMP)
# include "ace/Log_Msg.h"
#endif /* ACE_HAS_DUMP */
+
ACE_RCSID (ace,
Barrier,
"$Id: Barrier.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_Sub_Barrier)
+
void
ACE_Sub_Barrier::dump (void) const
{
#if defined (ACE_HAS_DUMP)
// ACE_TRACE ("ACE_Sub_Barrier::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
this->barrier_finished_.dump ();
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("running_threads_ = %d"), this->running_threads_));
@@ -26,6 +36,7 @@ ACE_Sub_Barrier::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
ACE_Sub_Barrier::ACE_Sub_Barrier (unsigned int count,
ACE_Thread_Mutex &lock,
const ACE_TCHAR *name,
@@ -35,12 +46,15 @@ ACE_Sub_Barrier::ACE_Sub_Barrier (unsigned int count,
{
// ACE_TRACE ("ACE_Sub_Barrier::ACE_Sub_Barrier");
}
+
ACE_ALLOC_HOOK_DEFINE(ACE_Barrier)
+
void
ACE_Barrier::dump (void) const
{
#if defined (ACE_HAS_DUMP)
// ACE_TRACE ("ACE_Barrier::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
this->lock_.dump ();
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("current_generation_ = %d"), this->current_generation_));
@@ -50,6 +64,7 @@ ACE_Barrier::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
ACE_Barrier::ACE_Barrier (unsigned int count,
const ACE_TCHAR *name,
void *arg)
@@ -63,20 +78,25 @@ ACE_Barrier::ACE_Barrier (unsigned int count,
this->sub_barrier_[0] = &this->sub_barrier_1_;
this->sub_barrier_[1] = &this->sub_barrier_2_;
}
+
int
ACE_Barrier::wait (void)
{
ACE_TRACE ("ACE_Barrier::wait");
ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1);
+
ACE_Sub_Barrier *sbp =
this->sub_barrier_[this->current_generation_];
+
// Check for shutdown...
if (sbp == 0)
{
errno = ESHUTDOWN;
return -1;
}
+
int retval = 0;
+
if (sbp->running_threads_ == 1)
{
// We're the last running thread, so swap generations and tell
@@ -90,9 +110,11 @@ ACE_Barrier::wait (void)
else
{
--sbp->running_threads_;
+
// Block until all the other threads wait().
while (sbp->running_threads_ != this->count_)
sbp->barrier_finished_.wait ();
+
// We're awake and the count has completed. See if it completed
// because all threads hit the barrier, or because the barrier
// was shut down.
@@ -102,36 +124,45 @@ ACE_Barrier::wait (void)
retval = -1;
}
}
+
return retval;
}
+
int
ACE_Barrier::shutdown (void)
{
ACE_TRACE ("ACE_Barrier::shutdown");
ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1);
+
ACE_Sub_Barrier *sbp =
this->sub_barrier_[this->current_generation_];
+
// Check for shutdown...
if (sbp == 0)
{
errno = ESHUTDOWN;
return -1;
}
+
// Flag the shutdown
this->sub_barrier_[0] = 0;
this->sub_barrier_[1] = 0;
// Tell all the threads waiting on the barrier to continue on their way.
sbp->running_threads_ = this->count_;
sbp->barrier_finished_.broadcast ();
+
return 0;
}
+
ACE_ALLOC_HOOK_DEFINE(ACE_Thread_Barrier)
+
ACE_Thread_Barrier::ACE_Thread_Barrier (unsigned int count,
const ACE_TCHAR *name)
: ACE_Barrier (count, name)
{
// ACE_TRACE ("ACE_Thread_Barrier::ACE_Thread_Barrier");
}
+
void
ACE_Thread_Barrier::dump (void) const
{
@@ -140,14 +171,17 @@ ACE_Thread_Barrier::dump (void) const
ACE_Barrier::dump ();
#endif /* ACE_HAS_DUMP */
}
+
#if 0
ACE_ALLOC_HOOK_DEFINE(ACE_Process_Barrier)
+
ACE_Process_Barrier::ACE_Process_Barrier (u_int count,
const ACE_TCHAR *name)
: ACE_Barrier (count, USYNC_PROCESS, name)
{
// ACE_TRACE ("ACE_Process_Barrier::ACE_Process_Barrier");
}
+
void
ACE_Process_Barrier::dump (void) const
{
@@ -157,6 +191,8 @@ ACE_Process_Barrier::dump (void) const
#endif /* ACE_HAS_DUMP */
}
#endif /* 0 */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_THREADS */
diff --git a/dep/ACE_wrappers/ace/Barrier.h b/dep/ACE_wrappers/ace/Barrier.h
index 69b59c99115..5fc9b9e8b7d 100644
--- a/dep/ACE_wrappers/ace/Barrier.h
+++ b/dep/ACE_wrappers/ace/Barrier.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file Barrier.h
@@ -10,18 +11,26 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//==========================================================================
+
#ifndef ACE_BARRIER_H
#define ACE_BARRIER_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include /**/ "ace/config-all.h"
+
// ACE platform supports some form of threading.
#if !defined (ACE_HAS_THREADS)
+
#include "ace/OS_NS_errno.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Barrier
*
@@ -35,10 +44,15 @@ public:
int wait (void) { ACE_NOTSUP_RETURN (-1); }
void dump (void) const {}
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#else /* ACE_HAS_THREADS */
+
#include "ace/Condition_Thread_Mutex.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
struct ACE_Export ACE_Sub_Barrier
{
// = Initialization.
@@ -46,16 +60,22 @@ struct ACE_Export ACE_Sub_Barrier
ACE_Thread_Mutex &lock,
const ACE_TCHAR *name = 0,
void *arg = 0);
+
~ACE_Sub_Barrier (void);
+
/// True if this generation of the barrier is done.
ACE_Condition_Thread_Mutex barrier_finished_;
+
/// Number of threads that are still running.
int running_threads_;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
};
+
/**
* @class ACE_Barrier
*
@@ -80,8 +100,10 @@ public:
ACE_Barrier (unsigned int count,
const ACE_TCHAR *name = 0,
void *arg = 0);
+
/// Default dtor.
~ACE_Barrier (void);
+
/// Block the caller until all @c count threads have called @c wait and
/// then allow all the caller threads to continue in parallel.
///
@@ -89,6 +111,7 @@ public:
/// @retval -1 if an error occurs or the barrier is shut
/// down (@sa shutdown ()).
int wait (void);
+
/// Shut the barrier down, aborting the wait of all waiting threads.
/// Any threads waiting on the barrier when it is shut down will return with
/// value -1, errno ESHUTDOWN.
@@ -97,18 +120,24 @@ public:
///
/// @since ACE beta 5.4.9.
int shutdown (void);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
/// Serialize access to the barrier state.
ACE_Thread_Mutex lock_;
+
/// Either 0 or 1, depending on whether we are the first generation
/// of waiters or the next generation of waiters.
int current_generation_;
+
/// Total number of threads that can be waiting at any one time.
int count_;
+
/**
* We keep two @c sub_barriers, one for the first "generation" of
* waiters, and one for the next "generation" of waiters. This
@@ -120,11 +149,13 @@ protected:
ACE_Sub_Barrier sub_barrier_1_;
ACE_Sub_Barrier sub_barrier_2_;
ACE_Sub_Barrier *sub_barrier_[2];
+
private:
// = Prevent assignment and initialization.
void operator= (const ACE_Barrier &);
ACE_Barrier (const ACE_Barrier &);
};
+
#if 0
/**
* @class ACE_Process_Barrier
@@ -139,12 +170,15 @@ class ACE_Export ACE_Process_Barrier : public ACE_Barrier
public:
/// Create a Process_Barrier, passing in the optional @a name.
ACE_Process_Barrier (unsigned int count, const ACE_TCHAR *name = 0);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
};
#endif /* 0 */
+
/**
* @class ACE_Thread_Barrier
*
@@ -158,18 +192,25 @@ class ACE_Export ACE_Thread_Barrier : public ACE_Barrier
public:
/// Create a Thread_Barrier, passing in the optional @a name.
ACE_Thread_Barrier (unsigned int count, const ACE_TCHAR *name = 0);
+
/// Default dtor.
~ACE_Thread_Barrier (void);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Barrier.inl"
#endif /* __ACE_INLINE__ */
+
#endif /* !ACE_HAS_THREADS */
+
#include /**/ "ace/post.h"
#endif /* ACE_BARRIER_H */
diff --git a/dep/ACE_wrappers/ace/Barrier.inl b/dep/ACE_wrappers/ace/Barrier.inl
index 2abf87a53c5..10430d917a3 100644
--- a/dep/ACE_wrappers/ace/Barrier.inl
+++ b/dep/ACE_wrappers/ace/Barrier.inl
@@ -1,17 +1,22 @@
// -*- C++ -*-
//
// $Id: Barrier.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_Sub_Barrier::~ACE_Sub_Barrier (void)
{
}
+
ACE_INLINE
ACE_Barrier::~ACE_Barrier (void)
{
}
+
ACE_INLINE
ACE_Thread_Barrier::~ACE_Thread_Barrier (void)
{
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Base_Thread_Adapter.cpp b/dep/ACE_wrappers/ace/Base_Thread_Adapter.cpp
index 6a9fd2889c5..d74f1934161 100644
--- a/dep/ACE_wrappers/ace/Base_Thread_Adapter.cpp
+++ b/dep/ACE_wrappers/ace/Base_Thread_Adapter.cpp
@@ -1,21 +1,29 @@
// $Id: Base_Thread_Adapter.cpp 81239 2008-04-04 22:28:48Z iliyan $
+
#include "ace/Base_Thread_Adapter.h"
+
ACE_RCSID (ace,
Base_Thread_Adapter,
"$Id: Base_Thread_Adapter.cpp 81239 2008-04-04 22:28:48Z iliyan $")
+
#if !defined (ACE_HAS_INLINED_OSCALLS)
# include "ace/Base_Thread_Adapter.inl"
#endif /* ACE_HAS_INLINED_OSCALLS */
+
#if defined (ACE_HAS_TSS_EMULATION)
# include "ace/OS_NS_Thread.h"
#endif /* ACE_HAS_TSS_EMULATION */
+
#include "ace/Service_Config.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INIT_LOG_MSG_HOOK ACE_Base_Thread_Adapter::init_log_msg_hook_ = 0;
ACE_INHERIT_LOG_MSG_HOOK ACE_Base_Thread_Adapter::inherit_log_msg_hook_ = 0;
ACE_CLOSE_LOG_MSG_HOOK ACE_Base_Thread_Adapter::close_log_msg_hook_ = 0;
ACE_SYNC_LOG_MSG_HOOK ACE_Base_Thread_Adapter::sync_log_msg_hook_ = 0;
ACE_THR_DESC_LOG_MSG_HOOK ACE_Base_Thread_Adapter::thr_desc_log_msg_hook_ = 0;
+
ACE_Base_Thread_Adapter::ACE_Base_Thread_Adapter (
ACE_THR_FUNC user_func,
void *arg,
@@ -33,6 +41,7 @@ ACE_Base_Thread_Adapter::ACE_Base_Thread_Adapter (
, ctx_ (ACE_Service_Config::current())
{
ACE_OS_TRACE ("ACE_Base_Thread_Adapter::ACE_Base_Thread_Adapter");
+
if (ACE_Base_Thread_Adapter::init_log_msg_hook_ != 0)
(*ACE_Base_Thread_Adapter::init_log_msg_hook_) (
this->log_msg_attributes_
@@ -45,9 +54,11 @@ ACE_Base_Thread_Adapter::ACE_Base_Thread_Adapter (
getitimer (ITIMER_PROF, &itimer_);
#endif // ACE_USES_GPROF
}
+
ACE_Base_Thread_Adapter::~ACE_Base_Thread_Adapter (void)
{
}
+
void
ACE_Base_Thread_Adapter::inherit_log_msg (void)
{
@@ -55,23 +66,27 @@ ACE_Base_Thread_Adapter::inherit_log_msg (void)
(*ACE_Base_Thread_Adapter::inherit_log_msg_hook_)(
this->thr_desc_,
this->log_msg_attributes_);
+
// Initialize the proper configuration context for the new thread
// Placed here since inherit_log_msg() gets called from any of our
// descendants (before self-destructing)
ACE_Service_Config::current (this->ctx_);
}
+
void
ACE_Base_Thread_Adapter::close_log_msg (void)
{
if (ACE_Base_Thread_Adapter::close_log_msg_hook_ != 0)
(*ACE_Base_Thread_Adapter::close_log_msg_hook_) ();
}
+
void
ACE_Base_Thread_Adapter::sync_log_msg (const ACE_TCHAR *prg)
{
if (ACE_Base_Thread_Adapter::sync_log_msg_hook_ != 0)
(*ACE_Base_Thread_Adapter::sync_log_msg_hook_) (prg);
}
+
ACE_OS_Thread_Descriptor *
ACE_Base_Thread_Adapter::thr_desc_log_msg (void)
{
@@ -79,13 +94,17 @@ ACE_Base_Thread_Adapter::thr_desc_log_msg (void)
return (*ACE_Base_Thread_Adapter::thr_desc_log_msg_hook_) ();
return 0;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
// Run the thread entry point for the <ACE_Thread_Adapter>. This must
// be an extern "C" to make certain compilers happy...
+
extern "C" ACE_THR_FUNC_RETURN
ACE_THREAD_ADAPTER_NAME (void *args)
{
ACE_OS_TRACE ("ACE_THREAD_ADAPTER_NAME");
+
#if defined (ACE_HAS_TSS_EMULATION)
// As early as we can in the execution of the new thread, allocate
// its local TS storage. Allocate it on the stack, to save dynamic
@@ -93,13 +112,18 @@ ACE_THREAD_ADAPTER_NAME (void *args)
void *ts_storage[ACE_TSS_Emulation::ACE_TSS_THREAD_KEYS_MAX];
ACE_TSS_Emulation::tss_open (ts_storage);
#endif /* ACE_HAS_TSS_EMULATION */
+
ACE_Base_Thread_Adapter * const thread_args =
static_cast<ACE_Base_Thread_Adapter *> (args);
+
#ifdef ACE_USES_GPROF
setitimer (ITIMER_PROF, thread_args->timerval (), 0);
#endif // ACE_USES_GPROF
+
// Invoke the user-supplied function with the args.
ACE_THR_FUNC_RETURN status = thread_args->invoke ();
+
return status;
}
+
diff --git a/dep/ACE_wrappers/ace/Base_Thread_Adapter.h b/dep/ACE_wrappers/ace/Base_Thread_Adapter.h
index 575f79fa2b5..beee7210f42 100644
--- a/dep/ACE_wrappers/ace/Base_Thread_Adapter.h
+++ b/dep/ACE_wrappers/ace/Base_Thread_Adapter.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Base_Thread_Adapter.h
@@ -8,27 +9,37 @@
* @author Nanbor Wang <nanbor@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_BASE_THREAD_ADAPTER_H
#define ACE_BASE_THREAD_ADAPTER_H
#include /**/ "ace/pre.h"
+
#include "ace/OS_Log_Msg_Attributes.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include /**/ "ace/ACE_export.h"
#include "ace/OS_Log_Msg_Attributes.h"
+
#ifdef ACE_USES_GPROF
#include "os_include/sys/os_time.h"
#endif // ACE_USES_GPROF
+
#if (defined (ACE_HAS_VERSIONED_NAMESPACE) && ACE_HAS_VERSIONED_NAMESPACE == 1)
# define ACE_THREAD_ADAPTER_NAME ACE_PREPROC_CONCATENATE(ACE_VERSIONED_NAMESPACE_NAME, _ace_thread_adapter)
#else
# define ACE_THREAD_ADAPTER_NAME ace_thread_adapter
#endif /* ACE_HAS_VERSIONED_NAMESPACE == 1 */
+
// Run the thread entry point for the ACE_Thread_Adapter. This must
// be an extern "C" to make certain compilers happy...
+
extern "C" ACE_Export ACE_THR_FUNC_RETURN ACE_THREAD_ADAPTER_NAME (void *args);
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_OS_Thread_Descriptor
*
@@ -42,9 +53,11 @@ class ACE_Export ACE_OS_Thread_Descriptor
public:
/// Get the thread creation flags.
long flags (void) const;
+
protected:
/// For use by ACE_Thread_Descriptor.
ACE_OS_Thread_Descriptor (long flags = 0);
+
/**
* Keeps track of whether this thread was created "detached" or not.
* If a thread is *not* created detached then if someone calls
@@ -54,8 +67,11 @@ protected:
long flags_;
};
+
+
class ACE_Service_Gestalt;
+
/**
* @class ACE_Base_Thread_Adapter
*
@@ -75,23 +91,31 @@ class ACE_Service_Gestalt;
class ACE_Export ACE_Base_Thread_Adapter
{
public:
+
virtual ~ACE_Base_Thread_Adapter (void);
+
/// Virtual method invoked by the thread entry point.
virtual ACE_THR_FUNC_RETURN invoke (void) = 0;
+
/// Accessor for the C entry point function to the OS thread creation
/// routine.
ACE_THR_C_FUNC entry_point (void);
+
#ifdef ACE_USES_GPROF
/// Accessor to the itimer_
/// followed http://sam.zoy.org/writings/programming/gprof.html
struct itimerval* timerval (void);
#endif // ACE_USES_PROF
+
/// Invoke the close_log_msg_hook, if it is present
static void close_log_msg (void);
+
/// Invoke the sync_log_msg_hook, if it is present
static void sync_log_msg (const ACE_TCHAR *prog_name);
+
/// Invoke the thr_desc_log_msg_hook, if it is present
static ACE_OS_Thread_Descriptor *thr_desc_log_msg (void);
+
protected:
/// Constructor.
ACE_Base_Thread_Adapter (ACE_THR_FUNC user_func,
@@ -106,6 +130,7 @@ protected:
/// Inherit the logging features if the parent thread has an
/// ACE_Log_Msg.
void inherit_log_msg (void);
+
private:
/// The hooks to inherit and cleanup the Log_Msg attributes
static ACE_INIT_LOG_MSG_HOOK init_log_msg_hook_;
@@ -113,22 +138,28 @@ private:
static ACE_CLOSE_LOG_MSG_HOOK close_log_msg_hook_;
static ACE_SYNC_LOG_MSG_HOOK sync_log_msg_hook_;
static ACE_THR_DESC_LOG_MSG_HOOK thr_desc_log_msg_hook_;
+
/// Set the Log_Msg hooks
static void set_log_msg_hooks (ACE_INIT_LOG_MSG_HOOK init_hook,
ACE_INHERIT_LOG_MSG_HOOK inherit_hook,
ACE_CLOSE_LOG_MSG_HOOK close_hook,
ACE_SYNC_LOG_MSG_HOOK sync_hook,
ACE_THR_DESC_LOG_MSG_HOOK thr_desc);
+
/// Allow the ACE_Log_Msg class to set its hooks.
friend class ACE_Log_Msg;
+
protected:
/// Thread startup function passed in by the user (C++ linkage).
ACE_THR_FUNC user_func_;
+
/// Argument to thread startup function.
void *arg_;
+
/// Entry point to the underlying OS thread creation call (C
/// linkage).
ACE_THR_C_FUNC entry_point_;
+
/**
* Optional thread descriptor. Passing this pointer in will force
* the spawned thread to cache this location in <Log_Msg> and wait
@@ -136,17 +167,22 @@ protected:
* descriptor.
*/
ACE_OS_Thread_Descriptor *thr_desc_;
+
/// The ACE_Log_Msg attributes.
ACE_OS_Log_Msg_Attributes log_msg_attributes_;
+
/// That is usefull for gprof, define itimerval
#ifdef ACE_USES_GPROF
struct itimerval itimer_;
#endif // ACE_USES_GPROF
+
/// Keep a reference to the configuration context that spawns the
/// thread so the child can inherit it.
ACE_Service_Gestalt * const ctx_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# if defined (ACE_HAS_INLINED_OSCALLS)
# if defined (ACE_INLINE)
# undef ACE_INLINE
@@ -154,6 +190,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_INLINE inline
# include "ace/Base_Thread_Adapter.inl"
# endif /* ACE_HAS_INLINED_OSCALLS */
+
#include /**/ "ace/post.h"
#endif /* ACE_BASE_THREAD_ADAPTER_H */
diff --git a/dep/ACE_wrappers/ace/Base_Thread_Adapter.inl b/dep/ACE_wrappers/ace/Base_Thread_Adapter.inl
index cc42abf3c96..3bac80246dd 100644
--- a/dep/ACE_wrappers/ace/Base_Thread_Adapter.inl
+++ b/dep/ACE_wrappers/ace/Base_Thread_Adapter.inl
@@ -1,17 +1,21 @@
// -*- C++ -*-
//
// $Id: Base_Thread_Adapter.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE long
ACE_OS_Thread_Descriptor::flags (void) const
{
return flags_;
}
+
ACE_INLINE
ACE_OS_Thread_Descriptor::ACE_OS_Thread_Descriptor (long flags)
: flags_ (flags)
{
}
+
ACE_INLINE void
ACE_Base_Thread_Adapter::set_log_msg_hooks (
ACE_INIT_LOG_MSG_HOOK init_hook,
@@ -26,11 +30,13 @@ ACE_Base_Thread_Adapter::set_log_msg_hooks (
ACE_Base_Thread_Adapter::sync_log_msg_hook_ = sync_hook;
ACE_Base_Thread_Adapter::thr_desc_log_msg_hook_ = thr_desc_hook;
}
+
ACE_INLINE ACE_THR_C_FUNC
ACE_Base_Thread_Adapter::entry_point (void)
{
return this->entry_point_;
}
+
#ifdef ACE_USES_GPROF
ACE_INLINE itimerval*
ACE_Base_Thread_Adapter::timerval (void)
@@ -38,4 +44,5 @@ ACE_Base_Thread_Adapter::timerval (void)
return &(this->itimer_);
}
#endif // ACE_USES_GPROF
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Based_Pointer_Repository.cpp b/dep/ACE_wrappers/ace/Based_Pointer_Repository.cpp
index 2fc7585f2cb..c9bf92f78ee 100644
--- a/dep/ACE_wrappers/ace/Based_Pointer_Repository.cpp
+++ b/dep/ACE_wrappers/ace/Based_Pointer_Repository.cpp
@@ -1,11 +1,14 @@
// $Id: Based_Pointer_Repository.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Map_Manager.h"
#include "ace/Based_Pointer_Repository.h"
#include "ace/Guard_T.h"
#include "ace/Null_Mutex.h"
#include "ace/Synch_Traits.h"
#include "ace/RW_Thread_Mutex.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Based_Pointer_Repository_Rep
*
@@ -22,30 +25,37 @@ public:
typedef ACE_Map_Manager <void *, size_t, ACE_Null_Mutex> MAP_MANAGER;
typedef ACE_Map_Iterator <void *, size_t, ACE_Null_Mutex> MAP_ITERATOR;
typedef ACE_Map_Entry <void *, size_t> MAP_ENTRY;
+
/// Keeps track of the mapping between addresses and their associated
/// values.
MAP_MANAGER addr_map_;
+
/// Synchronize concurrent access to the map.
ACE_SYNCH_MUTEX lock_;
};
+
ACE_Based_Pointer_Repository::ACE_Based_Pointer_Repository (void)
{
ACE_TRACE ("ACE_Based_Pointer_Repository::ACE_Based_Pointer_Repository");
ACE_NEW (this->rep_,
ACE_Based_Pointer_Repository_Rep);
}
+
ACE_Based_Pointer_Repository::~ACE_Based_Pointer_Repository (void)
{
ACE_TRACE ("ACE_Based_Pointer_Repository::~ACE_Based_Pointer_Repository");
delete this->rep_;
}
+
// Search for appropriate base address in repository
+
int
ACE_Based_Pointer_Repository::find (void *addr, void *&base_addr)
{
ACE_TRACE ("ACE_Based_Pointer_Repository::find");
ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, mon, this->rep_->lock_, -1);
ACE_Based_Pointer_Repository_Rep::MAP_ENTRY *ce = 0;
+
for (ACE_Based_Pointer_Repository_Rep::MAP_ITERATOR iter (this->rep_->addr_map_);
iter.next (ce) != 0;
iter.advance ())
@@ -57,27 +67,35 @@ ACE_Based_Pointer_Repository::find (void *addr, void *&base_addr)
base_addr = ce->ext_id_;
return 1;
}
+
// Assume base address 0 (e.g., if new'ed).
base_addr = 0;
return 0;
}
+
// Bind a new entry to the repository or update the size of an
// existing entry.
+
int
ACE_Based_Pointer_Repository::bind (void *addr, size_t size)
{
ACE_TRACE ("ACE_Based_Pointer_Repository::bind");
ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, mon, this->rep_->lock_, -1);
+
return this->rep_->addr_map_.rebind (addr, size);
}
+
// Unbind a base from the repository.
+
int
ACE_Based_Pointer_Repository::unbind (void *addr)
{
ACE_TRACE ("ACE_Based_Pointer_Repository::unbind");
ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, mon, this->rep_->lock_, -1);
ACE_Based_Pointer_Repository_Rep::MAP_ENTRY *ce = 0;
+
// Search for service handlers that requested notification.
+
for (ACE_Based_Pointer_Repository_Rep::MAP_ITERATOR iter (this->rep_->addr_map_);
iter.next (ce) != 0;
iter.advance ())
@@ -89,11 +107,14 @@ ACE_Based_Pointer_Repository::unbind (void *addr)
// Unbind base address.
return this->rep_->addr_map_.unbind (ce->ext_id_);
}
+
return 0;
}
+
#if defined (ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION)
template ACE_Singleton<ACE_Based_Pointer_Repository, ACE_SYNCH_RW_MUTEX> *
ACE_Singleton<ACE_Based_Pointer_Repository, ACE_SYNCH_RW_MUTEX>::singleton_;
#endif /* ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Based_Pointer_Repository.h b/dep/ACE_wrappers/ace/Based_Pointer_Repository.h
index 66aa86f422f..047e34dca28 100644
--- a/dep/ACE_wrappers/ace/Based_Pointer_Repository.h
+++ b/dep/ACE_wrappers/ace/Based_Pointer_Repository.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Based_Pointer_Repository.h
@@ -9,20 +10,28 @@
* @author Douglas C. Schmidt <schmidt@.cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_BASED_POINTER_REPOSITORY_H
#define ACE_BASED_POINTER_REPOSITORY_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Singleton.h"
#include "ace/Synch_Traits.h"
#include "ace/os_include/os_stddef.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward decl., using the "Cheshire Cat" technique.
class ACE_Based_Pointer_Repository_Rep;
+
/**
* @class ACE_Based_Pointer_Repository
*
@@ -33,9 +42,11 @@ class ACE_Export ACE_Based_Pointer_Repository
{
public:
// = Use ACE_Null_Mutex to allow locking while iterating.
+
// = Initialization and termination methods.
ACE_Based_Pointer_Repository (void);
~ACE_Based_Pointer_Repository (void);
+
// = Search structure methods.
/**
* Return the appropriate @a base_addr region that contains @a addr.
@@ -44,27 +55,38 @@ public:
*/
int find (void *addr,
void *&base_addr);
+
/// Bind a new entry to the repository or update the size of an
/// existing entry. Returns 0 on success and -1 on failure.
int bind (void *addr,
size_t size);
+
/// Unbind from the repository the <base_addr> that @a addr is
/// contained within.
int unbind (void *addr);
+
private:
+
/// Use the "Cheshire-Cat" technique to hide the implementation in
/// order to avoid circular #include dependencies.
ACE_Based_Pointer_Repository_Rep *rep_;
+
};
+
// ----------------------------------
+
/// Declare a process wide singleton
ACE_SINGLETON_DECLARE (ACE_Singleton,
ACE_Based_Pointer_Repository,
ACE_SYNCH_RW_MUTEX)
+
/// Provide a Singleton access point to the based pointer repository.
typedef ACE_Singleton<ACE_Based_Pointer_Repository, ACE_SYNCH_RW_MUTEX>
ACE_BASED_POINTER_REPOSITORY;
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
+
#endif /* ACE_BASED_POINTER_REPOSITORY_H */
diff --git a/dep/ACE_wrappers/ace/Based_Pointer_T.h b/dep/ACE_wrappers/ace/Based_Pointer_T.h
index ea116a5c3f7..39437bbb3c9 100644
--- a/dep/ACE_wrappers/ace/Based_Pointer_T.h
+++ b/dep/ACE_wrappers/ace/Based_Pointer_T.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Based_Pointer_T.h
@@ -9,11 +10,15 @@
* @author Douglas C. Schmidt <schmidt@.cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_BASED_POINTER_T_H
#define ACE_BASED_POINTER_T_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
#include "ace/Basic_Types.h"
+
#if defined (_MSC_VER)
// Suppress warning e.g. "return type for
// 'ACE_Based_Pointer<long>::operator ->' is 'long *' (i.e., not a UDT
@@ -21,7 +26,9 @@
// notation)"
#pragma warning(disable: 4284)
#endif /* _MSC_VER */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Based_Pointer_Basic
*
@@ -55,6 +62,7 @@ public:
* address 0.
*/
ACE_Based_Pointer_Basic (void);
+
/**
* Initialize this object using the @a initial pointer. This
* constructor initializes the <base_offset_> by asking the
@@ -77,46 +85,66 @@ public:
* indicates a "NULL" pointer.
*/
ACE_Based_Pointer_Basic (CONCRETE *initial);
+
/// Copy constructor.
ACE_Based_Pointer_Basic (const ACE_Based_Pointer_Basic<CONCRETE> &);
+
/// Constructor for know base address. @a o is only used to
/// resolve overload ambiguity.
ACE_Based_Pointer_Basic (const void *base_addr, int o);
+
/// Pseudo-assignment operator.
void operator = (CONCRETE *from);
+
/// Pseudo-assignment operator.
void operator = (const ACE_Based_Pointer_Basic<CONCRETE> &);
+
/// Dereference operator.
CONCRETE operator * (void) const;
+
/// Less than operator.
bool operator < (const ACE_Based_Pointer_Basic<CONCRETE> &) const;
+
/// Less than or equal operator.
bool operator <= (const ACE_Based_Pointer_Basic<CONCRETE> &) const;
+
/// Greater than operator.
bool operator > (const ACE_Based_Pointer_Basic<CONCRETE> &) const;
+
/// Greater than or equal operator.
bool operator >= (const ACE_Based_Pointer_Basic<CONCRETE> &) const;
+
/// Equality operator.
bool operator == (const ACE_Based_Pointer_Basic<CONCRETE> &) const;
+
/// Inequality operator.
bool operator != (const ACE_Based_Pointer_Basic<CONCRETE> &) const;
+
/// Subscript operator.
CONCRETE operator [](int index) const;
+
/// Increment operator.
void operator+= (int index);
+
/// Returns the underlying memory address of the smart pointer.
operator CONCRETE *() const;
+
/// Returns the underlying memory address of the smart pointer.
CONCRETE *addr (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
/// Dump the state of the object.
void dump (void) const;
+
protected:
ptrdiff_t target_;
+
/// Keep track of our offset from the base pointer.
ptrdiff_t base_offset_;
};
+
/**
* @class ACE_Based_Pointer
*
@@ -135,32 +163,44 @@ public:
/// Constructor. See constructor for ACE_Based_Pointer_Basic for
/// details.
ACE_Based_Pointer (void);
+
/// Initialize this object using the <initial> pointer. See
/// constructor for ACE_Based_Pointer_Basic for details.
ACE_Based_Pointer (CONCRETE *initial);
+
/// Initialize this object with known @a base_addr. @a dummy is
/// a dummy value used to resolve overload ambiguity and it
/// otherwise ignored.
ACE_Based_Pointer (const void *base_addr, int dummy);
+
/// Copy constructor (not implemented yet).
ACE_Based_Pointer (const ACE_Based_Pointer<CONCRETE> &);
+
/// Assignment operator.
void operator = (const ACE_Based_Pointer<CONCRETE> &);
+
/// Pseudo-assignment operator.
void operator = (CONCRETE *from);
+
/// The C++ "delegation operator".
CONCRETE *operator-> (void);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Based_Pointer_T.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Based_Pointer_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Based_Pointer_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_BASED_POINTER_T_H */
diff --git a/dep/ACE_wrappers/ace/Based_Pointer_T.inl b/dep/ACE_wrappers/ace/Based_Pointer_T.inl
index 3792bf2ecce..ba6a5aa511b 100644
--- a/dep/ACE_wrappers/ace/Based_Pointer_T.inl
+++ b/dep/ACE_wrappers/ace/Based_Pointer_T.inl
@@ -1,15 +1,19 @@
// -*- C++ -*-
//
// $Id: Based_Pointer_T.inl 81705 2008-05-15 14:02:02Z johnnyw $
+
#define ACE_COMPUTE_BASED_POINTER(P) (((char *) (P) - (P)->base_offset_) + (P)->target_)
#include "ace/Global_Macros.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template <class CONCRETE> ACE_INLINE CONCRETE *
ACE_Based_Pointer<CONCRETE>::operator->(void)
{
ACE_TRACE ("ACE_Based_Pointer<CONCRETE>::operator->");
return reinterpret_cast<CONCRETE *> (ACE_COMPUTE_BASED_POINTER (this));
}
+
template <class CONCRETE> ACE_INLINE void
ACE_Based_Pointer_Basic<CONCRETE>::operator = (CONCRETE *rhs)
{
@@ -21,6 +25,7 @@ ACE_Based_Pointer_Basic<CONCRETE>::operator = (CONCRETE *rhs)
this->target_ = ((char *) rhs
- ((char *) this - this->base_offset_));
}
+
template <class CONCRETE> ACE_INLINE void
ACE_Based_Pointer<CONCRETE>::operator = (CONCRETE *rhs)
{
@@ -32,27 +37,33 @@ ACE_Based_Pointer<CONCRETE>::operator = (CONCRETE *rhs)
this->target_ = ((char *) rhs
- ((char *) this - this->base_offset_));
}
+
template <class CONCRETE> ACE_INLINE CONCRETE
ACE_Based_Pointer_Basic<CONCRETE>::operator *(void) const
{
ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator *");
return *reinterpret_cast<CONCRETE *> (ACE_COMPUTE_BASED_POINTER (this));
}
+
template <class CONCRETE> ACE_INLINE CONCRETE *
ACE_Based_Pointer_Basic<CONCRETE>::addr (void) const
{
ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::addr");
+
if (this->target_ == -1)
return 0;
else
return reinterpret_cast<CONCRETE *> (ACE_COMPUTE_BASED_POINTER (this));
}
+
template <class CONCRETE> ACE_INLINE
ACE_Based_Pointer_Basic<CONCRETE>::operator CONCRETE *() const
{
ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator CONCRETE *()");
+
return this->addr ();
}
+
template <class CONCRETE> ACE_INLINE CONCRETE
ACE_Based_Pointer_Basic<CONCRETE>::operator [] (int index) const
{
@@ -61,58 +72,68 @@ ACE_Based_Pointer_Basic<CONCRETE>::operator [] (int index) const
reinterpret_cast<CONCRETE *> (ACE_COMPUTE_BASED_POINTER (this));
return c[index];
}
+
template <class CONCRETE> ACE_INLINE void
ACE_Based_Pointer_Basic<CONCRETE>::operator += (int index)
{
ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator +=");
this->base_offset_ += (index * sizeof (CONCRETE));
}
+
template <class CONCRETE> ACE_INLINE bool
ACE_Based_Pointer_Basic<CONCRETE>::operator == (const ACE_Based_Pointer_Basic<CONCRETE> &rhs) const
{
ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator ==");
return ACE_COMPUTE_BASED_POINTER (this) == ACE_COMPUTE_BASED_POINTER (&rhs);
}
+
template <class CONCRETE> ACE_INLINE bool
ACE_Based_Pointer_Basic<CONCRETE>::operator != (const ACE_Based_Pointer_Basic<CONCRETE> &rhs) const
{
ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator !=");
return !(*this == rhs);
}
+
template <class CONCRETE> ACE_INLINE bool
ACE_Based_Pointer_Basic<CONCRETE>::operator < (const ACE_Based_Pointer_Basic<CONCRETE> &rhs) const
{
ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator <");
return ACE_COMPUTE_BASED_POINTER (this) < ACE_COMPUTE_BASED_POINTER (&rhs);
}
+
template <class CONCRETE> ACE_INLINE bool
ACE_Based_Pointer_Basic<CONCRETE>::operator <= (const ACE_Based_Pointer_Basic<CONCRETE> &rhs) const
{
ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator <=");
return ACE_COMPUTE_BASED_POINTER (this) <= ACE_COMPUTE_BASED_POINTER (&rhs);
}
+
template <class CONCRETE> ACE_INLINE bool
ACE_Based_Pointer_Basic<CONCRETE>::operator > (const ACE_Based_Pointer_Basic<CONCRETE> &rhs) const
{
ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator >");
return ACE_COMPUTE_BASED_POINTER (this) > ACE_COMPUTE_BASED_POINTER (&rhs);
}
+
template <class CONCRETE> ACE_INLINE bool
ACE_Based_Pointer_Basic<CONCRETE>::operator >= (const ACE_Based_Pointer_Basic<CONCRETE> &rhs) const
{
ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator >=");
return ACE_COMPUTE_BASED_POINTER (this) >= ACE_COMPUTE_BASED_POINTER (&rhs);
}
+
template <class CONCRETE> ACE_INLINE void
ACE_Based_Pointer_Basic<CONCRETE>::operator= (const ACE_Based_Pointer_Basic<CONCRETE> &rhs)
{
ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator=");
*this = rhs.addr ();
}
+
template <class CONCRETE> ACE_INLINE void
ACE_Based_Pointer<CONCRETE>::operator= (const ACE_Based_Pointer<CONCRETE> &rhs)
{
ACE_TRACE ("ACE_Based_Pointer<CONCRETE>::operator=");
*this = rhs.addr ();
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Basic_Stats.cpp b/dep/ACE_wrappers/ace/Basic_Stats.cpp
index 68fc629adb5..760afa35e6d 100644
--- a/dep/ACE_wrappers/ace/Basic_Stats.cpp
+++ b/dep/ACE_wrappers/ace/Basic_Stats.cpp
@@ -1,22 +1,29 @@
// $Id: Basic_Stats.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Basic_Stats.h"
#include "ace/Log_Msg.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Basic_Stats.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace,
Basic_Stats,
"$Id: Basic_Stats.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
void
ACE_Basic_Stats::accumulate (const ACE_Basic_Stats &rhs)
{
if (rhs.samples_count_ == 0)
return;
+
if (this->samples_count_ == 0)
{
this->min_ = rhs.min_;
this->min_at_ = rhs.min_at_;
+
this->max_ = rhs.max_;
this->max_at_ = rhs.max_at_;
}
@@ -33,9 +40,11 @@ ACE_Basic_Stats::accumulate (const ACE_Basic_Stats &rhs)
this->max_at_ = rhs.max_at_;
}
}
+
this->samples_count_ += rhs.samples_count_;
this->sum_ += rhs.sum_;
}
+
void
ACE_Basic_Stats::dump_results (const ACE_TCHAR *msg, ACE_UINT32 sf) const
{
@@ -46,20 +55,25 @@ ACE_Basic_Stats::dump_results (const ACE_TCHAR *msg, ACE_UINT32 sf) const
ACE_TEXT ("%s : no data collected\n"), msg));
return;
}
+
ACE_UINT64 avg = this->sum_ / this->samples_count_;
+
ACE_UINT64 l_min = this->min_ / sf;
ACE_UINT64 l_max = this->max_ / sf;
ACE_UINT64 l_avg = avg / sf;
+
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("%s latency : %Q[%d]/%Q/%Q[%d] (min/avg/max)\n"),
msg,
l_min, this->min_at_,
l_avg,
l_max, this->max_at_));
+
#else
ACE_UNUSED_ARG (msg);
ACE_UNUSED_ARG (sf);
#endif /* ACE_NLOGGING */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Basic_Stats.h b/dep/ACE_wrappers/ace/Basic_Stats.h
index 3e4b29fc698..fcc9996d8ba 100644
--- a/dep/ACE_wrappers/ace/Basic_Stats.h
+++ b/dep/ACE_wrappers/ace/Basic_Stats.h
@@ -9,15 +9,20 @@
*/
//=============================================================================
+
#ifndef ACE_BASIC_STATS_H
#define ACE_BASIC_STATS_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
#include "ace/Basic_Types.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/// Collect basic stats about a series of samples
/**
* Compute the average and standard deviation (aka jitter) for an
@@ -33,12 +38,16 @@ public:
* the class is initialized.
*/
ACE_Basic_Stats (void);
+
/// The number of samples received so far
ACE_UINT32 samples_count (void) const;
+
/// Record one sample.
void sample (ACE_UINT64 value);
+
/// Update the values to reflect the stats in @a rhs.
void accumulate (const ACE_Basic_Stats &rhs);
+
/// Dump all the samples
/**
* Prints out the results, using @a msg as a prefix for each message and
@@ -48,23 +57,32 @@ public:
*/
void dump_results (const ACE_TCHAR *msg,
ACE_UINT32 scale_factor) const;
+
/// The number of samples
ACE_UINT32 samples_count_;
+
/// The minimum value
ACE_UINT64 min_;
+
/// The number of the sample that had the minimum value
ACE_UINT32 min_at_;
+
/// The maximum value
ACE_UINT64 max_;
+
/// The number of the sample that had the maximum value
ACE_UINT32 max_at_;
+
/// The sum of all the values
ACE_UINT64 sum_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Basic_Stats.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_BASIC_STATS_H */
diff --git a/dep/ACE_wrappers/ace/Basic_Stats.inl b/dep/ACE_wrappers/ace/Basic_Stats.inl
index 7dc8d12a57c..e2f153884e3 100644
--- a/dep/ACE_wrappers/ace/Basic_Stats.inl
+++ b/dep/ACE_wrappers/ace/Basic_Stats.inl
@@ -1,7 +1,9 @@
// -*- C++ -*-
//
// $Id: Basic_Stats.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_Basic_Stats::ACE_Basic_Stats (void)
: samples_count_ (0)
@@ -12,15 +14,18 @@ ACE_Basic_Stats::ACE_Basic_Stats (void)
, sum_ (0)
{
}
+
ACE_INLINE ACE_UINT32
ACE_Basic_Stats::samples_count (void) const
{
return this->samples_count_;
}
+
ACE_INLINE void
ACE_Basic_Stats::sample (ACE_UINT64 value)
{
++this->samples_count_;
+
if (this->samples_count_ == 1u)
{
this->min_ = value;
@@ -41,6 +46,8 @@ ACE_Basic_Stats::sample (ACE_UINT64 value)
this->max_at_ = this->samples_count_;
}
}
+
this->sum_ += value;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Basic_Types.cpp b/dep/ACE_wrappers/ace/Basic_Types.cpp
index 2d835a43b3b..f7c87cdb9ce 100644
--- a/dep/ACE_wrappers/ace/Basic_Types.cpp
+++ b/dep/ACE_wrappers/ace/Basic_Types.cpp
@@ -1,12 +1,15 @@
#include "ace/Basic_Types.h"
+
#if !defined (__ACE_INLINE__)
# include "ace/Basic_Types.inl"
#endif /* ! __ACE_INLINE__ */
+
ACE_RCSID (ace,
Basic_Types,
"$Id: Basic_Types.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if defined (ACE_LACKS_LONGLONG_T) && !defined (ACE_LACKS_UNSIGNEDLONGLONG_T)
# include "ace/Log_Msg.h"
# include "ace/OS_NS_stdio.h"
@@ -15,7 +18,9 @@ ACE_RCSID (ace,
// FUZZ: disable check_for_streams_include
# include "ace/streams.h"
# endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
void
ACE_U_LongLong::output (FILE *file) const
{
@@ -25,6 +30,7 @@ ACE_U_LongLong::output (FILE *file) const
ACE_OS::fprintf (file, "0x%lx", l_ ());
}
+
ACE_TCHAR *
ACE_U_LongLong::as_string (ACE_TCHAR *output,
unsigned int base,
@@ -89,6 +95,7 @@ ACE_U_LongLong::as_string (ACE_TCHAR *output,
{
ACE_OS::sprintf(output,
(uppercase ? "%lX" : "%lx"), this->l_ ());
+
}
break;
}
@@ -100,9 +107,11 @@ ACE_U_LongLong::as_string (ACE_TCHAR *output,
}
}
}
+
return output;
}
+
# if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
ostream&
operator<< (ostream& os, const ACE_U_LongLong& ll)
@@ -113,6 +122,7 @@ operator<< (ostream& os, const ACE_U_LongLong& ll)
unsigned long flags = os.setf(0);
#endif
char buffer[32];
+
if ((flags & ios::oct) != 0)
os << ll.as_string (buffer, 8);
else if ((flags & ios::hex) != 0)
@@ -122,6 +132,9 @@ operator<< (ostream& os, const ACE_U_LongLong& ll)
return os;
}
# endif
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_LACKS_LONGLONG_T */
+
diff --git a/dep/ACE_wrappers/ace/Basic_Types.h b/dep/ACE_wrappers/ace/Basic_Types.h
index 6a36971c3a9..9b57fd81c43 100644
--- a/dep/ACE_wrappers/ace/Basic_Types.h
+++ b/dep/ACE_wrappers/ace/Basic_Types.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Basic_Types.h
@@ -41,37 +42,50 @@
*
*/
//=============================================================================
+
#include "ace/config-lite.h"
+
#ifndef ACE_BASIC_TYPES_H
# define ACE_BASIC_TYPES_H
+
# include /**/ "ace/pre.h"
+
# if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
# endif /* ACE_LACKS_PRAGMA_ONCE */
+
// Pull in definitions
# include "ace/os_include/os_limits.h" // Integer limits
# include "ace/os_include/os_float.h" // Floating point limits
# include "ace/os_include/os_stdlib.h" // Other types
# include "ace/os_include/os_stddef.h" // Get ptrdiff_t - see further comments below
+
# if defined(ACE_LACKS_LONGLONG_T)
# include "ace/os_include/os_stdio.h" // For long long emulation
# endif /* ACE_LACKS_LONGLONG_T */
+
# include "ace/os_include/sys/os_types.h"
+
# if !defined (ACE_LACKS_SYS_PARAM_H)
# include /**/ <sys/param.h>
# endif /* ACE_LACKS_SYS_PARAM_H */
+
# include "ace/ACE_export.h"
+
# if !defined (ACE_LACKS_STDINT_H)
# include <stdint.h>
# endif
# if !defined (ACE_LACKS_INTTYPES_H)
# include <inttypes.h>
# endif
+
#ifdef ACE_LACKS_INTPTR_T
# include "ace/If_Then_Else.h"
+
// This intptr_t typedef is here instead of
// <ace/os_include/os_inttypes.h> since it depends on the template
// metaprogramming in <ace/If_Then_Else.h>.
+
// We could compare ACE_SIZEOF_VOID_P against ACE_SIZEOF_LONG, etc.
// However, that depends on the ACE preprocessor symbol definitions in
// the platform-specific configuration header being correct.
@@ -79,6 +93,7 @@
// i.e. determining the type at compile-time rather than at
// preprocessing-time, will work for all platforms, and does not
// depend on ACE developer-defined configuration parameters.
+
typedef ACE::If_Then_Else<
(sizeof (void*) == sizeof (signed int)),
signed int,
@@ -96,6 +111,7 @@ typedef ACE::If_Then_Else<
#endif /* ACE_LACKS_LONGLONG_T */
>::result_type
>::result_type intptr_t;
+
typedef ACE::If_Then_Else<
(sizeof (void*) == sizeof (unsigned int)),
unsigned int,
@@ -113,9 +129,12 @@ typedef ACE::If_Then_Else<
#endif /* ACE_LACKS_UNSIGNEDLONGLONG_T */
>::result_type
>::result_type uintptr_t;
+
#endif /* ACE_LACKS_INTPTR_T */
+
// A char always has 1 byte, by definition.
# define ACE_SIZEOF_CHAR 1
+
// Unfortunately, there isn't a portable way to determine the size of a wchar.
// So we just define them on a platform basis. If the platform doesn't
// define it and it's an XPG4 system, assume wchar_t is 4 bytes. Some code
@@ -132,6 +151,7 @@ typedef ACE::If_Then_Else<
# endif /* ACE_HAS_XPG4_MULTIBYTE_CHAR */
# endif /* !ACE_SIZEOF_WCHAR */
# endif /* ACE_HAS_WCHAR */
+
// The number of bytes in a short.
# if !defined (ACE_SIZEOF_SHORT)
# if (USHRT_MAX) == 255U
@@ -146,6 +166,7 @@ typedef ACE::If_Then_Else<
# error: unsupported short size, must be updated for this platform!
# endif /* USHRT_MAX */
# endif /* !defined (ACE_SIZEOF_SHORT) */
+
// The number of bytes in an int.
# if !defined (ACE_SIZEOF_INT)
# if (UINT_MAX) == 65535U
@@ -158,6 +179,7 @@ typedef ACE::If_Then_Else<
# error: unsupported int size, must be updated for this platform!
# endif /* UINT_MAX */
# endif /* !defined (ACE_SIZEOF_INT) */
+
// The number of bytes in a long.
# if !defined (ACE_SIZEOF_LONG)
# if (ULONG_MAX) == 65535UL
@@ -170,6 +192,7 @@ typedef ACE::If_Then_Else<
# error: unsupported long size, must be updated for this platform!
# endif /* ULONG_MAX */
# endif /* !defined (ACE_SIZEOF_LONG) */
+
// The number of bytes in a long long.
# if !defined (ACE_SIZEOF_LONG_LONG)
# if defined (ACE_LACKS_LONGLONG_T)
@@ -197,10 +220,13 @@ typedef ACE::If_Then_Else<
# endif
# endif /* !defined (ACE_SIZEOF_LONG_LONG) */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// The sizes of the commonly implemented types are now known. Set up
// typedefs for whatever we can. Some of these are needed for certain
// cases of ACE_UINT64, so do them before the 64-bit stuff.
+
#if defined (ACE_INT8_TYPE)
typedef ACE_INT8_TYPE ACE_INT8;
#elif defined (ACE_HAS_INT8_T)
@@ -210,6 +236,7 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
#else
typedef char ACE_INT8;
#endif /* defined (ACE_INT8_TYPE) */
+
#if defined (ACE_UINT8_TYPE)
typedef ACE_UINT8_TYPE ACE_UINT8;
#elif defined (ACE_HAS_UINT8_T)
@@ -217,6 +244,7 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
#else
typedef unsigned char ACE_UINT8;
#endif /* defined (ACE_UINT8_TYPE) */
+
#if defined (ACE_INT16_TYPE)
typedef ACE_INT16_TYPE ACE_INT16;
#elif defined (ACE_HAS_INT16_T)
@@ -228,6 +256,7 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
#else
# error Have to add to the ACE_INT16 type setting
#endif /* defined (ACE_INT16_TYPE) */
+
#if defined (ACE_UINT16_TYPE)
typedef ACE_UINT16_TYPE ACE_UINT16;
#elif defined (ACE_HAS_UINT16_T)
@@ -239,6 +268,7 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
#else
# error Have to add to the ACE_UINT16 type setting
#endif /* defined (ACE_UINT16_TYPE) */
+
#if defined (ACE_INT32_TYPE)
typedef ACE_INT32_TYPE ACE_INT32;
#elif defined (ACE_HAS_INT32_T)
@@ -250,6 +280,7 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
#else
# error Have to add to the ACE_INT32 type setting
#endif /* defined (ACE_INT32_TYPE) */
+
#if defined (ACE_UINT32_TYPE)
typedef ACE_UINT32_TYPE ACE_UINT32;
#elif defined (ACE_HAS_UINT32_T)
@@ -261,6 +292,7 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
#else
# error Have to add to the ACE_UINT32 type setting
#endif /* defined (ACE_UINT32_TYPE) */
+
#if defined (ACE_INT64_TYPE)
typedef ACE_INT64_TYPE ACE_INT64;
#elif defined (ACE_HAS_INT64_T)
@@ -275,8 +307,10 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
# endif /* __GNUC__ */
typedef long long ACE_INT64;
#endif /* defined (ACE_INT64_TYPE) */
+
#if !(defined (ACE_LACKS_LONGLONG_T) || defined (ACE_LACKS_UNSIGNEDLONGLONG_T))
/* See matching #if around ACE_U_LongLong class declaration below */
+
# if defined (ACE_UINT64_TYPE)
typedef ACE_UINT64_TYPE ACE_UINT64;
# elif defined (ACE_HAS_UINT64_T)
@@ -293,11 +327,15 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
# endif /* defined (ACE_UINT64_TYPE) */
#endif /* !(ACE_LACKS_LONGLONG_T || ACE_LACKS_UNSIGNEDLONGLONG_T) */
+
typedef ACE_UINT16 ACE_USHORT16; // @@ Backward compatibility.
+
// Define a generic byte for use in codecs
typedef unsigned char ACE_Byte;
+
// Define a pseudo wide character type when wchar is not supported so we
// can support basic wide character string operations.
+
# if defined (ACE_HAS_WCHAR) || defined (ACE_HAS_XPG4_MULTIBYTE_CHAR)
# define ACE_WINT_T wint_t
# define ACE_WCHAR_T wchar_t
@@ -305,17 +343,21 @@ typedef unsigned char ACE_Byte;
# define ACE_WINT_T ACE_UINT16
# define ACE_WCHAR_T ACE_UINT16
# endif /* ACE_HAS_WCHAR */
+
// The number of bytes in a void *.
# ifndef ACE_SIZEOF_VOID_P
# define ACE_SIZEOF_VOID_P ACE_SIZEOF_LONG
# endif /* ACE_SIZEOF_VOID_P */
+
// Type for doing arithmetic on pointers ... as elsewhere, we assume
// that unsigned versions of a type are the same size as the signed
// version of the same type.
# if defined (ACE_HAS_WINCE) && (_WIN32_WCE < 400)
typedef unsigned long ptrdiff_t; // evc3, PocketPC don't defined ptrdiff_t
# endif
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
// Byte-order (endian-ness) determination.
# if defined (BYTE_ORDER)
# if (BYTE_ORDER == LITTLE_ENDIAN)
@@ -362,12 +404,14 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_BYTE_ORDER ACE_BIG_ENDIAN
# endif
# endif /* ! BYTE_ORDER && ! __BYTE_ORDER */
+
// Byte swapping macros to deal with differences between little endian
// and big endian machines. Note that "long" here refers to 32 bit
// quantities.
# define ACE_SWAP_LONG(L) ((ACE_SWAP_WORD ((L) & 0xFFFF) << 16) \
| ACE_SWAP_WORD(((L) >> 16) & 0xFFFF))
# define ACE_SWAP_WORD(L) ((((L) & 0x00FF) << 8) | (((L) & 0xFF00) >> 8))
+
# if defined (ACE_LITTLE_ENDIAN)
# define ACE_HTONL(X) ACE_SWAP_LONG (X)
# define ACE_NTOHL(X) ACE_SWAP_LONG (X)
@@ -379,6 +423,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_IDL_NCTOHL(X) (X << 24)
# define ACE_IDL_NSTOHL(X) ((X) << 16)
# endif /* ACE_LITTLE_ENDIAN */
+
# if defined (ACE_LITTLE_ENDIAN)
# define ACE_HTONS(x) ACE_SWAP_WORD(x)
# define ACE_NTOHS(x) ACE_SWAP_WORD(x)
@@ -386,6 +431,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_HTONS(x) x
# define ACE_NTOHS(x) x
# endif /* ACE_LITTLE_ENDIAN */
+
#if defined (ACE_LACKS_LONGLONG_T)
// This throws away the high 32 bits. It's very unlikely that a
// pointer will be more than 32 bits wide if the platform does not
@@ -399,11 +445,14 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_LONGLONG_TO_PTR(PTR_TYPE, L) \
reinterpret_cast<PTR_TYPE> (static_cast<intptr_t> (L))
#endif /* ! ACE_LACKS_LONGLONG_T */
+
// If the platform lacks an unsigned long long, define one.
#if defined (ACE_LACKS_LONGLONG_T) || defined (ACE_LACKS_UNSIGNEDLONGLONG_T)
// Forward declaration for streams
# include "ace/iosfwd.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_U_LongLong
*
@@ -432,6 +481,7 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_U_LongLong &operator= (const ACE_INT32 &);
ACE_U_LongLong &operator= (const ACE_UINT32 &);
~ACE_U_LongLong (void);
+
// = Overloaded relation operators.
bool operator== (const ACE_U_LongLong &) const;
bool operator== (const ACE_UINT32) const;
@@ -445,17 +495,21 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
bool operator> (const ACE_UINT32) const;
bool operator>= (const ACE_U_LongLong &) const;
bool operator>= (const ACE_UINT32) const;
+
ACE_U_LongLong operator+ (const ACE_U_LongLong &) const;
ACE_U_LongLong operator+ (const ACE_UINT32) const;
ACE_U_LongLong operator- (const ACE_U_LongLong &) const;
ACE_U_LongLong operator- (const ACE_UINT32) const;
ACE_U_LongLong operator* (const ACE_UINT32) const;
ACE_U_LongLong &operator*= (const ACE_UINT32);
+
ACE_U_LongLong operator<< (const unsigned int) const;
ACE_U_LongLong &operator<<= (const unsigned int);
ACE_U_LongLong operator>> (const unsigned int) const;
ACE_U_LongLong &operator>>= (const unsigned int);
+
double operator/ (const double) const;
+
ACE_U_LongLong &operator+= (const ACE_U_LongLong &);
ACE_U_LongLong &operator+= (const ACE_UINT32);
ACE_U_LongLong &operator-= (const ACE_U_LongLong &);
@@ -468,16 +522,19 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_U_LongLong &operator|= (const ACE_UINT32);
ACE_U_LongLong &operator&= (const ACE_U_LongLong);
ACE_U_LongLong &operator&= (const ACE_UINT32);
+
// Note that the following take ACE_UINT32 arguments. These are
// typical use cases, and easy to implement. But, they limit the
// return values to 32 bits as well. There are no checks for
// overflow.
ACE_UINT32 operator/ (const ACE_UINT32) const;
ACE_UINT32 operator% (const ACE_UINT32) const;
+
// The following only operate on the lower 32 bits (they take only
// 32 bit arguments).
ACE_UINT32 operator| (const ACE_INT32) const;
ACE_UINT32 operator& (const ACE_INT32) const;
+
// The following operators convert their arguments to
// ACE_UINT32. So, there may be information loss if they are
// used.
@@ -491,20 +548,27 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_UINT32 operator/ (const unsigned int) const;
ACE_UINT32 operator/ (const int) const;
# endif /* ACE_SIZEOF_INT != 4 */
+
// = Helper methods.
/// Outputs the value to the FILE, in hex.
void output (FILE * = stdout) const;
+
ACE_TCHAR *as_string (ACE_TCHAR *string,
unsigned int base = 10,
unsigned int uppercase = 0) const;
+
ACE_UINT32 hi (void) const;
ACE_UINT32 lo (void) const;
+
void hi (const ACE_UINT32 hi);
void lo (const ACE_UINT32 lo);
+
#if defined (ACE_LACKS_UNSIGNEDLONGLONG_T)
long long to_int64 (void) const;
# endif
+
private:
+
#if defined (ACE_LACKS_UNSIGNEDLONGLONG_T)
long long data_;
#else
@@ -516,7 +580,9 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_UINT32 hi_;
/// Low 32 bits.
ACE_UINT32 lo_;
+
# else
+
/// Low 32 bits.
ACE_UINT32 lo_;
/// High 32 bits.
@@ -527,23 +593,31 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
union
{
struct ace_hi_lo_correct_endian data_;
+
/// To ensure alignment on 8-byte boundary.
double for_alignment_;
};
+
// @note the following four accessors are inlined here in
// order to minimize the extent of the data_ struct. It's
// only used here; the .i and .cpp files use the accessors.
+
/// Internal utility function to hide access through struct.
const ACE_UINT32 &h_ () const { return data_.hi_; }
+
/// Internal utility function to hide access through struct.
ACE_UINT32 &h_ () { return data_.hi_; }
+
/// Internal utility function to hide access through struct.
const ACE_UINT32 &l_ () const { return data_.lo_; }
+
/// Internal utility function to hide access through struct.
ACE_UINT32 &l_ () { return data_.lo_; }
+
// @note the above four accessors are inlined here in
// order to minimize the extent of the data_ struct. It's
// only used here; the .inl and .cpp files use the accessors.
+
/// These functions are used to implement multiplication.
ACE_UINT32 ul_shift (ACE_UINT32 a,
ACE_UINT32 c_in,
@@ -559,13 +633,19 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_UINT32 *carry) const;
#endif // ACE_LACKS_UNSIGNEDLONGLONG_T
};
+
typedef ACE_U_LongLong ACE_UINT64;
+
#if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
ostream &operator<< (ostream &, const ACE_U_LongLong &);
#endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# endif /* ACE_LACKS_LONGLONG_T */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Conversions from ACE_UINT64 to ACE_UINT32. ACE_CU64_TO_CU32 should
// be used on const ACE_UINT64's.
# if defined (ACE_LACKS_LONGLONG_T) || defined (ACE_LACKS_UNSIGNEDLONGLONG_T)
@@ -579,6 +659,7 @@ ACE_U64_TO_U32 (ACE_U_LongLong const & n)
*/
return n.lo ();
}
+
inline ACE_UINT32
ACE_CU64_TO_CU32 (ACE_U_LongLong const & n)
{
@@ -590,13 +671,16 @@ ACE_U64_TO_U32 (ACE_UINT64 n)
{
return static_cast<ACE_UINT32> (n);
}
+
inline ACE_UINT32
ACE_CU64_TO_CU32 (ACE_UINT64 n)
{
return static_cast<ACE_UINT32> (n);
}
# endif /* ! ACE_LACKS_LONGLONG_T */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
// 64-bit literals require special marking on some platforms.
# if defined (ACE_LACKS_LONGLONG_T)
// Can only specify 32-bit arguments.
@@ -619,6 +703,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_UINT64_LITERAL(n) n ## ull
# define ACE_INT64_LITERAL(n) n ## ll
# endif /* ! ACE_WIN32 && ! ACE_LACKS_LONGLONG_T */
+
#if !defined (ACE_INT8_FORMAT_SPECIFIER)
# if defined (PRId8)
# define ACE_INT8_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRId8)
@@ -626,6 +711,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_INT8_FORMAT_SPECIFIER ACE_TEXT ("%d")
# endif /* defined (PRId8) */
#endif /* ACE_INT8_FORMAT_SPECIFIER */
+
#if !defined (ACE_UINT8_FORMAT_SPECIFIER)
# if defined (PRIu8)
# define ACE_UINT8_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRIu8)
@@ -633,6 +719,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_UINT8_FORMAT_SPECIFIER ACE_TEXT ("%u")
# endif /* defined (PRIu8) */
#endif /* ACE_UINT8_FORMAT_SPECIFIER */
+
#if !defined (ACE_INT16_FORMAT_SPECIFIER)
# if defined (PRId16)
# define ACE_INT16_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRId16)
@@ -640,6 +727,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_INT16_FORMAT_SPECIFIER ACE_TEXT ("%d")
# endif /* defined (PRId16) */
#endif /* ACE_INT16_FORMAT_SPECIFIER */
+
#if !defined (ACE_UINT16_FORMAT_SPECIFIER)
# if defined (PRIu16)
# define ACE_UINT16_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRIu16)
@@ -647,6 +735,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_UINT16_FORMAT_SPECIFIER ACE_TEXT ("%u")
# endif /* defined (PRIu16) */
#endif /* ACE_UINT16_FORMAT_SPECIFIER */
+
#if !defined (ACE_INT32_FORMAT_SPECIFIER)
# if defined (PRId32)
# define ACE_INT32_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRId32)
@@ -656,6 +745,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_INT32_FORMAT_SPECIFIER ACE_TEXT ("%ld")
# endif /* defined (PRId32) */
#endif /* ACE_INT32_FORMAT_SPECIFIER */
+
#if !defined (ACE_UINT32_FORMAT_SPECIFIER)
# if defined (PRIu32)
# define ACE_UINT32_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRIu32)
@@ -665,6 +755,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_UINT32_FORMAT_SPECIFIER ACE_TEXT ("%lu")
# endif /* defined (PRIu32) */
#endif /* ACE_UINT32_FORMAT_SPECIFIER */
+
#if !defined (ACE_INT64_FORMAT_SPECIFIER)
# if defined (PRId64)
# define ACE_INT64_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRId64)
@@ -674,6 +765,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_INT64_FORMAT_SPECIFIER ACE_TEXT ("%lld")
# endif /* defined (PRId64) */
#endif /* ACE_INT64_FORMAT_SPECIFIER */
+
#if !defined (ACE_UINT64_FORMAT_SPECIFIER)
# if defined (PRIu64)
# define ACE_UINT64_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRIu64)
@@ -683,6 +775,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_UINT64_FORMAT_SPECIFIER ACE_TEXT ("%llu")
# endif /* defined (PRIu64) */
#endif /* ACE_UINT64_FORMAT_SPECIFIER */
+
#if !defined (ACE_SSIZE_T_FORMAT_SPECIFIER)
# if defined (ACE_WIN64)
# define ACE_SSIZE_T_FORMAT_SPECIFIER ACE_TEXT ("%I64d")
@@ -690,6 +783,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_SSIZE_T_FORMAT_SPECIFIER ACE_TEXT ("%d")
# endif /* ACE_WIN64 */
#endif /* ACE_SSIZE_T_FORMAT_SPECIFIER */
+
#if !defined (ACE_SIZE_T_FORMAT_SPECIFIER)
# if defined (ACE_WIN64)
# define ACE_SIZE_T_FORMAT_SPECIFIER ACE_TEXT ("%I64u")
@@ -697,6 +791,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_SIZE_T_FORMAT_SPECIFIER ACE_TEXT ("%u")
# endif /* ACE_WIN64 */
#endif /* ACE_SIZE_T_FORMAT_SPECIFIER */
+
// Cast from UINT64 to a double requires an intermediate cast to INT64
// on some platforms.
# if defined (ACE_LACKS_LONGLONG_T)
@@ -710,6 +805,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_UINT64_DBLCAST_ADAPTER(n) (n)
# endif /* ! ACE_WIN32 && ! ACE_LACKS_LONGLONG_T */
+
// The number of bytes in a float.
# ifndef ACE_SIZEOF_FLOAT
# if FLT_MAX_EXP == 128
@@ -720,6 +816,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# error: unsupported float size, must be updated for this platform!
# endif /* FLT_MAX_EXP */
# endif /* ACE_SIZEOF_FLOAT */
+
// The number of bytes in a double.
# ifndef ACE_SIZEOF_DOUBLE
# if DBL_MAX_EXP == 128
@@ -730,6 +827,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# error: unsupported double size, must be updated for this platform!
# endif /* DBL_MAX_EXP */
# endif /* ACE_SIZEOF_DOUBLE */
+
// The number of bytes in a long double.
# ifndef ACE_SIZEOF_LONG_DOUBLE
# if LDBL_MAX_EXP == 128
@@ -750,6 +848,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# error: unsupported double size, must be updated for this platform!
# endif /* LDBL_MAX_EXP */
# endif /* ACE_SIZEOF_LONG_DOUBLE */
+
// Max and min sizes for the ACE integer types.
#define ACE_CHAR_MAX 0x7F
#define ACE_CHAR_MIN -(ACE_CHAR_MAX)-1
@@ -763,6 +862,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
#define ACE_UINT32_MAX 0xFFFFFFFF
#define ACE_INT64_MAX ACE_INT64_LITERAL(0x7FFFFFFFFFFFFFFF)
#define ACE_INT64_MIN -(ACE_INT64_MAX)-1
+
#if defined (ACE_LACKS_UNSIGNEDLONGLONG_T)
// ACE_U_LongLong's constructor accepts a "long long" in this
// case. Set it to ACE_U_LongLong (-1) since the bit pattern for long
@@ -775,14 +875,17 @@ ACE_END_VERSIONED_NAMESPACE_DECL
#else
# define ACE_UINT64_MAX ACE_UINT64_LITERAL (0xFFFFFFFFFFFFFFFF)
#endif /* ACE_LACKS_UNSIGNEDLONGLONG_T */
+
// These use ANSI/IEEE format.
#define ACE_FLT_MAX 3.402823466e+38F
#define ACE_FLT_MIN 1.175494351e-38F
#define ACE_DBL_MAX 1.7976931348623158e+308
#define ACE_DBL_MIN 2.2250738585072014e-308
+
# if defined (__ACE_INLINE__)
# include "ace/Basic_Types.inl"
# endif /* __ACE_INLINE__ */
+
# include /**/ "ace/post.h"
#endif /* ACE_BASIC_TYPES_H */
diff --git a/dep/ACE_wrappers/ace/Basic_Types.inl b/dep/ACE_wrappers/ace/Basic_Types.inl
index 4f4f04ab9d9..c6f0013d45e 100644
--- a/dep/ACE_wrappers/ace/Basic_Types.inl
+++ b/dep/ACE_wrappers/ace/Basic_Types.inl
@@ -1,65 +1,80 @@
// -*- C++ -*-
//
// $Id: Basic_Types.inl 80826 2008-03-04 14:51:23Z wotte $
+
# if !defined (ACE_LACKS_LONGLONG_T) && defined (ACE_LACKS_UNSIGNEDLONGLONG_T)
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Implementation for ACE_U_LongLong when we have signed long long
// but no unsigned long long.
+
ACE_INLINE
ACE_U_LongLong::ACE_U_LongLong (const long long value)
: data_ (value)
{
}
+
ACE_INLINE ACE_UINT32
ACE_U_LongLong::hi (void) const
{
return (data_ >> 32) & 0xFFFFFFFF;
}
+
ACE_INLINE ACE_UINT32
ACE_U_LongLong::lo (void) const
{
return data_ & 0xFFFFFFFF;
}
+
ACE_INLINE void
ACE_U_LongLong::hi (const ACE_UINT32 hi)
{
data_ = hi;
data_ <<= 32;
}
+
ACE_INLINE void
ACE_U_LongLong::lo (const ACE_UINT32 lo)
{
data_ = lo;
}
+
ACE_INLINE long long
ACE_U_LongLong::to_int64 (void) const
{
return data_;
}
+
ACE_INLINE
ACE_U_LongLong::~ACE_U_LongLong (void)
{
}
+
ACE_INLINE bool
ACE_U_LongLong::operator== (const ACE_U_LongLong &n) const
{
return data_ == n.data_;
}
+
ACE_INLINE bool
ACE_U_LongLong::operator== (const ACE_UINT32 n) const
{
return data_ == n;
}
+
ACE_INLINE bool
ACE_U_LongLong::operator!= (const ACE_U_LongLong &n) const
{
return ! (*this == n);
}
+
ACE_INLINE bool
ACE_U_LongLong::operator!= (const ACE_UINT32 n) const
{
return ! (*this == n);
}
+
ACE_INLINE bool
ACE_U_LongLong::operator< (const ACE_U_LongLong &n) const
{
@@ -74,22 +89,27 @@ ACE_U_LongLong::operator< (const ACE_U_LongLong &n) const
else
return data_ < n.data_;
}
+
ACE_INLINE bool
ACE_U_LongLong::operator< (const ACE_UINT32 n) const
{
return operator< (static_cast<const ACE_U_LongLong> (n));
}
+
ACE_INLINE bool
ACE_U_LongLong::operator<= (const ACE_U_LongLong &n) const
{
if (data_ == n.data_) return true;
+
return data_ < n.data_;
}
+
ACE_INLINE bool
ACE_U_LongLong::operator<= (const ACE_UINT32 n) const
{
return operator<= (static_cast<const ACE_U_LongLong> (n));
}
+
ACE_INLINE bool
ACE_U_LongLong::operator> (const ACE_U_LongLong &n) const
{
@@ -104,33 +124,41 @@ ACE_U_LongLong::operator> (const ACE_U_LongLong &n) const
else
return data_ > n.data_;
}
+
ACE_INLINE bool
ACE_U_LongLong::operator> (const ACE_UINT32 n) const
{
return operator> (static_cast<const ACE_U_LongLong> (n));
}
+
ACE_INLINE bool
ACE_U_LongLong::operator>= (const ACE_U_LongLong &n) const
{
if (data_ == n.data_) return true;
+
return data_ > n.data_;
}
+
ACE_INLINE bool
ACE_U_LongLong::operator>= (const ACE_UINT32 n) const
{
return operator>= (static_cast<const ACE_U_LongLong> (n));
}
+
ACE_INLINE
ACE_U_LongLong::ACE_U_LongLong (const ACE_U_LongLong &n)
: data_ (n.data_)
{
}
+
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator= (const ACE_U_LongLong &n)
{
data_ = n.data_;
+
return *this;
}
+
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator= (const ACE_INT32 &rhs)
{
@@ -147,107 +175,135 @@ ACE_U_LongLong::operator= (const ACE_INT32 &rhs)
// implementation is to simply set all bits to zero.
data_ = 0;
}
+
return *this;
}
+
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator= (const ACE_UINT32 &rhs)
{
data_ = rhs;
+
return *this;
}
+
ACE_INLINE ACE_U_LongLong
ACE_U_LongLong::operator+ (const ACE_U_LongLong &n) const
{
return data_ + n.data_;
}
+
ACE_INLINE ACE_U_LongLong
ACE_U_LongLong::operator+ (const ACE_UINT32 n) const
{
return operator+ (static_cast<const ACE_U_LongLong> (n));
}
+
ACE_INLINE ACE_U_LongLong
ACE_U_LongLong::operator- (const ACE_U_LongLong &n) const
{
return data_ - n.data_;
}
+
ACE_INLINE ACE_U_LongLong
ACE_U_LongLong::operator- (const ACE_UINT32 n) const
{
return operator- (static_cast<const ACE_U_LongLong> (n));
}
+
ACE_INLINE ACE_U_LongLong
ACE_U_LongLong::operator<< (const u_int n) const
{
return data_ << n;
}
+
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator<<= (const u_int n)
{
data_ <<= n;
+
return *this;
}
+
ACE_INLINE ACE_U_LongLong
ACE_U_LongLong::operator>> (const u_int n) const
{
return data_ >> n;
}
+
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator>>= (const u_int n)
{
data_ >>= n;
+
return *this;
}
+
ACE_INLINE double
ACE_U_LongLong::operator/ (const double n) const
{
return data_ / n;
}
+
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator+= (const ACE_U_LongLong &n)
{
data_ += n.data_;
+
return *this;
}
+
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator+= (const ACE_UINT32 n)
{
return operator+= (static_cast<const ACE_U_LongLong> (n));
}
+
ACE_INLINE ACE_U_LongLong
ACE_U_LongLong::operator* (const ACE_UINT32 n) const
{
return data_ * n;
}
+
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator*= (const ACE_UINT32 n)
{
data_ *= n;
+
return *this;
}
+
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator-= (const ACE_U_LongLong &n)
{
data_ -= n.data_;
+
return *this;
}
+
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator-= (const ACE_UINT32 n)
{
return operator-= (static_cast<const ACE_U_LongLong> (n));
}
+
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator++ ()
{
++data_;
+
return *this;
}
+
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator-- ()
{
--data_;
+
return *this;
}
+
ACE_INLINE const ACE_U_LongLong
ACE_U_LongLong::operator++ (int)
{
@@ -257,6 +313,7 @@ ACE_U_LongLong::operator++ (int)
++*this;
return temp;
}
+
ACE_INLINE const ACE_U_LongLong
ACE_U_LongLong::operator-- (int)
{
@@ -266,139 +323,170 @@ ACE_U_LongLong::operator-- (int)
--*this;
return temp;
}
+
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator|= (const ACE_U_LongLong n)
{
data_ |= n.data_;
+
return *this;
}
+
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator|= (const ACE_UINT32 n)
{
return operator|= (static_cast<const ACE_U_LongLong> (n));
}
+
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator&= (const ACE_U_LongLong n)
{
data_ &= n.data_;
+
return *this;
}
+
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator&= (const ACE_UINT32 n)
{
return operator&= (static_cast<const ACE_U_LongLong> (n));
}
+
ACE_INLINE ACE_UINT32
ACE_U_LongLong::operator/ (const ACE_UINT32 n) const
{
return data_ / n;
}
+
ACE_INLINE ACE_UINT32
ACE_U_LongLong::operator% (const ACE_UINT32 n) const
{
return data_ % n;
}
+
ACE_INLINE ACE_UINT32
ACE_U_LongLong::operator| (const ACE_INT32 n) const
{
return data_ | n;
}
+
ACE_INLINE ACE_UINT32
ACE_U_LongLong::operator& (const ACE_INT32 n) const
{
return data_ & n;
}
+
ACE_INLINE ACE_U_LongLong
ACE_U_LongLong::operator* (const ACE_INT32 n) const
{
return operator* ((ACE_UINT32) n);
}
+
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator*= (const ACE_INT32 n)
{
return operator*= ((ACE_UINT32) n);
}
+
ACE_INLINE ACE_UINT32
ACE_U_LongLong::operator/ (const ACE_INT32 n) const
{
return operator/ ((ACE_UINT32) n);
}
+
#if ACE_SIZEOF_INT == 4
ACE_INLINE ACE_UINT32
ACE_U_LongLong::operator/ (const u_long n) const
{
return operator/ ((ACE_UINT32) n);
}
+
ACE_INLINE ACE_UINT32
ACE_U_LongLong::operator/ (const long n) const
{
return operator/ ((ACE_UINT32) n);
}
+
#else /* ACE_SIZEOF_INT != 4 */
ACE_INLINE ACE_UINT32
ACE_U_LongLong::operator/ (const u_int n) const
{
return operator/ ((ACE_UINT32) n);
}
+
ACE_INLINE ACE_UINT32
ACE_U_LongLong::operator/ (const int n) const
{
return operator/ ((ACE_UINT32) n);
}
#endif
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#elif defined (ACE_LACKS_LONGLONG_T)
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_U_LongLong::ACE_U_LongLong (const ACE_UINT32 lo, const ACE_UINT32 hi)
{
h_ () = hi;
l_ () = lo;
}
+
ACE_INLINE ACE_UINT32
ACE_U_LongLong::hi (void) const
{
return h_ ();
}
+
ACE_INLINE ACE_UINT32
ACE_U_LongLong::lo (void) const
{
return l_ ();
}
+
ACE_INLINE void
ACE_U_LongLong::hi (const ACE_UINT32 hi)
{
h_ () = hi;
}
+
ACE_INLINE void
ACE_U_LongLong::lo (const ACE_UINT32 lo)
{
l_ () = lo;
}
+
ACE_INLINE
ACE_U_LongLong::~ACE_U_LongLong (void)
{
}
+
ACE_INLINE bool
ACE_U_LongLong::operator== (const ACE_U_LongLong &n) const
{
return h_ () == n.h_ () && l_ () == n.l_ ();
}
+
ACE_INLINE bool
ACE_U_LongLong::operator== (const ACE_UINT32 n) const
{
return h_ () == 0 && l_ () == n;
}
+
ACE_INLINE bool
ACE_U_LongLong::operator!= (const ACE_U_LongLong &n) const
{
return ! (*this == n);
}
+
ACE_INLINE bool
ACE_U_LongLong::operator!= (const ACE_UINT32 n) const
{
return ! (*this == n);
}
+
ACE_INLINE bool
ACE_U_LongLong::operator< (const ACE_U_LongLong &n) const
{
@@ -406,11 +494,13 @@ ACE_U_LongLong::operator< (const ACE_U_LongLong &n) const
: h_ () > n.h_ () ? 0
: l_ () < n.l_ ();
}
+
ACE_INLINE bool
ACE_U_LongLong::operator< (const ACE_UINT32 n) const
{
return operator< (static_cast<const ACE_U_LongLong> (n));
}
+
ACE_INLINE bool
ACE_U_LongLong::operator<= (const ACE_U_LongLong &n) const
{
@@ -418,11 +508,13 @@ ACE_U_LongLong::operator<= (const ACE_U_LongLong &n) const
: h_ () > n.h_ () ? 0
: l_ () <= n.l_ ();
}
+
ACE_INLINE bool
ACE_U_LongLong::operator<= (const ACE_UINT32 n) const
{
return operator<= (static_cast<const ACE_U_LongLong> (n));
}
+
ACE_INLINE bool
ACE_U_LongLong::operator> (const ACE_U_LongLong &n) const
{
@@ -430,11 +522,13 @@ ACE_U_LongLong::operator> (const ACE_U_LongLong &n) const
: h_ () < n.h_ () ? 0
: l_ () > n.l_ ();
}
+
ACE_INLINE bool
ACE_U_LongLong::operator> (const ACE_UINT32 n) const
{
return operator> (static_cast<const ACE_U_LongLong> (n));
}
+
ACE_INLINE bool
ACE_U_LongLong::operator>= (const ACE_U_LongLong &n) const
{
@@ -442,24 +536,29 @@ ACE_U_LongLong::operator>= (const ACE_U_LongLong &n) const
: h_ () < n.h_ () ? 0
: l_ () >= n.l_ ();
}
+
ACE_INLINE bool
ACE_U_LongLong::operator>= (const ACE_UINT32 n) const
{
return operator>= (static_cast<const ACE_U_LongLong> (n));
}
+
ACE_INLINE
ACE_U_LongLong::ACE_U_LongLong (const ACE_U_LongLong &n)
{
h_ () = n.h_ ();
l_ () = n.l_ ();
}
+
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator= (const ACE_U_LongLong &n)
{
h_ () = n.h_ ();
l_ () = n.l_ ();
+
return *this;
}
+
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator= (const ACE_INT32 &rhs)
{
@@ -477,131 +576,168 @@ ACE_U_LongLong::operator= (const ACE_INT32 &rhs)
l_ () = 0;
h_ () = 0;
}
+
return *this;
}
+
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator= (const ACE_UINT32 &rhs)
{
l_ () = rhs;
h_ () = 0;
+
return *this;
}
+
ACE_INLINE ACE_U_LongLong
ACE_U_LongLong::operator+ (const ACE_U_LongLong &n) const
{
ACE_U_LongLong ret (l_ () + n.l_ (), h_ () + n.h_ ());
if (ret.l_ () < n.l_ ()) /* carry */ ++ret.h_ ();
+
return ret;
}
+
ACE_INLINE ACE_U_LongLong
ACE_U_LongLong::operator+ (const ACE_UINT32 n) const
{
return operator+ (static_cast<const ACE_U_LongLong> (n));
}
+
ACE_INLINE ACE_U_LongLong
ACE_U_LongLong::operator- (const ACE_U_LongLong &n) const
{
ACE_U_LongLong ret (l_ () - n.l_ (), h_ () - n.h_ ());
if (l_ () < n.l_ ()) /* borrow */ --ret.h_ ();
+
return ret;
}
+
ACE_INLINE ACE_U_LongLong
ACE_U_LongLong::operator- (const ACE_UINT32 n) const
{
return operator- (static_cast<const ACE_U_LongLong> (n));
}
+
ACE_INLINE ACE_U_LongLong
ACE_U_LongLong::operator<< (const u_int n) const
{
const ACE_UINT32 carry_mask = l_ () >> (32 - n);
ACE_U_LongLong ret (n < 32 ? l_ () << n : 0,
n < 32 ? (h_ () << n) | carry_mask : carry_mask);
+
return ret;
}
+
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator<<= (const u_int n)
{
const ACE_UINT32 carry_mask = l_ () >> (32 - n);
h_ () = n < 32 ? (h_ () << n) | carry_mask : carry_mask;
+
// g++ 2.7.2.3/Solaris 2.5.1 doesn't modify l_ () if shifted by 32.
l_ () = n < 32 ? l_ () << n : 0;
+
return *this;
}
+
ACE_INLINE ACE_U_LongLong
ACE_U_LongLong::operator>> (const u_int n) const
{
const ACE_UINT32 carry_mask = h_ () << (32 - n);
ACE_U_LongLong ret (n < 32 ? (l_ () >> n) | carry_mask : 0,
n < 32 ? h_ () >> n : 0);
+
return ret;
}
+
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator>>= (const u_int n)
{
const ACE_UINT32 carry_mask = h_ () << (32 - n);
l_ () = n < 32 ? (l_ () >> n) | carry_mask : carry_mask;
h_ () = n < 32 ? h_ () >> n : 0;
+
return *this;
}
+
ACE_INLINE double
ACE_U_LongLong::operator/ (const double n) const
{
// See the derivation above in operator/ (const ACE_UINT32).
+
return ((double) 0xffffffffu - n + 1.0) / n * h_ () +
(double) h_ () + (double) l_ () / n;
}
+
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator+= (const ACE_U_LongLong &n)
{
h_ () += n.h_ ();
l_ () += n.l_ ();
if (l_ () < n.l_ ()) /* carry */ ++h_ ();
+
return *this;
}
+
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator+= (const ACE_UINT32 n)
{
return operator+= (static_cast<const ACE_U_LongLong> (n));
}
+
#define ACE_HIGHBIT (~(~0UL >> 1))
+
ACE_INLINE ACE_UINT32
ACE_U_LongLong::ul_shift (ACE_UINT32 a, ACE_UINT32 c_in, ACE_UINT32 *c_out) const
{
const ACE_UINT32 b = (a << 1) | c_in;
*c_out = (*c_out << 1) + ((a & ACE_HIGHBIT) > 0);
+
return b;
}
+
ACE_INLINE ACE_U_LongLong
ACE_U_LongLong::ull_shift (ACE_U_LongLong a,
ACE_UINT32 c_in,
ACE_UINT32 *c_out) const
{
ACE_U_LongLong b;
+
b.l_ () = (a.l_ () << 1) | c_in;
c_in = ((a.l_ () & ACE_HIGHBIT) > 0);
b.h_ () = (a.h_ () << 1) | c_in;
*c_out = (*c_out << 1) + ((a.h_ () & ACE_HIGHBIT) > 0);
+
return b;
}
+
ACE_INLINE ACE_U_LongLong
ACE_U_LongLong::ull_add (ACE_U_LongLong a, ACE_U_LongLong b, ACE_UINT32 *carry) const
{
ACE_U_LongLong r (0, 0);
ACE_UINT32 c1, c2, c3, c4;
+
c1 = a.l_ () % 2;
c2 = b.l_ () % 2;
c3 = 0;
+
r.l_ () = a.l_ ()/2 + b.l_ ()/2 + (c1+c2)/2;
r.l_ () = ul_shift (r.l_ (), (c1+c2)%2, &c3);
+
c1 = a.h_ () % 2;
c2 = b.h_ () % 2;
c4 = 0;
+
r.h_ () = a.h_ ()/2 + b.h_ ()/2 + (c1+c2+c3)/2;
r.h_ () = ul_shift (r.h_ (), (c1+c2+c3)%2, &c4);
+
*carry = c4;
+
return r;
}
+
ACE_INLINE ACE_U_LongLong
ACE_U_LongLong::ull_mult (ACE_U_LongLong a, ACE_UINT32 b, ACE_UINT32 *carry) const
{
@@ -609,6 +745,7 @@ ACE_U_LongLong::ull_mult (ACE_U_LongLong a, ACE_UINT32 b, ACE_UINT32 *carry) con
const ACE_U_LongLong zero (0, 0);
ACE_U_LongLong accum (0, 0);
ACE_UINT32 c;
+
*carry = 0;
if (b > 0)
do
@@ -622,47 +759,60 @@ ACE_U_LongLong::ull_mult (ACE_U_LongLong a, ACE_UINT32 b, ACE_UINT32 *carry) con
mask >>= 1;
}
while (mask > 0);
+
return accum;
}
+
ACE_INLINE ACE_U_LongLong
ACE_U_LongLong::operator* (const ACE_UINT32 n) const
{
ACE_UINT32 carry; // will throw the carry away
+
return ull_mult (*this, n, &carry);
}
+
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator*= (const ACE_UINT32 n)
{
ACE_UINT32 carry; // will throw the carry away
+
return *this = ull_mult (*this, n, &carry);
}
+
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator-= (const ACE_U_LongLong &n)
{
h_ () -= n.h_ ();
if (l_ () < n.l_ ()) /* borrow */ --h_ ();
l_ () -= n.l_ ();
+
return *this;
}
+
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator-= (const ACE_UINT32 n)
{
return operator-= (static_cast<const ACE_U_LongLong> (n));
}
+
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator++ ()
{
++l_ ();
if (l_ () == 0) /* carry */ ++h_ ();
+
return *this;
}
+
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator-- ()
{
if (l_ () == 0) /* borrow */ --h_ ();
--l_ ();
+
return *this;
}
+
ACE_INLINE const ACE_U_LongLong
ACE_U_LongLong::operator++ (int)
{
@@ -672,6 +822,7 @@ ACE_U_LongLong::operator++ (int)
++*this;
return temp;
}
+
ACE_INLINE const ACE_U_LongLong
ACE_U_LongLong::operator-- (int)
{
@@ -681,30 +832,37 @@ ACE_U_LongLong::operator-- (int)
--*this;
return temp;
}
+
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator|= (const ACE_U_LongLong n)
{
l_ () |= n.l_ ();
h_ () |= n.h_ ();
+
return *this;
}
+
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator|= (const ACE_UINT32 n)
{
return operator|= (static_cast<const ACE_U_LongLong> (n));
}
+
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator&= (const ACE_U_LongLong n)
{
l_ () &= n.l_ ();
h_ () &= n.h_ ();
+
return *this;
}
+
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator&= (const ACE_UINT32 n)
{
return operator&= (static_cast<const ACE_U_LongLong> (n));
}
+
ACE_INLINE ACE_UINT32
ACE_U_LongLong::operator/ (const ACE_UINT32 n) const
{
@@ -716,8 +874,10 @@ ACE_U_LongLong::operator/ (const ACE_UINT32 n) const
// = ((0x100000000u - n) / n * hi_ + hi_ * n / n + lo_ / n
// = (0x100000000u - n) / n * hi_ + hi_ + lo_ / n
// = (0xffffffffu - n + 1) / n * hi_ + hi_ + lo_ / n
+
return (0xffffffffu - n + 1) / n * h_ () + h_ () + l_ () / n;
}
+
ACE_INLINE ACE_UINT32
ACE_U_LongLong::operator% (const ACE_UINT32 n) const
{
@@ -728,55 +888,67 @@ ACE_U_LongLong::operator% (const ACE_UINT32 n) const
// = (0x100000000u % n * hi_ + lo_ % n) % n
// = ((0x100000000u - n) % n * hi_ + lo_ % n) % n
// = ((0xffffffffu - n + 1) % n * hi_ + lo_ % n) % n
+
return ((0xffffffff - n + 1) % n * h_ () + l_ () % n) % n;
}
+
ACE_INLINE ACE_UINT32
ACE_U_LongLong::operator| (const ACE_INT32 n) const
{
return l_ () | n;
}
+
ACE_INLINE ACE_UINT32
ACE_U_LongLong::operator& (const ACE_INT32 n) const
{
return l_ () & n;
}
+
ACE_INLINE ACE_U_LongLong
ACE_U_LongLong::operator* (const ACE_INT32 n) const
{
return operator* ((ACE_UINT32) n);
}
+
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator*= (const ACE_INT32 n)
{
return operator*= ((ACE_UINT32) n);
}
+
ACE_INLINE ACE_UINT32
ACE_U_LongLong::operator/ (const ACE_INT32 n) const
{
return operator/ ((ACE_UINT32) n);
}
+
#if ACE_SIZEOF_INT == 4
ACE_INLINE ACE_UINT32
ACE_U_LongLong::operator/ (const u_long n) const
{
return operator/ ((ACE_UINT32) n);
}
+
ACE_INLINE ACE_UINT32
ACE_U_LongLong::operator/ (const long n) const
{
return operator/ ((ACE_UINT32) n);
}
+
#else /* ACE_SIZEOF_INT != 4 */
ACE_INLINE ACE_UINT32
ACE_U_LongLong::operator/ (const u_int n) const
{
return operator/ ((ACE_UINT32) n);
}
+
ACE_INLINE ACE_UINT32
ACE_U_LongLong::operator/ (const int n) const
{
return operator/ ((ACE_UINT32) n);
}
#endif /* ACE_SIZEOF_INT != 4 */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_LACKS_LONGLONG_T || ACE_LACKS_UNSIGNEDLONGLONG_T */
diff --git a/dep/ACE_wrappers/ace/Bound_Ptr.h b/dep/ACE_wrappers/ace/Bound_Ptr.h
index 2bdf6f86291..16ea929002e 100644
--- a/dep/ACE_wrappers/ace/Bound_Ptr.h
+++ b/dep/ACE_wrappers/ace/Bound_Ptr.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Bound_Ptr.h
@@ -9,15 +10,22 @@
* @author Boris Kolpackov <boris@codesynthesis.com>
*/
//=============================================================================
+
#ifndef ACE_BOUND_PTR_H
#define ACE_BOUND_PTR_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Auto_Ptr.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Bound_Ptr_Counter
*
@@ -33,45 +41,61 @@ class ACE_Bound_Ptr_Counter
public:
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
ACE_Bound_Ptr_Counter (long init_obj_ref_count = 0);
~ACE_Bound_Ptr_Counter (void);
+
/// Create a ACE_Bound_Ptr_Counter<ACE_LOCK> and initialize the
/// reference count to indicate ownership by a strong pointer.
static ACE_Bound_Ptr_Counter<ACE_LOCK> *create_strong (void);
+
/// Increase both the object and counter reference counts and return
/// the new object reference count. A return value of -1 indicates
/// that the object has already been destroyed.
static long attach_strong (ACE_Bound_Ptr_Counter<ACE_LOCK> *counter);
+
/// Decreases both the object and counter reference counts and
/// deletes whichever has no more references. Returns the new object
/// reference count.
static long detach_strong (ACE_Bound_Ptr_Counter<ACE_LOCK> *counter);
+
/// Create a ACE_Bound_Ptr_Counter<ACE_LOCK> and initialize the
/// reference count to indicate no ownership.
static ACE_Bound_Ptr_Counter<ACE_LOCK> *create_weak (void);
+
/// Increase the counter reference count and return argument.
static void attach_weak (ACE_Bound_Ptr_Counter<ACE_LOCK> *counter);
+
/// Decreases the counter reference count and deletes the counter if
/// it has no more references.
static void detach_weak (ACE_Bound_Ptr_Counter<ACE_LOCK> *counter);
+
/// Determine whether the object has been deleted.
static bool object_was_deleted (ACE_Bound_Ptr_Counter<ACE_LOCK> *counter);
+
private:
+
/// Allocate a new ACE_Bound_Ptr_Counter<ACE_LOCK> instance,
/// returning NULL if it cannot be created.
static ACE_Bound_Ptr_Counter<ACE_LOCK> *internal_create (long init_obj_ref_count);
+
private:
+
/// Reference count of underlying object. Is set to -1 once the
/// object has been destroyed to indicate to all weak pointers that
/// it is no longer valid.
long obj_ref_count_;
+
/// Reference count of this counter.
long self_ref_count_;
+
/// Mutex variable to synchronize access to the reference counts.
ACE_LOCK lock_;
};
+
// Forward decl.
template <class X, class ACE_LOCK> class ACE_Weak_Bound_Ptr;
+
/**
* @class ACE_Strong_Bound_Ptr
*
@@ -91,13 +115,17 @@ public:
/// Constructor that initializes an ACE_Strong_Bound_Ptr to point to the
/// object \<p\> immediately.
explicit ACE_Strong_Bound_Ptr (X *p = 0);
+
/// Constructor that initializes an ACE_Strong_Bound_Ptr by stealing
/// ownership of an object from an auto_ptr.
explicit ACE_Strong_Bound_Ptr (auto_ptr<X> p);
+
/// Copy constructor binds @c this and @a r to the same object.
ACE_Strong_Bound_Ptr (const ACE_Strong_Bound_Ptr<X, ACE_LOCK> &r);
+
/// Constructor binds @c this and @a r to the same object.
ACE_Strong_Bound_Ptr (const ACE_Weak_Bound_Ptr<X, ACE_LOCK> &r);
+
/// Copy constructor binds @c this and @a r to the same object if
/// Y* can be implicitly converted to X*.
template <class Y>
@@ -110,12 +138,16 @@ public:
//
COUNTER::attach_strong (this->counter_);
}
+
/// Destructor.
~ACE_Strong_Bound_Ptr (void);
+
/// Assignment operator that binds @c this and @a r to the same object.
void operator = (const ACE_Strong_Bound_Ptr<X, ACE_LOCK> &r);
+
/// Assignment operator that binds @c this and @a r to the same object.
void operator = (const ACE_Weak_Bound_Ptr<X, ACE_LOCK> &r);
+
/// Assignment operator that binds @c this and @a r to the same object
/// if Y* can be implicitly converted to X*.
template <class Y>
@@ -125,7 +157,9 @@ public:
// This operator is temporarily defined here to increase our chances
// of being accepted by broken compilers.
//
+
// This will work if &r == this, by first increasing the ref count
+
COUNTER *new_counter = r.counter_;
X* new_ptr = dynamic_cast<X_t*> (r.ptr_);
COUNTER::attach_strong (new_counter);
@@ -133,8 +167,10 @@ public:
delete this->ptr_;
this->counter_ = new_counter;
this->ptr_ = new_ptr;
+
return *this;
}
+
/// Equality operator that returns @c true if both
/// ACE_Strong_Bound_Ptr instances point to the same underlying
/// object.
@@ -143,6 +179,7 @@ public:
* instantiated and not used yet.
*/
bool operator == (const ACE_Strong_Bound_Ptr<X, ACE_LOCK> &r) const;
+
/// Equality operator that returns true if the ACE_Strong_Bound_Ptr
/// and ACE_Weak_Bound_Ptr objects point to the same underlying
/// object.
@@ -151,46 +188,64 @@ public:
* instantiated and not used yet.
*/
bool operator == (const ACE_Weak_Bound_Ptr<X, ACE_LOCK> &r) const;
+
/// Equality operator that returns @c true if the
/// ACE_Strong_Bound_Ptr and the raw pointer point to the same
/// underlying object.
bool operator == (X *p) const;
+
/// Inequality operator, which is the opposite of equality.
bool operator != (const ACE_Strong_Bound_Ptr<X, ACE_LOCK> &r) const;
+
/// Inequality operator, which is the opposite of equality.
bool operator != (const ACE_Weak_Bound_Ptr<X, ACE_LOCK> &r) const;
+
/// Inequality operator, which is the opposite of equality.
bool operator != (X *p) const;
+
/// Redirection operator
X *operator-> (void) const;
+
/// Dereference operator
X &operator * (void) const;
+
/// Get the pointer value.
X *get (void) const;
+
/// Resets the ACE_Strong_Bound_Ptr to refer to a different
/// underlying object.
void reset (X *p = 0);
+
/// Resets the ACE_Strong_Bound_Ptr to refer to a different
/// underlying object, ownership of which is stolen from the
/// auto_ptr.
void reset (auto_ptr<X> p);
+
/// Allows us to check for NULL on all ACE_Strong_Bound_Ptr
/// objects.
int null (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
typedef X X_t; // This indirection is for Borland C++.
+
friend class ACE_Weak_Bound_Ptr<X, ACE_LOCK>;
+
template <class Y, class L>
friend class ACE_Strong_Bound_Ptr;
+
/// The ACE_Bound_Ptr_Counter type.
typedef ACE_Bound_Ptr_Counter<ACE_LOCK> COUNTER;
+
/// The reference counter.
COUNTER *counter_;
+
/// The underlying object.
X *ptr_;
};
+
/**
* @class ACE_Weak_Bound_Ptr
*
@@ -214,16 +269,22 @@ public:
/// Constructor that initializes an ACE_Weak_Bound_Ptr to point to
/// the object \<p\> immediately.
explicit ACE_Weak_Bound_Ptr (X *p = 0);
+
/// Copy constructor binds @c this and @a r to the same object.
ACE_Weak_Bound_Ptr (const ACE_Weak_Bound_Ptr<X, ACE_LOCK> &r);
+
/// Constructor binds @c this and @a r to the same object.
ACE_Weak_Bound_Ptr (const ACE_Strong_Bound_Ptr<X, ACE_LOCK> &r);
+
/// Destructor.
~ACE_Weak_Bound_Ptr (void);
+
/// Assignment operator that binds @c this and @a r to the same object.
void operator = (const ACE_Weak_Bound_Ptr<X, ACE_LOCK> &r);
+
/// Assignment operator that binds @c this and @a r to the same object.
void operator = (const ACE_Strong_Bound_Ptr<X, ACE_LOCK> &r);
+
/// Equality operator that returns @c true if both
/// ACE_Weak_Bound_Ptr objects point to the same underlying object.
/**
@@ -231,6 +292,7 @@ public:
* instantiated and not used yet.
*/
bool operator == (const ACE_Weak_Bound_Ptr<X, ACE_LOCK> &r) const;
+
/// Equality operator that returns @c true if the ACE_Weak_Bound_Ptr
/// and ACE_Strong_Bound_Ptr objects point to the same underlying
/// object.
@@ -239,15 +301,20 @@ public:
* instantiated and not used yet.
*/
bool operator == (const ACE_Strong_Bound_Ptr<X, ACE_LOCK> &r) const;
+
/// Equality operator that returns @c true if the ACE_Weak_Bound_Ptr
/// and the raw pointer point to the same underlying object.
bool operator == (X *p) const;
+
/// Inequality operator, which is the opposite of equality.
bool operator != (const ACE_Weak_Bound_Ptr<X, ACE_LOCK> &r) const;
+
/// Inequality operator, which is the opposite of equality.
bool operator != (const ACE_Strong_Bound_Ptr<X, ACE_LOCK> &r) const;
+
/// Inequality operator, which is the opposite of equality.
bool operator != (X *p) const;
+
/// Redirection operator.
/**
* It returns a temporary strong pointer and makes use of the
@@ -257,17 +324,21 @@ public:
* the locking overhead, then use the unsafe_get method instead.
*/
ACE_Strong_Bound_Ptr<X, ACE_LOCK> operator-> (void) const;
+
/// Obtain a strong pointer corresponding to this weak pointer. This
/// function is useful to create a temporary strong pointer for
/// conversion to a reference.
ACE_Strong_Bound_Ptr<X, ACE_LOCK> strong (void) const;
+
/// Get the pointer value. Warning: this does not affect the
/// reference count of the underlying object, so it may disappear on
/// you while you are using it if you are not careful.
X *unsafe_get (void) const;
+
/// Resets the ACE_Weak_Bound_Ptr to refer to a different underlying
/// object.
void reset (X *p = 0);
+
/// Increment the reference count on the underlying object.
/**
* Returns the new reference count on the object. This function may
@@ -276,6 +347,7 @@ public:
* servants.
*/
long add_ref (void);
+
/// Decrement the reference count on the underlying object, which is deleted
/// if the count has reached zero.
/**
@@ -285,22 +357,33 @@ public:
* servants.
*/
long remove_ref (void);
+
/// Allows us to check for NULL on all ACE_Weak_Bound_Ptr objects.
int null (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
typedef X X_t; // This indirection is for Borland C++.
+
friend class ACE_Strong_Bound_Ptr<X, ACE_LOCK>;
+
/// The ACE_Bound_Ptr_Counter type.
typedef ACE_Bound_Ptr_Counter<ACE_LOCK> COUNTER;
+
/// The reference counter.
COUNTER *counter_;
+
/// The underlying object.
X *ptr_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include "ace/Bound_Ptr.inl"
+
#include /**/ "ace/post.h"
+
#endif /* ACE_BOUND_PTR_H */
diff --git a/dep/ACE_wrappers/ace/Bound_Ptr.inl b/dep/ACE_wrappers/ace/Bound_Ptr.inl
index 03a8a5849b3..540a5516eab 100644
--- a/dep/ACE_wrappers/ace/Bound_Ptr.inl
+++ b/dep/ACE_wrappers/ace/Bound_Ptr.inl
@@ -1,11 +1,15 @@
/* -*- C++ -*- */
// $Id: Bound_Ptr.inl 80826 2008-03-04 14:51:23Z wotte $
+
// Bound_Ptr.i
+
#include "ace/Guard_T.h"
#if !defined (ACE_NEW_THROWS_EXCEPTIONS)
# include "ace/Log_Msg.h"
#endif /* ACE_NEW_THROWS_EXCEPTIONS */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template <class ACE_LOCK> inline ACE_Bound_Ptr_Counter<ACE_LOCK> *
ACE_Bound_Ptr_Counter<ACE_LOCK>::internal_create (long init_obj_ref_count)
{
@@ -15,6 +19,7 @@ ACE_Bound_Ptr_Counter<ACE_LOCK>::internal_create (long init_obj_ref_count)
0);
return temp;
}
+
template <class ACE_LOCK> inline ACE_Bound_Ptr_Counter<ACE_LOCK> *
ACE_Bound_Ptr_Counter<ACE_LOCK>::create_strong (void)
{
@@ -29,43 +34,57 @@ ACE_Bound_Ptr_Counter<ACE_LOCK>::create_strong (void)
return temp;
}
+
+
template <class ACE_LOCK> inline long
ACE_Bound_Ptr_Counter<ACE_LOCK>::attach_strong (ACE_Bound_Ptr_Counter<ACE_LOCK>* counter)
{
ACE_GUARD_RETURN (ACE_LOCK, guard, counter->lock_, -1);
+
// Can't attach a strong pointer to an object that has already been deleted.
if (counter->obj_ref_count_ == -1)
return -1;
+
long new_obj_ref_count = ++counter->obj_ref_count_;
++counter->self_ref_count_;
+
return new_obj_ref_count;
}
+
template <class ACE_LOCK> inline long
ACE_Bound_Ptr_Counter<ACE_LOCK>::detach_strong (ACE_Bound_Ptr_Counter<ACE_LOCK>* counter)
{
ACE_Bound_Ptr_Counter<ACE_LOCK> *counter_del = 0;
long new_obj_ref_count;
+
{
ACE_GUARD_RETURN (ACE_LOCK, guard, counter->lock_, -1);
+
if ((new_obj_ref_count = --counter->obj_ref_count_) == 0)
// Change the object reference count to -1 to indicate that the
// object has been deleted, as opposed to a weak pointer that
// simply hasn't had any strong pointers created from it yet.
counter->obj_ref_count_ = -1;
+
if (--counter->self_ref_count_ == 0)
// Since counter contains the lock held by the ACE_Guard, the
// guard needs to be released before freeing the memory holding
// the lock. So save the pointer to free, then release, then
// free.
counter_del = counter;
+
} // Release the lock
+
delete counter_del;
+
return new_obj_ref_count;
}
+
template <class ACE_LOCK> inline ACE_Bound_Ptr_Counter<ACE_LOCK> *
ACE_Bound_Ptr_Counter<ACE_LOCK>::create_weak (void)
{
// Set initial object reference count to 0.
+
ACE_Bound_Ptr_Counter<ACE_LOCK> *temp = internal_create (0);
#if defined (ACE_NEW_THROWS_EXCEPTIONS)
if (temp == 0)
@@ -75,55 +94,69 @@ ACE_Bound_Ptr_Counter<ACE_LOCK>::create_weak (void)
#endif /* ACE_NEW_THROWS_EXCEPTIONS */
return temp;
}
+
template <class ACE_LOCK> inline void
ACE_Bound_Ptr_Counter<ACE_LOCK>::attach_weak (ACE_Bound_Ptr_Counter<ACE_LOCK>* counter)
{
ACE_GUARD (ACE_LOCK, guard, counter->lock_);
+
++counter->self_ref_count_;
}
+
template <class ACE_LOCK> inline void
ACE_Bound_Ptr_Counter<ACE_LOCK>::detach_weak (ACE_Bound_Ptr_Counter<ACE_LOCK>* counter)
{
ACE_Bound_Ptr_Counter<ACE_LOCK> *counter_del = 0;
+
{
ACE_GUARD (ACE_LOCK, guard, counter->lock_);
+
if (--counter->self_ref_count_ == 0)
// Since counter contains the lock held by the ACE_Guard, the
// guard needs to be released before freeing the memory holding
// the lock. So save the pointer to free, then release, then
// free.
counter_del = counter;
+
} // Release the lock
+
delete counter_del;
}
+
template <class ACE_LOCK> inline bool
ACE_Bound_Ptr_Counter<ACE_LOCK>::object_was_deleted (ACE_Bound_Ptr_Counter<ACE_LOCK> *counter)
{
ACE_GUARD_RETURN (ACE_LOCK, guard, counter->lock_, 0);
+
return counter->obj_ref_count_ == -1;
}
+
template <class ACE_LOCK> inline
ACE_Bound_Ptr_Counter<ACE_LOCK>::ACE_Bound_Ptr_Counter (long init_obj_ref_count)
: obj_ref_count_ (init_obj_ref_count),
self_ref_count_ (1)
{
}
+
template <class ACE_LOCK> inline
ACE_Bound_Ptr_Counter<ACE_LOCK>::~ACE_Bound_Ptr_Counter (void)
{
}
+
template <class X, class ACE_LOCK> inline
ACE_Strong_Bound_Ptr<X, ACE_LOCK>::ACE_Strong_Bound_Ptr (X *p)
: counter_ (COUNTER::create_strong ()),
ptr_ (p)
{
}
+
template <class X, class ACE_LOCK> inline
ACE_Strong_Bound_Ptr<X, ACE_LOCK>::ACE_Strong_Bound_Ptr (auto_ptr<X> p)
: counter_ (COUNTER::create_strong ()),
ptr_ (p.release())
{
}
+
template <class X, class ACE_LOCK> inline
ACE_Strong_Bound_Ptr<X, ACE_LOCK>::ACE_Strong_Bound_Ptr (const ACE_Strong_Bound_Ptr<X, ACE_LOCK> &r)
: counter_ (r.counter_),
@@ -131,6 +164,7 @@ ACE_Strong_Bound_Ptr<X, ACE_LOCK>::ACE_Strong_Bound_Ptr (const ACE_Strong_Bound_
{
COUNTER::attach_strong (this->counter_);
}
+
template <class X, class ACE_LOCK> inline
ACE_Strong_Bound_Ptr<X, ACE_LOCK>::ACE_Strong_Bound_Ptr (const ACE_Weak_Bound_Ptr<X, ACE_LOCK> &r)
: counter_ (r.counter_),
@@ -146,12 +180,14 @@ ACE_Strong_Bound_Ptr<X, ACE_LOCK>::ACE_Strong_Bound_Ptr (const ACE_Weak_Bound_Pt
this->ptr_ = 0;
}
}
+
template <class X, class ACE_LOCK> inline
ACE_Strong_Bound_Ptr<X, ACE_LOCK>::~ACE_Strong_Bound_Ptr (void)
{
if (COUNTER::detach_strong (this->counter_) == 0)
delete this->ptr_;
}
+
template <class X, class ACE_LOCK> inline void
ACE_Strong_Bound_Ptr<X, ACE_LOCK>::operator = (const ACE_Strong_Bound_Ptr<X, ACE_LOCK> &rhs)
{
@@ -159,6 +195,7 @@ ACE_Strong_Bound_Ptr<X, ACE_LOCK>::operator = (const ACE_Strong_Bound_Ptr<X, ACE
// why go through all that?
if (&rhs == this)
return;
+
COUNTER *new_counter = rhs.counter_;
X_t *new_ptr = rhs.ptr_;
COUNTER::attach_strong (new_counter);
@@ -167,6 +204,7 @@ ACE_Strong_Bound_Ptr<X, ACE_LOCK>::operator = (const ACE_Strong_Bound_Ptr<X, ACE
this->counter_ = new_counter;
this->ptr_ = new_ptr;
}
+
template <class X, class ACE_LOCK> inline void
ACE_Strong_Bound_Ptr<X, ACE_LOCK>::operator = (const ACE_Weak_Bound_Ptr<X, ACE_LOCK> &rhs)
{
@@ -174,8 +212,10 @@ ACE_Strong_Bound_Ptr<X, ACE_LOCK>::operator = (const ACE_Weak_Bound_Ptr<X, ACE_L
// why go through all that?
if (&rhs == this)
return;
+
COUNTER *new_counter = rhs.counter_;
X_t *new_ptr = rhs.ptr_;
+
// When creating a strong pointer from a weak one we can't assume that the
// underlying object still exists. Therefore we must check for a return value
// of -1, which indicates that the object has been destroyed.
@@ -185,63 +225,75 @@ ACE_Strong_Bound_Ptr<X, ACE_LOCK>::operator = (const ACE_Weak_Bound_Ptr<X, ACE_L
new_counter = COUNTER::create_strong ();
new_ptr = 0;
}
+
if (COUNTER::detach_strong (this->counter_) == 0)
delete this->ptr_;
this->counter_ = new_counter;
this->ptr_ = new_ptr;
}
+
template <class X, class ACE_LOCK> inline bool
ACE_Strong_Bound_Ptr<X, ACE_LOCK>::operator== (const ACE_Strong_Bound_Ptr<X, ACE_LOCK> &r) const
{
return this->ptr_ == r.ptr_;
}
+
template <class X, class ACE_LOCK> inline bool
ACE_Strong_Bound_Ptr<X, ACE_LOCK>::operator== (const ACE_Weak_Bound_Ptr<X, ACE_LOCK> &r) const
{
// Use the weak pointer's operator== since it will check for null.
return r == *this;
}
+
template <class X, class ACE_LOCK> inline bool
ACE_Strong_Bound_Ptr<X, ACE_LOCK>::operator== (X *p) const
{
return this->ptr_ == p;
}
+
template <class X, class ACE_LOCK> inline bool
ACE_Strong_Bound_Ptr<X, ACE_LOCK>::operator!= (const ACE_Strong_Bound_Ptr<X, ACE_LOCK> &r) const
{
return this->ptr_ != r.ptr_;
}
+
template <class X, class ACE_LOCK> inline bool
ACE_Strong_Bound_Ptr<X, ACE_LOCK>::operator!= (const ACE_Weak_Bound_Ptr<X, ACE_LOCK> &r) const
{
// Use the weak pointer's operator!= since it will check for null.
return r != *this;
}
+
template <class X, class ACE_LOCK> inline bool
ACE_Strong_Bound_Ptr<X, ACE_LOCK>::operator!= (X *p) const
{
return this->ptr_ != p;
}
+
template <class X, class ACE_LOCK> inline X *
ACE_Strong_Bound_Ptr<X, ACE_LOCK>::operator-> (void) const
{
return this->ptr_;
}
+
template<class X, class ACE_LOCK> inline X &
ACE_Strong_Bound_Ptr<X, ACE_LOCK>::operator *() const
{
return *this->ptr_;
}
+
template <class X, class ACE_LOCK> inline X*
ACE_Strong_Bound_Ptr<X, ACE_LOCK>::get (void) const
{
return this->ptr_;
}
+
template <class X, class ACE_LOCK> inline int
ACE_Strong_Bound_Ptr<X, ACE_LOCK>::null (void) const
{
return this->ptr_ == 0;
}
+
template<class X, class ACE_LOCK> inline void
ACE_Strong_Bound_Ptr<X, ACE_LOCK>::reset (X *p)
{
@@ -252,6 +304,7 @@ ACE_Strong_Bound_Ptr<X, ACE_LOCK>::reset (X *p)
if (COUNTER::detach_strong (old_counter) == 0)
delete old_ptr;
}
+
template<class X, class ACE_LOCK> inline void
ACE_Strong_Bound_Ptr<X, ACE_LOCK>::reset (auto_ptr<X> p)
{
@@ -262,12 +315,14 @@ ACE_Strong_Bound_Ptr<X, ACE_LOCK>::reset (auto_ptr<X> p)
if (COUNTER::detach_strong (old_counter) == 0)
delete old_ptr;
}
+
template <class X, class ACE_LOCK> inline
ACE_Weak_Bound_Ptr<X, ACE_LOCK>::ACE_Weak_Bound_Ptr (X *p)
: counter_ (COUNTER::create_weak ()),
ptr_ (p)
{
}
+
template <class X, class ACE_LOCK> inline
ACE_Weak_Bound_Ptr<X, ACE_LOCK>::ACE_Weak_Bound_Ptr (const ACE_Weak_Bound_Ptr<X, ACE_LOCK> &r)
: counter_ (r.counter_),
@@ -275,6 +330,7 @@ ACE_Weak_Bound_Ptr<X, ACE_LOCK>::ACE_Weak_Bound_Ptr (const ACE_Weak_Bound_Ptr<X,
{
COUNTER::attach_weak (this->counter_);
}
+
template <class X, class ACE_LOCK> inline
ACE_Weak_Bound_Ptr<X, ACE_LOCK>::ACE_Weak_Bound_Ptr (const ACE_Strong_Bound_Ptr<X, ACE_LOCK> &r)
: counter_ (r.counter_),
@@ -282,11 +338,13 @@ ACE_Weak_Bound_Ptr<X, ACE_LOCK>::ACE_Weak_Bound_Ptr (const ACE_Strong_Bound_Ptr<
{
COUNTER::attach_weak (this->counter_);
}
+
template <class X, class ACE_LOCK> inline
ACE_Weak_Bound_Ptr<X, ACE_LOCK>::~ACE_Weak_Bound_Ptr (void)
{
COUNTER::detach_weak (this->counter_);
}
+
template <class X, class ACE_LOCK> inline void
ACE_Weak_Bound_Ptr<X, ACE_LOCK>::operator = (const ACE_Weak_Bound_Ptr<X, ACE_LOCK> &rhs)
{
@@ -297,6 +355,7 @@ ACE_Weak_Bound_Ptr<X, ACE_LOCK>::operator = (const ACE_Weak_Bound_Ptr<X, ACE_LOC
this->counter_ = new_counter;
this->ptr_ = rhs.ptr_;
}
+
template <class X, class ACE_LOCK> inline void
ACE_Weak_Bound_Ptr<X, ACE_LOCK>::operator = (const ACE_Strong_Bound_Ptr<X, ACE_LOCK> &rhs)
{
@@ -307,6 +366,7 @@ ACE_Weak_Bound_Ptr<X, ACE_LOCK>::operator = (const ACE_Strong_Bound_Ptr<X, ACE_L
this->counter_ = new_counter;
this->ptr_ = rhs.ptr_;
}
+
template <class X, class ACE_LOCK> inline bool
ACE_Weak_Bound_Ptr<X, ACE_LOCK>::operator== (const ACE_Weak_Bound_Ptr<X, ACE_LOCK> &r) const
{
@@ -314,8 +374,10 @@ ACE_Weak_Bound_Ptr<X, ACE_LOCK>::operator== (const ACE_Weak_Bound_Ptr<X, ACE_LOC
// if the underlying object has been deleted.
if (COUNTER::object_was_deleted (this->counter_))
return r.ptr_ == 0;
+
return this->ptr_ == r.ptr_;
}
+
template <class X, class ACE_LOCK> inline bool
ACE_Weak_Bound_Ptr<X, ACE_LOCK>::operator== (const ACE_Strong_Bound_Ptr<X, ACE_LOCK> &r) const
{
@@ -323,8 +385,10 @@ ACE_Weak_Bound_Ptr<X, ACE_LOCK>::operator== (const ACE_Strong_Bound_Ptr<X, ACE_L
// if the underlying object has been deleted.
if (COUNTER::object_was_deleted (this->counter_))
return r.ptr_ == 0;
+
return this->ptr_ == r.ptr_;
}
+
template <class X, class ACE_LOCK> inline bool
ACE_Weak_Bound_Ptr<X, ACE_LOCK>::operator== (X *p) const
{
@@ -332,8 +396,10 @@ ACE_Weak_Bound_Ptr<X, ACE_LOCK>::operator== (X *p) const
// if the underlying object has been deleted.
if (COUNTER::object_was_deleted (this->counter_))
return p == 0;
+
return this->ptr_ == p;
}
+
template <class X, class ACE_LOCK> inline bool
ACE_Weak_Bound_Ptr<X, ACE_LOCK>::operator!= (const ACE_Weak_Bound_Ptr<X, ACE_LOCK> &r) const
{
@@ -341,8 +407,10 @@ ACE_Weak_Bound_Ptr<X, ACE_LOCK>::operator!= (const ACE_Weak_Bound_Ptr<X, ACE_LOC
// if the underlying object has been deleted.
if (COUNTER::object_was_deleted (this->counter_))
return r.ptr_ != 0;
+
return this->ptr_ != r.ptr_;
}
+
template <class X, class ACE_LOCK> inline bool
ACE_Weak_Bound_Ptr<X, ACE_LOCK>::operator!= (const ACE_Strong_Bound_Ptr<X, ACE_LOCK> &r) const
{
@@ -350,8 +418,10 @@ ACE_Weak_Bound_Ptr<X, ACE_LOCK>::operator!= (const ACE_Strong_Bound_Ptr<X, ACE_L
// if the underlying object has been deleted.
if (COUNTER::object_was_deleted (this->counter_))
return r.ptr_ != 0;
+
return this->ptr_ != r.ptr_;
}
+
template <class X, class ACE_LOCK> inline bool
ACE_Weak_Bound_Ptr<X, ACE_LOCK>::operator!= (X *p) const
{
@@ -359,18 +429,22 @@ ACE_Weak_Bound_Ptr<X, ACE_LOCK>::operator!= (X *p) const
// if the underlying object has been deleted.
if (COUNTER::object_was_deleted (this->counter_))
return p != 0;
+
return this->ptr_ != p;
}
+
template <class X, class ACE_LOCK> inline ACE_Strong_Bound_Ptr<X, ACE_LOCK>
ACE_Weak_Bound_Ptr<X, ACE_LOCK>::operator-> (void) const
{
return ACE_Strong_Bound_Ptr<X, ACE_LOCK> (*this);
}
+
template <class X, class ACE_LOCK> inline ACE_Strong_Bound_Ptr<X, ACE_LOCK>
ACE_Weak_Bound_Ptr<X, ACE_LOCK>::strong (void) const
{
return ACE_Strong_Bound_Ptr<X, ACE_LOCK> (*this);
}
+
template <class X, class ACE_LOCK> inline X*
ACE_Weak_Bound_Ptr<X, ACE_LOCK>::unsafe_get (void) const
{
@@ -378,6 +452,7 @@ ACE_Weak_Bound_Ptr<X, ACE_LOCK>::unsafe_get (void) const
// is defined to be unsafe!
return this->ptr_;
}
+
template <class X, class ACE_LOCK> inline int
ACE_Weak_Bound_Ptr<X, ACE_LOCK>::null (void) const
{
@@ -385,8 +460,10 @@ ACE_Weak_Bound_Ptr<X, ACE_LOCK>::null (void) const
// if the underlying object has been deleted.
if (COUNTER::object_was_deleted (this->counter_))
return 1;
+
return this->ptr_ == 0;
}
+
template<class X, class ACE_LOCK> inline void
ACE_Weak_Bound_Ptr<X, ACE_LOCK>::reset (X *p)
{
@@ -395,11 +472,13 @@ ACE_Weak_Bound_Ptr<X, ACE_LOCK>::reset (X *p)
this->ptr_ = p;
COUNTER::detach_weak (old_counter);
}
+
template<class X, class ACE_LOCK> inline long
ACE_Weak_Bound_Ptr<X, ACE_LOCK>::add_ref ()
{
return COUNTER::attach_strong (counter_);
}
+
template<class X, class ACE_LOCK> inline long
ACE_Weak_Bound_Ptr<X, ACE_LOCK>::remove_ref ()
{
@@ -411,4 +490,5 @@ ACE_Weak_Bound_Ptr<X, ACE_LOCK>::remove_ref ()
}
return new_obj_ref_count;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/CDR_Base.cpp b/dep/ACE_wrappers/ace/CDR_Base.cpp
index 40ea4936f2f..e7647006b65 100644
--- a/dep/ACE_wrappers/ace/CDR_Base.cpp
+++ b/dep/ACE_wrappers/ace/CDR_Base.cpp
@@ -1,27 +1,36 @@
#include "ace/CDR_Base.h"
+
#if !defined (__ACE_INLINE__)
# include "ace/CDR_Base.inl"
#endif /* ! __ACE_INLINE__ */
+
#include "ace/Message_Block.h"
#include "ace/OS_Memory.h"
#include "ace/OS_NS_string.h"
+
ACE_RCSID (ace,
CDR_Base,
"$Id: CDR_Base.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
#if defined (NONNATIVE_LONGDOUBLE)
static const ACE_INT16 max_eleven_bit = 0x3ff;
static const ACE_INT16 max_fifteen_bit = 0x3fff;
#endif /* NONNATIVE_LONGDOUBLE */
+
//
// See comments in CDR_Base.inl about optimization cases for swap_XX_array.
//
+
void
ACE_CDR::swap_2_array (char const * orig, char* target, size_t n)
{
// ACE_ASSERT(n > 0); The caller checks that n > 0
+
// We pretend that AMD64/GNU G++ systems have a Pentium CPU to
// take advantage of the inline assembly implementation.
+
// Later, we try to read in 32 or 64 bit chunks,
// so make sure we don't do that for unaligned addresses.
#if ACE_SIZEOF_LONG == 8 && \
@@ -47,14 +56,17 @@ ACE_CDR::swap_2_array (char const * orig, char* target, size_t n)
#endif
if (n == 0)
return;
+
//
// Loop unrolling. Here be dragons.
//
+
// (n & (~3)) is the greatest multiple of 4 not bigger than n.
// In the while loop ahead, orig will move over the array by 8 byte
// increments (4 elements of 2 bytes).
// end marks our barrier for not falling outside.
char const * const end = orig + 2 * (n & (~3));
+
// See if we're aligned for writting in 64 or 32 bit chunks...
#if ACE_SIZEOF_LONG == 8 && \
!((defined(__amd64__) || defined (__x86_64__)) && defined(__GNUG__))
@@ -93,21 +105,27 @@ ACE_CDR::swap_2_array (char const * orig, char* target, size_t n)
// 64 bit architecture.
register unsigned long a =
* reinterpret_cast<const unsigned long*> (orig);
+
register unsigned long a1 = (a & 0x00ff00ff00ff00ffUL) << 8;
register unsigned long a2 = (a & 0xff00ff00ff00ff00UL) >> 8;
+
a = (a1 | a2);
+
* reinterpret_cast<unsigned long*> (target) = a;
#else
register ACE_UINT32 a =
* reinterpret_cast<const ACE_UINT32*> (orig);
register ACE_UINT32 b =
* reinterpret_cast<const ACE_UINT32*> (orig + 4);
+
register ACE_UINT32 a1 = (a & 0x00ff00ffU) << 8;
register ACE_UINT32 b1 = (b & 0x00ff00ffU) << 8;
register ACE_UINT32 a2 = (a & 0xff00ff00U) >> 8;
register ACE_UINT32 b2 = (b & 0xff00ff00U) >> 8;
+
a = (a1 | a2);
b = (b1 | b2);
+
* reinterpret_cast<ACE_UINT32*> (target) = a;
* reinterpret_cast<ACE_UINT32*> (target + 4) = b;
#endif
@@ -158,13 +176,17 @@ ACE_CDR::swap_2_array (char const * orig, char* target, size_t n)
// 64 bit architecture.
register unsigned long a =
* reinterpret_cast<const unsigned long*> (orig);
+
register unsigned long a1 = (a & 0x00ff00ff00ff00ffUL) << 8;
register unsigned long a2 = (a & 0xff00ff00ff00ff00UL) >> 8;
+
a = (a1 | a2);
+
ACE_UINT16 b1 = static_cast<ACE_UINT16> (a >> 48);
ACE_UINT16 b2 = static_cast<ACE_UINT16> ((a >> 32) & 0xffff);
ACE_UINT16 b3 = static_cast<ACE_UINT16> ((a >> 16) & 0xffff);
ACE_UINT16 b4 = static_cast<ACE_UINT16> (a & 0xffff);
+
#if defined(ACE_LITTLE_ENDIAN)
* reinterpret_cast<ACE_UINT16*> (target) = b4;
* reinterpret_cast<ACE_UINT16*> (target + 2) = b3;
@@ -181,16 +203,20 @@ ACE_CDR::swap_2_array (char const * orig, char* target, size_t n)
* reinterpret_cast<const ACE_UINT32*> (orig);
register ACE_UINT32 b =
* reinterpret_cast<const ACE_UINT32*> (orig + 4);
+
register ACE_UINT32 a1 = (a & 0x00ff00ff) << 8;
register ACE_UINT32 b1 = (b & 0x00ff00ff) << 8;
register ACE_UINT32 a2 = (a & 0xff00ff00) >> 8;
register ACE_UINT32 b2 = (b & 0xff00ff00) >> 8;
+
a = (a1 | a2);
b = (b1 | b2);
+
ACE_UINT32 c1 = static_cast<ACE_UINT16> (a >> 16);
ACE_UINT32 c2 = static_cast<ACE_UINT16> (a & 0xffff);
ACE_UINT32 c3 = static_cast<ACE_UINT16> (b >> 16);
ACE_UINT32 c4 = static_cast<ACE_UINT16> (b & 0xffff);
+
#if defined(ACE_LITTLE_ENDIAN)
* reinterpret_cast<ACE_UINT16*> (target) = c2;
* reinterpret_cast<ACE_UINT16*> (target + 2) = c1;
@@ -203,10 +229,12 @@ ACE_CDR::swap_2_array (char const * orig, char* target, size_t n)
* reinterpret_cast<ACE_UINT16*> (target + 6) = c4;
#endif
#endif
+
orig += 8;
target += 8;
}
}
+
// (n & 3) == (n % 4).
switch (n&3) {
case 3:
@@ -221,10 +249,12 @@ ACE_CDR::swap_2_array (char const * orig, char* target, size_t n)
ACE_CDR::swap_2 (orig, target);
}
}
+
void
ACE_CDR::swap_4_array (char const * orig, char* target, size_t n)
{
// ACE_ASSERT (n > 0); The caller checks that n > 0
+
#if ACE_SIZEOF_LONG == 8
// Later, we read from *orig in 64 bit chunks,
// so make sure we don't generate unaligned readings.
@@ -238,16 +268,20 @@ ACE_CDR::swap_4_array (char const * orig, char* target, size_t n)
--n;
}
#endif /* ACE_SIZEOF_LONG == 8 */
+
if (n == 0)
return;
+
//
// Loop unrolling. Here be dragons.
//
+
// (n & (~3)) is the greatest multiple of 4 not bigger than n.
// In the while loop, orig will move over the array by 16 byte
// increments (4 elements of 4 bytes).
// ends marks our barrier for not falling outside.
char const * const end = orig + 4 * (n & (~3));
+
#if ACE_SIZEOF_LONG == 8
// 64 bits architecture.
// See if we can write in 8 byte chunks.
@@ -259,6 +293,7 @@ ACE_CDR::swap_4_array (char const * orig, char* target, size_t n)
* reinterpret_cast<const long*> (orig);
register unsigned long b =
* reinterpret_cast<const long*> (orig + 8);
+
#if defined(ACE_HAS_INTEL_ASSEMBLY)
asm ("bswapq %1" : "=r" (a) : "0" (a));
asm ("bswapq %1" : "=r" (b) : "0" (b));
@@ -273,11 +308,14 @@ ACE_CDR::swap_4_array (char const * orig, char* target, size_t n)
register unsigned long b62 = (b & 0x00ff000000ff0000L) >> 8;
register unsigned long a51 = (a & 0xff000000ff000000L) >> 24;
register unsigned long b51 = (b & 0xff000000ff000000L) >> 24;
+
a = (a84 | a73 | a62 | a51);
b = (b84 | b73 | b62 | b51);
#endif
+
* reinterpret_cast<long*> (target) = a;
* reinterpret_cast<long*> (target + 8) = b;
+
orig += 16;
target += 16;
}
@@ -291,6 +329,7 @@ ACE_CDR::swap_4_array (char const * orig, char* target, size_t n)
* reinterpret_cast<const long*> (orig);
register unsigned long b =
* reinterpret_cast<const long*> (orig + 8);
+
#if defined(ACE_HAS_INTEL_ASSEMBLY)
asm ("bswapq %1" : "=r" (a) : "0" (a));
asm ("bswapq %1" : "=r" (b) : "0" (b));
@@ -305,13 +344,16 @@ ACE_CDR::swap_4_array (char const * orig, char* target, size_t n)
register unsigned long b62 = (b & 0x00ff000000ff0000L) >> 8;
register unsigned long a51 = (a & 0xff000000ff000000L) >> 24;
register unsigned long b51 = (b & 0xff000000ff000000L) >> 24;
+
a = (a84 | a73 | a62 | a51);
b = (b84 | b73 | b62 | b51);
#endif
+
ACE_UINT32 c1 = static_cast<ACE_UINT32> (a >> 32);
ACE_UINT32 c2 = static_cast<ACE_UINT32> (a & 0xffffffff);
ACE_UINT32 c3 = static_cast<ACE_UINT32> (b >> 32);
ACE_UINT32 c4 = static_cast<ACE_UINT32> (b & 0xffffffff);
+
#if defined (ACE_LITTLE_ENDIAN)
* reinterpret_cast<ACE_UINT32*> (target + 0) = c2;
* reinterpret_cast<ACE_UINT32*> (target + 4) = c1;
@@ -327,7 +369,9 @@ ACE_CDR::swap_4_array (char const * orig, char* target, size_t n)
target += 16;
}
}
+
#else /* ACE_SIZEOF_LONG != 8 */
+
while (orig < end)
{
#if defined (ACE_HAS_PENTIUM) && defined (__GNUG__)
@@ -339,10 +383,12 @@ ACE_CDR::swap_4_array (char const * orig, char* target, size_t n)
*reinterpret_cast<const unsigned int*> (orig + 8);
register unsigned int d =
*reinterpret_cast<const unsigned int*> (orig + 12);
+
asm ("bswap %1" : "=r" (a) : "0" (a));
asm ("bswap %1" : "=r" (b) : "0" (b));
asm ("bswap %1" : "=r" (c) : "0" (c));
asm ("bswap %1" : "=r" (d) : "0" (d));
+
*reinterpret_cast<unsigned int*> (target) = a;
*reinterpret_cast<unsigned int*> (target + 4) = b;
*reinterpret_cast<unsigned int*> (target + 8) = c;
@@ -373,21 +419,26 @@ ACE_CDR::swap_4_array (char const * orig, char* target, size_t n)
* reinterpret_cast<const ACE_UINT32*> (orig + 8);
register ACE_UINT32 d =
* reinterpret_cast<const ACE_UINT32*> (orig + 12);
+
// Expect the optimizer reordering this A LOT.
// We leave it this way for clarity.
a = (a << 24) | ((a & 0xff00) << 8) | ((a & 0xff0000) >> 8) | (a >> 24);
b = (b << 24) | ((b & 0xff00) << 8) | ((b & 0xff0000) >> 8) | (b >> 24);
c = (c << 24) | ((c & 0xff00) << 8) | ((c & 0xff0000) >> 8) | (c >> 24);
d = (d << 24) | ((d & 0xff00) << 8) | ((d & 0xff0000) >> 8) | (d >> 24);
+
* reinterpret_cast<ACE_UINT32*> (target) = a;
* reinterpret_cast<ACE_UINT32*> (target + 4) = b;
* reinterpret_cast<ACE_UINT32*> (target + 8) = c;
* reinterpret_cast<ACE_UINT32*> (target + 12) = d;
#endif
+
orig += 16;
target += 16;
}
+
#endif /* ACE_SIZEOF_LONG == 8 */
+
// (n & 3) == (n % 4).
switch (n & 3) {
case 3:
@@ -402,6 +453,7 @@ ACE_CDR::swap_4_array (char const * orig, char* target, size_t n)
ACE_CDR::swap_4 (orig, target);
}
}
+
//
// We don't benefit from unrolling in swap_8_array and swap_16_array
// (swap_8 and swap_16 are big enough).
@@ -410,6 +462,7 @@ void
ACE_CDR::swap_8_array (char const * orig, char* target, size_t n)
{
// ACE_ASSERT(n > 0); The caller checks that n > 0
+
char const * const end = orig + 8*n;
while (orig < end)
{
@@ -418,10 +471,12 @@ ACE_CDR::swap_8_array (char const * orig, char* target, size_t n)
target += 8;
}
}
+
void
ACE_CDR::swap_16_array (char const * orig, char* target, size_t n)
{
// ACE_ASSERT(n > 0); The caller checks that n > 0
+
char const * const end = orig + 16*n;
while (orig < end)
{
@@ -430,6 +485,7 @@ ACE_CDR::swap_16_array (char const * orig, char* target, size_t n)
target += 16;
}
}
+
void
ACE_CDR::mb_align (ACE_Message_Block *mb)
{
@@ -442,34 +498,44 @@ ACE_CDR::mb_align (ACE_Message_Block *mb)
mb->rd_ptr (start);
mb->wr_ptr (start);
}
+
int
ACE_CDR::grow (ACE_Message_Block *mb, size_t minsize)
{
size_t newsize =
ACE_CDR::first_size (minsize + ACE_CDR::MAX_ALIGNMENT);
+
if (newsize <= mb->size ())
return 0;
+
ACE_Data_Block *db =
mb->data_block ()->clone_nocopy (0, newsize);
+
if (db == 0)
return -1;
+
// Do the equivalent of ACE_CDR::mb_align() here to avoid having
// to allocate an ACE_Message_Block on the stack thereby avoiding
// the manipulation of the data blocks reference count
size_t mb_len = mb->length ();
char *start = ACE_ptr_align_binary (db->base (),
ACE_CDR::MAX_ALIGNMENT);
+
ACE_OS::memcpy (start, mb->rd_ptr (), mb_len);
mb->data_block (db);
+
// Setting the data block on the mb resets the read and write
// pointers back to the beginning. We must set the rd_ptr to the
// aligned start and adjust the write pointer to the end
mb->rd_ptr (start);
mb->wr_ptr (start + mb_len);
+
// Remove the DONT_DELETE flags from mb
mb->clr_self_flags (ACE_Message_Block::DONT_DELETE);
+
return 0;
}
+
size_t
ACE_CDR::total_length (const ACE_Message_Block* begin,
const ACE_Message_Block* end)
@@ -482,16 +548,19 @@ ACE_CDR::total_length (const ACE_Message_Block* begin,
l += i->length ();
return l;
}
+
void
ACE_CDR::consolidate (ACE_Message_Block *dst,
const ACE_Message_Block *src)
{
if (src == 0)
return;
+
size_t newsize =
ACE_CDR::first_size (ACE_CDR::total_length (src, 0)
+ ACE_CDR::MAX_ALIGNMENT);
dst->size (newsize);
+
#if !defined (ACE_CDR_IGNORE_ALIGNMENT)
// We must copy the contents of <src> into the new buffer, but
// respecting the alignment.
@@ -505,6 +574,7 @@ ACE_CDR::consolidate (ACE_Message_Block *dst,
dst->rd_ptr (static_cast<size_t> (offset));
dst->wr_ptr (dst->rd_ptr ());
#endif /* ACE_CDR_IGNORE_ALIGNMENT */
+
for (const ACE_Message_Block* i = src;
i != 0;
i = i->cont ())
@@ -517,23 +587,28 @@ ACE_CDR::consolidate (ACE_Message_Block *dst,
dst->wr_ptr (i->length ());
}
}
+
#if defined (NONNATIVE_LONGLONG)
bool
ACE_CDR::LongLong::operator== (const ACE_CDR::LongLong &rhs) const
{
return this->h == rhs.h && this->l == rhs.l;
}
+
bool
ACE_CDR::LongLong::operator!= (const ACE_CDR::LongLong &rhs) const
{
return this->l != rhs.l || this->h != rhs.h;
}
+
#endif /* NONNATIVE_LONGLONG */
+
#if defined (NONNATIVE_LONGDOUBLE)
ACE_CDR::LongDouble&
ACE_CDR::LongDouble::assign (const ACE_CDR::LongDouble::NativeImpl& rhs)
{
ACE_OS::memset (this->ld, 0, sizeof (this->ld));
+
if (sizeof (rhs) == 8)
{
#if defined (ACE_LITTLE_ENDIAN)
@@ -551,6 +626,7 @@ ACE_CDR::LongDouble::assign (const ACE_CDR::LongDouble::NativeImpl& rhs)
ACE_INT16 exponent = ((rhs_ptr[0] & 0x7f) << 4) |
((rhs_ptr[1] >> 4) & 0xf);
const char* exp_ptr = reinterpret_cast<const char*> (&exponent);
+
// Infinity and NaN have an exponent of 0x7ff in 64-bit IEEE
if (exponent == 0x7ff)
{
@@ -561,9 +637,11 @@ ACE_CDR::LongDouble::assign (const ACE_CDR::LongDouble::NativeImpl& rhs)
exponent = (exponent - max_eleven_bit) + max_fifteen_bit;
}
exponent |= sign;
+
// Store the sign bit and exponent
this->ld[0] = exp_ptr[byte_zero];
this->ld[1] = exp_ptr[byte_one];
+
// Store the mantissa. In an 8 byte double, it is split by
// 4 bits (because of the 12 bits for sign and exponent), so
// we have to shift and or the rhs to get the right bytes.
@@ -596,6 +674,7 @@ ACE_CDR::LongDouble::assign (const ACE_CDR::LongDouble::NativeImpl& rhs)
}
return *this;
}
+
ACE_CDR::LongDouble&
ACE_CDR::LongDouble::assign (const ACE_CDR::LongDouble& rhs)
{
@@ -603,20 +682,24 @@ ACE_CDR::LongDouble::assign (const ACE_CDR::LongDouble& rhs)
*this = rhs;
return *this;
}
+
bool
ACE_CDR::LongDouble::operator== (const ACE_CDR::LongDouble &rhs) const
{
return ACE_OS::memcmp (this->ld, rhs.ld, 16) == 0;
}
+
bool
ACE_CDR::LongDouble::operator!= (const ACE_CDR::LongDouble &rhs) const
{
return ACE_OS::memcmp (this->ld, rhs.ld, 16) != 0;
}
+
ACE_CDR::LongDouble::operator ACE_CDR::LongDouble::NativeImpl () const
{
ACE_CDR::LongDouble::NativeImpl ret = 0.0;
char* lhs_ptr = reinterpret_cast<char*> (&ret);
+
if (sizeof (ret) == 8)
{
#if defined (ACE_LITTLE_ENDIAN)
@@ -633,8 +716,10 @@ ACE_CDR::LongDouble::operator ACE_CDR::LongDouble::NativeImpl () const
char* exp_ptr = reinterpret_cast<char*> (&exponent);
exp_ptr[byte_zero] = copy[0];
exp_ptr[byte_one] = copy[1];
+
ACE_INT16 sign = (exponent & 0x8000);
exponent &= 0x7fff;
+
// Infinity and NaN have an exponent of 0x7fff in 128-bit IEEE
if (exponent == 0x7fff)
{
@@ -645,9 +730,11 @@ ACE_CDR::LongDouble::operator ACE_CDR::LongDouble::NativeImpl () const
exponent = (exponent - max_fifteen_bit) + max_eleven_bit;
}
exponent = (exponent << 4) | sign;
+
// Store the sign and exponent
lhs_ptr[0] = exp_ptr[byte_zero];
lhs_ptr[1] = exp_ptr[byte_one];
+
// Store the mantissa. In an 8 byte double, it is split by
// 4 bits (because of the 12 bits for sign and exponent), so
// we have to shift and or the rhs to get the right bytes.
@@ -667,6 +754,7 @@ ACE_CDR::LongDouble::operator ACE_CDR::LongDouble::NativeImpl () const
++ri;
}
}
+
#if defined (ACE_LITTLE_ENDIAN)
ACE_CDR::swap_8 (lhs_ptr, lhs_ptr);
#endif
@@ -675,31 +763,38 @@ ACE_CDR::LongDouble::operator ACE_CDR::LongDouble::NativeImpl () const
{
ACE_OS::memcpy(lhs_ptr, this->ld, sizeof (ret));
}
+
// This bit of code is unnecessary. However, this code is
// necessary to work around a bug in the gcc 4.1.1 optimizer.
ACE_CDR::LongDouble tmp;
tmp.assign (ret);
+
return ret;
}
#endif /* NONNATIVE_LONGDOUBLE */
+
#if defined(_UNICOS) && !defined(_CRAYMPP)
// placeholders to get things compiling
ACE_CDR::Float::Float (void)
{
}
+
ACE_CDR::Float::Float (const float & /* init */)
{
}
+
ACE_CDR::Float &
ACE_CDR::Float::operator= (const float & /* rhs */)
{
return *this;
}
+
bool
ACE_CDR::Float::operator!= (const ACE_CDR::Float & /* rhs */) const
{
return false;
}
#endif /* _UNICOS */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/CDR_Base.h b/dep/ACE_wrappers/ace/CDR_Base.h
index 3d7ac40bd2e..c3b2e368514 100644
--- a/dep/ACE_wrappers/ace/CDR_Base.h
+++ b/dep/ACE_wrappers/ace/CDR_Base.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file CDR_Base.h
@@ -23,16 +24,23 @@
*/
//=============================================================================
+
#ifndef ACE_CDR_BASE_H
#define ACE_CDR_BASE_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Basic_Types.h"
#include "ace/Default_Constants.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Stuff used by the ACE CDR classes. Watch these values... they're also used
// in the ACE_CDR Byte_Order enum below.
#if defined ACE_LITTLE_ENDIAN
@@ -42,7 +50,9 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
# define ACE_CDR_BYTE_ORDER 0
// big endian encapsulation byte order has value = 0
#endif /* ! ACE_LITTLE_ENDIAN */
+
class ACE_Message_Block;
+
/**
* @class ACE_CDR
*
@@ -56,16 +66,19 @@ public:
// By defining as many of these constants as possible as enums we
// ensure they get inlined and avoid pointless static memory
// allocations.
+
enum
{
// Note that some of these get reused as part of the standard
// binary format: unsigned is the same size as its signed cousin,
// float is LONG_SIZE, and double is LONGLONG_SIZE.
+
OCTET_SIZE = 1,
SHORT_SIZE = 2,
LONG_SIZE = 4,
LONGLONG_SIZE = 8,
LONGDOUBLE_SIZE = 16,
+
OCTET_ALIGN = 1,
SHORT_ALIGN = 2,
LONG_ALIGN = 4,
@@ -73,9 +86,11 @@ public:
/// @note the CORBA LongDouble alignment requirements do not
/// match its size...
LONGDOUBLE_ALIGN = 8,
+
/// Maximal CDR 1.1 alignment: "quad precision" FP (i.e. "CDR::Long
/// double", size as above).
MAX_ALIGNMENT = 8,
+
/// The default buffer size.
/**
* @todo We want to add options to control this
@@ -83,14 +98,17 @@ public:
* default value ;-)
*/
DEFAULT_BUFSIZE = ACE_DEFAULT_CDR_BUFSIZE,
+
/// The buffer size grows exponentially until it reaches this size;
/// afterwards it grows linearly using the next constant
EXP_GROWTH_MAX = ACE_DEFAULT_CDR_EXP_GROWTH_MAX,
+
/// Once exponential growth is ruled out the buffer size increases
/// in chunks of this size, note that this constants have the same
/// value right now, but it does not need to be so.
LINEAR_GROWTH_CHUNK = ACE_DEFAULT_CDR_LINEAR_GROWTH_CHUNK
};
+
/**
* @enum Byte_Order
*
@@ -106,6 +124,7 @@ public:
/// Use whichever byte order is native to this machine.
BYTE_ORDER_NATIVE = ACE_CDR_BYTE_ORDER
};
+
/**
* Do byte swapping for each basic IDL type size. There exist only
* routines to put byte, halfword (2 bytes), word (4 bytes),
@@ -128,9 +147,11 @@ public:
static void swap_16_array (char const *orig,
char *target,
size_t length);
+
/// Align the message block to ACE_CDR::MAX_ALIGNMENT,
/// set by the CORBA spec at 8 bytes.
static void mb_align (ACE_Message_Block *mb);
+
/**
* Compute the size of the smallest buffer that can contain at least
* @a minsize bytes.
@@ -142,9 +163,11 @@ public:
* large value, but does not explode at the end.
*/
static size_t first_size (size_t minsize);
+
/// Compute not the smallest, but the second smallest buffer that
/// will fir @a minsize bytes.
static size_t next_size (size_t minsize);
+
/**
* Increase the capacity of mb to contain at least @a minsize bytes.
* If @a minsize is zero the size is increased by an amount at least
@@ -153,13 +176,16 @@ public:
* @retval 0 Success.
*/
static int grow (ACE_Message_Block *mb, size_t minsize);
+
/// Copy a message block chain into a single message block,
/// preserving the alignment of the first message block of the
/// original stream, not the following message blocks.
static void consolidate (ACE_Message_Block *dst,
const ACE_Message_Block *src);
+
static size_t total_length (const ACE_Message_Block *begin,
const ACE_Message_Block *end);
+
/**
* @name Basic OMG IDL Types
*
@@ -176,6 +202,7 @@ public:
typedef ACE_INT32 Long;
typedef ACE_UINT32 ULong;
typedef ACE_UINT64 ULongLong;
+
# if (defined (_MSC_VER)) || (defined (__BORLANDC__))
typedef __int64 LongLong;
# elif ACE_SIZEOF_LONG == 8 && !defined(_CRAYMPP)
@@ -203,6 +230,7 @@ public:
ACE_CDR::Long l;
ACE_CDR::Long h;
# endif /* ! ACE_BIG_ENDIAN */
+
/**
* @name Overloaded Relation Operators.
*
@@ -214,11 +242,13 @@ public:
//@}
};
# endif /* no native 64 bit integer type */
+
# if defined (NONNATIVE_LONGLONG)
# define ACE_CDR_LONGLONG_INITIALIZER {0,0}
# else
# define ACE_CDR_LONGLONG_INITIALIZER 0
# endif /* NONNATIVE_LONGLONG */
+
# if ACE_SIZEOF_FLOAT == 4
typedef float Float;
# else /* ACE_SIZEOF_FLOAT != 4 */
@@ -239,6 +269,7 @@ public:
# endif /* ACE_SIZEOF_INT != 4 */
};
# endif /* ACE_SIZEOF_FLOAT != 4 */
+
# if ACE_SIZEOF_DOUBLE == 8
typedef double Double;
# else /* ACE_SIZEOF_DOUBLE != 8 */
@@ -253,10 +284,12 @@ public:
# endif /* ACE_SIZEOF_INT != 8 */
};
# endif /* ACE_SIZEOF_DOUBLE != 8 */
+
// 94-9-32 Appendix A defines a 128 bit floating point "long
// double" data type, with greatly extended precision and four
// more bits of exponent (compared to "double"). This is an IDL
// extension, not yet standard.
+
# if ACE_SIZEOF_LONG_DOUBLE == 16
typedef long double LongDouble;
# define ACE_CDR_LONG_DOUBLE_INITIALIZER 0
@@ -281,11 +314,15 @@ public:
# else
typedef long double NativeImpl;
# endif /* ACE_CDR_IMPLEMENT_WITH_NATIVE_DOUBLE==1 */
+
char ld[16];
+
LongDouble& assign (const NativeImpl& rhs);
LongDouble& assign (const LongDouble& rhs);
+
bool operator== (const LongDouble &rhs) const;
bool operator!= (const LongDouble &rhs) const;
+
LongDouble& operator*= (const NativeImpl rhs) {
return this->assign (static_cast<NativeImpl> (*this) * rhs);
}
@@ -314,22 +351,30 @@ public:
this->assign (static_cast<NativeImpl> (*this) - 1);
return ldv;
}
+
operator NativeImpl () const;
};
# endif /* ACE_SIZEOF_LONG_DOUBLE != 16 */
+
//@}
+
#if !defined (ACE_CDR_GIOP_MAJOR_VERSION)
# define ACE_CDR_GIOP_MAJOR_VERSION 1
#endif /*ACE_CDR_GIOP_MAJOR_VERSION */
+
#if !defined (ACE_CDR_GIOP_MINOR_VERSION)
# define ACE_CDR_GIOP_MINOR_VERSION 2
#endif /* ACE_CDR_GIOP_MINOR_VERSION */
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
# include "ace/CDR_Base.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_CDR_BASE_H */
diff --git a/dep/ACE_wrappers/ace/CDR_Base.inl b/dep/ACE_wrappers/ace/CDR_Base.inl
index ba33e73c481..85373170af7 100644
--- a/dep/ACE_wrappers/ace/CDR_Base.inl
+++ b/dep/ACE_wrappers/ace/CDR_Base.inl
@@ -1,15 +1,19 @@
// -*- C++ -*-
//
// $Id: CDR_Base.inl 80826 2008-03-04 14:51:23Z wotte $
+
#if defined (ACE_HAS_INTRINSIC_BYTESWAP)
// Take advantage of MSVC++ byte swapping compiler intrinsics (found
// in <stdlib.h>).
# pragma intrinsic (_byteswap_ushort, _byteswap_ulong, _byteswap_uint64)
#endif /* ACE_HAS_INTRINSIC_BYTESWAP */
+
#if defined (ACE_HAS_BSWAP_16) || defined (ACE_HAS_BSWAP_32) || defined (ACE_HAS_BSWAP_64)
# include "ace/os_include/os_byteswap.h"
#endif
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
//
// The ACE_CDR::swap_X and ACE_CDR::swap_X_array routines are broken
// in 5 cases for optimization:
@@ -57,6 +61,7 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
// asigned to a certain variable so you don't have to clobber any
// register directly.
//
+
ACE_INLINE void
ACE_CDR::swap_2 (const char *orig, char* target)
{
@@ -90,6 +95,7 @@ ACE_CDR::swap_2 (const char *orig, char* target)
*udst = (usrc << 8) | (usrc >> 8);
#endif /* ACE_HAS_PENTIUM */
}
+
ACE_INLINE void
ACE_CDR::swap_4 (const char* orig, char* target)
{
@@ -124,6 +130,7 @@ ACE_CDR::swap_4 (const char* orig, char* target)
* reinterpret_cast<ACE_UINT32*> (target) = x;
#endif /* ACE_HAS_INTRINSIC_BYTESWAP */
}
+
ACE_INLINE void
ACE_CDR::swap_8 (const char* orig, char* target)
{
@@ -185,17 +192,20 @@ ACE_CDR::swap_8 (const char* orig, char* target)
* reinterpret_cast<ACE_UINT32*> (target + 4) = x;
#endif /* ACE_HAS_INTRINSIC_BYTESWAP */
}
+
ACE_INLINE void
ACE_CDR::swap_16 (const char* orig, char* target)
{
swap_8 (orig + 8, target);
swap_8 (orig, target + 8);
}
+
ACE_INLINE size_t
ACE_CDR::first_size (size_t minsize)
{
if (minsize == 0)
return ACE_CDR::DEFAULT_BUFSIZE;
+
size_t newsize = ACE_CDR::DEFAULT_BUFSIZE;
while (newsize < minsize)
{
@@ -203,6 +213,7 @@ ACE_CDR::first_size (size_t minsize)
{
// We grow exponentially at the beginning, this is fast and
// reduces the number of allocations.
+
// Quickly multiply by two using a bit shift. This is
// guaranteed to work since the variable is an unsigned
// integer.
@@ -218,10 +229,12 @@ ACE_CDR::first_size (size_t minsize)
}
return newsize;
}
+
ACE_INLINE size_t
ACE_CDR::next_size (size_t minsize)
{
size_t newsize = ACE_CDR::first_size (minsize);
+
if (newsize == minsize)
{
// If necessary increment the size
@@ -233,7 +246,10 @@ ACE_CDR::next_size (size_t minsize)
else
newsize += ACE_CDR::LINEAR_GROWTH_CHUNK;
}
+
return newsize;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
// ****************************************************************
diff --git a/dep/ACE_wrappers/ace/CDR_Size.cpp b/dep/ACE_wrappers/ace/CDR_Size.cpp
index 7ddb1408167..074631080c4 100644
--- a/dep/ACE_wrappers/ace/CDR_Size.cpp
+++ b/dep/ACE_wrappers/ace/CDR_Size.cpp
@@ -2,13 +2,17 @@
#include "ace/SString.h"
#include "ace/OS_Memory.h"
#include "ace/Truncate.h"
+
#if !defined (__ACE_INLINE__)
# include "ace/CDR_Size.inl"
#endif /* ! __ACE_INLINE__ */
+
ACE_RCSID (ace,
CDR_Size,
"$Id: CDR_Size.cpp 82559 2008-08-07 20:23:07Z parsons $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_CDR::Boolean
ACE_SizeCDR::write_wchar (ACE_CDR::WChar x)
{
@@ -19,11 +23,13 @@ ACE_SizeCDR::write_wchar (ACE_CDR::WChar x)
errno = EACCES;
return (this->good_bit_ = false);
}
+
if (static_cast<ACE_CDR::Short> (major_version_) == 1
&& static_cast<ACE_CDR::Short> (minor_version_) == 2)
{
ACE_CDR::Octet len =
static_cast<ACE_CDR::Octet> (ACE_OutputCDR::wchar_maxbytes ());
+
if (this->write_1 (&len))
{
if (ACE_OutputCDR::wchar_maxbytes () == sizeof(ACE_CDR::WChar))
@@ -59,6 +65,7 @@ ACE_SizeCDR::write_wchar (ACE_CDR::WChar x)
errno = EINVAL;
return (this->good_bit_ = false);
}
+
if (ACE_OutputCDR::wchar_maxbytes () == sizeof (ACE_CDR::WChar))
{
const void *temp = &x;
@@ -69,9 +76,11 @@ ACE_SizeCDR::write_wchar (ACE_CDR::WChar x)
ACE_CDR::Short sx = static_cast<ACE_CDR::Short> (x);
return this->write_2 (reinterpret_cast<const ACE_CDR::UShort *> (&sx));
}
+
ACE_CDR::Octet ox = static_cast<ACE_CDR::Octet> (x);
return this->write_1 (reinterpret_cast<const ACE_CDR::Octet *> (&ox));
}
+
ACE_CDR::Boolean
ACE_SizeCDR::write_string (ACE_CDR::ULong len,
const ACE_CDR::Char *x)
@@ -92,8 +101,10 @@ ACE_SizeCDR::write_string (ACE_CDR::ULong len,
if (this->write_ulong (1))
return this->write_char (0);
}
+
return (this->good_bit_ = false);
}
+
ACE_CDR::Boolean
ACE_SizeCDR::write_string (const ACE_CString &x)
{
@@ -102,6 +113,7 @@ ACE_SizeCDR::write_string (const ACE_CString &x)
return this->write_string (static_cast<ACE_CDR::ULong> (x.length ()),
x.c_str());
}
+
ACE_CDR::Boolean
ACE_SizeCDR::write_wstring (ACE_CDR::ULong len,
const ACE_CDR::WChar *x)
@@ -113,6 +125,7 @@ ACE_SizeCDR::write_wstring (ACE_CDR::ULong len,
errno = EACCES;
return (this->good_bit_ = false);
}
+
if (static_cast<ACE_CDR::Short> (this->major_version_) == 1
&& static_cast<ACE_CDR::Short> (this->minor_version_) == 2)
{
@@ -125,6 +138,7 @@ ACE_SizeCDR::write_wstring (ACE_CDR::ULong len,
this->write_ulong (
ACE_Utils::truncate_cast<ACE_CDR::ULong> (
ACE_OutputCDR::wchar_maxbytes () * len));
+
if (good_ulong)
{
return this->write_wchar_array (x, len);
@@ -136,6 +150,7 @@ ACE_SizeCDR::write_wstring (ACE_CDR::ULong len,
return this->write_ulong (0);
}
}
+
else
if (x != 0)
{
@@ -146,30 +161,35 @@ ACE_SizeCDR::write_wstring (ACE_CDR::ULong len,
return this->write_wchar (0);
return (this->good_bit_ = false);
}
+
ACE_CDR::Boolean
ACE_SizeCDR::write_1 (const ACE_CDR::Octet *)
{
this->adjust (1);
return true;
}
+
ACE_CDR::Boolean
ACE_SizeCDR::write_2 (const ACE_CDR::UShort *)
{
this->adjust (ACE_CDR::SHORT_SIZE);
return true;
}
+
ACE_CDR::Boolean
ACE_SizeCDR::write_4 (const ACE_CDR::ULong *)
{
this->adjust (ACE_CDR::LONG_SIZE);
return true;
}
+
ACE_CDR::Boolean
ACE_SizeCDR::write_8 (const ACE_CDR::ULongLong *)
{
this->adjust (ACE_CDR::LONGLONG_SIZE);
return true;
}
+
ACE_CDR::Boolean
ACE_SizeCDR::write_16 (const ACE_CDR::LongDouble *)
{
@@ -177,19 +197,23 @@ ACE_SizeCDR::write_16 (const ACE_CDR::LongDouble *)
ACE_CDR::LONGDOUBLE_ALIGN);
return true;
}
+
ACE_CDR::Boolean
ACE_SizeCDR::write_wchar_array_i (const ACE_CDR::WChar *,
ACE_CDR::ULong length)
{
if (length == 0)
return true;
+
size_t const align = (ACE_OutputCDR::wchar_maxbytes () == 2) ?
ACE_CDR::SHORT_ALIGN :
ACE_CDR::OCTET_ALIGN;
+
this->adjust (ACE_OutputCDR::wchar_maxbytes () * length, align);
return true;
}
+
ACE_CDR::Boolean
ACE_SizeCDR::write_array (const void *,
size_t size,
@@ -198,9 +222,11 @@ ACE_SizeCDR::write_array (const void *,
{
if (length == 0)
return true;
+
this->adjust (size * length, align);
return true;
}
+
ACE_CDR::Boolean
ACE_SizeCDR::write_boolean_array (const ACE_CDR::Boolean*,
ACE_CDR::ULong length)
@@ -208,11 +234,13 @@ ACE_SizeCDR::write_boolean_array (const ACE_CDR::Boolean*,
this->adjust (length, 1);
return true;
}
+
void
ACE_SizeCDR::adjust (size_t size)
{
adjust (size, size);
}
+
void
ACE_SizeCDR::adjust (size_t size,
size_t align)
@@ -223,11 +251,13 @@ ACE_SizeCDR::adjust (size_t size,
#endif /* ACE_LACKS_CDR_ALIGNMENT */
size_ += size;
}
+
ACE_CDR::Boolean
operator<< (ACE_SizeCDR &ss, const ACE_CString &x)
{
ss.write_string (x);
return ss.good_bit ();
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/CDR_Size.h b/dep/ACE_wrappers/ace/CDR_Size.h
index 6335bf847bb..777c29acc4d 100644
--- a/dep/ACE_wrappers/ace/CDR_Size.h
+++ b/dep/ACE_wrappers/ace/CDR_Size.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file CDR_Size.h
@@ -20,16 +21,23 @@
*
*/
//=============================================================================
+
#ifndef ACE_CDR_SIZE_H
#define ACE_CDR_SIZE_H
+
#include /**/ "ace/pre.h"
+
#include "ace/CDR_Base.h"
#include "ace/CDR_Stream.h" // for ACE_OutputCDR::from_*
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/SStringfwd.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_SizeCDR
*
@@ -42,15 +50,19 @@ public:
/// Default constructor.
ACE_SizeCDR (ACE_CDR::Octet major_version = ACE_CDR_GIOP_MAJOR_VERSION,
ACE_CDR::Octet minor_version = ACE_CDR_GIOP_MINOR_VERSION);
+
/// Returns @c false if an error has ocurred.
bool good_bit (void) const;
+
/// Reset current size.
void reset (void);
+
/// Return current size.
size_t total_length (void) const;
+
// Return 0 on failure and 1 on success.
//@{ @name Size-calculating pseudo-write operations
ACE_CDR::Boolean write_boolean (ACE_CDR::Boolean x);
@@ -66,6 +78,7 @@ public:
ACE_CDR::Boolean write_float (ACE_CDR::Float x);
ACE_CDR::Boolean write_double (const ACE_CDR::Double &x);
ACE_CDR::Boolean write_longdouble (const ACE_CDR::LongDouble &x);
+
/// For string we offer methods that accept a precomputed length.
ACE_CDR::Boolean write_string (const ACE_CDR::Char *x);
ACE_CDR::Boolean write_string (ACE_CDR::ULong len,
@@ -75,6 +88,7 @@ public:
ACE_CDR::Boolean write_wstring (ACE_CDR::ULong length,
const ACE_CDR::WChar *x);
//@}
+
/// @note the portion written starts at <x> and ends
/// at <x + length>.
/// The length is *NOT* stored into the CDR stream.
@@ -105,22 +119,27 @@ public:
ACE_CDR::ULong length);
ACE_CDR::Boolean write_longdouble_array (const ACE_CDR::LongDouble* x,
ACE_CDR::ULong length);
+
///
/// Adjust to @a size and count <size> octets.
void adjust (size_t size);
+
/// As above, but now the size and alignment requirements may be
/// different.
void adjust (size_t size,
size_t align);
+
private:
/// disallow copying...
ACE_SizeCDR (const ACE_SizeCDR& rhs);
ACE_SizeCDR& operator= (const ACE_SizeCDR& rhs);
+
ACE_CDR::Boolean write_1 (const ACE_CDR::Octet *x);
ACE_CDR::Boolean write_2 (const ACE_CDR::UShort *x);
ACE_CDR::Boolean write_4 (const ACE_CDR::ULong *x);
ACE_CDR::Boolean write_8 (const ACE_CDR::ULongLong *x);
ACE_CDR::Boolean write_16 (const ACE_CDR::LongDouble *x);
+
/**
* write an array of @a length elements, each of @a size bytes and the
* start aligned at a multiple of <align>. The elements are assumed
@@ -138,31 +157,42 @@ private:
size_t align,
ACE_CDR::ULong length);
+
ACE_CDR::Boolean write_wchar_array_i (const ACE_CDR::WChar* x,
ACE_CDR::ULong length);
+
private:
/// Set to false when an error ocurrs.
bool good_bit_;
+
/// Current size.
size_t size_;
+
protected:
/// GIOP version information
ACE_CDR::Octet major_version_;
ACE_CDR::Octet minor_version_;
};
+
// @@ This operator should not be inlined since they force SString.h
// to be included in this header.
extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss,
const ACE_CString &x);
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
# include "ace/CDR_Size.inl"
#else /* __ACE_INLINE__ */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Not used by CORBA or TAO
extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss,
ACE_CDR::Char x);
+
// CDR size-calculating output operators for primitive types
+
extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss,
ACE_CDR::Short x);
extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss,
@@ -181,7 +211,9 @@ extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss,
ACE_CDR::Float x);
extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss,
ACE_CDR::Double x);
+
// CDR size-calculating output operator from helper classes
+
extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss,
ACE_OutputCDR::from_boolean x);
extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss,
@@ -198,9 +230,13 @@ extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss,
const ACE_CDR::Char* x);
extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss,
const ACE_CDR::WChar* x);
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_CDR_SIZE_H */
diff --git a/dep/ACE_wrappers/ace/CDR_Size.inl b/dep/ACE_wrappers/ace/CDR_Size.inl
index af1864745b9..4ea81523faf 100644
--- a/dep/ACE_wrappers/ace/CDR_Size.inl
+++ b/dep/ACE_wrappers/ace/CDR_Size.inl
@@ -1,8 +1,11 @@
// -*- C++ -*-
//
// $Id: CDR_Size.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_string.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_SizeCDR::ACE_SizeCDR (ACE_CDR::Octet major_version,
ACE_CDR::Octet minor_version)
@@ -12,33 +15,40 @@ ACE_SizeCDR::ACE_SizeCDR (ACE_CDR::Octet major_version,
minor_version_ (minor_version)
{
}
+
ACE_INLINE bool
ACE_SizeCDR::good_bit (void) const
{
return this->good_bit_;
}
+
ACE_INLINE void
ACE_SizeCDR::reset (void)
{
this->size_ = 0;
}
+
ACE_INLINE size_t
ACE_SizeCDR::total_length (void) const
{
return this->size_;
}
+
// Encode the CDR stream.
+
ACE_INLINE ACE_CDR::Boolean
ACE_SizeCDR::write_octet (ACE_CDR::Octet x)
{
return this->write_1 (reinterpret_cast<const ACE_CDR::Octet *> (&x));
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_SizeCDR::write_boolean (ACE_CDR::Boolean x)
{
return (ACE_CDR::Boolean) this->write_octet (x ? (ACE_CDR::Octet) 1 : (ACE_CDR::Octet) 0);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_SizeCDR::write_char (ACE_CDR::Char x)
{
@@ -46,55 +56,65 @@ ACE_SizeCDR::write_char (ACE_CDR::Char x)
//
return this->write_1 (reinterpret_cast<const ACE_CDR::Octet*> (&x));
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_SizeCDR::write_short (ACE_CDR::Short x)
{
return this->write_2 (reinterpret_cast<const ACE_CDR::UShort*> (&x));
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_SizeCDR::write_ushort (ACE_CDR::UShort x)
{
return this->write_2 (reinterpret_cast<const ACE_CDR::UShort*> (&x));
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_SizeCDR::write_long (ACE_CDR::Long x)
{
return this->write_4 (reinterpret_cast<const ACE_CDR::ULong*> (&x));
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_SizeCDR::write_ulong (ACE_CDR::ULong x)
{
return this->write_4 (reinterpret_cast<const ACE_CDR::ULong*> (&x));
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_SizeCDR::write_longlong (const ACE_CDR::LongLong &x)
{
return this->write_8 (reinterpret_cast<const ACE_CDR::ULongLong*> (&x));
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_SizeCDR::write_ulonglong (const ACE_CDR::ULongLong &x)
{
const void *temp = &x;
return this->write_8 (reinterpret_cast<const ACE_CDR::ULongLong *> (temp));
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_SizeCDR::write_float (ACE_CDR::Float x)
{
const void *temp = &x;
return this->write_4 (reinterpret_cast<const ACE_CDR::ULong *> (temp));
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_SizeCDR::write_double (const ACE_CDR::Double &x)
{
const void *temp = &x;
return this->write_8 (reinterpret_cast<const ACE_CDR::ULongLong*> (temp));
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_SizeCDR::write_longdouble (const ACE_CDR::LongDouble &x)
{
const void *temp = &x;
return this->write_16 (reinterpret_cast<const ACE_CDR::LongDouble*> (temp));
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_SizeCDR::write_string (const ACE_CDR::Char *x)
{
@@ -106,6 +126,7 @@ ACE_SizeCDR::write_string (const ACE_CDR::Char *x)
}
return this->write_string (0, 0);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_SizeCDR::write_wstring (const ACE_CDR::WChar *x)
{
@@ -117,6 +138,7 @@ ACE_SizeCDR::write_wstring (const ACE_CDR::WChar *x)
}
return this->write_wstring (0, 0);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_SizeCDR::write_char_array (const ACE_CDR::Char *x,
ACE_CDR::ULong length)
@@ -128,6 +150,7 @@ ACE_SizeCDR::write_char_array (const ACE_CDR::Char *x,
ACE_CDR::OCTET_ALIGN,
length);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_SizeCDR::write_wchar_array (const ACE_CDR::WChar* x,
ACE_CDR::ULong length)
@@ -148,6 +171,7 @@ ACE_SizeCDR::write_wchar_array (const ACE_CDR::WChar* x,
length);
return this->write_wchar_array_i (x,length);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_SizeCDR::write_octet_array (const ACE_CDR::Octet* x,
ACE_CDR::ULong length)
@@ -157,6 +181,7 @@ ACE_SizeCDR::write_octet_array (const ACE_CDR::Octet* x,
ACE_CDR::OCTET_ALIGN,
length);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_SizeCDR::write_short_array (const ACE_CDR::Short *x,
ACE_CDR::ULong length)
@@ -166,6 +191,7 @@ ACE_SizeCDR::write_short_array (const ACE_CDR::Short *x,
ACE_CDR::SHORT_ALIGN,
length);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_SizeCDR::write_ushort_array (const ACE_CDR::UShort *x,
ACE_CDR::ULong length)
@@ -175,6 +201,7 @@ ACE_SizeCDR::write_ushort_array (const ACE_CDR::UShort *x,
ACE_CDR::SHORT_ALIGN,
length);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_SizeCDR::write_long_array (const ACE_CDR::Long *x,
ACE_CDR::ULong length)
@@ -184,6 +211,7 @@ ACE_SizeCDR::write_long_array (const ACE_CDR::Long *x,
ACE_CDR::LONG_ALIGN,
length);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_SizeCDR::write_ulong_array (const ACE_CDR::ULong *x,
ACE_CDR::ULong length)
@@ -193,6 +221,7 @@ ACE_SizeCDR::write_ulong_array (const ACE_CDR::ULong *x,
ACE_CDR::LONG_ALIGN,
length);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_SizeCDR::write_longlong_array (const ACE_CDR::LongLong *x,
ACE_CDR::ULong length)
@@ -202,6 +231,7 @@ ACE_SizeCDR::write_longlong_array (const ACE_CDR::LongLong *x,
ACE_CDR::LONGLONG_ALIGN,
length);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_SizeCDR::write_ulonglong_array (const ACE_CDR::ULongLong *x,
ACE_CDR::ULong length)
@@ -211,6 +241,7 @@ ACE_SizeCDR::write_ulonglong_array (const ACE_CDR::ULongLong *x,
ACE_CDR::LONGLONG_ALIGN,
length);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_SizeCDR::write_float_array (const ACE_CDR::Float *x,
ACE_CDR::ULong length)
@@ -221,6 +252,7 @@ ACE_SizeCDR::write_float_array (const ACE_CDR::Float *x,
length);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_SizeCDR::write_double_array (const ACE_CDR::Double *x,
ACE_CDR::ULong length)
@@ -230,6 +262,7 @@ ACE_SizeCDR::write_double_array (const ACE_CDR::Double *x,
ACE_CDR::LONGLONG_ALIGN,
length);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_SizeCDR::write_longdouble_array (const ACE_CDR::LongDouble* x,
ACE_CDR::ULong length)
@@ -240,80 +273,94 @@ ACE_SizeCDR::write_longdouble_array (const ACE_CDR::LongDouble* x,
length);
}
+
// ****************************************************************
+
ACE_INLINE ACE_CDR::Boolean
operator<< (ACE_SizeCDR &ss, ACE_CDR::Char x)
{
ss.write_char (x);
return (ACE_CDR::Boolean) ss.good_bit ();
}
+
ACE_INLINE ACE_CDR::Boolean
operator<< (ACE_SizeCDR &ss, ACE_CDR::Short x)
{
ss.write_short (x);
return (ACE_CDR::Boolean) ss.good_bit ();
}
+
ACE_INLINE ACE_CDR::Boolean
operator<< (ACE_SizeCDR &ss, ACE_CDR::UShort x)
{
ss.write_ushort (x);
return (ACE_CDR::Boolean) ss.good_bit ();
}
+
ACE_INLINE ACE_CDR::Boolean
operator<< (ACE_SizeCDR &ss, ACE_CDR::Long x)
{
ss.write_long (x);
return (ACE_CDR::Boolean) ss.good_bit ();
}
+
ACE_INLINE ACE_CDR::Boolean
operator<< (ACE_SizeCDR &ss, ACE_CDR::ULong x)
{
ss.write_ulong (x);
return (ACE_CDR::Boolean) ss.good_bit ();
}
+
ACE_INLINE ACE_CDR::Boolean
operator<< (ACE_SizeCDR &ss, ACE_CDR::LongLong x)
{
ss.write_longlong (x);
return (ACE_CDR::Boolean) ss.good_bit ();
}
+
ACE_INLINE ACE_CDR::Boolean
operator<< (ACE_SizeCDR &ss, ACE_CDR::ULongLong x)
{
ss.write_ulonglong (x);
return (ACE_CDR::Boolean) ss.good_bit ();
}
+
ACE_INLINE ACE_CDR::Boolean
operator<< (ACE_SizeCDR &ss, ACE_CDR::LongDouble x)
{
ss.write_longdouble (x);
return (ACE_CDR::Boolean) ss.good_bit ();
}
+
ACE_INLINE ACE_CDR::Boolean
operator<< (ACE_SizeCDR &ss, ACE_CDR::Float x)
{
ss.write_float (x);
return (ACE_CDR::Boolean) ss.good_bit ();
}
+
ACE_INLINE ACE_CDR::Boolean
operator<< (ACE_SizeCDR &ss, ACE_CDR::Double x)
{
ss.write_double (x);
return (ACE_CDR::Boolean) ss.good_bit ();
}
+
ACE_INLINE ACE_CDR::Boolean
operator<< (ACE_SizeCDR &ss, const ACE_CDR::Char *x)
{
ss.write_string (x);
return (ACE_CDR::Boolean) ss.good_bit ();
}
+
ACE_INLINE ACE_CDR::Boolean
operator<< (ACE_SizeCDR &ss, const ACE_CDR::WChar *x)
{
ss.write_wstring (x);
return (ACE_CDR::Boolean) ss.good_bit ();
}
+
// The following use the helper classes
ACE_INLINE ACE_CDR::Boolean
operator<< (ACE_SizeCDR &ss, ACE_OutputCDR::from_boolean x)
@@ -321,47 +368,57 @@ operator<< (ACE_SizeCDR &ss, ACE_OutputCDR::from_boolean x)
ss.write_boolean (x.val_);
return (ACE_CDR::Boolean) ss.good_bit ();
}
+
ACE_INLINE ACE_CDR::Boolean
operator<< (ACE_SizeCDR &ss, ACE_OutputCDR::from_char x)
{
ss.write_char (x.val_);
return (ACE_CDR::Boolean) ss.good_bit ();
}
+
ACE_INLINE ACE_CDR::Boolean
operator<< (ACE_SizeCDR &ss, ACE_OutputCDR::from_wchar x)
{
ss.write_wchar (x.val_);
return (ACE_CDR::Boolean) ss.good_bit ();
}
+
ACE_INLINE ACE_CDR::Boolean
operator<< (ACE_SizeCDR &ss, ACE_OutputCDR::from_octet x)
{
ss.write_octet (x.val_);
return (ACE_CDR::Boolean) ss.good_bit ();
}
+
ACE_INLINE ACE_CDR::Boolean
operator<< (ACE_SizeCDR &ss, ACE_OutputCDR::from_string x)
{
ACE_CDR::ULong len = 0;
+
if (x.val_ != 0)
{
len = static_cast<ACE_CDR::ULong> (ACE_OS::strlen (x.val_));
}
+
ss.write_string (len, x.val_);
return
(ACE_CDR::Boolean) (ss.good_bit () && (!x.bound_ || len <= x.bound_));
}
+
ACE_INLINE ACE_CDR::Boolean
operator<< (ACE_SizeCDR &ss, ACE_OutputCDR::from_wstring x)
{
ACE_CDR::ULong len = 0;
+
if (x.val_ != 0)
{
len = static_cast<ACE_CDR::ULong> (ACE_OS::strlen (x.val_));
}
+
ss.write_wstring (len, x.val_);
return
(ACE_CDR::Boolean) (ss.good_bit () && (!x.bound_ || len <= x.bound_));
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/CDR_Stream.cpp b/dep/ACE_wrappers/ace/CDR_Stream.cpp
index 776910b2666..1282f75358a 100644
--- a/dep/ACE_wrappers/ace/CDR_Stream.cpp
+++ b/dep/ACE_wrappers/ace/CDR_Stream.cpp
@@ -2,15 +2,21 @@
#include "ace/SString.h"
#include "ace/Auto_Ptr.h"
#include "ace/Truncate.h"
+
#if !defined (__ACE_INLINE__)
# include "ace/CDR_Stream.inl"
#endif /* ! __ACE_INLINE__ */
+
ACE_RCSID (ace,
CDR_Stream,
"$Id: CDR_Stream.cpp 82559 2008-08-07 20:23:07Z parsons $")
+
// ****************************************************************
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
size_t ACE_OutputCDR::wchar_maxbytes_ = sizeof (ACE_CDR::WChar);
+
ACE_OutputCDR::ACE_OutputCDR (size_t size,
int byte_order,
ACE_Allocator *buffer_allocator,
@@ -41,15 +47,18 @@ ACE_OutputCDR::ACE_OutputCDR (size_t size,
minor_version_ (minor_version),
char_translator_ (0),
wchar_translator_ (0)
+
{
ACE_CDR::mb_align (&this->start_);
this->current_ = &this->start_;
+
#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
ACE_NEW (this->monitor_,
ACE::Monitor_Control::Size_Monitor);
this->monitor_->receive (this->total_length ());
#endif /* ACE_HAS_MONITOR_POINTS==1 */
}
+
ACE_OutputCDR::ACE_OutputCDR (char *data,
size_t size,
int byte_order,
@@ -85,12 +94,14 @@ ACE_OutputCDR::ACE_OutputCDR (char *data,
// We cannot trust the buffer to be properly aligned
ACE_CDR::mb_align (&this->start_);
this->current_ = &this->start_;
+
#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
ACE_NEW (this->monitor_,
ACE::Monitor_Control::Size_Monitor);
this->monitor_->receive (this->total_length ());
#endif /* ACE_HAS_MONITOR_POINTS==1 */
}
+
ACE_OutputCDR::ACE_OutputCDR (ACE_Data_Block *data_block,
int byte_order,
ACE_Allocator *message_block_allocator,
@@ -115,12 +126,14 @@ ACE_OutputCDR::ACE_OutputCDR (ACE_Data_Block *data_block,
// We cannot trust the buffer to be properly aligned
ACE_CDR::mb_align (&this->start_);
this->current_ = &this->start_;
+
#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
ACE_NEW (this->monitor_,
ACE::Monitor_Control::Size_Monitor);
this->monitor_->receive (this->total_length ());
#endif /* ACE_HAS_MONITOR_POINTS==1 */
}
+
ACE_OutputCDR::ACE_OutputCDR (ACE_Message_Block *data,
int byte_order,
size_t memcpy_tradeoff,
@@ -142,22 +155,26 @@ ACE_OutputCDR::ACE_OutputCDR (ACE_Message_Block *data,
// We cannot trust the buffer to be properly aligned
ACE_CDR::mb_align (&this->start_);
this->current_ = &this->start_;
+
#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
ACE_NEW (this->monitor_,
ACE::Monitor_Control::Size_Monitor);
this->monitor_->receive (this->total_length ());
#endif /* ACE_HAS_MONITOR_POINTS==1 */
}
+
/*static*/ void
ACE_OutputCDR::wchar_maxbytes (size_t maxbytes)
{
ACE_OutputCDR::wchar_maxbytes_ = maxbytes;
}
+
/*static*/ size_t
ACE_OutputCDR::wchar_maxbytes ()
{
return ACE_OutputCDR::wchar_maxbytes_;
}
+
int
ACE_OutputCDR::grow_and_adjust (size_t size,
size_t align,
@@ -173,14 +190,18 @@ ACE_OutputCDR::grow_and_adjust (size_t size,
if (this->current_->cont () != 0)
cursize = this->current_->cont ()->size ();
size_t minsize = size;
+
#if !defined (ACE_LACKS_CDR_ALIGNMENT)
minsize += ACE_CDR::MAX_ALIGNMENT;
#endif /* ACE_LACKS_CDR_ALIGNMENT */
+
// Make sure that there is enough room for <minsize> bytes, but
// also make it bigger than whatever our current size is.
if (minsize < cursize)
minsize = cursize;
+
size_t const newsize = ACE_CDR::next_size (minsize);
+
this->good_bit_ = false;
ACE_Message_Block* tmp = 0;
ACE_NEW_RETURN (tmp,
@@ -195,6 +216,7 @@ ACE_OutputCDR::grow_and_adjust (size_t size,
ACE_Time_Value::max_time,
this->current_->data_block ()->data_block_allocator ()),
-1);
+
// Message block initialization may fail while the construction
// succeds. Since as a matter of policy, ACE may throw no
// exceptions, we have to do a separate check like this.
@@ -204,7 +226,9 @@ ACE_OutputCDR::grow_and_adjust (size_t size,
errno = ENOMEM;
return -1;
}
+
this->good_bit_ = true;
+
#if !defined (ACE_LACKS_CDR_ALIGNMENT)
// The new block must start with the same alignment as the
// previous block finished.
@@ -218,14 +242,17 @@ ACE_OutputCDR::grow_and_adjust (size_t size,
tmp->rd_ptr (static_cast<size_t> (offset));
tmp->wr_ptr (tmp->rd_ptr ());
#endif /* ACE_LACKS_CDR_ALIGNMENT */
+
// grow the chain and set the current block.
tmp->cont (this->current_->cont ());
this->current_->cont (tmp);
}
this->current_ = this->current_->cont ();
this->current_is_writable_ = true;
+
return this->adjust (size, align, buf);
}
+
ACE_CDR::Boolean
ACE_OutputCDR::write_wchar (ACE_CDR::WChar x)
{
@@ -286,6 +313,7 @@ ACE_OutputCDR::write_wchar (ACE_CDR::WChar x)
ACE_CDR::Octet ox = static_cast<ACE_CDR::Octet> (x);
return this->write_1 (reinterpret_cast<const ACE_CDR::Octet *> (&ox));
}
+
ACE_CDR::Boolean
ACE_OutputCDR::write_string (ACE_CDR::ULong len,
const ACE_CDR::Char *x)
@@ -295,6 +323,7 @@ ACE_OutputCDR::write_string (ACE_CDR::ULong len,
// smaller and should be better for the cache ;-) ;-)
if (this->char_translator_ != 0)
return this->char_translator_->write_string (*this, len, x);
+
if (len != 0)
{
if (this->write_ulong (len + 1))
@@ -309,8 +338,10 @@ ACE_OutputCDR::write_string (ACE_CDR::ULong len,
if (this->write_ulong (1))
return this->write_char (0);
}
+
return (this->good_bit_ = false);
}
+
ACE_CDR::Boolean
ACE_OutputCDR::write_string (const ACE_CString &x)
{
@@ -319,6 +350,7 @@ ACE_OutputCDR::write_string (const ACE_CString &x)
return this->write_string (static_cast<ACE_CDR::ULong> (x.length ()),
x.c_str());
}
+
ACE_CDR::Boolean
ACE_OutputCDR::write_wstring (ACE_CDR::ULong len,
const ACE_CDR::WChar *x)
@@ -334,6 +366,7 @@ ACE_OutputCDR::write_wstring (ACE_CDR::ULong len,
errno = EACCES;
return (this->good_bit_ = false);
}
+
if (static_cast<ACE_CDR::Short> (this->major_version_) == 1
&& static_cast<ACE_CDR::Short> (this->minor_version_) == 2)
{
@@ -346,6 +379,7 @@ ACE_OutputCDR::write_wstring (ACE_CDR::ULong len,
this->write_ulong (
ACE_Utils::truncate_cast<ACE_CDR::ULong> (
ACE_OutputCDR::wchar_maxbytes_ * len));
+
if (good_ulong)
{
return this->write_wchar_array (x, len);
@@ -357,6 +391,7 @@ ACE_OutputCDR::write_wstring (ACE_CDR::ULong len,
return this->write_ulong (0);
}
}
+
else
if (x != 0)
{
@@ -367,6 +402,7 @@ ACE_OutputCDR::write_wstring (ACE_CDR::ULong len,
return this->write_wchar (0);
return (this->good_bit_ = false);
}
+
ACE_CDR::Boolean
ACE_OutputCDR::write_octet_array_mb (const ACE_Message_Block* mb)
{
@@ -377,6 +413,7 @@ ACE_OutputCDR::write_octet_array_mb (const ACE_Message_Block* mb)
i = i->cont ())
{
size_t const length = i->length ();
+
// If the mb does not own its data we are forced to make a copy.
if (ACE_BIT_ENABLED (i->flags (),
ACE_Message_Block::DONT_DELETE))
@@ -388,6 +425,7 @@ ACE_OutputCDR::write_octet_array_mb (const ACE_Message_Block* mb)
return (this->good_bit_ = false);
continue;
}
+
if (length < this->memcpy_tradeoff_
&& this->current_->wr_ptr () + length < this->current_->end ())
{
@@ -398,16 +436,19 @@ ACE_OutputCDR::write_octet_array_mb (const ACE_Message_Block* mb)
return (this->good_bit_ = false);
continue;
}
+
ACE_Message_Block* cont = 0;
this->good_bit_ = false;
ACE_NEW_RETURN (cont,
ACE_Message_Block (i->data_block ()->duplicate ()),
false);
this->good_bit_ = true;
+
if (this->current_->cont () != 0)
ACE_Message_Block::release (this->current_->cont ());
cont->rd_ptr (i->rd_ptr ());
cont->wr_ptr (i->wr_ptr ());
+
this->current_->cont (cont);
this->current_ = cont;
this->current_is_writable_ = false;
@@ -416,8 +457,10 @@ ACE_OutputCDR::write_octet_array_mb (const ACE_Message_Block* mb)
(this->current_alignment_ + cont->length ()) % ACE_CDR::MAX_ALIGNMENT;
#endif /* ACE_LACKS_CDR_ALIGNMENT */
}
+
return true;
}
+
ACE_CDR::Boolean
ACE_OutputCDR::write_1 (const ACE_CDR::Octet *x)
{
@@ -427,8 +470,10 @@ ACE_OutputCDR::write_1 (const ACE_CDR::Octet *x)
*reinterpret_cast<ACE_CDR::Octet*> (buf) = *x;
return true;
}
+
return false;
}
+
ACE_CDR::Boolean
ACE_OutputCDR::write_2 (const ACE_CDR::UShort *x)
{
@@ -451,8 +496,10 @@ ACE_OutputCDR::write_2 (const ACE_CDR::UShort *x)
}
#endif /* ACE_ENABLE_SWAP_ON_WRITE */
}
+
return false;
}
+
ACE_CDR::Boolean
ACE_OutputCDR::write_4 (const ACE_CDR::ULong *x)
{
@@ -475,12 +522,15 @@ ACE_OutputCDR::write_4 (const ACE_CDR::ULong *x)
}
#endif /* ACE_ENABLE_SWAP_ON_WRITE */
}
+
return false;
}
+
ACE_CDR::Boolean
ACE_OutputCDR::write_8 (const ACE_CDR::ULongLong *x)
{
char *buf = 0;
+
if (this->adjust (ACE_CDR::LONGLONG_SIZE, buf) == 0)
{
#if defined (__arm__)
@@ -512,8 +562,10 @@ ACE_OutputCDR::write_8 (const ACE_CDR::ULongLong *x)
# endif /* ACE_ENABLE_SWAP_ON_WRITE */
#endif /* !__arm__ */
}
+
return false;
}
+
ACE_CDR::Boolean
ACE_OutputCDR::write_16 (const ACE_CDR::LongDouble *x)
{
@@ -538,8 +590,10 @@ ACE_OutputCDR::write_16 (const ACE_CDR::LongDouble *x)
}
#endif /* ACE_ENABLE_SWAP_ON_WRITE */
}
+
return false;
}
+
ACE_CDR::Boolean
ACE_OutputCDR::write_wchar_array_i (const ACE_CDR::WChar *x,
ACE_CDR::ULong length)
@@ -550,6 +604,7 @@ ACE_OutputCDR::write_wchar_array_i (const ACE_CDR::WChar *x,
size_t const align = (ACE_OutputCDR::wchar_maxbytes_ == 2) ?
ACE_CDR::SHORT_ALIGN :
ACE_CDR::OCTET_ALIGN;
+
if (this->adjust (ACE_OutputCDR::wchar_maxbytes_ * length, align, buf) == 0)
{
if (ACE_OutputCDR::wchar_maxbytes_ == 2)
@@ -578,6 +633,7 @@ ACE_OutputCDR::write_wchar_array_i (const ACE_CDR::WChar *x,
return false;
}
+
ACE_CDR::Boolean
ACE_OutputCDR::write_array (const void *x,
size_t size,
@@ -627,6 +683,7 @@ ACE_OutputCDR::write_array (const void *x,
return false;
}
+
ACE_CDR::Boolean
ACE_OutputCDR::write_boolean_array (const ACE_CDR::Boolean* x,
ACE_CDR::ULong length)
@@ -637,13 +694,16 @@ ACE_OutputCDR::write_boolean_array (const ACE_CDR::Boolean* x,
// a non-zero value (different from 1).
// We resort to a simple loop.
ACE_CDR::Boolean const * const end = x + length;
+
for (ACE_CDR::Boolean const * i = x;
i != end && this->good_bit ();
++i)
(void) this->write_boolean (*i);
+
return this->good_bit ();
}
+
char *
ACE_OutputCDR::write_long_placeholder (void)
{
@@ -655,6 +715,7 @@ ACE_OutputCDR::write_long_placeholder (void)
return buf;
}
+
char *
ACE_OutputCDR::write_short_placeholder (void)
{
@@ -666,11 +727,13 @@ ACE_OutputCDR::write_short_placeholder (void)
return buf;
}
+
ACE_CDR::Boolean
ACE_OutputCDR::replace (ACE_CDR::Long x, char* loc)
{
if (this->find (loc) == 0)
return false;
+
#if !defined (ACE_ENABLE_SWAP_ON_WRITE)
*reinterpret_cast<ACE_CDR::Long*> (loc) = x;
#else
@@ -683,14 +746,17 @@ ACE_OutputCDR::replace (ACE_CDR::Long x, char* loc)
ACE_CDR::swap_4 (reinterpret_cast<const char*> (&x), loc);
}
#endif /* ACE_ENABLE_SWAP_ON_WRITE */
+
return true;
}
+
ACE_CDR::Boolean
ACE_OutputCDR::replace (ACE_CDR::Short x, char* loc)
{
if (this->find (loc) == 0)
return false;
+
#if !defined (ACE_ENABLE_SWAP_ON_WRITE)
*reinterpret_cast<ACE_CDR::Short*> (loc) = x;
#else
@@ -703,9 +769,11 @@ ACE_OutputCDR::replace (ACE_CDR::Short x, char* loc)
ACE_CDR::swap_2 (reinterpret_cast<const char*> (&x), loc);
}
#endif /* ACE_ENABLE_SWAP_ON_WRITE */
+
return true;
}
+
int
ACE_OutputCDR::consolidate (void)
{
@@ -723,6 +791,7 @@ ACE_OutputCDR::consolidate (void)
{
return -1;
}
+
// Consolidate the chain into the first block. NOTE that
// ACE_CDR::consolidate can not be used since we don't want to
// overwrite what is already in the first block. We just append it since
@@ -737,6 +806,7 @@ ACE_OutputCDR::consolidate (void)
{
this->start_.copy (i->rd_ptr (), i->length ());
}
+
// Release the old blocks that were consolidated and reset the
// current_ and current_is_writable_ to reflect the single used block.
ACE_Message_Block::release (cont);
@@ -744,9 +814,11 @@ ACE_OutputCDR::consolidate (void)
this->current_ = &this->start_;
this->current_is_writable_ = true;
}
+
return 0;
}
+
ACE_Message_Block*
ACE_OutputCDR::find (char* loc)
{
@@ -758,22 +830,29 @@ ACE_OutputCDR::find (char* loc)
break;
}
}
+
return mb;
}
+
#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
+
void
ACE_OutputCDR::register_monitor (const char *id)
{
this->monitor_->name (id);
this->monitor_->add_to_registry ();
}
+
void
ACE_OutputCDR::unregister_monitor (void)
{
this->monitor_->remove_from_registry ();
}
+
#endif /* ACE_HAS_MONITOR_POINTS==1 */
+
// ****************************************************************
+
ACE_InputCDR::ACE_InputCDR (const char *buf,
size_t bufsiz,
int byte_order,
@@ -788,12 +867,14 @@ ACE_InputCDR::ACE_InputCDR (const char *buf,
wchar_translator_ (0)
{
this->start_.wr_ptr (bufsiz);
+
#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
ACE_NEW (this->monitor_,
ACE::Monitor_Control::Size_Monitor);
this->monitor_->receive (bufsiz);
#endif /* ACE_HAS_MONITOR_POINTS==1 */
}
+
ACE_InputCDR::ACE_InputCDR (size_t bufsiz,
int byte_order,
ACE_CDR::Octet major_version,
@@ -812,6 +893,7 @@ ACE_InputCDR::ACE_InputCDR (size_t bufsiz,
this->monitor_->receive (bufsiz);
#endif /* ACE_HAS_MONITOR_POINTS==1 */
}
+
ACE_InputCDR::ACE_InputCDR (const ACE_Message_Block *data,
int byte_order,
ACE_CDR::Octet major_version,
@@ -829,8 +911,10 @@ ACE_InputCDR::ACE_InputCDR (const ACE_Message_Block *data,
ACE::Monitor_Control::Size_Monitor);
this->monitor_->receive (this->start_.total_size ());
#endif /* ACE_HAS_MONITOR_POINTS==1 */
+
this->reset (data, byte_order);
}
+
ACE_InputCDR::ACE_InputCDR (ACE_Data_Block *data,
ACE_Message_Block::Message_Flags flag,
int byte_order,
@@ -850,6 +934,7 @@ ACE_InputCDR::ACE_InputCDR (ACE_Data_Block *data,
this->monitor_->receive (data->size ());
#endif /* ACE_HAS_MONITOR_POINTS==1 */
}
+
ACE_InputCDR::ACE_InputCDR (ACE_Data_Block *data,
ACE_Message_Block::Message_Flags flag,
size_t rd_pos,
@@ -867,18 +952,22 @@ ACE_InputCDR::ACE_InputCDR (ACE_Data_Block *data,
{
// Set the read pointer
this->start_.rd_ptr (rd_pos);
+
// Set the write pointer after doing a sanity check.
char* wrpos = this->start_.base () + wr_pos;
+
if (this->start_.end () >= wrpos)
{
this->start_.wr_ptr (wr_pos);
}
+
#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
ACE_NEW (this->monitor_,
ACE::Monitor_Control::Size_Monitor);
this->monitor_->receive (data->size ());
#endif /* ACE_HAS_MONITOR_POINTS==1 */
}
+
ACE_InputCDR::ACE_InputCDR (const ACE_InputCDR& rhs,
size_t size,
ACE_CDR::Long offset)
@@ -899,8 +988,10 @@ ACE_InputCDR::ACE_InputCDR (const ACE_InputCDR& rhs,
#else
char *incoming_start = rhs.start_.base ();
#endif /* ACE_LACKS_CDR_ALIGNMENT */
+
const size_t newpos =
(rhs.start_.rd_ptr() - incoming_start) + offset;
+
if (newpos <= this->start_.space ()
&& newpos + size <= this->start_.space ())
{
@@ -911,12 +1002,14 @@ ACE_InputCDR::ACE_InputCDR (const ACE_InputCDR& rhs,
{
this->good_bit_ = false;
}
+
#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
ACE_NEW (this->monitor_,
ACE::Monitor_Control::Size_Monitor);
this->monitor_->receive (this->start_.total_size ());
#endif /* ACE_HAS_MONITOR_POINTS==1 */
}
+
ACE_InputCDR::ACE_InputCDR (const ACE_InputCDR& rhs,
size_t size)
: start_ (rhs.start_,
@@ -936,8 +1029,10 @@ ACE_InputCDR::ACE_InputCDR (const ACE_InputCDR& rhs,
#else
char *incoming_start = rhs.start_.base ();
#endif /* ACE_LACKS_CDR_ALIGNMENT */
+
const size_t newpos =
rhs.start_.rd_ptr() - incoming_start;
+
if (newpos <= this->start_.space ()
&& newpos + size <= this->start_.space ())
{
@@ -945,6 +1040,7 @@ ACE_InputCDR::ACE_InputCDR (const ACE_InputCDR& rhs,
// wr_ptr() with a higher value than what we actually want.
this->start_.rd_ptr (newpos);
this->start_.wr_ptr (newpos + size);
+
ACE_CDR::Octet byte_order = 0;
(void) this->read_octet (byte_order);
this->do_byte_swap_ = (byte_order != ACE_CDR_BYTE_ORDER);
@@ -953,12 +1049,14 @@ ACE_InputCDR::ACE_InputCDR (const ACE_InputCDR& rhs,
{
this->good_bit_ = false;
}
+
#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
ACE_NEW (this->monitor_,
ACE::Monitor_Control::Size_Monitor);
this->monitor_->receive (this->start_.total_size ());
#endif /* ACE_HAS_MONITOR_POINTS==1 */
}
+
ACE_InputCDR::ACE_InputCDR (const ACE_InputCDR& rhs)
: start_ (rhs.start_,
ACE_CDR::MAX_ALIGNMENT),
@@ -975,16 +1073,19 @@ ACE_InputCDR::ACE_InputCDR (const ACE_InputCDR& rhs)
#else
char *buf = rhs.start_.base ();
#endif /* ACE_LACKS_CDR_ALIGNMENT */
+
size_t rd_offset = rhs.start_.rd_ptr () - buf;
size_t wr_offset = rhs.start_.wr_ptr () - buf;
this->start_.rd_ptr (rd_offset);
this->start_.wr_ptr (wr_offset);
+
#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
ACE_NEW (this->monitor_,
ACE::Monitor_Control::Size_Monitor);
this->monitor_->receive (this->start_.total_size ());
#endif /* ACE_HAS_MONITOR_POINTS==1 */
}
+
ACE_InputCDR::ACE_InputCDR (ACE_InputCDR::Transfer_Contents x)
: start_ (x.rhs_.start_.data_block ()),
do_byte_swap_ (x.rhs_.do_byte_swap_),
@@ -996,14 +1097,17 @@ ACE_InputCDR::ACE_InputCDR (ACE_InputCDR::Transfer_Contents x)
{
this->start_.rd_ptr (x.rhs_.start_.rd_ptr ());
this->start_.wr_ptr (x.rhs_.start_.wr_ptr ());
+
ACE_Data_Block* db = this->start_.data_block ()->clone_nocopy ();
(void) x.rhs_.start_.replace_data_block (db);
+
#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
ACE_NEW (this->monitor_,
ACE::Monitor_Control::Size_Monitor);
this->monitor_->receive (this->start_.total_size ());
#endif /* ACE_HAS_MONITOR_POINTS==1 */
}
+
ACE_InputCDR&
ACE_InputCDR::operator= (const ACE_InputCDR& rhs)
{
@@ -1018,11 +1122,14 @@ ACE_InputCDR::operator= (const ACE_InputCDR& rhs)
this->major_version_ = rhs.major_version_;
this->minor_version_ = rhs.minor_version_;
}
+
#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
this->monitor_->receive (this->start_.total_size ());
#endif /* ACE_HAS_MONITOR_POINTS==1 */
+
return *this;
}
+
ACE_InputCDR::ACE_InputCDR (const ACE_OutputCDR& rhs,
ACE_Allocator* buffer_allocator,
ACE_Allocator* data_block_allocator,
@@ -1052,12 +1159,14 @@ ACE_InputCDR::ACE_InputCDR (const ACE_OutputCDR& rhs,
{
this->start_.copy (i->rd_ptr (), i->length ());
}
+
#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
ACE_NEW (this->monitor_,
ACE::Monitor_Control::Size_Monitor);
this->monitor_->receive (this->start_.total_size ());
#endif /* ACE_HAS_MONITOR_POINTS==1 */
}
+
ACE_CDR::Boolean
ACE_InputCDR::skip_wchar (void)
{
@@ -1077,8 +1186,10 @@ ACE_InputCDR::skip_wchar (void)
else
return this->read_4 (reinterpret_cast<ACE_CDR::ULong *> (temp));
}
+
return (this->good_bit_ = false);
}
+
ACE_CDR::Boolean
ACE_InputCDR::read_wchar (ACE_CDR::WChar& x)
{
@@ -1092,31 +1203,37 @@ ACE_InputCDR::read_wchar (ACE_CDR::WChar& x)
errno = EACCES;
return (this->good_bit_ = false);
}
+
if (ACE_OutputCDR::wchar_maxbytes_ == sizeof (ACE_CDR::WChar))
{
if (static_cast<ACE_CDR::Short> (major_version_) == 1
&& static_cast<ACE_CDR::Short> (minor_version_) == 2)
{
ACE_CDR::Octet len;
+
if (this->read_1 (&len))
return this->read_array
(reinterpret_cast<ACE_CDR::Octet*> (&x),
static_cast<ACE_CDR::ULong> (len),
ACE_CDR::OCTET_ALIGN,
1);
+
else
return (this->good_bit_ = false);
}
+
void * const temp = &x;
if (sizeof (ACE_CDR::WChar) == 2)
return this->read_2 (reinterpret_cast<ACE_CDR::UShort *> (temp));
else
return this->read_4 (reinterpret_cast<ACE_CDR::ULong *> (temp));
}
+
if (static_cast<ACE_CDR::Short> (major_version_) == 1
&& static_cast<ACE_CDR::Short> (minor_version_) == 2)
{
ACE_CDR::Octet len;
+
if (this->read_1 (&len))
{
if (len == 2)
@@ -1166,10 +1283,12 @@ ACE_InputCDR::read_wchar (ACE_CDR::WChar& x)
x = static_cast<ACE_CDR::WChar> (ox);
return true;
}
+
}
}
return (this->good_bit_ = false);
}
+
ACE_CDR::Boolean
ACE_InputCDR::read_string (ACE_CDR::Char *&x)
{
@@ -1181,9 +1300,12 @@ ACE_InputCDR::read_string (ACE_CDR::Char *&x)
this->good_bit_ = this->char_translator_->read_string (*this, x);
return this->good_bit_;
}
+
ACE_CDR::ULong len = 0;
+
if (!this->read_ulong (len))
return false;
+
// A check for the length being too great is done later in the
// call to read_char_array but we want to have it done before
// the memory is allocated.
@@ -1192,7 +1314,9 @@ ACE_InputCDR::read_string (ACE_CDR::Char *&x)
ACE_NEW_RETURN (x,
ACE_CDR::Char[len],
0);
+
ACE_Auto_Basic_Array_Ptr<ACE_CDR::Char> safe_data (x);
+
if (this->read_char_array (x, len))
{
(void) safe_data.release ();
@@ -1209,9 +1333,11 @@ ACE_InputCDR::read_string (ACE_CDR::Char *&x)
ACE_OS::strcpy (const_cast<char *&> (x), "");
return true;
}
+
x = 0;
return (this->good_bit_ = false);
}
+
ACE_CDR::Boolean
ACE_InputCDR::read_string (ACE_CString &x)
{
@@ -1222,9 +1348,11 @@ ACE_InputCDR::read_string (ACE_CString &x)
x = data;
return true;
}
+
x = "";
return (this->good_bit_ = false);
}
+
ACE_CDR::Boolean
ACE_InputCDR::read_wstring (ACE_CDR::WChar*& x)
{
@@ -1241,35 +1369,45 @@ ACE_InputCDR::read_wstring (ACE_CDR::WChar*& x)
errno = EACCES;
return (this->good_bit_ = false);
}
+
ACE_CDR::ULong len = 0;
+
if (!this->read_ulong (len))
{
return false;
}
+
// A check for the length being too great is done later in the
// call to read_char_array but we want to have it done before
// the memory is allocated.
if (len > 0 && len <= this->length ())
{
ACE_Auto_Basic_Array_Ptr<ACE_CDR::WChar> safe_data;
+
if (static_cast<ACE_CDR::Short> (this->major_version_) == 1
&& static_cast<ACE_CDR::Short> (this->minor_version_) == 2)
{
len /=
ACE_Utils::truncate_cast<ACE_CDR::ULong> (
ACE_OutputCDR::wchar_maxbytes_);
+
//allocating one extra for the null character needed by applications
ACE_NEW_RETURN (x,
ACE_CDR::WChar [len + 1],
false);
+
ACE_auto_ptr_reset (safe_data, x);
+
if (this->read_wchar_array (x, len))
{
+
//Null character used by applications to find the end of
//the wstring
//Is this okay with the GIOP 1.2 spec??
x[len] = '\x00';
+
(void) safe_data.release ();
+
return true;
}
}
@@ -1278,10 +1416,13 @@ ACE_InputCDR::read_wstring (ACE_CDR::WChar*& x)
ACE_NEW_RETURN (x,
ACE_CDR::WChar [len],
false);
+
ACE_auto_ptr_reset (safe_data, x);
+
if (this->read_wchar_array (x, len))
{
(void) safe_data.release ();
+
return true;
}
}
@@ -1296,10 +1437,12 @@ ACE_InputCDR::read_wstring (ACE_CDR::WChar*& x)
x[0] = '\x00';
return true;
}
+
this->good_bit_ = false;
x = 0;
return false;
}
+
ACE_CDR::Boolean
ACE_InputCDR::read_array (void* x,
size_t size,
@@ -1309,6 +1452,7 @@ ACE_InputCDR::read_array (void* x,
if (length == 0)
return true;
char* buf = 0;
+
if (this->adjust (size * length, align, buf) == 0)
{
#if defined (ACE_DISABLE_SWAP_ON_READ)
@@ -1344,6 +1488,7 @@ ACE_InputCDR::read_array (void* x,
}
return false;
}
+
ACE_CDR::Boolean
ACE_InputCDR::read_wchar_array_i (ACE_CDR::WChar* x,
ACE_CDR::ULong length)
@@ -1354,6 +1499,7 @@ ACE_InputCDR::read_wchar_array_i (ACE_CDR::WChar* x,
size_t const align = (ACE_OutputCDR::wchar_maxbytes_ == 2) ?
ACE_CDR::SHORT_ALIGN :
ACE_CDR::OCTET_ALIGN;
+
if (this->adjust (ACE_OutputCDR::wchar_maxbytes_ * length, align, buf) == 0)
{
if (ACE_OutputCDR::wchar_maxbytes_ == 2)
@@ -1383,6 +1529,7 @@ ACE_InputCDR::read_wchar_array_i (ACE_CDR::WChar* x,
return false;
}
+
ACE_CDR::Boolean
ACE_InputCDR::read_boolean_array (ACE_CDR::Boolean *x,
ACE_CDR::ULong length)
@@ -1394,6 +1541,7 @@ ACE_InputCDR::read_boolean_array (ACE_CDR::Boolean *x,
this->good_bit_ = false;
return false;
}
+
// It is hard to optimize this, the spec requires that on the wire
// booleans be represented as a byte with value 0 or 1, but in
// memory it is possible (though very unlikely) that a boolean has
@@ -1401,8 +1549,10 @@ ACE_InputCDR::read_boolean_array (ACE_CDR::Boolean *x,
// We resort to a simple loop.
for (ACE_CDR::ULong i = 0; i != length && this->good_bit_; ++i)
(void) this->read_boolean (x[i]);
+
return this->good_bit_;
}
+
ACE_CDR::Boolean
ACE_InputCDR::read_1 (ACE_CDR::Octet *x)
{
@@ -1412,9 +1562,11 @@ ACE_InputCDR::read_1 (ACE_CDR::Octet *x)
this->start_.rd_ptr (1);
return true;
}
+
this->good_bit_ = false;
return false;
}
+
ACE_CDR::Boolean
ACE_InputCDR::read_2 (ACE_CDR::UShort *x)
{
@@ -1434,6 +1586,7 @@ ACE_InputCDR::read_2 (ACE_CDR::UShort *x)
this->good_bit_ = false;
return false;
}
+
ACE_CDR::Boolean
ACE_InputCDR::read_4 (ACE_CDR::ULong *x)
{
@@ -1453,10 +1606,12 @@ ACE_InputCDR::read_4 (ACE_CDR::ULong *x)
this->good_bit_ = false;
return false;
}
+
ACE_CDR::Boolean
ACE_InputCDR::read_8 (ACE_CDR::ULongLong *x)
{
char *buf = 0;
+
if (this->adjust (ACE_CDR::LONGLONG_SIZE, buf) == 0)
{
#if !defined (ACE_DISABLE_SWAP_ON_READ)
@@ -1498,9 +1653,11 @@ ACE_InputCDR::read_8 (ACE_CDR::ULongLong *x)
#endif /* ACE_DISABLE_SWAP_ON_READ */
return true;
}
+
this->good_bit_ = false;
return false;
}
+
ACE_CDR::Boolean
ACE_InputCDR::read_16 (ACE_CDR::LongDouble *x)
{
@@ -1519,9 +1676,11 @@ ACE_InputCDR::read_16 (ACE_CDR::LongDouble *x)
#endif /* ACE_DISABLE_SWAP_ON_READ */
return true;
}
+
this->good_bit_ = false;
return false;
}
+
ACE_CDR::Boolean
ACE_InputCDR::skip_string (void)
{
@@ -1537,11 +1696,13 @@ ACE_InputCDR::skip_string (void)
}
return false;
}
+
ACE_CDR::Boolean
ACE_InputCDR::skip_wstring (void)
{
ACE_CDR::ULong len = 0;
ACE_CDR::Boolean continue_skipping = read_ulong (len);
+
if (continue_skipping && len != 0)
{
if (static_cast<ACE_CDR::Short> (this->major_version_) == 1
@@ -1553,6 +1714,7 @@ ACE_InputCDR::skip_wstring (void)
}
return continue_skipping;
}
+
ACE_CDR::Boolean
ACE_InputCDR::skip_bytes (size_t len)
{
@@ -1564,47 +1726,58 @@ ACE_InputCDR::skip_bytes (size_t len)
this->good_bit_ = false;
return false;
}
+
int
ACE_InputCDR::grow (size_t newsize)
{
if (ACE_CDR::grow (&this->start_, newsize) == -1)
return -1;
+
ACE_CDR::mb_align (&this->start_);
this->start_.wr_ptr (newsize);
+
#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
if (newsize > this->start_.total_size ())
{
this->monitor_->receive (newsize);
}
#endif /* ACE_HAS_MONITOR_POINTS==1 */
+
return 0;
}
+
void
ACE_InputCDR::reset (const ACE_Message_Block* data,
int byte_order)
{
this->reset_byte_order (byte_order);
ACE_CDR::consolidate (&this->start_, data);
+
#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
this->monitor_->receive (this->start_.total_size ());
#endif /* ACE_HAS_MONITOR_POINTS==1 */
}
+
void
ACE_InputCDR::steal_from (ACE_InputCDR &cdr)
{
this->do_byte_swap_ = cdr.do_byte_swap_;
this->start_.data_block (cdr.start_.data_block ()->duplicate ());
+
// If the message block had a DONT_DELETE flags, just clear it off..
this->start_.clr_self_flags (ACE_Message_Block::DONT_DELETE);
this->start_.rd_ptr (cdr.start_.rd_ptr ());
+
this->start_.wr_ptr (cdr.start_.wr_ptr ());
this->major_version_ = cdr.major_version_;
this->minor_version_ = cdr.minor_version_;
cdr.reset_contents ();
+
#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
this->monitor_->receive (this->start_.total_size ());
#endif /* ACE_HAS_MONITOR_POINTS==1 */
}
+
void
ACE_InputCDR::exchange_data_blocks (ACE_InputCDR &cdr)
{
@@ -1612,74 +1785,95 @@ ACE_InputCDR::exchange_data_blocks (ACE_InputCDR &cdr)
int const byte_order = cdr.do_byte_swap_;
cdr.do_byte_swap_ = this->do_byte_swap_;
this->do_byte_swap_ = byte_order;
+
// Get the destination read and write pointers
size_t const drd_pos =
cdr.start_.rd_ptr () - cdr.start_.base ();
size_t const dwr_pos =
cdr.start_.wr_ptr () - cdr.start_.base ();
+
// Get the source read & write pointers
size_t const srd_pos =
this->start_.rd_ptr () - this->start_.base ();
size_t const swr_pos =
this->start_.wr_ptr () - this->start_.base ();
+
// Exchange data_blocks. Dont release any of the data blocks.
ACE_Data_Block *dnb =
this->start_.replace_data_block (cdr.start_.data_block ());
cdr.start_.replace_data_block (dnb);
+
// Exchange the flags information..
ACE_Message_Block::Message_Flags df = cdr.start_.self_flags ();
ACE_Message_Block::Message_Flags sf = this->start_.self_flags ();
+
cdr.start_.clr_self_flags (df);
this->start_.clr_self_flags (sf);
+
cdr.start_.set_self_flags (sf);
this->start_.set_self_flags (df);
+
// Reset the <cdr> pointers to zero before it is set again.
cdr.start_.reset ();
this->start_.reset ();
+
// Set the read and write pointers.
if (cdr.start_.size () >= srd_pos)
{
cdr.start_.rd_ptr (srd_pos);
}
+
if (cdr.start_.size () >= swr_pos)
{
cdr.start_.wr_ptr (swr_pos);
}
+
if (this->start_.size () >= drd_pos)
{
this->start_.rd_ptr (drd_pos);
}
+
if (this->start_.size () >= dwr_pos)
{
this->start_.wr_ptr (dwr_pos);
}
+
ACE_CDR::Octet const dmajor = cdr.major_version_;
ACE_CDR::Octet const dminor = cdr.minor_version_;
+
// Exchange the GIOP version info
cdr.major_version_ = this->major_version_;
cdr.minor_version_ = this->minor_version_;
+
this->major_version_ = dmajor;
this->minor_version_ = dminor;
+
#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
this->monitor_->receive (this->start_.total_size ());
#endif /* ACE_HAS_MONITOR_POINTS==1 */
}
+
ACE_Data_Block *
ACE_InputCDR::clone_from (ACE_InputCDR &cdr)
{
this->do_byte_swap_ = cdr.do_byte_swap_;
+
// Get the read & write pointer positions in the incoming CDR
// streams
char *rd_ptr = cdr.start_.rd_ptr ();
char *wr_ptr = cdr.start_.wr_ptr ();
+
// Now reset the incoming CDR stream
cdr.start_.reset ();
+
// As we have reset the stream, try to align the underlying message
// block in the incoming stream
ACE_CDR::mb_align (&cdr.start_);
+
// Get the read & write pointer positions again
char *nrd_ptr = cdr.start_.rd_ptr ();
char *nwr_ptr = cdr.start_.wr_ptr ();
+
// Actual length of the stream is..
// @todo: This will look idiotic, but we dont seem to have much of a
// choice. How do we calculate the length of the incoming stream?
@@ -1696,12 +1890,16 @@ ACE_InputCDR::clone_from (ACE_InputCDR &cdr)
// <wr_ptr>.
// (5) The bytes traversed by the <wr_ptr> is the actual length of
// the stream.
+
// Actual bytes traversed
size_t rd_bytes = rd_ptr - nrd_ptr;
size_t wr_bytes = wr_ptr - nwr_ptr;
+
ACE_CDR::mb_align (&this->start_);
+
ACE_Data_Block *db =
this->start_.data_block ();
+
// If the size of the data that needs to be copied are higher than
// what is available, then do a reallocation.
if (wr_bytes > (this->start_.size () - ACE_CDR::MAX_ALIGNMENT))
@@ -1710,107 +1908,141 @@ ACE_InputCDR::clone_from (ACE_InputCDR &cdr)
// block interface to simplify this
db =
cdr.start_.data_block ()->clone_nocopy ();
+
if (db == 0 || db->size ((wr_bytes) +
ACE_CDR::MAX_ALIGNMENT) == -1)
return 0;
+
// Replace our data block by using the incoming CDR stream.
db = this->start_.replace_data_block (db);
+
// Align the start_ message block.
ACE_CDR::mb_align (&this->start_);
+
// Clear the DONT_DELETE flag if it has been set
this->start_.clr_self_flags (ACE_Message_Block::DONT_DELETE);
}
+
// Now do the copy
(void) ACE_OS::memcpy (this->start_.wr_ptr (),
cdr.start_.rd_ptr (),
wr_bytes);
+
// Set the read pointer position to the same point as that was in
// <incoming> cdr.
this->start_.rd_ptr (rd_bytes);
this->start_.wr_ptr (wr_bytes);
+
// We have changed the read & write pointers for the incoming
// stream. Set them back to the positions that they were before..
cdr.start_.rd_ptr (rd_bytes);
cdr.start_.wr_ptr (wr_bytes);
+
this->major_version_ = cdr.major_version_;
this->minor_version_ = cdr.minor_version_;
+
// Copy the char/wchar translators
this->char_translator_ = cdr.char_translator_;
this->wchar_translator_ = cdr.wchar_translator_;
+
#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
this->monitor_->receive (this->start_.total_size ());
#endif /* ACE_HAS_MONITOR_POINTS==1 */
+
return db;
}
+
ACE_Message_Block*
ACE_InputCDR::steal_contents (void)
{
ACE_Message_Block* block = this->start_.clone ();
this->start_.data_block (block->data_block ()->clone ());
+
// If at all our message had a DONT_DELETE flag set, just clear it
// off.
this->start_.clr_self_flags (ACE_Message_Block::DONT_DELETE);
+
ACE_CDR::mb_align (&this->start_);
+
#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
this->monitor_->receive (this->start_.total_size ());
#endif /* ACE_HAS_MONITOR_POINTS==1 */
+
return block;
}
+
void
ACE_InputCDR::reset_contents (void)
{
this->start_.data_block (this->start_.data_block ()->clone_nocopy ());
+
// Reset the flags...
this->start_.clr_self_flags (ACE_Message_Block::DONT_DELETE);
+
#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
this->monitor_->receive (this->start_.total_size ());
#endif /* ACE_HAS_MONITOR_POINTS==1 */
}
+
#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
+
void
ACE_InputCDR::register_monitor (const char *id)
{
this->monitor_->name (id);
this->monitor_->add_to_registry ();
}
+
void
ACE_InputCDR::unregister_monitor (void)
{
this->monitor_->remove_from_registry ();
}
+
#endif /* ACE_HAS_MONITOR_POINTS==1 */
+
// --------------------------------------------------------------
+
ACE_Char_Codeset_Translator::~ACE_Char_Codeset_Translator (void)
{
}
+
// --------------------------------------------------------------
+
ACE_WChar_Codeset_Translator::~ACE_WChar_Codeset_Translator (void)
{
}
+
// --------------------------------------------------------------
+
ACE_CDR::Boolean
operator<< (ACE_OutputCDR &os, const ACE_CString &x)
{
os.write_string (x);
return os.good_bit ();
}
+
ACE_CDR::Boolean
operator>> (ACE_InputCDR &is, ACE_CString &x)
{
is.read_string (x);
return is.good_bit ();
}
+
#if defined (GEN_OSTREAM_OPS)
+
std::ostream&
operator<< (std::ostream &os, ACE_OutputCDR::from_boolean x)
{
return (x.val_ ? os << "true" : os << "false");
}
+
std::ostream&
operator<< (std::ostream &os, ACE_OutputCDR::from_char x)
{
return os << '\'' << x.val_ << '\'';
}
+
std::ostream&
operator<< (std::ostream &os, ACE_OutputCDR::from_wchar x)
{
@@ -1821,6 +2053,7 @@ operator<< (std::ostream &os, ACE_OutputCDR::from_wchar x)
os.setf (ios_base::dec, ios_base::basefield);
return os;
}
+
std::ostream&
operator<< (std::ostream &os, ACE_OutputCDR::from_octet x)
{
@@ -1829,6 +2062,8 @@ operator<< (std::ostream &os, ACE_OutputCDR::from_octet x)
ACE_OutputCDR::from_wchar tmp (w);
return os << tmp;
}
+
#endif /* GEN_OSTREAM_OPS */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/CDR_Stream.h b/dep/ACE_wrappers/ace/CDR_Stream.h
index 16d10f483cf..348433a0de4 100644
--- a/dep/ACE_wrappers/ace/CDR_Stream.h
+++ b/dep/ACE_wrappers/ace/CDR_Stream.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file CDR_Stream.h
@@ -35,26 +36,37 @@
* @author Codeset translation by Jim Rogers <jrogers@viasoft.com>
*/
//=============================================================================
+
#ifndef ACE_CDR_STREAM_H
#define ACE_CDR_STREAM_H
+
#include /**/ "ace/pre.h"
+
#include "ace/CDR_Base.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/SStringfwd.h"
#include "ace/Message_Block.h"
+
#if defined (GEN_OSTREAM_OPS)
#include "ace/streams.h"
#endif /* GEN_OSTREAM_OPS */
+
#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
#include "Monitor_Size.h"
#endif /* ACE_HAS_MONITOR_POINTS==1 */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Char_Codeset_Translator;
class ACE_WChar_Codeset_Translator;
+
class ACE_InputCDR;
+
/**
* @class ACE_OutputCDR
*
@@ -80,6 +92,7 @@ public:
friend class ACE_Char_Codeset_Translator;
friend class ACE_WChar_Codeset_Translator;
friend class ACE_InputCDR;
+
/**
* Default constructor; allows one to set byte ordering, allocators, and
* tuning information.
@@ -105,6 +118,7 @@ public:
size_t memcpy_tradeoff = ACE_DEFAULT_CDR_MEMCPY_TRADEOFF,
ACE_CDR::Octet major_version = ACE_CDR_GIOP_MAJOR_VERSION,
ACE_CDR::Octet minor_version = ACE_CDR_GIOP_MINOR_VERSION);
+
/// Build a CDR stream with an initial buffer, it will *not* remove
/// <data>, since it did not allocated it. It's important to be careful
/// with the alignment of <data>.
@@ -125,6 +139,7 @@ public:
size_t memcpy_tradeoff = ACE_DEFAULT_CDR_MEMCPY_TRADEOFF,
ACE_CDR::Octet giop_major_version = ACE_CDR_GIOP_MAJOR_VERSION,
ACE_CDR::Octet giop_minor_version = ACE_CDR_GIOP_MINOR_VERSION);
+
/// Build a CDR stream with an initial data block, it will *not* remove
/// <data_block>, since it did not allocated it. It's important to be
// careful with the alignment of <data_block>.
@@ -142,6 +157,7 @@ public:
size_t memcpy_tradeoff = ACE_DEFAULT_CDR_MEMCPY_TRADEOFF,
ACE_CDR::Octet giop_major_version = ACE_CDR_GIOP_MAJOR_VERSION,
ACE_CDR::Octet giop_minor_version = ACE_CDR_GIOP_MINOR_VERSION);
+
/// Build a CDR stream with an initial Message_Block chain, it will
/// *not* remove @a data, since it did not allocate it.
ACE_OutputCDR (ACE_Message_Block *data,
@@ -149,33 +165,40 @@ public:
size_t memcpy_tradeoff = ACE_DEFAULT_CDR_MEMCPY_TRADEOFF,
ACE_CDR::Octet giop_major_version = ACE_CDR_GIOP_MAJOR_VERSION,
ACE_CDR::Octet giop_minor_version = ACE_CDR_GIOP_MINOR_VERSION);
+
/// destructor
~ACE_OutputCDR (void);
+
/**
* Disambiguate overload when inserting booleans, octets, chars, and
* bounded strings.
*/
//@{ @name Helper classes
+
struct ACE_Export from_boolean
{
explicit from_boolean (ACE_CDR::Boolean b);
ACE_CDR::Boolean val_;
};
+
struct ACE_Export from_octet
{
explicit from_octet (ACE_CDR::Octet o);
ACE_CDR::Octet val_;
};
+
struct ACE_Export from_char
{
explicit from_char (ACE_CDR::Char c);
ACE_CDR::Char val_;
};
+
struct ACE_Export from_wchar
{
explicit from_wchar (ACE_CDR::WChar wc);
ACE_CDR::WChar val_;
};
+
struct ACE_Export from_string
{
from_string (ACE_CDR::Char* s,
@@ -188,6 +211,7 @@ public:
ACE_CDR::ULong bound_;
ACE_CDR::Boolean nocopy_;
};
+
struct ACE_Export from_wstring
{
from_wstring (ACE_CDR::WChar* ws,
@@ -201,6 +225,7 @@ public:
ACE_CDR::Boolean nocopy_;
};
//@}
+
/**
* @{ @name Write operations
* Return 0 on failure and 1 on success.
@@ -218,6 +243,7 @@ public:
ACE_CDR::Boolean write_float (ACE_CDR::Float x);
ACE_CDR::Boolean write_double (const ACE_CDR::Double &x);
ACE_CDR::Boolean write_longdouble (const ACE_CDR::LongDouble &x);
+
/// For string we offer methods that accept a precomputed length.
ACE_CDR::Boolean write_string (const ACE_CDR::Char *x);
ACE_CDR::Boolean write_string (ACE_CDR::ULong len,
@@ -227,6 +253,7 @@ public:
ACE_CDR::Boolean write_wstring (ACE_CDR::ULong length,
const ACE_CDR::WChar *x);
//@}
+
/// @note the portion written starts at <x> and ends
/// at <x + length>.
/// The length is *NOT* stored into the CDR stream.
@@ -257,10 +284,12 @@ public:
ACE_CDR::ULong length);
ACE_CDR::Boolean write_longdouble_array (const ACE_CDR::LongDouble* x,
ACE_CDR::ULong length);
+
/// Write an octet array contained inside a MB, this can be optimized
/// to minimize copies.
ACE_CDR::Boolean write_octet_array_mb (const ACE_Message_Block* mb);
//@}
+
/**
* @{ @name Placeholder/replace operations
* Facilitates writing a placeholder into a CDR stream to be replaced
@@ -276,6 +305,7 @@ public:
strm.replace (real_val, pos); // Replace earlier placeholder
@endcode
*/
+
/**
* Write a placeholder into the stream. The placeholder's pointer
* is returned so it may later be passed as the @a loc argument to
@@ -288,6 +318,7 @@ public:
*/
char* write_long_placeholder (void);
char* write_short_placeholder (void);
+
/**
* Writes a new value into a specific location. This is commonly
* used to update a prior "placeholder" location in the stream.
@@ -307,6 +338,7 @@ public:
ACE_CDR::Boolean replace (ACE_CDR::Long x, char* loc);
ACE_CDR::Boolean replace (ACE_CDR::Short x, char* loc);
//@}
+
/**
* Return 0 on failure and 1 on success.
*/
@@ -324,28 +356,36 @@ public:
ACE_CDR::Boolean append_float (ACE_InputCDR &);
ACE_CDR::Boolean append_double (ACE_InputCDR &);
ACE_CDR::Boolean append_longdouble (ACE_InputCDR &);
+
ACE_CDR::Boolean append_wstring (ACE_InputCDR &);
ACE_CDR::Boolean append_string (ACE_InputCDR &);
//@}
+
/// Returns @c false if an error has ocurred.
/**
* @note The only expected error is to run out of memory.
*/
bool good_bit (void) const;
+
/// Reuse the CDR stream to write on the old buffer.
void reset (void);
+
/// Add the length of each message block in the chain.
size_t total_length (void) const;
+
/**
* Return the start of the message block chain for this CDR stream.
* @note The complete CDR stream is represented by a chain of
* message blocks.
*/
const ACE_Message_Block *begin (void) const;
+
/// Return the last message in the chain that is is use.
const ACE_Message_Block *end (void) const;
+
/// Return the <current_> message block in chain.
const ACE_Message_Block *current (void) const;
+
/// Replace the message block chain with a single message block.
/**
* Upon successful completion, there will be a single message block
@@ -354,18 +394,21 @@ public:
* @note The only expected error is to run out of memory.
*/
int consolidate (void);
+
/**
* Access the underlying buffer (read only). @note This
* method only returns a pointer to the first block in the
* chain.
*/
const char *buffer (void) const;
+
/**
* Return the size of first message block in the block chain. @note This
* method only returns information about the first block in the
* chain.
*/
size_t length (void) const;
+
/**
* Utility function to allow the user more flexibility.
* Pads the stream up to the nearest <alignment>-byte boundary.
@@ -373,25 +416,32 @@ public:
* Returns 0 on success and -1 on failure.
*/
int align_write_ptr (size_t alignment);
+
/// Access the codeset translators. They can be null!
ACE_Char_Codeset_Translator *char_translator (void) const;
ACE_WChar_Codeset_Translator *wchar_translator (void) const;
+
/// Set the char codeset translator.
void char_translator (ACE_Char_Codeset_Translator *);
/// Set the wchar codeset translator.
void wchar_translator (ACE_WChar_Codeset_Translator *);
+
/// set the global size of serialized wchars. This may be different
/// than the size of a wchar_t.
static void wchar_maxbytes (size_t max_bytes);
+
/// access the serialized size of wchars.
static size_t wchar_maxbytes (void);
+
/**
* Return alignment of the wr_ptr(), with respect to the start of
* the CDR stream. This is not the same as the alignment of
* current->wr_ptr()!
*/
size_t current_alignment (void) const;
+
void current_alignment (size_t current_alignment);
+
/**
* Returns (in @a buf) the next position in the buffer aligned to
* @a size, it advances the Message_Block wr_ptr past the data
@@ -400,45 +450,57 @@ public:
*/
int adjust (size_t size,
char *&buf);
+
/// As above, but now the size and alignment requirements may be
/// different.
int adjust (size_t size,
size_t align,
char *&buf);
+
/// Returns true if this stream is writing in non-native byte order
/// and false otherwise. For example, it would be true if either
/// ACE_ENABLE_SWAP_ON_WRITE is defined or a specific byte order was
/// specified for this stream.
bool do_byte_swap (void) const;
+
/// Returns the byte order this stream is marshaling data in. Will be one
/// of the values in ACE_CDR::Byte_Order.
int byte_order (void) const;
+
/// For use by a gateway, which creates the output stream for the
/// reply to the client in its native byte order, but which must
/// send the reply in the byte order of the target's reply to the
/// gateway.
void reset_byte_order (int byte_order);
+
/// set GIOP version info
void set_version (ACE_CDR::Octet major, ACE_CDR::Octet minor);
+
/// Set the underlying GIOP version..
void get_version (ACE_CDR::Octet &major, ACE_CDR::Octet &minor);
+
#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
/// Register and unregister our buffer size monitor.
void register_monitor (const char* id);
void unregister_monitor (void);
#endif /* ACE_HAS_MONITOR_POINTS==1 */
+
private:
+
// Find the message block in the chain of message blocks
// that the provide location locates.
ACE_Message_Block* find (char* loc);
+
/// disallow copying...
ACE_OutputCDR (const ACE_OutputCDR& rhs);
ACE_OutputCDR& operator= (const ACE_OutputCDR& rhs);
+
ACE_CDR::Boolean write_1 (const ACE_CDR::Octet *x);
ACE_CDR::Boolean write_2 (const ACE_CDR::UShort *x);
ACE_CDR::Boolean write_4 (const ACE_CDR::ULong *x);
ACE_CDR::Boolean write_8 (const ACE_CDR::ULongLong *x);
ACE_CDR::Boolean write_16 (const ACE_CDR::LongDouble *x);
+
/**
* write an array of @a length elements, each of @a size bytes and the
* start aligned at a multiple of <align>. The elements are assumed
@@ -456,9 +518,11 @@ private:
size_t align,
ACE_CDR::ULong length);
+
ACE_CDR::Boolean write_wchar_array_i (const ACE_CDR::WChar* x,
ACE_CDR::ULong length);
+
/**
* Grow the CDR stream. When it returns @a buf contains a pointer to
* memory in the CDR stream, with at least @a size bytes ahead of it
@@ -468,11 +532,14 @@ private:
int grow_and_adjust (size_t size,
size_t align,
char *&buf);
+
private:
/// The start of the chain of message blocks.
ACE_Message_Block start_;
+
/// The current block in the chain where we are writing.
ACE_Message_Block *current_;
+
#if !defined (ACE_LACKS_CDR_ALIGNMENT)
/**
* The current alignment as measured from the start of the buffer.
@@ -484,6 +551,7 @@ private:
*/
size_t current_alignment_;
#endif /* ACE_LACKS_CDR_ALIGNMENT */
+
/**
* Is the current block writable. When we steal a buffer from the
* user and just chain it into the message block we are not supposed
@@ -491,6 +559,7 @@ private:
* buffer.
*/
bool current_is_writable_;
+
/**
* If not zero swap bytes at writing so the created CDR stream byte
* order does *not* match the machine byte order. The motivation
@@ -501,20 +570,26 @@ private:
* USE AT YOUR OWN RISK
*/
bool do_byte_swap_;
+
/// Set to false when an error ocurrs.
bool good_bit_;
+
/// Break-even point for copying.
size_t const memcpy_tradeoff_;
+
#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
ACE::Monitor_Control::Size_Monitor *monitor_;
#endif /* ACE_HAS_MONITOR_POINTS==1 */
+
protected:
/// GIOP version information
ACE_CDR::Octet major_version_;
ACE_CDR::Octet minor_version_;
+
/// If not nil, invoke for translation of character and string data.
ACE_Char_Codeset_Translator *char_translator_;
ACE_WChar_Codeset_Translator *wchar_translator_;
+
/**
* Some wide char codesets may be defined with a maximum number
* of bytes that is smaller than the size of a wchar_t. This means
@@ -527,7 +602,9 @@ protected:
static size_t wchar_maxbytes_;
};
+
// ****************************************************************
+
/**
* @class ACE_InputCDR
*
@@ -550,6 +627,7 @@ public:
// arrays and such.
friend class ACE_Char_Codeset_Translator;
friend class ACE_WChar_Codeset_Translator;
+
/**
* Create an input stream from an arbitrary buffer. The buffer must
* be properly aligned because this contructor will *not* work if
@@ -562,12 +640,14 @@ public:
int byte_order = ACE_CDR::BYTE_ORDER_NATIVE,
ACE_CDR::Octet major_version = ACE_CDR_GIOP_MAJOR_VERSION,
ACE_CDR::Octet minor_version = ACE_CDR_GIOP_MINOR_VERSION);
+
/// Create an empty input stream. The caller is responsible for
/// putting the right data and providing the right alignment.
ACE_InputCDR (size_t bufsiz,
int byte_order = ACE_CDR::BYTE_ORDER_NATIVE,
ACE_CDR::Octet major_version = ACE_CDR_GIOP_MAJOR_VERSION,
ACE_CDR::Octet minor_version = ACE_CDR_GIOP_MINOR_VERSION);
+
/// Create an input stream from an ACE_Message_Block
/**
* The alignment of the @a data block is carried into the new
@@ -581,6 +661,7 @@ public:
ACE_CDR::Octet major_version = ACE_CDR_GIOP_MAJOR_VERSION,
ACE_CDR::Octet minor_version = ACE_CDR_GIOP_MINOR_VERSION,
ACE_Lock* lock = 0);
+
/// Create an input stream from an ACE_Data_Block. The <flag>
/// indicates whether the <data> can be deleted by the CDR stream
/// or not
@@ -589,6 +670,7 @@ public:
int byte_order = ACE_CDR::BYTE_ORDER_NATIVE,
ACE_CDR::Octet major_version = ACE_CDR_GIOP_MAJOR_VERSION,
ACE_CDR::Octet minor_version = ACE_CDR_GIOP_MINOR_VERSION);
+
/// Create an input stream from an ACE_Data_Block. It also sets the
/// read and write pointers at the desired positions. This would be
/// helpful if the applications desires to create a new CDR stream
@@ -600,62 +682,76 @@ public:
int byte_order = ACE_CDR::BYTE_ORDER_NATIVE,
ACE_CDR::Octet major_version = ACE_CDR_GIOP_MAJOR_VERSION,
ACE_CDR::Octet minor_version = ACE_CDR_GIOP_MINOR_VERSION);
+
/**
* These make a copy of the current stream state, but do not copy
* the internal buffer, so the same stream can be read multiple
* times efficiently.
*/
ACE_InputCDR (const ACE_InputCDR& rhs);
+
ACE_InputCDR& operator= (const ACE_InputCDR& rhs);
+
/// When interpreting indirected TypeCodes it is useful to make a
/// "copy" of the stream starting in the new position.
ACE_InputCDR (const ACE_InputCDR& rhs,
size_t size,
ACE_CDR::Long offset);
+
/// This creates an encapsulated stream, the first byte must be (per
/// the spec) the byte order of the encapsulation.
ACE_InputCDR (const ACE_InputCDR& rhs,
size_t size);
+
/// Create an input CDR from an output CDR.
ACE_InputCDR (const ACE_OutputCDR& rhs,
ACE_Allocator* buffer_allocator = 0,
ACE_Allocator* data_block_allocator = 0,
ACE_Allocator* message_block_allocator = 0);
+
/// Helper class to transfer the contents from one input CDR to
/// another without requiring any extra memory allocations, data
/// copies or too many temporaries.
struct ACE_Export Transfer_Contents
{
Transfer_Contents (ACE_InputCDR &rhs);
+
ACE_InputCDR &rhs_;
};
/// Transfer the contents from <rhs> to a new CDR
ACE_InputCDR (Transfer_Contents rhs);
+
/// Destructor
~ACE_InputCDR (void);
+
/// Disambiguate overloading when extracting octets, chars,
/// booleans, and bounded strings
//@{ @name Helper classes
+
struct ACE_Export to_boolean
{
explicit to_boolean (ACE_CDR::Boolean &b);
ACE_CDR::Boolean &ref_;
};
+
struct ACE_Export to_char
{
explicit to_char (ACE_CDR::Char &c);
ACE_CDR::Char &ref_;
};
+
struct ACE_Export to_wchar
{
explicit to_wchar (ACE_CDR::WChar &wc);
ACE_CDR::WChar &ref_;
};
+
struct ACE_Export to_octet
{
explicit to_octet (ACE_CDR::Octet &o);
ACE_CDR::Octet &ref_;
};
+
struct ACE_Export to_string
{
/**
@@ -670,6 +766,7 @@ public:
const ACE_CDR::Char *&val_;
ACE_CDR::ULong bound_;
};
+
struct ACE_Export to_wstring
{
/// The constructor taking a non-const wstring is
@@ -683,6 +780,7 @@ public:
ACE_CDR::ULong bound_;
};
//@}
+
/**
* Return @c false on failure and @c true on success.
*/
@@ -700,10 +798,12 @@ public:
ACE_CDR::Boolean read_float (ACE_CDR::Float &x);
ACE_CDR::Boolean read_double (ACE_CDR::Double &x);
ACE_CDR::Boolean read_longdouble (ACE_CDR::LongDouble &x);
+
ACE_CDR::Boolean read_string (ACE_CDR::Char *&x);
ACE_CDR::Boolean read_string (ACE_CString &x);
ACE_CDR::Boolean read_wstring (ACE_CDR::WChar*& x);
//@}
+
/**
* The buffer @a x must be large enough to contain @a length
* elements.
@@ -737,6 +837,7 @@ public:
ACE_CDR::Boolean read_longdouble_array (ACE_CDR::LongDouble* x,
ACE_CDR::ULong length);
//@}
+
/**
* Return @c false on failure and @c true on success.
*/
@@ -755,6 +856,7 @@ public:
ACE_CDR::Boolean skip_double (void);
ACE_CDR::Boolean skip_longdouble (void);
//@}
+
/**
* The next field must be a string, this method skips it. It is
* useful in parsing a TypeCode.
@@ -762,13 +864,16 @@ public:
*/
ACE_CDR::Boolean skip_wstring (void);
ACE_CDR::Boolean skip_string (void);
+
/// Skip @a n bytes in the CDR stream.
/**
* @return @c false on failure and @c true on success.
*/
ACE_CDR::Boolean skip_bytes (size_t n);
+
/// returns @c false if a problem has been detected.
bool good_bit (void) const;
+
/**
* @return The start of the message block chain for this CDR
* stream.
@@ -777,35 +882,43 @@ public:
* we are planning to change that.
*/
const ACE_Message_Block* start (void) const;
+
// = The following functions are useful to read the contents of the
// CDR stream from a socket or file.
+
/**
* Grow the internal buffer, reset @c rd_ptr to the first byte in
* the new buffer that is properly aligned, and set @c wr_ptr to @c
* rd_ptr @c + @c newsize
*/
int grow (size_t newsize);
+
/**
* After reading and partially parsing the contents the user can
* detect a change in the byte order, this method will let him/her
* change it.
*/
void reset_byte_order (int byte_order);
+
/// Re-initialize the CDR stream, copying the contents of the chain
/// of message_blocks starting from @a data.
void reset (const ACE_Message_Block *data,
int byte_order);
+
/// Steal the contents from the current CDR.
ACE_Message_Block *steal_contents (void);
+
/// Steal the contents of @a cdr and make a shallow copy into this
/// stream.
void steal_from (ACE_InputCDR &cdr);
+
/// Exchange data blocks with the caller of this method. The read
/// and write pointers are also exchanged.
/**
* @note We now do only with the start_ message block.
*/
void exchange_data_blocks (ACE_InputCDR &cdr);
+
/// Copy the data portion from the @c cdr to this cdr and return the
/// data content (ie. the ACE_Data_Block) from this CDR to the
/// caller.
@@ -814,15 +927,20 @@ public:
* returned ACE_Data_Block.
*/
ACE_Data_Block* clone_from (ACE_InputCDR &cdr);
+
/// Re-initialize the CDR stream, forgetting about the old contents
/// of the stream and allocating a new buffer (from the allocators).
void reset_contents (void);
+
/// Returns the current position for the @c rd_ptr.
char* rd_ptr (void);
+
/// Returns the current position for the @c wr_ptr.
char* wr_ptr (void);
+
/// Return how many bytes are left in the stream.
size_t length (void) const;
+
/**
* Utility function to allow the user more flexibility.
* Skips up to the nearest @a alignment-byte boundary.
@@ -831,18 +949,23 @@ public:
* @return 0 on success and -1 on failure.
*/
int align_read_ptr (size_t alignment);
+
/// If @c true then this stream is writing in non-native byte order.
/// This is only meaningful if ACE_ENABLE_SWAP_ON_WRITE is defined.
bool do_byte_swap (void) const;
+
/// If @c do_byte_swap() returns @c false, this returns
/// ACE_CDR_BYTE_ORDER else it returns !ACE_CDR_BYTE_ORDER.
int byte_order (void) const;
+
/// Access the codeset translators. They can be nil!
ACE_Char_Codeset_Translator *char_translator (void) const;
ACE_WChar_Codeset_Translator *wchar_translator (void) const;
+
/// Set the codeset translators.
void char_translator (ACE_Char_Codeset_Translator *);
void wchar_translator (ACE_WChar_Codeset_Translator *);
+
/**
* Returns (in @a buf) the next position in the buffer aligned to
* @a size. It advances the Message_Block @c rd_ptr past the data
@@ -851,50 +974,65 @@ public:
*/
int adjust (size_t size,
char *&buf);
+
/// As above, but now the size and alignment requirements may be
/// different.
int adjust (size_t size,
size_t align,
char *&buf);
+
/// Set the underlying GIOP version..
void set_version (ACE_CDR::Octet major, ACE_CDR::Octet minor);
+
/// Set the underlying GIOP version..
void get_version (ACE_CDR::Octet &major, ACE_CDR::Octet &minor);
+
#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
/// Register and unregister our buffer size monitor.
void register_monitor (const char* id);
void unregister_monitor (void);
#endif /* ACE_HAS_MONITOR_POINTS==1 */
+
protected:
+
/// The start of the chain of message blocks, even though in the
/// current version the chain always has length 1.
ACE_Message_Block start_;
+
/// The CDR stream byte order does not match the one on the machine,
/// swapping is needed while reading.
bool do_byte_swap_;
+
/// set to @c false when an error occurs.
bool good_bit_;
+
/// The GIOP versions for this stream
ACE_CDR::Octet major_version_;
ACE_CDR::Octet minor_version_;
+
/// If not nil, invoke for translation of character and string data.
ACE_Char_Codeset_Translator *char_translator_;
ACE_WChar_Codeset_Translator *wchar_translator_;
+
#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
ACE::Monitor_Control::Size_Monitor *monitor_;
#endif /* ACE_HAS_MONITOR_POINTS==1 */
+
private:
+
ACE_CDR::Boolean read_1 (ACE_CDR::Octet *x);
ACE_CDR::Boolean read_2 (ACE_CDR::UShort *x);
ACE_CDR::Boolean read_4 (ACE_CDR::ULong *x);
ACE_CDR::Boolean read_8 (ACE_CDR::ULongLong *x);
ACE_CDR::Boolean read_16 (ACE_CDR::LongDouble *x);
+
// Several types can be read using the same routines, since TAO
// tries to use native types with known size for each CORBA type.
// We could use void* or char* to make the interface more
// consistent, but using native types let us exploit the strict
// alignment requirements of CDR streams and implement the
// operations using asignment.
+
/**
* Read an array of @a length elements, each of @a size bytes and the
* start aligned at a multiple of <align>. The elements are assumed
@@ -911,6 +1049,7 @@ private:
size_t size,
size_t align,
ACE_CDR::ULong length);
+
/**
* On those occasions when the native codeset for wchar is smaller than
* the size of a wchar_t, such as using UTF-16 with a 4-byte wchar_t, a
@@ -919,12 +1058,16 @@ private:
*/
ACE_CDR::Boolean read_wchar_array_i (ACE_CDR::WChar * x,
ACE_CDR::ULong length);
+
/// Move the rd_ptr ahead by @a offset bytes.
void rd_ptr (size_t offset);
+
/// Points to the continuation field of the current message block.
char* end (void);
};
+
// ****************************************************************
+
/**
* @class ACE_Char_Codeset_Translator
*
@@ -943,33 +1086,40 @@ class ACE_Export ACE_Char_Codeset_Translator
{
public:
virtual ~ACE_Char_Codeset_Translator ();
+
/// Read a single character from the stream, converting from the
/// stream codeset to the native codeset
virtual ACE_CDR::Boolean read_char (ACE_InputCDR&,
ACE_CDR::Char&) = 0;
+
/// Read a string from the stream, including the length, converting
/// the characters from the stream codeset to the native codeset
virtual ACE_CDR::Boolean read_string (ACE_InputCDR&,
ACE_CDR::Char *&) = 0;
+
/// Read an array of characters from the stream, converting the
/// characters from the stream codeset to the native codeset.
virtual ACE_CDR::Boolean read_char_array (ACE_InputCDR&,
ACE_CDR::Char*,
ACE_CDR::ULong) = 0;
+
/// Write a single character to the stream, converting from the
/// native codeset to the stream codeset
virtual ACE_CDR::Boolean write_char (ACE_OutputCDR&,
ACE_CDR::Char) = 0;
+
/// Write a string to the stream, including the length, converting
/// from the native codeset to the stream codeset
virtual ACE_CDR::Boolean write_string (ACE_OutputCDR&,
ACE_CDR::ULong,
const ACE_CDR::Char*) = 0;
+
/// Write an array of characters to the stream, converting from the
/// native codeset to the stream codeset
virtual ACE_CDR::Boolean write_char_array (ACE_OutputCDR&,
const ACE_CDR::Char*,
ACE_CDR::ULong) = 0;
+
virtual ACE_CDR::ULong ncs () = 0;
virtual ACE_CDR::ULong tcs () = 0;
protected:
@@ -979,6 +1129,7 @@ protected:
ACE_CDR::Octet *x);
ACE_CDR::Boolean write_1 (ACE_OutputCDR& output,
const ACE_CDR::Octet *x);
+
/// Efficiently read @a length elements of size @a size each from
/// <input> into <x>; the data must be aligned to <align>.
ACE_CDR::Boolean read_array (ACE_InputCDR& input,
@@ -986,6 +1137,7 @@ protected:
size_t size,
size_t align,
ACE_CDR::ULong length);
+
/**
* Efficiently write @a length elements of size @a size from <x> into
* <output>. Before inserting the elements enough padding is added
@@ -997,6 +1149,7 @@ protected:
size_t size,
size_t align,
ACE_CDR::ULong length);
+
/**
* Exposes the stream implementation of <adjust>, this is useful in
* many cases to minimize memory allocations during marshaling.
@@ -1008,15 +1161,19 @@ protected:
size_t size,
size_t align,
char *&buf);
+
/// Used by derived classes to set errors in the CDR stream.
void good_bit (ACE_OutputCDR& out, bool bit);
+
/// Obtain the CDR Stream's major & minor version values.
ACE_CDR::Octet major_version (ACE_InputCDR& input);
ACE_CDR::Octet minor_version (ACE_InputCDR& input);
ACE_CDR::Octet major_version (ACE_OutputCDR& output);
ACE_CDR::Octet minor_version (ACE_OutputCDR& output);
};
+
// ****************************************************************
+
/**
* @class ACE_WChar_Codeset_Translator
*
@@ -1031,6 +1188,7 @@ class ACE_Export ACE_WChar_Codeset_Translator
{
public:
virtual ~ACE_WChar_Codeset_Translator ();
+
virtual ACE_CDR::Boolean read_wchar (ACE_InputCDR&,
ACE_CDR::WChar&) = 0;
virtual ACE_CDR::Boolean read_wstring (ACE_InputCDR&,
@@ -1046,6 +1204,7 @@ public:
virtual ACE_CDR::Boolean write_wchar_array (ACE_OutputCDR&,
const ACE_CDR::WChar*,
ACE_CDR::ULong) = 0;
+
virtual ACE_CDR::ULong ncs () = 0;
virtual ACE_CDR::ULong tcs () = 0;
protected:
@@ -1063,6 +1222,7 @@ protected:
const ACE_CDR::UShort *x);
ACE_CDR::Boolean write_4 (ACE_OutputCDR& output,
const ACE_CDR::ULong *x);
+
/// Efficiently read @a length elements of size @a size each from
/// <input> into <x>; the data must be aligned to <align>.
ACE_CDR::Boolean read_array (ACE_InputCDR& input,
@@ -1070,6 +1230,7 @@ protected:
size_t size,
size_t align,
ACE_CDR::ULong length);
+
/**
* Efficiently write @a length elements of size @a size from <x> into
* <output>. Before inserting the elements enough padding is added
@@ -1081,6 +1242,7 @@ protected:
size_t size,
size_t align,
ACE_CDR::ULong length);
+
/**
* Exposes the stream implementation of <adjust>, this is useful in
* many cases to minimize memory allocations during marshaling.
@@ -1092,30 +1254,40 @@ protected:
size_t size,
size_t align,
char *&buf);
+
/// Used by derived classes to set errors in the CDR stream.
void good_bit (ACE_OutputCDR& out, bool bit);
+
/// Obtain the CDR Stream's major & minor version values.
ACE_CDR::Octet major_version (ACE_InputCDR& input);
ACE_CDR::Octet minor_version (ACE_InputCDR& input);
ACE_CDR::Octet major_version (ACE_OutputCDR& output);
ACE_CDR::Octet minor_version (ACE_OutputCDR& output);
+
};
+
// @@ These operators should not be inlined since they force SString.h
// to be included in this header.
extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os,
const ACE_CString &x);
+
extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is,
ACE_CString &x);
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
# include "ace/CDR_Stream.inl"
#else /* __ACE_INLINE__ */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Not used by CORBA or TAO
extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os,
ACE_CDR::Char x);
// CDR output operators for primitive types
+
extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os,
ACE_CDR::Short x);
extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os,
@@ -1134,7 +1306,9 @@ extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os,
ACE_CDR::Float x);
extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os,
ACE_CDR::Double x);
+
// CDR output operator from helper classes
+
extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os,
ACE_OutputCDR::from_boolean x);
extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os,
@@ -1151,10 +1325,12 @@ extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os,
const ACE_CDR::Char* x);
extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os,
const ACE_CDR::WChar* x);
+
// Not used by CORBA or TAO
extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is,
ACE_CDR::Char &x);
// CDR input operators for primitive types
+
extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is,
ACE_CDR::Short &x);
extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is,
@@ -1173,7 +1349,9 @@ extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is,
ACE_CDR::Float &x);
extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is,
ACE_CDR::Double &x);
+
// CDR input operator from helper classes
+
extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is,
ACE_InputCDR::to_boolean x);
extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is,
@@ -1190,23 +1368,36 @@ extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is,
ACE_CDR::Char*& x);
extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is,
ACE_CDR::WChar*& x);
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* __ACE_INLINE__ */
+
#if defined (GEN_OSTREAM_OPS)
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// ostream insertion operators for debugging code generated from IDL. All
// but these below are either in generated code itself or are unambiguous
// primitive types.
+
ACE_Export std::ostream& operator<< (std::ostream &os,
ACE_OutputCDR::from_boolean x);
+
ACE_Export std::ostream& operator<< (std::ostream &os,
ACE_OutputCDR::from_char x);
+
ACE_Export std::ostream& operator<< (std::ostream &os,
ACE_OutputCDR::from_wchar x);
+
ACE_Export std::ostream& operator<< (std::ostream &os,
ACE_OutputCDR::from_octet x);
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* GEN_OSTREAM_OPS */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_CDR_STREAM_H */
diff --git a/dep/ACE_wrappers/ace/CDR_Stream.inl b/dep/ACE_wrappers/ace/CDR_Stream.inl
index b471c56c6b9..9fef2d8fab0 100644
--- a/dep/ACE_wrappers/ace/CDR_Stream.inl
+++ b/dep/ACE_wrappers/ace/CDR_Stream.inl
@@ -1,51 +1,63 @@
// -*- C++ -*-
//
// $Id: CDR_Stream.inl 82350 2008-07-22 07:36:47Z johnnyw $
+
#include "ace/OS_NS_string.h"
#include "ace/OS_Memory.h"
+
// ****************************************************************
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// implementing the special types
ACE_INLINE
ACE_OutputCDR::from_boolean::from_boolean (ACE_CDR::Boolean b)
: val_ (b)
{
}
+
ACE_INLINE
ACE_InputCDR::to_boolean::to_boolean (ACE_CDR::Boolean &b)
: ref_ (b)
{
}
+
ACE_INLINE
ACE_OutputCDR::from_octet::from_octet (ACE_CDR::Octet o)
: val_ (o)
{
}
+
ACE_INLINE
ACE_InputCDR::to_octet::to_octet (ACE_CDR::Octet &o)
: ref_ (o)
{
}
+
ACE_INLINE
ACE_OutputCDR::from_char::from_char (ACE_CDR::Char c)
: val_ (c)
{
}
+
ACE_INLINE
ACE_InputCDR::to_char::to_char (ACE_CDR::Char &c)
: ref_ (c)
{
}
+
ACE_INLINE
ACE_OutputCDR::from_wchar::from_wchar (ACE_CDR::WChar wc)
: val_ (wc)
{
}
+
ACE_INLINE
ACE_InputCDR::to_wchar::to_wchar (ACE_CDR::WChar &wc)
: ref_ (wc)
{
}
+
ACE_INLINE
ACE_OutputCDR::from_string::from_string (ACE_CDR::Char *s,
ACE_CDR::ULong b,
@@ -55,6 +67,7 @@ ACE_OutputCDR::from_string::from_string (ACE_CDR::Char *s,
nocopy_ (nocopy)
{
}
+
ACE_INLINE
ACE_OutputCDR::from_string::from_string (const ACE_CDR::Char *s,
ACE_CDR::ULong b,
@@ -64,6 +77,7 @@ ACE_OutputCDR::from_string::from_string (const ACE_CDR::Char *s,
nocopy_ (nocopy)
{
}
+
ACE_INLINE
ACE_InputCDR::to_string::to_string (ACE_CDR::Char *&s,
ACE_CDR::ULong b)
@@ -71,6 +85,7 @@ ACE_InputCDR::to_string::to_string (ACE_CDR::Char *&s,
bound_ (b)
{
}
+
ACE_INLINE
ACE_InputCDR::to_string::to_string (const ACE_CDR::Char *&s,
ACE_CDR::ULong b)
@@ -78,6 +93,7 @@ ACE_InputCDR::to_string::to_string (const ACE_CDR::Char *&s,
bound_ (b)
{
}
+
ACE_INLINE
ACE_OutputCDR::from_wstring::from_wstring (ACE_CDR::WChar *ws,
ACE_CDR::ULong b,
@@ -87,6 +103,7 @@ ACE_OutputCDR::from_wstring::from_wstring (ACE_CDR::WChar *ws,
nocopy_ (nocopy)
{
}
+
ACE_INLINE
ACE_OutputCDR::from_wstring::from_wstring (const ACE_CDR::WChar *ws,
ACE_CDR::ULong b,
@@ -96,6 +113,7 @@ ACE_OutputCDR::from_wstring::from_wstring (const ACE_CDR::WChar *ws,
nocopy_ (nocopy)
{
}
+
ACE_INLINE
ACE_InputCDR::to_wstring::to_wstring (ACE_CDR::WChar *&ws,
ACE_CDR::ULong b)
@@ -103,6 +121,7 @@ ACE_InputCDR::to_wstring::to_wstring (ACE_CDR::WChar *&ws,
bound_ (b)
{
}
+
ACE_INLINE
ACE_InputCDR::to_wstring::to_wstring (const ACE_CDR::WChar *&ws,
ACE_CDR::ULong b)
@@ -110,12 +129,15 @@ ACE_InputCDR::to_wstring::to_wstring (const ACE_CDR::WChar *&ws,
bound_ (b)
{
}
+
ACE_INLINE
ACE_InputCDR::Transfer_Contents::Transfer_Contents (ACE_InputCDR &rhs)
: rhs_ (rhs)
{
}
+
// ****************************************************************
+
ACE_INLINE
ACE_OutputCDR::~ACE_OutputCDR (void)
{
@@ -124,39 +146,49 @@ ACE_OutputCDR::~ACE_OutputCDR (void)
ACE_Message_Block::release (this->start_.cont ());
this->start_.cont (0);
}
+
this->current_ = 0;
+
#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
this->monitor_->remove_ref ();
#endif /* ACE_HAS_MONITOR_POINTS==1 */
}
+
ACE_INLINE void
ACE_OutputCDR::reset (void)
{
this->current_ = &this->start_;
this->current_is_writable_ = true;
ACE_CDR::mb_align (&this->start_);
+
#if !defined (ACE_LACKS_CDR_ALIGNMENT)
this->current_alignment_ = 0;
#endif /* ACE_LACKS_CDR_ALIGNMENT */
+
// It is tempting not to remove the memory, but we need to do so to
// release any potential user buffers chained in the continuation
// field.
+
ACE_Message_Block * const cont = this->start_.cont ();
if (cont)
{
ACE_Message_Block::release (cont);
this->start_.cont (0);
}
+
#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
this->monitor_->receive (this->start_.total_size ());
#endif /* ACE_HAS_MONITOR_POINTS==1 */
}
+
// Encode the CDR stream.
+
ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::write_octet (ACE_CDR::Octet x)
{
return this->write_1 (&x);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::write_boolean (ACE_CDR::Boolean x)
{
@@ -167,6 +199,7 @@ ACE_OutputCDR::write_boolean (ACE_CDR::Boolean x)
? static_cast<ACE_CDR::Octet> (1)
: static_cast<ACE_CDR::Octet> (0)));
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::write_char (ACE_CDR::Char x)
{
@@ -177,56 +210,66 @@ ACE_OutputCDR::write_char (ACE_CDR::Char x)
}
return this->char_translator_->write_char (*this, x);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::write_short (ACE_CDR::Short x)
{
ACE_CDR::UShort temp = static_cast<ACE_CDR::UShort> (x);
return this->write_2 (&temp);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::write_ushort (ACE_CDR::UShort x)
{
return this->write_2 (&x);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::write_long (ACE_CDR::Long x)
{
ACE_CDR::ULong temp = static_cast<ACE_CDR::ULong> (x);
return this->write_4 (&temp);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::write_ulong (ACE_CDR::ULong x)
{
return this->write_4 (&x);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::write_longlong (const ACE_CDR::LongLong &x)
{
void const * const temp = &x;
return this->write_8 (reinterpret_cast<ACE_CDR::ULongLong const *> (temp));
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::write_ulonglong (const ACE_CDR::ULongLong &x)
{
return this->write_8 (&x);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::write_float (ACE_CDR::Float x)
{
void const * const temp = &x;
return this->write_4 (reinterpret_cast<ACE_CDR::ULong const *> (temp));
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::write_double (const ACE_CDR::Double &x)
{
void const * const temp = &x;
return this->write_8 (reinterpret_cast<ACE_CDR::ULongLong const *> (temp));
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::write_longdouble (const ACE_CDR::LongDouble &x)
{
return this->write_16 (&x);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::write_string (const ACE_CDR::Char *x)
{
@@ -236,8 +279,10 @@ ACE_OutputCDR::write_string (const ACE_CDR::Char *x)
static_cast<ACE_CDR::ULong> (ACE_OS::strlen (x));
return this->write_string (len, x);
}
+
return this->write_string (0, 0);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::write_wstring (const ACE_CDR::WChar *x)
{
@@ -247,8 +292,10 @@ ACE_OutputCDR::write_wstring (const ACE_CDR::WChar *x)
static_cast<ACE_CDR::ULong> (ACE_OS::strlen (x));
return this->write_wstring (len, x);
}
+
return this->write_wstring (0, 0);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::write_char_array (const ACE_CDR::Char *x,
ACE_CDR::ULong length)
@@ -260,17 +307,20 @@ ACE_OutputCDR::write_char_array (const ACE_CDR::Char *x,
length);
return this->char_translator_->write_char_array (*this, x, length);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::write_wchar_array (const ACE_CDR::WChar* x,
ACE_CDR::ULong length)
{
if (this->wchar_translator_)
return this->wchar_translator_->write_wchar_array (*this, x, length);
+
if (ACE_OutputCDR::wchar_maxbytes_ == 0)
{
errno = EACCES;
return (ACE_CDR::Boolean) (this->good_bit_ = false);
}
+
if (ACE_OutputCDR::wchar_maxbytes_ == sizeof (ACE_CDR::WChar))
return this->write_array (x,
sizeof (ACE_CDR::WChar),
@@ -280,6 +330,7 @@ ACE_OutputCDR::write_wchar_array (const ACE_CDR::WChar* x,
length);
return this->write_wchar_array_i (x,length);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::write_octet_array (const ACE_CDR::Octet* x,
ACE_CDR::ULong length)
@@ -289,6 +340,7 @@ ACE_OutputCDR::write_octet_array (const ACE_CDR::Octet* x,
ACE_CDR::OCTET_ALIGN,
length);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::write_short_array (const ACE_CDR::Short *x,
ACE_CDR::ULong length)
@@ -298,6 +350,7 @@ ACE_OutputCDR::write_short_array (const ACE_CDR::Short *x,
ACE_CDR::SHORT_ALIGN,
length);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::write_ushort_array (const ACE_CDR::UShort *x,
ACE_CDR::ULong length)
@@ -307,6 +360,7 @@ ACE_OutputCDR::write_ushort_array (const ACE_CDR::UShort *x,
ACE_CDR::SHORT_ALIGN,
length);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::write_long_array (const ACE_CDR::Long *x,
ACE_CDR::ULong length)
@@ -316,6 +370,7 @@ ACE_OutputCDR::write_long_array (const ACE_CDR::Long *x,
ACE_CDR::LONG_ALIGN,
length);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::write_ulong_array (const ACE_CDR::ULong *x,
ACE_CDR::ULong length)
@@ -325,6 +380,7 @@ ACE_OutputCDR::write_ulong_array (const ACE_CDR::ULong *x,
ACE_CDR::LONG_ALIGN,
length);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::write_longlong_array (const ACE_CDR::LongLong *x,
ACE_CDR::ULong length)
@@ -334,6 +390,7 @@ ACE_OutputCDR::write_longlong_array (const ACE_CDR::LongLong *x,
ACE_CDR::LONGLONG_ALIGN,
length);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::write_ulonglong_array (const ACE_CDR::ULongLong *x,
ACE_CDR::ULong length)
@@ -343,6 +400,7 @@ ACE_OutputCDR::write_ulonglong_array (const ACE_CDR::ULongLong *x,
ACE_CDR::LONGLONG_ALIGN,
length);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::write_float_array (const ACE_CDR::Float *x,
ACE_CDR::ULong length)
@@ -353,6 +411,7 @@ ACE_OutputCDR::write_float_array (const ACE_CDR::Float *x,
length);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::write_double_array (const ACE_CDR::Double *x,
ACE_CDR::ULong length)
@@ -362,6 +421,7 @@ ACE_OutputCDR::write_double_array (const ACE_CDR::Double *x,
ACE_CDR::LONGLONG_ALIGN,
length);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::write_longdouble_array (const ACE_CDR::LongDouble* x,
ACE_CDR::ULong length)
@@ -371,11 +431,13 @@ ACE_OutputCDR::write_longdouble_array (const ACE_CDR::LongDouble* x,
ACE_CDR::LONGDOUBLE_ALIGN,
length);
}
+
ACE_INLINE bool
ACE_OutputCDR::good_bit (void) const
{
return this->good_bit_;
}
+
ACE_INLINE int
ACE_OutputCDR::adjust (size_t size,
size_t align,
@@ -383,15 +445,19 @@ ACE_OutputCDR::adjust (size_t size,
{
if (!this->current_is_writable_)
return this->grow_and_adjust (size, align, buf);
+
#if !defined (ACE_LACKS_CDR_ALIGNMENT)
size_t const offset =
ACE_align_binary (this->current_alignment_, align)
- this->current_alignment_;
+
buf = this->current_->wr_ptr () + offset;
#else
buf = this->current_->wr_ptr ();
#endif /* ACE_LACKS_CDR_ALIGNMENT */
+
char * const end = buf + size;
+
if (end <= this->current_->end () &&
end >= buf)
{
@@ -399,24 +465,30 @@ ACE_OutputCDR::adjust (size_t size,
this->current_alignment_ += offset + size;
#endif /* ACE_LACKS_CDR_ALIGNMENT */
this->current_->wr_ptr (end);
+
#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
this->monitor_->receive (this->total_length ());
#endif /* ACE_HAS_MONITOR_POINTS==1 */
+
return 0;
}
+
return this->grow_and_adjust (size, align, buf);
}
+
ACE_INLINE int
ACE_OutputCDR::adjust (size_t size, char*& buf)
{
return this->adjust (size, size, buf);
}
+
ACE_INLINE void
ACE_OutputCDR::set_version (ACE_CDR::Octet major, ACE_CDR::Octet minor)
{
this->major_version_ = major;
this->minor_version_ = minor;
}
+
ACE_INLINE void
ACE_OutputCDR::get_version (ACE_CDR::Octet &major, ACE_CDR::Octet &minor)
{
@@ -424,41 +496,49 @@ ACE_OutputCDR::get_version (ACE_CDR::Octet &major, ACE_CDR::Octet &minor)
minor = this->minor_version_;
}
+
ACE_INLINE const ACE_Message_Block*
ACE_OutputCDR::begin (void) const
{
return &this->start_;
}
+
ACE_INLINE const ACE_Message_Block*
ACE_OutputCDR::end (void) const
{
return this->current_->cont ();
}
+
ACE_INLINE const ACE_Message_Block*
ACE_OutputCDR::current (void) const
{
return this->current_;
}
+
ACE_INLINE size_t
ACE_OutputCDR::total_length (void) const
{
return ACE_CDR::total_length (this->begin (), this->end ());
}
+
ACE_INLINE const char*
ACE_OutputCDR::buffer (void) const
{
return this->start_.rd_ptr ();
}
+
ACE_INLINE size_t
ACE_OutputCDR::length (void) const
{
return this->start_.length ();
}
+
ACE_INLINE bool
ACE_OutputCDR::do_byte_swap (void) const
{
return this->do_byte_swap_;
}
+
ACE_INLINE int
ACE_OutputCDR::byte_order (void) const
{
@@ -467,11 +547,13 @@ ACE_OutputCDR::byte_order (void) const
else
return ACE_CDR_BYTE_ORDER;
}
+
ACE_INLINE void
ACE_OutputCDR::reset_byte_order (int byte_order)
{
this->do_byte_swap_ = (byte_order != ACE_CDR_BYTE_ORDER);
}
+
ACE_INLINE size_t
ACE_OutputCDR::current_alignment (void) const
{
@@ -482,6 +564,7 @@ ACE_OutputCDR::current_alignment (void) const
return 0;
#endif /* ACE_LACKS_CDR_ALIGNMENT */
}
+
ACE_INLINE void
ACE_OutputCDR::current_alignment (size_t current_alignment)
{
@@ -492,6 +575,7 @@ ACE_OutputCDR::current_alignment (size_t current_alignment)
return 0;
#endif /* ACE_LACKS_CDR_ALIGNMENT */
}
+
ACE_INLINE int
ACE_OutputCDR::align_write_ptr (size_t alignment)
{
@@ -505,27 +589,33 @@ ACE_OutputCDR::align_write_ptr (size_t alignment)
return 0;
#endif /* ACE_LACKS_CDR_ALIGNMENT */
}
+
ACE_INLINE ACE_Char_Codeset_Translator *
ACE_OutputCDR::char_translator (void) const
{
return this->char_translator_;
}
+
ACE_INLINE ACE_WChar_Codeset_Translator *
ACE_OutputCDR::wchar_translator (void) const
{
return this->wchar_translator_;
}
+
ACE_INLINE void
ACE_OutputCDR::char_translator (ACE_Char_Codeset_Translator * ctran)
{
this->char_translator_ = ctran;
}
+
ACE_INLINE void
ACE_OutputCDR::wchar_translator (ACE_WChar_Codeset_Translator * wctran)
{
this->wchar_translator_ = wctran;
}
+
// ****************************************************************
+
ACE_INLINE
ACE_InputCDR::~ACE_InputCDR (void)
{
@@ -533,11 +623,13 @@ ACE_InputCDR::~ACE_InputCDR (void)
this->monitor_->remove_ref ();
#endif /* ACE_HAS_MONITOR_POINTS==1 */
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::read_octet (ACE_CDR::Octet& x)
{
return this->read_1 (&x);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::read_boolean (ACE_CDR::Boolean& x)
{
@@ -546,6 +638,7 @@ ACE_InputCDR::read_boolean (ACE_CDR::Boolean& x)
x = tmp ? true : false;
return (ACE_CDR::Boolean) this->good_bit_;
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::read_char (ACE_CDR::Char &x)
{
@@ -557,18 +650,21 @@ ACE_InputCDR::read_char (ACE_CDR::Char &x)
return this->char_translator_->read_char (*this, x);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::read_short (ACE_CDR::Short &x)
{
void *temp = &x;
return this->read_2 (reinterpret_cast<ACE_CDR::UShort*> (temp));
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::read_ushort (ACE_CDR::UShort &x)
{
return this->read_2 (&x);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::read_long (ACE_CDR::Long &x)
{
@@ -576,45 +672,53 @@ ACE_InputCDR::read_long (ACE_CDR::Long &x)
return this->read_4 (reinterpret_cast<ACE_CDR::ULong*> (temp));
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::read_ulong (ACE_CDR::ULong &x)
{
return this->read_4 (&x);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::read_longlong (ACE_CDR::LongLong &x)
{
void *temp = &x;
return this->read_8 (reinterpret_cast<ACE_CDR::ULongLong*> (temp));
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::read_ulonglong (ACE_CDR::ULongLong &x)
{
return this->read_8 (&x);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::read_float (ACE_CDR::Float &x)
{
void *temp = &x;
return this->read_4 (reinterpret_cast<ACE_CDR::ULong*> (temp));
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::read_double (ACE_CDR::Double &x)
{
void *temp = &x;
return this->read_8 (reinterpret_cast<ACE_CDR::ULongLong*> (temp));
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::read_longdouble (ACE_CDR::LongDouble &x)
{
return this->read_16 (&x);
}
+
ACE_INLINE size_t
ACE_InputCDR::length (void) const
{
return this->start_.length ();
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::read_char_array (ACE_CDR::Char* x,
ACE_CDR::ULong length)
@@ -626,6 +730,7 @@ ACE_InputCDR::read_char_array (ACE_CDR::Char* x,
this->good_bit_ = false;
return false;
}
+
if (this->char_translator_ == 0)
return this->read_array (x,
ACE_CDR::OCTET_SIZE,
@@ -633,6 +738,7 @@ ACE_InputCDR::read_char_array (ACE_CDR::Char* x,
length);
return this->char_translator_->read_char_array (*this, x, length);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::read_wchar_array (ACE_CDR::WChar* x,
ACE_CDR::ULong length)
@@ -644,6 +750,7 @@ ACE_InputCDR::read_wchar_array (ACE_CDR::WChar* x,
this->good_bit_ = false;
return false;
}
+
if (this->wchar_translator_ != 0)
return this->wchar_translator_->read_wchar_array (*this, x, length);
if (ACE_OutputCDR::wchar_maxbytes_ != sizeof (ACE_CDR::WChar))
@@ -655,6 +762,7 @@ ACE_InputCDR::read_wchar_array (ACE_CDR::WChar* x,
: ACE_CDR::LONG_ALIGN,
length);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::read_octet_array (ACE_CDR::Octet* x,
ACE_CDR::ULong length)
@@ -666,11 +774,13 @@ ACE_InputCDR::read_octet_array (ACE_CDR::Octet* x,
this->good_bit_ = false;
return false;
}
+
return this->read_array (x,
ACE_CDR::OCTET_SIZE,
ACE_CDR::OCTET_ALIGN,
length);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::read_short_array (ACE_CDR::Short *x,
ACE_CDR::ULong length)
@@ -682,11 +792,13 @@ ACE_InputCDR::read_short_array (ACE_CDR::Short *x,
this->good_bit_ = false;
return false;
}
+
return this->read_array (x,
ACE_CDR::SHORT_SIZE,
ACE_CDR::SHORT_ALIGN,
length);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::read_ushort_array (ACE_CDR::UShort *x,
ACE_CDR::ULong length)
@@ -698,11 +810,13 @@ ACE_InputCDR::read_ushort_array (ACE_CDR::UShort *x,
this->good_bit_ = false;
return false;
}
+
return this->read_array (x,
ACE_CDR::SHORT_SIZE,
ACE_CDR::SHORT_ALIGN,
length);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::read_long_array (ACE_CDR::Long *x,
ACE_CDR::ULong length)
@@ -714,11 +828,13 @@ ACE_InputCDR::read_long_array (ACE_CDR::Long *x,
this->good_bit_ = false;
return false;
}
+
return this->read_array (x,
ACE_CDR::LONG_SIZE,
ACE_CDR::LONG_ALIGN,
length);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::read_ulong_array (ACE_CDR::ULong *x,
ACE_CDR::ULong length)
@@ -730,11 +846,13 @@ ACE_InputCDR::read_ulong_array (ACE_CDR::ULong *x,
this->good_bit_ = false;
return false;
}
+
return this->read_array (x,
ACE_CDR::LONG_SIZE,
ACE_CDR::LONG_ALIGN,
length);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::read_longlong_array (ACE_CDR::LongLong *x,
ACE_CDR::ULong length)
@@ -746,11 +864,13 @@ ACE_InputCDR::read_longlong_array (ACE_CDR::LongLong *x,
this->good_bit_ = false;
return false;
}
+
return this->read_array (x,
ACE_CDR::LONGLONG_SIZE,
ACE_CDR::LONGLONG_ALIGN,
length);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::read_ulonglong_array (ACE_CDR::ULongLong *x,
ACE_CDR::ULong length)
@@ -762,11 +882,13 @@ ACE_InputCDR::read_ulonglong_array (ACE_CDR::ULongLong *x,
this->good_bit_ = false;
return false;
}
+
return this->read_array (x,
ACE_CDR::LONGLONG_SIZE,
ACE_CDR::LONGLONG_ALIGN,
length);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::read_float_array (ACE_CDR::Float *x,
ACE_CDR::ULong length)
@@ -778,12 +900,14 @@ ACE_InputCDR::read_float_array (ACE_CDR::Float *x,
this->good_bit_ = false;
return false;
}
+
return this->read_array (x,
ACE_CDR::LONG_SIZE,
ACE_CDR::LONG_ALIGN,
length);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::read_double_array (ACE_CDR::Double *x,
ACE_CDR::ULong length)
@@ -795,11 +919,13 @@ ACE_InputCDR::read_double_array (ACE_CDR::Double *x,
this->good_bit_ = false;
return false;
}
+
return this->read_array (x,
ACE_CDR::LONGLONG_SIZE,
ACE_CDR::LONGLONG_ALIGN,
length);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::read_longdouble_array (ACE_CDR::LongDouble* x,
ACE_CDR::ULong length)
@@ -816,91 +942,108 @@ ACE_InputCDR::read_longdouble_array (ACE_CDR::LongDouble* x,
ACE_CDR::LONGDOUBLE_ALIGN,
length);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::skip_octet (void)
{
ACE_CDR::Octet x;
return this->read_1 (&x);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::skip_char (void)
{
return this->skip_octet (); // sizeof (Char) == sizeof (Octet)
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::skip_boolean (void)
{
return this->skip_octet () && this->good_bit_;
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::skip_ushort (void)
{
ACE_CDR::UShort x;
return this->read_2 (&x);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::skip_short (void)
{
return this->skip_ushort ();
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::skip_ulong (void)
{
ACE_CDR::ULong x;
return this->read_4 (&x);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::skip_long (void)
{
return this->skip_ulong (); // sizeof (Long) == sizeof (ULong)
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::skip_ulonglong (void)
{
ACE_CDR::ULongLong x;
return this->read_8 (&x);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::skip_longlong (void)
{
return this->skip_ulonglong (); // sizeof (LongLong) == sizeof (ULongLong)
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::skip_float (void)
{
return this->skip_ulong (); // sizeof(Float) == sizeof (ULong)
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::skip_double (void)
{
return this->skip_ulonglong (); // sizeof(Double) == sizeof (ULongLong)
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::skip_longdouble (void)
{
ACE_CDR::LongDouble x;
return this->read_16 (&x);
}
+
ACE_INLINE char*
ACE_InputCDR::end (void)
{
return this->start_.end ();
}
+
ACE_INLINE void
ACE_InputCDR::rd_ptr (size_t offset)
{
this->start_.rd_ptr (offset);
}
+
ACE_INLINE char*
ACE_InputCDR::rd_ptr (void)
{
return this->start_.rd_ptr ();
}
+
ACE_INLINE char*
ACE_InputCDR::wr_ptr (void)
{
return this->start_.wr_ptr ();
}
+
ACE_INLINE int
ACE_InputCDR::adjust (size_t size,
size_t align,
@@ -911,107 +1054,126 @@ ACE_InputCDR::adjust (size_t size,
#else
buf = this->rd_ptr ();
#endif /* ACE_LACKS_CDR_ALIGNMENT */
+
char * const end = buf + size;
if (end <= this->wr_ptr ())
{
this->start_.rd_ptr (end);
return 0;
}
+
this->good_bit_ = false;
return -1;
#if defined (ACE_LACKS_CDR_ALIGNMENT)
ACE_UNUSED_ARG (align);
#endif /* ACE_LACKS_CDR_ALIGNMENT */
}
+
ACE_INLINE int
ACE_InputCDR::adjust (size_t size,
char*& buf)
{
return this->adjust (size, size, buf);
}
+
ACE_INLINE const ACE_Message_Block*
ACE_InputCDR::start (void) const
{
return &this->start_;
}
+
ACE_INLINE bool
ACE_InputCDR::good_bit (void) const
{
return this->good_bit_;
}
+
// ****************************************************************
+
ACE_INLINE ACE_CDR::Boolean
operator<< (ACE_OutputCDR &os, ACE_CDR::Char x)
{
os.write_char (x);
return (ACE_CDR::Boolean) os.good_bit ();
}
+
ACE_INLINE ACE_CDR::Boolean
operator<< (ACE_OutputCDR &os, ACE_CDR::Short x)
{
os.write_short (x);
return (ACE_CDR::Boolean) os.good_bit ();
}
+
ACE_INLINE ACE_CDR::Boolean
operator<< (ACE_OutputCDR &os, ACE_CDR::UShort x)
{
os.write_ushort (x);
return (ACE_CDR::Boolean) os.good_bit ();
}
+
ACE_INLINE ACE_CDR::Boolean
operator<< (ACE_OutputCDR &os, ACE_CDR::Long x)
{
os.write_long (x);
return (ACE_CDR::Boolean) os.good_bit ();
}
+
ACE_INLINE ACE_CDR::Boolean
operator<< (ACE_OutputCDR &os, ACE_CDR::ULong x)
{
os.write_ulong (x);
return (ACE_CDR::Boolean) os.good_bit ();
}
+
ACE_INLINE ACE_CDR::Boolean
operator<< (ACE_OutputCDR &os, ACE_CDR::LongLong x)
{
os.write_longlong (x);
return (ACE_CDR::Boolean) os.good_bit ();
}
+
ACE_INLINE ACE_CDR::Boolean
operator<< (ACE_OutputCDR &os, ACE_CDR::ULongLong x)
{
os.write_ulonglong (x);
return (ACE_CDR::Boolean) os.good_bit ();
}
+
ACE_INLINE ACE_CDR::Boolean
operator<< (ACE_OutputCDR &os, ACE_CDR::LongDouble x)
{
os.write_longdouble (x);
return (ACE_CDR::Boolean) os.good_bit ();
}
+
ACE_INLINE ACE_CDR::Boolean
operator<< (ACE_OutputCDR &os, ACE_CDR::Float x)
{
os.write_float (x);
return (ACE_CDR::Boolean) os.good_bit ();
}
+
ACE_INLINE ACE_CDR::Boolean
operator<< (ACE_OutputCDR &os, ACE_CDR::Double x)
{
os.write_double (x);
return (ACE_CDR::Boolean) os.good_bit ();
}
+
ACE_INLINE ACE_CDR::Boolean
operator<< (ACE_OutputCDR &os, const ACE_CDR::Char *x)
{
os.write_string (x);
return (ACE_CDR::Boolean) os.good_bit ();
}
+
ACE_INLINE ACE_CDR::Boolean
operator<< (ACE_OutputCDR &os, const ACE_CDR::WChar *x)
{
os.write_wstring (x);
return (ACE_CDR::Boolean) os.good_bit ();
}
+
// The following use the helper classes
ACE_INLINE ACE_CDR::Boolean
operator<< (ACE_OutputCDR &os, ACE_OutputCDR::from_boolean x)
@@ -1019,130 +1181,157 @@ operator<< (ACE_OutputCDR &os, ACE_OutputCDR::from_boolean x)
(void) os.write_boolean (x.val_);
return (ACE_CDR::Boolean) os.good_bit ();
}
+
ACE_INLINE ACE_CDR::Boolean
operator<< (ACE_OutputCDR &os, ACE_OutputCDR::from_char x)
{
os.write_char (x.val_);
return (ACE_CDR::Boolean) os.good_bit ();
}
+
ACE_INLINE ACE_CDR::Boolean
operator<< (ACE_OutputCDR &os, ACE_OutputCDR::from_wchar x)
{
os.write_wchar (x.val_);
return (ACE_CDR::Boolean) os.good_bit ();
}
+
ACE_INLINE ACE_CDR::Boolean
operator<< (ACE_OutputCDR &os, ACE_OutputCDR::from_octet x)
{
os.write_octet (x.val_);
return (ACE_CDR::Boolean) os.good_bit ();
}
+
ACE_INLINE ACE_CDR::Boolean
operator<< (ACE_OutputCDR &os, ACE_OutputCDR::from_string x)
{
ACE_CDR::ULong len = 0;
+
if (x.val_ != 0)
{
len = static_cast<ACE_CDR::ULong> (ACE_OS::strlen (x.val_));
}
+
os.write_string (len, x.val_);
return
(ACE_CDR::Boolean) (os.good_bit () && (!x.bound_ || len <= x.bound_));
}
+
ACE_INLINE ACE_CDR::Boolean
operator<< (ACE_OutputCDR &os, ACE_OutputCDR::from_wstring x)
{
ACE_CDR::ULong len = 0;
+
if (x.val_ != 0)
{
len = static_cast<ACE_CDR::ULong> (ACE_OS::strlen (x.val_));
}
+
os.write_wstring (len, x.val_);
return
(ACE_CDR::Boolean) (os.good_bit () && (!x.bound_ || len <= x.bound_));
}
+
// ****************************************************************
+
ACE_INLINE ACE_CDR::Boolean
operator>> (ACE_InputCDR &is, ACE_CDR::Char &x)
{
return is.read_char (x) && is.good_bit ();
}
+
ACE_INLINE ACE_CDR::Boolean
operator>> (ACE_InputCDR &is, ACE_CDR::Short &x)
{
return is.read_short (x) && is.good_bit ();
}
+
ACE_INLINE ACE_CDR::Boolean
operator>> (ACE_InputCDR &is, ACE_CDR::UShort &x)
{
return is.read_ushort (x) && is.good_bit ();
}
+
ACE_INLINE ACE_CDR::Boolean
operator>>(ACE_InputCDR &is, ACE_CDR::Long &x)
{
return is.read_long (x) && is.good_bit ();
}
+
ACE_INLINE ACE_CDR::Boolean
operator>> (ACE_InputCDR &is, ACE_CDR::ULong &x)
{
return is.read_ulong (x) && is.good_bit ();
}
+
ACE_INLINE ACE_CDR::Boolean
operator>> (ACE_InputCDR& is, ACE_CDR::LongLong &x)
{
return is.read_longlong (x) && is.good_bit ();
}
+
ACE_INLINE ACE_CDR::Boolean
operator>> (ACE_InputCDR& is, ACE_CDR::ULongLong &x)
{
return is.read_ulonglong (x) && is.good_bit ();
}
+
ACE_INLINE ACE_CDR::Boolean
operator>> (ACE_InputCDR& is, ACE_CDR::LongDouble &x)
{
return is.read_longdouble (x) && is.good_bit ();
}
+
ACE_INLINE ACE_CDR::Boolean
operator>> (ACE_InputCDR &is, ACE_CDR::Float &x)
{
return is.read_float (x) && is.good_bit ();
}
+
ACE_INLINE ACE_CDR::Boolean
operator>> (ACE_InputCDR &is, ACE_CDR::Double &x)
{
return is.read_double (x) && is.good_bit ();
}
+
ACE_INLINE ACE_CDR::Boolean
operator>> (ACE_InputCDR &is, ACE_CDR::Char *&x)
{
return is.read_string (x) && is.good_bit ();
}
+
ACE_INLINE ACE_CDR::Boolean
operator>> (ACE_InputCDR &is, ACE_CDR::WChar *&x)
{
return is.read_wstring (x) && is.good_bit ();
}
+
// The following use the helper classes
ACE_INLINE ACE_CDR::Boolean
operator>> (ACE_InputCDR &is, ACE_InputCDR::to_boolean x)
{
return is.read_boolean (x.ref_);
}
+
ACE_INLINE ACE_CDR::Boolean
operator>> (ACE_InputCDR &is, ACE_InputCDR::to_char x)
{
return is.read_char (x.ref_) && is.good_bit ();
}
+
ACE_INLINE ACE_CDR::Boolean
operator>> (ACE_InputCDR &is, ACE_InputCDR::to_wchar x)
{
return is.read_wchar (x.ref_) && is.good_bit ();
}
+
ACE_INLINE ACE_CDR::Boolean
operator>> (ACE_InputCDR &is, ACE_InputCDR::to_octet x)
{
return is.read_octet (x.ref_) && is.good_bit ();
}
+
ACE_INLINE ACE_CDR::Boolean
operator>> (ACE_InputCDR &is, ACE_InputCDR::to_string x)
{
@@ -1153,6 +1342,7 @@ operator>> (ACE_InputCDR &is, ACE_InputCDR::to_string x)
&& (!x.bound_
|| ACE_OS::strlen (x.val_) <= x.bound_));
}
+
ACE_INLINE ACE_CDR::Boolean
operator>> (ACE_InputCDR &is, ACE_InputCDR::to_wstring x)
{
@@ -1163,88 +1353,103 @@ operator>> (ACE_InputCDR &is, ACE_InputCDR::to_wstring x)
&& (!x.bound_
|| ACE_OS::strlen (x.val_) <= x.bound_));
}
+
// ***************************************************************************
// We must define these methods here because they use the "read_*" inlined
// methods of the ACE_InputCDR class
// ***************************************************************************
+
ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::append_boolean (ACE_InputCDR &stream)
{
ACE_CDR::Boolean x;
return stream.read_boolean (x) ? this->write_boolean (x) : false;
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::append_char (ACE_InputCDR &stream)
{
ACE_CDR::Char x;
return stream.read_char (x) ? this->write_char (x) : false;
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::append_wchar (ACE_InputCDR &stream)
{
ACE_CDR::WChar x;
return stream.read_wchar (x) ? this->write_wchar (x) : false;
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::append_octet (ACE_InputCDR &stream)
{
ACE_CDR::Octet x;
return stream.read_octet (x) ? this->write_octet (x) : false;
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::append_short (ACE_InputCDR &stream)
{
ACE_CDR::Short x;
return stream.read_short (x) ? this->write_short (x) : false;
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::append_ushort (ACE_InputCDR &stream)
{
ACE_CDR::UShort x;
return stream.read_ushort (x) ? this->write_ushort (x) : false;
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::append_long (ACE_InputCDR &stream)
{
ACE_CDR::Long x;
return stream.read_long (x) ? this->write_long (x) : false;
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::append_ulong (ACE_InputCDR &stream)
{
ACE_CDR::ULong x;
return stream.read_ulong (x) ? this->write_ulong (x) : false;
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::append_longlong (ACE_InputCDR &stream)
{
ACE_CDR::LongLong x;
return stream.read_longlong (x) ? this->write_longlong (x) : false;
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::append_ulonglong (ACE_InputCDR &stream)
{
ACE_CDR::ULongLong x;
return stream.read_ulonglong (x) ? this->write_ulonglong (x) : false;
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::append_float (ACE_InputCDR &stream)
{
ACE_CDR::Float x;
return stream.read_float (x) ? this->write_float (x) : false;
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::append_double (ACE_InputCDR &stream)
{
ACE_CDR::Double x;
return stream.read_double (x) ? this->write_double (x) : false;
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::append_longdouble (ACE_InputCDR &stream)
{
ACE_CDR::LongDouble x;
return stream.read_longdouble (x) ? this->write_longdouble (x) : false;
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::append_string (ACE_InputCDR &stream)
{
@@ -1254,6 +1459,7 @@ ACE_OutputCDR::append_string (ACE_InputCDR &stream)
delete [] x;
return flag;
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::append_wstring (ACE_InputCDR &stream)
{
@@ -1263,21 +1469,25 @@ ACE_OutputCDR::append_wstring (ACE_InputCDR &stream)
delete [] x;
return flag;
}
+
ACE_INLINE void
ACE_InputCDR::reset_byte_order (int byte_order)
{
this->do_byte_swap_ = (byte_order != ACE_CDR_BYTE_ORDER);
}
+
ACE_INLINE bool
ACE_InputCDR::do_byte_swap (void) const
{
return this->do_byte_swap_;
}
+
ACE_INLINE int
ACE_InputCDR::byte_order (void) const
{
return this->do_byte_swap () ? !ACE_CDR_BYTE_ORDER : ACE_CDR_BYTE_ORDER;
}
+
ACE_INLINE int
ACE_InputCDR::align_read_ptr (size_t alignment)
{
@@ -1287,60 +1497,72 @@ ACE_InputCDR::align_read_ptr (size_t alignment)
#else
char *buf = this->rd_ptr ();
#endif /* ACE_LACKS_CDR_ALIGNMENT */
+
if (buf <= this->wr_ptr ())
{
this->start_.rd_ptr (buf);
return 0;
}
+
this->good_bit_ = false;
return -1;
}
+
ACE_INLINE void
ACE_InputCDR::set_version (ACE_CDR::Octet major, ACE_CDR::Octet minor)
{
this->major_version_ = major;
this->minor_version_ = minor;
}
+
ACE_INLINE void
ACE_InputCDR::get_version (ACE_CDR::Octet &major, ACE_CDR::Octet &minor)
{
major = this->major_version_;
minor = this->minor_version_;
}
+
ACE_INLINE ACE_Char_Codeset_Translator *
ACE_InputCDR::char_translator (void) const
{
return this->char_translator_;
}
+
ACE_INLINE ACE_WChar_Codeset_Translator *
ACE_InputCDR::wchar_translator (void) const
{
return this->wchar_translator_;
}
+
ACE_INLINE void
ACE_InputCDR::char_translator (ACE_Char_Codeset_Translator * ctran)
{
this->char_translator_ = ctran;
}
+
ACE_INLINE void
ACE_InputCDR::wchar_translator (ACE_WChar_Codeset_Translator * wctran)
{
this->wchar_translator_ = wctran;
}
+
// ****************************************************************
+
ACE_INLINE ACE_CDR::Boolean
ACE_Char_Codeset_Translator::read_1 (ACE_InputCDR& input,
ACE_CDR::Octet *x)
{
return input.read_1 (x);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_Char_Codeset_Translator::write_1 (ACE_OutputCDR& output,
const ACE_CDR::Octet *x)
{
return output.write_1 (x);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_Char_Codeset_Translator::read_array (ACE_InputCDR& in,
void* x,
@@ -1350,6 +1572,7 @@ ACE_Char_Codeset_Translator::read_array (ACE_InputCDR& in,
{
return in.read_array (x, size, align, length);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_Char_Codeset_Translator::write_array (ACE_OutputCDR& out,
const void *x,
@@ -1359,6 +1582,7 @@ ACE_Char_Codeset_Translator::write_array (ACE_OutputCDR& out,
{
return out.write_array(x, size, align, length);
}
+
ACE_INLINE int
ACE_Char_Codeset_Translator::adjust (ACE_OutputCDR& out,
size_t size,
@@ -1367,68 +1591,81 @@ ACE_Char_Codeset_Translator::adjust (ACE_OutputCDR& out,
{
return out.adjust(size, align, buf);
}
+
ACE_INLINE void
ACE_Char_Codeset_Translator::good_bit (ACE_OutputCDR& out, bool bit)
{
out.good_bit_ = bit;
}
+
ACE_INLINE ACE_CDR::Octet
ACE_Char_Codeset_Translator::major_version (ACE_InputCDR& input)
{
return input.major_version_;
}
+
ACE_INLINE ACE_CDR::Octet
ACE_Char_Codeset_Translator::minor_version (ACE_InputCDR& input)
{
return input.minor_version_;
}
+
ACE_INLINE ACE_CDR::Octet
ACE_Char_Codeset_Translator::major_version (ACE_OutputCDR& output)
{
return output.major_version_;
}
+
ACE_INLINE ACE_CDR::Octet
ACE_Char_Codeset_Translator::minor_version (ACE_OutputCDR& output)
{
return output.minor_version_;
}
+
// ****************************************************************
+
ACE_INLINE ACE_CDR::Boolean
ACE_WChar_Codeset_Translator::read_1 (ACE_InputCDR& input,
ACE_CDR::Octet *x)
{
return input.read_1 (x);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_WChar_Codeset_Translator::read_2 (ACE_InputCDR& input,
ACE_CDR::UShort *x)
{
return input.read_2 (x);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_WChar_Codeset_Translator::read_4 (ACE_InputCDR& input,
ACE_CDR::ULong *x)
{
return input.read_4 (x);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_WChar_Codeset_Translator::write_1 (ACE_OutputCDR& output,
const ACE_CDR::Octet *x)
{
return output.write_1 (x);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_WChar_Codeset_Translator::write_2 (ACE_OutputCDR& output,
const ACE_CDR::UShort *x)
{
return output.write_2 (x);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_WChar_Codeset_Translator::write_4 (ACE_OutputCDR& output,
const ACE_CDR::ULong *x)
{
return output.write_4 (x);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_WChar_Codeset_Translator::read_array (ACE_InputCDR& in,
void* x,
@@ -1438,6 +1675,7 @@ ACE_WChar_Codeset_Translator::read_array (ACE_InputCDR& in,
{
return in.read_array (x, size, align, length);
}
+
ACE_INLINE ACE_CDR::Boolean
ACE_WChar_Codeset_Translator::write_array (ACE_OutputCDR& out,
const void *x,
@@ -1447,6 +1685,7 @@ ACE_WChar_Codeset_Translator::write_array (ACE_OutputCDR& out,
{
return out.write_array(x, size, align, length);
}
+
ACE_INLINE int
ACE_WChar_Codeset_Translator::adjust (ACE_OutputCDR& out,
size_t size,
@@ -1455,29 +1694,35 @@ ACE_WChar_Codeset_Translator::adjust (ACE_OutputCDR& out,
{
return out.adjust(size, align, buf);
}
+
ACE_INLINE void
ACE_WChar_Codeset_Translator::good_bit (ACE_OutputCDR& out, bool bit)
{
out.good_bit_ = bit;
}
+
ACE_INLINE ACE_CDR::Octet
ACE_WChar_Codeset_Translator::major_version (ACE_InputCDR& input)
{
return input.major_version_;
}
+
ACE_INLINE ACE_CDR::Octet
ACE_WChar_Codeset_Translator::minor_version (ACE_InputCDR& input)
{
return input.minor_version_;
}
+
ACE_INLINE ACE_CDR::Octet
ACE_WChar_Codeset_Translator::major_version (ACE_OutputCDR& output)
{
return output.major_version_;
}
+
ACE_INLINE ACE_CDR::Octet
ACE_WChar_Codeset_Translator::minor_version (ACE_OutputCDR& output)
{
return output.minor_version_;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/CE_Screen_Output.h b/dep/ACE_wrappers/ace/CE_Screen_Output.h
index 5c66b2d7f70..e4a3e3d92b0 100644
--- a/dep/ACE_wrappers/ace/CE_Screen_Output.h
+++ b/dep/ACE_wrappers/ace/CE_Screen_Output.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file CE_Screen_Output.h
@@ -8,21 +9,29 @@
* @author Si Mong Park <spark@ociweb.com>
*/
//=============================================================================
+
#ifndef ACE_CE_SCREEN_OUTPUT_H
#define ACE_CE_SCREEN_OUTPUT_H
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
#pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_WINCE)
+
#include "ace/Log_Msg_Callback.h"
#include "ace/Log_Record.h"
+
namespace
{
const ACE_TCHAR endl[] = ACE_TEXT("\r\n");
const ACE_TCHAR tab[] = ACE_TEXT("\t");
}
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_CE_Screen_Output
*
@@ -39,14 +48,21 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
class ACE_Export ACE_CE_Screen_Output : public ACE_Log_Msg_Callback
{
public:
+
ACE_CE_Screen_Output (HWND hEdit);
+
ACE_CE_Screen_Output (void);
+
virtual ~ACE_CE_Screen_Output();
+
/// Implementation of pure virtual function from ACE_Log_Msg_Callback.
virtual void log (ACE_Log_Record &log_record);
+
/// Interface to specify active window handle.
void SetOutputWindow (HWND hWnd);
+
void clear (void);
+
/// Stream insertion operator that performs actual print out.
/**
* @note This is the only one operator that performs output. All
@@ -55,26 +71,40 @@ public:
*/
ACE_CE_Screen_Output& operator << (ACE_TCHAR*);
ACE_CE_Screen_Output& operator << (const ACE_TCHAR*);
+
ACE_CE_Screen_Output& operator << (ACE_ANTI_TCHAR* output);
ACE_CE_Screen_Output& operator << (const ACE_ANTI_TCHAR* output);
+
ACE_CE_Screen_Output& operator << (char output);
ACE_CE_Screen_Output& operator << (unsigned char output);
+
ACE_CE_Screen_Output& operator << (unsigned short output);
+
ACE_CE_Screen_Output& operator << (int output);
ACE_CE_Screen_Output& operator << (unsigned int output);
+
ACE_CE_Screen_Output& operator << (float output);
+
ACE_CE_Screen_Output& operator << (long output);
ACE_CE_Screen_Output& operator << (unsigned long output);
+
ACE_CE_Screen_Output& operator << (FILE* pFile);
+
private:
+
ACE_CE_Screen_Output (ACE_CE_Screen_Output&);
+
private:
+
HWND handler_;
+
/// FILE pointer that used to save output to file. This class does
/// not own the file handler pointer.
FILE* pFile_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif // ACE_HAS_WINCE
#endif // ACE_CE_SCREEN_OUTPUT_H
diff --git a/dep/ACE_wrappers/ace/CORBA_macros.h b/dep/ACE_wrappers/ace/CORBA_macros.h
index 48dd70132c0..ce45893b0a2 100644
--- a/dep/ACE_wrappers/ace/CORBA_macros.h
+++ b/dep/ACE_wrappers/ace/CORBA_macros.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
// ============================================================================
/**
* @file CORBA_macros.h
@@ -15,16 +16,24 @@
* @author Carlos O'Ryan <coryan@uci.edu>, et al.
*/
// ============================================================================
+
// Macros for handling CORBA exceptions.
+
#ifndef ACE_CORBA_MACROS_H
#define ACE_CORBA_MACROS_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
# if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
# endif /* ACE_LACKS_PRAGMA_ONCE */
+
#define ACE_ENV_POLLUTE_NAMES
+
#include "ace/Exception_Macros.h"
+
// The Windows MFC exception mechanism requires that a caught CException
// (including the CMemoryException in use here) be freed using its Delete()
// method. Thus, when MFC is in use and we're catching exceptions as a result
@@ -37,7 +46,9 @@
#if !defined (ACE_del_bad_alloc)
# define ACE_del_bad_alloc
#endif
+
#if !defined (ACE_LACKS_DEPRECATED_MACROS)
+
// If you wish to you use these macros for emulating exceptions on
// platforms which lack native exception support, you need to do the
// following:
@@ -71,36 +82,46 @@
// the macros should still work if you defined your adapter class as
// ACE_EXCEPTION_TYPE.
+
// The following macros assume that an environment variable is passed
// in/out of each function that can throw an exception. The type of the
// environment variable is defined by ACE_ENV_TYPE.
+
#if !defined (ACE_ENV_TYPE)
# define ACE_ENV_TYPE CORBA::Environment
#endif /* ACE_ENV_TYPE */
+
// The name of the variable is defined by ACE_TRY_ENV. Below is the name
// that we use by default. If you wish to change it you can redefine
// ACE_TRY_ENV to change the default name. Also ACE_ADOPT_ENV allows the
// use of non-standard name within a scope.
+
#if !defined (ACE_TRY_ENV)
# define ACE_TRY_ENV _ACE_CORBA_Environment_variable
#endif /* ACE_TRY_ENV */
+
// The base type of Exception from which all the other exception types are
// derived. You can set this to any type as you please. By default, it is
// set to CORBA::Exception.
+
#if !defined (ACE_EXCEPTION_TYPE)
# define ACE_EXCEPTION_TYPE CORBA::Exception
#endif /* ACE_EXCEPTION_TYPE */
+
// This method is used to get the default value of the Environment
// variable. In the case of TAO, this variable is part of the TSS ORB
// resources and the method TAO_default_environment() returns the
// Environment variable.
+
#if !defined (ACE_DEFAULT_GET_ENV_METHOD)
# define ACE_DEFAULT_GET_ENV_METHOD TAO_default_environment
#endif /* ACE_DEFAULT_GET_ENV_METHOD */
+
// This is the exception caught by ACE_CATCHANY.
#if !defined (ACE_ANY_EXCEPTION)
# define ACE_ANY_EXCEPTION ex
#endif /* ACE_ANY_EXCEPTION */
+
// Declare a new environment variable on the stack. The type of the
// environment variable is determined by ACE_ENV_TYPE.
#if defined (ACE_USES_NATIVE_EXCEPTIONS)
@@ -111,33 +132,44 @@
# define ACE_DECLARE_NEW_ENV \
ACE_ENV_TYPE ACE_TRY_ENV
#endif /* ACE_USES_NATIVE_EXCEPTIONS */
+
// Provided for backward compatibility purposes. Don't use it in new code.
// Use the definition above along with defining ACE_ENV_TYPE.
+
#if defined (ACE_ENV_POLLUTE_NAMES)
# define ACE_DECLARE_NEW_CORBA_ENV ACE_DECLARE_NEW_ENV
#endif /* ACE_ENV_POLLUTE_NAMES */
+
#if defined (ACE_USES_NATIVE_EXCEPTIONS)
// -----------------------------------------------------------------
+
// Provided for backward compatibility purposes. Don't use it in new code.
#if defined (ACE_ENV_POLLUTE_NAMES)
# define ACE_ADOPT_CORBA_ENV(ENV)
#endif /* ACE_ENV_POLLUTE_NAMES */
+
#define ACE_ADOPT_ENV (ENV)
+
// No need to check. Native exceptions handle the control flow
// automatically when an exception occurs.
# define ACE_CHECK
+
// Used when the function requires a return value.
# define ACE_CHECK_RETURN(RETV)
+
// ACE_THROW_INT should not be used by the user.
# define ACE_THROW_INT(EXCEPTION) \
throw EXCEPTION
+
// Throwing an exception is easy. These two macros should _NOT_ be
// used within try blocks.
# define ACE_THROW(EXCEPTION) \
throw EXCEPTION
+
// Throwing an exception when the function requires a return value.
# define ACE_THROW_RETURN(EXCEPTION,RETV) \
throw EXCEPTION
+
// For compilers with native exceptions, we can simply use try to try. ;-)
// do {} while (0) is required to avoid compilation warnings.
# define ACE_TRY \
@@ -155,45 +187,58 @@
{ \
try \
{
+
// No need to check for exceptions within try block for compilers with
// native exceptions.
# define ACE_TRY_CHECK
# define ACE_TRY_CHECK_EX(LABEL)
+
// Likewise, throwing exceptions within try blocks is easy.
# define ACE_TRY_THROW(EXCEPTION) throw EXCEPTION
# define ACE_TRY_THROW_EX(EXCEPTION,LABEL) throw EXCEPTION
+
// Same thing for catch.
# define ACE_CATCH(EXCEPTION,VAR) \
} \
catch (EXCEPTION & VAR) \
{ \
ACE_UNUSED_ARG (VAR);
+
# define ACE_CATCHANY \
ACE_CATCH(ACE_EXCEPTION_TYPE, ACE_ANY_EXCEPTION)
+
# define ACE_CATCHALL \
} \
catch (...) \
{
+
# if defined (ACE_HAS_DEPRECATED_ACE_RETHROW)
# define ACE_RETHROW throw
# endif /* ACE_HAS_DEPRECATED_ACE_RETHROW */
+
// Rethrowing the exception from catch blocks.
# define ACE_RE_THROW throw
# define ACE_RE_THROW_EX(LABEL) throw
+
// Close the catch block.
# define ACE_ENDTRY \
} \
} while (0)
+
#else /* ! ACE_USES_NATIVE_EXCEPTIONS */
// -----------------------------------------------------------------
+
// When handling compilers without native exceptions, things get a bit
// hairy. Exceptions are simulated using ACE_ENV_TYPE. The trick here is to
// make sure the flow-of-control can simulate the case when native
// exceptions occur...
+
#if defined (ACE_ENV_POLLUTE_NAMES)
# define ACE_ADOPT_CORBA_ENV(ENV) ACE_ENV_TYPE &ACE_TRY_ENV = ENV
#endif /* ACE_ENV_POLLUTE_NAMES */
+
# define ACE_ADOPT_ENV(ENV) ACE_ENV_TYPE &ACE_TRY_ENV = ENV
+
// Follow every statement that could throw exceptions with ACE_CHECK or
// ACE_CHECK_RETURN. These two macros should _NOT_ be used within try
// blocks. Use ACE_TRY_CHECK or ACE_TRY_CHECK_EX instead.
@@ -204,8 +249,10 @@
# define ACE_CHECK_RETURN(RETV) \
if (ACE_TRY_ENV . exception () != 0) \
return RETV
+
// ACE_THROW_INT should not be used by the user.
# define ACE_THROW_INT(EXCEPTION) ACE_TRY_ENV.exception (new EXCEPTION)
+
// Throwing exceptions will inevitably cause a return from the current
// function. These two macros should _NOT_ be used within try blocks. Use
// ACE_TRY_THROW or ACE_TRY_THROW_EX instead.
@@ -215,12 +262,14 @@
ACE_TRY_ENV.exception (new EXCEPTION); \
return; \
} while (0)
+
# define ACE_THROW_RETURN(EXCEPTION,RETV) \
do \
{ \
ACE_TRY_ENV.exception (new EXCEPTION); \
return RETV; \
} while (0)
+
// ACE_TRY sets up flags to control program flow. ACE_TRY_FLAG acts like a
// one-shot flip-flop. When an exception occurs (detected using
// ACE_TRY_CHECK,) ACE_TRY_FLAG will be reset and the control goes back
@@ -236,6 +285,7 @@
ACE_TRY_LABEL: \
if (ACE_TRY_FLAG) \
do {
+
// ACE_TRY_NEW_ENV functions like the macro ACE_TRY but defines a new
// ACE_ENV_TYPE variable ACE_TRY_ENV. It is most often used in the outer
// most function where no ACE_TRY_ENV is available.
@@ -247,6 +297,7 @@
ACE_TRY_LABEL: \
if (ACE_TRY_FLAG) \
do {
+
// ACE_TRY_EX works exactly like ACE_TRY macro except the label used in the
// try block is customizable to avoid name clashing. It should be used when
// nested try blocks or multiple try blocks are required, in the same
@@ -258,6 +309,7 @@
ACE_TRY_LABEL ## LABEL: \
if (ACE_TRY_FLAG) \
do {
+
// Check for exceptions within try blocks.
# define ACE_TRY_CHECK \
{ \
@@ -267,6 +319,7 @@
goto ACE_TRY_LABEL; \
} \
}
+
// Checking exception within EX try blocks.
# define ACE_TRY_CHECK_EX(LABEL) \
{ \
@@ -276,6 +329,7 @@
goto ACE_TRY_LABEL ## LABEL; \
} \
}
+
// Throwing exception within TRY blocks.
# define ACE_TRY_THROW(EXCEPTION) \
{ \
@@ -283,12 +337,14 @@
ACE_TRY_FLAG = 0; \
goto ACE_TRY_LABEL; \
}
+
# define ACE_TRY_THROW_EX(EXCEPTION,LABEL) \
{ \
ACE_TRY_ENV.exception (new EXCEPTION); \
ACE_TRY_FLAG = 0; \
goto ACE_TRY_LABEL ## LABEL; \
}
+
// When exceptions occur or try block finishes execution without exception,
// control will continue in the catch block. This macro first checks if
// there's any uncaught exception left. If all the conditions are met, we
@@ -310,19 +366,23 @@
TYPE &VAR = *TYPE::_downcast (ACE_CAUGHT_ENV.exception ()); \
ACE_UNUSED_ARG (VAR); \
ACE_TRY_ENV.clear ();
+
// ACE_CATCHANY uses ACE_CATCH to catch all exceptions derived from
// ACE_EXCEPTION_TYPE
# define ACE_CATCHANY ACE_CATCH (ACE_EXCEPTION_TYPE, ACE_ANY_EXCEPTION)
+
// Since there's no other exception for compilers without exception
// support, we simply catch all ACE_EXCEPTION_TYPE exceptions for
// ACE_CATCHALL.
# define ACE_CATCHALL ACE_CATCHANY
+
# if defined (ACE_HAS_DEPRECATED_ACE_RETHROW)
# define ACE_RETHROW \
do \
ACE_TRY_ENV = ACE_CAUGHT_ENV; \
while (0)
# endif /* ACE_HAS_DEPRECATED_ACE_RETHROW */
+
// Rethrowing exception within catch blocks. Notice that we depend on the
// ACE_CHECK/ACE_CHECK_RETURN following the ACE_ENDTRY, or ACE_TRY_CHECK/
// ACE_TRY_CHECK_EX following the ACE_ENDTRY when the catch block is within
@@ -337,6 +397,7 @@
ACE_TRY_ENV = ACE_CAUGHT_ENV; \
goto ACE_TRY_LABEL ## LABEL; \
} while (0)
+
// Close the try block. Since exceptions may not get caught, and exceptions
// can also be rethrown from the catch block, it's always a good idea to
// follow ACE_ENDTRY with ACE_CHECK or ACE_TRY_CHECK (depending on the
@@ -344,37 +405,53 @@
# define ACE_ENDTRY \
} while (0); \
} while (0)
+
#endif /* ! ACE_USES_NATIVE_EXCEPTIONS */
+
#endif /* !ACE_LACKS_DEPRECATED_MACROS */
+
// ACE_HAS_EXCEPTIONS is not the same as ACE_NEW_THROWS_EXCEPTIONS.
#if defined(ACE_NEW_THROWS_EXCEPTIONS)
+
# if defined (ACE_HAS_NEW_NOTHROW)
+
# define ACE_NEW_THROW_EX(POINTER,CONSTRUCTOR,EXCEPTION) \
do { POINTER = new (ACE_nothrow) CONSTRUCTOR; \
if (POINTER == 0) { throw EXCEPTION; } \
} while (0)
+
# else
+
# define ACE_NEW_THROW_EX(POINTER,CONSTRUCTOR,EXCEPTION) \
do { try { POINTER = new CONSTRUCTOR; } \
catch (ACE_bad_alloc) { ACE_del_bad_alloc throw EXCEPTION; } \
} while (0)
+
# endif /* ACE_HAS_NEW_NOTHROW */
+
#else /* ! ACE_NEW_THROWS_EXCEPTIONS */
+
# define ACE_NEW_THROW_EX(POINTER,CONSTRUCTOR,EXCEPTION) \
do { POINTER = new CONSTRUCTOR; \
if (POINTER == 0) { throw EXCEPTION; } \
} while (0)
+
#endif /* ACE_NEW_THROWS_EXCEPTIONS */
+
# define ACE_GUARD_THROW_EX(MUTEX,OBJ,LOCK,EXCEPTION) \
ACE_Guard< MUTEX > OBJ (LOCK); \
if (OBJ.locked () == 0) throw EXCEPTION;
+
# define ACE_READ_GUARD_THROW_EX(MUTEX,OBJ,LOCK,EXCEPTION) \
ACE_Read_Guard< MUTEX > OBJ (LOCK); \
if (OBJ.locked () == 0) throw EXCEPTION;
+
# define ACE_WRITE_GUARD_THROW_EX(MUTEX,OBJ,LOCK,EXCEPTION) \
ACE_Write_Guard< MUTEX > OBJ (LOCK); \
if (OBJ.locked () == 0) throw EXCEPTION;
+
#if !defined (ACE_LACKS_DEPRECATED_MACROS)
+
//@{
/**
* @name Native C++ exceptions portability macros.
@@ -384,20 +461,24 @@
* hide the presence of the ACE_ENV_TYPE argument, but they collaborate
* with the ACE_TRY_* macros to emulate the try/catch blocks.
*/
+
/// Define a macro to emit code only when ACE_ENV_TYPE is used
#if !defined (ACE_USES_NATIVE_EXCEPTIONS) || defined (ACE_ENV_BKWD_COMPAT)
# define ACE_ENV_EMIT_CODE(X) X
#else
# define ACE_ENV_EMIT_CODE(X)
#endif /* ACE_USES_NATIVE_EXCEPTIONS && ! ACE_ENV_BKWD_COMPAT */
+
/// Another macro to emit code only when ACE_ENV_TYPE is used
#if !defined (ACE_USES_NATIVE_EXCEPTIONS) || defined (ACE_ENV_BKWD_COMPAT)
# define ACE_ENV_EMIT_CODE2(X,Y) X,Y
#else
# define ACE_ENV_EMIT_CODE2(X,Y)
#endif /* ACE_USES_NATIVE_EXCEPTIONS && ! ACE_ENV_BKWD_COMPAT */
+
/// Helper macro
#define ACE_ENV_EMIT_DUMMY
+
/// Declare a ACE_ENV_TYPE argument as the last argument of a
/// function
/**
@@ -412,6 +493,7 @@
#define ACE_ENV_ARG_DECL \
ACE_ENV_EMIT_CODE2(ACE_ENV_EMIT_DUMMY, \
ACE_ENV_TYPE &ACE_TRY_ENV)
+
/// Declare a ACE_ENV_TYPE argument with the default value obtained from
/// the ORB/application.
/**
@@ -423,6 +505,7 @@
ACE_ENV_EMIT_CODE2(ACE_ENV_EMIT_DUMMY, \
ACE_ENV_TYPE &ACE_TRY_ENV = \
ACE_DEFAULT_GET_ENV_METHOD ())
+
/// Declare a ACE_ENV_TYPE argument that is not used by the
/// function definition.
/**
@@ -432,10 +515,12 @@
#define ACE_ENV_ARG_DECL_NOT_USED \
ACE_ENV_EMIT_CODE2(ACE_ENV_EMIT_DUMMY, \
ACE_ENV_TYPE &)
+
/// Declare a ACE_ENV_TYPE argument for methods that do not take any other
/// parameters
#define ACE_ENV_SINGLE_ARG_DECL \
ACE_ENV_EMIT_CODE(ACE_ENV_TYPE &ACE_TRY_ENV)
+
/// Declare a ACE_ENV_TYPE argument with a default value for methods that
/// do not take any other parameters. The name of the default environment
/// getter method needs to be changed when switching ORBs or when used in
@@ -443,38 +528,49 @@
#define ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS \
ACE_ENV_EMIT_CODE(ACE_ENV_TYPE &ACE_TRY_ENV = \
ACE_DEFAULT_GET_ENV_METHOD ())
+
/// Declare a ACE_ENV_TYPE argument for methods which don't use it.
#define ACE_ENV_SINGLE_ARG_DECL_NOT_USED \
ACE_ENV_EMIT_CODE(ACE_ENV_TYPE &)
+
/// Use the ACE_ENV_TYPE argument in a nested call
#define ACE_ENV_ARG_PARAMETER \
ACE_ENV_EMIT_CODE2(ACE_ENV_EMIT_DUMMY, \
ACE_TRY_ENV)
+
/// Use the ACE_ENV_TYPE argument in a nested call, assuming that the
/// called function takes only the ACE_TRY_ENV argument.
#define ACE_ENV_SINGLE_ARG_PARAMETER \
ACE_ENV_EMIT_CODE(ACE_TRY_ENV)
+
/// Eliminate unused argument warnings about ACE_TRY_ENV
#define ACE_ENV_ARG_NOT_USED \
ACE_ENV_EMIT_CODE(ACE_UNUSED_ARG(ACE_TRY_ENV))
//@}
+
#if !defined (ACE_USES_NATIVE_EXCEPTIONS)
// This thing can be moved above when we drop ACE_ENV_BKWD_COMPAT.
# define ACE_ENV_RAISE(ex) ACE_TRY_ENV.exception (ex)
#else
# define ACE_ENV_RAISE(ex) (ex)->_raise ()
#endif /* ACE_USES_NATIVE_EXCEPTIONS */
+
// ============================================================
+
// Print out a TAO exception. This is not CORBA compliant.
# define ACE_PRINT_TAO_EXCEPTION(EX,INFO) \
EX._tao_print_exception (INFO)
+
// Print out a CORBA exception. There is not portable way to
// dump a CORBA exception. If you are using other ORB implementation,
// redefine the macro to get what you want.
# if !defined ACE_PRINT_EXCEPTION
# define ACE_PRINT_EXCEPTION(EX,INFO) ACE_PRINT_TAO_EXCEPTION(EX,INFO)
# endif /* ACE_PRINT_EXCEPTION */
+
#endif /* !ACE_LACKS_DEPRECATED_MACROS */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_CORBA_MACROS_H */
diff --git a/dep/ACE_wrappers/ace/Cache_Map_Manager_T.h b/dep/ACE_wrappers/ace/Cache_Map_Manager_T.h
index a6200bfc449..1476597ab54 100644
--- a/dep/ACE_wrappers/ace/Cache_Map_Manager_T.h
+++ b/dep/ACE_wrappers/ace/Cache_Map_Manager_T.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Cache_Map_Manager_T.h
@@ -8,27 +9,39 @@
* @author Kirthika Parameswaran <kirthika@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_CACHE_MAP_MANAGER_T_H
#define ACE_CACHE_MAP_MANAGER_T_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Default_Constants.h"
#include "ace/Global_Macros.h"
#include "ace/Pair_T.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward declaration.
class ACE_Allocator;
+
#define ACE_Cache_Map_Iterator ACMI
#define ACE_Cache_Map_Reverse_Iterator ACMRI
+
template <class KEY, class VALUE, class IMPLEMENTATION, class CACHING_STRATEGY, class ATTRIBUTES>
class ACE_Cache_Map_Iterator;
+
template <class KEY, class VALUE, class REVERSE_IMPLEMENTATION, class CACHING_STRATEGY, class ATTRIBUTES>
class ACE_Cache_Map_Reverse_Iterator;
+
// For linkers that cant grok long names.
#define ACE_Cache_Map_Manager ACMM
+
/**
* @class ACE_Cache_Map_Manager
*
@@ -48,45 +61,57 @@ template <class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class RE
class ACE_Cache_Map_Manager
{
public:
+
// = Traits.
typedef KEY key_type;
typedef VALUE mapped_type;
typedef CMAP_TYPE map_type;
typedef CACHING_STRATEGY caching_strategy_type;
+
typedef ITERATOR_IMPL ITERATOR_IMPLEMENTATION;
typedef REVERSE_ITERATOR_IMPL REVERSE_ITERATOR_IMPLEMENTATION;
+
friend class ACE_Cache_Map_Iterator<KEY, VALUE, ITERATOR_IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES>;
friend class ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, REVERSE_ITERATOR_IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES>;
+
// = ACE-style iterator typedefs.
typedef ACE_Cache_Map_Iterator<KEY, VALUE, ITERATOR_IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES>
ITERATOR;
typedef ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, REVERSE_ITERATOR_IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES>
REVERSE_ITERATOR;
+
// = STL-style iterator typedefs.
typedef ITERATOR
iterator;
typedef REVERSE_ITERATOR
reverse_iterator;
+
/**
* The actual value mapped to the key in the map. The <attributes>
* are used by the strategy and is transparent to the user of this
* class.
*/
typedef ACE_Pair<VALUE, ATTRIBUTES> CACHE_VALUE;
+
// = Initialization and termination methods.
+
/// Initialize a <Cache_Map_Manager> with <caching_strategy> and
/// @a size entries.
ACE_Cache_Map_Manager (CACHING_STRATEGY &caching_strategy,
size_t size = ACE_DEFAULT_MAP_SIZE,
ACE_Allocator *alloc = 0);
+
/// Close down a <Cache_Map_Manager> and release dynamically allocated
/// resources.
virtual ~ACE_Cache_Map_Manager (void);
+
/// Initialize a cache with size @a length.
int open (size_t length = ACE_DEFAULT_MAP_SIZE,
ACE_Allocator *alloc = 0);
+
/// Close down a cache and release dynamically allocated resources.
int close (void);
+
/**
* Associate @a key with @a value. If @a key is already in the CMAP_TYPE
* then the ENTRY is not changed. Returns 0 if a new entry is bound
@@ -95,6 +120,7 @@ public:
*/
int bind (const KEY &key,
const VALUE &value);
+
/**
* Lookup entry<key,value> in the cache. If it is not found, returns -1.
* If the @a key is located in the CMAP_TYPE object, the CACHING_STRATEGY is
@@ -104,6 +130,7 @@ public:
*/
int find (const KEY &key,
VALUE &value);
+
/**
* Lookup entry<key,value> in the cache. If it is not found, returns -1.
* If the @a key is located in the CMAP_TYPE object, the CACHING_STRATEGY is
@@ -112,6 +139,7 @@ public:
* 0 (success).
*/
int find (const KEY &key);
+
/**
* Reassociate the @a key with @a value. If the @a key already exists
* in the cache then returns 1, on a new bind returns 0 and returns
@@ -119,6 +147,7 @@ public:
*/
int rebind (const KEY &key,
const VALUE &value);
+
/**
* Reassociate @a key with @a value, storing the old value into the
* "out" parameter @a old_value. The function fails if @a key is not
@@ -129,6 +158,7 @@ public:
int rebind (const KEY &key,
const VALUE &value,
VALUE &old_value);
+
/**
* Reassociate @a key with @a value, storing the old key and value
* into the "out" parameters @a old_key and @a old_value. The
@@ -141,6 +171,7 @@ public:
const VALUE &value,
KEY &old_key,
VALUE &old_value);
+
/**
* Associate @a key with @a value if and only if @a key is not in the
* cache. If @a key is already in the cache, then the @a value
@@ -151,41 +182,59 @@ public:
*/
int trybind (const KEY &key,
VALUE &value);
+
/// Remove @a key from the cache.
int unbind (const KEY &key);
+
/// Remove @a key from the cache, and return the @a value associated with
/// @a key.
int unbind (const KEY &key,
VALUE &value);
+
/// Remove entries from the cache depending upon the strategy.
int purge (void);
+
/// Return the current size of the cache.
size_t current_size (void) const;
+
/// Return the total size of the cache.
size_t total_size (void) const;
+
/// Dumps the state of the object.
void dump (void) const;
+
// = STL styled iterator factory functions.
+
/// Return forward iterator.
ITERATOR begin (void);
ITERATOR end (void);
+
/// Return reverse iterator.
REVERSE_ITERATOR rbegin (void);
REVERSE_ITERATOR rend (void);
+
/// The map managed by the Cache_Map_Manager.
CMAP_TYPE &map (void);
+
/// The caching strategy used on the cache.
CACHING_STRATEGY &caching_strategy (void);
+
protected:
+
/// The underlying map which needs to be cached.
CMAP_TYPE map_;
+
/// The strategy to be followed for caching entries in the map.
CACHING_STRATEGY &caching_strategy_;
+
private:
+
// = Disallow these operations.
ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Cache_Map_Manager<KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES> &))
ACE_UNIMPLEMENTED_FUNC (ACE_Cache_Map_Manager (const ACE_Cache_Map_Manager<KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES> &))
+
};
+
/**
* @class ACE_Cache_Map_Iterator
*
@@ -197,7 +246,9 @@ private:
template <class KEY, class VALUE, class IMPLEMENTATION, class CACHING_STRATEGY, class ATTRIBUTES>
class ACE_Cache_Map_Iterator
{
+
public:
+
// = Traits.
/// The actual value mapped to the key in the cache. The <attributes>
/// are used by the strategy and is transperant to the cache user.
@@ -205,44 +256,62 @@ public:
value_type;
typedef ACE_Pair <VALUE, ATTRIBUTES>
CACHE_VALUE;
+
// = Initialisation and termination methods.
+
ACE_Cache_Map_Iterator (const IMPLEMENTATION &iterator_impl);
+
/// Copy constructor.
ACE_Cache_Map_Iterator (const ACE_Cache_Map_Iterator<KEY, VALUE, IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES> &rhs);
+
virtual ~ACE_Cache_Map_Iterator (void);
+
// = Iteration methods.
+
/// assignment operator.
ACE_Cache_Map_Iterator <KEY, VALUE, IMPLEMENTATION,
CACHING_STRATEGY, ATTRIBUTES> &operator=
(const ACE_Cache_Map_Iterator<KEY, VALUE, IMPLEMENTATION,
CACHING_STRATEGY, ATTRIBUTES> &rhs);
+
/// Comparision operators.
bool operator== (const ACE_Cache_Map_Iterator<KEY, VALUE, IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES> &rhs) const;
bool operator!= (const ACE_Cache_Map_Iterator<KEY, VALUE, IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES> &rhs) const;
+
/// Returns a reference to the internal element @c this is pointing
/// to.
ACE_Reference_Pair<KEY, VALUE> operator* (void) const;
+
// = STL styled iteration, compare, and reference functions.
+
/// Prefix advance
ACE_Cache_Map_Iterator<KEY, VALUE, IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES> &operator++ (void);
+
/// Postfix advance.
ACE_Cache_Map_Iterator<KEY, VALUE, IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES> operator++ (int);
+
/// Prefix reverse.
ACE_Cache_Map_Iterator<KEY, VALUE, IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES> &operator-- (void);
+
/// Postfix reverse.
ACE_Cache_Map_Iterator<KEY, VALUE, IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES> operator-- (int);
+
/// Returns the iterator of the internal map in the custody of the
/// Cache_Map_Manager.
IMPLEMENTATION &iterator_implementation (void);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
/// The actual iterator which iterates internally on the map
/// belonging to the Cache_Map_Manager.
IMPLEMENTATION iterator_implementation_;
};
+
/**
* @class ACE_Cache_Map_Reverse_Iterator
*
@@ -255,59 +324,83 @@ template <class KEY, class VALUE, class REVERSE_IMPLEMENTATION, class CACHING_ST
class ACE_Cache_Map_Reverse_Iterator
{
public:
+
// = Traits.
/// The actual value mapped to the key in the cache. The <attributes>
/// are used by the strategy and is transperant to the cache user.
typedef ACE_Reference_Pair<KEY, VALUE> value_type;
typedef ACE_Pair <VALUE, ATTRIBUTES> CACHE_VALUE;
+
// = Initialisation and termination methods.
+
ACE_Cache_Map_Reverse_Iterator (const REVERSE_IMPLEMENTATION &iterator_impl);
+
/// Copy constructor.
ACE_Cache_Map_Reverse_Iterator (const ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, REVERSE_IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES> &rhs);
+
~ACE_Cache_Map_Reverse_Iterator (void);
+
// = Iteration methods.
+
/// Assignment operator.
ACE_Cache_Map_Reverse_Iterator <KEY, VALUE, REVERSE_IMPLEMENTATION,
CACHING_STRATEGY, ATTRIBUTES> &operator=
(const ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, REVERSE_IMPLEMENTATION,
CACHING_STRATEGY, ATTRIBUTES> &rhs);
+
/// Comparision operators.
bool operator== (const ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, REVERSE_IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES> &rhs) const;
bool operator!= (const ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, REVERSE_IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES> &rhs) const;
+
/// Returns a reference to the internal element @c this is pointing
/// to.
ACE_Reference_Pair<KEY, VALUE> operator* (void) const;
+
// = STL styled iteration, compare, and reference functions.
+
/// Prefix advance
ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, REVERSE_IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES> &operator++ (void);
+
/// Postfix advance.
ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, REVERSE_IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES> operator++ (int);
+
/// Prefix reverse.
ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, REVERSE_IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES> &operator-- (void);
+
/// Postfix reverse.
ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, REVERSE_IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES> operator-- (int);
+
/// Returns the iterator of the internal map in the custody of the
/// Cache_Map_Manager.
REVERSE_IMPLEMENTATION &iterator_implementation (void);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
/// The actual iterator which iterates internally on the map
/// belonging to the Cache_Map_Manager.
REVERSE_IMPLEMENTATION reverse_iterator_implementation_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Cache_Map_Manager_T.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Cache_Map_Manager_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Cache_Map_Manager_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_CACHE_MAP_MANAGER_T_H */
diff --git a/dep/ACE_wrappers/ace/Cache_Map_Manager_T.inl b/dep/ACE_wrappers/ace/Cache_Map_Manager_T.inl
index d850b314f32..bcd48bd33e9 100644
--- a/dep/ACE_wrappers/ace/Cache_Map_Manager_T.inl
+++ b/dep/ACE_wrappers/ace/Cache_Map_Manager_T.inl
@@ -1,43 +1,52 @@
// -*- C++ -*-
//
//$Id: Cache_Map_Manager_T.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template <class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> ACE_INLINE int
ACE_Cache_Map_Manager<KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::purge (void)
{
return this->caching_strategy ().caching_utility ().clear_cache (this->map_,
this->caching_strategy ().purge_percent ());
}
+
template <class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> ACE_INLINE size_t
ACE_Cache_Map_Manager<KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::current_size (void) const
{
return this->map_.current_size ();
}
+
template <class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> ACE_INLINE size_t
ACE_Cache_Map_Manager<KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::total_size (void) const
{
return this->map_.total_size ();
}
+
template <class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> ACE_INLINE CMAP_TYPE &
ACE_Cache_Map_Manager<KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::map (void)
{
return this->map_;
}
+
template <class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> ACE_INLINE CACHING_STRATEGY &
ACE_Cache_Map_Manager<KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::caching_strategy (void)
{
return this->caching_strategy_;
}
+
template <class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> ACE_INLINE ACE_Cache_Map_Iterator<KEY, VALUE, ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>
ACE_Cache_Map_Manager<KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::begin (void)
{
return ITERATOR (this->map_.begin ());
}
+
template <class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> ACE_INLINE ACE_Cache_Map_Iterator<KEY, VALUE, ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>
ACE_Cache_Map_Manager<KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::end (void)
{
return ITERATOR (this->map_.end ());
}
+
template <class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> ACE_INLINE ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>
ACE_Cache_Map_Manager<KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::rbegin (void)
{
@@ -48,28 +57,34 @@ ACE_Cache_Map_Manager<KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMP
{
return REVERSE_ITERATOR (this->map_.rend ());
}
+
////////////////////////////////////////////////////////////////////////////////
+
template <class KEY, class VALUE, class IMPLEMENTATION, class CACHING_STRATEGY, class ATTRIBUTES> ACE_INLINE
ACE_Cache_Map_Iterator<KEY, VALUE, IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES>::ACE_Cache_Map_Iterator (const ACE_Cache_Map_Iterator <KEY, VALUE, IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES> &rhs)
: iterator_implementation_ (rhs.iterator_implementation_)
{
}
+
template <class KEY, class VALUE, class IMPLEMENTATION, class CACHING_STRATEGY, class ATTRIBUTES> ACE_INLINE ACE_Cache_Map_Iterator<KEY, VALUE, IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES> &
ACE_Cache_Map_Iterator<KEY, VALUE, IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES>::operator= (const ACE_Cache_Map_Iterator<KEY, VALUE, IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES> &rhs)
{
this->iterator_implementation_ = rhs.iterator_implementation_;
return *this;
}
+
template <class KEY, class VALUE, class IMPLEMENTATION, class CACHING_STRATEGY, class ATTRIBUTES> ACE_INLINE bool
ACE_Cache_Map_Iterator<KEY, VALUE, IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES>::operator== (const ACE_Cache_Map_Iterator<KEY, VALUE, IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES> &rhs) const
{
return this->iterator_implementation_ == rhs.iterator_implementation_;
}
+
template <class KEY, class VALUE, class IMPLEMENTATION, class CACHING_STRATEGY, class ATTRIBUTES> ACE_INLINE bool
ACE_Cache_Map_Iterator<KEY, VALUE, IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES>::operator!= (const ACE_Cache_Map_Iterator<KEY, VALUE, IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES> &rhs) const
{
return this->iterator_implementation_ != rhs.iterator_implementation_;
}
+
template <class KEY, class VALUE, class IMPLEMENTATION, class CACHING_STRATEGY, class ATTRIBUTES> ACE_INLINE ACE_Reference_Pair<KEY, VALUE>
ACE_Cache_Map_Iterator<KEY, VALUE, IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES>::operator* (void) const
{
@@ -77,6 +92,7 @@ ACE_Cache_Map_Iterator<KEY, VALUE, IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES>
(*this->iterator_implementation_).int_id_.first ());
return retn;
}
+
template <class KEY, class VALUE, class IMPLEMENTATION, class CACHING_STRATEGY, class ATTRIBUTES> ACE_INLINE
ACE_Cache_Map_Iterator<KEY, VALUE, IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES> &
ACE_Cache_Map_Iterator<KEY, VALUE, IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES>::operator++ (void)
@@ -84,6 +100,7 @@ ACE_Cache_Map_Iterator<KEY, VALUE, IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES>
++this->iterator_implementation_;
return *this;
}
+
template <class KEY, class VALUE, class IMPLEMENTATION, class CACHING_STRATEGY, class ATTRIBUTES> ACE_INLINE
ACE_Cache_Map_Iterator<KEY, VALUE, IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES>
ACE_Cache_Map_Iterator<KEY, VALUE, IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES>::operator++ (int)
@@ -92,6 +109,7 @@ ACE_Cache_Map_Iterator<KEY, VALUE, IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES>
++this->iterator_implementation_;
return retn;
}
+
template <class KEY, class VALUE, class IMPLEMENTATION, class CACHING_STRATEGY, class ATTRIBUTES> ACE_INLINE
ACE_Cache_Map_Iterator<KEY, VALUE, IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES> &
ACE_Cache_Map_Iterator<KEY, VALUE, IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES>::operator-- (void)
@@ -99,6 +117,7 @@ ACE_Cache_Map_Iterator<KEY, VALUE, IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES>
--this->iterator_implementation_;
return *this;
}
+
template <class KEY, class VALUE, class IMPLEMENTATION, class CACHING_STRATEGY, class ATTRIBUTES> ACE_INLINE
ACE_Cache_Map_Iterator<KEY, VALUE, IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES>
ACE_Cache_Map_Iterator<KEY, VALUE, IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES>::operator-- (int)
@@ -107,6 +126,7 @@ ACE_Cache_Map_Iterator<KEY, VALUE, IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES>
--this->iterator_implementation_;
return retn;
}
+
template <class KEY, class VALUE, class IMPLEMENTATION, class CACHING_STRATEGY, class ATTRIBUTES> ACE_INLINE void
ACE_Cache_Map_Iterator<KEY, VALUE, IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES>::dump (void) const
{
@@ -114,42 +134,51 @@ ACE_Cache_Map_Iterator<KEY, VALUE, IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES>
this->iterator_implementation_.dump ();
#endif /* ACE_HAS_DUMP */
}
+
template <class KEY, class VALUE, class IMPLEMENTATION, class CACHING_STRATEGY, class ATTRIBUTES> ACE_INLINE
ACE_Cache_Map_Iterator<KEY, VALUE, IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES>::ACE_Cache_Map_Iterator (const IMPLEMENTATION &iterator_impl)
: iterator_implementation_ (iterator_impl)
{
}
+
template <class KEY, class VALUE, class IMPLEMENTATION, class CACHING_STRATEGY, class ATTRIBUTES> ACE_INLINE IMPLEMENTATION &
ACE_Cache_Map_Iterator<KEY, VALUE, IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES>::iterator_implementation (void)
{
return this->iterator_implementation_;
}
+
////////////////////////////////////////////////////////////////////////////////
+
template <class KEY, class VALUE, class REVERSE_IMPLEMENTATION, class CACHING_STRATEGY, class ATTRIBUTES> ACE_INLINE
ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, REVERSE_IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES>::ACE_Cache_Map_Reverse_Iterator (const ACE_Cache_Map_Reverse_Iterator <KEY, VALUE, REVERSE_IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES> &rhs)
: reverse_iterator_implementation_ (rhs.reverse_iterator_implementation_)
{
}
+
template <class KEY, class VALUE, class REVERSE_IMPLEMENTATION, class CACHING_STRATEGY, class ATTRIBUTES> ACE_INLINE
ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, REVERSE_IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES>::~ACE_Cache_Map_Reverse_Iterator (void)
{
}
+
template <class KEY, class VALUE, class REVERSE_IMPLEMENTATION, class CACHING_STRATEGY, class ATTRIBUTES> ACE_INLINE ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, REVERSE_IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES> &
ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, REVERSE_IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES>::operator= (const ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, REVERSE_IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES> &rhs)
{
this->reverse_iterator_implementation_ = rhs.reverse_iterator_implementation_;
return *this;
}
+
template <class KEY, class VALUE, class REVERSE_IMPLEMENTATION, class CACHING_STRATEGY, class ATTRIBUTES> ACE_INLINE bool
ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, REVERSE_IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES>::operator== (const ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, REVERSE_IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES> &rhs) const
{
return this->reverse_iterator_implementation_ == rhs.reverse_iterator_implementation_;
}
+
template <class KEY, class VALUE, class REVERSE_IMPLEMENTATION, class CACHING_STRATEGY, class ATTRIBUTES> ACE_INLINE bool
ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, REVERSE_IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES>::operator!= (const ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, REVERSE_IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES> &rhs) const
{
return this->reverse_iterator_implementation_ != rhs.reverse_iterator_implementation_;
}
+
template <class KEY, class VALUE, class REVERSE_IMPLEMENTATION, class CACHING_STRATEGY, class ATTRIBUTES> ACE_INLINE ACE_Reference_Pair<KEY, VALUE>
ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, REVERSE_IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES>::operator* (void) const
{
@@ -157,6 +186,7 @@ ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, REVERSE_IMPLEMENTATION, CACHING_STRAT
(*this->reverse_iterator_implementation_).int_id_.first ());
return retv;
}
+
template <class KEY, class VALUE, class REVERSE_IMPLEMENTATION, class CACHING_STRATEGY, class ATTRIBUTES> ACE_INLINE
ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, REVERSE_IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES> &
ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, REVERSE_IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES>::operator++ (void)
@@ -164,6 +194,7 @@ ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, REVERSE_IMPLEMENTATION, CACHING_STRAT
++this->reverse_iterator_implementation_;
return *this;
}
+
template <class KEY, class VALUE, class REVERSE_IMPLEMENTATION, class CACHING_STRATEGY, class ATTRIBUTES> ACE_INLINE
ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, REVERSE_IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES>
ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, REVERSE_IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES>::operator++ (int)
@@ -172,6 +203,7 @@ ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, REVERSE_IMPLEMENTATION, CACHING_STRAT
++this->reverse_iterator_implementation_;
return retn;
}
+
template <class KEY, class VALUE, class REVERSE_IMPLEMENTATION, class CACHING_STRATEGY, class ATTRIBUTES> ACE_INLINE
ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, REVERSE_IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES> &
ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, REVERSE_IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES>::operator-- (void)
@@ -179,6 +211,7 @@ ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, REVERSE_IMPLEMENTATION, CACHING_STRAT
--this->reverse_iterator_implementation_;
return *this;
}
+
template <class KEY, class VALUE, class REVERSE_IMPLEMENTATION, class CACHING_STRATEGY, class ATTRIBUTES> ACE_INLINE
ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, REVERSE_IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES>
ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, REVERSE_IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES>::operator-- (int)
@@ -188,6 +221,7 @@ ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, REVERSE_IMPLEMENTATION, CACHING_STRAT
return retn;
}
+
template <class KEY, class VALUE, class REVERSE_IMPLEMENTATION, class CACHING_STRATEGY, class ATTRIBUTES> ACE_INLINE void
ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, REVERSE_IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES>::dump (void) const
{
@@ -195,14 +229,17 @@ ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, REVERSE_IMPLEMENTATION, CACHING_STRAT
this->reverse_iterator_implementation_.dump ();
#endif /* ACE_HAS_DUMP */
}
+
template <class KEY, class VALUE, class REVERSE_IMPLEMENTATION, class CACHING_STRATEGY, class ATTRIBUTES> ACE_INLINE
ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, REVERSE_IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES>::ACE_Cache_Map_Reverse_Iterator (const REVERSE_IMPLEMENTATION &iterator_impl)
: reverse_iterator_implementation_(iterator_impl)
{
}
+
template <class KEY, class VALUE, class REVERSE_IMPLEMENTATION, class CACHING_STRATEGY, class ATTRIBUTES> ACE_INLINE REVERSE_IMPLEMENTATION &
ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, REVERSE_IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES>::iterator_implementation (void)
{
return this->reverse_iterator_implementation_;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Cached_Connect_Strategy_T.h b/dep/ACE_wrappers/ace/Cached_Connect_Strategy_T.h
index 0c077c77e06..9f3227b54f1 100644
--- a/dep/ACE_wrappers/ace/Cached_Connect_Strategy_T.h
+++ b/dep/ACE_wrappers/ace/Cached_Connect_Strategy_T.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Cached_Connect_Strategy_T.h
@@ -8,21 +9,29 @@
* @author Kirthika Parameswaran <kirthika@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef CACHED_CONNECT_STRATEGY_T_H
#define CACHED_CONNECT_STRATEGY_T_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Strategies_T.h"
#include "ace/Hash_Cache_Map_Manager_T.h"
#include "ace/Caching_Strategies_T.h"
#include "ace/Functor_T.h"
#include "ace/Pair_T.h"
+
// For linkers which cant grok long names...
#define ACE_Cached_Connect_Strategy_Ex ACCSE
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Cached_Connect_Strategy_Ex
*
@@ -48,19 +57,24 @@ public:
ACE_Recycling_Strategy<SVC_HANDLER> *rec_s = 0,
MUTEX *lock = 0,
int delete_lock = 0);
+
/// Destructor
virtual ~ACE_Cached_Connect_Strategy_Ex (void);
+
/// Explicit purging of connection entries from the connection cache.
virtual int purge_connections (void);
+
/// Mark as closed (non-locking version). This is used during the cleanup of the
/// connections purged.
virtual int mark_as_closed_i (const void *recycling_act);
+
/**
* Since g++ version < 2.8 arent happy with templates, this special
* method had to be devised to avoid memory leaks and perform
* cleanup of the <connection_cache_>.
*/
void cleanup (void);
+
// = Typedefs for managing the map
typedef ACE_Refcounted_Hash_Recyclable<ACE_PEER_CONNECTOR_ADDR>
REFCOUNTED_HASH_RECYCLABLE_ADDRESS;
@@ -74,6 +88,7 @@ public:
typedef typename CONNECTION_CACHE::CACHE_ENTRY CONNECTION_CACHE_ENTRY;
typedef typename CONNECTION_CACHE::key_type KEY;
typedef typename CONNECTION_CACHE::mapped_type VALUE;
+
typedef ACE_Recyclable_Handler_Cleanup_Strategy<REFCOUNTED_HASH_RECYCLABLE_ADDRESS,
ACE_Pair<SVC_HANDLER *, ATTRIBUTES>,
ACE_Hash_Map_Manager_Ex<REFCOUNTED_HASH_RECYCLABLE_ADDRESS,
@@ -82,25 +97,34 @@ public:
ACE_Equal_To<REFCOUNTED_HASH_RECYCLABLE_ADDRESS>,
MUTEX> >
CLEANUP_STRATEGY;
+
typedef ACE_Cached_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX>
CCSBASE;
+
// = Accessor.
CACHING_STRATEGY &caching_strategy (void);
+
protected:
+
/// Find an idle handle.
int find (ACE_Refcounted_Hash_Recyclable<ACE_PEER_CONNECTOR_ADDR> &search_addr,
ACE_Hash_Map_Entry<ACE_Refcounted_Hash_Recyclable<ACE_PEER_CONNECTOR_ADDR>, ACE_Pair<SVC_HANDLER *, ATTRIBUTES> > *&entry);
+
/// Remove from cache (non-locking version).
virtual int purge_i (const void *recycling_act);
+
/// Add to cache (non-locking version).
virtual int cache_i (const void *recycling_act);
+
/// Get/Set <recycle_state> (non-locking version).
virtual int recycle_state_i (const void *recycling_act,
ACE_Recyclable_State new_state);
virtual ACE_Recyclable_State recycle_state_i (const void *recycling_act) const;
+
/// Cleanup hint and reset <*act_holder> to zero if <act_holder != 0>.
virtual int cleanup_hint_i (const void *recycling_act,
void **act_holder);
+
// = Helpers
int check_hint_i (SVC_HANDLER *&sh,
const ACE_PEER_CONNECTOR_ADDR &remote_addr,
@@ -111,6 +135,7 @@ protected:
int perms,
ACE_Hash_Map_Entry<ACE_Refcounted_Hash_Recyclable<ACE_PEER_CONNECTOR_ADDR>, ACE_Pair<SVC_HANDLER *, ATTRIBUTES> > *&entry,
int &found);
+
virtual int find_or_create_svc_handler_i (SVC_HANDLER *&sh,
const ACE_PEER_CONNECTOR_ADDR &remote_addr,
ACE_Time_Value *timeout,
@@ -120,6 +145,7 @@ protected:
int perms,
ACE_Hash_Map_Entry<ACE_Refcounted_Hash_Recyclable<ACE_PEER_CONNECTOR_ADDR>, ACE_Pair<SVC_HANDLER *, ATTRIBUTES> > *&entry,
int &found);
+
virtual int connect_svc_handler_i (SVC_HANDLER *&sh,
const ACE_PEER_CONNECTOR_ADDR &remote_addr,
ACE_Time_Value *timeout,
@@ -128,6 +154,7 @@ protected:
int flags,
int perms,
int &found);
+
/**
* Connection of the svc_handler with the remote host. This method
* also encapsulates the connection done with auto_purging under the
@@ -144,12 +171,16 @@ protected:
int reuse_addr,
int flags,
int perms);
+
/// Table that maintains the cache of connected SVC_HANDLERs.
CONNECTION_CACHE connection_cache_;
};
+
/////////////////////////////////////////////////////////////////////////////
+
// For linkers which cant grok long names...
#define ACE_Bounded_Cached_Connect_Strategy ABCCS
+
/**
* @class ACE_Bounded_Cached_Connect_Strategy
*
@@ -173,12 +204,16 @@ template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1,
class ACE_Bounded_Cached_Connect_Strategy
: public ACE_Cached_Connect_Strategy_Ex<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX>
{
+
typedef ACE_Cached_Connect_Strategy_Ex<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX>
CCSEBASE;
+
// = Typedefs for managing the map
typedef ACE_Refcounted_Hash_Recyclable<ACE_PEER_CONNECTOR_ADDR>
REFCOUNTED_HASH_RECYCLABLE_ADDRESS;
+
public:
+
/// Constructor
ACE_Bounded_Cached_Connect_Strategy (size_t max_size,
CACHING_STRATEGY &caching_s,
@@ -187,11 +222,15 @@ public:
ACE_Recycling_Strategy<SVC_HANDLER> *rec_s = 0,
MUTEX *lock = 0,
int delete_lock = 0);
+
/// Destructor
virtual ~ACE_Bounded_Cached_Connect_Strategy (void);
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
+
virtual int find_or_create_svc_handler_i (SVC_HANDLER *&sh,
const ACE_PEER_CONNECTOR_ADDR &remote_addr,
ACE_Time_Value *timeout,
@@ -202,17 +241,23 @@ protected:
ACE_Hash_Map_Entry<ACE_Refcounted_Hash_Recyclable<ACE_PEER_CONNECTOR_ADDR>,
ACE_Pair<SVC_HANDLER *, ATTRIBUTES> > *&entry,
int &found);
+
protected:
+
/// max items in the cache, used as a bound for the creation of svc_handlers.
size_t max_size_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Cached_Connect_Strategy_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Cached_Connect_Strategy_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
#endif /* CACHED_CONNECT_STRATEGY_T_H */
diff --git a/dep/ACE_wrappers/ace/Caching_Strategies_T.h b/dep/ACE_wrappers/ace/Caching_Strategies_T.h
index 82aeb9c10ba..d78332e41f5 100644
--- a/dep/ACE_wrappers/ace/Caching_Strategies_T.h
+++ b/dep/ACE_wrappers/ace/Caching_Strategies_T.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Caching_Strategies_T.h
@@ -8,20 +9,28 @@
* @author Kirthika Parameswaran <kirthika@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_CACHING_STRATEGIES_H
#define ACE_CACHING_STRATEGIES_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
#include "ace/Caching_Utility_T.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined(_MSC_VER)
#pragma warning(disable:4503)
#endif /* _MSC_VER */
+
// For linkers that cant grok long names.
#define ACE_Caching_Strategy ACS
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Caching_Strategy
*
@@ -37,40 +46,54 @@ class ACE_Caching_Strategy
public:
/// Destructor.
virtual ~ACE_Caching_Strategy (void);
+
/// Accessor method for the timer attributes.
virtual ATTRIBUTES attributes (void) = 0;
+
/// Get the percentage of entries to purge.
virtual double purge_percent (void) = 0;
+
/// Set the percentage of entries to purge.
virtual void purge_percent (double percentage) = 0;
+
// = Strategy related Operations
+
/// This method acts as a notification about the CONTAINERs bind
/// method call.
virtual int notify_bind (int result,
const ATTRIBUTES &attr) = 0;
+
/// This method acts as a notification about the CONTAINERs find
/// method call
virtual int notify_find (int result,
ATTRIBUTES &attr) = 0;
+
/// This method acts as a notification about the CONTAINERs unbind
/// method call
virtual int notify_unbind (int result,
const ATTRIBUTES &attr) = 0;
+
/// This method acts as a notification about the CONTAINERs trybind
/// method call
virtual int notify_trybind (int result,
ATTRIBUTES &attr) = 0;
+
/// This method acts as a notification about the CONTAINERs rebind
/// method call
virtual int notify_rebind (int result,
const ATTRIBUTES &attr) = 0;
+
/// Purge the cache.
virtual CACHING_UTILITY &caching_utility (void) = 0;
+
/// Dumps the state of the object.
virtual void dump (void) const = 0;
};
+
//////////////////////////////////////////////////////////////////////////
+
#define ACE_Caching_Strategy_Adapter ACSA
+
/**
* @class ACE_Caching_Strategy_Adapter
*
@@ -86,53 +109,73 @@ template <class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION>
class ACE_Caching_Strategy_Adapter
: public ACE_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>
{
+
public:
+
/// Constructor.
ACE_Caching_Strategy_Adapter (IMPLEMENTATION *implementation = 0,
bool delete_implementation = false);
+
/// Destructor.
~ACE_Caching_Strategy_Adapter (void);
+
/// Accessor method for the timer attributes.
ATTRIBUTES attributes (void);
+
/// Get the percentage of entries to purge.
double purge_percent (void);
+
/// Set the percentage of entries to purge.
void purge_percent (double percentage);
+
// = Strategy related Operations
+
/// This method acts as a notification about the CONTAINERs bind
/// method call.
int notify_bind (int result,
const ATTRIBUTES &attr);
+
/// This method acts as a notification about the CONTAINERs find
/// method call
int notify_find (int result,
ATTRIBUTES &attr);
+
/// This method acts as a notification about the CONTAINERs unbind
/// method call
int notify_unbind (int result,
const ATTRIBUTES &attr);
+
/// This method acts as a notification about the CONTAINERs trybind
/// method call
int notify_trybind (int result,
ATTRIBUTES &attr);
+
/// This method acts as a notification about the CONTAINERs rebind
/// method call
int notify_rebind (int result,
const ATTRIBUTES &attr);
+
/// Accessor to the implementation.
IMPLEMENTATION &implementation (void);
+
/// Purge the cache.
CACHING_UTILITY &caching_utility (void);
+
/// Dumps the state of the object.
void dump (void) const;
+
private:
+
/// Implementation class.
IMPLEMENTATION *implementation_;
+
/// Do we need to delete the implementation?
bool delete_implementation_;
};
+
//////////////////////////////////////////////////////////////////////////
#define ACE_LRU_Caching_Strategy ALRU
+
/**
* @class ACE_LRU_Caching_Strategy
*
@@ -156,9 +199,12 @@ template <class ATTRIBUTES, class CACHING_UTILITY>
class ACE_LRU_Caching_Strategy
{
public:
+
// Traits.
typedef ATTRIBUTES CACHING_ATTRIBUTES;
+
// = Initialisation and termination.
+
/**
* The <container> is the map in which the entries reside. The
* timer attribute is initialed to zero in this constructor. And
@@ -167,51 +213,69 @@ public:
* set to 10%.
*/
ACE_LRU_Caching_Strategy (void);
+
// = Operations of the strategy.
+
/// Accessor method for the timer attributes.
ATTRIBUTES attributes (void);
+
/// Get the percentage of entries to purge.
double purge_percent (void);
+
/// Set the percentage of entries to purge.
void purge_percent (double percentage);
+
// = Strategy related Operations
+
/// This method acts as a notification about the CONTAINERs bind
/// method call.
int notify_bind (int result,
const ATTRIBUTES &attr);
+
/// This method acts as a notification about the CONTAINERs find
/// method call
int notify_find (int result,
ATTRIBUTES &attr);
+
/// This method acts as a notification about the CONTAINERs unbind
/// method call
int notify_unbind (int result,
const ATTRIBUTES &attr);
+
/// This method acts as a notification about the CONTAINERs trybind
/// method call
int notify_trybind (int result,
ATTRIBUTES &attr);
+
/// This method acts as a notification about the CONTAINERs rebind
/// method call
int notify_rebind (int result,
const ATTRIBUTES &attr);
+
/// Purge the cache.
CACHING_UTILITY &caching_utility (void);
+
/// Dumps the state of the object.
void dump (void) const;
+
private:
+
/// This element is the one which is the deciding factor for purging
/// of an ITEM.
ATTRIBUTES timer_;
+
/// The level about which the purging will happen automagically.
double purge_percent_;
+
/// This is the helper class which will decide and expunge entries
/// from the cache.
CACHING_UTILITY caching_utility_;
};
+
//////////////////////////////////////////////////////////////////////////
#define ACE_LFU_Caching_Strategy ALFU
+
/**
* @class ACE_LFU_Caching_Strategy
*
@@ -234,10 +298,14 @@ private:
template <class ATTRIBUTES, class CACHING_UTILITY>
class ACE_LFU_Caching_Strategy
{
+
public:
+
// Traits.
typedef ATTRIBUTES CACHING_ATTRIBUTES;
+
// = Initialisation and termination methods.
+
/**
* The <container> is the map in which the entries reside. The
* timer attribute is initialed to zero in this constructor. And
@@ -246,46 +314,63 @@ public:
* set to 10%.
*/
ACE_LFU_Caching_Strategy (void);
+
// = Strategy methods.
+
/// Access the attributes.
ATTRIBUTES attributes (void);
+
/// Get the percentage of entries to purge.
double purge_percent (void);
+
/// Set the percentage of entries to purge.
void purge_percent (double percentage);
+
// = Strategy related Operations
+
/// This method acts as a notification about the CONTAINERs bind
/// method call.
int notify_bind (int result,
const ATTRIBUTES &attr);
+
/// Lookup notification.
int notify_find (int result,
ATTRIBUTES &attr);
+
/// This method acts as a notification about the CONTAINERs unbind
/// method call
int notify_unbind (int result,
const ATTRIBUTES &attr);
+
/// This method acts as a notification about the CONTAINERs trybind
/// method call
int notify_trybind (int result,
ATTRIBUTES &attr);
+
/// This method acts as a notification about the CONTAINERs rebind
/// method call
int notify_rebind (int result,
const ATTRIBUTES &attr);
+
/// Purge the cache.
CACHING_UTILITY &caching_utility (void);
+
/// Dumps the state of the object.
void dump (void) const;
+
private:
+
/// The level about which the purging will happen automagically.
double purge_percent_;
+
/// This is the helper class which will decide and expunge entries
/// from the cache.
CACHING_UTILITY caching_utility_;
};
+
/////////////////////////////////////////////////////////////
#define ACE_FIFO_Caching_Strategy AFIFO
+
/**
* @class ACE_FIFO_Caching_Strategy
*
@@ -306,9 +391,13 @@ private:
template<class ATTRIBUTES, class CACHING_UTILITY>
class ACE_FIFO_Caching_Strategy
{
+
public:
+
typedef ATTRIBUTES CACHING_ATTRIBUTES;
+
// = Initialisation and termination.
+
/**
* The <container> is the map in which the entries reside. The
* timer attribute is initialed to zero in this constructor. And
@@ -317,48 +406,66 @@ public:
* set to 10%.
*/
ACE_FIFO_Caching_Strategy (void);
+
// = Strategy methods.
+
/// Accessor method.
ATTRIBUTES attributes (void);
+
/// Get the percentage of entries to purge.
double purge_percent (void);
+
/// Set the percentage of entries to purge.
void purge_percent (double percentage);
+
// = Strategy related Operations
+
/// Notification for an item getting bound into the cache.
int notify_bind (int result,
const ATTRIBUTES &attr);
+
/// This method acts as a notification about the CONTAINERs find
/// method call
int notify_find (int result,
ATTRIBUTES &attr);
+
/// This method acts as a notification about the CONTAINERs unbind
/// method call
int notify_unbind (int result,
const ATTRIBUTES &attr);
+
/// This method acts as a notification about the CONTAINERs trybind
/// method call
int notify_trybind (int result,
ATTRIBUTES &attr);
+
/// Notification for an item getting bound again into the cache.
int notify_rebind (int result,
const ATTRIBUTES &attr);
+
/// Purge the cache.
CACHING_UTILITY &caching_utility (void);
+
/// Dumps the state of the object.
void dump (void) const;
+
private:
+
/// The order is the deciding factor for the item to be removed from
/// the cache.
ATTRIBUTES order_;
+
/// The level about which the purging will happen automagically.
double purge_percent_;
+
/// This is the helper class which will decide and expunge entries
/// from the cache.
CACHING_UTILITY caching_utility_;
};
+
//////////////////////////////////////////////////////////////////////
#define ACE_Null_Caching_Strategy ANULL
+
/**
* @class ACE_Null_Caching_Strategy
*
@@ -371,54 +478,76 @@ private:
template<class ATTRIBUTES, class CACHING_UTILITY>
class ACE_Null_Caching_Strategy
{
+
public:
+
// = Traits.
typedef ATTRIBUTES CACHING_ATTRIBUTES;
+
// = Strategy methods. All are NO_OP methods!!!
+
/// Accessor method.
ATTRIBUTES attributes (void);
+
/// Get the percentage of entries to purge.
double purge_percent (void);
+
/// Set the percentage of entries to purge.
void purge_percent (double percentage);
+
// = Strategy related Operations
+
/// Notification for an item getting bound into the cache.
int notify_bind (int result,
const ATTRIBUTES &attr);
+
/// This method acts as a notification about the CONTAINERs find
/// method call
int notify_find (int result,
ATTRIBUTES &attr);
+
/// This method acts as a notification about the CONTAINERs unbind
/// method call
int notify_unbind (int result,
const ATTRIBUTES &attr);
+
/// This method acts as a notification about the CONTAINERs trybind
/// method call
int notify_trybind (int result,
ATTRIBUTES &attr);
+
/// Notification for an item getting bound again into the cache.
int notify_rebind (int result,
const ATTRIBUTES &attr);
+
/// Purge the cache.
CACHING_UTILITY &caching_utility (void);
+
/// Dumps the state of the object.
void dump (void) const;
+
private:
+
/// This is the helper class which will decide and expunge entries
/// from the cache.
CACHING_UTILITY caching_utility_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Caching_Strategies_T.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Caching_Strategies_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Caching_Strategies_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_CACHING_STRATEGIES_H */
diff --git a/dep/ACE_wrappers/ace/Caching_Strategies_T.inl b/dep/ACE_wrappers/ace/Caching_Strategies_T.inl
index 8463e1cd650..41fa2d30301 100644
--- a/dep/ACE_wrappers/ace/Caching_Strategies_T.inl
+++ b/dep/ACE_wrappers/ace/Caching_Strategies_T.inl
@@ -1,9 +1,13 @@
// -*-C++-*-
//
//$Id: Caching_Strategies_T.inl 80826 2008-03-04 14:51:23Z wotte $
+
//////////////////////////////////////////////////////////////////////////////////
+
#include "ace/OS_Memory.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE
ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::ACE_Caching_Strategy_Adapter (IMPLEMENTATION *implementation,
bool delete_implementation)
@@ -17,6 +21,7 @@ ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::ACE_C
this->delete_implementation_ = true;
}
}
+
template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE
ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::~ACE_Caching_Strategy_Adapter (void)
{
@@ -27,21 +32,25 @@ ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::~ACE_
this->implementation_ = 0;
}
}
+
template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE ATTRIBUTES
ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::attributes (void)
{
return this->implementation_->attributes ();
}
+
template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE double
ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::purge_percent (void)
{
return this->implementation_->purge_percent ();
}
+
template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE void
ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::purge_percent (double percentage)
{
this->implementation_->purge_percent (percentage);
}
+
template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE int
ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::notify_bind (int result,
const ATTRIBUTES &attr)
@@ -49,6 +58,7 @@ ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::notif
return this->implementation_->notify_bind (result,
attr);
}
+
template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE int
ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::notify_find (int result,
ATTRIBUTES &attr)
@@ -56,6 +66,7 @@ ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::notif
return this->implementation_->notify_find (result,
attr);
}
+
template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE int
ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::notify_unbind (int result,
const ATTRIBUTES &attr)
@@ -63,6 +74,7 @@ ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::notif
return this->implementation_->notify_unbind (result,
attr);
}
+
template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE int
ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::notify_trybind (int result,
ATTRIBUTES &attr)
@@ -70,6 +82,7 @@ ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::notif
return this->implementation_->notify_trybind (result,
attr);
}
+
template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE int
ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::notify_rebind (int result,
const ATTRIBUTES &attr)
@@ -77,41 +90,50 @@ ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::notif
return this->implementation_->notify_rebind (result,
attr);
}
+
template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE IMPLEMENTATION &
ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::implementation (void)
{
return *this->implementation_;
}
+
template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE CACHING_UTILITY &
ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::caching_utility (void)
{
return this->implementation_->caching_utility ();
}
+
template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE void
ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_Caching_Strategy_Adapter::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
//////////////////////////////////////////////////////////////////////////////////
+
template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE ATTRIBUTES
ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::attributes (void)
{
return this->timer_;
}
+
template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE double
ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::purge_percent (void)
{
return this->purge_percent_;
}
+
template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE void
ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::purge_percent (double percentage)
{
this->purge_percent_ = percentage;
}
+
template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_bind (
int result,
@@ -119,8 +141,10 @@ ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_bind (
{
if (result == 0)
++this->timer_;
+
return result;
}
+
template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_find (
int result,
@@ -131,8 +155,10 @@ ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_find (
attr = this->timer_;
++this->timer_;
}
+
return result;
}
+
template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_unbind (
int result,
@@ -140,6 +166,7 @@ ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_unbind (
{
return result;
}
+
template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_trybind (
int result,
@@ -147,6 +174,7 @@ ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_trybind (
{
return result;
}
+
template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_rebind (
int result,
@@ -154,219 +182,275 @@ ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_rebind (
{
if (result == 0)
++this->timer_;
+
return result;
}
+
template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE CACHING_UTILITY &
ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::caching_utility (void)
{
return this->caching_utility_;
}
+
template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE void
ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_LRU_Caching_Strategy::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("timer_ = %d "), this->timer_));
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
//////////////////////////////////////////////////////////////////////////////////
+
template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE ATTRIBUTES
ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::attributes (void)
{
return 0;
}
+
template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE double
ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::purge_percent (void)
{
return this->purge_percent_;
}
+
template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE void
ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::purge_percent (double percentage)
{
this->purge_percent_ = percentage;
}
+
template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_bind (int result,
const ATTRIBUTES & /* attr */)
{
+
return result;
}
+
template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_find (int result,
ATTRIBUTES &attr)
{
if (result == 0)
++attr;
+
return result;
}
+
template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_trybind (int result,
ATTRIBUTES & /* attr */)
{
return result;
}
+
template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_rebind (int result,
const ATTRIBUTES & /* attr */)
{
return result;
}
+
template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_unbind (int result,
const ATTRIBUTES & /* attr */)
{
return result;
}
+
template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE CACHING_UTILITY &
ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::caching_utility (void)
{
return this->caching_utility_;
}
+
template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE void
ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_LFU_Caching_Strategy::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
//////////////////////////////////////////////////////////////////////////////////////
+
template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE ATTRIBUTES
ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::attributes (void)
{
return this->order_;
}
+
template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE double
ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::purge_percent (void)
{
return this->purge_percent_;
}
+
template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE void
ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::purge_percent (double percentage)
{
this->purge_percent_ = percentage;
}
+
template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_bind (int result,
const ATTRIBUTES &attr)
{
ACE_UNUSED_ARG (attr);
+
if (result == 0)
++this->order_;
+
return result;
}
+
template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_find (int result,
ATTRIBUTES &attr)
{
ACE_UNUSED_ARG (attr);
+
return result;
}
+
template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_unbind (int result,
const ATTRIBUTES &attr)
{
ACE_UNUSED_ARG (attr);
+
return result;
}
+
template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_trybind (int result,
ATTRIBUTES &attr)
{
ACE_UNUSED_ARG (attr);
+
return result;
}
+
template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_rebind (int result,
const ATTRIBUTES &attr)
{
ACE_UNUSED_ARG (attr);
+
if (result == 0)
++this->order_;
+
return result;
}
+
template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE CACHING_UTILITY &
ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::caching_utility (void)
{
return this->caching_utility_;
}
+
template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE void
ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_FIFO_Caching_Strategy::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("order_ = %d "), this->order_));
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
//////////////////////////////////////////////////////////////////////////////////
+
template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE ATTRIBUTES
ACE_Null_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::attributes (void)
{
return 0;
}
+
template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE double
ACE_Null_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::purge_percent (void)
{
return 0;
}
+
template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE void
ACE_Null_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::purge_percent (double percentage)
{
ACE_UNUSED_ARG (percentage);
}
+
template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
ACE_Null_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_bind (int result,
const ATTRIBUTES &attr)
{
ACE_UNUSED_ARG (attr);
+
return result;
}
+
template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
ACE_Null_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_find (int result,
ATTRIBUTES &attr)
{
ACE_UNUSED_ARG (attr);
+
return result;
}
+
template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
ACE_Null_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_unbind (int result,
const ATTRIBUTES &attr)
{
ACE_UNUSED_ARG (attr);
+
return result;
}
+
template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
ACE_Null_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_trybind (int result,
ATTRIBUTES &attr)
{
ACE_UNUSED_ARG (attr);
+
return result;
}
+
template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
ACE_Null_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_rebind (int result,
const ATTRIBUTES &attr)
{
ACE_UNUSED_ARG (attr);
+
return result;
}
+
template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE CACHING_UTILITY &
ACE_Null_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::caching_utility (void)
{
return this->caching_utility_;
}
+
template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE void
ACE_Null_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_Null_Caching_Strategy::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
//////////////////////////////////////////////////////////////////////////////////
diff --git a/dep/ACE_wrappers/ace/Caching_Utility_T.h b/dep/ACE_wrappers/ace/Caching_Utility_T.h
index 61a45bff0af..9859159be4c 100644
--- a/dep/ACE_wrappers/ace/Caching_Utility_T.h
+++ b/dep/ACE_wrappers/ace/Caching_Utility_T.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Caching_Utility_T.h
@@ -8,18 +9,26 @@
* @author Kirthika Parameswaran <kirthika@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_CACHING_UTILITY_H
#define ACE_CACHING_UTILITY_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Global_Macros.h"
#include "ace/Cleanup_Strategies_T.h"
+
// For linkers that cant grok long names.
#define ACE_Pair_Caching_Utility APUTIL
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Pair_Caching_Utility
*
@@ -38,33 +47,44 @@ template <class KEY, class VALUE, class CONTAINER, class ITERATOR, class ATTRIBU
class ACE_Pair_Caching_Utility
{
public:
+
typedef ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> CLEANUP_STRATEGY;
+
/// Constructor.
ACE_Pair_Caching_Utility (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_strategy = 0,
int delete_cleanup_strategy = 0);
+
/// Destructor.
~ACE_Pair_Caching_Utility (void);
+
/**
* Purge entries from the @a container. The Cleanup_Strategy will do the
* actual job of cleanup once the entries to be cleaned up are decided.
*/
int clear_cache (CONTAINER &container,
double purge_percent);
+
protected:
+
/// Find the entry with minimum caching attributes.
void minimum (CONTAINER &container,
KEY *&key_to_remove,
VALUE *&value_to_remove);
+
/// The cleanup strategy which can be used to destroy the entries of
/// the container.
CLEANUP_STRATEGY *cleanup_strategy_;
+
/// Whether the cleanup_strategy should be destroyed or not.
int delete_cleanup_strategy_;
+
ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Pair_Caching_Utility<KEY,VALUE,CONTAINER,ITERATOR,ATTRIBUTES> &))
ACE_UNIMPLEMENTED_FUNC (ACE_Pair_Caching_Utility (const ACE_Pair_Caching_Utility<KEY,VALUE,CONTAINER,ITERATOR,ATTRIBUTES> &))
};
+
////////////////////////////////////////////////////////////////////////////////
#define ACE_Recyclable_Handler_Caching_Utility ARHUTIL
+
/**
* @class ACE_Recyclable_Handler_Caching_Utility
*
@@ -82,14 +102,19 @@ protected:
template <class KEY, class VALUE, class CONTAINER, class ITERATOR, class ATTRIBUTES>
class ACE_Recyclable_Handler_Caching_Utility
{
+
public:
+
typedef ACE_Recyclable_Handler_Cleanup_Strategy<KEY, VALUE, CONTAINER> CLEANUP_STRATEGY;
typedef ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> CLEANUP_STRATEGY_BASE;
+
/// Constructor.
ACE_Recyclable_Handler_Caching_Utility (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_strategy = 0,
int delete_cleanup_strategy = 0);
+
/// Destructor.
~ACE_Recyclable_Handler_Caching_Utility (void);
+
/**
* Purge entries from the <container>. The Cleanup_Strategy will do
* the actual job of cleanup once the entries to be cleaned up are
@@ -97,21 +122,28 @@ public:
*/
int clear_cache (CONTAINER &container,
double purge_percent);
+
protected:
+
/// Find the entry with minimum caching attributes.
void minimum (CONTAINER &container,
KEY *&key_to_remove,
VALUE *&value_to_remove);
+
/// This is the default Cleanup Strategy for this utility.
CLEANUP_STRATEGY_BASE *cleanup_strategy_;
+
/// Whether the cleanup_strategy should be destroyed or not.
int delete_cleanup_strategy_;
+
private:
ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Recyclable_Handler_Caching_Utility<KEY,VALUE,CONTAINER,ITERATOR,ATTRIBUTES> &))
ACE_UNIMPLEMENTED_FUNC (ACE_Recyclable_Handler_Caching_Utility (const ACE_Recyclable_Handler_Caching_Utility<KEY,VALUE,CONTAINER,ITERATOR,ATTRIBUTES> &))
};
+
///////////////////////////////////////////////////////////////////////////
#define ACE_Refcounted_Recyclable_Handler_Caching_Utility ARRHUTIL
+
/**
* @class ACE_Refcounted_Recyclable_Handler_Caching_Utility
*
@@ -130,14 +162,19 @@ private:
template <class KEY, class VALUE, class CONTAINER, class ITERATOR, class ATTRIBUTES>
class ACE_Refcounted_Recyclable_Handler_Caching_Utility
{
+
public:
+
typedef ACE_Refcounted_Recyclable_Handler_Cleanup_Strategy<KEY, VALUE, CONTAINER> CLEANUP_STRATEGY;
typedef ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> CLEANUP_STRATEGY_BASE;
+
/// Constructor.
ACE_Refcounted_Recyclable_Handler_Caching_Utility (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_strategy = 0,
int delete_cleanup_strategy = 0);
+
/// Destructor.
~ACE_Refcounted_Recyclable_Handler_Caching_Utility (void);
+
/**
* Purge entries from the <container>. The Cleanup_Strategy will do
* the actual job of cleanup once the entries to be cleaned up are
@@ -145,26 +182,34 @@ public:
*/
int clear_cache (CONTAINER &container,
double purge_percent);
+
protected:
+
/// Find the entry with minimum caching attributes.
void minimum (CONTAINER &container,
KEY *&key_to_remove,
VALUE *&value_to_remove);
+
/// This is the default Cleanup Strategy for this utility.
CLEANUP_STRATEGY_BASE *cleanup_strategy_;
+
/// Whether the cleanup_strategy should be destroyed or not.
int delete_cleanup_strategy_;
+
/**
* This figure denotes the number of entries are there in the
* container which have been marked as closed already but might
* not have been unbound from the container.
*/
size_t marked_as_closed_entries_;
+
private:
ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Refcounted_Recyclable_Handler_Caching_Utility<KEY,VALUE,CONTAINER,ITERATOR,ATTRIBUTES> &))
ACE_UNIMPLEMENTED_FUNC (ACE_Refcounted_Recyclable_Handler_Caching_Utility (const ACE_Refcounted_Recyclable_Handler_Caching_Utility<KEY,VALUE,CONTAINER,ITERATOR,ATTRIBUTES> &))
};
+
////////////////////////////////////////////////////////////////////////////////////////
+
/**
* @class ACE_Handler_Caching_Utility
*
@@ -183,13 +228,17 @@ template <class KEY, class VALUE, class CONTAINER, class ITERATOR, class ATTRIBU
class ACE_Handler_Caching_Utility
{
public:
+
typedef ACE_Handler_Cleanup_Strategy<KEY, VALUE, CONTAINER> CLEANUP_STRATEGY;
typedef ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> CLEANUP_STRATEGY_BASE;
+
/// Constructor.
ACE_Handler_Caching_Utility (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_strategy = 0,
int delete_cleanup_strategy = 0);
+
/// Destructor.
~ACE_Handler_Caching_Utility (void);
+
/**
* Purge entries from the <container>. The Cleanup_Strategy will do
* the actual job of cleanup once the entries to be cleaned up are
@@ -197,7 +246,9 @@ public:
*/
int clear_cache (CONTAINER &container,
double purge_percent);
+
protected:
+
/**
* Find the entry with minimum caching attributes. This is handler
* specific since this utility is to be used very specifically for
@@ -207,15 +258,19 @@ protected:
void minimum (CONTAINER &container,
KEY *&key_to_remove,
VALUE *&value_to_remove);
+
/// The cleanup strategy which can be used to destroy the entries of
/// the container.
CLEANUP_STRATEGY_BASE *cleanup_strategy_;
+
/// Whether the cleanup_strategy should be destroyed or not.
int delete_cleanup_strategy_;
+
private:
ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Handler_Caching_Utility<KEY,VALUE,CONTAINER,ITERATOR,ATTRIBUTES> &))
ACE_UNIMPLEMENTED_FUNC (ACE_Handler_Caching_Utility (const ACE_Handler_Caching_Utility<KEY,VALUE,CONTAINER,ITERATOR,ATTRIBUTES> &))
};
+
///////////////////////////////////////////////////////////////////////////
#define ACE_Null_Caching_Utility ANUTIL
/**
@@ -234,13 +289,17 @@ template <class KEY, class VALUE, class CONTAINER, class ITERATOR, class ATTRIBU
class ACE_Null_Caching_Utility
{
public:
+
typedef ACE_Null_Cleanup_Strategy<KEY, VALUE, CONTAINER> CLEANUP_STRATEGY;
typedef ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> CLEANUP_STRATEGY_BASE;
+
/// Constructor.
ACE_Null_Caching_Utility (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_strategy = 0,
int delete_cleanup_strategy = 0);
+
/// Destructor.
~ACE_Null_Caching_Utility (void);
+
/**
* Purge entries from the <container>. The Cleanup_Strategy will do
* the actual job of cleanup once the entries to be cleaned up are
@@ -248,7 +307,9 @@ public:
*/
int clear_cache (CONTAINER &container,
double purge_percent);
+
protected:
+
/**
* Find the entry with minimum caching attributes. This is handler
* specific since this utility is to be used very specifically for
@@ -258,22 +319,30 @@ protected:
void minimum (CONTAINER &container,
KEY *&key_to_remove,
VALUE *&value_to_remove);
+
/// The cleanup strategy which can be used to destroy the entries of
/// the container.
CLEANUP_STRATEGY_BASE *cleanup_strategy_;
+
/// Whether the cleanup_strategy should be destroyed or not.
int delete_cleanup_strategy_;
+
private:
ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Null_Caching_Utility<KEY,VALUE,CONTAINER,ITERATOR,ATTRIBUTES> &))
ACE_UNIMPLEMENTED_FUNC (ACE_Null_Caching_Utility (const ACE_Null_Caching_Utility<KEY,VALUE,CONTAINER,ITERATOR,ATTRIBUTES> &))
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Caching_Utility_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Caching_Utility_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_CACHING_UTILITY_H */
diff --git a/dep/ACE_wrappers/ace/Capabilities.cpp b/dep/ACE_wrappers/ace/Capabilities.cpp
index c64417095f7..4f8151d1bc6 100644
--- a/dep/ACE_wrappers/ace/Capabilities.cpp
+++ b/dep/ACE_wrappers/ace/Capabilities.cpp
@@ -2,27 +2,36 @@
#include "ace/OS_NS_ctype.h"
#include "ace/OS_Memory.h"
#include "ace/OS_NS_string.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Capabilities.inl"
#endif /* !__ACE_INLINE__ */
+
#include "ace/OS_NS_stdio.h"
+
ACE_RCSID (ace,
Capabilities,
"$Id: Capabilities.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#define ACE_ESC ((ACE_TCHAR)0x1b)
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_CapEntry::~ACE_CapEntry (void)
{
}
+
ACE_Capabilities::ACE_Capabilities (void)
: caps_ ()
{
}
+
ACE_Capabilities::~ACE_Capabilities (void)
{
this->resetcaps ();
}
+
const ACE_TCHAR *
ACE_Capabilities::parse (const ACE_TCHAR *buf, ACE_TString &cap)
{
@@ -68,6 +77,7 @@ ACE_Capabilities::parse (const ACE_TCHAR *buf, ACE_TString &cap)
i < 3 && *buf && ACE_OS::ace_isdigit (*buf);
i++)
oc = oc * 8 + (*buf++ - ACE_TEXT ('0'));
+
cap += (ACE_TCHAR) oc;
continue;
}
@@ -76,15 +86,20 @@ ACE_Capabilities::parse (const ACE_TCHAR *buf, ACE_TString &cap)
}
return buf;
}
+
const ACE_TCHAR *
ACE_Capabilities::parse (const ACE_TCHAR *buf, int &cap)
{
int n = 0;
+
while (*buf && ACE_OS::ace_isdigit (*buf))
n = n * 10 + (*buf++ - ACE_TEXT ('0'));
+
cap = n;
+
return buf;
}
+
void
ACE_Capabilities::resetcaps (void)
{
@@ -96,9 +111,11 @@ ACE_Capabilities::resetcaps (void)
iter.next (entry);
delete entry->int_id_;
}
+
this->caps_.close ();
this->caps_.open ();
}
+
int
ACE_Capabilities::fillent (const ACE_TCHAR *buf)
{
@@ -109,11 +126,14 @@ ACE_Capabilities::fillent (const ACE_TCHAR *buf)
int n;
ACE_TString name;
ACE_CapEntry *ce;
+
// Skip blanks
while (*buf && ACE_OS::ace_isspace(*buf)) buf++;
// If we get end of line return
+
if (*buf == ACE_TEXT ('\0'))
break;
+
if (*buf == ACE_TEXT ('#'))
{
while (*buf && *buf != ACE_TEXT ('\n'))
@@ -126,6 +146,7 @@ ACE_Capabilities::fillent (const ACE_TCHAR *buf)
&& *buf!= ACE_TEXT ('#')
&& *buf != ACE_TEXT (','))
name += *buf++;
+
// If name is null.
switch (*buf)
{
@@ -167,11 +188,14 @@ ACE_Capabilities::fillent (const ACE_TCHAR *buf)
default:
return 0;
}
+
if (*buf++ != ACE_TEXT (','))
return -1;
}
+
return 0;
}
+
int
ACE_Capabilities::is_entry (const ACE_TCHAR *name, const ACE_TCHAR *line)
{
@@ -180,16 +204,20 @@ ACE_Capabilities::is_entry (const ACE_TCHAR *name, const ACE_TCHAR *line)
// Skip blanks or irrelevant characters
while (*line && ACE_OS::ace_isspace(*line))
++line;
+
// End of line reached
if (*line == ACE_TEXT ('\0'))
break;
+
// Build the entry name
ACE_TString nextname;
while (*line && *line != ACE_TEXT ('|') && *line != ACE_TEXT (','))
nextname += *line++;
+
// We have found the required entry?
if (ACE_OS::strcmp (nextname.c_str (), name) == 0)
return 1;
+
// Skip puntuaction char if neccesary.
if (*line == ACE_TEXT ('|') || *line == ACE_TEXT (','))
++line;
@@ -202,37 +230,46 @@ ACE_Capabilities::is_entry (const ACE_TCHAR *name, const ACE_TCHAR *line)
}
return 0;
}
+
int
ACE_Capabilities::getline (FILE *fp, ACE_TString &line)
{
int ch;
+
line.set (0, 0);
+
while ((ch = ACE_OS::fgetc (fp)) != EOF && ch != ACE_TEXT ('\n'))
line += (ACE_TCHAR) ch;
+
if (ch == EOF && line.length () == 0)
return -1;
else
return 0;
}
+
int
ACE_Capabilities::getval (const ACE_TCHAR *keyname, ACE_TString &val)
{
ACE_CapEntry* cap = 0;
if (this->caps_.find (keyname, cap) == -1)
return -1;
+
ACE_StringCapEntry *scap =
dynamic_cast<ACE_StringCapEntry *> (cap);
if (scap == 0)
return -1;
+
val = scap->getval ();
return 0;
}
+
int
ACE_Capabilities::getval (const ACE_TCHAR *keyname, int &val)
{
ACE_CapEntry *cap = 0;
if (this->caps_.find (keyname, cap) == -1)
return -1;
+
ACE_IntCapEntry *icap =
dynamic_cast<ACE_IntCapEntry *> (cap);
if (icap != 0)
@@ -240,63 +277,80 @@ ACE_Capabilities::getval (const ACE_TCHAR *keyname, int &val)
val = icap->getval ();
return 0;
}
+
ACE_BoolCapEntry *bcap =
dynamic_cast<ACE_BoolCapEntry *> (cap);
+
if (bcap == 0)
return -1;
+
val = bcap->getval ();
return 0;
}
+
#if !defined (ACE_IS_SPLITTING)
static int
is_empty (const ACE_TCHAR *line)
{
while (*line && ACE_OS::ace_isspace (*line))
++line;
+
return *line == ACE_TEXT ('\0') || *line == ACE_TEXT ('#');
}
+
static int
is_line (const ACE_TCHAR *line)
{
while (*line && ACE_OS::ace_isspace (*line))
++line;
+
return *line != ACE_TEXT ('\0');
}
#endif /* !ACE_IS_SPLITTING */
+
int
ACE_Capabilities::getent (const ACE_TCHAR *fname, const ACE_TCHAR *name)
{
FILE *fp = ACE_OS::fopen (fname, ACE_TEXT ("r"));
+
if (fp == 0)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("Can't open %s file\n"),
fname),
-1);
+
int done;
ACE_TString line;
+
while (0 == (done = (this->getline (fp, line) == -1))
&& is_empty (line.c_str ()))
continue;
+
while (!done)
{
ACE_TString newline;
ACE_TString description;
+
while (0 == (done = (this->getline (fp, newline) == -1)))
if (is_line (newline.c_str ()))
description += newline;
else
break;
+
if (this->is_entry (name, line.c_str()))
{
ACE_OS::fclose (fp);
return this->fillent (description.c_str ());
}
+
line = newline;
while (!done && is_empty (line.c_str ()))
done = this->getline (fp, line) == -1;
}
+
ACE_OS::fclose (fp);
return -1;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Capabilities.h b/dep/ACE_wrappers/ace/Capabilities.h
index f25d8fbb914..459afd1c681 100644
--- a/dep/ACE_wrappers/ace/Capabilities.h
+++ b/dep/ACE_wrappers/ace/Capabilities.h
@@ -1,4 +1,5 @@
/* -*- C++ -*- */
+
//=============================================================================
/**
* @file Capabilities.h
@@ -9,23 +10,30 @@
*/
//=============================================================================
+
#ifndef ACE_CAPABILITIES_H
#define ACE_CAPABILITIES_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Null_Mutex.h"
#include "ace/Hash_Map_Manager_T.h"
#include "ace/Containers.h"
#include "ace/SString.h"
#include "ace/Functor_String.h"
+
#if defined (ACE_IS_SPLITTING)
# include "ace/OS_NS_ctype.h"
#endif /* ACE_IS_SPLITTING */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_CapEntry
*
@@ -39,18 +47,26 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
class ACE_Export ACE_CapEntry
{
public:
+
virtual ~ACE_CapEntry (void);
+
protected:
+
enum
{
ACE_INTCAP = 0,
ACE_STRINGCAP = 1,
ACE_BOOLCAP = 2
};
+
ACE_CapEntry (int captype);
+
protected:
+
int captype_;
+
};
+
/**
* @class ACE_IntCapEntry
*
@@ -64,9 +80,11 @@ class ACE_Export ACE_IntCapEntry : public ACE_CapEntry
public:
ACE_IntCapEntry (int val);
int getval (void) const;
+
protected:
int val_;
};
+
/**
* @class ACE_StringCapEntry
*
@@ -80,9 +98,11 @@ class ACE_Export ACE_StringCapEntry : public ACE_CapEntry
public:
ACE_StringCapEntry (const ACE_TString &val);
ACE_TString getval (void) const;
+
protected:
ACE_TString val_;
};
+
/**
* @class ACE_BoolCapEntry
*
@@ -96,9 +116,11 @@ class ACE_Export ACE_BoolCapEntry : public ACE_CapEntry
public:
ACE_BoolCapEntry (int val);
int getval (void) const;
+
protected:
int val_;
};
+
/**
* @class ACE_Capabilities
*
@@ -117,59 +139,84 @@ protected:
class ACE_Export ACE_Capabilities
{
public:
+
typedef ACE_Hash_Map_Manager_Ex<ACE_TString, ACE_CapEntry *, ACE_Hash<ACE_TString>, ACE_Equal_To<ACE_TString>, ACE_Null_Mutex> CAPABILITIES_MAP;
+
/// The Constructor
ACE_Capabilities (void);
+
/// The Destructor
~ACE_Capabilities(void);
+
public:
+
/// Get a string entry.
int getval (const ACE_TCHAR *ent, ACE_TString &val);
+
/// Get an integer entry.
int getval (const ACE_TCHAR *ent, int &val);
+
/// Get the ACE_Capabilities name from FILE fname and load the
/// associated capabitily entries in map.
int getent (const ACE_TCHAR *fname, const ACE_TCHAR *name);
+
protected:
+
/// Parse an integer property
const ACE_TCHAR *parse (const ACE_TCHAR *buf, int &cap);
+
/// Parse a string property
const ACE_TCHAR *parse (const ACE_TCHAR *buf, ACE_TString &cap);
+
/// Fill the ACE_Capabilities with description in ent.
int fillent(const ACE_TCHAR *ent);
+
/// Parse a cap entry
int parseent (const ACE_TCHAR *name, ACE_TCHAR *line);
+
/// Get a line from FILE input stream
int getline (FILE* fp,
ACE_TString &line);
+
/// Is a valid entry
int is_entry (const ACE_TCHAR *name, const ACE_TCHAR *line);
+
/// Reset the set of capabilities
void resetcaps (void);
+
private:
+
/// This is the set of ACE_CapEntry.
CAPABILITIES_MAP caps_;
+
};
+
#if defined (ACE_IS_SPLITTING)
int
is_empty (const ACE_TCHAR *line)
{
while (*line && ACE_OS::ace_isspace (*line))
++line;
+
return *line == ACE_TEXT ('\0') || *line == ACE_TEXT ('#');
}
+
int
is_line (const ACE_TCHAR *line)
{
while (*line && ACE_OS::ace_isspace (*line))
++line;
+
return *line != ACE_TEXT ('\0');
}
#endif /* ACE_IS_SPLITTING */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Capabilities.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* __ACE_CAPABILITIES_H__ */
diff --git a/dep/ACE_wrappers/ace/Capabilities.inl b/dep/ACE_wrappers/ace/Capabilities.inl
index de65bf36a67..37284b28696 100644
--- a/dep/ACE_wrappers/ace/Capabilities.inl
+++ b/dep/ACE_wrappers/ace/Capabilities.inl
@@ -1,43 +1,52 @@
// -*- C++ -*-
//
// $Id: Capabilities.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_CapEntry::ACE_CapEntry (int captype)
: captype_ (captype)
{
}
+
ACE_INLINE
ACE_IntCapEntry::ACE_IntCapEntry (int val)
: ACE_CapEntry (ACE_INTCAP),
val_ (val)
{
}
+
ACE_INLINE int
ACE_IntCapEntry::getval (void) const
{
return val_;
}
+
ACE_INLINE
ACE_StringCapEntry::ACE_StringCapEntry (const ACE_TString &val)
: ACE_CapEntry (ACE_STRINGCAP),
val_ (val)
{
}
+
ACE_INLINE ACE_TString
ACE_StringCapEntry::getval (void) const
{
return val_;
}
+
ACE_INLINE
ACE_BoolCapEntry::ACE_BoolCapEntry (int val)
: ACE_CapEntry (ACE_BOOLCAP),
val_(val)
{
}
+
ACE_INLINE int
ACE_BoolCapEntry::getval (void) const
{
return val_;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Cleanup.cpp b/dep/ACE_wrappers/ace/Cleanup.cpp
index e71b082982d..960e74fffa4 100644
--- a/dep/ACE_wrappers/ace/Cleanup.cpp
+++ b/dep/ACE_wrappers/ace/Cleanup.cpp
@@ -1,35 +1,47 @@
// $Id: Cleanup.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Cleanup.h"
+
ACE_RCSID (ace,
Cleanup,
"$Id: Cleanup.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if !defined (ACE_HAS_INLINED_OSCALLS)
# include "ace/Cleanup.inl"
#endif /* ACE_HAS_INLINED_OSCALLS */
+
#include "ace/OS_Memory.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
void
ACE_Cleanup::cleanup (void *)
{
delete this;
}
+
ACE_Cleanup::~ACE_Cleanup (void)
{
}
+
/*****************************************************************************/
+
extern "C" void
ACE_CLEANUP_DESTROYER_NAME (ACE_Cleanup *object, void *param)
{
object->cleanup (param);
}
+
/*****************************************************************************/
+
ACE_Cleanup_Info::ACE_Cleanup_Info (void)
: object_ (0),
cleanup_hook_ (0),
param_ (0)
{
}
+
bool
ACE_Cleanup_Info::operator== (const ACE_Cleanup_Info &o) const
{
@@ -37,12 +49,15 @@ ACE_Cleanup_Info::operator== (const ACE_Cleanup_Info &o) const
&& o.cleanup_hook_ == this->cleanup_hook_
&& o.param_ == this->param_;
}
+
bool
ACE_Cleanup_Info::operator!= (const ACE_Cleanup_Info &o) const
{
return !(*this == o);
}
+
/*****************************************************************************/
+
/**
* @class ACE_Cleanup_Info_Node
*
@@ -61,42 +76,53 @@ public:
private:
ACE_Cleanup_Info cleanup_info_;
ACE_Cleanup_Info_Node *next_;
+
friend class ACE_OS_Exit_Info;
};
+
ACE_Cleanup_Info_Node::ACE_Cleanup_Info_Node (void)
: cleanup_info_ (),
next_ (0)
{
}
+
ACE_Cleanup_Info_Node::ACE_Cleanup_Info_Node (const ACE_Cleanup_Info &new_info,
ACE_Cleanup_Info_Node *next)
: cleanup_info_ (new_info),
next_ (next)
{
}
+
ACE_Cleanup_Info_Node::~ACE_Cleanup_Info_Node (void)
{
delete next_;
}
+
ACE_Cleanup_Info_Node *
ACE_Cleanup_Info_Node::insert (const ACE_Cleanup_Info &new_info)
{
ACE_Cleanup_Info_Node *new_node = 0;
+
ACE_NEW_RETURN (new_node,
ACE_Cleanup_Info_Node (new_info, this),
0);
+
return new_node;
}
+
/*****************************************************************************/
+
ACE_OS_Exit_Info::ACE_OS_Exit_Info (void)
{
ACE_NEW (registered_objects_, ACE_Cleanup_Info_Node);
}
+
ACE_OS_Exit_Info::~ACE_OS_Exit_Info (void)
{
delete registered_objects_;
registered_objects_ = 0;
}
+
int
ACE_OS_Exit_Info::at_exit_i (void *object,
ACE_CLEANUP_FUNC cleanup_hook,
@@ -106,9 +132,12 @@ ACE_OS_Exit_Info::at_exit_i (void *object,
new_info.object_ = object;
new_info.cleanup_hook_ = cleanup_hook;
new_info.param_ = param;
+
// Return -1 and sets errno if unable to allocate storage. Enqueue
// at the head and dequeue from the head to get LIFO ordering.
+
ACE_Cleanup_Info_Node *new_node = 0;
+
if ((new_node = registered_objects_->insert (new_info)) == 0)
return -1;
else
@@ -117,6 +146,7 @@ ACE_OS_Exit_Info::at_exit_i (void *object,
return 0;
}
}
+
int
ACE_OS_Exit_Info::find (void *object)
{
@@ -131,8 +161,10 @@ ACE_OS_Exit_Info::find (void *object)
return 1;
}
}
+
return 0;
}
+
void
ACE_OS_Exit_Info::call_hooks (void)
{
@@ -156,5 +188,6 @@ ACE_OS_Exit_Info::call_hooks (void)
(*info.cleanup_hook_) (info.object_, info.param_);
}
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Cleanup.h b/dep/ACE_wrappers/ace/Cleanup.h
index 5f38ace7276..c38db701360 100644
--- a/dep/ACE_wrappers/ace/Cleanup.h
+++ b/dep/ACE_wrappers/ace/Cleanup.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Cleanup.h
@@ -12,21 +13,29 @@
* Originally in OS.h.
*/
//=============================================================================
+
#ifndef ACE_CLEANUP_H
# define ACE_CLEANUP_H
+
# include /**/ "ace/pre.h"
+
# include "ace/config-lite.h"
+
# if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
# endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include /**/ "ace/ACE_export.h"
+
#if (defined (ACE_HAS_VERSIONED_NAMESPACE) && ACE_HAS_VERSIONED_NAMESPACE == 1)
# include "ace/Global_Macros.h"
# define ACE_CLEANUP_DESTROYER_NAME ACE_PREPROC_CONCATENATE(ACE_VERSIONED_NAMESPACE_NAME, _ace_cleanup_destroyer)
#else
# define ACE_CLEANUP_DESTROYER_NAME ace_cleanup_destroyer
#endif /* ACE_HAS_VERSIONED_NAMESPACE == 1 */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Cleanup
*
@@ -37,14 +46,18 @@ class ACE_Export ACE_Cleanup
public:
/// No-op constructor.
ACE_Cleanup (void);
+
/// Destructor.
virtual ~ACE_Cleanup (void);
+
/// Cleanup method that, by default, simply deletes itself.
virtual void cleanup (void *param = 0);
};
+
// Adapter for cleanup, used by ACE_Object_Manager.
extern "C" ACE_Export
void ACE_CLEANUP_DESTROYER_NAME (ACE_Cleanup *, void *param = 0);
+
/**
* @class ACE_Cleanup_Info
*
@@ -55,18 +68,25 @@ class ACE_Export ACE_Cleanup_Info
public:
/// Default constructor.
ACE_Cleanup_Info (void);
+
/// Equality operator.
bool operator== (const ACE_Cleanup_Info &o) const;
+
/// Inequality operator.
bool operator!= (const ACE_Cleanup_Info &o) const;
+
/// Point to object that gets passed into the <cleanup_hook_>.
void *object_;
+
/// Cleanup hook that gets called back.
ACE_CLEANUP_FUNC cleanup_hook_;
+
/// Parameter passed to the <cleanup_hook_>.
void *param_;
};
+
class ACE_Cleanup_Info_Node;
+
/**
* @class ACE_OS_Exit_Info
*
@@ -79,16 +99,21 @@ class ACE_Export ACE_OS_Exit_Info
public:
/// Default constructor.
ACE_OS_Exit_Info (void);
+
/// Destructor.
~ACE_OS_Exit_Info (void);
+
/// Use to register a cleanup hook.
int at_exit_i (void *object, ACE_CLEANUP_FUNC cleanup_hook, void *param);
+
/// Look for a registered cleanup hook object. Returns 1 if already
/// registered, 0 if not.
int find (void *object);
+
/// Call all registered cleanup hooks, in reverse order of
/// registration.
void call_hooks ();
+
private:
/**
* Keeps track of all registered objects. The last node is only
@@ -97,7 +122,9 @@ private:
*/
ACE_Cleanup_Info_Node *registered_objects_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# if defined (ACE_HAS_INLINED_OSCALLS)
# if defined (ACE_INLINE)
# undef ACE_INLINE
@@ -105,6 +132,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_INLINE inline
# include "ace/Cleanup.inl"
# endif /* ACE_HAS_INLINED_OSCALLS */
+
# include /**/ "ace/post.h"
#endif /* ACE_CLEANUP_H */
diff --git a/dep/ACE_wrappers/ace/Cleanup.inl b/dep/ACE_wrappers/ace/Cleanup.inl
index a9dadfef182..9c36d6b1ffd 100644
--- a/dep/ACE_wrappers/ace/Cleanup.inl
+++ b/dep/ACE_wrappers/ace/Cleanup.inl
@@ -1,9 +1,12 @@
// -*- C++ -*-
//
// $Id: Cleanup.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_Cleanup::ACE_Cleanup (void)
{
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Cleanup_Strategies_T.h b/dep/ACE_wrappers/ace/Cleanup_Strategies_T.h
index 24ccd9d8516..776ae28441b 100644
--- a/dep/ACE_wrappers/ace/Cleanup_Strategies_T.h
+++ b/dep/ACE_wrappers/ace/Cleanup_Strategies_T.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Cleanup_Strategies_T.h
@@ -9,16 +10,22 @@
*/
//=============================================================================
+
#ifndef CLEANUP_STRATEGIES_H
#define CLEANUP_STRATEGIES_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
// For linkers that cant grok long names.
#define ACE_Cleanup_Strategy ACLE
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Cleanup_Strategy
*
@@ -31,14 +38,19 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
template <class KEY, class VALUE, class CONTAINER>
class ACE_Cleanup_Strategy
{
+
public:
+
/// Destructor.
virtual ~ACE_Cleanup_Strategy (void);
+
/// The method which will do the cleanup of the entry in the container.
virtual int cleanup (CONTAINER &container, KEY *key, VALUE *value);
};
+
//////////////////////////////////////////////////////////////////////
#define ACE_Recyclable_Handler_Cleanup_Strategy ARHCLE
+
/**
* @class ACE_Recyclable_Handler_Cleanup_Strategy
*
@@ -53,12 +65,16 @@ public:
template <class KEY, class VALUE, class CONTAINER>
class ACE_Recyclable_Handler_Cleanup_Strategy : public ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER>
{
+
public:
+
/// The method which will do the cleanup of the entry in the container.
virtual int cleanup (CONTAINER &container, KEY *key, VALUE *value);
};
+
//////////////////////////////////////////////////////////////////////
#define ACE_Refcounted_Recyclable_Handler_Cleanup_Strategy ARRHCLE
+
/**
* @class ACE_Refcounted_Recyclable_Handler_Cleanup_Strategy
*
@@ -77,7 +93,9 @@ public:
/// The method which will do the cleanup of the entry in the container.
virtual int cleanup (CONTAINER &container, KEY *key, VALUE *value);
};
+
//////////////////////////////////////////////////////////////////////
+
/**
* @class ACE_Handler_Cleanup_Strategy
*
@@ -97,8 +115,10 @@ public:
/// The method which will do the cleanup of the entry in the container.
virtual int cleanup (CONTAINER &container, KEY *key, VALUE *value);
};
+
//////////////////////////////////////////////////////////////////////
#define ACE_Null_Cleanup_Strategy ANCLE
+
/**
* @class ACE_Null_Cleanup_Strategy
*
@@ -114,13 +134,17 @@ public:
/// The dummy cleanup method.
virtual int cleanup (CONTAINER &container, KEY *key, VALUE *value);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Cleanup_Strategies_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Cleanup_Strategies_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
#endif /* CLEANUP_STRATEGIES_H */
diff --git a/dep/ACE_wrappers/ace/Codecs.cpp b/dep/ACE_wrappers/ace/Codecs.cpp
index 7556b76088c..d0bb0778304 100644
--- a/dep/ACE_wrappers/ace/Codecs.cpp
+++ b/dep/ACE_wrappers/ace/Codecs.cpp
@@ -2,28 +2,38 @@
#include "ace/Log_Msg.h"
#include "ace/OS_Memory.h"
#include "ace/OS_NS_ctype.h"
+
ACE_RCSID (ace,
Codecs,
"$Id: Codecs.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
namespace
{
// Just in case ...
#undef alphabet
#undef pad
#undef max_columns
+
// Symbols which form the Base64 alphabet (Defined as per RFC 2045)
ACE_Byte const alphabet[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+
// The padding character used in the encoding
ACE_Byte const pad = '=';
+
// Number of columns per line of encoded output (Can have a maximum
// value of 76).
int const max_columns = 72;
}
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
bool ACE_Base64::init_ = false;
+
ACE_Byte ACE_Base64::decoder_[256];
+
ACE_Byte ACE_Base64::member_[256];
+
ACE_Byte*
ACE_Base64::encode (const ACE_Byte* input,
const size_t input_len,
@@ -32,21 +42,27 @@ ACE_Base64::encode (const ACE_Byte* input,
{
if (!ACE_Base64::init_)
ACE_Base64::init();
+
if (!input)
return 0;
+
ACE_Byte* result = 0;
+
size_t length = ((input_len + 2) / 3) * 4;
size_t num_lines = length / max_columns + 1;
length += num_lines + 1;
ACE_NEW_RETURN (result, ACE_Byte[length], 0);
+
int char_count = 0;
int bits = 0;
size_t pos = 0;
int cols = 0;
+
for (size_t i = 0; i < input_len; ++i)
{
bits += input[i];
++char_count;
+
if (char_count == 3)
{
result[pos++] = alphabet[bits >> 18];
@@ -67,6 +83,7 @@ ACE_Base64::encode (const ACE_Byte* input,
bits <<= 8;
}
}
+
if (char_count != 0)
{
bits <<= (16 - (8 * char_count));
@@ -86,17 +103,21 @@ ACE_Base64::encode (const ACE_Byte* input,
cols += 2;
}
}
+
if (cols > 0 && is_chunked)
result[pos++] = '\n';
+
result[pos] = 0;
*output_len = pos;
return result;
}
+
size_t
ACE_Base64::length (const ACE_Byte* input)
{
if (!ACE_Base64::init_)
ACE_Base64::init();
+
ACE_Byte* ptr = const_cast<ACE_Byte*> (input);
while (*ptr != 0 &&
(member_[*(ptr)] == 1 || *ptr == pad
@@ -106,25 +127,31 @@ ACE_Base64::length (const ACE_Byte* input)
len = ((len + 3) / 4) * 3 + 1 ;
return len;
}
+
ACE_Byte*
ACE_Base64::decode (const ACE_Byte* input, size_t* output_len)
{
if (!ACE_Base64::init_)
ACE_Base64::init();
+
if (!input)
return 0;
+
size_t result_len = ACE_Base64::length (input);
ACE_Byte* result = 0;
ACE_NEW_RETURN (result, ACE_Byte[result_len], 0);
+
ACE_Byte* ptr = const_cast<ACE_Byte*> (input);
while (*ptr != 0 &&
(member_[*(ptr)] == 1 || *ptr == pad
|| ACE_OS::ace_isspace (*ptr)))
++ptr;
size_t input_len = ptr - input;
+
int char_count = 0;
int bits = 0;
size_t pos = 0;
+
size_t i = 0;
for (; i < input_len; ++i)
{
@@ -134,6 +161,7 @@ ACE_Base64::decode (const ACE_Byte* input, size_t* output_len)
continue;
bits += decoder_[input[i]];
++char_count;
+
if (char_count == 4)
{
result[pos++] = static_cast<ACE_Byte> (bits >> 16);
@@ -147,6 +175,7 @@ ACE_Base64::decode (const ACE_Byte* input, size_t* output_len)
bits <<= 6;
}
}
+
int errors = 0;
if ( i == input_len)
{
@@ -176,6 +205,7 @@ ACE_Base64::decode (const ACE_Byte* input, size_t* output_len)
break;
}
}
+
if (errors)
{
delete[] result;
@@ -185,6 +215,7 @@ ACE_Base64::decode (const ACE_Byte* input, size_t* output_len)
*output_len = pos;
return result;
}
+
void
ACE_Base64::init ()
{
@@ -199,5 +230,6 @@ ACE_Base64::init ()
}
return;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Codecs.h b/dep/ACE_wrappers/ace/Codecs.h
index adde72115f1..0e0f13ac319 100644
--- a/dep/ACE_wrappers/ace/Codecs.h
+++ b/dep/ACE_wrappers/ace/Codecs.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Codecs.h
@@ -14,17 +15,24 @@
*
*/
//=============================================================================
+
#ifndef ACE_CODECS_H
#define ACE_CODECS_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Basic_Types.h"
#include "ace/Global_Macros.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Base64
*
@@ -38,7 +46,9 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
class ACE_Export ACE_Base64
{
public:
+
//@{
+
/**
* Encodes a stream of bytes to Base64 data
*
@@ -49,6 +59,7 @@ public:
* @return Encoded Base64 data in byte stream or NULL if input data cannot
* be encoded.
*/
+
static ACE_Byte* encode (const ACE_Byte* input,
const size_t input_len,
size_t* output_len,
@@ -63,6 +74,7 @@ public:
*/
static ACE_Byte* decode (const ACE_Byte* input,
size_t* output_len);
+
/**
* Return the length of the encoded input data
*
@@ -71,26 +83,40 @@ public:
*
*/
static size_t length (const ACE_Byte* input);
+
//@}
+
protected:
+
// Prevent default construction.
ACE_Base64 (void) {}
+
private:
+
// Preventing copying and assignment.
ACE_Base64 (ACE_Base64 const &);
ACE_Base64 & operator= (ACE_Base64 const &);
+
/// Initialize the tables for encoding/decoding.
static void init (void);
+
private:
+
/// Alphabet used for decoding i.e decoder_[alphabet_[i = 0..63]] = i
static ACE_Byte decoder_[];
+
/// Alphabet used to check valid range of encoded input i.e
/// member_[alphabet_[0..63]] = 1
static ACE_Byte member_[];
+
/// Boolean to denote whether initialization is complete
static bool init_;
+
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
+
#endif /* ACE_CODECS_H */
diff --git a/dep/ACE_wrappers/ace/Codeset_IBM1047.cpp b/dep/ACE_wrappers/ace/Codeset_IBM1047.cpp
index b91717db347..62488c8927c 100644
--- a/dep/ACE_wrappers/ace/Codeset_IBM1047.cpp
+++ b/dep/ACE_wrappers/ace/Codeset_IBM1047.cpp
@@ -13,13 +13,18 @@
*/
//=============================================================================
+
#include "ace/Codeset_IBM1047.h"
+
#if defined (ACE_HAS_EBCDIC)
+
ACE_RCSID (ace,
Codeset_IBM1047,
"$Id: Codeset_IBM1047.cpp 81661 2008-05-09 12:05:34Z johnnyw $")
+
#include "ace/OS_Memory.h"
#include "ace/OS_NS_string.h"
+
namespace
{
char const to_IBM1047[] =
@@ -41,6 +46,7 @@ namespace
"\x30\x42\x47\x57\xEE\x33\xB6\xE1\xCD\xED\x36\x44\xCE\xCF\x31\xAA" // E0-EF
"\xFC\x9E\xAE\x8C\xDD\xDC\x39\xFB\x80\xAF\xFD\x78\x76\xB2\x9F\xFF" // F0-FF
};
+
char const from_IBM1047[] =
{
"\x00\x01\x02\x03\xCF\x09\xD3\x7F\xD4\xD5\xC3\x0B\x0C\x0D\x0E\x0F" // 00-0F
@@ -61,23 +67,29 @@ namespace
"\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\xB3\xF7\xF0\xFA\xA7\xFF" // F0-FF
};
}
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_IBM1047_ISO8859::ACE_IBM1047_ISO8859 (void)
{
}
+
ACE_IBM1047_ISO8859::~ACE_IBM1047_ISO8859 (void)
{
}
+
ACE_CDR::ULong
ACE_IBM1047_ISO8859::ncs ()
{
return 0x10020417;
}
+
ACE_CDR::ULong
ACE_IBM1047_ISO8859::tcs ()
{
return 0x00010001;
}
+
ACE_CDR::Boolean
ACE_IBM1047_ISO8859::read_char (ACE_InputCDR &in,
ACE_CDR::Char &x)
@@ -89,24 +101,31 @@ ACE_IBM1047_ISO8859::read_char (ACE_InputCDR &in,
}
return 0;
}
+
ACE_CDR::Boolean
ACE_IBM1047_ISO8859::read_string (ACE_InputCDR& in,
ACE_CDR::Char *& x)
{
ACE_CDR::ULong len;
+
in.read_ulong (len);
+
if (len > 0)
{
ACE_NEW_RETURN (x,
ACE_CDR::Char[len],
0);
+
if (this->read_char_array (in, x, len))
return 1;
+
delete [] x;
}
+
x = 0;
return 0;
}
+
ACE_CDR::Boolean
ACE_IBM1047_ISO8859::read_char_array (ACE_InputCDR& in,
ACE_CDR::Char* x,
@@ -120,10 +139,13 @@ ACE_IBM1047_ISO8859::read_char_array (ACE_InputCDR& in,
{
for (ACE_CDR::ULong i = 0; i != len; ++i)
x[i] = to_IBM1047[x[i]];
+
return 1;
}
+
return 0;
}
+
ACE_CDR::Boolean
ACE_IBM1047_ISO8859::write_char (ACE_OutputCDR& out,
ACE_CDR::Char x)
@@ -132,6 +154,7 @@ ACE_IBM1047_ISO8859::write_char (ACE_OutputCDR& out,
this->write_1 (out,
reinterpret_cast<const ACE_CDR::Octet*> (&from_IBM1047[x]));
}
+
ACE_CDR::Boolean
ACE_IBM1047_ISO8859::write_string (ACE_OutputCDR& out,
ACE_CDR::ULong len,
@@ -141,6 +164,7 @@ ACE_IBM1047_ISO8859::write_string (ACE_OutputCDR& out,
return this->write_char_array (out, x, len + 1);
return 0;
}
+
ACE_CDR::Boolean
ACE_IBM1047_ISO8859::write_char_array (ACE_OutputCDR& out,
const ACE_CDR::Char* x,
@@ -150,30 +174,39 @@ ACE_IBM1047_ISO8859::write_char_array (ACE_OutputCDR& out,
if (this->adjust (out, len, 1, buf) == 0)
{
ACE_OS::memcpy (buf, x, len);
+
for (ACE_CDR::ULong i = 0; i != len; ++i)
buf[i] = from_IBM1047[buf[i]];
+
return 1;
}
+
this->good_bit(out, 0);
return 0;
}
+
// ****************************************************************
+
ACE_ISO8859_IBM1047::ACE_ISO8859_IBM1047 (void)
{
}
+
ACE_ISO8859_IBM1047::~ACE_ISO8859_IBM1047 (void)
{
}
+
ACE_CDR::ULong
ACE_ISO8859_IBM1047::ncs ()
{
return 0x00010001;
}
+
ACE_CDR::ULong
ACE_ISO8859_IBM1047::tcs ()
{
return 0x10020417;
}
+
ACE_CDR::Boolean
ACE_ISO8859_IBM1047::read_char (ACE_InputCDR& in,
ACE_CDR::Char& x)
@@ -185,24 +218,31 @@ ACE_ISO8859_IBM1047::read_char (ACE_InputCDR& in,
}
return 0;
}
+
ACE_CDR::Boolean
ACE_ISO8859_IBM1047::read_string (ACE_InputCDR &in,
ACE_CDR::Char *&x)
{
ACE_CDR::ULong len;
+
in.read_ulong (len);
+
if (len > 0)
{
ACE_NEW_RETURN (x,
ACE_CDR::Char[len],
0);
+
if (this->read_char_array (in, x, len))
return 1;
+
delete [] x;
}
+
x = 0;
return 0;
}
+
ACE_CDR::Boolean
ACE_ISO8859_IBM1047::read_char_array (ACE_InputCDR &in,
ACE_CDR::Char *x,
@@ -216,10 +256,13 @@ ACE_ISO8859_IBM1047::read_char_array (ACE_InputCDR &in,
{
for (ACE_CDR::ULong i = 0; i != len; ++i)
x[i] = from_IBM1047[x[i]];
+
return 1;
}
+
return 0;
}
+
ACE_CDR::Boolean
ACE_ISO8859_IBM1047::write_char (ACE_OutputCDR &out,
ACE_CDR::Char x)
@@ -228,6 +271,7 @@ ACE_ISO8859_IBM1047::write_char (ACE_OutputCDR &out,
this->write_1 (out,
reinterpret_cast<const ACE_CDR::Octet *> (&to_IBM1047[x]));
}
+
ACE_CDR::Boolean
ACE_ISO8859_IBM1047::write_string (ACE_OutputCDR& out,
ACE_CDR::ULong len,
@@ -238,22 +282,29 @@ ACE_ISO8859_IBM1047::write_string (ACE_OutputCDR& out,
else
return 0;
}
+
ACE_CDR::Boolean
ACE_ISO8859_IBM1047::write_char_array (ACE_OutputCDR &out,
const ACE_CDR::Char *x,
ACE_CDR::ULong len)
{
char *buf = 0;
+
if (this->adjust (out, len, 1, buf) == 0)
{
ACE_OS::memcpy (buf, x, len);
+
for (ACE_CDR::ULong i = 0; i != len; ++i)
buf[i] = to_IBM1047[buf[i]];
+
return 1;
}
+
this->good_bit (out, 0);
return 0;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_EBCDIC */
diff --git a/dep/ACE_wrappers/ace/Codeset_IBM1047.h b/dep/ACE_wrappers/ace/Codeset_IBM1047.h
index e3feebf539b..7e0df2b5c08 100644
--- a/dep/ACE_wrappers/ace/Codeset_IBM1047.h
+++ b/dep/ACE_wrappers/ace/Codeset_IBM1047.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Codeset_IBM1047.h
@@ -12,17 +13,25 @@
*/
//=============================================================================
+
#ifndef ACE_CODESET_IMB1047_H
#define ACE_CODESET_IMB1047_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_EBCDIC)
+
#include "ace/CDR_Stream.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// ****************************************************************
+
/**
* @class ACE_IBM1047_ISO8859
*
@@ -37,8 +46,10 @@ class ACE_Export ACE_IBM1047_ISO8859 : public ACE_Char_Codeset_Translator
public:
/// A do nothing constructor.
ACE_IBM1047_ISO8859 (void);
+
/// Virtual destruction
virtual ~ACE_IBM1047_ISO8859 (void);
+
// = Documented in $ACE_ROOT/ace/CDR_Stream.h
virtual ACE_CDR::Boolean read_char (ACE_InputCDR &,
ACE_CDR::Char &);
@@ -55,6 +66,7 @@ public:
virtual ACE_CDR::Boolean write_char_array (ACE_OutputCDR &,
const ACE_CDR::Char *,
ACE_CDR::ULong);
+
/// Return the native codeset ID as defined in the OSF code and character
/// set registry, 0x10020417
virtual ACE_CDR::ULong ncs ();
@@ -62,6 +74,7 @@ public:
/// set registry, 0x00010001
virtual ACE_CDR::ULong tcs ();
};
+
/**
* @class ACE_ISO8859_IBM1047
*
@@ -76,8 +89,10 @@ class ACE_Export ACE_ISO8859_IBM1047 : public ACE_Char_Codeset_Translator
public:
/// A do nothing constructor.
ACE_ISO8859_IBM1047 (void);
+
/// Virtual destruction
virtual ~ACE_ISO8859_IBM1047 (void);
+
// = Documented in $ACE_ROOT/ace/CDR_Stream.h
virtual ACE_CDR::Boolean read_char (ACE_InputCDR &,
ACE_CDR::Char &);
@@ -94,6 +109,7 @@ public:
virtual ACE_CDR::Boolean write_char_array (ACE_OutputCDR &,
const ACE_CDR::Char *,
ACE_CDR::ULong);
+
/// Return the native codeset ID as defined in the OSF code and character
/// set registry, 0x00010001
virtual ACE_CDR::ULong ncs ();
@@ -101,8 +117,12 @@ public:
/// set registry, 0x10020417
virtual ACE_CDR::ULong tcs ();
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_EBCDIC */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_CODESET_IMB1047_H */
diff --git a/dep/ACE_wrappers/ace/Codeset_Registry.cpp b/dep/ACE_wrappers/ace/Codeset_Registry.cpp
index 98b084377a4..789340af33c 100644
--- a/dep/ACE_wrappers/ace/Codeset_Registry.cpp
+++ b/dep/ACE_wrappers/ace/Codeset_Registry.cpp
@@ -10,17 +10,23 @@
* @author Phil Mesnier <mesnier_p@ociweb.com>
*/
//=============================================================================
+
#include "ace/Codeset_Registry.h"
#include "ace/OS_Memory.h"
#include "ace/OS_NS_string.h"
+
// $Id: Codeset_Registry.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#if !defined (__ACE_INLINE__)
#include "ace/Codeset_Registry.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID (ace,
Codeset_Registry,
"$Id: Codeset_Registry.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
int
ACE_Codeset_Registry::locale_to_registry_i (const ACE_CString &locale,
ACE_CDR::ULong &codeset_id,
@@ -44,6 +50,7 @@ ACE_Codeset_Registry::locale_to_registry_i (const ACE_CString &locale,
}
return 1;
}
+
int
ACE_Codeset_Registry::registry_to_locale_i (ACE_CDR::ULong codeset_id,
ACE_CString &locale,
@@ -67,6 +74,7 @@ ACE_Codeset_Registry::registry_to_locale_i (ACE_CDR::ULong codeset_id,
}
return 1;
}
+
int
ACE_Codeset_Registry::is_compatible_i (ACE_CDR::ULong codeset_id,
ACE_CDR::ULong other)
@@ -80,14 +88,17 @@ ACE_Codeset_Registry::is_compatible_i (ACE_CDR::ULong codeset_id,
if (other == registry_db_[i].codeset_id_)
rhs = &registry_db_[i];
}
+
if (lhs == 0 || rhs == 0)
return 0;
+
for (ACE_CDR::UShort l = 0; l < lhs->num_sets_; l++)
for (ACE_CDR::UShort r = 0; r < rhs->num_sets_; r++)
if (rhs->char_sets_[r] == lhs->char_sets_[l])
return 1;
return 0;
}
+
ACE_CDR::Short
ACE_Codeset_Registry::get_max_bytes_i (ACE_CDR::ULong codeset_id)
{
@@ -96,5 +107,6 @@ ACE_Codeset_Registry::get_max_bytes_i (ACE_CDR::ULong codeset_id)
return registry_db_[i].max_bytes_;
return 0;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Codeset_Registry.h b/dep/ACE_wrappers/ace/Codeset_Registry.h
index 441a8188089..80887d9a106 100644
--- a/dep/ACE_wrappers/ace/Codeset_Registry.h
+++ b/dep/ACE_wrappers/ace/Codeset_Registry.h
@@ -20,41 +20,52 @@
* @author Phil Mesnier <mesnier_p@ociweb.com>
*/
//=============================================================================
+
#ifndef ACE_CODESET_REGISTRY_H
#define ACE_CODESET_REGISTRY_H
+
#include /**/ "ace/pre.h"
#include "ace/SString.h"
#include "ace/CDR_Base.h"
#include "ace/Codeset_Symbols.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_DCE_CODESET_REGISTRY)
#include /**/ <dce/rpc.h>
#endif /* ACE_HAS_DCE_CODESET_REGISTRY */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Export ACE_Codeset_Registry
{
public:
+
/// Based on a locale string, find the registry value and optional codeset
/// collection. This wraps the dce_cs_loc_to_rgy function, or emulates it.
static int locale_to_registry (const ACE_CString &locale,
ACE_CDR::ULong &codeset_id,
ACE_CDR::UShort * = 0,
ACE_CDR::UShort ** = 0);
+
/// Based on a registry value, find the locale string and optional codeset
/// collection. This wraps the dce_cs_rgy_to_loc function, or emulates it.
static int registry_to_locale (ACE_CDR::ULong codeset_id,
ACE_CString &locale,
ACE_CDR::UShort * = 0,
ACE_CDR::UShort ** = 0);
+
/// Tell if two codesets are compatible. This wraps the
/// rpc_cs_char_set_compat_check function.
static int is_compatible (ACE_CDR::ULong codeset_id,
ACE_CDR::ULong other);
+
/// Return the max number of bytes required to represent a single character.
/// This wraps the rpc_rgy_get_max_bytes function.
static ACE_CDR::Short get_max_bytes (ACE_CDR::ULong codeset_id);
+
enum {max_charsets_ = 5};
protected:
typedef struct {
@@ -65,9 +76,11 @@ protected:
ACE_CDR::UShort char_sets_[max_charsets_];
ACE_CDR::UShort max_bytes_;
} registry_entry;
+
private:
static size_t const num_registry_entries_;
static registry_entry const registry_db_[];
+
static int locale_to_registry_i (const ACE_CString &locale,
ACE_CDR::ULong &codeset_id,
ACE_CDR::UShort * = 0,
@@ -80,10 +93,13 @@ private:
ACE_CDR::ULong other);
static ACE_CDR::Short get_max_bytes_i (ACE_CDR::ULong codeset_id);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Codeset_Registry.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_CODESET_REGISTRY_H */
diff --git a/dep/ACE_wrappers/ace/Codeset_Registry.inl b/dep/ACE_wrappers/ace/Codeset_Registry.inl
index a27444f52b4..4419cf5e7fc 100644
--- a/dep/ACE_wrappers/ace/Codeset_Registry.inl
+++ b/dep/ACE_wrappers/ace/Codeset_Registry.inl
@@ -13,7 +13,9 @@
* @author Phil Mesnier <mesnier_p@ociweb.com>
*/
//=============================================================================
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
int
ACE_Codeset_Registry::locale_to_registry(const ACE_CString &locale,
@@ -36,6 +38,7 @@ ACE_Codeset_Registry::locale_to_registry(const ACE_CString &locale,
char_sets);
#endif /* ACE_HAS_DCE_CODESET_REGISTRY */
}
+
// based on a registry value, find the locale string and optional codeset
// collection. This wraps the dce_cs_rgy_to_loc function, or emulates it.
ACE_INLINE
@@ -63,6 +66,7 @@ ACE_Codeset_Registry::registry_to_locale(ACE_CDR::ULong codeset_id,
char_sets);
#endif /* ACE_HAS_DCE_CODESET_REGISTRY */
}
+
// Tell if two codesets are compatible. This wraps the
// rpc_cs_char_set_compat_check function.
ACE_INLINE
@@ -78,6 +82,7 @@ ACE_Codeset_Registry::is_compatible (ACE_CDR::ULong codeset_id,
return ACE_Codeset_Registry::is_compatible_i (codeset_id,other);
#endif /* ACE_HAS_DCE_CODESET_REGISTRY */
}
+
// Return the max number of bytes required to represent a single character.
// This wraps the rpc_rgy_get_max_bytes function.
ACE_INLINE
@@ -93,4 +98,5 @@ ACE_Codeset_Registry::get_max_bytes (ACE_CDR::ULong codeset_id)
return ACE_Codeset_Registry::get_max_bytes_i (codeset_id);
#endif /* ACE_HAS_DCE_CODESET_REGISTRY */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Codeset_Registry_db.cpp b/dep/ACE_wrappers/ace/Codeset_Registry_db.cpp
index 05d3bf983cb..1f900db9b4f 100644
--- a/dep/ACE_wrappers/ace/Codeset_Registry_db.cpp
+++ b/dep/ACE_wrappers/ace/Codeset_Registry_db.cpp
@@ -9,8 +9,11 @@
* mkcsregdb. The source is in $ACE_ROOT/apps/mkcsregdb. It will generate a new
* copy of this file, with the registry_db_ array properly initialized.
*/
+
#include "ace/Codeset_Registry.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_Codeset_Registry::registry_entry const
ACE_Codeset_Registry::registry_db_[] =
{
@@ -24,6 +27,8 @@ ACE_Codeset_Registry::registry_db_[] =
{"IBM-1251 (CCSID 01251); MS Windows Cyrillic","CP1251",0x100204e3,1,{0x0015},1},
{"IBM-855 (CCSID 04951); Cyrillic Personal Computer","CP855",0x10021357,1,{0x0015},1}
};
+
size_t const ACE_Codeset_Registry::num_registry_entries_ = 9;
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Codeset_Symbols.h b/dep/ACE_wrappers/ace/Codeset_Symbols.h
index 2f52c35578e..2cfb6bc26b6 100644
--- a/dep/ACE_wrappers/ace/Codeset_Symbols.h
+++ b/dep/ACE_wrappers/ace/Codeset_Symbols.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Codeset_Symbols.h
@@ -12,6 +13,7 @@
//=============================================================================
#ifndef CODESET_SYMBOLS_H
#define CODESET_SYMBOLS_H
+
// These numbers are assigned by the OpenGroup, a database is
// available at
//
@@ -213,6 +215,7 @@
#define ACE_CODESET_ID_EBCDIC_ASCII_AND_JEF 0x10040004U
#define ACE_CODESET_ID_EBCDIC_KATAKANA_AND_JEF 0x10040005U
#define ACE_CODESET_ID_EBCDIC_JAPANESE_ENGLISH_AND_JEF 0x10040006U
+
#define ACE_CODESET_ID_TAO_BACKWARD_COMPATIBLE 0xf54414F0U
#endif // CODESET_SYMBOLS_H
diff --git a/dep/ACE_wrappers/ace/Condition_Recursive_Thread_Mutex.cpp b/dep/ACE_wrappers/ace/Condition_Recursive_Thread_Mutex.cpp
index 00542479376..658100f1818 100644
--- a/dep/ACE_wrappers/ace/Condition_Recursive_Thread_Mutex.cpp
+++ b/dep/ACE_wrappers/ace/Condition_Recursive_Thread_Mutex.cpp
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
/**
* @file Condition_Recursive_Thread_Mutex.cpp
*
@@ -8,22 +9,29 @@
*
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
+
#include "ace/Condition_Recursive_Thread_Mutex.h"
+
#if defined (ACE_HAS_THREADS)
+
#if defined (ACE_HAS_DUMP)
# include "ace/Log_Msg.h"
#endif /* ACE_HAS_DUMP */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
int
ACE_Condition<ACE_Recursive_Thread_Mutex>::remove (void)
{
return ACE_OS::cond_destroy (&this->cond_);
}
+
void
ACE_Condition<ACE_Recursive_Thread_Mutex>::dump (void) const
{
#if defined (ACE_HAS_DUMP)
// ACE_TRACE ("ACE_Condition<MUTEX>::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
// No dump method for ACE_cond_t even in emulated mode.
// cond_.dump ();
@@ -32,29 +40,35 @@ ACE_Condition<ACE_Recursive_Thread_Mutex>::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
ACE_Condition<ACE_Recursive_Thread_Mutex>::~ACE_Condition (void)
{
this->remove ();
}
+
ACE_Condition<ACE_Recursive_Thread_Mutex>::ACE_Condition (ACE_Recursive_Thread_Mutex &m)
: mutex_ (m)
{
ACE_OS::cond_init (&this->cond_);
}
+
int
ACE_Condition<ACE_Recursive_Thread_Mutex>::wait (const ACE_Time_Value *abstime)
{
return this->wait (this->mutex_, abstime);
}
+
int
ACE_Condition<ACE_Recursive_Thread_Mutex>::wait (ACE_Recursive_Thread_Mutex &mutex,
const ACE_Time_Value *abstime)
{
ACE_recursive_mutex_state mutex_state_holder;
ACE_recursive_thread_mutex_t &recursive_mutex = mutex.mutex ();
+
if (ACE_OS::recursive_mutex_cond_unlock (&recursive_mutex,
mutex_state_holder) == -1)
return -1;
+
// We wait on the condition, specifying the nesting mutex. For platforms
// with ACE_HAS_RECURSIVE_MUTEXES, this is the recursive mutex itself,
// and is the same as recursive_mutex, above. The caller should have been
@@ -82,28 +96,35 @@ ACE_Condition<ACE_Recursive_Thread_Mutex>::wait (ACE_Recursive_Thread_Mutex &mut
ACE_OS::recursive_mutex_cond_relock (&recursive_mutex,
mutex_state_holder);
}
+
return result;
}
+
int
ACE_Condition<ACE_Recursive_Thread_Mutex>::signal (void)
{
return ACE_OS::cond_signal (&this->cond_);
}
+
int
ACE_Condition<ACE_Recursive_Thread_Mutex>::broadcast (void)
{
return ACE_OS::cond_broadcast (&this->cond_);
}
+
ACE_Recursive_Thread_Mutex &
ACE_Condition<ACE_Recursive_Thread_Mutex>::mutex (void)
{
return this->mutex_;
}
+
ACE_Condition_Recursive_Thread_Mutex::ACE_Condition_Recursive_Thread_Mutex (
ACE_Recursive_Thread_Mutex &m) :
ACE_Condition<ACE_Recursive_Thread_Mutex> (m)
{
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_THREADS */
diff --git a/dep/ACE_wrappers/ace/Condition_Recursive_Thread_Mutex.h b/dep/ACE_wrappers/ace/Condition_Recursive_Thread_Mutex.h
index 33eb522b8c3..8625aa2fcea 100644
--- a/dep/ACE_wrappers/ace/Condition_Recursive_Thread_Mutex.h
+++ b/dep/ACE_wrappers/ace/Condition_Recursive_Thread_Mutex.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file Condition_Recursive_Thread_Mutex.h
@@ -10,19 +11,26 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//==========================================================================
+
#ifndef ACE_CONDITION_RECURSIVE_THREAD_MUTEX_H
#define ACE_CONDITION_RECURSIVE_THREAD_MUTEX_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if !defined (ACE_HAS_THREADS)
# include "ace/Null_Condition.h"
#else /* ACE_HAS_THREADS */
#include "ace/Recursive_Thread_Mutex.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template <class ACE_LOCK> class ACE_Condition;
+
/**
* @class ACE_Condition<ACE_Recursive_Thread_Mutex>
*
@@ -36,14 +44,17 @@ class ACE_Export ACE_Condition<ACE_Recursive_Thread_Mutex>
public:
/// Initialize the condition variable with a recursive mutex.
ACE_Condition (ACE_Recursive_Thread_Mutex &m);
+
/// Implicitly destroy the condition variable.
~ACE_Condition (void);
+
/**
* Explicitly destroy the condition variable. Note that only one
* thread should call this method since it doesn't protect against
* race conditions.
*/
int remove (void);
+
/**
* Block on condition, or until absolute time-of-day has passed. If
* abstime == 0 use "blocking" <wait> semantics. Else, if <abstime>
@@ -51,6 +62,7 @@ public:
* <wait> returns -1 and sets errno to ETIME.
*/
int wait (const ACE_Time_Value *abstime = 0);
+
/**
* Block on condition or until absolute time-of-day has passed. If
* abstime == 0 use "blocking" wait() semantics on the recursive @a mutex
@@ -61,24 +73,35 @@ public:
*/
int wait (ACE_Recursive_Thread_Mutex &mutex,
const ACE_Time_Value *abstime = 0);
+
/// Signal one waiting thread.
int signal (void);
+
/// Signal *all* waiting threads.
int broadcast (void);
+
/// Returns a reference to the underlying mutex;
ACE_Recursive_Thread_Mutex &mutex (void);
+
/// Dump the state of an object.
void dump (void) const;
+
private:
+
// = Prevent assignment and copying.
void operator= (const ACE_Condition<ACE_Recursive_Thread_Mutex> &);
ACE_Condition (const ACE_Condition<ACE_Recursive_Thread_Mutex> &);
+
private:
+
/// A normal (i.e., non-recursive) condition variable.
ACE_cond_t cond_;
+
/// Reference to the recursive mutex.
ACE_Recursive_Thread_Mutex &mutex_;
+
};
+
class ACE_Export ACE_Condition_Recursive_Thread_Mutex
: public ACE_Condition<ACE_Recursive_Thread_Mutex>
{
@@ -86,8 +109,11 @@ public:
/// Initialize the condition variable with a recursive mutex.
ACE_Condition_Recursive_Thread_Mutex (ACE_Recursive_Thread_Mutex &m);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* !ACE_HAS_THREADS */
+
#include /**/ "ace/post.h"
#endif /* ACE_CONDITION_RECURSIVE_THREAD_MUTEX_H */
diff --git a/dep/ACE_wrappers/ace/Condition_T.h b/dep/ACE_wrappers/ace/Condition_T.h
index 02bd5f56e9b..8e6132ec92c 100644
--- a/dep/ACE_wrappers/ace/Condition_T.h
+++ b/dep/ACE_wrappers/ace/Condition_T.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file Condition_T.h
@@ -10,17 +11,25 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//==========================================================================
+
#ifndef ACE_CONDITION_T_H
#define ACE_CONDITION_T_H
+
#include /**/ "ace/pre.h"
+
#include "ace/OS_NS_Thread.h"
#include "ace/Lock.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_THREADS) /* ACE platform supports some form of threading. */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Time_Value;
+
/**
* @class ACE_Condition
*
@@ -49,8 +58,10 @@ public:
/// Initialize the condition variable.
ACE_Condition (MUTEX &m, int type = USYNC_THREAD,
const ACE_TCHAR *name = 0, void *arg = 0);
+
/// Implicitly destroy the condition variable.
~ACE_Condition (void);
+
// = Lock accessors.
/**
* Block on condition, or until absolute time-of-day has passed. If
@@ -59,8 +70,10 @@ public:
* <wait> returns -1 and sets errno to ETIME.
*/
int wait (const ACE_Time_Value *abstime);
+
/// Block on condition.
int wait (void);
+
/**
* Block on condition or until absolute time-of-day has passed. If
* abstime == 0 use "blocking" wait() semantics on the <mutex>
@@ -70,29 +83,39 @@ public:
* and sets errno to ETIME.
*/
int wait (MUTEX &mutex, const ACE_Time_Value *abstime = 0);
+
/// Signal one waiting thread.
int signal (void);
+
/// Signal *all* waiting threads.
int broadcast (void);
+
// = Utility methods.
/// Explicitly destroy the condition variable.
int remove (void);
+
/// Returns a reference to the underlying mutex_;
MUTEX &mutex (void);
+
/// Dump the state of an object.
void dump (void) const;
+
// ACE_ALLOC_HOOK_DECLARE;
// Declare the dynamic allocation hooks.
+
protected:
/// Condition variable.
ACE_cond_t cond_;
+
/// Reference to mutex lock.
MUTEX &mutex_;
+
private:
// = Prevent assignment and initialization.
ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Condition<MUTEX> &))
ACE_UNIMPLEMENTED_FUNC (ACE_Condition (const ACE_Condition<MUTEX> &))
};
+
/**
* @class ACE_Thread_Condition
*
@@ -116,22 +139,30 @@ class ACE_Thread_Condition : public ACE_Condition<MUTEX>
public:
// = Initialization method.
ACE_Thread_Condition (MUTEX &m, const ACE_TCHAR *name = 0, void *arg = 0);
+
/// Dump the state of an object.
void dump (void) const;
+
// ACE_ALLOC_HOOK_DECLARE;
// Declare the dynamic allocation hooks.
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Condition_T.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Condition_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Condition_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#endif /* ACE_HAS_THREADS */
+
#include /**/ "ace/post.h"
#endif /* ACE_CONDITION_T_H */
diff --git a/dep/ACE_wrappers/ace/Condition_T.inl b/dep/ACE_wrappers/ace/Condition_T.inl
index d8c74727ad8..e3b452734a2 100644
--- a/dep/ACE_wrappers/ace/Condition_T.inl
+++ b/dep/ACE_wrappers/ace/Condition_T.inl
@@ -1,41 +1,51 @@
// -*- C++ -*-
//
// $Id: Condition_T.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template<class MUTEX> ACE_INLINE int
ACE_Condition<MUTEX>::remove (void)
{
// ACE_TRACE ("ACE_Condition<MUTEX>::remove");
+
// cond_destroy() is called in a loop if the condition variable is
// BUSY. This avoids a condition where a condition is signaled and
// because of some timing problem, the thread that is to be signaled
// has called the cond_wait routine after the signal call. Since
// the condition signal is not queued in any way, deadlock occurs.
+
int result = 0;
+
while ((result = ACE_OS::cond_destroy (&this->cond_)) == -1
&& errno == EBUSY)
{
ACE_OS::cond_broadcast (&this->cond_);
ACE_OS::thr_yield ();
}
+
return result;
}
+
template<class MUTEX> ACE_INLINE MUTEX &
ACE_Condition<MUTEX>::mutex (void)
{
// ACE_TRACE ("ACE_Condition<MUTEX>::mutex");
return this->mutex_;
}
+
template <class MUTEX> ACE_INLINE int
ACE_Condition<MUTEX>::signal (void)
{
// ACE_TRACE ("ACE_Condition<MUTEX>::signal");
return ACE_OS::cond_signal (&this->cond_);
}
+
template <class MUTEX> ACE_INLINE int
ACE_Condition<MUTEX>::broadcast (void)
{
// ACE_TRACE ("ACE_Condition<MUTEX>::broadcast");
return ACE_OS::cond_broadcast (&this->cond_);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Condition_Thread_Mutex.cpp b/dep/ACE_wrappers/ace/Condition_Thread_Mutex.cpp
index da3e7397e03..d1142f72172 100644
--- a/dep/ACE_wrappers/ace/Condition_Thread_Mutex.cpp
+++ b/dep/ACE_wrappers/ace/Condition_Thread_Mutex.cpp
@@ -8,20 +8,29 @@
*
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
+
#include "ace/Condition_Thread_Mutex.h"
+
#if defined (ACE_HAS_THREADS)
+
#if !defined (__ACE_INLINE__)
#include "ace/Condition_Thread_Mutex.inl"
#endif /* __ACE_INLINE__ */
+
#include "ace/Log_Msg.h"
+
ACE_RCSID(ace, Condition_Thread_Mutex, "$Id: Condition_Thread_Mutex.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_Condition_Thread_Mutex)
+
void
ACE_Condition_Thread_Mutex::dump (void) const
{
#if defined (ACE_HAS_DUMP)
// ACE_TRACE ("ACE_Condition_Thread_Mutex::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n")));
#if defined (ACE_WIN32)
@@ -32,6 +41,7 @@ ACE_Condition_Thread_Mutex::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
ACE_Condition_Thread_Mutex::ACE_Condition_Thread_Mutex (ACE_Thread_Mutex &m,
const ACE_TCHAR *name,
void *arg)
@@ -47,6 +57,7 @@ ACE_Condition_Thread_Mutex::ACE_Condition_Thread_Mutex (ACE_Thread_Mutex &m,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_Condition_Thread_Mutex::ACE_Condition_Thread_Mutex")));
}
+
ACE_Condition_Thread_Mutex::
ACE_Condition_Thread_Mutex (ACE_Thread_Mutex &m,
ACE_Condition_Attributes &attributes,
@@ -61,20 +72,24 @@ ACE_Condition_Thread_Mutex (ACE_Thread_Mutex &m,
ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_Condition_Thread_Mutex::ACE_Condition_Thread_Mutex")));
}
+
ACE_Condition_Thread_Mutex::~ACE_Condition_Thread_Mutex (void)
{
// ACE_TRACE ("ACE_Condition_Thread_Mutex::~ACE_Condition_Thread_Mutex");
this->remove ();
}
+
// Peform an "alertable" timed wait. If the argument <abstime> == 0
// then we do a regular <cond_wait>, else we do a timed wait for up to
// <abstime> using the <cond_timedwait> function.
+
int
ACE_Condition_Thread_Mutex::wait (void)
{
// ACE_TRACE ("ACE_Condition_Thread_Mutex::wait");
return ACE_OS::cond_wait (&this->cond_, &this->mutex_.lock_);
}
+
int
ACE_Condition_Thread_Mutex::wait (ACE_Thread_Mutex &mutex,
const ACE_Time_Value *abstime)
@@ -84,24 +99,29 @@ ACE_Condition_Thread_Mutex::wait (ACE_Thread_Mutex &mutex,
&mutex.lock_,
const_cast <ACE_Time_Value *> (abstime));
}
+
int
ACE_Condition_Thread_Mutex::wait (const ACE_Time_Value *abstime)
{
// ACE_TRACE ("ACE_Condition_Thread_Mutex::wait");
return this->wait (this->mutex_, abstime);
}
+
int
ACE_Condition_Thread_Mutex::signal (void)
{
// ACE_TRACE ("ACE_Condition_Thread_Mutex::signal");
return ACE_OS::cond_signal (&this->cond_);
}
+
int
ACE_Condition_Thread_Mutex::broadcast (void)
{
// ACE_TRACE ("ACE_Condition_Thread_Mutex::broadcast");
return ACE_OS::cond_broadcast (&this->cond_);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_THREADS */
diff --git a/dep/ACE_wrappers/ace/Condition_Thread_Mutex.h b/dep/ACE_wrappers/ace/Condition_Thread_Mutex.h
index 4889ad28a80..bc47ae2514a 100644
--- a/dep/ACE_wrappers/ace/Condition_Thread_Mutex.h
+++ b/dep/ACE_wrappers/ace/Condition_Thread_Mutex.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file Condition_Thread_Mutex.h
@@ -10,36 +11,49 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//==========================================================================
+
#ifndef ACE_CONDITION_THREAD_MUTEX_H
#define ACE_CONDITION_THREAD_MUTEX_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if !defined (ACE_HAS_THREADS)
# include "ace/Null_Condition.h"
#else /* ACE_HAS_THREADS */
// ACE platform supports some form of threading.
+
#include "ace/Thread_Mutex.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Time_Value;
+
class ACE_Export ACE_Condition_Attributes
{
public:
/// Constructor
ACE_Condition_Attributes (int type = ACE_DEFAULT_SYNCH_TYPE);
+
/// Destructor
~ACE_Condition_Attributes (void);
+
private:
friend class ACE_Condition_Thread_Mutex;
+
/// The attributes
ACE_condattr_t attributes_;
+
private:
// = Prevent assignment and initialization.
void operator= (const ACE_Condition_Attributes &);
ACE_Condition_Attributes (const ACE_Condition_Attributes &);
};
+
/**
* @class ACE_Condition_Thread_Mutex
*
@@ -67,19 +81,23 @@ public:
ACE_Condition_Thread_Mutex (ACE_Thread_Mutex &m,
const ACE_TCHAR *name = 0,
void *arg = 0);
+
/// Initialize the condition variable.
ACE_Condition_Thread_Mutex (ACE_Thread_Mutex &m,
ACE_Condition_Attributes &attributes,
const ACE_TCHAR *name = 0,
void *arg = 0);
+
/// Implicitly destroy the condition variable.
~ACE_Condition_Thread_Mutex (void);
+
/**
* Explicitly destroy the condition variable. Note that only one
* thread should call this method since it doesn't protect against
* race conditions.
*/
int remove (void);
+
/**
* Block on condition, or until absolute time-of-day has passed. If
* abstime == 0 use "blocking" <wait> semantics. Else, if @a abstime
@@ -87,8 +105,10 @@ public:
* <wait> returns -1 and sets errno to ETIME.
*/
int wait (const ACE_Time_Value *abstime);
+
/// Block on condition.
int wait (void);
+
/**
* Block on condition or until absolute time-of-day has passed. If
* abstime == 0 use "blocking" wait() semantics on the <mutex>
@@ -98,37 +118,48 @@ public:
* and sets errno to ETIME.
*/
int wait (ACE_Thread_Mutex &mutex, const ACE_Time_Value *abstime = 0);
+
/// Signal one waiting thread.
int signal (void);
+
/// Signal *all* waiting threads.
int broadcast (void);
+
/// Returns a reference to the underlying mutex;
ACE_Thread_Mutex &mutex (void);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
/// Condition variable.
ACE_cond_t cond_;
+
/// Reference to mutex lock.
ACE_Thread_Mutex &mutex_;
+
/// Keeps track of whether <remove> has been called yet to avoid
/// multiple <remove> calls, e.g., explicitly and implicitly in the
/// destructor. This flag isn't protected by a lock, so make sure
/// that you don't have multiple threads simultaneously calling
/// <remove> on the same object, which is a bad idea anyway...
bool removed_;
+
private:
// = Prevent assignment and initialization.
void operator= (const ACE_Condition_Thread_Mutex &);
ACE_Condition_Thread_Mutex (const ACE_Condition_Thread_Mutex &);
};
+
#if 0
// The following class is commented out since there doesn't
// appear to be a portable and robust means of implementing this
// functionality across platforms. If you know of a portable and
// robust way to implement this functionality please let us know.
+
/**
* @class ACE_Process_Condition
*
@@ -138,17 +169,23 @@ class ACE_Export ACE_Process_Condition
{
public:
ACE_Process_Condition (MUTEX &m, const ACE_TCHAR *name = 0, void *arg = 0);
+
/// Dump the state of an object.
void dump (void) const;
+
// ACE_ALLOC_HOOK_DECLARE;
// Declare the dynamic allocation hooks.
};
#endif /* 0 */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Condition_Thread_Mutex.inl"
#endif /* __ACE_INLINE__ */
+
#endif /* !ACE_HAS_THREADS */
+
#include /**/ "ace/post.h"
#endif /* ACE_CONDITION_THREAD_MUTEX_H */
diff --git a/dep/ACE_wrappers/ace/Condition_Thread_Mutex.inl b/dep/ACE_wrappers/ace/Condition_Thread_Mutex.inl
index e99d4780fef..851269e4af6 100644
--- a/dep/ACE_wrappers/ace/Condition_Thread_Mutex.inl
+++ b/dep/ACE_wrappers/ace/Condition_Thread_Mutex.inl
@@ -1,30 +1,38 @@
// -*- C++ -*-
//
// $Id: Condition_Thread_Mutex.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_Condition_Attributes::ACE_Condition_Attributes (int type)
{
(void) ACE_OS::condattr_init (this->attributes_, type);
}
+
ACE_INLINE
ACE_Condition_Attributes::~ACE_Condition_Attributes (void)
{
ACE_OS::condattr_destroy (this->attributes_);
}
+
ACE_INLINE int
ACE_Condition_Thread_Mutex::remove (void)
{
// ACE_TRACE ("ACE_Condition_Thread_Mutex::remove");
+
// <cond_destroy> is called in a loop if the condition variable is
// BUSY. This avoids a condition where a condition is signaled and
// because of some timing problem, the thread that is to be signaled
// has called the cond_wait routine after the signal call. Since
// the condition signal is not queued in any way, deadlock occurs.
+
int result = 0;
+
if (!this->removed_)
{
this->removed_ = true;
+
while ((result = ACE_OS::cond_destroy (&this->cond_)) == -1
&& errno == EBUSY)
{
@@ -34,21 +42,25 @@ ACE_Condition_Thread_Mutex::remove (void)
}
return result;
}
+
ACE_INLINE ACE_Thread_Mutex &
ACE_Condition_Thread_Mutex::mutex (void)
{
// ACE_TRACE ("ACE_Condition_Thread_Mutex::mutex");
return this->mutex_;
}
+
#if 0
template <class MUTEX> void
ACE_Process_Condition<MUTEX>::dump (void) const
{
#if defined (ACE_HAS_DUMP)
// ACE_TRACE ("ACE_Process_Condition<MUTEX>::dump");
+
ACE_Condition<MUTEX>::dump ();
#endif /* ACE_HAS_DUMP */
}
+
template <class MUTEX>
ACE_Process_Condition<MUTEX>::ACE_Process_Condition (MUTEX &m,
const ACE_TCHAR *name,
@@ -58,4 +70,5 @@ ACE_Process_Condition<MUTEX>::ACE_Process_Condition (MUTEX &m,
// ACE_TRACE ("ACE_Process_Condition<MUTEX>::ACE_Process_Condition");
}
#endif /* 0 */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Configuration.cpp b/dep/ACE_wrappers/ace/Configuration.cpp
index 2cd03a12ac6..fd8548d9e8d 100644
--- a/dep/ACE_wrappers/ace/Configuration.cpp
+++ b/dep/ACE_wrappers/ace/Configuration.cpp
@@ -4,29 +4,37 @@
#include "ace/SString.h"
#include "ace/OS_NS_string.h"
#include "ace/OS_NS_strings.h"
+
// Can remove this when import_config and export_config are removed from
// ACE_Configuration. They're deprecated at ACE 5.2.
#include "ace/Configuration_Import_Export.h"
+
#if !defined (ACE_LACKS_ACCESS)
# include "ace/OS_NS_unistd.h"
#endif /* ACE_LACKS_ACCESS */
+
#if !defined (__ACE_INLINE__)
#include "ace/Configuration.inl"
#endif /* __ACE_INLINE__ */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_Section_Key_Internal::ACE_Section_Key_Internal (void)
: ref_count_ (0)
{
}
+
ACE_Section_Key_Internal::~ACE_Section_Key_Internal (void)
{
}
+
int
ACE_Section_Key_Internal::add_ref (void)
{
++ref_count_;
return 0;
}
+
int
ACE_Section_Key_Internal::dec_ref (void)
{
@@ -34,27 +42,32 @@ ACE_Section_Key_Internal::dec_ref (void)
delete this;
return 0;
}
+
ACE_Configuration_Section_Key::ACE_Configuration_Section_Key (void)
: key_ (0)
{
}
+
ACE_Configuration_Section_Key::~ACE_Configuration_Section_Key (void)
{
if (key_)
key_->dec_ref ();
}
+
ACE_Configuration_Section_Key::ACE_Configuration_Section_Key (ACE_Section_Key_Internal* key)
: key_ (key)
{
if (key_)
key_->add_ref ();
}
+
ACE_Configuration_Section_Key::ACE_Configuration_Section_Key (const ACE_Configuration_Section_Key& rhs)
: key_ (rhs.key_)
{
if (key_)
key_->add_ref ();
}
+
ACE_Configuration_Section_Key&
ACE_Configuration_Section_Key::operator= (const ACE_Configuration_Section_Key& rhs)
{
@@ -62,26 +75,34 @@ ACE_Configuration_Section_Key::operator= (const ACE_Configuration_Section_Key& r
{
if (key_)
key_->dec_ref ();
+
key_ = rhs.key_;
+
if (key_)
key_->add_ref ();
}
return *this;
}
+
//////////////////////////////////////////////////////////////////////////////
+
ACE_TCHAR ACE_Configuration::NULL_String_ = '\0';
+
ACE_Configuration::ACE_Configuration (void)
: root_ ()
{
}
+
ACE_Configuration::~ACE_Configuration (void)
{
}
+
ACE_Section_Key_Internal*
ACE_Configuration::get_internal_key (const ACE_Configuration_Section_Key& key)
{
return key.key_;
}
+
int
ACE_Configuration::expand_path (const ACE_Configuration_Section_Key& key,
const ACE_TString& path_in,
@@ -94,6 +115,7 @@ ACE_Configuration::expand_path (const ACE_Configuration_Section_Key& key,
ACE_Tokenizer parser (pData.get ());
parser.delimiter_replace ('\\', '\0');
parser.delimiter_replace ('/', '\0');
+
for (ACE_TCHAR *temp = parser.next ();
temp != 0;
temp = parser.next ())
@@ -104,10 +126,14 @@ ACE_Configuration::expand_path (const ACE_Configuration_Section_Key& key,
create,
key_out))
return -1;
+
current_section = key_out;
}
+
return 0;
+
}
+
// import_config and export_config are here for backward compatibility,
// and have been deprecated.
int
@@ -116,52 +142,63 @@ ACE_Configuration::export_config (const ACE_TCHAR* filename)
ACE_Registry_ImpExp exporter (*this);
return exporter.export_config (filename);
}
+
int
ACE_Configuration::import_config (const ACE_TCHAR* filename)
{
ACE_Registry_ImpExp importer (*this);
return importer.import_config (filename);
}
+
int
ACE_Configuration::validate_name (const ACE_TCHAR* name, int allow_path)
{
// Invalid character set
const ACE_TCHAR* reject =
allow_path ? ACE_TEXT ("][") : ACE_TEXT ("\\][");
+
// Position of the first invalid character or terminating null.
size_t const pos = ACE_OS::strcspn (name, reject);
+
// Check if it is an invalid character.
if (name[pos] != ACE_TEXT ('\0'))
{
errno = EINVAL;
return -1;
}
+
// The first character can never be a path separator.
if (name[0] == ACE_TEXT ('\\'))
{
errno = EINVAL;
return -1;
}
+
// Validate length.
if (pos == 0 || pos > 255)
{
errno = ENAMETOOLONG;
return -1;
}
+
return 0;
}
+
int
ACE_Configuration::validate_value_name (const ACE_TCHAR* name)
{
if (name == 0 || *name == this->NULL_String_)
return 0;
+
return this->validate_name (name);
}
+
const ACE_Configuration_Section_Key&
ACE_Configuration::root_section (void) const
{
return root_;
}
+
/**
* Determine if the contents of this object is the same as the
* contents of the object on the right hand side.
@@ -175,9 +212,11 @@ ACE_Configuration::operator== (const ACE_Configuration& rhs) const
ACE_TString sectionName;
ACE_Configuration *nonconst_this = const_cast<ACE_Configuration*> (this);
ACE_Configuration &nonconst_rhs = const_cast<ACE_Configuration&> (rhs);
+
const ACE_Configuration_Section_Key& rhsRoot = rhs.root_section ();
ACE_Configuration_Section_Key rhsSection;
ACE_Configuration_Section_Key thisSection;
+
// loop through each section in this object
while ((rc) && (nonconst_this->enumerate_sections (this->root_,
sectionIndex,
@@ -208,6 +247,7 @@ ACE_Configuration::operator== (const ACE_Configuration& rhs) const
ACE_TString valueName;
VALUETYPE valueType;
VALUETYPE rhsType;
+
// Enumerate each value in this section
while ((rc) && nonconst_this->enumerate_values (thisSection,
valueIndex,
@@ -296,8 +336,10 @@ ACE_Configuration::operator== (const ACE_Configuration& rhs) const
// we're not equal if we cannot get this data
rc = false;
}
+
rc = (thisLength == rhsLength);
// are the length's the same?
+
if (rc)
{
unsigned char* thisCharData =
@@ -310,6 +352,7 @@ ACE_Configuration::operator== (const ACE_Configuration& rhs) const
{
rc = (* (thisCharData + count) == * (rhsCharData + count));
}
+
delete [] thisCharData;
delete [] rhsCharData;
}// end if the length's match
@@ -318,9 +361,13 @@ ACE_Configuration::operator== (const ACE_Configuration& rhs) const
// we're not comparing them. How would we since we have
// no get operation for invalid types.
// So, if we have them, we guess they are equal.
+
}// end else if values match.
+
++valueIndex;
+
}// end value while loop
+
// look in the rhs for values not in this
valueIndex = 0;
while ((rc) && (nonconst_rhs.enumerate_values (rhsSection,
@@ -339,9 +386,13 @@ ACE_Configuration::operator== (const ACE_Configuration& rhs) const
}
++valueIndex;
}// end while for rhs values not in this.
+
}// end else if sections match.
+
++sectionIndex;
+
}// end section while loop
+
// Finally, make sure that there are no sections in rhs that do not
// exist in this
sectionIndex = 0;
@@ -372,51 +423,66 @@ ACE_Configuration::operator== (const ACE_Configuration& rhs) const
}
return rc;
}
+
bool
ACE_Configuration::operator!= (const ACE_Configuration& rhs) const
{
return !(*this == rhs);
}
+
//////////////////////////////////////////////////////////////////////////////
+
#if defined (ACE_WIN32) && !defined (ACE_LACKS_WIN32_REGISTRY)
+
static const int ACE_DEFAULT_BUFSIZE = 256;
+
static const ACE_TCHAR *temp_name (const ACE_TCHAR *name)
{
if (name && *name == ACE_Configuration::NULL_String_)
return 0;
return name;
}
+
ACE_Section_Key_Win32::ACE_Section_Key_Win32 (HKEY hKey)
: hKey_ (hKey)
{
}
+
ACE_Section_Key_Win32::~ACE_Section_Key_Win32 (void)
{
::RegCloseKey (hKey_);
}
+
//////////////////////////////////////////////////////////////////////////////
+
bool
ACE_Configuration_Win32Registry::operator== (const ACE_Configuration_Win32Registry &rhs) const
{
ACE_UNUSED_ARG (rhs);
return true;
}
+
bool
ACE_Configuration_Win32Registry::operator!= (const ACE_Configuration_Win32Registry &rhs) const
{
ACE_UNUSED_ARG (rhs);
return true;
}
+
ACE_Configuration_Win32Registry::ACE_Configuration_Win32Registry (HKEY hKey)
{
ACE_Section_Key_Win32 *temp = 0;
+
ACE_NEW (temp, ACE_Section_Key_Win32 (hKey));
+
root_ = ACE_Configuration_Section_Key (temp);
}
+
ACE_Configuration_Win32Registry::~ACE_Configuration_Win32Registry (void)
{
}
+
int
ACE_Configuration_Win32Registry::open_section (const ACE_Configuration_Section_Key& base,
const ACE_TCHAR* sub_section,
@@ -425,9 +491,11 @@ ACE_Configuration_Win32Registry::open_section (const ACE_Configuration_Section_K
{
if (validate_name (sub_section, 1))
return -1;
+
HKEY base_key;
if (load_key (base, base_key))
return -1;
+
int errnum;
HKEY result_key;
if ((errnum = ACE_TEXT_RegOpenKeyEx (base_key,
@@ -441,6 +509,7 @@ ACE_Configuration_Win32Registry::open_section (const ACE_Configuration_Section_K
errno = errnum;
return -1;
}
+
if ((errnum = ACE_TEXT_RegCreateKeyEx (base_key,
sub_section,
0,
@@ -460,11 +529,14 @@ ACE_Configuration_Win32Registry::open_section (const ACE_Configuration_Section_K
return -1;
}
}
+
ACE_Section_Key_Win32 *temp;
+
ACE_NEW_RETURN (temp, ACE_Section_Key_Win32 (result_key), -1);
result = ACE_Configuration_Section_Key (temp);
return 0;
}
+
int
ACE_Configuration_Win32Registry::remove_section (const ACE_Configuration_Section_Key& key,
const ACE_TCHAR* sub_section,
@@ -472,17 +544,21 @@ ACE_Configuration_Win32Registry::remove_section (const ACE_Configuration_Section
{
if (validate_name (sub_section))
return -1;
+
HKEY base_key;
if (load_key (key, base_key))
return -1;
+
if (recursive)
{
ACE_Configuration_Section_Key section;
if (open_section (key, sub_section, 0, section))
return -1;
+
HKEY sub_key;
if (load_key (section, sub_key))
return -1;
+
ACE_TCHAR name_buffer[ACE_DEFAULT_BUFSIZE];
DWORD buffer_size = ACE_DEFAULT_BUFSIZE;
// Note we don't increment the index because the
@@ -502,6 +578,7 @@ ACE_Configuration_Win32Registry::remove_section (const ACE_Configuration_Section
buffer_size = ACE_DEFAULT_BUFSIZE;
}
}
+
int errnum;
errnum = ACE_TEXT_RegDeleteKey (base_key, sub_section);
if (errnum != ERROR_SUCCESS)
@@ -509,8 +586,10 @@ ACE_Configuration_Win32Registry::remove_section (const ACE_Configuration_Section
errno = errnum;
return -1;
}
+
return 0;
}
+
int
ACE_Configuration_Win32Registry::enumerate_values (const ACE_Configuration_Section_Key& key,
int index,
@@ -520,9 +599,11 @@ ACE_Configuration_Win32Registry::enumerate_values (const ACE_Configuration_Secti
HKEY base_key;
if (load_key (key, base_key))
return -1;
+
ACE_TCHAR name_buffer[ACE_DEFAULT_BUFSIZE];
DWORD buffer_size = ACE_DEFAULT_BUFSIZE;
DWORD value_type;
+
int rc = ACE_TEXT_RegEnumValue (base_key,
index,
name_buffer,
@@ -538,7 +619,9 @@ ACE_Configuration_Win32Registry::enumerate_values (const ACE_Configuration_Secti
errno = rc;
return -1;
}
+
name = name_buffer;
+
switch (value_type)
{
case REG_BINARY:
@@ -553,8 +636,10 @@ ACE_Configuration_Win32Registry::enumerate_values (const ACE_Configuration_Secti
default:
type = INVALID;
}
+
return 0;
}
+
int
ACE_Configuration_Win32Registry::enumerate_sections (const ACE_Configuration_Section_Key& key,
int index,
@@ -563,6 +648,7 @@ ACE_Configuration_Win32Registry::enumerate_sections (const ACE_Configuration_Sec
HKEY base_key;
if (load_key (key, base_key))
return -1;
+
ACE_TCHAR name_buffer[ACE_DEFAULT_BUFSIZE];
DWORD buffer_size = ACE_DEFAULT_BUFSIZE;
int rc = ACE_TEXT_RegEnumKeyEx (base_key,
@@ -580,9 +666,12 @@ ACE_Configuration_Win32Registry::enumerate_sections (const ACE_Configuration_Sec
errno = rc;
return -1;
}
+
name = name_buffer;
+
return 0;
}
+
int
ACE_Configuration_Win32Registry::set_string_value (const ACE_Configuration_Section_Key& key,
const ACE_TCHAR* name,
@@ -591,9 +680,11 @@ ACE_Configuration_Win32Registry::set_string_value (const ACE_Configuration_Secti
const ACE_TCHAR *t_name = temp_name (name);
if (validate_value_name (t_name))
return -1;
+
HKEY base_key;
if (load_key (key, base_key))
return -1;
+
int errnum;
DWORD len = static_cast<DWORD> (value.length () + 1);
len *= sizeof (ACE_TCHAR);
@@ -608,8 +699,10 @@ ACE_Configuration_Win32Registry::set_string_value (const ACE_Configuration_Secti
errno = errnum;
return -1;
}
+
return 0;
}
+
int
ACE_Configuration_Win32Registry::set_integer_value (const ACE_Configuration_Section_Key& key,
const ACE_TCHAR* name,
@@ -618,9 +711,11 @@ ACE_Configuration_Win32Registry::set_integer_value (const ACE_Configuration_Sect
const ACE_TCHAR *t_name = temp_name (name);
if (validate_value_name (t_name))
return -1;
+
HKEY base_key;
if (load_key (key, base_key))
return -1;
+
int errnum;
if ((errnum = ACE_TEXT_RegSetValueEx (base_key,
t_name,
@@ -632,8 +727,10 @@ ACE_Configuration_Win32Registry::set_integer_value (const ACE_Configuration_Sect
errno = errnum;
return -1;
}
+
return 0;
}
+
int
ACE_Configuration_Win32Registry::set_binary_value (const ACE_Configuration_Section_Key& key,
const ACE_TCHAR* name,
@@ -643,9 +740,11 @@ ACE_Configuration_Win32Registry::set_binary_value (const ACE_Configuration_Secti
const ACE_TCHAR *t_name = temp_name (name);
if (validate_value_name (t_name))
return -1;
+
HKEY base_key;
if (load_key (key, base_key))
return -1;
+
int errnum;
if ((errnum = ACE_TEXT_RegSetValueEx (base_key,
t_name,
@@ -658,8 +757,10 @@ ACE_Configuration_Win32Registry::set_binary_value (const ACE_Configuration_Secti
errno = errnum;
return -1;
}
+
return 0;
}
+
int
ACE_Configuration_Win32Registry::get_string_value (const ACE_Configuration_Section_Key& key,
const ACE_TCHAR* name,
@@ -668,9 +769,11 @@ ACE_Configuration_Win32Registry::get_string_value (const ACE_Configuration_Secti
const ACE_TCHAR *t_name = temp_name (name);
if (validate_value_name (t_name))
return -1;
+
HKEY base_key;
if (load_key (key, base_key))
return -1;
+
// Get the size of the binary data from windows
int errnum;
DWORD buffer_length = 0;
@@ -685,16 +788,20 @@ ACE_Configuration_Win32Registry::get_string_value (const ACE_Configuration_Secti
errno = errnum;
return -1;
}
+
if (type != REG_SZ)
{
errno = ERROR_INVALID_DATATYPE;
return -1;
}
+
ACE_TCHAR *temp = 0;
ACE_NEW_RETURN (temp,
ACE_TCHAR[buffer_length],
-1);
+
ACE_Auto_Basic_Array_Ptr<ACE_TCHAR> buffer (temp);
+
if ((errnum = ACE_TEXT_RegQueryValueEx (base_key,
t_name,
0,
@@ -705,9 +812,11 @@ ACE_Configuration_Win32Registry::get_string_value (const ACE_Configuration_Secti
errno = errnum;
return -1;
}
+
value = buffer.get ();
return 0;
}
+
int
ACE_Configuration_Win32Registry::get_integer_value (const ACE_Configuration_Section_Key& key,
const ACE_TCHAR* name,
@@ -716,9 +825,11 @@ ACE_Configuration_Win32Registry::get_integer_value (const ACE_Configuration_Sect
const ACE_TCHAR *t_name = temp_name (name);
if (validate_value_name (t_name))
return -1;
+
HKEY base_key;
if (load_key (key, base_key))
return -1;
+
int errnum;
DWORD length = sizeof (value);
DWORD type;
@@ -732,13 +843,16 @@ ACE_Configuration_Win32Registry::get_integer_value (const ACE_Configuration_Sect
errno = errnum;
return -1;
}
+
if (type != REG_DWORD)
{
errno = ERROR_INVALID_DATATYPE;
return -1;
}
+
return 0;
}
+
int
ACE_Configuration_Win32Registry::get_binary_value (
const ACE_Configuration_Section_Key &key,
@@ -749,9 +863,11 @@ ACE_Configuration_Win32Registry::get_binary_value (
const ACE_TCHAR *t_name = temp_name (name);
if (validate_value_name (t_name))
return -1;
+
HKEY base_key;
if (load_key (key, base_key))
return -1;
+
// Get the size of the binary data from windows
int errnum;
DWORD buffer_length = 0;
@@ -766,15 +882,19 @@ ACE_Configuration_Win32Registry::get_binary_value (
errno = errnum;
return -1;
}
+
if (type != REG_BINARY)
{
errno = ERROR_INVALID_DATATYPE;
return -1;
}
+
length = buffer_length;
+
BYTE * the_data = 0;
ACE_NEW_RETURN (the_data, BYTE[length], -1);
ACE_Auto_Basic_Array_Ptr<BYTE> safe_data (the_data);
+
if ((errnum = ACE_TEXT_RegQueryValueEx (base_key,
t_name,
0,
@@ -786,9 +906,12 @@ ACE_Configuration_Win32Registry::get_binary_value (
errno = errnum;
return -1;
}
+
data = safe_data.release ();
+
return 0;
}
+
int
ACE_Configuration_Win32Registry::find_value (const ACE_Configuration_Section_Key& key,
const ACE_TCHAR* name,
@@ -797,9 +920,11 @@ ACE_Configuration_Win32Registry::find_value (const ACE_Configuration_Section_Key
const ACE_TCHAR *t_name = temp_name (name);
if (validate_value_name (t_name))
return -1;
+
HKEY base_key;
if (load_key (key, base_key))
return -1;
+
DWORD buffer_length=0;
DWORD type;
int result=ACE_TEXT_RegQueryValueEx (base_key,
@@ -813,6 +938,7 @@ ACE_Configuration_Win32Registry::find_value (const ACE_Configuration_Section_Key
errno = result;
return -1;
}
+
switch (type)
{
case REG_SZ:
@@ -827,8 +953,10 @@ ACE_Configuration_Win32Registry::find_value (const ACE_Configuration_Section_Key
default:
return -1; // unknown type
}
+
return 0;
}
+
int
ACE_Configuration_Win32Registry::remove_value (const ACE_Configuration_Section_Key& key,
const ACE_TCHAR* name)
@@ -836,18 +964,22 @@ ACE_Configuration_Win32Registry::remove_value (const ACE_Configuration_Section_K
const ACE_TCHAR *t_name = temp_name (name);
if (validate_value_name (t_name))
return -1;
+
HKEY base_key;
if (load_key (key, base_key))
return -1;
+
int errnum;
if ((errnum = ACE_TEXT_RegDeleteValue (base_key, t_name)) != ERROR_SUCCESS)
{
errno = errnum;
return -1;
}
+
return 0;
}
+
int
ACE_Configuration_Win32Registry::load_key (const ACE_Configuration_Section_Key& key,
HKEY& hKey)
@@ -855,9 +987,11 @@ ACE_Configuration_Win32Registry::load_key (const ACE_Configuration_Section_Key&
ACE_Section_Key_Win32* pKey = dynamic_cast<ACE_Section_Key_Win32*> (get_internal_key (key));
if (!pKey)
return -1;
+
hKey = pKey->hKey_;
return 0;
}
+
HKEY
ACE_Configuration_Win32Registry::resolve_key (HKEY hKey,
const ACE_TCHAR* path,
@@ -875,6 +1009,7 @@ ACE_Configuration_Win32Registry::resolve_key (HKEY hKey,
errno = errnum;
return 0;
}
+
// recurse through the path
ACE_TCHAR *temp_path = 0;
ACE_NEW_RETURN (temp_path,
@@ -885,12 +1020,14 @@ ACE_Configuration_Win32Registry::resolve_key (HKEY hKey,
ACE_Tokenizer parser (pData.get ());
parser.delimiter_replace ('\\', '\0');
parser.delimiter_replace ('/', '\0');
+
for (ACE_TCHAR *temp = parser.next ();
temp != 0;
temp = parser.next ())
{
// Open the key
HKEY subkey;
+
#if defined (ACE_HAS_WINCE)
if ((errnum = ACE_TEXT_RegOpenKeyEx (result,
temp,
@@ -929,43 +1066,53 @@ ACE_Configuration_Win32Registry::resolve_key (HKEY hKey,
::RegCloseKey (result);
result = subkey;
}
+
return result;
}
+
#endif /* ACE_WIN32 && !ACE_LACKS_WIN32_REGISTRY */
+
///////////////////////////////////////////////////////////////
+
ACE_Configuration_Value_IntId::ACE_Configuration_Value_IntId (void)
: type_ (ACE_Configuration::INVALID),
length_ (0)
{
this->data_.ptr_ = 0;
}
+
ACE_Configuration_Value_IntId::ACE_Configuration_Value_IntId (ACE_TCHAR* string)
: type_ (ACE_Configuration::STRING),
length_ (0)
{
this->data_.ptr_ = string;
}
+
ACE_Configuration_Value_IntId::ACE_Configuration_Value_IntId (u_int integer)
: type_ (ACE_Configuration::INTEGER),
length_ (0)
{
this->data_.int_ = integer;
}
+
ACE_Configuration_Value_IntId::ACE_Configuration_Value_IntId (void* data, size_t length)
: type_ (ACE_Configuration::BINARY),
length_ (length)
{
this->data_.ptr_ = data;
}
+
ACE_Configuration_Value_IntId::ACE_Configuration_Value_IntId (const ACE_Configuration_Value_IntId& rhs)
: type_ (rhs.type_),
data_ (rhs.data_),
length_ (rhs.length_)
{
}
+
ACE_Configuration_Value_IntId::~ACE_Configuration_Value_IntId (void)
{
}
+
ACE_Configuration_Value_IntId& ACE_Configuration_Value_IntId::operator= (const ACE_Configuration_Value_IntId& rhs)
{
if (this != &rhs)
@@ -976,6 +1123,7 @@ ACE_Configuration_Value_IntId& ACE_Configuration_Value_IntId::operator= (const A
}
return *this;
}
+
void
ACE_Configuration_Value_IntId::free (ACE_Allocator *alloc)
{
@@ -984,67 +1132,84 @@ ACE_Configuration_Value_IntId::free (ACE_Allocator *alloc)
alloc->free (data_.ptr_);
// Do nothing in other cases...
}
+
ACE_Configuration_ExtId::ACE_Configuration_ExtId (void)
: name_ (0)
{
}
+
ACE_Configuration_ExtId::ACE_Configuration_ExtId (const ACE_TCHAR* name)
: name_ (name)
{
}
+
ACE_Configuration_ExtId::ACE_Configuration_ExtId (const ACE_Configuration_ExtId& rhs)
: name_ (rhs.name_)
{
}
+
ACE_Configuration_ExtId::~ACE_Configuration_ExtId (void)
{
}
+
ACE_Configuration_ExtId& ACE_Configuration_ExtId::operator= (const ACE_Configuration_ExtId& rhs)
{
if (this != &rhs)
name_ = rhs.name_;
+
return *this;
}
+
bool
ACE_Configuration_ExtId::operator== (const ACE_Configuration_ExtId& rhs) const
{
return (ACE_OS::strcasecmp (name_, rhs.name_) == 0);
}
+
bool
ACE_Configuration_ExtId::operator!= (const ACE_Configuration_ExtId& rhs) const
{
return !this->operator== (rhs);
}
+
u_long
ACE_Configuration_ExtId::hash (void) const
{
ACE_TString temp (name_, 0, false);
return temp.hash ();
}
+
void
ACE_Configuration_ExtId::free (ACE_Allocator *alloc)
{
alloc->free ((void *) (name_));
}
+
///////////////////////////////////////////////////////////////////////
+
ACE_Configuration_Section_IntId::ACE_Configuration_Section_IntId (void)
: value_hash_map_ (0),
section_hash_map_ (0)
{
}
+
ACE_Configuration_Section_IntId::ACE_Configuration_Section_IntId (VALUE_MAP* value_hash_map, SUBSECTION_MAP* section_hash_map)
: value_hash_map_ (value_hash_map),
section_hash_map_ (section_hash_map)
{
}
+
ACE_Configuration_Section_IntId::ACE_Configuration_Section_IntId (const ACE_Configuration_Section_IntId& rhs)
: value_hash_map_ (rhs.value_hash_map_),
section_hash_map_ (rhs.section_hash_map_)
{
+
}
+
ACE_Configuration_Section_IntId::~ACE_Configuration_Section_IntId ()
{
}
+
ACE_Configuration_Section_IntId&
ACE_Configuration_Section_IntId::operator= (const ACE_Configuration_Section_IntId& rhs)
{
@@ -1055,12 +1220,14 @@ ACE_Configuration_Section_IntId::operator= (const ACE_Configuration_Section_IntI
}
return *this;
}
+
void
ACE_Configuration_Section_IntId::free (ACE_Allocator *alloc)
{
alloc->free ((void *) (value_hash_map_));
alloc->free ((void *) (section_hash_map_));
}
+
ACE_Configuration_Section_Key_Heap::ACE_Configuration_Section_Key_Heap (const ACE_TCHAR* path)
: path_ (0),
value_iter_ (0),
@@ -1068,28 +1235,35 @@ ACE_Configuration_Section_Key_Heap::ACE_Configuration_Section_Key_Heap (const AC
{
path_ = ACE_OS::strdup (path);
}
+
ACE_Configuration_Section_Key_Heap::~ACE_Configuration_Section_Key_Heap ()
{
delete value_iter_;
delete section_iter_;
ACE_OS::free (path_);
}
+
//////////////////////////////////////////////////////////////////////////////
+
ACE_Configuration_Heap::ACE_Configuration_Heap (void)
: allocator_ (0),
index_ (0),
default_map_size_ (0)
{
ACE_Configuration_Section_Key_Heap *temp = 0;
+
ACE_NEW (temp, ACE_Configuration_Section_Key_Heap (ACE_TEXT ("")));
root_ = ACE_Configuration_Section_Key (temp);
}
+
ACE_Configuration_Heap::~ACE_Configuration_Heap (void)
{
if (allocator_)
allocator_->sync ();
+
delete allocator_;
}
+
int
ACE_Configuration_Heap::open (size_t default_map_size)
{
@@ -1103,19 +1277,23 @@ ACE_Configuration_Heap::open (size_t default_map_size)
return create_index ();
}
+
int
ACE_Configuration_Heap::open (const ACE_TCHAR* file_name,
void* base_address,
size_t default_map_size)
{
default_map_size_ = default_map_size;
+
// Make sure that the file name is of the legal length.
if (ACE_OS::strlen (file_name) >= MAXNAMELEN + MAXPATHLEN)
{
errno = ENAMETOOLONG;
return -1;
}
+
ACE_MMAP_Memory_Pool::OPTIONS options (base_address);
+
// Create the allocator with the appropriate options. The name used
// for the lock is the same as one used for the file.
ACE_NEW_RETURN (this->allocator_,
@@ -1123,6 +1301,7 @@ ACE_Configuration_Heap::open (const ACE_TCHAR* file_name,
file_name,
&options),
-1);
+
#if !defined (ACE_LACKS_ACCESS)
// Now check if the backing store has been created successfully.
if (ACE_OS::access (file_name, F_OK) != 0)
@@ -1130,22 +1309,27 @@ ACE_Configuration_Heap::open (const ACE_TCHAR* file_name,
ACE_TEXT ("create_index\n")),
-1);
#endif /* ACE_LACKS_ACCESS */
+
return create_index ();
}
+
int
ACE_Configuration_Heap::create_index (void)
{
void *section_index = 0;
+
// This is the easy case since if we find hash table in the
// memory-mapped file we know it's already initialized.
if (this->allocator_->find (ACE_CONFIG_SECTION_INDEX, section_index) == 0)
this->index_ = (SECTION_MAP *) section_index;
+
// Create a new <index_> (because we've just created a new
// memory-mapped file).
else
{
size_t index_size = sizeof (SECTION_MAP);
section_index = this->allocator_->malloc (index_size);
+
if (section_index == 0
|| create_index_helper (section_index) == -1
|| this->allocator_->bind (ACE_CONFIG_SECTION_INDEX,
@@ -1162,6 +1346,7 @@ ACE_Configuration_Heap::create_index (void)
}
return 0;
}
+
int
ACE_Configuration_Heap::create_index_helper (void *buffer)
{
@@ -1169,6 +1354,7 @@ ACE_Configuration_Heap::create_index_helper (void *buffer)
this->index_ = new (buffer) SECTION_MAP (this->allocator_);
return 0;
}
+
int
ACE_Configuration_Heap::load_key (const ACE_Configuration_Section_Key& key,
ACE_TString& name)
@@ -1176,15 +1362,18 @@ ACE_Configuration_Heap::load_key (const ACE_Configuration_Section_Key& key,
ACE_ASSERT (this->allocator_);
ACE_Configuration_Section_Key_Heap* pKey =
dynamic_cast<ACE_Configuration_Section_Key_Heap*> (get_internal_key (key));
+
if (!pKey)
{
return -1;
}
+
ACE_TString temp (pKey->path_, 0, false);
name.assign_nocopy (temp);
return 0;
}
+
int
ACE_Configuration_Heap::add_section (const ACE_Configuration_Section_Key& base,
const ACE_TCHAR* sub_section,
@@ -1194,25 +1383,31 @@ ACE_Configuration_Heap::add_section (const ACE_Configuration_Section_Key& base,
ACE_TString section;
if (load_key (base, section))
return -1;
+
// Find the base section
ACE_Configuration_ExtId ExtId (section.fast_rep ());
ACE_Configuration_Section_IntId IntId;
if (index_->find (ExtId, IntId, allocator_))
return -1;
+
// See if this section already exists
ACE_Configuration_ExtId SubSectionExtId (sub_section);
int ignored = 0;
+
if (!IntId.section_hash_map_->find (SubSectionExtId, ignored, allocator_))
{
// already exists!
errno = EEXIST;
return -1;
}
+
// Create the new section name
// only prepend a separater if were not at the root
if (section.length ())
section += ACE_TEXT ("\\");
+
section += sub_section;
+
// Add it to the base section
ACE_TCHAR* pers_name = (ACE_TCHAR *) allocator_->malloc ((ACE_OS::strlen (sub_section) + 1) * sizeof (ACE_TCHAR));
ACE_OS::strcpy (pers_name, sub_section);
@@ -1224,41 +1419,51 @@ ACE_Configuration_Heap::add_section (const ACE_Configuration_Section_Key& base,
}
return (new_section (section, result));
}
+
int
ACE_Configuration_Heap::new_section (const ACE_TString& section,
ACE_Configuration_Section_Key& result)
{
ACE_ASSERT (this->allocator_);
// Create a new section and add it to the global list
+
// Allocate memory for items to be stored in the table.
size_t section_len = section.length () + 1;
ACE_TCHAR *ptr = (ACE_TCHAR*) this->allocator_->malloc (section_len * sizeof (ACE_TCHAR));
+
int return_value = -1;
+
if (ptr == 0)
return -1;
else
{
// Populate memory with data.
ACE_OS::strcpy (ptr, section.fast_rep ());
+
void *value_hash_map = 0;
size_t map_size = sizeof (VALUE_MAP);
value_hash_map = this->allocator_->malloc (map_size);
+
// If allocation failed ...
if (value_hash_map == 0)
return -1;
+
// Initialize allocated hash map through placement new.
if (value_open_helper (default_map_size_, value_hash_map ) == -1)
{
this->allocator_->free (value_hash_map );
return -1;
}
+
// create the section map
void* section_hash_map = 0;
map_size = sizeof (SUBSECTION_MAP);
section_hash_map = this->allocator_->malloc (map_size);
+
// If allocation failed
if (section_hash_map == 0)
return -1;
+
// initialize allocated hash map through placement new
if (section_open_helper (default_map_size_, section_hash_map) == -1)
{
@@ -1266,12 +1471,15 @@ ACE_Configuration_Heap::new_section (const ACE_TString& section,
this->allocator_->free (section_hash_map);
return -1;
}
+
ACE_Configuration_ExtId name (ptr);
ACE_Configuration_Section_IntId entry ((VALUE_MAP*) value_hash_map,
(SUBSECTION_MAP*) section_hash_map);
+
// Do a normal bind. This will fail if there's already an
// entry with the same name.
return_value = this->index_->bind (name, entry, this->allocator_);
+
if (return_value == 1 /* Entry already existed so bind failed. */
|| return_value == -1 /* Unable to bind for other reasons. */)
{
@@ -1279,11 +1487,13 @@ ACE_Configuration_Heap::new_section (const ACE_TString& section,
this->allocator_->free (static_cast<void *> (ptr));
return return_value;
}
+
// If bind () succeed, it will automatically sync
// up the map manager entry. However, we must sync up our
// name/value memory.
this->allocator_->sync (ptr, section_len);
}
+
// set the result
ACE_Configuration_Section_Key_Heap *temp;
ACE_NEW_RETURN (temp,
@@ -1292,6 +1502,7 @@ ACE_Configuration_Heap::new_section (const ACE_TString& section,
result = ACE_Configuration_Section_Key (temp);
return return_value;
}
+
int
ACE_Configuration_Heap::value_open_helper (size_t hash_table_size,
void *buffer)
@@ -1300,6 +1511,7 @@ ACE_Configuration_Heap::value_open_helper (size_t hash_table_size,
new (buffer) VALUE_MAP (hash_table_size, this->allocator_);
return 0;
}
+
int
ACE_Configuration_Heap::section_open_helper (size_t hash_table_size,
void *buffer)
@@ -1308,6 +1520,7 @@ ACE_Configuration_Heap::section_open_helper (size_t hash_table_size,
new (buffer) SUBSECTION_MAP (hash_table_size, this->allocator_);
return 0;
}
+
int
ACE_Configuration_Heap::open_section (const ACE_Configuration_Section_Key& base,
const ACE_TCHAR* sub_section,
@@ -1317,7 +1530,9 @@ ACE_Configuration_Heap::open_section (const ACE_Configuration_Section_Key& base,
ACE_ASSERT (this->allocator_);
if (validate_name (sub_section, 1)) // 1 == allow_path
return -1;
+
result = base;
+
for (const ACE_TCHAR* separator;
(separator = ACE_OS::strchr (sub_section, ACE_TEXT ('\\'))) != 0;
)
@@ -1329,8 +1544,10 @@ ACE_Configuration_Heap::open_section (const ACE_Configuration_Section_Key& base,
return ret_val;
sub_section = separator + 1;
}
+
return open_simple_section (result, sub_section, create, result);
}
+
int
ACE_Configuration_Heap::open_simple_section (const ACE_Configuration_Section_Key& base,
const ACE_TCHAR* sub_section,
@@ -1338,19 +1555,24 @@ ACE_Configuration_Heap::open_simple_section (const ACE_Configuration_Section_Key
ACE_Configuration_Section_Key& result)
{
ACE_TString section (0, 0, false);
+
if (load_key (base, section))
{
return -1;
}
+
// Only add the \\ if were not at the root
if (section.length ())
{
section += ACE_TEXT ("\\");
}
+
section += sub_section;
+
// resolve the section
ACE_Configuration_ExtId ExtId (section.fast_rep ());
ACE_Configuration_Section_IntId IntId;
+
if (index_->find (ExtId, IntId, allocator_))
{
if (!create)
@@ -1358,8 +1580,10 @@ ACE_Configuration_Heap::open_simple_section (const ACE_Configuration_Section_Key
errno = ENOENT;
return -1;
}
+
return add_section (base, sub_section, result);
}
+
ACE_Configuration_Section_Key_Heap *temp;
ACE_NEW_RETURN (temp,
ACE_Configuration_Section_Key_Heap (section.fast_rep ()),
@@ -1367,6 +1591,7 @@ ACE_Configuration_Heap::open_simple_section (const ACE_Configuration_Section_Key
result = ACE_Configuration_Section_Key (temp);
return 0;
}
+
int
ACE_Configuration_Heap::remove_section (const ACE_Configuration_Section_Key& key,
const ACE_TCHAR* sub_section,
@@ -1375,55 +1600,68 @@ ACE_Configuration_Heap::remove_section (const ACE_Configuration_Section_Key& key
ACE_ASSERT (this->allocator_);
if (validate_name (sub_section))
return -1;
+
ACE_TString section;
if (load_key (key, section))
return -1;
+
// Find this key
ACE_Configuration_ExtId ParentExtId (section.fast_rep ());
ACE_Configuration_Section_IntId ParentIntId;
if (index_->find (ParentExtId, ParentIntId, allocator_))
return -1;// no parent key
+
// Find this subkey
if (section.length ())
section += ACE_TEXT ("\\");
+
section += sub_section;
ACE_Configuration_ExtId SectionExtId (section.fast_rep ());
SECTION_HASH::ENTRY* section_entry;
SECTION_HASH* hashmap = index_;
if (hashmap->find (SectionExtId, section_entry))
return -1;
+
if (recursive)
{
ACE_Configuration_Section_Key section;
if (open_section (key, sub_section, 0, section))
return -1;
+
int index = 0;
ACE_TString name;
while (!enumerate_sections (section, index, name))
{
if (remove_section (section, name.fast_rep (), 1))
return -1;
+
++index;
}
}
+
// Now make sure we dont have any subkeys
if (section_entry->int_id_.section_hash_map_->current_size ())
{
errno = ENOTEMPTY;
return -1;
}
+
// Now remove subkey from parent key
ACE_Configuration_ExtId SubSExtId (sub_section);
SUBSECTION_HASH::ENTRY* subsection_entry;
if (((SUBSECTION_HASH*)ParentIntId.section_hash_map_)->
find (SubSExtId, subsection_entry))
return -1;
+
if (ParentIntId.section_hash_map_->unbind (SubSExtId, allocator_))
return -1;
+
subsection_entry->ext_id_.free (allocator_);
+
// Remember the pointers so we can free them after we unbind
ACE_Configuration_ExtId ExtIdToFree (section_entry->ext_id_);
ACE_Configuration_Section_IntId IntIdToFree (section_entry->int_id_);
+
// iterate over all values and free memory
VALUE_HASH* value_hash_map = section_entry->int_id_.value_hash_map_;
VALUE_HASH::ITERATOR value_iter = value_hash_map->begin ();
@@ -1432,20 +1670,27 @@ ACE_Configuration_Heap::remove_section (const ACE_Configuration_Section_Key& key
VALUE_HASH::ENTRY* value_entry = 0;
if (!value_iter.next (value_entry))
return 1;
+
value_entry->ext_id_.free (allocator_);
value_entry->int_id_.free (allocator_);
+
value_iter.advance ();
}
+
// remove it
if (index_->unbind (SectionExtId, allocator_))
return -1;
+
value_hash_map->close ();
section_entry->int_id_.section_hash_map_->close (allocator_);
+
// Free the memory
ExtIdToFree.free (allocator_);
IntIdToFree.free (allocator_);
+
return 0;
}
+
int
ACE_Configuration_Heap::enumerate_values (const ACE_Configuration_Section_Key& key,
int index,
@@ -1457,12 +1702,15 @@ ACE_Configuration_Heap::enumerate_values (const ACE_Configuration_Section_Key& k
dynamic_cast<ACE_Configuration_Section_Key_Heap*> (get_internal_key (key));
if (!pKey)
return -1;
+
name = pKey->path_;
+
// resolve the section
ACE_Configuration_ExtId ExtId (pKey->path_);
ACE_Configuration_Section_IntId IntId;
if (index_->find (ExtId, IntId, allocator_))
return -1;
+
// Handle iterator resets
if (index == 0)
{
@@ -1472,20 +1720,26 @@ ACE_Configuration_Heap::enumerate_values (const ACE_Configuration_Section_Key& k
ACE_Equal_To<ACE_Configuration_ExtId>,
ACE_Null_Mutex>* hash_map = IntId.value_hash_map_;
delete pKey->value_iter_;
+
ACE_NEW_RETURN (pKey->value_iter_,
VALUE_HASH::ITERATOR (hash_map->begin ()),
-1);
}
+
// Get the next entry
ACE_Hash_Map_Entry<ACE_Configuration_ExtId, ACE_Configuration_Value_IntId>* entry = 0;
+
if (!pKey->value_iter_->next (entry))
return 1;
+
// Return the value of the iterator and advance it
name = entry->ext_id_.name_;
type = entry->int_id_.type_;
pKey->value_iter_->advance ();
+
return 0;
}
+
int
ACE_Configuration_Heap::enumerate_sections (const ACE_Configuration_Section_Key& key,
int index,
@@ -1497,29 +1751,36 @@ ACE_Configuration_Heap::enumerate_sections (const ACE_Configuration_Section_Key&
dynamic_cast<ACE_Configuration_Section_Key_Heap*> (get_internal_key (key));
if (!pKey)
return -1; // not a heap key!
+
// resolve the section
ACE_Configuration_ExtId ExtId (pKey->path_);
ACE_Configuration_Section_IntId IntId;
if (index_->find (ExtId, IntId, allocator_))
return -1; // unknown section
+
// Handle iterator resets
if (index == 0)
{
if (pKey->section_iter_)
delete pKey->section_iter_;
+
ACE_NEW_RETURN (pKey->section_iter_,
SUBSECTION_HASH::ITERATOR (IntId.section_hash_map_->begin ()),
-1);
}
+
// Get the next entry
ACE_Hash_Map_Entry<ACE_Configuration_ExtId, int>* entry = 0;
if (!pKey->section_iter_->next (entry))
return 1;
+
// Return the value of the iterator and advance it
pKey->section_iter_->advance ();
name = entry->ext_id_.name_;
+
return 0;
}
+
int
ACE_Configuration_Heap::set_string_value (const ACE_Configuration_Section_Key& key,
const ACE_TCHAR* name,
@@ -1529,13 +1790,16 @@ ACE_Configuration_Heap::set_string_value (const ACE_Configuration_Section_Key& k
const ACE_TCHAR *t_name = name ? name : &this->NULL_String_;
if (validate_value_name (t_name))
return -1;
+
ACE_TString section;
if (load_key (key, section))
return -1;
+
ACE_Configuration_ExtId section_ext (section.fast_rep ());
ACE_Configuration_Section_IntId section_int;
if (index_->find (section_ext, section_int, allocator_))
return -1;
+
// Get the entry for this item (if it exists)
VALUE_HASH::ENTRY* entry;
ACE_Configuration_ExtId item_name (t_name);
@@ -1570,8 +1834,10 @@ ACE_Configuration_Heap::set_string_value (const ACE_Configuration_Section_Key& k
}
return 0;
}
+
return 0;
}
+
int
ACE_Configuration_Heap::set_integer_value (const ACE_Configuration_Section_Key& key,
const ACE_TCHAR* name,
@@ -1581,15 +1847,18 @@ ACE_Configuration_Heap::set_integer_value (const ACE_Configuration_Section_Key&
const ACE_TCHAR *t_name = name ? name : &this->NULL_String_;
if (validate_value_name (t_name))
return -1;
+
// Get the section name from the key
ACE_TString section;
if (load_key (key, section))
return -1;
+
// Find this section
ACE_Configuration_ExtId section_ext (section.fast_rep ());
ACE_Configuration_Section_IntId section_int;
if (index_->find (section_ext, section_int, allocator_))
return -1; // section does not exist
+
// Get the entry for this item (if it exists)
VALUE_HASH::ENTRY* entry;
ACE_Configuration_ExtId item_name (t_name);
@@ -1614,8 +1883,10 @@ ACE_Configuration_Heap::set_integer_value (const ACE_Configuration_Section_Key&
}
return 0;
}
+
return 0;
}
+
int
ACE_Configuration_Heap::set_binary_value (const ACE_Configuration_Section_Key& key,
const ACE_TCHAR* name,
@@ -1626,15 +1897,18 @@ ACE_Configuration_Heap::set_binary_value (const ACE_Configuration_Section_Key& k
const ACE_TCHAR *t_name = name ? name : &this->NULL_String_;
if (validate_value_name (t_name))
return -1;
+
// Get the section name from the key
ACE_TString section;
if (load_key (key, section))
return -1;
+
// Find this section
ACE_Configuration_ExtId section_ext (section.fast_rep ());
ACE_Configuration_Section_IntId section_int;
if (index_->find (section_ext, section_int, allocator_))
return -1; // section does not exist
+
// Get the entry for this item (if it exists)
VALUE_HASH::ENTRY* entry;
ACE_Configuration_ExtId item_name (t_name);
@@ -1667,8 +1941,10 @@ ACE_Configuration_Heap::set_binary_value (const ACE_Configuration_Section_Key& k
}
return 0;
}
+
return 0;
}
+
int
ACE_Configuration_Heap::get_string_value (const ACE_Configuration_Section_Key& key,
const ACE_TCHAR* name,
@@ -1678,70 +1954,86 @@ ACE_Configuration_Heap::get_string_value (const ACE_Configuration_Section_Key& k
const ACE_TCHAR *t_name = name ? name : &this->NULL_String_;
if (validate_value_name (t_name))
return -1;
+
// Get the section name from the key
ACE_TString section;
if (load_key (key, section))
return -1;
+
// Find this section
ACE_Configuration_ExtId ExtId (section.fast_rep ());
ACE_Configuration_Section_IntId IntId;
if (index_->find (ExtId, IntId, allocator_))
return -1; // section does not exist
+
// See if it exists first
ACE_Configuration_ExtId VExtId (t_name);
ACE_Configuration_Value_IntId VIntId;
if (IntId.value_hash_map_->find (VExtId, VIntId, allocator_))
return -1; // unknown value
+
// Check type
if (VIntId.type_ != ACE_Configuration::STRING)
{
errno = ENOENT;
return -1;
}
+
// everythings ok, return the data
value = static_cast<ACE_TCHAR*> (VIntId.data_.ptr_);
return 0;
}
+
int
ACE_Configuration_Heap::get_integer_value (const ACE_Configuration_Section_Key& key,
const ACE_TCHAR* name,
u_int& value)
{
ACE_ASSERT (this->allocator_);
+
const ACE_TCHAR *t_name = name ? name : &this->NULL_String_;
if (validate_value_name (t_name))
return -1;
+
// Get the section name from the key
ACE_TString section (0, 0, false);
+
if (this->load_key (key, section) != 0)
{
return -1;
}
+
// Find this section
ACE_Configuration_ExtId ExtId (section.fast_rep ());
ACE_Configuration_Section_IntId IntId;
+
if (index_->find (ExtId, IntId, allocator_) != 0)
{
return -1; // section does not exist
}
+
// See if it exists first
ACE_Configuration_ExtId VExtId (t_name);
ACE_Configuration_Value_IntId VIntId;
+
if (IntId.value_hash_map_->find (VExtId, VIntId, allocator_) != 0)
{
return -1; // unknown value
}
+
// Check type
if (VIntId.type_ != ACE_Configuration::INTEGER)
{
errno = ENOENT;
return -1;
}
+
// Everythings ok, return the data
value = VIntId.data_.int_;
return 0;
}
+
int
ACE_Configuration_Heap::get_binary_value (
const ACE_Configuration_Section_Key& key,
@@ -1753,32 +2045,38 @@ ACE_Configuration_Heap::get_binary_value (
const ACE_TCHAR *t_name = name ? name : &this->NULL_String_;
if (validate_value_name (t_name))
return -1;
+
// Get the section name from the key
ACE_TString section;
if (load_key (key, section))
return -1;
+
// Find this section
ACE_Configuration_ExtId ExtId (section.fast_rep ());
ACE_Configuration_Section_IntId IntId;
if (index_->find (ExtId, IntId, allocator_))
return -1; // section does not exist
+
ACE_Configuration_ExtId VExtId (t_name);
ACE_Configuration_Value_IntId VIntId;
// See if it exists first
if (IntId.value_hash_map_->find (VExtId, VIntId, allocator_))
return -1; // unknown value
+
// Check type
if (VIntId.type_ != ACE_Configuration::BINARY)
{
errno = ENOENT;
return -1;
}
+
// Make a copy
ACE_NEW_RETURN (data, char[VIntId.length_], -1);
ACE_OS::memcpy (data, VIntId.data_.ptr_, VIntId.length_);
length = VIntId.length_;
return 0;
}
+
int
ACE_Configuration_Heap::find_value (const ACE_Configuration_Section_Key& key,
const ACE_TCHAR* name,
@@ -1788,23 +2086,28 @@ ACE_Configuration_Heap::find_value (const ACE_Configuration_Section_Key& key,
const ACE_TCHAR *t_name = name ? name : &this->NULL_String_;
if (validate_value_name (t_name))
return -1;
+
// Get the section name from the key
ACE_TString section;
if (load_key (key, section))
return -1;
+
// Find this section
ACE_Configuration_ExtId ExtId (section.fast_rep ());
ACE_Configuration_Section_IntId IntId;
if (index_->find (ExtId, IntId, allocator_))
return -1; // section does not exist
+
// Find it
ACE_Configuration_ExtId ValueExtId (t_name);
VALUE_HASH::ENTRY* value_entry;
if (((VALUE_HASH *) IntId.value_hash_map_)->find (ValueExtId, value_entry))
return -1; // value does not exist
+
type_out = value_entry->int_id_.type_;
return 0;
}
+
int
ACE_Configuration_Heap::remove_value (const ACE_Configuration_Section_Key& key,
const ACE_TCHAR* name)
@@ -1813,27 +2116,34 @@ ACE_Configuration_Heap::remove_value (const ACE_Configuration_Section_Key& key,
const ACE_TCHAR *t_name = name ? name : &this->NULL_String_;
if (validate_value_name (t_name))
return -1;
+
// Get the section name from the key
ACE_TString section;
if (load_key (key, section))
return -1;
+
// Find this section
ACE_Configuration_ExtId ExtId (section.fast_rep ());
ACE_Configuration_Section_IntId IntId;
if (index_->find (ExtId, IntId, allocator_))
return -1; // section does not exist
+
// Find it
ACE_Configuration_ExtId ValueExtId (t_name);
VALUE_HASH::ENTRY* value_entry;
if (((VALUE_HASH *) IntId.value_hash_map_)->find (ValueExtId, value_entry))
return -1;
+
// free it
value_entry->ext_id_.free (allocator_);
value_entry->int_id_.free (allocator_);
+
// Unbind it
if (IntId.value_hash_map_->unbind (ValueExtId, allocator_))
return -1;
+
return 0;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Configuration.h b/dep/ACE_wrappers/ace/Configuration.h
index 1fd5bb2fed8..55bd705bf64 100644
--- a/dep/ACE_wrappers/ace/Configuration.h
+++ b/dep/ACE_wrappers/ace/Configuration.h
@@ -1,4 +1,5 @@
/* -*- C++ -*- */
+
//=============================================================================
/**
* @file Configuration.h
@@ -24,9 +25,11 @@
* @todo Templatize this class with an ACE_LOCK to provide thread safety
*/
//=============================================================================
+
#ifndef ACE_CONFIGURATION_H
#define ACE_CONFIGURATION_H
#include /**/ "ace/pre.h"
+
#include "ace/SStringfwd.h"
#include "ace/Hash_Map_With_Allocator_T.h"
#include "ace/Malloc_T.h"
@@ -34,17 +37,23 @@
#include "ace/Local_Memory_Pool.h"
#include "ace/Synch_Traits.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
// configurable parameters
+
#if !defined (ACE_CONFIG_SECTION_INDEX)
# define ACE_CONFIG_SECTION_INDEX "Config_Section_Index"
#endif /* ! ACE_CONFIG_SECTION_INDEX */
+
#if !defined (ACE_DEFAULT_CONFIG_SECTION_SIZE)
#define ACE_DEFAULT_CONFIG_SECTION_SIZE 16
#endif /* ACE_DEFAULT_CONFIG_SECTION_SIZE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Section_Key_Internal
*
@@ -61,16 +70,20 @@ class ACE_Export ACE_Section_Key_Internal
public:
/// Virtual destructor, make sure descendants are virtual!
virtual ~ACE_Section_Key_Internal (void);
+
/// Increment reference count
virtual int add_ref (void);
+
/// Decrement reference count. Will delete this if count gets to 0
virtual int dec_ref (void);
protected:
ACE_Section_Key_Internal (void);
ACE_Section_Key_Internal (const ACE_Section_Key_Internal& rhs);
ACE_Section_Key_Internal& operator= (ACE_Section_Key_Internal& rhs);
+
u_int ref_count_;
};
+
/**
* @class ACE_Configuration_Section_Key
*
@@ -86,15 +99,19 @@ class ACE_Export ACE_Configuration_Section_Key
public:
/// Default constructor.
ACE_Configuration_Section_Key (void);
+
/// Constructor that initializes to a pointer to a concrete internal key.
/**
* @param key The section key to reference. Calls add_ref() with @a key.
*/
explicit ACE_Configuration_Section_Key (ACE_Section_Key_Internal *key);
+
/// Copy constructor, increments the reference count on the key.
ACE_Configuration_Section_Key (const ACE_Configuration_Section_Key &rhs);
+
/// Destructor, decrements reference count on the referenced key.
~ACE_Configuration_Section_Key (void);
+
/// Assignment operator, increments reference count for this object
/// and decrements it on @a rhs.
ACE_Configuration_Section_Key &
@@ -102,6 +119,7 @@ public:
private:
ACE_Section_Key_Internal *key_;
};
+
/**
* @class ACE_Configuration
*
@@ -126,14 +144,17 @@ public:
BINARY,
INVALID
};
+
/// Destructor
virtual ~ACE_Configuration (void);
+
/// Obtain a reference to the root section of this configuration.
/*
* @return Reference to the configuration's root section. Note that
* it is a const reference.
*/
virtual const ACE_Configuration_Section_Key& root_section (void) const;
+
/**
* Opens a named section in an existing section.
*
@@ -151,6 +172,7 @@ public:
const ACE_TCHAR *sub_section,
int create,
ACE_Configuration_Section_Key& result) = 0;
+
/// Removes a named section.
/**
* @param key Section key to remove the named section from.
@@ -164,6 +186,7 @@ public:
virtual int remove_section (const ACE_Configuration_Section_Key &key,
const ACE_TCHAR *sub_section,
int recursive) = 0;
+
/**
* Enumerates through the values in a section.
*
@@ -186,6 +209,7 @@ public:
int index,
ACE_TString& name,
VALUETYPE& type) = 0;
+
/**
* Enumerates through the subsections in a section.
*
@@ -205,6 +229,7 @@ public:
*/
virtual int enumerate_sections (const ACE_Configuration_Section_Key& key,
int index, ACE_TString& name) = 0;
+
/// Sets a string-typed value.
/**
* @param key Configuration section to set the value in.
@@ -218,6 +243,7 @@ public:
virtual int set_string_value (const ACE_Configuration_Section_Key& key,
const ACE_TCHAR* name,
const ACE_TString& value) = 0;
+
/// Sets a integer-typed value.
/**
* @param key Configuration section to set the value in.
@@ -231,6 +257,7 @@ public:
virtual int set_integer_value (const ACE_Configuration_Section_Key& key,
const ACE_TCHAR* name,
u_int value) = 0;
+
/// Sets a binary-typed value.
/**
* @param key Configuration section to set the value in.
@@ -246,6 +273,7 @@ public:
const ACE_TCHAR* name,
const void* data,
size_t length) = 0;
+
/// Gets a string-typed value.
/**
* @param key Configuration section to get the value from.
@@ -259,6 +287,7 @@ public:
virtual int get_string_value (const ACE_Configuration_Section_Key& key,
const ACE_TCHAR* name,
ACE_TString& value) = 0;
+
/// Gets an integer-typed value.
/**
* @param key Configuration section to get the value from.
@@ -272,6 +301,7 @@ public:
virtual int get_integer_value (const ACE_Configuration_Section_Key& key,
const ACE_TCHAR* name,
u_int& value) = 0;
+
/// Gets a binary-typed value.
/**
* @param key Configuration section to get the value from.
@@ -290,6 +320,7 @@ public:
const ACE_TCHAR* name,
void*& data,
size_t& length) = 0;
+
/**
* Retrieves the type of a named configuration value.
*
@@ -303,6 +334,7 @@ public:
virtual int find_value(const ACE_Configuration_Section_Key& key,
const ACE_TCHAR* name,
VALUETYPE& type) = 0;
+
/// Removes a named value.
/**
* @param key Configuration section to remove the named value from.
@@ -313,6 +345,7 @@ public:
*/
virtual int remove_value (const ACE_Configuration_Section_Key& key,
const ACE_TCHAR* name) = 0;
+
/**
* Expands @a path_in to @a key_out from @a key. If create is true,
* the subsections are created. Returns 0 on success, non zero on
@@ -325,6 +358,7 @@ public:
const ACE_TString& path_in,
ACE_Configuration_Section_Key& key_out,
int create = 1);
+
/**
* @deprecated Exports the configuration database to filename.
* If @a filename is already present, it is overwritten. This function is
@@ -332,6 +366,7 @@ public:
* either ACE_Registry_ImpExp or ACE_Ini_ImpExp instead.
*/
int export_config (const ACE_TCHAR* filename);
+
/**
* @deprecated Imports the configuration database from filename. Any
* existing data is not removed. This function is deprecated and will be
@@ -339,28 +374,34 @@ public:
* or ACE_Ini_ImpExp instead.
*/
int import_config (const ACE_TCHAR* filename);
+
/**
* Determine if the contents of this object is the same as the
* contents of the object on the right hand side.
* Returns true if they are equal and false if they are not equal
*/
bool operator==(const ACE_Configuration& rhs) const;
+
/**
* Determine if the contents of this object are different from the
* contents of the object on the right hand side.
* Returns false if they are equal and true if they are not equal
*/
bool operator!=(const ACE_Configuration& rhs) const;
+
/**
* * Represents the "NULL" string to simplify the internal logic.
* */
static ACE_TCHAR NULL_String_;
+
protected:
/// Default ctor
ACE_Configuration (void);
+
/// Resolves the internal key from a section key
ACE_Section_Key_Internal* get_internal_key
(const ACE_Configuration_Section_Key& key);
+
/**
* Tests to see if @a name is valid. @a name must be < 255 characters
* and not contain the path separator '\', brackets [] or = (maybe
@@ -369,6 +410,7 @@ protected:
* if @a allow_path is true.
*/
int validate_name (const ACE_TCHAR* name, int allow_path = 0);
+
/**
* Test to see if @a name is valid. The default value for a key can be
* unnamed, which means either @a name is == 0 or @a name == '\0` is
@@ -376,13 +418,17 @@ protected:
* same rules that apply to keys.
*/
int validate_value_name (const ACE_TCHAR* name);
+
// Not used
ACE_Configuration (const ACE_Configuration& rhs);
ACE_Configuration& operator= (const ACE_Configuration& rhs);
+
ACE_Configuration_Section_Key root_;
};
+
#if defined (ACE_WIN32) && !defined (ACE_LACKS_WIN32_REGISTRY)
+
/**
* @class ACE_Section_Key_Win32
*
@@ -395,14 +441,18 @@ class ACE_Export ACE_Section_Key_Win32 : public ACE_Section_Key_Internal
public:
/// Constructor based on an HKEY
ACE_Section_Key_Win32 (HKEY hKey);
+
HKEY hKey_;
+
protected:
/// Destructor - invokes <RegCloseKey>
virtual ~ACE_Section_Key_Win32 (void);
+
// Not used
ACE_Section_Key_Win32 (const ACE_Section_Key_Win32& rhs);
ACE_Section_Key_Win32& operator= (const ACE_Section_Key_Win32& rhs);
};
+
/**
* @class ACE_Configuration_Win32Registry
*
@@ -415,54 +465,69 @@ protected:
class ACE_Export ACE_Configuration_Win32Registry : public ACE_Configuration
{
public:
+
/**
* Constructor for registry configuration database. hKey is the
* base registry key to attach to. This class takes ownership of
* hKey, it will invoke <RegCloseKey> on it upon destruction.
*/
explicit ACE_Configuration_Win32Registry (HKEY hKey);
+
/// Destructor
virtual ~ACE_Configuration_Win32Registry (void);
+
virtual int open_section (const ACE_Configuration_Section_Key& base,
const ACE_TCHAR* sub_section,
int create,
ACE_Configuration_Section_Key& result);
+
virtual int remove_section (const ACE_Configuration_Section_Key& key,
const ACE_TCHAR* sub_section,
int recursive);
+
virtual int enumerate_values (const ACE_Configuration_Section_Key& key,
int index,
ACE_TString& name,
VALUETYPE& type);
+
virtual int enumerate_sections (const ACE_Configuration_Section_Key& key,
int index,
ACE_TString& name);
+
virtual int set_string_value (const ACE_Configuration_Section_Key& key,
const ACE_TCHAR* name,
const ACE_TString& value);
+
virtual int set_integer_value (const ACE_Configuration_Section_Key& key,
const ACE_TCHAR* name,
u_int value);
+
virtual int set_binary_value (const ACE_Configuration_Section_Key& key,
const ACE_TCHAR* name,
const void* data,
size_t length);
+
virtual int get_string_value (const ACE_Configuration_Section_Key& key,
const ACE_TCHAR* name,
ACE_TString& value);
+
virtual int get_integer_value (const ACE_Configuration_Section_Key& key,
const ACE_TCHAR* name,
u_int& value);
+
virtual int get_binary_value (const ACE_Configuration_Section_Key& key,
const ACE_TCHAR* name,
void*& data,
size_t& length);
+
virtual int find_value(const ACE_Configuration_Section_Key& key,
const ACE_TCHAR* name,
VALUETYPE& type);
+
/// Removes the the value @a name from @a key. returns non zero on error
virtual int remove_value (const ACE_Configuration_Section_Key& key,
const ACE_TCHAR* name);
+
/**
* This method traverses <path> through <hKey>. It is useful when
* you want the HKEY for a specific registry key, especially when
@@ -476,22 +541,28 @@ public:
int create = 1);
virtual bool operator== (const ACE_Configuration_Win32Registry &rhs) const;
virtual bool operator!= (const ACE_Configuration_Win32Registry &rhs) const;
+
protected:
+
/// Gets the HKEY for a configuration section
int load_key (const ACE_Configuration_Section_Key& key, HKEY& hKey);
+
// Not used
ACE_Configuration_Win32Registry (void);
ACE_Configuration_Win32Registry (const ACE_Configuration_Win32Registry& rhs);
ACE_Configuration_Win32Registry& operator= (const ACE_Configuration_Win32Registry& rhs);
};
#endif /* ACE_WIN32 && !ACE_LACKS_WIN32_REGISTRY */
+
// ACE_Allocator version
+
typedef ACE_Allocator_Adapter <ACE_Malloc <ACE_MMAP_MEMORY_POOL,
ACE_SYNCH_MUTEX> >
PERSISTENT_ALLOCATOR;
typedef ACE_Allocator_Adapter <ACE_Malloc <ACE_LOCAL_MEMORY_POOL,
ACE_SYNCH_MUTEX> >
HEAP_ALLOCATOR;
+
/**
* @class ACE_Configuration_ExtId
*
@@ -504,29 +575,41 @@ class ACE_Export ACE_Configuration_ExtId
public:
/// Defeault ctor
ACE_Configuration_ExtId (void);
+
/// Named constructor
explicit ACE_Configuration_ExtId (const ACE_TCHAR* name);
+
/// Copy ctor
ACE_Configuration_ExtId (const ACE_Configuration_ExtId& rhs);
+
/// destructor
~ACE_Configuration_ExtId (void);
+
/// Assignment operator
ACE_Configuration_ExtId& operator= (const ACE_Configuration_ExtId& rhs);
+
/// Equality comparison operator (must match name_).
bool operator== (const ACE_Configuration_ExtId &rhs) const;
+
/// Inequality comparison operator.
bool operator!= (const ACE_Configuration_ExtId &rhs) const;
+
/// Frees the name of the value. needed since we don't know the
/// allocator name_ was created in
void free (ACE_Allocator *alloc);
+
/// <hash> function is required in order for this class to be usable by
/// ACE_Hash_Map_Manager.
u_long hash (void) const;
+
// = Data members.
+
const ACE_TCHAR * name_;
+
// Accessors
const ACE_TCHAR *name (void);
};
+
typedef ACE_Hash_Map_With_Allocator<ACE_Configuration_ExtId, int>
SUBSECTION_MAP;
typedef ACE_Hash_Map_Manager_Ex<ACE_Configuration_ExtId,
@@ -535,8 +618,10 @@ typedef ACE_Hash_Map_Manager_Ex<ACE_Configuration_ExtId,
ACE_Equal_To<ACE_Configuration_ExtId>,
ACE_Null_Mutex>
SUBSECTION_HASH;
+
/// @deprecated Deprecated typedef. Use the SUBSECTION_HASH::ENTRY trait instead.
typedef SUBSECTION_HASH::ENTRY SUBSECTION_ENTRY;
+
/**
* @class ACE_Configuration_Value_IntId
*
@@ -550,21 +635,30 @@ class ACE_Export ACE_Configuration_Value_IntId
public:
/// Default constructor
ACE_Configuration_Value_IntId (void);
+
/// String constructor, takes ownership of string
explicit ACE_Configuration_Value_IntId (ACE_TCHAR* string);
+
/// Integer constructor
explicit ACE_Configuration_Value_IntId (u_int integer);
+
/// Binary constructor, takes ownership of data
ACE_Configuration_Value_IntId (void* data, size_t length);
+
/// Copy ctor
ACE_Configuration_Value_IntId (const ACE_Configuration_Value_IntId& rhs);
+
/// Destructor
~ACE_Configuration_Value_IntId (void);
+
/// Assignment operator
ACE_Configuration_Value_IntId& operator= (
const ACE_Configuration_Value_IntId& rhs);
+
void free (ACE_Allocator *alloc);
+
// = Data members.
+
/**
* Points to the string value or binary data or IS the integer
* Length is only used when type_ == BINARY
@@ -576,6 +670,7 @@ public:
} data_;
size_t length_;
};
+
typedef ACE_Hash_Map_With_Allocator<ACE_Configuration_ExtId,
ACE_Configuration_Value_IntId>
VALUE_MAP;
@@ -585,8 +680,10 @@ typedef ACE_Hash_Map_Manager_Ex<ACE_Configuration_ExtId,
ACE_Equal_To<ACE_Configuration_ExtId>,
ACE_Null_Mutex>
VALUE_HASH;
+
// Deprecated typedef. Use the VALUE_HASH::ENTRY trait instead.
typedef VALUE_HASH::ENTRY VALUE_ENTRY;
+
/**
* @class ACE_Configuration_Section_IntId
*
@@ -599,22 +696,30 @@ class ACE_Export ACE_Configuration_Section_IntId
public:
/// Default ctor
ACE_Configuration_Section_IntId (void);
+
/// Named ctor
ACE_Configuration_Section_IntId (VALUE_MAP* value_hash_map,
SUBSECTION_MAP* section_hash_map);
+
/// Copy ctor
ACE_Configuration_Section_IntId (const ACE_Configuration_Section_IntId& rhs);
+
/// Destructor
~ACE_Configuration_Section_IntId (void);
+
/// Assignment operator
ACE_Configuration_Section_IntId& operator= (
const ACE_Configuration_Section_IntId& rhs);
+
/// Frees the hash table and all its values
void free (ACE_Allocator *alloc);
+
// = Data Members.
VALUE_MAP* value_hash_map_;
+
SUBSECTION_MAP* section_hash_map_;
};
+
typedef ACE_Hash_Map_With_Allocator<ACE_Configuration_ExtId,
ACE_Configuration_Section_IntId>
SECTION_MAP;
@@ -624,8 +729,10 @@ typedef ACE_Hash_Map_Manager_Ex<ACE_Configuration_ExtId,
ACE_Equal_To<ACE_Configuration_ExtId>,
ACE_Null_Mutex>
SECTION_HASH;
+
// Deprecated typedef. Use the SECTION_HASH::ENTRY trait instead.
typedef SECTION_HASH::ENTRY SECTION_ENTRY;
+
/**
* @class ACE_Configuration_Section_Key_Heap
*
@@ -640,19 +747,24 @@ class ACE_Export ACE_Configuration_Section_Key_Heap
public:
/// Constructor based on the full path of the section
ACE_Configuration_Section_Key_Heap (const ACE_TCHAR* path);
+
/// The path itself
ACE_TCHAR* path_;
+
/// The value iterator
VALUE_HASH::ITERATOR* value_iter_;
+
/// The sub section iterator
SUBSECTION_HASH::ITERATOR* section_iter_;
protected:
/// Destructor - will delete the iterators
virtual ~ACE_Configuration_Section_Key_Heap (void);
+
// Not used
ACE_Configuration_Section_Key_Heap (const ACE_Configuration_Section_Key_Heap& rhs);
ACE_Configuration_Section_Key_Heap& operator= (const ACE_Configuration_Section_Key_Heap& rhs);
};
+
/**
* @class ACE_Configuration_Heap
*
@@ -672,55 +784,72 @@ protected:
class ACE_Export ACE_Configuration_Heap : public ACE_Configuration
{
public:
+
/// Default ctor
ACE_Configuration_Heap (void);
+
/// Destructor
virtual ~ACE_Configuration_Heap (void);
+
/// Opens a configuration based on a file name
int open (const ACE_TCHAR* file_name,
void* base_address = ACE_DEFAULT_BASE_ADDR,
size_t default_map_size = ACE_DEFAULT_CONFIG_SECTION_SIZE);
+
/// Opens a heap based configuration
int open (size_t default_map_size = ACE_DEFAULT_CONFIG_SECTION_SIZE);
+
virtual int open_section (const ACE_Configuration_Section_Key& base,
const ACE_TCHAR* sub_section,
int create, ACE_Configuration_Section_Key& result);
+
virtual int remove_section (const ACE_Configuration_Section_Key& key,
const ACE_TCHAR* sub_section,
int recursive);
+
virtual int enumerate_values (const ACE_Configuration_Section_Key& key,
int index,
ACE_TString& name,
VALUETYPE& type);
+
virtual int enumerate_sections (const ACE_Configuration_Section_Key& key,
int index,
ACE_TString& name);
+
virtual int set_string_value (const ACE_Configuration_Section_Key& key,
const ACE_TCHAR* name,
const ACE_TString& value);
+
virtual int set_integer_value (const ACE_Configuration_Section_Key& key,
const ACE_TCHAR* name,
u_int value);
+
virtual int set_binary_value (const ACE_Configuration_Section_Key& key,
const ACE_TCHAR* name,
const void* data,
size_t length);
+
virtual int get_string_value (const ACE_Configuration_Section_Key& key,
const ACE_TCHAR* name,
ACE_TString& value);
+
virtual int get_integer_value (const ACE_Configuration_Section_Key& key,
const ACE_TCHAR* name,
u_int& value);
+
virtual int get_binary_value (const ACE_Configuration_Section_Key& key,
const ACE_TCHAR* name,
void* &data,
size_t &length);
+
virtual int find_value(const ACE_Configuration_Section_Key& key,
const ACE_TCHAR* name,
VALUETYPE& type);
+
/// Removes the the value @a name from @a key. returns non zero on error
virtual int remove_value (const ACE_Configuration_Section_Key& key,
const ACE_TCHAR* name);
+
private:
/// @a sub_section may not contain path separators
int open_simple_section (const ACE_Configuration_Section_Key &base,
@@ -730,26 +859,37 @@ private:
int add_section (const ACE_Configuration_Section_Key &base,
const ACE_TCHAR *sub_section,
ACE_Configuration_Section_Key &result);
+
/// Helper for the <open> method.
int create_index (void);
+
/// Helper for create_index() method: places hash table into an
/// allocated space.
int create_index_helper (void *buffer);
+
int value_open_helper (size_t hash_table_size, void *buffer);
+
int section_open_helper (size_t hash_table_size, void *buffer);
+
int load_key (const ACE_Configuration_Section_Key& key, ACE_TString& name);
+
int new_section (const ACE_TString& section,
ACE_Configuration_Section_Key& result);
+
ACE_Configuration_Heap (const ACE_Configuration_Heap& rhs);
ACE_Configuration_Heap& operator= (const ACE_Configuration_Heap& rhs);
+
ACE_Allocator *allocator_;
SECTION_MAP *index_;
size_t default_map_size_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Configuration.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_CONFIGURATION_H */
diff --git a/dep/ACE_wrappers/ace/Configuration.inl b/dep/ACE_wrappers/ace/Configuration.inl
index 787de75b900..19c2c591bf4 100644
--- a/dep/ACE_wrappers/ace/Configuration.inl
+++ b/dep/ACE_wrappers/ace/Configuration.inl
@@ -1,10 +1,13 @@
// -*- C++ -*-
//
// $Id: Configuration.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE const ACE_TCHAR*
ACE_Configuration_ExtId::name (void)
{
return name_;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Configuration_Import_Export.cpp b/dep/ACE_wrappers/ace/Configuration_Import_Export.cpp
index 75e5f61a792..bd5a79b143a 100644
--- a/dep/ACE_wrappers/ace/Configuration_Import_Export.cpp
+++ b/dep/ACE_wrappers/ace/Configuration_Import_Export.cpp
@@ -1,24 +1,31 @@
// $Id: Configuration_Import_Export.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Configuration_Import_Export.h"
#include "ace/OS_Errno.h"
#include "ace/OS_NS_stdio.h"
#include "ace/OS_NS_ctype.h"
#include "ace/OS_NS_string.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_Config_ImpExp_Base::ACE_Config_ImpExp_Base (ACE_Configuration& config)
: config_ (config)
{
}
+
ACE_Config_ImpExp_Base::~ACE_Config_ImpExp_Base (void)
{
}
+
ACE_Registry_ImpExp::ACE_Registry_ImpExp (ACE_Configuration& config)
: ACE_Config_ImpExp_Base (config)
{
}
+
ACE_Registry_ImpExp::~ACE_Registry_ImpExp (void)
{
}
+
// Imports the configuration database from filename.
// No existing data is removed.
int
@@ -32,6 +39,7 @@ ACE_Registry_ImpExp::import_config (const ACE_TCHAR* filename)
FILE* in = ACE_OS::fopen (filename, ACE_TEXT ("r"));
if (!in)
return -1;
+
u_int buffer_size = 4096;
u_int read_pos = 0;
ACE_TCHAR *buffer = 0;
@@ -44,6 +52,7 @@ ACE_Registry_ImpExp::import_config (const ACE_TCHAR* filename)
}
ACE_Configuration_Section_Key section;
ACE_TCHAR *end = 0;
+
while (ACE_OS::fgets (buffer+read_pos, buffer_size - read_pos, in))
{
// Check if we got all the line.
@@ -61,6 +70,7 @@ ACE_Registry_ImpExp::import_config (const ACE_TCHAR* filename)
(void) ACE_OS::fclose (in);
return -1;
}
+
// copy the beginnning of the line
ACE_OS::memcpy (temp_buffer, buffer, buffer_size);
read_pos = buffer_size - 1;
@@ -70,9 +80,11 @@ ACE_Registry_ImpExp::import_config (const ACE_TCHAR* filename)
continue;
}
read_pos = 0;
+
// Check for a comment
if (buffer[0] == ACE_TEXT (';') || buffer[0] == ACE_TEXT ('#'))
continue;
+
if (buffer[0] == ACE_TEXT ('['))
{
// We have a new section here, strip out the section name
@@ -84,6 +96,7 @@ ACE_Registry_ImpExp::import_config (const ACE_TCHAR* filename)
return -3;
}
*end = 0;
+
if (config_.expand_path (config_.root_section (), buffer + 1, section, 1))
{
ACE_OS::fclose (in);
@@ -92,12 +105,14 @@ ACE_Registry_ImpExp::import_config (const ACE_TCHAR* filename)
}
continue;
} // end if firs char is a [
+
if (buffer[0] == ACE_TEXT ('"'))
{
// we have a value
end = ACE_OS::strchr (buffer+1, '"');
if (!end) // no closing quote, not a value so just skip it
continue;
+
// null terminate the name
*end = 0;
ACE_TCHAR* name = buffer + 1;
@@ -183,16 +198,19 @@ ACE_Registry_ImpExp::import_config (const ACE_TCHAR* filename)
}
} // end if maybe old format
} // end while fgets
+
if (ferror (in))
{
ACE_OS::fclose (in);
delete [] buffer;
return -1;
}
+
ACE_OS::fclose (in);
delete [] buffer;
return 0;
}
+
// This method exports the entire configuration database to <filename>.
// Once the file is opened this method calls 'export_section' passing
// the root section.
@@ -205,6 +223,7 @@ ACE_Registry_ImpExp::export_config (const ACE_TCHAR* filename)
return -1;
}
int result = -1;
+
FILE* out = ACE_OS::fopen (filename, ACE_TEXT ("w"));
if (out)
{
@@ -218,9 +237,11 @@ ACE_Registry_ImpExp::export_config (const ACE_TCHAR* filename)
}
return result;
}
+
// Method provided by derived classes in order to write one section
// to the file specified. Called by export_config when exporting
// the entire configuration object.
+
int
ACE_Registry_ImpExp::export_section (const ACE_Configuration_Section_Key& section,
const ACE_TString& path,
@@ -329,6 +350,7 @@ ACE_Registry_ImpExp::export_section (const ACE_Configuration_Section_Key& sectio
}
return 0;
}
+
//
// This method read the line format origionally used in ACE 5.1
//
@@ -340,6 +362,7 @@ ACE_Registry_ImpExp::process_previous_line_format (ACE_TCHAR* buffer,
ACE_TCHAR *endp = ACE_OS::strpbrk (buffer, ACE_TEXT ("\r\n"));
if (endp != 0)
*endp = '\0';
+
// assume this is a value, read in the value name
ACE_TCHAR* end = ACE_OS::strchr (buffer, '=');
if (end) // no =, not a value so just skip it
@@ -365,13 +388,16 @@ ACE_Registry_ImpExp::process_previous_line_format (ACE_TCHAR* buffer,
return 0;
} // end read_previous_line_format
+
ACE_Ini_ImpExp::ACE_Ini_ImpExp (ACE_Configuration& config)
: ACE_Config_ImpExp_Base (config)
{
}
+
ACE_Ini_ImpExp::~ACE_Ini_ImpExp (void)
{
}
+
// Method to read file and populate object.
int
ACE_Ini_ImpExp::import_config (const ACE_TCHAR* filename)
@@ -384,6 +410,7 @@ ACE_Ini_ImpExp::import_config (const ACE_TCHAR* filename)
FILE* in = ACE_OS::fopen (filename, ACE_TEXT ("r"));
if (!in)
return -1;
+
// @@ Make this a dynamic size!
ACE_TCHAR buffer[4096];
ACE_Configuration_Section_Key section;
@@ -395,6 +422,7 @@ ACE_Ini_ImpExp::import_config (const ACE_TCHAR* filename)
line[0] == ACE_TEXT ('#') ||
line[0] == '\0')
continue;
+
if (line[0] == ACE_TEXT ('['))
{
// We have a new section here, strip out the section name
@@ -405,6 +433,7 @@ ACE_Ini_ImpExp::import_config (const ACE_TCHAR* filename)
return -3;
}
*end = 0;
+
if (config_.expand_path (config_.root_section (),
line + 1,
section,
@@ -413,8 +442,10 @@ ACE_Ini_ImpExp::import_config (const ACE_TCHAR* filename)
ACE_OS::fclose (in);
return -3;
}
+
continue;
}
+
// We have a line; name ends at equal sign.
ACE_TCHAR *end = ACE_OS::strchr (line, ACE_TEXT ('='));
if (end == 0) // No '='
@@ -447,20 +478,24 @@ ACE_Ini_ImpExp::import_config (const ACE_TCHAR* filename)
++value;
}
}
+
if (config_.set_string_value (section, name, value))
{
ACE_OS::fclose (in);
return -4;
}
} // end while fgets
+
if (ferror (in))
{
ACE_OS::fclose (in);
return -1;
}
+
ACE_OS::fclose (in);
return 0;
}
+
// This method exports the entire configuration database to <filename>.
// Once the file is opened this method calls 'export_section' passing
// the root section.
@@ -473,6 +508,7 @@ ACE_Ini_ImpExp::export_config (const ACE_TCHAR* filename)
return -1;
}
int result = -1;
+
FILE* out = ACE_OS::fopen (filename, ACE_TEXT ("w"));
if (out)
{
@@ -486,9 +522,11 @@ ACE_Ini_ImpExp::export_config (const ACE_TCHAR* filename)
}
return result;
}
+
// Method provided by derived classes in order to write one section to the
// file specified. Called by export_config when exporting the entire
// configuration objet
+
int
ACE_Ini_ImpExp::export_section (const ACE_Configuration_Section_Key& section,
const ACE_TString& path,
@@ -569,7 +607,9 @@ ACE_Ini_ImpExp::export_section (const ACE_Configuration_Section_Key& section,
}
default:
return -3;
+
}// end switch on type
+
line += ACE_TEXT ("\n");
if (ACE_OS::fputs (line.fast_rep (), out) < 0)
return -4;
@@ -594,19 +634,24 @@ ACE_Ini_ImpExp::export_section (const ACE_Configuration_Section_Key& section,
++index;
}
return 0;
+
}
+
// Method to squish leading and trailing whitespaces from a string.
// Whitespace is defined as: spaces (' '), tabs ('\t') or end-of-line
// (cr/lf). The terminating nul is moved up to expunge trailing
// whitespace and the returned pointer points at the first
// non-whitespace character in the string, which may be the nul
// terminator if the string is all whitespace.
+
ACE_TCHAR *
ACE_Ini_ImpExp::squish (ACE_TCHAR *src)
{
ACE_TCHAR *cp = 0;
+
if (src == 0)
return 0;
+
// Start at the end and work backwards over all whitespace.
for (cp = src + ACE_OS::strlen (src) - 1;
cp != src;
@@ -614,10 +659,13 @@ ACE_Ini_ImpExp::squish (ACE_TCHAR *src)
if (!ACE_OS::ace_isspace (*cp))
break;
cp[1] = '\0'; // Chop trailing whitespace
+
// Now start at the beginning and move over all whitespace.
for (cp = src; ACE_OS::ace_isspace (*cp); ++cp)
continue;
+
return cp;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Configuration_Import_Export.h b/dep/ACE_wrappers/ace/Configuration_Import_Export.h
index f6e5923fe02..ec47bafa144 100644
--- a/dep/ACE_wrappers/ace/Configuration_Import_Export.h
+++ b/dep/ACE_wrappers/ace/Configuration_Import_Export.h
@@ -1,4 +1,5 @@
/* -*- C++ -*- */
+
//=============================================================================
/**
* @file Configuration_Import_Export.h
@@ -19,15 +20,20 @@
* - See todo's in each class
*/
//=============================================================================
+
#ifndef ACE_CONFIGURATION_IMPORT_EXPORT_H
#define ACE_CONFIGURATION_IMPORT_EXPORT_H
#include /**/ "ace/pre.h"
+
#include "ace/Configuration.h"
#include "ace/SString.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Config_ImpExp_Base
*
@@ -43,27 +49,33 @@ class ACE_Export ACE_Config_ImpExp_Base
public:
/// Constructor taking the ACE_Configuration to import/export to
ACE_Config_ImpExp_Base (ACE_Configuration& config);
+
/**
* Destructor
*/
virtual ~ACE_Config_ImpExp_Base (void);
+
/**
* Imports the configuration database from @a filename.
* No existing data is removed.
*/
virtual int import_config (const ACE_TCHAR* filename) = 0;
+
/**
* This method exports the entire configuration database to @a filename.
* Once the file is opened this method calls 'export_section' passing
* the root section.
*/
virtual int export_config (const ACE_TCHAR* filename) = 0;
+
protected:
ACE_Configuration &config_;
+
private:
ACE_Config_ImpExp_Base (const ACE_Config_ImpExp_Base&);
ACE_Config_ImpExp_Base& operator= (const ACE_Config_ImpExp_Base&);
};
+
/**
* @class ACE_Registry_ImpExp
*
@@ -84,28 +96,35 @@ class ACE_Export ACE_Registry_ImpExp : public ACE_Config_ImpExp_Base
public:
/// Construction
ACE_Registry_ImpExp (ACE_Configuration&);
+
/// Destruction.
virtual ~ACE_Registry_ImpExp (void);
+
/**
* Imports the configuration database from filename.
* No existing data is removed.
*/
virtual int import_config (const ACE_TCHAR* filename);
+
/**
* This method exports the entire configuration database to @a filename.
* Once the file is opened this method calls export_section() passing
* the root section.
*/
virtual int export_config (const ACE_TCHAR* filename);
+
private:
int export_section (const ACE_Configuration_Section_Key& section,
const ACE_TString& path,
FILE* out);
+
int process_previous_line_format (ACE_TCHAR* buffer,
ACE_Configuration_Section_Key& section);
+
ACE_Registry_ImpExp ( const ACE_Registry_ImpExp&);
ACE_Registry_ImpExp& operator= ( const ACE_Registry_ImpExp&);
};
+
/**
* @class ACE_Ini_ImpExp
*
@@ -147,21 +166,25 @@ public:
* Construction
*/
ACE_Ini_ImpExp (ACE_Configuration&);
+
/**
* Destructor
*/
virtual ~ACE_Ini_ImpExp (void);
+
/**
* Imports the configuration database from filename.
* No existing data is removed.
*/
virtual int import_config (const ACE_TCHAR* filename);
+
/**
* This method exports the entire configuration database to @a filename.
* Once the file is opened this method calls export_section() passing
* the root section.
*/
virtual int export_config (const ACE_TCHAR* filename);
+
private:
/**
* Method provided by derived classes in order to write one section
@@ -171,6 +194,7 @@ private:
int export_section (const ACE_Configuration_Section_Key& section,
const ACE_TString& path,
FILE* out);
+
/**
* Method to squish leading and trailing whitespaces in a string.
* Whitespace is defined as: spaces (' '), tabs ('\\t') or cr/lf.
@@ -180,10 +204,13 @@ private:
* first character past the last non-whitespace.
*/
ACE_TCHAR *squish (ACE_TCHAR *src);
+
ACE_Ini_ImpExp (const ACE_Ini_ImpExp&);
ACE_Ini_ImpExp& operator= (const ACE_Ini_ImpExp&);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
#endif /* ACE_CONFIGURATION_IMPORT_EXPORT_H */
diff --git a/dep/ACE_wrappers/ace/Connection_Recycling_Strategy.cpp b/dep/ACE_wrappers/ace/Connection_Recycling_Strategy.cpp
index 4406455ad63..6f32c9a2de2 100644
--- a/dep/ACE_wrappers/ace/Connection_Recycling_Strategy.cpp
+++ b/dep/ACE_wrappers/ace/Connection_Recycling_Strategy.cpp
@@ -1,10 +1,14 @@
#include "ace/Connection_Recycling_Strategy.h"
+
ACE_RCSID(ace, Connection_Recycling_Strategy, "$Id: Connection_Recycling_Strategy.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_Connection_Recycling_Strategy::~ACE_Connection_Recycling_Strategy (void)
{
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Connection_Recycling_Strategy.h b/dep/ACE_wrappers/ace/Connection_Recycling_Strategy.h
index 60dc01f4fa2..0770c3a6c26 100644
--- a/dep/ACE_wrappers/ace/Connection_Recycling_Strategy.h
+++ b/dep/ACE_wrappers/ace/Connection_Recycling_Strategy.h
@@ -1,4 +1,5 @@
/* -*- C++ -*- */
+
//=============================================================================
/**
* @file Connection_Recycling_Strategy.h
@@ -11,11 +12,15 @@
#ifndef ACE_CONNECTION_RECYCLING_STRATEGY_H
#define ACE_CONNECTION_RECYCLING_STRATEGY_H
#include /**/ "ace/pre.h"
+
#include "ace/Recyclable.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Connection_Recycling_Strategy
*
@@ -26,23 +31,34 @@ class ACE_Export ACE_Connection_Recycling_Strategy
public:
/// Virtual Destructor
virtual ~ACE_Connection_Recycling_Strategy (void);
+
/// Remove from cache.
virtual int purge (const void *recycling_act) = 0;
+
/// Add to cache.
virtual int cache (const void *recycling_act) = 0;
+
virtual int recycle_state (const void *recycling_act,
ACE_Recyclable_State new_state) = 0;
+
/// Get/Set recycle_state.
virtual ACE_Recyclable_State recycle_state (const void *recycling_act) const = 0;
+
/// Mark as closed.
virtual int mark_as_closed (const void *recycling_act) = 0;
+
/// Mark as closed.(non-locking version)
virtual int mark_as_closed_i (const void *recycling_act) = 0;
+
/// Cleanup hint and reset @a act_holder to zero if @a act_holder != 0.
virtual int cleanup_hint (const void *recycling_act,
void **act_holder = 0) = 0;
+
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
+
#endif /*ACE_CONNECTION_RECYCLING_STRATEGY*/
diff --git a/dep/ACE_wrappers/ace/Connector.h b/dep/ACE_wrappers/ace/Connector.h
index f6da43e3539..73689356501 100644
--- a/dep/ACE_wrappers/ace/Connector.h
+++ b/dep/ACE_wrappers/ace/Connector.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Connector.h
@@ -8,17 +9,24 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_CONNECTOR_H
#define ACE_CONNECTOR_H
+
#include /**/ "ace/pre.h"
+
#include "ace/Service_Object.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Strategies_T.h"
#include "ace/Synch_Options.h"
#include "ace/Unbounded_Set.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Connector_Base
*
@@ -32,14 +40,18 @@ template <class SVC_HANDLER>
class ACE_Connector_Base
{
public:
+
virtual ~ACE_Connector_Base (void) {}
+
/// Initialize the Svc_Handler.
virtual void initialize_svc_handler (ACE_HANDLE handle,
SVC_HANDLER *svc_handler) = 0;
+
/// Return the handle set representing the non-blocking connects in
/// progress.
virtual ACE_Unbounded_Set<ACE_HANDLE> &non_blocking_handles (void) = 0;
};
+
/**
* @class ACE_NonBlocking_Connect_Handler
*
@@ -49,10 +61,12 @@ template <class SVC_HANDLER>
class ACE_NonBlocking_Connect_Handler : public ACE_Event_Handler
{
public:
+
/// Constructor.
ACE_NonBlocking_Connect_Handler (ACE_Connector_Base<SVC_HANDLER> &connector,
SVC_HANDLER *,
long timer_id);
+
/// Close up and return underlying SVC_HANDLER through @c sh.
/**
* If the return value is true the close was performed succesfully,
@@ -66,40 +80,57 @@ public:
* object.
*/
bool close (SVC_HANDLER *&sh);
+
/// Get SVC_HANDLER.
SVC_HANDLER *svc_handler (void);
+
/// Get handle.
ACE_HANDLE handle (void);
+
/// Set handle.
void handle (ACE_HANDLE);
+
/// Get timer id.
long timer_id (void);
+
/// Set timer id.
void timer_id (long timer_id);
+
/// Called by ACE_Reactor when asynchronous connections fail.
virtual int handle_input (ACE_HANDLE);
+
/// Called by ACE_Reactor when asynchronous connections succeed.
virtual int handle_output (ACE_HANDLE);
+
/// Called by ACE_Reactor when asynchronous connections suceeds (on
/// some platforms only).
virtual int handle_exception (ACE_HANDLE fd);
+
/// This method is called if a connection times out before
/// completing.
virtual int handle_timeout (const ACE_Time_Value &tv, const void *arg);
+
/// Should Reactor resume us if we have been suspended before the upcall?
virtual int resume_handler (void);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
+
/// Connector base.
ACE_Connector_Base<SVC_HANDLER> &connector_;
+
/// Associated SVC_HANDLER.
SVC_HANDLER *svc_handler_;
+
/// Associated timer id.
long timer_id_;
};
+
/**
* @class ACE_Connector
*
@@ -119,6 +150,7 @@ template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1>
class ACE_Connector : public ACE_Connector_Base<SVC_HANDLER>, public ACE_Service_Object
{
public:
+
// Useful STL-style traits.
typedef typename SVC_HANDLER::addr_type addr_type;
typedef ACE_PEER_CONNECTOR connector_type;
@@ -126,6 +158,7 @@ public:
typedef typename SVC_HANDLER::stream_type stream_type;
typedef typename ACE_PEER_CONNECTOR::PEER_ADDR peer_addr_type;
typedef ACE_PEER_CONNECTOR_ADDR ACE_PEER_ADDR_TYPEDEF;
+
/**
* Initialize a connector. @a flags indicates how SVC_HANDLER's
* should be initialized prior to being activated. Right now, the
@@ -134,6 +167,7 @@ public:
*/
ACE_Connector (ACE_Reactor *r = ACE_Reactor::instance (),
int flags = 0);
+
/**
* Initialize a connector. @a flags indicates how SVC_HANDLER's
* should be initialized prior to being activated. Right now, the
@@ -142,9 +176,12 @@ public:
*/
virtual int open (ACE_Reactor *r = ACE_Reactor::instance (),
int flags = 0);
+
/// Shutdown a connector and release resources.
virtual ~ACE_Connector (void);
+
// = Connection establishment methods.
+
/**
* Initiate connection of @a svc_handler to peer at @a remote_addr
* using @a synch_options. If the caller wants to designate the
@@ -164,6 +201,7 @@ public:
int reuse_addr = 0,
int flags = O_RDWR,
int perms = 0);
+
/**
* This is a variation on the previous <connect> method. On cached
* connectors the @a svc_handler_hint variable can be used as a hint
@@ -183,6 +221,7 @@ public:
int reuse_addr = 0,
int flags = O_RDWR,
int perms = 0);
+
/**
* Initiate connection of @a n @a svc_handlers to peers at
* @a remote_addrs using @a synch_options. Returns -1 if failure
@@ -197,6 +236,7 @@ public:
ACE_TCHAR *failed_svc_handlers = 0,
const ACE_Synch_Options &synch_options =
ACE_Synch_Options::defaults);
+
/**
* Cancel the @a svc_handler that was started asynchronously. Note that
* this is the only case when the Connector does not actively close
@@ -204,27 +244,37 @@ public:
* decide the fate of the @a svc_handler.
*/
virtual int cancel (SVC_HANDLER *svc_handler);
+
/// Close down the Connector. All pending non-blocking connects are
/// canceled and the corresponding svc_handler is closed.
virtual int close (void);
+
/// Return the underlying PEER_CONNECTOR object.
virtual ACE_PEER_CONNECTOR &connector (void) const;
+
/// Initialize Svc_Handler.
virtual void initialize_svc_handler (ACE_HANDLE handle,
SVC_HANDLER *svc_handler);
+
/// Set Reactor.
virtual void reactor (ACE_Reactor *reactor);
+
/// Get Reactor.
virtual ACE_Reactor *reactor (void) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
// = Helpful typedefs.
typedef ACE_NonBlocking_Connect_Handler<SVC_HANDLER> NBCH;
+
// = The following two methods define the Connector's strategies for
// creating, connecting, and activating SVC_HANDLER's, respectively.
+
/**
* Bridge method for creating a SVC_HANDLER. The default is to
* create a new SVC_HANDLER only if @a sh == 0, else @a sh is
@@ -235,6 +285,7 @@ protected:
* else 0.
*/
virtual int make_svc_handler (SVC_HANDLER *&sh);
+
/**
* Bridge method for connecting the @a svc_handler to the
* @a remote_addr. The default behavior delegates to the
@@ -255,6 +306,7 @@ protected:
int reuse_addr,
int flags,
int perms);
+
/**
* Bridge method for activating a @a svc_handler with the appropriate
* concurrency strategy. The default behavior of this method is to
@@ -266,9 +318,11 @@ protected:
* multi-processing).
*/
virtual int activate_svc_handler (SVC_HANDLER *svc_handler);
+
/// Creates and registers ACE_NonBlocking_Connect_Handler.
int nonblocking_connect (SVC_HANDLER *,
const ACE_Synch_Options &);
+
/// Implementation of the connect methods.
virtual int connect_i (SVC_HANDLER *&svc_handler,
SVC_HANDLER **sh_copy,
@@ -278,27 +332,35 @@ protected:
int reuse_addr,
int flags,
int perms);
+
/// Return the handle set representing the non-blocking connects in
/// progress.
ACE_Unbounded_Set<ACE_HANDLE> &non_blocking_handles (void);
+
// = Dynamic linking hooks.
/// Default version does no work and returns -1. Must be overloaded
/// by application developer to do anything meaningful.
virtual int init (int argc, ACE_TCHAR *argv[]);
+
/// Calls handle_close() to shutdown the Connector gracefully.
virtual int fini (void);
+
/// Default version returns address info in @a buf.
virtual int info (ACE_TCHAR **strp, size_t length) const;
+
// = Service management hooks.
/// Default version does no work and returns -1. Must be overloaded
/// by application developer to do anything meaningful.
virtual int suspend (void);
+
/// Default version does no work and returns -1. Must be overloaded
/// by application developer to do anything meaningful.
virtual int resume (void);
+
private:
/// This is the peer connector factory.
ACE_PEER_CONNECTOR connector_;
+
/**
* Flags that indicate how SVC_HANDLER's should be initialized
* prior to being activated. Right now, the only flag that is
@@ -306,11 +368,15 @@ private:
* the SVC_HANDLER when it is opened.
*/
int flags_;
+
/// Pointer to the Reactor.
ACE_Reactor *reactor_;
+
/// Handle set representing the non-blocking connects in progress.
ACE_Unbounded_Set<ACE_HANDLE> non_blocking_handles_;
+
};
+
/**
* @class ACE_Strategy_Connector
*
@@ -330,6 +396,7 @@ class ACE_Strategy_Connector
: public ACE_Connector <SVC_HANDLER, ACE_PEER_CONNECTOR_2>
{
public:
+
// Useful STL-style traits.
typedef ACE_Creation_Strategy<SVC_HANDLER>
creation_strategy_type;
@@ -339,6 +406,7 @@ public:
concurrency_strategy_type;
typedef ACE_Connector <SVC_HANDLER, ACE_PEER_CONNECTOR_2>
base_type;
+
// = Define some useful (old style) traits.
typedef ACE_Creation_Strategy<SVC_HANDLER>
CREATION_STRATEGY;
@@ -348,6 +416,7 @@ public:
CONCURRENCY_STRATEGY;
typedef ACE_Connector <SVC_HANDLER, ACE_PEER_CONNECTOR_2>
SUPER;
+
/**
* Initialize a connector. @a flags indicates how <SVC_HANDLER>'s
* should be initialized prior to being activated. Right now, the
@@ -359,6 +428,7 @@ public:
ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2> * = 0,
ACE_Concurrency_Strategy<SVC_HANDLER> * = 0,
int flags = 0);
+
/**
* Initialize a connector. @a flags indicates how SVC_HANDLER's
* should be initialized prior to being activated. Right now, the
@@ -368,6 +438,7 @@ public:
*/
virtual int open (ACE_Reactor *r,
int flags);
+
/**
* Initialize a connector. @a flags indicates how SVC_HANDLER's
* should be initialized prior to being activated. Right now, the
@@ -379,18 +450,23 @@ public:
ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2> * = 0,
ACE_Concurrency_Strategy<SVC_HANDLER> * = 0,
int flags = 0);
+
/// Shutdown a connector and release resources.
virtual ~ACE_Strategy_Connector (void);
+
/// Close down the Connector
virtual int close (void);
+
// = Strategies accessors
virtual ACE_Creation_Strategy<SVC_HANDLER> *creation_strategy (void) const;
virtual ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2> *connect_strategy (void) const;
virtual ACE_Concurrency_Strategy<SVC_HANDLER> *concurrency_strategy (void) const;
+
protected:
// = The following three methods define the <Connector>'s strategies
// for creating, connecting, and activating SVC_HANDLER's,
// respectively.
+
/**
* Bridge method for creating a SVC_HANDLER. The strategy for
* creating a SVC_HANDLER are configured into the Connector via
@@ -403,6 +479,7 @@ protected:
* else 0.
*/
virtual int make_svc_handler (SVC_HANDLER *&sh);
+
/**
* Bridge method for connecting the new connection into the
* SVC_HANDLER. The default behavior delegates to the
@@ -415,6 +492,7 @@ protected:
int reuse_addr,
int flags,
int perms);
+
/**
* Bridge method for connecting the new connection into the
* SVC_HANDLER. The default behavior delegates to the
@@ -433,6 +511,7 @@ protected:
int reuse_addr,
int flags,
int perms);
+
/**
* Bridge method for activating a SVC_HANDLER with the appropriate
* concurrency strategy. The default behavior of this method is to
@@ -444,30 +523,42 @@ protected:
* multi-processing).
*/
virtual int activate_svc_handler (SVC_HANDLER *svc_handler);
+
// = Strategy objects.
+
/// Creation strategy for an Connector.
CREATION_STRATEGY *creation_strategy_;
+
/// true if Connector created the creation strategy and thus should
/// delete it, else false.
bool delete_creation_strategy_;
+
/// Connect strategy for a Connector.
CONNECT_STRATEGY *connect_strategy_;
+
/// true if Connector created the connect strategy and thus should
/// delete it, else false.
bool delete_connect_strategy_;
+
/// Concurrency strategy for an <Connector>.
CONCURRENCY_STRATEGY *concurrency_strategy_;
+
/// true if Connector created the concurrency strategy and thus should
/// delete it, else false.
bool delete_concurrency_strategy_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Connector.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Connector.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_CONNECTOR_H */
diff --git a/dep/ACE_wrappers/ace/Containers.cpp b/dep/ACE_wrappers/ace/Containers.cpp
index 45d29744728..754ef0e5194 100644
--- a/dep/ACE_wrappers/ace/Containers.cpp
+++ b/dep/ACE_wrappers/ace/Containers.cpp
@@ -1,9 +1,13 @@
// $Id: Containers.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Containers.h"
+
ACE_RCSID (ace,
Containers,
"$Id: Containers.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if !defined (__ACE_INLINE__)
#include "ace/Containers.inl"
#endif /* __ACE_INLINE__ */
+
diff --git a/dep/ACE_wrappers/ace/Containers.h b/dep/ACE_wrappers/ace/Containers.h
index 211f0cda68e..f6f1d35bb60 100644
--- a/dep/ACE_wrappers/ace/Containers.h
+++ b/dep/ACE_wrappers/ace/Containers.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Containers.h
@@ -8,18 +9,25 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_CONTAINERS_H
#define ACE_CONTAINERS_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template <class T> class ACE_Double_Linked_List;
template <class T> class ACE_Double_Linked_List_Iterator_Base;
template <class T> class ACE_Double_Linked_List_Iterator;
template <class T> class ACE_Double_Linked_List_Reverse_Iterator;
+
/**
* @class ACE_DLList_Node
*
@@ -33,22 +41,32 @@ public:
friend class ACE_Double_Linked_List_Iterator_Base<ACE_DLList_Node>;
friend class ACE_Double_Linked_List_Iterator<ACE_DLList_Node>;
friend class ACE_Double_Linked_List_Reverse_Iterator<ACE_DLList_Node>;
+
ACE_DLList_Node (void *i,
ACE_DLList_Node *n = 0,
ACE_DLList_Node *p = 0);
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
void *item_;
+
ACE_DLList_Node *next_;
ACE_DLList_Node *prev_;
+
protected:
ACE_DLList_Node (void);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Containers.inl"
#endif /* __ACE_INLINE__ */
+
#include "ace/Containers_T.h"
+
#include /**/ "ace/post.h"
+
#endif /* ACE_CONTAINERS_H */
diff --git a/dep/ACE_wrappers/ace/Containers.inl b/dep/ACE_wrappers/ace/Containers.inl
index 4ad213039ed..8094672a8f6 100644
--- a/dep/ACE_wrappers/ace/Containers.inl
+++ b/dep/ACE_wrappers/ace/Containers.inl
@@ -1,7 +1,9 @@
// -*- C++ -*-
//
// $Id: Containers.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_DLList_Node::ACE_DLList_Node (void)
: item_ (0),
@@ -9,6 +11,7 @@ ACE_DLList_Node::ACE_DLList_Node (void)
prev_ (0)
{
}
+
ACE_INLINE
ACE_DLList_Node::ACE_DLList_Node (void *i,
ACE_DLList_Node *n,
@@ -18,4 +21,5 @@ ACE_DLList_Node::ACE_DLList_Node (void *i,
prev_ (p)
{
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Containers_T.h b/dep/ACE_wrappers/ace/Containers_T.h
index f41858b1553..8969d3cf969 100644
--- a/dep/ACE_wrappers/ace/Containers_T.h
+++ b/dep/ACE_wrappers/ace/Containers_T.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Containers_T.h
@@ -8,26 +9,38 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_CONTAINERS_T_H
#define ACE_CONTAINERS_T_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
// Need by ACE_DLList_Node.
#include "ace/Containers.h"
+
// Shared with "ace/Unbounded_Set.h"
#include "ace/Node.h"
+
// Backwards compatibility, please include "ace/Array_Base.h" directly.
#include "ace/Array_Base.h"
+
// Backwards compatibility, please include "ace/Unbounded_Set.h" directly.
#include "ace/Unbounded_Set.h"
+
// Backwards compatibility, please include "ace/Unbounded_Queue.h" directly.
#include "ace/Unbounded_Queue.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Allocator;
+
/**
* @class ACE_Bounded_Stack
*
@@ -66,18 +79,21 @@ class ACE_Bounded_Stack
{
public:
// = Initialization, assignment, and termination methods.
+
/// Initialize a new empty stack with the provided size..
/**
* Initialize and allocate space for a new Bounded_Stack with the provided
* size.
*/
ACE_Bounded_Stack (size_t size);
+
/// Initialize the stack to be a copy of the stack provided.
/**
* Initialize the stack to be an exact copy of the Bounded_Stack provided
* as a parameter.
*/
ACE_Bounded_Stack (const ACE_Bounded_Stack<T> &s);
+
/// Assignment operator
/**
* Perform a deep copy operation using the Bounded_Stack parameter. If the
@@ -85,12 +101,15 @@ public:
* structure will be reallocated to accomadate the larger number of elements.
*/
void operator= (const ACE_Bounded_Stack<T> &s);
+
/// Perform actions needed when stack goes out of scope.
/**
* Deallocate the memory used by the Bounded_Stack.
*/
~ACE_Bounded_Stack (void);
+
// = Classic Stack operations.
+
///Add an element to the top of the stack.
/**
* Place a new item on top of the stack. Returns -1 if the stack
@@ -98,6 +117,7 @@ public:
* failure occurs.
*/
int push (const T &new_item);
+
///Remove an item from the top of stack.
/**
* Remove and return the top stack item. Returns -1 if the stack is
@@ -105,6 +125,7 @@ public:
* failure occurs.
*/
int pop (T &item);
+
///Examine the contents of the top of stack.
/**
* Return top stack item without removing it. Returns -1 if the
@@ -112,36 +133,47 @@ public:
* -1 if failure occurs.
*/
int top (T &item) const;
+
// = Check boundary conditions.
+
/// Returns 1 if the container is empty, otherwise returns 0.
/**
* Performs constant time check to determine if the stack is empty.
*/
int is_empty (void) const;
+
/// Returns 1 if the container is full, otherwise returns 0.
/**
* Performs constant time check to determine if the stack is at capacity.
*/
int is_full (void) const;
+
/// The number of items in the stack.
/**
* Return the number of items currently in the stack.
*/
size_t size (void) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Size of the dynamically allocated data.
size_t size_;
+
/// Keeps track of the current top of stack.
size_t top_;
+
/// Holds the stack's contents.
T *stack_;
};
+
//----------------------------------------
+
/**
* @class ACE_Fixed_Stack
*
@@ -183,22 +215,27 @@ public:
* Initialize an empty stack.
*/
ACE_Fixed_Stack (void);
+
/// The copy constructor (performs initialization).
/**
* Initialize the stack and copy the provided stack into the current stack.
*/
ACE_Fixed_Stack (const ACE_Fixed_Stack<T, ACE_SIZE> &s);
+
/// Assignment operator (performs assignment).
/**
* Perform a deep copy of the provided stack.
*/
void operator= (const ACE_Fixed_Stack<T, ACE_SIZE> &s);
+
/// Perform actions needed when stack goes out of scope.
/**
* Destroy the stack.
*/
~ACE_Fixed_Stack (void);
+
// = Classic Stack operations.
+
///Constant time placement of element on top of stack.
/**
* Place a new item on top of the stack. Returns -1 if the stack
@@ -206,6 +243,7 @@ public:
* failure occurs.
*/
int push (const T &new_item);
+
///Constant time removal of top of stack.
/**
* Remove and return the top stack item. Returns -1 if the stack is
@@ -213,6 +251,7 @@ public:
* failure occurs.
*/
int pop (T &item);
+
///Constant time examination of top of stack.
/**
* Return top stack item without removing it. Returns -1 if the
@@ -220,37 +259,49 @@ public:
* -1 if failure occurs.
*/
int top (T &item) const;
+
// = Check boundary conditions.
+
/// Returns 1 if the container is empty, otherwise returns 0.
/**
* Performs constant time check to see if stack is empty.
*/
int is_empty (void) const;
+
/// Returns 1 if the container is full, otherwise returns 0.
/**
* Performs constant time check to see if stack is full.
*/
int is_full (void) const;
+
/// The number of items in the stack.
/**
* Constant time access to the current size of the stack.
*/
size_t size (void) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Size of the allocated data.
size_t size_;
+
/// Keeps track of the current top of stack.
size_t top_;
+
/// Holds the stack's contents.
T stack_[ACE_SIZE];
};
+
//----------------------------------------
+
template<class T> class ACE_Ordered_MultiSet;
template<class T> class ACE_Ordered_MultiSet_Iterator;
+
/**
* @class ACE_DNode
*
@@ -261,20 +312,29 @@ class ACE_DNode
{
friend class ACE_Ordered_MultiSet<T>;
friend class ACE_Ordered_MultiSet_Iterator<T>;
+
public:
+
/// This isn't necessary, but it keeps some compilers happy.
~ACE_DNode (void);
+
private:
+
// = Initialization methods
ACE_DNode (const T &i, ACE_DNode<T> *n = 0, ACE_DNode<T> *p = 0);
+
/// Pointer to next element in the list of {ACE_DNode}s.
ACE_DNode<T> *next_;
+
/// Pointer to previous element in the list of {ACE_DNode}s.
ACE_DNode<T> *prev_;
+
/// Current value of the item in this node.
T item_;
};
+
+
/**
* @class ACE_Unbounded_Stack
*
@@ -315,8 +375,10 @@ class ACE_Unbounded_Stack
{
public:
friend class ACE_Unbounded_Stack_Iterator<T>;
+
// Trait definition.
typedef ACE_Unbounded_Stack_Iterator<T> ITERATOR;
+
// = Initialization, assignment, and termination methods.
/// Initialize a new stack so that it is empty. Use user defined
/// allocation strategy if specified.
@@ -325,23 +387,28 @@ public:
* if provided.
*/
ACE_Unbounded_Stack (ACE_Allocator *the_allocator = 0);
+
/// The copy constructor (performs initialization).
/**
* Initialize this stack to be an exact copy of {s}.
*/
ACE_Unbounded_Stack (const ACE_Unbounded_Stack<T> &s);
+
/// Assignment operator (performs assignment).
/**
* Perform a deep copy of the rhs into the lhs.
*/
void operator= (const ACE_Unbounded_Stack<T> &s);
+
/// Perform actions needed when stack goes out of scope.
/**
* Destroy the underlying list for the stack.
*/
~ACE_Unbounded_Stack (void);
+
// = Classic Stack operations.
+
///Push an element onto the top of stack.
/**
* Place a new item on top of the stack. Returns -1 if the stack
@@ -349,6 +416,7 @@ public:
* failure occurs.
*/
int push (const T &new_item);
+
///Pop the top element of the stack.
/**
* Remove and return the top stack item. Returns -1 if the stack is
@@ -356,6 +424,7 @@ public:
* failure occurs.
*/
int pop (T &item);
+
///Examine the top of the stack.
/**
* Return top stack item without removing it. Returns -1 if the
@@ -363,18 +432,23 @@ public:
* -1 if failure occurs.
*/
int top (T &item) const;
+
// = Check boundary conditions.
+
/// Returns 1 if the container is empty, otherwise returns 0.
/**
* Constant time check to see if the stack is empty.
*/
int is_empty (void) const;
+
/// Returns 1 if the container is full, otherwise returns 0.
/**
* Always resturns 0 since the stack is unbounded.
*/
int is_full (void) const;
+
// = Auxiliary methods (not strictly part of the Stack ADT).
+
///Linear Insert of an item.
/**
* Insert {new_item} into the Stack at the head (but doesn't allow
@@ -382,38 +456,49 @@ public:
* present (i.e., no duplicates are allowed), else 0.
*/
int insert (const T &new_item);
+
/// Remove @a item from the Stack. Returns 0 if it removes the item,
/// -1 if it can't find the item, and -1 if a failure occurs.
/**
* Linear remove operation.
*/
int remove (const T &item);
+
/// Finds if @a item occurs the set. Returns 0 if finds, else -1.
/**
* Linear find operation.
*/
int find (const T &item) const;
+
/// The number of items in the stack.
/**
* Constant time access to the current stack size.
*/
size_t size (void) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Delete all the nodes in the stack.
void delete_all_nodes (void);
+
/// Copy all nodes from {s} to {this}.
void copy_all_nodes (const ACE_Unbounded_Stack<T> &s);
+
/// Head of the linked list of Nodes.
ACE_Node<T> *head_;
+
/// Current size of the stack.
size_t cur_size_;
+
/// Allocation strategy of the stack.
ACE_Allocator *allocator_;
};
+
/**
* @class ACE_Unbounded_Stack_Iterator
*
@@ -426,30 +511,41 @@ public:
// = Initialization method.
/// Move to the first element in the {stack}.
ACE_Unbounded_Stack_Iterator (ACE_Unbounded_Stack<T> &stack);
+
// = Iteration methods.
+
/// Pass back the @a next_item that hasn't been seen in the Stack.
/// Returns 0 when all items have been seen, else 1.
int next (T *&next_item);
+
/// Move forward by one element in the Stack. Returns 0 when all the
/// items in the Stack have been seen, else 1.
int advance (void);
+
/// Move to the first element in the Stack. Returns 0 if the
/// Stack is empty, else 1.
int first (void);
+
/// Returns 1 when all items have been seen, else 0.
int done (void) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Pointer to the current node in the iteration.
ACE_Node<T> *current_;
+
/// Pointer to the Stack we're iterating over.
ACE_Unbounded_Stack<T> &stack_;
};
+
template <class T>
class ACE_Double_Linked_List;
+
/**
* @class ACE_Double_Linked_List_Iterator_Base
*
@@ -461,19 +557,24 @@ class ACE_Double_Linked_List_Iterator_Base
{
public:
// = Iteration methods.
+
/// Passes back the {entry} under the iterator. Returns 0 if the
/// iteration has completed, otherwise 1
int next (T *&) const;
+
/**
* @deprecated Return the address of next (current) unvisited item in
* the list. 0 if there is no more element available.
*/
T *next (void) const;
+
/// Returns 1 when all items have been seen, else 0.
int done (void) const;
+
/// STL-like iterator dereference operator: returns a reference
/// to the node underneath the iterator.
T & operator* (void) const ;
+
/**
* Retasks the iterator to iterate over a new
* Double_Linked_List. This allows clients to reuse an iterator
@@ -483,16 +584,21 @@ public:
* iterator changes. @@ Here be dragons. Comments?
*/
void reset (ACE_Double_Linked_List<T> &);
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
// = Initialization methods.
+
/// Constructor
ACE_Double_Linked_List_Iterator_Base (const ACE_Double_Linked_List<T> &);
+
/// Copy constructor.
ACE_Double_Linked_List_Iterator_Base (const
ACE_Double_Linked_List_Iterator_Base<T>
&iter);
+
// = Iteration methods.
/**
* Move to the first element of the list. Returns 0 if the list is
@@ -501,9 +607,11 @@ protected:
* first element is actually the 2n'd entry
*/
int go_head (void);
+
/// Move to the last element of the list. Returns 0 if the list is
/// empty, else 1.
int go_tail (void);
+
/**
* Check if we reach the end of the list. Can also be used to get
* the *current* element in the list. Return the address of the
@@ -511,18 +619,24 @@ protected:
* of element.
*/
T *not_done (void) const ;
+
/// Advance to the next element in the list. Return the address of the
/// next element if there are more, 0 otherwise.
T *do_advance (void);
+
/// Retreat to the previous element in the list. Return the address
/// of the previous element if there are more, 0 otherwise.
T *do_retreat (void);
+
/// Dump the state of an object.
void dump_i (void) const;
+
/// Remember where we are.
T *current_;
+
const ACE_Double_Linked_List<T> *dllist_;
};
+
/**
* @class ACE_Double_Linked_List_Iterator
*
@@ -542,6 +656,7 @@ class ACE_Double_Linked_List_Iterator : public ACE_Double_Linked_List_Iterator_B
public:
// = Initialization method.
ACE_Double_Linked_List_Iterator (const ACE_Double_Linked_List<T> &);
+
/**
* Retasks the iterator to iterate over a new
* Double_Linked_List. This allows clients to reuse an iterator
@@ -552,12 +667,15 @@ public:
* @@ Here be dragons. Comments?
*/
void reset (ACE_Double_Linked_List<T> &);
+
/// Move to the first element in the list. Returns 0 if the
/// list is empty, else 1.
int first (void);
+
/// Move forward by one element in the list. Returns 0 when all the
/// items in the list have been seen, else 1.
int advance (void);
+
/**
* Advance the iterator while removing the original item from the
* list. Return a pointer points to the original (removed) item.
@@ -565,20 +683,28 @@ public:
* but return 0 (NULL) instead.
*/
T* advance_and_remove (bool dont_remove);
+
// = STL-style iteration methods
+
/// Prefix advance.
ACE_Double_Linked_List_Iterator<T> & operator++ (void);
+
/// Postfix advance.
ACE_Double_Linked_List_Iterator<T> operator++ (int);
+
/// Prefix reverse.
ACE_Double_Linked_List_Iterator<T> & operator-- (void);
+
/// Postfix reverse.
ACE_Double_Linked_List_Iterator<T> operator-- (int);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
};
+
/**
* @class ACE_Double_Linked_List_Reverse_Iterator
*
@@ -599,6 +725,7 @@ class ACE_Double_Linked_List_Reverse_Iterator : public ACE_Double_Linked_List_It
public:
// = Initialization method.
ACE_Double_Linked_List_Reverse_Iterator (ACE_Double_Linked_List<T> &);
+
/**
* Retasks the iterator to iterate over a new
* Double_Linked_List. This allows clients to reuse an iterator
@@ -609,12 +736,15 @@ public:
* @@ Here be dragons. Comments?
*/
void reset (ACE_Double_Linked_List<T> &);
+
/// Move to the first element in the list. Returns 0 if the
/// list is empty, else 1.
int first (void);
+
/// Move forward by one element in the list. Returns 0 when all the
/// items in the list have been seen, else 1.
int advance (void);
+
/**
* Advance the iterator while removing the original item from the
* list. Return a pointer points to the original (removed) item.
@@ -622,21 +752,29 @@ public:
* but return 0 (NULL) instead.
*/
T* advance_and_remove (bool dont_remove);
+
// = STL-style iteration methods
+
/// Prefix advance.
ACE_Double_Linked_List_Reverse_Iterator<T> & operator++ (void);
+
/// Postfix advance.
ACE_Double_Linked_List_Reverse_Iterator<T> operator++ (int);
+
/// Prefix reverse.
ACE_Double_Linked_List_Reverse_Iterator<T> & operator-- (void);
+
/// Postfix reverse.
ACE_Double_Linked_List_Reverse_Iterator<T> operator-- (int);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
};
+
/**
* @class ACE_Double_Linked_List
*
@@ -688,9 +826,11 @@ public:
friend class ACE_Double_Linked_List_Iterator_Base<T>;
friend class ACE_Double_Linked_List_Iterator<T>;
friend class ACE_Double_Linked_List_Reverse_Iterator<T>;
+
// Trait definition.
typedef ACE_Double_Linked_List_Iterator<T> ITERATOR;
typedef ACE_Double_Linked_List_Reverse_Iterator<T> REVERSE_ITERATOR;
+
// = Initialization and termination methods.
/// construction. Use user specified allocation strategy
/// if specified.
@@ -699,47 +839,57 @@ public:
* If none is specified, then use default allocation strategy.
*/
ACE_Double_Linked_List (ACE_Allocator *the_allocator = 0);
+
/// Copy constructor.
/**
* Create a double linked list that is a copy of the provided
* parameter.
*/
ACE_Double_Linked_List (const ACE_Double_Linked_List<T> &);
+
/// Assignment operator.
/**
* Perform a deep copy of the provided list by first deleting the nodes of the
* lhs and then copying the nodes of the rhs.
*/
void operator= (const ACE_Double_Linked_List<T> &);
+
/// Destructor.
/**
* Clean up the memory allocated for the nodes of the list.
*/
~ACE_Double_Linked_List (void);
+
// = Check boundary conditions.
+
/// Returns 1 if the container is empty, 0 otherwise.
/**
* Performs constant time check to determine if the list is empty.
*/
int is_empty (void) const;
+
/// The list is unbounded, so this always returns 0.
/**
* Since the list is unbounded, the method simply returns 0.
*/
int is_full (void) const;
+
// = Classic queue operations.
+
/// Adds @a new_item to the tail of the list. Returns the new item
/// that was inserted.
/**
* Provides constant time insertion at the end of the list structure.
*/
T *insert_tail (T *new_item);
+
/// Adds @a new_item to the head of the list.Returns the new item that
/// was inserted.
/**
* Provides constant time insertion at the head of the list.
*/
T *insert_head (T *new_item);
+
/// Removes the head of the list and returns a pointer to that item.
/**
* Removes and returns the first {item} in the list. Returns
@@ -747,6 +897,7 @@ public:
* This method will *not* free the internal node.
*/
T* delete_head (void);
+
/// Removes the tail of the list and returns a pointer to that item.
/**
* Removes and returns the last {item} in the list. Returns
@@ -754,7 +905,9 @@ public:
* empty. This method will *not* free the internal node.
*/
T *delete_tail (void);
+
// = Additional utility methods.
+
///Empty the list.
/**
* Reset the {ACE_Double_Linked_List} to be empty.
@@ -762,6 +915,7 @@ public:
* This operation will delete all items.
*/
void reset (void);
+
/// Get the {slot}th element in the set. Returns -1 if the element
/// isn't in the range {0..{size} - 1}, else 0.
/**
@@ -769,37 +923,45 @@ public:
* with the address of the node occupying that index.
*/
int get (T *&item, size_t slot = 0);
+
/// The number of items in the queue.
/**
* Constant time call to return the current size of the list.
*/
size_t size (void) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Use DNode address directly.
/**
* Constant time removal of an item from the list using it's address.
*/
int remove (T *n);
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
/// Delete all the nodes in the list.
/**
* Removes and deallocates memory for all of the list nodes.
*/
void delete_nodes (void);
+
/// Copy nodes from {rhs} into this list.
/**
* Copy the elements of the provided list by allocated new nodes and assigning
* them with the proper data.
*/
void copy_nodes (const ACE_Double_Linked_List<T> &rhs);
+
/// Setup header pointer. Called after we create the head node in ctor.
/**
* Initialize the head pointer so that the list has a dummy node.
*/
void init_head (void);
+
///Constant time insert a new item into the list structure.
/**
* Insert a @a new_item into the list. It will be added before
@@ -809,6 +971,7 @@ protected:
int insert_element (T *new_item,
int before = 0,
T *old_item = 0);
+
///Constant time delete an item from the list structure.
/**
* Remove @a item from the list. Return 0 if succeed, -1 otherwise.
@@ -818,18 +981,24 @@ protected:
* tries to remove the same node again.
*/
int remove_element (T *item);
+
/// Head of the circular double-linked list.
T *head_;
+
/// Size of this list.
size_t size_;
+
/// Allocation Strategy of the queue.
ACE_Allocator *allocator_;
};
+
template <class T> class ACE_DLList;
template <class T> class ACE_DLList_Iterator;
template <class T> class ACE_DLList_Reverse_Iterator;
+
typedef ACE_Double_Linked_List<ACE_DLList_Node> ACE_DLList_Base;
+
//typedef ACE_Double_Linked_List_Iterator <ACE_DLList_Node>
// ACE_DLList_Iterator_Base;
//typedef ACE_Double_Linked_List_Reverse_Iterator <ACE_DLList_Node>
@@ -841,6 +1010,7 @@ typedef ACE_Double_Linked_List<ACE_DLList_Node> ACE_DLList_Base;
// typedef'ing worked, but as per Carlos's reccomendation, I'm just
// replacing all references to the base classes with their actual
// type. Matt Braun (6/15/99)
+
/**
* @class ACE_DLList
*
@@ -864,25 +1034,31 @@ class ACE_DLList : public ACE_DLList_Base
friend class ACE_Double_Linked_List_Iterator<T>;
friend class ACE_DLList_Iterator<T>;
friend class ACE_DLList_Reverse_Iterator<T>;
+
public:
+
/// Delegates to ACE_Double_Linked_List.
void operator= (const ACE_DLList<T> &l);
+
/**
* @name Queue-like insert and delete methods
*/
//@{
+
/**
* Insert pointer for a new item at the tail of the list.
*
* @return Pointer to item inserted; 0 on error.
*/
T *insert_tail (T *new_item);
+
/**
* Insert pointer for a new item at the head of the list.
*
* @return Pointer to item inserted; 0 on error.
*/
T *insert_head (T *new_item);
+
/**
* Removes the item at the head of the list and returns its pointer.
*
@@ -890,6 +1066,7 @@ public:
* an error occurred, or the original pointer inserted was 0.
*/
T *delete_head (void);
+
/**
* Removes the item at the tail of the list and returns its pointer.
*
@@ -898,6 +1075,7 @@ public:
*/
T *delete_tail (void);
//@}
+
/**
* Provide random access to any item in the list.
*
@@ -909,10 +1087,13 @@ public:
* @retval -1 Error, most likely slot is outside the range of the list.
*/
int get (T *&item, size_t slot = 0);
+
/// Delegates to ACE_Double_Linked_List.
void dump (void) const;
+
/// Delegates to ACE_Double_Linked_List.
int remove (ACE_DLList_Node *n);
+
/**
* Constructor.
*
@@ -921,8 +1102,10 @@ public:
* list. If 0, ACE_Allocator::instance() is used.
*/
ACE_DLList (ACE_Allocator *the_allocator = 0);
+
/// Delegates to ACE_Double_Linked_List.
ACE_DLList (const ACE_DLList<T> &l);
+
/**
* Deletes all ACE_DLList_Node objects in the list starting from the head.
* No T objects referred to by the deleted ACE_DLList_Node objects are
@@ -939,6 +1122,7 @@ public:
*/
~ACE_DLList (void);
};
+
/**
* @class ACE_DLList_Iterator
*
@@ -951,11 +1135,15 @@ public:
template <class T>
class ACE_DLList_Iterator : public ACE_Double_Linked_List_Iterator <ACE_DLList_Node>
{
+
friend class ACE_DLList<T>;
friend class ACE_DLList_Node;
+
public:
+
// = Initialization method.
ACE_DLList_Iterator (ACE_DLList<T> &l);
+
/**
* Retasks the iterator to iterate over a new
* Double_Linked_List. This allows clients to reuse an iterator
@@ -966,19 +1154,23 @@ public:
* @@ Here be dragons. Comments?
*/
void reset (ACE_DLList<T> &l);
+
// = Iteration methods.
/// Move forward by one element in the list. Returns 0 when all the
/// items in the list have been seen, else 1.
int advance (void);
+
/// Pass back the {next_item} that hasn't been seen in the list.
/// Returns 0 when all items have been seen, else 1.
int next (T *&);
+
/**
* @deprecated Delegates to ACE_Double_Linked_List_Iterator, except that
* whereas the Double_Linked_List version of next returns the node, this next
* returns the contents of the node
*/
T *next (void) const;
+
/**
* Removes the current item (i.e., {next}) from the list.
* Note that DLList iterators do not support {advance_and_remove}
@@ -986,11 +1178,14 @@ public:
* release the element returned by it.
*/
int remove (void);
+
/// Delegates to ACE_Double_Linked_List_Iterator.
void dump (void) const;
+
private:
ACE_DLList<T> *list_;
};
+
/**
* @class ACE_DLList_Reverse_Iterator
*
@@ -1003,11 +1198,15 @@ private:
template <class T>
class ACE_DLList_Reverse_Iterator : public ACE_Double_Linked_List_Reverse_Iterator <ACE_DLList_Node>
{
+
friend class ACE_DLList<T>;
friend class ACE_DLList_Node;
+
public:
+
// = Initialization method.
ACE_DLList_Reverse_Iterator (ACE_DLList<T> &l);
+
/**
* Retasks the iterator to iterate over a new
* Double_Linked_List. This allows clients to reuse an iterator
@@ -1018,28 +1217,36 @@ public:
* @@ Here be dragons. Comments?
*/
void reset (ACE_DLList<T> &l);
+
// = Iteration methods.
/// Move forward by one element in the list. Returns 0 when all the
/// items in the list have been seen, else 1.
int advance (void);
+
/// Pass back the {next_item} that hasn't been seen in the list.
/// Returns 0 when all items have been seen, else 1.
int next (T *&);
+
/// @deprecated Delegates to ACE_Double_Linked_List_Iterator.
T *next (void) const;
+
/// Removes the current item (i.e., {next}) from the list.
/// Note that DLList iterators do not support {advance_and_remove}
/// directly (defined in its base class) and you will need to
/// release the element returned by it.
int remove (void);
+
/// Delegates to ACE_Double_Linked_List_Iterator.
void dump (void) const;
+
private:
ACE_DLList<T> *list_;
};
+
// Forward declaration.
template <class T, size_t ACE_SIZE>
class ACE_Fixed_Set;
+
/**
* @class ACE_Fixed_Set_Iterator_Base
*
@@ -1050,34 +1257,46 @@ class ACE_Fixed_Set_Iterator_Base
{
public:
// = Iteration methods.
+
/// Pass back the {next_item} that hasn't been seen in the Set.
/// Returns 0 when all items have been seen, else 1.
int next (T *&next_item);
+
/// Move forward by one element in the set. Returns 0 when all the
/// items in the set have been seen, else 1.
int advance (void);
+
/// Move to the first element in the set. Returns 0 if the
/// set is empty, else 1.
int first (void);
+
/// Returns 1 when all items have been seen, else 0.
int done (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
// = Initialization method.
ACE_Fixed_Set_Iterator_Base (ACE_Fixed_Set<T, ACE_SIZE> &s);
+
/// Set we are iterating over.
ACE_Fixed_Set<T, ACE_SIZE> &s_;
+
/// How far we've advanced over the set.
ssize_t next_;
+
/// The number of non free items that the iterator had pointed at.
size_t iterated_items_;
+
/// Dump the state of an object.
void dump_i (void) const;
+
/// Pass back the {next_item} that hasn't been seen in the Set.
/// Returns 0 when all items have been seen, else 1.
int next_i (T *&next_item);
};
+
/**
* @class ACE_Fixed_Set_Iterator
*
@@ -1092,22 +1311,29 @@ class ACE_Fixed_Set_Iterator : public ACE_Fixed_Set_Iterator_Base <T, ACE_SIZE>
public:
// = Initialization method.
ACE_Fixed_Set_Iterator (ACE_Fixed_Set<T, ACE_SIZE> &s);
+
// = Iteration methods.
+
/// Pass back the {next_item} that hasn't been seen in the Set.
/// Returns 0 when all items have been seen, else 1.
int next (T *&next_item);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Remove the item where the itearetor is located at.
/// Returns 1 if it removes a item, else 0.
/// Pass back the removed {item}.
int remove (T *&item);
+
/// STL-like iterator dereference operator: returns a reference
/// to the node underneath the iterator.
T & operator* (void);
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
};
+
/**
* @class ACE_Fixed_Set_Const_Iterator
*
@@ -1121,18 +1347,24 @@ class ACE_Fixed_Set_Const_Iterator : public ACE_Fixed_Set_Iterator_Base <T, ACE_
public:
// = Initialization method.
ACE_Fixed_Set_Const_Iterator (const ACE_Fixed_Set<T, ACE_SIZE> &s);
+
// = Iteration methods.
+
/// Pass back the {next_item} that hasn't been seen in the Set.
/// Returns 0 when all items have been seen, else 1.
int next (const T *&next_item);
+
/// Dump the state of an object.
void dump (void) const;
+
/// STL-like iterator dereference operator: returns a reference
/// to the node underneath the iterator.
const T & operator* (void) const ;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
};
+
/**
* @class ACE_Fixed_Set
*
@@ -1173,42 +1405,52 @@ public:
friend class ACE_Fixed_Set_Iterator_Base<T, ACE_SIZE>;
friend class ACE_Fixed_Set_Iterator<T, ACE_SIZE>;
friend class ACE_Fixed_Set_Const_Iterator<T, ACE_SIZE>;
+
// Trait definitions.
typedef ACE_Fixed_Set_Iterator<T, ACE_SIZE> ITERATOR;
typedef ACE_Fixed_Set_Const_Iterator<T, ACE_SIZE> CONST_ITERATOR;
+
// = Initialization and termination methods.
/// Default Constructor.
/**
* Creates an empy set
*/
ACE_Fixed_Set (void);
+
/// Copy constructor.
/**
* Initializes a set to be a copy of the set parameter.
*/
ACE_Fixed_Set (const ACE_Fixed_Set<T, ACE_SIZE> &);
+
/// Assignment operator.
/**
* Deep copy of one set to another.
*/
void operator= (const ACE_Fixed_Set<T, ACE_SIZE> &);
+
/// Destructor.
/**
* Destroys a set.
*/
~ACE_Fixed_Set (void);
+
// = Check boundary conditions.
+
/// Returns 1 if the container is empty, otherwise returns 0.
/**
* Performs constant time check to determine if a set is empty.
*/
int is_empty (void) const;
+
/// Returns 1 if the container is full, otherwise returns 0.
/**
* Performs a constant time check to see if the set is full.
*/
int is_full (void) const;
+
// = Classic unordered set operations.
+
///Linear time insertion of an item unique to the set.
/**
* Insert @a new_item into the set (doesn't allow duplicates).
@@ -1216,6 +1458,7 @@ public:
* 0.
*/
int insert (const T &new_item);
+
///Linear time removal operation of an item.
/**
* Remove first occurrence of {item} from the set. Returns 0 if
@@ -1223,37 +1466,47 @@ public:
* failure occurs. Removal doesn't reclaim memory for the @a item.
*/
int remove (const T &item);
+
/// Finds if @a item occurs in the set. Returns 0 if finds, else -1.
/**
* Performs a linear find operation for the specified @a item.
*/
int find (const T &item) const;
+
/// Size of the set.
/**
* Returns the current size of the set.
*/
size_t size (void) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Holds the contents of the set.
struct
{
/// Item in the set.
T item_;
+
/// Keeps track of whether this item is in use or not.
int is_free_;
} search_structure_[ACE_SIZE];
+
/// Current size of the set.
size_t cur_size_;
+
/// Maximum size of the set.
size_t max_size_;
};
+
// Forward declaration.
template <class T>
class ACE_Bounded_Set;
+
/**
* @class ACE_Bounded_Set_Iterator
*
@@ -1268,29 +1521,39 @@ class ACE_Bounded_Set_Iterator
public:
// = Initialization method.
ACE_Bounded_Set_Iterator (ACE_Bounded_Set<T> &s);
+
// = Iteration methods.
+
/// Pass back the {next_item} that hasn't been seen in the Set.
/// Returns 0 when all items have been seen, else 1.
int next (T *&next_item);
+
/// Move forward by one element in the set. Returns 0 when all the
/// items in the set have been seen, else 1.
int advance (void);
+
/// Move to the first element in the set. Returns 0 if the
/// set is empty, else 1.
int first (void);
+
/// Returns 1 when all items have been seen, else 0.
int done (void) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Set we are iterating over.
ACE_Bounded_Set<T> &s_;
+
/// How far we've advanced over the set.
ssize_t next_;
};
+
/**
* @class ACE_Bounded_Set
*
@@ -1333,12 +1596,15 @@ class ACE_Bounded_Set
{
public:
friend class ACE_Bounded_Set_Iterator<T>;
+
// Trait definition.
typedef ACE_Bounded_Set_Iterator<T> ITERATOR;
+
enum
{
DEFAULT_SIZE = 10
};
+
// = Initialization and termination methods.
/// Construct a Bounded_Set using the default size.
/**
@@ -1346,17 +1612,20 @@ public:
* specified by the DEFAULT_SIZE.
*/
ACE_Bounded_Set (void);
+
/// Construct a Bounded_Set with the provided sizeB.
/**
* Initialize the Bounded_Set to have a maximum size equal to the size
* parameter specified.
*/
ACE_Bounded_Set (size_t size);
+
/// Construct a Bounded_Set that is a copy of the provides Bounded_Set.
/**
* Initialize the Bounded_Set to be a copy of the Bounded_Set parameter.
*/
ACE_Bounded_Set (const ACE_Bounded_Set<T> &);
+
/// Assignment operator.
/**
* The assignment will make a deep copy of the Bounded_Set provided. If the
@@ -1364,26 +1633,32 @@ public:
* deleted and reallocated to accomadate the larger number of elements.
*/
void operator= (const ACE_Bounded_Set<T> &);
+
/// Destructor
/**
* Clean up the underlying dynamically allocated memory that is used by
* the Bounded_Set.
*/
~ACE_Bounded_Set (void);
+
// = Check boundary conditions.
+
/// Returns 1 if the container is empty, otherwise returns 0.
/**
* A constant time check is performed to determine if the Bounded_Set is
* empty.
*/
int is_empty (void) const;
+
/// Returns 1 if the container is full, otherwise returns 0.
/**
* Performs a constant time check to determine if the Bounded_Set is at
* capacity.
*/
int is_full (void) const;
+
// = Classic unordered set operations.
+
///Inserts a new element unique to the set.
/**
* Insert @a new_item into the set (doesn't allow duplicates) in linear
@@ -1392,6 +1667,7 @@ public:
* 0.
*/
int insert (const T &new_item);
+
///Finds the specified element and removes it from the set.
/**
* Remove first occurrence of @a item from the set. Returns 0 if it
@@ -1400,36 +1676,46 @@ public:
* memory associated with the removed item.
*/
int remove (const T &item);
+
/// Finds if @a item occurs in the set. Returns 0 if finds, else -1.
/**
* find preforms a linear search for {item} and returns 0 on successful
* find and -1 otherwise.
*/
int find (const T &item) const;
+
/// Size of the set.
/**
* Returns a size_t representing the current size of the set.
*/
size_t size (void) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
struct Search_Structure
{
/// Item in the set.
T item_;
+
/// Keeps track of whether this item is in use or not.
int is_free_;
};
+
/// Holds the contents of the set.
Search_Structure *search_structure_;
+
/// Current size of the set.
size_t cur_size_;
+
/// Maximum size of the set.
size_t max_size_;
};
+
/**
* @class ACE_Ordered_MultiSet_Iterator
*
@@ -1443,39 +1729,54 @@ class ACE_Ordered_MultiSet_Iterator
{
public:
friend class ACE_Ordered_MultiSet<T>;
+
// = Initialization method.
ACE_Ordered_MultiSet_Iterator (ACE_Ordered_MultiSet<T> &s);
+
// = Iteration methods.
+
/// Pass back the {next_item} that hasn't been seen in the ordered multiset.
/// Returns 0 when all items have been seen, else 1.
int next (T *&next_item) const;
+
/// Repositions the iterator at the first item in the ordered multiset
/// Returns 0 if the list is empty else 1.
int first (void);
+
/// Repositions the iterator at the last item in the ordered multiset
/// Returns 0 if the list is empty else 1.
int last (void);
+
/// Move forward by one element in the set. Returns 0 when all the
/// items in the set have been seen, else 1.
int advance (void);
+
/// Move backward by one element in the set. Returns 0 when all the
/// items in the set have been seen, else 1.
int retreat (void);
+
/// Returns 1 when all items have been seen, else 0.
int done (void) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Returns a reference to the internal element {this} is pointing to.
T& operator* (void);
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
+
/// Pointer to the current node in the iteration.
ACE_DNode<T> *current_;
+
/// Pointer to the set we're iterating over.
ACE_Ordered_MultiSet<T> &set_;
};
+
/**
* @class ACE_Ordered_MultiSet
*
@@ -1517,8 +1818,10 @@ class ACE_Ordered_MultiSet
{
public:
friend class ACE_Ordered_MultiSet_Iterator<T>;
+
// Trait definition.
typedef ACE_Ordered_MultiSet_Iterator<T> ITERATOR;
+
// = Initialization and termination methods.
/// Constructor. Use user specified allocation strategy
/// if specified.
@@ -1527,39 +1830,48 @@ public:
* default strategy.
*/
ACE_Ordered_MultiSet (ACE_Allocator *the_allocator = 0);
+
/// Copy constructor.
/**
* Initialize the set to be a copy of the provided set.
*/
ACE_Ordered_MultiSet (const ACE_Ordered_MultiSet<T> &);
+
/// Destructor.
/**
* Delete the nodes of the set.
*/
~ACE_Ordered_MultiSet (void);
+
/// Assignment operator.
/**
* Delete the nodes in lhs, and copy the nodes from the rhs.
*/
void operator= (const ACE_Ordered_MultiSet<T> &);
+
// = Check boundary conditions.
+
/// Returns 1 if the container is empty, otherwise returns 0.
/**
* Constant time check to determine if the set is empty.
*/
int is_empty (void) const;
+
/// Size of the set.
/**
* Constant time check to determine the size of the set.
*/
size_t size (void) const;
+
// = Classic unordered set operations.
+
/// Insert @a new_item into the ordered multiset.
/// Returns -1 if failures occur, else 0.
/**
* Linear time, order preserving insert into the set beginning at the head.
*/
int insert (const T &new_item);
+
///Linear time insert beginning at the point specified by the provided iterator.
/**
* Insert @a new_item into the ordered multiset, starting its search at
@@ -1568,12 +1880,14 @@ public:
* Returns -1 if failures occur, else 0.
*/
int insert (const T &new_item, ITERATOR &iter);
+
/// Remove first occurrence of @a item from the set. Returns 0 if
/// it removes the item, -1 if it can't find the item.
/**
* Linear time search operation which removes the item from the set if found .
*/
int remove (const T &item);
+
///Linear find operation.
/**
* Finds first occurrence of @a item in the multiset, using the iterator's
@@ -1582,16 +1896,21 @@ public:
* locate the node, it leaves the iterator alone and just returns -1.
*/
int find (const T &item, ITERATOR &iter) const;
+
/// Reset the ACE_Ordered_MultiSet to be empty.
/**
* Delete the nodes inside the set.
*/
void reset (void);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
+
/**
* Insert @a item, starting its search at the position given,
* and if successful updates the passed pointer to point to
@@ -1599,6 +1918,7 @@ private:
*/
int insert_from (const T &item, ACE_DNode<T> *start_position,
ACE_DNode<T> **new_position);
+
/**
* Looks for first occurance of @a item in the ordered set, using the
* passed starting position as a hint: if there is such an instance, it
@@ -1612,20 +1932,28 @@ private:
*/
int locate (const T &item, ACE_DNode<T> *start_position,
ACE_DNode<T> *&new_position) const;
+
/// Delete all the nodes in the Set.
void delete_nodes (void);
+
/// Copy nodes into this set.
void copy_nodes (const ACE_Ordered_MultiSet<T> &);
+
/// Head of the bilinked list of Nodes.
ACE_DNode<T> *head_;
+
/// Head of the bilinked list of Nodes.
ACE_DNode<T> *tail_;
+
/// Current size of the set.
size_t cur_size_;
+
/// Allocation strategy of the set.
ACE_Allocator *allocator_;
};
+
// ****************************************************************
+
/**
* @class ACE_Array
*
@@ -1665,9 +1993,13 @@ class ACE_Array : public ACE_Array_Base<T>
public:
// Define a "trait"
typedef T TYPE;
+
typedef ACE_Array_Iterator<T> ITERATOR;
+
// = Exceptions.
+
// = Initialization and termination methods.
+
/// Dynamically create an uninitialized array.
/**
* Initialize an empty array of the specified size using the provided
@@ -1675,6 +2007,7 @@ public:
*/
ACE_Array (size_t size = 0,
ACE_Allocator* alloc = 0);
+
/// Dynamically initialize the entire array to the {default_value}.
/**
* Initialize an array the given size placing the default_value in each index.
@@ -1682,6 +2015,7 @@ public:
ACE_Array (size_t size,
const T &default_value,
ACE_Allocator* alloc = 0);
+
///Copy constructor.
/**
* The copy constructor performs initialization by making an exact
@@ -1689,6 +2023,7 @@ public:
* return true.
*/
ACE_Array (const ACE_Array<T> &s);
+
///Assignment operator
/**
* Assignment operator performs an assignment by making an exact
@@ -1699,7 +2034,9 @@ public:
* reallocate a new {array_}, and then copy the contents of {s}.
*/
void operator= (const ACE_Array<T> &s);
+
// = Compare operators
+
///Equality comparison operator.
/**
* Compare this array with {s} for equality. Two arrays are equal
@@ -1707,6 +2044,7 @@ public:
* are equal.
*/
bool operator== (const ACE_Array<T> &s) const;
+
///Inequality comparison operator.
/**
* Compare this array with {s} for inequality such that {*this} !=
@@ -1715,16 +2053,22 @@ public:
*/
bool operator!= (const ACE_Array<T> &s) const;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Containers_T.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Containers_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Containers_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_CONTAINERS_T_H */
diff --git a/dep/ACE_wrappers/ace/Containers_T.inl b/dep/ACE_wrappers/ace/Containers_T.inl
index b28da9699cd..912c9df8bb8 100644
--- a/dep/ACE_wrappers/ace/Containers_T.inl
+++ b/dep/ACE_wrappers/ace/Containers_T.inl
@@ -1,19 +1,23 @@
// -*- C++ -*-
//
// $Id: Containers_T.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template <class T> ACE_INLINE int
ACE_Bounded_Stack<T>::is_empty (void) const
{
ACE_TRACE ("ACE_Bounded_Stack<T>::is_empty");
return this->top_ == 0;
}
+
template <class T> ACE_INLINE int
ACE_Bounded_Stack<T>::is_full (void) const
{
ACE_TRACE ("ACE_Bounded_Stack<T>::is_full");
return this->top_ >= this->size_;
}
+
template <class T> ACE_INLINE int
ACE_Bounded_Stack<T>::push (const T &new_item)
{
@@ -26,6 +30,7 @@ ACE_Bounded_Stack<T>::push (const T &new_item)
else
return -1;
}
+
template <class T> ACE_INLINE int
ACE_Bounded_Stack<T>::pop (T &item)
{
@@ -38,6 +43,7 @@ ACE_Bounded_Stack<T>::pop (T &item)
else
return -1;
}
+
template <class T> ACE_INLINE int
ACE_Bounded_Stack<T>::top (T &item) const
{
@@ -50,24 +56,29 @@ ACE_Bounded_Stack<T>::top (T &item) const
else
return -1;
}
+
template <class T> ACE_INLINE size_t
ACE_Bounded_Stack<T>::size (void) const
{
return this->size_;
}
+
//----------------------------------------
+
template <class T, size_t ACE_SIZE> ACE_INLINE int
ACE_Fixed_Stack<T, ACE_SIZE>::is_empty (void) const
{
ACE_TRACE ("ACE_Fixed_Stack<T, ACE_SIZE>::is_empty");
return this->top_ == 0;
}
+
template <class T, size_t ACE_SIZE> ACE_INLINE int
ACE_Fixed_Stack<T, ACE_SIZE>::is_full (void) const
{
ACE_TRACE ("ACE_Fixed_Stack<T, ACE_SIZE>::is_full");
return this->top_ >= this->size_;
}
+
template <class T, size_t ACE_SIZE> ACE_INLINE int
ACE_Fixed_Stack<T, ACE_SIZE>::push (const T &new_item)
{
@@ -80,6 +91,7 @@ ACE_Fixed_Stack<T, ACE_SIZE>::push (const T &new_item)
else
return -1;
}
+
template <class T, size_t ACE_SIZE> ACE_INLINE int
ACE_Fixed_Stack<T, ACE_SIZE>::pop (T &item)
{
@@ -92,6 +104,7 @@ ACE_Fixed_Stack<T, ACE_SIZE>::pop (T &item)
else
return -1;
}
+
template <class T, size_t ACE_SIZE> ACE_INLINE int
ACE_Fixed_Stack<T, ACE_SIZE>::top (T &item) const
{
@@ -104,17 +117,20 @@ ACE_Fixed_Stack<T, ACE_SIZE>::top (T &item) const
else
return -1;
}
+
template <class T, size_t ACE_SIZE> ACE_INLINE size_t
ACE_Fixed_Stack<T, ACE_SIZE>::size (void) const
{
return this->size_;
}
+
template <class T> ACE_INLINE int
ACE_Unbounded_Stack<T>::is_empty (void) const
{
// ACE_TRACE ("ACE_Unbounded_Stack<T>::is_empty");
return this->head_ == this->head_->next_;
}
+
template <class T> ACE_INLINE int
ACE_Unbounded_Stack<T>::top (T &item) const
{
@@ -127,80 +143,103 @@ ACE_Unbounded_Stack<T>::top (T &item) const
else
return -1;
}
+
template <class T> ACE_INLINE int
ACE_Unbounded_Stack<T>::is_full (void) const
{
ACE_TRACE ("ACE_Unbounded_Stack<T>::is_full");
return 0; // ???
}
+
template <class T> ACE_INLINE size_t
ACE_Unbounded_Stack<T>::size (void) const
{
return this->cur_size_;
}
+
// ---
+
// ---
+
template <class T, size_t ACE_SIZE> ACE_INLINE int
ACE_Fixed_Set<T, ACE_SIZE>::is_empty (void) const
{
ACE_TRACE ("ACE_Fixed_Set<T>::is_empty");
return this->cur_size_ == 0;
}
+
template <class T, size_t ACE_SIZE> ACE_INLINE int
ACE_Fixed_Set<T, ACE_SIZE>::is_full (void) const
{
ACE_TRACE ("ACE_Fixed_Set<T, ACE_SIZE>::is_full");
return this->cur_size_ == this->max_size_;
}
+
// ---
+
template <class T> ACE_INLINE int
ACE_Bounded_Set<T>::is_empty (void) const
{
ACE_TRACE ("ACE_Bounded_Set<T>::is_empty");
return this->cur_size_ == 0;
}
+
template <class T> ACE_INLINE int
ACE_Bounded_Set<T>::is_full (void) const
{
ACE_TRACE ("ACE_Bounded_Set<T>::is_full");
return this->cur_size_ == this->max_size_;
}
+
// --
+
template <class T> ACE_INLINE int
ACE_Ordered_MultiSet_Iterator<T>::first (void)
{
ACE_TRACE ("ACE_Ordered_MultiSet_Iterator<T>::first");
current_ = set_.head_;
+
return (current_ ? 1 : 0);
}
+
template <class T> ACE_INLINE int
ACE_Ordered_MultiSet_Iterator<T>::last (void)
{
ACE_TRACE ("ACE_Ordered_MultiSet_Iterator<T>::last");
current_ = set_.tail_;
+
return (current_ ? 1 : 0);
}
+
template <class T> ACE_INLINE int
ACE_Ordered_MultiSet_Iterator<T>::advance (void)
{
ACE_TRACE ("ACE_Ordered_MultiSet_Iterator<T>::advance");
+
current_ = current_ ? current_->next_ : 0;
+
return (current_ ? 1 : 0);
}
+
template <class T> ACE_INLINE int
ACE_Ordered_MultiSet_Iterator<T>::retreat (void)
{
ACE_TRACE ("ACE_Ordered_MultiSet_Iterator<T>::retreat");
+
current_ = current_ ? current_->prev_ : 0;
+
return (current_ ? 1 : 0);
}
+
template <class T> ACE_INLINE int
ACE_Ordered_MultiSet_Iterator<T>::done (void) const
{
ACE_TRACE ("ACE_Ordered_MultiSet_Iterator<T>::done");
+
return (current_ ? 0 : 1);
}
+
template <class T> ACE_INLINE void
ACE_Ordered_MultiSet_Iterator<T>::dump (void) const
{
@@ -209,26 +248,33 @@ ACE_Ordered_MultiSet_Iterator<T>::dump (void) const
#endif /* ACE_HAS_DUMP */
}
+
+
// --
+
template <class T> ACE_INLINE int
ACE_Ordered_MultiSet<T>::is_empty (void) const
{
ACE_TRACE ("ACE_Ordered_MultiSet<T>::is_empty");
return this->cur_size_ > 0 ? 0 : 1;
}
+
template <class T> ACE_INLINE size_t
ACE_Ordered_MultiSet<T>::size (void) const
{
// ACE_TRACE ("ACE_Ordered_MultiSet<T>::size");
return this->cur_size_;
}
+
// ****************************************************************
+
template <class T> ACE_INLINE
ACE_Array<T>::ACE_Array (size_t size,
ACE_Allocator *alloc)
: ACE_Array_Base<T> (size, alloc)
{
}
+
template <class T> ACE_INLINE
ACE_Array<T>::ACE_Array (size_t size,
const T &default_value,
@@ -236,34 +282,45 @@ ACE_Array<T>::ACE_Array (size_t size,
: ACE_Array_Base<T> (size, default_value, alloc)
{
}
+
// The copy constructor (performs initialization).
+
template <class T> ACE_INLINE
ACE_Array<T>::ACE_Array (const ACE_Array<T> &s)
: ACE_Array_Base<T> (s)
{
}
+
// Assignment operator (performs assignment).
+
template <class T> ACE_INLINE void
ACE_Array<T>::operator= (const ACE_Array<T> &s)
{
// Check for "self-assignment".
+
if (this != &s)
this->ACE_Array_Base<T>::operator= (s);
}
+
// Compare this array with <s> for inequality.
+
template <class T> ACE_INLINE bool
ACE_Array<T>::operator!= (const ACE_Array<T> &s) const
{
return !(*this == s);
}
+
// ****************************************************************
+
// ****************************************************************
+
template <class T> ACE_INLINE void
ACE_DLList<T>::operator= (const ACE_DLList<T> &l)
{
*(ACE_DLList_Base *) this = l;
}
+
template <class T> ACE_INLINE int
ACE_DLList<T>::get (T *&item, size_t index)
{
@@ -273,6 +330,7 @@ ACE_DLList<T>::get (T *&item, size_t index)
item = (T *) node->item_;
return result;
}
+
template <class T> ACE_INLINE void
ACE_DLList<T>::dump (void) const
{
@@ -280,6 +338,7 @@ ACE_DLList<T>::dump (void) const
ACE_DLList_Base::dump ();
#endif /* ACE_HAS_DUMP */
}
+
template <class T> ACE_INLINE int
ACE_DLList<T>::remove (ACE_DLList_Node *n)
{
@@ -289,21 +348,25 @@ ACE_DLList<T>::remove (ACE_DLList_Node *n)
ACE_DLList_Node);
return result;
}
+
template <class T> ACE_INLINE
ACE_DLList<T>::ACE_DLList (ACE_Allocator *alloc)
: ACE_DLList_Base (alloc)
{
}
+
template <class T> ACE_INLINE
ACE_DLList<T>::ACE_DLList (const ACE_DLList<T> &l)
: ACE_DLList_Base ((ACE_DLList<T> &) l)
{
}
+
template <class T> ACE_INLINE
ACE_DLList<T>::~ACE_DLList (void)
{
while (this->delete_head ()) ;
}
+
template <class T> ACE_INLINE int
ACE_DLList_Iterator<T>::remove (void)
{
@@ -311,18 +374,21 @@ ACE_DLList_Iterator<T>::remove (void)
this->ACE_Double_Linked_List_Iterator <ACE_DLList_Node>::advance ();
return list_->remove (temp);
}
+
template <class T> ACE_INLINE
ACE_DLList_Iterator<T>::ACE_DLList_Iterator (ACE_DLList<T> &l)
: ACE_Double_Linked_List_Iterator <ACE_DLList_Node> ((ACE_DLList_Base &)l),
list_ (&l)
{
}
+
template <class T> ACE_INLINE void
ACE_DLList_Iterator<T>::reset (ACE_DLList<T> &l)
{
list_ = &l;
this->ACE_Double_Linked_List_Iterator <ACE_DLList_Node>::reset ((ACE_DLList_Base &)l);
}
+
template <class T> ACE_INLINE int
ACE_DLList_Iterator<T>::next (T *&ptr)
{
@@ -332,17 +398,20 @@ ACE_DLList_Iterator<T>::next (T *&ptr)
ptr = (T *) temp->item_;
return temp ? 1 : 0;
}
+
template <class T> ACE_INLINE T *
ACE_DLList_Iterator<T>::next (void) const
{
ACE_DLList_Node *temp = ACE_Double_Linked_List_Iterator <ACE_DLList_Node>::next ();
return (T *) (temp ? temp->item_ : 0);
}
+
template <class T> ACE_INLINE int
ACE_DLList_Iterator<T>::advance (void)
{
return this->ACE_Double_Linked_List_Iterator <ACE_DLList_Node>::advance ();
}
+
template <class T> ACE_INLINE void
ACE_DLList_Iterator<T>::dump (void) const
{
@@ -351,6 +420,7 @@ ACE_DLList_Iterator<T>::dump (void) const
#endif /* ACE_HAS_DUMP */
}
+
template <class T> ACE_INLINE int
ACE_DLList_Reverse_Iterator<T>::remove (void)
{
@@ -358,23 +428,27 @@ ACE_DLList_Reverse_Iterator<T>::remove (void)
this->ACE_Double_Linked_List_Reverse_Iterator <ACE_DLList_Node>::advance ();
return list_->remove (temp);
}
+
template <class T> ACE_INLINE
ACE_DLList_Reverse_Iterator<T>::ACE_DLList_Reverse_Iterator (ACE_DLList<T> &l)
: ACE_Double_Linked_List_Reverse_Iterator <ACE_DLList_Node> ((ACE_DLList_Base &)l),
list_ (&l)
{
}
+
template <class T> ACE_INLINE void
ACE_DLList_Reverse_Iterator<T>::reset (ACE_DLList<T> &l)
{
list_ = &l;
this->ACE_Double_Linked_List_Reverse_Iterator <ACE_DLList_Node>::reset ((ACE_DLList_Base &)l);
}
+
template <class T> ACE_INLINE int
ACE_DLList_Reverse_Iterator<T>::advance (void)
{
return ACE_Double_Linked_List_Reverse_Iterator <ACE_DLList_Node>::advance ();
}
+
template <class T> ACE_INLINE int
ACE_DLList_Reverse_Iterator<T>::next (T *&ptr)
{
@@ -385,6 +459,7 @@ ACE_DLList_Reverse_Iterator<T>::next (T *&ptr)
ptr = (T *) temp->item_;
return 1;
}
+
template <class T> ACE_INLINE T *
ACE_DLList_Reverse_Iterator<T>::next (void) const
{
@@ -392,6 +467,7 @@ ACE_DLList_Reverse_Iterator<T>::next (void) const
return (T *) (temp ? temp->item_ : 0);
}
+
template <class T> ACE_INLINE void
ACE_DLList_Reverse_Iterator<T>::dump (void) const
{
@@ -399,4 +475,5 @@ ACE_DLList_Reverse_Iterator<T>::dump (void) const
ACE_Double_Linked_List_Reverse_Iterator <ACE_DLList_Node>::dump ();
#endif /* ACE_HAS_DUMP */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Copy_Disabled.cpp b/dep/ACE_wrappers/ace/Copy_Disabled.cpp
index d7180dffc58..92cc98cd1ef 100644
--- a/dep/ACE_wrappers/ace/Copy_Disabled.cpp
+++ b/dep/ACE_wrappers/ace/Copy_Disabled.cpp
@@ -5,15 +5,20 @@
*
* @author Carlos O'Ryan <coryan@uci.edu>
*/
+
#include "ace/Copy_Disabled.h"
+
ACE_RCSID (ace,
Copy_Disabled,
"$Id: Copy_Disabled.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_Copy_Disabled::ACE_Copy_Disabled (void)
{
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Copy_Disabled.h b/dep/ACE_wrappers/ace/Copy_Disabled.h
index d94e949d78e..4dd6c2216b5 100644
--- a/dep/ACE_wrappers/ace/Copy_Disabled.h
+++ b/dep/ACE_wrappers/ace/Copy_Disabled.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//===========================================================================
/**
* @file Copy_Disabled.h
@@ -8,14 +9,20 @@
* @author Carlos O'Ryan <coryan@uci.edu>
*/
//===========================================================================
+
#ifndef ACE_COPY_DISABLED_H
#define ACE_COPY_DISABLED_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Copy_Disabled
*
@@ -42,13 +49,18 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
class ACE_Export ACE_Copy_Disabled
{
public:
+
/// Default constructor
ACE_Copy_Disabled (void);
+
private:
ACE_Copy_Disabled (const ACE_Copy_Disabled &);
ACE_Copy_Disabled &operator= (const ACE_Copy_Disabled &);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
+
#endif /* ACE_COPY_DISABLED_H */
diff --git a/dep/ACE_wrappers/ace/Countdown_Time.cpp b/dep/ACE_wrappers/ace/Countdown_Time.cpp
index dd72a3d7fac..3b3eede4364 100644
--- a/dep/ACE_wrappers/ace/Countdown_Time.cpp
+++ b/dep/ACE_wrappers/ace/Countdown_Time.cpp
@@ -1,19 +1,24 @@
#include "ace/Countdown_Time.h"
#include "ace/OS_NS_sys_time.h"
+
ACE_RCSID (ace,
Countdown_Time,
"$Id: Countdown_Time.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_Countdown_Time::ACE_Countdown_Time (ACE_Time_Value *max_wait_time)
: max_wait_time_ (max_wait_time),
stopped_ (false)
{
this->start ();
}
+
ACE_Countdown_Time::~ACE_Countdown_Time (void)
{
this->stop ();
}
+
void
ACE_Countdown_Time::start (void)
{
@@ -23,17 +28,20 @@ ACE_Countdown_Time::start (void)
this->stopped_ = false;
}
}
+
bool
ACE_Countdown_Time::stopped (void) const
{
return stopped_;
}
+
void
ACE_Countdown_Time::stop (void)
{
if (this->max_wait_time_ != 0 && this->stopped_ == false)
{
ACE_Time_Value elapsed_time = ACE_OS::gettimeofday () - this->start_time_;
+
if (*this->max_wait_time_ > elapsed_time)
{
*this->max_wait_time_ -= elapsed_time;
@@ -47,11 +55,13 @@ ACE_Countdown_Time::stop (void)
this->stopped_ = true;
}
}
+
void
ACE_Countdown_Time::update (void)
{
this->stop ();
this->start ();
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Countdown_Time.h b/dep/ACE_wrappers/ace/Countdown_Time.h
index 42267584e60..cc76bed02f4 100644
--- a/dep/ACE_wrappers/ace/Countdown_Time.h
+++ b/dep/ACE_wrappers/ace/Countdown_Time.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Countdown_Time.h
@@ -8,15 +9,22 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_COUNTDOWN_TIME_H
#define ACE_COUNTDOWN_TIME_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Time_Value.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Countdown_Time
*
@@ -31,31 +39,43 @@ class ACE_Export ACE_Countdown_Time
public:
/// Cache the @a max_wait_time and call @c start().
ACE_Countdown_Time (ACE_Time_Value *max_wait_time);
+
/// Destructor, makes sure the max_wait_time that got passed as pointer
/// to the constructor is updated with the time elapsed.
~ACE_Countdown_Time (void);
+
/// Cache the current time and enter a start state.
void start (void);
+
/// Subtract the elapsed time from max_wait_time_ and enter a stopped
/// state.
void stop (void);
+
/// Calls stop and then start. max_wait_time_ is modified by the
/// call to stop.
void update (void);
+
/// Returns true if we've already been stopped, else false.
bool stopped (void) const;
+
private:
/// Maximum time we were willing to wait.
ACE_Time_Value *max_wait_time_;
+
/// Beginning of the start time.
ACE_Time_Value start_time_;
+
/// Keeps track of whether we've already been stopped.
bool stopped_;
+
// Prevent copying
ACE_Countdown_Time (const ACE_Countdown_Time &);
ACE_Countdown_Time &operator= (const ACE_Countdown_Time &);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
+
#endif /* ACE_COUNTDOWN_TIME_H */
diff --git a/dep/ACE_wrappers/ace/DEV.cpp b/dep/ACE_wrappers/ace/DEV.cpp
index 4b335a4fd61..7b4fb00f2b2 100644
--- a/dep/ACE_wrappers/ace/DEV.cpp
+++ b/dep/ACE_wrappers/ace/DEV.cpp
@@ -1,12 +1,19 @@
// $Id: DEV.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/DEV.h"
+
#include "ace/OS_NS_unistd.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/DEV.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace, DEV, "$Id: DEV.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_DEV)
+
void
ACE_DEV::dump (void) const
{
@@ -14,12 +21,16 @@ ACE_DEV::dump (void) const
ACE_TRACE ("ACE_DEV::dump");
#endif /* ACE_HAS_DUMP */
}
+
// This is the do-nothing constructor.
+
ACE_DEV::ACE_DEV (void)
{
ACE_TRACE ("ACE_DEV::ACE_DEV");
}
+
// Close the device
+
int
ACE_DEV::close (void)
{
@@ -28,5 +39,6 @@ ACE_DEV::close (void)
this->set_handle (ACE_INVALID_HANDLE);
return result;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/DEV.h b/dep/ACE_wrappers/ace/DEV.h
index 6cff2d16794..6a6a7419e37 100644
--- a/dep/ACE_wrappers/ace/DEV.h
+++ b/dep/ACE_wrappers/ace/DEV.h
@@ -1,4 +1,5 @@
/* -*- C++ -*- */
+
//=============================================================================
/**
* @file DEV.h
@@ -9,18 +10,24 @@
*/
//=============================================================================
+
#ifndef ACE_DEV_H
#define ACE_DEV_H
#include /**/ "ace/pre.h"
+
#include "ace/IO_SAP.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/DEV_Addr.h"
+
// The following is necessary since many C++ compilers don't support
// typedef'd types inside of classes used as formal template
// arguments... ;-(. Luckily, using the C++ preprocessor I can hide
// most of this nastiness!
+
#if defined (ACE_HAS_TEMPLATE_TYPEDEFS)
#define ACE_DEV_CONNECTOR ACE_DEV_Connector
#define ACE_DEV_STREAM ACE_DEV_IO
@@ -28,7 +35,9 @@
#define ACE_DEV_CONNECTOR ACE_DEV_Connector, ACE_DEV_Addr
#define ACE_DEV_STREAM ACE_DEV_IO, ACE_DEV_Addr
#endif /* ACE_TEMPLATE_TYPEDEFS */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_DEV
*
@@ -40,24 +49,31 @@ class ACE_Export ACE_DEV : public ACE_IO_SAP
public:
/// Close down the DEVICE
int close (void);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
/**
* Disable signal @a signum
* This is here to prevent Win32 from
* disabling SPIPE using socket calls
*/
int disable (int signum) const ;
+
protected:
/// Ensure that this class is an abstract base class
ACE_DEV (void);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/DEV.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_DEV_H */
diff --git a/dep/ACE_wrappers/ace/DEV.inl b/dep/ACE_wrappers/ace/DEV.inl
index c7e4e0a19b3..4d97a73d8e8 100644
--- a/dep/ACE_wrappers/ace/DEV.inl
+++ b/dep/ACE_wrappers/ace/DEV.inl
@@ -1,7 +1,9 @@
// -*- C++ -*-
//
// $Id: DEV.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE int
ACE_DEV::disable (int signum) const
{
@@ -12,4 +14,5 @@ ACE_DEV::disable (int signum) const
return ACE_IO_SAP::disable (signum) ;
#endif /* ACE_WIN32 */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/DEV_Addr.cpp b/dep/ACE_wrappers/ace/DEV_Addr.cpp
index 2cd36775308..73abb6568aa 100644
--- a/dep/ACE_wrappers/ace/DEV_Addr.cpp
+++ b/dep/ACE_wrappers/ace/DEV_Addr.cpp
@@ -1,52 +1,70 @@
// $Id: DEV_Addr.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/DEV_Addr.h"
#if !defined (__ACE_INLINE__)
#include "ace/DEV_Addr.inl"
#endif /* __ACE_INLINE__ */
+
#include "ace/Log_Msg.h"
#include "ace/OS_NS_string.h"
+
ACE_RCSID (ace,
DEV_Addr,
"$Id: DEV_Addr.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_DEV_Addr)
+
// Transform the current address into string format.
+
int
ACE_DEV_Addr::addr_to_string (ACE_TCHAR *s, size_t len) const
{
ACE_TRACE ("ACE_DEV_Addr::addr_to_string");
+
ACE_OS::strsncpy (s, this->devname_, len);
return 0;
}
+
// Return a pointer to the address.
+
void *
ACE_DEV_Addr::get_addr (void) const
{
ACE_TRACE ("ACE_DEV_Addr::get_addr");
+
return (void *) &this->devname_;
}
+
void
ACE_DEV_Addr::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_DEV_Addr::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("devname_ = %s"), this->devname_));
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
// Do nothing constructor.
+
ACE_DEV_Addr::ACE_DEV_Addr (void)
: ACE_Addr (AF_DEV, sizeof this->devname_)
{
ACE_TRACE ("ACE_DEV_Addr::ACE_DEV_Addr");
+
(void) ACE_OS::memset ((void *) &this->devname_,
0, sizeof this->devname_);
}
+
int
ACE_DEV_Addr::set (const ACE_DEV_Addr &sa)
{
this->base_set (sa.get_type (), sa.get_size ());
+
if (sa.get_type () == AF_ANY)
(void) ACE_OS::memset ((void *) &this->devname_,
0,
@@ -57,26 +75,35 @@ ACE_DEV_Addr::set (const ACE_DEV_Addr &sa)
ACE_DEV_Addr::DEVNAME_LENGTH);
return 0;
}
+
// Copy constructor.
+
ACE_DEV_Addr::ACE_DEV_Addr (const ACE_DEV_Addr &sa)
: ACE_Addr (AF_DEV, sizeof this->devname_)
{
ACE_TRACE ("ACE_DEV_Addr::ACE_DEV_Addr");
+
this->set (sa);
}
+
ACE_DEV_Addr::ACE_DEV_Addr (const ACE_TCHAR *devname)
: ACE_Addr (AF_DEV, sizeof this->devname_)
{
ACE_TRACE ("ACE_DEV_Addr::ACE_DEV_Addr");
+
this->set (devname);
}
+
ACE_DEV_Addr &
ACE_DEV_Addr::operator= (const ACE_DEV_Addr &sa)
{
ACE_TRACE ("ACE_DEV_Addr::operator=");
+
if (this != &sa)
this->set (sa);
+
return *this;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/DEV_Addr.h b/dep/ACE_wrappers/ace/DEV_Addr.h
index efb8ebcaf24..f658cb0207d 100644
--- a/dep/ACE_wrappers/ace/DEV_Addr.h
+++ b/dep/ACE_wrappers/ace/DEV_Addr.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file DEV_Addr.h
@@ -8,15 +9,22 @@
* @author Gerhard Lenzer and Douglas C. Schmidt
*/
//==========================================================================
+
#ifndef ACE_DEV_ADDR_H
#define ACE_DEV_ADDR_H
+
#include /**/ "ace/pre.h"
+
#include "ace/Addr.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/os_dirent.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_DEV_Addr
*
@@ -28,39 +36,56 @@ public:
// = Initialization methods.
/// Default constructor.
ACE_DEV_Addr (void);
+
/// Copy constructor.
ACE_DEV_Addr (const ACE_DEV_Addr &sa);
+
/// Acts like a copy constructor.
int set (const ACE_DEV_Addr &sa);
+
/// Create a ACE_DEV_Addr from a device name.
explicit ACE_DEV_Addr (const ACE_TCHAR *devname);
+
/// Create a ACE_Addr from a ACE_DEV pathname.
void set (const ACE_TCHAR *devname);
+
/// Assignment operator.
ACE_DEV_Addr &operator= (const ACE_DEV_Addr &);
+
/// Return a pointer to the address.
virtual void *get_addr (void) const;
+
/// Transform the current address into string format.
virtual int addr_to_string (ACE_TCHAR *addr, size_t) const;
+
/// Compare two addresses for equality.
bool operator == (const ACE_DEV_Addr &SAP) const;
+
/// Compare two addresses for inequality.
bool operator != (const ACE_DEV_Addr &SAP) const;
+
/// Return the path name used for the rendezvous point.
const ACE_TCHAR *get_path_name (void) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
enum { DEVNAME_LENGTH = MAXPATHLEN + 1 };
/// Name of the device.
ACE_TCHAR devname_[DEVNAME_LENGTH];
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/DEV_Addr.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_DEV_ADDR_H */
diff --git a/dep/ACE_wrappers/ace/DEV_Addr.inl b/dep/ACE_wrappers/ace/DEV_Addr.inl
index 523848f6572..5c1da68d7e7 100644
--- a/dep/ACE_wrappers/ace/DEV_Addr.inl
+++ b/dep/ACE_wrappers/ace/DEV_Addr.inl
@@ -1,37 +1,51 @@
// -*- C++ -*-
//
// $Id: DEV_Addr.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_string.h"
#include "ace/Global_Macros.h"
#include "ace/os_include/sys/os_socket.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE void
ACE_DEV_Addr::set (const ACE_TCHAR *devname)
{
ACE_TRACE ("ACE_DEV_Addr::set");
+
this->ACE_Addr::base_set
(AF_DEV, static_cast<int> (ACE_OS::strlen (devname)));
ACE_OS::strsncpy (this->devname_, devname, ACE_DEV_Addr::DEVNAME_LENGTH);
}
+
// Compare two addresses for equality.
+
ACE_INLINE bool
ACE_DEV_Addr::operator == (const ACE_DEV_Addr &sap) const
{
ACE_TRACE ("ACE_DEV_Addr::operator ==");
+
return ACE_OS::strcmp (this->devname_, sap.devname_) == 0;
}
+
// Compare two addresses for inequality.
+
ACE_INLINE bool
ACE_DEV_Addr::operator != (const ACE_DEV_Addr &sap) const
{
ACE_TRACE ("ACE_DEV_Addr::operator !=");
+
return !((*this) == sap); // This is lazy, of course... ;-).
}
+
// Return the path name used for the rendezvous point.
+
ACE_INLINE const ACE_TCHAR *
ACE_DEV_Addr::get_path_name (void) const
{
ACE_TRACE ("ACE_DEV_Addr::get_path_name");
+
return this->devname_;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/DEV_Connector.cpp b/dep/ACE_wrappers/ace/DEV_Connector.cpp
index a6ae6a64d2c..02763c95296 100644
--- a/dep/ACE_wrappers/ace/DEV_Connector.cpp
+++ b/dep/ACE_wrappers/ace/DEV_Connector.cpp
@@ -1,16 +1,23 @@
// $Id: DEV_Connector.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/DEV_Connector.h"
+
#include "ace/Handle_Ops.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/DEV_Connector.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID (ace,
DEV_Connector,
"$Id: DEV_Connector.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_DEV_Connector)
+
void
ACE_DEV_Connector::dump (void) const
{
@@ -18,10 +25,12 @@ ACE_DEV_Connector::dump (void) const
ACE_TRACE ("ACE_DEV_Connector::dump");
#endif /* ACE_HAS_DUMP */
}
+
ACE_DEV_Connector::ACE_DEV_Connector (void)
{
ACE_TRACE ("ACE_DEV_Connector::ACE_DEV_Connector");
}
+
int
ACE_DEV_Connector::connect (ACE_DEV_IO &new_io,
const ACE_DEV_Addr &remote_sap,
@@ -32,6 +41,7 @@ ACE_DEV_Connector::connect (ACE_DEV_IO &new_io,
int perms)
{
ACE_TRACE ("ACE_DEV_Connector::connect");
+
ACE_HANDLE handle = ACE::handle_timed_open (timeout,
remote_sap.get_path_name (),
flags, perms);
@@ -39,5 +49,6 @@ ACE_DEV_Connector::connect (ACE_DEV_IO &new_io,
new_io.addr_ = remote_sap; // class copy.
return handle == ACE_INVALID_HANDLE ? -1 : 0;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/DEV_Connector.h b/dep/ACE_wrappers/ace/DEV_Connector.h
index 34db1362889..565d7ae024a 100644
--- a/dep/ACE_wrappers/ace/DEV_Connector.h
+++ b/dep/ACE_wrappers/ace/DEV_Connector.h
@@ -1,4 +1,5 @@
/* -*- C++ -*- */
+
//=============================================================================
/**
* @file DEV_Connector.h
@@ -8,17 +9,22 @@
* @author Gerhard Lenzer and Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_DEV_CONNECTOR_H
#define ACE_DEV_CONNECTOR_H
#include /**/ "ace/pre.h"
+
#include "ace/DEV_IO.h"
#include "ace/Log_Msg.h"
#include "ace/os_include/os_fcntl.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_DEV_Connector
*
@@ -29,6 +35,7 @@ class ACE_Export ACE_DEV_Connector
public:
/// Default constructor.
ACE_DEV_Connector (void);
+
/**
* Actively connect and produce a @a new_io if things go well.
* The @a remote_sap is the address that we are trying to connect
@@ -53,6 +60,7 @@ public:
int reuse_addr = 0,
int flags = O_RDWR,
int perms = 0);
+
/**
* Actively connect and produce a @a new_io if things go well.
* The @a remote_sap is the address that we are trying to connect
@@ -77,20 +85,27 @@ public:
int reuse_addr = 0,
int flags = O_RDWR,
int perms = 0);
+
/// Resets any event associations on this handle
int reset_new_handle (ACE_HANDLE handle);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
// = Meta-type info
typedef ACE_DEV_Addr PEER_ADDR;
typedef ACE_DEV_IO PEER_STREAM;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/DEV_Connector.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_DEV_CONNECTOR_H */
diff --git a/dep/ACE_wrappers/ace/DEV_Connector.inl b/dep/ACE_wrappers/ace/DEV_Connector.inl
index f5a0f6d8e4e..924a4254791 100644
--- a/dep/ACE_wrappers/ace/DEV_Connector.inl
+++ b/dep/ACE_wrappers/ace/DEV_Connector.inl
@@ -1,8 +1,11 @@
// -*- C++ -*-
//
// $Id: DEV_Connector.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Creates a Local ACE_DEV.
+
ACE_INLINE
ACE_DEV_Connector::ACE_DEV_Connector (ACE_DEV_IO &new_io,
const ACE_DEV_Addr &remote_sap,
@@ -19,6 +22,7 @@ ACE_DEV_Connector::ACE_DEV_Connector (ACE_DEV_IO &new_io,
ACE_ERROR ((LM_ERROR, ACE_TEXT ("address %s, %p\n"),
remote_sap.get_path_name (), ACE_TEXT ("ACE_DEV_IO")));
}
+
ACE_INLINE int
ACE_DEV_Connector::reset_new_handle (ACE_HANDLE handle)
{
@@ -26,4 +30,5 @@ ACE_DEV_Connector::reset_new_handle (ACE_HANDLE handle)
// Nothing to do here since the handle is not a socket
return 0;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/DEV_IO.cpp b/dep/ACE_wrappers/ace/DEV_IO.cpp
index f0769e49b25..e3c92041f28 100644
--- a/dep/ACE_wrappers/ace/DEV_IO.cpp
+++ b/dep/ACE_wrappers/ace/DEV_IO.cpp
@@ -1,23 +1,33 @@
// $Id: DEV_IO.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/DEV_IO.h"
#include "ace/Log_Msg.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/DEV_IO.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace, DEV_IO, "$Id: DEV_IO.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_DEV_IO)
+
// Return the local endpoint address.
+
int
ACE_DEV_IO::get_local_addr (ACE_DEV_Addr &addr) const
{
ACE_TRACE ("ACE_DEV_IO::get_local_addr");
+
addr = this->addr_;
return 0;
}
+
// Return the address of the remotely connected peer (if there is
// one).
+
int
ACE_DEV_IO::get_remote_addr (ACE_DEV_Addr &addr) const
{
@@ -25,25 +35,31 @@ ACE_DEV_IO::get_remote_addr (ACE_DEV_Addr &addr) const
addr = this->addr_;
return 0;
}
+
void
ACE_DEV_IO::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_DEV_IO::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
this->addr_.dump ();
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
// Simple-minded do nothing constructor.
+
ACE_DEV_IO::ACE_DEV_IO (void)
{
ACE_TRACE ("ACE_DEV_IO::ACE_DEV_IO");
}
+
// Send N char *ptrs and int lengths. Note that the char *'s precede
// the ints (basically, an varargs version of writev). The count N is
// the *total* number of trailing arguments, *not* a couple of the
// number of tuple pairs!
+
ssize_t
ACE_DEV_IO::send (size_t n, ...) const
{
@@ -58,12 +74,15 @@ ACE_DEV_IO::send (size_t n, ...) const
iovec[total_tuples],
-1);
#endif /* !defined (ACE_HAS_ALLOCA) */
+
va_start (argp, n);
+
for (int i = 0; i < total_tuples; i++)
{
iovp[i].iov_base = va_arg (argp, char *);
iovp[i].iov_len = va_arg (argp, int);
}
+
ssize_t result = ACE_OS::writev (this->get_handle (), iovp, total_tuples);
#if !defined (ACE_HAS_ALLOCA)
delete [] iovp;
@@ -71,11 +90,13 @@ ACE_DEV_IO::send (size_t n, ...) const
va_end (argp);
return result;
}
+
// This is basically an interface to ACE_OS::readv, that doesn't use the
// struct iovec explicitly. The ... can be passed as an arbitrary
// number of (char *ptr, int len) tuples. However, the count N is the
// *total* number of trailing arguments, *not* a couple of the number
// of tuple pairs!
+
ssize_t
ACE_DEV_IO::recv (size_t n, ...) const
{
@@ -90,12 +111,15 @@ ACE_DEV_IO::recv (size_t n, ...) const
iovec[total_tuples],
-1);
#endif /* !defined (ACE_HAS_ALLOCA) */
+
va_start (argp, n);
+
for (int i = 0; i < total_tuples; i++)
{
iovp[i].iov_base = va_arg (argp, char *);
iovp[i].iov_len = va_arg (argp, int);
}
+
ssize_t result = ACE_OS::readv (this->get_handle (), iovp, total_tuples);
#if !defined (ACE_HAS_ALLOCA)
delete [] iovp;
@@ -103,5 +127,6 @@ ACE_DEV_IO::recv (size_t n, ...) const
va_end (argp);
return result;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/DEV_IO.h b/dep/ACE_wrappers/ace/DEV_IO.h
index a34339f1fd5..e19cfd35603 100644
--- a/dep/ACE_wrappers/ace/DEV_IO.h
+++ b/dep/ACE_wrappers/ace/DEV_IO.h
@@ -1,4 +1,5 @@
/* -*- C++ -*- */
+
//=============================================================================
/**
* @file DEV_IO.h
@@ -9,20 +10,28 @@
* @author Douglas C. Schmidt
*/
//=============================================================================
+
#ifndef ACE_DEV_IO_H
#define ACE_DEV_IO_H
#include /**/ "ace/pre.h"
+
#include "ace/DEV.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_STREAM_PIPES)
# include "ace/OS_NS_stropts.h"
#endif /* ACE_HAS_STREAM_PIPES */
+
#include "ace/os_include/os_stdio.h"
#include "ace/os_include/sys/os_uio.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Time_Value;
+
/**
* @class ACE_DEV_IO
*
@@ -32,16 +41,21 @@ class ACE_Export ACE_DEV_IO : public ACE_DEV
{
public:
friend class ACE_DEV_Connector;
+
/// Default constructor.
ACE_DEV_IO (void);
+
// = Various send operations.
/// send upto @a n bytes in @a buf.
ssize_t send (const void *buf, size_t n) const;
+
/// Recv upto @a n bytes in @a buf.
ssize_t recv (void *buf, size_t n) const;
+
/// Send n bytes, keep trying until n are sent.
ssize_t send_n (const void *buf,
size_t n) const;
+
/**
* @name I/O operations
*
@@ -84,30 +98,37 @@ public:
size_t n,
const ACE_Time_Value *timeout = 0,
size_t *bytes_transferred = 0) const;
+
#if defined (ACE_HAS_STREAM_PIPES)
/// Recv bytes via STREAM pipes using "band" mode.
ssize_t recv (ACE_Str_Buf *cntl,
ACE_Str_Buf *data,
int *band,
int *flags) const;
+
/// Send bytes via STREAM pipes using "band" mode.
ssize_t send (const ACE_Str_Buf *cntl,
const ACE_Str_Buf *data,
int band,
int flags) const;
+
/// Recv @a cntl and @a data via STREAM pipes.
ssize_t recv (ACE_Str_Buf *cntl,
ACE_Str_Buf *data,
int *flags) const;
+
/// Send @a cntl and @a data via STREAM pipes.
ssize_t send (const ACE_Str_Buf *cntl,
const ACE_Str_Buf *data,
int flags = 0) const;
#endif /* ACE_HAS_STREAM_PIPES */
+
/// Send iovecs via <::writev>.
ssize_t send (const iovec iov[], size_t n) const;
+
/// Recv iovecs via <::readv>.
ssize_t recv (iovec iov[], size_t n) const;
+
/**
* Send N char *ptrs and int lengths. Note that the char *'s
* precede the ints (basically, an varargs version of writev). The
@@ -115,6 +136,7 @@ public:
* couple of the number of tuple pairs!
*/
ssize_t send (size_t n, ...) const;
+
/**
* This is an interface to ::readv, that doesn't use the struct
* iovec explicitly. The ... can be passed as an arbitrary number
@@ -123,31 +145,42 @@ public:
* number of tuple pairs!
*/
ssize_t recv (size_t n, ...) const;
+
/// Send @a n bytes via Win32 WriteFile using overlapped I/O.
ssize_t send (const void *buf, size_t n, ACE_OVERLAPPED *overlapped) const;
+
/// Recv @a n bytes via Win32 ReadFile using overlapped I/O.
ssize_t recv (void *buf, size_t n, ACE_OVERLAPPED *overlapped) const;
+
/// Dump the state of an object.
void dump (void) const;
+
// = The following two methods are no-ops to keep the
// ACE_Connector happy.
/// Return the local endpoint address.
int get_local_addr (ACE_DEV_Addr &) const;
+
/// Return the address of the remotely connected peer (if there is
/// one).
int get_remote_addr (ACE_DEV_Addr &) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
// = Meta-type info
typedef ACE_DEV_Addr PEER_ADDR;
+
private:
/// Address of device we are connected to.
ACE_DEV_Addr addr_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/DEV_IO.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_DEV_IO_H */
diff --git a/dep/ACE_wrappers/ace/DEV_IO.inl b/dep/ACE_wrappers/ace/DEV_IO.inl
index ebb05bc586f..796d24e114a 100644
--- a/dep/ACE_wrappers/ace/DEV_IO.inl
+++ b/dep/ACE_wrappers/ace/DEV_IO.inl
@@ -1,21 +1,28 @@
// -*- C++ -*-
//
// $Id: DEV_IO.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_sys_uio.h"
#include "ace/OS_NS_unistd.h"
#include "ace/OS_Memory.h"
+
#include "ace/ACE.h"
+
// Send exactly N bytes from BUF to this device. Keeping trying until
// this many bytes are sent.
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE ssize_t
ACE_DEV_IO::send_n (const void *buf, size_t n) const
{
ACE_TRACE ("ACE_DEV_IO::send_n");
return ACE::write_n (this->get_handle (), buf, n);
}
+
// Receive exactly N bytes from this file into BUF. Keep trying until
// this many bytes are received.
+
ACE_INLINE ssize_t
ACE_DEV_IO::recv_n (void *buf,
size_t n,
@@ -25,6 +32,7 @@ ACE_DEV_IO::recv_n (void *buf,
ACE_TRACE ("ACE_DEV_IO::recv_n");
#if defined (ACE_WIN32)
ACE_UNUSED_ARG (timeout);
+
return ACE::read_n (this->get_handle (),
buf,
n,
@@ -37,30 +45,35 @@ ACE_DEV_IO::recv_n (void *buf,
bytes_transferred);
#endif /*ACE_WIN32*/
}
+
ACE_INLINE ssize_t
ACE_DEV_IO::send (const void *buf, size_t n) const
{
ACE_TRACE ("ACE_DEV_IO::send");
return ACE_OS::write (this->get_handle (), (const char *) buf, n);
}
+
ACE_INLINE ssize_t
ACE_DEV_IO::recv (void *buf, size_t n) const
{
ACE_TRACE ("ACE_DEV_IO::recv");
return ACE_OS::read (this->get_handle (), (char *) buf, n);
}
+
ACE_INLINE ssize_t
ACE_DEV_IO::send (const iovec iov[], size_t n) const
{
ACE_TRACE ("ACE_DEV_IO::send");
return ACE_OS::writev (this->get_handle (), iov, static_cast<int> (n));
}
+
ACE_INLINE ssize_t
ACE_DEV_IO::recv (iovec iov[], size_t n) const
{
ACE_TRACE ("ACE_DEV_IO::recv");
return ACE_OS::readv (this->get_handle (), iov, static_cast<int> (n));
}
+
ACE_INLINE ssize_t
ACE_DEV_IO::send (const void *buf, size_t n,
ACE_OVERLAPPED *overlapped) const
@@ -70,6 +83,7 @@ ACE_DEV_IO::send (const void *buf, size_t n,
(const char *) buf, n,
overlapped);
}
+
ACE_INLINE ssize_t
ACE_DEV_IO::recv (void *buf, size_t n,
ACE_OVERLAPPED *overlapped) const
@@ -78,6 +92,7 @@ ACE_DEV_IO::recv (void *buf, size_t n,
return ACE_OS::read (this->get_handle (), (char *) buf, n,
overlapped);
}
+
#if defined (ACE_HAS_STREAM_PIPES)
ACE_INLINE ssize_t
ACE_DEV_IO::recv (ACE_Str_Buf *cntl, ACE_Str_Buf *data, int *band, int *flags) const
@@ -85,18 +100,21 @@ ACE_DEV_IO::recv (ACE_Str_Buf *cntl, ACE_Str_Buf *data, int *band, int *flags) c
ACE_TRACE ("ACE_DEV_IO::recv");
return ACE_OS::getpmsg (this->get_handle (), (strbuf *) cntl, (strbuf *) data, band, flags);
}
+
ACE_INLINE ssize_t
ACE_DEV_IO::send (const ACE_Str_Buf *cntl, const ACE_Str_Buf *data, int band, int flags) const
{
ACE_TRACE ("ACE_DEV_IO::send");
return ACE_OS::putpmsg (this->get_handle (), (strbuf *) cntl, (strbuf *) data, band, flags);
}
+
ACE_INLINE ssize_t
ACE_DEV_IO::recv (ACE_Str_Buf *cntl, ACE_Str_Buf *data, int *flags) const
{
ACE_TRACE ("ACE_DEV_IO::recv");
return ACE_OS::getmsg (this->get_handle (), (strbuf *) cntl, (strbuf *) data, flags);
}
+
ACE_INLINE ssize_t
ACE_DEV_IO::send (const ACE_Str_Buf *cntl, const ACE_Str_Buf *data, int flags) const
{
@@ -104,4 +122,5 @@ ACE_DEV_IO::send (const ACE_Str_Buf *cntl, const ACE_Str_Buf *data, int flags) c
return ACE_OS::putmsg (this->get_handle (), (strbuf *) cntl, (strbuf *) data, flags);
}
#endif /* ACE_HAS_STREAM_PIPES */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/DLL.cpp b/dep/ACE_wrappers/ace/DLL.cpp
index 73d7f0459f5..43cfa2efa84 100644
--- a/dep/ACE_wrappers/ace/DLL.cpp
+++ b/dep/ACE_wrappers/ace/DLL.cpp
@@ -1,16 +1,23 @@
// $Id: DLL.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/DLL.h"
+
#include "ace/Log_Msg.h"
#include "ace/ACE.h"
#include "ace/DLL_Manager.h"
#include "ace/OS_NS_string.h"
#include "ace/OS_NS_dlfcn.h"
#include "ace/OS_NS_Thread.h"
+
#include <algorithm>
+
ACE_RCSID(ace, DLL, "$Id: DLL.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Default constructor. Also, by default, the object will be closed
// before it is destroyed.
+
ACE_DLL::ACE_DLL (bool close_handle_on_destruction)
: open_mode_ (0),
dll_name_ (0),
@@ -20,6 +27,7 @@ ACE_DLL::ACE_DLL (bool close_handle_on_destruction)
{
ACE_TRACE ("ACE_DLL::ACE_DLL (int)");
}
+
ACE_DLL::ACE_DLL (const ACE_DLL &rhs)
: open_mode_ (0),
dll_name_ (0),
@@ -28,6 +36,7 @@ ACE_DLL::ACE_DLL (const ACE_DLL &rhs)
error_ (0)
{
ACE_TRACE ("ACE_DLL::ACE_DLL (const ACE_DLL &)");
+
if (rhs.dll_name_
// This will automatically up the refcount.
&& this->open (rhs.dll_name_,
@@ -38,23 +47,30 @@ ACE_DLL::ACE_DLL (const ACE_DLL &rhs)
ACE_TEXT ("ACE_DLL::copy_ctor: error: %s\n"),
this->error ()));
}
+
// Assignment operator
+
ACE_DLL &
ACE_DLL::operator= (const ACE_DLL &rhs)
{
ACE_TRACE ("ACE_DLL::operator= (const ACE_DLL &)");
+
ACE_DLL tmp (rhs);
+
std::swap (this->open_mode_, tmp.open_mode_);
std::swap (this->dll_name_, tmp.dll_name_);
std::swap (this->close_handle_on_destruction_,
tmp.close_handle_on_destruction_);
std::swap (this->dll_handle_, tmp.dll_handle_);
std::swap (this->error_, tmp.error_);
+
return *this;
}
+
// If the library name and the opening mode are specified than on
// object creation the library is implicitly opened.
+
ACE_DLL::ACE_DLL (const ACE_TCHAR *dll_name,
int open_mode,
bool close_handle_on_destruction)
@@ -65,25 +81,31 @@ ACE_DLL::ACE_DLL (const ACE_TCHAR *dll_name,
error_ (0)
{
ACE_TRACE ("ACE_DLL::ACE_DLL");
+
if (this->open (dll_name, this->open_mode_, close_handle_on_destruction) != 0
&& ACE::debug ())
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("ACE_DLL::open: error calling open: %s\n"),
this->error ()));
}
+
// The library is closed before the class gets destroyed depending on
// the close_handle_on_destruction value specified which is stored in
// close_handle_on_destruction_.
+
ACE_DLL::~ACE_DLL (void)
{
ACE_TRACE ("ACE_DLL::~ACE_DLL");
+
this->close ();
+
// Normally delete()d in ACE_DLL::close(). However, that may not
// occur if full ACE_DLL initialization is interrupted due to errors
// (e.g. attempting to open a DSO/DLL that does not exist). Make
// sure this->dll_name_ is deallocated.
delete [] this->dll_name_;
}
+
// This method opens the library based on the mode specified using the
// ACE_SHLIB_HANDLE which is obtained on making the ACE_OS::dlopen call.
// The default mode is:
@@ -94,14 +116,17 @@ ACE_DLL::~ACE_DLL (void)
// object is first loaded.
// RTLD_GLOBAL The object symbols are made available for the
// relocation processing of any other object.
+
int
ACE_DLL::open (const ACE_TCHAR *dll_filename,
int open_mode,
bool close_handle_on_destruction)
{
ACE_TRACE ("ACE_DLL::open");
+
return open_i (dll_filename, open_mode, close_handle_on_destruction);
}
+
int
ACE_DLL::open_i (const ACE_TCHAR *dll_filename,
int open_mode,
@@ -109,7 +134,9 @@ ACE_DLL::open_i (const ACE_TCHAR *dll_filename,
ACE_SHLIB_HANDLE handle)
{
ACE_TRACE ("ACE_DLL::open_i");
+
this->error_ = 0;
+
if (!dll_filename)
{
if (ACE::debug ())
@@ -119,6 +146,7 @@ ACE_DLL::open_i (const ACE_TCHAR *dll_filename,
: this->dll_name_));
return -1;
}
+
if (this->dll_handle_)
{
// If we have a good handle and its the same name, just return.
@@ -127,50 +155,69 @@ ACE_DLL::open_i (const ACE_TCHAR *dll_filename,
else
this->close ();
}
+
if (!this->dll_name_)
this->dll_name_ = ACE::strnew (dll_filename);
+
this->open_mode_ = open_mode;
this->close_handle_on_destruction_ = close_handle_on_destruction;
+
this->dll_handle_ = ACE_DLL_Manager::instance()->open_dll (this->dll_name_,
this->open_mode_,
handle);
+
if (!this->dll_handle_)
this->error_ = 1;
+
return this->error_ ? -1 : 0;
}
+
// The symbol refernce of the name specified is obtained.
+
void *
ACE_DLL::symbol (const ACE_TCHAR *sym_name, int ignore_errors)
{
ACE_TRACE ("ACE_DLL::symbol");
+
this->error_ = 0;
+
void *sym = 0;
if (this->dll_handle_)
sym = this->dll_handle_->symbol (sym_name, ignore_errors);
+
if (!sym)
this->error_ = 1;
+
return sym;
}
+
// The library is closed using the ACE_SHLIB_HANDLE object, i.e., the
// shared object is now disassociated form the current process.
+
int
ACE_DLL::close (void)
{
ACE_TRACE ("ACE_DLL::close");
+
int retval = 0;
+
if (this->dll_handle_
&& this->close_handle_on_destruction_
&& this->dll_name_
&& (retval = ACE_DLL_Manager::instance ()->close_dll (this->dll_name_)) != 0)
this->error_ = 1;
+
// Even if close_dll() failed, go ahead and cleanup.
this->dll_handle_ = 0;
delete [] this->dll_name_;
this->dll_name_ = 0;
this->close_handle_on_destruction_ = false;
+
return retval;
}
+
// This method is used return the last error of a library operation.
+
ACE_TCHAR *
ACE_DLL::error (void) const
{
@@ -179,32 +226,43 @@ ACE_DLL::error (void) const
{
return ACE_OS::dlerror ();
}
+
return 0;
}
+
// Return the handle to the user either temporarily or forever, thus
// orphaning it. If 0 means the user wants the handle forever and if 1
// means the user temporarily wants to take the handle.
+
ACE_SHLIB_HANDLE
ACE_DLL::get_handle (int become_owner) const
{
ACE_TRACE ("ACE_DLL::get_handle");
+
ACE_SHLIB_HANDLE handle = ACE_SHLIB_INVALID_HANDLE;
+
if (this->dll_handle_)
handle = this->dll_handle_->get_handle (become_owner);
+
return handle;
}
+
// Set the handle for the DLL. By default, the object will be closed
// before it is destroyed.
+
int
ACE_DLL::set_handle (ACE_SHLIB_HANDLE handle,
bool close_handle_on_destruction)
{
ACE_TRACE ("ACE_DLL::set_handle");
+
// Create a unique name. Note that this name is only quaranteed
// to be unique for the life of this object.
ACE_TCHAR temp[ACE_UNIQUE_NAME_LEN];
ACE_OS::unique_name (this, temp, ACE_UNIQUE_NAME_LEN);
+
return this->open_i (temp, 1, close_handle_on_destruction, handle);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/DLL.h b/dep/ACE_wrappers/ace/DLL.h
index d374d46c640..a9700daafc0 100644
--- a/dep/ACE_wrappers/ace/DLL.h
+++ b/dep/ACE_wrappers/ace/DLL.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file DLL.h
@@ -8,17 +9,24 @@
* @author Kirthika Parameswaran <kirthika@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_DLL_H
#define ACE_DLL_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Global_Macros.h"
#include "ace/os_include/os_dlfcn.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_DLL_Handle;
+
/**
* @class ACE_DLL
*
@@ -35,6 +43,7 @@ class ACE_Export ACE_DLL
{
public:
// = Initialization and termination methods.
+
/**
* Default constructor. By default, the close() operation on the
* object will be invoked before it is destroyed.
@@ -46,9 +55,11 @@ public:
* For example, termination by ACE_DLL_Manager via ACE::fini().
*/
explicit ACE_DLL (bool close_handle_on_destruction = true);
+
/// Allow assignment
ACE_DLL& operator= (const ACE_DLL &rhs);
+
/**
* This constructor performs the actions of open() during construction.
* @param dll_name The name or path of the DLL to load.
@@ -71,8 +82,10 @@ public:
explicit ACE_DLL (const ACE_TCHAR *dll_name,
int open_mode = ACE_DEFAULT_SHLIB_MODE,
bool close_handle_on_destruction = true);
+
/// Copy constructor.
ACE_DLL (const ACE_DLL &);
+
/**
* This method opens and dynamically links a specified DLL.
* @param dll_name The filename or path of the DLL to load.
@@ -106,14 +119,17 @@ public:
int open (const ACE_TCHAR *dll_name,
int open_mode = ACE_DEFAULT_SHLIB_MODE,
bool close_handle_on_destruction = true);
+
/// Call to close the DLL object.
int close (void);
+
/**
* Called when the DLL object is destroyed -- invokes close() if the
* @a close_handle_on_destruction flag was set to non-zero in the
* constructor or open() method.
*/
~ACE_DLL (void);
+
/**
* Look up a named symbol in the DLL. DLL must be successfully opened
* before calling symbol().
@@ -125,10 +141,12 @@ public:
* in the DLL. Otherwise, returns 0.
*/
void *symbol (const ACE_TCHAR *symbol_name, int ignore_errors = 0);
+
/// Returns a pointer to a string explaining that an error occured. You
/// will need to consult the error log for the actual error string
/// returned by the OS.
ACE_TCHAR *error (void) const;
+
/**
* Return the handle to the caller. If @a become_owner is non-0 then
* caller assumes ownership of the handle and the ACE_DLL object
@@ -136,32 +154,44 @@ public:
* <close_handle_on_destruction> is set.
*/
ACE_SHLIB_HANDLE get_handle (int become_owner = 0) const;
+
/// Set the handle for the DLL object. By default, the close()
//operation on / the object will be invoked before it is destroyed.
int set_handle (ACE_SHLIB_HANDLE handle,
bool close_handle_on_destruction = true);
+
private:
+
int open_i (const ACE_TCHAR *dll_name,
int open_mode = ACE_DEFAULT_SHLIB_MODE,
bool close_handle_on_destruction = true,
ACE_SHLIB_HANDLE handle = 0);
+
//private:
public:
+
/// Open mode.
int open_mode_;
+
/// Keep track of the name of the loaded dll, so it can be used
/// to remove framework components, singletons that live in the dll,
/// prior to unloading the dll in the close() method.
ACE_TCHAR *dll_name_;
+
/// This flag keeps track of whether we should close the handle
/// automatically when the object is destroyed.
bool close_handle_on_destruction_;
+
ACE_DLL_Handle *dll_handle_;
+
/// Flag to record if the last operation had an error.
bool error_;
+
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
#endif /* ACE_DLL_H */
diff --git a/dep/ACE_wrappers/ace/DLL_Manager.cpp b/dep/ACE_wrappers/ace/DLL_Manager.cpp
index 6b8df486d12..9463aa5e1bc 100644
--- a/dep/ACE_wrappers/ace/DLL_Manager.cpp
+++ b/dep/ACE_wrappers/ace/DLL_Manager.cpp
@@ -1,8 +1,11 @@
// $Id: DLL_Manager.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/DLL_Manager.h"
+
#include "ace/Log_Msg.h"
#include "ace/ACE.h"
#include "ace/Framework_Component.h"
+
#include "ace/Lib_Find.h"
#include "ace/Object_Manager.h"
#include "ace/SString.h"
@@ -10,12 +13,17 @@
#include "ace/Guard_T.h"
#include "ace/OS_NS_dlfcn.h"
#include "ace/OS_NS_string.h"
+
ACE_RCSID (ace,
DLL_Manager,
"DLL_Manager.cpp,v 4.23 2003/11/05 23:30:46 shuston Exp")
+
/******************************************************************/
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
sig_atomic_t ACE_DLL_Handle::open_called_ = 0;
+
ACE_DLL_Handle::ACE_DLL_Handle (void)
: refcount_ (0),
dll_name_ (0),
@@ -23,18 +31,21 @@ ACE_DLL_Handle::ACE_DLL_Handle (void)
{
ACE_TRACE ("ACE_DLL_Handle::ACE_DLL_Handle");
}
+
ACE_DLL_Handle::~ACE_DLL_Handle (void)
{
ACE_TRACE ("ACE_DLL_Handle::~ACE_DLL_Handle");
this->close (1);
delete[] this->dll_name_;
}
+
const ACE_TCHAR *
ACE_DLL_Handle::dll_name (void) const
{
ACE_TRACE ("ACE_DLL_Handle::dll_name");
return this->dll_name_;
}
+
int
ACE_DLL_Handle::open (const ACE_TCHAR *dll_name,
int open_mode,
@@ -42,6 +53,7 @@ ACE_DLL_Handle::open (const ACE_TCHAR *dll_name,
{
ACE_TRACE ("ACE_DLL_Handle::open");
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, 0));
+
if (this->dll_name_)
{
// Once dll_name_ has been set, it can't be changed..
@@ -53,13 +65,16 @@ ACE_DLL_Handle::open (const ACE_TCHAR *dll_name,
ACE_TEXT ("tried to reopen %s with name %s\n"),
this->dll_name_,
dll_name));
+
return -1;
}
}
else
this->dll_name_ = ACE::strnew (dll_name);
+
if (!this->open_called_)
this->open_called_ = 1;
+
// If it hasn't been loaded yet, go ahead and do that now.
if (this->handle_ == ACE_SHLIB_INVALID_HANDLE)
{
@@ -85,9 +100,11 @@ ACE_DLL_Handle::open (const ACE_TCHAR *dll_name,
*/
ACE_Array<ACE_TString> dll_names;
dll_names.max_size (10); // Decent guess to avoid realloc later
+
#if defined (ACE_MUST_HELP_DLOPEN_SEARCH_PATH)
// Find out where the library is
ACE_TCHAR dll_pathname[MAXPATHLEN + 1];
+
// Transform the pathname into the appropriate dynamic link library
// by searching the ACE_LD_SEARCH_PATH.
ACE::ldfind (dll_name,
@@ -99,6 +116,7 @@ ACE_DLL_Handle::open (const ACE_TCHAR *dll_name,
#else
this->get_dll_names (dll_name, dll_names);
#endif
+
ACE_Array_Iterator<ACE_TString> name_iter (dll_names);
ACE_TString *name = 0;
while (name_iter.next (name))
@@ -106,6 +124,7 @@ ACE_DLL_Handle::open (const ACE_TCHAR *dll_name,
// The ACE_SHLIB_HANDLE object is obtained.
this->handle_ = ACE_OS::dlopen (name->c_str (),
open_mode);
+
if (ACE::debug ())
{
ACE_DEBUG ((LM_DEBUG,
@@ -118,8 +137,10 @@ ACE_DLL_Handle::open (const ACE_TCHAR *dll_name,
: ACE_TEXT ("failed")),
this->error()->c_str()));
}
+
if (this->handle_ != ACE_SHLIB_INVALID_HANDLE) // Good one?
break;
+
// If errno is ENOENT we just skip over this one,
// anything else - like an undefined symbol, for
// instance must be flagged here or the next error will
@@ -134,6 +155,7 @@ ACE_DLL_Handle::open (const ACE_TCHAR *dll_name,
name->c_str (),
errno,
this->error ()->c_str ()));
+
#if defined (AIX)
// AIX often puts the shared library file (most often named
// shr.o) inside an archive library. If this is an archive
@@ -147,6 +169,7 @@ ACE_DLL_Handle::open (const ACE_TCHAR *dll_name,
aix_pathname[name->length ()] = '\0';
ACE_OS::strcat (aix_pathname, ACE_TEXT ("(shr.o)"));
open_mode |= RTLD_MEMBER;
+
if (ACE::debug ())
{
ACE_DEBUG ((LM_DEBUG,
@@ -159,9 +182,11 @@ ACE_DLL_Handle::open (const ACE_TCHAR *dll_name,
: "failed"),
this->error()->c_str()));
}
+
this->handle_ = ACE_OS::dlopen (aix_pathname, open_mode);
if (this->handle_ != ACE_SHLIB_INVALID_HANDLE)
break;
+
// If errno is ENOENT we just skip over this one, anything
// else - like an undefined symbol, for instance
// must be flagged here or the next error will mask it.
@@ -176,10 +201,13 @@ ACE_DLL_Handle::open (const ACE_TCHAR *dll_name,
name->c_str (),
errno,
this->error ()->c_str ()));
+
}
#endif /* AIX */
+
name_iter.advance ();
}
+
if (this->handle_ == ACE_SHLIB_INVALID_HANDLE)
{
if (ACE::debug ())
@@ -188,11 +216,14 @@ ACE_DLL_Handle::open (const ACE_TCHAR *dll_name,
ACE_TEXT ("Invalid handle error: %s\n"),
this->dll_name_,
this->error ()->c_str ()));
+
return -1;
}
}
}
+
++this->refcount_;
+
if (ACE::debug ())
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("ACE (%P|%t) DLL_Handle::open - %s (%d), refcount=%d\n"),
@@ -202,17 +233,21 @@ ACE_DLL_Handle::open (const ACE_TCHAR *dll_name,
return 0;
}
+
int
ACE_DLL_Handle::close (int unload)
{
ACE_TRACE ("ACE_DLL_Handle::close");
+
int retval = 0;
ACE_SHLIB_HANDLE h = ACE_SHLIB_INVALID_HANDLE;
+
// Only hold the lock until it comes time to dlclose() the DLL. Closing
// the DLL can cause further shutdowns as DLLs and their dependents are
// unloaded.
{
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, 0));
+
// Since we don't actually unload the dll as soon as the refcount
// reaches zero, we need to make sure we don't decrement it below
// zero.
@@ -220,6 +255,7 @@ ACE_DLL_Handle::close (int unload)
--this->refcount_;
else
this->refcount_ = 0;
+
if (ACE::debug ())
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("ACE (%P|%t) DLL_Handle::close - ")
@@ -227,6 +263,7 @@ ACE_DLL_Handle::close (int unload)
this->dll_name_,
this->handle_,
this->refcount_));
+
if (this->refcount_ == 0 &&
this->handle_ != ACE_SHLIB_INVALID_HANDLE &&
unload == 1)
@@ -237,37 +274,45 @@ ACE_DLL_Handle::close (int unload)
ACE_TEXT ("Unloading %s (handle=%d)\n"),
this->dll_name_,
this->handle_));
+
// First remove any associated Framework Components.
ACE_Framework_Repository *frPtr= ACE_Framework_Repository::instance ();
if (frPtr)
{
frPtr->remove_dll_components (this->dll_name_);
}
+
h = this->handle_;
this->handle_ = ACE_SHLIB_INVALID_HANDLE;
}
} // Release lock_ here
+
if (h != ACE_SHLIB_INVALID_HANDLE)
{
retval = ACE_OS::dlclose (h);
+
if (retval != 0 && ACE::debug ())
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("ACE (%P|%t) DLL_Handle::close - ")
ACE_TEXT ("Failed with: \"%s\".\n"),
this->error ()->c_str ()));
}
+
return retval;
}
+
sig_atomic_t
ACE_DLL_Handle::refcount (void) const
{
return this->refcount_;
}
+
void *
ACE_DLL_Handle::symbol (const ACE_TCHAR *sym_name, int ignore_errors)
{
ACE_TRACE ("ACE_DLL_Handle::symbol");
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, 0));
+
ACE_Auto_Array_Ptr <ACE_TCHAR> auto_name (ACE::ldname (sym_name));
// handle_ can be invalid especially when ACE_DLL_Handle resigned ownership
// BTW. Handle lifecycle management is a little crazy in ACE
@@ -278,6 +323,7 @@ ACE_DLL_Handle::symbol (const ACE_TCHAR *sym_name, int ignore_errors)
#else
void *sym = ACE_OS::dlsym (this->handle_, auto_name.get ());
#endif
+
// Linux says that the symbol could be null and that it isn't an
// error. So you should check the error message also, but since
// null symbols won't do us much good anyway, let's still report
@@ -290,31 +336,38 @@ ACE_DLL_Handle::symbol (const ACE_TCHAR *sym_name, int ignore_errors)
ACE_TEXT (" failed with \"%s\".\n"),
auto_name.get (),
this->error ()->c_str ()));
+
return 0;
}
return sym;
}
return 0;
}
+
ACE_SHLIB_HANDLE
ACE_DLL_Handle::get_handle (int become_owner)
{
ACE_TRACE ("ACE_DLL_Handle::get_handle");
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, 0));
+
if (this->refcount_ == 0 && become_owner != 0)
{
if (ACE::debug ())
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("ACE (%P|%t) DLL_Handle::get_handle: ")
ACE_TEXT ("cannot become owner, refcount == 0.\n")));
+
return ACE_SHLIB_INVALID_HANDLE;
}
+
ACE_SHLIB_HANDLE handle = this->handle_;
+
if (become_owner != 0)
{
if (--this->refcount_ == 0)
this->handle_ = ACE_SHLIB_INVALID_HANDLE;
}
+
if (ACE::debug ())
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("ACE (%P|%t) ACE_DLL_Handle::get_handle: ")
@@ -322,9 +375,12 @@ ACE_DLL_Handle::get_handle (int become_owner)
this->handle_ == ACE_SHLIB_INVALID_HANDLE ?
ACE_TEXT ("invalid") : ACE_TEXT ("valid"),
this->refcount_));
+
return handle;
}
+
// This method is used return the last error of a library operation.
+
auto_ptr <ACE_TString>
ACE_DLL_Handle::error (void)
{
@@ -334,6 +390,7 @@ ACE_DLL_Handle::error (void)
(new ACE_TString (error ? error : ACE_TEXT ("no error")));
return str;
}
+
void
ACE_DLL_Handle::get_dll_names (const ACE_TCHAR *dll_name,
ACE_Array<ACE_TString> &try_names)
@@ -342,6 +399,7 @@ ACE_DLL_Handle::get_dll_names (const ACE_TCHAR *dll_name,
// proper prefixes and/or suffixes to the specified dll_name.
ACE_TString base (dll_name);
ACE_TString base_dir, base_file, base_suffix;
+
// 1. Separate the dll_name into the dir part and the file part. We
// only decorate the file part to determine the names to try loading.
ACE_TString::size_type pos = base.rfind (ACE_DIRECTORY_SEPARATOR_CHAR);
@@ -352,6 +410,7 @@ ACE_DLL_Handle::get_dll_names (const ACE_TCHAR *dll_name,
}
else
base_file = base;
+
// 2. Locate the file suffix, if there is one. Move the '.' and the
// suffix to base_suffix.
if ((pos = base_file.rfind (ACE_TEXT ('.'))) != ACE_TString::npos)
@@ -359,6 +418,7 @@ ACE_DLL_Handle::get_dll_names (const ACE_TCHAR *dll_name,
base_suffix = base_file.substr (pos);
base_file = base_file.substr (0, pos);
}
+
// 3. Build the combinations to try for this platform.
// Try these combinations:
// - name with decorator and platform's suffix appended (if not supplied)
@@ -382,6 +442,7 @@ ACE_DLL_Handle::get_dll_names (const ACE_TCHAR *dll_name,
#endif
ACE_TString suffix (ACE_DLL_SUFFIX);
ACE_TString prefix (ACE_DLL_PREFIX);
+
for (size_t i = 0; i < 5 && try_names.size () < try_names.max_size (); ++i)
{
ACE_TString try_this;
@@ -417,6 +478,7 @@ ACE_DLL_Handle::get_dll_names (const ACE_TCHAR *dll_name,
try_this = dll_name;
break;
}
+
if (try_this.length ())
{
try_names.size (j + 1);
@@ -425,14 +487,18 @@ ACE_DLL_Handle::get_dll_names (const ACE_TCHAR *dll_name,
}
return;
}
+
/******************************************************************/
+
// Pointer to the Singleton instance.
ACE_DLL_Manager *ACE_DLL_Manager::instance_ = 0;
+
ACE_DLL_Manager *
ACE_DLL_Manager::instance (int size)
{
ACE_TRACE ("ACE_DLL_Manager::instance");
+
if (ACE_DLL_Manager::instance_ == 0)
{
// Perform Double-Checked Locking Optimization.
@@ -445,17 +511,22 @@ ACE_DLL_Manager::instance (int size)
0);
}
}
+
return ACE_DLL_Manager::instance_;
}
+
void
ACE_DLL_Manager::close_singleton (void)
{
ACE_TRACE ("ACE_DLL_Manager::close_singleton");
+
ACE_MT (ACE_GUARD (ACE_Recursive_Thread_Mutex, ace_mon,
*ACE_Static_Object_Lock::instance ()));
+
delete ACE_DLL_Manager::instance_;
ACE_DLL_Manager::instance_ = 0;
}
+
ACE_DLL_Manager::ACE_DLL_Manager (int size)
: handle_vector_ (0),
current_size_ (0),
@@ -463,25 +534,30 @@ ACE_DLL_Manager::ACE_DLL_Manager (int size)
unload_policy_ (ACE_DLL_UNLOAD_POLICY_PER_DLL)
{
ACE_TRACE ("ACE_DLL_Manager::ACE_DLL_Manager");
+
if (this->open (size) != 0 && ACE::debug ())
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("ACE_DLL_Manager ctor failed to allocate ")
ACE_TEXT ("handle_vector_.\n")));
}
+
ACE_DLL_Manager::~ACE_DLL_Manager (void)
{
ACE_TRACE ("ACE_DLL_Manager::~ACE_DLL_Manager");
+
if (this->close () != 0 && ACE::debug ())
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("ACE_DLL_Manager dtor failed to close ")
ACE_TEXT ("properly.\n")));
}
+
ACE_DLL_Handle *
ACE_DLL_Manager::open_dll (const ACE_TCHAR *dll_name,
int open_mode,
ACE_SHLIB_HANDLE handle)
{
ACE_TRACE ("ACE_DLL_Manager::open_dll");
+
ACE_DLL_Handle *temp_handle = 0;
ACE_DLL_Handle *dll_handle = 0;
{
@@ -494,10 +570,12 @@ ACE_DLL_Manager::open_dll (const ACE_TCHAR *dll_name,
ACE_NEW_RETURN (temp_handle,
ACE_DLL_Handle,
0);
+
dll_handle = temp_handle;
}
}
}
+
if (dll_handle)
{
if (dll_handle->open (dll_name, open_mode, handle) != 0)
@@ -508,9 +586,11 @@ ACE_DLL_Manager::open_dll (const ACE_TCHAR *dll_name,
ACE_TEXT ("ACE_DLL_Manager::open_dll: Could not ")
ACE_TEXT ("open dll %s.\n"),
dll_name));
+
delete temp_handle;
return 0;
}
+
// Add the handle to the vector only if the dll is successfully
// opened.
if (temp_handle != 0)
@@ -520,36 +600,45 @@ ACE_DLL_Manager::open_dll (const ACE_TCHAR *dll_name,
++this->current_size_;
}
}
+
return dll_handle;
}
+
int
ACE_DLL_Manager::close_dll (const ACE_TCHAR *dll_name)
{
ACE_TRACE ("ACE_DLL_Manager::close_dll");
ACE_DLL_Handle *handle = 0;
+
{
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, 0));
handle = this->find_dll (dll_name);
}
+
if (handle)
{
return this->unload_dll (handle, 0);
}
+
return -1;
}
+
u_long
ACE_DLL_Manager::unload_policy (void) const
{
ACE_TRACE ("ACE_DLL_Manager::unload_policy");
return this->unload_policy_;
}
+
void
ACE_DLL_Manager::unload_policy (u_long unload_policy)
{
ACE_TRACE ("ACE_DLL_Manager::unload_policy");
ACE_MT (ACE_GUARD (ACE_Thread_Mutex, ace_mon, this->lock_));
+
u_long old_policy = this->unload_policy_;
this->unload_policy_ = unload_policy;
+
// If going from LAZY to EAGER or from PER_DLL to PER_PROCESS|EAGER,
// call close(1) on all the ACE_DLL_Handle objects with refcount == 0
// which will force those that are still loaded to be unloaded.
@@ -568,23 +657,30 @@ ACE_DLL_Manager::unload_policy (u_long unload_policy)
}
}
}
+
int
ACE_DLL_Manager::open (int size)
{
ACE_TRACE ("ACE_DLL_Manager::open");
+
ACE_DLL_Handle **temp = 0;
+
ACE_NEW_RETURN (temp,
ACE_DLL_Handle *[size],
-1);
+
this->handle_vector_ = temp;
this->total_size_ = size;
return 0;
}
+
int
ACE_DLL_Manager::close (void)
{
ACE_TRACE ("ACE_DLL_Manager::close");
+
int force_close = 1;
+
if (this->handle_vector_ != 0)
{
// Delete components in reverse order.
@@ -599,28 +695,34 @@ ACE_DLL_Manager::close (void)
delete s;
}
}
+
delete [] this->handle_vector_;
this->handle_vector_ = 0;
this->current_size_ = 0;
}
return 0;
}
+
ACE_DLL_Handle *
ACE_DLL_Manager::find_dll (const ACE_TCHAR *dll_name) const
{
ACE_TRACE ("ACE_DLL_Manager::find_dll");
+
for (int i = 0; i < this->current_size_; i++)
if (this->handle_vector_[i] &&
ACE_OS::strcmp (this->handle_vector_[i]->dll_name (), dll_name) == 0)
{
return this->handle_vector_[i];
}
+
return 0;
}
+
int
ACE_DLL_Manager::unload_dll (ACE_DLL_Handle *dll_handle, int force_unload)
{
ACE_TRACE ("ACE_DLL_Manager::unload_dll");
+
if (dll_handle)
{
int unload = force_unload;
@@ -637,6 +739,7 @@ ACE_DLL_Manager::unload_dll (ACE_DLL_Handle *dll_handle, int force_unload)
{
// Declare the type of the symbol:
typedef int (*dll_unload_policy)(void);
+
void * const unload_policy_ptr =
dll_handle->symbol (ACE_TEXT ("_get_dll_unload_policy"), 1);
#if defined (ACE_OPENVMS) && (!defined (__INITIAL_POINTER_SIZE) || (__INITIAL_POINTER_SIZE < 64))
@@ -646,8 +749,10 @@ ACE_DLL_Manager::unload_dll (ACE_DLL_Handle *dll_handle, int force_unload)
intptr_t const temp_p =
reinterpret_cast<intptr_t> (unload_policy_ptr);
#endif
+
dll_unload_policy const the_policy =
reinterpret_cast<dll_unload_policy> (temp_p);
+
if (the_policy != 0)
unload = ACE_BIT_DISABLED (the_policy (),
ACE_DLL_UNLOAD_POLICY_LAZY);
@@ -656,11 +761,13 @@ ACE_DLL_Manager::unload_dll (ACE_DLL_Handle *dll_handle, int force_unload)
ACE_DLL_UNLOAD_POLICY_LAZY);
}
}
+
if (dll_handle->close (unload) != 0)
{
if (ACE::debug ())
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("ACE_DLL_Manager::unload error.\n")));
+
return -1;
}
}
@@ -670,9 +777,12 @@ ACE_DLL_Manager::unload_dll (ACE_DLL_Handle *dll_handle, int force_unload)
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("ACE_DLL_Manager::unload_dll called with ")
ACE_TEXT ("null pointer.\n")));
+
return -1;
}
+
return 0;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/DLL_Manager.h b/dep/ACE_wrappers/ace/DLL_Manager.h
index aeeec3fa0ca..0e571b6c03a 100644
--- a/dep/ACE_wrappers/ace/DLL_Manager.h
+++ b/dep/ACE_wrappers/ace/DLL_Manager.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file DLL_Manager.h
@@ -8,23 +9,31 @@
* @author Don Hinton <dhinton@ieee.org>
*/
//=============================================================================
+
#ifndef ACE_DLL_MANAGER_H
#define ACE_DLL_MANAGER_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Auto_Ptr.h"
#include "ace/Containers_T.h"
#include "ace/SStringfwd.h"
#include "ace/os_include/os_dlfcn.h"
+
#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
# include "ace/Thread_Mutex.h"
#endif /* ACE_MT_SAFE */
+
#define ACE_DEFAULT_DLL_MANAGER_SIZE 1024
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_DLL_Handle
*
@@ -48,12 +57,16 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
class ACE_Export ACE_DLL_Handle
{
public:
+
/// Default construtor.
ACE_DLL_Handle (void);
+
/// Destructor.
~ACE_DLL_Handle (void);
+
/// Returns the name of the shared library (without prefixes or suffixes).
const ACE_TCHAR *dll_name () const;
+
/**
* This method opens and dynamically links @a dll_name. The default
* mode is <RTLD_LAZY>, which loads identifier symbols but not the
@@ -67,56 +80,72 @@ public:
int open (const ACE_TCHAR *dll_name,
int open_mode,
ACE_SHLIB_HANDLE handle);
+
/// Call to close the DLL object. If unload = 0, it only decrements
/// the refcount, but if unload = 1, then it will actually unload
/// the library when the refcount == 0;
int close (int unload = 0);
+
/// Return the current refcount.
sig_atomic_t refcount (void) const;
+
/// If @a symbol_name is in the symbol table of the DLL a pointer to
/// the @a symbol_name is returned. Otherwise, returns 0. Set the
/// ignore_errors flag to supress logging errors if symbol_name isn't
/// found. This is nice if you just want to probe a dll to see what's
/// available, since missing functions in that case aren't really errors.
void *symbol (const ACE_TCHAR *symbol_name, int ignore_errors = 0);
+
/**
* Return the handle to the caller. If @a become_owner is non-0 then
* caller assumes ownership of the handle so we decrement the retcount.
*/
ACE_SHLIB_HANDLE get_handle (int become_owner = 0);
+
private:
+
/// Returns a pointer to a string explaining why <symbol> or <open>
/// failed. This is used internal to print out the error to the log,
/// but since this object is shared, we can't store or return the error
/// to the caller.
auto_ptr <ACE_TString> error (void);
+
// Builds array of DLL names to try to dlopen, based on platform
// and configured DLL prefixes/suffixes.
// Returns the array of names to try in try_names.
void get_dll_names (const ACE_TCHAR *dll_name,
ACE_Array<ACE_TString> &try_names);
+
// Disallow copying and assignment since we don't handle them.
ACE_DLL_Handle (const ACE_DLL_Handle &);
void operator= (const ACE_DLL_Handle &);
+
private:
+
// Keep track of how many ACE_DLL objects have a reference to this
// dll.
sig_atomic_t refcount_;
+
/// Name of the shared library.
ACE_TCHAR *dll_name_;
+
/// Handle to the actual library loaded by the OS.
ACE_SHLIB_HANDLE handle_;
+
/// Keeps track of whether or not open() has ever been called. This
/// helps get around problem on Linux, and perhaps other OS's, that
/// seg-fault if dlerror() is called before the ld library has been
/// initialized by a call to dlopen().
static sig_atomic_t open_called_;
+
#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
/// Synchronization variable for the MT_SAFE Repository
ACE_Thread_Mutex lock_;
#endif /* ACE_MT_SAFE */
};
+
class ACE_Framework_Repository;
+
/**
* @class ACE_DLL_Manager
*
@@ -155,61 +184,87 @@ class ACE_Export ACE_DLL_Manager
public:
friend class ACE_Framework_Repository;
friend class ACE_Object_Manager;
+
enum
{
DEFAULT_SIZE = ACE_DEFAULT_DLL_MANAGER_SIZE
};
+
/// Return a unique instance
static ACE_DLL_Manager *instance (int size = ACE_DLL_Manager::DEFAULT_SIZE);
+
/// Factory for ACE_DLL_Handle objects. If one already exits,
/// its refcount is incremented.
ACE_DLL_Handle *open_dll (const ACE_TCHAR *dll_name,
int openmode,
ACE_SHLIB_HANDLE handle);
+
/// Close the underlying dll. Decrements the refcount.
int close_dll (const ACE_TCHAR *dll_name);
+
/// Returns the current per-process UNLOAD_POLICY.
u_long unload_policy (void) const;
+
/// Set the per-process UNLOAD_POLICY. If the policy is changed from
/// LAZY to EAGER, then it will also unload any dlls with zero
/// refcounts.
void unload_policy (u_long unload_policy);
+
protected:
+
/// Default constructor.
ACE_DLL_Manager (int size = ACE_DLL_Manager::DEFAULT_SIZE);
+
/// Destructor.
~ACE_DLL_Manager (void);
+
// Allocate handle_vector_.
int open (int size);
+
// Close all open dlls and deallocate memory.
int close (void);
+
// Find dll in handle_vector_.
ACE_DLL_Handle *find_dll (const ACE_TCHAR *dll_name) const;
+
// Applies strategy for unloading dll.
int unload_dll (ACE_DLL_Handle *dll_handle, int force_unload = 0);
+
private:
+
/// Close the singleton instance.
static void close_singleton (void);
+
// Disallow copying and assignment since we don't handle these.
ACE_DLL_Manager (const ACE_DLL_Manager &);
void operator= (const ACE_DLL_Manager &);
+
private:
+
/// Vector containing all loaded handle objects.
ACE_DLL_Handle **handle_vector_;
+
/// Current number of handles.
int current_size_;
+
/// Maximum number of handles.
int total_size_;
+
/// Unload strategy.
u_long unload_policy_;
+
/// Pointer to a process-wide ACE_DLL_Manager.
static ACE_DLL_Manager *instance_;
+
#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
/// Synchronization variable for the MT_SAFE Repository
ACE_Thread_Mutex lock_;
#endif /* ACE_MT_SAFE */
+
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
#endif /* ACE_DLL_MANAGER_H */
diff --git a/dep/ACE_wrappers/ace/Date_Time.cpp b/dep/ACE_wrappers/ace/Date_Time.cpp
index 5e265b6b04f..8b26d0dd925 100644
--- a/dep/ACE_wrappers/ace/Date_Time.cpp
+++ b/dep/ACE_wrappers/ace/Date_Time.cpp
@@ -1,8 +1,11 @@
// Date_Time.cpp
// $Id: Date_Time.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Date_Time.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Date_Time.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace, Date_Time, "$Id: Date_Time.cpp 80826 2008-03-04 14:51:23Z wotte $")
diff --git a/dep/ACE_wrappers/ace/Date_Time.h b/dep/ACE_wrappers/ace/Date_Time.h
index ed038f924f7..7e91549d2a5 100644
--- a/dep/ACE_wrappers/ace/Date_Time.h
+++ b/dep/ACE_wrappers/ace/Date_Time.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file Date_Time.h
@@ -9,15 +10,21 @@
*
*/
//==========================================================================
+
#ifndef ACE_DATE_TIME_H
#define ACE_DATE_TIME_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Time_Value;
+
/**
* @class ACE_Date_Time
*
@@ -28,8 +35,10 @@ class ACE_Export ACE_Date_Time
public:
/// Constructor initializes current time/date info.
ACE_Date_Time (void);
+
/// Constructor initializes with the given ACE_Time_Value
explicit ACE_Date_Time (const ACE_Time_Value& timevalue);
+
/// Constructor with init values, no check for validy
/// Set/get portions of ACE_Date_Time, no check for validity.
ACE_Date_Time (long day,
@@ -40,42 +49,61 @@ public:
long second = 0,
long microsec = 0,
long wday = 0);
+
/// Update to the current time/date.
void update (void);
+
/// Update to the given ACE_Time_Value
void update (const ACE_Time_Value& timevalue);
+
/// Get day.
long day (void) const;
+
/// Set day.
void day (long day);
+
/// Get month.
long month (void) const;
+
/// Set month.
void month (long month);
+
/// Get year.
long year (void) const;
+
/// Set year.
void year (long year);
+
/// Get hour.
long hour (void) const;
+
/// Set hour.
void hour (long hour);
+
/// Get minute.
long minute (void) const;
+
/// Set minute.
void minute (long minute);
+
/// Get second.
long second (void) const;
+
/// Set second.
void second (long second);
+
/// Get microsec.
long microsec (void) const;
+
/// Set microsec.
void microsec (long microsec);
+
/// Get weekday.
long weekday (void) const;
+
/// Set weekday.
void weekday (long wday);
+
private:
long day_;
long month_;
@@ -86,10 +114,13 @@ private:
long microsec_;
long wday_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Date_Time.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_DATE_TIME_H */
diff --git a/dep/ACE_wrappers/ace/Date_Time.inl b/dep/ACE_wrappers/ace/Date_Time.inl
index 0ff0bf275b2..d34807d83a4 100644
--- a/dep/ACE_wrappers/ace/Date_Time.inl
+++ b/dep/ACE_wrappers/ace/Date_Time.inl
@@ -1,11 +1,14 @@
// -*- C++ -*-
//
// $Id: Date_Time.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Global_Macros.h"
#include "ace/Time_Value.h"
#include "ace/OS_NS_sys_time.h"
#include "ace/OS_NS_time.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE void
ACE_Date_Time::update (const ACE_Time_Value& timevalue)
{
@@ -38,24 +41,29 @@ ACE_Date_Time::update (const ACE_Time_Value& timevalue)
this->wday_ = tm_time.tm_wday;
#endif /* ACE_HAS_WINCE */
}
+
ACE_INLINE void
ACE_Date_Time::update (void)
{
ACE_TRACE ("ACE_Date_Time::update");
+
update(ACE_OS::gettimeofday ());
}
+
ACE_INLINE
ACE_Date_Time::ACE_Date_Time (void)
{
ACE_TRACE ("ACE_Date_Time::ACE_Date_Time");
this->update ();
}
+
ACE_INLINE
ACE_Date_Time::ACE_Date_Time (const ACE_Time_Value& timevalue)
{
ACE_TRACE ("ACE_Date_Time::ACE_Date_Time: timevalue");
this->update (timevalue);
}
+
// Constructor with init values, no check for validy
ACE_INLINE
ACE_Date_Time::ACE_Date_Time (long day,
@@ -77,7 +85,9 @@ ACE_Date_Time::ACE_Date_Time (long day,
{
ACE_TRACE ("ACE_Date_Time::ACE_Date_Time");
}
+
// set/get portions of ACE_Date_Time, no check for validy
+
// get day
ACE_INLINE long
ACE_Date_Time::day (void) const
@@ -85,6 +95,7 @@ ACE_Date_Time::day (void) const
ACE_TRACE ("ACE_Date_Time::day");
return day_;
}
+
// set day
ACE_INLINE void
ACE_Date_Time::day (long day)
@@ -92,6 +103,7 @@ ACE_Date_Time::day (long day)
ACE_TRACE ("ACE_Date_Time::day");
day_ = day;
}
+
// get month
ACE_INLINE long
ACE_Date_Time::month (void) const
@@ -99,6 +111,7 @@ ACE_Date_Time::month (void) const
ACE_TRACE ("ACE_Date_Time::month");
return month_;
}
+
// set month
ACE_INLINE void
ACE_Date_Time::month (long month)
@@ -106,6 +119,7 @@ ACE_Date_Time::month (long month)
ACE_TRACE ("ACE_Date_Time::month");
month_ = month;
}
+
// get year
ACE_INLINE long
ACE_Date_Time::year (void) const
@@ -113,6 +127,7 @@ ACE_Date_Time::year (void) const
ACE_TRACE ("ACE_Date_Time::year");
return year_;
}
+
// set year
ACE_INLINE void
ACE_Date_Time::year (long year)
@@ -120,6 +135,7 @@ ACE_Date_Time::year (long year)
ACE_TRACE ("ACE_Date_Time::year");
year_ = year;
}
+
// get hour
ACE_INLINE long
ACE_Date_Time::hour (void) const
@@ -127,6 +143,7 @@ ACE_Date_Time::hour (void) const
ACE_TRACE ("ACE_Date_Time::hour");
return hour_;
}
+
// set hour
ACE_INLINE void
ACE_Date_Time::hour (long hour)
@@ -134,6 +151,7 @@ ACE_Date_Time::hour (long hour)
ACE_TRACE ("ACE_Date_Time::hour");
hour_ = hour;
}
+
// get minute
ACE_INLINE long
ACE_Date_Time::minute (void) const
@@ -141,6 +159,7 @@ ACE_Date_Time::minute (void) const
ACE_TRACE ("ACE_Date_Time::minute");
return minute_;
}
+
// set minute
ACE_INLINE void
ACE_Date_Time::minute (long minute)
@@ -148,6 +167,7 @@ ACE_Date_Time::minute (long minute)
ACE_TRACE ("ACE_Date_Time::minute");
minute_ = minute;
}
+
// get second
ACE_INLINE long
ACE_Date_Time::second (void) const
@@ -155,6 +175,7 @@ ACE_Date_Time::second (void) const
ACE_TRACE ("ACE_Date_Time::second");
return second_;
}
+
// set second
ACE_INLINE void
ACE_Date_Time::second (long second)
@@ -162,6 +183,7 @@ ACE_Date_Time::second (long second)
ACE_TRACE ("ACE_Date_Time::second");
second_ = second;
}
+
// get microsec
ACE_INLINE long
ACE_Date_Time::microsec (void) const
@@ -169,6 +191,7 @@ ACE_Date_Time::microsec (void) const
ACE_TRACE ("ACE_Date_Time::microsec");
return microsec_;
}
+
// set microsec
ACE_INLINE void
ACE_Date_Time::microsec (long microsec)
@@ -176,6 +199,7 @@ ACE_Date_Time::microsec (long microsec)
ACE_TRACE ("ACE_Date_Time::microsec");
microsec_ = microsec;
}
+
// get wday
ACE_INLINE long
ACE_Date_Time::weekday (void) const
@@ -183,6 +207,7 @@ ACE_Date_Time::weekday (void) const
ACE_TRACE ("ACE_Date_Time::weekday");
return wday_;
}
+
// set wday
ACE_INLINE void
ACE_Date_Time::weekday (long wday)
@@ -190,4 +215,5 @@ ACE_Date_Time::weekday (long wday)
ACE_TRACE ("ACE_Date_Time::weekday");
wday_ = wday;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Default_Constants.h b/dep/ACE_wrappers/ace/Default_Constants.h
index 81a5a8a46fe..9eefd496b9b 100644
--- a/dep/ACE_wrappers/ace/Default_Constants.h
+++ b/dep/ACE_wrappers/ace/Default_Constants.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Default_Constants.h
@@ -12,70 +13,90 @@
* This one is split from the famous OS.h
*/
//=============================================================================
+
#ifndef ACE_DEFAULT_CONSTANTS_H
#define ACE_DEFAULT_CONSTANTS_H
#include /**/ "ace/pre.h"
+
// Included just keep compilers that see #pragma dierctive first
// happy.
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
// Define the default constants for ACE. Many of these are used for
// the ACE tests and applications. You can change these values by
// defining the macros in your config.h file.
# if !defined (ACE_DEFAULT_CLOSE_ALL_HANDLES)
# define ACE_DEFAULT_CLOSE_ALL_HANDLES true
# endif /* ACE_DEFAULT_CLOSE_ALL_HANDLES */
+
// The maximum length for a fully qualified Internet name.
# if !defined(ACE_MAX_FULLY_QUALIFIED_NAME_LEN)
# define ACE_MAX_FULLY_QUALIFIED_NAME_LEN 256
# endif /* ACE_MAX_FULLY_QUALIFIED_NAME_LEN */
+
#if !defined (ACE_DEFAULT_PAGEFILE_POOL_BASE)
#define ACE_DEFAULT_PAGEFILE_POOL_BASE (void *) 0
#endif /* ACE_DEFAULT_PAGEFILE_POOL_BASE */
+
#if !defined (ACE_DEFAULT_PAGEFILE_POOL_SIZE)
#define ACE_DEFAULT_PAGEFILE_POOL_SIZE (size_t) 0x01000000
#endif /* ACE_DEFAULT_PAGEFILE_POOL_SIZE */
+
#if !defined (ACE_DEFAULT_PAGEFILE_POOL_CHUNK)
#define ACE_DEFAULT_PAGEFILE_POOL_CHUNK (size_t) 0x00010000
#endif /* ACE_DEFAULT_PAGEFILE_POOL_CHUNK */
+
#if !defined (ACE_DEFAULT_PAGEFILE_POOL_NAME)
#define ACE_DEFAULT_PAGEFILE_POOL_NAME ACE_TEXT ("Default_ACE_Pagefile_Memory_Pool")
#endif /* ACE_DEFAULT_PAGEFILE_POOL_NAME */
+
#if !defined (ACE_DEFAULT_MESSAGE_BLOCK_PRIORITY)
#define ACE_DEFAULT_MESSAGE_BLOCK_PRIORITY 0
#endif /* ACE_DEFAULT_MESSAGE_BLOCK_PRIORITY */
+
#if !defined (ACE_DEFAULT_SERVICE_REPOSITORY_SIZE)
#define ACE_DEFAULT_SERVICE_REPOSITORY_SIZE 1024
#endif /* ACE_DEFAULT_SERVICE_REPOSITORY_SIZE */
+
#if !defined (ACE_REACTOR_NOTIFICATION_ARRAY_SIZE)
#define ACE_REACTOR_NOTIFICATION_ARRAY_SIZE 1024
#endif /* ACE_REACTOR_NOTIFICATION_ARRAY_SIZE */
+
# if !defined (ACE_DEFAULT_TIMEOUT)
# define ACE_DEFAULT_TIMEOUT 5
# endif /* ACE_DEFAULT_TIMEOUT */
+
# if !defined (ACE_DEFAULT_BACKLOG)
# define ACE_DEFAULT_BACKLOG 5
# endif /* ACE_DEFAULT_BACKLOG */
+
# if !defined (ACE_DEFAULT_ASYNCH_BACKLOG)
# define ACE_DEFAULT_ASYNCH_BACKLOG 5
# endif /* ACE_DEFAULT_ASYNCH_BACKLOG */
+
# if !defined (ACE_DEFAULT_THREADS)
# define ACE_DEFAULT_THREADS 1
# endif /* ACE_DEFAULT_THREADS */
+
// The following 3 defines are used in the IP multicast and broadcast tests.
# if !defined (ACE_DEFAULT_BROADCAST_PORT)
# define ACE_DEFAULT_BROADCAST_PORT 20000
# endif /* ACE_DEFAULT_BROADCAST_PORT */
+
# if !defined (ACE_DEFAULT_MULTICAST_PORT)
# define ACE_DEFAULT_MULTICAST_PORT 20001
# endif /* ACE_DEFAULT_MULTICAST_PORT */
+
# if !defined (ACE_DEFAULT_MULTICAST_ADDR)
// This address MUST be within the range for host group addresses:
// 224.0.0.0 to 239.255.255.255.
# define ACE_DEFAULT_MULTICAST_ADDR "224.9.9.2"
# endif /* ACE_DEFAULT_MULTICAST_ADDR */
+
# if defined (ACE_HAS_IPV6)
# if !defined (ACE_DEFAULT_MULTICASTV6_ADDR)
// This address should be within the range for site-local addresses:
@@ -83,77 +104,98 @@
# define ACE_DEFAULT_MULTICASTV6_ADDR "ff05:0::ff01:1"
# endif /* ACE_DEFAULT_MULTICASTV6_ADDR */
# endif
+
// Default port number for HTTP.
# if !defined (ACE_DEFAULT_HTTP_SERVER_PORT)
# define ACE_DEFAULT_HTTP_SERVER_PORT 80
# endif /* ACE_DEFAULT_HTTP_SERVER_PORT */
+
// Used in many IPC_SAP tests
# if !defined (ACE_DEFAULT_SERVER_PORT)
# define ACE_DEFAULT_SERVER_PORT 20002
# endif /* ACE_DEFAULT_SERVER_PORT */
+
# if !defined (ACE_DEFAULT_HTTP_PORT)
# define ACE_DEFAULT_HTTP_PORT 80
# endif /* ACE_DEFAULT_HTTP_PORT */
+
# if !defined (ACE_DEFAULT_MAX_SOCKET_BUFSIZ)
# define ACE_DEFAULT_MAX_SOCKET_BUFSIZ 65536
# endif /* ACE_DEFAULT_MAX_SOCKET_BUFSIZ */
+
# if !defined (ACE_DEFAULT_SERVER_PORT_STR)
# define ACE_DEFAULT_SERVER_PORT_STR ACE_TEXT("20002")
# endif /* ACE_DEFAULT_SERVER_PORT_STR */
+
// Used for the Service_Directory test
# if !defined (ACE_DEFAULT_SERVICE_PORT)
# define ACE_DEFAULT_SERVICE_PORT 20003
# endif /* ACE_DEFAULT_SERVICE_PORT */
+
// Used for the ACE_Thread_Spawn test
# if !defined (ACE_DEFAULT_THR_PORT )
# define ACE_DEFAULT_THR_PORT 20004
# endif /* ACE_DEFAULT_THR_PORT */
+
// Used for <SOCK_Connect::connect> tests
# if !defined (ACE_DEFAULT_LOCAL_PORT)
# define ACE_DEFAULT_LOCAL_PORT 20005
# endif /* ACE_DEFAULT_LOCAL_PORT */
+
// Used for Connector tests
# if !defined (ACE_DEFAULT_LOCAL_PORT_STR)
# define ACE_DEFAULT_LOCAL_PORT_STR "20005"
# endif /* ACE_DEFAULT_LOCAL_PORT_STR */
+
// Used for the name server.
# if !defined (ACE_DEFAULT_NAME_SERVER_PORT)
# define ACE_DEFAULT_NAME_SERVER_PORT 20006
# endif /* ACE_DEFAULT_NAME_SERVER_PORT */
+
# if !defined (ACE_DEFAULT_NAME_SERVER_PORT_STR)
# define ACE_DEFAULT_NAME_SERVER_PORT_STR "20006"
# endif /* ACE_DEFAULT_NAME_SERVER_PORT_STR */
+
// Used for the token server.
# if !defined (ACE_DEFAULT_TOKEN_SERVER_PORT)
# define ACE_DEFAULT_TOKEN_SERVER_PORT 20007
# endif /* ACE_DEFAULT_TOKEN_SERVER_PORT */
+
# if !defined (ACE_DEFAULT_TOKEN_SERVER_PORT_STR)
# define ACE_DEFAULT_TOKEN_SERVER_PORT_STR "20007"
# endif /* ACE_DEFAULT_TOKEN_SERVER_PORT_STR */
+
// Used for the logging server.
# if !defined (ACE_DEFAULT_LOGGING_SERVER_PORT)
# define ACE_DEFAULT_LOGGING_SERVER_PORT 20008
# endif /* ACE_DEFAULT_LOGGING_SERVER_PORT */
+
# if !defined (ACE_DEFAULT_LOGGING_SERVER_PORT_STR)
# define ACE_DEFAULT_LOGGING_SERVER_PORT_STR "20008"
# endif /* ACE_DEFAULT_LOGGING_SERVER_PORT_STR */
+
// Used for the logging server.
# if !defined (ACE_DEFAULT_THR_LOGGING_SERVER_PORT)
# define ACE_DEFAULT_THR_LOGGING_SERVER_PORT 20008
# endif /* ACE_DEFAULT_THR_LOGGING_SERVER_PORT */
+
# if !defined (ACE_DEFAULT_THR_LOGGING_SERVER_PORT_STR)
# define ACE_DEFAULT_THR_LOGGING_SERVER_PORT_STR "20008"
# endif /* ACE_DEFAULT_THR_LOGGING_SERVER_PORT_STR */
+
// Used for the time server.
# if !defined (ACE_DEFAULT_TIME_SERVER_PORT)
# define ACE_DEFAULT_TIME_SERVER_PORT 20009
# endif /* ACE_DEFAULT_TIME_SERVER_PORT */
+
# if !defined (ACE_DEFAULT_TIME_SERVER_PORT_STR)
# define ACE_DEFAULT_TIME_SERVER_PORT_STR "20009"
# endif /* ACE_DEFAULT_TIME_SERVER_PORT_STR */
+
# if !defined (ACE_DEFAULT_TIME_SERVER_STR)
# define ACE_DEFAULT_TIME_SERVER_STR "ACE_TS_TIME"
# endif /* ACE_DEFAULT_TIME_SERVER_STR */
+
// Used by the FIFO tests and the Client_Logging_Handler netsvc.
# if !defined (ACE_DEFAULT_RENDEZVOUS)
# if defined (ACE_HAS_STREAM_PIPES)
@@ -162,22 +204,27 @@
# define ACE_DEFAULT_RENDEZVOUS ACE_TEXT("localhost:20010")
# endif /* ACE_HAS_STREAM_PIPES */
# endif /* ACE_DEFAULT_RENDEZVOUS */
+
// Used for the UNIX syslog logging interface to ACE_Log_Msg.
# ifndef ACE_DEFAULT_SYSLOG_FACILITY
# define ACE_DEFAULT_SYSLOG_FACILITY LOG_USER
# endif /* ACE_DEFAULT_SYSLOG_FACILITY */
+
# if !defined (ACE_DEFAULT_LOGGER_KEY)
+
# if defined (ACE_HAS_STREAM_PIPES)
# define ACE_DEFAULT_LOGGER_KEY ACE_TEXT ("/tmp/server_daemon")
# else
# define ACE_DEFAULT_LOGGER_KEY ACE_TEXT ("localhost:20012")
# endif /* ACE_HAS_STREAM_PIPES */
# endif /* ACE_DEFAULT_LOGGER_KEY */
+
// The way to specify the local host for loopback IP. This is usually
// "localhost" but it may need changing on some platforms.
# if !defined (ACE_LOCALHOST)
# define ACE_LOCALHOST ACE_TEXT ("localhost")
# endif
+
// This specification for an IPv6 localhost should work on all platforms
// supporting IPv6
# if defined (ACE_HAS_IPV6)
@@ -185,6 +232,7 @@
# define ACE_IPV6_LOCALHOST ACE_TEXT ("::1")
# endif /* ACE_IPV6_LOCALHOST*/
#endif /* ACE_HAS_IPV6 */
+
// This specification for an IPv6 ANY address should work on all platforms
// supporting IPv6
# if defined (ACE_HAS_IPV6)
@@ -192,6 +240,7 @@
# define ACE_IPV6_ANY ACE_TEXT ("::")
# endif /* ACE_IPV6_ANY*/
#endif /* ACE_HAS_IPV6 */
+
# if !defined (ACE_DEFAULT_SERVER_HOST)
# if defined (ACE_HAS_IPV6)
# define ACE_DEFAULT_SERVER_HOST ACE_IPV6_LOCALHOST
@@ -199,28 +248,34 @@
# define ACE_DEFAULT_SERVER_HOST ACE_LOCALHOST
# endif /*ACE_HAS_IPV6*/
# endif /* ACE_DEFAULT_SERVER_HOST */
+
// Default shared memory key
# if !defined (ACE_DEFAULT_SHM_KEY)
# define ACE_DEFAULT_SHM_KEY 1234
# endif /* ACE_DEFAULT_SHM_KEY */
+
// Default address for shared memory mapped files and SYSV shared memory
// (defaults to 64 M).
# if !defined (ACE_DEFAULT_BASE_ADDR)
# define ACE_DEFAULT_BASE_ADDR ((char *) (64 * 1024 * 1024))
# endif /* ACE_DEFAULT_BASE_ADDR */
+
// Default segment size used by SYSV shared memory (128 K)
# if !defined (ACE_DEFAULT_SEGMENT_SIZE)
# define ACE_DEFAULT_SEGMENT_SIZE 1024 * 128
# endif /* ACE_DEFAULT_SEGMENT_SIZE */
+
// Maximum number of SYSV shared memory segments
// (does anyone know how to figure out the right values?!)
# if !defined (ACE_DEFAULT_MAX_SEGMENTS)
# define ACE_DEFAULT_MAX_SEGMENTS 6
# endif /* ACE_DEFAULT_MAX_SEGMENTS */
+
// Name of the map that's stored in shared memory.
# if !defined (ACE_NAME_SERVER_MAP)
# define ACE_NAME_SERVER_MAP "Name Server Map"
# endif /* ACE_NAME_SERVER_MAP */
+
// Default file permissions.
# if !defined (ACE_DEFAULT_FILE_PERMS)
# if defined (ACE_VXWORKS)
@@ -229,100 +284,127 @@
# define ACE_DEFAULT_FILE_PERMS 0644
# endif /* ACE_VXWORKS */
# endif /* ACE_DEFAULT_FILE_PERMS */
+
// Default directory permissions.
# if !defined (ACE_DEFAULT_DIR_PERMS)
# define ACE_DEFAULT_DIR_PERMS 0755
# endif /* ACE_DEFAULT_DIR_PERMS */
+
# if !defined (ACE_DEFAULT_TIMEPROBE_TABLE_SIZE)
# define ACE_DEFAULT_TIMEPROBE_TABLE_SIZE 8 * 1024
# endif /* ACE_DEFAULT_TIMEPROBE_TABLE_SIZE */
+
// Default size of the ACE Map_Manager.
# if !defined (ACE_DEFAULT_MAP_SIZE)
# define ACE_DEFAULT_MAP_SIZE 1024
# endif /* ACE_DEFAULT_MAP_SIZE */
+
// Defaults for ACE Timer Wheel
# if !defined (ACE_DEFAULT_TIMER_WHEEL_SIZE)
# define ACE_DEFAULT_TIMER_WHEEL_SIZE 1024
# endif /* ACE_DEFAULT_TIMER_WHEEL_SIZE */
+
# if !defined (ACE_DEFAULT_TIMER_WHEEL_RESOLUTION)
# define ACE_DEFAULT_TIMER_WHEEL_RESOLUTION 100
# endif /* ACE_DEFAULT_TIMER_WHEEL_RESOLUTION */
+
// Default size for ACE Timer Hash table
# if !defined (ACE_DEFAULT_TIMER_HASH_TABLE_SIZE)
# define ACE_DEFAULT_TIMER_HASH_TABLE_SIZE 1024
# endif /* ACE_DEFAULT_TIMER_HASH_TABLE_SIZE */
+
// Defaults for the ACE Free List
# if !defined (ACE_DEFAULT_FREE_LIST_PREALLOC)
# define ACE_DEFAULT_FREE_LIST_PREALLOC 0
# endif /* ACE_DEFAULT_FREE_LIST_PREALLOC */
+
# if !defined (ACE_DEFAULT_FREE_LIST_LWM)
# define ACE_DEFAULT_FREE_LIST_LWM 0
# endif /* ACE_DEFAULT_FREE_LIST_LWM */
+
# if !defined (ACE_DEFAULT_FREE_LIST_HWM)
# define ACE_DEFAULT_FREE_LIST_HWM 25000
# endif /* ACE_DEFAULT_FREE_LIST_HWM */
+
# if !defined (ACE_DEFAULT_FREE_LIST_INC)
# define ACE_DEFAULT_FREE_LIST_INC 100
# endif /* ACE_DEFAULT_FREE_LIST_INC */
+
# if !defined (ACE_UNIQUE_NAME_LEN)
# define ACE_UNIQUE_NAME_LEN 100
# endif /* ACE_UNIQUE_NAME_LEN */
+
# if !defined (ACE_MAX_DGRAM_SIZE)
// This is just a guess. 8k is the normal limit on
// most machines because that's what NFS expects.
# define ACE_MAX_DGRAM_SIZE 8192
# endif /* ACE_MAX_DGRAM_SIZE */
+
# if !defined (ACE_DEFAULT_ARGV_BUFSIZ)
# define ACE_DEFAULT_ARGV_BUFSIZ 1024 * 4
# endif /* ACE_DEFAULT_ARGV_BUFSIZ */
+
// A free list which create more elements when there aren't enough
// elements.
# define ACE_FREE_LIST_WITH_POOL 1
+
// A simple free list which doen't allocate/deallocate elements.
# define ACE_PURE_FREE_LIST 2
+
# if defined (ACE_WIN32)
+
// This is necessary to work around bugs with Win32 non-blocking
// connects...
# if !defined (ACE_NON_BLOCKING_BUG_DELAY)
# define ACE_NON_BLOCKING_BUG_DELAY 35000
# endif /* ACE_NON_BLOCKING_BUG_DELAY */
# endif /*ACE_WIN32*/
+
// Max size of an ACE Log Record data buffer. This can be reset in
// the config.h file if you'd like to increase or decrease the size.
# if !defined (ACE_MAXLOGMSGLEN)
# define ACE_MAXLOGMSGLEN 4 * 1024
# endif /* ACE_MAXLOGMSGLEN */
+
// Max size of an ACE Token.
# define ACE_MAXTOKENNAMELEN 40
+
// Max size of an ACE Token client ID.
# define ACE_MAXCLIENTIDLEN MAXHOSTNAMELEN + 20
+
/// Max udp packet size
#if !defined (ACE_MAX_UDP_PACKET_SIZE)
#define ACE_MAX_UDP_PACKET_SIZE 65536
#endif
+
/**
* @name Default values to control CDR classes memory allocation strategies
*/
//@{
+
/// Control the initial size of all CDR buffers, application
/// developers may want to optimize this value to fit their request
/// size
#if !defined (ACE_DEFAULT_CDR_BUFSIZE)
# define ACE_DEFAULT_CDR_BUFSIZE 512
#endif /* ACE_DEFAULT_CDR_BUFSIZE */
+
#if (ACE_DEFAULT_CDR_BUFSIZE == 0)
# error: ACE_DEFAULT_CDR_BUFSIZE should be bigger then 0
#endif
+
/// Stop exponential growth of CDR buffers to avoid overallocation
#if !defined (ACE_DEFAULT_CDR_EXP_GROWTH_MAX)
# define ACE_DEFAULT_CDR_EXP_GROWTH_MAX 65536
#endif /* ACE_DEFAULT_CDR_EXP_GROWTH_MAX */
+
/// Control CDR buffer growth after maximum exponential growth is
/// reached
#if !defined (ACE_DEFAULT_CDR_LINEAR_GROWTH_CHUNK)
# define ACE_DEFAULT_CDR_LINEAR_GROWTH_CHUNK 65536
#endif /* ACE_DEFAULT_CDR_LINEAR_GROWTH_CHUNK */
//@}
+
/// Control the zero-copy optimizations for octet sequences
/**
* Large octet sequences can be sent without any copies by chaining
@@ -334,6 +416,7 @@
#if !defined (ACE_DEFAULT_CDR_MEMCPY_TRADEOFF)
#define ACE_DEFAULT_CDR_MEMCPY_TRADEOFF 256
#endif /* ACE_DEFAULT_CDR_MEMCPY_TRADEOFF */
+
#if defined (ACE_WIN32)
// Define the pathname separator characters for Win32 (ugh).
# define ACE_DIRECTORY_SEPARATOR_STR_A "\\"
@@ -343,27 +426,34 @@
# define ACE_DIRECTORY_SEPARATOR_STR_A "/"
# define ACE_DIRECTORY_SEPARATOR_CHAR_A '/'
#endif /* ACE_WIN32 */
+
// Define the Wide character and normal versions of some of the string macros
#if defined (ACE_HAS_WCHAR)
# define ACE_DIRECTORY_SEPARATOR_STR_W ACE_TEXT_WIDE(ACE_DIRECTORY_SEPARATOR_STR_A)
# define ACE_DIRECTORY_SEPARATOR_CHAR_W ACE_TEXT_WIDE(ACE_DIRECTORY_SEPARATOR_CHAR_A)
#endif /* ACE_HAS_WCHAR */
+
#define ACE_DIRECTORY_SEPARATOR_STR ACE_TEXT (ACE_DIRECTORY_SEPARATOR_STR_A)
#define ACE_DIRECTORY_SEPARATOR_CHAR ACE_TEXT (ACE_DIRECTORY_SEPARATOR_CHAR_A)
+
#if !defined (ACE_DEFAULT_THREAD_PRIORITY)
# define ACE_DEFAULT_THREAD_PRIORITY (-0x7fffffffL - 1L)
#endif /* ACE_DEFAULT_THREAD_PRIORITY */
+
#if !defined (ACE_DEFAULT_THREAD_STACKSIZE)
# define ACE_DEFAULT_THREAD_STACKSIZE 0
#endif /* ACE_DEFAULT_THREAD_STACKSIZE */
+
#if !defined (ACE_MAX_DEFAULT_PORT)
# define ACE_MAX_DEFAULT_PORT 65535
#endif /* ACE_MAX_DEFAULT_PORT */
+
// Default number of ACE_Event_Handlers supported by
// ACE_Timer_Heap.
# if !defined (ACE_DEFAULT_TIMERS)
# define ACE_DEFAULT_TIMERS _POSIX_TIMER_MAX
# endif /* ACE_DEFAULT_TIMERS */
+
#if defined (ACE_WIN32)
# define ACE_PLATFORM_A "Win32"
# define ACE_PLATFORM_EXE_SUFFIX_A ".exe"
@@ -378,13 +468,16 @@
# define ACE_PLATFORM_A "UNIX"
# define ACE_PLATFORM_EXE_SUFFIX_A ""
#endif /* ACE_WIN32 */
+
// Define the Wide character and normal versions of some of the string macros
#if defined (ACE_HAS_WCHAR)
# define ACE_PLATFORM_W ACE_TEXT_WIDE(ACE_PLATFORM_A)
# define ACE_PLATFORM_EXE_SUFFIX_W ACE_TEXT_WIDE(ACE_PLATFORM_EXE_SUFFIX_A)
#endif /* ACE_HAS_WCHAR */
+
#define ACE_PLATFORM ACE_TEXT (ACE_PLATFORM_A)
#define ACE_PLATFORM_EXE_SUFFIX ACE_TEXT (ACE_PLATFORM_EXE_SUFFIX_A)
+
#if defined (ACE_WIN32)
# define ACE_LD_SEARCH_PATH ACE_TEXT ("PATH")
# define ACE_LD_SEARCH_PATH_SEPARATOR_STR ACE_TEXT (";")
@@ -402,12 +495,15 @@
# define ACE_LD_SEARCH_PATH_SEPARATOR_STR ACE_TEXT (":")
# endif /* ACE_LD_SEARCH_PATH_SEPARATOR_STR */
#endif /* ACE_WIN32 */
+
#if !defined (ACE_DLL_SUFFIX)
# define ACE_DLL_SUFFIX ACE_TEXT (".so")
#endif /* ACE_DLL_SUFFIX */
+
#if !defined (ACE_DLL_PREFIX)
# define ACE_DLL_PREFIX ACE_TEXT ("lib")
#endif /* ACE_DLL_PREFIX */
+
#if defined (ACE_WIN32)
// Used for dynamic linking
# if !defined (ACE_DEFAULT_SVC_CONF)
@@ -418,6 +514,7 @@
# endif /* ACE_USES_CLASSIC_SVC_CONF ==1 */
# endif /* ACE_DEFAULT_SVC_CONF */
#endif /* ACE_WIN32 */
+
// Used for dynamic linking.
#if !defined (ACE_DEFAULT_SVC_CONF)
# if (ACE_USES_CLASSIC_SVC_CONF == 1)
@@ -426,9 +523,11 @@
# define ACE_DEFAULT_SVC_CONF ACE_TEXT ("./svc.conf.xml")
# endif /* ACE_USES_CLASSIC_SVC_CONF ==1 */
#endif /* ACE_DEFAULT_SVC_CONF */
+
#if !defined (ACE_LOGGER_KEY)
# define ACE_LOGGER_KEY ACE_TEXT ("/tmp/server_daemon")
#endif /* ACE_LOGGER_KEY */
+
// Theses defines are used by the ACE Name Server.
#if !defined (ACE_DEFAULT_LOCALNAME_A)
# define ACE_DEFAULT_LOCALNAME_A "localnames"
@@ -436,6 +535,7 @@
#if !defined (ACE_DEFAULT_GLOBALNAME_A)
# define ACE_DEFAULT_GLOBALNAME_A "globalnames"
#endif /* ACE_DEFAULT_GLOBALNAME_A */
+
// ACE_DEFAULT_NAMESPACE_DIR is for legacy mode apps. A better
// way of doing this is something like ACE_Lib_Find::get_temp_dir, since
// this directory may not exist
@@ -450,12 +550,15 @@
# endif /* ACE_HAS_WCHAR */
# define ACE_DEFAULT_NAMESPACE_DIR ACE_TEXT(ACE_DEFAULT_NAMESPACE_DIR_A)
#endif /* ACE_LEGACY_MODE */
+
#if defined (ACE_HAS_WCHAR)
# define ACE_DEFAULT_LOCALNAME_W ACE_TEXT_WIDE(ACE_DEFAULT_LOCALNAME_A)
# define ACE_DEFAULT_GLOBALNAME_W ACE_TEXT_WIDE(ACE_DEFAULT_GLOBALNAME_A)
#endif /* ACE_HAS_WCHAR */
+
#define ACE_DEFAULT_LOCALNAME ACE_TEXT (ACE_DEFAULT_LOCALNAME_A)
#define ACE_DEFAULT_GLOBALNAME ACE_TEXT (ACE_DEFAULT_GLOBALNAME_A)
+
# if defined (ACE_WIN32)
// The "null" device on Win32.
# define ACE_DEV_NULL "nul"
@@ -465,6 +568,7 @@
# define ACE_DEV_NULL "/dev/null"
# define ACE_SYSCALL_FAILED -1
# endif /* ACE_WIN32 */
+
#include /**/ "ace/post.h"
#endif /*ACE_DEFAULT_CONSTANTS_H*/
diff --git a/dep/ACE_wrappers/ace/Dev_Poll_Reactor.cpp b/dep/ACE_wrappers/ace/Dev_Poll_Reactor.cpp
index a46e649d441..2cd90d17738 100644
--- a/dep/ACE_wrappers/ace/Dev_Poll_Reactor.cpp
+++ b/dep/ACE_wrappers/ace/Dev_Poll_Reactor.cpp
@@ -1,15 +1,20 @@
// $Id: Dev_Poll_Reactor.cpp 81315 2008-04-10 07:14:15Z johnnyw $
+
#include "ace/OS_NS_errno.h"
#include "ace/Dev_Poll_Reactor.h"
#include "ace/Signal.h"
#include "ace/Sig_Handler.h"
+
ACE_RCSID (ace,
Dev_Poll_Reactor,
"$Id: Dev_Poll_Reactor.cpp 81315 2008-04-10 07:14:15Z johnnyw $")
+
#if defined (ACE_HAS_EVENT_POLL) || defined (ACE_HAS_DEV_POLL)
+
# include "ace/OS_NS_unistd.h"
# include "ace/OS_NS_fcntl.h"
# include "ace/OS_NS_stropts.h"
+
# if defined (ACE_HAS_EVENT_POLL) && defined (linux)
# include /**/ <sys/epoll.h>
# elif defined (ACE_HAS_DEV_POLL)
@@ -21,10 +26,12 @@ ACE_RCSID (ace,
# include /**/ <sys/devpoll.h>
# endif /* linux */
# endif /* ACE_HAS_DEV_POLL */
+
#if !defined (__ACE_INLINE__)
# include "ace/Dev_Poll_Reactor.inl"
#endif /* __ACE_INLINE__ */
+
#include "ace/Handle_Set.h"
#include "ace/Reactor.h"
#include "ace/Timer_Heap.h"
@@ -38,7 +45,9 @@ ACE_RCSID (ace,
#include "ace/Guard_T.h"
#include "ace/OS_NS_string.h"
#include "ace/OS_NS_sys_time.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_Dev_Poll_Reactor_Notify::ACE_Dev_Poll_Reactor_Notify (void)
: dp_reactor_ (0)
, notification_pipe_ ()
@@ -48,36 +57,44 @@ ACE_Dev_Poll_Reactor_Notify::ACE_Dev_Poll_Reactor_Notify (void)
#endif /* ACE_HAS_REACTOR_NOTIFICATION_QUEUE */
{
}
+
int
ACE_Dev_Poll_Reactor_Notify::open (ACE_Reactor_Impl *r,
ACE_Timer_Queue * /* timer_queue */,
int disable_notify_pipe)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::open");
+
if (disable_notify_pipe == 0)
{
this->dp_reactor_ = dynamic_cast<ACE_Dev_Poll_Reactor *> (r);
+
if (this->dp_reactor_ == 0)
{
errno = EINVAL;
return -1;
}
+
if (this->notification_pipe_.open () == -1)
return -1;
+
#if defined (F_SETFD)
// close-on-exec
ACE_OS::fcntl (this->notification_pipe_.read_handle (), F_SETFD, 1);
ACE_OS::fcntl (this->notification_pipe_.write_handle (), F_SETFD, 1);
#endif /* F_SETFD */
+
#if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE)
if (notification_queue_.open () == -1)
{
return -1;
}
+
if (ACE::set_flags (this->notification_pipe_.write_handle (),
ACE_NONBLOCK) == -1)
return -1;
#endif /* ACE_HAS_REACTOR_NOTIFICATION_QUEUE */
+
// Set the read handle into non-blocking mode since we need to
// perform a "speculative" read when determining if there are
// notifications to dispatch.
@@ -85,40 +102,53 @@ ACE_Dev_Poll_Reactor_Notify::open (ACE_Reactor_Impl *r,
ACE_NONBLOCK) == -1)
return -1;
}
+
return 0;
}
+
int
ACE_Dev_Poll_Reactor_Notify::close (void)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::close");
+
#if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE)
notification_queue_.reset ();
#endif /* ACE_HAS_REACTOR_NOTIFICATION_QUEUE */
+
return this->notification_pipe_.close ();
}
+
int
ACE_Dev_Poll_Reactor_Notify::notify (ACE_Event_Handler *eh,
ACE_Reactor_Mask mask,
ACE_Time_Value *timeout)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::notify");
+
// Just consider this method a "no-op" if there's no
// ACE_Dev_Poll_Reactor configured.
if (this->dp_reactor_ == 0)
return 0;
+
ACE_Notification_Buffer buffer (eh, mask);
+
#if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE)
ACE_UNUSED_ARG (timeout);
ACE_Dev_Poll_Handler_Guard eh_guard (eh);
+
int notification_required =
notification_queue_.push_new_notification (buffer);
+
if (notification_required == -1)
return -1; // Also decrement eh's reference count
+
// The notification has been queued, so it will be delivered at some
// point (and may have been already); release the refcnt guard.
eh_guard.release ();
+
if (notification_required == 0)
return 0;
+
// Now pop the pipe to force the callback for dispatching when ready. If
// the send fails due to a full pipe, don't fail - assume the already-sent
// pipe bytes will cause the entire notification queue to be processed.
@@ -128,25 +158,32 @@ ACE_Dev_Poll_Reactor_Notify::notify (ACE_Event_Handler *eh,
&ACE_Time_Value::zero);
if (n == -1 && (errno != ETIME && errno != EAGAIN))
return -1;
+
return 0;
#else
+
ACE_Dev_Poll_Handler_Guard eh_guard (eh);
+
ssize_t n = ACE::send (this->notification_pipe_.write_handle (),
(char *) &buffer,
sizeof buffer,
timeout);
if (n == -1)
return -1;
+
eh_guard.release ();
+
return 0;
#endif /* ACE_HAS_REACTOR_NOTIFICATION_QUEUE */
}
+
int
ACE_Dev_Poll_Reactor_Notify::dispatch_notifications (
int & /* number_of_active_handles */,
ACE_Handle_Set & /* rd_mask */)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::dispatch_notifications");
+
// This method is unimplemented in the ACE_Dev_Poll_Reactor.
// Instead, the notification handler is invoked as part of the IO
// event set. Doing so alters the some documented semantics that
@@ -154,13 +191,16 @@ ACE_Dev_Poll_Reactor_Notify::dispatch_notifications (
// Enforcing such semantics does not appear to be beneficial, and
// also serves to slow down event dispatching particularly with this
// ACE_Dev_Poll_Reactor.
+
ACE_NOTSUP_RETURN (-1);
}
+
int
ACE_Dev_Poll_Reactor_Notify::read_notify_pipe (ACE_HANDLE handle,
ACE_Notification_Buffer &buffer)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::read_notify_pipe");
+
// This is a (non-blocking) "speculative" read, i.e., we attempt to
// read even if no event was polled on the read handle. A
// speculative read is necessary since notifications must be
@@ -171,6 +211,7 @@ ACE_Dev_Poll_Reactor_Notify::read_notify_pipe (ACE_HANDLE handle,
size_t to_read;
char *read_p;
bool have_one = false;
+
#if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE)
// For the queued case, we'll try to read one byte (since that's what
// the notify () tried to put in) but we don't need it - notifications can
@@ -179,22 +220,27 @@ ACE_Dev_Poll_Reactor_Notify::read_notify_pipe (ACE_HANDLE handle,
char b;
read_p = &b;
to_read = 1;
+
// Before reading the byte, pop a message from the queue and queue a
// new message unless the queue is now empty. The protocol is to
// keep a byte in the pipe as long as the queue is not empty.
bool more_messages_queued = false;
ACE_Notification_Buffer next;
+
int result = notification_queue_.pop_next_notification (buffer,
more_messages_queued,
next);
+
if (result == 0)
{
// remove the notification byte from the pipe, avoiding notification loop
ACE::recv (handle, read_p, to_read);
return 0;
}
+
if (result == -1)
return -1;
+
if (more_messages_queued)
(void) ACE::send (this->notification_pipe_.write_handle (),
(char *)&next,
@@ -204,13 +250,16 @@ ACE_Dev_Poll_Reactor_Notify::read_notify_pipe (ACE_HANDLE handle,
to_read = sizeof buffer;
read_p = (char *)&buffer;
#endif /* ACE_HAS_REACTOR_NOTIFICATION_QUEUE */
+
ssize_t n = ACE::recv (handle, read_p, to_read);
+
if (n > 0)
{
// Check to see if we've got a short read.
if (static_cast<size_t> (n) != to_read)
{
size_t remainder = to_read - n;
+
// If so, try to recover by reading the remainder. If this
// doesn't work we're in big trouble since the input stream
// won't be aligned correctly. I'm not sure quite what to
@@ -218,67 +267,85 @@ ACE_Dev_Poll_Reactor_Notify::read_notify_pipe (ACE_HANDLE handle,
if (ACE::recv (handle, &read_p[n], remainder) <= 0)
return -1;
}
+
return 1;
}
+
// Return -1 if things have gone seriously wrong.
if (n <= 0 && (errno != EWOULDBLOCK && errno != EAGAIN))
return -1;
+
return have_one ? 1 : 0;
}
+
int
ACE_Dev_Poll_Reactor_Notify::handle_input (ACE_HANDLE handle)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::handle_input");
+
// @@ We may end up dispatching this event handler twice: once when
// performing the speculative read on the notification pipe
// handle, and once more when dispatching the IO events.
+
// Precondition: this->select_reactor_.token_.current_owner () ==
// ACE_Thread::self ();
+
int number_dispatched = 0;
int result = 0;
ACE_Notification_Buffer buffer;
+
while ((result = this->read_notify_pipe (handle, buffer)) > 0)
{
// Dispatch the buffer
// NOTE: We count only if we made any dispatches ie. upcalls.
if (this->dispatch_notify (buffer) > 0)
++number_dispatched;
+
// Bail out if we've reached the <notify_threshold_>. Note that
// by default <notify_threshold_> is -1, so we'll loop until all
// the available notifications have been dispatched.
if (number_dispatched == this->max_notify_iterations_)
break;
}
+
if (result == -1)
{
// Reassign number_dispatched to -1 if things have gone
// seriously wrong.
number_dispatched = -1;
}
+
// Enqueue ourselves into the list of waiting threads. When we
// reacquire the token we'll be off and running again with ownership
// of the token. The postcondition of this call is that
// <select_reactor_.token_.current_owner> == <ACE_Thread::self>.
//this->select_reactor_->renew ();
+
return number_dispatched;
}
+
ACE_HANDLE
ACE_Dev_Poll_Reactor_Notify::notify_handle (void)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::notify_handle");
+
return this->notification_pipe_.read_handle ();
}
+
int
ACE_Dev_Poll_Reactor_Notify::is_dispatchable (ACE_Notification_Buffer &)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::is_dispatchable");
+
ACE_NOTSUP_RETURN (-1);
}
+
int
ACE_Dev_Poll_Reactor_Notify::dispatch_notify (ACE_Notification_Buffer &buffer)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::dispatch_notify");
+
// If eh == 0 then another thread is unblocking the
// ACE_Dev_Poll_Reactor to update the ACE_Dev_Poll_Reactor's
// internal structures. Otherwise, we need to dispatch the
@@ -287,10 +354,12 @@ ACE_Dev_Poll_Reactor_Notify::dispatch_notify (ACE_Notification_Buffer &buffer)
if (buffer.eh_ != 0)
{
int result = 0;
+
// Guard the handler's refcount. Recall that when the notify
// was queued, the refcount was incremented, so it need not be
// now. The guard insures that it is decremented properly.
ACE_Dev_Poll_Handler_Guard eh_guard (buffer.eh_, false);
+
switch (buffer.mask_)
{
case ACE_Event_Handler::READ_MASK:
@@ -312,42 +381,54 @@ ACE_Dev_Poll_Reactor_Notify::dispatch_notify (ACE_Notification_Buffer &buffer)
if (result == -1)
buffer.eh_->handle_close (ACE_INVALID_HANDLE, buffer.mask_);
}
+
return 1;
}
+
void
ACE_Dev_Poll_Reactor_Notify::max_notify_iterations (int iterations)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::max_notify_iterations");
+
// Must always be > 0 or < 0 to optimize the loop exit condition.
if (iterations == 0)
iterations = 1;
+
this->max_notify_iterations_ = iterations;
}
+
int
ACE_Dev_Poll_Reactor_Notify::max_notify_iterations (void)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::max_notify_iterations");
+
return this->max_notify_iterations_;
}
+
int
ACE_Dev_Poll_Reactor_Notify::purge_pending_notifications (
ACE_Event_Handler *eh,
ACE_Reactor_Mask mask)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::purge_pending_notifications");
+
#if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE)
+
return notification_queue_.purge_pending_notifications (eh, mask);
+
#else /* defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) */
ACE_UNUSED_ARG (eh);
ACE_UNUSED_ARG (mask);
ACE_NOTSUP_RETURN (-1);
#endif /* defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) */
}
+
void
ACE_Dev_Poll_Reactor_Notify::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("dp_reactor_ = %@"),
@@ -356,7 +437,9 @@ ACE_Dev_Poll_Reactor_Notify::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
// -----------------------------------------------------------------
+
ACE_Dev_Poll_Reactor_Handler_Repository::
ACE_Dev_Poll_Reactor_Handler_Repository (void)
: max_size_ (0),
@@ -364,11 +447,13 @@ ACE_Dev_Poll_Reactor_Handler_Repository (void)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor_Handler_Repository::ACE_Dev_Poll_Reactor_Handler_Repository");
}
+
int
ACE_Dev_Poll_Reactor_Handler_Repository::invalid_handle (
ACE_HANDLE handle) const
{
ACE_TRACE ("ACE_Dev_Poll_Reactor_Handler_Repository::invalid_handle");
+
if (handle < 0 || handle >= this->max_size_)
{
errno = EINVAL;
@@ -377,11 +462,13 @@ ACE_Dev_Poll_Reactor_Handler_Repository::invalid_handle (
else
return 0;
}
+
int
ACE_Dev_Poll_Reactor_Handler_Repository::handle_in_range (
ACE_HANDLE handle) const
{
ACE_TRACE ("ACE_Dev_Poll_Reactor_Handler_Repository::handle_in_range");
+
if (handle >= 0 && handle < this->max_size_)
return 1;
else
@@ -390,48 +477,62 @@ ACE_Dev_Poll_Reactor_Handler_Repository::handle_in_range (
return 0;
}
}
+
int
ACE_Dev_Poll_Reactor_Handler_Repository::open (size_t size)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor_Handler_Repository::open");
+
this->max_size_ = size;
+
// Try to allocate the memory.
ACE_NEW_RETURN (this->handlers_,
ACE_Dev_Poll_Event_Tuple[size],
-1);
+
// Try to increase the number of handles if <size> is greater than
// the current limit.
return ACE::set_handle_limit (size);
}
+
int
ACE_Dev_Poll_Reactor_Handler_Repository::unbind_all (void)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor_Handler_Repository::unbind_all");
+
// Unbind all of the event handlers.
for (int handle = 0;
handle < this->max_size_;
++handle)
this->unbind (handle);
+
return 0;
}
+
int
ACE_Dev_Poll_Reactor_Handler_Repository::close (void)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor_Handler_Repository::close");
+
if (this->handlers_ != 0)
{
this->unbind_all ();
+
delete [] this->handlers_;
this->handlers_ = 0;
}
+
return 0;
}
+
ACE_Event_Handler *
ACE_Dev_Poll_Reactor_Handler_Repository::find (ACE_HANDLE handle,
size_t *index_p)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor_Handler_Repository::find");
+
ACE_Event_Handler *eh = 0;
+
// Only bother to search for the <handle> if it's in range.
if (this->handle_in_range (handle))
{
@@ -444,8 +545,10 @@ ACE_Dev_Poll_Reactor_Handler_Repository::find (ACE_HANDLE handle,
else
errno = ENOENT;
}
+
return eh;
}
+
int
ACE_Dev_Poll_Reactor_Handler_Repository::bind (
ACE_HANDLE handle,
@@ -453,32 +556,43 @@ ACE_Dev_Poll_Reactor_Handler_Repository::bind (
ACE_Reactor_Mask mask)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor_Handler_Repository::bind");
+
if (event_handler == 0)
return -1;
+
if (handle == ACE_INVALID_HANDLE)
handle = event_handler->get_handle ();
+
if (this->invalid_handle (handle))
return -1;
+
this->handlers_[handle].event_handler = event_handler;
this->handlers_[handle].mask = mask;
event_handler->add_reference ();
+
return 0;
}
+
int
ACE_Dev_Poll_Reactor_Handler_Repository::unbind (ACE_HANDLE handle,
bool decr_refcnt)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor_Handler_Repository::unbind");
+
if (this->find (handle) == 0)
return -1;
+
if (decr_refcnt)
this->handlers_[handle].event_handler->remove_reference ();
this->handlers_[handle].event_handler = 0;
this->handlers_[handle].mask = ACE_Event_Handler::NULL_MASK;
this->handlers_[handle].suspended = 0;
+
return 0;
}
+
// -----------------------------------------------------------------
+
ACE_Dev_Poll_Reactor::ACE_Dev_Poll_Reactor (ACE_Sig_Handler *sh,
ACE_Timer_Queue *tq,
int disable_notify_pipe,
@@ -511,6 +625,7 @@ ACE_Dev_Poll_Reactor::ACE_Dev_Poll_Reactor (ACE_Sig_Handler *sh,
, restart_ (0)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::ACE_Dev_Poll_Reactor");
+
if (this->open (ACE::max_handles (),
0,
sh,
@@ -523,6 +638,7 @@ ACE_Dev_Poll_Reactor::ACE_Dev_Poll_Reactor (ACE_Sig_Handler *sh,
ACE_TEXT ("failed inside ")
ACE_TEXT ("ACE_Dev_Poll_Reactor::CTOR")));
}
+
ACE_Dev_Poll_Reactor::ACE_Dev_Poll_Reactor (size_t size,
int rs,
ACE_Sig_Handler *sh,
@@ -567,11 +683,14 @@ ACE_Dev_Poll_Reactor::ACE_Dev_Poll_Reactor (size_t size,
ACE_TEXT ("ACE_Dev_Poll_Reactor::open ")
ACE_TEXT ("failed inside ACE_Dev_Poll_Reactor::CTOR")));
}
+
ACE_Dev_Poll_Reactor::~ACE_Dev_Poll_Reactor (void)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::~ACE_Dev_Poll_Reactor");
+
(void) this->close ();
}
+
int
ACE_Dev_Poll_Reactor::open (size_t size,
int restart,
@@ -581,68 +700,87 @@ ACE_Dev_Poll_Reactor::open (size_t size,
ACE_Reactor_Notify *notify)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::open");
+
ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1));
+
// Can't initialize ourselves more than once.
if (this->initialized_)
return -1;
+
this->restart_ = restart;
this->signal_handler_ = sh;
this->timer_queue_ = tq;
this->notify_handler_ = notify;
+
int result = 0;
+
// Allows the signal handler to be overridden.
if (this->signal_handler_ == 0)
{
ACE_NEW_RETURN (this->signal_handler_,
ACE_Sig_Handler,
-1);
+
if (this->signal_handler_ == 0)
result = -1;
else
this->delete_signal_handler_ = true;
}
+
// Allows the timer queue to be overridden.
if (result != -1 && this->timer_queue_ == 0)
{
ACE_NEW_RETURN (this->timer_queue_,
ACE_Timer_Heap,
-1);
+
if (this->timer_queue_ == 0)
result = -1;
else
this->delete_timer_queue_ = true;
}
+
// Allows the Notify_Handler to be overridden.
if (result != -1 && this->notify_handler_ == 0)
{
ACE_NEW_RETURN (this->notify_handler_,
ACE_Dev_Poll_Reactor_Notify,
-1);
+
if (this->notify_handler_ == 0)
result = -1;
else
this->delete_notify_handler_ = true;
}
+
#if defined (ACE_HAS_EVENT_POLL)
+
// Allocating event table:
ACE_NEW_RETURN (this->events_, epoll_event[size], -1);
+
// Initializing epoll:
this->poll_fd_ = ::epoll_create (size);
if (this->poll_fd_ == -1)
result = -1;
+
#else
+
// Allocate the array before opening the device to avoid a potential
// resource leak if allocation fails.
ACE_NEW_RETURN (this->dp_fds_,
pollfd[size],
-1);
+
// Open the `/dev/poll' character device.
this->poll_fd_ = ACE_OS::open ("/dev/poll", O_RDWR);
if (this->poll_fd_ == ACE_INVALID_HANDLE)
result = -1;
+
#endif /* ACE_HAS_EVENT_POLL */
+
if (result != -1 && this->handler_rep_.open (size) == -1)
result = -1;
+
// Registration of the notification handler must be done after the
// /dev/poll device has been fully initialized.
else if (this->notify_handler_->open (this,
@@ -654,83 +792,111 @@ ACE_Dev_Poll_Reactor::open (size_t size,
this->notify_handler_,
ACE_Event_Handler::READ_MASK) == -1))
result = -1;
+
this->size_ = size;
+
if (result != -1)
// We're all set to go.
this->initialized_ = true;
else
// This will close down all the allocated resources properly.
(void) this->close ();
+
return result;
}
+
int
ACE_Dev_Poll_Reactor::current_info (ACE_HANDLE, size_t & /* size */)
{
ACE_NOTSUP_RETURN (-1);
}
+
int
ACE_Dev_Poll_Reactor::set_sig_handler (ACE_Sig_Handler *signal_handler)
{
if (this->delete_signal_handler_)
delete this->signal_handler_;
+
this->signal_handler_ = signal_handler;
this->delete_signal_handler_ = false;
+
return 0;
}
+
int
ACE_Dev_Poll_Reactor::timer_queue (ACE_Timer_Queue *tq)
{
if (this->delete_timer_queue_)
delete this->timer_queue_;
+
this->timer_queue_ = tq;
this->delete_timer_queue_ = false;
+
return 0;
+
}
+
ACE_Timer_Queue *
ACE_Dev_Poll_Reactor::timer_queue (void) const
{
return this->timer_queue_;
}
+
int
ACE_Dev_Poll_Reactor::close (void)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::close");
+
ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1));
+
int result = 0;
+
if (this->poll_fd_ != ACE_INVALID_HANDLE)
{
result = ACE_OS::close (this->poll_fd_);
}
+
#if defined (ACE_HAS_EVENT_POLL)
+
delete [] this->events_;
this->events_ = 0;
+
#else
+
delete [] this->dp_fds_;
this->dp_fds_ = 0;
+
#endif /* ACE_HAS_EVENT_POLL */
+
if (this->delete_signal_handler_)
{
delete this->signal_handler_;
this->signal_handler_ = 0;
this->delete_signal_handler_ = false;
}
+
(void) this->handler_rep_.close ();
+
if (this->delete_timer_queue_)
{
delete this->timer_queue_;
this->timer_queue_ = 0;
this->delete_timer_queue_ = false;
}
+
if (this->notify_handler_ != 0)
this->notify_handler_->close ();
+
if (this->delete_notify_handler_)
{
delete this->notify_handler_;
this->notify_handler_ = 0;
this->delete_notify_handler_ = false;
}
+
this->poll_fd_ = ACE_INVALID_HANDLE;
+
#if defined (ACE_HAS_EVENT_POLL)
this->start_pevents_ = 0;
this->end_pevents_ = 0;
@@ -738,34 +904,45 @@ ACE_Dev_Poll_Reactor::close (void)
this->start_pfds_ = 0;
this->end_pfds_ = 0;
#endif /* ACE_HAS_EVENT_POLL */
+
this->initialized_ = false;
+
return result;
}
+
int
ACE_Dev_Poll_Reactor::work_pending (const ACE_Time_Value & max_wait_time)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::work_pending");
+
// Stash the current time
//
// The destructor of this object will automatically compute how much
// time elapsed since this method was called.
ACE_Time_Value mwt (max_wait_time);
ACE_MT (ACE_Countdown_Time countdown (&mwt));
+
Token_Guard guard (this->token_);
int const result = guard.acquire_quietly (&mwt);
+
// If the guard is NOT the owner just return the retval
if (!guard.is_owner ())
return result;
+
// Update the countdown to reflect time waiting for the mutex.
ACE_MT (countdown.update ());
+
return this->work_pending_i (&mwt);
}
+
int
ACE_Dev_Poll_Reactor::work_pending_i (ACE_Time_Value * max_wait_time)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::work_pending_i");
+
if (this->deactivated_)
return 0;
+
#if defined (ACE_HAS_EVENT_POLL)
if (this->start_pevents_ != this->end_pevents_)
#else
@@ -773,75 +950,98 @@ ACE_Dev_Poll_Reactor::work_pending_i (ACE_Time_Value * max_wait_time)
#endif /* ACE_HAS_EVENT_POLL */
return 1; // We still have work_pending (). Do not poll for
// additional events.
+
ACE_Time_Value timer_buf (0);
ACE_Time_Value *this_timeout =
this->timer_queue_->calculate_timeout (max_wait_time, &timer_buf);
+
// Check if we have timers to fire.
int const timers_pending =
((this_timeout != 0 && max_wait_time == 0)
|| (this_timeout != 0 && max_wait_time != 0
&& *this_timeout != *max_wait_time) ? 1 : 0);
+
long const timeout =
(this_timeout == 0
? -1 /* Infinity */
: static_cast<long> (this_timeout->msec ()));
+
#if defined (ACE_HAS_EVENT_POLL)
+
// Wait for events.
int const nfds = ::epoll_wait (this->poll_fd_,
this->events_,
this->size_,
static_cast<int> (timeout));
+
if (nfds > 0)
{
this->start_pevents_ = this->events_;
this->end_pevents_ = this->start_pevents_ + nfds;
}
+
#else
+
struct dvpoll dvp;
+
dvp.dp_fds = this->dp_fds_;
dvp.dp_nfds = this->size_;
dvp.dp_timeout = timeout; // Milliseconds
+
// Poll for events
int const nfds = ACE_OS::ioctl (this->poll_fd_, DP_POLL, &dvp);
+
// Retrieve the results from the pollfd array.
this->start_pfds_ = dvp.dp_fds;
+
// If nfds == 0 then end_pfds_ == start_pfds_ meaning that there is
// no work pending. If nfds > 0 then there is work pending.
// Otherwise an error occurred.
if (nfds > -1)
this->end_pfds_ = this->start_pfds_ + nfds;
#endif /* ACE_HAS_EVENT_POLL */
+
// If timers are pending, override any timeout from the poll.
return (nfds == 0 && timers_pending != 0 ? 1 : nfds);
}
+
int
ACE_Dev_Poll_Reactor::handle_events (ACE_Time_Value *max_wait_time)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::handle_events");
+
// Stash the current time
//
// The destructor of this object will automatically compute how much
// time elapsed since this method was called.
ACE_MT (ACE_Countdown_Time countdown (max_wait_time));
+
Token_Guard guard (this->token_);
int const result = guard.acquire_quietly (max_wait_time);
+
// If the guard is NOT the owner just return the retval
if (!guard.is_owner ())
return result;
+
if (this->deactivated_)
return -1;
+
// Update the countdown to reflect time waiting for the mutex.
ACE_MT (countdown.update ());
+
return this->handle_events_i (max_wait_time, guard);
}
+
int
ACE_Dev_Poll_Reactor::handle_events_i (ACE_Time_Value *max_wait_time,
Token_Guard &guard)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::handle_events_i");
+
int result = 0;
// int active_handle_count = 0;
+
// Poll for events
//
// If the underlying ioctl () call was interrupted via the interrupt
@@ -854,12 +1054,14 @@ ACE_Dev_Poll_Reactor::handle_events_i (ACE_Time_Value *max_wait_time,
ACE_ERROR ((LM_ERROR, "%t: %p\n", "work_pending_i"));
}
while (result == -1 && this->restart_ != 0 && errno == EINTR);
+
if (result == 0 || (result == -1 && errno == ETIME))
return 0;
else if (result == -1)
{
if (errno != EINTR)
return -1;
+
// Bail out -- we got here since the poll was interrupted.
// If it was due to a signal registered through our ACE_Sig_Handler,
// then it was dispatched, so we count it in the number of events
@@ -871,58 +1073,75 @@ ACE_Dev_Poll_Reactor::handle_events_i (ACE_Time_Value *max_wait_time,
}
return -1;
}
+
// Dispatch an event.
return this->dispatch (guard);
}
+
// Dispatch an event. On entry, the token is held by the caller. If an
// event is found to dispatch, the token is released before dispatching it.
int
ACE_Dev_Poll_Reactor::dispatch (Token_Guard &guard)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::dispatch");
+
// Perform the Template Method for dispatching the first located event.
// We dispatch only one to effectively dispatch events concurrently.
// As soon as an event is located, the token is released, allowing the
// next waiter to begin getting an event while we dispatch one here.
int result = 0;
+
// Handle timers early since they may have higher latency
// constraints than I/O handlers. Ideally, the order of
// dispatching should be a strategy...
if ((result = this->dispatch_timer_handler (guard)) != 0)
return result;
+
// Check to see if there are no more I/O handles left to
// dispatch AFTER we've handled the timers.
+
// Finally, dispatch the I/O handlers.
result = this->dispatch_io_event (guard);
+
return result;
}
+
int
ACE_Dev_Poll_Reactor::dispatch_timer_handler (Token_Guard &guard)
{
if (this->timer_queue_->is_empty ())
return 0; // Empty timer queue so cannot have any expired timers.
+
// Get the current time
ACE_Time_Value cur_time (this->timer_queue_->gettimeofday () +
this->timer_queue_->timer_skew ());
+
// Look for a node in the timer queue whose timer <= the present
// time.
ACE_Timer_Node_Dispatch_Info info;
if (this->timer_queue_->dispatch_info (cur_time, info))
{
const void *upcall_act = 0;
+
// Preinvoke (handles refcount if needed, etc.)
this->timer_queue_->preinvoke (info, cur_time, upcall_act);
+
// Release the token before expiration upcall.
guard.release_token ();
+
// call the functor
this->timer_queue_->upcall (info, cur_time);
+
// Postinvoke (undo refcount if needed, etc.)
this->timer_queue_->postinvoke (info, cur_time, upcall_act);
+
// We have dispatched a timer
return 1;
}
+
return 0;
}
+
#if 0
int
ACE_Dev_Poll_Reactor::dispatch_notification_handlers (
@@ -936,19 +1155,24 @@ ACE_Dev_Poll_Reactor::dispatch_notification_handlers (
// ACE_Dev_Poll_Reactor's internal tables or the notify pipe is
// enabled. We'll handle all these threads and notifications, and
// then break out to continue the event loop.
+
const int n =
this->notify_handler_->dispatch_notifications (number_of_active_handles,
dispatch_set.rd_mask_);
+
if (n == -1)
return -1;
else
number_of_handlers_dispatched += n;
+
return /* this->state_changed_ ? -1 : */ 0;
}
#endif /* 0 */
+
int
ACE_Dev_Poll_Reactor::dispatch_io_event (Token_Guard &guard)
{
+
// Define bits to check for while dispatching.
#if defined (ACE_HAS_EVENT_POLL)
const __uint32_t out_event = EPOLLOUT;
@@ -961,12 +1185,14 @@ ACE_Dev_Poll_Reactor::dispatch_io_event (Token_Guard &guard)
const short in_event = POLLIN;
const short err_event = 0; // No known bits for this
#endif /* ACE_HAS_EVENT_POLL */
+
// Since the underlying event demultiplexing mechansim (`/dev/poll'
// or '/dev/epoll') is stateful, and since only one result buffer is
// used, all pending events (i.e. those retrieved from a previous
// poll) must be dispatched before any additional event can be
// polled. As such, the Dev_Poll_Reactor keeps track of the
// progress of events that have been dispatched.
+
// Dispatch the events.
//
// Select the first available handle with event (s) pending. Check for
@@ -992,6 +1218,7 @@ ACE_Dev_Poll_Reactor::dispatch_io_event (Token_Guard &guard)
const ACE_HANDLE handle = pfds->fd;
short &revents = pfds->revents;
#endif /* ACE_HAS_EVENT_POLL */
+
// Figure out what to do first in order to make it easier to manage
// the bit twiddling and possible pfds increment before releasing
// the token for dispatch.
@@ -1027,11 +1254,13 @@ ACE_Dev_Poll_Reactor::dispatch_io_event (Token_Guard &guard)
ACE_ERROR ((LM_ERROR, ACE_TEXT (" (%t) dispatch_io h %d unknown events 0x%x\n"), handle, revents));
// ACE_ASSERT (0);
}
+
// Increment the pointer to the next element before we
// release the token. Otherwise event handlers end up being
// dispatched multiple times for the same poll.
if (revents == 0)
++pfds;
+
/* When using sys_epoll, we can attach arbitrary user
data to the descriptor, so it can be delivered when
activity is detected. Perhaps we should store event
@@ -1039,6 +1268,7 @@ ACE_Dev_Poll_Reactor::dispatch_io_event (Token_Guard &guard)
it up in a repository ? Could it boost performance ?
*/
ACE_Event_Handler *eh = this->handler_rep_.find (handle);
+
if (eh)
{
// Modify the reference count in an exception-safe way.
@@ -1047,31 +1277,38 @@ ACE_Dev_Poll_Reactor::dispatch_io_event (Token_Guard &guard)
// the counting policy, it won't do much. Management of the
// notified handlers themselves is done in the notify handler.
ACE_Dev_Poll_Handler_Guard eh_guard (eh);
+
// Release the reactor token before upcall.
guard.release_token ();
+
// Dispatch the detected event
if (disp_out)
{
const int status =
this->upcall (eh, &ACE_Event_Handler::handle_output, handle);
+
if (status < 0)
// Note that the token is reacquired in remove_handler ().
this->remove_handler (handle, ACE_Event_Handler::WRITE_MASK);
return 1;
}
+
if (disp_exc)
{
const int status =
this->upcall (eh, &ACE_Event_Handler::handle_exception, handle);
+
if (status < 0)
// Note that the token is reacquired in remove_handler ().
this->remove_handler (handle, ACE_Event_Handler::EXCEPT_MASK);
return 1;
}
+
if (disp_in)
{
const int status =
this->upcall (eh, &ACE_Event_Handler::handle_input, handle);
+
if (status < 0)
// Note that the token is reacquired in remove_handler ().
this->remove_handler (handle, ACE_Event_Handler::READ_MASK);
@@ -1079,87 +1316,110 @@ ACE_Dev_Poll_Reactor::dispatch_io_event (Token_Guard &guard)
}
} // The reactor token is reacquired upon leaving this scope.
}
+
return 0;
}
+
int
ACE_Dev_Poll_Reactor::alertable_handle_events (ACE_Time_Value *max_wait_time)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::alertable_handle_events");
+
return this->handle_events (max_wait_time);
}
+
int
ACE_Dev_Poll_Reactor::handle_events (ACE_Time_Value &max_wait_time)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::handle_events");
+
return this->handle_events (&max_wait_time);
}
+
int
ACE_Dev_Poll_Reactor::alertable_handle_events (ACE_Time_Value &max_wait_time)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::alertable_handle_events");
+
return this->handle_events (max_wait_time);
}
+
int
ACE_Dev_Poll_Reactor::deactivated (void)
{
return this->deactivated_;
}
+
void
ACE_Dev_Poll_Reactor::deactivate (int do_stop)
{
this->deactivated_ = do_stop;
this->wakeup_all_threads ();
}
+
int
ACE_Dev_Poll_Reactor::register_handler (ACE_Event_Handler *handler,
ACE_Reactor_Mask mask)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::register_handler");
+
ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1));
+
return this->register_handler_i (handler->get_handle (),
handler,
mask);
}
+
int
ACE_Dev_Poll_Reactor::register_handler (ACE_HANDLE handle,
ACE_Event_Handler *event_handler,
ACE_Reactor_Mask mask)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::register_handler");
+
ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1));
+
return this->register_handler_i (handle,
event_handler,
mask);
}
+
int
ACE_Dev_Poll_Reactor::register_handler_i (ACE_HANDLE handle,
ACE_Event_Handler *event_handler,
ACE_Reactor_Mask mask)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::register_handler_i");
+
if (handle == ACE_INVALID_HANDLE
|| mask == ACE_Event_Handler::NULL_MASK)
{
errno = EINVAL;
return -1;
}
+
if (this->handler_rep_.find (handle) == 0)
{
// Handler not present in the repository. Bind it.
if (this->handler_rep_.bind (handle, event_handler, mask) != 0)
return -1;
+
#if defined (ACE_HAS_EVENT_POLL)
+
struct epoll_event epev;
ACE_OS::memset (&epev, 0, sizeof (epev));
static const int op = EPOLL_CTL_ADD;
+
epev.events = this->reactor_mask_to_poll_event (mask);
epev.data.fd = handle;
+
if (::epoll_ctl (this->poll_fd_, op, handle, &epev) == -1)
{
ACE_ERROR ((LM_ERROR, "%p\n", "epoll_ctl"));
(void) this->handler_rep_.unbind (handle);
return -1;
}
+
#endif /* ACE_HAS_EVENT_POLL */
}
else
@@ -1170,11 +1430,15 @@ ACE_Dev_Poll_Reactor::register_handler_i (ACE_HANDLE handle,
if (this->mask_ops_i (handle, mask, ACE_Reactor::ADD_MASK) == -1)
ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "mask_ops_i"), -1);
}
+
#ifndef ACE_HAS_EVENT_POLL
+
struct pollfd pfd;
+
pfd.fd = handle;
pfd.events = this->reactor_mask_to_poll_event (mask);
pfd.revents = 0;
+
// Add file descriptor to the "interest set."
if (ACE_OS::write (this->poll_fd_, &pfd, sizeof (pfd)) != sizeof (pfd))
{
@@ -1182,12 +1446,15 @@ ACE_Dev_Poll_Reactor::register_handler_i (ACE_HANDLE handle,
return -1;
}
#endif /*ACE_HAS_EVENT_POLL*/
+
// Note the fact that we've changed the state of the wait_set_,
// which is used by the dispatching loop to determine whether it can
// keep going or if it needs to reconsult select ().
// this->state_changed_ = 1;
+
return 0;
}
+
int
ACE_Dev_Poll_Reactor::register_handler (
ACE_HANDLE /* event_handle */,
@@ -1197,25 +1464,32 @@ ACE_Dev_Poll_Reactor::register_handler (
{
ACE_NOTSUP_RETURN (-1);
}
+
int
ACE_Dev_Poll_Reactor::register_handler (const ACE_Handle_Set &handle_set,
ACE_Event_Handler *event_handler,
ACE_Reactor_Mask mask)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::register_handler");
+
ACE_Handle_Set_Iterator handle_iter (handle_set);
+
ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1));
+
// @@ It might be more efficient to construct a pollfd array and
// pass it to the write () call in register_handler_i () only once,
// instead of calling write () (a system call) once for each file
// descriptor.
+
for (ACE_HANDLE h = handle_iter ();
h != ACE_INVALID_HANDLE;
h = handle_iter ())
if (this->register_handler_i (h, event_handler, mask) == -1)
return -1;
+
return 0;
}
+
int
ACE_Dev_Poll_Reactor::register_handler (int signum,
ACE_Event_Handler *new_sh,
@@ -1224,93 +1498,123 @@ ACE_Dev_Poll_Reactor::register_handler (int signum,
ACE_Sig_Action *old_disp)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::register_handler");
+
return this->signal_handler_->register_handler (signum,
new_sh,
new_disp,
old_sh,
old_disp);
}
+
int
ACE_Dev_Poll_Reactor::register_handler (const ACE_Sig_Set &sigset,
ACE_Event_Handler *new_sh,
ACE_Sig_Action *new_disp)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::register_handler");
+
int result = 0;
+
#if (ACE_NSIG > 0)
+
for (int s = 1; s < ACE_NSIG; ++s)
if ((sigset.is_member (s) == 1)
&& this->signal_handler_->register_handler (s,
new_sh,
new_disp) == -1)
result = -1;
+
#else /* ACE_NSIG <= 0 */
+
ACE_UNUSED_ARG (sigset);
ACE_UNUSED_ARG (new_sh);
ACE_UNUSED_ARG (new_disp);
+
#endif /* ACE_NSIG <= 0 */
+
return result;
}
+
int
ACE_Dev_Poll_Reactor::remove_handler (ACE_Event_Handler *handler,
ACE_Reactor_Mask mask)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::remove_handler");
+
ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1));
+
return this->remove_handler_i (handler->get_handle (), mask);
}
+
int
ACE_Dev_Poll_Reactor::remove_handler (ACE_HANDLE handle,
ACE_Reactor_Mask mask)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::remove_handler");
+
ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1));
+
return this->remove_handler_i (handle, mask);
}
+
int
ACE_Dev_Poll_Reactor::remove_handler_i (ACE_HANDLE handle,
ACE_Reactor_Mask mask)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::remove_handler_i");
+
ACE_Event_Handler *eh = this->handler_rep_.find (handle);
+
if (eh == 0 ||
this->mask_ops_i (handle, mask, ACE_Reactor::CLR_MASK) == -1)
return -1;
+
// Check for ref counting now - handle_close () may delete eh.
bool const requires_reference_counting =
eh->reference_counting_policy ().value () ==
ACE_Event_Handler::Reference_Counting_Policy::ENABLED;
+
if (ACE_BIT_DISABLED (mask, ACE_Event_Handler::DONT_CALL))
(void) eh->handle_close (handle, mask);
+
// If there are no longer any outstanding events on the given handle
// then remove it from the handler repository.
if (this->handler_rep_.mask (handle) == ACE_Event_Handler::NULL_MASK)
this->handler_rep_.unbind (handle, requires_reference_counting);
+
// Note the fact that we've changed the state of the wait_set,
// i.e. the "interest set," which is used by the dispatching loop to
// determine whether it can keep going or if it needs to reconsult
// /dev/poll or /dev/epoll.
// this->state_changed_ = 1;
+
return 0;
}
+
int
ACE_Dev_Poll_Reactor::remove_handler (const ACE_Handle_Set &handle_set,
ACE_Reactor_Mask mask)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::remove_handler");
+
ACE_Handle_Set_Iterator handle_iter (handle_set);
+
ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1));
+
// @@ It might be more efficient to construct a pollfd array and
// pass it to the write () call in register_handler_i () only once,
// instead of calling write () (a system call) once for each file
// descriptor.
+
for (ACE_HANDLE h = handle_iter ();
h != ACE_INVALID_HANDLE;
h = handle_iter ())
if (this->remove_handler_i (h, mask) == -1)
return -1;
+
return 0;
}
+
int
ACE_Dev_Poll_Reactor::remove_handler (int signum,
ACE_Sig_Action *new_disp,
@@ -1318,184 +1622,263 @@ ACE_Dev_Poll_Reactor::remove_handler (int signum,
int sigkey)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::remove_handler");
+
return this->signal_handler_->remove_handler (signum,
new_disp,
old_disp,
sigkey);
}
+
int
ACE_Dev_Poll_Reactor::remove_handler (const ACE_Sig_Set &sigset)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::remove_handler");
+
int result = 0;
+
#if (ACE_NSIG > 0)
+
for (int s = 1; s < ACE_NSIG; ++s)
if ((sigset.is_member (s) == 1)
&& this->signal_handler_->remove_handler (s) == -1)
result = -1;
+
#else /* ACE_NSIG <= 0 */
+
ACE_UNUSED_ARG (sigset);
+
#endif /* ACE_NSIG <= 0 */
+
return result;
}
+
int
ACE_Dev_Poll_Reactor::suspend_handler (ACE_Event_Handler *event_handler)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::suspend_handler");
+
if (event_handler == 0)
{
errno = EINVAL;
return -1;
}
+
ACE_HANDLE handle = event_handler->get_handle ();
+
ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1));
+
return this->suspend_handler_i (handle);
}
+
int
ACE_Dev_Poll_Reactor::suspend_handler (ACE_HANDLE handle)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::suspend_handler");
+
ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1));
+
return this->suspend_handler_i (handle);
}
+
int
ACE_Dev_Poll_Reactor::suspend_handler (const ACE_Handle_Set &handles)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::suspend_handler");
+
ACE_Handle_Set_Iterator handle_iter (handles);
ACE_HANDLE h;
+
ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1));
+
while ((h = handle_iter ()) != ACE_INVALID_HANDLE)
if (this->suspend_handler_i (h) == -1)
return -1;
+
return 0;
}
+
int
ACE_Dev_Poll_Reactor::suspend_handlers (void)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::suspend_handlers");
+
ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1));
+
size_t const len = this->handler_rep_.size ();
+
for (size_t i = 0; i < len; ++i)
if (this->handler_rep_.suspended (i) == 0
&& this->suspend_handler_i (i) != 0)
return -1;
+
return 0;
}
+
int
ACE_Dev_Poll_Reactor::suspend_handler_i (ACE_HANDLE handle)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::suspend_handler_i");
+
if (this->handler_rep_.find (handle) == 0)
return -1;
+
if (this->handler_rep_.suspended (handle))
return 0; // Already suspended. @@ Should this be an error?
+
// Remove the handle from the "interest set."
//
// Note that the associated event handler is still in the handler
// repository, but no events will be polled on the given handle thus
// no event will be dispatched to the event handler.
+
#if defined (ACE_HAS_EVENT_POLL)
+
struct epoll_event epev;
ACE_OS::memset (&epev, 0, sizeof (epev));
static const int op = EPOLL_CTL_DEL;
+
epev.events = 0;
epev.data.fd = handle;
+
if (::epoll_ctl (this->poll_fd_, op, handle, &epev) == -1)
return -1;
+
#else
+
struct pollfd pfd[1];
+
pfd[0].fd = handle;
pfd[0].events = POLLREMOVE;
pfd[0].revents = 0;
+
if (ACE_OS::write (this->poll_fd_, pfd, sizeof (pfd)) != sizeof (pfd))
return -1;
+
#endif /* ACE_HAS_EVENT_POLL */
+
this->handler_rep_.suspend (handle);
+
return 0;
}
+
int
ACE_Dev_Poll_Reactor::resume_handler (ACE_Event_Handler *event_handler)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::resume_handler");
+
if (event_handler == 0)
{
errno = EINVAL;
return -1;
}
+
ACE_HANDLE handle = event_handler->get_handle ();
+
ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1));
+
return this->resume_handler_i (handle);
}
+
int
ACE_Dev_Poll_Reactor::resume_handler (ACE_HANDLE handle)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::resume_handler");
+
ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1));
+
return this->resume_handler_i (handle);
}
+
int
ACE_Dev_Poll_Reactor::resume_handler (const ACE_Handle_Set &handles)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::resume_handler");
+
ACE_Handle_Set_Iterator handle_iter (handles);
ACE_HANDLE h;
+
ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1));
+
while ((h = handle_iter ()) != ACE_INVALID_HANDLE)
if (this->resume_handler_i (h) == -1)
return -1;
+
return 0;
}
+
int
ACE_Dev_Poll_Reactor::resume_handlers (void)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::resume_handlers");
+
ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1));
+
size_t const len = this->handler_rep_.size ();
+
for (size_t i = 0; i < len; ++i)
if (this->handler_rep_.suspended (i)
&& this->resume_handler_i (i) != 0)
return -1;
+
return 0;
}
+
int
ACE_Dev_Poll_Reactor::resume_handler_i (ACE_HANDLE handle)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::resume_handler_i");
+
if (this->handler_rep_.find (handle) == 0
&& this->handler_rep_.suspended (handle) == 0)
return -1;
+
ACE_Reactor_Mask mask = this->handler_rep_.mask (handle);
+
if (mask == ACE_Event_Handler::NULL_MASK)
return -1;
+
// Place the handle back in to the "interest set."
//
// Events for the given handle will once again be polled.
+
#if defined (ACE_HAS_EVENT_POLL)
+
struct epoll_event epev;
ACE_OS::memset (&epev, 0, sizeof (epev));
static const int op = EPOLL_CTL_ADD;
+
epev.events = this->reactor_mask_to_poll_event (mask);
epev.data.fd = handle;
+
if (::epoll_ctl (this->poll_fd_, op, handle, &epev) == -1)
return -1;
+
#else
+
struct pollfd pfd[1];
+
pfd[0].fd = handle;
pfd[0].events = this->reactor_mask_to_poll_event (mask);
pfd[0].revents = 0;
+
if (ACE_OS::write (this->poll_fd_, pfd, sizeof (pfd)) != sizeof (pfd))
return -1;
+
#endif /* ACE_HAS_EVENT_POLL */
+
this->handler_rep_.resume (handle);
+
return 0;
}
+
int
ACE_Dev_Poll_Reactor::resumable_handler (void)
{
// @@ Is this correct?
+
return 0;
}
+
int
ACE_Dev_Poll_Reactor::uses_event_associations (void)
{
@@ -1503,6 +1886,7 @@ ACE_Dev_Poll_Reactor::uses_event_associations (void)
// this method always return zero.
return 0;
}
+
long
ACE_Dev_Poll_Reactor::schedule_timer (ACE_Event_Handler *event_handler,
const void *arg,
@@ -1510,131 +1894,171 @@ ACE_Dev_Poll_Reactor::schedule_timer (ACE_Event_Handler *event_handler,
const ACE_Time_Value &interval)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::schedule_timer");
+
ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1));
+
if (0 != this->timer_queue_)
return this->timer_queue_->schedule
(event_handler,
arg,
this->timer_queue_->gettimeofday () + delay,
interval);
+
errno = ESHUTDOWN;
return -1;
}
+
int
ACE_Dev_Poll_Reactor::reset_timer_interval (long timer_id,
const ACE_Time_Value &interval)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::reset_timer_interval");
+
ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1));
+
if (0 != this->timer_queue_)
return this->timer_queue_->reset_interval (timer_id, interval);
+
errno = ESHUTDOWN;
return -1;
}
+
int
ACE_Dev_Poll_Reactor::cancel_timer (ACE_Event_Handler *event_handler,
int dont_call_handle_close)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::cancel_timer");
+
ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1));
+
return (this->timer_queue_ == 0
? 0
: this->timer_queue_->cancel (event_handler,
dont_call_handle_close));
}
+
int
ACE_Dev_Poll_Reactor::cancel_timer (long timer_id,
const void **arg,
int dont_call_handle_close)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::cancel_timer");
+
ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1));
+
return (this->timer_queue_ == 0
? 0
: this->timer_queue_->cancel (timer_id,
arg,
dont_call_handle_close));
}
+
int
ACE_Dev_Poll_Reactor::schedule_wakeup (ACE_Event_Handler *eh,
ACE_Reactor_Mask mask)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::schedule_wakeup");
+
return this->mask_ops (eh->get_handle (), mask, ACE_Reactor::ADD_MASK);
}
+
int
ACE_Dev_Poll_Reactor::schedule_wakeup (ACE_HANDLE handle,
ACE_Reactor_Mask mask)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::schedule_wakeup");
+
return this->mask_ops (handle, mask, ACE_Reactor::ADD_MASK);
}
+
int
ACE_Dev_Poll_Reactor::cancel_wakeup (ACE_Event_Handler *eh,
ACE_Reactor_Mask mask)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::cancel_wakeup");
+
return this->mask_ops (eh->get_handle (), mask, ACE_Reactor::CLR_MASK);
}
+
int
ACE_Dev_Poll_Reactor::cancel_wakeup (ACE_HANDLE handle,
ACE_Reactor_Mask mask)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::cancel_wakeup");
+
return this->mask_ops (handle, mask, ACE_Reactor::CLR_MASK);
}
+
int
ACE_Dev_Poll_Reactor::notify (ACE_Event_Handler *eh,
ACE_Reactor_Mask mask,
ACE_Time_Value *timeout)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::notify");
+
ssize_t n = 0;
+
// Pass over both the Event_Handler *and* the mask to allow the
// caller to dictate which Event_Handler method the receiver
// invokes. Note that this call can timeout.
+
n = this->notify_handler_->notify (eh, mask, timeout);
+
return n == -1 ? -1 : 0;
}
+
void
ACE_Dev_Poll_Reactor::max_notify_iterations (int iterations)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::max_notify_iterations");
+
ACE_MT (ACE_GUARD (ACE_Dev_Poll_Reactor_Token, mon, this->token_));
+
this->notify_handler_->max_notify_iterations (iterations);
}
+
int
ACE_Dev_Poll_Reactor::max_notify_iterations (void)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::max_notify_iterations");
+
ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1));
+
return this->notify_handler_->max_notify_iterations ();
}
+
int
ACE_Dev_Poll_Reactor::purge_pending_notifications (ACE_Event_Handler * eh,
ACE_Reactor_Mask mask)
{
if (this->notify_handler_ == 0)
return 0;
+
return this->notify_handler_->purge_pending_notifications (eh, mask);
}
+
ACE_Event_Handler *
ACE_Dev_Poll_Reactor::find_handler (ACE_HANDLE handle)
{
ACE_MT (ACE_READ_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, 0));
+
ACE_Event_Handler *event_handler = this->handler_rep_.find (handle);
if (event_handler)
event_handler->add_reference ();
return event_handler;
}
+
int
ACE_Dev_Poll_Reactor::handler (ACE_HANDLE handle,
ACE_Reactor_Mask mask,
ACE_Event_Handler **event_handler)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::handler");
+
ACE_MT (ACE_READ_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1));
+
ACE_Event_Handler *h = this->handler_rep_.find (handle);
+
if (h != 0
&& ACE_BIT_CMP_MASK (this->handler_rep_.mask (handle),
mask, // Compare all bits in the mask
@@ -1642,124 +2066,164 @@ ACE_Dev_Poll_Reactor::handler (ACE_HANDLE handle,
{
if (event_handler != 0)
*event_handler = h;
+
return 0;
}
+
return -1;
}
+
int
ACE_Dev_Poll_Reactor::handler (int signum,
ACE_Event_Handler **eh)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::handler");
+
ACE_Event_Handler *handler = this->signal_handler_->handler (signum);
+
if (handler == 0)
return -1;
else if (eh != 0)
*eh = handler;
+
return 0;
}
+
bool
ACE_Dev_Poll_Reactor::initialized (void)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::initialized");
+
ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, false));
+
return this->initialized_;
}
+
size_t
ACE_Dev_Poll_Reactor::size (void) const
{
return this->size_;
}
+
ACE_Lock &
ACE_Dev_Poll_Reactor::lock (void)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::lock");
+
return this->lock_adapter_;
}
+
void
ACE_Dev_Poll_Reactor::wakeup_all_threads (void)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::wakeup_all_threads");
+
// Send a notification, but don't block if there's no one to receive
// it.
this->notify (0,
ACE_Event_Handler::NULL_MASK,
(ACE_Time_Value *) &ACE_Time_Value::zero);
}
+
int
ACE_Dev_Poll_Reactor::owner (ACE_thread_t /* new_owner */,
ACE_thread_t * /* old_owner */)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::owner");
+
// There is no need to set the owner of the event loop. Multiple
// threads may invoke the event loop simulataneously.
+
return 0;
}
+
int
ACE_Dev_Poll_Reactor::owner (ACE_thread_t * /* owner */)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::owner");
+
// There is no need to set the owner of the event loop. Multiple
// threads may invoke the event loop simulataneously.
+
return 0;
}
+
int
ACE_Dev_Poll_Reactor::restart (void)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::restart");
+
ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1));
+
return this->restart_;
}
+
int
ACE_Dev_Poll_Reactor::restart (int r)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::restart");
+
ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1));
+
int current_value = this->restart_;
this->restart_ = r;
return current_value;
}
+
void
ACE_Dev_Poll_Reactor::requeue_position (int)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::requeue_position");
}
+
int
ACE_Dev_Poll_Reactor::requeue_position (void)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::requeue_position");
+
ACE_NOTSUP_RETURN (-1);
}
+
int
ACE_Dev_Poll_Reactor::mask_ops (ACE_Event_Handler *event_handler,
ACE_Reactor_Mask mask,
int ops)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::mask_ops");
+
ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1));
+
return this->mask_ops_i (event_handler->get_handle (), mask, ops);
}
+
int
ACE_Dev_Poll_Reactor::mask_ops (ACE_HANDLE handle,
ACE_Reactor_Mask mask,
int ops)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::mask_ops");
+
ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1));
+
return this->mask_ops_i (handle, mask, ops);
}
+
int
ACE_Dev_Poll_Reactor::mask_ops_i (ACE_HANDLE handle,
ACE_Reactor_Mask mask,
int ops)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::mask_ops_i");
+
if (this->handler_rep_.handle_in_range (handle) == 0)
return -1;
+
// Block out all signals until method returns.
ACE_Sig_Guard sb;
+
ACE_Reactor_Mask const old_mask = this->handler_rep_.mask (handle);
ACE_Reactor_Mask new_mask = old_mask;
+
// Perform GET, CLR, SET, and ADD operations on the interest/wait
// set and the suspend set (if necessary).
//
@@ -1771,50 +2235,63 @@ ACE_Dev_Poll_Reactor::mask_ops_i (ACE_HANDLE handle,
// (only changes enabled bits)
//
// Returns the original mask.
+
switch (ops)
{
case ACE_Reactor::GET_MASK:
// The work for this operation is done in all cases at the
// begining of the function.
return old_mask;
+
case ACE_Reactor::CLR_MASK:
ACE_CLR_BITS (new_mask, mask);
break;
+
case ACE_Reactor::SET_MASK:
new_mask = mask;
break;
+
case ACE_Reactor::ADD_MASK:
ACE_SET_BITS (new_mask, mask);
break;
+
default:
return -1;
}
+
/// Reset the mask for the given handle.
this->handler_rep_.mask (handle, new_mask);
+
if (this->handler_rep_.suspended (handle) == 0)
{
// Only attempt to alter events for the handle from the
// "interest set" if it hasn't been suspended.
+
short const events = this->reactor_mask_to_poll_event (new_mask);
+
#if defined (sun)
// Apparently events cannot be updated on-the-fly on Solaris so
// remove the existing events, and then add the new ones.
struct pollfd pfd[2];
+
pfd[0].fd = handle;
pfd[0].events = POLLREMOVE;
pfd[0].revents = 0;
pfd[1].fd = (events == POLLREMOVE ? ACE_INVALID_HANDLE : handle);
pfd[1].events = events;
pfd[1].revents = 0;
+
// Change the events associated with the given file descriptor.
if (ACE_OS::write (this->poll_fd_,
pfd,
sizeof (pfd)) != sizeof (pfd))
return -1;
#elif defined (ACE_HAS_EVENT_POLL)
+
struct epoll_event epev;
ACE_OS::memset (&epev, 0, sizeof (epev));
int op;
+
// ACE_Event_Handler::NULL_MASK ???
if (new_mask == 0)
{
@@ -1826,7 +2303,9 @@ ACE_Dev_Poll_Reactor::mask_ops_i (ACE_HANDLE handle,
op = EPOLL_CTL_MOD;
epev.events = events;
}
+
epev.data.fd = handle;
+
if (::epoll_ctl (this->poll_fd_, op, handle, &epev) == -1)
{
// If a handle is closed, epoll removes it from the poll set
@@ -1837,11 +2316,14 @@ ACE_Dev_Poll_Reactor::mask_ops_i (ACE_HANDLE handle,
::epoll_ctl (this->poll_fd_, EPOLL_CTL_ADD, handle, &epev) == -1)
return -1;
}
+
#else
pollfd pfd[1];
+
pfd[0].fd = handle;
pfd[0].events = events;
pfd[0].revents = 0;
+
// Change the events associated with the given file descriptor.
if (ACE_OS::write (this->poll_fd_,
pfd,
@@ -1849,35 +2331,42 @@ ACE_Dev_Poll_Reactor::mask_ops_i (ACE_HANDLE handle,
return -1;
#endif /*ACE_HAS_EVENT_POLL */
}
+
return old_mask;
}
+
int
ACE_Dev_Poll_Reactor::ready_ops (ACE_Event_Handler * /* event_handler */,
ACE_Reactor_Mask /* mask */,
int /* ops */)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::ready_ops");
+
// Since the Dev_Poll_Reactor uses the poll result buffer, the
// ready_set cannot be directly manipulated outside of the event
// loop.
ACE_NOTSUP_RETURN (-1);
}
+
int
ACE_Dev_Poll_Reactor::ready_ops (ACE_HANDLE /* handle */,
ACE_Reactor_Mask /* mask */,
int /* ops */)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::ready_ops");
+
// Since the Dev_Poll_Reactor uses the poll result buffer, the
// ready_set cannot be directly manipulated outside of the event
// loop.
ACE_NOTSUP_RETURN (-1);
}
+
void
ACE_Dev_Poll_Reactor::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_Dev_Poll_Reactor::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("restart_ = %d\n"), this->restart_));
ACE_DEBUG ((LM_DEBUG,
@@ -1891,10 +2380,12 @@ ACE_Dev_Poll_Reactor::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
short
ACE_Dev_Poll_Reactor::reactor_mask_to_poll_event (ACE_Reactor_Mask mask)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::reactor_mask_to_poll_event");
+
if (mask == ACE_Event_Handler::NULL_MASK)
// No event. Remove from interest set.
#if defined (ACE_HAS_EVENT_POLL)
@@ -1902,7 +2393,9 @@ ACE_Dev_Poll_Reactor::reactor_mask_to_poll_event (ACE_Reactor_Mask mask)
#else
return POLLREMOVE;
#endif /* ACE_HAS_EVENT_POLL */
+
short events = 0;
+
// READ, ACCEPT, and CONNECT flag will place the handle in the
// read set.
if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::READ_MASK)
@@ -1915,6 +2408,7 @@ ACE_Dev_Poll_Reactor::reactor_mask_to_poll_event (ACE_Reactor_Mask mask)
ACE_SET_BITS (events, POLLIN);
#endif /*ACE_HAS_EVENT_POLL*/
}
+
// WRITE and CONNECT flag will place the handle in the write set.
if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::WRITE_MASK)
|| ACE_BIT_ENABLED (mask, ACE_Event_Handler::CONNECT_MASK))
@@ -1925,6 +2419,7 @@ ACE_Dev_Poll_Reactor::reactor_mask_to_poll_event (ACE_Reactor_Mask mask)
ACE_SET_BITS (events, POLLOUT);
#endif /*ACE_HAS_EVENT_POLL*/
}
+
// EXCEPT flag will place the handle in the except set.
if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::EXCEPT_MASK))
{
@@ -1934,21 +2429,26 @@ ACE_Dev_Poll_Reactor::reactor_mask_to_poll_event (ACE_Reactor_Mask mask)
ACE_SET_BITS (events, POLLPRI);
#endif /*ACE_HAS_EVENT_POLL*/
}
+
return events;
}
+
namespace {
void polite_sleep_hook (void *) { }
}
+
int
ACE_Dev_Poll_Reactor::Token_Guard::acquire_quietly (ACE_Time_Value *max_wait)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::Token_Guard::acquire_quietly");
+
// Acquire the token but don't ping any waiters; just queue up politely.
int result = 0;
if (max_wait)
{
ACE_Time_Value tv = ACE_OS::gettimeofday ();
tv += *max_wait;
+
ACE_MT (result = this->token_.acquire_read (&polite_sleep_hook,
0,
&tv));
@@ -1957,6 +2457,7 @@ ACE_Dev_Poll_Reactor::Token_Guard::acquire_quietly (ACE_Time_Value *max_wait)
{
ACE_MT (result = this->token_.acquire_read (&polite_sleep_hook));
}
+
// Check for timeouts and errors.
if (result == -1)
{
@@ -1968,14 +2469,18 @@ ACE_Dev_Poll_Reactor::Token_Guard::acquire_quietly (ACE_Time_Value *max_wait)
return -1;
}
}
+
// We got the token and so let us mark ourselves as owner
this->owner_ = 1;
+
return result;
}
+
int
ACE_Dev_Poll_Reactor::Token_Guard::acquire (ACE_Time_Value *max_wait)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor::Token_Guard::acquire");
+
// Try to grab the token. If someone if already there, don't wake
// them up, just queue up in the thread pool.
int result = 0;
@@ -1983,12 +2488,14 @@ ACE_Dev_Poll_Reactor::Token_Guard::acquire (ACE_Time_Value *max_wait)
{
ACE_Time_Value tv = ACE_OS::gettimeofday ();
tv += *max_wait;
+
ACE_MT (result = this->token_.acquire (0, 0, &tv));
}
else
{
ACE_MT (result = this->token_.acquire ());
}
+
// Check for timeouts and errors.
if (result == -1)
{
@@ -1997,10 +2504,14 @@ ACE_Dev_Poll_Reactor::Token_Guard::acquire (ACE_Time_Value *max_wait)
else
return -1;
}
+
// We got the token and so let us mark ourseleves as owner
this->owner_ = 1;
+
return result;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_EVENT_POLL || ACE_HAS_DEV_POLL */
diff --git a/dep/ACE_wrappers/ace/Dev_Poll_Reactor.h b/dep/ACE_wrappers/ace/Dev_Poll_Reactor.h
index 14464f33439..c675999bb4c 100644
--- a/dep/ACE_wrappers/ace/Dev_Poll_Reactor.h
+++ b/dep/ACE_wrappers/ace/Dev_Poll_Reactor.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
// =========================================================================
/**
* @file Dev_Poll_Reactor.h
@@ -11,34 +12,46 @@
*/
// =========================================================================
+
#ifndef ACE_DEV_POLL_REACTOR_H
#define ACE_DEV_POLL_REACTOR_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_EVENT_POLL) && defined (ACE_HAS_DEV_POLL)
# error ACE_HAS_EVENT_POLL and ACE_HAS_DEV_POLL are mutually exclusive.
#endif /* ACE_HAS_EVENT_POLL && defined ACE_HAS_DEV_POLL */
+
#if defined (ACE_HAS_EVENT_POLL) || defined (ACE_HAS_DEV_POLL)
+
#include "ace/Pipe.h"
#include "ace/Lock_Adapter_T.h"
#include "ace/Reactor_Impl.h"
#include "ace/Reactor_Token_T.h"
#include "ace/Token.h"
+
#if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE)
# include "ace/Notification_Queue.h"
#endif /* ACE_HAS_REACTOR_NOTIFICATION_QUEUE */
+
#if defined (ACE_HAS_DEV_POLL)
struct pollfd;
#elif defined (ACE_HAS_EVENT_POLL)
struct epoll_event;
#endif
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward declarations
class ACE_Sig_Handler;
class ACE_Dev_Poll_Reactor;
+
/**
* @class ACE_Dev_Poll_Event_Tuple
*
@@ -59,17 +72,24 @@ class ACE_Dev_Poll_Reactor;
class ACE_Dev_Poll_Event_Tuple
{
public:
+
/// Constructor.
ACE_Dev_Poll_Event_Tuple (void);
+
public:
+
/// The event handler.
ACE_Event_Handler *event_handler;
+
/// The event mask for the above event handler.
ACE_Reactor_Mask mask;
+
/// Flag that states whether or not the event handler is suspended.
char suspended;
};
+
// ---------------------------------------------------------------------
+
#if 0
/**
* @class ACE_Dev_Poll_Ready_Set
@@ -98,17 +118,24 @@ public:
class ACE_Dev_Poll_Ready_Set
{
public:
+
/// Constructor.
ACE_Dev_Poll_Ready_Set (void);
+
public:
+
/// The array containing the pollfd structures corresponding to the
/// "ready" file descriptors.
struct pollfd *pfds;
+
/// The number of "ready" file descriptors in the above array.
int nfds;
+
};
#endif /* 0 */
+
// ---------------------------------------------------------------------
+
/**
* @class ACE_Dev_Poll_Reactor_Notify
*
@@ -122,8 +149,10 @@ public:
class ACE_Dev_Poll_Reactor_Notify : public ACE_Reactor_Notify
{
public:
+
/// Constructor
ACE_Dev_Poll_Reactor_Notify (void);
+
/**
* @name Initialization and Termination Methods
*
@@ -134,6 +163,7 @@ public:
ACE_Timer_Queue *timer_queue = 0,
int disable_notify = 0);
virtual int close (void);
+
/**
* Called by a thread when it wants to unblock the Reactor_Impl.
* This wakes up the Reactor_Impl if currently blocked. Pass over
@@ -147,6 +177,7 @@ public:
virtual int notify (ACE_Event_Handler *eh = 0,
ACE_Reactor_Mask mask = ACE_Event_Handler::EXCEPT_MASK,
ACE_Time_Value *timeout = 0);
+
/// Unimplemented method required by pure virtual method in abstract
/// base class.
/**
@@ -156,22 +187,28 @@ public:
*/
virtual int dispatch_notifications (int &number_of_active_handles,
ACE_Handle_Set &rd_mask);
+
/// Returns the ACE_HANDLE of the notify pipe on which the reactor
/// is listening for notifications so that other threads can unblock
/// the Reactor_Impl.
virtual ACE_HANDLE notify_handle (void);
+
/// Verify whether the buffer has dispatchable info or not.
virtual int is_dispatchable (ACE_Notification_Buffer &buffer);
+
/// Handle one notify call represented in @a buffer. This could be
/// because of a thread trying to unblock the Reactor_Impl.
virtual int dispatch_notify (ACE_Notification_Buffer &buffer);
+
/// Read one notify call on the handle into @a buffer.
/// This could be because of a thread trying to unblock the Reactor_Impl.
virtual int read_notify_pipe (ACE_HANDLE handle,
ACE_Notification_Buffer &buffer);
+
/// Called back by the ACE_Dev_Poll_Reactor when a thread wants to
/// unblock us.
virtual int handle_input (ACE_HANDLE handle);
+
/**
* Set the maximum number of times that the handle_input method
* will iterate and dispatch the ACE_Event_Handlers that are
@@ -182,6 +219,7 @@ public:
* of slightly higher dispatching overhead.
*/
virtual void max_notify_iterations (int);
+
/**
* Get the maximum number of times that the handle_input method
* will iterate and dispatch the ACE_Event_Handlers that are
@@ -189,6 +227,7 @@ public:
* loop.
*/
virtual int max_notify_iterations (void);
+
/**
* Purge any notifications pending in this reactor for the specified
* ACE_Event_Handler object. Returns the number of notifications
@@ -197,21 +236,26 @@ public:
virtual int purge_pending_notifications (
ACE_Event_Handler * = 0,
ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK);
+
/// Dump the state of an object.
virtual void dump (void) const;
+
protected:
+
/**
* Keep a back pointer to the ACE_Dev_Poll_Reactor. If this value
* if NULL then the ACE_Dev_Poll_Reactor has been initialized with
* disable_notify_pipe.
*/
ACE_Dev_Poll_Reactor *dp_reactor_;
+
/**
* Contains the ACE_HANDLE the ACE_Dev_Poll_Reactor is listening
* on, as well as the ACE_HANDLE that threads wanting the attention
* of the ACE_Dev_Poll_Reactor will write to.
*/
ACE_Pipe notification_pipe_;
+
/**
* Keeps track of the maximum number of times that the
* ACE_Dev_Poll_Reactor_Notify::handle_input method will iterate and
@@ -220,6 +264,7 @@ protected:
* this is set to -1, which means "iterate until the pipe is empty."
*/
int max_notify_iterations_;
+
#if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE)
/**
* @brief A user-space queue to store the notifications.
@@ -234,12 +279,16 @@ protected:
*/
ACE_Notification_Queue notification_queue_;
#endif /* ACE_HAS_REACTOR_NOTIFICATION_QUEUE */
+
};
+
// ---------------------------------------------------------------------
+
/**
* @class ACE_Dev_Poll_Reactor_Handler_Repository
*
* @internal
+
* @brief Used to map ACE_HANDLEs onto the appropriate
* ACE_Event_Handler *.
*
@@ -251,48 +300,62 @@ protected:
class ACE_Dev_Poll_Reactor_Handler_Repository
{
public:
+
/// Constructor.
ACE_Dev_Poll_Reactor_Handler_Repository (void);
+
/// Initialize a repository of the appropriate @a size.
int open (size_t size);
+
/// Close down the repository.
int close (void);
+
/**
* @name Repository Manipulation Operations
*
* Methods used to search and modify the handler repository.
*/
//@{
+
/**
* Return the @c ACE_Event_Handler associated with @c ACE_HANDLE. If
* @a index_p is non-zero, then return the index location of the
* handle, if found.
*/
ACE_Event_Handler *find (ACE_HANDLE handle, size_t *index_p = 0);
+
/// Set the event mask for event handler associated with the given
/// handle.
void mask (ACE_HANDLE handle, ACE_Reactor_Mask mask);
+
/// Retrieve the event mask for the event handler associated with
/// the given handle.
ACE_Reactor_Mask mask (ACE_HANDLE handle);
+
/// Mark the event handler associated with the given handle as
/// "suspended."
void suspend (ACE_HANDLE handle);
+
/// Mark the event handler associated with the given handle as
/// "resumed."
void resume (ACE_HANDLE handle);
+
/// Is the event handler for the given handle suspended?
int suspended (ACE_HANDLE handle) const;
+
/// Bind the ACE_Event_Handler to the @c ACE_HANDLE with the
/// appropriate ACE_Reactor_Mask settings.
int bind (ACE_HANDLE handle,
ACE_Event_Handler *handler,
ACE_Reactor_Mask mask);
+
/// Remove the binding for @c ACE_HANDLE; optionally decrement the associated
/// handler's reference count.
int unbind (ACE_HANDLE handle, bool decr_refcnt = true);
+
/// Remove all the (@c ACE_HANDLE, @c ACE_Event_Handler) tuples.
int unbind_all (void);
+
/**
* @name Sanity Checking
*
@@ -300,32 +363,44 @@ public:
* underlying handler array.
*/
//@{
+
// Check the @a handle to make sure it's a valid @c ACE_HANDLE that
// within the range of legal handles (i.e., greater than or equal to
// zero and less than @c max_size_).
int invalid_handle (ACE_HANDLE handle) const;
+
// Check the handle to make sure it's a valid @c ACE_HANDLE that is
// within the range of currently registered handles (i.e., greater
// than or equal to zero and less than @c max_handlep1_).
int handle_in_range (ACE_HANDLE handle) const;
+
//@}
+
/// Returns the current table size.
size_t size (void) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
+
/// Maximum number of handles.
int max_size_;
+
/// The underlying array of event handlers.
/**
* The array of event handlers is directly indexed directly using
* an @c ACE_HANDLE value. This is Unix-specific.
*/
ACE_Dev_Poll_Event_Tuple *handlers_;
+
};
+
// ---------------------------------------------------------------------
+
/**
* @class ACE_Dev_Poll_Reactor
*
@@ -359,15 +434,18 @@ private:
* sub-millisecond timeout resolutions for timers but that is
* entirely platform dependent.
*/
+
#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
typedef ACE_Token ACE_DEV_POLL_TOKEN;
#else
typedef ACE_Noop_Token ACE_DEV_POLL_TOKEN;
#endif /* ACE_MT_SAFE && ACE_MT_SAFE != 0 */
typedef ACE_Reactor_Token_T<ACE_DEV_POLL_TOKEN> ACE_Dev_Poll_Reactor_Token;
+
class ACE_Export ACE_Dev_Poll_Reactor : public ACE_Reactor_Impl
{
public:
+
/// Initialize @c ACE_Dev_Poll_Reactor with the default size.
/**
* The default size for the @c ACE_Dev_Poll_Reactor is the maximum
@@ -379,6 +457,7 @@ public:
ACE_Reactor_Notify *notify = 0,
int mask_signals = 1,
int s_queue = ACE_DEV_POLL_TOKEN::FIFO);
+
/// Initialize ACE_Dev_Poll_Reactor with size @a size.
/**
* @note On Unix platforms, the @a size parameter should be as large
@@ -399,8 +478,10 @@ public:
ACE_Reactor_Notify *notify = 0,
int mask_signals = 1,
int s_queue = ACE_DEV_POLL_TOKEN::FIFO);
+
/// Close down and release all resources.
virtual ~ACE_Dev_Poll_Reactor (void);
+
/// Initialization.
virtual int open (size_t size,
int restart = 0,
@@ -408,6 +489,7 @@ public:
ACE_Timer_Queue * = 0,
int disable_notify_pipe = 0,
ACE_Reactor_Notify * = 0);
+
/**
* @param handle allows the reactor to check if the caller is
* valid.
@@ -416,15 +498,20 @@ public:
* size. -1 if not.
*/
virtual int current_info (ACE_HANDLE handle, size_t & /* size */);
+
/// Use a user specified signal handler instead.
virtual int set_sig_handler (ACE_Sig_Handler *signal_handler);
+
/// Set a user-specified timer queue.
virtual int timer_queue (ACE_Timer_Queue *tq);
+
/// Get the timer queue
/// @return The current @c ACE_Timer_Queue.
virtual ACE_Timer_Queue *timer_queue (void) const;
+
/// Close down and release all resources.
virtual int close (void);
+
// = Event loop drivers.
/**
* Returns non-zero if there are I/O events "ready" for dispatching,
@@ -436,6 +523,7 @@ public:
*/
virtual int work_pending (
const ACE_Time_Value &max_wait_time = ACE_Time_Value::zero);
+
/**
* This event loop driver blocks for up to @a max_wait_time before
* returning. It will return earlier if events occur. Note that
@@ -457,11 +545,13 @@ public:
* @return The total number of @c ACE_Event_Handlers that were
* dispatched, 0 if the @a max_wait_time elapsed without
* dispatching any handlers, or -1 if an error occurs.
+
* @note It is only possible to achieve millisecond timeout
* resolutions with the @c ACE_Dev_Poll_Reactor.
*/
virtual int handle_events (ACE_Time_Value *max_wait_time = 0);
virtual int alertable_handle_events (ACE_Time_Value *max_wait_time = 0);
+
/**
* This method is just like the one above, except the
* @a max_wait_time value is a reference and can therefore never be
@@ -472,7 +562,9 @@ public:
*/
virtual int handle_events (ACE_Time_Value &max_wait_time);
virtual int alertable_handle_events (ACE_Time_Value &max_wait_time);
+
// = Event handling control.
+
/**
* @return The status of Reactor. If this function returns 0, the
* reactor is actively handling events. If it returns
@@ -480,6 +572,7 @@ public:
* @c handle_alertable_events() return -1 immediately.
*/
virtual int deactivated (void);
+
/**
* Control whether the Reactor will handle any more incoming events
* or not. If @a do_stop == 1, the Reactor will be disabled. By
@@ -487,16 +580,20 @@ public:
* deactivated/reactived as desired.
*/
virtual void deactivate (int do_stop);
+
// = Register and remove Handlers.
+
/// Register @a event_handler with @a mask. The I/O handle will
/// always come from get_handle on the event_handler.
virtual int register_handler (ACE_Event_Handler *event_handler,
ACE_Reactor_Mask mask);
+
/// Register @a event_handler with @a mask. The I/O handle is
/// provided through the @a io_handle parameter.
virtual int register_handler (ACE_HANDLE io_handle,
ACE_Event_Handler *event_handler,
ACE_Reactor_Mask mask);
+
/**
* Register an @a event_handler that will be notified when
* @a event_handle is signaled. @a mask specifies the network
@@ -506,11 +603,13 @@ public:
ACE_HANDLE io_handle,
ACE_Event_Handler *event_handler,
ACE_Reactor_Mask mask);
+
/// Register @a event_handler> with all the @a handles> in the @c
/// Handle_Set.
virtual int register_handler (const ACE_Handle_Set &handles,
ACE_Event_Handler *event_handler,
ACE_Reactor_Mask mask);
+
/**
* Register @a new_sh to handle the signal @a signum using the
* @a new_disp. Returns the @a old_sh that was previously
@@ -522,11 +621,13 @@ public:
ACE_Sig_Action *new_disp = 0,
ACE_Event_Handler **old_sh = 0,
ACE_Sig_Action *old_disp = 0);
+
/// Registers <new_sh> to handle a set of signals <sigset> using the
/// <new_disp>.
virtual int register_handler (const ACE_Sig_Set &sigset,
ACE_Event_Handler *new_sh,
ACE_Sig_Action *new_disp = 0);
+
/// Removes @a event_handler.
/**
* @note The I/O handle will be obtained using @c get_handle()
@@ -536,6 +637,7 @@ public:
*/
virtual int remove_handler (ACE_Event_Handler *event_handler,
ACE_Reactor_Mask mask);
+
/**
* Removes @a handle. If @a mask == ACE_Event_Handler::DONT_CALL
* then the <handle_close> method of the associated <event_handler>
@@ -543,6 +645,7 @@ public:
*/
virtual int remove_handler (ACE_HANDLE handle,
ACE_Reactor_Mask mask);
+
/**
* Removes all handles in <handle_set>. If @a mask ==
* ACE_Event_Handler::DONT_CALL then the <handle_close> method of
@@ -550,6 +653,7 @@ public:
*/
virtual int remove_handler (const ACE_Handle_Set &handle_set,
ACE_Reactor_Mask mask);
+
/**
* Remove the ACE_Event_Handler currently associated with @a signum.
* Install the new disposition (if given) and return the previous
@@ -560,35 +664,49 @@ public:
ACE_Sig_Action *new_disp,
ACE_Sig_Action *old_disp = 0,
int sigkey = -1);
+
/// Calls <remove_handler> for every signal in <sigset>.
virtual int remove_handler (const ACE_Sig_Set &sigset);
+
// = Suspend and resume Handlers.
+
/// Suspend event_handler temporarily. Use
/// ACE_Event_Handler::get_handle() to get the handle.
virtual int suspend_handler (ACE_Event_Handler *event_handler);
+
/// Suspend handle temporarily.
virtual int suspend_handler (ACE_HANDLE handle);
+
/// Suspend all handles in handle set temporarily.
virtual int suspend_handler (const ACE_Handle_Set &handles);
+
/// Suspend all handles temporarily.
virtual int suspend_handlers (void);
+
/// Resume event_handler. Use ACE_Event_Handler::get_handle() to
/// get the handle.
virtual int resume_handler (ACE_Event_Handler *event_handler);
+
/// Resume handle.
virtual int resume_handler (ACE_HANDLE handle);
+
/// Resume all handles in handle set.
virtual int resume_handler (const ACE_Handle_Set &handles);
+
/// Resume all handles.
virtual int resume_handlers (void);
+
/// Does the reactor allow the application to resume the handle on
/// its own, i.e., can it pass on the control of handle resumption to
/// the application.
virtual int resumable_handler (void);
+
/// Return 1 if we any event associations were made by the reactor
/// for the handles that it waits on, 0 otherwise.
virtual int uses_event_associations (void);
+
// = Timer management.
+
/**
* Schedule an ACE_Event_Handler that will expire after an amount
* of time. The return value of this method, a timer_id value,
@@ -612,6 +730,7 @@ public:
const void *arg,
const ACE_Time_Value &delay,
const ACE_Time_Value &interval = ACE_Time_Value::zero);
+
/**
* Resets the interval of the timer represented by @a timer_id to
* @a interval, which is specified in relative time to the current
@@ -621,10 +740,12 @@ public:
*/
virtual int reset_timer_interval (long timer_id,
const ACE_Time_Value &interval);
+
/// Cancel all Event_Handlers that match the address of
/// @a event_handler. Returns number of handlers cancelled.
virtual int cancel_timer (ACE_Event_Handler *event_handler,
int dont_call_handle_close = 1);
+
/**
* Cancel the single event handler that matches the @a timer_id value
* (which was returned from the schedule method). If @a arg is
@@ -637,22 +758,29 @@ public:
virtual int cancel_timer (long timer_id,
const void **arg = 0,
int dont_call_handle_close = 1);
+
// = High-level event handler scheduling operations
+
/// Add @a masks_to_be_added to the @a event_handler's entry.
/// @a event_handler must already have been registered.
virtual int schedule_wakeup (ACE_Event_Handler *event_handler,
ACE_Reactor_Mask masks_to_be_added);
+
/// Add @a masks_to_be_added to the @a handle's entry. <event_handler>
/// associated with @a handle must already have been registered.
virtual int schedule_wakeup (ACE_HANDLE handle,
ACE_Reactor_Mask masks_to_be_added);
+
/// Clear @a masks_to_be_cleared from the @a event_handler's entry.
virtual int cancel_wakeup (ACE_Event_Handler *event_handler,
ACE_Reactor_Mask masks_to_be_cleared);
+
/// Clear @a masks_to_be_cleared from the @a handle's entry.
virtual int cancel_wakeup (ACE_HANDLE handle,
ACE_Reactor_Mask masks_to_be_cleared);
+
// = Notification methods.
+
/**
* Notify @a event_handler of @a mask event. The ACE_Time_Value
* indicates how long to blocking trying to notify. If @a timeout ==
@@ -662,6 +790,7 @@ public:
virtual int notify (ACE_Event_Handler *event_handler = 0,
ACE_Reactor_Mask mask = ACE_Event_Handler::EXCEPT_MASK,
ACE_Time_Value * = 0);
+
/**
* Set the maximum number of times that ACE_Reactor_Impl will
* iterate and dispatch the <ACE_Event_Handlers> that are passed in
@@ -673,6 +802,7 @@ public:
* overhead.
*/
virtual void max_notify_iterations (int);
+
/**
* Get the maximum number of times that the ACE_Reactor_Impl will
* iterate and dispatch the <ACE_Event_Handlers> that are passed in
@@ -680,6 +810,7 @@ public:
* <ACE_Message_Queue::dequeue> loop.
*/
virtual int max_notify_iterations (void);
+
/**
* Purge any notifications pending in this reactor for the specified
* ACE_Event_Handler object. Returns the number of notifications
@@ -687,11 +818,13 @@ public:
*/
virtual int purge_pending_notifications (ACE_Event_Handler * = 0,
ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK);
+
/**
* Return the Event_Handler associated with @a handle. Return 0 if
* @a handle is not registered.
*/
virtual ACE_Event_Handler *find_handler (ACE_HANDLE handle);
+
/**
* Check to see if @a handle is associated with a valid Event_Handler
* bound to @a mask. Return the @a event_handler associated with this
@@ -700,6 +833,7 @@ public:
virtual int handler (ACE_HANDLE handle,
ACE_Reactor_Mask mask,
ACE_Event_Handler **event_handler = 0);
+
/**
* Check to see if @a signum is associated with a valid Event_Handler
* bound to a signal. Return the @a event_handler associated with
@@ -707,16 +841,21 @@ public:
*/
virtual int handler (int signum,
ACE_Event_Handler ** = 0);
+
/// Returns true if Reactor has been successfully initialized, else
/// false.
virtual bool initialized (void);
+
/// Returns the current size of the Reactor's internal descriptor
/// table.
virtual size_t size (void) const;
+
/// Returns a reference to the Reactor's internal lock.
virtual ACE_Lock &lock (void);
+
/// Wake up all threads waiting in the event loop.
virtual void wakeup_all_threads (void);
+
/// Transfers ownership of Reactor_Impl to the new_owner.
/**
* @note There is no need to set the owner of the event loop for the
@@ -725,6 +864,7 @@ public:
* no-op.
*/
virtual int owner (ACE_thread_t new_owner, ACE_thread_t *old_owner = 0);
+
/// Return the ID of the "owner" thread.
/**
* @note There is no need to set the owner of the event loop for the
@@ -733,8 +873,10 @@ public:
* no-op.
*/
virtual int owner (ACE_thread_t *owner);
+
/// Get the existing restart value.
virtual int restart (void);
+
/// Set a new value for restart and return the original value.
/**
* @param r If zero, then the event loop will not be automatically
@@ -744,16 +886,19 @@ public:
* @return Returns the previous "restart" value.
*/
virtual int restart (int r);
+
/// Set position of the owner thread.
/**
* @note This is currently a no-op.
*/
virtual void requeue_position (int);
+
/// Get position of the owner thread.
/**
* @note This is currently a no-op.
*/
virtual int requeue_position (void);
+
/**
* @name Low-level wait_set mask manipulation methods
*
@@ -764,6 +909,7 @@ public:
* manipulated with these methods.
*/
//@{
+
/// GET/SET/ADD/CLR the dispatch mask "bit" bound with the
/// event_handler and mask.
/**
@@ -772,6 +918,7 @@ public:
virtual int mask_ops (ACE_Event_Handler *event_handler,
ACE_Reactor_Mask mask,
int ops);
+
/// GET/SET/ADD/CLR the dispatch MASK "bit" bound with the handle
/// and mask.
/**
@@ -780,29 +927,39 @@ public:
virtual int mask_ops (ACE_HANDLE handle,
ACE_Reactor_Mask mask,
int ops);
+
//@}
+
/**
* @name Low-level ready_set mask manipulation methods
*
* These methods are unimplemented.
*/
//@{
+
/// GET/SET/ADD/CLR the ready "bit" bound with the event_handler
/// and mask.
virtual int ready_ops (ACE_Event_Handler *event_handler,
ACE_Reactor_Mask mask,
int ops);
+
/// GET/SET/ADD/CLR the ready "bit" bound with the handle and mask.
virtual int ready_ops (ACE_HANDLE handle,
ACE_Reactor_Mask,
int ops);
+
//@}
+
/// Dump the state of an object.
virtual void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
+
class Token_Guard;
+
/// Non-locking version of wait_pending().
/**
* Returns non-zero if there are I/O events "ready" for dispatching,
@@ -813,45 +970,55 @@ protected:
* resolutions with the ACE_Dev_Poll_Reactor.
*/
int work_pending_i (ACE_Time_Value *max_wait_time);
+
/// Poll for events and return the number of event handlers that
/// were dispatched.
/**
* This is a helper method called by all handle_events() methods.
*/
int handle_events_i (ACE_Time_Value *max_wait_time, Token_Guard &guard);
+
/// Perform the upcall with the given event handler method.
int upcall (ACE_Event_Handler *event_handler,
int (ACE_Event_Handler::*callback)(ACE_HANDLE),
ACE_HANDLE handle);
+
/**
* Dispatch ACE_Event_Handlers for time events, I/O events, and
* signal events. Returns the total number of ACE_Event_Handlers
* that were dispatched or -1 if something goes wrong.
*/
int dispatch (Token_Guard &guard);
+
/// Dispatch a single timer, if ready.
/// Returns: 0 if no timers ready (token still held),
/// 1 if a timer was expired (token released),
/// -1 on error (token still held).
int dispatch_timer_handler (Token_Guard &guard);
+
/// Dispatch an IO event to the corresponding event handler. Returns
/// Returns: 0 if no events ready (token still held),
/// 1 if an event was expired (token released),
/// -1 on error (token still held).
int dispatch_io_event (Token_Guard &guard);
+
/// Register the given event handler with the reactor.
int register_handler_i (ACE_HANDLE handle,
ACE_Event_Handler *eh,
ACE_Reactor_Mask mask);
+
/// Remove the event handler associated with the given handle and
/// event mask from the "interest set."
int remove_handler_i (ACE_HANDLE handle, ACE_Reactor_Mask mask);
+
/// Temporarily remove the given handle from the "interest set."
int suspend_handler_i (ACE_HANDLE handle);
+
/// Place the given handle that was temporarily removed from the
/// "interest set," i.e that was suspended, back in to the interest
/// set. The given handle will once again be polled for events.
int resume_handler_i (ACE_HANDLE handle);
+
/// GET/SET/ADD/CLR the dispatch MASK "bit" bound with the handle
/// and mask. This internal helper method acquires no lock.
/**
@@ -860,11 +1027,15 @@ protected:
int mask_ops_i (ACE_HANDLE handle,
ACE_Reactor_Mask mask,
int ops);
+
/// Convert a reactor mask to its corresponding poll() event mask.
short reactor_mask_to_poll_event (ACE_Reactor_Mask mask);
+
protected:
+
/// Has the reactor been initialized.
bool initialized_;
+
/// The file descriptor associated with the open `/dev/poll' or
/// `/dev/epoll' device.
/**
@@ -872,31 +1043,39 @@ protected:
* done through this file descriptor.
*/
ACE_HANDLE poll_fd_;
+
/// The maximum number of file descriptors over which demultiplexing
/// will occur.
size_t size_;
+
/// Track HANDLES we are interested in for various events that must
/// be dispatched *without* polling.
/// ACE_Dev_Poll_Ready_Set ready_set_;
+
#if defined (ACE_HAS_EVENT_POLL)
/// Table of event structures to be filled by epoll_wait:
struct epoll_event *events_;
+
/// Pointer to the next epoll_event array element that contains the next
/// event to be dispatched.
struct epoll_event *start_pevents_;
+
/// The last element in the event array plus one.
/**
* The loop that dispatches IO events stops when this->start_pevents_ ==
* this->end_pevents_.
*/
struct epoll_event *end_pevents_;
+
#else
/// The pollfd array that `/dev/poll' will feed its results to.
struct pollfd *dp_fds_;
+
/// Pointer to the next pollfd array element that contains the next
/// event to be dispatched.
struct pollfd *start_pfds_;
+
/// The last element in the pollfd array plus one.
/**
* The loop that dispatches IO events stops when this->start_pfds ==
@@ -904,31 +1083,42 @@ protected:
*/
struct pollfd *end_pfds_;
#endif /* ACE_HAS_EVENT_POLL */
+
/// This flag is used to keep track of whether we are actively handling
/// events or not.
sig_atomic_t deactivated_;
+
/// Lock used for synchronization of reactor state.
ACE_Dev_Poll_Reactor_Token token_;
+
/// Adapter used to return internal lock to outside world.
ACE_Lock_Adapter<ACE_Dev_Poll_Reactor_Token> lock_adapter_;
+
/// The repository that contains all registered event handlers.
ACE_Dev_Poll_Reactor_Handler_Repository handler_rep_;
+
/// Defined as a pointer to allow overriding by derived classes...
ACE_Timer_Queue *timer_queue_;
+
/// Keeps track of whether we should delete the timer queue (if we
/// didn't create it, then we don't delete it).
bool delete_timer_queue_;
+
/// Handle signals without requiring global/static variables.
ACE_Sig_Handler *signal_handler_;
+
/// Keeps track of whether we should delete the signal handler (if we
/// didn't create it, then we don't delete it).
bool delete_signal_handler_;
+
/// Callback object that unblocks the <ACE_Select_Reactor> if it's
/// sleeping.
ACE_Reactor_Notify *notify_handler_;
+
/// Keeps track of whether we need to delete the notify handler (if
/// we didn't create it, then we don't delete it).
bool delete_notify_handler_;
+
/// Flag that determines if signals are masked during event
/// dispatching.
/**
@@ -938,11 +1128,14 @@ protected:
* introduce by the kernel level locks required to change the mask.
*/
int mask_signals_;
+
/// Restart the handle_events event loop method automatically when
/// polling function in use (ioctl() in this case) is interrupted
/// via an EINTR signal.
int restart_;
+
protected:
+
/**
* @class Token_Guard
*
@@ -952,16 +1145,21 @@ protected:
class ACE_Export Token_Guard
{
public:
+
/// Constructor that will grab the token for us
Token_Guard (ACE_Dev_Poll_Reactor_Token &token);
+
/// Destructor. This will release the token if it hasn't been
/// released till this point
~Token_Guard (void);
+
/// Release the token ..
void release_token (void);
+
/// Returns whether the thread that created this object owns the
/// token or not.
int is_owner (void);
+
/// A helper method that acquires the token 1) at a low priority, and
/// 2) wait quietly for the token, not waking another thread. This
/// is appropriate for cases where a thread wants to wait for and
@@ -969,22 +1167,31 @@ protected:
/// token, and also queueing up behind other threads waiting to modify
/// event records.
int acquire_quietly (ACE_Time_Value *max_wait = 0);
+
/// A helper method that acquires the token at a high priority, and
/// does wake the current token holder.
int acquire (ACE_Time_Value *max_wait = 0);
+
private:
+
Token_Guard (void);
+
private:
+
/// The Reactor token.
ACE_Dev_Poll_Reactor_Token &token_;
+
/// Flag that indicate whether the thread that created this object
/// owns the token or not. A value of 0 indicates that this class
/// hasn't got the token (and hence the thread) and a value of 1
/// vice-versa.
int owner_;
+
};
+
};
+
/**
* @class ACE_Dev_Poll_Handler_Guard
*
@@ -999,6 +1206,7 @@ protected:
class ACE_Dev_Poll_Handler_Guard
{
public:
+
/// Constructor
/**
* The constructor checks to see if @a eh is a reference-counted handler and
@@ -1009,26 +1217,37 @@ public:
* the reference count is incremented when the notify is queued.
*/
ACE_Dev_Poll_Handler_Guard (ACE_Event_Handler *eh, bool do_incr = true);
+
/// Destructor
/**
* The destructor decrements the reference count on the event
* handler corresponding to the given handle.
*/
~ACE_Dev_Poll_Handler_Guard (void);
+
/// Release the event handler from this guard; when the destructor is
/// called, the handler's reference count will not be decremented.
void release (void);
+
private:
+
/// The event handler being managed.
ACE_Event_Handler *eh_;
+
/// true if eh_ is a reference-counted handler.
bool refcounted_;
+
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
# include "ace/Dev_Poll_Reactor.inl"
#endif /* __ACE_INLINE__ */
+
#endif /* ACE_HAS_EVENT_POLL || ACE_HAS_DEV_POLL */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_DEV_POLL_REACTOR_H */
diff --git a/dep/ACE_wrappers/ace/Dev_Poll_Reactor.inl b/dep/ACE_wrappers/ace/Dev_Poll_Reactor.inl
index bd11e66ebe6..96e71f2dea5 100644
--- a/dep/ACE_wrappers/ace/Dev_Poll_Reactor.inl
+++ b/dep/ACE_wrappers/ace/Dev_Poll_Reactor.inl
@@ -1,8 +1,11 @@
// -*- C++ -*-
//
// $Id: Dev_Poll_Reactor.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Log_Msg.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_Dev_Poll_Event_Tuple::ACE_Dev_Poll_Event_Tuple (void)
: event_handler (0),
@@ -10,7 +13,9 @@ ACE_Dev_Poll_Event_Tuple::ACE_Dev_Poll_Event_Tuple (void)
suspended (0)
{
}
+
// ---------------------------------------------------------------------
+
#if 0
ACE_INLINE
ACE_Dev_Poll_Ready_Set::ACE_Dev_Poll_Ready_Set (void)
@@ -19,59 +24,78 @@ ACE_Dev_Poll_Ready_Set::ACE_Dev_Poll_Ready_Set (void)
{
}
#endif /* 0 */
+
// ---------------------------------------------------------------------
+
ACE_INLINE void
ACE_Dev_Poll_Reactor_Handler_Repository::mask (ACE_HANDLE handle,
ACE_Reactor_Mask mask)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor_Handler_Repository::mask");
+
// Only bother to search for the handle if it's in range.
if (this->handle_in_range (handle))
this->handlers_[handle].mask = mask;
}
+
ACE_INLINE ACE_Reactor_Mask
ACE_Dev_Poll_Reactor_Handler_Repository::mask (ACE_HANDLE handle)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor_Handler_Repository::mask");
+
ACE_Reactor_Mask mask = ACE_Event_Handler::NULL_MASK;
+
// Only bother to search for the handle if it's in range.
if (this->handle_in_range (handle))
mask = this->handlers_[handle].mask;
+
if (mask == ACE_Event_Handler::NULL_MASK)
errno = ENOENT;
+
return mask;
}
+
ACE_INLINE void
ACE_Dev_Poll_Reactor_Handler_Repository::suspend (ACE_HANDLE handle)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor_Handler_Repository::suspend");
+
// Only bother to search for the handle if it's in range.
if (this->handle_in_range (handle))
this->handlers_[handle].suspended = 1;
}
+
ACE_INLINE void
ACE_Dev_Poll_Reactor_Handler_Repository::resume (ACE_HANDLE handle)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor_Handler_Repository::resume");
+
// Only bother to search for the handle if it's in range.
if (this->handle_in_range (handle))
this->handlers_[handle].suspended = 0;
}
+
ACE_INLINE int
ACE_Dev_Poll_Reactor_Handler_Repository::suspended (ACE_HANDLE handle) const
{
ACE_TRACE ("ACE_Dev_Poll_Reactor_Handler_Repository::suspended");
+
if (this->handle_in_range (handle))
return this->handlers_[handle].suspended;
+
return -1;
}
+
ACE_INLINE size_t
ACE_Dev_Poll_Reactor_Handler_Repository::size (void) const
{
ACE_TRACE ("ACE_Dev_Poll_Reactor_Handler_Repository::size");
+
return this->max_size_;
}
+
// -----------------------------------------------------------------
+
ACE_INLINE
ACE_Dev_Poll_Handler_Guard::ACE_Dev_Poll_Handler_Guard
(ACE_Event_Handler *eh,
@@ -81,15 +105,19 @@ ACE_Dev_Poll_Handler_Guard::ACE_Dev_Poll_Handler_Guard
{
if (eh == 0)
return;
+
this->refcounted_ =
eh->reference_counting_policy ().value () ==
ACE_Event_Handler::Reference_Counting_Policy::ENABLED;
+
if (do_incr && this->refcounted_)
eh->add_reference ();
+
/**
* The below comments were here when I replaced the old refcount
* scheme was replaced. They may still need addressing. -Steve Huston
*/
+
/**
* @todo Suspend the handler so that other threads will not cause
* an event that is already in an upcall from being dispatched
@@ -112,11 +140,13 @@ ACE_Dev_Poll_Handler_Guard::ACE_Dev_Poll_Handler_Guard
* repository.
*/
}
+
ACE_INLINE
ACE_Dev_Poll_Handler_Guard::~ACE_Dev_Poll_Handler_Guard (void)
{
if (this->refcounted_ && this->eh_ != 0)
this->eh_->remove_reference ();
+
/**
* The below comments were here when I replaced the old refcount
* scheme was replaced. They may still need addressing. -Steve Huston
@@ -126,12 +156,15 @@ ACE_Dev_Poll_Handler_Guard::~ACE_Dev_Poll_Handler_Guard (void)
* dispatch the handler.
*/
}
+
ACE_INLINE void
ACE_Dev_Poll_Handler_Guard::release (void)
{
this->eh_ = 0;
}
+
// ---------------------------------------------------------------------
+
ACE_INLINE int
ACE_Dev_Poll_Reactor::upcall (ACE_Event_Handler *event_handler,
int (ACE_Event_Handler::*callback)(ACE_HANDLE),
@@ -141,23 +174,29 @@ ACE_Dev_Poll_Reactor::upcall (ACE_Event_Handler *event_handler,
// callback) just call back as many times as the handler requests
// it. Other threads are off handling other things.
int status = 0;
+
do
{
status = (event_handler->*callback) (handle);
}
while (status > 0);
+
return status;
}
+
/************************************************************************/
// Methods for ACE_Dev_Poll_Reactor::Token_Guard
/************************************************************************/
+
ACE_INLINE
ACE_Dev_Poll_Reactor::Token_Guard::Token_Guard (ACE_Dev_Poll_Reactor_Token &token)
+
: token_ (token),
owner_ (0)
{
}
+
ACE_INLINE
ACE_Dev_Poll_Reactor::Token_Guard::~Token_Guard (void)
{
@@ -167,19 +206,23 @@ ACE_Dev_Poll_Reactor::Token_Guard::~Token_Guard (void)
this->owner_ = 0;
}
}
+
ACE_INLINE void
ACE_Dev_Poll_Reactor::Token_Guard::release_token (void)
{
if (this->owner_)
{
ACE_MT (this->token_.release ());
+
// We are not the owner anymore..
this->owner_ = 0;
}
}
+
ACE_INLINE int
ACE_Dev_Poll_Reactor::Token_Guard::is_owner (void)
{
return this->owner_;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Dirent.cpp b/dep/ACE_wrappers/ace/Dirent.cpp
index 61950b53700..180642fc0f9 100644
--- a/dep/ACE_wrappers/ace/Dirent.cpp
+++ b/dep/ACE_wrappers/ace/Dirent.cpp
@@ -1,5 +1,7 @@
// $Id: Dirent.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Dirent.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Dirent.inl"
#endif /* __ACE_INLINE__ */
diff --git a/dep/ACE_wrappers/ace/Dirent.h b/dep/ACE_wrappers/ace/Dirent.h
index 11fde3d452f..036a942c611 100644
--- a/dep/ACE_wrappers/ace/Dirent.h
+++ b/dep/ACE_wrappers/ace/Dirent.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Dirent.h
@@ -11,15 +12,21 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_DIRENT_H
#define ACE_DIRENT_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/OS_NS_dirent.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Dirent
*
@@ -31,15 +38,20 @@ public:
// = Initialization and termination methods.
/// Default constructor.
ACE_Dirent (void);
+
/// Constructor calls <opendir>
explicit ACE_Dirent (const ACE_TCHAR *dirname);
+
/// Opens the directory named by filename and associates a directory
/// stream with it.
int open (const ACE_TCHAR *filename);
+
/// Destructor calls <closedir>.
~ACE_Dirent (void);
+
/// Closes the directory stream and frees the <ACE_DIR> structure.
void close (void);
+
// = Iterator methods.
/**
* Returns a pointer to a structure representing the directory entry
@@ -59,6 +71,7 @@ public:
* directory is actually read.
*/
ACE_DIRENT *read (void);
+
/**
* Has the equivalent functionality as <readdir> except that an
* @a entry and @a result buffer must be supplied by the caller to
@@ -66,10 +79,12 @@ public:
*/
int read (struct ACE_DIRENT *entry,
struct ACE_DIRENT **result);
+
// = Manipulators.
/// Returns the current location associated with the directory
/// stream.
long tell (void);
+
/**
* Sets the position of the next <readdir> operation on the
* directory stream. The new position reverts to the position
@@ -83,6 +98,7 @@ public:
* any calls to readdir.
*/
void seek (long loc);
+
/**
* Resets the position of the directory stream to the beginning of
* the directory. It also causes the directory stream to refer to
@@ -90,14 +106,18 @@ public:
* <opendir> would.
*/
void rewind (void);
+
private:
/// Pointer to the directory stream.
ACE_DIR *dirp_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Dirent.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_DIRENT_H */
diff --git a/dep/ACE_wrappers/ace/Dirent.inl b/dep/ACE_wrappers/ace/Dirent.inl
index adce9b950bf..01ce3a96c4b 100644
--- a/dep/ACE_wrappers/ace/Dirent.inl
+++ b/dep/ACE_wrappers/ace/Dirent.inl
@@ -1,29 +1,37 @@
// -*- C++ -*-
//
// $Id: Dirent.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Log_Msg.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE int
ACE_Dirent::open (const ACE_TCHAR *dirname)
{
// If the directory stream is already open, close it to prevent
// possible resource leaks.
+
if (this->dirp_ != 0)
{
ACE_OS::closedir (this->dirp_);
this->dirp_ = 0;
}
+
this->dirp_ = ACE_OS::opendir (dirname);
+
if (this->dirp_ == 0)
return -1;
else
return 0;
}
+
ACE_INLINE
ACE_Dirent::ACE_Dirent (void)
: dirp_ (0)
{
}
+
ACE_INLINE
ACE_Dirent::ACE_Dirent (const ACE_TCHAR *dirname)
: dirp_ (0)
@@ -33,17 +41,20 @@ ACE_Dirent::ACE_Dirent (const ACE_TCHAR *dirname)
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_Dirent::ACE_Dirent")));
}
+
ACE_INLINE
ACE_Dirent::~ACE_Dirent (void)
{
if (this->dirp_ != 0)
ACE_OS::closedir (this->dirp_);
}
+
ACE_INLINE ACE_DIRENT *
ACE_Dirent::read (void)
{
return this->dirp_ ? ACE_OS::readdir (this->dirp_) : 0;
}
+
ACE_INLINE int
ACE_Dirent::read (struct ACE_DIRENT *entry,
struct ACE_DIRENT **result)
@@ -52,31 +63,37 @@ ACE_Dirent::read (struct ACE_DIRENT *entry,
? ACE_OS::readdir_r (this->dirp_, entry, result)
: 0;
}
+
ACE_INLINE void
ACE_Dirent::close (void)
{
if (this->dirp_ != 0)
{
ACE_OS::closedir (this->dirp_);
+
// Prevent double closure
this->dirp_ = 0;
}
}
+
ACE_INLINE void
ACE_Dirent::rewind (void)
{
if (this->dirp_)
ACE_OS::rewinddir (this->dirp_);
}
+
ACE_INLINE void
ACE_Dirent::seek (long loc)
{
if (this->dirp_)
ACE_OS::seekdir (this->dirp_, loc);
}
+
ACE_INLINE long
ACE_Dirent::tell (void)
{
return this->dirp_ ? ACE_OS::telldir (this->dirp_) : 0;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Dirent_Selector.cpp b/dep/ACE_wrappers/ace/Dirent_Selector.cpp
index 9ed414bfcaf..875a466e5b3 100644
--- a/dep/ACE_wrappers/ace/Dirent_Selector.cpp
+++ b/dep/ACE_wrappers/ace/Dirent_Selector.cpp
@@ -1,25 +1,34 @@
// $Id: Dirent_Selector.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Dirent_Selector.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Dirent_Selector.inl"
#endif /* __ACE_INLINE__ */
+
#include "ace/OS_NS_dirent.h"
#include "ace/OS_NS_stdlib.h"
+
ACE_RCSID (ace,
Dirent_Selector,
"$Id: Dirent_Selector.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Construction/Destruction
+
ACE_Dirent_Selector::ACE_Dirent_Selector (void)
: namelist_ (0),
n_ (0)
{
}
+
ACE_Dirent_Selector::~ACE_Dirent_Selector (void)
{
// Free up any allocated resources.
this->close();
}
+
int
ACE_Dirent_Selector::open (const ACE_TCHAR *dir,
ACE_SCANDIR_SELECTOR sel,
@@ -28,6 +37,7 @@ ACE_Dirent_Selector::open (const ACE_TCHAR *dir,
n_ = ACE_OS::scandir (dir, &this->namelist_, sel, cmp);
return n_;
}
+
int
ACE_Dirent_Selector::close (void)
{
@@ -40,9 +50,11 @@ ACE_Dirent_Selector::close (void)
#endif
ACE_OS::free (this->namelist_[n_]);
}
+
ACE_OS::free (this->namelist_);
this->namelist_ = 0;
return 0;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Dirent_Selector.h b/dep/ACE_wrappers/ace/Dirent_Selector.h
index d223414fadc..3356f18723d 100644
--- a/dep/ACE_wrappers/ace/Dirent_Selector.h
+++ b/dep/ACE_wrappers/ace/Dirent_Selector.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Dirent_Selector.h
@@ -10,16 +11,22 @@
* @author Rich Newman <RNewman@directv.com>
*/
//=============================================================================
+
#ifndef ACE_DIRENT_SELECTOR_H
#define ACE_DIRENT_SELECTOR_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
#pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/OS_NS_dirent.h" /* Need ACE_SCANDIR_SELECTOR, COMPARATOR */
#include "ace/os_include/os_dirent.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Dirent_Selector
*
@@ -31,29 +38,39 @@ class ACE_Export ACE_Dirent_Selector
public:
/// Constructor
ACE_Dirent_Selector (void);
+
/// Destructor.
virtual ~ACE_Dirent_Selector (void);
+
/// Return the length of the list of matching directory entries.
int length (void) const;
+
/// Return the entry at @a index.
ACE_DIRENT *operator[] (const int index) const;
+
/// Free up resources.
int close (void);
+
/// Open the directory @a dir and populate the current list of names with
/// directory entries that match the @a selector and @a comparator.
int open (const ACE_TCHAR *dir,
ACE_SCANDIR_SELECTOR selector = 0,
ACE_SCANDIR_COMPARATOR comparator = 0);
+
protected:
/// Ptr to the namelist array.
ACE_DIRENT **namelist_;
+
/// Number of entries in the array.
int n_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Dirent_Selector.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_DIRENT_SELECTOR_H */
diff --git a/dep/ACE_wrappers/ace/Dirent_Selector.inl b/dep/ACE_wrappers/ace/Dirent_Selector.inl
index 1f1192c8567..15f804704bf 100644
--- a/dep/ACE_wrappers/ace/Dirent_Selector.inl
+++ b/dep/ACE_wrappers/ace/Dirent_Selector.inl
@@ -1,15 +1,19 @@
// -*- C++ -*-
//
// $Id: Dirent_Selector.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE int
ACE_Dirent_Selector::length (void) const
{
return n_;
}
+
ACE_INLINE ACE_DIRENT *
ACE_Dirent_Selector::operator[] (const int n) const
{
return this->namelist_[n];
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Dump.cpp b/dep/ACE_wrappers/ace/Dump.cpp
index 7c43dbe5050..fce6bcc277a 100644
--- a/dep/ACE_wrappers/ace/Dump.cpp
+++ b/dep/ACE_wrappers/ace/Dump.cpp
@@ -1,32 +1,41 @@
// $Id: Dump.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Dump.h"
#include "ace/Guard_T.h"
#include "ace/Thread_Mutex.h"
#include "ace/Object_Manager.h"
#include "ace/Log_Msg.h"
+
ACE_RCSID(ace, Dump, "$Id: Dump.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Implementations (very simple for now...)
+
ACE_Dumpable::~ACE_Dumpable (void)
{
ACE_TRACE ("ACE_Dumpable::~ACE_Dumpable");
}
+
ACE_Dumpable::ACE_Dumpable (const void *this_ptr)
: this_ (this_ptr)
{
ACE_TRACE ("ACE_Dumpable::ACE_Dumpable");
}
+
ACE_Dumpable_Ptr::ACE_Dumpable_Ptr (const ACE_Dumpable *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_;
}
+
void
ACE_Dumpable_Ptr::operator= (const ACE_Dumpable *dumper) const
{
@@ -37,29 +46,35 @@ ACE_Dumpable_Ptr::operator= (const ACE_Dumpable *dumper) const
(const_cast<ACE_Dumpable_Ptr *> (this))->dumper_ = dumper;
}
}
+
ACE_ODB::ACE_ODB (void)
// Let the Tuple default constructor initialize object_table_
: current_size_ (0)
{
ACE_TRACE ("ACE_ODB::ACE_ODB");
}
+
ACE_ODB *
ACE_ODB::instance (void)
{
ACE_TRACE ("ACE_ODB::instance");
+
if (ACE_ODB::instance_ == 0)
{
ACE_MT (ACE_Thread_Mutex *lock =
ACE_Managed_Object<ACE_Thread_Mutex>::get_preallocated_object
(ACE_Object_Manager::ACE_DUMP_LOCK);
ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, *lock, 0));
+
if (ACE_ODB::instance_ == 0)
ACE_NEW_RETURN (ACE_ODB::instance_,
ACE_ODB,
0);
}
+
return ACE_ODB::instance_;
}
+
void
ACE_ODB::dump_objects (void)
{
@@ -71,14 +86,17 @@ ACE_ODB::dump_objects (void)
this->object_table_[i].dumper_->dump ();
}
}
+
// This method registers a new <dumper>. It detects
// duplicates and simply overwrites them.
+
void
ACE_ODB::register_object (const ACE_Dumpable *dumper)
{
ACE_TRACE ("ACE_ODB::register_object");
int i;
int slot = 0;
+
for (i = 0; i < this->current_size_; i++)
{
if (this->object_table_[i].this_ == 0)
@@ -89,6 +107,7 @@ ACE_ODB::register_object (const ACE_Dumpable *dumper)
break;
}
}
+
if (i == this->current_size_)
{
slot = this->current_size_++;
@@ -97,22 +116,27 @@ ACE_ODB::register_object (const ACE_Dumpable *dumper)
this->object_table_[slot].this_ = dumper->this_;
this->object_table_[slot].dumper_ = dumper;
}
+
void
ACE_ODB::remove_object (const void *this_ptr)
{
ACE_TRACE ("ACE_ODB::remove_object");
int i;
+
for (i = 0; i < this->current_size_; i++)
{
if (this->object_table_[i].this_ == this_ptr)
break;
}
+
if (i < this->current_size_)
{
this->object_table_[i].this_ = 0;
this->object_table_[i].dumper_ = 0;
}
}
+
ACE_ODB *ACE_ODB::instance_ = 0;
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Dump.h b/dep/ACE_wrappers/ace/Dump.h
index 0bd02f83b83..354b162cfb6 100644
--- a/dep/ACE_wrappers/ace/Dump.h
+++ b/dep/ACE_wrappers/ace/Dump.h
@@ -1,4 +1,5 @@
/* -*- C++ -*- */
+
//=============================================================================
/**
* @file Dump.h
@@ -46,14 +47,19 @@
*/
//=============================================================================
+
#ifndef ACE_DUMP_H
#define ACE_DUMP_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Dumpable
*
@@ -65,16 +71,21 @@ class ACE_Export ACE_Dumpable
public:
friend class ACE_ODB;
friend class ACE_Dumpable_Ptr;
+
/// Constructor.
ACE_Dumpable (const void *);
+
/// This pure virtual method must be filled in by a subclass.
virtual void dump (void) const = 0;
+
protected:
virtual ~ACE_Dumpable (void);
+
private:
/// Pointer to the object that is being stored.
const void *this_;
};
+
/**
* @class ACE_Dumpable_Ptr
*
@@ -87,11 +98,13 @@ public:
ACE_Dumpable_Ptr (const ACE_Dumpable *dumper = 0);
const ACE_Dumpable *operator->() const;
void operator= (const ACE_Dumpable *dumper) const;
+
private:
/// "Real" pointer to the underlying abstract base class
/// pointer that does the real work.
const ACE_Dumpable *dumper_;
};
+
/**
* @class ACE_ODB
*
@@ -103,22 +116,29 @@ class ACE_Export ACE_ODB
public:
/// @todo This is clearly inadequate and should be dynamic...
enum {MAX_TABLE_SIZE = 100000};
+
/// Iterates through the entire set of registered objects and
/// dumps their state.
void dump_objects (void);
+
/// Add the tuple <dumper, this_> to the list of registered ACE objects.
void register_object (const ACE_Dumpable *dumper);
+
/// Use <this_> to locate and remove the associated <dumper> from the
/// list of registered ACE objects.
void remove_object (const void *this_);
+
/// Interface to the Singleton instance of the object database.
static ACE_ODB *instance (void);
+
private:
ACE_ODB (void); // Ensure we have a Singleton...
+
struct Tuple
{
/// Pointer to the object that is registered.
const void *this_;
+
/// Smart pointer to the ACE_Dumpable object associated with this_.
/// This uses an ACE_Dumpable_Ptr, instead of a bare pointer, to
/// cope with hierarchies of dumpable classes. In such cases we
@@ -128,19 +148,26 @@ private:
/// on destruction of the subobject its handle won't exist anymore
/// and we'll have to check for that).
const ACE_Dumpable_Ptr dumper_;
+
Tuple (void) : dumper_(0) {}
};
+
/// Singleton instance of this class.
static ACE_ODB *instance_;
+
/// The current implementation is very simple-minded and will be
/// changed to be dynamic.
Tuple object_table_[ACE_ODB::MAX_TABLE_SIZE];
+
/// Current size of <object_table_>.
int current_size_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
// Include the templates classes at this point.
#include "ace/Dump_T.h"
+
#include /**/ "ace/post.h"
#endif /* ACE_DUMP_H */
diff --git a/dep/ACE_wrappers/ace/Dump_T.h b/dep/ACE_wrappers/ace/Dump_T.h
index cc18fdce813..4134df75392 100644
--- a/dep/ACE_wrappers/ace/Dump_T.h
+++ b/dep/ACE_wrappers/ace/Dump_T.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Dump_T.h
@@ -9,14 +10,19 @@
*/
//=============================================================================
+
#ifndef ACE_DUMP_T_H
#define ACE_DUMP_T_H
#include /**/ "ace/pre.h"
+
#include "ace/Dump.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Dumpable_Adapter
*
@@ -36,16 +42,21 @@ public:
// = Initialization and termination methods.
ACE_Dumpable_Adapter (const Concrete *t);
~ACE_Dumpable_Adapter (void);
+
/// Concrete dump method (simply delegates to the <dump> method of
/// <class Concrete>).
virtual void dump (void) const;
+
/// Delegate to methods in the Concrete class.
Concrete *operator->() const;
+
private:
/// Pointer to @c this of <class Concrete>.
const Concrete *this_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
// Some useful macros for conditionally compiling this feature...
#if defined (ACE_NDEBUG)
#define ACE_REGISTER_OBJECT(CLASS)
@@ -58,12 +69,15 @@ ACE_END_VERSIONED_NAMESPACE_DECL
ACE_ODB::instance ()->remove_object \
((void *) this);
#endif /* ACE_NDEBUG */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Dump_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Dump_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
#endif /* ACE_DUMP_T_H */
diff --git a/dep/ACE_wrappers/ace/Dynamic.cpp b/dep/ACE_wrappers/ace/Dynamic.cpp
index ef8ce0cec0c..2a3f8b0f26d 100644
--- a/dep/ACE_wrappers/ace/Dynamic.cpp
+++ b/dep/ACE_wrappers/ace/Dynamic.cpp
@@ -1,27 +1,35 @@
// $Id: Dynamic.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Dynamic.h"
#include "ace/Singleton.h"
#include "ace/TSS_T.h"
#include "ace/Synch_Traits.h"
#include "ace/Null_Mutex.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Dynamic.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace, Dynamic, "$Id: Dynamic.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_Dynamic::ACE_Dynamic (void)
: is_dynamic_ (false)
{
ACE_TRACE ("ACE_Dynamic::ACE_Dynamic");
}
+
/* static */ ACE_Dynamic *
ACE_Dynamic::instance (void)
{
return ACE_TSS_Singleton<ACE_Dynamic, ACE_SYNCH_NULL_MUTEX>::instance ();
}
+
#if defined (ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION)
template ACE_TSS_Singleton<ACE_Dynamic, ACE_Null_Mutex> *
ACE_TSS_Singleton<ACE_Dynamic, ACE_Null_Mutex>::singleton_;
#endif /* ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Dynamic.h b/dep/ACE_wrappers/ace/Dynamic.h
index 48b10b87eaa..6906ebf1267 100644
--- a/dep/ACE_wrappers/ace/Dynamic.h
+++ b/dep/ACE_wrappers/ace/Dynamic.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file Dynamic.h
@@ -9,14 +10,19 @@
* @author Irfan Pyarali.
*/
//==========================================================================
+
#ifndef ACE_DYNAMIC_H
#define ACE_DYNAMIC_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Dynamic
*
@@ -31,19 +37,25 @@ public:
// = Initialization and termination method.
/// Constructor.
ACE_Dynamic (void);
+
/// Destructor.
~ACE_Dynamic (void);
+
/**
* Sets a flag that indicates that the object was dynamically
* created. This method is usually called in operator new and then
* checked and reset in the constructor.
*/
void set (void);
+
/// @c true if we were allocated dynamically, else @c false.
bool is_dynamic (void);
+
/// Resets state flag.
void reset (void);
+
static ACE_Dynamic *instance (void);
+
private:
/**
* Flag that indicates that the object was dynamically created. This
@@ -52,10 +64,13 @@ private:
*/
bool is_dynamic_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Dynamic.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_DYNAMIC_H */
diff --git a/dep/ACE_wrappers/ace/Dynamic.inl b/dep/ACE_wrappers/ace/Dynamic.inl
index efe1a7553e5..1e8e968f898 100644
--- a/dep/ACE_wrappers/ace/Dynamic.inl
+++ b/dep/ACE_wrappers/ace/Dynamic.inl
@@ -1,28 +1,34 @@
// -*- C++ -*-
//
// $Id: Dynamic.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_Dynamic::~ACE_Dynamic (void)
{
// ACE_TRACE ("ACE_Dynamic::~ACE_Dynamic");
}
+
ACE_INLINE void
ACE_Dynamic::set (void)
{
// ACE_TRACE ("ACE_Dynamic::set");
this->is_dynamic_ = true;
}
+
ACE_INLINE bool
ACE_Dynamic::is_dynamic (void)
{
// ACE_TRACE ("ACE_Dynamic::is_dynamic");
return this->is_dynamic_;
}
+
ACE_INLINE void
ACE_Dynamic::reset (void)
{
// ACE_TRACE ("ACE_Dynamic::reset");
this->is_dynamic_ = false;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Dynamic_Message_Strategy.cpp b/dep/ACE_wrappers/ace/Dynamic_Message_Strategy.cpp
index fe0617ba1c8..e6c89e5238e 100644
--- a/dep/ACE_wrappers/ace/Dynamic_Message_Strategy.cpp
+++ b/dep/ACE_wrappers/ace/Dynamic_Message_Strategy.cpp
@@ -1,16 +1,22 @@
#include "ace/Dynamic_Message_Strategy.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Dynamic_Message_Strategy.inl"
#endif /* __ACE_INLINE__ */
+
#include "ace/Guard_T.h"
#include "ace/Log_Msg.h"
#include "ace/Malloc_Base.h"
#include "ace/OS_NS_string.h"
+
ACE_RCSID (ace,
Dynamic_Message_Strategy,
"$Id: Dynamic_Message_Strategy.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// ctor
+
ACE_Dynamic_Message_Strategy::ACE_Dynamic_Message_Strategy (unsigned long static_bit_field_mask,
unsigned long static_bit_field_shift,
unsigned long dynamic_priority_max,
@@ -24,21 +30,26 @@ ACE_Dynamic_Message_Strategy::ACE_Dynamic_Message_Strategy (unsigned long static
pending_shift_ (0, dynamic_priority_max)
{
}
+
// dtor
+
ACE_Dynamic_Message_Strategy::~ACE_Dynamic_Message_Strategy (void)
{
}
+
ACE_Dynamic_Message_Strategy::Priority_Status
ACE_Dynamic_Message_Strategy::priority_status (ACE_Message_Block & mb,
const ACE_Time_Value & tv)
{
// default the message to have pending priority status
Priority_Status status = ACE_Dynamic_Message_Strategy::PENDING;
+
// start with the passed absolute time as the message's priority, then
// call the polymorphic hook method to (at least partially) convert
// the absolute time and message attributes into the message's priority
ACE_Time_Value priority (tv);
convert_priority (priority, mb);
+
// if the priority is negative, the message is pending
if (priority < ACE_Time_Value::zero)
{
@@ -59,23 +70,29 @@ ACE_Dynamic_Message_Strategy::priority_status (ACE_Message_Block & mb,
// otherwise, the message is late, but its priority is correct
else
status = ACE_Dynamic_Message_Strategy::LATE;
+
// use (fast) bitwise operators to isolate and replace
// the dynamic portion of the message's priority
mb.msg_priority((mb.msg_priority() & static_bit_field_mask_) |
((priority.usec () +
ACE_ONE_SECOND_IN_USECS * (suseconds_t)(priority.sec())) <<
static_bit_field_shift_));
+
// returns the priority status of the message
return status;
}
+
// Dump the state of the strategy.
+
void
ACE_Dynamic_Message_Strategy::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_Dynamic_Message_Strategy::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
+
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("static_bit_field_mask_ = %u\n")
ACE_TEXT ("static_bit_field_shift_ = %u\n")
@@ -94,9 +111,11 @@ ACE_Dynamic_Message_Strategy::dump (void) const
this->min_pending_.usec (),
this->pending_shift_.sec (),
this->pending_shift_.usec ()));
+
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
ACE_Deadline_Message_Strategy::ACE_Deadline_Message_Strategy (unsigned long static_bit_field_mask,
unsigned long static_bit_field_shift,
unsigned long dynamic_priority_max,
@@ -107,9 +126,11 @@ ACE_Deadline_Message_Strategy::ACE_Deadline_Message_Strategy (unsigned long stat
dynamic_priority_offset)
{
}
+
ACE_Deadline_Message_Strategy::~ACE_Deadline_Message_Strategy (void)
{
}
+
void
ACE_Deadline_Message_Strategy::convert_priority (ACE_Time_Value & priority,
const ACE_Message_Block & mb)
@@ -119,18 +140,24 @@ ACE_Deadline_Message_Strategy::convert_priority (ACE_Time_Value & priority,
priority -= mb.msg_deadline_time ();
}
// dynamic priority conversion function based on time to deadline
+
void
ACE_Deadline_Message_Strategy::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_Deadline_Message_Strategy::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
+
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("ACE_Dynamic_Message_Strategy base class: \n")));
this->ACE_Dynamic_Message_Strategy::dump ();
+
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nderived class: ACE_Deadline_Message_Strategy\n")));
+
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
ACE_Laxity_Message_Strategy::ACE_Laxity_Message_Strategy (unsigned long static_bit_field_mask,
unsigned long static_bit_field_shift,
unsigned long dynamic_priority_max,
@@ -141,9 +168,11 @@ ACE_Laxity_Message_Strategy::ACE_Laxity_Message_Strategy (unsigned long static_b
dynamic_priority_offset)
{
}
+
ACE_Laxity_Message_Strategy::~ACE_Laxity_Message_Strategy (void)
{
}
+
void
ACE_Laxity_Message_Strategy::convert_priority (ACE_Time_Value & priority,
const ACE_Message_Block & mb)
@@ -154,18 +183,24 @@ ACE_Laxity_Message_Strategy::convert_priority (ACE_Time_Value & priority,
priority -= mb.msg_deadline_time ();
}
// dynamic priority conversion function based on laxity
+
void
ACE_Laxity_Message_Strategy::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_Laxity_Message_Strategy::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
+
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("ACE_Dynamic_Message_Strategy base class: \n")));
this->ACE_Dynamic_Message_Strategy::dump ();
+
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nderived class: ACE_Laxity_Message_Strategy\n")));
+
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
// Dump the state of the strategy.
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Dynamic_Message_Strategy.h b/dep/ACE_wrappers/ace/Dynamic_Message_Strategy.h
index ab40483e066..db6a51bb70e 100644
--- a/dep/ACE_wrappers/ace/Dynamic_Message_Strategy.h
+++ b/dep/ACE_wrappers/ace/Dynamic_Message_Strategy.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file Dynamic_Message_Strategy.h
@@ -8,16 +9,23 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//==========================================================================
+
#ifndef ACE_DYNAMIC_MESSAGE_STRATEGY_H
#define ACE_DYNAMIC_MESSAGE_STRATEGY_H
+
#include /**/ "ace/pre.h"
+
#include "ace/config-lite.h"
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Message_Block.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Dynamic_Message_Strategy
*
@@ -40,9 +48,12 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
class ACE_Export ACE_Dynamic_Message_Strategy
{
public:
+
// = Message priority status
+
// Values are defined as bit flags so that status combinations may
// be specified easily.
+
enum Priority_Status
{
/// Message can still make its deadline
@@ -54,57 +65,78 @@ public:
/// Mask to match any priority status
ANY_STATUS = 0x07
};
+
/// Constructor.
ACE_Dynamic_Message_Strategy (unsigned long static_bit_field_mask,
unsigned long static_bit_field_shift,
unsigned long dynamic_priority_max,
unsigned long dynamic_priority_offset);
+
/// Virtual destructor.
virtual ~ACE_Dynamic_Message_Strategy (void);
+
/// Updates the message's priority and returns its priority status.
Priority_Status priority_status (ACE_Message_Block &mb,
const ACE_Time_Value &tv);
+
/// Get static bit field mask.
unsigned long static_bit_field_mask (void) const;
+
/// Set static bit field mask.
void static_bit_field_mask (unsigned long);
+
/// Get left shift value to make room for static bit field.
unsigned long static_bit_field_shift (void) const;
+
/// Set left shift value to make room for static bit field.
void static_bit_field_shift (unsigned long);
+
/// Get maximum supported priority value.
unsigned long dynamic_priority_max (void) const;
+
/// Set maximum supported priority value.
void dynamic_priority_max (unsigned long);
+
/// Get offset to boundary between signed range and unsigned range.
unsigned long dynamic_priority_offset (void) const;
+
/// Set offset to boundary between signed range and unsigned range.
void dynamic_priority_offset (unsigned long);
+
/// Dump the state of the strategy.
virtual void dump (void) const;
+
protected:
/// Hook method for dynamic priority conversion.
virtual void convert_priority (ACE_Time_Value &priority,
const ACE_Message_Block &mb) = 0;
+
/// This is a bit mask with all ones in the static bit field.
unsigned long static_bit_field_mask_;
+
/**
* This is a left shift value to make room for static bit field:
* this value should be the logarithm base 2 of
* (static_bit_field_mask_ + 1).
*/
unsigned long static_bit_field_shift_;
+
/// Maximum supported priority value.
unsigned long dynamic_priority_max_;
+
/// Offset to boundary between signed range and unsigned range.
unsigned long dynamic_priority_offset_;
+
/// Maximum late time value that can be represented.
ACE_Time_Value max_late_;
+
/// Minimum pending time value that can be represented.
ACE_Time_Value min_pending_;
+
/// Time value by which to shift pending priority.
ACE_Time_Value pending_shift_;
};
+
/**
* @class ACE_Deadline_Message_Strategy
*
@@ -127,14 +159,18 @@ public:
unsigned long static_bit_field_shift = 10, // 10 low order bits
unsigned long dynamic_priority_max = 0x3FFFFFUL, // 2^(22)-1
unsigned long dynamic_priority_offset = 0x200000UL); // 2^(22-1)
+
/// Virtual dtor.
virtual ~ACE_Deadline_Message_Strategy (void);
+
/// Dynamic priority conversion function based on time to deadline.
virtual void convert_priority (ACE_Time_Value &priority,
const ACE_Message_Block &mb);
+
/// Dump the state of the strategy.
virtual void dump (void) const;
};
+
/**
* @class ACE_Laxity_Message_Strategy
*
@@ -158,18 +194,25 @@ public:
unsigned long static_bit_field_shift = 10, // 10 low order bits
unsigned long dynamic_priority_max = 0x3FFFFFUL, // 2^(22)-1
unsigned long dynamic_priority_offset = 0x200000UL); // 2^(22-1)
+
/// virtual dtor.
virtual ~ACE_Laxity_Message_Strategy (void);
+
/// Dynamic priority conversion function based on laxity.
virtual void convert_priority (ACE_Time_Value &priority,
const ACE_Message_Block &mb);
+
/// Dump the state of the strategy.
virtual void dump (void) const;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Dynamic_Message_Strategy.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_DYNAMIC_MESSAGE_STRATEGY_H */
diff --git a/dep/ACE_wrappers/ace/Dynamic_Message_Strategy.inl b/dep/ACE_wrappers/ace/Dynamic_Message_Strategy.inl
index 013cc186c71..9742a07fd88 100644
--- a/dep/ACE_wrappers/ace/Dynamic_Message_Strategy.inl
+++ b/dep/ACE_wrappers/ace/Dynamic_Message_Strategy.inl
@@ -1,37 +1,44 @@
// -*- C++ -*-
//
// $Id: Dynamic_Message_Strategy.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE unsigned long
ACE_Dynamic_Message_Strategy::static_bit_field_mask (void) const
{
return static_bit_field_mask_;
}
// get static bit field mask
+
ACE_INLINE void
ACE_Dynamic_Message_Strategy::static_bit_field_mask (unsigned long ul)
{
static_bit_field_mask_ = ul;
}
// set static bit field mask
+
ACE_INLINE unsigned long
ACE_Dynamic_Message_Strategy::static_bit_field_shift (void) const
{
return static_bit_field_shift_;
}
// get left shift value to make room for static bit field
+
ACE_INLINE void
ACE_Dynamic_Message_Strategy::static_bit_field_shift (unsigned long ul)
{
static_bit_field_shift_ = ul;
}
// set left shift value to make room for static bit field
+
ACE_INLINE unsigned long
ACE_Dynamic_Message_Strategy::dynamic_priority_max (void) const
{
return dynamic_priority_max_;
}
// get maximum supported priority value
+
ACE_INLINE void
ACE_Dynamic_Message_Strategy::dynamic_priority_max (unsigned long ul)
{
@@ -43,12 +50,14 @@ ACE_Dynamic_Message_Strategy::dynamic_priority_max (unsigned long ul)
pending_shift_ = ACE_Time_Value (0, ul);
}
// set maximum supported priority value
+
ACE_INLINE unsigned long
ACE_Dynamic_Message_Strategy::dynamic_priority_offset (void) const
{
return dynamic_priority_offset_;
}
// get offset for boundary between signed range and unsigned range
+
ACE_INLINE void
ACE_Dynamic_Message_Strategy::dynamic_priority_offset (unsigned long ul)
{
@@ -62,4 +71,5 @@ ACE_Dynamic_Message_Strategy::dynamic_priority_offset (unsigned long ul)
min_pending_ = ACE_Time_Value (0, ul);
}
// set offset for boundary between signed range and unsigned range
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Dynamic_Service.h b/dep/ACE_wrappers/ace/Dynamic_Service.h
index 8ed9a50b7b7..fb2469c5418 100644
--- a/dep/ACE_wrappers/ace/Dynamic_Service.h
+++ b/dep/ACE_wrappers/ace/Dynamic_Service.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Dynamic_Service.h
@@ -9,17 +10,25 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_DYNAMIC_SERVICE_H
#define ACE_DYNAMIC_SERVICE_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
#include "ace/Global_Macros.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Dynamic_Service_Base.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Service_Object;
+
/**
* @class ACE_Dynamic_Service
*
@@ -36,34 +45,46 @@ public:
/// Return instance using @a name to search the Service_Repository.
static TYPE* instance (const ACE_TCHAR *name);
static TYPE* instance (const ACE_TCHAR *name, bool no_global);
+
static TYPE* instance (const ACE_Service_Gestalt* repo,
const ACE_TCHAR *name);
static TYPE* instance (const ACE_Service_Gestalt* repo,
const ACE_TCHAR *name, bool no_global);
+
#if defined (ACE_USES_WCHAR)
+
/// Return instance using @a name to search the Service_Repository.
static TYPE* instance (const ACE_ANTI_TCHAR *name);
+
static TYPE* instance (const ACE_ANTI_TCHAR *name, bool no_global);
+
static TYPE* instance (const ACE_Service_Gestalt* repo,
const ACE_ANTI_TCHAR *name);
static TYPE* instance (const ACE_Service_Gestalt* repo,
const ACE_ANTI_TCHAR *name, bool no_global);
#endif // ACE_USES_WCHAR
+
private:
ACE_UNIMPLEMENTED_FUNC (ACE_Dynamic_Service ())
ACE_UNIMPLEMENTED_FUNC (ACE_Dynamic_Service (const ACE_Dynamic_Service&))
ACE_UNIMPLEMENTED_FUNC (ACE_Dynamic_Service& operator= (const ACE_Dynamic_Service&))
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Dynamic_Service.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
# include "ace/Dynamic_Service.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
# pragma implementation ("Dynamic_Service.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_DYNAMIC_SERVICE_H */
diff --git a/dep/ACE_wrappers/ace/Dynamic_Service.inl b/dep/ACE_wrappers/ace/Dynamic_Service.inl
index 402f99a8878..31324bf535b 100644
--- a/dep/ACE_wrappers/ace/Dynamic_Service.inl
+++ b/dep/ACE_wrappers/ace/Dynamic_Service.inl
@@ -1,25 +1,31 @@
// -*- C++ -*-
//
// $Id: Dynamic_Service.inl 81318 2008-04-10 10:12:05Z johnnyw $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_USES_WCHAR)
+
template <class TYPE> ACE_INLINE TYPE *
ACE_Dynamic_Service<TYPE>::instance (const ACE_ANTI_TCHAR *name)
{
return instance (ACE_TEXT_CHAR_TO_TCHAR (name),false);
}
+
template <class TYPE> ACE_INLINE TYPE *
ACE_Dynamic_Service<TYPE>::instance (const ACE_ANTI_TCHAR *name,
bool no_global)
{
return instance (ACE_TEXT_CHAR_TO_TCHAR (name),no_global);
}
+
template <class TYPE> ACE_INLINE TYPE *
ACE_Dynamic_Service<TYPE>::instance (const ACE_Service_Gestalt* repo,
const ACE_ANTI_TCHAR *name)
{
return instance (repo, ACE_TEXT_CHAR_TO_TCHAR (name),false);
}
+
template <class TYPE> ACE_INLINE TYPE *
ACE_Dynamic_Service<TYPE>::instance (const ACE_Service_Gestalt* repo,
const ACE_ANTI_TCHAR *name,
@@ -27,5 +33,7 @@ ACE_Dynamic_Service<TYPE>::instance (const ACE_Service_Gestalt* repo,
{
return instance (repo, ACE_TEXT_CHAR_TO_TCHAR (name),no_global);
}
+
#endif // ACE_USES_WCHAR
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Dynamic_Service_Base.cpp b/dep/ACE_wrappers/ace/Dynamic_Service_Base.cpp
index cac33ef3783..174b009d7b6 100644
--- a/dep/ACE_wrappers/ace/Dynamic_Service_Base.cpp
+++ b/dep/ACE_wrappers/ace/Dynamic_Service_Base.cpp
@@ -5,30 +5,38 @@
#include "ace/Service_Types.h"
#include "ace/Log_Msg.h"
+
ACE_RCSID (ace,
Dynamic_Service_Base,
"$Id: Dynamic_Service_Base.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
void
ACE_Dynamic_Service_Base::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_Dynamic_Service_Base::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n")));
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
// Get the instance using <name> for the current global
// service configuration repository.
+
void *
ACE_Dynamic_Service_Base::instance (const ACE_TCHAR *name, bool no_global)
{
ACE_TRACE ("ACE_Dynamic_Service_Base::instance");
return instance (ACE_Service_Config::current (), name, no_global);
}
+
// Find a service registration
+
const ACE_Service_Type *
ACE_Dynamic_Service_Base::find_i (const ACE_Service_Gestalt* &repo,
const ACE_TCHAR *name,
@@ -36,16 +44,20 @@ ACE_Dynamic_Service_Base::find_i (const ACE_Service_Gestalt* &repo,
{
ACE_TRACE ("ACE_Dynamic_Service_Base::find_i");
const ACE_Service_Type *svc_rec = 0;
+
ACE_Service_Gestalt* global = ACE_Service_Config::global ();
+
for ( ; (repo->find (name, &svc_rec) == -1) && !no_global; repo = global)
{
// Check the static repo, too if different
if (repo == global)
break;
}
+
return svc_rec;
}
+
// Get the instance using <name> for specific configuration repository.
void *
ACE_Dynamic_Service_Base::instance (const ACE_Service_Gestalt* repo,
@@ -53,8 +65,10 @@ ACE_Dynamic_Service_Base::instance (const ACE_Service_Gestalt* repo,
bool no_global)
{
ACE_TRACE ("ACE_Dynamic_Service_Base::instance");
+
void *obj = 0;
const ACE_Service_Type_Impl *type = 0;
+
const ACE_Service_Gestalt* repo_found = repo;
const ACE_Service_Type *svc_rec = find_i (repo_found, name, no_global);
if (svc_rec != 0)
@@ -63,13 +77,16 @@ ACE_Dynamic_Service_Base::instance (const ACE_Service_Gestalt* repo,
if (type != 0)
obj = type->object ();
}
+
if (ACE::debug ())
{
ACE_Guard <ACE_Log_Msg> log_guard (*ACE_Log_Msg::instance ());
+
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("ACE (%P|%t) DSB::instance, repo=%@, name=%s")
ACE_TEXT (" type=%@ => %@"),
repo->repo_, name, type, obj));
+
if (repo->repo_ != repo_found->repo_)
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT (" [in repo=%@]\n"),
@@ -77,7 +94,9 @@ ACE_Dynamic_Service_Base::instance (const ACE_Service_Gestalt* repo,
else
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n")));
}
+
return obj;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Dynamic_Service_Base.h b/dep/ACE_wrappers/ace/Dynamic_Service_Base.h
index c0a6cccfe5a..4491a9407d8 100644
--- a/dep/ACE_wrappers/ace/Dynamic_Service_Base.h
+++ b/dep/ACE_wrappers/ace/Dynamic_Service_Base.h
@@ -1,4 +1,5 @@
/* -*- C++ -*- */
+
//=============================================================================
/**
* @file Dynamic_Service_Base.h
@@ -9,16 +10,23 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_DYNAMIC_SERVICE_BASE_H
#define ACE_DYNAMIC_SERVICE_BASE_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Service_Gestalt;
class ACE_Service_Type;
+
/**
* @class ACE_Dynamic_Service_Base
*
@@ -29,31 +37,39 @@ class ACE_Service_Type;
*/
class ACE_Export ACE_Dynamic_Service_Base
{
+
public:
/// Dump the current static of the object
void dump (void) const;
+
protected:
/// Perform the default repo search, but optionally skip searching the global
/// repo.
static void* instance (const ACE_TCHAR *name, bool no_global = false);
+
static void* instance (const ACE_Service_Gestalt* repo,
const ACE_TCHAR *name,
bool no_global = false);
+
/// No need to create, or assign instances of this class
ACE_Dynamic_Service_Base (void);
~ACE_Dynamic_Service_Base (void);
const ACE_Dynamic_Service_Base& operator= (const ACE_Dynamic_Service_Base&);
+
private:
/// Implement the service search policy, i.e. "look for the service first
/// locally and then globally"
static const ACE_Service_Type *find_i (const ACE_Service_Gestalt* &repo,
const ACE_TCHAR *name,
bool no_global);
+
/// The dependency declaration class needs access to the service search
/// policy, implemented by find_i()
friend class ACE_Dynamic_Service_Dependency;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
#endif /* ACE_DYNAMIC_SERVICE_BASE_H */
diff --git a/dep/ACE_wrappers/ace/Dynamic_Service_Dependency.cpp b/dep/ACE_wrappers/ace/Dynamic_Service_Dependency.cpp
index 5aed803a36c..9a371ff3c16 100644
--- a/dep/ACE_wrappers/ace/Dynamic_Service_Dependency.cpp
+++ b/dep/ACE_wrappers/ace/Dynamic_Service_Dependency.cpp
@@ -3,22 +3,27 @@
#include "ace/Dynamic_Service_Dependency.h"
#include "ace/Service_Config.h"
#include "ace/Log_Msg.h"
+
ACE_RCSID (ace,
Dynamic_Service_Dependency,
"$Id: Dynamic_Service_Dependency.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_Dynamic_Service_Dependency::ACE_Dynamic_Service_Dependency (const ACE_TCHAR *principal)
{
this->init (ACE_Service_Config::current (), principal);
}
+
ACE_Dynamic_Service_Dependency::ACE_Dynamic_Service_Dependency (const ACE_Service_Gestalt *cfg,
const ACE_TCHAR *principal)
{
this->init (cfg, principal);
}
+
ACE_Dynamic_Service_Dependency::~ACE_Dynamic_Service_Dependency (void)
{
if (ACE::debug ())
@@ -26,6 +31,7 @@ ACE_Dynamic_Service_Dependency::~ACE_Dynamic_Service_Dependency (void)
ACE_TEXT ("(%P|%t) DSD, this=%@ - destroying\n"),
this));
}
+
void
ACE_Dynamic_Service_Dependency::init (const ACE_Service_Gestalt *cfg,
const ACE_TCHAR *principal)
@@ -41,5 +47,6 @@ ACE_Dynamic_Service_Dependency::init (const ACE_Service_Gestalt *cfg,
this->tracker_ = st->dll ();
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Dynamic_Service_Dependency.h b/dep/ACE_wrappers/ace/Dynamic_Service_Dependency.h
index e08e6ec0951..ce4c1d3e7cd 100644
--- a/dep/ACE_wrappers/ace/Dynamic_Service_Dependency.h
+++ b/dep/ACE_wrappers/ace/Dynamic_Service_Dependency.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Dynamic_Service_Dependency.h
@@ -8,17 +9,23 @@
* @author Iliyan Jeliazkov <iliyan@ociweb.com>
*/
//=============================================================================
+
#ifndef ACE_DYNAMIC_SERVICE_DEPENDENCY_H
#define ACE_DYNAMIC_SERVICE_DEPENDENCY_H
+
#include /**/ "ace/pre.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Dynamic_Service_Base.h"
#include "ace/Service_Object.h"
#include "ace/DLL.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Dynamic_Service_Dependency
*
@@ -47,13 +54,18 @@ public:
const ACE_TCHAR *principal);
ACE_Dynamic_Service_Dependency (const ACE_TCHAR *principal);
~ACE_Dynamic_Service_Dependency (void);
+
private:
void init (const ACE_Service_Gestalt *cfg, const ACE_TCHAR *principal);
+
private:
ACE_DLL tracker_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
+
#endif /* ACE_DYNAMIC_SERVICE_DEPENDENCY_H */
diff --git a/dep/ACE_wrappers/ace/Encoding_Converter.cpp b/dep/ACE_wrappers/ace/Encoding_Converter.cpp
index e3ce23c8640..e01c15ef865 100644
--- a/dep/ACE_wrappers/ace/Encoding_Converter.cpp
+++ b/dep/ACE_wrappers/ace/Encoding_Converter.cpp
@@ -1,10 +1,13 @@
// $Id: Encoding_Converter.cpp 80826 2008-03-04 14:51:23Z wotte $
#include "ace/Encoding_Converter.h"
+
#if defined (ACE_USES_WCHAR)
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_Encoding_Converter::~ACE_Encoding_Converter (void)
{
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
#endif /* ACE_USES_WCHAR */
diff --git a/dep/ACE_wrappers/ace/Encoding_Converter.h b/dep/ACE_wrappers/ace/Encoding_Converter.h
index 4567f31f741..8833d3fced8 100644
--- a/dep/ACE_wrappers/ace/Encoding_Converter.h
+++ b/dep/ACE_wrappers/ace/Encoding_Converter.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=========================================================================
/**
* @file Encoding_Converter.h
@@ -11,13 +12,19 @@
* @author Chad Elliott <elliott_c@ociweb.com>
*/
//=========================================================================
+
#ifndef ACE_ENCODING_CONVERTER_H
#define ACE_ENCODING_CONVERTER_H
+
#include /**/ "ace/pre.h"
+
#include "ace/Basic_Types.h"
+
#if defined (ACE_USES_WCHAR)
#include /**/ "ace/ACE_export.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/** The base class for all ACE UTF Encoding Converters.
* This class provides a generic interface that is used to implement
* various UTF encoding conversion classes.
@@ -33,9 +40,11 @@ public:
TARGET_EXHAUSTED,
SOURCE_ILLEGAL
};
+
/// This destructor is here (and virtual) because we have virtual
/// functions.
virtual ~ACE_Encoding_Converter (void);
+
/// Convert the source (which can be in any encoding) to UTF-8 and
/// store it in the provided target buffer.
virtual Result to_utf8 (const void* source,
@@ -43,6 +52,7 @@ public:
ACE_Byte* target,
size_t target_size,
bool strict = true) = 0;
+
/// Convert the UTF-8 source into an alternate encoding and store it
/// in the provided target buffer.
virtual Result from_utf8 (const ACE_Byte* source,
@@ -51,8 +61,11 @@ public:
size_t target_size,
bool strict = true) = 0;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
#endif /* ACE_USES_WCHAR */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_ENCODING_CONVERTER_H */
diff --git a/dep/ACE_wrappers/ace/Encoding_Converter_Factory.cpp b/dep/ACE_wrappers/ace/Encoding_Converter_Factory.cpp
index a3b36b2efb1..3cd365f3ae1 100644
--- a/dep/ACE_wrappers/ace/Encoding_Converter_Factory.cpp
+++ b/dep/ACE_wrappers/ace/Encoding_Converter_Factory.cpp
@@ -1,11 +1,14 @@
// $Id: Encoding_Converter_Factory.cpp 80826 2008-03-04 14:51:23Z wotte $
#include "ace/Encoding_Converter_Factory.h"
+
#if defined (ACE_USES_WCHAR)
#include "ace/UTF32_Encoding_Converter.h"
#include "ace/UTF16_Encoding_Converter.h"
#include "ace/UTF8_Encoding_Converter.h"
#include "ace/OS_Memory.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_Encoding_Converter*
ACE_Encoding_Converter_Factory::create (
const ACE_Byte* source,
@@ -18,6 +21,7 @@ ACE_Encoding_Converter_Factory::create (
bool const convert_for_bigendian = false;
#endif /* ACE_BIG_ENDIAN */
ACE_Encoding_Converter* converter = 0;
+
switch (hint)
{
case ACE_UTF_32BE:
@@ -51,17 +55,21 @@ ACE_Encoding_Converter_Factory::create (
converter = ACE_UTF8_Encoding_Converter::encoded (source, source_size);
if (converter != 0)
return converter;
+
// Check for UTF-32
converter = ACE_UTF32_Encoding_Converter::encoded (source, source_size);
if (converter != 0)
return converter;
+
// Check for UTF-16
converter = ACE_UTF16_Encoding_Converter::encoded (source, source_size);
if (converter != 0)
return converter;
}
+
return converter;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
#endif /* ACE_USES_WCHAR */
diff --git a/dep/ACE_wrappers/ace/Encoding_Converter_Factory.h b/dep/ACE_wrappers/ace/Encoding_Converter_Factory.h
index 1ee3747122f..c1311451db5 100644
--- a/dep/ACE_wrappers/ace/Encoding_Converter_Factory.h
+++ b/dep/ACE_wrappers/ace/Encoding_Converter_Factory.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=========================================================================
/**
* @file Encoding_Converter_Factory.h
@@ -10,14 +11,21 @@
* @author Chad Elliott <elliott_c@ociweb.com>
*/
//=========================================================================
+
#ifndef ACE_ENCODING_CONVERTER_FACTORY_H
#define ACE_ENCODING_CONVERTER_FACTORY_H
+
#include /**/ "ace/pre.h"
+
#include "ace/Basic_Types.h"
+
#if defined (ACE_USES_WCHAR)
#include /**/ "ace/ACE_export.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Encoding_Converter;
+
/** Create an encoding converter based on the source or hint.
* This class allows users to avoid knowing any concrete converter types.
*/
@@ -29,6 +37,7 @@ public:
ACE_UTF_16BE, ACE_UTF_16LE,
ACE_UTF_8, ACE_NONE
};
+
/// Create an encoding converter based on the source. If a hint is
/// given, it just creates the specified type of converter without looking
/// at the source.
@@ -36,8 +45,11 @@ public:
size_t source_size,
Encoding_Hint hint = ACE_NONE);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
#endif /* ACE_USES_WCHAR */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_ENCODING_CONVERTER_FACTORY_H */
diff --git a/dep/ACE_wrappers/ace/Env_Value_T.h b/dep/ACE_wrappers/ace/Env_Value_T.h
index 046ea9b4031..05b4706c122 100644
--- a/dep/ACE_wrappers/ace/Env_Value_T.h
+++ b/dep/ACE_wrappers/ace/Env_Value_T.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Env_Value_T.h
@@ -12,16 +13,22 @@
* @author Chris Cleeland (derived from work by Carlos O'Ryan)
*/
//=============================================================================
+
#ifndef ACE_ENV_VALUE_T_H
#define ACE_ENV_VALUE_T_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
#include "ace/Global_Macros.h"
#include "ace/OS_NS_stdlib.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Env_Value
*
@@ -40,81 +47,104 @@ public:
* <open>'d.
*/
ACE_Env_Value (void);
+
/// Constructor that calls <open>.
ACE_Env_Value (const ACE_TCHAR *varname,
const T &vardefault);
+
/// Destroy the value.
~ACE_Env_Value (void);
+
/// Returns the value as type T.
operator T (void);
+
/// The constructor, read @a varname from the environment, using
/// @a defval as its value if it is not defined.
void open (const ACE_TCHAR *varname, const T &defval);
+
/// Returns the name of the variable being tracked.
const ACE_TCHAR *varname (void) const;
+
private:
/// Disallow copying and assignment.
ACE_UNIMPLEMENTED_FUNC (ACE_Env_Value(const ACE_Env_Value<T> &))
ACE_UNIMPLEMENTED_FUNC (ACE_Env_Value<T> operator=(const ACE_Env_Value<T> &))
+
void fetch_value (void);
+
const ACE_TCHAR *varname_;
T value_;
};
+
/// Function to convert a string @a s into type @c T.
template <class T> void ACE_Convert (const ACE_TCHAR *s, T &t);
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Env_Value_T.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Env_Value_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template <> inline void
ACE_Convert (const ACE_TCHAR *s, ACE_TCHAR *&v)
{
v = (ACE_TCHAR *) s;
}
+
template <> inline void
ACE_Convert (const ACE_TCHAR *s, const ACE_TCHAR *&v)
{
v = (const ACE_TCHAR *) s;
}
+
template <> inline void
ACE_Convert (const ACE_TCHAR *s, short &si)
{
si = static_cast<short> (ACE_OS::strtol (s, 0, 10));
}
+
template <> inline void
ACE_Convert (const ACE_TCHAR *s, u_short &us)
{
us = static_cast <u_short> (ACE_OS::strtol (s, 0, 10));
}
+
template <> inline void
ACE_Convert (const ACE_TCHAR *s, u_int &i)
{
i = static_cast<u_int> (ACE_OS::strtol (s, 0, 10));
}
+
template <> inline void
ACE_Convert (const ACE_TCHAR *s, long &l)
{
l = ACE_OS::strtol (s, 0, 10);
}
+
template <> inline void
ACE_Convert (const ACE_TCHAR *s, int &i)
{
i = static_cast<int> (ACE_OS::strtol (s, 0, 10));
}
+
template <> inline void
ACE_Convert (const ACE_TCHAR *s, u_long &ul)
{
ul = ACE_OS::strtoul (s, 0, 10);
}
+
template <> inline void
ACE_Convert (const ACE_TCHAR *s, double &d)
{
d = ACE_OS::strtod (s, 0);
}
+
// Default calls a CTOR on type T of the form 'T::T(const char*)', but
// users can feel free to create their own specialized conversion
// functions if necessary, as shown above. Note that for 'char*' the
@@ -125,10 +155,13 @@ ACE_Convert (const ACE_TCHAR *s, T &t)
{
t = T (s);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Env_Value_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
#endif /* ACE_ENV_VALUE_T_H */
diff --git a/dep/ACE_wrappers/ace/Env_Value_T.inl b/dep/ACE_wrappers/ace/Env_Value_T.inl
index c18a3205eb7..d9af1b03164 100644
--- a/dep/ACE_wrappers/ace/Env_Value_T.inl
+++ b/dep/ACE_wrappers/ace/Env_Value_T.inl
@@ -1,15 +1,19 @@
// $Id: Env_Value_T.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template <class T> ACE_INLINE
ACE_Env_Value<T>::operator T (void)
{
return value_;
}
+
template <class T> ACE_INLINE
ACE_Env_Value<T>::ACE_Env_Value (void)
: varname_ (0)
{
}
+
template <class T> ACE_INLINE
ACE_Env_Value<T>::ACE_Env_Value (const ACE_TCHAR *varname,
const T &defval)
@@ -18,6 +22,7 @@ ACE_Env_Value<T>::ACE_Env_Value (const ACE_TCHAR *varname,
{
this->fetch_value ();
}
+
template <class T> ACE_INLINE void
ACE_Env_Value<T>::open (const ACE_TCHAR *varname,
const T &defval)
@@ -26,6 +31,7 @@ ACE_Env_Value<T>::open (const ACE_TCHAR *varname,
this->value_ = defval;
this->fetch_value ();
}
+
template <class T> ACE_INLINE void
ACE_Env_Value<T>::fetch_value (void)
{
@@ -39,13 +45,16 @@ ACE_Env_Value<T>::fetch_value (void)
ACE_Convert (ACE_TEXT_CHAR_TO_TCHAR (nenv), this->value_);
#endif
}
+
template <class T> ACE_INLINE const ACE_TCHAR*
ACE_Env_Value<T>::varname (void) const
{
return this->varname_;
}
+
template <class T> ACE_INLINE
ACE_Env_Value<T>::~ACE_Env_Value (void)
{
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Event.cpp b/dep/ACE_wrappers/ace/Event.cpp
index d98e055fd3e..a5461de4bd9 100644
--- a/dep/ACE_wrappers/ace/Event.cpp
+++ b/dep/ACE_wrappers/ace/Event.cpp
@@ -1,11 +1,17 @@
// $Id: Event.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Event.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Event.inl"
#endif /* __ACE_INLINE__ */
+
#include "ace/Log_Msg.h"
+
ACE_RCSID(ace, Event, "$Id: Event.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_Event::ACE_Event (int manual_reset,
int initial_state,
int type,
@@ -25,10 +31,12 @@ ACE_Event::ACE_Event (int manual_reset,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_Event::ACE_Event")));
}
+
ACE_Event::~ACE_Event (void)
{
this->remove ();
}
+
int
ACE_Event::remove (void)
{
@@ -40,11 +48,13 @@ ACE_Event::remove (void)
}
return result;
}
+
int
ACE_Event::wait (void)
{
return ACE_OS::event_wait (&this->handle_);
}
+
int
ACE_Event::wait (const ACE_Time_Value *abstime, int use_absolute_time)
{
@@ -52,21 +62,25 @@ ACE_Event::wait (const ACE_Time_Value *abstime, int use_absolute_time)
const_cast <ACE_Time_Value *> (abstime),
use_absolute_time);
}
+
int
ACE_Event::signal (void)
{
return ACE_OS::event_signal (&this->handle_);
}
+
int
ACE_Event::pulse (void)
{
return ACE_OS::event_pulse (&this->handle_);
}
+
int
ACE_Event::reset (void)
{
return ACE_OS::event_reset (&this->handle_);
}
+
void
ACE_Event::dump (void) const
{
@@ -75,5 +89,6 @@ ACE_Event::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Event.h b/dep/ACE_wrappers/ace/Event.h
index 3c9f744a9c4..69d819b3978 100644
--- a/dep/ACE_wrappers/ace/Event.h
+++ b/dep/ACE_wrappers/ace/Event.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file Event.h
@@ -10,15 +11,21 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//==========================================================================
+
#ifndef ACE_EVENT_H
#define ACE_EVENT_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/OS_NS_Thread.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Event
*
@@ -39,16 +46,20 @@ public:
const ACE_TCHAR *name = 0,
void *arg = 0,
LPSECURITY_ATTRIBUTES sa = 0);
+
/// Implicitly destroy the event variable.
~ACE_Event (void);
+
/**
* Explicitly destroy the event variable. Note that only one thread
* should call this method since it doesn't protect against race
* conditions.
*/
int remove (void);
+
/// Underlying handle to event.
ACE_event_t handle (void) const;
+
/**
* Set the underlying handle to event. Note that this method assumes
* ownership of the <handle> and will close it down in <remove>. If
@@ -58,6 +69,7 @@ public:
* overwriting it.
*/
void handle (ACE_event_t new_handle);
+
/**
* if MANUAL reset
* sleep till the event becomes signaled
@@ -67,11 +79,13 @@ public:
* event resets wait() completes.
*/
int wait (void);
+
/// Same as wait() above, but this one can be timed
/// @a abstime is absolute time-of-day if if @a use_absolute_time
/// is non-0, else it is relative time.
int wait (const ACE_Time_Value *abstime,
int use_absolute_time = 1);
+
/**
* if MANUAL reset
* wake up all waiting threads
@@ -82,6 +96,7 @@ public:
* reset event
*/
int signal (void);
+
/**
* if MANUAL reset
* wakeup all waiting threads and
@@ -91,30 +106,39 @@ public:
* reset event
*/
int pulse (void);
+
/// Set to nonsignaled state.
int reset (void);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks
ACE_ALLOC_HOOK_DECLARE;
+
protected:
/// The underlying handle.
ACE_event_t handle_;
+
/// Keeps track of whether <remove> has been called yet to avoid
/// multiple <remove> calls, e.g., explicitly and implicitly in the
/// destructor. This flag isn't protected by a lock, so make sure
/// that you don't have multiple threads simultaneously calling
/// <remove> on the same object, which is a bad idea anyway...
bool removed_;
+
private:
// = Prevent copying.
ACE_Event (const ACE_Event& event);
const ACE_Event &operator= (const ACE_Event &rhs);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Event.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_EVENT_H */
diff --git a/dep/ACE_wrappers/ace/Event.inl b/dep/ACE_wrappers/ace/Event.inl
index 295bf267de1..ae0805c95f0 100644
--- a/dep/ACE_wrappers/ace/Event.inl
+++ b/dep/ACE_wrappers/ace/Event.inl
@@ -1,14 +1,18 @@
// -*- C++ -*-
// $Id: Event.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE ACE_event_t
ACE_Event::handle (void) const
{
return this->handle_;
}
+
ACE_INLINE void
ACE_Event::handle (ACE_event_t new_handle)
{
this->handle_ = new_handle;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Event_Handler.cpp b/dep/ACE_wrappers/ace/Event_Handler.cpp
index c360e156ad5..916998eea52 100644
--- a/dep/ACE_wrappers/ace/Event_Handler.cpp
+++ b/dep/ACE_wrappers/ace/Event_Handler.cpp
@@ -1,19 +1,26 @@
// Event_Handler.cpp
// $Id: Event_Handler.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Event_Handler.h"
#include "ace/OS_Errno.h"
#include "ace/Reactor.h"
#include "ace/Thread_Manager.h"
/* Need to see if ACE_HAS_BUILTIN_ATOMIC_OP defined */
#include "ace/Atomic_Op.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Event_Handler.inl"
#endif /* __ACE_INLINE__ */
+
#include <algorithm>
+
ACE_RCSID(ace, Event_Handler, "$Id: Event_Handler.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Implement conceptually abstract virtual functions in the base class
// so derived classes don't have to implement unused ones.
+
ACE_Event_Handler::ACE_Event_Handler (ACE_Reactor *r,
int p)
: reference_count_ (1),
@@ -23,149 +30,185 @@ ACE_Event_Handler::ACE_Event_Handler (ACE_Reactor *r,
{
// ACE_TRACE ("ACE_Event_Handler::ACE_Event_Handler");
}
+
ACE_Event_Handler::~ACE_Event_Handler (void)
{
// ACE_TRACE ("ACE_Event_Handler::~ACE_Event_Handler");
}
+
// Gets the file descriptor associated with this I/O device.
+
ACE_HANDLE
ACE_Event_Handler::get_handle (void) const
{
ACE_TRACE ("ACE_Event_Handler::get_handle");
return ACE_INVALID_HANDLE;
}
+
// Sets the file descriptor associated with this I/O device.
+
void
ACE_Event_Handler::set_handle (ACE_HANDLE)
{
ACE_TRACE ("ACE_Event_Handler::set_handle");
}
+
// Gets the priority of this handler.
+
int
ACE_Event_Handler::priority (void) const
{
ACE_TRACE ("ACE_Event_Handler::priority");
return this->priority_;
}
+
// Sets the priority
+
void
ACE_Event_Handler::priority (int priority)
{
ACE_TRACE ("ACE_Event_Handler::priority");
this->priority_ = priority;
}
+
// Called when the object is about to be removed from the Dispatcher
// tables.
+
int
ACE_Event_Handler::handle_close (ACE_HANDLE, ACE_Reactor_Mask)
{
ACE_TRACE ("ACE_Event_Handler::handle_close");
return -1;
}
+
// Called when input becomes available on fd.
+
int
ACE_Event_Handler::handle_input (ACE_HANDLE)
{
ACE_TRACE ("ACE_Event_Handler::handle_input");
return -1;
}
+
// Called when output is possible on fd.
+
int
ACE_Event_Handler::handle_output (ACE_HANDLE)
{
ACE_TRACE ("ACE_Event_Handler::handle_output");
return -1;
}
+
// Called when urgent data is available on fd.
+
int
ACE_Event_Handler::handle_exception (ACE_HANDLE)
{
ACE_TRACE ("ACE_Event_Handler::handle_exception");
return -1;
}
+
// Called when timer expires, TV stores the current time.
+
int
ACE_Event_Handler::handle_timeout (const ACE_Time_Value &, const void *)
{
ACE_TRACE ("ACE_Event_Handler::handle_timeout");
return -1;
}
+
// Called when a monitored Process exits
+
int
ACE_Event_Handler::handle_exit (ACE_Process *)
{
ACE_TRACE ("ACE_Event_Handler::handle_exit");
return -1;
}
+
// Called when a registered signal occurs.
+
int
ACE_Event_Handler::handle_signal (int, siginfo_t *, ucontext_t *)
{
ACE_TRACE ("ACE_Event_Handler::handle_signal");
return -1;
}
+
int
ACE_Event_Handler::resume_handler (void)
{
ACE_TRACE ("ACE_Event_Handler::resume_handler");
+
// Return a default value and allow the reactor to take care of
// resuming the handler
return ACE_Event_Handler::ACE_REACTOR_RESUMES_HANDLER;
}
+
int
ACE_Event_Handler::handle_qos (ACE_HANDLE)
{
ACE_TRACE ("ACE_Event_Handler::handle_qos");
return -1;
}
+
int
ACE_Event_Handler::handle_group_qos (ACE_HANDLE)
{
ACE_TRACE ("ACE_Event_Handler::handle_group_qos");
return -1;
}
+
void
ACE_Event_Handler::reactor (ACE_Reactor *reactor)
{
ACE_TRACE ("ACE_Event_Handler::reactor");
this->reactor_ = reactor;
}
+
ACE_Reactor *
ACE_Event_Handler::reactor (void) const
{
ACE_TRACE ("ACE_Event_Handler::reactor");
return this->reactor_;
}
+
ACE_Reactor_Timer_Interface *
ACE_Event_Handler::reactor_timer_interface (void) const
{
ACE_TRACE ("ACE_Event_Handler::reactor_timer_interface");
return this->reactor_;
}
+
ACE_Event_Handler::Reference_Count
ACE_Event_Handler::add_reference (void)
{
bool const reference_counting_required =
this->reference_counting_policy ().value () ==
ACE_Event_Handler::Reference_Counting_Policy::ENABLED;
+
if (reference_counting_required)
return ++this->reference_count_;
else
return 1;
}
+
ACE_Event_Handler::Reference_Count
ACE_Event_Handler::remove_reference (void)
{
bool const reference_counting_required =
this->reference_counting_policy ().value () ==
ACE_Event_Handler::Reference_Counting_Policy::ENABLED;
+
if (reference_counting_required)
{
Reference_Count result =
--this->reference_count_;
+
if (result == 0)
delete this;
+
return result;
}
else
@@ -173,42 +216,53 @@ ACE_Event_Handler::remove_reference (void)
return 1;
}
}
+
ACE_Event_Handler::Policy::~Policy (void)
{
}
+
ACE_Event_Handler::Reference_Counting_Policy::Reference_Counting_Policy (Reference_Counting_Policy::Value value)
: value_ (value)
{
}
+
ACE_Event_Handler::Reference_Counting_Policy::Value
ACE_Event_Handler::Reference_Counting_Policy::value (void) const
{
return this->value_;
}
+
void
ACE_Event_Handler::Reference_Counting_Policy::value (ACE_Event_Handler::Reference_Counting_Policy::Value value)
{
this->value_ = value;
}
+
ACE_Event_Handler::Reference_Counting_Policy &
ACE_Event_Handler::reference_counting_policy (void)
{
return this->reference_counting_policy_;
}
+
//#if !defined (ACE_HAS_WINCE)
+
ACE_THR_FUNC_RETURN
ACE_Event_Handler::read_adapter (void *args)
{
ACE_Event_Handler *this_ptr = static_cast<ACE_Event_Handler *> (args);
ACE_Reactor *r = this_ptr->reactor ();
+
while (this_ptr->handle_input (ACE_STDIN) != -1)
continue;
+
this_ptr->handle_close (ACE_STDIN, ACE_Event_Handler::READ_MASK);
// It's possible for handle_close() to "delete this" so we need to
// cache the reactor pointer and use it here.
r->notify ();
+
return 0;
}
+
int
ACE_Event_Handler::register_stdin_handler (ACE_Event_Handler *eh,
ACE_Reactor *reactor,
@@ -217,6 +271,7 @@ ACE_Event_Handler::register_stdin_handler (ACE_Event_Handler *eh,
{
#if defined (ACE_WIN32)
ACE_UNUSED_ARG (reactor);
+
eh->reactor (reactor);
return thr_mgr->spawn (&read_adapter, static_cast<void *> (eh), flags);
#else
@@ -228,12 +283,14 @@ ACE_Event_Handler::register_stdin_handler (ACE_Event_Handler *eh,
ACE_Event_Handler::READ_MASK);
#endif /* ACE_WIN32 */
}
+
int
ACE_Event_Handler::remove_stdin_handler (ACE_Reactor *reactor,
ACE_Thread_Manager * /* thr_mgr */)
{
#if defined (ACE_WIN32)
ACE_UNUSED_ARG (reactor);
+
// What should we do here?
ACE_NOTSUP_RETURN (-1);
#else
@@ -241,16 +298,21 @@ ACE_Event_Handler::remove_stdin_handler (ACE_Reactor *reactor,
ACE_Event_Handler::READ_MASK);
#endif /* ACE_WIN32 */
}
+
//#endif /* ACE_HAS_WINCE */
+
// ---------------------------------------------------------------------
+
ACE_Event_Handler_var::ACE_Event_Handler_var (void)
: ptr_ (0)
{
}
+
ACE_Event_Handler_var::ACE_Event_Handler_var (ACE_Event_Handler *p)
: ptr_ (p)
{
}
+
ACE_Event_Handler_var::ACE_Event_Handler_var (const ACE_Event_Handler_var &b)
: ptr_ (b.ptr_)
{
@@ -259,6 +321,7 @@ ACE_Event_Handler_var::ACE_Event_Handler_var (const ACE_Event_Handler_var &b)
this->ptr_->add_reference ();
}
}
+
ACE_Event_Handler_var::~ACE_Event_Handler_var (void)
{
if (this->ptr_ != 0)
@@ -267,6 +330,7 @@ ACE_Event_Handler_var::~ACE_Event_Handler_var (void)
this->ptr_->remove_reference ();
}
}
+
ACE_Event_Handler_var &
ACE_Event_Handler_var::operator= (ACE_Event_Handler *p)
{
@@ -275,25 +339,31 @@ ACE_Event_Handler_var::operator= (ACE_Event_Handler *p)
ACE_Event_Handler_var tmp (p);
std::swap (this->ptr_, tmp.ptr_);
}
+
return *this;
}
+
ACE_Event_Handler_var &
ACE_Event_Handler_var::operator= (const ACE_Event_Handler_var &b)
{
ACE_Event_Handler_var tmp (b);
std::swap (this->ptr_, tmp.ptr_);
+
return *this;
}
+
ACE_Event_Handler *
ACE_Event_Handler_var::operator->() const
{
return this->ptr_;
}
+
ACE_Event_Handler *
ACE_Event_Handler_var::handler (void) const
{
return this->ptr_;
}
+
ACE_Event_Handler *
ACE_Event_Handler_var::release (void)
{
@@ -301,16 +371,20 @@ ACE_Event_Handler_var::release (void)
this->ptr_ = 0;
return old;
}
+
void
ACE_Event_Handler_var::reset (ACE_Event_Handler *p)
{
*this = p;
}
+
// ---------------------------------------------------------------------
+
ACE_Notification_Buffer::ACE_Notification_Buffer (void)
{
ACE_TRACE ("ACE_Notification_Buffer::ACE_Notification_Buffer");
}
+
ACE_Notification_Buffer::ACE_Notification_Buffer (ACE_Event_Handler *eh,
ACE_Reactor_Mask mask)
: eh_ (eh),
@@ -318,5 +392,6 @@ ACE_Notification_Buffer::ACE_Notification_Buffer (ACE_Event_Handler *eh,
{
ACE_TRACE ("ACE_Notification_Buffer::ACE_Notification_Buffer");
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Event_Handler.h b/dep/ACE_wrappers/ace/Event_Handler.h
index 1939ff59850..e97cca48a46 100644
--- a/dep/ACE_wrappers/ace/Event_Handler.h
+++ b/dep/ACE_wrappers/ace/Event_Handler.h
@@ -1,4 +1,5 @@
/* -*- C++ -*- */
+
//==========================================================================
/**
* @file Event_Handler.h
@@ -8,24 +9,32 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//==========================================================================
+
#ifndef ACE_EVENT_HANDLER_H
#define ACE_EVENT_HANDLER_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/os_signal.h"
#include "ace/Atomic_Op.h"
#include "ace/Synch_Traits.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward declaration.
class ACE_Message_Block;
class ACE_Reactor;
class ACE_Reactor_Timer_Interface;
class ACE_Thread_Manager;
class ACE_Process;
+
typedef unsigned long ACE_Reactor_Mask;
+
/**
* @class ACE_Event_Handler
*
@@ -73,26 +82,36 @@ public:
EXCEPT_MASK,
DONT_CALL = (1 << 9)
};
+
/// Destructor is virtual to enable proper cleanup.
virtual ~ACE_Event_Handler (void);
+
/// Get the I/O handle.
virtual ACE_HANDLE get_handle (void) const;
+
/// Set the I/O handle.
virtual void set_handle (ACE_HANDLE);
+
// = Get/set priority
+
// Priorities run from MIN_PRIORITY (which is the "lowest priority")
// to MAX_PRIORITY (which is the "highest priority").
/// Get the priority of the Event_Handler.
virtual int priority (void) const;
+
/// Set the priority of the Event_Handler.
virtual void priority (int priority);
+
/// Called when input events occur (e.g., connection or data).
virtual int handle_input (ACE_HANDLE fd = ACE_INVALID_HANDLE);
+
/// Called when output events are possible (e.g., when flow control
/// abates or non-blocking connection completes).
virtual int handle_output (ACE_HANDLE fd = ACE_INVALID_HANDLE);
+
/// Called when an exceptional events occur (e.g., SIGURG).
virtual int handle_exception (ACE_HANDLE fd = ACE_INVALID_HANDLE);
+
/**
* Called when timer expires. @a current_time represents the current
* time that the <Event_Handler> was selected for timeout
@@ -101,17 +120,21 @@ public:
*/
virtual int handle_timeout (const ACE_Time_Value &current_time,
const void *act = 0);
+
/// Called when a process exits.
virtual int handle_exit (ACE_Process *);
+
/// Called when a <handle_*()> method returns -1 or when the
/// <remove_handler> method is called on an ACE_Reactor. The
/// @a close_mask indicates which event has triggered the
/// <handle_close> method callback on a particular @a handle.
virtual int handle_close (ACE_HANDLE handle,
ACE_Reactor_Mask close_mask);
+
/// Called when object is signaled by OS (either via UNIX signals or
/// when a Win32 object becomes signaled).
virtual int handle_signal (int signum, siginfo_t * = 0, ucontext_t * = 0);
+
enum
{
/// The handler is not resumed at all. Could lead to deadlock..
@@ -135,15 +158,20 @@ public:
* be used across different components in ACE.
*/
virtual int resume_handler (void);
+
virtual int handle_qos (ACE_HANDLE = ACE_INVALID_HANDLE);
virtual int handle_group_qos (ACE_HANDLE = ACE_INVALID_HANDLE);
+
// = Accessors to set/get the various event demultiplexors.
/// Set the event demultiplexors.
virtual void reactor (ACE_Reactor *reactor);
+
/// Get the event demultiplexors.
virtual ACE_Reactor *reactor (void) const;
+
/// Get only the reactor's timer related interface.
virtual ACE_Reactor_Timer_Interface *reactor_timer_interface (void) const;
+
/**
* Used to read from non-socket ACE_HANDLEs in our own thread to
* work around Win32 limitations that don't allow us to <select> on
@@ -155,6 +183,7 @@ public:
* reading from ACE_STDIN.
*/
static ACE_THR_FUNC_RETURN read_adapter (void *event_handler);
+
/**
* Abstracts away from the differences between Win32 and ACE with
* respect to reading from ACE_STDIN, which is non-<select>'able on
@@ -164,11 +193,14 @@ public:
ACE_Reactor *reactor,
ACE_Thread_Manager *thr_mgr,
int flags = THR_DETACHED);
+
/// Performs the inverse of the <register_stdin_handler> method.
static int remove_stdin_handler (ACE_Reactor *reactor,
ACE_Thread_Manager *thr_mgr);
+
/// Reference count type.
typedef long Reference_Count;
+
/// Increment reference count on the handler.
/**
* This method is called when the handler is registered with the
@@ -178,6 +210,7 @@ public:
* @return Current reference count.
*/
virtual Reference_Count add_reference (void);
+
/// Decrement reference count on the handler.
/**
* This method is called when the handler is removed from the
@@ -188,6 +221,7 @@ public:
* @return Current reference count.
*/
virtual Reference_Count remove_reference (void);
+
/**
* @class Policy
*
@@ -195,10 +229,13 @@ public:
*/
class ACE_Export Policy
{
+
public:
+
/// Virtual destructor.
virtual ~Policy (void);
};
+
/**
* @class Reference_Counting_Policy
*
@@ -215,7 +252,9 @@ public:
{
/// This policy can only be created by the handler.
friend class ACE_Event_Handler;
+
public:
+
enum Value
{
/// Perform reference counting.
@@ -223,34 +262,48 @@ public:
/// Don't perform reference counting.
DISABLED
};
+
/// Current Reference_Counting_Policy.
Value value (void) const;
+
/// Update Reference_Counting_Policy.
void value (Value value);
+
private:
+
/// Private constructor.
Reference_Counting_Policy (Value value);
+
/// The value of the policy.
Value value_;
};
+
/// Current Reference_Counting_Policy.
Reference_Counting_Policy &reference_counting_policy (void);
+
protected:
/// Force ACE_Event_Handler to be an abstract base class.
ACE_Event_Handler (ACE_Reactor * = 0,
int priority = ACE_Event_Handler::LO_PRIORITY);
+
/// Typedef for implementation of reference counting.
typedef ACE_Atomic_Op<ACE_SYNCH_MUTEX, Reference_Count> Atomic_Reference_Count;
+
/// Reference count.
Atomic_Reference_Count reference_count_;
+
private:
+
/// Priority of this Event_Handler.
int priority_;
+
/// Pointer to the various event demultiplexors.
ACE_Reactor *reactor_;
+
/// Reference counting requirements.
Reference_Counting_Policy reference_counting_policy_;
};
+
/**
* @class ACE_Event_Handler_var
*
@@ -261,31 +314,45 @@ private:
*/
class ACE_Export ACE_Event_Handler_var
{
+
public:
+
/// Default constructor.
ACE_Event_Handler_var (void);
+
/// Construct with a handler.
ACE_Event_Handler_var (ACE_Event_Handler *p);
+
/// Copy constructor.
ACE_Event_Handler_var (const ACE_Event_Handler_var &b);
+
/// Destructor.
~ACE_Event_Handler_var (void);
+
/// Assignment to a handler.
ACE_Event_Handler_var &operator= (ACE_Event_Handler *p);
+
/// Assignment to a ACE_Event_Handler_var.
ACE_Event_Handler_var &operator= (const ACE_Event_Handler_var &b);
+
/// Overloaded "->".
ACE_Event_Handler *operator-> () const;
+
/// Access the handler.
ACE_Event_Handler *handler (void) const;
+
/// Release the handler.
ACE_Event_Handler *release (void);
+
/// Reset the handler.
void reset (ACE_Event_Handler *p = 0);
+
private:
+
/// Handler.
ACE_Event_Handler *ptr_;
};
+
/**
* @class ACE_Notification_Buffer
*
@@ -296,20 +363,27 @@ class ACE_Export ACE_Notification_Buffer
{
public:
ACE_Notification_Buffer (void);
+
ACE_Notification_Buffer (ACE_Event_Handler *eh,
ACE_Reactor_Mask mask);
+
/// Default dtor.
~ACE_Notification_Buffer (void);
+
/// Pointer to the Event_Handler that will be dispatched
/// by the main event loop.
ACE_Event_Handler *eh_;
+
/// Mask that indicates which method to call.
ACE_Reactor_Mask mask_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Event_Handler.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_EVENT_HANDLER_H */
diff --git a/dep/ACE_wrappers/ace/Event_Handler.inl b/dep/ACE_wrappers/ace/Event_Handler.inl
index 1f285572543..d97c45466ae 100644
--- a/dep/ACE_wrappers/ace/Event_Handler.inl
+++ b/dep/ACE_wrappers/ace/Event_Handler.inl
@@ -1,9 +1,12 @@
// -*- C++ -*-
//
// $Id: Event_Handler.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_Notification_Buffer::~ACE_Notification_Buffer (void)
{
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Event_Handler_T.h b/dep/ACE_wrappers/ace/Event_Handler_T.h
index 99c7ad8eaf5..47cc5fd56bf 100644
--- a/dep/ACE_wrappers/ace/Event_Handler_T.h
+++ b/dep/ACE_wrappers/ace/Event_Handler_T.h
@@ -1,4 +1,5 @@
/* -*- C++ -*- */
+
//=============================================================================
/**
* @file Event_Handler_T.h
@@ -8,15 +9,21 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_EVENT_HANDLER_T_H
#define ACE_EVENT_HANDLER_T_H
#include /**/ "ace/pre.h"
+
#include "ace/Event_Handler.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_TEMPLATE_TYPEDEFS)
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Event_Handler_T
*
@@ -58,17 +65,23 @@ class ACE_Event_Handler_T : public ACE_Event_Handler
{
public:
// = Typedefs to simplify pointer-to-member-function registration.
+
// Get/set the underlying handle.
typedef ACE_HANDLE (T::*GET_HANDLE) (void) const;
typedef void (T::*SET_HANDLE) (ACE_HANDLE);
+
/// Handle I/O events.
typedef int (T::*IO_HANDLER) (ACE_HANDLE);
+
/// Handle timeout events.
typedef int (T::*TO_HANDLER) (const ACE_Time_Value &, const void *);
+
/// Handle close events.
typedef int (T::*CL_HANDLER) (ACE_HANDLE, ACE_Reactor_Mask);
+
/// = Initialization and termination methods.
typedef int (T::*SIG_HANDLER) (int, siginfo_t*, ucontext_t*);
+
/// Initialize the op_handler.
ACE_Event_Handler_T (T *op_handler,
int delete_handler,
@@ -80,9 +93,12 @@ public:
IO_HANDLER output = 0,
SET_HANDLE set_handle = 0,
IO_HANDLER except = 0);
+
/// Close down and delete the <op_handler>
~ACE_Event_Handler_T (void);
+
// = Override all the ACE_Event_Handler methods.
+
// These methods all delegate down to the <T> operations handler.
virtual ACE_HANDLE get_handle (void) const;
virtual void set_handle (ACE_HANDLE);
@@ -92,60 +108,84 @@ public:
virtual int handle_timeout (const ACE_Time_Value &tv, const void *arg = 0);
virtual int handle_close (ACE_HANDLE fd, ACE_Reactor_Mask close_mask);
virtual int handle_signal (int signum, siginfo_t * = 0, ucontext_t * = 0);
+
// = Get/set the operations handler.
T *op_handler (void);
void op_handler (T *);
+
// = Get/set the target pointer-to-method used for dispatching.
+
GET_HANDLE handle_get (void);
void handle_get (GET_HANDLE);
+
SET_HANDLE handle_set (void);
void handle_set (SET_HANDLE);
+
IO_HANDLER input_handler (void);
void input_handler (IO_HANDLER);
+
IO_HANDLER output_handler (void);
void output_handler (IO_HANDLER);
+
IO_HANDLER except_handler (void);
void except_handler (IO_HANDLER);
+
TO_HANDLER to_handler (void);
void to_handler (TO_HANDLER);
+
CL_HANDLER cl_handler (void);
void cl_handler (CL_HANDLER);
+
SIG_HANDLER sig_handler (void);
void sig_handler (SIG_HANDLER);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
/// Pointer to the object that handles all the delegated operations.
T *op_handler_;
+
// = Handle input, output, and exception events.
IO_HANDLER input_handler_;
IO_HANDLER output_handler_;
IO_HANDLER except_handler_;
+
/// Handle timeout events.
TO_HANDLER to_handler_;
+
/// Handle close events.
CL_HANDLER cl_handler_;
+
/// Handle signal events.
SIG_HANDLER sig_handler_;
+
/// Keeps track of whether we need to delete the handler in the
/// destructor.
int delete_handler_;
+
// = Get/set underlying handle.
SET_HANDLE set_handle_;
GET_HANDLE get_handle_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Event_Handler_T.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Event_Handler_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Event_Handler_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#endif /* ACE_HAS_TEMPLATE_TYPEDEFS */
#include /**/ "ace/post.h"
#endif /* ACE_EVENT_HANDLER_H */
diff --git a/dep/ACE_wrappers/ace/Event_Handler_T.inl b/dep/ACE_wrappers/ace/Event_Handler_T.inl
index 2207be8ab2a..40db43e8e23 100644
--- a/dep/ACE_wrappers/ace/Event_Handler_T.inl
+++ b/dep/ACE_wrappers/ace/Event_Handler_T.inl
@@ -1,114 +1,135 @@
// -*- C++ -*-
//
// $Id: Event_Handler_T.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Global_Macros.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template<class T> ACE_INLINE void
ACE_Event_Handler_T<T>::op_handler (T *op)
{
ACE_TRACE ("ACE_Event_Handler_T<T>::op_handler");
this->op_handler_ = op;
}
+
template<class T> ACE_INLINE T *
ACE_Event_Handler_T<T>::op_handler (void)
{
ACE_TRACE ("ACE_Event_Handler_T<T>::op_handler");
return this->op_handler_;
}
+
template<class T> ACE_INLINE typename ACE_Event_Handler_T<T>::GET_HANDLE
ACE_Event_Handler_T<T>::handle_get (void)
{
ACE_TRACE ("ACE_Event_Handler_T<T>::handle_get");
return this->get_handle_;
}
+
template<class T> ACE_INLINE void
ACE_Event_Handler_T<T>::handle_get (typename ACE_Event_Handler_T<T>::GET_HANDLE h)
{
ACE_TRACE ("ACE_Event_Handler_T<T>::handle_get");
this->get_handle_ = h;
}
+
template<class T> ACE_INLINE typename ACE_Event_Handler_T<T>::SET_HANDLE
ACE_Event_Handler_T<T>::handle_set (void)
{
ACE_TRACE ("ACE_Event_Handler_T<T>::handle_set");
return this->set_handle_;
}
+
template<class T> ACE_INLINE void
ACE_Event_Handler_T<T>::handle_set (typename ACE_Event_Handler_T<T>::SET_HANDLE h)
{
ACE_TRACE ("ACE_Event_Handler_T<T>::handle_set");
this->set_handle_ = h;
}
+
template<class T> ACE_INLINE typename ACE_Event_Handler_T<T>::IO_HANDLER
ACE_Event_Handler_T<T>::input_handler (void)
{
ACE_TRACE ("ACE_Event_Handler_T<T>::input_handler");
return this->input_handler_;
}
+
template<class T> ACE_INLINE void
ACE_Event_Handler_T<T>::input_handler (typename ACE_Event_Handler_T<T>::IO_HANDLER h)
{
ACE_TRACE ("ACE_Event_Handler_T<T>::input_handler");
this->input_handler_ = h;
}
+
template<class T> ACE_INLINE typename ACE_Event_Handler_T<T>::IO_HANDLER
ACE_Event_Handler_T<T>::output_handler (void)
{
ACE_TRACE ("ACE_Event_Handler_T<T>::output_handler");
return this->output_handler_;
}
+
template<class T> ACE_INLINE void
ACE_Event_Handler_T<T>::output_handler (typename ACE_Event_Handler_T<T>::IO_HANDLER h)
{
ACE_TRACE ("ACE_Event_Handler_T<T>::output_handler");
this->output_handler_ = h;
}
+
template<class T> ACE_INLINE typename ACE_Event_Handler_T<T>::IO_HANDLER
ACE_Event_Handler_T<T>::except_handler (void)
{
ACE_TRACE ("ACE_Event_Handler_T<T>::except_handler");
return this->except_handler_;
}
+
template<class T> ACE_INLINE void
ACE_Event_Handler_T<T>::except_handler (typename ACE_Event_Handler_T<T>::IO_HANDLER h)
{
ACE_TRACE ("ACE_Event_Handler_T<T>::except_handler");
this->except_handler_ = h;
}
+
template<class T> ACE_INLINE typename ACE_Event_Handler_T<T>::TO_HANDLER
ACE_Event_Handler_T<T>::to_handler (void)
{
ACE_TRACE ("ACE_Event_Handler_T<T>::to_handler");
return this->to_handler_;
}
+
template<class T> ACE_INLINE void
ACE_Event_Handler_T<T>::to_handler (typename ACE_Event_Handler_T<T>::TO_HANDLER h)
{
ACE_TRACE ("ACE_Event_Handler_T<T>::to_handler");
this->to_handler_ = h;
}
+
template<class T> ACE_INLINE typename ACE_Event_Handler_T<T>::CL_HANDLER
ACE_Event_Handler_T<T>::cl_handler (void)
{
ACE_TRACE ("ACE_Event_Handler_T<T>::cl_handler");
return this->cl_handler_;
}
+
template<class T> ACE_INLINE void
ACE_Event_Handler_T<T>::cl_handler (typename ACE_Event_Handler_T<T>::CL_HANDLER h)
{
ACE_TRACE ("ACE_Event_Handler_T<T>::cl_handler");
this->cl_handler_ = h;
}
+
template<class T> ACE_INLINE typename ACE_Event_Handler_T<T>::SIG_HANDLER
ACE_Event_Handler_T<T>::sig_handler (void)
{
ACE_TRACE ("ACE_Event_Handler_T<T>::sig_handler");
return this->sig_handler_;
}
+
template<class T> ACE_INLINE void
ACE_Event_Handler_T<T>::sig_handler (typename ACE_Event_Handler_T<T>::SIG_HANDLER h)
{
ACE_TRACE ("ACE_Event_Handler_T<T>::sig_handler");
this->sig_handler_ = h;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Exception_Macros.h b/dep/ACE_wrappers/ace/Exception_Macros.h
index 26a772ed064..32805184d04 100644
--- a/dep/ACE_wrappers/ace/Exception_Macros.h
+++ b/dep/ACE_wrappers/ace/Exception_Macros.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
// ============================================================================
/**
* @file Exception_Macros.h
@@ -15,14 +16,20 @@
* @author Krishnakumar B <kitty@cs.wustl.edu>, et al.
*/
// ============================================================================
+
// Macros for handling exceptions.
+
#ifndef ACE_EXCEPTION_MACROS_H
#define ACE_EXCEPTION_MACROS_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
# if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
# endif /* ACE_LACKS_PRAGMA_ONCE */
+
// By default, if the compiler supports native exception handling, assume
// CORBA also support native exception handling. But it can be disabled by
// defining ACE_CORBA_HAS_EXCEPTIONS=0. If the compiler does not support
@@ -42,6 +49,8 @@
# undef ACE_CORBA_HAS_EXCEPTIONS
# undef ACE_USES_NATIVE_EXCEPTIONS
#endif /* ACE_HAS_EXCEPTIONS */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_EXCEPTION_MACROS_H */
diff --git a/dep/ACE_wrappers/ace/FIFO.cpp b/dep/ACE_wrappers/ace/FIFO.cpp
index 80342f65f01..c5ace7f90d9 100644
--- a/dep/ACE_wrappers/ace/FIFO.cpp
+++ b/dep/ACE_wrappers/ace/FIFO.cpp
@@ -1,39 +1,51 @@
// $Id: FIFO.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/FIFO.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/FIFO.inl"
#endif /* __ACE_INLINE__ */
+
#include "ace/Log_Msg.h"
#include "ace/OS_NS_string.h"
#include "ace/OS_NS_errno.h"
#include "ace/OS_NS_sys_stat.h"
#include "ace/OS_NS_fcntl.h"
+
ACE_RCSID(ace, FIFO, "$Id: FIFO.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_FIFO)
+
void
ACE_FIFO::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_FIFO::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("rendezvous_ = %s"), this->rendezvous_));
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
int
ACE_FIFO::open (const ACE_TCHAR *r, int flags, mode_t perms,
LPSECURITY_ATTRIBUTES sa)
{
ACE_TRACE ("ACE_FIFO::open");
ACE_OS::strsncpy (this->rendezvous_, r, MAXPATHLEN);
+
if ((flags & O_CREAT) != 0
&& ACE_OS::mkfifo (this->rendezvous_, perms) == -1
&& !(errno == EEXIST))
return -1;
+
this->set_handle (ACE_OS::open (this->rendezvous_, flags, 0, sa));
return this->get_handle () == ACE_INVALID_HANDLE ? -1 : 0;
}
+
ACE_FIFO::ACE_FIFO (const ACE_TCHAR *fifo_name,
int flags,
mode_t perms,
@@ -43,15 +55,18 @@ ACE_FIFO::ACE_FIFO (const ACE_TCHAR *fifo_name,
if (this->open (fifo_name, flags, perms, sa) == -1)
ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ACE_FIFO")));
}
+
ACE_FIFO::ACE_FIFO (void)
{
// ACE_TRACE ("ACE_FIFO::ACE_FIFO");
}
+
int
ACE_FIFO::close (void)
{
ACE_TRACE ("ACE_FIFO::close");
int result = 0;
+
if (this->get_handle () != ACE_INVALID_HANDLE)
{
result = ACE_OS::close (this->get_handle ());
@@ -59,5 +74,6 @@ ACE_FIFO::close (void)
}
return result;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/FIFO.h b/dep/ACE_wrappers/ace/FIFO.h
index e640f640a69..a1ef6038e35 100644
--- a/dep/ACE_wrappers/ace/FIFO.h
+++ b/dep/ACE_wrappers/ace/FIFO.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file FIFO.h
@@ -9,16 +10,22 @@
*/
//==========================================================================
+
#ifndef ACE_FIFO_H
#define ACE_FIFO_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/IPC_SAP.h"
#include "ace/os_include/os_limits.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_FIFO
*
@@ -36,33 +43,44 @@ public:
/// flags.
int open (const ACE_TCHAR *rendezvous, int flags, mode_t perms,
LPSECURITY_ATTRIBUTES sa = 0);
+
/// Close down the ACE_FIFO without removing the rendezvous point.
int close (void);
+
/// Close down the ACE_FIFO and remove the rendezvous point from the
/// file system.
int remove (void);
+
/// Return the local address of this endpoint.
int get_local_addr (const ACE_TCHAR *&rendezvous) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
// = Make these protected to ensure that the class is "abstract."
/// Default constructor.
ACE_FIFO (void);
+
/// Open up the named pipe on the <rendezvous> in accordance with the
/// flags.
ACE_FIFO (const ACE_TCHAR *rendezvous, int flags, mode_t perms,
LPSECURITY_ATTRIBUTES sa = 0);
+
private:
/// Rendezvous point in the file system.
ACE_TCHAR rendezvous_[MAXPATHLEN + 1];
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/FIFO.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_FIFO_H */
diff --git a/dep/ACE_wrappers/ace/FIFO.inl b/dep/ACE_wrappers/ace/FIFO.inl
index 726e719307e..05cc030a917 100644
--- a/dep/ACE_wrappers/ace/FIFO.inl
+++ b/dep/ACE_wrappers/ace/FIFO.inl
@@ -1,8 +1,11 @@
// -*- C++ -*-
//
// $Id: FIFO.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_unistd.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE int
ACE_FIFO::get_local_addr (const ACE_TCHAR *&r) const
{
@@ -10,6 +13,7 @@ ACE_FIFO::get_local_addr (const ACE_TCHAR *&r) const
r = this->rendezvous_;
return 0;
}
+
ACE_INLINE int
ACE_FIFO::remove (void)
{
@@ -17,4 +21,5 @@ ACE_FIFO::remove (void)
int const result = this->close ();
return ACE_OS::unlink (this->rendezvous_) == -1 || result == -1 ? -1 : 0;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/FIFO_Recv.cpp b/dep/ACE_wrappers/ace/FIFO_Recv.cpp
index 1a7085b1502..08eb20fb469 100644
--- a/dep/ACE_wrappers/ace/FIFO_Recv.cpp
+++ b/dep/ACE_wrappers/ace/FIFO_Recv.cpp
@@ -1,13 +1,19 @@
// $Id: FIFO_Recv.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/FIFO_Recv.h"
#include "ace/Log_Msg.h"
#include "ace/OS_NS_fcntl.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/FIFO_Recv.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace, FIFO_Recv, "$Id: FIFO_Recv.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_FIFO_Recv)
+
void
ACE_FIFO_Recv::dump (void) const
{
@@ -19,19 +25,23 @@ ACE_FIFO_Recv::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
int
ACE_FIFO_Recv::close (void)
{
ACE_TRACE ("ACE_FIFO_Recv::close");
int result = ACE_FIFO::close ();
+
if (this->aux_handle_ != ACE_INVALID_HANDLE)
return ACE_OS::close (this->aux_handle_);
else
return result;
}
+
// Note that persistent means "open fifo for writing, as well as
// reading." This ensures that the fifo never gets EOF, even if there
// aren't any writers at the moment!
+
int
ACE_FIFO_Recv::open (const ACE_TCHAR *fifo_name,
int flags,
@@ -40,6 +50,7 @@ ACE_FIFO_Recv::open (const ACE_TCHAR *fifo_name,
LPSECURITY_ATTRIBUTES sa)
{
ACE_TRACE ("ACE_FIFO_Recv::open");
+
if (ACE_FIFO::open (fifo_name, ACE_NONBLOCK | flags, perms, sa) == -1)
return -1;
else if (this->disable (ACE_NONBLOCK) == -1)
@@ -50,11 +61,13 @@ ACE_FIFO_Recv::open (const ACE_TCHAR *fifo_name,
else
return this->get_handle () == ACE_INVALID_HANDLE ? -1 : 0;
}
+
ACE_FIFO_Recv::ACE_FIFO_Recv (void)
: aux_handle_ (ACE_INVALID_HANDLE)
{
ACE_TRACE ("ACE_FIFO_Recv::ACE_FIFO_Recv");
}
+
ACE_FIFO_Recv::ACE_FIFO_Recv (const ACE_TCHAR *fifo_name,
int flags,
mode_t perms,
@@ -63,6 +76,7 @@ ACE_FIFO_Recv::ACE_FIFO_Recv (const ACE_TCHAR *fifo_name,
: aux_handle_ (ACE_INVALID_HANDLE)
{
ACE_TRACE ("ACE_FIFO_Recv::ACE_FIFO_Recv");
+
if (this->ACE_FIFO_Recv::open (fifo_name,
flags,
perms,
@@ -70,5 +84,6 @@ ACE_FIFO_Recv::ACE_FIFO_Recv (const ACE_TCHAR *fifo_name,
sa) == -1)
ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ACE_FIFO_Recv")));
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/FIFO_Recv.h b/dep/ACE_wrappers/ace/FIFO_Recv.h
index 723e5be6e9f..7c9ffbec84e 100644
--- a/dep/ACE_wrappers/ace/FIFO_Recv.h
+++ b/dep/ACE_wrappers/ace/FIFO_Recv.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file FIFO_Recv.h
@@ -9,16 +10,23 @@
*/
//==========================================================================
+
#ifndef ACE_FIFO_RECV_H
#define ACE_FIFO_RECV_H
+
#include /**/ "ace/pre.h"
+
#include "ace/FIFO.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/os_fcntl.h"
#include "ace/Default_Constants.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_FIFO_Recv
*
@@ -31,36 +39,48 @@ public:
// = Initialization methods.
/// Default constructor.
ACE_FIFO_Recv (void);
+
/// Open up a bytestream named pipe for reading.
ACE_FIFO_Recv (const ACE_TCHAR *rendezvous,
int flags = O_CREAT | O_RDONLY,
mode_t perms = ACE_DEFAULT_FILE_PERMS,
int persistent = 1,
LPSECURITY_ATTRIBUTES sa = 0);
+
/// Open up a bytestream named pipe for reading.
int open (const ACE_TCHAR *rendezvous,
int flags = O_CREAT | O_RDONLY,
mode_t perms = ACE_DEFAULT_FILE_PERMS,
int persistent = 1,
LPSECURITY_ATTRIBUTES sa = 0);
+
/// Close down the named pipe.
int close (void);
+
/// Recv @a buf of up to @a len bytes.
ssize_t recv (void *buf, size_t len);
+
/// Recv @a buf of exactly @a len bytes (block until done).
ssize_t recv_n (void *buf, size_t len);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Auxiliary handle that is used to implement persistent FIFOs.
ACE_HANDLE aux_handle_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/FIFO_Recv.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_FIFO_RECV_H */
diff --git a/dep/ACE_wrappers/ace/FIFO_Recv.inl b/dep/ACE_wrappers/ace/FIFO_Recv.inl
index a127a8a2c3f..d4c3fee4326 100644
--- a/dep/ACE_wrappers/ace/FIFO_Recv.inl
+++ b/dep/ACE_wrappers/ace/FIFO_Recv.inl
@@ -1,19 +1,24 @@
// -*- C++ -*-
//
// $Id: FIFO_Recv.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/ACE.h"
#include "ace/OS_NS_unistd.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE ssize_t
ACE_FIFO_Recv::recv (void *buf, size_t len)
{
ACE_TRACE ("ACE_FIFO_Recv::recv");
return ACE_OS::read (this->get_handle (), (char *) buf, len);
}
+
ACE_INLINE ssize_t
ACE_FIFO_Recv::recv_n (void *buf, size_t n)
{
ACE_TRACE ("ACE_FIFO_Recv::recv_n");
return ACE::recv_n (this->get_handle (), buf, n);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/FIFO_Recv_Msg.cpp b/dep/ACE_wrappers/ace/FIFO_Recv_Msg.cpp
index a9eb284d842..5a8cb5c04d5 100644
--- a/dep/ACE_wrappers/ace/FIFO_Recv_Msg.cpp
+++ b/dep/ACE_wrappers/ace/FIFO_Recv_Msg.cpp
@@ -1,12 +1,19 @@
// $Id: FIFO_Recv_Msg.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/FIFO_Recv_Msg.h"
+
#include "ace/Log_Msg.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/FIFO_Recv_Msg.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace, FIFO_Recv_Msg, "$Id: FIFO_Recv_Msg.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_FIFO_Recv_Msg)
+
void
ACE_FIFO_Recv_Msg::dump (void) const
{
@@ -15,9 +22,11 @@ ACE_FIFO_Recv_Msg::dump (void) const
ACE_FIFO_Recv::dump ();
#endif /* ACE_HAS_DUMP */
}
+
// Note that persistent means "open FIFO for writing, as well as
// reading." This ensures that the FIFO never gets EOF, even if there
// aren't any writers at the moment!
+
int
ACE_FIFO_Recv_Msg::open (const ACE_TCHAR *fifo_name,
int flags,
@@ -26,16 +35,19 @@ ACE_FIFO_Recv_Msg::open (const ACE_TCHAR *fifo_name,
LPSECURITY_ATTRIBUTES sa)
{
ACE_TRACE ("ACE_FIFO_Recv_Msg::open");
+
return ACE_FIFO_Recv::open (fifo_name,
flags,
perms,
persistent,
sa);
}
+
ACE_FIFO_Recv_Msg::ACE_FIFO_Recv_Msg (void)
{
ACE_TRACE ("ACE_FIFO_Recv_Msg::ACE_FIFO_Recv_Msg");
}
+
ACE_FIFO_Recv_Msg::ACE_FIFO_Recv_Msg (const ACE_TCHAR *fifo_name,
int flags,
mode_t perms,
@@ -43,6 +55,7 @@ ACE_FIFO_Recv_Msg::ACE_FIFO_Recv_Msg (const ACE_TCHAR *fifo_name,
LPSECURITY_ATTRIBUTES sa)
{
ACE_TRACE ("ACE_FIFO_Recv_Msg::ACE_FIFO_Recv_Msg");
+
if (this->ACE_FIFO_Recv_Msg::open (fifo_name,
flags,
perms,
@@ -50,5 +63,6 @@ ACE_FIFO_Recv_Msg::ACE_FIFO_Recv_Msg (const ACE_TCHAR *fifo_name,
sa) == -1)
ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ACE_FIFO_Recv_Msg")));
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/FIFO_Recv_Msg.h b/dep/ACE_wrappers/ace/FIFO_Recv_Msg.h
index 57a340a3b15..5490814c56b 100644
--- a/dep/ACE_wrappers/ace/FIFO_Recv_Msg.h
+++ b/dep/ACE_wrappers/ace/FIFO_Recv_Msg.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file FIFO_Recv_Msg.h
@@ -9,16 +10,22 @@
*/
//=============================================================================
+
#ifndef ACE_FIFO_RECV_MSG_H
#define ACE_FIFO_RECV_MSG_H
#include /**/ "ace/pre.h"
+
#include "ace/FIFO_Recv.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward decls
class ACE_Str_Buf;
+
/**
* @class ACE_FIFO_Recv_Msg
*
@@ -41,18 +48,21 @@ public:
// = Initialization methods.
/// Default constructor.
ACE_FIFO_Recv_Msg (void);
+
/// Open up a record-oriented named pipe for reading.
ACE_FIFO_Recv_Msg (const ACE_TCHAR *rendezvous,
int flags = O_CREAT | O_RDONLY,
mode_t perms = ACE_DEFAULT_FILE_PERMS,
int persistent = 1,
LPSECURITY_ATTRIBUTES sa = 0);
+
/// Open up a record-oriented named pipe for reading.
int open (const ACE_TCHAR *rendezvous,
int flags = O_CREAT | O_RDONLY,
mode_t perms = ACE_DEFAULT_FILE_PERMS,
int persistent = 1,
LPSECURITY_ATTRIBUTES sa = 0);
+
/// Receive a message based on attributes in an ACE_Str_Buf.
/**
* @param msg Reference to an ACE_Str_Buf whose @c buf member points
@@ -78,6 +88,7 @@ public:
* @c msg.maxlen is discarded.
*/
ssize_t recv (ACE_Str_Buf &msg);
+
/// Receive a message based on buffer pointer and maximum size.
/**
* @param buf Pointer to the memory to receive the data.
@@ -96,26 +107,33 @@ public:
* excess of @arg len. The excess bytes are discarded.
*/
ssize_t recv (void *buf, size_t len);
+
#if defined (ACE_HAS_STREAM_PIPES)
/// Recv <data> and <cntl> message via Stream pipes.
ssize_t recv (ACE_Str_Buf *data,
ACE_Str_Buf *cntl,
int *flags);
+
/// Recv <data> and <cntl> message via Stream pipes in "band" mode.
ssize_t recv (int *band,
ACE_Str_Buf *data,
ACE_Str_Buf *cntl,
int *flags);
#endif /* ACE_HAS_STREAM_PIPES */
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/FIFO_Recv_Msg.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_FIFO_RECV_MSG_H */
diff --git a/dep/ACE_wrappers/ace/FIFO_Recv_Msg.inl b/dep/ACE_wrappers/ace/FIFO_Recv_Msg.inl
index c1cbf4e37db..0a0b0673d38 100644
--- a/dep/ACE_wrappers/ace/FIFO_Recv_Msg.inl
+++ b/dep/ACE_wrappers/ace/FIFO_Recv_Msg.inl
@@ -1,13 +1,17 @@
// -*- C++ -*-
//
// $Id: FIFO_Recv_Msg.inl 82559 2008-08-07 20:23:07Z parsons $
+
#include "ace/Min_Max.h"
#include "ace/OS_NS_stropts.h"
#include "ace/Truncate.h"
+
#if !defined (ACE_HAS_STREAM_PIPES)
#include "ace/OS_NS_unistd.h"
#endif
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE ssize_t
ACE_FIFO_Recv_Msg::recv (ACE_Str_Buf &recv_msg)
{
@@ -39,12 +43,15 @@ ACE_FIFO_Recv_Msg::recv (ACE_Str_Buf &recv_msg)
ssize_t recv_len = ACE_OS::read (this->get_handle (),
(char *) recv_msg.buf,
ACE_MIN (remaining, requested));
+
if (recv_len == -1)
{
return -1;
}
+
// Tell caller what's really in the buffer.
recv_msg.len = static_cast<int> (recv_len);
+
// If there are more bytes remaining in the message, read them and
// throw them away. Leaving them in the FIFO would make it difficult
// to find the start of the next message in the fifo.
@@ -53,6 +60,7 @@ ACE_FIFO_Recv_Msg::recv (ACE_Str_Buf &recv_msg)
// saving the indication here either to read the remainder later.
size_t total_msg_size = remaining;
remaining -= recv_len;
+
while (remaining > 0)
{
const size_t throw_away = 1024;
@@ -60,23 +68,29 @@ ACE_FIFO_Recv_Msg::recv (ACE_Str_Buf &recv_msg)
recv_len = ACE_OS::read (this->get_handle (),
dev_null,
ACE_MIN (remaining, throw_away));
+
if (recv_len == -1)
{
break;
}
+
remaining -= recv_len;
}
+
return ACE_Utils::truncate_cast<ssize_t> (total_msg_size);
}
#endif /* ACE_HAS_STREAM_PIPES */
}
+
ACE_INLINE ssize_t
ACE_FIFO_Recv_Msg::recv (void *buf, size_t max_len)
{
ACE_TRACE ("ACE_FIFO_Recv_Msg::recv");
ACE_Str_Buf recv_msg ((char *) buf, 0, static_cast<int> (max_len));
+
return this->recv (recv_msg);
}
+
#if defined (ACE_HAS_STREAM_PIPES)
ACE_INLINE ssize_t
ACE_FIFO_Recv_Msg::recv (ACE_Str_Buf *data,
@@ -96,6 +110,7 @@ ACE_FIFO_Recv_Msg::recv (ACE_Str_Buf *data,
return (cntl == 0 ? 0 : cntl->len) + (data == 0 ? 0 : data->len);
}
}
+
ACE_INLINE ssize_t
ACE_FIFO_Recv_Msg::recv (int *band,
ACE_Str_Buf *data,
@@ -103,6 +118,7 @@ ACE_FIFO_Recv_Msg::recv (int *band,
int *flags)
{
ACE_TRACE ("ACE_FIFO_Recv_Msg::recv");
+
if (ACE_OS::getpmsg (this->get_handle (),
(strbuf *) cntl,
(strbuf *) data,
@@ -117,4 +133,5 @@ ACE_FIFO_Recv_Msg::recv (int *band,
}
}
#endif /* ACE_HAS_STREAM_PIPES */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/FIFO_Send.cpp b/dep/ACE_wrappers/ace/FIFO_Send.cpp
index 3913f4a86d5..79ea87682d3 100644
--- a/dep/ACE_wrappers/ace/FIFO_Send.cpp
+++ b/dep/ACE_wrappers/ace/FIFO_Send.cpp
@@ -1,12 +1,18 @@
// $Id: FIFO_Send.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/FIFO_Send.h"
#include "ace/Log_Msg.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/FIFO_Send.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace, FIFO_Send, "$Id: FIFO_Send.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_FIFO_Send)
+
void
ACE_FIFO_Send::dump (void) const
{
@@ -15,10 +21,12 @@ ACE_FIFO_Send::dump (void) const
ACE_FIFO::dump ();
#endif /* ACE_HAS_DUMP */
}
+
ACE_FIFO_Send::ACE_FIFO_Send (void)
{
// ACE_TRACE ("ACE_FIFO_Send::ACE_FIFO_Send");
}
+
int
ACE_FIFO_Send::open (const ACE_TCHAR *rendezvous_name,
int flags,
@@ -31,6 +39,7 @@ ACE_FIFO_Send::open (const ACE_TCHAR *rendezvous_name,
perms,
sa);
}
+
ACE_FIFO_Send::ACE_FIFO_Send (const ACE_TCHAR *fifo_name,
int flags,
mode_t perms,
@@ -45,5 +54,6 @@ ACE_FIFO_Send::ACE_FIFO_Send (const ACE_TCHAR *fifo_name,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_FIFO_Send::ACE_FIFO_Send")));
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/FIFO_Send.h b/dep/ACE_wrappers/ace/FIFO_Send.h
index 503054e47d3..7c0928cceaf 100644
--- a/dep/ACE_wrappers/ace/FIFO_Send.h
+++ b/dep/ACE_wrappers/ace/FIFO_Send.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file FIFO_Send.h
@@ -9,16 +10,23 @@
*/
//==========================================================================
+
#ifndef ACE_FIFO_SEND_H
#define ACE_FIFO_SEND_H
+
#include /**/ "ace/pre.h"
+
#include "ace/FIFO.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/os_fcntl.h"
#include "ace/Default_Constants.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_FIFO_Send
*
@@ -30,29 +38,39 @@ public:
// = Initialization methods.
/// Default constructor.
ACE_FIFO_Send (void);
+
/// Open up a bytestream named pipe for writing.
ACE_FIFO_Send (const ACE_TCHAR *rendezvous,
int flags = O_WRONLY,
mode_t perms = ACE_DEFAULT_FILE_PERMS,
LPSECURITY_ATTRIBUTES sa = 0);
+
/// Open up a bytestream named pipe for writing.
int open (const ACE_TCHAR *rendezvous,
int flags = O_WRONLY,
mode_t perms = ACE_DEFAULT_FILE_PERMS,
LPSECURITY_ATTRIBUTES sa = 0);
+
/// Send @a buf of up to @a len bytes.
ssize_t send (const void *buf, size_t len);
+
/// Send @a buf of exactly @a len bytes (block until done).
ssize_t send_n (const void *buf, size_t len);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/FIFO_Send.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_FIFO_SEND_H */
diff --git a/dep/ACE_wrappers/ace/FIFO_Send.inl b/dep/ACE_wrappers/ace/FIFO_Send.inl
index e04afc77074..a01facd61f0 100644
--- a/dep/ACE_wrappers/ace/FIFO_Send.inl
+++ b/dep/ACE_wrappers/ace/FIFO_Send.inl
@@ -1,19 +1,24 @@
// -*- C++ -*-
//
// $Id: FIFO_Send.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/ACE.h"
#include "ace/OS_NS_unistd.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE ssize_t
ACE_FIFO_Send::send (const void *buf, size_t len)
{
ACE_TRACE ("ACE_FIFO_Send::send");
return ACE_OS::write (this->get_handle (), (const char *) buf, len);
}
+
ACE_INLINE ssize_t
ACE_FIFO_Send::send_n (const void *buf, size_t n)
{
ACE_TRACE ("ACE_FIFO_Send::send_n");
return ACE::send_n (this->get_handle (), buf, n);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/FIFO_Send_Msg.cpp b/dep/ACE_wrappers/ace/FIFO_Send_Msg.cpp
index 711d827911f..441a850c354 100644
--- a/dep/ACE_wrappers/ace/FIFO_Send_Msg.cpp
+++ b/dep/ACE_wrappers/ace/FIFO_Send_Msg.cpp
@@ -1,13 +1,20 @@
// $Id: FIFO_Send_Msg.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/FIFO_Send_Msg.h"
+
#include "ace/Log_Msg.h"
#include "ace/OS_NS_sys_uio.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/FIFO_Send_Msg.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace, FIFO_Send_Msg, "$Id: FIFO_Send_Msg.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_FIFO_Send_Msg)
+
void
ACE_FIFO_Send_Msg::dump (void) const
{
@@ -16,6 +23,7 @@ ACE_FIFO_Send_Msg::dump (void) const
ACE_FIFO_Send::dump ();
#endif /* ACE_HAS_DUMP */
}
+
ssize_t
ACE_FIFO_Send_Msg::send (const ACE_Str_Buf &send_msg)
{
@@ -30,20 +38,25 @@ ACE_FIFO_Send_Msg::send (const ACE_Str_Buf &send_msg)
return send_msg.len;
#else
iovec iov[2];
+
iov[0].iov_base = (char *) &send_msg.len;
iov[0].iov_len = sizeof send_msg.len;
+
iov[1].iov_base = (char *) send_msg.buf;
iov[1].iov_len = static_cast<u_long> (send_msg.len);
+
ssize_t sent = ACE_OS::writev (this->get_handle (), iov, 2);
if (sent > 0)
sent -= iov[0].iov_len; // Don't count the length we added.
return sent;
#endif /* ACE_HAS_STREAM_PIPES */
}
+
ACE_FIFO_Send_Msg::ACE_FIFO_Send_Msg (void)
{
// ACE_TRACE ("ACE_FIFO_Send_Msg::ACE_FIFO_Send_Msg");
}
+
int
ACE_FIFO_Send_Msg::open (const ACE_TCHAR *fifo_name,
int flags,
@@ -53,6 +66,7 @@ ACE_FIFO_Send_Msg::open (const ACE_TCHAR *fifo_name,
ACE_TRACE ("ACE_FIFO_Send_Msg::open");
return ACE_FIFO_Send::open (fifo_name, flags | O_WRONLY, perms, sa);
}
+
ACE_FIFO_Send_Msg::ACE_FIFO_Send_Msg (const ACE_TCHAR *fifo_name,
int flags,
mode_t perms,
@@ -62,5 +76,6 @@ ACE_FIFO_Send_Msg::ACE_FIFO_Send_Msg (const ACE_TCHAR *fifo_name,
if (this->ACE_FIFO_Send_Msg::open (fifo_name, flags, perms, sa) == -1)
ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ACE_FIFO_Send_Msg")));
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/FIFO_Send_Msg.h b/dep/ACE_wrappers/ace/FIFO_Send_Msg.h
index c625dcc3381..ff746969156 100644
--- a/dep/ACE_wrappers/ace/FIFO_Send_Msg.h
+++ b/dep/ACE_wrappers/ace/FIFO_Send_Msg.h
@@ -1,4 +1,5 @@
/* -*- C++ -*- */
+
//=============================================================================
/**
* @file FIFO_Send_Msg.h
@@ -9,19 +10,26 @@
*/
//=============================================================================
+
#ifndef ACE_FIFO_SEND_MSG_H
#define ACE_FIFO_SEND_MSG_H
#include /**/ "ace/pre.h"
+
#include "ace/FIFO_Send.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_STREAM_PIPES)
# include "ace/OS_NS_stropts.h"
#endif /* ACE_HAS_STREAM_PIPES */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward Decls
class ACE_Str_Buf;
+
/**
* @class ACE_FIFO_Send_Msg
*
@@ -34,40 +42,51 @@ public:
// = Initialization methods.
/// Default constructor.
ACE_FIFO_Send_Msg (void);
+
/// Open up a record-oriented named pipe for writing.
ACE_FIFO_Send_Msg (const ACE_TCHAR *rendezvous,
int flags = O_WRONLY,
mode_t perms = ACE_DEFAULT_FILE_PERMS,
LPSECURITY_ATTRIBUTES sa = 0);
+
/// Open up a record-oriented named pipe for writing.
int open (const ACE_TCHAR *rendezvous,
int flags = O_WRONLY,
mode_t perms = ACE_DEFAULT_FILE_PERMS,
LPSECURITY_ATTRIBUTES sa = 0);
+
/// Send @a buf of up to @a len bytes.
ssize_t send (const ACE_Str_Buf &msg);
+
/// Send @a buf of exactly @a len bytes (block until done).
ssize_t send (const void *buf, size_t len);
+
#if defined (ACE_HAS_STREAM_PIPES)
/// Send <data> and <cntl> message via Stream pipes.
ssize_t send (const ACE_Str_Buf *data,
const ACE_Str_Buf *cntl = 0,
int flags = 0);
+
/// Send <data> and <cntl> message via Stream pipes in "band" mode.
ssize_t send (int band,
const ACE_Str_Buf *data,
const ACE_Str_Buf *cntl = 0,
int flags = MSG_BAND);
#endif /* ACE_HAS_STREAM_PIPES */
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/FIFO_Send_Msg.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_FIFO_SEND_MSG_H */
diff --git a/dep/ACE_wrappers/ace/FIFO_Send_Msg.inl b/dep/ACE_wrappers/ace/FIFO_Send_Msg.inl
index b2f5036f549..0a34e64e370 100644
--- a/dep/ACE_wrappers/ace/FIFO_Send_Msg.inl
+++ b/dep/ACE_wrappers/ace/FIFO_Send_Msg.inl
@@ -1,15 +1,20 @@
// -*- C++ -*-
//
// $Id: FIFO_Send_Msg.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_stropts.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE ssize_t
ACE_FIFO_Send_Msg::send (const void *buf, size_t len)
{
ACE_TRACE ("ACE_FIFO_Send_Msg::send");
ACE_Str_Buf send_msg ((char *) buf, static_cast<int> (len));
+
return this->send (send_msg);
}
+
#if defined (ACE_HAS_STREAM_PIPES)
ACE_INLINE ssize_t
ACE_FIFO_Send_Msg::send (const ACE_Str_Buf *data,
@@ -25,6 +30,7 @@ ACE_FIFO_Send_Msg::send (const ACE_Str_Buf *data,
else
return (cntl == 0 ? 0 : cntl->len) + (data == 0 ? 0 : data->len);
}
+
ACE_INLINE ssize_t
ACE_FIFO_Send_Msg::send (int band,
const ACE_Str_Buf *data,
@@ -32,6 +38,7 @@ ACE_FIFO_Send_Msg::send (int band,
int flags)
{
ACE_TRACE ("ACE_FIFO_Send_Msg::send");
+
if (ACE_OS::putpmsg (this->get_handle (),
(strbuf *) cntl,
(strbuf *) data,
@@ -42,4 +49,5 @@ ACE_FIFO_Send_Msg::send (int band,
return (cntl == 0 ? 0 : cntl->len) + (data == 0 ? 0 : data->len);
}
#endif /* ACE_HAS_STREAM_PIPES */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/FILE.cpp b/dep/ACE_wrappers/ace/FILE.cpp
index 3f4c02b6dcf..50b6342bc89 100644
--- a/dep/ACE_wrappers/ace/FILE.cpp
+++ b/dep/ACE_wrappers/ace/FILE.cpp
@@ -1,15 +1,23 @@
// $Id: FILE.cpp 80826 2008-03-04 14:51:23Z wotte $
+
/* Defines the member functions for the base class of the ACE_IO_SAP
ACE_FILE abstraction. */
+
#include "ace/FILE.h"
+
#include "ace/OS_NS_unistd.h"
#include "ace/OS_NS_sys_stat.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/FILE.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace, FILE, "$Id: FILE.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_FILE)
+
void
ACE_FILE::dump (void) const
{
@@ -18,17 +26,22 @@ ACE_FILE::dump (void) const
ACE_IO_SAP::dump ();
#endif /* ACE_HAS_DUMP */
}
+
// This is the do-nothing constructor.
+
ACE_FILE::ACE_FILE (void)
{
ACE_TRACE ("ACE_FILE::ACE_FILE");
}
+
// Close the file
+
int
ACE_FILE::close (void)
{
ACE_TRACE ("ACE_FILE::close");
int result = 0;
+
if (this->get_handle () != ACE_INVALID_HANDLE)
{
result = ACE_OS::close (this->get_handle ());
@@ -36,52 +49,65 @@ ACE_FILE::close (void)
}
return result;
}
+
int
ACE_FILE::get_info (ACE_FILE_Info *finfo)
{
ACE_TRACE ("ACE_FILE::get_info");
ACE_stat filestatus;
+
int const result = ACE_OS::fstat (this->get_handle (), &filestatus);
+
if (result == 0)
{
finfo->mode_ = filestatus.st_mode;
finfo->nlink_ = filestatus.st_nlink;
finfo->size_ = filestatus.st_size;
}
+
return result;
}
+
int
ACE_FILE::get_info (ACE_FILE_Info &finfo)
{
ACE_TRACE ("ACE_FILE::get_info");
+
return this->get_info (&finfo);
}
+
int
ACE_FILE::truncate (ACE_OFF_T length)
{
ACE_TRACE ("ACE_FILE::truncate");
return ACE_OS::ftruncate (this->get_handle (), length);
}
+
ACE_OFF_T
ACE_FILE::seek (ACE_OFF_T offset, int startpos)
{
return ACE_OS::lseek (this->get_handle (), offset, startpos);
}
+
ACE_OFF_T
ACE_FILE::tell (void)
{
ACE_TRACE ("ACE_FILE::tell");
return ACE_OS::lseek (this->get_handle (), 0, SEEK_CUR);
}
+
// Return the local endpoint address.
+
int
ACE_FILE::get_local_addr (ACE_Addr &addr) const
{
ACE_TRACE ("ACE_FILE::get_local_addr");
+
// Perform the downcast since <addr> had better be an
// <ACE_FILE_Addr>.
ACE_FILE_Addr *file_addr =
dynamic_cast<ACE_FILE_Addr *> (&addr);
+
if (file_addr == 0)
return -1;
else
@@ -90,25 +116,33 @@ ACE_FILE::get_local_addr (ACE_Addr &addr) const
return 0;
}
}
+
// Return the same result as <get_local_addr>.
+
int
ACE_FILE::get_remote_addr (ACE_Addr &addr) const
{
ACE_TRACE ("ACE_FILE::get_remote_addr");
+
return this->get_local_addr (addr);
}
+
int
ACE_FILE::remove (void)
{
ACE_TRACE ("ACE_FILE::remove");
+
this->close ();
return ACE_OS::unlink (this->addr_.get_path_name ());
}
+
int
ACE_FILE::unlink (void)
{
ACE_TRACE ("ACE_FILE::unlink");
+
return ACE_OS::unlink (this->addr_.get_path_name ());
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/FILE.h b/dep/ACE_wrappers/ace/FILE.h
index bc6ffe68785..44d5ac71d20 100644
--- a/dep/ACE_wrappers/ace/FILE.h
+++ b/dep/ACE_wrappers/ace/FILE.h
@@ -1,4 +1,5 @@
/* -*- C++ -*- */
+
//=============================================================================
/**
* @file FILE.h
@@ -8,18 +9,24 @@
* @author Gerhard Lenzer
*/
//=============================================================================
+
#ifndef ACE_FILE_H
#define ACE_FILE_H
#include /**/ "ace/pre.h"
+
#include "ace/IO_SAP.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/FILE_Addr.h"
+
// The following is necessary since many C++ compilers don't support
// typedef'd types inside of classes used as formal template
// arguments... ;-(. Luckily, using the C++ preprocessor I can hide
// most of this nastiness!
+
#if defined (ACE_HAS_TEMPLATE_TYPEDEFS)
#define ACE_FILE_CONNECTOR ACE_FILE_Connector
#define ACE_FILE_STREAM ACE_FILE_IO
@@ -27,7 +34,9 @@
#define ACE_FILE_CONNECTOR ACE_FILE_Connector, ACE_FILE_Addr
#define ACE_FILE_STREAM ACE_FILE_IO, ACE_FILE_Addr
#endif /* ACE_TEMPLATE_TYPEDEFS */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_FILE_Info
*
@@ -38,11 +47,14 @@ class ACE_Export ACE_FILE_Info
public:
/// Mode of file
mode_t mode_;
+
/// No of links
nlink_t nlink_;
+
/// Size of file
ACE_OFF_T size_;
};
+
/**
* @class ACE_FILE
*
@@ -54,17 +66,23 @@ public:
/// Close the ACE_FILE handle without removing the ACE_FILE from
/// the file system.
int close (void);
+
/// Close and remove the ACE_FILE from the file system.
int remove (void);
+
/// Remove the ACE_FILE from the file system without closing the
/// ACE_FILE handle.
int unlink (void);
+
/// Get information on this ACE_FILE.
int get_info (ACE_FILE_Info *finfo);
+
/// Get information on this ACE_FILE.
int get_info (ACE_FILE_Info &finfo);
+
/// Set filesize to length byte.
int truncate (ACE_OFF_T length);
+
/**
* Sets the file pointer as follows:
* o If <whence> is <SEEK_SET>, the pointer is set to @a offset
@@ -78,34 +96,45 @@ public:
*/
ACE_OFF_T seek (ACE_OFF_T offset,
int whence = SEEK_CUR);
+
/// Return an offset for the file handle.
ACE_OFF_T tell (void);
+
/**
* Disable signal @a signum
* This is here to prevent Win32 from
* disabling SPIPE using socket calls
*/
int disable (int signum) const ;
+
/// Return the local endpoint address in the referenced ACE_Addr.
/// Returns 0 if successful, else -1.
int get_local_addr (ACE_Addr &) const;
+
/// Return the same thing as get_local_addr().
int get_remote_addr (ACE_Addr &) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
/// Ensure that this class is only created by the
/// ACE_FILE_Connector.
ACE_FILE (void);
+
/// File we are "connected" with...
ACE_FILE_Addr addr_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/FILE.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_FILE_H */
diff --git a/dep/ACE_wrappers/ace/FILE.inl b/dep/ACE_wrappers/ace/FILE.inl
index 5bed51dd798..288374afc58 100644
--- a/dep/ACE_wrappers/ace/FILE.inl
+++ b/dep/ACE_wrappers/ace/FILE.inl
@@ -1,7 +1,9 @@
// -*- C++ -*-
//
// $Id: FILE.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE int
ACE_FILE::disable (int signum) const
{
@@ -12,4 +14,5 @@ ACE_FILE::disable (int signum) const
return ACE_IO_SAP::disable (signum) ;
#endif /* ACE_WIN32 */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/FILE_Addr.cpp b/dep/ACE_wrappers/ace/FILE_Addr.cpp
index 6b282822fde..4b95a7db874 100644
--- a/dep/ACE_wrappers/ace/FILE_Addr.cpp
+++ b/dep/ACE_wrappers/ace/FILE_Addr.cpp
@@ -1,21 +1,28 @@
// $Id: FILE_Addr.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/FILE_Addr.h"
#include "ace/Lib_Find.h"
#include "ace/Log_Msg.h"
#include "ace/OS_NS_stdlib.h"
#include "ace/OS_NS_string.h"
#include "ace/os_include/sys/os_socket.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/FILE_Addr.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace, FILE_Addr, "$Id: FILE_Addr.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_FILE_Addr)
+
ACE_FILE_Addr::ACE_FILE_Addr (void)
: ACE_Addr (AF_FILE, sizeof this->filename_ / sizeof (ACE_TCHAR))
{
this->filename_[0] = '\0';
}
+
int
ACE_FILE_Addr::set (const ACE_FILE_Addr &sa)
{
@@ -34,9 +41,12 @@ ACE_FILE_Addr::set (const ACE_FILE_Addr &sa)
ACE_TEXT ("defaulting to current directory\n")));
this->filename_[0] = 0;
}
+
// Add the filename to the end
ACE_OS::strcat (this->filename_, ACE_TEXT ("ace-fileXXXXXX"));
+
#endif /* ACE_DEFAULT_TEMP_FILE */
+
if (ACE_OS::mktemp (this->filename_) == 0)
return -1;
this->base_set (AF_FILE,
@@ -45,16 +55,20 @@ ACE_FILE_Addr::set (const ACE_FILE_Addr &sa)
else
{
(void)ACE_OS::strsncpy (this->filename_, sa.filename_, sa.get_size ());
+
this->base_set (sa.get_type (), sa.get_size ());
}
return 0;
}
+
// Copy constructor.
+
ACE_FILE_Addr::ACE_FILE_Addr (const ACE_FILE_Addr &sa)
: ACE_Addr (AF_FILE, sizeof this->filename_)
{
this->set (sa);
}
+
int
ACE_FILE_Addr::set (const ACE_TCHAR *filename)
{
@@ -65,6 +79,7 @@ ACE_FILE_Addr::set (const ACE_TCHAR *filename)
sizeof this->filename_ / sizeof (ACE_TCHAR));
return 0;
}
+
ACE_FILE_Addr &
ACE_FILE_Addr::operator= (const ACE_FILE_Addr &sa)
{
@@ -72,28 +87,35 @@ ACE_FILE_Addr::operator= (const ACE_FILE_Addr &sa)
this->set (sa);
return *this;
}
+
// Create a ACE_Addr from a ACE_FILE pathname.
+
ACE_FILE_Addr::ACE_FILE_Addr (const ACE_TCHAR *filename)
{
this->set (filename);
}
+
int
ACE_FILE_Addr::addr_to_string (ACE_TCHAR *s, size_t len) const
{
ACE_OS::strsncpy (s, this->filename_, len);
return 0;
}
+
// Return the address.
+
void *
ACE_FILE_Addr::get_addr (void) const
{
return (void *)&this->filename_;
}
+
void
ACE_FILE_Addr::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_FILE_Addr::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("filename_ = %s"), this->filename_));
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
diff --git a/dep/ACE_wrappers/ace/FILE_Addr.h b/dep/ACE_wrappers/ace/FILE_Addr.h
index 2ad8ea993ea..0604b689e5b 100644
--- a/dep/ACE_wrappers/ace/FILE_Addr.h
+++ b/dep/ACE_wrappers/ace/FILE_Addr.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file FILE_Addr.h
@@ -8,16 +9,22 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_FILE_ADDR_H
#define ACE_FILE_ADDR_H
#include /**/ "ace/pre.h"
+
#include "ace/Addr.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Flag_Manip.h"
#include "ace/os_include/os_dirent.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_FILE_Addr
*
@@ -29,39 +36,55 @@ public:
// = Initialization methods.
/// Default constructor.
ACE_FILE_Addr (void);
+
/// Copy constructor.
ACE_FILE_Addr (const ACE_FILE_Addr &sa);
+
/// Acts like a copy constructor. If @a sa == ACE_Addr::sap_any then
/// create a temporary filename using ACE_OS::mktemp.
int set (const ACE_FILE_Addr &sa);
+
/// Create a ACE_FILE_Addr from a pathname.
explicit ACE_FILE_Addr (const ACE_TCHAR *filename);
+
/// Create a ACE_FILE_Addr from a pathname.
int set (const ACE_TCHAR *filename);
+
/// Assignment operator.
ACE_FILE_Addr &operator= (const ACE_FILE_Addr &);
+
/// Return a pointer to the address.
virtual void *get_addr (void) const;
+
/// Transform the current address into string format.
virtual int addr_to_string (ACE_TCHAR *addr, size_t) const;
+
/// Compare two addresses for equality.
bool operator == (const ACE_FILE_Addr &SAP) const;
+
/// Compare two addresses for inequality.
bool operator != (const ACE_FILE_Addr &SAP) const;
+
/// Return the path name used for the rendezvous point.
const ACE_TCHAR *get_path_name (void) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Name of the file.
ACE_TCHAR filename_[MAXPATHLEN + 1];
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/FILE_Addr.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_FILE_ADDR_H */
diff --git a/dep/ACE_wrappers/ace/FILE_Addr.inl b/dep/ACE_wrappers/ace/FILE_Addr.inl
index 4f8a99d7a76..0ae7d31d278 100644
--- a/dep/ACE_wrappers/ace/FILE_Addr.inl
+++ b/dep/ACE_wrappers/ace/FILE_Addr.inl
@@ -2,24 +2,33 @@
//
// $Id: FILE_Addr.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/SString.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Compare two addresses for equality.
+
ACE_INLINE bool
ACE_FILE_Addr::operator == (const ACE_FILE_Addr &sap) const
{
return ACE_OS::strcmp (this->filename_, sap.filename_) == 0;
}
+
// Compare two addresses for inequality.
+
ACE_INLINE bool
ACE_FILE_Addr::operator != (const ACE_FILE_Addr &sap) const
{
return !((*this) == sap); // This is lazy, of course... ;-)
}
+
// Return the path name used for the rendezvous point.
+
ACE_INLINE const ACE_TCHAR *
ACE_FILE_Addr::get_path_name (void) const
{
return this->filename_;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/FILE_Connector.cpp b/dep/ACE_wrappers/ace/FILE_Connector.cpp
index 7ae8d002de3..b4f4d09e3c6 100644
--- a/dep/ACE_wrappers/ace/FILE_Connector.cpp
+++ b/dep/ACE_wrappers/ace/FILE_Connector.cpp
@@ -1,27 +1,36 @@
// $Id: FILE_Connector.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/FILE_Connector.h"
#include "ace/Handle_Ops.h"
#include "ace/OS_NS_stdlib.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/FILE_Connector.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace, FILE_Connector, "$Id: FILE_Connector.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_FILE_Connector)
+
void
ACE_FILE_Connector::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_FILE_Connector::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n")));
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
ACE_FILE_Connector::ACE_FILE_Connector (void)
{
ACE_TRACE ("ACE_FILE_Connector::ACE_FILE_Connector");
}
+
int
ACE_FILE_Connector::connect (ACE_FILE_IO &new_io,
const ACE_FILE_Addr &remote_sap,
@@ -33,7 +42,9 @@ ACE_FILE_Connector::connect (ACE_FILE_IO &new_io,
{
ACE_TRACE ("ACE_FILE_Connector::connect");
ACE_ASSERT (new_io.get_handle () == ACE_INVALID_HANDLE);
+
ACE_HANDLE handle = ACE_INVALID_HANDLE;
+
// Check to see if caller has requested that we create the filename.
if (reinterpret_cast<const ACE_Addr &> (
const_cast<ACE_FILE_Addr &> (remote_sap)) == ACE_Addr::sap_any)
@@ -47,21 +58,28 @@ ACE_FILE_Connector::connect (ACE_FILE_IO &new_io,
// since it opens the file for us. Better to avoid the race
// condition.
char filename[] = "ace-file-XXXXXX";
+
handle = ACE_OS::mkstemp (filename); // mkstemp() replaces "XXXXXX"
+
if (handle == ACE_INVALID_HANDLE
|| new_io.addr_.set (ACE_TEXT_CHAR_TO_TCHAR (filename)) != 0)
return -1;
+
new_io.set_handle (handle);
+
return 0;
}
else
new_io.addr_ = remote_sap; // class copy.
+
handle = ACE::handle_timed_open (timeout,
new_io.addr_.get_path_name (),
flags,
perms);
+
new_io.set_handle (handle);
return handle == ACE_INVALID_HANDLE ? -1 : 0;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/FILE_Connector.h b/dep/ACE_wrappers/ace/FILE_Connector.h
index 3b820c2b21c..4f87e209d66 100644
--- a/dep/ACE_wrappers/ace/FILE_Connector.h
+++ b/dep/ACE_wrappers/ace/FILE_Connector.h
@@ -1,4 +1,5 @@
/* -*- C++ -*- */
+
//=============================================================================
/**
* @file FILE_Connector.h
@@ -8,16 +9,21 @@
* @author Doug Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_FILE_CONNECTOR_H
#define ACE_FILE_CONNECTOR_H
#include /**/ "ace/pre.h"
+
#include "ace/FILE_IO.h"
#include "ace/Log_Msg.h"
#include "ace/os_include/os_fcntl.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_FILE_Connector
*
@@ -36,6 +42,7 @@ public:
// = Initialization methods.
/// Default constructor.
ACE_FILE_Connector (void);
+
/**
* Actively ``connect'' and produce a @a new_io ACE_FILE_IO object
* if things go well. The @a remote_sap is the file that we are
@@ -57,6 +64,7 @@ public:
int reuse_addr = 0,
int flags = O_RDWR | O_CREAT,
int perms = ACE_DEFAULT_FILE_PERMS);
+
/**
* Actively ``connect'' and produce a @a new_io <ACE_FILE_IO> object
* if things go well. The @a remote_sap is the file that we are
@@ -80,20 +88,27 @@ public:
int reuse_addr = 0,
int flags = O_RDWR | O_CREAT,
int perms = ACE_DEFAULT_FILE_PERMS);
+
/// Resets any event associations on this handle
int reset_new_handle (ACE_HANDLE handle);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
// = Meta-type "trait" information.
typedef ACE_FILE_Addr PEER_ADDR;
typedef ACE_FILE_IO PEER_STREAM;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/FILE_Connector.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_FILE_CONNECTOR_H */
diff --git a/dep/ACE_wrappers/ace/FILE_Connector.inl b/dep/ACE_wrappers/ace/FILE_Connector.inl
index 867549f953a..deab94e0061 100644
--- a/dep/ACE_wrappers/ace/FILE_Connector.inl
+++ b/dep/ACE_wrappers/ace/FILE_Connector.inl
@@ -1,8 +1,11 @@
// -*- C++ -*-
//
// $Id: FILE_Connector.inl 80826 2008-03-04 14:51:23Z wotte $
+
// Creates a Local ACE_FILE.
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_FILE_Connector::ACE_FILE_Connector (ACE_FILE_IO &new_io,
const ACE_FILE_Addr &remote_sap,
@@ -21,6 +24,7 @@ ACE_FILE_Connector::ACE_FILE_Connector (ACE_FILE_IO &new_io,
remote_sap.get_path_name (),
ACE_TEXT ("ACE_FILE_IO")));
}
+
ACE_INLINE int
ACE_FILE_Connector::reset_new_handle (ACE_HANDLE handle)
{
@@ -28,4 +32,5 @@ ACE_FILE_Connector::reset_new_handle (ACE_HANDLE handle)
// Nothing to do here since the handle is not a socket
return 0;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/FILE_IO.cpp b/dep/ACE_wrappers/ace/FILE_IO.cpp
index 3d644951807..c68df3e0416 100644
--- a/dep/ACE_wrappers/ace/FILE_IO.cpp
+++ b/dep/ACE_wrappers/ace/FILE_IO.cpp
@@ -1,34 +1,46 @@
// $Id: FILE_IO.cpp 82559 2008-08-07 20:23:07Z parsons $
+
#include "ace/FILE_IO.h"
+
#include "ace/Log_Msg.h"
#include "ace/OS_NS_sys_stat.h"
#include "ace/OS_Memory.h"
#include "ace/Truncate.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/FILE_IO.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace, FILE_IO, "$Id: FILE_IO.cpp 82559 2008-08-07 20:23:07Z parsons $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_FILE_IO)
+
void
ACE_FILE_IO::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_FILE_IO::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
this->addr_.dump ();
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
// Simple-minded do nothing constructor.
+
ACE_FILE_IO::ACE_FILE_IO (void)
{
ACE_TRACE ("ACE_FILE_IO::ACE_FILE_IO");
}
+
// Send N char *ptrs and int lengths. Note that the char *'s precede
// the ints (basically, an varargs version of writev). The count N is
// the *total* number of trailing arguments, *not* a couple of the
// number of tuple pairs!
+
ssize_t
ACE_FILE_IO::send (size_t n, ...) const
{
@@ -43,12 +55,15 @@ ACE_FILE_IO::send (size_t n, ...) const
iovec[total_tuples],
-1);
#endif /* !defined (ACE_HAS_ALLOCA) */
+
va_start (argp, n);
+
for (int i = 0; i < total_tuples; i++)
{
iovp[i].iov_base = va_arg (argp, char *);
iovp[i].iov_len = va_arg (argp, int);
}
+
ssize_t result = ACE_OS::writev (this->get_handle (),
iovp,
total_tuples);
@@ -58,11 +73,13 @@ ACE_FILE_IO::send (size_t n, ...) const
va_end (argp);
return result;
}
+
// This is basically an interface to ACE_OS::readv, that doesn't use
// the struct iovec explicitly. The ... can be passed as an arbitrary
// number of (char *ptr, int len) tuples. However, the count N is the
// *total* number of trailing arguments, *not* a couple of the number
// of tuple pairs!
+
ssize_t
ACE_FILE_IO::recv (size_t n, ...) const
{
@@ -77,12 +94,15 @@ ACE_FILE_IO::recv (size_t n, ...) const
iovec[total_tuples],
-1);
#endif /* !defined (ACE_HAS_ALLOCA) */
+
va_start (argp, n);
+
for (int i = 0; i < total_tuples; i++)
{
iovp[i].iov_base = va_arg (argp, char *);
iovp[i].iov_len = va_arg (argp, int);
}
+
ssize_t const result = ACE_OS::readv (this->get_handle (),
iovp,
total_tuples);
@@ -92,17 +112,21 @@ ACE_FILE_IO::recv (size_t n, ...) const
va_end (argp);
return result;
}
+
// Allows a client to read from a file without having to provide a
// buffer to read. This method determines how much data is in the
// file, allocates a buffer of this size, reads in the data, and
// returns the number of bytes read.
+
ssize_t
ACE_FILE_IO::recvv (iovec *io_vec)
{
ACE_TRACE ("ACE_FILE_IO::recvv");
+
io_vec->iov_base = 0;
size_t const length =
static_cast <size_t> (ACE_OS::filesize (this->get_handle ()));
+
if (length > 0)
{
ACE_NEW_RETURN (io_vec->iov_base,
@@ -117,5 +141,6 @@ ACE_FILE_IO::recvv (iovec *io_vec)
return ACE_Utils::truncate_cast<ssize_t> (length);
}
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/FILE_IO.h b/dep/ACE_wrappers/ace/FILE_IO.h
index c5042c75e45..a1a470b8d30 100644
--- a/dep/ACE_wrappers/ace/FILE_IO.h
+++ b/dep/ACE_wrappers/ace/FILE_IO.h
@@ -1,4 +1,5 @@
/* -*- C++ -*- */
+
//=============================================================================
/**
* @file FILE_IO.h
@@ -8,24 +9,33 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_FILE_IO_H
#define ACE_FILE_IO_H
#include /**/ "ace/pre.h"
+
#include "ace/FILE.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/FILE_Addr.h"
+
// Used in the FILE_IO.h file...
#include "ace/os_include/os_stdio.h"
#include "ace/os_include/sys/os_uio.h"
+
#if defined (ACE_HAS_STREAM_PIPES)
# include "ace/OS_NS_stropts.h"
#endif /* ACE_HAS_STREAM_PIPES */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward decl.
class ACE_Message_Block;
class ACE_Time_Value;
+
/**
* @class ACE_FILE_IO
*
@@ -35,47 +45,61 @@ class ACE_Export ACE_FILE_IO : public ACE_FILE
{
public:
friend class ACE_FILE_Connector;
+
// = Initialization method.
/// Default constructor.
ACE_FILE_IO (void);
+
/// send upto @a n bytes in @a buf.
ssize_t send (const void *buf, size_t n) const;
+
/// Recv upto @a n bytes in @a buf.
ssize_t recv (void *buf, size_t n) const;
+
/// Send n bytes, keep trying until n are sent.
ssize_t send_n (const void *buf, size_t n) const;
+
/// Send all the @a message_blocks chained through their <next> and
/// <cont> pointers. This call uses the underlying OS gather-write
/// operation to reduce the domain-crossing penalty.
ssize_t send_n (const ACE_Message_Block *message_block,
const ACE_Time_Value *timeout = 0,
size_t *bytes_transferred = 0);
+
/// Recv n bytes, keep trying until n are received.
ssize_t recv_n (void *buf, size_t n) const;
+
#if defined (ACE_HAS_STREAM_PIPES)
/// Send bytes via STREAM pipes.
ssize_t send (const ACE_Str_Buf *cntl,
const ACE_Str_Buf *data,
int flags = 0) const;
+
/// Recv bytes via STREAM pipes.
ssize_t recv (ACE_Str_Buf *cntl,
ACE_Str_Buf *data,
int *flags) const;
+
/// Send bytes via STREAM pipes using "band" mode.
ssize_t send (const ACE_Str_Buf *cntl,
const ACE_Str_Buf *data,
int band,
int flags) const;
+
/// Recv bytes via STREAM pipes using "band" mode.
ssize_t recv (ACE_Str_Buf *cntl,
ACE_Str_Buf *data,
int *band,
int *flags) const;
+
#endif /* ACE_HAS_STREAM_PIPES */
+
/// Send iovecs via <::writev>.
ssize_t send (const iovec iov[], int n) const;
+
/// Recv iovecs via <::readv>.
ssize_t recv (iovec iov[], int n) const;
+
/**
* Send N char *ptrs and int lengths. Note that the char *'s
* precede the ints (basically, an varargs version of writev). The
@@ -83,6 +107,7 @@ public:
* couple of the number of tuple pairs!
*/
ssize_t send (size_t n, ...) const;
+
/**
* This is an interface to ::readv, that doesn't use the struct
* iovec explicitly. The ... can be passed as an arbitrary number
@@ -91,17 +116,21 @@ public:
* number of tuple pairs!
*/
ssize_t recv (size_t n, ...) const;
+
/// Send @a n bytes via Win32 WriteFile using overlapped I/O.
ssize_t send (const void *buf,
size_t n,
ACE_OVERLAPPED *overlapped) const;
+
/// Recv @a n bytes via Win32 ReadFile using overlapped I/O.
ssize_t recv (void *buf,
size_t n,
ACE_OVERLAPPED *overlapped) const;
+
/// Send an @c iovec of size @a n to the file.
ssize_t sendv (const iovec iov[],
int n) const;
+
/**
* Allows a client to read from a file without having to provide a
* buffer to read. This method determines how much data is in the
@@ -111,24 +140,32 @@ public:
* delete [] io_vec->iov_base.
*/
ssize_t recvv (iovec *io_vec);
+
/// Send an <iovec> of size @a n to the file. Will block until all
/// bytes are sent or an error occurs.
ssize_t sendv_n (const iovec iov[],
int n) const;
+
/// Receive an <iovec> of size @a n to the file.
ssize_t recvv_n (iovec iov[],
int n) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
// = Meta-type info
typedef ACE_FILE_Addr PEER_ADDR;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/FILE_IO.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_FILE_IO_H */
diff --git a/dep/ACE_wrappers/ace/FILE_IO.inl b/dep/ACE_wrappers/ace/FILE_IO.inl
index 80f18745ad7..d2e4f756c2c 100644
--- a/dep/ACE_wrappers/ace/FILE_IO.inl
+++ b/dep/ACE_wrappers/ace/FILE_IO.inl
@@ -1,10 +1,13 @@
// -*- C++ -*-
//
// $Id: FILE_IO.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/ACE.h"
#include "ace/OS_NS_sys_uio.h"
#include "ace/OS_NS_unistd.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE ssize_t
ACE_FILE_IO::sendv_n (const iovec iov[], int n) const
{
@@ -13,6 +16,7 @@ ACE_FILE_IO::sendv_n (const iovec iov[], int n) const
iov,
n);
}
+
ACE_INLINE ssize_t
ACE_FILE_IO::send_n (const ACE_Message_Block *message_block,
const ACE_Time_Value *timeout,
@@ -24,7 +28,9 @@ ACE_FILE_IO::send_n (const ACE_Message_Block *message_block,
message_block,
bytes_transferred);
}
+
// Recv an n byte message from the file.
+
ACE_INLINE ssize_t
ACE_FILE_IO::recvv_n (iovec iov[], int n) const
{
@@ -35,53 +41,64 @@ ACE_FILE_IO::recvv_n (iovec iov[], int n) const
iov,
n);
}
+
// Send an <iovec> of size <n> to the file.
+
ACE_INLINE ssize_t
ACE_FILE_IO::sendv (const iovec iov[], int n) const
{
ACE_TRACE ("ACE_FILE_IO::sendv");
return ACE_OS::writev (this->get_handle (), iov, n);
}
+
// Send exactly N bytes from BUF to this file. Keeping trying until
// this many bytes are sent.
+
ACE_INLINE ssize_t
ACE_FILE_IO::send_n (const void *buf, size_t n) const
{
ACE_TRACE ("ACE_FILE_IO::send_n");
return ACE::write_n (this->get_handle (), buf, n);
}
+
// Receive exactly N bytes from this file into BUF. Keep trying until
// this many bytes are received.
+
ACE_INLINE ssize_t
ACE_FILE_IO::recv_n (void *buf, size_t n) const
{
ACE_TRACE ("ACE_FILE_IO::recv_n");
return ACE::read_n (this->get_handle (), buf, n);
}
+
ACE_INLINE ssize_t
ACE_FILE_IO::send (const void *buf, size_t n) const
{
ACE_TRACE ("ACE_FILE_IO::send");
return ACE_OS::write (this->get_handle (), buf, n);
}
+
ACE_INLINE ssize_t
ACE_FILE_IO::recv (void *buf, size_t n) const
{
ACE_TRACE ("ACE_FILE_IO::recv");
return ACE_OS::read (this->get_handle (), buf, n);
}
+
ACE_INLINE ssize_t
ACE_FILE_IO::send (const iovec iov[], int n) const
{
ACE_TRACE ("ACE_FILE_IO::send");
return ACE_OS::writev (this->get_handle (), iov, n);
}
+
ACE_INLINE ssize_t
ACE_FILE_IO::recv (iovec iov[], int n) const
{
ACE_TRACE ("ACE_FILE_IO::recv");
return ACE_OS::readv (this->get_handle (), iov, n);
}
+
#if defined (ACE_HAS_STREAM_PIPES)
ACE_INLINE ssize_t
ACE_FILE_IO::recv (ACE_Str_Buf *cntl, ACE_Str_Buf *data, int *band, int *flags) const
@@ -89,24 +106,28 @@ ACE_FILE_IO::recv (ACE_Str_Buf *cntl, ACE_Str_Buf *data, int *band, int *flags)
ACE_TRACE ("ACE_FILE_IO::recv");
return ACE_OS::getpmsg (this->get_handle (), (strbuf *) cntl, (strbuf *) data, band, flags);
}
+
ACE_INLINE ssize_t
ACE_FILE_IO::send (const ACE_Str_Buf *cntl, const ACE_Str_Buf *data, int band, int flags) const
{
ACE_TRACE ("ACE_FILE_IO::send");
return ACE_OS::putpmsg (this->get_handle (), (strbuf *) cntl, (strbuf *) data, band, flags);
}
+
ACE_INLINE ssize_t
ACE_FILE_IO::recv (ACE_Str_Buf *cntl, ACE_Str_Buf *data, int *flags) const
{
ACE_TRACE ("ACE_FILE_IO::recv");
return ACE_OS::getmsg (this->get_handle (), (strbuf *) cntl, (strbuf *) data, flags);
}
+
ACE_INLINE ssize_t
ACE_FILE_IO::send (const ACE_Str_Buf *cntl, const ACE_Str_Buf *data, int flags) const
{
ACE_TRACE ("ACE_FILE_IO::send");
return ACE_OS::putmsg (this->get_handle (), (strbuf *) cntl, (strbuf *) data, flags);
}
+
ACE_INLINE ssize_t
ACE_FILE_IO::send (const void *buf, size_t n,
ACE_OVERLAPPED *overlapped) const
@@ -116,6 +137,7 @@ ACE_FILE_IO::send (const void *buf, size_t n,
buf, n,
overlapped);
}
+
ACE_INLINE ssize_t
ACE_FILE_IO::recv (void *buf, size_t n,
ACE_OVERLAPPED *overlapped) const
@@ -124,5 +146,7 @@ ACE_FILE_IO::recv (void *buf, size_t n,
return ACE_OS::read (this->get_handle (), buf, n,
overlapped);
}
+
#endif /* ACE_HAS_STREAM_PIPES */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/File_Lock.cpp b/dep/ACE_wrappers/ace/File_Lock.cpp
index 54779482753..2b06ff26640 100644
--- a/dep/ACE_wrappers/ace/File_Lock.cpp
+++ b/dep/ACE_wrappers/ace/File_Lock.cpp
@@ -1,22 +1,30 @@
// $Id: File_Lock.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/File_Lock.h"
#include "ace/Log_Msg.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/File_Lock.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace, File_Lock, "$Id: File_Lock.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_File_Lock)
+
void
ACE_File_Lock::dump (void) const
{
#if defined (ACE_HAS_DUMP)
// ACE_TRACE ("ACE_File_Lock::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
this->lock_.dump ();
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
ACE_File_Lock::ACE_File_Lock (ACE_HANDLE h,
int unlink_in_destructor)
: removed_ (0),
@@ -29,6 +37,7 @@ ACE_File_Lock::ACE_File_Lock (ACE_HANDLE h,
ACE_TEXT ("ACE_File_Lock::ACE_File_Lock")));
this->set_handle (h);
}
+
ACE_File_Lock::ACE_File_Lock (const ACE_TCHAR *name,
int flags,
mode_t perms,
@@ -36,12 +45,14 @@ ACE_File_Lock::ACE_File_Lock (const ACE_TCHAR *name,
: unlink_in_destructor_ (unlink_in_destructor)
{
// ACE_TRACE ("ACE_File_Lock::ACE_File_Lock");
+
if (this->open (name, flags, perms) == -1)
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("%p %s\n"),
ACE_TEXT ("ACE_File_Lock::ACE_File_Lock"),
name));
}
+
int
ACE_File_Lock::open (const ACE_TCHAR *name,
int flags,
@@ -51,10 +62,12 @@ ACE_File_Lock::open (const ACE_TCHAR *name,
this->removed_ = 0;
return ACE_OS::flock_init (&this->lock_, flags, name, perms);
}
+
ACE_File_Lock::~ACE_File_Lock (void)
{
// ACE_TRACE ("ACE_File_Lock::~ACE_File_Lock");
this->remove (this->unlink_in_destructor_);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/File_Lock.h b/dep/ACE_wrappers/ace/File_Lock.h
index aca576b562c..c0629762d15 100644
--- a/dep/ACE_wrappers/ace/File_Lock.h
+++ b/dep/ACE_wrappers/ace/File_Lock.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file File_Lock.h
@@ -8,15 +9,21 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_FILE_LOCK_H
#define ACE_FILE_LOCK_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/OS_NS_stdio.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_File_Lock
*
@@ -38,6 +45,7 @@ public:
*/
ACE_File_Lock (ACE_HANDLE handle = ACE_INVALID_HANDLE,
int unlink_in_destructor = 1);
+
/// Open the @a filename with @a flags and @a mode and set the result
/// to <handle_>. If you don't want the file unlinked in the
/// destructor pass a zero value for <unlink_in_destructor>.
@@ -45,22 +53,27 @@ public:
int flags,
mode_t mode = 0,
int unlink_in_destructor = 1);
+
/// Open the @a filename with @a flags and @a mode and set the result to
/// <handle_>.
int open (const ACE_TCHAR *filename,
int flags,
mode_t mode = 0);
+
/// Remove a File lock by releasing it and closing down the <handle_>.
~ACE_File_Lock (void);
+
/// Remove a File lock by releasing it and closing down the
/// <handle_>. If <unlink_file> is non-0 then we unlink the file.
int remove (int unlink_file = 1);
+
/**
* Note, for interface uniformity with other synchronization
* wrappers we include the <acquire> method. This is implemented as
* a write-lock to be on the safe-side...
*/
int acquire (short whence = 0, ACE_OFF_T start = 0, ACE_OFF_T len = 1);
+
/**
* Note, for interface uniformity with other synchronization
* wrappers we include the <tryacquire> method. This is implemented
@@ -69,17 +82,21 @@ public:
* is set to @c EBUSY.
*/
int tryacquire (short whence = 0, ACE_OFF_T start = 0, ACE_OFF_T len = 1);
+
/// Unlock a readers/writer lock.
int release (short whence = 0, ACE_OFF_T start = 0, ACE_OFF_T len = 1);
+
/// Acquire a write lock, but block if any readers or a
/// writer hold the lock.
int acquire_write (short whence = 0, ACE_OFF_T start = 0, ACE_OFF_T len = 1);
+
/**
* Conditionally acquire a write lock (i.e., won't block). Returns
* -1 on failure. If we "failed" because someone else already had
* the lock, @c errno is set to @c EBUSY.
*/
int tryacquire_write (short whence = 0, ACE_OFF_T start = 0, ACE_OFF_T len = 1);
+
/**
* Conditionally upgrade to a write lock (i.e., won't block). Returns
* -1 on failure. If we "failed" because someone else already had
@@ -88,20 +105,24 @@ public:
int tryacquire_write_upgrade (short whence = 0,
ACE_OFF_T start = 0,
ACE_OFF_T len = 1);
+
/**
* Acquire a read lock, but block if a writer hold the lock.
* Returns -1 on failure. If we "failed" because someone else
* already had the lock, @c errno is set to @c EBUSY.
*/
int acquire_read (short whence = 0, ACE_OFF_T start = 0, ACE_OFF_T len = 1);
+
/**
* Conditionally acquire a read lock (i.e., won't block). Returns
* -1 on failure. If we "failed" because someone else already had
* the lock, @c errno is set to @c EBUSY.
*/
int tryacquire_read (short whence = 0, ACE_OFF_T start = 0, ACE_OFF_T len = 1);
+
/// Get underlying ACE_HANDLE for the file.
ACE_HANDLE get_handle (void) const;
+
/**
* Set underlying ACE_HANDLE. Note that this method assumes
* ownership of the <handle> and will close it down in <remove>. If
@@ -111,31 +132,40 @@ public:
* overwriting it.
*/
void set_handle (ACE_HANDLE);
+
/// Dump state of the object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
/// Locking structure for OS record locks.
ACE_OS::ace_flock_t lock_;
+
/// Keeps track of whether <remove> has been called yet to avoid
/// multiple <remove> calls, e.g., explicitly and implicitly in the
/// destructor. This flag isn't protected by a lock, so make sure
/// that you don't have multiple threads simultaneously calling
/// <remove> on the same object, which is a bad idea anyway...
int removed_;
+
/// Keeps track of whether to unlink the underlying file in the
/// destructor.
int unlink_in_destructor_;
+
private:
// = Prevent assignment and initialization.
void operator= (const ACE_File_Lock &);
ACE_File_Lock (const ACE_File_Lock &);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/File_Lock.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_FILE_LOCK_H */
diff --git a/dep/ACE_wrappers/ace/File_Lock.inl b/dep/ACE_wrappers/ace/File_Lock.inl
index abdd9d4a256..20b00039222 100644
--- a/dep/ACE_wrappers/ace/File_Lock.inl
+++ b/dep/ACE_wrappers/ace/File_Lock.inl
@@ -1,25 +1,30 @@
// -*- C++ -*-
//
// $Id: File_Lock.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE int
ACE_File_Lock::acquire_read (short whence, ACE_OFF_T start, ACE_OFF_T len)
{
// ACE_TRACE ("ACE_File_Lock::acquire_read");
return ACE_OS::flock_rdlock (&this->lock_, whence, start, len);
}
+
ACE_INLINE int
ACE_File_Lock::tryacquire_read (short whence, ACE_OFF_T start, ACE_OFF_T len)
{
// ACE_TRACE ("ACE_File_Lock::tryacquire_read");
return ACE_OS::flock_tryrdlock (&this->lock_, whence, start, len);
}
+
ACE_INLINE int
ACE_File_Lock::tryacquire_write (short whence, ACE_OFF_T start, ACE_OFF_T len)
{
// ACE_TRACE ("ACE_File_Lock::tryacquire_write");
return ACE_OS::flock_trywrlock (&this->lock_, whence, start, len);
}
+
ACE_INLINE int
ACE_File_Lock::tryacquire_write_upgrade (short whence,
ACE_OFF_T start,
@@ -28,35 +33,42 @@ ACE_File_Lock::tryacquire_write_upgrade (short whence,
// ACE_TRACE ("ACE_File_Lock::tryacquire_write_upgrade");
return ACE_OS::flock_trywrlock (&this->lock_, whence, start, len);
}
+
ACE_INLINE int
ACE_File_Lock::tryacquire (short whence, ACE_OFF_T start, ACE_OFF_T len)
{
// ACE_TRACE ("ACE_File_Lock::tryacquire");
return this->tryacquire_write (whence, start, len);
}
+
ACE_INLINE int
ACE_File_Lock::acquire_write (short whence, ACE_OFF_T start, ACE_OFF_T len)
{
// ACE_TRACE ("ACE_File_Lock::acquire_write");
return ACE_OS::flock_wrlock (&this->lock_, whence, start, len);
}
+
ACE_INLINE int
ACE_File_Lock::acquire (short whence, ACE_OFF_T start, ACE_OFF_T len)
{
// ACE_TRACE ("ACE_File_Lock::acquire");
return this->acquire_write (whence, start, len);
}
+
ACE_INLINE int
ACE_File_Lock::release (short whence, ACE_OFF_T start, ACE_OFF_T len)
{
// ACE_TRACE ("ACE_File_Lock::release");
return ACE_OS::flock_unlock (&this->lock_, whence, start, len);
}
+
ACE_INLINE int
ACE_File_Lock::remove (int unlink_file)
{
// ACE_TRACE ("ACE_File_Lock::remove");
+
int result = 0;
+
if (this->removed_ == 0)
{
this->removed_ = 1;
@@ -65,12 +77,14 @@ ACE_File_Lock::remove (int unlink_file)
}
return result;
}
+
ACE_INLINE ACE_HANDLE
ACE_File_Lock::get_handle (void) const
{
// ACE_TRACE ("ACE_File_Lock::get_handle");
return this->lock_.handle_;
}
+
ACE_INLINE void
ACE_File_Lock::set_handle (ACE_HANDLE h)
{
@@ -78,4 +92,5 @@ ACE_File_Lock::set_handle (ACE_HANDLE h)
this->lock_.handle_ = h;
this->removed_ = 0;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Filecache.cpp b/dep/ACE_wrappers/ace/Filecache.cpp
index df1fe934c7d..cfb70f94f68 100644
--- a/dep/ACE_wrappers/ace/Filecache.cpp
+++ b/dep/ACE_wrappers/ace/Filecache.cpp
@@ -1,4 +1,5 @@
// $Id: Filecache.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Filecache.h"
#include "ace/Object_Manager.h"
#include "ace/Log_Msg.h"
@@ -9,9 +10,11 @@
#include "ace/OS_NS_unistd.h"
#include "ace/OS_NS_fcntl.h"
#include "ace/Truncate.h"
+
ACE_RCSID (ace,
Filecache,
"$Id: Filecache.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if defined (ACE_WIN32)
// Specifies no sharing flags.
#define R_MASK ACE_DEFAULT_OPEN_PERMS
@@ -20,6 +23,7 @@ ACE_RCSID (ace,
#define R_MASK S_IRUSR|S_IRGRP|S_IROTH
#define W_MASK S_IRUSR|S_IRGRP|S_IROTH|S_IWUSR|S_IWGRP|S_IWOTH
#endif /* ACE_WIN32 */
+
#if defined (ACE_WIN32)
// See if you can get rid of some of these.
#define READ_FLAGS (FILE_FLAG_SEQUENTIAL_SCAN | \
@@ -38,20 +42,25 @@ ACE_RCSID (ace,
#define WRITE_FLAGS (O_RDWR | O_CREAT | O_TRUNC)
// static const int WCOPY_FLAGS = O_RDWR | O_CREAT | O_TRUNC;
#endif /* ACE_WIN32 */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// static data members
ACE_Filecache *ACE_Filecache::cvf_ = 0;
+
void
ACE_Filecache_Handle::init (void)
{
this->file_ = 0;
this->handle_ = ACE_INVALID_HANDLE;
}
+
ACE_Filecache_Handle::ACE_Filecache_Handle (void)
: file_ (0), handle_ (0), mapit_ (0)
{
this->init ();
}
+
ACE_Filecache_Handle::ACE_Filecache_Handle (const ACE_TCHAR *filename,
ACE_Filecache_Flag mapit)
: file_ (0), handle_ (0), mapit_ (mapit)
@@ -59,16 +68,19 @@ ACE_Filecache_Handle::ACE_Filecache_Handle (const ACE_TCHAR *filename,
this->init ();
// Fetch the file from the Virtual_Filesystem let the
// Virtual_Filesystem do the work of cache coherency.
+
// Filecache will also do the acquire, since it holds the lock at
// that time.
this->file_ = ACE_Filecache::instance ()->fetch (filename, mapit);
}
+
ACE_Filecache_Handle::ACE_Filecache_Handle (const ACE_TCHAR *filename,
int size,
ACE_Filecache_Flag mapit)
: file_ (0), handle_ (0), mapit_ (mapit)
{
this->init ();
+
if (size == 0)
ACE_Filecache::instance ()->remove (filename);
else
@@ -76,23 +88,28 @@ ACE_Filecache_Handle::ACE_Filecache_Handle (const ACE_TCHAR *filename,
// Since this is being opened for a write, simply create a new
// ACE_Filecache_Object now, and let the destructor add it into CVF
// later
+
// Filecache will also do the acquire, since it holds the lock at
// that time.
this->file_ = ACE_Filecache::instance ()->create (filename, size);
}
}
+
ACE_Filecache_Handle::~ACE_Filecache_Handle (void)
{
if (this->handle_ != ACE_INVALID_HANDLE)
// this was dup ()'d
ACE_OS::close (this->handle_);
+
ACE_Filecache::instance ()->finish (this->file_);
}
+
void *
ACE_Filecache_Handle::address (void) const
{
return this->file_ == 0 ? 0 : this->file_->address ();
}
+
ACE_HANDLE
ACE_Filecache_Handle::handle (void) const
{
@@ -104,6 +121,7 @@ ACE_Filecache_Handle::handle (void) const
}
return this->handle_;
}
+
int
ACE_Filecache_Handle::error (void) const
{
@@ -112,6 +130,7 @@ ACE_Filecache_Handle::error (void) const
else
return this->file_->error ();
}
+
ACE_OFF_T
ACE_Filecache_Handle::size (void) const
{
@@ -120,13 +139,16 @@ ACE_Filecache_Handle::size (void) const
else
return this->file_->size ();
}
+
// ------------------
// ACE_Filecache_Hash
// ------------------
+
#define ACE_Filecache_Hash \
ACE_Hash_Map_Manager_Ex<const ACE_TCHAR *, ACE_Filecache_Object *, ACE_Hash<const ACE_TCHAR *>, ACE_Equal_To<const ACE_TCHAR *>, ACE_Null_Mutex>
#define ACE_Filecache_Hash_Entry \
ACE_Hash_Map_Entry<const ACE_TCHAR *, ACE_Filecache_Object *>
+
template <>
ACE_Filecache_Hash_Entry::ACE_Hash_Map_Entry (
const ACE_TCHAR *const &ext_id,
@@ -141,6 +163,7 @@ ACE_Filecache_Hash_Entry::ACE_Hash_Map_Entry (
prev_ (prev)
{
}
+
template <>
ACE_Filecache_Hash_Entry::ACE_Hash_Map_Entry (ACE_Filecache_Hash_Entry *next,
ACE_Filecache_Hash_Entry *prev)
@@ -149,19 +172,23 @@ ACE_Filecache_Hash_Entry::ACE_Hash_Map_Entry (ACE_Filecache_Hash_Entry *next,
prev_ (prev)
{
}
+
template <>
ACE_Filecache_Hash_Entry::~ACE_Hash_Map_Entry (void)
{
ACE_OS::free ((void *) ext_id_);
}
+
// We need these template specializations since KEY is defined as a
// ACE_TCHAR*, which doesn't have a hash() or equal() method defined on it.
+
template <>
unsigned long
ACE_Filecache_Hash::hash (const ACE_TCHAR *const &ext_id)
{
return ACE::hash_pjw (ext_id);
}
+
template <>
int
ACE_Filecache_Hash::equal (const ACE_TCHAR *const &id1,
@@ -169,12 +196,15 @@ ACE_Filecache_Hash::equal (const ACE_TCHAR *const &id1,
{
return ACE_OS::strcmp (id1, id2) == 0;
}
+
#undef ACE_Filecache_Hash
#undef ACE_Filecache_Hash_Entry
+
// -------------
// ACE_Filecache
// -------------
+
ACE_Filecache *
ACE_Filecache::instance (void)
{
@@ -185,6 +215,7 @@ ACE_Filecache::instance (void)
*ACE_Managed_Object<ACE_SYNCH_RW_MUTEX>::get_preallocated_object
(ACE_Object_Manager::ACE_FILECACHE_LOCK);
ACE_GUARD_RETURN (ACE_SYNCH_RW_MUTEX, ace_mon, lock, 0);
+
// @@ James, please check each of the ACE_NEW_RETURN calls to
// make sure that it is safe to return if allocation fails.
if (ACE_Filecache::cvf_ == 0)
@@ -192,28 +223,35 @@ ACE_Filecache::instance (void)
ACE_Filecache,
0);
}
+
return ACE_Filecache::cvf_;
}
+
ACE_Filecache::ACE_Filecache (void)
: size_ (ACE_DEFAULT_VIRTUAL_FILESYSTEM_TABLE_SIZE),
hash_ (size_)
{
}
+
ACE_Filecache::~ACE_Filecache (void)
{
}
+
ACE_Filecache_Object *
ACE_Filecache::insert_i (const ACE_TCHAR *filename,
ACE_SYNCH_RW_MUTEX &filelock,
int mapit)
{
ACE_Filecache_Object *handle = 0;
+
if (this->hash_.find (filename, handle) == -1)
{
ACE_NEW_RETURN (handle,
ACE_Filecache_Object (filename, filelock, 0, mapit),
0);
+
// ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" (%t) CVF: creating %s\n"), filename));
+
if (this->hash_.bind (filename, handle) == -1)
{
delete handle;
@@ -222,16 +260,20 @@ ACE_Filecache::insert_i (const ACE_TCHAR *filename,
}
else
handle = 0;
+
return handle;
}
+
ACE_Filecache_Object *
ACE_Filecache::remove_i (const ACE_TCHAR *filename)
{
ACE_Filecache_Object *handle = 0;
+
// Disassociate file from the cache.
if (this->hash_.unbind (filename, handle) == 0)
{
handle->stale_ = 1;
+
// Try a lock. If it succeeds, we can delete it now.
// Otherwise, it will clean itself up later.
if (handle->lock_.tryacquire_write () == 0)
@@ -242,58 +284,74 @@ ACE_Filecache::remove_i (const ACE_TCHAR *filename)
}
else
handle = 0;
+
return handle;
}
+
ACE_Filecache_Object *
ACE_Filecache::update_i (const ACE_TCHAR *filename,
ACE_SYNCH_RW_MUTEX &filelock,
int mapit)
{
ACE_Filecache_Object *handle = 0;
+
handle = this->remove_i (filename);
handle = this->insert_i (filename, filelock, mapit);
+
return handle;
}
+
int
ACE_Filecache::find (const ACE_TCHAR *filename)
{
return this->hash_.find (filename);
}
+
ACE_Filecache_Object *
ACE_Filecache::remove (const ACE_TCHAR *filename)
{
ACE_Filecache_Object *handle = 0;
+
ACE_OFF_T loc = ACE::hash_pjw (filename) % this->size_;
ACE_SYNCH_RW_MUTEX &hashlock = this->hash_lock_[loc];
// ACE_SYNCH_RW_MUTEX &filelock = this->file_lock_[loc];
+
if (this->hash_.find (filename, handle) != -1)
{
ACE_WRITE_GUARD_RETURN (ACE_SYNCH_RW_MUTEX,
ace_mon,
hashlock,
0);
+
return this->remove_i (filename);
}
+
return 0;
}
+
ACE_Filecache_Object *
ACE_Filecache::fetch (const ACE_TCHAR *filename, int mapit)
{
ACE_Filecache_Object *handle = 0;
+
ACE_OFF_T loc = ACE::hash_pjw (filename) % this->size_;
ACE_SYNCH_RW_MUTEX &hashlock = this->hash_lock_[loc];
ACE_SYNCH_RW_MUTEX &filelock = this->file_lock_[loc];
+
filelock.acquire_read ();
+
if (this->hash_.find (filename, handle) == -1)
{
ACE_WRITE_GUARD_RETURN (ACE_SYNCH_RW_MUTEX,
ace_mon,
hashlock,
0);
+
// Second check in the method call
handle = this->insert_i (filename, filelock, mapit);
+
if (handle == 0)
filelock.release ();
}
@@ -307,35 +365,45 @@ ACE_Filecache::fetch (const ACE_TCHAR *filename, int mapit)
ace_mon,
hashlock,
0);
+
// Second check in the method call
handle = this->update_i (filename, filelock, mapit);
+
if (handle == 0)
filelock.release ();
}
}
// ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" (%t) CVF: found %s\n"), filename));
}
+
return handle;
}
+
ACE_Filecache_Object *
ACE_Filecache::create (const ACE_TCHAR *filename, int size)
{
ACE_Filecache_Object *handle = 0;
+
ACE_OFF_T loc = ACE::hash_pjw (filename) % this->size_;
ACE_SYNCH_RW_MUTEX &filelock = this->file_lock_[loc];
+
ACE_NEW_RETURN (handle,
ACE_Filecache_Object (filename, size, filelock),
0);
handle->acquire ();
+
return handle;
}
+
ACE_Filecache_Object *
ACE_Filecache::finish (ACE_Filecache_Object *&file)
{
if (file == 0)
return file;
+
ACE_OFF_T loc = ACE::hash_pjw (file->filename_) % this->size_;
ACE_SYNCH_RW_MUTEX &hashlock = this->hash_lock_[loc];
+
if (file != 0)
switch (file->action_)
{
@@ -345,10 +413,13 @@ ACE_Filecache::finish (ACE_Filecache_Object *&file)
ace_mon,
hashlock,
0);
+
file->release ();
+
this->remove_i (file->filename_);
#if 0
int result = this->hash_.bind (file->filename (), file);
+
if (result == 0)
file->acquire ();
#else
@@ -365,9 +436,11 @@ ACE_Filecache::finish (ACE_Filecache_Object *&file)
}
#endif
}
+
break;
default:
file->release ();
+
// Last one using a stale file is resposible for deleting it.
if (file->stale_)
{
@@ -379,10 +452,13 @@ ACE_Filecache::finish (ACE_Filecache_Object *&file)
file = 0;
}
}
+
break;
}
+
return file;
}
+
void
ACE_Filecache_Object::init (void)
{
@@ -391,8 +467,10 @@ ACE_Filecache_Object::init (void)
this->error_ = ACE_SUCCESS;
this->tempname_ = 0;
this->size_ = 0;
+
ACE_OS::memset (&(this->stat_), 0, sizeof (this->stat_));
}
+
ACE_Filecache_Object::ACE_Filecache_Object (void)
: tempname_ (0),
mmap_ (),
@@ -408,6 +486,7 @@ ACE_Filecache_Object::ACE_Filecache_Object (void)
{
this->init ();
}
+
ACE_Filecache_Object::ACE_Filecache_Object (const ACE_TCHAR *filename,
ACE_SYNCH_RW_MUTEX &lock,
LPSECURITY_ATTRIBUTES sa,
@@ -425,24 +504,29 @@ ACE_Filecache_Object::ACE_Filecache_Object (const ACE_TCHAR *filename,
lock_ (lock)
{
this->init ();
+
// ASSERT strlen(filename) < sizeof (this->filename_)
ACE_OS::strcpy (this->filename_, filename);
this->action_ = ACE_Filecache_Object::ACE_READING;
// place ourselves into the READING state
+
// Can we access the file?
if (ACE_OS::access (this->filename_, R_OK) == -1)
{
this->error_i (ACE_Filecache_Object::ACE_ACCESS_FAILED);
return;
}
+
// Can we stat the file?
if (ACE_OS::stat (this->filename_, &this->stat_) == -1)
{
this->error_i (ACE_Filecache_Object::ACE_STAT_FAILED);
return;
}
+
this->size_ = ACE_Utils::truncate_cast<ACE_OFF_T> (this->stat_.st_size);
this->tempname_ = this->filename_;
+
// Can we open the file?
this->handle_ = ACE_OS::open (this->tempname_,
READ_FLAGS, R_MASK, this->sa_);
@@ -452,6 +536,7 @@ ACE_Filecache_Object::ACE_Filecache_Object (const ACE_TCHAR *filename,
ACE_TEXT ("ACE_Filecache_Object::ctor: open"));
return;
}
+
if (mapit)
{
// Can we map the file?
@@ -465,9 +550,11 @@ ACE_Filecache_Object::ACE_Filecache_Object (const ACE_TCHAR *filename,
return;
}
}
+
// Ok, finished!
this->action_ = ACE_Filecache_Object::ACE_READING;
}
+
ACE_Filecache_Object::ACE_Filecache_Object (const ACE_TCHAR *filename,
ACE_OFF_T size,
ACE_SYNCH_RW_MUTEX &lock,
@@ -477,9 +564,11 @@ ACE_Filecache_Object::ACE_Filecache_Object (const ACE_TCHAR *filename,
lock_ (lock)
{
this->init ();
+
this->size_ = size;
ACE_OS::strcpy (this->filename_, filename);
this->action_ = ACE_Filecache_Object::ACE_WRITING;
+
// Can we access the file?
if (ACE_OS::access (this->filename_, R_OK|W_OK) == -1
// Does it exist?
@@ -489,7 +578,9 @@ ACE_Filecache_Object::ACE_Filecache_Object (const ACE_TCHAR *filename,
this->error_i (ACE_Filecache_Object::ACE_ACCESS_FAILED);
return;
}
+
this->tempname_ = this->filename_;
+
// Can we open the file?
this->handle_ = ACE_OS::open (this->tempname_, WRITE_FLAGS, W_MASK, this->sa_);
if (this->handle_ == ACE_INVALID_HANDLE)
@@ -498,6 +589,7 @@ ACE_Filecache_Object::ACE_Filecache_Object (const ACE_TCHAR *filename,
ACE_TEXT ("ACE_Filecache_Object::acquire: open"));
return;
}
+
// Can we write?
if (ACE_OS::pwrite (this->handle_, "", 1, this->size_ - 1) != 1)
{
@@ -506,6 +598,7 @@ ACE_Filecache_Object::ACE_Filecache_Object (const ACE_TCHAR *filename,
ACE_OS::close (this->handle_);
return;
}
+
// Can we map?
if (this->mmap_.map (this->handle_, this->size_, PROT_RDWR, MAP_SHARED,
0, 0, this->sa_) != 0)
@@ -514,8 +607,10 @@ ACE_Filecache_Object::ACE_Filecache_Object (const ACE_TCHAR *filename,
ACE_TEXT ("ACE_Filecache_Object::acquire: map"));
ACE_OS::close (this->handle_);
}
+
// Ok, done!
}
+
ACE_Filecache_Object::~ACE_Filecache_Object (void)
{
if (this->error_ == ACE_SUCCESS)
@@ -524,19 +619,23 @@ ACE_Filecache_Object::~ACE_Filecache_Object (void)
ACE_OS::close (this->handle_);
this->handle_ = ACE_INVALID_HANDLE;
}
+
this->lock_.release ();
}
+
int
ACE_Filecache_Object::acquire (void)
{
return this->lock_.tryacquire_read ();
}
+
int
ACE_Filecache_Object::release (void)
{
if (this->action_ == ACE_WRITING)
{
// We are safe since only one thread has a writable Filecache_Object
+
#if 0
ACE_HANDLE original = ACE_OS::open (this->filename_, WRITE_FLAGS, W_MASK,
this->sa_);
@@ -552,9 +651,11 @@ ACE_Filecache_Object::release (void)
else if (ACE_OS::stat (this->filename_, &this->stat_) == -1)
this->error_ = ACE_Filecache_Object::ACE_STAT_FAILED;
#endif
+
this->mmap_.unmap ();
ACE_OS::close (this->handle_);
this->handle_ = ACE_INVALID_HANDLE;
+
#if 0
// Leave the file in an acquirable state.
this->handle_ = ACE_OS::open (this->tempname_, READ_FLAGS, R_MASK);
@@ -575,17 +676,21 @@ ACE_Filecache_Object::release (void)
ACE_OS::close (this->handle_);
this->handle_ = ACE_INVALID_HANDLE;
}
+
this->action_ = ACE_Filecache_Object::ACE_READING;
#endif
}
+
return this->lock_.release ();
}
+
int
ACE_Filecache_Object::error (void) const
{
// The existence of the object means a read lock is being held.
return this->error_;
}
+
int
ACE_Filecache_Object::error_i (int error_value, const ACE_TCHAR *s)
{
@@ -594,36 +699,42 @@ ACE_Filecache_Object::error_i (int error_value, const ACE_TCHAR *s)
this->error_ = error_value;
return error_value;
}
+
const ACE_TCHAR *
ACE_Filecache_Object::filename (void) const
{
// The existence of the object means a read lock is being held.
return this->filename_;
}
+
ACE_OFF_T
ACE_Filecache_Object::size (void) const
{
// The existence of the object means a read lock is being held.
return this->size_;
}
+
ACE_HANDLE
ACE_Filecache_Object::handle (void) const
{
// The existence of the object means a read lock is being held.
return this->handle_;
}
+
void *
ACE_Filecache_Object::address (void) const
{
// The existence of the object means a read lock is being held.
return this->mmap_.addr ();
}
+
int
ACE_Filecache_Object::update (void) const
{
// The existence of the object means a read lock is being held.
int result;
ACE_stat statbuf;
+
if (ACE_OS::stat (this->filename_, &statbuf) == -1)
result = 1;
else
@@ -636,7 +747,9 @@ ACE_Filecache_Object::update (void) const
#else
result = ACE_OS::difftime (this->stat_.st_mtime, statbuf.st_mtime) < 0;
#endif /* ACE_HAS_WINCE */
+
return result;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Filecache.h b/dep/ACE_wrappers/ace/Filecache.h
index bdc89e39b36..c6dba10f339 100644
--- a/dep/ACE_wrappers/ace/Filecache.h
+++ b/dep/ACE_wrappers/ace/Filecache.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Filecache.h
@@ -9,25 +10,34 @@
*/
//=============================================================================
+
#ifndef ACE_FILECACHE_H
#define ACE_FILECACHE_H
+
#include /**/ "ace/pre.h"
+
#include "ace/Mem_Map.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Hash_Map_Manager_T.h"
#include "ace/Null_Mutex.h"
#include "ace/Synch_Traits.h"
#include "ace/RW_Thread_Mutex.h"
#include "ace/OS_NS_sys_stat.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
enum ACE_Filecache_Flag
{
ACE_NOMAP = 0,
ACE_MAPIT = 1
};
+
class ACE_Filecache_Object;
+
/**
* @class ACE_Filecache_Handle
*
@@ -79,10 +89,12 @@ class ACE_Export ACE_Filecache_Handle
// Since this design should be simpler, problems should be easier to spot.
//
public:
+
/// Query cache for file, and acquire it. Assumes the file is being
/// opened for reading.
ACE_Filecache_Handle (const ACE_TCHAR *filename,
ACE_Filecache_Flag mapit = ACE_MAPIT);
+
/**
* Create new entry, and acquire it. Presence of SIZE assumes the
* file is being opened for writing. If SIZE is zero, assumes the
@@ -91,21 +103,29 @@ public:
ACE_Filecache_Handle (const ACE_TCHAR *filename,
int size,
ACE_Filecache_Flag mapit = ACE_MAPIT);
+
/// Closes any open handles, release acquired file.
~ACE_Filecache_Handle (void);
+
/// Base address of memory mapped file.
void *address (void) const;
+
/// A handle (e.g., UNIX file descriptor, or NT file handle).
ACE_HANDLE handle (void) const;
+
/// Any associated error in handle creation and acquisition.
int error (void) const;
+
/// The size of the file.
ACE_OFF_T size (void) const;
+
protected:
/// Default do nothing constructor. Prevent it from being called.
ACE_Filecache_Handle (void);
+
/// Common initializations for constructors.
void init (void);
+
public:
/// These come from ACE_Filecache_Object, which is an internal class.
enum
@@ -118,16 +138,22 @@ public:
ACE_MEMMAP_FAILED,
ACE_WRITE_FAILED
};
+
private:
/// A reference to the low level instance.
ACE_Filecache_Object *file_;
+
/// A <dup>'d version of the one from <file_>.
ACE_HANDLE handle_;
+
int mapit_;
};
+
typedef ACE_Hash_Map_Manager_Ex<const ACE_TCHAR *, ACE_Filecache_Object *, ACE_Hash<const ACE_TCHAR *>, ACE_Equal_To<const ACE_TCHAR *>, ACE_Null_Mutex>
ACE_Filecache_Hash;
+
typedef ACE_Hash_Map_Entry<const ACE_TCHAR *, ACE_Filecache_Object *> ACE_Filecache_Hash_Entry;
+
/**
* @class ACE_Filecache
*
@@ -141,20 +167,27 @@ class ACE_Export ACE_Filecache
public:
/// Singleton pattern.
static ACE_Filecache *instance (void);
+
~ACE_Filecache (void);
+
/// Returns 0 if the file associated with ``filename'' is in the cache,
/// or -1 if not.
int find (const ACE_TCHAR *filename);
+
/// Return the file associated with ``filename'' if it is in the cache,
/// or create if not.
ACE_Filecache_Object *fetch (const ACE_TCHAR *filename, int mapit = 1);
+
/// Remove the file associated with ``filename'' from the cache.
ACE_Filecache_Object *remove (const ACE_TCHAR *filename);
+
/// Create a new Filecache_Object, returns it.
ACE_Filecache_Object *create (const ACE_TCHAR *filename, int size);
+
/// Release an acquired Filecache_Object, returns it again or NULL if it
/// was deleted.
ACE_Filecache_Object *finish (ACE_Filecache_Object *&new_file);
+
protected:
ACE_Filecache_Object *insert_i (const ACE_TCHAR *filename,
ACE_SYNCH_RW_MUTEX &filelock,
@@ -163,29 +196,38 @@ protected:
ACE_Filecache_Object *update_i (const ACE_TCHAR *filename,
ACE_SYNCH_RW_MUTEX &filelock,
int mapit);
+
public:
+
enum
{
/// For this stupid implementation, use an array. Someday, use a
/// balanced search tree, or real hash table.
ACE_DEFAULT_VIRTUAL_FILESYSTEM_TABLE_SIZE = 512,
+
/// This determines the highwater mark in megabytes for the cache.
/// This will be ignored for now.
ACE_DEFAULT_VIRTUAL_FILESYSTEM_CACHE_SIZE = 20
};
+
protected:
/// Prevent it from being called.
ACE_Filecache (void);
+
private:
ACE_OFF_T size_;
+
/// The hash table
ACE_Filecache_Hash hash_;
+
/// The reference to the instance
static ACE_Filecache *cvf_;
+
// = Synchronization variables.
ACE_SYNCH_RW_MUTEX hash_lock_[ACE_DEFAULT_VIRTUAL_FILESYSTEM_TABLE_SIZE];
ACE_SYNCH_RW_MUTEX file_lock_[ACE_DEFAULT_VIRTUAL_FILESYSTEM_TABLE_SIZE];
};
+
/**
* @class ACE_Filecache_Object
*
@@ -198,51 +240,68 @@ class ACE_Export ACE_Filecache_Object
{
public:
friend class ACE_Filecache;
+
/// Creates a file for reading.
ACE_Filecache_Object (const ACE_TCHAR *filename,
ACE_SYNCH_RW_MUTEX &lock,
LPSECURITY_ATTRIBUTES sa = 0,
int mapit = 1);
+
/// Creates a file for writing.
ACE_Filecache_Object (const ACE_TCHAR *filename,
ACE_OFF_T size,
ACE_SYNCH_RW_MUTEX &lock,
LPSECURITY_ATTRIBUTES sa = 0);
+
/// Only if reference count is zero should this be called.
~ACE_Filecache_Object (void);
+
/// Increment the reference_count_.
int acquire (void);
+
/// Decrement the reference_count_.
int release (void);
+
// = error_ accessors
int error (void) const;
int error (int error_value,
const ACE_TCHAR *s = ACE_TEXT ("ACE_Filecache_Object"));
+
/// filename_ accessor
const ACE_TCHAR *filename (void) const;
+
/// handle_ accessor.
ACE_HANDLE handle (void) const;
+
/// Base memory address for memory mapped file.
void *address (void) const;
+
/// size_ accessor.
ACE_OFF_T size (void) const;
+
/// True if file on disk is newer than cached file.
int update (void) const;
+
protected:
/// Prevent from being called.
ACE_Filecache_Object (void);
+
/// Common initialization code,
void init (void);
+
private:
/// Internal error logging method, no locking.
int error_i (int error_value,
const ACE_TCHAR *s = ACE_TEXT ("ACE_Filecache_Object"));
+
public:
+
enum Creation_States
{
ACE_READING = 1,
ACE_WRITING = 2
};
+
enum Error_Conditions
{
ACE_SUCCESS = 0,
@@ -253,31 +312,43 @@ public:
ACE_MEMMAP_FAILED,
ACE_WRITE_FAILED
};
+
private:
/// The temporary file name and the real file name. The real file is
/// copied into the temporary file for safety reasons.
ACE_TCHAR *tempname_;
ACE_TCHAR filename_[MAXPATHLEN + 1];
+
/// Holds the memory mapped version of the temporary file.
ACE_Mem_Map mmap_;
+
/// The descriptor to the temporary file.
ACE_HANDLE handle_;
+
/// Used to compare against the real file to test if an update is needed.
ACE_stat stat_;
ACE_OFF_T size_;
+
/// Status indicators.
int action_;
int error_;
+
/// If set to 1, means the object is flagged for removal.
int stale_;
+
/// Security attribute object.
LPSECURITY_ATTRIBUTES sa_;
+
/// The default initializer
ACE_SYNCH_RW_MUTEX junklock_;
+
/// Provides a bookkeeping mechanism for users of this object.
ACE_SYNCH_RW_MUTEX &lock_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
+
#endif /* ACE_FILECACHE_H */
diff --git a/dep/ACE_wrappers/ace/Flag_Manip.cpp b/dep/ACE_wrappers/ace/Flag_Manip.cpp
index c453ef6dafc..252ea6240da 100644
--- a/dep/ACE_wrappers/ace/Flag_Manip.cpp
+++ b/dep/ACE_wrappers/ace/Flag_Manip.cpp
@@ -1,20 +1,28 @@
// $Id: Flag_Manip.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Flag_Manip.h"
+
#if defined (ACE_LACKS_FCNTL)
# include "ace/OS_NS_stropts.h"
# include "ace/OS_NS_errno.h"
#endif /* ACE_LACKS_FCNTL */
+
#if !defined (__ACE_INLINE__)
#include "ace/Flag_Manip.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (CYGWIN32)
# include "ace/os_include/os_termios.h"
#endif /* CYGWIN32 */
+
ACE_RCSID (ace,
Flag_Manip,
"$Id: Flag_Manip.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Flags are file status flags to turn on.
+
int
ACE::set_flags (ACE_HANDLE handle, int flags)
{
@@ -34,21 +42,27 @@ ACE::set_flags (ACE_HANDLE handle, int flags)
}
#else
int val = ACE_OS::fcntl (handle, F_GETFL, 0);
+
if (val == -1)
return -1;
+
// Turn on flags.
ACE_SET_BITS (val, flags);
+
if (ACE_OS::fcntl (handle, F_SETFL, val) == -1)
return -1;
else
return 0;
#endif /* ACE_LACKS_FCNTL */
}
+
// Flags are the file status flags to turn off.
+
int
ACE::clr_flags (ACE_HANDLE handle, int flags)
{
ACE_TRACE ("ACE::clr_flags");
+
#if defined (ACE_LACKS_FCNTL)
switch (flags)
{
@@ -64,15 +78,19 @@ ACE::clr_flags (ACE_HANDLE handle, int flags)
}
#else
int val = ACE_OS::fcntl (handle, F_GETFL, 0);
+
if (val == -1)
return -1;
+
// Turn flags off.
ACE_CLR_BITS (val, flags);
+
if (ACE_OS::fcntl (handle, F_SETFL, val) == -1)
return -1;
else
return 0;
#endif /* ACE_LACKS_FCNTL */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Flag_Manip.h b/dep/ACE_wrappers/ace/Flag_Manip.h
index d88a97fd033..6bd797e5606 100644
--- a/dep/ACE_wrappers/ace/Flag_Manip.h
+++ b/dep/ACE_wrappers/ace/Flag_Manip.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Flag_Manip.h
@@ -10,36 +11,49 @@
* @author Priyanka Gontla <pgontla@doc.ece.uci.edu>
*/
//=============================================================================
+
#ifndef ACE_FLAG_MANIP_H
#define ACE_FLAG_MANIP_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Global_Macros.h"
#include "ace/os_include/os_fcntl.h" /* For values passed to these methods */
+
#if defined (ACE_EXPORT_MACRO)
# undef ACE_EXPORT_MACRO
#endif
#define ACE_EXPORT_MACRO ACE_Export
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE
{
// = Set/get/clear various flags related to I/O HANDLE.
/// Set flags associated with @a handle.
extern ACE_Export int set_flags (ACE_HANDLE handle,
int flags);
+
/// Clear flags associated with @a handle.
extern ACE_Export int clr_flags (ACE_HANDLE handle,
int flags);
+
/// Return the current setting of flags associated with @a handle.
ACE_NAMESPACE_INLINE_FUNCTION int get_flags (ACE_HANDLE handle);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Flag_Manip.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_FLAG_MANIP_H */
diff --git a/dep/ACE_wrappers/ace/Flag_Manip.inl b/dep/ACE_wrappers/ace/Flag_Manip.inl
index bcf170defeb..229a4ee596c 100644
--- a/dep/ACE_wrappers/ace/Flag_Manip.inl
+++ b/dep/ACE_wrappers/ace/Flag_Manip.inl
@@ -1,13 +1,17 @@
// -*- C++ -*-
//
// $Id: Flag_Manip.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_fcntl.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Return flags currently associated with handle.
ACE_INLINE int
ACE::get_flags (ACE_HANDLE handle)
{
ACE_TRACE ("ACE::get_flags");
+
#if defined (ACE_LACKS_FCNTL)
// ACE_OS::fcntl is not supported. It
// would be better to store ACE's notion of the flags
@@ -18,4 +22,5 @@ ACE::get_flags (ACE_HANDLE handle)
return ACE_OS::fcntl (handle, F_GETFL, 0);
#endif /* ACE_LACKS_FCNTL */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Framework_Component.cpp b/dep/ACE_wrappers/ace/Framework_Component.cpp
index 15ce13a7f6d..446df96fa31 100644
--- a/dep/ACE_wrappers/ace/Framework_Component.cpp
+++ b/dep/ACE_wrappers/ace/Framework_Component.cpp
@@ -1,50 +1,69 @@
// Framework_Component.cpp
// $Id: Framework_Component.cpp 82238 2008-07-02 12:05:46Z sma $
+
#include "ace/Framework_Component.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Framework_Component.inl"
#endif /* __ACE_INLINE__ */
+
#include "ace/Object_Manager.h"
#include "ace/Log_Msg.h"
#include "ace/DLL_Manager.h"
#include "ace/Recursive_Thread_Mutex.h"
#include "ace/OS_NS_string.h"
+
ACE_RCSID(ace, Framework_Component, "$Id: Framework_Component.cpp 82238 2008-07-02 12:05:46Z sma $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_Framework_Component::~ACE_Framework_Component (void)
{
ACE_TRACE ("ACE_Framework_Component::~ACE_Framework_Component");
+
ACE::strdelete (const_cast<ACE_TCHAR*> (this->dll_name_));
ACE::strdelete (const_cast<ACE_TCHAR*> (this->name_));
}
+
/***************************************************************/
+
ACE_ALLOC_HOOK_DEFINE(ACE_Framework_Repository)
+
sig_atomic_t ACE_Framework_Repository::shutting_down_ = 0;
+
// Pointer to the Singleton instance.
ACE_Framework_Repository *ACE_Framework_Repository::repository_ = 0;
+
ACE_Framework_Repository::~ACE_Framework_Repository (void)
{
ACE_TRACE ("ACE_Framework_Repository::~ACE_Framework_Repository");
this->close ();
}
+
int
ACE_Framework_Repository::open (int size)
{
ACE_TRACE ("ACE_Framework_Repository::open");
+
ACE_Framework_Component **temp = 0;
+
ACE_NEW_RETURN (temp,
ACE_Framework_Component *[size],
-1);
+
this->component_vector_ = temp;
this->total_size_ = size;
return 0;
}
+
int
ACE_Framework_Repository::close (void)
{
ACE_TRACE ("ACE_Framework_Repository::close");
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1));
+
this->shutting_down_ = 1;
+
if (this->component_vector_ != 0)
{
// Delete components in reverse order.
@@ -54,20 +73,25 @@ ACE_Framework_Repository::close (void)
ACE_Framework_Component *s =
const_cast<ACE_Framework_Component *> (
this->component_vector_[i]);
+
this->component_vector_[i] = 0;
delete s;
}
+
delete [] this->component_vector_;
this->component_vector_ = 0;
this->current_size_ = 0;
}
+
ACE_DLL_Manager::close_singleton ();
return 0;
}
+
ACE_Framework_Repository *
ACE_Framework_Repository::instance (int size)
{
ACE_TRACE ("ACE_Framework_Repository::instance");
+
if (ACE_Framework_Repository::repository_ == 0)
{
// Perform Double-Checked Locking Optimization.
@@ -84,23 +108,29 @@ ACE_Framework_Repository::instance (int size)
}
}
}
+
return ACE_Framework_Repository::repository_;
}
+
void
ACE_Framework_Repository::close_singleton (void)
{
ACE_TRACE ("ACE_Framework_Repository::close_singleton");
+
ACE_MT (ACE_GUARD (ACE_Recursive_Thread_Mutex, ace_mon,
*ACE_Static_Object_Lock::instance ()));
+
delete ACE_Framework_Repository::repository_;
ACE_Framework_Repository::repository_ = 0;
}
+
int
ACE_Framework_Repository::register_component (ACE_Framework_Component *fc)
{
ACE_TRACE ("ACE_Framework_Repository::register_component");
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1));
int i;
+
// Check to see if it's already registered
for (i = 0; i < this->current_size_; i++)
if (this->component_vector_[i] &&
@@ -110,20 +140,24 @@ ACE_Framework_Repository::register_component (ACE_Framework_Component *fc)
"AFR::register_component: error, compenent already registered\n"),
-1);
}
+
if (i < this->total_size_)
{
this->component_vector_[i] = fc;
this->current_size_++;
return 0;
}
+
return -1;
}
+
int
ACE_Framework_Repository::remove_component (const ACE_TCHAR *name)
{
ACE_TRACE ("ACE_Framework_Repository::remove_component");
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1));
int i;
+
for (i = 0; i < this->current_size_; i++)
if (this->component_vector_[i] &&
ACE_OS::strcmp (this->component_vector_[i]->name_, name) == 0)
@@ -133,23 +167,30 @@ ACE_Framework_Repository::remove_component (const ACE_TCHAR *name)
this->compact ();
return 0;
}
+
return -1;
}
+
int
ACE_Framework_Repository::remove_dll_components (const ACE_TCHAR *dll_name)
{
ACE_TRACE ("ACE_Framework_Repository::remove_dll_components");
+
if (this->shutting_down_)
return this->remove_dll_components_i (dll_name);
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1));
+
return this->remove_dll_components_i (dll_name);
}
+
int
ACE_Framework_Repository::remove_dll_components_i (const ACE_TCHAR *dll_name)
{
ACE_TRACE ("ACE_Framework_Repository::remove_dll_components_i");
+
int i;
int retval = -1;
+
for (i = 0; i < this->current_size_; i++)
if (this->component_vector_[i] &&
ACE_OS::strcmp (this->component_vector_[i]->dll_name_, dll_name) == 0)
@@ -163,20 +204,26 @@ ACE_Framework_Repository::remove_dll_components_i (const ACE_TCHAR *dll_name)
this->component_vector_[i] = 0;
++retval;
}
+
this->compact ();
+
return retval == -1 ? -1 : 0;
}
+
void
ACE_Framework_Repository::compact (void)
{
ACE_TRACE ("ACE_Framework_Repository::compact");
+
int i;
int start_hole;
int end_hole;
+
do
{
start_hole = this->current_size_;
end_hole = this->current_size_;
+
// Find hole
for (i = 0; i < this->current_size_; ++i)
{
@@ -193,6 +240,7 @@ ACE_Framework_Repository::compact (void)
else if (end_hole != this->current_size_)
break;
}
+
if (start_hole != this->current_size_)
{
// move the contents and reset current_size_
@@ -205,8 +253,10 @@ ACE_Framework_Repository::compact (void)
// active slot.
this->current_size_ = start_hole;
}
+
} while (start_hole != this->current_size_);
}
+
void
ACE_Framework_Repository::dump (void) const
{
@@ -214,14 +264,17 @@ ACE_Framework_Repository::dump (void) const
ACE_TRACE ("ACE_Framework_Repository::dump");
#endif /* ACE_HAS_DUMP */
}
+
ACE_Framework_Repository::ACE_Framework_Repository (int size)
: current_size_ (0)
{
ACE_TRACE ("ACE_Framework_Repository::ACE_Framework_Repository");
+
if (this->open (size) == -1)
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_Framework_Repository")));
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Framework_Component.h b/dep/ACE_wrappers/ace/Framework_Component.h
index 5d0c5a93645..fecd8ccf3bb 100644
--- a/dep/ACE_wrappers/ace/Framework_Component.h
+++ b/dep/ACE_wrappers/ace/Framework_Component.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Framework_Component.h
@@ -31,17 +32,24 @@
* @author Don Hinton <dhinton@ieee.org>.
*/
//=============================================================================
+
#ifndef ACE_FRAMEWORK_COMPONENT_H
#define ACE_FRAMEWORK_COMPONENT_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/os_signal.h"
#include "ace/Thread_Mutex.h"
+
#define ACE_DEFAULT_FRAMEWORK_REPOSITORY_SIZE 1024
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Framework_Component
*
@@ -52,27 +60,35 @@ class ACE_Export ACE_Framework_Component
{
public:
friend class ACE_Framework_Repository;
+
/// Constructor.
ACE_Framework_Component (void *_this,
const ACE_TCHAR *dll_name = 0,
const ACE_TCHAR *name = 0);
+
/// Close the contained singleton.
virtual void close_singleton (void) = 0;
+
protected:
/// Destructor.
virtual ~ACE_Framework_Component (void);
+
private:
// No copy possible
ACE_Framework_Component (const ACE_Framework_Component &);
void operator= (const ACE_Framework_Component &);
+
private:
/// Pointer to the actual component.
const void *this_;
+
/// Library associated with this component
const ACE_TCHAR *dll_name_;
+
/// Component name
const ACE_TCHAR *name_;
};
+
/**
* @class ACE_Framework_Repository
*
@@ -87,77 +103,109 @@ class ACE_Export ACE_Framework_Repository
public:
// This is just to silence a compiler warning about no public ctors
friend class ACE_Framework_Component;
+
enum
{
DEFAULT_SIZE = ACE_DEFAULT_FRAMEWORK_REPOSITORY_SIZE
};
+
/// Close down the repository and free up dynamically allocated
/// resources.
~ACE_Framework_Repository (void);
+
/// Initialize the repository.
int open (int size = DEFAULT_SIZE);
+
/// Close down the repository and free up dynamically allocated
/// resources, also called by dtor.
int close (void);
+
/// Get pointer to a process-wide ACE_Framework_Repository.
static ACE_Framework_Repository *instance
(int size = ACE_Framework_Repository::DEFAULT_SIZE);
+
/// Delete the dynamically allocated Singleton.
static void close_singleton (void);
+
// = Search structure operations (all acquire locks as necessary).
+
/// Insert a new component. Returns -1 when the repository is full
/// and 0 on success.
int register_component (ACE_Framework_Component *fc);
+
/// Remove a component. Returns -1 on error or if component not found
/// and 0 on success.
int remove_component (const ACE_TCHAR *name);
+
/// Remove all components associated with a particular dll.
int remove_dll_components (const ACE_TCHAR *dll_name);
+
/// Return the current size of the repository.
int current_size (void) const;
+
/// Return the total size of the repository.
int total_size (void) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
+
/// Initialize the repository.
ACE_Framework_Repository (int size = ACE_Framework_Repository::DEFAULT_SIZE);
+
private:
+
/// Actually removes the dll components, must be called with locks held.
int remove_dll_components_i (const ACE_TCHAR *dll_name);
+
/// Compact component_vector_ after components have been removed__maintains
/// order.
void compact (void);
+
/// Disallow copying and assignment.
ACE_Framework_Repository (const ACE_Framework_Repository &);
ACE_Framework_Repository &operator= (const ACE_Framework_Repository &);
+
private:
+
/// Contains all the framework components.
ACE_Framework_Component **component_vector_;
+
/// Current number of components.
int current_size_;
+
/// Maximum number of components.
int total_size_;
+
/// Pointer to a process-wide ACE_Framework_Repository.
static ACE_Framework_Repository *repository_;
+
/// Flag set when repository is the process of shutting down. This
/// is necessary to keep from self-deadlocking since some of
/// the components might make calls back to the repository to
/// unload their components, e.g., ACE_DLL_Manager.
static sig_atomic_t shutting_down_;
+
#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
/// Synchronization variable for the MT_SAFE Repository
ACE_Thread_Mutex lock_;
#endif /* ACE_MT_SAFE */
+
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Framework_Component.inl"
#endif /* __ACE_INLINE__ */
+
// Include the templates classes at this point.
#include "ace/Framework_Component_T.h"
+
#include /**/ "ace/post.h"
#endif /* ACE_FRAMEWORK_COMPONENT_H */
diff --git a/dep/ACE_wrappers/ace/Framework_Component.inl b/dep/ACE_wrappers/ace/Framework_Component.inl
index 46736dd73ab..1fb2de38b85 100644
--- a/dep/ACE_wrappers/ace/Framework_Component.inl
+++ b/dep/ACE_wrappers/ace/Framework_Component.inl
@@ -1,9 +1,12 @@
// -*- C++ -*-
//
// $Id: Framework_Component.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/ACE.h"
#include "ace/Guard_T.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_Framework_Component::ACE_Framework_Component (void *_this,
const ACE_TCHAR *dll_name,
@@ -14,7 +17,9 @@ ACE_Framework_Component::ACE_Framework_Component (void *_this,
{
ACE_TRACE ("ACE_Framework_Component::ctor");
}
+
/***************************************************************/
+
ACE_INLINE int
ACE_Framework_Repository::current_size (void) const
{
@@ -22,6 +27,7 @@ ACE_Framework_Repository::current_size (void) const
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, (ACE_Thread_Mutex &) this->lock_, -1));
return this->current_size_;
}
+
ACE_INLINE int
ACE_Framework_Repository::total_size (void) const
{
@@ -29,4 +35,5 @@ ACE_Framework_Repository::total_size (void) const
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, (ACE_Thread_Mutex &) this->lock_, -1));
return this->total_size_;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Framework_Component_T.h b/dep/ACE_wrappers/ace/Framework_Component_T.h
index 5ddc94a633f..f8d365a86c0 100644
--- a/dep/ACE_wrappers/ace/Framework_Component_T.h
+++ b/dep/ACE_wrappers/ace/Framework_Component_T.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Framework_Component_T.h
@@ -8,14 +9,18 @@
* @author Don Hinton <dhinton@ieee.org>
*/
//=============================================================================
+
#ifndef ACE_FRAMEWORK_COMPONENT_T_H
#define ACE_FRAMEWORK_COMPONENT_T_H
#include /**/ "ace/pre.h"
#include "ace/Framework_Component.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Framework_Component_T
*
@@ -34,26 +39,34 @@ class ACE_Framework_Component_T : public ACE_Framework_Component
{
public:
// = Initialization and termination methods.
+
/// Constructor.
ACE_Framework_Component_T (Concrete *concrete);
+
/// Destructor.
~ACE_Framework_Component_T (void);
+
/// Close the contained singleton.
void close_singleton (void);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
// This macro should be called in the instance() method
// of the Concrete class that will be managed. Along
// with the appropriate template instantiation.
#define ACE_REGISTER_FRAMEWORK_COMPONENT(CLASS, INSTANCE) \
ACE_Framework_Repository::instance ()->register_component \
(new ACE_Framework_Component_T<CLASS> (INSTANCE));
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Framework_Component_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Framework_Component_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
#endif /* ACE_FRAMEWORK_COMPONENT_T_H */
diff --git a/dep/ACE_wrappers/ace/Free_List.h b/dep/ACE_wrappers/ace/Free_List.h
index 9c674df8abb..ba1f0e4dded 100644
--- a/dep/ACE_wrappers/ace/Free_List.h
+++ b/dep/ACE_wrappers/ace/Free_List.h
@@ -1,4 +1,5 @@
/* -*- C++ -*- */
+
//=============================================================================
/**
* @file Free_List.h
@@ -8,17 +9,23 @@
* @author Darrell Brunsch (brunsch@cs.wustl.edu)
*/
//=============================================================================
+
#ifndef ACE_FREE_LIST_H
#define ACE_FREE_LIST_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Global_Macros.h"
#include "ace/Default_Constants.h"
#include "ace/os_include/os_stddef.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Free_List
*
@@ -32,17 +39,22 @@ class ACE_Free_List
public:
/// Destructor - removes all the elements from the free_list.
virtual ~ACE_Free_List (void);
+
/// Inserts an element onto the free list (if it isn't past the high
/// water mark).
virtual void add (T *element) = 0;
+
/// Takes a element off the freelist and returns it. It creates
/// <inc> new elements if the size is at or below the low water mark.
virtual T *remove (void) = 0;
+
/// Returns the current size of the free list.
virtual size_t size (void) = 0;
+
/// Resizes the free list to @a newsize.
virtual void resize (size_t newsize) = 0;
};
+
/**
* @class ACE_Locked_Free_List
*
@@ -71,50 +83,69 @@ public:
size_t lwm = ACE_DEFAULT_FREE_LIST_LWM,
size_t hwm = ACE_DEFAULT_FREE_LIST_HWM,
size_t inc = ACE_DEFAULT_FREE_LIST_INC);
+
/// Destructor - removes all the elements from the free_list.
virtual ~ACE_Locked_Free_List (void);
+
/// Inserts an element onto the free list (if it isn't past the high
/// water mark).
virtual void add (T *element);
+
/// Takes a element off the freelist and returns it. It creates
/// <inc> new elements if the size is at or below the low water mark.
virtual T *remove (void);
+
/// Returns the current size of the free list.
virtual size_t size (void);
+
/// Resizes the free list to @a newsize.
virtual void resize (size_t newsize);
+
protected:
/// Allocates @a n extra nodes for the freelist.
virtual void alloc (size_t n);
+
/// Removes and frees @a n nodes from the freelist.
virtual void dealloc (size_t n);
+
/// Free list operation mode, either ACE_FREE_LIST_WITH_POOL or
/// ACE_PURE_FREE_LIST.
int mode_;
+
/// Pointer to the first node in the freelist.
T *free_list_;
+
/// Low water mark.
size_t lwm_;
+
/// High water mark.
size_t hwm_;
+
/// Increment value.
size_t inc_;
+
/// Keeps track of the size of the list.
size_t size_;
+
/// Synchronization variable for ACE_Timer_Queue.
ACE_LOCK mutex_;
+
private:
// = Don't allow these operations for now.
ACE_UNIMPLEMENTED_FUNC (ACE_Locked_Free_List (const ACE_Locked_Free_List<T, ACE_LOCK> &))
ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Locked_Free_List<T, ACE_LOCK> &))
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Free_List.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Free_List.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
#endif /* ACE_FREE_LIST_H */
diff --git a/dep/ACE_wrappers/ace/Functor.cpp b/dep/ACE_wrappers/ace/Functor.cpp
index e707388f9af..618adcf5a61 100644
--- a/dep/ACE_wrappers/ace/Functor.cpp
+++ b/dep/ACE_wrappers/ace/Functor.cpp
@@ -24,15 +24,21 @@
*/
//=============================================================================
+
#include "ace/Functor_T.h"
#include "ace/Functor.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Functor.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace, Functor, "$Id: Functor.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_Command_Base::~ACE_Command_Base (void)
{
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Functor.h b/dep/ACE_wrappers/ace/Functor.h
index ba0a37c0281..d8f393c68b6 100644
--- a/dep/ACE_wrappers/ace/Functor.h
+++ b/dep/ACE_wrappers/ace/Functor.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file Functor.h
@@ -26,19 +27,26 @@
*/
//==========================================================================
+
#ifndef ACE_FUNCTOR_H
#define ACE_FUNCTOR_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include /**/ "ace/ACE_export.h"
#include "ace/Basic_Types.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
//////////////////////////////////////////////////////////////
// GOF Command Pattern Classes and Template Specializations //
//////////////////////////////////////////////////////////////
+
/**
* @class ACE_Command_Base
*
@@ -55,8 +63,10 @@ public:
// = Initialization and termination methods.
/// Default constructor.
ACE_Command_Base (void);
+
/// Virtual destructor.
virtual ~ACE_Command_Base (void);
+
/**
* Invokes the method encapsulated by the command, passing along the
* passed argument (if any). Users of classes derived from this
@@ -66,15 +76,18 @@ public:
*/
virtual int execute (void *arg = 0) = 0;
};
+
////////////////////////////////////////////////////////////
// STL-style Functor Classes and Template Specializations //
////////////////////////////////////////////////////////////
+
// Forward declaration since we are going to specialize that template
// here. The template itself requires this file so every user of the
// template should also see the specialization.
template <class TYPE> class ACE_Hash;
template <class TYPE> class ACE_Equal_To;
template <class TYPE> class ACE_Less_Than;
+
/**
* @class ACE_Hash<char>
*
@@ -87,6 +100,7 @@ public:
/// Simply returns t
unsigned long operator () (char t) const;
};
+
/**
* @class ACE_Hash<signed char>
*
@@ -99,6 +113,7 @@ public:
/// Simply returns t
unsigned long operator () (signed char t) const;
};
+
/**
* @class ACE_Hash<unsigned char>
*
@@ -111,8 +126,10 @@ public:
/// Simply returns t
unsigned long operator () (unsigned char t) const;
};
+
#if 0
// @@ ADD HASHES FOR ACE TYPES
+
/**
* @class ACE_Hash<ACE_INT16>
*
@@ -125,6 +142,7 @@ public:
/// Simply returns t
unsigned long operator () (ACE_INT16 t) const;
};
+
/**
* @class ACE_Hash<ACE_UINT16>
*
@@ -137,6 +155,7 @@ public:
/// Simply returns t
unsigned long operator () (ACE_UINT16 t) const;
};
+
/**
* @class ACE_Hash<ACE_INT32>
*
@@ -149,6 +168,7 @@ public:
/// Simply returns t
unsigned long operator () (ACE_INT32 t) const;
};
+
/**
* @class ACE_Hash<ACE_UINT32>
*
@@ -161,6 +181,7 @@ public:
/// Simply returns t
unsigned long operator () (ACE_UINT32 t) const;
};
+
/**
* @class ACE_Hash<ACE_UINT64>
*
@@ -173,8 +194,10 @@ public:
/// Simply returns t
unsigned long operator () (ACE_UINT64 t) const;
};
+
// @@ DONE ADDING HASHES FOR ACE TYPES
#endif
+
/**
* @class ACE_Hash<short>
*
@@ -187,6 +210,7 @@ public:
/// Simply returns t
unsigned long operator () (short t) const;
};
+
/**
* @class ACE_Hash<unsigned short>
*
@@ -199,6 +223,7 @@ public:
/// Simply returns t
unsigned long operator () (unsigned short t) const;
};
+
/**
* @class ACE_Hash<int>
*
@@ -211,6 +236,7 @@ public:
/// Simply returns t
unsigned long operator () (int t) const;
};
+
/**
* @class ACE_Hash<unsigned int>
*
@@ -223,6 +249,7 @@ public:
/// Simply returns t
unsigned long operator () (unsigned int t) const;
};
+
/**
* @class ACE_Hash<long>
*
@@ -235,6 +262,7 @@ public:
/// Simply returns t
unsigned long operator () (long t) const;
};
+
/**
* @class ACE_Hash<unsigned long>
*
@@ -247,6 +275,7 @@ public:
/// Simply returns t
unsigned long operator () (unsigned long t) const;
};
+
#if !defined (ACE_LACKS_LONGLONG_T) && (ACE_SIZEOF_LONG < 8)
/**
* @class ACE_Hash<ACE_INT64>
@@ -261,6 +290,7 @@ public:
unsigned long operator () (ACE_INT64 t) const;
};
#endif /* !ACE_LACKS_LONGLONG_T && ACE_SIZEOF_LONG < 8 */
+
// We can do this even if ACE_LACKS_UNSIGNEDLONGLONG_T because there's an
// emulation for it in ACE_U_LongLong.
#if (ACE_SIZEOF_LONG < 8)
@@ -277,6 +307,7 @@ public:
unsigned long operator () (const ACE_UINT64 &t) const;
};
#endif /* ACE_SIZEOF_LONG < 8 */
+
/**
* @class ACE_Hash<const char *>
*
@@ -289,6 +320,7 @@ public:
/// Calls ACE::hash_pjw
unsigned long operator () (const char *t) const;
};
+
/**
* @class ACE_Hash<char *>
*
@@ -301,6 +333,7 @@ public:
/// Calls ACE::hash_pjw
unsigned long operator () (const char *t) const;
};
+
/**
* @class ACE_Hash<void *>
*
@@ -312,6 +345,7 @@ class ACE_Export ACE_Hash<void *>
public:
unsigned long operator () (const void *) const;
};
+
/**
* @class ACE_Equal_To<const char *>
*
@@ -325,6 +359,7 @@ public:
int operator () (const char *lhs,
const char *rhs) const;
};
+
/**
* @class ACE_Equal_To<char *>
*
@@ -339,6 +374,7 @@ public:
int operator () (const char *lhs,
const char *rhs) const;
};
+
/**
* @class ACE_Equal_To<ACE_UINT16>
*
@@ -353,6 +389,7 @@ public:
int operator () (const ACE_UINT16 lhs,
const ACE_UINT16 rhs) const;
};
+
/**
* @class ACE_Equal_To<ACE_INT16>
*
@@ -367,6 +404,7 @@ public:
int operator () (const ACE_INT16 lhs,
const ACE_INT16 rhs) const;
};
+
/**
* @class ACE_Equal_To<ACE_UINT32>
*
@@ -381,6 +419,7 @@ public:
int operator () (const ACE_UINT32 lhs,
const ACE_UINT32 rhs) const;
};
+
/**
* @class ACE_Equal_To<ACE_INT32>
*
@@ -395,6 +434,7 @@ public:
int operator () (const ACE_INT32 lhs,
const ACE_INT32 rhs) const;
};
+
/**
* @class ACE_Equal_To<ACE_UINT64>
*
@@ -409,6 +449,7 @@ public:
int operator () (const ACE_UINT64 lhs,
const ACE_UINT64 rhs) const;
};
+
/**
* @class ACE_Less_Than<const char*>
*
@@ -423,6 +464,7 @@ public:
int operator () (const char *lhs,
const char *rhs) const;
};
+
/**
* @class ACE_Less_Than<char *>
*
@@ -437,7 +479,9 @@ public:
int operator () (const char *lhs,
const char *rhs) const;
};
+
#if defined (ACE_HAS_WCHAR)
+
# if ! defined (ACE_LACKS_NATIVE_WCHAR_T)
/**
* @class ACE_Hash<wchar_t>
@@ -464,6 +508,7 @@ public:
/// Calls ACE::hash_pjw
unsigned long operator () (const wchar_t *t) const;
};
+
/**
* @class ACE_Hash<wchar_t *>
*
@@ -476,6 +521,7 @@ public:
/// Calls ACE::hash_pjw
unsigned long operator () (const wchar_t *t) const;
};
+
/**
* @class ACE_Equal_To<const wchar_t *>
*
@@ -489,6 +535,7 @@ public:
int operator () (const wchar_t *lhs,
const wchar_t *rhs) const;
};
+
/**
* @class ACE_Equal_To<wchar_t *>
*
@@ -503,6 +550,7 @@ public:
int operator () (const wchar_t *lhs,
const wchar_t *rhs) const;
};
+
/**
* @class ACE_Less_Than<const wchar_t *>
*
@@ -517,6 +565,7 @@ public:
int operator () (const wchar_t *lhs,
const wchar_t *rhs) const;
};
+
/**
* @class ACE_Less_Than<wchar_t *>
*
@@ -531,11 +580,15 @@ public:
int operator () (const wchar_t *lhs,
const wchar_t *rhs) const;
};
+
#endif // ACE_HAS_WCHAR
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Functor.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_FUNCTOR_H */
diff --git a/dep/ACE_wrappers/ace/Functor.inl b/dep/ACE_wrappers/ace/Functor.inl
index 48e4875089b..30e539459a8 100644
--- a/dep/ACE_wrappers/ace/Functor.inl
+++ b/dep/ACE_wrappers/ace/Functor.inl
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Functor.inl
@@ -23,25 +24,33 @@
*/
//=============================================================================
+
#include "ace/ACE.h"
#include "ace/OS_NS_string.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
//////////////////////////////////////////////////////////////
// GOF Command Pattern Classes and Template Specializations //
//////////////////////////////////////////////////////////////
+
// Default constructor.
+
ACE_INLINE
ACE_Command_Base::ACE_Command_Base (void)
{
}
+
////////////////////////////////////////////////////////////
// STL-style Functor Classes and Template Specializations //
////////////////////////////////////////////////////////////
+
ACE_INLINE unsigned long
ACE_Hash<char>::operator () (char t) const
{
return t;
}
+
#if defined (ACE_HAS_WCHAR) && ! defined (ACE_LACKS_NATIVE_WCHAR_T)
ACE_INLINE unsigned long
ACE_Hash<wchar_t>::operator () (wchar_t t) const
@@ -49,37 +58,44 @@ ACE_Hash<wchar_t>::operator () (wchar_t t) const
return t;
}
#endif /* ACE_HAS_WCHAR && ! ACE_LACKS_NATIVE_WCHAR_T */
+
ACE_INLINE unsigned long
ACE_Hash<signed char>::operator () (signed char t) const
{
return t;
}
+
ACE_INLINE unsigned long
ACE_Hash<unsigned char>::operator () (unsigned char t) const
{
return t;
}
+
#if 0
ACE_INLINE unsigned long
ACE_Hash<ACE_INT16>::operator () (ACE_INT16 t) const
{
return t;
}
+
ACE_INLINE unsigned long
ACE_Hash<ACE_UINT16>::operator () (ACE_UINT16 t) const
{
return t;
}
+
ACE_INLINE unsigned long
ACE_Hash<ACE_INT32>::operator () (ACE_INT32 t) const
{
return static_cast<unsigned long> (t);
}
+
ACE_INLINE unsigned long
ACE_Hash<ACE_UINT32>::operator () (ACE_UINT32 t) const
{
return t;
}
+
ACE_INLINE unsigned long
ACE_Hash<ACE_UINT64>::operator () (ACE_UINT64 t) const
{
@@ -90,36 +106,43 @@ ACE_Hash<ACE_UINT64>::operator () (ACE_UINT64 t) const
#endif /* ACE_SIZEOF_LONG */
}
#endif
+
ACE_INLINE unsigned long
ACE_Hash<short>::operator () (short t) const
{
return static_cast<unsigned long> (t);
}
+
ACE_INLINE unsigned long
ACE_Hash<unsigned short>::operator () (unsigned short t) const
{
return static_cast<unsigned long> (t);
}
+
ACE_INLINE unsigned long
ACE_Hash<int>::operator () (int t) const
{
return static_cast<unsigned long> (t);
}
+
ACE_INLINE unsigned long
ACE_Hash<unsigned int>::operator () (unsigned int t) const
{
return static_cast<unsigned long> (t);
}
+
ACE_INLINE unsigned long
ACE_Hash<long>::operator () (long t) const
{
return static_cast<unsigned long> (t);
}
+
ACE_INLINE unsigned long
ACE_Hash<unsigned long>::operator () (unsigned long t) const
{
return t;
}
+
// This #if needs to match the one in Functor.h
#if !defined (ACE_LACKS_LONGLONG_T) && (ACE_SIZEOF_LONG < 8)
ACE_INLINE unsigned long
@@ -128,6 +151,7 @@ ACE_Hash<ACE_INT64>::operator () (ACE_INT64 t) const
return static_cast<unsigned long> (t);
}
#endif /* !ACE_LACKS_LONGLONG_T && ACE_SIZEOF_LONG < 8 */
+
#if (ACE_SIZEOF_LONG < 8)
ACE_INLINE unsigned long
ACE_Hash<ACE_UINT64>::operator () (const ACE_UINT64 &t) const
@@ -139,101 +163,122 @@ ACE_Hash<ACE_UINT64>::operator () (const ACE_UINT64 &t) const
#endif /* ACE_SIZEOF_LONG */
}
#endif /* !ACE_LACKS_UNSIGNEDLONGLONG_T */
+
ACE_INLINE unsigned long
ACE_Hash<const char *>::operator () (const char *t) const
{
return ACE::hash_pjw (t);
}
+
ACE_INLINE unsigned long
ACE_Hash<char *>::operator () (const char *t) const
{
return ACE::hash_pjw (t);
}
+
ACE_INLINE unsigned long
ACE_Hash<void *>::operator () (const void *t) const
{
return static_cast<unsigned long> (reinterpret_cast<uintptr_t> (t));
}
+
/***********************************************************************/
ACE_INLINE int
ACE_Equal_To<const char *>::operator () (const char *lhs, const char *rhs) const
{
return !ACE_OS::strcmp (lhs, rhs);
}
+
ACE_INLINE int
ACE_Equal_To<char *>::operator () (const char *lhs, const char *rhs) const
{
return !ACE_OS::strcmp (lhs, rhs);
}
+
ACE_INLINE int
ACE_Equal_To<ACE_UINT16>::operator () (const ACE_UINT16 lhs, const ACE_UINT16 rhs) const
{
return (lhs == rhs);
}
+
ACE_INLINE int
ACE_Equal_To<ACE_INT16>::operator () (const ACE_INT16 lhs, const ACE_INT16 rhs) const
{
return (lhs == rhs);
}
+
ACE_INLINE int
ACE_Equal_To<ACE_UINT32>::operator () (const ACE_UINT32 lhs, const ACE_UINT32 rhs) const
{
return (lhs == rhs);
}
+
ACE_INLINE int
ACE_Equal_To<ACE_INT32>::operator () (const ACE_INT32 lhs, const ACE_INT32 rhs) const
{
return (lhs == rhs);
}
+
ACE_INLINE int
ACE_Equal_To<ACE_UINT64>::operator () (const ACE_UINT64 lhs, const ACE_UINT64 rhs) const
{
return (lhs == rhs);
}
+
/****************************************************************************/
ACE_INLINE int
ACE_Less_Than<const char *>::operator () (const char *lhs, const char *rhs) const
{
return (ACE_OS::strcmp (lhs, rhs) < 0) ? 1 : 0;
}
+
ACE_INLINE int
ACE_Less_Than<char *>::operator () (const char *lhs, const char *rhs) const
{
return (ACE_OS::strcmp (lhs, rhs) < 0) ? 1 : 0;
}
+
#if defined (ACE_HAS_WCHAR)
+
ACE_INLINE unsigned long
ACE_Hash<const wchar_t *>::operator () (const wchar_t *t) const
{
return ACE::hash_pjw (t);
}
+
ACE_INLINE unsigned long
ACE_Hash<wchar_t *>::operator () (const wchar_t *t) const
{
return ACE::hash_pjw (t);
}
+
ACE_INLINE int
ACE_Equal_To<const wchar_t *>::operator () (const wchar_t *lhs,
const wchar_t *rhs) const
{
return !ACE_OS::strcmp (lhs, rhs);
}
+
ACE_INLINE int
ACE_Equal_To<wchar_t *>::operator () (const wchar_t *lhs,
const wchar_t *rhs) const
{
return !ACE_OS::strcmp (lhs, rhs);
}
+
ACE_INLINE int
ACE_Less_Than<const wchar_t *>::operator () (const wchar_t *lhs, const wchar_t *rhs) const
{
return (ACE_OS::strcmp (lhs, rhs) < 0) ? 1 : 0;
}
+
ACE_INLINE int
ACE_Less_Than<wchar_t *>::operator () (const wchar_t *lhs, const wchar_t *rhs) const
{
return (ACE_OS::strcmp (lhs, rhs) < 0) ? 1 : 0;
}
+
#endif // ACE_HAS_WCHAR
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Functor_String.cpp b/dep/ACE_wrappers/ace/Functor_String.cpp
index 6a518a556a6..798c9d26286 100644
--- a/dep/ACE_wrappers/ace/Functor_String.cpp
+++ b/dep/ACE_wrappers/ace/Functor_String.cpp
@@ -1,6 +1,8 @@
#include "ace/Functor_String.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Functor_String.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace, Functor, "$Id: Functor_String.cpp 80826 2008-03-04 14:51:23Z wotte $")
diff --git a/dep/ACE_wrappers/ace/Functor_String.h b/dep/ACE_wrappers/ace/Functor_String.h
index 51a41cd1d7d..5fabef1f625 100644
--- a/dep/ACE_wrappers/ace/Functor_String.h
+++ b/dep/ACE_wrappers/ace/Functor_String.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file Functor_String.h
@@ -15,22 +16,29 @@
#ifndef ACE_FUNCTOR_STRING_H
#define ACE_FUNCTOR_STRING_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include /**/ "ace/ACE_export.h"
#include "ace/SStringfwd.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
////////////////////////////////////////////////////////////
// STL-style Functor Classes and Template Specializations //
////////////////////////////////////////////////////////////
+
// Forward declaration since we are going to specialize that template
// here. The template itself requires this file so every user of the
// template should also see the specialization.
template <class TYPE> class ACE_Hash;
template <class TYPE> class ACE_Equal_To;
template <class TYPE> class ACE_Less_Than;
+
/**
* @class ACE_Equal_To<ACE_CString>
*
@@ -45,6 +53,7 @@ public:
const ACE_CString &rhs) const;
};
+
/**
* @class ACE_Hash<ACE_CString>
*
@@ -58,6 +67,7 @@ public:
unsigned long operator () (const ACE_CString &lhs) const;
};
+
/**
* @class ACE_Less_Than<ACE_CString>
*
@@ -73,7 +83,9 @@ public:
const ACE_CString &rhs) const;
};
+
#if defined (ACE_USES_WCHAR)
+
/**
* @class ACE_Equal_To<ACE_WString>
*
@@ -88,6 +100,7 @@ public:
const ACE_WString &rhs) const;
};
+
/**
* @class ACE_Hash<ACE_WString>
*
@@ -100,6 +113,7 @@ public:
/// Calls ACE::hash_pjw
unsigned long operator () (const ACE_WString &lhs) const;
};
+
/**
* @class ACE_Less_Than<ACE_WString>
*
@@ -114,11 +128,15 @@ public:
int operator () (const ACE_WString &lhs,
const ACE_WString &rhs) const;
};
+
#endif /*ACE_USES_WCHAR*/
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Functor_String.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /*ACE_FUNCTOR_STRING_H*/
diff --git a/dep/ACE_wrappers/ace/Functor_String.inl b/dep/ACE_wrappers/ace/Functor_String.inl
index 00dc758fce0..bdac96386f8 100644
--- a/dep/ACE_wrappers/ace/Functor_String.inl
+++ b/dep/ACE_wrappers/ace/Functor_String.inl
@@ -1,21 +1,26 @@
// -*- C++ -*-
//
// $Id: Functor_String.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/ACE.h"
#include "ace/String_Base.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE unsigned long
ACE_Hash<ACE_CString>::operator () (const ACE_CString &t) const
{
return t.hash ();
}
+
ACE_INLINE int
ACE_Equal_To<ACE_CString>::operator () (const ACE_CString &lhs,
const ACE_CString &rhs) const
{
return lhs == rhs;
}
+
ACE_INLINE int
ACE_Less_Than<ACE_CString>::operator () (const ACE_CString &lhs,
const ACE_CString &rhs) const
@@ -23,6 +28,7 @@ ACE_Less_Than<ACE_CString>::operator () (const ACE_CString &lhs,
return (lhs < rhs);
}
+
#if defined (ACE_USES_WCHAR)
ACE_INLINE unsigned long
ACE_Hash<ACE_WString>::operator () (const ACE_WString &t) const
@@ -30,17 +36,21 @@ ACE_Hash<ACE_WString>::operator () (const ACE_WString &t) const
return t.hash ();
}
+
ACE_INLINE int
ACE_Equal_To<ACE_WString>::operator () (const ACE_WString &lhs,
const ACE_WString &rhs) const
{
return lhs == rhs;
}
+
ACE_INLINE int
ACE_Less_Than<ACE_WString>::operator () (const ACE_WString &lhs,
const ACE_WString &rhs) const
{
return (lhs < rhs);
}
+
#endif /*ACE_USES_WCHAR*/
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Functor_T.h b/dep/ACE_wrappers/ace/Functor_T.h
index dad8bbe5582..4a3a621366c 100644
--- a/dep/ACE_wrappers/ace/Functor_T.h
+++ b/dep/ACE_wrappers/ace/Functor_T.h
@@ -1,4 +1,5 @@
/* -*- C++ -*- */
+
//=============================================================================
/**
* @file Functor_T.h
@@ -24,18 +25,25 @@
*/
//=============================================================================
+
#ifndef ACE_FUNCTOR_T_H
#define ACE_FUNCTOR_T_H
#include /**/ "ace/pre.h"
+
#include "ace/Functor.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Functor_String.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
///////////////////////////////////
// GOF Command Pattern Templates //
///////////////////////////////////
+
/**
* @class ACE_Command_Callback
*
@@ -55,19 +63,25 @@ public:
/// Constructor: sets the <receiver_> of the Command to recvr, and the
/// <action_> of the Command to <action>.
ACE_Command_Callback (RECEIVER &recvr, ACTION action);
+
/// Virtual destructor.
virtual ~ACE_Command_Callback (void);
+
/// Invokes the method <action_> from the object <receiver_>.
virtual int execute (void *arg = 0);
+
private:
/// Object where the method resides.
RECEIVER &receiver_;
+
/// Method that is going to be invoked.
ACTION action_;
};
+
/////////////////////////////////
// STL-style Functor Templates //
/////////////////////////////////
+
/**
* @class ACE_Hash
*
@@ -80,6 +94,7 @@ public:
/// Simply calls t.hash ()
unsigned long operator () (const TYPE &t) const;
};
+
/**
* @class ACE_Pointer_Hash
*
@@ -92,6 +107,7 @@ public:
/// Simply returns t.
unsigned long operator () (TYPE t) const;
};
+
/**
* @class ACE_Equal_To
*
@@ -106,6 +122,7 @@ public:
bool operator () (const TYPE &lhs,
const TYPE &rhs) const;
};
+
/**
* @class ACE_Less_Than
*
@@ -121,17 +138,22 @@ public:
bool operator () (const TYPE &lhs,
const TYPE &rhs) const;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Functor_T.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Functor_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Functor_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
#endif /* ACE_FUNCTOR_T_H */
diff --git a/dep/ACE_wrappers/ace/Functor_T.inl b/dep/ACE_wrappers/ace/Functor_T.inl
index bcc1556fd9c..35cfed5b798 100644
--- a/dep/ACE_wrappers/ace/Functor_T.inl
+++ b/dep/ACE_wrappers/ace/Functor_T.inl
@@ -1,12 +1,15 @@
// -*- C++ -*-
//
// $Id: Functor_T.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template <class TYPE> ACE_INLINE unsigned long
ACE_Hash<TYPE>::operator () (const TYPE &t) const
{
return t.hash ();
}
+
template <class TYPE> ACE_INLINE unsigned long
ACE_Pointer_Hash<TYPE>::operator () (TYPE t) const
{
@@ -21,16 +24,19 @@ ACE_Pointer_Hash<TYPE>::operator () (TYPE t) const
# pragma warning(pop)
#endif /* ACE_WIN64 */
}
+
template <class TYPE> ACE_INLINE bool
ACE_Equal_To<TYPE>::operator () (const TYPE &lhs,
const TYPE &rhs) const
{
return lhs == rhs;
}
+
template <class TYPE> ACE_INLINE bool
ACE_Less_Than<TYPE>::operator () (const TYPE &lhs,
const TYPE &rhs) const
{
return lhs < rhs;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Future.h b/dep/ACE_wrappers/ace/Future.h
index 72de047756e..d86efd5a485 100644
--- a/dep/ACE_wrappers/ace/Future.h
+++ b/dep/ACE_wrappers/ace/Future.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Future.h
@@ -11,23 +12,32 @@
* @author John Tucker <johnny_tucker@yahoo.com>
*/
//=============================================================================
+
#ifndef ACE_FUTURE_H
#define ACE_FUTURE_H
+
#include /**/ "ace/pre.h"
+
#include "ace/Unbounded_Set.h"
#include "ace/Strategies_T.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_THREADS)
+
#include "ace/Recursive_Thread_Mutex.h"
#include "ace/Condition_Recursive_Thread_Mutex.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward decl.
template <class T> class ACE_Future_Holder;
template <class T> class ACE_Future_Observer;
template <class T> class ACE_Future_Rep;
template <class T> class ACE_Future;
+
/**
* @class ACE_Future_Holder
*
@@ -39,12 +49,16 @@ class ACE_Future_Holder
public:
ACE_Future_Holder (const ACE_Future<T> &future);
~ACE_Future_Holder (void);
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
ACE_Future<T> item_;
+
protected:
ACE_Future_Holder (void);
};
+
/**
* @class ACE_Future_Observer
*
@@ -61,15 +75,19 @@ class ACE_Future_Observer
public:
/// Destructor
virtual ~ACE_Future_Observer (void);
+
/// Called by the ACE_Future in which we are subscribed to when
/// its value is written to.
virtual void update (const ACE_Future<T> &future) = 0;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
protected:
+
/// Constructor
ACE_Future_Observer (void);
};
+
/**
* @class ACE_Future_Rep
*
@@ -87,6 +105,7 @@ class ACE_Future_Rep
{
private:
friend class ACE_Future<T>;
+
/**
* Set the result value. The specified <caller> represents the
* future that invoked this <set> method, which is used to notify
@@ -96,10 +115,12 @@ private:
*/
int set (const T &r,
ACE_Future<T> &caller);
+
/// Wait up to @a tv time to get the @a value. Note that @a tv must be
/// specified in absolute time rather than relative time.
int get (T &value,
ACE_Time_Value *tv) const;
+
/**
* Attaches the specified observer to a subject (i.e., the ACE_Future_Rep).
* The update method of the specified subject will be invoked with a copy of
@@ -110,6 +131,7 @@ private:
*/
int attach (ACE_Future_Observer<T> *observer,
ACE_Future<T> &caller);
+
/**
* Detaches the specified observer from a subject (i.e., the ACE_Future_Rep).
* The update method of the specified subject will not be invoked when the
@@ -120,6 +142,7 @@ private:
* observer was not attached in the first place.
*/
int detach (ACE_Future_Observer<T> *observer);
+
/**
* Type conversion. will block forever until the result is
* available. Note that this method is going away in a subsequent
@@ -130,18 +153,25 @@ private:
* timeouts.
*/
operator T ();
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
// = Encapsulate reference count and object lifetime of instances.
+
// These methods must go after the others to work around a bug with
// Borland's C++ Builder...
+
/// Allocate a new ACE_Future_Rep<T> instance, returning NULL if it
/// cannot be created.
static ACE_Future_Rep<T> *internal_create (void);
+
/// Create a ACE_Future_Rep<T> and initialize the reference count.
static ACE_Future_Rep<T> *create (void);
+
/**
* Increase the reference count and return argument. Uses the
* attribute "value_ready_mutex_" to synchronize reference count
@@ -150,6 +180,7 @@ private:
* Precondition (rep != 0).
*/
static ACE_Future_Rep<T> *attach (ACE_Future_Rep<T> *&rep);
+
/**
* Decreases the reference count and deletes rep if there are no
* more references to rep.
@@ -157,6 +188,7 @@ private:
* Precondition (rep != 0)
*/
static void detach (ACE_Future_Rep<T> *&rep);
+
/**
* Decreases the rep's reference count and deletes rep if there
* are no more references to rep. Then assigns new_rep to rep.
@@ -164,24 +196,37 @@ private:
* Precondition (rep != 0 && new_rep != 0)
*/
static void assign (ACE_Future_Rep<T> *&rep, ACE_Future_Rep<T> *new_rep);
+
/// Is result available?
int ready (void) const;
+
/// Pointer to the result.
T *value_;
+
/// Reference count.
int ref_count_;
+
typedef ACE_Future_Observer<T> OBSERVER;
+
typedef ACE_Unbounded_Set<OBSERVER *> OBSERVER_COLLECTION;
+
/// Keep a list of ACE_Future_Observers unread by client's reader thread.
OBSERVER_COLLECTION observer_collection_;
+
// = Condition variable and mutex that protect the <value_>.
mutable ACE_Recursive_Thread_Mutex value_ready_mutex_;
mutable ACE_Condition_Recursive_Thread_Mutex value_ready_;
+
private:
+
ACE_Future_Rep (void);
+
protected:
+
~ACE_Future_Rep (void);
+
};
+
/**
* @class ACE_Future
*
@@ -196,20 +241,26 @@ public:
// = Initialization and termination methods.
/// Constructor.
ACE_Future (void);
+
/// Copy constructor binds @a this and @a r to the same
/// ACE_Future_Rep. An ACE_Future_Rep is created if necessary.
ACE_Future (const ACE_Future<T> &r);
+
/// Constructor that initialises an ACE_Future to point to the
/// result @a r immediately.
ACE_Future (const T &r);
+
/// Destructor.
~ACE_Future (void);
+
/// Assignment operator that binds @a this and @a r to the same
/// ACE_Future_Rep. An ACE_Future_Rep is created if necessary.
void operator = (const ACE_Future<T> &r);
+
/// Cancel an ACE_Future and assign the value @a r. It is used if a
/// client does not want to wait for the value to be produced.
int cancel (const T &r);
+
/**
* Cancel an ACE_Future. Put the future into its initial
* state. Returns 0 on succes and -1 on failure. It is now possible
@@ -217,6 +268,7 @@ public:
* is now bound to a new ACE_Future_Rep.
*/
int cancel (void);
+
/**
* Equality operator that returns @c true if both ACE_Future objects
* point to the same ACE_Future_Rep object.
@@ -225,8 +277,10 @@ public:
* instantiated and not used yet.
*/
bool operator == (const ACE_Future<T> &r) const;
+
/// Inequality operator, which is the opposite of equality.
bool operator != (const ACE_Future<T> &r) const;
+
/**
* Make the result available. Is used by the server thread to give
* the result to all waiting clients. Returns 0 for success, -1 on failure.
@@ -236,6 +290,7 @@ public:
* effect.
*/
int set (const T &r);
+
/**
* Wait to get the object's value.
*
@@ -250,6 +305,7 @@ public:
*/
int get (T &value,
ACE_Time_Value *tv = 0) const;
+
/**
* @deprecated Note that this method is going away in a subsequent
* release since it doesn't distinguish between failure
@@ -261,8 +317,10 @@ public:
* and also permits timeouts.
*/
operator T ();
+
/// Check if the result is available.
int ready (void) const;
+
/**
* Attaches the specified observer to a subject (this ACE_Future).
* The update method of the specified subject will be invoked with a copy of
@@ -277,6 +335,7 @@ public:
* @retval -1 Error; check ACE_OS::last_error() for an error code.
*/
int attach (ACE_Future_Observer<T> *observer);
+
/**
* Detaches the specified observer from a subject (this ACE_Future).
* The update method of the specified subject will not be invoked when the
@@ -289,30 +348,41 @@ public:
* to calling this method.
*/
int detach (ACE_Future_Observer<T> *observer);
+
/// Dump the state of an object.
void dump (void) const;
+
/**
* Get the underlying ACE_Future_Rep pointer. Note that this method should
* rarely, if ever, be used and that modifying the underlying
* ACE_Future_Rep should be done with extreme caution.
*/
ACE_Future_Rep<T> *get_rep (void);
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
+
// the ACE_Future_Rep
/// Protect operations on the <Future>.
typedef ACE_Future_Rep<T> FUTURE_REP;
FUTURE_REP *future_rep_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Future.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Future.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#endif /* ACE_HAS_THREADS */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_FUTURE_H */
diff --git a/dep/ACE_wrappers/ace/Future_Set.h b/dep/ACE_wrappers/ace/Future_Set.h
index 76c31fd41aa..b41fc673986 100644
--- a/dep/ACE_wrappers/ace/Future_Set.h
+++ b/dep/ACE_wrappers/ace/Future_Set.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Future_Set.h
@@ -8,19 +9,25 @@
* @author John Tucker <jtucker@infoglide.com>
*/
//=============================================================================
+
#ifndef ACE_FUTURE_SET_H
#define ACE_FUTURE_SET_H
#include /**/ "ace/pre.h"
+
#include "ace/Thread.h"
#include "ace/Message_Queue.h"
#include "ace/Future.h"
#include "ace/Hash_Map_Manager_T.h"
#include "ace/Null_Mutex.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
#pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_THREADS)
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Future_Set
*
@@ -38,10 +45,13 @@ class ACE_Future_Set : public ACE_Future_Observer<T>
{
public:
// = Initialization and termination methods.
+
/// Constructor.
ACE_Future_Set (ACE_Message_Queue<ACE_SYNCH> *future_notification_queue_ = 0);
+
/// Destructor.
~ACE_Future_Set (void);
+
/**
* Return 1 if their are no ACE_Future objects left on its queue and
* 0 otherwise.
@@ -53,6 +63,7 @@ public:
* or when the ACE_Future_Set has not been assigned any subjects.
*/
int is_empty (void) const;
+
/**
* Enqueus the given ACE_Future into this objects queue when it is
* readable.
@@ -61,6 +72,7 @@ public:
* future is already inserted, and -1 if failures occur.
*/
int insert (ACE_Future<T> &future);
+
/**
* Wait up to @a tv time to get the @a value. Note that @a tv must be
* specified in absolute time rather than relative time.); get the
@@ -78,41 +90,57 @@ public:
*/
int next_readable (ACE_Future<T> &result,
ACE_Time_Value *tv = 0);
+
/// Called by the ACE_Future subject in which we are subscribed to
/// when its value is written to.
virtual void update (const ACE_Future<T> &future);
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
// = Disallow these operations.
ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Future_Set<T> &))
ACE_UNIMPLEMENTED_FUNC (ACE_Future_Set (const ACE_Future_Set<T> &))
+
typedef ACE_Future<T> FUTURE;
+
typedef ACE_Future_Rep<T> FUTURE_REP;
+
typedef ACE_Future_Holder<T> FUTURE_HOLDER;
+
typedef ACE_Pointer_Hash<FUTURE_REP *> FUTURE_REP_HASH;
+
typedef ACE_Equal_To<FUTURE_REP *> FUTURE_REP_COMPARE;
+
typedef ACE_Hash_Map_Manager_Ex<FUTURE_REP *,
FUTURE_HOLDER *,
FUTURE_REP_HASH,
FUTURE_REP_COMPARE,
ACE_Null_Mutex> FUTURE_HASH_MAP;
+
/// Map of <ACE_Futures>, subjects, which have not been written to by
/// client's writer thread.
FUTURE_HASH_MAP future_map_;
+
/// Message queue for notifying the reader thread of <ACE_Futures> which
/// have been written to by client's writer thread.
ACE_Message_Queue<ACE_SYNCH> *future_notification_queue_;
+
/// Keeps track of whether we need to delete the message queue.
bool delete_queue_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Future_Set.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Future_Set.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#endif /* ACE_HAS_THREADS */
#include /**/ "ace/post.h"
#endif /* ACE_FUTURE_SET_H */
diff --git a/dep/ACE_wrappers/ace/Get_Opt.cpp b/dep/ACE_wrappers/ace/Get_Opt.cpp
index 02b85b96abc..9725171701d 100644
--- a/dep/ACE_wrappers/ace/Get_Opt.cpp
+++ b/dep/ACE_wrappers/ace/Get_Opt.cpp
@@ -1,8 +1,11 @@
// $Id: Get_Opt.cpp 81840 2008-06-05 13:46:45Z sma $
+
#include "ace/Get_Opt.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Get_Opt.inl"
#endif /* __ACE_INLINE__ */
+
#include "ace/ACE.h"
#include "ace/Log_Msg.h"
#include "ace/SString.h"
@@ -10,9 +13,11 @@
#include "ace/OS_NS_string.h"
#include "ace/OS_NS_ctype.h"
#include "ace/OS_NS_stdlib.h"
+
ACE_RCSID (ace,
Get_Opt,
"$Id: Get_Opt.cpp 81840 2008-06-05 13:46:45Z sma $")
+
/*
* Copyright (c) 1987, 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -45,6 +50,7 @@ ACE_RCSID (ace,
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
+
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -80,8 +86,11 @@ ACE_RCSID (ace,
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_Get_Opt)
+
#ifdef ACE_USES_WCHAR
void ACE_Get_Opt::ACE_Get_Opt_Init (const ACE_TCHAR *optstring)
#else
@@ -110,8 +119,10 @@ ACE_Get_Opt::ACE_Get_Opt (int argc,
#endif
{
ACE_TRACE ("ACE_Get_Opt::ACE_Get_Opt");
+
ACE_NEW (this->optstring_, ACE_TString (optstring));
ACE_NEW (this->last_option_, ACE_TString (ACE_TEXT ("")));
+
// First check to see if POSIXLY_CORRECT was set.
// Win32 is the only platform capable of wide-char env var.
#if defined (ACE_WIN32)
@@ -121,6 +132,7 @@ ACE_Get_Opt::ACE_Get_Opt (int argc,
#endif
if (ACE_OS::getenv (env_check) != 0)
this->ordering_ = REQUIRE_ORDER;
+
// Now, check to see if any or the following were passed at
// the begining of optstring: '+' same as POSIXLY_CORRECT;
// '-' turns off POSIXLY_CORRECT; or ':' which signifies we
@@ -149,9 +161,11 @@ ACE_Get_Opt::ACE_Get_Opt (int argc,
}
}
}
+
ACE_Get_Opt::~ACE_Get_Opt (void)
{
ACE_TRACE ("ACE_Get_Opt::~ACE_Get_Opt");
+
size_t i = 0;
size_t size = this->long_opts_.size ();
ACE_Get_Opt_Long_Option *option = 0;
@@ -173,13 +187,16 @@ ACE_Get_Opt::~ACE_Get_Opt (void)
delete this->optstring_;
delete this->last_option_;
}
+
int
ACE_Get_Opt::nextchar_i (void)
{
ACE_TRACE ("ACE_Get_Opt::nextchar_i");
+
if (this->ordering_ == PERMUTE_ARGS)
if (this->permute () == EOF)
return EOF;
+
// Update scanning pointer.
if (this->optind >= this->argc_)
{
@@ -191,10 +208,12 @@ ACE_Get_Opt::nextchar_i (void)
|| this->nextchar_[1] == '\0')
{
// We didn't get an option.
+
if (this->ordering_ == REQUIRE_ORDER
|| this->ordering_ == PERMUTE_ARGS)
// If we permuted or require the options to be in order, we're done.
return EOF;
+
// It must be RETURN_IN_ORDER...
this->optarg = this->argv_[this->optind++];
this->nextchar_ = 0;
@@ -209,34 +228,42 @@ ACE_Get_Opt::nextchar_i (void)
this->nextchar_ = 0;
return EOF;
}
+
// If it's a long option, and we allow long options advance nextchar_.
if (*this->nextchar_ == '-' && this->long_opts_.size () != 0)
this->nextchar_++;
+
return 0;
}
+
int
ACE_Get_Opt::long_option_i (void)
{
ACE_TRACE ("ACE_Get_Opt::long_option_i");
+
ACE_Get_Opt_Long_Option *p;
ACE_TCHAR *s = this->nextchar_;
int hits = 0;
int exact = 0;
ACE_Get_Opt_Long_Option *pfound = 0;
int indfound = 0;
+
// Advance to the end of the long option name so we can use
// it to get the length for a string compare.
while (*s && *s != '=')
s++;
+
size_t len = s - this->nextchar_;
// set last_option_ to nextchar_, up to the '='.
this->last_option (ACE_TString (this->nextchar_, len));
+
size_t size = this->long_opts_.size ();
u_int option_index = 0;
for (option_index = 0; option_index < size ; option_index++)
{
p = this->long_opts_[option_index];
ACE_ASSERT (p);
+
if (!ACE_OS::strncmp (p->name_, this->nextchar_, len))
{
// Got at least a partial match.
@@ -251,6 +278,7 @@ ACE_Get_Opt::long_option_i (void)
}
}
}
+
if ((hits > 1) && !exact)
{
// Great, we found a match, but unfortunately we found more than
@@ -263,6 +291,7 @@ ACE_Get_Opt::long_option_i (void)
this->optind++;
return '?';
}
+
if (pfound != 0)
{
// Okay, we found a good one (either a single hit or an exact match).
@@ -334,20 +363,25 @@ ACE_Get_Opt::long_option_i (void)
}
return this->short_option_i ();
}
+
int
ACE_Get_Opt::short_option_i (void)
{
ACE_TRACE ("ACE_Get_Opt::short_option_i");
+
/* Look at and handle the next option-character. */
ACE_TCHAR opt = *this->nextchar_++;
// Set last_option_ to opt
this->last_option (opt);
+
ACE_TCHAR *oli = 0;
oli =
const_cast<ACE_TCHAR*> (ACE_OS::strchr (this->optstring_->c_str (), opt));
+
/* Increment `optind' when we start to process its last character. */
if (*this->nextchar_ == '\0')
++this->optind;
+
if (oli == 0 || opt == ':')
{
if (this->opterr)
@@ -406,19 +440,23 @@ ACE_Get_Opt::short_option_i (void)
}
return opt;
}
+
int
ACE_Get_Opt::operator () (void)
{
ACE_TRACE ("ACE_Get_Opt_Long::operator");
+
// First of all, make sure we reinitialize any pointers..
this->optarg = 0;
this->long_option_ = 0;
+
if (this->argv_ == 0)
{
// It can happen, e.g., on VxWorks.
this->optind = 0;
return -1;
}
+
// We check this because we can string short options together if the
// preceding one doesn't take an argument.
if (this->nextchar_ == 0 || *this->nextchar_ == '\0')
@@ -427,11 +465,14 @@ ACE_Get_Opt::operator () (void)
if (retval != 0)
return retval;
}
+
if (((this->argv_[this->optind][0] == '-')
&& (this->argv_[this->optind][1] == '-')) || this->long_only_)
return this->long_option_i ();
+
return this->short_option_i ();
}
+
int
ACE_Get_Opt::long_option (const ACE_TCHAR *name,
OPTION_ARG_MODE has_arg)
@@ -439,12 +480,14 @@ ACE_Get_Opt::long_option (const ACE_TCHAR *name,
ACE_TRACE ("ACE_Get_Opt::long_option (const ACE_TCHAR *name, OPTION_ARG_MODE has_arg)");
return this->long_option (name, 0, has_arg);
}
+
int
ACE_Get_Opt::long_option (const ACE_TCHAR *name,
int short_option,
OPTION_ARG_MODE has_arg)
{
ACE_TRACE ("ACE_Get_Opt::long_option (const ACE_TCHAR *name, int short_option, OPTION_ARG_MODE has_arg)");
+
// We only allow valid alpha-numeric characters as short options.
// If short_options is not a valid alpha-numeric, we can still return it
// when the long option is found, but won't allow the caller to pass it on
@@ -511,10 +554,13 @@ ACE_Get_Opt::long_option (const ACE_TCHAR *name,
*this->optstring_ += ACE_TEXT ("::");
}
}
+
ACE_Get_Opt_Long_Option *option =
new ACE_Get_Opt_Long_Option (name, has_arg, short_option);
+
if (!option)
return -1;
+
// Add to array
size_t size = this->long_opts_.size ();
if (this->long_opts_.size (size + 1) != 0
@@ -527,6 +573,7 @@ ACE_Get_Opt::long_option (const ACE_TCHAR *name,
}
return 0;
}
+
const ACE_TCHAR*
ACE_Get_Opt::long_option (void) const
{
@@ -535,21 +582,25 @@ ACE_Get_Opt::long_option (void) const
return this->long_option_->name_;
return 0;
}
+
const ACE_TCHAR*
ACE_Get_Opt::last_option (void) const
{
return this->last_option_->c_str ();
}
+
void
ACE_Get_Opt::last_option (const ACE_TString &last_option)
{
*this->last_option_ = last_option;
}
+
void
ACE_Get_Opt::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_Get_Opt::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n")
ACE_TEXT ("opstring_ = %s\n")
@@ -566,6 +617,7 @@ ACE_Get_Opt::dump (void) const
this->nextchar_,
this->optopt_,
this->ordering_));
+
// now loop through the
size_t size = this->long_opts_.size ();
for (u_int i = 0; i < size ; ++i)
@@ -581,19 +633,24 @@ ACE_Get_Opt::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
void
ACE_Get_Opt::permute_args (void)
{
ACE_TRACE ("ACE_Get_Opt::permute_args");
+
u_long cyclelen, i, j, ncycle, nnonopts, nopts;
u_long opt_end = this->optind;
int cstart, pos = 0;
ACE_TCHAR *swap = 0;
+
nnonopts = this->nonopt_end_ - this->nonopt_start_;
nopts = opt_end - this->nonopt_end_;
ncycle = ACE::gcd (nnonopts, nopts);
cyclelen = (opt_end - this->nonopt_start_) / ncycle;
+
this->optind = this->optind - nnonopts;
+
for (i = 0; i < ncycle; i++)
{
cstart = this->nonopt_end_ + i;
@@ -605,36 +662,46 @@ ACE_Get_Opt::permute_args (void)
else
pos += nopts;
swap = this->argv_[pos];
+
((ACE_TCHAR **)this->argv_)[pos] = argv_[cstart];
+
((ACE_TCHAR **)this->argv_)[cstart] = swap;
}
}
}
+
int
ACE_Get_Opt::permute (void)
{
ACE_TRACE ("ACE_Get_Opt::permute");
+
if (this->nonopt_start_ != this->nonopt_end_
&& this->nonopt_start_ != this->optind)
this->permute_args ();
+
this->nonopt_start_ = this->optind;
+
// Skip over args untill we find the next option.
while (this->optind < this->argc_
&& (this->argv_[this->optind][0] != '-'
|| this->argv_[this->optind][1] == '\0'))
this->optind++;
+
// Got an option, so mark this as the end of the non options.
this->nonopt_end_ = this->optind;
+
if (this->optind != this->argc_
&& ACE_OS::strcmp (this->argv_[this->optind],
ACE_TEXT ("--")) == 0)
{
// We found the marker for the end of the options.
++this->optind;
+
if (this->nonopt_start_ != this->nonopt_end_
&& this->nonopt_end_ != this->optind)
this->permute_args ();
}
+
if (this->optind == this->argc_)
{
if (this->nonopt_start_ != this->nonopt_end_)
@@ -643,11 +710,13 @@ ACE_Get_Opt::permute (void)
}
return 0;
}
+
const ACE_TCHAR *
ACE_Get_Opt::optstring (void) const
{
return this->optstring_->c_str ();
}
+
ACE_Get_Opt::ACE_Get_Opt_Long_Option::ACE_Get_Opt_Long_Option (
const ACE_TCHAR *name,
int has_arg,
@@ -656,9 +725,11 @@ ACE_Get_Opt::ACE_Get_Opt_Long_Option::ACE_Get_Opt_Long_Option (
has_arg_ (has_arg),
val_ (val)
{}
+
ACE_Get_Opt::ACE_Get_Opt_Long_Option::~ACE_Get_Opt_Long_Option (void)
{
delete [] this->name_;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Get_Opt.h b/dep/ACE_wrappers/ace/Get_Opt.h
index 70555e5530a..e00518954e6 100644
--- a/dep/ACE_wrappers/ace/Get_Opt.h
+++ b/dep/ACE_wrappers/ace/Get_Opt.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file Get_Opt.h
@@ -9,22 +10,29 @@
* @author Don Hinton <dhinton@gmx.net> (added long option support)
*/
//==========================================================================
+
#ifndef ACE_GET_OPT_H
#define ACE_GET_OPT_H
#include /**/ "ace/pre.h"
+
#include "ace/SStringfwd.h"
#include "ace/Containers.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#undef optind
#undef optarg
#undef opterr
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/*
* These definitions are for backward compatibility with previous versions.
* of ACE_Get_Opt.
*/
+
/**
* @class ACE_Get_Opt
*
@@ -32,6 +40,7 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
*
* This is a C++ wrapper for getopt(3c) and getopt_long(3c).
*/
+
class ACE_Export ACE_Get_Opt
{
public:
@@ -45,6 +54,7 @@ public:
* can continue processing the rest of the @a argv elements.
*/
REQUIRE_ORDER = 1,
+
/**
* PERMUTE_ARGS means the @a argv elements are reordered dynamically
* (permuted) so that all options appear first. When the elements are
@@ -54,6 +64,7 @@ public:
* element.
*/
PERMUTE_ARGS = 2,
+
/**
* RETURN_IN_ORDER means each @a argv element is processed in the
* order is it seen. If the element is not recognized as an option, '1'
@@ -61,18 +72,22 @@ public:
*/
RETURN_IN_ORDER = 3
};
+
/// Mutually exclusive option argument mode used by long options.
enum OPTION_ARG_MODE
{
/// Doesn't take an argument.
NO_ARG = 0,
+
/// Requires an argument, same as passing ":" after a short option
/// character in @a optstring.
ARG_REQUIRED = 1,
+
/// Argument is optional, same as passing "::" after a short
/// option character in @a optstring.
ARG_OPTIONAL = 2
};
+
/**
* Constructor initializes the command line to be parsed. All information
* for parsing must be supplied to this constructor.
@@ -162,6 +177,7 @@ public:
int report_errors = 0,
int ordering = PERMUTE_ARGS,
int long_only = 0);
+
#else
private:
void ACE_Get_Opt_Init (const ACE_TCHAR *optstring);
@@ -183,6 +199,7 @@ public:
#endif
/// Default dtor.
~ACE_Get_Opt (void);
+
/**
* Scan elements of @a argv (whose length is @a argc) for short option
* characters given in @a optstring or long options (with no short
@@ -220,12 +237,14 @@ public:
* and ':' in order to determine ordering and missing argument behavior.
*/
int operator () (void);
+
/**
* For communication from @c operator() to the caller. When
* @c operator() finds an option that takes an argument, the argument
* value is returned from this method, otherwise it returns 0.
*/
ACE_TCHAR *opt_arg (void) const;
+
/**
* Returns the most recently matched option character. Especially
* useful when operator() returns ':' for an unspecified argument
@@ -233,6 +252,7 @@ public:
* was specified without its required argument.
*/
int opt_opt (void);
+
/**
* Index in @a argv of the next element to be scanned. This is used
* for communication to and from the caller and for communication
@@ -246,6 +266,7 @@ public:
* much of @a argv has been scanned so far.
*/
int &opt_ind (void);
+
/// Adds a long option with no corresponding short option.
/**
* If the @a name option is seen, @c operator() returns 0.
@@ -259,6 +280,7 @@ public:
*/
int long_option (const ACE_TCHAR *name,
OPTION_ARG_MODE has_arg = NO_ARG);
+
/// Adds a long option with a corresponding short option.
/**
* @param name The long option to add.
@@ -276,29 +298,37 @@ public:
int long_option (const ACE_TCHAR *name,
int short_option,
OPTION_ARG_MODE has_arg = NO_ARG);
+
/// Returns the name of the long option found on the last call to
/// @c operator() or 0 if none was found.
const ACE_TCHAR *long_option (void) const;
+
/// The number of arguments in the internal @c argv_.
int argc (void) const;
+
/// Accessor for the internal @c argv_ pointer.
ACE_TCHAR **argv (void) const;
+
/// Accessor for the @c last_option that was processed. This allows
/// applications to know if the found option was a short or long
/// option, and is especially useful in cases where it was invalid
/// and the caller wants to print out the invalid value.
const ACE_TCHAR *last_option (void) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Return the @a optstring. This is handy to verify that calls to
/// long_option added short options as expected.
const ACE_TCHAR *optstring (void) const;
+
public:
/*
* The following five data members should be private, but that
* would break backwards compatibility. However, we recommend not
* writing code that uses these fields directly.
*/
+
/// Holds the @a argc count.
/**
* @deprecated This is public for backwards compatibility only.
@@ -307,6 +337,7 @@ public:
* @c argc() accessor method instead.
*/
int argc_;
+
/// Holds the @a argv pointer.
/**
* @deprecated This is public for backwards compatibility only.
@@ -315,6 +346,7 @@ public:
* @c argv() accessor method instead.
*/
ACE_TCHAR **argv_;
+
/// Index in @c argv_ of the next element to be scanned.
/**
* @deprecated This is public for backwards compatibility only.
@@ -323,6 +355,7 @@ public:
* @c opt_ind() accessor method instead.
*/
int optind;
+
/// Callers store zero here to inhibit the error message for
/// unrecognized options.
/**
@@ -332,6 +365,7 @@ public:
* @a report_errors argument to this class's constructor instead.
*/
int opterr;
+
/// Points to the option argument when one is found on last call to
/// @c operator().
/**
@@ -341,6 +375,7 @@ public:
* @c opt_arg() accessor method instead.
*/
ACE_TCHAR *optarg;
+
private:
/**
* @class ACE_Get_Opt_Long_Option This class is for internal use
@@ -353,13 +388,18 @@ private:
ACE_Get_Opt_Long_Option (const ACE_TCHAR *name,
int has_arg,
int val = 0);
+
/// Dtor.
~ACE_Get_Opt_Long_Option (void);
+
bool operator < (const ACE_Get_Opt_Long_Option &rhs);
+
/// Long option name.
const ACE_TCHAR *name_;
+
/// Contains value for <OPTION_ARG_MODE>.
int has_arg_;
+
/// Contains a valid short option character or zero if it doesn't
/// have a corresponding short option. It can also contain a
/// non-printable value that cannot be passed to <optstring> but
@@ -368,35 +408,48 @@ private:
/// for an example of this technique.
int val_;
};
+
/// Updates nextchar_.
int nextchar_i (void);
+
/// Handles long options.
int long_option_i (void);
+
/// Handles short options.
int short_option_i (void);
+
/// If permuting args, this functions manages the nonopt_start_ and
/// nonopt_end_ indexes and makes calls to permute to actually
/// reorder the <argv>-elements.
void permute_args (void);
+
/// Handles reordering <argv>-elements.
int permute (void);
+
/// Set last_option.
void last_option (const ACE_TString &s);
+
// Disallow copying and assignment.
ACE_Get_Opt (const ACE_Get_Opt &);
ACE_Get_Opt &operator= (const ACE_Get_Opt &);
+
private:
+
/// Holds the option string.
ACE_TString *optstring_;
+
/// Treat all options as long options.
int long_only_;
+
/// Keeps track of whether or not a colon was passed in <optstring>.
/// This is used to determine the return value when required
/// arguments are missing.
int has_colon_;
+
/// This is the last option, short or long, that was processed. This
/// is handy to have in cases where the option passed was invalid.
ACE_TString *last_option_;
+
/**
* The next char to be scanned in the option-element in which the
* last option character we returned was found. This allows us to
@@ -405,27 +458,38 @@ private:
* by advancing to the next <argv>-element.
*/
ACE_TCHAR *nextchar_;
+
/// Most recently matched short option character.
int optopt_;
+
/// Keeps track of ordering mode (default <PERMUTE_ARGS>).
int ordering_;
+
/// Index of the first non-option <argv>-element found (only valid
/// when permuting).
int nonopt_start_;
+
/// Index of the <argv>-element following the last non-option element
/// (only valid when permuting).
int nonopt_end_;
+
/// Points to the long_option found on last call to <operator()>.
ACE_Get_Opt_Long_Option *long_option_;
+
/// Array of long options.
ACE_Array<ACE_Get_Opt_Long_Option*> long_opts_;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Get_Opt.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_GET_OPT_H */
diff --git a/dep/ACE_wrappers/ace/Get_Opt.inl b/dep/ACE_wrappers/ace/Get_Opt.inl
index f8f499f4177..e307fb5e400 100644
--- a/dep/ACE_wrappers/ace/Get_Opt.inl
+++ b/dep/ACE_wrappers/ace/Get_Opt.inl
@@ -1,37 +1,45 @@
// -*- C++ -*-
//
// $Id: Get_Opt.inl 81840 2008-06-05 13:46:45Z sma $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE bool
ACE_Get_Opt::ACE_Get_Opt_Long_Option::operator < (const ACE_Get_Opt_Long_Option &rhs)
{
return this->name_ < rhs.name_;
}
+
ACE_INLINE int
ACE_Get_Opt::argc (void) const
{
return this->argc_;
}
+
ACE_INLINE ACE_TCHAR **
ACE_Get_Opt::argv (void) const
{
return this->argv_;
}
+
ACE_INLINE ACE_TCHAR*
ACE_Get_Opt::opt_arg (void) const
{
return this->optarg;
}
+
ACE_INLINE int
ACE_Get_Opt::opt_opt (void)
{
return this->optopt_;
}
+
ACE_INLINE int &
ACE_Get_Opt::opt_ind (void)
{
return this->optind;
}
+
#ifdef ACE_USES_WCHAR
ACE_INLINE ACE_Get_Opt::ACE_Get_Opt (int argc,
ACE_TCHAR **argv,
@@ -58,6 +66,7 @@ ACE_INLINE ACE_Get_Opt::ACE_Get_Opt (int argc,
{
ACE_Get_Opt_Init (optstring);
}
+
ACE_INLINE ACE_Get_Opt::ACE_Get_Opt (int argc,
ACE_TCHAR **argv,
const char *optstring,
@@ -84,4 +93,5 @@ ACE_INLINE ACE_Get_Opt::ACE_Get_Opt (int argc,
ACE_Get_Opt_Init (ACE_TEXT_CHAR_TO_TCHAR (optstring));
}
#endif
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Global_Macros.h b/dep/ACE_wrappers/ace/Global_Macros.h
index cad219c8e96..12f6a2465c6 100644
--- a/dep/ACE_wrappers/ace/Global_Macros.h
+++ b/dep/ACE_wrappers/ace/Global_Macros.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Global_Macros.h
@@ -12,34 +13,45 @@
* This one is split from the famous OS.h
*/
//=============================================================================
+
#ifndef ACE_GLOBAL_MACROS_H
#define ACE_GLOBAL_MACROS_H
+
#include /**/ "ace/pre.h"
+
// Included just keep compilers that see #pragma dierctive first
// happy.
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/config-lite.h"
#include "ace/Assert.h" // For ACE_ASSERT
+
// Start Global Macros
# define ACE_BEGIN_DUMP ACE_TEXT ("\n====\n(%P|%t|%x)\n")
# define ACE_END_DUMP ACE_TEXT ("====\n")
+
# if defined (ACE_NDEBUG)
# define ACE_DB(X)
# else
# define ACE_DB(X) X
# endif /* ACE_NDEBUG */
+
// ACE_NO_HEAP_CHECK macro can be used to suppress false report of
// memory leaks. It turns off the built-in heap checking until the
// block is left. The old state will then be restored Only used for
// Win32 (in the moment).
# if defined (ACE_WIN32)
+
# if defined (_DEBUG) && !defined (ACE_HAS_WINCE) && !defined (__BORLANDC__)
# include /**/ <crtdbg.h>
+
// Open versioned namespace, if enabled by the user.
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Export ACE_No_Heap_Check
{
public:
@@ -50,8 +62,10 @@ public:
private:
int old_state;
};
+
// Close versioned namespace, if enabled by the user.
ACE_END_VERSIONED_NAMESPACE_DECL
+
# define ACE_NO_HEAP_CHECK ACE_No_Heap_Check ____no_heap;
# else /* !_DEBUG */
# define ACE_NO_HEAP_CHECK
@@ -59,12 +73,16 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# else /* !ACE_WIN32 */
# define ACE_NO_HEAP_CHECK
# endif /* ACE_WIN32 */
+
// Turn a number into a string.
# define ACE_ITOA(X) #X
+
// Create a string of a server address with a "host:port" format.
# define ACE_SERVER_ADDRESS(H,P) H ACE_TEXT(":") P
+
// A couple useful inline functions for checking whether bits are
// enabled or disabled.
+
// Efficiently returns the least power of two >= X...
# define ACE_POW(X) (((X) == 0)?1:(X-=1,X|=X>>1,X|=X>>2,X|=X>>4,X|=X>>8,X|=X>>16,(++X)))
# define ACE_EVEN(NUM) (((NUM) & 1) == 0)
@@ -74,15 +92,18 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_BIT_CMP_MASK(WORD, BIT, MASK) (((WORD) & (BIT)) == MASK)
# define ACE_SET_BITS(WORD, BITS) (WORD |= (BITS))
# define ACE_CLR_BITS(WORD, BITS) (WORD &= ~(BITS))
+
# if !defined (ACE_ENDLESS_LOOP)
# define ACE_ENDLESS_LOOP
# endif /* ! ACE_ENDLESS_LOOP */
+
# if defined (ACE_NEEDS_FUNC_DEFINITIONS)
// It just evaporated ;-) Not pleasant.
# define ACE_UNIMPLEMENTED_FUNC(f)
# else
# define ACE_UNIMPLEMENTED_FUNC(f) f;
# endif /* ACE_NEEDS_FUNC_DEFINITIONS */
+
#if !defined (ACE_LACKS_DEPRECATED_MACROS)
// Easy way to designate that a class is used as a pseudo-namespace.
// Insures that g++ "friendship" anamolies are properly handled.
@@ -92,7 +113,9 @@ ACE_END_VERSIONED_NAMESPACE_DECL
CLASSNAME (const CLASSNAME&); \
friend class ace_dewarn_gplusplus
#endif /* ACE_LACKS_DEPRECATED_MACROS */
+
// ----------------------------------------------------------------
+
//FUZZ: disable check_for_exception_sepc
#if !defined (ACE_LACKS_DEPRECATED_MACROS)
#if defined (ACE_HAS_NO_THROW_SPEC)
@@ -111,13 +134,16 @@ ACE_END_VERSIONED_NAMESPACE_DECL
#endif /*ACE_HAS_NO_THROW_SPEC*/
#endif /* ACE_LACKS_DEPRECATED_MACROS */
//FUZZ: enable check_for_exception_sepc
+
// ----------------------------------------------------------------
+
#if !defined (ACE_LACKS_DEPRECATED_MACROS)
/**
* This macro is deprecated
*/
#define ACE_NESTED_CLASS(TYPE, NAME) TYPE::NAME
#endif /* ACE_LACKS_DEPRECATED_MACROS */
+
#if !defined (ACE_LACKS_DEPRECATED_MACROS)
/**
* @name CORBA namespace macros.
@@ -135,7 +161,9 @@ ACE_END_VERSIONED_NAMESPACE_DECL
#define ACE_CORBA_3(TYPE, NAME) CORBA::TYPE::NAME
//@}
#endif /* ACE_LACKS_DEPRECATED_MACROS */
+
// ----------------------------------------------------------------
+
// Convenient macro for testing for deadlock, as well as for detecting
// when mutexes fail.
#define ACE_GUARD_ACTION(MUTEX, OBJ, LOCK, ACTION, REACTION) \
@@ -160,7 +188,9 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_READ_GUARD_RETURN(MUTEX,OBJ,LOCK,RETURN) \
ACE_Read_Guard< MUTEX > OBJ (LOCK); \
if (OBJ.locked () == 0) return RETURN;
+
// ----------------------------------------------------------------
+
# define ACE_DES_NOFREE(POINTER,CLASS) \
do { \
if (POINTER) \
@@ -169,6 +199,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
} \
} \
while (0)
+
# define ACE_DES_ARRAY_NOFREE(POINTER,SIZE,CLASS) \
do { \
if (POINTER) \
@@ -182,6 +213,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
} \
} \
while (0)
+
# define ACE_DES_FREE(POINTER,DEALLOCATOR,CLASS) \
do { \
if (POINTER) \
@@ -191,6 +223,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
} \
} \
while (0)
+
# define ACE_DES_ARRAY_FREE(POINTER,SIZE,DEALLOCATOR,CLASS) \
do { \
if (POINTER) \
@@ -205,6 +238,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
} \
} \
while (0)
+
# if defined (ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR)
# define ACE_DES_NOFREE_TEMPLATE(POINTER,T_CLASS,T_PARAMETER) \
do { \
@@ -227,6 +261,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
} \
} \
while (0)
+
#if defined (ACE_EXPLICIT_TEMPLATE_DESTRUCTOR_TAKES_ARGS)
# define ACE_DES_FREE_TEMPLATE(POINTER,DEALLOCATOR,T_CLASS,T_PARAMETER) \
do { \
@@ -427,11 +462,14 @@ ACE_END_VERSIONED_NAMESPACE_DECL
while (0)
# endif /* defined ! ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR */
+
/*******************************************************************/
+
/// Service Objects, i.e., objects dynamically loaded via the service
/// configurator, must provide a destructor function with the
/// following prototype to perform object cleanup.
typedef void (*ACE_Service_Object_Exterminator)(void *);
+
/** @name Service Configurator macros
*
* The following macros are used to define helper objects used in
@@ -464,6 +502,7 @@ typedef void (*ACE_Service_Object_Exterminator)(void *);
*/
# define ACE_STATIC_SVC_DECLARE(SERVICE_CLASS) \
extern ACE_Static_Svc_Descriptor ace_svc_desc_##SERVICE_CLASS ;
+
/// As ACE_STATIC_SVC_DECLARE, but using an export macro for NT
/// compilers.
/**
@@ -484,6 +523,7 @@ extern ACE_Static_Svc_Descriptor ace_svc_desc_##SERVICE_CLASS ;
*/
#define ACE_STATIC_SVC_DECLARE_EXPORT(EXPORT_NAME,SERVICE_CLASS) \
extern EXPORT_NAME##_Export ACE_Static_Svc_Descriptor ace_svc_desc_##SERVICE_CLASS;
+
/// Define the data structure used to register a statically linked
/// service into the Service Configurator.
/**
@@ -516,6 +556,7 @@ extern EXPORT_NAME##_Export ACE_Static_Svc_Descriptor ace_svc_desc_##SERVICE_CLA
*/
# define ACE_STATIC_SVC_DEFINE(SERVICE_CLASS, NAME, TYPE, FN, FLAGS, ACTIVE) \
ACE_Static_Svc_Descriptor ace_svc_desc_##SERVICE_CLASS = { NAME, TYPE, FN, FLAGS, ACTIVE };
+
/// Automatically register a service with the service configurator
/**
* In some applications the services must be automatically registered
@@ -544,7 +585,9 @@ public:\
};
#define ACE_STATIC_SVC_REGISTER(SERVICE_CLASS)\
ACE_Static_Svc_##SERVICE_CLASS ace_static_svc_##SERVICE_CLASS
+
#else /* !ACE_LACKS_STATIC_CONSTRUCTORS */
+
# define ACE_STATIC_SVC_REQUIRE(SERVICE_CLASS)\
class ACE_Static_Svc_##SERVICE_CLASS {\
public:\
@@ -555,13 +598,16 @@ public:\
};\
static ACE_Static_Svc_##SERVICE_CLASS ace_static_svc_##SERVICE_CLASS;
#define ACE_STATIC_SVC_REGISTER(SERVICE_CLASS) do {} while (0)
+
#endif /* !ACE_LACKS_STATIC_CONSTRUCTORS */
+
// Preprocessor symbols will not be expanded if they are
// concatenated. Force the preprocessor to expand them during the
// argument prescan by calling a macro that itself calls another that
// performs the actual concatenation.
#define ACE_PREPROC_CONCATENATE_IMPL(A,B) A ## B
#define ACE_PREPROC_CONCATENATE(A,B) ACE_PREPROC_CONCATENATE_IMPL(A,B)
+
#if defined (ACE_HAS_VERSIONED_NAMESPACE) && ACE_HAS_VERSIONED_NAMESPACE == 1
// Preprocessor symbols will not be expanded if they are
// concatenated. Force the preprocessor to expand them during the
@@ -571,9 +617,11 @@ static ACE_Static_Svc_##SERVICE_CLASS ace_static_svc_##SERVICE_CLASS;
#else
# define ACE_MAKE_SVC_CONFIG_FUNCTION_NAME(PREFIX,VERSIONED_NAMESPACE,SERVICE_CLASS) PREFIX ## _ ## SERVICE_CLASS
#endif /* ACE_HAS_VERSIONED_NAMESPACE == 1 */
+
#define ACE_MAKE_SVC_CONFIG_FACTORY_NAME(VERSIONED_NAMESPACE,SERVICE_CLASS) ACE_MAKE_SVC_CONFIG_FUNCTION_NAME(_make,VERSIONED_NAMESPACE,SERVICE_CLASS)
#define ACE_MAKE_SVC_CONFIG_GOBBLER_NAME(VERSIONED_NAMESPACE,SERVICE_CLASS) ACE_MAKE_SVC_CONFIG_FUNCTION_NAME(_gobble,VERSIONED_NAMESPACE,SERVICE_CLASS)
+
/// Declare the factory method used to create dynamically loadable
/// services.
/**
@@ -593,6 +641,7 @@ static ACE_Static_Svc_##SERVICE_CLASS ace_static_svc_##SERVICE_CLASS;
# define ACE_FACTORY_DECLARE(CLS,SERVICE_CLASS) \
extern "C" CLS##_Export ACE_VERSIONED_NAMESPACE_NAME::ACE_Service_Object * \
ACE_MAKE_SVC_CONFIG_FACTORY_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS) (ACE_Service_Object_Exterminator *);
+
/// Define the factory method (and destructor) for a dynamically
/// loadable service.
/**
@@ -608,6 +657,7 @@ ACE_MAKE_SVC_CONFIG_FACTORY_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS) (AC
* specified as ACE_Local_Service.
*/
# define ACE_Local_Service_Export
+
#if defined (ACE_OPENVMS)
# define ACE_PREPROC_STRINGIFY(A) #A
# define ACE_MAKE_SVC_REGISTRAR_ARG(A) ACE_PREPROC_STRINGIFY(A), (void*)&A
@@ -643,6 +693,7 @@ ACE_MAKE_SVC_CONFIG_FACTORY_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS) (AC
return new SERVICE_CLASS; \
}
#endif
+
/**
* For service classes scoped within namespaces, use this macro in
* place of ACE_FACTORY_DEFINE. The third argument in this case is
@@ -704,12 +755,16 @@ ACE_MAKE_SVC_CONFIG_FACTORY_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS) (AC
return new NAMESPACE_CLASS; \
}
#endif
+
/// The canonical name for a service factory method
# define ACE_SVC_NAME(SERVICE_CLASS) ACE_MAKE_SVC_CONFIG_FACTORY_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS)
+
/// The canonical way to invoke (i.e. construct) a service factory
/// method.
#define ACE_SVC_INVOKE(SERVICE_CLASS) ACE_SVC_NAME(SERVICE_CLASS) (0)
+
//@}
+
/** @name Helper macros for services defined in the netsvcs library.
*
* The ACE services defined in netsvcs use this helper macros for
@@ -720,6 +775,7 @@ ACE_MAKE_SVC_CONFIG_FACTORY_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS) (AC
# define ACE_SVC_FACTORY_DECLARE(X) ACE_FACTORY_DECLARE (ACE_Svc, X)
# define ACE_SVC_FACTORY_DEFINE(X) ACE_FACTORY_DEFINE (ACE_Svc, X)
//@}
+
#if defined (ACE_WIN32)
// These are used in SPIPE_Acceptor/Connector, but are ignored at runtime.
# if defined (ACE_HAS_WINCE)
@@ -782,10 +838,13 @@ ACE_MAKE_SVC_CONFIG_FACTORY_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS) (AC
# endif /* !defined PIPE_TYPE_MESSAGE */
#endif /* ACE_WIN32 */
+
// Some useful abstrations for expressions involving
// ACE_Allocator.malloc (). The difference between ACE_NEW_MALLOC*
// with ACE_ALLOCATOR* is that they call constructors also.
+
#include "ace/OS_Errno.h" /* Need errno and ENOMEM */
+
# define ACE_ALLOCATOR_RETURN(POINTER,ALLOCATOR,RET_VAL) \
do { POINTER = ALLOCATOR; \
if (POINTER == 0) { errno = ENOMEM; return RET_VAL; } \
@@ -798,6 +857,7 @@ ACE_MAKE_SVC_CONFIG_FACTORY_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS) (AC
do { POINTER = ALLOCATOR; \
if (POINTER == 0) { errno = ENOMEM; } \
} while (0)
+
# define ACE_NEW_MALLOC_RETURN(POINTER,ALLOCATOR,CONSTRUCTOR,RET_VAL) \
do { POINTER = ALLOCATOR; \
if (POINTER == 0) { errno = ENOMEM; return RET_VAL;} \
@@ -813,6 +873,7 @@ ACE_MAKE_SVC_CONFIG_FACTORY_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS) (AC
if (POINTER == 0) { errno = ENOMEM;} \
else { (void) new (POINTER) CONSTRUCTOR; } \
} while (0)
+
/* ACE_Metrics */
#if defined ACE_LACKS_ARRAY_PLACEMENT_NEW
# define ACE_NEW_MALLOC_ARRAY_RETURN(POINTER,ALLOCATOR,CONSTRUCTOR,COUNT,RET_VAL) \
@@ -841,6 +902,7 @@ ACE_MAKE_SVC_CONFIG_FACTORY_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS) (AC
else { (void) new (POINTER) CONSTRUCTOR [COUNT]; } \
} while (0)
#endif /* defined ACE_LACKS_ARRAY_PLACEMENT_NEW */
+
// This is being placed here temporarily to help stablelize the builds, but will
// be moved out along with the above macros as part of the subsetting. dhinton
#if !defined (ACE_LACKS_NEW_H)
@@ -850,7 +912,9 @@ ACE_MAKE_SVC_CONFIG_FACTORY_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS) (AC
# include /**/ <new.h>
# endif /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */
#endif /* ! ACE_LACKS_NEW_H */
+
# define ACE_NOOP(x)
+
#if defined (ACE_WIN32) && defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS)
# define ACE_SEH_TRY __try
# define ACE_SEH_EXCEPT(X) __except(X)
@@ -860,39 +924,48 @@ ACE_MAKE_SVC_CONFIG_FACTORY_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS) (AC
# define ACE_SEH_EXCEPT(X) while (0)
# define ACE_SEH_FINALLY if (1)
#endif /* ACE_WIN32 */
+
// These should probably be put into a seperate header.
+
// The following is necessary since many C++ compilers don't support
// typedef'd types inside of classes used as formal template
// arguments... ;-(. Luckily, using the C++ preprocessor I can hide
// most of this nastiness!
+
# if defined (ACE_HAS_TEMPLATE_TYPEDEFS)
+
// Handle ACE_Message_Queue.
# define ACE_SYNCH_DECL class _ACE_SYNCH
# define ACE_SYNCH_USE _ACE_SYNCH
# define ACE_SYNCH_MUTEX_T typename _ACE_SYNCH::MUTEX
# define ACE_SYNCH_CONDITION_T typename _ACE_SYNCH::CONDITION
# define ACE_SYNCH_SEMAPHORE_T typename _ACE_SYNCH::SEMAPHORE
+
// Handle ACE_Malloc*
# define ACE_MEM_POOL_1 class _ACE_MEM_POOL
# define ACE_MEM_POOL_2 _ACE_MEM_POOL
# define ACE_MEM_POOL _ACE_MEM_POOL
# define ACE_MEM_POOL_OPTIONS typename _ACE_MEM_POOL::OPTIONS
+
// Handle ACE_Svc_Handler
# define ACE_PEER_STREAM_1 class _ACE_PEER_STREAM
# define ACE_PEER_STREAM_2 _ACE_PEER_STREAM
# define ACE_PEER_STREAM _ACE_PEER_STREAM
# define ACE_PEER_STREAM_ADDR typename _ACE_PEER_STREAM::PEER_ADDR
+
// Handle ACE_Acceptor
# define ACE_PEER_ACCEPTOR_1 class _ACE_PEER_ACCEPTOR
# define ACE_PEER_ACCEPTOR_2 _ACE_PEER_ACCEPTOR
# define ACE_PEER_ACCEPTOR _ACE_PEER_ACCEPTOR
# define ACE_PEER_ACCEPTOR_ADDR typename _ACE_PEER_ACCEPTOR::PEER_ADDR
+
// Handle ACE_Connector
# define ACE_PEER_CONNECTOR_1 class _ACE_PEER_CONNECTOR
# define ACE_PEER_CONNECTOR_2 _ACE_PEER_CONNECTOR
# define ACE_PEER_CONNECTOR _ACE_PEER_CONNECTOR
# define ACE_PEER_CONNECTOR_ADDR typename ACE_PEER_CONNECTOR::PEER_ADDR
# define ACE_PEER_CONNECTOR_ADDR_ANY ACE_PEER_ADDR_TYPEDEF::sap_any
+
// Handle ACE_SOCK_*
# define ACE_SOCK_ACCEPTOR ACE_SOCK_Acceptor
# define ACE_SOCK_CONNECTOR ACE_SOCK_Connector
@@ -900,33 +973,41 @@ ACE_MAKE_SVC_CONFIG_FACTORY_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS) (AC
# define ACE_SOCK_DGRAM ACE_SOCK_Dgram
# define ACE_SOCK_DGRAM_BCAST ACE_SOCK_Dgram_Bcast
# define ACE_SOCK_DGRAM_MCAST ACE_SOCK_Dgram_Mcast
+
// Handle ACE_SOCK_SEQPACK_*
# define ACE_SOCK_SEQPACK_ACCEPTOR ACE_SOCK_SEQPACK_Acceptor
# define ACE_SOCK_SEQPACK_CONNECTOR ACE_SOCK_SEQPACK_Connector
# define ACE_SOCK_SEQPACK_ASSOCIATION ACE_SOCK_SEQPACK_Association
+
// Handle ACE_MEM_*
# define ACE_MEM_ACCEPTOR ACE_MEM_Acceptor
# define ACE_MEM_CONNECTOR ACE_MEM_Connector
# define ACE_MEM_STREAM ACE_MEM_Stream
+
// Handle ACE_LSOCK_*
# define ACE_LSOCK_ACCEPTOR ACE_LSOCK_Acceptor
# define ACE_LSOCK_CONNECTOR ACE_LSOCK_Connector
# define ACE_LSOCK_STREAM ACE_LSOCK_Stream
+
// Handle ACE_TLI_*
# define ACE_TLI_ACCEPTOR ACE_TLI_Acceptor
# define ACE_TLI_CONNECTOR ACE_TLI_Connector
# define ACE_TLI_STREAM ACE_TLI_Stream
+
// Handle ACE_SPIPE_*
# define ACE_SPIPE_ACCEPTOR ACE_SPIPE_Acceptor
# define ACE_SPIPE_CONNECTOR ACE_SPIPE_Connector
# define ACE_SPIPE_STREAM ACE_SPIPE_Stream
+
// Handle ACE_UPIPE_*
# define ACE_UPIPE_ACCEPTOR ACE_UPIPE_Acceptor
# define ACE_UPIPE_CONNECTOR ACE_UPIPE_Connector
# define ACE_UPIPE_STREAM ACE_UPIPE_Stream
+
// Handle ACE_FILE_*
# define ACE_FILE_CONNECTOR ACE_FILE_Connector
# define ACE_FILE_STREAM ACE_FILE_IO
+
// Handle ACE_*_Memory_Pool.
# define ACE_MMAP_MEMORY_POOL ACE_MMAP_Memory_Pool
# define ACE_LITE_MMAP_MEMORY_POOL ACE_Lite_MMAP_Memory_Pool
@@ -934,7 +1015,9 @@ ACE_MAKE_SVC_CONFIG_FACTORY_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS) (AC
# define ACE_SHARED_MEMORY_POOL ACE_Shared_Memory_Pool
# define ACE_LOCAL_MEMORY_POOL ACE_Local_Memory_Pool
# define ACE_PAGEFILE_MEMORY_POOL ACE_Pagefile_Memory_Pool
+
# else /* TEMPLATES are broken in some form or another (i.e., most C++ compilers) */
+
// Handle ACE_Message_Queue.
# if defined (ACE_HAS_OPTIMIZED_MESSAGE_QUEUE)
# define ACE_SYNCH_DECL class _ACE_SYNCH_MUTEX_T, class _ACE_SYNCH_CONDITION_T, class _ACE_SYNCH_SEMAPHORE_T
@@ -946,27 +1029,32 @@ ACE_MAKE_SVC_CONFIG_FACTORY_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS) (AC
# define ACE_SYNCH_MUTEX_T _ACE_SYNCH_MUTEX_T
# define ACE_SYNCH_CONDITION_T _ACE_SYNCH_CONDITION_T
# define ACE_SYNCH_SEMAPHORE_T _ACE_SYNCH_SEMAPHORE_T
+
// Handle ACE_Malloc*
# define ACE_MEM_POOL_1 class _ACE_MEM_POOL, class _ACE_MEM_POOL_OPTIONS
# define ACE_MEM_POOL_2 _ACE_MEM_POOL, _ACE_MEM_POOL_OPTIONS
# define ACE_MEM_POOL _ACE_MEM_POOL
# define ACE_MEM_POOL_OPTIONS _ACE_MEM_POOL_OPTIONS
+
// Handle ACE_Svc_Handler
# define ACE_PEER_STREAM_1 class _ACE_PEER_STREAM, class _ACE_PEER_ADDR
# define ACE_PEER_STREAM_2 _ACE_PEER_STREAM, _ACE_PEER_ADDR
# define ACE_PEER_STREAM _ACE_PEER_STREAM
# define ACE_PEER_STREAM_ADDR _ACE_PEER_ADDR
+
// Handle ACE_Acceptor
# define ACE_PEER_ACCEPTOR_1 class _ACE_PEER_ACCEPTOR, class _ACE_PEER_ADDR
# define ACE_PEER_ACCEPTOR_2 _ACE_PEER_ACCEPTOR, _ACE_PEER_ADDR
# define ACE_PEER_ACCEPTOR _ACE_PEER_ACCEPTOR
# define ACE_PEER_ACCEPTOR_ADDR _ACE_PEER_ADDR
+
// Handle ACE_Connector
# define ACE_PEER_CONNECTOR_1 class _ACE_PEER_CONNECTOR, class _ACE_PEER_ADDR
# define ACE_PEER_CONNECTOR_2 _ACE_PEER_CONNECTOR, _ACE_PEER_ADDR
# define ACE_PEER_CONNECTOR _ACE_PEER_CONNECTOR
# define ACE_PEER_CONNECTOR_ADDR _ACE_PEER_ADDR
# define ACE_PEER_CONNECTOR_ADDR_ANY ACE_PEER_CONNECTOR_ADDR::sap_any
+
// Handle ACE_SOCK_*
# define ACE_SOCK_ACCEPTOR ACE_SOCK_Acceptor, ACE_INET_Addr
# define ACE_SOCK_CONNECTOR ACE_SOCK_Connector, ACE_INET_Addr
@@ -974,33 +1062,41 @@ ACE_MAKE_SVC_CONFIG_FACTORY_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS) (AC
# define ACE_SOCK_DGRAM ACE_SOCK_Dgram, ACE_INET_Addr
# define ACE_SOCK_DGRAM_BCAST ACE_SOCK_Dgram_Bcast, ACE_INET_Addr
# define ACE_SOCK_DGRAM_MCAST ACE_SOCK_Dgram_Mcast, ACE_INET_Addr
+
// Handle ACE_SOCK_SEQPACK_*
# define ACE_SOCK_SEQPACK_ACCEPTOR ACE_SOCK_SEQPACK_Acceptor, ACE_Multihomed_INET_Addr
# define ACE_SOCK_SEQPACK_CONNECTOR ACE_SOCK_SEQPACK_Connector, ACE_Multihomed_INET_Addr
# define ACE_SOCK_SEQPACK_ASSOCIATION ACE_SOCK_SEQPACK_Association, ACE_Multihomed_INET_Addr
+
// Handle ACE_MEM_*
# define ACE_MEM_ACCEPTOR ACE_MEM_Acceptor, ACE_MEM_Addr
# define ACE_MEM_CONNECTOR ACE_MEM_Connector, ACE_INET_Addr
# define ACE_MEM_STREAM ACE_MEM_Stream, ACE_INET_Addr
+
// Handle ACE_LSOCK_*
# define ACE_LSOCK_ACCEPTOR ACE_LSOCK_Acceptor, ACE_UNIX_Addr
# define ACE_LSOCK_CONNECTOR ACE_LSOCK_Connector, ACE_UNIX_Addr
# define ACE_LSOCK_STREAM ACE_LSOCK_Stream, ACE_UNIX_Addr
+
// Handle ACE_TLI_*
# define ACE_TLI_ACCEPTOR ACE_TLI_Acceptor, ACE_INET_Addr
# define ACE_TLI_CONNECTOR ACE_TLI_Connector, ACE_INET_Addr
# define ACE_TLI_STREAM ACE_TLI_Stream, ACE_INET_Addr
+
// Handle ACE_SPIPE_*
# define ACE_SPIPE_ACCEPTOR ACE_SPIPE_Acceptor, ACE_SPIPE_Addr
# define ACE_SPIPE_CONNECTOR ACE_SPIPE_Connector, ACE_SPIPE_Addr
# define ACE_SPIPE_STREAM ACE_SPIPE_Stream, ACE_SPIPE_Addr
+
// Handle ACE_UPIPE_*
# define ACE_UPIPE_ACCEPTOR ACE_UPIPE_Acceptor, ACE_SPIPE_Addr
# define ACE_UPIPE_CONNECTOR ACE_UPIPE_Connector, ACE_SPIPE_Addr
# define ACE_UPIPE_STREAM ACE_UPIPE_Stream, ACE_SPIPE_Addr
+
// Handle ACE_FILE_*
# define ACE_FILE_CONNECTOR ACE_FILE_Connector, ACE_FILE_Addr
# define ACE_FILE_STREAM ACE_FILE_IO, ACE_FILE_Addr
+
// Handle ACE_*_Memory_Pool.
# define ACE_MMAP_MEMORY_POOL ACE_MMAP_Memory_Pool, ACE_MMAP_Memory_Pool_Options
# define ACE_LITE_MMAP_MEMORY_POOL ACE_Lite_MMAP_Memory_Pool, ACE_MMAP_Memory_Pool_Options
@@ -1009,6 +1105,7 @@ ACE_MAKE_SVC_CONFIG_FACTORY_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS) (AC
# define ACE_LOCAL_MEMORY_POOL ACE_Local_Memory_Pool, ACE_Local_Memory_Pool_Options
# define ACE_PAGEFILE_MEMORY_POOL ACE_Pagefile_Memory_Pool, ACE_Pagefile_Memory_Pool_Options
# endif /* ACE_HAS_TEMPLATE_TYPEDEFS */
+
// Work around compilers that don't like in-class static integral
// constants. Constants in this case are meant to be compile-time
// constants so that they may be used as template arguments, for
@@ -1018,6 +1115,8 @@ ACE_MAKE_SVC_CONFIG_FACTORY_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS) (AC
#else
# define ACE_STATIC_CONSTANT(TYPE, ASSIGNMENT) enum { ASSIGNMENT }
#endif /* !ACE_LACKS_STATIC_IN_CLASS_CONSTANTS */
+
#include /**/ "ace/post.h"
+
#endif /*ACE_GLOBAL_MACROS_H*/
diff --git a/dep/ACE_wrappers/ace/Guard_T.h b/dep/ACE_wrappers/ace/Guard_T.h
index 7bf491bb69a..a70bdda713a 100644
--- a/dep/ACE_wrappers/ace/Guard_T.h
+++ b/dep/ACE_wrappers/ace/Guard_T.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file Guard_T.h
@@ -10,16 +11,22 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//==========================================================================
+
#ifndef ACE_GUARD_T_H
#define ACE_GUARD_T_H
#include /**/ "ace/pre.h"
+
#include "ace/Lock.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Global_Macros.h"
#include "ace/OS_NS_Thread.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Guard
*
@@ -35,52 +42,71 @@ template <class ACE_LOCK>
class ACE_Guard
{
public:
+
// = Initialization and termination methods.
ACE_Guard (ACE_LOCK &l);
+
/// Implicitly and automatically acquire (or try to acquire) the
/// lock. If @a block is non-0 then <acquire> the <ACE_LOCK>, else
/// <tryacquire> it.
ACE_Guard (ACE_LOCK &l, bool block);
+
/// Initialise the guard without implicitly acquiring the lock. The
/// <become_owner> parameter indicates whether the guard should release
/// the lock implicitly on destruction. The <block> parameter is
/// ignored and is used here to disambiguate with the preceding
/// constructor.
ACE_Guard (ACE_LOCK &l, bool block, int become_owner);
+
/// Implicitly release the lock.
~ACE_Guard (void);
+
// = Lock accessors.
+
/// Explicitly acquire the lock.
int acquire (void);
+
/// Conditionally acquire the lock (i.e., won't block).
int tryacquire (void);
+
/// Explicitly release the lock, but only if it is held!
int release (void);
+
/// Relinquish ownership of the lock so that it is not released
/// implicitly in the destructor.
void disown (void);
+
// = Utility methods.
/// 1 if locked, 0 if couldn't acquire the lock
/// (errno will contain the reason for this).
int locked (void) const;
+
/// Explicitly remove the lock.
int remove (void);
+
/// Dump the state of an object.
void dump (void) const;
+
// ACE_ALLOC_HOOK_DECLARE;
// Declare the dynamic allocation hooks.
+
protected:
+
/// Helper, meant for subclass only.
ACE_Guard (ACE_LOCK *lock): lock_ (lock), owner_ (0) {}
+
/// Pointer to the ACE_LOCK we're guarding.
ACE_LOCK *lock_;
+
/// Keeps track of whether we acquired the lock or failed.
int owner_;
+
private:
// = Prevent assignment and initialization.
ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Guard<ACE_LOCK> &))
ACE_UNIMPLEMENTED_FUNC (ACE_Guard (const ACE_Guard<ACE_LOCK> &))
};
+
/**
* @class ACE_Write_Guard
*
@@ -94,26 +120,37 @@ class ACE_Write_Guard : public ACE_Guard<ACE_LOCK>
{
public:
// = Initialization method.
+
/// Implicitly and automatically acquire a write lock.
ACE_Write_Guard (ACE_LOCK &m);
+
/// Implicitly and automatically acquire (or try to acquire) a write
/// lock.
ACE_Write_Guard (ACE_LOCK &m, bool block);
+
// = Lock accessors.
+
/// Explicitly acquire the write lock.
int acquire_write (void);
+
/// Explicitly acquire the write lock.
int acquire (void);
+
/// Conditionally acquire the write lock (i.e., won't block).
int tryacquire_write (void);
+
/// Conditionally acquire the write lock (i.e., won't block).
int tryacquire (void);
+
// = Utility methods.
+
/// Dump the state of an object.
void dump (void) const;
+
// ACE_ALLOC_HOOK_DECLARE;
// Declare the dynamic allocation hooks.
};
+
/**
* @class ACE_Read_Guard
*
@@ -127,33 +164,47 @@ class ACE_Read_Guard : public ACE_Guard<ACE_LOCK>
{
public:
// = Initialization methods.
+
/// Implicitly and automatically acquire a read lock.
ACE_Read_Guard (ACE_LOCK& m);
+
/// Implicitly and automatically acquire (or try to acquire) a read
/// lock.
ACE_Read_Guard (ACE_LOCK &m, bool block);
+
// = Lock accessors.
+
/// Explicitly acquire the read lock.
int acquire_read (void);
+
/// Explicitly acquire the read lock.
int acquire (void);
+
/// Conditionally acquire the read lock (i.e., won't block).
int tryacquire_read (void);
+
/// Conditionally acquire the read lock (i.e., won't block).
int tryacquire (void);
+
// = Utility methods.
+
/// Dump the state of an object.
void dump (void) const;
+
// ACE_ALLOC_HOOK_DECLARE;
// Declare the dynamic allocation hooks.
};
+
#if !(defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION)))
+
#define ACE_TSS_Guard ACE_Guard
#define ACE_TSS_Write_GUARD ACE_Write_Guard
#define ACE_TSS_Read_GUARD ACE_Read_Guard
+
#else
/* ACE platform supports some form of threading and
thread-specific storage. */
+
/**
* @class ACE_TSS_Guard
*
@@ -167,39 +218,54 @@ class ACE_TSS_Guard
{
public:
// = Initialization and termination methods.
+
/// Implicitly and automatically acquire the thread-specific lock.
ACE_TSS_Guard (ACE_LOCK &lock, bool block = true);
+
/// Implicitly release the thread-specific lock.
~ACE_TSS_Guard (void);
+
// = Lock accessors.
+
/// Explicitly acquire the thread-specific lock.
int acquire (void);
+
/// Conditionally acquire the thread-specific lock (i.e., won't
/// block).
int tryacquire (void);
+
/// Explicitly release the thread-specific lock.
int release (void);
+
// = Utility methods.
/// Explicitly release the thread-specific lock.
int remove (void);
+
/// Dump the state of an object.
void dump (void) const;
+
// ACE_ALLOC_HOOK_DECLARE;
// Declare the dynamic allocation hooks.
+
protected:
/// Helper, meant for subclass only.
ACE_TSS_Guard (void);
+
/// Initialize the key.
void init_key (void);
+
/// Called when thread exits to clean up the lock.
static void cleanup (void *ptr);
+
/// Thread-specific key...
ACE_thread_key_t key_;
+
private:
// = Prevent assignment and initialization.
ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_TSS_Guard<ACE_LOCK> &))
ACE_UNIMPLEMENTED_FUNC (ACE_TSS_Guard (const ACE_TSS_Guard<ACE_LOCK> &))
};
+
/**
* @class ACE_TSS_Write_Guard
*
@@ -213,23 +279,33 @@ class ACE_TSS_Write_Guard : public ACE_TSS_Guard<ACE_LOCK>
{
public:
// = Initialization method.
+
/// Implicitly and automatically acquire the thread-specific write lock.
ACE_TSS_Write_Guard (ACE_LOCK &lock, bool block = true);
+
// = Lock accessors.
+
/// Explicitly acquire the thread-specific write lock.
int acquire_write (void);
+
/// Explicitly acquire the thread-specific write lock.
int acquire (void);
+
/// Conditionally acquire the thread-specific write lock (i.e., won't block).
int tryacquire_write (void);
+
/// Conditionally acquire the thread-specific write lock (i.e., won't block).
int tryacquire (void);
+
// = Utility methods.
+
/// Dump the state of an object.
void dump (void) const;
+
// ACE_ALLOC_HOOK_DECLARE;
// Declare the dynamic allocation hooks.
};
+
/**
* @class ACE_TSS_Read_Guard
*
@@ -245,34 +321,46 @@ public:
// = Initialization method.
/// Implicitly and automatically acquire the thread-specific read lock.
ACE_TSS_Read_Guard (ACE_LOCK &lock, bool block = true);
+
// = Lock accessors.
/// Explicitly acquire the thread-specific read lock.
int acquire_read (void);
+
/// Explicitly acquire the thread-specific read lock.
int acquire (void);
+
/// Conditionally acquire the thread-specific read lock (i.e., won't
/// block).
int tryacquire_read (void);
+
/// Conditionally acquire the thread-specific read lock (i.e., won't
/// block).
int tryacquire (void);
+
// = Utility methods.
/// Dump the state of an object.
void dump (void) const;
+
// ACE_ALLOC_HOOK_DECLARE;
// Declare the dynamic allocation hooks.
};
+
#endif /* !(defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION))) */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Guard_T.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Guard_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Guard_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
#endif /* ACE_GUARD_T_H */
diff --git a/dep/ACE_wrappers/ace/Guard_T.inl b/dep/ACE_wrappers/ace/Guard_T.inl
index 1395dd38565..5fb22b3bac7 100644
--- a/dep/ACE_wrappers/ace/Guard_T.inl
+++ b/dep/ACE_wrappers/ace/Guard_T.inl
@@ -1,18 +1,23 @@
// -*- C++ -*-
//
// $Id: Guard_T.inl 82508 2008-08-05 13:52:48Z johnnyw $
+
#include "ace/RW_Thread_Mutex.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template <class ACE_LOCK> ACE_INLINE int
ACE_Guard<ACE_LOCK>::acquire (void)
{
return this->owner_ = this->lock_->acquire ();
}
+
template <class ACE_LOCK> ACE_INLINE int
ACE_Guard<ACE_LOCK>::tryacquire (void)
{
return this->owner_ = this->lock_->tryacquire ();
}
+
template <class ACE_LOCK> ACE_INLINE int
ACE_Guard<ACE_LOCK>::release (void)
{
@@ -24,6 +29,7 @@ ACE_Guard<ACE_LOCK>::release (void)
return this->lock_->release ();
}
}
+
template <class ACE_LOCK> ACE_INLINE
ACE_Guard<ACE_LOCK>::ACE_Guard (ACE_LOCK &l)
: lock_ (&l),
@@ -31,6 +37,7 @@ ACE_Guard<ACE_LOCK>::ACE_Guard (ACE_LOCK &l)
{
this->acquire ();
}
+
template <class ACE_LOCK> ACE_INLINE
ACE_Guard<ACE_LOCK>::ACE_Guard (ACE_LOCK &l, bool block)
: lock_ (&l),
@@ -41,60 +48,72 @@ ACE_Guard<ACE_LOCK>::ACE_Guard (ACE_LOCK &l, bool block)
else
this->tryacquire ();
}
+
template <class ACE_LOCK> ACE_INLINE
ACE_Guard<ACE_LOCK>::ACE_Guard (ACE_LOCK &l, bool /* block */, int become_owner)
: lock_ (&l),
owner_ (become_owner == 0 ? -1 : 0)
{
}
+
// Implicitly and automatically acquire (or try to acquire) the
// lock.
+
template <class ACE_LOCK> ACE_INLINE
ACE_Guard<ACE_LOCK>::~ACE_Guard (void)
{
this->release ();
}
+
template <class ACE_LOCK> ACE_INLINE int
ACE_Guard<ACE_LOCK>::locked (void) const
{
return this->owner_ != -1;
}
+
template <class ACE_LOCK> ACE_INLINE int
ACE_Guard<ACE_LOCK>::remove (void)
{
return this->lock_->remove ();
}
+
template <class ACE_LOCK> ACE_INLINE void
ACE_Guard<ACE_LOCK>::disown (void)
{
this->owner_ = -1;
}
+
template <class ACE_LOCK> ACE_INLINE
ACE_Write_Guard<ACE_LOCK>::ACE_Write_Guard (ACE_LOCK &m)
: ACE_Guard<ACE_LOCK> (&m)
{
this->acquire_write ();
}
+
template <class ACE_LOCK> ACE_INLINE int
ACE_Write_Guard<ACE_LOCK>::acquire_write (void)
{
return this->owner_ = this->lock_->acquire_write ();
}
+
template <class ACE_LOCK> ACE_INLINE int
ACE_Write_Guard<ACE_LOCK>::acquire (void)
{
return this->owner_ = this->lock_->acquire_write ();
}
+
template <class ACE_LOCK> ACE_INLINE int
ACE_Write_Guard<ACE_LOCK>::tryacquire_write (void)
{
return this->owner_ = this->lock_->tryacquire_write ();
}
+
template <class ACE_LOCK> ACE_INLINE int
ACE_Write_Guard<ACE_LOCK>::tryacquire (void)
{
return this->owner_ = this->lock_->tryacquire_write ();
}
+
template <class ACE_LOCK> ACE_INLINE
ACE_Write_Guard<ACE_LOCK>::ACE_Write_Guard (ACE_LOCK &m,
bool block)
@@ -105,32 +124,38 @@ ACE_Write_Guard<ACE_LOCK>::ACE_Write_Guard (ACE_LOCK &m,
else
this->tryacquire_write ();
}
+
template <class ACE_LOCK> ACE_INLINE int
ACE_Read_Guard<ACE_LOCK>::acquire_read (void)
{
return this->owner_ = this->lock_->acquire_read ();
}
+
template <class ACE_LOCK> ACE_INLINE int
ACE_Read_Guard<ACE_LOCK>::acquire (void)
{
return this->owner_ = this->lock_->acquire_read ();
}
+
template <class ACE_LOCK> ACE_INLINE int
ACE_Read_Guard<ACE_LOCK>::tryacquire_read (void)
{
return this->owner_ = this->lock_->tryacquire_read ();
}
+
template <class ACE_LOCK> ACE_INLINE int
ACE_Read_Guard<ACE_LOCK>::tryacquire (void)
{
return this->owner_ = this->lock_->tryacquire_read ();
}
+
template <class ACE_LOCK> ACE_INLINE
ACE_Read_Guard<ACE_LOCK>::ACE_Read_Guard (ACE_LOCK &m)
: ACE_Guard<ACE_LOCK> (&m)
{
this->acquire_read ();
}
+
template <class ACE_LOCK> ACE_INLINE
ACE_Read_Guard<ACE_LOCK>::ACE_Read_Guard (ACE_LOCK &m,
bool block)
@@ -141,4 +166,5 @@ ACE_Read_Guard<ACE_LOCK>::ACE_Read_Guard (ACE_LOCK &m,
else
this->tryacquire_read ();
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Handle_Gobbler.h b/dep/ACE_wrappers/ace/Handle_Gobbler.h
index b5fb77a81e5..9e9805a676f 100644
--- a/dep/ACE_wrappers/ace/Handle_Gobbler.h
+++ b/dep/ACE_wrappers/ace/Handle_Gobbler.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Handle_Gobbler.h
@@ -10,14 +11,19 @@
*/
//=============================================================================
+
#ifndef ACE_HANDLE_GOBBLER_H
#define ACE_HANDLE_GOBBLER_H
#include /**/ "ace/pre.h"
+
#include "ace/Handle_Set.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Handle_Gobbler
*
@@ -30,25 +36,34 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
class ACE_Handle_Gobbler
{
public:
+
/// Destructor. Cleans up any remaining handles.
inline ~ACE_Handle_Gobbler (void);
+
/**
* Handles are opened continously until the process runs out of
* them, and then <n_handles_to_keep_available> handles are closed
* (freed) thereby making them usable in the future.
*/
inline int consume_handles (size_t n_handles_to_keep_available);
+
/// Free up @a n_handles.
inline int free_handles (size_t n_handles);
+
/// All remaining handles are closed.
inline void close_remaining_handles (void);
+
private:
typedef ACE_Handle_Set HANDLE_SET;
+
/// The container which holds the open descriptors.
HANDLE_SET handle_set_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include "ace/Handle_Gobbler.inl"
+
#include /**/ "ace/post.h"
#endif /* ACE_HANDLE_GOBBLER_H */
diff --git a/dep/ACE_wrappers/ace/Handle_Gobbler.inl b/dep/ACE_wrappers/ace/Handle_Gobbler.inl
index 1d00c04325a..4b81218e6de 100644
--- a/dep/ACE_wrappers/ace/Handle_Gobbler.inl
+++ b/dep/ACE_wrappers/ace/Handle_Gobbler.inl
@@ -1,12 +1,16 @@
// -*- C++ -*-
//
// $Id: Handle_Gobbler.inl 80826 2008-03-04 14:51:23Z wotte $
+
// Since this is only included in Handle_Gobbler.h, these should be
// inline, not ACE_INLINE.
// FUZZ: disable check_for_inline
+
#include "ace/OS_NS_unistd.h"
#include "ace/OS_NS_fcntl.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
inline void
ACE_Handle_Gobbler::close_remaining_handles (void)
{
@@ -14,11 +18,13 @@ ACE_Handle_Gobbler::close_remaining_handles (void)
for (ACE_HANDLE h = iter (); h != ACE_INVALID_HANDLE; h = iter ())
ACE_OS::close (h);
}
+
inline
ACE_Handle_Gobbler::~ACE_Handle_Gobbler (void)
{
this->close_remaining_handles ();
}
+
inline int
ACE_Handle_Gobbler::free_handles (size_t n_handles)
{
@@ -27,19 +33,25 @@ ACE_Handle_Gobbler::free_handles (size_t n_handles)
h != ACE_INVALID_HANDLE && n_handles > 0;
--n_handles, h = iter ())
ACE_OS::close (h);
+
return 0;
}
+
inline int
ACE_Handle_Gobbler::consume_handles (size_t n_handles_to_keep_available)
{
int result = 0;
+
#if defined(ACE_WIN32)
// On Win32, this style of gobbling doesn't seem to work.
ACE_UNUSED_ARG(n_handles_to_keep_available);
+
#else
+
while (1)
{
ACE_HANDLE handle = ACE_OS::open (ACE_DEV_NULL, O_WRONLY);
+
if (handle == ACE_INVALID_HANDLE)
{
if (ACE::out_of_handles (errno))
@@ -57,7 +69,10 @@ ACE_Handle_Gobbler::consume_handles (size_t n_handles_to_keep_available)
break;
this->handle_set_.set_bit (handle);
}
+
#endif /* ACE_WIN32 */
+
return result;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Handle_Ops.cpp b/dep/ACE_wrappers/ace/Handle_Ops.cpp
index b722edeb02d..213fa933d7a 100644
--- a/dep/ACE_wrappers/ace/Handle_Ops.cpp
+++ b/dep/ACE_wrappers/ace/Handle_Ops.cpp
@@ -1,13 +1,18 @@
// $Id: Handle_Ops.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Handle_Ops.h"
+
#include "ace/OS_NS_errno.h"
#include "ace/OS_NS_fcntl.h"
#include "ace/Time_Value.h"
+
ACE_RCSID (ace,
Handle_Ops,
"$Id: Handle_Ops.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_HANDLE
ACE::handle_timed_open (ACE_Time_Value *timeout,
const ACE_TCHAR *name,
@@ -16,6 +21,7 @@ ACE::handle_timed_open (ACE_Time_Value *timeout,
LPSECURITY_ATTRIBUTES sa)
{
ACE_TRACE ("ACE::handle_timed_open");
+
if (timeout != 0)
{
#if !defined (ACE_WIN32)
@@ -23,17 +29,21 @@ ACE::handle_timed_open (ACE_Time_Value *timeout,
// don't use it there
flags |= ACE_NONBLOCK;
#endif /* ACE_WIN32 */
+
// Open the named pipe or file using non-blocking mode...
ACE_HANDLE const handle = ACE_OS::open (name, flags, perms, sa);
+
if (handle == ACE_INVALID_HANDLE
&& (errno == EWOULDBLOCK
&& (timeout->sec () > 0 || timeout->usec () > 0)))
// This expression checks if we were polling.
errno = ETIMEDOUT;
+
return handle;
}
else
return ACE_OS::open (name, flags, perms, sa);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Handle_Ops.h b/dep/ACE_wrappers/ace/Handle_Ops.h
index 771b7a179c0..16ee852725d 100644
--- a/dep/ACE_wrappers/ace/Handle_Ops.h
+++ b/dep/ACE_wrappers/ace/Handle_Ops.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Handle_Ops.h
@@ -8,16 +9,24 @@
* Handle operations.
*/
//=============================================================================
+
#ifndef ACE_HANDLE_OPS_H
#define ACE_HANDLE_OPS_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Global_Macros.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Time_Value;
+
// = Operations on HANDLEs.
namespace ACE
{
@@ -33,7 +42,10 @@ namespace ACE
int perms,
LPSECURITY_ATTRIBUTES sa = 0);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
+
#endif /* ACE_HANDLE_OPS_H */
diff --git a/dep/ACE_wrappers/ace/Handle_Set.cpp b/dep/ACE_wrappers/ace/Handle_Set.cpp
index 4802c3c6406..288d0010169 100644
--- a/dep/ACE_wrappers/ace/Handle_Set.cpp
+++ b/dep/ACE_wrappers/ace/Handle_Set.cpp
@@ -1,13 +1,20 @@
// Handle_Set.cpp
// $Id: Handle_Set.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Handle_Set.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Handle_Set.inl"
#endif /* __ACE_INLINE__ */
+
#include "ace/OS_NS_string.h"
+
ACE_RCSID(ace, Handle_Set, "$Id: Handle_Set.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_Handle_Set)
+
// ACE_MSB_MASK is only used here.
// This needs to go here to avoid overflow problems on some compilers.
#if defined (ACE_WIN32)
@@ -16,25 +23,31 @@ ACE_ALLOC_HOOK_DEFINE(ACE_Handle_Set)
#else /* ! ACE_WIN32 */
# define ACE_MSB_MASK (~((fd_mask) 1 << (NFDBITS - 1)))
#endif /* ! ACE_WIN32 */
+
#if defined (__BORLANDC__) && !defined (ACE_WIN32)
// The Borland C++ compiler on Linux also doesn't have fds_bits, but has __fds_bits.
#define fds_bits __fds_bits
#endif
+
#if defined (linux) && __GLIBC__ > 1 && __GLIBC_MINOR__ >= 1 && !defined (_XOPEN_SOURCE)
// XPG4.2 requires the fds_bits member name, so it is not enabled by
// default on Linux/glibc-2.1.x systems. Instead use "__fds_bits."
// Ugly, but "what are you going to do?" 8-)
#define fds_bits __fds_bits
#endif /* linux && __GLIBC__ > 1 && __GLIBC_MINOR__ >= 1 && !_XOPEN_SOURCE */
+
void
ACE_Handle_Set::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_Handle_Set::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
+
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nsize_ = %d"), this->size_));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nmax_handle_ = %d"), this->max_handle_));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n[ ")));
+
#if defined (ACE_WIN32)
for (size_t i = 0; i < (size_t) this->mask_.fd_count + 1; i++)
ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" %x "), this->mask_.fd_array[i]));
@@ -43,10 +56,12 @@ ACE_Handle_Set::dump (void) const
if (this->is_set (i))
ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" %d "), i));
#endif /* ACE_WIN32 */
+
ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" ]\n")));
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
// Table that maps bytes to counts of the enabled bits in each value
// from 0 to 255,
//
@@ -58,6 +73,7 @@ ACE_Handle_Set::dump (void) const
//
// because there are 2 bits enabled in the value 5, i.e., it's
// 101 in binary.
+
const char ACE_Handle_Set::nbits_[256] =
{
0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4,
@@ -76,12 +92,15 @@ const char ACE_Handle_Set::nbits_[256] =
3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8};
+
// Constructor, initializes the bitmask to all 0s.
+
ACE_Handle_Set::ACE_Handle_Set (void)
{
ACE_TRACE ("ACE_Handle_Set::ACE_Handle_Set");
this->reset ();
}
+
ACE_Handle_Set::ACE_Handle_Set (const fd_set &fd_mask)
{
ACE_TRACE ("ACE_Handle_Set::ACE_Handle_Set");
@@ -96,20 +115,26 @@ ACE_Handle_Set::ACE_Handle_Set (const fd_set &fd_mask)
#endif /* ACE_HAS_BIG_FD_SET */
#endif /* !ACE_WIN32 */
}
+
// Counts the number of bits enabled in N. Uses a table lookup to
// speed up the count.
+
int
ACE_Handle_Set::count_bits (u_long n)
{
+
ACE_TRACE ("ACE_Handle_Set::count_bits");
#if defined (ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT)
register int rval = 0;
+
// Count the number of enabled bits in <n>. This algorithm is very
// fast, i.e., O(enabled bits in n).
+
for (register u_long m = n;
m != 0;
m &= m - 1)
rval++;
+
return rval;
#else
return (ACE_Handle_Set::nbits_[n & 0xff]
@@ -118,26 +143,32 @@ ACE_Handle_Set::count_bits (u_long n)
+ ACE_Handle_Set::nbits_[(n >> 24) & 0xff]);
#endif /* ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT */
}
+
#if defined (ACE_HAS_BIG_FD_SET)
// Find the bit position counting from right to left worst case
// (1<<31) is 8.
+
int
ACE_Handle_Set::bitpos (u_long bit)
{
register int l = 0;
register u_long n = bit - 1;
+
// This is a fast count method when have the most significative bit.
+
while (n >> 8)
{
n >>= 8;
l += 8;
}
+
// Is greater than 15?
if (n & 16)
{
n >>= 4;
l += 4;
}
+
// Count number remaining bits.
while (n != 0)
{
@@ -147,7 +178,9 @@ ACE_Handle_Set::bitpos (u_long bit)
return l;
}
#endif /* ACE_HAS_BIG_FD_SET */
+
// Synchronize the underlying FD_SET with the MAX_FD and the SIZE.
+
#if defined (ACE_USE_SHIFT_FOR_EFFICIENCY)
// These don't work because shifting right 3 bits is not the same as
// dividing by 3, e.g., dividing by 8 requires shifting right 3 bits.
@@ -159,6 +192,7 @@ ACE_Handle_Set::bitpos (u_long bit)
#define ACE_DIV_BY_WORDSIZE(x) ((x) / ((int) ACE_Handle_Set::WORDSIZE))
#define ACE_MULT_BY_WORDSIZE(x) ((x) * ((int) ACE_Handle_Set::WORDSIZE))
#endif /* ACE_USE_SHIFT_FOR_EFFICIENCY */
+
void
ACE_Handle_Set::sync (ACE_HANDLE max)
{
@@ -166,27 +200,33 @@ ACE_Handle_Set::sync (ACE_HANDLE max)
#if !defined (ACE_WIN32)
fd_mask *maskp = (fd_mask *)(this->mask_.fds_bits);
this->size_ = 0;
+
for (int i = ACE_DIV_BY_WORDSIZE (max - 1);
i >= 0;
i--)
this->size_ += ACE_Handle_Set::count_bits (maskp[i]);
+
this->set_max (max);
#else
ACE_UNUSED_ARG (max);
#endif /* !ACE_WIN32 */
}
+
// Resets the MAX_FD after a clear of the original MAX_FD.
+
void
ACE_Handle_Set::set_max (ACE_HANDLE current_max)
{
ACE_TRACE ("ACE_Handle_Set::set_max");
#if !defined(ACE_WIN32)
fd_mask * maskp = (fd_mask *)(this->mask_.fds_bits);
+
if (this->size_ == 0)
this->max_handle_ = ACE_INVALID_HANDLE;
else
{
int i;
+
for (i = ACE_DIV_BY_WORDSIZE (current_max - 1);
maskp[i] == 0;
i--)
@@ -210,6 +250,7 @@ ACE_Handle_Set::set_max (ACE_HANDLE current_max)
+ ACE_Handle_Set::bitpos(val & ~(val - 1));
#endif /* 1 */
}
+
// Do some sanity checking...
if (this->max_handle_ >= ACE_Handle_Set::MAXSIZE)
this->max_handle_ = ACE_Handle_Set::MAXSIZE - 1;
@@ -217,12 +258,15 @@ ACE_Handle_Set::set_max (ACE_HANDLE current_max)
ACE_UNUSED_ARG (current_max);
#endif /* !ACE_WIN32 */
}
+
ACE_ALLOC_HOOK_DEFINE(ACE_Handle_Set_Iterator)
+
void
ACE_Handle_Set_Iterator::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_Handle_Set_Iterator::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
#if defined(ACE_WIN32) || !defined(ACE_HAS_BIG_FD_SET)
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nhandle_index_ = %d"), this->handle_index_));
@@ -234,6 +278,7 @@ ACE_Handle_Set_Iterator::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
ACE_HANDLE
ACE_Handle_Set_Iterator::operator () (void)
{
@@ -244,9 +289,11 @@ ACE_Handle_Set_Iterator::operator () (void)
return (ACE_HANDLE) this->handles_.mask_.fd_array[this->handle_index_++];
else
return ACE_INVALID_HANDLE;
+
#elif !defined (ACE_HAS_BIG_FD_SET) /* !ACE_WIN32 */
// No sense searching further than the max_handle_ + 1;
ACE_HANDLE maxhandlep1 = this->handles_.max_handle_ + 1;
+
// HP-UX 11 plays some games with the fd_mask type - fd_mask is
// defined as an int_32t, but the fds_bits is an array of longs.
// This makes plainly indexing through the array by hand tricky,
@@ -258,6 +305,7 @@ ACE_Handle_Set_Iterator::operator () (void)
// this amounts to practically a NOP, since this is what would have
// been done anyway, without all this type jazz.
fd_mask * maskp = (fd_mask *)(this->handles_.mask_.fds_bits);
+
if (this->handle_index_ >= maxhandlep1)
// We've seen all the handles we're interested in seeing for this
// iterator.
@@ -265,6 +313,7 @@ ACE_Handle_Set_Iterator::operator () (void)
else
{
ACE_HANDLE result = this->handle_index_;
+
// Increment the iterator and advance to the next bit in this
// word.
this->handle_index_++;
@@ -274,18 +323,22 @@ ACE_Handle_Set_Iterator::operator () (void)
# else
this->word_val_ = (this->word_val_ >> 1) & ACE_MSB_MASK;
# endif /* ACE_TANDEM_NSK_BIT_ORDER */
+
// If we've examined all the bits in this word, we'll go onto
// the next word.
+
if (this->word_val_ == 0)
{
// Start the handle_index_ at the beginning of the next word
// and then loop until we've found the first non-zero bit or
// we run past the <maxhandlep1> of the bitset.
+
for (this->handle_index_ = ACE_MULT_BY_WORDSIZE(++this->word_num_);
this->handle_index_ < maxhandlep1
&& maskp[this->word_num_] == 0;
this->word_num_++)
this->handle_index_ += ACE_Handle_Set::WORDSIZE;
+
// If the bit index becomes >= the maxhandlep1 that means
// there weren't any more bits set that we want to consider.
// Therefore, we'll just store the maxhandlep1, which will
@@ -300,10 +353,12 @@ ACE_Handle_Set_Iterator::operator () (void)
// Load the bits of the next word.
this->word_val_ = maskp[this->word_num_];
}
+
// Loop until we get <word_val_> to have its least significant
// bit enabled, keeping track of which <handle_index> this
// represents (this information is used by subsequent calls to
// <operator()>).
+
#if defined (ACE_TANDEM_NSK_BIT_ORDER)
// bits are in reverse order, MSB (sign bit) = bit 0.
for (;
@@ -316,11 +371,13 @@ ACE_Handle_Set_Iterator::operator () (void)
this->handle_index_++)
this->word_val_ = (this->word_val_ >> 1) & ACE_MSB_MASK;
# endif /* ACE_TANDEM_NSK_BIT_ORDER */
+
return result;
}
#else /* !ACE_HAS_BIG_FD_SET */
// Find the first word in fds_bits with bit on
register u_long lsb = this->word_val_;
+
if (lsb == 0)
{
do
@@ -328,19 +385,26 @@ ACE_Handle_Set_Iterator::operator () (void)
// We have exceeded the word count in Handle_Set?
if (++this->word_num_ >= this->word_max_)
return ACE_INVALID_HANDLE;
+
lsb = this->handles_.mask_.fds_bits[this->word_num_];
}
while (lsb == 0);
+
// Set index to word boundary.
this->handle_index_ = ACE_MULT_BY_WORDSIZE (this->word_num_);
+
// Put new word_val.
this->word_val_ = lsb;
+
// Find the least significative bit.
lsb &= ~(lsb - 1);
+
// Remove least significative bit.
this->word_val_ ^= lsb;
+
// Save to calculate bit distance.
this->oldlsb_ = lsb;
+
// Move index to least significative bit.
while (lsb >>= 1)
this->handle_index_++;
@@ -349,9 +413,12 @@ ACE_Handle_Set_Iterator::operator () (void)
{
// Find the least significative bit.
lsb &= ~(lsb - 1);
+
// Remove least significative bit.
this->word_val_ ^= lsb;
+
register u_long n = lsb - this->oldlsb_;
+
// Move index to bit distance between new lsb and old lsb.
do
{
@@ -359,11 +426,14 @@ ACE_Handle_Set_Iterator::operator () (void)
n &= n >> 1;
}
while (n != 0);
+
this->oldlsb_ = lsb;
}
+
return this->handle_index_;
#endif /* ACE_WIN32 */
}
+
ACE_Handle_Set_Iterator::ACE_Handle_Set_Iterator (const ACE_Handle_Set &hs)
: handles_ (hs),
#if !defined (ACE_HAS_BIG_FD_SET) || defined (ACE_WIN32)
@@ -381,13 +451,16 @@ ACE_Handle_Set_Iterator::ACE_Handle_Set_Iterator (const ACE_Handle_Set &hs)
// No sense searching further than the max_handle_ + 1;
ACE_HANDLE maxhandlep1 =
this->handles_.max_handle_ + 1;
+
fd_mask *maskp =
(fd_mask *)(this->handles_.mask_.fds_bits);
+
// Loop until we've found the first non-zero bit or we run past the
// <maxhandlep1> of the bitset.
while (this->handle_index_ < maxhandlep1
&& maskp[++this->word_num_] == 0)
this->handle_index_ += ACE_Handle_Set::WORDSIZE;
+
// If the bit index becomes >= the maxhandlep1 that means there
// weren't any bits set. Therefore, we'll just store the
// maxhandlep1, which will cause <operator()> to return
@@ -426,10 +499,12 @@ ACE_Handle_Set_Iterator::ACE_Handle_Set_Iterator (const ACE_Handle_Set &hs)
#endif /* !ACE_WIN32 && !ACE_HAS_BIG_FD_SET */
}
+
void
ACE_Handle_Set_Iterator::reset_state (void)
{
ACE_TRACE ("ACE_Handle_Set_Iterator::reset_state");
+
#if !defined (ACE_HAS_BIG_FD_SET) || defined (ACE_WIN32)
this->handle_index_ = 0;
this->word_num_ = -1;
@@ -439,17 +514,21 @@ ACE_Handle_Set_Iterator::reset_state (void)
this->handles_.max_handle_ == ACE_INVALID_HANDLE ? 0
: ((ACE_DIV_BY_WORDSIZE (this->handles_.max_handle_)) + 1);
#endif /* ACE_HAS_BIG_FD_SET */
+
#if !defined (ACE_WIN32) && !defined (ACE_HAS_BIG_FD_SET)
// No sense searching further than the max_handle_ + 1;
ACE_HANDLE maxhandlep1 =
this->handles_.max_handle_ + 1;
+
fd_mask *maskp =
(fd_mask *)(this->handles_.mask_.fds_bits);
+
// Loop until we've found the first non-zero bit or we run past the
// <maxhandlep1> of the bitset.
while (this->handle_index_ < maxhandlep1
&& maskp[++this->word_num_] == 0)
this->handle_index_ += ACE_Handle_Set::WORDSIZE;
+
// If the bit index becomes >= the maxhandlep1 that means there
// weren't any bits set. Therefore, we'll just store the
// maxhandlep1, which will cause <operator()> to return
@@ -487,5 +566,6 @@ ACE_Handle_Set_Iterator::reset_state (void)
}
#endif /* !ACE_WIN32 && !ACE_HAS_BIG_FD_SET */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Handle_Set.h b/dep/ACE_wrappers/ace/Handle_Set.h
index 148316f8445..6e33055b4f6 100644
--- a/dep/ACE_wrappers/ace/Handle_Set.h
+++ b/dep/ACE_wrappers/ace/Handle_Set.h
@@ -1,4 +1,5 @@
/* -*- C++ -*- */
+
//=============================================================================
/**
* @file Handle_Set.h
@@ -8,28 +9,37 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_HANDLE_SET_H
#define ACE_HANDLE_SET_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/sys/os_select.h"
#include "ace/os_include/os_limits.h"
+
#if defined (__QNX__)
typedef long fd_mask;
#endif /* __QNX__ */
+
// Default size of the ACE Reactor.
#if defined (FD_SETSIZE)
int const ACE_FD_SETSIZE = FD_SETSIZE;
#else /* !FD_SETSIZE */
# define ACE_FD_SETSIZE FD_SETSIZE
#endif /* ACE_FD_SETSIZE */
+
#if !defined (ACE_DEFAULT_SELECT_REACTOR_SIZE)
# define ACE_DEFAULT_SELECT_REACTOR_SIZE ACE_FD_SETSIZE
#endif /* ACE_DEFAULT_SELECT_REACTOR_SIZE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Handle_Set
*
@@ -44,37 +54,48 @@ class ACE_Export ACE_Handle_Set
{
public:
friend class ACE_Handle_Set_Iterator;
+
// = Initialization and termination.
+
enum
{
MAXSIZE = ACE_DEFAULT_SELECT_REACTOR_SIZE
};
+
// = Initialization methods.
/// Constructor, initializes the bitmask to all 0s.
ACE_Handle_Set (void);
+
/**
* Constructor, initializes the handle set from a given mask.
*/
ACE_Handle_Set (const fd_set &mask);
+
// = Methods for manipulating bitsets.
/// Initialize the bitmask to all 0s and reset the associated fields.
void reset (void);
+
/**
* Checks whether @a handle is enabled. No range checking is
* performed so @a handle must be less than
* @c ACE_DEFAULT_SELECT_REACTOR_SIZE.
*/
int is_set (ACE_HANDLE handle) const;
+
/// Enables the @a handle. No range checking is performed so @a handle
/// must be less than @c ACE_DEFAULT_SELECT_REACTOR_SIZE.
void set_bit (ACE_HANDLE handle);
+
/// Disables the @a handle. No range checking is performed so
/// @a handle must be less than @c ACE_DEFAULT_SELECT_REACTOR_SIZE.
void clr_bit (ACE_HANDLE handle);
+
/// Returns a count of the number of enabled bits.
int num_set (void) const;
+
/// Returns the number of the large bit.
ACE_HANDLE max_set (void) const;
+
/**
* Rescan the underlying @c fd_set up to handle @a max to find the new
* <max_handle> (highest bit set) and <size> (how many bits set) values.
@@ -83,31 +104,41 @@ public:
* after <select> modifies the @c fd_set.
*/
void sync (ACE_HANDLE max);
+
/// Returns a pointer to the underlying @c fd_set. Returns 0 if
/// there are no handle bits set (<size_> == 0).
operator fd_set *();
+
/// Returns a pointer to the underlying @c fd_set. Returns 0 if
/// there are no handle bits set (<size_> == 0).
fd_set *fdset (void);
+
#if defined (ACE_HAS_BIG_FD_SET)
/// Assignment operator optimizes for cases where <size_> == 0.
ACE_Handle_Set & operator= (const ACE_Handle_Set &);
#endif /* ACE_HAS_BIG_FD_SET */
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Size of the set, i.e., a count of the number of enabled bits.
int size_;
+
/// Current max handle.
ACE_HANDLE max_handle_;
+
#if defined (ACE_HAS_BIG_FD_SET)
/// Current min handle.
ACE_HANDLE min_handle_;
#endif /* ACE_HAS_BIG_FD_SET */
+
/// Bitmask.
fd_set mask_;
+
enum
{
WORDSIZE = NFDBITS,
@@ -116,20 +147,25 @@ private:
#endif /* ACE_WIN32 */
NBITS = 256
};
+
/// Counts the number of bits enabled in N. Uses a table lookup to
/// speed up the count.
static int count_bits (u_long n);
+
#if defined (ACE_HAS_BIG_FD_SET)
/// Find the position of the bit counting from right to left.
static int bitpos (u_long bit);
#endif /* ACE_HAS_BIG_FD_SET */
+
/// Resets the <max_handle_> after a clear of the original
/// <max_handle_>.
void set_max (ACE_HANDLE max);
+
/// Table that maps bytes to counts of the enabled bits in each value
/// from 0 to 255.
static const char nbits_[NBITS];
};
+
/**
* @class ACE_Handle_Set_Iterator
*
@@ -140,11 +176,14 @@ class ACE_Export ACE_Handle_Set_Iterator
public:
/// Constructor.
ACE_Handle_Set_Iterator (const ACE_Handle_Set &hs);
+
/// Default dtor.
~ACE_Handle_Set_Iterator (void);
+
/// Reset the state of the iterator by reinitializing the state
/// that we maintain.
void reset_state (void);
+
/**
* "Next" operator. Returns the next unseen ACE_HANDLE in the
* <Handle_Set> up to <handle_set_.max_handle_>). When all the
@@ -153,13 +192,17 @@ public:
* (which is now obsolete).
*/
ACE_HANDLE operator () (void);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// The <Handle_Set> we are iterating through.
const ACE_Handle_Set &handles_;
+
/// Index of the bit we're examining in the current <word_num_> word.
#if defined (ACE_WIN32)
u_int handle_index_;
@@ -169,12 +212,15 @@ private:
int handle_index_;
u_long oldlsb_;
#endif /* ACE_WIN32 */
+
/// Number of the word we're iterating over (typically between 0..7).
int word_num_;
+
#if defined (ACE_HAS_BIG_FD_SET)
/// Number max of the words with a possible bit on.
int word_max_;
#endif /* ACE_HAS_BIG_FD_SET */
+
#if !defined (ACE_WIN32) && !defined (ACE_HAS_BIG_FD_SET)
/// Value of the bits in the word we're iterating on.
fd_mask word_val_;
@@ -183,10 +229,13 @@ private:
u_long word_val_;
#endif /* !ACE_WIN32 && !ACE_HAS_BIG_FD_SET */
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Handle_Set.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_HANDLE_SET */
diff --git a/dep/ACE_wrappers/ace/Handle_Set.inl b/dep/ACE_wrappers/ace/Handle_Set.inl
index c7087527918..7e669d4fd2d 100644
--- a/dep/ACE_wrappers/ace/Handle_Set.inl
+++ b/dep/ACE_wrappers/ace/Handle_Set.inl
@@ -1,22 +1,30 @@
// -*- C++ -*-
//
// $Id: Handle_Set.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Log_Msg.h"
+
// todo: This should be cleaned up a bit.
// memset for FD_ZERO on OpenBSD and Solaris w/ gcc 2.95.3
#include "ace/os_include/os_string.h"
+
// FreeBSD 4.8-RC? for bzero() used by FD_ZERO
#include "ace/os_include/os_strings.h"
+
// IRIX5 defines bzero() in this odd file... used by FD_ZERO
#if defined (ACE_HAS_BSTRING)
# include /**/ <bstring.h>
#endif /* ACE_HAS_BSTRING */
+
// AIX defines bzero() in this odd file... used by FD_ZERO
#if defined (ACE_HAS_STRINGS)
# include "ace/os_include/os_strings.h"
#endif /* ACE_HAS_STRINGS */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Initialize the bitmask to all 0s and reset the associated fields.
+
ACE_INLINE void
ACE_Handle_Set::reset (void)
{
@@ -32,11 +40,13 @@ ACE_Handle_Set::reset (void)
FD_ZERO (&this->mask_);
// #endif /* ACE_HAS_BIG_FD_SET */
}
+
#if defined (ACE_HAS_BIG_FD_SET)
ACE_INLINE ACE_Handle_Set &
ACE_Handle_Set::operator = (const ACE_Handle_Set &rhs)
{
ACE_TRACE ("ACE_Handle_Set::operator =");
+
if (rhs.size_ > 0)
{
this->size_ =
@@ -50,17 +60,22 @@ ACE_Handle_Set::operator = (const ACE_Handle_Set &rhs)
}
else
this->reset ();
+
return *this;
}
#endif /* ACE_HAS_BIG_FD_SET */
+
// Returns the number of the large bit.
+
ACE_INLINE ACE_HANDLE
ACE_Handle_Set::max_set (void) const
{
ACE_TRACE ("ACE_Handle_Set::max_set");
return this->max_handle_;
}
+
// Checks whether handle is enabled.
+
ACE_INLINE int
ACE_Handle_Set::is_set (ACE_HANDLE handle) const
{
@@ -77,7 +92,9 @@ ACE_Handle_Set::is_set (ACE_HANDLE handle) const
&this->mask_);
#endif /* ACE_HAS_BIG_FD_SET */
}
+
// Enables the handle.
+
ACE_INLINE void
ACE_Handle_Set::set_bit (ACE_HANDLE handle)
{
@@ -93,35 +110,44 @@ ACE_Handle_Set::set_bit (ACE_HANDLE handle)
#if defined (ACE_HAS_BIG_FD_SET)
if (this->size_ == 0)
FD_ZERO (&this->mask_);
+
if (handle < this->min_handle_)
this->min_handle_ = handle;
#endif /* ACE_HAS_BIG_FD_SET */
+
FD_SET (handle,
&this->mask_);
++this->size_;
+
if (handle > this->max_handle_)
this->max_handle_ = handle;
#endif /* ACE_WIN32 */
}
}
+
// Disables the handle.
+
ACE_INLINE void
ACE_Handle_Set::clr_bit (ACE_HANDLE handle)
{
ACE_TRACE ("ACE_Handle_Set::clr_bit");
+
if ((handle != ACE_INVALID_HANDLE) &&
(this->is_set (handle)))
{
FD_CLR ((ACE_SOCKET) handle,
&this->mask_);
--this->size_;
+
#if !defined (ACE_WIN32)
if (handle == this->max_handle_)
this->set_max (this->max_handle_);
#endif /* !ACE_WIN32 */
}
}
+
// Returns a count of the number of enabled bits.
+
ACE_INLINE int
ACE_Handle_Set::num_set (void) const
{
@@ -132,28 +158,36 @@ ACE_Handle_Set::num_set (void) const
return this->size_;
#endif /* ACE_WIN32 */
}
+
// Returns a pointer to the underlying fd_set.
+
ACE_INLINE
ACE_Handle_Set::operator fd_set *()
{
ACE_TRACE ("ACE_Handle_Set::operator fd_set *");
+
if (this->size_ > 0)
return (fd_set *) &this->mask_;
else
return (fd_set *) 0;
}
+
// Returns a pointer to the underlying fd_set.
+
ACE_INLINE fd_set *
ACE_Handle_Set::fdset (void)
{
ACE_TRACE ("ACE_Handle_Set::fdset");
+
if (this->size_ > 0)
return (fd_set *) &this->mask_;
else
return (fd_set *) 0;
}
+
ACE_INLINE
ACE_Handle_Set_Iterator::~ACE_Handle_Set_Iterator (void)
{
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Hash_Cache_Map_Manager_T.h b/dep/ACE_wrappers/ace/Hash_Cache_Map_Manager_T.h
index fdff0bd1c53..5326c97d33f 100644
--- a/dep/ACE_wrappers/ace/Hash_Cache_Map_Manager_T.h
+++ b/dep/ACE_wrappers/ace/Hash_Cache_Map_Manager_T.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Hash_Cache_Map_Manager_T.h
@@ -9,18 +10,26 @@
*/
//=============================================================================
+
#ifndef HASH_CACHE_MAP_MANAGER_T_H
#define HASH_CACHE_MAP_MANAGER_T_H
+
#include /**/ "ace/pre.h"
+
#include "ace/Hash_Map_Manager_T.h"
#include "ace/Cache_Map_Manager_T.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
#pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Null_Mutex.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward declaration.
class ACE_Allocator;
+
#define ACE_CACHE_MAP_MANAGER \
ACE_Cache_Map_Manager<KEY, \
VALUE, \
@@ -29,8 +38,10 @@ class ACE_Allocator;
ACE_Hash_Map_Reverse_Iterator_Ex<KEY, ACE_Pair<VALUE, ATTRIBUTES>, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex>, \
CACHING_STRATEGY, \
ATTRIBUTES>
+
// For linkers that cant grok long names.
#define ACE_Hash_Cache_Map_Manager AHCMM
+
/**
* @class ACE_Hash_Cache_Map_Manager
*
@@ -54,6 +65,7 @@ template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class CACH
class ACE_Hash_Cache_Map_Manager : public ACE_CACHE_MAP_MANAGER
{
public:
+
/**
* The actual value mapped to the key in the map. The <attributes>
* are used by the strategy and is transparent to the user of this
@@ -64,14 +76,17 @@ class ACE_Hash_Cache_Map_Manager : public ACE_CACHE_MAP_MANAGER
typedef ACE_Hash_Map_Entry<KEY, CACHE_VALUE> CACHE_ENTRY;
typedef KEY key_type;
typedef VALUE mapped_type;
+
// = Initialization and termination methods.
/// Initialize a <Hash_Cache_Map_Manager> with @a size entries.
ACE_Hash_Cache_Map_Manager (CACHING_STRATEGY &caching_s,
size_t size = ACE_DEFAULT_MAP_SIZE,
ACE_Allocator *alloc = 0);
+
/// Close down a <Cache_Map_Manager> and release dynamically allocated
/// resources.
~ACE_Hash_Cache_Map_Manager (void);
+
/**
* Associate @a key with @a value. If @a key is already in the
* MAP then the ENTRY is not changed. Returns 0 if a new entry is
@@ -80,6 +95,7 @@ class ACE_Hash_Cache_Map_Manager : public ACE_CACHE_MAP_MANAGER
*/
int bind (const KEY &key,
const VALUE &value);
+
/**
* Same as a normal bind, except the cache entry is also passed back
* to the caller. The entry in this case will either be the newly
@@ -88,14 +104,18 @@ class ACE_Hash_Cache_Map_Manager : public ACE_CACHE_MAP_MANAGER
int bind (const KEY &key,
const VALUE &value,
CACHE_ENTRY *&entry);
+
/// Loopkup entry<key,value> in the cache.
int find (const KEY &key,
VALUE &value);
+
/// Is @a key in the cache?
int find (const KEY &key);
+
/// Obtain the entry when the find succeeds.
int find (const KEY &key,
CACHE_ENTRY *&entry);
+
/**
* Reassociate the @a key with @a value. If the @a key already exists
* in the cache then returns 1, on a new bind returns 0 and returns
@@ -103,6 +123,7 @@ class ACE_Hash_Cache_Map_Manager : public ACE_CACHE_MAP_MANAGER
*/
int rebind (const KEY &key,
const VALUE &value);
+
/**
* Reassociate @a key with @a value, storing the old value into the
* "out" parameter @a old_value. The function fails if @a key is not
@@ -113,6 +134,7 @@ class ACE_Hash_Cache_Map_Manager : public ACE_CACHE_MAP_MANAGER
int rebind (const KEY &key,
const VALUE &value,
VALUE &old_value);
+
/**
* Reassociate @a key with @a value, storing the old key and value
* into the "out" parameters @a old_key and @a old_value. The
@@ -125,6 +147,7 @@ class ACE_Hash_Cache_Map_Manager : public ACE_CACHE_MAP_MANAGER
const VALUE &value,
KEY &old_key,
VALUE &old_value);
+
/**
* Same as a normal rebind, except the cache entry is also passed back
* to the caller. The entry in this case will either be the newly
@@ -133,6 +156,7 @@ class ACE_Hash_Cache_Map_Manager : public ACE_CACHE_MAP_MANAGER
int rebind (const KEY &key,
const VALUE &value,
CACHE_ENTRY *&entry);
+
/**
* Associate @a key with @a value if and only if @a key is not in the
* cache. If @a key is already in the cache, then the @a value parameter
@@ -143,6 +167,7 @@ class ACE_Hash_Cache_Map_Manager : public ACE_CACHE_MAP_MANAGER
*/
int trybind (const KEY &key,
VALUE &value);
+
/**
* Same as a normal trybind, except the cache entry is also passed
* back to the caller. The entry in this case will either be the
@@ -151,29 +176,40 @@ class ACE_Hash_Cache_Map_Manager : public ACE_CACHE_MAP_MANAGER
int trybind (const KEY &key,
VALUE &value,
CACHE_ENTRY *&entry);
+
/// Remove @a key from the cache.
int unbind (const KEY &key);
+
/// Remove @a key from the cache, and return the @a value associated with
/// @a key.
int unbind (const KEY &key,
VALUE &value);
+
/// Remove entry from map.
int unbind (CACHE_ENTRY *entry);
+
protected:
+
/// Base class.
typedef ACE_CACHE_MAP_MANAGER ACE_HCMM_BASE;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Hash_Cache_Map_Manager_T.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Hash_Cache_Map_Manager_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Hash_Cache_Map_Manager_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
+
#endif /* HASH_CACHE_MAP_MANAGER_T_H */
diff --git a/dep/ACE_wrappers/ace/Hash_Cache_Map_Manager_T.inl b/dep/ACE_wrappers/ace/Hash_Cache_Map_Manager_T.inl
index 161f1c6bf7d..f097bb7e073 100644
--- a/dep/ACE_wrappers/ace/Hash_Cache_Map_Manager_T.inl
+++ b/dep/ACE_wrappers/ace/Hash_Cache_Map_Manager_T.inl
@@ -1,9 +1,12 @@
// -*- C++ -*-
//
// $Id: Hash_Cache_Map_Manager_T.inl 80826 2008-03-04 14:51:23Z wotte $
+
#define ACE_T1 class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class CACHING_STRATEGY, class ATTRIBUTES
#define ACE_T2 KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template <ACE_T1> ACE_INLINE int
ACE_Hash_Cache_Map_Manager<ACE_T2>::bind (const KEY &key,
const VALUE &value)
@@ -11,6 +14,7 @@ ACE_Hash_Cache_Map_Manager<ACE_T2>::bind (const KEY &key,
return ACE_HCMM_BASE::bind (key,
value);
}
+
template <ACE_T1> ACE_INLINE int
ACE_Hash_Cache_Map_Manager<ACE_T2>::rebind (const KEY &key,
const VALUE &value)
@@ -18,6 +22,7 @@ ACE_Hash_Cache_Map_Manager<ACE_T2>::rebind (const KEY &key,
return ACE_HCMM_BASE::rebind (key,
value);
}
+
template <ACE_T1> ACE_INLINE int
ACE_Hash_Cache_Map_Manager<ACE_T2>::rebind (const KEY &key,
const VALUE &value,
@@ -27,6 +32,7 @@ ACE_Hash_Cache_Map_Manager<ACE_T2>::rebind (const KEY &key,
value,
old_value);
}
+
template <ACE_T1> ACE_INLINE int
ACE_Hash_Cache_Map_Manager<ACE_T2>::rebind (const KEY &key,
const VALUE &value,
@@ -38,6 +44,7 @@ ACE_Hash_Cache_Map_Manager<ACE_T2>::rebind (const KEY &key,
old_key,
old_value);
}
+
template <ACE_T1> ACE_INLINE int
ACE_Hash_Cache_Map_Manager<ACE_T2>::trybind (const KEY &key,
VALUE &value)
@@ -45,11 +52,13 @@ ACE_Hash_Cache_Map_Manager<ACE_T2>::trybind (const KEY &key,
return ACE_HCMM_BASE::trybind (key,
value);
}
+
template <ACE_T1> ACE_INLINE int
ACE_Hash_Cache_Map_Manager<ACE_T2>::unbind (const KEY &key)
{
return ACE_HCMM_BASE::unbind (key);
}
+
template <ACE_T1> ACE_INLINE int
ACE_Hash_Cache_Map_Manager<ACE_T2>::unbind (const KEY &key,
VALUE &value)
@@ -57,6 +66,8 @@ ACE_Hash_Cache_Map_Manager<ACE_T2>::unbind (const KEY &key,
return ACE_HCMM_BASE::unbind (key,
value);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#undef ACE_T1
#undef ACE_T2
diff --git a/dep/ACE_wrappers/ace/Hash_Map_Manager.h b/dep/ACE_wrappers/ace/Hash_Map_Manager.h
index abef18a5509..0e253eb4cb9 100644
--- a/dep/ACE_wrappers/ace/Hash_Map_Manager.h
+++ b/dep/ACE_wrappers/ace/Hash_Map_Manager.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Hash_Map_Manager.h
@@ -10,15 +11,22 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_HASH_MAP_MANAGER_H
#define ACE_HASH_MAP_MANAGER_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
// Include the templates here.
#include "ace/Hash_Map_Manager_T.h"
+
#include /**/ "ace/post.h"
+
#endif /* ACE_HASH_MAP_MANAGER_H */
diff --git a/dep/ACE_wrappers/ace/Hash_Map_Manager_T.h b/dep/ACE_wrappers/ace/Hash_Map_Manager_T.h
index d5a1f4a2083..9ef8e23c7ea 100644
--- a/dep/ACE_wrappers/ace/Hash_Map_Manager_T.h
+++ b/dep/ACE_wrappers/ace/Hash_Map_Manager_T.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Hash_Map_Manager_T.h
@@ -8,18 +9,24 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_HASH_MAP_MANAGER_T_H
#define ACE_HASH_MAP_MANAGER_T_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Default_Constants.h"
#include "ace/Functor_T.h"
#include "ace/Log_Msg.h"
#include <iterator>
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Hash_Map_Entry
*
@@ -35,51 +42,69 @@ public:
const INT_ID &int_id,
ACE_Hash_Map_Entry<EXT_ID, INT_ID> *next = 0,
ACE_Hash_Map_Entry<EXT_ID, INT_ID> *prev = 0);
+
/// Constructor.
ACE_Hash_Map_Entry (ACE_Hash_Map_Entry<EXT_ID, INT_ID> *next,
ACE_Hash_Map_Entry<EXT_ID, INT_ID> *prev);
+
/// Destructor.
~ACE_Hash_Map_Entry (void);
+
/// Key accessor.
EXT_ID& key (void);
+
/// Item accessor.
INT_ID& item (void);
+
/// Key used to look up an entry.
/// @deprecated Use key()
EXT_ID ext_id_;
+
/// The contents of the entry itself.
/// @deprecated Use item()
INT_ID int_id_;
+
/// Pointer to the next item in the bucket of overflow nodes.
ACE_Hash_Map_Entry<EXT_ID, INT_ID> *next_;
+
/// Pointer to the prev item in the bucket of overflow nodes.
ACE_Hash_Map_Entry<EXT_ID, INT_ID> *prev_;
+
/// Dump the state of an object.
void dump (void) const;
};
+
// Forward decl.
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
class ACE_Hash_Map_Iterator_Base_Ex;
+
// Forward decl.
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
class ACE_Hash_Map_Const_Iterator_Base_Ex;
+
// Forward decl.
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
class ACE_Hash_Map_Iterator_Ex;
+
// Forward decl.
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
class ACE_Hash_Map_Const_Iterator_Ex;
+
// Forward decl.
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
class ACE_Hash_Map_Reverse_Iterator_Ex;
+
// Forward decl.
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
class ACE_Hash_Map_Const_Reverse_Iterator_Ex;
+
// Forward decl.
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
class ACE_Hash_Map_Bucket_Iterator;
+
// Forward decl.
class ACE_Allocator;
+
/**
* @class ACE_Hash_Map_Manager_Ex
*
@@ -93,6 +118,7 @@ class ACE_Allocator;
* user can make this a persistent class by providing an
* ACE_Allocator with a persistable memory pool.
*/
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
class ACE_Hash_Map_Manager_Ex
{
@@ -104,6 +130,7 @@ public:
friend class ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>;
friend class ACE_Hash_Map_Const_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>;
friend class ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>;
+
typedef EXT_ID
KEY;
typedef INT_ID
@@ -111,6 +138,7 @@ public:
typedef ACE_LOCK lock_type;
typedef ACE_Hash_Map_Entry<EXT_ID, INT_ID>
ENTRY;
+
// = ACE-style iterator typedefs.
typedef ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>
ITERATOR;
@@ -120,6 +148,7 @@ public:
REVERSE_ITERATOR;
typedef ACE_Hash_Map_Const_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>
CONST_REVERSE_ITERATOR;
+
// = STL-style iterator typedefs.
typedef ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>
iterator;
@@ -129,6 +158,7 @@ public:
reverse_iterator;
typedef ACE_Hash_Map_Const_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>
const_reverse_iterator;
+
// = STL-style typedefs/traits.
typedef EXT_ID key_type;
typedef INT_ID data_type;
@@ -139,7 +169,9 @@ public:
typedef value_type const * const_pointer;
typedef ptrdiff_t difference_type;
typedef size_t size_type;
+
// = Initialization and termination methods.
+
/**
* Initialize an ACE_Hash_Map_Manager_Ex with a default number of elements.
*
@@ -154,6 +186,7 @@ public:
*/
ACE_Hash_Map_Manager_Ex (ACE_Allocator *table_alloc = 0,
ACE_Allocator *entry_alloc = 0);
+
/**
* Initialize an ACE_Hash_Map_Manager_Ex with @a size elements.
*
@@ -169,6 +202,7 @@ public:
ACE_Hash_Map_Manager_Ex (size_t size,
ACE_Allocator *table_alloc = 0,
ACE_Allocator *entry_alloc = 0);
+
/**
* Initialize an ACE_Hash_Map_Manager_Ex with @a size elements.
* @param table_alloc is a pointer to a memory allocator used for
@@ -181,16 +215,21 @@ public:
* @a table_alloc.
* @return -1 on failure, 0 on success
*/
+
int open (size_t size = ACE_DEFAULT_MAP_SIZE,
ACE_Allocator *table_alloc = 0,
ACE_Allocator *entry_alloc = 0);
+
/// Close down the ACE_Hash_Map_Manager_Ex and release dynamically allocated
/// resources.
int close (void);
+
/// Removes all the entries in the ACE_Hash_Map_Manager_Ex.
int unbind_all (void);
+
/// Cleanup the ACE_Hash_Map_Manager_Ex.
~ACE_Hash_Map_Manager_Ex (void);
+
/**
* Associate @a item with @a int_id. If @a item is already in the
* map then the map is not changed.
@@ -201,6 +240,7 @@ public:
*/
int bind (const EXT_ID &item,
const INT_ID &int_id);
+
/**
* Same as a normal bind, except the map entry is also passed back
* to the caller. The entry in this case will either be the newly
@@ -209,6 +249,7 @@ public:
int bind (const EXT_ID &ext_id,
const INT_ID &int_id,
ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry);
+
/**
* Associate @a ext_id with @a int_id if and only if @a ext_id is not
* in the map. If @a ext_id is already in the map then the @a int_id
@@ -218,6 +259,7 @@ public:
*/
int trybind (const EXT_ID &ext_id,
INT_ID &int_id);
+
/**
* Same as a normal trybind, except the map entry is also passed
* back to the caller. The entry in this case will either be the
@@ -226,6 +268,7 @@ public:
int trybind (const EXT_ID &ext_id,
INT_ID &int_id,
ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry);
+
/**
* Reassociate @a ext_id with @a int_id. If @a ext_id is not in the
* map then behaves just like <bind>. Returns 0 if a new entry is
@@ -234,6 +277,7 @@ public:
*/
int rebind (const EXT_ID &ext_id,
const INT_ID &int_id);
+
/**
* Same as a normal rebind, except the map entry is also passed back
* to the caller. The entry in this case will either be the newly
@@ -242,6 +286,7 @@ public:
int rebind (const EXT_ID &ext_id,
const INT_ID &int_id,
ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry);
+
/**
* Associate @a ext_id with @a int_id. If @a ext_id is not in the map
* then behaves just like <bind>. Otherwise, store the old value of
@@ -252,6 +297,7 @@ public:
int rebind (const EXT_ID &ext_id,
const INT_ID &int_id,
INT_ID &old_int_id);
+
/**
* Same as a normal rebind, except the map entry is also passed back
* to the caller. The entry in this case will either be the newly
@@ -261,6 +307,7 @@ public:
const INT_ID &int_id,
INT_ID &old_int_id,
ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry);
+
/**
* Associate @a ext_id with @a int_id. If @a ext_id is not in the map
* then behaves just like <bind>. Otherwise, store the old values
@@ -275,6 +322,7 @@ public:
const INT_ID &int_id,
EXT_ID &old_ext_id,
INT_ID &old_int_id);
+
/**
* Same as a normal rebind, except the map entry is also passed back
* to the caller. The entry in this case will either be the newly
@@ -285,33 +333,40 @@ public:
EXT_ID &old_ext_id,
INT_ID &old_int_id,
ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry);
+
/// Locate @a ext_id and pass out parameter via @a int_id.
/// Return 0 if found, returns -1 if not found.
int find (const EXT_ID &ext_id,
INT_ID &int_id) const;
+
/// Returns 0 if the @a ext_id is in the mapping, otherwise -1.
int find (const EXT_ID &ext_id) const;
+
/// Locate @a ext_id and pass out parameter via @a entry. If found,
/// return 0, returns -1 if not found.
int find (const EXT_ID &ext_id,
ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry) const;
+
/// Locate @a ext_id and pass out an iterator that points to its
/// corresponding value.
/**
* @param pos @a pos will be set to @c end() if not found.
*/
void find (EXT_ID const & ext_id, iterator & pos) const;
+
/**
* Unbind (remove) the @a ext_id from the map. Don't return the
* @a int_id to the caller (this is useful for collections where the
* @a int_ids are *not* dynamically allocated...)
*/
int unbind (const EXT_ID &ext_id);
+
/// Break any association of @a ext_id. Returns the value of @a int_id
/// in case the caller needs to deallocate memory. Return 0 if the
/// unbind was successful, and returns -1 if failures occur.
int unbind (const EXT_ID &ext_id,
INT_ID &int_id);
+
/// Remove entry from map.
/**
* This unbind operation is fast relative to those that accept an
@@ -321,6 +376,7 @@ public:
* occur.
*/
int unbind (ACE_Hash_Map_Entry<EXT_ID, INT_ID> *entry);
+
/// Remove entry from map pointed to by @c iterator @a pos.
/**
* This unbind operation is fast relative to those that accept an
@@ -330,12 +386,15 @@ public:
* occur.
*/
int unbind (iterator pos);
+
/// Returns the current number of ACE_Hash_Map_Entry objects in the
/// hash table.
size_t current_size (void) const;
+
/// Return the size of the array that's used to point to the
/// linked lists of ACE_Hash_Map_Entry objects in the hash table.
size_t total_size (void) const;
+
/**
* Returns a reference to the underlying <ACE_LOCK>. This makes it
* possible to acquire the lock explicitly, which can be useful in
@@ -345,122 +404,158 @@ public:
* @note The right name would be <lock>, but HP/C++ will choke on that!
*/
ACE_LOCK &mutex (void);
+
/// Dump the state of an object.
void dump (void) const;
+
// = STL styled iterator factory functions.
+
/// Return forward iterator.
iterator begin (void);
iterator end (void);
const_iterator begin (void) const;
const_iterator end (void) const;
+
/// Return reverse iterator.
reverse_iterator rbegin (void);
reverse_iterator rend (void);
const_reverse_iterator rbegin (void) const;
const_reverse_iterator rend (void) const;
+
protected:
// = The following methods do the actual work.
+
/// Returns 1 if <id1> == <id2>, else 0. This is defined as a
/// separate method to facilitate template specialization.
int equal (const EXT_ID &id1, const EXT_ID &id2);
+
/// Compute the hash value of the @a ext_id. This is defined as a
/// separate method to facilitate template specialization.
u_long hash (const EXT_ID &ext_id);
+
// = These methods assume locks are held by private methods.
+
/// Performs bind. Must be called with locks held.
int bind_i (const EXT_ID &ext_id,
const INT_ID &int_id);
+
/// Performs bind. Must be called with locks held.
int bind_i (const EXT_ID &ext_id,
const INT_ID &int_id,
ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry);
+
/// Performs trybind. Must be called with locks held.
int trybind_i (const EXT_ID &ext_id,
INT_ID &int_id);
+
/// Performs trybind. Must be called with locks held.
int trybind_i (const EXT_ID &ext_id,
INT_ID &int_id,
ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry);
+
/// Performs rebind. Must be called with locks held.
int rebind_i (const EXT_ID &ext_id,
const INT_ID &int_id);
+
/// Performs rebind. Must be called with locks held.
int rebind_i (const EXT_ID &ext_id,
const INT_ID &int_id,
ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry);
+
/// Performs rebind. Must be called with locks held.
int rebind_i (const EXT_ID &ext_id,
const INT_ID &int_id,
INT_ID &old_int_id);
+
/// Performs rebind. Must be called with locks held.
int rebind_i (const EXT_ID &ext_id,
const INT_ID &int_id,
INT_ID &old_int_id,
ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry);
+
/// Performs rebind. Must be called with locks held.
int rebind_i (const EXT_ID &ext_id,
const INT_ID &int_id,
EXT_ID &old_ext_id,
INT_ID &old_int_id);
+
/// Performs rebind. Must be called with locks held.
int rebind_i (const EXT_ID &ext_id,
const INT_ID &int_id,
EXT_ID &old_ext_id,
INT_ID &old_int_id,
ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry);
+
/// Performs a find of @a int_id using @a ext_id as the key. Must be
/// called with locks held.
int find_i (const EXT_ID &ext_id,
INT_ID &int_id);
+
/// Performs a find using @a ext_id as the key. Must be called with
/// locks held.
int find_i (const EXT_ID &ext_id);
+
/// Performs a find using @a ext_id as the key. Must be called with
/// locks held.
int find_i (const EXT_ID &ext_id,
ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry);
+
/// Performs unbind. Must be called with locks held.
int unbind_i (const EXT_ID &ext_id,
INT_ID &int_id);
+
/// Performs unbind. Must be called with locks held.
int unbind_i (const EXT_ID &ext_id);
+
/// Performs unbind. Must be called with locks held.
int unbind_i (ACE_Hash_Map_Entry<EXT_ID, INT_ID> *entry);
+
/**
* Resize the map. Must be called with locks held.
* @note This method should never be called more than once or else all the
* hashing will get screwed up as the size will change.
*/
int create_buckets (size_t size);
+
/// Close down a <Map_Manager_Ex>. Must be called with
/// locks held.
int close_i (void);
+
/// Removes all the entries in <Map_Manager_Ex>. Must be called with
/// locks held.
int unbind_all_i (void);
+
/// Pointer to a memory allocator used for table_, so it should
/// supply size*sizeof (ACE_Hash_Map_Entry<EXT_ID, INT_ID>),
ACE_Allocator *table_allocator_;
+
/// Addidtional allocator for entries, so it should be able to
/// allocate 'size' / chunks of sizeof(ACE_Hash_Map_Entry<EXT_ID,
/// INT_ID>) bytes each.
ACE_Allocator *entry_allocator_;
+
/// Synchronization variable for the MT_SAFE
/// @c ACE_Hash_Map_Manager_Ex.
mutable ACE_LOCK lock_;
+
/// Function object used for hashing keys.
HASH_KEY hash_key_;
+
/// Function object used for comparing keys.
COMPARE_KEYS compare_keys_;
+
protected:
/// Returns the ACE_Hash_Map_Entry that corresponds to @a ext_id.
int shared_find (const EXT_ID &ext_id,
ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry,
size_t &loc);
+
/// Accessor of the underlying table
ACE_Hash_Map_Entry<EXT_ID, INT_ID> *table (void);
+
/// Accessor of the current size attribute
size_t cur_size (void) const;
+
private:
/**
* Array of ACE_Hash_Map_Entry *s, each of which points to an
@@ -468,16 +563,20 @@ private:
* list of <EXT_ID>s that hash to that bucket.
*/
ACE_Hash_Map_Entry<EXT_ID, INT_ID> *table_;
+
/// Total size of the hash table.
size_t total_size_;
+
/// Current number of entries in the table
/// @note That this can be larger than <total_size_> due to the
/// bucket chaining).
size_t cur_size_;
+
// = Disallow these operations.
ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &))
ACE_UNIMPLEMENTED_FUNC (ACE_Hash_Map_Manager_Ex (const ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &))
};
+
/**
* @class ACE_Hash_Map_Iterator_Base_Ex
*
@@ -493,11 +592,13 @@ public:
// = STL-style typedefs/traits.
typedef ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>
container_type;
+
// = std::iterator_traits typedefs/traits.
typedef typename container_type::value_type value_type;
typedef typename container_type::reference reference;
typedef typename container_type::pointer pointer;
typedef typename container_type::difference_type difference_type;
+
// = Initialization method.
/// Contructor.
/**
@@ -512,6 +613,7 @@ public:
COMPARE_KEYS,
ACE_LOCK> &mm,
bool head);
+
/// Contructor.
/**
* This constructor positions the iterator to the given @a entry.
@@ -524,41 +626,56 @@ public:
ACE_LOCK> & mm,
ACE_Hash_Map_Entry<EXT_ID, INT_ID> * entry,
size_t index);
+
// = ITERATION methods.
+
/// Pass back the next <entry> that hasn't been seen in the Set.
/// Returns 0 when all items have been seen, else 1.
int next (ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&next_entry) const;
+
/// Returns 1 when all items have been seen, else 0.
int done (void) const;
+
/// Returns a reference to the interal element @c this is pointing to.
ACE_Hash_Map_Entry<EXT_ID, INT_ID>& operator* (void) const;
+
/// Returns a pointer to the interal element @c this is pointing to.
ACE_Hash_Map_Entry<EXT_ID, INT_ID>* operator-> (void) const;
+
/// Returns reference the Hash_Map_Manager_Ex that is being iterated
/// over.
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>& map (void);
+
/// Check if two iterators point to the same position
bool operator== (const ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &) const;
bool operator!= (const ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
/// Move forward by one element in the set. Returns 0 when there's
/// no more item in the set after the current items, else 1.
int forward_i (void);
+
/// Move backward by one element in the set. Returns 0 when there's
/// no more item in the set before the current item, else 1.
int reverse_i (void);
+
/// Dump the state of an object.
void dump_i (void) const;
+
/// Map we are iterating over.
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *map_man_;
+
/// Keeps track of how far we've advanced in the table.
ssize_t index_;
+
/// Keeps track of how far we've advanced in a linked list in each
/// table slot.
ACE_Hash_Map_Entry<EXT_ID, INT_ID> *next_;
};
+
/**
* @class ACE_Hash_Map_Const_Iterator_Base_Ex
*
@@ -574,51 +691,68 @@ public:
// = STL-style typedefs/traits.
typedef ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>
container_type;
+
// = std::iterator_traits typedefs/traits.
typedef typename container_type::value_type value_type;
typedef typename container_type::const_reference reference;
typedef typename container_type::const_pointer pointer;
typedef typename container_type::difference_type difference_type;
+
// = Initialization method.
/// Contructor. If head the iterator constructed is positioned
/// at the head of the map, it is positioned at the end otherwise.
ACE_Hash_Map_Const_Iterator_Base_Ex (const ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &mm,
bool head);
+
// = ITERATION methods.
+
/// Pass back the next <entry> that hasn't been seen in the Set.
/// Returns 0 when all items have been seen, else 1.
int next (ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&next_entry) const;
+
/// Returns 1 when all items have been seen, else 0.
int done (void) const;
+
/// Returns a reference to the interal element @c this is pointing to.
ACE_Hash_Map_Entry<EXT_ID, INT_ID>& operator* (void) const;
+
/// Returns a pointer to the interal element @c this is pointing to.
ACE_Hash_Map_Entry<EXT_ID, INT_ID>* operator-> (void) const;
+
/// Returns reference the Hash_Map_Manager_Ex that is being iterated
/// over.
const ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>& map (void);
+
/// Check if two iterators point to the same position
bool operator== (const ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &) const;
bool operator!= (const ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
/// Move forward by one element in the set. Returns 0 when there's
/// no more item in the set after the current items, else 1.
int forward_i (void);
+
/// Move backward by one element in the set. Returns 0 when there's
/// no more item in the set before the current item, else 1.
int reverse_i (void);
+
/// Dump the state of an object.
void dump_i (void) const;
+
/// Map we are iterating over.
const ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *map_man_;
+
/// Keeps track of how far we've advanced in the table.
ssize_t index_;
+
/// Keeps track of how far we've advanced in a linked list in each
/// table slot.
ACE_Hash_Map_Entry<EXT_ID, INT_ID> *next_;
};
+
/**
* @class ACE_Hash_Map_Iterator_Ex
*
@@ -638,15 +772,18 @@ public:
// = STL-style traits/typedefs
typedef typename ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::container_type
container_type;
+
// = STL-style traits/typedefs
typedef std::bidirectional_iterator_tag iterator_category;
typedef typename container_type::value_type value_type;
typedef typename container_type::reference reference;
typedef typename container_type::pointer pointer;
typedef typename container_type::difference_type difference_type;
+
// = Initialization method.
ACE_Hash_Map_Iterator_Ex (ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &mm,
int tail = 0);
+
/// Contructor.
/**
* This constructor positions the iterator to the given @a entry.
@@ -659,24 +796,33 @@ public:
ACE_LOCK> & mm,
ACE_Hash_Map_Entry<EXT_ID, INT_ID> * entry,
size_t index);
+
// = Iteration methods.
/// Move forward by one element in the set. Returns 0 when all the
/// items in the set have been seen, else 1.
int advance (void);
+
/// Dump the state of an object.
void dump (void) const;
+
// = STL styled iteration, compare, and reference functions.
+
/// Prefix advance.
ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &operator++ (void);
+
/// Postfix advance.
ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> operator++ (int);
+
/// Prefix reverse.
ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &operator-- (void);
+
/// Postfix reverse.
ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> operator-- (int);
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
};
+
/**
* @class ACE_Hash_Map_Const_Iterator_Ex
*
@@ -696,33 +842,44 @@ public:
// = STL-style traits/typedefs
typedef typename ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::container_type
container_type;
+
// = std::iterator_trait traits/typedefs
typedef std::bidirectional_iterator_tag iterator_category;
typedef typename container_type::value_type value_type;
typedef typename container_type::reference reference;
typedef typename container_type::pointer pointer;
typedef typename container_type::difference_type difference_type;
+
// = Initialization method.
ACE_Hash_Map_Const_Iterator_Ex (const ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &mm,
int tail = 0);
+
// = Iteration methods.
/// Move forward by one element in the set. Returns 0 when all the
/// items in the set have been seen, else 1.
int advance (void);
+
/// Dump the state of an object.
void dump (void) const;
+
// = STL styled iteration, compare, and reference functions.
+
/// Prefix advance.
ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &operator++ (void);
+
/// Postfix advance.
ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> operator++ (int);
+
/// Prefix reverse.
ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &operator-- (void);
+
/// Postfix reverse.
ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> operator-- (int);
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
};
+
/**
* @class ACE_Hash_Map_Bucket_Iterator
*
@@ -749,50 +906,67 @@ public:
// = STL-style traits/typedefs
typedef ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>
container_type;
+
// = std::iterator traits/typedefs
typedef std::bidirectional_iterator_tag iterator_category;
typedef typename container_type::value_type value_type;
typedef typename container_type::reference reference;
typedef typename container_type::pointer pointer;
typedef typename container_type::difference_type difference_type;
+
// = Initialization method.
ACE_Hash_Map_Bucket_Iterator (ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &mm,
const EXT_ID &ext_id,
int tail = 0);
+
// = STL styled iteration, compare, and reference functions.
+
/// Prefix advance.
ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &operator++ (void);
+
/// Postfix advance.
ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> operator++ (int);
+
/// Prefix reverse.
ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &operator-- (void);
+
/// Postfix reverse.
ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> operator-- (int);
+
/// Returns a reference to the interal element @c this is pointing to.
ACE_Hash_Map_Entry<EXT_ID, INT_ID>& operator* (void) const;
+
/// Returns a pointer to the interal element @c this is pointing to.
ACE_Hash_Map_Entry<EXT_ID, INT_ID>* operator-> (void) const;
+
/// Returns reference the Hash_Map_Manager_Ex that is being iterated
/// over.
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>& map (void);
+
/// Check if two iterators point to the same position
bool operator== (const ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &) const;
bool operator!= (const ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &) const;
+
protected:
/// Move forward by one element in the set. Returns 0 when there's
/// no more item in the set after the current items, else 1.
int forward_i (void);
+
/// Move backward by one element in the set. Returns 0 when there's
/// no more item in the set before the current item, else 1.
int reverse_i (void);
+
/// Map we are iterating over.
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *map_man_;
+
/// Keeps track of how far we've advanced in the table.
ssize_t index_;
+
/// Keeps track of how far we've advanced in a linked list in each
/// table slot.
ACE_Hash_Map_Entry<EXT_ID, INT_ID> *next_;
};
+
/**
* @class ACE_Hash_Map_Reverse_Iterator_Ex
*
@@ -812,33 +986,44 @@ public:
// = STL-style traits/typedefs
typedef typename ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::container_type
container_type;
+
// = std::iterator_traits typedefs
typedef std::bidirectional_iterator_tag iterator_category;
typedef typename container_type::value_type value_type;
typedef typename container_type::reference reference;
typedef typename container_type::pointer pointer;
typedef typename container_type::difference_type difference_type;
+
// = Initialization method.
ACE_Hash_Map_Reverse_Iterator_Ex (ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &mm,
bool head = false);
+
// = Iteration methods.
/// Move forward by one element in the set. Returns 0 when all the
/// items in the set have been seen, else 1.
int advance (void);
+
/// Dump the state of an object.
void dump (void) const;
+
// = STL styled iteration, compare, and reference functions.
+
/// Prefix reverse.
ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &operator++ (void);
+
/// Postfix reverse.
ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> operator++ (int);
+
/// Prefix advance.
ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &operator-- (void);
+
/// Postfix advance.
ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> operator-- (int);
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
};
+
/**
* @class ACE_Hash_Map_Const_Reverse_Iterator_Ex
*
@@ -858,33 +1043,44 @@ public:
// = STL-style traits/typedefs
typedef typename ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::container_type
container_type;
+
// = std::iterator_traits typedefs
typedef std::bidirectional_iterator_tag iterator_category;
typedef typename container_type::value_type value_type;
typedef typename container_type::reference reference;
typedef typename container_type::pointer pointer;
typedef typename container_type::difference_type difference_type;
+
// = Initialization method.
ACE_Hash_Map_Const_Reverse_Iterator_Ex (const ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &mm,
bool head = false);
+
// = Iteration methods.
/// Move forward by one element in the set. Returns 0 when all the
/// items in the set have been seen, else 1.
int advance (void);
+
/// Dump the state of an object.
void dump (void) const;
+
// = STL styled iteration, compare, and reference functions.
+
/// Prefix reverse.
ACE_Hash_Map_Const_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &operator++ (void);
+
/// Postfix reverse.
ACE_Hash_Map_Const_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> operator++ (int);
+
/// Prefix advance.
ACE_Hash_Map_Const_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &operator-- (void);
+
/// Postfix advance.
ACE_Hash_Map_Const_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> operator-- (int);
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
};
+
/**
* @class ACE_Hash_Map_Manager
*
@@ -929,6 +1125,7 @@ template <class EXT_ID, class INT_ID, class ACE_LOCK>
class ACE_Hash_Map_Manager : public ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK>
{
public:
+
/**
* Initialize a @c Hash_Map_Manager with default size elements.
* @param table_alloc is a pointer to a memory allocator used for
@@ -942,6 +1139,7 @@ public:
*/
ACE_Hash_Map_Manager (ACE_Allocator *table_alloc = 0,
ACE_Allocator *entry_alloc = 0);
+
/**
* Initialize a @c Hash_Map_Manager with @c size elements.
* @param table_alloc is a pointer to a memory allocator used for
@@ -956,11 +1154,13 @@ public:
ACE_Hash_Map_Manager (size_t size,
ACE_Allocator *table_alloc = 0,
ACE_Allocator *entry_alloc = 0);
+
// = The following two are necessary for template specialization of
// ACE_Hash_Map_Manager to work.
int equal (const EXT_ID &id1, const EXT_ID &id2);
u_long hash (const EXT_ID &ext_id);
};
+
/**
* @class ACE_Hash_Map_Iterator
*
@@ -973,26 +1173,35 @@ public:
// = STL-style traits/typedefs
typedef typename ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK>::container_type
container_type;
+
typedef typename ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK>::iterator_category
iterator_category;
+
typedef typename ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK>::value_type
value_type;
+
typedef typename ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK>::reference
reference;
+
typedef typename ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK>::pointer
pointer;
+
typedef typename ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK>::difference_type
difference_type;
+
// = Initialization method.
/// Construct from map
ACE_Hash_Map_Iterator (ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK> &mm,
int tail = 0);
+
/// Construct from base
ACE_Hash_Map_Iterator (const ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> &base);
+
/// Assignment from base
ACE_Hash_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK> &
operator= (const ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> &base);
};
+
/**
* @class ACE_Hash_Map_Const_Iterator
*
@@ -1005,27 +1214,36 @@ public:
// = STL-style traits/typedefs
typedef typename ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK>::container_type
container_type;
+
// = std::iterator_traits typedefs
typedef typename ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK>::iterator_category
iterator_category;
+
typedef typename ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK>::value_type
value_type;
+
typedef typename ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK>::reference
reference;
+
typedef typename ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK>::pointer
pointer;
+
typedef typename ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK>::difference_type
difference_type;
+
// = Initialization method.
/// Construct from map
ACE_Hash_Map_Const_Iterator (const ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK> &mm,
int tail = 0);
+
/// Construct from base
ACE_Hash_Map_Const_Iterator (const ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> &base);
+
/// Assignment from base
ACE_Hash_Map_Const_Iterator<EXT_ID, INT_ID, ACE_LOCK> &
operator= (const ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> &base);
};
+
/**
* @class ACE_Hash_Map_Reverse_Iterator
*
@@ -1038,36 +1256,49 @@ public:
// = STL-style traits/typedefs
typedef typename ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK>::container_type
container_type;
+
// = std::iterator_traits typedefs
typedef typename ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK>::iterator_category
iterator_category;
+
typedef typename ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK>::value_type
value_type;
+
typedef typename ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK>::reference
reference;
+
typedef typename ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK>::pointer
pointer;
+
typedef typename ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK>::difference_type
difference_type;
+
// = Initialization method.
ACE_Hash_Map_Reverse_Iterator (ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK> &mm,
bool head = false);
+
/// Construct from base
ACE_Hash_Map_Reverse_Iterator (const ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> &base);
+
/// Assignment from base
ACE_Hash_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK> &
operator= (const ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> &base);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
# include "ace/Hash_Map_Manager_T.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Hash_Map_Manager_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Hash_Map_Manager_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
#endif /* ACE_HASH_MAP_MANAGER_T_H */
diff --git a/dep/ACE_wrappers/ace/Hash_Map_Manager_T.inl b/dep/ACE_wrappers/ace/Hash_Map_Manager_T.inl
index e22cf77acec..3b9cea3d3b4 100644
--- a/dep/ACE_wrappers/ace/Hash_Map_Manager_T.inl
+++ b/dep/ACE_wrappers/ace/Hash_Map_Manager_T.inl
@@ -1,8 +1,11 @@
// -*- C++ -*-
//
// $Id: Hash_Map_Manager_T.inl 81082 2008-03-25 09:09:11Z johnnyw $
+
#include "ace/Guard_T.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_Hash_Map_Manager_Ex (size_t size,
ACE_Allocator *table_alloc,
@@ -16,6 +19,7 @@ ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_H
if (this->open (size, table_alloc, entry_alloc) == -1)
ACE_ERROR ((LM_ERROR, ACE_TEXT ("ACE_Hash_Map_Manager_Ex\n")));
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_Hash_Map_Manager_Ex (ACE_Allocator *table_alloc,
ACE_Allocator *entry_alloc)
@@ -29,110 +33,137 @@ ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_H
ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_Hash_Map_Manager_Ex open")));
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::close (void)
{
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
return this->close_i ();
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::unbind_all (void)
{
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
return this->unbind_all_i ();
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::~ACE_Hash_Map_Manager_Ex (void)
{
this->close ();
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE size_t
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::current_size (void) const
{
return this->cur_size_;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE size_t
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::total_size (void) const
{
return this->total_size_;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE ACE_LOCK &
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::mutex (void)
{
ACE_TRACE ("ACE_Hash_Map_Manager_Ex::mutex");
return this->lock_;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE u_long
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::hash (const EXT_ID &ext_id)
{
return this->hash_key_ (ext_id);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::equal (const EXT_ID &id1,
const EXT_ID &id2)
{
return this->compare_keys_ (id1, id2);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::bind_i (const EXT_ID &ext_id,
const INT_ID &int_id)
{
ACE_Hash_Map_Entry<EXT_ID, INT_ID> *temp;
+
return this->bind_i (ext_id, int_id, temp);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::bind (const EXT_ID &ext_id,
const INT_ID &int_id)
{
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
return this->bind_i (ext_id, int_id);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::bind (const EXT_ID &ext_id,
const INT_ID &int_id,
ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry)
{
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
return this->bind_i (ext_id, int_id, entry);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::trybind_i (const EXT_ID &ext_id,
INT_ID &int_id)
{
ACE_Hash_Map_Entry<EXT_ID, INT_ID> *temp;
+
int result = this->trybind_i (ext_id, int_id, temp);
if (result == 1)
int_id = temp->int_id_;
return result;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::trybind (const EXT_ID &ext_id,
INT_ID &int_id)
{
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
return this->trybind_i (ext_id, int_id);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::trybind (const EXT_ID &ext_id,
INT_ID &int_id,
ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry)
{
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
return this->trybind_i (ext_id, int_id, entry);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::unbind_i (const EXT_ID &ext_id)
{
INT_ID int_id;
+
return this->unbind_i (ext_id, int_id);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::unbind (const EXT_ID &ext_id,
INT_ID &int_id)
{
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
return this->unbind_i (ext_id, int_id);
}
+
template <class EXT_ID,
class INT_ID,
class HASH_KEY,
@@ -152,23 +183,29 @@ ACE_Hash_Map_Manager_Ex<EXT_ID,
{
return this->unbind (&(*pos));
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::unbind (const EXT_ID &ext_id)
{
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
return this->unbind_i (ext_id) == -1 ? -1 : 0;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::unbind (ACE_Hash_Map_Entry<EXT_ID, INT_ID> *entry)
{
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
return this->unbind_i (entry) == -1 ? -1 : 0;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::find_i (const EXT_ID &ext_id,
INT_ID &int_id)
{
ACE_Hash_Map_Entry<EXT_ID, INT_ID> *entry;
+
size_t dummy;
if (this->shared_find (ext_id, entry, dummy) == -1)
return -1;
@@ -178,13 +215,16 @@ ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::find_
return 0;
}
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::find_i (const EXT_ID &ext_id)
{
ACE_Hash_Map_Entry<EXT_ID, INT_ID> *entry;
+
size_t dummy;
return this->shared_find (ext_id, entry, dummy);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::find (const EXT_ID &ext_id,
INT_ID &int_id) const
@@ -192,18 +232,24 @@ ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::find
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *nc_this =
const_cast <ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *>
(this);
+
ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
return nc_this->find_i (ext_id, int_id);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::find (const EXT_ID &ext_id) const
{
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *nc_this =
const_cast <ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *>
(this);
+
ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
return nc_this->find_i (ext_id);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::find_i (const EXT_ID &ext_id,
ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry)
@@ -211,6 +257,7 @@ ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::find_
size_t dummy;
return this->shared_find (ext_id, entry, dummy);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::find (const EXT_ID &ext_id,
ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry) const
@@ -218,29 +265,36 @@ ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::find
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *nc_this =
const_cast <ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *>
(this);
+
ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
return nc_this->find_i (ext_id, entry);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::rebind_i (const EXT_ID &ext_id,
const INT_ID &int_id)
{
ACE_Hash_Map_Entry<EXT_ID, INT_ID> *node;
+
return this->rebind_i (ext_id,
int_id,
node);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::rebind_i (const EXT_ID &ext_id,
const INT_ID &int_id,
INT_ID &old_int_id)
{
ACE_Hash_Map_Entry<EXT_ID, INT_ID> *node;
+
return this->rebind_i (ext_id,
int_id,
old_int_id,
node);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::rebind_i (const EXT_ID &ext_id,
const INT_ID &int_id,
@@ -248,35 +302,43 @@ ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::rebin
INT_ID &old_int_id)
{
ACE_Hash_Map_Entry<EXT_ID, INT_ID> *node;
+
return this->rebind_i (ext_id,
int_id,
old_ext_id,
old_int_id,
node);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::rebind (const EXT_ID &ext_id,
const INT_ID &int_id)
{
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
return this->rebind_i (ext_id, int_id);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::rebind (const EXT_ID &ext_id,
const INT_ID &int_id,
ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry)
{
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
return this->rebind_i (ext_id, int_id, entry);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::rebind (const EXT_ID &ext_id,
const INT_ID &int_id,
INT_ID &old_int_id)
{
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
return this->rebind_i (ext_id, int_id, old_int_id);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::rebind (const EXT_ID &ext_id,
const INT_ID &int_id,
@@ -284,8 +346,10 @@ ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::rebin
ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry)
{
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
return this->rebind_i (ext_id, int_id, old_int_id, entry);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::rebind (const EXT_ID &ext_id,
const INT_ID &int_id,
@@ -293,8 +357,10 @@ ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::rebin
INT_ID &old_int_id)
{
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
return this->rebind_i (ext_id, int_id, old_ext_id, old_int_id);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::rebind (const EXT_ID &ext_id,
const INT_ID &int_id,
@@ -303,68 +369,80 @@ ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::rebin
ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry)
{
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
return this->rebind_i (ext_id, int_id, old_ext_id, old_int_id, entry);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
typename ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::iterator
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::begin (void)
{
return iterator (*this);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
typename ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::iterator
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::end (void)
{
return iterator (*this, 1);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
typename ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::const_iterator
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::begin (void) const
{
return const_iterator (*this);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
typename ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::const_iterator
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::end (void) const
{
return const_iterator (*this, 1);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
typename ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::reverse_iterator
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::rbegin (void)
{
return reverse_iterator (*this);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
typename ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::reverse_iterator
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::rend (void)
{
return reverse_iterator (*this, 1);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
typename ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::const_reverse_iterator
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::rbegin (void) const
{
return const_reverse_iterator (*this);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
typename ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::const_reverse_iterator
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::rend (void) const
{
return const_reverse_iterator (*this, 1);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Map_Entry<EXT_ID, INT_ID> *
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::table (void)
{
return this->table_;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
size_t
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::cur_size (void) const
{
return this->cur_size_;
}
+
template <class EXT_ID,
class INT_ID,
class HASH_KEY,
@@ -385,16 +463,21 @@ ACE_Hash_Map_Manager_Ex<EXT_ID,
{
ENTRY * entry = 0;
size_t index = 0;
+
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *nc_this =
const_cast <ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *>
(this);
+
ACE_READ_GUARD (ACE_LOCK, ace_mon, this->lock_);
+
if (nc_this->shared_find (ext_id, entry, index) != -1)
pos = iterator (*nc_this, entry, index);
else
pos = nc_this->end ();
}
+
// ---------------------------------------------------------------------
+
template <class EXT_ID,
class INT_ID,
class HASH_KEY,
@@ -419,6 +502,7 @@ ACE_Hash_Map_Iterator_Base_Ex<EXT_ID,
if (mm.table_ != 0)
this->next_ = &mm.table_[head ? 0 : mm.total_size_ - 1];
}
+
template <class EXT_ID,
class INT_ID,
class HASH_KEY,
@@ -442,11 +526,13 @@ ACE_Hash_Map_Iterator_Base_Ex<EXT_ID,
, next_ (entry)
{
}
+
template <class EXT_ID,
class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::next (ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry) const
{
ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::next");
+
if (this->map_man_->table_ != 0
&& this->index_ < static_cast<ssize_t> (this->map_man_->total_size_)
&& this->index_ >= 0
@@ -458,36 +544,47 @@ ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>:
else
return 0;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::done (void) const
{
ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::done");
+
return this->map_man_->table_ == 0
|| this->index_ >= static_cast<ssize_t> (this->map_man_->total_size_)
|| this->index_ < 0;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Map_Entry<EXT_ID, INT_ID> &
ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator* (void) const
{
ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator*");
ACE_Hash_Map_Entry<EXT_ID, INT_ID> *retv = 0;
+
int result = this->next (retv);
+
ACE_UNUSED_ARG (result);
ACE_ASSERT (result != 0);
+
return *retv;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Map_Entry<EXT_ID, INT_ID> *
ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-> (void) const
{
ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator->");
ACE_Hash_Map_Entry<EXT_ID, INT_ID> *retv = 0;
+
int result = this->next (retv);
+
ACE_UNUSED_ARG (result);
ACE_ASSERT (result != 0);
+
return retv;
}
+
// Returns the reference to the hash_map_manager_ex that is being
// iterated over.
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
@@ -497,6 +594,7 @@ ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>:
ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::map");
return *this->map_man_;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE bool
ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator== (const ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &rhs) const
{
@@ -505,6 +603,7 @@ ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>:
&& this->index_ == rhs.index_
&& this->next_ == rhs.next_;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE bool
ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator!= (const ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &rhs) const
{
@@ -513,6 +612,7 @@ ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>:
|| this->index_ != rhs.index_
|| this->map_man_ != rhs.map_man_;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_Hash_Map_Const_Iterator_Base_Ex (const ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &mm,
bool head)
@@ -521,13 +621,16 @@ ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_
next_ (0)
{
ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_Hash_Map_Const_Iterator_Base_Ex");
+
if (mm.table_ != 0)
this->next_ = &mm.table_[head ? 0 : mm.total_size_ - 1];
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::next (ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry) const
{
ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::next");
+
if (this->map_man_->table_ != 0
&& this->index_ < (ssize_t) this->map_man_->total_size_
&& this->index_ >= 0
@@ -539,36 +642,47 @@ ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_
else
return 0;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::done (void) const
{
ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::done");
+
return this->map_man_->table_ == 0
|| this->index_ >= (ssize_t) this->map_man_->total_size_
|| this->index_ < 0;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Map_Entry<EXT_ID, INT_ID> &
ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator* (void) const
{
ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator*");
ACE_Hash_Map_Entry<EXT_ID, INT_ID> *retv = 0;
+
int result = this->next (retv);
+
ACE_UNUSED_ARG (result);
ACE_ASSERT (result != 0);
+
return *retv;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Map_Entry<EXT_ID, INT_ID> *
ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-> (void) const
{
ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator->");
ACE_Hash_Map_Entry<EXT_ID, INT_ID> *retv = 0;
+
int result = this->next (retv);
+
ACE_UNUSED_ARG (result);
ACE_ASSERT (result != 0);
+
return retv;
}
+
// Returns the reference to the hash_map_manager_ex that is being
// iterated over.
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
@@ -578,6 +692,7 @@ ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_
ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::map");
return *this->map_man_;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE bool
ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator== (const ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &rhs) const
{
@@ -586,6 +701,7 @@ ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_
&& this->index_ == rhs.index_
&& this->next_ == rhs.next_;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE bool
ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator!= (const ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &rhs) const
{
@@ -594,15 +710,19 @@ ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_
|| this->index_ != rhs.index_
|| this->map_man_ != rhs.map_man_;
}
+
ACE_ALLOC_HOOK_DEFINE(ACE_Hash_Map_Iterator_Ex)
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE void
ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::dump");
+
this->dump_i ();
#endif /* ACE_HAS_DUMP */
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_Hash_Map_Iterator_Ex (ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &mm,
int tail)
@@ -613,6 +733,7 @@ ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_
if (tail == 0)
this->forward_i ();
}
+
template <class EXT_ID,
class INT_ID,
class HASH_KEY,
@@ -640,55 +761,68 @@ ACE_Hash_Map_Iterator_Ex<EXT_ID,
index)
{
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::advance (void)
{
ACE_TRACE ("ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::advance");
return this->forward_i ();
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &
ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (void)
{
ACE_TRACE ("ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (void)");
+
this->forward_i ();
return *this;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>
ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (int)
{
ACE_TRACE ("ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (int)");
+
ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> retv (*this);
++*this;
return retv;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &
ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (void)
{
ACE_TRACE ("ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (void)");
+
this->reverse_i ();
return *this;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>
ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (int)
{
ACE_TRACE ("ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (int)");
+
ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> retv (*this);
--*this;
return retv;
}
+
ACE_ALLOC_HOOK_DEFINE(ACE_Hash_Map_Const_Iterator_Ex)
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE void
ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::dump");
+
this->dump_i ();
#endif /* ACE_HAS_DUMP */
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_Hash_Map_Const_Iterator_Ex (const ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &mm,
int tail)
@@ -699,46 +833,56 @@ ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>
if (tail == 0)
this->forward_i ();
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::advance (void)
{
ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::advance");
return this->forward_i ();
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &
ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (void)
{
ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (void)");
+
this->forward_i ();
return *this;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>
ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (int)
{
ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (int)");
+
ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> retv (*this);
++*this;
return retv;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &
ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (void)
{
ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (void)");
+
this->reverse_i ();
return *this;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>
ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (int)
{
ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (int)");
+
ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> retv (*this);
--*this;
return retv;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_Hash_Map_Bucket_Iterator (ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &mm,
const EXT_ID &ext_id,
@@ -746,73 +890,92 @@ ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::
: map_man_ (&mm)
{
ACE_TRACE ("ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_Hash_Map_Bucket_Iterator");
+
this->index_ = this->map_man_->hash (ext_id) % this->map_man_->total_size_;
this->next_ = &this->map_man_->table_[this->index_];
+
if (tail == 0)
this->forward_i ();
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &
ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (void)
{
ACE_TRACE ("ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (void)");
+
this->forward_i ();
return *this;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>
ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (int)
{
ACE_TRACE ("ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (int)");
+
ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> retv (*this);
++*this;
return retv;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &
ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (void)
{
ACE_TRACE ("ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (void)");
+
this->reverse_i ();
return *this;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>
ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (int)
{
ACE_TRACE ("ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (int)");
+
ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> retv (*this);
--*this;
return retv;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> int
ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::forward_i (void)
{
ACE_TRACE ("ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::forward_i");
+
this->next_ = this->next_->next_;
return this->next_ != &this->map_man_->table_[this->index_];
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> int
ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::reverse_i (void)
{
ACE_TRACE ("ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::reverse_i");
+
this->next_ = this->next_->prev_;
return this->next_ != &this->map_man_->table_[this->index_];
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Map_Entry<EXT_ID, INT_ID> &
ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator* (void) const
{
ACE_TRACE ("ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator*");
+
return *this->next_;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Map_Entry<EXT_ID, INT_ID> *
ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-> (void) const
{
ACE_TRACE ("ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator->");
+
return this->next_;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &
ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::map (void)
@@ -820,6 +983,7 @@ ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::
ACE_TRACE ("ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::map");
return *this->map_man_;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE bool
ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator== (const ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &rhs) const
{
@@ -828,6 +992,7 @@ ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::
&& this->index_ == rhs.index_
&& this->next_ == rhs.next_;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE bool
ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator!= (const ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &rhs) const
{
@@ -836,15 +1001,19 @@ ACE_Hash_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::
|| this->index_ != rhs.index_
|| this->map_man_ != rhs.map_man_;
}
+
ACE_ALLOC_HOOK_DEFINE(ACE_Hash_Map_Reverse_Iterator_Ex)
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE void
ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::dump");
+
this->dump_i ();
#endif /* ACE_HAS_DUMP */
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_Hash_Map_Reverse_Iterator_Ex (ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &mm, bool head)
: ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> (mm, head)
@@ -853,55 +1022,68 @@ ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOC
if (!head)
this->reverse_i ();
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::advance (void)
{
ACE_TRACE ("ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::advance");
return this->reverse_i ();
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &
ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (void)
{
ACE_TRACE ("ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (void)");
+
this->reverse_i ();
return *this;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>
ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (int)
{
ACE_TRACE ("ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (int)");
+
ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> retv (*this);
++*this;
return retv;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &
ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (void)
{
ACE_TRACE ("ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (void)");
+
this->forward_i ();
return *this;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>
ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (int)
{
ACE_TRACE ("ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (int)");
+
ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> retv (*this);
--*this;
return retv;
}
+
ACE_ALLOC_HOOK_DEFINE(ACE_Hash_Map_Const_Reverse_Iterator_Ex)
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE void
ACE_Hash_Map_Const_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_Hash_Map_Const_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::dump");
+
this->dump_i ();
#endif /* ACE_HAS_DUMP */
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Map_Const_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_Hash_Map_Const_Reverse_Iterator_Ex (const ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &mm, bool head)
: ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> (mm, head)
@@ -910,46 +1092,56 @@ ACE_Hash_Map_Const_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, A
if (!head)
this->reverse_i ();
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Map_Const_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::advance (void)
{
ACE_TRACE ("ACE_Hash_Map_Const_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::advance");
return this->reverse_i ();
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Map_Const_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &
ACE_Hash_Map_Const_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (void)
{
ACE_TRACE ("ACE_Hash_Map_Const_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (void)");
+
this->reverse_i ();
return *this;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Map_Const_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>
ACE_Hash_Map_Const_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (int)
{
ACE_TRACE ("ACE_Hash_Map_Const_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (int)");
+
ACE_Hash_Map_Const_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> retv (*this);
++*this;
return retv;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Map_Const_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &
ACE_Hash_Map_Const_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (void)
{
ACE_TRACE ("ACE_Hash_Map_Const_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (void)");
+
this->forward_i ();
return *this;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Map_Const_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>
ACE_Hash_Map_Const_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (int)
{
ACE_TRACE ("ACE_Hash_Map_Const_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (int)");
+
ACE_Hash_Map_Const_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> retv (*this);
--*this;
return retv;
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK>
ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::ACE_Hash_Map_Manager (ACE_Allocator *table_alloc,
ACE_Allocator *entry_alloc)
@@ -957,6 +1149,7 @@ ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::ACE_Hash_Map_Manager (ACE_Alloca
entry_alloc)
{
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK>
ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::ACE_Hash_Map_Manager (size_t size,
ACE_Allocator *table_alloc,
@@ -966,16 +1159,19 @@ ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::ACE_Hash_Map_Manager (size_t siz
entry_alloc)
{
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> int
ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::equal (const EXT_ID &id1, const EXT_ID &id2)
{
return ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK>::equal (id1, id2);
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> u_long
ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::hash (const EXT_ID &ext_id)
{
return ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK>::hash (ext_id);
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK>
ACE_Hash_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK>::ACE_Hash_Map_Iterator (ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK> &mm,
int tail)
@@ -983,21 +1179,26 @@ ACE_Hash_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK>::ACE_Hash_Map_Iterator (ACE_Hash
tail)
{
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK>
ACE_Hash_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK>::ACE_Hash_Map_Iterator (const ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> &base)
: ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> (base)
{
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_Hash_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK> &
ACE_Hash_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK>::operator= (const ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> &rhs)
{
if (this != &rhs)
{
ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> &base = *this;
+
base = rhs;
}
+
return *this;
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK>
ACE_Hash_Map_Const_Iterator<EXT_ID, INT_ID, ACE_LOCK>::ACE_Hash_Map_Const_Iterator (const ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK> &mm,
int tail)
@@ -1005,21 +1206,26 @@ ACE_Hash_Map_Const_Iterator<EXT_ID, INT_ID, ACE_LOCK>::ACE_Hash_Map_Const_Iterat
tail)
{
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK>
ACE_Hash_Map_Const_Iterator<EXT_ID, INT_ID, ACE_LOCK>::ACE_Hash_Map_Const_Iterator (const ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> &base)
: ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> (base)
{
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_Hash_Map_Const_Iterator<EXT_ID, INT_ID, ACE_LOCK> &
ACE_Hash_Map_Const_Iterator<EXT_ID, INT_ID, ACE_LOCK>::operator= (const ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> &rhs)
{
if (this != &rhs)
{
ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> &base = *this;
+
base = rhs;
}
+
return *this;
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK>
ACE_Hash_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK>::ACE_Hash_Map_Reverse_Iterator (ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK> &mm,
bool head)
@@ -1027,16 +1233,21 @@ ACE_Hash_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK>::ACE_Hash_Map_Reverse_It
head)
{
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK>
ACE_Hash_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK>::ACE_Hash_Map_Reverse_Iterator (const ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> &base)
: ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> (base)
{
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_Hash_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK> &
ACE_Hash_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK>::operator= (const ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> &rhs)
{
ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> &base = *this;
+
base = rhs;
+
return *this;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Hash_Map_With_Allocator_T.h b/dep/ACE_wrappers/ace/Hash_Map_With_Allocator_T.h
index fc574b82c33..cb42eee5929 100644
--- a/dep/ACE_wrappers/ace/Hash_Map_With_Allocator_T.h
+++ b/dep/ACE_wrappers/ace/Hash_Map_With_Allocator_T.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Hash_Map_With_Allocator_T.h
@@ -9,15 +10,20 @@
* @author Irfan Pyarali <irfan@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_HASH_MAP_WITH_ALLOCATOR_T_H
#define ACE_HASH_MAP_WITH_ALLOCATOR_T_H
#include /**/ "ace/pre.h"
+
#include "ace/Hash_Map_Manager_T.h"
#include "ace/Null_Mutex.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Hash_Map_With_Allocator
*
@@ -48,46 +54,60 @@ class ACE_Hash_Map_With_Allocator :
public:
/// Constructor.
ACE_Hash_Map_With_Allocator (ACE_Allocator *alloc);
+
/// Constructor that specifies hash table size.
ACE_Hash_Map_With_Allocator (size_t size,
ACE_Allocator *alloc);
+
// = The following methods are Proxies to the corresponding methods
// in ACE_Hash_Map_Manager. Each method sets the allocator to
// the one specified by the invoking entity, and then calls the
// corresponding method in ACE_Hash_Map_Manager to do the
// actual work.
+
int bind (const EXT_ID &,
const INT_ID &,
ACE_Allocator *alloc);
+
int unbind (const EXT_ID &,
INT_ID &,
ACE_Allocator *alloc);
+
int unbind (const EXT_ID &,
ACE_Allocator *alloc);
+
int rebind (const EXT_ID &,
const INT_ID &,
EXT_ID &,
INT_ID &,
ACE_Allocator *alloc);
+
int find (const EXT_ID &,
INT_ID &,
ACE_Allocator *alloc);
+
/// Returns 0 if the @a ext_id is in the mapping, otherwise -1.
int find (const EXT_ID &ext_id,
ACE_Allocator *alloc);
+
int close (ACE_Allocator *alloc);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Hash_Map_With_Allocator_T.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Hash_Map_With_Allocator_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Hash_Map_With_Allocator_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
#endif /* ACE_HASH_MAP_WITH_ALLOCATOR_T_H */
diff --git a/dep/ACE_wrappers/ace/Hash_Map_With_Allocator_T.inl b/dep/ACE_wrappers/ace/Hash_Map_With_Allocator_T.inl
index 2646159991b..99a603cfa9b 100644
--- a/dep/ACE_wrappers/ace/Hash_Map_With_Allocator_T.inl
+++ b/dep/ACE_wrappers/ace/Hash_Map_With_Allocator_T.inl
@@ -1,6 +1,9 @@
// -*- C++ -*-
+
// $Id: Hash_Map_With_Allocator_T.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template <class EXT_ID, class INT_ID> ACE_INLINE int
ACE_Hash_Map_With_Allocator<EXT_ID, INT_ID>::close (ACE_Allocator *alloc)
{
@@ -9,6 +12,7 @@ ACE_Hash_Map_With_Allocator<EXT_ID, INT_ID>::close (ACE_Allocator *alloc)
this->entry_allocator_ = alloc;
return this->close_i ();
}
+
template <class EXT_ID, class INT_ID> ACE_INLINE int
ACE_Hash_Map_With_Allocator<EXT_ID, INT_ID>::bind (const EXT_ID &ext_id,
const INT_ID &int_id,
@@ -19,6 +23,7 @@ ACE_Hash_Map_With_Allocator<EXT_ID, INT_ID>::bind (const EXT_ID &ext_id,
this->entry_allocator_ = alloc;
return this->bind_i (ext_id, int_id);
}
+
template <class EXT_ID, class INT_ID> ACE_INLINE int
ACE_Hash_Map_With_Allocator<EXT_ID, INT_ID>::unbind (const EXT_ID &ext_id,
INT_ID &int_id,
@@ -29,6 +34,7 @@ ACE_Hash_Map_With_Allocator<EXT_ID, INT_ID>::unbind (const EXT_ID &ext_id,
this->entry_allocator_ = alloc;
return this->unbind_i (ext_id, int_id);
}
+
template <class EXT_ID, class INT_ID> ACE_INLINE int
ACE_Hash_Map_With_Allocator<EXT_ID, INT_ID>::unbind (const EXT_ID &ext_id,
ACE_Allocator *alloc)
@@ -38,6 +44,7 @@ ACE_Hash_Map_With_Allocator<EXT_ID, INT_ID>::unbind (const EXT_ID &ext_id,
this->entry_allocator_ = alloc;
return this->unbind_i (ext_id);
}
+
template <class EXT_ID, class INT_ID> ACE_INLINE int
ACE_Hash_Map_With_Allocator<EXT_ID, INT_ID>::rebind (const EXT_ID &ext_id,
const INT_ID &int_id,
@@ -50,6 +57,7 @@ ACE_Hash_Map_With_Allocator<EXT_ID, INT_ID>::rebind (const EXT_ID &ext_id,
this->entry_allocator_ = alloc;
return this->rebind_i (ext_id, int_id, old_ext_id, old_int_id);
}
+
template <class EXT_ID, class INT_ID> ACE_INLINE int
ACE_Hash_Map_With_Allocator<EXT_ID, INT_ID>::find (const EXT_ID &ext_id,
INT_ID &int_id,
@@ -60,6 +68,7 @@ ACE_Hash_Map_With_Allocator<EXT_ID, INT_ID>::find (const EXT_ID &ext_id,
this->entry_allocator_ = alloc;
return this->find_i (ext_id, int_id);
}
+
template <class EXT_ID, class INT_ID> ACE_INLINE int
ACE_Hash_Map_With_Allocator<EXT_ID, INT_ID>::find (const EXT_ID &ext_id,
ACE_Allocator *alloc)
@@ -69,4 +78,5 @@ ACE_Hash_Map_With_Allocator<EXT_ID, INT_ID>::find (const EXT_ID &ext_id,
this->entry_allocator_ = alloc;
return this->find_i (ext_id);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Hash_Multi_Map_Manager_T.h b/dep/ACE_wrappers/ace/Hash_Multi_Map_Manager_T.h
index 3876fcff663..1719819213d 100644
--- a/dep/ACE_wrappers/ace/Hash_Multi_Map_Manager_T.h
+++ b/dep/ACE_wrappers/ace/Hash_Multi_Map_Manager_T.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Hash_Multi_Map_Manager_T.h
@@ -20,18 +21,25 @@
* @author Shanshan Jiang <shanshan.jiang@vanderbilt.edu>
*/
//=============================================================================
+
#ifndef ACE_HASH_MULTI_MAP_MANAGER_T_H
#define ACE_HASH_MULTI_MAP_MANAGER_T_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Default_Constants.h"
#include "ace/Functor_T.h"
#include "ace/Log_Msg.h"
+
#include "ace/Unbounded_Set.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Hash_Multi_Map_Entry
*
@@ -42,58 +50,77 @@ class ACE_Hash_Multi_Map_Entry
{
public:
friend class ACE_Unbounded_Set<INT_ID>;
+
typedef ACE_Unbounded_Set<INT_ID> VALUE_SET;
typedef ACE_Unbounded_Set_Iterator<INT_ID> VALUE_SET_ITERATOR;
+
// = Initialization and termination methods.
/// Constructor.
ACE_Hash_Multi_Map_Entry (const EXT_ID &ext_id,
const ACE_Unbounded_Set<INT_ID> &int_id_set,
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *next = 0,
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *prev = 0);
+
/// Constructor.
ACE_Hash_Multi_Map_Entry (ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *next,
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *prev);
+
# if ! defined (ACE_HAS_BROKEN_NOOP_DTORS)
/// Destructor.
~ACE_Hash_Multi_Map_Entry (void);
#endif /* ! defined (ACE_HAS_BROKEN_NOOP_DTORS) */
+
/// Key accessor.
EXT_ID& key (void);
+
/// Item accessor.
ACE_Unbounded_Set<INT_ID>& item (void);
+
/// Key used to look up an entry.
/// @deprecated Use key()
EXT_ID ext_id_;
+
/// The contents of the entry itself.
/// @deprecated Use item()
ACE_Unbounded_Set<INT_ID> int_id_set_;
+
/// Pointer to the next item in the bucket of overflow nodes.
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *next_;
+
/// Pointer to the prev item in the bucket of overflow nodes.
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *prev_;
+
/// Dump the state of an object.
void dump (void) const;
};
+
// Forward decl.
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
class ACE_Hash_Multi_Map_Iterator_Base;
+
// Forward decl.
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
class ACE_Hash_Multi_Map_Const_Iterator_Base;
+
// Forward decl.
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
class ACE_Hash_Multi_Map_Iterator;
+
// Forward decl.
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
class ACE_Hash_Multi_Map_Const_Iterator;
+
// Forward decl.
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
class ACE_Hash_Multi_Map_Reverse_Iterator;
+
// Forward decl.
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
class ACE_Hash_Multi_Map_Bucket_Iterator;
+
// Forward decl.
class ACE_Allocator;
+
/**
* @class ACE_Hash_Multi_Map_Manager
*
@@ -107,6 +134,7 @@ class ACE_Allocator;
* user can make this a persistent class by providing an
* @c ACE_Allocator with a persistable memory pool.
*/
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
class ACE_Hash_Multi_Map_Manager
{
@@ -117,6 +145,7 @@ public:
friend class ACE_Hash_Multi_Map_Const_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>;
friend class ACE_Hash_Multi_Map_Reverse_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>;
friend class ACE_Hash_Multi_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>;
+
typedef EXT_ID
KEY;
typedef INT_ID
@@ -124,6 +153,7 @@ public:
typedef ACE_LOCK lock_type;
typedef ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID>
ENTRY;
+
// = ACE-style iterator typedefs.
typedef ACE_Hash_Multi_Map_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>
ITERATOR;
@@ -131,6 +161,7 @@ public:
CONST_ITERATOR;
typedef ACE_Hash_Multi_Map_Reverse_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>
REVERSE_ITERATOR;
+
// = STL-style iterator typedefs.
typedef ACE_Hash_Multi_Map_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>
iterator;
@@ -138,7 +169,9 @@ public:
const_iterator;
typedef ACE_Hash_Multi_Map_Reverse_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>
reverse_iterator;
+
// = Initialization and termination methods.
+
/**
* Initialize a @c Hash_Multi_Map_Manager with default size elements.
* @param table_alloc is a pointer to a memory allocator used for
@@ -154,6 +187,7 @@ public:
*/
ACE_Hash_Multi_Map_Manager (ACE_Allocator *table_alloc = 0,
ACE_Allocator *entry_alloc = 0);
+
/**
* Initialize a @c Hash_Multi_Map_Manager with @a size elements.
* @param size is the number of elements in a Hash_Multi_Map_Manager.
@@ -171,6 +205,7 @@ public:
ACE_Hash_Multi_Map_Manager (size_t size,
ACE_Allocator *table_alloc = 0,
ACE_Allocator *entry_alloc = 0);
+
/**
* Initialize a @c Hash_Multi_Map_Manager with @a size elements.
* @param size is the number of elements in a Hash_Multi_Map_Manager.
@@ -186,16 +221,21 @@ public:
* @a table_alloc.
* @return -1 on failure, 0 on success
*/
+
int open (size_t size = ACE_DEFAULT_MAP_SIZE,
ACE_Allocator *table_alloc = 0,
ACE_Allocator *entry_alloc = 0);
+
/// Close down a Hash_Multi_Map_Manager and release dynamically allocated
/// resources.
int close (void);
+
/// Removes all the entries in Hash_Multi_Map_Manager.
int unbind_all (void);
+
/// Cleanup the Hash_Multi_Map_Manager.
~ACE_Hash_Multi_Map_Manager (void);
+
/**
* Associate @a ext_id with @a int_id. If @a ext_id and @a int_id is already
* in the map then the @c ACE_Hash_Multi_Map_Entry is not changed. Returns 0 if
@@ -204,6 +244,7 @@ public:
*/
int bind (const EXT_ID &ext_id,
const INT_ID &int_id);
+
/**
* Same as a normal bind, except the map entry is also passed back
* to the caller. The entry in this case will either be the newly
@@ -212,6 +253,7 @@ public:
int bind (const EXT_ID &ext_id,
const INT_ID &int_id,
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *&entry);
+
/**
* Associate @a ext_id with @a int_id_set. If @a ext_id is already in the
* map then the @c ACE_Hash_Multi_Map_Entry is not changed. Returns 0 if a
@@ -220,6 +262,7 @@ public:
*/
int bind (const EXT_ID &ext_id,
const ACE_Unbounded_Set<INT_ID> &int_id_set);
+
/**
* Same as a normal bind, except the map entry is also passed back
* to the caller. The entry in this case will either be the newly
@@ -228,6 +271,7 @@ public:
int bind (const EXT_ID &ext_id,
const ACE_Unbounded_Set<INT_ID> &int_id_set,
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *&entry);
+
/**
* Associate @a ext_id with @a int_id_set if and only if @a ext_id is
* not in the map. If @a ext_id is already in the map then the @a int_id_set
@@ -237,6 +281,7 @@ public:
*/
int trybind (const EXT_ID &ext_id,
ACE_Unbounded_Set<INT_ID> &int_id_set);
+
/**
* Same as a normal trybind, except the map entry is also passed
* back to the caller. The entry in this case will either be the
@@ -245,6 +290,7 @@ public:
int trybind (const EXT_ID &ext_id,
ACE_Unbounded_Set<INT_ID> &int_id_set,
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *&entry);
+
/**
* Reassociate @a ext_id with @a int_id_set. If @a ext_id is not in
* the map then behaves just like bind. Returns 0 if a new entry is
@@ -253,6 +299,7 @@ public:
*/
int rebind (const EXT_ID &ext_id,
const ACE_Unbounded_Set<INT_ID> &int_id_set);
+
/**
* Same as a normal rebind, except the map entry is also passed back
* to the caller. The entry in this case will either be the newly
@@ -261,6 +308,7 @@ public:
int rebind (const EXT_ID &ext_id,
const ACE_Unbounded_Set<INT_ID> &int_id_set,
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *&entry);
+
/**
* Associate @a ext_id with @a int_id_set. If @a ext_id is not in the map
* then behaves just like bind. Otherwise, store the old value of
@@ -271,6 +319,7 @@ public:
int rebind (const EXT_ID &ext_id,
const ACE_Unbounded_Set<INT_ID> &int_id_set,
ACE_Unbounded_Set<INT_ID> &old_int_id_set);
+
/**
* Same as a normal rebind, except the map entry is also passed back
* to the caller. The entry in this case will either be the newly
@@ -280,6 +329,7 @@ public:
const ACE_Unbounded_Set<INT_ID> &int_id_set,
ACE_Unbounded_Set<INT_ID> &old_int_id_set,
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *&entry);
+
/**
* Associate @a ext_id with @a int_id_set. If @a ext_id is not in the map
* then behaves just like bind. Otherwise, store the old values
@@ -294,6 +344,7 @@ public:
const ACE_Unbounded_Set<INT_ID> &int_id_set,
EXT_ID &old_ext_id,
ACE_Unbounded_Set<INT_ID> &old_int_id_set);
+
/**
* Same as a normal rebind, except the map entry is also passed back
* to the caller. The entry in this case will either be the newly
@@ -304,44 +355,55 @@ public:
EXT_ID &old_ext_id,
ACE_Unbounded_Set<INT_ID> &old_int_id_set,
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *&entry);
+
/// Locate @a ext_id and pass out parameter via @a int_id_set.
/// Return 0 if found, returns -1 if not found.
int find (const EXT_ID &ext_id,
ACE_Unbounded_Set<INT_ID> &int_id_set) const;
+
/// Locate @a ext_id and @a int_id.
/// Return 0 if found, returns -1 if not found.
int find (const EXT_ID &ext_id,
const INT_ID &int_id) const;
+
/// Returns 0 if the @a ext_id is in the mapping, otherwise -1.
int find (const EXT_ID &ext_id) const;
+
/// Locate @a ext_id and pass out parameter via @a entry. If found,
/// return 0, returns -1 if not found.
int find (const EXT_ID &ext_id,
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *&entry) const;
+
/**
* Unbind (remove) the @a ext_id from the map. Don't return the
* int_id to the caller (this is useful for collections where the
* int_ids are *not* dynamically allocated...)
*/
int unbind (const EXT_ID &ext_id);
+
/// Break any association of @a ext_id. Returns the value of @a int_id_set
/// in case the caller needs to deallocate memory. Return 0 if the
/// unbind was successfully, and returns -1 if failures occur.
int unbind (const EXT_ID &ext_id,
ACE_Unbounded_Set<INT_ID> &int_id_set);
+
/// Break any association of @a ext_id and @a int_id. Return 0 if the
/// unbind was successfully, and returns -1 if failures occur.
int unbind (const EXT_ID &ext_id,
const INT_ID &int_id);
+
/// Remove @a entry from map. Return 0 if the unbind was successfully,
/// and returns -1 if failures occur.
int unbind (ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *entry);
+
/// Returns the current number of @c ACE_Hash_Multi_Map_Entry objects in the
/// hash table.
size_t current_size (void) const;
+
/// Return the size of the array that's used to point to the
/// linked lists of @c ACE_Hash_Multi_Map_Entry objects in the hash table.
size_t total_size (void) const;
+
/**
* Returns a reference to the underlying @c ACE_LOCK. This makes it
* possible to acquire the lock explicitly, which can be useful in
@@ -351,133 +413,173 @@ public:
* @note The right name would be lock, but HP/C++ will choke on that!
*/
ACE_LOCK &mutex (void);
+
/// Dump the state of an object.
void dump (void) const;
+
// = STL styled iterator factory functions.
+
/// Return forward iterator.
ACE_Hash_Multi_Map_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> begin (void);
ACE_Hash_Multi_Map_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> end (void);
+
/// Return reverse iterator.
ACE_Hash_Multi_Map_Reverse_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> rbegin (void);
ACE_Hash_Multi_Map_Reverse_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> rend (void);
+
protected:
// = The following methods do the actual work.
+
/// Returns 1 if @a id1 == @a id2, else 0. This is defined as a
/// separate method to facilitate template specialization.
int equal (const EXT_ID &id1, const EXT_ID &id2);
+
/// Compute the hash value of the @a ext_id. This is defined as a
/// separate method to facilitate template specialization.
u_long hash (const EXT_ID &ext_id);
+
// = These methods assume locks are held by private methods.
+
/// Performs bind. Must be called with locks held.
int bind_i (const EXT_ID &ext_id,
const INT_ID &int_id);
+
/// Performs bind. Must be called with locks held.
int bind_i (const EXT_ID &ext_id,
const INT_ID &int_id,
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *&entry);
+
/// Performs bind. Must be called with locks held.
int bind_i (const EXT_ID &ext_id,
const ACE_Unbounded_Set<INT_ID> &int_id_set);
+
/// Performs bind. Must be called with locks held.
int bind_i (const EXT_ID &ext_id,
const ACE_Unbounded_Set<INT_ID> &int_id_set,
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *&entry);
+
/// Performs trybind. Must be called with locks held.
int trybind_i (const EXT_ID &ext_id,
ACE_Unbounded_Set<INT_ID> &int_id_set);
+
/// Performs trybind. Must be called with locks held.
int trybind_i (const EXT_ID &ext_id,
ACE_Unbounded_Set<INT_ID> &int_id_set,
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *&entry);
+
/// Performs rebind. Must be called with locks held.
int rebind_i (const EXT_ID &ext_id,
const ACE_Unbounded_Set<INT_ID> &int_id_set);
+
/// Performs rebind. Must be called with locks held.
int rebind_i (const EXT_ID &ext_id,
const ACE_Unbounded_Set<INT_ID> &int_id_set,
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *&entry);
+
/// Performs rebind. Must be called with locks held.
int rebind_i (const EXT_ID &ext_id,
const ACE_Unbounded_Set<INT_ID> &int_id_set,
ACE_Unbounded_Set<INT_ID> &old_int_id);
+
/// Performs rebind. Must be called with locks held.
int rebind_i (const EXT_ID &ext_id,
const ACE_Unbounded_Set<INT_ID> &int_id_set,
ACE_Unbounded_Set<INT_ID> &old_int_id_set,
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *&entry);
+
/// Performs rebind. Must be called with locks held.
int rebind_i (const EXT_ID &ext_id,
const ACE_Unbounded_Set<INT_ID> &int_id_set,
EXT_ID &old_ext_id,
ACE_Unbounded_Set<INT_ID> &old_int_id_set);
+
/// Performs rebind. Must be called with locks held.
int rebind_i (const EXT_ID &ext_id,
const ACE_Unbounded_Set<INT_ID> &int_id_set,
EXT_ID &old_ext_id,
ACE_Unbounded_Set<INT_ID> &old_int_id_set,
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *&entry);
+
/// Performs a find of @a int_id_set using @a ext_id as the key. Must be
/// called with locks held.
int find_i (const EXT_ID &ext_id,
ACE_Unbounded_Set<INT_ID> &int_id_set);
+
/// Performs a find of @a ext_id and @a int_id. Must be
/// called with locks held.
int find_i (const EXT_ID &ext_id,
const INT_ID &int_id);
+
/// Performs a find using @a ext_id as the key. Must be called with
/// locks held.
int find_i (const EXT_ID &ext_id);
+
/// Performs a find using @a ext_id as the key. Must be called with
/// locks held.
int find_i (const EXT_ID &ext_id,
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *&entry);
+
/// Performs unbind. Must be called with locks held.
int unbind_i (const EXT_ID &ext_id,
ACE_Unbounded_Set<INT_ID> &int_id_set);
+
/// Performs unbind. Must be called with locks held.
int unbind_i (const EXT_ID &ext_id,
const INT_ID &int_id);
+
/// Performs unbind. Must be called with locks held.
int unbind_i (const EXT_ID &ext_id);
+
/// Performs unbind. Must be called with locks held.
int unbind_i (ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *entry);
+
/**
* Resize the map. Must be called with locks held.
* @note This method should never be called more than once or else all the
* hashing will get screwed up as the size will change.
*/
int create_buckets (size_t size);
+
/// Close down a Map_Manager. Must be called with
/// locks held.
int close_i (void);
+
/// Removes all the entries in Map_Manager. Must be called with
/// locks held.
int unbind_all_i (void);
+
/// Pointer to a memory allocator used for table_, so it should
/// supply size*sizeof (@c ACE_Hash_Multi_Map_Entry<@c EXT_ID, @c INT_ID>),
ACE_Allocator *table_allocator_;
+
/// Addidtional allocator for entries, so it should be able to
/// allocate 'size' / chunks of sizeof
/// (@c ACE_Hash_Multi_Map_Entry<@c EXT_ID, @c INT_ID>) bytes each.
ACE_Allocator *entry_allocator_;
+
/// Synchronization variable for the MT_SAFE
/// @c ACE_Hash_Multi_Map_Manager.
ACE_LOCK lock_;
+
/// Function object used for hashing keys.
HASH_KEY hash_key_;
+
/// Function object used for comparing keys.
COMPARE_KEYS compare_keys_;
+
protected:
/// Returns the @c ACE_Hash_Multi_Map_Entry object that corresponds to
/// @a ext_id.
int shared_find (const EXT_ID &ext_id,
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *&entry,
size_t &loc);
+
/// Accessor of the underlying table
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *table (void);
+
/// Accessor of the current size attribute
size_t cur_size (void) const;
+
private:
/**
* Array of the pointers to @c ACE_Hash_Multi_Map_Entry objects, each of
@@ -485,16 +587,20 @@ private:
* beginning of a linked list of @c EXT_ID that hash to that bucket.
*/
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *table_;
+
/// Total size of the hash table.
size_t total_size_;
+
/// Current number of entries in the table
/// @note That this can be larger than total_size_ due to the
/// bucket chaining).
size_t cur_size_;
+
// = Disallow these operations.
ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &))
ACE_UNIMPLEMENTED_FUNC (ACE_Hash_Multi_Map_Manager (const ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &))
};
+
/**
* @class ACE_Hash_Multi_Map_Iterator_Base
*
@@ -512,41 +618,56 @@ public:
/// at the head of the map, it is positioned at the end otherwise.
ACE_Hash_Multi_Map_Iterator_Base (ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &mm,
int head);
+
// = ITERATION methods.
+
/// Pass back the @a next_entry that hasn't been seen in the Set.
/// Returns 0 when all items have been seen, else 1.
int next (ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *&next_entry) const;
+
/// Returns 1 when all items have been seen, else 0.
int done (void) const;
+
/// Returns a reference to the interal element this object is pointing to.
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID>& operator* (void) const;
+
/// Returns a pointer to the interal element this object is pointing to.
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID>* operator-> (void) const;
+
/// Returns reference the @c Hash_Multi_Map_Manager that is being iterated
/// over.
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>& map (void);
+
/// Check if two iterators point to the same position
bool operator== (const ACE_Hash_Multi_Map_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &) const;
bool operator!= (const ACE_Hash_Multi_Map_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
/// Move forward by one element in the set. Returns 0 when there's
/// no more item in the set after the current items, else 1.
int forward_i (void);
+
/// Move backward by one element in the set. Returns 0 when there's
/// no more item in the set before the current item, else 1.
int reverse_i (void);
+
/// Dump the state of an object.
void dump_i (void) const;
+
/// Map we are iterating over.
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *map_man_;
+
/// Keeps track of how far we've advanced in the table.
ssize_t index_;
+
/// Keeps track of how far we've advanced in a linked list in each
/// table slot.
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *next_;
};
+
/**
* @class ACE_Hash_Multi_Map_Const_Iterator_Base
*
@@ -564,41 +685,56 @@ public:
/// at the head of the map, it is positioned at the end otherwise.
ACE_Hash_Multi_Map_Const_Iterator_Base (const ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &mm,
int head);
+
// = ITERATION methods.
+
/// Pass back the @a next_entry that hasn't been seen in the Set.
/// Returns 0 when all items have been seen, else 1.
int next (ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *&next_entry) const;
+
/// Returns 1 when all items have been seen, else 0.
int done (void) const;
+
/// Returns a reference to the interal element this object is pointing to.
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID>& operator* (void) const;
+
/// Returns a pointer to the interal element this object is pointing to.
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID>* operator-> (void) const;
+
/// Returns reference the @c Hash_Multi_Map_Manager that is being iterated
/// over.
const ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>& map (void);
+
/// Check if two iterators point to the same position
bool operator== (const ACE_Hash_Multi_Map_Const_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &) const;
bool operator!= (const ACE_Hash_Multi_Map_Const_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
/// Move forward by one element in the set. Returns 0 when there's
/// no more item in the set after the current items, else 1.
int forward_i (void);
+
/// Move backward by one element in the set. Returns 0 when there's
/// no more item in the set before the current item, else 1.
int reverse_i (void);
+
/// Dump the state of an object.
void dump_i (void) const;
+
/// Map we are iterating over.
const ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *map_man_;
+
/// Keeps track of how far we've advanced in the table.
ssize_t index_;
+
/// Keeps track of how far we've advanced in a linked list in each
/// table slot.
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *next_;
};
+
/**
* @class ACE_Hash_Multi_Map_Iterator
*
@@ -618,24 +754,33 @@ public:
// = Initialization method.
ACE_Hash_Multi_Map_Iterator (ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &mm,
int tail = 0);
+
// = Iteration methods.
/// Move forward by one element in the set. Returns 0 when all the
/// items in the set have been seen, else 1.
int advance (void);
+
/// Dump the state of an object.
void dump (void) const;
+
// = STL styled iteration, compare, and reference functions.
+
/// Prefix advance.
ACE_Hash_Multi_Map_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &operator++ (void);
+
/// Postfix advance.
ACE_Hash_Multi_Map_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> operator++ (int);
+
/// Prefix reverse.
ACE_Hash_Multi_Map_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &operator-- (void);
+
/// Postfix reverse.
ACE_Hash_Multi_Map_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> operator-- (int);
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
};
+
/**
* @class ACE_Hash_Multi_Map_Const_Iterator
*
@@ -655,24 +800,33 @@ public:
// = Initialization method.
ACE_Hash_Multi_Map_Const_Iterator (const ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &mm,
int tail = 0);
+
// = Iteration methods.
/// Move forward by one element in the set. Returns 0 when all the
/// items in the set have been seen, else 1.
int advance (void);
+
/// Dump the state of an object.
void dump (void) const;
+
// = STL styled iteration, compare, and reference functions.
+
/// Prefix advance.
ACE_Hash_Multi_Map_Const_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &operator++ (void);
+
/// Postfix advance.
ACE_Hash_Multi_Map_Const_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> operator++ (int);
+
/// Prefix reverse.
ACE_Hash_Multi_Map_Const_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &operator-- (void);
+
/// Postfix reverse.
ACE_Hash_Multi_Map_Const_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> operator-- (int);
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
};
+
/**
* @class ACE_Hash_Multi_Map_Bucket_Iterator
*
@@ -700,40 +854,55 @@ public:
ACE_Hash_Multi_Map_Bucket_Iterator (ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &mm,
const EXT_ID &ext_id,
int tail = 0);
+
// = STL styled iteration, compare, and reference functions.
+
/// Prefix advance.
ACE_Hash_Multi_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &operator++ (void);
+
/// Postfix advance.
ACE_Hash_Multi_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> operator++ (int);
+
/// Prefix reverse.
ACE_Hash_Multi_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &operator-- (void);
+
/// Postfix reverse.
ACE_Hash_Multi_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> operator-- (int);
+
/// Returns a reference to the interal element this object is pointing to.
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID>& operator* (void) const;
+
/// Returns a pointer to the interal element this object is pointing to.
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID>* operator-> (void) const;
+
/// Returns reference the Hash_Multi_Map_Manager that is being iterated
/// over.
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>& map (void);
+
/// Check if two iterators point to the same position
bool operator== (const ACE_Hash_Multi_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &) const;
bool operator!= (const ACE_Hash_Multi_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &) const;
+
protected:
/// Move forward by one element in the set. Returns 0 when there's
/// no more item in the set after the current items, else 1.
int forward_i (void);
+
/// Move backward by one element in the set. Returns 0 when there's
/// no more item in the set before the current item, else 1.
int reverse_i (void);
+
/// Map we are iterating over.
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *map_man_;
+
/// Keeps track of how far we've advanced in the table.
ssize_t index_;
+
/// Keeps track of how far we've advanced in a linked list in each
/// table slot.
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *next_;
};
+
/**
* @class ACE_Hash_Multi_Map_Reverse_Iterator
*
@@ -753,34 +922,47 @@ public:
// = Initialization method.
ACE_Hash_Multi_Map_Reverse_Iterator (ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &mm,
int head = 0);
+
// = Iteration methods.
/// Move forward by one element in the set. Returns 0 when all the
/// items in the set have been seen, else 1.
int advance (void);
+
/// Dump the state of an object.
void dump (void) const;
+
// = STL styled iteration, compare, and reference functions.
+
/// Prefix reverse.
ACE_Hash_Multi_Map_Reverse_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &operator++ (void);
+
/// Postfix reverse.
ACE_Hash_Multi_Map_Reverse_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> operator++ (int);
+
/// Prefix advance.
ACE_Hash_Multi_Map_Reverse_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &operator-- (void);
+
/// Postfix advance.
ACE_Hash_Multi_Map_Reverse_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> operator-- (int);
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
# include "ace/Hash_Multi_Map_Manager_T.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Hash_Multi_Map_Manager_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Hash_Multi_Map_Manager_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
#endif /* ACE_HASH_MULTI_MAP_MANAGER_T_H */
diff --git a/dep/ACE_wrappers/ace/Hash_Multi_Map_Manager_T.inl b/dep/ACE_wrappers/ace/Hash_Multi_Map_Manager_T.inl
index ee801aa4030..b6c353c2153 100644
--- a/dep/ACE_wrappers/ace/Hash_Multi_Map_Manager_T.inl
+++ b/dep/ACE_wrappers/ace/Hash_Multi_Map_Manager_T.inl
@@ -1,8 +1,11 @@
// -*- C++ -*-
//
// $Id: Hash_Multi_Map_Manager_T.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Guard_T.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_Hash_Multi_Map_Manager (size_t size,
ACE_Allocator *table_alloc,
@@ -16,6 +19,7 @@ ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::AC
if (this->open (size, table_alloc, entry_alloc) == -1)
ACE_ERROR ((LM_ERROR, ACE_TEXT ("ACE_Hash_Multi_Map_Manager\n")));
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_Hash_Multi_Map_Manager (ACE_Allocator *table_alloc,
ACE_Allocator *entry_alloc)
@@ -28,156 +32,196 @@ ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::AC
if (this->open (ACE_DEFAULT_MAP_SIZE, table_alloc, entry_alloc) == -1)
ACE_ERROR ((LM_ERROR, ACE_TEXT ("ACE_Hash_Multi_Map_Manager\n")));
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::close (void)
{
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
return this->close_i ();
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::unbind_all (void)
{
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
return this->unbind_all_i ();
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::~ACE_Hash_Multi_Map_Manager (void)
{
this->close ();
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE size_t
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::current_size (void) const
{
return this->cur_size_;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE size_t
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::total_size (void) const
{
return this->total_size_;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE ACE_LOCK &
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::mutex (void)
{
ACE_TRACE ("ACE_Hash_Multi_Map_Manager::mutex");
return this->lock_;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE u_long
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::hash (const EXT_ID &ext_id)
{
return this->hash_key_ (ext_id);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::equal (const EXT_ID &id1,
const EXT_ID &id2)
{
return this->compare_keys_ (id1, id2);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::bind_i (const EXT_ID &ext_id,
const INT_ID &int_id)
{
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *temp;
+
return this->bind_i (ext_id, int_id, temp);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::bind_i (const EXT_ID &ext_id,
const ACE_Unbounded_Set<INT_ID> &int_id_set)
{
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *temp;
+
return this->bind_i (ext_id, int_id_set, temp);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::bind (const EXT_ID &ext_id,
const INT_ID &int_id)
{
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
return this->bind_i (ext_id, int_id);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::bind (const EXT_ID &ext_id,
const INT_ID &int_id,
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *&entry)
{
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
return this->bind_i (ext_id, int_id, entry);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::bind (const EXT_ID &ext_id,
const ACE_Unbounded_Set<INT_ID> &int_id_set)
{
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
return this->bind_i (ext_id, int_id_set);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::bind (const EXT_ID &ext_id,
const ACE_Unbounded_Set<INT_ID> &int_id_set,
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *&entry)
{
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
return this->bind_i (ext_id, int_id_set, entry);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::trybind_i (const EXT_ID &ext_id,
ACE_Unbounded_Set<INT_ID> &int_id_set)
{
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *temp;
+
int result = this->trybind_i (ext_id, int_id_set, temp);
if (result == 1)
int_id_set = temp->int_id_set_;
return result;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::trybind (const EXT_ID &ext_id,
ACE_Unbounded_Set<INT_ID> &int_id_set)
{
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
return this->trybind_i (ext_id, int_id_set);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::trybind (const EXT_ID &ext_id,
ACE_Unbounded_Set<INT_ID> &int_id_set,
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *&entry)
{
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
return this->trybind_i (ext_id, int_id_set, entry);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::unbind_i (const EXT_ID &ext_id)
{
ACE_Unbounded_Set<INT_ID> int_id_set;
+
return this->unbind_i (ext_id, int_id_set);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::unbind (const EXT_ID &ext_id,
ACE_Unbounded_Set<INT_ID> &int_id_set)
{
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
return this->unbind_i (ext_id, int_id_set);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::unbind (const EXT_ID &ext_id,
const INT_ID &int_id)
{
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
return this->unbind_i (ext_id, int_id);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::unbind (const EXT_ID &ext_id)
{
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
return this->unbind_i (ext_id) == -1 ? -1 : 0;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::unbind (ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *entry)
{
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
return this->unbind_i (entry) == -1 ? -1 : 0;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::find_i (const EXT_ID &ext_id,
ACE_Unbounded_Set<INT_ID> &int_id_set)
{
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *entry;
+
size_t dummy;
if (this->shared_find (ext_id, entry, dummy) == -1)
return -1;
@@ -187,11 +231,13 @@ ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::fi
return 0;
}
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::find_i (const EXT_ID &ext_id,
const INT_ID &int_id)
{
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *entry;
+
size_t dummy;
if (this->shared_find (ext_id, entry, dummy) == -1)
return -1;
@@ -203,13 +249,16 @@ ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::fi
return -1;
}
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::find_i (const EXT_ID &ext_id)
{
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *entry;
+
size_t dummy;
return this->shared_find (ext_id, entry, dummy);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::find (const EXT_ID &ext_id,
ACE_Unbounded_Set<INT_ID> &int_id_set) const
@@ -217,9 +266,12 @@ ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::fi
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *nc_this =
const_cast <ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *>
(this);
+
ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, nc_this->lock_, -1);
+
return nc_this->find_i (ext_id, int_id_set);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::find (const EXT_ID &ext_id,
const INT_ID &int_id) const
@@ -227,18 +279,24 @@ ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::fi
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *nc_this =
const_cast <ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *>
(this);
+
ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, nc_this->lock_, -1);
+
return nc_this->find_i (ext_id, int_id);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::find (const EXT_ID &ext_id) const
{
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *nc_this =
const_cast <ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *>
(this);
+
ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, nc_this->lock_, -1);
+
return nc_this->find_i (ext_id);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::find_i (const EXT_ID &ext_id,
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *&entry)
@@ -246,6 +304,7 @@ ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::fi
size_t dummy;
return this->shared_find (ext_id, entry, dummy);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::find (const EXT_ID &ext_id,
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *&entry) const
@@ -253,29 +312,36 @@ ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::fi
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *nc_this =
const_cast <ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *>
(this);
+
ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, nc_this->lock_, -1);
+
return nc_this->find_i (ext_id, entry);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::rebind_i (const EXT_ID &ext_id,
const ACE_Unbounded_Set<INT_ID> &int_id_set)
{
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *node;
+
return this->rebind_i (ext_id,
int_id_set,
node);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::rebind_i (const EXT_ID &ext_id,
const ACE_Unbounded_Set<INT_ID> &int_id_set,
ACE_Unbounded_Set<INT_ID> &old_int_id_set)
{
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *node;
+
return this->rebind_i (ext_id,
int_id_set,
old_int_id_set,
node);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::rebind_i (const EXT_ID &ext_id,
const ACE_Unbounded_Set<INT_ID> &int_id_set,
@@ -283,35 +349,43 @@ ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::re
ACE_Unbounded_Set<INT_ID> &old_int_id_set)
{
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *node;
+
return this->rebind_i (ext_id,
int_id_set,
old_ext_id,
old_int_id_set,
node);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::rebind (const EXT_ID &ext_id,
const ACE_Unbounded_Set<INT_ID> &int_id_set)
{
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
return this->rebind_i (ext_id, int_id_set);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::rebind (const EXT_ID &ext_id,
const ACE_Unbounded_Set<INT_ID> &int_id_set,
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *&entry)
{
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
return this->rebind_i (ext_id, int_id_set, entry);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::rebind (const EXT_ID &ext_id,
const ACE_Unbounded_Set<INT_ID> &int_id_set,
ACE_Unbounded_Set<INT_ID> &old_int_id_set)
{
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
return this->rebind_i (ext_id, int_id_set, old_int_id_set);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::rebind (const EXT_ID &ext_id,
const ACE_Unbounded_Set<INT_ID> &int_id_set,
@@ -319,8 +393,10 @@ ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::re
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *&entry)
{
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
return this->rebind_i (ext_id, int_id_set, old_int_id_set, entry);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::rebind (const EXT_ID &ext_id,
const ACE_Unbounded_Set<INT_ID> &int_id_set,
@@ -328,8 +404,10 @@ ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::re
ACE_Unbounded_Set<INT_ID> &old_int_id_set)
{
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
return this->rebind_i (ext_id, int_id_set, old_ext_id, old_int_id_set);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::rebind (const EXT_ID &ext_id,
const ACE_Unbounded_Set<INT_ID> &int_id_set,
@@ -338,44 +416,52 @@ ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::re
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *&entry)
{
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
return this->rebind_i (ext_id, int_id_set, old_ext_id, old_int_id_set, entry);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Multi_Map_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::begin (void)
{
return ACE_Hash_Multi_Map_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> (*this);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Multi_Map_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::end (void)
{
return ACE_Hash_Multi_Map_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> (*this, 1);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Multi_Map_Reverse_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::rbegin (void)
{
return ACE_Hash_Multi_Map_Reverse_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> (*this);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Multi_Map_Reverse_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::rend (void)
{
return ACE_Hash_Multi_Map_Reverse_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> (*this, 1);
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::table (void)
{
return this->table_;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
size_t
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::cur_size (void) const
{
return this->cur_size_;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Multi_Map_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_Hash_Multi_Map_Iterator_Base (ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &mm,
int head)
@@ -384,13 +470,16 @@ ACE_Hash_Multi_Map_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOC
next_ (0)
{
ACE_TRACE ("ACE_Hash_Multi_Map_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_Hash_Multi_Map_Iterator_Base");
+
if (mm.table_ != 0)
this->next_ = &mm.table_[head != 0 ? 0 : mm.total_size_ - 1];
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Multi_Map_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::next (ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *&entry) const
{
ACE_TRACE ("ACE_Hash_Multi_Map_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::next");
+
if (this->map_man_->table_ != 0
&& this->index_ < static_cast<ssize_t> (this->map_man_->total_size_)
&& this->index_ >= 0
@@ -402,36 +491,47 @@ ACE_Hash_Multi_Map_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOC
else
return 0;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Multi_Map_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::done (void) const
{
ACE_TRACE ("ACE_Hash_Multi_Map_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::done");
+
return this->map_man_->table_ == 0
|| this->index_ >= static_cast<ssize_t> (this->map_man_->total_size_)
|| this->index_ < 0;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> &
ACE_Hash_Multi_Map_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator* (void) const
{
ACE_TRACE ("ACE_Hash_Multi_Map_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator*");
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *retv = 0;
+
int result = this->next (retv);
+
ACE_UNUSED_ARG (result);
ACE_ASSERT (result != 0);
+
return *retv;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *
ACE_Hash_Multi_Map_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-> (void) const
{
ACE_TRACE ("ACE_Hash_Multi_Map_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator->");
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *retv = 0;
+
int result = this->next (retv);
+
ACE_UNUSED_ARG (result);
ACE_ASSERT (result != 0);
+
return retv;
}
+
// Returns the reference to the Hash_Multi_Map_manager_ex that is being
// iterated over.
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
@@ -441,6 +541,7 @@ ACE_Hash_Multi_Map_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOC
ACE_TRACE ("ACE_Hash_Multi_Map_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::map");
return *this->map_man_;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE bool
ACE_Hash_Multi_Map_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator== (const ACE_Hash_Multi_Map_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &rhs) const
{
@@ -449,6 +550,7 @@ ACE_Hash_Multi_Map_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOC
&& this->index_ == rhs.index_
&& this->next_ == rhs.next_;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE bool
ACE_Hash_Multi_Map_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator!= (const ACE_Hash_Multi_Map_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &rhs) const
{
@@ -457,6 +559,7 @@ ACE_Hash_Multi_Map_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOC
|| this->index_ != rhs.index_
|| this->map_man_ != rhs.map_man_;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Multi_Map_Const_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_Hash_Multi_Map_Const_Iterator_Base (const ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &mm,
int head)
@@ -465,13 +568,16 @@ ACE_Hash_Multi_Map_Const_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, A
next_ (0)
{
ACE_TRACE ("ACE_Hash_Multi_Map_Const_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_Hash_Multi_Map_Const_Iterator_Base");
+
if (mm.table_ != 0)
this->next_ = &mm.table_[head != 0 ? 0 : mm.total_size_ - 1];
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Multi_Map_Const_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::next (ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *&entry) const
{
ACE_TRACE ("ACE_Hash_Multi_Map_Const_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::next");
+
if (this->map_man_->table_ != 0
&& this->index_ < (ssize_t) this->map_man_->total_size_
&& this->index_ >= 0
@@ -483,36 +589,47 @@ ACE_Hash_Multi_Map_Const_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, A
else
return 0;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Multi_Map_Const_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::done (void) const
{
ACE_TRACE ("ACE_Hash_Multi_Map_Const_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::done");
+
return this->map_man_->table_ == 0
|| this->index_ >= (ssize_t) this->map_man_->total_size_
|| this->index_ < 0;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> &
ACE_Hash_Multi_Map_Const_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator* (void) const
{
ACE_TRACE ("ACE_Hash_Multi_Map_Const_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator*");
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *retv = 0;
+
int result = this->next (retv);
+
ACE_UNUSED_ARG (result);
ACE_ASSERT (result != 0);
+
return *retv;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *
ACE_Hash_Multi_Map_Const_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-> (void) const
{
ACE_TRACE ("ACE_Hash_Multi_Map_Const_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator->");
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *retv = 0;
+
int result = this->next (retv);
+
ACE_UNUSED_ARG (result);
ACE_ASSERT (result != 0);
+
return retv;
}
+
// Returns the reference to the Hash_Multi_Map_manager_ex that is being
// iterated over.
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
@@ -522,6 +639,7 @@ ACE_Hash_Multi_Map_Const_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, A
ACE_TRACE ("ACE_Hash_Multi_Map_Const_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::map");
return *this->map_man_;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE bool
ACE_Hash_Multi_Map_Const_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator== (const ACE_Hash_Multi_Map_Const_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &rhs) const
{
@@ -530,6 +648,7 @@ ACE_Hash_Multi_Map_Const_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, A
&& this->index_ == rhs.index_
&& this->next_ == rhs.next_;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE bool
ACE_Hash_Multi_Map_Const_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator!= (const ACE_Hash_Multi_Map_Const_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &rhs) const
{
@@ -538,15 +657,19 @@ ACE_Hash_Multi_Map_Const_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, A
|| this->index_ != rhs.index_
|| this->map_man_ != rhs.map_man_;
}
+
ACE_ALLOC_HOOK_DEFINE(ACE_Hash_Multi_Map_Iterator)
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE void
ACE_Hash_Multi_Map_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_Hash_Multi_Map_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::dump");
+
this->dump_i ();
#endif /* ACE_HAS_DUMP */
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Multi_Map_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_Hash_Multi_Map_Iterator (ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &mm,
int tail)
@@ -557,55 +680,68 @@ ACE_Hash_Multi_Map_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::A
if (tail == 0)
this->forward_i ();
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Multi_Map_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::advance (void)
{
ACE_TRACE ("ACE_Hash_Multi_Map_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::advance");
return this->forward_i ();
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Multi_Map_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &
ACE_Hash_Multi_Map_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (void)
{
ACE_TRACE ("ACE_Hash_Multi_Map_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (void)");
+
this->forward_i ();
return *this;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Multi_Map_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>
ACE_Hash_Multi_Map_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (int)
{
ACE_TRACE ("ACE_Hash_Multi_Map_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (int)");
+
ACE_Hash_Multi_Map_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> retv (*this);
++*this;
return retv;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Multi_Map_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &
ACE_Hash_Multi_Map_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (void)
{
ACE_TRACE ("ACE_Hash_Multi_Map_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (void)");
+
this->reverse_i ();
return *this;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Multi_Map_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>
ACE_Hash_Multi_Map_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (int)
{
ACE_TRACE ("ACE_Hash_Multi_Map_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (int)");
+
ACE_Hash_Multi_Map_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> retv (*this);
--*this;
return retv;
}
+
ACE_ALLOC_HOOK_DEFINE(ACE_Hash_Multi_Map_Const_Iterator)
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE void
ACE_Hash_Multi_Map_Const_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_Hash_Multi_Map_Const_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::dump");
+
this->dump_i ();
#endif /* ACE_HAS_DUMP */
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Multi_Map_Const_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_Hash_Multi_Map_Const_Iterator (const ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &mm,
int tail)
@@ -616,46 +752,56 @@ ACE_Hash_Multi_Map_Const_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LO
if (tail == 0)
this->forward_i ();
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Multi_Map_Const_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::advance (void)
{
ACE_TRACE ("ACE_Hash_Multi_Map_Const_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::advance");
return this->forward_i ();
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Multi_Map_Const_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &
ACE_Hash_Multi_Map_Const_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (void)
{
ACE_TRACE ("ACE_Hash_Multi_Map_Const_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (void)");
+
this->forward_i ();
return *this;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Multi_Map_Const_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>
ACE_Hash_Multi_Map_Const_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (int)
{
ACE_TRACE ("ACE_Hash_Multi_Map_Const_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (int)");
+
ACE_Hash_Multi_Map_Const_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> retv (*this);
++*this;
return retv;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Multi_Map_Const_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &
ACE_Hash_Multi_Map_Const_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (void)
{
ACE_TRACE ("ACE_Hash_Multi_Map_Const_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (void)");
+
this->reverse_i ();
return *this;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Multi_Map_Const_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>
ACE_Hash_Multi_Map_Const_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (int)
{
ACE_TRACE ("ACE_Hash_Multi_Map_Const_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (int)");
+
ACE_Hash_Multi_Map_Const_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> retv (*this);
--*this;
return retv;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Multi_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_Hash_Multi_Map_Bucket_Iterator (ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &mm,
const EXT_ID &ext_id,
@@ -663,73 +809,92 @@ ACE_Hash_Multi_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_L
: map_man_ (&mm)
{
ACE_TRACE ("ACE_Hash_Multi_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_Hash_Multi_Map_Bucket_Iterator");
+
this->index_ = this->map_man_->hash (ext_id) % this->map_man_->total_size_;
this->next_ = &this->map_man_->table_[this->index_];
+
if (tail == 0)
this->forward_i ();
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Multi_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &
ACE_Hash_Multi_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (void)
{
ACE_TRACE ("ACE_Hash_Multi_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (void)");
+
this->forward_i ();
return *this;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Multi_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>
ACE_Hash_Multi_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (int)
{
ACE_TRACE ("ACE_Hash_Multi_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (int)");
+
ACE_Hash_Multi_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> retv (*this);
++*this;
return retv;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Multi_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &
ACE_Hash_Multi_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (void)
{
ACE_TRACE ("ACE_Hash_Multi_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (void)");
+
this->reverse_i ();
return *this;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Multi_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>
ACE_Hash_Multi_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (int)
{
ACE_TRACE ("ACE_Hash_Multi_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (int)");
+
ACE_Hash_Multi_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> retv (*this);
--*this;
return retv;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> int
ACE_Hash_Multi_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::forward_i (void)
{
ACE_TRACE ("ACE_Hash_Multi_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::forward_i");
+
this->next_ = this->next_->next_;
return this->next_ != &this->map_man_->table_[this->index_];
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> int
ACE_Hash_Multi_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::reverse_i (void)
{
ACE_TRACE ("ACE_Hash_Multi_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::reverse_i");
+
this->next_ = this->next_->prev_;
return this->next_ != &this->map_man_->table_[this->index_];
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> &
ACE_Hash_Multi_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator* (void) const
{
ACE_TRACE ("ACE_Hash_Multi_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator*");
+
return *this->next_;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *
ACE_Hash_Multi_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-> (void) const
{
ACE_TRACE ("ACE_Hash_Multi_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator->");
+
return this->next_;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &
ACE_Hash_Multi_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::map (void)
@@ -737,6 +902,7 @@ ACE_Hash_Multi_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_L
ACE_TRACE ("ACE_Hash_Multi_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::map");
return *this->map_man_;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE bool
ACE_Hash_Multi_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator== (const ACE_Hash_Multi_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &rhs) const
{
@@ -745,6 +911,7 @@ ACE_Hash_Multi_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_L
&& this->index_ == rhs.index_
&& this->next_ == rhs.next_;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE bool
ACE_Hash_Multi_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator!= (const ACE_Hash_Multi_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &rhs) const
{
@@ -753,15 +920,19 @@ ACE_Hash_Multi_Map_Bucket_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_L
|| this->index_ != rhs.index_
|| this->map_man_ != rhs.map_man_;
}
+
ACE_ALLOC_HOOK_DEFINE(ACE_Hash_Multi_Map_Reverse_Iterator)
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE void
ACE_Hash_Multi_Map_Reverse_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_Hash_Multi_Map_Reverse_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::dump");
+
this->dump_i ();
#endif /* ACE_HAS_DUMP */
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Multi_Map_Reverse_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_Hash_Multi_Map_Reverse_Iterator (ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &mm, int head)
: ACE_Hash_Multi_Map_Iterator_Base<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> (mm, head)
@@ -770,44 +941,54 @@ ACE_Hash_Multi_Map_Reverse_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_
if (head == 0)
this->reverse_i ();
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Multi_Map_Reverse_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::advance (void)
{
ACE_TRACE ("ACE_Hash_Multi_Map_Reverse_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::advance");
return this->reverse_i ();
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Multi_Map_Reverse_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &
ACE_Hash_Multi_Map_Reverse_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (void)
{
ACE_TRACE ("ACE_Hash_Multi_Map_Reverse_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (void)");
+
this->reverse_i ();
return *this;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Multi_Map_Reverse_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>
ACE_Hash_Multi_Map_Reverse_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (int)
{
ACE_TRACE ("ACE_Hash_Multi_Map_Reverse_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (int)");
+
ACE_Hash_Multi_Map_Reverse_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> retv (*this);
++*this;
return retv;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Multi_Map_Reverse_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &
ACE_Hash_Multi_Map_Reverse_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (void)
{
ACE_TRACE ("ACE_Hash_Multi_Map_Reverse_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (void)");
+
this->forward_i ();
return *this;
}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Multi_Map_Reverse_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>
ACE_Hash_Multi_Map_Reverse_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (int)
{
ACE_TRACE ("ACE_Hash_Multi_Map_Reverse_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (int)");
+
ACE_Hash_Multi_Map_Reverse_Iterator<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> retv (*this);
--*this;
return retv;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Hashable.cpp b/dep/ACE_wrappers/ace/Hashable.cpp
index efcad1b3296..c3c9bc43a1a 100644
--- a/dep/ACE_wrappers/ace/Hashable.cpp
+++ b/dep/ACE_wrappers/ace/Hashable.cpp
@@ -1,17 +1,23 @@
//$Id: Hashable.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Hashable.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Hashable.inl"
#endif /* __ACE_INLINE __ */
+
ACE_RCSID (ace,
Hashable,
"$Id: Hashable.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_Hashable::~ACE_Hashable (void)
{
}
+
unsigned long
ACE_Hashable::hash (void) const
{
@@ -20,9 +26,12 @@ ACE_Hashable::hash (void) const
// happen far less often than a non-zero value, so this caching
// strategy should pay off, esp. if hash computation is expensive
// relative to the simple comparison.
+
if (this->hash_value_ == 0)
this->hash_value_ = this->hash_i ();
+
return this->hash_value_;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Hashable.h b/dep/ACE_wrappers/ace/Hashable.h
index 2bb122741c7..88e272cd8b9 100644
--- a/dep/ACE_wrappers/ace/Hashable.h
+++ b/dep/ACE_wrappers/ace/Hashable.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Hashable.h
@@ -8,14 +9,20 @@
* @author Doug Schmidt
*/
//=============================================================================
+
#ifndef ACE_HASHABLE_H
#define ACE_HASHABLE_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Hashable
*
@@ -24,25 +31,36 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
class ACE_Export ACE_Hashable
{
public:
+
/// Destructor.
virtual ~ACE_Hashable (void);
+
/// Computes and returns hash value. This "caches" the hash value to
/// improve performance.
virtual unsigned long hash (void) const;
+
protected:
/// Protected constructor.
ACE_Hashable (void);
+
/// This is the method that actually performs the non-cached hash
/// computation.
virtual unsigned long hash_i (void) const = 0;
+
protected:
+
/// Pre-computed hash-value.
mutable unsigned long hash_value_;
+
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Hashable.inl"
#endif /* __ACE_INLINE __ */
+
#include /**/ "ace/post.h"
+
#endif /*ACE_HASHABLE_H*/
diff --git a/dep/ACE_wrappers/ace/Hashable.inl b/dep/ACE_wrappers/ace/Hashable.inl
index e226277b395..352b7794eb9 100644
--- a/dep/ACE_wrappers/ace/Hashable.inl
+++ b/dep/ACE_wrappers/ace/Hashable.inl
@@ -2,10 +2,13 @@
//
// $Id: Hashable.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_Hashable::ACE_Hashable (void)
: hash_value_ (0)
{
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/High_Res_Timer.cpp b/dep/ACE_wrappers/ace/High_Res_Timer.cpp
index dacc241f9da..181c1da5682 100644
--- a/dep/ACE_wrappers/ace/High_Res_Timer.cpp
+++ b/dep/ACE_wrappers/ace/High_Res_Timer.cpp
@@ -1,14 +1,18 @@
// $Id: High_Res_Timer.cpp 81030 2008-03-20 12:43:29Z johnnyw $
+
// Be very carefull before changing the calculations inside
// ACE_High_Res_Timer. The precision matters and we are using integer
// calculations not floating point. Also look good at the emulated 64
// bit int class (inside Basic_Types{h,i,cpp} before changing
// anything. It's operator/ only returns 32 bits not 64 bits, among
// other things.
+
#include "ace/High_Res_Timer.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/High_Res_Timer.inl"
#endif /* __ACE_INLINE__ */
+
#include "ace/Stats.h"
#include "ace/OS_NS_stdio.h"
#include "ace/OS_NS_string.h"
@@ -17,50 +21,67 @@
#include "ace/OS_NS_unistd.h"
#include "ace/OS_NS_stdlib.h"
#include "ace/Truncate.h"
+
ACE_RCSID(ace, High_Res_Timer, "$Id: High_Res_Timer.cpp 81030 2008-03-20 12:43:29Z johnnyw $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_High_Res_Timer)
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
// For Intel platforms, a scale factor is required for
// ACE_OS::gethrtime. We'll still set this to one to prevent division
// by zero errors.
#if (defined (ACE_WIN32) || defined (ACE_HAS_POWERPC_TIMER) || \
defined (ACE_HAS_PENTIUM) || defined (ACE_HAS_ALPHA_TIMER)) && \
!defined (ACE_HAS_HI_RES_TIMER)
+
# include "ace/Guard_T.h"
# include "ace/Recursive_Thread_Mutex.h"
# include "ace/Object_Manager.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Initialize the global_scale_factor_ to 1. The first
// ACE_High_Res_Timer instance construction will override this
// value.
/* static */
ACE_UINT32 ACE_High_Res_Timer::global_scale_factor_ = 1u;
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#else /* ! (ACE_WIN32 || ACE_HAS_POWERPC_TIMER || \
ACE_HAS_PENTIUM || ACE_HAS_ALPHA_TIMER) ||
ACE_HAS_HI_RES_TIMER */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// A scale_factor of 1000 converts nanosecond ticks to microseconds.
// That is, on these platforms, 1 tick == 1 nanosecond.
/* static */
ACE_UINT32 ACE_High_Res_Timer::global_scale_factor_ = 1000u;
+
ACE_END_VERSIONED_NAMESPACE_DECL
#endif /* ! (ACE_WIN32 || ACE_HAS_POWERPC_TIMER || \
ACE_HAS_PENTIUM || ACE_HAS_ALPHA_TIMER) ||
ACE_HAS_HI_RES_TIMER */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// This is used to tell if the global_scale_factor_ has been
// set, and if high resolution timers are supported.
/* static */
int ACE_High_Res_Timer::global_scale_factor_status_ = 0;
+
#if defined (linux)
// Determine the apparent CPU clock speed from /proc/cpuinfo
ACE_UINT32
ACE_High_Res_Timer::get_cpuinfo (void)
{
ACE_UINT32 scale_factor = 1u;
+
// Get the BogoMIPS from /proc/cpuinfo. It works fine on Alpha and
// Pentium Pro. For other CPUs, it will be necessary to interpret
// the BogoMips, as described in the BogoMips mini-HOWTO. Note that
@@ -69,12 +90,16 @@ ACE_High_Res_Timer::get_cpuinfo (void)
#if !defined (__alpha__)
bool supported = false;
#endif /* __alpha__ */
+
FILE *cpuinfo = ACE_OS::fopen (ACE_TEXT ("/proc/cpuinfo"),
ACE_TEXT ("r"));
+
if (cpuinfo != 0)
{
char buf[128];
+
// ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nReading /proc/cpuinfo...")));
+
while (ACE_OS::fgets (buf, sizeof buf, cpuinfo))
{
#if defined (__alpha__)
@@ -96,6 +121,7 @@ ACE_High_Res_Timer::get_cpuinfo (void)
double mhertz = 1;
double bmips = 1;
char arg[128];
+
// CPU type?
if (::sscanf (buf, "cpu : %s\n", arg) == 1)
{
@@ -151,12 +177,16 @@ ACE_High_Res_Timer::get_cpuinfo (void)
}
#endif /* __alpha__ */
}
+
// ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" (done)\n")));
+
ACE_OS::fclose (cpuinfo);
}
+
return scale_factor;
}
#endif /* linux */
+
ACE_UINT32
ACE_High_Res_Timer::global_scale_factor (void)
{
@@ -173,6 +203,7 @@ ACE_High_Res_Timer::global_scale_factor (void)
// do with static objects; it's just a convenient lock to use.
ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon,
*ACE_Static_Object_Lock::instance (), 0));
+
// Double check
if (ACE_High_Res_Timer::global_scale_factor_status_ == 0)
{
@@ -189,15 +220,19 @@ ACE_High_Res_Timer::global_scale_factor (void)
ACE_High_Res_Timer::global_scale_factor
(static_cast<unsigned int> (freq.QuadPart / ACE_HR_SCALE_CONVERSION));
# endif // (ACE_LACKS_LONGLONG_T)
+
ACE_High_Res_Timer::global_scale_factor_status_ = 1;
}
else
// High-Res timers not supported
ACE_High_Res_Timer::global_scale_factor_status_ = -1;
+
return ACE_High_Res_Timer::global_scale_factor_;
+
# elif defined (linux)
ACE_High_Res_Timer::global_scale_factor (ACE_High_Res_Timer::get_cpuinfo ());
# endif /* ! ACE_WIN32 && ! (linux && __alpha__) */
+
# if !defined (ACE_WIN32)
if (ACE_High_Res_Timer::global_scale_factor_ == 1u)
// Failed to retrieve CPU speed from system, so calculate it.
@@ -205,20 +240,26 @@ ACE_High_Res_Timer::global_scale_factor (void)
# endif // (ACE_WIN32)
}
}
+
ACE_High_Res_Timer::global_scale_factor_status_ = 1;
#endif /* (ACE_WIN32 || ACE_HAS_POWERPC_TIMER || \
ACE_HAS_PENTIUM || ACE_HAS_ALPHA_TIMER) && \
! ACE_HAS_HI_RES_TIMER &&
((WIN32 && ! WINCE) || ghs || __GNUG__) */
+
return ACE_High_Res_Timer::global_scale_factor_;
}
+
ACE_High_Res_Timer::ACE_High_Res_Timer (void)
{
ACE_TRACE ("ACE_High_Res_Timer::ACE_High_Res_Timer");
+
this->reset ();
+
// Make sure that the global scale factor is set.
(void) global_scale_factor ();
}
+
ACE_UINT32
ACE_High_Res_Timer::calibrate (const ACE_UINT32 usec,
const u_int iterations)
@@ -227,6 +268,7 @@ ACE_High_Res_Timer::calibrate (const ACE_UINT32 usec,
ACE_Stats delta_hrtime;
// In units of 100 usec, to avoid overflow.
ACE_Stats actual_sleeps;
+
for (u_int i = 0;
i < iterations;
++i)
@@ -240,28 +282,35 @@ ACE_High_Res_Timer::calibrate (const ACE_UINT32 usec,
ACE_OS::gethrtime ();
const ACE_Time_Value actual_delta =
ACE_OS::gettimeofday () - actual_start;
+
// Store the sample.
delta_hrtime.sample (ACE_Utils::truncate_cast<ACE_INT32> (stop - start));
actual_sleeps.sample (actual_delta.msec () * 100u);
}
+
// Calculate the mean value of the samples, with no fractional
// precision. Use it for the global scale factor.
ACE_Stats_Value ticks (0);
delta_hrtime.mean (ticks);
+
ACE_Stats_Value actual_sleep (0);
actual_sleeps.mean (actual_sleep);
+
// The addition of 5 below rounds instead of truncates.
const ACE_UINT32 scale_factor =
(ticks.whole () / actual_sleep.whole () + 5) /
10u /* usec/100 usec */;
ACE_High_Res_Timer::global_scale_factor (scale_factor);
+
return scale_factor;
}
+
void
ACE_High_Res_Timer::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_High_Res_Timer::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nglobal_scale_factor_: %u\n"),
global_scale_factor ()));
@@ -293,28 +342,34 @@ ACE_High_Res_Timer::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
void
ACE_High_Res_Timer::reset (void)
{
ACE_TRACE ("ACE_High_Res_Timer::reset");
+
this->start_ = 0;
this->end_ = 0;
this->total_ = 0;
this->start_incr_ = 0;
}
+
void
ACE_High_Res_Timer::elapsed_time (ACE_Time_Value &tv) const
{
hrtime_to_tv (tv,
ACE_High_Res_Timer::elapsed_hrtime (this->end_, this->start_));
}
+
#if defined (ACE_HAS_POSIX_TIME)
// Note... Win32 does not have ACE_HAS_POSIX_TIME, so the scale factor
// does not need to take into account the different units on Win32.
+
void
ACE_High_Res_Timer::elapsed_time (struct timespec &elapsed_time) const
{
// This implementation should be cleaned up.
+
// Just grab the nanoseconds. That is, leave off all values above
// microsecond. This equation is right! Don't mess with me! (It
// first strips off everything but the portion less than 1 usec.
@@ -326,18 +381,22 @@ ACE_High_Res_Timer::elapsed_time (struct timespec &elapsed_time) const
u_long nseconds = static_cast<u_long> (elapsed %
global_scale_factor () * 1000u /
global_scale_factor ());
+
// Get just the microseconds (dropping any left over nanoseconds).
ACE_UINT32 useconds = (ACE_UINT32) (elapsed / global_scale_factor ());
+
elapsed_time.tv_sec = (time_t) (useconds / ACE_ONE_SECOND_IN_USECS);
// Transforms one second in microseconds into nanoseconds.
elapsed_time.tv_nsec = (time_t) ((useconds % ACE_ONE_SECOND_IN_USECS) * 1000u + nseconds);
}
#endif /* ACE_HAS_POSIX_TIME */
+
void
ACE_High_Res_Timer::elapsed_time_incr (ACE_Time_Value &tv) const
{
hrtime_to_tv (tv, total_);
}
+
void
ACE_High_Res_Timer::elapsed_time (ACE_hrtime_t &nanoseconds) const
{
@@ -352,6 +411,7 @@ ACE_High_Res_Timer::elapsed_time (ACE_hrtime_t &nanoseconds) const
// Right shift is implemented for non native 64-bit ints
// operator/ only for a 32 bit result !
}
+
void
ACE_High_Res_Timer::elapsed_time_incr (ACE_hrtime_t &nanoseconds) const
{
@@ -361,6 +421,7 @@ ACE_High_Res_Timer::elapsed_time_incr (ACE_hrtime_t &nanoseconds) const
// Caution - Borland has a problem with >>=, so resist the temptation.
nanoseconds = nanoseconds >> 10;
}
+
#if !defined (ACE_HAS_WINCE)
void
ACE_High_Res_Timer::print_ave (const ACE_TCHAR *str,
@@ -368,14 +429,17 @@ ACE_High_Res_Timer::print_ave (const ACE_TCHAR *str,
ACE_HANDLE handle) const
{
ACE_TRACE ("ACE_High_Res_Timer::print_ave");
+
// Get the total number of nanoseconds elapsed.
ACE_hrtime_t total_nanoseconds;
this->elapsed_time (total_nanoseconds);
+
// Separate to seconds and nanoseconds.
u_long total_secs =
static_cast<u_long> (total_nanoseconds / (ACE_UINT32) ACE_ONE_SECOND_IN_NSECS);
ACE_UINT32 extra_nsecs =
static_cast<ACE_UINT32> (total_nanoseconds % (ACE_UINT32) ACE_ONE_SECOND_IN_NSECS);
+
ACE_TCHAR buf[100];
if (count > 1)
{
@@ -392,6 +456,7 @@ ACE_High_Res_Timer::print_ave (const ACE_TCHAR *str,
ACE_TEXT (" total %3lu.%06lu secs\n"),
total_secs,
(extra_nsecs + 500lu) / 1000lu);
+
ACE_OS::write (handle,
str,
ACE_OS::strlen (str));
@@ -399,24 +464,29 @@ ACE_High_Res_Timer::print_ave (const ACE_TCHAR *str,
buf,
ACE_OS::strlen (buf));
}
+
void
ACE_High_Res_Timer::print_total (const ACE_TCHAR *str,
const int count,
ACE_HANDLE handle) const
{
ACE_TRACE ("ACE_High_Res_Timer::print_total");
+
// Get the total number of nanoseconds elapsed.
ACE_hrtime_t total_nanoseconds;
this->elapsed_time (total_nanoseconds);
+
// Separate to seconds and nanoseconds.
u_long total_secs =
(u_long) (total_nanoseconds / (ACE_UINT32) ACE_ONE_SECOND_IN_NSECS);
ACE_UINT32 extra_nsecs =
(ACE_UINT32) (total_nanoseconds % (ACE_UINT32) ACE_ONE_SECOND_IN_NSECS);
+
ACE_TCHAR buf[100];
if (count > 1)
{
ACE_hrtime_t avg_nsecs = this->total_ / (ACE_UINT32) count;
+
ACE_OS::sprintf (buf,
ACE_TEXT (" count = %d, total (secs %lu, usecs %u), avg usecs = %lu\n"),
count,
@@ -429,6 +499,7 @@ ACE_High_Res_Timer::print_total (const ACE_TCHAR *str,
ACE_TEXT (" total %3lu.%06u secs\n"),
total_secs,
(extra_nsecs + 500u) / 1000u);
+
ACE_OS::write (handle,
str,
ACE_OS::strlen (str));
@@ -437,6 +508,7 @@ ACE_High_Res_Timer::print_total (const ACE_TCHAR *str,
ACE_OS::strlen (buf));
}
#endif /* !ACE_HAS_WINCE */
+
int
ACE_High_Res_Timer::get_env_global_scale_factor (const ACE_TCHAR *env)
{
@@ -459,5 +531,6 @@ ACE_High_Res_Timer::get_env_global_scale_factor (const ACE_TCHAR *env)
#endif /* !ACE_HAS_WINCE */
return -1;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/High_Res_Timer.h b/dep/ACE_wrappers/ace/High_Res_Timer.h
index 20c27a13132..83584c39b19 100644
--- a/dep/ACE_wrappers/ace/High_Res_Timer.h
+++ b/dep/ACE_wrappers/ace/High_Res_Timer.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file High_Res_Timer.h
@@ -8,17 +9,23 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//==========================================================================
+
#ifndef ACE_HIGH_RES_TIMER_H
#define ACE_HIGH_RES_TIMER_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Basic_Types.h"
#include "ace/OS_NS_time.h"
#include "ace/Time_Value.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_High_Res_Timer
*
@@ -94,6 +101,7 @@ class ACE_Export ACE_High_Res_Timer
{
public:
// = Initialization method.
+
/**
* global_scale_factor_ is set to @a gsf. All High_Res_Timers use
* global_scale_factor_. This allows applications to set the scale
@@ -108,11 +116,14 @@ public:
* instead a hardcoded value.
*/
static void global_scale_factor (ACE_UINT32 gsf);
+
/// Returns the global_scale_factor.
static ACE_UINT32 global_scale_factor (void);
+
#ifndef ACE_HR_SCALE_CONVERSION
# define ACE_HR_SCALE_CONVERSION (ACE_ONE_SECOND_IN_USECS)
#endif /* ACE_HR_SCALE_CONVERSION */
+
/**
* Sets the global_scale_factor to the value in the @a env
* environment variable. Returns 0 on success, -1 on failure.
@@ -122,6 +133,7 @@ public:
*/
static int get_env_global_scale_factor (const ACE_TCHAR *env
= ACE_TEXT ("ACE_SCALE_FACTOR"));
+
/**
* Set (and return, for info) the global scale factor by sleeping
* for @a usec and counting the number of intervening clock cycles.
@@ -135,16 +147,22 @@ public:
*/
static ACE_UINT32 calibrate (const ACE_UINT32 usec = 500000,
const u_int iterations = 10);
+
/// Initialize the timer.
ACE_High_Res_Timer (void);
+
/// Destructor.
~ACE_High_Res_Timer (void);
+
/// Reinitialize the timer.
void reset (void);
+
/// Start timing.
void start (const ACE_OS::ACE_HRTimer_Op = ACE_OS::ACE_HRTIMER_GETTIME);
+
/// Stop timing.
void stop (const ACE_OS::ACE_HRTimer_Op = ACE_OS::ACE_HRTIMER_GETTIME);
+
/// Set @a tv to the number of microseconds elapsed.
/**
* Could overflow within hours on windows with emulated 64 bit int's
@@ -152,32 +170,40 @@ public:
* so normaly don't have this problem.
*/
void elapsed_time (ACE_Time_Value &tv) const;
+
/// Set @a nanoseconds to the number of nanoseconds elapsed.
/**
* Will overflow when measuring more than 194 day's.
*/
void elapsed_time (ACE_hrtime_t &nanoseconds) const;
+
#if defined (ACE_HAS_POSIX_TIME)
/// Returns the elapsed (stop - start) time in a struct timespec
/// (sec, nsec).
void elapsed_time (struct timespec &) const;
#endif /* ACE_HAS_POSIX_TIME */
+
/// Sets @a usecs to the elapsed (stop - start) time in microseconds.
/**
* Will overflow on windows when measuring more than appox. 2^^54 ticks.
* Is still more than 48 days with a 4 Ghz counter.
*/
void elapsed_microseconds (ACE_hrtime_t &usecs) const;
+
/// Start incremental timing.
void start_incr (const ACE_OS::ACE_HRTimer_Op = ACE_OS::ACE_HRTIMER_GETTIME);
+
/// Stop incremental timing.
void stop_incr (const ACE_OS::ACE_HRTimer_Op = ACE_OS::ACE_HRTIMER_GETTIME);
+
/// Set @a tv to the number of microseconds elapsed between all calls
/// to start_incr and stop_incr.
void elapsed_time_incr (ACE_Time_Value &tv) const;
+
/// Set <nsec> to the number of nanoseconds elapsed between all calls
/// to start_incr and stop_incr.
void elapsed_time_incr (ACE_hrtime_t &nanoseconds) const;
+
#if !defined (ACE_HAS_WINCE)
// @@ WINCE These two functions are currently not supported on Windows CE.
// However, we should probably use the handle and ACE_Log_Msg to
@@ -187,15 +213,19 @@ public:
void print_total (const ACE_TCHAR *message,
const int iterations = 1,
ACE_HANDLE handle = ACE_STDOUT) const;
+
/// Print average time.
void print_ave (const ACE_TCHAR *message,
const int iterations = 1,
ACE_HANDLE handle = ACE_STDOUT) const;
#endif /* !ACE_HAS_WINCE */
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
/**
* Get the current "time" as the high resolution counter at this time.
* This is intended to be useful for supplying to a ACE_Timer_Queue
@@ -203,6 +233,7 @@ public:
* on the high res timer rather than wall clock time.
*/
static ACE_Time_Value gettimeofday_hr (void);
+
/**
* @deprecated THIS FUNCTION IS DEPRECATED. PLEASE USE
* <ACE_OS::gettimeofday> INSTEAD! Calls <ACE_High_Res_Timer::hrtime_to_tv>
@@ -218,9 +249,11 @@ public:
*/
static ACE_Time_Value gettimeofday (const ACE_OS::ACE_HRTimer_Op =
ACE_OS::ACE_HRTIMER_GETTIME);
+
/// Converts an @a hrt to @a tv using global_scale_factor_.
static void hrtime_to_tv (ACE_Time_Value &tv,
const ACE_hrtime_t hrt);
+
#if defined (linux)
/**
* This is used to find out the Mhz of the machine for the scale
@@ -229,6 +262,7 @@ public:
*/
static ACE_UINT32 get_cpuinfo (void);
#endif /* defined (linux) */
+
private:
/**
* For internal use: gets the high-resolution time using
@@ -239,22 +273,29 @@ private:
*/
static ACE_hrtime_t gettime (const ACE_OS::ACE_HRTimer_Op =
ACE_OS::ACE_HRTIMER_GETTIME);
+
/// Calculate the difference between two ACE_hrtime_t values. It is assumed
/// that the end time is later than start time, so if end is a smaller
/// value, the time counter has wrapped around.
static ACE_hrtime_t elapsed_hrtime (const ACE_hrtime_t end,
const ACE_hrtime_t start);
+
/// Starting time.
ACE_hrtime_t start_;
+
/// Ending time.
ACE_hrtime_t end_;
+
/// Total elapsed time.
ACE_hrtime_t total_;
+
/// Start time of incremental timing.
ACE_hrtime_t start_incr_;
+
/// Converts ticks to microseconds. That is, ticks /
/// global_scale_factor_ == microseconds.
static ACE_UINT32 global_scale_factor_;
+
/**
* Indicates the status of the global scale factor,
* 0 = hasn't been set
@@ -263,10 +304,13 @@ private:
*/
static int global_scale_factor_status_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/High_Res_Timer.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_HIGH_RES_TIMER_H */
diff --git a/dep/ACE_wrappers/ace/High_Res_Timer.inl b/dep/ACE_wrappers/ace/High_Res_Timer.inl
index 5fdc1445ff0..85df18abe8b 100644
--- a/dep/ACE_wrappers/ace/High_Res_Timer.inl
+++ b/dep/ACE_wrappers/ace/High_Res_Timer.inl
@@ -1,17 +1,22 @@
// -*- C++ -*- */
//
// $Id: High_Res_Timer.inl 81138 2008-03-28 09:18:15Z johnnyw $
+
#include "ace/Global_Macros.h"
+
#if defined (ACE_WIN32)
# include "ace/OS_NS_sys_time.h"
#endif /* ACE_WIN32 */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Be very careful before changing the calculations inside
// ACE_High_Res_Timer. The precision matters and we are using integer
// calculations not floating point. Also look closely at the emulated 64
// bit int class (inside Basic_Types{h,i,cpp} before changing
// anything. It's operator/ only returns 32 bits not 64 bits, among
// other things.
+
ACE_INLINE void
ACE_High_Res_Timer::hrtime_to_tv (ACE_Time_Value &tv,
const ACE_hrtime_t hrt)
@@ -21,6 +26,7 @@ ACE_High_Res_Timer::hrtime_to_tv (ACE_Time_Value &tv,
// clock ticks to microseconds.
tv.sec ((long) (hrt / (ACE_UINT32) ACE_HR_SCALE_CONVERSION /
global_scale_factor ()));
+
// Calculate usec in a manner that's compatible with ACE_U_LongLong.
// hrt = (tv.sec * ACE_ONE_SECOND_IN_USECS + tv.usec) * global_scale_factor_
// tv.usec = hrt / global_scale_factor_ - tv.sec * ACE_ONE_SECOND_IN_USECS
@@ -32,6 +38,7 @@ ACE_High_Res_Timer::hrtime_to_tv (ACE_Time_Value &tv,
tv.usec ((long) ((hrt - tmp) / global_scale_factor ()));
}
+
ACE_INLINE ACE_Time_Value
ACE_High_Res_Timer::gettimeofday (const ACE_OS::ACE_HRTimer_Op op)
{
@@ -39,15 +46,18 @@ ACE_High_Res_Timer::gettimeofday (const ACE_OS::ACE_HRTimer_Op op)
// Get the global scale factor if there isn't one yet.
if (ACE_High_Res_Timer::global_scale_factor_status_ == 0)
ACE_High_Res_Timer::global_scale_factor ();
+
// If there isn't a high-res timer, use gettimeofday ();
if (ACE_High_Res_Timer::global_scale_factor_status_ == -1)
return ACE_OS::gettimeofday ();
#endif /* ACE_WIN32 */
+
ACE_Time_Value tv;
ACE_High_Res_Timer::hrtime_to_tv (tv, ACE_OS::gethrtime (op));
return tv;
}
+
// Get the current high res timer as the time of day. This is intended
// to be used for a gettimeofday replacement in ACE_Timer_Queue and
// derived classes so the timers will bebased on high res timers rather
@@ -60,6 +70,7 @@ ACE_High_Res_Timer::gettimeofday_hr (void)
return ACE_High_Res_Timer::gettimeofday ();
}
+
ACE_INLINE ACE_hrtime_t
ACE_High_Res_Timer::gettime (const ACE_OS::ACE_HRTimer_Op op)
{
@@ -67,6 +78,7 @@ ACE_High_Res_Timer::gettime (const ACE_OS::ACE_HRTimer_Op op)
// Get the global scale factor if there isn't one yet.
if (ACE_High_Res_Timer::global_scale_factor_status_ == 0)
ACE_High_Res_Timer::global_scale_factor ();
+
// If there isn't a high-res timer, use gettimeofday ();
if (ACE_High_Res_Timer::global_scale_factor_status_ == -1)
{
@@ -76,8 +88,10 @@ ACE_High_Res_Timer::gettime (const ACE_OS::ACE_HRTimer_Op op)
return tv.sec () * ACE_ONE_SECOND_IN_USECS + tv.usec ();
}
#endif /* ACE_WIN32 */
+
return ACE_OS::gethrtime (op);
}
+
ACE_INLINE ACE_hrtime_t
ACE_High_Res_Timer::elapsed_hrtime (const ACE_hrtime_t end,
const ACE_hrtime_t start)
@@ -86,28 +100,33 @@ ACE_High_Res_Timer::elapsed_hrtime (const ACE_hrtime_t end,
return end - start;
return (~start + 1 + end); // Wrapped-around counter diff
}
+
ACE_INLINE
ACE_High_Res_Timer::~ACE_High_Res_Timer (void)
{
}
+
ACE_INLINE void
ACE_High_Res_Timer::start (const ACE_OS::ACE_HRTimer_Op op)
{
ACE_TRACE ("ACE_High_Res_Timer::start");
this->start_ = ACE_High_Res_Timer::gettime (op);
}
+
ACE_INLINE void
ACE_High_Res_Timer::stop (const ACE_OS::ACE_HRTimer_Op op)
{
ACE_TRACE ("ACE_High_Res_Timer::stop");
this->end_ = ACE_High_Res_Timer::gettime (op);
}
+
ACE_INLINE void
ACE_High_Res_Timer::start_incr (const ACE_OS::ACE_HRTimer_Op op)
{
ACE_TRACE ("ACE_High_Res_Timer::start_incr");
this->start_incr_ = ACE_High_Res_Timer::gettime (op);
}
+
ACE_INLINE void
ACE_High_Res_Timer::stop_incr (const ACE_OS::ACE_HRTimer_Op op)
{
@@ -116,6 +135,7 @@ ACE_High_Res_Timer::stop_incr (const ACE_OS::ACE_HRTimer_Op op)
ACE_High_Res_Timer::elapsed_hrtime (ACE_High_Res_Timer::gettime (op),
this->start_incr_);
}
+
ACE_INLINE void
ACE_High_Res_Timer::elapsed_microseconds (ACE_hrtime_t &usecs) const
{
@@ -123,9 +143,11 @@ ACE_High_Res_Timer::elapsed_microseconds (ACE_hrtime_t &usecs) const
this->start_);
usecs = (ACE_hrtime_t) (elapsed / global_scale_factor ());
}
+
ACE_INLINE void
ACE_High_Res_Timer::global_scale_factor (ACE_UINT32 gsf)
{
global_scale_factor_ = gsf;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/ICMP_Socket.cpp b/dep/ACE_wrappers/ace/ICMP_Socket.cpp
index 5cd647069bc..51f8a9b2064 100644
--- a/dep/ACE_wrappers/ace/ICMP_Socket.cpp
+++ b/dep/ACE_wrappers/ace/ICMP_Socket.cpp
@@ -1,27 +1,36 @@
// $Id: ICMP_Socket.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/ICMP_Socket.h"
+
#if defined (ACE_HAS_ICMP_SUPPORT) && (ACE_HAS_ICMP_SUPPORT == 1)
+
#include "ace/ACE.h"
#include "ace/Log_Msg.h"
#include "ace/OS_NS_netdb.h"
#include "ace/OS_NS_sys_socket.h"
+
ACE_RCSID (ace,
ICMP_Socket,
"$Id: ICMP_Socket.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE (ACE_ICMP_Socket)
+
void
ACE_ICMP_Socket::dump (void) const
{
ACE_TRACE ("ACE_ICMP_Socket::dump");
}
+
ACE_ICMP_Socket::ACE_ICMP_Socket (void)
{
ACE_TRACE ("ACE_ICMP_Socket::ACE_ICMP_Socket");
}
+
ssize_t
ACE_ICMP_Socket::send (void const * buf,
size_t n,
@@ -29,6 +38,7 @@ ACE_ICMP_Socket::send (void const * buf,
int flags) const
{
ACE_TRACE ("ACE_ICMP_Socket::send");
+
return ACE_OS::sendto (this->get_handle (),
(char const *) buf,
n,
@@ -36,6 +46,7 @@ ACE_ICMP_Socket::send (void const * buf,
(sockaddr const *) addr.get_addr (),
addr.get_size ());
}
+
ssize_t
ACE_ICMP_Socket::recv (void * buf,
size_t n,
@@ -43,6 +54,7 @@ ACE_ICMP_Socket::recv (void * buf,
int flags) const
{
ACE_TRACE ("ACE_ICMP_Socket::recv");
+
int addr_len = addr.get_size ();
ssize_t status = ACE_OS::recvfrom (this->get_handle (),
(char *) buf,
@@ -51,8 +63,10 @@ ACE_ICMP_Socket::recv (void * buf,
(sockaddr *) addr.get_addr (),
(int*) &addr_len);
addr.set_size (addr_len);
+
return status;
}
+
ssize_t
ACE_ICMP_Socket::recv (void * buf,
size_t n,
@@ -60,21 +74,25 @@ ACE_ICMP_Socket::recv (void * buf,
ACE_Time_Value const * timeout) const
{
ACE_TRACE ("ACE_ICMP_Socket::recv");
+
return ACE::recv (this->get_handle (),
buf,
n,
flags,
timeout);
}
+
int
ACE_ICMP_Socket::open (ACE_Addr const & local,
int protocol,
int reuse_addr)
{
ACE_TRACE ("ACE_ICMP_Socket::open");
+
// Check if icmp protocol is supported on this host
int proto_number = -1;
protoent *proto;
+
if (! (proto = getprotobyname ("icmp")))
{
ACE_ERROR_RETURN
@@ -86,6 +104,7 @@ ACE_ICMP_Socket::open (ACE_Addr const & local,
-1);
}
proto_number = proto->p_proto;
+
if (proto_number != IPPROTO_ICMP || proto_number != protocol)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -94,6 +113,7 @@ ACE_ICMP_Socket::open (ACE_Addr const & local,
ACE_TEXT ("currently supported.\n")),
-1);
}
+
if (ACE_SOCK::open (SOCK_RAW,
AF_INET,
protocol,
@@ -101,12 +121,15 @@ ACE_ICMP_Socket::open (ACE_Addr const & local,
{
return -1;
}
+
return this->shared_open (local);
}
+
int
ACE_ICMP_Socket::shared_open (ACE_Addr const & local)
{
ACE_TRACE ("ACE_ICMP_Socket::shared_open");
+
int error = 0;
if (local == ACE_Addr::sap_any)
{
@@ -121,12 +144,15 @@ ACE_ICMP_Socket::shared_open (ACE_Addr const & local)
{
error = 1;
}
+
if (error != 0)
{
this->close ();
}
+
return error ? -1 : 0;
}
+
unsigned short
ACE_ICMP_Socket::calculate_checksum (unsigned short * paddress,
int len)
@@ -140,17 +166,22 @@ ACE_ICMP_Socket::calculate_checksum (unsigned short * paddress,
sum += *w++;
nleft -= 2;
}
+
if (nleft == 1)
{
*((unsigned char *) &answer) = *((unsigned char *) w);
sum += answer;
}
+
// add back carry outs from top 16 bits to low 16 bits
sum = (sum >> 16) + (sum & 0xffff); // add hi 16 to low 16
sum += (sum >> 16); // add carry
answer = ~sum; // truncate to 16 bits
+
return (answer);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_ICMP_SUPPORT == 1 */
diff --git a/dep/ACE_wrappers/ace/ICMP_Socket.h b/dep/ACE_wrappers/ace/ICMP_Socket.h
index a22e22ff307..edb179ffb3a 100644
--- a/dep/ACE_wrappers/ace/ICMP_Socket.h
+++ b/dep/ACE_wrappers/ace/ICMP_Socket.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file ICMP_Socket.h
@@ -9,18 +10,26 @@
* @author Gonzalo A. Diethelm <gonzalo.diethelm@aditiva.com>
*/
//=============================================================================
+
#ifndef ACE_ICMP_SOCKET_H
#define ACE_ICMP_SOCKET_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_ICMP_SUPPORT) && (ACE_HAS_ICMP_SUPPORT == 1)
+
#include "ace/SOCK.h"
#include "ace/Time_Value.h"
#include "ace/os_include/netinet/os_in.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_ICMP_Socket
*
@@ -31,54 +40,72 @@ class ACE_Export ACE_ICMP_Socket : public ACE_SOCK
{
public:
// = Initialization methods.
+
/**
* @name Data transfer routines.
*
* Data transfer routines.
*/
//@{
+
/// Send an @a n byte @a buf to the datagram socket (uses
/// @c sendto(3) ).
ssize_t send (void const * buf,
size_t n,
ACE_Addr const & addr,
int flags = 0) const;
+
/// Receive an @a n byte @a buf from the datagram socket
/// (uses @c recvfrom(3) ).
ssize_t recv (void * buf,
size_t n,
ACE_Addr & addr,
int flags = 0) const;
+
/// TODO: comment
ssize_t recv (void * buf,
size_t n,
int flags,
ACE_Time_Value const * timeout) const;
+
//@}
+
/// Wrapper around the BSD-style @c socket system call (no QoS).
int open (ACE_Addr const & local = ACE_Addr::sap_any,
int protocol = IPPROTO_ICMP,
int reuse_addr = 0);
+
/// Dump the state of object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
+
// Protected constructors, so the class can only be derived from.
+
/// Default constructor.
ACE_ICMP_Socket (void);
+
/// Constructor that takes a local listening address.
ACE_ICMP_Socket (ACE_Addr const & local,
int protocol = IPPROTO_ICMP,
int reuse_addr = 0);
+
/// Wrapper around BSD-style @c bind system call.
int shared_open (ACE_Addr const & local);
+
/// Calculates check-sum.
unsigned short calculate_checksum (unsigned short* paddress,
int len);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_ICMP_SUPPORT == 1 */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_ICMP_SOCKET_H */
diff --git a/dep/ACE_wrappers/ace/INET_Addr.cpp b/dep/ACE_wrappers/ace/INET_Addr.cpp
index 297d9d75308..6da4417f08e 100644
--- a/dep/ACE_wrappers/ace/INET_Addr.cpp
+++ b/dep/ACE_wrappers/ace/INET_Addr.cpp
@@ -1,9 +1,13 @@
// $Id: INET_Addr.cpp 82434 2008-07-28 11:40:36Z johnnyw $
+
// Defines the Internet domain address family address format.
+
#include "ace/INET_Addr.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/INET_Addr.inl"
#endif /* __ACE_INLINE__ */
+
#include "ace/Log_Msg.h"
#include "ace/OS_NS_stdio.h"
#include "ace/OS_NS_errno.h"
@@ -13,27 +17,36 @@
#include "ace/OS_NS_netdb.h"
#include "ace/OS_NS_unistd.h"
#include "ace/OS_NS_sys_socket.h"
+
ACE_RCSID (ace,
INET_Addr,
"$Id: INET_Addr.cpp 82434 2008-07-28 11:40:36Z johnnyw $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_INET_Addr)
+
// Transform the current address into string format.
+
int
ACE_INET_Addr::addr_to_string (ACE_TCHAR s[],
size_t size,
int ipaddr_format) const
{
ACE_TRACE ("ACE_INET_Addr::addr_to_string");
+
// XXX Can we (should we) include the scope id for IPv6 addresses?
char hoststr[MAXHOSTNAMELEN+1];
+
bool result = false;
if (ipaddr_format == 0)
result = (this->get_host_name (hoststr, MAXHOSTNAMELEN+1) == 0);
else
result = (this->get_host_addr (hoststr, MAXHOSTNAMELEN+1) != 0);
+
if (!result)
return -1;
+
size_t total_len =
ACE_OS::strlen (hoststr)
+ 5 // ACE_OS::strlen ("65535"), Assuming the max port number.
@@ -55,6 +68,7 @@ ACE_INET_Addr::addr_to_string (ACE_TCHAR s[],
# endif /* !ACE_WIN32 && ACE_USES_WCHAR */
}
#endif // ACE_HAS_IPV6
+
if (size < total_len)
return -1;
else
@@ -63,43 +77,54 @@ ACE_INET_Addr::addr_to_string (ACE_TCHAR s[],
this->get_port_number ());
return 0;
}
+
void
ACE_INET_Addr::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_INET_Addr::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
+
ACE_TCHAR s[ACE_MAX_FULLY_QUALIFIED_NAME_LEN + 16];
this->addr_to_string(s, ACE_MAX_FULLY_QUALIFIED_NAME_LEN + 16);
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s"), s));
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
// Compare two addresses for inequality.
+
bool
ACE_INET_Addr::operator != (const ACE_INET_Addr &sap) const
{
ACE_TRACE ("ACE_INET_Addr::operator !=");
return !((*this) == sap);
}
+
// Compare two addresses for equality.
+
bool
ACE_INET_Addr::operator == (const ACE_INET_Addr &sap) const
{
ACE_TRACE ("ACE_INET_Addr::operator ==");
+
if (this->get_type () != sap.get_type ()
|| this->get_size () != sap.get_size ())
return false;
+
return (ACE_OS::memcmp (&this->inet_addr_,
&sap.inet_addr_,
this->get_size ()) == 0);
}
+
bool
ACE_INET_Addr::is_ip_equal (const ACE_INET_Addr &sap) const
{
if (this->get_type () != sap.get_type ()
|| this->get_size () != sap.get_size ())
return false;
+
#if defined (ACE_HAS_IPV6)
if (this->get_type () == PF_INET6)
{
@@ -117,6 +142,7 @@ ACE_INET_Addr::is_ip_equal (const ACE_INET_Addr &sap) const
return this->get_ip_address () == sap.get_ip_address();
}
+
u_long
ACE_INET_Addr::hash (void) const
{
@@ -130,16 +156,19 @@ ACE_INET_Addr::hash (void) const
#endif /* ACE_HAS_IPV6 */
return this->get_ip_address () + this->get_port_number ();
}
+
ACE_INET_Addr::ACE_INET_Addr (void)
: ACE_Addr (determine_type (), sizeof (inet_addr_))
{
// ACE_TRACE ("ACE_INET_Addr::ACE_INET_Addr");
this->reset ();
}
+
int
ACE_INET_Addr::set (const ACE_INET_Addr &sa)
{
ACE_TRACE ("ACE_INET_Addr::set");
+
if (sa.get_type () == AF_ANY)
// Ugh, this is really a base class, so don't copy it.
ACE_OS::memset (&this->inet_addr_, 0, sizeof (this->inet_addr_));
@@ -149,12 +178,16 @@ ACE_INET_Addr::set (const ACE_INET_Addr &sa)
ACE_OS::memcpy (&this->inet_addr_,
&sa.inet_addr_,
sa.get_size ());
+
this->set_type (sa.get_type());
this->set_size (sa.get_size());
}
+
return 0;
}
+
// Transform the string into the current addressing format.
+
int
ACE_INET_Addr::string_to_addr (const char s[], int address_family)
{
@@ -162,6 +195,7 @@ ACE_INET_Addr::string_to_addr (const char s[], int address_family)
int result;
char *ip_buf = 0;
char *ip_addr = 0;
+
// Need to make a duplicate since we'll be overwriting the string.
ACE_ALLOCATOR_RETURN (ip_buf,
ACE_OS::strdup (s),
@@ -188,10 +222,12 @@ ACE_INET_Addr::string_to_addr (const char s[], int address_family)
}
}
#endif /* ACE_HAS_IPV6 */
+
if (port_p == 0) // Assume it's a port number.
{
char *endp = 0;
long const port = ACE_OS::strtol (ip_addr, &endp, 10);
+
if (*endp == '\0') // strtol scanned the entire string - all digits
{
if (port < 0 || port > ACE_MAX_DEFAULT_PORT)
@@ -205,8 +241,10 @@ ACE_INET_Addr::string_to_addr (const char s[], int address_family)
else
{
*port_p = '\0'; ++port_p; // skip over ':'
+
char *endp = 0;
long port = ACE_OS::strtol (port_p, &endp, 10);
+
if (*endp == '\0') // strtol scanned the entire string - all digits
{
if (port < 0 || port > ACE_MAX_DEFAULT_PORT)
@@ -217,15 +255,18 @@ ACE_INET_Addr::string_to_addr (const char s[], int address_family)
else
result = this->set (port_p, ip_addr);
}
+
ACE_OS::free (ACE_MALLOC_T (ip_buf));
return result;
}
+
int
ACE_INET_Addr::set (const char address[], int address_family)
{
ACE_TRACE ("ACE_INET_Addr::set");
return this->string_to_addr (address, address_family);
}
+
ACE_INET_Addr::ACE_INET_Addr (const char address[], int address_family)
: ACE_Addr (determine_type (), sizeof (inet_addr_))
{
@@ -233,6 +274,7 @@ ACE_INET_Addr::ACE_INET_Addr (const char address[], int address_family)
this->reset ();
this->set (address, address_family);
}
+
#if defined (ACE_HAS_WCHAR)
ACE_INET_Addr::ACE_INET_Addr (const wchar_t address[], int address_family)
: ACE_Addr (determine_type (), sizeof (inet_addr_))
@@ -241,8 +283,11 @@ ACE_INET_Addr::ACE_INET_Addr (const wchar_t address[], int address_family)
this->reset ();
this->set (address, address_family);
}
+
#endif /* ACE_HAS_WCHAR */
+
// Copy constructor.
+
ACE_INET_Addr::ACE_INET_Addr (const ACE_INET_Addr &sa)
: ACE_Addr (sa.get_type (), sa.get_size())
{
@@ -250,8 +295,10 @@ ACE_INET_Addr::ACE_INET_Addr (const ACE_INET_Addr &sa)
this->reset ();
this->set (sa);
}
+
// Initializes a ACE_INET_Addr from a PORT_NUMBER and a 32 bit Internet
// address.
+
int
ACE_INET_Addr::set (u_short port_number,
ACE_UINT32 inet_address,
@@ -263,11 +310,14 @@ ACE_INET_Addr::set (u_short port_number,
sizeof inet_address,
encode, map);
this->set_port_number (port_number, encode);
+
return 0;
}
+
// Initializes a ACE_INET_Addr from a PORT_NUMBER and the remote
// HOST_NAME.
+
int
ACE_INET_Addr::set (u_short port_number,
const char host_name[],
@@ -275,15 +325,18 @@ ACE_INET_Addr::set (u_short port_number,
int address_family)
{
ACE_TRACE ("ACE_INET_Addr::set");
+
// Yow, someone gave us a NULL host_name!
if (host_name == 0)
{
errno = EINVAL;
return -1;
}
+
ACE_OS::memset ((void *) &this->inet_addr_,
0,
sizeof this->inet_addr_);
+
#if defined (ACE_HAS_IPV6)
struct addrinfo hints;
struct addrinfo *res = 0;
@@ -327,6 +380,7 @@ ACE_INET_Addr::set (u_short port_number,
::freeaddrinfo (res);
return 0;
#else /* ACE_HAS_IPV6 */
+
// IPv6 not supported... insure the family is set to IPv4
address_family = AF_INET;
this->set_type (address_family);
@@ -348,11 +402,13 @@ ACE_INET_Addr::set (u_short port_number,
hostent hentry;
ACE_HOSTENT_DATA buf;
int h_error = 0; // Not the same as errno!
+
hostent *hp = ACE_OS::gethostbyname_r (host_name, &hentry,
buf, &h_error);
if (hp == 0)
errno = h_error;
# endif /* ACE_VXWORKS */
+
if (hp == 0)
{
return -1;
@@ -369,26 +425,33 @@ ACE_INET_Addr::set (u_short port_number,
}
#endif /* ACE_HAS_IPV6 */
}
+
// Helper function to get a port number from a port name.
+
static int get_port_number_from_name (const char port_name[],
const char protocol[])
{
// Maybe port_name is directly a port number?
char *endp = 0;
long port_number = ACE_OS::strtol (port_name, &endp, 10);
+
if (*endp == '\0')
{
// port_name was really a number, and nothing else.
+
// Check for overflow.
if (port_number < 0 || port_number > ACE_MAX_DEFAULT_PORT)
return -1;
+
// Return the port number. NOTE: this number must
// be returned in network byte order!
u_short n = static_cast<u_short> (port_number);
n = ACE_HTONS (n);
return n;
}
+
// We try to resolve port number from its name.
+
#if defined (ACE_LACKS_GETSERVBYNAME)
port_number = 0;
ACE_UNUSED_ARG (port_name);
@@ -404,47 +467,59 @@ static int get_port_number_from_name (const char port_name[],
if (sp != 0)
port_number = sp->s_port;
#endif /* ACE_LACKS_GETSERVBYNAME */
+
return port_number;
}
+
// Initializes a ACE_INET_Addr from a <port_name> and the remote
// <host_name>.
+
int
ACE_INET_Addr::set (const char port_name[],
const char host_name[],
const char protocol[])
{
ACE_TRACE ("ACE_INET_Addr::set");
+
int const port_number = get_port_number_from_name (port_name, protocol);
if (port_number == -1)
{
ACE_NOTSUP_RETURN (-1);
}
+
int address_family = PF_UNSPEC;
# if defined (ACE_HAS_IPV6)
if (ACE_OS::strcmp (ACE_TEXT_CHAR_TO_TCHAR(protocol), ACE_TEXT ("tcp6")) == 0)
address_family = AF_INET6;
# endif /* ACE_HAS_IPV6 */
+
return this->set (static_cast<u_short> (port_number),
host_name, 0, address_family);
}
+
// Initializes a ACE_INET_Addr from a <port_name> and a 32 bit
// Internet address.
+
int
ACE_INET_Addr::set (const char port_name[],
ACE_UINT32 inet_address,
const char protocol[])
{
ACE_TRACE ("ACE_INET_Addr::set");
+
int const port_number = get_port_number_from_name (port_name, protocol);
if (port_number == -1)
{
ACE_NOTSUP_RETURN (-1);
}
+
return this->set (static_cast<u_short> (port_number),
inet_address, 0);
}
+
// Creates a ACE_INET_Addr from a PORT_NUMBER and the remote
// HOST_NAME.
+
ACE_INET_Addr::ACE_INET_Addr (u_short port_number,
const char host_name[],
int address_family)
@@ -461,6 +536,7 @@ ACE_INET_Addr::ACE_INET_Addr (u_short port_number,
ACE_TEXT_CHAR_TO_TCHAR ((host_name == 0) ?
"<unknown>" : host_name)));
}
+
#if defined (ACE_HAS_WCHAR)
ACE_INET_Addr::ACE_INET_Addr (u_short port_number,
const wchar_t host_name[],
@@ -480,11 +556,14 @@ ACE_INET_Addr::ACE_INET_Addr (u_short port_number,
host_name)));
}
#endif /* ACE_HAS_WCHAR */
+
// Creates a ACE_INET_Addr from a sockaddr_in structure.
+
int
ACE_INET_Addr::set (const sockaddr_in *addr, int len)
{
ACE_TRACE ("ACE_INET_Addr::set");
+
if (addr->sin_family == AF_INET)
{
int maxlen = static_cast<int> (sizeof (this->inet_addr_.in4_));
@@ -505,27 +584,33 @@ ACE_INET_Addr::set (const sockaddr_in *addr, int len)
return 0;
}
#endif /* ACE_HAS_IPV6 */
+
errno = EAFNOSUPPORT;
return -1;
}
+
// Return the address.
+
void *
ACE_INET_Addr::get_addr (void) const
{
ACE_TRACE ("ACE_INET_Addr::get_addr");
return (void*)&this->inet_addr_;
}
+
void
ACE_INET_Addr::set_addr (void *addr, int len)
{
this->set_addr (addr, len, 0);
}
+
// Set a pointer to the address.
void
ACE_INET_Addr::set_addr (void *addr, int /* len */, int map)
{
ACE_TRACE ("ACE_INET_Addr::set_addr");
struct sockaddr_in *getfamily = static_cast<struct sockaddr_in *> (addr);
+
if (getfamily->sin_family == AF_INET)
{
#if defined (ACE_HAS_IPV6)
@@ -551,7 +636,9 @@ ACE_INET_Addr::set_addr (void *addr, int /* len */, int map)
}
#endif // ACE_HAS_IPV6
}
+
// Creates a ACE_INET_Addr from a sockaddr_in structure.
+
ACE_INET_Addr::ACE_INET_Addr (const sockaddr_in *addr, int len)
: ACE_Addr (determine_type (), sizeof (inet_addr_))
{
@@ -559,7 +646,9 @@ ACE_INET_Addr::ACE_INET_Addr (const sockaddr_in *addr, int len)
this->reset ();
this->set (addr, len);
}
+
// Creates a ACE_INET_Addr from a PORT_NUMBER and an Internet address.
+
ACE_INET_Addr::ACE_INET_Addr (u_short port_number,
ACE_UINT32 inet_address)
: ACE_Addr (determine_type (), sizeof (inet_addr_))
@@ -571,8 +660,10 @@ ACE_INET_Addr::ACE_INET_Addr (u_short port_number,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_INET_Addr::ACE_INET_Addr")));
}
+
// Creates a ACE_INET_Addr from a PORT_NAME and the remote
// HOST_NAME.
+
ACE_INET_Addr::ACE_INET_Addr (const char port_name[],
const char host_name[],
const char protocol[])
@@ -586,6 +677,7 @@ ACE_INET_Addr::ACE_INET_Addr (const char port_name[],
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("ACE_INET_Addr::ACE_INET_Addr")));
}
+
#if defined (ACE_HAS_WCHAR)
ACE_INET_Addr::ACE_INET_Addr (const wchar_t port_name[],
const wchar_t host_name[],
@@ -601,7 +693,9 @@ ACE_INET_Addr::ACE_INET_Addr (const wchar_t port_name[],
ACE_TEXT ("ACE_INET_Addr::ACE_INET_Addr")));
}
#endif /* ACE_HAS_WCHAR */
+
// Creates a ACE_INET_Addr from a PORT_NAME and an Internet address.
+
ACE_INET_Addr::ACE_INET_Addr (const char port_name[],
ACE_UINT32 inet_address,
const char protocol[])
@@ -621,6 +715,7 @@ ACE_INET_Addr::ACE_INET_Addr (const char port_name[],
ACE_UNUSED_ARG (protocol);
#endif
}
+
#if defined (ACE_HAS_WCHAR)
ACE_INET_Addr::ACE_INET_Addr (const wchar_t port_name[],
ACE_UINT32 inet_address,
@@ -642,14 +737,17 @@ ACE_INET_Addr::ACE_INET_Addr (const wchar_t port_name[],
#endif
}
#endif /* ACE_HAS_WCHAR */
+
ACE_INET_Addr::~ACE_INET_Addr (void)
{
}
+
int
ACE_INET_Addr::get_host_name (char hostname[],
size_t len) const
{
ACE_TRACE ("ACE_INET_Addr::get_host_name");
+
int result;
if (len > 1)
{
@@ -673,44 +771,57 @@ ACE_INET_Addr::get_host_name (char hostname[],
hostname[0] = '\0';
result = -1;
}
+
return result;
}
+
#if defined (ACE_HAS_WCHAR)
int
ACE_INET_Addr::get_host_name (wchar_t hostname[],
size_t len) const
{
ACE_TRACE ("ACE_INET_Addr::get_host_name");
+
char char_hostname [MAXHOSTNAMELEN + 1];
+
// We have a build in limitation of MAXHOSTNAMELEN
if (len > MAXHOSTNAMELEN + 1)
len = MAXHOSTNAMELEN + 1;
+
// Call the char version
int result = this->get_host_name (char_hostname, len);
+
// And copy it over, if successful
if (result == 0)
ACE_OS::strcpy (hostname,
ACE_Ascii_To_Wide (char_hostname).wchar_rep ());
+
return result;
}
#endif /* ACE_HAS_WCHAR */
+
// Return the character representation of the hostname.
+
const char *
ACE_INET_Addr::get_host_name (void) const
{
ACE_TRACE ("ACE_INET_Addr::get_host_name");
+
static char name[MAXHOSTNAMELEN + 1];
if (this->get_host_name (name, MAXHOSTNAMELEN + 1) == -1)
ACE_OS::strcpy (name, "<unknown>");
return name;
}
+
void
ACE_INET_Addr::set_port_number (u_short port_number,
int encode)
{
ACE_TRACE ("ACE_INET_Addr::set_port_number");
+
if (encode)
port_number = ACE_HTONS (port_number);
+
#if defined (ACE_HAS_IPV6)
if (this->get_type () == AF_INET6)
this->inet_addr_.in6_.sin6_port = port_number;
@@ -718,11 +829,13 @@ ACE_INET_Addr::set_port_number (u_short port_number,
#endif /* ACE_HAS_IPV6 */
this->inet_addr_.in4_.sin_port = port_number;
}
+
// returns -2 when the hostname is truncated
int
ACE_INET_Addr::get_host_name_i (char hostname[], size_t len) const
{
ACE_TRACE ("ACE_INET_Addr::get_host_name_i");
+
#if defined (ACE_HAS_IPV6)
if ((this->get_type () == PF_INET6 &&
0 == ACE_OS::memcmp (&this->inet_addr_.in6_.sin6_addr,
@@ -758,6 +871,7 @@ ACE_INET_Addr::get_host_name_i (char hostname[], size_t len) const
void* addr = this->ip_addr_pointer ();
int size = this->ip_addr_size ();
int type = this->get_type ();
+
# if defined (ACE_HAS_IPV6) && defined (ACE_HAS_BROKEN_GETHOSTBYADDR_V4MAPPED)
// Most OS can not handle IPv6-mapped-IPv4 addresses (even
// though they are meant to) so map them back to IPv4 addresses
@@ -772,6 +886,7 @@ ACE_INET_Addr::get_host_name_i (char hostname[], size_t len) const
type = PF_INET;
}
# endif /* ACE_HAS_IPV6 */
+
# if defined (DIGITAL_UNIX) && defined (__GNUC__)
hostent * const hp =
ACE_OS::gethostbyaddr (static_cast <char *> (addr), size, type);
@@ -787,8 +902,10 @@ ACE_INET_Addr::get_host_name_i (char hostname[], size_t len) const
buf,
&h_error);
# endif /* DIGITAL_UNIX */
+
if (hp == 0 || hp->h_name == 0)
return -1;
+
if (ACE_OS::strlen (hp->h_name) >= len)
{
// We know the length, so use memcpy
@@ -802,11 +919,13 @@ ACE_INET_Addr::get_host_name_i (char hostname[], size_t len) const
// Using errno looks ok, but ENOSPC could be set on
// other places.
}
+
ACE_OS::strcpy (hostname, hp->h_name);
return 0;
#endif /* ACE_VXWORKS */
}
}
+
int ACE_INET_Addr::set_address (const char *ip_addr,
int len,
int encode /* = 1 */,
@@ -821,12 +940,14 @@ int ACE_INET_Addr::set_address (const char *ip_addr,
errno = EAFNOSUPPORT;
return -1;
}
+
if (len == 4)
{
ACE_UINT32 ip4 = *reinterpret_cast<const ACE_UINT32 *> (ip_addr);
if (encode)
ip4 = ACE_HTONL (ip4);
+
if (this->get_type () == AF_INET && map == 0) {
this->base_set (AF_INET, sizeof (this->inet_addr_.in4_));
#ifdef ACE_HAS_SOCKADDR_IN_SIN_LEN
@@ -869,6 +990,7 @@ int ACE_INET_Addr::set_address (const char *ip_addr,
sizeof (ip6));
return 0;
}
+
// Build up a 128 bit address. An IPv4-mapped IPv6 address
// is defined as 0:0:0:0:0:ffff:IPv4_address. This is defined
// in RFC 1884 */
@@ -896,13 +1018,17 @@ int ACE_INET_Addr::set_address (const char *ip_addr,
this->inet_addr_.in6_.sin6_len = sizeof (this->inet_addr_.in6_);
#endif
ACE_OS::memcpy (&this->inet_addr_.in6_.sin6_addr, ip_addr, len);
+
return 0;
} /* end len == 16 */
#endif /* ACE_HAS_IPV6 */
+
// Here with an unrecognized length.
errno = EAFNOSUPPORT;
return -1;
+
}
+
#if (defined (__linux__) || defined (ACE_WIN32)) && defined (ACE_HAS_IPV6)
int
ACE_INET_Addr::set_interface (const char *intf_name)
@@ -926,8 +1052,10 @@ ACE_INET_Addr::set_interface (const char *intf_name)
}
else
return 0;
+
}
#endif /* __linux && ACE_HAS_IPV6 */
+
const char *
ACE_INET_Addr::get_host_addr (char *dst, int size) const
{
@@ -939,6 +1067,7 @@ ACE_INET_Addr::get_host_addr (char *dst, int size) const
// representation which is not distinguishable from the IPv4 form which makes
// it impossible to resolve back to an IPv6 INET_Addr without prior knowledge
// that this was such an address to begin with.
+
//if (IN6_IS_ADDR_V4MAPPED (&this->inet_addr_.in6_.sin6_addr))
//{
// ACE_UINT32 addr;
@@ -946,6 +1075,7 @@ ACE_INET_Addr::get_host_addr (char *dst, int size) const
// addr = ACE_HTONL (addr);
// return ACE_OS::inet_ntop (AF_INET, &addr, dst, size);
//}
+
# if defined (ACE_WIN32)
if (0 == ::getnameinfo (reinterpret_cast<const sockaddr*> (&this->inet_addr_.in6_),
this->get_size (),
@@ -978,11 +1108,13 @@ ACE_INET_Addr::get_host_addr (char *dst, int size) const
# endif /* ACE_WIN32 */
}
#endif /* ACE_HAS_IPV6 */
+
return ACE_OS::inet_ntop (AF_INET,
&this->inet_addr_.in4_.sin_addr,
dst,
size);
}
+
// Return the dotted Internet address.
const char *
ACE_INET_Addr::get_host_addr (void) const
@@ -996,6 +1128,7 @@ ACE_INET_Addr::get_host_addr (void) const
return this->get_host_addr (buf, INET_ADDRSTRLEN);
#endif /* !ACE_HAS_IPV6 */
}
+
// Return the 4-byte IP address, converting it into host byte order.
ACE_UINT32
ACE_INET_Addr::get_ip_address (void) const
@@ -1014,6 +1147,7 @@ ACE_INET_Addr::get_ip_address (void) const
ACE_OS::memcpy (&addr, thisaddrptr, sizeof (addr));
return ACE_NTOHL (addr);
}
+
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("ACE_INET_Addr::get_ip_address: address is a IPv6 address not IPv4\n")));
errno = EAFNOSUPPORT;
@@ -1022,5 +1156,6 @@ ACE_INET_Addr::get_ip_address (void) const
#endif /* ACE_HAS_IPV6 */
return ACE_NTOHL (ACE_UINT32 (this->inet_addr_.in4_.sin_addr.s_addr));
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/INET_Addr.h b/dep/ACE_wrappers/ace/INET_Addr.h
index fc5f76dad54..aadd0de1022 100644
--- a/dep/ACE_wrappers/ace/INET_Addr.h
+++ b/dep/ACE_wrappers/ace/INET_Addr.h
@@ -1,4 +1,5 @@
/* -*- C++ -*- */
+
//=============================================================================
/**
* @file INET_Addr.h
@@ -8,15 +9,21 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_INET_ADDR_H
#define ACE_INET_ADDR_H
#include /**/ "ace/pre.h"
+
#include "ace/Sock_Connect.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Addr.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_INET_Addr
*
@@ -27,12 +34,16 @@ class ACE_Export ACE_INET_Addr : public ACE_Addr
{
public:
// = Initialization methods.
+
/// Default constructor.
ACE_INET_Addr (void);
+
/// Copy constructor.
ACE_INET_Addr (const ACE_INET_Addr &);
+
/// Creates an ACE_INET_Addr from a sockaddr_in structure.
ACE_INET_Addr (const sockaddr_in *addr, int len);
+
/// Creates an ACE_INET_Addr from a @a port_number and the remote
/// @a host_name. The port number is assumed to be in host byte order.
/// To set a port already in network byte order, please @see set().
@@ -40,6 +51,7 @@ public:
ACE_INET_Addr (u_short port_number,
const char host_name[],
int address_family = AF_UNSPEC);
+
/**
* Initializes an ACE_INET_Addr from the @a address, which can be
* "ip-number:port-number" (e.g., "tango.cs.wustl.edu:1234" or
@@ -49,6 +61,7 @@ public:
*/
explicit ACE_INET_Addr (const char address[],
int address_family = AF_UNSPEC);
+
/**
* Creates an ACE_INET_Addr from a @a port_number and an Internet
* <ip_addr>. This method assumes that @a port_number and <ip_addr>
@@ -57,11 +70,13 @@ public:
*/
explicit ACE_INET_Addr (u_short port_number,
ACE_UINT32 ip_addr = INADDR_ANY);
+
/// Uses <getservbyname> to create an ACE_INET_Addr from a
/// <port_name>, the remote @a host_name, and the @a protocol.
ACE_INET_Addr (const char port_name[],
const char host_name[],
const char protocol[] = "tcp");
+
/**
* Uses <getservbyname> to create an ACE_INET_Addr from a
* <port_name>, an Internet <ip_addr>, and the @a protocol. This
@@ -70,25 +85,34 @@ public:
ACE_INET_Addr (const char port_name[],
ACE_UINT32 ip_addr,
const char protocol[] = "tcp");
+
#if defined (ACE_HAS_WCHAR)
ACE_INET_Addr (u_short port_number,
const wchar_t host_name[],
int address_family = AF_UNSPEC);
+
explicit ACE_INET_Addr (const wchar_t address[],
int address_family = AF_UNSPEC);
+
ACE_INET_Addr (const wchar_t port_name[],
const wchar_t host_name[],
const wchar_t protocol[] = ACE_TEXT_WIDE ("tcp"));
+
ACE_INET_Addr (const wchar_t port_name[],
ACE_UINT32 ip_addr,
const wchar_t protocol[] = ACE_TEXT_WIDE ("tcp"));
#endif /* ACE_HAS_WCHAR */
+
/// Default dtor.
~ACE_INET_Addr (void);
+
// = Direct initialization methods.
+
// These methods are useful after the object has been constructed.
+
/// Initializes from another ACE_INET_Addr.
int set (const ACE_INET_Addr &);
+
/**
* Initializes an ACE_INET_Addr from a @a port_number and the
* remote @a host_name. If @a encode is non-zero then @a port_number is
@@ -102,6 +126,7 @@ public:
const char host_name[],
int encode = 1,
int address_family = AF_UNSPEC);
+
/**
* Initializes an ACE_INET_Addr from a @a port_number and an Internet
* @a ip_addr. If @a encode is non-zero then the port number and IP address
@@ -115,11 +140,13 @@ public:
ACE_UINT32 ip_addr = INADDR_ANY,
int encode = 1,
int map = 0);
+
/// Uses <getservbyname> to initialize an ACE_INET_Addr from a
/// <port_name>, the remote @a host_name, and the @a protocol.
int set (const char port_name[],
const char host_name[],
const char protocol[] = "tcp");
+
/**
* Uses <getservbyname> to initialize an ACE_INET_Addr from a
* <port_name>, an <ip_addr>, and the @a protocol. This assumes that
@@ -128,6 +155,7 @@ public:
int set (const char port_name[],
ACE_UINT32 ip_addr,
const char protocol[] = "tcp");
+
/**
* Initializes an ACE_INET_Addr from the @a addr, which can be
* "ip-number:port-number" (e.g., "tango.cs.wustl.edu:1234" or
@@ -136,29 +164,38 @@ public:
* INADDR_ANY.
*/
int set (const char addr[], int address_family = AF_UNSPEC);
+
/// Creates an ACE_INET_Addr from a sockaddr_in structure.
int set (const sockaddr_in *,
int len);
+
#if defined (ACE_HAS_WCHAR)
int set (u_short port_number,
const wchar_t host_name[],
int encode = 1,
int address_family = AF_UNSPEC);
+
int set (const wchar_t port_name[],
const wchar_t host_name[],
const wchar_t protocol[] = ACE_TEXT_WIDE ("tcp"));
+
int set (const wchar_t port_name[],
ACE_UINT32 ip_addr,
const wchar_t protocol[] = ACE_TEXT_WIDE ("tcp"));
+
int set (const wchar_t addr[], int address_family = AF_UNSPEC);
#endif /* ACE_HAS_WCHAR */
+
/// Return a pointer to the underlying network address.
virtual void *get_addr (void) const;
int get_addr_size(void) const;
+
/// Set a pointer to the address.
virtual void set_addr (void *, int len);
+
/// Set a pointer to the address.
virtual void set_addr (void *, int len, int map);
+
/**
* Transform the current ACE_INET_Addr address into string format.
* If <ipaddr_format> is non-0 this produces "ip-number:port-number"
@@ -170,6 +207,7 @@ public:
virtual int addr_to_string (ACE_TCHAR buffer[],
size_t size,
int ipaddr_format = 1) const;
+
/**
* Initializes an ACE_INET_Addr from the @a address, which can be
* "ip-addr:port-number" (e.g., "tango.cs.wustl.edu:1234"),
@@ -181,11 +219,13 @@ public:
*/
virtual int string_to_addr (const char address[],
int address_family = AF_UNSPEC);
+
#if defined (ACE_HAS_WCHAR)
/*
virtual int string_to_addr (const char address[]);
*/
#endif /* ACE_HAS_WCHAR */
+
/**
* Sets the port number without affecting the host name. If
* @a encode is enabled then @a port_number is converted into network
@@ -194,6 +234,7 @@ public:
*/
void set_port_number (u_short,
int encode = 1);
+
/**
* Sets the address without affecting the port number. If
* @a encode is enabled then <ip_addr> is converted into network
@@ -208,6 +249,7 @@ public:
int len,
int encode = 1,
int map = 0);
+
#if (defined (__linux__) || defined (ACE_WIN32)) && defined (ACE_HAS_IPV6)
/**
* Sets the interface that should be used for this address. This only has
@@ -215,8 +257,10 @@ public:
*/
int set_interface (const char *intf_name);
#endif /* (__linux__ || ACE_WIN32) && ACE_HAS_IPV6 */
+
/// Return the port number, converting it into host byte-order.
u_short get_port_number (void) const;
+
/**
* Return the character representation of the name of the host,
* storing it in the <hostname> (which is assumed to be
@@ -226,10 +270,12 @@ public:
*/
int get_host_name (char hostname[],
size_t hostnamelen) const;
+
#if defined (ACE_HAS_WCHAR)
int get_host_name (wchar_t hostname[],
size_t hostnamelen) const;
#endif /* ACE_HAS_WCHAR */
+
/**
* Return the character representation of the hostname. This
* version is non-reentrant since it returns a pointer to a static
@@ -239,12 +285,14 @@ public:
* above.
*/
const char *get_host_name (void) const;
+
/**
* Return the "dotted decimal" Internet address representation of
* the hostname storing it in the @a addr (which is assumed to be
* @a addr_size bytes long). This version is reentrant.
*/
const char *get_host_addr (char *addr, int addr_size) const;
+
/**
* Return the "dotted decimal" Internet address representation of
* the hostname. This version is non-reentrant since it returns a
@@ -254,23 +302,31 @@ public:
* get_host_addr() described above.
*/
const char *get_host_addr (void) const;
+
/// Return the 4-byte IP address, converting it into host byte
/// order.
ACE_UINT32 get_ip_address (void) const;
+
/// Return @c true if the IP address is INADDR_ANY or IN6ADDR_ANY.
bool is_any (void) const;
+
/// Return @c true if the IP address is IPv4/IPv6 loopback address.
bool is_loopback (void) const;
+
/// Return @c true if the IP address is IPv4/IPv6 multicast address.
bool is_multicast (void) const;
+
#if defined (ACE_HAS_IPV6)
/// Return @c true if the IP address is IPv6 linklocal address.
bool is_linklocal (void) const;
+
/// Return @c true if the IP address is IPv4-mapped IPv6 address.
bool is_ipv4_mapped_ipv6 (void) const;
+
/// Return @c true if the IP address is IPv4-compatible IPv6 address.
bool is_ipv4_compat_ipv6 (void) const;
#endif /* ACE_HAS_IPV6 */
+
/**
* Returns @c true if @c this is less than @a rhs. In this context,
* "less than" is defined in terms of IP address and TCP port
@@ -278,30 +334,40 @@ public:
* in STL maps.
*/
bool operator < (const ACE_INET_Addr &rhs) const;
+
/// Compare two addresses for equality. The addresses are considered
/// equal if they contain the same IP address and port number.
bool operator == (const ACE_INET_Addr &SAP) const;
+
/// Compare two addresses for inequality.
bool operator != (const ACE_INET_Addr &SAP) const;
+
/// A variation of the equality operator, this method only compares the
/// IP address and ignores the port number.
bool is_ip_equal (const ACE_INET_Addr &SAP) const;
+
/// Computes and returns hash value.
virtual u_long hash (void) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Insure that @a hostname is properly null-terminated.
int get_host_name_i (char hostname[], size_t hostnamelen) const;
+
// Methods to gain access to the actual address of
// the underlying internet address structure.
void *ip_addr_pointer (void) const;
int ip_addr_size (void) const;
int determine_type (void) const;
+
/// Initialize underlying inet_addr_ to default values
void reset (void);
+
/// Underlying representation.
/// This union uses the knowledge that the two structures share the
/// first member, sa_family (as all sockaddr structures do).
@@ -313,10 +379,13 @@ private:
#endif /* ACE_HAS_IPV6 */
} inet_addr_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/INET_Addr.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_INET_ADDR_H */
diff --git a/dep/ACE_wrappers/ace/INET_Addr.inl b/dep/ACE_wrappers/ace/INET_Addr.inl
index 39fcf956fde..4cd9d404b82 100644
--- a/dep/ACE_wrappers/ace/INET_Addr.inl
+++ b/dep/ACE_wrappers/ace/INET_Addr.inl
@@ -2,10 +2,13 @@
//
// $Id: INET_Addr.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_string.h"
#include "ace/Global_Macros.h"
#include "ace/OS_NS_arpa_inet.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE void
ACE_INET_Addr::reset (void)
{
@@ -27,6 +30,7 @@ ACE_INET_Addr::reset (void)
}
#endif /* ACE_HAS_IPV6 */
}
+
ACE_INLINE int
ACE_INET_Addr::determine_type (void) const
{
@@ -40,6 +44,7 @@ ACE_INET_Addr::determine_type (void) const
return AF_INET;
#endif /* ACE_HAS_IPV6 */
}
+
ACE_INLINE void *
ACE_INET_Addr::ip_addr_pointer (void) const
{
@@ -52,6 +57,7 @@ ACE_INET_Addr::ip_addr_pointer (void) const
return (void*)&this->inet_addr_.in4_.sin_addr;
#endif
}
+
ACE_INLINE int
ACE_INET_Addr::ip_addr_size (void) const
{
@@ -75,7 +81,9 @@ ACE_INET_Addr::ip_addr_size (void) const
# endif /* ! _UNICOS */
#endif /* ACE_HAS_IPV6 */
}
+
// Return the port number, converting it into host byte order...
+
ACE_INLINE u_short
ACE_INET_Addr::get_port_number (void) const
{
@@ -91,6 +99,7 @@ ACE_INET_Addr::get_port_number (void) const
return ntohs (this->inet_addr_.in4_.sin_port);
#endif /* ACE_HAS_IPV6 */
}
+
ACE_INLINE int
ACE_INET_Addr::get_addr_size (void) const
{
@@ -104,6 +113,7 @@ ACE_INET_Addr::get_addr_size (void) const
return sizeof this->inet_addr_.in4_;
#endif /* ACE_HAS_IPV6 */
}
+
ACE_INLINE bool
ACE_INET_Addr::operator < (const ACE_INET_Addr &rhs) const
{
@@ -112,11 +122,13 @@ ACE_INET_Addr::operator < (const ACE_INET_Addr &rhs) const
{
return this->get_type() < rhs.get_type();
}
+
if (this->get_type() == PF_INET6)
{
int memval = ACE_OS::memcmp (this->ip_addr_pointer(),
rhs.ip_addr_pointer(),
this->ip_addr_size());
+
return memval < 0
|| (memval == 0
&& (this->get_port_number() < rhs.get_port_number()
@@ -125,10 +137,12 @@ ACE_INET_Addr::operator < (const ACE_INET_Addr &rhs) const
rhs.inet_addr_.in6_.sin6_scope_id)));
}
#endif
+
return this->get_ip_address () < rhs.get_ip_address ()
|| (this->get_ip_address () == rhs.get_ip_address ()
&& this->get_port_number () < rhs.get_port_number ());
}
+
#if defined (ACE_HAS_WCHAR)
ACE_INLINE int
ACE_INET_Addr::set (u_short port_number,
@@ -141,6 +155,7 @@ ACE_INET_Addr::set (u_short port_number,
encode,
address_family);
}
+
ACE_INLINE int
ACE_INET_Addr::set (const wchar_t port_name[],
const wchar_t host_name[],
@@ -150,6 +165,7 @@ ACE_INET_Addr::set (const wchar_t port_name[],
ACE_Wide_To_Ascii (host_name).char_rep (),
ACE_Wide_To_Ascii (protocol).char_rep ());
}
+
ACE_INLINE int
ACE_INET_Addr::set (const wchar_t port_name[],
ACE_UINT32 ip_addr,
@@ -159,12 +175,15 @@ ACE_INET_Addr::set (const wchar_t port_name[],
ip_addr,
ACE_Wide_To_Ascii (protocol).char_rep ());
}
+
ACE_INLINE int
ACE_INET_Addr::set (const wchar_t addr[], int address_family)
{
return this->set (ACE_Wide_To_Ascii (addr).char_rep (), address_family);
}
+
#endif /* ACE_HAS_WCHAR */
+
// Return @c true if the IP address is INADDR_ANY or IN6ADDR_ANY.
ACE_INLINE bool
ACE_INET_Addr::is_any (void) const
@@ -173,8 +192,10 @@ ACE_INET_Addr::is_any (void) const
if (this->get_type () == AF_INET6)
return IN6_IS_ADDR_UNSPECIFIED (&this->inet_addr_.in6_.sin6_addr);
#endif /* ACE_HAS_IPV6 */
+
return (this->inet_addr_.in4_.sin_addr.s_addr == INADDR_ANY);
}
+
// Return @c true if the IP address is IPv4/IPv6 loopback address.
ACE_INLINE bool
ACE_INET_Addr::is_loopback (void) const
@@ -183,9 +204,11 @@ ACE_INET_Addr::is_loopback (void) const
if (this->get_type () == AF_INET6)
return IN6_IS_ADDR_LOOPBACK (&this->inet_addr_.in6_.sin6_addr);
#endif /* ACE_HAS_IPV6 */
+
// RFC 3330 defines loopback as any address with 127.x.x.x
return ((this->get_ip_address () & 0XFF000000) == (INADDR_LOOPBACK & 0XFF000000));
}
+
// Return @c true if the IP address is IPv4/IPv6 multicast address.
ACE_INLINE bool
ACE_INET_Addr::is_multicast (void) const
@@ -198,6 +221,7 @@ ACE_INET_Addr::is_multicast (void) const
this->inet_addr_.in4_.sin_addr.s_addr >= 0xE0000000 && // 224.0.0.0
this->inet_addr_.in4_.sin_addr.s_addr <= 0xEFFFFFFF; // 239.255.255.255
}
+
#if defined (ACE_HAS_IPV6)
// Return @c true if the IP address is IPv6 linklocal address.
ACE_INLINE bool
@@ -205,23 +229,29 @@ ACE_INET_Addr::is_linklocal (void) const
{
if (this->get_type () == AF_INET6)
return IN6_IS_ADDR_LINKLOCAL (&this->inet_addr_.in6_.sin6_addr);
+
return false;
}
+
// Return @c true if the IP address is IPv4 mapped IPv6 address.
ACE_INLINE bool
ACE_INET_Addr::is_ipv4_mapped_ipv6 (void) const
{
if (this->get_type () == AF_INET6)
return IN6_IS_ADDR_V4MAPPED (&this->inet_addr_.in6_.sin6_addr);
+
return false;
}
+
// Return @c true if the IP address is IPv4-compatible IPv6 address.
ACE_INLINE bool
ACE_INET_Addr::is_ipv4_compat_ipv6 (void) const
{
if (this->get_type () == AF_INET6)
return IN6_IS_ADDR_V4COMPAT (&this->inet_addr_.in6_.sin6_addr);
+
return false;
}
#endif /* ACE_HAS_IPV6 */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/IOStream.cpp b/dep/ACE_wrappers/ace/IOStream.cpp
index f047c62fe7b..0b6ac17ca6f 100644
--- a/dep/ACE_wrappers/ace/IOStream.cpp
+++ b/dep/ACE_wrappers/ace/IOStream.cpp
@@ -1,14 +1,22 @@
// $Id: IOStream.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#ifndef ACE_IOSTREAM_CPP
#define ACE_IOSTREAM_CPP
+
#include "ace/IOStream.h"
+
ACE_RCSID(ace, IOStream, "$Id: IOStream.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if !defined (ACE_LACKS_ACE_IOSTREAM)
+
# include "ace/OS_NS_errno.h"
# include "ace/OS_Memory.h"
+
///////////////////////////////////////////////////////////////////////////
+
/* Here's a simple example of how iostream's non-virtual operators can
get you in a mess:
+
class myiostream : public iostream
{
public:
@@ -17,16 +25,21 @@ ACE_RCSID(ace, IOStream, "$Id: IOStream.cpp 80826 2008-03-04 14:51:23Z wotte $")
...
}
};
+
...
+
int i;
String s;
myiostream foo (...);
+
foo >> s;
// OK
// invokes myiostream::operator>> (String&) returning myiostream&
+
foo >> i;
// OK
// invokes iostream::operator>> (int&) returning iostream&
+
foo >> i >> s;
// BAD
// invokes iostream::operator>> (int&) then iostream::operator>> (String&)
@@ -35,7 +48,9 @@ ACE_RCSID(ace, IOStream, "$Id: IOStream.cpp 80826 2008-03-04 14:51:23Z wotte $")
// a reference to iostream. The second >> has no idea of the ACE_IOStream and
// gets invoked on iostream. Probably NOT what you wanted!
+
// In order to make all of this work the way you want, you have to do this:
+
class myiostream : public iostream
{
public:
@@ -43,33 +58,42 @@ ACE_RCSID(ace, IOStream, "$Id: IOStream.cpp 80826 2008-03-04 14:51:23Z wotte $")
{
return ((myiostream&)iostream::operator>> (i));
}
+
myiostream& operator>> (String & s)
{
...
}
};
+
...
+
int i;
String s;
myiostream foo (...);
+
foo >> s;
// OK
// invokes myiostream::operator>> (String&) returning myiostream&
+
foo >> i;
// OK
// invokes myiostream::operator>> (int&) returning myiostream&
+
foo >> i >> s;
// OK
// Because you provided operator>> (int&) in class myiostream, that
// function will be invoked by the first >>. Since it returns
// a myiostream&, the second >> will be invoked as desired. */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_HANDLE
ACE_Streambuf::get_handle (void)
{
return 0;
}
+
ACE_Time_Value *
ACE_Streambuf::recv_timeout (ACE_Time_Value *tv)
{
@@ -81,17 +105,22 @@ ACE_Streambuf::recv_timeout (ACE_Time_Value *tv)
}
else
recv_timeout_ = 0;
+
return rval;
}
+
int
ACE_Streambuf::underflow (void)
{
// If input mode is not set, any attempt to read from the stream is
// a failure.
+
if (ACE_BIT_DISABLED (mode_, ios::in))
return EOF;
+
// If base () is empty then this is the first time any get/put
// operation has been attempted on the stream.
+
if (!this->base ())
{
// Set base () to use our private read buffer. The arguments are:
@@ -101,8 +130,10 @@ ACE_Streambuf::underflow (void)
//
// We have to say "no" to the third parameter because we want to
// explicitly handle deletion of the TWO buffers at destruction.
+
setb (this->eback_saved_,
this->eback_saved_ + streambuf_size_, 0);
+
// Remember that we are now in getMode. This will help us if
// we're called prior to a mode change as well as helping us
// when the mode does change.
@@ -111,6 +142,7 @@ ACE_Streambuf::underflow (void)
// This simply sets eback (), gptr () and egptr () described
// earlier.
setg (base (), base (), base ());
+
// Set the put buffer such that puts will be disabled. Any
// attempt to put data will now cause overflow to be invoked.
setp (0, 0);
@@ -132,6 +164,7 @@ ACE_Streambuf::underflow (void)
// need what we're sending before it can respond.
if (out_waiting () && syncout () == EOF)
return EOF;
+
if( ! pbase() )
{
delete [] pbase_saved_;
@@ -145,20 +178,26 @@ ACE_Streambuf::underflow (void)
this->pptr_saved_ = pptr ();
this->epptr_saved_ = epptr ();
}
+
// Disable put mode as described in the constructor.
setp (0, 0);
+
// Like the case where base () is false, we now point base
// () to use our private get buffer.
setb (this->eback_saved_,
this->eback_saved_ + streambuf_size_,
0);
+
// And restore the previous state of the get pointers.
+
setg (this->eback_saved_, this->gptr_saved_,
this->egptr_saved_);
+
// Finally, set our mode so that we don't get back into this
// if () and so that overflow can operate correctly.
cur_mode_ = get_mode_;
}
+
// There could be data in the input buffer if we switched to put
// mode before reading everything. In that case, we take this
// opportunity to feed it back to the iostream.
@@ -168,11 +207,15 @@ ACE_Streambuf::underflow (void)
// char when we're not returning EOF.
return (u_char) *gptr ();
}
+
// We really shouldn't be here unless there is a lack of data in the
// read buffer. So... go get some more data from the peer.
+
int result = fillbuf ();
+
// Fillbuf will give us EOF if there was an error with the peer. In
// that case, we can do no more input.
+
if (EOF == result)
{
// Disable ourselves and return failure to the iostream. That
@@ -180,28 +223,35 @@ ACE_Streambuf::underflow (void)
setg (0, 0, 0);
return EOF;
}
+
// Return the next available character in the input buffer. Again,
// we protect against sign extension.
+
return (u_char) *gptr ();
}
+
// Much of this is similar to underflow. I'll just hit the highlights
// rather than repeating a lot of what you've already seen.
+
int
ACE_Streambuf::overflow (int c)
{
// Check to see if output is allowed at all.
if (! (mode_ & ios::out))
return EOF;
+
if (!base ())
{
// Set base () to use put's private buffer.
//
setb (this->pbase_saved_,
this->pbase_saved_ + streambuf_size_, 0);
+
// Set the mode for optimization.
this->cur_mode_ = this->put_mode_;
// Set the put area using the new base () values.
setp (base (), ebuf ());
+
// Disable the get area.
setg (0, 0, 0);
}
@@ -230,21 +280,28 @@ ACE_Streambuf::overflow (int c)
this->egptr_saved_ = egptr ();
}
// <-- JCEJ 6/6/98
+
// then disable the get buffer
setg (0, 0, 0);
+
// Reconfigure base () and restore the put pointers.
setb (pbase_saved_, pbase_saved_ + streambuf_size_, 0);
setp (base (), ebuf ());
+
// Save the new mode.
this->cur_mode_ = this->put_mode_;
}
+
// If there is output to be flushed, do so now. We shouldn't
// get here unless this is the case...
+
if (out_waiting () && EOF == syncout ())
return EOF;
}
+
// If we're not putting EOF, then we have to deal with the character
// that is being put. Perhaps we should do something special with EOF???
+
if (c != EOF)
{
// We've already written any data that may have been in the
@@ -254,9 +311,12 @@ ACE_Streambuf::overflow (int c)
*pptr () = (char) c;
pbump (1);
}
+
return 0;
}
+
// syncin
+
int
ACE_Streambuf::syncin (void)
{
@@ -265,33 +325,42 @@ ACE_Streambuf::syncin (void)
// function so that it won't do anything evil to us.
return 0;
}
+
// syncout
+
int
ACE_Streambuf::syncout (void)
{
// Unlike syncin, syncout is a doable thing. All we have to do is
// write whatever is in the output buffer to the peer. flushbuf ()
// is how we do it.
+
if (flushbuf () == EOF)
return EOF;
else
return 0;
}
+
int
ACE_Streambuf::sync (void)
{
// sync () is fairly traditional in that it syncs both input and
// output. We could have omitted the call to syncin () but someday,
// we may want it to do something.
+
syncin ();
+
// Don't bother syncing the output unless there is data to be
// sent...
+
if (out_waiting ())
return syncout ();
else
return 0;
}
+
// flushbuf
+
int
ACE_Streambuf::flushbuf (void)
{
@@ -299,8 +368,10 @@ ACE_Streambuf::flushbuf (void)
// buffer. pbase () points to the beginning of the put buffer.
// Unless pptr () is greater than pbase () there is nothing to be
// sent to the peer.
+
if (pptr () <= pbase ())
return 0;
+
// 4/12/97 -- JCEJ
// Kludge!!!
// If the remote side shuts down the connection, an attempt to send
@@ -332,25 +403,32 @@ ACE_Streambuf::flushbuf (void)
// The correct way to handle this is for the application to trap
// (and ignore?) SIGPIPE. Thanks to Amos Shapira for reminding me
// of this.
+
// Starting at the beginning of the buffer, send as much data as
// there is waiting. send guarantees that all of the data will be
// sent or an error will be returned.
+
if (this->send (pbase (), pptr () - pbase ()) == -1)
return EOF;
+
// Now that we've sent everything in the output buffer, we reset the
// buffer pointers to appear empty.
setp (base (), ebuf ());
+
return 0;
}
+
int
ACE_Streambuf::get_one_byte (void)
{
this->timeout_ = 0;
+
// The recv function will return immediately if there is no data
// waiting. So, we use recv_n to wait for exactly one byte to come
// from the peer. Later, we can use recv to see if there is
// anything else in the buffer. (Ok, we could use flags to tell it
// to block but I like this better.)
+
if (this->recv_n (base (), 1, MSG_PEEK, this->recv_timeout_) != 1)
{
if (errno == ETIME)
@@ -360,32 +438,43 @@ ACE_Streambuf::get_one_byte (void)
else
return 1;
}
+
// This will be called when the read (get) buffer has been exhausted
// (ie -- gptr == egptr).
+
int
ACE_Streambuf::fillbuf (void)
{
// Invoke recv_n to get exactly one byte from the remote. This will
// block until something shows up.
+
if (get_one_byte () == EOF)
return EOF;
+
// Now, get whatever else may be in the buffer. This will return if
// there is nothing in the buffer.
+
int bc = this->recv (base (), blen (), this->recv_timeout_);
+
// recv will give us -1 if there was a problem. If there was
// nothing waiting to be read, it will give us 0. That isn't an
// error.
+
if (bc < 0)
{
if (errno == ETIME)
this->timeout_ = 1;
return EOF;
}
+
// Move the get pointer to reflect the number of bytes we just read.
+
setg (base (), base (), base () + bc);
+
// Return the byte-read-count including the one from <get_one_byte>.
return bc;
}
+
ACE_Streambuf::ACE_Streambuf (u_int streambuf_size, int io_mode)
: eback_saved_ (0), // to avoid Purify UMR
pbase_saved_ (0), // to avoid Purify UMR
@@ -398,32 +487,40 @@ ACE_Streambuf::ACE_Streambuf (u_int streambuf_size, int io_mode)
(void)reset_get_buffer ();
(void)reset_put_buffer ();
}
+
u_int
ACE_Streambuf::streambuf_size (void)
{
return streambuf_size_;
}
+
// Return the number of bytes not yet gotten. eback + get_waiting =
// gptr.
+
u_int
ACE_Streambuf::get_waiting (void)
{
return this->gptr_saved_ - this->eback_saved_;
}
+
// Return the number of bytes in the get area (includes some already
// gotten); eback + get_avail = egptr.
+
u_int
ACE_Streambuf::get_avail (void)
{
return this->egptr_saved_ - this->eback_saved_;
}
+
// Return the number of bytes to be 'put' onto the stream media.
// pbase + put_avail = pptr.
+
u_int
ACE_Streambuf::put_avail (void)
{
return this->pptr_saved_ - this->pbase_saved_;
}
+
// Typical usage:
//
// u_int newGptr = otherStream->get_waiting ();
@@ -433,6 +530,7 @@ ACE_Streambuf::put_avail (void)
//
// 'myStream' now has the get buffer of 'otherStream' and can use it in any way.
// 'otherStream' now has a new, empty get buffer.
+
char *
ACE_Streambuf::reset_get_buffer (char *newBuffer,
u_int _streambuf_size,
@@ -440,6 +538,7 @@ ACE_Streambuf::reset_get_buffer (char *newBuffer,
u_int _egptr)
{
char * rval = this->eback_saved_;
+
// The get area is where the iostream will get data from. This is
// our read buffer. There are three pointers which describe the
// read buffer:
@@ -466,25 +565,32 @@ ACE_Streambuf::reset_get_buffer (char *newBuffer,
ACE_NEW_RETURN (this->eback_saved_,
char[streambuf_size_],
0);
+
this->gptr_saved_ = this->eback_saved_ + _gptr;
this->egptr_saved_ = this->eback_saved_ + _egptr;
+
// Disable the get area initially. This will cause underflow to be
// invoked on the first get operation.
setg (0, 0, 0);
+
reset_base ();
+
return rval;
}
+
// Typical usage:
//
// u_int newPptr = otherStream->put_avail ();
// char * newBuf = otherStream->reset_put_buffer ();
// char * oldputbuf = otherStream->reset_put_buffer (newBuf, otherStream->streambuf_size (), newPptr);
+
char *
ACE_Streambuf::reset_put_buffer (char *newBuffer,
u_int _streambuf_size,
u_int _pptr)
{
char *rval = this->pbase_saved_;
+
// The put area is where the iostream will put data that needs to be
// sent to the peer. This becomes our write buffer. The three
// pointers which maintain this area are:
@@ -508,20 +614,26 @@ ACE_Streambuf::reset_put_buffer (char *newBuffer,
ACE_NEW_RETURN (this->pbase_saved_,
char[streambuf_size_],
0);
+
this->pptr_saved_ = this->pbase_saved_ + _pptr;
this->epptr_saved_ = this->pbase_saved_ + streambuf_size_;
+
// Disable the put area. Overflow will be called by the first call
// to any put operator.
setp (0, 0);
+
reset_base ();
+
return rval;
}
+
void
ACE_Streambuf::reset_base (void)
{
// Until we experience the first get or put operation, we do not
// know what our current IO mode is.
this->cur_mode_ = 0;
+
// The common area used for reading and writting is called "base".
// We initialize it this way so that the first get/put operation
// will have to "allocate" base. This allocation will set base to
@@ -529,21 +641,26 @@ ACE_Streambuf::reset_base (void)
// value.
setb (0, 0);
}
+
// If the default allocation strategey were used the common buffer
// would be deleted when the object destructs. Since we are providing
// separate read/write buffers, it is up to us to manage their memory.
+
ACE_Streambuf::~ACE_Streambuf (void)
{
delete [] this->eback_saved_;
delete [] this->pbase_saved_;
}
+
u_char ACE_Streambuf::timeout (void)
{
u_char rval = this->timeout_;
this->timeout_ = 0;
return rval;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* !ACE_LACKS_ACE_IOSTREAM */
#endif /* ACE_IOSTREAM_CPP */
diff --git a/dep/ACE_wrappers/ace/IOStream.h b/dep/ACE_wrappers/ace/IOStream.h
index 860df2c9dad..d7995a8e4f6 100644
--- a/dep/ACE_wrappers/ace/IOStream.h
+++ b/dep/ACE_wrappers/ace/IOStream.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file IOStream.h
@@ -9,16 +10,21 @@
* @author Jim Crossley <jim@lads.com>
*/
//=============================================================================
+
#ifndef ACE_IOSTREAM_H
#define ACE_IOSTREAM_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
// Needed on Windows for streambuf
// FUZZ: disable check_for_streams_include
#include "ace/streams.h"
+
// This is a temporary restriction - ACE_IOStream is only enabled if the
// compiler does not supply the standard C++ library (and standard iostreams)
// or, if it does, the platform is explicitly set to use old iostreams
@@ -29,7 +35,9 @@
# define ACE_LACKS_ACE_IOSTREAM
# endif /* !ACE_USES_OLD_IOSTREAMS && !ACE_LACKS_ACE_IOSTREAM */
#endif /* ACE_HAS_STANDARD_CPP_LIBRARY */
+
#if !defined (ACE_LACKS_ACE_IOSTREAM)
+
# if defined (ACE_HAS_STRING_CLASS)
# if defined (ACE_WIN32) && defined (_MSC_VER)
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -43,6 +51,7 @@ typedef String ACE_IOStream_String;
ACE_END_VERSIONED_NAMESPACE_DECL
# else
# include /**/ <string>
+
# if defined(ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB)
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
typedef std::string ACE_IOStream_String;
@@ -54,6 +63,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# endif /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */
# endif /* ! ACE_HAS_STDCPP_STL_INCLUDES */
# endif /* ACE_WIN32 && defined (_MSC_VER) */
+
# if defined (__DECCXX_VER)
# if __DECCXX_VER < 50700000
# include /**/ <stl_macros>
@@ -61,7 +71,9 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# include /**/ <stdcomp>
# endif /* __DECCXX_VER < 50700000 */
# endif /* __DECCXX_VER */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Export ACE_Quoted_String : public ACE_IOStream_String
{
public:
@@ -85,11 +97,16 @@ public:
inline int length (void) { return this->GetLength (); }
# endif /* ACE_WIN32 && defined (_MSC_VER) */
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# endif /* ACE_HAS_STRING_CLASS */
+
# include "ace/Time_Value.h"
# include "ace/os_include/sys/os_types.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Streambuf
*
@@ -145,6 +162,7 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
class ACE_Export ACE_Streambuf : public streambuf
{
public:
+
/**
* If the default allocation strategey were used the common buffer
* would be deleted when the object destructs. Since we are
@@ -152,8 +170,10 @@ public:
* their memory.
*/
virtual ~ACE_Streambuf (void);
+
/// Get the current Time_Value pointer and provide a new one.
ACE_Time_Value *recv_timeout (ACE_Time_Value *tv = 0);
+
/**
* Use this to allocate a new/different buffer for put operations.
* If you do not provide a buffer pointer, one will be allocated.
@@ -166,9 +186,11 @@ public:
char *reset_put_buffer (char *newBuffer = 0,
u_int _streambuf_size = 0,
u_int _pptr = 0 );
+
/// Return the number of bytes to be 'put' onto the stream media.
/// pbase + put_avail = pptr
u_int put_avail (void);
+
/**
* Use this to allocate a new/different buffer for get operations.
* If you do not provide a buffer pointer, one will be allocated.
@@ -182,31 +204,41 @@ public:
u_int _streambuf_size = 0,
u_int _gptr = 0,
u_int _egptr = 0);
+
/// Return the number of bytes not yet gotten. eback + get_waiting =
/// gptr
u_int get_waiting (void);
+
/// Return the number of bytes in the get area (includes some already
/// gotten); eback + get_avail = egptr
u_int get_avail (void);
+
/// Query the streambuf for the size of its buffers.
u_int streambuf_size (void);
+
/// Did we take an error because of an IO operation timeout?
/// @note Invoking this resets the flag.
u_char timeout (void);
+
protected:
ACE_Streambuf (u_int streambuf_size,
int io_mode);
+
/// Sync both input and output. See syncin/syncout below for
/// descriptions.
virtual int sync (void);
+
// = Signatures for the underflow/overflow discussed above.
virtual int underflow (void);
+
/// The overflow function receives the character which caused the
/// overflow.
virtual int overflow (int c = EOF);
+
/// Resets the <base> pointer and streambuf mode. This is used
/// internally when get/put buffers are allocatd.
void reset_base (void);
+
protected:
// = Two pointer sets for manipulating the read/write areas.
char *eback_saved_;
@@ -215,23 +247,30 @@ protected:
char *pbase_saved_;
char *pptr_saved_;
char *epptr_saved_;
+
// = With cur_mode_ we keep track of our current IO mode.
+
// This helps us to optimize the underflow/overflow functions.
u_char cur_mode_;
const u_char get_mode_;
const u_char put_mode_;
+
/// mode tells us if we're working for an istream, ostream, or
/// iostream.
int mode_;
+
/// This defines the size of the input and output buffers. It can be
/// set by the object constructor.
const u_int streambuf_size_;
+
/// Did we take an error because of an IO operation timeout?
u_char timeout_;
+
/// We want to allow the user to provide Time_Value pointers to
/// prevent infinite blocking while waiting to receive data.
ACE_Time_Value recv_timeout_value_;
ACE_Time_Value *recv_timeout_;
+
/**
* syncin is called when the input needs to be synced with the
* source file. In a filebuf, this results in the <seek> system
@@ -242,18 +281,22 @@ protected:
* call.
*/
int syncin (void);
+
/// syncout is called when the output needs to be flushed. This is
/// easily done by calling the peer's send_n function.
int syncout (void);
+
/// flushbuf is the worker of syncout. It is a separate function
/// because it gets used sometimes in different context.
int flushbuf (void);
+
/**
* fillbuf is called in a couple of places. This is the worker of
* underflow. It will attempt to fill the read buffer from the
* peer.
*/
int fillbuf (void);
+
/**
* Used by fillbuf and others to get exactly one byte from the peer.
* recv_n is used to be sure we block until something is available.
@@ -261,6 +304,7 @@ protected:
* datagram-derived objects.
*/
virtual int get_one_byte (void);
+
/**
* Stream connections and "unconnected connections" (ie --
* datagrams) need to work just a little differently. We derive
@@ -280,7 +324,9 @@ protected:
ssize_t len,
int flags = 0,
ACE_Time_Value *tv = 0) = 0;
+
virtual ACE_HANDLE get_handle (void);
+
# if defined (ACE_HAS_STANDARD_CPP_LIBRARY) && (ACE_HAS_STANDARD_CPP_LIBRARY != 0) && !defined (ACE_USES_OLD_IOSTREAMS)
char *base (void) const
{
@@ -292,22 +338,28 @@ protected:
{
return cur_mode_ == 0 ? 0 : base () + streambuf_size_;
}
+
int blen (void) const
{
return streambuf_size_;
}
+
void setb (char* b, char* eb, int /* a */=0)
{
setbuf (b, (eb - b));
}
+
int out_waiting (void)
{
return pptr () - pbase ();
}
# endif /* ACE_HAS_STANDARD_CPP_LIBRARY */
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
///////////////////////////////////////////////////////////////////////////
+
// These typedefs are provided by G++ (on some systems?) without the
// trailing '_'. Since we can't count on 'em, I've defined them to
// what GNU wants here.
@@ -315,13 +367,16 @@ ACE_END_VERSIONED_NAMESPACE_DECL
typedef ios& (*__manip_)(ios&);
typedef istream& (*__imanip_)(istream&);
typedef ostream& (*__omanip_)(ostream&);
+
// Trying to do something like is shown below instead of using the
// __*manip typedefs causes Linux do segfault when "<<endl" is done.
//
// virtual MT& operator<<(ios& (*func)(ios&)) { (*func)(*this); return *this; }
+
// This macro defines the get operator for class MT into datatype DT.
// We will use it below to quickly override most (all?) iostream get
// operators. Notice how the <ipfx> and <isfx> functions are used.
+
#define GET_SIG(MT,DT) inline virtual MT& operator>> (DT v)
# if (defined (__SUNPRO_CC) && __SUNPRO_CC > 0x510)
#define GET_CODE { \
@@ -344,9 +399,11 @@ typedef ostream& (*__omanip_)(ostream&);
# endif
#define GET_PROT(MT,DT,CODE) GET_SIG(MT,DT) CODE
#define GET_FUNC(MT,DT) GET_PROT(MT,DT,GET_CODE)
+
// This macro defines the put operator for class MT into datatype DT.
// We will use it below to quickly override most (all?) iostream put
// operators. Notice how the <opfx> and <osfx> functions are used.
+
#define PUT_SIG(MT,DT) inline virtual MT& operator<< (DT v)
# if (defined (__SUNPRO_CC) && __SUNPRO_CC > 0x510)
#define PUT_CODE { \
@@ -370,8 +427,10 @@ typedef ostream& (*__omanip_)(ostream&);
#define PUT_PROT(MT,DT,CODE) PUT_SIG(MT,DT) CODE
#define PUT_FUNC(MT,DT) PUT_PROT(MT,DT,PUT_CODE)
+
// These are necessary in case somebody wants to derive from us and
// override one of these with a custom approach.
+
# if defined (ACE_LACKS_CHAR_RIGHT_SHIFTS)
#define GET_FUNC_SET0(MT,CODE,CODE2) \
GET_PROT(MT,short &,CODE) \
@@ -401,6 +460,7 @@ typedef ostream& (*__omanip_)(ostream&);
inline virtual MT& operator>>(__omanip_ func) CODE2 \
inline virtual MT& operator>>(__manip_ func) CODE2
# endif
+
#define PUT_FUNC_SET0(MT,CODE,CODE2) \
PUT_PROT(MT,short,CODE) \
PUT_PROT(MT,u_short,CODE) \
@@ -417,6 +477,7 @@ typedef ostream& (*__omanip_)(ostream&);
PUT_PROT(MT,void *,CODE) \
inline virtual MT& operator<<(__omanip_ func) CODE2 \
inline virtual MT& operator<<(__manip_ func) CODE2
+
# if defined (ACE_LACKS_SIGNED_CHAR)
#define GET_FUNC_SET1(MT,CODE,CODE2) GET_FUNC_SET0(MT,CODE,CODE2)
#define PUT_FUNC_SET1(MT,CODE,CODE2) PUT_FUNC_SET0(MT,CODE,CODE2)
@@ -425,22 +486,28 @@ typedef ostream& (*__omanip_)(ostream&);
GET_PROT(MT,signed char &,CODE) \
GET_PROT(MT,signed char *,CODE) \
GET_FUNC_SET0(MT,CODE,CODE2)
+
#define PUT_FUNC_SET1(MT,CODE,CODE2) \
PUT_FUNC(MT,signed char) \
PUT_FUNC(MT,const signed char *) \
PUT_FUNC_SET0(MT,CODE,CODE2)
# endif /* ACE_LACKS_SIGNED_CHAR */
+
#define GET_MANIP_CODE { if (ipfx ()) { (*func) (*this); } isfx (); return *this; }
#define PUT_MANIP_CODE { if (opfx ()) { (*func) (*this); } osfx (); return *this; }
+
#define GET_FUNC_SET(MT) GET_FUNC_SET1(MT,GET_CODE,GET_MANIP_CODE)
#define PUT_FUNC_SET(MT) PUT_FUNC_SET1(MT,PUT_CODE,PUT_MANIP_CODE)
#define GETPUT_FUNC_SET(MT) GET_FUNC_SET(MT) PUT_FUNC_SET(MT)
+
#define GET_SIG_SET(MT) GET_FUNC_SET1(MT,= 0;,= 0;)
#define PUT_SIG_SET(MT) PUT_FUNC_SET1(MT,= 0;,= 0;)
#define GETPUT_SIG_SET(MT) GET_SIG_SET(MT) PUT_SIG_SET(MT)
+
// Include the templates here.
# include "ace/IOStream_T.h"
#endif /* !ACE_LACKS_ACE_IOSTREAM && ACE_USES_OLD_IOSTREAMS */
+
#include /**/ "ace/post.h"
#endif /* ACE_IOSTREAM_H */
diff --git a/dep/ACE_wrappers/ace/IOStream_T.h b/dep/ACE_wrappers/ace/IOStream_T.h
index ae9c2f3335b..e0046f921a3 100644
--- a/dep/ACE_wrappers/ace/IOStream_T.h
+++ b/dep/ACE_wrappers/ace/IOStream_T.h
@@ -1,4 +1,5 @@
/* -*- C++ -*- */
+
//=============================================================================
/**
* @file IOStream_T.h
@@ -13,24 +14,33 @@
* we only put some conditional compilations in that file.
*/
//=============================================================================
+
#ifndef ACE_IOSTREAM_T_H
#define ACE_IOSTREAM_T_H
#include /**/ "ace/pre.h"
+
#include "ace/IOStream.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if !defined (ACE_LACKS_ACE_IOSTREAM)
+
# include "ace/INET_Addr.h"
# include "ace/Global_Macros.h"
+
# if defined (ACE_LACKS_IOSTREAM_FX)
# include "ace/os_include/os_ctype.h"
# endif /**/
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
# if defined (ACE_HAS_STRING_CLASS)
template <class STREAM> STREAM & operator>> (STREAM &stream, ACE_Quoted_String &str);
template <class STREAM> STREAM & operator<< (STREAM &stream, ACE_Quoted_String &str);
# endif /* defined (ACE_HAS_STRING_CLASS) */
+
template <class STREAM>
class ACE_Streambuf_T : public ACE_Streambuf
{
@@ -44,23 +54,30 @@ public:
ACE_Streambuf_T (STREAM *peer,
u_int streambuf_size = ACE_STREAMBUF_SIZE,
int io_mode = ios::in | ios::out);
+
virtual ssize_t send (char *buf, ssize_t len);
+
virtual ssize_t recv (char *buf,
ssize_t len,
ACE_Time_Value *tv = 0);
+
virtual ssize_t recv (char *buf,
ssize_t len,
int flags,
ACE_Time_Value * tv = 0);
+
virtual ssize_t recv_n (char *buf,
ssize_t len,
int flags = 0,
ACE_Time_Value *tv = 0);
+
protected:
virtual ACE_HANDLE get_handle (void);
+
/// This will be our ACE_SOCK_Stream or similar object.
STREAM *peer_;
};
+
/**
* @class ACE_IOStream
*
@@ -97,18 +114,22 @@ public:
// = Initialization and termination methods.
ACE_IOStream (STREAM &stream,
u_int streambuf_size = ACE_STREAMBUF_SIZE);
+
/**
* The default constructor. This will initiailze your STREAM and
* then setup the iostream baseclass to use a custom streambuf based
* on STREAM.
*/
ACE_IOStream (u_int streambuf_size = ACE_STREAMBUF_SIZE);
+
/// We have to get rid of the <streambuf_> ourselves since we gave it
/// to the <iostream> base class;
virtual ~ACE_IOStream (void);
+
/// The only ambituity in the multiple inheritance is the <close>
/// function.
virtual int close (void);
+
/**
* Returns 1 if we're at the end of the <STREAM>, i.e., if the
* connection has closed down or an error has occurred, else 0.
@@ -118,6 +139,7 @@ public:
* successively.
*/
int eof (void) const;
+
# if defined (ACE_HAS_STRING_CLASS)
/**
* A simple string operator. The base <iostream> has them for char*
@@ -125,11 +147,14 @@ public:
* provide our own here, we may not get what we want.
*/
virtual ACE_IOStream<STREAM> &operator>> (ACE_IOStream_String &v);
+
/// The converse of the <String::put> operator.
virtual ACE_IOStream<STREAM> &operator<< (ACE_IOStream_String &v);
+
# endif /* ACE_HAS_STRING_CLASS */
// = Using the macros to provide get/set operators.
GETPUT_FUNC_SET (ACE_IOStream<STREAM>)
+
# if defined (ACE_LACKS_IOSTREAM_FX)
virtual int ipfx (int noskip = 0)
{
@@ -191,15 +216,19 @@ public:
virtual int opfx (void) { return iostream::opfx (); }
virtual void osfx (void) { iostream::osfx (); }
# endif /* ACE_LACKS_IOSTREAM_FX */
+
/// Allow the programmer to provide a timeout for read operations.
/// Give it a pointer to NULL to block forever.
ACE_IOStream<STREAM> & operator>> (ACE_Time_Value *&tv);
+
protected:
/// This is where all of the action takes place. The streambuf_ is
/// the interface to the underlying STREAM.
ACE_Streambuf_T<STREAM> *streambuf_;
+
private:
// = Private methods.
+
// We move these into the private section so that they cannot be
// used by the application programmer. This is necessary because
// streambuf_ will be buffering IO on the STREAM object. If these
@@ -210,6 +239,7 @@ private:
ACE_UNIMPLEMENTED_FUNC (ssize_t send_n (...))
ACE_UNIMPLEMENTED_FUNC (ssize_t recv_n (...))
};
+
/**
* @class ACE_SOCK_Dgram_SC
*
@@ -243,20 +273,26 @@ public:
int flags = 0,
ACE_Time_Value *tv = 0);
int get_remote_addr (ACE_INET_Addr &addr) const;
+
protected:
ACE_INET_Addr peer_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# if defined (__ACE_INLINE__)
# include "ace/IOStream_T.inl"
# endif /* __ACE_INLINE__ */
+
# if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
# include "ace/IOStream_T.cpp"
# endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
# if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
# pragma implementation ("IOStream_T.cpp")
# endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
#endif /* ACE_LACKS_ACE_IOSTREAM */
+
#include /**/ "ace/post.h"
#endif /* ACE_IOSTREAM_T_H */
diff --git a/dep/ACE_wrappers/ace/IOStream_T.inl b/dep/ACE_wrappers/ace/IOStream_T.inl
index a960b10d586..513d6ecb1d2 100644
--- a/dep/ACE_wrappers/ace/IOStream_T.inl
+++ b/dep/ACE_wrappers/ace/IOStream_T.inl
@@ -1,35 +1,45 @@
// -*- C++ -*-
//
// $Id: IOStream_T.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Handle_Set.h"
#include "ace/OS_NS_errno.h"
#include "ace/OS_NS_sys_select.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template <class STREAM> ACE_INLINE int
ACE_IOStream<STREAM>::eof (void) const
{
// Get the timeout value of the streambuf
ACE_Time_Value *timeout = this->streambuf_->recv_timeout (0);
+
// Reset the timeout value of the streambuf.
(void) this->streambuf_->recv_timeout (timeout);
+
char c;
int rval = this->streambuf_->recv_n (&c,
sizeof c,
MSG_PEEK,
timeout);
+
// Timeout, not an eof
if (this->streambuf_->timeout())
return 0;
+
// No timeout, got enough data: not eof
if (rval == sizeof(char))
return 0;
+
// No timeout, not enough data: definately eof
return 1;
}
+
template <class STREAM> ACE_INLINE
ACE_SOCK_Dgram_SC<STREAM>::ACE_SOCK_Dgram_SC (void)
{
}
+
template <class STREAM> ACE_INLINE
ACE_SOCK_Dgram_SC<STREAM>::ACE_SOCK_Dgram_SC (STREAM &source,
ACE_INET_Addr &dest)
@@ -37,12 +47,14 @@ ACE_SOCK_Dgram_SC<STREAM>::ACE_SOCK_Dgram_SC (STREAM &source,
peer_ (dest)
{
}
+
template <class STREAM> ACE_INLINE ssize_t
ACE_SOCK_Dgram_SC<STREAM>::send_n (char *buf,
ssize_t len)
{
return STREAM::send (buf, len, peer_);
}
+
template <class STREAM> ACE_INLINE ssize_t
ACE_SOCK_Dgram_SC<STREAM>::recv (char *buf,
ssize_t len,
@@ -52,6 +64,7 @@ ACE_SOCK_Dgram_SC<STREAM>::recv (char *buf,
return recv (buf, len, 0, tv);
//FUZZ: enable check_for_lack_ACE_OS
}
+
template <class STREAM> ACE_INLINE ssize_t
ACE_SOCK_Dgram_SC<STREAM>::recv (char *buf,
ssize_t len,
@@ -62,7 +75,9 @@ ACE_SOCK_Dgram_SC<STREAM>::recv (char *buf,
{
ACE_HANDLE handle = this->get_handle ();
ACE_Handle_Set handle_set;
+
handle_set.set_bit (handle);
+
switch (ACE_OS::select (int (handle) + 1,
(fd_set *) handle_set, // read_fds.
(fd_set *) 0, // write_fds.
@@ -77,6 +92,7 @@ ACE_SOCK_Dgram_SC<STREAM>::recv (char *buf,
; // Do the 'recv' below
}
}
+
int rval = STREAM::recv (buf, len, peer_, flags);
#if defined (ACE_WIN32)
if (rval == SOCKET_ERROR)
@@ -86,6 +102,7 @@ ACE_SOCK_Dgram_SC<STREAM>::recv (char *buf,
#endif /* ACE_WIN32 */
return rval < len ? rval : len;
}
+
template <class STREAM> ACE_INLINE ssize_t
ACE_SOCK_Dgram_SC<STREAM>::recv_n (char *buf,
ssize_t len,
@@ -95,10 +112,12 @@ ACE_SOCK_Dgram_SC<STREAM>::recv_n (char *buf,
int rval = this->recv (buf, len, flags, tv);
return rval;
}
+
template <class STREAM> ACE_INLINE int
ACE_SOCK_Dgram_SC<STREAM>::get_remote_addr (ACE_INET_Addr &addr) const
{
addr = peer_;
return 0;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/IO_Cntl_Msg.cpp b/dep/ACE_wrappers/ace/IO_Cntl_Msg.cpp
index d142295215f..213237298c4 100644
--- a/dep/ACE_wrappers/ace/IO_Cntl_Msg.cpp
+++ b/dep/ACE_wrappers/ace/IO_Cntl_Msg.cpp
@@ -1,17 +1,25 @@
// $Id: IO_Cntl_Msg.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/IO_Cntl_Msg.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/IO_Cntl_Msg.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace, IO_Cntl_Msg, "$Id: IO_Cntl_Msg.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if 0
// This is not meant to be used, it's just a place holder...
+
#if !defined (__ACE_INLINE__)
#include "ace/Intrusive_List.inl"
#endif /* __ACE_INLINE__ */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward decl
template <class SYNCH> class ACE_Module;
+
/**
* @class ACE_Module_Link
*
@@ -21,17 +29,24 @@ class ACE_Module_Link
{
public:
ACE_Module_Link (ACE_Module *m1, ACE_Module *m2): mod_upper_ (m1), mod_lower_ (m2), count_ (0) {}
+
ACE_Module *upper (void) { return this->mod_upper_; }
void upper (ACE_Module *u) { this->mod_upper_ = u; }
+
ACE_Module *lower (void) { return this->mod_lower_; }
void lower (ACE_Module *l) { this->mod_lower_ = l; }
+
int count (void) const { return this->count_; }
void count (int c) { this->count_ = c; }
+
private:
ACE_Module *mod_upper_;
ACE_Module *mod_lower_;
int count_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif
+
diff --git a/dep/ACE_wrappers/ace/IO_Cntl_Msg.h b/dep/ACE_wrappers/ace/IO_Cntl_Msg.h
index ec88f1b9d8f..e99d0189620 100644
--- a/dep/ACE_wrappers/ace/IO_Cntl_Msg.h
+++ b/dep/ACE_wrappers/ace/IO_Cntl_Msg.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file IO_Cntl_Msg.h
@@ -9,15 +10,21 @@
*/
//==========================================================================
+
#ifndef ACE_IO_CNTL_MSG_H
#define ACE_IO_CNTL_MSG_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
#include "ace/os_include/os_stddef.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_IO_Cntl_Msg
*
@@ -41,45 +48,66 @@ public:
/// Unlink modules
MOD_UNLINK = 6
};
+
typedef unsigned short ACE_IO_Cntl_Cmds;
+
// = Initialization method.
/// Initialize the control message.
ACE_IO_Cntl_Msg (ACE_IO_Cntl_Cmds c);
+
// = Get/set methods
+
/// Get command.
ACE_IO_Cntl_Cmds cmd (void);
+
/// Set command.
void cmd (ACE_IO_Cntl_Cmds c);
+
/// Get count.
size_t count (void);
+
/// Set count.
void count (size_t c);
+
/// Get error.
int error (void);
+
/// Set error.
void error (int e);
+
/// Get return value.
int rval (void);
+
/// Set return value.
void rval (int r);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Command.
ACE_IO_Cntl_Cmds cmd_;
+
/// Count.
size_t count_;
+
/// Error.
int error_;
+
/// Return value
int rval_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/IO_Cntl_Msg.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_IO_CNTL_MSG_H */
diff --git a/dep/ACE_wrappers/ace/IO_Cntl_Msg.inl b/dep/ACE_wrappers/ace/IO_Cntl_Msg.inl
index c39d4a8cb46..6b8558e0806 100644
--- a/dep/ACE_wrappers/ace/IO_Cntl_Msg.inl
+++ b/dep/ACE_wrappers/ace/IO_Cntl_Msg.inl
@@ -1,50 +1,61 @@
// -*- C++ -*-
//
// $Id: IO_Cntl_Msg.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_IO_Cntl_Msg::ACE_IO_Cntl_Msg (ACE_IO_Cntl_Cmds c)
{
this->cmd_ = c;
}
+
ACE_INLINE ACE_IO_Cntl_Msg::ACE_IO_Cntl_Cmds
ACE_IO_Cntl_Msg::cmd (void)
{
return this->cmd_;
}
+
ACE_INLINE void
ACE_IO_Cntl_Msg::cmd (ACE_IO_Cntl_Cmds c)
{
this->cmd_ = c;
}
+
ACE_INLINE size_t
ACE_IO_Cntl_Msg::count (void)
{
return this->count_;
}
+
ACE_INLINE void
ACE_IO_Cntl_Msg::count (size_t c)
{
this->count_ = c;
}
+
ACE_INLINE int
ACE_IO_Cntl_Msg::error (void)
{
return this->error_;
}
+
ACE_INLINE void
ACE_IO_Cntl_Msg::error (int e)
{
this->error_ = e;
}
+
ACE_INLINE int
ACE_IO_Cntl_Msg::rval (void)
{
return this->rval_;
}
+
ACE_INLINE void
ACE_IO_Cntl_Msg::rval (int r)
{
this->rval_ = r;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/IO_SAP.cpp b/dep/ACE_wrappers/ace/IO_SAP.cpp
index 68340f0cd33..bfb693f9871 100644
--- a/dep/ACE_wrappers/ace/IO_SAP.cpp
+++ b/dep/ACE_wrappers/ace/IO_SAP.cpp
@@ -1,36 +1,48 @@
// $Id: IO_SAP.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/IO_SAP.h"
+
#include "ace/Log_Msg.h"
#include "ace/OS_NS_unistd.h"
#include "ace/OS_NS_errno.h"
#include "ace/OS_NS_fcntl.h"
#include "ace/os_include/os_signal.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/IO_SAP.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace, IO_SAP, "$Id: IO_SAP.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_IO_SAP)
+
// This is the do-nothing constructor. It does not perform a
// ACE_OS::open system call.
+
ACE_IO_SAP::ACE_IO_SAP (void)
: handle_ (ACE_INVALID_HANDLE)
{
ACE_TRACE ("ACE_IO_SAP::ACE_IO_SAP");
}
+
void
ACE_IO_SAP::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_IO_SAP::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("handle_ = %d"), this->handle_));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\npid_ = %d"), this->pid_));
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
// Cache for the process ID.
pid_t ACE_IO_SAP::pid_ = 0;
+
int
ACE_IO_SAP::enable (int value) const
{
@@ -38,6 +50,7 @@ ACE_IO_SAP::enable (int value) const
/* First-time in initialization. */
if (ACE_IO_SAP::pid_ == 0)
ACE_IO_SAP::pid_ = ACE_OS::getpid ();
+
switch (value)
{
#if defined (SIGURG)
@@ -76,12 +89,15 @@ ACE_IO_SAP::enable (int value) const
default:
return -1;
}
+
return 0;
}
+
int
ACE_IO_SAP::disable (int value) const
{
ACE_TRACE ("ACE_IO_SAP::disable");
+
switch (value)
{
#if defined (SIGURG)
@@ -122,5 +138,6 @@ ACE_IO_SAP::disable (int value) const
}
return 0;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/IO_SAP.h b/dep/ACE_wrappers/ace/IO_SAP.h
index 0e0af4d6786..94f717c7981 100644
--- a/dep/ACE_wrappers/ace/IO_SAP.h
+++ b/dep/ACE_wrappers/ace/IO_SAP.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file IO_SAP.h
@@ -9,16 +10,21 @@
*/
//=============================================================================
+
#ifndef ACE_IO_SAP_H
#define ACE_IO_SAP_H
#include /**/ "ace/pre.h"
+
#include "ace/Flag_Manip.h"
#include "ace/os_include/sys/os_types.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_IO_SAP
*
@@ -33,44 +39,59 @@ public:
/// Be consistent with Winsock
INVALID_HANDLE = -1
};
+
/// Default dtor.
~ACE_IO_SAP (void);
+
/// Interface for ioctl.
int control (int cmd, void *) const;
+
// = Common I/O handle options related to files.
+
/**
* Enable asynchronous I/O (ACE_SIGIO), urgent data (ACE_SIGURG),
* non-blocking I/O (ACE_NONBLOCK), or close-on-exec (ACE_CLOEXEC),
* which is passed as the @a value.
*/
int enable (int value) const;
+
/**
* Disable asynchronous I/O (ACE_SIGIO), urgent data (ACE_SIGURG),
* non-blocking I/O (ACE_NONBLOCK), or close-on-exec (ACE_CLOEXEC),
* which is passed as the @a value.
*/
int disable (int value) const;
+
/// Get the underlying handle.
ACE_HANDLE get_handle (void) const;
+
/// Set the underlying handle.
void set_handle (ACE_HANDLE handle);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
/// Ensure that ACE_IO_SAP is an abstract base class.
ACE_IO_SAP (void);
+
private:
/// Underlying I/O handle.
ACE_HANDLE handle_;
+
/// Cache the process ID.
static pid_t pid_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/IO_SAP.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_IO_SAP_H */
diff --git a/dep/ACE_wrappers/ace/IO_SAP.inl b/dep/ACE_wrappers/ace/IO_SAP.inl
index 858cacf7bf2..78b2ee31fc0 100644
--- a/dep/ACE_wrappers/ace/IO_SAP.inl
+++ b/dep/ACE_wrappers/ace/IO_SAP.inl
@@ -1,32 +1,42 @@
// -*- C++ -*-
//
// $Id: IO_SAP.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_stropts.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_IO_SAP::~ACE_IO_SAP (void)
{
ACE_TRACE ("ACE_IO_SAP::~ACE_IO_SAP");
}
+
// Used to return the underlying handle_.
+
ACE_INLINE ACE_HANDLE
ACE_IO_SAP::get_handle (void) const
{
ACE_TRACE ("ACE_IO_SAP::get_handle");
return this->handle_;
}
+
// Used to set the underlying handle_.
+
ACE_INLINE void
ACE_IO_SAP::set_handle (ACE_HANDLE handle)
{
ACE_TRACE ("ACE_IO_SAP::set_handle");
this->handle_ = handle;
}
+
// Provides access to the ACE_OS::ioctl system call.
+
ACE_INLINE int
ACE_IO_SAP::control (int cmd, void *arg) const
{
ACE_TRACE ("ACE_IO_SAP::control");
return ACE_OS::ioctl (this->handle_, cmd, arg);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/IPC_SAP.cpp b/dep/ACE_wrappers/ace/IPC_SAP.cpp
index b5968974d51..d257bf60ea5 100644
--- a/dep/ACE_wrappers/ace/IPC_SAP.cpp
+++ b/dep/ACE_wrappers/ace/IPC_SAP.cpp
@@ -1,43 +1,57 @@
// $Id: IPC_SAP.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/IPC_SAP.h"
+
#include "ace/Log_Msg.h"
#include "ace/OS_NS_unistd.h"
#include "ace/os_include/os_signal.h"
#include "ace/OS_NS_errno.h"
#include "ace/OS_NS_fcntl.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/IPC_SAP.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace, IPC_SAP, "$Id: IPC_SAP.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_IPC_SAP)
+
void
ACE_IPC_SAP::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_IPC_SAP::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("handle_ = %d"), this->handle_));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\npid_ = %d"), this->pid_));
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
// Cache for the process ID.
pid_t ACE_IPC_SAP::pid_ = 0;
+
// This is the do-nothing constructor. It does not perform a
// ACE_OS::socket system call.
+
ACE_IPC_SAP::ACE_IPC_SAP (void)
: handle_ (ACE_INVALID_HANDLE)
{
// ACE_TRACE ("ACE_IPC_SAP::ACE_IPC_SAP");
}
+
int
ACE_IPC_SAP::enable (int value) const
{
ACE_TRACE ("ACE_IPC_SAP::enable");
+
// First-time in initialization.
if (ACE_IPC_SAP::pid_ == 0)
ACE_IPC_SAP::pid_ = ACE_OS::getpid ();
+
#if defined (ACE_WIN32) || defined (ACE_VXWORKS)
switch (value)
{
@@ -101,12 +115,15 @@ ACE_IPC_SAP::enable (int value) const
}
return 0;
#endif /* ! ACE_WIN32 && ! ACE_VXWORKS */
+
/* NOTREACHED */
}
+
int
ACE_IPC_SAP::disable (int value) const
{
ACE_TRACE ("ACE_IPC_SAP::disable");
+
#if defined (ACE_WIN32) || defined (ACE_VXWORKS)
switch (value)
{
@@ -172,5 +189,6 @@ ACE_IPC_SAP::disable (int value) const
#endif /* ! ACE_WIN32 && ! ACE_VXWORKS */
/* NOTREACHED */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/IPC_SAP.h b/dep/ACE_wrappers/ace/IPC_SAP.h
index 3629a303754..cc924a24ade 100644
--- a/dep/ACE_wrappers/ace/IPC_SAP.h
+++ b/dep/ACE_wrappers/ace/IPC_SAP.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file IPC_SAP.h
@@ -8,15 +9,20 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_IPC_SAP_H
#define ACE_IPC_SAP_H
#include /**/ "ace/pre.h"
+
#include "ace/Flag_Manip.h"
#include "ace/os_include/sys/os_types.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_IPC_SAP
*
@@ -26,33 +32,44 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
class ACE_Export ACE_IPC_SAP
{
public:
+
/// Interface for <ioctl>.
int control (int cmd, void *) const;
+
// = Common I/O handle options related to sockets.
+
/**
* Enable asynchronous I/O (ACE_SIGIO), urgent data (ACE_SIGURG),
* non-blocking I/O (ACE_NONBLOCK), or close-on-exec (ACE_CLOEXEC),
* which is passed as the @a value.
*/
int enable (int value) const;
+
/**
* Disable asynchronous I/O (ACE_SIGIO), urgent data (ACE_SIGURG),
* non-blocking I/O (ACE_NONBLOCK), or close-on-exec (ACE_CLOEXEC),
* which is passed as the @a value.
*/
int disable (int value) const;
+
/// Get the underlying handle.
ACE_HANDLE get_handle (void) const;
+
/// Set the underlying handle.
void set_handle (ACE_HANDLE handle);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
+
// = Ensure that ACE_IPC_SAP is an abstract base class.
/// Default constructor.
ACE_IPC_SAP (void);
+
/// Protected destructor.
/**
* Not a virtual destructor. Protected destructor to prevent
@@ -60,16 +77,21 @@ protected:
* ACE_IPC_SAP pointer/reference.
*/
~ACE_IPC_SAP (void);
+
private:
/// Underlying I/O handle.
ACE_HANDLE handle_;
+
/// Cache the process ID.
static pid_t pid_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/IPC_SAP.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_IPC_SAP_H */
diff --git a/dep/ACE_wrappers/ace/IPC_SAP.inl b/dep/ACE_wrappers/ace/IPC_SAP.inl
index a5cf28ea8ec..5e80486902a 100644
--- a/dep/ACE_wrappers/ace/IPC_SAP.inl
+++ b/dep/ACE_wrappers/ace/IPC_SAP.inl
@@ -1,31 +1,40 @@
// -*- C++ -*-
//
// $Id: IPC_SAP.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_stropts.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_IPC_SAP::~ACE_IPC_SAP (void)
{
// ACE_TRACE ("ACE_IPC_SAP::~ACE_IPC_SAP");
}
+
ACE_INLINE ACE_HANDLE
ACE_IPC_SAP::get_handle (void) const
{
ACE_TRACE ("ACE_IPC_SAP::get_handle");
return this->handle_;
}
+
// Used to set the underlying handle_.
+
ACE_INLINE void
ACE_IPC_SAP::set_handle (ACE_HANDLE handle)
{
ACE_TRACE ("ACE_IPC_SAP::set_handle");
this->handle_ = handle;
}
+
// Provides access to the ACE_OS::ioctl system call.
+
ACE_INLINE int
ACE_IPC_SAP::control (int cmd, void *arg) const
{
ACE_TRACE ("ACE_IPC_SAP::control");
return ACE_OS::ioctl (this->handle_, cmd, arg);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/If_Then_Else.h b/dep/ACE_wrappers/ace/If_Then_Else.h
index c9579dbc593..67f08f6f8e4 100644
--- a/dep/ACE_wrappers/ace/If_Then_Else.h
+++ b/dep/ACE_wrappers/ace/If_Then_Else.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file If_Then_Else.h
@@ -12,12 +13,17 @@
* @author Ossama Othman <ossama@dre.vanderbilt.edu>
*/
//=============================================================================
+
#ifndef ACE_IF_THEN_ELSE_H
#define ACE_IF_THEN_ELSE_H
+
#include "ace/config-lite.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE
{
+
/**
* @struct If_Then_Else
*
@@ -47,6 +53,7 @@ namespace ACE
*/
template <bool C, typename Ta, typename Tb>
struct If_Then_Else;
+
/**
* @struct If_Then_Else
*
@@ -60,6 +67,7 @@ namespace ACE
{
typedef Ta result_type;
};
+
/**
* @struct If_Then_Else
*
@@ -73,7 +81,10 @@ namespace ACE
{
typedef Tb result_type;
};
+
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_IF_THEN_ELSE_H */
diff --git a/dep/ACE_wrappers/ace/Init_ACE.cpp b/dep/ACE_wrappers/ace/Init_ACE.cpp
index bf28e6d2741..655ef539d6f 100644
--- a/dep/ACE_wrappers/ace/Init_ACE.cpp
+++ b/dep/ACE_wrappers/ace/Init_ACE.cpp
@@ -1,24 +1,33 @@
#include "ace/Init_ACE.h"
+
#include "ace/Object_Manager.h"
+
ACE_RCSID (ace,
Init_ACE,
"$Id: Init_ACE.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
unsigned int ACE::init_fini_count_ = 0;
+
int
ACE::init (void)
{
// Don't use ACE_TRACE, because Object_Manager might not have been
// instantiated yet.
// ACE_TRACE ("ACE::init");
+
++ACE::init_fini_count_;
+
return ACE_Object_Manager::instance ()->init ();
}
+
int
ACE::fini (void)
{
ACE_TRACE ("ACE::fini");
+
if (ACE::init_fini_count_ > 0)
{
if (--ACE::init_fini_count_ == 0)
@@ -32,5 +41,6 @@ ACE::fini (void)
// application!
return -1;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Init_ACE.h b/dep/ACE_wrappers/ace/Init_ACE.h
index 49c72e70b13..9f2afa34669 100644
--- a/dep/ACE_wrappers/ace/Init_ACE.h
+++ b/dep/ACE_wrappers/ace/Init_ACE.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Init_ACE.h
@@ -10,14 +11,20 @@
*/
//=============================================================================
+
#ifndef ACE_INIT_ACE_H
#define ACE_INIT_ACE_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE
{
/**
@@ -28,6 +35,7 @@ namespace ACE
* called.
*/
extern ACE_Export int init (void);
+
/**
* Shut down ACE library services. Can be called only once per
* program invocation.
@@ -35,8 +43,10 @@ namespace ACE
* called.
*/
extern ACE_Export int fini (void);
+
// private:
// Used internally, so not exported.
+
/**
* Counter to match <init()>/<fini()> calls. <init()> must increment it;
* <fini()> must decrement it. <fini()> then does nothing until it
@@ -44,7 +54,10 @@ namespace ACE
*/
extern unsigned int init_fini_count_;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
+
#endif /* ACE_INIT_ACE_H */
diff --git a/dep/ACE_wrappers/ace/Intrusive_Auto_Ptr.h b/dep/ACE_wrappers/ace/Intrusive_Auto_Ptr.h
index ca4c835da14..85d52f7f1c5 100644
--- a/dep/ACE_wrappers/ace/Intrusive_Auto_Ptr.h
+++ b/dep/ACE_wrappers/ace/Intrusive_Auto_Ptr.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Intrusive_Auto_Ptr.h
@@ -10,17 +11,24 @@
* @note Modeled on http://www.boost.org/boost/intrusive_ptr.hpp
*/
//=============================================================================
+
#ifndef ACE_INTRUSIVE_AUTO_PTR_H
#define ACE_INTRUSIVE_AUTO_PTR_H
+
#include /**/ "ace/pre.h"
+
#include "ace/Auto_Ptr.h"
#include "ace/Atomic_Op.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward decl.
template <class X> class ACE_Intrusive_Auto_Ptr;
+
/**
* @class ACE_Intrusive_Auto_Ptr
*
@@ -42,56 +50,76 @@ template <class X>
class ACE_Intrusive_Auto_Ptr
{
protected:
+
/// Used to define a proper boolean conversion for "if (sp) ..."
static void unspecified_bool(ACE_Intrusive_Auto_Ptr<X>***){};
typedef void (*unspecified_bool_type)(ACE_Intrusive_Auto_Ptr<X>***);
+
public:
+
/// Enables "if (sp) ..."
operator unspecified_bool_type() const
{
return rep_ == 0 ? 0: unspecified_bool;
}
+
// = Initialization and termination methods.
+
/// Constructor that initializes an ACE_Intrusive_Auto_Ptr to
/// the specified pointer value.
ACE_Intrusive_Auto_Ptr (X *p = 0, bool addref = true);
+
/// Copy constructor binds the new ACE_Intrusive_Auto_Ptr to the
/// representation object referenced by @a r.
/// An ACE_Intrusive_Auto_Ptr_Rep is created if necessary.
ACE_Intrusive_Auto_Ptr (const ACE_Intrusive_Auto_Ptr<X> &r);
+
// Derived class copy ctor
template<class U> ACE_Intrusive_Auto_Ptr(const ACE_Intrusive_Auto_Ptr<U> & rhs);
+
/// Destructor. Releases the reference to the underlying representation.
/// If the release of that reference causes its reference count to reach 0,
/// the representation object will also be destroyed.
virtual ~ACE_Intrusive_Auto_Ptr (void);
+
/// Assignment operator that binds the current object and @a r to the same
/// ACE_Intrusive_Auto_Ptr_Rep. An ACE_Intrusive_Auto_Ptr_Rep
/// is created if necessary.
void operator = (const ACE_Intrusive_Auto_Ptr<X> &r);
+
/// Redirection operator
X *operator-> (void) const;
+
/// Accessor method.
X &operator *() const;
+
/// Releases the reference to the underlying representation object.
/// @retval The pointer value prior to releasing it.
X *release (void);
+
/// Releases the current pointer value and then sets a new
/// pointer value specified by @a p.
void reset (X *p = 0);
+
/// Get the pointer value.
X *get (void) const;
+
/// Get the reference count value.
long count (void) const;
+
/// Returns @c true if this object does not contain a valid pointer.
// bool null (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
+
/// Protect operations on the ACE_Intrusive_Auto_Ptr.
X *rep_;
};
+
/// Equality operator that returns @c true if both
/// ACE_Intrusive_Auto_Ptr objects point to the same underlying
/// representation. It does not compare the actual pointers.
@@ -101,27 +129,38 @@ protected:
*/
template<class T, class U>
bool operator==(ACE_Intrusive_Auto_Ptr<T> const & a, ACE_Intrusive_Auto_Ptr<U> const & b);
+
/// Inequality operator, which is the opposite of equality.
template<class T, class U>
bool operator!=(ACE_Intrusive_Auto_Ptr<T> const & a, ACE_Intrusive_Auto_Ptr<U> const & b);
+
template<class T, class U>
bool operator==(ACE_Intrusive_Auto_Ptr<T> const & a, U * b);
+
template<class T, class U>
bool operator!=(ACE_Intrusive_Auto_Ptr<T> & a, U * b);
+
template<class T, class U>
bool operator==(T * a, ACE_Intrusive_Auto_Ptr<U> const & b);
+
template<class T, class U>
bool operator!=(T * a, ACE_Intrusive_Auto_Ptr<U> const & b);
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Intrusive_Auto_Ptr.inl"
#endif /* __ACE_INLINE __ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Intrusive_Auto_Ptr.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Intrusive_Auto_Ptr.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_INTRUSIVE_AUTO_PTR_H */
diff --git a/dep/ACE_wrappers/ace/Intrusive_Auto_Ptr.inl b/dep/ACE_wrappers/ace/Intrusive_Auto_Ptr.inl
index d3f38c968eb..4feb83db7b1 100644
--- a/dep/ACE_wrappers/ace/Intrusive_Auto_Ptr.inl
+++ b/dep/ACE_wrappers/ace/Intrusive_Auto_Ptr.inl
@@ -1,9 +1,12 @@
// -*- C++ -*-
//
// $Id: Intrusive_Auto_Ptr.inl 81219 2008-04-02 20:23:32Z iliyan $
+
#include "ace/Guard_T.h"
#include "ace/Log_Msg.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template <class X> ACE_INLINE
ACE_Intrusive_Auto_Ptr<X>::ACE_Intrusive_Auto_Ptr (X *p, bool addref)
: rep_ (p)
@@ -11,6 +14,7 @@ ACE_Intrusive_Auto_Ptr<X>::ACE_Intrusive_Auto_Ptr (X *p, bool addref)
if (rep_ != 0 && addref)
X::intrusive_add_ref (rep_);
}
+
template <class X> ACE_INLINE
ACE_Intrusive_Auto_Ptr<X>::ACE_Intrusive_Auto_Ptr (const ACE_Intrusive_Auto_Ptr<X> &r)
: rep_ (r.rep_)
@@ -18,31 +22,37 @@ ACE_Intrusive_Auto_Ptr<X>::ACE_Intrusive_Auto_Ptr (const ACE_Intrusive_Auto_Ptr<
if (rep_ != 0)
X::intrusive_add_ref (rep_);
}
+
template <class X> ACE_INLINE X *
ACE_Intrusive_Auto_Ptr<X>::operator-> (void) const
{
return this->rep_;
}
+
template<class X> ACE_INLINE X &
ACE_Intrusive_Auto_Ptr<X>::operator *() const
{
return *this->rep_;
}
+
template <class X> ACE_INLINE X*
ACE_Intrusive_Auto_Ptr<X>::get (void) const
{
// We return the ACE_Future_rep.
return this->rep_;
}
+
template<class X> ACE_INLINE X *
ACE_Intrusive_Auto_Ptr<X>::release (void)
{
X *p = this->rep_;
if (this->rep_ != 0)
X::intrusive_remove_ref (this->rep_);
+
this->rep_ = 0;
return p;
}
+
template<class X> ACE_INLINE void
ACE_Intrusive_Auto_Ptr<X>::reset (X *p)
{
@@ -50,20 +60,26 @@ ACE_Intrusive_Auto_Ptr<X>::reset (X *p)
// pointer value.
if (this->rep_ == p)
return;
+
X *old_rep = this->rep_;
this->rep_ = p;
+
if (this->rep_ != 0)
X::intrusive_add_ref (this->rep_);
+
if (old_rep != 0)
X::intrusive_remove_ref (old_rep);
+
return;
}
+
template <class X> ACE_INLINE void
ACE_Intrusive_Auto_Ptr<X>::operator = (const ACE_Intrusive_Auto_Ptr<X> &rhs)
{
// do nothing when aliasing
if (this->rep_ == rhs.rep_)
return;
+
// assign a zero
if (rhs.rep_ == 0)
{
@@ -71,12 +87,14 @@ ACE_Intrusive_Auto_Ptr<X>::operator = (const ACE_Intrusive_Auto_Ptr<X> &rhs)
this->rep_ = 0;
return;
}
+
// bind <this> to the same <ACE_Intrusive_Auto_Ptr_Rep> as <rhs>.
X *old_rep = this->rep_;
this->rep_ = rhs.rep_;
X::intrusive_add_ref (this->rep_);
X::intrusive_remove_ref (old_rep);
}
+
// Copy derived class constructor
template<class X> template <class U> ACE_INLINE
ACE_Intrusive_Auto_Ptr<X>::ACE_Intrusive_Auto_Ptr (const ACE_Intrusive_Auto_Ptr<U> & rhs)
@@ -86,6 +104,7 @@ ACE_Intrusive_Auto_Ptr<X>::ACE_Intrusive_Auto_Ptr (const ACE_Intrusive_Auto_Ptr<
this->rep_ = rhs.operator-> ();
X::intrusive_add_ref(this->rep_);
}
+
/// Equality operator that returns @c true if both
/// ACE_Intrusive_Auto_Ptr objects point to the same underlying
/// representation. It does not compare the actual pointers.
@@ -97,26 +116,32 @@ template<class T, class U> ACE_INLINE bool operator==(ACE_Intrusive_Auto_Ptr<T>
{
return a.get() == b.get();
}
+
/// Inequality operator, which is the opposite of equality.
template<class T, class U> ACE_INLINE bool operator!=(ACE_Intrusive_Auto_Ptr<T> const & a, ACE_Intrusive_Auto_Ptr<U> const & b)
{
return a.get() != b.get();
}
+
template<class T, class U> ACE_INLINE bool operator==(ACE_Intrusive_Auto_Ptr<T> const & a, U * b)
{
return a.get() == b;
}
+
template<class T, class U> ACE_INLINE bool operator!=(ACE_Intrusive_Auto_Ptr<T> & a, U * b)
{
return a.get() != b;
}
+
template<class T, class U> ACE_INLINE bool operator==(T * a, ACE_Intrusive_Auto_Ptr<U> const & b)
{
return a == b.get();
}
+
template<class T, class U> ACE_INLINE bool operator!=(T * a, ACE_Intrusive_Auto_Ptr<U> const & b)
{
return a != b.get();
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Intrusive_List.h b/dep/ACE_wrappers/ace/Intrusive_List.h
index 6e33da7dac0..24e7cedfc13 100644
--- a/dep/ACE_wrappers/ace/Intrusive_List.h
+++ b/dep/ACE_wrappers/ace/Intrusive_List.h
@@ -1,4 +1,5 @@
/* -*- C++ -*- */
+
//=============================================================================
/**
* @file Intrusive_List.h
@@ -8,14 +9,19 @@
* @author Carlos O'Ryan <coryan@uci.edu>
*/
//=============================================================================
+
#ifndef ACE_INTRUSIVE_LIST_H
#define ACE_INTRUSIVE_LIST_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Intrusive_List
*
@@ -56,39 +62,53 @@ public:
/// Constructor. Use user specified allocation strategy
/// if specified.
ACE_Intrusive_List (void);
+
/// Destructor.
~ACE_Intrusive_List (void);
+
// = Check boundary conditions.
+
/// Returns 1 if the container is empty, otherwise returns 0.
int is_empty (void) const;
+
/// Returns 1 if the container is empty, otherwise returns 0.
/// @deprecated Use is_empty() instead.
int empty (void) const;
+
/// Insert an element at the beginning of the list
void push_front (T *node);
+
/// Insert an element at the end of the list
void push_back (T *node);
+
/// Remove the element at the beginning of the list
T *pop_front (void);
+
/// Remove the element at the end of the list
T *pop_back (void);
+
/// Get the element at the head of the queue
T *head (void) const;
+
/// Get the element at the tail of the queue
T *tail (void) const;
+
/// Remove a element from the list
/**
* Verify that the element is still in the list before removing it.
*/
void remove (T *node);
+
/// Swap two lists
void swap(ACE_Intrusive_List<T> & rhs);
+
/// Remove a element from the list without checking
/**
* No attempts are performed to check if T* really belongs to the
* list. The effects of removing an invalid element are unspecified
*/
void unsafe_remove (T *node);
+
private:
/** @name Disallow copying
*
@@ -97,22 +117,29 @@ private:
ACE_Intrusive_List (const ACE_Intrusive_List<T> &);
ACE_Intrusive_List<T>& operator= (const ACE_Intrusive_List<T> &);
//@}
+
private:
/// Head of the list
T *head_;
+
/// Tail of the list
T *tail_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Intrusive_List.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Intrusive_List.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Intrusive_List.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
#endif /* ACE_INTRUSIVE_LIST_H */
diff --git a/dep/ACE_wrappers/ace/Intrusive_List.inl b/dep/ACE_wrappers/ace/Intrusive_List.inl
index 2c5e4b73e32..aac3306962b 100644
--- a/dep/ACE_wrappers/ace/Intrusive_List.inl
+++ b/dep/ACE_wrappers/ace/Intrusive_List.inl
@@ -1,32 +1,40 @@
// -*- C++ -*-
//
// $Id: Intrusive_List.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include <algorithm>
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template<class T> ACE_INLINE int
ACE_Intrusive_List<T>::is_empty (void) const
{
return this->head_ == 0;
}
+
template<class T> ACE_INLINE int
ACE_Intrusive_List<T>::empty (void) const
{
return this->is_empty ();
}
+
template<class T> ACE_INLINE T *
ACE_Intrusive_List<T>::head (void) const
{
return this->head_;
}
+
template<class T> ACE_INLINE T *
ACE_Intrusive_List<T>::tail (void) const
{
return this->tail_;
}
+
template<class T> ACE_INLINE void
ACE_Intrusive_List<T>::swap(ACE_Intrusive_List<T> & rhs)
{
std::swap(head_, rhs.head_);
std::swap(tail_, rhs.tail_);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Intrusive_List_Node.h b/dep/ACE_wrappers/ace/Intrusive_List_Node.h
index cee7b5ed2cb..21ea961f220 100644
--- a/dep/ACE_wrappers/ace/Intrusive_List_Node.h
+++ b/dep/ACE_wrappers/ace/Intrusive_List_Node.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Intrusive_List_Node.h
@@ -8,14 +9,19 @@
* @author Carlos O'Ryan <coryan@uci.edu>
*/
//=============================================================================
+
#ifndef ACE_INTRUSIVE_LIST_NODE_H
#define ACE_INTRUSIVE_LIST_NODE_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Intrusive_List_Node
*
@@ -46,6 +52,7 @@ public:
T *next (void) const;
void next (T *);
//@}
+
protected:
/// Constructor
/**
@@ -53,21 +60,27 @@ protected:
* be instantiated.
*/
ACE_Intrusive_List_Node (void);
+
private:
/// Head and tail of the list
T *prev_;
T *next_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Intrusive_List_Node.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Intrusive_List_Node.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Intrusive_List_Node.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
#endif /* ACE_INTRUSIVE_LIST_NODE_H */
diff --git a/dep/ACE_wrappers/ace/Intrusive_List_Node.inl b/dep/ACE_wrappers/ace/Intrusive_List_Node.inl
index 9a6895bc6aa..52c4f7dec1b 100644
--- a/dep/ACE_wrappers/ace/Intrusive_List_Node.inl
+++ b/dep/ACE_wrappers/ace/Intrusive_List_Node.inl
@@ -1,25 +1,31 @@
// -*- C++ -*-
//
// $Id: Intrusive_List_Node.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template<class T> ACE_INLINE T*
ACE_Intrusive_List_Node<T>::prev (void) const
{
return this->prev_;
}
+
template<class T> ACE_INLINE void
ACE_Intrusive_List_Node<T>::prev (T *x)
{
this->prev_ = x;
}
+
template<class T> ACE_INLINE T*
ACE_Intrusive_List_Node<T>::next (void) const
{
return this->next_;
}
+
template<class T> ACE_INLINE void
ACE_Intrusive_List_Node<T>::next (T *x)
{
this->next_ = x;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/LOCK_SOCK_Acceptor.h b/dep/ACE_wrappers/ace/LOCK_SOCK_Acceptor.h
index 0f363bbb515..6429a2888c8 100644
--- a/dep/ACE_wrappers/ace/LOCK_SOCK_Acceptor.h
+++ b/dep/ACE_wrappers/ace/LOCK_SOCK_Acceptor.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file LOCK_SOCK_Acceptor.h
@@ -9,14 +10,19 @@
*/
//=============================================================================
+
#ifndef ACE_LOCK_SOCK_ACCEPTOR_H
#define ACE_LOCK_SOCK_ACCEPTOR_H
#include /**/ "ace/pre.h"
+
#include "ace/SOCK_Acceptor.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_LOCK_SOCK_Acceptor
*
@@ -38,19 +44,25 @@ public:
ACE_Time_Value *timeout = 0,
int restart = 1,
int reset_new_handle = 0) const;
+
/// Return a reference to the lock.
ACE_LOCK &lock (void);
+
protected:
/// Type of locking mechanism.
ACE_LOCK lock_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/LOCK_SOCK_Acceptor.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("LOCK_SOCK_Acceptor.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
#endif /* ACE_LOCK_SOCK_ACCEPTOR_H */
diff --git a/dep/ACE_wrappers/ace/LSOCK.cpp b/dep/ACE_wrappers/ace/LSOCK.cpp
index 120ab011513..17c210aa9fc 100644
--- a/dep/ACE_wrappers/ace/LSOCK.cpp
+++ b/dep/ACE_wrappers/ace/LSOCK.cpp
@@ -1,26 +1,37 @@
// $Id: LSOCK.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/LSOCK.h"
+
ACE_RCSID(ace, LSOCK, "$Id: LSOCK.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS)
+
#include "ace/Log_Msg.h"
#include "ace/OS_NS_sys_socket.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/LSOCK.inl"
#endif /* __ACE_INLINE__ */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_LSOCK)
+
void
ACE_LSOCK::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_LSOCK::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("aux_handle_ = %d"), this->aux_handle_));
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
#if defined (ACE_HAS_MSG)
// This routine sends an open file descriptor to <this->handle_>.
+
ssize_t
ACE_LSOCK::send_handle (const ACE_HANDLE handle) const
{
@@ -32,6 +43,7 @@ ACE_LSOCK::send_handle (const ACE_HANDLE handle) const
char cmsgbuf[ACE_BSD_CONTROL_MSG_LEN];
cmsghdr *cmsgptr = (cmsghdr *) cmsgbuf;
#endif /* ACE_HAS_4_4BSD_SENDMSG_RECVMSG */
+
a[0] = 0xab;
a[1] = 0xcd;
iov.iov_base = (char *) a;
@@ -40,6 +52,7 @@ ACE_LSOCK::send_handle (const ACE_HANDLE handle) const
send_msg.msg_iovlen = 1;
send_msg.msg_name = 0;
send_msg.msg_namelen = 0;
+
#if defined (ACE_HAS_4_4BSD_SENDMSG_RECVMSG)
cmsgptr->cmsg_level = SOL_SOCKET;
cmsgptr->cmsg_type = SCM_RIGHTS;
@@ -52,11 +65,14 @@ ACE_LSOCK::send_handle (const ACE_HANDLE handle) const
send_msg.msg_accrights = (char *) &handle;
send_msg.msg_accrightslen = sizeof handle;
#endif /* ACE_HAS_4_4BSD_SENDMSG_RECVMSG */
+
return ACE_OS::sendmsg (this->get_handle (), &send_msg, 0);
}
+
// This file receives an open file descriptor from <this->handle_>.
// Note, this routine returns -1 if problems occur, 0 if we recv a
// message that does not have file descriptor in it, and 1 otherwise.
+
ssize_t
ACE_LSOCK::recv_handle (ACE_HANDLE &handle, char *pbuf, ssize_t *len) const
{
@@ -64,9 +80,11 @@ ACE_LSOCK::recv_handle (ACE_HANDLE &handle, char *pbuf, ssize_t *len) const
u_char a[2];
iovec iov;
msghdr recv_msg;
+
#if defined (ACE_HAS_4_4BSD_SENDMSG_RECVMSG)
char cmsgbuf[ACE_BSD_CONTROL_MSG_LEN];
#endif /* ACE_HAS_4_4BSD_SENDMSG_RECVMSG */
+
if (pbuf != 0 && len != 0)
{
iov.iov_base = pbuf;
@@ -77,6 +95,7 @@ ACE_LSOCK::recv_handle (ACE_HANDLE &handle, char *pbuf, ssize_t *len) const
iov.iov_base = (char *) a;
iov.iov_len = sizeof a;
}
+
recv_msg.msg_iov = &iov;
recv_msg.msg_iovlen = 1;
recv_msg.msg_name = 0;
@@ -88,12 +107,16 @@ ACE_LSOCK::recv_handle (ACE_HANDLE &handle, char *pbuf, ssize_t *len) const
recv_msg.msg_accrights = (char *) &handle;
recv_msg.msg_accrightslen = sizeof handle;
#endif /* ACE_HAS_4_4BSD_SENDMSG_RECVMSG */
+
#if defined (ACE_HAS_STREAMS)
+
ssize_t nbytes = ACE_OS::recvmsg (this->get_handle (), &recv_msg, 0);
+
if (nbytes != ACE_INVALID_HANDLE)
{
if (len != 0)
*len = nbytes;
+
if (nbytes == sizeof a
&& ((u_char *) iov.iov_base)[0] == 0xab
&& ((u_char *) iov.iov_base)[1] == 0xcd)
@@ -111,6 +134,7 @@ ACE_LSOCK::recv_handle (ACE_HANDLE &handle, char *pbuf, ssize_t *len) const
ssize_t nbytes = ACE_OS::recvmsg (this->get_handle (),
&recv_msg,
MSG_PEEK);
+
if (nbytes != ACE_INVALID_HANDLE)
{
if (nbytes == sizeof a
@@ -126,6 +150,7 @@ ACE_LSOCK::recv_handle (ACE_HANDLE &handle, char *pbuf, ssize_t *len) const
recv_msg.msg_accrights = (char *) &handle;
recv_msg.msg_accrightslen = sizeof handle;
#endif /* ACE_HAS_4_4BSD_SENDMSG_RECVMSG */
+
if (ACE_OS::recvmsg (this->get_handle (),
&recv_msg, 0) == ACE_INVALID_HANDLE)
return ACE_INVALID_HANDLE;
@@ -150,6 +175,8 @@ ACE_LSOCK::recv_handle (ACE_HANDLE &handle, char *pbuf, ssize_t *len) const
return ACE_INVALID_HANDLE;
}
#endif /* ACE_HAS_MSG */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */
diff --git a/dep/ACE_wrappers/ace/LSOCK.h b/dep/ACE_wrappers/ace/LSOCK.h
index d4ec904a1a4..250362cdaef 100644
--- a/dep/ACE_wrappers/ace/LSOCK.h
+++ b/dep/ACE_wrappers/ace/LSOCK.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file LSOCK.h
@@ -9,16 +10,24 @@
*/
//=============================================================================
+
#ifndef ACE_LOCAL_SOCK_H
#define ACE_LOCAL_SOCK_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS)
+
#include "ace/SOCK.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_LSOCK
*
@@ -31,33 +40,45 @@ public:
#if defined (ACE_HAS_MSG)
/// Send an open FD to another process.
ssize_t send_handle (const ACE_HANDLE handle) const;
+
/// Recv an open FD from another process.
ssize_t recv_handle (ACE_HANDLE &handles,
char *pbuf = 0,
ssize_t *len = 0) const;
#endif /* ACE_HAS_MSG */
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
// = Ensure that ACE_LSOCK is an abstract base class
+
/// Default constructor.
ACE_LSOCK (void);
+
/// Initialize based on @a handle.
ACE_LSOCK (ACE_HANDLE handle);
+
/// Get handle.
ACE_HANDLE get_handle (void) const;
+
/// Set handle.
void set_handle (ACE_HANDLE handle);
+
private:
/// An auxiliary handle used to avoid virtual base classes...
ACE_HANDLE aux_handle_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/LSOCK.inl"
#endif /* __ACE_INLINE__ */
+
#endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */
#include /**/ "ace/post.h"
#endif /* ACE_LOCAL_SOCK_H */
diff --git a/dep/ACE_wrappers/ace/LSOCK.inl b/dep/ACE_wrappers/ace/LSOCK.inl
index a1edf9145d6..6bf726ad28c 100644
--- a/dep/ACE_wrappers/ace/LSOCK.inl
+++ b/dep/ACE_wrappers/ace/LSOCK.inl
@@ -1,33 +1,43 @@
// -*- C++ -*-
//
// $Id: LSOCK.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Simple-minded constructor.
+
ACE_INLINE
ACE_LSOCK::ACE_LSOCK (void)
: aux_handle_ (ACE_INVALID_HANDLE)
{
ACE_TRACE ("ACE_LSOCK::ACE_LSOCK");
}
+
// Sets the underlying file descriptor.
+
ACE_INLINE void
ACE_LSOCK::set_handle (ACE_HANDLE handle)
{
ACE_TRACE ("ACE_LSOCK::set_handle");
this->aux_handle_ = handle;
}
+
// Gets the underlying file descriptor.
+
ACE_INLINE ACE_HANDLE
ACE_LSOCK::get_handle (void) const
{
ACE_TRACE ("ACE_LSOCK::get_handle");
return this->aux_handle_;
}
+
// Sets the underlying file descriptor.
+
ACE_INLINE
ACE_LSOCK::ACE_LSOCK (ACE_HANDLE handle)
: aux_handle_ (handle)
{
ACE_TRACE ("ACE_LSOCK::ACE_LSOCK");
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/LSOCK_Acceptor.cpp b/dep/ACE_wrappers/ace/LSOCK_Acceptor.cpp
index dcde5ae0fe9..ece671beae3 100644
--- a/dep/ACE_wrappers/ace/LSOCK_Acceptor.cpp
+++ b/dep/ACE_wrappers/ace/LSOCK_Acceptor.cpp
@@ -1,36 +1,52 @@
// $Id: LSOCK_Acceptor.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/LSOCK_Acceptor.h"
+
#if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS)
+
#include "ace/Log_Msg.h"
#include "ace/OS_NS_unistd.h"
#include "ace/OS_NS_sys_socket.h"
+
ACE_RCSID(ace, LSOCK_Acceptor, "$Id: LSOCK_Acceptor.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_LSOCK_Acceptor)
+
// Return the local endpoint address.
+
int
ACE_LSOCK_Acceptor::get_local_addr (ACE_Addr &a) const
{
ACE_TRACE ("ACE_LSOCK_Acceptor::get_local_addr");
+
ACE_UNIX_Addr& target = dynamic_cast<ACE_UNIX_Addr &> (a);
+
target = this->local_addr_;
+
return 0;
}
+
void
ACE_LSOCK_Acceptor::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_LSOCK_Acceptor::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
this->local_addr_.dump ();
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
// Do nothing routine for constructor.
+
ACE_LSOCK_Acceptor::ACE_LSOCK_Acceptor (void)
{
ACE_TRACE ("ACE_LSOCK_Acceptor::ACE_LSOCK_Acceptor");
}
+
int
ACE_LSOCK_Acceptor::open (const ACE_Addr &remote_sap,
int reuse_addr,
@@ -43,7 +59,9 @@ ACE_LSOCK_Acceptor::open (const ACE_Addr &remote_sap,
return ACE_SOCK_Acceptor::open (remote_sap, reuse_addr,
protocol_family, backlog, protocol);
}
+
// General purpose routine for performing server ACE_SOCK creation.
+
ACE_LSOCK_Acceptor::ACE_LSOCK_Acceptor (const ACE_Addr &remote_sap,
int reuse_addr,
int protocol_family,
@@ -59,7 +77,9 @@ ACE_LSOCK_Acceptor::ACE_LSOCK_Acceptor (const ACE_Addr &remote_sap,
ACE_ERROR ((LM_ERROR,
"ACE_LSOCK_Acceptor::ACE_LSOCK_Acceptor"));
}
+
// General purpose routine for accepting new connections.
+
int
ACE_LSOCK_Acceptor::accept (ACE_LSOCK_Stream &new_stream,
ACE_Addr *remote_addr,
@@ -68,6 +88,7 @@ ACE_LSOCK_Acceptor::accept (ACE_LSOCK_Stream &new_stream,
int reset_new_handle) const
{
ACE_TRACE ("ACE_LSOCK_Acceptor::accept");
+
int in_blocking_mode = 0;
if (this->shared_accept_start (timeout,
restart,
@@ -77,11 +98,13 @@ ACE_LSOCK_Acceptor::accept (ACE_LSOCK_Stream &new_stream,
{
sockaddr *addr = 0;
int len = 0;
+
if (remote_addr != 0)
{
len = remote_addr->get_size ();
addr = (sockaddr *) remote_addr->get_addr ();
}
+
do
new_stream.set_handle (ACE_OS::accept (this->get_handle (),
addr,
@@ -90,18 +113,22 @@ ACE_LSOCK_Acceptor::accept (ACE_LSOCK_Stream &new_stream,
&& restart != 0
&& errno == EINTR
&& timeout == 0);
+
// Reset the size of the addr, which is only necessary for UNIX
// domain sockets.
if (new_stream.get_handle () != ACE_INVALID_HANDLE
&& remote_addr != 0)
remote_addr->set_size (len);
}
+
return this->shared_accept_finish (new_stream,
in_blocking_mode,
reset_new_handle);
}
+
// Close down the UNIX domain stream and remove the rendezvous point
// from the file system.
+
int
ACE_LSOCK_Acceptor::remove (void)
{
@@ -110,6 +137,8 @@ ACE_LSOCK_Acceptor::remove (void)
return ACE_OS::unlink (this->local_addr_.get_path_name ()) == -1
|| result == -1 ? -1 : 0;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */
diff --git a/dep/ACE_wrappers/ace/LSOCK_Acceptor.h b/dep/ACE_wrappers/ace/LSOCK_Acceptor.h
index a2411a693af..1168c389ab6 100644
--- a/dep/ACE_wrappers/ace/LSOCK_Acceptor.h
+++ b/dep/ACE_wrappers/ace/LSOCK_Acceptor.h
@@ -1,4 +1,5 @@
/* -*- C++ -*- */
+
//=============================================================================
/**
* @file LSOCK_Acceptor.h
@@ -9,20 +10,28 @@
*/
//=============================================================================
+
#ifndef ACE_LOCAL_SOCK_ACCEPTOR_H
#define ACE_LOCAL_SOCK_ACCEPTOR_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS)
+
#include "ace/SOCK_Acceptor.h"
#include "ace/UNIX_Addr.h"
#include "ace/LSOCK_Stream.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward decl.
class ACE_Reactor;
+
/**
* @class ACE_LSOCK_Acceptor
*
@@ -35,41 +44,52 @@ public:
// = Initialization methods.
/// Default constructor.
ACE_LSOCK_Acceptor (void);
+
/// Initiate a passive mode socket.
ACE_LSOCK_Acceptor (const ACE_Addr &local_sap,
int reuse_addr = 0,
int protocol_family = PF_UNIX,
int backlog = ACE_DEFAULT_BACKLOG,
int protocol = 0);
+
/// Initiate a passive mode socket.
int open (const ACE_Addr &local_sap,
int reuse_addr = 0,
int protocol_family = PF_UNIX,
int backlog = ACE_DEFAULT_BACKLOG,
int protocol = 0);
+
/// Accept a new data transfer connection.
int accept (ACE_LSOCK_Stream &new_ipc_sap,
ACE_Addr * = 0,
ACE_Time_Value *timeout = 0,
int restart = 1,
int reset_new_handle = 0) const;
+
/// Close down the ACE_LSOCK and remove the rendezvous point from the
/// file system.
int remove (void);
+
/// Return the local endpoint address.
int get_local_addr (ACE_Addr &) const;
+
// = Meta-type info
typedef ACE_UNIX_Addr PEER_ADDR;
typedef ACE_LSOCK_Stream PEER_STREAM;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Address of our rendezvous point.
ACE_UNIX_Addr local_addr_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */
#include /**/ "ace/post.h"
#endif /* ACE_LOCAL_SOCK_ACCEPTOR_H */
diff --git a/dep/ACE_wrappers/ace/LSOCK_CODgram.cpp b/dep/ACE_wrappers/ace/LSOCK_CODgram.cpp
index 950bf1fa08c..9f2b23574be 100644
--- a/dep/ACE_wrappers/ace/LSOCK_CODgram.cpp
+++ b/dep/ACE_wrappers/ace/LSOCK_CODgram.cpp
@@ -1,25 +1,35 @@
// $Id: LSOCK_CODgram.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/LSOCK_CODgram.h"
#if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS)
+
#include "ace/Log_Msg.h"
+
ACE_RCSID(ace, LSOCK_CODgram, "$Id: LSOCK_CODgram.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if !defined (__ACE_INLINE__)
#include "ace/LSOCK_CODgram.inl"
#endif /* __ACE_INLINE__ */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_LSOCK_CODgram)
+
void
ACE_LSOCK_CODgram::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_LSOCK_CODgram::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACE_SOCK_CODgram::dump ();
ACE_LSOCK::dump ();
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
/* Here's the general-purpose open routine. */
+
int
ACE_LSOCK_CODgram::open (const ACE_Addr &remote,
const ACE_Addr &local,
@@ -33,7 +43,9 @@ ACE_LSOCK_CODgram::open (const ACE_Addr &remote,
ACE_LSOCK::set_handle (this->get_handle ());
return 0;
}
+
/* Create a local ACE_SOCK datagram. */
+
ACE_LSOCK_CODgram::ACE_LSOCK_CODgram (const ACE_Addr &remote,
const ACE_Addr &local,
int protocol_family,
@@ -44,6 +56,8 @@ ACE_LSOCK_CODgram::ACE_LSOCK_CODgram (const ACE_Addr &remote,
protocol) == -1)
ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ACE_LSOCK_CODgram")));
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */
diff --git a/dep/ACE_wrappers/ace/LSOCK_CODgram.h b/dep/ACE_wrappers/ace/LSOCK_CODgram.h
index d19bf5b773f..1ea5ba00386 100644
--- a/dep/ACE_wrappers/ace/LSOCK_CODgram.h
+++ b/dep/ACE_wrappers/ace/LSOCK_CODgram.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file LSOCK_CODgram.h
@@ -9,18 +10,25 @@
*/
//=============================================================================
+
#ifndef ACE_LOCAL_SOCK_CODGRAM_H
#define ACE_LOCAL_SOCK_CODGRAM_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS)
+
#include "ace/LSOCK.h"
#include "ace/SOCK_CODgram.h"
#include "ace/Addr.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_LSOCK_CODgram
*
@@ -33,29 +41,38 @@ public:
// = Initialization methods.
/// Default constructor.
ACE_LSOCK_CODgram (void);
+
/// Initiate a connected-datagram.
ACE_LSOCK_CODgram (const ACE_Addr &remote_sap,
const ACE_Addr &local_sap = ACE_Addr::sap_any,
int protocol_family = PF_UNIX,
int protocol = 0);
+
/// Initiate a connected-datagram.
int open (const ACE_Addr &remote_sap,
const ACE_Addr &local_sap = ACE_Addr::sap_any,
int protocol_family = PF_UNIX,
int protocol = 0);
+
/// Get underlying handle.
ACE_HANDLE get_handle (void) const;
+
/// Set underlying handle.
void set_handle (ACE_HANDLE);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/LSOCK_CODgram.inl"
#endif /* __ACE_INLINE__ */
+
#endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */
#include /**/ "ace/post.h"
#endif /* ACE_LOCAL_SOCK_CODGRAM_H */
diff --git a/dep/ACE_wrappers/ace/LSOCK_CODgram.inl b/dep/ACE_wrappers/ace/LSOCK_CODgram.inl
index cc8987850d5..02870c65ab6 100644
--- a/dep/ACE_wrappers/ace/LSOCK_CODgram.inl
+++ b/dep/ACE_wrappers/ace/LSOCK_CODgram.inl
@@ -1,13 +1,17 @@
// -*- C++ -*-
//
// $Id: LSOCK_CODgram.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Do nothing constructor.
+
ACE_INLINE
ACE_LSOCK_CODgram::ACE_LSOCK_CODgram (void)
{
ACE_TRACE ("ACE_LSOCK_CODgram::ACE_LSOCK_CODgram");
}
+
ACE_INLINE void
ACE_LSOCK_CODgram::set_handle (ACE_HANDLE h)
{
@@ -15,10 +19,12 @@ ACE_LSOCK_CODgram::set_handle (ACE_HANDLE h)
this->ACE_SOCK_CODgram::set_handle (h);
this->ACE_LSOCK::set_handle (h);
}
+
ACE_INLINE ACE_HANDLE
ACE_LSOCK_CODgram::get_handle (void) const
{
ACE_TRACE ("ACE_LSOCK_CODgram::get_handle");
return this->ACE_SOCK_CODgram::get_handle ();
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/LSOCK_Connector.cpp b/dep/ACE_wrappers/ace/LSOCK_Connector.cpp
index 251c2d193ad..efb2063320e 100644
--- a/dep/ACE_wrappers/ace/LSOCK_Connector.cpp
+++ b/dep/ACE_wrappers/ace/LSOCK_Connector.cpp
@@ -1,27 +1,37 @@
// $Id: LSOCK_Connector.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/LSOCK_Connector.h"
#if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS)
+
#include "ace/Log_Msg.h"
+
ACE_RCSID(ace, LSOCK_Connector, "$Id: LSOCK_Connector.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if !defined (__ACE_INLINE__)
#include "ace/LSOCK_Connector.inl"
#endif /* __ACE_INLINE__ */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_LSOCK_Connector)
+
void
ACE_LSOCK_Connector::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_LSOCK_Connector::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n")));
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
ACE_LSOCK_Connector::ACE_LSOCK_Connector (void)
{
ACE_TRACE ("ACE_LSOCK_Connector::ACE_LSOCK_Connector");
}
+
// Establish a connection.
ACE_LSOCK_Connector::ACE_LSOCK_Connector (ACE_LSOCK_Stream &new_stream,
const ACE_UNIX_Addr &remote_sap,
@@ -43,6 +53,8 @@ ACE_LSOCK_Connector::ACE_LSOCK_Connector (ACE_LSOCK_Stream &new_stream,
// ACE_LSOCK_Stream.
new_stream.set_handle (new_stream.get_handle ());
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */
diff --git a/dep/ACE_wrappers/ace/LSOCK_Connector.h b/dep/ACE_wrappers/ace/LSOCK_Connector.h
index 0caf924c587..84946d63a66 100644
--- a/dep/ACE_wrappers/ace/LSOCK_Connector.h
+++ b/dep/ACE_wrappers/ace/LSOCK_Connector.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file LSOCK_Connector.h
@@ -8,18 +9,25 @@
* @author Doug Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_LOCAL_SOCK_CONNECTOR_H
#define ACE_LOCAL_SOCK_CONNECTOR_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS)
+
#include "ace/SOCK_Connector.h"
#include "ace/LSOCK_Stream.h"
#include "ace/UNIX_Addr.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_LSOCK_Connector
*
@@ -32,6 +40,7 @@ public:
// = Initialization methods.
/// Default constructor.
ACE_LSOCK_Connector (void);
+
/**
* Actively connect and produce a @a new_stream if things go well.
* All arguments are relayed to the ACE_SOCK_Connector constructor
@@ -45,6 +54,7 @@ public:
int reuse_addr = 0,
int flags = 0,
int perms = 0);
+
/**
* Actively connect and produce a @a new_stream if things go well.
* The @c ACE_SOCK_Connector::connect() method is called to perform
@@ -58,18 +68,24 @@ public:
int reuse_addr = 0,
int flags = 0,
int perms = 0);
+
// = Meta-type info
typedef ACE_UNIX_Addr PEER_ADDR;
typedef ACE_LSOCK_Stream PEER_STREAM;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/LSOCK_Connector.inl"
#endif /* __ACE_INLINE__ */
+
#endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */
#include /**/ "ace/post.h"
#endif /* ACE_LOCAL_SOCK_CONNECTOR_H */
diff --git a/dep/ACE_wrappers/ace/LSOCK_Connector.inl b/dep/ACE_wrappers/ace/LSOCK_Connector.inl
index 2f6082cabf8..31e79c9690a 100644
--- a/dep/ACE_wrappers/ace/LSOCK_Connector.inl
+++ b/dep/ACE_wrappers/ace/LSOCK_Connector.inl
@@ -1,7 +1,9 @@
// -*- C++ -*-
//
// $Id: LSOCK_Connector.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Establish a connection.
ACE_INLINE int
ACE_LSOCK_Connector::connect (ACE_LSOCK_Stream &new_stream,
@@ -21,4 +23,5 @@ ACE_LSOCK_Connector::connect (ACE_LSOCK_Stream &new_stream,
new_stream.set_handle (new_stream.get_handle ());
return result;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/LSOCK_Dgram.cpp b/dep/ACE_wrappers/ace/LSOCK_Dgram.cpp
index 2c7e9c80f4a..5cb18a611a4 100644
--- a/dep/ACE_wrappers/ace/LSOCK_Dgram.cpp
+++ b/dep/ACE_wrappers/ace/LSOCK_Dgram.cpp
@@ -1,30 +1,42 @@
// $Id: LSOCK_Dgram.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/LSOCK_Dgram.h"
#if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS)
+
#include "ace/Log_Msg.h"
+
ACE_RCSID(ace, LSOCK_Dgram, "$Id: LSOCK_Dgram.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if !defined (__ACE_INLINE__)
#include "ace/LSOCK_Dgram.inl"
#endif /* __ACE_INLINE__ */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_LSOCK_Dgram)
+
void
ACE_LSOCK_Dgram::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_LSOCK_Dgram::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACE_SOCK_Dgram::dump ();
ACE_LSOCK::dump ();
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
// The "do nothing" constructor.
+
ACE_LSOCK_Dgram::ACE_LSOCK_Dgram (void)
{
ACE_TRACE ("ACE_LSOCK_Dgram::ACE_LSOCK_Dgram");
}
+
// Here's the general-purpose open routine.
+
int
ACE_LSOCK_Dgram::open (const ACE_Addr &local,
int protocol_family,
@@ -38,7 +50,9 @@ ACE_LSOCK_Dgram::open (const ACE_Addr &local,
ACE_LSOCK::set_handle (this->ACE_SOCK_Dgram::get_handle ());
return 0;
}
+
// Create a local ACE_SOCK datagram.
+
ACE_LSOCK_Dgram::ACE_LSOCK_Dgram (const ACE_Addr &local,
int protocol_family,
int protocol)
@@ -51,6 +65,8 @@ ACE_LSOCK_Dgram::ACE_LSOCK_Dgram (const ACE_Addr &local,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_LSOCK_Dgram")));
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */
diff --git a/dep/ACE_wrappers/ace/LSOCK_Dgram.h b/dep/ACE_wrappers/ace/LSOCK_Dgram.h
index 675f5096419..17fad2b7b43 100644
--- a/dep/ACE_wrappers/ace/LSOCK_Dgram.h
+++ b/dep/ACE_wrappers/ace/LSOCK_Dgram.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file LSOCK_Dgram.h
@@ -9,17 +10,24 @@
*/
//=============================================================================
+
#ifndef ACE_LOCAL_SOCK_DGRAM_H
#define ACE_LOCAL_SOCK_DGRAM_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS)
+
#include "ace/SOCK_Dgram.h"
#include "ace/LSOCK.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_LSOCK_Dgram
*
@@ -31,27 +39,36 @@ public:
// = Initialization methods.
/// Default constructor.
ACE_LSOCK_Dgram (void);
+
/// Initiate a local dgram.
ACE_LSOCK_Dgram (const ACE_Addr &local,
int protocol_family = PF_UNIX,
int protocol = 0);
+
/// Initiate a local dgram.
int open (const ACE_Addr &local,
int protocol_family = PF_UNIX,
int protocol = 0);
+
/// Get handle.
ACE_HANDLE get_handle (void) const;
+
/// Set handle.
void set_handle (ACE_HANDLE);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/LSOCK_Dgram.inl"
#endif /* __ACE_INLINE__ */
+
#endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */
#include /**/ "ace/post.h"
#endif /* ACE_LOCAL_SOCK_DGRAM_H */
diff --git a/dep/ACE_wrappers/ace/LSOCK_Dgram.inl b/dep/ACE_wrappers/ace/LSOCK_Dgram.inl
index feb018be119..3174adf00da 100644
--- a/dep/ACE_wrappers/ace/LSOCK_Dgram.inl
+++ b/dep/ACE_wrappers/ace/LSOCK_Dgram.inl
@@ -1,7 +1,9 @@
// -*- C++ -*-
//
// $Id: LSOCK_Dgram.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE void
ACE_LSOCK_Dgram::set_handle (ACE_HANDLE h)
{
@@ -9,10 +11,12 @@ ACE_LSOCK_Dgram::set_handle (ACE_HANDLE h)
this->ACE_SOCK_Dgram::set_handle (h);
this->ACE_LSOCK::set_handle (h);
}
+
ACE_INLINE ACE_HANDLE
ACE_LSOCK_Dgram::get_handle (void) const
{
ACE_TRACE ("ACE_LSOCK_Dgram::get_handle");
return this->ACE_SOCK_Dgram::get_handle ();
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/LSOCK_Stream.cpp b/dep/ACE_wrappers/ace/LSOCK_Stream.cpp
index 0830745eb03..ab8110c7732 100644
--- a/dep/ACE_wrappers/ace/LSOCK_Stream.cpp
+++ b/dep/ACE_wrappers/ace/LSOCK_Stream.cpp
@@ -1,22 +1,31 @@
// $Id: LSOCK_Stream.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/LSOCK_Stream.h"
#if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS)
+
#include "ace/Log_Msg.h"
#include "ace/OS_NS_sys_socket.h"
+
ACE_RCSID(ace, LSOCK_Stream, "$Id: LSOCK_Stream.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if !defined (__ACE_INLINE__)
#include "ace/LSOCK_Stream.inl"
#endif /* __ACE_INLINE__ */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_LSOCK_Stream)
+
int
ACE_LSOCK_Stream::get_local_addr (ACE_Addr &addr) const
{
ACE_TRACE ("ACE_LSOCK_Stream::get_local_addr");
+
// Perform the downcast since <addr> had better be an
// <ACE_UNIX_Addr>.
ACE_UNIX_Addr *rhs_unix_addr = dynamic_cast<ACE_UNIX_Addr *> (&addr);
ACE_UNIX_Addr lhs_unix_addr;
+
if (rhs_unix_addr == 0)
return -1;
else if (ACE_SOCK::get_local_addr (lhs_unix_addr) == -1)
@@ -27,24 +36,31 @@ ACE_LSOCK_Stream::get_local_addr (ACE_Addr &addr) const
return 0;
}
}
+
int
ACE_LSOCK_Stream::get_remote_addr (ACE_Addr &addr) const
{
ACE_TRACE ("ACE_LSOCK_Stream::get_remote_addr");
+
return this->get_local_addr (addr);
}
+
void
ACE_LSOCK_Stream::dump (void) const
{
ACE_TRACE ("ACE_LSOCK_Stream::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACE_SOCK_Stream::dump ();
ACE_LSOCK::dump ();
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
}
+
#if defined (ACE_HAS_MSG)
+
// Send a readv-style vector of buffers, along with an open I/O
// handle.
+
ssize_t
ACE_LSOCK_Stream::send_msg (const iovec iov[],
size_t n,
@@ -56,10 +72,12 @@ ACE_LSOCK_Stream::send_msg (const iovec iov[],
char cmsgbuf[ACE_BSD_CONTROL_MSG_LEN];
cmsghdr *cmsgptr = (cmsghdr *) cmsgbuf;
#endif /* ACE_HAS_4_4BSD_SENDMSG_RECVMSG */
+
send_msg.msg_iov = const_cast <iovec *> (iov);
send_msg.msg_iovlen = n;
send_msg.msg_name = 0;
send_msg.msg_namelen = 0;
+
#if defined (ACE_HAS_4_4BSD_SENDMSG_RECVMSG)
cmsgptr->cmsg_level = SOL_SOCKET;
cmsgptr->cmsg_type = SCM_RIGHTS;
@@ -72,11 +90,14 @@ ACE_LSOCK_Stream::send_msg (const iovec iov[],
send_msg.msg_accrights = (char *) &handle;
send_msg.msg_accrightslen = sizeof handle;
#endif /* ACE_HAS_4_4BSD_SENDMSG_RECVMSG */
+
return ACE_OS::sendmsg (this->ACE_SOCK_Stream::get_handle (),
&send_msg, 0);
}
+
// Read a readv-style vector of buffers, along with an open I/O
// handle.
+
ssize_t
ACE_LSOCK_Stream::recv_msg (iovec iov[],
size_t n,
@@ -88,10 +109,12 @@ ACE_LSOCK_Stream::recv_msg (iovec iov[],
char cmsgbuf[ACE_BSD_CONTROL_MSG_LEN];
cmsghdr *cmsgptr = (cmsghdr *) cmsgbuf;
#endif /* ACE_HAS_4_4BSD_SENDMSG_RECVMSG */
+
recv_msg.msg_iov = (iovec *) iov;
recv_msg.msg_iovlen = n;
recv_msg.msg_name = 0;
recv_msg.msg_namelen = 0;
+
#if defined (ACE_HAS_4_4BSD_SENDMSG_RECVMSG)
recv_msg.msg_control = cmsgbuf;
recv_msg.msg_controllen = sizeof cmsgbuf;
@@ -102,11 +125,14 @@ ACE_LSOCK_Stream::recv_msg (iovec iov[],
#else
recv_msg.msg_accrights = (char *) &handle;
recv_msg.msg_accrightslen = sizeof handle;
+
return ACE_OS::recvmsg (this->ACE_SOCK_Stream::get_handle (),
&recv_msg, 0);
#endif /* ACE_HAS_4_4BSD_SENDMSG_RECVMSG */
}
#endif /* ACE_HAS_MSG */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */
diff --git a/dep/ACE_wrappers/ace/LSOCK_Stream.h b/dep/ACE_wrappers/ace/LSOCK_Stream.h
index 43e3de762ea..e95641ba725 100644
--- a/dep/ACE_wrappers/ace/LSOCK_Stream.h
+++ b/dep/ACE_wrappers/ace/LSOCK_Stream.h
@@ -1,4 +1,5 @@
/* -*- C++ -*- */
+
//=============================================================================
/**
* @file LSOCK_Stream.h
@@ -9,18 +10,25 @@
*/
//=============================================================================
+
#ifndef ACE_LOCAL_SOCK_STREAM_H
#define ACE_LOCAL_SOCK_STREAM_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS)
+
#include "ace/SOCK_Stream.h"
#include "ace/UNIX_Addr.h"
#include "ace/LSOCK.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_LSOCK_Stream
*
@@ -34,30 +42,41 @@ public:
ssize_t send_msg (const iovec iov[],
size_t n,
ACE_HANDLE handle);
+
/// Send iovecs via <::writev>.
ssize_t recv_msg (iovec iov[],
size_t n,
ACE_HANDLE &handle);
+
/// Get handle.
ACE_HANDLE get_handle (void) const;
+
/// Overrides set_handle from the base classes.
void set_handle (ACE_HANDLE fd);
+
// = Meta-type info
typedef ACE_UNIX_Addr PEER_ADDR;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
/// This method simply returns the "local" addr.
int get_local_addr (ACE_Addr &) const;
+
/// This method returns the "local" addr since it's the same value
/// for UNIX domain sockets.
int get_remote_addr (ACE_Addr &) const;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/LSOCK_Stream.inl"
#endif /* __ACE_INLINE__ */
+
#endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */
#include /**/ "ace/post.h"
#endif /* ACE_LOCAL_SOCK_STREAM_H */
diff --git a/dep/ACE_wrappers/ace/LSOCK_Stream.inl b/dep/ACE_wrappers/ace/LSOCK_Stream.inl
index 68c1209b6b3..0d9421115f2 100644
--- a/dep/ACE_wrappers/ace/LSOCK_Stream.inl
+++ b/dep/ACE_wrappers/ace/LSOCK_Stream.inl
@@ -1,9 +1,12 @@
// -*- C++ -*-
//
// $Id: LSOCK_Stream.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Sets both the file descriptors... Overrides handle from the base
// classes.
+
ACE_INLINE void
ACE_LSOCK_Stream::set_handle (ACE_HANDLE fd)
{
@@ -11,10 +14,12 @@ ACE_LSOCK_Stream::set_handle (ACE_HANDLE fd)
this->ACE_SOCK_Stream::set_handle (fd);
this->ACE_LSOCK::set_handle (fd);
}
+
ACE_INLINE ACE_HANDLE
ACE_LSOCK_Stream::get_handle (void) const
{
ACE_TRACE ("ACE_LSOCK_Stream::get_handle");
return this->ACE_SOCK_Stream::get_handle ();
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Lib_Find.cpp b/dep/ACE_wrappers/ace/Lib_Find.cpp
index 729b43a8c93..3654751bb58 100644
--- a/dep/ACE_wrappers/ace/Lib_Find.cpp
+++ b/dep/ACE_wrappers/ace/Lib_Find.cpp
@@ -1,4 +1,5 @@
// $Id: Lib_Find.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Lib_Find.h"
#include "ace/Log_Msg.h"
#include "ace/OS_NS_string.h"
@@ -8,18 +9,23 @@
#include "ace/OS_NS_stdlib.h"
#include "ace/OS_Memory.h"
#include "ace/OS_NS_fcntl.h"
+
#if defined (ACE_WIN32)
# include "ace/OS_NS_strings.h"
#endif /* ACE_WIN32 */
+
#if defined (ACE_OPENVMS)
#include "ace/RB_Tree.h"
#include "ace/Thread_Mutex.h"
#include "ace/Singleton.h"
+
#include /**/ "descrip.h"
#include /**/ "chfdef.h"
#include /**/ "stsdef.h"
#include /**/ "libdef.h"
+
extern "C" int LIB$FIND_IMAGE_SYMBOL(...);
+
class ACE_LD_Symbol_Registry
{
// @internal
@@ -44,17 +50,23 @@ class ACE_LD_Symbol_Registry
// - first try directly from DLL using the RTL dlsym() function and if that fails;
// - try to find symbol in singleton registry.
public:
+
typedef ACE_RB_Tree<const ACE_TCHAR*,
void*,
ACE_Less_Than<const ACE_TCHAR*>,
ACE_Thread_Mutex>
TREE;
+
void register_symbol (const ACE_TCHAR* symname, void* symaddr);
+
void* find_symbol (const ACE_TCHAR* symname);
+
ACE_LD_Symbol_Registry () {}
private:
+
TREE symbol_registry_;
};
+
void
ACE_LD_Symbol_Registry::register_symbol (const ACE_TCHAR* symname,
void* symaddr)
@@ -73,26 +85,34 @@ ACE_LD_Symbol_Registry::register_symbol (const ACE_TCHAR* symname,
ACE_TEXT_ALWAYS_CHAR (symname)));
}
}
+
void*
ACE_LD_Symbol_Registry::find_symbol (const ACE_TCHAR* symname)
{
void* symaddr = 0;
int const result = symbol_registry_.find (symname, symaddr);
+
return (result == 0 ? symaddr : 0);
}
+
/// Declare a process wide singleton
ACE_SINGLETON_DECLARE (ACE_Singleton,
ACE_LD_Symbol_Registry,
ACE_Thread_Mutex)
+
typedef ACE_Singleton<ACE_LD_Symbol_Registry, ACE_Thread_Mutex>
ACE_LD_SYMBOL_REGISTRY;
+
#if defined (ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION)
template ACE_Singleton<ACE_LD_Symbol_Registry, ACE_Thread_Mutex> *
ACE_Singleton<ACE_LD_Symbol_Registry, ACE_Thread_Mutex>::singleton_;
#endif /* ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION */
#endif
+
ACE_RCSID(ace, Lib_Find, "$Id: Lib_Find.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
int
ACE::ldfind (const ACE_TCHAR* filename,
ACE_TCHAR pathname[],
@@ -105,17 +125,20 @@ ACE::ldfind (const ACE_TCHAR* filename,
errno = ENOMEM;
return -1;
}
+
dsc$descriptor nameDsc;
nameDsc.dsc$b_class = DSC$K_CLASS_S;
nameDsc.dsc$b_dtype = DSC$K_DTYPE_T;
nameDsc.dsc$w_length = ACE_OS::strlen(filename);
nameDsc.dsc$a_pointer = (char*)filename;
+
char symbol[] = "NULL";
dsc$descriptor symbolDsc;
symbolDsc.dsc$b_class = DSC$K_CLASS_S;
symbolDsc.dsc$b_dtype = DSC$K_DTYPE_T;
symbolDsc.dsc$w_length = ACE_OS::strlen(symbol);
symbolDsc.dsc$a_pointer = symbol;
+
int symbolValue;
int result;
try
@@ -126,6 +149,7 @@ ACE::ldfind (const ACE_TCHAR* filename,
{
result = sig.chf$l_sig_name;
}
+
int severity = result & STS$M_SEVERITY;
int conditionId = result & STS$M_COND_ID;
if (severity == STS$K_SUCCESS || severity == STS$K_WARNING || severity == STS$K_INFO ||
@@ -134,12 +158,14 @@ ACE::ldfind (const ACE_TCHAR* filename,
ACE_OS::strcpy(pathname, filename);
return 0;
}
+
if (ACE_OS::strlen(filename) + ACE_OS::strlen(ACE_DLL_PREFIX) >= maxpathnamelen)
{
errno = ENOMEM;
return -1;
}
+
ACE_OS::strcpy(pathname, ACE_DLL_PREFIX);
ACE_OS::strcat(pathname, filename);
nameDsc.dsc$w_length = ACE_OS::strlen(pathname);
@@ -152,6 +178,7 @@ ACE::ldfind (const ACE_TCHAR* filename,
{
result = sig.chf$l_sig_name;
}
+
severity = result & STS$M_SEVERITY;
conditionId = result & STS$M_COND_ID;
if (severity == STS$K_SUCCESS || severity == STS$K_WARNING || severity == STS$K_INFO ||
@@ -162,6 +189,7 @@ ACE::ldfind (const ACE_TCHAR* filename,
errno = ENOENT;
return -1;
#endif /* ACE_OPENVMS */
+
#if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE) && \
!defined (ACE_HAS_PHARLAP)
ACE_TCHAR expanded_filename[MAXPATHLEN];
@@ -171,6 +199,7 @@ ACE::ldfind (const ACE_TCHAR* filename,
/ sizeof (ACE_TCHAR)))
filename = expanded_filename;
#endif /* ACE_WIN32 && !ACE_HAS_WINCE && !ACE_HAS_PHARLAP */
+
ACE_TCHAR tempcopy[MAXPATHLEN + 1];
ACE_TCHAR searchpathname[MAXPATHLEN + 1];
#if defined (ACE_WIN32) && defined (ACE_LD_DECORATOR_STR) && !defined (ACE_DISABLE_DEBUG_DLL_CHECK)
@@ -179,6 +208,7 @@ ACE::ldfind (const ACE_TCHAR* filename,
#else
ACE_TCHAR searchfilename[MAXPATHLEN + 1];
#endif /* ACE_WIN32 && ACE_LD_DECORATOR_STR && !ACE_DISABLE_DEBUG_DLL_CHECK */
+
// Create a copy of filename to work with.
if (ACE_OS::strlen (filename) + 1
> (sizeof tempcopy / sizeof (ACE_TCHAR)))
@@ -188,15 +218,19 @@ ACE::ldfind (const ACE_TCHAR* filename,
}
else
ACE_OS::strcpy (tempcopy, filename);
+
// Insert canonical directory separators.
ACE_TCHAR *separator_ptr;
+
#if (ACE_DIRECTORY_SEPARATOR_CHAR != '/')
// Make all the directory separators "canonical" to simplify
// subsequent code.
ACE::strrepl (tempcopy, ACE_DIRECTORY_SEPARATOR_CHAR, '/');
#endif /* ACE_DIRECTORY_SEPARATOR_CHAR */
+
// Separate filename from pathname.
separator_ptr = ACE_OS::strrchr (tempcopy, '/');
+
// This is a relative path.
if (separator_ptr == 0)
{
@@ -209,15 +243,20 @@ ACE::ldfind (const ACE_TCHAR* filename,
separator_ptr[1] = '\0';
ACE_OS::strcpy (searchpathname, tempcopy);
}
+
bool has_suffix = false;
+
// Check to see if this has an appropriate DLL suffix for the OS
// platform.
ACE_TCHAR *s = ACE_OS::strrchr (searchfilename, '.');
+
const ACE_TCHAR *dll_suffix = ACE_DLL_SUFFIX;
+
if (s != 0)
{
// If we have a dot, we have a suffix
has_suffix = true;
+
// Check whether this matches the appropriate platform-specific
// suffix.
#if defined (ACE_WIN32)
@@ -234,6 +273,7 @@ ACE::ldfind (const ACE_TCHAR* filename,
s));
}
}
+
// Make sure we've got enough space in searchfilename.
if (ACE_OS::strlen (searchfilename)
+ ACE_OS::strlen (ACE_DLL_PREFIX)
@@ -243,15 +283,18 @@ ACE::ldfind (const ACE_TCHAR* filename,
errno = ENOMEM;
return -1;
}
+
#if defined (ACE_WIN32) && defined (ACE_LD_DECORATOR_STR) && !defined (ACE_DISABLE_DEBUG_DLL_CHECK)
size_t len_searchfilename = ACE_OS::strlen (searchfilename);
if (! has_suffix)
ACE_OS::strcpy (searchfilename + len_searchfilename,
decorator);
+
for (int tag = 1; tag >= 0; tag --)
{
if (tag == 0)
searchfilename [len_searchfilename] = 0;
+
#endif /* ACE_WIN32 && ACE_LD_DECORATOR_STR && !ACE_DISABLE_DEBUG_DLL_CHECK */
// Use absolute pathname if there is one.
if (ACE_OS::strlen (searchpathname) > 0)
@@ -279,6 +322,7 @@ ACE::ldfind (const ACE_TCHAR* filename,
has_suffix ? ACE_TEXT ("") : 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,
ACE_TEXT ("%s%s%s%s"),
@@ -290,6 +334,7 @@ ACE::ldfind (const ACE_TCHAR* filename,
return 0;
}
}
+
// Use relative filenames via LD_LIBRARY_PATH or PATH (depending on
// OS platform).
else
@@ -310,6 +355,7 @@ ACE::ldfind (const ACE_TCHAR* filename,
}
else if (pathlen > 0)
return 0;
+
// In case not found we should try again with the ACE_DLL_PREFIX
// prefixed
ACE_OS::strcpy (searchfilename, ACE_DLL_PREFIX);
@@ -343,6 +389,7 @@ ACE::ldfind (const ACE_TCHAR* filename,
ld_path = wide_ldpath.wchar_rep ();
# endif /* ACE_WIN32 || !ACE_USES_WCHAR */
# endif /* ACE_DEFAULT_LD_SEARCH_PATH */
+
#if defined (ACE_HAS_WINCE)
ACE_TCHAR *ld_path_temp = 0;
if (ld_path != 0)
@@ -354,6 +401,7 @@ ACE::ldfind (const ACE_TCHAR* filename,
{
ACE_OS::strcpy (ld_path_temp,
ACE_LD_SEARCH_PATH_SEPARATOR_STR);
+
ACE_OS::strcat (ld_path_temp, ld_path);
ld_path = ld_path_temp;
}
@@ -364,6 +412,7 @@ ACE::ldfind (const ACE_TCHAR* filename,
}
}
#endif /* ACE_HAS_WINCE */
+
if (ld_path != 0
&& (ld_path = ACE_OS::strdup (ld_path)) != 0)
{
@@ -374,17 +423,21 @@ ACE::ldfind (const ACE_TCHAR* filename,
// third iteration would be "/bar". However, this is not
// the case; one only gets two iterations: "/foo" followed
// by "/bar".
+
// This is especially a problem in parsing Unix paths
// because it is permissible to specify 'the current
// directory' as an empty entry. So, we introduce the
// following special code to cope with this:
+
// Look at each dynamic lib directory in the search path.
+
ACE_TCHAR *nextholder = 0;
const ACE_TCHAR *path_entry =
ACE::strsplit_r (ld_path,
ACE_LD_SEARCH_PATH_SEPARATOR_STR,
nextholder);
int result = 0;
+
for (;;)
{
// Check if at end of search path.
@@ -409,6 +462,7 @@ ACE::ldfind (const ACE_TCHAR* filename,
// that the loop condition will still work.
else if (path_entry[0] == '\0')
path_entry = ACE_TEXT (".");
+
// First, try matching the filename *without* adding a
// prefix.
ACE_OS::sprintf (pathname,
@@ -419,6 +473,7 @@ ACE::ldfind (const ACE_TCHAR* filename,
has_suffix ? ACE_TEXT ("") : dll_suffix);
if (ACE_OS::access (pathname, F_OK) == 0)
break;
+
// Second, try matching the filename *with* adding a
// prefix.
ACE_OS::sprintf (pathname,
@@ -430,12 +485,14 @@ ACE::ldfind (const ACE_TCHAR* filename,
has_suffix ? ACE_TEXT ("") : dll_suffix);
if (ACE_OS::access (pathname, F_OK) == 0)
break;
+
// Fetch the next item in the path
path_entry =
ACE::strsplit_r (0,
ACE_LD_SEARCH_PATH_SEPARATOR_STR,
nextholder);
}
+
#if defined (ACE_HAS_WINCE)
if (ld_path_temp != 0)
ACE_OS::free (ld_path_temp);
@@ -452,14 +509,17 @@ ACE::ldfind (const ACE_TCHAR* filename,
#if defined (ACE_WIN32) && defined (ACE_LD_DECORATOR_STR) && !defined (ACE_DISABLE_DEBUG_DLL_CHECK)
}
#endif /* ACE_WIN32 && ACE_LD_DECORATOR_STR && !ACE_DISABLE_DEBUG_DLL_CHECK */
+
errno = ENOENT;
return -1;
}
+
FILE *
ACE::ldopen (const ACE_TCHAR *filename,
const ACE_TCHAR *type)
{
ACE_TRACE ("ACE::ldopen");
+
ACE_TCHAR buf[MAXPATHLEN + 1];
if (ACE::ldfind (filename,
buf,
@@ -468,34 +528,42 @@ ACE::ldopen (const ACE_TCHAR *filename,
else
return ACE_OS::fopen (buf, type);
}
+
ACE_TCHAR *
ACE::ldname (const ACE_TCHAR *entry_point)
{
ACE_TRACE ("ACE::ldname");
+
#if defined(ACE_NEEDS_DL_UNDERSCORE)
size_t size =
1 // leading '_'
+ ACE_OS::strlen (entry_point)
+ 1;
+
ACE_TCHAR *new_name;
ACE_NEW_RETURN (new_name,
ACE_TCHAR[size],
0);
+
ACE_OS::strcpy (new_name, ACE_TEXT ("_"));
ACE_OS::strcat (new_name, entry_point);
+
return new_name;
#else /* ACE_NEEDS_DL_UNDERSCORE */
size_t size =
ACE_OS::strlen (entry_point)
+ 1;
+
ACE_TCHAR *new_name;
ACE_NEW_RETURN (new_name,
ACE_TCHAR[size],
0);
+
ACE_OS::strcpy (new_name, entry_point);
return new_name;
#endif /* ACE_NEEDS_DL_UNDERSCORE */
}
+
#if defined (ACE_OPENVMS)
void
ACE::ldregister (const ACE_TCHAR *entry_point,
@@ -504,6 +572,7 @@ ACE::ldregister (const ACE_TCHAR *entry_point,
ACE_LD_SYMBOL_REGISTRY::instance ()->register_symbol (entry_point,
entry_addr);
}
+
void *
ACE::ldsymbol (ACE_SHLIB_HANDLE sh, const ACE_TCHAR *entry_point)
{
@@ -511,9 +580,11 @@ ACE::ldsymbol (ACE_SHLIB_HANDLE sh, const ACE_TCHAR *entry_point)
// if not found through dlsym() try registry
if (symaddr == 0)
symaddr = ACE_LD_SYMBOL_REGISTRY::instance ()->find_symbol (entry_point);
+
return symaddr;
}
#endif
+
int
ACE::get_temp_dir (ACE_TCHAR *buffer, size_t buffer_len)
{
@@ -521,20 +592,27 @@ ACE::get_temp_dir (ACE_TCHAR *buffer, size_t buffer_len)
#if defined (ACE_WIN32)
result = ACE_TEXT_GetTempPath (static_cast<DWORD> (buffer_len),
buffer);
+
// Make sure to return -1 if there is an error
if (result == 0 && ::GetLastError () != ERROR_SUCCESS
|| result > static_cast<int> (buffer_len))
result = -1;
+
#else /* ACE_WIN32 */
+
// NOTE! Non-Windows platforms don't deal with wide chars for env.
// variables, so do this narrow-char and convert to wide for the
// caller if necessary.
+
// On non-win32 platforms, check to see what the TMPDIR environment
// variable is defined to be. If it doesn't exist, just use /tmp
const char *tmpdir = ACE_OS::getenv ("TMPDIR");
+
if (tmpdir == 0)
tmpdir = "/tmp";
+
size_t len = ACE_OS::strlen (tmpdir);
+
// Check to see if the buffer is large enough for the string,
// another /, and its null character (hence the + 2)
if ((len + 2) > buffer_len)
@@ -544,6 +622,7 @@ ACE::get_temp_dir (ACE_TCHAR *buffer, size_t buffer_len)
else
{
ACE_OS::strcpy (buffer, ACE_TEXT_CHAR_TO_TCHAR (tmpdir));
+
// Add a trailing slash because we cannot assume there is already one
// at the end. And having an extra one should not cause problems.
buffer[len] = ACE_TEXT ('/');
@@ -553,6 +632,7 @@ ACE::get_temp_dir (ACE_TCHAR *buffer, size_t buffer_len)
#endif /* ACE_WIN32 */
return result;
}
+
ACE_HANDLE
ACE::open_temp_file (const ACE_TCHAR *name, int mode, int perm)
{
@@ -567,8 +647,10 @@ ACE::open_temp_file (const ACE_TCHAR *name, int mode, int perm)
// Open it.
ACE_HANDLE handle = ACE_OS::open (name, mode, perm);
#endif /* ACE_WIN32 */
+
if (handle == ACE_INVALID_HANDLE)
return ACE_INVALID_HANDLE;
+
// Unlink it so that the file will be removed automatically when the
// process goes away.
if (ACE_OS::unlink (name) == -1)
@@ -577,37 +659,47 @@ ACE::open_temp_file (const ACE_TCHAR *name, int mode, int perm)
// Return the handle.
return handle;
}
+
size_t
ACE::strrepl (char *s, char search, char replace)
{
ACE_TRACE ("ACE::strrepl");
+
size_t replaced = 0;
+
for (size_t i = 0; s[i] != '\0'; i++)
if (s[i] == search)
{
s[i] = replace;
++replaced;
}
+
return replaced;
}
+
// Split a string up into 'token'-delimited pieces, ala Perl's
// "split".
+
char *
ACE::strsplit_r (char *str,
const char *token,
char *&next_start)
{
char *result = 0;
+
if (str != 0)
next_start = str;
+
if (next_start != 0)
{
char *tok_loc = ACE_OS::strstr (next_start, token);
+
if (tok_loc != 0)
{
// Return the beginning of the string.
result = next_start;
+
// Insure it's terminated.
*tok_loc = '\0';
next_start = tok_loc + ACE_OS::strlen (token);
@@ -618,8 +710,10 @@ ACE::strsplit_r (char *str,
next_start = (char *) 0;
}
}
+
return result;
}
+
#if defined (ACE_HAS_WCHAR)
wchar_t *
ACE::strsplit_r (wchar_t *str,
@@ -627,15 +721,19 @@ ACE::strsplit_r (wchar_t *str,
wchar_t *&next_start)
{
wchar_t *result = 0;
+
if (str != 0)
next_start = str;
+
if (next_start != 0)
{
wchar_t *tok_loc = ACE_OS::strstr (next_start, token);
+
if (tok_loc != 0)
{
// Return the beginning of the string.
result = next_start;
+
// Insure it's terminated.
*tok_loc = '\0';
next_start = tok_loc + ACE_OS::strlen (token);
@@ -646,21 +744,27 @@ ACE::strsplit_r (wchar_t *str,
next_start = (wchar_t *) 0;
}
}
+
return result;
}
+
size_t
ACE::strrepl (wchar_t *s, wchar_t search, wchar_t replace)
{
ACE_TRACE ("ACE::strrepl");
+
size_t replaced = 0;
+
for (size_t i = 0; s[i] != '\0'; i++)
if (s[i] == search)
{
s[i] = replace;
++replaced;
}
+
return replaced;
}
#endif /* ACE_HAS_WCHAR */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Lib_Find.h b/dep/ACE_wrappers/ace/Lib_Find.h
index 620f9ce6213..1651eb77f43 100644
--- a/dep/ACE_wrappers/ace/Lib_Find.h
+++ b/dep/ACE_wrappers/ace/Lib_Find.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Lib_Find.h
@@ -9,19 +10,24 @@
* $Id: Lib_Find.h 80826 2008-03-04 14:51:23Z wotte $
*/
//=============================================================================
+
#ifndef ACE_LIB_FIND_H
#define ACE_LIB_FIND_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
#include /**/ "ace/ACE_export.h"
#include "ace/os_include/os_stdio.h"
#if defined (ACE_OPENVMS)
# include "ace/OS_NS_dlfcn.h"
#endif
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE
{
// = Methods for searching and opening shared libraries.
+
/**
* Finds the file @a filename either using an absolute path or using
* a relative path in conjunction with ACE_LD_SEARCH_PATH (e.g.,
@@ -35,6 +41,7 @@ namespace ACE
extern ACE_Export int ldfind (const ACE_TCHAR* filename,
ACE_TCHAR pathname[],
size_t maxpathnamelen);
+
/**
* Uses @c ldfind to locate and open the appropriate @a filename and
* returns a pointer to the file, else it returns a NULL
@@ -42,6 +49,7 @@ namespace ACE
*/
extern ACE_Export FILE *ldopen (const ACE_TCHAR *filename,
const ACE_TCHAR *type);
+
/**
* Transforms @a entry_point into a form that can be located in a
* dynamic library using <dlsym>. For example, with Win32/Borland
@@ -51,6 +59,7 @@ namespace ACE
*/
extern ACE_Export ACE_TCHAR *ldname (const ACE_TCHAR *entry_point);
+
#if defined (ACE_OPENVMS)
/**
* Registers an @a entry_point and its address for later retrieval
@@ -59,6 +68,7 @@ namespace ACE
*/
extern ACE_Export void ldregister (const ACE_TCHAR *entry_point,
void* entry_addr);
+
/**
* Looks up an @a entry_point address either from previously registered
* symbols or through ACE_OS::dlsym ().
@@ -68,17 +78,20 @@ namespace ACE
extern ACE_Export void *ldsymbol (ACE_SHLIB_HANDLE sh,
const ACE_TCHAR *entry_point);
#endif
+
/**
* Returns the temporary directory including the trailing slash in
* @a buffer. Returns -1 for an error or if the buffer_len is not
* long enough.
*/
extern ACE_Export int get_temp_dir (ACE_TCHAR *buffer, size_t buffer_len);
+
/// Opening the temp file. File is automagically unlinked when it is
/// closed. This is useful for have temp files.
extern ACE_Export ACE_HANDLE open_temp_file (const ACE_TCHAR *name,
int mode,
int perm = 0);
+
// @@ Though the following functions dont come under the same category as
// above, these are used only in the functions in this class. So it makes
// more sense to move these functions too to this class.
@@ -86,6 +99,7 @@ namespace ACE
/// Replace all instances of @a search in @a s with @a replace. Returns
/// the number of replacements made.
extern ACE_Export size_t strrepl (char *s, char search, char replace);
+
/**
* Splits string <s> into pieces separated by the string <token>.
* <next_start> is an opaque cookie handed back by the call to store
@@ -96,18 +110,23 @@ namespace ACE
extern ACE_Export char *strsplit_r (char *s,
const char *token,
char *&next_start);
+
#if defined (ACE_HAS_WCHAR)
/// As strrepl, but for wide characters.
extern ACE_Export size_t strrepl (wchar_t *s,
wchar_t search,
wchar_t replace);
+
/// As strsplit_r, but for wide characters.
extern ACE_Export wchar_t *strsplit_r (wchar_t *s,
const wchar_t *token,
wchar_t *&next_start);
#endif /* ACE_HAS_WCHAR */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
#endif /* ACE_LIB_FIND_H */
+
diff --git a/dep/ACE_wrappers/ace/Local_Memory_Pool.cpp b/dep/ACE_wrappers/ace/Local_Memory_Pool.cpp
index c81200794f9..ebec0ad75aa 100644
--- a/dep/ACE_wrappers/ace/Local_Memory_Pool.cpp
+++ b/dep/ACE_wrappers/ace/Local_Memory_Pool.cpp
@@ -1,12 +1,17 @@
// $Id: Local_Memory_Pool.cpp 80826 2008-03-04 14:51:23Z wotte $
+
// Local_Memory_Pool.cpp
#include "ace/Local_Memory_Pool.h"
#include "ace/Auto_Ptr.h"
#include "ace/OS_Memory.h"
#include "ace/Log_Msg.h"
+
ACE_RCSID(ace, Local_Memory_Pool, "$Id: Local_Memory_Pool.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_Local_Memory_Pool)
+
void
ACE_Local_Memory_Pool::dump (void) const
{
@@ -14,16 +19,19 @@ ACE_Local_Memory_Pool::dump (void) const
ACE_TRACE ("ACE_Local_Memory_Pool::dump");
#endif /* ACE_HAS_DUMP */
}
+
ACE_Local_Memory_Pool::ACE_Local_Memory_Pool (const ACE_TCHAR *,
const OPTIONS *)
{
ACE_TRACE ("ACE_Local_Memory_Pool::ACE_Local_Memory_Pool");
}
+
ACE_Local_Memory_Pool::~ACE_Local_Memory_Pool (void)
{
// Free up all memory allocated by this pool.
this->release ();
}
+
// Ask system for initial chunk of local memory.
void *
ACE_Local_Memory_Pool::init_acquire (size_t nbytes,
@@ -34,30 +42,38 @@ ACE_Local_Memory_Pool::init_acquire (size_t nbytes,
// Note that we assume that when ACE_Local_Memory_Pool is used,
// ACE_Malloc's constructor will only get called once. If this
// assumption doesn't hold, we are in deep trouble!
+
first_time = 1;
return this->acquire (nbytes, rounded_bytes);
}
+
void *
ACE_Local_Memory_Pool::acquire (size_t nbytes,
size_t &rounded_bytes)
{
ACE_TRACE ("ACE_Local_Memory_Pool::acquire");
rounded_bytes = this->round_up (nbytes);
+
char *temp = 0;
ACE_NEW_RETURN (temp,
char[rounded_bytes],
0);
+
ACE_Auto_Basic_Array_Ptr<char> cp (temp);
+
if (this->allocated_chunks_.insert (cp.get ()) != 0)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("(%P|%t) insertion into set failed\n")),
0);
+
return cp.release ();
}
+
int
ACE_Local_Memory_Pool::release (int)
{
ACE_TRACE ("ACE_Local_Memory_Pool::release");
+
// Zap the memory we allocated.
for (ACE_Unbounded_Set<char *>::iterator i = this->allocated_chunks_.begin ();
i != this->allocated_chunks_.end ();
@@ -66,30 +82,35 @@ ACE_Local_Memory_Pool::release (int)
this->allocated_chunks_.reset ();
return 0;
}
+
int
ACE_Local_Memory_Pool::sync (ssize_t, int)
{
ACE_TRACE ("ACE_Local_Memory_Pool::sync");
return 0;
}
+
int
ACE_Local_Memory_Pool::sync (void *, size_t, int)
{
ACE_TRACE ("ACE_Local_Memory_Pool::sync");
return 0;
}
+
int
ACE_Local_Memory_Pool::protect (ssize_t, int)
{
ACE_TRACE ("ACE_Local_Memory_Pool::protect");
return 0;
}
+
int
ACE_Local_Memory_Pool::protect (void *, size_t, int)
{
ACE_TRACE ("ACE_Local_Memory_Pool::protect");
return 0;
}
+
#if defined (ACE_WIN32)
int
ACE_Local_Memory_Pool::seh_selector (void *)
@@ -98,17 +119,20 @@ ACE_Local_Memory_Pool::seh_selector (void *)
// Continue propagate the structural exception up.
}
#endif /* ACE_WIN32 */
+
int
ACE_Local_Memory_Pool::remap (void *)
{
return 0;
// Not much can be done.
}
+
void *
ACE_Local_Memory_Pool::base_addr (void) const
{
return 0;
}
+
// Let the underlying new operator figure out the alignment...
size_t
ACE_Local_Memory_Pool::round_up (size_t nbytes)
@@ -116,5 +140,6 @@ ACE_Local_Memory_Pool::round_up (size_t nbytes)
ACE_TRACE ("ACE_Local_Memory_Pool::round_up");
return ACE::round_to_pagesize (nbytes);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Local_Memory_Pool.h b/dep/ACE_wrappers/ace/Local_Memory_Pool.h
index afc5b0c94f0..f02b101c0dc 100644
--- a/dep/ACE_wrappers/ace/Local_Memory_Pool.h
+++ b/dep/ACE_wrappers/ace/Local_Memory_Pool.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Local_Memory_Pool.h
@@ -9,16 +10,22 @@
* @author Prashant Jain <pjain@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_LOCAL_MEMORY_POOL_H
#define ACE_LOCAL_MEMORY_POOL_H
#include /**/ "ace/pre.h"
+
#include "ace/os_include/sys/os_mman.h" /* Need PROT_RDWR */
#include "ace/ACE.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Unbounded_Set.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Local_Memory_Pool_Options
*
@@ -30,6 +37,7 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
class ACE_Export ACE_Local_Memory_Pool_Options
{
};
+
/**
* @class ACE_Local_Memory_Pool
*
@@ -41,38 +49,48 @@ class ACE_Export ACE_Local_Memory_Pool
{
public:
typedef ACE_Local_Memory_Pool_Options OPTIONS;
+
/// Initialize the pool.
ACE_Local_Memory_Pool (const ACE_TCHAR *backing_store_name = 0,
const OPTIONS *options = 0);
+
virtual ~ACE_Local_Memory_Pool (void);
+
/// Ask system for initial chunk of local memory.
virtual void *init_acquire (size_t nbytes,
size_t &rounded_bytes,
int &first_time);
+
/// Acquire at least @a nbytes from the memory pool. @a rounded_bytes is
/// the actual number of bytes allocated.
virtual void *acquire (size_t nbytes,
size_t &rounded_bytes);
+
/// Instruct the memory pool to release all of its resources.
virtual int release (int destroy = 1);
+
/**
* Sync @a len bytes of the memory region to the backing store
* starting at <this->base_addr_>. If @a len == -1 then sync the
* whole region.
*/
virtual int sync (ssize_t len = -1, int flags = MS_SYNC);
+
/// Sync @a len bytes of the memory region to the backing store
/// starting at @a add_.
virtual int sync (void *addr, size_t len, int flags = MS_SYNC);
+
/**
* Change the protection of the pages of the mapped region to @a prot
* starting at <this->base_addr_> up to @a len bytes. If @a len == -1
* then change protection of all pages in the mapped region.
*/
virtual int protect (ssize_t len = -1, int prot = PROT_RDWR);
+
/// Change the protection of the pages of the mapped region to @a prot
/// starting at @a addr up to @a len bytes.
virtual int protect (void *addr, size_t len, int prot = PROT_RDWR);
+
#if defined (ACE_WIN32)
/**
* Win32 Structural exception selector. The return value decides
@@ -81,27 +99,36 @@ public:
*/
virtual int seh_selector (void *);
#endif /* ACE_WIN32 */
+
/**
* Try to extend the virtual address space so that @a addr is now
* covered by the address mapping. Always returns 0 since we can't
* remap a local memory pool.
*/
virtual int remap (void *addr);
+
/// Return the base address of this memory pool, 0 if base_addr
/// never changes.
virtual void *base_addr (void) const;
+
/// Dump the state of an object.
virtual void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
/// List of memory that we have allocated.
ACE_Unbounded_Set<char *> allocated_chunks_;
+
/// Implement the algorithm for rounding up the request to an
/// appropriate chunksize.
virtual size_t round_up (size_t nbytes);
+
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
#endif /* ACE_LOCAL_MEMORY_POOL_H */
diff --git a/dep/ACE_wrappers/ace/Local_Name_Space.cpp b/dep/ACE_wrappers/ace/Local_Name_Space.cpp
index 7554f3d8948..deba2ab215d 100644
--- a/dep/ACE_wrappers/ace/Local_Name_Space.cpp
+++ b/dep/ACE_wrappers/ace/Local_Name_Space.cpp
@@ -4,33 +4,40 @@
#include "ace/SString.h"
#include "ace/OS_NS_string.h"
#include "ace/Truncate.h"
+
ACE_RCSID (ace,
Local_Name_Space,
"$Id: Local_Name_Space.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_NS_String::~ACE_NS_String (void)
{
if (this->delete_rep_)
delete [] this->rep_;
}
+
ACE_WCHAR_T *
ACE_NS_String::fast_rep (void) const
{
ACE_TRACE ("ACE_NS_String::fast_rep");
return this->rep_;
}
+
ACE_NS_String::operator ACE_NS_WString () const
{
ACE_TRACE ("ACE_NS_String::operator ACE_NS_WString");
return ACE_NS_WString (this->rep_,
(this->len_ / sizeof (ACE_WCHAR_T)) - 1);
}
+
size_t
ACE_NS_String::len (void) const
{
ACE_TRACE ("ACE_NS_String::len");
return this->len_;
}
+
char *
ACE_NS_String::char_rep (void) const
{
@@ -39,6 +46,7 @@ ACE_NS_String::char_rep (void) const
(this->len_ / sizeof (ACE_WCHAR_T)) - 1);
return w_string.char_rep ();
}
+
ACE_NS_String::ACE_NS_String (void)
: len_ (0),
rep_ (0),
@@ -46,6 +54,7 @@ ACE_NS_String::ACE_NS_String (void)
{
ACE_TRACE ("ACE_NS_String::ACE_NS_String");
}
+
ACE_NS_String::ACE_NS_String (const ACE_NS_WString &s)
: len_ ((s.length () + 1) * sizeof (ACE_WCHAR_T)),
rep_ (s.rep ()),
@@ -53,10 +62,12 @@ ACE_NS_String::ACE_NS_String (const ACE_NS_WString &s)
{
ACE_TRACE ("ACE_NS_String::ACE_NS_String");
}
+
int
ACE_NS_String::strstr (const ACE_NS_String &s) const
{
ACE_TRACE ("ACE_NS_String::strstr");
+
if (this->len_ < s.len_)
// If they're larger than we are they can't be a substring of us!
return -1;
@@ -68,19 +79,24 @@ ACE_NS_String::strstr (const ACE_NS_String &s) const
// They're smaller than we are...
const size_t len = (this->len_ - s.len_) / sizeof (ACE_WCHAR_T);
const size_t pat_len = s.len_ / sizeof (ACE_WCHAR_T) - 1;
+
for (size_t i = 0; i <= len; ++i)
{
size_t j;
+
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 ACE_Utils::truncate_cast<int> (i);
}
+
return -1;
}
}
+
bool
ACE_NS_String::operator == (const ACE_NS_String &s) const
{
@@ -89,12 +105,14 @@ ACE_NS_String::operator == (const ACE_NS_String &s) const
&& ACE_OS::memcmp ((void *) this->rep_,
(void *) s.rep_, this->len_) == 0;
}
+
bool
ACE_NS_String::operator != (const ACE_NS_String &s) const
{
ACE_TRACE ("ACE_NS_String::operator !=");
return !this->operator == (s);
}
+
ACE_NS_String::ACE_NS_String (ACE_WCHAR_T *dst,
const ACE_WCHAR_T *src,
size_t bytes)
@@ -105,6 +123,7 @@ ACE_NS_String::ACE_NS_String (ACE_WCHAR_T *dst,
ACE_TRACE ("ACE_NS_String::ACE_NS_String");
ACE_OS::memcpy (this->rep_, src, bytes);
}
+
u_long
ACE_NS_String::hash (void) const
{
@@ -112,34 +131,40 @@ ACE_NS_String::hash (void) const
(reinterpret_cast<char *> (const_cast<ACE_WCHAR_T *> (this->rep_)),
this->len_);
}
+
ACE_NS_Internal::ACE_NS_Internal (void)
: value_ (),
type_ ()
{
}
+
ACE_NS_Internal::ACE_NS_Internal (ACE_NS_String &value, const char *type)
: value_ (value),
type_ (type)
{
ACE_TRACE ("ACE_NS_Internal::ACE_NS_Internal");
}
+
bool
ACE_NS_Internal::operator == (const ACE_NS_Internal &s) const
{
ACE_TRACE ("ACE_NS_Internal::operator ==");
return this->value_ == s.value_;
}
+
ACE_NS_String
ACE_NS_Internal::value (void)
{
ACE_TRACE ("ACE_NS_Internal::value");
return this->value_;
}
+
const char *
ACE_NS_Internal::type (void)
{
ACE_TRACE ("ACE_NS_Internal::type");
return this->type_;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Local_Name_Space.h b/dep/ACE_wrappers/ace/Local_Name_Space.h
index 1e792ff0dc4..09aadcaa4de 100644
--- a/dep/ACE_wrappers/ace/Local_Name_Space.h
+++ b/dep/ACE_wrappers/ace/Local_Name_Space.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Local_Name_Space.h
@@ -10,15 +11,22 @@
* @author Douglas C. Schmidt (schmidt@cs.wustl.edu).
*/
//=============================================================================
+
#ifndef ACE_LOCAL_NAME_SPACE_H
#define ACE_LOCAL_NAME_SPACE_H
+
#include /**/ "ace/pre.h"
+
#include "ace/Malloc_T.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_NS_WString;
+
/**
* @class ACE_NS_String
*
@@ -34,39 +42,54 @@ public:
// = Initialization.
/// Default "no-op" constructor.
ACE_NS_String (void);
+
/// Initialization method.
ACE_NS_String (ACE_WCHAR_T *dst,
const ACE_WCHAR_T *src,
size_t len);
+
/// Converts an ACE_NS_WString to an ACE_NS_String;
ACE_NS_String (const ACE_NS_WString &);
+
/// Destructor
~ACE_NS_String (void);
+
/// Converts an ACE_NS_String to fresh copy of an ACE_NS_WString;
operator ACE_NS_WString () const;
+
/// Return the ASCII character representation.
char *char_rep (void) const;
+
/// Matches on substrings.
int strstr (const ACE_NS_String &) const;
+
/// Compare an ACE_NS_String.
bool operator == (const ACE_NS_String &) const;
+
/// Compare an ACE_NS_String.
bool operator != (const ACE_NS_String &) const;
+
/// Returns length of the string
size_t len (void) const;
+
/// Returns the underlying representation.
ACE_WCHAR_T *fast_rep (void) const;
+
/// Returns a hash value for this string.
u_long hash (void) const;
+
private:
/// Length of the string.
size_t len_;
+
/// This actually points into shared/persistent memory.
ACE_WCHAR_T *rep_;
+
/// Should rep_ be deleted when destructed (only used
/// for WString conversions)
bool delete_rep_;
};
+
/**
* @class ACE_NS_Internal
*
@@ -78,23 +101,33 @@ class ACE_Export ACE_NS_Internal
public:
/// No-op constructor.
ACE_NS_Internal (void);
+
/// Constructor.
ACE_NS_Internal (ACE_NS_String &value, const char *type);
+
/// Compare an ACE_NS_Internal
bool operator == (const ACE_NS_Internal &) const;
+
/// Return value.
ACE_NS_String value (void);
+
/// Return type.
const char *type (void);
+
private:
/// Contains the value of the string.
ACE_NS_String value_;
+
/// Contains the type of the string.
const char *type_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
// Include the ACE_Local_Name_Space templates stuff at this point.
#include "ace/Local_Name_Space_T.h"
+
#include /**/ "ace/post.h"
+
#endif /* ACE_LOCAL_NAME_SPACE_H */
diff --git a/dep/ACE_wrappers/ace/Local_Name_Space_T.h b/dep/ACE_wrappers/ace/Local_Name_Space_T.h
index fddbadd9624..1263cebd5ab 100644
--- a/dep/ACE_wrappers/ace/Local_Name_Space_T.h
+++ b/dep/ACE_wrappers/ace/Local_Name_Space_T.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Local_Name_Space_T.h
@@ -10,22 +11,30 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_LOCAL_NAME_SPACE_T_H
#define ACE_LOCAL_NAME_SPACE_T_H
#include /**/ "ace/pre.h"
+
#include "ace/Name_Space.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Naming_Context.h"
#include "ace/SString.h"
#include "ace/Local_Name_Space.h"
#include "ace/Null_Mutex.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/// A short-hand name for our set of name/value/type tuples passed back
/// to callers.
typedef ACE_Unbounded_Set<ACE_NS_WString> ACE_WSTRING_SET;
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
// Simplify later usage by defining typedefs.
#if (1)
# include "ace/Hash_Map_Manager_T.h"
@@ -38,11 +47,14 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
typedef ACE_Map_Manager<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex> MAP_MANAGER;
ACE_END_VERSIONED_NAMESPACE_DECL
#endif /* 0 */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/// @deprecated Deprecated typedefs. Use the map's traits instead.
typedef MAP_MANAGER::ITERATOR MAP_ITERATOR;
typedef MAP_MANAGER::ENTRY MAP_ENTRY;
+
/**
* @class ACE_Name_Space_Map
*
@@ -62,6 +74,7 @@ class ACE_Name_Space_Map : public MAP_MANAGER
public:
/// Constructor.
ACE_Name_Space_Map (ALLOCATOR *alloc);
+
// = The following methods are Proxies to the underlying methods
// provided by ACE_Hash_Map_Manager. When they are called, they
// acquire the lock, set the allocator to the one specific to this
@@ -69,19 +82,24 @@ public:
int bind (const ACE_NS_String &,
const ACE_NS_Internal &,
ALLOCATOR *alloc);
+
int unbind (const ACE_NS_String &,
ACE_NS_Internal &,
ALLOCATOR *alloc);
+
int rebind (const ACE_NS_String &,
const ACE_NS_Internal &,
ACE_NS_String &,
ACE_NS_Internal &,
ALLOCATOR *alloc);
+
int find (const ACE_NS_String &,
ACE_NS_Internal &,
ALLOCATOR *alloc);
+
int close (ALLOCATOR *alloc);
};
+
/**
* @class ACE_Local_Name_Space
*
@@ -102,6 +120,7 @@ public:
// = Initialization and termination methods.
/// "Do-nothing" constructor.
ACE_Local_Name_Space (void);
+
/**
* Specifies the scope of this namespace, opens and memory-maps the
* associated file (if accessible) or contacts the dedicated name
@@ -109,19 +128,23 @@ public:
*/
ACE_Local_Name_Space (ACE_Naming_Context::Context_Scope_Type scope_in,
ACE_Name_Options *name_options);
+
/**
* Specifies the scope of this namespace, opens and memory-maps the
* associated file (if accessible) or contacts the dedicated name
* server process for NET_LOCAL namespace.
*/
int open (ACE_Naming_Context::Context_Scope_Type scope_in);
+
/// Destructor, do some cleanup :TBD: last dtor should "compress"
/// file
~ACE_Local_Name_Space (void);
+
/// Bind a new name to a naming context (Wide character strings).
virtual int bind (const ACE_NS_WString &name,
const ACE_NS_WString &value,
const char *type = "");
+
/**
* Overwrite the value or type of an existing name in a
* ACE_Local_Name_Space or bind a new name to the context, if it
@@ -130,10 +153,12 @@ public:
virtual int rebind (const ACE_NS_WString &name,
const ACE_NS_WString &value,
const char *type = "");
+
/// Delete a name from a ACE_Local_Name_Space (Wide charcter strings
/// Interface).
virtual int unbind (const ACE_NS_WString &name);
virtual int unbind_i (const ACE_NS_WString &name);
+
/// Get value and type of a given name binding (Wide chars). The
/// caller is responsible for deleting @a type!
virtual int resolve (const ACE_NS_WString &name,
@@ -142,24 +167,28 @@ public:
virtual int resolve_i (const ACE_NS_WString &name,
ACE_NS_WString &value,
char *&type);
+
/// Get a set of names matching a specified pattern (wchars). Matching
/// means the names must begin with the pattern string.
virtual int list_names (ACE_WSTRING_SET &set,
const ACE_NS_WString &pattern);
virtual int list_names_i (ACE_WSTRING_SET &set,
const ACE_NS_WString &pattern);
+
/// Get a set of values matching a specified pattern (wchars). Matching
/// means the values must begin with the pattern string.
virtual int list_values (ACE_WSTRING_SET &set,
const ACE_NS_WString &pattern);
virtual int list_values_i (ACE_WSTRING_SET &set,
const ACE_NS_WString &pattern);
+
/// Get a set of types matching a specified pattern (wchars). Matching
/// means the types must begin with the pattern string.
virtual int list_types (ACE_WSTRING_SET &set,
const ACE_NS_WString &pattern);
virtual int list_types_i (ACE_WSTRING_SET &set,
const ACE_NS_WString &pattern);
+
/**
* Get a set of names matching a specified pattern (wchars). Matching
* means the names must begin with the pattern string. Returns the
@@ -169,6 +198,7 @@ public:
const ACE_NS_WString &pattern);
virtual int list_name_entries_i (ACE_BINDING_SET &set,
const ACE_NS_WString &pattern);
+
/**
* Get a set of values matching a specified pattern (wchars). Matching
* means the values must begin with the pattern string. Returns the
@@ -178,6 +208,7 @@ public:
const ACE_NS_WString &pattern);
virtual int list_value_entries_i (ACE_BINDING_SET &set,
const ACE_NS_WString &pattern);
+
/**
* Get a set of types matching a specified pattern (wchars). Matching
* means the types must begin with the pattern string. Returns the
@@ -187,17 +218,21 @@ public:
const ACE_NS_WString &pattern);
virtual int list_type_entries_i (ACE_BINDING_SET &set,
const ACE_NS_WString &pattern);
+
/// Dump the state of the object
virtual void dump (void) const;
virtual void dump_i (void) const;
+
// = I just know this is going to cause problems on some platform...
typedef ACE_Allocator_Adapter <ACE_Malloc <ACE_MEM_POOL_2, ACE_LOCK> >
ALLOCATOR;
+
private:
#if defined (ACE_WIN32)
/// Remap the backing store
int remap (EXCEPTION_POINTERS *ep);
#endif /* ACE_WIN32 */
+
/// Factor out code from bind() and rebind().
int shared_bind (const ACE_NS_WString &name,
const ACE_NS_WString &value,
@@ -205,31 +240,42 @@ private:
int shared_bind_i (const ACE_NS_WString &name,
const ACE_NS_WString &value,
const char *type, int rebind);
+
/// Allocate the appropriate type of map manager that stores the
/// key/value binding.
int create_manager (void);
int create_manager_i (void);
+
/// Pointer to the allocator
ALLOCATOR *allocator_;
+
/// Pointer to the allocated map manager.
ACE_Name_Space_Map <ALLOCATOR> *name_space_map_;
+
/// Scope of this naming context (e.g., PROC_LOCAL, NODE_LOCAL, or
/// NET_LOCAL).
ACE_Naming_Context::Context_Scope_Type ns_scope_;
+
/// Keep track of the options such as database name etc
ACE_Name_Options *name_options_;
+
/// Name of the file used as the backing store.
ACE_TCHAR context_file_[MAXPATHLEN + MAXNAMELEN];
+
/// Synchronization variable.
ACE_LOCK *lock_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Local_Name_Space_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Local_Name_Space_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
#endif /* ACE_LOCAL_NAME_SPACE_T_H */
diff --git a/dep/ACE_wrappers/ace/Local_Tokens.cpp b/dep/ACE_wrappers/ace/Local_Tokens.cpp
index 1d8d7c50f9c..2fc6eed1acf 100644
--- a/dep/ACE_wrappers/ace/Local_Tokens.cpp
+++ b/dep/ACE_wrappers/ace/Local_Tokens.cpp
@@ -1,17 +1,24 @@
// $Id: Local_Tokens.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Local_Tokens.h"
+
#if defined (ACE_HAS_TOKENS_LIBRARY)
+
#include "ace/Thread.h"
#include "ace/Token_Manager.h"
#include "ace/OS_NS_unistd.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Local_Tokens.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID (ace,
Local_Tokens,
"$Id: Local_Tokens.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
void
ACE_Tokens::dump (void) const
{
@@ -27,41 +34,49 @@ ACE_Tokens::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
ACE_Tokens::ACE_Tokens (void)
: visited_ (0),
reference_count_ (0)
{
ACE_TRACE ("ACE_Tokens::ACE_Tokens");
}
+
ACE_Tokens::~ACE_Tokens (void)
{
}
+
void
ACE_Tokens::make_owner (ACE_TPQ_Entry *caller)
{
this->waiters_.remove (caller);
this->waiters_.enqueue (caller, 0);
}
+
ACE_Token_Proxy_Queue *
ACE_Tokens::waiters ()
{
ACE_TRACE ("ACE_Tokens::waiters");
return &this->waiters_;
}
+
int
ACE_Tokens::no_of_waiters ()
{
ACE_TRACE ("ACE_Tokens::no_of_waiters");
return this->waiters_.size ();
}
+
#if defined (ACE_LACKS_INLINE_FUNCTIONS)
ACE_Null_Token::ACE_Null_Token (void)
{
}
+
ACE_Null_Token::~ACE_Null_Token (void)
{
}
#endif /* ACE_LACKS_INLINE_FUNCTIONS */
+
void
ACE_TPQ_Entry::dump (void) const
{
@@ -74,15 +89,18 @@ ACE_TPQ_Entry::dump (void) const
ACE_TEXT (" client_id_ = %s\n"),
nesting_level_,
client_id_));
+
if (next_ != 0)
{
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("next:.\n")));
next_->dump ();
}
+
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("ACE_TPQ_Entry::dump end.\n")));
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
ACE_TPQ_Entry::ACE_TPQ_Entry (const ACE_Token_Proxy *new_proxy,
const ACE_TCHAR *client_id)
: cond_var_ (lock_),
@@ -93,6 +111,7 @@ ACE_TPQ_Entry::ACE_TPQ_Entry (const ACE_Token_Proxy *new_proxy,
sleep_hook_ (0)
{
ACE_TRACE ("ACE_TPQ_Entry::ACE_TPQ_Entry");
+
if (client_id != 0)
this->client_id (client_id);
else
@@ -101,7 +120,9 @@ ACE_TPQ_Entry::ACE_TPQ_Entry (const ACE_Token_Proxy *new_proxy,
ACE_TCHAR host_name[MAXHOSTNAMELEN];
ACE_TCHAR name[(sizeof host_name / sizeof (ACE_TCHAR)) + 256];
ACE_OS::hostname (host_name, sizeof host_name);
+
ACE_thread_t thread_id = ACE_Thread::self ();
+
// The cast is an attempt to get this to compile (and run,
// hopefully) regardless of the type of ACE_thread_t.
ACE_OS::sprintf (name,
@@ -109,9 +130,11 @@ ACE_TPQ_Entry::ACE_TPQ_Entry (const ACE_Token_Proxy *new_proxy,
host_name,
static_cast<u_int> (ACE_OS::getpid ()),
*reinterpret_cast<u_long *> (&thread_id));
+
this->client_id (name);
}
}
+
ACE_TPQ_Entry::ACE_TPQ_Entry (void)
: cond_var_ (lock_),
proxy_ (0),
@@ -120,16 +143,19 @@ ACE_TPQ_Entry::ACE_TPQ_Entry (void)
{
ACE_TRACE ("ACE_TPQ_Entry::ACE_TPQ_Entry null const.");
}
+
ACE_TPQ_Entry::ACE_TPQ_Entry (const ACE_TPQ_Entry &rhs)
: cond_var_ (lock_)
{
ACE_TRACE ("ACE_TPQ_Entry::ACE_TPQ_Entry copy const.");
*this = rhs;
}
+
ACE_TPQ_Entry::~ACE_TPQ_Entry (void)
{
ACE_TRACE ("ACE_TPQ_Entry::~ACE_TPQ_Entry");
}
+
void
ACE_TPQ_Entry::operator= (const ACE_TPQ_Entry& rhs)
{
@@ -141,19 +167,24 @@ ACE_TPQ_Entry::operator= (const ACE_TPQ_Entry& rhs)
this->client_id (rhs.client_id ());
this->sleep_hook_ = rhs.sleep_hook ();
}
+
void
ACE_TPQ_Entry::client_id (const ACE_TCHAR *id)
{
ACE_TRACE ("ACE_TPQ_Entry::client_id");
+
if (id == 0)
return;
+
ACE_OS::strsncpy (this->client_id_,
(ACE_TCHAR *) id,
ACE_MAXCLIENTIDLEN);
}
+
ACE_TSS_TPQ_Entry::~ACE_TSS_TPQ_Entry (void)
{
}
+
void
ACE_TSS_TPQ_Entry::dump (void) const
{
@@ -168,6 +199,7 @@ ACE_TSS_TPQ_Entry::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
ACE_TSS_TPQ_Entry::ACE_TSS_TPQ_Entry (const ACE_Token_Proxy *proxy,
const ACE_TCHAR *client_id)
: proxy_ (proxy),
@@ -175,17 +207,20 @@ ACE_TSS_TPQ_Entry::ACE_TSS_TPQ_Entry (const ACE_Token_Proxy *proxy,
{
ACE_TRACE ("ACE_TSS_TPQ_Entry::ACE_TSS_TPQ_Entry");
}
+
ACE_TPQ_Entry *
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;
}
+
ACE_TSS_TPQ_Entry::operator ACE_TPQ_Entry * (void)
{
#if !defined (ACE_NO_TSS_TOKENS)
@@ -200,31 +235,40 @@ ACE_TSS_TPQ_Entry::operator ACE_TPQ_Entry * (void)
return (ACE_TPQ_Entry *) this;;
#endif /* !ACE_NO_TSS_TOKENS */
}
+
ACE_TPQ_Iterator::ACE_TPQ_Iterator (ACE_Token_Proxy_Queue &q)
: current_ (q.head_)
{
ACE_TRACE ("ACE_TPQ_Iterator::ACE_TPQ_Iterator");
}
+
int
ACE_TPQ_Iterator::next (ACE_TPQ_Entry *&next_item)
{
ACE_TRACE ("ACE_TPQ_Iterator::next");
+
next_item = this->current_;
+
return current_ != 0;
}
+
int
ACE_TPQ_Iterator::done (void) const
{
ACE_TRACE ("ACE_TPQ_Iterator::done");
+
return this->current_ == 0;
}
+
void
ACE_TPQ_Iterator::advance (void)
{
ACE_TRACE ("ACE_TPQ_Iterator::advance");
+
if (current_ != 0)
this->current_ = this->current_->next_;
}
+
void
ACE_TPQ_Iterator::dump (void) const
{
@@ -238,6 +282,7 @@ ACE_TPQ_Iterator::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
void
ACE_Token_Proxy_Queue::dump (void) const
{
@@ -250,10 +295,12 @@ ACE_Token_Proxy_Queue::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("head_ and tail_\n")));
if (this->head_ != 0)
this->head_->dump ();
+
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("ACE_Token_Proxy_Queue::dump end.\n")));
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
ACE_Token_Proxy_Queue::ACE_Token_Proxy_Queue (void)
: head_ (0),
tail_ (0),
@@ -261,19 +308,23 @@ ACE_Token_Proxy_Queue::ACE_Token_Proxy_Queue (void)
{
ACE_TRACE ("ACE_Token_Proxy_Queue::ACE_Token_Proxy_Queue");
}
+
void
ACE_Token_Proxy_Queue::enqueue (ACE_TPQ_Entry *tpq,
int position)
{
ACE_TRACE ("ACE_Token_Proxy_Queue::enqueue");
tpq->next_ = 0;
+
++this->size_;
+
if (this->head_ == 0)
{
// make tpq the entire list
this->head_ = this->tail_ = tpq;
return;
}
+
if (position == 0)
{
// make head of list
@@ -281,6 +332,7 @@ ACE_Token_Proxy_Queue::enqueue (ACE_TPQ_Entry *tpq,
this->head_ = tpq;
return;
}
+
if (position == -1)
{
// stick at back of list
@@ -288,8 +340,10 @@ ACE_Token_Proxy_Queue::enqueue (ACE_TPQ_Entry *tpq,
this->tail_ = tpq;
return;
}
+
// walk through list to insertion point
ACE_TPQ_Entry *temp = head_;
+
for (int x = position;
x > 1;
--x)
@@ -301,40 +355,52 @@ ACE_Token_Proxy_Queue::enqueue (ACE_TPQ_Entry *tpq,
else
temp = temp->next_;
}
+
// insert new tpq after temp
tpq->next_ = temp->next_;
temp->next_ = tpq;
}
+
void
ACE_Token_Proxy_Queue::dequeue (void)
{
ACE_TRACE ("ACE_Token_Proxy_Queue::dequeue");
+
if (head_ == 0)
return;
+
ACE_TPQ_Entry *temp = this->head_;
+
this->head_ = this->head_->next_;
+
temp->next_ = 0;
+
--this->size_;
+
if (this->head_ == 0 && this->size_ != 0)
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("incorrect size = %d\n"),
this->size_));
}
+
/*
int
ACE_Token_Proxy_Queue::member (const ACE_TCHAR *id)
{
ACE_TRACE ("ACE_Token_Proxy_Queue::member");
+
for (ACE_TPQ_Entry *temp = this->head_;
temp != 0;
temp = temp->next_)
if (ACE_OS::strcmp (temp->client_id (), id) == 0)
// We found it!
return 1;
+
// We didn't find it :-(
return 0;
}
*/
+
void
ACE_Token_Proxy_Queue::remove (const ACE_TPQ_Entry *remove_me)
{
@@ -342,17 +408,21 @@ ACE_Token_Proxy_Queue::remove (const ACE_TPQ_Entry *remove_me)
// sanity
if ((remove_me == 0) || (this->head_ == 0))
return;
+
// is it the head?
if (this->head_ == remove_me) // pointer comparison.
{
this->head_ = this->head_->next_;
if (this->head_ == 0)
this->tail_ = 0;
+
--this->size_;
return;
}
+
ACE_TPQ_Entry *temp = this->head_;
ACE_TPQ_Entry *previous = 0;
+
// is it in the middle or tail?
while (temp != 0)
{
@@ -364,15 +434,19 @@ ACE_Token_Proxy_Queue::remove (const ACE_TPQ_Entry *remove_me)
// is it the tail?
if (this->tail_ == temp)
this->tail_ = previous;
+
--this->size_;
return;
}
+
previous = temp;
temp = temp->next_;
}
+
// it wasn't in the list.
return;
}
+
void
ACE_Mutex_Token::dump (void) const
{
@@ -388,17 +462,21 @@ ACE_Mutex_Token::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
ACE_Mutex_Token::ACE_Mutex_Token (const ACE_TCHAR *name)
{
ACE_TRACE ("ACE_Mutex_Token::ACE_Mutex_Token");
+
ACE_OS::strsncpy (this->token_name_,
name,
ACE_MAXTOKENNAMELEN);
}
+
ACE_Mutex_Token::~ACE_Mutex_Token (void)
{
ACE_TRACE ("ACE_Mutex_Token::~ACE_Mutex_Token");
}
+
int
ACE_Mutex_Token::acquire (ACE_TPQ_Entry *caller,
int ignore_deadlock,
@@ -412,6 +490,7 @@ ACE_Mutex_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);
+
// Does _anyone_ own the token?
if (this->owner () == 0)
{
@@ -419,6 +498,7 @@ ACE_Mutex_Token::acquire (ACE_TPQ_Entry *caller,
this->waiters_.enqueue (caller, -1);
return 0; // success
}
+
// Does the caller already own it?
if (this->is_owner (caller->client_id ()))
{
@@ -426,6 +506,7 @@ ACE_Mutex_Token::acquire (ACE_TPQ_Entry *caller,
caller->nesting_level (1);
return 0; // success
}
+
// Check for deadlock.
if (!ignore_deadlock
&& ACE_Token_Manager::instance ()->check_deadlock (caller->proxy ()) == 1)
@@ -433,15 +514,20 @@ ACE_Mutex_Token::acquire (ACE_TPQ_Entry *caller,
errno = EDEADLK;
ACE_RETURN (-1);
}
+
// Someone owns it. Sorry, you're getting queued up at the end of
// the waiter queue.
this->waiters_.enqueue (caller, -1);
+
if (notify)
this->owner ()->call_sleep_hook ();
+
errno = EWOULDBLOCK;
ACE_RETURN (-1);
+
ACE_NOTREACHED (return -1);
}
+
int
ACE_Mutex_Token::tryacquire (ACE_TPQ_Entry *caller)
{
@@ -453,6 +539,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)
{
@@ -472,49 +559,62 @@ ACE_Mutex_Token::tryacquire (ACE_TPQ_Entry *caller)
errno = EWOULDBLOCK;
ACE_RETURN (-1);
}
+
ACE_NOTREACHED (return -1);
}
+
int
ACE_Mutex_Token::renew (ACE_TPQ_Entry *caller,
int requeue_position)
{
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)
{
errno = EACCES;
ACE_RETURN (-1);
}
+
// The caller is the owner, so check to see if there are any
// waiters. If not, we just keep the token. == 1 means that there
// is only the owner.
if (this->waiters_.size () == 1 || requeue_position == 0)
return 0;
+
// Requeue the caller.
this->waiters_.dequeue ();
+
this->waiters_.enqueue (caller, requeue_position);
+
// Notify new owner.
if (this->owner () != 0)
this->owner ()->proxy ()->token_acquired (this->owner ());
+
// Tell the caller that the operation would block.
errno = EWOULDBLOCK;
ACE_RETURN (-1);
+
ACE_NOTREACHED (return -1);
}
+
// Release the current holder of the token (which had
// better be the caller's thread!).
+
int
ACE_Mutex_Token::release (ACE_TPQ_Entry *caller)
{
ACE_TRACE ("ACE_Mutex_Token::release");
ACE_GUARD_RETURN (ACE_TOKEN_CONST::MUTEX, ace_mon, this->lock_, -1);
+
// Does anyone own the token?
if (this->owner () == 0)
{
errno = EACCES;
ACE_RETURN (-1);
}
+
// Is the caller the owner.
if (this->is_owner (caller->client_id ()))
{
@@ -531,8 +631,10 @@ ACE_Mutex_Token::release (ACE_TPQ_Entry *caller)
}
else
this->remove (caller);
+
return 0;
}
+
int
ACE_Mutex_Token::owners (OWNER_STACK &stack,
const ACE_TCHAR *id)
@@ -546,8 +648,10 @@ ACE_Mutex_Token::owners (OWNER_STACK &stack,
if (id != 0)
return this->owner ()->equal_client_id (id);
}
+
return 0;
}
+
int
ACE_Mutex_Token::is_waiting_for (const ACE_TCHAR *id)
{
@@ -555,6 +659,7 @@ ACE_Mutex_Token::is_waiting_for (const ACE_TCHAR *id)
// If there is no owner, or <id> is the owner, return false.
if ((this->owner () == 0) || this->is_owner (id))
return 0;
+
// Step through each waiter looking for <id>.
ACE_TPQ_Iterator iterator (waiters_);
iterator.advance ();
@@ -565,8 +670,10 @@ ACE_Mutex_Token::is_waiting_for (const ACE_TCHAR *id)
if (temp->equal_client_id (id))
return 1;
}
+
return 0;
}
+
int
ACE_Mutex_Token::is_owner (const ACE_TCHAR *id)
{
@@ -578,19 +685,23 @@ ACE_Mutex_Token::is_owner (const ACE_TCHAR *id)
else
return 0;
}
+
int
ACE_Mutex_Token::type (void) const
{
ACE_TRACE ("ACE_Mutex_Token::type");
return (int) ACE_Tokens::MUTEX;
}
+
// ************************************************************
+
int
ACE_RW_Token::type (void) const
{
ACE_TRACE ("ACE_RW_Token::type");
return (int) ACE_Tokens::RWLOCK;
}
+
void
ACE_RW_Token::dump (void) const
{
@@ -607,18 +718,22 @@ ACE_RW_Token::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
ACE_RW_Token::ACE_RW_Token (const ACE_TCHAR *name)
: num_writers_ (0)
{
ACE_TRACE ("ACE_RW_Token::ACE_RW_Token");
+
ACE_OS::strsncpy (this->token_name_,
name,
ACE_MAXTOKENNAMELEN);
}
+
ACE_RW_Token::~ACE_RW_Token (void)
{
ACE_TRACE ("ACE_RW_Token::~ACE_RW_Token");
}
+
int
ACE_RW_Token::acquire (ACE_TPQ_Entry *caller,
int ignore_deadlock,
@@ -632,8 +747,10 @@ 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_++;
+
// Does _anyone_ own the token?
if (this->owner () == 0)
{
@@ -641,12 +758,14 @@ ACE_RW_Token::acquire (ACE_TPQ_Entry *caller,
this->waiters_.enqueue (caller, -1);
return 0;
}
+
// Check for recursive acquisition.
if (this->is_owner (caller->client_id ()))
{
caller->nesting_level (1);
return 0; // Success.
}
+
// Reader.
if (caller->proxy ()->type () == ACE_RW_Token::READER)
{
@@ -659,7 +778,9 @@ ACE_RW_Token::acquire (ACE_TPQ_Entry *caller,
}
// Else failure.
}
+
// Failure code.
+
// Check for deadlock.
if (!ignore_deadlock &&
ACE_Token_Manager::instance ()->check_deadlock (caller->proxy ()) == 1)
@@ -669,8 +790,10 @@ ACE_RW_Token::acquire (ACE_TPQ_Entry *caller,
errno = EDEADLK;
ACE_RETURN (-1);
}
+
// Queue the caller at the end of the queue.
this->waiters_.enqueue (caller, -1);
+
if (notify)
{
// If it's a writer, just notify it.
@@ -689,10 +812,13 @@ ACE_RW_Token::acquire (ACE_TPQ_Entry *caller,
temp->proxy ()->type () == ACE_RW_Token::READER);
}
}
+
errno = EWOULDBLOCK;
ACE_RETURN (-1);
+
ACE_NOTREACHED (return -1);
}
+
int
ACE_RW_Token::tryacquire (ACE_TPQ_Entry *caller)
{
@@ -704,10 +830,12 @@ ACE_RW_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);
+
if (caller->proxy ()->type () == ACE_RW_Token::WRITER)
{
this->num_writers_++;
}
+
// Does _anyone_ own the token?
if (this->owner () == 0)
{
@@ -715,12 +843,14 @@ ACE_RW_Token::tryacquire (ACE_TPQ_Entry *caller)
this->waiters_.enqueue (caller, -1);
return 0;
}
+
// Check for recursive acquisition.
if (this->is_owner (caller->client_id ()))
{
caller->nesting_level (1);
return 0; // Success.
}
+
// Reader.
if (caller->proxy ()->type () == ACE_RW_Token::READER)
{
@@ -739,30 +869,38 @@ ACE_RW_Token::tryacquire (ACE_TPQ_Entry *caller)
this->num_writers_--;
}
+
errno = EWOULDBLOCK;
ACE_RETURN (-1);
+
ACE_NOTREACHED (return -1);
}
+
int
ACE_RW_Token::renew (ACE_TPQ_Entry *caller,
int requeue_position)
{
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)
{
errno = EACCES;
ACE_RETURN (-1);
}
+
// The caller is the owner, so check to see if there are any
// waiters. If not, we just keep the token.
if (this->waiters_.size () == 1 || requeue_position == 0)
return 0;
+
// There are waiters, so remove the caller.
this->remove (caller);
+
// Requeue the caller.
this->waiters_.enqueue (caller, requeue_position);
+
if (caller->proxy ()->type () == ACE_RW_Token::READER)
{
// If the caller got queued before any writers, the caller is
@@ -773,18 +911,23 @@ ACE_RW_Token::renew (ACE_TPQ_Entry *caller,
}
// Writers will always have to block since waiters_.size () == 1 or
// requeue_position == 0.
+
// Get a new owner.
this->notify_new_owner (caller);
+
// Tell the caller that the operation would block.
errno = EWOULDBLOCK;
ACE_RETURN (-1);
+
ACE_NOTREACHED (return -1);
}
+
int
ACE_RW_Token::release (ACE_TPQ_Entry *caller)
{
ACE_TRACE ("ACE_RW_Token::release");
ACE_GUARD_RETURN (ACE_TOKEN_CONST::MUTEX, ace_mon, this->lock_, -1);
+
// Check for errors.
if ((this->owner () == 0) ||
(this->is_owner (caller->client_id ()) == 0))
@@ -792,30 +935,38 @@ ACE_RW_Token::release (ACE_TPQ_Entry *caller)
errno = EACCES;
ACE_RETURN (-1);
}
+
if (caller->proxy ()->type () == ACE_RW_Token::WRITER)
num_writers_--;
+
// Recursive release.
if (caller->nesting_level () > 0)
{
caller->nesting_level (-1);
return 0;
}
+
// Remove the caller and notify the new owner(s).
this->remove (caller);
this->notify_new_owner (caller);
+
return 0;
}
+
void
ACE_RW_Token::notify_new_owner (ACE_TPQ_Entry *old_owner)
{
ACE_TRACE ("ACE_RW_Token::notify_new_owner");
+
if (this->owner () == 0)
return;
+
if (this->owner ()->proxy ()->type () == ACE_RW_Token::READER)
{
if (old_owner->proxy ()->type () == ACE_RW_Token::READER)
// the owners already know that they're owners
return;
+
// The current owner is a reader and the previous owner was a
// writer, so notify all waiting readers up to the first writer.
// call back all reader owners.
@@ -827,6 +978,7 @@ ACE_RW_Token::notify_new_owner (ACE_TPQ_Entry *old_owner)
if (temp->proxy ()->type () == WRITER)
// We've gone through all the readers.
break;
+
temp->proxy ()->token_acquired (temp);
}
}
@@ -834,14 +986,18 @@ ACE_RW_Token::notify_new_owner (ACE_TPQ_Entry *old_owner)
this->owner ()->proxy ()->token_acquired (this->owner ());
}
+
int
ACE_RW_Token::owners (OWNER_STACK &stack,
const ACE_TCHAR *id)
{
ACE_TRACE ("ACE_RW_Token::owners");
+
if (this->owner () == 0)
return 0;
+
int id_is_owner = 0;
+
// The first waiter is a writer, so there is only one owner.
if (this->owner ()->proxy ()->type () == WRITER)
{
@@ -864,14 +1020,18 @@ ACE_RW_Token::owners (OWNER_STACK &stack,
if (temp->proxy ()->type () == WRITER)
// We've gone through all the readers.
break;
+
stack.push (temp);
+
if (!id_is_owner && (id != 0) &&
(ACE_OS::strcmp (id, temp->client_id ()) == 0))
id_is_owner = 1;
}
}
+
return id_is_owner;
}
+
int
ACE_RW_Token::is_waiting_for (const ACE_TCHAR *id)
{
@@ -880,6 +1040,7 @@ ACE_RW_Token::is_waiting_for (const ACE_TCHAR *id)
if ((this->owner () == 0) ||
this->is_owner (id))
return 0;
+
// Step through each waiter looking for <id>.
ACE_TPQ_Iterator iterator (waiters_);
iterator.advance ();
@@ -890,8 +1051,10 @@ ACE_RW_Token::is_waiting_for (const ACE_TCHAR *id)
if (temp->equal_client_id (id))
return 1;
}
+
return 0;
}
+
int
ACE_RW_Token::is_owner (const ACE_TCHAR *id)
{
@@ -899,9 +1062,11 @@ ACE_RW_Token::is_owner (const ACE_TCHAR *id)
// If there is no owner, return false.
if (this->owner () == 0)
return 0;
+
// A writer owns us.
if (this->owner ()->proxy ()->type () == ACE_RW_Token::WRITER)
return this->owner ()->equal_client_id (id);
+
// Readers own us.
// Step through each owning reader looking for <id>.
ACE_TPQ_Iterator iterator (waiters_);
@@ -911,11 +1076,14 @@ ACE_RW_Token::is_owner (const ACE_TCHAR *id)
{
if (temp->proxy ()->type () != ACE_RW_Token::READER)
break;
+
if (temp->equal_client_id (id))
return 1;
}
+
return 0;
}
+
void
ACE_Token_Proxy::dump (void) const
{
@@ -928,13 +1096,16 @@ ACE_Token_Proxy::dump (void) const
ACE_TEXT (" debug_ = %d\n"),
(int) this->type (), ignore_deadlock_, debug_));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("mutex_, and waiter_\n")));
+
if (this->token_ != 0)
this->token_->dump ();
+
this->waiter_.dump ();
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("ACE_Token_Proxy::dump end.\n")));
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
const ACE_TCHAR *
ACE_Token_Proxy::client_id (void) const
{
@@ -942,29 +1113,34 @@ ACE_Token_Proxy::client_id (void) const
// Thread-specific.
const ACE_TPQ_Entry *temp = this->waiter_.operator->();
const ACE_TCHAR *id = temp->client_id ();
+
if (id == 0)
return ACE_TEXT ("ERROR NO CLIENT ID");
else
return id;
}
+
void
ACE_Token_Proxy::client_id (const ACE_TCHAR *client_id)
{
ACE_TRACE ("ACE_Token_Proxy::client_id");
this->waiter_->client_id (client_id);
}
+
const ACE_TCHAR *
ACE_Token_Proxy::owner_id (void)
{
ACE_TRACE ("ACE_Token_Proxy::owner_id");
return this->token_->owner_id ();
}
+
const ACE_TCHAR *
ACE_Token_Proxy::name (void) const
{
ACE_TRACE ("ACE_Token_Proxy::name");
return this->token_->name ();
}
+
#if defined (ACE_WIN32_VC8)
# pragma warning (push)
# pragma warning (disable:4355) /* Use of 'this' in initializer list */
@@ -975,9 +1151,11 @@ ACE_Token_Proxy::ACE_Token_Proxy (void)
{
ACE_TRACE ("ACE_Token_Proxy::ACE_Token_Proxy");
}
+
// Notice the token_ (0). Do *not* copy the token pointer. This must
// be obtained through the token manager. Also, we don't copy any
// waiter info. A copied Proxy does *not* inherit client_id.
+
ACE_Token_Proxy::ACE_Token_Proxy (const ACE_Token_Proxy &)
: token_ (0),
waiter_ (this, 0)
@@ -987,26 +1165,32 @@ ACE_Token_Proxy::ACE_Token_Proxy (const ACE_Token_Proxy &)
#if defined (ACE_WIN32_VC8)
# pragma warning (pop)
#endif
+
// @@ should I do a mutex_->release ()?
ACE_Token_Proxy::~ACE_Token_Proxy (void)
{
ACE_TRACE ("ACE_Token_Proxy::~ACE_Token_Proxy");
+
if (token_ != 0)
// notify token manager that we are done with it so it can
// free it if necessary
ACE_Token_Manager::instance ()->release_token (token_);
}
+
int
ACE_Token_Proxy::open (const ACE_TCHAR *token_name,
int ignore_deadlock,
int debug)
{
ACE_TRACE ("ACE_Token_Proxy::open");
+
// Store some parameters.
this->ignore_deadlock_ = ignore_deadlock;
this->debug_ = debug;
+
// Used in case a name was not specified.
ACE_TCHAR name[BUFSIZ];
+
// We must have a name.
if (token_name == 0)
{
@@ -1014,17 +1198,21 @@ ACE_Token_Proxy::open (const ACE_TCHAR *token_name,
reinterpret_cast<long> (this));
token_name = name;
}
+
// Get or create the underlying token. The Token Manager will call
// us back to set token_.
ACE_Token_Manager::instance ()->get_token (this, token_name);
+
// Check for failed get or failed new.
if (this->token_ == 0)
{
errno = ENOMEM;
ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Can't allocate mutex")), -1);
}
+
return 0;
}
+
int
ACE_Token_Proxy::acquire (int notify,
void (*sleep_hook)(void *),
@@ -1036,6 +1224,7 @@ ACE_Token_Proxy::acquire (int notify,
errno = ENOENT;
ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Not open.\n")), -1);
}
+
// Make sure no one calls our token_acquired until we have a chance
// to sleep first! If after we call an EWOULDBLOCK
// mutex_->acquire() below, but before we enter handle_options to
@@ -1043,7 +1232,9 @@ ACE_Token_Proxy::acquire (int notify,
// waiter queue and signal us, IT WILL FIRST HAVE TO ACQUIRE THIS
// cond_var.mutex (). _This_ is why we acquire it.
this->waiter_->cond_var_.mutex ().acquire ();
+
this->waiter_->sleep_hook (sleep_hook);
+
if (this->token_->acquire (this->waiter_, this->ignore_deadlock_, notify) == -1)
// acquire failed
{
@@ -1057,6 +1248,7 @@ ACE_Token_Proxy::acquire (int notify,
ACE_RETURN (-1);
}
// Else, fallthrough and block!
+
case EWOULDBLOCK :
if (this->debug_)
ACE_DEBUG ((LM_DEBUG,
@@ -1065,6 +1257,7 @@ ACE_Token_Proxy::acquire (int notify,
this->name (),
this->token_->owner_id (),
token_->no_of_waiters ()));
+
// no error, but would block, if error, return error (-1),
// otherwise, return whether we called the holder or not.
int return_value;
@@ -1073,8 +1266,10 @@ ACE_Token_Proxy::acquire (int notify,
return_value = -1;
else
return_value = notify == 1;
+
errno = EWOULDBLOCK;
ACE_RETURN (return_value);
+
default :
waiter_->cond_var_.mutex ().release ();
ACE_ERROR_RETURN ((LM_ERROR,
@@ -1092,8 +1287,10 @@ ACE_Token_Proxy::acquire (int notify,
this->name ()));
waiter_->cond_var_.mutex ().release ();
}
+
return 0;
}
+
int
ACE_Token_Proxy::tryacquire (void (*sleep_hook)(void *))
{
@@ -1105,9 +1302,12 @@ ACE_Token_Proxy::tryacquire (void (*sleep_hook)(void *))
ACE_TEXT ("Not open.\n")),
-1);
}
+
this->waiter_->sleep_hook (sleep_hook);
+
return this->token_->tryacquire (waiter_);
}
+
int
ACE_Token_Proxy::renew (int requeue_position,
ACE_Synch_Options &options)
@@ -1120,19 +1320,23 @@ ACE_Token_Proxy::renew (int requeue_position,
ACE_TEXT ("Not open.\n")),
-1);
}
+
// Make sure no one calls our token_acquired until we have a chance
// to sleep first!
this->waiter_->cond_var_.mutex ().acquire ();
+
if (this->token_->renew (this->waiter_, requeue_position) == -1)
{
// check for error
if (errno != EWOULDBLOCK)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("%p renew failed\n"), ACE_TEXT ("ACE_Token_Proxy")), -1);
+
if (this->debug_)
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) renew blocking for %s, owner is %s\n"),
this->name (),
token_->owner_id ()));
+
// no error, but would block, so block or return
return this->handle_options (options, waiter_->cond_var_);
}
@@ -1146,12 +1350,14 @@ ACE_Token_Proxy::renew (int requeue_position,
return 0;
}
}
+
int
ACE_Token_Proxy::handle_options (ACE_Synch_Options &options,
ACE_TOKEN_CONST::COND_VAR &cv)
{
// Some operation failed with EWOULDBLOCK.
ACE_TRACE ("ACE_Token_Proxy::handle_options");
+
if (options[ACE_Synch_Options::USE_REACTOR] == 1)
// Asynchronous.
{
@@ -1176,6 +1382,7 @@ ACE_Token_Proxy::handle_options (ACE_Synch_Options &options,
ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("condition variable wait")
ACE_TEXT (" bombed.")), -1);
}
+
if (this->debug_)
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) unblocking %s.\n"),
this->client_id ()));
@@ -1183,10 +1390,12 @@ ACE_Token_Proxy::handle_options (ACE_Synch_Options &options,
return 0; // operation succeeded
}
}
+
int
ACE_Token_Proxy::release (ACE_Synch_Options &)
{
ACE_TRACE ("ACE_Token_Proxy::release");
+
if (this->token_ == 0)
{
errno = ENOENT;
@@ -1194,6 +1403,7 @@ ACE_Token_Proxy::release (ACE_Synch_Options &)
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Must open before releasing.\n")));
ACE_RETURN (-1);
}
+
if (this->token_->release (waiter_) != 0)
{
// Release failed.
@@ -1208,15 +1418,18 @@ ACE_Token_Proxy::release (ACE_Synch_Options &)
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) released %s, owner is %s\n"),
this->name (),
token_->owner_id ()));
+
return 0;
}
}
+
int
ACE_Token_Proxy::remove (ACE_Synch_Options &)
{
ACE_TRACE ("ACE_Token_Proxy::remove");
return 0;
}
+
void
ACE_Token_Proxy::sleep_hook (void)
{
@@ -1224,6 +1437,7 @@ ACE_Token_Proxy::sleep_hook (void)
// Somebody wants our token! (Let'em wait...)
return;
}
+
void
ACE_Token_Proxy::token_acquired (ACE_TPQ_Entry *e)
{
@@ -1235,14 +1449,17 @@ ACE_Token_Proxy::token_acquired (ACE_TPQ_Entry *e)
// overriden to do something more useful!
e->cond_var_.signal ();
e->cond_var_.mutex ().release ();
+
return;
}
+
int
ACE_Token_Proxy::type (void) const
{
ACE_TRACE ("ACE_Token_Proxy::type");
return 0;
}
+
int
ACE_Token_Proxy::acquire_read (int notify,
void (*sleep_hook)(void *),
@@ -1252,6 +1469,7 @@ ACE_Token_Proxy::acquire_read (int notify,
sleep_hook,
options);
}
+
int
ACE_Token_Proxy::acquire_write (int notify,
void (*sleep_hook)(void *),
@@ -1261,30 +1479,36 @@ ACE_Token_Proxy::acquire_write (int notify,
sleep_hook,
options);
}
+
int
ACE_Token_Proxy::tryacquire_read (void (*sleep_hook)(void *))
{
return this->tryacquire (sleep_hook);
}
+
int
ACE_Token_Proxy::tryacquire_write (void (*sleep_hook)(void *))
{
return this->tryacquire (sleep_hook);
}
+
ACE_Token_Name::ACE_Token_Name (const ACE_TCHAR *token_name)
{
ACE_TRACE ("ACE_Token_Name::ACE_Token_Name");
this->name (token_name);
}
+
ACE_Token_Name::ACE_Token_Name (const ACE_Token_Name &rhs)
{
ACE_TRACE ("ACE_Token_Name::ACE_Token_Name");
this->name (rhs.name ());
}
+
ACE_Token_Name::~ACE_Token_Name ()
{
ACE_TRACE ("ACE_Token_Name::~ACE_Token_Name");
}
+
void
ACE_Token_Name::dump (void) const
{
@@ -1297,7 +1521,9 @@ ACE_Token_Name::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
// ************************************************************
+
ACE_Token_Proxy *
ACE_Local_Mutex::clone (void) const
{
@@ -1309,6 +1535,7 @@ ACE_Local_Mutex::clone (void) const
0);
return temp;
}
+
ACE_Tokens *
ACE_Local_Mutex::create_token (const ACE_TCHAR *name)
{
@@ -1318,13 +1545,17 @@ ACE_Local_Mutex::create_token (const ACE_TCHAR *name)
0);
return temp;
}
+
ACE_Local_Mutex::~ACE_Local_Mutex (void)
{
}
+
// ************************************************************
+
ACE_Local_RLock::~ACE_Local_RLock (void)
{
}
+
ACE_Tokens *
ACE_Local_RLock::create_token (const ACE_TCHAR *name)
{
@@ -1334,11 +1565,13 @@ ACE_Local_RLock::create_token (const ACE_TCHAR *name)
0);
return temp;
}
+
int
ACE_Local_RLock::type (void) const
{
return ACE_RW_Token::READER;
}
+
ACE_Token_Proxy *
ACE_Local_RLock::clone (void) const
{
@@ -1350,10 +1583,13 @@ ACE_Local_RLock::clone (void) const
0);
return temp;
}
+
// ************************************************************
+
ACE_Local_WLock::~ACE_Local_WLock (void)
{
}
+
ACE_Tokens *
ACE_Local_WLock::create_token (const ACE_TCHAR *name)
{
@@ -1363,11 +1599,13 @@ ACE_Local_WLock::create_token (const ACE_TCHAR *name)
0);
return temp;
}
+
int
ACE_Local_WLock::type (void) const
{
return ACE_RW_Token::WRITER;
}
+
ACE_Token_Proxy *
ACE_Local_WLock::clone (void) const
{
@@ -1379,6 +1617,8 @@ ACE_Local_WLock::clone (void) const
0);
return temp;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_TOKENS_LIBRARY */
diff --git a/dep/ACE_wrappers/ace/Local_Tokens.h b/dep/ACE_wrappers/ace/Local_Tokens.h
index 6d5e133087d..611643b7752 100644
--- a/dep/ACE_wrappers/ace/Local_Tokens.h
+++ b/dep/ACE_wrappers/ace/Local_Tokens.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Local_Tokens.h
@@ -39,14 +40,19 @@
*
*/
//=============================================================================
+
#ifndef ACE_LOCAL_MUTEX_H
#define ACE_LOCAL_MUTEX_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_TOKENS_LIBRARY)
+
#include "ace/Synch_Traits.h"
#include "ace/Condition_Thread_Mutex.h"
#include "ace/TSS_T.h"
@@ -56,10 +62,13 @@
#include "ace/Log_Msg.h"
#include "ace/OS_NS_string.h"
#include "ace/os_include/os_netdb.h"
+
#if !(defined (ACE_HAS_THREADS) && defined (ACE_HAS_THREAD_SPECIFIC_STORAGE))
# define ACE_NO_TSS_TOKENS 1
#endif /* !(defined (ACE_HAS_THREADS) && defined (ACE_HAS_THREAD_SPECIFIC_STORAGE)) */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// 1.
/**
* @class ACE_TOKEN_CONST
@@ -83,8 +92,10 @@ namespace ACE_TOKEN_CONST
typedef ACE_Guard<ACE_Null_Mutex> GUARD;
#endif /* ACE_HAS_THREADS */
}
+
// Forward decl.
class ACE_Token_Proxy;
+
// 3..
/**
* @class ACE_TPQ_Entry
@@ -98,70 +109,99 @@ class ACE_Export ACE_TPQ_Entry
friend class ACE_Token_Manager;
public:
typedef void (*PTVF) (void *);
+
/// Null constructor.
ACE_TPQ_Entry (void);
+
/// Constructor.
ACE_TPQ_Entry (const ACE_Token_Proxy *proxy,
const ACE_TCHAR *client_id);
+
/// Copy constructor.
ACE_TPQ_Entry (const ACE_TPQ_Entry &rhs);
+
/// Destructor.
~ACE_TPQ_Entry (void);
+
/// Copy operator use by the queue.
void operator= (const ACE_TPQ_Entry &rhs);
+
/// Get top of the queue.
ACE_Token_Proxy *proxy (void) const;
+
/// Set top of the queue.
void proxy (ACE_Token_Proxy *);
+
/// Get nesting level of the entry.
int nesting_level (void) const;
+
/// Delta nesting level of the entry.
void nesting_level (int delta);
+
/// Get client_id of the entry.
const ACE_TCHAR *client_id (void) const;
+
/// Set client_id of the entry.
void client_id (const ACE_TCHAR *);
+
/// Returns 1 if @a id == client id. Does not check for @a id == 0.
int equal_client_id (const ACE_TCHAR *id);
+
/// One method for arg and sleep_hook.
void set (void (*sleep_hook)(void *));
+
/// Set sleep hook of the entry.
void sleep_hook (void (*sh)(void *));
+
/// Get sleep hook of the entry.
PTVF sleep_hook (void) const;
+
/// Call the sleep hook function or method passing arg.
void call_sleep_hook (void);
+
/// Dump the state of the class.
void dump (void) const;
+
// = Used to block the thread if an acquire fails with EWOULDBLOCK.
ACE_TOKEN_CONST::COND_VAR cond_var_;
ACE_TOKEN_CONST::MUTEX lock_;
+
/// Pointer to next in list.
ACE_TPQ_Entry *next_;
+
/// Get whether this client is blocked waiting for a token.
int waiting (void) const;
+
/// Set whether this client is blocked waiting for a token.
void waiting (int w);
+
private:
/// This client is waiting for a token.
int waiting_;
+
/// Proxy.
ACE_Token_Proxy *proxy_;
+
/// Nesting level.
int nesting_level_;
+
/// Arg.
void *arg_;
+
/// Client id.
ACE_TCHAR client_id_[ACE_MAXCLIENTIDLEN];
+
/// Sleep hook.
void (*sleep_hook_)(void *);
};
+
// b..
#if defined (ACE_NO_TSS_TOKENS)
typedef ACE_TPQ_Entry ACE_TPQ_ENTRY;
#else
typedef ACE_TSS<ACE_TPQ_Entry> ACE_TPQ_ENTRY;
#endif /* ACE_NO_TSS_TOKENS */
+
/**
* @class ACE_TSS_TPQ_Entry
*
@@ -176,32 +216,43 @@ public:
/// make_TSS_TYPE
ACE_TSS_TPQ_Entry (const ACE_Token_Proxy *proxy,
const ACE_TCHAR *client_id);
+
/// Destructor.
virtual ~ACE_TSS_TPQ_Entry (void);
+
/// Allows us to pass args to the construction of the TSS object.
virtual ACE_TPQ_Entry *make_TSS_TYPE (void) const;
+
/// Operator overloading and inheritence don't mix.
operator ACE_TPQ_Entry *(void);
+
/// Dump the state of the class.
void dump (void) const;
+
#if defined (ACE_NO_TSS_TOKENS)
ACE_TPQ_Entry *operator-> (void)
{
return (ACE_TPQ_Entry *) this;
}
#endif /* ACE_NO_TSS_TOKENS */
+
private:
/// Private: should not be used
ACE_TSS_TPQ_Entry (const ACE_TSS_TPQ_Entry &);
void operator= (const ACE_TSS_TPQ_Entry &);
+
// = These are passed to the constructor of ACE_TPQ_Entry in
// make_TSS_TYPE
+
/// Proxy.
const ACE_Token_Proxy *proxy_;
+
/// Client_id.
const ACE_TCHAR *client_id_;
};
+
class ACE_Token_Proxy_Queue;
+
// c..
/**
* @class ACE_TPQ_Iterator
@@ -215,19 +266,26 @@ class ACE_Export ACE_TPQ_Iterator
public:
/// Constructor.
ACE_TPQ_Iterator (ACE_Token_Proxy_Queue &q);
+
/// Destructor.
~ACE_TPQ_Iterator (void);
+
/// Pass back the <next_item>.
int next (ACE_TPQ_Entry *&next_item);
+
/// Returns 1 when all items have been seen, else 0.
int done (void) const;
+
/// Move forward by one element in the queue.
void advance (void);
+
/// Dump the state of an object.
void dump (void) const;
+
private:
ACE_TPQ_Entry *current_;
};
+
// 4..
/**
* @class ACE_Token_Proxy_Queue
@@ -247,10 +305,13 @@ class ACE_Export ACE_Token_Proxy_Queue
{
public:
friend class ACE_TPQ_Iterator;
+
/// Constructor.
ACE_Token_Proxy_Queue (void);
+
/// Destructor.
~ACE_Token_Proxy_Queue (void);
+
/**
* Enqueue a proxy, nesting level, client_id, and a magic cookie at
* the given position in the list. If the position is -1, we
@@ -258,26 +319,36 @@ public:
*/
void enqueue (ACE_TPQ_Entry* new_entry,
int position);
+
/// Top of the queue.
const ACE_TPQ_Entry* head (void);
+
// int member (const ACE_TCHAR *id);
// Is this id in the waiter list?
+
/// Remove the top waiter.
void dequeue (void);
+
/// Remove the waiter whose proxy ref matches @a remove_me.
void remove (const ACE_TPQ_Entry *remove_me);
+
/// The number of waiters.
int size (void);
+
/// Dump the state of the class.
void dump (void) const;
+
protected:
/// Head.
ACE_TPQ_Entry *head_;
+
/// Tail.
ACE_TPQ_Entry *tail_;
+
/// Size.
int size_;
};
+
// 5..
/**
* @class ACE_Tokens
@@ -300,82 +371,114 @@ protected:
class ACE_Export ACE_Tokens
{
public:
+
/// Null constructor.
ACE_Tokens (void);
+
/// Destructor
virtual ~ACE_Tokens (void);
+
/// No implementation.
virtual int acquire (ACE_TPQ_Entry *caller,
int ignore_deadlock,
int notify) = 0;
+
/// No implementation.
virtual int tryacquire (ACE_TPQ_Entry *caller) = 0;
+
/// No implementation.
virtual int renew (ACE_TPQ_Entry *caller,
int requeue_position) = 0;
+
/// No implementation.
virtual int release (ACE_TPQ_Entry *caller) = 0;
+
/// Move the caller to the front of the waiter list. This is for use
/// with remote mutexes and shadow mutexes.
void make_owner (ACE_TPQ_Entry *caller);
+
/// Remove the caller from the waiter list.
void remove (ACE_TPQ_Entry *caller);
+
// = Accessor methods.
+
/// Stack of owners.
typedef ACE_Unbounded_Stack<ACE_TPQ_Entry *> OWNER_STACK;
+
/// Returns a stack of the current owners. Returns -1 on error, 0 on
/// success. If <id> is non-zero, returns 1 if id is an owner.
virtual int owners (OWNER_STACK &o, const ACE_TCHAR *id) = 0;
+
/// Returns 1 if <id> is waiting for this token. 0 otherwise.
virtual int is_waiting_for (const ACE_TCHAR *id) = 0;
+
/// Returns 1 if <id> is an owner of this token. 0 otherwise.
virtual int is_owner (const ACE_TCHAR *id) = 0;
+
/// Return the queue of waiters.
virtual ACE_Token_Proxy_Queue *waiters (void);
+
/// Return the number of proxies that are currently waiting to get
/// the token.
virtual int no_of_waiters (void);
+
/// The current owner.
const ACE_TCHAR *owner_id (void);
+
/// Token name.
const ACE_TCHAR* name (void);
+
// = Reference counting. These are only called by the
// Token_Manager.
void inc_reference (void);
int dec_reference (void);
+
/// Dump the state of the class.
void dump (void) const;
+
/**
* These are the Token types supported by the library at ship time.
* There is no restriction on the number of Token types added by
* "3rd parties." These are only necessary for the Token Server.
*/
enum TOKEN_TYPES { MUTEX, RWLOCK };
+
/**
* Provides a manual RTTI mechanism. This method is used only by
* ACE_Token_Request so that the type of a token can be sent to a
* remote Token Server.
*/
virtual int type (void) const = 0;
+
// = The following methods allow the deadlock detection algorithm to
// check if this token has been visited.
+
/// Mark or unmark the token as visited.
void visit (int v);
+
/// Check if the token has been visited.
int visited (void);
+
/// All the data of the current owner.
ACE_TPQ_Entry *owner (void);
+
protected:
+
/// For the deadlock detection algorithm.
int visited_;
+
/// Reference count.
int reference_count_;
+
/// List of client's owning and waiting the token.
ACE_Token_Proxy_Queue waiters_;
+
/// Name of token.
ACE_TCHAR token_name_[ACE_MAXTOKENNAMELEN];
};
+
class ACE_Local_Mutex;
+
// 6..
/**
* @class ACE_Mutex_Token
@@ -397,12 +500,15 @@ class ACE_Export ACE_Mutex_Token : public ACE_Tokens
public:
/// Constructor
explicit ACE_Mutex_Token (const ACE_TCHAR* name);
+
/// Destructor
virtual ~ACE_Mutex_Token (void);
+
// = Synchronization operations.
// With acquire, renew, and release, the caller must be specified so
// that multiple proxies (e.g. ACE_Local_Mutex) can use the same
// token.
+
/**
* Returns 0 on success, -1 on failure with <ACE_Log_Msg::errnum> as
* the reason. If errnum == EWOULDBLOCK, and notify == 1,
@@ -413,8 +519,10 @@ public:
virtual int acquire (ACE_TPQ_Entry *caller,
int ignore_deadlock,
int notify);
+
/// Same as acquire, but fails if would block
virtual int tryacquire (ACE_TPQ_Entry *caller);
+
/**
* An optimized method that efficiently reacquires the token if no
* other threads are waiting. This is useful for situations where
@@ -437,27 +545,35 @@ public:
*/
virtual int renew (ACE_TPQ_Entry *caller,
int requeue_position);
+
/**
* Relinquish the token. If there are any waiters then the next one
* in line gets it. If the caller is not the owner, caller is
* removed from the waiter list.
*/
virtual int release (ACE_TPQ_Entry *caller);
+
/// Dump the state of the class.
void dump (void) const;
+
/// Returns ACE_Tokens::MUTEX.
virtual int type (void) const;
+
/// Returns a stack of the current owners. Returns -1 on error, 0 on
/// success. If <id> is non-zero, returns 1 if id is an owner.
virtual int owners (OWNER_STACK &o, const ACE_TCHAR *id);
+
/// Returns 1 if <id> is waiting for this token. 0 otherwise.
virtual int is_waiting_for (const ACE_TCHAR *id);
+
/// Returns 1 if <id> is an owner of this token. 0 otherwise.
virtual int is_owner (const ACE_TCHAR *id);
+
private:
/// ACE_Mutex_Token used to lock internal data structures.
ACE_TOKEN_CONST::MUTEX lock_;
};
+
// 12..
/**
* @class ACE_RW_Token
@@ -479,12 +595,15 @@ class ACE_Export ACE_RW_Token : public ACE_Tokens
public:
/// Constructor.
explicit ACE_RW_Token (const ACE_TCHAR* name);
+
/// Destructor.
virtual ~ACE_RW_Token (void);
+
// = Synchronization operations.
// With acquire, renew, and release, the caller must be specified so
// that multiple proxies (e.g. ACE_Local_Mutex) can use the same
// token.
+
/**
* Returns 0 on success, -1 on failure with <ACE_Log_Msg::errnum> as
* the reason. If errnum == EWOULDBLOCK, and notify == 1,
@@ -495,8 +614,10 @@ public:
virtual int acquire (ACE_TPQ_Entry *caller,
int ignore_deadlock,
int notify);
+
/// Same as acquire except fails on would block
virtual int tryacquire (ACE_TPQ_Entry *caller);
+
/**
* An optimized method that efficiently reacquires the token if no
* other threads are waiting. This is useful for situations where
@@ -519,33 +640,44 @@ public:
*/
virtual int renew (ACE_TPQ_Entry *caller,
int requeue_position);
+
/**
* Relinquish the token. If there are any waiters then the next one
* in line gets it. If the caller is not the owner, caller is
* removed from the waiter list.
*/
virtual int release (ACE_TPQ_Entry *caller);
+
/// Dump the state of the class.
void dump (void) const;
+
/// These are the types that proxies can be.
enum PROXY_TYPE { READER, WRITER };
+
/// Returns READER or WRITER.
virtual int type (void) const;
+
/// Returns a stack of the current owners. Returns -1 on error, 0 on
/// success. If <id> is non-zero, returns 1 if id is an owner.
virtual int owners (OWNER_STACK &o, const ACE_TCHAR *id);
+
/// Returns 1 if <id> is waiting for this token. 0 otherwise.
virtual int is_waiting_for (const ACE_TCHAR *id);
+
/// Returns 1 if <id> is an owner of this token. 0 otherwise.
virtual int is_owner (const ACE_TCHAR *id);
+
protected:
/// The number of waiting writers.
int num_writers_;
+
/// ACE_Mutex_Token used to lock internal data structures.
ACE_TOKEN_CONST::MUTEX lock_;
+
/// Sets the new owner.
void notify_new_owner (ACE_TPQ_Entry *caller);
};
+
// a..
/**
* @class ACE_Token_Name
@@ -563,24 +695,33 @@ class ACE_Export ACE_Token_Name
public:
/// Construction.
ACE_Token_Name (const ACE_TCHAR *token_name = 0);
+
/// Copy construction.
ACE_Token_Name (const ACE_Token_Name &rhs);
+
/// Destructor.
virtual ~ACE_Token_Name (void);
+
/// Copy.
void operator= (const ACE_Token_Name &rhs);
+
/// Comparison.
bool operator== (const ACE_Token_Name &rhs) const;
+
/// Get the token name.
const ACE_TCHAR *name (void) const;
+
/// Set the token name.
void name (const ACE_TCHAR *new_name);
+
/// Dump the state of the class.
void dump (void) const;
+
private:
/// Name of the token.
ACE_TCHAR token_name_[ACE_MAXTOKENNAMELEN];
};
+
// 7..
/**
* @class ACE_Token_Proxy
@@ -612,11 +753,14 @@ class ACE_Export ACE_Token_Proxy
public:
friend class ACE_Token_Manager;
friend class ACE_Token_Invariant_Manager; // For testing.
+
// Initialization and termination methods.
/// Construction.
ACE_Token_Proxy (void);
+
/// Destructor.
virtual ~ACE_Token_Proxy (void);
+
/**
* Open the <ACE_Token>.
* @param name The string uniquely identifying the token.
@@ -626,58 +770,72 @@ public:
virtual int open (const ACE_TCHAR *name,
int ignore_deadlock = 0,
int debug = 0);
+
// = The following methods have implementations which are
// independent of the token semantics (mutex, rwlock, etc.) They
// forward operations to the underlying token and perform the
// necessary blocking semantics for operations (condition variables
// etc.) This allows reuse of the blocking code as well as having
// multiple proxies to the same token.
+
/// Calls acquire on the token. Blocks the calling thread if would
/// block.
virtual int acquire (int notify = 0,
void (*sleep_hook)(void *) = 0,
ACE_Synch_Options &options =
ACE_Synch_Options::defaults);
+
/// Calls renew on the token. Blocks the calling thread if would block.
virtual int renew (int requeue_position = -1,
ACE_Synch_Options &options =
ACE_Synch_Options::defaults);
+
/// Calls renew on the token.
virtual int tryacquire (void (*sleep_hook)(void *) = 0);
+
/// Calls release on the token.
virtual int release (ACE_Synch_Options &options =
ACE_Synch_Options::defaults);
+
/// Calls remove on the token.
virtual int remove (ACE_Synch_Options &options =
ACE_Synch_Options::defaults);
+
/// Since the locking mechanism doesn't support read locks then this
/// just calls <acquire>.
virtual int acquire_read (int notify = 0,
void (*sleep_hook)(void *) = 0,
ACE_Synch_Options &options =
ACE_Synch_Options::defaults);
+
/// Since the locking mechanism doesn't support write locks then this
/// just calls <acquire>.
virtual int acquire_write (int notify = 0,
void (*sleep_hook)(void *) = 0,
ACE_Synch_Options &options =
ACE_Synch_Options::defaults);
+
/// Since the locking mechanism doesn't support read locks then this
/// just calls <tryacquire>.
virtual int tryacquire_read (void (*sleep_hook)(void *) = 0);
+
/// Since the locking mechanism doesn't support write locks then this
/// just calls <tryacquire>.
virtual int tryacquire_write (void (*sleep_hook)(void *) = 0);
+
// = Utility methods.
+
/// Get the client id of the proxy. This is implemented as
/// thread-specific data.
virtual const ACE_TCHAR *client_id (void) const;
+
/**
* Set the client_id for the calling thread. I strongly recommend
* that this not be used unless you really know what you're doing.
* I use this in the Token Server, and it caused many headaches.
*/
virtual void client_id (const ACE_TCHAR *client_id);
+
/**
* Return the name of the token. This is important for use within
* the token servers (local and remote) as well as with token
@@ -687,21 +845,27 @@ public:
* called "Reactor Token."
*/
virtual const ACE_TCHAR *name (void) const;
+
/**
* This should really be called <someone_waiting>. This is called
* by ACE_Token_xx's when another proxy enters the waiting list and
* requests that the current token holder be notified.
*/
virtual void sleep_hook (void);
+
/// This is called when a queued (waiting) proxy is removed from the
/// waiters list and given the token.
virtual void token_acquired (ACE_TPQ_Entry *);
+
/// The client id of the current token holder
virtual const ACE_TCHAR *owner_id (void);
+
/// Return a dynamically allocated clone of the derived class.
virtual ACE_Token_Proxy *clone (void) const = 0;
+
/// Dump the state of the class.
void dump (void) const;
+
/**
* This method can be used be Tokens (e.g. Readers/Writer Tokens) to
* distinguish between Proxy types. For instance a Reader proxy
@@ -709,25 +873,33 @@ public:
* default implementation returns 0.
*/
virtual int type (void) const;
+
protected:
/// Duplication.
ACE_Token_Proxy (const ACE_Token_Proxy &);
+
/// If this is set, we ignore deadlock.
int ignore_deadlock_;
+
/// Print a bunch of debug messages.
int debug_;
+
/// Reference to the actual logical token. Many ACE_Local_Mutex
/// proxies can reference the same ACE_Mutex_Token.
ACE_Tokens *token_;
+
/// Handles cond_var waits.
int handle_options (ACE_Synch_Options &options,
ACE_TOKEN_CONST::COND_VAR &cv);
+
/// Waiter info used for asynchronous transactions.
ACE_TSS_TPQ_Entry waiter_;
+
/// Make the correct type of ACE_Tokens. This is called by the Token
/// Manager.
virtual ACE_Tokens *create_token (const ACE_TCHAR *name) = 0;
};
+
// 8..
/**
* @class ACE_Null_Token
@@ -741,33 +913,43 @@ public:
// @@ Hopefully, we can remove this ridicules ifdef when CE's compiler becomes more normal.
/// Construction.
ACE_Null_Token (void);
+
/// Destructor.
~ACE_Null_Token (void);
#endif /* ACE_LACKS_INLINE_FUNCTION */
+
/// Acquire.
virtual int acquire (int /* notify */ = 0,
void (* /* sleep_hook */ )(void *) = 0,
ACE_Synch_Options & /* options */ =
ACE_Synch_Options::defaults) { return 0; }
+
/// Renew.
virtual int renew (int /* requeue_position */ = -1,
ACE_Synch_Options & /* options */ =
ACE_Synch_Options::defaults) { return 0; }
+
/// Try acquire.
virtual int tryacquire (void (* /* sleep_hook */)(void *) = 0) { return 0; }
+
/// Release.
virtual int release (ACE_Synch_Options & /* options */ =
ACE_Synch_Options::defaults) { return 0; }
+
/// Remove.
virtual int remove (ACE_Synch_Options & /* options */ =
ACE_Synch_Options::defaults) { return 0; }
+
/// Return a dynamically allocated clone of the derived class.
virtual ACE_Token_Proxy *clone (void) const { return new ACE_Null_Token; }
+
/// Dump the state of the class.
void dump (void) const;
+
/// Do not allow the Token Manager to create us.
virtual ACE_Tokens *create_token (const ACE_TCHAR *) { return 0; }
};
+
// 9..
/**
* @class ACE_Local_Mutex
@@ -799,16 +981,21 @@ public:
ACE_Local_Mutex (const ACE_TCHAR *token_name = 0,
int ignore_deadlock = 0,
int debug = 0);
+
/// Destructor
~ACE_Local_Mutex (void);
+
/// Dump the state of the class.
void dump (void) const;
+
/// Return deep copy.
virtual ACE_Token_Proxy *clone (void) const;
+
protected:
/// Return a new ACE_Local_Mutex.
virtual ACE_Tokens *create_token (const ACE_TCHAR *name);
};
+
// *.
/**
* @class ACE_Local_RLock
@@ -838,6 +1025,7 @@ class ACE_Export ACE_Local_RLock : public ACE_Token_Proxy
{
public:
// = Initialization and termination.
+
/**
* Constructor.
* @param token_name Uniquely id's the token.
@@ -847,18 +1035,24 @@ public:
ACE_Local_RLock (const ACE_TCHAR *token_name = 0,
int ignore_deadlock = 0,
int debug = 0);
+
/// Destructor
~ACE_Local_RLock (void);
+
/// Dump the state of the class.
void dump (void) const;
+
/// Returns ACE_RW_Token::RLOCK.
virtual int type (void) const;
+
/// Return deep copy.
virtual ACE_Token_Proxy *clone (void) const;
+
protected:
/// Return a new ACE_Local_Mutex.
virtual ACE_Tokens *create_token (const ACE_TCHAR *name);
};
+
// *.
/**
* @class ACE_Local_WLock
@@ -888,6 +1082,7 @@ class ACE_Export ACE_Local_WLock : public ACE_Token_Proxy
{
public:
// = Initialization and termination.
+
/**
* Constructor.
* @param token_name Uniquely id's the token.
@@ -897,20 +1092,28 @@ public:
ACE_Local_WLock (const ACE_TCHAR *token_name = 0,
int ignore_deadlock = 0,
int debug = 0);
+
/// Destructor
~ACE_Local_WLock (void);
+
/// Dump the state of the class.
void dump (void) const;
+
/// Returns ACE_RW_Token::WLOCK.
virtual int type (void) const;
+
/// Return deep copy.
virtual ACE_Token_Proxy *clone (void) const;
+
protected:
/// Return a new ACE_Local_Mutex.
ACE_Tokens *create_token (const ACE_TCHAR *name);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_TOKENS_LIBRARY */
+
#if defined (__ACE_INLINE__)
#include "ace/Local_Tokens.inl"
#endif /* __ACE_INLINE__ */
diff --git a/dep/ACE_wrappers/ace/Local_Tokens.inl b/dep/ACE_wrappers/ace/Local_Tokens.inl
index 7d456edd2fb..56b3cb764e2 100644
--- a/dep/ACE_wrappers/ace/Local_Tokens.inl
+++ b/dep/ACE_wrappers/ace/Local_Tokens.inl
@@ -1,59 +1,73 @@
// -*- C++ -*-
//
// $Id: Local_Tokens.inl 80826 2008-03-04 14:51:23Z wotte $
+
#if defined (ACE_HAS_TOKENS_LIBRARY)
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// ************************************************************
+
ACE_INLINE int
ACE_Token_Proxy_Queue::size (void)
{
ACE_TRACE ("ACE_Token_Proxy_Queue::size");
return this->size_;
}
+
// ************************************************************
+
ACE_INLINE int
ACE_TPQ_Entry::waiting (void) const
{
ACE_TRACE ("ACE_TPQ_Entry::waiting");
return waiting_;
}
+
ACE_INLINE void
ACE_TPQ_Entry::waiting (int v)
{
ACE_TRACE ("ACE_TPQ_Entry::waiting");
waiting_ = v;
}
+
ACE_INLINE const ACE_TCHAR *
ACE_TPQ_Entry::client_id (void) const
{
ACE_TRACE ("ACE_TPQ_Entry::client_id");
return this->client_id_;
}
+
ACE_INLINE ACE_Token_Proxy *
ACE_TPQ_Entry::proxy (void) const
{
ACE_TRACE ("ACE_TPQ_Entry::proxy");
return this->proxy_;
}
+
ACE_INLINE void
ACE_TPQ_Entry::proxy (ACE_Token_Proxy *proxy)
{
ACE_TRACE ("ACE_TPQ_Entry::proxy");
this->proxy_ = proxy;
}
+
ACE_INLINE
ACE_TPQ_Iterator::~ACE_TPQ_Iterator (void)
{
}
+
ACE_INLINE
ACE_Token_Proxy_Queue::~ACE_Token_Proxy_Queue (void)
{
}
+
ACE_INLINE void
ACE_Tokens::remove (ACE_TPQ_Entry *caller)
{
this->waiters_.remove (caller);
}
+
ACE_INLINE int
ACE_Tokens::dec_reference (void)
{
@@ -63,14 +77,17 @@ ACE_Tokens::dec_reference (void)
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("dec_reference already zero")));
return 0;
}
+
return --this->reference_count_;
}
+
ACE_INLINE void
ACE_Tokens::inc_reference (void)
{
ACE_TRACE ("ACE_Tokens::inc_reference");
++this->reference_count_;
}
+
ACE_INLINE const ACE_TPQ_Entry *
ACE_Token_Proxy_Queue::head (void)
{
@@ -80,27 +97,32 @@ ACE_Token_Proxy_Queue::head (void)
else
return this->head_;
}
+
// **************************************************
// **************************************************
// **************************************************
+
ACE_INLINE void
ACE_Tokens::visit (int v)
{
ACE_TRACE ("ACE_Tokens::visit");
visited_ = v;
}
+
ACE_INLINE int
ACE_Tokens::visited (void)
{
ACE_TRACE ("ACE_Tokens::visited");
return visited_;
}
+
ACE_INLINE ACE_TPQ_Entry *
ACE_Tokens::owner (void)
{
ACE_TRACE ("ACE_Tokens::owner");
return (ACE_TPQ_Entry *) this->waiters_.head ();
}
+
ACE_INLINE const ACE_TCHAR*
ACE_Tokens::owner_id ()
{
@@ -110,53 +132,63 @@ ACE_Tokens::owner_id ()
else
return this->owner ()->client_id ();
}
+
ACE_INLINE const ACE_TCHAR*
ACE_Tokens::name (void)
{
ACE_TRACE ("ACE_Tokens::name");
return this->token_name_;
}
+
#if 0
ACE_INLINE ACE_Token_Proxy *
ACE_Tokens::current_owner (void)
{
ACE_TRACE ("ACE_Tokens::current_owner");
// ACE_GUARD_RETURN ???
+
if (this->owner () == 0)
return 0;
else
return this->owner ()->proxy ();
}
#endif /* 0 */
+
// ************************************************************
+
ACE_INLINE int
ACE_TPQ_Entry::nesting_level (void) const
{
ACE_TRACE ("ACE_TPQ_Entry::nesting_level");
return this->nesting_level_;
}
+
ACE_INLINE void
ACE_TPQ_Entry::nesting_level (int delta)
{
ACE_TRACE ("ACE_TPQ_Entry::nesting_level");
this->nesting_level_ += delta;
}
+
ACE_INLINE ACE_TPQ_Entry::PTVF
ACE_TPQ_Entry::sleep_hook (void) const
{
ACE_TRACE ("ACE_TPQ_Entry::sleep_hook");
return this->sleep_hook_;
}
+
ACE_INLINE void
ACE_TPQ_Entry::sleep_hook (void (*sh)(void *))
{
ACE_TRACE ("ACE_TPQ_Entry::sleep_hook");
this->sleep_hook_ = sh;
}
+
ACE_INLINE void
ACE_TPQ_Entry::call_sleep_hook (void)
{
ACE_TRACE ("ACE_TPQ_Entry::call_sleep_hook");
+
// if a function has been registered, call it.
if (this->sleep_hook () != 0)
this->sleep_hook () ((void *) this->proxy ());
@@ -164,15 +196,18 @@ ACE_TPQ_Entry::call_sleep_hook (void)
// otherwise, call back the sleep_hook method
this->proxy ()->sleep_hook ();
}
+
ACE_INLINE int
ACE_TPQ_Entry::equal_client_id (const ACE_TCHAR *id)
{
ACE_TRACE ("ACE_TPQ_Entry::equal_client_id");
return (ACE_OS::strcmp (this->client_id (), id) == 0);
}
+
// ************************************************************
// ************************************************************
// ************************************************************
+
ACE_INLINE
ACE_Local_Mutex::ACE_Local_Mutex (const ACE_TCHAR *token_name,
int ignore_deadlock,
@@ -181,24 +216,32 @@ ACE_Local_Mutex::ACE_Local_Mutex (const ACE_TCHAR *token_name,
ACE_TRACE ("ACE_Local_Mutex::ACE_Local_Mutex");
this->open (token_name, ignore_deadlock, debug);
}
+
ACE_INLINE void
ACE_Token_Name::name (const ACE_TCHAR *new_name)
{
ACE_TRACE ("ACE_Token_Name::name");
+
if (new_name == 0)
new_name = ACE_TEXT ("no name");
+
size_t n = ACE_OS::strlen (new_name) + 1;
+
if (n >= ACE_MAXTOKENNAMELEN)
n = ACE_MAXTOKENNAMELEN - 1;
+
ACE_OS::strsncpy (this->token_name_, (ACE_TCHAR *) new_name, n);
}
+
ACE_INLINE const ACE_TCHAR*
ACE_Token_Name::name (void) const
{
ACE_TRACE ("ACE_Token_Name::name");
return this->token_name_;
}
+
// ************************************************************
+
ACE_INLINE
ACE_Local_RLock::ACE_Local_RLock (const ACE_TCHAR *token_name,
int ignore_deadlock,
@@ -207,7 +250,9 @@ ACE_Local_RLock::ACE_Local_RLock (const ACE_TCHAR *token_name,
ACE_TRACE ("ACE_Local_RLock::ACE_Local_RLock");
this->open (token_name, ignore_deadlock, debug);
}
+
// ************************************************************
+
ACE_INLINE
ACE_Local_WLock::ACE_Local_WLock (const ACE_TCHAR *token_name,
int ignore_deadlock,
@@ -216,8 +261,10 @@ ACE_Local_WLock::ACE_Local_WLock (const ACE_TCHAR *token_name,
ACE_TRACE ("ACE_Local_WLock::ACE_Local_WLock");
this->open (token_name, ignore_deadlock, debug);
}
+
// ************************************************************
+
ACE_INLINE void
ACE_Token_Name::operator= (const ACE_Token_Name &rhs)
{
@@ -227,12 +274,16 @@ ACE_Token_Name::operator= (const ACE_Token_Name &rhs)
else
this->name (rhs.name ());
}
+
ACE_INLINE bool
ACE_Token_Name::operator== (const ACE_Token_Name &rhs) const
{
ACE_TRACE ("ACE_Token_Name::operator==");
+
// the name and type must be the same
return (ACE_OS::strcmp (this->token_name_, rhs.name ()) == 0);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_TOKENS_LIBRARY */
diff --git a/dep/ACE_wrappers/ace/Lock.cpp b/dep/ACE_wrappers/ace/Lock.cpp
index f4b5849cbca..f3fd45f4b95 100644
--- a/dep/ACE_wrappers/ace/Lock.cpp
+++ b/dep/ACE_wrappers/ace/Lock.cpp
@@ -1,65 +1,82 @@
// $Id: Lock.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Lock.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Lock.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace, Lock, "$Id: Lock.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_Lock::~ACE_Lock (void)
{
}
+
ACE_Adaptive_Lock::ACE_Adaptive_Lock (void)
: lock_ (0)
{
}
+
ACE_Adaptive_Lock::~ACE_Adaptive_Lock (void)
{
}
+
int
ACE_Adaptive_Lock::remove (void)
{
return this->lock_->remove ();
}
+
int
ACE_Adaptive_Lock::acquire (void)
{
return this->lock_->acquire ();
}
+
int
ACE_Adaptive_Lock::tryacquire (void)
{
return this->lock_->tryacquire ();
}
+
int
ACE_Adaptive_Lock::release (void)
{
return this->lock_->release ();
}
+
int
ACE_Adaptive_Lock::acquire_read (void)
{
return this->lock_->acquire_read ();
}
+
int
ACE_Adaptive_Lock::acquire_write (void)
{
return this->lock_->acquire_write ();
}
+
int
ACE_Adaptive_Lock::tryacquire_read (void)
{
return this->lock_->tryacquire_read ();
}
+
int
ACE_Adaptive_Lock::tryacquire_write (void)
{
return this->lock_->tryacquire_write ();
}
+
int
ACE_Adaptive_Lock::tryacquire_write_upgrade (void)
{
return this->lock_->tryacquire_write_upgrade ();
}
+
void
ACE_Adaptive_Lock::dump (void) const
{
@@ -67,5 +84,6 @@ ACE_Adaptive_Lock::dump (void) const
// return this->lock_->dump ();
#endif /* ACE_HAS_DUMP */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Lock.h b/dep/ACE_wrappers/ace/Lock.h
index 02358f46231..8a2db49e3d0 100644
--- a/dep/ACE_wrappers/ace/Lock.h
+++ b/dep/ACE_wrappers/ace/Lock.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file Lock.h
@@ -10,14 +11,19 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//==========================================================================
+
#ifndef ACE_LOCK_H
#define ACE_LOCK_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Lock
*
@@ -39,37 +45,45 @@ class ACE_Export ACE_Lock
public:
/// CE needs a default ctor here.
ACE_Lock (void);
+
/// Noop virtual destructor
virtual ~ACE_Lock (void);
+
/**
* Explicitly destroy the lock. Note that only one thread should
* call this method since it doesn't protect against race
* conditions.
*/
virtual int remove (void) = 0;
+
/// Block the thread until the lock is acquired. Returns -1 on
/// failure.
virtual int acquire (void) = 0;
+
/**
* Conditionally acquire the lock (i.e., won't block). Returns -1
* on failure. If we "failed" because someone else already had the
* lock, @c errno is set to @c EBUSY.
*/
virtual int tryacquire (void) = 0;
+
/// Release the lock. Returns -1 on failure.
virtual int release (void) = 0;
+
/**
* Block until the thread acquires a read lock. If the locking
* mechanism doesn't support read locks then this just calls
* <acquire>. Returns -1 on failure.
*/
virtual int acquire_read (void) = 0;
+
/**
* Block until the thread acquires a write lock. If the locking
* mechanism doesn't support read locks then this just calls
* <acquire>. Returns -1 on failure.
*/
virtual int acquire_write (void) = 0;
+
/**
* Conditionally acquire a read lock. If the locking mechanism
* doesn't support read locks then this just calls <acquire>.
@@ -77,6 +91,7 @@ public:
* already had the lock, @c errno is set to @c EBUSY.
*/
virtual int tryacquire_read (void) = 0;
+
/**
* Conditionally acquire a write lock. If the locking mechanism
* doesn't support read locks then this just calls <acquire>.
@@ -84,6 +99,7 @@ public:
* already had the lock, @c errno is set to @c EBUSY.
*/
virtual int tryacquire_write (void) = 0;
+
/**
* Conditionally try to upgrade a lock held for read to a write lock.
* If the locking mechanism doesn't support read locks then this just
@@ -91,6 +107,7 @@ public:
*/
virtual int tryacquire_write_upgrade (void) = 0;
};
+
/**
* @class ACE_Adaptive_Lock
*
@@ -109,7 +126,9 @@ public:
/// You must also override the destructor function to match with how
/// you construct the underneath <lock_>.
virtual ~ACE_Adaptive_Lock (void);
+
// = Lock/unlock operations.
+
virtual int remove (void);
virtual int acquire (void);
virtual int tryacquire (void);
@@ -120,6 +139,7 @@ public:
virtual int tryacquire_write (void);
virtual int tryacquire_write_upgrade (void);
void dump (void) const;
+
protected:
/**
* Create and initialize create the actual lcok used in the class.
@@ -127,12 +147,16 @@ protected:
* must overwrite this method for this class to work.
*/
ACE_Adaptive_Lock (void);
+
ACE_Lock *lock_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Lock.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_LOCK_H */
diff --git a/dep/ACE_wrappers/ace/Lock.inl b/dep/ACE_wrappers/ace/Lock.inl
index d08196d8f2a..7e3ae68396a 100644
--- a/dep/ACE_wrappers/ace/Lock.inl
+++ b/dep/ACE_wrappers/ace/Lock.inl
@@ -1,9 +1,12 @@
// -*- C++ -*-
//
// $Id: Lock.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_Lock::ACE_Lock (void)
{
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Lock_Adapter_T.h b/dep/ACE_wrappers/ace/Lock_Adapter_T.h
index d43e18bf6f6..1f0f4521dc5 100644
--- a/dep/ACE_wrappers/ace/Lock_Adapter_T.h
+++ b/dep/ACE_wrappers/ace/Lock_Adapter_T.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file Lock_Adapter_T.h
@@ -10,14 +11,19 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//==========================================================================
+
#ifndef ACE_LOCK_ADAPTER_T_H
#define ACE_LOCK_ADAPTER_T_H
#include /**/ "ace/pre.h"
+
#include "ace/Lock.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Lock_Adapter
*
@@ -34,65 +40,85 @@ class ACE_Lock_Adapter : public ACE_Lock
{
public:
typedef ACE_LOCKING_MECHANISM ACE_LOCK;
+
// = Initialization/Finalization methods.
+
/// Constructor. All locking requests will be forwarded to <lock>.
ACE_Lock_Adapter (ACE_LOCKING_MECHANISM &lock);
+
/// Constructor. Since no lock is provided by the user, one will be
/// created internally.
ACE_Lock_Adapter (void);
+
/// Destructor. If <lock_> was not passed in by the user, it will be
/// deleted.
virtual ~ACE_Lock_Adapter (void);
+
// = Lock accessors.
/// Block the thread until the lock is acquired.
virtual int acquire (void);
+
/// Conditionally acquire the lock (i.e., won't block).
virtual int tryacquire (void);
+
/// Release the lock.
virtual int release (void);
+
/**
* Block until the thread acquires a read lock. If the locking
* mechanism doesn't support read locks then this just calls
* <acquire>.
*/
virtual int acquire_read (void);
+
/**
* Block until the thread acquires a write lock. If the locking
* mechanism doesn't support read locks then this just calls
* <acquire>.
*/
virtual int acquire_write (void);
+
/// Conditionally acquire a read lock. If the locking mechanism
/// doesn't support read locks then this just calls <acquire>.
virtual int tryacquire_read (void);
+
/// Conditionally acquire a write lock. If the locking mechanism
/// doesn't support read locks then this just calls <acquire>.
virtual int tryacquire_write (void);
+
/**
* Conditionally try to upgrade a lock held for read to a write lock.
* If the locking mechanism doesn't support read locks then this just
* calls <acquire>. Returns 0 on success, -1 on failure.
*/
virtual int tryacquire_write_upgrade (void);
+
/// Explicitly destroy the lock.
virtual int remove (void);
+
private:
/// The concrete locking mechanism that all the methods delegate to.
ACE_LOCKING_MECHANISM *lock_;
+
/// This flag keep track of whether we are responsible for deleting
/// the lock
bool delete_lock_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Lock_Adapter_T.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Lock_Adapter_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Lock_Adapter_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
#endif /* ACE_LOCK_ADAPTER_T_H */
diff --git a/dep/ACE_wrappers/ace/Lock_Adapter_T.inl b/dep/ACE_wrappers/ace/Lock_Adapter_T.inl
index b00f7d7024d..ff102b59d4a 100644
--- a/dep/ACE_wrappers/ace/Lock_Adapter_T.inl
+++ b/dep/ACE_wrappers/ace/Lock_Adapter_T.inl
@@ -1,7 +1,9 @@
// -*- C++ -*-
//
// $Id: Lock_Adapter_T.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template <class ACE_LOCKING_MECHANISM>
ACE_INLINE
ACE_Lock_Adapter<ACE_LOCKING_MECHANISM>::ACE_Lock_Adapter (
@@ -10,4 +12,5 @@ ACE_Lock_Adapter<ACE_LOCKING_MECHANISM>::ACE_Lock_Adapter (
delete_lock_ (false)
{
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Log_Msg.cpp b/dep/ACE_wrappers/ace/Log_Msg.cpp
index 542caf149d0..1fe455c56c3 100644
--- a/dep/ACE_wrappers/ace/Log_Msg.cpp
+++ b/dep/ACE_wrappers/ace/Log_Msg.cpp
@@ -1,11 +1,14 @@
// $Id: Log_Msg.cpp 82581 2008-08-11 08:58:24Z johnnyw $
+
// We need this to get the status of ACE_NTRACE...
#include "ace/config-all.h"
+
// Turn off tracing for the duration of this file.
#if defined (ACE_NTRACE)
# undef ACE_NTRACE
#endif /* ACE_NTRACE */
#define ACE_NTRACE 1
+
#include "ace/ACE.h"
#include "ace/Thread_Manager.h"
#include "ace/Guard_T.h"
@@ -14,16 +17,20 @@
#include "ace/OS_NS_sys_time.h"
#include "ace/OS_NS_wchar.h"
#include "ace/OS_NS_signal.h"
+
#if !defined (ACE_MT_SAFE) || (ACE_MT_SAFE != 0)
# include "ace/Object_Manager_Base.h"
#endif /* ! ACE_MT_SAFE */
+
#if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
// FUZZ: disable check_for_streams_include
# include "ace/streams.h"
#endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */
+
#if defined (ACE_HAS_TRACE)
# include "ace/Trace.h"
#endif /* ACE_HAS_TRACE */
+
#include "ace/Log_Msg.h"
#include "ace/Log_Msg_Callback.h"
#include "ace/Log_Msg_IPC.h"
@@ -32,12 +39,17 @@
#include "ace/Log_Record.h"
#include "ace/Recursive_Thread_Mutex.h"
#include "ace/Stack_Trace.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Log_Msg.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace, Log_Msg, "$Id: Log_Msg.cpp 82581 2008-08-11 08:58:24Z johnnyw $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_Log_Msg)
+
// only used here... dhinton
#if defined (ACE_HAS_SYS_SIGLIST)
# if !defined (_sys_siglist)
@@ -45,10 +57,12 @@ ACE_ALLOC_HOOK_DEFINE(ACE_Log_Msg)
# endif /* !defined (sys_siglist) */
//extern char **_sys_siglist;
#endif /* ACE_HAS_SYS_SIGLIST */
+
#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
bool ACE_Log_Msg::key_created_ = 0;
# if defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || \
defined (ACE_HAS_TSS_EMULATION)
+
#if defined (ACE_MVS)
static ACE_thread_key_t the_log_msg_tss_key =
#if !defined(_LP64)
@@ -59,10 +73,12 @@ ACE_ALLOC_HOOK_DEFINE(ACE_Log_Msg)
#else
static ACE_thread_key_t the_log_msg_tss_key = 0;
#endif /* defined (ACE_MVS) */
+
ACE_thread_key_t *log_msg_tss_key (void)
{
return &the_log_msg_tss_key;
}
+
# endif /* ACE_HAS_THREAD_SPECIFIC_STORAGE || ACE_HAS_TSS_EMULATION */
#else
static ACE_Cleanup_Adapter<ACE_Log_Msg>* log_msg_cleanup = 0;
@@ -75,6 +91,7 @@ public:
}
};
#endif /* ACE_MT_SAFE */
+
#if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE) && !defined (ACE_HAS_PHARLAP)
# define ACE_LOG_MSG_SYSLOG_BACKEND ACE_Log_Msg_NT_Event_Log
#elif !defined (ACE_LACKS_UNIX_SYSLOG) && !defined (ACE_HAS_WINCE)
@@ -82,6 +99,7 @@ public:
#else
# define ACE_LOG_MSG_SYSLOG_BACKEND ACE_Log_Msg_IPC
#endif /* ! ACE_WIN32 */
+
// When doing ACE_OS::s[n]printf() calls in log(), we need to update
// the space remaining in the output buffer based on what's returned from
// the output function. If we could rely on more modern compilers, this
@@ -91,10 +109,12 @@ public:
do { if (static_cast<size_t> (LEN) > COUNT) COUNT = 0; \
else COUNT -= static_cast<size_t> (LEN); \
} while (0)
+
/// Instance count for Log_Msg - used to know when dynamically
/// allocated storage (program name and host name) can be safely
/// deleted.
int ACE_Log_Msg::instance_count_ = 0;
+
/**
* @class ACE_Log_Msg_Manager
*
@@ -110,20 +130,28 @@ class ACE_Log_Msg_Manager
public:
static ACE_Log_Msg_Backend *log_backend_;
static ACE_Log_Msg_Backend *custom_backend_;
+
static u_long log_backend_flags_;
+
static int init_backend (const u_long *flags = 0);
+
#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
//FUZZ: disable check_for_lack_ACE_OS
static void close (void);
//FUZZ: enable check_for_lack_ACE_OS
+
static ACE_Recursive_Thread_Mutex *get_lock (void);
+
private:
static ACE_Recursive_Thread_Mutex *lock_;
#endif /* ! ACE_MT_SAFE */
};
+
ACE_Log_Msg_Backend *ACE_Log_Msg_Manager::log_backend_ = 0;
ACE_Log_Msg_Backend *ACE_Log_Msg_Manager::custom_backend_ = 0;
+
u_long ACE_Log_Msg_Manager::log_backend_flags_ = 0;
+
int ACE_Log_Msg_Manager::init_backend (const u_long *flags)
{
// If flags have been supplied, and they are different from the flags
@@ -137,6 +165,7 @@ int ACE_Log_Msg_Manager::init_backend (const u_long *flags)
{
return -1;
}
+
if ((ACE_BIT_ENABLED (*flags, ACE_Log_Msg::SYSLOG)
&& ACE_BIT_DISABLED (ACE_Log_Msg_Manager::log_backend_flags_, ACE_Log_Msg::SYSLOG))
|| (ACE_BIT_DISABLED (*flags, ACE_Log_Msg::SYSLOG)
@@ -145,11 +174,14 @@ int ACE_Log_Msg_Manager::init_backend (const u_long *flags)
delete ACE_Log_Msg_Manager::log_backend_;
ACE_Log_Msg_Manager::log_backend_ = 0;
}
+
ACE_Log_Msg_Manager::log_backend_flags_ = *flags;
}
+
if (ACE_Log_Msg_Manager::log_backend_ == 0)
{
ACE_NO_HEAP_CHECK;
+
#if (defined (WIN32) || !defined (ACE_LACKS_UNIX_SYSLOG)) && !defined (ACE_HAS_WINCE) && !defined (ACE_HAS_PHARLAP)
// Allocate the ACE_Log_Msg_Backend instance.
if (ACE_BIT_ENABLED (ACE_Log_Msg_Manager::log_backend_flags_, ACE_Log_Msg::SYSLOG))
@@ -162,27 +194,35 @@ int ACE_Log_Msg_Manager::init_backend (const u_long *flags)
ACE_Log_Msg_IPC,
-1);
}
+
return 0;
}
+
#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
ACE_Recursive_Thread_Mutex *ACE_Log_Msg_Manager::lock_ = 0;
+
ACE_Recursive_Thread_Mutex *
ACE_Log_Msg_Manager::get_lock (void)
{
// This function is called by the first thread to create an ACE_Log_Msg
// instance. It makes the call while holding a mutex, so we don't have
// to grab another one here.
+
if (ACE_Log_Msg_Manager::lock_ == 0)
{
ACE_NO_HEAP_CHECK;
+
ACE_NEW_RETURN (ACE_Log_Msg_Manager::lock_,
ACE_Recursive_Thread_Mutex,
0);
}
+
if (init_backend () == -1)
return 0;
+
return ACE_Log_Msg_Manager::lock_;
}
+
void
ACE_Log_Msg_Manager::close (void)
{
@@ -194,14 +234,18 @@ ACE_Log_Msg_Manager::close (void)
// this one leak is harmless on Solaris.
delete ACE_Log_Msg::instance ();
#endif /* ACE_HAS_STHREADS && ! TSS_EMULATION && ! ACE_HAS_EXCEPTIONS */
+
// Ugly, ugly, but don't know a better way.
delete ACE_Log_Msg_Manager::lock_;
ACE_Log_Msg_Manager::lock_ = 0;
+
delete ACE_Log_Msg_Manager::log_backend_;
ACE_Log_Msg_Manager::log_backend_ = 0;
+
// we are never responsible for custom backend
ACE_Log_Msg_Manager::custom_backend_ = 0;
}
+
# if defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || \
defined (ACE_HAS_TSS_EMULATION)
/* static */
@@ -223,6 +267,7 @@ ACE_TSS_CLEANUP_NAME (void *ptr)
}
# endif /* ACE_HAS_THREAD_SPECIFIC_STORAGE || ACE_HAS_TSS_EMULATION */
#endif /* ! ACE_MT_SAFE */
+
/* static */
int
ACE_Log_Msg::exists (void)
@@ -232,6 +277,7 @@ ACE_Log_Msg::exists (void)
defined (ACE_HAS_TSS_EMULATION)
void *tss_log_msg = 0; // The actual type is ACE_Log_Msg*, but we need this
// void to keep G++ from complaining.
+
// Get the tss_log_msg from thread-specific storage.
return ACE_Log_Msg::key_created_
&& ACE_Thread::getspecific (*(log_msg_tss_key ()), &tss_log_msg) != -1
@@ -243,6 +289,7 @@ ACE_Log_Msg::exists (void)
return 1;
#endif /* ! ACE_MT_SAFE */
}
+
ACE_Log_Msg *
ACE_Log_Msg::instance (void)
{
@@ -250,12 +297,14 @@ ACE_Log_Msg::instance (void)
# if defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || \
defined (ACE_HAS_TSS_EMULATION)
// TSS Singleton implementation.
+
if (!ACE_Log_Msg::key_created_)
{
ACE_thread_mutex_t *lock =
reinterpret_cast<ACE_thread_mutex_t *> (
ACE_OS_Object_Manager::preallocated_object
[ACE_OS_Object_Manager::ACE_LOG_MSG_INSTANCE_LOCK]);
+
if (1 == ACE_OS_Object_Manager::starting_up())
//This function is called before ACE_OS_Object_Manager is
//initialized. So the lock might not be valid. Assume it's
@@ -263,10 +312,12 @@ ACE_Log_Msg::instance (void)
;
else
ACE_OS::thread_mutex_lock (lock);
+
if (!ACE_Log_Msg::key_created_)
{
// Allocate the Singleton lock.
ACE_Log_Msg_Manager::get_lock ();
+
{
ACE_NO_HEAP_CHECK;
if (ACE_Thread::keycreate (log_msg_tss_key (),
@@ -282,8 +333,10 @@ ACE_Log_Msg::instance (void)
return 0; // Major problems, this should *never* happen!
}
}
+
ACE_Log_Msg::key_created_ = true;
}
+
if (1 == ACE_OS_Object_Manager::starting_up())
//This function is called before ACE_OS_Object_Manager is
//initialized. So the lock might not be valid. Assume it's
@@ -292,12 +345,16 @@ ACE_Log_Msg::instance (void)
else
ACE_OS::thread_mutex_unlock (lock);
}
+
ACE_Log_Msg *tss_log_msg = 0;
void *temp = 0;
+
// Get the tss_log_msg from thread-specific storage.
if (ACE_Thread::getspecific (*(log_msg_tss_key ()), &temp) == -1)
return 0; // This should not happen!
+
tss_log_msg = static_cast <ACE_Log_Msg *> (temp);
+
// Check to see if this is the first time in for this thread.
if (tss_log_msg == 0)
{
@@ -309,18 +366,21 @@ ACE_Log_Msg::instance (void)
// memory leaks.
{
ACE_NO_HEAP_CHECK;
+
ACE_NEW_RETURN (tss_log_msg,
ACE_Log_Msg,
0);
// Store the dynamically allocated pointer in thread-specific
// storage. It gets deleted via the ACE_TSS_cleanup function
// when the thread terminates.
+
if (ACE_Thread::setspecific (*(log_msg_tss_key()),
reinterpret_cast<void *> (tss_log_msg))
!= 0)
return 0; // Major problems, this should *never* happen!
}
}
+
return tss_log_msg;
# else
# error "Platform must support thread-specific storage if threads are used."
@@ -331,16 +391,20 @@ ACE_Log_Msg::instance (void)
// callback, so instead we do it here.
if (ACE_Log_Msg_Manager::init_backend () == -1)
return 0;
+
// Singleton implementation.
+
if (log_msg_cleanup == 0)
{
ACE_NEW_RETURN (log_msg_cleanup, ACE_Msg_Log_Cleanup, 0);
// Register the instance for destruction at program termination.
ACE_Object_Manager::at_exit (log_msg_cleanup);
}
+
return &log_msg_cleanup->object ();
#endif /* ! ACE_MT_SAFE */
}
+
// Not inlined to help prevent having to include OS.h just to
// get ACE_DEBUG, et al, macros.
int
@@ -348,8 +412,10 @@ ACE_Log_Msg::last_error_adapter (void)
{
return ACE_OS::last_error ();
}
+
// Sets the flag in the default priority mask used to initialize
// ACE_Log_Msg instances, as well as the current per-thread instance.
+
void
ACE_Log_Msg::enable_debug_messages (ACE_Log_Priority priority)
{
@@ -357,8 +423,10 @@ ACE_Log_Msg::enable_debug_messages (ACE_Log_Priority priority)
ACE_Log_Msg *i = ACE_Log_Msg::instance ();
i->priority_mask (i->priority_mask () | priority);
}
+
// Clears the flag in the default priority mask used to initialize
// ACE_Log_Msg instances, as well as the current per-thread instance.
+
void
ACE_Log_Msg::disable_debug_messages (ACE_Log_Priority priority)
{
@@ -366,24 +434,32 @@ ACE_Log_Msg::disable_debug_messages (ACE_Log_Priority priority)
ACE_Log_Msg *i = ACE_Log_Msg::instance ();
i->priority_mask (i->priority_mask () & ~priority);
}
+
const ACE_TCHAR *
ACE_Log_Msg::program_name (void)
{
return ACE_Log_Msg::program_name_;
}
+
/// Name of the local host.
const ACE_TCHAR *ACE_Log_Msg::local_host_ = 0;
+
/// Records the program name.
const ACE_TCHAR *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.
pid_t ACE_Log_Msg::pid_ = -2;
+
/// Current offset of msg_[].
ptrdiff_t ACE_Log_Msg::msg_off_ = 0;
+
/// Default per-thread priority mask
/// By default, no priorities are enabled.
u_long ACE_Log_Msg::default_priority_mask_ = 0;
+
/// Default per-process priority mask
/// By default, all priorities are enabled.
u_long ACE_Log_Msg::process_priority_mask_ = LM_SHUTDOWN
@@ -397,17 +473,21 @@ u_long ACE_Log_Msg::process_priority_mask_ = LM_SHUTDOWN
| LM_CRITICAL
| LM_ALERT
| LM_EMERGENCY;
+
void
ACE_Log_Msg::close (void)
{
// This call needs to go here to avoid memory leaks.
ACE_MT (ACE_Log_Msg_Manager::close ());
+
// Please note that this will be called by a statement that is
// harded coded into the ACE_Object_Manager's shutdown sequence, in
// its destructor.
+
#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) && \
(defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || \
defined (ACE_HAS_TSS_EMULATION))
+
if (ACE_Log_Msg::key_created_)
{
ACE_thread_mutex_t *lock =
@@ -415,6 +495,7 @@ ACE_Log_Msg::close (void)
(ACE_OS_Object_Manager::preallocated_object
[ACE_OS_Object_Manager::ACE_LOG_MSG_INSTANCE_LOCK]);
ACE_OS::thread_mutex_lock (lock);
+
if (ACE_Log_Msg::key_created_)
{
// Clean up this ACE_Log_Msg instance and reset the TSS to
@@ -425,6 +506,7 @@ ACE_Log_Msg::close (void)
// See Bugzilla 2980 for lots of details.
ACE_Log_Msg *tss_log_msg = 0;
void *temp = 0;
+
// Get the tss_log_msg from thread-specific storage.
if (ACE_Thread::getspecific (*(log_msg_tss_key ()), &temp) != -1
&& temp)
@@ -436,47 +518,57 @@ ACE_Log_Msg::close (void)
reinterpret_cast <void *>(0)) != 0)
ACE_OS::printf ("ACE_Log_Msg::close failed to ACE_Thread::setspecific to 0\n");
}
+
// The key is not needed any longer; ACE_Log_Msg is closing
// and will need to be reopened if this process wishes to use
// logging again. So delete the key.
ACE_Thread::keyfree (*(log_msg_tss_key()));
ACE_Log_Msg::key_created_ = false;
}
+
ACE_OS::thread_mutex_unlock (lock);
}
#endif /* (ACE_HAS_THREAD_SPECIFIC_STORAGE || ACE_HAS_TSS_EMULATION) && ACE_MT_SAFE */
}
+
void
ACE_Log_Msg::sync_hook (const ACE_TCHAR *prg_name)
{
ACE_LOG_MSG->sync (prg_name);
}
+
ACE_OS_Thread_Descriptor *
ACE_Log_Msg::thr_desc_hook (void)
{
return ACE_LOG_MSG->thr_desc ();
}
+
// Call after a fork to resynchronize the PID and PROGRAM_NAME
// variables.
void
ACE_Log_Msg::sync (const ACE_TCHAR *prog_name)
{
ACE_TRACE ("ACE_Log_Msg::sync");
+
if (prog_name)
{
// Must free if already allocated!!!
ACE_OS::free ((void *) ACE_Log_Msg::program_name_);
+
// Stop heap checking, block will be freed by the destructor when
// the last ACE_Log_Msg instance is deleted.
// 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);
}
}
+
ACE_Log_Msg::pid_ = ACE_OS::getpid ();
ACE_Log_Msg::msg_off_ = 0;
}
+
u_long
ACE_Log_Msg::flags (void)
{
@@ -484,25 +576,31 @@ ACE_Log_Msg::flags (void)
u_long result;
ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon,
*ACE_Log_Msg_Manager::get_lock (), 0));
+
result = ACE_Log_Msg::flags_;
return result;
}
+
void
ACE_Log_Msg::set_flags (u_long flgs)
{
ACE_TRACE ("ACE_Log_Msg::set_flags");
ACE_MT (ACE_GUARD (ACE_Recursive_Thread_Mutex, ace_mon,
*ACE_Log_Msg_Manager::get_lock ()));
+
ACE_SET_BITS (ACE_Log_Msg::flags_, flgs);
}
+
void
ACE_Log_Msg::clr_flags (u_long flgs)
{
ACE_TRACE ("ACE_Log_Msg::clr_flags");
ACE_MT (ACE_GUARD (ACE_Recursive_Thread_Mutex, ace_mon,
*ACE_Log_Msg_Manager::get_lock ()));
+
ACE_CLR_BITS (ACE_Log_Msg::flags_, flgs);
}
+
int
ACE_Log_Msg::acquire (void)
{
@@ -513,10 +611,12 @@ ACE_Log_Msg::acquire (void)
return 0;
#endif /* ! ACE_MT_SAFE */
}
+
u_long
ACE_Log_Msg::priority_mask (u_long n_mask, MASK_TYPE mask_type)
{
u_long o_mask;
+
if (mask_type == THREAD)
{
o_mask = this->priority_mask_;
@@ -527,18 +627,22 @@ ACE_Log_Msg::priority_mask (u_long n_mask, MASK_TYPE mask_type)
o_mask = ACE_Log_Msg::process_priority_mask_;
ACE_Log_Msg::process_priority_mask_ = n_mask;
}
+
return o_mask;
}
+
int
ACE_Log_Msg::release (void)
{
ACE_TRACE ("ACE_Log_Msg::release");
+
#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
return ACE_Log_Msg_Manager::get_lock ()->release ();
#else /* ! ACE_MT_SAFE */
return 0;
#endif /* ! ACE_MT_SAFE */
}
+
ACE_Log_Msg::ACE_Log_Msg (void)
: status_ (0),
errnum_ (0),
@@ -556,16 +660,20 @@ ACE_Log_Msg::ACE_Log_Msg (void)
timestamp_ (0)
{
// ACE_TRACE ("ACE_Log_Msg::ACE_Log_Msg");
+
ACE_MT (ACE_GUARD (ACE_Recursive_Thread_Mutex, ace_mon,
*ACE_Log_Msg_Manager::get_lock ()));
++instance_count_;
+
if (this->instance_count_ == 1)
ACE_Base_Thread_Adapter::set_log_msg_hooks (ACE_Log_Msg::init_hook,
ACE_Log_Msg::inherit_hook,
ACE_Log_Msg::close,
ACE_Log_Msg::sync_hook,
ACE_Log_Msg::thr_desc_hook);
+
this->conditional_values_.is_set_ = false;
+
char *timestamp = ACE_OS::getenv ("ACE_LOG_TIMESTAMP");
if (timestamp != 0)
{
@@ -579,12 +687,16 @@ ACE_Log_Msg::ACE_Log_Msg (void)
this->timestamp_ = 2;
}
}
+
ACE_NEW_NORETURN (this->msg_, ACE_TCHAR[ACE_MAXLOGMSGLEN+1]);
}
+
ACE_Log_Msg::~ACE_Log_Msg (void)
{
#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
+
int instance_count = 0;
+
// Only hold the guard while updating the instance_count_.
// If ACE_Log_Msg_Manager::close () is called, the lock will
// be deleted.
@@ -594,9 +706,11 @@ ACE_Log_Msg::~ACE_Log_Msg (void)
instance_count = --instance_count_;
}
// Release the guard.
+
#else /* ! ACE_MT_SAFE */
int instance_count = --instance_count_;
#endif /* ! ACE_MT_SAFE */
+
// If this is the last instance then cleanup. Only the last
// thread to destroy its ACE_Log_Msg instance should execute
// this block.
@@ -605,25 +719,30 @@ ACE_Log_Msg::~ACE_Log_Msg (void)
// Destroy the message queue instance.
if (ACE_Log_Msg_Manager::log_backend_ != 0)
ACE_Log_Msg_Manager::log_backend_->close ();
+
// Close down custom backend
if (ACE_Log_Msg_Manager::custom_backend_ != 0)
ACE_Log_Msg_Manager::custom_backend_->close ();
+
# if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
# if defined (ACE_HAS_TSS_EMULATION)
ACE_Log_Msg_Manager::close ();
# endif /* ACE_HAS_TSS_EMULATION */
# endif /* ACE_MT_SAFE */
+
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_)
{
ACE_OS::free ((void *) ACE_Log_Msg::local_host_);
ACE_Log_Msg::local_host_ = 0;
}
}
+
//
// do we need to close and clean up?
//
@@ -638,9 +757,12 @@ ACE_Log_Msg::~ACE_Log_Msg (void)
ostream_ = 0;
}
#endif
+
delete[] this->msg_;
}
+
// Open the sender-side of the message queue.
+
int
ACE_Log_Msg::open (const ACE_TCHAR *prog_name,
u_long flags,
@@ -649,12 +771,15 @@ ACE_Log_Msg::open (const ACE_TCHAR *prog_name,
ACE_TRACE ("ACE_Log_Msg::open");
ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon,
*ACE_Log_Msg_Manager::get_lock (), -1));
+
if (prog_name)
{
ACE_OS::free ((void *) ACE_Log_Msg::program_name_);
+
// Stop heap checking, block will be freed by the destructor.
{
ACE_NO_HEAP_CHECK;
+
ACE_ALLOCATOR_RETURN (ACE_Log_Msg::program_name_,
ACE_OS::strdup (prog_name),
-1);
@@ -668,17 +793,23 @@ ACE_Log_Msg::open (const ACE_TCHAR *prog_name,
ACE_OS::strdup (ACE_TEXT ("<unknown>")),
-1);
}
+
int status = 0;
+
// Be sure that there is a message_queue_, with multiple threads.
ACE_MT (ACE_Log_Msg_Manager::init_backend (&flags));
+
// Always close the current handle before doing anything else.
if (ACE_Log_Msg_Manager::log_backend_ != 0)
ACE_Log_Msg_Manager::log_backend_->reset ();
+
if (ACE_Log_Msg_Manager::custom_backend_ != 0)
ACE_Log_Msg_Manager::custom_backend_->reset ();
+
// Note that if we fail to open the message queue the default action
// is to use stderr (set via static initialization in the
// Log_Msg.cpp file).
+
if (ACE_BIT_ENABLED (flags, ACE_Log_Msg::LOGGER)
|| ACE_BIT_ENABLED (flags, ACE_Log_Msg::SYSLOG))
{
@@ -689,6 +820,7 @@ ACE_Log_Msg::open (const ACE_TCHAR *prog_name,
status = -1;
else
status = ACE_Log_Msg_Manager::log_backend_->open (logger_key);
+
if (status == -1)
ACE_SET_BITS (ACE_Log_Msg::flags_, ACE_Log_Msg::STDERR);
else
@@ -707,19 +839,23 @@ ACE_Log_Msg::open (const ACE_TCHAR *prog_name,
ACE_CLR_BITS (ACE_Log_Msg::flags_, ACE_Log_Msg::SYSLOG);
ACE_SET_BITS (ACE_Log_Msg::flags_, ACE_Log_Msg::STDERR);
}
+
if (ACE_BIT_ENABLED (flags, ACE_Log_Msg::CUSTOM))
{
status =
ACE_Log_Msg_Manager::custom_backend_->open (logger_key);
+
if (status != -1)
ACE_SET_BITS (ACE_Log_Msg::flags_, ACE_Log_Msg::CUSTOM);
}
+
// 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);
+
// VERBOSE takes precedence over VERBOSE_LITE...
if (ACE_BIT_ENABLED (flags,
ACE_Log_Msg::VERBOSE_LITE))
@@ -729,6 +865,7 @@ ACE_Log_Msg::open (const ACE_TCHAR *prog_name,
ACE_Log_Msg::VERBOSE))
ACE_SET_BITS (ACE_Log_Msg::flags_,
ACE_Log_Msg::VERBOSE);
+
if (ACE_BIT_ENABLED (flags,
ACE_Log_Msg::OSTREAM))
{
@@ -738,16 +875,20 @@ ACE_Log_Msg::open (const ACE_TCHAR *prog_name,
if (this->msg_ostream () == 0)
this->msg_ostream (ACE_DEFAULT_LOG_STREAM);
}
+
if (ACE_BIT_ENABLED (flags,
ACE_Log_Msg::MSG_CALLBACK))
ACE_SET_BITS (ACE_Log_Msg::flags_,
ACE_Log_Msg::MSG_CALLBACK);
+
if (ACE_BIT_ENABLED (flags,
ACE_Log_Msg::SILENT))
ACE_SET_BITS (ACE_Log_Msg::flags_,
ACE_Log_Msg::SILENT);
+
return status;
}
+
/**
* Valid Options (prefixed by '%', as in printf format strings) include:
* 'A': print an ACE_timer_t value
@@ -792,15 +933,20 @@ ACE_Log_Msg::log (ACE_Log_Priority log_priority,
const ACE_TCHAR *format_str, ...)
{
ACE_TRACE ("ACE_Log_Msg::log");
+
// Start of variable args section.
va_list argp;
+
va_start (argp, format_str);
+
ssize_t const result = this->log (format_str,
log_priority,
argp);
va_end (argp);
+
return result;
}
+
#if defined (ACE_HAS_WCHAR)
/**
* Since this is the ANTI_TCHAR version, we need to convert
@@ -811,16 +957,21 @@ ACE_Log_Msg::log (ACE_Log_Priority log_priority,
const ACE_ANTI_TCHAR *format_str, ...)
{
ACE_TRACE ("ACE_Log_Msg::log");
+
// Start of variable args section.
va_list argp;
+
va_start (argp, format_str);
+
ssize_t const result = this->log (ACE_TEXT_ANTI_TO_TCHAR (format_str),
log_priority,
argp);
va_end (argp);
+
return result;
}
#endif /* ACE_HAS_WCHAR */
+
ssize_t
ACE_Log_Msg::log (const ACE_TCHAR *format_str,
ACE_Log_Priority log_priority,
@@ -828,15 +979,20 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
{
ACE_TRACE ("ACE_Log_Msg::log");
// External decls.
+
typedef void (*PTF)(...);
+
// Check if there were any conditional values set.
bool const conditional_values = this->conditional_values_.is_set_;
+
// Reset conditional values.
this->conditional_values_.is_set_ = false;
+
// Only print the message if <priority_mask_> hasn't been reset to
// exclude this logging priority.
if (this->log_priority_enabled (log_priority) == 0)
return 0;
+
// If conditional values were set and the log priority is correct,
// then the values are actually set.
if (conditional_values)
@@ -847,19 +1003,23 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
this->restart (),
this->msg_ostream (),
this->msg_callback ());
+
// Logging is supposed to be a benign activity (i.e., not interfer
// with normal application operations), so don't inadvertently smash
// errno!
ACE_Errno_Guard guard (errno);
+
ACE_Log_Record log_record (log_priority,
ACE_OS::gettimeofday (),
this->getpid ());
+
// bp is pointer to where to put next part of logged message.
// bspace is the number of characters remaining in msg_.
ACE_TCHAR *bp = const_cast<ACE_TCHAR *> (this->msg ());
size_t bspace = ACE_Log_Record::MAXLOGMSGLEN; // Leave room for Nul term.
if (this->msg_off_ <= ACE_Log_Record::MAXLOGMSGLEN)
bspace -= static_cast<size_t> (this->msg_off_);
+
// If this platform has snprintf() capability to prevent overrunning the
// output buffer, use it. To avoid adding a maintenance-hassle compile-
// time couple between here and OS.cpp, don't try to figure this out at
@@ -867,21 +1027,26 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
// the platform doesn't support the length-limiting capability.
ACE_TCHAR test[2];
bool can_check = ACE_OS::snprintf (test, 1, ACE_TEXT ("x")) != -1;
+
bool abort_prog = false;
int exit_value = 0;
+
if (ACE_BIT_ENABLED (ACE_Log_Msg::flags_, ACE_Log_Msg::VERBOSE))
{
// Prepend the program name onto this message
+
if (ACE_Log_Msg::program_name_ != 0)
{
for (const ACE_TCHAR *s = ACE_Log_Msg::program_name_;
bspace > 1 && (*bp = *s) != '\0';
++s, --bspace)
bp++;
+
*bp++ = '|';
--bspace;
}
}
+
if (timestamp_ > 0)
{
ACE_TCHAR day_and_time[35];
@@ -897,15 +1062,19 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
ACE::timestamp (day_and_time, sizeof day_and_time / sizeof (ACE_TCHAR));
s = day_and_time;
}
+
for (; bspace > 1 && (*bp = *s) != '\0'; ++s, --bspace)
++bp;
+
*bp++ = '|';
--bspace;
}
+
while (*format_str != '\0' && bspace > 0)
{
// Copy input to output until we encounter a %, however a
// % followed by another % is not a format specification.
+
if (*format_str != '%')
{
*bp++ = *format_str++;
@@ -930,6 +1099,7 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
// format specifier from the ACE_Log_Msg-supported list to the
// equivalent sprintf specifier, and run the new format spec
// through sprintf, adding it to the bp string.
+
const ACE_TCHAR *abort_str = ACE_TEXT ("Aborting...");
const ACE_TCHAR *start_format = format_str;
ACE_TCHAR format[128]; // Converted format string
@@ -938,8 +1108,10 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
bool done = false;
bool skip_nul_locate = false;
int this_len = 0; // How many chars s[n]printf wrote
+
fp = format;
*fp++ = *format_str++; // Copy in the %
+
// Initialization to satisfy VC6
int tmp_indent = 0;
// Work through the format string to copy in the format
@@ -948,9 +1120,11 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
// When the real format specifier is located, change it to
// one recognized by sprintf, if needed, and do the sprintf
// call.
+
while (!done)
{
done = true; // Unless a conversion spec changes it
+
switch (*format_str)
{
// The initial set of cases are the conversion
@@ -978,12 +1152,14 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
*fp++ = *format_str;
done = false;
break;
+
case '*':
wp = va_arg (argp, int);
ACE_OS::sprintf (fp, ACE_TEXT ("%d"), wp);
fp += ACE_OS::strlen (fp);
done = false;
break;
+
case 'A': // ACE_timer_t
{
ACE_OS::strcpy (fp, ACE_TEXT ("f"));
@@ -995,6 +1171,7 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
ACE_UPDATE_COUNT (bspace, this_len);
}
break;
+
case 'a': // Abort program after handling all of format string.
abort_prog = true;
exit_value = va_arg (argp, int);
@@ -1004,6 +1181,7 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
else
bspace = 0;
break;
+
case 'l': // Source file line number
ACE_OS::strcpy (fp, ACE_TEXT ("d"));
if (can_check)
@@ -1015,6 +1193,7 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
this_len = ACE_OS::sprintf (bp, format, this->linenum ());
ACE_UPDATE_COUNT (bspace, this_len);
break;
+
case 'N': // Source file name
#if !defined (ACE_WIN32) && defined (ACE_USES_WCHAR)
ACE_OS::strcpy (fp, ACE_TEXT ("ls"));
@@ -1033,6 +1212,7 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
: ACE_TEXT ("<unknown file>"));
ACE_UPDATE_COUNT (bspace, this_len);
break;
+
case 'n': // Program name
#if !defined (ACE_WIN32) && defined (ACE_USES_WCHAR)
ACE_OS::strcpy (fp, ACE_TEXT ("ls"));
@@ -1051,6 +1231,7 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
ACE_TEXT ("<unknown>"));
ACE_UPDATE_COUNT (bspace, this_len);
break;
+
case 'P': // Process ID
#if defined (ACE_OPENVMS)
// Print the process id in hex on OpenVMS.
@@ -1067,6 +1248,7 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
(bp, format, static_cast<int> (this->getpid ()));
ACE_UPDATE_COUNT (bspace, this_len);
break;
+
case 'p': // <errno> string, ala perror()
{
errno = 0;
@@ -1077,6 +1259,7 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
if (errno == 0)
{
#endif
+
#if !defined (ACE_WIN32) && defined (ACE_USES_WCHAR)
ACE_OS::strcpy (fp, ACE_TEXT ("ls: %ls"));
#else
@@ -1096,6 +1279,7 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
{
errno = ACE::map_errno (this->errnum ());
ACE_TCHAR *lpMsgBuf = 0;
+
// PharLap can't do FormatMessage, so try for socket
// error.
# if !defined (ACE_HAS_PHARLAP)
@@ -1111,6 +1295,7 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
0,
0);
# endif /* ACE_HAS_PHARLAP */
+
// If we don't get a valid response from
// <FormatMessage>, we'll assume this is a
// WinSock error and so we'll try to convert
@@ -1154,6 +1339,7 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
ACE_UPDATE_COUNT (bspace, this_len);
break;
}
+
case 'M': // Print the name of the priority of the message.
#if !defined (ACE_WIN32) && defined (ACE_USES_WCHAR)
ACE_OS::strcpy (fp, ACE_TEXT ("ls"));
@@ -1170,6 +1356,7 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
ACE_Log_Record::priority_name (log_priority));
ACE_UPDATE_COUNT (bspace, this_len);
break;
+
case 'm': // Format the string assocated with the errno value.
{
errno = 0;
@@ -1181,6 +1368,7 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
if (errno == 0)
{
#endif
+
#if !defined (ACE_WIN32) && defined (ACE_USES_WCHAR)
ACE_OS::strcpy (fp, ACE_TEXT ("ls"));
#else /* ACE_WIN32 && ACE_USES_WCHAR */
@@ -1198,6 +1386,7 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
{
errno = ACE::map_errno (this->errnum ());
ACE_TCHAR *lpMsgBuf = 0;
+
// PharLap can't do FormatMessage, so try for socket
// error.
# if !defined (ACE_HAS_PHARLAP)
@@ -1213,6 +1402,7 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
0,
0);
# endif /* ACE_HAS_PHARLAP */
+
// If we don't get a valid response from
// <FormatMessage>, we'll assume this is a
// WinSock error and so we'll try to convert
@@ -1247,6 +1437,7 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
ACE_UPDATE_COUNT (bspace, this_len);
break;
}
+
case 'R': // Format the return status of the operation.
this->op_status (va_arg (argp, int));
ACE_OS::strcpy (fp, ACE_TEXT ("d"));
@@ -1258,19 +1449,23 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
(bp, format, this->op_status ());
ACE_UPDATE_COUNT (bspace, this_len);
break;
+
case '{': // Increment the trace_depth, then indent
skip_nul_locate = true;
(void) this->inc ();
break;
+
case '}': // indent, then decrement trace_depth
skip_nul_locate = true;
(void) this->dec ();
break;
+
case '$': // insert a newline, then indent the next line
// according to %I
*bp++ = '\n';
--bspace;
/* fallthrough */
+
case 'I': // Indent with nesting_depth*width spaces
// Caller can do %*I to override nesting indent, and
// if %*I was done, wp has the extracted width.
@@ -1288,13 +1483,16 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
tmp_indent;
--tmp_indent)
*bp++ = ' ';
+
*bp = '\0';
bspace -= static_cast<size_t> (wp);
skip_nul_locate = true;
break;
+
case 'r': // Run (invoke) this subroutine.
{
ptrdiff_t const osave = ACE_Log_Msg::msg_off_;
+
if (ACE_BIT_ENABLED (ACE_Log_Msg::flags_,
ACE_Log_Msg::SILENT) &&
bspace > 1)
@@ -1303,7 +1501,9 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
--bspace;
}
ACE_Log_Msg::msg_off_ = bp - this->msg_;
+
(*va_arg (argp, PTF))();
+
if (ACE_BIT_ENABLED (ACE_Log_Msg::flags_,
ACE_Log_Msg::SILENT) &&
bspace > (1 + ACE_OS::strlen (bp)))
@@ -1317,6 +1517,7 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
ACE_Log_Msg::msg_off_ = osave;
break;
}
+
case 'S': // format the string for with this signal number.
{
int sig = va_arg (argp, int);
@@ -1352,6 +1553,7 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
ACE_UPDATE_COUNT (bspace, this_len);
break;
}
+
case 'D': // Format the timestamp in format:
// Weekday Month day year hour:minute:sec.usec
{
@@ -1371,6 +1573,7 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
ACE_UPDATE_COUNT (bspace, this_len);
break;
}
+
case 'T': // Format the timestamp in
// hour:minute:sec:usec format.
{
@@ -1391,6 +1594,7 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
ACE_UPDATE_COUNT (bspace, this_len);
break;
}
+
case 't': // Format thread id.
#if defined (ACE_WIN32)
ACE_OS::strcpy (fp, ACE_TEXT ("u"));
@@ -1412,6 +1616,7 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
# else
ACE_Thread::self ();
# endif /* ACE_HAS_THREADS */
+
if (can_check)
this_len = ACE_OS::snprintf (bp, bspace, format, id);
else
@@ -1420,6 +1625,7 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
#else
ACE_hthread_t t_id;
ACE_Thread::self (t_id);
+
# if defined (ACE_MVS) || defined (ACE_TANDEM_T1248_PTHREADS)
// MVS's pthread_t is a struct... yuck. So use the ACE 5.0
// code for it.
@@ -1442,9 +1648,11 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
this_len = ACE_OS::sprintf
(bp, format, (unsigned long)t_id);
# endif /* ACE_MWS || ACE_TANDEM_T1248_PTHREADS */
+
#endif /* ACE_WIN32 */
ACE_UPDATE_COUNT (bspace, this_len);
break;
+
case 's': // String
{
#if !defined (ACE_WIN32) && defined (ACE_USES_WCHAR)
@@ -1463,6 +1671,7 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
ACE_UPDATE_COUNT (bspace, this_len);
}
break;
+
case 'C': // Narrow-char string
{
char *cstr = va_arg (argp, char *);
@@ -1480,6 +1689,7 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
ACE_UPDATE_COUNT (bspace, this_len);
}
break;
+
case 'W':
{
#if defined (ACE_HAS_WCHAR)
@@ -1505,6 +1715,7 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
ACE_UPDATE_COUNT (bspace, this_len);
}
break;
+
case 'w': // Wide character
#if defined (ACE_WIN32)
# if defined (ACE_USES_WCHAR)
@@ -1541,6 +1752,7 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
#endif /* ACE_WIN32 */
ACE_UPDATE_COUNT (bspace, this_len);
break;
+
case 'z': // ACE_OS::WChar character
{
// On some platforms sizeof (wchar_t) can be 2
@@ -1569,11 +1781,13 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
ACE_UPDATE_COUNT (bspace, this_len);
break;
}
+
case 'Z': // ACE_OS::WChar character string
{
ACE_OS::WChar *wchar_str = va_arg (argp, ACE_OS::WChar*);
if (wchar_str == 0)
break;
+
wchar_t *wchar_t_str = 0;
if (sizeof (ACE_OS::WChar) != sizeof (wchar_t))
{
@@ -1581,11 +1795,13 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
ACE_NEW_NORETURN(wchar_t_str, wchar_t[len]);
if (wchar_t_str == 0)
break;
+
for (size_t i = 0; i < len; ++i)
{
wchar_t_str[i] = wchar_str[i];
}
}
+
if (wchar_t_str == 0)
{
wchar_t_str = reinterpret_cast<wchar_t*> (wchar_str);
@@ -1615,6 +1831,7 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
ACE_UPDATE_COUNT (bspace, this_len);
break;
}
+
case 'c':
#if defined (ACE_WIN32) && defined (ACE_USES_WCHAR)
ACE_OS::strcpy (fp, ACE_TEXT ("C"));
@@ -1629,6 +1846,7 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
(bp, format, va_arg (argp, int));
ACE_UPDATE_COUNT (bspace, this_len);
break;
+
case 'd': case 'i': case 'o':
case 'u': case 'x': case 'X':
fp[0] = *format_str;
@@ -1641,6 +1859,7 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
(bp, format, va_arg (argp, int));
ACE_UPDATE_COUNT (bspace, this_len);
break;
+
case 'F': case 'f': case 'e': case 'E':
case 'g': case 'G':
fp[0] = *format_str;
@@ -1653,6 +1872,7 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
(bp, format, va_arg (argp, double));
ACE_UPDATE_COUNT (bspace, this_len);
break;
+
case 'Q':
#if defined (ACE_LACKS_LONGLONG_T) || defined (ACE_LACKS_UNSIGNEDLONGLONG_T)
{
@@ -1684,6 +1904,7 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
#endif /* ! ACE_LACKS_LONGLONG_T || ACE_LACKS_UNSIGNEDLONGLONG_T */
ACE_UPDATE_COUNT (bspace, this_len);
break;
+
case 'q':
#if defined (ACE_LACKS_LONGLONG_T)
// No implementation available yet, no ACE_INT64 emulation
@@ -1704,6 +1925,7 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
#endif /* ! ACE_LACKS_LONGLONG_T */
ACE_UPDATE_COUNT (bspace, this_len);
break;
+
case 'b':
{
const ACE_TCHAR *fmt = ACE_SSIZE_T_FORMAT_SPECIFIER;
@@ -1719,6 +1941,7 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
va_arg (argp, ssize_t));
ACE_UPDATE_COUNT (bspace, this_len);
break;
+
case 'B':
{
const ACE_TCHAR *fmt = ACE_SIZE_T_FORMAT_SPECIFIER;
@@ -1734,12 +1957,14 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
va_arg (argp, size_t));
ACE_UPDATE_COUNT (bspace, this_len);
break;
+
case ':':
{
// Assume a 32 bit time_t and change if needed.
const ACE_TCHAR *fmt = ACE_TEXT ("%d");
if (sizeof (time_t) == 8)
fmt = ACE_INT64_FORMAT_SPECIFIER;
+
ACE_OS::strcpy (fp, &fmt[1]); // Skip leading %
}
if (can_check)
@@ -1752,6 +1977,7 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
va_arg (argp, time_t));
ACE_UPDATE_COUNT (bspace, this_len);
break;
+
case '@':
ACE_OS::strcpy (fp, ACE_TEXT ("p"));
if (can_check)
@@ -1762,6 +1988,7 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
(bp, format, va_arg (argp, void*));
ACE_UPDATE_COUNT (bspace, this_len);
break;
+
case '?':
// Stack trace up to this point
{
@@ -1778,6 +2005,7 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
break;
}
+
default:
// So, it's not a legit format specifier after all...
// Copy from the original % to where we are now, then
@@ -1794,16 +2022,21 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
}
break;
}
+
// Bump to the next char in the caller's format_str
++format_str;
}
+
if (!skip_nul_locate)
while (*bp != '\0') // Locate end of bp.
++bp;
}
}
+
*bp = '\0'; // Terminate bp, but don't auto-increment this!
+
ssize_t result = 0;
+
// Check that memory was not corrupted, if it corrupted we can't log anything
// anymore because all our members could be corrupted.
if (bp >= (this->msg_ + ACE_MAXLOGMSGLEN+1))
@@ -1817,23 +2050,28 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
// Copy the message from thread-specific storage into the transfer
// buffer (this can be optimized away by changing other code...).
log_record.msg_data (this->msg ());
+
// Write the <log_record> to the appropriate location.
result = this->log (log_record,
abort_prog);
}
+
if (abort_prog)
{
// Since we are now calling abort instead of exit, this value is
// not used.
ACE_UNUSED_ARG (exit_value);
+
// *Always* print a message to stderr if we're aborting. We
// don't use verbose, however, to avoid recursive aborts if
// something is hosed.
log_record.print (ACE_Log_Msg::local_host_, 0, stderr);
ACE_OS::abort ();
}
+
return result;
}
+
#if !defined (ACE_WIN32)
/**
* @class ACE_Log_Msg_Sig_Guard
@@ -1848,15 +2086,19 @@ class ACE_Log_Msg_Sig_Guard
private:
ACE_Log_Msg_Sig_Guard (void);
~ACE_Log_Msg_Sig_Guard (void);
+
/// Original signal mask.
sigset_t omask_;
+
friend ssize_t ACE_Log_Msg::log (ACE_Log_Record &log_record,
int suppress_stderr);
};
+
ACE_Log_Msg_Sig_Guard::ACE_Log_Msg_Sig_Guard (void)
{
#if !defined (ACE_LACKS_UNIX_SIGNALS)
ACE_OS::sigemptyset (&this->omask_);
+
# if defined (ACE_LACKS_PTHREAD_THR_SIGSETMASK)
ACE_OS::sigprocmask (SIG_BLOCK,
ACE_OS_Object_Manager::default_mask (),
@@ -1868,6 +2110,7 @@ ACE_Log_Msg_Sig_Guard::ACE_Log_Msg_Sig_Guard (void)
# endif /* ACE_LACKS_PTHREAD_THR_SIGSETMASK */
#endif /* ACE_LACKS_UNIX_SIGNALS */
}
+
ACE_Log_Msg_Sig_Guard::~ACE_Log_Msg_Sig_Guard (void)
{
#if !defined (ACE_LACKS_UNIX_SIGNALS)
@@ -1883,11 +2126,13 @@ ACE_Log_Msg_Sig_Guard::~ACE_Log_Msg_Sig_Guard (void)
#endif /* ! ACE_LACKS_UNIX_SIGNALS */
}
#endif /* ! ACE_WIN32 */
+
ssize_t
ACE_Log_Msg::log (ACE_Log_Record &log_record,
int suppress_stderr)
{
ssize_t result = 0;
+
// Format the message and print it to stderr and/or ship it off to
// the log_client daemon, and/or print it to the ostream. Of
// course, only print the message if "SILENT" mode is disabled.
@@ -1896,10 +2141,12 @@ ACE_Log_Msg::log (ACE_Log_Record &log_record,
{
bool tracing = this->tracing_enabled ();
this->stop_tracing ();
+
#if !defined (ACE_WIN32)
// Make this block signal-safe.
ACE_Log_Msg_Sig_Guard sb;
#endif /* !ACE_WIN32 */
+
// Do the callback, if needed, before acquiring the lock
// to avoid holding the lock during the callback so we don't
// have deadlock if the callback uses the logger.
@@ -1907,16 +2154,19 @@ ACE_Log_Msg::log (ACE_Log_Record &log_record,
ACE_Log_Msg::MSG_CALLBACK)
&& this->msg_callback () != 0)
this->msg_callback ()->log (log_record);
+
// Make sure that the lock is held during all this.
ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon,
*ACE_Log_Msg_Manager::get_lock (),
-1));
+
if (ACE_BIT_ENABLED (ACE_Log_Msg::flags_,
ACE_Log_Msg::STDERR)
&& !suppress_stderr) // This is taken care of by our caller.
log_record.print (ACE_Log_Msg::local_host_,
ACE_Log_Msg::flags_,
stderr);
+
if (ACE_BIT_ENABLED (ACE_Log_Msg::flags_, ACE_Log_Msg::CUSTOM) ||
ACE_BIT_ENABLED (ACE_Log_Msg::flags_, ACE_Log_Msg::SYSLOG) ||
ACE_BIT_ENABLED (ACE_Log_Msg::flags_, ACE_Log_Msg::LOGGER))
@@ -1925,12 +2175,14 @@ ACE_Log_Msg::log (ACE_Log_Record &log_record,
ACE_MT (ACE_Log_Msg_Manager::init_backend ());
}
+
if (ACE_BIT_ENABLED (ACE_Log_Msg::flags_, ACE_Log_Msg::LOGGER) ||
ACE_BIT_ENABLED (ACE_Log_Msg::flags_, ACE_Log_Msg::SYSLOG))
{
result =
ACE_Log_Msg_Manager::log_backend_->log (log_record);
}
+
if (ACE_BIT_ENABLED (ACE_Log_Msg::flags_, ACE_Log_Msg::CUSTOM) &&
ACE_Log_Msg_Manager::custom_backend_ != 0)
{
@@ -1938,6 +2190,7 @@ ACE_Log_Msg::log (ACE_Log_Record &log_record,
ACE_Log_Msg_Manager::custom_backend_->log (log_record);
}
+
// This must come last, after the other two print operations
// (see the <ACE_Log_Record::print> method for details).
if (ACE_BIT_ENABLED (ACE_Log_Msg::flags_,
@@ -1951,12 +2204,16 @@ ACE_Log_Msg::log (ACE_Log_Record &log_record,
*this->msg_ostream ()
#endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */
);
+
if (tracing)
this->start_tracing ();
}
+
return result;
}
+
// Calls log to do the actual print, but formats first.
+
int
ACE_Log_Msg::log_hexdump (ACE_Log_Priority log_priority,
const char *buffer,
@@ -1967,43 +2224,54 @@ ACE_Log_Msg::log_hexdump (ACE_Log_Priority log_priority,
// exclude this logging priority.
if (this->log_priority_enabled (log_priority) == 0)
return 0;
+
ACE_TCHAR* buf = 0;
const size_t buf_sz =
ACE_Log_Record::MAXLOGMSGLEN - ACE_Log_Record::VERBOSE_LEN - 58;
ACE_NEW_RETURN (buf, ACE_TCHAR[buf_sz], -1);
+
ACE_TCHAR *msg_buf = 0;
const size_t text_sz = text ? ACE_OS::strlen(text) : 0;
ACE_NEW_RETURN (msg_buf,
ACE_TCHAR[text_sz + 58],
-1);
+
buf[0] = 0; // in case size = 0
+
size_t const len = ACE::format_hexdump
(buffer, size, buf, buf_sz / sizeof (ACE_TCHAR) - text_sz);
+
int sz = 0;
+
if (text)
sz = ACE_OS::sprintf (msg_buf,
ACE_TEXT ("%s - "),
text);
+
sz += ACE_OS::sprintf (msg_buf + sz,
ACE_TEXT ("HEXDUMP ")
ACE_SIZE_T_FORMAT_SPECIFIER
ACE_TEXT (" bytes"),
size);
+
if (len < size)
ACE_OS::sprintf (msg_buf + sz,
ACE_TEXT (" (showing first ")
ACE_SIZE_T_FORMAT_SPECIFIER
ACE_TEXT (" bytes)"),
len);
+
// Now print out the formatted buffer.
this->log (log_priority,
ACE_TEXT ("%s\n%s"),
msg_buf,
buf);
+
delete [] msg_buf;
delete [] buf;
return 0;
}
+
void
ACE_Log_Msg::set (const char *filename,
int line,
@@ -2022,6 +2290,7 @@ ACE_Log_Msg::set (const char *filename,
this->msg_ostream (os);
this->msg_callback (c);
}
+
void
ACE_Log_Msg::conditional_set (const char *filename,
int line,
@@ -2034,11 +2303,13 @@ ACE_Log_Msg::conditional_set (const char *filename,
this->conditional_values_.op_status_ = status;
this->conditional_values_.errnum_ = err;
}
+
void
ACE_Log_Msg::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_Log_Msg::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("status_ = %d\n"), this->status_));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nerrnum_ = %d\n"), this->errnum_));
@@ -2069,65 +2340,80 @@ ACE_Log_Msg::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nthr_state_ = %d\n"),
this->thr_desc_->state ()));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nmsg_off_ = %d\n"), this->msg_off_));
+
// Be sure that there is a message_queue_, with multiple threads.
ACE_MT (ACE_Log_Msg_Manager::init_backend ());
+
ACE_MT (ACE_Log_Msg_Manager::get_lock ()->dump ());
// Synchronize output operations.
+
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
void
ACE_Log_Msg::thr_desc (ACE_Thread_Descriptor *td)
{
this->thr_desc_ = td;
+
if (td != 0)
td->acquire_release ();
}
+
#if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS) && defined(ACE_LEGACY_MODE)
ACE_SEH_EXCEPT_HANDLER
ACE_Log_Msg::seh_except_selector (void)
{
return ACE_OS_Object_Manager::seh_except_selector ();
}
+
ACE_SEH_EXCEPT_HANDLER
ACE_Log_Msg::seh_except_selector (ACE_SEH_EXCEPT_HANDLER n)
{
return ACE_OS_Object_Manager::seh_except_selector (n);
}
+
ACE_SEH_EXCEPT_HANDLER
ACE_Log_Msg::seh_except_handler (void)
{
return ACE_OS_Object_Manager::seh_except_handler ();
}
+
ACE_SEH_EXCEPT_HANDLER
ACE_Log_Msg::seh_except_handler (ACE_SEH_EXCEPT_HANDLER n)
{
return ACE_OS_Object_Manager::seh_except_handler (n);
}
#endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS && ACE_LEGACY_MODE */
+
ACE_Log_Msg_Backend *
ACE_Log_Msg::msg_backend (ACE_Log_Msg_Backend *b)
{
ACE_TRACE ("ACE_Log_Msg::msg_backend");
ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon,
*ACE_Log_Msg_Manager::get_lock (), 0));
+
ACE_Log_Msg_Backend *tmp = ACE_Log_Msg_Manager::custom_backend_;
ACE_Log_Msg_Manager::custom_backend_ = b;
return tmp;
}
+
ACE_Log_Msg_Backend *
ACE_Log_Msg::msg_backend (void)
{
ACE_TRACE ("ACE_Log_Msg::msg_backend");
ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon,
*ACE_Log_Msg_Manager::get_lock (), 0));
+
return ACE_Log_Msg_Manager::custom_backend_;
}
+
void
ACE_Log_Msg::msg_ostream (ACE_OSTREAM_TYPE *m, bool delete_ostream)
{
if (this->ostream_ == m)
return;
+
if (this->delete_ostream_)
{
#if defined (ACE_LACKS_IOSTREAM_TOTALLY)
@@ -2136,9 +2422,11 @@ ACE_Log_Msg::msg_ostream (ACE_OSTREAM_TYPE *m, bool delete_ostream)
delete this->ostream_;
#endif
}
+
this->delete_ostream_ = delete_ostream;
this->ostream_ = m;
}
+
void
ACE_Log_Msg::local_host (const ACE_TCHAR *s)
{
@@ -2147,10 +2435,12 @@ ACE_Log_Msg::local_host (const ACE_TCHAR *s)
ACE_OS::free ((void *) ACE_Log_Msg::local_host_);
{
ACE_NO_HEAP_CHECK;
+
ACE_ALLOCATOR (ACE_Log_Msg::local_host_, ACE_OS::strdup (s));
}
}
}
+
int
ACE_Log_Msg::log_priority_enabled (ACE_Log_Priority log_priority,
const char *,
@@ -2158,6 +2448,7 @@ ACE_Log_Msg::log_priority_enabled (ACE_Log_Priority log_priority,
{
return this->log_priority_enabled (log_priority);
}
+
#if defined (ACE_USES_WCHAR)
int
ACE_Log_Msg::log_priority_enabled (ACE_Log_Priority log_priority,
@@ -2167,7 +2458,9 @@ ACE_Log_Msg::log_priority_enabled (ACE_Log_Priority log_priority,
return this->log_priority_enabled (log_priority);
}
#endif /* ACE_USES_WCHAR */
+
// ****************************************************************
+
void
ACE_Log_Msg::init_hook (ACE_OS_Log_Msg_Attributes &attributes
# if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS)
@@ -2190,6 +2483,7 @@ ACE_Log_Msg::init_hook (ACE_OS_Log_Msg_Attributes &attributes
attributes.trace_depth_ = inherit_log->trace_depth ();
}
}
+
void
ACE_Log_Msg::inherit_hook (ACE_OS_Thread_Descriptor *thr_desc,
ACE_OS_Log_Msg_Attributes &attributes)
@@ -2200,20 +2494,26 @@ ACE_Log_Msg::inherit_hook (ACE_OS_Thread_Descriptor *thr_desc,
// <ACE_Log_Msg>. Note that all of the following operations occur
// within thread-specific storage.
ACE_Log_Msg *new_log = ACE_LOG_MSG;
+
// Note that we do not inherit the callback because this might have
// been allocated off of the stack of the original thread, in which
// case all hell would break loose...
+
if (attributes.ostream_)
{
new_log->msg_ostream (attributes.ostream_);
new_log->priority_mask (attributes.priority_mask_);
+
if (attributes.tracing_enabled_)
new_log->start_tracing ();
+
new_log->restart (attributes.restart_);
new_log->trace_depth (attributes.trace_depth_);
}
+
// @@ Now the TSS Log_Msg has been created, cache my thread
// descriptor in.
+
if (thr_desc != 0)
// This downcast is safe. We do it to avoid having to #include
// ace/Thread_Manager.h.
@@ -2222,5 +2522,6 @@ ACE_Log_Msg::inherit_hook (ACE_OS_Thread_Descriptor *thr_desc,
// thread manager has thread descriptor ready.
#endif /* ! ACE_THREADS_DONT_INHERIT_LOG_MSG && ! ACE_HAS_MINIMAL_ACE_OS */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Log_Msg.h b/dep/ACE_wrappers/ace/Log_Msg.h
index 4dc2e91fc43..f799a6500ae 100644
--- a/dep/ACE_wrappers/ace/Log_Msg.h
+++ b/dep/ACE_wrappers/ace/Log_Msg.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Log_Msg.h
@@ -8,9 +9,11 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_LOG_MSG_H
#define ACE_LOG_MSG_H
#include /**/ "ace/pre.h"
+
// This stuff must come first to avoid problems with circular
// headers...
// ... but ACE_NDEBUG and ACE_NLOGGING can come from the config.h file, so
@@ -21,9 +24,11 @@
#include "ace/Default_Constants.h"
#include "ace/Log_Priority.h"
#include "ace/os_include/os_limits.h"
+
// The ACE_ASSERT macro used to be defined here, include ace/Assert.h
// for backwards compatibility.
#include "ace/Assert.h"
+
#if defined (ACE_NLOGGING)
#define ACE_HEX_DUMP(X) do {} while (0)
#define ACE_RETURN(Y) do { return (Y); } while (0)
@@ -91,28 +96,39 @@
#define ACE_ERROR_BREAK(X) { ACE_ERROR (X); break; }
#endif
#endif /* ACE_NLOGGING */
+
#include "ace/OS_Log_Msg_Attributes.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
// These workarounds are necessary for nasty libraries or platforms
// that #define STDERR or THREAD (e.g. LynxOS). We simply #undef
// these macros as there is no way to save the macro definition using
// the pre-processor. See Bugzilla Bug #299 for more info.
+
#if defined (STDERR)
# undef STDERR
#endif /* STDERR */
+
#if defined (THREAD)
# undef THREAD
#endif /* THREAD */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Log_Msg_Callback;
class ACE_Log_Msg_Backend;
+
// ****************************************************************
+
#define ACE_LOG_MSG ACE_Log_Msg::instance ()
+
// Forward declaration
class ACE_Thread_Descriptor;
class ACE_Log_Record;
+
/**
* @class ACE_Log_Msg
*
@@ -171,25 +187,35 @@ public:
/// Write messages to the user provided backend
CUSTOM = 256
};
+
// = Initialization and termination routines.
+
/// Returns a pointer to the Singleton.
static ACE_Log_Msg *instance (void);
+
/// Returns last error.
static int last_error_adapter (void);
+
/// Returns non-null if an ACE_Log_Msg exists for the calling thread.
static int exists (void);
+
/// Returns the current program name used for logging.
static const ACE_TCHAR * program_name (void);
+
/// Clears the flag from the default priority mask used to
/// initialize ACE_Log_Msg instances.
static void disable_debug_messages (ACE_Log_Priority priority = LM_DEBUG);
+
/// Sets the flag in the default priority mask used to initialize
/// ACE_Log_Msg instances.
static void enable_debug_messages (ACE_Log_Priority priority = LM_DEBUG);
+
/// Initialize logger.
ACE_Log_Msg (void);
+
/// cleanup logger.
~ACE_Log_Msg (void);
+
/// Initialize the ACE logging facility.
/**
* Initialize the ACE logging facility. Supplies the program name
@@ -212,19 +238,24 @@ public:
int open (const ACE_TCHAR *prog_name,
u_long options_flags = ACE_Log_Msg::STDERR,
const ACE_TCHAR *logger_key = 0);
+
// = Set/get the options flags.
+
/**
* Enable the bits in the logger's options flags.
*/
void set_flags (u_long f);
+
/**
* Disable the bits in the logger's options flags.
*/
void clr_flags (u_long f);
+
/**
* Return the bits in the logger's options flags.
*/
u_long flags (void);
+
/** @name Allow apps to acquire and release internal synchronization
* lock
*
@@ -233,59 +264,80 @@ public:
* lock atomically over a number of calls to ACE_Log_Msg.
*/
//@{
+
/// Acquire the internal lock.
int acquire (void);
+
/// Release the internal lock.
int release (void);
//@}
+
/// Call after doing a @c fork() to resynchronize the process id and
/// @c program_name_ variables.
void sync (const ACE_TCHAR *program_name);
+
// = Set/get methods. Note that these are non-static and thus will
// be thread-specific.
+
/// Set the result of the operation status (by convention, -1 means
/// error).
void op_status (int status);
+
/// Get the result of the operation status (by convention, -1 means
/// error).
int op_status (void) const;
+
/// Set the value of the errnum (by convention this corresponds to
/// errno).
void errnum (int);
+
/// Get the value of the errnum (by convention this corresponds to
/// errno).
int errnum (void) const;
+
/// Set the line number where an error occurred.
void linenum (int);
+
/// Get the line number where an error occurred.
int linenum (void) const;
+
/// Set the file name where an error occurred.
void file (const char *);
+
/// Get the file name where an error occurred.
const char *file (void);
+
/// Set the message that describes what type of error occurred.
void msg (const ACE_TCHAR *);
+
/// Get the message that describes what type of error occurred.
const ACE_TCHAR *msg (void);
+
/// Set the field that indicates whether interrupted calls should be
/// restarted.
void restart (int);
+
/// Get the field that indicates whether interrupted calls should be
/// restarted.
int restart (void) const;
+
// = Notice that the following two function is equivalent to
// "void msg_ostream (HANDLE)" and "HANDLE msg_ostream (void)"
// on Windows CE. There is no <iostream.h> support on CE.
+
/// Update the ostream without overwriting the delete_ostream_ flag.
void msg_ostream (ACE_OSTREAM_TYPE *);
+
/**
* delete_stream == true, forces Log_Msg.h to delete the stream in
* its own ~dtor (assumes control of the stream)
* use only with proper ostream (eg: fstream), not (cout, cerr)
*/
void msg_ostream (ACE_OSTREAM_TYPE *, bool delete_ostream);
+
/// Get the ostream that is used to print error messages.
ACE_OSTREAM_TYPE *msg_ostream (void) const;
+
/**
* Set a new callback object and return the existing callback to
* allow "chaining". Note that ACE_Log_Msg_Callback objects are not
@@ -294,6 +346,7 @@ public:
*/
ACE_Log_Msg_Callback *msg_callback (ACE_Log_Msg_Callback *c);
ACE_Log_Msg_Callback *msg_callback (void) const;
+
/**
* Set a new backend object and return the existing backend to
* allow "chaining". Note that as opposed to ACE_Log_Msg_Callback,
@@ -306,26 +359,35 @@ public:
*/
static ACE_Log_Msg_Backend *msg_backend (ACE_Log_Msg_Backend *b);
static ACE_Log_Msg_Backend *msg_backend (void);
+
/// Nesting depth increment.
int inc (void);
+
/// Nesting depth decrement.
int dec (void);
+
/// Get trace depth.
int trace_depth (void) const;
+
/// Set trace depth.
void trace_depth (int);
+
/// Get trace active status.
bool trace_active (void) const;
+
/// Set trace active status.
void trace_active (bool value);
+
/// Get the TSS thread descriptor.
ACE_Thread_Descriptor *thr_desc (void) const;
+
/**
* Set the TSS thread descriptor. This method will call
* td->acquire_release to block execution until this call
* return.
*/
void thr_desc (ACE_Thread_Descriptor *td);
+
#if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS) && defined(ACE_LEGACY_MODE)
// These functions are disabled without ACE_LEGACY_MODE
// because the *semantics* have changed (the objects are no longer
@@ -333,38 +395,50 @@ public:
/// Get TSS exception action.
/// @note The action is no longer TSS, they are global!
ACE_SEH_EXCEPT_HANDLER seh_except_selector (void);
+
/// Set TSS exception action.
/// @note The action is no longer TSS, they are global!
ACE_SEH_EXCEPT_HANDLER seh_except_selector (ACE_SEH_EXCEPT_HANDLER);
+
/// Get TSS exception handler.
/// @note The handler is no longer TSS, they are global!
ACE_SEH_EXCEPT_HANDLER seh_except_handler (void);
+
/// Set TSS exception handler.
/// @note The handler is no longer TSS, they are global!
ACE_SEH_EXCEPT_HANDLER seh_except_handler (ACE_SEH_EXCEPT_HANDLER);
#endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS && ACE_LEGACY_MODE */
+
/// Stop tracing status on a per-thread basis...
void stop_tracing (void);
+
/// Start tracing status on a per-thread basis...
void start_tracing (void);
+
/// Query tracing status on a per-thread basis...
bool tracing_enabled (void) const;
+
typedef enum
{
PROCESS = 0,
THREAD = 1
} MASK_TYPE;
+
// = Get/set the priority mask.
/// Get the current ACE_Log_Priority mask.
u_long priority_mask (MASK_TYPE = THREAD);
+
/// Set the ACE_Log_Priority mask, returns original mask.
u_long priority_mask (u_long, MASK_TYPE = THREAD);
+
/// Return true if the requested priority is enabled.
int log_priority_enabled (ACE_Log_Priority log_priority);
+
/// Return true if the requested priority is enabled.
int log_priority_enabled (ACE_Log_Priority log_priority,
const char *,
...);
+
#if defined (ACE_USES_WCHAR)
// We are not using ACE_TCHAR for this since ACE_HEX_DUMP
// doesn't take in a ACE_TCHAR. log_hexdump takes in a char
@@ -375,13 +449,17 @@ public:
const wchar_t *,
...);
#endif /* ACE_USES_WCHAR */
+
/// Optimize reading of the pid (avoids a system call if the value is
/// cached...).
pid_t getpid (void) const;
+
/// Get the name of the local host.
const ACE_TCHAR *local_host (void) const;
+
/// Set the name of the local host.
void local_host (const ACE_TCHAR *);
+
/**
* Set the line number, file name, operational status, error number,
* restart flag, ostream, and the callback object. This combines
@@ -394,12 +472,14 @@ public:
int restart = 1,
ACE_OSTREAM_TYPE *os = 0,
ACE_Log_Msg_Callback *c = 0);
+
/// These values are only actually set if the requested priority is
/// enabled.
void conditional_set (const char *file,
int line,
int op_status,
int errnum);
+
/**
* Format a message to the thread-safe ACE logging mechanism. Valid
* options (prefixed by '%', as in printf format strings) include:
@@ -447,9 +527,11 @@ public:
* - '?': print out stack trace (see Stack_Trace.h header comments)
*/
ssize_t log (ACE_Log_Priority priority, const ACE_TCHAR *format, ...);
+
#if defined (ACE_HAS_WCHAR)
ssize_t log (ACE_Log_Priority priority, const ACE_ANTI_TCHAR *format, ...);
#endif /* ACE_HAS_WCHAR */
+
/**
* An alternative logging mechanism that makes it possible to
* integrate variable argument lists from other logging mechanisms
@@ -458,10 +540,12 @@ public:
ssize_t log (const ACE_TCHAR *format,
ACE_Log_Priority priority,
va_list argp);
+
/// Log a custom built log record to the currently enabled logging
/// sinks.
ssize_t log (ACE_Log_Record &log_record,
int suppress_stderr = 0);
+
/**
* Method to log hex dump. This is useful for debugging. Calls
* log() to do the actual print, but formats first to make the chars
@@ -471,6 +555,7 @@ public:
const char *buffer,
size_t size,
const ACE_TCHAR *text = 0);
+
static void init_hook (ACE_OS_Log_Msg_Attributes &attributes
# if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS)
, ACE_SEH_EXCEPT_HANDLER selector = 0
@@ -482,6 +567,7 @@ public:
* @a attributes argument
*/
);
+
/**
* Inherit hook, the @a attributes field is a ACE_OS_Log_Msg_Attributes
* object, invoke the inherit_log_msg() method on it, then destroy
@@ -489,38 +575,53 @@ public:
*/
static void inherit_hook (ACE_OS_Thread_Descriptor *thr_desc,
ACE_OS_Log_Msg_Attributes &attributes);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Status of operation (-1 means failure, >= 0 means success).
int status_;
+
/// Type of error that occurred (see <sys/errno.h>).
int errnum_;
+
/// Line number where the error occurred.
int linenum_;
+
/// File where the error occurred.
char file_[MAXPATHLEN + 1];
+
/// The log message, which resides in thread-specific storage. Note
/// that only the current log message is stored here -- it will be
/// overwritten by the subsequent call to log().
ACE_TCHAR* msg_; // Add one for NUL-terminator.
+
/// Indicates whether we should restart system calls that are
/// interrupted.
int restart_;
+
/// The ostream where logging messages can be written.
ACE_OSTREAM_TYPE *ostream_;
+
/// The callback object.
ACE_Log_Msg_Callback *msg_callback_;
+
/// Depth of the nesting for printing traces.
int trace_depth_;
+
/// Are we already within an ACE_Trace constructor call?
bool trace_active_;
+
/// Are we allowing tracing in this thread?
bool tracing_enabled_;
+
/// Are we deleting this ostream?
bool delete_ostream_;
+
/**
* If we're running in the context of an ACE_Thread_Manager this
* will point to the thread descriptor adapter which holds the
@@ -528,42 +629,55 @@ private:
* access all thread data kept in ACE_Thread_Descriptor.
*/
ACE_Thread_Descriptor *thr_desc_;
+
/**
* Keeps track of all the per-thread ACE_Log_Priority values that
* are currently enabled. Default is for all logging priorities to
* be disabled.
*/
u_long priority_mask_;
+
/// Always timestamp?
int timestamp_;
+
// = The following fields are *not* kept in thread-specific storage.
+
// We only want one instance for the entire process!
+
/**
* Keeps track of all the per-process ACE_Log_Priority values that
* are currently enabled. Default is for all logging priorities to
* be enabled.
*/
static u_long process_priority_mask_;
+
/// Records the program name.
static const ACE_TCHAR *program_name_;
+
/// Name of the local host (used when printing messages).
static const ACE_TCHAR *local_host_;
+
/// Process id of the current process.
static pid_t pid_;
+
/// Options flags used to hold the logger flag options, e.g.,
/// STDERR, LOGGER, OSTREAM, MSG_CALLBACK, etc.
static u_long flags_;
+
/// Offset of msg_[].
static ptrdiff_t msg_off_;
+
/**
* Number of existing ACE_Log_Msg instances; when 0, delete program/host
* names
*/
static int instance_count_;
+
/**
* Priority mask to use for each new instance
*/
static u_long default_priority_mask_;
+
/// Anonymous struct since there will only be one instance. This
/// struct keeps information stored away in case we actually end up
/// calling log() if the log priority is correct.
@@ -575,21 +689,29 @@ private:
int op_status_;
int errnum_;
} conditional_values_;
+
#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
static bool key_created_;
#endif /* ACE_MT_SAFE */
+
/// For cleanup, at program termination.
static void close (void);
+
/// Decouple the OS layer from the ACE_Log_Msg layer.
static void sync_hook (const ACE_TCHAR *prg_name);
+
/// Return the TSS singleton thread descriptor
static ACE_OS_Thread_Descriptor *thr_desc_hook (void);
+
//friend void ACE_OS::cleanup_tss (const u_int);
+
// = Disallow these operations.
ACE_Log_Msg &operator= (const ACE_Log_Msg &);
ACE_Log_Msg (const ACE_Log_Msg &);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
# if defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || \
defined (ACE_HAS_TSS_EMULATION)
@@ -599,23 +721,28 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# else
# define LOCAL_EXTERN_PREFIX
# endif /* ACE_HAS_THR_C_DEST */
+
#if (defined (ACE_HAS_VERSIONED_NAMESPACE) && ACE_HAS_VERSIONED_NAMESPACE == 1)
# define ACE_TSS_CLEANUP_NAME ACE_PREPROC_CONCATENATE(ACE_,ACE_PREPROC_CONCATENATE(ACE_VERSIONED_NAMESPACE_NAME, _TSS_cleanup))
#else
# define ACE_TSS_CLEANUP_NAME ACE_TSS_cleanup
#endif /* ACE_HAS_VERSIONED_NAMESPACE == 1 */
+
LOCAL_EXTERN_PREFIX
void
ACE_TSS_CLEANUP_NAME (void *ptr);
# endif /* ACE_HAS_THREAD_SPECIFIC_STORAGE || ACE_HAS_TSS_EMULATION */
#endif /* ACE_MT_SAFE */
+
#if defined(ACE_LEGACY_MODE)
#include "ace/Log_Msg_Callback.h"
#endif /* ACE_LEGACY_MODE */
+
#if defined (__ACE_INLINE__)
#include "ace/Log_Msg.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_LOG_MSG_H */
diff --git a/dep/ACE_wrappers/ace/Log_Msg.inl b/dep/ACE_wrappers/ace/Log_Msg.inl
index ecabac652c6..2af6a376b35 100644
--- a/dep/ACE_wrappers/ace/Log_Msg.inl
+++ b/dep/ACE_wrappers/ace/Log_Msg.inl
@@ -1,9 +1,12 @@
// -*- C++ -*-
//
// $Id: Log_Msg.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_string.h"
#include "ace/OS_NS_unistd.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
u_long
ACE_Log_Msg::priority_mask (MASK_TYPE mask_type)
@@ -12,6 +15,7 @@ ACE_Log_Msg::priority_mask (MASK_TYPE mask_type)
? this->priority_mask_
: ACE_Log_Msg::process_priority_mask_;
}
+
ACE_INLINE
int
ACE_Log_Msg::log_priority_enabled (ACE_Log_Priority log_priority)
@@ -20,96 +24,112 @@ ACE_Log_Msg::log_priority_enabled (ACE_Log_Priority log_priority)
ACE_Log_Msg::process_priority_mask_,
log_priority);
}
+
ACE_INLINE
void
ACE_Log_Msg::op_status (int status)
{
this->status_ = status;
}
+
ACE_INLINE
int
ACE_Log_Msg::op_status (void) const
{
return this->status_;
}
+
ACE_INLINE
void
ACE_Log_Msg::restart (int r)
{
this->restart_ = r;
}
+
ACE_INLINE
int
ACE_Log_Msg::restart (void) const
{
return this->restart_;
}
+
ACE_INLINE
int
ACE_Log_Msg::errnum (void) const
{
return this->errnum_;
}
+
ACE_INLINE
void
ACE_Log_Msg::errnum (int e)
{
this->errnum_ = e;
}
+
ACE_INLINE
int
ACE_Log_Msg::linenum (void) const
{
return this->linenum_;
}
+
ACE_INLINE
void
ACE_Log_Msg::linenum (int l)
{
this->linenum_ = l;
}
+
ACE_INLINE
int
ACE_Log_Msg::inc (void)
{
return this->trace_depth_++;
}
+
ACE_INLINE
int
ACE_Log_Msg::dec (void)
{
return this->trace_depth_ == 0 ? 0 : --this->trace_depth_;
}
+
ACE_INLINE
int
ACE_Log_Msg::trace_depth (void) const
{
return this->trace_depth_;
}
+
ACE_INLINE
void
ACE_Log_Msg::trace_depth (int depth)
{
this->trace_depth_ = depth;
}
+
ACE_INLINE
bool
ACE_Log_Msg::trace_active (void) const
{
return this->trace_active_;
}
+
ACE_INLINE
void
ACE_Log_Msg::trace_active (bool value)
{
this->trace_active_ = value;
}
+
ACE_INLINE
ACE_Thread_Descriptor *
ACE_Log_Msg::thr_desc (void) const
{
return this->thr_desc_;
}
+
/// Enable the tracing facility on a per-thread basis.
ACE_INLINE
void
@@ -117,6 +137,7 @@ ACE_Log_Msg::start_tracing (void)
{
this->tracing_enabled_ = true;
}
+
/// Disable the tracing facility on a per-thread basis.
ACE_INLINE
void
@@ -124,30 +145,35 @@ ACE_Log_Msg::stop_tracing (void)
{
this->tracing_enabled_ = false;
}
+
ACE_INLINE
bool
ACE_Log_Msg::tracing_enabled (void) const
{
return this->tracing_enabled_;
}
+
ACE_INLINE
const char *
ACE_Log_Msg::file (void)
{
return this->file_;
}
+
ACE_INLINE
void
ACE_Log_Msg::file (const char *s)
{
ACE_OS::strsncpy (this->file_, s, sizeof this->file_);
}
+
ACE_INLINE
const ACE_TCHAR *
ACE_Log_Msg::msg (void)
{
return this->msg_ + ACE_Log_Msg::msg_off_;
}
+
ACE_INLINE
void
ACE_Log_Msg::msg (const ACE_TCHAR *m)
@@ -155,12 +181,14 @@ ACE_Log_Msg::msg (const ACE_TCHAR *m)
ACE_OS::strsncpy (this->msg_, m,
((ACE_MAXLOGMSGLEN+1) / sizeof (ACE_TCHAR)));
}
+
ACE_INLINE
ACE_Log_Msg_Callback *
ACE_Log_Msg::msg_callback (void) const
{
return this->msg_callback_;
}
+
ACE_INLINE
ACE_Log_Msg_Callback *
ACE_Log_Msg::msg_callback (ACE_Log_Msg_Callback *c)
@@ -169,32 +197,39 @@ ACE_Log_Msg::msg_callback (ACE_Log_Msg_Callback *c)
this->msg_callback_ = c;
return old;
}
+
ACE_INLINE
ACE_OSTREAM_TYPE *
ACE_Log_Msg::msg_ostream (void) const
{
return this->ostream_;
}
+
ACE_INLINE
void
ACE_Log_Msg::msg_ostream (ACE_OSTREAM_TYPE *m)
{
this->ostream_ = m;
}
+
ACE_INLINE
const ACE_TCHAR *
ACE_Log_Msg::local_host (void) const
{
return ACE_Log_Msg::local_host_;
}
+
ACE_INLINE
pid_t
ACE_Log_Msg::getpid (void) const
{
if (ACE_Log_Msg::pid_ == -2)
ACE_Log_Msg::pid_ = ACE_OS::getpid ();
+
return ACE_Log_Msg::pid_;
}
+
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Log_Msg_Backend.cpp b/dep/ACE_wrappers/ace/Log_Msg_Backend.cpp
index 1858bed9b54..f8ed295fec5 100644
--- a/dep/ACE_wrappers/ace/Log_Msg_Backend.cpp
+++ b/dep/ACE_wrappers/ace/Log_Msg_Backend.cpp
@@ -1,10 +1,15 @@
// $Id: Log_Msg_Backend.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Log_Msg_Backend.h"
+
ACE_RCSID(ace, Log_Msg_Backend, "$Id: Log_Msg_Backend.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_Log_Msg_Backend::~ACE_Log_Msg_Backend (void)
{
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Log_Msg_Backend.h b/dep/ACE_wrappers/ace/Log_Msg_Backend.h
index 377b3f5b482..f9de2b8bf5b 100644
--- a/dep/ACE_wrappers/ace/Log_Msg_Backend.h
+++ b/dep/ACE_wrappers/ace/Log_Msg_Backend.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Log_Msg_Backend.h
@@ -9,16 +10,23 @@
*/
//=============================================================================
+
#ifndef ACE_LOG_MSG_BACKEND_H
#define ACE_LOG_MSG_BACKEND_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/sys/os_types.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Log_Record;
+
/**
* @class ACE_Log_Msg_Backend
*
@@ -35,6 +43,7 @@ class ACE_Export ACE_Log_Msg_Backend
public:
/// No-op virtual destructor.
virtual ~ACE_Log_Msg_Backend (void);
+
/**
* Open the back end object. Perform any actions needed to prepare
* the object for later logging operations.
@@ -47,6 +56,7 @@ public:
* @retval -1 for failure.
*/
virtual int open (const ACE_TCHAR *logger_key) = 0;
+
/**
* Reset the backend. If ACE_Log_Msg is reopened during execution, this
* hook will be called. This method should perform any needed cleanup
@@ -57,8 +67,10 @@ public:
* -1 for failure.
*/
virtual int reset (void) = 0;
+
/// Close the backend completely.
virtual int close (void) = 0;
+
/**
* Process a log record.
*
@@ -69,7 +81,9 @@ public:
*/
virtual ssize_t log (ACE_Log_Record &log_record) = 0;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
#endif /* ACE_LOG_MSG_BACKEND_H */
diff --git a/dep/ACE_wrappers/ace/Log_Msg_Callback.cpp b/dep/ACE_wrappers/ace/Log_Msg_Callback.cpp
index f3912894719..b227843733d 100644
--- a/dep/ACE_wrappers/ace/Log_Msg_Callback.cpp
+++ b/dep/ACE_wrappers/ace/Log_Msg_Callback.cpp
@@ -1,8 +1,12 @@
// $Id: Log_Msg_Callback.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Log_Msg_Callback.h"
+
ACE_RCSID(ace, Log_Msg_Callback, "$Id: Log_Msg_Callback.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_Log_Msg_Callback::~ACE_Log_Msg_Callback (void)
{
}
diff --git a/dep/ACE_wrappers/ace/Log_Msg_Callback.h b/dep/ACE_wrappers/ace/Log_Msg_Callback.h
index 72b785b7643..4a3f6f77495 100644
--- a/dep/ACE_wrappers/ace/Log_Msg_Callback.h
+++ b/dep/ACE_wrappers/ace/Log_Msg_Callback.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Log_Msg_Callback.h
@@ -8,15 +9,21 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_LOG_MSG_CALLBACK_H
#define ACE_LOG_MSG_CALLBACK_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Log_Record;
+
/**
* @class ACE_Log_Msg_Callback
*
@@ -49,12 +56,15 @@ class ACE_Export ACE_Log_Msg_Callback
public:
/// No-op virtual destructor.
virtual ~ACE_Log_Msg_Callback (void);
+
/// Callback routine. This is called when we want to log a message.
/// Since this routine is pure virtual, it must be overwritten by the
/// subclass.
virtual void log (ACE_Log_Record &log_record) = 0;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
#endif /* ACE_LOG_MSG_CALLBACK_H */
diff --git a/dep/ACE_wrappers/ace/Log_Msg_IPC.cpp b/dep/ACE_wrappers/ace/Log_Msg_IPC.cpp
index 8dc0de0f870..7c61ac45979 100644
--- a/dep/ACE_wrappers/ace/Log_Msg_IPC.cpp
+++ b/dep/ACE_wrappers/ace/Log_Msg_IPC.cpp
@@ -1,17 +1,23 @@
// $Id: Log_Msg_IPC.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Log_Msg_IPC.h"
#include "ace/Log_Record.h"
#include "ace/CDR_Stream.h"
#include "ace/Truncate.h"
+
ACE_RCSID(ace, Log_Msg_IPC, "$Id: Log_Msg_IPC.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_Log_Msg_IPC::ACE_Log_Msg_IPC (void)
{
}
+
ACE_Log_Msg_IPC::~ACE_Log_Msg_IPC (void)
{
(void) this->close ();
}
+
int
ACE_Log_Msg_IPC::open (const ACE_TCHAR *logger_key)
{
@@ -19,6 +25,7 @@ ACE_Log_Msg_IPC::open (const ACE_TCHAR *logger_key)
return con.connect (this->message_queue_,
ACE_LOG_MSG_IPC_ADDR (logger_key));
}
+
int
ACE_Log_Msg_IPC::reset (void)
{
@@ -30,11 +37,13 @@ ACE_Log_Msg_IPC::reset (void)
}
return 0;
}
+
int
ACE_Log_Msg_IPC::close (void)
{
return this->message_queue_.close ();
}
+
ssize_t
ACE_Log_Msg_IPC::log (ACE_Log_Record &log_record)
{
@@ -52,33 +61,42 @@ ACE_Log_Msg_IPC::log (ACE_Log_Record &log_record)
+ log_record.msg_data_len () // message
#endif
+ ACE_CDR::MAX_ALIGNMENT; // padding;
+
// Insert contents of <log_record> into payload stream.
ACE_OutputCDR payload (max_payload_size);
payload << log_record;
+
// Get the number of bytes used by the CDR stream. If it becomes desireable
// to support payloads more than 4GB, this field will need to be changed
// to a 64-bit value.
ACE_CDR::ULong length =
ACE_Utils::truncate_cast<ACE_CDR::ULong> (payload.total_length ());
+
// Send a header so the receiver can determine the byte order and
// size of the incoming CDR stream.
ACE_OutputCDR header (ACE_CDR::MAX_ALIGNMENT + 8);
header << ACE_OutputCDR::from_boolean (ACE_CDR_BYTE_ORDER);
+
// Store the size of the payload that follows
header << ACE_CDR::ULong (length);
+
// Use an iovec to send both buffer and payload simultaneously.
iovec iov[2];
iov[0].iov_base = header.begin ()->rd_ptr ();
iov[0].iov_len = 8;
iov[1].iov_base = payload.begin ()->rd_ptr ();
iov[1].iov_len = length;
+
#if defined (ACE_HAS_STREAM_PIPES)
// Use the <putpmsg> API if supported to ensure correct message
// queueing according to priority.
+
ACE_Str_Buf header_msg (static_cast<void *> (header.begin ()->rd_ptr ()),
static_cast<int> (8));
+
ACE_Str_Buf payload_msg (static_cast<void *> (payload.begin ()->rd_ptr ()),
static_cast<int> (length));
+
return this->message_queue_.send (&header_msg,
&payload_msg,
static_cast<int> (log_record.priority ()),
@@ -89,5 +107,6 @@ ACE_Log_Msg_IPC::log (ACE_Log_Record &log_record)
return this->message_queue_.sendv_n (iov, 2);
#endif /* ACE_HAS_STREAM_PIPES */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Log_Msg_IPC.h b/dep/ACE_wrappers/ace/Log_Msg_IPC.h
index 54373a436cf..09c975b1c73 100644
--- a/dep/ACE_wrappers/ace/Log_Msg_IPC.h
+++ b/dep/ACE_wrappers/ace/Log_Msg_IPC.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Log_Msg_IPC.h
@@ -8,13 +9,17 @@
* @author Carlos O'Ryan <coryan@uci.edu>
*/
//=============================================================================
+
#ifndef ACE_LOG_MSG_LOGGER_H
#define ACE_LOG_MSG_LOGGER_H
#include /**/ "ace/pre.h"
+
#include "ace/Log_Msg_Backend.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
// IPC conduit between sender and client daemon. This should be
// included in the ACE_Log_Msg class, but due to "order of include"
// problems it can't be...
@@ -33,7 +38,9 @@ typedef ACE_SOCK_Connector ACE_LOG_MSG_IPC_CONNECTOR;
typedef ACE_INET_Addr ACE_LOG_MSG_IPC_ADDR;
ACE_END_VERSIONED_NAMESPACE_DECL
#endif /* ACE_HAS_STREAM_PIPES */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/// Defines the interfaces for ACE_Log_Msg backend.
/**
* Implement an ACE_Log_Msg_Backend that logs to a remote logging
@@ -44,10 +51,13 @@ class ACE_Export ACE_Log_Msg_IPC : public ACE_Log_Msg_Backend
public:
/// Constructor
ACE_Log_Msg_IPC (void);
+
/// Destructor
virtual ~ACE_Log_Msg_IPC (void);
+
/// Open a new connection
virtual int open (const ACE_TCHAR *logger_key);
+
/**
* Reset the backend. When changing the logging destination the
* backend may need to properly disconnect from the remote logging
@@ -55,12 +65,16 @@ public:
* the number of local allocations/deallocations.
*/
virtual int reset (void);
+
virtual int close (void);
virtual ssize_t log (ACE_Log_Record &log_record);
+
private:
ACE_LOG_MSG_IPC_STREAM message_queue_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
#endif /* ACE_LOG_MSG_H */
diff --git a/dep/ACE_wrappers/ace/Log_Msg_NT_Event_Log.cpp b/dep/ACE_wrappers/ace/Log_Msg_NT_Event_Log.cpp
index 773ef6d1043..c895373c95d 100644
--- a/dep/ACE_wrappers/ace/Log_Msg_NT_Event_Log.cpp
+++ b/dep/ACE_wrappers/ace/Log_Msg_NT_Event_Log.cpp
@@ -1,36 +1,47 @@
// $Id: Log_Msg_NT_Event_Log.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/config-all.h"
+
#if defined (ACE_HAS_LOG_MSG_NT_EVENT_LOG)
+
#include "ace/Log_Msg_NT_Event_Log.h"
#include "ace/Log_Msg.h"
#include "ace/Log_Record.h"
#include "ace/OS_NS_stdio.h"
#include "ace/OS_NS_string.h"
+
ACE_RCSID(ace, Log_Msg_NT_Event_Log, "$Id: Log_Msg_NT_Event_Log.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_Log_Msg_NT_Event_Log::ACE_Log_Msg_NT_Event_Log (void)
: evlog_handle_(0)
{
}
+
ACE_Log_Msg_NT_Event_Log::~ACE_Log_Msg_NT_Event_Log (void)
{
this->close ();
}
+
int
ACE_Log_Msg_NT_Event_Log::open (const ACE_TCHAR *logger_key)
{
// ACE's "resource module" contains the message resource required
// for event logging.
ACE_TCHAR msg_file [MAXPATHLEN];
+
if (!ACE_TEXT_GetModuleFileName (ACE_OS::get_win32_resource_module (),
msg_file,
MAXPATHLEN))
return -1;
DWORD msg_file_length =
static_cast<DWORD> ((ACE_OS::strlen (msg_file) + 1) * sizeof (ACE_TCHAR));
+
// If a logger_key has been supplied then we use that as the event
// source name, otherwise we default to the program name.
const ACE_TCHAR *event_source_name = logger_key ? logger_key : ACE_Log_Msg::program_name ();
+
// Information is stored in the registry at a location based on the
// program name.
ACE_TCHAR reg_key [MAXPATHLEN];
@@ -40,6 +51,7 @@ ACE_Log_Msg_NT_Event_Log::open (const ACE_TCHAR *logger_key)
ACE_OS::strncat (reg_key,
event_source_name,
MAXPATHLEN - reg_key_length);
+
// Add the event source to the registry. Note that if this fails it
// is not fatal. The application will still be able to write entries
// to the event log, they just won't be formatted correctly.
@@ -61,16 +73,19 @@ ACE_Log_Msg_NT_Event_Log::open (const ACE_TCHAR *logger_key)
(LPBYTE) msg_file,
msg_file_length);
RegCloseKey (hkey);
+
// Obtain a handle to the event source.
this->evlog_handle_ = ACE_TEXT_RegisterEventSource (0,
event_source_name);
return this->evlog_handle_ ? 0 : -1;
}
+
int
ACE_Log_Msg_NT_Event_Log::reset (void)
{
return this->close ();
}
+
int
ACE_Log_Msg_NT_Event_Log::close (void)
{
@@ -83,6 +98,7 @@ ACE_Log_Msg_NT_Event_Log::close (void)
else
return -1;
}
+
ssize_t
ACE_Log_Msg_NT_Event_Log::log (ACE_Log_Record &log_record)
{
@@ -92,6 +108,7 @@ ACE_Log_Msg_NT_Event_Log::log (ACE_Log_Record &log_record)
// data for the worst case of all newlines.
const ACE_TCHAR* src_msg_data = log_record.msg_data ();
ACE_TCHAR msg_data [ACE_Log_Record::MAXLOGMSGLEN * 2];
+
for (size_t i = 0, j = 0;
i < log_record.msg_data_len ();
++i)
@@ -104,6 +121,7 @@ ACE_Log_Msg_NT_Event_Log::log (ACE_Log_Record &log_record)
else
msg_data[j++] = src_msg_data[i];
}
+
// Map the ACE log record type to an event log type.
WORD event_type;
switch (log_record.type ())
@@ -127,15 +145,19 @@ ACE_Log_Msg_NT_Event_Log::log (ACE_Log_Record &log_record)
event_type = EVENTLOG_ERROR_TYPE;
break;
}
+
// Send the log message to the system event log.
const ACE_TCHAR* msgs [1];
msgs[0] = msg_data;
+
if (ACE_TEXT_ReportEvent (this->evlog_handle_,
event_type, 0, 0, 0, 1, 0, msgs, 0) == 0)
return -1;
else
return 0;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_LOG_MSG_NT_EVENT_LOG */
diff --git a/dep/ACE_wrappers/ace/Log_Msg_NT_Event_Log.h b/dep/ACE_wrappers/ace/Log_Msg_NT_Event_Log.h
index da4012d55bf..66920903ab6 100644
--- a/dep/ACE_wrappers/ace/Log_Msg_NT_Event_Log.h
+++ b/dep/ACE_wrappers/ace/Log_Msg_NT_Event_Log.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Log_Msg_NT_Event_Log.h
@@ -8,16 +9,23 @@
* @author Christopher Kohlhoff <chris@kohlhoff.com>
*/
//=============================================================================
+
#ifndef ACE_LOG_MSG_NT_EVENT_LOG_H
#define ACE_LOG_MSG_NT_EVENT_LOG_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined ACE_HAS_LOG_MSG_NT_EVENT_LOG
+
#include "ace/Log_Msg_Backend.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Log_Msg_NT_Event_Log
*
@@ -29,8 +37,10 @@ class ACE_Export ACE_Log_Msg_NT_Event_Log : public ACE_Log_Msg_Backend
public:
/// Constructor
ACE_Log_Msg_NT_Event_Log (void);
+
/// Destructor
virtual ~ACE_Log_Msg_NT_Event_Log (void);
+
/// Open a new event log.
/**
* Initialize the event logging facility.
@@ -40,17 +50,24 @@ public:
* returned from ACE_Log_Msg::program_name() is used.
*/
virtual int open (const ACE_TCHAR *logger_key);
+
/// Reset the backend.
virtual int reset (void);
+
/// Close the backend completely.
virtual int close (void);
+
/// This is called when we want to log a message.
virtual ssize_t log (ACE_Log_Record &log_record);
+
private:
HANDLE evlog_handle_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_LOG_MSG_NT_EVENT_LOG */
+
#include /**/ "ace/post.h"
#endif /* ACE_LOG_MSG_NT_EVENT_LOG_H */
diff --git a/dep/ACE_wrappers/ace/Log_Msg_UNIX_Syslog.cpp b/dep/ACE_wrappers/ace/Log_Msg_UNIX_Syslog.cpp
index fe89f0812b0..715886cef18 100644
--- a/dep/ACE_wrappers/ace/Log_Msg_UNIX_Syslog.cpp
+++ b/dep/ACE_wrappers/ace/Log_Msg_UNIX_Syslog.cpp
@@ -1,13 +1,18 @@
// $Id: Log_Msg_UNIX_Syslog.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/config-all.h"
+
#if !defined (ACE_LACKS_UNIX_SYSLOG)
+
#include "ace/ACE.h"
#include "ace/Log_Msg.h"
#include "ace/Log_Msg_UNIX_Syslog.h"
#include "ace/Log_Record.h"
#include "ace/OS_NS_string.h"
#include "ace/os_include/os_syslog.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// NOTE:
// The ACE_Log_Msg_UNIX_Syslog class can use the openlog(),
// setlogmask(), syslog() and closelog() routines in a thread safe
@@ -18,18 +23,22 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
// facility, will be the same for all threads in a process. This
// should not be too limiting, as the ACE_Log_Msg class itself can
// be used to control thread specific logging behavior.
+
ACE_Log_Msg_UNIX_Syslog::ACE_Log_Msg_UNIX_Syslog (void)
{
}
+
ACE_Log_Msg_UNIX_Syslog::~ACE_Log_Msg_UNIX_Syslog (void)
{
(void) this->close ();
}
+
int
ACE_Log_Msg_UNIX_Syslog::open (const ACE_TCHAR * logger_key)
{
if (logger_key == 0)
logger_key = ACE_Log_Msg::program_name ();
+
// Initialize the UNIX syslog facility. Default the syslog log
// options LOG_CONS and LOG_PID to be set. There really should be a
// logging strategy option to control the syslog log options,
@@ -43,38 +52,47 @@ ACE_Log_Msg_UNIX_Syslog::open (const ACE_TCHAR * logger_key)
LOG_CONS|LOG_PID,
ACE_DEFAULT_SYSLOG_FACILITY);
#endif /* ACE_USES_WCHAR */
+
// Enable logging of all syslog priorities. If logging of all
// priorities is not desired, use the ACE_Log_Msg::priority_mask()
// method to control the log output sent to the syslog daemon via
// the log() method, or use the system's syslog.conf file to select
// desired level of information.
+
#if !defined (ACE_LACKS_SETLOGMASK)
(void) setlogmask (LOG_UPTO (LOG_DEBUG));
#endif /* ACE_LACKS_SETLOGMASK */
+
return 0;
}
+
int
ACE_Log_Msg_UNIX_Syslog::reset (void)
{
return this->close ();
}
+
int
ACE_Log_Msg_UNIX_Syslog::close (void)
{
closelog();
return 0;
}
+
ssize_t
ACE_Log_Msg_UNIX_Syslog::log (ACE_Log_Record &log_record)
{
int syslog_priority = this->convert_log_priority (log_record.type ());
u_long flags = ACE_LOG_MSG->flags ();
+
// The UNIX syslog() facility does not support multi-line messages.
// Break up the message data into separate lines and send each line
// to the syslog daemon.
+
ACE_TCHAR message[ACE_Log_Record::MAXVERBOSELOGMSGLEN];
ACE_OS::strcpy (message, log_record.msg_data ());
ACE_TCHAR *strtokp = 0;
+
for (ACE_TCHAR *line = ACE_OS::strtok_r (message,
ACE_TEXT ("\n"),
&strtokp);
@@ -106,8 +124,10 @@ ACE_Log_Msg_UNIX_Syslog::log (ACE_Log_Record &log_record)
else // No formatting required.
syslog (syslog_priority, "%s", ACE_TEXT_ALWAYS_CHAR (line));
}
+
return 0;
}
+
int
ACE_Log_Msg_UNIX_Syslog::convert_log_priority (ACE_UINT32 lm_priority)
{
@@ -143,33 +163,46 @@ ACE_Log_Msg_UNIX_Syslog::convert_log_priority (ACE_UINT32 lm_priority)
syslog_priority = LOG_ERR;
break;
}
+
return syslog_priority;
}
+
int
ACE_Log_Msg_UNIX_Syslog::convert_log_mask (int lm_mask)
{
int syslog_mask = 0;
+
if (ACE_BIT_ENABLED (lm_mask, LM_TRACE)
|| ACE_BIT_ENABLED (lm_mask, LM_DEBUG))
ACE_SET_BITS (syslog_mask, LOG_MASK(LOG_DEBUG));
+
if (ACE_BIT_ENABLED (lm_mask, LM_STARTUP)
|| ACE_BIT_ENABLED (lm_mask, LM_SHUTDOWN)
|| ACE_BIT_ENABLED (lm_mask, LM_INFO))
ACE_SET_BITS (syslog_mask, LOG_MASK(LOG_INFO));
+
if (ACE_BIT_ENABLED (lm_mask, LM_NOTICE))
ACE_SET_BITS (syslog_mask, LOG_MASK(LOG_NOTICE));
+
if (ACE_BIT_ENABLED (lm_mask, LM_ERROR))
ACE_SET_BITS (syslog_mask, LOG_MASK(LOG_ERR));
+
if (ACE_BIT_ENABLED (lm_mask, LM_WARNING))
ACE_SET_BITS (syslog_mask, LOG_MASK(LOG_WARNING));
+
if (ACE_BIT_ENABLED (lm_mask, LM_CRITICAL))
ACE_SET_BITS (syslog_mask, LOG_MASK(LOG_CRIT));
+
if (ACE_BIT_ENABLED (lm_mask, LM_ALERT))
ACE_SET_BITS (syslog_mask, LOG_MASK(LOG_ALERT));
+
if (ACE_BIT_ENABLED (lm_mask, LM_EMERGENCY))
ACE_SET_BITS (syslog_mask, LOG_MASK(LOG_EMERG));
+
return syslog_mask;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* !ACE_LACKS_UNIX_SYSLOG */
diff --git a/dep/ACE_wrappers/ace/Log_Msg_UNIX_Syslog.h b/dep/ACE_wrappers/ace/Log_Msg_UNIX_Syslog.h
index 50017e1c69b..c781d6ab3e1 100644
--- a/dep/ACE_wrappers/ace/Log_Msg_UNIX_Syslog.h
+++ b/dep/ACE_wrappers/ace/Log_Msg_UNIX_Syslog.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Log_Msg_UNIX_Syslog.h
@@ -8,16 +9,23 @@
* @author Jerry D. De Master <jdemaster@rite-solutions.com>
*/
//=============================================================================
+
#ifndef ACE_LOG_MSG_UNIX_SYSLOG_H
#define ACE_LOG_MSG_UNIX_SYSLOG_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if !defined (ACE_LACKS_UNIX_SYSLOG)
+
#include "ace/Log_Msg_Backend.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Log_Msg_UNIX_Syslog
*
@@ -29,8 +37,10 @@ class ACE_Export ACE_Log_Msg_UNIX_Syslog : public ACE_Log_Msg_Backend
public:
/// Constructor
ACE_Log_Msg_UNIX_Syslog (void);
+
/// Destructor
virtual ~ACE_Log_Msg_UNIX_Syslog (void);
+
/// Open a new event log.
/**
* Initialize the event logging facility.
@@ -40,20 +50,28 @@ public:
* returned from ACE_Log_Msg::program_name() is used.
*/
virtual int open (const ACE_TCHAR *logger_key);
+
/// Reset the backend.
virtual int reset (void);
+
/// Close the backend completely.
virtual int close (void);
+
/// This is called when we want to log a message.
virtual ssize_t log (ACE_Log_Record &log_record);
+
private:
/// Convert an ACE_Log_Priority value to the corresponding syslog priority.
int convert_log_priority (ACE_UINT32 lm_priority);
+
/// Convert an ACE_Log_Priority mask to the corresponding syslog mask value.
int convert_log_mask (int lm_mask);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* !ACE_LACKS_UNIX_SYSLOG */
+
#include /**/ "ace/post.h"
#endif /* ACE_LOG_MSG_UNIX_SYSLOG_H */
diff --git a/dep/ACE_wrappers/ace/Log_Priority.h b/dep/ACE_wrappers/ace/Log_Priority.h
index d22e9111d90..6abffaa0756 100644
--- a/dep/ACE_wrappers/ace/Log_Priority.h
+++ b/dep/ACE_wrappers/ace/Log_Priority.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Log_Priority.h
@@ -8,11 +9,16 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_LOG_PRIORITY_H
#define ACE_LOG_PRIORITY_H
+
#include /**/ "ace/pre.h"
+
#include "ace/config-lite.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @enum ACE_Log_Priority
*
@@ -27,39 +33,54 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
enum ACE_Log_Priority
{
// = Note, this first argument *must* start at 1!
+
/// Shutdown the logger (decimal 1).
LM_SHUTDOWN = 01,
+
/// Messages indicating function-calling sequence (decimal 2).
LM_TRACE = 02,
+
/// Messages that contain information normally of use only when
/// debugging a program (decimal 4).
LM_DEBUG = 04,
+
/// Informational messages (decimal 8).
LM_INFO = 010,
+
/// Conditions that are not error conditions, but that may require
/// special handling (decimal 16).
LM_NOTICE = 020,
+
/// Warning messages (decimal 32).
LM_WARNING = 040,
+
/// Initialize the logger (decimal 64).
LM_STARTUP = 0100,
+
/// Error messages (decimal 128).
LM_ERROR = 0200,
+
/// Critical conditions, such as hard device errors (decimal 256).
LM_CRITICAL = 0400,
+
/// A condition that should be corrected immediately, such as a
/// corrupted system database (decimal 512).
LM_ALERT = 01000,
+
/// A panic condition. This is normally broadcast to all users
/// (decimal 1024).
LM_EMERGENCY = 02000,
+
/// The maximum logging priority.
LM_MAX = LM_EMERGENCY,
+
/// Do not use!! This enum value ensures that the underlying
/// integral type for this enum is at least 32 bits.
LM_ENSURE_32_BITS = 0x7FFFFFFF
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
#endif /* ACE_LOG_PRIORITY_H */
diff --git a/dep/ACE_wrappers/ace/Log_Record.cpp b/dep/ACE_wrappers/ace/Log_Record.cpp
index 679bd45b13c..8142dad0d1d 100644
--- a/dep/ACE_wrappers/ace/Log_Record.cpp
+++ b/dep/ACE_wrappers/ace/Log_Record.cpp
@@ -1,5 +1,7 @@
// $Id: Log_Record.cpp 81826 2008-06-02 15:29:53Z schmidt $
+
#include "ace/Log_Record.h"
+
#include "ace/Log_Msg.h"
#include "ace/ACE.h"
#include "ace/OS_NS_stdio.h"
@@ -7,17 +9,24 @@
#include "ace/CDR_Stream.h"
#include "ace/Auto_Ptr.h"
#include "ace/Truncate.h"
+
#if !defined (__ACE_INLINE__)
# include "ace/Log_Record.inl"
#endif /* __ACE_INLINE__ */
+
#if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
// FUZZ: disable check_for_streams_include
# include "ace/streams.h"
#endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */
+
#include "ace/OS_Memory.h"
+
ACE_RCSID(ace, Log_Record, "$Id: Log_Record.cpp 81826 2008-06-02 15:29:53Z schmidt $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_Log_Record)
+
namespace
{
// Symbolic names for the <ACE_Log_Priority> enumerators.
@@ -57,11 +66,13 @@ namespace
ACE_TEXT ("LM_UNK(020000000000)")
};
}
+
const ACE_TCHAR *
ACE_Log_Record::priority_name (ACE_Log_Priority p)
{
return ace_priority_names[ACE::log2 (p)];
}
+
void
ACE_Log_Record::priority_name (ACE_Log_Priority p,
const ACE_TCHAR *name)
@@ -69,28 +80,34 @@ ACE_Log_Record::priority_name (ACE_Log_Priority p,
// Name must be a statically allocated string
ace_priority_names[ACE::log2 (p)] = name;
}
+
u_long
ACE_Log_Record::priority (void) const
{
ACE_TRACE ("ACE_Log_Record::priority");
+
// Get the priority of the <Log_Record> <type_>. This is computed
// as the base 2 logarithm of <type_> (which must be a power of 2,
// as defined by the enums in <ACE_Log_Priority>).
return ACE::log2 ((u_long) this->type_);
}
+
void
ACE_Log_Record::priority (u_long p)
{
ACE_TRACE ("ACE_Log_Record::priority");
+
// Set the priority of the <Log_Record> <type_> (which must be a
// power of 2, as defined by the enums in <ACE_Log_Priority>).
this->type_ = (ACE_UINT32) p;
}
+
void
ACE_Log_Record::dump (void) const
{
#if defined (ACE_HAS_DUMP)
// ACE_TRACE ("ACE_Log_Record::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("length_ = %d\n"), this->length_));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\ntype_ = %u\n"), this->type_));
@@ -104,6 +121,7 @@ ACE_Log_Record::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
int
ACE_Log_Record::msg_data (const ACE_TCHAR *data)
{
@@ -121,6 +139,7 @@ ACE_Log_Record::msg_data (const ACE_TCHAR *data)
this->round_up ();
return 0;
}
+
ACE_Log_Record::ACE_Log_Record (ACE_Log_Priority lp,
time_t ts_sec,
long p)
@@ -140,6 +159,7 @@ ACE_Log_Record::ACE_Log_Record (ACE_Log_Priority lp,
this->msg_data_[0] = '\0';
}
}
+
ACE_Log_Record::ACE_Log_Record (ACE_Log_Priority lp,
const ACE_Time_Value &ts,
long p)
@@ -159,17 +179,20 @@ ACE_Log_Record::ACE_Log_Record (ACE_Log_Priority lp,
this->msg_data_[0] = '\0';
}
}
+
void
ACE_Log_Record::round_up (void)
{
// ACE_TRACE ("ACE_Log_Record::round_up");
// Determine the length of the payload.
size_t len = sizeof (*this) + (sizeof (ACE_TCHAR) * ((ACE_OS::strlen (this->msg_data_) + 1)));
+
// Round up to the alignment.
len = ((len + ACE_Log_Record::ALIGN_WORDB - 1)
& ~(ACE_Log_Record::ALIGN_WORDB - 1));
this->length_ = static_cast<ACE_UINT32> (len);
}
+
ACE_Log_Record::ACE_Log_Record (void)
: length_ (0),
type_ (0),
@@ -187,6 +210,7 @@ ACE_Log_Record::ACE_Log_Record (void)
this->msg_data_[0] = '\0';
}
}
+
int
ACE_Log_Record::format_msg (const ACE_TCHAR host_name[],
u_long verbose_flag,
@@ -195,6 +219,7 @@ ACE_Log_Record::format_msg (const ACE_TCHAR host_name[],
/* 0123456789012345678901234 */
/* Oct 18 14:25:36.000 1989<nul> */
ACE_TCHAR timestamp[26]; // Only used by VERBOSE and VERBOSE_LITE.
+
// The sprintf format needs to be different for Windows and POSIX
// in the wide-char case.
#if defined (ACE_WIN32) || !defined (ACE_USES_WCHAR)
@@ -206,6 +231,7 @@ ACE_Log_Record::format_msg (const ACE_TCHAR host_name[],
const ACE_TCHAR *verbose_fmt = ACE_TEXT ("%ls@%ls@%u@%ls@%ls");
const ACE_TCHAR *verbose_lite_fmt = ACE_TEXT ("%ls@%ls@%ls");
#endif
+
if (ACE_BIT_ENABLED (verbose_flag,
ACE_Log_Msg::VERBOSE)
|| ACE_BIT_ENABLED (verbose_flag,
@@ -213,18 +239,23 @@ ACE_Log_Record::format_msg (const ACE_TCHAR host_name[],
{
time_t const now = this->secs_;
ACE_TCHAR ctp[26]; // 26 is a magic number...
+
if (ACE_OS::ctime_r (&now, ctp, sizeof ctp / sizeof (ACE_TCHAR)) == 0)
return -1;
+
/* 01234567890123456789012345 */
/* Wed Oct 18 14:25:36 1989n0 */
+
ctp[19] = '\0'; // NUL-terminate after the time.
ctp[24] = '\0'; // NUL-terminate after the date.
+
ACE_OS::sprintf (timestamp,
time_fmt,
ctp + 4,
((long) this->usecs_) / 1000,
ctp + 20);
}
+
if (ACE_BIT_ENABLED (verbose_flag,
ACE_Log_Msg::VERBOSE))
{
@@ -249,6 +280,7 @@ ACE_Log_Record::format_msg (const ACE_TCHAR host_name[],
ACE_OS::strcpy (verbose_msg, this->msg_data_);
return 0;
}
+
int
ACE_Log_Record::print (const ACE_TCHAR host_name[],
u_long verbose_flag,
@@ -258,7 +290,9 @@ ACE_Log_Record::print (const ACE_TCHAR host_name[],
{
ACE_TCHAR *verbose_msg = 0;
ACE_NEW_RETURN (verbose_msg, ACE_TCHAR[MAXVERBOSELOGMSGLEN], -1);
+
int result = this->format_msg (host_name, verbose_flag, verbose_msg);
+
if (result == 0)
{
if (fp != 0)
@@ -281,12 +315,15 @@ ACE_Log_Record::print (const ACE_TCHAR host_name[],
ACE_OS::fflush (fp);
}
}
+
delete [] verbose_msg;
+
return result;
}
else
return 0;
}
+
int
operator<< (ACE_OutputCDR &cdr,
const ACE_Log_Record &log_record)
@@ -295,6 +332,7 @@ operator<< (ACE_OutputCDR &cdr,
// so reduce it here if needed.
ACE_CDR::ULong u_msglen =
ACE_Utils::truncate_cast<ACE_CDR::ULong> (log_record.msg_data_len ());
+
// Insert each field from <log_record> into the output CDR stream.
cdr << ACE_CDR::Long (log_record.type ());
cdr << ACE_CDR::Long (log_record.pid ());
@@ -308,6 +346,7 @@ operator<< (ACE_OutputCDR &cdr,
#endif /* ACE_USES_WCHAR */
return cdr.good_bit ();
}
+
int
operator>> (ACE_InputCDR &cdr,
ACE_Log_Record &log_record)
@@ -317,6 +356,7 @@ operator>> (ACE_InputCDR &cdr,
ACE_CDR::LongLong sec;
ACE_CDR::Long usec;
ACE_CDR::ULong buffer_len;
+
// Extract each field from input CDR stream into <log_record>.
if ((cdr >> type) && (cdr >> pid) && (cdr >> sec) && (cdr >> usec)
&& (cdr >> buffer_len)) {
@@ -338,7 +378,9 @@ operator>> (ACE_InputCDR &cdr,
}
return cdr.good_bit ();
}
+
#if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
+
int
ACE_Log_Record::print (const ACE_TCHAR host_name[],
u_long verbose_flag,
@@ -348,18 +390,24 @@ ACE_Log_Record::print (const ACE_TCHAR host_name[],
{
ACE_TCHAR* verbose_msg = 0;
ACE_NEW_RETURN (verbose_msg, ACE_TCHAR[MAXVERBOSELOGMSGLEN], -1);
+
int const result = this->format_msg (host_name, verbose_flag, verbose_msg);
+
if (result == 0)
{
// Since ostream expects only chars, we cannot pass wchar_t's
s << ACE_TEXT_ALWAYS_CHAR (verbose_msg);
s.flush ();
}
+
delete [] verbose_msg;
+
return result;
}
return 0;
}
+
#endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Log_Record.h b/dep/ACE_wrappers/ace/Log_Record.h
index 7250dc66939..be3e0b29e1e 100644
--- a/dep/ACE_wrappers/ace/Log_Record.h
+++ b/dep/ACE_wrappers/ace/Log_Record.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Log_Record.h
@@ -8,21 +9,30 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
// These need to go outside of the #ifdef to avoid problems with
// circular dependencies...
+
#include "ace/Log_Priority.h"
+
#ifndef ACE_LOG_RECORD_H
#define ACE_LOG_RECORD_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Default_Constants.h"
#include "ace/Basic_Types.h"
#include "ace/iosfwd.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Time_Value;
+
/// Defines the structure of an ACE logging record.
class ACE_Export ACE_Log_Record
{
@@ -31,15 +41,19 @@ public:
{
/// Maximum size of a logging message.
MAXLOGMSGLEN = ACE_MAXLOGMSGLEN+1,
+
/// Most restrictive alignment.
ALIGN_WORDB = 8,
+
/// Size used by verbose mode.
/// 20 (date) + 15 (host_name) + 10 (pid) + 10 (type)
/// + 4 (@) ... + ? (progname)
VERBOSE_LEN = 128,
+
/// Maximum size of a logging message with the verbose headers
MAXVERBOSELOGMSGLEN = VERBOSE_LEN + MAXLOGMSGLEN
};
+
// = Initialization
/**
* Create a <Log_Record> and set its priority, time stamp, and
@@ -52,9 +66,11 @@ public:
ACE_Log_Record (ACE_Log_Priority lp,
const ACE_Time_Value &time_stamp,
long pid);
+
/// Default dtor.
~ACE_Log_Record (void);
+
/// Write the contents of the logging record to the appropriate
/// <FILE> iff the corresponding type is enabled.
int print (const ACE_TCHAR host_name[],
@@ -64,6 +80,7 @@ public:
#else
FILE *fp);
#endif /* ACE_HAS_WINCE */
+
#if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
/// Write the contents of the logging record to the appropriate
/// <ostream> iff the corresponding type is enabled.
@@ -71,73 +88,96 @@ public:
u_long verbose_flag,
ACE_OSTREAM_TYPE &stream);
#endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */
+
int format_msg (const ACE_TCHAR host_name[],
u_long verbose_flag,
ACE_TCHAR *verbose_msg);
+
/**
* Returns a character array with the string form of the
* <ACE_Log_Priority> parameter. This is used for the verbose
* printing format.
*/
static const ACE_TCHAR *priority_name (ACE_Log_Priority p);
+
// IMPORTANT: @a name must be a statically allocated const ACE_TCHAR*
static void priority_name (ACE_Log_Priority p,
const ACE_TCHAR *name);
+
// = Marshall/demarshall
/// Encode the <Log_Record> for transmission on the network.
/// @deprecated The encode() and decode() metods are deprecated; please use
/// the CDR insertion and extraction operators to properly encode and decode
/// ACE_Log_Record objects.
void encode (void);
+
/// Decode the <Log_Record> received from the network.
/// @deprecated The encode() and decode() metods are deprecated; please use
/// the CDR insertion and extraction operators to properly encode and decode
/// ACE_Log_Record objects.
void decode (void);
+
// = Set/get methods
+
/// Get the type of the <Log_Record>.
ACE_UINT32 type (void) const;
+
/// Set the type of the <Log_Record>.
void type (ACE_UINT32);
+
/**
* Get the priority of the <Log_Record> <type_>. This is computed
* as the base 2 logarithm of <type_> (which must be a power of 2,
* as defined by the enums in <ACE_Log_Priority>).
*/
u_long priority (void) const;
+
/// Set the priority of the <Log_Record> <type_> (which must be a
/// power of 2, as defined by the enums in <ACE_Log_Priority>).
void priority (u_long num);
+
/// Get the total length of the <Log_Record>, which includes the
/// size of the various data member fields.
long length (void) const;
+
/// Set the total length of the <Log_Record>, which needs to account for
/// the size of the various data member fields.
void length (long);
+
/// Get the time stamp of the <Log_Record>.
ACE_Time_Value time_stamp (void) const;
+
/// Set the time stamp of the <Log_Record>.
void time_stamp (const ACE_Time_Value &ts);
+
/// Get the process id of the <Log_Record>.
long pid (void) const;
+
/// Set the process id of the <Log_Record>.
void pid (long);
+
/// Get the message data of the <Log_Record>.
const ACE_TCHAR *msg_data (void) const;
+
/// Set the message data of the record. If @a data is longer than the
/// current msg_data_ buffer, a new msg_data_ buffer is allocated to
/// fit. If such a reallocation faisl, this method returns -1, else 0.
int msg_data (const ACE_TCHAR *data);
+
/// Get the size of the message data of the <Log_Record>, including
/// a byte for the NUL.
size_t msg_data_len (void) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Round up to the alignment restrictions.
void round_up (void);
+
/**
* Total length of the logging record in bytes. This field *must*
* come first in order for various IPC framing mechanisms to work
@@ -145,30 +185,40 @@ private:
* to be passed portably across platforms.
*/
ACE_INT32 length_;
+
/// Type of logging record.
ACE_UINT32 type_;
+
/// Time that the logging record was generated.
time_t secs_;
ACE_UINT32 usecs_;
+
/// Id of process that generated the logging record.
ACE_UINT32 pid_;
+
/// Logging record data
ACE_TCHAR *msg_data_; // Heap-allocated text message area
size_t msg_data_size_; // Allocated size of msg_data_ in ACE_TCHARs
+
/// disallow copying...
ACE_Log_Record (const ACE_Log_Record& rhs);
ACE_Log_Record& operator= (const ACE_Log_Record& rhs);
};
+
// Forward decls.
class ACE_InputCDR;
class ACE_OutputCDR;
+
// iostream operators for ACE_Log_Record.
ACE_Export int operator>> (ACE_InputCDR &cdr, ACE_Log_Record &log_record);
ACE_Export int operator<< (ACE_OutputCDR &cdr, const ACE_Log_Record &log_record);
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Log_Record.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_LOG_RECORD_H */
diff --git a/dep/ACE_wrappers/ace/Log_Record.inl b/dep/ACE_wrappers/ace/Log_Record.inl
index 91b8518e55e..4fe84ecab07 100644
--- a/dep/ACE_wrappers/ace/Log_Record.inl
+++ b/dep/ACE_wrappers/ace/Log_Record.inl
@@ -1,17 +1,21 @@
// -*- C++ -*-
//
// $Id: Log_Record.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Global_Macros.h"
#include "ace/os_include/arpa/os_inet.h"
#include "ace/Time_Value.h"
#include "ace/OS_NS_string.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_Log_Record::~ACE_Log_Record (void)
{
if (this->msg_data_)
delete [] this->msg_data_;
}
+
ACE_INLINE void
ACE_Log_Record::encode (void)
{
@@ -28,6 +32,7 @@ ACE_Log_Record::encode (void)
this->pid_ = htonl (this->pid_);
#endif /* ACE_LACKS_HTONL */
}
+
ACE_INLINE void
ACE_Log_Record::decode (void)
{
@@ -35,6 +40,7 @@ ACE_Log_Record::decode (void)
#if !defined (ACE_LACKS_NTOHL)
ACE_Time_Value tv (this->secs_,
ntohl (this->usecs_));
+
this->secs_ = tv.sec ();
this->usecs_ = tv.usec ();
this->type_ = ntohl (this->type_);
@@ -42,36 +48,42 @@ ACE_Log_Record::decode (void)
this->length_ = ntohl (this->length_);
#endif /* ACE_LACKS_NTOHL */
}
+
ACE_INLINE ACE_UINT32
ACE_Log_Record::type (void) const
{
ACE_TRACE ("ACE_Log_Record::type");
return this->type_;
}
+
ACE_INLINE void
ACE_Log_Record::type (ACE_UINT32 t)
{
ACE_TRACE ("ACE_Log_Record::type");
this->type_ = t;
}
+
ACE_INLINE long
ACE_Log_Record::length (void) const
{
ACE_TRACE ("ACE_Log_Record::length");
return (long) this->length_;
}
+
ACE_INLINE void
ACE_Log_Record::length (long l)
{
ACE_TRACE ("ACE_Log_Record::length");
this->length_ = static_cast<ACE_UINT32> (l);
}
+
ACE_INLINE ACE_Time_Value
ACE_Log_Record::time_stamp (void) const
{
ACE_TRACE ("ACE_Log_Record::time_stamp");
return ACE_Time_Value (this->secs_, (long) this->usecs_);
}
+
ACE_INLINE void
ACE_Log_Record::time_stamp (const ACE_Time_Value &ts)
{
@@ -79,28 +91,33 @@ ACE_Log_Record::time_stamp (const ACE_Time_Value &ts)
this->secs_ = ts.sec ();
this->usecs_ = (ACE_UINT32) ts.usec ();
}
+
ACE_INLINE long
ACE_Log_Record::pid (void) const
{
ACE_TRACE ("ACE_Log_Record::pid");
return (long) this->pid_;
}
+
ACE_INLINE void
ACE_Log_Record::pid (long p)
{
ACE_TRACE ("ACE_Log_Record::pid");
this->pid_ = (ACE_UINT32) p;
}
+
ACE_INLINE const ACE_TCHAR *
ACE_Log_Record::msg_data (void) const
{
ACE_TRACE ("ACE_Log_Record::msg_data");
return this->msg_data_;
}
+
ACE_INLINE size_t
ACE_Log_Record::msg_data_len (void) const
{
ACE_TRACE ("ACE_Log_Record::msg_data_len");
return ACE_OS::strlen (this->msg_data_) + 1;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Logging_Strategy.cpp b/dep/ACE_wrappers/ace/Logging_Strategy.cpp
index ed3a0b37ca7..36f2726db51 100644
--- a/dep/ACE_wrappers/ace/Logging_Strategy.cpp
+++ b/dep/ACE_wrappers/ace/Logging_Strategy.cpp
@@ -1,34 +1,46 @@
// $Id: Logging_Strategy.cpp 81696 2008-05-14 18:15:31Z johnnyw $
+
#include "ace/Logging_Strategy.h"
#include "ace/Service_Config.h"
#include "ace/ACE.h"
#include "ace/Get_Opt.h"
+
// FUZZ: disable check_for_streams_include
#include "ace/streams.h"
+
#include "ace/Lib_Find.h"
#include "ace/Log_Msg.h"
#include "ace/Reactor.h"
#include "ace/OS_NS_string.h"
#include "ace/OS_NS_stdio.h"
#include "ace/OS_NS_unistd.h"
+
ACE_RCSID (ace,
Logging_Strategy,
"$Id: Logging_Strategy.cpp 81696 2008-05-14 18:15:31Z johnnyw $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Parse the string containing (thread) priorities and set them
// accordingly.
+
void
ACE_Logging_Strategy::priorities (ACE_TCHAR *priority_string,
ACE_Log_Msg::MASK_TYPE mask)
{
u_long priority_mask = 0;
+
// Choose priority mask to change.
+
if (mask == ACE_Log_Msg::PROCESS)
priority_mask = process_priority_mask_;
else
priority_mask = thread_priority_mask_;
+
ACE_TCHAR *strtokp = 0;
+
// Parse string and alternate priority mask.
+
for (ACE_TCHAR *priority = ACE_OS::strtok_r (priority_string,
ACE_TEXT ("|"),
&strtokp);
@@ -82,18 +94,23 @@ ACE_Logging_Strategy::priorities (ACE_TCHAR *priority_string,
else if (ACE_OS::strcmp (priority, ACE_TEXT ("~EMERGENCY")) == 0)
ACE_CLR_BITS (priority_mask, LM_EMERGENCY);
}
+
// Affect right priority mask.
+
if (mask == ACE_Log_Msg::PROCESS)
process_priority_mask_ = priority_mask;
else
thread_priority_mask_ = priority_mask;
}
+
// Parse the string containing all the flags and set the flags
// accordingly.
+
void
ACE_Logging_Strategy::tokenize (ACE_TCHAR *flag_string)
{
ACE_TCHAR *strtokp;
+
for (ACE_TCHAR *flag = ACE_OS::strtok_r (flag_string,
ACE_TEXT ("|"),
&strtokp);
@@ -116,11 +133,13 @@ ACE_Logging_Strategy::tokenize (ACE_TCHAR *flag_string)
ACE_SET_BITS (this->flags_, ACE_Log_Msg::SYSLOG);
}
}
+
int
ACE_Logging_Strategy::parse_args (int argc, ACE_TCHAR *argv[])
{
ACE_TRACE ("ACE_Logging_Strategy::parse_args");
ACE_TCHAR *temp;
+
// Perform data member initializations. BTW, do *not* initialize
// <thread_priority_mask_> or <process_priority_mask_> here to avoid
// unduing the behavior in <init>, where these are set by
@@ -133,8 +152,10 @@ ACE_Logging_Strategy::parse_args (int argc, ACE_TCHAR *argv[])
this->max_file_number_ = 1;
this->interval_ = ACE_DEFAULT_LOGFILE_POLL_INTERVAL;
this->max_size_ = 0;
+
ACE_Get_Opt get_opt (argc, argv,
ACE_TEXT ("f:i:k:m:n:N:op:s:t:w"), 0);
+
for (int c; (c = get_opt ()) != -1; )
{
switch (c)
@@ -205,6 +226,7 @@ ACE_Logging_Strategy::parse_args (int argc, ACE_TCHAR *argv[])
}
return 0;
}
+
ACE_Logging_Strategy::ACE_Logging_Strategy (void)
: thread_priority_mask_ (0),
process_priority_mask_ (0),
@@ -226,6 +248,7 @@ ACE_Logging_Strategy::ACE_Logging_Strategy (void)
#else /* ACE_DEFAULT_LOGFILE */
ACE_NEW (this->filename_,
ACE_TCHAR[MAXPATHLEN + 1]);
+
// Get the temporary directory
if (ACE::get_temp_dir
(this->filename_,
@@ -236,45 +259,60 @@ ACE_Logging_Strategy::ACE_Logging_Strategy (void)
ACE_TEXT ("defaulting to current directory\n")));
this->filename_[0] = 0;
}
+
// Add the filename to the end
ACE_OS::strcat (this->filename_,
ACE_TEXT ("logfile"));
#endif /* ACE_DEFAULT_LOGFILE */
}
+
ACE_Logging_Strategy::~ACE_Logging_Strategy (void)
{
// This is allocated in constructor, so it must be deallocated in
// the destructor!
delete [] this->filename_;
}
+
int
ACE_Logging_Strategy::fini (void)
{
delete [] this->filename_;
this->filename_ = 0; // Avoid double deletions.
+
delete [] this->logger_key_;
delete [] this->program_name_;
+
if (this->reactor ()
&& this->interval_ > 0 && this->max_size_ > 0)
this->reactor ()->cancel_timer (this);
+
return 0;
}
+
int
ACE_Logging_Strategy::init (int argc, ACE_TCHAR *argv[])
{
ACE_TRACE ("ACE_Logging_Strategy::init");
+
// Store current priority masks for changes in <parse_args>.
+
this->process_priority_mask_ =
this->log_msg_->priority_mask (ACE_Log_Msg::PROCESS);
+
this->thread_priority_mask_ =
this->log_msg_->priority_mask (ACE_Log_Msg::THREAD);
+
// Use the options hook to parse the command line arguments.
this->parse_args (argc, argv);
+
// Setup priorities (to original if not specified on command line)
+
this->log_msg_->priority_mask (thread_priority_mask_,
ACE_Log_Msg::THREAD);
+
this->log_msg_->priority_mask (process_priority_mask_,
ACE_Log_Msg::PROCESS);
+
// Check if any flags were specified. If none were specified, let
// the default behavior take effect.
if (this->flags_ != 0)
@@ -306,6 +344,7 @@ ACE_Logging_Strategy::init (int argc, ACE_TCHAR *argv[])
else if (output_file == 0)
output_file = ACE_OS::fopen (this->filename_,
ACE_TEXT ("at"));
+
if (output_file == 0)
return -1;
#else
@@ -328,6 +367,7 @@ ACE_Logging_Strategy::init (int argc, ACE_TCHAR *argv[])
-1);
delete_ostream = 1;
}
+
if (output_file->rdstate () != ios::goodbit)
{
if (delete_ostream)
@@ -338,6 +378,7 @@ ACE_Logging_Strategy::init (int argc, ACE_TCHAR *argv[])
// Set the <output_file> that'll be used by the rest of the
// code.
this->log_msg_->msg_ostream (output_file, delete_ostream);
+
// Setup a timeout handler to perform the maximum file size
// check (if required).
if (this->interval_ > 0 && this->max_size_ > 0)
@@ -345,6 +386,7 @@ ACE_Logging_Strategy::init (int argc, ACE_TCHAR *argv[])
if (this->reactor () == 0)
// Use singleton.
this->reactor (ACE_Reactor::instance ());
+
this->reactor ()->schedule_timer
(this, 0,
ACE_Time_Value (this->interval_),
@@ -354,10 +396,12 @@ ACE_Logging_Strategy::init (int argc, ACE_TCHAR *argv[])
// Now set the flags for Log_Msg
this->log_msg_->set_flags (this->flags_);
}
+
return this->log_msg_->open (this->program_name_,
this->log_msg_->flags (),
this->logger_key_);
}
+
int
ACE_Logging_Strategy::handle_timeout (const ACE_Time_Value &,
const void *)
@@ -373,6 +417,7 @@ ACE_Logging_Strategy::handle_timeout (const ACE_Time_Value &,
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("Cannot acquire lock!\n")),
-1);
+
// Close the current ostream.
#if defined (ACE_LACKS_IOSTREAM_TOTALLY)
FILE *output_file = (FILE *) this->log_msg_->msg_ostream ();
@@ -391,35 +436,43 @@ ACE_Logging_Strategy::handle_timeout (const ACE_Time_Value &,
{
// Just unlink the file.
ACE_OS::unlink (this->filename_);
+
// Open a new log file with the same name.
#if defined (ACE_LACKS_IOSTREAM_TOTALLY)
output_file = ACE_OS::fopen (this->filename_,
ACE_TEXT ("wt"));
+
if (output_file == 0)
return -1;
+
this->log_msg_->msg_ostream (output_file);
#else
output_file->open (ACE_TEXT_ALWAYS_CHAR (this->filename_),
ios::out);
#endif /* ACE_LACKS_IOSTREAM_TOTALLY */
+
// Release the lock previously acquired.
this->log_msg_->release ();
return 0;
}
}
count_++;
+
// Set the number of digits of the log_files labels.
int digits = 1, res = count_;
while((res = (res / 10))>0)
digits++;
+
if (ACE_OS::strlen (this->filename_) + digits <= MAXPATHLEN)
{
ACE_TCHAR backup[MAXPATHLEN+1];
+
// analyse if it was chosen the mode which will order the
// log_files
if (order_files_)
{
ACE_TCHAR to_backup[MAXPATHLEN+1];
+
// reorder the logs starting at the oldest (the biggest
// number) watch if we reached max_file_number_.
int max_num;
@@ -430,6 +483,7 @@ ACE_Logging_Strategy::handle_timeout (const ACE_Time_Value &,
max_num = max_file_number_;
else
max_num = count_;
+
for (int i = max_num ; i > 1 ;i--)
{
ACE_OS::sprintf (backup,
@@ -440,9 +494,11 @@ ACE_Logging_Strategy::handle_timeout (const ACE_Time_Value &,
ACE_TEXT ("%s.%d"),
this->filename_,
i - 1);
+
// Remove any existing old file; ignore error as
// file may not exist.
ACE_OS::unlink (backup);
+
// Rename the current log file to the name of the
// backup log file.
ACE_OS::rename (to_backup, backup);
@@ -455,14 +511,17 @@ ACE_Logging_Strategy::handle_timeout (const ACE_Time_Value &,
{
if (fixed_number_ && count_>max_file_number_)
count_ = 1; // start over from 1
+
ACE_OS::sprintf (backup,
ACE_TEXT ("%s.%d"),
this->filename_,
count_);
}
+
// Remove any existing old file; ignore error as file may
// not exist.
ACE_OS::unlink (backup);
+
// Rename the current log file to the name of the backup log
// file.
ACE_OS::rename (this->filename_, backup);
@@ -471,29 +530,38 @@ ACE_Logging_Strategy::handle_timeout (const ACE_Time_Value &,
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("Backup file name too long; ")
ACE_TEXT ("backup logfile not saved.\n")));
+
// Open a new log file by the same name
#if defined (ACE_LACKS_IOSTREAM_TOTALLY)
output_file = ACE_OS::fopen (this->filename_, ACE_TEXT ("wt"));
+
if (output_file == 0)
return -1;
+
this->log_msg_->msg_ostream (output_file);
#else
output_file->open (ACE_TEXT_ALWAYS_CHAR (this->filename_),
ios::out);
#endif /* ACE_LACKS_IOSTREAM_TOTALLY */
+
// Release the lock previously acquired.
this->log_msg_->release ();
}
+
return 0;
}
+
void
ACE_Logging_Strategy::log_msg (ACE_Log_Msg *log_msg)
{
this->log_msg_ = log_msg;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
// The following is a "Factory" used by the ACE_Service_Config and
// svc.conf file to dynamically initialize the state of the
// Logging_Strategy.
+
ACE_FACTORY_DEFINE (ACE, ACE_Logging_Strategy)
diff --git a/dep/ACE_wrappers/ace/Logging_Strategy.h b/dep/ACE_wrappers/ace/Logging_Strategy.h
index d114c055d70..8af68b32593 100644
--- a/dep/ACE_wrappers/ace/Logging_Strategy.h
+++ b/dep/ACE_wrappers/ace/Logging_Strategy.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Logging_Strategy.h
@@ -9,17 +10,23 @@
* @author Orlando Ribeiro <oribeiro@inescporto.pt>
*/
//=============================================================================
+
#ifndef ACE_LOGGING_STRATEGY_H
#define ACE_LOGGING_STRATEGY_H
+
#include "ace/Service_Object.h"
#include "ace/Log_Msg.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if !defined (ACE_DEFAULT_LOGFILE_POLL_INTERVAL)
#define ACE_DEFAULT_LOGFILE_POLL_INTERVAL 600 /* Seconds */
#endif /* ACE_DEFAULT_LOGFILE_POLL_INTERVAL */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Logging_Strategy
*
@@ -74,12 +81,16 @@ class ACE_Export ACE_Logging_Strategy : public ACE_Service_Object
public:
/// Constructor.
ACE_Logging_Strategy (void);
+
/// Destructor.
~ACE_Logging_Strategy (void);
+
/// Dynamic linking initialization hook.
virtual int init (int argc, ACE_TCHAR *argv[]);
+
/// Dynamic linking termination hook.
virtual int fini (void);
+
/**
* Timeout handler which tests logfile size. If the current logfile
* size exceeds <max_size_>, the current logfile is closed, saved to
@@ -87,6 +98,7 @@ public:
*/
virtual int handle_timeout (const ACE_Time_Value& tv,
const void* arg);
+
/**
* Parse arguments provided in svc.conf file.
* @arg '-f' Pass in the flags (such as OSTREAM, STDERR, LOGGER, VERBOSE,
@@ -113,52 +125,72 @@ public:
* reconfiguration.
*/
int parse_args (int argc, ACE_TCHAR *argv[]);
+
void log_msg (ACE_Log_Msg *log_msg);
+
protected:
/// Tokenize to set all the flags
void tokenize (ACE_TCHAR *flag_string);
+
/// Tokenize to set priorities (either process or thread one).
void priorities (ACE_TCHAR *priority_string,
ACE_Log_Msg::MASK_TYPE mask);
+
/// Current thread's priority mask set by <priorities>
u_long thread_priority_mask_;
+
/// Process-wide priority mask set by <priorities>
u_long process_priority_mask_;
+
/// Flags we keep track of.
u_long flags_;
+
/// File name we're logging to.
ACE_TCHAR *filename_;
+
/// Logger key for distributed logging.
ACE_TCHAR *logger_key_;
+
/// Program name to be used for %n format specifier.
ACE_TCHAR *program_name_;
+
/// If non-0 then wipeout the logfile, otherwise append to it.
/// Default value is 0.
bool wipeout_logfile_;
+
/// If non-0 we have a maximum number of log files we can write.
/// Default value is 0, i.e., no maximum number.
bool fixed_number_;
+
/// If non-0 we order the files as we rotate them. Default value
/// is 0, i.e., we do not rotate files by default.
bool order_files_;
+
/// This tells us in what file we last wrote. It will be increased
/// to enable multiple log files
int count_;
+
/// Tells us what is the maximum log file to write. We will write
/// <max_file_number_> + 1 files (includes the current log file).
/// Default value is 1, i.e., 2 files by default.
int max_file_number_;
+
/// If non-zero, sampling interval (in secs) at which maximum logfile
/// size is checked, otherwise logfile size can grow indefinitely.
/// Default value is 0.
u_long interval_;
+
/// Maximum logfile size (in KB). Default value is
/// <ACE_DEFAULT_MAX_LOGFILE_SIZE>.
u_long max_size_;
+
/// ACE_Log_Msg instance to work with
ACE_Log_Msg *log_msg_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
ACE_FACTORY_DECLARE (ACE, ACE_Logging_Strategy)
+
#endif /* ACE_LOGGING_STRATEGY_H */
diff --git a/dep/ACE_wrappers/ace/MEM_Acceptor.cpp b/dep/ACE_wrappers/ace/MEM_Acceptor.cpp
index e1c08be6f18..76bafc1ef05 100644
--- a/dep/ACE_wrappers/ace/MEM_Acceptor.cpp
+++ b/dep/ACE_wrappers/ace/MEM_Acceptor.cpp
@@ -1,16 +1,24 @@
// $Id: MEM_Acceptor.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/MEM_Acceptor.h"
+
#if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1)
+
#include "ace/OS_NS_stdio.h"
#include "ace/OS_NS_string.h"
#include "ace/OS_NS_sys_socket.h"
#include "ace/OS_NS_unistd.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/MEM_Acceptor.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace, MEM_Acceptor, "$Id: MEM_Acceptor.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_MEM_Acceptor)
+
void
ACE_MEM_Acceptor::dump (void) const
{
@@ -18,7 +26,9 @@ ACE_MEM_Acceptor::dump (void) const
ACE_TRACE ("ACE_MEM_Acceptor::dump");
#endif /* ACE_HAS_DUMP */
}
+
// Do nothing routine for constructor.
+
ACE_MEM_Acceptor::ACE_MEM_Acceptor (void)
: mmap_prefix_ (0),
malloc_options_ (ACE_DEFAULT_BASE_ADDR, 0),
@@ -26,12 +36,15 @@ ACE_MEM_Acceptor::ACE_MEM_Acceptor (void)
{
ACE_TRACE ("ACE_MEM_Acceptor::ACE_MEM_Acceptor");
}
+
ACE_MEM_Acceptor::~ACE_MEM_Acceptor (void)
{
ACE_TRACE ("ACE_MEM_Acceptor::~ACE_MEM_Acceptor");
delete[] this->mmap_prefix_;
}
+
// General purpose routine for performing server ACE_SOCK creation.
+
ACE_MEM_Acceptor::ACE_MEM_Acceptor (const ACE_MEM_Addr &remote_sap,
int reuse_addr,
int backlog,
@@ -48,6 +61,7 @@ ACE_MEM_Acceptor::ACE_MEM_Acceptor (const ACE_MEM_Addr &remote_sap,
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("ACE_MEM_Acceptor::ACE_MEM_Acceptor")));
}
+
int
ACE_MEM_Acceptor::open (const ACE_MEM_Addr &remote_sap,
int reuse_addr,
@@ -61,7 +75,9 @@ ACE_MEM_Acceptor::open (const ACE_MEM_Addr &remote_sap,
back_log,
protocol);
}
+
// General purpose routine for accepting new connections.
+
int
ACE_MEM_Acceptor::accept (ACE_MEM_Stream &new_stream,
ACE_MEM_Addr *remote_sap,
@@ -70,6 +86,7 @@ ACE_MEM_Acceptor::accept (ACE_MEM_Stream &new_stream,
int reset_new_handle)
{
ACE_TRACE ("ACE_MEM_Acceptor::accept");
+
int in_blocking_mode = 1;
if (this->shared_accept_start (timeout,
restart,
@@ -81,12 +98,14 @@ ACE_MEM_Acceptor::accept (ACE_MEM_Stream &new_stream,
struct sockaddr_in inet_addr;
int *len_ptr = 0;
int len = 0;
+
if (remote_sap != 0)
{
addr = reinterpret_cast<sockaddr *> (&inet_addr);
len = sizeof (inet_addr);
len_ptr = &len;
}
+
do
// On Win32 the third parameter to <accept> must be a NULL
// pointer if to ignore the client's address.
@@ -97,22 +116,27 @@ ACE_MEM_Acceptor::accept (ACE_MEM_Stream &new_stream,
&& restart != 0
&& errno == EINTR
&& timeout == 0);
+
if (remote_sap != 0)
{
ACE_INET_Addr temp (&inet_addr, len);
remote_sap->set_port_number (temp.get_port_number ());
}
}
+
if (this->shared_accept_finish (new_stream,
in_blocking_mode,
reset_new_handle) == -1)
return -1;
+
// Allocate 2 * MAXPATHLEN so we can accomodate the unique
// name that gets appended later
ACE_TCHAR buf [2 * MAXPATHLEN + 1];
+
ACE_INET_Addr local_addr;
if (new_stream.get_local_addr (local_addr) == -1)
return -1;
+
if (this->mmap_prefix_ != 0)
{
ACE_OS::sprintf (buf,
@@ -131,6 +155,7 @@ ACE_MEM_Acceptor::accept (ACE_MEM_Stream &new_stream,
ACE_TEXT ("defaulting to current directory\n")));
buf[0] = 0;
}
+
ACE_OS::sprintf (name,
ACE_TEXT ("MEM_Acceptor_%d_"),
local_addr.get_port_number ());
@@ -138,11 +163,15 @@ ACE_MEM_Acceptor::accept (ACE_MEM_Stream &new_stream,
}
ACE_TCHAR unique [MAXPATHLEN];
ACE_OS::unique_name (&new_stream, unique, MAXPATHLEN);
+
ACE_OS::strcat (buf, unique);
+
// Make sure we have a fresh start.
ACE_OS::unlink (buf);
+
new_stream.disable (ACE_NONBLOCK);
ACE_HANDLE new_handle = new_stream.get_handle ();
+
// Protocol negociation:
// Tell the client side what level of signaling strategy
// we support.
@@ -158,40 +187,50 @@ ACE_MEM_Acceptor::accept (ACE_MEM_Stream &new_stream,
ACE_ERROR_RETURN ((LM_DEBUG,
ACE_TEXT ("ACE_MEM_Acceptor::accept error sending strategy\n")),
-1);
+
// Now we get the signaling strategy the client support.
if (ACE::recv (new_handle, &client_signaling,
sizeof (ACE_INT16)) == -1)
ACE_ERROR_RETURN ((LM_DEBUG,
ACE_TEXT ("ACE_MEM_Acceptor::%p error receiving strategy\n"), ACE_TEXT ("accept")),
-1);
+
// Ensure minimum buffer size
if (this->malloc_options_.minimum_bytes_ < ACE_MEM_STREAM_MIN_BUFFER)
this->malloc_options_.minimum_bytes_ = ACE_MEM_STREAM_MIN_BUFFER;
+
// Client will decide what signaling strategy to use.
+
// Now set up the shared memory malloc pool.
if (new_stream.init (buf,
static_cast<ACE_MEM_IO::Signal_Strategy> (client_signaling),
&this->malloc_options_) == -1)
return -1;
+
// @@ Need to handle timeout here.
ACE_UINT16 buf_len = static_cast<ACE_UINT16> ((ACE_OS::strlen (buf) + 1) *
sizeof (ACE_TCHAR));
+
// No need to worry about byte-order because both parties should always
// be on the same machine.
if (ACE::send (new_handle, &buf_len, sizeof (ACE_UINT16)) == -1)
return -1;
+
// Now send the pathname of the mmap file.
if (ACE::send (new_handle, buf, buf_len) == -1)
return -1;
return 0;
}
+
int
ACE_MEM_Acceptor::shared_accept_finish (ACE_MEM_Stream new_stream,
int in_blocking_mode,
int reset_new_handle) const
{
ACE_TRACE ("ACE_MEM_Acceptor::shared_accept_finish ()");
+
ACE_HANDLE new_handle = new_stream.get_handle ();
+
// Check to see if we were originally in blocking mode, and if so,
// set the <new_stream>'s handle and <this> handle to be in blocking
// mode.
@@ -199,6 +238,7 @@ ACE_MEM_Acceptor::shared_accept_finish (ACE_MEM_Stream new_stream,
{
// Save/restore errno.
ACE_Errno_Guard error (errno);
+
// Only disable ACE_NONBLOCK if we weren't in non-blocking mode
// originally.
ACE::clr_flags (this->get_handle (),
@@ -206,6 +246,7 @@ ACE_MEM_Acceptor::shared_accept_finish (ACE_MEM_Stream new_stream,
ACE::clr_flags (new_handle,
ACE_NONBLOCK);
}
+
#if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
if (reset_new_handle)
// Reset the event association inherited by the new handle.
@@ -215,8 +256,11 @@ ACE_MEM_Acceptor::shared_accept_finish (ACE_MEM_Stream new_stream,
#endif /* ACE_WIN32 */
if (new_handle == ACE_INVALID_HANDLE)
return -1;
+
return 0;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */
diff --git a/dep/ACE_wrappers/ace/MEM_Acceptor.h b/dep/ACE_wrappers/ace/MEM_Acceptor.h
index ee2fbece7ed..b982ab81642 100644
--- a/dep/ACE_wrappers/ace/MEM_Acceptor.h
+++ b/dep/ACE_wrappers/ace/MEM_Acceptor.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file MEM_Acceptor.h
@@ -8,23 +9,33 @@
* @author Nanbor Wang <nanbor@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_MEM_ACCEPTOR_H
#define ACE_MEM_ACCEPTOR_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#include "ace/SOCK_Acceptor.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1)
+
#include "ace/MEM_Stream.h"
#include "ace/MEM_Addr.h"
+
#if !defined (ACE_HAS_WINCE)
#include "ace/OS_QoS.h"
#endif // ACE_HAS_WINCE
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward decl.
class ACE_Reactor;
+
/**
* @class ACE_MEM_Acceptor
*
@@ -46,13 +57,16 @@ public:
// = Initialization methods.
/// Default constructor.
ACE_MEM_Acceptor (void);
+
/// destructor.
~ACE_MEM_Acceptor (void);
+
/// Initiate a passive mode socket.
ACE_MEM_Acceptor (const ACE_MEM_Addr &remote_sap,
int reuse_addr = 0,
int backlog = ACE_DEFAULT_BACKLOG,
int protocol = 0);
+
/**
* Initialize a passive-mode BSD-style acceptor socket (no QoS).
* @a local_sap is the address that we're going to listen for
@@ -64,17 +78,20 @@ public:
int reuse_addr = 0,
int backlog = ACE_DEFAULT_BACKLOG,
int protocol = 0);
+
/// Accept a new data transfer connection.
int accept (ACE_MEM_Stream &new_ipc_sap,
ACE_MEM_Addr *remote_addr = 0,
ACE_Time_Value *timeout = 0,
int restart = 1,
int reset_new_handle = 0);
+
/// Perform operations that must occur after <ACE_OS::accept> is
/// called.
int shared_accept_finish (ACE_MEM_Stream new_stream,
int in_blocking_mode,
int reset_new_handle) const;
+
/**
* Accessor/mutator of mmap filename prefix. By default, the
* <mmap_prefix_> is not set and the mmap filename is
@@ -86,28 +103,37 @@ public:
*/
const ACE_TCHAR *mmap_prefix (void) const;
void mmap_prefix (const ACE_TCHAR *prefix);
+
/**
* Change the initial MMAP buffer size (in bytes) of the MEM_Stream
* this MEM_Acceptor creates.
*/
void init_buffer_size (ACE_OFF_T bytes);
+
/// Get the preferred signaling strategy.
ACE_MEM_IO::Signal_Strategy preferred_strategy (void) const;
+
/// Set the preferred signaling strategy.
void preferred_strategy (ACE_MEM_IO::Signal_Strategy strategy);
+
/// Return the local endpoint address in the referenced <ACE_Addr>.
/// Returns 0 if successful, else -1.
int get_local_addr (ACE_MEM_Addr &) const;
+
/// Accessor to the mmap options.
/// @deprecated This method has been deprecated.
ACE_MEM_SAP::MALLOC_OPTIONS& malloc_options (void);
+
// = Meta-type info
typedef ACE_MEM_Addr PEER_ADDR;
typedef ACE_MEM_Stream PEER_STREAM;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
// = The following methods should not be accessable externally
// because MEM_Acceptor do not support their semantics.
@@ -116,6 +142,7 @@ protected:
int protocol_family = PF_INET,
int backlog = ACE_DEFAULT_BACKLOG,
int protocol = 0);
+
int open (const ACE_Addr &local_sap,
ACE_Protocol_Info *protocolinfo,
ACE_SOCK_GROUP g,
@@ -124,11 +151,13 @@ protected:
int protocol_family,
int backlog = ACE_DEFAULT_BACKLOG,
int protocol = 0);
+
int accept (ACE_SOCK_Stream &new_stream,
ACE_Addr *remote_addr = 0,
ACE_Time_Value *timeout = 0,
int restart = 1,
int reset_new_handle = 0) const;
+
#if !defined (ACE_HAS_WINCE)
int accept (ACE_SOCK_Stream &new_stream,
ACE_Accept_QoS_Params qos_params,
@@ -137,21 +166,28 @@ protected:
int restart = 1,
int reset_new_handle = 0) const;
#endif // ACE_HAS_WINCE
+
private:
/// The filename prefix of the created mmap files. It should
/// contains the absolute path name of the file.
ACE_TCHAR *mmap_prefix_;
+
/// A cached MALLOC_OPTIONS. MEM_Accaptor use it to create the shared
/// mamory malloc upon every incoming connection.
ACE_MEM_SAP::MALLOC_OPTIONS malloc_options_;
+
/// Preferred signaling strategy.
ACE_MEM_IO::Signal_Strategy preferred_strategy_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/MEM_Acceptor.inl"
#endif /* __ACE_INLINE__ */
+
#endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */
+
#include /**/ "ace/post.h"
#endif /* ACE_MEM_ACCEPTOR_H */
diff --git a/dep/ACE_wrappers/ace/MEM_Acceptor.inl b/dep/ACE_wrappers/ace/MEM_Acceptor.inl
index 40054221334..9bcc211e2b4 100644
--- a/dep/ACE_wrappers/ace/MEM_Acceptor.inl
+++ b/dep/ACE_wrappers/ace/MEM_Acceptor.inl
@@ -1,7 +1,9 @@
// -*- C++ -*-
//
// $Id: MEM_Acceptor.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE int
ACE_MEM_Acceptor::open (const ACE_Addr &local_sap,
ACE_Protocol_Info *protocolinfo,
@@ -16,6 +18,7 @@ ACE_MEM_Acceptor::open (const ACE_Addr &local_sap,
(local_sap, protocolinfo, g, flags, reuse_addr, protocol_family,
backlog, protocol);
}
+
ACE_INLINE int
ACE_MEM_Acceptor::accept (ACE_SOCK_Stream &new_stream,
ACE_Addr *remote_addr,
@@ -26,6 +29,7 @@ ACE_MEM_Acceptor::accept (ACE_SOCK_Stream &new_stream,
return this->ACE_SOCK_Acceptor::accept
(new_stream, remote_addr, timeout, restart, reset_new_handle);
}
+
#if !defined (ACE_HAS_WINCE)
ACE_INLINE int
ACE_MEM_Acceptor::accept (ACE_SOCK_Stream &new_stream,
@@ -39,19 +43,23 @@ ACE_MEM_Acceptor::accept (ACE_SOCK_Stream &new_stream,
(new_stream, qos_params, remote_addr, timeout, restart, reset_new_handle);
}
#endif // ACE_HAS_WINCE
+
ACE_INLINE int
ACE_MEM_Acceptor::get_local_addr (ACE_MEM_Addr &sap) const
{
ACE_INET_Addr temp;
+
this->ACE_SOCK_Acceptor::get_local_addr (temp);
sap.set_port_number (temp.get_port_number ());
return 0;
}
+
ACE_INLINE const ACE_TCHAR *
ACE_MEM_Acceptor::mmap_prefix (void) const
{
return this->mmap_prefix_;
}
+
ACE_INLINE void
ACE_MEM_Acceptor::mmap_prefix (const ACE_TCHAR *prefix)
{
@@ -64,26 +72,32 @@ ACE_MEM_Acceptor::mmap_prefix (const ACE_TCHAR *prefix)
this->mmap_prefix_ = ACE::strnew (prefix);
}
}
+
ACE_INLINE ACE_MEM_IO::Signal_Strategy
ACE_MEM_Acceptor::preferred_strategy (void) const
{
return this->preferred_strategy_;
}
+
ACE_INLINE void
ACE_MEM_Acceptor::preferred_strategy (ACE_MEM_IO::Signal_Strategy strategy)
{
this->preferred_strategy_ = strategy;
}
+
ACE_INLINE void
ACE_MEM_Acceptor::init_buffer_size (ACE_OFF_T bytes)
{
this->malloc_options_.minimum_bytes_ = bytes;
}
+
ACE_INLINE ACE_MEM_SAP::MALLOC_OPTIONS &
ACE_MEM_Acceptor::malloc_options (void)
{
// @@ This function has been deprecated and will be removed in the
// future.
+
return this->malloc_options_;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/MEM_Addr.cpp b/dep/ACE_wrappers/ace/MEM_Addr.cpp
index 48187dcb268..92069775459 100644
--- a/dep/ACE_wrappers/ace/MEM_Addr.cpp
+++ b/dep/ACE_wrappers/ace/MEM_Addr.cpp
@@ -1,26 +1,37 @@
// $Id: MEM_Addr.cpp 80826 2008-03-04 14:51:23Z wotte $
+
// Defines the Internet domain address family address format.
+
#include "ace/MEM_Addr.h"
+
#if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1)
+
#if !defined (__ACE_INLINE__)
#include "ace/MEM_Addr.inl"
#endif /* __ACE_INLINE__ */
+
#include "ace/Log_Msg.h"
#include "ace/OS_NS_stdlib.h"
#include "ace/OS_NS_unistd.h"
#include "ace/os_include/os_netdb.h"
+
ACE_RCSID (ace,
MEM_Addr,
"$Id: MEM_Addr.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_MEM_Addr)
+
// Transform the current address into string format.
+
ACE_MEM_Addr::ACE_MEM_Addr (void)
: ACE_Addr (AF_INET, sizeof (ACE_MEM_Addr))
{
// ACE_TRACE ("ACE_MEM_Addr::ACE_MEM_Addr");
this->initialize_local (0);
}
+
ACE_MEM_Addr::ACE_MEM_Addr (const ACE_MEM_Addr &sa)
: ACE_Addr (AF_INET, sizeof (ACE_MEM_Addr))
{
@@ -28,6 +39,7 @@ ACE_MEM_Addr::ACE_MEM_Addr (const ACE_MEM_Addr &sa)
this->external_.set (sa.external_);
this->internal_.set (sa.internal_);
}
+
ACE_MEM_Addr::ACE_MEM_Addr (const ACE_TCHAR port_number[])
: ACE_Addr (AF_INET, sizeof (ACE_MEM_Addr))
{
@@ -37,29 +49,35 @@ ACE_MEM_Addr::ACE_MEM_Addr (const ACE_TCHAR port_number[])
10));
this->initialize_local (pn);
}
+
ACE_MEM_Addr::ACE_MEM_Addr (u_short port_number)
: ACE_Addr (AF_INET, sizeof (ACE_MEM_Addr))
{
ACE_TRACE ("ACE_MEM_Addr::ACE_MEM_Addr");
this->initialize_local (port_number);
}
+
ACE_MEM_Addr::~ACE_MEM_Addr (void)
{
}
+
int
ACE_MEM_Addr::initialize_local (u_short port_number)
{
ACE_TCHAR name[MAXHOSTNAMELEN + 1];
if (ACE_OS::hostname (name, MAXHOSTNAMELEN+1) == -1)
return -1;
+
this->external_.set (port_number, name);
this->internal_.set (port_number, ACE_TEXT ("localhost"));
return 0;
}
+
int
ACE_MEM_Addr::same_host (const ACE_INET_Addr &sap)
{
ACE_TRACE ("ACE_MEM_Addr::same_host");
+
// ACE_INET_Addr::operator== takes port number into account, so get
// the addresses without a port number and compare.
ACE_INET_Addr me (this->external_);
@@ -68,39 +86,49 @@ ACE_MEM_Addr::same_host (const ACE_INET_Addr &sap)
you.set_port_number (0);
return me == you;
}
+
int
ACE_MEM_Addr::addr_to_string (ACE_TCHAR s[],
size_t size,
int ipaddr_format) const
{
ACE_TRACE ("ACE_MEM_Addr::addr_to_string");
+
return this->external_.addr_to_string (s, size, ipaddr_format);
}
+
// Transform the string into the current addressing format.
+
int
ACE_MEM_Addr::string_to_addr (const ACE_TCHAR s[])
{
ACE_TRACE ("ACE_MEM_Addr::string_to_addr");
+
u_short pn = static_cast<u_short> (ACE_OS::strtoul (s,
0,
10));
return this->set (pn);
}
+
// Return the address.
+
void *
ACE_MEM_Addr::get_addr (void) const
{
ACE_TRACE ("ACE_MEM_Addr::get_addr");
return this->external_.get_addr ();
}
+
// Set a pointer to the address.
void
ACE_MEM_Addr::set_addr (void *addr, int len)
{
ACE_TRACE ("ACE_MEM_Addr::set_addr");
+
this->external_.set_addr (addr, len);
this->internal_.set_port_number (this->external_.get_port_number ());
}
+
int
ACE_MEM_Addr::get_host_name (ACE_TCHAR hostname[],
size_t len) const
@@ -108,29 +136,36 @@ ACE_MEM_Addr::get_host_name (ACE_TCHAR hostname[],
ACE_TRACE ("ACE_MEM_Addr::get_host_name");
return this->external_.get_host_name (hostname, len);
}
+
// Return the character representation of the hostname.
+
const char *
ACE_MEM_Addr::get_host_name (void) const
{
ACE_TRACE ("ACE_MEM_Addr::get_host_name");
return this->external_.get_host_name ();
}
+
u_long
ACE_MEM_Addr::hash (void) const
{
return this->external_.hash ();
}
+
void
ACE_MEM_Addr::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_MEM_Addr::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
this->external_.dump ();
this->internal_.dump ();
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */
diff --git a/dep/ACE_wrappers/ace/MEM_Addr.h b/dep/ACE_wrappers/ace/MEM_Addr.h
index da18f221594..be67b507982 100644
--- a/dep/ACE_wrappers/ace/MEM_Addr.h
+++ b/dep/ACE_wrappers/ace/MEM_Addr.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file MEM_Addr.h
@@ -9,16 +10,23 @@
*/
//==========================================================================
+
#ifndef ACE_MEM_ADDR_H
#define ACE_MEM_ADDR_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1)
+
#include "ace/INET_Addr.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_MEM_Addr
*
@@ -31,20 +39,29 @@ public:
// = Initialization methods.
/// Default constructor.
ACE_MEM_Addr (void);
+
/// Copy constructor.
ACE_MEM_Addr (const ACE_MEM_Addr &);
+
/// Creates an ACE_MEM_Addr from a @a port_number
ACE_MEM_Addr (u_short port_number);
+
/// Creates an ACE_MEM_Addr from a @a port_name.
explicit ACE_MEM_Addr (const ACE_TCHAR port_name[]);
+
/// Default dtor.
~ACE_MEM_Addr (void);
+
// = Direct initialization methods.
+
/// Default initialization routine.
int initialize_local (u_short port);
+
/// Check if @a sap designates an endpoint on the same host.
int same_host (const ACE_INET_Addr& sap);
+
// These methods are useful after the object has been constructed.
+
/**
* Initializes an ACE_MEM_Addr from a @a port_number. If @a encode
* is enabled then @a port_number is converted into network byte order,
@@ -52,65 +69,88 @@ public:
* are passed straight through.
*/
int set (u_short port_number, int encode = 1);
+
/// Uses <getservbyname> to initialize an ACE_MEM_Addr from a
/// <port_name>, the remote <host_name>, and the <protocol>.
int set (const ACE_TCHAR port_name[]);
+
/// Return a pointer to the underlying network address.
virtual void *get_addr (void) const;
+
/// Set a pointer to the address.
virtual void set_addr (void *, int len);
+
/// Transform the external ACE_MEM_Addr address into string
/// format.
virtual int addr_to_string (ACE_TCHAR buffer[],
size_t size,
int ipaddr_format = 1) const;
+
/// Initializes the external ACE_MEM_Addr from the @a address.
virtual int string_to_addr (const ACE_TCHAR address[]);
+
/// Sets the port number.
void set_port_number (u_short,
int encode = 1);
+
/// Return the port number, converting it into host byte order.
u_short get_port_number (void) const;
+
/// Return the character representation of the hostname.
int get_host_name (ACE_TCHAR hostname[],
size_t hostnamelen) const;
+
/**
* Return the character representation of the hostname (this version
* is non-reentrant since it returns a pointer to a static data
* area).
*/
const char *get_host_name (void) const;
+
/// Return the "dotted decimal" external address.
const char *get_host_addr (void) const;
+
/// Return the 4-byte external IP address, converting it into host byte
/// order.
ACE_UINT32 get_ip_address (void) const;
+
const ACE_INET_Addr &get_remote_addr (void) const;
const ACE_INET_Addr &get_local_addr (void) const;
+
/// Compare two addresses for equality. The addresses are considered
/// equal if they contain the same IP address and port number.
bool operator == (const ACE_MEM_Addr &SAP) const;
bool operator == (const ACE_INET_Addr &SAP) const;
+
/// Compare two addresses for inequality.
bool operator != (const ACE_MEM_Addr &SAP) const;
bool operator != (const ACE_INET_Addr &SAP) const;
+
/// Computes and returns hash value.
virtual u_long hash (void) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// External INET addr used for identifying host.
ACE_INET_Addr external_;
+
/// Internal INET addr for accepting/connecting.
ACE_INET_Addr internal_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/MEM_Addr.inl"
#endif /* __ACE_INLINE__ */
+
#endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */
+
#include /**/ "ace/post.h"
#endif /* ACE_MEM_ADDR_H */
diff --git a/dep/ACE_wrappers/ace/MEM_Addr.inl b/dep/ACE_wrappers/ace/MEM_Addr.inl
index 63fb7a81ee8..ef19536dfe9 100644
--- a/dep/ACE_wrappers/ace/MEM_Addr.inl
+++ b/dep/ACE_wrappers/ace/MEM_Addr.inl
@@ -2,17 +2,23 @@
//
// $Id: MEM_Addr.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Global_Macros.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Set the port number.
+
ACE_INLINE void
ACE_MEM_Addr::set_port_number (u_short port_number,
int encode)
{
ACE_TRACE ("ACE_MEM_Addr::set_port_number");
+
this->external_.set_port_number (port_number, encode);
this->internal_.set_port_number (port_number, encode);
}
+
ACE_INLINE int
ACE_MEM_Addr::set (u_short port_number, int encode)
{
@@ -20,68 +26,86 @@ ACE_MEM_Addr::set (u_short port_number, int encode)
this->set_port_number (port_number, encode);
return 0;
}
+
ACE_INLINE int
ACE_MEM_Addr::set (const ACE_TCHAR port_number[])
{
ACE_TRACE ("ACE_MEM_Addr::set");
return this->string_to_addr (port_number);
}
+
// Return the port number.
+
ACE_INLINE u_short
ACE_MEM_Addr::get_port_number (void) const
{
ACE_TRACE ("ACE_MEM_Addr::get_port_number");
return this->internal_.get_port_number ();
}
+
// Return the dotted Internet address.
+
ACE_INLINE const char *
ACE_MEM_Addr::get_host_addr (void) const
{
ACE_TRACE ("ACE_MEM_Addr::get_host_addr");
return this->internal_.get_host_addr ();
}
+
// Return the 4-byte IP address, converting it into host byte order.
+
ACE_INLINE ACE_UINT32
ACE_MEM_Addr::get_ip_address (void) const
{
ACE_TRACE ("ACE_MEM_Addr::get_ip_address");
return this->external_.get_ip_address ();
}
+
ACE_INLINE const ACE_INET_Addr &
ACE_MEM_Addr::get_local_addr (void) const
{
return this->internal_;
}
+
ACE_INLINE const ACE_INET_Addr &
ACE_MEM_Addr::get_remote_addr (void) const
{
return this->external_;
}
+
// Compare two addresses for equality.
+
ACE_INLINE bool
ACE_MEM_Addr::operator == (const ACE_MEM_Addr &sap) const
{
ACE_TRACE ("ACE_MEM_Addr::operator ==");
+
return this->external_ == sap.external_ &&
this->internal_ == sap.internal_;
}
+
ACE_INLINE bool
ACE_MEM_Addr::operator == (const ACE_INET_Addr &sap) const
{
ACE_TRACE ("ACE_MEM_Addr::operator ==");
+
return this->external_ == sap;
}
+
// Compare two addresses for inequality.
+
ACE_INLINE bool
ACE_MEM_Addr::operator != (const ACE_MEM_Addr &sap) const
{
ACE_TRACE ("ACE_MEM_Addr::operator !=");
return !((*this) == sap);
}
+
ACE_INLINE bool
ACE_MEM_Addr::operator != (const ACE_INET_Addr &sap) const
{
ACE_TRACE ("ACE_MEM_Addr::operator !=");
return !((*this) == sap);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/MEM_Connector.cpp b/dep/ACE_wrappers/ace/MEM_Connector.cpp
index 5423d570a67..21b8d94fa3a 100644
--- a/dep/ACE_wrappers/ace/MEM_Connector.cpp
+++ b/dep/ACE_wrappers/ace/MEM_Connector.cpp
@@ -1,29 +1,39 @@
// MEM_Connector.cpp
// $Id: MEM_Connector.cpp 81517 2008-04-29 07:23:47Z johnnyw $
+
#include "ace/MEM_Connector.h"
+
ACE_RCSID(ace, MEM_Connector, "$Id: MEM_Connector.cpp 81517 2008-04-29 07:23:47Z johnnyw $")
+
#if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1)
+
#if !defined (__ACE_INLINE__)
#include "ace/MEM_Connector.inl"
#endif /* __ACE_INLINE__ */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_MEM_Connector)
+
void
ACE_MEM_Connector::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_MEM_Connector::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n")));
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
ACE_MEM_Connector::ACE_MEM_Connector (void)
: malloc_options_ (ACE_DEFAULT_BASE_ADDR, 0),
preferred_strategy_ (ACE_MEM_IO::Reactive)
{
ACE_TRACE ("ACE_MEM_Connector::ACE_MEM_Connector");
}
+
// Establish a connection.
ACE_MEM_Connector::ACE_MEM_Connector (ACE_MEM_Stream &new_stream,
const ACE_INET_Addr &remote_sap,
@@ -46,6 +56,7 @@ ACE_MEM_Connector::ACE_MEM_Connector (ACE_MEM_Stream &new_stream,
flags,
perms);
}
+
int
ACE_MEM_Connector::connect (ACE_MEM_Stream &new_stream,
const ACE_INET_Addr &remote_sap,
@@ -56,6 +67,7 @@ ACE_MEM_Connector::connect (ACE_MEM_Stream &new_stream,
int perms)
{
ACE_TRACE ("ACE_MEM_Connector::connect");
+
if (!this->address_.same_host (remote_sap))
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("(%P|%t) MEM_Connector can't connect ")
@@ -69,7 +81,9 @@ ACE_MEM_Connector::connect (ACE_MEM_Stream &new_stream,
else
this->address_.set_port_number (remote_sap.get_port_number ());
+
ACE_SOCK_Stream temp_stream;
+
if (ACE_SOCK_Connector::connect (temp_stream,
this->address_.get_local_addr (),
timeout, local_sap,
@@ -79,12 +93,15 @@ ACE_MEM_Connector::connect (ACE_MEM_Stream &new_stream,
ACE_TEXT ("ACE_MEM_Connector::connect")),
-1);
+
ACE_HANDLE new_handle = temp_stream.get_handle ();
new_stream.set_handle (new_handle);
new_stream.disable (ACE_NONBLOCK);
// Do not close the handle.
+
// now we should setup the mmap malloc.
ACE_TCHAR buf[MAXPATHLEN];
+
// @@ Need to handle timeout here.
ACE_INT16 server_strategy = ACE_MEM_IO::Reactive;
// Receive the signaling strategy theserver support.
@@ -93,33 +110,41 @@ ACE_MEM_Connector::connect (ACE_MEM_Stream &new_stream,
ACE_ERROR_RETURN ((LM_DEBUG,
ACE_TEXT ("ACE_MEM_Connector::connect error receiving strategy\n")),
-1);
+
// If either side don't support MT, we will not use it.
#if defined (ACE_WIN32) || !defined (_ACE_USE_SV_SEM)
if (! (this->preferred_strategy_ == ACE_MEM_IO::MT &&
server_strategy == ACE_MEM_IO::MT))
#endif /* ACE_WIN32 || !_ACE_USE_SV_SEM */
server_strategy = ACE_MEM_IO::Reactive;
+
if (ACE::send (new_handle, &server_strategy,
sizeof (ACE_INT16)) == -1)
ACE_ERROR_RETURN ((LM_DEBUG,
ACE_TEXT ("ACE_MEM_Connector::connect error sending strategy\n")),
-1);
+
ACE_INT16 buf_len;
// Byte-order is not a problem for this read.
if (ACE::recv (new_handle, &buf_len, sizeof (buf_len)) == -1)
ACE_ERROR_RETURN ((LM_DEBUG,
ACE_TEXT ("ACE_MEM_Connector::connect error receiving shm filename length\n")),
-1);
+
if (ACE::recv (new_handle, buf, buf_len) == -1)
ACE_ERROR_RETURN ((LM_DEBUG,
ACE_TEXT ("ACE_MEM_Connector::connect error receiving shm filename.\n")),
-1);
+
if (new_stream.init (buf,
static_cast<ACE_MEM_IO::Signal_Strategy> (server_strategy),
&this->malloc_options_) == -1)
return -1;
+
return 0;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */
diff --git a/dep/ACE_wrappers/ace/MEM_Connector.h b/dep/ACE_wrappers/ace/MEM_Connector.h
index ce7e8b507f8..d976d8d91bf 100644
--- a/dep/ACE_wrappers/ace/MEM_Connector.h
+++ b/dep/ACE_wrappers/ace/MEM_Connector.h
@@ -1,4 +1,5 @@
/* -*- C++ -*- */
+
//=============================================================================
/**
* @file MEM_Connector.h
@@ -8,18 +9,25 @@
* @author Nanbor Wang <nanbor@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_MEM_CONNECTOR_H
#define ACE_MEM_CONNECTOR_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1)
+
#include "ace/SOCK_Connector.h"
#include "ace/MEM_Stream.h"
#include "ace/MEM_Addr.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_MEM_Connector
*
@@ -32,6 +40,7 @@ public:
// = Initialization methods.
/// Default constructor.
ACE_MEM_Connector (void);
+
/**
* Actively connect to a peer, producing a connected @c ACE_MEM_Stream
* object if the connection succeeds.
@@ -76,6 +85,7 @@ public:
int reuse_addr = 0,
int flags = 0,
int perms = 0);
+
/**
* Actively connect to a peer, producing a connected @c ACE_MEM_Stream
* object if the connection succeeds.
@@ -124,34 +134,47 @@ public:
int reuse_addr = 0,
int flags = 0,
int perms = 0);
+
/// Get the preferred signaling strategy.
ACE_MEM_IO::Signal_Strategy preferred_strategy (void) const;
+
/// Set the preferred signaling strategy.
void preferred_strategy (ACE_MEM_IO::Signal_Strategy strategy);
+
/// Accessor to underlying malloc options.
/// @deprecated This method has been deprecated.
ACE_MEM_SAP::MALLOC_OPTIONS &malloc_options (void);
+
// = Meta-type info
typedef ACE_INET_Addr PEER_ADDR;
typedef ACE_MEM_Stream PEER_STREAM;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// The acceptor address this connector is connecting to.
ACE_MEM_Addr address_;
+
/// A cached MALLOC_OPTIONS that the MEM_Connector used to initialize
/// the shared memory malloc update connection establishment.
ACE_MEM_SAP::MALLOC_OPTIONS malloc_options_;
+
/// Preferred signaling strategy.
ACE_MEM_IO::Signal_Strategy preferred_strategy_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/MEM_Connector.inl"
#endif /* __ACE_INLINE__ */
+
#endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */
+
#include /**/ "ace/post.h"
#endif /* ACE_MEM_CONNECTOR_H */
diff --git a/dep/ACE_wrappers/ace/MEM_Connector.inl b/dep/ACE_wrappers/ace/MEM_Connector.inl
index c038e1668a7..e61399ea936 100644
--- a/dep/ACE_wrappers/ace/MEM_Connector.inl
+++ b/dep/ACE_wrappers/ace/MEM_Connector.inl
@@ -1,23 +1,30 @@
// -*- C++ -*-
//
// $Id: MEM_Connector.inl 80826 2008-03-04 14:51:23Z wotte $
+
// Establish a connection.
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE ACE_MEM_IO::Signal_Strategy
ACE_MEM_Connector::preferred_strategy (void) const
{
return this->preferred_strategy_;
}
+
ACE_INLINE void
ACE_MEM_Connector::preferred_strategy (ACE_MEM_IO::Signal_Strategy strategy)
{
this->preferred_strategy_ = strategy;
}
+
ACE_INLINE ACE_MEM_SAP::MALLOC_OPTIONS &
ACE_MEM_Connector::malloc_options (void)
{
// @@ This function has been deprecated and will be removed in the
// future.
+
return this->malloc_options_;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/MEM_IO.cpp b/dep/ACE_wrappers/ace/MEM_IO.cpp
index 8685b176f14..b1c31619354 100644
--- a/dep/ACE_wrappers/ace/MEM_IO.cpp
+++ b/dep/ACE_wrappers/ace/MEM_IO.cpp
@@ -1,17 +1,25 @@
// MEM_IO.cpp
// $Id: MEM_IO.cpp 82559 2008-08-07 20:23:07Z parsons $
+
#include "ace/MEM_IO.h"
#include "ace/Handle_Set.h"
+
#if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1)
+
#if !defined (__ACE_INLINE__)
#include "ace/MEM_IO.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace, MEM_IO, "$Id: MEM_IO.cpp 82559 2008-08-07 20:23:07Z parsons $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_MEM_IO)
+
ACE_Reactive_MEM_IO::~ACE_Reactive_MEM_IO (void)
{
}
+
int
ACE_Reactive_MEM_IO::init (ACE_HANDLE handle,
const ACE_TCHAR *name,
@@ -22,20 +30,24 @@ ACE_Reactive_MEM_IO::init (ACE_HANDLE handle,
return this->create_shm_malloc (name,
options);
}
+
ssize_t
ACE_Reactive_MEM_IO::recv_buf (ACE_MEM_SAP_Node *&buf,
int flags,
const ACE_Time_Value *timeout)
{
ACE_TRACE ("ACE_Reactive_MEM_IO::recv_buf");
+
if (this->shm_malloc_ == 0 || this->handle_ == ACE_INVALID_HANDLE)
return -1;
+
ACE_OFF_T new_offset = 0;
ssize_t retv = ACE::recv (this->handle_,
(char *) &new_offset,
sizeof (ACE_OFF_T),
flags,
timeout);
+
if (retv == 0)
{
// ACE_DEBUG ((LM_INFO, "MEM_Stream closed\n"));
@@ -48,23 +60,28 @@ ACE_Reactive_MEM_IO::recv_buf (ACE_MEM_SAP_Node *&buf,
buf = 0;
return -1;
}
+
return this->get_buf_len (new_offset, buf);
}
+
ssize_t
ACE_Reactive_MEM_IO::send_buf (ACE_MEM_SAP_Node *buf,
int flags,
const ACE_Time_Value *timeout)
{
ACE_TRACE ("ACE_Reactive_MEM_IO::send_buf");
+
if (this->shm_malloc_ == 0 || this->handle_ == ACE_INVALID_HANDLE)
{
return -1;
}
+
// The offset.
ACE_OFF_T offset =
ACE_Utils::truncate_cast<ACE_OFF_T> (
reinterpret_cast<char *> (buf)
- static_cast<char *> (this->shm_malloc_->base_addr ()));
+
// Send the offset value over the socket.
if (ACE::send (this->handle_,
(const char *) &offset,
@@ -74,16 +91,20 @@ ACE_Reactive_MEM_IO::send_buf (ACE_MEM_SAP_Node *buf,
{
// unsucessful send, release the memory in the shared-memory.
this->release_buffer (buf);
+
return -1;
}
+
return ACE_Utils::truncate_cast<ssize_t> (buf->size ());
}
+
#if defined (ACE_WIN32) || !defined (_ACE_USE_SV_SEM)
int
ACE_MT_MEM_IO::Simple_Queue::write (ACE_MEM_SAP_Node *new_node)
{
if (this->mq_ == 0)
return -1;
+
// Here, we assume we already have acquired the lock necessary.
// And we are allowed to write.
if (this->mq_->tail_.addr () == 0) // nothing in the queue.
@@ -100,12 +121,15 @@ ACE_MT_MEM_IO::Simple_Queue::write (ACE_MEM_SAP_Node *new_node)
}
return 0;
}
+
ACE_MEM_SAP_Node *
ACE_MT_MEM_IO::Simple_Queue::read ()
{
if (this->mq_ == 0)
return 0;
+
ACE_MEM_SAP_Node *retv = 0;
+
ACE_SEH_TRY
{
retv = this->mq_->head_;
@@ -123,8 +147,10 @@ ACE_MT_MEM_IO::Simple_Queue::read ()
ACE_SEH_EXCEPT (this->malloc_->memory_pool ().seh_selector (GetExceptionInformation ()))
{
}
+
return retv;
}
+
ACE_MT_MEM_IO::~ACE_MT_MEM_IO ()
{
delete this->recv_channel_.sema_;
@@ -132,6 +158,7 @@ ACE_MT_MEM_IO::~ACE_MT_MEM_IO ()
delete this->send_channel_.sema_;
delete this->send_channel_.lock_;
}
+
int
ACE_MT_MEM_IO::init (ACE_HANDLE handle,
const ACE_TCHAR *name,
@@ -139,17 +166,20 @@ ACE_MT_MEM_IO::init (ACE_HANDLE handle,
{
ACE_TRACE ("ACE_MT_MEM_IO::init");
ACE_UNUSED_ARG (handle);
+
// @@ Give me a rule on naming and how the queue should
// be kept in the shared memory and we are done
// with this.
if (this->create_shm_malloc (name, options) == -1)
return -1;
+
ACE_TCHAR server_sema [MAXPATHLEN];
ACE_TCHAR client_sema [MAXPATHLEN];
ACE_TCHAR server_lock [MAXPATHLEN];
ACE_TCHAR client_lock [MAXPATHLEN];
const ACE_TCHAR *basename = ACE::basename (name);
// size_t baselen = ACE_OS::strlen (basename);
+
// Building names. @@ Check buffer overflow?
ACE_OS::strcpy (server_sema, basename);
ACE_OS::strcat (server_sema, ACE_TEXT ("_sema_to_server"));
@@ -159,6 +189,7 @@ ACE_MT_MEM_IO::init (ACE_HANDLE handle,
ACE_OS::strcat (server_lock, ACE_TEXT ("_lock_to_server"));
ACE_OS::strcpy (client_lock, basename);
ACE_OS::strcat (client_lock, ACE_TEXT ("_lock_to_client"));
+
void *to_server_ptr = 0;
// @@ Here, we assume the shared memory fill will never be resued.
// So we can determine whether we are server or client by examining
@@ -171,6 +202,7 @@ ACE_MT_MEM_IO::init (ACE_HANDLE handle,
ACE_ALLOCATOR_RETURN (ptr,
this->shm_malloc_->malloc (2 * sizeof (MQ_Struct)),
-1);
+
MQ_Struct *mymq = reinterpret_cast<MQ_Struct *> (ptr);
mymq->tail_ = 0;
mymq->head_ = 0;
@@ -178,8 +210,10 @@ ACE_MT_MEM_IO::init (ACE_HANDLE handle,
(mymq + 1)->head_ = 0;
if (this->shm_malloc_->bind ("to_server", mymq) == -1)
return -1;
+
if (this->shm_malloc_->bind ("to_client", mymq + 1) == -1)
return -1;
+
this->recv_channel_.queue_.init (mymq, this->shm_malloc_);
ACE_NEW_RETURN (this->recv_channel_.sema_,
ACE_SYNCH_PROCESS_SEMAPHORE (0, server_sema),
@@ -187,6 +221,7 @@ ACE_MT_MEM_IO::init (ACE_HANDLE handle,
ACE_NEW_RETURN (this->recv_channel_.lock_,
ACE_SYNCH_PROCESS_MUTEX (server_lock),
-1);
+
this->send_channel_.queue_.init (mymq + 1, this->shm_malloc_);
ACE_NEW_RETURN (this->send_channel_.sema_,
ACE_SYNCH_PROCESS_SEMAPHORE (0, client_sema),
@@ -206,6 +241,7 @@ ACE_MT_MEM_IO::init (ACE_HANDLE handle,
ACE_NEW_RETURN (this->recv_channel_.lock_,
ACE_SYNCH_PROCESS_MUTEX (client_lock),
-1);
+
this->send_channel_.queue_.init (mymq, this->shm_malloc_);
ACE_NEW_RETURN (this->send_channel_.sema_,
ACE_SYNCH_PROCESS_SEMAPHORE (0, server_sema),
@@ -216,64 +252,80 @@ ACE_MT_MEM_IO::init (ACE_HANDLE handle,
}
return 0;
}
+
ssize_t
ACE_MT_MEM_IO::recv_buf (ACE_MEM_SAP_Node *&buf,
int flags,
const ACE_Time_Value *timeout)
{
ACE_TRACE ("ACE_MT_MEM_IO::recv_buf");
+
// @@ Don't know how to handle timeout yet.
ACE_UNUSED_ARG (timeout);
ACE_UNUSED_ARG (flags);
+
if (this->shm_malloc_ == 0)
{
return -1;
}
+
// Need to handle timeout here.
if (this->recv_channel_.sema_->acquire () == -1)
{
return -1;
}
+
{
// @@ We can probably skip the lock in certain circumstance.
ACE_GUARD_RETURN (ACE_SYNCH_PROCESS_MUTEX, ace_mon, *this->recv_channel_.lock_, -1);
+
buf = this->recv_channel_.queue_.read ();
+
if (buf != 0)
{
return ACE_Utils::truncate_cast<ssize_t> (buf->size ());
}
+
return -1;
}
}
+
ssize_t
ACE_MT_MEM_IO::send_buf (ACE_MEM_SAP_Node *buf,
int flags,
const ACE_Time_Value *timeout)
{
ACE_TRACE ("ACE_MT_MEM_IO::send_buf");
+
// @@ Don't know how to handle timeout yet.
ACE_UNUSED_ARG (timeout);
ACE_UNUSED_ARG (flags);
+
if (this->shm_malloc_ == 0)
{
return -1;
}
+
{
// @@ We can probably skip the lock in certain curcumstances.
ACE_GUARD_RETURN (ACE_SYNCH_PROCESS_MUTEX, ace_mon, *this->send_channel_.lock_, -1);
+
if (this->send_channel_.queue_.write (buf) == -1)
{
this->release_buffer (buf);
return -1;
}
}
+
if (this->send_channel_.sema_->release () == -1)
{
return -1;
}
+
return ACE_Utils::truncate_cast<ssize_t> (buf->size ());
}
#endif /* ACE_WIN32 || !_ACE_USE_SV_SEM */
+
void
ACE_MEM_IO::dump (void) const
{
@@ -281,12 +333,14 @@ ACE_MEM_IO::dump (void) const
ACE_TRACE ("ACE_MEM_IO::dump");
#endif /* ACE_HAS_DUMP */
}
+
int
ACE_MEM_IO::init (const ACE_TCHAR *name,
ACE_MEM_IO::Signal_Strategy type,
ACE_MEM_SAP::MALLOC_OPTIONS *options)
{
ACE_UNUSED_ARG (type);
+
delete this->deliver_strategy_;
this->deliver_strategy_ = 0;
switch (type)
@@ -306,10 +360,12 @@ ACE_MEM_IO::init (const ACE_TCHAR *name,
default:
return -1;
}
+
return this->deliver_strategy_->init (this->get_handle (),
name,
options);
}
+
int
ACE_MEM_IO::fini (void)
{
@@ -322,33 +378,41 @@ ACE_MEM_IO::fini (void)
return -1;
}
}
+
// Allows a client to read from a socket without having to provide
// a buffer to read. This method determines how much data is in the
// socket, allocates a buffer of this size, reads in the data, and
// returns the number of bytes read.
+
ssize_t
ACE_MEM_IO::send (const ACE_Message_Block *message_block,
const ACE_Time_Value *timeout)
{
ACE_TRACE ("ACE_MEM_IO::send");
+
if (this->deliver_strategy_ == 0)
{
return -1; // Something went seriously wrong.
}
+
size_t len = message_block->total_length ();
+
if (len != 0)
{
ACE_MEM_SAP_Node *buf =
reinterpret_cast<ACE_MEM_SAP_Node *> (
this->deliver_strategy_->acquire_buffer (
ACE_Utils::truncate_cast<ssize_t> (len)));
+
size_t n = 0;
+
while (message_block != 0)
{
ACE_OS::memcpy (static_cast<char *> (buf->data ()) + n,
message_block->rd_ptr (),
message_block->length ());
n += message_block->length ();
+
if (message_block->cont ())
{
message_block = message_block->cont ();
@@ -358,14 +422,18 @@ ACE_MEM_IO::send (const ACE_Message_Block *message_block,
message_block = message_block->next ();
}
}
+
buf->size_ = len;
+
return this->deliver_strategy_->send_buf (buf,
0,
timeout);
}
+
return 0;
}
+
#if 0
ssize_t
ACE_MEM_IO::recvv (iovec *io_vec,
@@ -376,7 +444,9 @@ ACE_MEM_IO::recvv (iovec *io_vec,
ACE_Handle_Set handle_set;
handle_set.reset ();
handle_set.set_bit (this->get_handle ());
+
io_vec->iov_base = 0;
+
// Check the status of the current socket.
switch (ACE_OS::select (int (this->get_handle ()) + 1,
handle_set,
@@ -394,7 +464,9 @@ ACE_MEM_IO::recvv (iovec *io_vec,
// Goes fine, fallthrough to get data
break;
}
+
int inlen;
+
if (ACE_OS::ioctl (this->get_handle (),
FIONREAD,
&inlen) == -1)
@@ -416,14 +488,17 @@ ACE_MEM_IO::recvv (iovec *io_vec,
ACE_NOTSUP_RETURN (-1);
#endif /* FIONREAD */
}
+
// Send N char *ptrs and int lengths. Note that the char *'s precede
// the ints (basically, an varargs version of writev). The count N is
// the *total* number of trailing arguments, *not* a couple of the
// number of tuple pairs!
+
ssize_t
ACE_MEM_IO::send (size_t n, ...) const
{
ACE_TRACE ("ACE_MEM_IO::send");
+
va_list argp;
size_t total_tuples = n / 2;
iovec *iovp;
@@ -434,12 +509,15 @@ ACE_MEM_IO::send (size_t n, ...) const
iovec[total_tuples],
-1);
#endif /* !defined (ACE_HAS_ALLOCA) */
+
va_start (argp, n);
+
for (size_t i = 0; i < total_tuples; i++)
{
iovp[i].iov_base = va_arg (argp, char *);
iovp[i].iov_len = va_arg (argp, ssize_t);
}
+
ssize_t result = ACE_OS::sendv (this->get_handle (),
iovp,
total_tuples);
@@ -449,15 +527,18 @@ ACE_MEM_IO::send (size_t n, ...) const
va_end (argp);
return result;
}
+
// This is basically an interface to ACE_OS::readv, that doesn't use
// the struct iovec_Base explicitly. The ... can be passed as an arbitrary
// number of (char *ptr, int len) tuples. However, the count N is the
// *total* number of trailing arguments, *not* a couple of the number
// of tuple pairs!
+
ssize_t
ACE_MEM_IO::recv (size_t n, ...) const
{
ACE_TRACE ("ACE_MEM_IO::recv");
+
va_list argp;
size_t total_tuples = n / 2;
iovec *iovp;
@@ -468,12 +549,15 @@ ACE_MEM_IO::recv (size_t n, ...) const
iovec[total_tuples],
-1);
#endif /* !defined (ACE_HAS_ALLOCA) */
+
va_start (argp, n);
+
for (size_t i = 0; i < total_tuples; i++)
{
iovp[i].iov_base = va_arg (argp, char *);
iovp[i].iov_len = va_arg (argp, ssize_t);
}
+
ssize_t result = ACE_OS::recvv (this->get_handle (),
iovp,
total_tuples);
@@ -484,6 +568,8 @@ ACE_MEM_IO::recv (size_t n, ...) const
return result;
}
#endif /* 0 */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */
diff --git a/dep/ACE_wrappers/ace/MEM_IO.h b/dep/ACE_wrappers/ace/MEM_IO.h
index 69871a6ab67..bbea3b3936d 100644
--- a/dep/ACE_wrappers/ace/MEM_IO.h
+++ b/dep/ACE_wrappers/ace/MEM_IO.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file MEM_IO.h
@@ -9,26 +10,35 @@
*/
//=============================================================================
+
#ifndef ACE_MEM_IO_H
#define ACE_MEM_IO_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1)
+
#include "ace/SOCK.h"
#include "ace/MEM_SAP.h"
#include "ace/Message_Block.h"
#include "ace/Process_Semaphore.h"
#include "ace/Process_Mutex.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Export ACE_Reactive_MEM_IO : public ACE_MEM_SAP
{
public:
ACE_Reactive_MEM_IO (void);
+
virtual ~ACE_Reactive_MEM_IO (void);
+
/**
* Initialize the MEM_SAP object.
*
@@ -38,6 +48,7 @@ public:
virtual int init (ACE_HANDLE handle,
const ACE_TCHAR *name,
MALLOC_OPTIONS *options);
+
/**
* Fetch location of next available data into <recv_buffer_>.
* As this operation read the address of the data off the socket
@@ -46,6 +57,7 @@ public:
virtual ssize_t recv_buf (ACE_MEM_SAP_Node *&buf,
int flags,
const ACE_Time_Value *timeout);
+
/**
* Wait to to @a timeout amount of time to send @a buf. If <send>
* times out a -1 is returned with @c errno == ETIME. If it succeeds
@@ -53,6 +65,7 @@ public:
virtual ssize_t send_buf (ACE_MEM_SAP_Node *buf,
int flags,
const ACE_Time_Value *timeout);
+
/**
* Convert the buffer offset <off> to absolute address to @a buf.
* Return the size of valid information containing in the @a buf,
@@ -60,6 +73,7 @@ public:
*/
ssize_t get_buf_len (const ACE_OFF_T off, ACE_MEM_SAP_Node *&buf);
};
+
#if defined (ACE_WIN32) || !defined (_ACE_USE_SV_SEM)
class ACE_Export ACE_MT_MEM_IO : public ACE_MEM_SAP
{
@@ -69,32 +83,41 @@ public:
ACE_MEM_SAP_Node::ACE_MEM_SAP_NODE_PTR head_;
ACE_MEM_SAP_Node::ACE_MEM_SAP_NODE_PTR tail_;
} MQ_Struct; // Structure for a simple queue
+
class Simple_Queue
{
public:
Simple_Queue (void);
Simple_Queue (MQ_Struct *mq);
+
int init (MQ_Struct *mq, ACE_MEM_SAP::MALLOC_TYPE *malloc);
+
int write (ACE_MEM_SAP_Node *new_msg);
+
ACE_MEM_SAP_Node *read (void);
private:
MQ_Struct *mq_;
ACE_MEM_SAP::MALLOC_TYPE *malloc_;
};
+
typedef struct
{
ACE_SYNCH_PROCESS_SEMAPHORE *sema_;
ACE_SYNCH_PROCESS_MUTEX *lock_;
Simple_Queue queue_;
} Channel;
+
ACE_MT_MEM_IO (void);
+
virtual ~ACE_MT_MEM_IO (void);
+
/**
* Initialize the MEM_SAP object.
*/
virtual int init (ACE_HANDLE handle,
const ACE_TCHAR *name,
MALLOC_OPTIONS *options);
+
/**
* Fetch location of next available data into <recv_buffer_>.
* As this operation read the address of the data off the socket
@@ -103,6 +126,7 @@ public:
virtual ssize_t recv_buf (ACE_MEM_SAP_Node *&buf,
int flags,
const ACE_Time_Value *timeout);
+
/**
* Wait to to @a timeout amount of time to send @a buf. If <send>
* times out a -1 is returned with @c errno == ETIME. If it succeeds
@@ -110,11 +134,13 @@ public:
virtual ssize_t send_buf (ACE_MEM_SAP_Node *buf,
int flags,
const ACE_Time_Value *timeout);
+
private:
Channel recv_channel_;
Channel send_channel_;
};
#endif /* ACE_WIN32 || !_ACE_USE_SV_SEM */
+
/**
* @class ACE_MEM_IO
*
@@ -147,40 +173,49 @@ public:
// = Initialization and termination methods.
/// Constructor.
ACE_MEM_IO (void);
+
/// Destructor.
~ACE_MEM_IO (void);
+
typedef enum
{
Reactive,
MT
} Signal_Strategy;
+
/**
* Initialize the MEM_SAP object.
*/
int init (const ACE_TCHAR *name,
ACE_MEM_IO::Signal_Strategy type = ACE_MEM_IO::Reactive,
ACE_MEM_SAP::MALLOC_OPTIONS *options = 0);
+
/**
* Finalizing the MEM_IO object. This method doesn't invoke
* the <remove> method.
*/
int fini (void);
+
/// Send an @a n byte buffer to the other process using shm_malloc_
/// connected thru the socket.
ssize_t send (const void *buf,
size_t n,
int flags) ;
+
/// Recv an @a n byte buffer from the shm_malloc_ thru connected socket.
ssize_t recv (void *buf,
size_t n,
int flags) ;
+
/// Send an @a n byte buffer to the other process using shm_malloc_
/// connected thru the socket.
ssize_t send (const void *buf,
size_t n) ;
+
/// Recv an @a n byte buffer from the shm_malloc_ thru connected socket.
ssize_t recv (void *buf,
size_t n) ;
+
/**
* Wait to to @a timeout amount of time to send up to @a n bytes into
* @a buf from <handle> (uses the <send> call). If <send> times out
@@ -190,6 +225,7 @@ public:
ssize_t send (const void *buf,
size_t n,
const ACE_Time_Value *timeout);
+
/**
* Wait to to @a timeout amount of time to send up to @a n bytes into
* @a buf from <handle> (uses the <send> call). If <send> times out
@@ -200,6 +236,7 @@ public:
size_t n,
int flags,
const ACE_Time_Value *timeout);
+
/**
* Wait to to @a timeout amount of time to send the @a message_block.
* If <send> times out a -1 is returned with @c errno == ETIME. If
@@ -207,6 +244,7 @@ public:
*/
ssize_t send (const ACE_Message_Block *message_block,
const ACE_Time_Value *timeout);
+
/**
* Wait up to @a timeout amount of time to receive up to @a n bytes
* into @a buf from <handle> (uses the <recv> call). If <recv> times
@@ -216,6 +254,7 @@ public:
ssize_t recv (void *buf,
size_t n,
const ACE_Time_Value *timeout);
+
/**
* Wait up to @a timeout amount of time to receive up to @a n bytes
* into @a buf from <handle> (uses the <recv> call). If <recv> times
@@ -227,33 +266,46 @@ public:
int flags,
const ACE_Time_Value *timeout);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
/// Return the local endpoint port number. Returns 0 if successful,
/// else -1.
/* int get_local_port (u_short &) const;
+
/// Return the port number of the remotely connected peer (if there
/// is one). Returns 0 if successful, else -1.
int get_remote_port (u_short &) const;
*/
+
private:
ssize_t fetch_recv_buf (int flag, const ACE_Time_Value *timeout);
+
/// Actual deliverying mechanism.
ACE_MEM_SAP *deliver_strategy_;
+
/// Internal pointer for support recv/send.
ACE_MEM_SAP_Node *recv_buffer_;
+
/// Record the current total buffer size of <recv_buffer_>.
ssize_t buf_size_;
+
/// Record the current read pointer location in <recv_buffer_>.
ssize_t cur_offset_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/MEM_IO.inl"
#endif /* __ACE_INLINE__ */
+
#endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */
+
#include /**/ "ace/post.h"
#endif /* ACE_SOCK_IO_H */
diff --git a/dep/ACE_wrappers/ace/MEM_IO.inl b/dep/ACE_wrappers/ace/MEM_IO.inl
index 07eee7e963d..e3ec07fc5ce 100644
--- a/dep/ACE_wrappers/ace/MEM_IO.inl
+++ b/dep/ACE_wrappers/ace/MEM_IO.inl
@@ -1,13 +1,17 @@
// -*- C++ -*-
//
// $Id: MEM_IO.inl 82559 2008-08-07 20:23:07Z parsons $
+
#include "ace/OS_NS_string.h"
#include "ace/Truncate.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_Reactive_MEM_IO::ACE_Reactive_MEM_IO ()
{
}
+
#if defined (ACE_WIN32) || !defined (_ACE_USE_SV_SEM)
ACE_INLINE
ACE_MT_MEM_IO::Simple_Queue::Simple_Queue (void)
@@ -15,6 +19,7 @@ ACE_MT_MEM_IO::Simple_Queue::Simple_Queue (void)
malloc_ (0)
{
}
+
ACE_INLINE
ACE_MT_MEM_IO::ACE_MT_MEM_IO ()
{
@@ -23,34 +28,41 @@ ACE_MT_MEM_IO::ACE_MT_MEM_IO ()
this->send_channel_.sema_ = 0;
this->send_channel_.lock_ = 0;
}
+
ACE_INLINE
ACE_MT_MEM_IO::Simple_Queue::Simple_Queue (MQ_Struct *mq)
: mq_ (mq),
malloc_ (0)
{
}
+
ACE_INLINE int
ACE_MT_MEM_IO::Simple_Queue::init (MQ_Struct *mq,
ACE_MEM_SAP::MALLOC_TYPE *malloc)
{
if (this->mq_ != 0)
return -1;
+
this->mq_ = mq;
this->malloc_ = malloc;
return 0;
}
#endif /* ACE_WIN32 || !_ACE_USE_SV_SEM */
+
ACE_INLINE ssize_t
ACE_Reactive_MEM_IO::get_buf_len (const ACE_OFF_T off, ACE_MEM_SAP_Node *&buf)
{
#if !defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS)
ACE_TRACE ("ACE_Reactive_MEM_IO::get_buf_len");
#endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */
+
if (this->shm_malloc_ == 0)
{
return -1;
}
+
ssize_t retv = 0;
+
ACE_SEH_TRY
{
buf =
@@ -61,8 +73,10 @@ ACE_Reactive_MEM_IO::get_buf_len (const ACE_OFF_T off, ACE_MEM_SAP_Node *&buf)
ACE_SEH_EXCEPT (this->shm_malloc_->memory_pool ().seh_selector (GetExceptionInformation ()))
{
}
+
return retv;
}
+
// Send an n byte message to the connected socket.
ACE_INLINE
ACE_MEM_IO::ACE_MEM_IO (void)
@@ -73,32 +87,41 @@ ACE_MEM_IO::ACE_MEM_IO (void)
{
// ACE_TRACE ("ACE_MEM_IO::ACE_MEM_IO");
}
+
ACE_INLINE ssize_t
ACE_MEM_IO::fetch_recv_buf (int flag, const ACE_Time_Value *timeout)
{
ACE_TRACE ("ACE_MEM_IO::fetch_recv_buf");
+
if (this->deliver_strategy_ == 0)
return -1;
+
// This method can only be called when <buf_size_> == <cur_offset_>.
ACE_ASSERT (this->buf_size_ == this->cur_offset_);
+
// We have done using the previous buffer, return it to malloc.
if (this->recv_buffer_ != 0)
this->deliver_strategy_->release_buffer (this->recv_buffer_);
+
this->cur_offset_ = 0;
ssize_t retv = 0;
+
if ((retv = this->deliver_strategy_->recv_buf (this->recv_buffer_,
flag,
timeout)) > 0)
this->buf_size_ = retv;
else
this->buf_size_ = 0;
+
return retv;
}
+
ACE_INLINE
ACE_MEM_IO::~ACE_MEM_IO (void)
{
delete this->deliver_strategy_;
}
+
ACE_INLINE ssize_t
ACE_MEM_IO::send (const void *buf,
size_t len,
@@ -106,24 +129,32 @@ ACE_MEM_IO::send (const void *buf,
const ACE_Time_Value *timeout)
{
ACE_TRACE ("ACE_MEM_IO::send");
+
if (this->deliver_strategy_ == 0)
{
return 0;
}
+
ACE_MEM_SAP_Node *sbuf =
this->deliver_strategy_->acquire_buffer (
ACE_Utils::truncate_cast<ssize_t> (len));
+
if (sbuf == 0)
{
return -1; // Memory buffer not initialized.
}
+
ACE_OS::memcpy (sbuf->data (), buf, len);
+
///
+
sbuf->size_ = len;
+
return this->deliver_strategy_->send_buf (sbuf,
flags,
timeout);
}
+
ACE_INLINE ssize_t
ACE_MEM_IO::recv (void *buf,
size_t len,
@@ -131,53 +162,70 @@ ACE_MEM_IO::recv (void *buf,
const ACE_Time_Value *timeout)
{
ACE_TRACE ("ACE_MEM_IO::recv");
+
size_t count = 0;
+
size_t buf_len = this->buf_size_ - this->cur_offset_;
+
if (buf_len == 0)
{
ssize_t blen = // Buffer length
this->fetch_recv_buf (flags, timeout);
+
if (blen <= 0)
{
return blen;
}
+
buf_len = this->buf_size_;
}
+
size_t length = (len > buf_len ? buf_len : len);
+
ACE_OS::memcpy ((char *) buf + count,
(char *) this->recv_buffer_->data () + this->cur_offset_,
length);
this->cur_offset_ += ACE_Utils::truncate_cast<ssize_t> (length);
count += length;
+
return ACE_Utils::truncate_cast<ssize_t> (count);
}
+
ACE_INLINE ssize_t
ACE_MEM_IO::send (const void *buf, size_t n, int flags)
{
ACE_TRACE ("ACE_MEM_IO::send");
return this->send (buf, n, flags, 0);
}
+
// Recv an n byte message from the connected socket.
+
ACE_INLINE ssize_t
ACE_MEM_IO::recv (void *buf, size_t n, int flags)
{
ACE_TRACE ("ACE_MEM_IO::recv");
return this->recv (buf, n, flags, 0);
}
+
// Send an n byte message to the connected socket.
+
ACE_INLINE ssize_t
ACE_MEM_IO::send (const void *buf, size_t n)
{
ACE_TRACE ("ACE_MEM_IO::send");
return this->send (buf, n, 0);
}
+
// Recv an n byte message from the connected socket.
+
ACE_INLINE ssize_t
ACE_MEM_IO::recv (void *buf, size_t n)
{
ACE_TRACE ("ACE_MEM_IO::recv");
+
return this->recv (buf, n, 0);
}
+
ACE_INLINE ssize_t
ACE_MEM_IO::recv (void *buf,
size_t len,
@@ -186,6 +234,7 @@ ACE_MEM_IO::recv (void *buf,
ACE_TRACE ("ACE_MEM_IO::recv");
return this->recv (buf, len, 0, timeout);
}
+
ACE_INLINE ssize_t
ACE_MEM_IO::send (const void *buf,
size_t len,
@@ -194,4 +243,5 @@ ACE_MEM_IO::send (const void *buf,
ACE_TRACE ("ACE_MEM_IO::send");
return this->send (buf, len, 0, timeout);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/MEM_SAP.cpp b/dep/ACE_wrappers/ace/MEM_SAP.cpp
index 6210ee653a9..3710802c206 100644
--- a/dep/ACE_wrappers/ace/MEM_SAP.cpp
+++ b/dep/ACE_wrappers/ace/MEM_SAP.cpp
@@ -1,17 +1,25 @@
// $Id: MEM_SAP.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/MEM_SAP.h"
+
#if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1)
+
#if !defined (__ACE_INLINE__)
#include "ace/MEM_SAP.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace, MEM_SAP, "$Id: MEM_SAP.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_IPC_SAP)
+
void
ACE_MEM_SAP::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_MEM_SAP::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
if (this->shm_malloc_ != 0)
this->shm_malloc_->dump ();
@@ -20,35 +28,43 @@ ACE_MEM_SAP::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
ACE_MEM_SAP::ACE_MEM_SAP (void)
: handle_ (ACE_INVALID_HANDLE),
shm_malloc_ (0)
{
// ACE_TRACE ("ACE_MEM_SAP::ACE_MEM_SAP");
}
+
ACE_MEM_SAP::~ACE_MEM_SAP (void)
{
// ACE_TRACE ("ACE_MEM_SAP::~ACE_MEM_SAP");
delete this->shm_malloc_;
}
+
int
ACE_MEM_SAP::fini ()
{
ACE_TRACE ("ACE_MEM_SAP::fini");
+
return this->close_shm_malloc ();
}
+
int
ACE_MEM_SAP::create_shm_malloc (const ACE_TCHAR *name,
MALLOC_OPTIONS *options)
{
ACE_TRACE ("ACE_MEM_SAP::create_shm_malloc");
+
if (this->shm_malloc_ != 0)
return -1; // already initialized.
+
ACE_NEW_RETURN (this->shm_malloc_,
MALLOC_TYPE (name,
0,
options),
-1);
+
if (this->shm_malloc_->bad () != 0)
{
this->shm_malloc_->remove (); // Cleanup OS resources
@@ -56,19 +72,27 @@ ACE_MEM_SAP::create_shm_malloc (const ACE_TCHAR *name,
this->shm_malloc_ = 0;
return -1;
}
+
return 0;
}
+
int
ACE_MEM_SAP::close_shm_malloc (void)
{
ACE_TRACE ("ACE_MEM_SAP::close_shm_malloc");
+
int retv = -1;
+
if (this->shm_malloc_ != 0)
this->shm_malloc_->release (1);
+
delete this->shm_malloc_;
this->shm_malloc_ = 0;
+
return retv;
}
+
#endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/MEM_SAP.h b/dep/ACE_wrappers/ace/MEM_SAP.h
index 6f3ba322f13..e50b14b0853 100644
--- a/dep/ACE_wrappers/ace/MEM_SAP.h
+++ b/dep/ACE_wrappers/ace/MEM_SAP.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file MEM_SAP.h
@@ -8,24 +9,33 @@
* @author Nanbor Wang <nanbor@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_MEM_SAP_H
#define ACE_MEM_SAP_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
// MEM_SAP requries position independent pointers to work
#if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1)
+
#include "ace/PI_Malloc.h"
#include "ace/Malloc_T.h"
#include "ace/MMAP_Memory_Pool.h"
#include "ace/Process_Mutex.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_MEM_SAP;
class ACE_Reactive_MEM_IO;
class ACE_MT_MEM_IO;
class ACE_MEM_IO;
+
// Internal data structure
// MEM_SAP uses to queue up
// data.
@@ -36,21 +46,30 @@ public:
// friend class ACE_Reactive_MEM_IO;
// friend class ACE_MT_MEM_IO;
// friend class ACE_MEM_IO;
+
typedef ACE_Based_Pointer<ACE_MEM_SAP_Node> ACE_MEM_SAP_NODE_PTR;
+
/// Initialize the node with its capacity.
ACE_MEM_SAP_Node (size_t cap);
+
/// Get the size of the data we hold.
size_t size (void) const;
+
/// Get the capacity of this block of data.
size_t capacity (void) const;
+
/// Get the pointer to the block of data we hold.
void *data (void);
+
/// The maximum size of this memory block.
size_t capacity_;
+
/// The actualy size used.
size_t size_;
+
ACE_MEM_SAP_NODE_PTR next_;
};
+
/**
* @class ACE_MEM_SAP
*
@@ -61,21 +80,26 @@ class ACE_Export ACE_MEM_SAP
{
public:
// = Initialization and termination methods.
+
typedef ACE_Malloc_T<ACE_MMAP_MEMORY_POOL, ACE_Process_Mutex, ACE_PI_Control_Block> MALLOC_TYPE;
typedef ACE_MMAP_Memory_Pool_Options MALLOC_OPTIONS;
+
/// Destructor.
virtual ~ACE_MEM_SAP (void);
+
/**
* Initialize the MEM_SAP object.
*/
virtual int init (ACE_HANDLE handle,
const ACE_TCHAR *name,
MALLOC_OPTIONS *options) = 0;
+
/**
* Finalizing the MEM_SAP object. This method doesn't invoke
* the <remove> method.
*/
virtual int fini ();
+
/**
* Fetch location of next available data into <recv_buffer_>.
* As this operation read the address of the data off the socket
@@ -84,6 +108,7 @@ public:
virtual ssize_t recv_buf (ACE_MEM_SAP_Node *&buf,
int flags,
const ACE_Time_Value *timeout) = 0;
+
/**
* Wait to to @a timeout amount of time to send @a buf. If <send>
* times out a -1 is returned with @c errno == ETIME. If it succeeds
@@ -91,18 +116,24 @@ public:
virtual ssize_t send_buf (ACE_MEM_SAP_Node *buf,
int flags,
const ACE_Time_Value *timeout) = 0;
+
/// request a buffer of size @a size. Return 0 if the <shm_malloc_> is
/// not initialized.
ACE_MEM_SAP_Node *acquire_buffer (const ssize_t size);
+
/// release a buffer pointed by @a buf. Return -1 if the <shm_malloc_>
/// is not initialized.
int release_buffer (ACE_MEM_SAP_Node *buf);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
// = Class initializing methods to create/connect to a shared memory pool.
+
/**
* Create a new shm_malloc object. Return 0 if succeed and -1
* otherwise. This method should only be called from an acceptor
@@ -111,20 +142,29 @@ protected:
*/
int create_shm_malloc (const ACE_TCHAR *name,
MALLOC_OPTIONS *options);
+
/// Close down the share memory pool. Clean up the
/// mmap file if we are the last one using it.
int close_shm_malloc (void);
+
ACE_HANDLE handle_;
+
/// Data exchange channel.
MALLOC_TYPE *shm_malloc_;
+
/// Constructor. Prevent this class from being instantiated.
ACE_MEM_SAP (void);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/MEM_SAP.inl"
#endif /* __ACE_INLINE__ */
+
#endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_SOCK_IO_H */
diff --git a/dep/ACE_wrappers/ace/MEM_SAP.inl b/dep/ACE_wrappers/ace/MEM_SAP.inl
index 6ad47b88475..a006fdc1179 100644
--- a/dep/ACE_wrappers/ace/MEM_SAP.inl
+++ b/dep/ACE_wrappers/ace/MEM_SAP.inl
@@ -1,8 +1,11 @@
// -*- C++ -*-
//
// $Id: MEM_SAP.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/RW_Thread_Mutex.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_MEM_SAP_Node::ACE_MEM_SAP_Node (size_t cap)
: capacity_ (cap),
@@ -10,29 +13,35 @@ ACE_MEM_SAP_Node::ACE_MEM_SAP_Node (size_t cap)
next_ (0)
{
}
+
ACE_INLINE size_t
ACE_MEM_SAP_Node::size (void) const
{
return this->size_;
}
+
ACE_INLINE size_t
ACE_MEM_SAP_Node::capacity (void) const
{
return this->capacity_;
}
+
ACE_INLINE void *
ACE_MEM_SAP_Node::data (void)
{
return this + 1;
}
+
ACE_INLINE ACE_MEM_SAP_Node *
ACE_MEM_SAP::acquire_buffer (const ssize_t size)
{
ACE_TRACE ("ACE_MEM_SAP::acquire_buffer");
if (this->shm_malloc_ == 0)
return 0; // not initialized.
+
ACE_MEM_SAP_Node *buf = 0;
+
ACE_NEW_MALLOC_RETURN (buf,
static_cast<ACE_MEM_SAP_Node *>
(this->shm_malloc_->malloc (sizeof (ACE_MEM_SAP_Node) + size)),
@@ -40,13 +49,16 @@ ACE_MEM_SAP::acquire_buffer (const ssize_t size)
0);
return buf;
}
+
ACE_INLINE int
ACE_MEM_SAP::release_buffer (ACE_MEM_SAP_Node *buf)
{
ACE_TRACE ("ACE_MEM_SAP::release_buffer");
if (this->shm_malloc_ == 0)
return -1; // not initialized.
+
this->shm_malloc_->free (buf);
return 0;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/MEM_Stream.cpp b/dep/ACE_wrappers/ace/MEM_Stream.cpp
index 3a54872ea41..3ad616314ad 100644
--- a/dep/ACE_wrappers/ace/MEM_Stream.cpp
+++ b/dep/ACE_wrappers/ace/MEM_Stream.cpp
@@ -1,12 +1,19 @@
// $Id: MEM_Stream.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/MEM_Stream.h"
+
#if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1)
+
#if !defined (__ACE_INLINE__)
#include "ace/MEM_Stream.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace, MEM_Stream, "$Id: MEM_Stream.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_MEM_Stream)
+
void
ACE_MEM_Stream::dump (void) const
{
@@ -14,11 +21,14 @@ ACE_MEM_Stream::dump (void) const
ACE_TRACE ("ACE_MEM_Stream::dump");
#endif /* ACE_HAS_DUMP */
}
+
int
ACE_MEM_Stream::close (void)
{
this->send ((char *)0, 0);
+
this->fini ();
+
#if defined (ACE_WIN32)
// We need the following call to make things work correctly on
// Win32, which requires use to do a <close_writer> before doing the
@@ -31,6 +41,8 @@ ACE_MEM_Stream::close (void)
// Close down the socket.
return ACE_SOCK::close ();
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */
diff --git a/dep/ACE_wrappers/ace/MEM_Stream.h b/dep/ACE_wrappers/ace/MEM_Stream.h
index 0c9b9007009..7148e9f15ad 100644
--- a/dep/ACE_wrappers/ace/MEM_Stream.h
+++ b/dep/ACE_wrappers/ace/MEM_Stream.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file MEM_Stream.h
@@ -9,21 +10,30 @@
*/
//=============================================================================
+
#ifndef ACE_MEM_STREAM_H
#define ACE_MEM_STREAM_H
#include /**/ "ace/pre.h"
+
#include "ace/MEM_IO.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1)
+
#include "ace/INET_Addr.h"
+
#if !defined (ACE_MEM_STREAM_MIN_BUFFER)
# define ACE_MEM_STREAM_MIN_BUFFER 4096
#endif /* ACE_MEM_STREAM_MIN_BUFFER */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_MEM_Acceptor;
class ACE_MEM_Connector;
+
/**
* @class ACE_MEM_Stream
*
@@ -43,25 +53,32 @@ class ACE_MEM_Connector;
class ACE_Export ACE_MEM_Stream : public ACE_MEM_IO
{
public:
+
friend class ACE_MEM_Acceptor;
friend class ACE_MEM_Connector;
+
// Initialization and termination methods.
/// Constructor.
ACE_MEM_Stream (void);
+
/// Constructor (sets the underlying ACE_HANDLE with <h>).
ACE_MEM_Stream (ACE_HANDLE h);
+
/// Destructor.
~ACE_MEM_Stream (void);
+
//= The following two methods use write and read system calls.
/// Send n bytes, keep trying until n are sent.
/// Recv n bytes, keep trying until n are received.
ssize_t send_n (const void *buf, size_t n);
ssize_t recv_n (void *buf, size_t n);
+
// = The following two methods use the send and recv system calls.
/// Send n bytes, keep trying until n are sent.
/// Recv n bytes, keep trying until n are received.
ssize_t send_n (const void *buf, size_t n, int flags);
ssize_t recv_n (void *buf, size_t n, int flags);
+
#if 0
/**
* Try to send exactly @a len bytes into @a buf from <handle> (uses
@@ -74,6 +91,7 @@ public:
size_t len,
int flags,
const ACE_Time_Value *timeout);
+
/**
* Try to recv exactly @a len bytes into @a buf from <handle> (uses
* the <ACE::recv_n> call). The ACE_Time_Value indicates how long
@@ -89,6 +107,7 @@ public:
size_t len,
int flags,
const ACE_Time_Value *timeout);
+
/**
* Send an <iovec> of size @a n to the connected socket (uses
* <ACE::sendv_n>). Will block until all bytes are sent or an error
@@ -96,33 +115,45 @@ public:
*/
ssize_t sendv_n (const iovec iov[],
size_t n) const;
+
/// Receive an <iovec> of size @a n to the connected socket.
ssize_t recvv_n (iovec iov[],
size_t n) const;
#endif /* 0 */
+
// = Selectively close endpoints.
+
/// Close down the reader.
int close_reader (void);
+
/// Close down the writer.
int close_writer (void);
+
/**
* Close down the socket (we need this to make things work correctly
* on Win32, which requires use to do a <close_writer> before doing
* the close to avoid losing data).
*/
int close (void);
+
// = Meta-type info
typedef ACE_Addr PEER_ADDR;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/MEM_Stream.inl"
#endif /* __ACE_INLINE__ */
+
#endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */
+
#include /**/ "ace/post.h"
#endif /* ACE_MEM_STREAM_H */
diff --git a/dep/ACE_wrappers/ace/MEM_Stream.inl b/dep/ACE_wrappers/ace/MEM_Stream.inl
index 79cead7e0e0..e995db5c5f9 100644
--- a/dep/ACE_wrappers/ace/MEM_Stream.inl
+++ b/dep/ACE_wrappers/ace/MEM_Stream.inl
@@ -1,25 +1,31 @@
// -*- C++ -*-
//
// $Id: MEM_Stream.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/MEM_Stream.h"
#include "ace/OS_NS_sys_socket.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_MEM_Stream::ACE_MEM_Stream (void)
{
// ACE_TRACE ("ACE_MEM_Stream::ACE_MEM_Stream");
}
+
ACE_INLINE
ACE_MEM_Stream::ACE_MEM_Stream (ACE_HANDLE h)
{
// ACE_TRACE ("ACE_MEM_Stream::ACE_MEM_Stream");
this->set_handle (h);
}
+
ACE_INLINE
ACE_MEM_Stream::~ACE_MEM_Stream (void)
{
// ACE_TRACE ("ACE_MEM_Stream::~ACE_MEM_Stream");
}
+
ACE_INLINE int
ACE_MEM_Stream::close_reader (void)
{
@@ -29,7 +35,9 @@ ACE_MEM_Stream::close_reader (void)
else
return 0;
}
+
// Shut down just the writing end of a ACE_SOCK.
+
ACE_INLINE int
ACE_MEM_Stream::close_writer (void)
{
@@ -39,27 +47,32 @@ ACE_MEM_Stream::close_writer (void)
else
return 0;
}
+
ACE_INLINE ssize_t
ACE_MEM_Stream::send_n (const void *buf, size_t n)
{
return this->send (buf, n);
}
+
ACE_INLINE ssize_t
ACE_MEM_Stream::recv_n (void *buf, size_t n)
{
return this->recv (buf, n);
}
+
ACE_INLINE ssize_t
ACE_MEM_Stream::send_n (const void *buf, size_t n, int flags)
{
return this->send (buf, n, flags);
}
+
ACE_INLINE ssize_t
ACE_MEM_Stream::recv_n (void *buf, size_t n, int flags)
{
return this->recv (buf, n, flags);
}
+
#if 0
ACE_INLINE ssize_t
ACE_MEM_Stream::recv_n (void *buf,
@@ -74,6 +87,7 @@ ACE_MEM_Stream::recv_n (void *buf,
flags,
timeout);
}
+
ACE_INLINE ssize_t
ACE_MEM_Stream::recv_n (void *buf,
size_t len,
@@ -85,6 +99,7 @@ ACE_MEM_Stream::recv_n (void *buf,
len,
timeout);
}
+
ACE_INLINE ssize_t
ACE_MEM_Stream::recvv_n (iovec iov[],
size_t n,
@@ -96,6 +111,7 @@ ACE_MEM_Stream::recvv_n (iovec iov[],
n,
timeout);
}
+
ACE_INLINE ssize_t
ACE_MEM_Stream::send_n (const void *buf,
size_t len,
@@ -109,6 +125,7 @@ ACE_MEM_Stream::send_n (const void *buf,
flags,
timeout);
}
+
ACE_INLINE ssize_t
ACE_MEM_Stream::send_n (const void *buf,
size_t len,
@@ -120,6 +137,7 @@ ACE_MEM_Stream::send_n (const void *buf,
len,
timeout);
}
+
ACE_INLINE ssize_t
ACE_MEM_Stream::sendv_n (iovec iov[],
size_t n,
@@ -131,6 +149,7 @@ ACE_MEM_Stream::sendv_n (iovec iov[],
n,
timeout);
}
+
ACE_INLINE ssize_t
ACE_MEM_Stream::send_urg (const void *ptr,
size_t len,
@@ -143,6 +162,7 @@ ACE_MEM_Stream::send_urg (const void *ptr,
MSG_OOB,
timeout);
}
+
ACE_INLINE ssize_t
ACE_MEM_Stream::recv_urg (void *ptr,
size_t len,
@@ -156,4 +176,5 @@ ACE_MEM_Stream::recv_urg (void *ptr,
timeout);
}
#endif /* 0 */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/MMAP_Memory_Pool.cpp b/dep/ACE_wrappers/ace/MMAP_Memory_Pool.cpp
index 3fa6ccba578..f323d111a1b 100644
--- a/dep/ACE_wrappers/ace/MMAP_Memory_Pool.cpp
+++ b/dep/ACE_wrappers/ace/MMAP_Memory_Pool.cpp
@@ -1,4 +1,5 @@
// $Id: MMAP_Memory_Pool.cpp 82513 2008-08-05 18:52:53Z parsons $
+
// MMAP_Memory_Pool.cpp
#include "ace/MMAP_Memory_Pool.h"
#include "ace/OS_NS_sys_mman.h"
@@ -7,18 +8,24 @@
#include "ace/OS_NS_sys_stat.h"
#include "ace/Log_Msg.h"
#include "ace/Truncate.h"
+
#if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1)
#include "ace/Based_Pointer_T.h"
#include "ace/Based_Pointer_Repository.h"
#endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */
+
#if !defined (__ACE_INLINE__)
#include "ace/MMAP_Memory_Pool.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace,
MMAP_Memory_Pool,
"$Id: MMAP_Memory_Pool.cpp 82513 2008-08-05 18:52:53Z parsons $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_MMAP_Memory_Pool)
+
void
ACE_MMAP_Memory_Pool::dump (void) const
{
@@ -26,67 +33,86 @@ ACE_MMAP_Memory_Pool::dump (void) const
ACE_TRACE ("ACE_MMAP_Memory_Pool::dump");
#endif /* ACE_HAS_DUMP */
}
+
int
ACE_MMAP_Memory_Pool::release (int destroy)
{
ACE_TRACE ("ACE_MMAP_Memory_Pool::release");
+
#if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1)
ACE_BASED_POINTER_REPOSITORY::instance ()->unbind (this->mmap_.addr ());
#endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */
+
if (destroy)
this->mmap_.remove ();
else
this->mmap_.close ();
return 0;
}
+
int
ACE_MMAP_Memory_Pool::sync (size_t len, int flags)
{
ACE_TRACE ("ACE_MMAP_Memory_Pool::sync");
+
return this->mmap_.sync (len, flags);
}
+
int
ACE_MMAP_Memory_Pool::sync (int flags)
{
ACE_TRACE ("ACE_MMAP_Memory_Pool::sync");
+
size_t const len = ACE_Utils::truncate_cast<size_t> (
ACE_OS::lseek (this->mmap_.handle (), 0, SEEK_END));
+
return this->mmap_.sync (len, flags);
}
+
// Sync <len> bytes of the memory region to the backing store starting
// at <addr_>.
+
int
ACE_MMAP_Memory_Pool::sync (void *addr, size_t len, int flags)
{
ACE_TRACE ("ACE_MMAP_Memory_Pool::sync");
return ACE_OS::msync (addr, len, flags);
}
+
// Change the protection of the pages of the mapped region to <prot>
// starting at <this->base_addr_> up to <len> bytes.
// Change protection of all pages in the mapped region.
+
int
ACE_MMAP_Memory_Pool::protect (size_t len, int prot)
{
ACE_TRACE ("ACE_MMAP_Memory_Pool::protect");
+
return this->mmap_.protect (len, prot);
}
+
int
ACE_MMAP_Memory_Pool::protect (int prot)
{
ACE_TRACE ("ACE_MMAP_Memory_Pool::protect");
+
size_t const len = ACE_Utils::truncate_cast<size_t> (
ACE_OS::lseek (this->mmap_.handle (), 0, SEEK_END));
+
return this->mmap_.protect (len, prot);
}
+
// Change the protection of the pages of the mapped region to <prot>
// starting at <addr> up to <len> bytes.
+
int
ACE_MMAP_Memory_Pool::protect (void *addr, size_t len, int prot)
{
ACE_TRACE ("ACE_MMAP_Memory_Pool::protect");
return ACE_OS::mprotect (addr, len, prot);
}
+
ACE_MMAP_Memory_Pool::ACE_MMAP_Memory_Pool (
const ACE_TCHAR *backing_store_name,
const OPTIONS *options)
@@ -100,6 +126,7 @@ ACE_MMAP_Memory_Pool::ACE_MMAP_Memory_Pool (
install_signal_handler_ (true)
{
ACE_TRACE ("ACE_MMAP_Memory_Pool::ACE_MMAP_Memory_Pool");
+
#if (defined (ACE_HAS_SIGINFO_T) && !defined (ACE_LACKS_SI_ADDR)) || defined (ACE_WIN32)
// For plaforms that give the faulting address.
guess_on_fault_ = false;
@@ -112,12 +139,14 @@ ACE_MMAP_Memory_Pool::ACE_MMAP_Memory_Pool (
// If no options are specified, default to true.
guess_on_fault_ = true;
#endif /* (defined (ACE_HAS_SIGINFO_T) && !defined (ACE_LACKS_SI_ADDR)) || defined (ACE_WIN32) */
+
// Only change the defaults if <options> != 0.
if (options)
{
if (options->flags_ != 0)
this->flags_ = options->flags_;
use_fixed_addr_ = options->use_fixed_addr_;
+
if (use_fixed_addr_ == ACE_MMAP_Memory_Pool_Options::ALWAYS_FIXED)
{
this->base_addr_ = const_cast<void *> (options->base_addr_);
@@ -130,6 +159,7 @@ ACE_MMAP_Memory_Pool::ACE_MMAP_Memory_Pool (
this->file_mode_ = options->file_mode_;
this->install_signal_handler_ = options->install_signal_handler_;
}
+
if (backing_store_name == 0)
{
// Only create a new unique filename for the backing store file
@@ -148,9 +178,11 @@ ACE_MMAP_Memory_Pool::ACE_MMAP_Memory_Pool (
ACE_TEXT ("defaulting to current directory\n")));
this->backing_store_name_[0] = 0;
}
+
// Add the filename to the end
ACE_OS::strcat (this->backing_store_name_,
ACE_TEXT ("ace-malloc-XXXXXX"));
+
// If requested an unique filename, use mktemp to get a random file.
if (options && options->unique_)
ACE_OS::mktemp(this->backing_store_name_);
@@ -160,6 +192,7 @@ ACE_MMAP_Memory_Pool::ACE_MMAP_Memory_Pool (
ACE_OS::strsncpy (this->backing_store_name_,
backing_store_name,
(sizeof this->backing_store_name_ / sizeof (ACE_TCHAR)));
+
#if !defined (ACE_WIN32)
if (this->install_signal_handler_)
{
@@ -169,9 +202,11 @@ ACE_MMAP_Memory_Pool::ACE_MMAP_Memory_Pool (
}
#endif /* ACE_WIN32 */
}
+
ACE_MMAP_Memory_Pool::~ACE_MMAP_Memory_Pool (void)
{
}
+
// Compute the new map_size of the backing store and commit the
// memory.
int
@@ -179,10 +214,12 @@ ACE_MMAP_Memory_Pool::commit_backing_store_name (size_t rounded_bytes,
size_t & map_size)
{
ACE_TRACE ("ACE_MMAP_Memory_Pool::commit_backing_store_name");
+
#if defined (__Lynx__)
map_size = rounded_bytes;
#else
size_t seek_len;
+
if (this->write_each_page_)
// Write to the end of every block to ensure that we have enough
// space in the backing store.
@@ -190,9 +227,11 @@ ACE_MMAP_Memory_Pool::commit_backing_store_name (size_t rounded_bytes,
else
// We're willing to risk it all in the name of efficiency...
seek_len = rounded_bytes;
+
// The following loop will execute multiple times (if
// this->write_each_page == 1) or just once (if
// this->write_each_page == 0).
+
for (size_t cur_block = 0;
cur_block < rounded_bytes;
cur_block += seek_len)
@@ -202,6 +241,7 @@ ACE_MMAP_Memory_Pool::commit_backing_store_name (size_t rounded_bytes,
ACE_OS::lseek (this->mmap_.handle (),
static_cast<ACE_OFF_T> (seek_len - 1),
SEEK_END));
+
if (map_size == static_cast<size_t> (-1)
|| ACE_OS::write (this->mmap_.handle (),
"",
@@ -211,15 +251,19 @@ ACE_MMAP_Memory_Pool::commit_backing_store_name (size_t rounded_bytes,
this->backing_store_name_),
-1);
}
+
#if defined (ACE_OPENVMS)
::fsync(this->mmap_.handle());
#endif
+
// Increment by one to put us at the beginning of the next chunk...
++map_size;
#endif /* __Lynx__ */
return 0;
}
+
// Memory map the file up to <map_size> bytes.
+
int
ACE_MMAP_Memory_Pool::map_file (size_t map_size)
{
@@ -227,12 +271,15 @@ ACE_MMAP_Memory_Pool::map_file (size_t map_size)
#if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1)
void* obase_addr = this->base_addr_;
#endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */
+
// Unmap the existing mapping.
this->mmap_.unmap ();
+
#if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1)
if (use_fixed_addr_ == ACE_MMAP_Memory_Pool_Options::NEVER_FIXED)
this->base_addr_ = 0;
#endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */
+
// Remap the file; try to stay at the same location as a previous mapping
// but do not force it with MAP_FIXED. Doing so will give the OS permission
// to map locations currently holding other things (such as the heap, or
@@ -264,54 +311,69 @@ ACE_MMAP_Memory_Pool::map_file (size_t map_size)
{
#if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1)
this->base_addr_ = this->mmap_.addr ();
+
if (obase_addr && this->base_addr_ != obase_addr)
{
ACE_BASED_POINTER_REPOSITORY::instance ()->unbind (obase_addr);
}
+
ACE_BASED_POINTER_REPOSITORY::instance ()->bind (this->base_addr_,
map_size);
#endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */
return 0;
}
}
+
// Ask operating system for more shared memory, increasing the mapping
// accordingly. Note that this routine assumes that the appropriate
// locks are held when it is called.
+
void *
ACE_MMAP_Memory_Pool::acquire (size_t nbytes,
size_t &rounded_bytes)
{
ACE_TRACE ("ACE_MMAP_Memory_Pool::acquire");
rounded_bytes = this->round_up (nbytes);
+
// ACE_DEBUG ((LM_DEBUG, "(%P|%t) acquiring more chunks, nbytes =
// %B, rounded_bytes = %B\n", nbytes, rounded_bytes));
+
size_t map_size;
+
if (this->commit_backing_store_name (rounded_bytes,
map_size) == -1)
return 0;
else if (this->map_file (map_size) == -1)
return 0;
+
// ACE_DEBUG ((LM_DEBUG, "(%P|%t) acquired more chunks, nbytes = %B,
// rounded_bytes = %B, map_size = %B\n", nbytes, rounded_bytes,
// map_size));
+
return (void *) ((char *) this->mmap_.addr () + (this->mmap_.size () - rounded_bytes));
}
+
// Ask system for initial chunk of shared memory.
+
void *
ACE_MMAP_Memory_Pool::init_acquire (size_t nbytes,
size_t &rounded_bytes,
int &first_time)
{
ACE_TRACE ("ACE_MMAP_Memory_Pool::init_acquire");
+
first_time = 0;
+
if (nbytes < static_cast <size_t> (this->minimum_bytes_))
nbytes = static_cast <size_t> (this->minimum_bytes_);
+
if (this->mmap_.open (this->backing_store_name_,
O_RDWR | O_CREAT | O_TRUNC | O_EXCL,
this->file_mode_, this->sa_) != -1)
{
// First time in, so need to acquire memory.
first_time = 1;
+
void *result = this->acquire (nbytes, rounded_bytes);
// After the first time, reset the flag so that subsequent calls
// will use MAP_FIXED
@@ -349,6 +411,7 @@ ACE_MMAP_Memory_Pool::init_acquire (size_t nbytes,
ACE_BASED_POINTER_REPOSITORY::instance ()->bind (this->mmap_.addr(),
this->mmap_.size());
#endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */
+
return this->mmap_.addr ();
}
else
@@ -357,21 +420,26 @@ ACE_MMAP_Memory_Pool::init_acquire (size_t nbytes,
ACE_TEXT ("MMAP_Memory_Pool::init_acquire")),
0);
}
+
#if defined (ACE_WIN32)
int
ACE_MMAP_Memory_Pool::seh_selector (void *ep)
{
DWORD const ecode = ((EXCEPTION_POINTERS *) ep)->ExceptionRecord->ExceptionCode;
+
if (ecode == EXCEPTION_ACCESS_VIOLATION)
{
void * fault_addr = (void *)
((EXCEPTION_POINTERS *) ep)->ExceptionRecord->ExceptionInformation[1];
+
if (this->remap (fault_addr) == 0)
return 1;
}
+
return 0;
}
#endif /* ACE_WIN32 */
+
int
ACE_MMAP_Memory_Pool::remap (void *addr)
{
@@ -380,12 +448,15 @@ ACE_MMAP_Memory_Pool::remap (void *addr)
size_t const current_map_size =
ACE_Utils::truncate_cast<size_t> (ACE_OS::filesize (this->mmap_.handle ()));
// ACE_OS::lseek (this->mmap_.handle (), 0, SEEK_END);
+
if (!(addr < (void *) ((char *) this->mmap_.addr () + current_map_size)
&& addr >= this->mmap_.addr ()))
return -1;
+
// Extend the mapping to cover the size of the backing store.
return this->map_file (current_map_size);
}
+
ACE_MMAP_Memory_Pool_Options::ACE_MMAP_Memory_Pool_Options (
const void *base_addr,
int use_fixed_addr,
@@ -413,6 +484,7 @@ ACE_MMAP_Memory_Pool_Options::ACE_MMAP_Memory_Pool_Options (
if (base_addr_ == 0 && use_fixed_addr_ == ALWAYS_FIXED)
use_fixed_addr_ = FIRSTCALL_FIXED;
}
+
#if !defined (ACE_WIN32)
int
ACE_MMAP_Memory_Pool::handle_signal (int signum, siginfo_t *siginfo, ucontext_t *)
@@ -424,9 +496,11 @@ ACE_MMAP_Memory_Pool::handle_signal (int signum, siginfo_t *siginfo, ucontext_t
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) received %S\n"), signum));
#endif
// ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) new mapping address = %@\n"), (char *) this->base_addr_ + current_map_size));
+
#if defined (ACE_HAS_SIGINFO_T) && !defined (ACE_LACKS_SI_ADDR)
// Make sure that the pointer causing the problem is within the
// range of the backing store.
+
if (siginfo != 0)
{
// ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) si_signo = %d, si_code = %d, addr = %@\n"), siginfo->si_signo, siginfo->si_code, siginfo->si_addr));
@@ -450,6 +524,7 @@ ACE_MMAP_Memory_Pool::handle_signal (int signum, siginfo_t *siginfo, ucontext_t
// Check if the current mapping is up to date.
size_t const current_map_size =
ACE_Utils::truncate_cast<size_t> (ACE_OS::filesize (this->mmap_.handle ()));
+
if (static_cast<size_t> (current_map_size) == this->mmap_.size ())
{
// The mapping is up to date so this really is a bad
@@ -459,6 +534,7 @@ ACE_MMAP_Memory_Pool::handle_signal (int signum, siginfo_t *siginfo, ucontext_t
this->signal_handler_.remove_handler (SIGSEGV);
return 0;
}
+
// Extend the mapping to cover the size of the backing store.
return this->map_file (current_map_size);
}
@@ -466,45 +542,54 @@ ACE_MMAP_Memory_Pool::handle_signal (int signum, siginfo_t *siginfo, ucontext_t
return -1;
}
#endif
+
void *
ACE_MMAP_Memory_Pool::base_addr (void) const
{
ACE_TRACE ("ACE_MMAP_Memory_Pool::base_addr");
return this->base_addr_;
}
+
size_t
ACE_MMAP_Memory_Pool::round_up (size_t nbytes)
{
ACE_TRACE ("ACE_MMAP_Memory_Pool::round_up");
return ACE::round_to_pagesize (nbytes);
}
+
ACE_ALLOC_HOOK_DEFINE(ACE_Lite_MMAP_Memory_Pool)
+
ACE_Lite_MMAP_Memory_Pool::ACE_Lite_MMAP_Memory_Pool (const ACE_TCHAR *backing_store_name,
const OPTIONS *options)
: ACE_MMAP_Memory_Pool (backing_store_name, options)
{
ACE_TRACE ("ACE_Lite_MMAP_Memory_Pool::ACE_Lite_MMAP_Memory_Pool");
}
+
ACE_Lite_MMAP_Memory_Pool::~ACE_Lite_MMAP_Memory_Pool (void)
{
}
+
int
ACE_Lite_MMAP_Memory_Pool::sync (size_t, int)
{
ACE_TRACE ("ACE_Lite_MMAP_Memory_Pool::sync");
return 0;
}
+
int
ACE_Lite_MMAP_Memory_Pool::sync (int)
{
ACE_TRACE ("ACE_Lite_MMAP_Memory_Pool::sync");
return 0;
}
+
int
ACE_Lite_MMAP_Memory_Pool::sync (void *, size_t, int)
{
ACE_TRACE ("ACE_Lite_MMAP_Memory_Pool::sync");
return 0;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/MMAP_Memory_Pool.h b/dep/ACE_wrappers/ace/MMAP_Memory_Pool.h
index c857f4eae11..aca39757152 100644
--- a/dep/ACE_wrappers/ace/MMAP_Memory_Pool.h
+++ b/dep/ACE_wrappers/ace/MMAP_Memory_Pool.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file MMAP_Memory_Pool.h
@@ -9,18 +10,25 @@
* @author Prashant Jain <pjain@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_MMAP_MEMORY_POOL_H
#define ACE_MMAP_MEMORY_POOL_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/ACE.h"
#include "ace/Event_Handler.h"
#include "ace/Sig_Handler.h"
#include "ace/Mem_Map.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_MMAP_Memory_Pool_Options
*
@@ -39,11 +47,13 @@ public:
* calls to mmap.
*/
FIRSTCALL_FIXED = 0,
+
/**
* The base address specified in base_addr will be used in all calls to
* mmap.
*/
ALWAYS_FIXED = 1,
+
/**
* The base address will be selected by the OS for each call to mmap.
* Caution should be used with this mode since a call that requires the
@@ -52,6 +62,7 @@ public:
*/
NEVER_FIXED = 2
};
+
/// Constructor
ACE_MMAP_Memory_Pool_Options (const void *base_addr = ACE_DEFAULT_BASE_ADDR,
int use_fixed_addr = ALWAYS_FIXED,
@@ -63,8 +74,10 @@ public:
mode_t file_mode = ACE_DEFAULT_FILE_PERMS,
bool unique_ = false,
bool install_signal_handler = true);
+
/// Base address of the memory-mapped backing store.
const void *base_addr_;
+
/**
* Determines whether we set @c base_addr_ or if mmap(2) selects it
* FIRSTCALL_FIXED The base address from the first call to mmap
@@ -78,32 +91,42 @@ public:
* cached by the application.
*/
int use_fixed_addr_;
+
/// Should each page be written eagerly to avoid surprises later
/// on?
bool write_each_page_;
+
/// What the minimim bytes of the initial segment should be.
size_t minimum_bytes_;
+
/// Any special flags that need to be used for @c mmap.
u_int flags_;
+
/**
* Try to remap without knowing the faulting address. This
* parameter is ignored on platforms that know the faulting address
* (UNIX with SI_ADDR and Win32).
*/
bool guess_on_fault_;
+
/// Pointer to a security attributes object. Only used on NT.
LPSECURITY_ATTRIBUTES sa_;
+
/// File mode for mmaped file, if it is created.
mode_t file_mode_;
+
/// Do we want an unique backing store name?
bool unique_;
+
/// Should we install a signal handler
bool install_signal_handler_;
+
private:
// Prevent copying
ACE_MMAP_Memory_Pool_Options (const ACE_MMAP_Memory_Pool_Options &);
ACE_MMAP_Memory_Pool_Options &operator= (const ACE_MMAP_Memory_Pool_Options &);
};
+
/**
* @class ACE_MMAP_Memory_Pool
*
@@ -114,16 +137,21 @@ class ACE_Export ACE_MMAP_Memory_Pool : public ACE_Event_Handler
{
public:
typedef ACE_MMAP_Memory_Pool_Options OPTIONS;
+
// = Initialization and termination methods.
+
/// Initialize the pool.
ACE_MMAP_Memory_Pool (const ACE_TCHAR *backing_store_name = 0,
const OPTIONS *options = 0);
+
/// Destructor.
virtual ~ACE_MMAP_Memory_Pool (void);
+
/// Ask system for initial chunk of shared memory.
virtual void *init_acquire (size_t nbytes,
size_t &rounded_bytes,
int &first_time);
+
/**
* Acquire at least @a nbytes from the memory pool. @a rounded_bytes
* is the actual number of bytes allocated. Also acquires an
@@ -132,31 +160,39 @@ public:
*/
virtual void *acquire (size_t nbytes,
size_t &rounded_bytes);
+
/// Instruct the memory pool to release all of its resources.
virtual int release (int destroy = 1);
+
/// Sync the memory region to the backing store starting at
/// @c this->base_addr_.
virtual int sync (size_t len, int flags = MS_SYNC);
+
/// Sync the memory region to the backing store starting at
/// @c this->base_addr_. Will sync as much as the backing file
/// allows.
virtual int sync (int flags = MS_SYNC);
+
/// Sync the memory region to the backing store starting at @a addr.
virtual int sync (void *addr, size_t len, int flags = MS_SYNC);
+
/**
* Change the protection of the pages of the mapped region to @a prot
* starting at @c this->base_addr_ up to @a len bytes. If @a len == -1
* then change protection of all pages in the mapped region.
*/
virtual int protect (size_t len, int prot = PROT_RDWR);
+
/**
* Change the protection of all the pages of the mapped region to @a prot
* starting at @c this->base_addr_.
*/
virtual int protect (int prot = PROT_RDWR);
+
/// Change the protection of the pages of the mapped region to @a prot
/// starting at @a addr up to @a len bytes.
virtual int protect (void *addr, size_t len, int prot = PROT_RDWR);
+
#if defined (ACE_WIN32)
/**
* Win32 Structural exception selector. The return value decides
@@ -165,6 +201,7 @@ public:
*/
virtual int seh_selector (void *);
#endif /* ACE_WIN32 */
+
/**
* Try to extend the virtual address space so that @a addr is now
* covered by the address mapping. The method succeeds and returns
@@ -176,26 +213,35 @@ public:
* isn't in range (yet).
*/
virtual int remap (void *addr);
+
/// Return the base address of this memory pool.
virtual void *base_addr (void) const;
+
/// Dump the state of an object.
virtual void dump (void) const;
+
/// Get reference to underlying ACE_Mem_Map object.
ACE_Mem_Map const & mmap (void) const;
+
/// Get reference to underlying ACE_Mem_Map object.
ACE_Mem_Map & mmap (void);
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
/// Implement the algorithm for rounding up the request to an
/// appropriate chunksize.
virtual size_t round_up (size_t nbytes);
+
/// Compute the new @a map_size of the backing store and commit the
/// memory.
virtual int commit_backing_store_name (size_t rounded_bytes,
size_t & map_size);
+
/// Memory map the file up to @a map_size bytes.
virtual int map_file (size_t map_size);
+
#if !defined (ACE_WIN32)
/**
* Handle SIGSEGV and SIGBUS signals to remap memory properly. When a
@@ -210,42 +256,55 @@ protected:
*/
virtual int handle_signal (int signum, siginfo_t *, ucontext_t *);
#endif
+
#if !defined (ACE_WIN32)
/// Handles SIGSEGV.
ACE_Sig_Handler signal_handler_;
#endif
+
/// Memory-mapping object.
ACE_Mem_Map mmap_;
+
/**
* Base of mapped region. If this has the value of 0 then the OS is
* free to select any address to map the file, otherwise this value
* is what the OS must try to use to mmap the file.
*/
void *base_addr_;
+
/// Must we use the @c base_addr_ or can we let mmap(2) select it?
int use_fixed_addr_;
+
/// Flags passed into ACE_OS::mmap().
int flags_;
+
/// Should we write a byte to each page to forceably allocate memory
/// for this backing store?
bool write_each_page_;
+
/// What the minimum bytes of the initial segment should be.
size_t minimum_bytes_;
+
/// Name of the backing store where the shared memory pool is kept.
ACE_TCHAR backing_store_name_[MAXPATHLEN + 1];
+
/**
* Try to remap without knowing the faulting address. This
* parameter is ignored on platforms that know the faulting address
* (UNIX with SI_ADDR and Win32).
*/
bool guess_on_fault_;
+
/// Security attributes object, only used on NT.
LPSECURITY_ATTRIBUTES sa_;
+
/// Protection mode for mmaped file.
mode_t file_mode_;
+
/// Should we install a signal handler
bool install_signal_handler_;
};
+
/**
* @class ACE_Lite_MMAP_Memory_Pool
*
@@ -264,19 +323,26 @@ public:
/// Initialize the pool.
ACE_Lite_MMAP_Memory_Pool (const ACE_TCHAR *backing_store_name = 0,
const OPTIONS *options = 0);
+
/// Destructor.
virtual ~ACE_Lite_MMAP_Memory_Pool (void);
+
/// Overwrite the default sync behavior with no-op
virtual int sync (size_t len, int flags = MS_SYNC);
+
/// Overwrite the default sync behavior with no-op
virtual int sync (int flags = MS_SYNC);
+
/// Overwrite the default sync behavior with no-op
virtual int sync (void *addr, size_t len, int flags = MS_SYNC);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/MMAP_Memory_Pool.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_MMAP_MEMORY_POOL_H */
diff --git a/dep/ACE_wrappers/ace/MMAP_Memory_Pool.inl b/dep/ACE_wrappers/ace/MMAP_Memory_Pool.inl
index 2782bd1bed4..80df932233b 100644
--- a/dep/ACE_wrappers/ace/MMAP_Memory_Pool.inl
+++ b/dep/ACE_wrappers/ace/MMAP_Memory_Pool.inl
@@ -1,17 +1,21 @@
// -*- C++ -*-
//
// $Id: MMAP_Memory_Pool.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_Mem_Map const &
ACE_MMAP_Memory_Pool::mmap (void) const
{
return mmap_;
}
+
ACE_INLINE
ACE_Mem_Map &
ACE_MMAP_Memory_Pool::mmap (void)
{
return mmap_;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Malloc.cpp b/dep/ACE_wrappers/ace/Malloc.cpp
index e0de20f1de3..b9684654c10 100644
--- a/dep/ACE_wrappers/ace/Malloc.cpp
+++ b/dep/ACE_wrappers/ace/Malloc.cpp
@@ -1,34 +1,44 @@
// $Id: Malloc.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Malloc.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Malloc.inl"
#endif /* __ACE_INLINE__ */
+
#include "ace/Object_Manager.h"
#include "ace/Malloc_Base.h"
#include "ace/OS_NS_string.h"
+
ACE_RCSID (ace,
Malloc,
"$Id: Malloc.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Process-wide ACE_Allocator.
ACE_Allocator *ACE_Allocator::allocator_ = 0;
+
// Controls whether the Allocator is deleted when we shut down (we can
// only delete it safely if we created it!) This is no longer used;
// see ACE_Allocator::instance (void).
int ACE_Allocator::delete_allocator_ = 0;
+
void
ACE_Control_Block::ACE_Malloc_Header::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_Control_Block::ACE_Malloc_Header::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nnext_block = %@"), (ACE_Malloc_Header *) this->next_block_));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nsize = %d\n"), this->size_));
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
void
ACE_Control_Block::print_alignment_info (void)
{
@@ -64,32 +74,39 @@ ACE_Control_Block::print_alignment_info (void)
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("End <--- ACE_Control_Block::print_alignment_info:\n")));
#endif /* ACE_HAS_DUMP */
}
+
void
ACE_Control_Block::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_Control_Block::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Name Node:\n")));
for (ACE_Name_Node *nextn = this->name_head_;
nextn != 0;
nextn = nextn->next_)
nextn->dump ();
+
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("freep_ = %@"), (ACE_Malloc_Header *) this->freep_));
this->base_.dump ();
+
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nMalloc Header:\n")));
for (ACE_Malloc_Header *nexth = ((ACE_Malloc_Header *)this->freep_)->next_block_;
nexth != 0 && nexth != &this->base_;
nexth = nexth->next_block_)
nexth->dump ();
+
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n")));
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
ACE_Control_Block::ACE_Name_Node::ACE_Name_Node (void)
{
ACE_TRACE ("ACE_Control_Block::ACE_Name_Node::ACE_Name_Node");
}
+
ACE_Control_Block::ACE_Name_Node::ACE_Name_Node (const char *name,
char *name_ptr,
char *pointer,
@@ -105,21 +122,25 @@ ACE_Control_Block::ACE_Name_Node::ACE_Name_Node (const char *name,
if (next != 0)
next->prev_ = this;
}
+
const char *
ACE_Control_Block::ACE_Name_Node::name (void) const
{
return this->name_;
}
+
ACE_Control_Block::ACE_Malloc_Header::ACE_Malloc_Header (void)
: next_block_ (0),
size_ (0)
{
}
+
void
ACE_Control_Block::ACE_Name_Node::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_Control_Block::ACE_Name_Node::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("pointer = %@"), (const char *) this->pointer_));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nnext_ = %@"), (ACE_Name_Node *) this->next_));
@@ -132,6 +153,7 @@ ACE_Control_Block::ACE_Name_Node::dump (void) const
#endif /* ACE_HAS_DUMP */
}
+
#if defined (ACE_HAS_MALLOC_STATS)
ACE_Malloc_Stats::ACE_Malloc_Stats (void)
: nchunks_ (0),
@@ -140,15 +162,18 @@ ACE_Malloc_Stats::ACE_Malloc_Stats (void)
{
ACE_TRACE ("ACE_Malloc_Stats::ACE_Malloc_Stats");
}
+
void
ACE_Malloc_Stats::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_Malloc_Stats::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
int const nblocks = this->nblocks_.value ();
int const ninuse = this->ninuse_.value ();
int const nchunks = this->nchunks_.value ();
+
ACE_DEBUG ((LM_DEBUG, ACE_TEXT("nblocks = %d"), nblocks));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT("\nninuse = %d"), ninuse));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT("\nnchunks = %d"), nchunks));
@@ -156,6 +181,8 @@ ACE_Malloc_Stats::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
#endif /*ACE_HAS_MALLOC_STATS*/
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Malloc.h b/dep/ACE_wrappers/ace/Malloc.h
index b93fff00944..5974f012652 100644
--- a/dep/ACE_wrappers/ace/Malloc.h
+++ b/dep/ACE_wrappers/ace/Malloc.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file Malloc.h
@@ -8,14 +9,20 @@
* @author Doug Schmidt and Irfan Pyarali
*/
//==========================================================================
+
#ifndef ACE_MALLOC_H
#define ACE_MALLOC_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Log_Msg.h"
+
#if defined (ACE_HAS_MALLOC_STATS)
# include "ace/Atomic_Op.h"
# if defined (ACE_HAS_THREADS)
@@ -26,16 +33,23 @@
# define ACE_PROCESS_MUTEX ACE_SV_Semaphore_Simple
# endif /* ACE_HAS_THREADS */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
typedef ACE_Atomic_Op<ACE_PROCESS_MUTEX, int> ACE_INT;
+
/******************************************************************
+
* Assume that ACE_MALLOC_ALIGN is the number of bytes of the alignment
of the platform. Usually, this will be 4 on most platforms. Some
platforms require this to be 8. In any case, this macro should
always be a 2's power.
+
* Malloc_Header structure.
+
Notice that sizeof (ACE_Malloc_Header) must be multiple of
ACE_MALLOC_ALIGN
+
+-----------------------------------------+
|MALLOC_HEADER_PTR *next_block_; |
| // Points to next free Malloc_Header |
@@ -53,10 +67,13 @@ typedef ACE_Atomic_Op<ACE_PROCESS_MUTEX, int> ACE_INT;
| // the sizeof (Malloc_Header) to be |
| // multiple of ACE_MALLOC_ALIGN. |
+-----------------------------------------+
+
* Name_Node
+
ACE_Malloc allows searching thru it's allocated buffer using names.
Name_Node is an internal data structure that ACE_Malloc used to
maintain a linked list that manages this (name, buffer) mappings.
+
+-----------------------------------------+
|char *name_; |
| // Points to a dynamically allocated |
@@ -79,12 +96,15 @@ typedef ACE_Atomic_Op<ACE_PROCESS_MUTEX, int> ACE_INT;
| // Name Node linked list pointers. |
+-----------------------------------------+
+
* Control_Block
+
Only the first ACE_Malloc instance that uses
the shared memory will initialize the control block because all
later instances are supposed to share the memory with the first
instance. The following diagram shows the initial value of a
Control_Block.
+
+-----------------------------------------+
|NAME_NODE_PTR name_head_; |<---- NULL.
| // Entry point for double-linked list.|
@@ -115,6 +135,7 @@ typedef ACE_Atomic_Op<ACE_PROCESS_MUTEX, int> ACE_INT;
| +-------------+
| |size_ |----> 0
+-----------------------------------------+
+
The first ACE_Malloc initializes the control block by allocating a
memory block of size equal to or greater than sizeof (control block)
(rounded to the closest <rounded_bytes>) and invokes the placement
@@ -126,6 +147,7 @@ typedef ACE_Atomic_Op<ACE_PROCESS_MUTEX, int> ACE_INT;
than the sizeof Control_Block, the control block is initialized to
the following diagram:
+
+-------------------------------------
|name_head_; |
+-------------------------------------+
@@ -161,32 +183,43 @@ typedef ACE_Atomic_Op<ACE_PROCESS_MUTEX, int> ACE_INT;
| +-----------+
| |size_; |
+-------------------------------------+
+
***********************************************************/
+
/// This keeps stats on the usage of the memory manager.
struct ACE_Export ACE_Malloc_Stats
{
ACE_Malloc_Stats (void);
void dump (void) const;
+
/// Coarse-grained unit of allocation.
ACE_INT nchunks_;
+
/// Fine-grained unit of allocation.
ACE_INT nblocks_;
+
/// Number of blocks in use
ACE_INT ninuse_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# define ACE_MALLOC_STATS(X) X
#else
# define ACE_MALLOC_STATS(X)
#endif /* ACE_HAS_MALLOC_STATS */
+
#if !defined (ACE_MALLOC_PADDING)
// ACE_MALLOC_PADDING allows you to insure that allocated regions are
// at least <ACE_MALLOC_PADDING> bytes long. It is especially useful
// when you want areas to be at least a page long, or 32K long, or
// something like that.
+
# define ACE_MALLOC_PADDING 1
#endif /* ACE_MALLOC_PADDING */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
union ACE_max_align_info
{
int (*i)();
@@ -194,15 +227,19 @@ union ACE_max_align_info
long l;
double d;
};
+
#if !defined (ACE_MALLOC_ALIGN)
// Align the malloc header size to a multiple of a double.
# define ACE_MALLOC_ALIGN (sizeof (ACE_max_align_info))
#endif /* ACE_MALLOC_ALIGN */
+
#if !defined ACE_MALLOC_ROUNDUP
# define ACE_MALLOC_ROUNDUP(X, Y) (((X) + ((Y) - 1)) & ~((Y) - 1))
#endif
+
// ACE_MALLOC_HEADER_SIZE is the normalized malloc header size.
#define ACE_MALLOC_HEADER_SIZE ACE_MALLOC_ROUNDUP(ACE_MALLOC_PADDING, ACE_MALLOC_ALIGN)
+
/**
* @class ACE_Control_Block
*
@@ -219,6 +256,7 @@ union ACE_max_align_info
class ACE_Export ACE_Control_Block
{
public:
+
/**
* @class ACE_Malloc_Header
*
@@ -230,21 +268,27 @@ public:
{
public:
ACE_Malloc_Header (void);
+
/// Points to next block if on free list.
ACE_Malloc_Header *next_block_;
+
/// Initialize a malloc header pointer.
static void init_ptr (ACE_Malloc_Header **ptr,
ACE_Malloc_Header *init,
void *base_addr);
+
/// Size of this header control block.
size_t size_;
+
# if !defined (ACE_MALLOC_PADDING_SIZE)
# define ACE_MALLOC_PADDING_SIZE ACE_MALLOC_ROUNDUP (ACE_MALLOC_HEADER_SIZE + sizeof (ACE_Malloc_Header*) + sizeof (size_t), ACE_MALLOC_ALIGN) - (sizeof (ACE_Malloc_Header*) + sizeof (size_t))
# endif /* !ACE_MALLOC_PADDING_SIZE */
char padding_[(ACE_MALLOC_PADDING_SIZE) ? ACE_MALLOC_PADDING_SIZE : ACE_MALLOC_ALIGN];
+
/// Dump the state of the object.
void dump (void) const;
};
+
/**
* @class ACE_Name_Node
*
@@ -264,40 +308,55 @@ public:
char *name_ptr,
char *pointer,
ACE_Name_Node *head);
+
/// Constructor.
ACE_Name_Node (void);
+
/// Constructor.
~ACE_Name_Node (void);
+
/// Initialize a name node pointer.
static void init_ptr (ACE_Name_Node **ptr,
ACE_Name_Node *init,
void *base_addr);
+
/// Return a pointer to the name of this node.
const char *name (void) const;
+
/// Name of the Node.
char *name_;
+
/// Pointer to the contents.
char *pointer_;
+
/// Pointer to the next node in the doubly-linked list.
ACE_Name_Node *next_;
+
/// Pointer to the previous node in the doubly-linked list.
ACE_Name_Node *prev_;
+
/// Dump the state of the object.
void dump (void) const;
private:
/// Copy constructor.
ACE_Name_Node (const ACE_Name_Node &);
};
+
/// Print out a bunch of size info for debugging.
static void print_alignment_info (void);
+
/// Reference counter.
int ref_counter_;
+
/// Head of the linked list of Name Nodes.
ACE_Name_Node *name_head_;
+
/// Current head of the freelist.
ACE_Malloc_Header *freep_;
+
/// Name of lock thats ensures mutual exclusion.
char lock_name_[MAXNAMELEN];
+
#if defined (ACE_HAS_MALLOC_STATS)
/// Keep statistics about ACE_Malloc state and performance.
ACE_Malloc_Stats malloc_stats_;
@@ -312,20 +371,27 @@ public:
+ sizeof (int) \
+ MAXNAMELEN))
#endif /* ACE_HAS_MALLOC_STATS */
+
# if !defined (ACE_CONTROL_BLOCK_ALIGN_BYTES)
# define ACE_CONTROL_BLOCK_ALIGN_BYTES \
ACE_MALLOC_ROUNDUP (ACE_CONTROL_BLOCK_SIZE, ACE_MALLOC_ALIGN) - ACE_CONTROL_BLOCK_SIZE
# endif /* !ACE_CONTROL_BLOCK_ALIGN_BYTES */
char align_[(ACE_CONTROL_BLOCK_ALIGN_BYTES) ? ACE_CONTROL_BLOCK_ALIGN_BYTES : ACE_MALLOC_ALIGN];
+
/// Dummy node used to anchor the freelist. This needs to come last...
ACE_Malloc_Header base_;
+
/// Dump the state of the object.
void dump (void) const;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Malloc.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_MALLOC_H */
diff --git a/dep/ACE_wrappers/ace/Malloc.inl b/dep/ACE_wrappers/ace/Malloc.inl
index 58a8fe17d73..caf48684f41 100644
--- a/dep/ACE_wrappers/ace/Malloc.inl
+++ b/dep/ACE_wrappers/ace/Malloc.inl
@@ -1,21 +1,26 @@
// -*- C++ -*-
//
// $Id: Malloc.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_Control_Block::ACE_Name_Node::~ACE_Name_Node (void)
{
}
+
ACE_INLINE void
ACE_Control_Block::ACE_Malloc_Header::init_ptr
(ACE_Malloc_Header **ptr, ACE_Malloc_Header *init, void *)
{
*ptr = init;
}
+
ACE_INLINE void
ACE_Control_Block::ACE_Name_Node::init_ptr
(ACE_Name_Node **ptr, ACE_Name_Node *init, void *)
{
*ptr = init;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Malloc_Allocator.cpp b/dep/ACE_wrappers/ace/Malloc_Allocator.cpp
index 2cb237c2344..9c53da4a172 100644
--- a/dep/ACE_wrappers/ace/Malloc_Allocator.cpp
+++ b/dep/ACE_wrappers/ace/Malloc_Allocator.cpp
@@ -1,24 +1,32 @@
// $Id: Malloc_Allocator.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Malloc_Allocator.h"
#include "ace/Object_Manager.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Malloc_Allocator.inl"
#endif /* __ACE_INLINE__ */
+
#include "ace/Guard_T.h"
#include "ace/Recursive_Thread_Mutex.h"
#include "ace/Log_Msg.h" // for ACE_ASSERT
#include "ace/OS_NS_string.h"
+
ACE_RCSID (ace, Malloc_Allocator, "$Id: Malloc_Allocator.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_Allocator *
ACE_Allocator::instance (void)
{
// ACE_TRACE ("ACE_Allocator::instance");
+
if (ACE_Allocator::allocator_ == 0)
{
// Perform Double-Checked Locking Optimization.
ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon,
*ACE_Static_Object_Lock::instance (), 0));
+
if (ACE_Allocator::allocator_ == 0)
{
// Have a seat. We want to avoid ever having to delete the
@@ -36,6 +44,7 @@ ACE_Allocator::instance (void)
// doesn't get constructed statically. We never bother to
// destroy it.
static void *allocator_instance = 0;
+
// Check this critical assumption. We put it in a variable
// first to avoid stupid compiler warnings that the
// condition may always be true/false.
@@ -44,14 +53,17 @@ ACE_Allocator::instance (void)
sizeof (ACE_New_Allocator));
ACE_ASSERT (assertion);
# endif /* !ACE_NDEBUG */
+
// Initialize the allocator_instance by using a placement
// new.
ACE_Allocator::allocator_ =
new (&allocator_instance) ACE_New_Allocator;
}
}
+
return ACE_Allocator::allocator_;
}
+
ACE_Allocator *
ACE_Allocator::instance (ACE_Allocator *r)
{
@@ -59,17 +71,22 @@ ACE_Allocator::instance (ACE_Allocator *r)
ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon,
*ACE_Static_Object_Lock::instance (), 0));
ACE_Allocator *t = ACE_Allocator::allocator_;
+
// We can't safely delete it since we don't know who created it!
ACE_Allocator::delete_allocator_ = 0;
+
ACE_Allocator::allocator_ = r;
return t;
}
+
void
ACE_Allocator::close_singleton (void)
{
ACE_TRACE ("ACE_Allocator::close_singleton");
+
ACE_MT (ACE_GUARD (ACE_Recursive_Thread_Mutex, ace_mon,
*ACE_Static_Object_Lock::instance ()));
+
if (ACE_Allocator::delete_allocator_)
{
// This should never be executed.... See the
@@ -79,110 +96,135 @@ ACE_Allocator::close_singleton (void)
ACE_Allocator::delete_allocator_ = 0;
}
}
+
ACE_Allocator::~ACE_Allocator (void)
{
ACE_TRACE ("ACE_Allocator::~ACE_Allocator");
}
+
ACE_Allocator::ACE_Allocator (void)
{
ACE_TRACE ("ACE_Allocator::ACE_Allocator");
}
+
/******************************************************************************/
+
void *
ACE_New_Allocator::malloc (size_t nbytes)
{
char *ptr = 0;
+
if (nbytes > 0)
ACE_NEW_RETURN (ptr, char[nbytes], 0);
return (void *) ptr;
}
+
void *
ACE_New_Allocator::calloc (size_t nbytes,
char initial_value)
{
char *ptr = 0;
+
ACE_NEW_RETURN (ptr, char[nbytes], 0);
+
ACE_OS::memset (ptr, initial_value, nbytes);
return (void *) ptr;
}
+
void *
ACE_New_Allocator::calloc (size_t n_elem, size_t elem_size, char initial_value)
{
return ACE_New_Allocator::calloc (n_elem * elem_size, initial_value);
}
+
void
ACE_New_Allocator::free (void *ptr)
{
delete [] (char *) ptr;
}
+
int
ACE_New_Allocator::remove (void)
{
ACE_NOTSUP_RETURN (-1);
}
+
int
ACE_New_Allocator::bind (const char *, void *, int)
{
ACE_NOTSUP_RETURN (-1);
}
+
int
ACE_New_Allocator::trybind (const char *, void *&)
{
ACE_NOTSUP_RETURN (-1);
}
+
int
ACE_New_Allocator::find (const char *, void *&)
{
ACE_NOTSUP_RETURN (-1);
}
+
int
ACE_New_Allocator::find (const char *)
{
ACE_NOTSUP_RETURN (-1);
}
+
int
ACE_New_Allocator::unbind (const char *)
{
ACE_NOTSUP_RETURN (-1);
}
+
int
ACE_New_Allocator::unbind (const char *, void *&)
{
ACE_NOTSUP_RETURN (-1);
}
+
int
ACE_New_Allocator::sync (ssize_t, int)
{
ACE_NOTSUP_RETURN (-1);
}
+
int
ACE_New_Allocator::sync (void *, size_t, int)
{
ACE_NOTSUP_RETURN (-1);
}
+
int
ACE_New_Allocator::protect (ssize_t, int)
{
ACE_NOTSUP_RETURN (-1);
}
+
int
ACE_New_Allocator::protect (void *, size_t, int)
{
ACE_NOTSUP_RETURN (-1);
}
+
#if defined (ACE_HAS_MALLOC_STATS)
void
ACE_New_Allocator::print_stats (void) const
{
}
#endif /* ACE_HAS_MALLOC_STATS */
+
void
ACE_New_Allocator::dump (void) const
{
#if defined (ACE_HAS_DUMP)
#endif /* ACE_HAS_DUMP */
}
+
/******************************************************************************/
+
void *
ACE_Static_Allocator_Base::malloc (size_t nbytes)
{
@@ -200,14 +242,17 @@ ACE_Static_Allocator_Base::malloc (size_t nbytes)
return (void *) ptr;
}
}
+
void *
ACE_Static_Allocator_Base::calloc (size_t nbytes,
char initial_value)
{
void *ptr = this->malloc (nbytes);
+
ACE_OS::memset (ptr, initial_value, nbytes);
return (void *) ptr;
}
+
void *
ACE_Static_Allocator_Base::calloc (size_t n_elem,
size_t elem_size,
@@ -215,6 +260,7 @@ ACE_Static_Allocator_Base::calloc (size_t n_elem,
{
return this->calloc (n_elem * elem_size, initial_value);
}
+
void
ACE_Static_Allocator_Base::free (void *ptr)
{
@@ -222,79 +268,95 @@ ACE_Static_Allocator_Base::free (void *ptr)
ACE_UNUSED_ARG (ptr);
ACE_ASSERT (ptr >= this->buffer_ && ptr < this->buffer_ + this->size_);
}
+
int
ACE_Static_Allocator_Base::remove (void)
{
return -1;
}
+
int
ACE_Static_Allocator_Base::bind (const char *, void *, int)
{
return -1;
}
+
int
ACE_Static_Allocator_Base::trybind (const char *, void *&)
{
return -1;
}
+
int
ACE_Static_Allocator_Base::find (const char *, void *&)
{
return -1;
}
+
int
ACE_Static_Allocator_Base::find (const char *)
{
return -1;
}
+
int
ACE_Static_Allocator_Base::unbind (const char *)
{
return -1;
}
+
int
ACE_Static_Allocator_Base::unbind (const char *, void *&)
{
return -1;
}
+
int
ACE_Static_Allocator_Base::sync (ssize_t, int)
{
return -1;
}
+
int
ACE_Static_Allocator_Base::sync (void *, size_t, int)
{
return -1;
}
+
int
ACE_Static_Allocator_Base::protect (ssize_t, int)
{
return -1;
}
+
int
ACE_Static_Allocator_Base::protect (void *, size_t, int)
{
return -1;
}
+
#if defined (ACE_HAS_MALLOC_STATS)
void
ACE_Static_Allocator_Base::print_stats (void) const
{
}
#endif /* ACE_HAS_MALLOC_STATS */
+
void
ACE_Static_Allocator_Base::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_Static_Allocator_Base::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\noffset_ = %d"), this->offset_));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nsize_ = %d\n"), this->size_));
ACE_HEX_DUMP ((LM_DEBUG, this->buffer_, this->size_));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n")));
+
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Malloc_Allocator.h b/dep/ACE_wrappers/ace/Malloc_Allocator.h
index dc66a8cce61..bd01df8e6a2 100644
--- a/dep/ACE_wrappers/ace/Malloc_Allocator.h
+++ b/dep/ACE_wrappers/ace/Malloc_Allocator.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file Malloc_Allocator.h
@@ -8,14 +9,20 @@
* @author Based on code that formerly existed in another ACE file.
*/
//==========================================================================
+
#ifndef ACE_MALLOC_ALLOCATOR_H
#define ACE_MALLOC_ALLOCATOR_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Malloc_Base.h"
+
#if defined (ACE_HAS_MALLOC_STATS)
#if defined (ACE_HAS_THREADS)
#include "ace/Process_Mutex.h"
@@ -24,8 +31,11 @@
#include "ace/SV_Semaphore_Simple.h"
#define ACE_PROCESS_MUTEX ACE_SV_Semaphore_Simple
#endif /* ACE_HAS_THREADS */
+
#endif /* ACE_HAS_MALLOC_STATS */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_New_Allocator
*
@@ -49,6 +59,7 @@ public:
virtual void *calloc (size_t nbytes, char initial_value = '\0');
virtual void *calloc (size_t n_elem, size_t elem_size, char initial_value = '\0');
virtual void free (void *ptr);
+
/// These methods are no-ops.
virtual int remove (void);
virtual int bind (const char *name, void *pointer, int duplicates = 0);
@@ -65,10 +76,12 @@ public:
virtual void print_stats (void) const;
#endif /* ACE_HAS_MALLOC_STATS */
virtual void dump (void) const;
+
private:
// DO NOT ADD ANY STATE (DATA MEMBERS) TO THIS CLASS!!!! See the
// <ACE_Allocator::instance> implementation for explanation.
};
+
/**
* @class ACE_Static_Allocator_Base
*
@@ -107,20 +120,28 @@ public:
virtual void print_stats (void) const;
#endif /* ACE_HAS_MALLOC_STATS */
virtual void dump (void) const;
+
protected:
/// Don't allow direct instantiations of this class.
ACE_Static_Allocator_Base (void);
+
/// Pointer to the buffer.
char *buffer_;
+
/// Size of the buffer.
size_t size_;
+
/// Pointer to the current offset in the <buffer_>.
size_t offset_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Malloc_Allocator.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
+
#endif /* MALLOC_ALLOCATOR_H */
diff --git a/dep/ACE_wrappers/ace/Malloc_Allocator.inl b/dep/ACE_wrappers/ace/Malloc_Allocator.inl
index 40e5a941a25..050d7353894 100644
--- a/dep/ACE_wrappers/ace/Malloc_Allocator.inl
+++ b/dep/ACE_wrappers/ace/Malloc_Allocator.inl
@@ -1,7 +1,9 @@
// -*- C++ -*-
//
// $Id: Malloc_Allocator.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_Static_Allocator_Base::ACE_Static_Allocator_Base (char * buffer,
size_t size)
@@ -10,4 +12,5 @@ ACE_Static_Allocator_Base::ACE_Static_Allocator_Base (char * buffer,
offset_ (0)
{
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Malloc_Base.h b/dep/ACE_wrappers/ace/Malloc_Base.h
index 81fd56d322a..7cd204064bb 100644
--- a/dep/ACE_wrappers/ace/Malloc_Base.h
+++ b/dep/ACE_wrappers/ace/Malloc_Base.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Malloc_Base.h
@@ -9,18 +10,25 @@
*/
//=============================================================================
+
#ifndef ACE_MALLOC_BASE_H
#define ACE_MALLOC_BASE_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/sys/os_types.h"
#include "ace/os_include/sys/os_mman.h"
#include "ace/os_include/sys/os_types.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// The definition of this class is located in Malloc.cpp.
+
/**
* @class ACE_Allocator
*
@@ -31,34 +39,48 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
class ACE_Export ACE_Allocator
{
public:
+
/// Unsigned integer type used for specifying memory block lengths.
typedef size_t size_type;
+
// = Memory Management
+
/// Get pointer to a default ACE_Allocator.
static ACE_Allocator *instance (void);
+
/// Set pointer to a process-wide ACE_Allocator and return existing
/// pointer.
static ACE_Allocator *instance (ACE_Allocator *);
+
/// Delete the dynamically allocated Singleton
static void close_singleton (void);
+
/// "No-op" constructor (needed to make certain compilers happy).
ACE_Allocator (void);
+
/// Virtual destructor
virtual ~ACE_Allocator (void);
+
/// Allocate @a nbytes, but don't give them any initial value.
virtual void *malloc (size_type nbytes) = 0;
+
/// Allocate @a nbytes, giving them @a initial_value.
virtual void *calloc (size_type nbytes, char initial_value = '\0') = 0;
+
/// Allocate <n_elem> each of size @a elem_size, giving them
/// @a initial_value.
virtual void *calloc (size_type n_elem,
size_type elem_size,
char initial_value = '\0') = 0;
+
/// Free <ptr> (must have been allocated by <ACE_Allocator::malloc>).
virtual void free (void *ptr) = 0;
+
/// Remove any resources associated with this memory manager.
virtual int remove (void) = 0;
+
// = Map manager like functions
+
/**
* Associate @a name with @a pointer. If @a duplicates == 0 then do
* not allow duplicate @a name/@a pointer associations, else if
@@ -69,6 +91,7 @@ public:
* returns -1 if a resource failure occurs.
*/
virtual int bind (const char *name, void *pointer, int duplicates = 0) = 0;
+
/**
* Associate @a name with @a pointer. Does not allow duplicate
* @a name/@a pointer associations. Returns 0 if successfully binds
@@ -80,52 +103,67 @@ public:
* the caller.
*/
virtual int trybind (const char *name, void *&pointer) = 0;
+
/// Locate @a name and pass out parameter via pointer. If found,
/// return 0, returns -1 if failure occurs.
virtual int find (const char *name, void *&pointer) = 0;
+
/// Returns 0 if the name is in the mapping. -1, otherwise.
virtual int find (const char *name) = 0;
+
/// Unbind (remove) the name from the map. Don't return the pointer
/// to the caller
virtual int unbind (const char *name) = 0;
+
/// Break any association of name. Returns the value of pointer in
/// case the caller needs to deallocate memory.
virtual int unbind (const char *name, void *&pointer) = 0;
+
// = Protection and "sync" (i.e., flushing memory to persistent
// backing store).
+
/**
* Sync @a len bytes of the memory region to the backing store
* starting at @c this->base_addr_. If @a len == -1 then sync the
* whole region.
*/
virtual int sync (ssize_t len = -1, int flags = MS_SYNC) = 0;
+
/// Sync @a len bytes of the memory region to the backing store
/// starting at @a addr.
virtual int sync (void *addr, size_type len, int flags = MS_SYNC) = 0;
+
/**
* Change the protection of the pages of the mapped region to @a prot
* starting at <this->base_addr_> up to @a len bytes. If @a len == -1
* then change protection of all pages in the mapped region.
*/
virtual int protect (ssize_t len = -1, int prot = PROT_RDWR) = 0;
+
/// Change the protection of the pages of the mapped region to @a prot
/// starting at @a addr up to @a len bytes.
virtual int protect (void *addr, size_type len, int prot = PROT_RDWR) = 0;
+
#if defined (ACE_HAS_MALLOC_STATS)
/// Dump statistics of how malloc is behaving.
virtual void print_stats (void) const = 0;
#endif /* ACE_HAS_MALLOC_STATS */
+
/// Dump the state of the object.
virtual void dump (void) const = 0;
private:
// DO NOT ADD ANY STATE (DATA MEMBERS) TO THIS CLASS!!!! See the
// <ACE_Allocator::instance> implementation for explanation.
+
/// Pointer to a process-wide ACE_Allocator instance.
static ACE_Allocator *allocator_;
+
/// Must delete the <allocator_> if non-0.
static int delete_allocator_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
#endif /* ACE_MALLOC_BASE_H */
diff --git a/dep/ACE_wrappers/ace/Malloc_T.h b/dep/ACE_wrappers/ace/Malloc_T.h
index 343bd54f910..ade2e37f9e4 100644
--- a/dep/ACE_wrappers/ace/Malloc_T.h
+++ b/dep/ACE_wrappers/ace/Malloc_T.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file Malloc_T.h
@@ -9,18 +10,24 @@
* Irfan Pyarali <irfan@cs.wustl.edu>
*/
//==========================================================================
+
#ifndef ACE_MALLOC_T_H
#define ACE_MALLOC_T_H
#include /**/ "ace/pre.h"
+
#include "ace/Malloc.h" /* Need ACE_Control_Block */
#include "ace/Malloc_Base.h" /* Need ACE_Allocator */
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Malloc_Allocator.h"
#include "ace/Free_List.h"
#include "ace/Guard_T.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Cached_Mem_Pool_Node
*
@@ -39,10 +46,13 @@ class ACE_Cached_Mem_Pool_Node
public:
/// Return the address of free memory.
T *addr (void);
+
/// Get the next ACE_Cached_Mem_Pool_Node in a list.
ACE_Cached_Mem_Pool_Node<T> *get_next (void);
+
/// Set the next ACE_Cached_Mem_Pool_Node.
void set_next (ACE_Cached_Mem_Pool_Node<T> *ptr);
+
private:
/**
* Since memory is not used when placed in a free list,
@@ -53,6 +63,7 @@ private:
*/
ACE_Cached_Mem_Pool_Node<T> *next_;
};
+
/**
* @class ACE_Cached_Allocator
*
@@ -77,8 +88,10 @@ public:
/// Create a cached memory pool with @a n_chunks chunks
/// each with sizeof (TYPE) size.
ACE_Cached_Allocator (size_t n_chunks);
+
/// Clear things up.
~ACE_Cached_Allocator (void);
+
/**
* Get a chunk of memory from free list cache. Note that @a nbytes is
* only checked to make sure that it's less or equal to sizeof T, and is
@@ -86,6 +99,7 @@ public:
* item of sizeof (T).
*/
void *malloc (size_t nbytes = sizeof (T));
+
/**
* Get a chunk of memory from free list cache, giving them
* @a initial_value. Note that @a nbytes is only checked to make sure
@@ -94,22 +108,28 @@ public:
*/
virtual void *calloc (size_t nbytes,
char initial_value = '\0');
+
/// This method is a no-op and just returns 0 since the free list
/// only works with fixed sized entities.
virtual void *calloc (size_t n_elem,
size_t elem_size,
char initial_value = '\0');
+
/// Return a chunk of memory back to free list cache.
void free (void *);
+
/// Return the number of chunks available in the cache.
size_t pool_depth (void);
+
private:
/// Remember how we allocate the memory in the first place so
/// we can clear things up later.
char *pool_;
+
/// Maintain a cached memory free list.
ACE_Locked_Free_List<ACE_Cached_Mem_Pool_Node<T>, ACE_LOCK> free_list_;
};
+
/**
* @class ACE_Dynamic_Cached_Allocator
*
@@ -133,8 +153,10 @@ public:
/// Create a cached memory pool with @a n_chunks chunks
/// each with @a chunk_size size.
ACE_Dynamic_Cached_Allocator (size_t n_chunks, size_t chunk_size);
+
/// Clear things up.
~ACE_Dynamic_Cached_Allocator (void);
+
/**
* Get a chunk of memory from free list cache. Note that @a nbytes is
* only checked to make sure that it's less or equal to @a chunk_size,
@@ -142,6 +164,7 @@ public:
* item of @a chunk_size size.
*/
void *malloc (size_t nbytes = 0);
+
/**
* Get a chunk of memory from free list cache, giving them
* @a initial_value. Note that @a nbytes is only checked to make sure
@@ -150,27 +173,34 @@ public:
*/
virtual void *calloc (size_t nbytes,
char initial_value = '\0');
+
/// This method is a no-op and just returns 0 since the free list
/// only works with fixed sized entities.
virtual void *calloc (size_t n_elem,
size_t elem_size,
char initial_value = '\0');
+
/// Return a chunk of memory back to free list cache.
void free (void *);
+
/// Return the number of chunks available in the cache.
size_t pool_depth (void);
+
private:
/// Remember how we allocate the memory in the first place so
/// we can clear things up later.
char *pool_;
+
/// Maintain a cached memory free list. We use @c char as template
/// parameter, although sizeof(char) is usually less than
/// sizeof(void*). Really important is that @a chunk_size
/// must be greater or equal to sizeof(void*).
ACE_Locked_Free_List<ACE_Cached_Mem_Pool_Node<char>, ACE_LOCK> free_list_;
+
/// Remember the size of our chunks.
size_t chunk_size_;
};
+
/**
* @class ACE_Allocator_Adapter
*
@@ -183,6 +213,7 @@ class ACE_Allocator_Adapter : public ACE_Allocator
public:
// Trait.
typedef MALLOC ALLOCATOR;
+
#if defined (ACE_HAS_TEMPLATE_TYPEDEFS)
// The following code will break C++ compilers that don't support
// template typedefs correctly.
@@ -190,12 +221,14 @@ public:
#else
typedef const void *MEMORY_POOL_OPTIONS;
#endif /* ACE_HAS_TEMPLATE_TYPEDEFS */
+
// = Initialization.
/**
* Note that @a pool_name should be located in
* a directory with the appropriate visibility and protection so
* that all processes that need to access it can do so. */
ACE_Allocator_Adapter (const char *pool_name = 0);
+
/**
* Note that @a pool_name should be located in
* a directory with the appropriate visibility and protection so
@@ -211,12 +244,14 @@ public:
{
ACE_TRACE ("ACE_Allocator_Adapter<MALLOC>::ACE_Allocator_Adapter");
}
+
#if defined (ACE_HAS_WCHAR)
/**
* Note that @a pool_name should be located in
* a directory with the appropriate visibility and protection so
* that all processes that need to access it can do so. */
ACE_Allocator_Adapter (const wchar_t *pool_name);
+
/**
* Note that @a pool_name should be located in
* a directory with the appropriate visibility and protection so
@@ -233,23 +268,32 @@ public:
ACE_TRACE ("ACE_Allocator_Adapter<MALLOC>::ACE_Allocator_Adapter");
}
#endif /* ACE_HAS_WCHAR */
+
/// Destructor.
virtual ~ACE_Allocator_Adapter (void);
+
// = Memory Management
+
/// Allocate @a nbytes, but don't give them any initial value.
virtual void *malloc (size_t nbytes);
+
/// Allocate @a nbytes, giving them all an @a initial_value.
virtual void *calloc (size_t nbytes, char initial_value = '\0');
+
/// Allocate @a n_elem each of size @a elem_size, giving them
/// @a initial_value.
virtual void *calloc (size_t n_elem,
size_t elem_size,
char initial_value = '\0');
+
/// Free @a ptr (must have been allocated by ACE_Allocator::malloc()).
virtual void free (void *ptr);
+
/// Remove any resources associated with this memory manager.
virtual int remove (void);
+
// = Map manager like functions
+
/**
* Associate @a name with @a pointer. If @a duplicates == 0 then do
* not allow duplicate @a name/pointer associations, else if
@@ -260,6 +304,7 @@ public:
* returns -1 if a resource failure occurs.
*/
virtual int bind (const char *name, void *pointer, int duplicates = 0);
+
/**
* Associate @a name with @a pointer. Does not allow duplicate
* name/pointer associations. Returns 0 if successfully binds
@@ -271,48 +316,62 @@ public:
* the caller.
*/
virtual int trybind (const char *name, void *&pointer);
+
/// Locate @a name and pass out parameter via pointer. If found,
/// return 0, returns -1 if @a name isn't found.
virtual int find (const char *name, void *&pointer);
+
/// Returns 0 if the name is in the mapping and -1 if not.
virtual int find (const char *name);
+
/// Unbind (remove) the name from the map. Don't return the pointer
/// to the caller
virtual int unbind (const char *name);
+
/// Break any association of name. Returns the value of pointer in
/// case the caller needs to deallocate memory.
virtual int unbind (const char *name, void *&pointer);
+
// = Protection and "sync" (i.e., flushing data to backing store).
+
/**
* Sync @a len bytes of the memory region to the backing store
* starting at @c this->base_addr_. If @a len == -1 then sync the
* whole region.
*/
virtual int sync (ssize_t len = -1, int flags = MS_SYNC);
+
/// Sync @a len bytes of the memory region to the backing store
/// starting at @c addr_.
virtual int sync (void *addr, size_t len, int flags = MS_SYNC);
+
/**
* Change the protection of the pages of the mapped region to @a prot
* starting at @c this->base_addr_ up to @a len bytes. If @a len == -1
* then change protection of all pages in the mapped region.
*/
virtual int protect (ssize_t len = -1, int prot = PROT_RDWR);
+
/// Change the protection of the pages of the mapped region to @a prot
/// starting at @a addr up to @a len bytes.
virtual int protect (void *addr, size_t len, int prot = PROT_RDWR);
+
/// Returns the underlying allocator.
ALLOCATOR &alloc (void);
+
#if defined (ACE_HAS_MALLOC_STATS)
/// Dump statistics of how malloc is behaving.
virtual void print_stats (void) const;
#endif /* ACE_HAS_MALLOC_STATS */
+
/// Dump the state of the object.
virtual void dump (void) const;
+
private:
/// ALLOCATOR instance, which is owned by the adapter.
ALLOCATOR allocator_;
};
+
/**
* @class ACE_Static_Allocator
*
@@ -333,18 +392,23 @@ public:
{
// This function <{must}> be inlined!!!
}
+
private:
/// Pool contents.
char pool_[POOL_SIZE];
};
+
// Forward declaration.
template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB>
class ACE_Malloc_LIFO_Iterator_T;
+
// Ensure backwards compatibility...
#define ACE_Malloc_Iterator ACE_Malloc_LIFO_Iterator
+
// Forward declaration.
template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB>
class ACE_Malloc_FIFO_Iterator_T;
+
/**
* @class ACE_Malloc_T
*
@@ -394,6 +458,7 @@ public:
typedef ACE_MEM_POOL_OPTIONS MEMORY_POOL_OPTIONS;
typedef typename ACE_CB::ACE_Name_Node NAME_NODE;
typedef typename ACE_CB::ACE_Malloc_Header MALLOC_HEADER;
+
// = Initialization and termination methods.
/**
* Initialize ACE_Malloc. This constructor passes @a pool_name to
@@ -406,6 +471,7 @@ public:
* that all processes that need to access it can do so.
*/
ACE_Malloc_T (const ACE_TCHAR *pool_name = 0);
+
/**
* Initialize ACE_Malloc. This constructor passes @a pool_name to
* initialize the memory pool, and uses @a lock_name to automatically
@@ -420,6 +486,7 @@ public:
ACE_Malloc_T (const ACE_TCHAR *pool_name,
const ACE_TCHAR *lock_name,
const ACE_MEM_POOL_OPTIONS *options = 0);
+
/**
* Initialize an ACE_Malloc with an external ACE_LOCK.
* This constructor passes @a pool_name and @a options to initialize
@@ -429,6 +496,7 @@ public:
ACE_Malloc_T (const ACE_TCHAR *pool_name,
const ACE_MEM_POOL_OPTIONS *options,
ACE_LOCK *lock);
+
#if !defined (ACE_HAS_TEMPLATE_TYPEDEFS)
/// This is necessary to work around template bugs with certain C++
/// compilers.
@@ -436,30 +504,42 @@ public:
const ACE_TCHAR *lock_name,
const void *options = 0);
#endif /* ACE_HAS_TEMPLATE_TYPEDEFS */
+
/// Destructor
~ACE_Malloc_T (void);
+
/// Get Reference counter.
int ref_counter (void);
+
/// Release ref counter.
int release (int close = 0);
+
/// Releases resources allocated by this object.
int remove (void);
+
// = Memory management
+
/// Allocate @a nbytes, but don't give them any initial value.
void *malloc (size_t nbytes);
+
/// Allocate @a nbytes, giving them @a initial_value.
void *calloc (size_t nbytes, char initial_value = '\0');
+
/// Allocate @a n_elem each of size @a elem_size, giving them
/// @a initial_value.
void *calloc (size_t n_elem,
size_t elem_size,
char initial_value = '\0');
+
/// Deallocate memory pointed to by @a ptr, which must have been
/// allocated previously by malloc().
void free (void *ptr);
+
/// Returns a reference to the underlying memory pool.
MEMORY_POOL &memory_pool (void);
+
// = Map manager like functions
+
/**
* Associate @a name with @a pointer. If @a duplicates == 0 then do
* not allow duplicate name/pointer associations, else if
@@ -470,6 +550,7 @@ public:
* returns -1 if a resource failure occurs.
*/
int bind (const char *name, void *pointer, int duplicates = 0);
+
/**
* Associate @a name with @a pointer. Does not allow duplicate
* name/pointer associations. Returns 0 if successfully binds
@@ -481,17 +562,21 @@ public:
* the caller.
*/
int trybind (const char *name, void *&pointer);
+
/// Locate @a name and pass out parameter via @a pointer. If found,
/// return 0, returns -1 if failure occurs.
int find (const char *name, void *&pointer);
+
/// Returns 0 if @a name is in the mapping. -1, otherwise.
int find (const char *name);
+
/**
* Unbind (remove) the name from the map. Don't return the pointer
* to the caller. If you want to remove all occurrences of @a name
* you'll need to call this method multiple times until it fails...
*/
int unbind (const char *name);
+
/**
* Unbind (remove) one association of @a name to @a pointer. Returns
* the value of pointer in case the caller needs to deallocate
@@ -499,25 +584,31 @@ public:
* need to call this method multiple times until it fails...
*/
int unbind (const char *name, void *&pointer);
+
// = Protection and "sync" (i.e., flushing data to backing store).
+
/**
* Sync @a len bytes of the memory region to the backing store
* starting at @c this->base_addr_. If @a len == -1 then sync the
* whole region.
*/
int sync (ssize_t len = -1, int flags = MS_SYNC);
+
/// Sync @a len bytes of the memory region to the backing store
/// starting at @c addr_.
int sync (void *addr, size_t len, int flags = MS_SYNC);
+
/**
* Change the protection of the pages of the mapped region to @a prot
* starting at @c this->base_addr_ up to @a len bytes. If @a len == -1
* then change protection of all pages in the mapped region.
*/
int protect (ssize_t len = -1, int prot = PROT_RDWR);
+
/// Change the protection of the pages of the mapped region to @a prot
/// starting at @a addr up to @a len bytes.
int protect (void *addr, size_t len, int prot = PROT_RDWR);
+
/**
* Returns a count of the number of available chunks that can hold
* @a size byte allocations. Function can be used to determine if you
@@ -529,19 +620,25 @@ public:
* that would fit in the currently allocated memory.
*/
ssize_t avail_chunks (size_t size) const;
+
#if defined (ACE_HAS_MALLOC_STATS)
/// Dump statistics of how malloc is behaving.
void print_stats (void) const;
#endif /* ACE_HAS_MALLOC_STATS */
+
/// Returns a pointer to the lock used to provide mutual exclusion to
/// an ACE_Malloc allocator.
ACE_LOCK &mutex (void);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
/// Return cb_ptr value.
void *base_addr (void);
+
/**
* Bad flag. This operation should be called immediately after the
* construction of the Malloc object to query whether the object was
@@ -551,13 +648,16 @@ public:
* unuable.
*/
int bad (void);
+
private:
/// Initialize the Malloc pool.
int open (void);
+
/// Associate @a name with @a pointer. Assumes that locks are held by
/// callers.
int shared_bind (const char *name,
void *pointer);
+
/**
* Try to locate @a name. If found, return the associated
* ACE_Name_Node, else returns 0 if can't find the @a name.
@@ -565,23 +665,32 @@ private:
* return value to ACE_CB::ACE_Name_Node*.
*/
void *shared_find (const char *name);
+
/// Allocate memory. Assumes that locks are held by callers.
void *shared_malloc (size_t nbytes);
+
/// Deallocate memory. Assumes that locks are held by callers.
void shared_free (void *ptr);
+
/// Pointer to the control block that is stored in memory controlled
/// by <MEMORY_POOL>.
ACE_CB *cb_ptr_;
+
/// Pool of memory used by ACE_Malloc to manage its freestore.
MEMORY_POOL memory_pool_;
+
/// Lock that ensures mutual exclusion for the memory pool.
ACE_LOCK *lock_;
+
/// True if destructor should delete the lock
bool delete_lock_;
+
/// Keep track of failure in constructor.
int bad_flag_;
};
+
/*****************************************************************************/
+
/**
* @class ACE_Malloc_Lock_Adapter_T
*
@@ -596,6 +705,7 @@ private:
*
*/
/*****************************************************************************/
+
/**
* @class ACE_Malloc_LIFO_Iterator_T
*
@@ -613,19 +723,25 @@ class ACE_Malloc_LIFO_Iterator_T
public:
typedef typename ACE_CB::ACE_Name_Node NAME_NODE;
typedef typename ACE_CB::ACE_Malloc_Header MALLOC_HEADER;
+
// = Initialization method.
/// If @a name = 0 it will iterate through everything else only
/// through those entries whose @a name match.
ACE_Malloc_LIFO_Iterator_T (ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB> &malloc,
const char *name = 0);
+
/// Destructor.
~ACE_Malloc_LIFO_Iterator_T (void);
+
// = Iteration methods.
+
/// Returns 1 when all items have been seen, else 0.
int done (void) const;
+
/// Pass back the next entry in the set that hasn't yet been
/// visited. Returns 0 when all items have been seen, else 1.
int next (void *&next_entry);
+
/**
* Pass back the next entry (and the name associated with it) in
* the set that hasn't yet been visited. Returns 0 when all items
@@ -633,23 +749,31 @@ public:
*/
int next (void *&next_entry,
const char *&name);
+
/// Move forward by one element in the set. Returns 0 when all the
/// items in the set have been seen, else 1.
int advance (void);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Malloc we are iterating over.
ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB> &malloc_;
+
/// Keeps track of how far we've advanced...
NAME_NODE *curr_;
+
/// Lock Malloc for the lifetime of the iterator.
ACE_Read_Guard<ACE_LOCK> guard_;
+
/// Name that we are searching for.
const char *name_;
};
+
/**
* @class ACE_Malloc_FIFO_Iterator_T
*
@@ -667,19 +791,25 @@ class ACE_Malloc_FIFO_Iterator_T
public:
typedef typename ACE_CB::ACE_Name_Node NAME_NODE;
typedef typename ACE_CB::ACE_Malloc_Header MALLOC_HEADER;
+
// = Initialization method.
/// If @a name = 0 it will iterate through everything else only
/// through those entries whose @a name match.
ACE_Malloc_FIFO_Iterator_T (ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB> &malloc,
const char *name = 0);
+
/// Destructor.
~ACE_Malloc_FIFO_Iterator_T (void);
+
// = Iteration methods.
+
/// Returns 1 when all items have been seen, else 0.
int done (void) const;
+
/// Pass back the next entry in the set that hasn't yet been
/// visited. Returns 0 when all items have been seen, else 1.
int next (void *&next_entry);
+
/**
* Pass back the next entry (and the name associated with it) in
* the set that hasn't yet been visited. Returns 0 when all items
@@ -687,26 +817,35 @@ public:
*/
int next (void *&next_entry,
const char *&name);
+
/// Move forward by one element in the set. Returns 0 when all the
/// items in the set have been seen, else 1.
int advance (void);
+
/// Go to the starting element that was inserted first. Returns 0
/// when there is no item in the set, else 1.
int start (void);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Malloc we are iterating over.
ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB> &malloc_;
+
/// Keeps track of how far we've advanced...
NAME_NODE *curr_;
+
/// Lock Malloc for the lifetime of the iterator.
ACE_Read_Guard<ACE_LOCK> guard_;
+
/// Name that we are searching for.
const char *name_;
};
+
template <ACE_MEM_POOL_1, class ACE_LOCK>
class ACE_Malloc : public ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_Control_Block>
{
@@ -721,6 +860,7 @@ public:
* that all processes that need to access it can do so.
*/
ACE_Malloc (const ACE_TCHAR *pool_name = 0);
+
/**
* Initialize ACE_Malloc. This constructor passes @a pool_name to
* initialize the memory pool, and uses @a lock_name to automatically
@@ -734,6 +874,7 @@ public:
ACE_Malloc (const ACE_TCHAR *pool_name,
const ACE_TCHAR *lock_name,
const ACE_MEM_POOL_OPTIONS *options = 0);
+
#if !defined (ACE_HAS_TEMPLATE_TYPEDEFS)
/// This is necessary to work around template bugs with certain C++
/// compilers.
@@ -742,6 +883,7 @@ public:
const void *options = 0);
#endif /* ACE_HAS_TEMPLATE_TYPEDEFS */
};
+
template <ACE_MEM_POOL_1, class ACE_LOCK>
class ACE_Malloc_LIFO_Iterator : public ACE_Malloc_LIFO_Iterator_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_Control_Block>
{
@@ -752,6 +894,7 @@ public:
ACE_Malloc_LIFO_Iterator (ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK> &malloc,
const char *name = 0);
};
+
template <ACE_MEM_POOL_1, class ACE_LOCK>
class ACE_Malloc_FIFO_Iterator : public ACE_Malloc_FIFO_Iterator_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_Control_Block>
{
@@ -762,22 +905,28 @@ public:
ACE_Malloc_FIFO_Iterator (ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK> &malloc,
const char *name = 0);
};
+
template <class ACE_LOCK>
class ACE_Malloc_Lock_Adapter_T
{
public:
ACE_LOCK * operator () (const ACE_TCHAR *myname);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Malloc_T.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Malloc_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Malloc_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
#endif /* ACE_MALLOC_H */
diff --git a/dep/ACE_wrappers/ace/Malloc_T.inl b/dep/ACE_wrappers/ace/Malloc_T.inl
index 4db8c5a3449..46f6c0c146b 100644
--- a/dep/ACE_wrappers/ace/Malloc_T.inl
+++ b/dep/ACE_wrappers/ace/Malloc_T.inl
@@ -1,8 +1,11 @@
// -*- C++ -*-
//
// $Id: Malloc_T.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_string.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template <class T> ACE_INLINE T *
ACE_Cached_Mem_Pool_Node<T>::addr (void)
{
@@ -11,39 +14,47 @@ ACE_Cached_Mem_Pool_Node<T>::addr (void)
// types).
return static_cast<T *> (static_cast <void *> (this));
}
+
template <class T> ACE_INLINE ACE_Cached_Mem_Pool_Node<T> *
ACE_Cached_Mem_Pool_Node<T>::get_next (void)
{
return this->next_;
}
+
template <class T> ACE_INLINE void
ACE_Cached_Mem_Pool_Node<T>::set_next (ACE_Cached_Mem_Pool_Node<T> *ptr)
{
this->next_ = ptr;
}
+
template <class T, class ACE_LOCK> ACE_INLINE size_t
ACE_Cached_Allocator<T, ACE_LOCK>::pool_depth (void)
{
return this->free_list_.size ();
}
+
template <class ACE_LOCK> ACE_INLINE size_t
ACE_Dynamic_Cached_Allocator<ACE_LOCK>::pool_depth (void)
{
return this->free_list_.size ();
}
+
template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> ACE_INLINE int
ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::ref_counter (void)
{
ACE_GUARD_RETURN (ACE_LOCK, ace_mon, *this->lock_, -1);
if (this->cb_ptr_ != 0)
return this->cb_ptr_->ref_counter_;
+
return -1;
}
+
template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> ACE_INLINE int
ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::bad (void)
{
return this->bad_flag_;
}
+
template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> ACE_INLINE int
ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::release (int close)
{
@@ -51,24 +62,28 @@ ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::release (int close)
if (this->cb_ptr_ != 0)
{
int const retv = --this->cb_ptr_->ref_counter_;
+
#if 0
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P) ACE_Malloc_T::release ->%d\n"),
this->cb_ptr_->ref_counter_ - 1));
#endif /* 0 */
if (close)
this->memory_pool_.release (0);
+
if (retv == 0)
this->remove ();
return retv;
}
return -1;
}
+
template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> ACE_INLINE ACE_MEM_POOL &
ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::memory_pool (void)
{
ACE_TRACE ("ACE_Malloc_T<MEMORY_POOL, ACE_LOCK, ACE_CB>::memory_pool");
return this->memory_pool_;
}
+
template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> ACE_INLINE int
ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::sync (ssize_t len,
int flags)
@@ -76,6 +91,7 @@ ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::sync (ssize_t len,
ACE_TRACE ("ACE_Malloc_T<MEMORY_POOL, ACE_LOCK, ACE_CB>::sync");
return this->memory_pool_.sync (len, flags);
}
+
template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> ACE_INLINE int
ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::sync (void *addr,
size_t len,
@@ -84,6 +100,7 @@ ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::sync (void *addr,
ACE_TRACE ("ACE_Malloc_T<MEMORY_POOL, ACE_LOCK, ACE_CB>::sync");
return this->memory_pool_.sync (addr, len, flags);
}
+
template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> ACE_INLINE int
ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::protect (ssize_t len,
int flags)
@@ -91,6 +108,7 @@ ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::protect (ssize_t len,
ACE_TRACE ("ACE_Malloc_T<MEMORY_POOL, ACE_LOCK, ACE_CB>::protect");
return this->memory_pool_.protect (len, flags);
}
+
template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> ACE_INLINE int
ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::protect (void *addr,
size_t len,
@@ -99,21 +117,25 @@ ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::protect (void *addr,
ACE_TRACE ("ACE_Malloc_T<MEMORY_POOL, ACE_LOCK, ACE_CB>::protect");
return this->memory_pool_.protect (addr, len, flags);
}
+
template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> ACE_INLINE ACE_LOCK &
ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::mutex (void)
{
return *this->lock_;
}
+
template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> ACE_INLINE void *
ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::base_addr (void)
{
return this->cb_ptr_;
}
+
template <ACE_MEM_POOL_1, class ACE_LOCK> ACE_INLINE
ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::ACE_Malloc (const ACE_TCHAR *pool_name)
: ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_Control_Block> (pool_name)
{
}
+
template <ACE_MEM_POOL_1, class ACE_LOCK> ACE_INLINE
ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::ACE_Malloc (const ACE_TCHAR *pool_name,
const ACE_TCHAR *lock_name,
@@ -121,6 +143,7 @@ ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::ACE_Malloc (const ACE_TCHAR *pool_name,
: ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_Control_Block> (pool_name, lock_name, options)
{
}
+
#if !defined (ACE_HAS_TEMPLATE_TYPEDEFS)
template <ACE_MEM_POOL_1, class ACE_LOCK> ACE_INLINE
ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::ACE_Malloc (const ACE_TCHAR *pool_name,
@@ -130,12 +153,14 @@ ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::ACE_Malloc (const ACE_TCHAR *pool_name,
{
}
#endif /* !ACE_HAS_TEMPLATE_TYPEDEFS */
+
template <ACE_MEM_POOL_1, class ACE_LOCK> ACE_INLINE
ACE_Malloc_LIFO_Iterator<ACE_MEM_POOL_2, ACE_LOCK>::ACE_Malloc_LIFO_Iterator (ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK> &malloc,
const char *name)
: ACE_Malloc_LIFO_Iterator_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_Control_Block> (malloc, name)
{
}
+
template <ACE_MEM_POOL_1, class ACE_LOCK> ACE_INLINE
ACE_Malloc_FIFO_Iterator<ACE_MEM_POOL_2, ACE_LOCK>::ACE_Malloc_FIFO_Iterator (ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK> &malloc,
const char *name)
@@ -143,6 +168,7 @@ ACE_Malloc_FIFO_Iterator<ACE_MEM_POOL_2, ACE_LOCK>::ACE_Malloc_FIFO_Iterator (AC
{
}
+
#if 0
template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> ACE_INLINE void
ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::init_malloc_header_ptr (void* ptr)
@@ -154,4 +180,5 @@ ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::init_malloc_header_ptr (void* pt
#endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */
}
#endif /* 0 */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Managed_Object.h b/dep/ACE_wrappers/ace/Managed_Object.h
index 3c67713ae1d..f4ac54834d4 100644
--- a/dep/ACE_wrappers/ace/Managed_Object.h
+++ b/dep/ACE_wrappers/ace/Managed_Object.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Managed_Object.h
@@ -8,16 +9,23 @@
* @author David L. Levine <levine@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_MANAGED_OBJECT_H
#define ACE_MANAGED_OBJECT_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Object_Manager.h"
#include "ace/Global_Macros.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Cleanup_Adapter
*
@@ -37,16 +45,21 @@ class ACE_Cleanup_Adapter : public ACE_Cleanup
public:
/// Default constructor.
ACE_Cleanup_Adapter (void);
+
/// Virtual destructor, needed by some compilers for vtable placement.
virtual ~ACE_Cleanup_Adapter (void);
+
/// Accessor for contained object.
TYPE &object (void);
+
private:
ACE_UNIMPLEMENTED_FUNC (ACE_Cleanup_Adapter (const ACE_Cleanup_Adapter<TYPE> &))
ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Cleanup_Adapter<TYPE> &))
+
/// Contained object.
TYPE object_;
};
+
/**
* @class ACE_Managed_Object
*
@@ -95,6 +108,7 @@ public:
// that this function doesn't need a lock. Also, because it is
// intended _only_ for use with hard-code values, it performs no
// range checking on "id".
+
// Cast the return type of the the object pointer based
// on the type of the function template parameter.
return &((ACE_Cleanup_Adapter<TYPE> *)
@@ -105,12 +119,14 @@ public:
// because it can _only_ be used for accessing preallocated objects.
// @note The function definition is inlined here so that it compiles
// on AIX 4.1 w/xlC v. 3.01.
+
static TYPE *get_preallocated_array (ACE_Object_Manager::Preallocated_Array identifier)
{
// The preallocated array are in a separate, "read-only" array so
// that this function doesn't need a lock. Also, because it is
// intended _only_ for use with hard-code values, it performs no
// range checking on "id".
+
// Cast the return type of the the object pointer based
// on the type of the function template parameter.
return &((ACE_Cleanup_Adapter<TYPE> *)
@@ -121,23 +137,33 @@ public:
// because it can _only_ be used for accessing preallocated arrays.
// @note The function definition is inlined here so that it compiles
// on AIX 4.1 w/xlC v. 3.01.
+
protected:
+
// Disallow instantiation of this class.
ACE_UNIMPLEMENTED_FUNC (ACE_Managed_Object (void))
+
private:
+
ACE_UNIMPLEMENTED_FUNC (ACE_Managed_Object (const ACE_Managed_Object<TYPE> &))
ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Managed_Object<TYPE> &))
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Managed_Object.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Managed_Object.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Managed_Object.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_MANAGED_OBJECT_H */
diff --git a/dep/ACE_wrappers/ace/Managed_Object.inl b/dep/ACE_wrappers/ace/Managed_Object.inl
index b6101c94c81..2e77a1c4ed6 100644
--- a/dep/ACE_wrappers/ace/Managed_Object.inl
+++ b/dep/ACE_wrappers/ace/Managed_Object.inl
@@ -1,7 +1,9 @@
// -*- C++ -*-
//
// $Id: Managed_Object.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template <class TYPE>
ACE_INLINE
ACE_Cleanup_Adapter<TYPE>::ACE_Cleanup_Adapter (void)
@@ -9,6 +11,7 @@ ACE_Cleanup_Adapter<TYPE>::ACE_Cleanup_Adapter (void)
// have a default constructor. Let the compiler figure it out . . .
{
}
+
template <class TYPE>
ACE_INLINE
TYPE &
@@ -16,4 +19,5 @@ ACE_Cleanup_Adapter<TYPE>::object (void)
{
return this->object_;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Manual_Event.cpp b/dep/ACE_wrappers/ace/Manual_Event.cpp
index 90c91c0a2d7..33183c53f4d 100644
--- a/dep/ACE_wrappers/ace/Manual_Event.cpp
+++ b/dep/ACE_wrappers/ace/Manual_Event.cpp
@@ -1,11 +1,16 @@
// $Id: Manual_Event.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Manual_Event.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Manual_Event.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace, Manual_Event, "$Id: Manual_Event.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_Manual_Event::ACE_Manual_Event (int initial_state,
int type,
const char *name,
@@ -17,6 +22,7 @@ ACE_Manual_Event::ACE_Manual_Event (int initial_state,
arg)
{
}
+
#if defined (ACE_HAS_WCHAR)
ACE_Manual_Event::ACE_Manual_Event (int initial_state,
int type,
@@ -30,6 +36,7 @@ ACE_Manual_Event::ACE_Manual_Event (int initial_state,
{
}
#endif /* ACE_HAS_WCHAR */
+
void
ACE_Manual_Event::dump (void) const
{
@@ -37,5 +44,6 @@ ACE_Manual_Event::dump (void) const
ACE_Event::dump ();
#endif /* ACE_HAS_DUMP */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Manual_Event.h b/dep/ACE_wrappers/ace/Manual_Event.h
index fb0fc99dfb9..6a46535e6c5 100644
--- a/dep/ACE_wrappers/ace/Manual_Event.h
+++ b/dep/ACE_wrappers/ace/Manual_Event.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file Manual_Event.h
@@ -10,15 +11,21 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//==========================================================================
+
#ifndef ACE_MANUAL_EVENT_H
#define ACE_MANUAL_EVENT_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Event.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Manual_Event
*
@@ -37,6 +44,7 @@ public:
int type = USYNC_THREAD,
const char *name = 0,
void *arg = 0);
+
#if defined (ACE_HAS_WCHAR)
/// constructor which will create manual event (wchar_t version)
ACE_Manual_Event (int initial_state,
@@ -44,18 +52,24 @@ public:
const wchar_t *name,
void *arg = 0);
#endif /* ACE_HAS_WCHAR */
+
/// Default dtor.
~ACE_Manual_Event (void);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks
ACE_ALLOC_HOOK_DECLARE;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Manual_Event.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_MANUAL_EVENT_H */
diff --git a/dep/ACE_wrappers/ace/Manual_Event.inl b/dep/ACE_wrappers/ace/Manual_Event.inl
index 0b09964a751..9872973f4ba 100644
--- a/dep/ACE_wrappers/ace/Manual_Event.inl
+++ b/dep/ACE_wrappers/ace/Manual_Event.inl
@@ -1,9 +1,12 @@
// -*- C++ -*-
//
// $Id: Manual_Event.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_Manual_Event::~ACE_Manual_Event (void)
{
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Map.h b/dep/ACE_wrappers/ace/Map.h
index 0cfc5d57fdf..2ea515fd2dc 100644
--- a/dep/ACE_wrappers/ace/Map.h
+++ b/dep/ACE_wrappers/ace/Map.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Map.h
@@ -11,15 +12,22 @@
*/
//=============================================================================
+
#ifndef ACE_MAP_H
#define ACE_MAP_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
// Include the templates here.
#include "ace/Map_T.h"
+
#include /**/ "ace/post.h"
+
#endif /* ACE_MAP_H */
diff --git a/dep/ACE_wrappers/ace/Map_Manager.h b/dep/ACE_wrappers/ace/Map_Manager.h
index fc89c4a7fc8..b6e141621fa 100644
--- a/dep/ACE_wrappers/ace/Map_Manager.h
+++ b/dep/ACE_wrappers/ace/Map_Manager.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Map_Manager.h
@@ -8,19 +9,27 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_MAP_MANAGER_H
#define ACE_MAP_MANAGER_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Basic_Types.h"
#include "ace/Global_Macros.h"
#include "ace/Default_Constants.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward declaration.
class ACE_Allocator;
+
/**
* @class ACE_Map_Entry
*
@@ -32,51 +41,73 @@ class ACE_Map_Entry
public:
/// Initialize member variables.
ACE_Map_Entry (void);
+
/// We need this destructor to keep some compilers from complaining.
/// It's just a no-op, however.
~ACE_Map_Entry (void);
+
/// Key used to look up an entry.
EXT_ID ext_id_;
+
/// The contents of the entry itself.
INT_ID int_id_;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
// = These are really private, but unfortunately template friends
// are not portable.
+
/// Get next entry.
ACE_UINT32 next (void) const;
+
/// Set next entry.
void next (ACE_UINT32 n);
+
/// Get prev entry.
ACE_UINT32 prev (void) const;
+
/// Set prev entry.
void prev (ACE_UINT32 p);
+
/// Keeps track of the next entry.
ACE_UINT32 next_;
+
/// Keeps track of the previous entry.
ACE_UINT32 prev_;
+
#if defined (ACE_HAS_LAZY_MAP_MANAGER)
+
/// Is this entry free?
bool free_;
+
#endif /* ACE_HAS_LAZY_MAP_MANAGER */
+
};
+
// Forward decl.
template <class EXT_ID, class INT_ID, class ACE_LOCK>
class ACE_Map_Iterator_Base;
+
// Forward decl.
template <class EXT_ID, class INT_ID, class ACE_LOCK>
class ACE_Map_Const_Iterator_Base;
+
// Forward decl.
template <class EXT_ID, class INT_ID, class ACE_LOCK>
class ACE_Map_Iterator;
+
// Forward decl.
template <class EXT_ID, class INT_ID, class ACE_LOCK>
class ACE_Map_Const_Iterator;
+
// Forward decl.
template <class EXT_ID, class INT_ID, class ACE_LOCK>
class ACE_Map_Reverse_Iterator;
+
/**
* @class ACE_Map_Manager
*
@@ -102,6 +133,7 @@ public:
friend class ACE_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK>;
friend class ACE_Map_Const_Iterator<EXT_ID, INT_ID, ACE_LOCK>;
friend class ACE_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK>;
+
// = Traits.
typedef EXT_ID KEY;
typedef INT_ID VALUE;
@@ -110,24 +142,31 @@ public:
typedef ACE_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK> ITERATOR;
typedef ACE_Map_Const_Iterator<EXT_ID, INT_ID, ACE_LOCK> CONST_ITERATOR;
typedef ACE_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK> REVERSE_ITERATOR;
+
typedef ACE_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK> iterator;
typedef ACE_Map_Const_Iterator<EXT_ID, INT_ID, ACE_LOCK> const_iterator;
typedef ACE_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK> reverse_iterator;
+
// = Initialization and termination methods.
/// Initialize a ACE_Map_Manager with the ACE_DEFAULT_MAP_SIZE.
ACE_Map_Manager (ACE_Allocator *alloc = 0);
+
/// Initialize a ACE_Map_Manager with @a size entries.
ACE_Map_Manager (size_t size,
ACE_Allocator *alloc = 0);
+
/// Initialize a ACE_Map_Manager with size @a length.
int open (size_t length = ACE_DEFAULT_MAP_SIZE,
ACE_Allocator *alloc = 0);
+
/// Close down a ACE_Map_Manager and release dynamically allocated
/// resources.
int close (void);
+
/// Close down a ACE_Map_Manager and release dynamically allocated
/// resources.
~ACE_Map_Manager (void);
+
/**
* Associate @a ext_id with @a int_id. If @a ext_id is already in the
* map then the ACE_Map_Entry is not changed.
@@ -137,6 +176,7 @@ public:
*/
int bind (const EXT_ID &ext_id,
const INT_ID &int_id);
+
/**
* Reassociate @a ext_id with @a int_id. If @a ext_id is not in the
* map then behaves just like bind(). Otherwise, store the old
@@ -152,6 +192,7 @@ public:
const INT_ID &int_id,
EXT_ID &old_ext_id,
INT_ID &old_int_id);
+
/**
* Reassociate @a ext_id with @a int_id. If @a ext_id is not in the
* map then behaves just like <bind>. Otherwise, store the old
@@ -164,10 +205,12 @@ public:
int rebind (const EXT_ID &ext_id,
const INT_ID &int_id,
INT_ID &old_int_id);
+
/// Reassociate @a ext_id with @a int_id. Old values in the map are
/// ignored.
int rebind (const EXT_ID &ext_id,
const INT_ID &int_id);
+
/**
* Associate @a ext_id with @a int_id if and only if @a ext_id is not
* in the map. If @a ext_id is already in the map then the @a int_id
@@ -178,6 +221,7 @@ public:
*/
int trybind (const EXT_ID &ext_id,
INT_ID &int_id);
+
/**
* Locate @a ext_id and pass out parameter via @a int_id.
* @retval 0 If found.
@@ -185,8 +229,10 @@ public:
*/
int find (const EXT_ID &ext_id,
INT_ID &int_id) const;
+
/// Returns 0 if the @a ext_id is in the mapping, otherwise -1.
int find (const EXT_ID &ext_id) const;
+
/**
* Unbind (remove) the @a ext_id from the map. Don't return the
* @a int_id to the caller (this is useful for collections where the
@@ -194,6 +240,7 @@ public:
* successful, else -1.
*/
int unbind (const EXT_ID &ext_id);
+
/**
* Break any association of @a ext_id. Returns the value of @a int_id
* in case the caller needs to deallocate memory. Returns 0 if
@@ -201,14 +248,18 @@ public:
*/
int unbind (const EXT_ID &ext_id,
INT_ID &int_id);
+
/**
* Unbind all entires.
*/
void unbind_all (void);
+
/// Return the current size of the map.
size_t current_size (void) const;
+
/// Return the total size of the map.
size_t total_size (void) const;
+
/**
* Returns a reference to the underlying <ACE_LOCK>. This makes it
* possible to acquire the lock explicitly, which can be useful in
@@ -218,93 +269,125 @@ public:
* @note The right name would be <lock>, but HP/C++ will choke on that!
*/
ACE_LOCK &mutex (void);
+
/// Dump the state of an object.
void dump (void) const;
+
// = STL styled iterator factory functions.
+
/// Return forward iterator.
ACE_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK> begin (void);
ACE_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK> end (void);
+
/// Return reverse iterator.
ACE_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK> rbegin (void);
ACE_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK> rend (void);
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
+
// = The following methods do the actual work.
+
// These methods assume that the locks are held by the private
// methods.
+
/// Performs the binding of @a ext_id to @a int_id. Must be called
/// with locks held.
int bind_i (const EXT_ID &ext_id,
const INT_ID &int_id);
+
/// Bind an entry (without finding first). Must be called with locks
/// held.
int shared_bind (const EXT_ID &ext_id,
const INT_ID &int_id);
+
/// Performs a rebinding of <ext_it> to @a int_id. Also, recovers old
/// values. Must be called with locks held.
int rebind_i (const EXT_ID &ext_id,
const INT_ID &int_id,
EXT_ID &old_ext_id,
INT_ID &old_int_id);
+
/// Performs a rebinding of <ext_it> to @a int_id. Also, recovers old
/// values. Must be called with locks held.
int rebind_i (const EXT_ID &ext_id,
const INT_ID &int_id,
INT_ID &old_int_id);
+
/// Performs a rebinding of <ext_it> to @a int_id. Must be called
/// with locks held.
int rebind_i (const EXT_ID &ext_id,
const INT_ID &int_id);
+
/// Performs a conditional bind of @a int_id using @a ext_id as the
/// key. Must be called with locks held.
int trybind_i (const EXT_ID &ext_id,
INT_ID &int_id);
+
/// Performs a find of @a int_id using @a ext_id as the key. Must be
/// called with locks held.
int find_i (const EXT_ID &ext_id,
INT_ID &int_id);
+
/// Performs a find using @a ext_id as the key. Must be called with
/// locks held.
int find_and_return_index (const EXT_ID &ext_id,
ACE_UINT32 &slot);
+
/// Performs an unbind of @a int_id using @a ext_id as the key. Must
/// be called with locks held.
int unbind_i (const EXT_ID &ext_id,
INT_ID &int_id);
+
/// Performs an unbind using @a ext_id as the key. Must be called
/// with locks held.
int unbind_i (const EXT_ID &ext_id);
+
/// Performs an unbind using @a ext_id as the key. Must be called
/// with locks held.
int unbind_and_return_index (const EXT_ID &ext_id,
ACE_UINT32 &slot);
+
/// Unbind @a slot.
void unbind_slot (ACE_UINT32 slot);
+
/// Resize the map. Must be called with locks held.
int resize_i (ACE_UINT32 size);
+
/// Close down a <Map_Manager>. Must be called with locks held.
int close_i (void);
+
/// Returns 1 if <id1> == <id2>, else 0. This is defined as a
/// separate method to facilitate template specialization.
int equal (const EXT_ID &id1, const EXT_ID &id2);
+
/// This function returns the new size of the Map Manager. This
/// function is called when we run out of room and need to resize.
ACE_UINT32 new_size (void);
+
/// Explicitly call the destructors and free up the
/// <search_structure_>.
void free_search_structure (void);
+
/// Id of the free list sentinel.
ACE_UINT32 free_list_id (void) const;
+
/// Id of the occupied list sentinel.
ACE_UINT32 occupied_list_id (void) const;
+
/// Finds the next free slot.
int next_free (ACE_UINT32 &slot);
+
/// Move from free list to occupied list.
void move_from_free_list_to_occupied_list (ACE_UINT32 slot);
+
/// Move from occupied list to free list.
void move_from_occupied_list_to_free_list (ACE_UINT32 slot);
+
#if defined (ACE_HAS_LAZY_MAP_MANAGER)
+
/**
* In the case of lazy map managers, the movement of free slots from
* the occupied list to the free list is delayed until we run out of
@@ -312,39 +395,52 @@ protected:
* entire occupied list, moving free slots to the free list.
*/
void move_all_free_slots_from_occupied_list (void);
+
#endif /* ACE_HAS_LAZY_MAP_MANAGER */
+
/// Move helper.
void shared_move (ACE_UINT32 slot,
ACE_Map_Entry<EXT_ID, INT_ID> &current_list,
ACE_UINT32 current_list_id,
ACE_Map_Entry<EXT_ID, INT_ID> &new_list,
ACE_UINT32 new_list_id);
+
/// Pointer to a memory allocator.
ACE_Allocator *allocator_;
+
/// Synchronization variable for the MT_SAFE ACE_Map_Manager.
mutable ACE_LOCK lock_;
+
/// Implement the Map as a resizeable array of ACE_Map_Entry.
ACE_Map_Entry<EXT_ID, INT_ID> *search_structure_;
+
/// Total number of elements in this->search_structure_.
ACE_UINT32 total_size_;
+
/// Current size of the map.
ACE_UINT32 cur_size_;
+
/// Free list.
ACE_Map_Entry<EXT_ID, INT_ID> free_list_;
+
/// Occupied list.
ACE_Map_Entry<EXT_ID, INT_ID> occupied_list_;
+
enum
{
/// Grow map exponentially up to 64K
MAX_EXPONENTIAL = 64 * 1024,
+
/// Afterwards grow in chunks of 32K
LINEAR_INCREASE = 32 * 1024
};
+
private:
// = Disallow these operations.
ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK> &))
ACE_UNIMPLEMENTED_FUNC (ACE_Map_Manager (const ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK> &))
};
+
/**
* @class ACE_Map_Iterator_Base
*
@@ -361,36 +457,49 @@ public:
/// Contructor. If head != 0, the iterator constructed is positioned
/// at the head of the map, it is positioned at the end otherwise.
ACE_Map_Iterator_Base (ACE_Map_Manager <EXT_ID, INT_ID, ACE_LOCK> &mm);
+
// = Iteration methods.
+
/// Pass back the next <entry> that hasn't been seen in the Set.
/// Returns 0 when all items have been seen, else 1.
int next (ACE_Map_Entry<EXT_ID, INT_ID> *&next_entry) const;
+
/// Returns 1 when all items have been seen, else 0.
int done (void) const;
+
/// Returns a reference to the interal element @c this is pointing to.
ACE_Map_Entry<EXT_ID, INT_ID>& operator* (void) const;
+
/// Returns reference the Map_Manager that is being iterated
/// over.
ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>& map (void);
+
/// Check if two iterators point to the same position
bool operator== (const ACE_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK> &) const;
bool operator!= (const ACE_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK> &) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
/// Move forward by one element in the set. Returns 0 when there's
/// no more item in the set after the current items, else 1.
int forward_i (void);
+
/// Move backware by one element in the set. Returns 0 when there's
/// no more item in the set before the current item, else 1.
int reverse_i (void);
+
/// Dump the state of an object.
void dump_i (void) const;
+
/// Map we are iterating over.
ACE_Map_Manager <EXT_ID, INT_ID, ACE_LOCK> *map_man_;
+
/// Keeps track of how far we've advanced...
ACE_UINT32 next_;
};
+
/**
* @class ACE_Map_Const_Iterator_Base
*
@@ -407,36 +516,49 @@ public:
/// Contructor. If head != 0, the iterator constructed is positioned
/// at the head of the map, it is positioned at the end otherwise.
ACE_Map_Const_Iterator_Base (const ACE_Map_Manager <EXT_ID, INT_ID, ACE_LOCK> &mm);
+
// = Iteration methods.
+
/// Pass back the next <entry> that hasn't been seen in the Set.
/// Returns 0 when all items have been seen, else 1.
int next (ACE_Map_Entry<EXT_ID, INT_ID> *&next_entry) const;
+
/// Returns 1 when all items have been seen, else 0.
int done (void) const;
+
/// Returns a reference to the interal element @c this is pointing to.
ACE_Map_Entry<EXT_ID, INT_ID>& operator* (void) const;
+
/// Returns reference the Map_Manager that is being iterated
/// over.
const ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>& map (void) const;
+
/// Check if two iterators point to the same position
bool operator== (const ACE_Map_Const_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK> &) const;
bool operator!= (const ACE_Map_Const_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK> &) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
/// Move forward by one element in the set. Returns 0 when there's
/// no more item in the set after the current items, else 1.
int forward_i (void);
+
/// Move backware by one element in the set. Returns 0 when there's
/// no more item in the set before the current item, else 1.
int reverse_i (void);
+
/// Dump the state of an object.
void dump_i (void) const;
+
/// Map we are iterating over.
const ACE_Map_Manager <EXT_ID, INT_ID, ACE_LOCK> *map_man_;
+
/// Keeps track of how far we've advanced...
ACE_UINT32 next_;
};
+
/**
* @class ACE_Map_Iterator
*
@@ -456,24 +578,34 @@ public:
// = Initialization method.
ACE_Map_Iterator (ACE_Map_Manager <EXT_ID, INT_ID, ACE_LOCK> &mm,
int pass_end = 0);
+
// = Iteration methods.
+
/// Move forward by one element in the set. Returns 0 when all the
/// items in the set have been seen, else 1.
int advance (void);
+
/// Dump the state of an object.
void dump (void) const;
+
// = STL styled iteration, compare, and reference functions.
+
/// Prefix advance.
ACE_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK> &operator++ (void);
+
/// Postfix advance.
ACE_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK> operator++ (int);
+
/// Prefix reverse.
ACE_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK> &operator-- (void);
+
/// Postfix reverse.
ACE_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK> operator-- (int);
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
};
+
/**
* @class ACE_Map_Const_Iterator
*
@@ -493,24 +625,34 @@ public:
// = Initialization method.
ACE_Map_Const_Iterator (const ACE_Map_Manager <EXT_ID, INT_ID, ACE_LOCK> &mm,
int pass_end = 0);
+
// = Iteration methods.
+
/// Move forward by one element in the set. Returns 0 when all the
/// items in the set have been seen, else 1.
int advance (void);
+
/// Dump the state of an object.
void dump (void) const;
+
// = STL styled iteration, compare, and reference functions.
+
/// Prefix advance.
ACE_Map_Const_Iterator<EXT_ID, INT_ID, ACE_LOCK> &operator++ (void);
+
/// Postfix advance.
ACE_Map_Const_Iterator<EXT_ID, INT_ID, ACE_LOCK> operator++ (int);
+
/// Prefix reverse.
ACE_Map_Const_Iterator<EXT_ID, INT_ID, ACE_LOCK> &operator-- (void);
+
/// Postfix reverse.
ACE_Map_Const_Iterator<EXT_ID, INT_ID, ACE_LOCK> operator-- (int);
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
};
+
/**
* @class ACE_Map_Reverse_Iterator
*
@@ -530,34 +672,49 @@ public:
// = Initialization method.
ACE_Map_Reverse_Iterator (ACE_Map_Manager <EXT_ID, INT_ID, ACE_LOCK> &mm,
int pass_end = 0);
+
// = Iteration methods.
+
/// Move forward by one element in the set. Returns 0 when all the
/// items in the set have been seen, else 1.
int advance (void);
+
/// Dump the state of an object.
void dump (void) const;
+
// = STL styled iteration, compare, and reference functions.
+
/// Prefix reverse.
ACE_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK> &operator++ (void);
+
/// Postfix reverse.
ACE_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK> operator++ (int);
+
/// Prefix advance.
ACE_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK> &operator-- (void);
+
/// Postfix advance.
ACE_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK> operator-- (int);
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Map_Manager.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Map_Manager.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Map_Manager.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_MAP_MANAGER_H */
diff --git a/dep/ACE_wrappers/ace/Map_Manager.inl b/dep/ACE_wrappers/ace/Map_Manager.inl
index 83c238d19cc..62502c1c4d5 100644
--- a/dep/ACE_wrappers/ace/Map_Manager.inl
+++ b/dep/ACE_wrappers/ace/Map_Manager.inl
@@ -1,9 +1,12 @@
// -*- C++ -*-
//
// $Id: Map_Manager.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Guard_T.h"
#include "ace/Log_Msg.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template <class EXT_ID, class INT_ID> ACE_INLINE
ACE_Map_Entry<EXT_ID, INT_ID>::ACE_Map_Entry (void)
: next_ (0),
@@ -13,31 +16,37 @@ ACE_Map_Entry<EXT_ID, INT_ID>::ACE_Map_Entry (void)
#endif /* ACE_HAS_LAZY_MAP_MANAGER */
{
}
+
template <class EXT_ID, class INT_ID> ACE_INLINE
ACE_Map_Entry<EXT_ID, INT_ID>::~ACE_Map_Entry (void)
{
// No-op just to keep some compilers happy...
}
+
template <class EXT_ID, class INT_ID> ACE_INLINE ACE_UINT32
ACE_Map_Entry<EXT_ID, INT_ID>::next (void) const
{
return this->next_;
}
+
template <class EXT_ID, class INT_ID> ACE_INLINE void
ACE_Map_Entry<EXT_ID, INT_ID>::next (ACE_UINT32 n)
{
this->next_ = n;
}
+
template <class EXT_ID, class INT_ID> ACE_INLINE ACE_UINT32
ACE_Map_Entry<EXT_ID, INT_ID>::prev (void) const
{
return this->prev_;
}
+
template <class EXT_ID, class INT_ID> ACE_INLINE void
ACE_Map_Entry<EXT_ID, INT_ID>::prev (ACE_UINT32 p)
{
this->prev_ = p;
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE
ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::ACE_Map_Manager (size_t size,
ACE_Allocator *alloc)
@@ -49,6 +58,7 @@ ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::ACE_Map_Manager (size_t size,
if (this->open (size, alloc) == -1)
ACE_ERROR ((LM_ERROR, ACE_TEXT ("ACE_Map_Manager\n")));
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE
ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::ACE_Map_Manager (ACE_Allocator *alloc)
: allocator_ (0),
@@ -59,25 +69,31 @@ ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::ACE_Map_Manager (ACE_Allocator *alloc
if (this->open (ACE_DEFAULT_MAP_SIZE, alloc) == -1)
ACE_ERROR ((LM_ERROR, ACE_TEXT ("ACE_Map_Manager\n")));
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE int
ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::close (void)
{
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
return this->close_i ();
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE
ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::~ACE_Map_Manager (void)
{
this->close ();
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE int
ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::bind (const EXT_ID &ext_id,
const INT_ID &int_id)
{
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
return this->bind_i (ext_id,
int_id);
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE int
ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::rebind (const EXT_ID &ext_id,
const INT_ID &int_id,
@@ -85,46 +101,56 @@ ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::rebind (const EXT_ID &ext_id,
INT_ID &old_int_id)
{
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
return this->rebind_i (ext_id,
int_id,
old_ext_id,
old_int_id);
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE int
ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::rebind (const EXT_ID &ext_id,
const INT_ID &int_id,
INT_ID &old_int_id)
{
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
return this->rebind_i (ext_id,
int_id,
old_int_id);
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE int
ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::rebind (const EXT_ID &ext_id,
const INT_ID &int_id)
{
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
return this->rebind_i (ext_id,
int_id);
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE int
ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::trybind (const EXT_ID &ext_id,
INT_ID &int_id)
{
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
return this->trybind_i (ext_id,
int_id);
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE int
ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::find (const EXT_ID &ext_id) const
{
ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK> *nc_this =
(ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK> *) this;
ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, nc_this->lock_, -1);
+
ACE_UINT32 slot = 0;
return nc_this->find_and_return_index (ext_id, slot);
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE int
ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::find (const EXT_ID &ext_id,
INT_ID &int_id) const
@@ -132,8 +158,10 @@ ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::find (const EXT_ID &ext_id,
ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK> *nc_this =
(ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK> *) this;
ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, nc_this->lock_, -1);
+
return nc_this->find_i (ext_id, int_id);
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE int
ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::unbind_i (const EXT_ID &ext_id)
{
@@ -142,37 +170,44 @@ ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::unbind_i (const EXT_ID &ext_id)
return this->unbind_and_return_index (ext_id,
slot);
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE int
ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::unbind (const EXT_ID &ext_id,
INT_ID &int_id)
{
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
return this->unbind_i (ext_id,
int_id);
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE int
ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::unbind (const EXT_ID &ext_id)
{
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
return this->unbind_i (ext_id);
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE size_t
ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::current_size (void) const
{
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, static_cast<size_t> (-1));
return this->cur_size_;
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE size_t
ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::total_size (void) const
{
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, static_cast<size_t> (-1));
return this->total_size_;
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE ACE_LOCK &
ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::mutex (void)
{
return this->lock_;
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE void
ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::move_from_free_list_to_occupied_list (ACE_UINT32 slot)
{
@@ -182,6 +217,7 @@ ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::move_from_free_list_to_occupied_list
this->occupied_list_,
this->occupied_list_id ());
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE void
ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::move_from_occupied_list_to_free_list (ACE_UINT32 slot)
{
@@ -191,12 +227,14 @@ ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::move_from_occupied_list_to_free_list
this->free_list_,
this->free_list_id ());
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE int
ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::equal (const EXT_ID &id1,
const EXT_ID &id2)
{
return id1 == id2;
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE ACE_UINT32
ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::free_list_id (void) const
{
@@ -205,41 +243,48 @@ ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::free_list_id (void) const
// accordingly.
return (ACE_UINT32) ~0;
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE ACE_UINT32
ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::occupied_list_id (void) const
{
return (ACE_UINT32) ~1;
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE
ACE_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK>
ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::begin (void)
{
return ACE_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK> (*this);
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE
ACE_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK>
ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::end (void)
{
return ACE_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK> (*this, 1);
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE
ACE_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK>
ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::rbegin (void)
{
return ACE_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK> (*this);
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE
ACE_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK>
ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::rend (void)
{
return ACE_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK> (*this, 1);
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE
ACE_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK>::ACE_Map_Iterator_Base (ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK> &mm)
: map_man_ (&mm),
next_ (map_man_->occupied_list_id ())
{
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE int
ACE_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK>::next (ACE_Map_Entry<EXT_ID, INT_ID> *&mm) const
{
@@ -251,78 +296,102 @@ ACE_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK>::next (ACE_Map_Entry<EXT_ID, INT
else
return 0;
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE int
ACE_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK>::done (void) const
{
return this->next_ == this->map_man_->occupied_list_id ();
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE int
ACE_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK>::forward_i (void)
{
+
#if defined (ACE_HAS_LAZY_MAP_MANAGER)
+
while (1)
{
// Go to the next item in the list.
this->next_ = this->map_man_->search_structure_[this->next_].next ();
+
// Stop if we reach the end.
if (this->done ())
break;
+
// Break if we find a non-free slot.
if (!this->map_man_->search_structure_[this->next_].free_)
{
break;
}
}
+
#else
+
this->next_ = this->map_man_->search_structure_[this->next_].next ();
+
#endif /* ACE_HAS_LAZY_MAP_MANAGER */
+
return this->next_ != this->map_man_->occupied_list_id ();
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE int
ACE_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK>::reverse_i (void)
{
+
#if defined (ACE_HAS_LAZY_MAP_MANAGER)
+
while (1)
{
// Go to the prev item in the list.
this->next_ = this->map_man_->search_structure_[this->next_].prev ();
+
// Stop if we reach the end.
if (this->done ())
break;
+
// Break if we find a non-free slot.
if (!this->map_man_->search_structure_[this->next_].free_)
{
break;
}
}
+
#else
+
this->next_ = this->map_man_->search_structure_[this->next_].prev ();
+
#endif /* ACE_HAS_LAZY_MAP_MANAGER */
+
return this->next_ != this->map_man_->occupied_list_id ();
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE
ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK> &
ACE_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK>::map (void)
{
return *this->map_man_;
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE bool
ACE_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK>::operator== (const ACE_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK> &rhs) const
{
return (this->map_man_ == rhs.map_man_ &&
this->next_ == rhs.next_);
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE bool
ACE_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK>::operator!= (const ACE_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK> &rhs) const
{
return !this->operator== (rhs);
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE
ACE_Map_Const_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK>::ACE_Map_Const_Iterator_Base (const ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK> &mm)
: map_man_ (&mm),
next_ (this->map_man_->occupied_list_id ())
{
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE int
ACE_Map_Const_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK>::next (ACE_Map_Entry<EXT_ID, INT_ID> *&mm) const
{
@@ -334,72 +403,95 @@ ACE_Map_Const_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK>::next (ACE_Map_Entry<EXT_I
else
return 0;
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE int
ACE_Map_Const_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK>::done (void) const
{
return this->next_ == this->map_man_->occupied_list_id ();
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE int
ACE_Map_Const_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK>::forward_i (void)
{
+
#if defined (ACE_HAS_LAZY_MAP_MANAGER)
+
while (1)
{
// Go to the next item in the list.
this->next_ = this->map_man_->search_structure_[this->next_].next ();
+
// Stop if we reach the end.
if (this->done ())
break;
+
// Break if we find a non-free slot.
if (!this->map_man_->search_structure_[this->next_].free_)
{
break;
}
}
+
#else
+
this->next_ = this->map_man_->search_structure_[this->next_].next ();
+
#endif /* ACE_HAS_LAZY_MAP_MANAGER */
+
return this->next_ != this->map_man_->occupied_list_id ();
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE int
ACE_Map_Const_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK>::reverse_i (void)
{
+
#if defined (ACE_HAS_LAZY_MAP_MANAGER)
+
while (1)
{
// Go to the prev item in the list.
this->next_ = this->map_man_->search_structure_[this->next_].prev ();
+
// Stop if we reach the end.
if (this->done ())
break;
+
// Break if we find a non-free slot.
if (!this->map_man_->search_structure_[this->next_].free_)
{
break;
}
}
+
#else
+
this->next_ = this->map_man_->search_structure_[this->next_].prev ();
+
#endif /* ACE_HAS_LAZY_MAP_MANAGER */
+
return this->next_ != this->map_man_->occupied_list_id ();
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE
const ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK> &
ACE_Map_Const_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK>::map (void) const
{
return *this->map_man_;
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE bool
ACE_Map_Const_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK>::operator== (const ACE_Map_Const_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK> &rhs) const
{
return (this->map_man_ == rhs.map_man_ &&
this->next_ == rhs.next_);
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE bool
ACE_Map_Const_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK>::operator!= (const ACE_Map_Const_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK> &rhs) const
{
return !this->operator== (rhs);
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE
ACE_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK>::ACE_Map_Iterator (ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK> &mm,
int pass_end)
@@ -407,32 +499,43 @@ ACE_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK>::ACE_Map_Iterator (ACE_Map_Manager<EX
{
if (!pass_end)
{
+
#if defined (ACE_HAS_LAZY_MAP_MANAGER)
+
// Start here.
this->next_ = this->map_man_->occupied_list_.next ();
+
while (1)
{
// Stop if we reach the end.
if (this->done ())
break;
+
// Break if we find a non-free slot.
if (!this->map_man_->search_structure_[this->next_].free_)
{
break;
}
+
// Go to the next item in the list.
this->next_ = this->map_man_->search_structure_[this->next_].next ();
}
+
#else
+
this->next_ = this->map_man_->occupied_list_.next ();
+
#endif /* ACE_HAS_LAZY_MAP_MANAGER */
+
}
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE int
ACE_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK>::advance (void)
{
return this->forward_i ();
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE
ACE_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK> &
ACE_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK>::operator++ (void)
@@ -440,6 +543,7 @@ ACE_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK>::operator++ (void)
this->forward_i ();
return *this;
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE
ACE_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK>
ACE_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK>::operator++ (int)
@@ -448,6 +552,7 @@ ACE_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK>::operator++ (int)
++*this;
return retv;
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE
ACE_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK> &
ACE_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK>::operator-- (void)
@@ -455,6 +560,7 @@ ACE_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK>::operator-- (void)
this->reverse_i ();
return *this;
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE
ACE_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK>
ACE_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK>::operator-- (int)
@@ -463,6 +569,7 @@ ACE_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK>::operator-- (int)
--*this;
return retv;
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE
ACE_Map_Const_Iterator<EXT_ID, INT_ID, ACE_LOCK>::ACE_Map_Const_Iterator (const ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK> &mm,
int pass_end)
@@ -470,32 +577,43 @@ ACE_Map_Const_Iterator<EXT_ID, INT_ID, ACE_LOCK>::ACE_Map_Const_Iterator (const
{
if (!pass_end)
{
+
#if defined (ACE_HAS_LAZY_MAP_MANAGER)
+
// Start here.
this->next_ = this->map_man_->occupied_list_.next ();
+
while (1)
{
// Stop if we reach the end.
if (this->done ())
break;
+
// Break if we find a non-free slot.
if (!this->map_man_->search_structure_[this->next_].free_)
{
break;
}
+
// Go to the next item in the list.
this->next_ = this->map_man_->search_structure_[this->next_].next ();
}
+
#else
+
this->next_ = this->map_man_->occupied_list_.next ();
+
#endif /* ACE_HAS_LAZY_MAP_MANAGER */
+
}
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE int
ACE_Map_Const_Iterator<EXT_ID, INT_ID, ACE_LOCK>::advance (void)
{
return this->forward_i ();
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE
ACE_Map_Const_Iterator<EXT_ID, INT_ID, ACE_LOCK> &
ACE_Map_Const_Iterator<EXT_ID, INT_ID, ACE_LOCK>::operator++ (void)
@@ -503,6 +621,7 @@ ACE_Map_Const_Iterator<EXT_ID, INT_ID, ACE_LOCK>::operator++ (void)
this->forward_i ();
return *this;
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE
ACE_Map_Const_Iterator<EXT_ID, INT_ID, ACE_LOCK>
ACE_Map_Const_Iterator<EXT_ID, INT_ID, ACE_LOCK>::operator++ (int)
@@ -511,6 +630,7 @@ ACE_Map_Const_Iterator<EXT_ID, INT_ID, ACE_LOCK>::operator++ (int)
++*this;
return retv;
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE
ACE_Map_Const_Iterator<EXT_ID, INT_ID, ACE_LOCK> &
ACE_Map_Const_Iterator<EXT_ID, INT_ID, ACE_LOCK>::operator-- (void)
@@ -518,6 +638,7 @@ ACE_Map_Const_Iterator<EXT_ID, INT_ID, ACE_LOCK>::operator-- (void)
this->reverse_i ();
return *this;
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE
ACE_Map_Const_Iterator<EXT_ID, INT_ID, ACE_LOCK>
ACE_Map_Const_Iterator<EXT_ID, INT_ID, ACE_LOCK>::operator-- (int)
@@ -526,6 +647,7 @@ ACE_Map_Const_Iterator<EXT_ID, INT_ID, ACE_LOCK>::operator-- (int)
--*this;
return retv;
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE
ACE_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK>::ACE_Map_Reverse_Iterator (ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK> &mm,
int pass_end)
@@ -533,32 +655,43 @@ ACE_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK>::ACE_Map_Reverse_Iterator (AC
{
if (!pass_end)
{
+
#if defined (ACE_HAS_LAZY_MAP_MANAGER)
+
// Start here.
this->next_ = this->map_man_->occupied_list_.prev ();
+
while (1)
{
// Stop if we reach the end.
if (this->done ())
break;
+
// Break if we find a non-free slot.
if (!this->map_man_->search_structure_[this->next_].free_)
{
break;
}
+
// Go to the prev item in the list.
this->next_ = this->map_man_->search_structure_[this->next_].prev ();
}
+
#else
+
this->next_ = this->map_man_->occupied_list_.prev ();
+
#endif /* ACE_HAS_LAZY_MAP_MANAGER */
+
}
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE int
ACE_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK>::advance (void)
{
return this->reverse_i ();
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE
ACE_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK> &
ACE_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK>::operator++ (void)
@@ -566,6 +699,7 @@ ACE_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK>::operator++ (void)
this->reverse_i ();
return *this;
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE
ACE_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK>
ACE_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK>::operator++ (int)
@@ -574,6 +708,7 @@ ACE_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK>::operator++ (int)
++*this;
return retv;
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE
ACE_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK> &
ACE_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK>::operator-- (void)
@@ -581,6 +716,7 @@ ACE_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK>::operator-- (void)
this->forward_i ();
return *this;
}
+
template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE
ACE_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK>
ACE_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK>::operator-- (int)
@@ -589,4 +725,5 @@ ACE_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK>::operator-- (int)
--*this;
return retv;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Map_T.h b/dep/ACE_wrappers/ace/Map_T.h
index 86b455613e2..1882b354e52 100644
--- a/dep/ACE_wrappers/ace/Map_T.h
+++ b/dep/ACE_wrappers/ace/Map_T.h
@@ -1,4 +1,5 @@
/* -*- C++ -*- */
+
//=============================================================================
/**
* @file Map_T.h
@@ -8,17 +9,22 @@
* @author Irfan Pyarali <irfan@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_MAP_T_H
#define ACE_MAP_T_H
#include /**/ "ace/pre.h"
+
#include "ace/Pair_T.h"
#include "ace/Map_Manager.h"
#include "ace/Hash_Map_Manager_T.h"
#include "ace/Active_Map_Manager.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Noop_Key_Generator
*
@@ -28,9 +34,11 @@ template <class T>
class ACE_Noop_Key_Generator
{
public:
+
/// Functor method: generates a new key.
int operator () (T &);
};
+
/**
* @class ACE_Incremental_Key_Generator
*
@@ -48,16 +56,22 @@ template <class T>
class ACE_Incremental_Key_Generator
{
public:
+
/// Constructor.
ACE_Incremental_Key_Generator (void);
+
/// Functor method: generates a new key.
int operator () (T &t);
+
/// Returns the current value.
const T& current_value (void) const;
+
protected:
+
/// Current value.
T t_;
};
+
/**
* @class ACE_Iterator_Impl
*
@@ -69,19 +83,26 @@ template <class T>
class ACE_Iterator_Impl
{
public:
+
/// Destructor.
virtual ~ACE_Iterator_Impl (void);
+
/// Clone.
virtual ACE_Iterator_Impl<T> *clone (void) const = 0;
+
/// Comparison.
virtual int compare (const ACE_Iterator_Impl<T> &rhs) const = 0;
+
/// Dereference.
virtual T dereference (void) const = 0;
+
/// Advance.
virtual void plus_plus (void) = 0;
+
/// Reverse.
virtual void minus_minus (void) = 0;
};
+
/**
* @class ACE_Reverse_Iterator_Impl
*
@@ -93,19 +114,26 @@ template <class T>
class ACE_Reverse_Iterator_Impl
{
public:
+
/// Destructor.
virtual ~ACE_Reverse_Iterator_Impl (void);
+
/// Clone.
virtual ACE_Reverse_Iterator_Impl<T> *clone (void) const = 0;
+
/// Comparison.
virtual int compare (const ACE_Reverse_Iterator_Impl<T> &rhs) const = 0;
+
/// Dereference.
virtual T dereference (void) const = 0;
+
/// Advance.
virtual void plus_plus (void) = 0;
+
/// Reverse.
virtual void minus_minus (void) = 0;
};
+
/**
* @class ACE_Iterator
*
@@ -117,36 +145,51 @@ template <class T>
class ACE_Iterator
{
public:
+
// = Traits.
typedef T value_type;
typedef ACE_Iterator_Impl<T> implementation;
+
/// Constructor.
ACE_Iterator (ACE_Iterator_Impl<T> *impl);
+
/// Copy constructor.
ACE_Iterator (const ACE_Iterator<T> &rhs);
+
/// Destructor.
~ACE_Iterator (void);
+
/// Assignment operator.
ACE_Iterator<T> &operator= (const ACE_Iterator<T> &rhs);
+
/// Comparison operators.
bool operator== (const ACE_Iterator<T> &rhs) const;
bool operator!= (const ACE_Iterator<T> &rhs) const;
+
/// Dereference operator.
T operator *() const;
+
/// Prefix advance.
ACE_Iterator<T> &operator++ (void);
+
/// Postfix advance.
ACE_Iterator<T> operator++ (int);
+
/// Prefix reverse.
ACE_Iterator<T> &operator-- (void);
+
/// Postfix reverse.
ACE_Iterator<T> operator-- (int);
+
/// Accessor to implementation object.
ACE_Iterator_Impl<T> &impl (void);
+
protected:
+
/// Implementation pointer.
ACE_Iterator_Impl<T> *implementation_;
};
+
/**
* @class ACE_Reverse_Iterator
*
@@ -158,17 +201,23 @@ template <class T>
class ACE_Reverse_Iterator
{
public:
+
// = Traits.
typedef T value_type;
typedef ACE_Reverse_Iterator_Impl<T> implementation;
+
/// Constructor.
ACE_Reverse_Iterator (ACE_Reverse_Iterator_Impl<T> *impl);
+
/// Copy constructor.
ACE_Reverse_Iterator (const ACE_Reverse_Iterator<T> &rhs);
+
/// Destructor.
~ACE_Reverse_Iterator (void);
+
/// Assignment operator.
ACE_Reverse_Iterator<T> &operator= (const ACE_Reverse_Iterator<T> &rhs);
+
/**
* @name Comparison Operators
*
@@ -178,22 +227,31 @@ public:
bool operator== (const ACE_Reverse_Iterator<T> &rhs) const;
bool operator!= (const ACE_Reverse_Iterator<T> &rhs) const;
//@}
+
/// Dereference operator.
T operator *() const;
+
/// Prefix advance.
ACE_Reverse_Iterator<T> &operator++ (void);
+
/// Postfix advance.
ACE_Reverse_Iterator<T> operator++ (int);
+
/// Prefix reverse.
ACE_Reverse_Iterator<T> &operator-- (void);
+
/// Postfix reverse.
ACE_Reverse_Iterator<T> operator-- (int);
+
/// Accessor to implementation object.
ACE_Reverse_Iterator_Impl<T> &impl (void);
+
protected:
+
/// Implementation pointer.
ACE_Reverse_Iterator_Impl<T> *implementation_;
};
+
/**
* @class ACE_Map
*
@@ -205,6 +263,7 @@ template <class KEY, class VALUE>
class ACE_Map
{
public:
+
// = Traits.
typedef KEY
key_type;
@@ -220,13 +279,17 @@ public:
iterator_implementation;
typedef ACE_Reverse_Iterator_Impl<value_type>
reverse_iterator_implementation;
+
/// Close down and release dynamically allocated resources.
virtual ~ACE_Map (void);
+
/// Initialize a map with size @a length.
virtual int open (size_t length = ACE_DEFAULT_MAP_SIZE,
ACE_Allocator *alloc = 0) = 0;
+
/// Close down a <Map> and release dynamically allocated resources.
virtual int close (void) = 0;
+
/**
* Add @a key / @a value pair to the map. If @a key is already in the
* map then no changes are made and 1 is returned. Returns 0 on a
@@ -235,6 +298,7 @@ public:
*/
virtual int bind (const KEY &key,
const VALUE &value) = 0;
+
/**
* Add @a key / @a value pair to the map. @a key is an "inout" parameter
* and maybe modified/extended by the map to add additional
@@ -243,6 +307,7 @@ public:
*/
virtual int bind_modify_key (const VALUE &value,
KEY &key) = 0;
+
/**
* Produce a key and return it through @a key which is an "out"
* parameter. For maps that do not naturally produce keys, the map
@@ -252,6 +317,7 @@ public:
* by the key generator.
*/
virtual int create_key (KEY &key) = 0;
+
/**
* Add @a value to the map, and the corresponding key produced by the
* Map is returned through @a key which is an "out" parameter. For
@@ -263,6 +329,7 @@ public:
*/
virtual int bind_create_key (const VALUE &value,
KEY &key) = 0;
+
/**
* Add @a value to the map. The user does not care about the
* corresponding key produced by the Map. For maps that do not
@@ -273,10 +340,12 @@ public:
* generator.
*/
virtual int bind_create_key (const VALUE &value) = 0;
+
/// Recovers the original key potentially modified by the map during
/// <bind_modify_key>.
virtual int recover_key (const KEY &modified_key,
KEY &original_key) = 0;
+
/**
* Reassociate @a key with @a value. The function fails if @a key is
* not in the map for maps that do not allow user specified keys.
@@ -285,6 +354,7 @@ public:
*/
virtual int rebind (const KEY &key,
const VALUE &value) = 0;
+
/**
* Reassociate @a key with @a value, storing the old value into the
* "out" parameter @a old_value. The function fails if @a key is not
@@ -295,6 +365,7 @@ public:
virtual int rebind (const KEY &key,
const VALUE &value,
VALUE &old_value) = 0;
+
/**
* Reassociate @a key with @a value, storing the old key and value
* into the "out" parameters @a old_key and @a old_value. The
@@ -307,6 +378,7 @@ public:
const VALUE &value,
KEY &old_key,
VALUE &old_value) = 0;
+
/**
* Associate @a key with @a value if and only if @a key is not in the
* map. If @a key is already in the map, then the @a value parameter
@@ -317,44 +389,61 @@ public:
*/
virtual int trybind (const KEY &key,
VALUE &value) = 0;
+
/// Locate @a value associated with @a key.
virtual int find (const KEY &key,
VALUE &value) = 0;
+
/// Is @a key in the map?
virtual int find (const KEY &key) = 0;
+
/// Remove @a key from the map.
virtual int unbind (const KEY &key) = 0;
+
/// Remove @a key from the map, and return the @a value associated with
/// @a key.
virtual int unbind (const KEY &key,
VALUE &value) = 0;
+
/// Return the current size of the map.
virtual size_t current_size (void) const = 0;
+
/// Return the total size of the map.
virtual size_t total_size (void) const = 0;
+
/// Dump the state of an object.
virtual void dump (void) const = 0;
+
// = STL styled iterator factory functions.
+
/// Return forward iterator.
iterator begin (void);
iterator end (void);
+
/// Return reverse iterator.
reverse_iterator rbegin (void);
reverse_iterator rend (void);
+
protected:
+
// = Protected no-op constructor.
ACE_Map (void);
+
/// Return forward iterator.
virtual ACE_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *begin_impl (void) = 0;
virtual ACE_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *end_impl (void) = 0;
+
/// Return reverse iterator.
virtual ACE_Reverse_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *rbegin_impl (void) = 0;
virtual ACE_Reverse_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *rend_impl (void) = 0;
+
private:
+
// = Disallow these operations.
ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Map<KEY, VALUE> &))
ACE_UNIMPLEMENTED_FUNC (ACE_Map (const ACE_Map<KEY, VALUE> &))
};
+
/**
* @class ACE_Map_Impl_Iterator_Adapter
*
@@ -366,29 +455,41 @@ template <class T, class IMPLEMENTATION, class ENTRY>
class ACE_Map_Impl_Iterator_Adapter : public ACE_Iterator_Impl<T>
{
public:
+
// = Traits.
typedef IMPLEMENTATION
implementation;
+
/// Constructor.
ACE_Map_Impl_Iterator_Adapter (const IMPLEMENTATION &impl);
+
/// Destructor.
virtual ~ACE_Map_Impl_Iterator_Adapter (void);
+
/// Clone.
virtual ACE_Iterator_Impl<T> *clone (void) const;
+
/// Comparison.
virtual int compare (const ACE_Iterator_Impl<T> &rhs) const;
+
/// Dereference.
virtual T dereference (void) const;
+
/// Advance.
virtual void plus_plus (void);
+
/// Reverse.
virtual void minus_minus (void);
+
/// Accessor to implementation object.
IMPLEMENTATION &impl (void);
+
protected:
+
/// All implementation details are forwarded to this class.
IMPLEMENTATION implementation_;
};
+
/**
* @class ACE_Map_Impl_Reverse_Iterator_Adapter
*
@@ -400,29 +501,41 @@ template <class T, class IMPLEMENTATION, class ENTRY>
class ACE_Map_Impl_Reverse_Iterator_Adapter : public ACE_Reverse_Iterator_Impl<T>
{
public:
+
// = Traits.
typedef IMPLEMENTATION
implementation;
+
/// Constructor.
ACE_Map_Impl_Reverse_Iterator_Adapter (const IMPLEMENTATION &impl);
+
/// Destructor.
virtual ~ACE_Map_Impl_Reverse_Iterator_Adapter (void);
+
/// Clone.
virtual ACE_Reverse_Iterator_Impl<T> *clone (void) const;
+
/// Comparison.
virtual int compare (const ACE_Reverse_Iterator_Impl<T> &rhs) const;
+
/// Dereference.
virtual T dereference (void) const;
+
/// Advance.
virtual void plus_plus (void);
+
/// Reverse.
virtual void minus_minus (void);
+
/// Accessor to implementation object.
IMPLEMENTATION &impl (void);
+
protected:
+
/// All implementation details are forwarded to this class.
IMPLEMENTATION implementation_;
};
+
/**
* @class ACE_Map_Impl
*
@@ -434,27 +547,35 @@ template <class KEY, class VALUE, class IMPLEMENTATION, class ITERATOR, class RE
class ACE_Map_Impl : public ACE_Map<KEY, VALUE>
{
public:
+
// = Traits.
typedef ACE_Map_Impl_Iterator_Adapter<typename ACE_Map<KEY, VALUE>::value_type, ITERATOR, ENTRY>
iterator_impl;
typedef ACE_Map_Impl_Reverse_Iterator_Adapter<typename ACE_Map<KEY, VALUE>::value_type, REVERSE_ITERATOR, ENTRY>
reverse_iterator_impl;
+
typedef IMPLEMENTATION
implementation;
+
// = Initialization and termination methods.
/// Initialize with the ACE_DEFAULT_MAP_SIZE.
ACE_Map_Impl (ACE_Allocator *alloc = 0);
+
/// Initialize with @a size entries. The @a size parameter is ignored
/// by maps for which an initialize size does not make sense.
ACE_Map_Impl (size_t size,
ACE_Allocator *alloc = 0);
+
/// Close down and release dynamically allocated resources.
virtual ~ACE_Map_Impl (void);
+
/// Initialize a <Map> with size @a length.
virtual int open (size_t length = ACE_DEFAULT_MAP_SIZE,
ACE_Allocator *alloc = 0);
+
/// Close down a <Map> and release dynamically allocated resources.
virtual int close (void);
+
/**
* Add @a key / @a value pair to the map. If @a key is already in the
* map then no changes are made and 1 is returned. Returns 0 on a
@@ -463,6 +584,7 @@ public:
*/
virtual int bind (const KEY &key,
const VALUE &value);
+
/**
* Add @a key / @a value pair to the map. @a key is an "inout" parameter
* and maybe modified/extended by the map to add additional
@@ -471,6 +593,7 @@ public:
*/
virtual int bind_modify_key (const VALUE &value,
KEY &key);
+
/**
* Produce a key and return it through @a key which is an "out"
* parameter. For maps that do not naturally produce keys, the map
@@ -480,6 +603,7 @@ public:
* by the key generator.
*/
virtual int create_key (KEY &key);
+
/**
* Add @a value to the map, and the corresponding key produced by the
* Map is returned through @a key which is an "out" parameter. For
@@ -491,6 +615,7 @@ public:
*/
virtual int bind_create_key (const VALUE &value,
KEY &key);
+
/**
* Add @a value to the map. The user does not care about the
* corresponding key produced by the Map. For maps that do not
@@ -501,10 +626,12 @@ public:
* generator.
*/
virtual int bind_create_key (const VALUE &value);
+
/// Recovers the original key potentially modified by the map during
/// <bind_modify_key>.
virtual int recover_key (const KEY &modified_key,
KEY &original_key);
+
/**
* Reassociate @a key with @a value. The function fails if @a key is
* not in the map for maps that do not allow user specified keys.
@@ -513,6 +640,7 @@ public:
*/
virtual int rebind (const KEY &key,
const VALUE &value);
+
/**
* Reassociate @a key with @a value, storing the old value into the
* "out" parameter @a old_value. The function fails if @a key is not
@@ -523,6 +651,7 @@ public:
virtual int rebind (const KEY &key,
const VALUE &value,
VALUE &old_value);
+
/**
* Reassociate @a key with @a value, storing the old key and value
* into the "out" parameters @a old_key and @a old_value. The
@@ -535,6 +664,7 @@ public:
const VALUE &value,
KEY &old_key,
VALUE &old_value);
+
/**
* Associate @a key with @a value if and only if @a key is not in the
* map. If @a key is already in the map, then the @a value parameter
@@ -545,40 +675,56 @@ public:
*/
virtual int trybind (const KEY &key,
VALUE &value);
+
/// Locate @a value associated with @a key.
virtual int find (const KEY &key,
VALUE &value);
+
/// Is @a key in the map?
virtual int find (const KEY &key);
+
/// Remove @a key from the map.
virtual int unbind (const KEY &key);
+
/// Remove @a key from the map, and return the @a value associated with
/// @a key.
virtual int unbind (const KEY &key,
VALUE &value);
+
/// Return the current size of the map.
virtual size_t current_size (void) const;
+
/// Return the total size of the map.
virtual size_t total_size (void) const;
+
/// Dump the state of an object.
virtual void dump (void) const;
+
/// Accessor to implementation object.
IMPLEMENTATION &impl (void);
+
protected:
+
/// All implementation details are forwarded to this class.
IMPLEMENTATION implementation_;
+
// = STL styled iterator factory functions.
+
/// Return forward iterator.
virtual ACE_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *begin_impl (void);
virtual ACE_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *end_impl (void);
+
/// Return reverse iterator.
virtual ACE_Reverse_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *rbegin_impl (void);
virtual ACE_Reverse_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *rend_impl (void);
+
private:
+
// = Disallow these operations.
ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Map_Impl<KEY, VALUE, IMPLEMENTATION, ITERATOR, REVERSE_ITERATOR, ENTRY> &))
ACE_UNIMPLEMENTED_FUNC (ACE_Map_Impl (const ACE_Map_Impl<KEY, VALUE, IMPLEMENTATION, ITERATOR, REVERSE_ITERATOR, ENTRY> &))
};
+
/**
* @class ACE_Active_Map_Manager_Iterator_Adapter
*
@@ -590,29 +736,41 @@ template <class T, class VALUE>
class ACE_Active_Map_Manager_Iterator_Adapter : public ACE_Iterator_Impl<T>
{
public:
+
// = Traits.
typedef typename ACE_Active_Map_Manager<VALUE>::iterator
implementation;
+
/// Constructor.
ACE_Active_Map_Manager_Iterator_Adapter (const ACE_Map_Iterator<ACE_Active_Map_Manager_Key, VALUE, ACE_Null_Mutex> &impl);
+
/// Destructor.
virtual ~ACE_Active_Map_Manager_Iterator_Adapter (void);
+
/// Clone.
virtual ACE_Iterator_Impl<T> *clone (void) const;
+
/// Comparison.
virtual int compare (const ACE_Iterator_Impl<T> &rhs) const;
+
/// Dereference.
virtual T dereference (void) const;
+
/// Advance.
virtual void plus_plus (void);
+
/// Reverse.
virtual void minus_minus (void);
+
/// Accessor to implementation object.
ACE_Map_Iterator<ACE_Active_Map_Manager_Key, VALUE, ACE_Null_Mutex> &impl (void);
+
protected:
+
/// All implementation details are forwarded to this class.
ACE_Map_Iterator<ACE_Active_Map_Manager_Key, VALUE, ACE_Null_Mutex> implementation_;
};
+
/**
* @class ACE_Active_Map_Manager_Reverse_Iterator_Adapter
*
@@ -624,29 +782,41 @@ template <class T, class VALUE>
class ACE_Active_Map_Manager_Reverse_Iterator_Adapter : public ACE_Reverse_Iterator_Impl<T>
{
public:
+
// = Traits.
typedef typename ACE_Active_Map_Manager<VALUE>::reverse_iterator
implementation;
+
/// Constructor.
ACE_Active_Map_Manager_Reverse_Iterator_Adapter (const ACE_Map_Reverse_Iterator<ACE_Active_Map_Manager_Key, VALUE, ACE_Null_Mutex> &impl);
+
/// Destructor.
virtual ~ACE_Active_Map_Manager_Reverse_Iterator_Adapter (void);
+
/// Clone.
virtual ACE_Reverse_Iterator_Impl<T> *clone (void) const;
+
/// Comparison.
virtual int compare (const ACE_Reverse_Iterator_Impl<T> &rhs) const;
+
/// Dereference.
virtual T dereference (void) const;
+
/// Advance.
virtual void plus_plus (void);
+
/// Reverse.
virtual void minus_minus (void);
+
/// Accessor to implementation object.
ACE_Map_Reverse_Iterator<ACE_Active_Map_Manager_Key, VALUE, ACE_Null_Mutex> &impl (void);
+
protected:
+
/// All implementation details are forwarded to this class.
ACE_Map_Reverse_Iterator<ACE_Active_Map_Manager_Key, VALUE, ACE_Null_Mutex> implementation_;
};
+
/**
* @class ACE_Active_Map_Manager_Adapter
*
@@ -658,6 +828,7 @@ template <class KEY, class VALUE, class KEY_ADAPTER>
class ACE_Active_Map_Manager_Adapter : public ACE_Map<KEY, VALUE>
{
public:
+
// = Traits.
typedef ACE_Pair<KEY, VALUE>
expanded_value;
@@ -667,20 +838,26 @@ public:
reverse_iterator_impl;
typedef ACE_Active_Map_Manager<expanded_value>
implementation;
+
// = Initialization and termination methods.
/// Initialize with the ACE_DEFAULT_MAP_SIZE.
ACE_Active_Map_Manager_Adapter (ACE_Allocator *alloc = 0);
+
/// Initialize with @a size entries. The @a size parameter is ignored
/// by maps for which an initialize size does not make sense.
ACE_Active_Map_Manager_Adapter (size_t size,
ACE_Allocator *alloc = 0);
+
/// Close down and release dynamically allocated resources.
virtual ~ACE_Active_Map_Manager_Adapter (void);
+
/// Initialize a <Map> with size @a length.
virtual int open (size_t length = ACE_DEFAULT_MAP_SIZE,
ACE_Allocator *alloc = 0);
+
/// Close down a <Map> and release dynamically allocated resources.
virtual int close (void);
+
/**
* Add @a key / @a value pair to the map. If @a key is already in the
* map then no changes are made and 1 is returned. Returns 0 on a
@@ -689,6 +866,7 @@ public:
*/
virtual int bind (const KEY &key,
const VALUE &value);
+
/**
* Add @a key / @a value pair to the map. @a key is an "inout" parameter
* and maybe modified/extended by the map to add additional
@@ -697,6 +875,7 @@ public:
*/
virtual int bind_modify_key (const VALUE &value,
KEY &key);
+
/**
* Produce a key and return it through @a key which is an "out"
* parameter. For maps that do not naturally produce keys, the map
@@ -706,6 +885,7 @@ public:
* by the key generator.
*/
virtual int create_key (KEY &key);
+
/**
* Add @a value to the map, and the corresponding key produced by the
* Map is returned through @a key which is an "out" parameter. For
@@ -717,6 +897,7 @@ public:
*/
virtual int bind_create_key (const VALUE &value,
KEY &key);
+
/**
* Add @a value to the map. The user does not care about the
* corresponding key produced by the Map. For maps that do not
@@ -727,10 +908,12 @@ public:
* generator.
*/
virtual int bind_create_key (const VALUE &value);
+
/// Recovers the original key potentially modified by the map during
/// <bind_modify_key>.
virtual int recover_key (const KEY &modified_key,
KEY &original_key);
+
/**
* Reassociate @a key with @a value. The function fails if @a key is
* not in the map for maps that do not allow user specified keys.
@@ -739,6 +922,7 @@ public:
*/
virtual int rebind (const KEY &key,
const VALUE &value);
+
/**
* Reassociate @a key with @a value, storing the old value into the
* "out" parameter @a old_value. The function fails if @a key is not
@@ -749,6 +933,7 @@ public:
virtual int rebind (const KEY &key,
const VALUE &value,
VALUE &old_value);
+
/**
* Reassociate @a key with @a value, storing the old key and value
* into the "out" parameters @a old_key and @a old_value. The
@@ -761,6 +946,7 @@ public:
const VALUE &value,
KEY &old_key,
VALUE &old_value);
+
/**
* Associate @a key with @a value if and only if @a key is not in the
* map. If @a key is already in the map, then the @a value parameter
@@ -771,50 +957,70 @@ public:
*/
virtual int trybind (const KEY &key,
VALUE &value);
+
/// Locate @a value associated with @a key.
virtual int find (const KEY &key,
VALUE &value);
+
/// Is @a key in the map?
virtual int find (const KEY &key);
+
/// Remove @a key from the map.
virtual int unbind (const KEY &key);
+
/// Remove @a key from the map, and return the @a value associated with
/// @a key.
virtual int unbind (const KEY &key,
VALUE &value);
+
/// Return the current size of the map.
virtual size_t current_size (void) const;
+
/// Return the total size of the map.
virtual size_t total_size (void) const;
+
/// Dump the state of an object.
virtual void dump (void) const;
+
/// Accessor to implementation object.
ACE_Active_Map_Manager<ACE_Pair<KEY, VALUE> > &impl (void);
+
/// Accessor to key adapter.
KEY_ADAPTER &key_adapter (void);
+
protected:
+
/// Find helper.
virtual int find (const KEY &key,
expanded_value *&internal_value);
+
/// Unbind helper.
virtual int unbind (const KEY &key,
expanded_value *&internal_value);
+
/// All implementation details are forwarded to this class.
ACE_Active_Map_Manager<ACE_Pair<KEY, VALUE> > implementation_;
+
/// Adapts between the user key and the Active_Map_Manager_Key.
KEY_ADAPTER key_adapter_;
+
// = STL styled iterator factory functions.
+
/// Return forward iterator.
virtual ACE_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *begin_impl (void);
virtual ACE_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *end_impl (void);
+
/// Return reverse iterator.
virtual ACE_Reverse_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *rbegin_impl (void);
virtual ACE_Reverse_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *rend_impl (void);
+
private:
+
// = Disallow these operations.
ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Active_Map_Manager_Adapter<KEY, VALUE, KEY_ADAPTER> &))
ACE_UNIMPLEMENTED_FUNC (ACE_Active_Map_Manager_Adapter (const ACE_Active_Map_Manager_Adapter<KEY, VALUE, KEY_ADAPTER> &))
};
+
/**
* @class ACE_Hash_Map_Manager_Ex_Iterator_Adapter
*
@@ -826,29 +1032,41 @@ template <class T, class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS>
class ACE_Hash_Map_Manager_Ex_Iterator_Adapter : public ACE_Iterator_Impl<T>
{
public:
+
// = Traits.
typedef typename ACE_Hash_Map_Manager_Ex<KEY, VALUE, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex>::iterator
implementation;
+
/// Constructor.
ACE_Hash_Map_Manager_Ex_Iterator_Adapter (const ACE_Hash_Map_Iterator_Ex<KEY, VALUE, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex> &impl);
+
/// Destructor.
virtual ~ACE_Hash_Map_Manager_Ex_Iterator_Adapter (void);
+
/// Clone.
virtual ACE_Iterator_Impl<T> *clone (void) const;
+
/// Comparison.
virtual int compare (const ACE_Iterator_Impl<T> &rhs) const;
+
/// Dereference.
virtual T dereference (void) const;
+
/// Advance.
virtual void plus_plus (void);
+
/// Reverse.
virtual void minus_minus (void);
+
/// Accessor to implementation object.
ACE_Hash_Map_Iterator_Ex<KEY, VALUE, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex> &impl (void);
+
protected:
+
/// All implementation details are forwarded to this class.
ACE_Hash_Map_Iterator_Ex<KEY, VALUE, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex> implementation_;
};
+
/**
* @class ACE_Hash_Map_Manager_Ex_Reverse_Iterator_Adapter
*
@@ -860,29 +1078,41 @@ template <class T, class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS>
class ACE_Hash_Map_Manager_Ex_Reverse_Iterator_Adapter : public ACE_Reverse_Iterator_Impl<T>
{
public:
+
// = Traits.
typedef typename ACE_Hash_Map_Manager_Ex<KEY, VALUE, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex>::reverse_iterator
implementation;
+
/// Constructor.
ACE_Hash_Map_Manager_Ex_Reverse_Iterator_Adapter (const ACE_Hash_Map_Reverse_Iterator_Ex<KEY, VALUE, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex> &impl);
+
/// Destructor.
virtual ~ACE_Hash_Map_Manager_Ex_Reverse_Iterator_Adapter (void);
+
/// Clone.
virtual ACE_Reverse_Iterator_Impl<T> *clone (void) const;
+
/// Comparison.
virtual int compare (const ACE_Reverse_Iterator_Impl<T> &rhs) const;
+
/// Dereference.
virtual T dereference (void) const;
+
/// Advance.
virtual void plus_plus (void);
+
/// Reverse.
virtual void minus_minus (void);
+
/// Accessor to implementation object.
ACE_Hash_Map_Reverse_Iterator_Ex<KEY, VALUE, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex> &impl (void);
+
protected:
+
/// All implementation details are forwarded to this class.
ACE_Hash_Map_Reverse_Iterator_Ex<KEY, VALUE, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex> implementation_;
};
+
/**
* @class ACE_Hash_Map_Manager_Ex_Adapter
*
@@ -894,6 +1124,7 @@ template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class KEY_
class ACE_Hash_Map_Manager_Ex_Adapter : public ACE_Map<KEY, VALUE>
{
public:
+
// = Traits.
typedef ACE_Hash_Map_Manager_Ex_Iterator_Adapter<ACE_Reference_Pair<const KEY, VALUE>, KEY, VALUE, HASH_KEY, COMPARE_KEYS>
iterator_impl;
@@ -901,20 +1132,26 @@ public:
reverse_iterator_impl;
typedef ACE_Hash_Map_Manager_Ex<KEY, VALUE, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex>
implementation;
+
// = Initialization and termination methods.
/// Initialize with the ACE_DEFAULT_MAP_SIZE.
ACE_Hash_Map_Manager_Ex_Adapter (ACE_Allocator *alloc = 0);
+
/// Initialize with @a size entries. The @a size parameter is ignored
/// by maps for which an initialize size does not make sense.
ACE_Hash_Map_Manager_Ex_Adapter (size_t size,
ACE_Allocator *alloc = 0);
+
/// Close down and release dynamically allocated resources.
virtual ~ACE_Hash_Map_Manager_Ex_Adapter (void);
+
/// Initialize a <Map> with size @a length.
virtual int open (size_t length = ACE_DEFAULT_MAP_SIZE,
ACE_Allocator *alloc = 0);
+
/// Close down a <Map> and release dynamically allocated resources.
virtual int close (void);
+
/**
* Add @a key / @a value pair to the map. If @a key is already in the
* map then no changes are made and 1 is returned. Returns 0 on a
@@ -923,6 +1160,7 @@ public:
*/
virtual int bind (const KEY &key,
const VALUE &value);
+
/**
* Add @a key / @a value pair to the map. @a key is an "inout" parameter
* and maybe modified/extended by the map to add additional
@@ -931,6 +1169,7 @@ public:
*/
virtual int bind_modify_key (const VALUE &value,
KEY &key);
+
/**
* Produce a key and return it through @a key which is an "out"
* parameter. For maps that do not naturally produce keys, the map
@@ -940,6 +1179,7 @@ public:
* by the key generator.
*/
virtual int create_key (KEY &key);
+
/**
* Add @a value to the map, and the corresponding key produced by the
* Map is returned through @a key which is an "out" parameter. For
@@ -951,6 +1191,7 @@ public:
*/
virtual int bind_create_key (const VALUE &value,
KEY &key);
+
/**
* Add @a value to the map. The user does not care about the
* corresponding key produced by the Map. For maps that do not
@@ -961,10 +1202,12 @@ public:
* generator.
*/
virtual int bind_create_key (const VALUE &value);
+
/// Recovers the original key potentially modified by the map during
/// <bind_modify_key>.
virtual int recover_key (const KEY &modified_key,
KEY &original_key);
+
/**
* Reassociate @a key with @a value. The function fails if @a key is
* not in the map for maps that do not allow user specified keys.
@@ -973,6 +1216,7 @@ public:
*/
virtual int rebind (const KEY &key,
const VALUE &value);
+
/**
* Reassociate @a key with @a value, storing the old value into the
* "out" parameter @a old_value. The function fails if @a key is not
@@ -983,6 +1227,7 @@ public:
virtual int rebind (const KEY &key,
const VALUE &value,
VALUE &old_value);
+
/**
* Reassociate @a key with @a value, storing the old key and value
* into the "out" parameters @a old_key and @a old_value. The
@@ -995,6 +1240,7 @@ public:
const VALUE &value,
KEY &old_key,
VALUE &old_value);
+
/**
* Associate @a key with @a value if and only if @a key is not in the
* map. If @a key is already in the map, then the @a value parameter
@@ -1005,44 +1251,62 @@ public:
*/
virtual int trybind (const KEY &key,
VALUE &value);
+
/// Locate @a value associated with @a key.
virtual int find (const KEY &key,
VALUE &value);
+
/// Is @a key in the map?
virtual int find (const KEY &key);
+
/// Remove @a key from the map.
virtual int unbind (const KEY &key);
+
/// Remove @a key from the map, and return the @a value associated with
/// @a key.
virtual int unbind (const KEY &key,
VALUE &value);
+
/// Return the current size of the map.
virtual size_t current_size (void) const;
+
/// Return the total size of the map.
virtual size_t total_size (void) const;
+
/// Dump the state of an object.
virtual void dump (void) const;
+
/// Accessor to implementation object.
ACE_Hash_Map_Manager_Ex<KEY, VALUE, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex> &impl (void);
+
/// Accessor to key generator.
KEY_GENERATOR &key_generator (void);
+
protected:
+
/// All implementation details are forwarded to this class.
ACE_Hash_Map_Manager_Ex<KEY, VALUE, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex> implementation_;
+
/// Functor class used for generating key.
KEY_GENERATOR key_generator_;
+
// = STL styled iterator factory functions.
+
/// Return forward iterator.
virtual ACE_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *begin_impl (void);
virtual ACE_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *end_impl (void);
+
/// Return reverse iterator.
virtual ACE_Reverse_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *rbegin_impl (void);
virtual ACE_Reverse_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *rend_impl (void);
+
private:
+
// = Disallow these operations.
ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Hash_Map_Manager_Ex_Adapter<KEY, VALUE, HASH_KEY, COMPARE_KEYS, KEY_GENERATOR> &))
ACE_UNIMPLEMENTED_FUNC (ACE_Hash_Map_Manager_Ex_Adapter (const ACE_Hash_Map_Manager_Ex_Adapter<KEY, VALUE, HASH_KEY, COMPARE_KEYS, KEY_GENERATOR> &))
};
+
/**
* @class ACE_Map_Manager_Iterator_Adapter
*
@@ -1054,29 +1318,41 @@ template <class T, class KEY, class VALUE>
class ACE_Map_Manager_Iterator_Adapter : public ACE_Iterator_Impl<T>
{
public:
+
// = Traits.
typedef typename ACE_Map_Manager<KEY, VALUE, ACE_Null_Mutex>::iterator
implementation;
+
/// Constructor.
ACE_Map_Manager_Iterator_Adapter (const ACE_Map_Iterator<KEY, VALUE, ACE_Null_Mutex> &impl);
+
/// Destructor.
virtual ~ACE_Map_Manager_Iterator_Adapter (void);
+
/// Clone.
virtual ACE_Iterator_Impl<T> *clone (void) const;
+
/// Comparison.
virtual int compare (const ACE_Iterator_Impl<T> &rhs) const;
+
/// Dereference.
virtual T dereference (void) const;
+
/// Advance.
virtual void plus_plus (void);
+
/// Reverse.
virtual void minus_minus (void);
+
/// Accessor to implementation object.
ACE_Map_Iterator<KEY, VALUE, ACE_Null_Mutex> &impl (void);
+
protected:
+
/// All implementation details are forwarded to this class.
ACE_Map_Iterator<KEY, VALUE, ACE_Null_Mutex> implementation_;
};
+
/**
* @class ACE_Map_Manager_Reverse_Iterator_Adapter
*
@@ -1088,29 +1364,41 @@ template <class T, class KEY, class VALUE>
class ACE_Map_Manager_Reverse_Iterator_Adapter : public ACE_Reverse_Iterator_Impl<T>
{
public:
+
// = Traits.
typedef typename ACE_Map_Manager<KEY, VALUE, ACE_Null_Mutex>::reverse_iterator
implementation;
+
/// Constructor.
ACE_Map_Manager_Reverse_Iterator_Adapter (const ACE_Map_Reverse_Iterator<KEY, VALUE, ACE_Null_Mutex> &impl);
+
/// Destructor.
virtual ~ACE_Map_Manager_Reverse_Iterator_Adapter (void);
+
/// Clone.
virtual ACE_Reverse_Iterator_Impl<T> *clone (void) const;
+
/// Comparison.
virtual int compare (const ACE_Reverse_Iterator_Impl<T> &rhs) const;
+
/// Dereference.
virtual T dereference (void) const;
+
/// Advance.
virtual void plus_plus (void);
+
/// Reverse.
virtual void minus_minus (void);
+
/// Accessor to implementation object.
ACE_Map_Reverse_Iterator<KEY, VALUE, ACE_Null_Mutex> &impl (void);
+
protected:
+
/// All implementation details are forwarded to this class.
ACE_Map_Reverse_Iterator<KEY, VALUE, ACE_Null_Mutex> implementation_;
};
+
/**
* @class ACE_Map_Manager_Adapter
*
@@ -1122,6 +1410,7 @@ template <class KEY, class VALUE, class KEY_GENERATOR>
class ACE_Map_Manager_Adapter : public ACE_Map<KEY, VALUE>
{
public:
+
// = Traits.
typedef ACE_Map_Manager_Iterator_Adapter<ACE_Reference_Pair<const KEY, VALUE>, KEY, VALUE>
iterator_impl;
@@ -1129,20 +1418,26 @@ public:
reverse_iterator_impl;
typedef ACE_Map_Manager<KEY, VALUE, ACE_Null_Mutex>
implementation;
+
// = Initialization and termination methods.
/// Initialize with the ACE_DEFAULT_MAP_SIZE.
ACE_Map_Manager_Adapter (ACE_Allocator *alloc = 0);
+
/// Initialize with @a size entries. The @a size parameter is ignored
/// by maps for which an initialize size does not make sense.
ACE_Map_Manager_Adapter (size_t size,
ACE_Allocator *alloc = 0);
+
/// Close down and release dynamically allocated resources.
virtual ~ACE_Map_Manager_Adapter (void);
+
/// Initialize a <Map> with size @a length.
virtual int open (size_t length = ACE_DEFAULT_MAP_SIZE,
ACE_Allocator *alloc = 0);
+
/// Close down a <Map> and release dynamically allocated resources.
virtual int close (void);
+
/**
* Add @a key / @a value pair to the map. If @a key is already in the
* map then no changes are made and 1 is returned. Returns 0 on a
@@ -1151,6 +1446,7 @@ public:
*/
virtual int bind (const KEY &key,
const VALUE &value);
+
/**
* Add @a key / @a value pair to the map. @a key is an "inout" parameter
* and maybe modified/extended by the map to add additional
@@ -1159,6 +1455,7 @@ public:
*/
virtual int bind_modify_key (const VALUE &value,
KEY &key);
+
/**
* Produce a key and return it through @a key which is an "out"
* parameter. For maps that do not naturally produce keys, the map
@@ -1168,6 +1465,7 @@ public:
* by the key generator.
*/
virtual int create_key (KEY &key);
+
/**
* Add @a value to the map, and the corresponding key produced by the
* Map is returned through @a key which is an "out" parameter. For
@@ -1179,6 +1477,7 @@ public:
*/
virtual int bind_create_key (const VALUE &value,
KEY &key);
+
/**
* Add @a value to the map. The user does not care about the
* corresponding key produced by the Map. For maps that do not
@@ -1189,10 +1488,12 @@ public:
* generator.
*/
virtual int bind_create_key (const VALUE &value);
+
/// Recovers the original key potentially modified by the map during
/// <bind_modify_key>.
virtual int recover_key (const KEY &modified_key,
KEY &original_key);
+
/**
* Reassociate @a key with @a value. The function fails if @a key is
* not in the map for maps that do not allow user specified keys.
@@ -1201,6 +1502,7 @@ public:
*/
virtual int rebind (const KEY &key,
const VALUE &value);
+
/**
* Reassociate @a key with @a value, storing the old value into the
* "out" parameter @a old_value. The function fails if @a key is not
@@ -1211,6 +1513,7 @@ public:
virtual int rebind (const KEY &key,
const VALUE &value,
VALUE &old_value);
+
/**
* Reassociate @a key with @a value, storing the old key and value
* into the "out" parameters @a old_key and @a old_value. The
@@ -1223,6 +1526,7 @@ public:
const VALUE &value,
KEY &old_key,
VALUE &old_value);
+
/**
* Associate @a key with @a value if and only if @a key is not in the
* map. If @a key is already in the map, then the @a value parameter
@@ -1233,54 +1537,76 @@ public:
*/
virtual int trybind (const KEY &key,
VALUE &value);
+
/// Locate @a value associated with @a key.
virtual int find (const KEY &key,
VALUE &value);
+
/// Is @a key in the map?
virtual int find (const KEY &key);
+
/// Remove @a key from the map.
virtual int unbind (const KEY &key);
+
/// Remove @a key from the map, and return the @a value associated with
/// @a key.
virtual int unbind (const KEY &key,
VALUE &value);
+
/// Return the current size of the map.
virtual size_t current_size (void) const;
+
/// Return the total size of the map.
virtual size_t total_size (void) const;
+
/// Dump the state of an object.
virtual void dump (void) const;
+
/// Accessor to implementation object.
ACE_Map_Manager<KEY, VALUE, ACE_Null_Mutex> &impl (void);
+
/// Accessor to key generator.
KEY_GENERATOR &key_generator (void);
+
protected:
+
/// All implementation details are forwarded to this class.
ACE_Map_Manager<KEY, VALUE, ACE_Null_Mutex> implementation_;
+
/// Functor class used for generating key.
KEY_GENERATOR key_generator_;
+
// = STL styled iterator factory functions.
+
/// Return forward iterator.
virtual ACE_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *begin_impl (void);
virtual ACE_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *end_impl (void);
+
/// Return reverse iterator.
virtual ACE_Reverse_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *rbegin_impl (void);
virtual ACE_Reverse_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *rend_impl (void);
+
private:
+
// = Disallow these operations.
ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Map_Manager_Adapter<KEY, VALUE, KEY_GENERATOR> &))
ACE_UNIMPLEMENTED_FUNC (ACE_Map_Manager_Adapter (const ACE_Map_Manager_Adapter<KEY, VALUE, KEY_GENERATOR> &))
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Map_T.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Map_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Map_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
#endif /* ACE_MAP_T_H */
diff --git a/dep/ACE_wrappers/ace/Map_T.inl b/dep/ACE_wrappers/ace/Map_T.inl
index 051793df073..adf32eb91c9 100644
--- a/dep/ACE_wrappers/ace/Map_T.inl
+++ b/dep/ACE_wrappers/ace/Map_T.inl
@@ -1,43 +1,52 @@
// -*- C++ -*-
//
// $Id: Map_T.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template <class T> ACE_INLINE int
ACE_Noop_Key_Generator<T>::operator() (T &)
{
return -1;
}
+
template <class T> ACE_INLINE
ACE_Incremental_Key_Generator<T>::ACE_Incremental_Key_Generator (void)
: t_ (0)
{
}
+
template <class T> ACE_INLINE int
ACE_Incremental_Key_Generator<T>::operator() (T &t)
{
t = ++this->t_;
return 0;
}
+
template <class T> ACE_INLINE const T &
ACE_Incremental_Key_Generator<T>::current_value (void) const
{
return this->t_;
}
+
template <class T> ACE_INLINE
ACE_Iterator<T>::ACE_Iterator (ACE_Iterator_Impl<T> *impl)
: implementation_ (impl)
{
}
+
template <class T> ACE_INLINE
ACE_Iterator<T>::ACE_Iterator (const ACE_Iterator<T> &rhs)
: implementation_ (rhs.implementation_->clone ())
{
}
+
template <class T> ACE_INLINE
ACE_Iterator<T>::~ACE_Iterator (void)
{
delete this->implementation_;
}
+
template <class T> ACE_INLINE ACE_Iterator<T> &
ACE_Iterator<T>::operator= (const ACE_Iterator<T> &rhs)
{
@@ -45,27 +54,32 @@ ACE_Iterator<T>::operator= (const ACE_Iterator<T> &rhs)
this->implementation_ = rhs.implementation_->clone ();
return *this;
}
+
template <class T> ACE_INLINE bool
ACE_Iterator<T>::operator== (const ACE_Iterator<T> &rhs) const
{
return this->implementation_->compare (*rhs.implementation_);
}
+
template <class T> ACE_INLINE bool
ACE_Iterator<T>::operator!= (const ACE_Iterator<T> &rhs) const
{
return !this->operator== (rhs);
}
+
template <class T> ACE_INLINE T
ACE_Iterator<T>::operator* (void) const
{
return this->implementation_->dereference ();
}
+
template <class T> ACE_INLINE ACE_Iterator<T> &
ACE_Iterator<T>::operator++ (void)
{
this->implementation_->plus_plus ();
return *this;
}
+
template <class T> ACE_INLINE ACE_Iterator<T>
ACE_Iterator<T>::operator++ (int)
{
@@ -73,12 +87,14 @@ ACE_Iterator<T>::operator++ (int)
this->implementation_->plus_plus ();
return tmp;
}
+
template <class T> ACE_INLINE ACE_Iterator<T> &
ACE_Iterator<T>::operator-- (void)
{
this->implementation_->minus_minus ();
return *this;
}
+
template <class T> ACE_INLINE ACE_Iterator<T>
ACE_Iterator<T>::operator-- (int)
{
@@ -86,26 +102,31 @@ ACE_Iterator<T>::operator-- (int)
this->implementation_->minus_minus ();
return tmp;
}
+
template <class T> ACE_INLINE ACE_Iterator_Impl<T> &
ACE_Iterator<T>::impl (void)
{
return *this->implementation_;
}
+
template <class T> ACE_INLINE
ACE_Reverse_Iterator<T>::ACE_Reverse_Iterator (ACE_Reverse_Iterator_Impl<T> *impl)
: implementation_ (impl)
{
}
+
template <class T> ACE_INLINE
ACE_Reverse_Iterator<T>::ACE_Reverse_Iterator (const ACE_Reverse_Iterator<T> &rhs)
: implementation_ (rhs.implementation_->clone ())
{
}
+
template <class T> ACE_INLINE
ACE_Reverse_Iterator<T>::~ACE_Reverse_Iterator (void)
{
delete this->implementation_;
}
+
template <class T> ACE_INLINE ACE_Reverse_Iterator<T> &
ACE_Reverse_Iterator<T>::operator= (const ACE_Reverse_Iterator<T> &rhs)
{
@@ -113,27 +134,32 @@ ACE_Reverse_Iterator<T>::operator= (const ACE_Reverse_Iterator<T> &rhs)
this->implementation_ = rhs.implementation_->clone ();
return *this;
}
+
template <class T> ACE_INLINE bool
ACE_Reverse_Iterator<T>::operator== (const ACE_Reverse_Iterator<T> &rhs) const
{
return this->implementation_->compare (*rhs.implementation_);
}
+
template <class T> ACE_INLINE bool
ACE_Reverse_Iterator<T>::operator!= (const ACE_Reverse_Iterator<T> &rhs) const
{
return !this->operator== (rhs);
}
+
template <class T> ACE_INLINE T
ACE_Reverse_Iterator<T>::operator* (void) const
{
return this->implementation_->dereference ();
}
+
template <class T> ACE_INLINE ACE_Reverse_Iterator<T> &
ACE_Reverse_Iterator<T>::operator++ (void)
{
this->implementation_->plus_plus ();
return *this;
}
+
template <class T> ACE_INLINE ACE_Reverse_Iterator<T>
ACE_Reverse_Iterator<T>::operator++ (int)
{
@@ -141,12 +167,14 @@ ACE_Reverse_Iterator<T>::operator++ (int)
this->implementation_->plus_plus ();
return tmp;
}
+
template <class T> ACE_INLINE ACE_Reverse_Iterator<T> &
ACE_Reverse_Iterator<T>::operator-- (void)
{
this->implementation_->minus_minus ();
return *this;
}
+
template <class T> ACE_INLINE ACE_Reverse_Iterator<T>
ACE_Reverse_Iterator<T>::operator-- (int)
{
@@ -154,60 +182,72 @@ ACE_Reverse_Iterator<T>::operator-- (int)
this->implementation_->minus_minus ();
return tmp;
}
+
template <class T> ACE_INLINE ACE_Reverse_Iterator_Impl<T> &
ACE_Reverse_Iterator<T>::impl (void)
{
return *this->implementation_;
}
+
template <class KEY, class VALUE> ACE_INLINE
ACE_Map<KEY, VALUE>::ACE_Map (void)
{
}
+
template <class KEY, class VALUE> ACE_INLINE ACE_Iterator<ACE_Reference_Pair<const KEY, VALUE> >
ACE_Map<KEY, VALUE>::begin (void)
{
return iterator (this->begin_impl ());
}
+
template <class KEY, class VALUE> ACE_INLINE ACE_Iterator<ACE_Reference_Pair<const KEY, VALUE> >
ACE_Map<KEY, VALUE>::end (void)
{
return iterator (this->end_impl ());
}
+
template <class KEY, class VALUE> ACE_INLINE ACE_Reverse_Iterator<ACE_Reference_Pair<const KEY, VALUE> >
ACE_Map<KEY, VALUE>::rbegin (void)
{
return reverse_iterator (this->rbegin_impl ());
}
+
template <class KEY, class VALUE> ACE_INLINE ACE_Reverse_Iterator<ACE_Reference_Pair<const KEY, VALUE> >
ACE_Map<KEY, VALUE>::rend (void)
{
return reverse_iterator (this->rend_impl ());
}
+
template <class T, class IMPLEMENTATION, class ENTRY> ACE_INLINE
ACE_Map_Impl_Iterator_Adapter<T, IMPLEMENTATION, ENTRY>::ACE_Map_Impl_Iterator_Adapter (const IMPLEMENTATION &impl)
: implementation_ (impl)
{
}
+
template <class T, class IMPLEMENTATION, class ENTRY> ACE_INLINE IMPLEMENTATION &
ACE_Map_Impl_Iterator_Adapter<T, IMPLEMENTATION, ENTRY>::impl (void)
{
return this->implementation_;
}
+
template <class T, class IMPLEMENTATION, class ENTRY> ACE_INLINE
ACE_Map_Impl_Reverse_Iterator_Adapter<T, IMPLEMENTATION, ENTRY>::ACE_Map_Impl_Reverse_Iterator_Adapter (const IMPLEMENTATION &impl)
: implementation_ (impl)
{
}
+
template <class T, class IMPLEMENTATION, class ENTRY> ACE_INLINE IMPLEMENTATION &
ACE_Map_Impl_Reverse_Iterator_Adapter<T, IMPLEMENTATION, ENTRY>::impl (void)
{
return this->implementation_;
}
+
template <class KEY, class VALUE, class IMPLEMENTATION, class ITERATOR, class REVERSE_ITERATOR, class ENTRY> ACE_INLINE
ACE_Map_Impl<KEY, VALUE, IMPLEMENTATION, ITERATOR, REVERSE_ITERATOR, ENTRY>::ACE_Map_Impl (ACE_Allocator *alloc)
: implementation_ (alloc)
{
}
+
template <class KEY, class VALUE, class IMPLEMENTATION, class ITERATOR, class REVERSE_ITERATOR, class ENTRY> ACE_INLINE
ACE_Map_Impl<KEY, VALUE, IMPLEMENTATION, ITERATOR, REVERSE_ITERATOR, ENTRY>::ACE_Map_Impl (size_t size,
ACE_Allocator *alloc)
@@ -215,36 +255,43 @@ ACE_Map_Impl<KEY, VALUE, IMPLEMENTATION, ITERATOR, REVERSE_ITERATOR, ENTRY>::ACE
alloc)
{
}
+
template <class KEY, class VALUE, class IMPLEMENTATION, class ITERATOR, class REVERSE_ITERATOR, class ENTRY> ACE_INLINE IMPLEMENTATION &
ACE_Map_Impl<KEY, VALUE, IMPLEMENTATION, ITERATOR, REVERSE_ITERATOR, ENTRY>::impl (void)
{
return this->implementation_;
}
+
template <class T, class VALUE> ACE_INLINE
ACE_Active_Map_Manager_Iterator_Adapter<T, VALUE>::ACE_Active_Map_Manager_Iterator_Adapter (const ACE_Map_Iterator<ACE_Active_Map_Manager_Key, VALUE, ACE_Null_Mutex> &impl)
: implementation_ (impl)
{
}
+
template <class T, class VALUE> ACE_INLINE ACE_Map_Iterator<ACE_Active_Map_Manager_Key, VALUE, ACE_Null_Mutex> &
ACE_Active_Map_Manager_Iterator_Adapter<T, VALUE>::impl (void)
{
return this->implementation_;
}
+
template <class T, class VALUE> ACE_INLINE
ACE_Active_Map_Manager_Reverse_Iterator_Adapter<T, VALUE>::ACE_Active_Map_Manager_Reverse_Iterator_Adapter (const ACE_Map_Reverse_Iterator<ACE_Active_Map_Manager_Key, VALUE, ACE_Null_Mutex> &impl)
: implementation_ (impl)
{
}
+
template <class T, class VALUE> ACE_INLINE ACE_Map_Reverse_Iterator<ACE_Active_Map_Manager_Key, VALUE, ACE_Null_Mutex> &
ACE_Active_Map_Manager_Reverse_Iterator_Adapter<T, VALUE>::impl (void)
{
return this->implementation_;
}
+
template <class KEY, class VALUE, class KEY_ADAPTER> ACE_INLINE
ACE_Active_Map_Manager_Adapter<KEY, VALUE, KEY_ADAPTER>::ACE_Active_Map_Manager_Adapter (ACE_Allocator *alloc)
: implementation_ (alloc)
{
}
+
template <class KEY, class VALUE, class KEY_ADAPTER> ACE_INLINE
ACE_Active_Map_Manager_Adapter<KEY, VALUE, KEY_ADAPTER>::ACE_Active_Map_Manager_Adapter (size_t size,
ACE_Allocator *alloc)
@@ -252,41 +299,49 @@ ACE_Active_Map_Manager_Adapter<KEY, VALUE, KEY_ADAPTER>::ACE_Active_Map_Manager_
alloc)
{
}
+
template <class KEY, class VALUE, class KEY_ADAPTER> ACE_INLINE ACE_Active_Map_Manager<ACE_Pair<KEY, VALUE> > &
ACE_Active_Map_Manager_Adapter<KEY, VALUE, KEY_ADAPTER>::impl (void)
{
return this->implementation_;
}
+
template <class KEY, class VALUE, class KEY_ADAPTER> ACE_INLINE KEY_ADAPTER &
ACE_Active_Map_Manager_Adapter<KEY, VALUE, KEY_ADAPTER>::key_adapter (void)
{
return this->key_adapter_;
}
+
template <class T, class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS> ACE_INLINE
ACE_Hash_Map_Manager_Ex_Iterator_Adapter<T, KEY, VALUE, HASH_KEY, COMPARE_KEYS>::ACE_Hash_Map_Manager_Ex_Iterator_Adapter (const ACE_Hash_Map_Iterator_Ex<KEY, VALUE, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex> &impl)
: implementation_ (impl)
{
}
+
template <class T, class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS> ACE_INLINE ACE_Hash_Map_Iterator_Ex<KEY, VALUE, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex> &
ACE_Hash_Map_Manager_Ex_Iterator_Adapter<T, KEY, VALUE, HASH_KEY, COMPARE_KEYS>::impl (void)
{
return this->implementation_;
}
+
template <class T, class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS> ACE_INLINE
ACE_Hash_Map_Manager_Ex_Reverse_Iterator_Adapter<T, KEY, VALUE, HASH_KEY, COMPARE_KEYS>::ACE_Hash_Map_Manager_Ex_Reverse_Iterator_Adapter (const ACE_Hash_Map_Reverse_Iterator_Ex<KEY, VALUE, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex> &impl)
: implementation_ (impl)
{
}
+
template <class T, class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS> ACE_INLINE ACE_Hash_Map_Reverse_Iterator_Ex<KEY, VALUE, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex> &
ACE_Hash_Map_Manager_Ex_Reverse_Iterator_Adapter<T, KEY, VALUE, HASH_KEY, COMPARE_KEYS>::impl (void)
{
return this->implementation_;
}
+
template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class KEY_GENERATOR> ACE_INLINE
ACE_Hash_Map_Manager_Ex_Adapter<KEY, VALUE, HASH_KEY, COMPARE_KEYS, KEY_GENERATOR>::ACE_Hash_Map_Manager_Ex_Adapter (ACE_Allocator *alloc)
: implementation_ (alloc)
{
}
+
template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class KEY_GENERATOR> ACE_INLINE
ACE_Hash_Map_Manager_Ex_Adapter<KEY, VALUE, HASH_KEY, COMPARE_KEYS, KEY_GENERATOR>::ACE_Hash_Map_Manager_Ex_Adapter (size_t size,
ACE_Allocator *alloc)
@@ -294,41 +349,49 @@ ACE_Hash_Map_Manager_Ex_Adapter<KEY, VALUE, HASH_KEY, COMPARE_KEYS, KEY_GENERATO
alloc)
{
}
+
template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class KEY_GENERATOR> ACE_INLINE ACE_Hash_Map_Manager_Ex<KEY, VALUE, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex> &
ACE_Hash_Map_Manager_Ex_Adapter<KEY, VALUE, HASH_KEY, COMPARE_KEYS, KEY_GENERATOR>::impl (void)
{
return this->implementation_;
}
+
template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class KEY_GENERATOR> ACE_INLINE KEY_GENERATOR &
ACE_Hash_Map_Manager_Ex_Adapter<KEY, VALUE, HASH_KEY, COMPARE_KEYS, KEY_GENERATOR>::key_generator (void)
{
return this->key_generator_;
}
+
template <class T, class KEY, class VALUE> ACE_INLINE
ACE_Map_Manager_Iterator_Adapter<T, KEY, VALUE>::ACE_Map_Manager_Iterator_Adapter (const ACE_Map_Iterator<KEY, VALUE, ACE_Null_Mutex> &impl)
: implementation_ (impl)
{
}
+
template <class T, class KEY, class VALUE> ACE_INLINE ACE_Map_Iterator<KEY, VALUE, ACE_Null_Mutex> &
ACE_Map_Manager_Iterator_Adapter<T, KEY, VALUE>::impl (void)
{
return this->implementation_;
}
+
template <class T, class KEY, class VALUE> ACE_INLINE
ACE_Map_Manager_Reverse_Iterator_Adapter<T, KEY, VALUE>::ACE_Map_Manager_Reverse_Iterator_Adapter (const ACE_Map_Reverse_Iterator<KEY, VALUE, ACE_Null_Mutex> &impl)
: implementation_ (impl)
{
}
+
template <class T, class KEY, class VALUE> ACE_INLINE ACE_Map_Reverse_Iterator<KEY, VALUE, ACE_Null_Mutex> &
ACE_Map_Manager_Reverse_Iterator_Adapter<T, KEY, VALUE>::impl (void)
{
return this->implementation_;
}
+
template <class KEY, class VALUE, class KEY_GENERATOR> ACE_INLINE
ACE_Map_Manager_Adapter<KEY, VALUE, KEY_GENERATOR>::ACE_Map_Manager_Adapter (ACE_Allocator *alloc)
: implementation_ (alloc)
{
}
+
template <class KEY, class VALUE, class KEY_GENERATOR> ACE_INLINE
ACE_Map_Manager_Adapter<KEY, VALUE, KEY_GENERATOR>::ACE_Map_Manager_Adapter (size_t size,
ACE_Allocator *alloc)
@@ -336,14 +399,17 @@ ACE_Map_Manager_Adapter<KEY, VALUE, KEY_GENERATOR>::ACE_Map_Manager_Adapter (siz
alloc)
{
}
+
template <class KEY, class VALUE, class KEY_GENERATOR> ACE_INLINE ACE_Map_Manager<KEY, VALUE, ACE_Null_Mutex> &
ACE_Map_Manager_Adapter<KEY, VALUE, KEY_GENERATOR>::impl (void)
{
return this->implementation_;
}
+
template <class KEY, class VALUE, class KEY_GENERATOR> ACE_INLINE KEY_GENERATOR &
ACE_Map_Manager_Adapter<KEY, VALUE, KEY_GENERATOR>::key_generator (void)
{
return this->key_generator_;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Mem_Map.cpp b/dep/ACE_wrappers/ace/Mem_Map.cpp
index 2f19639489c..1c79d93f33c 100644
--- a/dep/ACE_wrappers/ace/Mem_Map.cpp
+++ b/dep/ACE_wrappers/ace/Mem_Map.cpp
@@ -1,23 +1,31 @@
// $Id: Mem_Map.cpp 80826 2008-03-04 14:51:23Z wotte $
+
// Defines the member functions for the memory mapping facility.
+
#include "ace/Mem_Map.h"
#if !defined (__ACE_INLINE__)
#include "ace/Mem_Map.inl"
#endif /* __ACE_INLINE__ */
+
#include "ace/OS_NS_sys_stat.h"
#include "ace/OS_NS_fcntl.h"
#include "ace/OS_NS_string.h"
#include "ace/Log_Msg.h"
#include "ace/Truncate.h"
+
ACE_RCSID(ace, Mem_Map, "Mem_Map.cpp,v 4.39 2003/11/01 11:15:13 dhinton Exp")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_Mem_Map)
+
void
ACE_Mem_Map::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_Mem_Map::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("base_addr_ = %x"), this->base_addr_));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nfilename_ = %s"), this->filename_));
@@ -28,20 +36,27 @@ ACE_Mem_Map::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
int
ACE_Mem_Map::close (void)
{
ACE_TRACE ("ACE_Mem_Map::close");
+
this->unmap ();
+
return this->close_handle ();
}
+
ACE_Mem_Map::~ACE_Mem_Map (void)
{
ACE_TRACE ("ACE_Mem_Map::~ACE_Mem_Map");
+
this->close ();
}
+
// This function does the dirty work of actually calling ACE_OS::mmap
// to map the file into memory.
+
int
ACE_Mem_Map::map_it (ACE_HANDLE handle,
size_t length_request,
@@ -52,6 +67,7 @@ ACE_Mem_Map::map_it (ACE_HANDLE handle,
LPSECURITY_ATTRIBUTES sa)
{
ACE_TRACE ("ACE_Mem_Map::map_it");
+
#if defined (ACE_LACKS_AUTO_MMAP_REPLACEMENT)
// If the system does not replace any previous mappings, then
// unmap() before (potentially) mapping to the same location.
@@ -59,14 +75,19 @@ ACE_Mem_Map::map_it (ACE_HANDLE handle,
if (unmap_result != 0)
return unmap_result;
#endif /* ACE_LACKS_AUTO_MMAP_REPLACEMENT */
+
this->base_addr_ = addr;
this->handle_ = handle;
+
// Get the current filesize
ACE_OFF_T const current_file_length = ACE_OS::filesize (this->handle_);
+
// Flag to indicate if we need to extend the back store
bool extend_backing_store = false;
+
// File length requested by user
ACE_OFF_T requested_file_length = 0;
+
// Check <length_request>
if (length_request == static_cast<size_t> (-1))
{
@@ -80,8 +101,10 @@ ACE_Mem_Map::map_it (ACE_HANDLE handle,
+ static_cast<ACE_UINT64> (offset)
> static_cast<ACE_UINT64> (ACE_Numeric_Limits<ACE_OFF_T>::max ()))
return -1;
+
// File length implicitly requested by user
requested_file_length = static_cast<ACE_OFF_T> (length_request) + offset;
+
// Check to see if we need to extend the backing store
if (requested_file_length > current_file_length)
{
@@ -90,12 +113,15 @@ ACE_Mem_Map::map_it (ACE_HANDLE handle,
// by setting the descriptor to ACE_INVALID_HANDLE (closing
// down the descriptor if necessary).
this->close_filemapping_handle ();
+
// Remember to extend the backing store
extend_backing_store = true;
}
+
// Set length to length_request
this->length_ = length_request;
}
+
// Check if we need to extend the backing store.
if (extend_backing_store)
{
@@ -106,12 +132,14 @@ ACE_Mem_Map::map_it (ACE_HANDLE handle,
// This will make the file size <requested_file_length>
null_byte_position = requested_file_length - 1;
}
+
if (ACE_OS::pwrite (this->handle_,
"",
1,
null_byte_position) == -1)
return -1;
}
+
this->base_addr_ = ACE_OS::mmap (this->base_addr_,
this->length_,
prot,
@@ -120,8 +148,10 @@ ACE_Mem_Map::map_it (ACE_HANDLE handle,
offset,
&this->file_mapping_,
sa);
+
return this->base_addr_ == MAP_FAILED ? -1 : 0;
}
+
int
ACE_Mem_Map::open (const ACE_TCHAR *file_name,
int flags,
@@ -129,6 +159,7 @@ ACE_Mem_Map::open (const ACE_TCHAR *file_name,
LPSECURITY_ATTRIBUTES sa)
{
ACE_TRACE ("ACE_Mem_Map::open");
+
#if defined (INTEGRITY) || defined (__QNXNTO__) || defined (ACE_VXWORKS)
this->handle_ = ACE_OS::shm_open (file_name, flags, perms, sa);
#elif defined (ACE_OPENVMS)
@@ -136,6 +167,7 @@ ACE_Mem_Map::open (const ACE_TCHAR *file_name,
#else
this->handle_ = ACE_OS::open (file_name, flags, perms, sa);
#endif /* INTEGRITY */
+
if (this->handle_ == ACE_INVALID_HANDLE)
return -1;
else
@@ -143,10 +175,12 @@ ACE_Mem_Map::open (const ACE_TCHAR *file_name,
ACE_OS::strsncpy (this->filename_,
file_name,
MAXPATHLEN);
+
this->close_handle_ = true;
return 0;
}
}
+
int
ACE_Mem_Map::map (const ACE_TCHAR *file_name,
size_t len,
@@ -160,6 +194,7 @@ ACE_Mem_Map::map (const ACE_TCHAR *file_name,
{
ACE_TRACE ("ACE_Mem_Map::map");
this->length_ = 0;
+
if (this->open (file_name,
flags,
mode,
@@ -174,6 +209,7 @@ ACE_Mem_Map::map (const ACE_TCHAR *file_name,
offset,
sa);
}
+
ACE_Mem_Map::ACE_Mem_Map (void)
: base_addr_ (MAP_FAILED),
length_ (0),
@@ -184,7 +220,9 @@ ACE_Mem_Map::ACE_Mem_Map (void)
ACE_TRACE ("ACE_Mem_Map::ACE_Mem_Map");
ACE_OS::memset (this->filename_, 0, sizeof this->filename_);
}
+
// Map a file specified by FILE_NAME.
+
ACE_Mem_Map::ACE_Mem_Map (const ACE_TCHAR *file_name,
size_t len,
int flags,
@@ -214,8 +252,10 @@ ACE_Mem_Map::ACE_Mem_Map (const ACE_TCHAR *file_name,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_Mem_Map::ACE_Mem_Map")));
}
+
// Map a file from an open file descriptor HANDLE. This function will
// lookup the length of the file if it is not given.
+
ACE_Mem_Map::ACE_Mem_Map (ACE_HANDLE handle,
size_t len,
int prot,
@@ -230,6 +270,7 @@ ACE_Mem_Map::ACE_Mem_Map (ACE_HANDLE handle,
close_handle_ (false)
{
ACE_TRACE ("ACE_Mem_Map::ACE_Mem_Map");
+
ACE_OS::memset (this->filename_,
0,
sizeof this->filename_);
@@ -244,21 +285,27 @@ ACE_Mem_Map::ACE_Mem_Map (ACE_HANDLE handle,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_Mem_Map::ACE_Mem_Map")));
}
+
// Close down and remove the file from the file system.
+
int
ACE_Mem_Map::remove (void)
{
ACE_TRACE ("ACE_Mem_Map::remove");
+
ACE_OS::ftruncate (this->handle_, 0);
this->close ();
+
if (this->filename_[0] != '\0')
#if defined (INTEGRITY) || defined (__QNXNTO__) || defined (ACE_VXWORKS)
return ACE_OS::shm_unlink (this->filename_);
#else
return ACE_OS::unlink (this->filename_);
#endif /* __QNXNTO__ */
+
else
return 0;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Mem_Map.h b/dep/ACE_wrappers/ace/Mem_Map.h
index 07a53e51d38..5ef4634cfbd 100644
--- a/dep/ACE_wrappers/ace/Mem_Map.h
+++ b/dep/ACE_wrappers/ace/Mem_Map.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file Mem_Map.h
@@ -8,19 +9,26 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//==========================================================================
+
#ifndef ACE_MEM_MAP_H
#define ACE_MEM_MAP_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Global_Macros.h"
#include "ace/os_include/sys/os_mman.h"
#include "ace/os_include/os_limits.h"
#include "ace/os_include/os_fcntl.h"
#include "ace/Default_Constants.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Mem_Map
*
@@ -33,8 +41,10 @@ class ACE_Export ACE_Mem_Map
{
public:
// = Initialization and termination methods.
+
/// Default constructor.
ACE_Mem_Map (void);
+
/// Map a file from an open file descriptor @a handle. This function
/// will lookup the length of the file if it is not given.
ACE_Mem_Map (ACE_HANDLE handle,
@@ -44,6 +54,7 @@ public:
void *addr = 0,
ACE_OFF_T offset = 0,
LPSECURITY_ATTRIBUTES sa = 0);
+
/// Map a file specified by @a file_name.
ACE_Mem_Map (const ACE_TCHAR *filename,
size_t length = static_cast<size_t> (-1),
@@ -54,6 +65,7 @@ public:
void *addr = 0,
ACE_OFF_T offset = 0,
LPSECURITY_ATTRIBUTES sa = 0);
+
/// Map a file from an open file descriptor @a handle. This function
/// will lookup the length of the file if it is not given.
int map (ACE_HANDLE handle,
@@ -63,6 +75,7 @@ public:
void *addr = 0,
ACE_OFF_T offset = 0,
LPSECURITY_ATTRIBUTES sa = 0);
+
/// Remap the file associated with <handle_>.
int map (size_t length = static_cast<size_t> (-1),
int prot = PROT_RDWR,
@@ -70,6 +83,7 @@ public:
void *addr = 0,
ACE_OFF_T offset = 0,
LPSECURITY_ATTRIBUTES sa = 0);
+
/// Map a file specified by @a filename.
int map (const ACE_TCHAR *filename,
size_t length = static_cast<size_t> (-1),
@@ -80,75 +94,99 @@ public:
void *addr = 0,
ACE_OFF_T offset = 0,
LPSECURITY_ATTRIBUTES sa = 0);
+
/// Destructor.
~ACE_Mem_Map (void);
+
/// Open the file without mapping it.
int open (const ACE_TCHAR *filename,
int flags = O_RDWR | O_CREAT,
mode_t perms = ACE_DEFAULT_FILE_PERMS,
LPSECURITY_ATTRIBUTES sa = 0);
+
/// Close down the <handle_> if necessary and unmap the mapping.
int close (void);
+
/// Close down the <handle_> if necessary.
int close_handle (void);
+
/**
* Close down the internal <file_mapping_> if necessary. This is
* mostly necessary on Win32, which has a different handle for
* file-mapping kernel object.
*/
int close_filemapping_handle (void);
+
/// This operator passes back the starting address of the mapped
/// file.
int operator () (void *&addr);
+
/// Return the base address.
void *addr (void) const;
+
/// This function returns the number of bytes currently mapped in the
/// file.
size_t size (void) const;
+
/// Unmap the region starting at <base_addr_>.
int unmap (ssize_t len = -1);
+
/// Unmap the region starting at <addr_>.
int unmap (void *addr, ssize_t len);
+
/**
* Sync @a len bytes of the memory region to the backing store
* starting at <base_addr_>. If @a len == -1 then sync the whole
* region.
*/
int sync (size_t len, int flags = MS_SYNC);
+
/**
* Sync the whole memory region to the backing store
* starting at <base_addr_>.
*/
int sync (int flags = MS_SYNC);
+
/// Sync @a len bytes of the memory region to the backing store
/// starting at <addr_>.
int sync (void *addr, size_t len, int flags = MS_SYNC);
+
/**
* Change the protection of the pages of the mapped region to @a prot
* starting at <base_addr_> up to @a len bytes.
*/
int protect (size_t len, int prot = PROT_RDWR);
+
/**
* Change the protection of all the pages of the mapped region to @a prot
* starting at <base_addr_>.
*/
int protect (int prot = PROT_RDWR);
+
/// Change the protection of the pages of the mapped region to @a prot
/// starting at @a addr up to @a len bytes.
int protect (void *addr, size_t len, int prot = PROT_RDWR);
+
/// Close and remove the file from the file system.
int remove (void);
+
/// Hook into the underlying VM system.
int advise (int behavior, int len = -1);
+
/// Return the underlying <handle_>.
ACE_HANDLE handle (void) const;
+
/// Return the name of file that is mapped (if any).
const ACE_TCHAR *filename (void) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
+
/// This method does the dirty work of actually calling ::mmap to map
/// the file into memory.
int map_it (ACE_HANDLE handle,
@@ -158,28 +196,41 @@ private:
void *addr = 0,
ACE_OFF_T offset = 0,
LPSECURITY_ATTRIBUTES sa = 0);
+
// = Disallow copying and assignment.
ACE_Mem_Map (const ACE_Mem_Map &);
void operator = (const ACE_Mem_Map &);
+
private:
+
/// Base address of the memory-mapped file.
void *base_addr_;
+
/// Name of the file that is mapped.
ACE_TCHAR filename_[MAXPATHLEN + 1];
+
/// Length of the mapping.
size_t length_;
+
/// HANDLE for the open file.
ACE_HANDLE handle_;
+
/// HANDLE for the open mapping.
ACE_HANDLE file_mapping_;
+
/// Keeps track of whether we need to close the handle. This is set
/// if we opened the file.
bool close_handle_;
+
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Mem_Map.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_MEM_MAP_H */
diff --git a/dep/ACE_wrappers/ace/Mem_Map.inl b/dep/ACE_wrappers/ace/Mem_Map.inl
index 59bd84e70b1..3fd3235db9b 100644
--- a/dep/ACE_wrappers/ace/Mem_Map.inl
+++ b/dep/ACE_wrappers/ace/Mem_Map.inl
@@ -1,22 +1,28 @@
// -*- C++ -*-
//
// $Id: Mem_Map.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_unistd.h"
#include "ace/OS_NS_sys_mman.h"
#include "ace/OS_NS_sys_stat.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE ACE_HANDLE
ACE_Mem_Map::handle (void) const
{
ACE_TRACE ("ACE_Mem_Map::handle");
return this->handle_;
}
+
// Return the name of file that is mapped (if any).
+
ACE_INLINE const ACE_TCHAR *
ACE_Mem_Map::filename (void) const
{
return this->filename_;
}
+
ACE_INLINE int
ACE_Mem_Map::map (ACE_HANDLE handle,
size_t length,
@@ -29,7 +35,9 @@ ACE_Mem_Map::map (ACE_HANDLE handle,
ACE_TRACE ("ACE_Mem_Map::map");
return this->map_it (handle, length, prot, share, addr, offset, sa);
}
+
// Remap the file associated with <this->handle_>.
+
ACE_INLINE int
ACE_Mem_Map::map (size_t length,
int prot,
@@ -46,14 +54,18 @@ ACE_Mem_Map::map (size_t length,
share |= MAP_FIXED;
addr = this->base_addr_;
}
+
return this->map_it (this->handle (), length, prot,
share, addr, offset, sa);
}
+
// This operator passes back the starting address of the mapped file.
+
ACE_INLINE int
ACE_Mem_Map::operator () (void *&addr)
{
ACE_TRACE ("ACE_Mem_Map::operator");
+
if (this->base_addr_ == MAP_FAILED)
return -1;
else
@@ -62,39 +74,51 @@ ACE_Mem_Map::operator () (void *&addr)
return 0;
}
}
+
// Return the base address.
+
ACE_INLINE void *
ACE_Mem_Map::addr (void) const
{
ACE_TRACE ("ACE_Mem_Map::addr");
+
return this->base_addr_;
}
+
// This function returns the number of bytes currently mapped in the
// file.
+
ACE_INLINE size_t
ACE_Mem_Map::size (void) const
{
ACE_TRACE ("ACE_Mem_Map::size");
return this->length_;
}
+
ACE_INLINE int
ACE_Mem_Map::close_filemapping_handle (void)
{
int result = 0;
+
if (this->file_mapping_ != this->handle_
&& this->file_mapping_ != ACE_INVALID_HANDLE)
{
result = ACE_OS::close (this->file_mapping_);
this->file_mapping_ = ACE_INVALID_HANDLE;
}
+
return result;
}
+
// Unmap the region starting at <this->base_addr_>.
+
ACE_INLINE int
ACE_Mem_Map::unmap (ssize_t len)
{
ACE_TRACE ("ACE_Mem_Map::unmap");
+
this->close_filemapping_handle ();
+
if (this->base_addr_ != MAP_FAILED)
{
int const result = ACE_OS::munmap (this->base_addr_,
@@ -105,17 +129,23 @@ ACE_Mem_Map::unmap (ssize_t len)
else
return 0;
}
+
// Unmap the region starting at <addr_>.
+
ACE_INLINE int
ACE_Mem_Map::unmap (void *addr, ssize_t len)
{
ACE_TRACE ("ACE_Mem_Map::unmap");
+
this->close_filemapping_handle ();
+
return ACE_OS::munmap (addr,
len < 0 ? this->length_ : len);
}
+
// Sync <len> bytes of the memory region to the backing store starting
// at <this->base_addr_>.
+
ACE_INLINE int
ACE_Mem_Map::sync (size_t len, int flags)
{
@@ -124,6 +154,7 @@ ACE_Mem_Map::sync (size_t len, int flags)
len,
flags);
}
+
// Sync the whole mapped region.
ACE_INLINE int
ACE_Mem_Map::sync (int flags)
@@ -133,16 +164,20 @@ ACE_Mem_Map::sync (int flags)
this->length_,
flags);
}
+
// Sync <len> bytes of the memory region to the backing store starting
// at <addr_>.
+
ACE_INLINE int
ACE_Mem_Map::sync (void *addr, size_t len, int flags)
{
ACE_TRACE ("ACE_Mem_Map::sync");
return ACE_OS::msync (addr, len, flags);
}
+
// Change the protection of the pages of the mapped region to <prot>
// starting at <this->base_addr_> up to <len> bytes.
+
ACE_INLINE int
ACE_Mem_Map::protect (size_t len, int prot)
{
@@ -150,43 +185,54 @@ ACE_Mem_Map::protect (size_t len, int prot)
return ACE_OS::mprotect (this->base_addr_, len, prot);
}
+
// Change the protection of all the pages of the mapped region to <prot>
// starting at <this->base_addr_>.
+
ACE_INLINE int
ACE_Mem_Map::protect (int prot)
{
ACE_TRACE ("ACE_Mem_Map::protect");
return ACE_OS::mprotect (this->base_addr_, this->length_, prot);
}
+
// Change the protection of the pages of the mapped region to <prot>
// starting at <addr> up to <len> bytes.
+
ACE_INLINE int
ACE_Mem_Map::protect (void *addr, size_t len, int prot)
{
ACE_TRACE ("ACE_Mem_Map::protect");
return ACE_OS::mprotect (addr, len, prot);
}
+
// Hook into the underlying VM system.
+
ACE_INLINE int
ACE_Mem_Map::advise (int behavior, int len)
{
ACE_TRACE ("ACE_Mem_Map::advise");
const size_t advise_len =
len < 0 ? this->length_ : static_cast<size_t> (len);
+
return ACE_OS::madvise ((caddr_t) this->base_addr_,
advise_len,
behavior);
}
+
ACE_INLINE int
ACE_Mem_Map::close_handle (void)
{
int result = 0;
+
if (this->close_handle_)
{
this->close_handle_ = false;
result = ACE_OS::close (this->handle_);
this->handle_ = ACE_INVALID_HANDLE;
}
+
return result;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Memory_Pool.h b/dep/ACE_wrappers/ace/Memory_Pool.h
index 850298057e0..d95778754c7 100644
--- a/dep/ACE_wrappers/ace/Memory_Pool.h
+++ b/dep/ACE_wrappers/ace/Memory_Pool.h
@@ -1,4 +1,5 @@
/* -*- C++ -*- */
+
//=============================================================================
/**
* @file Memory_Pool.h
@@ -9,18 +10,23 @@
* @author Prashant Jain <pjain@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_MEMORY_POOL_H
#define ACE_MEMORY_POOL_H
#include /**/ "ace/pre.h"
+
#include "ace/ACE.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Local_Memory_Pool.h"
#include "ace/MMAP_Memory_Pool.h"
#include "ace/Sbrk_Memory_Pool.h"
#include "ace/Shared_Memory_Pool.h"
#include "ace/Pagefile_Memory_Pool.h"
+
#include /**/ "ace/post.h"
#endif /* ACE_MEMORY_POOL_H */
diff --git a/dep/ACE_wrappers/ace/Message_Block.cpp b/dep/ACE_wrappers/ace/Message_Block.cpp
index 85ec1f4542c..072693613ea 100644
--- a/dep/ACE_wrappers/ace/Message_Block.cpp
+++ b/dep/ACE_wrappers/ace/Message_Block.cpp
@@ -1,19 +1,27 @@
#include "ace/Message_Block.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Message_Block.inl"
#endif /* __ACE_INLINE__ */
+
#include "ace/Guard_T.h"
#include "ace/Log_Msg.h"
#include "ace/Malloc_Base.h"
#include "ace/OS_NS_string.h"
+
//#define ACE_ENABLE_TIMEPROBES
#include "ace/Timeprobe.h"
+
ACE_RCSID (ace,
Message_Block,
"$Id: Message_Block.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE (ACE_Message_Block)
+
#if defined (ACE_ENABLE_TIMEPROBES)
+
static const char *ACE_MB_Timeprobe_Description[] =
{
"Message_Block::init_i - enter",
@@ -27,6 +35,7 @@ static const char *ACE_MB_Timeprobe_Description[] =
"Data_Block::clone - enter",
"Data_Block::clone - leave"
};
+
enum
{
ACE_MESSAGE_BLOCK_INIT_I_ENTER = 3000,
@@ -41,10 +50,13 @@ enum
ACE_DATA_BLOCK_CLONE_LEAVE
};
+
// Setup Timeprobes
ACE_TIMEPROBE_EVENT_DESCRIPTIONS (ACE_MB_Timeprobe_Description,
ACE_MESSAGE_BLOCK_INIT_I_ENTER);
+
#endif /* ACE_ENABLE_TIMEPROBES */
+
void
ACE_Message_Block::data_block (ACE_Data_Block *db)
{
@@ -53,19 +65,24 @@ ACE_Message_Block::data_block (ACE_Data_Block *db)
ACE_Message_Block::DONT_DELETE)
&& this->data_block_ != 0)
this->data_block_->release ();
+
this->data_block_ = db;
+
// Set the read and write pointers in the <Message_Block> to point
// to the buffer in the <ACE_Data_Block>.
this->rd_ptr (this->data_block ()->base ());
this->wr_ptr (this->data_block ()->base ());
}
+
int
ACE_Message_Block::copy (const char *buf, size_t n)
{
ACE_TRACE ("ACE_Message_Block::copy");
+
/*size_t len = static_cast<size_t> (this->end () - this->wr_ptr ());*/
// Note that for this to work correct, end () *must* be >= mark ().
size_t len = this->space ();
+
if (len < n)
{
errno = ENOSPC;
@@ -80,14 +97,18 @@ ACE_Message_Block::copy (const char *buf, size_t n)
return 0;
}
}
+
int
ACE_Message_Block::copy (const char *buf)
{
ACE_TRACE ("ACE_Message_Block::copy");
+
/* size_t len = static_cast<size_t> (this->end () - this->wr_ptr ()); */
// Note that for this to work correct, end() *must* be >= wr_ptr().
size_t len = this->space ();
+
size_t buflen = ACE_OS::strlen (buf) + 1;
+
if (len < buflen)
{
errno = ENOSPC;
@@ -102,6 +123,7 @@ ACE_Message_Block::copy (const char *buf)
return 0;
}
}
+
int
ACE_Message_Block::crunch (void)
{
@@ -109,6 +131,7 @@ ACE_Message_Block::crunch (void)
{
if (this->rd_ptr_ > this->wr_ptr_)
return -1;
+
size_t const len = this->length ();
(void) ACE_OS::memmove (this->base (),
this->rd_ptr (),
@@ -118,6 +141,7 @@ ACE_Message_Block::crunch (void)
}
return 0;
}
+
void
ACE_Data_Block::dump (void) const
{
@@ -145,6 +169,7 @@ ACE_Data_Block::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
void
ACE_Message_Block::dump (void) const
{
@@ -170,6 +195,7 @@ ACE_Message_Block::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
int
ACE_Data_Block::reference_count (void) const
{
@@ -177,14 +203,18 @@ ACE_Data_Block::reference_count (void) const
{
// We need to acquire the lock before retrieving the count
ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->locking_strategy_, 0);
+
return this->reference_count_i ();
}
+
return this->reference_count_i ();
}
+
int
ACE_Data_Block::size (size_t length)
{
ACE_TRACE ("ACE_Data_Block::size");
+
if (length <= this->max_size_)
this->cur_size_ = length;
else
@@ -194,6 +224,7 @@ ACE_Data_Block::size (size_t length)
ACE_ALLOCATOR_RETURN (buf,
(char *) this->allocator_strategy_->malloc (length),
-1);
+
ACE_OS::memcpy (buf,
this->base_,
this->cur_size_);
@@ -210,20 +241,25 @@ ACE_Data_Block::size (size_t length)
}
return 0;
}
+
int
ACE_Message_Block::size (size_t length)
{
ACE_TRACE ("ACE_Message_Block::size");
+
// Resize the underlying <ACE_Data_Block>.
if (this->data_block ()->size (length) == -1)
return -1;
+
return 0;
}
+
void
ACE_Message_Block::total_size_and_length (size_t &mb_size,
size_t &mb_length) const
{
ACE_TRACE ("ACE_Message_Block::total_size_and_length");
+
for (const ACE_Message_Block *i = this;
i != 0;
i = i->cont ())
@@ -232,39 +268,50 @@ ACE_Message_Block::total_size_and_length (size_t &mb_size,
mb_length += i->length ();
}
}
+
size_t
ACE_Message_Block::total_size (void) const
{
ACE_TRACE ("ACE_Message_Block::total_size");
+
size_t size = 0;
for (const ACE_Message_Block *i = this;
i != 0;
i = i->cont ())
size += i->size ();
+
return size;
}
+
size_t
ACE_Message_Block::total_length (void) const
{
ACE_TRACE ("ACE_Message_Block::total_length");
+
size_t length = 0;
for (const ACE_Message_Block *i = this;
i != 0;
i = i->cont ())
length += i->length ();
+
return length;
}
+
size_t
ACE_Message_Block::total_capacity (void) const
{
ACE_TRACE ("ACE_Message_Block::total_capacity");
+
size_t size = 0;
+
for (const ACE_Message_Block *i = this;
i != 0;
i = i->cont ())
size += i->capacity ();
+
return size;
}
+
ACE_Data_Block::ACE_Data_Block (void)
: type_ (ACE_Message_Block::MB_DATA),
cur_size_ (0),
@@ -278,11 +325,14 @@ ACE_Data_Block::ACE_Data_Block (void)
{
ACE_TRACE ("ACE_Data_Block::ACE_Data_Block");
ACE_FUNCTION_TIMEPROBE (ACE_DATA_BLOCK_CTOR1_ENTER);
+
ACE_ALLOCATOR (this->allocator_strategy_,
ACE_Allocator::instance ());
+
ACE_ALLOCATOR (this->data_block_allocator_,
ACE_Allocator::instance ());
}
+
ACE_Data_Block::ACE_Data_Block (size_t size,
ACE_Message_Block::ACE_Message_Type msg_type,
const char *msg_data,
@@ -302,14 +352,17 @@ ACE_Data_Block::ACE_Data_Block (size_t size,
{
ACE_TRACE ("ACE_Data_Block::ACE_Data_Block");
ACE_FUNCTION_TIMEPROBE (ACE_DATA_BLOCK_CTOR2_ENTER);
+
// If the user didn't pass one in, let's use the
// <ACE_Allocator::instance>.
if (this->allocator_strategy_ == 0)
ACE_ALLOCATOR (this->allocator_strategy_,
ACE_Allocator::instance ());
+
if (this->data_block_allocator_ == 0)
ACE_ALLOCATOR (this->data_block_allocator_,
ACE_Allocator::instance ());
+
if (msg_data == 0)
{
ACE_ALLOCATOR (this->base_,
@@ -320,16 +373,19 @@ ACE_Data_Block::ACE_Data_Block (size_t size,
size);
#endif /* ACE_INITIALIZE_MEMORY_BEFORE_USE */
}
+
// ACE_ALLOCATOR returns on alloc failure but we cant throw, so setting
// the size to 0 (i.e. "bad bit") ...
if (this->base_ == 0)
{
size = 0;
}
+
// The memory is legit, whether passed in or allocated, so set
// the size.
this->cur_size_ = this->max_size_ = size;
}
+
ACE_Message_Block::ACE_Message_Block (const char *data,
size_t size,
unsigned long priority)
@@ -337,6 +393,7 @@ ACE_Message_Block::ACE_Message_Block (const char *data,
data_block_ (0)
{
ACE_TRACE ("ACE_Message_Block::ACE_Message_Block");
+
if (this->init_i (size, // size
MB_DATA, // type
0, // cont
@@ -353,11 +410,13 @@ ACE_Message_Block::ACE_Message_Block (const char *data,
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("ACE_Message_Block")));
}
+
ACE_Message_Block::ACE_Message_Block (ACE_Allocator *message_block_allocator)
: flags_ (0),
data_block_ (0)
{
ACE_TRACE ("ACE_Message_Block::ACE_Message_Block");
+
if (this->init_i (0, // size
MB_DATA, // type
0, // cont
@@ -374,6 +433,7 @@ ACE_Message_Block::ACE_Message_Block (ACE_Allocator *message_block_allocator)
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("ACE_Message_Block")));
}
+
ACE_Message_Block::ACE_Message_Block (size_t size,
ACE_Message_Type msg_type,
ACE_Message_Block *msg_cont,
@@ -389,6 +449,7 @@ ACE_Message_Block::ACE_Message_Block (size_t size,
data_block_ (0)
{
ACE_TRACE ("ACE_Message_Block::ACE_Message_Block");
+
if (this->init_i (size,
msg_type,
msg_cont,
@@ -405,6 +466,7 @@ ACE_Message_Block::ACE_Message_Block (size_t size,
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("ACE_Message_Block")));
}
+
int
ACE_Message_Block::init (size_t size,
ACE_Message_Type msg_type,
@@ -419,6 +481,7 @@ ACE_Message_Block::init (size_t size,
ACE_Allocator *message_block_allocator)
{
ACE_TRACE ("ACE_Message_Block::init");
+
return this->init_i (size,
msg_type,
msg_cont,
@@ -433,12 +496,14 @@ ACE_Message_Block::init (size_t size,
data_block_allocator,
message_block_allocator);
}
+
int
ACE_Message_Block::init (const char *data,
size_t size)
{
ACE_TRACE ("ACE_Message_Block::init");
// Should we also initialize all the other fields, as well?
+
return this->init_i (size, // size
MB_DATA, // type
0, // cont
@@ -453,6 +518,7 @@ ACE_Message_Block::init (const char *data,
0, // data_block allocator
0); // message_block allocator
}
+
ACE_Message_Block::ACE_Message_Block (size_t size,
ACE_Message_Type msg_type,
ACE_Message_Block *msg_cont,
@@ -470,6 +536,7 @@ ACE_Message_Block::ACE_Message_Block (size_t size,
data_block_ (0)
{
ACE_TRACE ("ACE_Message_Block::ACE_Message_Block");
+
if (this->init_i (size,
msg_type,
msg_cont,
@@ -486,6 +553,7 @@ ACE_Message_Block::ACE_Message_Block (size_t size,
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("ACE_Message_Block")));
}
+
ACE_Message_Block::ACE_Message_Block (ACE_Data_Block *data_block,
ACE_Message_Block::Message_Flags flags,
ACE_Allocator *message_block_allocator)
@@ -493,6 +561,7 @@ ACE_Message_Block::ACE_Message_Block (ACE_Data_Block *data_block,
data_block_ (0)
{
ACE_TRACE ("ACE_Message_Block::ACE_Message_Block");
+
if (this->init_i (0, // size
MB_NORMAL, // type
0, // cont
@@ -509,12 +578,14 @@ ACE_Message_Block::ACE_Message_Block (ACE_Data_Block *data_block,
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("ACE_Message_Block")));
}
+
ACE_Message_Block::ACE_Message_Block (const ACE_Message_Block &mb,
size_t align)
:flags_ (0),
data_block_ (0)
{
ACE_TRACE ("ACE_Message_Block::ACE_Message_Block");
+
if (ACE_BIT_DISABLED (mb.flags_,
ACE_Message_Block::DONT_DELETE))
{
@@ -540,9 +611,11 @@ ACE_Message_Block::ACE_Message_Block (const ACE_Message_Block &mb,
#else
char *start = this->base ();
#endif /* ACE_LACKS_CDR_ALIGNMENT */
+
// Set our rd & wr pointers
this->rd_ptr (start);
this->wr_ptr (start);
+
}
else
{
@@ -561,6 +634,7 @@ ACE_Message_Block::ACE_Message_Block (const ACE_Message_Block &mb,
mb.message_block_allocator_) == -1)
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("ACE_Message_Block")));
+
#if !defined (ACE_LACKS_CDR_ALIGNMENT)
// Align ourselves
char *start = ACE_ptr_align_binary (this->base (),
@@ -568,9 +642,11 @@ ACE_Message_Block::ACE_Message_Block (const ACE_Message_Block &mb,
#else
char *start = this->base ();
#endif /* ACE_LACKS_CDR_ALIGNMENT */
+
// Set our rd & wr pointers
this->rd_ptr (start);
this->wr_ptr (start);
+
#if !defined (ACE_LACKS_CDR_ALIGNMENT)
// Get the alignment offset of the incoming ACE_Message_Block
start = ACE_ptr_align_binary (mb.base (),
@@ -578,20 +654,25 @@ ACE_Message_Block::ACE_Message_Block (const ACE_Message_Block &mb,
#else
start = mb.base ();
#endif /* ACE_LACKS_CDR_ALIGNMENT */
+
// Actual offset for the incoming message block assuming that it
// is also aligned to the same "align" byte
size_t const wr_offset = mb.wr_ptr_ - (start - mb.base ());
+
// Copy wr_offset amount of data in to <this->data_block>
(void) ACE_OS::memcpy (this->wr_ptr (),
start,
wr_offset);
+
// Dont move the write pointer, just leave it to the application
// to do what it wants
+
}
#if defined (ACE_LACKS_CDR_ALIGNMENT)
ACE_UNUSED_ARG (align);
#endif /* ACE_LACKS_CDR_ALIGNMENT */
}
+
int
ACE_Message_Block::init_i (size_t size,
ACE_Message_Type msg_type,
@@ -609,6 +690,7 @@ ACE_Message_Block::init_i (size_t size,
{
ACE_TRACE ("ACE_Message_Block::init_i");
ACE_FUNCTION_TIMEPROBE (ACE_MESSAGE_BLOCK_INIT_I_ENTER);
+
this->rd_ptr_ = 0;
this->wr_ptr_ = 0;
this->priority_ = priority;
@@ -622,19 +704,24 @@ ACE_Message_Block::init_i (size_t size,
this->cont_ = msg_cont;
this->next_ = 0;
this->prev_ = 0;
+
this->message_block_allocator_ = message_block_allocator;
+
if (this->data_block_ != 0)
{
this->data_block_->release ();
this->data_block_ = 0;
}
+
if (db == 0)
{
if (data_block_allocator == 0)
ACE_ALLOCATOR_RETURN (data_block_allocator,
ACE_Allocator::instance (),
-1);
+
ACE_TIMEPROBE (ACE_MESSAGE_BLOCK_INIT_I_DB_ALLOC);
+
// Allocate the <ACE_Data_Block> portion, which is reference
// counted.
ACE_NEW_MALLOC_RETURN (db,
@@ -649,6 +736,7 @@ ACE_Message_Block::init_i (size_t size,
data_block_allocator),
-1);
ACE_TIMEPROBE (ACE_MESSAGE_BLOCK_INIT_I_DB_CTOR);
+
// Message block initialization may fail, while the construction
// succeds. Since ACE may throw no exceptions, we have to do a
// separate check and clean up, like this:
@@ -660,16 +748,21 @@ ACE_Message_Block::init_i (size_t size,
return -1;
}
}
+
// Reset the data_block_ pointer.
this->data_block (db);
+
return 0;
}
+
ACE_Data_Block::~ACE_Data_Block (void)
{
// Sanity check...
ACE_ASSERT (this->reference_count_ <= 1);
+
// Just to be safe...
this->reference_count_ = 0;
+
if (ACE_BIT_DISABLED (this->flags_,
ACE_Message_Block::DONT_DELETE))
{
@@ -677,27 +770,36 @@ ACE_Data_Block::~ACE_Data_Block (void)
this->base_ = 0;
}
}
+
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
result = this;
+
return result;
}
+
ACE_Data_Block *
ACE_Data_Block::release_no_delete (ACE_Lock *lock)
{
ACE_TRACE ("ACE_Data_Block::release_no_delete");
+
ACE_Data_Block *result = 0;
ACE_Lock *lock_to_be_used = 0;
+
// Check if we were passed in a lock
if (lock != 0)
{
@@ -705,6 +807,7 @@ ACE_Data_Block::release_no_delete (ACE_Lock *lock)
if (lock == this->locking_strategy_)
// In this case no locking is required.
lock_to_be_used = 0;
+
// The lock passed in does not match our lock
else
// Lock to be used is our lock
@@ -714,23 +817,30 @@ ACE_Data_Block::release_no_delete (ACE_Lock *lock)
else
// Lock to be used is our lock
lock_to_be_used = this->locking_strategy_;
+
// If there's a locking strategy then we need to acquire the lock
// before decrementing the count.
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 ();
+
return result;
}
+
ACE_Data_Block *
ACE_Data_Block::release (ACE_Lock *lock)
{
ACE_TRACE ("ACE_Data_Block::release");
+
ACE_Allocator *allocator = this->data_block_allocator_;
+
ACE_Data_Block *result = this->release_no_delete (lock);
+
// We must delete this outside the scope of the locking_strategy_
// since otherwise we'd be trying to "release" through a deleted
// pointer!
@@ -740,27 +850,34 @@ ACE_Data_Block::release (ACE_Lock *lock)
ACE_Data_Block);
return result;
}
+
ACE_Message_Block *
ACE_Message_Block::release (void)
{
ACE_TRACE ("ACE_Message_Block::release");
+
// We want to hold the data block in a temporary variable because we
// invoked "delete this;" at some point, so using this->data_block_
// could be a bad idea.
ACE_Data_Block *tmp = this->data_block ();
+
// This flag is set to 1 when we have to destroy the data_block
int destroy_dblock = 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);
+
// Call non-guarded release with <lock>
destroy_dblock = this->release_i (lock);
}
@@ -772,6 +889,7 @@ ACE_Message_Block::release (void)
else
// This is the case when we don't even have a valid data block
destroy_dblock = this->release_i (0);
+
if (destroy_dblock != 0)
{
ACE_Allocator *allocator = tmp->data_block_allocator ();
@@ -779,22 +897,27 @@ ACE_Message_Block::release (void)
allocator->free,
ACE_Data_Block);
}
+
return 0;
}
+
int
ACE_Message_Block::release_i (ACE_Lock *lock)
{
ACE_TRACE ("ACE_Message_Block::release_i");
+
// Free up all the continuation messages.
if (this->cont_)
{
ACE_Message_Block *mb = this->cont_;
ACE_Message_Block *tmp = 0;
+
do
{
tmp = mb;
mb = mb->cont_;
tmp->cont_ = 0;
+
ACE_Data_Block *db = tmp->data_block ();
if (tmp->release_i (lock) != 0)
{
@@ -805,9 +928,12 @@ ACE_Message_Block::release_i (ACE_Lock *lock)
}
}
while (mb);
+
this->cont_ = 0;
}
+
int result = 0;
+
if (ACE_BIT_DISABLED (this->flags_,
ACE_Message_Block::DONT_DELETE) &&
this->data_block ())
@@ -816,6 +942,7 @@ ACE_Message_Block::release_i (ACE_Lock *lock)
result = 1;
this->data_block_ = 0;
}
+
// We will now commit suicide: this object *must* have come from the
// allocator given.
if (this->message_block_allocator_ == 0)
@@ -827,31 +954,39 @@ ACE_Message_Block::release_i (ACE_Lock *lock)
allocator->free,
ACE_Message_Block);
}
+
return result;
}
+
/* static */ ACE_Message_Block *
ACE_Message_Block::release (ACE_Message_Block *mb)
{
ACE_TRACE ("ACE_Message_Block::release");
+
if (mb != 0)
return mb->release ();
else
return 0;
}
+
ACE_Message_Block::~ACE_Message_Block (void)
{
ACE_TRACE ("ACE_Message_Block::~ACE_Message_Block");
+
if (ACE_BIT_DISABLED (this->flags_,
ACE_Message_Block::DONT_DELETE)&&
this->data_block ())
this->data_block ()->release ();
+
this->prev_ = 0;
this->next_ = 0;
}
+
ACE_Data_Block *
ACE_Data_Block::duplicate (void)
{
ACE_TRACE ("ACE_Data_Block::duplicate");
+
// Create a new <ACE_Message_Block>, but share the <base_> pointer
// data (i.e., don't copy that).
if (this->locking_strategy_)
@@ -862,8 +997,10 @@ ACE_Data_Block::duplicate (void)
}
else
++this->reference_count_;
+
return this;
}
+
#if defined (ACE_HAS_TIMED_MESSAGE_BLOCKS)
#define ACE_EXECUTION_TIME this->execution_time_
#define ACE_DEADLINE_TIME this->deadline_time_
@@ -871,14 +1008,18 @@ ACE_Data_Block::duplicate (void)
#define ACE_EXECUTION_TIME ACE_Time_Value::zero
#define ACE_DEADLINE_TIME ACE_Time_Value::max_time
#endif /* ACE_HAS_TIMED_MESSAGE_BLOCKS */
+
ACE_Message_Block *
ACE_Message_Block::duplicate (void) const
{
ACE_TRACE ("ACE_Message_Block::duplicate");
+
ACE_Message_Block *nb = 0;
+
// 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>.
+
// If there is no allocator, use the standard new and delete calls.
if (this->message_block_allocator_ == 0)
ACE_NEW_RETURN (nb,
@@ -922,16 +1063,19 @@ ACE_Message_Block::duplicate (void) const
this->data_block ()->data_block_allocator (),
this->message_block_allocator_),
0);
+
// Set the read and write pointers in the new <Message_Block> to the
// same relative offset as in the existing <Message_Block>. Note
// that we are assuming that the data_block()->base() pointer
// doesn't change when it's duplicated.
nb->rd_ptr (this->rd_ptr_);
nb->wr_ptr (this->wr_ptr_);
+
// Increment the reference counts of all the continuation messages.
if (this->cont_)
{
nb->cont_ = this->cont_->duplicate ();
+
// If things go wrong, release all of our resources and return
// 0.
if (nb->cont_ == 0)
@@ -940,8 +1084,10 @@ ACE_Message_Block::duplicate (void) const
nb = 0;
}
}
+
return nb;
}
+
ACE_Message_Block *
ACE_Message_Block::duplicate (const ACE_Message_Block *mb)
{
@@ -951,11 +1097,14 @@ ACE_Message_Block::duplicate (const ACE_Message_Block *mb)
else
return mb->duplicate ();
}
+
ACE_Data_Block *
ACE_Data_Block::clone (ACE_Message_Block::Message_Flags mask) const
{
ACE_TRACE ("ACE_Data_Block::clone");
+
ACE_Data_Block *nb = this->clone_nocopy (mask);
+
// Copy all of the payload memory into the new object. The new block
// was allocated with max_size_ (and, thus, it's cur_size_ is the same
// as max_size_). Maintain the same "has been written" boundary in the
@@ -966,21 +1115,28 @@ ACE_Data_Block::clone (ACE_Message_Block::Message_Flags mask) const
this->base_,
this->cur_size_);
}
+
return nb;
}
+
ACE_Data_Block *
ACE_Data_Block::clone_nocopy (ACE_Message_Block::Message_Flags mask,
size_t max_size) const
{
ACE_FUNCTION_TIMEPROBE(ACE_DATA_BLOCK_CLONE_ENTER);
+
ACE_TRACE ("ACE_Data_Block::clone_nocopy");
+
// 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 size_t newsize =
max_size == 0 ? this->max_size_ : max_size;
+
ACE_Data_Block *nb = 0;
+
ACE_NEW_MALLOC_RETURN (nb,
static_cast<ACE_Data_Block*> (
this->data_block_allocator_->malloc (sizeof (ACE_Data_Block))),
@@ -992,6 +1148,7 @@ ACE_Data_Block::clone_nocopy (ACE_Message_Block::Message_Flags mask,
this->flags_, // flags
this->data_block_allocator_),
0);
+
// Message block initialization may fail while the construction
// succeds. Since as a matter of policy, ACE may throw no
// exceptions, we have to do a separate check like this.
@@ -1003,20 +1160,26 @@ ACE_Data_Block::clone_nocopy (ACE_Message_Block::Message_Flags mask,
return 0;
}
+
// Set new flags minus the mask...
nb->clr_flags (mask | always_clear);
return nb;
}
+
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 = 0;
+
if(message_block_allocator_ == 0)
{
ACE_NEW_RETURN (nb,
@@ -1062,15 +1225,18 @@ ACE_Message_Block::clone (Message_Flags mask) const
db->data_block_allocator (),
this->message_block_allocator_);
}
+
if (nb == 0)
{
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_);
nb->wr_ptr (this->wr_ptr_);
+
// Clone all the continuation messages if necessary.
if (this->cont () != 0
&& (nb->cont_ = this->cont ()->clone (mask)) == 0)
@@ -1080,6 +1246,7 @@ ACE_Message_Block::clone (Message_Flags mask) const
}
return nb;
}
+
// This is private.
ACE_Message_Block &
ACE_Message_Block::operator= (const ACE_Message_Block &)
@@ -1087,6 +1254,7 @@ ACE_Message_Block::operator= (const ACE_Message_Block &)
ACE_TRACE ("ACE_Message_Block::operator=");
return *this;
}
+
void
ACE_Data_Block::base (char *msg_data,
size_t msg_length,
@@ -1095,10 +1263,12 @@ ACE_Data_Block::base (char *msg_data,
if (ACE_BIT_DISABLED (this->flags_,
ACE_Message_Block::DONT_DELETE))
this->allocator_strategy_->free (this->base_);
+
this->max_size_ = msg_length;
this->cur_size_ = msg_length;
this->base_ = msg_data;
this->flags_ = msg_flags;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Message_Block.h b/dep/ACE_wrappers/ace/Message_Block.h
index e4b59a7371e..ea039a386a4 100644
--- a/dep/ACE_wrappers/ace/Message_Block.h
+++ b/dep/ACE_wrappers/ace/Message_Block.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file Message_Block.h
@@ -8,23 +9,31 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//==========================================================================
+
#ifndef ACE_MESSAGE_BLOCK_H
#define ACE_MESSAGE_BLOCK_H
+
#include /**/ "ace/pre.h"
+
#include "ace/config-lite.h"
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Default_Constants.h"
#include "ace/Global_Macros.h"
#include "ace/Time_Value.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward declaration.
class ACE_Allocator;
class ACE_Data_Block;
class ACE_Lock;
+
/**
* @class ACE_Message_Block
*
@@ -51,6 +60,7 @@ class ACE_Export ACE_Message_Block
{
public:
friend class ACE_Data_Block;
+
enum
{
// = Data and proto
@@ -58,6 +68,7 @@ public:
MB_DATA = 0x01,
/// Undifferentiated protocol control
MB_PROTO = 0x02,
+
// = Control messages
/// Line break (regular and priority)
MB_BREAK = 0x03,
@@ -71,6 +82,7 @@ public:
MB_IOCTL = 0x07,
/// Set various stream head options
MB_SETOPTS = 0x08,
+
// = Control messages
/// Acknowledge ioctl (high priority; go to head of queue)
MB_IOCACK = 0x81,
@@ -94,6 +106,7 @@ public:
MB_ERROR = 0x8a,
/// Post an event to an event queue
MB_PCEVENT = 0x8b,
+
// = Message class masks
/// Normal priority message mask
MB_NORMAL = 0x00,
@@ -102,8 +115,10 @@ public:
/// User-defined message mask
MB_USER = 0x200
};
+
typedef int ACE_Message_Type;
typedef unsigned long Message_Flags;
+
enum
{
/// Don't delete the data on exit since we don't own it.
@@ -111,9 +126,11 @@ public:
/// user defined flags start here
USER_FLAGS = 0x1000
};
+
// = Initialization and termination.
/// Create an empty message.
ACE_Message_Block (ACE_Allocator *message_block_allocator = 0);
+
/**
* Create an ACE_Message_Block that owns the specified ACE_Data_Block
* without copying it. If the @a flags is set to @c DONT_DELETE we
@@ -124,6 +141,7 @@ public:
ACE_Message_Block (ACE_Data_Block *,
Message_Flags flags = 0,
ACE_Allocator *message_block_allocator = 0);
+
/**
* Create an ACE_Message_Block that refers to @a data without
* copying it. The @a data memory will not be freed when this block is
@@ -134,6 +152,7 @@ public:
ACE_Message_Block (const char *data,
size_t size = 0,
unsigned long priority = ACE_DEFAULT_MESSAGE_BLOCK_PRIORITY);
+
/**
* Create an initialized message of type @a type containing @a size
* bytes. The @a cont argument initializes the continuation field in
@@ -168,6 +187,7 @@ public:
const ACE_Time_Value &deadline_time = ACE_Time_Value::max_time,
ACE_Allocator *data_block_allocator = 0,
ACE_Allocator *message_block_allocator = 0);
+
/**
* A copy constructor. This constructor is a bit different. If the
* incoming Message Block has a data block from the stack this
@@ -181,6 +201,7 @@ public:
*/
ACE_Message_Block (const ACE_Message_Block &mb,
size_t align);
+
/**
* Create a Message Block that assumes it has ownership of @a data,
* but in reality it doesnt (i.e., cannot delete it since it didn't
@@ -189,6 +210,7 @@ public:
*/
int init (const char *data,
size_t size = 0);
+
/**
* Create an initialized message of type @a type containing @a size
* bytes. The @a cont argument initializes the continuation field in
@@ -215,6 +237,7 @@ public:
const ACE_Time_Value &deadline_time = ACE_Time_Value::max_time,
ACE_Allocator *data_block_allocator = 0,
ACE_Allocator *message_block_allocator = 0);
+
/**
* Delete all the resources held in the message.
*
@@ -222,25 +245,34 @@ public:
* chain; the destructor is not. See <release()> for details.
*/
virtual ~ACE_Message_Block (void);
+
// = Message Type accessors and mutators.
+
/// Get type of the message.
ACE_Message_Type msg_type (void) const;
+
/// Set type of the message.
void msg_type (ACE_Message_Type type);
+
/// Find out what type of message this is.
int is_data_msg (void) const;
+
/// Find out what class of message this is (there are two classes,
/// @c normal messages and @c high-priority messages).
ACE_Message_Type msg_class (void) const;
+
// = Message flag accessors and mutators.
/// Bitwise-or the @a more_flags into the existing message flags and
/// return the new value.
Message_Flags set_flags (Message_Flags more_flags);
+
/// Clear the message flag bits specified in @a less_flags and return
/// the new value.
Message_Flags clr_flags (Message_Flags less_flags);
+
/// Get the current message flags.
Message_Flags flags (void) const;
+
// = Data Block flag accessors and mutators.
/// Bitwise-or the @a more_flags into the existing message flags and
/// return the new value.
@@ -250,29 +282,41 @@ public:
* me if I am totally totally wrong..
*/
Message_Flags set_self_flags (ACE_Message_Block::Message_Flags more_flags);
+
/// Clear the message flag bits specified in @a less_flags and return
/// the new value.
Message_Flags clr_self_flags (ACE_Message_Block::Message_Flags less_flags);
+
/// Get the current message flags.
Message_Flags self_flags (void) const;
+
/// Get priority of the message.
unsigned long msg_priority (void) const;
+
/// Set priority of the message.
void msg_priority (unsigned long priority);
+
/// Get execution time associated with the message.
const ACE_Time_Value &msg_execution_time (void) const;
+
/// Set execution time associated with the message.
void msg_execution_time (const ACE_Time_Value &et);
+
/// Get absolute time of deadline associated with the message.
const ACE_Time_Value &msg_deadline_time (void) const;
+
/// Set absolute time of deadline associated with the message.
void msg_deadline_time (const ACE_Time_Value &dt);
+
// = Deep copy and shallow copy methods.
+
/// Return an exact "deep copy" of the message, i.e., create fresh
/// new copies of all the Data_Blocks and continuations.
virtual ACE_Message_Block *clone (Message_Flags mask = 0) const;
+
/// Return a "shallow" copy that increments our reference count by 1.
virtual ACE_Message_Block *duplicate (void) const;
+
/**
* Return a "shallow" copy that increments our reference count by 1.
* This is similar to CORBA's <_duplicate> method, which is useful
@@ -280,6 +324,7 @@ public:
* before calling <_duplicate> on them.
*/
static ACE_Message_Block *duplicate (const ACE_Message_Block *mb);
+
/**
* Decrease the shared ACE_Data_Block's reference count by 1. If the
* ACE_Data_Block's reference count goes to 0, it is deleted.
@@ -308,6 +353,7 @@ public:
* longer valid.
*/
virtual ACE_Message_Block *release (void);
+
/**
* This behaves like the non-static method <release>, except that it
* checks if @a mb is 0. This is similar to <CORBA::release>, which
@@ -315,7 +361,9 @@ public:
* pointers before calling <release> on them. Returns @a mb.
*/
static ACE_Message_Block *release (ACE_Message_Block *mb);
+
// = Operations on Message data
+
/**
* Copies data into this ACE_Message_Block. Data is copied into the
* block starting at the current write pointer.
@@ -329,6 +377,7 @@ public:
* by calling space().
*/
int copy (const char *buf, size_t n);
+
/**
* Copies a 0-terminated character string into this ACE_Message_Block.
* The string is copied into the block starting at the current write
@@ -343,15 +392,18 @@ public:
* Free space can be checked by calling space().
*/
int copy (const char *buf);
+
/// Normalizes data in the top-level <Message_Block> to align with the base,
/// i.e., it "shifts" the data pointed to by <rd_ptr> down to the <base> and
/// then readjusts <rd_ptr> to point to <base> and <wr_ptr> to point
/// to <base> + the length of the moved data. Returns -1 and does
/// nothing if the <rd_ptr> is > <wr_ptr>, else 0 on success.
int crunch (void);
+
/// Resets the Message Block data to contain nothing, i.e., sets the
/// read and write pointers to align with the base.
void reset (void);
+
/// Access all the allocators in the message block.
/// @@todo: Not sure whether we would need finer control while
/// trying to access allocators ie. a method for every allocator.
@@ -371,6 +423,7 @@ public:
void access_allocators (ACE_Allocator *&allocator_strategy,
ACE_Allocator *&data_block_allocator,
ACE_Allocator *&message_block_allocator);
+
/// Reset all the allocators in the message block.
/// @todo Not sure whether we would need finer control while
/// trying to reset allocators ie. a method for every allocator.
@@ -381,33 +434,44 @@ public:
void reset_allocators (ACE_Allocator *allocator_strategy = 0,
ACE_Allocator *data_block_allocator = 0,
ACE_Allocator *message_block_allocator = 0);
+
/// Get message data.
char *base (void) const;
+
/// Set message data (doesn't reallocate).
void base (char *data,
size_t size,
Message_Flags = DONT_DELETE);
+
/// Return a pointer to 1 past the end of the allocated data in a message.
char *end (void) const;
+
/**
* Return a pointer to 1 past the end of the allotted data in a message.
* Allotted data may be less than allocated data if a value smaller than
* capacity() to is passed to size().
*/
char *mark (void) const;
+
/// Get the read pointer.
char *rd_ptr (void) const;
+
/// Set the read pointer to @a ptr.
void rd_ptr (char *ptr);
+
/// Set the read pointer ahead @a n bytes.
void rd_ptr (size_t n);
+
/// Get the write pointer.
char *wr_ptr (void) const;
+
/// Set the write pointer to @a ptr.
void wr_ptr (char *ptr);
+
/// Set the write pointer ahead @a n bytes. This is used to compute
/// the <length> of a message.
void wr_ptr (size_t n);
+
/** @name Message length and size operations
*
* Message length is (wr_ptr - rd_ptr).
@@ -418,21 +482,27 @@ public:
//@{
/// Get the length of the message
size_t length (void) const;
+
/// Set the length of the message
void length (size_t n);
+
/// Get the length of the <Message_Block>s, including chained
/// <Message_Block>s.
size_t total_length (void) const;
+
/// Get the total number of bytes in all <Message_Block>s, including
/// chained <Message_Block>s.
size_t total_size (void) const;
+
/// Get the total number of bytes and total length in all
/// <Message_Block>s, including chained <Message_Block>s.
void total_size_and_length (size_t &mb_size,
size_t &mb_length) const;
+
/// Get the number of bytes in the top-level <Message_Block> (i.e.,
/// does not consider the bytes in chained <Message_Block>s).
size_t size (void) const;
+
/**
* Set the number of bytes in the top-level <Message_Block>,
* reallocating space if necessary. However, the <rd_ptr_> and
@@ -440,22 +510,28 @@ public:
* it is reallocated. Returns 0 if successful, else -1.
*/
int size (size_t length);
+
/// Get the number of allocated bytes in all <Message_Block>, including
/// chained <Message_Block>s.
size_t total_capacity (void) const;
+
/// Get the number of allocated bytes in the top-level <Message_Block>.
size_t capacity (void) const;
+
/// Get the number of bytes available after the <wr_ptr_> in the
/// top-level <Message_Block>.
size_t space (void) const;
//@}
+
// = ACE_Data_Block methods.
+
/**
* Get a pointer to the data block. Note that the ACE_Message_Block
* still references the block; this call does not change the reference
* count.
*/
ACE_Data_Block *data_block (void) const;
+
/**
* Set a new data block pointer. The original ACE_Data_Block is released
* as a result of this call. If you need to keep the original block, call
@@ -464,35 +540,48 @@ public:
* you held on it prior to the call.
*/
void data_block (ACE_Data_Block *);
+
/// Set a new data block pointer. A pointer to the original ACE_Data_Block
/// is returned, and not released (as it is with <data_block>).
ACE_Data_Block *replace_data_block (ACE_Data_Block*);
+
// = The continuation field chains together composite messages.
/// Get the continuation field.
ACE_Message_Block *cont (void) const;
+
/// Set the continuation field.
void cont (ACE_Message_Block *);
+
// = Pointer to the <Message_Block> directly ahead in the ACE_Message_Queue.
/// Get link to next message.
ACE_Message_Block *next (void) const;
+
/// Set link to next message.
void next (ACE_Message_Block *);
+
// = Pointer to the <Message_Block> directly behind in the ACE_Message_Queue.
/// Get link to prev message.
ACE_Message_Block *prev (void) const;
+
/// Set link to prev message.
void prev (ACE_Message_Block *);
+
// = The locking strategy prevents race conditions.
/// Get the locking strategy.
ACE_Lock *locking_strategy (void);
+
/// Set a new locking strategy and return the hold one.
ACE_Lock *locking_strategy (ACE_Lock *);
+
/// Get the current reference count.
int reference_count (void) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
// = Internal initialization methods.
/// Perform the actual initialization.
@@ -509,9 +598,11 @@ protected:
ACE_Data_Block *db,
ACE_Allocator *data_block_allocator,
ACE_Allocator *message_block_allocator);
+
/// Internal release implementation
/// Returns 1 if the data block has to be destroyed.
int release_i (ACE_Lock *lock);
+
/// Perform the actual initialization.
int init_i (size_t size,
ACE_Message_Type type,
@@ -526,38 +617,51 @@ protected:
ACE_Data_Block *db,
ACE_Allocator *data_block_allocator,
ACE_Allocator *message_block_allocator);
+
/// Pointer to beginning of next read.
size_t rd_ptr_;
+
/// Pointer to beginning of next write.
size_t wr_ptr_;
+
/// Priority of message.
unsigned long priority_;
+
#if defined (ACE_HAS_TIMED_MESSAGE_BLOCKS)
/// Execution time associated with the message.
ACE_Time_Value execution_time_;
+
/// Absolute deadline time for message.
ACE_Time_Value deadline_time_;
#endif /* ACE_HAS_TIMED_MESSAGE_BLOCKS */
+
// = Links to other ACE_Message_Block *s.
/// Pointer to next message block in the chain.
ACE_Message_Block *cont_;
+
/// Pointer to next message in the list.
ACE_Message_Block *next_;
+
/// Pointer to previous message in the list.
ACE_Message_Block *prev_;
+
/// Misc flags (e.g., DONT_DELETE and USER_FLAGS).
ACE_Message_Block::Message_Flags flags_;
+
/// Pointer to the reference counted data structure that contains the
/// actual memory buffer.
ACE_Data_Block *data_block_;
+
/// The allocator used to destroy ourselves when release is called
/// and create new message blocks on duplicate.
ACE_Allocator *message_block_allocator_;
+
private:
// = Disallow these operations for now (use <clone> instead).
ACE_Message_Block &operator= (const ACE_Message_Block &);
ACE_Message_Block (const ACE_Message_Block &);
};
+
/**
* @class ACE_Data_Block
*
@@ -576,6 +680,7 @@ public:
// = Initialization and termination methods.
/// Default "do-nothing" constructor.
ACE_Data_Block (void);
+
/// Initialize.
ACE_Data_Block (size_t size,
ACE_Message_Block::ACE_Message_Type msg_type,
@@ -584,35 +689,47 @@ public:
ACE_Lock *locking_strategy,
ACE_Message_Block::Message_Flags flags,
ACE_Allocator *data_block_allocator);
+
/// Delete all the resources held in the message.
virtual ~ACE_Data_Block (void);
+
/// Get type of the message.
ACE_Message_Block::ACE_Message_Type msg_type (void) const;
+
/// Set type of the message.
void msg_type (ACE_Message_Block::ACE_Message_Type type);
+
/// Get message data pointer
char *base (void) const;
+
/// Set message data pointer (doesn't reallocate).
void base (char *data,
size_t size,
ACE_Message_Block::Message_Flags mflags = ACE_Message_Block::DONT_DELETE);
+
/// Return a pointer to 1 past the end of the allocated data in a message.
char *end (void) const;
+
/**
* Return a pointer to 1 past the end of the allotted data in a message.
* The allotted data may be less than allocated data if <size()> is passed
* an argument less than <capacity()>.
*/
char *mark (void) const;
+
// = Message size is the total amount of space alloted.
+
/// Get the total amount of allotted space in the message. The amount of
/// allotted space may be less than allocated space.
size_t size (void) const;
+
/// Set the total amount of space in the message. Returns 0 if
/// successful, else -1.
int size (size_t length);
+
/// Get the total amount of allocated space.
size_t capacity (void) const;
+
/**
* Return an exact "deep copy" of the message, i.e., create fresh
* new copies of all the Data_Blocks and continuations.
@@ -621,6 +738,7 @@ public:
* themselves.
*/
virtual ACE_Data_Block *clone (ACE_Message_Block::Message_Flags mask = 0) const;
+
/**
* As clone above, but it does not copy the contents of the buffer,
* i.e., create a new Data_Block of the same dynamic type, with the
@@ -631,8 +749,10 @@ public:
*/
virtual ACE_Data_Block *clone_nocopy (ACE_Message_Block::Message_Flags mask = 0,
size_t max_size = 0) const;
+
/// Return a "shallow" copy that increments our reference count by 1.
ACE_Data_Block *duplicate (void);
+
/**
* Decrease the shared reference count by 1. If the reference count
* is > 0 then return this; else if reference count == 0 then delete
@@ -640,33 +760,45 @@ public:
* count < 0.
*/
ACE_Data_Block *release (ACE_Lock *lock = 0);
+
// = Message flag accessors and mutators.
/// Bitwise-or the <more_flags> into the existing message flags and
/// return the new value.
ACE_Message_Block::Message_Flags set_flags (ACE_Message_Block::Message_Flags more_flags);
+
/// Clear the message flag bits specified in <less_flags> and return
/// the new value.
ACE_Message_Block::Message_Flags clr_flags (ACE_Message_Block::Message_Flags less_flags);
+
/// Get the current message flags.
ACE_Message_Block::Message_Flags flags (void) const;
+
/// Obtain the allocator strategy.
ACE_Allocator *allocator_strategy (void) const;
+
// = The locking strategy prevents race conditions.
/// Get the locking strategy.
ACE_Lock *locking_strategy (void);
+
/// Set a new locking strategy and return the hold one.
ACE_Lock *locking_strategy (ACE_Lock *);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Get the current reference count.
int reference_count (void) const;
+
/// Get the allocator used to create this object
ACE_Allocator *data_block_allocator (void) const;
+
protected:
/// Internal release implementation
virtual ACE_Data_Block *release_i (void);
+
/// Internal get the current reference count.
int reference_count_i (void) const;
+
/**
* Decrease the reference count, but don't delete the object.
* Returns 0 if the object should be removed.
@@ -677,16 +809,22 @@ protected:
*/
friend class ACE_Message_Block;
ACE_Data_Block *release_no_delete (ACE_Lock *lock);
+
/// Type of message.
ACE_Message_Block::ACE_Message_Type type_;
+
/// Current size of message block.
size_t cur_size_;
+
/// Total size of buffer.
size_t max_size_;
+
/// Misc flags (e.g., DONT_DELETE and USER_FLAGS).
ACE_Message_Block::Message_Flags flags_;
+
/// Pointer To beginning of message payload.
char *base_;
+
// = Strategies.
/**
* Pointer to the allocator defined for this ACE_Data_Block. Note
@@ -694,6 +832,7 @@ protected:
* ACE_Data_Block.
*/
ACE_Allocator *allocator_strategy_;
+
/**
* Pointer to the locking strategy defined for this
* ACE_Data_Block. This is used to protect regions of code that
@@ -701,6 +840,7 @@ protected:
* shared by all owners of the ACE_Data_Block's data.
*/
ACE_Lock *locking_strategy_;
+
/**
* Reference count for this ACE_Data_Block, which is used to avoid
* deep copies (i.e., <clone>). Note that this pointer value is
@@ -708,18 +848,25 @@ protected:
* ACE_Message_Blocks.
*/
int reference_count_;
+
/// The allocator use to destroy ourselves.
ACE_Allocator *data_block_allocator_;
+
private:
// = Disallow these operations.
ACE_Data_Block &operator= (const ACE_Data_Block &);
ACE_Data_Block (const ACE_Data_Block &);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Message_Block.inl"
#endif /* __ACE_INLINE__ */
+
#include "ace/Message_Block_T.h"
+
#include /**/ "ace/post.h"
+
#endif /* ACE_MESSAGE_BLOCK_H */
diff --git a/dep/ACE_wrappers/ace/Message_Block.inl b/dep/ACE_wrappers/ace/Message_Block.inl
index 6642b1eaf7f..bf756e4dddb 100644
--- a/dep/ACE_wrappers/ace/Message_Block.inl
+++ b/dep/ACE_wrappers/ace/Message_Block.inl
@@ -1,13 +1,16 @@
// -*- C++ -*-
//
// $Id: Message_Block.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE ACE_Data_Block *
ACE_Message_Block::data_block (void) const
{
ACE_TRACE ("ACE_Message_Block::data_block");
return this->data_block_;
}
+
ACE_INLINE ACE_Message_Block::Message_Flags
ACE_Message_Block::set_self_flags (ACE_Message_Block::Message_Flags more_flags)
{
@@ -16,6 +19,7 @@ ACE_Message_Block::set_self_flags (ACE_Message_Block::Message_Flags more_flags)
// ones: more_flags &= ~(USER_FLAGS -1).
return ACE_SET_BITS (this->flags_, more_flags);
}
+
ACE_INLINE ACE_Message_Block::Message_Flags
ACE_Message_Block::clr_self_flags (ACE_Message_Block::Message_Flags less_flags)
{
@@ -24,40 +28,47 @@ ACE_Message_Block::clr_self_flags (ACE_Message_Block::Message_Flags less_flags)
// ones: less_flags &= ~(USER_FLAGS -1).
return ACE_CLR_BITS (this->flags_, less_flags);
}
+
ACE_INLINE ACE_Message_Block::Message_Flags
ACE_Message_Block::self_flags (void) const
{
ACE_TRACE ("ACE_Message_Block::self_flags");
return this->flags_;
}
+
ACE_INLINE int
ACE_Data_Block::reference_count_i (void) const
{
return reference_count_;
}
+
ACE_INLINE int
ACE_Message_Block::reference_count (void) const
{
return data_block () ? data_block ()->reference_count () : 0;
}
+
ACE_INLINE char *
ACE_Data_Block::base (void) const
{
ACE_TRACE ("ACE_Data_Block::base");
return this->base_;
}
+
ACE_INLINE size_t
ACE_Data_Block::size (void) const
{
ACE_TRACE ("ACE_Data_Block::size");
return this->cur_size_;
}
+
ACE_INLINE size_t
ACE_Data_Block::capacity (void) const
{
ACE_TRACE ("ACE_Data_Block::capacity");
return this->max_size_;
}
+
ACE_INLINE ACE_Message_Block::Message_Flags
ACE_Data_Block::set_flags (ACE_Message_Block::Message_Flags more_flags)
{
@@ -66,6 +77,7 @@ ACE_Data_Block::set_flags (ACE_Message_Block::Message_Flags more_flags)
// ones: more_flags &= ~(USER_FLAGS -1).
return ACE_SET_BITS (this->flags_, more_flags);
}
+
ACE_INLINE ACE_Message_Block::Message_Flags
ACE_Data_Block::clr_flags (ACE_Message_Block::Message_Flags less_flags)
{
@@ -74,92 +86,110 @@ ACE_Data_Block::clr_flags (ACE_Message_Block::Message_Flags less_flags)
// ones: less_flags &= ~(USER_FLAGS -1).
return ACE_CLR_BITS (this->flags_, less_flags);
}
+
ACE_INLINE ACE_Message_Block::Message_Flags
ACE_Data_Block::flags (void) const
{
ACE_TRACE ("ACE_Data_Block::flags");
return this->flags_;
}
+
ACE_INLINE ACE_Allocator*
ACE_Data_Block::data_block_allocator (void) const
{
ACE_TRACE ("ACE_Data_Block::data_block_allocator");
return this->data_block_allocator_;
}
+
ACE_INLINE ACE_Message_Block::Message_Flags
ACE_Message_Block::set_flags (ACE_Message_Block::Message_Flags more_flags)
{
ACE_TRACE ("ACE_Message_Block::set_flags");
return this->data_block ()->set_flags (more_flags);
}
+
ACE_INLINE ACE_Message_Block::Message_Flags
ACE_Message_Block::clr_flags (ACE_Message_Block::Message_Flags less_flags)
{
ACE_TRACE ("ACE_Message_Block::clr_flags");
return this->data_block ()->clr_flags (less_flags);
}
+
ACE_INLINE ACE_Message_Block::Message_Flags
ACE_Message_Block::flags (void) const
{
ACE_TRACE ("ACE_Message_Block::flags");
return this->data_block ()->flags ();
}
+
// Return the length of the "active" portion of the message.
+
ACE_INLINE size_t
ACE_Message_Block::length (void) const
{
ACE_TRACE ("ACE_Message_Block::length");
return this->wr_ptr_ - this->rd_ptr_;
}
+
// Sets the length of the "active" portion of the message. This is
// defined as the offset from RD_PTR to WR_PTR.
+
ACE_INLINE void
ACE_Message_Block::length (size_t len)
{
ACE_TRACE ("ACE_Message_Block::length");
this->wr_ptr_ = this->rd_ptr_ + len;
}
+
// Return the length of the potential size of the message.
+
ACE_INLINE size_t
ACE_Message_Block::size (void) const
{
ACE_TRACE ("ACE_Message_Block::size");
return this->data_block ()->size ();
}
+
ACE_INLINE size_t
ACE_Message_Block::capacity (void) const
{
ACE_TRACE ("ACE_Message_Block::capacity");
return this->data_block ()->capacity ();
}
+
ACE_INLINE ACE_Message_Block::ACE_Message_Type
ACE_Data_Block::msg_type (void) const
{
ACE_TRACE ("ACE_Data_Block::msg_type");
return this->type_;
}
+
ACE_INLINE void
ACE_Data_Block::msg_type (ACE_Message_Block::ACE_Message_Type t)
{
ACE_TRACE ("ACE_Data_Block::msg_type");
this->type_ = t;
}
+
ACE_INLINE ACE_Message_Block::ACE_Message_Type
ACE_Message_Block::msg_type (void) const
{
ACE_TRACE ("ACE_Message_Block::msg_type");
return this->data_block ()->msg_type ();
}
+
ACE_INLINE void
ACE_Message_Block::msg_type (ACE_Message_Block::ACE_Message_Type t)
{
ACE_TRACE ("ACE_Message_Block::msg_type");
this->data_block ()->msg_type (t);
}
+
ACE_INLINE ACE_Message_Block::ACE_Message_Type
ACE_Message_Block::msg_class (void) const
{
ACE_TRACE ("ACE_Message_Block::msg_class");
+
if (this->msg_type () < ACE_Message_Block::MB_PRIORITY)
return ACE_Message_Block::MB_NORMAL;
else if (this->msg_type () < ACE_Message_Block::MB_USER)
@@ -167,6 +197,7 @@ ACE_Message_Block::msg_class (void) const
else
return ACE_Message_Block::MB_USER;
}
+
ACE_INLINE int
ACE_Message_Block::is_data_msg (void) const
{
@@ -177,18 +208,21 @@ ACE_Message_Block::is_data_msg (void) const
|| mt == ACE_Message_Block::MB_PROTO
|| mt == ACE_Message_Block::MB_PCPROTO;
}
+
ACE_INLINE unsigned long
ACE_Message_Block::msg_priority (void) const
{
ACE_TRACE ("ACE_Message_Block::msg_priority");
return this->priority_;
}
+
ACE_INLINE void
ACE_Message_Block::msg_priority (unsigned long pri)
{
ACE_TRACE ("ACE_Message_Block::msg_priority");
this->priority_ = pri;
}
+
ACE_INLINE const ACE_Time_Value &
ACE_Message_Block::msg_execution_time (void) const
{
@@ -199,6 +233,7 @@ ACE_Message_Block::msg_execution_time (void) const
return ACE_Time_Value::zero;
#endif /* ACE_HAS_TIMED_MESSAGE_BLOCKS */
}
+
ACE_INLINE void
ACE_Message_Block::msg_execution_time (const ACE_Time_Value &et)
{
@@ -209,16 +244,19 @@ ACE_Message_Block::msg_execution_time (const ACE_Time_Value &et)
ACE_UNUSED_ARG (et);
#endif /* ACE_HAS_TIMED_MESSAGE_BLOCKS */
}
+
ACE_INLINE const ACE_Time_Value &
ACE_Message_Block::msg_deadline_time (void) const
{
ACE_TRACE ("ACE_Message_Block::msg_deadline_time (void)");
+
#if defined (ACE_HAS_TIMED_MESSAGE_BLOCKS)
return this->deadline_time_;
#else
return ACE_Time_Value::max_time; // absolute time of deadline
#endif /* ACE_HAS_TIMED_MESSAGE_BLOCKS */
}
+
ACE_INLINE void
ACE_Message_Block::msg_deadline_time (const ACE_Time_Value &dt)
{
@@ -229,6 +267,7 @@ ACE_Message_Block::msg_deadline_time (const ACE_Time_Value &dt)
ACE_UNUSED_ARG (dt);
#endif /* ACE_HAS_TIMED_MESSAGE_BLOCKS */
}
+
ACE_INLINE void
ACE_Message_Block::access_allocators (ACE_Allocator *& allocator_strategy,
ACE_Allocator *& data_block_allocator,
@@ -241,12 +280,14 @@ ACE_Message_Block::access_allocators (ACE_Allocator *& allocator_strategy,
message_block_allocator =
this->message_block_allocator_;
}
+
ACE_INLINE char *
ACE_Message_Block::base (void) const
{
ACE_TRACE ("ACE_Message_Block::base");
return this->data_block ()->base ();
}
+
ACE_INLINE void
ACE_Message_Block::base (char *msg_data,
size_t msg_length,
@@ -257,37 +298,44 @@ ACE_Message_Block::base (char *msg_data,
this->wr_ptr_ = 0;
this->data_block ()->base (msg_data, msg_length, msg_flags);
}
+
ACE_INLINE char *
ACE_Message_Block::rd_ptr (void) const
{
ACE_TRACE ("ACE_Message_Block::rd_ptr");
return this->base () + this->rd_ptr_;
}
+
ACE_INLINE void
ACE_Message_Block::wr_ptr (char *new_ptr)
{
ACE_TRACE ("ACE_Message_Block::wr_ptr");
this->wr_ptr_ = new_ptr - this->base ();
}
+
// Return a pointer to 1 past the end of the data buffer.
+
ACE_INLINE char *
ACE_Data_Block::mark (void) const
{
ACE_TRACE ("ACE_Data_Block::mark");
return this->base_ + this->cur_size_;
}
+
ACE_INLINE char *
ACE_Message_Block::mark (void) const
{
ACE_TRACE ("ACE_Message_Block::mark");
return this->data_block ()->mark ();
}
+
ACE_INLINE char *
ACE_Data_Block::end (void) const
{
ACE_TRACE ("ACE_Data_Block::end");
return this->base_ + this->max_size_;
}
+
ACE_INLINE char *
ACE_Message_Block::end (void) const
{
@@ -295,30 +343,35 @@ ACE_Message_Block::end (void) const
return this->data_block ()->end ();
}
+
ACE_INLINE void
ACE_Message_Block::rd_ptr (char *new_ptr)
{
ACE_TRACE ("ACE_Message_Block::rd_ptr");
this->rd_ptr_ = new_ptr - this->base ();
}
+
ACE_INLINE void
ACE_Message_Block::rd_ptr (size_t n)
{
ACE_TRACE ("ACE_Message_Block::rd_ptr");
this->rd_ptr_ += n;
}
+
ACE_INLINE char *
ACE_Message_Block::wr_ptr (void) const
{
ACE_TRACE ("ACE_Message_Block::wr_ptr");
return this->base () + this->wr_ptr_;
}
+
ACE_INLINE void
ACE_Message_Block::wr_ptr (size_t n)
{
ACE_TRACE ("ACE_Message_Block::wr_ptr");
this->wr_ptr_ += n;
}
+
ACE_INLINE void
ACE_Message_Block::reset (void)
{
@@ -326,18 +379,21 @@ ACE_Message_Block::reset (void)
this->rd_ptr_ = 0;
this->wr_ptr_ = 0;
}
+
ACE_INLINE size_t
ACE_Message_Block::space (void) const
{
ACE_TRACE ("ACE_Message_Block::space");
return this->mark () - this->wr_ptr ();
}
+
ACE_INLINE ACE_Data_Block *
ACE_Message_Block::replace_data_block (ACE_Data_Block *db)
{
ACE_TRACE ("ACE_Message_Block::replace_data_block");
ACE_Data_Block *old = this->data_block_;
this->data_block_ = db;
+
if (db != 0)
{
// Set the read and write pointers in the <Message_Block> to point
@@ -345,20 +401,24 @@ ACE_Message_Block::replace_data_block (ACE_Data_Block *db)
this->rd_ptr (this->data_block ()->base ());
this->wr_ptr (this->data_block ()->base ());
}
+
return old;
}
+
ACE_INLINE void
ACE_Message_Block::cont (ACE_Message_Block *cont_msg)
{
ACE_TRACE ("ACE_Message_Block::cont");
this->cont_ = cont_msg;
}
+
ACE_INLINE ACE_Message_Block *
ACE_Message_Block::cont (void) const
{
ACE_TRACE ("ACE_Message_Block::cont");
return this->cont_;
}
+
ACE_INLINE void
ACE_Message_Block::reset_allocators (ACE_Allocator *allocator_strategy,
ACE_Allocator *data_block_allocator,
@@ -370,61 +430,72 @@ ACE_Message_Block::reset_allocators (ACE_Allocator *allocator_strategy,
data_block_allocator;
this->message_block_allocator_ =
message_block_allocator;
+
if (this->cont () != 0)
this->cont ()->reset_allocators (allocator_strategy,
data_block_allocator,
message_block_allocator);
}
+
ACE_INLINE void
ACE_Message_Block::next (ACE_Message_Block *next_msg)
{
ACE_TRACE ("ACE_Message_Block::next");
this->next_ = next_msg;
}
+
ACE_INLINE ACE_Message_Block *
ACE_Message_Block::next (void) const
{
ACE_TRACE ("ACE_Message_Block::next");
return this->next_;
}
+
ACE_INLINE void
ACE_Message_Block::prev (ACE_Message_Block *next_msg)
{
ACE_TRACE ("ACE_Message_Block::prev");
this->prev_ = next_msg;
}
+
ACE_INLINE ACE_Message_Block *
ACE_Message_Block::prev (void) const
{
ACE_TRACE ("ACE_Message_Block::prev");
return this->prev_;
}
+
ACE_INLINE ACE_Allocator *
ACE_Data_Block::allocator_strategy (void) const
{
ACE_TRACE ("ACE_Data_Block::allocator_strategy");
return this->allocator_strategy_;
}
+
ACE_INLINE ACE_Lock *
ACE_Data_Block::locking_strategy (void)
{
ACE_TRACE ("ACE_Data_Block::locking_strategy");
return this->locking_strategy_;
}
+
ACE_INLINE ACE_Lock *
ACE_Data_Block::locking_strategy (ACE_Lock *nls)
{
ACE_TRACE ("ACE_Data_Block::locking_strategy");
ACE_Lock *ols = this->locking_strategy_;
+
this->locking_strategy_ = nls;
return ols;
}
+
ACE_INLINE ACE_Lock *
ACE_Message_Block::locking_strategy (void)
{
ACE_TRACE ("ACE_Message_Block::locking_strategy");
return this->data_block ()->locking_strategy ();
}
+
ACE_INLINE ACE_Lock *
ACE_Message_Block::locking_strategy (ACE_Lock *nls)
{
@@ -433,4 +504,5 @@ ACE_Message_Block::locking_strategy (ACE_Lock *nls)
this->data_block ()->locking_strategy (nls);
return ols;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Message_Block_T.h b/dep/ACE_wrappers/ace/Message_Block_T.h
index 239fe83ac4c..25615fa4508 100644
--- a/dep/ACE_wrappers/ace/Message_Block_T.h
+++ b/dep/ACE_wrappers/ace/Message_Block_T.h
@@ -1,4 +1,5 @@
/* -*- C++ -*- */
+
//=============================================================================
/**
* @file Message_Block_T.h
@@ -9,14 +10,19 @@
* @author Carlos O'Ryan <coryan@atdesk.com>
*/
//=============================================================================
+
#ifndef ACE_MESSAGE_BLOCK_T_H
#define ACE_MESSAGE_BLOCK_T_H
#include /**/ "ace/pre.h"
+
#include "ace/Message_Block.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Locked_Data_Block
*
@@ -35,6 +41,7 @@ public:
// = Initialization and termination methods.
/// Default "do-nothing" constructor.
ACE_Locked_Data_Block (void);
+
/// Initialize.
ACE_Locked_Data_Block (size_t size,
ACE_Message_Block::ACE_Message_Type msg_type,
@@ -42,8 +49,10 @@ public:
ACE_Allocator *allocator_strategy,
ACE_Message_Block::Message_Flags flags,
ACE_Allocator *data_block_allocator);
+
/// Delete all the resources held in the message.
virtual ~ACE_Locked_Data_Block (void);
+
/**
* Return an exact "deep copy" of the message, the dynamic type is
* ACE_Locked_Data_Block<>
@@ -51,23 +60,30 @@ public:
*/
virtual ACE_Data_Block *clone_nocopy (ACE_Message_Block::Message_Flags mask = 0,
size_t max_size = 0) const;
+
private:
/// The lock
ACE_LOCK lock_;
+
// = Disallow these operations.
ACE_UNIMPLEMENTED_FUNC (ACE_Locked_Data_Block<ACE_LOCK> &operator= (const ACE_Locked_Data_Block<ACE_LOCK> &))
ACE_UNIMPLEMENTED_FUNC (ACE_Locked_Data_Block (const ACE_Locked_Data_Block<ACE_LOCK> &))
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Message_Block_T.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Message_Block_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Message_Block_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
#endif /* ACE_MESSAGE_BLOCK_T_H */
diff --git a/dep/ACE_wrappers/ace/Message_Block_T.inl b/dep/ACE_wrappers/ace/Message_Block_T.inl
index f250e41abb9..58c89c641ad 100644
--- a/dep/ACE_wrappers/ace/Message_Block_T.inl
+++ b/dep/ACE_wrappers/ace/Message_Block_T.inl
@@ -1,12 +1,15 @@
// -*- C++ -*-
//
// $Id: Message_Block_T.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template<class ACE_LOCK> ACE_INLINE
ACE_Locked_Data_Block<ACE_LOCK>::ACE_Locked_Data_Block (void)
{
this->locking_strategy_ = &this->lock_;
}
+
template<class ACE_LOCK> ACE_INLINE
ACE_Locked_Data_Block<ACE_LOCK>::
ACE_Locked_Data_Block (size_t size,
@@ -24,4 +27,5 @@ ACE_Locked_Data_Block (size_t size,
data_block_allocator)
{
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Message_Queue.cpp b/dep/ACE_wrappers/ace/Message_Queue.cpp
index 1cce1c7f7d0..ba04916c563 100644
--- a/dep/ACE_wrappers/ace/Message_Queue.cpp
+++ b/dep/ACE_wrappers/ace/Message_Queue.cpp
@@ -1,21 +1,29 @@
// $Id: Message_Queue.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Message_Queue.h"
#include "ace/Log_Msg.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Message_Queue.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID (ace,
Message_Queue,
"$Id: Message_Queue.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_Message_Queue_Base::~ACE_Message_Queue_Base (void)
{
}
+
int
ACE_Message_Queue_Base::state (void)
{
ACE_TRACE ("ACE_Message_Queue_Base::state");
+
return this->state_;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Message_Queue.h b/dep/ACE_wrappers/ace/Message_Queue.h
index f5e83080a6b..c9734213409 100644
--- a/dep/ACE_wrappers/ace/Message_Queue.h
+++ b/dep/ACE_wrappers/ace/Message_Queue.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Message_Queue.h
@@ -8,23 +9,30 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_MESSAGE_QUEUE_H
#define ACE_MESSAGE_QUEUE_H
#include /**/ "ace/pre.h"
+
#include "ace/Message_Block.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/IO_Cntl_Msg.h"
#if defined (ACE_HAS_WIN32_OVERLAPPED_IO)
# include "ace/Synch_Traits.h" /* Needed in ACE_Message_Queue_NT */
# include "ace/Thread_Mutex.h" /* Needed in ACE_Message_Queue_NT */
#endif
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward decls.
class ACE_Notification_Strategy;
template <ACE_SYNCH_DECL> class ACE_Message_Queue_Iterator;
template <ACE_SYNCH_DECL> class ACE_Message_Queue_Reverse_Iterator;
+
/**
* @class ACE_Message_Queue_Base
*
@@ -47,33 +55,44 @@ public:
enum
{
// Default high and low watermarks.
+
/// Default high watermark (16 K).
DEFAULT_HWM = 16 * 1024,
/// Default low watermark (same as high water mark).
DEFAULT_LWM = 16 * 1024,
+
// Queue states. Before PULSED state was added, the activate()
// and deactivate() methods returned WAS_INACTIVE or WAS_ACTIVE
// to indicate the previous condition. Now those methods
// return the state the queue was previously in. WAS_ACTIVE
// and WAS_INACTIVE are defined to match previous semantics for
// applications that don't use the PULSED state.
+
/// @deprecated Use ACTIVATED instead.
WAS_ACTIVE = 1,
/// Message queue is active and processing normally
ACTIVATED = 1,
+
/// @deprecated Use DEACTIVATED instead.
WAS_INACTIVE = 2,
/// Queue is deactivated; no enqueue or dequeue operations allowed.
DEACTIVATED = 2,
+
/// Message queue was pulsed; enqueue and dequeue may proceed normally.
PULSED = 3
+
};
+
ACE_Message_Queue_Base (void);
+
/// Close down the message queue and release all resources.
virtual int close (void) = 0;
+
/// Close down the message queue and release all resources.
virtual ~ACE_Message_Queue_Base (void);
+
// = Enqueue and dequeue methods.
+
/**
* Retrieve the first ACE_Message_Block without removing it. Note
* that @a timeout uses <{absolute}> time rather than <{relative}>
@@ -85,6 +104,7 @@ public:
*/
virtual int peek_dequeue_head (ACE_Message_Block *&first_item,
ACE_Time_Value *timeout = 0) = 0;
+
/**
* Enqueue a <ACE_Message_Block *> into the tail of the queue.
* Returns number of items in queue if the call succeeds or -1
@@ -98,6 +118,7 @@ public:
ACE_Time_Value *timeout = 0) = 0;
virtual int enqueue (ACE_Message_Block *new_item,
ACE_Time_Value *timeout = 0) = 0;
+
/**
* Dequeue and return the <ACE_Message_Block *> at the head of the
* queue. Returns number of items in queue if the call succeeds or
@@ -111,27 +132,37 @@ public:
ACE_Time_Value *timeout = 0) = 0;
virtual int dequeue (ACE_Message_Block *&first_item,
ACE_Time_Value *timeout = 0) = 0;
+
// = Check if queue is full/empty.
/// True if queue is full, else false.
virtual bool is_full (void) = 0;
+
/// True if queue is empty, else false.
virtual bool is_empty (void) = 0;
+
// = Queue statistic methods.
+
/// Number of total bytes on the queue, i.e., sum of the message
/// block sizes.
virtual size_t message_bytes (void) = 0;
+
/// Number of total length on the queue, i.e., sum of the message
/// block lengths.
virtual size_t message_length (void) = 0;
+
/// Number of total messages on the queue.
virtual size_t message_count (void) = 0;
+
/// New value of the number of total bytes on the queue, i.e.,
/// sum of the message block sizes.
virtual void message_bytes (size_t new_size) = 0;
+
/// New value of the number of total length on the queue, i.e.,
/// sum of the message block lengths.
virtual void message_length (size_t new_length) = 0;
+
// = Activation control methods.
+
/**
* Deactivate the queue and wake up all threads waiting on the queue
* so they can continue. No messages are removed from the queue,
@@ -142,6 +173,7 @@ public:
* @retval The queue's state before this call.
*/
virtual int deactivate (void) = 0;
+
/**
* Reactivate the queue so that threads can enqueue and dequeue
* messages again.
@@ -149,6 +181,7 @@ public:
* @retval The queue's state before this call.
*/
virtual int activate (void) = 0;
+
/**
* Pulse the queue to wake up any waiting threads. Changes the
* queue state to PULSED; future enqueue/dequeue operations proceed
@@ -157,35 +190,49 @@ public:
* @retval The queue's state before this call.
*/
virtual int pulse (void) = 0;
+
/// Returns the current state of the queue.
virtual int state (void);
+
/// Returns 1 if the state of the queue is DEACTIVATED,
/// and 0 if the queue's state is ACTIVATED or PULSED.
virtual int deactivated (void) = 0;
+
/// Get the notification strategy for the <Message_Queue>
virtual ACE_Notification_Strategy *notification_strategy (void) = 0;
+
/// Set the notification strategy for the <Message_Queue>
virtual void notification_strategy (ACE_Notification_Strategy *s) = 0;
+
// = Notification hook.
+
/// Dump the state of an object.
virtual void dump (void) const = 0;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
// = Disallow copying and assignment.
ACE_Message_Queue_Base (const ACE_Message_Queue_Base &);
void operator= (const ACE_Message_Queue_Base &);
+
protected:
/// Indicates the state of the queue, which can be
/// <ACTIVATED>, <DEACTIVATED>, or <PULSED>.
int state_;
+
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
// Include the templates here.
#include "ace/Message_Queue_T.h"
+
#if defined (__ACE_INLINE__)
#include "ace/Message_Queue.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_MESSAGE_QUEUE_H */
diff --git a/dep/ACE_wrappers/ace/Message_Queue.inl b/dep/ACE_wrappers/ace/Message_Queue.inl
index c4a99c6f39e..4dab2522200 100644
--- a/dep/ACE_wrappers/ace/Message_Queue.inl
+++ b/dep/ACE_wrappers/ace/Message_Queue.inl
@@ -1,9 +1,12 @@
// -*- C++ -*-
//
// $Id: Message_Queue.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_Message_Queue_Base::ACE_Message_Queue_Base (void)
{
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Message_Queue_NT.cpp b/dep/ACE_wrappers/ace/Message_Queue_NT.cpp
index eaae996fb94..a8c9c8859b7 100644
--- a/dep/ACE_wrappers/ace/Message_Queue_NT.cpp
+++ b/dep/ACE_wrappers/ace/Message_Queue_NT.cpp
@@ -1,15 +1,21 @@
// $Id: Message_Queue_NT.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Message_Queue_NT.h"
#include "ace/Log_Msg.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Message_Queue_NT.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID (ace,
Message_Queue_NT,
"$Id: Message_Queue_NT.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_HAS_WIN32_OVERLAPPED_IO)
+
ACE_Message_Queue_NT::ACE_Message_Queue_NT (DWORD max_threads)
: max_cthrs_ (max_threads),
cur_thrs_ (0),
@@ -21,6 +27,7 @@ ACE_Message_Queue_NT::ACE_Message_Queue_NT (DWORD max_threads)
ACE_TRACE ("ACE_Message_Queue_NT::ACE_Message_Queue_NT");
this->open (max_threads);
}
+
int
ACE_Message_Queue_NT::open (DWORD max_threads)
{
@@ -32,6 +39,7 @@ ACE_Message_Queue_NT::open (DWORD max_threads)
max_threads);
return (this->completion_port_ == 0 ? -1 : 0);
}
+
int
ACE_Message_Queue_NT::close (void)
{
@@ -40,11 +48,13 @@ ACE_Message_Queue_NT::close (void)
this->deactivate ();
return (::CloseHandle (this->completion_port_) ? 0 : -1 );
}
+
ACE_Message_Queue_NT::~ACE_Message_Queue_NT (void)
{
ACE_TRACE ("ACE_Message_Queue_NT::~ACE_Message_Queue_NT");
this->close ();
}
+
int
ACE_Message_Queue_NT::enqueue (ACE_Message_Block *new_item,
ACE_Time_Value *)
@@ -72,16 +82,20 @@ ACE_Message_Queue_NT::enqueue (ACE_Message_Block *new_item,
}
else
errno = ESHUTDOWN;
+
// Fail to enqueue the message.
return -1;
}
+
int
ACE_Message_Queue_NT::dequeue (ACE_Message_Block *&first_item,
ACE_Time_Value *timeout)
{
ACE_TRACE ("ACE_Message_Queue_NT::dequeue_head");
+
{
ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1);
+
// Make sure the MQ is not deactivated before proceeding.
if (this->state_ == ACE_Message_Queue_Base::DEACTIVATED)
{
@@ -91,6 +105,7 @@ ACE_Message_Queue_NT::dequeue (ACE_Message_Block *&first_item,
else
++this->cur_thrs_; // Increase the waiting thread count.
}
+
ULONG_PTR queue_state;
DWORD msize;
// Get a message from the completion port.
@@ -117,15 +132,18 @@ ACE_Message_Queue_NT::dequeue (ACE_Message_Block *&first_item,
}
return -1;
}
+
int
ACE_Message_Queue_NT::deactivate (void)
{
ACE_TRACE ("ACE_Message_Queue_NT::deactivate");
ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1);
+
int const previous_state = this->state_;
if (previous_state != ACE_Message_Queue_Base::DEACTIVATED)
{
this->state_ = ACE_Message_Queue_Base::DEACTIVATED;
+
// Get the number of shutdown messages necessary to wake up all
// waiting threads.
DWORD cntr =
@@ -138,6 +156,7 @@ ACE_Message_Queue_NT::deactivate (void)
}
return previous_state;
}
+
int
ACE_Message_Queue_NT::activate (void)
{
@@ -147,17 +166,21 @@ ACE_Message_Queue_NT::activate (void)
this->state_ = ACE_Message_Queue_Base::ACTIVATED;
return previous_status;
}
+
int
ACE_Message_Queue_NT::pulse (void)
{
ACE_TRACE ("ACE_Message_Queue_NT::pulse");
ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1);
+
int const previous_state = this->state_;
if (previous_state != ACE_Message_Queue_Base::DEACTIVATED)
{
this->state_ = ACE_Message_Queue_Base::PULSED;
+
// Get the number of shutdown messages necessary to wake up all
// waiting threads.
+
DWORD cntr =
this->cur_thrs_ - static_cast<DWORD> (this->cur_count_);
while (cntr-- > 0)
@@ -168,11 +191,13 @@ ACE_Message_Queue_NT::pulse (void)
}
return previous_state;
}
+
void
ACE_Message_Queue_NT::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_Message_Queue_NT::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
switch (this->state_)
{
@@ -189,6 +214,7 @@ ACE_Message_Queue_NT::dump (void) const
ACE_TEXT ("state = PULSED\n")));
break;
}
+
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("max_cthrs_ = %d\n")
ACE_TEXT ("cur_thrs_ = %d\n")
@@ -205,6 +231,8 @@ ACE_Message_Queue_NT::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
#endif /* ACE_HAS_WIN32_OVERLAPPED_IO */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Message_Queue_NT.h b/dep/ACE_wrappers/ace/Message_Queue_NT.h
index dd735612e62..ffdc9eb4da2 100644
--- a/dep/ACE_wrappers/ace/Message_Queue_NT.h
+++ b/dep/ACE_wrappers/ace/Message_Queue_NT.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Message_Queue_NT.h
@@ -8,18 +9,24 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_MESSAGE_QUEUE_NT_H
#define ACE_MESSAGE_QUEUE_NT_H
#include /**/ "ace/pre.h"
+
#include "ace/Message_Queue.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_WIN32_OVERLAPPED_IO)
# include "ace/Synch_Traits.h" /* Needed in ACE_Message_Queue_NT */
# include "ace/Thread_Mutex.h" /* Needed in ACE_Message_Queue_NT */
#endif
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_HAS_WIN32_OVERLAPPED_IO)
/**
* @class ACE_Message_Queue_NT
@@ -43,6 +50,7 @@ class ACE_Export ACE_Message_Queue_NT : public ACE_Message_Queue_Base
public:
// = Initialization and termination methods.
ACE_Message_Queue_NT (DWORD max_threads = ACE_Message_Queue_Base::DEFAULT_HWM);
+
/**
* Initialize the Message Queue by creating a new NT I/O completion
* port. The first arguemnt specifies the number of threads
@@ -50,12 +58,16 @@ public:
* 0 when succeeds, -1 otherwise.
*/
virtual int open (DWORD max_threads = ACE_Message_Queue_Base::DEFAULT_HWM);
+
/// Close down the underlying I/O completion port. You need to
/// re-open the MQ after this function is executed.
virtual int close (void);
+
/// Close down the message queue and release all resources.
virtual ~ACE_Message_Queue_NT (void);
+
// = Enqueue and dequeue methods.
+
/**
* Enqueue an <ACE_Message_Block *> at the end of the queue.
* Returns -1 on failure, else the number of items still on the
@@ -65,6 +77,7 @@ public:
ACE_Time_Value *timeout = 0);
virtual int enqueue (ACE_Message_Block *new_item,
ACE_Time_Value *timeout = 0);
+
/**
* Dequeue and return the <ACE_Message_Block *> at the head of the
* queue. Returns -1 on failure, else the number of items still on
@@ -74,31 +87,37 @@ public:
ACE_Time_Value *timeout = 0);
virtual int dequeue (ACE_Message_Block *&first_item,
ACE_Time_Value *timeout = 0);
+
// = Check if queue is full/empty.
/**
* Always return false.
*/
+
virtual bool is_full (void);
/**
* True if queue is empty, else false. Notice the return value is
* only transient.
*/
virtual bool is_empty (void);
+
// = Queue statistic methods (transient.)
/**
* Number of total bytes on the queue, i.e., sum of the message
* block sizes.
*/
virtual size_t message_bytes (void);
+
/**
* Number of total length on the queue, i.e., sum of the message
* block lengths.
*/
virtual size_t message_length (void);
+
/**
* Number of total messages on the queue.
*/
virtual size_t message_count (void);
+
// = Manual changes to these stats (used when queued message blocks
// change size or lengths).
/**
@@ -106,14 +125,18 @@ public:
* the message block sizes.
*/
virtual void message_bytes (size_t new_size);
+
/**
* New value of the number of total length on the queue, i.e., sum
* of the message block lengths.
*/
virtual void message_length (size_t new_length);
+
/// Get the max concurrent thread number.
virtual DWORD max_threads (void);
+
// = Activation control methods.
+
/**
* Deactivate the queue and wake up all threads waiting on the queue
* so they can continue. No messages are removed from the queue,
@@ -124,11 +147,13 @@ public:
* @retval The queue's state before this call.
*/
virtual int deactivate (void);
+
/**
* Reactivate the queue so that threads can enqueue and dequeue
* messages again. Returns the state of the queue before the call.
*/
virtual int activate (void);
+
/**
* Pulse the queue to wake up any waiting threads. Changes the
* queue state to PULSED; future enqueue/dequeue operations proceed
@@ -137,51 +162,71 @@ public:
* @retval The queue's state before this call.
*/
virtual int pulse (void);
+
/// Returns true if the state of the queue is <DEACTIVATED>,
/// but false if the queue's is <ACTIVATED> or <PULSED>.
virtual int deactivated (void);
+
// = Not currently implemented...
int peek_dequeue_head (ACE_Message_Block *&first_item,
ACE_Time_Value *timeout = 0);
ACE_Notification_Strategy *notification_strategy (void);
void notification_strategy (ACE_Notification_Strategy *s);
+
// = Notification hook.
+
/// Dump the state of an object.
virtual void dump (void) const;
+
/// Get the handle to the underlying completion port.
virtual ACE_HANDLE completion_port (void);
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
+
// Disallow copying and assignment.
ACE_Message_Queue_NT (const ACE_Message_Queue_NT &);
void operator= (const ACE_Message_Queue_NT &);
+
private:
// = Internal states.
+
/// Maximum threads that can be released (and run) concurrently.
DWORD max_cthrs_;
+
/// Current number of threads waiting to dequeue messages.
DWORD cur_thrs_;
+
/// Current number of bytes in queue.
size_t cur_bytes_;
+
/// Current length of messages in queue.
size_t cur_length_;
+
/// Current number of messages in the queue.
size_t cur_count_;
+
/**
* Synchronizer. This should really be an ACE_Recursive_Thread_Mutex
* but since this class is only supported on NT, it's okay to use
* ACE_Thread_Mutex here.
*/
ACE_SYNCH_MUTEX lock_;
+
/// Underlying NT IoCompletionPort.
ACE_HANDLE completion_port_;
+
};
#endif /* ACE_HAS_WIN32_OVERLAPPED_IO */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Message_Queue_NT.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_MESSAGE_QUEUE_NT_H */
diff --git a/dep/ACE_wrappers/ace/Message_Queue_NT.inl b/dep/ACE_wrappers/ace/Message_Queue_NT.inl
index ac7bddac3fc..4fc18fbbdf7 100644
--- a/dep/ACE_wrappers/ace/Message_Queue_NT.inl
+++ b/dep/ACE_wrappers/ace/Message_Queue_NT.inl
@@ -1,11 +1,15 @@
// -*- C++ -*-
//
// $Id: Message_Queue_NT.inl 80826 2008-03-04 14:51:23Z wotte $
+
#if defined (ACE_HAS_WIN32_OVERLAPPED_IO)
# include "ace/Guard_T.h"
#endif /* ACE_HAS_WIN32_OVERLAPPED_IO */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_HAS_WIN32_OVERLAPPED_IO)
+
ACE_INLINE int
ACE_Message_Queue_NT::enqueue_tail (ACE_Message_Block *new_item,
ACE_Time_Value *timeout)
@@ -13,6 +17,7 @@ ACE_Message_Queue_NT::enqueue_tail (ACE_Message_Block *new_item,
ACE_TRACE ("ACE_Message_Queue_NT::enqueue_tail");
return this->enqueue (new_item, timeout);
}
+
ACE_INLINE int
ACE_Message_Queue_NT::dequeue_head (ACE_Message_Block *&first_item,
ACE_Time_Value *timeout)
@@ -20,19 +25,23 @@ ACE_Message_Queue_NT::dequeue_head (ACE_Message_Block *&first_item,
ACE_TRACE ("ACE_Message_Queue_NT::dequeue_head");
return this->dequeue (first_item, timeout);
}
+
ACE_INLINE bool
ACE_Message_Queue_NT::is_full (void)
{
ACE_TRACE ("ACE_Message_Queue_NT::is_full");
return false; // Always not full.
}
+
ACE_INLINE bool
ACE_Message_Queue_NT::is_empty (void)
{
ACE_TRACE ("ACE_Message_Queue_NT::is_empty");
ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, false);
+
return this->cur_bytes_ > 0 || this->cur_count_ > 0 ? false : true;
}
+
ACE_INLINE size_t
ACE_Message_Queue_NT::message_bytes (void)
{
@@ -40,6 +49,7 @@ ACE_Message_Queue_NT::message_bytes (void)
// Accessing to size_t must be atomic.
return this->cur_bytes_;
}
+
ACE_INLINE size_t
ACE_Message_Queue_NT::message_length (void)
{
@@ -47,6 +57,7 @@ ACE_Message_Queue_NT::message_length (void)
// Accessing to size_t must be atomic.
return this->cur_length_;
}
+
ACE_INLINE size_t
ACE_Message_Queue_NT::message_count (void)
{
@@ -54,26 +65,32 @@ ACE_Message_Queue_NT::message_count (void)
// Accessing to size_t must be atomic.
return this->cur_count_;
}
+
ACE_INLINE void
ACE_Message_Queue_NT::message_bytes (size_t new_value)
{
ACE_TRACE ("ACE_Message_Queue_NT::message_bytes");
ACE_GUARD (ACE_SYNCH_MUTEX, ace_mon, this->lock_);
+
this->cur_bytes_ = new_value;
}
+
ACE_INLINE void
ACE_Message_Queue_NT::message_length (size_t new_value)
{
ACE_TRACE ("ACE_Message_Queue_NT::message_length");
ACE_GUARD (ACE_SYNCH_MUTEX, ace_mon, this->lock_);
+
this->cur_length_ = new_value;
}
+
ACE_INLINE DWORD
ACE_Message_Queue_NT::max_threads (void)
{
ACE_TRACE ("ACE_Message_Queue_NT::max_threads");
return this->max_cthrs_;
}
+
ACE_INLINE int
ACE_Message_Queue_NT::deactivated (void)
{
@@ -81,12 +98,14 @@ ACE_Message_Queue_NT::deactivated (void)
// Accessing to int must be atomic.
return this->state_ == ACE_Message_Queue_Base::DEACTIVATED;
}
+
ACE_INLINE ACE_HANDLE
ACE_Message_Queue_NT::completion_port (void)
{
ACE_TRACE ("ACE_Message_Queue_NT::completion_port");
return this->completion_port_;
}
+
ACE_INLINE int
ACE_Message_Queue_NT::peek_dequeue_head (ACE_Message_Block *&first_item,
ACE_Time_Value *timeout)
@@ -95,14 +114,18 @@ ACE_Message_Queue_NT::peek_dequeue_head (ACE_Message_Block *&first_item,
ACE_UNUSED_ARG(timeout);
ACE_NOTSUP_RETURN (-1);
}
+
ACE_INLINE ACE_Notification_Strategy *
ACE_Message_Queue_NT::notification_strategy (void)
{
ACE_NOTSUP_RETURN (0);
}
+
ACE_INLINE void
ACE_Message_Queue_NT::notification_strategy (ACE_Notification_Strategy *)
{
}
+
#endif /* ACE_HAS_WIN32_OVERLAPPED_IO */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Message_Queue_T.h b/dep/ACE_wrappers/ace/Message_Queue_T.h
index 6effd45ad3b..b4c764b4de8 100644
--- a/dep/ACE_wrappers/ace/Message_Queue_T.h
+++ b/dep/ACE_wrappers/ace/Message_Queue_T.h
@@ -1,4 +1,5 @@
/* -*- C++ -*- */
+
//=============================================================================
/**
* @file Message_Queue_T.h
@@ -8,23 +9,31 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_MESSAGE_QUEUE_T_H
#define ACE_MESSAGE_QUEUE_T_H
+
#include /**/ "ace/pre.h"
+
#include "ace/Message_Queue.h"
#include "ace/Dynamic_Message_Strategy.h"
#include "ace/Synch_Traits.h"
#include "ace/Guard_T.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_VXWORKS)
class ACE_Message_Queue_Vx;
#endif /* defined (ACE_VXWORKS) */
+
#if defined (ACE_HAS_WIN32_OVERLAPPED_IO)
class ACE_Message_Queue_NT;
#endif /* ACE_HAS_WIN32_OVERLAPPED_IO*/
+
#if defined (ACE_HAS_MONITOR_POINTS) && ACE_HAS_MONITOR_POINTS == 1
namespace ACE
{
@@ -34,6 +43,7 @@ namespace ACE
}
}
#endif /* ACE_HAS_MONITOR_POINTS==1 */
+
/**
* @class ACE_Message_Queue
*
@@ -57,11 +67,13 @@ class ACE_Message_Queue : public ACE_Message_Queue_Base
public:
friend class ACE_Message_Queue_Iterator<ACE_SYNCH_USE>;
friend class ACE_Message_Queue_Reverse_Iterator<ACE_SYNCH_USE>;
+
// = Traits
typedef ACE_Message_Queue_Iterator<ACE_SYNCH_USE>
ITERATOR;
typedef ACE_Message_Queue_Reverse_Iterator<ACE_SYNCH_USE>
REVERSE_ITERATOR;
+
/**
* @name Initialization methods
*/
@@ -92,13 +104,16 @@ public:
size_t lwm = ACE_Message_Queue_Base::DEFAULT_LWM,
ACE_Notification_Strategy *ns = 0);
//@}
+
/// Releases all resources from the message queue and marks it deactivated.
/// @sa flush().
///
/// @retval The number of messages released from the queue; -1 on error.
virtual int close (void);
+
/// Releases all resources from the message queue and marks it deactivated.
virtual ~ACE_Message_Queue (void);
+
/**
* Releases all resources from the message queue but does not mark it
* deactivated. This method holds the queue lock during this operation.
@@ -107,6 +122,7 @@ public:
* @return The number of messages flushed; -1 on error.
*/
virtual int flush (void);
+
/**
* Release all resources from the message queue but do not mark it
* as deactivated.
@@ -117,6 +133,7 @@ public:
* @return The number of messages flushed.
*/
virtual int flush_i (void);
+
/** @name Enqueue and dequeue methods
*
* The enqueue and dequeue methods accept a timeout value passed as
@@ -159,6 +176,7 @@ public:
*/
virtual int peek_dequeue_head (ACE_Message_Block *&first_item,
ACE_Time_Value *timeout = 0);
+
/**
* Enqueue an ACE_Message_Block into the queue in accordance with
* the ACE_Message_Block's priority (0 is lowest priority). FIFO
@@ -179,6 +197,7 @@ public:
*/
virtual int enqueue_prio (ACE_Message_Block *new_item,
ACE_Time_Value *timeout = 0);
+
/**
* Enqueue an ACE_Message_Block into the queue in accordance with the
* block's deadline time. FIFO order is maintained when messages of
@@ -199,6 +218,7 @@ public:
*/
virtual int enqueue_deadline (ACE_Message_Block *new_item,
ACE_Time_Value *timeout = 0);
+
/**
* @deprecated This is an alias for enqueue_prio(). It's only here for
* backwards compatibility and will go away in a subsequent release.
@@ -206,6 +226,7 @@ public:
*/
virtual int enqueue (ACE_Message_Block *new_item,
ACE_Time_Value *timeout = 0);
+
/**
* Enqueue one or more ACE_Message_Block objects at the tail of the queue.
* If the @a new_item @c next() pointer is non-zero, it is assumed to be the
@@ -228,6 +249,7 @@ public:
*/
virtual int enqueue_tail (ACE_Message_Block *new_item,
ACE_Time_Value *timeout = 0);
+
/**
* Enqueue one or more ACE_Message_Block objects at the head of the queue.
* If the @a new_item @c next() pointer is non-zero, it is assumed to be the
@@ -250,9 +272,11 @@ public:
*/
virtual int enqueue_head (ACE_Message_Block *new_item,
ACE_Time_Value *timeout = 0);
+
/// This method is an alias for the dequeue_head() method.
virtual int dequeue (ACE_Message_Block *&first_item,
ACE_Time_Value *timeout = 0);
+
/**
* Dequeue the ACE_Message_Block at the head of the queue and return
* a pointer to the dequeued block.
@@ -269,6 +293,7 @@ public:
*/
virtual int dequeue_head (ACE_Message_Block *&first_item,
ACE_Time_Value *timeout = 0);
+
/**
* Dequeue the ACE_Message_Block that has the lowest priority (preserves
* FIFO order for messages with the same priority) and return a pointer
@@ -286,6 +311,7 @@ public:
*/
virtual int dequeue_prio (ACE_Message_Block *&first_item,
ACE_Time_Value *timeout = 0);
+
/**
* Dequeue the ACE_Message_Block at the tail of the queue and return
* a pointer to the dequeued block.
@@ -302,6 +328,7 @@ public:
*/
virtual int dequeue_tail (ACE_Message_Block *&dequeued,
ACE_Time_Value *timeout = 0);
+
/**
* Dequeue the ACE_Message_Block with the earliest deadline time and return
* a pointer to the dequeued block.
@@ -319,27 +346,33 @@ public:
virtual int dequeue_deadline (ACE_Message_Block *&dequeued,
ACE_Time_Value *timeout = 0);
//@}
+
/** @name Queue statistics methods
*/
//@{
+
/// True if queue is full, else false.
virtual bool is_full (void);
/// True if queue is empty, else false.
virtual bool is_empty (void);
+
/**
* Number of total bytes on the queue, i.e., sum of the message
* block sizes.
*/
virtual size_t message_bytes (void);
+
/**
* Number of total length on the queue, i.e., sum of the message
* block lengths.
*/
virtual size_t message_length (void);
+
/**
* Number of total messages on the queue.
*/
virtual size_t message_count (void);
+
// = Manual changes to these stats (used when queued message blocks
// change size or lengths).
/**
@@ -352,11 +385,14 @@ public:
* of the message block lengths.
*/
virtual void message_length (size_t new_length);
+
//@}
+
/** @name Water mark (flow control) methods
*/
//@{
+
/**
* Get high watermark.
*/
@@ -366,6 +402,7 @@ public:
* stored in a queue before it's considered "full."
*/
virtual void high_water_mark (size_t hwm);
+
/**
* Get low watermark.
*/
@@ -377,12 +414,14 @@ public:
*/
virtual void low_water_mark (size_t lwm);
//@}
+
/** @name Activation and queue state methods
* See C++NPv2 Section 6.2 and APG Section 12.3 for a fuller treatment of
* queue states and transitions and how the transitions affect message
* enqueueing and dequeueing operations.
*/
//@{
+
/**
* Deactivate the queue and wakeup all threads waiting on the queue
* so they can continue. No messages are removed from the queue,
@@ -392,11 +431,13 @@ public:
* call and WAS_ACTIVE if queue was active before the call.
*/
virtual int deactivate (void);
+
/**
* Reactivate the queue so that threads can enqueue and dequeue
* messages again. Returns the state of the queue before the call.
*/
virtual int activate (void);
+
/**
* Pulse the queue to wake up any waiting threads. Changes the
* queue state to PULSED; future enqueue/dequeue operations proceed
@@ -405,16 +446,20 @@ public:
* @return The queue's state before this call.
*/
virtual int pulse (void);
+
/// Returns the current state of the queue, which can be one of
/// ACTIVATED, DEACTIVATED, or PULSED.
virtual int state (void);
+
/// Returns true if the state of the queue is <DEACTIVATED>,
/// but false if the queue's is <ACTIVATED> or <PULSED>.
virtual int deactivated (void);
//@}
+
/** @name Notification strategy methods
*/
//@{
+
/**
* This hook is automatically invoked by <enqueue_head>,
* <enqueue_tail>, and <enqueue_prio> when a new item is inserted
@@ -426,49 +471,70 @@ public:
* the notification occurs.
*/
virtual int notify (void);
+
/// Get the notification strategy for the <Message_Queue>
virtual ACE_Notification_Strategy *notification_strategy (void);
+
/// Set the notification strategy for the <Message_Queue>
virtual void notification_strategy (ACE_Notification_Strategy *s);
//@}
+
/// Returns a reference to the lock used by the ACE_Message_Queue.
virtual ACE_SYNCH_MUTEX_T &lock (void);
+
/// Dump the state of an object.
virtual void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
// = Routines that actually do the enqueueing and dequeueing.
+
// These routines assume that locks are held by the corresponding
// public methods. Since they are virtual, you can change the
// queueing mechanism by subclassing from ACE_Message_Queue.
+
/// Enqueue an <ACE_Message_Block *> in accordance with its priority.
virtual int enqueue_i (ACE_Message_Block *new_item);
+
/// Enqueue an <ACE_Message_Block *> in accordance with its deadline time.
virtual int enqueue_deadline_i (ACE_Message_Block *new_item);
+
/// Enqueue an <ACE_Message_Block *> at the end of the queue.
virtual int enqueue_tail_i (ACE_Message_Block *new_item);
+
/// Enqueue an <ACE_Message_Block *> at the head of the queue.
virtual int enqueue_head_i (ACE_Message_Block *new_item);
+
/// Dequeue and return the <ACE_Message_Block *> at the head of the
/// queue.
virtual int dequeue_head_i (ACE_Message_Block *&first_item);
+
/// Dequeue and return the <ACE_Message_Block *> with the lowest
/// priority.
virtual int dequeue_prio_i (ACE_Message_Block *&dequeued);
+
/// Dequeue and return the <ACE_Message_Block *> at the tail of the
/// queue.
virtual int dequeue_tail_i (ACE_Message_Block *&first_item);
+
/// Dequeue and return the <ACE_Message_Block *> with the lowest
/// deadline time.
virtual int dequeue_deadline_i (ACE_Message_Block *&first_item);
+
// = Check the boundary conditions (assumes locks are held).
+
/// True if queue is full, else false.
virtual bool is_full_i (void);
+
/// True if queue is empty, else false.
virtual bool is_empty_i (void);
+
// = Implementation of the public <activate> and <deactivate> methods.
+
// These methods assume locks are held.
+
/**
* Notifies all waiting threads that the queue has been deactivated
* so they can wakeup and continue other processing.
@@ -484,54 +550,76 @@ protected:
* @return The state of the queue before the call.
*/
virtual int deactivate_i (int pulse = 0);
+
/// Activate the queue.
virtual int activate_i (void);
+
// = Helper methods to factor out common #ifdef code.
+
/// Wait for the queue to become non-full.
virtual int wait_not_full_cond (ACE_Guard<ACE_SYNCH_MUTEX_T> &mon,
ACE_Time_Value *timeout);
+
/// Wait for the queue to become non-empty.
virtual int wait_not_empty_cond (ACE_Guard<ACE_SYNCH_MUTEX_T> &mon,
ACE_Time_Value *timeout);
+
/// Inform any threads waiting to enqueue that they can procede.
virtual int signal_enqueue_waiters (void);
+
/// Inform any threads waiting to dequeue that they can procede.
virtual int signal_dequeue_waiters (void);
+
/// Pointer to head of ACE_Message_Block list.
ACE_Message_Block *head_;
+
/// Pointer to tail of ACE_Message_Block list.
ACE_Message_Block *tail_;
+
/// Lowest number before unblocking occurs.
size_t low_water_mark_;
+
/// Greatest number of bytes before blocking.
size_t high_water_mark_;
+
/// Current number of bytes in the queue.
size_t cur_bytes_;
+
/// Current length of messages in the queue.
size_t cur_length_;
+
/// Current number of messages in the queue.
size_t cur_count_;
+
/// The notification strategy used when a new message is enqueued.
ACE_Notification_Strategy *notification_strategy_;
+
// = Synchronization primitives for controlling concurrent access.
/// Protect queue from concurrent access.
ACE_SYNCH_MUTEX_T lock_;
+
/// Used to make threads sleep until the queue is no longer empty.
ACE_SYNCH_CONDITION_T not_empty_cond_;
+
/// Used to make threads sleep until the queue is no longer full.
ACE_SYNCH_CONDITION_T not_full_cond_;
+
/// Sends the size of the queue whenever it changes.
#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
ACE::Monitor_Control::Size_Monitor *monitor_;
#endif
+
private:
+
// = Disallow these operations.
ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Message_Queue<ACE_SYNCH_USE> &))
ACE_UNIMPLEMENTED_FUNC (ACE_Message_Queue (const ACE_Message_Queue<ACE_SYNCH_USE> &))
};
+
// This typedef is used to get around a compiler bug in g++/vxworks.
typedef ACE_Message_Queue<ACE_SYNCH> ACE_DEFAULT_MESSAGE_QUEUE_TYPE;
+
/**
* @class ACE_Message_Queue_Iterator
*
@@ -543,25 +631,33 @@ class ACE_Message_Queue_Iterator
public:
// = Initialization method.
ACE_Message_Queue_Iterator (ACE_Message_Queue <ACE_SYNCH_USE> &queue);
+
// = Iteration methods.
/// Pass back the @a entry that hasn't been seen in the queue.
/// Returns 0 when all items have been seen, else 1.
int next (ACE_Message_Block *&entry);
+
/// Returns 1 when all items have been seen, else 0.
int done (void) const;
+
/// Move forward by one element in the queue. Returns 0 when all the
/// items in the set have been seen, else 1.
int advance (void);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Message_Queue we are iterating over.
ACE_Message_Queue <ACE_SYNCH_USE> &queue_;
+
/// Keeps track of how far we've advanced...
ACE_Message_Block *curr_;
};
+
/**
* @class ACE_Message_Queue_Reverse_Iterator
*
@@ -573,25 +669,33 @@ class ACE_Message_Queue_Reverse_Iterator
public:
// = Initialization method.
ACE_Message_Queue_Reverse_Iterator (ACE_Message_Queue <ACE_SYNCH_USE> &queue);
+
// = Iteration methods.
/// Pass back the @a entry that hasn't been seen in the queue.
/// Returns 0 when all items have been seen, else 1.
int next (ACE_Message_Block *&entry);
+
/// Returns 1 when all items have been seen, else 0.
int done (void) const;
+
/// Move forward by one element in the queue. Returns 0 when all the
/// items in the set have been seen, else 1.
int advance (void);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Message_Queue we are iterating over.
ACE_Message_Queue <ACE_SYNCH_USE> &queue_;
+
/// Keeps track of how far we've advanced...
ACE_Message_Block *curr_;
};
+
/**
* @class ACE_Dynamic_Message_Queue
*
@@ -668,8 +772,10 @@ public:
size_t hwm = ACE_Message_Queue_Base::DEFAULT_HWM,
size_t lwm = ACE_Message_Queue_Base::DEFAULT_LWM,
ACE_Notification_Strategy * = 0);
+
/// Close down the message queue and release all resources.
virtual ~ACE_Dynamic_Message_Queue (void);
+
/**
* Detach all messages with status given in the passed flags from
* the queue and return them by setting passed head and tail pointers
@@ -682,6 +788,7 @@ public:
virtual int remove_messages (ACE_Message_Block *&list_head,
ACE_Message_Block *&list_tail,
u_int status_flags);
+
/**
* Dequeue and return the <ACE_Message_Block *> at the head of the
* queue. Returns -1 on failure, else the number of items still on
@@ -689,8 +796,10 @@ public:
*/
virtual int dequeue_head (ACE_Message_Block *&first_item,
ACE_Time_Value *timeout = 0);
+
/// Dump the state of the queue.
virtual void dump (void) const;
+
/**
* Just call priority enqueue method: tail enqueue semantics for dynamic
* message queues are unstable: the message may or may not be where
@@ -699,6 +808,7 @@ public:
*/
virtual int enqueue_tail (ACE_Message_Block *new_item,
ACE_Time_Value *timeout = 0);
+
/**
* Just call priority enqueue method: head enqueue semantics for dynamic
* message queues are unstable: the message may or may not be where
@@ -708,9 +818,12 @@ public:
virtual int enqueue_head (ACE_Message_Block *new_item,
ACE_Time_Value *timeout = 0);
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
+
/**
* Enqueue an <ACE_Message_Block *> in accordance with its priority.
* priority may be *dynamic* or *static* or a combination or *both*
@@ -719,12 +832,14 @@ protected:
* enqueued messages.
*/
virtual int enqueue_i (ACE_Message_Block *new_item);
+
/// Enqueue a message in priority order within a given priority status sublist
virtual int sublist_enqueue_i (ACE_Message_Block *new_item,
const ACE_Time_Value &current_time,
ACE_Message_Block *&sublist_head,
ACE_Message_Block *&sublist_tail,
ACE_Dynamic_Message_Strategy::Priority_Status status);
+
/**
* Dequeue and return the <ACE_Message_Block *> at the head of the
* logical queue. Attempts first to dequeue from the pending
@@ -733,39 +848,55 @@ protected:
* empty just sets the passed pointer to zero and returns -1.
*/
virtual int dequeue_head_i (ACE_Message_Block *&first_item);
+
/// Refresh the queue using the strategy
/// specific priority status function.
virtual int refresh_queue (const ACE_Time_Value & current_time);
+
/// Refresh the pending queue using the strategy
/// specific priority status function.
virtual int refresh_pending_queue (const ACE_Time_Value & current_time);
+
/// Refresh the late queue using the strategy
/// specific priority status function.
virtual int refresh_late_queue (const ACE_Time_Value & current_time);
+
/// Pointer to head of the pending messages
ACE_Message_Block *pending_head_;
+
/// Pointer to tail of the pending messages
ACE_Message_Block *pending_tail_;
+
/// Pointer to head of the late messages
ACE_Message_Block *late_head_;
+
/// Pointer to tail of the late messages
ACE_Message_Block *late_tail_;
+
/// Pointer to head of the beyond late messages
ACE_Message_Block *beyond_late_head_;
+
/// Pointer to tail of the beyond late messages
ACE_Message_Block *beyond_late_tail_;
+
/// Pointer to a dynamic priority evaluation function.
ACE_Dynamic_Message_Strategy &message_strategy_;
+
private:
// = Disallow public access to these operations.
+
ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Dynamic_Message_Queue<ACE_SYNCH_USE> &))
ACE_UNIMPLEMENTED_FUNC (ACE_Dynamic_Message_Queue (const ACE_Dynamic_Message_Queue<ACE_SYNCH_USE> &))
+
// provide definitions for these (just call base class method),
// but make them private so they're not accessible outside the class
+
/// Private method to hide public base class method: just calls base class method
virtual int peek_dequeue_head (ACE_Message_Block *&first_item,
ACE_Time_Value *timeout = 0);
+
};
+
/**
* @class ACE_Message_Queue_Factory
*
@@ -789,6 +920,7 @@ public:
create_static_message_queue (size_t hwm = ACE_Message_Queue_Base::DEFAULT_HWM,
size_t lwm = ACE_Message_Queue_Base::DEFAULT_LWM,
ACE_Notification_Strategy * = 0);
+
/// Factory method for a dynamically prioritized (by time to deadline) ACE_Dynamic_Message_Queue
static ACE_Dynamic_Message_Queue<ACE_SYNCH_USE> *
create_deadline_message_queue (size_t hwm = ACE_Message_Queue_Base::DEFAULT_HWM,
@@ -798,6 +930,7 @@ public:
u_long static_bit_field_shift = 10, // 10 low order bits
u_long dynamic_priority_max = 0x3FFFFFUL, // 2^(22)-1
u_long dynamic_priority_offset = 0x200000UL); // 2^(22-1)
+
/// Factory method for a dynamically prioritized (by laxity) ACE_Dynamic_Message_Queue
static ACE_Dynamic_Message_Queue<ACE_SYNCH_USE> *
create_laxity_message_queue (size_t hwm = ACE_Message_Queue_Base::DEFAULT_HWM,
@@ -808,21 +941,29 @@ public:
u_long dynamic_priority_max = 0x3FFFFFUL, // 2^(22)-1
u_long dynamic_priority_offset = 0x200000UL); // 2^(22-1)
+
#if defined (ACE_VXWORKS)
+
/// Factory method for a wrapped VxWorks message queue
static ACE_Message_Queue_Vx *
create_Vx_message_queue (size_t max_messages, size_t max_message_length,
ACE_Notification_Strategy *ns = 0);
+
#endif /* defined (ACE_VXWORKS) */
+
#if defined (ACE_HAS_WIN32_OVERLAPPED_IO)
+
/// Factory method for a NT message queue.
static ACE_Message_Queue_NT *
create_NT_message_queue (size_t max_threads);
+
#endif /* ACE_HAS_WIN32_OVERLAPPED_IO */
};
+
// Forward decls.
template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> class ACE_Message_Queue_Ex_Iterator;
template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> class ACE_Message_Queue_Ex_Reverse_Iterator;
+
/**
* @class ACE_Message_Queue_Ex
*
@@ -844,18 +985,22 @@ template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL>
class ACE_Message_Queue_Ex
{
public:
+
enum
{
/// Default priority value. This is the lowest priority.
DEFAULT_PRIORITY = 0
};
+
friend class ACE_Message_Queue_Ex_Iterator <ACE_MESSAGE_TYPE, ACE_SYNCH_USE>;
friend class ACE_Message_Queue_Ex_Reverse_Iterator<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>;
+
// = Traits
typedef ACE_Message_Queue_Ex_Iterator<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>
ITERATOR;
typedef ACE_Message_Queue_Ex_Reverse_Iterator<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>
REVERSE_ITERATOR;
+
/**
* @name Initialization methods
*/
@@ -886,13 +1031,16 @@ public:
size_t lwm = ACE_Message_Queue_Base::DEFAULT_LWM,
ACE_Notification_Strategy * = 0);
//@}
+
/// Releases all resources from the message queue and marks it deactivated.
/// @sa flush().
///
/// @retval The number of messages released from the queue; -1 on error.
virtual int close (void);
+
/// Releases all resources from the message queue and marks it deactivated.
virtual ~ACE_Message_Queue_Ex (void);
+
/**
* Releases all resources from the message queue but does not mark it
* deactivated. This method holds the queue lock during this operation.
@@ -901,6 +1049,7 @@ public:
* @return The number of messages flushed; -1 on error.
*/
virtual int flush (void);
+
/**
* Release all resources from the message queue but do not mark it
* as deactivated.
@@ -911,6 +1060,7 @@ public:
* @return The number of messages flushed.
*/
virtual int flush_i (void);
+
/** @name Enqueue and dequeue methods
*
* The enqueue and dequeue methods accept a timeout value passed as
@@ -953,6 +1103,7 @@ public:
*/
virtual int peek_dequeue_head (ACE_MESSAGE_TYPE *&first_item,
ACE_Time_Value *timeout = 0);
+
/**
* Enqueue an ACE_MESSAGE TYPE into the queue in accordance with
* the specified priority (0 is lowest priority). FIFO
@@ -973,12 +1124,14 @@ public:
virtual int enqueue_prio (ACE_MESSAGE_TYPE *new_item,
ACE_Time_Value *timeout = 0,
unsigned long priority = DEFAULT_PRIORITY);
+
/**
* This method acts just like enqueue_tail(). There's no deadline
* time associated with items.
*/
virtual int enqueue_deadline (ACE_MESSAGE_TYPE *new_item,
ACE_Time_Value *timeout = 0);
+
/**
* @deprecated This is an alias for enqueue_prio(). It's only here for
* backwards compatibility and will go away in a subsequent release.
@@ -986,6 +1139,7 @@ public:
*/
virtual int enqueue (ACE_MESSAGE_TYPE *new_item,
ACE_Time_Value *timeout = 0);
+
/**
* Enqueue an item at the tail of the queue.
*
@@ -1001,6 +1155,7 @@ public:
*/
virtual int enqueue_tail (ACE_MESSAGE_TYPE *new_item,
ACE_Time_Value *timeout = 0);
+
/**
* Enqueue an item at the head of the queue.
*
@@ -1016,9 +1171,11 @@ public:
*/
virtual int enqueue_head (ACE_MESSAGE_TYPE *new_item,
ACE_Time_Value *timeout = 0);
+
/// This method is an alias for the following <dequeue_head> method.
virtual int dequeue (ACE_MESSAGE_TYPE *&first_item,
ACE_Time_Value *timeout = 0);
+
/**
* Dequeue the item at the head of the queue and return a pointer to it.
*
@@ -1034,6 +1191,7 @@ public:
*/
virtual int dequeue_head (ACE_MESSAGE_TYPE *&first_item,
ACE_Time_Value *timeout = 0);
+
/**
* Dequeue the item that has the lowest priority (preserves
* FIFO order for items with the same priority) and return a pointer
@@ -1051,6 +1209,7 @@ public:
*/
virtual int dequeue_prio (ACE_MESSAGE_TYPE *&dequeued,
ACE_Time_Value *timeout = 0);
+
/**
* Dequeue the item at the tail of the queue and return a pointer to it.
*
@@ -1066,6 +1225,7 @@ public:
*/
virtual int dequeue_tail (ACE_MESSAGE_TYPE *&dequeued,
ACE_Time_Value *timeout = 0);
+
/**
* Because there's deadline associated with enqueue_deadline(), this
* method will behave just as dequeue_head().
@@ -1073,13 +1233,17 @@ public:
virtual int dequeue_deadline (ACE_MESSAGE_TYPE *&dequeued,
ACE_Time_Value *timeout = 0);
//@}
+
/** @name Queue statistics methods
*/
//@{
+
/// True if queue is full, else false.
virtual bool is_full (void);
+
/// True if queue is empty, else false.
virtual bool is_empty (void);
+
/**
* Number of total bytes on the queue, i.e., sum of the message
* block sizes.
@@ -1094,6 +1258,7 @@ public:
* Number of total messages on the queue.
*/
virtual size_t message_count (void);
+
// = Manual changes to these stats (used when queued message blocks
// change size or lengths).
/**
@@ -1106,10 +1271,13 @@ public:
* of the message block lengths.
*/
virtual void message_length (size_t new_length);
+
//@}
+
/** @name Water mark (flow control) methods
*/
//@{
+
/**
* Get high watermark.
*/
@@ -1119,6 +1287,7 @@ public:
* stored in a queue before it's considered "full."
*/
virtual void high_water_mark (size_t hwm);
+
/**
* Get low watermark.
*/
@@ -1130,12 +1299,14 @@ public:
*/
virtual void low_water_mark (size_t lwm);
//@}
+
/** @name Activation and queue state methods
* See C++NPv2 Section 6.2 and APG Section 12.3 for a fuller treatment of
* queue states and transitions and how the transitions affect message
* enqueueing and dequeueing operations.
*/
//@{
+
/**
* Deactivate the queue and wakeup all threads waiting on the queue
* so they can continue. No messages are removed from the queue,
@@ -1145,11 +1316,13 @@ public:
* call and WAS_ACTIVE if queue was active before the call.
*/
virtual int deactivate (void);
+
/**
* Reactivate the queue so that threads can enqueue and dequeue
* messages again. Returns the state of the queue before the call.
*/
virtual int activate (void);
+
/**
* Pulse the queue to wake up any waiting threads. Changes the
* queue state to PULSED; future enqueue/dequeue operations proceed
@@ -1158,16 +1331,20 @@ public:
* @retval The queue's state before this call.
*/
virtual int pulse (void);
+
/// Returns the current state of the queue, which can be one of
/// ACTIVATED, DEACTIVATED, or PULSED.
virtual int state (void);
+
/// Returns true if the state of the queue is DEACTIVATED,
/// but false if the queue's state is ACTIVATED or PULSED.
virtual int deactivated (void);
//@}
+
/** @name Notification strategy methods
*/
//@{
+
/**
* This hook is automatically invoked by <enqueue_head>,
* <enqueue_tail>, and <enqueue_prio> when a new item is inserted
@@ -1179,21 +1356,28 @@ public:
* the notification occurs.
*/
virtual int notify (void);
+
/// Get the notification strategy for the <Message_Queue>
virtual ACE_Notification_Strategy *notification_strategy (void);
+
/// Set the notification strategy for the <Message_Queue>
virtual void notification_strategy (ACE_Notification_Strategy *s);
//@}
+
/// Returns a reference to the lock used by the ACE_Message_Queue_Ex.
virtual ACE_SYNCH_MUTEX_T &lock (void);
+
/// Dump the state of an object.
virtual void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
/// Implement this via an ACE_Message_Queue.
ACE_Message_Queue<ACE_SYNCH_USE> queue_;
};
+
/**
* @class ACE_Message_Queue_Ex_Iterator
*
@@ -1205,23 +1389,30 @@ class ACE_Message_Queue_Ex_Iterator
public:
// = Initialization method.
ACE_Message_Queue_Ex_Iterator (ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE> & queue);
+
// = Iteration methods.
/// Pass back the @a entry that hasn't been seen in the queue.
/// Returns 0 when all items have been seen, else 1.
int next (ACE_MESSAGE_TYPE *&entry);
+
/// Returns 1 when all items have been seen, else 0.
int done (void) const;
+
/// Move forward by one element in the queue. Returns 0 when all the
/// items in the set have been seen, else 1.
int advance (void);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Implement this via the ACE_Message_Queue_Iterator
ACE_Message_Queue_Iterator<ACE_SYNCH_USE> iter_;
};
+
/**
* @class ACE_Message_Queue_Ex_Iterator
*
@@ -1233,23 +1424,30 @@ class ACE_Message_Queue_Ex_Reverse_Iterator
public:
// = Initialization method.
ACE_Message_Queue_Ex_Reverse_Iterator (ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE> & queue);
+
// = Iteration methods.
/// Pass back the @a entry that hasn't been seen in the queue.
/// Returns 0 when all items have been seen, else 1.
int next (ACE_MESSAGE_TYPE *&entry);
+
/// Returns 1 when all items have been seen, else 0.
int done (void) const;
+
/// Move forward by one element in the queue. Returns 0 when all the
/// items in the set have been seen, else 1.
int advance (void);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Implement this via the ACE_Message_Queue_Reverse_Iterator
ACE_Message_Queue_Reverse_Iterator<ACE_SYNCH_USE> iter_;
};
+
/**
* @class ACE_Message_Queue_Ex_N
*
@@ -1273,6 +1471,7 @@ class ACE_Message_Queue_Ex_N : public ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE
{
public:
// = Initialization and termination methods.
+
/**
* Initialize an ACE_Message_Queue_Ex_N. The @a high_water_mark
* determines how many bytes can be stored in a queue before it's
@@ -1290,8 +1489,10 @@ public:
ACE_Message_Queue_Ex_N (size_t high_water_mark = ACE_Message_Queue_Base::DEFAULT_HWM,
size_t low_water_mark = ACE_Message_Queue_Base::DEFAULT_LWM,
ACE_Notification_Strategy * ns = 0);
+
/// Close down the message queue and release all resources.
virtual ~ACE_Message_Queue_Ex_N (void);
+
/**
* Enqueue one or more @c ACE_MESSAGE_TYPE objects at the head of the queue.
* If the @a new_item @c next() pointer is non-zero, it is assumed to be the
@@ -1313,6 +1514,7 @@ public:
* - ESHUTDOWN: the queue was deactivated or pulsed
*/
virtual int enqueue_head (ACE_MESSAGE_TYPE *new_item, ACE_Time_Value *tv = 0);
+
/**
* Enqueue one or more @c ACE_MESSAGE_TYPE objects at the tail of the queue.
* If the @a new_item @c next() pointer is non-zero, it is assumed to be the
@@ -1334,8 +1536,10 @@ public:
* - ESHUTDOWN: the queue was deactivated or pulsed
*/
virtual int enqueue_tail (ACE_MESSAGE_TYPE *new_item, ACE_Time_Value *tv = 0);
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
/**
* An helper method that wraps the incoming chain messages
@@ -1343,13 +1547,18 @@ protected:
*/
ACE_Message_Block *wrap_with_mbs_i (ACE_MESSAGE_TYPE *new_item);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Message_Queue_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Message_Queue_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_MESSAGE_QUEUE_T_H */
diff --git a/dep/ACE_wrappers/ace/Message_Queue_Vx.cpp b/dep/ACE_wrappers/ace/Message_Queue_Vx.cpp
index be7d59026d3..e224f5078e9 100644
--- a/dep/ACE_wrappers/ace/Message_Queue_Vx.cpp
+++ b/dep/ACE_wrappers/ace/Message_Queue_Vx.cpp
@@ -1,18 +1,25 @@
// $Id: Message_Queue_Vx.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Message_Queue_Vx.h"
#include "ace/Log_Msg.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Message_Queue_Vx.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID (ace,
Message_Queue_Vx,
"$Id: Message_Queue_Vx.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_VXWORKS)
+
////////////////////////////////
// class ACE_Message_Queue_Vx //
////////////////////////////////
+
void
ACE_Message_Queue_Vx::dump (void) const
{
@@ -52,6 +59,7 @@ ACE_Message_Queue_Vx::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
ACE_Message_Queue_Vx::ACE_Message_Queue_Vx (size_t max_messages,
size_t max_message_length,
ACE_Notification_Strategy *ns)
@@ -60,18 +68,23 @@ ACE_Message_Queue_Vx::ACE_Message_Queue_Vx (size_t max_messages,
max_message_length_ (static_cast<int> (max_message_length))
{
ACE_TRACE ("ACE_Message_Queue_Vx::ACE_Message_Queue_Vx");
+
if (this->open (max_messages_, max_message_length_, ns) == -1)
ACE_ERROR ((LM_ERROR, ACE_TEXT ("open")));
}
+
ACE_Message_Queue_Vx::~ACE_Message_Queue_Vx (void)
{
ACE_TRACE ("ACE_Message_Queue_Vx::~ACE_Message_Queue_Vx");
+
if (this->tail_ != 0 && this->close () == -1)
ACE_ERROR ((LM_ERROR, ACE_TEXT ("close")));
}
+
// Don't bother locking since if someone calls this function more than
// once for the same queue, we're in bigger trouble than just
// concurrency control!
+
int
ACE_Message_Queue_Vx::open (size_t max_messages,
size_t max_message_length,
@@ -87,120 +100,147 @@ ACE_Message_Queue_Vx::open (size_t max_messages,
this->notification_strategy_ = ns;
this->max_messages_ = static_cast<int> (max_messages);
this->max_message_length_ = static_cast<int> (max_message_length);
+
if (tail_)
{
// Had already created a msgQ, so delete it.
close ();
activate_i ();
}
+
return (this->tail_ =
reinterpret_cast<ACE_Message_Block *> (
::msgQCreate (max_messages_,
max_message_length_,
MSG_Q_FIFO))) == 0 ? -1 : 0;
}
+
// Clean up the queue if we have not already done so!
+
int
ACE_Message_Queue_Vx::close (void)
{
ACE_TRACE ("ACE_Message_Queue_Vx::close");
// Don't lock, because we don't have a lock. It shouldn't be
// necessary, anyways.
+
this->deactivate_i ();
+
// Don't bother to free up the remaining message on the list,
// because we don't have any way to iterate over what's in the
// queue.
+
return ::msgQDelete (msgq ());
}
+
bool
ACE_Message_Queue_Vx::is_empty_i (void)
{
ACE_TRACE ("ACE_Message_Queue_Vx::is_empty_i");
return ::msgQNumMsgs (msgq ()) == 0;
}
+
bool
ACE_Message_Queue_Vx::is_full_i (void)
{
ACE_TRACE ("ACE_Message_Queue_Vx::is_full_i");
return ::msgQNumMsgs (msgq ()) >= max_messages_;
}
+
size_t
ACE_Message_Queue_Vx::high_water_mark (void)
{
ACE_TRACE ("ACE_Message_Queue_Vx::high_water_mark");
ACE_NOTSUP_RETURN ((size_t) -1);
}
+
void
ACE_Message_Queue_Vx::high_water_mark (size_t)
{
ACE_TRACE ("ACE_Message_Queue_Vx::high_water_mark");
ACE_NOTSUP;
}
+
size_t
ACE_Message_Queue_Vx::low_water_mark (void)
{
ACE_TRACE ("ACE_Message_Queue_Vx::low_water_mark");
// Don't need to guard, because this is fixed.
+
ACE_NOTSUP_RETURN ((size_t) -1);
}
+
void
ACE_Message_Queue_Vx::low_water_mark (size_t)
{
ACE_TRACE ("ACE_Message_Queue_Vx::low_water_mark");
ACE_NOTSUP;
}
+
size_t
ACE_Message_Queue_Vx::message_bytes (void)
{
ACE_TRACE ("ACE_Message_Queue_Vx::message_bytes");
ACE_NOTSUP_RETURN ((size_t) -1);
}
+
size_t
ACE_Message_Queue_Vx::message_length (void)
{
ACE_TRACE ("ACE_Message_Queue_Vx::message_length");
ACE_NOTSUP_RETURN ((size_t) -1);
}
+
size_t
ACE_Message_Queue_Vx::message_count (void)
{
ACE_TRACE ("ACE_Message_Queue_Vx::message_count");
// Don't need to guard, because this is a system call.
+
return ::msgQNumMsgs (msgq ());
}
+
void
ACE_Message_Queue_Vx::message_bytes (size_t)
{
ACE_TRACE ("ACE_Message_Queue_Vx::message_bytes");
ACE_NOTSUP;
}
+
void
ACE_Message_Queue_Vx::message_length (size_t)
{
ACE_TRACE ("ACE_Message_Queue_Vx::message_length");
ACE_NOTSUP;
}
+
int
ACE_Message_Queue_Vx::signal_enqueue_waiters (void)
{
// No-op.
return 0;
}
+
int
ACE_Message_Queue_Vx::signal_dequeue_waiters (void)
{
// No-op.
return 0;
}
+
int
ACE_Message_Queue_Vx::enqueue_tail_i (ACE_Message_Block *new_item)
{
ACE_TRACE ("ACE_Message_Queue_Vx::enqueue_tail_i");
+
if (new_item == 0)
return -1;
+
// Don't try to send a composite message!!!! Only the first
// block will be sent.
+
++this->cur_count_;
+
// Always use this method to actually send a message on the queue.
if (::msgQSend (msgq (),
new_item->rd_ptr (),
@@ -211,43 +251,55 @@ ACE_Message_Queue_Vx::enqueue_tail_i (ACE_Message_Block *new_item)
else
return -1;
}
+
int
ACE_Message_Queue_Vx::enqueue_head_i (ACE_Message_Block *new_item)
{
ACE_TRACE ("ACE_Message_Queue_Vx::enqueue_head_i");
+
// Just delegate to enqueue_tail_i.
return enqueue_tail_i (new_item);
}
+
int
ACE_Message_Queue_Vx::enqueue_i (ACE_Message_Block *new_item)
{
ACE_TRACE ("ACE_Message_Queue_Vx::enqueue_i");
+
if (new_item == 0)
return -1;
+
if (this->head_ == 0)
// Should always take this branch.
return this->enqueue_head_i (new_item);
else
ACE_NOTSUP_RETURN (-1);
}
+
int
ACE_Message_Queue_Vx::enqueue_deadline_i (ACE_Message_Block *new_item)
{
ACE_TRACE ("ACE_Message_Queue_Vx::enqueue_deadline_i");
+
// Just delegate to enqueue_tail_i.
return enqueue_tail_i (new_item);
}
+
// Actually get the first ACE_Message_Block (no locking, so must be
// called with locks held). This method assumes that the queue has at
// least one item in it when it is called.
+
int
ACE_Message_Queue_Vx::dequeue_head_i (ACE_Message_Block *&first_item)
{
ACE_TRACE ("ACE_Message_Queue_Vx::dequeue_head_i");
+
// We don't allocate a new Message_Block: the caller must provide
// it, and must ensure that it is big enough (without chaining).
+
if (first_item == 0 || first_item->wr_ptr () == 0)
return -1;
+
if (::msgQReceive (msgq (),
first_item->wr_ptr (),
first_item->size (),
@@ -256,25 +308,30 @@ ACE_Message_Queue_Vx::dequeue_head_i (ACE_Message_Block *&first_item)
else
return ::msgQNumMsgs (msgq ());
}
+
int
ACE_Message_Queue_Vx::dequeue_prio_i (ACE_Message_Block *& /*dequeued*/)
{
ACE_TRACE ("ACE_Message_Queue_Vx::dequeue_prio_i");
ACE_NOTSUP_RETURN (-1);
}
+
int
ACE_Message_Queue_Vx::dequeue_tail_i (ACE_Message_Block *& /*dequeued*/)
{
ACE_TRACE ("ACE_Message_Queue_Vx::dequeue_tail_i");
ACE_NOTSUP_RETURN (-1);
}
+
int
ACE_Message_Queue_Vx::dequeue_deadline_i (ACE_Message_Block *& /*dequeued*/)
{
ACE_TRACE ("ACE_Message_Queue_Vx::dequeue_deadline_i");
ACE_NOTSUP_RETURN (-1);
}
+
// Take a look at the first item without removing it.
+
int
ACE_Message_Queue_Vx::wait_not_full_cond (ACE_Guard<ACE_Null_Mutex> &mon,
ACE_Time_Value *tv)
@@ -282,8 +339,10 @@ ACE_Message_Queue_Vx::wait_not_full_cond (ACE_Guard<ACE_Null_Mutex> &mon,
// Always return here, and let the VxWorks message queue handle blocking.
ACE_UNUSED_ARG (mon);
ACE_UNUSED_ARG (tv);
+
return 0;
}
+
int
ACE_Message_Queue_Vx::wait_not_empty_cond (ACE_Guard<ACE_Null_Mutex> &mon,
ACE_Time_Value *tv)
@@ -291,8 +350,10 @@ ACE_Message_Queue_Vx::wait_not_empty_cond (ACE_Guard<ACE_Null_Mutex> &mon,
// Always return here, and let the VxWorks message queue handle blocking.
ACE_UNUSED_ARG (mon);
ACE_UNUSED_ARG (tv);
+
return 0;
}
+
#if ! defined (ACE_NEEDS_FUNC_DEFINITIONS)
int
ACE_Message_Queue_Vx::peek_dequeue_head (ACE_Message_Block *&,
@@ -301,6 +362,8 @@ ACE_Message_Queue_Vx::peek_dequeue_head (ACE_Message_Block *&,
ACE_NOTSUP_RETURN (-1);
}
#endif /* ! ACE_NEEDS_FUNC_DEFINITIONS */
+
#endif /* ACE_VXWORKS */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Message_Queue_Vx.h b/dep/ACE_wrappers/ace/Message_Queue_Vx.h
index a3a27d6595e..a442394e25a 100644
--- a/dep/ACE_wrappers/ace/Message_Queue_Vx.h
+++ b/dep/ACE_wrappers/ace/Message_Queue_Vx.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Message_Queue_Vx.h
@@ -8,20 +9,28 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_MESSAGE_QUEUE_VX_H
#define ACE_MESSAGE_QUEUE_VX_H
#include /**/ "ace/pre.h"
+
#include "ace/Message_Block.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_VXWORKS)
+
// Include the templates here.
#include "ace/Message_Queue_T.h"
+
# include /**/ <msgQLib.h>
# include "ace/Null_Mutex.h"
# include "ace/Null_Condition.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Message_Queue_Vx
*
@@ -60,30 +69,37 @@ public:
ACE_Message_Queue_Vx (size_t max_messages,
size_t max_message_length,
ACE_Notification_Strategy * = 0);
+
// Create a message queue with all the defaults.
/// Create a message queue with all the defaults.
virtual int open (size_t max_messages,
size_t max_message_length,
ACE_Notification_Strategy * = 0);
+
/// Close down the message queue and release all resources.
virtual int close (void);
+
/// Close down the message queue and release all resources.
virtual ~ACE_Message_Queue_Vx (void);
+
// = Queue statistic methods.
/**
* Number of total bytes on the queue, i.e., sum of the message
* block sizes.
*/
virtual size_t message_bytes (void);
+
/**
* Number of total length on the queue, i.e., sum of the message
* block lengths.
*/
virtual size_t message_length (void);
+
/**
* Number of total messages on the queue.
*/
virtual size_t message_count (void);
+
// = Manual changes to these stats (used when queued message blocks
// change size or lengths).
/**
@@ -96,81 +112,117 @@ public:
* of the message block lengths.
*/
virtual void message_length (size_t new_length);
+
// = Flow control routines
+
/// Get high watermark.
virtual size_t high_water_mark (void);
+
/// Set high watermark.
virtual void high_water_mark (size_t hwm);
+
/// Get low watermark.
virtual size_t low_water_mark (void);
+
/// Set low watermark.
virtual void low_water_mark (size_t lwm);
+
// = Activation control methods.
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
/// Enqueue an <ACE_Message_Block *> in accordance with its priority.
virtual int enqueue_i (ACE_Message_Block *new_item);
+
/// Enqueue an <ACE_Message_Block *> in accordance with its deadline time.
virtual int enqueue_deadline_i (ACE_Message_Block *new_item);
+
/// Enqueue an <ACE_Message_Block *> at the end of the queue.
virtual int enqueue_tail_i (ACE_Message_Block *new_item);
+
/// Enqueue an <ACE_Message_Block *> at the head of the queue.
virtual int enqueue_head_i (ACE_Message_Block *new_item);
+
/// Dequeue and return the <ACE_Message_Block *> at the head of the
/// queue.
virtual int dequeue_head_i (ACE_Message_Block *&first_item);
+
/// Dequeue and return the <ACE_Message_Block *> with the lowest
/// priority.
virtual int dequeue_prio_i (ACE_Message_Block *&dequeued);
+
/// Dequeue and return the <ACE_Message_Block *> at the tail of the
/// queue.
virtual int dequeue_tail_i (ACE_Message_Block *&dequeued);
+
/// Dequeue and return the <ACE_Message_Block *> that has the lowest
/// deadline time.
virtual int dequeue_deadline_i (ACE_Message_Block *&dequeued);
+
// = Check the boundary conditions (assumes locks are held).
/// True if queue is full, else false.
virtual bool is_full_i (void);
+
/// True if queue is empty, else false.
virtual bool is_empty_i (void);
+
// = Implementation of public <activate>/<deactivate> methods above.
+
// These methods assume locks are held.
+
// = Helper methods to factor out common #ifdef code.
/// Wait for the queue to become non-full.
virtual int wait_not_full_cond (ACE_Guard<ACE_Null_Mutex> &mon,
ACE_Time_Value *tv);
+
/// Wait for the queue to become non-empty.
virtual int wait_not_empty_cond (ACE_Guard<ACE_Null_Mutex> &mon,
ACE_Time_Value *tv);
+
/// Inform any threads waiting to enqueue that they can procede.
virtual int signal_enqueue_waiters (void);
+
/// Inform any threads waiting to dequeue that they can procede.
virtual int signal_dequeue_waiters (void);
+
/// Access the underlying msgQ.
MSG_Q_ID msgq (void);
+
private:
+
// Disallow copying and assignment.
ACE_Message_Queue_Vx (const ACE_Message_Queue_Vx &);
void operator= (const ACE_Message_Queue_Vx &);
+
ACE_UNIMPLEMENTED_FUNC (virtual int peek_dequeue_head
(ACE_Message_Block *&first_item,
ACE_Time_Value *tv = 0))
+
private:
/// Maximum number of messages that can be queued.
int max_messages_;
+
/// Maximum message size, in bytes.
int max_message_length_;
+
/// Native message queue options.
int options_;
+
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_VXWORKS */
+
#if defined (__ACE_INLINE__)
#include "ace/Message_Queue_Vx.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_MESSAGE_QUEUE_VX_H */
diff --git a/dep/ACE_wrappers/ace/Message_Queue_Vx.inl b/dep/ACE_wrappers/ace/Message_Queue_Vx.inl
index c7d87808dec..b295e958c92 100644
--- a/dep/ACE_wrappers/ace/Message_Queue_Vx.inl
+++ b/dep/ACE_wrappers/ace/Message_Queue_Vx.inl
@@ -1,14 +1,19 @@
// -*- C++ -*-
//
// $Id: Message_Queue_Vx.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_VXWORKS)
// Specialization to use native VxWorks Message Queues.
+
ACE_INLINE MSG_Q_ID
ACE_Message_Queue_Vx::msgq (void)
{
// Hijack the tail_ field to store the MSG_Q_ID.
return reinterpret_cast<MSG_Q_ID> (tail_);
}
+
#endif /* ACE_VXWORKS */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Method_Object.h b/dep/ACE_wrappers/ace/Method_Object.h
index b78ebdab0d3..cb330d4ae2b 100644
--- a/dep/ACE_wrappers/ace/Method_Object.h
+++ b/dep/ACE_wrappers/ace/Method_Object.h
@@ -1,4 +1,5 @@
/* -*- C++ -*- */
+
//=============================================================================
/**
* @file Method_Object.h
@@ -14,18 +15,25 @@
*/
//=============================================================================
+
#ifndef ACE_METHOD_OBJECT_H
#define ACE_METHOD_OBJECT_H
#include /**/ "ace/pre.h"
+
#include "ace/Method_Request.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Maintain backwards compatibility so that Steve Huston doesn't go
// postal... ;-)
typedef ACE_Method_Request ACE_Method_Object;
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
#endif /* ACE_METHOD_OBJECT_H */
diff --git a/dep/ACE_wrappers/ace/Method_Request.cpp b/dep/ACE_wrappers/ace/Method_Request.cpp
index e556f5d69af..528bf147433 100644
--- a/dep/ACE_wrappers/ace/Method_Request.cpp
+++ b/dep/ACE_wrappers/ace/Method_Request.cpp
@@ -1,24 +1,31 @@
#include "ace/Method_Request.h"
+
ACE_RCSID (ace,
Method_Request,
"$Id: Method_Request.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_Method_Request::ACE_Method_Request (unsigned long prio)
: priority_ (prio)
{
}
+
ACE_Method_Request::~ACE_Method_Request (void)
{
}
+
unsigned long
ACE_Method_Request::priority (void) const
{
return this->priority_;
}
+
void
ACE_Method_Request::priority (unsigned long prio)
{
this->priority_ = prio;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Method_Request.h b/dep/ACE_wrappers/ace/Method_Request.h
index c2777153919..56548a71e92 100644
--- a/dep/ACE_wrappers/ace/Method_Request.h
+++ b/dep/ACE_wrappers/ace/Method_Request.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Method_Request.h
@@ -10,15 +11,22 @@
*/
//=============================================================================
+
#ifndef ACE_METHOD_REQUEST_H
#define ACE_METHOD_REQUEST_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Global_Macros.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Method_Request
*
@@ -40,11 +48,14 @@ public:
// = Initialization and termination methods.
/// Constructor.
ACE_Method_Request (unsigned long priority = 0);
+
/// Destructor.
virtual ~ACE_Method_Request (void);
+
// = Accessors.
/// Get priority.
unsigned long priority (void) const;
+
/// Set priority.
/**
* Priority values are user-defined. The default (set in the constructor)
@@ -57,6 +68,7 @@ public:
* @sa ACE_Activation_Queue::enqueue
*/
void priority (unsigned long prio);
+
// = Invocation method (must be overridden by subclasses).
/// Invoked by the scheduler to execute the request.
/**
@@ -68,16 +80,22 @@ public:
* if needed.
*/
virtual int call (void) = 0;
+
private:
+
/// Disallow copying and assignment.
ACE_Method_Request (const ACE_Method_Request &);
void operator= (const ACE_Method_Request &);
+
protected:
/// The priority of the request.
unsigned long priority_;
+
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
#endif /* ACE_METHOD_REQUEST_H */
diff --git a/dep/ACE_wrappers/ace/Metrics_Cache.h b/dep/ACE_wrappers/ace/Metrics_Cache.h
index 889cdb24412..b318ab028de 100644
--- a/dep/ACE_wrappers/ace/Metrics_Cache.h
+++ b/dep/ACE_wrappers/ace/Metrics_Cache.h
@@ -1,4 +1,5 @@
/* -*- C++ -*- */
+
//=============================================================================
/**
* @file Metrics_Cache.h
@@ -9,14 +10,20 @@
*/
//=============================================================================
+
#ifndef ACE_METRICS_CACHE_H
#define ACE_METRICS_CACHE_H
+
#include "ace/Timeprobe.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_METRICS_COLLECTION)
+
#if defined (ACE_ENABLE_TIMEPROBES) && defined (ACE_COMPILE_TIMEPROBES)
+
/**
* Call the appropriate 'report_ + NAME + _start' function. The start function makes a time probe measurement.
*
@@ -38,6 +45,7 @@
do { if((METRICS_PTR->metrics_enabled())) { \
METRICS_PTR->report_##NAME##_start(X); \
} } while (0)
+
/**
* Call the appropriate 'report_ + NAME + _stop' function. The stop function makes a time probe measurement.
*
@@ -53,6 +61,7 @@ METRICS_PTR->report_##NAME##_start(X); \
do { if((METRICS_PTR->metrics_enabled())) { \
METRICS_PTR->report_##NAME##_stop(X); \
} } while (0)
+
/**
* Call the appropriate 'report_ + NAME + _suspend' function. The suspend function makes a time probe measurement.
* This marks when the object under observation has been suspended.
@@ -67,6 +76,7 @@ METRICS_PTR->report_##NAME##_stop(X); \
do { if((METRICS_PTR->metrics_enabled())) { \
METRICS_PTR->report_##NAME##_suspend(X); \
} } while (0)
+
/**
* Call the appropriate 'report_ + NAME + _resume' function. The suspend function makes a time probe measurement.
* This marks when the object under observation that was suspended is not resuming normal execution.
@@ -82,6 +92,7 @@ do { if((METRICS_PTR->metrics_enabled())) { \
METRICS_PTR->report_##NAME##_resume(X); \
} } while (0)
+
/**
* Mystery macros. I could not find where there were functions like 'report_base_metrics_start ()'. All the
* start and stop functions had an argument to find the probe in the cache
@@ -90,24 +101,31 @@ METRICS_PTR->report_##NAME##_resume(X); \
do { if((METRICS_PTR->metrics_enabled())) { \
METRICS_PTR->report_##NAME##_start(); \
} } while (0)
+
# define STOP_METRIC(METRICS_PTR,NAME) \
do { if((METRICS_PTR->metrics_enabled())) { \
METRICS_PTR->report_##NAME##_stop(); \
} } while (0)
+
#include "ace/Metrics_Cache_T.h"
#include "ace/Singleton.h"
+
#if defined (_MSC_VER)
// Disable warning of using Microsoft Extension.
#pragma warning(disable:4231)
#endif /* _MSC_VER */
+
#if defined (_MSC_VER)
// Default back the warning of using Microsoft Extension.
#pragma warning(default:4231)
#endif /* _MSC_VER */
+
#else
#error ACE_Compile_Timeprobes must be defined in order to collect metrics
#endif /* ACE_ENABLE_TIMEPROBES & ACE_COMPILE_TIMEPROBES */
+
#else
+
# define REGISTER_METRICS_PROBE_RETURN(METRICS_PTR,METRICS_REGION,PROBE_NAME,PROBE_TYPE,METRICS_HANDLE)
# define REGISTER_METRICS_REPORTING_PROBE_RETURN(METRICS_PTR,METRICS_REGION,PROBE_NAME,PROBE_TYPE,METRICS_LOGGER_REF,METRICS_HANDLE)
# define START_DISPATCH_METRIC(METRICS_PTR,NAME,X)
@@ -116,6 +134,8 @@ METRICS_PTR->report_##NAME##_stop(); \
# define RESUME_DISPATCH_METRIC(METRICS_PTR,NAME,X)
# define START_METRIC(METRICS_PTR,NAME)
# define STOP_METRIC(METRICS_PTR,NAME)
+
#endif /* ACE_ENABLE_TIMEPROBES && ACE_COMPILE_TIMEPROBES */
+
#endif /* ACE_METRICS_CACHE_H */
diff --git a/dep/ACE_wrappers/ace/Metrics_Cache_T.h b/dep/ACE_wrappers/ace/Metrics_Cache_T.h
index 9bd8c087814..5785163c413 100644
--- a/dep/ACE_wrappers/ace/Metrics_Cache_T.h
+++ b/dep/ACE_wrappers/ace/Metrics_Cache_T.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Metrics_Cache_T.h
@@ -9,22 +10,30 @@
*/
//=============================================================================
+
#ifndef ACE_METRICS_CACHE_T_H
#define ACE_METRICS_CACHE_T_H
+
#include /**/ "ace/config-all.h"
+
// helpful macro definitions
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_COMPILE_TIMEPROBES)
+
#include "ace/Timeprobe.h"
#include "ace/Timeprobe_T.h"
+
// Defaults for initializing timeprobes and timeprobe arays.
#define METRICS_MIN_TIMEPROBE_TABLE_SIZE 256 * 4
#define METRICS_MAX_TIMEPROBE_TABLE_SIZE 256 * 256
#define METRICS_DEFAULT_TIMEPROBE_TABLE_SIZE METRICS_MIN_TIMEPROBE_TABLE_SIZE
#define METRICS_DEFAULT_TIMEPROBE_COUNT 6
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Metrics_Timeprobe
*
@@ -38,11 +47,14 @@ class ACE_Metrics_Timeprobe :
public ACE_Timeprobe_Ex<ACE_LOCK, ALLOCATOR>
{
public:
+
typedef ACE_Metrics_Timeprobe<ACE_LOCK, ALLOCATOR>
ACE_METRICS_TIMEPROBE_TYPE;
+
typedef ACE_timeprobe_t ACE_METRICS_TIMEPROBE_DATA_TYPE;
typedef ACE_METRICS_TIMEPROBE_TYPE* ACE_METRICS_TIMEPROBE_BASED_PTR_TYPE;
typedef char* ACE_METRICS_NAME_BASED_PTR_TYPE;
+
// Enumerated timeprobe event types.
enum event_id
{
@@ -51,39 +63,53 @@ public:
WORK_SUSPEND = 2,
WORK_RESUME = 3
};
+
// Default constructor: plugs in the above event descriptions.
ACE_Metrics_Timeprobe (u_int id = 0,
const char *name = 0,
u_long size = METRICS_DEFAULT_TIMEPROBE_TABLE_SIZE);
+
// Constructor with allocator: plugs in the above event descriptions.
ACE_Metrics_Timeprobe (ALLOCATOR *allocatorPtr,
u_int id = 0,
const char *name = 0,
u_long size = METRICS_DEFAULT_TIMEPROBE_TABLE_SIZE);
+
// Destructor.
virtual ~ACE_Metrics_Timeprobe ();
+
// Returns true if a timeprobe event matches the passed id.
int is_event (const ACE_METRICS_TIMEPROBE_DATA_TYPE &t,
ACE_Metrics_Timeprobe<ACE_LOCK, ALLOCATOR>::event_id id);
+
// Accessor and mutator for probe name.
const char * probe_name (void);
void probe_name (char * name);
+
// Accessor for probe id.
u_int probe_id (void);
+
// Mutator for probe id.
void probe_id (u_int id);
+
// Flush the ACE metrics timeprobe into shared memory.
void flush_ACE_Metrics_Timeprobe ();
+
protected:
+
// Identifier for the timeprobe.
u_int id_;
+
// Name of the timeprobe.
char* name_;
+
private:
+
// Declare but do not define.
ACE_Metrics_Timeprobe (const ACE_Metrics_Timeprobe<ACE_LOCK, ALLOCATOR> &);
void operator =(const ACE_Metrics_Timeprobe<ACE_LOCK, ALLOCATOR> &);
};
+
/**
* @class ACE_Metrics_Cache
*
@@ -96,89 +122,123 @@ template <class ACE_LOCK, class ALLOCATOR>
class ACE_Metrics_Cache
{
public:
+
typedef ACE_Metrics_Cache <ACE_LOCK, ALLOCATOR> ACE_METRICS_CACHE_TYPE;
+
// Default constructor.
ACE_Metrics_Cache (u_long table_size
= METRICS_DEFAULT_TIMEPROBE_TABLE_SIZE,
u_long number_of_probes
= METRICS_DEFAULT_TIMEPROBE_COUNT,
ALLOCATOR * allocatorPtr = (ALLOCATOR*)ALLOCATOR::instance());
+
// Destructor.
~ACE_Metrics_Cache ();
+
// = Dispatching metrics.
+
// Report start, stop, suspend, and resume times of a dispatch
// enqueue: stores data metrics on the supplier side.
void report_enqueue_start (u_long i);
void report_enqueue_stop (u_long i);
void report_enqueue_suspend (u_long i);
void report_enqueue_resume (u_long i);
+
// Report start, stop, suspend, and resume times of a dispatch
// dequeue: stores data metrics on the supplier side..
void report_dequeue_start (u_long i);
void report_dequeue_stop (u_long i);
void report_dequeue_suspend (u_long i);
void report_dequeue_resume (u_long i);
+
// Reset the metrics data on the consumer side.
void reset_base_statistics ();
+
// Flips the supplier and consumer sides.
void flip_supplier_and_consumer ();
+
// Flush the ACE metrics cache into shared memory.
void flush_ACE_Metrics_Cache ();
+
// Set the enable state for metrics collection.
void metrics_enabled(int enabled);
+
// Return the enable state for metrics collection.
int metrics_enabled(void) const;
+
protected:
+
// Obtain an allocator pointer correctly thunked for the current
// address space. If there is no allocator stored in the instance,
// the singleton allocator in the current process is used.
ALLOCATOR * allocator (void);
+
// = Implementation members.
+
// Number of probes in each supplier/consumer set.
u_long probe_set_size_;
+
// Probe data counts for each supplier/consumer set.
u_long * enqueue_count_ [2];
u_long * dequeue_count_ [2];
+
// Probes for each supplier/consumer set.
ACE_Metrics_Timeprobe<ACE_LOCK, ALLOCATOR> ** enqueue_probes_ [2];
ACE_Metrics_Timeprobe<ACE_LOCK, ALLOCATOR> ** dequeue_probes_ [2];
+
// Names for the probes.
char ** enqueue_names_;
char ** dequeue_names_;
+
// Index from which probe events are being consumed.
// for WSOA, it's the data being sent to the logger
int consumer_index_;
+
// Index to which probe events are being supplied.
// for WSOA, it's the data being recorded from the probes
int supplier_index_;
+
// Size of the timestamp table in each probe.
u_long table_size_;
+
// Interval start and stop timestamps.
ACE_Time_Value interval_start_;
+
// Interval start and stop timestamps.
ACE_Time_Value interval_end_;
+
// Flag to indicate whether or not start time of interval has been
// initialized since the last reset.
int interval_initialized_;
+
// Indicator of whether metrics is enabled.
int metrics_enabled_;
+
private:
+
// Allocation strategy object.
ALLOCATOR* allocator_;
+
// Declare but do not define.
ACE_Metrics_Cache (const ACE_Metrics_Cache<ACE_LOCK, ALLOCATOR> &);
void operator = (const ACE_Metrics_Cache<ACE_LOCK, ALLOCATOR> &);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Metrics_Cache_T.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Metrics_Cache_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Metrics_Cache_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#endif /* defined (ACE_COMPILE_TIMEPROBES) */
+
#endif /* ACE_METRICS_CACHE_T_H */
diff --git a/dep/ACE_wrappers/ace/Metrics_Cache_T.inl b/dep/ACE_wrappers/ace/Metrics_Cache_T.inl
index b9f1f503a0d..e3cc3b8cc66 100644
--- a/dep/ACE_wrappers/ace/Metrics_Cache_T.inl
+++ b/dep/ACE_wrappers/ace/Metrics_Cache_T.inl
@@ -1,13 +1,17 @@
// -*- C++ -*-
//
// $Id: Metrics_Cache_T.inl 80826 2008-03-04 14:51:23Z wotte $
+
#ifndef ACE_METRICS_CACHE_T_INL
#define ACE_METRICS_CACHE_T_INL
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/////////////////////////////
// Class ACE_Metrics_Cache //
/////////////////////////////
+
template <class ACE_LOCK, class ALLOCATOR>
ACE_INLINE void
ACE_Metrics_Cache<ACE_LOCK, ALLOCATOR>::report_enqueue_start (u_long i)
@@ -17,6 +21,7 @@ ACE_Metrics_Cache<ACE_LOCK, ALLOCATOR>::report_enqueue_start (u_long i)
u_long & count =
this->enqueue_count_ [this->supplier_index_] [i];
++count;
+
if (! this->interval_initialized_)
{
this->interval_initialized_ = 1;
@@ -26,6 +31,7 @@ ACE_Metrics_Cache<ACE_LOCK, ALLOCATOR>::report_enqueue_start (u_long i)
this->interval_end_.set (this->interval_start_.sec(),
this->interval_start_.usec());
}
+
// Take the metrics timeprobe last, to avoid measuring the above
// metrics processing.
ACE_Metrics_Timeprobe<ACE_LOCK, ALLOCATOR> * probe =
@@ -35,6 +41,7 @@ ACE_Metrics_Cache<ACE_LOCK, ALLOCATOR>::report_enqueue_start (u_long i)
}
}
+
template <class ACE_LOCK, class ALLOCATOR>
ACE_INLINE void
ACE_Metrics_Cache<ACE_LOCK, ALLOCATOR>::report_enqueue_stop (u_long i)
@@ -47,14 +54,18 @@ ACE_Metrics_Cache<ACE_LOCK, ALLOCATOR>::report_enqueue_stop (u_long i)
this->enqueue_probes_ [this->supplier_index_][i];
probe->
timeprobe (ACE_Metrics_Timeprobe<ACE_LOCK, ALLOCATOR>::WORK_STOP);
+
ACE_hrtime_t hrtime_now = ACE_OS::gethrtime ();
ACE_High_Res_Timer::hrtime_to_tv (this->interval_end_,
hrtime_now);
+
u_long & count = enqueue_count_ [this->supplier_index_][i];
++count;
}
+
}
+
template <class ACE_LOCK, class ALLOCATOR>
ACE_INLINE void
ACE_Metrics_Cache<ACE_LOCK, ALLOCATOR>::report_enqueue_suspend (u_long i)
@@ -71,6 +82,7 @@ ACE_Metrics_Cache<ACE_LOCK, ALLOCATOR>::report_enqueue_suspend (u_long i)
}
}
+
template <class ACE_LOCK, class ALLOCATOR>
ACE_INLINE void
ACE_Metrics_Cache<ACE_LOCK, ALLOCATOR>::report_enqueue_resume (u_long i)
@@ -87,6 +99,7 @@ ACE_Metrics_Cache<ACE_LOCK, ALLOCATOR>::report_enqueue_resume (u_long i)
}
}
+
template <class ACE_LOCK, class ALLOCATOR>
ACE_INLINE void
ACE_Metrics_Cache<ACE_LOCK, ALLOCATOR>::report_dequeue_start (u_long i)
@@ -96,6 +109,7 @@ ACE_Metrics_Cache<ACE_LOCK, ALLOCATOR>::report_dequeue_start (u_long i)
u_long & count =
this->dequeue_count_ [this->supplier_index_] [i];
++count;
+
if (! this->interval_initialized_)
{
this->interval_initialized_ = 1;
@@ -105,6 +119,7 @@ ACE_Metrics_Cache<ACE_LOCK, ALLOCATOR>::report_dequeue_start (u_long i)
this->interval_end_.set (this->interval_start_.sec(),
this->interval_start_.usec());
}
+
// Take the metrics timeprobe last, to avoid measuring the above
// metrics processing.
ACE_Metrics_Timeprobe<ACE_LOCK, ALLOCATOR> * probe =
@@ -114,6 +129,7 @@ ACE_Metrics_Cache<ACE_LOCK, ALLOCATOR>::report_dequeue_start (u_long i)
}
}
+
template <class ACE_LOCK, class ALLOCATOR>
ACE_INLINE void
ACE_Metrics_Cache<ACE_LOCK, ALLOCATOR>::report_dequeue_stop (u_long i)
@@ -124,15 +140,19 @@ ACE_Metrics_Cache<ACE_LOCK, ALLOCATOR>::report_dequeue_stop (u_long i)
// metrics processing below.
ACE_Metrics_Timeprobe<ACE_LOCK, ALLOCATOR> * probe =
this->dequeue_probes_ [this->supplier_index_][i];
+
probe->timeprobe (ACE_Metrics_Timeprobe<ACE_LOCK, ALLOCATOR>::WORK_STOP);
+
ACE_hrtime_t hrtime_now = ACE_OS::gethrtime ();
ACE_High_Res_Timer::hrtime_to_tv (this->interval_end_,
hrtime_now);
+
u_long & count = dequeue_count_ [this->supplier_index_] [i];
++count;
}
}
+
template <class ACE_LOCK, class ALLOCATOR>
ACE_INLINE void
ACE_Metrics_Cache<ACE_LOCK, ALLOCATOR>::report_dequeue_suspend (u_long i)
@@ -149,6 +169,7 @@ ACE_Metrics_Cache<ACE_LOCK, ALLOCATOR>::report_dequeue_suspend (u_long i)
}
}
+
template <class ACE_LOCK, class ALLOCATOR>
ACE_INLINE void
ACE_Metrics_Cache<ACE_LOCK, ALLOCATOR>::report_dequeue_resume (u_long i)
@@ -165,6 +186,7 @@ ACE_Metrics_Cache<ACE_LOCK, ALLOCATOR>::report_dequeue_resume (u_long i)
}
}
+
template <class ACE_LOCK, class ALLOCATOR>
ACE_INLINE void
ACE_Metrics_Cache<ACE_LOCK, ALLOCATOR>::reset_base_statistics ()
@@ -172,10 +194,12 @@ ACE_Metrics_Cache<ACE_LOCK, ALLOCATOR>::reset_base_statistics ()
this->interval_initialized_ = 0;
this->interval_start_.set (0, 0);
this->interval_end_.set (0, 0);
+
for (u_int i = 0; i < this->probe_set_size_; ++i)
{
this->enqueue_count_ [this->consumer_index_] [i] = 0;
this->dequeue_count_ [this->consumer_index_] [i] = 0;
+
ACE_Metrics_Timeprobe<ACE_LOCK, ALLOCATOR> * probe =
this->enqueue_probes_ [this->consumer_index_][i];
probe->reset ();
@@ -185,7 +209,9 @@ ACE_Metrics_Cache<ACE_LOCK, ALLOCATOR>::reset_base_statistics ()
}
}
+
// Flips the supplier and consumer positions.
+
template <class ACE_LOCK, class ALLOCATOR>
ACE_INLINE void
ACE_Metrics_Cache<ACE_LOCK, ALLOCATOR>::flip_supplier_and_consumer ()
@@ -194,17 +220,21 @@ ACE_Metrics_Cache<ACE_LOCK, ALLOCATOR>::flip_supplier_and_consumer ()
consumer_index_ = supplier_index_;
supplier_index_ = temp;
}
+
template <class ACE_LOCK, class ALLOCATOR>
ACE_INLINE void
ACE_Metrics_Cache<ACE_LOCK, ALLOCATOR>::metrics_enabled(int enabled)
{
metrics_enabled_ = enabled;
}
+
template <class ACE_LOCK, class ALLOCATOR>
ACE_INLINE int
ACE_Metrics_Cache<ACE_LOCK, ALLOCATOR>::metrics_enabled(void) const
{
return metrics_enabled_;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_METRICS_CACHE_T_INL */
diff --git a/dep/ACE_wrappers/ace/Min_Max.h b/dep/ACE_wrappers/ace/Min_Max.h
index a51013f8f14..fe22b7e9a77 100644
--- a/dep/ACE_wrappers/ace/Min_Max.h
+++ b/dep/ACE_wrappers/ace/Min_Max.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Min_Max.h
@@ -11,48 +12,60 @@
* @author Derek Dominish <Derek.Dominish@Australia.Boeing.com>
*/
//=============================================================================
+
#ifndef ACE_MIN_MAX_H
#define ACE_MIN_MAX_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
# if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
# endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template <class T>
inline const T &
ace_min (const T &t1, const T &t2)
{
return t2 > t1 ? t1 : t2;
}
+
template <class T>
inline const T &
ace_max (const T &t1, const T &t2)
{
return t1 > t2 ? t1 : t2;
}
+
template <class T>
inline const T &
ace_min (const T &t1, const T &t2, const T &t3)
{
return ace_min (ace_min (t1, t2), t3);
}
+
template <class T>
inline const T &
ace_max (const T &t1, const T &t2, const T &t3)
{
return ace_max (ace_max (t1, t2), t3);
}
+
template <class T>
inline const T &
ace_range (const T &min, const T &max, const T &val)
{
return ace_min (ace_max (min, val), max);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# define ACE_MIN(a,b) ace_min((a),(b))
# define ACE_MAX(a,b) ace_max((a),(b))
# define ACE_RANGE(a,b,c) ace_range((a),(b),(c))
+
#include /**/ "ace/post.h"
#endif /* ACE_MIN_MAX_H */
diff --git a/dep/ACE_wrappers/ace/Module.h b/dep/ACE_wrappers/ace/Module.h
index ae912762db3..e749b6365cd 100644
--- a/dep/ACE_wrappers/ace/Module.h
+++ b/dep/ACE_wrappers/ace/Module.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file Module.h
@@ -8,16 +9,23 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//==========================================================================
+
#ifndef ACE_MODULE_H
#define ACE_MODULE_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Task_T.h"
#include "ace/os_include/os_dirent.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Module_Base
*
@@ -34,10 +42,13 @@ public:
{
/// Indicates that the flags have not been set
M_FLAGS_NOT_SET = 0,
+
/// Indicates that <close> should delete the writer Task.
M_DELETE_READER = 1,
+
/// Indicates that <close> should delete the reader Task.
M_DELETE_WRITER = 2,
+
/// Indicates that <close> deletes the Tasks.
/**
* Don't change this value without updating the same enum in class
@@ -46,10 +57,12 @@ public:
* together.
*/
M_DELETE = 3,
+
/// Indicates that <close> should not delete any Tasks.
M_DELETE_NONE = 4
};
};
+
/**
* @class ACE_Module
*
@@ -68,8 +81,10 @@ public:
// = Initialization and termination methods.
/// Create an empty Module.
ACE_Module (void);
+
/// Shutdown the Module.
virtual ~ACE_Module (void);
+
/// Create an initialized module with @a module_name as its identity
/// and @a reader and @a writer as its tasks.
ACE_Module (const ACE_TCHAR *module_name,
@@ -77,6 +92,7 @@ public:
ACE_Task<ACE_SYNCH_USE> *reader = 0,
void *args = 0,
int flags = M_DELETE);
+
/**
* Initialize the module with <module_name> as its identity
* and <reader> and <writer> as its tasks. Previously register
@@ -89,6 +105,7 @@ public:
ACE_Task<ACE_SYNCH_USE> *reader = 0,
void *a = 0,
int flags = M_DELETE);
+
/**
* Close down the module and its tasks. The flags argument can be
* used to override the default behaviour, which depends on previous
@@ -97,9 +114,11 @@ public:
* not be called from within <ACE_Task::module_closed>.
*/
int close (int flags = M_DELETE_NONE);
+
// = ACE_Task manipulation routines
/// Get the writer task.
ACE_Task<ACE_SYNCH_USE> *writer (void);
+
/**
* Set the writer task. @a flags can be used to indicate that the
* module should delete the writer during a call to close or to the
@@ -108,8 +127,10 @@ public:
* be called from within <ACE_Task::module_closed>.
*/
void writer (ACE_Task<ACE_SYNCH_USE> *q, int flags = M_DELETE_WRITER);
+
/// Get the reader task.
ACE_Task<ACE_SYNCH_USE> *reader (void);
+
/**
* Set the reader task. @a flags can be used to indicate that the
* module should delete the reader during a call to close or to the
@@ -118,56 +139,78 @@ public:
* be called from within <ACE_Task::module_closed>.
*/
void reader (ACE_Task<ACE_SYNCH_USE> *q, int flags = M_DELETE_READER);
+
/// Set and get pointer to sibling ACE_Task in an ACE_Module
ACE_Task<ACE_SYNCH_USE> *sibling (ACE_Task<ACE_SYNCH_USE> *orig);
+
// = Identify the module
/// Get the module name.
const ACE_TCHAR *name (void) const;
+
/// Set the module name.
void name (const ACE_TCHAR *);
+
// = Argument to the Tasks.
/// Get the argument passed to the tasks.
void *arg (void) const;
+
/// Set the argument passed to the tasks.
void arg (void *);
+
/// Link to other modules in the ustream stack
void link (ACE_Module<ACE_SYNCH_USE> *m);
+
/// Get the next pointer to the module above in the stream.
ACE_Module<ACE_SYNCH_USE> *next (void);
+
/// Set the next pointer to the module above in the stream.
void next (ACE_Module<ACE_SYNCH_USE> *m);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Implements the close operation for either the reader or the
/// writer task (depending on <which>).
int close_i (int which, int flags);
+
/// Pair of Tasks that form the "read-side" and "write-side" of the
/// ACE_Module partitioning.
ACE_Task<ACE_SYNCH_USE> *q_pair_[2];
+
/// Name of the ACE_Module.
ACE_TCHAR name_[MAXPATHLEN + 1];
+
/// Next ACE_Module in the stack.
ACE_Module<ACE_SYNCH_USE> *next_;
+
/// Argument passed through to the reader and writer task when they
/// are opened.
void *arg_;
+
/// Holds flags which are used to determine if the reader and writer
/// task have to be deleted on exit
int flags_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Module.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Module.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Module.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_MODULE_H */
diff --git a/dep/ACE_wrappers/ace/Module.inl b/dep/ACE_wrappers/ace/Module.inl
index 31146f390af..62e4929a24b 100644
--- a/dep/ACE_wrappers/ace/Module.inl
+++ b/dep/ACE_wrappers/ace/Module.inl
@@ -1,54 +1,65 @@
// -*- C++ -*-
//
// $Id: Module.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_string.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template <ACE_SYNCH_DECL> ACE_INLINE void *
ACE_Module<ACE_SYNCH_USE>::arg (void) const
{
ACE_TRACE ("ACE_Module<ACE_SYNCH_USE>::arg");
return this->arg_;
}
+
template <ACE_SYNCH_DECL> ACE_INLINE void
ACE_Module<ACE_SYNCH_USE>::arg (void *a)
{
ACE_TRACE ("ACE_Module<ACE_SYNCH_USE>::arg");
this->arg_ = a;
}
+
template <ACE_SYNCH_DECL> ACE_INLINE const ACE_TCHAR *
ACE_Module<ACE_SYNCH_USE>::name (void) const
{
ACE_TRACE ("ACE_Module<ACE_SYNCH_USE>::name");
return this->name_;
}
+
template <ACE_SYNCH_DECL> ACE_INLINE void
ACE_Module<ACE_SYNCH_USE>::name (const ACE_TCHAR *n)
{
ACE_TRACE ("ACE_Module<ACE_SYNCH_USE>::name");
ACE_OS::strsncpy (this->name_, n, MAXPATHLEN);
}
+
template <ACE_SYNCH_DECL> ACE_INLINE ACE_Task<ACE_SYNCH_USE> *
ACE_Module<ACE_SYNCH_USE>::writer (void)
{
ACE_TRACE ("ACE_Module<ACE_SYNCH_USE>::writer");
return this->q_pair_[1];
}
+
template <ACE_SYNCH_DECL> ACE_INLINE ACE_Task<ACE_SYNCH_USE> *
ACE_Module<ACE_SYNCH_USE>::reader (void)
{
ACE_TRACE ("ACE_Module<ACE_SYNCH_USE>::reader");
return this->q_pair_[0];
}
+
template <ACE_SYNCH_DECL> ACE_INLINE ACE_Module<ACE_SYNCH_USE> *
ACE_Module<ACE_SYNCH_USE>::next (void)
{
ACE_TRACE ("ACE_Module<ACE_SYNCH_USE>::next");
return this->next_;
}
+
template <ACE_SYNCH_DECL> ACE_INLINE void
ACE_Module<ACE_SYNCH_USE>::next (ACE_Module<ACE_SYNCH_USE> *m)
{
ACE_TRACE ("ACE_Module<ACE_SYNCH_USE>::next");
this->next_ = m;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Monitor_Admin.cpp b/dep/ACE_wrappers/ace/Monitor_Admin.cpp
index 1a6f3931bb3..059ee78c180 100644
--- a/dep/ACE_wrappers/ace/Monitor_Admin.cpp
+++ b/dep/ACE_wrappers/ace/Monitor_Admin.cpp
@@ -1,9 +1,14 @@
// $Id: Monitor_Admin.cpp 81753 2008-05-21 19:02:47Z parsons $
+
#include "ace/Monitor_Admin.h"
+
#if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1)
+
#include "ace/Reactor.h"
#include "ace/Monitor_Point_Registry.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE
{
namespace Monitor_Control
@@ -19,11 +24,14 @@ namespace ACE
mp->update ();
return 0;
}
+
//====================================================================
+
Monitor_Admin::Monitor_Admin (void)
: reactor_ (ACE_Reactor::instance ()),
default_reactor_ (true)
{}
+
Monitor_Admin::~Monitor_Admin (void)
{
if (this->default_reactor_)
@@ -32,12 +40,14 @@ namespace ACE
/// before its destructor is called.
ACE_Reactor::instance ()->close_singleton ();
}
+
/// We access the registry through ACE_Singleton, which
/// doesn't call the destructor, so we call this method to
/// do a remove_ref() on all monitor points left in the registry.
/// which needs to be done before the registry goes away.
Monitor_Point_Registry::instance ()->cleanup ();
}
+
bool
Monitor_Admin::monitor_point (Monitor_Base* monitor_point,
const ACE_Time_Value& time)
@@ -45,6 +55,7 @@ namespace ACE
/// This call checks for a null monitor_point.
bool good_reg_add =
Monitor_Point_Registry::instance ()->add (monitor_point);
+
if (!good_reg_add)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -59,14 +70,17 @@ namespace ACE
ACE_Time_Value::zero,
time);
}
+
return good_reg_add;
}
+
Monitor_Base*
Monitor_Admin::monitor_point (const char* name)
{
ACE_CString name_str (name, 0, false);
return Monitor_Point_Registry::instance ()->get (name_str);
}
+
void
Monitor_Admin::auto_query (ACE_Event_Handler* handler,
Monitor_Query* query,
@@ -77,12 +91,14 @@ namespace ACE
ACE_Time_Value::zero,
time);
}
+
void
Monitor_Admin::reactor (ACE_Reactor* new_reactor)
{
this->reactor_ = new_reactor;
this->default_reactor_ = false;
}
+
ACE_Reactor*
Monitor_Admin::reactor (void) const
{
@@ -90,6 +106,9 @@ namespace ACE
}
}
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */
+
diff --git a/dep/ACE_wrappers/ace/Monitor_Admin.h b/dep/ACE_wrappers/ace/Monitor_Admin.h
index 19aaf3891f5..4120d8a1c5e 100644
--- a/dep/ACE_wrappers/ace/Monitor_Admin.h
+++ b/dep/ACE_wrappers/ace/Monitor_Admin.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Monitor_Admin.h
@@ -8,21 +9,30 @@
* @author Jeff Parsons <j.parsons@vanderbilt.edu>
*/
//=============================================================================
+
#ifndef MONITOR_ADMIN_H
#define MONITOR_ADMIN_H
+
#include /**/ "ace/pre.h"
+
#include "ace/Event_Handler.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
#pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1)
+
#include "ace/Monitor_Base.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE
{
namespace Monitor_Control
{
class Monitor_Query;
+
/**
* @class Monitor_Point_Auto_Updater
*
@@ -45,6 +55,7 @@ namespace ACE
virtual int handle_timeout (const ACE_Time_Value& interval,
const void* monitor_point);
};
+
/**
* @class Admin
*
@@ -58,24 +69,29 @@ namespace ACE
public:
Monitor_Admin (void);
~Monitor_Admin (void);
+
/// Add or access monitor points in a global registry
/// If the ACE_Time_Value arg is non-zero,
/// the monitor point, the auto updater member, and the given time
/// interval are passed to our reactor's register_timeout()
/// method.
+
bool monitor_point (Monitor_Base* monitor_point,
const ACE_Time_Value& time);
Monitor_Base* monitor_point (const char* name);
+
/// Works similarly to monitor_point() above, but registers the
/// handler arg's handle_timeout() method with the reactor,
/// instead of our auto_updater_'s handle_timeout().
void auto_query (ACE_Event_Handler* handler,
Monitor_Query* query,
const ACE_Time_Value& time);
+
/// This mutator allows the application to create its own reactor
/// and substitute it for the default reactor.
void reactor (ACE_Reactor* new_reactor);
ACE_Reactor* reactor (void) const;
+
private:
Monitor_Point_Auto_Updater auto_updater_;
ACE_Reactor* reactor_;
@@ -83,8 +99,12 @@ namespace ACE
};
}
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */
+
#include /**/ "ace/post.h"
+
#endif // MONITOR_ADMIN_H
diff --git a/dep/ACE_wrappers/ace/Monitor_Admin_Manager.cpp b/dep/ACE_wrappers/ace/Monitor_Admin_Manager.cpp
index 6a3299b6a18..61ebb226af4 100644
--- a/dep/ACE_wrappers/ace/Monitor_Admin_Manager.cpp
+++ b/dep/ACE_wrappers/ace/Monitor_Admin_Manager.cpp
@@ -1,8 +1,13 @@
// $Id: Monitor_Admin_Manager.cpp 81691 2008-05-14 11:09:21Z johnnyw $
+
#include "ace/Monitor_Admin_Manager.h"
+
#if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1)
+
#include "ace/Service_Config.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE
{
namespace Monitor_Control
@@ -12,6 +17,7 @@ namespace ACE
{
return this->admin_;
}
+
int
Monitor_Admin_Manager::Initializer (void)
{
@@ -20,7 +26,9 @@ namespace ACE
}
}
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
ACE_STATIC_SVC_DEFINE (MC_ADMINMANAGER,
ACE_TEXT ("MC_ADMINMANAGER"),
ACE_SVC_OBJ_T,
@@ -29,5 +37,7 @@ ACE_STATIC_SVC_DEFINE (MC_ADMINMANAGER,
| ACE_Service_Type::DELETE_OBJ,
0)
ACE_FACTORY_DEFINE (ACE, MC_ADMINMANAGER)
+
#endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */
+
diff --git a/dep/ACE_wrappers/ace/Monitor_Admin_Manager.h b/dep/ACE_wrappers/ace/Monitor_Admin_Manager.h
index a3ad87809a4..16ae520feb2 100644
--- a/dep/ACE_wrappers/ace/Monitor_Admin_Manager.h
+++ b/dep/ACE_wrappers/ace/Monitor_Admin_Manager.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Monitor_Admin_Manager.h
@@ -8,16 +9,24 @@
* @author Jeff Parsons <j.parsons@vanderbilt.edu>
*/
//=============================================================================
+
#ifndef MONITOR_ADMIN_MANAGER_H
#define MONITOR_ADMIN_MANAGER_H
+
#include /**/ "ace/pre.h"
+
#include "ace/Service_Object.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
#pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1)
+
#include "ace/Monitor_Admin.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE
{
namespace Monitor_Control
@@ -36,19 +45,27 @@ namespace ACE
public:
/// Access the admin instance.
ACE::Monitor_Control::Monitor_Admin& admin (void);
+
/// Used to force initialization of the MC service.
static int Initializer (void);
+
private:
Monitor_Admin admin_;
};
}
}
+
/// For the ACE_FACTORY_DEFINE macro in the .cpp file.
typedef ACE::Monitor_Control::Monitor_Admin_Manager MC_ADMINMANAGER;
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
ACE_STATIC_SVC_DECLARE (MC_ADMINMANAGER)
ACE_FACTORY_DECLARE (ACE, MC_ADMINMANAGER)
+
#endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */
+
#include /**/ "ace/post.h"
+
#endif // MONITOR_ADMIN_MANAGER_H
diff --git a/dep/ACE_wrappers/ace/Monitor_Base.cpp b/dep/ACE_wrappers/ace/Monitor_Base.cpp
index db07878bc41..dfcb1032b2f 100644
--- a/dep/ACE_wrappers/ace/Monitor_Base.cpp
+++ b/dep/ACE_wrappers/ace/Monitor_Base.cpp
@@ -1,16 +1,22 @@
// $Id: Monitor_Base.cpp 82328 2008-07-15 17:20:17Z parsons $
+
#include "ace/Monitor_Base.h"
+
#if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1)
+
#include "ace/Monitor_Admin_Manager.h"
#include "ace/Monitor_Control_Action.h"
#include "ace/Monitor_Point_Registry.h"
#include "ace/Guard_T.h"
#include "ace/Dynamic_Service.h"
#include "ace/OS_NS_sys_time.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Monitor_Base.inl"
#endif /* __ACE_INLINE__ */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE
{
namespace Monitor_Control
@@ -22,9 +28,11 @@ namespace ACE
, name_ (name)
{
}
+
Monitor_Base::~Monitor_Base (void)
{
ACE_GUARD (ACE_SYNCH_MUTEX, guard, this->mutex_);
+
if (this->data_.type_ == Monitor_Control_Types::MC_LIST)
{
for (size_t i = 0UL; i < this->data_.index_; ++i)
@@ -33,11 +41,13 @@ namespace ACE
}
}
}
+
void
Monitor_Base::update (void)
{
/// Overridden in derived classes.
}
+
void
Monitor_Base::receive (double data)
{
@@ -49,15 +59,18 @@ namespace ACE
this->name_.c_str ()));
return;
}
+
ACE_GUARD (ACE_SYNCH_MUTEX, guard, this->mutex_);
this->data_.timestamp_ = ACE_OS::gettimeofday ();
this->data_.value_ = data;
+
if (this->data_.type_ != Monitor_Control_Types::MC_COUNTER)
{
this->data_.sum_ += data;
this->data_.sum_of_squares_ += (data * data);
++this->data_.index_;
}
+
if (this->data_.type_ == Monitor_Control_Types::MC_COUNTER)
{
++this->data_.last_;
@@ -66,6 +79,7 @@ namespace ACE
else
{
this->data_.last_ = data;
+
if (!this->data_.minimum_set_)
{
this->data_.minimum_set_ = true;
@@ -75,17 +89,20 @@ namespace ACE
{
this->data_.minimum_ = data;
}
+
if (this->data_.maximum_ < data)
{
this->data_.maximum_ = data;
}
}
}
+
void
Monitor_Base::receive (size_t data)
{
this->receive (static_cast<double> (data));
}
+
void
Monitor_Base::receive (const Monitor_Control_Types::NameList& data)
{
@@ -97,78 +114,101 @@ namespace ACE
this->name_.c_str ()));
return;
}
+
ACE_GUARD (ACE_SYNCH_MUTEX, guard, this->mutex_);
+
for (size_t i = 0UL; i < this->data_.index_; ++i)
{
ACE::strdelete (this->data_.list_[i]);
}
+
this->data_.index_ = data.size ();
this->data_.list_.max_size (this->data_.index_);
+
for (size_t i = 0UL; i < this->data_.index_; ++i)
{
this->data_.list_[i] = ACE::strnew (data[i].c_str ());
}
}
+
long
Monitor_Base::add_constraint (const char* expression,
Control_Action* action)
{
/// Thread-safe and guaranteed to be unique.
long id = Monitor_Point_Registry::instance ()->constraint_id ();
+
CONSTRAINTS::value_type entry;
entry.first = id;
entry.second.expr = expression;
entry.second.control_action = action;
+
/// This is thread-safe on its own so we don't have
/// to guard it here.
action->add_ref ();
+
{
ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, guard, this->mutex_, -1);
+
/// Since we know external key is unique,
/// we don't check for failure.
(void) this->constraints_.insert (entry);
}
+
return id;
}
+
Control_Action*
Monitor_Base::remove_constraint (const long constraint_id)
{
Control_Action* retval = 0;
+
{
ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, guard, this->mutex_, 0);
+
CONSTRAINT_ITERATOR i = this->constraints_.find (constraint_id);
+
if (i != this->constraints_.end ())
{
retval = i->second.control_action;
(void) this->constraints_.erase (constraint_id);
}
}
+
return retval;
}
+
void
Monitor_Base::retrieve (Monitor_Control_Types::Data& data) const
{
ACE_GUARD (ACE_SYNCH_MUTEX, guard, this->mutex_);
+
data = this->data_;
}
+
void
Monitor_Base::clear (void)
{
ACE_GUARD (ACE_SYNCH_MUTEX, guard, this->mutex_);
+
this->clear_i ();
}
+
void
Monitor_Base::retrieve_and_clear (Monitor_Control_Types::Data& data)
{
ACE_GUARD (ACE_SYNCH_MUTEX, guard, this->mutex_);
+
data = this->data_;
this->clear_i ();
}
+
void
Monitor_Base::add_to_registry (const ACE_Time_Value& time)
{
MC_ADMINMANAGER *mgr =
ACE_Dynamic_Service<MC_ADMINMANAGER>::instance ("MC_ADMINMANAGER");
+
if (!mgr->admin ().monitor_point (this, time))
{
ACE_ERROR ((LM_ERROR,
@@ -176,6 +216,7 @@ namespace ACE
this->name ()));
}
}
+
void
Monitor_Base::remove_from_registry (void)
{
@@ -192,6 +233,7 @@ namespace ACE
// this->name ()));
}
}
+
double
Monitor_Base::average (void) const
{
@@ -204,11 +246,14 @@ namespace ACE
this->name_.c_str ()),
0);
}
+
ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, guard, this->mutex_, 0.0);
+
return (this->data_.index_== 0UL
? 0.0
: this->data_.sum_ / this->data_.index_);
}
+
double
Monitor_Base::sum_of_squares (void) const
{
@@ -222,9 +267,12 @@ namespace ACE
this->name_.c_str ()),
0);
}
+
ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, guard, this->mutex_, 0.0);
+
return this->data_.sum_of_squares_;
}
+
size_t
Monitor_Base::count (void) const
{
@@ -235,11 +283,14 @@ namespace ACE
this->name_.c_str ()),
0UL);
}
+
ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, guard, this->mutex_, 0UL);
+
return (this->data_.type_ == Monitor_Control_Types::MC_COUNTER
? static_cast<size_t> (this->data_.last_)
: this->data_.index_);
}
+
double
Monitor_Base::minimum_sample (void) const
{
@@ -252,9 +303,12 @@ namespace ACE
this->name_.c_str ()),
0);
}
+
ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, guard, this->mutex_, 0.0);
+
return this->data_.minimum_;
}
+
double
Monitor_Base::maximum_sample (void) const
{
@@ -267,9 +321,12 @@ namespace ACE
this->name_.c_str ()),
0);
}
+
ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, guard, this->mutex_, 0.0);
+
return this->data_.maximum_;
}
+
double
Monitor_Base::last_sample (void) const
{
@@ -282,28 +339,37 @@ namespace ACE
this->name_.c_str ()),
0);
}
+
ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, guard, this->mutex_, 0.0);
+
return this->data_.last_;
}
+
Monitor_Control_Types::NameList
Monitor_Base::get_list (void) const
{
Monitor_Control_Types::NameList retval;
+
if (this->data_.type_ != Monitor_Control_Types::MC_LIST)
{
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("get_list: %s is not a ")
ACE_TEXT ("list monitor type\n"),
this->name_.c_str ()));
+
return retval;
}
+
ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, guard, this->mutex_, retval);
+
for (size_t i = 0UL; i < this->data_.index_; ++i)
{
retval.push_back (this->data_.list_[i]);
}
+
return retval;
}
+
void
Monitor_Base::clear_i (void)
{
@@ -313,8 +379,10 @@ namespace ACE
{
ACE::strdelete (this->data_.list_[i]);
}
+
this->data_.list_.max_size (0UL);
}
+
this->data_.value_ = 0.0;
this->data_.timestamp_ = ACE_Time_Value::zero;
this->data_.index_ = 0UL;
@@ -327,6 +395,9 @@ namespace ACE
}
}
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */
+
diff --git a/dep/ACE_wrappers/ace/Monitor_Base.h b/dep/ACE_wrappers/ace/Monitor_Base.h
index aa026af9f8a..1ed230f0061 100644
--- a/dep/ACE_wrappers/ace/Monitor_Base.h
+++ b/dep/ACE_wrappers/ace/Monitor_Base.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Monitor_Base.h
@@ -8,25 +9,35 @@
* @author Jeff Parsons <j.parsons@vanderbilt.edu>
*/
//=============================================================================
+
#ifndef MONITOR_BASE_H
#define MONITOR_BASE_H
+
#include /**/ "ace/pre.h"
+
#include "ace/Monitor_Control_Types.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
#pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1)
+
#include "ace/Refcountable_T.h"
#include "ace/Thread_Mutex.h"
#include "ace/Synch_Traits.h"
#include "ace/CDR_Base.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ETCL_Constraint;
+
namespace ACE
{
namespace Monitor_Control
{
class Control_Action;
+
/**
* @class Monitor_Base
*
@@ -39,73 +50,104 @@ namespace ACE
public:
typedef Monitor_Control_Types::ConstraintList CONSTRAINTS;
typedef CONSTRAINTS::const_iterator CONSTRAINT_ITERATOR;
+
Monitor_Base (const char* name,
Monitor_Control_Types::Information_Type type);
virtual ~Monitor_Base (void);
+
/// Implemented by the most-derived class. Does the actual
/// work of fetching the monitored value.
virtual void update (void);
+
/// Updates the monitor's data if it is a numeric floating point.
virtual void receive (double data);
+
/// Updates the monitor's data if it is an integer size.
virtual void receive (size_t data);
+
/// Updates the monitor's data if it is a string type.
virtual void receive (const Monitor_Control_Types::NameList& data);
+
/// Add a constraint, returns a unique constraint id.
long add_constraint (const char* expression,
Control_Action* action = 0);
+
/// Remove a constraint and return the associated control action,
/// which may be shared, for deletion or further use.
Control_Action* remove_constraint (const long constraint_id);
+
/// Get all constraints
CONSTRAINTS& constraints (void);
+
/// Reset function.
virtual void clear (void);
+
/// Data accessors.
void retrieve (Monitor_Control_Types::Data& data) const;
void retrieve_and_clear (Monitor_Control_Types::Data& data);
+
/// Common to all monitors.
+
void add_to_registry (
const ACE_Time_Value& time = ACE_Time_Value::zero);
void remove_from_registry (void);
+
const char* name (void) const;
void name (const char* new_name);
+
void add_ref (void);
void remove_ref (void);
+
/// Calculate the average of the accumulated samples.
double average (void) const;
+
/// Calculate the sum of the squares of the samples.
double sum_of_squares (void) const;
+
/// Returns the number of samples
size_t count (void) const;
+
/// Returns the minimum sample value
double minimum_sample (void) const;
+
/// Returns the maximum sample value
double maximum_sample (void) const;
+
/// Returns the most recent sample value
double last_sample (void) const;
+
/// Return the type of this statistic
Monitor_Control_Types::Information_Type type (void) const;
+
/// Return the list or error msg if wrong type.
Monitor_Control_Types::NameList get_list (void) const;
+
protected:
/// Overridden in some monitors (for example the OS monitors) where
/// clearing requires monitor-specific actions.
virtual void clear_i (void);
+
protected:
Monitor_Control_Types::Data data_;
mutable ACE_SYNCH_MUTEX mutex_;
+
CONSTRAINTS constraints_;
+
private:
ACE_CString name_;
};
}
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Monitor_Base.inl"
#endif /* __ACE_INLINE__ */
+
#endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */
+
#include /**/ "ace/post.h"
+
#endif // MONITOR_BASE_H
diff --git a/dep/ACE_wrappers/ace/Monitor_Base.inl b/dep/ACE_wrappers/ace/Monitor_Base.inl
index 44cc1ea1f64..71603dbbee8 100644
--- a/dep/ACE_wrappers/ace/Monitor_Base.inl
+++ b/dep/ACE_wrappers/ace/Monitor_Base.inl
@@ -1,5 +1,7 @@
// $Id: Monitor_Base.inl 82328 2008-07-15 17:20:17Z parsons $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE
{
namespace Monitor_Control
@@ -10,34 +12,40 @@ namespace ACE
{
return this->name_.c_str ();
}
+
ACE_INLINE
void
Monitor_Base::name (const char* new_name)
{
this->name_ = new_name;
}
+
ACE_INLINE
Monitor_Base::CONSTRAINTS&
Monitor_Base::constraints (void)
{
return this->constraints_;
}
+
ACE_INLINE
void
Monitor_Base::add_ref (void)
{
(void) this->increment ();
}
+
ACE_INLINE
void
Monitor_Base::remove_ref (void)
{
long const new_count = this->decrement ();
+
if (new_count == 0)
{
delete this;
}
}
+
ACE_INLINE
Monitor_Control_Types::Information_Type
Monitor_Base::type (void) const
@@ -46,5 +54,6 @@ namespace ACE
}
}
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Monitor_Control_Action.cpp b/dep/ACE_wrappers/ace/Monitor_Control_Action.cpp
index ce3a26b95c1..4a4757a5111 100644
--- a/dep/ACE_wrappers/ace/Monitor_Control_Action.cpp
+++ b/dep/ACE_wrappers/ace/Monitor_Control_Action.cpp
@@ -1,8 +1,13 @@
// $Id: Monitor_Control_Action.cpp 81691 2008-05-14 11:09:21Z johnnyw $
+
#include "ace/Monitor_Control_Action.h"
+
#if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1)
+
#include "ace/Guard_T.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE
{
namespace Monitor_Control
@@ -10,17 +15,21 @@ namespace ACE
Control_Action::Control_Action (void)
: ACE_Refcountable_T<ACE_SYNCH_MUTEX> (1)
{}
+
Control_Action::~Control_Action (void)
{}
+
void
Control_Action::add_ref (void)
{
(void) this->increment ();
}
+
void
Control_Action::remove_ref (void)
{
const long new_count = this->decrement ();
+
if (new_count == 0)
{
delete this;
@@ -28,7 +37,10 @@ namespace ACE
}
}
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */
+
diff --git a/dep/ACE_wrappers/ace/Monitor_Control_Action.h b/dep/ACE_wrappers/ace/Monitor_Control_Action.h
index c5a3ff24f07..ba51b56d382 100644
--- a/dep/ACE_wrappers/ace/Monitor_Control_Action.h
+++ b/dep/ACE_wrappers/ace/Monitor_Control_Action.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Monitor_Control_Action.h
@@ -8,15 +9,22 @@
* @author Jeff Parsons <j.parsons@vanderbilt.edu>
*/
//=============================================================================
+
#ifndef MONITOR_CONTROL_ACTION_H
#define MONITOR_CONTROL_ACTION_H
+
#include /**/ "ace/pre.h"
+
#include "ace/Refcountable_T.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
#pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1)
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE
{
namespace Monitor_Control
@@ -36,17 +44,23 @@ namespace ACE
public:
/// To be implemented by the concrete derived class.
virtual void execute (const char* command = 0) = 0;
+
/// Refcounting methods.
void add_ref (void);
void remove_ref (void);
+
protected:
Control_Action (void);
virtual ~Control_Action (void);
};
}
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */
+
#include /**/ "ace/post.h"
+
#endif // MONITOR_CONTROL_ACTION_H
diff --git a/dep/ACE_wrappers/ace/Monitor_Control_Types.cpp b/dep/ACE_wrappers/ace/Monitor_Control_Types.cpp
index 6fd873d025b..e9934a96f74 100644
--- a/dep/ACE_wrappers/ace/Monitor_Control_Types.cpp
+++ b/dep/ACE_wrappers/ace/Monitor_Control_Types.cpp
@@ -1,8 +1,13 @@
// $Id: Monitor_Control_Types.cpp 82328 2008-07-15 17:20:17Z parsons $
+
#include "ace/Monitor_Control_Types.h"
+
#if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1)
+
#include "ace/Monitor_Control_Action.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE
{
namespace Monitor_Control
@@ -20,10 +25,13 @@ namespace ACE
, sum_of_squares_ (0.0)
, last_ (0.0)
{}
+
//=============================================================
+
Monitor_Control_Types::Constraint::Constraint (void)
: control_action (0)
{}
+
Monitor_Control_Types::Constraint::Constraint (const Constraint& rhs)
: expr (rhs.expr),
control_action (rhs.control_action)
@@ -33,6 +41,7 @@ namespace ACE
control_action->add_ref ();
}
}
+
Monitor_Control_Types::Constraint::~Constraint (void)
{
if (this->control_action != 0)
@@ -40,6 +49,7 @@ namespace ACE
this->control_action->remove_ref ();
}
}
+
Monitor_Control_Types::Constraint&
Monitor_Control_Types::Constraint::operator= (const Constraint& rhs)
{
@@ -47,17 +57,23 @@ namespace ACE
{
this->control_action->remove_ref ();
}
+
this->expr = rhs.expr;
this->control_action = rhs.control_action;
+
if (this->control_action != 0)
{
this->control_action->add_ref ();
}
+
return *this;
}
}
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */
+
diff --git a/dep/ACE_wrappers/ace/Monitor_Control_Types.h b/dep/ACE_wrappers/ace/Monitor_Control_Types.h
index 48802be9ab1..db0a12ce046 100644
--- a/dep/ACE_wrappers/ace/Monitor_Control_Types.h
+++ b/dep/ACE_wrappers/ace/Monitor_Control_Types.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Monitor_Control_Types.h
@@ -8,23 +9,32 @@
* @author Jeff Parsons <j.parsons@vanderbilt.edu>
*/
//=============================================================================
+
#ifndef MONITOR_CONTROL_TYPES_H
#define MONITOR_CONTROL_TYPES_H
+
#include /**/ "ace/pre.h"
+
#include "ace/Vector_T.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
#pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1)
+
#include "ace/Array_Map.h"
#include "ace/SString.h"
#include "ace/Time_Value.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE
{
namespace Monitor_Control
{
class Control_Action;
+
struct ACE_Export Monitor_Control_Types
{
/// A monitor can hold various types of data and maintains stats
@@ -38,6 +48,7 @@ namespace ACE
MC_LIST,
MC_GROUP
};
+
/**
* @brief An instance is contained by each enabled monitor point.
*/
@@ -47,7 +58,9 @@ namespace ACE
ACE_Time_Value timestamp_;
double value_;
ACE_Array_Base<char *> list_;
+
Information_Type type_;
+
size_t index_;
bool minimum_set_;
double minimum_;
@@ -56,6 +69,7 @@ namespace ACE
double sum_of_squares_;
double last_;
};
+
/**
* @brief Bundles the constrain string with its associated
* trigger action.
@@ -64,13 +78,16 @@ namespace ACE
{
Constraint (void);
~Constraint (void);
+
/// Implemented explicitly so reference counting of control
/// actions can be managed.
Constraint (const Constraint& rhs);
Constraint& operator= (const Constraint& rhs);
+
ACE_CString expr;
Control_Action* control_action;
};
+
#if defined (__BORLANDC__) && (__BORLANDC__ <= 0x570)
// Borland C++ Builder 6 and earlier don't handle the second template
// argument correctly. We have to pass it explicitly
@@ -83,10 +100,12 @@ namespace ACE
* a group of monitor points.
*/
typedef ACE_Vector<Data> DataList;
+
/**
* @brief Used in various places to pass around a set of string names.
*/
typedef ACE_Vector<ACE_CString> NameList;
+
/**
* @brief Holder for a monitor point's constraints.
*/
@@ -95,8 +114,12 @@ namespace ACE
};
}
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */
+
#include /**/ "ace/post.h"
+
#endif // MONITOR_CONTROL_TYPES_H
diff --git a/dep/ACE_wrappers/ace/Monitor_Point_Registry.cpp b/dep/ACE_wrappers/ace/Monitor_Point_Registry.cpp
index 04d23406365..0a66ac4c986 100644
--- a/dep/ACE_wrappers/ace/Monitor_Point_Registry.cpp
+++ b/dep/ACE_wrappers/ace/Monitor_Point_Registry.cpp
@@ -1,8 +1,13 @@
// $Id: Monitor_Point_Registry.cpp 81833 2008-06-04 14:44:53Z parsons $
+
#include "ace/Monitor_Point_Registry.h"
+
#if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1)
+
#include "ace/Monitor_Base.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE
{
namespace Monitor_Control
@@ -13,10 +18,12 @@ namespace ACE
return
ACE_Singleton<Monitor_Point_Registry, ACE_SYNCH_MUTEX>::instance ();
}
+
Monitor_Point_Registry::Monitor_Point_Registry (void)
: constraint_id_ (0)
{
}
+
bool
Monitor_Point_Registry::add (Monitor_Base* type)
{
@@ -26,22 +33,30 @@ namespace ACE
"registry add: null type\n"),
false);
}
+
int status = 0;
+
{
ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, guard, this->mutex_, false);
+
type->add_ref ();
+
status = this->map_.bind (type->name (), type);
+
/// Temporary debugging code.
// ACE_DEBUG ((LM_DEBUG, "adding %s\n", type->name ()));
}
+
if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"registry add: map bind failed\n"),
false);
}
+
return (status == 0);
}
+
bool
Monitor_Point_Registry::remove (const char* name)
{
@@ -51,15 +66,20 @@ namespace ACE
"registry remove: null name\n"),
false);
}
+
int status = 0;
Map::data_type mp = 0;
+
{
ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, guard, this->mutex_, false);
+
ACE_CString name_str (name, 0, false);
status = this->map_.unbind (name_str, mp);
+
/// Temporary debugging code.
// ACE_DEBUG ((LM_DEBUG, "removing %s\n", name_str.c_str ()));
}
+
if (status == -1)
{
// (JP) There is a problem with this failing on a single ACE_Message_Queue
@@ -77,45 +97,60 @@ namespace ACE
{
mp->remove_ref ();
}
+
return (status == 0);
}
+
Monitor_Control_Types::NameList
Monitor_Point_Registry::names (void)
{
Monitor_Control_Types::NameList name_holder_;
+
{
ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, guard, this->mutex_, 0);
+
for (Map::CONST_ITERATOR i (this->map_); !i.done (); i.advance ())
{
name_holder_.push_back (i->key ());
}
}
+
return name_holder_;
}
+
Monitor_Base*
Monitor_Point_Registry::get (const ACE_CString& name) const
{
Map::data_type mp = 0;
+
{
ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, guard, this->mutex_, 0);
+
this->map_.find (name, mp);
}
+
if (mp != 0)
{
mp->add_ref ();
}
+
return mp;
}
+
long
Monitor_Point_Registry::constraint_id (void)
{
long retval = 0;
+
{
ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, guard, this->mutex_, -1);
+
retval = this->constraint_id_++;
}
+
return retval;
}
+
void
Monitor_Point_Registry::cleanup (void)
{
@@ -130,6 +165,9 @@ namespace ACE
}
}
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */
+
diff --git a/dep/ACE_wrappers/ace/Monitor_Point_Registry.h b/dep/ACE_wrappers/ace/Monitor_Point_Registry.h
index c1a9d258ed3..2c08d695ec1 100644
--- a/dep/ACE_wrappers/ace/Monitor_Point_Registry.h
+++ b/dep/ACE_wrappers/ace/Monitor_Point_Registry.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Monitor_Point_Registry.h
@@ -8,25 +9,34 @@
* @author Jeff Parsons <j.parsons@vanderbilt.edu>
*/
//=============================================================================
+
#ifndef MONITOR_POINT_REGISTRY_H
#define MONITOR_POINT_REGISTRY_H
+
#include /**/ "ace/pre.h"
+
#include "ace/Thread_Mutex.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
#pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1)
+
#include "ace/Synch_Traits.h"
#include "ace/Null_Mutex.h"
#include "ace/Hash_Map_Manager_T.h"
#include "ace/Monitor_Control_Types.h"
#include "ace/Singleton.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE
{
namespace Monitor_Control
{
class Monitor_Base;
+
/**
* @class Monitor_Point_Registry
*
@@ -37,40 +47,55 @@ namespace ACE
{
public:
friend class ACE_Singleton<Monitor_Point_Registry, ACE_SYNCH_MUTEX>;
+
/// Used to help ensure that there is only a single instance
/// per process of Monitor_Point_Registry.
static Monitor_Point_Registry* instance (void);
+
/// Adds a monitor to the registry.
bool add (Monitor_Base* type);
+
/// Remove a monitor from the registry.
bool remove (const char* name);
+
/// Returns a list of names stored in the registry
Monitor_Control_Types::NameList names (void);
+
/// Increments the refcount, so the caller is responsible for
/// decrementing it when finished.
Monitor_Base* get (const ACE_CString& name) const;
+
/// Returns a unique id for a constraint when it is created.
long constraint_id (void);
+
/// Decrements the reference count on all remaining entries,
/// called right before we go out of scope (i.e., process exits).
void cleanup (void);
+
private:
/// Prevent that users can make an instance.
Monitor_Point_Registry (void);
+
/// Underlying container for the registry.
typedef ACE_Hash_Map_Manager<ACE_CString,
Monitor_Base*,
ACE_SYNCH_NULL_MUTEX> Map;
+
mutable ACE_SYNCH_MUTEX mutex_;
Map map_;
+
/// Since we're accessed as a singleton, we can keep track of
/// dispensing unique ids for constraints.
long constraint_id_;
};
}
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */
+
#include /**/ "ace/post.h"
+
#endif // MONITOR_POINT_REGISTRY_H
diff --git a/dep/ACE_wrappers/ace/Monitor_Size.cpp b/dep/ACE_wrappers/ace/Monitor_Size.cpp
index a8c3ca15e76..d7dbaadf853 100644
--- a/dep/ACE_wrappers/ace/Monitor_Size.cpp
+++ b/dep/ACE_wrappers/ace/Monitor_Size.cpp
@@ -1,8 +1,13 @@
// $Id: Monitor_Size.cpp 82328 2008-07-15 17:20:17Z parsons $
+
#include "ace/Monitor_Size.h"
+
#if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1)
+
#include "ace/Guard_T.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE
{
namespace Monitor_Control
@@ -11,19 +16,23 @@ namespace ACE
: Monitor_Base ("", Monitor_Control_Types::MC_NUMBER)
{
}
+
Size_Monitor::Size_Monitor (const char* name)
: Monitor_Base (name, Monitor_Control_Types::MC_NUMBER)
{
}
+
Size_Monitor::~Size_Monitor (void)
{
}
+
void
Size_Monitor::update (void)
{
// No platform-specific or periodic code is needed, receive() can be
// called directly whenever the size changes.
}
+
void
Size_Monitor::clear (void)
{
@@ -31,6 +40,9 @@ namespace ACE
}
}
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */
+
diff --git a/dep/ACE_wrappers/ace/Monitor_Size.h b/dep/ACE_wrappers/ace/Monitor_Size.h
index 66e61c9e1be..bca6815af73 100644
--- a/dep/ACE_wrappers/ace/Monitor_Size.h
+++ b/dep/ACE_wrappers/ace/Monitor_Size.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Monitor_Size.h
@@ -8,16 +9,24 @@
* @author Jeff Parsons <j.parsons@vanderbilt.edu>
*/
//=============================================================================
+
#ifndef SIZE_MONITOR_H
#define SIZE_MONITOR_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
#pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Monitor_Base.h"
+
#if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1)
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE
{
namespace Monitor_Control
@@ -35,16 +44,22 @@ namespace ACE
Size_Monitor (void);
Size_Monitor (const char* name);
virtual ~Size_Monitor (void);
+
/// Implemented by the most-derived class. Does the actual
/// work of fetching the monitored value.
virtual void update (void);
+
/// Reset function.
virtual void clear (void);
};
}
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */
+
#include /**/ "ace/post.h"
+
#endif // SIZE_MONITOR_H
diff --git a/dep/ACE_wrappers/ace/Msg_WFMO_Reactor.cpp b/dep/ACE_wrappers/ace/Msg_WFMO_Reactor.cpp
index 0be801393f7..2b834daa823 100644
--- a/dep/ACE_wrappers/ace/Msg_WFMO_Reactor.cpp
+++ b/dep/ACE_wrappers/ace/Msg_WFMO_Reactor.cpp
@@ -1,16 +1,23 @@
// $Id: Msg_WFMO_Reactor.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Msg_WFMO_Reactor.h"
+
ACE_RCSID(ace, Msg_WFMO_Reactor, "$Id: Msg_WFMO_Reactor.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if defined (ACE_WIN32) && !defined (ACE_LACKS_MSG_WFMO)
+
#if !defined (__ACE_INLINE__)
#include "ace/Msg_WFMO_Reactor.inl"
#endif /* __ACE_INLINE__ */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_Msg_WFMO_Reactor::ACE_Msg_WFMO_Reactor (ACE_Sig_Handler *sh,
ACE_Timer_Queue *tq)
: ACE_WFMO_Reactor (sh, tq)
{
}
+
ACE_Msg_WFMO_Reactor::ACE_Msg_WFMO_Reactor (size_t size,
int unused,
ACE_Sig_Handler *sh,
@@ -18,9 +25,11 @@ ACE_Msg_WFMO_Reactor::ACE_Msg_WFMO_Reactor (size_t size,
: ACE_WFMO_Reactor (size, unused, sh, tq)
{
}
+
ACE_Msg_WFMO_Reactor::~ACE_Msg_WFMO_Reactor (void)
{
}
+
DWORD
ACE_Msg_WFMO_Reactor::wait_for_multiple_events (int timeout,
int alertable)
@@ -36,11 +45,13 @@ ACE_Msg_WFMO_Reactor::wait_for_multiple_events (int timeout,
QS_ALLINPUT,
alertable);
}
+
int
ACE_Msg_WFMO_Reactor::dispatch_window_messages (void)
{
int number_of_messages = 0;
MSG msg;
+
// Process all pending message from this thread's message queue
while (::PeekMessage (&msg, 0, 0, 0, PM_REMOVE))
{
@@ -51,11 +62,14 @@ ACE_Msg_WFMO_Reactor::dispatch_window_messages (void)
::PostQuitMessage (LOWORD (msg.wParam));
return -1;
}
+
::DispatchMessage (&msg);
++number_of_messages;
}
+
return number_of_messages;
}
+
DWORD
ACE_Msg_WFMO_Reactor::poll_remaining_handles (DWORD slot)
{
@@ -65,6 +79,8 @@ ACE_Msg_WFMO_Reactor::poll_remaining_handles (DWORD slot)
0,
QS_ALLINPUT);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_WIN32 && !ACE_LACKS_MSG_WFMO */
diff --git a/dep/ACE_wrappers/ace/Msg_WFMO_Reactor.h b/dep/ACE_wrappers/ace/Msg_WFMO_Reactor.h
index 772f68db4f4..714f4ce7a26 100644
--- a/dep/ACE_wrappers/ace/Msg_WFMO_Reactor.h
+++ b/dep/ACE_wrappers/ace/Msg_WFMO_Reactor.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Msg_WFMO_Reactor.h
@@ -10,16 +11,23 @@
*/
//=============================================================================
+
#ifndef ACE_MSG_WFMO_REACTOR_H
#define ACE_MSG_WFMO_REACTOR_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_WIN32) && !defined (ACE_LACKS_MSG_WFMO)
+
#include "ace/WFMO_Reactor.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Msg_WFMO_Reactor
*
@@ -38,6 +46,7 @@ public:
/// Initialize <ACE_Msg_WFMO_Reactor> with the default size.
ACE_Msg_WFMO_Reactor (ACE_Sig_Handler * = 0,
ACE_Timer_Queue * = 0);
+
/**
* Initialize <ACE_Msg_WFMO_Reactor> with size @a size. Two slots will be
* added to the @a size parameter which will store handles used for
@@ -47,8 +56,10 @@ public:
int unused = 0,
ACE_Sig_Handler * = 0,
ACE_Timer_Queue * = 0);
+
/// Close down the ACE_Msg_WFMO_Reactor and release all of its resources.
virtual ~ACE_Msg_WFMO_Reactor (void);
+
/**
* This event loop driver blocks for up to @a max_wait_time before
* returning. It will return earlier if timer events, I/O events,
@@ -76,6 +87,7 @@ public:
*/
virtual int handle_events (ACE_Time_Value *max_wait_time = 0);
virtual int alertable_handle_events (ACE_Time_Value *max_wait_time = 0);
+
/**
* This method is just like the one above, except the
* @a max_wait_time value is a reference and can therefore never be
@@ -83,20 +95,27 @@ public:
*/
virtual int handle_events (ACE_Time_Value &max_wait_time);
virtual int alertable_handle_events (ACE_Time_Value &max_wait_time);
+
protected:
/// Wait for timer and I/O events to occur.
virtual DWORD wait_for_multiple_events (int timeout,
int alertable);
+
/// Check for activity on remaining handles.
virtual DWORD poll_remaining_handles (DWORD index);
+
/// Dispatches window messages.
virtual int dispatch_window_messages (void);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Msg_WFMO_Reactor.inl"
#endif /* __ACE_INLINE__ */
+
#endif /* ACE_WIN32 && !ACE_LACKS_MSG_WFMO */
+
#include /**/ "ace/post.h"
#endif /* ACE_MSG_WFMO_REACTOR_H */
diff --git a/dep/ACE_wrappers/ace/Msg_WFMO_Reactor.inl b/dep/ACE_wrappers/ace/Msg_WFMO_Reactor.inl
index dddcf781800..f28bb4321a6 100644
--- a/dep/ACE_wrappers/ace/Msg_WFMO_Reactor.inl
+++ b/dep/ACE_wrappers/ace/Msg_WFMO_Reactor.inl
@@ -1,27 +1,35 @@
// -*- C++ -*-
//
// $Id: Msg_WFMO_Reactor.inl 80826 2008-03-04 14:51:23Z wotte $
+
#if defined (ACE_WIN32) && !defined (ACE_LACKS_MSG_WFMO)
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE int
ACE_Msg_WFMO_Reactor::handle_events (ACE_Time_Value &how_long)
{
return this->event_handling (&how_long, 0);
}
+
ACE_INLINE int
ACE_Msg_WFMO_Reactor::alertable_handle_events (ACE_Time_Value &how_long)
{
return this->event_handling (&how_long, MWMO_ALERTABLE);
}
+
ACE_INLINE int
ACE_Msg_WFMO_Reactor::handle_events (ACE_Time_Value *how_long)
{
return this->event_handling (how_long, 0);
}
+
ACE_INLINE int
ACE_Msg_WFMO_Reactor::alertable_handle_events (ACE_Time_Value *how_long)
{
return this->event_handling (how_long, MWMO_ALERTABLE);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_WIN32 && !ACE_LACKS_MSG_WFMO */
diff --git a/dep/ACE_wrappers/ace/Multihomed_INET_Addr.cpp b/dep/ACE_wrappers/ace/Multihomed_INET_Addr.cpp
index 59d00bedbc4..f5c50a6c278 100644
--- a/dep/ACE_wrappers/ace/Multihomed_INET_Addr.cpp
+++ b/dep/ACE_wrappers/ace/Multihomed_INET_Addr.cpp
@@ -1,38 +1,51 @@
// $Id: Multihomed_INET_Addr.cpp 80826 2008-03-04 14:51:23Z wotte $
+
// Extends ACE_INET_Addr with support for multi-homed addresses.
+
#include "ace/Multihomed_INET_Addr.h"
#include "ace/Log_Msg.h"
+
#if !defined (__ACE_INLINE__)
# include "ace/Multihomed_INET_Addr.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID (ace,
Multihomed_INET_Addr,
"$Id: Multihomed_INET_Addr.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_Multihomed_INET_Addr)
+
// Default constructor
+
ACE_Multihomed_INET_Addr::ACE_Multihomed_INET_Addr (void)
: secondaries_ (0)
{
ACE_TRACE ("ACE_Multihomed_INET_Addr::ACE_Multihomed_INET_Addr");
}
+
ACE_Multihomed_INET_Addr::ACE_Multihomed_INET_Addr (const char address[])
: ACE_INET_Addr (address),
secondaries_ (0)
{
}
+
ACE_Multihomed_INET_Addr::ACE_Multihomed_INET_Addr(u_short port_number,
const char host_name[],
int encode,
int address_family,
const char *(secondary_host_names[]),
size_t size){
+
// Initialize the primary INET addr
ACE_INET_Addr::set(port_number, host_name, encode, address_family);
+
// check for secondary INET addrs
if (secondary_host_names && size){
// we have a non-zero pointer and size
this->secondaries_.size(size); // size the array
+
size_t next_empty_slot = 0;
for (size_t i = 0; i < size; ++i) {
int ret = this->secondaries_[next_empty_slot].set(port_number,
@@ -49,8 +62,10 @@ ACE_Multihomed_INET_Addr::ACE_Multihomed_INET_Addr(u_short port_number,
++next_empty_slot;
}
}
+
return;
}
+
#if defined (ACE_HAS_WCHAR)
ACE_Multihomed_INET_Addr::ACE_Multihomed_INET_Addr(u_short port_number,
const wchar_t host_name[],
@@ -58,12 +73,15 @@ ACE_Multihomed_INET_Addr::ACE_Multihomed_INET_Addr(u_short port_number,
int address_family,
const wchar_t *(secondary_host_names[]),
size_t size){
+
// Initialize the primary INET addr
ACE_INET_Addr::set(port_number, host_name, encode, address_family);
+
// check for secondary INET addrs
if (secondary_host_names && size){
// we have a non-zero pointer and size
this->secondaries_.size(size); // size the array
+
size_t next_empty_slot = 0;
for (size_t i = 0; i < size; ++i) {
int ret = this->secondaries_[next_empty_slot].set(port_number,
@@ -80,25 +98,31 @@ ACE_Multihomed_INET_Addr::ACE_Multihomed_INET_Addr(u_short port_number,
++next_empty_slot;
}
}
+
return;
}
#endif /* ACE_HAS_WCHAR */
+
ACE_Multihomed_INET_Addr::ACE_Multihomed_INET_Addr(u_short port_number,
ACE_UINT32 primary_ip_addr,
int encode,
const ACE_UINT32 *secondary_ip_addrs,
size_t size){
+
// Initialize the primary INET addr
ACE_INET_Addr::set(port_number, primary_ip_addr, encode);
+
// check for secondary INET addrs
if (secondary_ip_addrs && size){
// we have a non-zero pointer and size
this->secondaries_.size(size); // size the array
+
size_t next_empty_slot = 0;
for (size_t i = 0; i < size; ++i) {
int const ret = this->secondaries_[next_empty_slot].set(port_number,
secondary_ip_addrs[i],
encode);
+
if (ret) {
ACE_DEBUG ((LM_DEBUG,
"Invalid INET addr (%u:%u) will be ignored\n",
@@ -109,8 +133,10 @@ ACE_Multihomed_INET_Addr::ACE_Multihomed_INET_Addr(u_short port_number,
++next_empty_slot;
}
}
+
return;
}
+
// Set implementations (NEED BETTER COMMENT HERE)
int
ACE_Multihomed_INET_Addr::set (u_short port_number,
@@ -121,7 +147,9 @@ ACE_Multihomed_INET_Addr::set (u_short port_number,
size_t size)
{
this->secondaries_.size(size);
+
for (size_t i = 0; i < size; ++i) {
+
int const ret = this->secondaries_[i].set(port_number,
secondary_host_names[i],
encode,
@@ -130,8 +158,10 @@ ACE_Multihomed_INET_Addr::set (u_short port_number,
return ret;
}
}
+
return ACE_INET_Addr::set(port_number, host_name, encode, address_family);
}
+
#if defined (ACE_HAS_WCHAR)
//
// WCHAR version of ::set
@@ -145,7 +175,9 @@ ACE_Multihomed_INET_Addr::set (u_short port_number,
size_t size)
{
this->secondaries_.size(size);
+
for (size_t i = 0; i < size; ++i) {
+
int ret = this->secondaries_[i].set(port_number,
secondary_host_names[i],
encode,
@@ -154,9 +186,11 @@ ACE_Multihomed_INET_Addr::set (u_short port_number,
return ret;
}
}
+
return ACE_INET_Addr::set(port_number, host_name, encode, address_family);
}
#endif /* ACE_HAS_WCHAR */
+
int
ACE_Multihomed_INET_Addr::set (u_short port_number,
ACE_UINT32 primary_ip_addr,
@@ -165,24 +199,31 @@ ACE_Multihomed_INET_Addr::set (u_short port_number,
size_t size)
{
this->secondaries_.size(size);
+
for (size_t i = 0; i < size; ++i) {
+
int ret = this->secondaries_[i].set(port_number,
secondary_ip_addrs[i],
encode);
+
if (ret) {
return ret;
}
}
+
return ACE_INET_Addr::set(port_number, primary_ip_addr, encode);
}
+
void
ACE_Multihomed_INET_Addr::set_port_number (u_short port_number, int encode)
{
size_t i = 0;
while (i < secondaries_.size())
secondaries_[i++].set_port_number(port_number, encode);
+
this->ACE_INET_Addr::set_port_number(port_number, encode);
}
+
int
ACE_Multihomed_INET_Addr::get_secondary_addresses(ACE_INET_Addr *secondary_addrs,
size_t size) const
@@ -190,15 +231,20 @@ ACE_Multihomed_INET_Addr::get_secondary_addresses(ACE_INET_Addr *secondary_addrs
size_t top =
size < this->secondaries_.size() ?
size : this->secondaries_.size();
+
for (size_t i = 0; i < top; ++i)
{
+
int ret =
secondary_addrs[i].set (this->secondaries_[i]);
+
if (ret)
return ret;
}
+
return 0;
}
+
void
ACE_Multihomed_INET_Addr::get_addresses(sockaddr_in *addrs,
size_t size) const
@@ -207,15 +253,19 @@ ACE_Multihomed_INET_Addr::get_addresses(sockaddr_in *addrs,
if (size > 0) {
addrs[0] = *reinterpret_cast<sockaddr_in*> (this->get_addr ());
}
+
// Copy secondary addresses to remaining slots of the user-supplied
// array. Secondary address [i] is copied to slot [i+1]
+
size_t top = size - 1 < this->secondaries_.size() ?
size - 1 : this->secondaries_.size();
+
for (size_t i = 0; i < top; ++i) {
addrs[i+1] =
*reinterpret_cast<sockaddr_in*> (this->secondaries_[i].get_addr());
}
}
+
#if defined (ACE_HAS_IPV6)
void
ACE_Multihomed_INET_Addr::get_addresses(sockaddr_in6 *addrs,
@@ -226,11 +276,13 @@ ACE_Multihomed_INET_Addr::get_addresses(sockaddr_in6 *addrs,
{
addrs[0] = *reinterpret_cast<sockaddr_in6*> (this->get_addr ());
}
+
// Copy secondary addresses to remaining slots of the user-supplied
// array. Secondary address [i] is copied to slot [i+1]
size_t top =
size - 1 < this->secondaries_.size() ?
size - 1 : this->secondaries_.size();
+
for (size_t i = 0; i < top; ++i)
{
addrs[i+1] =
@@ -239,8 +291,11 @@ ACE_Multihomed_INET_Addr::get_addresses(sockaddr_in6 *addrs,
}
#endif /* ACE_HAS_IPV6 */
+
ACE_Multihomed_INET_Addr::~ACE_Multihomed_INET_Addr (void)
{
+
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Multihomed_INET_Addr.h b/dep/ACE_wrappers/ace/Multihomed_INET_Addr.h
index f7077613ab5..88a3fbe3424 100644
--- a/dep/ACE_wrappers/ace/Multihomed_INET_Addr.h
+++ b/dep/ACE_wrappers/ace/Multihomed_INET_Addr.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Multihomed_INET_Addr.h
@@ -8,16 +9,23 @@
* @author Edward R. Mulholland <emulholl@atl.lmco.com>
*/
//=============================================================================
+
#ifndef ACE_MULTIHOMED_INET_ADDR_H
#define ACE_MULTIHOMED_INET_ADDR_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/INET_Addr.h"
#include "ace/Containers_T.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Multihomed_INET_Addr
*
@@ -28,8 +36,10 @@ class ACE_Export ACE_Multihomed_INET_Addr : public ACE_INET_Addr
{
public:
// = Initialization methods.
+
/// Default constructor.
ACE_Multihomed_INET_Addr (void);
+
/**
* Initializes an ACE_Multihomed_INET_Addr from the @a address,
* which can be "ip-number:port-number" (e.g., "tango.cs.wustl.edu:1234"
@@ -38,6 +48,7 @@ public:
* INADDR_ANY.
*/
explicit ACE_Multihomed_INET_Addr (const char address[]);
+
/**
* Constructs an ACE_Multihomed_INET_Addr from a @a port_number, a
* @a primary_host_name, and an array of <secondary_host_names>.
@@ -55,6 +66,7 @@ public:
int address_family = AF_UNSPEC,
const char *(secondary_host_names[]) = 0,
size_t size = 0);
+
/**
* Constructs an ACE_Multihomed_INET_Addr from a @a port_number,
* a @a primary_ip_addr, and an array of @a secondary_ip_addrs. @a
@@ -68,6 +80,7 @@ public:
int encode = 1,
const ACE_UINT32 *secondary_ip_addrs = 0,
size_t size = 0);
+
#if defined (ACE_HAS_WCHAR)
/**
* WCHAR versions of the methods that take char's as arguments.
@@ -84,13 +97,20 @@ public:
int address_family = AF_UNSPEC,
const wchar_t *(secondary_host_names[]) = 0,
size_t size = 0);
+
#endif /* ACE_HAS_WCHAR */
+
/// Use compiler-generated copy constructor.
+
/// Use compiler-generated assignment operator.
+
/// Default dtor.
~ACE_Multihomed_INET_Addr (void);
+
// = Direct initialization methods.
+
// These methods are useful after the object has been constructed.
+
/**
* Initializes an ACE_Multihomed_INET_Addr from a @a port_number, a
* @a primary_host_name, and an array of <secondary_host_names>.
@@ -108,6 +128,7 @@ public:
int address_family = AF_UNSPEC,
const char *(secondary_host_names[]) = 0,
size_t size = 0);
+
/**
* Initializes an ACE_Multihomed_INET_Addr from a @a port_number,
* a @a primary_ip_addr, and an array of @a secondary_ip_addrs. @a
@@ -121,6 +142,7 @@ public:
int encode = 1,
const ACE_UINT32 *secondary_ip_addrs = 0,
size_t size = 0);
+
/**
* Sets the port number without affecting the host name. The port
* numbers of the primary address, and of any and all secondary
@@ -131,17 +153,21 @@ public:
*/
void set_port_number (u_short port_number,
int encode = 1);
+
// = Accessor methods.
+
/**
* Returns the number of secondary addresses.
*/
size_t get_num_secondary_addresses () const;
+
/**
* Initialize user-supplied array @a secondary_addrs with the current
* secondary addresses. @a size is taken as the size of this array.
*/
int get_secondary_addresses(ACE_INET_Addr *secondary_addrs,
size_t size) const;
+
/**
* Initialize user-supplied array @a addrs with the the current
* primary and secondary addresses. @a size is taken as the size of
@@ -149,18 +175,25 @@ public:
*/
void get_addresses(sockaddr_in *addrs,
size_t size) const;
+
#if defined (ACE_HAS_IPV6)
+
/// IPV6 version of the above.
void get_addresses(sockaddr_in6 *addrs,
size_t size) const;
#endif /* ACE_HAS_IPV6 */
+
private:
ACE_Array<ACE_INET_Addr> secondaries_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
# include "ace/Multihomed_INET_Addr.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_MULTIHOMED_INET_ADDR_H */
diff --git a/dep/ACE_wrappers/ace/Multihomed_INET_Addr.inl b/dep/ACE_wrappers/ace/Multihomed_INET_Addr.inl
index 6f13f14c85b..61c8560593c 100644
--- a/dep/ACE_wrappers/ace/Multihomed_INET_Addr.inl
+++ b/dep/ACE_wrappers/ace/Multihomed_INET_Addr.inl
@@ -1,7 +1,9 @@
// -*- C++ -*-
//
// $Id: Multihomed_INET_Addr.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Accessor implementations
ACE_INLINE
size_t
@@ -9,4 +11,5 @@ ACE_Multihomed_INET_Addr::get_num_secondary_addresses() const
{
return this->secondaries_.size();
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Mutex.cpp b/dep/ACE_wrappers/ace/Mutex.cpp
index 8672baf0371..8203a1c4ced 100644
--- a/dep/ACE_wrappers/ace/Mutex.cpp
+++ b/dep/ACE_wrappers/ace/Mutex.cpp
@@ -1,21 +1,29 @@
// $Id: Mutex.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Mutex.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Mutex.inl"
#endif /* __ACE_INLINE__ */
+
#include "ace/Log_Msg.h"
#include "ace/OS_NS_string.h"
#include "ace/os_include/sys/os_mman.h"
+
ACE_RCSID (ace,
Mutex,
"$Id: Mutex.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_Mutex)
+
void
ACE_Mutex::dump (void) const
{
// ACE_TRACE ("ACE_Mutex::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
#if defined (ACE_HAS_PTHREADS) || defined(ACE_HAS_STHREADS)
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("lockname_ = %s\n"), this->lockname_));
@@ -24,6 +32,7 @@ ACE_Mutex::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n")));
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
}
+
ACE_Mutex::ACE_Mutex (int type, const ACE_TCHAR *name,
ACE_mutexattr_t *arg, mode_t mode)
:
@@ -34,6 +43,7 @@ ACE_Mutex::ACE_Mutex (int type, const ACE_TCHAR *name,
removed_ (false)
{
// ACE_TRACE ("ACE_Mutex::ACE_Mutex");
+
// These platforms need process-wide mutex to be in shared memory.
#if defined(ACE_HAS_PTHREADS) || defined (ACE_HAS_STHREADS)
if (type == USYNC_PROCESS)
@@ -63,6 +73,7 @@ ACE_Mutex::ACE_Mutex (int type, const ACE_TCHAR *name,
return;
}
}
+
this->process_lock_ =
(ACE_mutex_t *) ACE_OS::mmap (0,
sizeof (ACE_mutex_t),
@@ -73,6 +84,7 @@ ACE_Mutex::ACE_Mutex (int type, const ACE_TCHAR *name,
ACE_OS::close (fd);
if (this->process_lock_ == MAP_FAILED)
return;
+
if (this->lockname_
&& ACE_OS::mutex_init (this->process_lock_,
type,
@@ -91,6 +103,7 @@ ACE_Mutex::ACE_Mutex (int type, const ACE_TCHAR *name,
#else
ACE_UNUSED_ARG (mode);
#endif /* ACE_HAS_PTHREADS || ACE_HAS_STHREADS */
+
if (ACE_OS::mutex_init (&this->lock_,
type,
name,
@@ -102,10 +115,12 @@ ACE_Mutex::ACE_Mutex (int type, const ACE_TCHAR *name,
}
#endif /* ACE_HAS_PTHREADS || ACE_HAS_STHREADS */
}
+
ACE_Mutex::~ACE_Mutex (void)
{
// ACE_TRACE ("ACE_Mutex::~ACE_Mutex");
this->remove ();
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Mutex.h b/dep/ACE_wrappers/ace/Mutex.h
index b7d6b7d78bc..d0440263472 100644
--- a/dep/ACE_wrappers/ace/Mutex.h
+++ b/dep/ACE_wrappers/ace/Mutex.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file Mutex.h
@@ -8,25 +9,36 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//==========================================================================
+
#ifndef ACE_MUTEX_H
#define ACE_MUTEX_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/OS_NS_Thread.h"
#include "ace/OS_NS_unistd.h"
#include "ace/os_include/os_fcntl.h"
+
# if !defined (ACE_DEFAULT_MUTEX_A)
# define ACE_DEFAULT_MUTEX_A "ACE_MUTEX"
# endif /* ACE_DEFAULT_MUTEX_A */
+
# if defined (ACE_HAS_WCHAR)
# define ACE_DEFAULT_MUTEX_W ACE_TEXT_WIDE(ACE_DEFAULT_MUTEX_A)
# endif /* ACE_HAS_WCHAR */
+
# define ACE_DEFAULT_MUTEX ACE_TEXT (ACE_DEFAULT_MUTEX_A)
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Time_Value;
+
/**
* @class ACE_Mutex
*
@@ -43,16 +55,20 @@ public:
const ACE_TCHAR *name = 0,
ACE_mutexattr_t *arg = 0,
mode_t mode = ACE_DEFAULT_FILE_PERMS);
+
/// Implicitly destroy the mutex.
~ACE_Mutex (void);
+
/// Explicitly destroy the mutex.
/**
* @note Only one thread should call this method since it doesn't
* protect against race conditions.
*/
int remove (void);
+
/// Acquire lock ownership (wait on queue if necessary).
int acquire (void);
+
/// Block the thread until the mutex is acquired or @a tv times out,
/// in which case -1 is returned and @c errno == @c ETIME.
/**
@@ -61,6 +77,7 @@ public:
* to show the actual(absolute) acquisition time.
*/
int acquire (ACE_Time_Value &tv);
+
/// Block the thread until the mutex is acquired or @a *tv times
/// out, in which case -1 is returned and @c errno == @c ETIME.
/**
@@ -73,26 +90,31 @@ public:
* return to show the actual (absolute) acquisition time.
*/
int acquire (ACE_Time_Value *tv);
+
/// Conditionally acquire lock (i.e., don't wait on queue).
/**
* @return -1 on failure. If we "failed" because someone
* else already had the lock, @c errno is set to @c EBUSY.
*/
int tryacquire (void);
+
/// Release lock and unblock a thread at head of queue.
int release (void);
+
/// Acquire mutex ownership.
/**
* This calls @c acquire and is only here to make the @c ACE_Mutex
* interface consistent with the other synchronization APIs.
*/
int acquire_read (void);
+
/// Acquire mutex ownership.
/**
* This calls @c acquire and is only here to make the @c ACE_Mutex
* interface consistent with the other synchronization APIs.
*/
int acquire_write (void);
+
/// Conditionally acquire mutex (i.e., won't block).
/**
* This calls @c tryacquire and is only here to make the @c ACE_Mutex
@@ -102,6 +124,7 @@ public:
* already had the lock, @c errno is set to @c EBUSY.
*/
int tryacquire_read (void);
+
/// Conditionally acquire mutex (i.e., won't block).
/**
* This calls @c tryacquire and is only here to make the @c ACE_Mutex
@@ -111,23 +134,29 @@ public:
* already had the lock, @c errno is set to @c EBUSY.
*/
int tryacquire_write (void);
+
/**
* This is only here for consistency with the other synchronization
* APIs and usability with Lock adapters. Assumes the caller already has
* acquired the mutex and returns 0 in all cases.
*/
int tryacquire_write_upgrade (void);
+
/// Return the underlying mutex.
const ACE_mutex_t &lock (void) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
// = This should be protected but some C++ compilers complain...
public:
#if defined (ACE_HAS_PTHREADS) || defined(ACE_HAS_STHREADS)
/// This lock resides in shared memory.
ACE_mutex_t *process_lock_;
+
/**
* Remember the name of the mutex if we created it so we can unlink
* it when we go away (only the actor that initialized the memory
@@ -135,23 +164,30 @@ public:
*/
const ACE_TCHAR *lockname_;
#endif /* ACE_HAS_PTHREADS */
+
/// Mutex type supported by the OS.
ACE_mutex_t lock_;
+
/// Keeps track of whether @c remove has been called yet to avoid
/// multiple @c remove calls, e.g., explicitly and implicitly in the
/// destructor. This flag isn't protected by a lock, so make sure
/// that you don't have multiple threads simultaneously calling
/// @c remove on the same object, which is a bad idea anyway.
bool removed_;
+
private:
// Prevent assignment and initialization.
void operator= (const ACE_Mutex &);
ACE_Mutex (const ACE_Mutex &);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Mutex.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_MUTEX_H */
diff --git a/dep/ACE_wrappers/ace/Mutex.inl b/dep/ACE_wrappers/ace/Mutex.inl
index 3f3f6eabe4a..8c6c73c8667 100644
--- a/dep/ACE_wrappers/ace/Mutex.inl
+++ b/dep/ACE_wrappers/ace/Mutex.inl
@@ -2,8 +2,11 @@
//
// $Id: Mutex.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_sys_mman.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE int
ACE_Mutex::acquire_read (void)
{
@@ -14,6 +17,7 @@ ACE_Mutex::acquire_read (void)
#endif /* ACE_HAS_PTHREADS || ACE_HAS_STHREADS */
return ACE_OS::mutex_lock (&this->lock_);
}
+
ACE_INLINE int
ACE_Mutex::acquire_write (void)
{
@@ -24,6 +28,7 @@ ACE_Mutex::acquire_write (void)
#endif /* ACE_HAS_PTHREADS || ACE_HAS_STHREADS */
return ACE_OS::mutex_lock (&this->lock_);
}
+
ACE_INLINE int
ACE_Mutex::tryacquire_read (void)
{
@@ -34,6 +39,7 @@ ACE_Mutex::tryacquire_read (void)
#endif /* ACE_HAS_PTHREADS || ACE_HAS_STHREADS */
return ACE_OS::mutex_trylock (&this->lock_);
}
+
ACE_INLINE const ACE_mutex_t &
ACE_Mutex::lock (void) const
{
@@ -44,6 +50,7 @@ ACE_Mutex::lock (void) const
#endif /* ACE_HAS_PTHREADS || ACE_HAS_STHREADS */
return this->lock_;
}
+
ACE_INLINE int
ACE_Mutex::tryacquire_write (void)
{
@@ -54,12 +61,14 @@ ACE_Mutex::tryacquire_write (void)
#endif /* ACE_HAS_PTHREADS || ACE_HAS_STHREADS */
return ACE_OS::mutex_trylock (&this->lock_);
}
+
ACE_INLINE int
ACE_Mutex::tryacquire_write_upgrade (void)
{
// ACE_TRACE ("ACE_Mutex::tryacquire_write_upgrade");
return 0;
}
+
ACE_INLINE int
ACE_Mutex::acquire (void)
{
@@ -70,6 +79,7 @@ ACE_Mutex::acquire (void)
#endif /* ACE_HAS_PTHREADS || ACE_HAS_STHREADS */
return ACE_OS::mutex_lock (&this->lock_);
}
+
ACE_INLINE int
ACE_Mutex::acquire (ACE_Time_Value &tv)
{
@@ -80,6 +90,7 @@ ACE_Mutex::acquire (ACE_Time_Value &tv)
#endif /* ACE_HAS_PTHREADS || ACE_HAS_STHREADS*/
return ACE_OS::mutex_lock (&this->lock_, tv);
}
+
ACE_INLINE int
ACE_Mutex::acquire (ACE_Time_Value *tv)
{
@@ -89,6 +100,7 @@ ACE_Mutex::acquire (ACE_Time_Value *tv)
#endif /* ACE_HAS_PTHREADS || ACE_HAS_STHREADS*/
return ACE_OS::mutex_lock (&this->lock_, tv);
}
+
ACE_INLINE int
ACE_Mutex::tryacquire (void)
{
@@ -99,6 +111,7 @@ ACE_Mutex::tryacquire (void)
#endif /* ACE_HAS_PTHREADS || ACE_HAS_STHREADS */
return ACE_OS::mutex_trylock (&this->lock_);
}
+
ACE_INLINE int
ACE_Mutex::release (void)
{
@@ -109,6 +122,7 @@ ACE_Mutex::release (void)
#endif /* ACE_HAS_PTHREADS || ACE_HAS_STHREADS */
return ACE_OS::mutex_unlock (&this->lock_);
}
+
ACE_INLINE int
ACE_Mutex::remove (void)
{
@@ -157,4 +171,5 @@ ACE_Mutex::remove (void)
#endif /* ACE_HAS_PTHREADS || ACE_HAS_STHREADS */
return result;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/NT_Service.cpp b/dep/ACE_wrappers/ace/NT_Service.cpp
index 9353e8ed60a..2cd94793c52 100644
--- a/dep/ACE_wrappers/ace/NT_Service.cpp
+++ b/dep/ACE_wrappers/ace/NT_Service.cpp
@@ -1,16 +1,24 @@
// $Id: NT_Service.cpp 81862 2008-06-09 10:41:41Z sma $
+
#include "ace/config-all.h"
#if defined (ACE_WIN32) && !defined (ACE_LACKS_WIN32_SERVICES)
+
#include "ace/NT_Service.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/NT_Service.inl"
#endif /* __ACE_INLINE__ */
+
#include "ace/Log_Msg.h"
#include "ace/Service_Object.h"
#include "ace/OS_NS_errno.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_NT_Service)
+
// ACE_NT_Service destructor.
+
ACE_NT_Service::~ACE_NT_Service (void)
{
if (this->svc_sc_handle_ != 0)
@@ -22,6 +30,7 @@ ACE_NT_Service::~ACE_NT_Service (void)
delete [] this->name_;
delete [] this->host_;
}
+
// This default implementation of ACE_NT_Service::open sets the
// service's status to START_PENDING with the estimated time until
// STARTED set to the value given when this object was constructed.
@@ -41,11 +50,13 @@ ACE_NT_Service::~ACE_NT_Service (void)
// request for the service. It is up to that function and svc to
// cooperate to both respond appropriately to the request (by at least
// updating the service's status) and to fulfill the request.
+
int
ACE_NT_Service::open (void *args)
{
ACE_UNUSED_ARG (args);
this->report_status (SERVICE_START_PENDING, 0);
+
int svc_return = this->svc ();
if (svc_return == 0)
{
@@ -64,14 +75,18 @@ ACE_NT_Service::open (void *args)
this->svc_status_.dwServiceSpecificExitCode = errno;
}
}
+
return svc_return;
+
}
+
int
ACE_NT_Service::fini (void)
{
return this->report_status (SERVICE_STOPPED, 0);
}
+
void
ACE_NT_Service::handle_control (DWORD control_code)
{
@@ -81,23 +96,28 @@ ACE_NT_Service::handle_control (DWORD control_code)
case SERVICE_CONTROL_STOP:
this->stop_requested (control_code);
break;
+
case SERVICE_CONTROL_PAUSE:
this->pause_requested (control_code);
break;
+
case SERVICE_CONTROL_CONTINUE:
this->continue_requested (control_code);
break;
+
case SERVICE_CONTROL_INTERROGATE:
this->interrogate_requested (control_code);
break;
}
}
+
void
ACE_NT_Service::stop_requested (DWORD)
{
this->report_status (SERVICE_STOP_PENDING);
/* how to cancel? */
}
+
void
ACE_NT_Service::pause_requested (DWORD)
{
@@ -105,6 +125,7 @@ ACE_NT_Service::pause_requested (DWORD)
this->suspend ();
this->report_status (SERVICE_PAUSED);
}
+
void
ACE_NT_Service::continue_requested (DWORD)
{
@@ -112,30 +133,37 @@ ACE_NT_Service::continue_requested (DWORD)
this->resume ();
this->report_status (SERVICE_RUNNING);
}
+
void
ACE_NT_Service::interrogate_requested (DWORD)
{
this->report_status (0);
}
+
void
ACE_NT_Service::name (const ACE_TCHAR *name, const ACE_TCHAR *desc)
{
delete [] this->desc_;
delete [] this->name_;
+
if (desc == 0)
desc = name;
+
this->name_ = ACE::strnew (name);
this->desc_ = ACE::strnew (desc);
}
+
void
ACE_NT_Service::host (const ACE_TCHAR *host)
{
delete [] this->host_;
+
if (this->svc_sc_handle_ != 0)
{
CloseServiceHandle (this->svc_sc_handle_);
this->svc_sc_handle_ = 0;
}
+
if (host == 0)
{
this->host_ = 0;
@@ -145,6 +173,7 @@ ACE_NT_Service::host (const ACE_TCHAR *host)
this->host_ = ACE::strnew (host);
}
}
+
int
ACE_NT_Service::insert (DWORD start_type,
DWORD error_control,
@@ -157,8 +186,10 @@ ACE_NT_Service::insert (DWORD start_type,
DWORD desired_access)
{
ACE_TCHAR this_exe[MAXPATHLEN + 2];
+
// Insure ACE_OS::last_error finds GetLastError unless we set errno.
errno = 0;
+
if (exe_path == 0)
{
if (ACE_TEXT_GetModuleFileName (0, this_exe + 1, MAXPATHLEN) == 0)
@@ -168,11 +199,13 @@ ACE_NT_Service::insert (DWORD start_type,
ACE_OS::strcat (this_exe, ACE_TEXT ("\""));
exe_path = this_exe;
}
+
SC_HANDLE sc_mgr = ACE_TEXT_OpenSCManager (this->host (),
0,
SC_MANAGER_ALL_ACCESS);
if (sc_mgr == 0)
return -1;
+
SC_HANDLE sh = ACE_TEXT_CreateService (sc_mgr,
this->name (),
this->desc (),
@@ -190,24 +223,33 @@ ACE_NT_Service::insert (DWORD start_type,
// smashes it. ACE_OS::last_error will find the saved error value.
if (sh == 0)
ACE_OS::set_errno_to_last_error ();
+
CloseServiceHandle (sc_mgr);
+
if (sh == 0)
return -1;
+
if (this->svc_sc_handle_ != 0)
CloseServiceHandle (this->svc_sc_handle_);
this->svc_sc_handle_ = sh;
+
return 0;
+
}
+
int
ACE_NT_Service::remove (void)
{
if (this->svc_sc_handle () == 0)
return -1;
+
if (DeleteService (this->svc_sc_handle()) == 0
&& GetLastError () != ERROR_SERVICE_MARKED_FOR_DELETE)
return -1;
+
return 0;
}
+
// Sets the startup type for the service. Returns -1 on error, 0 on
// success.
int
@@ -216,6 +258,7 @@ ACE_NT_Service::startup (DWORD startup)
SC_HANDLE svc = this->svc_sc_handle ();
if (svc == 0)
return -1;
+
BOOL ok =
ChangeServiceConfig (svc,
(DWORD) SERVICE_NO_CHANGE,// No change to service type
@@ -227,9 +270,12 @@ ACE_NT_Service::startup (DWORD startup)
0, // No change to dependencies
0, 0, // No change to acct/passwd
0); // No change to name
+
return ok ? 0 : -1;
}
+
// Returns the current startup type.
+
DWORD
ACE_NT_Service::startup (void)
{
@@ -240,6 +286,7 @@ ACE_NT_Service::startup (void)
char cfgbuff[1024];
LPQUERY_SERVICE_CONFIG cfg;
DWORD cfgsize, needed_size;
+
SC_HANDLE svc = this->svc_sc_handle ();
if (svc == 0)
{
@@ -255,13 +302,16 @@ ACE_NT_Service::startup (void)
// Zero is a valid return value for QueryServiceConfig, so if
// QueryServiceConfig fails, return the DWORD equivalent of -1.
return MAXDWORD;
+
}
+
void
ACE_NT_Service::capture_log_msg_attributes (void)
{
ACE_Log_Msg::init_hook (this->log_msg_attributes_);
}
+
void
ACE_NT_Service::inherit_log_msg_attributes (void)
{
@@ -270,6 +320,7 @@ ACE_NT_Service::inherit_log_msg_attributes (void)
ACE_Log_Msg::inherit_hook (0, this->log_msg_attributes_);
}
+
int
ACE_NT_Service::start_svc (ACE_Time_Value *wait_time,
DWORD *svc_state,
@@ -278,13 +329,17 @@ ACE_NT_Service::start_svc (ACE_Time_Value *wait_time,
SC_HANDLE svc = this->svc_sc_handle ();
if (svc == 0)
return -1;
+
if (!ACE_TEXT_StartService (svc, argc, argv))
return -1;
+
this->wait_for_service_state (SERVICE_RUNNING, wait_time);
if (svc_state != 0)
*svc_state = this->svc_status_.dwCurrentState;
+
return 0;
}
+
int
ACE_NT_Service::stop_svc (ACE_Time_Value *wait_time,
DWORD *svc_state)
@@ -292,16 +347,20 @@ ACE_NT_Service::stop_svc (ACE_Time_Value *wait_time,
SC_HANDLE svc = this->svc_sc_handle ();
if (svc == 0)
return -1;
+
if (!ControlService (svc,
SERVICE_CONTROL_STOP,
&this->svc_status_))
return -1;
+
this->wait_for_service_state (SERVICE_STOPPED,
wait_time);
if (svc_state != 0)
*svc_state = this->svc_status_.dwCurrentState;
+
return 0;
}
+
int
ACE_NT_Service::pause_svc (ACE_Time_Value *wait_time,
DWORD *svc_state)
@@ -309,16 +368,20 @@ ACE_NT_Service::pause_svc (ACE_Time_Value *wait_time,
SC_HANDLE svc = this->svc_sc_handle ();
if (svc == 0)
return -1;
+
if (!ControlService (svc,
SERVICE_CONTROL_PAUSE,
&this->svc_status_))
return -1;
+
this->wait_for_service_state (SERVICE_PAUSED,
wait_time);
if (svc_state != 0)
*svc_state = this->svc_status_.dwCurrentState;
+
return 0;
}
+
int
ACE_NT_Service::continue_svc (ACE_Time_Value *wait_time,
DWORD *svc_state)
@@ -326,55 +389,69 @@ ACE_NT_Service::continue_svc (ACE_Time_Value *wait_time,
SC_HANDLE svc = this->svc_sc_handle ();
if (svc == 0)
return -1;
+
if (!ControlService (svc,
SERVICE_CONTROL_CONTINUE,
&this->svc_status_))
return -1;
+
this->wait_for_service_state (SERVICE_RUNNING,
wait_time);
if (svc_state != 0)
*svc_state = this->svc_status_.dwCurrentState;
+
return 0;
}
+
DWORD
ACE_NT_Service::state (ACE_Time_Value *wait_hint)
{
DWORD curr_state;
+
if (this->state (&curr_state,
wait_hint) == -1)
return 0;
return curr_state;
}
+
int
ACE_NT_Service::state (DWORD *pstate,
ACE_Time_Value *wait_hint)
{
SC_HANDLE svc = this->svc_sc_handle ();
+
if (svc == 0)
return -1;
+
// Need to create a temporary copy of this variable since the
// QueryServiceStatus call will modify the setting depending on the
// current state of the Service. If the service is currently
// STOPPED, the value will be cleared.
DWORD controls_accepted = this->svc_status_.dwControlsAccepted;
+
if (QueryServiceStatus (svc,
&this->svc_status_) == 0)
return -1;
+
if (wait_hint != 0)
wait_hint->msec (static_cast<long> (this->svc_status_.dwWaitHint));
+
*pstate = this->svc_status_.dwCurrentState;
this->svc_status_.dwControlsAccepted = controls_accepted;
return 0;
}
+
// test_access
//
// Open a new handle, ignoring any handle open in svc_sc_handle_.
// This function's results are returned without leaving the handle
// open.
+
int
ACE_NT_Service::test_access (DWORD desired_access)
{
int status = -1; // Guilty until proven innocent
+
SC_HANDLE sc_mgr = ACE_TEXT_OpenSCManager (this->host (),
0,
GENERIC_READ);
@@ -390,8 +467,10 @@ ACE_NT_Service::test_access (DWORD desired_access)
CloseServiceHandle (handle);
}
}
+
return status;
}
+
// report_status
//
// Reports the current status. If new_status is not 0, it sets the
@@ -401,6 +480,7 @@ ACE_NT_Service::test_access (DWORD desired_access)
// is used unless it's 0, in which case the existing hint is used.
// The dwWaitHint is not updated by this function. The checkpoint is
// incremented by one after a pending report.
+
int
ACE_NT_Service::report_status (DWORD new_status,
DWORD time_hint)
@@ -408,6 +488,7 @@ ACE_NT_Service::report_status (DWORD new_status,
int bump_checkpoint = 0;
int retval = 0;
DWORD save_controls = 0;
+
if (new_status != 0)
this->svc_status_.dwCurrentState = new_status;
switch (this->svc_status_.dwCurrentState)
@@ -422,17 +503,23 @@ ACE_NT_Service::report_status (DWORD new_status,
this->svc_status_.dwWaitHint = time_hint ? time_hint : this->start_time_;
bump_checkpoint = 1;
break;
+
default:
this->svc_status_.dwCheckPoint = 0;
}
+
retval = SetServiceStatus (this->svc_handle_,
&this->svc_status_) ? 0 : -1;
+
if (save_controls != 0)
this->svc_status_.dwControlsAccepted = save_controls;
+
if (bump_checkpoint)
++this->svc_status_.dwCheckPoint;
+
return retval;
}
+
SC_HANDLE
ACE_NT_Service::svc_sc_handle (void)
{
@@ -453,8 +540,10 @@ ACE_NT_Service::svc_sc_handle (void)
else
ACE_OS::set_errno_to_last_error ();
}
+
return this->svc_sc_handle_;
}
+
void
ACE_NT_Service::wait_for_service_state (DWORD desired_state,
ACE_Time_Value *wait_time)
@@ -463,26 +552,32 @@ ACE_NT_Service::wait_for_service_state (DWORD desired_state,
DWORD last_check_point = 0;
int first_time = 1;
int service_ok;
+
ACE_Time_Value time_out = ACE_OS::gettimeofday ();
if (wait_time != 0)
time_out += *wait_time;
+
// Poll until the service reaches the desired state.
for (;;)
{
service_ok = 0 != QueryServiceStatus (this->svc_sc_handle_,
&this->svc_status_);
+
// If we cannot query the service, we are done.
if (!service_ok)
break;
+
// If the service has the desired state, we are done.
if (desired_state == this->svc_status_.dwCurrentState)
break;
+
// If we time-out, we are done
if (wait_time != 0 && ACE_OS::gettimeofday () > time_out )
{
errno = ETIME;
break;
}
+
if (first_time)
{
// remember the service state, the first time we wait
@@ -511,10 +606,14 @@ ACE_NT_Service::wait_for_service_state (DWORD desired_state,
}
}
}
+
::Sleep (this->svc_status_.dwWaitHint);
}
+
return;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_WIN32 && !ACE_LACKS_WIN32_SERVICES */
diff --git a/dep/ACE_wrappers/ace/NT_Service.h b/dep/ACE_wrappers/ace/NT_Service.h
index 5d5ec6c1e98..bc6e39036b2 100644
--- a/dep/ACE_wrappers/ace/NT_Service.h
+++ b/dep/ACE_wrappers/ace/NT_Service.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file NT_Service.h
@@ -8,19 +9,26 @@
* @author Steve Huston <shuston@riverace.com>
*/
//==========================================================================
+
#ifndef ACE_NT_SERVICE_H
#define ACE_NT_SERVICE_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_WIN32) && !defined (ACE_LACKS_WIN32_SERVICES)
+
#include "ace/ACE.h"
#include "ace/OS_Log_Msg_Attributes.h"
#include "ace/Service_Object.h"
#include "ace/Task.h"
#include "ace/OS_NS_errno.h" // needed for those using our macros
+
// ACE_NT_SERVICE_START_TIMEOUT is an estimate of the number of
// milliseconds your service will take to start. Default is 5
// seconds; you can pass a different value (or set one) when you
@@ -28,7 +36,9 @@
#if !defined ACE_NT_SERVICE_START_TIMEOUT
#define ACE_NT_SERVICE_START_TIMEOUT 5000
#endif /* ACE_NT_SERVICE_TIMEOUT */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_NT_Service
*
@@ -88,12 +98,14 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
*/
class ACE_Export ACE_NT_Service : public ACE_Task<ACE_MT_SYNCH>
{
+
public:
// = Initialization and termination methods.
/// Constructor primarily for use when running the service.
ACE_NT_Service (DWORD start_timeout = ACE_NT_SERVICE_START_TIMEOUT,
DWORD service_type = SERVICE_WIN32_OWN_PROCESS,
DWORD controls_mask = SERVICE_ACCEPT_STOP);
+
/// Constructor primarily for use when inserting/removing/controlling
/// the service.
ACE_NT_Service (const ACE_TCHAR *name,
@@ -101,20 +113,25 @@ public:
DWORD start_timeout = ACE_NT_SERVICE_START_TIMEOUT,
DWORD service_type = SERVICE_WIN32_OWN_PROCESS,
DWORD controls_mask = SERVICE_ACCEPT_STOP);
+
virtual ~ACE_NT_Service (void);
+
// = Functions to operate the service
+
/**
* Hook called to open the service. By default, sets the service
* status to SERVICE_START_PENDING, calls the @c svc() method,
* interprets and sets the service status, and returns.
*/
virtual int open (void *args = 0);
+
/**
* Hook called when terminating the service. Inherited from
* ACE_Shared_Object. Default implementation sets the service status
* to SERVICE_STOPPED.
*/
virtual int fini (void);
+
/**
* The actual service implementation. This function need not be overridden
* by applications that are just using SCM capabilities, but must be
@@ -122,6 +139,7 @@ public:
* this function will set the status to RUNNING.
*/
virtual int svc (void);
+
/**
* This function is called in response to a request from the Service
* Dispatcher. It must interact with the <svc> function to effect the
@@ -134,24 +152,32 @@ public:
* SERVICE_CONTROL_SHUTDOWN: same as SERVICE_CONTROL_STOP.
*/
virtual void handle_control (DWORD control_code);
+
/// Set the svc_handle_ member. This is only a public function because
/// the macro-generated service function calls it.
void svc_handle (const SERVICE_STATUS_HANDLE new_svc_handle);
+
// = Methods which can be used to do SCP-like functions. The first group
// are used to register/insert and remove the service's definition in the
// SCM registry.
+
/// Sets the name and description for the service.
/// If desc is 0, it takes the same value as name.
void name (const ACE_TCHAR *name, const ACE_TCHAR *desc = 0);
+
/// Get the service name.
const ACE_TCHAR *name (void) const;
+
/// Get the service description.
const ACE_TCHAR *desc (void) const;
+
/// Sets the host machine
void host (const ACE_TCHAR *host);
+
/// Get the host machine.
const ACE_TCHAR *host (void) const;
+
/**
* Insert (create) the service in the NT Service Control Manager,
* with the given creation values. exe_path defaults to the path name
@@ -168,17 +194,22 @@ public:
const ACE_TCHAR *account_name = 0,
const ACE_TCHAR *password = 0,
DWORD desired_access = SERVICE_ALL_ACCESS);
+
/**
* Remove the service from the NT Service Control Manager. Returns -1 on
* error, 0 on success. This just affects the SCM and registry - the
* can and will keep running fine if it is already running.
*/
int remove (void);
+
/// Sets the startup type for the service. Returns -1 on error, 0 on success.
int startup (DWORD startup);
+
/// Returns the current startup type.
DWORD startup (void);
+
// = Methods to control ACE_Log_Msg behavior in the service.
+
/**
* Set the ACE_Log_Msg attributes that the service thread will use to
* initialize its ACE_Log_Msg instance. This is how the initiating
@@ -190,6 +221,7 @@ public:
* function.
*/
void capture_log_msg_attributes (void);
+
/**
* Set the ACE_Log_Msg attributes in the current thread to those saved
* in the most recent call to @c capture_log_msg_attributes(). This function
@@ -198,7 +230,9 @@ public:
* correctly into the process's established logging setup.
*/
void inherit_log_msg_attributes (void);
+
// = Methods which control the service's execution.
+
// These methods to start/pause/resume/stop/check the service all
// have the following common behavior with respect to @a wait_time
// and return value. @a wait_time is a pointer to an ACE_Time_Value
@@ -224,6 +258,7 @@ public:
// this would include privilege restrictions and if the service is
// not configured to receive the request (this is most likely to
// happen in the case of pause and continue).
+
/**
* Start the service (must have been inserted before). wait_time is
* the time to wait for the service to reach a steady state before
@@ -239,6 +274,7 @@ public:
int start_svc (ACE_Time_Value *wait_time = 0,
DWORD *svc_state = 0,
DWORD argc = 0, const ACE_TCHAR **argv = 0);
+
/**
* Requests the service to stop. Will wait up to @a wait_time for
* the service to actually stop. If not specified, the function
@@ -248,10 +284,13 @@ public:
* was made successfully, -1 if not.
*/
int stop_svc (ACE_Time_Value *wait_time = 0, DWORD *svc_state = 0);
+
/// Pause the service.
int pause_svc (ACE_Time_Value *wait_time = 0, DWORD *svc_state = 0);
+
/// Continue the service.
int continue_svc (ACE_Time_Value *wait_time = 0, DWORD *svc_state = 0);
+
/**
* Get the current state for the service. If <wait_hint> is not 0,
* it receives the service's reported wait hint. Note that this
@@ -262,9 +301,11 @@ public:
* set of valid service state values are all greater than 0.
*/
DWORD state (ACE_Time_Value *wait_hint = 0);
+
/// A version of <state> that returns -1 for failure, 0 for success.
/// The DWORD pointed to by pstate receives the state value.
int state (DWORD *pstate, ACE_Time_Value *wait_hint = 0);
+
/**
* Test access to the object's service in the SCM. The service must
* already have been inserted in the SCM database. This function
@@ -274,16 +315,20 @@ public:
* ACE_OS::last_error to get the specific error indication.
*/
int test_access (DWORD desired_access = SERVICE_ALL_ACCESS);
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
int report_status (DWORD new_status, DWORD time_hint = 0);
+
/**
* Return the svc_sc_handle_ member. If the member is null, it
* retrieves the handle from the Service Control Manager and caches
* it.
*/
SC_HANDLE svc_sc_handle (void);
+
/**
* Waits for the service to reach <desired_state> or get
* (apparently) stuck before it reaches that state. Will wait at
@@ -294,29 +339,38 @@ protected:
*/
void wait_for_service_state (DWORD desired_state,
ACE_Time_Value *wait_time);
+
/// Called by <handle_control> when a stop/shutdown was requested.
virtual void stop_requested (DWORD control_code);
+
/// Called by <handle_control> when a pause was requested.
virtual void pause_requested (DWORD control_code);
+
/// Called by <handle_control> when a continue was requested.
virtual void continue_requested (DWORD control_code);
+
/// Called by <handle_control> when a interrogate was requested.
virtual void interrogate_requested (DWORD control_code);
+
protected:
/// Estimate of init time needed
DWORD start_time_;
/// Service handle - doesn't need close.
SERVICE_STATUS_HANDLE svc_handle_;
SERVICE_STATUS svc_status_;
+
/// Service's SCM handle
SC_HANDLE svc_sc_handle_;
ACE_TCHAR *name_;
ACE_TCHAR *desc_;
ACE_TCHAR *host_;
+
/// ACE_Log_Msg attributes to inherit from the starting thread.
ACE_OS_Log_Msg_Attributes log_msg_attributes_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
// These macros help to get things set up correctly at compile time
// and to take most of the grudge work out of creating the proper
// functions and doing the registrations.
@@ -324,6 +378,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
// ACE_NT_SERVICE_DEFINE - defines the 'ServiceMain' function which NT will
// call in its own thread when the service control
// dispatcher starts.
+
#define ACE_NT_SERVICE_DEFINE(SVCNAME, SVCCLASS, SVCDESC) \
ACE_NT_Service * _ace_nt_svc_obj_##SVCNAME = 0; \
VOID WINAPI ace_nt_svc_handler_##SVCNAME (DWORD fdwControl) { \
@@ -353,12 +408,15 @@ ACE_END_VERSIONED_NAMESPACE_DECL
} \
return; \
}
+
#define ACE_NT_SERVICE_REFERENCE(SVCNAME) \
extern ACE_NT_Service * _ace_nt_svc_obj_##SVCNAME; \
extern VOID WINAPI ace_nt_svc_main_##SVCNAME (DWORD dwArgc, \
ACE_TCHAR **lpszArgv);
+
#define ACE_NT_SERVICE_ENTRY(SVCDESC, SVCNAME) \
{ SVCDESC, &ace_nt_svc_main_##SVCNAME }
+
#define ACE_NT_SERVICE_RUN(SVCNAME, SVCINSTANCE, RET) \
ACE_TEXT_SERVICE_TABLE_ENTRY _ace_nt_svc_table[2] = \
{ \
@@ -369,10 +427,14 @@ extern VOID WINAPI ace_nt_svc_main_##SVCNAME (DWORD dwArgc, \
_ace_nt_svc_obj_##SVCNAME->capture_log_msg_attributes (); \
ACE_OS::last_error (0); \
int RET = ACE_TEXT_StartServiceCtrlDispatcher(_ace_nt_svc_table);
+
#if defined (__ACE_INLINE__)
#include "ace/NT_Service.inl"
#endif /* __ACE_INLINE__ */
+
#endif /* ACE_WIN32 && !ACE_LACKS_WIN32_SERVICES */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_SERVICE_OBJECT_H */
diff --git a/dep/ACE_wrappers/ace/NT_Service.inl b/dep/ACE_wrappers/ace/NT_Service.inl
index 2d2117ca156..80c2a7a3764 100644
--- a/dep/ACE_wrappers/ace/NT_Service.inl
+++ b/dep/ACE_wrappers/ace/NT_Service.inl
@@ -1,7 +1,9 @@
// -*- C++ -*-
//
// $Id: NT_Service.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_NT_Service::ACE_NT_Service (DWORD start_timeout,
DWORD service_type,
@@ -22,6 +24,7 @@ ACE_NT_Service::ACE_NT_Service (DWORD start_timeout,
svc_status_.dwWaitHint = 0;
}
+
ACE_INLINE
ACE_NT_Service::ACE_NT_Service (const ACE_TCHAR *name,
const ACE_TCHAR *desc,
@@ -43,34 +46,40 @@ ACE_NT_Service::ACE_NT_Service (const ACE_TCHAR *name,
svc_status_.dwCheckPoint = 0;
}
+
ACE_INLINE int
ACE_NT_Service::svc (void)
{
return -1;
}
+
ACE_INLINE
const ACE_TCHAR *
ACE_NT_Service::name (void) const
{
return name_;
}
+
ACE_INLINE
const ACE_TCHAR *
ACE_NT_Service::desc (void) const
{
return desc_;
}
+
ACE_INLINE
const ACE_TCHAR *
ACE_NT_Service::host (void) const
{
return host_;
}
+
ACE_INLINE void
ACE_NT_Service::svc_handle(const SERVICE_STATUS_HANDLE new_svc_handle)
{
this->svc_handle_ = new_svc_handle;
return;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Name_Proxy.cpp b/dep/ACE_wrappers/ace/Name_Proxy.cpp
index b2052cd3210..19ff0be473d 100644
--- a/dep/ACE_wrappers/ace/Name_Proxy.cpp
+++ b/dep/ACE_wrappers/ace/Name_Proxy.cpp
@@ -1,14 +1,19 @@
// $Id: Name_Proxy.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Name_Proxy.h"
#include "ace/Log_Msg.h"
#include "ace/os_include/arpa/os_inet.h"
+
ACE_RCSID(ace, Name_Proxy, "$Id: Name_Proxy.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
void
ACE_Name_Proxy::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_Name_Proxy::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
this->connector_.dump ();
this->peer_.dump ();
@@ -16,27 +21,35 @@ ACE_Name_Proxy::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
// Default constructor.
+
ACE_Name_Proxy::ACE_Name_Proxy (void)
: reactor_ (0)
{
ACE_TRACE ("ACE_Name_Proxy::ACE_Name_Proxy");
}
+
// Establish binding with the ACE_Name Server at remote_addr.
+
int
ACE_Name_Proxy::open (const ACE_INET_Addr &remote_addr,
ACE_Synch_Options& options)
{
ACE_TRACE ("ACE_Name_Proxy::open");
ACE_Time_Value *timeout = 0;
+
if (options[ACE_Synch_Options::USE_TIMEOUT])
timeout = const_cast<ACE_Time_Value *> (options.time_value ());
+
// Initiate the connection.
return this->connector_.connect (this->peer_,
remote_addr,
timeout);
}
+
// Establish binding with the ACE_Name Server at remote_addr.
+
ACE_Name_Proxy::ACE_Name_Proxy (
const ACE_INET_Addr &remote_addr,
ACE_Synch_Options& options)
@@ -49,25 +62,31 @@ ACE_Name_Proxy::ACE_Name_Proxy (
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_Name_Proxy::ACE_Name_Proxy")));
}
+
// Obtain underlying handle.
+
/* VIRTUAL */ ACE_HANDLE
ACE_Name_Proxy::get_handle (void) const
{
ACE_TRACE ("ACE_Name_Proxy::get_handle");
return this->peer_.get_handle ();
}
+
int
ACE_Name_Proxy::request_reply (ACE_Name_Request &request)
{
ACE_TRACE ("ACE_Name_Proxy::request_reply");
void *buffer;
ssize_t length = request.encode (buffer);
+
if (length == -1)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("encode failed")),
-1);
+
// Transmit request via a blocking send.
+
if (this->peer_.send_n (buffer, length) != length)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("%p\n"),
@@ -76,7 +95,9 @@ ACE_Name_Proxy::request_reply (ACE_Name_Request &request)
else
{
ACE_Name_Reply reply;
+
// Receive reply via blocking read.
+
if (this->peer_.recv_n (&reply,
sizeof reply) == -1)
ACE_ERROR_RETURN ((LM_ERROR,
@@ -92,18 +113,22 @@ ACE_Name_Proxy::request_reply (ACE_Name_Request &request)
return reply.status ();
}
}
+
int
ACE_Name_Proxy::send_request (ACE_Name_Request &request)
{
ACE_TRACE ("ACE_Name_Proxy::send_request");
void *buffer;
ssize_t length = request.encode (buffer);
+
if (length == -1)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("encode failed")),
-1);
+
// Transmit request via a blocking send.
+
else if (this->peer_.send_n (buffer, length) != length)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("%p\n"),
@@ -111,6 +136,7 @@ ACE_Name_Proxy::send_request (ACE_Name_Request &request)
-1);
return 0;
}
+
int
ACE_Name_Proxy::recv_reply (ACE_Name_Request &reply)
{
@@ -119,6 +145,7 @@ ACE_Name_Proxy::recv_reply (ACE_Name_Request &reply)
// implementation assumes that the first 4 bytes are the length of
// the message.
ssize_t n = this->peer_.recv ((void *) &reply, sizeof (ACE_UINT32));
+
switch (n)
{
case -1:
@@ -140,11 +167,13 @@ ACE_Name_Proxy::recv_reply (ACE_Name_Request &reply)
{
// Transform the length into host byte order.
ssize_t length = ACE_NTOHL (reply.length ());
+
// Receive the rest of the request message.
// @@ beware of blocking read!!!.
n = this->peer_.recv ((void *) (((char *) &reply)
+ sizeof (ACE_UINT32)),
length - sizeof (ACE_UINT32));
+
// Subtract off the size of the part we skipped over...
if (n != ssize_t (length - sizeof (ACE_UINT32)))
{
@@ -155,6 +184,7 @@ ACE_Name_Proxy::recv_reply (ACE_Name_Request &reply)
n));
return -1;
}
+
// Decode the request into host byte order.
if (reply.decode () == -1)
{
@@ -167,11 +197,14 @@ ACE_Name_Proxy::recv_reply (ACE_Name_Request &reply)
}
return 0;
}
+
// Close down the connection to the server.
+
ACE_Name_Proxy::~ACE_Name_Proxy (void)
{
ACE_TRACE ("ACE_Name_Proxy::~ACE_Name_Proxy");
this->peer_.close ();
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Name_Proxy.h b/dep/ACE_wrappers/ace/Name_Proxy.h
index f495dde52d2..24ca63a30af 100644
--- a/dep/ACE_wrappers/ace/Name_Proxy.h
+++ b/dep/ACE_wrappers/ace/Name_Proxy.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Name_Proxy.h
@@ -15,20 +16,26 @@
*/
//=============================================================================
+
#ifndef ACE_NAME_PROXY_H
#define ACE_NAME_PROXY_H
#include /**/ "ace/pre.h"
+
#include "ace/INET_Addr.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/SOCK_Connector.h"
#include "ace/SOCK_Stream.h"
#include "ace/Service_Config.h"
#include "ace/Synch_Options.h"
#include "ace/Name_Request_Reply.h"
#include "ace/Event_Handler.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Name_Proxy
*
@@ -43,38 +50,53 @@ class ACE_Export ACE_Name_Proxy : public ACE_Event_Handler
public:
/// Default constructor.
ACE_Name_Proxy (void);
+
// = Establish a binding with the ACE_Name Server.
ACE_Name_Proxy (const ACE_INET_Addr &remote_addr, // Address of ACE_Name Server.
ACE_Synch_Options& options =
ACE_Synch_Options::defaults);
+
int open (const ACE_INET_Addr &remote_addr, // Address of ACE_Name Server.
ACE_Synch_Options& options =
ACE_Synch_Options::defaults);
+
/// Perform the request and wait for the reply.
int request_reply (ACE_Name_Request &request);
+
/// Perform the request.
int send_request (ACE_Name_Request &request);
+
/// Receive the reply.
int recv_reply (ACE_Name_Request &reply);
+
/// Obtain underlying handle.
virtual ACE_HANDLE get_handle (void) const;
+
/// Close down the connection to the server.
virtual ~ACE_Name_Proxy (void);
+
/// Dump the state of the object;
void dump (void) const;
+
private:
+
/// ACE_Connector factory used to establish connections actively.
ACE_SOCK_Connector connector_;
+
/// Connection to ACE_Name Server peer.
ACE_SOCK_Stream peer_;
+
/// Pointer to ACE_Reactor (used if we are run in "reactive-mode").
ACE_Reactor *reactor_;
+
private:
// Prevent copying
ACE_Name_Proxy (const ACE_Name_Proxy &);
ACE_Name_Proxy &operator= (const ACE_Name_Proxy &);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
#endif /* ACE_NAME_PROXY_H */
diff --git a/dep/ACE_wrappers/ace/Name_Request_Reply.cpp b/dep/ACE_wrappers/ace/Name_Request_Reply.cpp
index 8b918850d50..ff160d8574a 100644
--- a/dep/ACE_wrappers/ace/Name_Request_Reply.cpp
+++ b/dep/ACE_wrappers/ace/Name_Request_Reply.cpp
@@ -6,16 +6,22 @@
#include "ace/Truncate.h"
#include "ace/OS_NS_string.h"
#include "ace/os_include/arpa/os_inet.h"
+
ACE_RCSID (ace,
Name_Request_Reply,
"$Id: Name_Request_Reply.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Default "do nothing" constructor.
+
ACE_Name_Request::ACE_Name_Request (void)
{
ACE_TRACE ("ACE_Name_Request::ACE_Name_Request");
}
+
// Create a ACE_Name_Request message.
+
ACE_Name_Request::ACE_Name_Request (
ACE_INT32 t, // Type of request.
const ACE_WCHAR_T name[], // Name
@@ -31,6 +37,7 @@ ACE_Name_Request::ACE_Name_Request (
this->name_len (name_length);
this->value_len (value_length);
this->type_len (type_length);
+
// If timeout is a NULL pointer, then block forever...
if (timeout == 0)
{
@@ -45,10 +52,12 @@ ACE_Name_Request::ACE_Name_Request (
this->transfer_.sec_timeout_ = timeout->sec ();
this->transfer_.usec_timeout_ = timeout->usec ();
}
+
// Set up pointers and copy name value and type into request.
this->name_ = this->transfer_.data_;
this->value_ = &this->name_[name_length / sizeof (ACE_WCHAR_T) ];
this->type_ = (char *)(&this->value_[value_length / sizeof (ACE_WCHAR_T)]); //
+
(void) ACE_OS::memcpy (this->name_,
name,
name_length);
@@ -58,98 +67,123 @@ ACE_Name_Request::ACE_Name_Request (
(void) ACE_OS::memcpy (this->type_,
type,
type_length);
+
// Compute size of the fixed portion of the message...
size_t len = sizeof this->transfer_ - sizeof this->transfer_.data_;
+
// ... then add in the amount of the variable-sized portion.
len += name_length + value_length + type_length ;
+
this->length (static_cast<ACE_UINT32> (len));
}
+
// Initialize length_ in order to avoid problems with byte-ordering.
+
void
ACE_Name_Request::init (void)
{
ACE_TRACE ("ACE_Name_Request::init");
this->length (sizeof this->transfer_);
}
+
// = Set/get the length of the encoded/decoded message.
+
ACE_UINT32
ACE_Name_Request::length (void) const
{
ACE_TRACE ("ACE_Name_Request::length");
return this->transfer_.length_;
}
+
void
ACE_Name_Request::length (ACE_UINT32 l)
{
ACE_TRACE ("ACE_Name_Request::length");
this->transfer_.length_ = l;
}
+
// = Set/get the type of the message.
+
ACE_INT32
ACE_Name_Request::msg_type (void) const
{
ACE_TRACE ("ACE_Name_Request::msg_type");
return this->transfer_.msg_type_;
}
+
void
ACE_Name_Request::msg_type (ACE_INT32 t)
{
ACE_TRACE ("ACE_Name_Request::msg_type");
this->transfer_.msg_type_ = t;
}
+
// = Set/get the len of the name
+
ACE_UINT32
ACE_Name_Request::name_len (void) const
{
ACE_TRACE ("ACE_Name_Request::name_len");
return this->transfer_.name_len_;
}
+
void
ACE_Name_Request::name_len (ACE_UINT32 t)
{
ACE_TRACE ("ACE_Name_Request::name_len");
this->transfer_.name_len_ = t;
}
+
// = Set/get the len of the value
+
ACE_UINT32
ACE_Name_Request::value_len (void) const
{
ACE_TRACE ("ACE_Name_Request::value_len");
return this->transfer_.value_len_;
}
+
void
ACE_Name_Request::value_len (ACE_UINT32 t)
{
ACE_TRACE ("ACE_Name_Request::value_len");
this->transfer_.value_len_ = t;
}
+
// = Set/get the len of the type
+
ACE_UINT32
ACE_Name_Request::type_len (void) const
{
ACE_TRACE ("ACE_Name_Request::type_len");
return this->transfer_.type_len_;
}
+
void
ACE_Name_Request::type_len (ACE_UINT32 t)
{
ACE_TRACE ("ACE_Name_Request::type_len");
this->transfer_.type_len_ = t;
}
+
// = Set/get the blocking semantics.
+
ACE_UINT32
ACE_Name_Request::block_forever (void) const
{
ACE_TRACE ("ACE_Name_Request::block_forever");
return this->transfer_.block_forever_;
}
+
void
ACE_Name_Request::block_forever (ACE_UINT32 bs)
{
ACE_TRACE ("ACE_Name_Request::block_forever");
this->transfer_.block_forever_ = bs;
}
+
// = Set/get the timeout.
+
ACE_Time_Value
ACE_Name_Request::timeout (void) const
{
@@ -157,6 +191,7 @@ ACE_Name_Request::timeout (void) const
time_t sec = ACE_Utils::truncate_cast<time_t> (this->transfer_.sec_timeout_);
return ACE_Time_Value (sec, this->transfer_.usec_timeout_);
}
+
void
ACE_Name_Request::timeout (const ACE_Time_Value timeout)
{
@@ -164,13 +199,16 @@ ACE_Name_Request::timeout (const ACE_Time_Value timeout)
this->transfer_.sec_timeout_ = timeout.sec ();
this->transfer_.usec_timeout_ = timeout.usec ();
}
+
// = Set/get the name
+
const ACE_WCHAR_T *
ACE_Name_Request::name (void) const
{
ACE_TRACE ("ACE_Name_Request::name");
return this->name_;
}
+
void
ACE_Name_Request::name (const ACE_WCHAR_T *t)
{
@@ -179,28 +217,35 @@ ACE_Name_Request::name (const ACE_WCHAR_T *t)
t,
this->name_len ());
}
+
// = Set/get the value
+
const ACE_WCHAR_T *
ACE_Name_Request::value (void) const
{
ACE_TRACE ("ACE_Name_Request::value");
return this->value_;
}
+
void
ACE_Name_Request::value (const ACE_WCHAR_T *c)
{
ACE_TRACE ("ACE_Name_Request::value");
+
(void) ACE_OS::memcpy (this->value_,
c,
this->value_len());
}
+
// = Set/get the type
+
const char *
ACE_Name_Request::type (void) const
{
ACE_TRACE ("ACE_Name_Request::type");
return this->type_;
}
+
void
ACE_Name_Request::type (const char *c)
{
@@ -209,20 +254,26 @@ ACE_Name_Request::type (const char *c)
c,
sizeof this->type_);
}
+
// Encode the transfer buffer into network byte order so that it can
// be sent to the server.
+
int
ACE_Name_Request::encode (void *&buf)
{
ACE_TRACE ("ACE_Name_Request::encode");
// Compute the length *before* doing the marshaling.
+
ACE_UINT32 len = this->length ();
+
size_t nv_data_len =
(this->transfer_.name_len_ + this->transfer_.value_len_)
/ sizeof (ACE_WCHAR_T);
+
for (size_t i = 0; i < nv_data_len; i++)
this->transfer_.data_[i] =
ACE_HTONS (this->transfer_.data_[i]);
+
buf = (void *) &this->transfer_;
this->transfer_.block_forever_ = ACE_HTONL (this->transfer_.block_forever_);
this->transfer_.usec_timeout_ = ACE_HTONL (this->transfer_.usec_timeout_);
@@ -235,10 +286,13 @@ ACE_Name_Request::encode (void *&buf)
this->transfer_.name_len_ = ACE_HTONL (this->transfer_.name_len_);
this->transfer_.value_len_ = ACE_HTONL (this->transfer_.value_len_);
this->transfer_.type_len_ = ACE_HTONL (this->transfer_.type_len_);
+
return len;
}
+
// Decode the transfer buffer into host byte byte order so that it can
// be used by the server.
+
int
ACE_Name_Request::decode (void)
{
@@ -255,20 +309,26 @@ ACE_Name_Request::decode (void)
this->transfer_.name_len_ = ACE_NTOHL (this->transfer_.name_len_);
this->transfer_.value_len_ = ACE_NTOHL (this->transfer_.value_len_);
this->transfer_.type_len_ = ACE_NTOHL (this->transfer_.type_len_);
+
size_t nv_data_len =
(this->transfer_.name_len_ + this->transfer_.value_len_)
/ sizeof (ACE_WCHAR_T);
+
for (size_t i = 0; i < nv_data_len; i++)
this->transfer_.data_[i] =
ACE_NTOHS (this->transfer_.data_[i]);
+
this->name_ = this->transfer_.data_;
this->value_ = &this->name_[this->transfer_.name_len_ / sizeof (ACE_WCHAR_T)];
this->type_ = (char *)(&this->value_[this->transfer_.value_len_ / sizeof (ACE_WCHAR_T)]);
this->type_[this->transfer_.type_len_] = '\0';
+
// Decode the variable-sized portion.
return 0;
}
+
// Print out the current values of the ACE_Name_Request.
+
void
ACE_Name_Request::dump (void) const
{
@@ -279,6 +339,7 @@ ACE_Name_Request::dump (void) const
this->length ()));
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("message-type = ")));
+
switch (this->msg_type ())
{
case ACE_Name_Request::BIND:
@@ -327,6 +388,7 @@ ACE_Name_Request::dump (void) const
this->msg_type ()));
break;
}
+
if (this->block_forever ())
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("blocking forever\n")));
@@ -346,20 +408,26 @@ ACE_Name_Request::dump (void) const
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("*******\nvalue_len = %d\n"),
this->value_len ()));
+
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("+++++++\n")));
#endif /* ACE_HAS_DUMP */
}
+
// Default constructor.
+
ACE_Name_Reply::ACE_Name_Reply (void)
{
ACE_TRACE ("ACE_Name_Reply::ACE_Name_Reply");
+
// Initialize to a known quantity.
this->msg_type (0);
this->errnum (0);
this->length (sizeof this->transfer_);
}
+
// Create a ACE_Name_Reply message.
+
ACE_Name_Reply::ACE_Name_Reply (ACE_UINT32 t, ACE_UINT32 err) // Type of reply.
{
ACE_TRACE ("ACE_Name_Reply::ACE_Name_Reply");
@@ -367,47 +435,59 @@ ACE_Name_Reply::ACE_Name_Reply (ACE_UINT32 t, ACE_UINT32 err) // Type of reply.
this->errnum (err);
this->length (sizeof this->transfer_);
}
+
// Initialize length_ to avoid problems with byte-ordering.
+
void
ACE_Name_Reply::init (void)
{
ACE_TRACE ("ACE_Name_Reply::init");
this->length (sizeof this->transfer_);
}
+
// = Set/get the length of the encoded/decoded message.
+
ACE_UINT32
ACE_Name_Reply::length (void) const
{
ACE_TRACE ("ACE_Name_Reply::length");
return this->transfer_.length_;
}
+
void
ACE_Name_Reply::length (ACE_UINT32 l)
{
ACE_TRACE ("ACE_Name_Reply::length");
this->transfer_.length_ = l;
}
+
// = Set/get the type of the message.
+
ACE_INT32
ACE_Name_Reply::msg_type (void) const
{
ACE_TRACE ("ACE_Name_Reply::msg_type");
return this->transfer_.type_;
}
+
void
ACE_Name_Reply::msg_type (ACE_INT32 t)
{
ACE_TRACE ("ACE_Name_Reply::msg_type");
this->transfer_.type_ = t;
}
+
// Get the status of the reply (0 == success, -1 == failure).
+
ACE_INT32
ACE_Name_Reply::status (void) const
{
ACE_TRACE ("ACE_Name_Reply::status");
return this->transfer_.type_;
}
+
// Set the status of the reply (0 == success, -1 == failure).
+
void
ACE_Name_Reply::status (ACE_INT32 s)
{
@@ -417,6 +497,7 @@ ACE_Name_Reply::status (ACE_INT32 s)
else
this->transfer_.type_ = 0;
}
+
// = Set/get the errno of a failed reply.
ACE_UINT32
ACE_Name_Reply::errnum (void) const
@@ -424,27 +505,33 @@ ACE_Name_Reply::errnum (void) const
ACE_TRACE ("ACE_Name_Reply::errnum");
return this->transfer_.errno_;
}
+
void
ACE_Name_Reply::errnum (ACE_UINT32 e)
{
ACE_TRACE ("ACE_Name_Reply::errnum");
this->transfer_.errno_ = e;
}
+
// Encode the transfer buffer into network byte order
// so that it can be sent to the client.
+
int
ACE_Name_Reply::encode (void *&buf)
{
ACE_TRACE ("ACE_Name_Reply::encode");
int len = this->length (); // Get length *before* marshaling.
+
this->transfer_.length_ = ACE_HTONL (this->transfer_.length_);
this->transfer_.type_ = ACE_HTONL (this->transfer_.type_);
this->transfer_.errno_ = ACE_HTONL (this->transfer_.errno_);
buf = (void *) &this->transfer_;
return len;
}
+
// Decode the transfer buffer into host byte order so that it can be
// used by the client.
+
int
ACE_Name_Reply::decode (void)
{
@@ -454,7 +541,9 @@ ACE_Name_Reply::decode (void)
this->transfer_.errno_ = ACE_NTOHL (this->transfer_.errno_);
return 0;
}
+
// Print out current values of the ACE_Name_Reply object.
+
void
ACE_Name_Reply::dump (void) const
{
@@ -484,5 +573,6 @@ ACE_Name_Reply::dump (void) const
}
#endif /* ACE_HAS_DUMP */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Name_Request_Reply.h b/dep/ACE_wrappers/ace/Name_Request_Reply.h
index 5309c183e34..2c32c4cf32c 100644
--- a/dep/ACE_wrappers/ace/Name_Request_Reply.h
+++ b/dep/ACE_wrappers/ace/Name_Request_Reply.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Name_Request_Reply.h
@@ -14,15 +15,22 @@
*/
//=============================================================================
+
#ifndef ACE_NAME_REQUEST_REPLY_H
#define ACE_NAME_REQUEST_REPLY_H
+
#include /**/ "ace/pre.h"
+
#include "ace/Basic_Types.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Time_Value;
+
/**
* @class ACE_Name_Request
*
@@ -49,16 +57,20 @@ public:
LIST_TYPE_ENTRIES = 026,
MAX_ENUM = 11,
MAX_LIST = 3,
+
// Mask for bitwise operation used for table lookup
/// Mask for lookup of operation
OP_TABLE_MASK = 07,
/// Mask for lookup of list_operation
LIST_OP_MASK = 030,
+
/// Class-specific constant values.
MAX_NAME_LENGTH = MAXPATHLEN + 1
};
+
/// Default constructor.
ACE_Name_Request (void);
+
/// Create a ACE_Name_Request message.
ACE_Name_Request (ACE_INT32 msg_type, // Type of request.
const ACE_WCHAR_T name[], //
@@ -68,82 +80,111 @@ public:
const char type[],
const ACE_UINT32 type_length,
ACE_Time_Value *timeout = 0); // Max time willing to wait for request.
+
/// Initialize length_ in order to ensure correct byte ordering
/// before a request is sent.
void init (void);
+
// = Set/get the length of the encoded/decoded message.
ACE_UINT32 length (void) const;
void length (ACE_UINT32);
+
// = Set/get the type of the message.
ACE_INT32 msg_type (void) const;
void msg_type (ACE_INT32);
+
// = Set/get the blocking semantics.
ACE_UINT32 block_forever (void) const;
void block_forever (ACE_UINT32);
+
// = Set/get the timeout.
ACE_Time_Value timeout (void) const;
void timeout (const ACE_Time_Value timeout);
+
// = Set/get the name
const ACE_WCHAR_T *name (void) const;
void name (const ACE_WCHAR_T *);
+
// = Set/get the value
const ACE_WCHAR_T *value (void) const;
void value (const ACE_WCHAR_T *);
+
// = Set/get the type
const char *type (void) const;
void type (const char *);
+
// = Set/get the len of name
ACE_UINT32 name_len (void) const;
void name_len (ACE_UINT32);
+
// = Set/get the len of value
ACE_UINT32 value_len (void) const;
void value_len (ACE_UINT32);
+
// = Set/get the len of type
ACE_UINT32 type_len (void) const;
void type_len (ACE_UINT32);
+
/// Encode the message before transmission.
int encode (void *&);
+
/// Decode message after reception.
int decode (void);
+
/// Print out the values of the message for debugging purposes.
void dump (void) const;
+
private:
// = The 5 fields in the <Transfer> struct are transmitted to the server.
// The remaining 2 fields are not tranferred -- they are used only on
// the server-side to simplify lookups.
+
struct Transfer
{
/// Length of entire request.
ACE_UINT32 length_;
+
/// Type of the request (i.e., <BIND>, <REBIND>, <RESOLVE>, and <UNBIND>).
ACE_UINT32 msg_type_;
+
/// Indicates if we should block forever. If 0, then <secTimeout_>
/// and <usecTimeout_> indicates how long we should wait.
ACE_UINT32 block_forever_;
+
/// Max seconds willing to wait for name if not blocking forever.
ACE_UINT64 sec_timeout_;
+
/// Max micro seconds to wait for name if not blocking forever.
ACE_UINT32 usec_timeout_;
+
/// Len of name in bytes
ACE_UINT32 name_len_;
+
/// Len of value in bytes
ACE_UINT32 value_len_;
+
/// Len of type in bytes
ACE_UINT32 type_len_;
+
/// The data portion contains the <name_>
/// followed by the <value_>
/// followed by the <type_>.
ACE_WCHAR_T data_[MAX_NAME_LENGTH + MAXPATHLEN + MAXPATHLEN + 2];
};
+
/// Transfer buffer.
Transfer transfer_;
+
/// Pointer to the beginning of the name in this->data_.
ACE_WCHAR_T *name_;
+
/// Pointer to the beginning of the value in this->data_;
ACE_WCHAR_T *value_;
+
/// Pointer to the beginning of the type in this->data_;
char *type_;
};
+
/**
* @class ACE_Name_Reply
*
@@ -160,48 +201,66 @@ public:
/// Class-specific constant values.
MAX_NAME_LENGTH = MAXPATHLEN + 1
};
+
/// Default constructor.
ACE_Name_Reply (void);
+
/// Create a <ACE_Name_Reply> message.
ACE_Name_Reply (ACE_UINT32 type, ACE_UINT32 err); // Type of reply.
+
/// Initialize length_ in order to ensure correct byte ordering
/// before a reply is sent.
void init (void);
+
// = Set/get the length of the encoded/decoded message.
ACE_UINT32 length (void) const;
void length (ACE_UINT32);
+
// = Set/get the type of the message.
ACE_INT32 msg_type (void) const;
void msg_type (ACE_INT32);
+
// = Set/get the status of the reply (0 == success, -1 == failure).
ACE_INT32 status (void) const;
void status (ACE_INT32);
+
// = Set/get the errno of a failed reply.
ACE_UINT32 errnum (void) const;
void errnum (ACE_UINT32);
+
/// Encode the message before transfer.
int encode (void *&);
+
/// Decode a message after reception.
int decode (void);
+
/// Print out the values of the message for debugging purposes.
void dump (void) const;
+
private:
// = The 3 fields in the <Transfer> struct are transmitted to the server.
+
struct Transfer
{
/// Length of entire reply.
ACE_UINT32 length_;
+
/// Type of the reply, i.e., success (0) or failure (-1).
ACE_INT32 type_;
+
/// Indicates why error occurred if <this->type_> == failure (-1).
/// Typical reasons include: @c ETIME (if the client timed out after
/// waiting for the name).
ACE_UINT32 errno_;
};
+
/// Transfer buffer.
Transfer transfer_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
+
#endif /* ACE_NAME_REQUEST_REPLY_H */
diff --git a/dep/ACE_wrappers/ace/Name_Space.cpp b/dep/ACE_wrappers/ace/Name_Space.cpp
index 6019d1a927b..724d3206c16 100644
--- a/dep/ACE_wrappers/ace/Name_Space.cpp
+++ b/dep/ACE_wrappers/ace/Name_Space.cpp
@@ -1,10 +1,14 @@
// Name_Space.cpp
// $Id: Name_Space.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Name_Space.h"
#include "ace/OS_NS_string.h"
#include "ace/OS_NS_stdlib.h"
+
ACE_RCSID(ace, Name_Space, "$Id: Name_Space.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_Name_Binding::ACE_Name_Binding (void)
: name_ (),
value_ (),
@@ -13,11 +17,13 @@ ACE_Name_Binding::ACE_Name_Binding (void)
ACE_TRACE ("ACE_Name_Binding::ACE_Name_Binding");
}
+
ACE_Name_Binding::~ACE_Name_Binding (void)
{
ACE_TRACE ("ACE_Name_Binding::~ACE_Name_Binding");
ACE_OS::free ((void *) this->type_);
}
+
ACE_Name_Binding::ACE_Name_Binding (const ACE_NS_WString &name,
const ACE_NS_WString &value,
const char *type)
@@ -27,6 +33,7 @@ ACE_Name_Binding::ACE_Name_Binding (const ACE_NS_WString &name,
{
ACE_TRACE ("ACE_Name_Binding::ACE_Name_Binding");
}
+
ACE_Name_Binding::ACE_Name_Binding (const ACE_Name_Binding &s)
: name_ (s.name_),
value_ (s.value_),
@@ -34,10 +41,12 @@ ACE_Name_Binding::ACE_Name_Binding (const ACE_Name_Binding &s)
{
ACE_TRACE ("ACE_Name_Binding::ACE_Name_Binding");
}
+
void
ACE_Name_Binding::operator = (const ACE_Name_Binding &s)
{
ACE_TRACE ("ACE_Name_Binding::operator =");
+
if (this != &s)
{
ACE_OS::free ((void *) this->type_);
@@ -46,6 +55,7 @@ ACE_Name_Binding::operator = (const ACE_Name_Binding &s)
this->type_ = ACE_OS::strdup (s.type_);
}
}
+
bool
ACE_Name_Binding::operator == (const ACE_Name_Binding &s) const
{
@@ -54,9 +64,11 @@ ACE_Name_Binding::operator == (const ACE_Name_Binding &s) const
&& this->value_ == s.value_
&& ACE_OS::strcmp (this->type_, s.type_) == 0;
}
+
ACE_Name_Space::~ACE_Name_Space (void)
{
ACE_TRACE ("ACE_Name_Space::~ACE_Name_Space");
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Name_Space.h b/dep/ACE_wrappers/ace/Name_Space.h
index 16b859dcc78..ccd4d4dbfe9 100644
--- a/dep/ACE_wrappers/ace/Name_Space.h
+++ b/dep/ACE_wrappers/ace/Name_Space.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file Name_Space.h
@@ -8,17 +9,25 @@
* @author Prashant Jain <pjain@cse.wustl.edu>
*/
//==========================================================================
+
#ifndef ACE_NAME_SPACE_H
#define ACE_NAME_SPACE_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/SString.h"
#include "ace/Unbounded_Set.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
typedef ACE_Unbounded_Set<ACE_NS_WString> ACE_WSTRING_SET;
+
/**
* @class ACE_Name_Binding
*
@@ -32,27 +41,38 @@ public:
ACE_Name_Binding (const ACE_NS_WString &n,
const ACE_NS_WString &v,
const char *t);
+
/// Default constructor.
ACE_Name_Binding (void);
+
/// Copy constructor.
ACE_Name_Binding (const ACE_Name_Binding &);
+
/// Assignment operator.
void operator= (const ACE_Name_Binding &);
+
/// Destructor.
~ACE_Name_Binding (void);
+
/// Test for equality.
bool operator == (const ACE_Name_Binding &s) const;
+
/// Name of the binding.
ACE_NS_WString name_;
+
/// Value of the binding.
ACE_NS_WString value_;
+
/// Type of the binding.
char *type_;
};
+
typedef ACE_Unbounded_Set<ACE_Name_Binding> ACE_BINDING_SET;
typedef ACE_Unbounded_Set_Iterator<ACE_Name_Binding> ACE_BINDING_ITERATOR;
+
typedef ACE_Unbounded_Set<ACE_NS_WString> ACE_PWSTRING_SET;
typedef ACE_Unbounded_Set_Iterator<ACE_NS_WString> ACE_PWSTRING_ITERATOR;
+
/**
* @class ACE_Name_Space
*
@@ -65,14 +85,17 @@ typedef ACE_Unbounded_Set_Iterator<ACE_NS_WString> ACE_PWSTRING_ITERATOR;
class ACE_Export ACE_Name_Space
{
public:
+
/// virtual destructor to ensure destructors of subclasses get
/// called.
virtual ~ACE_Name_Space (void);
+
/// Bind a new name to a naming context (Wide character strings).
virtual int bind (const ACE_NS_WString &name_in,
const ACE_NS_WString &value_in,
const char *type_in = "") = 0;
+
/**
* Overwrite the value or type of an existing name in a
* ACE_Name_Space or bind a new name to the context, if it didn't
@@ -81,26 +104,32 @@ public:
virtual int rebind (const ACE_NS_WString &name_in,
const ACE_NS_WString &value_in,
const char *type_in = "") = 0;
+
/// Delete a name from a ACE_Name_Space (Wide charcter strings
/// Interface).
virtual int unbind (const ACE_NS_WString &name_in) = 0;
+
/// Get value and type of a given name binding (Wide chars). The
/// caller is responsible for deleting both <value_out> and <type_out>!
virtual int resolve (const ACE_NS_WString &name_in,
ACE_NS_WString &value_out,
char *&type_out) = 0;
+
/// Get a set of names matching a specified pattern (wchars). Matching
/// means the names must begin with the pattern string.
virtual int list_names (ACE_WSTRING_SET &set_out,
const ACE_NS_WString &pattern_in) = 0;
+
/// Get a set of values matching a specified pattern (wchars). Matching
/// means the values must begin with the pattern string.
virtual int list_values (ACE_WSTRING_SET &set_out,
const ACE_NS_WString &pattern_in) = 0;
+
/// Get a set of types matching a specified pattern (wchars). Matching
/// means the types must begin with the pattern string.
virtual int list_types (ACE_WSTRING_SET &set_out,
const ACE_NS_WString &pattern_in) = 0;
+
/**
* Get a set of names matching a specified pattern (wchars). Matching
* means the names must begin with the pattern string. Returns the
@@ -108,6 +137,7 @@ public:
*/
virtual int list_name_entries (ACE_BINDING_SET &set,
const ACE_NS_WString &pattern) = 0;
+
/**
* Get a set of values matching a specified pattern (wchars). Matching
* means the values must begin with the pattern string. Returns the
@@ -115,6 +145,7 @@ public:
*/
virtual int list_value_entries (ACE_BINDING_SET &set,
const ACE_NS_WString &pattern) = 0;
+
/**
* Get a set of types matching a specified pattern (wchars). Matching
* means the types must begin with the pattern string. Returns the
@@ -122,10 +153,14 @@ public:
*/
virtual int list_type_entries (ACE_BINDING_SET &set,
const ACE_NS_WString &pattern) = 0;
+
/// Dump the state of the object
virtual void dump (void) const = 0;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
+
#endif /* ACE_NAME_SPACE_H */
diff --git a/dep/ACE_wrappers/ace/Naming_Context.cpp b/dep/ACE_wrappers/ace/Naming_Context.cpp
index 596f3bba301..424e0d95f7e 100644
--- a/dep/ACE_wrappers/ace/Naming_Context.cpp
+++ b/dep/ACE_wrappers/ace/Naming_Context.cpp
@@ -1,4 +1,5 @@
// $Id: Naming_Context.cpp 81286 2008-04-09 07:27:30Z johnnyw $
+
#include "ace/Get_Opt.h"
#include "ace/Naming_Context.h"
#include "ace/Remote_Name_Space.h"
@@ -12,32 +13,43 @@
# include "ace/OS_NS_strings.h"
# include "ace/Trace.h"
#endif /* ACE_HAS_TRACE */
+
ACE_RCSID(ace, Naming_Context, "$Id: Naming_Context.cpp 81286 2008-04-09 07:27:30Z johnnyw $")
+
#if !defined (__ACE_INLINE__)
#include "ace/Naming_Context.inl"
#endif /* __ACE_INLINE__ */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Make life easier later on...
+
typedef ACE_Local_Name_Space <ACE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex> LOCAL_NAME_SPACE;
typedef ACE_Local_Name_Space <ACE_LITE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex> LITE_LOCAL_NAME_SPACE;
+
// The ACE_Naming_Context static service object is now defined
// by the ACE_Object_Manager, in Object_Manager.cpp.
+
int
ACE_Naming_Context::info (ACE_TCHAR **strp,
size_t length) const
{
ACE_TRACE ("ACE_Naming_Context::info");
+
ACE_TCHAR buf[BUFSIZ];
+
ACE_OS::sprintf (buf,
ACE_TEXT ("%s\t#%s\n"),
ACE_TEXT ("ACE_Naming_Context"),
ACE_TEXT ("Proxy for making calls to a Name Server"));
+
if (*strp == 0 && (*strp = ACE_OS::strdup (buf)) == 0)
return -1;
else
ACE_OS::strsncpy (*strp, buf, length);
return static_cast<int> (ACE_OS::strlen (buf));
}
+
int
ACE_Naming_Context::local (void)
{
@@ -47,20 +59,25 @@ ACE_Naming_Context::local (void)
|| 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_,
(sizeof this->hostname_ / sizeof (ACE_TCHAR)));
+
this->netnameserver_host_ =
this->name_options_->nameserver_host ();
this->netnameserver_port_ =
this->name_options_->nameserver_port ();
+
// Perform factory operation to select appropriate type of
// Name_Space subclass.
+
#if (defined (ACE_WIN32) && defined (ACE_USES_WCHAR))
// This only works on Win32 platforms when ACE_USES_WCHAR is turned on
+
if (this->name_options_->use_registry ())
// Use ACE_Registry
ACE_NEW_RETURN (this->name_space_,
@@ -91,36 +108,46 @@ ACE_Naming_Context::open (Context_Scope_Type scope_in, int lite)
-1);
}
}
+
if (ACE_LOG_MSG->op_status () != 0 || this->name_space_ == 0)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("NAME_SPACE::NAME_SPACE\n")),
-1);
return 0;
}
+
int
ACE_Naming_Context::close_down (void)
{
ACE_TRACE ("ACE_Naming_Context::close_down");
+
delete this->name_options_;
this->name_options_ = 0;
+
return this->close ();
}
+
int
ACE_Naming_Context::close (void)
{
ACE_TRACE ("ACE_Naming_Context::close");
+
delete this->name_space_;
this->name_space_ = 0;
+
return 0;
}
+
ACE_Naming_Context::ACE_Naming_Context (void)
: name_options_ (0),
name_space_ (0)
{
ACE_TRACE ("ACE_Naming_Context::ACE_Naming_Context");
+
ACE_NEW (this->name_options_,
ACE_Name_Options);
}
+
ACE_Naming_Context::ACE_Naming_Context (Context_Scope_Type scope_in,
int lite)
: name_options_ (0),
@@ -128,19 +155,23 @@ ACE_Naming_Context::ACE_Naming_Context (Context_Scope_Type scope_in,
netnameserver_host_ (0)
{
ACE_TRACE ("ACE_Naming_Context::ACE_Naming_Context");
+
ACE_NEW (this->name_options_,
ACE_Name_Options);
+
// Initialize.
if (this->open (scope_in, lite) == -1)
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_Naming_Context::ACE_Naming_Context")));
}
+
ACE_Name_Options *
ACE_Naming_Context::name_options (void)
{
return this->name_options_;
}
+
int
ACE_Naming_Context::bind (const ACE_NS_WString &name_in,
const ACE_NS_WString &value_in,
@@ -149,6 +180,7 @@ ACE_Naming_Context::bind (const ACE_NS_WString &name_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,
@@ -159,6 +191,7 @@ ACE_Naming_Context::bind (const char *name_in,
ACE_NS_WString (value_in),
type_in);
}
+
int
ACE_Naming_Context::rebind (const ACE_NS_WString &name_in,
const ACE_NS_WString &value_in,
@@ -169,6 +202,7 @@ ACE_Naming_Context::rebind (const ACE_NS_WString &name_in,
value_in,
type_in);
}
+
int
ACE_Naming_Context::rebind (const char *name_in,
const char *value_in,
@@ -179,6 +213,7 @@ ACE_Naming_Context::rebind (const char *name_in,
ACE_NS_WString (value_in),
type_in);
}
+
int
ACE_Naming_Context::resolve (const ACE_NS_WString &name_in,
ACE_NS_WString &value_out,
@@ -189,6 +224,7 @@ ACE_Naming_Context::resolve (const ACE_NS_WString &name_in,
value_out,
type_out);
}
+
int
ACE_Naming_Context::resolve (const char *name_in,
ACE_NS_WString &value_out,
@@ -199,6 +235,7 @@ ACE_Naming_Context::resolve (const char *name_in,
value_out,
type_out);
}
+
int
ACE_Naming_Context::resolve (const char *name_in,
char *&value_out,
@@ -206,27 +243,33 @@ ACE_Naming_Context::resolve (const char *name_in,
{
ACE_TRACE ("ACE_Naming_Context::resolve");
ACE_NS_WString val_str;
+
if (this->resolve (ACE_NS_WString (name_in),
val_str,
type_out) == -1)
return -1;
+
// Note that <char_rep> *allocates* the memory! Thus, caller is
// responsible for deleting it!
value_out = val_str.char_rep ();
+
return value_out == 0 ? -1 : 0;
}
+
int
ACE_Naming_Context::unbind (const ACE_NS_WString &name_in)
{
ACE_TRACE ("ACE_Naming_Context::unbind");
return this->name_space_->unbind (name_in);
}
+
int
ACE_Naming_Context::unbind (const char *name_in)
{
ACE_TRACE ("ACE_Naming_Context::unbind");
return this->unbind (ACE_NS_WString (name_in));
}
+
int
ACE_Naming_Context::list_names (ACE_PWSTRING_SET &set_out,
const ACE_NS_WString &pattern_in)
@@ -235,6 +278,7 @@ ACE_Naming_Context::list_names (ACE_PWSTRING_SET &set_out,
return this->name_space_->list_names (set_out,
pattern_in);
}
+
int
ACE_Naming_Context::list_names (ACE_PWSTRING_SET &set_out,
const char *pattern_in)
@@ -243,6 +287,7 @@ ACE_Naming_Context::list_names (ACE_PWSTRING_SET &set_out,
return this->list_names (set_out,
ACE_NS_WString (pattern_in));
}
+
int
ACE_Naming_Context::list_values (ACE_PWSTRING_SET &set_out,
const ACE_NS_WString &pattern_in)
@@ -251,6 +296,7 @@ ACE_Naming_Context::list_values (ACE_PWSTRING_SET &set_out,
return this->name_space_->list_values (set_out,
pattern_in);
}
+
int
ACE_Naming_Context::list_values (ACE_PWSTRING_SET &set_out,
const char *pattern_in)
@@ -259,6 +305,7 @@ ACE_Naming_Context::list_values (ACE_PWSTRING_SET &set_out,
return this->list_values (set_out,
ACE_NS_WString (pattern_in));
}
+
int
ACE_Naming_Context::list_types (ACE_PWSTRING_SET &set_out,
const ACE_NS_WString &pattern_in)
@@ -267,6 +314,7 @@ ACE_Naming_Context::list_types (ACE_PWSTRING_SET &set_out,
return this->name_space_->list_types (set_out,
pattern_in);
}
+
int
ACE_Naming_Context::list_types (ACE_PWSTRING_SET &set_out,
const char *pattern_in)
@@ -275,6 +323,7 @@ ACE_Naming_Context::list_types (ACE_PWSTRING_SET &set_out,
return this->list_types (set_out,
ACE_NS_WString (pattern_in));
}
+
int
ACE_Naming_Context::list_name_entries (ACE_BINDING_SET &set_out,
const ACE_NS_WString &pattern_in)
@@ -283,6 +332,7 @@ ACE_Naming_Context::list_name_entries (ACE_BINDING_SET &set_out,
return this->name_space_->list_name_entries (set_out,
pattern_in);
}
+
int
ACE_Naming_Context::list_name_entries (ACE_BINDING_SET &set_out,
const char *pattern_in)
@@ -291,6 +341,7 @@ ACE_Naming_Context::list_name_entries (ACE_BINDING_SET &set_out,
return this->list_name_entries (set_out,
ACE_NS_WString (pattern_in));
}
+
int
ACE_Naming_Context::list_value_entries (ACE_BINDING_SET &set_out,
const ACE_NS_WString &pattern_in)
@@ -299,6 +350,7 @@ ACE_Naming_Context::list_value_entries (ACE_BINDING_SET &set_out,
return this->name_space_->list_value_entries (set_out,
pattern_in);
}
+
int
ACE_Naming_Context::list_value_entries (ACE_BINDING_SET &set_out,
const char *pattern_in)
@@ -307,6 +359,7 @@ ACE_Naming_Context::list_value_entries (ACE_BINDING_SET &set_out,
return this->list_value_entries (set_out,
ACE_NS_WString (pattern_in));
}
+
int
ACE_Naming_Context::list_type_entries (ACE_BINDING_SET &set_out,
const ACE_NS_WString &pattern_in)
@@ -315,6 +368,7 @@ ACE_Naming_Context::list_type_entries (ACE_BINDING_SET &set_out,
return this->name_space_->list_type_entries (set_out,
pattern_in);
}
+
int
ACE_Naming_Context::list_type_entries (ACE_BINDING_SET &set_out,
const char *pattern_in)
@@ -323,11 +377,14 @@ ACE_Naming_Context::list_type_entries (ACE_BINDING_SET &set_out,
return this->list_type_entries (set_out,
ACE_NS_WString (pattern_in));
}
+
ACE_Naming_Context::~ACE_Naming_Context (void)
{
ACE_TRACE ("ACE_Naming_Context::~ACE_Naming_Context");
+
this->close_down ();
}
+
void
ACE_Naming_Context::dump ()
{
@@ -336,6 +393,7 @@ ACE_Naming_Context::dump ()
this->name_space_->dump();
#endif /* ACE_HAS_DUMP */
}
+
int
ACE_Naming_Context::init (int argc, ACE_TCHAR *argv[])
{
@@ -345,6 +403,7 @@ ACE_Naming_Context::init (int argc, ACE_TCHAR *argv[])
this->name_options_->parse_args (argc, argv);
return this->open (this->name_options_->context ());
}
+
int
ACE_Naming_Context::fini (void)
{
@@ -354,6 +413,7 @@ ACE_Naming_Context::fini (void)
this->close_down ();
return 0;
}
+
ACE_Name_Options::ACE_Name_Options (void)
: debugging_ (0),
verbosity_ (0),
@@ -365,11 +425,13 @@ ACE_Name_Options::ACE_Name_Options (void)
base_address_ (ACE_DEFAULT_BASE_ADDR)
{
ACE_TRACE ("ACE_Name_Options::ACE_Name_Options");
+
#if defined (ACE_DEFAULT_NAMESPACE_DIR)
this->namespace_dir_ = ACE_OS::strdup (ACE_DEFAULT_NAMESPACE_DIR);
#else /* ACE_DEFAULT_NAMESPACE_DIR */
size_t pathsize = (MAXPATHLEN + 1) * sizeof (ACE_TCHAR);
this->namespace_dir_ = static_cast <ACE_TCHAR *> (ACE_OS::malloc (pathsize));
+
if (ACE::get_temp_dir (this->namespace_dir_, MAXPATHLEN) == -1)
{
ACE_ERROR ((LM_ERROR,
@@ -380,26 +442,31 @@ ACE_Name_Options::ACE_Name_Options (void)
}
#endif /* ACE_DEFAULT_NAMESPACE_DIR */
}
+
ACE_Name_Options::~ACE_Name_Options (void)
{
ACE_TRACE ("ACE_Name_Options::~ACE_Name_Options");
+
ACE_OS::free ((void *) this->nameserver_host_);
ACE_OS::free ((void *) this->namespace_dir_ );
ACE_OS::free ((void *) this->process_name_ );
ACE_OS::free ((void *) this->database_ );
}
+
void
ACE_Name_Options::nameserver_port (int port)
{
ACE_TRACE ("ACE_Name_Options::nameserver_port");
this->nameserver_port_ = port;
}
+
int
ACE_Name_Options::nameserver_port (void)
{
ACE_TRACE ("ACE_Name_Options::nameserver_port");
return this->nameserver_port_;
}
+
void
ACE_Name_Options::namespace_dir (const ACE_TCHAR *dir)
{
@@ -407,6 +474,7 @@ ACE_Name_Options::namespace_dir (const ACE_TCHAR *dir)
ACE_OS::free ((void *) this->namespace_dir_ );
this->namespace_dir_ = ACE_OS::strdup (dir);
}
+
void
ACE_Name_Options::process_name (const ACE_TCHAR *pname)
{
@@ -415,6 +483,7 @@ ACE_Name_Options::process_name (const ACE_TCHAR *pname)
ACE_OS::free ((void *) this->process_name_ );
this->process_name_ = ACE_OS::strdup (t);
}
+
void
ACE_Name_Options::nameserver_host (const ACE_TCHAR *host)
{
@@ -422,18 +491,21 @@ ACE_Name_Options::nameserver_host (const ACE_TCHAR *host)
ACE_OS::free ((void *) this->nameserver_host_);
this->nameserver_host_ = ACE_OS::strdup (host);
}
+
const ACE_TCHAR *
ACE_Name_Options::nameserver_host (void)
{
ACE_TRACE ("ACE_Name_Options::nameserver_host");
return this->nameserver_host_;
}
+
const ACE_TCHAR *
ACE_Name_Options::database (void)
{
ACE_TRACE ("ACE_Name_Options::database");
return this->database_;
}
+
void
ACE_Name_Options::database (const ACE_TCHAR *db)
{
@@ -441,47 +513,59 @@ ACE_Name_Options::database (const ACE_TCHAR *db)
ACE_OS::free ((void *) this->database_);
this->database_ = ACE_OS::strdup (db);
}
+
char *
ACE_Name_Options::base_address (void)
{
ACE_TRACE ("ACE_Name_Options::base_address");
return this->base_address_;
}
+
void
ACE_Name_Options::base_address (char *base_address)
{
ACE_TRACE ("ACE_Name_Options::base_address");
this->base_address_ = base_address;
}
+
ACE_Naming_Context::Context_Scope_Type
ACE_Name_Options::context (void)
{
ACE_TRACE ("ACE_Name_Options::context");
return this->context_;
}
+
void
ACE_Name_Options::context (ACE_Naming_Context::Context_Scope_Type context)
{
ACE_TRACE ("ACE_Name_Options::context");
this->context_ = context;
}
+
void
ACE_Name_Options::parse_args (int argc, ACE_TCHAR *argv[])
{
ACE_TRACE ("ACE_Name_Options::parse_args");
+
const ACE_TCHAR* program_name = 0;
+
// Argc can be 0 on some platforms like VxWorks.
if (argc > 0)
program_name = argv[0];
+
ACE_LOG_MSG->open (program_name);
this->process_name (program_name);
+
// Default is to use the PROC_LOCAL context...
this->context (ACE_Naming_Context::PROC_LOCAL);
+
// Make the database name the same as the process name by default
// (note that this makes a copy of the process_name_ so that we can
// clean it up in the destructor).
this->database (this->process_name ());
+
ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("b:c:dh:l:P:p:s:T:vr"));
+
for (int c; (c = get_opt ()) != -1; )
switch (c)
{
@@ -547,10 +631,13 @@ ACE_Name_Options::parse_args (int argc, ACE_TCHAR *argv[])
break;
}
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
// The following Factory is used by the ACE_Service_Config and
// svc.conf file to dynamically initialize the state of the Name
// Server client.
+
ACE_FACTORY_DEFINE (ACE, ACE_Naming_Context)
ACE_STATIC_SVC_DEFINE (ACE_Naming_Context,
ACE_TEXT ("ACE_Naming_Context"),
diff --git a/dep/ACE_wrappers/ace/Naming_Context.h b/dep/ACE_wrappers/ace/Naming_Context.h
index 36f7f93f56c..2ac80a74526 100644
--- a/dep/ACE_wrappers/ace/Naming_Context.h
+++ b/dep/ACE_wrappers/ace/Naming_Context.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file Naming_Context.h
@@ -10,20 +11,27 @@
* @author Prashant Jain <pjain@uci.edu>
*/
//==========================================================================
+
#ifndef ACE_NAMING_CONTEXT_H
#define ACE_NAMING_CONTEXT_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Service_Object.h"
#include "ace/Name_Space.h"
#include "ace/os_include/os_netdb.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward decl
class ACE_Name_Options;
class ACE_Static_Svc_Descriptor;
+
/**
* @class ACE_Naming_Context
*
@@ -56,9 +64,11 @@ public:
/// Name lookup is local to the (sub)network.
NET_LOCAL
};
+
// = Initialization and termination methods.
/// "Do-nothing" constructor.
ACE_Naming_Context (void);
+
/**
* Specifies the scope of this namespace, opens and memory-maps the
* associated file (if accessible) or contacts the dedicated name
@@ -67,6 +77,7 @@ public:
* ACE_Lite_MMap_Memory_Pool. By default we use ACE_MMap_Memory_Pool.
*/
ACE_Naming_Context (Context_Scope_Type scope_in, int light = 0);
+
/**
* Specifies the scope of this namespace, opens and memory-maps the
* associated file (if accessible) or contacts the dedicated name
@@ -76,32 +87,42 @@ public:
*/
int open (Context_Scope_Type scope_in = ACE_Naming_Context::PROC_LOCAL,
int light = 0);
+
/// Deletes the instance of Name Space. Must be called before
/// switching name spaces.
int close (void);
+
/// Release all resources. Gets called by destructor and fini.
int close_down (void);
+
/// destructor, do some cleanup :TBD: last dtor should "compress"
/// file
~ACE_Naming_Context (void);
+
// = Dynamic initialization hooks.
/// Initialize name options and naming context when dynamically
/// linked.
virtual int init (int argc, ACE_TCHAR *argv[]);
+
/// Close down the test when dynamically unlinked.
virtual int fini (void);
+
/// Returns information about this context.
virtual int info (ACE_TCHAR **strp, size_t length) const;
+
/// Returns the ACE_Name_Options associated with the Naming_Context
ACE_Name_Options *name_options (void);
+
/// Bind a new name to a naming context (Wide character strings).
int bind (const ACE_NS_WString &name_in,
const ACE_NS_WString &value_in,
const char *type_in = "");
+
/// Bind a new name to a naming context ( character strings).
int bind (const char *name_in,
const char *value_in,
const char *type_in = "");
+
/**
* Overwrite the value or type of an existing name in a
* ACE_Naming_Context or bind a new name to the context, if it
@@ -110,6 +131,7 @@ public:
int rebind (const ACE_NS_WString &name_in,
const ACE_NS_WString &value_in,
const char *type_in = "");
+
/**
* Overwrite the value or type of an existing name in a
* ACE_Naming_Context or bind a new name to the context, if it
@@ -118,17 +140,21 @@ public:
int rebind (const char *name_in,
const char *value_in,
const char *type_in = "");
+
/// Delete a name from a ACE_Naming_Context (Wide charcter strings
/// Interface).
int unbind (const ACE_NS_WString &name_in);
+
/// Delete a name from a ACE_Naming_Context (character strings
/// interface).
int unbind (const char *name_in);
+
/// Get value and type of a given name binding (Wide chars). The
/// caller is responsible for deleting both @a value_out> and @a type_out!
int resolve (const ACE_NS_WString &name_in,
ACE_NS_WString &value_out,
char *&type_out);
+
/**
* Get value and type of a given name binding (Wide chars output).
* The caller is responsible for deleting both @a value_out and
@@ -137,35 +163,43 @@ public:
int resolve (const char *name_in,
ACE_NS_WString &value_out,
char *&type_out);
+
/// Get value and type of a given name binding ( chars ). The caller
/// is responsible for deleting both @a value_out and @a type_out!
int resolve (const char *name_in,
char *&value_out,
char *&type_out);
+
/// Get a set of names matching a specified pattern (wchars). Matching
/// means the names must begin with the pattern string.
int list_names (ACE_PWSTRING_SET &set_out,
const ACE_NS_WString &pattern_in);
+
/// Get a set of names matching a specified pattern (chars). Matching
/// means the names must begin with the pattern string.
int list_names (ACE_PWSTRING_SET &set_out,
const char *pattern_in);
+
/// Get a set of values matching a specified pattern (wchars). Matching
/// means the values must begin with the pattern string.
int list_values (ACE_PWSTRING_SET &set_out,
const ACE_NS_WString &pattern_in);
+
/// Get a set of values matching a specified pattern (chars). Matching
/// means the values must begin with the pattern string.
int list_values (ACE_PWSTRING_SET &set_out,
const char *pattern_in);
+
/// Get a set of types matching a specified pattern (wchars). Matching
/// means the types must begin with the pattern string.
int list_types (ACE_PWSTRING_SET &set_out,
const ACE_NS_WString &pattern_in);
+
/// Get a set of types matching a specified pattern (chars). Matching
/// means the types must begin with the pattern string.
int list_types (ACE_PWSTRING_SET &set_out,
const char *pattern_in);
+
/**
* Get a set of names matching a specified pattern (wchars). Matching
* means the names must begin with the pattern string. Returns the
@@ -173,6 +207,7 @@ public:
*/
virtual int list_name_entries (ACE_BINDING_SET &set_out,
const ACE_NS_WString &pattern_in);
+
/**
* Get a set of names matching a specified pattern (wchars). Matching
* means the names must begin with the pattern string. Returns the
@@ -180,6 +215,7 @@ public:
*/
virtual int list_name_entries (ACE_BINDING_SET &set_out,
const char *pattern_in);
+
/**
* Get a set of values matching a specified pattern (wchars). Matching
* means the values must begin with the pattern string. Returns the
@@ -187,6 +223,7 @@ public:
*/
virtual int list_value_entries (ACE_BINDING_SET &set_out,
const ACE_NS_WString &pattern_in);
+
/**
* Get a set of values matching a specified pattern (wchars). Matching
* means the values must begin with the pattern string. Returns the
@@ -194,6 +231,7 @@ public:
*/
virtual int list_value_entries (ACE_BINDING_SET &set_out,
const char *pattern_in);
+
/**
* Get a set of types matching a specified pattern (wchars). Matching
* means the types must begin with the pattern string. Returns the
@@ -201,6 +239,7 @@ public:
*/
virtual int list_type_entries (ACE_BINDING_SET &set_out,
const ACE_NS_WString &pattern_in);
+
/**
* Get a set of types matching a specified pattern (wchars). Matching
* means the types must begin with the pattern string. Returns the
@@ -208,22 +247,31 @@ public:
*/
virtual int list_type_entries (ACE_BINDING_SET &set_out,
const char *pattern_in);
+
/// Dump the state of the object.
void dump (void);
+
private:
/// Keep track of the options such as database name etc per Naming Context
ACE_Name_Options *name_options_;
+
/// Name space (can be either local or remote) dynamically bound.
ACE_Name_Space *name_space_;
+
/// Holds the local hostname.
ACE_TCHAR hostname_[MAXHOSTNAMELEN + 1];
+
/// Holds name of net name server.
const ACE_TCHAR *netnameserver_host_;
+
/// Holds port number of the net name server.
int netnameserver_port_;
+
/// 1 if we're on the same local machine as the name server, else 0.
int local (void);
+
};
+
/**
* @class ACE_Name_Options
*
@@ -235,73 +283,106 @@ public:
// = Initialization and termination methods.
ACE_Name_Options (void);
~ACE_Name_Options (void);
+
/// Parse arguments.
void parse_args (int argc,
ACE_TCHAR *argv[]);
+
/// Set the port number
void nameserver_port (int port);
+
/// Get the port number
int nameserver_port (void);
+
/// Get the context
ACE_Naming_Context::Context_Scope_Type context (void);
+
/// Set the context
void context (ACE_Naming_Context::Context_Scope_Type);
+
/// Set the host name
void nameserver_host (const ACE_TCHAR *host);
+
/// Get the host name
const ACE_TCHAR *nameserver_host (void);
+
/// Set name space directory
void namespace_dir (const ACE_TCHAR *dir);
+
/// Get name space directory
const ACE_TCHAR *namespace_dir (void);
+
/// Set process name
void process_name (const ACE_TCHAR *dir);
+
/// Get process name
const ACE_TCHAR *process_name (void);
+
/// Set database name
void database (const ACE_TCHAR *);
+
/// Get database name
const ACE_TCHAR *database (void);
+
/// Set base address of the underlying allocator
void base_address (char *address);
+
/// Get base address of the underlying allocator
char *base_address (void);
+
/// Get use of registry in naming
bool use_registry (void) const;
+
/// Set use of registry in naming
void use_registry (bool x);
+
/// Return debug status
int debug (void);
+
/// Return verbose status
int verbose (void);
+
private:
/// Extra debugging info
int debugging_;
+
/// Extra verbose messages
int verbosity_;
+
/// Use Win32 Registry
bool use_registry_;
+
/// Port to connect to nameserver process.
int nameserver_port_;
+
/// Hostname of nameserver.
const ACE_TCHAR *nameserver_host_;
+
/// Directory to hold name_bindings.
ACE_TCHAR *namespace_dir_;
+
/// Name of this process.
const ACE_TCHAR *process_name_;
+
/// Name of the database that stores the name/value/type bindings.
const ACE_TCHAR *database_;
+
/// Base address of the underlying allocator
char *base_address_;
+
/// The context in which the naming database will be created.
ACE_Naming_Context::Context_Scope_Type context_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Naming_Context.inl"
#endif /* __ACE_INLINE__ */
+
ACE_FACTORY_DECLARE (ACE, ACE_Naming_Context)
ACE_STATIC_SVC_DECLARE_EXPORT (ACE, ACE_Naming_Context)
+
#include /**/ "ace/post.h"
#endif /* ACE_NAMING_CONTEXT_H */
diff --git a/dep/ACE_wrappers/ace/Naming_Context.inl b/dep/ACE_wrappers/ace/Naming_Context.inl
index d10350b94df..917ddce37f3 100644
--- a/dep/ACE_wrappers/ace/Naming_Context.inl
+++ b/dep/ACE_wrappers/ace/Naming_Context.inl
@@ -1,34 +1,40 @@
// $Id: Naming_Context.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_INLINE bool
ACE_Name_Options::use_registry (void) const
{
ACE_TRACE ("ACE_Name_Options::use_registry");
return this->use_registry_;
}
+
ACE_INLINE void
ACE_Name_Options::use_registry (bool x)
{
ACE_TRACE ("ACE_Name_Options::use_registry");
this->use_registry_ = x;
}
+
ACE_INLINE int
ACE_Name_Options::verbose (void)
{
ACE_TRACE ("ACE_Name_Options::verbose");
return this->verbosity_;
}
+
ACE_INLINE const ACE_TCHAR *
ACE_Name_Options::process_name (void)
{
ACE_TRACE ("ACE_Name_Options::process_name");
return this->process_name_;
}
+
ACE_INLINE const ACE_TCHAR *
ACE_Name_Options::namespace_dir (void)
{
ACE_TRACE ("ACE_Name_Options::namespace_dir");
return this->namespace_dir_;
}
+
ACE_INLINE int
ACE_Name_Options::debug (void)
{
diff --git a/dep/ACE_wrappers/ace/Netlink_Addr.cpp b/dep/ACE_wrappers/ace/Netlink_Addr.cpp
index 231996f8491..0f73345b9c5 100644
--- a/dep/ACE_wrappers/ace/Netlink_Addr.cpp
+++ b/dep/ACE_wrappers/ace/Netlink_Addr.cpp
@@ -1,4 +1,5 @@
// $Id: Netlink_Addr.cpp 80826 2008-03-04 14:51:23Z wotte $
+
//=============================================================================
/**
* @file Netlink_Addr.cpp
@@ -9,13 +10,19 @@
* @author Raz Ben Yehuda <raziebe@gmail.com>
*/
//=============================================================================
+
#include "ace/Netlink_Addr.h"
+
#ifdef ACE_HAS_NETLINK
+
#if !defined (__ACE_INLINE__)
#include "ace/Netlink_Addr.inl"
#endif /* __ACE_INLINE__ */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_Netlink_Addr)
+
int ACE_Netlink_Addr::set (const ACE_Netlink_Addr &sa)
{
ACE_OS::memset ((void *) &this->nl_,0,sizeof this->nl_);
@@ -23,31 +30,40 @@ int ACE_Netlink_Addr::set (const ACE_Netlink_Addr &sa)
this->base_set (sa.get_type (), sa.get_size ());
return 0;
}
+
// Copy constructor.
+
ACE_Netlink_Addr::ACE_Netlink_Addr (const ACE_Netlink_Addr &sa)
: ACE_Addr (AF_NETLINK, sa.get_size ())
{
this->set (sa);
}
+
int ACE_Netlink_Addr::set (const sockaddr_nl *un, int len)
{
(void) ACE_OS::memcpy ((void *) &this->nl_,un,len);
return 0;
}
+
ACE_Netlink_Addr::ACE_Netlink_Addr (const sockaddr_nl *un, int len)
{
this->set (un, len);
}
+
int
ACE_Netlink_Addr::get_pid (void) const
{
return this->nl_.nl_pid;
}
+
int
ACE_Netlink_Addr::get_gid (void) const
{
return this->nl_.nl_groups;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif
+
diff --git a/dep/ACE_wrappers/ace/Netlink_Addr.h b/dep/ACE_wrappers/ace/Netlink_Addr.h
index 6f71a419c08..cd1c20fd474 100644
--- a/dep/ACE_wrappers/ace/Netlink_Addr.h
+++ b/dep/ACE_wrappers/ace/Netlink_Addr.h
@@ -1,4 +1,5 @@
// $Id: Netlink_Addr.h 80826 2008-03-04 14:51:23Z wotte $
+
//=============================================================================
/**
* @file Netlink_Addr.h
@@ -9,21 +10,29 @@
* @author Raz Ben Yehuda <raziebe@gmail.com>
*/
//=============================================================================
+
#ifndef ACE_NETLINK_ADDR_H
#define ACE_NETLINK_ADDR_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
#pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#ifdef ACE_HAS_NETLINK
+
#include "ace/OS_NS_string.h"
#include "ace/Global_Macros.h"
#include "ace/OS_NS_unistd.h"
#include "ace/OS_NS_unistd.h"
#include "ace/Addr.h"
#include "ace/os_include/sys/os_socket.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Netlink_Addr
*
@@ -32,14 +41,19 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
class ACE_Export ACE_Netlink_Addr : public ACE_Addr {
public:
// = Initialization methods.
+
/// Default constructor.
ACE_Netlink_Addr (void);
+
/// Copy constructor.
ACE_Netlink_Addr (const ACE_Netlink_Addr &);
+
/// Creates an ACE_INET_Addr from a sockaddr_in structure.
ACE_Netlink_Addr (const sockaddr_nl *, int len);
+
/// Dtor
~ACE_Netlink_Addr (void);
+
/**
* @param naddr sets the nl_ member @see nl_
*/
@@ -72,8 +86,10 @@ public:
* Set a pointer to the address
*/
virtual void set_addr (void *, int len= sizeof(sockaddr_nl) );
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/**
* @return family type AF_NETLINK
@@ -84,14 +100,22 @@ private:
* set nl_ @see nl_ to zero and sets address family to default value
*/
void reset (void);
+
sockaddr_nl nl_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Netlink_Addr.inl"
#endif /* __ACE_INLINE__ */
+
#endif /* ACE_HAS_NETLINK */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_NETLINK_ADDR_H */
+
+
diff --git a/dep/ACE_wrappers/ace/Netlink_Addr.inl b/dep/ACE_wrappers/ace/Netlink_Addr.inl
index 2f970f9baa9..4ec38fa4a28 100644
--- a/dep/ACE_wrappers/ace/Netlink_Addr.inl
+++ b/dep/ACE_wrappers/ace/Netlink_Addr.inl
@@ -1,39 +1,51 @@
// -*- C++ -*-
// $Id: Netlink_Addr.inl 80826 2008-03-04 14:51:23Z wotte $
+
#ifdef ACE_HAS_NETLINK
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE ACE_Netlink_Addr::~ACE_Netlink_Addr (void){}
+
ACE_INLINE ACE_Netlink_Addr::ACE_Netlink_Addr (void):
ACE_Addr (this->determine_type(), sizeof (sockaddr_nl))
{
this->nl_.nl_family = AF_NETLINK;
}
+
ACE_INLINE void ACE_Netlink_Addr::set(int pid, int gid)
{
this->nl_.nl_pid = pid;
this->nl_.nl_groups = gid;
}
+
ACE_INLINE void ACE_Netlink_Addr::reset (void)
{
ACE_OS::memset (&this->nl_, 0, sizeof (this->nl_));
this->nl_.nl_family = AF_NETLINK;
}
+
ACE_INLINE int ACE_Netlink_Addr::determine_type (void) const
{
return AF_NETLINK;
}
+
ACE_INLINE void *ACE_Netlink_Addr::get_addr (void) const
{
return (void*)&(this->nl_);
}
+
ACE_INLINE int ACE_Netlink_Addr::get_addr_size (void) const
{
return sizeof(this->nl_);
}
+
ACE_INLINE void ACE_Netlink_Addr::set_addr (void *addr, int len){
ACE_OS::memcpy (&this->nl_,addr,len);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_NETLINK */
diff --git a/dep/ACE_wrappers/ace/Node.h b/dep/ACE_wrappers/ace/Node.h
index db4d7eaf27e..bf47b15915b 100644
--- a/dep/ACE_wrappers/ace/Node.h
+++ b/dep/ACE_wrappers/ace/Node.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Node.h
@@ -9,14 +10,19 @@
*/
//=============================================================================
+
#ifndef ACE_NODE_H
#define ACE_NODE_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward declarations.
template <class T, class C> class ACE_Unbounded_Set_Ex;
template <class T, class C> class ACE_Unbounded_Set_Ex_Iterator;
@@ -26,6 +32,7 @@ template <class T> class ACE_Unbounded_Queue_Iterator;
template <class T> class ACE_Unbounded_Queue_Const_Iterator;
template <class T> class ACE_Unbounded_Stack;
template <class T> class ACE_Unbounded_Stack_Iterator;
+
/**
* @class ACE_Node
*
@@ -43,8 +50,10 @@ public:
friend class ACE_Unbounded_Set_Ex_Const_Iterator<T, C>;
friend class ACE_Unbounded_Stack<T>;
friend class ACE_Unbounded_Stack_Iterator<T>;
+
/// This isn't necessary, but it keeps some compilers happy.
~ACE_Node (void);
+
private:
// = Initialization methods
ACE_Node (const T &i, ACE_Node<T, C> *n);
@@ -53,19 +62,25 @@ private:
private:
/// Not possible
void operator= (const ACE_Node<T, C> &);
+
private:
/// Pointer to next element in the list of ACE_Nodes.
ACE_Node<T, C> *next_;
+
/// Current value of the item in this node.
T item_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Node.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Node.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
#endif /* ACE_NODE_H */
diff --git a/dep/ACE_wrappers/ace/Notification_Queue.cpp b/dep/ACE_wrappers/ace/Notification_Queue.cpp
index 03832a9e3ab..1faada20c59 100644
--- a/dep/ACE_wrappers/ace/Notification_Queue.cpp
+++ b/dep/ACE_wrappers/ace/Notification_Queue.cpp
@@ -1,10 +1,15 @@
// $Id: Notification_Queue.cpp 81315 2008-04-10 07:14:15Z johnnyw $
+
#include "ace/Notification_Queue.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Notification_Queue.inl"
#endif /* __ACE_INLINE__ */
+
#include "ace/Guard_T.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_Notification_Queue::
ACE_Notification_Queue()
: ACE_Copy_Disabled()
@@ -13,26 +18,33 @@ ACE_Notification_Queue()
, free_queue_()
{
}
+
ACE_Notification_Queue::
~ACE_Notification_Queue()
{
reset();
}
+
int
ACE_Notification_Queue::
open()
{
ACE_TRACE ("ACE_Notification_Queue::open");
+
ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, mon, this->notify_queue_lock_, -1);
+
if (!this->free_queue_.is_empty ())
return 0;
+
return allocate_more_buffers();
}
+
void
ACE_Notification_Queue::
reset()
{
ACE_TRACE ("ACE_Notification_Queue::reset");
+
// Release all the event handlers still in the queue ...
for (ACE_Notification_Queue_Node * node = notify_queue_.head();
node != 0;
@@ -44,6 +56,7 @@ reset()
}
(void) node->get().eh_->remove_reference();
}
+
// ... free up the dynamically allocated resources ...
ACE_Notification_Queue_Node **b = 0;
for (ACE_Unbounded_Queue_Iterator<ACE_Notification_Queue_Node *> alloc_iter (this->alloc_queue_);
@@ -53,40 +66,52 @@ reset()
delete [] *b;
*b = 0;
}
+
// ... cleanup the list of allocated blocks ...
this->alloc_queue_.reset ();
+
// ... swap with empty lists to reset the contents ...
Buffer_List().swap(notify_queue_);
Buffer_List().swap(free_queue_);
}
+
int ACE_Notification_Queue::
allocate_more_buffers()
{
ACE_TRACE ("ACE_Notification_Queue::allocate_more_buffers");
+
ACE_Notification_Queue_Node *temp = 0;
+
ACE_NEW_RETURN (temp,
ACE_Notification_Queue_Node[ACE_REACTOR_NOTIFICATION_ARRAY_SIZE],
-1);
+
if (this->alloc_queue_.enqueue_head (temp) == -1)
{
delete [] temp;
return -1;
}
+
for (size_t i = 0; i < ACE_REACTOR_NOTIFICATION_ARRAY_SIZE; ++i)
{
free_queue_.push_front(temp + i);
}
+
return 0;
}
+
int
ACE_Notification_Queue::
purge_pending_notifications(ACE_Event_Handler * eh,
ACE_Reactor_Mask mask)
{
ACE_TRACE ("ACE_Notification_Queue::purge_pending_notifications");
+
ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, mon, this->notify_queue_lock_, -1);
+
if (this->notify_queue_.is_empty ())
return 0;
+
int number_purged = 0;
ACE_Notification_Queue_Node * node = notify_queue_.head();
while(node != 0)
@@ -97,6 +122,7 @@ purge_pending_notifications(ACE_Event_Handler * eh,
node = node->next();
continue;
}
+
if (!node->mask_disables_all_notifications(mask))
{
// ... another easy case, skip this node too, but clear the
@@ -105,33 +131,44 @@ purge_pending_notifications(ACE_Event_Handler * eh,
node = node->next();
continue;
}
+
// ... this is the more complicated case, we want to remove the
// node from the notify_queue_ list. First save the next node
// on the list:
ACE_Notification_Queue_Node * next = node->next();
+
// ... then remove it ...
notify_queue_.unsafe_remove(node);
++number_purged;
+
// ... release resources ...
ACE_Event_Handler *event_handler = node->get().eh_;
event_handler->remove_reference ();
+
// ... now this is a free node ...
free_queue_.push_front(node);
+
// ... go to the next node, if there is one ...
node = next;
}
+
return number_purged;
}
+
int ACE_Notification_Queue::
push_new_notification(
ACE_Notification_Buffer const & buffer)
{
ACE_TRACE ("ACE_Notification_Queue::push_new_notification");
+
bool notification_required = false;
+
ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, mon, this->notify_queue_lock_, -1);
+
// No pending notifications.
if (this->notify_queue_.is_empty ())
notification_required = true;
+
if (free_queue_.is_empty())
{
if (allocate_more_buffers() == -1)
@@ -139,17 +176,23 @@ push_new_notification(
return -1;
}
}
+
ACE_Notification_Queue_Node * node =
free_queue_.pop_front();
+
ACE_ASSERT (node != 0);
node->set(buffer);
+
notify_queue_.push_back(node);
+
if (!notification_required)
{
return 0;
}
+
return 1;
}
+
int
ACE_Notification_Queue::pop_next_notification(
ACE_Notification_Buffer & current,
@@ -157,22 +200,30 @@ ACE_Notification_Queue::pop_next_notification(
ACE_Notification_Buffer & next)
{
ACE_TRACE ("ACE_Notification_Queue::pop_next_notification");
+
more_messages_queued = false;
+
ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, mon, this->notify_queue_lock_, -1);
+
if (notify_queue_.is_empty ())
{
return 0;
}
+
ACE_Notification_Queue_Node * node =
notify_queue_.pop_front();
+
current = node->get();
free_queue_.push_front(node);
+
if(!this->notify_queue_.is_empty())
{
more_messages_queued = true;
next = notify_queue_.head()->get();
}
+
return 1;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Notification_Queue.h b/dep/ACE_wrappers/ace/Notification_Queue.h
index 0178f689d33..b2ed768fd7a 100644
--- a/dep/ACE_wrappers/ace/Notification_Queue.h
+++ b/dep/ACE_wrappers/ace/Notification_Queue.h
@@ -1,6 +1,8 @@
#ifndef ACE_NOTIFICATION_QUEUE_H
#define ACE_NOTIFICATION_QUEUE_H
+
#include /**/ "ace/pre.h"
+
/**
* @file Notification_Queue.h
*
@@ -13,7 +15,9 @@
#include "ace/Intrusive_List.h"
#include "ace/Intrusive_List_Node.h"
#include "ace/Unbounded_Queue.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Notification_Queue_Node
*
@@ -27,30 +31,37 @@ public:
* @brief Constructor
*/
ACE_Notification_Queue_Node();
+
/**
* @brief Modifier change the contained buffer
*/
void set(ACE_Notification_Buffer const & rhs);
+
/**
* @brief Accessor, fetch the contained buffer
*/
ACE_Notification_Buffer const & get() const;
+
/**
* @brief Checks if the event handler matches the purge condition
*/
bool matches_for_purging(ACE_Event_Handler * eh) const;
+
/**
* @brief Return true if clearing the mask would leave no
* notifications to deliver.
*/
bool mask_disables_all_notifications(ACE_Reactor_Mask mask);
+
/**
* @brief Clear the notifications specified by @c mask
*/
void clear_mask(ACE_Reactor_Mask mask);
+
private:
ACE_Notification_Buffer contents_;
};
+
/**
* @class ACE_Notification_Queue
*
@@ -71,14 +82,17 @@ class ACE_Export ACE_Notification_Queue : private ACE_Copy_Disabled
public:
ACE_Notification_Queue();
~ACE_Notification_Queue();
+
/**
* @brief Pre-allocate resources in the queue
*/
int open();
+
/**
* @brief Release all resources in the queue
*/
void reset();
+
/**
* @brief Remove all elements in the queue matching @c eh and @c mask
*
@@ -87,6 +101,7 @@ public:
*/
int purge_pending_notifications(ACE_Event_Handler * eh,
ACE_Reactor_Mask mask);
+
/**
* @brief Add a new notification to the queue
*
@@ -94,6 +109,7 @@ public:
* the pipe and 0 otherwise.
*/
int push_new_notification(ACE_Notification_Buffer const & buffer);
+
/**
* @brief Extract the next notification from the queue
*
@@ -103,29 +119,39 @@ public:
ACE_Notification_Buffer & current,
bool & more_messages_queued,
ACE_Notification_Buffer & next);
+
private:
/**
* @brief Allocate more memory for the queue
*/
int allocate_more_buffers();
+
private:
/// Keeps track of allocated arrays of type
/// ACE_Notification_Buffer. The idea is to amortize allocation
/// costs by allocating multiple ACE_Notification_Buffer objects at
/// a time.
ACE_Unbounded_Queue <ACE_Notification_Queue_Node*> alloc_queue_;
+
typedef ACE_Intrusive_List<ACE_Notification_Queue_Node> Buffer_List;
+
/// Keeps track of all pending notifications.
Buffer_List notify_queue_;
+
/// Keeps track of all free buffers.
Buffer_List free_queue_;
+
/// Synchronization for handling of queues.
ACE_SYNCH_MUTEX notify_queue_lock_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Notification_Queue.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_NOTIFICATION_QUEUE_H */
diff --git a/dep/ACE_wrappers/ace/Notification_Queue.inl b/dep/ACE_wrappers/ace/Notification_Queue.inl
index 094ce9caa31..d3579d272cf 100644
--- a/dep/ACE_wrappers/ace/Notification_Queue.inl
+++ b/dep/ACE_wrappers/ace/Notification_Queue.inl
@@ -1,29 +1,35 @@
// $Id: Notification_Queue.inl 81315 2008-04-10 07:14:15Z johnnyw $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE ACE_Notification_Queue_Node::
ACE_Notification_Queue_Node()
: ACE_Intrusive_List_Node<ACE_Notification_Queue_Node>()
, contents_(0, 0)
{
}
+
ACE_INLINE void
ACE_Notification_Queue_Node::
set(ACE_Notification_Buffer const & rhs)
{
contents_ = rhs;
}
+
ACE_INLINE ACE_Notification_Buffer const &
ACE_Notification_Queue_Node::
get() const
{
return contents_;
}
+
ACE_INLINE bool
ACE_Notification_Queue_Node::
matches_for_purging(ACE_Event_Handler * eh) const
{
return (0 != get().eh_) && (0 == eh || eh == get().eh_);
}
+
ACE_INLINE bool
ACE_Notification_Queue_Node::
mask_disables_all_notifications(ACE_Reactor_Mask mask)
@@ -32,11 +38,13 @@ mask_disables_all_notifications(ACE_Reactor_Mask mask)
// the mask
return ACE_BIT_DISABLED (get().mask_, ~mask);
}
+
ACE_INLINE void
ACE_Notification_Queue_Node::
clear_mask(ACE_Reactor_Mask mask)
{
ACE_CLR_BITS(contents_.mask_, mask);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Notification_Strategy.cpp b/dep/ACE_wrappers/ace/Notification_Strategy.cpp
index 7897acbaa8a..4ffdda52097 100644
--- a/dep/ACE_wrappers/ace/Notification_Strategy.cpp
+++ b/dep/ACE_wrappers/ace/Notification_Strategy.cpp
@@ -1,17 +1,23 @@
#include "ace/Notification_Strategy.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Notification_Strategy.inl"
#endif /* __ACE_INLINE __ */
+
ACE_RCSID(ace, Strategies, "$Id: Notification_Strategy.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_Notification_Strategy::ACE_Notification_Strategy (ACE_Event_Handler *eh,
ACE_Reactor_Mask mask)
: eh_ (eh),
mask_ (mask)
{
}
+
ACE_Notification_Strategy::~ACE_Notification_Strategy (void)
{
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Notification_Strategy.h b/dep/ACE_wrappers/ace/Notification_Strategy.h
index 65f06bb6d08..7467ca06f4b 100644
--- a/dep/ACE_wrappers/ace/Notification_Strategy.h
+++ b/dep/ACE_wrappers/ace/Notification_Strategy.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Notification_Strategy.h
@@ -11,13 +12,18 @@
#ifndef ACE_NOTIFICATION_STRATEGY_H
#define ACE_NOTIFICATION_STRATEGY_H
#include /**/ "ace/pre.h"
+
#include "ace/Event_Handler.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward decls.
class ACE_Reactor;
+
/**
* @class ACE_Notification_Strategy
*
@@ -32,28 +38,39 @@ class ACE_Export ACE_Notification_Strategy
public:
/// Constructor.
ACE_Notification_Strategy (ACE_Event_Handler *eh, ACE_Reactor_Mask mask);
+
/// Destructor.
virtual ~ACE_Notification_Strategy (void);
+
virtual int notify (void) = 0;
virtual int notify (ACE_Event_Handler *, ACE_Reactor_Mask mask) = 0;
+
/// Get the event handler.
ACE_Event_Handler *event_handler (void);
+
/// Set the event handler.
void event_handler (ACE_Event_Handler *eh);
+
/// Get the reactor mask.
ACE_Reactor_Mask mask (void) const;
+
/// Set the reactor mask.
void mask (ACE_Reactor_Mask m);
+
protected:
/// The event handler.
ACE_Event_Handler *eh_;
+
/// The reactor mask.
ACE_Reactor_Mask mask_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Notification_Strategy.inl"
#endif /* __ACE_INLINE __ */
+
#include /**/ "ace/post.h"
#endif /*ACE_NOTIFICATION_STRATEGY_H */
diff --git a/dep/ACE_wrappers/ace/Notification_Strategy.inl b/dep/ACE_wrappers/ace/Notification_Strategy.inl
index 7ed63b08420..e1a309bcb35 100644
--- a/dep/ACE_wrappers/ace/Notification_Strategy.inl
+++ b/dep/ACE_wrappers/ace/Notification_Strategy.inl
@@ -1,25 +1,31 @@
// -*- C++ -*-
//
//$Id: Notification_Strategy.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE ACE_Event_Handler *
ACE_Notification_Strategy::event_handler (void)
{
return eh_;
}
+
ACE_INLINE void
ACE_Notification_Strategy::event_handler (ACE_Event_Handler *eh)
{
this->eh_ = eh;
}
+
ACE_INLINE ACE_Reactor_Mask
ACE_Notification_Strategy::mask (void) const
{
return mask_;
}
+
ACE_INLINE void
ACE_Notification_Strategy::mask (ACE_Reactor_Mask m)
{
this->mask_ = m;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Null_Barrier.h b/dep/ACE_wrappers/ace/Null_Barrier.h
index 651468bae01..64e3516d2a6 100644
--- a/dep/ACE_wrappers/ace/Null_Barrier.h
+++ b/dep/ACE_wrappers/ace/Null_Barrier.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file Null_Barrier.h
@@ -10,12 +11,16 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//==========================================================================
+
#ifndef ACE_NULL_BARRIER_H
#define ACE_NULL_BARRIER_H
#include /**/ "ace/pre.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// All methods in this class are inline, so there is no
// need to import or export on Windows. -- CAE 12/18/2003
+
/**
* @class ACE_Null_Barrier
*
@@ -28,21 +33,28 @@ public:
ACE_Null_Barrier (unsigned int,
const char * = 0,
void * = 0) {};
+
/// Default dtor.
~ACE_Null_Barrier (void) {};
+
/// Block the caller until all <count> threads have called <wait> and
/// then allow all the caller threads to continue in parallel.
int wait (void) { return 0; };
+
/// Dump the state of an object.
void dump (void) const {};
+
/// Declare the dynamic allocation hooks.
//ACE_ALLOC_HOOK_DECLARE;
+
private:
// = Prevent assignment and initialization.
void operator= (const ACE_Null_Barrier &);
ACE_Null_Barrier (const ACE_Null_Barrier &);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
#endif /* ACE_NULL_BARRIER_H */
diff --git a/dep/ACE_wrappers/ace/Null_Condition.h b/dep/ACE_wrappers/ace/Null_Condition.h
index bdef2bbfc9f..c693b0a69eb 100644
--- a/dep/ACE_wrappers/ace/Null_Condition.h
+++ b/dep/ACE_wrappers/ace/Null_Condition.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file Null_Condition.h
@@ -10,18 +11,25 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//==========================================================================
+
#ifndef ACE_NULL_CONDITION_H
#define ACE_NULL_CONDITION_H
#include /**/ "ace/pre.h"
+
// All methods in this class are inline, so there is no
// need to import or export on Windows. -- CAE 12/18/2003
#include "ace/Null_Mutex.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/os_errno.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Time_Value;
+
/**
* @class ACE_Null_Condition
*
@@ -36,31 +44,43 @@ public:
const ACE_TCHAR * = 0,
void * = 0)
: mutex_ ((ACE_Null_Mutex &) m) {}
+
~ACE_Null_Condition (void) {}
+
/// Returns 0.
int remove (void) {return 0;}
+
/// Returns -1 with @c errno == @c ETIME.
int wait (const ACE_Time_Value * = 0) {errno = ETIME; return -1;}
+
/// Returns -1 with @c errno == @c ETIME.
int wait (ACE_Null_Mutex &,
const ACE_Time_Value * = 0) {errno = ETIME; return -1;}
+
/// Returns 0.
int signal (void) {return 0;}
+
/// Returns 0.
int broadcast (void) {return 0;}
ACE_Null_Mutex &mutex (void) {return this->mutex_;};
+
/// Dump the state of an object.
void dump (void) const {}
+
// ACE_ALLOC_HOOK_DECLARE;
// Declare the dynamic allocation hooks.
+
protected:
ACE_Null_Mutex &mutex_; // Reference to mutex lock.
+
private:
// = Prevent assignment and initialization.
void operator= (const ACE_Null_Condition &);
ACE_Null_Condition (const ACE_Null_Condition &);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
#endif /* ACE_NULL_CONDITION_H */
diff --git a/dep/ACE_wrappers/ace/Null_Mutex.h b/dep/ACE_wrappers/ace/Null_Mutex.h
index ed818c163f0..5bfbea7e23b 100644
--- a/dep/ACE_wrappers/ace/Null_Mutex.h
+++ b/dep/ACE_wrappers/ace/Null_Mutex.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file Null_Mutex.h
@@ -10,23 +11,31 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//==========================================================================
+
#ifndef ACE_NULL_MUTEX_H
#define ACE_NULL_MUTEX_H
#include /**/ "ace/pre.h"
+
// All methods in this class are inline, so there is no
// need to import or export on Windows. -- CAE 12/18/2003
// Update... leaving off the ACE_Export causes compile warnings in some
// cases with Microsoft Visual Studio .NET 2005, so I added the ACE_Export
// to these class declarations. Steve Huston, 12/8/2006.
+
#include "ace/os_include/os_errno.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Global_Macros.h"
#include "ace/OS_Memory.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Time_Value;
+
/**
* @class ACE_Null_Mutex
*
@@ -41,32 +50,46 @@ public:
~ACE_Null_Mutex (void) {}
/// Return 0.
int remove (void) {return 0;}
+
/// Return 0.
int acquire (void) {return 0;}
+
/// Return -1 with @c errno == @c ETIME.
int acquire (ACE_Time_Value &) {errno = ETIME; return -1;}
+
/// Return -1 with @c errno == @c ETIME.
int acquire (ACE_Time_Value *) {errno = ETIME; return -1;}
+
/// Return 0.
int tryacquire (void) {return 0;}
+
/// Return 0.
int release (void) {return 0;}
+
/// Return 0.
int acquire_write (void) {return 0;}
+
/// Return 0.
int tryacquire_write (void) {return 0;}
+
/// Return 0.
int tryacquire_write_upgrade (void) {return 0;}
+
/// Return 0.
int acquire_read (void) {return 0;}
+
/// Return 0.
int tryacquire_read (void) {return 0;}
+
/// Dump the state of an object.
void dump (void) const {}
+
/// Declare the dynamic allocation hooks.
//ACE_ALLOC_HOOK_DECLARE;
+
int lock_; // A dummy lock.
};
+
#if defined (ACE_USES_OBSOLETE_GUARD_CLASSES)
/**
* @class ACE_Null_Mutex_Guard
@@ -89,14 +112,17 @@ public:
int tryacquire (void) {return 0;}
int release (void) {return 0:}
void dump (void) const {}
+
private:
// = Prevent assignment and initialization.
void operator= (const ACE_Null_Mutex_Guard &);
ACE_Null_Mutex_Guard (const ACE_Null_Mutex_Guard &);
};
#endif /* ACE_USES_OBSOLETE_GUARD_CLASSES */
+
template <class ACE_LOCK>
class ACE_Guard;
+
/**
* @class ACE_Guard<ACE_Null_Mutex>
*
@@ -117,6 +143,7 @@ public:
#if defined (ACE_WIN32)
~ACE_Guard (void) {}
#endif /* ACE_WIN32 */
+
int acquire (void) { return 0; }
int tryacquire (void) { return 0; }
int release (void) { return 0; }
@@ -124,13 +151,18 @@ public:
int locked (void) { return 1; }
int remove (void) { return 0; }
void dump (void) const {}
+
private:
+
// Disallow copying and assignment.
ACE_Guard (const ACE_Guard<ACE_Null_Mutex> &);
void operator= (const ACE_Guard<ACE_Null_Mutex> &);
+
};
+
template <class ACE_LOCK>
class ACE_Write_Guard;
+
/**
* @class ACE_Write_Guard<ACE_Null_Mutex>
*
@@ -144,14 +176,17 @@ public:
: ACE_Guard<ACE_Null_Mutex> (m) {}
ACE_Write_Guard (ACE_Null_Mutex &m, int blocked)
: ACE_Guard<ACE_Null_Mutex> (m, blocked) {}
+
int acquire_write (void) { return 0; }
int acquire (void) { return 0; }
int tryacquire_write (void) { return 0; }
int tryacquire (void) { return 0; }
void dump (void) const {}
};
+
template <class ACE_LOCK>
class ACE_Read_Guard;
+
/**
* @class ACE_Read_Guard<ACE_Null_Mutex>
*
@@ -165,13 +200,16 @@ public:
: ACE_Guard<ACE_Null_Mutex> (m) {}
ACE_Read_Guard (ACE_Null_Mutex &m, int blocked)
: ACE_Guard<ACE_Null_Mutex> (m, blocked) {}
+
int acquire_read (void) { return 0; }
int acquire (void) { return 0; }
int tryacquire_read (void) { return 0; }
int tryacquire (void) { return 0; }
void dump (void) const {}
};
+
template <class T> class ACE_Malloc_Lock_Adapter_T;
+
/**
* @class ACE_Malloc_Lock_Adapter_T<ACE_Null_Mutex>
*
@@ -187,7 +225,9 @@ public:
return p;
}
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
#endif /* ACE_NULL_MUTEX_H */
diff --git a/dep/ACE_wrappers/ace/Null_Semaphore.h b/dep/ACE_wrappers/ace/Null_Semaphore.h
index aed85445923..4b8112876f6 100644
--- a/dep/ACE_wrappers/ace/Null_Semaphore.h
+++ b/dep/ACE_wrappers/ace/Null_Semaphore.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file Null_Semaphore.h
@@ -10,18 +11,24 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//==========================================================================
+
#ifndef ACE_NULL_SEMAPHORE_H
#define ACE_NULL_SEMAPHORE_H
#include /**/ "ace/pre.h"
+
// All methods in this class are inline, so there is no
// need to import or export on Windows. -- CAE 12/18/2003
#include "ace/os_include/os_errno.h"
#include "ace/os_include/sys/os_types.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Time_Value;
+
/**
* @class ACE_Null_Semaphore
*
@@ -51,34 +58,49 @@ public:
~ACE_Null_Semaphore (void) {}
/// Return 0.
int remove (void) {return 0;}
+
/// Return 0.
int acquire (void) {return 0;}
+
/// Return -1 with @c errno == @c ETIME.
int acquire (ACE_Time_Value &) {errno = ETIME; return -1;}
+
/// Return -1 with @c errno == @c ETIME.
int acquire (ACE_Time_Value *) {errno = ETIME; return -1;}
+
/// Return 0.
int tryacquire (void) {return 0;}
+
/// Return 0.
int release (void) {return 0;}
+
/// Return 0.
int release (size_t) {return 0;}
+
/// Return 0.
int acquire_write (void) {return 0;}
+
/// Return 0.
int tryacquire_write (void) {return 0;}
+
/// Return 0.
int tryacquire_write_upgrade (void) {return 0;}
+
/// Return 0.
int acquire_read (void) {return 0;}
+
/// Return 0.
int tryacquire_read (void) {return 0;}
+
/// Dump the state of an object.
void dump (void) const {}
+
/// Declare the dynamic allocation hooks.
//ACE_ALLOC_HOOK_DECLARE;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
#endif /* ACE_NULL_SEMAPHORE_H */
diff --git a/dep/ACE_wrappers/ace/Numeric_Limits.h b/dep/ACE_wrappers/ace/Numeric_Limits.h
index 9e80d0e4a02..b4ee307fe5c 100644
--- a/dep/ACE_wrappers/ace/Numeric_Limits.h
+++ b/dep/ACE_wrappers/ace/Numeric_Limits.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Numeric_Limits.h
@@ -20,16 +21,22 @@
* @author Ossama Othman <ossama_othman at symantec dot com>
*/
//=============================================================================
+
#ifndef ACE_NUMERIC_LIMITS_H
#define ACE_NUMERIC_LIMITS_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
# if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
# endif /* ACE_LACKS_PRAGMA_ONCE */
+
#ifdef ACE_LACKS_NUMERIC_LIMITS
# include "ace/Basic_Types.h"
#else
+
# ifdef __MINGW32__
// Windows defines min/max macros that interfere with the
// numeric_limits::min/max() traits. Undefine those macros before
@@ -44,20 +51,27 @@
# undef min
# undef max
# endif /* __MINGW32__ */
+
# if defined (ACE_LACKS_LONGLONG_T) || defined (ACE_LACKS_UNSIGNEDLONGLONG_T)
// For ACE_U_LongLong.
# include "ace/Basic_Types.h"
# endif /* ACE_LACKS_LONGLONG_T || ACE_LACKS_UNSIGNEDLONGLONG_T */
+
# include <limits>
#endif /* ACE_LACKS_NUMERIC_LIMITS */
+
// Address global namespace pollution potentially incurred by some
// platforms.
#undef min
#undef max
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
#ifdef ACE_LACKS_NUMERIC_LIMITS
+
template <typename T> struct ACE_Numeric_Limits;
+
// ------------------------------------------
// Special cases.
template<>
@@ -66,32 +80,38 @@ struct ACE_Export ACE_Numeric_Limits<char>
static char min (void) { return CHAR_MIN; }
static char max (void) { return CHAR_MAX; }
};
+
// ------------------------------------------
// Signed integers.
+
template<>
struct ACE_Export ACE_Numeric_Limits<signed char>
{
static signed char min (void) { return SCHAR_MIN; }
static signed char max (void) { return SCHAR_MAX; }
};
+
template<>
struct ACE_Export ACE_Numeric_Limits<signed short>
{
static signed short min (void) { return SHRT_MIN; }
static signed short max (void) { return SHRT_MAX; }
};
+
template<>
struct ACE_Export ACE_Numeric_Limits<signed int>
{
static signed int min (void) { return INT_MIN; }
static signed int max (void) { return INT_MAX; }
};
+
template<>
struct ACE_Export ACE_Numeric_Limits<signed long>
{
static signed long min (void) { return LONG_MIN; }
static signed long max (void) { return LONG_MAX; }
};
+
// #ifndef ACE_LACKS_LONGLONG_T
// template<>
// struct ACE_Export ACE_Numeric_Limits<signed long long>
@@ -105,6 +125,7 @@ struct ACE_Export ACE_Numeric_Limits<signed long>
// #else
// # error Unable to determine minimum signed long long value.
// #endif /* LLONG_MIN */
+
// #if defined (LLONG_MAX)
// # define ACE_LLONG_MAX LLONG_MAX
// #elif defined (LONG_LONG_MAX)
@@ -114,10 +135,12 @@ struct ACE_Export ACE_Numeric_Limits<signed long>
// #else
// # error Unable to determine maximum signed long long value.
// #endif /* LLONG_MAX */
+
// static signed long long min (void) { return ACE_LLONG_MIN; }
// static signed long long max (void) { return ACE_LLONG_MAX; }
// };
// #endif /* !ACE_LACKS_LONGLONG_T */
+
// ------------------------------------------
// Unsigned integers
template<>
@@ -126,24 +149,28 @@ struct ACE_Export ACE_Numeric_Limits<unsigned char>
static unsigned char min (void) { return 0; }
static unsigned char max (void) { return UCHAR_MAX; }
};
+
template<>
struct ACE_Export ACE_Numeric_Limits<unsigned short>
{
static unsigned short min (void) { return 0; }
static unsigned short max (void) { return USHRT_MAX; }
};
+
template<>
struct ACE_Export ACE_Numeric_Limits<unsigned int>
{
static unsigned int min (void) { return 0; }
static unsigned int max (void) { return UINT_MAX; }
};
+
template<>
struct ACE_Export ACE_Numeric_Limits<unsigned long>
{
static unsigned long min (void) { return 0; }
static unsigned long max (void) { return ULONG_MAX; }
};
+
// #ifndef ACE_LACKS_LONGLONG_T
// template<>
// struct ACE_Export ACE_Numeric_Limits<unsigned long long>
@@ -161,35 +188,43 @@ struct ACE_Export ACE_Numeric_Limits<unsigned long>
// }
// };
// #endif /* !ACE_LACKS_LONGLONG_T */
+
// ------------------------------------------
// Floating point types
+
template<>
struct ACE_Export ACE_Numeric_Limits<float>
{
static float min (void) { return FLT_MIN; }
static float max (void) { return FLT_MAX; }
};
+
template<>
struct ACE_Export ACE_Numeric_Limits<double>
{
static double min (void) { return DBL_MIN; }
static double max (void) { return DBL_MAX; }
};
+
template<>
struct ACE_Export ACE_Numeric_Limits<long double>
{
static long double min (void) { return LDBL_MIN; }
static long double max (void) { return LDBL_MAX; }
};
+
#else
+
// std::numeric_limits<> has all of the necessary specializations.
// Just wrap it.
+
template <typename T>
struct ACE_Numeric_Limits
{
static T min (void) { return std::numeric_limits<T>::min (); }
static T max (void) { return std::numeric_limits<T>::max (); }
};
+
# if (defined (ACE_WIN64) && defined (_MSC_VER) && _MSC_VER <= 1310) \
|| defined (ACE_LACKS_NUMERIC_LIMITS_64_BIT_TYPES)
// The Microsoft Platform SDK does not provide std::numeric_limits<>
@@ -208,6 +243,7 @@ struct ACE_Numeric_Limits<LONGLONG>
static LONGLONG min (void) { return _I64_MIN; }
static LONGLONG max (void) { return _I64_MAX; }
};
+
template<>
struct ACE_Numeric_Limits<ULONGLONG>
{
@@ -215,7 +251,9 @@ struct ACE_Numeric_Limits<ULONGLONG>
static ULONGLONG max (void) { return _UI64_MAX; }
};
# endif /* ACE_WIN64 && _MSC_VER <= 1310 */
+
#endif /* ACE_LACKS_NUMERIC_LIMITS */
+
#if defined (ACE_LACKS_LONGLONG_T) || defined (ACE_LACKS_UNSIGNEDLONGLONG_T)
template<>
struct ACE_Numeric_Limits<ACE_U_LongLong>
@@ -224,7 +262,10 @@ struct ACE_Numeric_Limits<ACE_U_LongLong>
static ACE_U_LongLong max (void) { return ACE_UINT64_MAX; }
};
#endif /* ACE_LACKS_LONGLONG_T || defined ACE_LACKS_UNSIGNEDLONGLONG_T */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
+
#endif /* ACE_NUMERIC_LIMITS_H */
diff --git a/dep/ACE_wrappers/ace/OS.h b/dep/ACE_wrappers/ace/OS.h
index a16823ce33c..9283ed6f417 100644
--- a/dep/ACE_wrappers/ace/OS.h
+++ b/dep/ACE_wrappers/ace/OS.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file OS.h
@@ -10,13 +11,18 @@
* @author and a cast of thousands...
*/
//=============================================================================
+
#ifndef ACE_OS_H
#define ACE_OS_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if !defined (DO_NOT_INCLUDE_OS_H)
#include "ace/Cleanup.h"
#include "ace/Object_Manager_Base.h"
@@ -53,31 +59,41 @@
#include "ace/OS_NS_time.h"
#include "ace/OS_NS_unistd.h"
#include "ace/OS_NS_wchar.h"
+
// Include the split up ACE_OS classes
#include "ace/OS_Dirent.h"
#include "ace/OS_String.h"
#include "ace/OS_Memory.h"
#include "ace/OS_TLI.h"
#include "ace/OS_Errno.h"
+
#include "ace/os_include/os_dlfcn.h"
#include "ace/os_include/sys/os_mman.h"
#include "ace/os_include/os_netdb.h"
#include "ace/os_include/sys/os_socket.h"
#include "ace/os_include/net/os_if.h"
#include "ace/os_include/sys/os_sem.h"
+
#include "ace/Time_Value.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Timeout_Manager;
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
// Here are all ACE-specific default constants, needed throughout ACE
// and its applications. The values can be over written by user
// specific values in config.h files.
#include "ace/Default_Constants.h"
+
// Here are all ACE-specific global declarations needed throughout
// ACE.
#include "ace/Global_Macros.h"
+
// include the ACE min()/max() functions.
# include "ace/Min_Max.h"
+
///////////////////////////////////////////
// //
// NOTE: Please do not add any #includes //
@@ -86,31 +102,38 @@ ACE_END_VERSIONED_NAMESPACE_DECL
// first! //
// //
///////////////////////////////////////////
+
#include "ace/os_include/netinet/os_tcp.h"
#include "ace/os_include/sys/os_stat.h"
#include "ace/os_include/os_stropts.h"
#include "ace/os_include/os_unistd.h"
#include "ace/os_include/sys/os_wait.h"
+
// This needs to go here *first* to avoid problems with AIX.
# if defined (ACE_HAS_PTHREADS)
# include "ace/os_include/os_pthread.h"
# endif /* ACE_HAS_PTHREADS */
+
# if defined (ACE_HAS_PROC_FS)
# include /**/ <sys/procfs.h>
# endif /* ACE_HAS_PROC_FS */
+
# if defined (ACE_HAS_POSIX_SEM)
# include "ace/os_include/os_semaphore.h"
# endif /* ACE_HAS_POSIX_SEM */
+
#include "ace/os_include/sys/os_types.h"
#include "ace/os_include/os_stddef.h"
#if !defined (ACE_LACKS_UNISTD_H)
# include "ace/os_include/os_unistd.h"
#endif /* ACE_LACKS_UNISTD_H */
+
// Standard C Library includes
# if !defined (ACE_HAS_WINCE)
# include "ace/os_include/os_assert.h"
# include "ace/os_include/os_stdio.h"
+
# if !defined (ACE_LACKS_NEW_H)
# if defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB)
# include /**/ <new>
@@ -118,46 +141,61 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# include /**/ <new.h>
# endif /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */
# endif /* ! ACE_LACKS_NEW_H */
+
# if !defined (ACE_VXWORKS)
# define ACE_DONT_INCLUDE_ACE_SIGNAL_H
# include "ace/os_include/os_signal.h"
# undef ACE_DONT_INCLUDE_ACE_SIGNAL_H
# endif /* ! VXWORKS */
+
# include "ace/os_include/os_fcntl.h"
# endif /* ACE_HAS_WINCE */
+
# include "ace/os_include/os_limits.h"
# include "ace/os_include/os_ctype.h"
# include "ace/os_include/os_string.h"
# include "ace/os_include/os_stdlib.h"
# include "ace/os_include/os_float.h"
+
# if defined (ACE_NEEDS_SCHED_H)
# include "ace/os_include/os_sched.h"
# endif /* ACE_NEEDS_SCHED_H */
+
# include "ace/iosfwd.h"
+
# if !defined (ACE_HAS_WINCE)
# include "ace/os_include/os_fcntl.h"
# endif /* ACE_HAS_WINCE */
+
# if defined ACE_HAS_BYTESEX_H
# include /**/ <bytesex.h>
# endif /* ACE_HAS_BYTESEX_H */
# include "ace/Basic_Types.h"
+
# if defined (ACE_HAS_UTIME)
# include "ace/os_include/os_utime.h"
# endif /* ACE_HAS_UTIME */
+
# if defined (ACE_WIN32)
+
# if !defined (ACE_HAS_WINCE)
# include "ace/os_include/sys/os_timeb.h"
# endif /* ACE_HAS_WINCE */
+
# if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
# include "ace/os_include/netinet/os_in.h" // <ws2tcpip.h>
# endif /* ACE_HAS_WINSOCK2 */
+
# if !defined (ACE_HAS_WINCE)
# include "ace/os_include/os_time.h"
# include "ace/os_include/sys/os_stat.h" // <direct.h>
# include "ace/os_include/os_unistd.h" // <process.h>
# endif /* ACE_HAS_WINCE */
+
# include "ace/os_include/os_fcntl.h"
+
# else /* !defined (ACE_WIN32) */
+
# if defined (CYGWIN32)
# include "ace/os_include/sys/os_uio.h"
# include "ace/os_include/os_fcntl.h" // <sys/file.h>
@@ -182,6 +220,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# include "ace/os_include/sys/os_utsname.h"
# include "ace/os_include/sys/os_wait.h"
# include "ace/os_include/os_pwd.h"
+
# elif ! defined (ACE_VXWORKS) && ! defined (INTEGRITY)
# include "ace/os_include/sys/os_uio.h"
# include "ace/os_include/sys/os_ipc.h"
@@ -196,40 +235,54 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# include "ace/os_include/os_pwd.h"
# endif /* ! VXWORKS */
# include "ace/os_include/os_stropts.h" // <sys/ioctl.h>
+
// IRIX5 defines bzero() in this odd file...
# if defined (ACE_HAS_BSTRING)
# include /**/ <bstring.h>
# endif /* ACE_HAS_BSTRING */
+
// AIX defines bzero() in this odd file...
# if defined (ACE_HAS_STRINGS)
# include "ace/os_include/os_strings.h"
# endif /* ACE_HAS_STRINGS */
+
# if defined (ACE_HAS_TERMIOS)
# include "ace/os_include/os_termios.h"
# endif /* ACE_HAS_TERMIOS */
+
# if defined (ACE_HAS_AIO_CALLS)
# include "ace/os_include/os_aio.h"
# endif /* ACE_HAS_AIO_CALLS */
+
# include "ace/os_include/os_limits.h" // <sys/param.h>
+
# if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS)
# include "ace/os_include/sys/os_un.h"
# endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */
+
# if defined (ACE_HAS_POLL)
# include "ace/os_include/os_poll.h"
# endif /* ACE_HAS_POLL */
+
# if defined (ACE_HAS_SELECT_H)
# include "ace/os_include/sys/os_select.h"
# endif /* ACE_HAS_SELECT_H */
+
# include "ace/os_include/sys/os_msg.h"
+
# if defined (ACE_HAS_PRIOCNTL)
# include /**/ <sys/priocntl.h>
# endif /* ACE_HAS_PRIOCNTL */
+
# endif /* !defined (ACE_WIN32) */
+
# if !defined (ACE_WIN32) && !defined (ACE_LACKS_UNIX_SYSLOG)
# include "ace/os_include/os_syslog.h"
# endif /* !defined (ACE_WIN32) && !defined (ACE_LACKS_UNIX_SYSLOG) */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @namespace ACE_OS
*
@@ -251,7 +304,9 @@ namespace ACE_OS
{
// = A set of wrappers for miscellaneous operations.
} /* namespace ACE_OS */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# if defined (ACE_HAS_INLINED_OSCALLS)
# if defined (ACE_INLINE)
# undef ACE_INLINE
@@ -259,6 +314,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_INLINE inline
# include "ace/OS.inl"
# endif /* ACE_HAS_INLINED_OSCALLS */
+
#if defined (ACE_LEGACY_MODE)
# include "ace/Log_Msg.h"
# include "ace/Thread_Hook.h"
@@ -266,7 +322,9 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# include "ace/Thread_Exit.h"
# include "ace/Thread_Control.h"
#endif /* ACE_LEGACY_MODE */
+
#endif /* 0 */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_H */
diff --git a/dep/ACE_wrappers/ace/OS.inl b/dep/ACE_wrappers/ace/OS.inl
index fea3b69e90e..593b582d8ce 100644
--- a/dep/ACE_wrappers/ace/OS.inl
+++ b/dep/ACE_wrappers/ace/OS.inl
@@ -1,19 +1,24 @@
// -*- C++ -*-
// $Id: OS.inl 81697 2008-05-14 18:33:11Z johnnyw $
+
#if !defined (ACE_HAS_INLINED_OSCALLS)
# undef ACE_INLINE
# define ACE_INLINE
#endif /* ACE_HAS_INLINED_OSCALLS */
+
#if defined (ACE_HAS_XLI)
# include /**/ <xliuser.h>
#endif /* ACE_HAS_XLI */
+
#if !defined (ACE_HAS_CPLUSPLUS_HEADERS)
# include /**/ <libc.h>
# include /**/ <osfcn.h>
#endif /* ACE_HAS_CPLUSPLUS_HEADERS */
+
#if defined (ACE_HAS_SYSENT_H)
# include /**/ <sysent.h>
#endif /* ACE_HAS_SYSENT_H */
+
#if defined (ACE_USES_STD_NAMESPACE_FOR_STDC_LIB) && \
(ACE_USES_STD_NAMESPACE_FOR_STDC_LIB != 0)
using std::bsearch;
@@ -29,10 +34,13 @@ using std::gmtime;
using std::asctime;
using std::strftime;
#endif /* ACE_USES_STD_NAMESPACE_FOR_STDC_LIB */
+
#if !defined (ACE_LACKS_MALLOC_H)
# include /**/ <malloc.h>
#endif /* ACE_LACKS_MALLOC_H */
+
#if !defined (ACE_WIN32)
+
// Matthew Stevens 7-10-95 Fix GNU GCC 2.7 for memchr() problem.
# if defined (ACE_HAS_GNU_CSTRING_H)
// Define this file to keep /usr/include/memory.h from being included.
@@ -44,22 +52,28 @@ using std::strftime;
# include /**/ <memory.h>
# endif /* ACE_LACKS_MEMORY_H */
# endif /* ACE_HAS_GNU_CSTRING_H */
+
// The following are #defines and #includes that must be visible for
// ACE to compile it's OS wrapper class implementation correctly. We
// put them inside of here to reduce compiler overhead if we're not
// inlining...
+
# if defined (ACE_HAS_REGEX)
# include /**/ <regexpr.h>
# endif /* ACE_HAS_REGEX */
+
# if defined (ACE_HAS_SYS_SYSTEMINFO_H)
# include /**/ <sys/systeminfo.h>
# endif /* ACE_HAS_SYS_SYSTEMINFO_H */
+
# if defined (ACE_HAS_SYS_SYSCALL_H)
# include /**/ <sys/syscall.h>
# endif /* ACE_HAS_SYS_SYSCALL_H */
+
# if defined (UNIXWARE) /* See strcasecmp, below */
# include /**/ <ctype.h>
# endif /* UNIXWARE */
+
# if defined (ACE_HAS_GETIFADDRS)
# if defined (ACE_VXWORKS)
# include /**/ <net/ifaddrs.h>
@@ -68,9 +82,12 @@ using std::strftime;
# endif
# endif /* ACE_HAS_GETIFADDRS */
+
#endif /* WIN32 */
+
#if defined (ACE_HAS_SHM_OPEN) && defined(INTEGRITY)
#include "ace/os_include/sys/os_mman.h"
#endif
+
// ****************************************************************
diff --git a/dep/ACE_wrappers/ace/OS_Dirent.h b/dep/ACE_wrappers/ace/OS_Dirent.h
index 180b8b39343..e9c0984390c 100644
--- a/dep/ACE_wrappers/ace/OS_Dirent.h
+++ b/dep/ACE_wrappers/ace/OS_Dirent.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file OS_Dirent.h
@@ -10,17 +11,23 @@
* @author and a cast of thousands...
*/
//=============================================================================
+
#ifndef ACE_OS_DIRENT_H
#define ACE_OS_DIRENT_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/OS_Errno.h"
#include "ace/os_include/os_dirent.h"
#include "ace/os_include/sys/os_types.h"
+
#include "ace/OS_NS_dirent.h"
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_DIRENT_H */
diff --git a/dep/ACE_wrappers/ace/OS_Errno.cpp b/dep/ACE_wrappers/ace/OS_Errno.cpp
index 9dbf8575abb..1e1eab82218 100644
--- a/dep/ACE_wrappers/ace/OS_Errno.cpp
+++ b/dep/ACE_wrappers/ace/OS_Errno.cpp
@@ -1,7 +1,10 @@
// -*- C++ -*-
// $Id: OS_Errno.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_Errno.h"
+
ACE_RCSID(ace, OS_Errno, "$Id: OS_Errno.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
// Inlining this class on debug builds with gcc on Solaris can cause
// deadlocks during static initialization. On non debug builds it
// causes compilation errors.
@@ -13,11 +16,16 @@ ACE_RCSID(ace, OS_Errno, "$Id: OS_Errno.cpp 80826 2008-03-04 14:51:23Z wotte $")
# define ACE_INLINE
# include "ace/OS_Errno.inl"
#endif /* ACE_HAS_INLINED_OSCALLS */
+
#if defined (ACE_HAS_WINCE_BROKEN_ERRNO)
+
#include "ace/OS_Memory.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_CE_Errno *ACE_CE_Errno::instance_ = 0;
DWORD ACE_CE_Errno::errno_key_ = 0xffffffff;
+
void
ACE_CE_Errno::init ()
{
@@ -25,6 +33,7 @@ ACE_CE_Errno::init ()
ACE_CE_Errno ());
ACE_CE_Errno::errno_key_ = TlsAlloc ();
}
+
void
ACE_CE_Errno::fini ()
{
@@ -32,6 +41,8 @@ ACE_CE_Errno::fini ()
delete ACE_CE_Errno::instance_;
ACE_CE_Errno::instance_ = 0;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_WINCE_BROKEN_ERRNO */
diff --git a/dep/ACE_wrappers/ace/OS_Errno.h b/dep/ACE_wrappers/ace/OS_Errno.h
index b256012a5cb..41e33692cb9 100644
--- a/dep/ACE_wrappers/ace/OS_Errno.h
+++ b/dep/ACE_wrappers/ace/OS_Errno.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file OS_Errno.h
@@ -8,15 +9,21 @@
* @author (Originally in OS.h)Doug Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_OS_ERRNO_H
#define ACE_OS_ERRNO_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/OS_NS_errno.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Errno_Guard
*
@@ -43,31 +50,41 @@ public:
/// <errno_ptr_> to the address of <errno_ref>.
ACE_Errno_Guard (ACE_ERRNO_TYPE &errno_ref,
int error);
+
/// Stash the value of @c errno into <error_> and initialize the
/// <errno_ptr_> to the address of <errno_ref>.
ACE_Errno_Guard (ACE_ERRNO_TYPE &errno_ref);
+
/// Reset the value of @c errno to <error>.
~ACE_Errno_Guard (void);
+
#if defined (ACE_HAS_WINCE_BROKEN_ERRNO)
/// Assign <errno_ref> to <error_>.
int operator= (const ACE_ERRNO_TYPE &errno_ref);
#endif /* ACE_HAS_WINCE_BROKEN_ERRNO */
+
/// Assign <error> to <error_>.
int operator= (int error);
+
/// Compare <error> with <error_> for equality.
bool operator== (int error);
+
/// Compare <error> with <error_> for inequality.
bool operator!= (int error);
+
private:
// Prevent copying
ACE_Errno_Guard (const ACE_Errno_Guard &);
ACE_Errno_Guard &operator= (const ACE_Errno_Guard &);
+
#if defined (ACE_MT_SAFE)
ACE_ERRNO_TYPE *errno_ptr_;
#endif /* ACE_MT_SAFE */
int error_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
// Inlining this class on debug builds with gcc on Solaris can cause
// deadlocks during static initialization. On non debug builds it
// causes compilation errors.
@@ -79,6 +96,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_INLINE inline
# include "ace/OS_Errno.inl"
#endif /* ACE_HAS_INLINED_OSCALLS */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_ERRNO_H */
diff --git a/dep/ACE_wrappers/ace/OS_Errno.inl b/dep/ACE_wrappers/ace/OS_Errno.inl
index acb7e1624bb..3fac7dfd492 100644
--- a/dep/ACE_wrappers/ace/OS_Errno.inl
+++ b/dep/ACE_wrappers/ace/OS_Errno.inl
@@ -1,7 +1,9 @@
// -*- C++ -*-
//
// $Id: OS_Errno.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_Errno_Guard::ACE_Errno_Guard (ACE_ERRNO_TYPE &errno_ref,
int error)
@@ -15,6 +17,7 @@ ACE_Errno_Guard::ACE_Errno_Guard (ACE_ERRNO_TYPE &errno_ref,
ACE_UNUSED_ARG (errno_ref);
#endif /* ACE_MT_SAFE */
}
+
ACE_INLINE
ACE_Errno_Guard::ACE_Errno_Guard (ACE_ERRNO_TYPE &errno_ref)
:
@@ -24,6 +27,7 @@ ACE_Errno_Guard::ACE_Errno_Guard (ACE_ERRNO_TYPE &errno_ref)
error_ (errno_ref)
{
}
+
ACE_INLINE
ACE_Errno_Guard::~ACE_Errno_Guard (void)
{
@@ -33,6 +37,7 @@ ACE_Errno_Guard::~ACE_Errno_Guard (void)
errno = this->error_;
#endif /* ACE_MT_SAFE */
}
+
#if defined (ACE_HAS_WINCE_BROKEN_ERRNO)
ACE_INLINE int
ACE_Errno_Guard::operator= (const ACE_ERRNO_TYPE &error)
@@ -40,19 +45,23 @@ ACE_Errno_Guard::operator= (const ACE_ERRNO_TYPE &error)
return this->error_ = error;
}
#endif /* ACE_HAS_WINCE_BROKEN_ERRNO */
+
ACE_INLINE int
ACE_Errno_Guard::operator= (int error)
{
return this->error_ = error;
}
+
ACE_INLINE bool
ACE_Errno_Guard::operator== (int error)
{
return this->error_ == error;
}
+
ACE_INLINE bool
ACE_Errno_Guard::operator!= (int error)
{
return this->error_ != error;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_Log_Msg_Attributes.cpp b/dep/ACE_wrappers/ace/OS_Log_Msg_Attributes.cpp
index 5b74e152b60..227ead2726c 100644
--- a/dep/ACE_wrappers/ace/OS_Log_Msg_Attributes.cpp
+++ b/dep/ACE_wrappers/ace/OS_Log_Msg_Attributes.cpp
@@ -1,7 +1,10 @@
// $Id: OS_Log_Msg_Attributes.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_Log_Msg_Attributes.h"
+
#if !defined (ACE_HAS_INLINED_OSCALLS)
# include "ace/OS_Log_Msg_Attributes.inl"
#endif /* ACE_HAS_INLINED_OSCALLS */
+
ACE_RCSID(ace, OS_Log_Msg_Attributes, "$Id: OS_Log_Msg_Attributes.cpp 80826 2008-03-04 14:51:23Z wotte $")
diff --git a/dep/ACE_wrappers/ace/OS_Log_Msg_Attributes.h b/dep/ACE_wrappers/ace/OS_Log_Msg_Attributes.h
index 7ce7098e111..ff6bc1180c2 100644
--- a/dep/ACE_wrappers/ace/OS_Log_Msg_Attributes.h
+++ b/dep/ACE_wrappers/ace/OS_Log_Msg_Attributes.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file OS_Log_Msg_Attributes.h
@@ -8,17 +9,23 @@
* @author Carlos O'Ryan
*/
//=============================================================================
+
#include /**/ "ace/config-all.h"
+
#ifndef ACE_OS_LOG_MSG_ATTRIBUTES_H
#define ACE_OS_LOG_MSG_ATTRIBUTES_H
#include /**/ "ace/pre.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include /**/ "ace/ACE_export.h"
#include "ace/os_include/os_stdio.h"
#include "ace/iosfwd.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_OS_Log_Msg_Attributes
*
@@ -37,30 +44,40 @@ class ACE_Export ACE_OS_Log_Msg_Attributes
public:
/// Constructor
ACE_OS_Log_Msg_Attributes (void);
+
protected:
friend class ACE_Log_Msg;
+
/// Ostream where the new TSS Log_Msg will use.
ACE_OSTREAM_TYPE *ostream_;
+
/// Priority_mask to be used in new TSS Log_Msg.
unsigned long priority_mask_;
+
/// Are we allowing tracing in this thread?
int tracing_enabled_;
+
/// Indicates whether we should restart system calls that are
/// interrupted.
int restart_;
+
/// Depth of the nesting for printing traces.
int trace_depth_;
+
# if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS)
/// Structured exception handling Callbacks, only used under Win32
ACE_SEH_EXCEPT_HANDLER seh_except_selector_;
ACE_SEH_EXCEPT_HANDLER seh_except_handler_;
# endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */
+
private:
// Prevent copying
ACE_OS_Log_Msg_Attributes (const ACE_OS_Log_Msg_Attributes &);
ACE_OS_Log_Msg_Attributes &operator= (const ACE_OS_Log_Msg_Attributes &);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# if defined (ACE_HAS_INLINED_OSCALLS)
# if defined (ACE_INLINE)
# undef ACE_INLINE
@@ -68,6 +85,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_INLINE inline
# include "ace/OS_Log_Msg_Attributes.inl"
# endif /* ACE_HAS_INLINED_OSCALLS */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_LOG_MSG_ATTRIBUTES_H */
diff --git a/dep/ACE_wrappers/ace/OS_Log_Msg_Attributes.inl b/dep/ACE_wrappers/ace/OS_Log_Msg_Attributes.inl
index 0e73eca708c..82619a031ab 100644
--- a/dep/ACE_wrappers/ace/OS_Log_Msg_Attributes.inl
+++ b/dep/ACE_wrappers/ace/OS_Log_Msg_Attributes.inl
@@ -1,9 +1,12 @@
// -*- C++ -*-
//
// $Id: OS_Log_Msg_Attributes.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_OS_Log_Msg_Attributes::ACE_OS_Log_Msg_Attributes (void)
{
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_Memory.h b/dep/ACE_wrappers/ace/OS_Memory.h
index b5e4808268f..60590c02159 100644
--- a/dep/ACE_wrappers/ace/OS_Memory.h
+++ b/dep/ACE_wrappers/ace/OS_Memory.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file OS_Memory.h
@@ -10,16 +11,21 @@
* @author and a cast of thousands...
*/
//=============================================================================
+
#ifndef ACE_OS_MEMORY_H
#define ACE_OS_MEMORY_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/OS_Errno.h"
#include "ace/Basic_Types.h"
#include "ace/os_include/os_stddef.h"
+
// Allow an installation to replace the lowest-level allocation
// functions without changing the source of ACE.
//
@@ -49,13 +55,17 @@
#if !defined (ACE_REALLOC_FUNC)
# define ACE_REALLOC_FUNC ::realloc
#endif
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_HAS_OLD_MALLOC)
typedef char * ACE_MALLOC_T;
#else
typedef void * ACE_MALLOC_T;
#endif /* ACE_HAS_OLD_MALLOC */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
// ============================================================================
// ACE_NEW macros
//
@@ -64,12 +74,14 @@ ACE_END_VERSIONED_NAMESPACE_DECL
// depending on whether ANSI/ISO exception handling semantics are
// being used).
// ============================================================================
+
// If new(std::nothrow) is defined then, by definition, new throws exceptions.
#if defined (ACE_HAS_NEW_NOTHROW)
# if !defined (ACE_NEW_THROWS_EXCEPTIONS)
# define ACE_NEW_THROWS_EXCEPTIONS
# endif
#endif
+
// The Windows MFC exception mechanism requires that a caught CException
// (including the CMemoryException in use here) be freed using its Delete()
// method. Thus, when MFC is in use and we're catching exceptions as a result
@@ -82,7 +94,9 @@ ACE_END_VERSIONED_NAMESPACE_DECL
#if !defined (ACE_del_bad_alloc)
# define ACE_del_bad_alloc
#endif
+
#if defined (ACE_NEW_THROWS_EXCEPTIONS)
+
// Since new() throws exceptions, we need a way to avoid passing
// exceptions past the call to new because ACE counts on having a 0
// return value for a failed allocation. Some compilers offer the
@@ -90,6 +104,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
// do not. For those that do not, this sets up what exception is thrown,
// and then below we'll do a try/catch around the new to catch it and
// return a 0 pointer instead.
+
# if defined (__HP_aCC)
// I know this works for HP aC++... if <stdexcept> is used, it
// introduces other stuff that breaks things, like <memory>, which
@@ -168,6 +183,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_throw_bad_alloc throw ACE_bad_alloc ()
# endif
# endif /* __HP_aCC */
+
# if defined (ACE_HAS_NEW_NOTHROW)
# define ACE_NEW_RETURN(POINTER,CONSTRUCTOR,RET_VAL) \
do { POINTER = new (ACE_nothrow) CONSTRUCTOR; \
@@ -181,21 +197,27 @@ ACE_END_VERSIONED_NAMESPACE_DECL
do { POINTER = new(ACE_nothrow) CONSTRUCTOR; \
if (POINTER == 0) { errno = ENOMEM; } \
} while (0)
+
# else
+
# define ACE_NEW_RETURN(POINTER,CONSTRUCTOR,RET_VAL) \
do { try { POINTER = new CONSTRUCTOR; } \
catch (ACE_bad_alloc) { ACE_del_bad_alloc errno = ENOMEM; POINTER = 0; return RET_VAL; } \
} while (0)
+
# define ACE_NEW(POINTER,CONSTRUCTOR) \
do { try { POINTER = new CONSTRUCTOR; } \
catch (ACE_bad_alloc) { ACE_del_bad_alloc errno = ENOMEM; POINTER = 0; return; } \
} while (0)
+
# define ACE_NEW_NORETURN(POINTER,CONSTRUCTOR) \
do { try { POINTER = new CONSTRUCTOR; } \
catch (ACE_bad_alloc) { ACE_del_bad_alloc errno = ENOMEM; POINTER = 0; } \
} while (0)
# endif /* ACE_HAS_NEW_NOTHROW */
+
#else /* ACE_NEW_THROWS_EXCEPTIONS */
+
# define ACE_NEW_RETURN(POINTER,CONSTRUCTOR,RET_VAL) \
do { POINTER = new CONSTRUCTOR; \
if (POINTER == 0) { errno = ENOMEM; return RET_VAL; } \
@@ -208,15 +230,19 @@ ACE_END_VERSIONED_NAMESPACE_DECL
do { POINTER = new CONSTRUCTOR; \
if (POINTER == 0) { errno = ENOMEM; } \
} while (0)
+
# define ACE_throw_bad_alloc \
void* gcc_will_complain_if_literal_0_is_returned = 0; \
return gcc_will_complain_if_literal_0_is_returned
+
#endif /* ACE_NEW_THROWS_EXCEPTIONS */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
//@{
/**
* @name Efficiently compute aligned pointers to powers of 2 boundaries.
*/
+
/**
* Efficiently align "value" up to "alignment", knowing that all such
* boundaries are binary powers and that we're using two's complement
@@ -267,6 +293,7 @@ ACE_align_binary (uintptr_t ptr, uintptr_t alignment)
return (ptr + tmp) & (~tmp);
}
#endif
+
#if defined (ACE_OPENVMS) && (!defined (__INITIAL_POINTER_SIZE) || (__INITIAL_POINTER_SIZE < 64))
/// Return the next address aligned to a required boundary
inline char *
@@ -276,6 +303,7 @@ ACE_ptr_align_binary (char const * ptr, unsigned int alignment)
reinterpret_cast<char *> (
ACE_align_binary (reinterpret_cast<unsigned int> (ptr), alignment));
}
+
/// Return the next address aligned to a required boundary
inline char *
ACE_ptr_align_binary (unsigned char const * ptr, unsigned int alignment)
@@ -292,6 +320,7 @@ ACE_ptr_align_binary (char const * ptr, uintptr_t alignment)
reinterpret_cast<char *> (
ACE_align_binary (reinterpret_cast<uintptr_t> (ptr), alignment));
}
+
/// Return the next address aligned to a required boundary
inline char *
ACE_ptr_align_binary (unsigned char const * ptr, uintptr_t alignment)
@@ -302,7 +331,9 @@ ACE_ptr_align_binary (unsigned char const * ptr, uintptr_t alignment)
#endif /* ACE_OPENVMS && __INITIAL_POINTER_SIZE < 64 */
//@}
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include "ace/OS_NS_stdlib.h"
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_MEMORY_H */
diff --git a/dep/ACE_wrappers/ace/OS_NS_Thread.cpp b/dep/ACE_wrappers/ace/OS_NS_Thread.cpp
index 7229f18eabc..187f4bf4078 100644
--- a/dep/ACE_wrappers/ace/OS_NS_Thread.cpp
+++ b/dep/ACE_wrappers/ace/OS_NS_Thread.cpp
@@ -1,10 +1,13 @@
#include "ace/OS_NS_Thread.h"
+
ACE_RCSID (ace,
OS_NS_Thread,
"$Id: OS_NS_Thread.cpp 81345 2008-04-13 07:28:11Z johnnyw $")
+
#if !defined (ACE_HAS_INLINED_OSCALLS)
# include "ace/OS_NS_Thread.inl"
#endif /* ACE_HAS_INLINED_OSCALLS */
+
#include "ace/OS_NS_stdio.h"
#include "ace/Sched_Params.h"
#include "ace/OS_Memory.h"
@@ -19,12 +22,14 @@ ACE_RCSID (ace,
#include "ace/Thread_Mutex.h"
#include "ace/Condition_T.h"
#include "ace/Guard_T.h"
+
extern "C" void
ACE_MUTEX_LOCK_CLEANUP_ADAPTER_NAME (void *args)
{
ACE_VERSIONED_NAMESPACE_NAME::ACE_OS::mutex_lock_cleanup (args);
}
+
#if !defined(ACE_WIN32) && defined (__IBMCPP__) && (__IBMCPP__ >= 400)
# define ACE_BEGINTHREADEX(STACK, STACKSIZE, ENTRY_POINT, ARGS, FLAGS, THR_ID) \
(*THR_ID = ::_beginthreadex ((void(_Optlink*)(void*))ENTRY_POINT, STACK, STACKSIZE, ARGS), *THR_ID)
@@ -39,8 +44,11 @@ ACE_MUTEX_LOCK_CLEANUP_ADAPTER_NAME (void *args)
# define ACE_BEGINTHREADEX(STACK, STACKSIZE, ENTRY_POINT, ARGS, FLAGS, THR_ID) \
::_beginthreadex (STACK, STACKSIZE, (ACE_WIN32THRFUNC_T) ENTRY_POINT, ARGS, FLAGS, (unsigned int *) THR_ID)
#endif /* defined (__IBMCPP__) && (__IBMCPP__ >= 400) */
+
/*****************************************************************************/
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
void
ACE_Thread_ID::to_string (char *thr_string) const
{
@@ -48,6 +56,7 @@ ACE_Thread_ID::to_string (char *thr_string) const
char *fp = 0; // Current format pointer
fp = format;
*fp++ = '%'; // Copy in the %
+
#if defined (ACE_WIN32)
ACE_OS::strcpy (fp, "u");
ACE_OS::sprintf (thr_string,
@@ -63,6 +72,7 @@ ACE_Thread_ID::to_string (char *thr_string) const
# endif /* ACE_HAS_THREADS */
);
#else
+
# if defined (ACE_MVS) || defined (ACE_TANDEM_T1248_PTHREADS)
// MVS's pthread_t is a struct... yuck. So use the ACE 5.0
// code for it.
@@ -80,19 +90,29 @@ ACE_Thread_ID::to_string (char *thr_string) const
format,
(unsigned long) thread_handle_);
# endif /* ACE_MVS || ACE_TANDEM_T1248_PTHREADS */
+
#endif /* ACE_WIN32 */
}
+
/*****************************************************************************/
+
#if defined (ACE_WIN32) || defined (ACE_HAS_TSS_EMULATION)
+
#if defined (ACE_HAS_TSS_EMULATION)
u_int ACE_TSS_Emulation::total_keys_ = 0;
+
ACE_TSS_Keys* ACE_TSS_Emulation::tss_keys_used_ = 0;
+
ACE_TSS_Emulation::ACE_TSS_DESTRUCTOR
ACE_TSS_Emulation::tss_destructor_[ACE_TSS_Emulation::ACE_TSS_THREAD_KEYS_MAX]
= { 0 };
+
# if defined (ACE_HAS_THREAD_SPECIFIC_STORAGE)
+
bool ACE_TSS_Emulation::key_created_ = false;
+
ACE_OS_thread_key_t ACE_TSS_Emulation::native_tss_key_;
+
/* static */
# if defined (ACE_HAS_THR_C_FUNC)
extern "C"
@@ -112,15 +132,18 @@ ACE_TSS_Emulation_cleanup (void *ptr)
// cleanup
}
# endif /* ACE_HAS_THR_C_FUNC */
+
void **
ACE_TSS_Emulation::tss_base (void* ts_storage[], u_int *ts_created)
{
// TSS Singleton implementation.
+
// Create the one native TSS key, if necessary.
if (!key_created_)
{
// Double-checked lock . . .
ACE_TSS_BASE_GUARD
+
if (!key_created_)
{
ACE_NO_HEAP_CHECK;
@@ -133,7 +156,9 @@ ACE_TSS_Emulation::tss_base (void* ts_storage[], u_int *ts_created)
key_created_ = true;
}
}
+
void **old_ts_storage = 0;
+
// Get the tss_storage from thread-OS specific storage.
if (ACE_OS::thr_getspecific_native (native_tss_key_,
(void **) &old_ts_storage) == -1)
@@ -141,12 +166,14 @@ ACE_TSS_Emulation::tss_base (void* ts_storage[], u_int *ts_created)
ACE_ASSERT (false);
return 0; // This should not happen!
}
+
// Check to see if this is the first time in for this thread.
// This block can also be entered after a fork () in the child process.
if (old_ts_storage == 0)
{
if (ts_created)
*ts_created = 1u;
+
// Use the ts_storage passed as argument, if non-zero. It is
// possible that this has been implemented in the stack. At the
// moment, this is unknown. The cleanup must not do nothing.
@@ -155,18 +182,22 @@ ACE_TSS_Emulation::tss_base (void* ts_storage[], u_int *ts_created)
if (ts_storage == 0)
{
ACE_NO_HEAP_CHECK;
+
ACE_NEW_RETURN (ts_storage,
void*[ACE_TSS_THREAD_KEYS_MAX],
0);
+
// Zero the entire TSS array. Do it manually instead of
// using memset, for optimum speed. Though, memset may be
// faster :-)
void **tss_base_p = ts_storage;
+
for (u_int i = 0;
i < ACE_TSS_THREAD_KEYS_MAX;
++i)
*tss_base_p++ = 0;
}
+
// Store the pointer in thread-specific storage. It gets
// deleted via the ACE_TSS_Emulation_cleanup function when the
// thread terminates.
@@ -180,9 +211,11 @@ ACE_TSS_Emulation::tss_base (void* ts_storage[], u_int *ts_created)
else
if (ts_created)
ts_created = 0;
+
return ts_storage ? ts_storage : old_ts_storage;
}
# endif /* ACE_HAS_THREAD_SPECIFIC_STORAGE */
+
u_int
ACE_TSS_Emulation::total_keys ()
{
@@ -190,8 +223,10 @@ ACE_TSS_Emulation::total_keys ()
*static_cast <ACE_recursive_thread_mutex_t *>
(ACE_OS_Object_Manager::preallocated_object[
ACE_OS_Object_Manager::ACE_TSS_KEY_LOCK]));
+
return total_keys_;
}
+
int
ACE_TSS_Emulation::next_key (ACE_thread_key_t &key)
{
@@ -199,11 +234,13 @@ ACE_TSS_Emulation::next_key (ACE_thread_key_t &key)
*static_cast <ACE_recursive_thread_mutex_t *>
(ACE_OS_Object_Manager::preallocated_object[
ACE_OS_Object_Manager::ACE_TSS_KEY_LOCK]));
+
// Initialize the tss_keys_used_ pointer on first use.
if (tss_keys_used_ == 0)
{
ACE_NEW_RETURN (tss_keys_used_, ACE_TSS_Keys, -1);
}
+
if (total_keys_ < ACE_TSS_THREAD_KEYS_MAX)
{
u_int counter = 0;
@@ -226,6 +263,7 @@ ACE_TSS_Emulation::next_key (ACE_thread_key_t &key)
break;
}
}
+
++total_keys_;
return 0;
}
@@ -235,6 +273,7 @@ ACE_TSS_Emulation::next_key (ACE_thread_key_t &key)
return -1;
}
}
+
int
ACE_TSS_Emulation::release_key (ACE_thread_key_t key)
{
@@ -242,6 +281,7 @@ ACE_TSS_Emulation::release_key (ACE_thread_key_t key)
*static_cast <ACE_recursive_thread_mutex_t *>
(ACE_OS_Object_Manager::preallocated_object[
ACE_OS_Object_Manager::ACE_TSS_KEY_LOCK]));
+
if (tss_keys_used_ != 0 &&
tss_keys_used_->test_and_clear (key) == 0)
{
@@ -250,6 +290,7 @@ ACE_TSS_Emulation::release_key (ACE_thread_key_t key)
}
return 1;
}
+
int
ACE_TSS_Emulation::is_key (ACE_thread_key_t key)
{
@@ -257,6 +298,7 @@ ACE_TSS_Emulation::is_key (ACE_thread_key_t key)
*static_cast <ACE_recursive_thread_mutex_t *>
(ACE_OS_Object_Manager::preallocated_object[
ACE_OS_Object_Manager::ACE_TSS_KEY_LOCK]));
+
if (tss_keys_used_ != 0 &&
tss_keys_used_->is_set (key) == 1)
{
@@ -264,6 +306,7 @@ ACE_TSS_Emulation::is_key (ACE_thread_key_t key)
}
return 0;
}
+
void *
ACE_TSS_Emulation::tss_open (void *ts_storage[ACE_TSS_THREAD_KEYS_MAX])
{
@@ -272,6 +315,7 @@ ACE_TSS_Emulation::tss_open (void *ts_storage[ACE_TSS_THREAD_KEYS_MAX])
// is 0. It isn't always, specifically, when a program is run
// directly by the shell (without spawning a new task) after
// another program has been run.
+
u_int ts_created = 0;
tss_base (ts_storage, &ts_created);
if (ts_created)
@@ -279,6 +323,7 @@ ACE_TSS_Emulation::tss_open (void *ts_storage[ACE_TSS_THREAD_KEYS_MAX])
# else /* ! ACE_HAS_THREAD_SPECIFIC_STORAGE */
tss_base () = ts_storage;
# endif
+
// Zero the entire TSS array. Do it manually instead of using
// memset, for optimum speed. Though, memset may be faster :-)
void **tss_base_p = tss_base ();
@@ -286,6 +331,7 @@ ACE_TSS_Emulation::tss_open (void *ts_storage[ACE_TSS_THREAD_KEYS_MAX])
{
*tss_base_p = 0;
}
+
return tss_base ();
# if defined (ACE_HAS_THREAD_SPECIFIC_STORAGE)
}
@@ -295,6 +341,7 @@ ACE_TSS_Emulation::tss_open (void *ts_storage[ACE_TSS_THREAD_KEYS_MAX])
}
# endif /* ACE_HAS_THREAD_SPECIFIC_STORAGE */
}
+
void
ACE_TSS_Emulation::tss_close ()
{
@@ -302,39 +349,52 @@ ACE_TSS_Emulation::tss_close ()
ACE_OS::thr_keyfree_native (native_tss_key_);
#endif /* ACE_HAS_THREAD_SPECIFIC_STORAGE */
}
+
#endif /* ACE_HAS_TSS_EMULATION */
+
#endif /* WIN32 || ACE_HAS_TSS_EMULATION */
+
/*****************************************************************************/
+
#if defined (ACE_WIN32) || defined (ACE_HAS_TSS_EMULATION)
+
// Moved class ACE_TSS_Ref declaration to OS.h so it can be visible to
// the single file of template instantiations.
+
ACE_TSS_Ref::ACE_TSS_Ref (ACE_thread_t id)
: tid_(id)
{
ACE_OS_TRACE ("ACE_TSS_Ref::ACE_TSS_Ref");
}
+
ACE_TSS_Ref::ACE_TSS_Ref (void)
{
ACE_OS_TRACE ("ACE_TSS_Ref::ACE_TSS_Ref");
}
+
// Check for equality.
bool
ACE_TSS_Ref::operator== (const ACE_TSS_Ref &info) const
{
ACE_OS_TRACE ("ACE_TSS_Ref::operator==");
+
return this->tid_ == info.tid_;
}
+
// Check for inequality.
ACE_SPECIAL_INLINE
bool
ACE_TSS_Ref::operator != (const ACE_TSS_Ref &tss_ref) const
{
ACE_OS_TRACE ("ACE_TSS_Ref::operator !=");
+
return !(*this == tss_ref);
}
+
// moved class ACE_TSS_Info declaration
// to OS.h so it can be visible to the
// single file of template instantiations
+
ACE_TSS_Info::ACE_TSS_Info (ACE_thread_key_t key,
ACE_TSS_Info::Destructor dest)
: key_ (key),
@@ -343,6 +403,7 @@ ACE_TSS_Info::ACE_TSS_Info (ACE_thread_key_t key,
{
ACE_OS_TRACE ("ACE_TSS_Info::ACE_TSS_Info");
}
+
ACE_TSS_Info::ACE_TSS_Info (void)
: key_ (ACE_OS::NULL_key),
destructor_ (0),
@@ -350,37 +411,45 @@ ACE_TSS_Info::ACE_TSS_Info (void)
{
ACE_OS_TRACE ("ACE_TSS_Info::ACE_TSS_Info");
}
+
# if defined (ACE_HAS_NONSCALAR_THREAD_KEY_T)
static inline bool operator== (const ACE_thread_key_t &lhs,
const ACE_thread_key_t &rhs)
{
return ! ACE_OS::memcmp (&lhs, &rhs, sizeof (ACE_thread_key_t));
}
+
static inline bool operator!= (const ACE_thread_key_t &lhs,
const ACE_thread_key_t &rhs)
{
return ! (lhs == rhs);
}
# endif /* ACE_HAS_NONSCALAR_THREAD_KEY_T */
+
// Check for equality.
bool
ACE_TSS_Info::operator== (const ACE_TSS_Info &info) const
{
ACE_OS_TRACE ("ACE_TSS_Info::operator==");
+
return this->key_ == info.key_;
}
+
// Check for inequality.
bool
ACE_TSS_Info::operator != (const ACE_TSS_Info &info) const
{
ACE_OS_TRACE ("ACE_TSS_Info::operator !=");
+
return !(*this == info);
}
+
void
ACE_TSS_Info::dump (void)
{
# if defined (ACE_HAS_DUMP)
// ACE_OS_TRACE ("ACE_TSS_Info::dump");
+
# if 0
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("key_ = %u\n"), this->key_));
@@ -389,8 +458,10 @@ ACE_TSS_Info::dump (void)
# endif /* 0 */
# endif /* ACE_HAS_DUMP */
}
+
// Moved class ACE_TSS_Keys declaration to OS.h so it can be visible
// to the single file of template instantiations.
+
ACE_TSS_Keys::ACE_TSS_Keys (void)
{
for (u_int i = 0; i < ACE_WORDS; ++i)
@@ -398,6 +469,7 @@ ACE_TSS_Keys::ACE_TSS_Keys (void)
key_bit_words_[i] = 0;
}
}
+
ACE_SPECIAL_INLINE
void
ACE_TSS_Keys::find (const u_int key, u_int &word, u_int &bit)
@@ -405,12 +477,14 @@ ACE_TSS_Keys::find (const u_int key, u_int &word, u_int &bit)
word = key / ACE_BITS_PER_WORD;
bit = key % ACE_BITS_PER_WORD;
}
+
int
ACE_TSS_Keys::test_and_set (const ACE_thread_key_t key)
{
ACE_KEY_INDEX (key_index, key);
u_int word, bit;
find (key_index, word, bit);
+
if (ACE_BIT_ENABLED (key_bit_words_[word], 1 << bit))
{
return 1;
@@ -421,12 +495,14 @@ ACE_TSS_Keys::test_and_set (const ACE_thread_key_t key)
return 0;
}
}
+
int
ACE_TSS_Keys::test_and_clear (const ACE_thread_key_t key)
{
ACE_KEY_INDEX (key_index, key);
u_int word, bit;
find (key_index, word, bit);
+
if (word < ACE_WORDS && ACE_BIT_ENABLED (key_bit_words_[word], 1 << bit))
{
ACE_CLR_BITS (key_bit_words_[word], 1 << bit);
@@ -437,14 +513,17 @@ ACE_TSS_Keys::test_and_clear (const ACE_thread_key_t key)
return 1;
}
}
+
int
ACE_TSS_Keys::is_set (const ACE_thread_key_t key) const
{
ACE_KEY_INDEX (key_index, key);
u_int word, bit;
find (key_index, word, bit);
+
return word < ACE_WORDS ? ACE_BIT_ENABLED (key_bit_words_[word], 1 << bit) : 0;
}
+
/**
* @class ACE_TSS_Cleanup
* @brief Singleton that helps to manage the lifetime of TSS objects and keys.
@@ -456,21 +535,27 @@ public:
/// @param key the key to be monitored
/// @param destructor the function to call to delete objects stored via this key
int insert (ACE_thread_key_t key, void (*destructor)(void *));
+
/// Mark a key as being used by this thread.
void thread_use_key (ACE_thread_key_t key);
+
/// This thread is no longer using this key
/// call destructor if appropriate
int thread_detach_key (ACE_thread_key_t key);
+
/// This key is no longer used
/// Release key if use count == 0
/// fail if use_count != 0;
/// @param key the key to be released
int free_key (ACE_thread_key_t key);
+
/// Cleanup the thread-specific objects. Does _NOT_ exit the thread.
/// For each used key perform the same actions as free_key.
void thread_exit (void);
+
private:
void dump (void);
+
/// Release a key used by this thread
/// @param info reference to the info for this key
/// @param destructor out arg to receive destructor function ptr
@@ -479,27 +564,35 @@ private:
ACE_TSS_Info &info,
ACE_TSS_Info::Destructor & destructor,
void *& tss_obj);
+
/// remove key if it's unused (thread_count == 0)
/// @param info reference to the info for this key
int remove_key (ACE_TSS_Info &info);
+
/// Find the TSS keys (if any) for this thread.
/// @param thread_keys reference to pointer to be filled in by this function.
/// @return false if keys don't exist.
bool find_tss_keys (ACE_TSS_Keys *& thread_keys) const;
+
/// Accessor for this threads ACE_TSS_Keys instance.
/// Creates the keys if necessary.
ACE_TSS_Keys *tss_keys ();
+
/// Ensure singleton.
ACE_TSS_Cleanup (void);
~ACE_TSS_Cleanup (void);
+
/// ACE_TSS_Cleanup access only via TSS_Cleanup_Instance
friend class TSS_Cleanup_Instance;
+
private:
// Array of <ACE_TSS_Info> objects.
typedef ACE_TSS_Info ACE_TSS_TABLE[ACE_DEFAULT_THREAD_KEYS];
typedef ACE_TSS_Info *ACE_TSS_TABLE_ITERATOR;
+
/// Table of <ACE_TSS_Info>'s.
ACE_TSS_TABLE table_;
+
/// Key for the thread-specific ACE_TSS_Keys
/// Used by find_tss_keys() or tss_keys() to find the
/// bit array that records whether each TSS key is in
@@ -507,6 +600,7 @@ private:
ACE_thread_key_t in_use_;
};
+
/*****************************************************************************/
/**
* @class TSS_Cleanup_Instance
@@ -524,6 +618,7 @@ private:
* DESTROY means provide exclusive access to the ACE_TSS_Cleanup, then
* delete it when the TSS_Cleanup_Instance goes out of scope.
*/
+
class TSS_Cleanup_Instance
{
public:
@@ -535,15 +630,20 @@ public:
};
TSS_Cleanup_Instance (Purpose purpose = USE);
~TSS_Cleanup_Instance();
+
bool valid();
ACE_TSS_Cleanup * operator ->();
+
private:
+
ACE_TSS_Cleanup * operator *();
+
private:
static unsigned int reference_count_;
static ACE_TSS_Cleanup * instance_;
static ACE_Thread_Mutex* mutex_;
static ACE_Thread_Condition<ACE_Thread_Mutex>* condition_;
+
private:
ACE_TSS_Cleanup * ptr_;
unsigned short flags_;
@@ -553,6 +653,7 @@ private:
FLAG_VALID_CHECKED = 2
};
};
+
TSS_Cleanup_Instance::TSS_Cleanup_Instance (Purpose purpose)
: ptr_(0)
, flags_(0)
@@ -566,7 +667,9 @@ TSS_Cleanup_Instance::TSS_Cleanup_Instance (Purpose purpose)
ACE_NEW (mutex_, ACE_Thread_Mutex ());
ACE_NEW (condition_, ACE_Thread_Condition<ACE_Thread_Mutex> (*mutex_));
}
+
ACE_Guard<ACE_Thread_Mutex> guard(*mutex_);
+
if (purpose == CREATE)
{
if (instance_ == 0)
@@ -599,11 +702,13 @@ TSS_Cleanup_Instance::TSS_Cleanup_Instance (Purpose purpose)
}
}
}
+
TSS_Cleanup_Instance::~TSS_Cleanup_Instance (void)
{
// Variable to hold the mutex_ to delete outside the scope of the
// guard.
ACE_Thread_Mutex *del_mutex = 0;
+
// scope the guard
{
ACE_Guard<ACE_Thread_Mutex> guard (*mutex_);
@@ -626,6 +731,7 @@ TSS_Cleanup_Instance::~TSS_Cleanup_Instance (void)
}
}
}// end of guard scope
+
if (del_mutex != 0)
{
delete condition_;
@@ -633,32 +739,38 @@ TSS_Cleanup_Instance::~TSS_Cleanup_Instance (void)
delete del_mutex;
}
}
+
bool
TSS_Cleanup_Instance::valid()
{
ACE_SET_BITS(flags_, FLAG_VALID_CHECKED);
return (this->instance_ != 0);
}
+
ACE_TSS_Cleanup *
TSS_Cleanup_Instance::operator *()
{
ACE_ASSERT(ACE_BIT_ENABLED(flags_, FLAG_VALID_CHECKED));
return instance_;
}
+
ACE_TSS_Cleanup *
TSS_Cleanup_Instance::operator ->()
{
ACE_ASSERT(ACE_BIT_ENABLED(flags_, FLAG_VALID_CHECKED));
return instance_;
}
+
// = Static object initialization.
unsigned int TSS_Cleanup_Instance::reference_count_ = 0;
ACE_TSS_Cleanup * TSS_Cleanup_Instance::instance_ = 0;
ACE_Thread_Mutex* TSS_Cleanup_Instance::mutex_ = 0;
ACE_Thread_Condition<ACE_Thread_Mutex>* TSS_Cleanup_Instance::condition_ = 0;
+
ACE_TSS_Cleanup::~ACE_TSS_Cleanup (void)
{
}
+
void
ACE_TSS_Cleanup::thread_exit (void)
{
@@ -671,15 +783,18 @@ ACE_TSS_Cleanup::thread_exit (void)
ACE_thread_key_t keys[ACE_DEFAULT_THREAD_KEYS];
// count of items to be destroyed
unsigned int d_count = 0;
+
// scope the guard
{
ACE_TSS_CLEANUP_GUARD
+
// if not initialized or already cleaned up
ACE_TSS_Keys *this_thread_keys = 0;
if (! find_tss_keys (this_thread_keys) )
{
return;
}
+
// Minor hack: Iterating in reverse order means the LOG buffer which is
// accidentally allocated first will be accidentally deallocated (almost)
// last -- in case someone logs something from the other destructors.
@@ -708,6 +823,7 @@ ACE_TSS_Cleanup::thread_exit (void)
}
}
}
+
// remove the in_use bit vector last
ACE_KEY_INDEX (use_index, this->in_use_);
ACE_TSS_Info & info = this->table_[use_index];
@@ -731,22 +847,26 @@ ACE_TSS_Cleanup::thread_exit (void)
#endif // defined (ACE_HAS_TSS_EMULATION)
}
}
+
extern "C" void
ACE_TSS_Cleanup_keys_destroyer (void *tss_keys)
{
delete static_cast <ACE_TSS_Keys *> (tss_keys);
}
+
ACE_TSS_Cleanup::ACE_TSS_Cleanup (void)
: in_use_ (ACE_OS::NULL_key)
{
ACE_OS_TRACE ("ACE_TSS_Cleanup::ACE_TSS_Cleanup");
}
+
int
ACE_TSS_Cleanup::insert (ACE_thread_key_t key,
void (*destructor)(void *))
{
ACE_OS_TRACE ("ACE_TSS_Cleanup::insert");
ACE_TSS_CLEANUP_GUARD
+
ACE_KEY_INDEX (key_index, key);
ACE_ASSERT (key_index < ACE_DEFAULT_THREAD_KEYS);
if (key_index < ACE_DEFAULT_THREAD_KEYS)
@@ -762,6 +882,7 @@ ACE_TSS_Cleanup::insert (ACE_thread_key_t key,
return -1;
}
}
+
int
ACE_TSS_Cleanup::free_key (ACE_thread_key_t key)
{
@@ -774,20 +895,24 @@ ACE_TSS_Cleanup::free_key (ACE_thread_key_t key)
}
return -1;
}
+
int
ACE_TSS_Cleanup::remove_key (ACE_TSS_Info &info)
{
// assume CLEANUP_GUARD is held by caller
ACE_OS_TRACE ("ACE_TSS_Cleanup::remove_key");
+
#if 0 // This was a good idea, but POSIX says it's legal to delete used keys.
// When this is done, any existing TSS objects controlled by this key are leaked
// There is no "right thing" to do in this case
+
// only remove it if all threads are done with it
if (info.thread_count_ != 0)
{
return -1;
}
#endif // 0
+
#if !defined (ACE_HAS_TSS_EMULATION)
ACE_OS_thread_key_t temp_key = info.key_;
ACE_OS::thr_keyfree_native (temp_key);
@@ -800,6 +925,7 @@ ACE_TSS_Cleanup::remove_key (ACE_TSS_Info &info)
info.destructor_ = 0;
return 0;
}
+
int
ACE_TSS_Cleanup::thread_detach_key (ACE_thread_key_t key)
{
@@ -807,18 +933,22 @@ ACE_TSS_Cleanup::thread_detach_key (ACE_thread_key_t key)
// the actual call is deferred until the guard is released
ACE_TSS_Info::Destructor destructor = 0;
void * tss_obj = 0;
+
// scope the guard
{
ACE_TSS_CLEANUP_GUARD
+
ACE_KEY_INDEX (key_index, key);
ACE_ASSERT (key_index < sizeof(this->table_)/sizeof(this->table_[0])
&& this->table_[key_index].key_ == key);
ACE_TSS_Info &info = this->table_ [key_index];
+
// sanity check
if (!info.key_in_use ())
{
return -1;
}
+
this->thread_release (info, destructor, tss_obj);
} // end of scope for the Guard
// if there's a destructor and an object to be destroyed
@@ -828,6 +958,7 @@ ACE_TSS_Cleanup::thread_detach_key (ACE_thread_key_t key)
}
return 0;
}
+
void
ACE_TSS_Cleanup::thread_release (
ACE_TSS_Info &info,
@@ -852,6 +983,7 @@ ACE_TSS_Cleanup::thread_release (
}
}
}
+
void
ACE_TSS_Cleanup::thread_use_key (ACE_thread_key_t key)
{
@@ -860,18 +992,22 @@ ACE_TSS_Cleanup::thread_use_key (ACE_thread_key_t key)
if (! tss_keys ()->test_and_set (key))
{
ACE_TSS_CLEANUP_GUARD
+
// Retrieve the key's ACE_TSS_Info and increment its thread_count_.
ACE_KEY_INDEX (key_index, key);
ACE_TSS_Info &key_info = this->table_ [key_index];
+
ACE_ASSERT (key_info.key_in_use ());
++key_info.thread_count_;
}
}
+
void
ACE_TSS_Cleanup::dump (void)
{
# if defined (ACE_HAS_DUMP)
// Iterate through all the thread-specific items and dump them all.
+
ACE_TSS_TABLE_ITERATOR key_info = table_;
for (unsigned int i = 0;
i < ACE_DEFAULT_THREAD_KEYS;
@@ -879,6 +1015,7 @@ ACE_TSS_Cleanup::dump (void)
key_info->dump ();
# endif /* ACE_HAS_DUMP */
}
+
bool
ACE_TSS_Cleanup::find_tss_keys (ACE_TSS_Keys *& tss_keys) const
{
@@ -892,6 +1029,7 @@ ACE_TSS_Cleanup::find_tss_keys (ACE_TSS_Keys *& tss_keys) const
}
return tss_keys != 0;
}
+
ACE_TSS_Keys *
ACE_TSS_Cleanup::tss_keys ()
{
@@ -910,12 +1048,14 @@ ACE_TSS_Cleanup::tss_keys ()
}
}
}
+
void *ts_keys = 0;
if (ACE_OS::thr_getspecific (in_use_, &ts_keys) == -1)
{
ACE_ASSERT (false);
return 0; // This should not happen!
}
+
if (ts_keys == 0)
{
ACE_NEW_RETURN (ts_keys,
@@ -930,11 +1070,16 @@ ACE_TSS_Cleanup::tss_keys ()
return 0; // Major problems, this should *never* happen!
}
}
+
return reinterpret_cast <ACE_TSS_Keys*>(ts_keys);
}
+
#endif /* ACE_WIN32 || ACE_HAS_TSS_EMULATION */
+
/*****************************************************************************/
+
// = Static initialization.
+
// This is necessary to deal with POSIX pthreads insanity. This
// guarantees that we've got a "zero'd" thread id even when
// ACE_thread_t, ACE_hthread_t, and ACE_thread_key_t are implemented
@@ -948,7 +1093,9 @@ ACE_hthread_t ACE_OS::NULL_hthread;
#else /* ! ACE_HAS_TSS_EMULATION */
ACE_thread_key_t ACE_OS::NULL_key;
#endif /* ! ACE_HAS_TSS_EMULATION */
+
/*****************************************************************************/
+
void
ACE_OS::cleanup_tss (const u_int main_thread)
{
@@ -962,6 +1109,7 @@ ACE_OS::cleanup_tss (const u_int main_thread)
}
}
#endif /* ACE_HAS_TSS_EMULATION || ACE_WIN32 */
+
if (main_thread)
{
#if !defined (ACE_HAS_TSS_EMULATION) && !defined (ACE_HAS_MINIMAL_ACE_OS)
@@ -971,6 +1119,7 @@ ACE_OS::cleanup_tss (const u_int main_thread)
// exits.
ACE_Base_Thread_Adapter::close_log_msg ();
#endif /* ! ACE_HAS_TSS_EMULATION && ! ACE_HAS_MINIMAL_ACE_OS */
+
#if defined (ACE_WIN32) || defined (ACE_HAS_TSS_EMULATION)
// Finally, free up the ACE_TSS_Cleanup instance. This method gets
// called by the ACE_Object_Manager.
@@ -979,19 +1128,24 @@ ACE_OS::cleanup_tss (const u_int main_thread)
{
; // the pointer deletes the Cleanup when it goes out of scope
}
+
#endif /* WIN32 || ACE_HAS_TSS_EMULATION */
+
#if defined (ACE_HAS_TSS_EMULATION)
ACE_TSS_Emulation::tss_close ();
#endif /* ACE_HAS_TSS_EMULATION */
}
}
+
/*****************************************************************************/
// CONDITIONS BEGIN
/*****************************************************************************/
+
#if defined (ACE_LACKS_COND_T)
// NOTE: The ACE_OS::cond_* functions for some non-Unix platforms are
// defined here either because they're too big to be inlined, or
// to avoid use before definition if they were inline.
+
// @@ The following functions could be inlined if i could figure where
// to put it among the #ifdefs!
int
@@ -1000,21 +1154,25 @@ ACE_OS::condattr_init (ACE_condattr_t &attributes, int type)
attributes.type = type;
return 0;
}
+
int
ACE_OS::condattr_destroy (ACE_condattr_t &)
{
return 0;
}
+
int
ACE_OS::cond_broadcast (ACE_cond_t *cv)
{
ACE_OS_TRACE ("ACE_OS::cond_broadcast");
# if defined (ACE_HAS_THREADS)
// The <external_mutex> must be locked before this call is made.
+
// This is needed to ensure that <waiters_> and <was_broadcast_> are
// consistent relative to each other.
ACE_OS::thread_mutex_lock (&cv->waiters_lock_);
int have_waiters = 0;
+
if (cv->waiters_ > 0)
{
// We are broadcasting, even if there is just one waiter...
@@ -1049,6 +1207,7 @@ ACE_OS::cond_broadcast (ACE_cond_t *cv)
ACE_NOTSUP_RETURN (-1);
# endif /* ACE_HAS_THREADS */
}
+
int
ACE_OS::cond_destroy (ACE_cond_t *cv)
{
@@ -1066,6 +1225,7 @@ ACE_OS::cond_destroy (ACE_cond_t *cv)
ACE_NOTSUP_RETURN (-1);
# endif /* ACE_HAS_THREADS */
}
+
int
ACE_OS::cond_init (ACE_cond_t *cv,
ACE_condattr_t &attributes,
@@ -1074,6 +1234,7 @@ ACE_OS::cond_init (ACE_cond_t *cv,
return
ACE_OS::cond_init (cv, static_cast<short> (attributes.type), name, arg);
}
+
# if defined (ACE_HAS_WCHAR)
int
ACE_OS::cond_init (ACE_cond_t *cv,
@@ -1084,6 +1245,7 @@ ACE_OS::cond_init (ACE_cond_t *cv,
ACE_OS::cond_init (cv, static_cast<short> (attributes.type), name, arg);
}
# endif /* ACE_HAS_WCHAR */
+
int
ACE_OS::cond_init (ACE_cond_t *cv, short type, const char *name, void *arg)
{
@@ -1091,6 +1253,7 @@ ACE_OS::cond_init (ACE_cond_t *cv, short type, const char *name, void *arg)
# if defined (ACE_HAS_THREADS)
cv->waiters_ = 0;
cv->was_broadcast_ = 0;
+
int result = 0;
if (ACE_OS::sema_init (&cv->sema_, 0, type, name, arg) == -1)
result = -1;
@@ -1111,6 +1274,7 @@ ACE_OS::cond_init (ACE_cond_t *cv, short type, const char *name, void *arg)
ACE_NOTSUP_RETURN (-1);
# endif /* ACE_HAS_THREADS */
}
+
# if defined (ACE_HAS_WCHAR)
int
ACE_OS::cond_init (ACE_cond_t *cv, short type, const wchar_t *name, void *arg)
@@ -1119,6 +1283,7 @@ ACE_OS::cond_init (ACE_cond_t *cv, short type, const wchar_t *name, void *arg)
# if defined (ACE_HAS_THREADS)
cv->waiters_ = 0;
cv->was_broadcast_ = 0;
+
int result = 0;
if (ACE_OS::sema_init (&cv->sema_, 0, type, name, arg) == -1)
result = -1;
@@ -1140,6 +1305,7 @@ ACE_OS::cond_init (ACE_cond_t *cv, short type, const wchar_t *name, void *arg)
# endif /* ACE_HAS_THREADS */
}
# endif /* ACE_HAS_WCHAR */
+
int
ACE_OS::cond_signal (ACE_cond_t *cv)
{
@@ -1154,6 +1320,7 @@ ACE_OS::cond_signal (ACE_cond_t *cv)
ACE_OS::thread_mutex_lock (&cv->waiters_lock_);
int have_waiters = cv->waiters_ > 0;
ACE_OS::thread_mutex_unlock (&cv->waiters_lock_);
+
if (have_waiters != 0)
return ACE_OS::sema_post (&cv->sema_);
else
@@ -1163,6 +1330,7 @@ ACE_OS::cond_signal (ACE_cond_t *cv)
ACE_NOTSUP_RETURN (-1);
# endif /* ACE_HAS_THREADS */
}
+
int
ACE_OS::cond_wait (ACE_cond_t *cv,
ACE_mutex_t *external_mutex)
@@ -1173,7 +1341,9 @@ ACE_OS::cond_wait (ACE_cond_t *cv,
ACE_OS::thread_mutex_lock (&cv->waiters_lock_);
++cv->waiters_;
ACE_OS::thread_mutex_unlock (&cv->waiters_lock_);
+
int result = 0;
+
# if defined (ACE_HAS_SIGNAL_OBJECT_AND_WAIT)
if (external_mutex->type_ == USYNC_PROCESS)
// This call will automatically release the mutex and wait on the semaphore.
@@ -1190,18 +1360,24 @@ ACE_OS::cond_wait (ACE_cond_t *cv,
// ACE_OS::cond_signal().
if (ACE_OS::mutex_unlock (external_mutex) != 0)
return -1;
+
// Wait to be awakened by a ACE_OS::cond_signal() or
// ACE_OS::cond_broadcast().
result = ACE_OS::sema_wait (&cv->sema_);
}
+
// Reacquire lock to avoid race conditions on the <waiters_> count.
ACE_OS::thread_mutex_lock (&cv->waiters_lock_);
+
// We're ready to return, so there's one less waiter.
--cv->waiters_;
+
int last_waiter = cv->was_broadcast_ && cv->waiters_ == 0;
+
// Release the lock so that other collaborating threads can make
// progress.
ACE_OS::thread_mutex_unlock (&cv->waiters_lock_);
+
if (result == -1)
// Bad things happened, so let's just return below.
/* NOOP */;
@@ -1209,6 +1385,7 @@ ACE_OS::cond_wait (ACE_cond_t *cv,
else if (external_mutex->type_ == USYNC_PROCESS)
{
if (last_waiter)
+
// This call atomically signals the <waiters_done_> event and
// waits until it can acquire the mutex. This is important to
// prevent unfairness.
@@ -1222,6 +1399,7 @@ ACE_OS::cond_wait (ACE_cond_t *cv,
// errors occur because that's the guarantee that we give to
// our callers.
ACE_OS::mutex_lock (external_mutex);
+
return result;
/* NOTREACHED */
}
@@ -1234,9 +1412,11 @@ ACE_OS::cond_wait (ACE_cond_t *cv,
# else
ACE_OS::event_signal (&cv->waiters_done_);
# endif /* ACE_VXWORKS */
+
// We must always regain the <external_mutex>, even when errors
// occur because that's the guarantee that we give to our callers.
ACE_OS::mutex_lock (external_mutex);
+
return result;
# else
ACE_UNUSED_ARG (cv);
@@ -1244,6 +1424,7 @@ ACE_OS::cond_wait (ACE_cond_t *cv,
ACE_NOTSUP_RETURN (-1);
# endif /* ACE_HAS_THREADS */
}
+
int
ACE_OS::cond_timedwait (ACE_cond_t *cv,
ACE_mutex_t *external_mutex,
@@ -1255,13 +1436,16 @@ ACE_OS::cond_timedwait (ACE_cond_t *cv,
if (timeout == 0)
return ACE_OS::cond_wait (cv, external_mutex);
# if defined (ACE_HAS_WTHREADS) || defined (ACE_VXWORKS)
+
// Prevent race conditions on the <waiters_> count.
ACE_OS::thread_mutex_lock (&cv->waiters_lock_);
cv->waiters_++;
ACE_OS::thread_mutex_unlock (&cv->waiters_lock_);
+
int result = 0;
ACE_Errno_Guard error (errno, 0);
int msec_timeout;
+
if (timeout->sec () == 0 && timeout->usec () == 0)
msec_timeout = 0; // Do a "poll."
else
@@ -1270,6 +1454,7 @@ ACE_OS::cond_timedwait (ACE_cond_t *cv,
// passed as a parameter) and relative time (which is what
// WaitForSingleObjects() expects).
ACE_Time_Value relative_time (*timeout - ACE_OS::gettimeofday ());
+
// Watchout for situations where a context switch has caused the
// current time to be > the timeout.
if (relative_time < ACE_Time_Value::zero)
@@ -1277,6 +1462,7 @@ ACE_OS::cond_timedwait (ACE_cond_t *cv,
else
msec_timeout = relative_time.msec ();
}
+
# if defined (ACE_HAS_SIGNAL_OBJECT_AND_WAIT)
if (external_mutex->type_ == USYNC_PROCESS)
// This call will automatically release the mutex and wait on the
@@ -1294,6 +1480,7 @@ ACE_OS::cond_timedwait (ACE_cond_t *cv,
// other calls to ACE_OS::cond_signal().
if (ACE_OS::mutex_unlock (external_mutex) != 0)
return -1;
+
// Wait to be awakened by a ACE_OS::signal() or
// ACE_OS::broadcast().
# if defined (ACE_WIN32)
@@ -1312,11 +1499,15 @@ ACE_OS::cond_timedwait (ACE_cond_t *cv,
result = ::semTake (cv->sema_.sema_, ticks);
# endif /* ACE_WIN32 || VXWORKS */
}
+
// Reacquire lock to avoid race conditions.
ACE_OS::thread_mutex_lock (&cv->waiters_lock_);
cv->waiters_--;
+
int last_waiter = cv->was_broadcast_ && cv->waiters_ == 0;
+
ACE_OS::thread_mutex_unlock (&cv->waiters_lock_);
+
# if defined (ACE_WIN32)
if (result != WAIT_OBJECT_0)
{
@@ -1367,6 +1558,7 @@ ACE_OS::cond_timedwait (ACE_cond_t *cv,
// errors occur because that's the guarantee that we give to
// our callers.
ACE_OS::mutex_lock (external_mutex);
+
return result;
/* NOTREACHED */
}
@@ -1381,9 +1573,11 @@ ACE_OS::cond_timedwait (ACE_cond_t *cv,
# else
ACE_OS::sema_post (&cv->waiters_done_);
# endif /* ACE_WIN32 */
+
// We must always regain the <external_mutex>, even when errors
// occur because that's the guarantee that we give to our callers.
ACE_OS::mutex_lock (external_mutex);
+
return result;
# endif /* ACE_HAS_WTHREADS || ACE_HAS_VXWORKS */
# else
@@ -1393,6 +1587,7 @@ ACE_OS::cond_timedwait (ACE_cond_t *cv,
ACE_NOTSUP_RETURN (-1);
# endif /* ACE_HAS_THREADS */
}
+
# if defined (ACE_HAS_WTHREADS)
int
ACE_OS::cond_timedwait (ACE_cond_t *cv,
@@ -1404,13 +1599,16 @@ ACE_OS::cond_timedwait (ACE_cond_t *cv,
// Handle the easy case first.
if (timeout == 0)
return ACE_OS::cond_wait (cv, external_mutex);
+
// Prevent race conditions on the <waiters_> count.
ACE_OS::thread_mutex_lock (&cv->waiters_lock_);
cv->waiters_++;
ACE_OS::thread_mutex_unlock (&cv->waiters_lock_);
+
int result = 0;
int error = 0;
int msec_timeout;
+
if (timeout->sec () == 0 && timeout->usec () == 0)
msec_timeout = 0; // Do a "poll."
else
@@ -1419,6 +1617,7 @@ ACE_OS::cond_timedwait (ACE_cond_t *cv,
// passed as a parameter) and relative time (which is what
// WaitForSingleObjects() expects).
ACE_Time_Value relative_time (*timeout - ACE_OS::gettimeofday ());
+
// Watchout for situations where a context switch has caused the
// current time to be > the timeout.
if (relative_time < ACE_Time_Value::zero)
@@ -1426,27 +1625,35 @@ ACE_OS::cond_timedwait (ACE_cond_t *cv,
else
msec_timeout = relative_time.msec ();
}
+
// We keep the lock held just long enough to increment the count of
// waiters by one. Note that we can't keep it held across the call
// to WaitForSingleObject since that will deadlock other calls to
// ACE_OS::cond_signal().
if (ACE_OS::thread_mutex_unlock (external_mutex) != 0)
return -1;
+
// Wait to be awakened by a ACE_OS::signal() or ACE_OS::broadcast().
# if defined (ACE_USES_WINCE_SEMA_SIMULATION)
// Can't use Win32 API on simulated semaphores.
result = ACE_OS::sema_wait (&cv->sema_,
timeout);
+
if (result == -1 && errno == ETIME)
result = WAIT_TIMEOUT;
# else
result = ::WaitForSingleObject (cv->sema_, msec_timeout);
# endif /* ACE_USES_WINCE_SEMA_SIMULATION */
+
// Reacquire lock to avoid race conditions.
ACE_OS::thread_mutex_lock (&cv->waiters_lock_);
+
cv->waiters_--;
+
int last_waiter = cv->was_broadcast_ && cv->waiters_ == 0;
+
ACE_OS::thread_mutex_unlock (&cv->waiters_lock_);
+
if (result != WAIT_OBJECT_0)
{
switch (result)
@@ -1460,9 +1667,11 @@ ACE_OS::cond_timedwait (ACE_cond_t *cv,
}
result = -1;
}
+
if (last_waiter)
// Release the signaler/broadcaster if we're the last waiter.
ACE_OS::event_signal (&cv->waiters_done_);
+
// We must always regain the <external_mutex>, even when errors
// occur because that's the guarantee that we give to our callers.
ACE_OS::thread_mutex_lock (external_mutex);
@@ -1472,6 +1681,7 @@ ACE_OS::cond_timedwait (ACE_cond_t *cv,
ACE_NOTSUP_RETURN (-1);
# endif /* ACE_HAS_THREADS */
}
+
int
ACE_OS::cond_wait (ACE_cond_t *cv,
ACE_thread_mutex_t *external_mutex)
@@ -1481,14 +1691,17 @@ ACE_OS::cond_wait (ACE_cond_t *cv,
ACE_OS::thread_mutex_lock (&cv->waiters_lock_);
cv->waiters_++;
ACE_OS::thread_mutex_unlock (&cv->waiters_lock_);
+
int result = 0;
int error = 0;
+
// We keep the lock held just long enough to increment the count of
// waiters by one. Note that we can't keep it held across the call
// to ACE_OS::sema_wait() since that will deadlock other calls to
// ACE_OS::cond_signal().
if (ACE_OS::thread_mutex_unlock (external_mutex) != 0)
return -1;
+
// Wait to be awakened by a ACE_OS::cond_signal() or
// ACE_OS::cond_broadcast().
# if !defined (ACE_USES_WINCE_SEMA_SIMULATION)
@@ -1496,14 +1709,21 @@ ACE_OS::cond_wait (ACE_cond_t *cv,
# else
// Can't use Win32 API on simulated semaphores.
result = ACE_OS::sema_wait (&cv->sema_);
+
if (result != WAIT_OBJECT_0 && errno == ETIME)
result = WAIT_TIMEOUT;
+
# endif /* ACE_USES_WINCE_SEMA_SIMULATION */
+
// Reacquire lock to avoid race conditions.
ACE_OS::thread_mutex_lock (&cv->waiters_lock_);
+
cv->waiters_--;
+
int last_waiter = cv->was_broadcast_ && cv->waiters_ == 0;
+
ACE_OS::thread_mutex_unlock (&cv->waiters_lock_);
+
if (result != WAIT_OBJECT_0)
{
switch (result)
@@ -1519,9 +1739,11 @@ ACE_OS::cond_wait (ACE_cond_t *cv,
else if (last_waiter)
// Release the signaler/broadcaster if we're the last waiter.
ACE_OS::event_signal (&cv->waiters_done_);
+
// We must always regain the <external_mutex>, even when errors
// occur because that's the guarantee that we give to our callers.
ACE_OS::thread_mutex_lock (external_mutex);
+
// Reset errno in case mutex_lock() also fails...
errno = error;
return result;
@@ -1544,12 +1766,15 @@ ACE_OS::cond_init (ACE_cond_t *cv, short type, const char *name, void *arg)
return -1;
}
#endif /* ACE_LACKS_COND_T */
+
/*****************************************************************************/
// CONDITIONS END
/*****************************************************************************/
+
/*****************************************************************************/
// MUTEXES BEGIN
/*****************************************************************************/
+
int
ACE_OS::mutex_init (ACE_mutex_t *m,
int lock_scope,
@@ -1563,6 +1788,7 @@ ACE_OS::mutex_init (ACE_mutex_t *m,
# if defined (ACE_HAS_PTHREADS)
ACE_UNUSED_ARG (name);
ACE_UNUSED_ARG (sa);
+
# if defined (ACE_VXWORKS) && (ACE_VXWORKS >= 0x600) && (ACE_VXWORKS <= 0x620)
/* Tests show that VxWorks 6.x pthread lib does not only
* require zeroing of mutex/condition objects to function correctly
@@ -1572,10 +1798,12 @@ ACE_OS::mutex_init (ACE_mutex_t *m,
# else
pthread_mutexattr_t l_attributes;
# endif
+
if (attributes == 0)
attributes = &l_attributes;
int result = 0;
int attr_init = 0; // have we initialized the local attributes.
+
// Only do these initializations if the <attributes> parameter
// wasn't originally set.
if (attributes == &l_attributes)
@@ -1590,6 +1818,7 @@ ACE_OS::mutex_init (ACE_mutex_t *m,
result = -1; // ACE_ADAPT_RETVAL used it for intermediate status
}
}
+
if (result == 0 && lock_scope != 0)
{
# if defined (_POSIX_THREAD_PROCESS_SHARED) && !defined (ACE_LACKS_MUTEXATTR_PSHARED)
@@ -1598,6 +1827,7 @@ ACE_OS::mutex_init (ACE_mutex_t *m,
result);
# endif /* _POSIX_THREAD_PROCESS_SHARED && !ACE_LACKS_MUTEXATTR_PSHARED */
}
+
if (result == 0 && lock_type != 0)
{
# if defined (ACE_HAS_RECURSIVE_MUTEXES)
@@ -1606,6 +1836,7 @@ ACE_OS::mutex_init (ACE_mutex_t *m,
result);
# endif /* ACE_HAS_RECURSIVE_MUTEXES */
}
+
if (result == 0)
{
# if defined (ACE_VXWORKS)&& (ACE_VXWORKS >= 0x600) && (ACE_VXWORKS <= 0x620)
@@ -1623,10 +1854,12 @@ ACE_OS::mutex_init (ACE_mutex_t *m,
else
result = -1; // ACE_ADAPT_RETVAL used it for intermediate status
}
+
// Only do the deletions if the <attributes> parameter wasn't
// originally set.
if (attributes == &l_attributes && attr_init)
::pthread_mutexattr_destroy (&l_attributes);
+
return result;
# elif defined (ACE_HAS_STHREADS)
ACE_UNUSED_ARG (name);
@@ -1640,6 +1873,7 @@ ACE_OS::mutex_init (ACE_mutex_t *m,
int, -1);
# elif defined (ACE_HAS_WTHREADS)
m->type_ = lock_scope;
+
SECURITY_ATTRIBUTES sa_buffer;
SECURITY_DESCRIPTOR sd_buffer;
switch (lock_scope)
@@ -1677,11 +1911,13 @@ ACE_OS::mutex_init (ACE_mutex_t *m,
return -1;
}
/* NOTREACHED */
+
# elif defined (ACE_VXWORKS)
ACE_UNUSED_ARG (name);
ACE_UNUSED_ARG (attributes);
ACE_UNUSED_ARG (sa);
ACE_UNUSED_ARG (lock_type);
+
return (*m = ::semMCreate (lock_scope)) == 0 ? -1 : 0;
# endif /* ACE_HAS_PTHREADS */
#else
@@ -1694,6 +1930,7 @@ ACE_OS::mutex_init (ACE_mutex_t *m,
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_THREADS */
}
+
int
ACE_OS::mutex_destroy (ACE_mutex_t *m)
{
@@ -1728,6 +1965,7 @@ ACE_OS::mutex_destroy (ACE_mutex_t *m)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_THREADS */
}
+
#if defined (ACE_HAS_WCHAR)
int
ACE_OS::mutex_init (ACE_mutex_t *m,
@@ -1759,6 +1997,7 @@ ACE_OS::mutex_init (ACE_mutex_t *m,
name,
attributes);
}
+
errno = EINVAL;
return -1;
#else /* ACE_HAS_THREADS && ACE_HAS_WTHREADS */
@@ -1771,6 +2010,7 @@ ACE_OS::mutex_init (ACE_mutex_t *m,
#endif /* ACE_HAS_THREADS && ACE_HAS_WTHREADS */
}
#endif /* ACE_HAS_WCHAR */
+
int
ACE_OS::mutex_lock (ACE_mutex_t *m)
{
@@ -1818,6 +2058,7 @@ ACE_OS::mutex_lock (ACE_mutex_t *m)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_THREADS */
}
+
int
ACE_OS::mutex_lock (ACE_mutex_t *m,
int &abandoned)
@@ -1856,27 +2097,36 @@ ACE_OS::mutex_lock (ACE_mutex_t *m,
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_THREADS and ACE_HAS_WTHREADS */
}
+
int
ACE_OS::mutex_lock (ACE_mutex_t *m,
const ACE_Time_Value &timeout)
{
#if defined (ACE_HAS_THREADS) && defined (ACE_HAS_MUTEX_TIMEOUTS)
+
# if defined (ACE_HAS_PTHREADS)
int result;
+
// "timeout" should be an absolute time.
+
timespec_t ts = timeout; // Calls ACE_Time_Value::operator timespec_t().
+
// Note that the mutex should not be a recursive one, i.e., it
// should only be a standard mutex or an error checking mutex.
+
ACE_OSCALL (ACE_ADAPT_RETVAL (::pthread_mutex_timedlock (m, &ts), result), int, -1, result);
+
// We need to adjust this to make the errno values consistent.
if (result == -1 && errno == ETIMEDOUT)
errno = ETIME;
return result;
+
# elif defined (ACE_HAS_WTHREADS)
// Note that we must convert between absolute time (which is passed
// as a parameter) and relative time (which is what the system call
// expects).
ACE_Time_Value relative_time (timeout - ACE_OS::gettimeofday ());
+
switch (m->type_)
{
case USYNC_PROCESS:
@@ -1903,12 +2153,16 @@ ACE_OS::mutex_lock (ACE_mutex_t *m,
return -1;
}
/* NOTREACHED */
+
# elif defined (ACE_VXWORKS)
+
// Note that we must convert between absolute time (which is passed
// as a parameter) and relative time (which is what the system call
// expects).
ACE_Time_Value relative_time (timeout - ACE_OS::gettimeofday ());
+
int ticks_per_sec = ::sysClkRateGet ();
+
int ticks = relative_time.sec() * ticks_per_sec +
relative_time.usec () * ticks_per_sec / ACE_ONE_SECOND_IN_USECS;
if (::semTake (*m, ticks) == ERROR)
@@ -1924,12 +2178,14 @@ ACE_OS::mutex_lock (ACE_mutex_t *m,
else
return 0;
# endif /* ACE_HAS_PTHREADS */
+
#else
ACE_UNUSED_ARG (m);
ACE_UNUSED_ARG (timeout);
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_THREADS && ACE_HAS_MUTEX_TIMEOUTS */
}
+
int
ACE_OS::mutex_trylock (ACE_mutex_t *m)
{
@@ -1992,6 +2248,7 @@ ACE_OS::mutex_trylock (ACE_mutex_t *m)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_THREADS */
}
+
int
ACE_OS::mutex_trylock (ACE_mutex_t *m, int &abandoned)
{
@@ -2030,6 +2287,7 @@ ACE_OS::mutex_trylock (ACE_mutex_t *m, int &abandoned)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_THREADS and ACE_HAS_WTHREADS */
}
+
int
ACE_OS::mutex_unlock (ACE_mutex_t *m)
{
@@ -2065,6 +2323,7 @@ ACE_OS::mutex_unlock (ACE_mutex_t *m)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_THREADS */
}
+
void
ACE_OS::mutex_lock_cleanup (void *mutex)
{
@@ -2080,12 +2339,15 @@ ACE_OS::mutex_lock_cleanup (void *mutex)
ACE_UNUSED_ARG (mutex);
#endif /* ACE_HAS_THREADS */
}
+
/*****************************************************************************/
// MUTEXES END
/*****************************************************************************/
+
/*****************************************************************************/
// EVENTS BEGIN
/*****************************************************************************/
+
int
ACE_OS::event_destroy (ACE_event_t *event)
{
@@ -2099,12 +2361,14 @@ ACE_OS::event_destroy (ACE_event_t *event)
// objects because at time of destroy they were just being used in
// another thread possibly causing deadlocks later on if they keep
// being used after we're gone.
+
if (event->eventdata_->type_ == USYNC_PROCESS)
{
if (event->name_)
{
// Only destroy the event data if we're the ones who initialized
// it.
+
int r1, r2;
# if (defined (ACE_HAS_PTHREADS) && defined (_POSIX_THREAD_PROCESS_SHARED) && \
(!defined (ACE_LACKS_MUTEXATTR_PSHARED) || !defined (ACE_LACKS_CONDATTR_PSHARED))) || \
@@ -2120,6 +2384,7 @@ ACE_OS::event_destroy (ACE_event_t *event)
# else
r1 = ACE_OS::sema_destroy(&event->lock_);
# endif
+
# if (defined (ACE_HAS_PTHREADS) && defined (_POSIX_THREAD_PROCESS_SHARED) && !defined (ACE_LACKS_CONDATTR_PSHARED)) || \
(!defined (ACE_USES_FIFO_SEM) && \
(!defined (ACE_HAS_POSIX_SEM) || !defined (ACE_HAS_POSIX_SEM_TIMEOUT) || defined (ACE_LACKS_NAMED_POSIX_SEM)))
@@ -2178,6 +2443,7 @@ ACE_OS::event_destroy (ACE_event_t *event)
# else
r1 = ACE_OS::sema_destroy(&event->lock_);
# endif
+
# if (defined (ACE_HAS_PTHREADS) && defined (_POSIX_THREAD_PROCESS_SHARED) && !defined (ACE_LACKS_CONDATTR_PSHARED)) || \
(!defined (ACE_USES_FIFO_SEM) && \
(!defined (ACE_HAS_POSIX_SEM) || !defined (ACE_HAS_POSIX_SEM_TIMEOUT) || defined (ACE_LACKS_NAMED_POSIX_SEM)))
@@ -2198,12 +2464,14 @@ ACE_OS::event_destroy (ACE_event_t *event)
return r1 != 0 || r2 != 0 ? -1 : 0;
}
}
+
return 0;
#else
ACE_UNUSED_ARG (event);
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_WIN32 */
}
+
int
ACE_OS::event_init (ACE_event_t *event,
int manual_reset,
@@ -2240,6 +2508,7 @@ ACE_OS::event_init (ACE_event_t *event,
ACE_UNUSED_ARG (sa);
event->eventdata_ = 0;
ACE_eventdata_t* evtdata;
+
if (type == USYNC_PROCESS)
{
const char *name_p = 0;
@@ -2282,6 +2551,7 @@ ACE_OS::event_init (ACE_event_t *event,
}
owner = 1;
}
+
evtdata =
(ACE_eventdata_t *) ACE_OS::mmap (0,
sizeof (ACE_eventdata_t),
@@ -2296,6 +2566,7 @@ ACE_OS::event_init (ACE_event_t *event,
ACE_OS::shm_unlink (ACE_TEXT_CHAR_TO_TCHAR (name_p));
return -1;
}
+
if (owner)
{
event->name_ = ACE_OS::strdup (name_p);
@@ -2311,6 +2582,7 @@ ACE_OS::event_init (ACE_event_t *event,
event->eventdata_->auto_event_signaled_ = false;
event->eventdata_->waiting_threads_ = 0;
event->eventdata_->signal_count_ = 0;
+
# if (defined (ACE_HAS_PTHREADS) && defined (_POSIX_THREAD_PROCESS_SHARED) && !defined (ACE_LACKS_CONDATTR_PSHARED)) || \
(!defined (ACE_USES_FIFO_SEM) && \
(!defined (ACE_HAS_POSIX_SEM) || !defined (ACE_HAS_POSIX_SEM_TIMEOUT) || defined (ACE_LACKS_NAMED_POSIX_SEM)))
@@ -2361,6 +2633,7 @@ ACE_OS::event_init (ACE_event_t *event,
else
{
int result = 0;
+
event->name_ = 0;
event->eventdata_ = evtdata;
#if (!defined (ACE_HAS_PTHREADS) || !defined (_POSIX_THREAD_PROCESS_SHARED) || defined (ACE_LACKS_CONDATTR_PSHARED)) && \
@@ -2377,6 +2650,7 @@ ACE_OS::event_init (ACE_event_t *event,
sem_name,
arg);
# endif
+
# if (!defined (ACE_HAS_PTHREADS) || !defined (_POSIX_THREAD_PROCESS_SHARED) || \
(defined (ACE_LACKS_MUTEXATTR_PSHARED) && defined (ACE_LACKS_CONDATTR_PSHARED))) && \
(defined (ACE_USES_FIFO_SEM) || \
@@ -2410,6 +2684,7 @@ ACE_OS::event_init (ACE_event_t *event,
event->eventdata_->auto_event_signaled_ = false;
event->eventdata_->waiting_threads_ = 0;
event->eventdata_->signal_count_ = 0;
+
# if (defined (ACE_HAS_PTHREADS) && defined (_POSIX_THREAD_PROCESS_SHARED) && !defined (ACE_LACKS_CONDATTR_PSHARED)) || \
(!defined (ACE_USES_FIFO_SEM) && \
(!defined (ACE_HAS_POSIX_SEM) || !defined (ACE_HAS_POSIX_SEM_TIMEOUT) || defined (ACE_LACKS_NAMED_POSIX_SEM)))
@@ -2442,6 +2717,7 @@ ACE_OS::event_init (ACE_event_t *event,
if (result == 0)
result = ACE_OS::sema_post(&event->lock_); /* initially unlock */
# endif
+
return result;
}
#else
@@ -2455,6 +2731,7 @@ ACE_OS::event_init (ACE_event_t *event,
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_WIN32 */
}
+
int
ACE_OS::event_pulse (ACE_event_t *event)
{
@@ -2463,6 +2740,7 @@ ACE_OS::event_pulse (ACE_event_t *event)
#elif defined (ACE_HAS_THREADS)
int result = 0;
int error = 0;
+
// grab the lock first
# if (defined (ACE_HAS_PTHREADS) && defined (_POSIX_THREAD_PROCESS_SHARED) && \
(!defined (ACE_LACKS_MUTEXATTR_PSHARED) || !defined (ACE_LACKS_CONDATTR_PSHARED))) || \
@@ -2498,6 +2776,7 @@ ACE_OS::event_pulse (ACE_event_t *event)
result = -1;
error = errno;
}
+
if (result == 0)
while(event->eventdata_->signal_count_!=0 && event->eventdata_->waiting_threads_!=0)
ACE_OS::thr_yield ();
@@ -2517,11 +2796,14 @@ ACE_OS::event_pulse (ACE_event_t *event)
result = -1;
error = errno;
}
+
event->eventdata_->auto_event_signaled_ = true;
}
}
+
// Reset event.
event->eventdata_->is_signaled_ = 0;
+
// Now we can let go of the lock.
# if (defined (ACE_HAS_PTHREADS) && defined (_POSIX_THREAD_PROCESS_SHARED) && \
(!defined (ACE_LACKS_MUTEXATTR_PSHARED) || !defined (ACE_LACKS_CONDATTR_PSHARED))) || \
@@ -2543,6 +2825,7 @@ ACE_OS::event_pulse (ACE_event_t *event)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_WIN32 */
}
+
int
ACE_OS::event_reset (ACE_event_t *event)
{
@@ -2550,6 +2833,7 @@ ACE_OS::event_reset (ACE_event_t *event)
ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::ResetEvent (*event), ace_result_), int, -1);
#elif defined (ACE_HAS_THREADS)
int result = 0;
+
// Grab the lock first.
# if (defined (ACE_HAS_PTHREADS) && defined (_POSIX_THREAD_PROCESS_SHARED) && \
(!defined (ACE_LACKS_MUTEXATTR_PSHARED) || !defined (ACE_LACKS_CONDATTR_PSHARED))) || \
@@ -2563,6 +2847,7 @@ ACE_OS::event_reset (ACE_event_t *event)
// Reset event.
event->eventdata_->is_signaled_ = 0;
event->eventdata_->auto_event_signaled_ = false;
+
// Now we can let go of the lock.
# if (defined (ACE_HAS_PTHREADS) && defined (_POSIX_THREAD_PROCESS_SHARED) && \
(!defined (ACE_LACKS_MUTEXATTR_PSHARED) || !defined (ACE_LACKS_CONDATTR_PSHARED))) || \
@@ -2581,6 +2866,7 @@ ACE_OS::event_reset (ACE_event_t *event)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_WIN32 */
}
+
int
ACE_OS::event_signal (ACE_event_t *event)
{
@@ -2589,6 +2875,7 @@ ACE_OS::event_signal (ACE_event_t *event)
#elif defined (ACE_HAS_THREADS)
int result = 0;
int error = 0;
+
// grab the lock first
# if (defined (ACE_HAS_PTHREADS) && defined (_POSIX_THREAD_PROCESS_SHARED) && \
(!defined (ACE_LACKS_MUTEXATTR_PSHARED) || !defined (ACE_LACKS_CONDATTR_PSHARED))) || \
@@ -2618,6 +2905,7 @@ ACE_OS::event_signal (ACE_event_t *event)
error = errno;
}
# endif
+
if (result == 0)
// signal event
event->eventdata_->is_signaled_ = 1;
@@ -2640,8 +2928,10 @@ ACE_OS::event_signal (ACE_event_t *event)
result = -1;
error = errno;
}
+
event->eventdata_->auto_event_signaled_ = true;
}
+
// Now we can let go of the lock.
# if (defined (ACE_HAS_PTHREADS) && defined (_POSIX_THREAD_PROCESS_SHARED) && \
(!defined (ACE_LACKS_MUTEXATTR_PSHARED) || !defined (ACE_LACKS_CONDATTR_PSHARED))) || \
@@ -2651,18 +2941,21 @@ ACE_OS::event_signal (ACE_event_t *event)
# else
ACE_OS::sema_post (&event->lock_);
# endif
+
if (result == -1)
// Reset errno in case mutex_unlock() also fails...
errno = error;
}
else
result = -1;
+
return result;
#else
ACE_UNUSED_ARG (event);
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_WIN32 */
}
+
int
ACE_OS::event_timedwait (ACE_event_t *event,
ACE_Time_Value *timeout,
@@ -2671,8 +2964,10 @@ ACE_OS::event_timedwait (ACE_event_t *event,
if (timeout == 0)
// Wait indefinitely.
return ACE_OS::event_wait (event);
+
#if defined (ACE_WIN32)
DWORD result;
+
if (timeout->sec () == 0 && timeout->usec () == 0)
// Do a "poll".
result = ::WaitForSingleObject (*event, 0);
@@ -2690,6 +2985,7 @@ ACE_OS::event_timedwait (ACE_event_t *event,
// Time is given in absolute time, we should use
// gettimeofday() to calculate relative time
ACE_Time_Value relative_time (*timeout - ACE_OS::gettimeofday ());
+
// Watchout for situations where a context switch has caused
// the current time to be > the timeout. Thanks to Norbert
// Rapp <NRapp@nexus-informatics.de> for pointing this.
@@ -2704,6 +3000,7 @@ ACE_OS::event_timedwait (ACE_event_t *event,
msec_timeout = timeout->msec ();
result = ::WaitForSingleObject (*event, msec_timeout);
}
+
switch (result)
{
case WAIT_OBJECT_0:
@@ -2719,6 +3016,7 @@ ACE_OS::event_timedwait (ACE_event_t *event,
#elif defined (ACE_HAS_THREADS)
int result = 0;
int error = 0;
+
// grab the lock first
# if (defined (ACE_HAS_PTHREADS) && defined (_POSIX_THREAD_PROCESS_SHARED) && \
(!defined (ACE_LACKS_MUTEXATTR_PSHARED) || !defined (ACE_LACKS_CONDATTR_PSHARED))) || \
@@ -2743,11 +3041,14 @@ ACE_OS::event_timedwait (ACE_event_t *event,
// event is currently not signaled
{
event->eventdata_->waiting_threads_++;
+
ACE_Time_Value absolute_timeout = *timeout;
+
// cond_timewait() expects absolute time, check
// <use_absolute_time> flag.
if (use_absolute_time == 0)
absolute_timeout += ACE_OS::gettimeofday ();
+
while (event->eventdata_->is_signaled_ == 0 &&
event->eventdata_->auto_event_signaled_ == false)
{
@@ -2762,6 +3063,7 @@ ACE_OS::event_timedwait (ACE_event_t *event,
error = errno;
break;
}
+
if (event->eventdata_->signal_count_ > 0)
{
event->eventdata_->signal_count_--;
@@ -2778,6 +3080,7 @@ ACE_OS::event_timedwait (ACE_event_t *event,
event->eventdata_->waiting_threads_--;
return -1;
}
+
if (ACE_OS::sema_wait(&event->semaphore_, absolute_timeout) !=0)
{
result = -1;
@@ -2786,12 +3089,14 @@ ACE_OS::event_timedwait (ACE_event_t *event,
else
error = errno;
}
+
bool signalled = false;
if (result == 0 && event->eventdata_->signal_count_ > 0)
{
event->eventdata_->signal_count_--;
signalled = true;
}
+
# if (defined (ACE_HAS_PTHREADS) && defined (_POSIX_THREAD_PROCESS_SHARED) && !defined (ACE_LACKS_MUTEXATTR_PSHARED)) || \
(!defined (ACE_USES_FIFO_SEM) && (!defined (ACE_HAS_POSIX_SEM) || defined (ACE_LACKS_NAMED_POSIX_SEM)))
if (ACE_OS::mutex_lock (&event->eventdata_->lock_) != 0)
@@ -2802,8 +3107,10 @@ ACE_OS::event_timedwait (ACE_event_t *event,
event->eventdata_->waiting_threads_--; // yes, I know it's not save
return -1;
}
+
if (result)
break;
+
if (event->eventdata_->manual_reset_ == 1 && event->eventdata_->is_signaled_ == 1)
if (ACE_OS::sema_post(&event->semaphore_) != 0)
{
@@ -2811,16 +3118,20 @@ ACE_OS::event_timedwait (ACE_event_t *event,
error = errno;
break;
}
+
if (signalled)
break;
# endif
}
+
// Reset the auto_event_signaled_ to false now that we have
// woken up.
if (event->eventdata_->auto_event_signaled_ == true)
event->eventdata_->auto_event_signaled_ = false;
+
event->eventdata_->waiting_threads_--;
}
+
// Now we can let go of the lock.
# if (defined (ACE_HAS_PTHREADS) && defined (_POSIX_THREAD_PROCESS_SHARED) && \
(!defined (ACE_LACKS_MUTEXATTR_PSHARED) || !defined (ACE_LACKS_CONDATTR_PSHARED))) || \
@@ -2830,6 +3141,7 @@ ACE_OS::event_timedwait (ACE_event_t *event,
# else
ACE_OS::sema_post (&event->lock_);
# endif
+
if (result == -1)
// Reset errno in case mutex_unlock() also fails...
errno = error;
@@ -2844,6 +3156,7 @@ ACE_OS::event_timedwait (ACE_event_t *event,
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_WIN32 */
}
+
int
ACE_OS::event_wait (ACE_event_t *event)
{
@@ -2861,6 +3174,7 @@ ACE_OS::event_wait (ACE_event_t *event)
#elif defined (ACE_HAS_THREADS)
int result = 0;
int error = 0;
+
// grab the lock first
# if (defined (ACE_HAS_PTHREADS) && defined (_POSIX_THREAD_PROCESS_SHARED) && \
(!defined (ACE_LACKS_MUTEXATTR_PSHARED) || !defined (ACE_LACKS_CONDATTR_PSHARED))) || \
@@ -2881,6 +3195,7 @@ ACE_OS::event_wait (ACE_event_t *event)
else // event is currently not signaled
{
event->eventdata_->waiting_threads_++;
+
while (event->eventdata_->is_signaled_ == 0 &&
event->eventdata_->auto_event_signaled_ == false)
{
@@ -2911,17 +3226,20 @@ ACE_OS::event_wait (ACE_event_t *event)
event->eventdata_->waiting_threads_--;
return -1;
}
+
if (ACE_OS::sema_wait (&event->semaphore_) !=0)
{
result = -1;
error = errno;
}
+
bool signalled = false;
if (result == 0 && event->eventdata_->signal_count_ > 0)
{
event->eventdata_->signal_count_--;
signalled = true;
}
+
# if (defined (ACE_HAS_PTHREADS) && defined (_POSIX_THREAD_PROCESS_SHARED) && !defined (ACE_LACKS_MUTEXATTR_PSHARED)) || \
(!defined (ACE_USES_FIFO_SEM) && (!defined (ACE_HAS_POSIX_SEM) || defined (ACE_LACKS_NAMED_POSIX_SEM)))
if (ACE_OS::mutex_lock (&event->eventdata_->lock_) != 0)
@@ -2932,8 +3250,10 @@ ACE_OS::event_wait (ACE_event_t *event)
event->eventdata_->waiting_threads_--;
return -1;
}
+
if (result)
break;
+
if (event->eventdata_->manual_reset_ == 1 && event->eventdata_->is_signaled_ == 1)
if (ACE_OS::sema_post(&event->semaphore_) != 0)
{
@@ -2941,15 +3261,19 @@ ACE_OS::event_wait (ACE_event_t *event)
error = errno;
break;
}
+
if (signalled)
break;
# endif
}
+
// Reset it since we have woken up.
if (event->eventdata_->auto_event_signaled_ == true)
event->eventdata_->auto_event_signaled_ = false;
+
event->eventdata_->waiting_threads_--;
}
+
// Now we can let go of the lock.
# if (defined (ACE_HAS_PTHREADS) && defined (_POSIX_THREAD_PROCESS_SHARED) && \
(!defined (ACE_LACKS_MUTEXATTR_PSHARED) || !defined (ACE_LACKS_CONDATTR_PSHARED))) || \
@@ -2959,6 +3283,7 @@ ACE_OS::event_wait (ACE_event_t *event)
# else
ACE_OS::sema_post (&event->lock_);
# endif
+
if (result == -1)
// Reset errno in case mutex_unlock() also fails...
errno = error;
@@ -2971,9 +3296,11 @@ ACE_OS::event_wait (ACE_event_t *event)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_WIN32 */
}
+
/*****************************************************************************/
// EVENTS END
/*****************************************************************************/
+
int
ACE_OS::lwp_getparams (ACE_Sched_Params &sched_params)
{
@@ -2984,12 +3311,14 @@ ACE_OS::lwp_getparams (ACE_Sched_Params &sched_params)
if (ACE_OS::scheduling_class ("RT", rt_id) == -1
|| ACE_OS::scheduling_class ("TS", ts_id) == -1)
return -1;
+
// Get this LWP's scheduling parameters.
pcparms_t pcparms;
// The following is just to avoid Purify warnings about unitialized
// memory reads.
ACE_OS::memset (&pcparms, 0, sizeof pcparms);
pcparms.pc_cid = PC_CLNULL;
+
if (ACE_OS::priority_control (P_LWPID,
P_MYID,
PC_GETPARMS,
@@ -3000,6 +3329,7 @@ ACE_OS::lwp_getparams (ACE_Sched_Params &sched_params)
// RT class.
rtparms_t rtparms;
ACE_OS::memcpy (&rtparms, pcparms.pc_clparms, sizeof rtparms);
+
sched_params.policy (ACE_SCHED_FIFO);
sched_params.priority (rtparms.rt_pri);
sched_params.scope (ACE_SCOPE_THREAD);
@@ -3014,6 +3344,7 @@ ACE_OS::lwp_getparams (ACE_Sched_Params &sched_params)
/* TS class */
tsparms_t tsparms;
ACE_OS::memcpy (&tsparms, pcparms.pc_clparms, sizeof tsparms);
+
sched_params.policy (ACE_SCHED_OTHER);
sched_params.priority (tsparms.ts_upri);
sched_params.scope (ACE_SCOPE_THREAD);
@@ -3021,11 +3352,13 @@ ACE_OS::lwp_getparams (ACE_Sched_Params &sched_params)
}
else
return -1;
+
#else /* ! ACE_HAS_STHREADS && ! sun */
ACE_UNUSED_ARG (sched_params);
ACE_NOTSUP_RETURN (-1);
#endif /* ! ACE_HAS_STHREADS && ! sun */
}
+
int
ACE_OS::lwp_setparams (const ACE_Sched_Params &sched_params)
{
@@ -3038,6 +3371,7 @@ ACE_OS::lwp_setparams (const ACE_Sched_Params &sched_params)
ACE_NOTSUP_RETURN (-1);
#endif /* ! ACE_HAS_STHREADS && ! sun */
}
+
#if !defined (ACE_HAS_THREADS) || (defined (ACE_LACKS_RWLOCK_T) && \
!defined (ACE_HAS_PTHREADS_UNIX98_EXT))
int
@@ -3051,12 +3385,14 @@ ACE_OS::rwlock_init (ACE_rwlock_t *rw,
// NT, POSIX, and VxWorks don't support this natively.
ACE_UNUSED_ARG (name);
int result = -1;
+
// Since we cannot use the user specified name for all three
// objects, we will create three completely new names.
ACE_TCHAR name1[ACE_UNIQUE_NAME_LEN];
ACE_TCHAR name2[ACE_UNIQUE_NAME_LEN];
ACE_TCHAR name3[ACE_UNIQUE_NAME_LEN];
ACE_TCHAR name4[ACE_UNIQUE_NAME_LEN];
+
ACE_OS::unique_name ((const void *) &rw->lock_,
name1,
ACE_UNIQUE_NAME_LEN);
@@ -3069,6 +3405,7 @@ ACE_OS::rwlock_init (ACE_rwlock_t *rw,
ACE_OS::unique_name ((const void *) &rw->waiting_important_writer_,
name4,
ACE_UNIQUE_NAME_LEN);
+
ACE_condattr_t attributes;
if (ACE_OS::condattr_init (attributes, type) == 0)
{
@@ -3090,6 +3427,7 @@ ACE_OS::rwlock_init (ACE_rwlock_t *rw,
}
ACE_OS::condattr_destroy (attributes);
}
+
if (result == -1)
{
// Save/restore errno.
@@ -3109,6 +3447,7 @@ ACE_OS::rwlock_init (ACE_rwlock_t *rw,
# endif /* ACE_HAS_THREADS */
}
#endif /* ! ACE_HAS_THREADS || ACE_LACKS_RWLOCK_T */
+
int
ACE_OS::sched_params (const ACE_Sched_Params &sched_params,
ACE_id_t id)
@@ -3125,12 +3464,15 @@ ACE_OS::sched_params (const ACE_Sched_Params &sched_params,
errno = EINVAL;
return -1;
}
+
// Thanks to Thilo Kielmann <kielmann@informatik.uni-siegen.de> for
// providing this code for 1003.1c PThreads. Please note that this
// has only been tested for POSIX 1003.1c threads, and may cause
// problems with other PThreads flavors!
+
struct sched_param param;
param.sched_priority = sched_params.priority ();
+
if (sched_params.scope () == ACE_SCOPE_PROCESS)
{
# if defined(ACE_TANDEM_T1248_PTHREADS) || defined (ACE_HAS_PTHREAD_SCHEDPARAM)
@@ -3154,6 +3496,7 @@ ACE_OS::sched_params (const ACE_Sched_Params &sched_params,
else if (sched_params.scope () == ACE_SCOPE_THREAD)
{
ACE_thread_t thr_id = ACE_OS::thr_self ();
+
int result;
ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::pthread_setschedparam (thr_id,
sched_params.policy (),
@@ -3172,27 +3515,35 @@ ACE_OS::sched_params (const ACE_Sched_Params &sched_params,
errno = EINVAL;
return -1;
}
+
#elif defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)
+
// PharLap ETS can act on the current thread - it can set the
// quantum also, unlike Win32. All this only works on the RT
// version.
# if defined (ACE_HAS_PHARLAP_RT)
if (id != ACE_SELF)
ACE_NOTSUP_RETURN (-1);
+
# if !defined (ACE_PHARLAP_LABVIEW_RT)
if (sched_params.quantum() != ACE_Time_Value::zero)
EtsSetTimeSlice (sched_params.quantum().msec());
# endif
+
# else
+
if (sched_params.quantum () != ACE_Time_Value::zero)
{
// I don't know of a way to set the quantum on Win32.
errno = EINVAL;
return -1;
}
+
# endif /* ACE_HAS_PHARLAP_RT */
+
if (sched_params.scope () == ACE_SCOPE_THREAD)
{
+
// Setting the REALTIME_PRIORITY_CLASS on Windows is almost always
// a VERY BAD THING. This include guard will allow people
// to easily disable this feature in ACE.
@@ -3211,12 +3562,14 @@ ACE_OS::sched_params (const ACE_Sched_Params &sched_params,
return -1;
}
#endif /* ACE_DISABLE_WIN32_INCREASE_PRIORITY */
+
// Now that we have set the priority class of the process, set the
// priority of the current thread to the desired value.
return ACE_OS::thr_setprio (sched_params.priority ());
}
else if (sched_params.scope () == ACE_SCOPE_PROCESS)
{
+
# if defined (ACE_HAS_PHARLAP_RT)
ACE_NOTSUP_RETURN (-1);
# else
@@ -3248,6 +3601,7 @@ ACE_OS::sched_params (const ACE_Sched_Params &sched_params,
::CloseHandle (hProcess);
return 0;
#endif /* ACE_HAS_PHARLAP_RT */
+
}
else
{
@@ -3256,8 +3610,10 @@ ACE_OS::sched_params (const ACE_Sched_Params &sched_params,
}
#elif defined (ACE_VXWORKS)
ACE_UNUSED_ARG (id);
+
// There is only one class of priorities on VxWorks, and no time
// quanta. So, just set the current thread's priority.
+
if (sched_params.policy () != ACE_SCHED_FIFO
|| sched_params.scope () != ACE_SCOPE_PROCESS
|| sched_params.quantum () != ACE_Time_Value::zero)
@@ -3265,6 +3621,7 @@ ACE_OS::sched_params (const ACE_Sched_Params &sched_params,
errno = EINVAL;
return -1;
}
+
// Set the thread priority on the current thread.
return ACE_OS::thr_setprio (sched_params.priority ());
#else
@@ -3273,6 +3630,7 @@ ACE_OS::sched_params (const ACE_Sched_Params &sched_params,
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_STHREADS */
}
+
int
ACE_OS::scheduling_class (const char *class_name, ACE_id_t &id)
{
@@ -3282,6 +3640,7 @@ ACE_OS::scheduling_class (const char *class_name, ACE_id_t &id)
// The following is just to avoid Purify warnings about unitialized
// memory reads.
ACE_OS::memset (&pcinfo, 0, sizeof pcinfo);
+
ACE_OS::strcpy (pcinfo.pc_clname, class_name);
if (ACE_OS::priority_control (P_ALL /* ignored */,
P_MYID /* ignored */,
@@ -3301,6 +3660,7 @@ ACE_OS::scheduling_class (const char *class_name, ACE_id_t &id)
ACE_NOTSUP_RETURN (-1);
#endif /* ! ACE_HAS_PRIOCNTL */
}
+
int
ACE_OS::set_scheduling_params (const ACE_Sched_Params &sched_params,
ACE_id_t id)
@@ -3308,6 +3668,7 @@ ACE_OS::set_scheduling_params (const ACE_Sched_Params &sched_params,
#if defined (ACE_HAS_PRIOCNTL)
// Set priority class, priority, and quantum of this LWP or process as
// specified in sched_params.
+
// Get the priority class ID.
ACE_id_t class_id;
if (ACE_OS::scheduling_class (sched_params.policy() == ACE_SCHED_OTHER ?
@@ -3316,11 +3677,14 @@ ACE_OS::set_scheduling_params (const ACE_Sched_Params &sched_params,
{
return -1;
}
+
pcparms_t pcparms;
// The following is just to avoid Purify warnings about unitialized
// memory reads.
ACE_OS::memset (&pcparms, 0, sizeof pcparms);
+
pcparms.pc_cid = class_id;
+
if (sched_params.policy () == ACE_SCHED_OTHER &&
sched_params.quantum () == ACE_Time_Value::zero)
// SunOS doesn't support non-zero quantums in time-sharing class: use
@@ -3330,9 +3694,11 @@ ACE_OS::set_scheduling_params (const ACE_Sched_Params &sched_params,
// The following is just to avoid Purify warnings about unitialized
// memory reads.
ACE_OS::memset (&tsparms, 0, sizeof tsparms);
+
// Don't change ts_uprilim (user priority limit)
tsparms.ts_uprilim = TS_NOCHANGE;
tsparms.ts_upri = sched_params.priority ();
+
// Package up the TS class ID and parameters for the
// priority_control () call.
ACE_OS::memcpy (pcparms.pc_clparms, &tsparms, sizeof tsparms);
@@ -3348,7 +3714,9 @@ ACE_OS::set_scheduling_params (const ACE_Sched_Params &sched_params,
// The following is just to avoid Purify warnings about unitialized
// memory reads.
ACE_OS::memset (&rtparms, 0, sizeof rtparms);
+
rtparms.rt_pri = sched_params.priority ();
+
if (sched_params.quantum () == ACE_Time_Value::zero)
{
// rtparms.rt_tqsecs is ignored with RT_TQINF
@@ -3359,6 +3727,7 @@ ACE_OS::set_scheduling_params (const ACE_Sched_Params &sched_params,
rtparms.rt_tqsecs = (ulong) sched_params.quantum ().sec ();
rtparms.rt_tqnsecs = sched_params.quantum ().usec () * 1000;
}
+
// Package up the RT class ID and parameters for the
// priority_control () call.
ACE_OS::memcpy (pcparms.pc_clparms, &rtparms, sizeof rtparms);
@@ -3368,6 +3737,7 @@ ACE_OS::set_scheduling_params (const ACE_Sched_Params &sched_params,
errno = EINVAL;
return -1;
}
+
if (ACE_OS::priority_control ((idtype_t) (sched_params.scope () == ACE_SCOPE_THREAD
? ACE_SCOPE_PROCESS
: sched_params.scope ()),
@@ -3377,6 +3747,7 @@ ACE_OS::set_scheduling_params (const ACE_Sched_Params &sched_params,
{
return ACE_OS::last_error ();
}
+
return 0;
#else /* ! ACE_HAS_PRIOCNTL */
ACE_UNUSED_ARG (sched_params);
@@ -3384,6 +3755,7 @@ ACE_OS::set_scheduling_params (const ACE_Sched_Params &sched_params,
ACE_NOTSUP_RETURN (-1);
#endif /* ! ACE_HAS_PRIOCNTL */
}
+
int
ACE_OS::thr_create (ACE_THR_FUNC func,
void *args,
@@ -3397,9 +3769,11 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
const char** thr_name)
{
ACE_OS_TRACE ("ACE_OS::thr_create");
+
if (ACE_BIT_DISABLED (flags, THR_DETACHED) &&
ACE_BIT_DISABLED (flags, THR_JOINABLE))
ACE_SET_BITS (flags, THR_JOINABLE);
+
#if defined (ACE_NO_THREAD_ADAPTER)
# define ACE_THREAD_FUNCTION func
# define ACE_THREAD_ARGUMENT args
@@ -3407,6 +3781,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
# define ACE_THREAD_FUNCTION thread_args->entry_point ()
# define ACE_THREAD_ARGUMENT thread_args
#endif /* ! defined (ACE_NO_THREAD_ADAPTER) */
+
ACE_Base_Thread_Adapter *thread_args = 0;
if (thread_adapter == 0)
#if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS)
@@ -3421,26 +3796,34 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
ACE_OS_Thread_Adapter (func, args,
(ACE_THR_C_FUNC) ACE_THREAD_ADAPTER_NAME),
-1);
+
#endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */
else
thread_args = thread_adapter;
+
auto_ptr <ACE_Base_Thread_Adapter> auto_thread_args;
+
if (thread_adapter == 0)
ACE_AUTO_PTR_RESET (auto_thread_args,
thread_args,
ACE_Base_Thread_Adapter);
+
#if defined (ACE_HAS_THREADS)
+
// *** Set Stack Size
# if defined (ACE_NEEDS_HUGE_THREAD_STACKSIZE)
if (stacksize < ACE_NEEDS_HUGE_THREAD_STACKSIZE)
stacksize = ACE_NEEDS_HUGE_THREAD_STACKSIZE;
# endif /* ACE_NEEDS_HUGE_THREAD_STACKSIZE */
+
ACE_thread_t tmp_thr;
if (thr_id == 0)
thr_id = &tmp_thr;
+
ACE_hthread_t tmp_handle;
if (thr_handle == 0)
thr_handle = &tmp_handle;
+
# if defined (ACE_HAS_PTHREADS)
int result;
# if defined (ACE_VXWORKS) && (ACE_VXWORKS >= 0x600) && (ACE_VXWORKS <= 0x620)
@@ -3454,13 +3837,16 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
# endif
if (ACE_ADAPT_RETVAL(::pthread_attr_init(&attr), result) != 0)
return -1;
+
if (stacksize != 0)
{
size_t size = stacksize;
+
# if defined (PTHREAD_STACK_MIN)
if (size < static_cast <size_t> (PTHREAD_STACK_MIN))
size = PTHREAD_STACK_MIN;
# endif /* PTHREAD_STACK_MIN */
+
# if !defined (ACE_LACKS_PTHREAD_ATTR_SETSTACKSIZE)
# if !defined (ACE_LACKS_PTHREAD_ATTR_SETSTACK)
int result;
@@ -3480,6 +3866,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
ACE_UNUSED_ARG (size);
# endif /* !ACE_LACKS_PTHREAD_ATTR_SETSTACKSIZE */
}
+
// *** Set Stack Address
# if defined (ACE_LACKS_PTHREAD_ATTR_SETSTACK)
# if !defined (ACE_LACKS_PTHREAD_ATTR_SETSTACKADDR)
@@ -3495,6 +3882,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
ACE_UNUSED_ARG (stack);
# endif /* !ACE_LACKS_PTHREAD_ATTR_SETSTACKADDR */
# endif /* ACE_LACKS_PTHREAD_ATTR_SETSTACK */
+
// *** Deal with various attributes
if (flags != 0)
{
@@ -3504,8 +3892,10 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
|| ACE_BIT_ENABLED (flags, THR_JOINABLE))
{
int dstate = PTHREAD_CREATE_JOINABLE;
+
if (ACE_BIT_ENABLED (flags, THR_DETACHED))
dstate = PTHREAD_CREATE_DETACHED;
+
if (ACE_ADAPT_RETVAL(::pthread_attr_setdetachstate (&attr, dstate),
result) != 0)
{
@@ -3513,11 +3903,13 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
return -1;
}
}
+
// Note: if ACE_LACKS_SETDETACH and THR_DETACHED is enabled, we
// call ::pthread_detach () below. If THR_DETACHED is not
// enabled, we call ::pthread_detach () in the Thread_Manager,
// after joining with the thread.
# endif /* ACE_LACKS_SETDETACH */
+
// *** Set Policy
# if !defined (ACE_LACKS_SETSCHED) || defined (ACE_HAS_PTHREAD_SCHEDPARAM)
// If we wish to set the priority explicitly, we have to enable
@@ -3530,11 +3922,13 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
&& ACE_BIT_DISABLED (flags, THR_SCHED_DEFAULT))
ACE_SET_BITS (flags, THR_SCHED_DEFAULT);
}
+
if (ACE_BIT_ENABLED (flags, THR_SCHED_FIFO)
|| ACE_BIT_ENABLED (flags, THR_SCHED_RR)
|| ACE_BIT_ENABLED (flags, THR_SCHED_DEFAULT))
{
int spolicy;
+
# if defined (ACE_HAS_ONLY_SCHED_OTHER)
// SunOS, thru version 5.6, only supports SCHED_OTHER.
spolicy = SCHED_OTHER;
@@ -3545,6 +3939,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
// Make sure to enable explicit scheduling, in case we didn't
// enable it above (for non-default priority).
ACE_SET_BITS (flags, THR_EXPLICIT_SCHED);
+
if (ACE_BIT_ENABLED (flags, THR_SCHED_DEFAULT))
spolicy = SCHED_OTHER;
else if (ACE_BIT_ENABLED (flags, THR_SCHED_FIFO))
@@ -3561,7 +3956,9 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
# endif /* SCHED_IO */
else
spolicy = SCHED_RR;
+
# endif /* ACE_HAS_ONLY_SCHED_OTHER */
+
(void) ACE_ADAPT_RETVAL(::pthread_attr_setschedpolicy (&attr, spolicy),
result);
if (result != 0)
@@ -3570,6 +3967,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
return -1;
}
}
+
// *** Set Priority (use reasonable default priorities)
# if defined(ACE_HAS_PTHREADS)
// If we wish to explicitly set a scheduling policy, we also
@@ -3593,6 +3991,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
{
struct sched_param sparam;
ACE_OS::memset ((void *) &sparam, 0, sizeof sparam);
+
# if defined (ACE_HAS_IRIX62_THREADS)
sparam.sched_priority = ACE_MIN (priority,
(long) PTHREAD_MAX_PRIORITY);
@@ -3619,6 +4018,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
# else
sparam.sched_priority = priority;
# endif /* ACE_HAS_IRIX62_THREADS */
+
{
# if defined (sun) && defined (ACE_HAS_ONLY_SCHED_OTHER)
// SunOS, through 5.6, POSIX only allows priorities > 0 to
@@ -3637,6 +4037,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
}
}
}
+
// *** Set scheduling explicit or inherited
if (ACE_BIT_ENABLED (flags, THR_INHERIT_SCHED)
|| ACE_BIT_ENABLED (flags, THR_EXPLICIT_SCHED))
@@ -3653,6 +4054,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
# else /* ACE_LACKS_SETSCHED */
ACE_UNUSED_ARG (priority);
# endif /* ACE_LACKS_SETSCHED */
+
// *** Set pthread name
# if defined (ACE_HAS_PTHREAD_ATTR_SETNAME)
if (thr_name && *thr_name)
@@ -3666,6 +4068,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
#else
ACE_UNUSED_ARG (thr_name);
# endif
+
// *** Set Scope
# if !defined (ACE_LACKS_THREAD_PROCESS_SCOPING)
if (ACE_BIT_ENABLED (flags, THR_SCOPE_SYSTEM)
@@ -3681,6 +4084,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
# endif /* ACE_CONFIG_LINUX_H */
if (ACE_BIT_ENABLED (flags, THR_SCOPE_SYSTEM))
scope = PTHREAD_SCOPE_SYSTEM;
+
if (ACE_ADAPT_RETVAL(::pthread_attr_setscope (&attr, scope), result) != 0)
{
::pthread_attr_destroy (&attr);
@@ -3688,16 +4092,19 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
}
}
# endif /* !ACE_LACKS_THREAD_PROCESS_SCOPING */
+
# ifdef ACE_HAS_PTHREAD_ATTR_SETCREATESUSPEND_NP
if (ACE_BIT_ENABLED (flags, THR_SUSPENDED))
{
if (ACE_ADAPT_RETVAL(::pthread_attr_setcreatesuspend_np(&attr), result) != 0)
{
+
::pthread_attr_destroy (&attr);
return -1;
}
}
# endif /* !ACE_HAS_PTHREAD_ATTR_SETCREATESUSPEND_NP */
+
# if ! defined(ACE_LACKS_THR_CONCURRENCY_FUNCS)
if (ACE_BIT_ENABLED (flags, THR_NEW_LWP))
{
@@ -3727,6 +4134,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
}
# endif /* ! ACE_LACKS_THR_CONCURRENCY_FUNCS */
}
+
ACE_OSCALL (ACE_ADAPT_RETVAL (::pthread_create (thr_id,
&attr,
thread_args->entry_point (),
@@ -3734,13 +4142,16 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
result),
int, -1, result);
::pthread_attr_destroy (&attr);
+
// This is a SunOS or POSIX implementation of pthreads, where we
// assume that ACE_thread_t and ACE_hthread_t are the same. If this
// *isn't* correct on some platform, please let us know.
if (result != -1)
*thr_handle = *thr_id;
+
# if defined (sun) && defined (ACE_HAS_ONLY_SCHED_OTHER)
// SunOS prior to 5.7:
+
// If the priority is 0, then we might have to set it now because we
// couldn't set it with ::pthread_attr_setschedparam, as noted
// above. This doesn't provide strictly correct behavior, because
@@ -3764,14 +4175,17 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
&sparam),
result), int,
-1, result);
+
// The only policy supported by by SunOS, thru version 5.6,
// is SCHED_OTHER, so that's hard-coded here.
policy = ACE_SCHED_OTHER;
+
if (sparam.sched_priority != 0)
{
ACE_OS::memset ((void *) &sparam, 0, sizeof sparam);
// The memset to 0 sets the priority to 0, so we don't need
// to explicitly set sparam.sched_priority.
+
ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::pthread_setschedparam (*thr_id,
policy,
&sparam),
@@ -3779,6 +4193,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
int, -1);
}
}
+
# if defined (ACE_NEEDS_LWP_PRIO_SET)
# if 0
// It would be useful if we could make this work. But, it requires
@@ -3786,6 +4201,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
// thread is bound. Is there a way to do that? Instead, just rely
// on the code in ACE_Thread_Adapter::invoke () to set the LWP
// priority.
+
// If the thread is bound, then set the priority on its LWP.
if (ACE_BIT_ENABLED (flags, THR_BOUND))
{
@@ -3800,25 +4216,30 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
}
# endif /* 0 */
# endif /* ACE_NEEDS_LWP_PRIO_SET */
+
# endif /* sun && ACE_HAS_ONLY_SCHED_OTHER */
auto_thread_args.release ();
return result;
# elif defined (ACE_HAS_STHREADS)
int result;
int start_suspended = ACE_BIT_ENABLED (flags, THR_SUSPENDED);
+
if (priority != ACE_DEFAULT_THREAD_PRIORITY)
// If we need to set the priority, then we need to start the
// thread in a suspended mode.
ACE_SET_BITS (flags, THR_SUSPENDED);
+
ACE_OSCALL (ACE_ADAPT_RETVAL (::thr_create (stack, stacksize,
thread_args->entry_point (),
thread_args,
flags, thr_id), result),
int, -1, result);
+
if (result != -1)
{
// With SunOS threads, ACE_thread_t and ACE_hthread_t are the same.
*thr_handle = *thr_id;
+
if (priority != ACE_DEFAULT_THREAD_PRIORITY)
{
// Set the priority of the new thread and then let it
@@ -3830,6 +4251,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
errno = result;
return -1;
}
+
if (start_suspended == 0)
{
result = ACE_OS::thr_continue (*thr_id);
@@ -3867,6 +4289,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
DUPLICATE_SAME_ACCESS);
# endif /* ! ACE_HAS_WINCE */
*thr_id = cwin_thread->m_nThreadID;
+
if (ACE_BIT_ENABLED (flags, THR_SUSPENDED) == 0)
cwin_thread->ResumeThread ();
// cwin_thread will be deleted in AfxThreadExit()
@@ -3877,22 +4300,26 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
# endif /* ACE_HAS_MFC */
{
int start_suspended = ACE_BIT_ENABLED (flags, THR_SUSPENDED);
+
if (priority != ACE_DEFAULT_THREAD_PRIORITY)
// If we need to set the priority, then we need to start the
// thread in a suspended mode.
ACE_SET_BITS (flags, THR_SUSPENDED);
+
*thr_handle = (void *) ACE_BEGINTHREADEX (0,
static_cast <u_int> (stacksize),
thread_args->entry_point (),
thread_args,
flags,
thr_id);
+
if (priority != ACE_DEFAULT_THREAD_PRIORITY && *thr_handle != 0)
{
// Set the priority of the new thread and then let it
// continue, but only if the user didn't start it suspended
// in the first place!
ACE_OS::thr_setprio (*thr_handle, priority);
+
if (start_suspended == 0)
ACE_OS::thr_continue (*thr_handle);
}
@@ -3906,9 +4333,11 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
flags,
thr_id);
# endif /* 0 */
+
// Close down the handle if no one wants to use it.
if (thr_handle == &tmp_handle && tmp_handle != 0)
::CloseHandle (tmp_handle);
+
if (*thr_handle != 0)
{
auto_thread_args.release ();
@@ -3917,6 +4346,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
else
ACE_FAIL_RETURN (-1);
/* NOTREACHED */
+
# elif defined (ACE_VXWORKS)
// The hard-coded values below are what ::sp () would use. (::sp ()
// hardcodes priority to 100, flags to VX_FP_TASK, and stacksize to
@@ -3924,12 +4354,14 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
// specified, ::taskSpawn () is used so that we can set the
// priority, flags, and stacksize. If a stack is specified,
// ::taskInit ()/::taskActivate() are used.
+
// If called with thr_create() defaults, use same default values as ::sp ():
if (priority == ACE_DEFAULT_THREAD_PRIORITY) priority = 100;
// Assumes that there is a floating point coprocessor. As noted
// above, ::sp () hardcodes this, so we should be safe with it.
if (flags == 0) flags = VX_FP_TASK;
if (stacksize == 0) stacksize = 20000;
+
ACE_thread_t tid;
# if 0 /* Don't support setting of stack, because it doesn't seem to work. */
if (stack == 0)
@@ -3953,9 +4385,11 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
{
// If a task name (thr_id) was not supplied, then the task will
// not have a unique name. That's VxWorks' behavior.
+
// Carve out a TCB at the beginning of the stack space. The TCB
// occupies 400 bytes with VxWorks 5.3.1/I386.
WIND_TCB *tcb = (WIND_TCB *) stack;
+
// The TID is defined to be the address of the TCB.
int status = ::taskInit (tcb,
thr_name && *thr_name ? const_cast <char*>(*thr_name) : 0,
@@ -3966,27 +4400,34 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
thread_args->entry_point (),
(int) thread_args,
0, 0, 0, 0, 0, 0, 0, 0, 0);
+
if (status == OK)
{
// The task was successfully initialized, now activate it.
status = ::taskActivate ((ACE_hthread_t) tcb);
}
+
tid = status == OK ? (ACE_thread_t) tcb : ERROR;
}
# endif /* 0 */
+
if (tid == ERROR)
return -1;
else
{
if (thr_id)
*thr_id = tid;
+
if (thr_handle)
*thr_handle = tid;
+
if (thr_name && !(*thr_name))
*thr_name = ::taskName (tid);
+
auto_thread_args.release ();
return 0;
}
+
# endif /* ACE_HAS_STHREADS */
#else
ACE_UNUSED_ARG (func);
@@ -4001,6 +4442,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_THREADS */
}
+
void
ACE_OS::thr_exit (ACE_THR_FUNC_RETURN status)
{
@@ -4014,6 +4456,7 @@ ACE_OS::thr_exit (ACE_THR_FUNC_RETURN status)
// Can't call it here because on NT, the thread is exited
// directly by ACE_Thread_Adapter::invoke ().
// ACE_TSS_Cleanup::instance ()->thread_exit (status);
+
# if defined (ACE_HAS_MFC) && (ACE_HAS_MFC != 0)
int using_afx = -1;
// An ACE_Thread_Descriptor really is an ACE_OS_Thread_Descriptor.
@@ -4023,8 +4466,10 @@ ACE_OS::thr_exit (ACE_THR_FUNC_RETURN status)
if (td)
using_afx = ACE_BIT_ENABLED (td->flags (), THR_USE_AFX);
# endif /* ACE_HAS_MFC && (ACE_HAS_MFC != 0) */
+
// Call TSS destructors.
ACE_OS::cleanup_tss (0 /* not main thread */);
+
// Exit the thread.
// Allow CWinThread-destructor to be invoked from AfxEndThread.
// _endthreadex will be called from AfxEndThread so don't exit the
@@ -4052,6 +4497,7 @@ ACE_OS::thr_exit (ACE_THR_FUNC_RETURN status)
# else
ACE_ENDTHREADEX (status);
# endif /* ACE_HAS_MFC && ACE_HAS_MFS != 0*/
+
# elif defined (ACE_HAS_VXTHREADS)
ACE_thread_t tid = ACE_OS::thr_self ();
*((int *) status) = ::taskDelete (tid);
@@ -4060,10 +4506,12 @@ ACE_OS::thr_exit (ACE_THR_FUNC_RETURN status)
ACE_UNUSED_ARG (status);
#endif /* ACE_HAS_THREADS */
}
+
#if defined (ACE_HAS_VXTHREADS)
// Leave this in the global scope to allow
// users to adjust the delay value.
int ACE_THR_JOIN_DELAY = 5;
+
int
ACE_OS::thr_join (ACE_hthread_t thr_handle,
ACE_THR_FUNC_RETURN *status)
@@ -4073,13 +4521,16 @@ ACE_OS::thr_join (ACE_hthread_t thr_handle,
{
*status = 0;
}
+
// This method can not support joining all threads
if (ACE_OS::thr_cmp (thr_handle, ACE_OS::NULL_hthread))
{
ACE_NOTSUP_RETURN (-1);
}
+
int retval = ESRCH;
ACE_thread_t current = ACE_OS::thr_self ();
+
// Make sure we are not joining ourself
if (ACE_OS::thr_cmp (thr_handle, current))
{
@@ -4090,6 +4541,7 @@ ACE_OS::thr_join (ACE_hthread_t thr_handle,
// Whether the task exists or not
// we will return a successful value
retval = 0;
+
// Verify that the task id still exists
while (taskIdVerify (thr_handle) == OK)
{
@@ -4097,6 +4549,7 @@ ACE_OS::thr_join (ACE_hthread_t thr_handle,
ACE_OS::sleep (ACE_THR_JOIN_DELAY);
}
}
+
// Adapt the return value into errno and return value.
// The ACE_ADAPT_RETVAL macro doesn't exactly do what
// we need to do here, so we do it manually.
@@ -4105,8 +4558,10 @@ ACE_OS::thr_join (ACE_hthread_t thr_handle,
errno = retval;
retval = -1;
}
+
return retval;
}
+
int
ACE_OS::thr_join (ACE_thread_t waiter_id,
ACE_thread_t *thr_id,
@@ -4116,6 +4571,7 @@ ACE_OS::thr_join (ACE_thread_t waiter_id,
return ACE_OS::thr_join (waiter_id, status);
}
#endif /* ACE_HAS_VXTHREADS */
+
int
ACE_OS::thr_key_detach (ACE_thread_key_t key, void *)
{
@@ -4134,6 +4590,7 @@ ACE_OS::thr_key_detach (ACE_thread_key_t key, void *)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_WTHREADS || ACE_HAS_TSS_EMULATION */
}
+
int
ACE_OS::thr_get_affinity (ACE_hthread_t thr_id,
size_t cpu_set_size,
@@ -4174,6 +4631,7 @@ ACE_OS::thr_get_affinity (ACE_hthread_t thr_id,
ACE_NOTSUP_RETURN (-1);
#endif
}
+
int
ACE_OS::thr_set_affinity (ACE_hthread_t thr_id,
size_t cpu_set_size,
@@ -4215,6 +4673,7 @@ ACE_OS::thr_set_affinity (ACE_hthread_t thr_id,
ACE_NOTSUP_RETURN (-1);
#endif
}
+
int
ACE_OS::thr_key_used (ACE_thread_key_t key)
{
@@ -4231,6 +4690,7 @@ ACE_OS::thr_key_used (ACE_thread_key_t key)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_WIN32 || ACE_HAS_TSS_EMULATION */
}
+
#if defined (ACE_HAS_THREAD_SPECIFIC_STORAGE)
int
ACE_OS::thr_keycreate_native (ACE_OS_thread_key_t *key,
@@ -4257,6 +4717,7 @@ ACE_OS::thr_keycreate_native (ACE_OS_thread_key_t *key,
# elif defined (ACE_HAS_WTHREADS)
ACE_UNUSED_ARG (dest);
*key = ::TlsAlloc ();
+
if (*key == ACE_SYSCALL_FAILED)
ACE_FAIL_RETURN (-1);
return 0;
@@ -4268,6 +4729,7 @@ ACE_OS::thr_keycreate_native (ACE_OS_thread_key_t *key,
# endif /* ACE_HAS_THREADS */
}
#endif /* ACE_HAS_THREAD_SPECIFIC_STORAGE */
+
int
ACE_OS::thr_keycreate (ACE_thread_key_t *key,
# if defined (ACE_HAS_THR_C_DEST)
@@ -4283,6 +4745,7 @@ ACE_OS::thr_keycreate (ACE_thread_key_t *key,
if (ACE_TSS_Emulation::next_key (*key) == 0)
{
ACE_TSS_Emulation::tss_destructor (*key, dest);
+
// Extract out the thread-specific table instance and stash away
// the key and destructor so that we can free it up later on...
TSS_Cleanup_Instance cleanup (TSS_Cleanup_Instance::CREATE);
@@ -4328,6 +4791,7 @@ ACE_OS::thr_keycreate (ACE_thread_key_t *key,
ACE_NOTSUP_RETURN (-1);
# endif /* ACE_HAS_THREADS */
}
+
#if defined (ACE_HAS_THREAD_SPECIFIC_STORAGE)
int
ACE_OS::thr_keyfree_native (ACE_OS_thread_key_t key)
@@ -4362,6 +4826,7 @@ ACE_OS::thr_keyfree_native (ACE_OS_thread_key_t key)
# endif /* ACE_HAS_THREADS */
}
#endif /* ACE_HAS_THREAD_SPECIFIC_STORAGE */
+
int
ACE_OS::thr_keyfree (ACE_thread_key_t key)
{
@@ -4397,18 +4862,22 @@ ACE_OS::thr_keyfree (ACE_thread_key_t key)
return 0;
# endif /* ACE_HAS_THREADS */
}
+
int
ACE_OS::thr_setprio (const ACE_Sched_Priority prio)
{
// Set the thread priority on the current thread.
ACE_hthread_t my_thread_id;
ACE_OS::thr_self (my_thread_id);
+
int const status = ACE_OS::thr_setprio (my_thread_id, prio);
+
#if defined (ACE_NEEDS_LWP_PRIO_SET)
// If the thread is in the RT class, then set the priority on its
// LWP. (Instead of doing this if the thread is in the RT class, it
// should be done for all bound threads. But, there doesn't appear
// to be an easy way to determine if the thread is bound.)
+
if (status == 0)
{
// Find what scheduling class the thread's LWP is in.
@@ -4429,8 +4898,10 @@ ACE_OS::thr_setprio (const ACE_Sched_Priority prio)
// done.
}
#endif /* ACE_NEEDS_LWP_PRIO_SET */
+
return status;
}
+
# if defined (ACE_HAS_THREAD_SPECIFIC_STORAGE)
int
ACE_OS::thr_setspecific_native (ACE_OS_thread_key_t key, void *data)
@@ -4460,6 +4931,7 @@ ACE_OS::thr_setspecific_native (ACE_OS_thread_key_t key, void *data)
# endif /* ACE_HAS_THREADS */
}
# endif /* ACE_HAS_THREAD_SPECIFIC_STORAGE */
+
int
ACE_OS::thr_setspecific (ACE_thread_key_t key, void *data)
{
@@ -4525,6 +4997,7 @@ ACE_OS::thr_setspecific (ACE_thread_key_t key, void *data)
ACE_NOTSUP_RETURN (-1);
# endif /* ACE_HAS_THREADS */
}
+
void
ACE_OS::unique_name (const void *object,
char *name,
@@ -4544,6 +5017,7 @@ ACE_OS::unique_name (const void *object,
temp_name,
length);
}
+
#if defined (ACE_USES_WCHAR)
void
ACE_OS::unique_name (const void *object,
@@ -4565,11 +5039,14 @@ ACE_OS::unique_name (const void *object,
length);
}
#endif
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_VXWORKS) && !defined (__RTP__)
# include /**/ <usrLib.h> /* for ::sp() */
# include /**/ <sysLib.h> /* for ::sysClkRateGet() */
# include "ace/Service_Config.h"
+
// This global function can be used from the VxWorks shell to pass
// arguments to a C main () function.
//
@@ -4583,9 +5060,11 @@ spa (FUNCPTR entry, ...)
static char *argv[ACE_MAX_ARGS];
va_list pvar;
unsigned int argc;
+
// Hardcode a program name because the real one isn't available
// through the VxWorks shell.
argv[0] = "ace_main";
+
// Peel off arguments to spa () and put into argv. va_arg () isn't
// necessarily supposed to return 0 when done, though since the
// VxWorks shell uses a fixed number (10) of arguments, it might 0
@@ -4593,12 +5072,15 @@ spa (FUNCPTR entry, ...)
// limit, but then it couldn't depend on the trailing 0. So, the
// number of arguments would have to be passed.
va_start (pvar, entry);
+
for (argc = 1; argc <= ACE_MAX_ARGS; ++argc)
{
argv[argc] = va_arg (pvar, char *);
+
if (argv[argc] == 0)
break;
}
+
if (argc > ACE_MAX_ARGS && argv[argc-1] != 0)
{
// try to read another arg, and warn user if the limit was exceeded
@@ -4613,6 +5095,7 @@ spa (FUNCPTR entry, ...)
for (unsigned int i = argc; i <= ACE_MAX_ARGS; ++i)
argv[i] = 0;
}
+
// The hard-coded options are what ::sp () uses, except for the
// larger stack size (instead of ::sp ()'s 20000).
int const ret = ::taskSpawn (argv[0], // task name
@@ -4624,10 +5107,12 @@ spa (FUNCPTR entry, ...)
(int) argv, // second argument to main ()
0, 0, 0, 0, 0, 0, 0, 0);
va_end (pvar);
+
// ::taskSpawn () returns the taskID on success: return 0 instead if
// successful
return ret > 0 ? 0 : ret;
}
+
// A helper function for the extended spa functions
static void
add_to_argv (int& argc, char** argv, int max_args, char* string)
@@ -4635,6 +5120,7 @@ add_to_argv (int& argc, char** argv, int max_args, char* string)
char indouble = 0;
size_t previous = 0;
size_t length = ACE_OS::strlen (string);
+
// We use <= to make sure that we get the last argument
for (size_t i = 0; i <= length; i++)
{
@@ -4676,18 +5162,22 @@ add_to_argv (int& argc, char** argv, int max_args, char* string)
ACE_OS::fprintf (stderr, "spae(): number of arguments "
"limited to %d\n", max_args);
}
+
// Skip over whitespace in between arguments
for(++i; i < length && ACE_OS::ace_isspace (string[i]); ++i)
{
}
+
// Save the starting point for the next time around
previous = i;
+
// Make sure we don't skip over a character due
// to the above loop to skip over whitespace
i--;
}
}
}
+
// This global function can be used from the VxWorks shell to pass
// arguments to a C main () function.
//
@@ -4702,21 +5192,25 @@ spae (FUNCPTR entry, ...)
static char* argv[ACE_MAX_ARGS] = { "ace_main", 0 };
va_list pvar;
int argc = 1;
+
// Peel off arguments to spa () and put into argv. va_arg () isn't
// necessarily supposed to return 0 when done, though since the
// VxWorks shell uses a fixed number (10) of arguments, it might 0
// the unused ones.
va_start (pvar, entry);
+
int i = 0;
for (char* str = va_arg (pvar, char*);
str != 0 && i < WINDSH_ARGS; str = va_arg (pvar, char*), ++i)
{
add_to_argv(argc, argv, ACE_MAX_ARGS, str);
}
+
// fill unused argv slots with 0 to get rid of leftovers
// from previous invocations
for (i = argc; i < ACE_MAX_ARGS; ++i)
argv[i] = 0;
+
// The hard-coded options are what ::sp () uses, except for the
// larger stack size (instead of ::sp ()'s 20000).
int const ret = ::taskSpawn (argv[0], // task name
@@ -4728,10 +5222,12 @@ spae (FUNCPTR entry, ...)
(int) argv, // second argument to main ()
0, 0, 0, 0, 0, 0, 0, 0);
va_end (pvar);
+
// ::taskSpawn () returns the taskID on success: return 0 instead if
// successful
return ret > 0 ? 0 : ret;
}
+
// This global function can be used from the VxWorks shell to pass
// arguments to a C main () function. The function will be run
// within the shells task.
@@ -4750,26 +5246,33 @@ spaef (FUNCPTR entry, ...)
static char* argv[ACE_MAX_ARGS] = { "ace_main", 0 };
va_list pvar;
int argc = 1;
+
// Peel off arguments to spa () and put into argv. va_arg () isn't
// necessarily supposed to return 0 when done, though since the
// VxWorks shell uses a fixed number (10) of arguments, it might 0
// the unused ones.
va_start (pvar, entry);
+
int i = 0;
for (char* str = va_arg (pvar, char*);
str != 0 && i < WINDSH_ARGS; str = va_arg (pvar, char*), ++i)
{
add_to_argv(argc, argv, ACE_MAX_ARGS, str);
}
+
// fill unused argv slots with 0 to get rid of leftovers
// from previous invocations
for (i = argc; i < ACE_MAX_ARGS; ++i)
argv[i] = 0;
+
int ret = entry (argc, argv);
+
va_end (pvar);
+
// Return the return value of the invoked ace_main routine.
return ret;
}
+
// This global function can be used from the VxWorks shell to pass
// arguments to and run a main () function (i.e. ace_main).
//
@@ -4779,6 +5282,7 @@ spaef (FUNCPTR entry, ...)
// This routine spawns the main () function in a separate task and waits till the
// task has finished.
static int _vx_call_rc = 0;
+
static int
_vx_call_entry(FUNCPTR entry, int argc, char* argv[])
{
@@ -4786,19 +5290,24 @@ _vx_call_entry(FUNCPTR entry, int argc, char* argv[])
_vx_call_rc = entry (argc, argv);
return _vx_call_rc;
}
+
int
vx_execae (FUNCPTR entry, char* arg, int prio, int opt, int stacksz, ...)
{
static int const ACE_MAX_ARGS = 128;
static char* argv[ACE_MAX_ARGS] = { "ace_main", 0 };
int argc = 1;
+
// Peel off arguments to run_main () and put into argv.
+
if (arg)
add_to_argv(argc, argv, ACE_MAX_ARGS, arg);
+
// fill unused argv slots with 0 to get rid of leftovers
// from previous invocations
for (int i = argc; i < ACE_MAX_ARGS; ++i)
argv[i] = 0;
+
// The hard-coded options are what ::sp () uses, except for the
// larger stack size (instead of ::sp ()'s 20000).
int const ret = ::taskSpawn (argv[0], // task name
@@ -4810,10 +5319,13 @@ vx_execae (FUNCPTR entry, char* arg, int prio, int opt, int stacksz, ...)
argc, // first argument to main ()
(int) argv, // second argument to main ()
0, 0, 0, 0, 0, 0, 0);
+
if (ret == ERROR)
return 255;
+
while( ret > 0 && ::taskIdVerify (ret) != ERROR )
::taskDelay (3 * ::sysClkRateGet ());
+
// ::taskSpawn () returns the taskID on success: return _vx_call_rc instead if
// successful
return ret > 0 ? _vx_call_rc : 255;
diff --git a/dep/ACE_wrappers/ace/OS_NS_Thread.inl b/dep/ACE_wrappers/ace/OS_NS_Thread.inl
index 292076cbdeb..14a32196e8d 100644
--- a/dep/ACE_wrappers/ace/OS_NS_Thread.inl
+++ b/dep/ACE_wrappers/ace/OS_NS_Thread.inl
@@ -1,6 +1,7 @@
// -*- C++ -*-
//
// $Id: OS_NS_Thread.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_macros.h"
// for timespec_t, perhaps move it to os_time.h
#include "ace/Time_Value.h"
@@ -10,17 +11,22 @@
#include "ace/OS_NS_unistd.h"
#include "ace/OS_NS_stdio.h"
#include "ace/OS_NS_errno.h"
+
#if defined (ACE_USES_FIFO_SEM)
# include "ace/OS_NS_sys_stat.h"
# include "ace/OS_NS_sys_select.h"
# include "ace/OS_NS_fcntl.h"
# include "ace/Handle_Set.h"
# endif /* ACE_USES_FIFO_SEM */
+
#if defined (ACE_HAS_PRIOCNTL)
# include /**/ <sys/priocntl.h>
#endif /* ACE_HAS_PRIOCNTL */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/*****************************************************************************/
+
#if defined (ACE_LACKS_COND_T) && defined (ACE_HAS_THREADS)
ACE_INLINE long
ACE_cond_t::waiters (void) const
@@ -28,8 +34,11 @@ ACE_cond_t::waiters (void) const
return this->waiters_;
}
#endif /* ACE_LACKS_COND_T && ACE_HAS_THREADS */
+
/*****************************************************************************/
+
#if defined (ACE_HAS_TSS_EMULATION)
+
# if !defined (ACE_HAS_THREAD_SPECIFIC_STORAGE)
ACE_INLINE
void **&
@@ -44,6 +53,7 @@ ACE_TSS_Emulation::tss_base ()
# endif /* ACE_HAS_VXTHREADS */
}
# endif /* ! ACE_HAS_THREAD_SPECIFIC_STORAGE */
+
ACE_INLINE
ACE_TSS_Emulation::ACE_TSS_DESTRUCTOR
ACE_TSS_Emulation::tss_destructor (const ACE_thread_key_t key)
@@ -51,6 +61,7 @@ ACE_TSS_Emulation::tss_destructor (const ACE_thread_key_t key)
ACE_KEY_INDEX (key_index, key);
return tss_destructor_ [key_index];
}
+
ACE_INLINE
void
ACE_TSS_Emulation::tss_destructor (const ACE_thread_key_t key,
@@ -59,11 +70,13 @@ ACE_TSS_Emulation::tss_destructor (const ACE_thread_key_t key,
ACE_KEY_INDEX (key_index, key);
tss_destructor_ [key_index] = destructor;
}
+
ACE_INLINE
void *&
ACE_TSS_Emulation::ts_object (const ACE_thread_key_t key)
{
ACE_KEY_INDEX (key_index, key);
+
# if defined (ACE_HAS_VXTHREADS)
/* If someone wants tss_base make sure they get one. This
gets used if someone spawns a VxWorks task directly, not
@@ -72,6 +85,7 @@ ACE_TSS_Emulation::ts_object (const ACE_thread_key_t key)
{
taskIdCurrent->ACE_VXWORKS_SPARE =
reinterpret_cast<int> (new void *[ACE_TSS_THREAD_KEYS_MAX]);
+
// Zero the entire TSS array. Do it manually instead of using
// memset, for optimum speed. Though, memset may be faster :-)
void **tss_base_p =
@@ -82,10 +96,14 @@ ACE_TSS_Emulation::ts_object (const ACE_thread_key_t key)
}
}
# endif /* ACE_HAS_VXTHREADS */
+
return tss_base ()[key_index];
}
+
#endif /* ACE_HAS_TSS_EMULATION */
+
/*****************************************************************************/
+
ACE_INLINE int
ACE_OS::thr_equal (ACE_thread_t t1, ACE_thread_t t2)
{
@@ -102,19 +120,24 @@ ACE_OS::thr_equal (ACE_thread_t t1, ACE_thread_t t2)
return t1 == t2;
#endif /* ACE_HAS_PTHREADS */
}
+
#if !defined (ACE_LACKS_COND_T)
// NOTE: The ACE_OS::cond_* functions for Unix platforms are defined
// here because the ACE_OS::sema_* functions below need them.
// However, ACE_WIN32 and VXWORKS define the ACE_OS::cond_* functions
// using the ACE_OS::sema_* functions. So, they are defined in OS.cpp.
+
ACE_INLINE int
ACE_OS::condattr_destroy (ACE_condattr_t &attributes)
{
#if defined (ACE_HAS_THREADS)
# if defined (ACE_HAS_PTHREADS)
+
pthread_condattr_destroy (&attributes);
+
# elif defined (ACE_HAS_STHREADS)
attributes.type = 0;
+
# endif /* ACE_HAS_PTHREADS vs. ACE_HAS_STHREADS */
return 0;
# else
@@ -122,6 +145,7 @@ ACE_OS::condattr_destroy (ACE_condattr_t &attributes)
return 0;
# endif /* ACE_HAS_THREADS */
}
+
ACE_INLINE int
ACE_OS::condattr_init (ACE_condattr_t &attributes,
int type)
@@ -130,6 +154,7 @@ ACE_OS::condattr_init (ACE_condattr_t &attributes,
# if defined (ACE_HAS_THREADS)
# if defined (ACE_HAS_PTHREADS)
int result = -1;
+
# if defined (ACE_VXWORKS) && (ACE_VXWORKS >= 0x600) && (ACE_VXWORKS <= 0x620)
/* Tests show that VxWorks 6.x pthread lib does not only
* require zeroing of mutex/condition objects to function correctly
@@ -147,21 +172,27 @@ ACE_OS::condattr_init (ACE_condattr_t &attributes,
result = 0;
else
result = -1; // ACE_ADAPT_RETVAL used it for intermediate status
+
return result;
# elif defined (ACE_HAS_STHREADS)
attributes.type = type;
+
return 0;
+
# else
ACE_UNUSED_ARG (attributes);
ACE_UNUSED_ARG (type);
ACE_NOTSUP_RETURN (-1);
+
# endif /* ACE_HAS_PTHREADS vs. ACE_HAS_STHREADS */
+
# else
ACE_UNUSED_ARG (attributes);
ACE_UNUSED_ARG (type);
ACE_NOTSUP_RETURN (-1);
# endif /* ACE_HAS_THREADS */
}
+
ACE_INLINE int
ACE_OS::cond_broadcast (ACE_cond_t *cv)
{
@@ -183,6 +214,7 @@ ACE_OS::cond_broadcast (ACE_cond_t *cv)
ACE_NOTSUP_RETURN (-1);
# endif /* ACE_HAS_THREADS */
}
+
ACE_INLINE int
ACE_OS::cond_destroy (ACE_cond_t *cv)
{
@@ -200,6 +232,7 @@ ACE_OS::cond_destroy (ACE_cond_t *cv)
ACE_NOTSUP_RETURN (-1);
# endif /* ACE_HAS_THREADS */
}
+
ACE_INLINE int
ACE_OS::cond_init (ACE_cond_t *cv,
ACE_condattr_t &attributes,
@@ -212,6 +245,7 @@ ACE_OS::cond_init (ACE_cond_t *cv,
# if defined (ACE_HAS_THREADS)
# if defined (ACE_HAS_PTHREADS)
int result = -1;
+
# if defined (ACE_VXWORKS) && (ACE_VXWORKS >= 0x600) && (ACE_VXWORKS <= 0x620)
/* VxWorks 6.x API reference states:
* If the memory for the condition variable object has been allocated
@@ -221,10 +255,12 @@ ACE_OS::cond_init (ACE_cond_t *cv,
*/
ACE_OS::memset (cv, 0, sizeof (*cv));
# endif
+
if (ACE_ADAPT_RETVAL (pthread_cond_init (cv, &attributes), result) == 0)
result = 0;
else
result = -1; // ACE_ADAPT_RETVAL used it for intermediate status
+
return result;
# elif defined (ACE_HAS_STHREADS)
int result;
@@ -242,6 +278,7 @@ ACE_OS::cond_init (ACE_cond_t *cv,
ACE_NOTSUP_RETURN (-1);
# endif /* ACE_HAS_THREADS */
}
+
#if defined (ACE_HAS_WCHAR)
ACE_INLINE int
ACE_OS::cond_init (ACE_cond_t *cv,
@@ -252,6 +289,7 @@ ACE_OS::cond_init (ACE_cond_t *cv,
return ACE_OS::cond_init (cv, attributes, ACE_Wide_To_Ascii (name).char_rep (), arg);
}
#endif /* ACE_HAS_WCHAR */
+
#if defined (ACE_HAS_WCHAR)
ACE_INLINE int
ACE_OS::cond_init (ACE_cond_t *cv, short type, const wchar_t *name, void *arg)
@@ -259,6 +297,7 @@ ACE_OS::cond_init (ACE_cond_t *cv, short type, const wchar_t *name, void *arg)
return ACE_OS::cond_init (cv, type, ACE_Wide_To_Ascii (name).char_rep (), arg);
}
#endif /* ACE_HAS_WCHAR */
+
ACE_INLINE int
ACE_OS::cond_signal (ACE_cond_t *cv)
{
@@ -277,6 +316,7 @@ ACE_OS::cond_signal (ACE_cond_t *cv)
ACE_NOTSUP_RETURN (-1);
# endif /* ACE_HAS_THREADS */
}
+
ACE_INLINE int
ACE_OS::cond_wait (ACE_cond_t *cv,
ACE_mutex_t *external_mutex)
@@ -298,6 +338,7 @@ ACE_OS::cond_wait (ACE_cond_t *cv,
ACE_NOTSUP_RETURN (-1);
# endif /* ACE_HAS_THREADS */
}
+
ACE_INLINE int
ACE_OS::cond_timedwait (ACE_cond_t *cv,
ACE_mutex_t *external_mutex,
@@ -307,9 +348,12 @@ ACE_OS::cond_timedwait (ACE_cond_t *cv,
# if defined (ACE_HAS_THREADS)
int result;
timespec_t ts;
+
if (timeout != 0)
ts = *timeout; // Calls ACE_Time_Value::operator timespec_t().
+
# if defined (ACE_HAS_PTHREADS)
+
ACE_OSCALL (ACE_ADAPT_RETVAL (timeout == 0
? pthread_cond_wait (cv, external_mutex)
: pthread_cond_timedwait (cv, external_mutex,
@@ -321,6 +365,7 @@ ACE_OS::cond_timedwait (ACE_cond_t *cv,
if (result == -1 &&
(errno == ETIMEDOUT || errno == EAGAIN))
errno = ETIME;
+
# elif defined (ACE_HAS_STHREADS)
ACE_OSCALL (ACE_ADAPT_RETVAL (timeout == 0
? ::cond_wait (cv, external_mutex)
@@ -332,6 +377,7 @@ ACE_OS::cond_timedwait (ACE_cond_t *cv,
# endif /* ACE_HAS_STHREADS */
if (timeout != 0)
timeout->set (ts); // Update the time value before returning.
+
return result;
# else
ACE_UNUSED_ARG (cv);
@@ -341,12 +387,14 @@ ACE_OS::cond_timedwait (ACE_cond_t *cv,
# endif /* ACE_HAS_THREADS */
}
#endif /* !ACE_LACKS_COND_T */
+
ACE_INLINE int
ACE_OS::mutex_lock (ACE_mutex_t *m,
const ACE_Time_Value *timeout)
{
return timeout == 0 ? ACE_OS::mutex_lock (m) : ACE_OS::mutex_lock (m, *timeout);
}
+
#if defined (ACE_HAS_WCHAR)
ACE_INLINE int
ACE_OS::event_init (ACE_event_t *event,
@@ -369,6 +417,7 @@ ACE_OS::event_init (ACE_event_t *event,
name);
if (*event == 0)
ACE_FAIL_RETURN (-1);
+
return 0;
#else /* ACE_WIN32 */
return ACE_OS::event_init (event,
@@ -381,6 +430,7 @@ ACE_OS::event_init (ACE_event_t *event,
#endif /* ACE_WIN32 */
}
#endif /* ACE_HAS_WCHAR */
+
ACE_INLINE long
ACE_OS::priority_control (ACE_idtype_t idtype, ACE_id_t identifier, int cmd, void *arg)
{
@@ -396,6 +446,7 @@ ACE_OS::priority_control (ACE_idtype_t idtype, ACE_id_t identifier, int cmd, voi
ACE_NOTSUP_RETURN (-1);
#endif /* ! ACE_HAS_PRIOCNTL*/
}
+
// This method is used to prepare the recursive mutex for releasing
// when waiting on a condition variable. If the platform doesn't have
// native recursive mutex and condition variable support, then ACE needs
@@ -440,6 +491,7 @@ ACE_OS::recursive_mutex_cond_unlock (ACE_recursive_thread_mutex_t *m,
# if defined (ACE_HAS_WINCE) && (UNDER_CE < 500)
ACE_thread_t me = ACE_OS::thr_self ();
# endif /* ACE_HAS_WINCE && CE 4 or earlier */
+
state.relock_count_ = 0;
while (
# if !defined (ACE_HAS_WINCE)
@@ -482,6 +534,7 @@ ACE_OS::recursive_mutex_cond_unlock (ACE_recursive_thread_mutex_t *m,
// the mutex... this part is handled in recursive_mutex_cond_relock().
if (ACE_OS::thread_mutex_lock (&m->nesting_mutex_) == -1)
return -1;
+
# if !defined (ACE_NDEBUG)
if (m->nesting_level_ == 0
|| ACE_OS::thr_equal (ACE_OS::thr_self (), m->owner_id_) == 0)
@@ -491,6 +544,7 @@ ACE_OS::recursive_mutex_cond_unlock (ACE_recursive_thread_mutex_t *m,
return -1;
}
# endif /* ACE_NDEBUG */
+
// To make error recovery a bit easier, signal the condition now. Any
// waiter won't regain control until the mutex is released, which won't
// be until the caller returns and does the wait on the condition.
@@ -501,6 +555,7 @@ ACE_OS::recursive_mutex_cond_unlock (ACE_recursive_thread_mutex_t *m,
ACE_OS::thread_mutex_unlock (&m->nesting_mutex_);
return -1;
}
+
// Ok, the nesting_mutex_ lock is still held, the condition has been
// signaled... reset the nesting info and return _WITH_ the lock
// held. The lock will be released when the condition waits, in the
@@ -518,6 +573,7 @@ ACE_OS::recursive_mutex_cond_unlock (ACE_recursive_thread_mutex_t *m,
#endif /* ACE_HAS_THREADS */
}
+
// This method is called after waiting on a condition variable when a
// recursive mutex must be reacquired. If the platform doesn't natively
// integrate recursive mutexes and condition variables, it's taken care
@@ -545,6 +601,7 @@ ACE_OS::recursive_mutex_cond_relock (ACE_recursive_thread_mutex_t *m,
// prevent warnings for unused variables
ACE_UNUSED_ARG (state);
ACE_UNUSED_ARG (m);
+
# endif /* ACE_WIN32 */
# else
// Without recursive mutex support, it's somewhat trickier. On entry,
@@ -556,6 +613,7 @@ ACE_OS::recursive_mutex_cond_relock (ACE_recursive_thread_mutex_t *m,
// before calling ACE_OS::recursive_mutex_cond_unlock().
while (m->nesting_level_ > 0)
ACE_OS::cond_wait (&m->lock_available_, &m->nesting_mutex_);
+
// At this point, we still have nesting_mutex_ and the mutex is free.
m->nesting_level_ = state.nesting_level_;
m->owner_id_ = state.owner_id_;
@@ -568,6 +626,7 @@ ACE_OS::recursive_mutex_cond_relock (ACE_recursive_thread_mutex_t *m,
return;
#endif /* ACE_HAS_THREADS */
}
+
ACE_INLINE int
ACE_OS::recursive_mutex_destroy (ACE_recursive_thread_mutex_t *m)
{
@@ -587,6 +646,7 @@ ACE_OS::recursive_mutex_destroy (ACE_recursive_thread_mutex_t *m)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_THREADS */
}
+
ACE_INLINE int
ACE_OS::recursive_mutex_init (ACE_recursive_thread_mutex_t *m,
const ACE_TCHAR *name,
@@ -623,6 +683,7 @@ ACE_OS::recursive_mutex_init (ACE_recursive_thread_mutex_t *m,
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_THREADS */
}
+
ACE_INLINE int
ACE_OS::recursive_mutex_lock (ACE_recursive_thread_mutex_t *m)
{
@@ -632,6 +693,7 @@ ACE_OS::recursive_mutex_lock (ACE_recursive_thread_mutex_t *m)
#else
ACE_thread_t const t_id = ACE_OS::thr_self ();
int result = 0;
+
// Acquire the guard.
if (ACE_OS::thread_mutex_lock (&m->nesting_mutex_) == -1)
result = -1;
@@ -650,13 +712,16 @@ ACE_OS::recursive_mutex_lock (ACE_recursive_thread_mutex_t *m)
while (m->nesting_level_ > 0)
ACE_OS::cond_wait (&m->lock_available_,
&m->nesting_mutex_);
+
// At this point the nesting_mutex_ is held...
m->owner_id_ = t_id;
}
+
// At this point, we can safely increment the nesting_level_ no
// matter how we got here!
++m->nesting_level_;
}
+
{
// Save/restore errno.
ACE_Errno_Guard error (errno);
@@ -669,6 +734,7 @@ ACE_OS::recursive_mutex_lock (ACE_recursive_thread_mutex_t *m)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_THREADS */
}
+
ACE_INLINE int
ACE_OS::recursive_mutex_lock (ACE_recursive_thread_mutex_t *m,
const ACE_Time_Value &timeout)
@@ -679,6 +745,7 @@ ACE_OS::recursive_mutex_lock (ACE_recursive_thread_mutex_t *m,
#else
ACE_thread_t t_id = ACE_OS::thr_self ();
int result = 0;
+
// Try to acquire the guard.
if (ACE_OS::thread_mutex_lock (&m->nesting_mutex_, timeout) == -1)
result = -1;
@@ -699,6 +766,7 @@ ACE_OS::recursive_mutex_lock (ACE_recursive_thread_mutex_t *m,
result = ACE_OS::cond_timedwait (&m->lock_available_,
&m->nesting_mutex_,
const_cast <ACE_Time_Value *> (&timeout));
+
// The mutex is reacquired even in the case of a timeout
// release the mutex to prevent a deadlock
if (result == -1)
@@ -706,15 +774,19 @@ ACE_OS::recursive_mutex_lock (ACE_recursive_thread_mutex_t *m,
// Save/restore errno.
ACE_Errno_Guard error (errno);
ACE_OS::thread_mutex_unlock (&m->nesting_mutex_);
+
return result;
}
}
+
// At this point the nesting_mutex_ is held...
m->owner_id_ = t_id;
}
+
// At this point, we can safely increment the nesting_level_ no
// matter how we got here!
m->nesting_level_++;
+
// Save/restore errno.
ACE_Errno_Guard error (errno);
ACE_OS::thread_mutex_unlock (&m->nesting_mutex_);
@@ -727,6 +799,7 @@ ACE_OS::recursive_mutex_lock (ACE_recursive_thread_mutex_t *m,
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_THREADS */
}
+
ACE_INLINE int
ACE_OS::recursive_mutex_lock (ACE_recursive_thread_mutex_t *m,
const ACE_Time_Value *timeout)
@@ -735,6 +808,7 @@ ACE_OS::recursive_mutex_lock (ACE_recursive_thread_mutex_t *m,
? ACE_OS::recursive_mutex_lock (m)
: ACE_OS::recursive_mutex_lock (m, *timeout);
}
+
ACE_INLINE int
ACE_OS::recursive_mutex_trylock (ACE_recursive_thread_mutex_t *m)
{
@@ -744,6 +818,7 @@ ACE_OS::recursive_mutex_trylock (ACE_recursive_thread_mutex_t *m)
#else
ACE_thread_t t_id = ACE_OS::thr_self ();
int result = 0;
+
// Acquire the guard.
if (ACE_OS::thread_mutex_lock (&m->nesting_mutex_) == -1)
result = -1;
@@ -765,6 +840,7 @@ ACE_OS::recursive_mutex_trylock (ACE_recursive_thread_mutex_t *m)
result = -1;
}
}
+
{
// Save/restore errno.
ACE_Errno_Guard error (errno);
@@ -777,6 +853,7 @@ ACE_OS::recursive_mutex_trylock (ACE_recursive_thread_mutex_t *m)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_THREADS */
}
+
ACE_INLINE int
ACE_OS::recursive_mutex_unlock (ACE_recursive_thread_mutex_t *m)
{
@@ -789,6 +866,7 @@ ACE_OS::recursive_mutex_unlock (ACE_recursive_thread_mutex_t *m)
ACE_thread_t t_id = ACE_OS::thr_self ();
# endif /* ACE_NDEBUG */
int result = 0;
+
if (ACE_OS::thread_mutex_lock (&m->nesting_mutex_) == -1)
result = -1;
else
@@ -809,12 +887,14 @@ ACE_OS::recursive_mutex_unlock (ACE_recursive_thread_mutex_t *m)
// This may not be strictly necessary, but it does put
// the mutex into a known state...
m->owner_id_ = ACE_OS::NULL_thread;
+
// Inform a waiter that the lock is free.
if (ACE_OS::cond_signal (&m->lock_available_) == -1)
result = -1;
}
}
}
+
{
// Save/restore errno.
ACE_Errno_Guard error (errno);
@@ -827,6 +907,7 @@ ACE_OS::recursive_mutex_unlock (ACE_recursive_thread_mutex_t *m)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_THREADS */
}
+
ACE_INLINE int
ACE_OS::rw_rdlock (ACE_rwlock_t *rw)
{
@@ -877,6 +958,7 @@ ACE_OS::rw_rdlock (ACE_rwlock_t *rw)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_THREADS */
}
+
ACE_INLINE int
ACE_OS::rw_tryrdlock (ACE_rwlock_t *rw)
{
@@ -894,9 +976,11 @@ ACE_OS::rw_tryrdlock (ACE_rwlock_t *rw)
# endif /* ACE_HAS_PTHREADS_UNIX98_EXT */
# else /* NT, POSIX, and VxWorks don't support this natively. */
int result = -1;
+
if (ACE_OS::mutex_lock (&rw->lock_) != -1)
{
ACE_Errno_Guard error (errno);
+
if (rw->ref_count_ == -1 || rw->num_waiting_writers_ > 0)
{
error = EBUSY;
@@ -907,6 +991,7 @@ ACE_OS::rw_tryrdlock (ACE_rwlock_t *rw)
rw->ref_count_++;
result = 0;
}
+
ACE_OS::mutex_unlock (&rw->lock_);
}
return result;
@@ -916,6 +1001,7 @@ ACE_OS::rw_tryrdlock (ACE_rwlock_t *rw)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_THREADS */
}
+
ACE_INLINE int
ACE_OS::rw_trywrlock (ACE_rwlock_t *rw)
{
@@ -933,9 +1019,11 @@ ACE_OS::rw_trywrlock (ACE_rwlock_t *rw)
# endif /* ACE_HAS_PTHREADS_UNIX98_EXT */
# else /* NT, POSIX, and VxWorks don't support this natively. */
int result = -1;
+
if (ACE_OS::mutex_lock (&rw->lock_) != -1)
{
ACE_Errno_Guard error (errno);
+
if (rw->ref_count_ != 0)
{
error = EBUSY;
@@ -946,6 +1034,7 @@ ACE_OS::rw_trywrlock (ACE_rwlock_t *rw)
rw->ref_count_ = -1;
result = 0;
}
+
ACE_OS::mutex_unlock (&rw->lock_);
}
return result;
@@ -955,11 +1044,13 @@ ACE_OS::rw_trywrlock (ACE_rwlock_t *rw)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_THREADS */
}
+
// Note that the caller of this method *must* already possess this
// lock as a read lock.
// return {-1 and no errno set means: error,
// -1 and errno==EBUSY set means: could not upgrade,
// 0 means: upgraded successfully}
+
ACE_INLINE int
ACE_OS::rw_trywrlock_upgrade (ACE_rwlock_t *rw)
{
@@ -980,9 +1071,11 @@ ACE_OS::rw_trywrlock_upgrade (ACE_rwlock_t *rw)
# else /* NT, POSIX, and VxWorks don't support this natively. */
// The ACE rwlock emulation does support upgrade . . .
int result = 0;
+
# if defined (ACE_HAS_PTHREADS)
ACE_PTHREAD_CLEANUP_PUSH (&rw->lock_);
# endif /* defined (ACE_HAS_PTHREADS) */
+
if (ACE_OS::mutex_lock (&rw->lock_) == -1)
return -1;
// -1 means didn't get the mutex, error
@@ -998,6 +1091,7 @@ ACE_OS::rw_trywrlock_upgrade (ACE_rwlock_t *rw)
{
rw->num_waiting_writers_++; // prohibit any more readers
rw->important_writer_ = 1;
+
if (ACE_OS::cond_wait (&rw->waiting_important_writer_, &rw->lock_) == -1)
{
result = -1;
@@ -1015,17 +1109,22 @@ ACE_OS::rw_trywrlock_upgrade (ACE_rwlock_t *rw)
// everything is O.K.
}
}
+
ACE_OS::mutex_unlock (&rw->lock_);
+
# if defined (ACE_HAS_PTHREADS)
ACE_PTHREAD_CLEANUP_POP (0);
# endif /* defined (ACE_HAS_PTHREADS) */
+
return result;
+
# endif /* ! ACE_LACKS_RWLOCK_T */
#else
ACE_UNUSED_ARG (rw);
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_THREADS */
}
+
ACE_INLINE int
ACE_OS::rw_unlock (ACE_rwlock_t *rw)
{
@@ -1044,6 +1143,7 @@ ACE_OS::rw_unlock (ACE_rwlock_t *rw)
# else /* NT, POSIX, and VxWorks don't support this natively. */
if (ACE_OS::mutex_lock (&rw->lock_) == -1)
return -1;
+
if (rw->ref_count_ > 0) // Releasing a reader.
rw->ref_count_--;
else if (rw->ref_count_ == -1) // Releasing a writer.
@@ -1053,8 +1153,10 @@ ACE_OS::rw_unlock (ACE_rwlock_t *rw)
(void) ACE_OS::mutex_unlock (&rw->lock_);
return -1; // @@ ACE_ASSERT (!"count should not be 0!\n");
}
+
int result = 0;
ACE_Errno_Guard error (errno);
+
if (rw->important_writer_ && rw->ref_count_ == 1)
// only the reader requesting to upgrade its lock is left over.
{
@@ -1072,6 +1174,7 @@ ACE_OS::rw_unlock (ACE_rwlock_t *rw)
result = ACE_OS::cond_broadcast (&rw->waiting_readers_);
error = errno;
}
+
(void) ACE_OS::mutex_unlock (&rw->lock_);
return result;
# endif /* ! ace_lacks_rwlock_t */
@@ -1080,6 +1183,7 @@ ACE_OS::rw_unlock (ACE_rwlock_t *rw)
ACE_NOTSUP_RETURN (-1);
#endif /* ace_has_threads */
}
+
ACE_INLINE int
ACE_OS::rw_wrlock (ACE_rwlock_t *rw)
{
@@ -1100,6 +1204,7 @@ ACE_OS::rw_wrlock (ACE_rwlock_t *rw)
ACE_PTHREAD_CLEANUP_PUSH (&rw->lock_);
# endif /* defined (ACE_HAS_PTHREADS) */
int result = 0;
+
if (ACE_OS::mutex_lock (&rw->lock_) == -1)
result = -1; // -1 means didn't get the mutex.
else
@@ -1107,11 +1212,13 @@ ACE_OS::rw_wrlock (ACE_rwlock_t *rw)
while (rw->ref_count_ != 0)
{
rw->num_waiting_writers_++;
+
if (ACE_OS::cond_wait (&rw->waiting_writers_, &rw->lock_) == -1)
{
result = -2; // -2 means we need to release the mutex.
break;
}
+
rw->num_waiting_writers_--;
}
}
@@ -1129,6 +1236,7 @@ ACE_OS::rw_wrlock (ACE_rwlock_t *rw)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_THREADS */
}
+
ACE_INLINE int
ACE_OS::rwlock_destroy (ACE_rwlock_t *rw)
{
@@ -1155,6 +1263,7 @@ ACE_OS::rwlock_destroy (ACE_rwlock_t *rw)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_THREADS */
}
+
#if defined (ACE_HAS_THREADS) && (!defined (ACE_LACKS_RWLOCK_T) || \
defined (ACE_HAS_PTHREADS_UNIX98_EXT))
ACE_INLINE int
@@ -1167,6 +1276,7 @@ ACE_OS::rwlock_init (ACE_rwlock_t *rw,
# if defined (ACE_HAS_PTHREADS_UNIX98_EXT)
ACE_UNUSED_ARG (name);
ACE_UNUSED_ARG (arg);
+
int status;
pthread_rwlockattr_t attr;
pthread_rwlockattr_init (&attr);
@@ -1179,7 +1289,9 @@ ACE_OS::rwlock_init (ACE_rwlock_t *rw,
# endif /* !ACE_LACKS_RWLOCKATTR_PSHARED */
status = ACE_ADAPT_RETVAL (pthread_rwlock_init (rw, &attr), status);
pthread_rwlockattr_destroy (&attr);
+
return status;
+
# else
type = type;
name = name;
@@ -1188,6 +1300,7 @@ ACE_OS::rwlock_init (ACE_rwlock_t *rw,
# endif /* ACE_HAS_PTHREADS_UNIX98_EXT */
}
#endif /* ACE_HAS THREADS && !defined (ACE_LACKS_RWLOCK_T) */
+
ACE_INLINE int
ACE_OS::sema_destroy (ACE_sema_t *s)
{
@@ -1265,8 +1378,10 @@ ACE_OS::sema_destroy (ACE_sema_t *s)
ACE_NOTSUP_RETURN (-1);
# endif /* ACE_HAS_POSIX_SEM */
}
+
// NOTE: The previous four function definitions must appear before
// ACE_OS::sema_init ().
+
ACE_INLINE int
ACE_OS::sema_init (ACE_sema_t *s,
u_int count,
@@ -1280,11 +1395,13 @@ ACE_OS::sema_init (ACE_sema_t *s,
#if defined (ACE_HAS_POSIX_SEM)
ACE_UNUSED_ARG (max);
ACE_UNUSED_ARG (sa);
+
s->name_ = 0;
# if defined (ACE_HAS_POSIX_SEM_TIMEOUT) || defined (ACE_DISABLE_POSIX_SEM_TIMEOUT_EMULATION)
ACE_UNUSED_ARG (arg);
# else
int result = -1;
+
if (ACE_OS::mutex_init (&s->lock_, type, name,
(ACE_mutexattr_t *) arg) == 0
&& ACE_OS::cond_init (&s->count_nonzero_, (short)type, name, arg) == 0
@@ -1293,6 +1410,7 @@ ACE_OS::sema_init (ACE_sema_t *s,
if (ACE_OS::mutex_unlock (&s->lock_) == 0)
result = 0;
}
+
if (result == -1)
{
ACE_OS::mutex_destroy (&s->lock_);
@@ -1300,6 +1418,7 @@ ACE_OS::sema_init (ACE_sema_t *s,
return result;
}
# endif /* ACE_HAS_POSIX_SEM_TIMEOUT || ACE_DISABLE_POSIX_SEM_TIMEOUT_EMULATION */
+
# if defined (ACE_LACKS_NAMED_POSIX_SEM)
s->new_sema_ = false;
if (type == USYNC_PROCESS)
@@ -1330,6 +1449,7 @@ ACE_OS::sema_init (ACE_sema_t *s,
}
if (fd == -1)
return -1;
+
s->sema_ = (sem_t *)
ACE_OS::mmap (0,
sizeof (ACE_sema_t),
@@ -1371,6 +1491,7 @@ ACE_OS::sema_init (ACE_sema_t *s,
name = last_slash; // Chop off chars preceding last slash
# endif /* sun */
# endif /* sun || HPUX */
+
ACE_ALLOCATOR_RETURN (s->name_,
ACE_OS::strdup (name),
-1);
@@ -1396,12 +1517,14 @@ ACE_OS::sema_init (ACE_sema_t *s,
type != USYNC_THREAD,
count), int, -1);
}
+
#elif defined (ACE_USES_FIFO_SEM)
ACE_UNUSED_ARG (arg);
ACE_UNUSED_ARG (max);
ACE_UNUSED_ARG (sa);
int flags = 0;
mode_t mode = S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP;
+
if (type == USYNC_THREAD)
{
// Create systemwide unique name for semaphore
@@ -1411,9 +1534,11 @@ ACE_OS::sema_init (ACE_sema_t *s,
ACE_UNIQUE_NAME_LEN);
name = &uname[0];
}
+
s->name_ = 0;
s->fd_[0] = s->fd_[1] = ACE_INVALID_HANDLE;
bool creator = false;
+
if (ACE_OS::mkfifo (ACE_TEXT_CHAR_TO_TCHAR (name), mode) < 0)
{
if (errno != EEXIST) /* already exists OK else ERR */
@@ -1431,6 +1556,7 @@ ACE_OS::sema_init (ACE_sema_t *s,
}
else
creator = true; // remember we created it for initialization at end
+
// for processshared semaphores remember who we are to be able to remove
// the FIFO when we're done with it
if (type == USYNC_PROCESS)
@@ -1443,15 +1569,19 @@ ACE_OS::sema_init (ACE_sema_t *s,
return -1;
}
}
+
if ((s->fd_[0] = ACE_OS::open (name, O_RDONLY | O_NONBLOCK)) == ACE_INVALID_HANDLE
|| (s->fd_[1] = ACE_OS::open (name, O_WRONLY | O_NONBLOCK)) == ACE_INVALID_HANDLE)
return (-1);
+
/* turn off nonblocking for fd_[0] */
if ((flags = ACE_OS::fcntl (s->fd_[0], F_GETFL, 0)) < 0)
return (-1);
+
flags &= ~O_NONBLOCK;
if (ACE_OS::fcntl (s->fd_[0], F_SETFL, flags) < 0)
return (-1);
+
//if (s->name_ && count)
if (creator && count)
{
@@ -1460,6 +1590,7 @@ ACE_OS::sema_init (ACE_sema_t *s,
if (ACE_OS::write (s->fd_[1], &c, sizeof (char)) != 1)
return (-1);
}
+
// In the case of process scope semaphores we can already unlink the FIFO now that
// we completely set it up (the opened handles will keep it active until we close
// thos down). This way we're protected against unexpected crashes as far as removal
@@ -1470,6 +1601,7 @@ ACE_OS::sema_init (ACE_sema_t *s,
{
ACE_OS::unlink (name);
}
+
return (0);
#elif defined (ACE_HAS_THREADS)
# if defined (ACE_HAS_STHREADS)
@@ -1483,6 +1615,7 @@ ACE_OS::sema_init (ACE_sema_t *s,
ACE_UNUSED_ARG (max);
ACE_UNUSED_ARG (sa);
int result = -1;
+
if (ACE_OS::mutex_init (&s->lock_, type, name,
(ACE_mutexattr_t *) arg) == 0
&& ACE_OS::cond_init (&s->count_nonzero_, type, name, arg) == 0
@@ -1490,9 +1623,11 @@ ACE_OS::sema_init (ACE_sema_t *s,
{
s->count_ = count;
s->waiters_ = 0;
+
if (ACE_OS::mutex_unlock (&s->lock_) == 0)
result = 0;
}
+
if (result == -1)
{
ACE_OS::mutex_destroy (&s->lock_);
@@ -1512,6 +1647,7 @@ ACE_OS::sema_init (ACE_sema_t *s,
count,
max,
name);
+
if (*s == 0)
ACE_FAIL_RETURN (-1);
/* NOTREACHED */
@@ -1519,6 +1655,7 @@ ACE_OS::sema_init (ACE_sema_t *s,
return 0;
# else /* ACE_USES_WINCE_SEMA_SIMULATION */
int result = -1;
+
// Initialize internal object for semaphore simulation.
// Grab the lock as soon as possible when we initializing
// the semaphore count. Notice that we initialize the
@@ -1535,9 +1672,11 @@ ACE_OS::sema_init (ACE_sema_t *s,
&& ACE_OS::thread_mutex_lock (&s->lock_) == 0)
{
s->count_ = count;
+
if (ACE_OS::thread_mutex_unlock (&s->lock_) == 0)
result = 0;
}
+
// Destroy the internal objects if we didn't initialize
// either of them successfully. Don't bother to check
// for errors.
@@ -1568,6 +1707,7 @@ ACE_OS::sema_init (ACE_sema_t *s,
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_POSIX_SEM */
}
+
#if defined (ACE_HAS_WCHAR)
ACE_INLINE int
ACE_OS::sema_init (ACE_sema_t *s,
@@ -1591,6 +1731,7 @@ ACE_OS::sema_init (ACE_sema_t *s,
count,
max,
name);
+
if (*s == 0)
ACE_FAIL_RETURN (-1);
/* NOTREACHED */
@@ -1598,6 +1739,7 @@ ACE_OS::sema_init (ACE_sema_t *s,
return 0;
# else /* ACE_USES_WINCE_SEMA_SIMULATION */
int result = -1;
+
// Initialize internal object for semaphore simulation.
// Grab the lock as soon as possible when we initializing
// the semaphore count. Notice that we initialize the
@@ -1614,9 +1756,11 @@ ACE_OS::sema_init (ACE_sema_t *s,
&& ACE_OS::thread_mutex_lock (&s->lock_) == 0)
{
s->count_ = count;
+
if (ACE_OS::thread_mutex_unlock (&s->lock_) == 0)
result = 0;
}
+
// Destroy the internal objects if we didn't initialize
// either of them successfully. Don't bother to check
// for errors.
@@ -1633,6 +1777,7 @@ ACE_OS::sema_init (ACE_sema_t *s,
# endif /* ACE_HAS_WTHREADS */
}
#endif /* ACE_HAS_WCHAR */
+
ACE_INLINE int
ACE_OS::sema_post (ACE_sema_t *s)
{
@@ -1642,10 +1787,12 @@ ACE_OS::sema_post (ACE_sema_t *s)
ACE_OSCALL_RETURN (::sem_post (s->sema_), int, -1);
# else
int result = -1;
+
if (ACE_OS::mutex_lock (&s->lock_) == 0)
{
if (::sem_post (s->sema_) == 0)
result = ACE_OS::cond_signal (&s->count_nonzero_);
+
ACE_OS::mutex_unlock (&s->lock_);
}
return result;
@@ -1661,6 +1808,7 @@ ACE_OS::sema_post (ACE_sema_t *s)
ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::sema_post (s), result), int, -1);
# elif defined (ACE_HAS_PTHREADS)
int result = -1;
+
if (ACE_OS::mutex_lock (&s->lock_) == 0)
{
// Always allow a waiter to continue if there is one.
@@ -1668,6 +1816,7 @@ ACE_OS::sema_post (ACE_sema_t *s)
result = ACE_OS::cond_signal (&s->count_nonzero_);
else
result = 0;
+
s->count_++;
ACE_OS::mutex_unlock (&s->lock_);
}
@@ -1679,6 +1828,7 @@ ACE_OS::sema_post (ACE_sema_t *s)
int, -1);
# else /* ACE_USES_WINCE_SEMA_SIMULATION */
int result = -1;
+
// Since we are simulating semaphores, we need to update semaphore
// count manually. Grab the lock to prevent race condition first.
if (ACE_OS::thread_mutex_lock (&s->lock_) == 0)
@@ -1690,6 +1840,7 @@ ACE_OS::sema_post (ACE_sema_t *s)
result = ACE_OS::event_signal (&s->count_nonzero_);
else
result = 0;
+
ACE_OS::thread_mutex_unlock (&s->lock_);
}
return result;
@@ -1702,6 +1853,7 @@ ACE_OS::sema_post (ACE_sema_t *s)
ACE_NOTSUP_RETURN (-1);
# endif /* ACE_HAS_POSIX_SEM */
}
+
ACE_INLINE int
ACE_OS::sema_post (ACE_sema_t *s, u_int release_count)
{
@@ -1720,9 +1872,11 @@ ACE_OS::sema_post (ACE_sema_t *s, u_int release_count)
for (size_t i = 0; i < release_count; i++)
if (ACE_OS::sema_post (s) == -1)
return -1;
+
return 0;
#endif /* ACE_WIN32 */
}
+
ACE_INLINE int
ACE_OS::sema_trywait (ACE_sema_t *s)
{
@@ -1733,20 +1887,24 @@ ACE_OS::sema_trywait (ACE_sema_t *s)
# elif defined (ACE_USES_FIFO_SEM)
char c;
int rc, flags;
+
/* turn on nonblocking for s->fd_[0] */
if ((flags = ACE_OS::fcntl (s->fd_[0], F_GETFL, 0)) < 0)
return (-1);
flags |= O_NONBLOCK;
if (ACE_OS::fcntl (s->fd_[0], F_SETFL, flags) < 0)
return (-1);
+
// read sets errno to EAGAIN if no input
rc = ACE_OS::read (s->fd_[0], &c, sizeof (char));
+
/* turn off nonblocking for fd_[0] */
if ((flags = ACE_OS::fcntl (s->fd_[0], F_GETFL, 0)) >= 0)
{
flags &= ~O_NONBLOCK;
ACE_OS::fcntl (s->fd_[0], F_SETFL, flags);
}
+
return rc == 1 ? 0 : (-1);
# elif defined (ACE_HAS_THREADS)
# if defined (ACE_HAS_STHREADS)
@@ -1756,7 +1914,9 @@ ACE_OS::sema_trywait (ACE_sema_t *s)
result),
int, -1);
# elif defined (ACE_HAS_PTHREADS)
+
int result = -1;
+
if (ACE_OS::mutex_lock (&s->lock_) == 0)
{
if (s->count_ > 0)
@@ -1766,12 +1926,14 @@ ACE_OS::sema_trywait (ACE_sema_t *s)
}
else
errno = EBUSY;
+
ACE_OS::mutex_unlock (&s->lock_);
}
return result;
# elif defined (ACE_HAS_WTHREADS)
# if !defined (ACE_USES_WINCE_SEMA_SIMULATION)
DWORD result = ::WaitForSingleObject (*s, 0);
+
if (result == WAIT_OBJECT_0)
return 0;
else
@@ -1788,9 +1950,11 @@ ACE_OS::sema_trywait (ACE_sema_t *s)
// if the semaphore is not available and avoid grabing the
// lock.
DWORD result = ::WaitForSingleObject (s->count_nonzero_, 0);
+
if (result == WAIT_OBJECT_0) // Proceed when it is available.
{
ACE_OS::thread_mutex_lock (&s->lock_);
+
// Need to double check if the semaphore is still available.
// The double checking scheme will slightly affect the
// efficiency if most of the time semaphores are not blocked.
@@ -1804,8 +1968,10 @@ ACE_OS::sema_trywait (ACE_sema_t *s)
ACE_OS::event_reset (&s->count_nonzero_);
result = 0;
}
+
ACE_OS::thread_mutex_unlock (&s->lock_);
}
+
// Translate error message to errno used by ACE.
if (result == WAIT_TIMEOUT)
errno = EBUSY;
@@ -1834,6 +2000,7 @@ ACE_OS::sema_trywait (ACE_sema_t *s)
ACE_NOTSUP_RETURN (-1);
# endif /* ACE_HAS_POSIX_SEM */
}
+
ACE_INLINE int
ACE_OS::sema_wait (ACE_sema_t *s)
{
@@ -1851,7 +2018,9 @@ ACE_OS::sema_wait (ACE_sema_t *s)
ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::sema_wait (s), result), int, -1);
# elif defined (ACE_HAS_PTHREADS)
int result = 0;
+
ACE_PTHREAD_CLEANUP_PUSH (&s->lock_);
+
if (ACE_OS::mutex_lock (&s->lock_) != 0)
result = -1;
else
@@ -1859,6 +2028,7 @@ ACE_OS::sema_wait (ACE_sema_t *s)
// Keep track of the number of waiters so that we can signal
// them properly in <ACE_OS::sema_post>.
s->waiters_++;
+
// Wait until the semaphore count is > 0.
while (s->count_ == 0)
if (ACE_OS::cond_wait (&s->count_nonzero_,
@@ -1867,14 +2037,18 @@ ACE_OS::sema_wait (ACE_sema_t *s)
result = -2; // -2 means that we need to release the mutex.
break;
}
+
--s->waiters_;
}
+
if (result == 0)
--s->count_;
+
if (result != -1)
ACE_OS::mutex_unlock (&s->lock_);
ACE_PTHREAD_CLEANUP_POP (0);
return result < 0 ? -1 : result;
+
# elif defined (ACE_HAS_WTHREADS)
# if !defined (ACE_USES_WINCE_SEMA_SIMULATION)
switch (::WaitForSingleObject (*s, INFINITE))
@@ -1898,6 +2072,7 @@ ACE_OS::sema_wait (ACE_sema_t *s)
{
case WAIT_OBJECT_0:
ACE_OS::thread_mutex_lock (&s->lock_);
+
// Need to double check if the semaphore is still available.
// This time, we shouldn't wait at all.
if (::WaitForSingleObject (s->count_nonzero_, 0) == WAIT_OBJECT_0)
@@ -1909,12 +2084,14 @@ ACE_OS::sema_wait (ACE_sema_t *s)
ACE_OS::event_reset (&s->count_nonzero_);
result = 0;
}
+
ACE_OS::thread_mutex_unlock (&s->lock_);
// if we didn't get a hold on the semaphore, the result won't
// be 0 and thus, we'll start from the beginning again.
if (result == 0)
return 0;
break;
+
default:
// Since we wait indefinitely, anything other than
// WAIT_OBJECT_O indicates an error.
@@ -1932,6 +2109,7 @@ ACE_OS::sema_wait (ACE_sema_t *s)
ACE_NOTSUP_RETURN (-1);
# endif /* ACE_HAS_POSIX_SEM */
}
+
ACE_INLINE int
ACE_OS::sema_wait (ACE_sema_t *s, ACE_Time_Value &tv)
{
@@ -1949,7 +2127,9 @@ ACE_OS::sema_wait (ACE_sema_t *s, ACE_Time_Value &tv)
int result = 0;
bool expired = false;
ACE_Errno_Guard error (errno);
+
ACE_PTHREAD_CLEANUP_PUSH (&s->lock_);
+
if (ACE_OS::mutex_lock (&s->lock_) != 0)
result = -2;
else
@@ -1962,6 +2142,7 @@ ACE_OS::sema_wait (ACE_sema_t *s, ACE_Time_Value &tv)
expired = ACE_OS::gettimeofday () > tv;
else
expired = false;
+
finished = result != -1 || expired ||
(result == -1 && errno != EAGAIN);
if (!finished)
@@ -1976,12 +2157,15 @@ ACE_OS::sema_wait (ACE_sema_t *s, ACE_Time_Value &tv)
}
}
} while (!finished);
+
if (expired)
error = ETIME;
+
# if defined (ACE_LACKS_COND_TIMEDWAIT_RESET)
tv = ACE_OS::gettimeofday ();
# endif /* ACE_LACKS_COND_TIMEDWAIT_RESET */
}
+
if (result != -2)
ACE_OS::mutex_unlock (&s->lock_);
ACE_PTHREAD_CLEANUP_POP (0);
@@ -1994,11 +2178,14 @@ ACE_OS::sema_wait (ACE_sema_t *s, ACE_Time_Value &tv)
# elif defined (ACE_USES_FIFO_SEM)
int rc;
ACE_Time_Value now = ACE_OS::gettimeofday ();
+
while (tv > now)
{
ACE_Time_Value timeout = tv;
timeout -= now;
+
ACE_Handle_Set fds_;
+
fds_.set_bit (s->fd_[0]);
if ((rc = ACE_OS::select (ACE_Handle_Set::MAXSIZE, fds_, 0, 0, timeout)) != 1)
{
@@ -2009,15 +2196,19 @@ ACE_OS::sema_wait (ACE_sema_t *s, ACE_Time_Value &tv)
return (-1);
}
}
+
// try to read the signal *but* do *not* block
if (rc == 1 && ACE_OS::sema_trywait (s) == 0)
return (0);
+
// we were woken for input but someone beat us to it
// so we wait again if there is still time
now = ACE_OS::gettimeofday ();
}
+
// make sure errno is set right
errno = ETIME;
+
return (-1);
# elif defined (ACE_HAS_THREADS)
# if defined (ACE_HAS_STHREADS)
@@ -2027,7 +2218,9 @@ ACE_OS::sema_wait (ACE_sema_t *s, ACE_Time_Value &tv)
# elif defined (ACE_HAS_PTHREADS)
int result = 0;
ACE_Errno_Guard error (errno);
+
ACE_PTHREAD_CLEANUP_PUSH (&s->lock_);
+
if (ACE_OS::mutex_lock (&s->lock_) != 0)
result = -1;
else
@@ -2035,6 +2228,7 @@ ACE_OS::sema_wait (ACE_sema_t *s, ACE_Time_Value &tv)
// Keep track of the number of waiters so that we can signal
// them properly in <ACE_OS::sema_post>.
s->waiters_++;
+
// Wait until the semaphore count is > 0 or until we time out.
while (s->count_ == 0)
if (ACE_OS::cond_timedwait (&s->count_nonzero_,
@@ -2045,8 +2239,10 @@ ACE_OS::sema_wait (ACE_sema_t *s, ACE_Time_Value &tv)
result = -2; // -2 means that we need to release the mutex.
break;
}
+
--s->waiters_;
}
+
if (result == 0)
{
# if defined (ACE_LACKS_COND_TIMEDWAIT_RESET)
@@ -2054,6 +2250,7 @@ ACE_OS::sema_wait (ACE_sema_t *s, ACE_Time_Value &tv)
# endif /* ACE_LACKS_COND_TIMEDWAIT_RESET */
--s->count_;
}
+
if (result != -1)
ACE_OS::mutex_unlock (&s->lock_);
ACE_PTHREAD_CLEANUP_POP (0);
@@ -2061,6 +2258,7 @@ ACE_OS::sema_wait (ACE_sema_t *s, ACE_Time_Value &tv)
# elif defined (ACE_HAS_WTHREADS)
# if !defined (ACE_USES_WINCE_SEMA_SIMULATION)
int msec_timeout;
+
if (tv.sec () == 0 && tv.usec () == 0)
msec_timeout = 0; // Do a "poll."
else
@@ -2069,6 +2267,7 @@ ACE_OS::sema_wait (ACE_sema_t *s, ACE_Time_Value &tv)
// passed as a parameter) and relative time (which is what
// <WaitForSingleObjects> expects).
ACE_Time_Value relative_time (tv - ACE_OS::gettimeofday ());
+
// Watchout for situations where a context switch has caused the
// current time to be > the timeout.
if (relative_time < ACE_Time_Value::zero)
@@ -2076,6 +2275,7 @@ ACE_OS::sema_wait (ACE_sema_t *s, ACE_Time_Value &tv)
else
msec_timeout = relative_time.msec ();
}
+
switch (::WaitForSingleObject (*s, msec_timeout))
{
case WAIT_OBJECT_0:
@@ -2095,6 +2295,7 @@ ACE_OS::sema_wait (ACE_sema_t *s, ACE_Time_Value &tv)
// we may get signaled but cannot grab the semaphore before
// timeout. In that case, we'll need to restart the process with
// updated timeout value.
+
// tv is an absolute time, but we need relative to work with the Windows
// API. Also, some users have become accustomed to using a 0 time value
// as a shortcut for "now", which works on non-Windows because 0 is
@@ -2105,6 +2306,7 @@ ACE_OS::sema_wait (ACE_sema_t *s, ACE_Time_Value &tv)
end_time = ACE_OS::gettimeofday ();
ACE_Time_Value relative_time = end_time - ACE_OS::gettimeofday ();
int result = -1;
+
// While we are not timeout yet. >= 0 will let this go through once
// and if not able to get the object, it should hit WAIT_TIMEOUT
// right away.
@@ -2115,6 +2317,7 @@ ACE_OS::sema_wait (ACE_sema_t *s, ACE_Time_Value &tv)
{
case WAIT_OBJECT_0:
ACE_OS::thread_mutex_lock (&s->lock_);
+
// Need to double check if the semaphore is still available.
// We can only do a "try lock" styled wait here to avoid
// blocking threads that want to signal the semaphore.
@@ -2127,7 +2330,9 @@ ACE_OS::sema_wait (ACE_sema_t *s, ACE_Time_Value &tv)
ACE_OS::event_reset (&s->count_nonzero_);
result = 0;
}
+
ACE_OS::thread_mutex_unlock (&s->lock_);
+
// Only return when we successfully get the semaphore.
if (result == 0)
{
@@ -2135,20 +2340,24 @@ ACE_OS::sema_wait (ACE_sema_t *s, ACE_Time_Value &tv)
return 0;
}
break;
+
// We have timed out.
case WAIT_TIMEOUT:
errno = ETIME;
return -1;
+
// What?
default:
ACE_OS::set_errno_to_last_error ();
// This is taken from the hack above. ;)
return -1;
};
+
// Haven't been able to get the semaphore yet, update the
// timeout value to reflect the remaining time we want to wait.
relative_time = end_time - ACE_OS::gettimeofday ();
}
+
// We have timed out.
errno = ETIME;
return -1;
@@ -2158,7 +2367,9 @@ ACE_OS::sema_wait (ACE_sema_t *s, ACE_Time_Value &tv)
// passed as a parameter) and relative time (which is what
// the system call expects).
ACE_Time_Value relative_time (tv - ACE_OS::gettimeofday ());
+
int ticks_per_sec = ::sysClkRateGet ();
+
int ticks = relative_time.sec () * ticks_per_sec +
relative_time.usec () * ticks_per_sec / ACE_ONE_SECOND_IN_USECS;
if (::semTake (s->sema_, ticks) == ERROR)
@@ -2183,11 +2394,13 @@ ACE_OS::sema_wait (ACE_sema_t *s, ACE_Time_Value &tv)
ACE_NOTSUP_RETURN (-1);
# endif /* ACE_HAS_POSIX_SEM */
}
+
ACE_INLINE int
ACE_OS::sema_wait (ACE_sema_t *s, ACE_Time_Value *tv)
{
return tv == 0 ? ACE_OS::sema_wait (s) : ACE_OS::sema_wait (s, *tv);
}
+
ACE_INLINE int
ACE_OS::semctl (int int_id, int semnum, int cmd, semun value)
{
@@ -2199,9 +2412,11 @@ ACE_OS::semctl (int int_id, int semnum, int cmd, semun value)
ACE_UNUSED_ARG (semnum);
ACE_UNUSED_ARG (cmd);
ACE_UNUSED_ARG (value);
+
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_SYSV_IPC */
}
+
ACE_INLINE int
ACE_OS::semget (key_t key, int nsems, int flags)
{
@@ -2212,9 +2427,11 @@ ACE_OS::semget (key_t key, int nsems, int flags)
ACE_UNUSED_ARG (key);
ACE_UNUSED_ARG (nsems);
ACE_UNUSED_ARG (flags);
+
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_SYSV_IPC */
}
+
ACE_INLINE int
ACE_OS::semop (int int_id, struct sembuf *sops, size_t nsops)
{
@@ -2225,9 +2442,11 @@ ACE_OS::semop (int int_id, struct sembuf *sops, size_t nsops)
ACE_UNUSED_ARG (int_id);
ACE_UNUSED_ARG (sops);
ACE_UNUSED_ARG (nsops);
+
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_SYSV_IPC */
}
+
ACE_INLINE int
ACE_OS::sigtimedwait (const sigset_t *sset,
siginfo_t *info,
@@ -2237,6 +2456,7 @@ ACE_OS::sigtimedwait (const sigset_t *sset,
#if defined (ACE_HAS_SIGTIMEDWAIT)
timespec_t ts;
timespec_t *tsp;
+
if (timeout != 0)
{
ts = *timeout; // Calls ACE_Time_Value::operator timespec_t().
@@ -2244,6 +2464,7 @@ ACE_OS::sigtimedwait (const sigset_t *sset,
}
else
tsp = 0;
+
ACE_OSCALL_RETURN (::sigtimedwait (sset, info, tsp),
int, -1);
#else
@@ -2253,6 +2474,7 @@ ACE_OS::sigtimedwait (const sigset_t *sset,
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_SIGTIMEDWAIT */
}
+
ACE_INLINE int
ACE_OS::sigwait (sigset_t *sset, int *sig)
{
@@ -2315,6 +2537,7 @@ ACE_OS::sigwait (sigset_t *sset, int *sig)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_THREADS */
}
+
ACE_INLINE int
ACE_OS::sigwaitinfo (const sigset_t *sset,
siginfo_t *info)
@@ -2331,6 +2554,7 @@ ACE_OS::sigwaitinfo (const sigset_t *sset,
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_SIGTIMEDWAIT */
}
+
ACE_INLINE int
ACE_OS::thr_cancel (ACE_thread_t thr_id)
{
@@ -2352,6 +2576,7 @@ ACE_OS::thr_cancel (ACE_thread_t thr_id)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_THREADS */
}
+
ACE_INLINE int
ACE_OS::thr_cmp (ACE_hthread_t t1, ACE_hthread_t t2)
{
@@ -2368,6 +2593,7 @@ ACE_OS::thr_cmp (ACE_hthread_t t1, ACE_hthread_t t2)
return t1 == t2;
#endif /* ACE_HAS_PTHREADS */
}
+
ACE_INLINE int
ACE_OS::thr_continue (ACE_hthread_t target_thread)
{
@@ -2410,6 +2636,7 @@ ACE_OS::thr_continue (ACE_hthread_t target_thread)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_THREADS */
}
+
ACE_INLINE int
ACE_OS::thr_getconcurrency (void)
{
@@ -2426,6 +2653,7 @@ ACE_OS::thr_getconcurrency (void)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_THREADS */
}
+
ACE_INLINE int
ACE_OS::thr_getprio (ACE_hthread_t ht_id, int &priority, int &policy)
{
@@ -2434,8 +2662,10 @@ ACE_OS::thr_getprio (ACE_hthread_t ht_id, int &priority, int &policy)
#if defined (ACE_HAS_THREADS)
# if (defined (ACE_HAS_PTHREADS) && \
(!defined (ACE_LACKS_SETSCHED) || defined (ACE_HAS_PTHREAD_SCHEDPARAM)))
+
struct sched_param param;
int result;
+
ACE_OSCALL (ACE_ADAPT_RETVAL (pthread_getschedparam (ht_id, &policy, &param),
result), int,
-1, result);
@@ -2446,7 +2676,9 @@ ACE_OS::thr_getprio (ACE_hthread_t ht_id, int &priority, int &policy)
ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::thr_getprio (ht_id, &priority), result), int, -1);
# elif defined (ACE_HAS_WTHREADS) && !defined (ACE_HAS_WINCE)
ACE_Errno_Guard error (errno);
+
priority = ::GetThreadPriority (ht_id);
+
# if defined (ACE_HAS_PHARLAP)
# if defined (ACE_PHARLAP_LABVIEW_RT)
policy = ACE_SCHED_FIFO;
@@ -2458,10 +2690,12 @@ ACE_OS::thr_getprio (ACE_hthread_t ht_id, int &priority, int &policy)
DWORD priority_class = ::GetPriorityClass (::GetCurrentProcess ());
if (priority_class == 0 && (error = ::GetLastError ()) != NO_ERROR)
ACE_FAIL_RETURN (-1);
+
policy =
(priority_class ==
REALTIME_PRIORITY_CLASS) ? ACE_SCHED_FIFO : ACE_SCHED_OTHER;
# endif /* ACE_HAS_PHARLAP */
+
return 0;
# elif defined (ACE_HAS_VXTHREADS)
ACE_OSCALL_RETURN (::taskPriorityGet (ht_id, &priority), int, -1);
@@ -2476,6 +2710,7 @@ ACE_OS::thr_getprio (ACE_hthread_t ht_id, int &priority, int &policy)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_THREADS */
}
+
ACE_INLINE int
ACE_OS::thr_getprio (ACE_hthread_t ht_id, int &priority)
{
@@ -2483,6 +2718,7 @@ ACE_OS::thr_getprio (ACE_hthread_t ht_id, int &priority)
int policy = 0;
return ACE_OS::thr_getprio (ht_id, priority, policy);
}
+
#if defined (ACE_HAS_THREAD_SPECIFIC_STORAGE)
ACE_INLINE int
ACE_OS::thr_getspecific_native (ACE_OS_thread_key_t key, void **data)
@@ -2510,6 +2746,7 @@ ACE_OS::thr_getspecific_native (ACE_OS_thread_key_t key, void **data)
# endif /* ACE_HAS_PTHREADS etc.*/
}
#endif /* ACE_HAS_THREAD_SPECIFIC_STORAGE */
+
ACE_INLINE int
ACE_OS::thr_getspecific (ACE_thread_key_t key, void **data)
{
@@ -2540,6 +2777,7 @@ ACE_OS::thr_getspecific (ACE_thread_key_t key, void **data)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_THREADS */
}
+
#if !defined (ACE_HAS_VXTHREADS)
ACE_INLINE int
ACE_OS::thr_join (ACE_hthread_t thr_handle,
@@ -2557,9 +2795,11 @@ ACE_OS::thr_join (ACE_hthread_t thr_handle,
int, -1);
# elif defined (ACE_HAS_WTHREADS)
ACE_THR_FUNC_RETURN local_status = 0;
+
// Make sure that status is non-NULL.
if (status == 0)
status = &local_status;
+
if (::WaitForSingleObject (thr_handle, INFINITE) == WAIT_OBJECT_0
&& ::GetExitCodeThread (thr_handle, status) != FALSE)
{
@@ -2579,6 +2819,7 @@ ACE_OS::thr_join (ACE_hthread_t thr_handle,
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_THREADS */
}
+
ACE_INLINE int
ACE_OS::thr_join (ACE_thread_t waiter_id,
ACE_thread_t *thr_id,
@@ -2599,6 +2840,7 @@ ACE_OS::thr_join (ACE_thread_t waiter_id,
ACE_UNUSED_ARG (waiter_id);
ACE_UNUSED_ARG (thr_id);
ACE_UNUSED_ARG (status);
+
// This could be implemented if the DLL-Main function or the
// task exit base class some log the threads which have exited
ACE_NOTSUP_RETURN (-1);
@@ -2611,6 +2853,7 @@ ACE_OS::thr_join (ACE_thread_t waiter_id,
#endif /* ACE_HAS_THREADS */
}
#endif /* !VXWORKS */
+
ACE_INLINE int
ACE_OS::thr_kill (ACE_thread_t thr_id, int signum)
{
@@ -2647,6 +2890,7 @@ ACE_OS::thr_kill (ACE_thread_t thr_id, int signum)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_THREADS */
}
+
ACE_INLINE size_t
ACE_OS::thr_min_stack (void)
{
@@ -2672,7 +2916,9 @@ ACE_OS::thr_min_stack (void)
# elif defined (ACE_HAS_VXTHREADS)
TASK_DESC taskDesc;
STATUS status;
+
ACE_thread_t tid = ACE_OS::thr_self ();
+
ACE_OSCALL (ACE_ADAPT_RETVAL (::taskInfoGet (tid, &taskDesc),
status),
STATUS, -1, status);
@@ -2684,6 +2930,7 @@ ACE_OS::thr_min_stack (void)
ACE_NOTSUP_RETURN (0);
#endif /* ACE_HAS_THREADS */
}
+
ACE_INLINE ACE_thread_t
ACE_OS::thr_self (void)
{
@@ -2703,6 +2950,7 @@ ACE_OS::thr_self (void)
return 1; // Might as well make it the first thread ;-)
#endif /* ACE_HAS_THREADS */
}
+
ACE_INLINE const char*
ACE_OS::thr_name (void)
{
@@ -2716,6 +2964,7 @@ ACE_OS::thr_name (void)
ACE_NOTSUP_RETURN (0);
#endif
}
+
ACE_INLINE void
ACE_OS::thr_self (ACE_hthread_t &self)
{
@@ -2737,6 +2986,7 @@ ACE_OS::thr_self (ACE_hthread_t &self)
self = 1; // Might as well make it the main thread ;-)
#endif /* ACE_HAS_THREADS */
}
+
ACE_INLINE int
ACE_OS::thr_setcancelstate (int new_state, int *old_state)
{
@@ -2767,6 +3017,7 @@ ACE_OS::thr_setcancelstate (int new_state, int *old_state)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_THREADS */
}
+
ACE_INLINE int
ACE_OS::thr_setcanceltype (int new_type, int *old_type)
{
@@ -2789,6 +3040,7 @@ ACE_OS::thr_setcanceltype (int new_type, int *old_type)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_THREADS */
}
+
ACE_INLINE int
ACE_OS::thr_setconcurrency (int hint)
{
@@ -2813,6 +3065,7 @@ ACE_OS::thr_setconcurrency (int hint)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_THREADS */
}
+
ACE_INLINE int
ACE_OS::thr_setprio (ACE_hthread_t ht_id, int priority, int policy)
{
@@ -2821,9 +3074,11 @@ ACE_OS::thr_setprio (ACE_hthread_t ht_id, int priority, int policy)
#if defined (ACE_HAS_THREADS)
# if (defined (ACE_HAS_PTHREADS) && \
(!defined (ACE_LACKS_SETSCHED) || defined (ACE_HAS_PTHREAD_SCHEDPARAM)))
+
int result;
struct sched_param param;
ACE_OS::memset ((void *) &param, 0, sizeof param);
+
// If <policy> is -1, we don't want to use it for
// pthread_setschedparam(). Instead, obtain policy from
// pthread_getschedparam().
@@ -2835,7 +3090,9 @@ ACE_OS::thr_setprio (ACE_hthread_t ht_id, int priority, int policy)
if (result == -1)
return result;
}
+
param.sched_priority = priority;
+
ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (pthread_setschedparam (ht_id,
policy,
&param),
@@ -2864,6 +3121,7 @@ ACE_OS::thr_setprio (ACE_hthread_t ht_id, int priority, int policy)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_THREADS */
}
+
ACE_INLINE int
ACE_OS::thr_sigsetmask (int how,
const sigset_t *nsm,
@@ -2876,6 +3134,7 @@ ACE_OS::thr_sigsetmask (int how,
ACE_UNUSED_ARG (osm);
ACE_UNUSED_ARG (nsm);
ACE_UNUSED_ARG (how);
+
ACE_NOTSUP_RETURN (-1);
# elif defined (ACE_HAS_SIGTHREADMASK)
int result;
@@ -2894,6 +3153,7 @@ ACE_OS::thr_sigsetmask (int how,
result), int, -1);
//FUZZ: enable check_for_lack_ACE_OS
# endif /* !ACE_LACKS_PTHREAD_SIGMASK */
+
#if 0
/* Don't know if any platform actually needs this... */
// as far as I can tell, this is now pthread_sigaction() -- jwr
@@ -2901,10 +3161,12 @@ ACE_OS::thr_sigsetmask (int how,
ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (pthread_sigaction (how, nsm, osm),
result), int, -1);
#endif /* 0 */
+
# elif defined (ACE_HAS_WTHREADS)
ACE_UNUSED_ARG (osm);
ACE_UNUSED_ARG (nsm);
ACE_UNUSED_ARG (how);
+
ACE_NOTSUP_RETURN (-1);
# elif defined (ACE_VXWORKS)
int old_mask = 0;
@@ -2930,6 +3192,7 @@ ACE_OS::thr_sigsetmask (int how,
default:
return -1;
}
+
return 0;
# else /* Should not happen. */
ACE_UNUSED_ARG (how);
@@ -2944,6 +3207,7 @@ ACE_OS::thr_sigsetmask (int how,
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_THREADS */
}
+
ACE_INLINE int
ACE_OS::thr_suspend (ACE_hthread_t target_thread)
{
@@ -2981,6 +3245,7 @@ ACE_OS::thr_suspend (ACE_hthread_t target_thread)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_THREADS */
}
+
ACE_INLINE void
ACE_OS::thr_testcancel (void)
{
@@ -2997,6 +3262,7 @@ ACE_OS::thr_testcancel (void)
#else
#endif /* ACE_HAS_THREADS */
}
+
ACE_INLINE void
ACE_OS::thr_yield (void)
{
@@ -3019,6 +3285,7 @@ ACE_OS::thr_yield (void)
;
#endif /* ACE_HAS_THREADS */
}
+
ACE_INLINE int
ACE_OS::thread_mutex_destroy (ACE_thread_mutex_t *m)
{
@@ -3033,8 +3300,10 @@ ACE_OS::thread_mutex_destroy (ACE_thread_mutex_t *m)
#else
ACE_UNUSED_ARG (m);
ACE_NOTSUP_RETURN (-1);
+
#endif /* ACE_HAS_THREADS */
}
+
ACE_INLINE int
ACE_OS::thread_mutex_init (ACE_thread_mutex_t *m,
int lock_type,
@@ -3047,6 +3316,7 @@ ACE_OS::thread_mutex_init (ACE_thread_mutex_t *m,
ACE_UNUSED_ARG (lock_type);
ACE_UNUSED_ARG (name);
ACE_UNUSED_ARG (arg);
+
ACE_SEH_TRY
{
::InitializeCriticalSection (m);
@@ -3057,20 +3327,25 @@ ACE_OS::thread_mutex_init (ACE_thread_mutex_t *m,
return -1;
}
return 0;
+
# elif defined (ACE_HAS_STHREADS) || defined (ACE_HAS_PTHREADS)
// Force the use of USYNC_THREAD!
return ACE_OS::mutex_init (m, USYNC_THREAD, name, arg, 0, lock_type);
# elif defined (ACE_HAS_VXTHREADS)
return mutex_init (m, lock_type, name, arg);
+
# endif /* ACE_HAS_STHREADS || ACE_HAS_PTHREADS */
+
#else
ACE_UNUSED_ARG (m);
ACE_UNUSED_ARG (lock_type);
ACE_UNUSED_ARG (name);
ACE_UNUSED_ARG (arg);
ACE_NOTSUP_RETURN (-1);
+
#endif /* ACE_HAS_THREADS */
}
+
#if defined (ACE_HAS_WCHAR)
ACE_INLINE int
ACE_OS::thread_mutex_init (ACE_thread_mutex_t *m,
@@ -3084,6 +3359,7 @@ ACE_OS::thread_mutex_init (ACE_thread_mutex_t *m,
ACE_UNUSED_ARG (lock_type);
ACE_UNUSED_ARG (name);
ACE_UNUSED_ARG (arg);
+
ACE_SEH_TRY
{
::InitializeCriticalSection (m);
@@ -3094,6 +3370,7 @@ ACE_OS::thread_mutex_init (ACE_thread_mutex_t *m,
return -1;
}
return 0;
+
# elif defined (ACE_HAS_STHREADS) || defined (ACE_HAS_PTHREADS)
// Force the use of USYNC_THREAD!
return ACE_OS::mutex_init (m, USYNC_THREAD, name, arg, 0, lock_type);
@@ -3106,9 +3383,11 @@ ACE_OS::thread_mutex_init (ACE_thread_mutex_t *m,
ACE_UNUSED_ARG (name);
ACE_UNUSED_ARG (arg);
ACE_NOTSUP_RETURN (-1);
+
#endif /* ACE_HAS_THREADS */
}
#endif /* ACE_HAS_WCHAR */
+
ACE_INLINE int
ACE_OS::thread_mutex_lock (ACE_thread_mutex_t *m)
{
@@ -3125,11 +3404,13 @@ ACE_OS::thread_mutex_lock (ACE_thread_mutex_t *m)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_THREADS */
}
+
ACE_INLINE int
ACE_OS::thread_mutex_lock (ACE_thread_mutex_t *m,
const ACE_Time_Value &timeout)
{
// ACE_OS_TRACE ("ACE_OS::thread_mutex_lock");
+
// For all platforms, except MS Windows, this method is equivalent
// to calling ACE_OS::mutex_lock() since ACE_thread_mutex_t and
// ACE_mutex_t are the same type. However, those typedefs evaluate
@@ -3137,6 +3418,7 @@ ACE_OS::thread_mutex_lock (ACE_thread_mutex_t *m,
// implementation in ACE for MS Windows cannot readily support
// timeouts due to a lack of timeout features for this type of MS
// Windows synchronization mechanism.
+
#if defined (ACE_HAS_THREADS) && !defined (ACE_HAS_WTHREADS)
return ACE_OS::mutex_lock (m, timeout);
#else
@@ -3145,6 +3427,7 @@ ACE_OS::thread_mutex_lock (ACE_thread_mutex_t *m,
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_THREADS */
}
+
ACE_INLINE int
ACE_OS::thread_mutex_lock (ACE_thread_mutex_t *m,
const ACE_Time_Value *timeout)
@@ -3153,10 +3436,12 @@ ACE_OS::thread_mutex_lock (ACE_thread_mutex_t *m,
? ACE_OS::thread_mutex_lock (m)
: ACE_OS::thread_mutex_lock (m, *timeout);
}
+
ACE_INLINE int
ACE_OS::thread_mutex_trylock (ACE_thread_mutex_t *m)
{
ACE_OS_TRACE ("ACE_OS::thread_mutex_trylock");
+
#if defined (ACE_HAS_THREADS)
# if defined (ACE_HAS_WTHREADS)
# if defined (ACE_HAS_WIN32_TRYLOCK)
@@ -3175,11 +3460,13 @@ ACE_OS::thread_mutex_trylock (ACE_thread_mutex_t *m)
# elif defined (ACE_HAS_STHREADS) || defined (ACE_HAS_PTHREADS) || defined (ACE_VXWORKS)
return ACE_OS::mutex_trylock (m);
#endif /* Threads variety case */
+
#else
ACE_UNUSED_ARG (m);
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_THREADS */
}
+
ACE_INLINE int
ACE_OS::thread_mutex_unlock (ACE_thread_mutex_t *m)
{
@@ -3196,20 +3483,25 @@ ACE_OS::thread_mutex_unlock (ACE_thread_mutex_t *m)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_THREADS */
}
+
/*****************************************************************************/
+
# if defined (ACE_IS_SPLITTING)
# define ACE_SPECIAL_INLINE
# else
# define ACE_SPECIAL_INLINE ACE_INLINE
//# define ACE_SPECIAL_INLINE inline
# endif
+
#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
+
ACE_INLINE
int
ACE_OS_Thread_Mutex_Guard::acquire (void)
{
return owner_ = ACE_OS::thread_mutex_lock (&lock_);
}
+
ACE_INLINE
int
ACE_OS_Thread_Mutex_Guard::release (void)
@@ -3222,6 +3514,7 @@ ACE_OS_Thread_Mutex_Guard::release (void)
return ACE_OS::thread_mutex_unlock (&lock_);
}
}
+
ACE_INLINE
ACE_OS_Thread_Mutex_Guard::ACE_OS_Thread_Mutex_Guard (ACE_thread_mutex_t &m)
: lock_ (m), owner_ (-1)
@@ -3229,18 +3522,22 @@ ACE_OS_Thread_Mutex_Guard::ACE_OS_Thread_Mutex_Guard (ACE_thread_mutex_t &m)
if (!ACE_OS_Object_Manager::starting_up ())
acquire ();
}
+
ACE_INLINE
ACE_OS_Thread_Mutex_Guard::~ACE_OS_Thread_Mutex_Guard ()
{
release ();
}
+
/*****************************************************************************/
+
ACE_INLINE
int
ACE_OS_Recursive_Thread_Mutex_Guard::acquire (void)
{
return owner_ = ACE_OS::recursive_mutex_lock (&lock_);
}
+
ACE_INLINE
int
ACE_OS_Recursive_Thread_Mutex_Guard::release (void)
@@ -3253,6 +3550,7 @@ ACE_OS_Recursive_Thread_Mutex_Guard::release (void)
return ACE_OS::recursive_mutex_unlock (&lock_);
}
}
+
ACE_INLINE
ACE_OS_Recursive_Thread_Mutex_Guard::ACE_OS_Recursive_Thread_Mutex_Guard (
ACE_recursive_thread_mutex_t &m)
@@ -3262,14 +3560,18 @@ ACE_OS_Recursive_Thread_Mutex_Guard::ACE_OS_Recursive_Thread_Mutex_Guard (
if (!ACE_OS_Object_Manager::starting_up ())
acquire ();
}
+
ACE_INLINE
ACE_OS_Recursive_Thread_Mutex_Guard::~ACE_OS_Recursive_Thread_Mutex_Guard ()
{
release ();
}
+
#endif /* ACE_MT_SAFE && ACE_MT_SAFE != 0 */
+
/*****************************************************************************/
+
ACE_INLINE
ACE_Thread_ID::ACE_Thread_ID (ACE_thread_t thread_id,
ACE_hthread_t thread_handle)
@@ -3277,39 +3579,46 @@ ACE_Thread_ID::ACE_Thread_ID (ACE_thread_t thread_id,
thread_handle_ (thread_handle)
{
}
+
ACE_INLINE
ACE_Thread_ID::ACE_Thread_ID (const ACE_Thread_ID &id)
: thread_id_ (id.thread_id_),
thread_handle_ (id.thread_handle_)
{
}
+
ACE_INLINE
ACE_Thread_ID::ACE_Thread_ID (void)
: thread_id_ (ACE_OS::thr_self ())
{
ACE_OS::thr_self (thread_handle_);
}
+
ACE_INLINE
ACE_thread_t
ACE_Thread_ID::id (void) const
{
return this->thread_id_;
}
+
ACE_INLINE void
ACE_Thread_ID::id (ACE_thread_t thread_id)
{
this->thread_id_ = thread_id;
}
+
ACE_INLINE ACE_hthread_t
ACE_Thread_ID::handle (void) const
{
return this->thread_handle_;
}
+
ACE_INLINE void
ACE_Thread_ID::handle (ACE_hthread_t thread_handle)
{
this->thread_handle_ = thread_handle;
}
+
ACE_INLINE bool
ACE_Thread_ID::operator== (const ACE_Thread_ID &rhs) const
{
@@ -3317,9 +3626,11 @@ ACE_Thread_ID::operator== (const ACE_Thread_ID &rhs) const
ACE_OS::thr_cmp (this->thread_handle_, rhs.thread_handle_)
&& ACE_OS::thr_equal (this->thread_id_, rhs.thread_id_);
}
+
ACE_INLINE bool
ACE_Thread_ID::operator!= (const ACE_Thread_ID &rhs) const
{
return !(*this == rhs);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_NS_arpa_inet.cpp b/dep/ACE_wrappers/ace/OS_NS_arpa_inet.cpp
index fe061b0adc2..cb496c9d0eb 100644
--- a/dep/ACE_wrappers/ace/OS_NS_arpa_inet.cpp
+++ b/dep/ACE_wrappers/ace/OS_NS_arpa_inet.cpp
@@ -1,11 +1,16 @@
// -*- C++ -*-
// $Id: OS_NS_arpa_inet.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_arpa_inet.h"
+
ACE_RCSID(ace, OS_NS_arpa_inet, "$Id: OS_NS_arpa_inet.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if !defined (ACE_HAS_INLINED_OSCALLS)
# include "ace/OS_NS_arpa_inet.inl"
#endif /* ACE_HAS_INLINED_OSCALLS */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
int
ACE_OS::inet_aton (const char *host_name, struct in_addr *addr)
{
@@ -19,6 +24,7 @@ ACE_OS::inet_aton (const char *host_name, struct in_addr *addr)
host_name = " ";
# endif /* ACE_WIN32 */
unsigned long ip_addr = ACE_OS::inet_addr (host_name);
+
if (ip_addr == INADDR_NONE
// Broadcast addresses are weird...
&& ACE_OS::strcmp (host_name, "255.255.255.255") != 0)
@@ -43,5 +49,6 @@ ACE_OS::inet_aton (const char *host_name, struct in_addr *addr)
ACE_OSCALL_RETURN (::inet_aton (host_name, addr), int, 0);
#endif /* ACE_LACKS_INET_ATON */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_NS_arpa_inet.h b/dep/ACE_wrappers/ace/OS_NS_arpa_inet.h
index 4a60e422ab6..dba0f6bd4da 100644
--- a/dep/ACE_wrappers/ace/OS_NS_arpa_inet.h
+++ b/dep/ACE_wrappers/ace/OS_NS_arpa_inet.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file OS_NS_arpa_inet.h
@@ -12,39 +13,55 @@
* Originally in OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_NS_ARPA_INET_H
# define ACE_OS_NS_ARPA_INET_H
+
# include /**/ "ace/pre.h"
+
# include "ace/config-all.h"
+
# if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
# endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/arpa/os_inet.h"
#include /**/ "ace/ACE_export.h"
+
#if defined (ACE_EXPORT_MACRO)
# undef ACE_EXPORT_MACRO
#endif
#define ACE_EXPORT_MACRO ACE_Export
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE_OS {
+
ACE_NAMESPACE_INLINE_FUNCTION
unsigned long inet_addr (const char *name);
+
extern ACE_Export
int inet_aton (const char *strptr,
struct in_addr *addr);
+
ACE_NAMESPACE_INLINE_FUNCTION
char *inet_ntoa (const struct in_addr addr);
+
ACE_NAMESPACE_INLINE_FUNCTION
const char *inet_ntop (int family,
const void *addrptr,
char *strptr,
size_t len);
+
ACE_NAMESPACE_INLINE_FUNCTION
int inet_pton (int family,
const char *strptr,
void *addrptr);
+
} /* namespace ACE_OS */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# if defined (ACE_HAS_INLINED_OSCALLS)
# if defined (ACE_INLINE)
# undef ACE_INLINE
@@ -52,6 +69,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_INLINE inline
# include "ace/OS_NS_arpa_inet.inl"
# endif /* ACE_HAS_INLINED_OSCALLS */
+
# include /**/ "ace/post.h"
#endif /* ACE_OS_NS_ARPA_INET_H */
diff --git a/dep/ACE_wrappers/ace/OS_NS_arpa_inet.inl b/dep/ACE_wrappers/ace/OS_NS_arpa_inet.inl
index 53cf59b4c70..71db747c942 100644
--- a/dep/ACE_wrappers/ace/OS_NS_arpa_inet.inl
+++ b/dep/ACE_wrappers/ace/OS_NS_arpa_inet.inl
@@ -1,9 +1,12 @@
// -*- C++ -*-
// $Id: OS_NS_arpa_inet.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_string.h"
#include "ace/OS_NS_errno.h"
#include "ace/OS_NS_stdio.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE unsigned long
ACE_OS::inet_addr (const char *name)
{
@@ -17,6 +20,7 @@ ACE_OS::inet_addr (const char *name)
return ::inet_addr (name);
#endif /* ACE_HAS_NONCONST_GETBY */
}
+
ACE_INLINE char *
ACE_OS::inet_ntoa (const struct in_addr addr)
{
@@ -30,52 +34,65 @@ ACE_OS::inet_ntoa (const struct in_addr addr)
0);
#endif
}
+
ACE_INLINE const char *
ACE_OS::inet_ntop (int family, const void *addrptr, char *strptr, size_t len)
{
ACE_OS_TRACE ("ACE_OS::inet_ntop");
+
#if defined (ACE_HAS_IPV6) && !defined (ACE_WIN32)
ACE_OSCALL_RETURN (::inet_ntop (family, addrptr, strptr, len), const char *, 0);
#else
const u_char *p = reinterpret_cast<const u_char *> (addrptr);
+
if (family == AF_INET)
{
char temp[INET_ADDRSTRLEN];
+
// Stevens uses snprintf() in his implementation but snprintf()
// doesn't appear to be very portable. For now, hope that using
// sprintf() will not cause any string/memory overrun problems.
ACE_OS::sprintf (temp,
"%d.%d.%d.%d",
p[0], p[1], p[2], p[3]);
+
if (ACE_OS::strlen (temp) >= len)
{
errno = ENOSPC;
return 0; // Failure
}
+
ACE_OS::strcpy (strptr, temp);
return strptr;
}
+
ACE_NOTSUP_RETURN(0);
#endif /* ACE_HAS_IPV6 */
}
+
ACE_INLINE int
ACE_OS::inet_pton (int family, const char *strptr, void *addrptr)
{
ACE_OS_TRACE ("ACE_OS::inet_pton");
+
#if defined (ACE_HAS_IPV6) && !defined (ACE_WIN32)
ACE_OSCALL_RETURN (::inet_pton (family, strptr, addrptr), int, -1);
#else
if (family == AF_INET)
{
struct in_addr in_val;
+
if (ACE_OS::inet_aton (strptr, &in_val))
{
ACE_OS::memcpy (addrptr, &in_val, sizeof (struct in_addr));
return 1; // Success
}
+
return 0; // Input is not a valid presentation format
}
+
ACE_NOTSUP_RETURN(-1);
#endif /* ACE_HAS_IPV6 */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_NS_ctype.cpp b/dep/ACE_wrappers/ace/OS_NS_ctype.cpp
index 90914c715e5..e8bd11f6c24 100644
--- a/dep/ACE_wrappers/ace/OS_NS_ctype.cpp
+++ b/dep/ACE_wrappers/ace/OS_NS_ctype.cpp
@@ -1,8 +1,12 @@
// -*- C++ -*-
// $Id: OS_NS_ctype.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_ctype.h"
+
ACE_RCSID(ace, OS_NS_ctype, "$Id: OS_NS_ctype.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if !defined (ACE_HAS_INLINED_OSCALLS)
# include "ace/OS_NS_ctype.inl"
#endif /* ACE_HAS_INLINED_OSCALLS */
+
diff --git a/dep/ACE_wrappers/ace/OS_NS_ctype.h b/dep/ACE_wrappers/ace/OS_NS_ctype.h
index 50c29cffc7e..c03143eea90 100644
--- a/dep/ACE_wrappers/ace/OS_NS_ctype.h
+++ b/dep/ACE_wrappers/ace/OS_NS_ctype.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file OS_NS_ctype.h
@@ -12,21 +13,31 @@
* Originally in OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_NS_CTYPE_H
# define ACE_OS_NS_CTYPE_H
+
# include /**/ "ace/pre.h"
+
# include "ace/config-all.h"
+
# if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
# endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include /**/ "ace/ACE_export.h"
+
#if defined (ACE_EXPORT_MACRO)
# undef ACE_EXPORT_MACRO
#endif
#define ACE_EXPORT_MACRO ACE_Export
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE_OS {
+
// these are non-standard names...
+
/** @name Functions from <cctype>
*
* Included are the functions defined in <cctype> and their <cwctype>
@@ -36,58 +47,77 @@ namespace ACE_OS {
* here. Instead, we change by prepending "ace_".
*/
//@{
+
/// Returns true if the character is an alphanumeric character.
ACE_NAMESPACE_INLINE_FUNCTION
int ace_isalnum (ACE_TCHAR c);
+
/// Returns true if the character is an alphabetic character.
ACE_NAMESPACE_INLINE_FUNCTION
int ace_isalpha (ACE_TCHAR c);
+
/// Returns true if the character is a control character.
ACE_NAMESPACE_INLINE_FUNCTION
int ace_iscntrl (ACE_TCHAR c);
+
/// Returns true if the character is a decimal-digit character.
ACE_NAMESPACE_INLINE_FUNCTION
int ace_isdigit (ACE_TCHAR c);
+
/// Returns true if the character is a printable character other than a space.
ACE_NAMESPACE_INLINE_FUNCTION
int ace_isgraph (ACE_TCHAR c);
+
/// Returns true if the character is a lowercase character.
ACE_NAMESPACE_INLINE_FUNCTION
int ace_islower (ACE_TCHAR c);
+
/// Returns true if the character is a printable character.
ACE_NAMESPACE_INLINE_FUNCTION
int ace_isprint (ACE_TCHAR c);
+
/// Returns true if the character is a punctuation character.
ACE_NAMESPACE_INLINE_FUNCTION
int ace_ispunct (ACE_TCHAR c);
+
/// Returns true if the character is a space character.
ACE_NAMESPACE_INLINE_FUNCTION
int ace_isspace (ACE_TCHAR c);
+
/// Returns true if the character is an uppercase character.
ACE_NAMESPACE_INLINE_FUNCTION
int ace_isupper (ACE_TCHAR c);
+
/// Returns true if the character is a hexadecimal-digit character.
ACE_NAMESPACE_INLINE_FUNCTION
int ace_isxdigit (ACE_TCHAR c);
+
/// Converts a character to lower case (char version).
ACE_NAMESPACE_INLINE_FUNCTION
int ace_tolower (int c);
+
#if defined (ACE_HAS_WCHAR)
/// Converts a character to lower case (wchar_t version).
ACE_NAMESPACE_INLINE_FUNCTION
wint_t ace_towlower (wint_t c);
#endif /* ACE_HAS_WCHAR */
+
/// Converts a character to upper case (char version).
ACE_NAMESPACE_INLINE_FUNCTION
int ace_toupper (int c);
+
#if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_TOWUPPER)
/// Converts a character to upper case (wchar_t version).
ACE_NAMESPACE_INLINE_FUNCTION
wint_t ace_towupper (wint_t c);
#endif /* ACE_HAS_WCHAR && !ACE_LACKS_TOWUPPER */
+
//@}
+
} /* namespace ACE_OS */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# if defined (ACE_HAS_INLINED_OSCALLS)
# if defined (ACE_INLINE)
# undef ACE_INLINE
@@ -95,6 +125,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_INLINE inline
# include "ace/OS_NS_ctype.inl"
# endif /* ACE_HAS_INLINED_OSCALLS */
+
# include /**/ "ace/post.h"
#endif /* ACE_OS_NS_CTYPE_H */
diff --git a/dep/ACE_wrappers/ace/OS_NS_ctype.inl b/dep/ACE_wrappers/ace/OS_NS_ctype.inl
index b8effeb5ae4..8ca1f1a2976 100644
--- a/dep/ACE_wrappers/ace/OS_NS_ctype.inl
+++ b/dep/ACE_wrappers/ace/OS_NS_ctype.inl
@@ -1,11 +1,14 @@
// -*- C++ -*-
//
// $Id: OS_NS_ctype.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/os_include/os_ctype.h"
#if defined ACE_HAS_WCHAR
# include "ace/os_include/os_wctype.h"
#endif /* ACE_HAS_WCHAR */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE int
ACE_OS::ace_isalnum (ACE_TCHAR c)
{
@@ -21,6 +24,7 @@ ACE_OS::ace_isalnum (ACE_TCHAR c)
return isalnum ((unsigned char) c);
#endif /* ACE_USES_WCHAR */
}
+
ACE_INLINE int
ACE_OS::ace_isalpha (ACE_TCHAR c)
{
@@ -30,6 +34,7 @@ ACE_OS::ace_isalpha (ACE_TCHAR c)
return isalpha ((unsigned char) c);
#endif /* ACE_USES_WCHAR */
}
+
ACE_INLINE int
ACE_OS::ace_iscntrl (ACE_TCHAR c)
{
@@ -39,6 +44,7 @@ ACE_OS::ace_iscntrl (ACE_TCHAR c)
return iscntrl ((unsigned char) c);
#endif /* ACE_USES_WCHAR */
}
+
ACE_INLINE int
ACE_OS::ace_isdigit (ACE_TCHAR c)
{
@@ -48,6 +54,7 @@ ACE_OS::ace_isdigit (ACE_TCHAR c)
return isdigit ((unsigned char) c);
#endif /* ACE_USES_WCHAR */
}
+
ACE_INLINE int
ACE_OS::ace_isgraph (ACE_TCHAR c)
{
@@ -57,6 +64,7 @@ ACE_OS::ace_isgraph (ACE_TCHAR c)
return isgraph ((unsigned char) c);
#endif /* ACE_USES_WCHAR */
}
+
ACE_INLINE int
ACE_OS::ace_islower (ACE_TCHAR c)
{
@@ -66,6 +74,7 @@ ACE_OS::ace_islower (ACE_TCHAR c)
return islower ((unsigned char) c);
#endif /* ACE_USES_WCHAR */
}
+
ACE_INLINE int
ACE_OS::ace_isprint (ACE_TCHAR c)
{
@@ -75,6 +84,7 @@ ACE_OS::ace_isprint (ACE_TCHAR c)
return isprint ((unsigned char) c);
#endif /* ACE_USES_WCHAR */
}
+
ACE_INLINE int
ACE_OS::ace_ispunct (ACE_TCHAR c)
{
@@ -84,6 +94,7 @@ ACE_OS::ace_ispunct (ACE_TCHAR c)
return ispunct ((unsigned char) c);
#endif /* ACE_USES_WCHAR */
}
+
ACE_INLINE int
ACE_OS::ace_isspace (ACE_TCHAR c)
{
@@ -93,6 +104,7 @@ ACE_OS::ace_isspace (ACE_TCHAR c)
return isspace ((unsigned char) c);
#endif /* ACE_USES_WCHAR */
}
+
ACE_INLINE int
ACE_OS::ace_isupper (ACE_TCHAR c)
{
@@ -102,6 +114,7 @@ ACE_OS::ace_isupper (ACE_TCHAR c)
return isupper ((unsigned char) c);
#endif /* ACE_USES_WCHAR */
}
+
ACE_INLINE int
ACE_OS::ace_isxdigit (ACE_TCHAR c)
{
@@ -111,11 +124,13 @@ ACE_OS::ace_isxdigit (ACE_TCHAR c)
return isxdigit ((unsigned char) c);
#endif /* ACE_USES_WCHAR */
}
+
ACE_INLINE int
ACE_OS::ace_tolower (int c)
{
return tolower (c);
}
+
#if defined (ACE_HAS_WCHAR)
ACE_INLINE wint_t
ACE_OS::ace_towlower (wint_t c)
@@ -130,11 +145,13 @@ ACE_OS::ace_towlower (wint_t c)
#endif /* ACE_LACKS_TOWLOWER */
}
#endif /* ACE_HAS_WCHAR */
+
ACE_INLINE int
ACE_OS::ace_toupper (int c)
{
return toupper (c);
}
+
#if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_TOWUPPER)
ACE_INLINE wint_t
ACE_OS::ace_towupper (wint_t c)
@@ -142,4 +159,5 @@ ACE_OS::ace_towupper (wint_t c)
return towupper (c);
}
#endif /* ACE_HAS_WCHAR && !ACE_LACKS_TOWUPPER */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_NS_dirent.cpp b/dep/ACE_wrappers/ace/OS_NS_dirent.cpp
index 040150b513e..4a3672c28c5 100644
--- a/dep/ACE_wrappers/ace/OS_NS_dirent.cpp
+++ b/dep/ACE_wrappers/ace/OS_NS_dirent.cpp
@@ -1,14 +1,20 @@
// $Id: OS_NS_dirent.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_dirent.h"
+
ACE_RCSID(ace, OS_NS_dirent, "$Id: OS_NS_dirent.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if !defined (ACE_HAS_INLINED_OSCALLS)
# include "ace/OS_NS_dirent.inl"
#endif /* ACE_HAS_INLINED_OSCALLS */
+
#include "ace/OS_NS_errno.h"
#include "ace/OS_NS_string.h"
#include "ace/Log_Msg.h"
#include "ace/OS_NS_stdlib.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_LACKS_CLOSEDIR)
void
ACE_OS::closedir_emulation (ACE_DIR *d)
@@ -16,6 +22,7 @@ ACE_OS::closedir_emulation (ACE_DIR *d)
#if defined (ACE_WIN32)
if (d->current_handle_ != INVALID_HANDLE_VALUE)
::FindClose (d->current_handle_);
+
d->current_handle_ = INVALID_HANDLE_VALUE;
d->started_reading_ = 0;
if (d->dirent_ != 0)
@@ -28,6 +35,7 @@ ACE_OS::closedir_emulation (ACE_DIR *d)
#endif /* ACE_WIN32 */
}
#endif /* ACE_LACKS_CLOSEDIR */
+
#if defined (ACE_LACKS_OPENDIR)
ACE_DIR *
ACE_OS::opendir_emulation (const ACE_TCHAR *filename)
@@ -36,26 +44,34 @@ ACE_OS::opendir_emulation (const ACE_TCHAR *filename)
# if defined (ACE_HAS_WINCE) && !defined (INVALID_FILE_ATTRIBUTES)
# define INVALID_FILE_ATTRIBUTES 0xFFFFFFFF
# endif
+
ACE_DIR *dir;
ACE_TCHAR extra[3] = {0,0,0};
+
// Check if filename is a directory.
DWORD fileAttribute = ACE_TEXT_GetFileAttributes (filename);
if (fileAttribute == INVALID_FILE_ATTRIBUTES
|| !(fileAttribute & FILE_ATTRIBUTE_DIRECTORY))
return 0;
+
/*
Note: the semantics of the win32 function FindFirstFile take the
basename(filename) as a pattern to be matched within the dirname(filename).
This is contrary to the behavior of the posix function readdir which treats
basename(filename) as a directory to be opened and read.
+
For this reason, we append a slash-star or backslash-star to the supplied
filename so the result is that FindFirstFile will do what we need.
+
According to the documentation for FindFirstFile, either a '/' or a '\' may
be used as a directory name separator.
+
Of course, it is necessary to ensure that this is only done if the trailing
filespec is not already there.
+
Phil Mesnier
*/
+
size_t lastchar = ACE_OS::strlen (filename);
if (lastchar > 0)
{
@@ -67,6 +83,7 @@ ACE_OS::opendir_emulation (const ACE_TCHAR *filename)
ACE_OS::strcpy (extra, ACE_TEXT ("*"));
}
}
+
ACE_NEW_RETURN (dir, ACE_DIR, 0);
ACE_NEW_RETURN (dir->directory_name_,
ACE_TCHAR[lastchar + ACE_OS::strlen (extra) + 1],
@@ -84,6 +101,7 @@ ACE_OS::opendir_emulation (const ACE_TCHAR *filename)
#endif /* WIN32 */
}
#endif /* ACE_LACKS_CLOSEDIR */
+
#if defined (ACE_LACKS_READDIR)
struct ACE_DIRENT *
ACE_OS::readdir_emulation (ACE_DIR *d)
@@ -95,6 +113,7 @@ ACE_OS::readdir_emulation (ACE_DIR *d)
ACE_OS::free (d->dirent_);
d->dirent_ = 0;
}
+
if (!d->started_reading_)
{
d->current_handle_ = ACE_TEXT_FindFirstFile (d->directory_name_,
@@ -112,10 +131,12 @@ ACE_OS::readdir_emulation (ACE_DIR *d)
d->current_handle_ = INVALID_HANDLE_VALUE;
}
}
+
if (d->current_handle_ != INVALID_HANDLE_VALUE)
{
d->dirent_ = (ACE_DIRENT *)
ACE_OS::malloc (sizeof (ACE_DIRENT));
+
if (d->dirent_ != 0)
{
d->dirent_->d_name = (ACE_TCHAR*)
@@ -124,6 +145,7 @@ ACE_OS::readdir_emulation (ACE_DIR *d)
ACE_OS::strcpy (d->dirent_->d_name, d->fdata_.cFileName);
d->dirent_->d_reclen = sizeof (ACE_DIRENT);
}
+
return d->dirent_;
}
else
@@ -134,6 +156,7 @@ ACE_OS::readdir_emulation (ACE_DIR *d)
#endif /* ACE_WIN32 */
}
#endif /* ACE_LACKS_READDIR */
+
#if !defined (ACE_HAS_SCANDIR)
int
ACE_OS::scandir_emulation (const ACE_TCHAR *dirname,
@@ -142,16 +165,20 @@ ACE_OS::scandir_emulation (const ACE_TCHAR *dirname,
ACE_SCANDIR_COMPARATOR comparator)
{
ACE_DIR *dirp = ACE_OS::opendir (dirname);
+
if (dirp == 0)
return -1;
// A sanity check here. "namelist" had better not be zero.
else if (namelist == 0)
return -1;
+
ACE_DIRENT **vector = 0;
ACE_DIRENT *dp = 0;
int arena_size = 0;
+
int nfiles = 0;
int fail = 0;
+
// @@ This code shoulduse readdir_r() rather than readdir().
for (dp = ACE_OS::readdir (dirp);
dp != 0;
@@ -159,6 +186,7 @@ ACE_OS::scandir_emulation (const ACE_TCHAR *dirname,
{
if (selector && (*selector)(dp) == 0)
continue;
+
// If we get here, we have a dirent that the user likes.
if (nfiles == arena_size)
{
@@ -167,6 +195,7 @@ ACE_OS::scandir_emulation (const ACE_TCHAR *dirname,
arena_size = 10;
else
arena_size *= 2;
+
newv = (ACE_DIRENT **) ACE_OS::realloc (vector,
arena_size * sizeof (ACE_DIRENT *));
if (newv == 0)
@@ -176,6 +205,7 @@ ACE_OS::scandir_emulation (const ACE_TCHAR *dirname,
}
vector = newv;
}
+
#if defined (ACE_LACKS_STRUCT_DIR)
ACE_DIRENT *newdp = (ACE_DIRENT *) ACE_OS::malloc (sizeof (ACE_DIRENT));
#else
@@ -184,20 +214,24 @@ ACE_OS::scandir_emulation (const ACE_TCHAR *dirname,
((ACE_OS::strlen (dp->d_name) + 1) * sizeof (ACE_TCHAR));
ACE_DIRENT *newdp = (ACE_DIRENT *) ACE_OS::malloc (dsize);
#endif /* ACE_LACKS_STRUCT_DIR */
+
if (newdp == 0)
{
fail = 1;
break;
}
+
#if defined (ACE_LACKS_STRUCT_DIR)
newdp->d_name = (ACE_TCHAR*) ACE_OS::malloc (
(ACE_OS::strlen (dp->d_name) + 1) * sizeof (ACE_TCHAR));
+
if (newdp->d_name == 0)
{
fail = 1;
ACE_OS::free (newdp);
break;
}
+
// Don't use memcpy here since d_name is now a pointer
newdp->d_ino = dp->d_ino;
newdp->d_off = dp->d_off;
@@ -208,6 +242,7 @@ ACE_OS::scandir_emulation (const ACE_TCHAR *dirname,
vector[nfiles++] = (ACE_DIRENT *) ACE_OS::memcpy (newdp, dp, dsize);
#endif /* ACE_LACKS_STRUCT_DIR */
}
+
if (fail)
{
ACE_OS::closedir (dirp);
@@ -221,15 +256,20 @@ ACE_OS::scandir_emulation (const ACE_TCHAR *dirname,
ACE_OS::free (vector);
return -1;
}
+
ACE_OS::closedir (dirp);
+
*namelist = vector;
+
if (comparator)
ACE_OS::qsort (*namelist,
nfiles,
sizeof (ACE_DIRENT *),
(ACE_COMPARE_FUNC) comparator);
+
return nfiles;
}
#endif /* !ACE_HAS_SCANDIR */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_NS_dirent.h b/dep/ACE_wrappers/ace/OS_NS_dirent.h
index a6117a580d8..72f06b91648 100644
--- a/dep/ACE_wrappers/ace/OS_NS_dirent.h
+++ b/dep/ACE_wrappers/ace/OS_NS_dirent.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file OS_NS_dirent.h
@@ -12,19 +13,26 @@
* Originally in OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_NS_DIRENT_H
# define ACE_OS_NS_DIRENT_H
+
# include /**/ "ace/pre.h"
+
# include "ace/config-all.h"
+
# if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
# endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/os_dirent.h"
#include /**/ "ace/ACE_export.h"
+
#if defined (ACE_EXPORT_MACRO)
# undef ACE_EXPORT_MACRO
#endif
#define ACE_EXPORT_MACRO ACE_Export
+
// Define the scandir() selector and comparator function types. Many platforms
// define these in terms of const pointers to dirent arrays/structs. Some
// platforms use void pointers instead. The ACE-exported API is defined in
@@ -39,11 +47,13 @@ extern "C" {
#endif /* ACE_SCANDIR_CMP_USES_VOIDPTR */
typedef int (*ACE_SCANDIR_COMPARATOR)(const ACE_DIRENT **f1,
const ACE_DIRENT **f2);
+
#if defined (ACE_SCANDIR_SEL_LACKS_CONST)
typedef int (*ACE_SCANDIR_OS_SELECTOR)(ACE_DIRENT *filename);
#endif /* ACE_SCANDIR_SEL_LACKS_CONST */
typedef int (*ACE_SCANDIR_SELECTOR)(const ACE_DIRENT *filename);
}
+
/*
* We inline and undef some functions that may be implemented
* as macros on some platforms. This way macro definitions will
@@ -51,6 +61,7 @@ extern "C" {
* using the pre-processor.
*
*/
+
#if !defined (ACE_LACKS_REWINDDIR)
# if !defined (ACE_HAS_WREWINDDIR) || !defined (ACE_USES_WCHAR)
inline void ace_rewinddir_helper (ACE_DIR *dir)
@@ -64,37 +75,50 @@ inline void ace_rewinddir_helper (ACE_DIR *dir)
}
# endif /* !defined (ACE_HAS_WREWINDDIR) && !defined (ACE_USES_WCHAR) */
#endif /* ACE_LACKS_REWINDDIR */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE_OS {
+
ACE_NAMESPACE_INLINE_FUNCTION
void closedir (ACE_DIR *);
+
ACE_NAMESPACE_INLINE_FUNCTION
ACE_DIR *opendir (const ACE_TCHAR *filename);
+
ACE_NAMESPACE_INLINE_FUNCTION
struct ACE_DIRENT *readdir (ACE_DIR *);
+
ACE_NAMESPACE_INLINE_FUNCTION
int readdir_r (ACE_DIR *dirp,
struct ACE_DIRENT *entry,
struct ACE_DIRENT **result);
+
ACE_NAMESPACE_INLINE_FUNCTION
void rewinddir (ACE_DIR *);
+
ACE_NAMESPACE_INLINE_FUNCTION
int scandir (const ACE_TCHAR *dirname,
struct ACE_DIRENT **namelist[],
ACE_SCANDIR_SELECTOR selector,
ACE_SCANDIR_COMPARATOR comparator);
+
ACE_NAMESPACE_INLINE_FUNCTION
int alphasort (const void *, const void *);
+
ACE_NAMESPACE_INLINE_FUNCTION
void seekdir (ACE_DIR *,
long loc);
+
ACE_NAMESPACE_INLINE_FUNCTION
long telldir (ACE_DIR *);
+
// Win32 emulation functions
#if defined (ACE_LACKS_OPENDIR)
extern ACE_Export
ACE_DIR *opendir_emulation (const ACE_TCHAR *filename);
#endif /* ACE_LACKS_OPENDIR */
+
#if !defined (ACE_HAS_SCANDIR)
extern ACE_Export
int scandir_emulation (const ACE_TCHAR *dirname,
@@ -102,16 +126,21 @@ namespace ACE_OS {
ACE_SCANDIR_SELECTOR selector,
ACE_SCANDIR_COMPARATOR comparator);
#endif /* !ACE_HAS_SCANDIR */
+
#if defined (ACE_LACKS_CLOSEDIR)
extern ACE_Export
void closedir_emulation (ACE_DIR *);
#endif /* ACE_LACKS_CLOSEDIR */
+
#if defined (ACE_LACKS_READDIR)
extern ACE_Export
struct ACE_DIRENT *readdir_emulation (ACE_DIR *);
#endif /* ACE_LACKS_READDIR */
+
} /* namespace ACE_OS */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# if defined (ACE_HAS_INLINED_OSCALLS)
# if defined (ACE_INLINE)
# undef ACE_INLINE
@@ -119,6 +148,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_INLINE inline
# include "ace/OS_NS_dirent.inl"
# endif /* ACE_HAS_INLINED_OSCALLS */
+
# include /**/ "ace/post.h"
#endif /* ACE_OS_NS_DIRENT_H */
diff --git a/dep/ACE_wrappers/ace/OS_NS_dirent.inl b/dep/ACE_wrappers/ace/OS_NS_dirent.inl
index b439e4df599..2f73e091a24 100644
--- a/dep/ACE_wrappers/ace/OS_NS_dirent.inl
+++ b/dep/ACE_wrappers/ace/OS_NS_dirent.inl
@@ -1,13 +1,18 @@
// -*- C++ -*-
//
// $Id: OS_NS_dirent.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_Memory.h"
+
#if defined (ACE_LACKS_ALPHASORT)
# include "ace/OS_NS_string.h"
#endif /* ACE_LACKS_ALPHASORT */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE_OS
{
+
ACE_INLINE void
closedir (ACE_DIR *d)
{
@@ -21,10 +26,12 @@ closedir (ACE_DIR *d)
# else /* ACE_WIN32 && ACE_LACKS_CLOSEDIR */
::closedir (d);
# endif /* ACE_WIN32 && ACE_LACKS_CLOSEDIR */
+
#else /* ACE_HAS_DIRENT */
ACE_UNUSED_ARG (d);
#endif /* ACE_HAS_DIRENT */
}
+
ACE_INLINE ACE_DIR *
opendir (const ACE_TCHAR *filename)
{
@@ -43,6 +50,7 @@ opendir (const ACE_TCHAR *filename)
ACE_NOTSUP_RETURN (0);
#endif /* ACE_HAS_DIRENT */
}
+
ACE_INLINE struct ACE_DIRENT *
readdir (ACE_DIR *d)
{
@@ -59,6 +67,7 @@ readdir (ACE_DIR *d)
ACE_NOTSUP_RETURN (0);
#endif /* ACE_HAS_DIRENT */
}
+
ACE_INLINE int
readdir_r (ACE_DIR *dirp,
struct ACE_DIRENT *entry,
@@ -85,8 +94,10 @@ readdir_r (ACE_DIR *dirp,
ACE_UNUSED_ARG (entry);
ACE_UNUSED_ARG (result);
ACE_NOTSUP_RETURN (0);
+
#endif /* ACE_HAS_REENTRANT_FUNCTIONS */
}
+
ACE_INLINE void
rewinddir (ACE_DIR *d)
{
@@ -100,6 +111,7 @@ rewinddir (ACE_DIR *d)
# endif /* !defined (ACE_LACKS_REWINDDIR) */
#endif /* ACE_HAS_DIRENT */
}
+
ACE_INLINE int
scandir (const ACE_TCHAR *dirname,
struct ACE_DIRENT **namelist[],
@@ -120,10 +132,12 @@ scandir (const ACE_TCHAR *dirname,
# else
comparator);
# endif /* ACE_SCANDIR_CMP_USES_VOIDPTR */
+
#else /* ! defined ( ACE_HAS_SCANDIR) */
return ACE_OS::scandir_emulation (dirname, namelist, selector, comparator);
#endif /* ACE_HAS_SCANDIR */
}
+
ACE_INLINE int
alphasort (const void *a, const void *b)
{
@@ -142,6 +156,7 @@ alphasort (const void *a, const void *b)
# endif
#endif
}
+
ACE_INLINE void
seekdir (ACE_DIR *d, long loc)
{
@@ -152,6 +167,7 @@ seekdir (ACE_DIR *d, long loc)
ACE_UNUSED_ARG (loc);
#endif /* ! ACE_HAS_DIRENT || ACE_LACKS_SEEKDIR */
}
+
ACE_INLINE long
telldir (ACE_DIR *d)
{
@@ -162,5 +178,7 @@ telldir (ACE_DIR *d)
ACE_NOTSUP_RETURN (-1);
#endif /* ! ACE_HAS_DIRENT || ACE_LACKS_TELLDIR */
}
+
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_NS_dlfcn.cpp b/dep/ACE_wrappers/ace/OS_NS_dlfcn.cpp
index 4e1123fc5a8..54580ba6523 100644
--- a/dep/ACE_wrappers/ace/OS_NS_dlfcn.cpp
+++ b/dep/ACE_wrappers/ace/OS_NS_dlfcn.cpp
@@ -1,7 +1,11 @@
// $Id: OS_NS_dlfcn.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_dlfcn.h"
+
ACE_RCSID(ace, OS_NS_dlfcn, "$Id: OS_NS_dlfcn.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if !defined (ACE_HAS_INLINED_OSCALLS)
# include "ace/OS_NS_dlfcn.inl"
#endif /* ACE_HAS_INLINED_OSCALLS */
+
diff --git a/dep/ACE_wrappers/ace/OS_NS_dlfcn.h b/dep/ACE_wrappers/ace/OS_NS_dlfcn.h
index fde99933873..13a8e7d0cfa 100644
--- a/dep/ACE_wrappers/ace/OS_NS_dlfcn.h
+++ b/dep/ACE_wrappers/ace/OS_NS_dlfcn.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file OS_NS_dlfcn.h
@@ -12,35 +13,50 @@
* Originally in OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_NS_DLFCN_H
# define ACE_OS_NS_DLFCN_H
+
# include /**/ "ace/pre.h"
+
# include "ace/config-all.h"
+
# if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
# endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/os_dlfcn.h"
#include /**/ "ace/ACE_export.h"
+
#if defined (ACE_EXPORT_MACRO)
# undef ACE_EXPORT_MACRO
#endif
#define ACE_EXPORT_MACRO ACE_Export
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE_OS {
+
//@{ @name A set of wrappers for explicit dynamic linking.
ACE_NAMESPACE_INLINE_FUNCTION
int dlclose (ACE_SHLIB_HANDLE handle);
+
ACE_NAMESPACE_INLINE_FUNCTION
ACE_TCHAR *dlerror (void);
+
ACE_NAMESPACE_INLINE_FUNCTION
ACE_SHLIB_HANDLE dlopen (const ACE_TCHAR *filename,
int mode = ACE_DEFAULT_SHLIB_MODE);
+
ACE_NAMESPACE_INLINE_FUNCTION
void *dlsym (ACE_SHLIB_HANDLE handle,
const ACE_TCHAR *symbol);
//@}
+
} /* namespace ACE_OS */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# if defined (ACE_HAS_INLINED_OSCALLS)
# if defined (ACE_INLINE)
# undef ACE_INLINE
@@ -48,6 +64,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_INLINE inline
# include "ace/OS_NS_dlfcn.inl"
# endif /* ACE_HAS_INLINED_OSCALLS */
+
# include /**/ "ace/post.h"
#endif /* ACE_OS_NS_DLFCN_H */
diff --git a/dep/ACE_wrappers/ace/OS_NS_dlfcn.inl b/dep/ACE_wrappers/ace/OS_NS_dlfcn.inl
index ea9caa111a6..9b75ac3ad5c 100644
--- a/dep/ACE_wrappers/ace/OS_NS_dlfcn.inl
+++ b/dep/ACE_wrappers/ace/OS_NS_dlfcn.inl
@@ -1,6 +1,7 @@
// -*- C++ -*-
//
// $Id: OS_NS_dlfcn.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_macros.h"
#include "ace/OS_NS_errno.h"
#include "ace/OS_NS_fcntl.h"
@@ -9,14 +10,18 @@
#include "ace/Default_Constants.h"
#include "ace/os_include/os_fcntl.h"
#include "ace/os_include/os_string.h"
+
#if defined (ACE_WIN32) && defined (ACE_HAS_PHARLAP)
# include "ace/OS_NS_stdio.h"
#endif
+
#if defined (ACE_USES_ASM_SYMBOL_IN_DLSYM)
# include "ace/OS_Memory.h"
# include "ace/OS_NS_string.h"
#endif /* ACE_USES_ASM_SYMBOL_IN_DLSYM */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE int
ACE_OS::dlclose (ACE_SHLIB_HANDLE handle)
{
@@ -25,10 +30,13 @@ ACE_OS::dlclose (ACE_SHLIB_HANDLE handle)
ACE_UNUSED_ARG (handle);
return 0;
#elif defined (ACE_HAS_SVR4_DYNAMIC_LINKING)
+
# if !defined (ACE_HAS_AUTOMATIC_INIT_FINI)
// SunOS4 does not automatically call _fini()!
void *ptr;
+
ACE_OSCALL (::dlsym (handle, ACE_TEXT ("_fini")), void *, 0, ptr);
+
if (ptr != 0)
(*((int (*)(void)) ptr)) (); // Call _fini hook explicitly.
# endif /* ACE_HAS_AUTOMATIC_INIT_FINI */
@@ -64,6 +72,7 @@ ACE_OS::dlclose (ACE_SHLIB_HANDLE handle)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_SVR4_DYNAMIC_LINKING */
}
+
ACE_INLINE ACE_TCHAR *
ACE_OS::dlerror (void)
{
@@ -107,11 +116,13 @@ ACE_OS::dlerror (void)
ACE_NOTSUP_RETURN (0);
# endif /* ACE_HAS_SVR4_DYNAMIC_LINKING */
}
+
ACE_INLINE ACE_SHLIB_HANDLE
ACE_OS::dlopen (const ACE_TCHAR *fname,
int mode)
{
ACE_OS_TRACE ("ACE_OS::dlopen");
+
# if defined (ACE_HAS_SVR4_DYNAMIC_LINKING)
void *handle;
# if defined (ACE_HAS_SGIDLADD)
@@ -130,7 +141,9 @@ ACE_OS::dlopen (const ACE_TCHAR *fname,
void *ptr;
// Some systems (e.g., SunOS4) do not automatically call _init(), so
// we'll have to call it manually.
+
ACE_OSCALL (::dlsym (handle, ACE_TEXT ("_init")), void *, 0, ptr);
+
if (ptr != 0 && (*((int (*)(void)) ptr)) () == -1) // Call _init hook explicitly.
{
// Close down the handle to prevent leaks.
@@ -142,8 +155,10 @@ ACE_OS::dlopen (const ACE_TCHAR *fname,
return handle;
# elif defined (ACE_WIN32)
ACE_UNUSED_ARG (mode);
+
ACE_WIN32CALL_RETURN (ACE_TEXT_LoadLibrary (fname), ACE_SHLIB_HANDLE, 0);
# elif defined (__hpux)
+
# if defined(__GNUC__) || __cplusplus >= 199707L
ACE_OSCALL_RETURN (::shl_load(fname, mode, 0L), ACE_SHLIB_HANDLE, 0);
# else
@@ -155,12 +170,14 @@ ACE_OS::dlopen (const ACE_TCHAR *fname,
ACE_HANDLE filehandle = ACE_OS::open (fname,
O_RDONLY,
ACE_DEFAULT_FILE_PERMS);
+
if (filehandle != ACE_INVALID_HANDLE)
{
ACE_OS::last_error(0);
ACE_OSCALL ( ::loadModule (filehandle, LOAD_GLOBAL_SYMBOLS|LOAD_COMMON_MATCH_ALL ), MODULE *, 0, handle);
int loaderror = ACE_OS::last_error();
ACE_OS::close (filehandle);
+
if ( (loaderror != 0) && (handle != 0) )
{
// ouch something went wrong most likely unresolved externals
@@ -181,16 +198,19 @@ ACE_OS::dlopen (const ACE_TCHAR *fname,
ACE_NOTSUP_RETURN (0);
# endif /* ACE_HAS_SVR4_DYNAMIC_LINKING */
}
+
ACE_INLINE void *
ACE_OS::dlsym (ACE_SHLIB_HANDLE handle,
const ACE_TCHAR *sname)
{
ACE_OS_TRACE ("ACE_OS::dlsym");
+
#if defined (ACE_HAS_DLSYM_SEGFAULT_ON_INVALID_HANDLE)
// Check if the handle is valid before making any calls using it.
if (handle == ACE_SHLIB_INVALID_HANDLE)
return 0;
#endif /* ACE_HAS_DLSYM_SEGFAULT_ON_INVALID_HANDLE */
+
// Get the correct OS type.
#if defined (ACE_HAS_WINCE)
// CE (at least thru Pocket PC 2003) offers GetProcAddressW, not ...A, so
@@ -211,7 +231,9 @@ ACE_OS::dlsym (ACE_SHLIB_HANDLE handle,
#else
const char *symbolname = sname;
#endif /* ACE_HAS_WINCE */
+
# if defined (ACE_HAS_SVR4_DYNAMIC_LINKING)
+
# if defined (ACE_USES_ASM_SYMBOL_IN_DLSYM)
int l = ACE_OS::strlen (symbolname) + 2;
char *asm_symbolname = 0;
@@ -227,15 +249,21 @@ ACE_OS::dlsym (ACE_SHLIB_HANDLE handle,
# else
ACE_OSCALL_RETURN (::dlsym (handle, symbolname), void *, 0);
# endif /* ACE_USES_ASM_SYMBOL_IN_DLSYM */
+
# elif defined (ACE_WIN32)
+
ACE_WIN32CALL_RETURN (::GetProcAddress (handle, symbolname), void *, 0);
+
# elif defined (__hpux)
+
void *value = 0;
int status;
shl_t _handle = handle;
ACE_OSCALL (::shl_findsym(&_handle, symbolname, TYPE_UNDEFINED, &value), int, -1, status);
return status == 0 ? value : 0;
+
# elif defined (ACE_VXWORKS) && !defined (__RTP__)
+
// For now we use the VxWorks global symbol table
// which resolves the most recently loaded symbols .. which resolve mostly what we want..
ACE_UNUSED_ARG (handle);
@@ -243,11 +271,16 @@ ACE_OS::dlsym (ACE_SHLIB_HANDLE handle,
char *value = 0;
STATUS status;
ACE_OSCALL (::symFindByName(sysSymTbl, symbolname, &value, &symtype), int, -1, status);
+
return status == OK ? reinterpret_cast <void*>(value) : 0;
+
# else
+
ACE_UNUSED_ARG (handle);
ACE_UNUSED_ARG (symbolname);
ACE_NOTSUP_RETURN (0);
+
# endif /* ACE_HAS_SVR4_DYNAMIC_LINKING */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_NS_errno.cpp b/dep/ACE_wrappers/ace/OS_NS_errno.cpp
index 90961d61466..ea3213c0832 100644
--- a/dep/ACE_wrappers/ace/OS_NS_errno.cpp
+++ b/dep/ACE_wrappers/ace/OS_NS_errno.cpp
@@ -1,8 +1,12 @@
// -*- C++ -*-
// $Id: OS_NS_errno.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_errno.h"
+
ACE_RCSID(ace, OS_NS_errno, "$Id: OS_NS_errno.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if !defined (ACE_HAS_INLINED_OSCALLS)
# include "ace/OS_NS_errno.inl"
#endif /* ACE_HAS_INLINED_OSCALLS */
+
diff --git a/dep/ACE_wrappers/ace/OS_NS_errno.h b/dep/ACE_wrappers/ace/OS_NS_errno.h
index e664c94b2df..9ab6d1b1f38 100644
--- a/dep/ACE_wrappers/ace/OS_NS_errno.h
+++ b/dep/ACE_wrappers/ace/OS_NS_errno.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file OS_NS_errno.h
@@ -12,30 +13,44 @@
* Originally in OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_NS_ERRNO_H
# define ACE_OS_NS_ERRNO_H
+
# include /**/ "ace/pre.h"
+
# include "ace/config-lite.h"
+
# if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
# endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/os_errno.h"
#include /**/ "ace/ACE_export.h"
+
#if defined (ACE_EXPORT_MACRO)
# undef ACE_EXPORT_MACRO
#endif
#define ACE_EXPORT_MACRO ACE_Export
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE_OS {
+
ACE_NAMESPACE_INLINE_FUNCTION
int last_error (void);
+
ACE_NAMESPACE_INLINE_FUNCTION
void last_error (int error);
+
ACE_NAMESPACE_INLINE_FUNCTION
int set_errno_to_last_error (void);
+
ACE_NAMESPACE_INLINE_FUNCTION
int set_errno_to_wsa_last_error (void);
+
} /* namespace ACE_OS */
+
#if defined (ACE_HAS_WINCE_BROKEN_ERRNO)
/**
* @class ACE_CE_Errno
@@ -53,20 +68,26 @@ public:
static void init ();
static void fini ();
static ACE_CE_Errno *instance ();
+
operator int (void) const;
int operator= (int);
+
private:
static ACE_CE_Errno *instance_;
static DWORD errno_key_;
};
+
# define errno (* (ACE_CE_Errno::instance ()))
#endif /* ACE_HAS_WINCE_BROKEN_ERRNO */
+
#if defined (ACE_HAS_WINCE_BROKEN_ERRNO)
# define ACE_ERRNO_TYPE ACE_CE_Errno
#else
# define ACE_ERRNO_TYPE int
#endif /* ACE_HAS_WINCE_BROKEN_ERRNO */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# if defined (ACE_HAS_INLINED_OSCALLS)
# if defined (ACE_INLINE)
# undef ACE_INLINE
@@ -74,6 +95,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_INLINE inline
# include "ace/OS_NS_errno.inl"
# endif /* ACE_HAS_INLINED_OSCALLS */
+
# include /**/ "ace/post.h"
#endif /* ACE_OS_NS_ERRNO_H */
diff --git a/dep/ACE_wrappers/ace/OS_NS_errno.inl b/dep/ACE_wrappers/ace/OS_NS_errno.inl
index 94b00dc7baa..3795eec54a7 100644
--- a/dep/ACE_wrappers/ace/OS_NS_errno.inl
+++ b/dep/ACE_wrappers/ace/OS_NS_errno.inl
@@ -1,12 +1,16 @@
// -*- C++ -*-
//
// $Id: OS_NS_errno.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/config-all.h" /* Need ACE_TRACE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE int
ACE_OS::last_error (void)
{
// ACE_OS_TRACE ("ACE_OS::last_error");
+
#if defined (ACE_WIN32)
// ACE_OS::last_error() prefers errnor since started out as a way to
// avoid directly accessing errno in ACE code - particularly the ACE
@@ -20,6 +24,7 @@ ACE_OS::last_error (void)
return errno;
#endif /* ACE_WIN32 */
}
+
ACE_INLINE void
ACE_OS::last_error (int error)
{
@@ -29,6 +34,7 @@ ACE_OS::last_error (int error)
#endif /* ACE_WIN32 */
errno = error;
}
+
ACE_INLINE int
ACE_OS::set_errno_to_last_error (void)
{
@@ -38,6 +44,7 @@ ACE_OS::set_errno_to_last_error (void)
return errno;
# endif /* defined(ACE_WIN32) */
}
+
ACE_INLINE int
ACE_OS::set_errno_to_wsa_last_error (void)
{
@@ -47,18 +54,22 @@ ACE_OS::set_errno_to_wsa_last_error (void)
return errno;
# endif /* defined(ACE_WIN32) */
}
+
#if defined (ACE_HAS_WINCE_BROKEN_ERRNO)
+
ACE_INLINE ACE_CE_Errno *
ACE_CE_Errno::instance ()
{
// This should be inlined.
return ACE_CE_Errno::instance_;
}
+
ACE_INLINE
ACE_CE_Errno::operator int (void) const
{
return (int) TlsGetValue (ACE_CE_Errno::errno_key_);
}
+
ACE_INLINE int
ACE_CE_Errno::operator= (int x)
{
@@ -66,5 +77,7 @@ ACE_CE_Errno::operator= (int x)
TlsSetValue (ACE_CE_Errno::errno_key_, (void *) x);
return x;
}
+
#endif /* ACE_HAS_WINCE_BROKEN_ERRNO */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_NS_fcntl.cpp b/dep/ACE_wrappers/ace/OS_NS_fcntl.cpp
index a3d94760fc7..a50e900330a 100644
--- a/dep/ACE_wrappers/ace/OS_NS_fcntl.cpp
+++ b/dep/ACE_wrappers/ace/OS_NS_fcntl.cpp
@@ -1,14 +1,20 @@
// $Id: OS_NS_fcntl.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_fcntl.h"
+
ACE_RCSID(ace, OS_NS_fcntl, "$Id: OS_NS_fcntl.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if !defined (ACE_HAS_INLINED_OSCALLS)
# include "ace/OS_NS_fcntl.inl"
#endif /* ACE_HAS_INLINED_OSCALLS */
+
#include "ace/OS_NS_stdio.h"
#include "ace/OS_NS_Thread.h"
#include "ace/OS_NS_macros.h"
#include "ace/Object_Manager_Base.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_HANDLE
ACE_OS::open (const char *filename,
int mode,
@@ -16,13 +22,16 @@ ACE_OS::open (const char *filename,
LPSECURITY_ATTRIBUTES sa)
{
ACE_OS_TRACE ("ACE_OS::open");
+
#if defined (ACE_WIN32)
DWORD access = GENERIC_READ;
if (ACE_BIT_ENABLED (mode, O_WRONLY))
access = GENERIC_WRITE;
else if (ACE_BIT_ENABLED (mode, O_RDWR))
access = GENERIC_READ | GENERIC_WRITE;
+
DWORD creation = OPEN_EXISTING;
+
if ((mode & (_O_CREAT | _O_EXCL)) == (_O_CREAT | _O_EXCL))
creation = CREATE_NEW;
else if ((mode & (_O_CREAT | _O_TRUNC)) == (_O_CREAT | _O_TRUNC))
@@ -31,9 +40,12 @@ ACE_OS::open (const char *filename,
creation = OPEN_ALWAYS;
else if (ACE_BIT_ENABLED (mode, _O_TRUNC))
creation = TRUNCATE_EXISTING;
+
DWORD flags = 0;
+
if (ACE_BIT_ENABLED (mode, _O_TEMPORARY))
flags |= FILE_FLAG_DELETE_ON_CLOSE | FILE_ATTRIBUTE_TEMPORARY;
+
if (ACE_BIT_ENABLED (mode, FILE_FLAG_WRITE_THROUGH))
flags |= FILE_FLAG_WRITE_THROUGH;
if (ACE_BIT_ENABLED (mode, FILE_FLAG_OVERLAPPED))
@@ -50,7 +62,9 @@ ACE_OS::open (const char *filename,
flags |= FILE_FLAG_BACKUP_SEMANTICS;
if (ACE_BIT_ENABLED (mode, FILE_FLAG_POSIX_SEMANTICS))
flags |= FILE_FLAG_POSIX_SEMANTICS;
+
ACE_MT (ACE_thread_mutex_t *ace_os_monitor_lock = 0;)
+
if (ACE_BIT_ENABLED (mode, _O_APPEND))
{
ACE_MT
@@ -61,9 +75,11 @@ ACE_OS::open (const char *filename,
ACE_OS::thread_mutex_lock (ace_os_monitor_lock);
)
}
+
DWORD shared_mode = perms;
SECURITY_ATTRIBUTES sa_buffer;
SECURITY_DESCRIPTOR sd_buffer;
+
#if defined (ACE_HAS_WINCE)
ACE_HANDLE h = ::CreateFileW (ACE_Ascii_To_Wide (filename).wchar_rep (),
access,
@@ -83,6 +99,7 @@ ACE_OS::open (const char *filename,
flags,
0);
#endif /* ACE_HAS_WINCE */
+
if (ACE_BIT_ENABLED (mode, _O_APPEND))
{
LONG high_size = 0;
@@ -96,8 +113,10 @@ ACE_OS::open (const char *filename,
ACE_MT (ACE_OS::thread_mutex_unlock (ace_os_monitor_lock);)
ACE_FAIL_RETURN (ACE_INVALID_HANDLE);
}
+
ACE_MT (ACE_OS::thread_mutex_unlock (ace_os_monitor_lock);)
}
+
if (h == ACE_INVALID_HANDLE)
ACE_FAIL_RETURN (h);
else
@@ -115,6 +134,7 @@ ACE_OS::open (const char *filename,
ACE_OSCALL_RETURN (::open (filename, mode, perms), ACE_HANDLE, ACE_INVALID_HANDLE);
#endif /* ACE_WIN32 */
}
+
#if defined (ACE_HAS_WCHAR)
ACE_HANDLE
ACE_OS::open (const wchar_t *filename,
@@ -125,12 +145,15 @@ ACE_OS::open (const wchar_t *filename,
#if defined (ACE_WIN32)
// @@ (brunsch) Yuck, maybe there is a way to combine the code
// here with the char version
+
DWORD access = GENERIC_READ;
if (ACE_BIT_ENABLED (mode, O_WRONLY))
access = GENERIC_WRITE;
else if (ACE_BIT_ENABLED (mode, O_RDWR))
access = GENERIC_READ | GENERIC_WRITE;
+
DWORD creation = OPEN_EXISTING;
+
if ((mode & (_O_CREAT | _O_EXCL)) == (_O_CREAT | _O_EXCL))
creation = CREATE_NEW;
else if ((mode & (_O_CREAT | _O_TRUNC)) == (_O_CREAT | _O_TRUNC))
@@ -139,9 +162,12 @@ ACE_OS::open (const wchar_t *filename,
creation = OPEN_ALWAYS;
else if (ACE_BIT_ENABLED (mode, _O_TRUNC))
creation = TRUNCATE_EXISTING;
+
DWORD flags = 0;
+
if (ACE_BIT_ENABLED (mode, _O_TEMPORARY))
flags |= FILE_FLAG_DELETE_ON_CLOSE | FILE_ATTRIBUTE_TEMPORARY;
+
if (ACE_BIT_ENABLED (mode, FILE_FLAG_WRITE_THROUGH))
flags |= FILE_FLAG_WRITE_THROUGH;
if (ACE_BIT_ENABLED (mode, FILE_FLAG_OVERLAPPED))
@@ -158,7 +184,9 @@ ACE_OS::open (const wchar_t *filename,
flags |= FILE_FLAG_BACKUP_SEMANTICS;
if (ACE_BIT_ENABLED (mode, FILE_FLAG_POSIX_SEMANTICS))
flags |= FILE_FLAG_POSIX_SEMANTICS;
+
ACE_MT (ACE_thread_mutex_t *ace_os_monitor_lock = 0;)
+
if (ACE_BIT_ENABLED (mode, _O_APPEND))
{
ACE_MT
@@ -169,9 +197,11 @@ ACE_OS::open (const wchar_t *filename,
ACE_OS::thread_mutex_lock (ace_os_monitor_lock);
)
}
+
DWORD shared_mode = perms;
SECURITY_ATTRIBUTES sa_buffer;
SECURITY_DESCRIPTOR sd_buffer;
+
ACE_HANDLE h = ::CreateFileW (filename,
access,
shared_mode,
@@ -180,6 +210,7 @@ ACE_OS::open (const wchar_t *filename,
creation,
flags,
0);
+
if (ACE_BIT_ENABLED (mode, _O_APPEND))
{
LONG high_size = 0;
@@ -193,8 +224,10 @@ ACE_OS::open (const wchar_t *filename,
ACE_MT (ACE_OS::thread_mutex_unlock (ace_os_monitor_lock);)
ACE_FAIL_RETURN (ACE_INVALID_HANDLE);
}
+
ACE_MT (ACE_OS::thread_mutex_unlock (ace_os_monitor_lock);)
}
+
if (h == ACE_INVALID_HANDLE)
ACE_FAIL_RETURN (h);
else
@@ -208,5 +241,6 @@ ACE_OS::open (const wchar_t *filename,
#endif /* ACE_WIN32 */
}
#endif /* ACE_HAS_WCHAR */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_NS_fcntl.h b/dep/ACE_wrappers/ace/OS_NS_fcntl.h
index c65337221c3..1fc765ce0bd 100644
--- a/dep/ACE_wrappers/ace/OS_NS_fcntl.h
+++ b/dep/ACE_wrappers/ace/OS_NS_fcntl.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file OS_NS_fcntl.h
@@ -12,30 +13,41 @@
* Originally in OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_NS_FCNTL_H
# define ACE_OS_NS_FCNTL_H
+
# include /**/ "ace/pre.h"
+
# include "ace/config-all.h"
+
# if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
# endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/os_fcntl.h"
#include "ace/Global_Macros.h" // for LPSECURITY_ATTRIBUTES :-(
#include "ace/Default_Constants.h"
#include /**/ "ace/ACE_export.h"
+
#if defined (ACE_EXPORT_MACRO)
# undef ACE_EXPORT_MACRO
#endif
#define ACE_EXPORT_MACRO ACE_Export
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE_OS {
+
ACE_NAMESPACE_INLINE_FUNCTION
int fcntl (ACE_HANDLE handle,
int cmd,
long arg = 0);
+
#if !defined (ACE_DEFAULT_OPEN_PERMS)
# define ACE_DEFAULT_OPEN_PERMS ACE_DEFAULT_FILE_PERMS
#endif /* ACE_DEFAULT_OPEN_PERMS */
+
/// The O_APPEND flag is only partly supported on Win32. If you specify
/// O_APPEND, then the file pointer will be positioned at the end of
/// the file initially during open, but it is not re-positioned at
@@ -54,8 +66,11 @@ namespace ACE_OS {
mode_t perms = ACE_DEFAULT_OPEN_PERMS,
LPSECURITY_ATTRIBUTES sa = 0);
#endif /* ACE_HAS_WCHAR */
+
} /* namespace ACE_OS */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# if defined (ACE_HAS_INLINED_OSCALLS)
# if defined (ACE_INLINE)
# undef ACE_INLINE
@@ -63,6 +78,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_INLINE inline
# include "ace/OS_NS_fcntl.inl"
# endif /* ACE_HAS_INLINED_OSCALLS */
+
# include /**/ "ace/post.h"
#endif /* ACE_OS_NS_FCNTL_H */
diff --git a/dep/ACE_wrappers/ace/OS_NS_fcntl.inl b/dep/ACE_wrappers/ace/OS_NS_fcntl.inl
index 17cb8b6f30e..ddace065e7c 100644
--- a/dep/ACE_wrappers/ace/OS_NS_fcntl.inl
+++ b/dep/ACE_wrappers/ace/OS_NS_fcntl.inl
@@ -1,8 +1,11 @@
// -*- C++ -*-
//
// $Id: OS_NS_fcntl.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_errno.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE int
ACE_OS::fcntl (ACE_HANDLE handle, int cmd, long arg)
{
@@ -16,4 +19,5 @@ ACE_OS::fcntl (ACE_HANDLE handle, int cmd, long arg)
ACE_OSCALL_RETURN (::fcntl (handle, cmd, arg), int, -1);
# endif /* ACE_LACKS_FCNTL */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_NS_macros.h b/dep/ACE_wrappers/ace/OS_NS_macros.h
index 1d02adcf63b..b80db9eebdb 100644
--- a/dep/ACE_wrappers/ace/OS_NS_macros.h
+++ b/dep/ACE_wrappers/ace/OS_NS_macros.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file OS_NS_macros.h
@@ -12,13 +13,18 @@
* Originally in OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_NS_MACROS_H
# define ACE_OS_NS_MACROS_H
+
# include /**/ "ace/pre.h"
+
# include "ace/config-all.h"
+
# if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
# endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_WIN32)
# define ACE_SOCKCALL_RETURN(OP,TYPE,FAILVALUE) \
do { TYPE ace_result_ = (TYPE) OP; \
@@ -32,7 +38,9 @@
# define ACE_SOCKCALL_RETURN(OP,TYPE,FAILVALUE) ACE_OSCALL_RETURN(OP,TYPE,FAILVALUE)
# define ACE_SOCKCALL(OP,TYPE,FAILVALUE,RESULT) ACE_OSCALL(OP,TYPE,FAILVALUE,RESULT)
#endif /* ACE_WIN32 */
+
#if !defined (ACE_WIN32)
+
// Adapt the weird threading and synchronization routines (which
// return errno rather than -1) so that they return -1 and set errno.
// This is more consistent with the rest of ACE_OS and enables us to
@@ -42,10 +50,13 @@
# else
# define ACE_ADAPT_RETVAL(OP,RESULT) ((RESULT = (OP)) != 0 ? (errno = RESULT, -1) : 0)
# endif /* ACE_VXWORKS */
+
#else /* ACE_WIN32 */
+
// Adapt the Win32 System Calls (which return BOOLEAN values of TRUE
// and FALSE) into int values expected by the ACE_OSCALL macros.
# define ACE_ADAPT_RETVAL(OP,RESULT) ((RESULT = (OP)) == FALSE ? -1 : 0)
+
// Perform a mapping of Win32 error numbers into POSIX errnos.
# define ACE_FAIL_RETURN(RESULT) do { \
switch (ACE_OS::set_errno_to_last_error ()) { \
@@ -55,14 +66,19 @@
case ERROR_PATH_NOT_FOUND: errno = ENOENT; break; \
} \
return RESULT; } while (0)
+
#endif /* !ACE_WIN32 */
+
// Helper functions to split large intergers into smaller high-order
// and low-order parts, and reconstitute them again. These are
// required primarily for supporting _FILE_OFFSET_BITS==64 on windows.
+
#if defined(ACE_WIN32)
# if defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS==64)
# include "ace/Basic_Types.h"
+
# define ACE_LOW_PART(X) static_cast<DWORD>(X)
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
LONG
inline ACE_High_Part (ACE_OFF_T value)
@@ -72,6 +88,7 @@ inline ACE_High_Part (ACE_OFF_T value)
return new_value.HighPart;
}
# define ACE_HIGH_PART(X) ACE_High_Part(X)
+
LONGLONG
inline ACE_Combine_Parts (LONG high, DWORD low)
{
@@ -81,6 +98,7 @@ inline ACE_Combine_Parts (LONG high, DWORD low)
return value.QuadPart;
}
ACE_END_VERSIONED_NAMESPACE_DECL
+
# define ACE_COMBINE_PARTS(X,Y) ACE_Combine_Parts(X,Y)
# else /* _FILE_OFFSET_BITS==64 */
# define ACE_LOW_PART(X) X
@@ -89,6 +107,9 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# endif /* _FILE_OFFSET_BITS==64 */
#endif /* ACE_WIN32 */
+
+
# include /**/ "ace/post.h"
+
#endif /* ACE_OS_NS_MACROS_H */
diff --git a/dep/ACE_wrappers/ace/OS_NS_math.cpp b/dep/ACE_wrappers/ace/OS_NS_math.cpp
index 6db2f6f5b78..7cbfd89336c 100644
--- a/dep/ACE_wrappers/ace/OS_NS_math.cpp
+++ b/dep/ACE_wrappers/ace/OS_NS_math.cpp
@@ -1,7 +1,11 @@
// $Id: OS_NS_math.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_math.h"
+
ACE_RCSID(ace, OS_NS_math, "$Id: OS_NS_math.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if !defined (ACE_HAS_INLINED_OSCALLS)
# include "ace/OS_NS_math.inl"
#endif /* ACE_HAS_INLINED_OSCALLS */
+
diff --git a/dep/ACE_wrappers/ace/OS_NS_math.h b/dep/ACE_wrappers/ace/OS_NS_math.h
index e12b33263d5..0ed1d6ce892 100644
--- a/dep/ACE_wrappers/ace/OS_NS_math.h
+++ b/dep/ACE_wrappers/ace/OS_NS_math.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file OS_NS_math.h
@@ -12,20 +13,28 @@
* Originally in OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_NS_MATH_H
# define ACE_OS_NS_MATH_H
+
# include /**/ "ace/pre.h"
+
# include "ace/config-all.h"
+
# if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
# endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/os_math.h"
+
#include /**/ "ace/ACE_export.h"
+
#if defined (ACE_EXPORT_MACRO)
# undef ACE_EXPORT_MACRO
#endif
#define ACE_EXPORT_MACRO ACE_Export
+
/*
* We inline and undef some functions that may be implemented
* as macros on some platforms. This way macro definitions will
@@ -44,43 +53,56 @@ inline double ace_log2_helper (double x)
# else
/*
==================================================================
+
log (x)
k
log (x) = -------
b log (b)
k
+
meaning the binary logarithm of x using the natural logarithm, for
example, is:
+
log (x)
e
log (x) = -------
2 log (2)
e
+
==================================================================
*/
+
// Precomputed value of 1/log(2.0). Saves an expensive division and
// computing log(2.0) in each call.
double const _1_ln2 = 1.442695040888963407359924681002;
+
return log (x) * _1_ln2;
# endif /* !ACE_LACKS_LOG2 */
#endif /* defined (log2) */
}
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE_OS
{
/// This method computes the largest integral value not greater than x.
ACE_NAMESPACE_INLINE_FUNCTION
double floor (double x);
+
/// This method computes the smallest integral value not less than x.
ACE_NAMESPACE_INLINE_FUNCTION
double ceil (double x);
+
/// This method computes the base-2 logarithm of x.
ACE_NAMESPACE_INLINE_FUNCTION
double log2 (double x);
+
} /* namespace ACE_OS */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# if defined (ACE_HAS_INLINED_OSCALLS)
# if defined (ACE_INLINE)
# undef ACE_INLINE
@@ -88,6 +110,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_INLINE inline
# include "ace/OS_NS_math.inl"
# endif /* ACE_HAS_INLINED_OSCALLS */
+
# include /**/ "ace/post.h"
#endif /* ACE_OS_NS_MATH_H */
diff --git a/dep/ACE_wrappers/ace/OS_NS_math.inl b/dep/ACE_wrappers/ace/OS_NS_math.inl
index 44512815944..edfeb41869d 100644
--- a/dep/ACE_wrappers/ace/OS_NS_math.inl
+++ b/dep/ACE_wrappers/ace/OS_NS_math.inl
@@ -1,8 +1,11 @@
// -*- C++ -*-
//
// $Id: OS_NS_math.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE_OS {
+
ACE_INLINE double
floor (double x)
{
@@ -14,6 +17,7 @@ namespace ACE_OS {
else
return static_cast<long>(x) - 1;
}
+
ACE_INLINE double
ceil (double x)
{
@@ -25,10 +29,13 @@ namespace ACE_OS {
else
return static_cast<long> (x) + 1;
}
+
ACE_INLINE double
log2 (double x)
{
return ace_log2_helper (x);
}
+
} // ACE_OS namespace
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_NS_netdb.cpp b/dep/ACE_wrappers/ace/OS_NS_netdb.cpp
index 3ecb20808ed..f4fa87906a9 100644
--- a/dep/ACE_wrappers/ace/OS_NS_netdb.cpp
+++ b/dep/ACE_wrappers/ace/OS_NS_netdb.cpp
@@ -1,10 +1,14 @@
// -*- C++ -*-
// $Id: OS_NS_netdb.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_netdb.h"
+
ACE_RCSID(ace, OS_NS_netdb, "$Id: OS_NS_netdb.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if !defined (ACE_HAS_INLINED_OSCALLS)
# include "ace/OS_NS_netdb.inl"
#endif /* ACE_HAS_INLINED_OSCALLS */
+
#include "ace/os_include/net/os_if.h"
#include "ace/OS_NS_unistd.h"
#if defined (ACE_WIN32) && defined (ACE_HAS_PHARLAP)
@@ -12,40 +16,52 @@ ACE_RCSID(ace, OS_NS_netdb, "$Id: OS_NS_netdb.cpp 80826 2008-03-04 14:51:23Z wot
#endif
#include "ace/OS_NS_stropts.h"
#include "ace/OS_NS_sys_socket.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_VXWORKS) && defined (ACE_LACKS_GETHOSTBYADDR)
+
struct hostent *
ACE_OS::gethostbyaddr (const char *addr, int length, int type)
{
ACE_OS_TRACE ("ACE_OS::gethostbyaddr");
+
if (length != 4 || type != AF_INET)
{
errno = EINVAL;
return 0;
}
+
// not thread safe!
static hostent ret;
static char name [MAXNAMELEN + 1];
static char *hostaddr[2];
static char *aliases[1];
+
if (::hostGetByAddr (*(int *) addr, name) != 0)
{
// errno will have been set to S_hostLib_UNKNOWN_HOST.
return 0;
}
+
// Might not be official: just echo input arg.
hostaddr[0] = (char *) addr;
hostaddr[1] = 0;
aliases[0] = 0;
+
ret.h_name = name;
ret.h_addrtype = AF_INET;
ret.h_length = 4; // VxWorks 5.2/3 doesn't define IP_ADDR_LEN;
ret.h_addr_list = hostaddr;
ret.h_aliases = aliases;
+
return &ret;
}
+
#endif /* ACE_VXWORKS && ACE_LACKS_GETHOSTBYADDR */
+
#if defined (ACE_VXWORKS) && defined (ACE_LACKS_GETHOSTBYADDR)
+
struct hostent *
ACE_OS::gethostbyaddr_r (const char *addr, int length, int type,
hostent *result, ACE_HOSTENT_DATA buffer,
@@ -57,6 +73,7 @@ ACE_OS::gethostbyaddr_r (const char *addr, int length, int type,
errno = EINVAL;
return 0;
}
+
if (ACE_OS::netdb_acquire ())
return 0;
else
@@ -65,6 +82,7 @@ ACE_OS::gethostbyaddr_r (const char *addr, int length, int type,
// buffer[0-3]: h_addr_list[0], the first (and only) addr.
// buffer[4-7]: h_addr_list[1], the null terminator for the h_addr_list.
// buffer[8]: the name of the host, null terminated.
+
// Call ::hostGetByAddr (), which puts the (one) hostname into
// buffer.
if (::hostGetByAddr (*(int *) addr, &buffer[8]) == 0)
@@ -73,6 +91,7 @@ ACE_OS::gethostbyaddr_r (const char *addr, int length, int type,
result->h_name = &buffer[8]; // null-terminated host name
result->h_addrtype = AF_INET;
result->h_length = 4; // VxWorks 5.2/3 doesn't define IP_ADDR_LEN.
+
result->h_addr_list = (char **) buffer;
// Might not be official: just echo input arg.
result->h_addr_list[0] = (char *) addr;
@@ -87,53 +106,69 @@ ACE_OS::gethostbyaddr_r (const char *addr, int length, int type,
result = 0;
}
}
+
ACE_OS::netdb_release ();
*h_errnop = errno;
return result;
}
+
#endif /* ACE_VXWORKS && ACE_LACKS_GETHOSTBYADDR */
+
#if defined (ACE_VXWORKS) && defined (ACE_LACKS_GETHOSTBYNAME)
+
struct hostent *
ACE_OS::gethostbyname (const char *name)
{
ACE_OS_TRACE ("ACE_OS::gethostbyname");
+
// not thread safe!
static hostent ret;
static int first_addr;
static char *hostaddr[2];
static char *aliases[1];
+
if (0 == name || '\0' == name[0])
return 0;
+
ACE_OSCALL (::hostGetByName (const_cast <char *> (name)), int, -1, first_addr);
if (first_addr == -1)
return 0;
+
hostaddr[0] = (char *) &first_addr;
hostaddr[1] = 0;
aliases[0] = 0;
+
// Might not be official: just echo input arg.
ret.h_name = (char *) name;
ret.h_addrtype = AF_INET;
ret.h_length = 4; // VxWorks 5.2/3 doesn't define IP_ADDR_LEN;
ret.h_addr_list = hostaddr;
ret.h_aliases = aliases;
+
return &ret;
}
+
#endif /* ACE_VXWORKS && ACE_LACKS_GETHOSTBYNAME */
+
#if defined (ACE_VXWORKS) && defined (ACE_LACKS_GETHOSTBYNAME)
+
struct hostent *
ACE_OS::gethostbyname_r (const char *name, hostent *result,
ACE_HOSTENT_DATA buffer,
int *h_errnop)
{
ACE_OS_TRACE ("ACE_OS::gethostbyname_r");
+
if (0 == name || '\0' == name[0])
return 0;
+
if (ACE_OS::netdb_acquire ())
return 0;
else
{
int addr;
ACE_OSCALL (::hostGetByName (const_cast <char *> (name)), int, -1, addr);
+
if (addr == -1)
{
// errno will have been set to S_hostLib_UNKNOWN_HOST
@@ -145,10 +180,12 @@ ACE_OS::gethostbyname_r (const char *name, hostent *result,
result->h_name = (char *) name;
result->h_addrtype = AF_INET;
result->h_length = 4; // VxWorks 5.2/3 doesn't define IP_ADDR_LEN;
+
// buffer layout:
// buffer[0-3]: h_addr_list[0], pointer to the addr.
// buffer[4-7]: h_addr_list[1], null terminator for the h_addr_list.
// buffer[8-11]: the first (and only) addr.
+
// Store the address list in buffer.
result->h_addr_list = (char **) buffer;
// Store the actual address _after_ the address list.
@@ -160,22 +197,29 @@ ACE_OS::gethostbyname_r (const char *name, hostent *result,
result->h_aliases = &result->h_addr_list[1];
}
}
+
ACE_OS::netdb_release ();
*h_errnop = errno;
return result;
}
+
#endif /* ACE_VXWORKS && ACE_LACKS_GETHOSTBYNAME*/
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
// Include if_arp so that getmacaddr can use the
// arp structure.
#if defined (sun)
# include /**/ <net/if_arp.h>
#endif
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
int
ACE_OS::getmacaddress (struct macaddr_node_t *node)
{
ACE_OS_TRACE ("ACE_OS::getmacaddress");
+
#if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)
# if !defined (ACE_HAS_PHARLAP)
/** Define a structure for use with the netbios routine */
@@ -184,25 +228,32 @@ ACE_OS::getmacaddress (struct macaddr_node_t *node)
ADAPTER_STATUS adapt;
NAME_BUFFER NameBuff [30];
};
+
NCB ncb;
LANA_ENUM lenum;
unsigned char result;
+
ACE_OS::memset (&ncb, 0, sizeof(ncb));
ncb.ncb_command = NCBENUM;
ncb.ncb_buffer = reinterpret_cast<unsigned char*> (&lenum);
ncb.ncb_length = sizeof(lenum);
+
result = Netbios (&ncb);
+
for(int i = 0; i < lenum.length; i++)
{
ACE_OS::memset (&ncb, 0, sizeof(ncb));
ncb.ncb_command = NCBRESET;
ncb.ncb_lana_num = lenum.lana [i];
+
/** Reset the netbios */
result = Netbios (&ncb);
+
if (ncb.ncb_retcode != NRC_GOODRET)
{
return -1;
}
+
ADAPTERSTAT adapter;
ACE_OS::memset (&ncb, 0, sizeof (ncb));
ACE_OS::strcpy (reinterpret_cast<char*> (ncb.ncb_callname), "*");
@@ -210,7 +261,9 @@ ACE_OS::getmacaddress (struct macaddr_node_t *node)
ncb.ncb_lana_num = lenum.lana[i];
ncb.ncb_buffer = reinterpret_cast<unsigned char*> (&adapter);
ncb.ncb_length = sizeof (adapter);
+
result = Netbios (&ncb);
+
if (result == 0)
{
ACE_OS::memcpy (node->node,
@@ -226,6 +279,7 @@ ACE_OS::getmacaddress (struct macaddr_node_t *node)
EK_TCPIPCFG *devp;
size_t i;
ACE_TCHAR dev_name[16];
+
for (i = 0; i < 10; i++)
{
// Ethernet.
@@ -251,29 +305,41 @@ ACE_OS::getmacaddress (struct macaddr_node_t *node)
# endif /* ACE_HAS_PHARLAP_RT */
# endif /* ACE_HAS_PHARLAP */
#elif defined (sun)
+
/** obtain the local host name */
char hostname [MAXHOSTNAMELEN];
ACE_OS::hostname (hostname, sizeof (hostname));
+
/** Get the hostent to use with ioctl */
struct hostent *phost =
ACE_OS::gethostbyname (hostname);
+
if (phost == 0)
return -1;
+
ACE_HANDLE handle =
ACE_OS::socket (PF_INET, SOCK_DGRAM, IPPROTO_UDP);
+
if (handle == ACE_INVALID_HANDLE)
return -1;
+
char **paddrs = phost->h_addr_list;
+
struct arpreq ar;
+
struct sockaddr_in *psa =
(struct sockaddr_in *)&(ar.arp_pa);
+
ACE_OS::memset (&ar,
0,
sizeof (struct arpreq));
+
psa->sin_family = AF_INET;
+
ACE_OS::memcpy (&(psa->sin_addr),
*paddrs,
sizeof (struct in_addr));
+
if (ACE_OS::ioctl (handle,
SIOCGARP,
&ar) == -1)
@@ -281,40 +347,58 @@ ACE_OS::getmacaddress (struct macaddr_node_t *node)
ACE_OS::close (handle);
return -1;
}
+
ACE_OS::close (handle);
+
ACE_OS::memcpy (node->node,
ar.arp_ha.sa_data,
6);
+
return 0;
+
#elif defined (linux) && !defined (ACE_LACKS_NETWORKING)
+
struct ifreq ifr;
+
ACE_HANDLE handle =
ACE_OS::socket (PF_INET, SOCK_DGRAM, 0);
+
if (handle == ACE_INVALID_HANDLE)
return -1;
+
ACE_OS::strcpy (ifr.ifr_name, "eth0");
+
if (ACE_OS::ioctl (handle/*s*/, SIOCGIFHWADDR, &ifr) < 0)
{
ACE_OS::close (handle);
return -1;
}
+
struct sockaddr* sa =
(struct sockaddr *) &ifr.ifr_addr;
+
ACE_OS::close (handle);
+
ACE_OS::memcpy (node->node,
sa->sa_data,
6);
+
return 0;
+
#else
ACE_UNUSED_ARG (node);
ACE_NOTSUP_RETURN (-1);
#endif
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) && defined (ACE_LACKS_NETDB_REENTRANT_FUNCTIONS)
# include "ace/OS_NS_Thread.h"
# include "ace/Object_Manager_Base.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
int
ACE_OS::netdb_acquire (void)
{
@@ -322,6 +406,7 @@ ACE_OS::netdb_acquire (void)
ACE_OS_Object_Manager::preallocated_object[
ACE_OS_Object_Manager::ACE_OS_MONITOR_LOCK]);
}
+
int
ACE_OS::netdb_release (void)
{
@@ -329,6 +414,9 @@ ACE_OS::netdb_release (void)
ACE_OS_Object_Manager::preallocated_object[
ACE_OS_Object_Manager::ACE_OS_MONITOR_LOCK]);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# endif /* defined (ACE_LACKS_NETDB_REENTRANT_FUNCTIONS) */
+
diff --git a/dep/ACE_wrappers/ace/OS_NS_netdb.h b/dep/ACE_wrappers/ace/OS_NS_netdb.h
index 92a1f31f391..2cf78998db1 100644
--- a/dep/ACE_wrappers/ace/OS_NS_netdb.h
+++ b/dep/ACE_wrappers/ace/OS_NS_netdb.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file OS_NS_netdb.h
@@ -12,22 +13,31 @@
* Originally in OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_NS_NETDB_H
#define ACE_OS_NS_NETDB_H
+
# include /**/ "ace/pre.h"
+
# include "ace/config-all.h"
+
# if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
# endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/os_netdb.h"
#include /**/ "ace/ACE_export.h"
+
#if defined (ACE_EXPORT_MACRO)
# undef ACE_EXPORT_MACRO
#endif
#define ACE_EXPORT_MACRO ACE_Export
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE_OS
{
+
#if defined (ACE_VXWORKS) && defined (ACE_LACKS_GETHOSTBYADDR)
extern ACE_Export
#else
@@ -36,6 +46,7 @@ namespace ACE_OS
struct hostent *gethostbyaddr (const char *addr,
int length,
int type);
+
#if defined (ACE_VXWORKS) && defined (ACE_LACKS_GETHOSTBYADDR)
extern ACE_Export
#else
@@ -47,12 +58,14 @@ namespace ACE_OS
struct hostent *result,
ACE_HOSTENT_DATA buffer,
int *h_errnop);
+
#if defined (ACE_VXWORKS) && defined (ACE_LACKS_GETHOSTBYNAME)
extern ACE_Export
#else
ACE_NAMESPACE_INLINE_FUNCTION
#endif /* ACE_VXWORKS */
struct hostent *gethostbyname (const char *name);
+
#if defined (ACE_VXWORKS) && defined (ACE_LACKS_GETHOSTBYNAME)
extern ACE_Export
#else
@@ -63,12 +76,15 @@ namespace ACE_OS
ACE_HOSTENT_DATA buffer,
int *h_errnop);
+
ACE_NAMESPACE_INLINE_FUNCTION
struct hostent *getipnodebyaddr (const void *src, size_t len,
int family);
+
ACE_NAMESPACE_INLINE_FUNCTION
struct hostent *getipnodebyname (const char *name, int family,
int flags = 0);
+
/**
* Get the first adapter found on the machine.
* @todo: this is really useless except for UUID, move there? dhinton
@@ -76,36 +92,48 @@ namespace ACE_OS
struct macaddr_node_t {
unsigned char node[6];
};
+
extern ACE_Export
int getmacaddress (struct macaddr_node_t *node);
+
ACE_NAMESPACE_INLINE_FUNCTION
struct protoent *getprotobyname (const char *name);
+
ACE_NAMESPACE_INLINE_FUNCTION
struct protoent *getprotobyname_r (const char *name,
struct protoent *result,
ACE_PROTOENT_DATA buffer);
+
ACE_NAMESPACE_INLINE_FUNCTION
struct protoent *getprotobynumber (int proto);
+
ACE_NAMESPACE_INLINE_FUNCTION
struct protoent *getprotobynumber_r (int proto,
struct protoent *result,
ACE_PROTOENT_DATA buffer);
+
ACE_NAMESPACE_INLINE_FUNCTION
struct servent *getservbyname (const char *svc,
const char *proto);
+
ACE_NAMESPACE_INLINE_FUNCTION
struct servent *getservbyname_r (const char *svc,
const char *proto,
struct servent *result,
ACE_SERVENT_DATA buf);
+
# if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) && defined (ACE_LACKS_NETDB_REENTRANT_FUNCTIONS)
extern ACE_Export
int netdb_acquire (void);
+
extern ACE_Export
int netdb_release (void);
# endif /* defined (ACE_MT_SAFE) && ACE_LACKS_NETDB_REENTRANT_FUNCTIONS */
+
} /* namespace ACE_OS */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# if defined (ACE_HAS_INLINED_OSCALLS)
# if defined (ACE_INLINE)
# undef ACE_INLINE
@@ -113,6 +141,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_INLINE inline
# include "ace/OS_NS_netdb.inl"
# endif /* ACE_HAS_INLINED_OSCALLS */
+
# include /**/ "ace/post.h"
#endif /* ACE_OS_NS_NETDB_H */
diff --git a/dep/ACE_wrappers/ace/OS_NS_netdb.inl b/dep/ACE_wrappers/ace/OS_NS_netdb.inl
index eda20fa2dca..508831d4380 100644
--- a/dep/ACE_wrappers/ace/OS_NS_netdb.inl
+++ b/dep/ACE_wrappers/ace/OS_NS_netdb.inl
@@ -1,9 +1,11 @@
// -*- C++ -*-
//
// $Id: OS_NS_netdb.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_macros.h"
#include "ace/OS_NS_string.h"
#include "ace/OS_NS_errno.h"
+
#if defined (ACE_LACKS_NETDB_REENTRANT_FUNCTIONS)
# if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
# define ACE_NETDBCALL_RETURN(OP,TYPE,FAILVALUE,TARGET,SIZE) \
@@ -37,8 +39,11 @@
} while(0)
# endif /* ACE_MT_SAFE && ACE_MT_SAFE != 0 */
#endif /* ACE_LACKS_NETDB_REENTRANT_FUNCTIONS */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
#if !(defined (ACE_VXWORKS) && defined (ACE_LACKS_GETHOSTBYADDR))
+
ACE_INLINE struct hostent *
ACE_OS::gethostbyaddr (const char *addr, int length, int type)
{
@@ -49,8 +54,10 @@ ACE_OS::gethostbyaddr (const char *addr, int length, int type)
ACE_UNUSED_ARG (type);
ACE_NOTSUP_RETURN (0);
# else
+
if (0 == addr || '\0' == addr[0])
return 0;
+
# if defined (ACE_VXWORKS)
// VxWorks 6.x has a gethostbyaddr() that is threadsafe and
// returns an heap-allocated hostentry structure.
@@ -78,8 +85,11 @@ ACE_OS::gethostbyaddr (const char *addr, int length, int type)
# endif /* ACE_HAS_NONCONST_GETBY */
# endif /* !ACE_LACKS_GETHOSTBYADDR */
}
+
#endif
+
#if !(defined (ACE_VXWORKS) && defined (ACE_LACKS_GETHOSTBYADDR))
+
ACE_INLINE struct hostent *
ACE_OS::gethostbyaddr_r (const char *addr,
int length,
@@ -98,10 +108,13 @@ ACE_OS::gethostbyaddr_r (const char *addr,
ACE_UNUSED_ARG (h_errnop);
ACE_NOTSUP_RETURN (0);
# elif defined (ACE_HAS_REENTRANT_FUNCTIONS) && !defined (UNIXWARE)
+
if (0 == addr || '\0' == addr[0])
return 0;
+
# if defined (AIX) || defined (DIGITAL_UNIX)
ACE_OS::memset (buffer, 0, sizeof (ACE_HOSTENT_DATA));
+
//FUZZ: disable check_for_lack_ACE_OS
if (::gethostbyaddr_r ((char *) addr, length, type, result,
(struct hostent_data *) buffer)== 0)
@@ -115,6 +128,7 @@ ACE_OS::gethostbyaddr_r (const char *addr,
# elif defined (__GLIBC__) || defined (__FreeBSD__)
// GNU C library has a different signature
ACE_OS::memset (buffer, 0, sizeof (ACE_HOSTENT_DATA));
+
//FUZZ: disable check_for_lack_ACE_OS
if (::gethostbyaddr_r ((char *) addr,
length,
@@ -134,15 +148,18 @@ ACE_OS::gethostbyaddr_r (const char *addr,
//FUZZ: disable check_for_lack_ACE_OS
struct hostent* hp = ::gethostbyaddr (addr, length, type);
//FUZZ: enable check_for_lack_ACE_OS
+
if (hp)
{
result->h_addrtype = hp->h_addrtype;
result->h_length = hp->h_length;
+
// buffer layout:
// buffer[0-3]: h_addr_list[0], pointer to the addr.
// buffer[4-7]: h_addr_list[1], null terminator for the h_addr_list.
// buffer[8..(8+h_length)]: the first (and only) addr.
// buffer[(8+h_length)...]: hostname
+
// Store the address list in buffer.
result->h_addr_list = (char **) buffer;
// Store the actual address _after_ the address list.
@@ -152,6 +169,7 @@ ACE_OS::gethostbyaddr_r (const char *addr,
result->h_addr_list[1] = 0;
// And no aliases, so null-terminate h_aliases.
result->h_aliases = &result->h_addr_list[1];
+
if (((2*sizeof(char*))+hp->h_length+ACE_OS::strlen (hp->h_name)+1) <= sizeof (ACE_HOSTENT_DATA))
{
result->h_name = (char *) result->h_addr_list[0] + hp->h_length;
@@ -161,8 +179,10 @@ ACE_OS::gethostbyaddr_r (const char *addr,
{
result->h_name = (char *)0;
}
+
// free hostent memory
::hostentFree (hp);
+
return result;
}
else
@@ -202,6 +222,7 @@ ACE_OS::gethostbyaddr_r (const char *addr,
ACE_UNUSED_ARG (h_errnop);
ACE_UNUSED_ARG (buffer);
ACE_UNUSED_ARG (result);
+
//FUZZ: disable check_for_lack_ACE_OS
ACE_SOCKCALL_RETURN (::gethostbyaddr (addr,
(ACE_SOCKET_LEN) length,
@@ -211,8 +232,11 @@ ACE_OS::gethostbyaddr_r (const char *addr,
//FUZZ: enable check_for_lack_ACE_OS
# endif /* ACE_LACKS_GETHOSTBYADDR_R */
}
+
#endif
+
#if !(defined (ACE_VXWORKS) && defined (ACE_LACKS_GETHOSTBYNAME))
+
ACE_INLINE struct hostent *
ACE_OS::gethostbyname (const char *name)
{
@@ -221,8 +245,10 @@ ACE_OS::gethostbyname (const char *name)
ACE_UNUSED_ARG (name);
ACE_NOTSUP_RETURN (0);
# else
+
if (0 == name || '\0' == name[0])
return 0;
+
# if defined (ACE_VXWORKS)
// VxWorks 6.x has a gethostbyname() that is threadsafe and
// returns an heap-allocated hostentry structure.
@@ -246,8 +272,11 @@ ACE_OS::gethostbyname (const char *name)
# endif /* ACE_HAS_NONCONST_GETBY */
# endif /* !ACE_LACKS_GETHOSTBYNAME */
}
+
#endif
+
#if !(defined (ACE_VXWORKS) && defined (ACE_LACKS_GETHOSTBYNAME))
+
ACE_INLINE struct hostent *
ACE_OS::gethostbyname_r (const char *name,
struct hostent *result,
@@ -262,13 +291,16 @@ ACE_OS::gethostbyname_r (const char *name,
ACE_UNUSED_ARG (h_errnop);
ACE_NOTSUP_RETURN (0);
# elif defined (ACE_HAS_REENTRANT_FUNCTIONS) && !defined (UNIXWARE)
+
if (0 == name || '\0' == name[0])
return (struct hostent *)0;
+
# if defined (DIGITAL_UNIX) || \
(defined (ACE_AIX_MINOR_VERS) && (ACE_AIX_MINOR_VERS > 2))
ACE_UNUSED_ARG (result);
ACE_UNUSED_ARG (buffer);
ACE_UNUSED_ARG (h_errnop);
+
// gethostbyname returns thread-specific storage on Digital Unix and
// AIX 4.3
//FUZZ: disable check_for_lack_ACE_OS
@@ -276,6 +308,7 @@ ACE_OS::gethostbyname_r (const char *name,
//FUZZ: enable check_for_lack_ACE_OS
# elif defined (AIX)
ACE_OS::memset (buffer, 0, sizeof (ACE_HOSTENT_DATA));
+
//FUZZ: disable check_for_lack_ACE_OS
if (::gethostbyname_r (name, result, (struct hostent_data *) buffer) == 0)
return result;
@@ -288,6 +321,7 @@ ACE_OS::gethostbyname_r (const char *name,
# elif defined (__GLIBC__) || defined (__FreeBSD__)
// GNU C library has a different signature
ACE_OS::memset (buffer, 0, sizeof (ACE_HOSTENT_DATA));
+
//FUZZ: disable check_for_lack_ACE_OS
if (::gethostbyname_r (name,
result,
@@ -305,14 +339,17 @@ ACE_OS::gethostbyname_r (const char *name,
//FUZZ: disable check_for_lack_ACE_OS
struct hostent* hp = ::gethostbyname (name);
//FUZZ: enable check_for_lack_ACE_OS
+
if (hp)
{
result->h_addrtype = hp->h_addrtype;
result->h_length = hp->h_length;
+
// buffer layout:
// buffer[0-3]: h_addr_list[0], pointer to the addr.
// buffer[4-7]: h_addr_list[1], null terminator for the h_addr_list.
// buffer[8...]: the first (and only) addr.
+
// Store the address list in buffer.
result->h_addr_list = (char **) buffer;
// Store the actual address _after_ the address list.
@@ -322,6 +359,7 @@ ACE_OS::gethostbyname_r (const char *name,
result->h_addr_list[1] = 0;
// And no aliases, so null-terminate h_aliases.
result->h_aliases = &result->h_addr_list[1];
+
if (((2*sizeof(char*))+hp->h_length+ACE_OS::strlen (hp->h_name)+1) <= sizeof (ACE_HOSTENT_DATA))
{
result->h_name = (char *) result->h_addr_list[0] + hp->h_length;
@@ -331,8 +369,10 @@ ACE_OS::gethostbyname_r (const char *name,
{
result->h_name = (char *)0;
}
+
// free hostent memory
::hostentFree (hp);
+
return result;
}
else
@@ -371,6 +411,7 @@ ACE_OS::gethostbyname_r (const char *name,
ACE_UNUSED_ARG (result);
ACE_UNUSED_ARG (buffer);
ACE_UNUSED_ARG (h_errnop);
+
//FUZZ: disable check_for_lack_ACE_OS
ACE_SOCKCALL_RETURN (::gethostbyname (name),
struct hostent *,
@@ -378,7 +419,9 @@ ACE_OS::gethostbyname_r (const char *name,
//FUZZ: enable check_for_lack_ACE_OS
# endif /* defined (ACE_HAS_REENTRANT_FUNCTIONS) && !defined (UNIXWARE) */
}
+
#endif
+
ACE_INLINE struct hostent *
ACE_OS::getipnodebyaddr (const void *src, size_t len, int family)
{
@@ -405,9 +448,11 @@ ACE_OS::getipnodebyaddr (const void *src, size_t len, int family)
return ACE_OS::gethostbyaddr (static_cast<const char *> (src),
static_cast<int> (len),
family);
+
ACE_NOTSUP_RETURN (0);
# endif /* defined (ACE_HAS_IPV6) && !defined (ACE_WIN32) */
}
+
ACE_INLINE struct hostent *
ACE_OS::getipnodebyname (const char *name, int family, int flags)
{
@@ -439,9 +484,11 @@ ACE_OS::getipnodebyname (const char *name, int family, int flags)
ACE_UNUSED_ARG (flags);
if (family == AF_INET)
return ACE_OS::gethostbyname (name);
+
ACE_NOTSUP_RETURN (0);
# endif /* defined (ACE_HAS_IPV6) && !ACE_LACKS_GETIPNODEBYNAME_IPV6 */
}
+
ACE_INLINE struct protoent *
ACE_OS::getprotobyname (const char *name)
{
@@ -462,6 +509,7 @@ ACE_OS::getprotobyname (const char *name)
//FUZZ: enable check_for_lack_ACE_OS
#endif /* ACE_LACKS_GETPROTOBYNAME */
}
+
ACE_INLINE struct protoent *
ACE_OS::getprotobyname_r (const char *name,
struct protoent *result,
@@ -520,6 +568,7 @@ ACE_OS::getprotobyname_r (const char *name,
#else
ACE_UNUSED_ARG (buffer);
ACE_UNUSED_ARG (result);
+
//FUZZ: disable check_for_lack_ACE_OS
ACE_SOCKCALL_RETURN (::getprotobyname (name),
struct protoent *,
@@ -527,6 +576,7 @@ ACE_OS::getprotobyname_r (const char *name,
//FUZZ: enable check_for_lack_ACE_OS
#endif /* defined (ACE_HAS_REENTRANT_FUNCTIONS) !defined (UNIXWARE) */
}
+
ACE_INLINE struct protoent *
ACE_OS::getprotobynumber (int proto)
{
@@ -540,6 +590,7 @@ ACE_OS::getprotobynumber (int proto)
//FUZZ: enable check_for_lack_ACE_OS
#endif /* ACE_LACKS_GETPROTOBYNUMBER */
}
+
ACE_INLINE struct protoent *
ACE_OS::getprotobynumber_r (int proto,
struct protoent *result,
@@ -588,12 +639,14 @@ ACE_OS::getprotobynumber_r (int proto,
#else
ACE_UNUSED_ARG (buffer);
ACE_UNUSED_ARG (result);
+
//FUZZ: disable check_for_lack_ACE_OS
ACE_SOCKCALL_RETURN (::getprotobynumber (proto),
struct protoent *, 0);
//FUZZ: enable check_for_lack_ACE_OS
#endif /* defined (ACE_HAS_REENTRANT_FUNCTIONS) && !defined (UNIXWARE) */
}
+
ACE_INLINE struct servent *
ACE_OS::getservbyname (const char *svc, const char *proto)
{
@@ -618,6 +671,7 @@ ACE_OS::getservbyname (const char *svc, const char *proto)
//FUZZ: enable check_for_lack_ACE_OS
#endif /* ACE_HAS_NONCONST_GETBY */
}
+
ACE_INLINE struct servent *
ACE_OS::getservbyname_r (const char *svc,
const char *proto,
@@ -634,6 +688,7 @@ ACE_OS::getservbyname_r (const char *svc,
#elif defined (ACE_HAS_REENTRANT_FUNCTIONS) && !defined (UNIXWARE)
# if defined (AIX) || defined (DIGITAL_UNIX)
ACE_OS::memset (buf, 0, sizeof (ACE_SERVENT_DATA));
+
//FUZZ: disable check_for_lack_ACE_OS
if (::getservbyname_r (svc, proto, result, (struct servent_data *) buf) == 0)
return result;
@@ -643,6 +698,7 @@ ACE_OS::getservbyname_r (const char *svc,
# elif defined (__GLIBC__) || defined (__FreeBSD__)
// GNU C library has a different signature
ACE_OS::memset (buf, 0, sizeof (ACE_SERVENT_DATA));
+
//FUZZ: disable check_for_lack_ACE_OS
if (::getservbyname_r (svc,
proto,
@@ -690,4 +746,5 @@ ACE_OS::getservbyname_r (const char *svc,
//FUZZ: enable check_for_lack_ACE_OS
#endif /* defined (ACE_HAS_REENTRANT_FUNCTIONS) && !defined (UNIXWARE) */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_NS_poll.cpp b/dep/ACE_wrappers/ace/OS_NS_poll.cpp
index d289032ca5e..f31c48e4ac1 100644
--- a/dep/ACE_wrappers/ace/OS_NS_poll.cpp
+++ b/dep/ACE_wrappers/ace/OS_NS_poll.cpp
@@ -1,7 +1,11 @@
// $Id: OS_NS_poll.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_poll.h"
+
ACE_RCSID(ace, OS_NS_poll, "$Id: OS_NS_poll.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if !defined (ACE_HAS_INLINED_OSCALLS)
# include "ace/OS_NS_poll.inl"
#endif /* ACE_HAS_INLINED_OSCALLS */
+
diff --git a/dep/ACE_wrappers/ace/OS_NS_poll.h b/dep/ACE_wrappers/ace/OS_NS_poll.h
index a57dc1c1861..bf20577bc6b 100644
--- a/dep/ACE_wrappers/ace/OS_NS_poll.h
+++ b/dep/ACE_wrappers/ace/OS_NS_poll.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file OS_NS_poll.h
@@ -12,33 +13,47 @@
* Originally in OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_NS_POLL_H
# define ACE_OS_NS_POLL_H
+
# include /**/ "ace/pre.h"
+
# include "ace/config-all.h"
+
# if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
# endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/os_poll.h"
#include /**/ "ace/ACE_export.h"
+
#if defined (ACE_EXPORT_MACRO)
# undef ACE_EXPORT_MACRO
#endif
#define ACE_EXPORT_MACRO ACE_Export
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Time_Value;
+
namespace ACE_OS
{
+
ACE_NAMESPACE_INLINE_FUNCTION
int poll (struct pollfd *pollfds,
unsigned long len,
const ACE_Time_Value *tv = 0);
+
ACE_NAMESPACE_INLINE_FUNCTION
int poll (struct pollfd *pollfds,
unsigned long len,
const ACE_Time_Value &tv);
+
} /* namespace ACE_OS */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# if defined (ACE_HAS_INLINED_OSCALLS)
# if defined (ACE_INLINE)
# undef ACE_INLINE
@@ -46,6 +61,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_INLINE inline
# include "ace/OS_NS_poll.inl"
# endif /* ACE_HAS_INLINED_OSCALLS */
+
# include /**/ "ace/post.h"
#endif /* ACE_OS_NS_POLL_H */
diff --git a/dep/ACE_wrappers/ace/OS_NS_poll.inl b/dep/ACE_wrappers/ace/OS_NS_poll.inl
index f6932853e08..92ce0c41e63 100644
--- a/dep/ACE_wrappers/ace/OS_NS_poll.inl
+++ b/dep/ACE_wrappers/ace/OS_NS_poll.inl
@@ -1,9 +1,12 @@
// -*- C++ -*-
//
// $Id: OS_NS_poll.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Time_Value.h"
#include "ace/OS_NS_errno.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE int
ACE_OS::poll (struct pollfd *pollfds,
unsigned long len,
@@ -17,9 +20,11 @@ ACE_OS::poll (struct pollfd *pollfds,
ACE_UNUSED_ARG (timeout);
ACE_UNUSED_ARG (len);
ACE_UNUSED_ARG (pollfds);
+
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_POLL */
}
+
ACE_INLINE int
ACE_OS::poll (struct pollfd *pollfds,
unsigned long len,
@@ -32,7 +37,9 @@ ACE_OS::poll (struct pollfd *pollfds,
ACE_UNUSED_ARG (timeout);
ACE_UNUSED_ARG (len);
ACE_UNUSED_ARG (pollfds);
+
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_POLL */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_NS_pwd.cpp b/dep/ACE_wrappers/ace/OS_NS_pwd.cpp
index a673577749a..1c8387a16fa 100644
--- a/dep/ACE_wrappers/ace/OS_NS_pwd.cpp
+++ b/dep/ACE_wrappers/ace/OS_NS_pwd.cpp
@@ -1,7 +1,11 @@
// $Id: OS_NS_pwd.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_pwd.h"
+
ACE_RCSID(ace, OS_NS_pwd, "$Id: OS_NS_pwd.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if !defined (ACE_HAS_INLINED_OSCALLS)
# include "ace/OS_NS_pwd.inl"
#endif /* ACE_HAS_INLINED_OSCALLS */
+
diff --git a/dep/ACE_wrappers/ace/OS_NS_pwd.h b/dep/ACE_wrappers/ace/OS_NS_pwd.h
index 40d5ded8150..a70a6d3f3bc 100644
--- a/dep/ACE_wrappers/ace/OS_NS_pwd.h
+++ b/dep/ACE_wrappers/ace/OS_NS_pwd.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file OS_NS_pwd.h
@@ -12,34 +13,49 @@
* Originally in OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_NS_PWD_H
#define ACE_OS_NS_PWD_H
+
# include /**/ "ace/pre.h"
+
# include "ace/config-all.h"
+
# if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
# endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/os_pwd.h"
#include /**/ "ace/ACE_export.h"
+
#if defined (ACE_EXPORT_MACRO)
# undef ACE_EXPORT_MACRO
#endif
#define ACE_EXPORT_MACRO ACE_Export
+
# if defined (ACE_HAS_BROKEN_R_ROUTINES)
# undef getpwnam_r
# endif /* ACE_HAS_BROKEN_R_ROUTINES */
+
struct passwd;
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE_OS
{
+
//@{ @name A set of wrappers for password routines.
+
ACE_NAMESPACE_INLINE_FUNCTION
void endpwent (void);
+
ACE_NAMESPACE_INLINE_FUNCTION
struct passwd *getpwent (void);
+
ACE_NAMESPACE_INLINE_FUNCTION
struct passwd *getpwnam (const char *user);
+
ACE_NAMESPACE_INLINE_FUNCTION
struct passwd *getpwnam_r (const char *name,
struct passwd *pwent,
@@ -48,8 +64,11 @@ namespace ACE_OS
ACE_NAMESPACE_INLINE_FUNCTION
void setpwent (void);
//@}
+
} /* namespace ACE_OS */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# if defined (ACE_HAS_INLINED_OSCALLS)
# if defined (ACE_INLINE)
# undef ACE_INLINE
@@ -57,6 +76,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_INLINE inline
# include "ace/OS_NS_pwd.inl"
# endif /* ACE_HAS_INLINED_OSCALLS */
+
# include /**/ "ace/post.h"
#endif /* ACE_OS_NS_PWD_H */
diff --git a/dep/ACE_wrappers/ace/OS_NS_pwd.inl b/dep/ACE_wrappers/ace/OS_NS_pwd.inl
index 52cf9840765..cb13fe8f292 100644
--- a/dep/ACE_wrappers/ace/OS_NS_pwd.inl
+++ b/dep/ACE_wrappers/ace/OS_NS_pwd.inl
@@ -1,9 +1,13 @@
// -*- C++ -*-
//
// $Id: OS_NS_pwd.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_errno.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Accessors to PWD file.
+
ACE_INLINE void
ACE_OS::endpwent (void)
{
@@ -11,6 +15,7 @@ ACE_OS::endpwent (void)
::endpwent ();
#endif /* ! ACE_LACKS_PWD_FUNCTIONS */
}
+
ACE_INLINE struct passwd *
ACE_OS::getpwent (void)
{
@@ -20,6 +25,7 @@ ACE_OS::getpwent (void)
ACE_NOTSUP_RETURN (0);
#endif /* ! ACE_LACKS_PWD_FUNCTIONS */
}
+
ACE_INLINE struct passwd *
ACE_OS::getpwnam (const char *name)
{
@@ -30,13 +36,16 @@ ACE_OS::getpwnam (const char *name)
ACE_NOTSUP_RETURN (0);
#endif /* ACE_LACKS_PWD_FUNCTIONS */
}
+
ACE_INLINE struct passwd *
ACE_OS::getpwnam_r (const char *name, struct passwd *pwent,
char *buffer, int buflen)
{
#if defined (ACE_HAS_POSIX_GETPWNAM_R)
struct passwd *result = 0;
+
int const status = ::getpwnam_r (name, pwent, buffer, buflen, &result);
+
if (status != 0)
{
errno = status;
@@ -99,6 +108,7 @@ ACE_OS::getpwnam_r (const char *name, struct passwd *pwent,
ACE_NOTSUP_RETURN (0);
#endif /* ACE_HAS_POSIX_GETPWNAM_R */
}
+
ACE_INLINE void
ACE_OS::setpwent (void)
{
@@ -106,4 +116,5 @@ ACE_OS::setpwent (void)
::setpwent ();
#endif /* ! ACE_LACKS_PWD_FUNCTIONS */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_NS_regex.cpp b/dep/ACE_wrappers/ace/OS_NS_regex.cpp
index e326acf0099..df532281eac 100644
--- a/dep/ACE_wrappers/ace/OS_NS_regex.cpp
+++ b/dep/ACE_wrappers/ace/OS_NS_regex.cpp
@@ -1,7 +1,11 @@
// $Id: OS_NS_regex.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_regex.h"
+
ACE_RCSID(ace, OS_NS_regex, "$Id: OS_NS_regex.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if !defined (ACE_HAS_INLINED_OSCALLS)
# include "ace/OS_NS_regex.inl"
#endif /* ACE_HAS_INLINED_OSCALLS */
+
diff --git a/dep/ACE_wrappers/ace/OS_NS_regex.h b/dep/ACE_wrappers/ace/OS_NS_regex.h
index 0c1360c18d1..8684d087d5d 100644
--- a/dep/ACE_wrappers/ace/OS_NS_regex.h
+++ b/dep/ACE_wrappers/ace/OS_NS_regex.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file OS_NS_regex.h
@@ -12,33 +13,46 @@
* Originally in OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_NS_REGEX_H
# define ACE_OS_NS_REGEX_H
+
# include /**/ "ace/pre.h"
+
# include "ace/config-all.h"
+
# if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
# endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include /**/ "ace/ACE_export.h"
+
#if defined (ACE_EXPORT_MACRO)
# undef ACE_EXPORT_MACRO
#endif
#define ACE_EXPORT_MACRO ACE_Export
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE_OS
{
+
// non=standard..
//@{ @name A set of wrappers for regular expressions.
ACE_NAMESPACE_INLINE_FUNCTION
char *compile (const char *instring,
char *expbuf,
char *endbuf);
+
ACE_NAMESPACE_INLINE_FUNCTION
int step (const char *str,
char *expbuf);
//@}
+
} /* namespace ACE_OS */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# if defined (ACE_HAS_INLINED_OSCALLS)
# if defined (ACE_INLINE)
# undef ACE_INLINE
@@ -46,6 +60,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_INLINE inline
# include "ace/OS_NS_regex.inl"
# endif /* ACE_HAS_INLINED_OSCALLS */
+
# include /**/ "ace/post.h"
#endif /* ACE_OS_NS_REGEX_H */
diff --git a/dep/ACE_wrappers/ace/OS_NS_regex.inl b/dep/ACE_wrappers/ace/OS_NS_regex.inl
index b7e191ec301..3f5a0aa932f 100644
--- a/dep/ACE_wrappers/ace/OS_NS_regex.inl
+++ b/dep/ACE_wrappers/ace/OS_NS_regex.inl
@@ -1,9 +1,12 @@
// -*- C++ -*-
//
// $Id: OS_NS_regex.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_errno.h"
#include "ace/os_include/os_regex.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE char *
ACE_OS::compile (const char *instring, char *expbuf, char *endbuf)
{
@@ -14,9 +17,11 @@ ACE_OS::compile (const char *instring, char *expbuf, char *endbuf)
ACE_UNUSED_ARG (instring);
ACE_UNUSED_ARG (expbuf);
ACE_UNUSED_ARG (endbuf);
+
ACE_NOTSUP_RETURN (0);
#endif /* ACE_HAS_REGEX */
}
+
ACE_INLINE int
ACE_OS::step (const char *str, char *expbuf)
{
@@ -26,7 +31,9 @@ ACE_OS::step (const char *str, char *expbuf)
#else
ACE_UNUSED_ARG (str);
ACE_UNUSED_ARG (expbuf);
+
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_REGEX */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_NS_signal.cpp b/dep/ACE_wrappers/ace/OS_NS_signal.cpp
index 51cdcaaf633..e0b3b612676 100644
--- a/dep/ACE_wrappers/ace/OS_NS_signal.cpp
+++ b/dep/ACE_wrappers/ace/OS_NS_signal.cpp
@@ -1,21 +1,27 @@
// $Id: OS_NS_signal.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_signal.h"
+
ACE_RCSID(ace, OS_NS_signal, "$Id: OS_NS_signal.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if !defined (ACE_HAS_INLINED_OSCALLS)
# include "ace/OS_NS_signal.inl"
#endif /* ACE_HAS_INLINED_OSCALLS */
+
#if !defined (ACE_HAS_SIGINFO_T)
siginfo_t::siginfo_t (ACE_HANDLE handle)
: si_handle_ (handle),
si_handles_ (&handle)
{
}
+
siginfo_t::siginfo_t (ACE_HANDLE *handles)
: si_handle_ (handles[0]),
si_handles_ (handles)
{
}
#endif /* ACE_HAS_SIGINFO_T */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_NS_signal.h b/dep/ACE_wrappers/ace/OS_NS_signal.h
index 14b6e6fcdfa..d9abed0a666 100644
--- a/dep/ACE_wrappers/ace/OS_NS_signal.h
+++ b/dep/ACE_wrappers/ace/OS_NS_signal.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file OS_NS_signal.h
@@ -12,47 +13,63 @@
* Originally in OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_NS_SIGNAL_H
# define ACE_OS_NS_SIGNAL_H
+
# include /**/ "ace/pre.h"
+
# include "ace/config-lite.h"
+
# if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
# endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/os_signal.h"
#include /**/ "ace/ACE_export.h"
+
#if defined (ACE_EXPORT_MACRO)
# undef ACE_EXPORT_MACRO
#endif
#define ACE_EXPORT_MACRO ACE_Export
+
# if !defined (SIG_BLOCK)
# define SIG_BLOCK 1
# endif /* SIG_BLOCK */
+
# if !defined (SIG_UNBLOCK)
# define SIG_UNBLOCK 2
# endif /* SIG_UNBLOCK */
+
# if !defined (SIG_SETMASK)
# define SIG_SETMASK 3
# endif /* SIG_SETMASK */
+
// Create some useful typedefs.
+
# if !defined (ACE_HAS_SIGINFO_T)
struct ACE_Export siginfo_t
{
siginfo_t (ACE_HANDLE handle);
siginfo_t (ACE_HANDLE *handles); // JCEJ 12/23/96
+
/// Win32 HANDLE that has become signaled.
ACE_HANDLE si_handle_;
+
/// Array of Win32 HANDLEs all of which have become signaled.
ACE_HANDLE *si_handles_;
};
# endif /* ACE_HAS_SIGINFO_T */
+
#if !defined (ACE_WIN32)
extern "C"
{
typedef void (*ACE_SIGNAL_C_FUNC)(int, siginfo_t *, void *);
}
#endif /* ACE_WIN32 */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// This hack is needed to get around an odd and hard-to-reproduce problem
// with HP aC++. If struct sigaction is defined extern "C" and the sigaction
// function in namespace ACE_OS, the compiler sometimes gets confused.
@@ -69,44 +86,61 @@ typedef extern "C" struct sigaction ACE_SIGACTION;
#else
typedef struct sigaction ACE_SIGACTION;
#endif
+
namespace ACE_OS {
+
//@{ @name A set of wrappers for Signals.
+
ACE_NAMESPACE_INLINE_FUNCTION
int kill (pid_t pid,
int signum);
+
ACE_NAMESPACE_INLINE_FUNCTION
int pthread_sigmask (int how,
const sigset_t *nsp,
sigset_t *osp);
+
ACE_NAMESPACE_INLINE_FUNCTION
int sigaction (int signum,
const ACE_SIGACTION *nsa,
ACE_SIGACTION *osa);
+
ACE_NAMESPACE_INLINE_FUNCTION
int sigaddset (sigset_t *s,
int signum);
+
ACE_NAMESPACE_INLINE_FUNCTION
int sigdelset (sigset_t *s,
int signum);
+
ACE_NAMESPACE_INLINE_FUNCTION
int sigemptyset (sigset_t *s);
+
ACE_NAMESPACE_INLINE_FUNCTION
int sigfillset (sigset_t *s);
+
ACE_NAMESPACE_INLINE_FUNCTION
int sigismember (sigset_t *s,
int signum);
+
ACE_NAMESPACE_INLINE_FUNCTION
ACE_SignalHandler signal (int signum,
ACE_SignalHandler);
+
ACE_NAMESPACE_INLINE_FUNCTION
int sigprocmask (int how,
const sigset_t *nsp,
sigset_t *osp);
+
ACE_NAMESPACE_INLINE_FUNCTION
int sigsuspend (const sigset_t *set);
+
//@}
+
} /* namespace ACE_OS */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# if defined (ACE_HAS_INLINED_OSCALLS)
# if defined (ACE_INLINE)
# undef ACE_INLINE
@@ -114,6 +148,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_INLINE inline
# include "ace/OS_NS_signal.inl"
# endif /* ACE_HAS_INLINED_OSCALLS */
+
# include /**/ "ace/post.h"
#endif /* ACE_OS_NS_SIGNAL_H */
diff --git a/dep/ACE_wrappers/ace/OS_NS_signal.inl b/dep/ACE_wrappers/ace/OS_NS_signal.inl
index d0551af1b37..5fae8f0e7fa 100644
--- a/dep/ACE_wrappers/ace/OS_NS_signal.inl
+++ b/dep/ACE_wrappers/ace/OS_NS_signal.inl
@@ -1,15 +1,19 @@
// -*- C++ -*-
//
// $Id: OS_NS_signal.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_macros.h"
#include "ace/OS_NS_errno.h"
#ifndef WIN32
#include <pthread.h>
#include <signal.h>
#endif
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE_OS
{
+
ACE_INLINE int
kill (pid_t pid, int signum)
{
@@ -22,6 +26,7 @@ kill (pid_t pid, int signum)
ACE_OSCALL_RETURN (::kill (pid, signum), int, -1);
#endif /* ACE_LACKS_KILL */
}
+
ACE_INLINE int
pthread_sigmask (int how, const sigset_t *nsp, sigset_t *osp)
{
@@ -38,6 +43,7 @@ pthread_sigmask (int how, const sigset_t *nsp, sigset_t *osp)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_PTHREADS && !ACE_LACKS_PTHREAD_SIGMASK */
}
+
ACE_INLINE int
sigaction (int signum, const ACE_SIGACTION *nsa, ACE_SIGACTION *osa)
{
@@ -46,8 +52,10 @@ sigaction (int signum, const ACE_SIGACTION *nsa, ACE_SIGACTION *osa)
return 0;
#if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)
struct sigaction sa;
+
if (osa == 0)
osa = &sa;
+
if (nsa == 0)
{
osa->sa_handler = ::signal (signum, SIG_IGN);
@@ -69,6 +77,7 @@ sigaction (int signum, const ACE_SIGACTION *nsa, ACE_SIGACTION *osa)
ACE_OSCALL_RETURN (::sigaction (signum, nsa, osa), int, -1);
#endif /* ACE_WIN32 !ACE_HAS_WINCE */
}
+
ACE_INLINE int
sigaddset (sigset_t *s, int signum)
{
@@ -90,6 +99,7 @@ sigaddset (sigset_t *s, int signum)
ACE_OSCALL_RETURN (::sigaddset (s, signum), int, -1);
#endif /* ACE_LACKS_SIGSET || ACE_LACKS_SIGSET_DEFINITIONS */
}
+
ACE_INLINE int
sigdelset (sigset_t *s, int signum)
{
@@ -110,6 +120,7 @@ sigdelset (sigset_t *s, int signum)
ACE_OSCALL_RETURN (::sigdelset (s, signum), int, -1);
#endif /* ACE_LACKS_SIGSET || ACE_LACKS_SIGSET_DEFINITIONS */
}
+
ACE_INLINE int
sigemptyset (sigset_t *s)
{
@@ -125,6 +136,7 @@ sigemptyset (sigset_t *s)
ACE_OSCALL_RETURN (::sigemptyset (s), int, -1);
#endif /* ACE_LACKS_SIGSET || ACE_LACKS_SIGSET_DEFINITIONS */
}
+
ACE_INLINE int
sigfillset (sigset_t *s)
{
@@ -140,6 +152,7 @@ sigfillset (sigset_t *s)
ACE_OSCALL_RETURN (::sigfillset (s), int, -1);
#endif /* ACE_LACKS_SIGSET || ACE_LACKS_SIGSET_DEFINITIONS */
}
+
ACE_INLINE int
sigismember (sigset_t *s, int signum)
{
@@ -166,6 +179,7 @@ sigismember (sigset_t *s, int signum)
ACE_OSCALL_RETURN (::sigismember (s, signum), int, -1);
#endif /* ACE_LACKS_SIGSET || ACE_LACKS_SIGSET_DEFINITIONS */
}
+
ACE_INLINE ACE_SignalHandler
signal (int signum, ACE_SignalHandler func)
{
@@ -185,6 +199,7 @@ signal (int signum, ACE_SignalHandler func)
ACE_NOTSUP_RETURN (0); // Should return SIG_ERR but it is not defined on WinCE.
#endif /* defined (ACE_WIN32) && !defined (ACE_HAS_WINCE) || !defined (ACE_LACKS_UNIX_SIGNALS) */
}
+
ACE_INLINE int
sigprocmask (int how, const sigset_t *nsp, sigset_t *osp)
{
@@ -197,11 +212,13 @@ sigprocmask (int how, const sigset_t *nsp, sigset_t *osp)
ACE_OSCALL_RETURN (::sigprocmask (how, nsp, osp), int, -1);
#endif /* ACE_LACKS_SIGSET || ACE_LACKS_SIGSET_DEFINITIONS */
}
+
ACE_INLINE int
sigsuspend (const sigset_t *sigset)
{
#if defined (ACE_HAS_SIGSUSPEND)
sigset_t s;
+
if (sigset == 0)
{
sigset = &s;
@@ -213,5 +230,7 @@ sigsuspend (const sigset_t *sigset)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_SIGSUSPEND */
}
+
} /* end namespace ACE_OS */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_NS_stdio.cpp b/dep/ACE_wrappers/ace/OS_NS_stdio.cpp
index bfed4f46011..01ceec72279 100644
--- a/dep/ACE_wrappers/ace/OS_NS_stdio.cpp
+++ b/dep/ACE_wrappers/ace/OS_NS_stdio.cpp
@@ -1,18 +1,24 @@
// $Id: OS_NS_stdio.cpp 82586 2008-08-11 12:46:00Z johnnyw $
+
#include "ace/OS_NS_stdio.h"
#include "ace/OS_NS_Thread.h"
+
ACE_RCSID (ace,
OS_NS_stdio,
"$Id: OS_NS_stdio.cpp 82586 2008-08-11 12:46:00Z johnnyw $")
+
#if !defined (ACE_HAS_INLINED_OSCALLS)
# include "ace/OS_NS_stdio.inl"
#endif /* ACE_HAS_INLINED_OSCALLS */
+
# if defined (ACE_WIN32)
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_TEXT_OSVERSIONINFO ACE_OS::win32_versioninfo_;
HINSTANCE ACE_OS::win32_resource_module_;
ACE_END_VERSIONED_NAMESPACE_DECL
+
# if defined (ACE_HAS_DLL) && (ACE_HAS_DLL == 1) && !defined (ACE_HAS_WINCE)
// This function is called by the OS when the ACE DLL is loaded. We
// use it to determine the default module containing ACE's resources.
@@ -33,12 +39,15 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID)
}
# endif /* ACE_HAS_DLL && ACE_HAS_DLL == 1 */
# endif /* ACE_WIN32 */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
void
ACE_OS::ace_flock_t::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_OS_TRACE ("ACE_OS::ace_flock_t::dump");
+
# if 0
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("handle_ = %u"), this->handle_));
@@ -62,7 +71,9 @@ ACE_OS::ace_flock_t::dump (void) const
# endif /* 0 */
#endif /* ACE_HAS_DUMP */
}
+
/*****************************************************************************/
+
#if defined (ACE_USES_WCHAR)
void ACE_OS::checkUnicodeFormat (FILE* fp)
{
@@ -75,10 +86,12 @@ void ACE_OS::checkUnicodeFormat (FILE* fp)
// and be written without any error since given buffers are all in 'char'
// type instead of ACE_TCHAR. Therefore, it is user's reponsibility to
// select correct buffer type.
+
// At this point, check if the file is Unicode or not.
ACE_UINT16 first_two_bytes;
size_t numRead =
ACE_OS::fread(&first_two_bytes, sizeof (first_two_bytes), 1, fp);
+
if (numRead == 1)
{
if ((first_two_bytes != 0xFFFE) && // not a small endian Unicode file
@@ -97,6 +110,7 @@ void ACE_OS::checkUnicodeFormat (FILE* fp)
}
}
#endif // ACE_USES_WCHAR
+
#if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)
namespace
{
@@ -145,25 +159,31 @@ namespace
}
}
} // Close anonymous namespace
+
FILE *
ACE_OS::fopen (const char *filename,
const ACE_TCHAR *mode)
{
ACE_OS_TRACE ("ACE_OS::fopen");
int hmode = _O_TEXT;
+
// Let the chips fall where they may if the user passes in a NULL
// mode string. Convert to an empty mode string to prevent a
// crash.
ACE_TCHAR const empty_mode[] = ACE_TEXT ("");
if (!mode)
mode = empty_mode;
+
for (ACE_TCHAR const* mode_ptr = mode; *mode_ptr != 0; ++mode_ptr)
fopen_mode_to_open_mode_converter (*mode_ptr, hmode);
+
ACE_HANDLE const handle = ACE_OS::open (filename, hmode);
if (handle != ACE_INVALID_HANDLE)
{
hmode &= _O_TEXT | _O_RDONLY | _O_APPEND;
+
int const fd = ::_open_osfhandle (intptr_t (handle), hmode);
+
if (fd != -1)
{
# if defined (ACE_HAS_NONCONST_FDOPEN) && !defined (ACE_USES_WCHAR)
@@ -184,10 +204,12 @@ ACE_OS::fopen (const char *filename,
}
::_close (fd);
}
+
ACE_OS::close (handle);
}
return 0;
}
+
#if defined (ACE_HAS_WCHAR)
FILE *
ACE_OS::fopen (const char *filename,
@@ -195,25 +217,31 @@ ACE_OS::fopen (const char *filename,
{
return ACE_OS::fopen (filename, ACE_TEXT_ANTI_TO_TCHAR (mode));
}
+
FILE *
ACE_OS::fopen (const wchar_t *filename,
const ACE_ANTI_TCHAR *mode)
{
return ACE_OS::fopen (filename, ACE_TEXT_ANTI_TO_TCHAR (mode));
}
+
FILE *
ACE_OS::fopen (const wchar_t *filename,
const ACE_TCHAR *mode)
{
ACE_OS_TRACE ("ACE_OS::fopen");
int hmode = _O_TEXT;
+
for (const ACE_TCHAR *mode_ptr = mode; *mode_ptr != 0; mode_ptr++)
fopen_mode_to_open_mode_converter (*mode_ptr, hmode);
+
ACE_HANDLE handle = ACE_OS::open (filename, hmode);
if (handle != ACE_INVALID_HANDLE)
{
hmode &= _O_TEXT | _O_RDONLY | _O_APPEND;
+
int const fd = ::_open_osfhandle (intptr_t (handle), hmode);
+
if (fd != -1)
{
# if defined (ACE_HAS_NONCONST_FDOPEN) && !defined (ACE_USES_WCHAR)
@@ -234,14 +262,18 @@ ACE_OS::fopen (const wchar_t *filename,
}
::_close (fd);
}
+
ACE_OS::close (handle);
}
return 0;
}
#endif /* ACE_HAS_WCHAR */
+
#endif /* ACE_WIN32 */
+
// The following *printf functions aren't inline because
// they use varargs.
+
int
ACE_OS::fprintf (FILE *fp, const char *format, ...)
{
@@ -253,6 +285,7 @@ ACE_OS::fprintf (FILE *fp, const char *format, ...)
va_end (ap);
return result;
}
+
#if defined (ACE_HAS_WCHAR)
int
ACE_OS::fprintf (FILE *fp, const wchar_t *format, ...)
@@ -266,6 +299,7 @@ ACE_OS::fprintf (FILE *fp, const wchar_t *format, ...)
return result;
}
#endif /* ACE_HAS_WCHAR */
+
int
ACE_OS::asprintf (char **bufp, const char *format, ...)
{
@@ -277,6 +311,7 @@ ACE_OS::asprintf (char **bufp, const char *format, ...)
va_end (ap);
return result;
}
+
#if defined (ACE_HAS_WCHAR)
int
ACE_OS::asprintf (wchar_t **bufp, const wchar_t *format, ...)
@@ -290,6 +325,7 @@ ACE_OS::asprintf (wchar_t **bufp, const wchar_t *format, ...)
return result;
}
#endif /* ACE_HAS_WCHAR */
+
int
ACE_OS::printf (const char *format, ...)
{
@@ -301,6 +337,7 @@ ACE_OS::printf (const char *format, ...)
va_end (ap);
return result;
}
+
#if defined (ACE_HAS_WCHAR)
int
ACE_OS::printf (const wchar_t *format, ...)
@@ -314,6 +351,7 @@ ACE_OS::printf (const wchar_t *format, ...)
return result;
}
#endif /* ACE_HAS_WCHAR */
+
int
ACE_OS::snprintf (char *buf, size_t maxlen, const char *format, ...)
{
@@ -324,6 +362,7 @@ ACE_OS::snprintf (char *buf, size_t maxlen, const char *format, ...)
va_end (ap);
return result;
}
+
#if defined (ACE_HAS_WCHAR)
int
ACE_OS::snprintf (wchar_t *buf, size_t maxlen, const wchar_t *format, ...)
@@ -336,6 +375,7 @@ ACE_OS::snprintf (wchar_t *buf, size_t maxlen, const wchar_t *format, ...)
return result;
}
#endif /* ACE_HAS_WCHAR */
+
int
ACE_OS::sprintf (char *buf, const char *format, ...)
{
@@ -346,6 +386,7 @@ ACE_OS::sprintf (char *buf, const char *format, ...)
va_end (ap);
return result;
}
+
#if defined (ACE_HAS_WCHAR)
int
ACE_OS::sprintf (wchar_t *buf, const wchar_t *format, ...)
@@ -358,6 +399,7 @@ ACE_OS::sprintf (wchar_t *buf, const wchar_t *format, ...)
return result;
}
#endif /* ACE_HAS_WCHAR */
+
#if !defined (ACE_HAS_VASPRINTF)
int
ACE_OS::vasprintf_emulation(char **bufp, const char *format, va_list argptr)
@@ -366,21 +408,26 @@ ACE_OS::vasprintf_emulation(char **bufp, const char *format, va_list argptr)
va_copy (ap, argptr);
int size = ACE_OS::vsnprintf(0, 0, format, ap);
va_end (ap);
+
if (size != -1)
{
char *buf = reinterpret_cast<char*>(ACE_OS::malloc(size + 1));
if (!buf)
return -1;
+
va_list aq;
va_copy (aq, argptr);
size = ACE_OS::vsnprintf(buf, size + 1, format, aq);
va_end (aq);
+
if (size != -1)
*bufp = buf;
}
+
return size;
}
#endif /* !ACE_HAS_VASPRINTF */
+
#if defined (ACE_HAS_WCHAR)
#if !defined (ACE_HAS_VASWPRINTF)
int
@@ -390,22 +437,27 @@ ACE_OS::vaswprintf_emulation(wchar_t **bufp, const wchar_t *format, va_list argp
va_copy (ap, argptr);
int size = ACE_OS::vsnprintf(0, 0, format, ap);
va_end (ap);
+
if (size != -1)
{
wchar_t *buf = reinterpret_cast<wchar_t*>
(ACE_OS::malloc((size + 1) * sizeof(wchar_t)));
if (!buf)
return -1;
+
va_list aq;
va_copy (aq, argptr);
size = ACE_OS::vsnprintf(buf, size + 1, format, aq);
va_end (aq);
+
if (size != -1)
*bufp = buf;
}
+
return size;
}
#endif /* !ACE_HAS_VASWPRINTF */
#endif /* ACE_HAS_WCHAR */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_NS_stdio.h b/dep/ACE_wrappers/ace/OS_NS_stdio.h
index 06e90e5aa71..a27d90822c9 100644
--- a/dep/ACE_wrappers/ace/OS_NS_stdio.h
+++ b/dep/ACE_wrappers/ace/OS_NS_stdio.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file OS_NS_stdio.h
@@ -12,24 +13,32 @@
* Originally in OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_NS_STDIO_H
# define ACE_OS_NS_STDIO_H
+
# include /**/ "ace/pre.h"
+
# include "ace/config-all.h"
+
# if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
# endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/os_stdio.h"
#include "ace/os_include/os_fcntl.h"
#include /**/ "ace/ACE_export.h"
+
/* OPENVMS needs unistd for cuserid() */
#if defined (CYGWIN32) || defined (ACE_OPENVMS)
# include "ace/os_include/os_unistd.h"
#endif /* CYGWIN32 || ACE_OPENVMS */
+
#if defined (ACE_EXPORT_MACRO)
# undef ACE_EXPORT_MACRO
#endif
#define ACE_EXPORT_MACRO ACE_Export
+
/*
* We inline and undef some functions that may be implemented
* as macros on some platforms. This way macro definitions will
@@ -48,6 +57,7 @@ inline void ace_clearerr_helper (FILE *stream)
# endif /* defined (clearerr) */
}
#endif /* !ACE_LACKS_CLEARERR */
+
inline int ace_fgetc_helper (FILE *fp)
{
#if defined (fgetc)
@@ -57,6 +67,7 @@ inline int ace_fgetc_helper (FILE *fp)
return ACE_STD_NAMESPACE::fgetc (fp);
#endif /* defined (fgetc) */
}
+
inline int ace_fputc_helper (int ch, FILE *fp)
{
#if defined (fputc)
@@ -66,6 +77,7 @@ inline int ace_fputc_helper (int ch, FILE *fp)
return ACE_STD_NAMESPACE::fputc (ch, fp);
#endif /* defined (fputc) */
}
+
inline int ace_getc_helper (FILE *fp)
{
#if defined (getc)
@@ -75,6 +87,7 @@ inline int ace_getc_helper (FILE *fp)
return ACE_STD_NAMESPACE::getc (fp);
#endif /* defined (getc) */
}
+
inline int ace_putc_helper (int ch, FILE *fp)
{
#if defined (putc)
@@ -84,6 +97,7 @@ inline int ace_putc_helper (int ch, FILE *fp)
return ACE_STD_NAMESPACE::putc (ch, fp);
#endif /* defined (putc) */
}
+
inline int ace_ungetc_helper (int ch, FILE *fp)
{
#if defined (ungetc)
@@ -94,6 +108,7 @@ inline int ace_ungetc_helper (int ch, FILE *fp)
#endif /* defined (ungetc) */
}
+
#if !defined (ACE_LACKS_CUSERID) && !defined(ACE_HAS_ALT_CUSERID) \
&& !defined(ACE_WIN32) && !defined (ACE_VXWORKS)
/// Helper for the ACE_OS::cuserid() function
@@ -115,6 +130,7 @@ inline char *ace_cuserid(char *user)
return cuserid(user);
}
#endif /* !ACE_LACKS_CUSERID && !ACE_HAS_ALT_CUSERID && ... */
+
# if defined (ACE_LACKS_FILELOCKS)
# if ! defined (ACE_VXWORKS) && ! defined (ACE_HAS_RTEMS) && !defined (INTEGRITY)
// VxWorks defines struct flock in sys/fcntlcom.h. But it doesn't
@@ -132,8 +148,11 @@ struct flock
};
# endif /* ! VXWORKS */
# endif /* ACE_LACKS_FILELOCKS */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE_OS {
+
/**
* @class ace_flock_t
*
@@ -144,35 +163,43 @@ namespace ACE_OS {
public:
/// Dump state of the object.
void dump (void) const;
+
# if defined (ACE_WIN32)
ACE_OVERLAPPED overlapped_;
# else
struct flock lock_;
# endif /* ACE_WIN32 */
+
/// Name of this filelock.
const ACE_TCHAR *lockname_;
+
/// Handle to the underlying file.
ACE_HANDLE handle_;
};
+
# if defined (ACE_USES_WCHAR)
// If fp points to the Unicode format file, the file pointer will be moved right next
// to the Unicode header (2 types). Otherwise, file pointer will be at the beginning.
extern ACE_Export
void checkUnicodeFormat (FILE* fp);
# endif // ACE_USES_WCHAR
+
# if !defined (ACE_LACKS_CLEARERR)
ACE_NAMESPACE_INLINE_FUNCTION
void clearerr (FILE* fp);
# endif /* !ACE_LACKS_CLEARERR */
+
//@{ @name Wrappers to obtain the current user id
// Legacy as per SUSV3
# if !defined (ACE_LACKS_CUSERID)
# if defined(cuserid)
# undef cuserid
# endif /* cuserid */
+
ACE_NAMESPACE_INLINE_FUNCTION
char *cuserid (char *user,
size_t maxlen = ACE_MAX_USERID);
+
# if defined (ACE_HAS_WCHAR)
ACE_NAMESPACE_INLINE_FUNCTION
wchar_t *cuserid (wchar_t *user,
@@ -180,34 +207,47 @@ namespace ACE_OS {
# endif /* ACE_HAS_WCHAR */
# endif /* ACE_LACKS_CUSERID */
//@}
+
extern ACE_Export
int asprintf (char **bufp, const char* format, ...);
+
# if defined (ACE_HAS_WCHAR)
extern ACE_Export
int asprintf (wchar_t **bufp, const wchar_t* format, ...);
#endif /* ACE_HAS_WCHAR */
+
ACE_NAMESPACE_INLINE_FUNCTION
int fclose (FILE *fp);
+
# if defined (fdopen)
# undef fdopen
# endif /* fdopen */
+
ACE_NAMESPACE_INLINE_FUNCTION
FILE *fdopen (ACE_HANDLE handle, const ACE_TCHAR *mode);
+
ACE_NAMESPACE_INLINE_FUNCTION
int fflush (FILE *fp);
+
ACE_NAMESPACE_INLINE_FUNCTION
int fgetc (FILE* fp);
+
ACE_NAMESPACE_INLINE_FUNCTION
int getc (FILE* fp);
+
ACE_NAMESPACE_INLINE_FUNCTION
int fgetpos (FILE* fp, fpos_t* pos);
+
ACE_NAMESPACE_INLINE_FUNCTION
char *fgets (char *buf, int size, FILE *fp);
+
# if defined (ACE_HAS_WCHAR) && !defined(ACE_LACKS_FGETWS)
ACE_NAMESPACE_INLINE_FUNCTION
wchar_t *fgets (wchar_t *buf, int size, FILE *fp);
# endif /* ACE_HAS_WCHAR && !ACE_LACKS_FGETWS */
+
//@{ @name A set of wrappers for file locks.
+
# if defined (ACE_WIN32)
ACE_NAMESPACE_INLINE_FUNCTION
void flock_adjust_params (ace_flock_t *lock,
@@ -215,46 +255,56 @@ namespace ACE_OS {
ACE_OFF_T &start,
ACE_OFF_T &len);
# endif /* ACE_WIN32 */
+
ACE_NAMESPACE_INLINE_FUNCTION
int flock_init (ace_flock_t *lock,
int flags = 0,
const ACE_TCHAR *name = 0,
mode_t perms = 0);
+
ACE_NAMESPACE_INLINE_FUNCTION
int flock_destroy (ace_flock_t *lock,
int unlink_file = 1);
+
ACE_NAMESPACE_INLINE_FUNCTION
int flock_rdlock (ace_flock_t *lock,
short whence = 0,
ACE_OFF_T start = 0,
ACE_OFF_T len = 0);
+
ACE_NAMESPACE_INLINE_FUNCTION
int flock_tryrdlock (ace_flock_t *lock,
short whence = 0,
ACE_OFF_T start = 0,
ACE_OFF_T len = 0);
+
ACE_NAMESPACE_INLINE_FUNCTION
int flock_trywrlock (ace_flock_t *lock,
short whence = 0,
ACE_OFF_T start = 0,
ACE_OFF_T len = 0);
+
ACE_NAMESPACE_INLINE_FUNCTION
int flock_unlock (ace_flock_t *lock,
short whence = 0,
ACE_OFF_T start = 0,
ACE_OFF_T len = 0);
+
ACE_NAMESPACE_INLINE_FUNCTION
int flock_wrlock (ace_flock_t *lock,
short whence = 0,
ACE_OFF_T start = 0,
ACE_OFF_T len = 0);
+
//@}
+
#if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)
extern ACE_Export
#else
ACE_NAMESPACE_INLINE_FUNCTION
#endif /* ACE_WIN32 */
FILE *fopen (const char *filename, const char *mode);
+
#if defined (ACE_HAS_WCHAR)
#if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)
extern ACE_Export
@@ -275,6 +325,7 @@ namespace ACE_OS {
# endif /* ACE_WIN32 */
FILE *fopen (const wchar_t *filename, const char *mode);
#endif /* ACE_HAS_WCHAR */
+
#if defined (ACE_WIN32)
/// Default Win32 Security Attributes definition.
ACE_NAMESPACE_INLINE_FUNCTION
@@ -283,153 +334,202 @@ namespace ACE_OS {
LPSECURITY_ATTRIBUTES default_win32_security_attributes_r (LPSECURITY_ATTRIBUTES,
LPSECURITY_ATTRIBUTES,
SECURITY_DESCRIPTOR*);
+
// = Win32 OS version determination function.
/// Return the win32 OSVERSIONINFO structure.
ACE_NAMESPACE_INLINE_FUNCTION
const ACE_TEXT_OSVERSIONINFO &get_win32_versioninfo (void);
+
// = A pair of functions for modifying ACE's Win32 resource usage.
/// Return the handle of the module containing ACE's resources. By
/// default, for a DLL build of ACE this is a handle to the ACE DLL
/// itself, and for a static build it is a handle to the executable.
ACE_NAMESPACE_INLINE_FUNCTION
HINSTANCE get_win32_resource_module (void);
+
/// Allow an application to modify which module contains ACE's
/// resources. This is mainly useful for a static build of ACE where
/// the required resources reside somewhere other than the executable.
ACE_NAMESPACE_INLINE_FUNCTION
void set_win32_resource_module (HINSTANCE);
+
extern ACE_Export ACE_TEXT_OSVERSIONINFO win32_versioninfo_;
+
extern ACE_Export HINSTANCE win32_resource_module_;
+
#endif /* ACE_WIN32 */
+
extern ACE_Export
int fprintf (FILE *fp, const char *format, ...);
+
# if defined (ACE_HAS_WCHAR)
extern ACE_Export
int fprintf (FILE *fp, const wchar_t *format, ...);
# endif /* ACE_HAS_WCHAR */
+
ACE_NAMESPACE_INLINE_FUNCTION
int ungetc (int c,
FILE *fp);
+
ACE_NAMESPACE_INLINE_FUNCTION
int fputc (int c,
FILE *fp);
+
ACE_NAMESPACE_INLINE_FUNCTION
int putc (int c,
FILE *fp);
+
ACE_NAMESPACE_INLINE_FUNCTION
int fputs (const char *s,
FILE *stream);
+
# if defined (ACE_HAS_WCHAR) && !defined(ACE_LACKS_FPUTWS)
ACE_NAMESPACE_INLINE_FUNCTION
int fputs (const wchar_t *s,
FILE *stream);
# endif /* ACE_HAS_WCHAR && !ACE_LACKS_FPUTWS */
+
ACE_NAMESPACE_INLINE_FUNCTION
size_t fread (void *ptr,
size_t size,
size_t nelems,
FILE *fp);
+
ACE_NAMESPACE_INLINE_FUNCTION
FILE *freopen (const ACE_TCHAR *filename,
const ACE_TCHAR *mode,
FILE* stream);
+
ACE_NAMESPACE_INLINE_FUNCTION
int fseek (FILE *fp,
long offset,
int ptrname);
+
ACE_NAMESPACE_INLINE_FUNCTION
int fsetpos (FILE* fp, fpos_t* pos);
+
ACE_NAMESPACE_INLINE_FUNCTION
long ftell (FILE* fp);
+
ACE_NAMESPACE_INLINE_FUNCTION
size_t fwrite (const void *ptr,
size_t size,
size_t nitems,
FILE *fp);
+
ACE_NAMESPACE_INLINE_FUNCTION
void perror (const char *s);
+
#if defined (ACE_HAS_WCHAR)
ACE_NAMESPACE_INLINE_FUNCTION
void perror (const wchar_t *s);
#endif /* ACE_HAS_WCHAR */
+
extern ACE_Export
int printf (const char *format, ...);
+
#if defined (ACE_HAS_WCHAR)
extern ACE_Export
int printf (const wchar_t *format, ...);
#endif
+
ACE_NAMESPACE_INLINE_FUNCTION
int puts (const char *s);
+
#if defined (ACE_HAS_WCHAR)
ACE_NAMESPACE_INLINE_FUNCTION
int puts (const wchar_t *s);
#endif /* ACE_HAS_WCHAR */
+
ACE_NAMESPACE_INLINE_FUNCTION
int rename (const char *old_name,
const char *new_name,
int flags = -1);
+
#if defined (ACE_HAS_WCHAR)
ACE_NAMESPACE_INLINE_FUNCTION
int rename (const wchar_t *old_name,
const wchar_t *new_name,
int flags = -1);
#endif /* ACE_HAS_WCHAR */
+
ACE_NAMESPACE_INLINE_FUNCTION
void rewind (FILE *fp);
+
extern ACE_Export
int snprintf (char *buf, size_t maxlen, const char *format, ...);
+
# if defined (ACE_HAS_WCHAR)
extern ACE_Export
int snprintf (wchar_t *buf, size_t maxlen, const wchar_t *format, ...);
# endif /* ACE_HAS_WCHAR */
+
extern ACE_Export
int sprintf (char *buf, const char *format, ...);
+
# if defined (ACE_HAS_WCHAR)
extern ACE_Export
int sprintf (wchar_t *buf, const wchar_t *format, ...);
# endif /* ACE_HAS_WCHAR */
+
ACE_NAMESPACE_INLINE_FUNCTION
char *tempnam (const char *dir = 0,
const char *pfx = 0);
+
#if defined (ACE_HAS_WCHAR)
ACE_NAMESPACE_INLINE_FUNCTION
wchar_t *tempnam (const wchar_t *dir,
const wchar_t *pfx = 0);
#endif /* ACE_HAS_WCHAR */
+
ACE_NAMESPACE_INLINE_FUNCTION
int vasprintf (char **bufp, const char *format, va_list argptr);
+
ACE_NAMESPACE_INLINE_FUNCTION
int vprintf (const char *format, va_list argptr);
+
ACE_NAMESPACE_INLINE_FUNCTION
int vfprintf (FILE *fp, const char *format, va_list argptr);
+
ACE_NAMESPACE_INLINE_FUNCTION
int vsprintf (char *buffer, const char *format, va_list argptr);
+
ACE_NAMESPACE_INLINE_FUNCTION
int vsnprintf (char *buffer, size_t maxlen, const char *format, va_list argptr);
+
# if defined (ACE_HAS_WCHAR)
ACE_NAMESPACE_INLINE_FUNCTION
int vasprintf (wchar_t **bufp, const wchar_t *format, va_list argptr);
+
ACE_NAMESPACE_INLINE_FUNCTION
int vprintf (const wchar_t *format, va_list argptr);
+
ACE_NAMESPACE_INLINE_FUNCTION
int vfprintf (FILE *fp, const wchar_t *format, va_list argptr);
+
ACE_NAMESPACE_INLINE_FUNCTION
int vsprintf (wchar_t *buffer, const wchar_t *format, va_list argptr);
+
ACE_NAMESPACE_INLINE_FUNCTION
int vsnprintf (wchar_t *buffer, size_t maxlen, const wchar_t *format, va_list argptr);
# endif /* ACE_HAS_WCHAR */
+
#if !defined (ACE_HAS_VASPRINTF)
extern ACE_Export
int vasprintf_emulation (char **bufp, const char *format, va_list argptr);
#endif /* !ACE_HAS_VASPRINTF */
+
#if defined (ACE_HAS_WCHAR)
#if !defined (ACE_HAS_VASWPRINTF)
extern ACE_Export
int vaswprintf_emulation (wchar_t **bufp, const wchar_t *format, va_list argptr);
#endif /* !ACE_HAS_VASWPRINTF */
#endif /* ACE_HAS_WCHAR */
+
} /* namespace ACE_OS */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# if defined (ACE_HAS_INLINED_OSCALLS)
# if defined (ACE_INLINE)
# undef ACE_INLINE
@@ -437,6 +537,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_INLINE inline
# include "ace/OS_NS_stdio.inl"
# endif /* ACE_HAS_INLINED_OSCALLS */
+
# include /**/ "ace/post.h"
#endif /* ACE_OS_NS_STDIO_H */
diff --git a/dep/ACE_wrappers/ace/OS_NS_stdio.inl b/dep/ACE_wrappers/ace/OS_NS_stdio.inl
index 69c97c284c2..2c6894e46c4 100644
--- a/dep/ACE_wrappers/ace/OS_NS_stdio.inl
+++ b/dep/ACE_wrappers/ace/OS_NS_stdio.inl
@@ -1,6 +1,7 @@
// -*- C++ -*-
//
// $Id: OS_NS_stdio.inl 82444 2008-07-28 13:33:07Z johnnyw $
+
#include "ace/OS_NS_unistd.h"
#include "ace/OS_NS_stdlib.h"
#include "ace/OS_NS_fcntl.h"
@@ -10,11 +11,15 @@
#include "ace/OS_NS_macros.h"
#include "ace/OS_NS_sys_stat.h"
#include "ace/OS_Memory.h"
+
#if defined (ACE_HAS_TRIO)
# include <trio.h>
#endif /* ACE_HAS_TRIO */
+
/*****************************************************************************/
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_WIN32)
ACE_INLINE void
ACE_OS::flock_adjust_params (ACE_OS::ace_flock_t *lock,
@@ -52,6 +57,7 @@ ACE_OS::flock_adjust_params (ACE_OS::ace_flock_t *lock,
return;
}
# endif /* ACE_LACKS_WIN32_SETFILEPOINTEREX */
+
# if defined (_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS == 64
start += offset.QuadPart;
# else
@@ -64,6 +70,7 @@ ACE_OS::flock_adjust_params (ACE_OS::ace_flock_t *lock,
ACE_OFF_T const size = ACE_OS::filesize (lock->handle_);
if (size == -1)
return;
+
start += size;
}
break;
@@ -78,6 +85,7 @@ ACE_OS::flock_adjust_params (ACE_OS::ace_flock_t *lock,
}
}
#endif /* ACE_WIN32 */
+
ACE_INLINE int
ACE_OS::flock_init (ACE_OS::ace_flock_t *lock,
int flags,
@@ -94,6 +102,7 @@ ACE_OS::flock_init (ACE_OS::ace_flock_t *lock,
#endif /* ACE_WIN32 */
lock->handle_ = ACE_INVALID_HANDLE;
lock->lockname_ = 0;
+
if (name != 0)
{
ACE_OSCALL (ACE_OS::open (name, flags, perms),
@@ -107,6 +116,7 @@ ACE_OS::flock_init (ACE_OS::ace_flock_t *lock,
else
return 0;
}
+
ACE_INLINE int
ACE_OS::flock_unlock (ACE_OS::ace_flock_t *lock,
short whence,
@@ -136,12 +146,14 @@ ACE_OS::flock_unlock (ACE_OS::ace_flock_t *lock,
lock->lock_.l_start = start;
lock->lock_.l_len = len;
lock->lock_.l_type = F_UNLCK; // Unlock file.
+
// release lock
ACE_OSCALL_RETURN (ACE_OS::fcntl (lock->handle_, F_SETLK,
reinterpret_cast<long> (&lock->lock_)),
int, -1);
#endif /* ACE_WIN32 */
}
+
ACE_INLINE int
ACE_OS::flock_destroy (ACE_OS::ace_flock_t *lock,
int unlink_file)
@@ -164,6 +176,7 @@ ACE_OS::flock_destroy (ACE_OS::ace_flock_t *lock,
}
return 0;
}
+
ACE_INLINE int
ACE_OS::flock_rdlock (ACE_OS::ace_flock_t *lock,
short whence,
@@ -199,6 +212,7 @@ ACE_OS::flock_rdlock (ACE_OS::ace_flock_t *lock,
int, -1);
#endif /* ACE_WIN32 */
}
+
ACE_INLINE int
ACE_OS::flock_tryrdlock (ACE_OS::ace_flock_t *lock,
short whence,
@@ -229,16 +243,20 @@ ACE_OS::flock_tryrdlock (ACE_OS::ace_flock_t *lock,
lock->lock_.l_start = start;
lock->lock_.l_len = len;
lock->lock_.l_type = F_RDLCK; // set read lock
+
int result = 0;
// Does not block, if no access, returns -1 and set errno = EBUSY;
ACE_OSCALL (ACE_OS::fcntl (lock->handle_, F_SETLK,
reinterpret_cast<long> (&lock->lock_)),
int, -1, result);
+
if (result == -1 && (errno == EACCES || errno == EAGAIN))
errno = EBUSY;
+
return result;
#endif /* ACE_WIN32 */
}
+
ACE_INLINE int
ACE_OS::flock_trywrlock (ACE_OS::ace_flock_t *lock,
short whence,
@@ -269,17 +287,21 @@ ACE_OS::flock_trywrlock (ACE_OS::ace_flock_t *lock,
lock->lock_.l_start = start;
lock->lock_.l_len = len;
lock->lock_.l_type = F_WRLCK; // set write lock
+
int result = 0;
// Does not block, if no access, returns -1 and set errno = EBUSY;
ACE_OSCALL (ACE_OS::fcntl (lock->handle_,
F_SETLK,
reinterpret_cast<long> (&lock->lock_)),
int, -1, result);
+
if (result == -1 && (errno == EACCES || errno == EAGAIN))
errno = EBUSY;
+
return result;
#endif /* ACE_WIN32 */
}
+
ACE_INLINE int
ACE_OS::flock_wrlock (ACE_OS::ace_flock_t *lock,
short whence,
@@ -316,6 +338,7 @@ ACE_OS::flock_wrlock (ACE_OS::ace_flock_t *lock,
int, -1);
#endif /* ACE_WIN32 */
}
+
#if !defined (ACE_LACKS_CLEARERR)
ACE_INLINE void
ACE_OS::clearerr (FILE* fp)
@@ -323,6 +346,7 @@ ACE_OS::clearerr (FILE* fp)
ace_clearerr_helper (fp);
}
#endif /* !ACE_LACKS_CLEARERR */
+
#if !defined (ACE_LACKS_CUSERID)
ACE_INLINE char *
ACE_OS::cuserid (char *user, size_t maxlen)
@@ -355,42 +379,54 @@ ACE_OS::cuserid (char *user, size_t maxlen)
# if defined (ACE_LACKS_PWD_FUNCTIONS)
# error Cannot use alternate cuserid() without POSIX password functions!
# endif /* ACE_LACKS_PWD_FUNCTIONS */
+
// POSIX.1 dropped the cuserid() function.
// GNU GLIBC and other platforms correctly deprecate the cuserid()
// function.
+
if (maxlen == 0)
{
// It doesn't make sense to have a zero length user ID.
errno = EINVAL;
return 0;
}
+
struct passwd *pw = 0;
+
// Make sure the file pointer is at the beginning of the password file
ACE_OS::setpwent ();
// Should use ACE_OS::setpwent() but I didn't want to move this
// method after it.
+
// Use the effective user ID to determine the user name.
pw = ::getpwuid (ACE_OS::geteuid ());
+
// Make sure the password file is closed.
ACE_OS::endpwent ();
+
if (pw == 0)
{
errno = ENOENT;
return 0;
}
+
size_t max_length = 0;
char *userid = 0;
+
if (user == 0)
{
// Not reentrant/thread-safe, but nothing else can be done if a
// zero pointer was passed in as the destination.
+
#if defined (_POSIX_SOURCE) && defined (L_cuserid)
const size_t ACE_L_cuserid = L_cuserid;
#else
const size_t ACE_L_cuserid = 9; // 8 character user ID + NULL
#endif /* _POSIX_SOURCE */
+
static char tmp[ACE_L_cuserid] = { '\0' };
max_length = ACE_L_cuserid - 1; // Do not include NULL in length
+
userid = tmp;
}
else
@@ -398,6 +434,7 @@ ACE_OS::cuserid (char *user, size_t maxlen)
max_length = maxlen;
userid = user;
}
+
// Extract the user name from the passwd structure.
if (ACE_OS::strlen (pw->pw_name) <= max_length)
{
@@ -414,6 +451,7 @@ ACE_OS::cuserid (char *user, size_t maxlen)
ACE_OSCALL_RETURN (::ace_cuserid(user), char*, 0);
#endif /* ACE_VXWORKS */
}
+
#if defined (ACE_HAS_WCHAR)
ACE_INLINE wchar_t *
ACE_OS::cuserid (wchar_t *user, size_t maxlen)
@@ -431,24 +469,30 @@ ACE_OS::cuserid (wchar_t *user, size_t maxlen)
# else /* ACE_WIN32 */
char *char_user;
wchar_t *result = 0;
+
ACE_NEW_RETURN (char_user, char[maxlen + 1], 0);
+
if (ACE_OS::cuserid (char_user, maxlen))
{
ACE_OS::strcpy (user, ACE_Ascii_To_Wide (char_user).wchar_rep ());
result = user;
}
+
delete [] char_user;
+
return result;
# endif /* ACE_WIN32 */
}
#endif /* ACE_HAS_WCHAR */
#endif /* ACE_LACKS_CUSERID */
+
ACE_INLINE int
ACE_OS::fclose (FILE *fp)
{
ACE_OS_TRACE ("ACE_OS::fclose");
ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::fclose (fp), int, -1);
}
+
ACE_INLINE FILE *
ACE_OS::fdopen (ACE_HANDLE handle, const ACE_TCHAR *mode)
{
@@ -460,8 +504,11 @@ ACE_OS::fdopen (ACE_HANDLE handle, const ACE_TCHAR *mode)
#elif defined (ACE_WIN32)
// kernel file handle -> FILE* conversion...
// Options: _O_APPEND, _O_RDONLY and _O_TEXT are lost
+
FILE * file = 0;
+
int const crt_handle = ::_open_osfhandle (intptr_t (handle), 0);
+
if (crt_handle != -1)
{
# if defined(ACE_HAS_NONCONST_FDOPEN) && !defined (ACE_USES_WCHAR)
@@ -473,11 +520,13 @@ ACE_OS::fdopen (ACE_HANDLE handle, const ACE_TCHAR *mode)
# else
file = ::_fdopen (crt_handle, mode);
# endif /* ACE_HAS_NONCONST_FDOPEN */
+
if (!file)
{
::_close (crt_handle);
}
}
+
return file;
#elif defined (ACE_LACKS_FDOPEN)
ACE_UNUSED_ARG (handle);
@@ -488,6 +537,7 @@ ACE_OS::fdopen (ACE_HANDLE handle, const ACE_TCHAR *mode)
(::fdopen (handle, ACE_TEXT_ALWAYS_CHAR (mode)), FILE *, 0);
#endif /* ACE_HAS_WINCE */
}
+
ACE_INLINE int
ACE_OS::fflush (FILE *fp)
{
@@ -499,29 +549,35 @@ ACE_OS::fflush (FILE *fp)
return 0;
}
#endif /* ACE_VXWORKS */
+
ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::fflush (fp), int, -1);
}
+
ACE_INLINE int
ACE_OS::fgetc (FILE* fp)
{
return ace_fgetc_helper (fp);
}
+
ACE_INLINE int
ACE_OS::getc (FILE* fp)
{
return ace_getc_helper (fp);
}
+
ACE_INLINE int
ACE_OS::fgetpos (FILE* fp, fpos_t* pos)
{
ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::fgetpos (fp, pos), int, -1);
}
+
ACE_INLINE char *
ACE_OS::fgets (char *buf, int size, FILE *fp)
{
ACE_OS_TRACE ("ACE_OS::fgets");
ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::fgets (buf, size, fp), char *, 0);
}
+
#if defined (ACE_HAS_WCHAR) && !defined(ACE_LACKS_FGETWS)
ACE_INLINE wchar_t *
ACE_OS::fgets (wchar_t *buf, int size, FILE *fp)
@@ -530,6 +586,7 @@ ACE_OS::fgets (wchar_t *buf, int size, FILE *fp)
ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::fgetws (buf, size, fp), wchar_t *, 0);
}
#endif /* ACE_HAS_WCHAR && !ACE_LACKS_FGETWS */
+
#if !(defined (ACE_WIN32) && !defined (ACE_HAS_WINCE))
// Win32 PC implementation of fopen () is in OS_NS_stdio.cpp.
ACE_INLINE FILE *
@@ -539,6 +596,7 @@ ACE_OS::fopen (const char *filename, const char *mode)
ACE_OSCALL_RETURN
(::fopen (filename, mode), FILE *, 0);
}
+
#if defined (ACE_HAS_WCHAR)
// Win32 PC implementation of fopen () is in OS_NS_stdio.cpp.
ACE_INLINE FILE *
@@ -582,28 +640,34 @@ ACE_OS::fopen (const wchar_t *filename, const char *mode)
#endif /* ACE_HAS_WINCE */
}
#endif /* ACE_HAS_WCHAR */
+
#endif /* ACE_WIN32 */
+
ACE_INLINE int
ACE_OS::ungetc (int c, FILE *fp)
{
return ace_ungetc_helper (c, fp);
}
+
ACE_INLINE int
ACE_OS::fputc (int c, FILE *fp)
{
return ace_fputc_helper (c, fp);
}
+
ACE_INLINE int
ACE_OS::putc (int c, FILE *fp)
{
return ace_putc_helper (c, fp);
}
+
ACE_INLINE int
ACE_OS::fputs (const char *s, FILE *stream)
{
ACE_OS_TRACE ("ACE_OS::fputs");
ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::fputs (s, stream), int, -1);
}
+
#if defined (ACE_HAS_WCHAR) && !defined(ACE_LACKS_FPUTWS)
ACE_INLINE int
ACE_OS::fputs (const wchar_t *s, FILE *stream)
@@ -612,6 +676,7 @@ ACE_OS::fputs (const wchar_t *s, FILE *stream)
ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::fputws (s, stream), int, -1);
}
#endif /* ACE_HAS_WCHAR && !ACE_LACKS_FPUTWS */
+
ACE_INLINE size_t
ACE_OS::fread (void *ptr, size_t size, size_t nelems, FILE *fp)
{
@@ -620,6 +685,7 @@ ACE_OS::fread (void *ptr, size_t size, size_t nelems, FILE *fp)
size_t,
0);
}
+
ACE_INLINE FILE *
ACE_OS::freopen (const ACE_TCHAR *filename, const ACE_TCHAR *mode, FILE* stream)
{
@@ -637,6 +703,7 @@ ACE_OS::freopen (const ACE_TCHAR *filename, const ACE_TCHAR *mode, FILE* stream)
FILE *, 0);
#endif /* ACE_WIN32 && ACE_USES_WCHAR */
}
+
ACE_INLINE int
ACE_OS::fseek (FILE *fp, long offset, int whence)
{
@@ -662,16 +729,19 @@ ACE_OS::fseek (FILE *fp, long offset, int whence)
# endif /* ACE_WIN32 */
ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::fseek (fp, offset, whence), int, -1);
}
+
ACE_INLINE int
ACE_OS::fsetpos (FILE* fp, fpos_t* pos)
{
ACE_OSCALL_RETURN (::fsetpos (fp, pos), int, -1);
}
+
ACE_INLINE long
ACE_OS::ftell (FILE* fp)
{
ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::ftell (fp), long, -1);
}
+
ACE_INLINE size_t
ACE_OS::fwrite (const void *ptr, size_t size, size_t nitems, FILE *fp)
{
@@ -680,6 +750,7 @@ ACE_OS::fwrite (const void *ptr, size_t size, size_t nitems, FILE *fp)
size_t,
0);
}
+
ACE_INLINE void
ACE_OS::perror (const char *s)
{
@@ -690,6 +761,7 @@ ACE_OS::perror (const char *s)
::perror (s);
#endif /* ACE_HAS_WINCE */
}
+
#if defined (ACE_HAS_WCHAR)
ACE_INLINE void
ACE_OS::perror (const wchar_t *s)
@@ -705,12 +777,14 @@ ACE_OS::perror (const wchar_t *s)
#endif /* ACE_HAS_WINCE */
}
#endif /* ACE_HAS_WCHAR */
+
ACE_INLINE int
ACE_OS::puts (const char *s)
{
ACE_OS_TRACE ("ACE_OS::puts");
ACE_OSCALL_RETURN (::puts (s), int, -1);
}
+
#if defined (ACE_HAS_WCHAR)
ACE_INLINE int
ACE_OS::puts (const wchar_t *s)
@@ -725,6 +799,7 @@ ACE_OS::puts (const wchar_t *s)
#endif /* ACE_WIN32 */
}
#endif /* ACE_HAS_WCHAR */
+
ACE_INLINE int
ACE_OS::rename (const char *old_name,
const char *new_name,
@@ -757,6 +832,7 @@ ACE_OS::rename (const char *old_name,
ACE_OSCALL_RETURN (::rename (old_name, new_name), int, -1);
# endif /* ACE_LACKS_RENAME */
}
+
#if defined (ACE_HAS_WCHAR)
ACE_INLINE int
ACE_OS::rename (const wchar_t *old_name,
@@ -793,6 +869,7 @@ ACE_OS::rename (const wchar_t *old_name,
# endif /* ACE_LACKS_RENAME */
}
#endif /* ACE_HAS_WCHAR */
+
ACE_INLINE void
ACE_OS::rewind (FILE *fp)
{
@@ -805,6 +882,7 @@ ACE_OS::rewind (FILE *fp)
(void) fseek (fp, 0L, SEEK_SET);
#endif /* ACE_HAS_WINCE */
}
+
ACE_INLINE char *
ACE_OS::tempnam (const char *dir, const char *pfx)
{
@@ -819,6 +897,7 @@ ACE_OS::tempnam (const char *dir, const char *pfx)
ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::tempnam (dir, pfx), char *, 0);
#endif /* ACE_LACKS_TEMPNAM */
}
+
#if defined (ACE_HAS_WCHAR)
ACE_INLINE wchar_t *
ACE_OS::tempnam (const wchar_t *dir, const wchar_t *pfx)
@@ -855,6 +934,7 @@ ACE_OS::tempnam (const wchar_t *dir, const wchar_t *pfx)
#endif /* ACE_LACKS_TEMPNAM */
}
#endif /* ACE_HAS_WCHAR */
+
ACE_INLINE int
ACE_OS::vasprintf (char **bufp, const char* format, va_list argptr)
{
@@ -864,6 +944,7 @@ ACE_OS::vasprintf (char **bufp, const char* format, va_list argptr)
return ACE_OS::vasprintf_emulation (bufp, format, argptr);
#endif /* ACE_HAS_VASPRINTF */
}
+
#if defined (ACE_HAS_WCHAR)
ACE_INLINE int
ACE_OS::vasprintf (wchar_t **bufp, const wchar_t* format, va_list argptr)
@@ -875,11 +956,13 @@ ACE_OS::vasprintf (wchar_t **bufp, const wchar_t* format, va_list argptr)
#endif /* ACE_HAS_VASWPRINTF */
}
#endif /* ACE_HAS_WCHAR */
+
ACE_INLINE int
ACE_OS::vprintf (const char *format, va_list argptr)
{
return ::vprintf (format, argptr);
}
+
#if defined (ACE_HAS_WCHAR)
ACE_INLINE int
ACE_OS::vprintf (const wchar_t *format, va_list argptr)
@@ -893,11 +976,13 @@ ACE_OS::vprintf (const wchar_t *format, va_list argptr)
#endif /* ACE_HAS_VWPRINTF */
}
#endif /* ACE_HAS_WCHAR */
+
ACE_INLINE int
ACE_OS::vfprintf (FILE *fp, const char *format, va_list argptr)
{
return ACE_STD_NAMESPACE::vfprintf (fp, format, argptr);
}
+
#if defined (ACE_HAS_WCHAR)
ACE_INLINE int
ACE_OS::vfprintf (FILE *fp, const wchar_t *format, va_list argptr)
@@ -912,11 +997,13 @@ ACE_OS::vfprintf (FILE *fp, const wchar_t *format, va_list argptr)
#endif /* ACE_HAS_VFWPRINTF */
}
#endif /* ACE_HAS_WCHAR */
+
ACE_INLINE int
ACE_OS::vsprintf (char *buffer, const char *format, va_list argptr)
{
return ::vsprintf (buffer, format, argptr);
}
+
#if defined (ACE_HAS_WCHAR)
ACE_INLINE int
ACE_OS::vsprintf (wchar_t *buffer, const wchar_t *format, va_list argptr)
@@ -927,24 +1014,30 @@ ACE_OS::vsprintf (wchar_t *buffer, const wchar_t *format, va_list argptr)
defined (ACE_HAS_VSWPRINTF) || defined (ACE_WIN32_VC9) || \
(defined (ACE_WIN32_VC8) && !defined (ACE_HAS_WINCE) && \
_MSC_FULL_VER > 140050000)
+
// The XPG4/UNIX98/C99 signature of the wide-char sprintf has a
// maxlen argument. Since this method doesn't supply one, pass in
// a length that works (ULONG_MAX doesn't on all platform since some check
// to see if the operation will remain in bounds). If this isn't ok, use
// ACE_OS::snprintf().
return vswprintf (buffer, 4096, format, argptr);
+
# elif defined (ACE_WIN32)
// Windows has vswprintf, but the pre-VC8 signature is from the older
// ISO C standard. Also see ACE_OS::snprintf() for more info on this.
+
return vswprintf (buffer, format, argptr);
+
# else
ACE_UNUSED_ARG (buffer);
ACE_UNUSED_ARG (format);
ACE_UNUSED_ARG (argptr);
ACE_NOTSUP_RETURN (-1);
+
# endif /* XPG5 || ACE_HAS_DINKUM_STL */
}
#endif /* ACE_HAS_WCHAR */
+
ACE_INLINE int
ACE_OS::vsnprintf (char *buffer, size_t maxlen, const char *format, va_list ap)
{
@@ -959,9 +1052,11 @@ ACE_OS::vsnprintf (char *buffer, size_t maxlen, const char *format, va_list ap)
result = ::vsnprintf (buffer, maxlen, format, ap);
# else
result = ::_vsnprintf (buffer, maxlen, format, ap);
+
// Win32 doesn't regard a full buffer with no 0-terminate as an overrun.
if (result == static_cast<int> (maxlen))
buffer[maxlen-1] = '\0';
+
// Win32 doesn't 0-terminate the string if it overruns maxlen.
if (result == -1)
buffer[maxlen-1] = '\0';
@@ -975,6 +1070,7 @@ ACE_OS::vsnprintf (char *buffer, size_t maxlen, const char *format, va_list ap)
{
result = static_cast <int> (maxlen + 1);
}
+
return result;
#elif defined (ACE_HAS_TRIO)
return trio_vsnprintf (buffer, maxlen, format, ap);
@@ -986,6 +1082,7 @@ ACE_OS::vsnprintf (char *buffer, size_t maxlen, const char *format, va_list ap)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_LACKS_VSNPRINTF */
}
+
#if defined (ACE_HAS_WCHAR)
ACE_INLINE int
ACE_OS::vsnprintf (wchar_t *buffer, size_t maxlen, const wchar_t *format, va_list ap)
@@ -995,21 +1092,26 @@ ACE_OS::vsnprintf (wchar_t *buffer, size_t maxlen, const wchar_t *format, va_lis
(defined (ACE_HAS_DINKUM_STL) || defined (__DMC__)) || \
defined (ACE_HAS_VSWPRINTF) || \
defined (ACE_WIN32)
+
int result;
+
# if defined (ACE_WIN32)
// Microsoft's vswprintf() doesn't have the maxlen argument that
// XPG4/UNIX98 define. They do, however, recommend use of _vsnwprintf()
// as a substitute, which does have the same signature as the UNIX98 one.
result = ::_vsnwprintf (buffer, maxlen, format, ap);
+
// Win32 doesn't regard a full buffer with no 0-terminate as an overrun.
if (result == static_cast<int> (maxlen))
buffer[maxlen-1] = '\0';
+
// Win32 doesn't 0-terminate the string if it overruns maxlen.
if (result == -1)
buffer[maxlen-1] = '\0';
# else
result = vswprintf (buffer, maxlen, format, ap);
#endif
+
// In out-of-range conditions, C99 defines vsnprintf() to return the number
// of characters that would have been written if enough space was available.
// Earlier variants of the vsnprintf() (e.g. UNIX98) defined it to return
@@ -1019,16 +1121,21 @@ ACE_OS::vsnprintf (wchar_t *buffer, size_t maxlen, const wchar_t *format, va_lis
{
result = static_cast <int> (maxlen + 1);
}
+
return result;
+
# else
+
ACE_UNUSED_ARG (buffer);
ACE_UNUSED_ARG (maxlen);
ACE_UNUSED_ARG (format);
ACE_UNUSED_ARG (ap);
ACE_NOTSUP_RETURN (-1);
+
# endif /* platforms with a variant of vswprintf */
}
#endif /* ACE_HAS_WCHAR */
+
#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
#if defined (ACE_WIN32)
ACE_INLINE const ACE_TEXT_OSVERSIONINFO &
@@ -1036,16 +1143,19 @@ ACE_OS::get_win32_versioninfo ()
{
return ACE_OS::win32_versioninfo_;
}
+
ACE_INLINE HINSTANCE
ACE_OS::get_win32_resource_module ()
{
return ACE_OS::win32_resource_module_;
}
+
ACE_INLINE void
ACE_OS::set_win32_resource_module (HINSTANCE instance)
{
ACE_OS::win32_resource_module_ = instance;
}
+
ACE_INLINE LPSECURITY_ATTRIBUTES
ACE_OS::default_win32_security_attributes (LPSECURITY_ATTRIBUTES sa)
{
@@ -1067,6 +1177,7 @@ ACE_OS::default_win32_security_attributes (LPSECURITY_ATTRIBUTES sa)
return sa;
#endif /* ACE_DEFINES_DEFAULT_WIN32_SECURITY_ATTRIBUTES */
}
+
ACE_INLINE LPSECURITY_ATTRIBUTES
ACE_OS::default_win32_security_attributes_r (LPSECURITY_ATTRIBUTES sa,
LPSECURITY_ATTRIBUTES sa_buffer,
@@ -1093,6 +1204,8 @@ ACE_OS::default_win32_security_attributes_r (LPSECURITY_ATTRIBUTES sa,
return sa;
#endif /* ACE_DEFINES_DEFAULT_WIN32_SECURITY_ATTRIBUTES */
}
+
#endif /* ACE_WIN32 */
#endif
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_NS_stdlib.cpp b/dep/ACE_wrappers/ace/OS_NS_stdlib.cpp
index 311ba3b17ca..78d01380c0f 100644
--- a/dep/ACE_wrappers/ace/OS_NS_stdlib.cpp
+++ b/dep/ACE_wrappers/ace/OS_NS_stdlib.cpp
@@ -1,21 +1,29 @@
// $Id: OS_NS_stdlib.cpp 81804 2008-05-29 16:12:07Z vzykov $
+
#include "ace/OS_NS_stdlib.h"
+
ACE_RCSID (ace,
OS_NS_stdlib,
"$Id: OS_NS_stdlib.cpp 81804 2008-05-29 16:12:07Z vzykov $")
+
#include "ace/Default_Constants.h"
+
#if !defined (ACE_HAS_INLINED_OSCALLS)
# include "ace/OS_NS_stdlib.inl"
#endif /* ACE_HAS_INLINED_OSCALLS */
+
#include "ace/OS_Memory.h"
+
#include "ace/OS_NS_unistd.h"
#include "ace/OS_NS_ctype.h"
+
#if defined (ACE_LACKS_MKTEMP) \
|| defined (ACE_LACKS_MKSTEMP) \
|| defined (ACE_LACKS_REALPATH)
# include "ace/OS_NS_stdio.h"
# include "ace/OS_NS_sys_stat.h"
#endif /* ACE_LACKS_MKTEMP || ACE_LACKS_MKSTEMP || ACE_LACKS_REALPATH */
+
#if defined (ACE_LACKS_MKSTEMP)
# include "ace/OS_NS_fcntl.h"
# include "ace/OS_NS_ctype.h"
@@ -23,8 +31,11 @@ ACE_RCSID (ace,
# include "ace/OS_NS_Thread.h"
# include "ace/Numeric_Limits.h"
#endif /* ACE_LACKS_MKSTEMP */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_EXIT_HOOK ACE_OS::exit_hook_ = 0;
+
void *
ACE_OS::calloc (size_t elements, size_t sizeof_elements)
{
@@ -36,10 +47,12 @@ ACE_OS::calloc (size_t elements, size_t sizeof_elements)
return ACE_MALLOC_FUNC (elements * sizeof_elements);
#endif /* ACE_HAS_WINCE */
}
+
void
ACE_OS::exit (int status)
{
ACE_OS_TRACE ("ACE_OS::exit");
+
#if defined (ACE_HAS_NONSTATIC_OBJECT_MANAGER) && !defined (ACE_HAS_WINCE) && !defined (ACE_DOESNT_INSTANTIATE_NONSTATIC_OBJECT_MANAGER)
// Shut down the ACE_Object_Manager, if it had registered its exit_hook.
// With ACE_HAS_NONSTATIC_OBJECT_MANAGER, the ACE_Object_Manager is
@@ -47,6 +60,7 @@ ACE_OS::exit (int status)
if (exit_hook_)
(*exit_hook_) ();
#endif /* ACE_HAS_NONSTATIC_OBJECT_MANAGER && !ACE_HAS_WINCE && !ACE_DOESNT_INSTANTIATE_NONSTATIC_OBJECT_MANAGER */
+
#if !defined (ACE_HAS_WINCE)
# if defined (ACE_WIN32)
::ExitProcess ((UINT) status);
@@ -59,11 +73,13 @@ ACE_OS::exit (int status)
::TerminateProcess (::GetCurrentProcess (), status);
#endif /* ACE_HAS_WINCE */
}
+
void
ACE_OS::free (void *ptr)
{
ACE_FREE_FUNC (ACE_MALLOC_T (ptr));
}
+
// You may be asking yourself, why are we doing this? Well, in winbase.h,
// MS didn't follow their normal Api_FunctionA and Api_FunctionW style,
// so we have to #undef their define to get access to the unicode version.
@@ -72,6 +88,7 @@ ACE_OS::free (void *ptr)
#if defined (ACE_WIN32) && defined (UNICODE) && !defined (ACE_USES_TCHAR)
#undef GetEnvironmentStrings
#endif /* ACE_WIN32 && UNICODE !ACE_USES_TCHAR */
+
ACE_TCHAR *
ACE_OS::getenvstrings (void)
{
@@ -87,10 +104,12 @@ ACE_OS::getenvstrings (void)
ACE_NOTSUP_RETURN (0);
#endif /* ACE_WIN32 */
}
+
// Return a dynamically allocated duplicate of <str>, substituting the
// environment variables of form $VAR_NAME. Note that the pointer is
// allocated with <ACE_OS::malloc> and must be freed by
// <ACE_OS::free>.
+
ACE_TCHAR *
ACE_OS::strenvdup (const ACE_TCHAR *str)
{
@@ -155,21 +174,26 @@ ACE_OS::strenvdup (const ACE_TCHAR *str)
return ACE_OS::strdup (str);
#endif /* ACE_HAS_WINCE */
}
+
#if !defined (ACE_HAS_ITOA)
char *
ACE_OS::itoa_emulation (int value, char *string, int radix)
{
char *e = string;
char *b = string;
+
// Short circuit if 0
+
if (value == 0)
{
string[0] = '0';
string[1] = 0;
return string;
}
+
// If negative and base 10, print a - and then do the
// number.
+
if (value < 0 && radix == 10)
{
string[0] = '-';
@@ -177,15 +201,21 @@ ACE_OS::itoa_emulation (int value, char *string, int radix)
++e; // Don't overwrite the negative sign.
value = -value; // Drop negative sign so character selection is correct.
}
+
// Convert to base <radix>, but in reverse order
+
while (value != 0)
{
int mod = value % radix;
value = value / radix;
+
*e++ = (mod < 10) ? '0' + mod : 'a' + mod - 10;
}
+
*e-- = 0;
+
// Now reverse the string to get the correct result
+
while (e > b)
{
char temp = *e;
@@ -194,38 +224,50 @@ ACE_OS::itoa_emulation (int value, char *string, int radix)
++b;
--e;
}
+
return string;
}
#endif /* !ACE_HAS_ITOA */
+
#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_ITOW)
wchar_t *
ACE_OS::itow_emulation (int value, wchar_t *string, int radix)
{
wchar_t *e = string;
wchar_t *b = string;
+
// Short circuit if 0
+
if (value == 0)
{
string[0] = '0';
string[1] = 0;
return string;
}
+
// If negative and base 10, print a - and then do the
// number.
+
if (value < 0 && radix == 10)
{
string[0] = '-';
b++;
}
+
// Convert to base <radix>, but in reverse order
+
while (value != 0)
{
int mod = value % radix;
value = value / radix;
+
*e++ = (mod < 10) ? '0' + mod : 'a' + mod - 10;
}
+
*e-- = 0;
+
// Now reverse the string to get the correct result
+
while (e > b)
{
wchar_t temp = *e;
@@ -234,14 +276,17 @@ ACE_OS::itow_emulation (int value, wchar_t *string, int radix)
++b;
--e;
}
+
return string;
}
#endif /* ACE_HAS_WCHAR && ACE_LACKS_ITOW */
+
void *
ACE_OS::malloc (size_t nbytes)
{
return ACE_MALLOC_FUNC (nbytes);
}
+
#if defined (ACE_LACKS_MKTEMP)
ACE_TCHAR *
ACE_OS::mktemp (ACE_TCHAR *s)
@@ -253,6 +298,7 @@ ACE_OS::mktemp (ACE_TCHAR *s)
else
{
ACE_TCHAR *xxxxxx = ACE_OS::strstr (s, ACE_TEXT ("XXXXXX"));
+
if (xxxxxx == 0)
// the template string doesn't contain "XXXXXX"!
return s;
@@ -260,6 +306,7 @@ ACE_OS::mktemp (ACE_TCHAR *s)
{
ACE_TCHAR unique_letter = ACE_TEXT ('a');
ACE_stat sb;
+
// Find an unused filename for this process. It is assumed
// that the user will open the file immediately after
// getting this filename back (so, yes, there is a race
@@ -289,17 +336,20 @@ ACE_OS::mktemp (ACE_TCHAR *s)
}
}
#endif /* ACE_LACKS_MKTEMP */
+
void *
ACE_OS::realloc (void *ptr, size_t nbytes)
{
return ACE_REALLOC_FUNC (ACE_MALLOC_T (ptr), nbytes);
}
+
#if defined (ACE_LACKS_REALPATH) && !defined (ACE_HAS_WINCE)
char *
ACE_OS::realpath (const char *file_name,
char *resolved_name)
{
ACE_OS_TRACE ("ACE_OS::realpath");
+
if (file_name == 0)
{
// Single Unix Specification V3:
@@ -307,6 +357,7 @@ ACE_OS::realpath (const char *file_name,
errno = EINVAL;
return 0;
}
+
if (*file_name == '\0')
{
// Single Unix Specification V3:
@@ -315,7 +366,9 @@ ACE_OS::realpath (const char *file_name,
errno = ENOENT;
return 0;
}
+
char* rpath;
+
if (resolved_name == 0)
{
// Single Unix Specification V3:
@@ -335,7 +388,9 @@ ACE_OS::realpath (const char *file_name,
{
rpath = resolved_name;
}
+
char* dest;
+
if (*file_name != '/')
{
// file_name is relative path so CWD needs to be added
@@ -351,17 +406,22 @@ ACE_OS::realpath (const char *file_name,
{
dest = rpath;
}
+
#if !defined (ACE_LACKS_SYMLINKS)
char expand_buf[PATH_MAX]; // Extra buffer needed to expand symbolic links
int nlinks = 0;
#endif
+
while (*file_name)
{
*dest++ = '/';
+
// Skip multiple separators
while (*file_name == '/')
++file_name;
+
char* start = dest;
+
// Process one path component
while (*file_name && *file_name != '/')
{
@@ -374,6 +434,7 @@ ACE_OS::realpath (const char *file_name,
return 0;
}
}
+
if (start == dest) // Are we done?
{
if (dest - rpath > 1)
@@ -395,6 +456,7 @@ ACE_OS::realpath (const char *file_name,
else
{
ACE_stat st;
+
*dest = '\0';
if (ACE_OS::lstat(rpath, &st) < 0)
{
@@ -402,6 +464,7 @@ ACE_OS::realpath (const char *file_name,
ACE_OS::free (rpath);
return 0;
}
+
// Check if current path is a link
if (S_ISLNK (st.st_mode))
{
@@ -412,9 +475,12 @@ ACE_OS::realpath (const char *file_name,
ACE_OS::free (rpath);
return 0;
}
+
char link_buf[PATH_MAX];
+
ssize_t link_len = ACE_OS::readlink (rpath, link_buf, PATH_MAX);
int tail_len = ACE_OS::strlen (file_name) + 1;
+
// Check if there is room to expand link?
if (link_len + tail_len > PATH_MAX)
{
@@ -423,9 +489,11 @@ ACE_OS::realpath (const char *file_name,
ACE_OS::free (rpath);
return 0;
}
+
// Move tail and prefix it with expanded link
ACE_OS::memmove (expand_buf + link_len, file_name, tail_len);
ACE_OS::memcpy (expand_buf, link_buf, link_len);
+
if (*link_buf == '/') // Absolute link?
{
dest = rpath;
@@ -441,10 +509,13 @@ ACE_OS::realpath (const char *file_name,
}
# endif /* ACE_LACKS_SYMLINKS */
}
+
*dest = '\0';
+
return rpath;
}
#endif /* ACE_LACKS_REALPATH && !ACE_HAS_WINCE */
+
#if defined (ACE_LACKS_STRTOL)
long
ACE_OS::strtol_emulation (const char *nptr, char **endptr, int base)
@@ -454,6 +525,7 @@ ACE_OS::strtol_emulation (const char *nptr, char **endptr, int base)
register int c;
register unsigned long cutoff;
register int neg = 0, any, cutlim;
+
/*
* Skip white space and pick up leading +/- sign if any.
* If base is 0, allow 0x for hex and 0 for octal, else
@@ -475,6 +547,7 @@ ACE_OS::strtol_emulation (const char *nptr, char **endptr, int base)
}
if (base == 0)
base = c == '0' ? 8 : 10;
+
/*
* Compute the cutoff value between legal numbers and illegal
* numbers. That is the largest legal value, divided by the
@@ -522,6 +595,7 @@ ACE_OS::strtol_emulation (const char *nptr, char **endptr, int base)
return (acc);
}
#endif /* ACE_LACKS_STRTOL */
+
#if defined (ACE_LACKS_STRTOUL)
unsigned long
ACE_OS::strtoul_emulation (const char *nptr,
@@ -533,6 +607,7 @@ ACE_OS::strtoul_emulation (const char *nptr,
register int c;
register unsigned long cutoff;
register int neg = 0, any, cutlim;
+
/*
* See strtol for comments as to the logic used.
*/
@@ -557,6 +632,7 @@ ACE_OS::strtoul_emulation (const char *nptr,
base = c == '0' ? 8 : 10;
cutoff = (unsigned long) ULONG_MAX / (unsigned long) base;
cutlim = (unsigned long) ULONG_MAX % (unsigned long) base;
+
for (acc = 0, any = 0;; c = *s++)
{
if (ACE_OS::ace_isdigit(c))
@@ -588,6 +664,7 @@ ACE_OS::strtoul_emulation (const char *nptr,
return (acc);
}
#endif /* ACE_LACKS_STRTOUL */
+
#if defined (ACE_LACKS_STRTOULL)
ACE_UINT64
ACE_OS::strtoull_emulation (const char *nptr,
@@ -599,6 +676,7 @@ ACE_OS::strtoull_emulation (const char *nptr,
register int c;
register ACE_UINT64 cutoff;
register int neg = 0, any, cutlim;
+
/*
* See strtol for comments as to the logic used.
*/
@@ -621,8 +699,10 @@ ACE_OS::strtoull_emulation (const char *nptr,
}
if (base == 0)
base = c == '0' ? 8 : 10;
+
cutoff = (ACE_UINT64) ACE_UINT64_MAX / (ACE_UINT64) base;
cutlim = (ACE_UINT64) ACE_UINT64_MAX % (ACE_UINT64) base;
+
for (acc = 0, any = 0;; c = *s++)
{
if (ACE_OS::ace_isdigit(c))
@@ -654,6 +734,7 @@ ACE_OS::strtoull_emulation (const char *nptr,
return (acc);
}
#endif /* ACE_LACKS_STRTOULL */
+
#if defined (ACE_LACKS_MKSTEMP)
ACE_HANDLE
ACE_OS::mkstemp_emulation (ACE_TCHAR * s)
@@ -663,29 +744,37 @@ ACE_OS::mkstemp_emulation (ACE_TCHAR * s)
errno = EINVAL;
return ACE_INVALID_HANDLE;
}
+
// The "XXXXXX" template to be filled in.
ACE_TCHAR * const t = ACE_OS::strstr (s, ACE_TEXT ("XXXXXX"));
+
if (t == 0)
{
errno = EINVAL;
return ACE_INVALID_HANDLE;
}
+
static unsigned int const NUM_RETRIES = 50;
static unsigned int const NUM_CHARS = 6; // Do not change!
+
// Use ACE_Time_Value::msec(ACE_UINT64&) as opposed to
// ACE_Time_Value::msec(void) to avoid truncation.
ACE_UINT64 msec;
+
// Use a const ACE_Time_Value to resolve ambiguity between
// ACE_Time_Value::msec (long) and ACE_Time_Value::msec(ACE_UINT64&) const.
ACE_Time_Value const now = ACE_OS::gettimeofday();
now.msec (msec);
+
// Add the process and thread ids to ensure uniqueness.
msec += ACE_OS::getpid();
msec += (size_t) ACE_OS::thr_self();
+
// ACE_thread_t may be a char* (returned by ACE_OS::thr_self()) so
// we need to use a C-style cast as a catch-all in order to use a
// static_cast<> to an integral type.
ACE_RANDR_TYPE seed = static_cast<ACE_RANDR_TYPE> (msec);
+
// We only care about UTF-8 / ASCII characters in generated
// filenames. A UTF-16 or UTF-32 character could potentially cause
// a very large space to be searched in the below do/while() loop,
@@ -699,6 +788,7 @@ ACE_OS::mkstemp_emulation (ACE_TCHAR * s)
// in parallel.
float const MAX_VAL =
static_cast<float> (ACE_Numeric_Limits<char>::max ());
+
// Use high-order bits rather than low-order ones (e.g. rand() %
// MAX_VAL). See Numerical Recipes in C: The Art of Scientific
// Computing (William H. Press, Brian P. Flannery, Saul
@@ -706,9 +796,11 @@ ACE_OS::mkstemp_emulation (ACE_TCHAR * s)
// University Press, 1992 (2nd ed., p. 277).
//
// e.g.: MAX_VAL * rand() / (RAND_MAX + 1.0)
+
// Factor out the constant coefficient.
float const coefficient =
static_cast<float> (MAX_VAL / (RAND_MAX + 1.0f));
+
// @@ These nested loops may be ineffecient. Improvements are
// welcome.
for (unsigned int i = 0; i < NUM_RETRIES; ++i)
@@ -716,6 +808,7 @@ ACE_OS::mkstemp_emulation (ACE_TCHAR * s)
for (unsigned int n = 0; n < NUM_CHARS; ++n)
{
ACE_TCHAR r;
+
// This do/while() loop allows this alphanumeric character
// selection to work for EBCDIC, as well.
do
@@ -723,14 +816,17 @@ ACE_OS::mkstemp_emulation (ACE_TCHAR * s)
r = static_cast<ACE_TCHAR> (coefficient * ACE_OS::rand_r (seed));
}
while (!ACE_OS::ace_isalnum (r));
+
t[n] = r;
}
+
static int const perms =
#if defined (ACE_WIN32)
0; /* Do not share while open. */
#else
0600; /* S_IRUSR | S_IWUSR */
#endif /* ACE_WIN32 */
+
// Create the file with the O_EXCL bit set to ensure that we're
// not subject to a symbolic link attack.
//
@@ -739,16 +835,20 @@ ACE_OS::mkstemp_emulation (ACE_TCHAR * s)
ACE_HANDLE const handle = ACE_OS::open (s,
O_RDWR | O_CREAT | O_EXCL,
perms);
+
if (handle != ACE_INVALID_HANDLE)
return handle;
}
+
errno = EEXIST; // Couldn't create a unique temporary file.
return ACE_INVALID_HANDLE;
}
#endif /* ACE_LACKS_MKSTEMP */
+
#if !defined (ACE_HAS_GETPROGNAME) && !defined (ACE_HAS_SETPROGNAME)
static const char *__progname = "";
#endif /* !ACE_HAS_GETPROGNAME && !ACE_HAS_SETPROGNAME */
+
#if !defined (ACE_HAS_GETPROGNAME)
const char*
ACE_OS::getprogname_emulation ()
@@ -756,6 +856,7 @@ ACE_OS::getprogname_emulation ()
return __progname;
}
#endif /* !ACE_HAS_GETPROGNAME */
+
#if !defined (ACE_HAS_SETPROGNAME)
void
ACE_OS::setprogname_emulation (const char* progname)
@@ -767,5 +868,6 @@ ACE_OS::setprogname_emulation (const char* progname)
__progname = progname;
}
#endif /* !ACE_HAS_SETPROGNAME */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_NS_stdlib.h b/dep/ACE_wrappers/ace/OS_NS_stdlib.h
index e26c96e1205..237956efc7e 100644
--- a/dep/ACE_wrappers/ace/OS_NS_stdlib.h
+++ b/dep/ACE_wrappers/ace/OS_NS_stdlib.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file OS_NS_stdlib.h
@@ -12,23 +13,32 @@
* Originally in OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_NS_STDLIB_H
# define ACE_OS_NS_STDLIB_H
+
# include /**/ "ace/pre.h"
+
# include "ace/config-all.h"
+
# if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
# endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/os_stdlib.h"
#include /**/ "ace/ACE_export.h"
+
#include "ace/Basic_Types.h" /* ACE_UINT64 and intptr_t in inl file */
+
#if defined (ACE_EXPORT_MACRO)
# undef ACE_EXPORT_MACRO
#endif
#define ACE_EXPORT_MACRO ACE_Export
+
# if defined (ACE_HAS_BROKEN_R_ROUTINES)
# undef rand_r
# endif /* ACE_HAS_BROKEN_R_ROUTINES */
+
// We need this for MVS... as well as Linux, etc...
// On Windows, we explicitly set this up as __cdecl so it's correct even
// if building with another calling convention, such as __stdcall.
@@ -41,8 +51,11 @@ extern "C" {
typedef int (*ACE_COMPARE_FUNC)(const void *, const void *);
}
#endif /* ACE_WIN32 && _MSC_VER */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE_OS {
+
/** @name Non-standard functions
*
* These functions aren't in the standard.
@@ -50,83 +63,108 @@ namespace ACE_OS {
*/
//@{
+
ACE_NAMESPACE_INLINE_FUNCTION
void _exit (int status = 0);
+
ACE_NAMESPACE_INLINE_FUNCTION
void abort (void);
+
ACE_NAMESPACE_INLINE_FUNCTION
int atexit (ACE_EXIT_HOOK func);
+
ACE_NAMESPACE_INLINE_FUNCTION
int atoi (const char *s);
+
# if defined (ACE_HAS_WCHAR)
ACE_NAMESPACE_INLINE_FUNCTION
int atoi (const wchar_t *s);
# endif /* ACE_HAS_WCHAR */
+
// atop not in spec
# if defined (atop)
# undef atop
# endif /* atop */
+
ACE_NAMESPACE_INLINE_FUNCTION
void *atop (const char *s);
+
# if defined (ACE_HAS_WCHAR)
ACE_NAMESPACE_INLINE_FUNCTION
void *atop (const wchar_t *s);
# endif /* ACE_HAS_WCHAR */
+
ACE_NAMESPACE_INLINE_FUNCTION
void *bsearch (const void *key,
const void *base,
size_t nel,
size_t size,
ACE_COMPARE_FUNC);
+
extern ACE_Export
void *calloc (size_t elements, size_t sizeof_elements);
+
extern ACE_Export
void exit (int status = 0);
+
extern ACE_Export
void free (void *);
+
ACE_NAMESPACE_INLINE_FUNCTION
char *getenv (const char *symbol);
+
# if defined (ACE_HAS_WCHAR) && defined (ACE_WIN32)
ACE_NAMESPACE_INLINE_FUNCTION
wchar_t *getenv (const wchar_t *symbol);
# endif /* ACE_HAS_WCHAR && ACE_WIN32 */
+
// not in spec
extern ACE_Export
ACE_TCHAR *getenvstrings (void);
+
// itoa not in spec
/// Converts an integer to a string.
ACE_NAMESPACE_INLINE_FUNCTION
char *itoa (int value, char *string, int radix);
+
#if defined (ACE_HAS_WCHAR)
/// Converts an integer to a string.
ACE_NAMESPACE_INLINE_FUNCTION
wchar_t *itoa (int value, wchar_t *string, int radix);
#endif /* ACE_HAS_WCHAR */
+
#if !defined (ACE_HAS_ITOA)
/// Emulated itoa - Converts an integer to a string.
extern ACE_Export
char *itoa_emulation (int value, char *string, int radix);
#endif /* !ACE_HAS_ITOA */
+
#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_ITOW)
/// Emulated itow - Converts an integer to a string.
extern ACE_Export
wchar_t *itow_emulation (int value, wchar_t *string, int radix);
#endif /* ACE_HAS_WCHAR && ACE_LACKS_ITOW */
+
extern ACE_Export
void *malloc (size_t);
+
ACE_NAMESPACE_INLINE_FUNCTION
ACE_HANDLE mkstemp (char *s);
+
# if defined (ACE_HAS_WCHAR)
ACE_NAMESPACE_INLINE_FUNCTION
ACE_HANDLE mkstemp (wchar_t *s);
# endif /* ACE_HAS_WCHAR */
+
#if defined (ACE_LACKS_MKSTEMP)
extern ACE_Export
ACE_HANDLE mkstemp_emulation (ACE_TCHAR * s);
#endif /* ACE_LACKS_MKSTEMP */
+
#if !defined (ACE_LACKS_MKTEMP)
ACE_NAMESPACE_INLINE_FUNCTION
char *mktemp (char *s);
+
# if defined (ACE_HAS_WCHAR)
ACE_NAMESPACE_INLINE_FUNCTION
wchar_t *mktemp (wchar_t *s);
@@ -135,8 +173,10 @@ namespace ACE_OS {
extern ACE_Export
ACE_TCHAR *mktemp (ACE_TCHAR *s);
#endif /* !ACE_LACKS_MSTEMP */
+
ACE_NAMESPACE_INLINE_FUNCTION
int putenv (const char *string);
+
#if defined (ACE_HAS_WCHAR) && defined (ACE_WIN32)
// Windows is the only platform that supports a wchar_t environment.
// Since other platforms make @a string part of the environment, it's
@@ -145,17 +185,22 @@ namespace ACE_OS {
ACE_NAMESPACE_INLINE_FUNCTION
int putenv (const wchar_t *string);
#endif /* ACE_HAS_WCHAR && ACE_WIN32 */
+
ACE_NAMESPACE_INLINE_FUNCTION
void qsort (void *base,
size_t nel,
size_t width,
ACE_COMPARE_FUNC);
+
ACE_NAMESPACE_INLINE_FUNCTION
int rand (void);
+
ACE_NAMESPACE_INLINE_FUNCTION
int rand_r (ACE_RANDR_TYPE &seed);
+
extern ACE_Export
void *realloc (void *, size_t);
+
#if !defined (ACE_HAS_WINCE)
# if !defined (ACE_LACKS_REALPATH)
ACE_NAMESPACE_INLINE_FUNCTION
@@ -163,94 +208,118 @@ namespace ACE_OS {
extern ACE_Export
# endif /* !ACE_LACKS_REALPATH */
char *realpath (const char *file_name, char *resolved_name);
+
# if defined (ACE_HAS_WCHAR)
ACE_NAMESPACE_INLINE_FUNCTION
wchar_t *realpath (const wchar_t *file_name, wchar_t *resolved_name);
# endif /* ACE_HAS_WCHAR */
#endif /* ACE_HAS_WINCE */
+
// exit_hook and set_exit_hook not in spec
/// Function that is called by <ACE_OS::exit>, if non-null.
extern ACE_Export ACE_EXIT_HOOK exit_hook_;
+
/// For use by ACE_Object_Manager only, to register its exit hook..
ACE_NAMESPACE_INLINE_FUNCTION
ACE_EXIT_HOOK set_exit_hook (ACE_EXIT_HOOK hook);
+
ACE_NAMESPACE_INLINE_FUNCTION
void srand (u_int seed);
+
// not in spec
extern ACE_Export
ACE_TCHAR *strenvdup (const ACE_TCHAR *str);
+
#if !defined (ACE_LACKS_STRTOD)
/// Converts a string to a double value (char version).
ACE_NAMESPACE_INLINE_FUNCTION
double strtod (const char *s, char **endptr);
#endif /* !ACE_LACKS_STRTOD */
+
#if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_WCSTOD)
/// Converts a string to a double value (wchar_t version).
ACE_NAMESPACE_INLINE_FUNCTION
double strtod (const wchar_t *s, wchar_t **endptr);
#endif /* ACE_HAS_WCHAR && !ACE_LACKS_WCSTOD */
+
/// Converts a string to a long value (char version).
ACE_NAMESPACE_INLINE_FUNCTION
long strtol (const char *s, char **ptr, int base);
+
#if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_WCSTOL)
/// Converts a string to a long value (wchar_t version).
ACE_NAMESPACE_INLINE_FUNCTION
long strtol (const wchar_t *s, wchar_t **ptr, int base);
#endif /* ACE_HAS_WCHAR && !ACE_LACKS_WCSTOL */
+
#if defined (ACE_LACKS_STRTOL)
extern ACE_Export
long strtol_emulation (const char *nptr, char **endptr, int base);
#endif /* ACE_LACKS_STRTOL */
+
/// Converts a string to an unsigned long value (char version).
ACE_NAMESPACE_INLINE_FUNCTION
unsigned long strtoul (const char *s, char **ptr, int base);
+
#if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_WCSTOUL)
/// Converts a string to an unsigned long value (wchar_t version).
ACE_NAMESPACE_INLINE_FUNCTION
unsigned long strtoul (const wchar_t *s, wchar_t **ptr, int base);
#endif /* ACE_HAS_WCHAR && !ACE_LACKS_WCSTOUL */
+
#if defined (ACE_LACKS_STRTOUL)
extern ACE_Export
unsigned long strtoul_emulation (const char *nptr,
char **endptr,
int base);
#endif /* ACE_LACKS_STRTOUL */
+
/// Converts a string to a 64 bit int value (char version).
ACE_NAMESPACE_INLINE_FUNCTION
ACE_UINT64 strtoull (const char *s, char **ptr, int base);
+
#if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_WCSTOULL)
/// Converts a string to a 64 bit int value (wchar_t version).
ACE_NAMESPACE_INLINE_FUNCTION
ACE_UINT64 strtoull (const wchar_t *s, wchar_t **ptr, int base);
#endif /* ACE_HAS_WCHAR && !ACE_LACKS_WCSTOUL */
+
#if defined (ACE_LACKS_STRTOULL)
extern ACE_Export
ACE_UINT64 strtoull_emulation (const char *nptr,
char **endptr,
int base);
#endif /* ACE_LACKS_STRTOULL */
+
ACE_NAMESPACE_INLINE_FUNCTION
int system (const ACE_TCHAR *s);
+
/// Get the name of the current program
///
/// Originally from NetBSD, now found in *BSD, Cygwin, Darwin, etc.
ACE_NAMESPACE_INLINE_FUNCTION
const char *getprogname ();
+
#if !defined (ACE_HAS_GETPROGNAME)
extern ACE_Export
const char *getprogname_emulation ();
#endif /* !ACE_HAS_GETPROGNAME */
+
/// Set the name of the current program
///
/// Originally from NetBSD, now found in *BSD, Cygwin, Darwin, etc.
ACE_NAMESPACE_INLINE_FUNCTION
void setprogname (const char* name);
+
#if !defined (ACE_HAS_SETPROGNAME)
extern ACE_Export
void setprogname_emulation (const char* name);
#endif /* !ACE_HAS_SETPROGNAME */
+
} /* namespace ACE_OS */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# if defined (ACE_HAS_INLINED_OSCALLS)
# if defined (ACE_INLINE)
# undef ACE_INLINE
@@ -258,6 +327,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_INLINE inline
# include "ace/OS_NS_stdlib.inl"
# endif /* ACE_HAS_INLINED_OSCALLS */
+
# include /**/ "ace/post.h"
#endif /* ACE_OS_NS_STDLIB_H */
diff --git a/dep/ACE_wrappers/ace/OS_NS_stdlib.inl b/dep/ACE_wrappers/ace/OS_NS_stdlib.inl
index fae9be3e520..e32929a353b 100644
--- a/dep/ACE_wrappers/ace/OS_NS_stdlib.inl
+++ b/dep/ACE_wrappers/ace/OS_NS_stdlib.inl
@@ -1,19 +1,24 @@
// -*- C++ -*-
//
// $Id: OS_NS_stdlib.inl 82643 2008-08-19 14:02:12Z johnnyw $
+
#include "ace/config-all.h" /* Need ACE_TRACE */
#include "ace/Object_Manager_Base.h"
#include "ace/OS_NS_string.h"
#include "ace/Global_Macros.h"
#include "ace/os_include/os_errno.h"
#include "ace/os_include/os_search.h"
+
#if defined (ACE_WCHAR_IN_STD_NAMESPACE)
# define ACE_WCHAR_STD_NAMESPACE std
#else
# define ACE_WCHAR_STD_NAMESPACE ACE_STD_NAMESPACE
#endif /* ACE_WCHAR_IN_STD_NAMESPACE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Doesn't need a macro since it *never* returns!
+
ACE_INLINE void
ACE_OS::_exit (int status)
{
@@ -26,6 +31,7 @@ ACE_OS::_exit (int status)
::TerminateProcess (::GetCurrentProcess (), status);
#endif /* ACE_VXWORKS */
}
+
ACE_INLINE void
ACE_OS::abort (void)
{
@@ -36,16 +42,19 @@ ACE_OS::abort (void)
exit (1);
#endif /* !ACE_HAS_WINCE */
}
+
ACE_INLINE int
ACE_OS::atexit (ACE_EXIT_HOOK func)
{
return ACE_OS_Object_Manager::instance ()->at_exit (func);
}
+
ACE_INLINE int
ACE_OS::atoi (const char *s)
{
ACE_OSCALL_RETURN (::atoi (s), int, -1);
}
+
#if defined (ACE_HAS_WCHAR)
ACE_INLINE int
ACE_OS::atoi (const wchar_t *s)
@@ -57,9 +66,11 @@ ACE_OS::atoi (const wchar_t *s)
#endif /* ACE_WIN32 */
}
#endif /* ACE_HAS_WCHAR */
+
#if defined (atop)
# undef atop
#endif /* atop */
+
ACE_INLINE void *
ACE_OS::atop (const char *s)
{
@@ -78,6 +89,7 @@ ACE_OS::atop (const char *s)
void * p = reinterpret_cast<void *> (ip);
return p;
}
+
#if defined (ACE_HAS_WCHAR)
ACE_INLINE void *
ACE_OS::atop (const wchar_t *s)
@@ -97,6 +109,7 @@ ACE_OS::atop (const wchar_t *s)
return p;
}
#endif /* ACE_HAS_WCHAR */
+
ACE_INLINE void *
ACE_OS::bsearch (const void *key,
const void *base,
@@ -115,6 +128,7 @@ ACE_OS::bsearch (const void *key,
ACE_NOTSUP_RETURN (0);
#endif /* ACE_LACKS_BSEARCH */
}
+
ACE_INLINE char *
ACE_OS::getenv (const char *symbol)
{
@@ -126,6 +140,7 @@ ACE_OS::getenv (const char *symbol)
ACE_OSCALL_RETURN (::getenv (symbol), char *, 0);
#endif /* ACE_LACKS_ENV */
}
+
#if defined (ACE_HAS_WCHAR) && defined (ACE_WIN32)
ACE_INLINE wchar_t *
ACE_OS::getenv (const wchar_t *symbol)
@@ -138,6 +153,7 @@ ACE_OS::getenv (const wchar_t *symbol)
#endif /* ACE_LACKS_ENV */
}
#endif /* ACE_HAS_WCHAR && ACE_WIN32 */
+
ACE_INLINE char *
ACE_OS::itoa (int value, char *string, int radix)
{
@@ -149,6 +165,7 @@ ACE_OS::itoa (int value, char *string, int radix)
return ::itoa (value, string, radix);
#endif /* !ACE_HAS_ITOA */
}
+
#if defined (ACE_HAS_WCHAR)
ACE_INLINE wchar_t *
ACE_OS::itoa (int value, wchar_t *string, int radix)
@@ -160,6 +177,7 @@ ACE_OS::itoa (int value, wchar_t *string, int radix)
#endif /* ACE_LACKS_ITOW */
}
#endif /* ACE_HAS_WCHAR */
+
ACE_INLINE ACE_HANDLE
ACE_OS::mkstemp (char *s)
{
@@ -181,6 +199,7 @@ ACE_OS::mkstemp (char *s)
return ACE_OS::mkstemp_emulation (s);
#endif /* !ACE_LACKS_MKSTEMP */
}
+
#if defined (ACE_HAS_WCHAR)
ACE_INLINE ACE_HANDLE
ACE_OS::mkstemp (wchar_t *s)
@@ -214,6 +233,7 @@ ACE_OS::mkstemp (wchar_t *s)
# endif /* !ACE_LACKS_MKSTEMP */
}
#endif /* ACE_HAS_WCHAR */
+
#if !defined (ACE_LACKS_MKTEMP)
ACE_INLINE char *
ACE_OS::mktemp (char *s)
@@ -224,6 +244,7 @@ ACE_OS::mktemp (char *s)
return ::mktemp (s);
# endif /* ACE_WIN32 */
}
+
# if defined (ACE_HAS_WCHAR)
ACE_INLINE wchar_t *
ACE_OS::mktemp (wchar_t *s)
@@ -243,12 +264,15 @@ ACE_OS::mktemp (wchar_t *s)
# endif
}
# endif /* ACE_HAS_WCHAR */
+
#endif /* !ACE_LACKS_MKTEMP */
+
#if defined (INTEGRITY)
extern "C" {
int putenv (char *string);
}
#endif
+
ACE_INLINE int
ACE_OS::putenv (const char *string)
{
@@ -277,6 +301,7 @@ ACE_OS::putenv (const char *string)
}
else
ACE_OSCALL (::setenv (string, "", 1), int, -1, result);
+
return result;
#elif defined (ACE_LACKS_ENV) || defined (ACE_LACKS_PUTENV)
ACE_UNUSED_ARG (string);
@@ -285,6 +310,7 @@ ACE_OS::putenv (const char *string)
ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::putenv (const_cast <char *> (string)), int, -1);
#endif /* ACE_HAS_WINCE */
}
+
#if defined (ACE_HAS_WCHAR) && defined (ACE_WIN32)
ACE_INLINE int
ACE_OS::putenv (const wchar_t *string)
@@ -299,6 +325,7 @@ ACE_OS::putenv (const wchar_t *string)
#endif /* ACE_HAS_WINCE */
}
#endif /* ACE_HAS_WCHAR && ACE_WIN32 */
+
ACE_INLINE void
ACE_OS::qsort (void *base,
size_t nel,
@@ -314,13 +341,16 @@ ACE_OS::qsort (void *base,
ACE_UNUSED_ARG (compar);
#endif /* !ACE_LACKS_QSORT */
}
+
ACE_INLINE int
ACE_OS::rand (void)
{
ACE_OS_TRACE ("ACE_OS::rand");
ACE_OSCALL_RETURN (::rand (), int, -1);
}
+
#if !defined (ACE_WIN32)
+
ACE_INLINE int
ACE_OS::rand_r (ACE_RANDR_TYPE &seed)
{
@@ -339,11 +369,14 @@ ACE_OS::rand_r (ACE_RANDR_TYPE &seed)
ACE_OSCALL_RETURN (::rand (), int, -1);
# endif /* ACE_HAS_REENTRANT_FUNCTIONS */
}
+
#else /* ACE_WIN32 */
+
ACE_INLINE int
ACE_OS::rand_r (ACE_RANDR_TYPE& seed)
{
ACE_OS_TRACE ("ACE_OS::rand_r");
+
long new_seed = (long) (seed);
if (new_seed == 0)
new_seed = 0x12345987;
@@ -354,7 +387,9 @@ ACE_OS::rand_r (ACE_RANDR_TYPE& seed)
(seed) = (unsigned int)new_seed;
return (int) (new_seed & RAND_MAX);
}
+
#endif /* !ACE_WIN32 */
+
#if !defined (ACE_HAS_WINCE)
# if !defined (ACE_LACKS_REALPATH)
ACE_INLINE char *
@@ -368,6 +403,7 @@ ACE_OS::realpath (const char *file_name,
# endif /* ! ACE_WIN32 */
}
# endif /* !ACE_LACKS_REALPATH */
+
# if defined (ACE_HAS_WCHAR)
ACE_INLINE wchar_t *
ACE_OS::realpath (const wchar_t *file_name,
@@ -389,6 +425,7 @@ ACE_OS::realpath (const wchar_t *file_name,
}
# endif /* ACE_HAS_WCHAR */
#endif /* ACE_HAS_WINCE */
+
ACE_INLINE ACE_EXIT_HOOK
ACE_OS::set_exit_hook (ACE_EXIT_HOOK exit_hook)
{
@@ -396,12 +433,14 @@ ACE_OS::set_exit_hook (ACE_EXIT_HOOK exit_hook)
exit_hook_ = exit_hook;
return old_hook;
}
+
ACE_INLINE void
ACE_OS::srand (u_int seed)
{
ACE_OS_TRACE ("ACE_OS::srand");
::srand (seed);
}
+
#if !defined (ACE_LACKS_STRTOD)
ACE_INLINE double
ACE_OS::strtod (const char *s, char **endptr)
@@ -409,6 +448,7 @@ ACE_OS::strtod (const char *s, char **endptr)
return ::strtod (s, endptr);
}
#endif /* !ACE_LACKS_STRTOD */
+
#if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_WCSTOD)
ACE_INLINE double
ACE_OS::strtod (const wchar_t *s, wchar_t **endptr)
@@ -416,6 +456,7 @@ ACE_OS::strtod (const wchar_t *s, wchar_t **endptr)
return ACE_WCHAR_STD_NAMESPACE::wcstod (s, endptr);
}
#endif /* ACE_HAS_WCHAR && !ACE_LACKS_WCSTOD */
+
ACE_INLINE long
ACE_OS::strtol (const char *s, char **ptr, int base)
{
@@ -425,6 +466,7 @@ ACE_OS::strtol (const char *s, char **ptr, int base)
return ::strtol (s, ptr, base);
#endif /* ACE_LACKS_STRTOL */
}
+
#if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_WCSTOL)
ACE_INLINE long
ACE_OS::strtol (const wchar_t *s, wchar_t **ptr, int base)
@@ -432,6 +474,7 @@ ACE_OS::strtol (const wchar_t *s, wchar_t **ptr, int base)
return ACE_WCHAR_STD_NAMESPACE::wcstol (s, ptr, base);
}
#endif /* ACE_HAS_WCHAR && !ACE_LACKS_WCSTOL */
+
ACE_INLINE unsigned long
ACE_OS::strtoul (const char *s, char **ptr, int base)
{
@@ -441,6 +484,7 @@ ACE_OS::strtoul (const char *s, char **ptr, int base)
return ::strtoul (s, ptr, base);
#endif /* ACE_LACKS_STRTOUL */
}
+
#if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_WCSTOUL)
ACE_INLINE unsigned long
ACE_OS::strtoul (const wchar_t *s, wchar_t **ptr, int base)
@@ -448,6 +492,7 @@ ACE_OS::strtoul (const wchar_t *s, wchar_t **ptr, int base)
return ACE_WCHAR_STD_NAMESPACE::wcstoul (s, ptr, base);
}
#endif /* ACE_HAS_WCHAR && !ACE_LACKS_WCSTOUL */
+
ACE_INLINE ACE_UINT64
ACE_OS::strtoull (const char *s, char **ptr, int base)
{
@@ -459,6 +504,7 @@ ACE_OS::strtoull (const char *s, char **ptr, int base)
return ::strtoull (s, ptr, base);
#endif /* ACE_LACKS_STRTOULL */
}
+
#if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_WCSTOULL)
ACE_INLINE ACE_UINT64
ACE_OS::strtoull (const wchar_t *s, wchar_t **ptr, int base)
@@ -470,6 +516,7 @@ ACE_OS::strtoull (const wchar_t *s, wchar_t **ptr, int base)
#endif /* ACE_WIN32 */
}
#endif /* ACE_HAS_WCHAR && !ACE_LACKS_WCSTOULL */
+
ACE_INLINE int
ACE_OS::system (const ACE_TCHAR *s)
{
@@ -485,6 +532,7 @@ ACE_OS::system (const ACE_TCHAR *s)
ACE_OSCALL_RETURN (::system (ACE_TEXT_ALWAYS_CHAR (s)), int, -1);
#endif /* ACE_LACKS_SYSTEM */
}
+
ACE_INLINE const char*
ACE_OS::getprogname ()
{
@@ -494,6 +542,7 @@ ACE_OS::getprogname ()
return ACE_OS::getprogname_emulation ();
#endif /* ACE_HAS_GETPROGNAME */
}
+
ACE_INLINE void
ACE_OS::setprogname (const char* name)
{
@@ -503,4 +552,5 @@ ACE_OS::setprogname (const char* name)
ACE_OS::setprogname_emulation (name);
#endif /* ACE_HAS_SETPROGNAME */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_NS_string.cpp b/dep/ACE_wrappers/ace/OS_NS_string.cpp
index 452ebaafd9d..924d8199af9 100644
--- a/dep/ACE_wrappers/ace/OS_NS_string.cpp
+++ b/dep/ACE_wrappers/ace/OS_NS_string.cpp
@@ -1,34 +1,44 @@
// $Id: OS_NS_string.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_string.h"
#include "ace/OS_NS_stdlib.h"
#include "ace/ACE.h"
+
ACE_RCSID (ace,
OS_NS_string,
"$Id: OS_NS_string.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if !defined (ACE_HAS_INLINED_OSCALLS)
# include "ace/OS_NS_string.inl"
#endif /* ACE_HAS_INLINED_OSCALLS */
+
#if defined (ACE_HAS_WCHAR)
# include "ace/OS_NS_stdlib.h"
#endif /* ACE_HAS_WCHAR */
+
#if !defined (ACE_LACKS_STRERROR)
# include "ace/OS_NS_stdio.h"
#endif /* ACE_LACKS_STRERROR */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_LACKS_MEMCHR)
const void *
ACE_OS::memchr_emulation (const void *s, int c, size_t len)
{
const unsigned char *t = (const unsigned char *) s;
const unsigned char *e = (const unsigned char *) s + len;
+
while (t < e)
if (((int) *t) == c)
return t;
else
++t;
+
return 0;
}
#endif /* ACE_LACKS_MEMCHR */
+
#if (defined (ACE_LACKS_STRDUP) && !defined (ACE_STRDUP_EQUIVALENT)) \
|| defined (ACE_HAS_STRDUP_EMULATION)
char *
@@ -37,9 +47,11 @@ ACE_OS::strdup_emulation (const char *s)
char *t = (char *) ACE_OS::malloc (ACE_OS::strlen (s) + 1);
if (t == 0)
return 0;
+
return ACE_OS::strcpy (t, s);
}
#endif /* (ACE_LACKS_STRDUP && !ACE_STRDUP_EQUIVALENT) || ... */
+
#if defined (ACE_HAS_WCHAR)
#if (defined (ACE_LACKS_WCSDUP) && !defined (ACE_WCSDUP_EQUIVALENT)) \
|| defined (ACE_HAS_WCSDUP_EMULATION)
@@ -51,34 +63,43 @@ ACE_OS::strdup_emulation (const wchar_t *s)
* sizeof (wchar_t));
if (buffer == 0)
return 0;
+
return ACE_OS::strcpy (buffer, s);
}
#endif /* (ACE_LACKS_WCSDUP && !ACE_WCSDUP_EQUIVALENT) || ... */
#endif /* ACE_HAS_WCHAR */
+
char *
ACE_OS::strecpy (char *s, const char *t)
{
register char *dscan = s;
register const char *sscan = t;
+
while ((*dscan++ = *sscan++) != '\0')
continue;
+
return dscan;
}
+
#if defined (ACE_HAS_WCHAR)
wchar_t *
ACE_OS::strecpy (wchar_t *s, const wchar_t *t)
{
register wchar_t *dscan = s;
register const wchar_t *sscan = t;
+
while ((*dscan++ = *sscan++) != ACE_TEXT_WIDE ('\0'))
continue;
+
return dscan;
}
#endif /* ACE_HAS_WCHAR */
+
char *
ACE_OS::strerror (int errnum)
{
static char ret_errortext[128];
+
if (ACE::is_sock_error (errnum))
{
const ACE_TCHAR *errortext = ACE::sock_error (errnum);
@@ -99,6 +120,7 @@ ACE_OS::strerror (int errnum)
ACE_Errno_Guard g (errno);
errno = 0;
char *errmsg = 0;
+
#if defined (ACE_HAS_TR24731_2005_CRT)
errmsg = ret_errortext;
ACE_SECURECRTCALL (strerror_s (ret_errortext, sizeof(ret_errortext), errnum),
@@ -109,6 +131,7 @@ ACE_OS::strerror (int errnum)
errno = EINVAL;
#endif /* ACE_WIN32 */
errmsg = ::strerror (errnum);
+
if (errno == EINVAL || errmsg == 0 || errmsg[0] == 0)
{
ACE_OS::sprintf (ret_errortext, "Unknown error %d", errnum);
@@ -118,6 +141,7 @@ ACE_OS::strerror (int errnum)
return errmsg;
#endif /* ACE_LACKS_STRERROR */
}
+
#if defined (ACE_LACKS_STRERROR)
/**
* Just returns "Unknown Error" all the time.
@@ -128,58 +152,73 @@ ACE_OS::strerror_emulation (int errnum)
return "Unknown Error";
}
#endif /* ACE_LACKS_STRERROR */
+
const char *
ACE_OS::strnchr (const char *s, int c, size_t len)
{
for (size_t i = 0; i < len; ++i)
if (s[i] == c)
return s + i;
+
return 0;
}
+
const ACE_WCHAR_T *
ACE_OS::strnchr (const ACE_WCHAR_T *s, ACE_WCHAR_T c, size_t len)
{
for (size_t i = 0; i < len; ++i)
if (s[i] == c)
return s + i;
+
return 0;
}
+
const char *
ACE_OS::strnstr (const char *s1, const char *s2, size_t len2)
{
// Substring length
size_t const len1 = ACE_OS::strlen (s1);
+
// Check if the substring is longer than the string being searched.
if (len2 > len1)
return 0;
+
// Go upto <len>
size_t const len = len1 - len2;
+
for (size_t i = 0; i <= len; i++)
{
if (ACE_OS::memcmp (s1 + i, s2, len2) == 0)
// Found a match! Return the index.
return s1 + i;
}
+
return 0;
}
+
const ACE_WCHAR_T *
ACE_OS::strnstr (const ACE_WCHAR_T *s1, const ACE_WCHAR_T *s2, size_t len2)
{
// Substring length
const size_t len1 = ACE_OS::strlen (s1);
+
// Check if the substring is longer than the string being searched.
if (len2 > len1)
return 0;
+
// Go upto <len>
const size_t len = len1 - len2;
+
for (size_t i = 0; i <= len; i++)
{
if (ACE_OS::memcmp (s1 + i, s2, len2 * sizeof (ACE_WCHAR_T)) == 0)
// Found a match! Return the index.
return s1 + i;
}
+
return 0;
}
+
#if defined (ACE_HAS_MEMCPY_LOOP_UNROLL)
void *
ACE_OS::fast_memcpy (void *t, const void *s, size_t len)
@@ -210,36 +249,44 @@ ACE_OS::fast_memcpy (void *t, const void *s, size_t len)
}
}
#endif /* ACE_HAS_MEMCPY_LOOP_UNROLL */
+
#if defined (ACE_LACKS_STRRCHR)
char *
ACE_OS::strrchr_emulation (char *s, int c)
{
char *p = s + ACE_OS::strlen (s);
+
while (*p != c)
if (p == s)
return 0;
else
--p;
+
return p;
}
+
const char *
ACE_OS::strrchr_emulation (const char *s, int c)
{
const char *p = s + ACE_OS::strlen (s);
+
while (*p != c)
if (p == s)
return 0;
else
--p;
+
return p;
}
#endif /* ACE_LACKS_STRRCHR */
+
char *
ACE_OS::strsncpy (char *dst, const char *src, size_t maxlen)
{
register char *rdst = dst;
register const char *rsrc = src;
register size_t rmaxlen = maxlen;
+
if (rmaxlen > 0)
{
if (rdst!=rsrc)
@@ -256,12 +303,14 @@ ACE_OS::strsncpy (char *dst, const char *src, size_t maxlen)
}
return dst;
}
+
ACE_WCHAR_T *
ACE_OS::strsncpy (ACE_WCHAR_T *dst, const ACE_WCHAR_T *src, size_t maxlen)
{
register ACE_WCHAR_T *rdst = dst;
register const ACE_WCHAR_T *rsrc = src;
register size_t rmaxlen = maxlen;
+
if (rmaxlen > 0)
{
if (rdst!=rsrc)
@@ -278,6 +327,7 @@ ACE_OS::strsncpy (ACE_WCHAR_T *dst, const ACE_WCHAR_T *src, size_t maxlen)
}
return dst;
}
+
#if (!defined (ACE_HAS_REENTRANT_FUNCTIONS) || defined (ACE_LACKS_STRTOK_R)) \
&& !defined (ACE_HAS_TR24731_2005_CRT)
char *
@@ -301,6 +351,7 @@ ACE_OS::strtok_r_emulation (char *s, const char *tokens, char **lasts)
return s ;
}
#endif /* !ACE_HAS_REENTRANT_FUNCTIONS */
+
# if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSTOK)
wchar_t*
ACE_OS::strtok_r_emulation (ACE_WCHAR_T *s,
@@ -322,5 +373,6 @@ ACE_OS::strtok_r_emulation (ACE_WCHAR_T *s,
return sbegin;
}
# endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSTOK */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_NS_string.h b/dep/ACE_wrappers/ace/OS_NS_string.h
index 4dbdf06f703..d75fbce6ece 100644
--- a/dep/ACE_wrappers/ace/OS_NS_string.h
+++ b/dep/ACE_wrappers/ace/OS_NS_string.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file OS_NS_string.h
@@ -12,22 +13,31 @@
* Originally in OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_NS_STRING_H
#define ACE_OS_NS_STRING_H
+
# include /**/ "ace/pre.h"
+
# include "ace/config-lite.h"
+
# if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
# endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Basic_Types.h" // to get ACE_WCHAR_T,
// should be in os_stddef.h or not used like this.
#include /**/ "ace/ACE_export.h"
+
#if defined (ACE_EXPORT_MACRO)
# undef ACE_EXPORT_MACRO
#endif
#define ACE_EXPORT_MACRO ACE_Export
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE_OS {
+
/** @name Functions from <cstring>
*
* Included are the functions defined in <cstring> and their <cwchar>
@@ -36,23 +46,29 @@ namespace ACE_OS {
* @todo To be complete, we should add strcoll, and strxfrm.
*/
//@{
+
/// Finds characters in a buffer (const void version).
ACE_NAMESPACE_INLINE_FUNCTION
const void *memchr (const void *s, int c, size_t len);
+
/// Finds characters in a buffer (void version).
ACE_NAMESPACE_INLINE_FUNCTION
void *memchr (void *s, int c, size_t len);
+
#if defined (ACE_LACKS_MEMCHR)
/// Emulated memchr - Finds a character in a buffer.
extern ACE_Export
const void *memchr_emulation (const void *s, int c, size_t len);
#endif /* ACE_LACKS_MEMCHR */
+
/// Compares two buffers.
ACE_NAMESPACE_INLINE_FUNCTION
int memcmp (const void *t, const void *s, size_t len);
+
/// Copies one buffer to another.
ACE_NAMESPACE_INLINE_FUNCTION
void *memcpy (void *t, const void *s, size_t len);
+
#if defined (ACE_HAS_MEMCPY_LOOP_UNROLL)
/*
* Version of memcpy where the copy loop is unrolled.
@@ -62,90 +78,111 @@ namespace ACE_OS {
extern ACE_Export
void *fast_memcpy (void *t, const void *s, size_t len);
#endif
+
/// Moves one buffer to another.
ACE_NAMESPACE_INLINE_FUNCTION
void *memmove (void *t, const void *s, size_t len);
+
/// Fills a buffer with a character value.
ACE_NAMESPACE_INLINE_FUNCTION
void *memset (void *s, int c, size_t len);
+
/// Appends a string to another string (char version).
ACE_NAMESPACE_INLINE_FUNCTION
char *strcat (char *s, const char *t);
+
#if defined (ACE_HAS_WCHAR)
/// Appends a string to another string (wchar_t version).
ACE_NAMESPACE_INLINE_FUNCTION
wchar_t *strcat (wchar_t *s, const wchar_t *t);
#endif /* ACE_HAS_WCHAR */
+
/// Finds the first occurance of a character in a string (const char
/// version).
ACE_NAMESPACE_INLINE_FUNCTION
const char *strchr (const char *s, int c);
+
#if defined (ACE_HAS_WCHAR)
/// Finds the first occurance of a character in a string (const wchar_t
/// version).
ACE_NAMESPACE_INLINE_FUNCTION
const wchar_t *strchr (const wchar_t *s, wchar_t c);
#endif /* ACE_HAS_WCHAR */
+
/// Finds the first occurance of a character in a string (char version).
ACE_NAMESPACE_INLINE_FUNCTION
char *strchr (char *s, int c);
+
#if defined (ACE_HAS_WCHAR)
/// Finds the first occurance of a character in a string (wchar_t version).
ACE_NAMESPACE_INLINE_FUNCTION
wchar_t *strchr (wchar_t *s, wchar_t c);
#endif /* ACE_HAS_WCHAR */
+
/// Compares two strings (char version).
ACE_NAMESPACE_INLINE_FUNCTION
int strcmp (const char *s, const char *t);
+
/// Compares two strings (wchar_t version).
ACE_NAMESPACE_INLINE_FUNCTION
int strcmp (const ACE_WCHAR_T *s, const ACE_WCHAR_T *t);
+
/// Copies a string (char version).
ACE_NAMESPACE_INLINE_FUNCTION
char *strcpy (char *s, const char *t);
+
#if defined (ACE_HAS_WCHAR)
/// Copies a string (wchar_t version).
ACE_NAMESPACE_INLINE_FUNCTION
wchar_t *strcpy (wchar_t *s, const wchar_t *t);
#endif /* ACE_HAS_WCHAR */
+
/// Searches for the first substring without any of the specified
/// characters and returns the size of the substring (char version).
ACE_NAMESPACE_INLINE_FUNCTION
size_t strcspn (const char *s, const char *reject);
+
#if defined (ACE_HAS_WCHAR)
/// Searches for the first substring without any of the specified
/// characters and returns the size of the substring (wchar_t version).
ACE_NAMESPACE_INLINE_FUNCTION
size_t strcspn (const wchar_t *s, const wchar_t *reject);
#endif /* ACE_HAS_WCHAR */
+
/// Returns a malloced duplicated string (char version).
ACE_NAMESPACE_INLINE_FUNCTION
char *strdup (const char *s);
+
#if (defined (ACE_LACKS_STRDUP) && !defined(ACE_STRDUP_EQUIVALENT)) \
|| defined (ACE_HAS_STRDUP_EMULATION)
extern ACE_Export
char *strdup_emulation (const char *s);
#endif
+
#if defined (ACE_HAS_WCHAR)
/// Returns a malloced duplicated string (wchar_t version).
ACE_NAMESPACE_INLINE_FUNCTION
wchar_t *strdup (const wchar_t *s);
+
#if (defined (ACE_LACKS_WCSDUP) && !defined(ACE_WCSDUP_EQUIVALENT)) \
|| defined (ACE_HAS_WCSDUP_EMULATION)
extern ACE_Export
wchar_t *strdup_emulation (const wchar_t *s);
#endif
#endif /* ACE_HAS_WCHAR */
+
/// Copies a string, but returns a pointer to the end of the
/// copied region (char version).
extern ACE_Export
char *strecpy (char *des, const char *src);
+
#if defined (ACE_HAS_WCHAR)
/// Copies a string, but returns a pointer to the end of the
/// copied region (wchar_t version).
extern ACE_Export
wchar_t *strecpy (wchar_t *s, const wchar_t *t);
#endif /* ACE_HAS_WCHAR */
+
/*
** Returns a system error message. If the supplied errnum is out of range,
** a string of the form "Unknown error %d" is used to format the string
@@ -153,49 +190,63 @@ namespace ACE_OS {
*/
extern ACE_Export
char *strerror (int errnum);
+
#if defined (ACE_LACKS_STRERROR)
/// Emulated strerror - Returns a system error message.
extern ACE_Export
char *strerror_emulation (int errnum);
#endif /* ACE_LACKS_STRERROR */
+
/// Finds the length of a string (char version).
ACE_NAMESPACE_INLINE_FUNCTION
size_t strlen (const char *s);
+
/// Finds the length of a string (ACE_WCHAR_T version).
ACE_NAMESPACE_INLINE_FUNCTION
size_t strlen (const ACE_WCHAR_T *s);
+
/// Appends part of a string to another string (char version).
ACE_NAMESPACE_INLINE_FUNCTION
char *strncat (char *s, const char *t, size_t len);
+
/// Appends part of a string to another string (wchar_t version).
ACE_NAMESPACE_INLINE_FUNCTION
ACE_WCHAR_T *strncat (ACE_WCHAR_T *s, const ACE_WCHAR_T *t, size_t len);
+
/// Finds the first occurance of a character in an array (const char
/// version).
extern ACE_Export
const char *strnchr (const char *s, int c, size_t len);
+
/// Finds the first occurance of a character in an array (const ACE_WCHAR_T
/// version).
extern ACE_Export
const ACE_WCHAR_T *strnchr (const ACE_WCHAR_T *s, ACE_WCHAR_T c, size_t len);
+
/// Finds the first occurance of a character in an array (char version).
ACE_NAMESPACE_INLINE_FUNCTION
char *strnchr (char *s, int c, size_t len);
+
/// Finds the first occurance of a character in an array (ACE_WCHAR_T version).
ACE_NAMESPACE_INLINE_FUNCTION
ACE_WCHAR_T *strnchr (ACE_WCHAR_T *s, ACE_WCHAR_T c, size_t len);
+
/// Compares two arrays (char version).
ACE_NAMESPACE_INLINE_FUNCTION
int strncmp (const char *s, const char *t, size_t len);
+
/// Compares two arrays (wchar_t version).
ACE_NAMESPACE_INLINE_FUNCTION
int strncmp (const ACE_WCHAR_T *s, const ACE_WCHAR_T *t, size_t len);
+
/// Copies an array (char version)
ACE_NAMESPACE_INLINE_FUNCTION
char *strncpy (char *s, const char *t, size_t len);
+
/// Copies an array (ACE_WCHAR_T version)
ACE_NAMESPACE_INLINE_FUNCTION
ACE_WCHAR_T *strncpy (ACE_WCHAR_T *s, const ACE_WCHAR_T *t, size_t len);
+
/// Finds the length of a limited-length string (char version).
/**
* @param s The character string to find the length of.
@@ -207,6 +258,7 @@ namespace ACE_OS {
*/
ACE_NAMESPACE_INLINE_FUNCTION
size_t strnlen (const char *s, size_t maxlen);
+
/// Finds the length of a limited-length string (ACE_WCHAR_T version).
/**
* @param s The character string to find the length of.
@@ -218,66 +270,81 @@ namespace ACE_OS {
*/
ACE_NAMESPACE_INLINE_FUNCTION
size_t strnlen (const ACE_WCHAR_T *s, size_t maxlen);
+
/// Finds the first occurance of a substring in an array (const char
/// version).
extern ACE_Export
const char *strnstr (const char *s, const char *t, size_t len);
+
/// Finds the first occurance of a substring in an array (const wchar_t
/// version).
extern ACE_Export
const ACE_WCHAR_T *strnstr (const ACE_WCHAR_T *s,
const ACE_WCHAR_T *t,
size_t len);
+
/// Finds the first occurance of a substring in an array (char version).
ACE_NAMESPACE_INLINE_FUNCTION
char *strnstr (char *s, const char *t, size_t len);
+
/// Finds the first occurance of a substring in an array (wchar_t version).
ACE_NAMESPACE_INLINE_FUNCTION
ACE_WCHAR_T *strnstr (ACE_WCHAR_T *s, const ACE_WCHAR_T *t, size_t len);
+
/// Searches for characters in a string (const char version).
ACE_NAMESPACE_INLINE_FUNCTION
const char *strpbrk (const char *s1, const char *s2);
+
#if defined (ACE_HAS_WCHAR)
/// Searches for characters in a string (const wchar_t version).
ACE_NAMESPACE_INLINE_FUNCTION
const wchar_t *strpbrk (const wchar_t *s1, const wchar_t *s2);
#endif /* ACE_HAS_WCHAR */
+
/// Searches for characters in a string (char version).
ACE_NAMESPACE_INLINE_FUNCTION
char *strpbrk (char *s1, const char *s2);
+
#if defined (ACE_HAS_WCHAR)
/// Searches for characters in a string (wchar_t version).
ACE_NAMESPACE_INLINE_FUNCTION
wchar_t *strpbrk (wchar_t *s1, const wchar_t *s2);
#endif /* ACE_HAS_WCHAR */
+
/// Finds the last occurance of a character in a string (const char
/// version).
ACE_NAMESPACE_INLINE_FUNCTION
const char *strrchr (const char *s, int c);
+
#if defined (ACE_HAS_WCHAR)
/// Finds the last occurance of a character in a string (const wchar_t
/// version).
ACE_NAMESPACE_INLINE_FUNCTION
const wchar_t *strrchr (const wchar_t *s, wchar_t c);
#endif /* ACE_HAS_WCHAR */
+
/// Finds the last occurance of a character in a string (char version).
ACE_NAMESPACE_INLINE_FUNCTION
char *strrchr (char *s, int c);
+
#if defined (ACE_HAS_WCHAR)
/// Finds the last occurance of a character in a string (wchar_t version).
ACE_NAMESPACE_INLINE_FUNCTION
wchar_t *strrchr (wchar_t *s, wchar_t c);
#endif /* ACE_HAS_WCHAR */
+
#if defined (ACE_LACKS_STRRCHR)
/// Emulated strrchr (char version) - Finds the last occurance of a
/// character in a string.
extern ACE_Export
char *strrchr_emulation (char *s, int c);
+
/// Emulated strrchr (const char version) - Finds the last occurance of a
/// character in a string.
extern ACE_Export
const char *strrchr_emulation (const char *s, int c);
#endif /* ACE_LACKS_STRRCHR */
+
/// This is a "safe" c string copy function (char version).
/**
* Unlike strncpy() this function will always add a terminating '\0'
@@ -298,6 +365,7 @@ namespace ACE_OS {
char *strsncpy (char *dst,
const char *src,
size_t maxlen);
+
/// This is a "safe" c string copy function (wchar_t version).
/**
* Unlike strncpy() this function will always add a terminating '\0'
@@ -318,63 +386,79 @@ namespace ACE_OS {
ACE_WCHAR_T *strsncpy (ACE_WCHAR_T *dst,
const ACE_WCHAR_T *src,
size_t maxlen);
+
/// Searches for the first substring containing only the specified
/// characters and returns the size of the substring (char version).
ACE_NAMESPACE_INLINE_FUNCTION
size_t strspn (const char *s1, const char *s2);
+
#if defined (ACE_HAS_WCHAR)
/// Searches for the first substring containing only the specified
/// characters and returns the size of the substring (wchar_t version).
ACE_NAMESPACE_INLINE_FUNCTION
size_t strspn (const wchar_t *s1, const wchar_t *s2);
#endif /* ACE_HAS_WCHAR */
+
/// Finds the first occurance of a substring in a string (const char
/// version).
ACE_NAMESPACE_INLINE_FUNCTION
const char *strstr (const char *s, const char *t);
+
#if defined (ACE_HAS_WCHAR)
/// Finds the first occurance of a substring in a string (const wchar_t
/// version).
ACE_NAMESPACE_INLINE_FUNCTION
const wchar_t *strstr (const wchar_t *s, const wchar_t *t);
#endif /* ACE_HAS_WCHAR */
+
/// Finds the first occurance of a substring in a string (char version).
ACE_NAMESPACE_INLINE_FUNCTION
char *strstr (char *s, const char *t);
+
#if defined (ACE_HAS_WCHAR)
/// Finds the first occurance of a substring in a string (wchar_t version).
ACE_NAMESPACE_INLINE_FUNCTION
wchar_t *strstr (wchar_t *s, const wchar_t *t);
#endif /* ACE_HAS_WCHAR */
+
/// Finds the next token in a string (char version).
ACE_NAMESPACE_INLINE_FUNCTION
char *strtok (char *s, const char *tokens);
+
#if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_WCSTOK)
/// Finds the next token in a string (wchar_t version).
ACE_NAMESPACE_INLINE_FUNCTION
wchar_t *strtok (wchar_t *s, const wchar_t *tokens);
#endif /* ACE_HAS_WCHAR && !ACE_LACKS_WCSTOK */
+
//@}
+
/// Finds the next token in a string (safe char version).
ACE_NAMESPACE_INLINE_FUNCTION
char *strtok_r (char *s, const char *tokens, char **lasts);
+
#if defined (ACE_HAS_WCHAR)
/// Finds the next token in a string (wchar_t version).
ACE_NAMESPACE_INLINE_FUNCTION
wchar_t *strtok_r (ACE_WCHAR_T *s, const ACE_WCHAR_T *tokens, ACE_WCHAR_T **lasts);
#endif // ACE_HAS_WCHAR
+
#if !defined (ACE_HAS_REENTRANT_FUNCTIONS) || defined (ACE_LACKS_STRTOK_R)
/// Emulated strtok_r.
extern ACE_Export
char *strtok_r_emulation (char *s, const char *tokens, char **lasts);
#endif /* !ACE_HAS_REENTRANT_FUNCTIONS */
+
# if defined (ACE_HAS_WCHAR) && defined(ACE_LACKS_WCSTOK)
/// Emulated strtok_r (wchar_t version).
extern ACE_Export
wchar_t *strtok_r_emulation (ACE_WCHAR_T *s, const ACE_WCHAR_T *tokens, ACE_WCHAR_T **lasts);
# endif // ACE_HAS_WCHAR && ACE_LACKS_WCSTOK
+
} /* namespace ACE_OS */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# if defined (ACE_HAS_INLINED_OSCALLS)
# if defined (ACE_INLINE)
# undef ACE_INLINE
@@ -382,6 +466,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_INLINE inline
# include "ace/OS_NS_string.inl"
# endif /* ACE_HAS_INLINED_OSCALLS */
+
# include /**/ "ace/post.h"
#endif /* ACE_OS_NS_STRING_H */
diff --git a/dep/ACE_wrappers/ace/OS_NS_string.inl b/dep/ACE_wrappers/ace/OS_NS_string.inl
index 7577de45eea..8b9d15f30ac 100644
--- a/dep/ACE_wrappers/ace/OS_NS_string.inl
+++ b/dep/ACE_wrappers/ace/OS_NS_string.inl
@@ -1,11 +1,14 @@
// -*- C++ -*-
//
// $Id: OS_NS_string.inl 80826 2008-03-04 14:51:23Z wotte $
+
// OS_NS_wchar.h is only needed to get the emulation methods.
// Perhaps they should be moved. dhinton
#include "ace/OS_NS_wchar.h"
#include "ace/os_include/os_string.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE const void *
ACE_OS::memchr (const void *s, int c, size_t len)
{
@@ -15,6 +18,7 @@ ACE_OS::memchr (const void *s, int c, size_t len)
return ACE_OS::memchr_emulation (s, c, len);
#endif /* !ACE_LACKS_MEMCHR */
}
+
ACE_INLINE void *
ACE_OS::memchr (void *s, int c, size_t len)
{
@@ -22,11 +26,13 @@ ACE_OS::memchr (void *s, int c, size_t len)
c,
len));
}
+
ACE_INLINE int
ACE_OS::memcmp (const void *t, const void *s, size_t len)
{
return ::memcmp (t, s, len);
}
+
ACE_INLINE void *
ACE_OS::memcpy (void *t, const void *s, size_t len)
{
@@ -36,11 +42,13 @@ ACE_OS::memcpy (void *t, const void *s, size_t len)
return ::memcpy (t, s, len);
#endif /* ACE_HAS_MEMCPY_LOOP_UNROLL */
}
+
ACE_INLINE void *
ACE_OS::memmove (void *t, const void *s, size_t len)
{
return ::memmove (t, s, len);
}
+
ACE_INLINE void *
ACE_OS::memset (void *s, int c, size_t len)
{
@@ -89,16 +97,19 @@ ACE_OS::memset (void *s, int c, size_t len)
ptr[i] = c;
}
}
+
return s;
#else
return ::memset (s, c, len);
#endif /* ACE_HAS_SLOW_MEMSET */
}
+
ACE_INLINE char *
ACE_OS::strcat (char *s, const char *t)
{
return ::strcat (s, t);
}
+
#if defined (ACE_HAS_WCHAR)
ACE_INLINE wchar_t *
ACE_OS::strcat (wchar_t *s, const wchar_t *t)
@@ -110,11 +121,13 @@ ACE_OS::strcat (wchar_t *s, const wchar_t *t)
# endif /* ACE_LACKS_WCSCAT */
}
#endif /* ACE_HAS_WCHAR */
+
ACE_INLINE const char *
ACE_OS::strchr (const char *s, int c)
{
return const_cast <const char *> (::strchr (s, c));
}
+
#if defined (ACE_HAS_WCHAR)
ACE_INLINE const wchar_t *
ACE_OS::strchr (const wchar_t *s, wchar_t c)
@@ -126,11 +139,13 @@ ACE_OS::strchr (const wchar_t *s, wchar_t c)
# endif /* ACE_LACKS_WCSCHR */
}
#endif /* ACE_HAS_WCHAR */
+
ACE_INLINE char *
ACE_OS::strchr (char *s, int c)
{
return ::strchr (s, c);
}
+
#if defined (ACE_HAS_WCHAR)
ACE_INLINE wchar_t *
ACE_OS::strchr (wchar_t *s, wchar_t c)
@@ -140,11 +155,13 @@ ACE_OS::strchr (wchar_t *s, wchar_t c)
c));
}
#endif /* ACE_HAS_WCHAR */
+
ACE_INLINE int
ACE_OS::strcmp (const char *s, const char *t)
{
return ::strcmp (s, t);
}
+
ACE_INLINE int
ACE_OS::strcmp (const ACE_WCHAR_T *s, const ACE_WCHAR_T *t)
{
@@ -154,11 +171,13 @@ ACE_OS::strcmp (const ACE_WCHAR_T *s, const ACE_WCHAR_T *t)
return ::wcscmp (s, t);
# endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSCMP */
}
+
ACE_INLINE char *
ACE_OS::strcpy (char *s, const char *t)
{
return ::strcpy (s, t);
}
+
#if defined (ACE_HAS_WCHAR)
ACE_INLINE wchar_t *
ACE_OS::strcpy (wchar_t *s, const wchar_t *t)
@@ -170,11 +189,13 @@ ACE_OS::strcpy (wchar_t *s, const wchar_t *t)
# endif /* ACE_LACKS_WCSCPY */
}
#endif /* ACE_HAS_WCHAR */
+
ACE_INLINE size_t
ACE_OS::strcspn (const char *s, const char *reject)
{
return ::strcspn (s, reject);
}
+
#if defined (ACE_HAS_WCHAR)
ACE_INLINE size_t
ACE_OS::strcspn (const wchar_t *s, const wchar_t *reject)
@@ -186,6 +207,7 @@ ACE_OS::strcspn (const wchar_t *s, const wchar_t *reject)
# endif /* ACE_LACKS_WCSCSPN */
}
#endif /* ACE_HAS_WCHAR */
+
ACE_INLINE char *
ACE_OS::strdup (const char *s)
{
@@ -200,6 +222,7 @@ ACE_OS::strdup (const char *s)
return ::strdup (s);
# endif /* (ACE_LACKS_STRDUP && !ACE_STRDUP_EQUIVALENT) || ... */
}
+
#if defined (ACE_HAS_WCHAR)
ACE_INLINE wchar_t *
ACE_OS::strdup (const wchar_t *s)
@@ -216,11 +239,13 @@ ACE_OS::strdup (const wchar_t *s)
# endif /* (ACE_LACKS_WCSDUP && !ACE_WCSDUP_EQUIVALENT) || ... */
}
#endif /* ACE_HAS_WCHAR */
+
ACE_INLINE size_t
ACE_OS::strlen (const char *s)
{
return ::strlen (s);
}
+
ACE_INLINE size_t
ACE_OS::strlen (const ACE_WCHAR_T *s)
{
@@ -230,6 +255,7 @@ ACE_OS::strlen (const ACE_WCHAR_T *s)
return ::wcslen (s);
# endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSLEN */
}
+
ACE_INLINE char *
ACE_OS::strncat (char *s, const char *t, size_t len)
{
@@ -240,6 +266,7 @@ ACE_OS::strncat (char *s, const char *t, size_t len)
return ::strncat (s, t, len);
#endif /* ACE_HAS_TR24731_2005_CRT */
}
+
ACE_INLINE ACE_WCHAR_T *
ACE_OS::strncat (ACE_WCHAR_T *s, const ACE_WCHAR_T *t, size_t len)
{
@@ -252,6 +279,7 @@ ACE_OS::strncat (ACE_WCHAR_T *s, const ACE_WCHAR_T *t, size_t len)
return ::wcsncat (s, t, len);
# endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSNCAT */
}
+
ACE_INLINE char *
ACE_OS::strnchr (char *s, int c, size_t len)
{
@@ -259,6 +287,7 @@ ACE_OS::strnchr (char *s, int c, size_t len)
c,
len));
}
+
ACE_INLINE ACE_WCHAR_T *
ACE_OS::strnchr (ACE_WCHAR_T *s, ACE_WCHAR_T c, size_t len)
{
@@ -268,11 +297,13 @@ ACE_OS::strnchr (ACE_WCHAR_T *s, ACE_WCHAR_T c, size_t len)
c,
len));
}
+
ACE_INLINE int
ACE_OS::strncmp (const char *s, const char *t, size_t len)
{
return ::strncmp (s, t, len);
}
+
ACE_INLINE int
ACE_OS::strncmp (const ACE_WCHAR_T *s, const ACE_WCHAR_T *t, size_t len)
{
@@ -282,11 +313,13 @@ ACE_OS::strncmp (const ACE_WCHAR_T *s, const ACE_WCHAR_T *t, size_t len)
return ::wcsncmp (s, t, len);
# endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSNCMP */
}
+
ACE_INLINE char *
ACE_OS::strncpy (char *s, const char *t, size_t len)
{
return ::strncpy (s, t, len);
}
+
ACE_INLINE ACE_WCHAR_T *
ACE_OS::strncpy (ACE_WCHAR_T *s, const ACE_WCHAR_T *t, size_t len)
{
@@ -296,6 +329,7 @@ ACE_OS::strncpy (ACE_WCHAR_T *s, const ACE_WCHAR_T *t, size_t len)
return ::wcsncpy (s, t, len);
# endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSNCPY */
}
+
ACE_INLINE size_t
ACE_OS::strnlen (const char *s, size_t maxlen)
{
@@ -309,6 +343,7 @@ ACE_OS::strnlen (const char *s, size_t maxlen)
return i;
#endif /* ACE_HAS_STRNLEN */
}
+
ACE_INLINE size_t
ACE_OS::strnlen (const ACE_WCHAR_T *s, size_t maxlen)
{
@@ -322,12 +357,14 @@ ACE_OS::strnlen (const ACE_WCHAR_T *s, size_t maxlen)
return i;
#endif /* ACE_HAS_WCSNLEN */
}
+
ACE_INLINE char *
ACE_OS::strnstr (char *s, const char *t, size_t len)
{
return
const_cast <char *> (ACE_OS::strnstr (const_cast <const char *> (s), t, len));
}
+
ACE_INLINE ACE_WCHAR_T *
ACE_OS::strnstr (ACE_WCHAR_T *s, const ACE_WCHAR_T *t, size_t len)
{
@@ -337,11 +374,13 @@ ACE_OS::strnstr (ACE_WCHAR_T *s, const ACE_WCHAR_T *t, size_t len)
t,
len));
}
+
ACE_INLINE const char *
ACE_OS::strpbrk (const char *s1, const char *s2)
{
return const_cast <const char *> (::strpbrk (s1, s2));
}
+
#if defined (ACE_HAS_WCHAR)
ACE_INLINE const wchar_t *
ACE_OS::strpbrk (const wchar_t *s, const wchar_t *t)
@@ -353,11 +392,13 @@ ACE_OS::strpbrk (const wchar_t *s, const wchar_t *t)
# endif /* ACE_LACKS_WCSPBRK */
}
#endif /* ACE_HAS_WCHAR */
+
ACE_INLINE char *
ACE_OS::strpbrk (char *s1, const char *s2)
{
return ::strpbrk (s1, s2);
}
+
#if defined (ACE_HAS_WCHAR)
ACE_INLINE wchar_t *
ACE_OS::strpbrk (wchar_t *s, const wchar_t *t)
@@ -366,6 +407,7 @@ ACE_OS::strpbrk (wchar_t *s, const wchar_t *t)
const_cast<const wchar_t *> (s), t));
}
#endif /* ACE_HAS_WCHAR */
+
ACE_INLINE const char *
ACE_OS::strrchr (const char *s, int c)
{
@@ -375,6 +417,7 @@ ACE_OS::strrchr (const char *s, int c)
return (const char *) ::strrchr (s, c);
#endif /* ! ACE_LACKS_STRRCHR */
}
+
#if defined (ACE_HAS_WCHAR)
ACE_INLINE const wchar_t *
ACE_OS::strrchr (const wchar_t *s, wchar_t c)
@@ -386,6 +429,7 @@ ACE_OS::strrchr (const wchar_t *s, wchar_t c)
#endif /* ! ACE_LACKS_WCSRCHR */
}
#endif /* ACE_HAS_WCHAR */
+
ACE_INLINE char *
ACE_OS::strrchr (char *s, int c)
{
@@ -395,6 +439,7 @@ ACE_OS::strrchr (char *s, int c)
return ::strrchr (s, c);
#endif /* ! ACE_LACKS_STRRCHR */
}
+
#if defined (ACE_HAS_WCHAR)
ACE_INLINE wchar_t *
ACE_OS::strrchr (wchar_t *s, wchar_t c)
@@ -403,11 +448,13 @@ ACE_OS::strrchr (wchar_t *s, wchar_t c)
const_cast<const wchar_t *> (s), c));
}
#endif /* ACE_HAS_WCHAR */
+
ACE_INLINE size_t
ACE_OS::strspn (const char *s, const char *t)
{
return ::strspn (s, t);
}
+
#if defined (ACE_HAS_WCHAR)
ACE_INLINE size_t
ACE_OS::strspn (const wchar_t *s, const wchar_t *t)
@@ -419,11 +466,13 @@ ACE_OS::strspn (const wchar_t *s, const wchar_t *t)
# endif /* ACE_LACKS_WCSSPN */
}
#endif /* ACE_HAS_WCHAR */
+
ACE_INLINE const char *
ACE_OS::strstr (const char *s, const char *t)
{
return (const char *) ::strstr (s, t);
}
+
#if defined (ACE_HAS_WCHAR)
ACE_INLINE const wchar_t *
ACE_OS::strstr (const wchar_t *s, const wchar_t *t)
@@ -437,11 +486,13 @@ ACE_OS::strstr (const wchar_t *s, const wchar_t *t)
# endif /* ACE_LACKS_WCSSTR */
}
#endif /* ACE_HAS_WCHAR */
+
ACE_INLINE char *
ACE_OS::strstr (char *s, const char *t)
{
return ::strstr (s, t);
}
+
#if defined (ACE_HAS_WCHAR)
ACE_INLINE wchar_t *
ACE_OS::strstr (wchar_t *s, const wchar_t *t)
@@ -455,11 +506,13 @@ ACE_OS::strstr (wchar_t *s, const wchar_t *t)
# endif /* ACE_LACKS_WCSSTR */
}
#endif /* ACE_HAS_WCHAR */
+
ACE_INLINE char *
ACE_OS::strtok (char *s, const char *tokens)
{
return ::strtok (s, tokens);
}
+
#if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_WCSTOK)
ACE_INLINE wchar_t *
ACE_OS::strtok (wchar_t *s, const wchar_t *tokens)
@@ -472,6 +525,7 @@ ACE_OS::strtok (wchar_t *s, const wchar_t *tokens)
#endif /* ACE_HAS_3_PARAM_WCSTOK */
}
#endif /* ACE_HAS_WCHAR && !ACE_LACKS_WCSTOK */
+
ACE_INLINE char *
ACE_OS::strtok_r (char *s, const char *tokens, char **lasts)
{
@@ -483,6 +537,7 @@ ACE_OS::strtok_r (char *s, const char *tokens, char **lasts)
return ACE_OS::strtok_r_emulation (s, tokens, lasts);
#endif /* (ACE_HAS_REENTRANT_FUNCTIONS) */
}
+
#if defined (ACE_HAS_WCHAR)
ACE_INLINE wchar_t*
ACE_OS::strtok_r (ACE_WCHAR_T *s, const ACE_WCHAR_T *tokens, ACE_WCHAR_T **lasts)
@@ -501,4 +556,5 @@ ACE_OS::strtok_r (ACE_WCHAR_T *s, const ACE_WCHAR_T *tokens, ACE_WCHAR_T **lasts
#endif /* ACE_LACKS_WCSTOK */
}
#endif // ACE_HAS_WCHAR
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_NS_strings.cpp b/dep/ACE_wrappers/ace/OS_NS_strings.cpp
index 3340fb2694e..74510861fe0 100644
--- a/dep/ACE_wrappers/ace/OS_NS_strings.cpp
+++ b/dep/ACE_wrappers/ace/OS_NS_strings.cpp
@@ -1,19 +1,26 @@
// $Id: OS_NS_strings.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_strings.h"
+
ACE_RCSID(ace, OS_NS_strings, "$Id: OS_NS_strings.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if !defined (ACE_HAS_INLINED_OSCALLS)
# include "ace/OS_NS_strings.inl"
#endif /* ACE_HAS_INLINED_OSCALLS */
+
#if defined (ACE_LACKS_STRCASECMP)
# include "ace/OS_NS_ctype.h"
#endif /* ACE_LACKS_STRCASECMP */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_LACKS_STRCASECMP)
int
ACE_OS::strcasecmp_emulation (const char *s, const char *t)
{
const char *scan1 = s;
const char *scan2 = t;
+
while (*scan1 != 0
&& ACE_OS::ace_tolower (*scan1)
== ACE_OS::ace_tolower (*scan2))
@@ -21,9 +28,11 @@ ACE_OS::strcasecmp_emulation (const char *s, const char *t)
++scan1;
++scan2;
}
+
// The following case analysis is necessary so that characters which
// look negative collate low against normal characters but high
// against the end-of-string NUL.
+
if (*scan1 == '\0' && *scan2 == '\0')
return 0;
else if (*scan1 == '\0')
@@ -34,6 +43,7 @@ ACE_OS::strcasecmp_emulation (const char *s, const char *t)
return ACE_OS::ace_tolower (*scan1) - ACE_OS::ace_tolower (*scan2);
}
#endif /* ACE_LACKS_STRCASECMP */
+
#if defined (ACE_LACKS_STRCASECMP)
int
ACE_OS::strncasecmp_emulation (const char *s,
@@ -43,6 +53,7 @@ ACE_OS::strncasecmp_emulation (const char *s,
const char *scan1 = s;
const char *scan2 = t;
size_t count = 0;
+
while (count++ < len
&& *scan1 != 0
&& ACE_OS::ace_tolower (*scan1)
@@ -51,11 +62,14 @@ ACE_OS::strncasecmp_emulation (const char *s,
++scan1;
++scan2;
}
+
if (count > len)
return 0;
+
// The following case analysis is necessary so that characters which
// look negative collate low against normal characters but high
// against the end-of-string NUL.
+
if (*scan1 == '\0' && *scan2 == '\0')
return 0;
else if (*scan1 == '\0')
@@ -66,5 +80,6 @@ ACE_OS::strncasecmp_emulation (const char *s,
return ACE_OS::ace_tolower (*scan1) - ACE_OS::ace_tolower (*scan2);
}
#endif /* ACE_LACKS_STRCASECMP */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_NS_strings.h b/dep/ACE_wrappers/ace/OS_NS_strings.h
index 8e0d4ea791e..7f1ad48c831 100644
--- a/dep/ACE_wrappers/ace/OS_NS_strings.h
+++ b/dep/ACE_wrappers/ace/OS_NS_strings.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file OS_NS_strings.h
@@ -12,49 +13,67 @@
* Originally in OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_NS_STRINGS_H
#define ACE_OS_NS_STRINGS_H
+
# include /**/ "ace/pre.h"
+
# include "ace/config-all.h"
+
# if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
# endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/os_strings.h"
#include /**/ "ace/ACE_export.h"
+
#if defined (ACE_EXPORT_MACRO)
# undef ACE_EXPORT_MACRO
#endif
#define ACE_EXPORT_MACRO ACE_Export
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Time_Value;
+
namespace ACE_OS
{
+
/// Compares two strings (case insensitive const char version).
ACE_NAMESPACE_INLINE_FUNCTION
int strcasecmp (const char *s, const char *t);
+
#if defined (ACE_HAS_WCHAR)
/// Compares two strings (case insensitive const wchar_t version).
ACE_NAMESPACE_INLINE_FUNCTION
int strcasecmp (const wchar_t *s, const wchar_t *t);
#endif /* ACE_HAS_WCHAR */
+
/// Compares two arrays (case insensitive const char version).
ACE_NAMESPACE_INLINE_FUNCTION
int strncasecmp (const char *s, const char *t, size_t len);
+
#if defined (ACE_HAS_WCHAR)
/// Compares two arrays (case insensitive const wchar_t version).
ACE_NAMESPACE_INLINE_FUNCTION
int strncasecmp (const wchar_t *s, const wchar_t *t, size_t len);
#endif /* ACE_HAS_WCHAR */
+
#if defined (ACE_LACKS_STRCASECMP)
/// Emulated strcasecmp - Performs a case insensitive comparison of strings.
extern ACE_Export
int strcasecmp_emulation (const char *s, const char *t);
+
/// Emulated strncasecmp - Performs a case insensitvie comparison of arrays.
extern ACE_Export
int strncasecmp_emulation (const char *s, const char *t, size_t len);
#endif /* ACE_LACKS_STRCASECMP */
+
} /* namespace ACE_OS */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# if defined (ACE_HAS_INLINED_OSCALLS)
# if defined (ACE_INLINE)
# undef ACE_INLINE
@@ -62,6 +81,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_INLINE inline
# include "ace/OS_NS_strings.inl"
# endif /* ACE_HAS_INLINED_OSCALLS */
+
# include /**/ "ace/post.h"
#endif /* ACE_OS_NS_STRINGS_H */
diff --git a/dep/ACE_wrappers/ace/OS_NS_strings.inl b/dep/ACE_wrappers/ace/OS_NS_strings.inl
index 7ee23d5850b..cb6f21e6592 100644
--- a/dep/ACE_wrappers/ace/OS_NS_strings.inl
+++ b/dep/ACE_wrappers/ace/OS_NS_strings.inl
@@ -1,10 +1,13 @@
// -*- C++ -*-
//
// $Id: OS_NS_strings.inl 80826 2008-03-04 14:51:23Z wotte $
+
#if defined (ACE_HAS_WCHAR)
# include "ace/OS_NS_wchar.h"
#endif /* ACE_HAS_WCHAR */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE int
ACE_OS::strcasecmp (const char *s, const char *t)
{
@@ -16,6 +19,7 @@ ACE_OS::strcasecmp (const char *s, const char *t)
return ::strcasecmp (s, t);
#endif /* ACE_LACKS_STRCASECMP */
}
+
#if defined (ACE_HAS_WCHAR)
ACE_INLINE int
ACE_OS::strcasecmp (const wchar_t *s, const wchar_t *t)
@@ -27,6 +31,7 @@ ACE_OS::strcasecmp (const wchar_t *s, const wchar_t *t)
# endif /* ACE_LACKS_WCSICMP */
}
#endif /* ACE_HAS_WCHAR */
+
ACE_INLINE int
ACE_OS::strncasecmp (const char *s, const char *t, size_t len)
{
@@ -38,6 +43,7 @@ ACE_OS::strncasecmp (const char *s, const char *t, size_t len)
return ::strncasecmp (s, t, len);
#endif /* ACE_LACKS_STRCASECMP */
}
+
#if defined (ACE_HAS_WCHAR)
ACE_INLINE int
ACE_OS::strncasecmp (const wchar_t *s, const wchar_t *t, size_t len)
@@ -49,4 +55,5 @@ ACE_OS::strncasecmp (const wchar_t *s, const wchar_t *t, size_t len)
#endif /* ACE_LACKS_WCSNICMP */
}
#endif /* ACE_HAS_WCHAR */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_NS_stropts.cpp b/dep/ACE_wrappers/ace/OS_NS_stropts.cpp
index e3f4bfcf867..0917715924a 100644
--- a/dep/ACE_wrappers/ace/OS_NS_stropts.cpp
+++ b/dep/ACE_wrappers/ace/OS_NS_stropts.cpp
@@ -1,10 +1,15 @@
// $Id: OS_NS_stropts.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_stropts.h"
+
ACE_RCSID(ace, OS_NS_stropts, "$Id: OS_NS_stropts.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if !defined (ACE_HAS_INLINED_OSCALLS)
# include "ace/OS_NS_stropts.inl"
#endif /* ACE_HAS_INLINED_OSCALLS */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
int
ACE_OS::ioctl (ACE_HANDLE socket,
unsigned long io_control_code,
@@ -41,6 +46,7 @@ ACE_OS::ioctl (ACE_HANDLE socket,
ACE_NOTSUP_RETURN (-1);
# endif /* ACE_HAS_WINSOCK2 */
}
+
#if !(defined (ACE_HAS_WINCE) && (UNDER_CE < 500))
int
ACE_OS::ioctl (ACE_HANDLE socket,
@@ -53,14 +59,18 @@ ACE_OS::ioctl (ACE_HANDLE socket,
ACE_OVERLAPPED_COMPLETION_FUNC func)
{
# if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
+
QOS qos;
unsigned long qos_len = sizeof (QOS);
+
if (io_control_code == SIO_SET_QOS)
{
qos.SendingFlowspec = *(ace_qos.sending_flowspec ());
qos.ReceivingFlowspec = *(ace_qos.receiving_flowspec ());
qos.ProviderSpecific = (WSABUF) ace_qos.provider_specific ();
+
qos_len += ace_qos.provider_specific ().iov_len;
+
ACE_SOCKCALL_RETURN (::WSAIoctl ((ACE_SOCKET) socket,
io_control_code,
&qos,
@@ -76,6 +86,7 @@ ACE_OS::ioctl (ACE_HANDLE socket,
else
{
unsigned long dwBufferLen = 0;
+
// Query for the buffer size.
int result = ::WSAIoctl ((ACE_SOCKET) socket,
io_control_code,
@@ -87,9 +98,11 @@ ACE_OS::ioctl (ACE_HANDLE socket,
0,
0);
+
if (result == SOCKET_ERROR)
{
unsigned long dwErr = ::WSAGetLastError ();
+
if (dwErr == WSAEWOULDBLOCK)
{
errno = dwErr;
@@ -102,11 +115,14 @@ ACE_OS::ioctl (ACE_HANDLE socket,
return -1;
}
}
+
char *qos_buf = 0;
ACE_NEW_RETURN (qos_buf,
char [dwBufferLen],
-1);
+
QOS *qos = reinterpret_cast<QOS*> (qos_buf);
+
result = ::WSAIoctl ((ACE_SOCKET) socket,
io_control_code,
0,
@@ -116,8 +132,10 @@ ACE_OS::ioctl (ACE_HANDLE socket,
bytes_returned,
0,
0);
+
if (result == SOCKET_ERROR)
return result;
+
ACE_Flow_Spec sending_flowspec (qos->SendingFlowspec.TokenRate,
qos->SendingFlowspec.TokenBucketSize,
qos->SendingFlowspec.PeakBandwidth,
@@ -134,6 +152,7 @@ ACE_OS::ioctl (ACE_HANDLE socket,
# endif /* ACE_HAS_WINSOCK2_GQOS */
0,
0);
+
ACE_Flow_Spec receiving_flowspec (qos->ReceivingFlowspec.TokenRate,
qos->ReceivingFlowspec.TokenBucketSize,
qos->ReceivingFlowspec.PeakBandwidth,
@@ -150,12 +169,15 @@ ACE_OS::ioctl (ACE_HANDLE socket,
# endif /* ACE_HAS_WINSOCK2_GQOS */
0,
0);
+
ace_qos.sending_flowspec (&sending_flowspec);
ace_qos.receiving_flowspec (&receiving_flowspec);
ace_qos.provider_specific (*((struct iovec *) (&qos->ProviderSpecific)));
+
return result;
}
+
# else
ACE_UNUSED_ARG (socket);
ACE_UNUSED_ARG (io_control_code);
@@ -169,5 +191,6 @@ ACE_OS::ioctl (ACE_HANDLE socket,
# endif /* ACE_HAS_WINSOCK2 */
}
#endif /* !(defined (ACE_HAS_WINCE) && (UNDER_CE < 500)) */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_NS_stropts.h b/dep/ACE_wrappers/ace/OS_NS_stropts.h
index 24b0da083a1..edae88c3e25 100644
--- a/dep/ACE_wrappers/ace/OS_NS_stropts.h
+++ b/dep/ACE_wrappers/ace/OS_NS_stropts.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file OS_NS_stropts.h
@@ -12,26 +13,36 @@
* Originally in OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_NS_STROPTS_H
#define ACE_OS_NS_STROPTS_H
+
# include /**/ "ace/pre.h"
+
# include "ace/config-all.h"
+
# if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
# endif /* ACE_LACKS_PRAGMA_ONCE */
+
# ifndef ACE_IOCTL_TYPE_ARG2
# define ACE_IOCTL_TYPE_ARG2 int
# endif
+
#include "ace/os_include/os_stropts.h"
#include "ace/os_include/os_stdio.h"
#include /**/ "ace/ACE_export.h"
+
#if defined (ACE_EXPORT_MACRO)
# undef ACE_EXPORT_MACRO
#endif
#define ACE_EXPORT_MACRO ACE_Export
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
typedef WSAPROTOCOL_INFO ACE_Protocol_Info;
+
// Callback function that's used by the QoS-enabled <ACE_OS::ioctl>
// method.
typedef LPWSAOVERLAPPED_COMPLETION_ROUTINE ACE_OVERLAPPED_COMPLETION_FUNC;
@@ -44,6 +55,7 @@ struct ACE_Protocol_Info
int iProtocol;
char szProtocol[255+1];
};
+
// Callback function that's used by the QoS-enabled <ACE_OS::ioctl>
// method.
typedef void (*ACE_OVERLAPPED_COMPLETION_FUNC) (unsigned long error,
@@ -51,7 +63,9 @@ typedef void (*ACE_OVERLAPPED_COMPLETION_FUNC) (unsigned long error,
ACE_OVERLAPPED *overlapped,
unsigned long flags);
typedef unsigned long ACE_SOCK_GROUP;
+
#endif /* (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) */
+
// @todo: move this to it's own file... dhinton
/**
* @class ACE_Str_Buf
@@ -64,16 +78,21 @@ public:
// = Initialization method
/// Constructor.
ACE_Str_Buf (void *b = 0, int l = 0, int max = 0);
+
/// Constructor.
ACE_Str_Buf (strbuf &);
};
+
class ACE_QoS;
+
namespace ACE_OS {
+
ACE_NAMESPACE_INLINE_FUNCTION
int getmsg (ACE_HANDLE handle,
struct strbuf *ctl,
struct strbuf
*data, int *flags);
+
ACE_NAMESPACE_INLINE_FUNCTION
int getpmsg (ACE_HANDLE handle,
struct strbuf *ctl,
@@ -81,16 +100,20 @@ namespace ACE_OS {
*data,
int *band,
int *flags);
+
ACE_NAMESPACE_INLINE_FUNCTION
int fattach (int handle,
const char *path);
+
ACE_NAMESPACE_INLINE_FUNCTION
int fdetach (const char *file);
+
/// UNIX-style <ioctl>.
ACE_NAMESPACE_INLINE_FUNCTION
int ioctl (ACE_HANDLE handle,
ACE_IOCTL_TYPE_ARG2 cmd,
void * = 0);
+
/// QoS-enabled <ioctl>.
extern ACE_Export
int ioctl (ACE_HANDLE socket,
@@ -102,6 +125,7 @@ namespace ACE_OS {
unsigned long *bytes_returned,
ACE_OVERLAPPED *overlapped,
ACE_OVERLAPPED_COMPLETION_FUNC func);
+
#if !(defined (ACE_HAS_WINCE) && (UNDER_CE < 500))
/// QoS-enabled <ioctl> when the I/O control code is either
/// SIO_SET_QOS or SIO_GET_QOS.
@@ -115,21 +139,27 @@ namespace ACE_OS {
ACE_OVERLAPPED *overlapped = 0,
ACE_OVERLAPPED_COMPLETION_FUNC func = 0);
#endif /* !(defined (ACE_HAS_WINCE) && (UNDER_CE < 500)) */
+
ACE_NAMESPACE_INLINE_FUNCTION
int isastream (ACE_HANDLE handle);
+
ACE_NAMESPACE_INLINE_FUNCTION
int putmsg (ACE_HANDLE handle,
const struct strbuf *ctl,
const struct strbuf *data,
int flags);
+
ACE_NAMESPACE_INLINE_FUNCTION
int putpmsg (ACE_HANDLE handle,
const struct strbuf *ctl,
const struct strbuf *data,
int band,
int flags);
+
} /* namespace ACE_OS */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# if defined (ACE_HAS_INLINED_OSCALLS)
# if defined (ACE_INLINE)
# undef ACE_INLINE
@@ -137,6 +167,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_INLINE inline
# include "ace/OS_NS_stropts.inl"
# endif /* ACE_HAS_INLINED_OSCALLS */
+
# include /**/ "ace/post.h"
#endif /* ACE_OS_NS_STROPTS_H */
diff --git a/dep/ACE_wrappers/ace/OS_NS_stropts.inl b/dep/ACE_wrappers/ace/OS_NS_stropts.inl
index 16d8a9d5ce1..04200747c57 100644
--- a/dep/ACE_wrappers/ace/OS_NS_stropts.inl
+++ b/dep/ACE_wrappers/ace/OS_NS_stropts.inl
@@ -1,18 +1,22 @@
// -*- C++ -*-
//
// $Id: OS_NS_stropts.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/os_include/os_errno.h"
#include "ace/OS_NS_unistd.h"
#include "ace/OS_NS_string.h"
#include "ace/OS_NS_macros.h"
#include "ace/OS_Memory.h"
#include "ace/OS_QoS.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_LACKS_CONST_STRBUF_PTR)
typedef struct strbuf *ACE_STRBUF_TYPE;
#else
typedef const struct strbuf *ACE_STRBUF_TYPE;
#endif /* ACE_LACKS_CONST_STRBUF_PTR */
+
ACE_INLINE
ACE_Str_Buf::ACE_Str_Buf (void *b, int l, int max)
{
@@ -20,6 +24,7 @@ ACE_Str_Buf::ACE_Str_Buf (void *b, int l, int max)
this->len = l;
this->buf = (char *) b;
}
+
ACE_INLINE
ACE_Str_Buf::ACE_Str_Buf (strbuf &sb)
{
@@ -27,7 +32,9 @@ ACE_Str_Buf::ACE_Str_Buf (strbuf &sb)
this->len = sb.len;
this->buf = sb.buf;
}
+
/*****************************************************************************/
+
ACE_INLINE int
ACE_OS::getmsg (ACE_HANDLE handle,
struct strbuf *ctl,
@@ -42,10 +49,12 @@ ACE_OS::getmsg (ACE_HANDLE handle,
ACE_UNUSED_ARG (ctl);
ACE_UNUSED_ARG (data);
ACE_UNUSED_ARG (flags);
+
// I'm not sure how to implement this correctly.
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_STREAM_PIPES */
}
+
ACE_INLINE int
ACE_OS::getpmsg (ACE_HANDLE handle,
struct strbuf *ctl,
@@ -62,10 +71,12 @@ ACE_OS::getpmsg (ACE_HANDLE handle,
ACE_UNUSED_ARG (data);
ACE_UNUSED_ARG (band);
ACE_UNUSED_ARG (flags);
+
// I'm not sure how to implement this correctly.
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_STREAM_PIPES */
}
+
ACE_INLINE int
ACE_OS::fattach (int handle, const char *path)
{
@@ -75,9 +86,11 @@ ACE_OS::fattach (int handle, const char *path)
#else
ACE_UNUSED_ARG (handle);
ACE_UNUSED_ARG (path);
+
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_STREAM_PIPES */
}
+
ACE_INLINE int
ACE_OS::fdetach (const char *file)
{
@@ -86,15 +99,18 @@ ACE_OS::fdetach (const char *file)
ACE_OSCALL_RETURN (::fdetach (file), int, -1);
#else
ACE_UNUSED_ARG (file);
+
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_STREAM_PIPES */
}
+
ACE_INLINE int
ACE_OS::ioctl (ACE_HANDLE handle,
ACE_IOCTL_TYPE_ARG2 cmd,
void *val)
{
ACE_OS_TRACE ("ACE_OS::ioctl");
+
#if defined (ACE_WIN32)
ACE_SOCKET sock = (ACE_SOCKET) handle;
ACE_SOCKCALL_RETURN (::ioctlsocket (sock, cmd, reinterpret_cast<unsigned long *> (val)), int, -1);
@@ -105,6 +121,7 @@ ACE_OS::ioctl (ACE_HANDLE handle,
ACE_OSCALL_RETURN (::ioctl (handle, cmd, val), int, -1);
#endif /* ACE_WIN32 */
}
+
ACE_INLINE int
ACE_OS::isastream (ACE_HANDLE handle)
{
@@ -113,9 +130,11 @@ ACE_OS::isastream (ACE_HANDLE handle)
ACE_OSCALL_RETURN (::isastream (handle), int, -1);
#else
ACE_UNUSED_ARG (handle);
+
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_STREAM_PIPES */
}
+
ACE_INLINE int
ACE_OS::putmsg (ACE_HANDLE handle, const struct strbuf *ctl,
const struct strbuf *data, int flags)
@@ -158,6 +177,7 @@ ACE_OS::putmsg (ACE_HANDLE handle, const struct strbuf *ctl,
}
#endif /* ACE_HAS_STREAM_PIPES */
}
+
ACE_INLINE int
ACE_OS::putpmsg (ACE_HANDLE handle,
const struct strbuf *ctl,
@@ -177,4 +197,5 @@ ACE_OS::putpmsg (ACE_HANDLE handle,
return ACE_OS::putmsg (handle, ctl, data, flags);
#endif /* ACE_HAS_STREAM_PIPES */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_NS_sys_mman.cpp b/dep/ACE_wrappers/ace/OS_NS_sys_mman.cpp
index 02cdcef84c6..d4224bb5d59 100644
--- a/dep/ACE_wrappers/ace/OS_NS_sys_mman.cpp
+++ b/dep/ACE_wrappers/ace/OS_NS_sys_mman.cpp
@@ -1,7 +1,11 @@
// $Id: OS_NS_sys_mman.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_sys_mman.h"
+
ACE_RCSID(ace, OS_NS_sys_mman, "$Id: OS_NS_sys_mman.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if !defined (ACE_HAS_INLINED_OSCALLS)
# include "ace/OS_NS_sys_mman.inl"
#endif /* ACE_HAS_INLINED_OSCALLS */
+
diff --git a/dep/ACE_wrappers/ace/OS_NS_sys_mman.h b/dep/ACE_wrappers/ace/OS_NS_sys_mman.h
index f7c3988247d..b9015a7fa61 100644
--- a/dep/ACE_wrappers/ace/OS_NS_sys_mman.h
+++ b/dep/ACE_wrappers/ace/OS_NS_sys_mman.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file OS_NS_sys_mman.h
@@ -12,29 +13,39 @@
* Originally in OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_NS_SYS_MMAN_H
# define ACE_OS_NS_SYS_MMAN_H
+
# include /**/ "ace/pre.h"
+
# include "ace/config-all.h"
+
# if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
# endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Global_Macros.h"
#include "ace/os_include/sys/os_types.h"
#include "ace/os_include/sys/os_mman.h"
#include /**/ "ace/ACE_export.h"
+
#if defined (ACE_EXPORT_MACRO)
# undef ACE_EXPORT_MACRO
#endif
#define ACE_EXPORT_MACRO ACE_Export
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE_OS
{
+
//@{ @name A set of wrappers for memory mapped files.
ACE_NAMESPACE_INLINE_FUNCTION
int madvise (caddr_t addr,
size_t len,
int map_advice);
+
ACE_NAMESPACE_INLINE_FUNCTION
void *mmap (void *addr,
size_t len,
@@ -45,27 +56,35 @@ namespace ACE_OS
ACE_HANDLE *file_mapping = 0,
LPSECURITY_ATTRIBUTES sa = 0,
const ACE_TCHAR *file_mapping_name = 0);
+
ACE_NAMESPACE_INLINE_FUNCTION
int mprotect (void *addr,
size_t len,
int prot);
+
ACE_NAMESPACE_INLINE_FUNCTION
int msync (void *addr,
size_t len,
int sync);
+
ACE_NAMESPACE_INLINE_FUNCTION
int munmap (void *addr,
size_t len);
//@}
+
ACE_NAMESPACE_INLINE_FUNCTION
ACE_HANDLE shm_open (const ACE_TCHAR *filename,
int mode,
mode_t perms = 0,
LPSECURITY_ATTRIBUTES sa = 0);
+
ACE_NAMESPACE_INLINE_FUNCTION
int shm_unlink (const ACE_TCHAR *path);
+
} /* namespace ACE_OS */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# if defined (ACE_HAS_INLINED_OSCALLS)
# if defined (ACE_INLINE)
# undef ACE_INLINE
@@ -73,6 +92,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_INLINE inline
# include "ace/OS_NS_sys_mman.inl"
# endif /* ACE_HAS_INLINED_OSCALLS */
+
# include /**/ "ace/post.h"
#endif /* ACE_OS_NS_SYS_MMAN_H */
diff --git a/dep/ACE_wrappers/ace/OS_NS_sys_mman.inl b/dep/ACE_wrappers/ace/OS_NS_sys_mman.inl
index f64155b2c2a..de5935fb9b9 100644
--- a/dep/ACE_wrappers/ace/OS_NS_sys_mman.inl
+++ b/dep/ACE_wrappers/ace/OS_NS_sys_mman.inl
@@ -1,18 +1,22 @@
// -*- C++ -*-
//
// $Id: OS_NS_sys_mman.inl 82171 2008-06-25 13:32:01Z jtc $
+
#include "ace/OS_NS_fcntl.h"
#include "ace/OS_NS_unistd.h"
#include "ace/OS_NS_stdio.h"
#include "ace/OS_NS_macros.h"
#include "ace/OS_NS_errno.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_HAS_VOIDPTR_MMAP)
// Needed for some odd OS's (e.g., SGI).
typedef void *ACE_MMAP_TYPE;
#else
typedef char *ACE_MMAP_TYPE;
#endif /* ACE_HAS_VOIDPTR_MMAP */
+
ACE_INLINE int
ACE_OS::madvise (caddr_t addr, size_t len, int map_advice)
{
@@ -26,6 +30,7 @@ ACE_OS::madvise (caddr_t addr, size_t len, int map_advice)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_WIN32 */
}
+
ACE_INLINE void *
ACE_OS::mmap (void *addr,
size_t len,
@@ -41,7 +46,9 @@ ACE_OS::mmap (void *addr,
#if !defined (ACE_WIN32) || defined (ACE_HAS_PHARLAP)
ACE_UNUSED_ARG (file_mapping_name);
#endif /* !defined (ACE_WIN32) || defined (ACE_HAS_PHARLAP) */
+
#if defined (ACE_WIN32) && !defined (ACE_HAS_PHARLAP)
+
# if defined(ACE_HAS_WINCE)
ACE_UNUSED_ARG (addr);
if (ACE_BIT_ENABLED (flags, MAP_FIXED)) // not supported
@@ -58,11 +65,14 @@ ACE_OS::mmap (void *addr,
return MAP_FAILED;
}
# endif
+
int nt_flags = 0;
ACE_HANDLE local_handle = ACE_INVALID_HANDLE;
+
// Ensure that file_mapping is non-zero.
if (file_mapping == 0)
file_mapping = &local_handle;
+
if (ACE_BIT_ENABLED (flags, MAP_PRIVATE))
{
# if !defined(ACE_HAS_WINCE)
@@ -77,6 +87,7 @@ ACE_OS::mmap (void *addr,
if (ACE_BIT_ENABLED (prot, PAGE_READWRITE))
nt_flags = FILE_MAP_WRITE;
}
+
// Only create a new handle if we didn't have a valid one passed in.
if (*file_mapping == ACE_INVALID_HANDLE)
{
@@ -86,6 +97,7 @@ ACE_OS::mmap (void *addr,
ACE_OS::default_win32_security_attributes_r (sa,
&sa_buffer,
&sd_buffer);
+
*file_mapping = ACE_TEXT_CreateFileMapping (file_handle,
attr,
prot,
@@ -93,13 +105,17 @@ ACE_OS::mmap (void *addr,
0,
file_mapping_name);
}
+
if (*file_mapping == 0)
ACE_FAIL_RETURN (MAP_FAILED);
+
# if defined (ACE_OS_EXTRA_MMAP_FLAGS)
nt_flags |= ACE_OS_EXTRA_MMAP_FLAGS;
# endif /* ACE_OS_EXTRA_MMAP_FLAGS */
+
DWORD low_off = ACE_LOW_PART (off);
DWORD high_off = ACE_HIGH_PART (off);
+
# if !defined (ACE_HAS_WINCE)
void *addr_mapping = ::MapViewOfFileEx (*file_mapping,
nt_flags,
@@ -114,15 +130,18 @@ ACE_OS::mmap (void *addr,
low_off,
len);
# endif /* ! ACE_HAS_WINCE */
+
// Only close this down if we used the temporary.
if (file_mapping == &local_handle)
::CloseHandle (*file_mapping);
+
if (addr_mapping == 0)
ACE_FAIL_RETURN (MAP_FAILED);
else
return addr_mapping;
#elif !defined (ACE_LACKS_MMAP)
ACE_UNUSED_ARG (sa);
+
# if defined (ACE_OS_EXTRA_MMAP_FLAGS)
flags |= ACE_OS_EXTRA_MMAP_FLAGS;
# endif /* ACE_OS_EXTRA_MMAP_FLAGS */
@@ -153,10 +172,12 @@ ACE_OS::mmap (void *addr,
ACE_NOTSUP_RETURN (MAP_FAILED);
#endif /* ACE_WIN32 && !ACE_HAS_PHARLAP */
}
+
// Implements simple read/write control for pages. Affects a page if
// part of the page is referenced. Currently PROT_READ, PROT_WRITE,
// and PROT_RDWR has been mapped in OS.h. This needn't have anything
// to do with a mmap region.
+
ACE_INLINE int
ACE_OS::mprotect (void *addr, size_t len, int prot)
{
@@ -173,12 +194,14 @@ ACE_OS::mprotect (void *addr, size_t len, int prot)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_WIN32 && !ACE_HAS_PHARLAP */
}
+
ACE_INLINE int
ACE_OS::msync (void *addr, size_t len, int sync)
{
ACE_OS_TRACE ("ACE_OS::msync");
#if defined (ACE_WIN32) && !defined (ACE_HAS_PHARLAP)
ACE_UNUSED_ARG (sync);
+
ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::FlushViewOfFile (addr, len), ace_result_), int, -1);
#elif !defined (ACE_LACKS_MSYNC)
ACE_OSCALL_RETURN (::msync ((ACE_MMAP_TYPE) addr, len, sync), int, -1);
@@ -189,12 +212,14 @@ ACE_OS::msync (void *addr, size_t len, int sync)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_WIN32 && !ACE_HAS_PHARLAP */
}
+
ACE_INLINE int
ACE_OS::munmap (void *addr, size_t len)
{
ACE_OS_TRACE ("ACE_OS::munmap");
#if defined (ACE_WIN32)
ACE_UNUSED_ARG (len);
+
ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::UnmapViewOfFile (addr), ace_result_), int, -1);
#elif !defined (ACE_LACKS_MMAP)
ACE_OSCALL_RETURN (::munmap ((ACE_MMAP_TYPE) addr, len), int, -1);
@@ -204,6 +229,7 @@ ACE_OS::munmap (void *addr, size_t len)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_WIN32 */
}
+
ACE_INLINE ACE_HANDLE
ACE_OS::shm_open (const ACE_TCHAR *filename,
int mode,
@@ -239,6 +265,7 @@ ACE_OS::shm_open (const ACE_TCHAR *filename,
return ACE_OS::open (filename, mode, perms, sa);
#endif /* ACE_HAS_SHM_OPEN */
}
+
ACE_INLINE int
ACE_OS::shm_unlink (const ACE_TCHAR *path)
{
@@ -266,4 +293,5 @@ ACE_OS::shm_unlink (const ACE_TCHAR *path)
return ACE_OS::unlink (path);
#endif /* ACE_HAS_SHM_OPEN */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_NS_sys_msg.cpp b/dep/ACE_wrappers/ace/OS_NS_sys_msg.cpp
index f45a88480f4..4cc59b49b2a 100644
--- a/dep/ACE_wrappers/ace/OS_NS_sys_msg.cpp
+++ b/dep/ACE_wrappers/ace/OS_NS_sys_msg.cpp
@@ -1,7 +1,11 @@
// $Id: OS_NS_sys_msg.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_sys_msg.h"
+
ACE_RCSID(ace, OS_NS_sys_msg, "$Id: OS_NS_sys_msg.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if !defined (ACE_HAS_INLINED_OSCALLS)
# include "ace/OS_NS_sys_msg.inl"
#endif /* ACE_HAS_INLINED_OSCALLS */
+
diff --git a/dep/ACE_wrappers/ace/OS_NS_sys_msg.h b/dep/ACE_wrappers/ace/OS_NS_sys_msg.h
index d4554e20d0e..a2599407d8a 100644
--- a/dep/ACE_wrappers/ace/OS_NS_sys_msg.h
+++ b/dep/ACE_wrappers/ace/OS_NS_sys_msg.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file OS_NS_sys_msg.h
@@ -12,43 +13,58 @@
* Originally in OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_NS_SYS_MSG_H
# define ACE_OS_NS_SYS_MSG_H
+
# include /**/ "ace/pre.h"
+
# include "ace/config-all.h"
+
# if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
# endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/sys/os_msg.h"
#include /**/ "ace/ACE_export.h"
+
#if defined (ACE_EXPORT_MACRO)
# undef ACE_EXPORT_MACRO
#endif
#define ACE_EXPORT_MACRO ACE_Export
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE_OS {
+
//@{ @name A set of wrappers for System V message queues.
ACE_NAMESPACE_INLINE_FUNCTION
int msgctl (int msqid,
int cmd,
struct msqid_ds *);
+
ACE_NAMESPACE_INLINE_FUNCTION
int msgget (key_t key,
int msgflg);
+
ACE_NAMESPACE_INLINE_FUNCTION
ssize_t msgrcv (int int_id,
void *buf,
size_t len,
long type,
int flags);
+
ACE_NAMESPACE_INLINE_FUNCTION
int msgsnd (int int_id,
const void *buf,
size_t len,
int flags);
//@}
+
} /* namespace ACE_OS */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# if defined (ACE_HAS_INLINED_OSCALLS)
# if defined (ACE_INLINE)
# undef ACE_INLINE
@@ -56,6 +72,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_INLINE inline
# include "ace/OS_NS_sys_msg.inl"
# endif /* ACE_HAS_INLINED_OSCALLS */
+
# include /**/ "ace/post.h"
#endif /* ACE_OS_NS_SYS_MSG_H */
diff --git a/dep/ACE_wrappers/ace/OS_NS_sys_msg.inl b/dep/ACE_wrappers/ace/OS_NS_sys_msg.inl
index aa0f1f94a05..5fe12c84a4d 100644
--- a/dep/ACE_wrappers/ace/OS_NS_sys_msg.inl
+++ b/dep/ACE_wrappers/ace/OS_NS_sys_msg.inl
@@ -1,8 +1,11 @@
// -*- C++ -*-
//
// $Id: OS_NS_sys_msg.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_errno.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE int
ACE_OS::msgctl (int msqid, int cmd, struct msqid_ds *val)
{
@@ -13,9 +16,11 @@ ACE_OS::msgctl (int msqid, int cmd, struct msqid_ds *val)
ACE_UNUSED_ARG (msqid);
ACE_UNUSED_ARG (cmd);
ACE_UNUSED_ARG (val);
+
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_SYSV_IPC */
}
+
ACE_INLINE int
ACE_OS::msgget (key_t key, int msgflg)
{
@@ -25,9 +30,11 @@ ACE_OS::msgget (key_t key, int msgflg)
#else
ACE_UNUSED_ARG (key);
ACE_UNUSED_ARG (msgflg);
+
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_SYSV_IPC */
}
+
ACE_INLINE ssize_t
ACE_OS::msgrcv (int int_id, void *buf, size_t len,
long type, int flags)
@@ -42,9 +49,11 @@ ACE_OS::msgrcv (int int_id, void *buf, size_t len,
ACE_UNUSED_ARG (len);
ACE_UNUSED_ARG (type);
ACE_UNUSED_ARG (flags);
+
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_SYSV_IPC */
}
+
ACE_INLINE int
ACE_OS::msgsnd (int int_id, const void *buf, size_t len, int flags)
{
@@ -61,7 +70,9 @@ ACE_OS::msgsnd (int int_id, const void *buf, size_t len, int flags)
ACE_UNUSED_ARG (buf);
ACE_UNUSED_ARG (len);
ACE_UNUSED_ARG (flags);
+
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_SYSV_IPC */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_NS_sys_resource.cpp b/dep/ACE_wrappers/ace/OS_NS_sys_resource.cpp
index 22f9ce7eeb5..516d9e4d003 100644
--- a/dep/ACE_wrappers/ace/OS_NS_sys_resource.cpp
+++ b/dep/ACE_wrappers/ace/OS_NS_sys_resource.cpp
@@ -1,7 +1,11 @@
// $Id: OS_NS_sys_resource.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_sys_resource.h"
+
ACE_RCSID(ace, OS_NS_sys_resource, "$Id: OS_NS_sys_resource.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if !defined (ACE_HAS_INLINED_OSCALLS)
# include "ace/OS_NS_sys_resource.inl"
#endif /* ACE_HAS_INLINED_OSCALLS */
+
diff --git a/dep/ACE_wrappers/ace/OS_NS_sys_resource.h b/dep/ACE_wrappers/ace/OS_NS_sys_resource.h
index 84f33211746..5b9a7abea92 100644
--- a/dep/ACE_wrappers/ace/OS_NS_sys_resource.h
+++ b/dep/ACE_wrappers/ace/OS_NS_sys_resource.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file OS_NS_sys_resource.h
@@ -12,34 +13,48 @@
* Originally in OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_NS_SYS_RESOURCE_H
# define ACE_OS_NS_SYS_RESOURCE_H
+
# include /**/ "ace/pre.h"
+
# include "ace/config-all.h"
+
# if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
# endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/sys/os_resource.h"
#include /**/ "ace/ACE_export.h"
+
#if defined (ACE_EXPORT_MACRO)
# undef ACE_EXPORT_MACRO
#endif
#define ACE_EXPORT_MACRO ACE_Export
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE_OS
{
+
ACE_NAMESPACE_INLINE_FUNCTION
int getrlimit (int resource,
struct rlimit *rl);
+
ACE_NAMESPACE_INLINE_FUNCTION
int getrusage (int who,
struct rusage *rusage);
+
ACE_NAMESPACE_INLINE_FUNCTION
int setrlimit (int resource,
const struct rlimit *rl);
+
} /* namespace ACE_OS */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# if defined (ACE_HAS_INLINED_OSCALLS)
# if defined (ACE_INLINE)
# undef ACE_INLINE
@@ -47,6 +62,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_INLINE inline
# include "ace/OS_NS_sys_resource.inl"
# endif /* ACE_HAS_INLINED_OSCALLS */
+
# include /**/ "ace/post.h"
#endif /* ACE_OS_NS_SYS_RESOURCE_H */
diff --git a/dep/ACE_wrappers/ace/OS_NS_sys_resource.inl b/dep/ACE_wrappers/ace/OS_NS_sys_resource.inl
index 28f9338e8fb..f1f49da91ab 100644
--- a/dep/ACE_wrappers/ace/OS_NS_sys_resource.inl
+++ b/dep/ACE_wrappers/ace/OS_NS_sys_resource.inl
@@ -1,16 +1,21 @@
// -*- C++ -*-
//
// $Id: OS_NS_sys_resource.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_errno.h"
#include "ace/OS_NS_macros.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE int
ACE_OS::getrlimit (int resource, struct rlimit *rl)
{
ACE_OS_TRACE ("ACE_OS::getrlimit");
+
#if defined (ACE_LACKS_RLIMIT)
ACE_UNUSED_ARG (resource);
ACE_UNUSED_ARG (rl);
+
ACE_NOTSUP_RETURN (-1);
#else
# if defined (ACE_HAS_RLIMIT_RESOURCE_ENUM)
@@ -20,13 +25,16 @@ ACE_OS::getrlimit (int resource, struct rlimit *rl)
# endif /* ACE_HAS_RLIMIT_RESOURCE_ENUM */
#endif /* ACE_LACKS_RLIMIT */
}
+
ACE_INLINE int
ACE_OS::getrusage (int who, struct rusage *ru)
{
ACE_OS_TRACE ("ACE_OS::getrusage");
+
#if defined (ACE_HAS_GETRUSAGE)
# if defined (ACE_WIN32)
ACE_UNUSED_ARG (who);
+
# if defined (ACE_LACKS_GETPROCESSTIMES)
ACE_UNUSED_ARG (ru);
ACE_NOTSUP_RETURN (-1);
@@ -54,13 +62,16 @@ ACE_OS::getrusage (int who, struct rusage *ru)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_GETRUSAGE */
}
+
ACE_INLINE int
ACE_OS::setrlimit (int resource, const struct rlimit *rl)
{
ACE_OS_TRACE ("ACE_OS::setrlimit");
+
#if defined (ACE_LACKS_RLIMIT)
ACE_UNUSED_ARG (resource);
ACE_UNUSED_ARG (rl);
+
ACE_NOTSUP_RETURN (-1);
#else
# if defined (ACE_HAS_RLIMIT_RESOURCE_ENUM)
@@ -83,4 +94,5 @@ ACE_OS::setrlimit (int resource, const struct rlimit *rl)
# endif /* ACE_HAS_RLIMIT_RESOURCE_ENUM */
#endif /* ACE_LACKS_RLIMIT */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_NS_sys_select.cpp b/dep/ACE_wrappers/ace/OS_NS_sys_select.cpp
index f2c5fac289c..afe41b7a3e7 100644
--- a/dep/ACE_wrappers/ace/OS_NS_sys_select.cpp
+++ b/dep/ACE_wrappers/ace/OS_NS_sys_select.cpp
@@ -1,7 +1,11 @@
// $Id: OS_NS_sys_select.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_sys_select.h"
+
ACE_RCSID(ace, OS_NS_sys_select, "$Id: OS_NS_sys_select.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if !defined (ACE_HAS_INLINED_OSCALLS)
# include "ace/OS_NS_sys_select.inl"
#endif /* ACE_HAS_INLINED_OSCALLS */
+
diff --git a/dep/ACE_wrappers/ace/OS_NS_sys_select.h b/dep/ACE_wrappers/ace/OS_NS_sys_select.h
index 291c78f5740..8425f3eb66c 100644
--- a/dep/ACE_wrappers/ace/OS_NS_sys_select.h
+++ b/dep/ACE_wrappers/ace/OS_NS_sys_select.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file OS_NS_sys_select.h
@@ -12,26 +13,37 @@
* Originally in OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_NS_SYS_SELECT_H
# define ACE_OS_NS_SYS_SELECT_H
+
# include /**/ "ace/pre.h"
+
# include "ace/config-all.h"
+
# if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
# endif /* ACE_LACKS_PRAGMA_ONCE */
+
// The following is needed for Mac OSX 10.2 (Jaguar). Mac OSX 10.3 (Panther)
// doesn't seem to have this issue.
+
#if defined (ACE_SYS_SELECT_NEEDS_UNISTD_H)
#include "ace/OS_NS_unistd.h"
#endif
+
#include "ace/os_include/sys/os_select.h"
#include /**/ "ace/ACE_export.h"
+
#if defined (ACE_EXPORT_MACRO)
# undef ACE_EXPORT_MACRO
#endif
#define ACE_EXPORT_MACRO ACE_Export
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Time_Value;
+
namespace ACE_OS
{
// Should be moved to cpp or inl.
@@ -41,14 +53,18 @@ namespace ACE_OS
fd_set *wfds = 0,
fd_set *efds = 0,
const ACE_Time_Value *tv = 0);
+
ACE_NAMESPACE_INLINE_FUNCTION
int select (int width,
fd_set *rfds,
fd_set *wfds,
fd_set *efds,
const ACE_Time_Value &tv);
+
} /* namespace ACE_OS */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# if defined (ACE_HAS_INLINED_OSCALLS)
# if defined (ACE_INLINE)
# undef ACE_INLINE
@@ -56,6 +72,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_INLINE inline
# include "ace/OS_NS_sys_select.inl"
# endif /* ACE_HAS_INLINED_OSCALLS */
+
# include /**/ "ace/post.h"
#endif /* ACE_OS_NS_SYS_SELECT_H */
diff --git a/dep/ACE_wrappers/ace/OS_NS_sys_select.inl b/dep/ACE_wrappers/ace/OS_NS_sys_select.inl
index 7bbba081fb4..e58c6166ed5 100644
--- a/dep/ACE_wrappers/ace/OS_NS_sys_select.inl
+++ b/dep/ACE_wrappers/ace/OS_NS_sys_select.inl
@@ -1,10 +1,13 @@
// -*- C++ -*-
//
// $Id: OS_NS_sys_select.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_errno.h"
#include "ace/OS_NS_macros.h"
#include "ace/Time_Value.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// It would be really cool to add another version of select that would
// function like the one we're defending against below!
ACE_INLINE int
@@ -17,6 +20,7 @@ ACE_OS::select (int width,
// We must defend against non-conformity!
timeval copy;
timeval *timep = 0;
+
if (timeout != 0)
{
copy = *timeout;
@@ -42,6 +46,7 @@ ACE_OS::select (int width,
int, -1);
#endif
}
+
ACE_INLINE int
ACE_OS::select (int width,
fd_set *rfds, fd_set *wfds, fd_set *efds,
@@ -71,4 +76,5 @@ ACE_OS::select (int width,
#endif
#undef ___ACE_TIMEOUT
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_NS_sys_sendfile.cpp b/dep/ACE_wrappers/ace/OS_NS_sys_sendfile.cpp
index e69329512ab..bf0911d5653 100644
--- a/dep/ACE_wrappers/ace/OS_NS_sys_sendfile.cpp
+++ b/dep/ACE_wrappers/ace/OS_NS_sys_sendfile.cpp
@@ -1,15 +1,20 @@
// $Id: OS_NS_sys_sendfile.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_sys_sendfile.h"
#include "ace/OS_NS_sys_mman.h"
+
#if defined (ACE_WIN32) || defined (HPUX)
# include "ace/OS_NS_sys_socket.h"
#else
# include "ace/OS_NS_unistd.h"
#endif /* ACE_WIN32 || HPUX */
+
#ifndef ACE_HAS_INLINED_OSCALLS
# include "ace/OS_NS_sys_sendfile.inl"
#endif /* ACE_HAS_INLINED_OSCALLS */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
#ifndef ACE_HAS_SENDFILE
ssize_t
ACE_OS::sendfile_emulation (ACE_HANDLE out_fd,
@@ -19,24 +24,31 @@ ACE_OS::sendfile_emulation (ACE_HANDLE out_fd,
{
// @@ Is it possible to inline a call to ::TransmitFile() on
// MS Windows instead of emulating here?
+
// @@ We may want set up a signal lease (or oplock) if supported by
// the platform so that we don't get a bus error if the mmap()ed
// file is truncated.
void * const buf =
ACE_OS::mmap (0, count, PROT_READ, MAP_SHARED, in_fd, *offset);
+
if (buf == MAP_FAILED)
return -1;
+
#if defined (ACE_WIN32) || defined (HPUX)
ssize_t const r =
ACE_OS::send (out_fd, static_cast<const char *> (buf), count);
#else
ssize_t const r = ACE_OS::write (out_fd, buf, count);
#endif /* ACE_WIN32 */
+
(void) ACE_OS::munmap (buf, count);
+
if (r > 0)
*offset += static_cast<off_t> (r);
+
return r;
}
#endif /* !ACE_HAS_SENDFILE */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_NS_sys_sendfile.h b/dep/ACE_wrappers/ace/OS_NS_sys_sendfile.h
index a8a44d89d8d..85487530097 100644
--- a/dep/ACE_wrappers/ace/OS_NS_sys_sendfile.h
+++ b/dep/ACE_wrappers/ace/OS_NS_sys_sendfile.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file OS_NS_sys_sendfile.h
@@ -8,20 +9,28 @@
* @author Ossama Othman <ossama@dre.vanderbilt.edu>
*/
//=============================================================================
+
#ifndef ACE_OS_NS_SYS_SENDFILE_H
#define ACE_OS_NS_SYS_SENDFILE_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Basic_Types.h" /* For ssize_t and off_t. */
+
#if defined (ACE_EXPORT_MACRO)
# undef ACE_EXPORT_MACRO
#endif
#define ACE_EXPORT_MACRO ACE_Export
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE_OS
{
/// Finds the length of a string (char version).
@@ -30,6 +39,7 @@ namespace ACE_OS
ACE_HANDLE in_fd,
off_t * offset,
size_t count);
+
#ifndef ACE_HAS_SENDFILE
extern ACE_Export
ssize_t sendfile_emulation (ACE_HANDLE out_fd,
@@ -37,8 +47,11 @@ namespace ACE_OS
off_t * offset,
size_t count);
#endif /* !ACE_HAS_SENDFILE */
+
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# if defined (ACE_HAS_INLINED_OSCALLS)
# if defined (ACE_INLINE)
# undef ACE_INLINE
@@ -46,6 +59,8 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_INLINE inline
# include "ace/OS_NS_sys_sendfile.inl"
# endif /* ACE_HAS_INLINED_OSCALLS */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_OS_NS_SYS_SENDFILE_H */
diff --git a/dep/ACE_wrappers/ace/OS_NS_sys_sendfile.inl b/dep/ACE_wrappers/ace/OS_NS_sys_sendfile.inl
index b642bb47cb4..72270e8f396 100644
--- a/dep/ACE_wrappers/ace/OS_NS_sys_sendfile.inl
+++ b/dep/ACE_wrappers/ace/OS_NS_sys_sendfile.inl
@@ -1,10 +1,13 @@
// -*- C++ -*-
//
// $Id: OS_NS_sys_sendfile.inl 80826 2008-03-04 14:51:23Z wotte $
+
#ifdef ACE_HAS_SENDFILE
# include <sys/sendfile.h>
#endif /* ACE_HAS_SENDFILE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE ssize_t
ACE_OS::sendfile (ACE_HANDLE out_fd,
ACE_HANDLE in_fd,
@@ -17,4 +20,5 @@ ACE_OS::sendfile (ACE_HANDLE out_fd,
return ACE_OS::sendfile_emulation (out_fd, in_fd, offset, count);
#endif /* ACE_HAS_SENDFILE */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_NS_sys_shm.cpp b/dep/ACE_wrappers/ace/OS_NS_sys_shm.cpp
index 421f9ab8ce7..db4792c9476 100644
--- a/dep/ACE_wrappers/ace/OS_NS_sys_shm.cpp
+++ b/dep/ACE_wrappers/ace/OS_NS_sys_shm.cpp
@@ -1,7 +1,11 @@
// $Id: OS_NS_sys_shm.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_sys_shm.h"
+
ACE_RCSID(ace, OS_NS_sys_shm, "$Id: OS_NS_sys_shm.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if !defined (ACE_HAS_INLINED_OSCALLS)
# include "ace/OS_NS_sys_shm.inl"
#endif /* ACE_HAS_INLINED_OSCALLS */
+
diff --git a/dep/ACE_wrappers/ace/OS_NS_sys_shm.h b/dep/ACE_wrappers/ace/OS_NS_sys_shm.h
index 47fea577f4b..bd5cbadc80b 100644
--- a/dep/ACE_wrappers/ace/OS_NS_sys_shm.h
+++ b/dep/ACE_wrappers/ace/OS_NS_sys_shm.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file OS_NS_sys_shm.h
@@ -12,40 +13,55 @@
* Originally in OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_NS_SYS_SHM_H
# define ACE_OS_NS_SYS_SHM_H
+
# include /**/ "ace/pre.h"
+
# include "ace/config-all.h"
+
# if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
# endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/sys/os_shm.h"
#include /**/ "ace/ACE_export.h"
+
#if defined (ACE_EXPORT_MACRO)
# undef ACE_EXPORT_MACRO
#endif
#define ACE_EXPORT_MACRO ACE_Export
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE_OS
{
+
//@{ @name A set of wrappers for System V shared memory.
ACE_NAMESPACE_INLINE_FUNCTION
void *shmat (int int_id,
const void *shmaddr,
int shmflg);
+
ACE_NAMESPACE_INLINE_FUNCTION
int shmctl (int int_id,
int cmd,
struct shmid_ds *buf);
+
ACE_NAMESPACE_INLINE_FUNCTION
int shmdt (const void *shmaddr);
+
ACE_NAMESPACE_INLINE_FUNCTION
int shmget (key_t key,
size_t size,
int flags);
///@}
+
} /* namespace ACE_OS */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# if defined (ACE_HAS_INLINED_OSCALLS)
# if defined (ACE_INLINE)
# undef ACE_INLINE
@@ -53,6 +69,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_INLINE inline
# include "ace/OS_NS_sys_shm.inl"
# endif /* ACE_HAS_INLINED_OSCALLS */
+
# include /**/ "ace/post.h"
#endif /* ACE_OS_NS_SYS_SHM_H */
diff --git a/dep/ACE_wrappers/ace/OS_NS_sys_shm.inl b/dep/ACE_wrappers/ace/OS_NS_sys_shm.inl
index f6648c3fc1f..013d208438b 100644
--- a/dep/ACE_wrappers/ace/OS_NS_sys_shm.inl
+++ b/dep/ACE_wrappers/ace/OS_NS_sys_shm.inl
@@ -1,8 +1,11 @@
// -*- C++ -*-
//
// $Id: OS_NS_sys_shm.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_errno.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE void *
ACE_OS::shmat (int int_id, const void *shmaddr, int shmflg)
{
@@ -17,9 +20,11 @@ ACE_OS::shmat (int int_id, const void *shmaddr, int shmflg)
ACE_UNUSED_ARG (int_id);
ACE_UNUSED_ARG (shmaddr);
ACE_UNUSED_ARG (shmflg);
+
ACE_NOTSUP_RETURN ((void *) -1);
#endif /* ACE_HAS_SYSV_IPC */
}
+
ACE_INLINE int
ACE_OS::shmctl (int int_id, int cmd, struct shmid_ds *buf)
{
@@ -30,9 +35,11 @@ ACE_OS::shmctl (int int_id, int cmd, struct shmid_ds *buf)
ACE_UNUSED_ARG (buf);
ACE_UNUSED_ARG (cmd);
ACE_UNUSED_ARG (int_id);
+
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_SYSV_IPC */
}
+
ACE_INLINE int
ACE_OS::shmdt (const void *shmaddr)
{
@@ -46,9 +53,11 @@ ACE_OS::shmdt (const void *shmaddr)
# endif /* ACE_HAS_CHARPTR_SHMDT */
#else
ACE_UNUSED_ARG (shmaddr);
+
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_SYSV_IPC */
}
+
ACE_INLINE int
ACE_OS::shmget (key_t key, size_t size, int flags)
{
@@ -59,7 +68,9 @@ ACE_OS::shmget (key_t key, size_t size, int flags)
ACE_UNUSED_ARG (flags);
ACE_UNUSED_ARG (size);
ACE_UNUSED_ARG (key);
+
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_SYSV_IPC */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_NS_sys_socket.cpp b/dep/ACE_wrappers/ace/OS_NS_sys_socket.cpp
index 9fb017457d5..4c14784dd53 100644
--- a/dep/ACE_wrappers/ace/OS_NS_sys_socket.cpp
+++ b/dep/ACE_wrappers/ace/OS_NS_sys_socket.cpp
@@ -1,13 +1,19 @@
// $Id: OS_NS_sys_socket.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_sys_socket.h"
+
ACE_RCSID(ace, OS_NS_sys_socket, "$Id: OS_NS_sys_socket.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if !defined (ACE_HAS_INLINED_OSCALLS)
# include "ace/OS_NS_sys_socket.inl"
#endif /* ACE_HAS_INLINED_OSCALLS */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_WIN32)
int ACE_OS::socket_initialized_;
#endif /* ACE_WIN32 */
+
#if !(defined (ACE_HAS_WINCE) && (UNDER_CE < 500))
ACE_HANDLE
ACE_OS::accept (ACE_HANDLE handle,
@@ -30,6 +36,7 @@ ACE_OS::accept (ACE_HANDLE handle,
addrlen);
# endif /* ACE_HAS_WINSOCK2 */
}
+
int
ACE_OS::connect (ACE_HANDLE handle,
const sockaddr *addr,
@@ -53,6 +60,7 @@ ACE_OS::connect (ACE_HANDLE handle,
addrlen);
# endif /* ACE_HAS_WINSOCK2 */
}
+
ACE_HANDLE
ACE_OS::join_leaf (ACE_HANDLE socket,
const sockaddr *name,
@@ -60,11 +68,14 @@ ACE_OS::join_leaf (ACE_HANDLE socket,
const ACE_QoS_Params &qos_params)
{
# if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
+
QOS qos;
// Construct the WinSock2 QOS structure.
+
qos.SendingFlowspec = *(qos_params.socket_qos ()->sending_flowspec ());
qos.ReceivingFlowspec = *(qos_params.socket_qos ()->receiving_flowspec ());
qos.ProviderSpecific = (WSABUF) qos_params.socket_qos ()->provider_specific ();
+
ACE_SOCKCALL_RETURN (::WSAJoinLeaf ((ACE_SOCKET) socket,
name,
namelen,
@@ -75,6 +86,7 @@ ACE_OS::join_leaf (ACE_HANDLE socket,
qos_params.flags ()),
ACE_HANDLE,
ACE_INVALID_HANDLE);
+
# else
ACE_UNUSED_ARG (socket);
ACE_UNUSED_ARG (name);
@@ -84,6 +96,7 @@ ACE_OS::join_leaf (ACE_HANDLE socket,
# endif /* ACE_HAS_WINSOCK2 */
}
#endif /* !(defined (ACE_HAS_WINCE) && (UNDER_CE < 500)) */
+
int
ACE_OS::socket_init (int version_high, int version_low)
{
@@ -93,6 +106,7 @@ ACE_OS::socket_init (int version_high, int version_low)
WORD version_requested = MAKEWORD (version_high, version_low);
WSADATA wsa_data;
int error = WSAStartup (version_requested, &wsa_data);
+
if (error != 0)
# if defined (ACE_HAS_WINCE)
{
@@ -107,6 +121,7 @@ ACE_OS::socket_init (int version_high, int version_low)
"WSAGetLastError returned %d\n",
error);
# endif /* ACE_HAS_WINCE */
+
ACE_OS::socket_initialized_ = 1;
}
# else
@@ -115,6 +130,7 @@ ACE_OS::socket_init (int version_high, int version_low)
# endif /* ACE_WIN32 */
return 0;
}
+
int
ACE_OS::socket_fini (void)
{
@@ -141,5 +157,6 @@ ACE_OS::socket_fini (void)
# endif /* ACE_WIN32 */
return 0;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_NS_sys_socket.h b/dep/ACE_wrappers/ace/OS_NS_sys_socket.h
index 14ece7b1b5b..c545a2c017a 100644
--- a/dep/ACE_wrappers/ace/OS_NS_sys_socket.h
+++ b/dep/ACE_wrappers/ace/OS_NS_sys_socket.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file OS_NS_sys_socket.h
@@ -12,21 +13,28 @@
* Originally in OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_NS_SYS_SOCKET_H
# define ACE_OS_NS_SYS_SOCKET_H
+
# include /**/ "ace/pre.h"
+
# include "ace/config-all.h"
+
# if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
# endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/sys/os_socket.h"
#include "ace/os_include/net/os_if.h"
#include "ace/OS_NS_stropts.h"
#include /**/ "ace/ACE_export.h"
+
#if defined (ACE_EXPORT_MACRO)
# undef ACE_EXPORT_MACRO
#endif
#define ACE_EXPORT_MACRO ACE_Export
+
/// These are available values for the @a how argument to ACE_OS::shutdown().
#if defined (SD_RECEIVE)
#define ACE_SHUTDOWN_READ SD_RECEIVE
@@ -35,6 +43,7 @@
#else
#define ACE_SHUTDOWN_READ 0
#endif /* SD_RECEIVE */
+
#if defined (SD_SEND)
#define ACE_SHUTDOWN_WRITE SD_SEND
#elif defined (SHUT_WR)
@@ -42,6 +51,7 @@
#else
#define ACE_SHUTDOWN_WRITE 1
#endif /* SD_SEND */
+
#if defined (SD_BOTH)
#define ACE_SHUTDOWN_BOTH SD_BOTH
#elif defined (SHUT_RDWR)
@@ -49,21 +59,27 @@
#else
#define ACE_SHUTDOWN_BOTH 2
#endif /* SD_BOTH */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Accept_QoS_Params;
class ACE_QoS_Params;
+
namespace ACE_OS
{
+
# if defined (ACE_WIN32)
/// Keeps track of whether we've already initialized WinSock...
extern ACE_Export int socket_initialized_;
# endif /* ACE_WIN32 */
+
//@{ @name A set of wrappers for sockets.
/// BSD-style <accept> (no QoS).
ACE_NAMESPACE_INLINE_FUNCTION
ACE_HANDLE accept (ACE_HANDLE handle,
struct sockaddr *addr,
int *addrlen);
+
#if !(defined (ACE_HAS_WINCE) && (UNDER_CE < 500))
/**
* QoS-enabled <accept>, which passes @a qos_params to <accept>. If
@@ -76,18 +92,22 @@ namespace ACE_OS
int *addrlen,
const ACE_Accept_QoS_Params &qos_params);
#endif /* !(defined (ACE_HAS_WINCE) && (UNDER_CE < 500)) */
+
ACE_NAMESPACE_INLINE_FUNCTION
int bind (ACE_HANDLE s,
struct sockaddr *name,
int namelen);
+
/// Takes care of windows specific requirement to call closesocket
ACE_NAMESPACE_INLINE_FUNCTION
int closesocket (ACE_HANDLE s);
+
/// BSD-style <connect> (no QoS).
ACE_NAMESPACE_INLINE_FUNCTION
int connect (ACE_HANDLE handle,
struct sockaddr *addr,
int addrlen);
+
#if !(defined (ACE_HAS_WINCE) && (UNDER_CE < 500))
/**
* QoS-enabled <connect>, which passes @a qos_params to <connect>.
@@ -100,16 +120,19 @@ namespace ACE_OS
int addrlen,
const ACE_QoS_Params &qos_params);
#endif /* !(defined (ACE_HAS_WINCE) && (UNDER_CE < 500)) */
+
/// Retrieve information about available transport protocols
/// installed on the local machine. Windows specific...
ACE_NAMESPACE_INLINE_FUNCTION
int enum_protocols (int *protocols,
ACE_Protocol_Info *protocol_buffer,
u_long *buffer_length);
+
ACE_NAMESPACE_INLINE_FUNCTION
int getpeername (ACE_HANDLE handle,
struct sockaddr *addr,
int *addrlen);
+
ACE_NAMESPACE_INLINE_FUNCTION
int getsockname (ACE_HANDLE handle,
struct sockaddr *addr,
@@ -120,6 +143,7 @@ namespace ACE_OS
int optname,
char *optval,
int *optlen);
+
#if !(defined (ACE_HAS_WINCE) && (UNDER_CE < 500))
/// Joins a leaf node into a QoS-enabled multi-point session.
extern ACE_Export
@@ -128,14 +152,17 @@ namespace ACE_OS
int namelen,
const ACE_QoS_Params &qos_params);
#endif /* !(defined (ACE_HAS_WINCE) && (UNDER_CE < 500)) */
+
ACE_NAMESPACE_INLINE_FUNCTION
int listen (ACE_HANDLE handle,
int backlog);
+
ACE_NAMESPACE_INLINE_FUNCTION
ssize_t recv (ACE_HANDLE handle,
char *buf,
size_t len,
int flags = 0);
+
ACE_NAMESPACE_INLINE_FUNCTION
ssize_t recvfrom (ACE_HANDLE handle,
char *buf,
@@ -143,6 +170,7 @@ namespace ACE_OS
int flags,
struct sockaddr *addr,
int *addrlen);
+
ACE_NAMESPACE_INLINE_FUNCTION
ssize_t recvfrom (ACE_HANDLE handle,
iovec *buffers,
@@ -153,23 +181,28 @@ namespace ACE_OS
int *addrlen,
ACE_OVERLAPPED *overlapped,
ACE_OVERLAPPED_COMPLETION_FUNC func);
+
ACE_NAMESPACE_INLINE_FUNCTION
ssize_t recvmsg (ACE_HANDLE handle,
struct msghdr *msg,
int flags);
+
ACE_NAMESPACE_INLINE_FUNCTION
ssize_t recvv (ACE_HANDLE handle,
iovec *iov,
int iovlen);
+
ACE_NAMESPACE_INLINE_FUNCTION
ssize_t send (ACE_HANDLE handle,
const char *buf,
size_t len,
int flags = 0);
+
ACE_NAMESPACE_INLINE_FUNCTION
ssize_t sendmsg (ACE_HANDLE handle,
const struct msghdr *msg,
int flags);
+
ACE_NAMESPACE_INLINE_FUNCTION
ssize_t sendto (ACE_HANDLE handle,
const char *buf,
@@ -177,6 +210,7 @@ namespace ACE_OS
int flags,
const struct sockaddr *addr,
int addrlen);
+
ACE_NAMESPACE_INLINE_FUNCTION
ssize_t sendto (ACE_HANDLE handle,
const iovec *buffers,
@@ -187,11 +221,13 @@ namespace ACE_OS
int addrlen,
ACE_OVERLAPPED *overlapped,
ACE_OVERLAPPED_COMPLETION_FUNC func);
+
ACE_NAMESPACE_INLINE_FUNCTION
ssize_t sendv (ACE_HANDLE handle,
const iovec *iov,
int iovcnt);
+
/// Manipulate the options associated with a socket.
ACE_NAMESPACE_INLINE_FUNCTION
int setsockopt (ACE_HANDLE handle,
@@ -199,32 +235,41 @@ namespace ACE_OS
int optname,
const char *optval,
int optlen);
+
ACE_NAMESPACE_INLINE_FUNCTION
int shutdown (ACE_HANDLE handle,
int how);
+
#if defined (__linux__) && defined (ACE_HAS_IPV6)
ACE_NAMESPACE_INLINE_FUNCTION
unsigned int if_nametoindex (const char *ifname);
+
ACE_NAMESPACE_INLINE_FUNCTION
char *if_indextoname (unsigned int ifindex, char *ifname);
+
ACE_NAMESPACE_INLINE_FUNCTION
struct if_nameindex *if_nameindex (void);
+
ACE_NAMESPACE_INLINE_FUNCTION
void if_freenameindex (struct if_nameindex *ptr);
#endif /* __linux__ && ACE_HAS_IPV6 */
+
/// Initialize WinSock before first use (e.g., when a DLL is first
/// loaded or the first use of a socket() call.
extern ACE_Export
int socket_init (int version_high = 1,
int version_low = 1);
+
/// Finalize WinSock after last use (e.g., when a DLL is unloaded).
extern ACE_Export
int socket_fini (void);
+
/// Create a BSD-style socket (no QoS).
ACE_NAMESPACE_INLINE_FUNCTION
ACE_HANDLE socket (int protocol_family,
int type,
int proto);
+
/// Create a QoS-enabled socket. If the OS platform doesn't support
/// QoS-enabled <socket> then the BSD-style <socket> is called.
ACE_NAMESPACE_INLINE_FUNCTION
@@ -234,13 +279,17 @@ namespace ACE_OS
ACE_Protocol_Info *protocolinfo,
ACE_SOCK_GROUP g,
u_long flags);
+
ACE_NAMESPACE_INLINE_FUNCTION
int socketpair (int domain,
int type,
int protocol,
ACE_HANDLE sv[2]);
+
} /* namespace ACE_OS */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# if defined (ACE_HAS_INLINED_OSCALLS)
# if defined (ACE_INLINE)
# undef ACE_INLINE
@@ -248,6 +297,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_INLINE inline
# include "ace/OS_NS_sys_socket.inl"
# endif /* ACE_HAS_INLINED_OSCALLS */
+
# include /**/ "ace/post.h"
#endif /* ACE_OS_NS_SYS_SOCKET_H */
diff --git a/dep/ACE_wrappers/ace/OS_NS_sys_socket.inl b/dep/ACE_wrappers/ace/OS_NS_sys_socket.inl
index 7dbd938f91b..db63c418d84 100644
--- a/dep/ACE_wrappers/ace/OS_NS_sys_socket.inl
+++ b/dep/ACE_wrappers/ace/OS_NS_sys_socket.inl
@@ -1,6 +1,7 @@
// -*- C++ -*-
//
// $Id: OS_NS_sys_socket.inl 82342 2008-07-17 19:52:57Z shuston $
+
#include "ace/OS_NS_errno.h"
#include "ace/OS_NS_macros.h"
#include "ace/OS_NS_sys_uio.h"
@@ -8,11 +9,14 @@
#include "ace/OS_QoS.h"
#include "ace/Global_Macros.h"
#include "ace/os_include/netinet/os_in.h"
+
#if defined (ACE_GETNAME_RETURNS_RANDOM_SIN_ZERO) \
&& (ACE_GETNAME_RETURNS_RANDOM_SIN_ZERO == 1)
#include "ace/OS_NS_string.h"
#endif
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_HAS_VOIDPTR_SOCKOPT)
typedef void *ACE_SOCKOPT_TYPE1;
#elif defined (ACE_HAS_CHARPTR_SOCKOPT)
@@ -20,6 +24,7 @@ typedef char *ACE_SOCKOPT_TYPE1;
#else
typedef const char *ACE_SOCKOPT_TYPE1;
#endif /* ACE_HAS_VOIDPTR_SOCKOPT */
+
ACE_INLINE ACE_HANDLE
ACE_OS::accept (ACE_HANDLE handle,
struct sockaddr *addr,
@@ -35,6 +40,7 @@ ACE_OS::accept (ACE_HANDLE handle,
// handled explicitly here. If the ACE_OSCALL macro ever changes,
// this function needs to be reviewed. On Win32, the regular macros
// can be used, as this is not an issue.
+
#if defined (ACE_LACKS_ACCEPT)
ACE_UNUSED_ARG (handle);
ACE_UNUSED_ARG (addr);
@@ -50,10 +56,13 @@ ACE_OS::accept (ACE_HANDLE handle,
# if defined (ACE_HAS_BROKEN_ACCEPT_ADDR)
// Apparently some platforms like VxWorks can't correctly deal with
// a NULL addr.
+
sockaddr_in fake_addr;
int fake_addrlen;
+
if (addrlen == 0)
addrlen = &fake_addrlen;
+
if (addr == 0)
{
addr = (sockaddr *) &fake_addr;
@@ -63,6 +72,7 @@ ACE_OS::accept (ACE_HANDLE handle,
ACE_HANDLE ace_result = ::accept ((ACE_SOCKET) handle,
addr,
(ACE_SOCKET_LEN *) addrlen);
+
# if !(defined (EAGAIN) && defined (EWOULDBLOCK) && EAGAIN == EWOULDBLOCK)
// Optimize this code out if we can detect that EAGAIN ==
// EWOULDBLOCK at compile time. If we cannot detect equality at
@@ -78,9 +88,12 @@ ACE_OS::accept (ACE_HANDLE handle,
errno = EWOULDBLOCK;
}
# endif /* EAGAIN != EWOULDBLOCK*/
+
return ace_result;
+
#endif /* defined (ACE_WIN32) */
}
+
ACE_INLINE int
ACE_OS::bind (ACE_HANDLE handle, struct sockaddr *addr, int addrlen)
{
@@ -109,6 +122,7 @@ ACE_OS::bind (ACE_HANDLE handle, struct sockaddr *addr, int addrlen)
(ACE_SOCKET_LEN) addrlen), int, -1);
#endif
}
+
ACE_INLINE int
ACE_OS::closesocket (ACE_HANDLE handle)
{
@@ -118,6 +132,7 @@ ACE_OS::closesocket (ACE_HANDLE handle)
// applications that duplicate a handle on fork(), for
// example, and expect to continue writing in the fork()ed
// process.
+
ACE_SOCKCALL_RETURN (::closesocket ((SOCKET) handle), int, -1);
#else
//FUZZ: disable check_for_lack_ACE_OS
@@ -125,6 +140,7 @@ ACE_OS::closesocket (ACE_HANDLE handle)
//FUZZ: enable check_for_lack_ACE_OS
#endif /* ACE_WIN32 */
}
+
ACE_INLINE int
ACE_OS::connect (ACE_HANDLE handle,
struct sockaddr *addr,
@@ -142,17 +158,20 @@ ACE_OS::connect (ACE_HANDLE handle,
(ACE_SOCKET_LEN) addrlen), int, -1);
#endif /* ACE_LACKS_CONNECT */
}
+
ACE_INLINE int
ACE_OS::enum_protocols (int *protocols,
ACE_Protocol_Info *protocol_buffer,
u_long *buffer_length)
{
#if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
+
ACE_SOCKCALL_RETURN (::WSAEnumProtocols (protocols,
protocol_buffer,
buffer_length),
int,
SOCKET_ERROR);
+
#else
ACE_UNUSED_ARG (protocols);
ACE_UNUSED_ARG (protocol_buffer);
@@ -160,11 +179,13 @@ ACE_OS::enum_protocols (int *protocols,
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_WINSOCK2 */
}
+
ACE_INLINE int
ACE_OS::getpeername (ACE_HANDLE handle, struct sockaddr *addr,
int *addrlen)
{
ACE_OS_TRACE ("ACE_OS::getpeername");
+
#if defined (ACE_LACKS_GETPEERNAME)
ACE_UNUSED_ARG (handle);
ACE_UNUSED_ARG (addr);
@@ -179,6 +200,7 @@ ACE_OS::getpeername (ACE_HANDLE handle, struct sockaddr *addr,
int,
-1,
result);
+
// Some platforms, like older versions of the Linux kernel, do not
// initialize the sin_zero field since that field is generally only
// used for padding/alignment purposes. On those platforms
@@ -195,6 +217,7 @@ ACE_OS::getpeername (ACE_HANDLE handle, struct sockaddr *addr,
0,
sizeof (reinterpret_cast<struct sockaddr_in *> (addr)->sin_zero));
}
+
return result;
#else
ACE_SOCKCALL_RETURN (::getpeername ((ACE_SOCKET) handle,
@@ -204,6 +227,7 @@ ACE_OS::getpeername (ACE_HANDLE handle, struct sockaddr *addr,
-1);
#endif /* ACE_GETNAME_RETURNS_RANDOM_SIN_ZERO */
}
+
ACE_INLINE int
ACE_OS::getsockname (ACE_HANDLE handle,
struct sockaddr *addr,
@@ -222,6 +246,7 @@ ACE_OS::getsockname (ACE_HANDLE handle,
addr,
(ACE_SOCKET_LEN *) addrlen),
int, -1, result);
+
// Some platforms, like older versions of the Linux kernel, do not
// initialize the sin_zero field since that field is generally only
// used for padding/alignment purposes. On those platforms
@@ -238,6 +263,7 @@ ACE_OS::getsockname (ACE_HANDLE handle,
0,
sizeof (reinterpret_cast<struct sockaddr_in *> (addr)->sin_zero));
}
+
return result;
#else
ACE_SOCKCALL_RETURN (::getsockname ((ACE_SOCKET) handle,
@@ -246,6 +272,7 @@ ACE_OS::getsockname (ACE_HANDLE handle,
int, -1);
#endif /* ACE_GETNAME_RETURNS_RANDOM_SIN_ZERO */
}
+
ACE_INLINE int
ACE_OS::getsockopt (ACE_HANDLE handle,
int level,
@@ -271,6 +298,7 @@ ACE_OS::getsockopt (ACE_HANDLE handle,
-1);
#endif /* ACE_LACKS_GETSOCKOPT */
}
+
ACE_INLINE int
ACE_OS::listen (ACE_HANDLE handle, int backlog)
{
@@ -283,10 +311,12 @@ ACE_OS::listen (ACE_HANDLE handle, int backlog)
ACE_SOCKCALL_RETURN (::listen ((ACE_SOCKET) handle, backlog), int, -1);
#endif /* ACE_LACKS_LISTEN */
}
+
ACE_INLINE ssize_t
ACE_OS::recv (ACE_HANDLE handle, char *buf, size_t len, int flags)
{
ACE_OS_TRACE ("ACE_OS::recv");
+
// On UNIX, a non-blocking socket with no data to receive, this
// system call will return EWOULDBLOCK or EAGAIN, depending on the
// platform. UNIX 98 allows either errno, and they may be the same
@@ -308,6 +338,7 @@ ACE_OS::recv (ACE_HANDLE handle, char *buf, size_t len, int flags)
#else
ssize_t ace_result_;
ace_result_ = ::recv ((ACE_SOCKET) handle, buf, len, flags);
+
# if !(defined (EAGAIN) && defined (EWOULDBLOCK) && EAGAIN == EWOULDBLOCK)
// Optimize this code out if we can detect that EAGAIN ==
// EWOULDBLOCK at compile time. If we cannot detect equality at
@@ -323,9 +354,11 @@ ACE_OS::recv (ACE_HANDLE handle, char *buf, size_t len, int flags)
errno = EWOULDBLOCK;
}
# endif /* EAGAIN != EWOULDBLOCK*/
+
return ace_result_;
#endif /* ACE_LACKS_RECV */
}
+
ACE_INLINE ssize_t
ACE_OS::recvfrom (ACE_HANDLE handle,
char *buf,
@@ -381,6 +414,7 @@ ACE_OS::recvfrom (ACE_HANDLE handle,
ssize_t, -1);
#endif /* ACE_LACKS_RECVFROM */
}
+
ACE_INLINE ssize_t
ACE_OS::recvfrom (ACE_HANDLE handle,
iovec *buffers,
@@ -393,6 +427,7 @@ ACE_OS::recvfrom (ACE_HANDLE handle,
ACE_OVERLAPPED_COMPLETION_FUNC func)
{
ACE_OS_TRACE ("ACE_OS::recvfrom");
+
#if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
DWORD bytes_recvd;
DWORD the_flags = flags;
@@ -424,6 +459,7 @@ ACE_OS::recvfrom (ACE_HANDLE handle,
ACE_NOTSUP_RETURN (-1);
#endif /* defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) */
}
+
ACE_INLINE ssize_t
ACE_OS::recvmsg (ACE_HANDLE handle, struct msghdr *msg, int flags)
{
@@ -431,6 +467,7 @@ ACE_OS::recvmsg (ACE_HANDLE handle, struct msghdr *msg, int flags)
#if !defined (ACE_LACKS_RECVMSG)
# if (defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0))
DWORD bytes_received = 0;
+
int result = ::WSARecvFrom ((SOCKET) handle,
(WSABUF *) msg->msg_iov,
msg->msg_iovlen,
@@ -440,6 +477,7 @@ ACE_OS::recvmsg (ACE_HANDLE handle, struct msghdr *msg, int flags)
&msg->msg_namelen,
0,
0);
+
if (result != 0)
{
ACE_OS::set_errno_to_wsa_last_error ();
@@ -454,19 +492,24 @@ ACE_OS::recvmsg (ACE_HANDLE handle, struct msghdr *msg, int flags)
ACE_UNUSED_ARG (flags);
ACE_UNUSED_ARG (msg);
ACE_UNUSED_ARG (handle);
+
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_LACKS_RECVMSG */
}
+
ACE_INLINE ssize_t
ACE_OS::recvv (ACE_HANDLE handle,
iovec *buffers,
int n)
{
#if defined (ACE_HAS_WINSOCK2)
+
DWORD bytes_received = 0;
int result = 1;
+
// Winsock 2 has WSARecv and can do this directly, but Winsock 1 needs
// to do the recvs piece-by-piece.
+
# if (ACE_HAS_WINSOCK2 != 0)
DWORD flags = 0;
result = ::WSARecv ((SOCKET) handle,
@@ -479,6 +522,7 @@ ACE_OS::recvv (ACE_HANDLE handle,
# else
int i, chunklen;
char *chunkp = 0;
+
// Step through the buffers requested by caller; for each one, cycle
// through reads until it's filled or an error occurs.
for (i = 0; i < n && result > 0; ++i)
@@ -497,6 +541,7 @@ ACE_OS::recvv (ACE_HANDLE handle,
}
}
# endif /* ACE_HAS_WINSOCK2 != 0 */
+
if (result == SOCKET_ERROR)
{
ACE_OS::set_errno_to_wsa_last_error ();
@@ -508,10 +553,12 @@ ACE_OS::recvv (ACE_HANDLE handle,
return ACE_OS::readv (handle, buffers, n);
#endif /* ACE_HAS_WINSOCK2 */
}
+
ACE_INLINE ssize_t
ACE_OS::send (ACE_HANDLE handle, const char *buf, size_t len, int flags)
{
ACE_OS_TRACE ("ACE_OS::send");
+
// On UNIX, a non-blocking socket with no data to receive, this
// system call will return EWOULDBLOCK or EAGAIN, depending on the
// platform. UNIX 98 allows either errno, and they may be the same
@@ -534,6 +581,7 @@ ACE_OS::send (ACE_HANDLE handle, const char *buf, size_t len, int flags)
flags), ssize_t, -1);
#else
ssize_t const ace_result_ = ::send ((ACE_SOCKET) handle, buf, len, flags);
+
# if !(defined (EAGAIN) && defined (EWOULDBLOCK) && EAGAIN == EWOULDBLOCK)
// Optimize this code out if we can detect that EAGAIN ==
// EWOULDBLOCK at compile time. If we cannot detect equality at
@@ -549,9 +597,11 @@ ACE_OS::send (ACE_HANDLE handle, const char *buf, size_t len, int flags)
errno = EWOULDBLOCK;
}
# endif /* EAGAIN != EWOULDBLOCK*/
+
return ace_result_;
#endif /* defined (ACE_WIN32) */
}
+
ACE_INLINE ssize_t
ACE_OS::sendmsg (ACE_HANDLE handle,
const struct msghdr *msg,
@@ -570,6 +620,7 @@ ACE_OS::sendmsg (ACE_HANDLE handle,
msg->msg_namelen,
0,
0);
+
if (result != 0)
{
ACE_OS::set_errno_to_wsa_last_error ();
@@ -588,9 +639,11 @@ ACE_OS::sendmsg (ACE_HANDLE handle,
ACE_UNUSED_ARG (flags);
ACE_UNUSED_ARG (msg);
ACE_UNUSED_ARG (handle);
+
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_LACKS_SENDMSG */
}
+
ACE_INLINE ssize_t
ACE_OS::sendto (ACE_HANDLE handle,
const char *buf,
@@ -634,6 +687,7 @@ ACE_OS::sendto (ACE_HANDLE handle,
ssize_t, -1);
#endif /* ACE_LACKS_SENDTO */
}
+
ACE_INLINE ssize_t
ACE_OS::sendto (ACE_HANDLE handle,
const iovec *buffers,
@@ -665,8 +719,11 @@ ACE_OS::sendto (ACE_HANDLE handle,
#else
ACE_UNUSED_ARG (overlapped);
ACE_UNUSED_ARG (func);
+
number_of_bytes_sent = 0;
+
ssize_t result = 0;
+
for (int i = 0; i < buffer_count; ++i)
{
result = ACE_OS::sendto (handle,
@@ -680,9 +737,11 @@ ACE_OS::sendto (ACE_HANDLE handle,
break;
number_of_bytes_sent += static_cast<size_t> (result);
}
+
return result;
#endif /* defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) */
}
+
ACE_INLINE ssize_t
ACE_OS::sendv (ACE_HANDLE handle,
const iovec *buffers,
@@ -691,6 +750,7 @@ ACE_OS::sendv (ACE_HANDLE handle,
#if defined (ACE_HAS_WINSOCK2)
DWORD bytes_sent = 0;
ssize_t result = 0;
+
// Winsock 2 has WSASend and can do this directly, but Winsock 1
// needs to do the sends one-by-one.
# if (ACE_HAS_WINSOCK2 != 0)
@@ -713,6 +773,7 @@ ACE_OS::sendv (ACE_HANDLE handle,
buffers[i].iov_base,
buffers[i].iov_len,
0);
+
if (result == SOCKET_ERROR)
{
// There is a subtle difference in behaviour depending on
@@ -732,14 +793,18 @@ ACE_OS::sendv (ACE_HANDLE handle,
{
// Gets ignored on error anyway
bytes_sent += result;
+
// If the transfer isn't complete just drop out of the loop.
if (result < (int)buffers[i].iov_len)
break;
}
}
# endif /* ACE_HAS_WINSOCK2 != 0 */
+
return (ssize_t) bytes_sent;
+
#elif defined (ACE_HAS_SOCK_BUF_SIZE_MAX)
+
// Platform limits the maximum socket message size. Pare down the
// iovec, if necessary, to obey the limit.
iovec local_iov[ACE_IOV_MAX];
@@ -749,6 +814,7 @@ ACE_OS::sendv (ACE_HANDLE handle,
{
local_iov[i].iov_base = buffers[i].iov_base;
local_iov[i].iov_len = buffers[i].iov_len;
+
new_total = total + buffers[i].iov_len;
if (new_total >= ACE_HAS_SOCK_BUF_SIZE_MAX_VALUE)
{
@@ -759,10 +825,12 @@ ACE_OS::sendv (ACE_HANDLE handle,
total = new_total;
}
return ACE_OS::writev (handle, local_iov, n);
+
#else
return ACE_OS::writev (handle, buffers, n);
#endif /* ACE_HAS_WINSOCK2 */
}
+
ACE_INLINE int
ACE_OS::setsockopt (ACE_HANDLE handle,
int level,
@@ -799,6 +867,7 @@ ACE_OS::setsockopt (ACE_HANDLE handle,
}
}
#endif /*ACE_HAS_WINSOCK2*/
+
int result;
ACE_SOCKCALL (::setsockopt ((ACE_SOCKET) handle,
level,
@@ -817,6 +886,7 @@ ACE_OS::setsockopt (ACE_HANDLE handle,
return result;
#endif
}
+
ACE_INLINE int
ACE_OS::shutdown (ACE_HANDLE handle, int how)
{
@@ -829,6 +899,7 @@ ACE_OS::shutdown (ACE_HANDLE handle, int how)
ACE_SOCKCALL_RETURN (::shutdown ((ACE_SOCKET) handle, how), int, -1);
#endif /* ACE_LACKS_SHUTDOWN */
}
+
ACE_INLINE ACE_HANDLE
ACE_OS::socket (int domain,
int type,
@@ -848,6 +919,7 @@ ACE_OS::socket (int domain,
ACE_INVALID_HANDLE);
#endif /* ACE_LACKS_SOCKET */
}
+
ACE_INLINE ACE_HANDLE
ACE_OS::socket (int domain,
int type,
@@ -857,6 +929,7 @@ ACE_OS::socket (int domain,
u_long flags)
{
ACE_OS_TRACE ("ACE_OS::socket");
+
#if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
ACE_SOCKCALL_RETURN (::WSASocket (domain,
type,
@@ -870,11 +943,13 @@ ACE_OS::socket (int domain,
ACE_UNUSED_ARG (protocolinfo);
ACE_UNUSED_ARG (g);
ACE_UNUSED_ARG (flags);
+
return ACE_OS::socket (domain,
type,
proto);
#endif /* ACE_HAS_WINSOCK2 */
}
+
ACE_INLINE int
ACE_OS::socketpair (int domain, int type,
int protocol, ACE_HANDLE sv[2])
@@ -885,12 +960,14 @@ ACE_OS::socketpair (int domain, int type,
ACE_UNUSED_ARG (type);
ACE_UNUSED_ARG (protocol);
ACE_UNUSED_ARG (sv);
+
ACE_NOTSUP_RETURN (-1);
#else
ACE_OSCALL_RETURN (::socketpair (domain, type, protocol, sv),
int, -1);
#endif /* ACE_LACKS_SOCKETPAIR */
}
+
#if defined (__linux__) && defined (ACE_HAS_IPV6)
ACE_INLINE unsigned int
ACE_OS::if_nametoindex (const char *ifname)
@@ -898,18 +975,21 @@ ACE_OS::if_nametoindex (const char *ifname)
ACE_OS_TRACE ("ACE_OS::if_nametoindex");
ACE_OSCALL_RETURN (::if_nametoindex (ifname), int, 0);
}
+
ACE_INLINE char *
ACE_OS::if_indextoname (unsigned int ifindex, char *ifname)
{
ACE_OS_TRACE ("ACE_OS::if_indextoname");
ACE_OSCALL_RETURN (::if_indextoname (ifindex, ifname), char *, 0);
}
+
ACE_INLINE struct if_nameindex *
ACE_OS::if_nameindex (void)
{
ACE_OS_TRACE ("ACE_OS::if_nameindex");
ACE_OSCALL_RETURN (::if_nameindex (), struct if_nameindex *, 0);
}
+
ACE_INLINE void
ACE_OS::if_freenameindex (struct if_nameindex *ptr)
{
@@ -918,4 +998,5 @@ ACE_OS::if_freenameindex (struct if_nameindex *ptr)
::if_freenameindex (ptr);
}
#endif /* __linux__ && ACE_HAS_IPV6 */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_NS_sys_stat.cpp b/dep/ACE_wrappers/ace/OS_NS_sys_stat.cpp
index 4f8cabf1aa6..fbb98a3f1ec 100644
--- a/dep/ACE_wrappers/ace/OS_NS_sys_stat.cpp
+++ b/dep/ACE_wrappers/ace/OS_NS_sys_stat.cpp
@@ -1,7 +1,11 @@
// $Id: OS_NS_sys_stat.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_sys_stat.h"
+
ACE_RCSID(ace, OS_NS_sys_stat, "$Id: OS_NS_sys_stat.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if !defined (ACE_HAS_INLINED_OSCALLS)
# include "ace/OS_NS_sys_stat.inl"
#endif /* ACE_HAS_INLINED_OSCALLS */
+
diff --git a/dep/ACE_wrappers/ace/OS_NS_sys_stat.h b/dep/ACE_wrappers/ace/OS_NS_sys_stat.h
index 02ae7431c10..6aeb8f3095c 100644
--- a/dep/ACE_wrappers/ace/OS_NS_sys_stat.h
+++ b/dep/ACE_wrappers/ace/OS_NS_sys_stat.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file OS_NS_sys_stat.h
@@ -12,21 +13,29 @@
* Originally in OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_NS_SYS_STAT_H
# define ACE_OS_NS_SYS_STAT_H
+
# include /**/ "ace/pre.h"
+
# include "ace/config-all.h"
+
# if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
# endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/sys/os_stat.h"
#include "ace/Default_Constants.h" // for ACE_DEFAULT_DIR_PERMS
#include /**/ "ace/ACE_export.h"
+
#if defined (ACE_EXPORT_MACRO)
# undef ACE_EXPORT_MACRO
#endif
#define ACE_EXPORT_MACRO ACE_Export
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
# if defined (_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS == 64 \
&& defined (ACE_WIN32)
# if defined (__BORLANDC__)
@@ -67,50 +76,67 @@ typedef struct stat ACE_stat;
# define ACE_WSTAT_FUNC_NAME ACE_STAT_FUNC_NAME
# endif /* ACE_WIN32 */
# endif /* _FILE_OFFSET_BITS == 64 && ACE_WIN32 */
+
namespace ACE_OS
{
+
ACE_NAMESPACE_INLINE_FUNCTION
ACE_HANDLE creat (const ACE_TCHAR *filename,
mode_t mode);
+
//@{ @name A set of wrappers for low-level file operations.
+
// non-standard
ACE_NAMESPACE_INLINE_FUNCTION
ACE_OFF_T filesize (ACE_HANDLE handle);
+
ACE_NAMESPACE_INLINE_FUNCTION
ACE_OFF_T filesize (const ACE_TCHAR *handle);
//@}
+
ACE_NAMESPACE_INLINE_FUNCTION
int fstat (ACE_HANDLE,
ACE_stat *);
+
ACE_NAMESPACE_INLINE_FUNCTION
int lstat (const char *,
ACE_stat *);
+
#if defined (ACE_HAS_WCHAR)
ACE_NAMESPACE_INLINE_FUNCTION
int lstat (const wchar_t *,
ACE_stat *);
#endif /* ACE_HAS_WCHAR */
+
ACE_NAMESPACE_INLINE_FUNCTION
int mkdir (const char *path,
mode_t mode = ACE_DEFAULT_DIR_PERMS);
+
#if defined (ACE_HAS_WCHAR)
ACE_NAMESPACE_INLINE_FUNCTION
int mkdir (const wchar_t *path,
mode_t mode = ACE_DEFAULT_DIR_PERMS);
#endif /* ACE_HAS_WCHAR */
+
ACE_NAMESPACE_INLINE_FUNCTION
int mkfifo (const ACE_TCHAR *file,
mode_t mode = ACE_DEFAULT_FILE_PERMS);
+
ACE_NAMESPACE_INLINE_FUNCTION
int stat (const char *file, ACE_stat *);
+
#if defined (ACE_HAS_WCHAR)
ACE_NAMESPACE_INLINE_FUNCTION
int stat (const wchar_t *file, ACE_stat *);
#endif /* ACE_HAS_WCHAR */
+
ACE_NAMESPACE_INLINE_FUNCTION
mode_t umask (mode_t cmask);
+
} /* namespace ACE_OS */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# if defined (ACE_HAS_INLINED_OSCALLS)
# if defined (ACE_INLINE)
# undef ACE_INLINE
@@ -118,6 +144,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_INLINE inline
# include "ace/OS_NS_sys_stat.inl"
# endif /* ACE_HAS_INLINED_OSCALLS */
+
# include /**/ "ace/post.h"
#endif /* ACE_OS_NS_SYS_STAT_H */
diff --git a/dep/ACE_wrappers/ace/OS_NS_sys_stat.inl b/dep/ACE_wrappers/ace/OS_NS_sys_stat.inl
index 02d269d4983..a5c515df51d 100644
--- a/dep/ACE_wrappers/ace/OS_NS_sys_stat.inl
+++ b/dep/ACE_wrappers/ace/OS_NS_sys_stat.inl
@@ -1,13 +1,17 @@
// -*- C++ -*-
//
// $Id: OS_NS_sys_stat.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_unistd.h"
#include "ace/OS_NS_fcntl.h"
#include "ace/OS_NS_errno.h"
#include "ace/OS_NS_macros.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE_OS
{
+
ACE_INLINE ACE_HANDLE
creat (const ACE_TCHAR *filename, mode_t mode)
{
@@ -19,6 +23,7 @@ namespace ACE_OS
ACE_HANDLE, ACE_INVALID_HANDLE);
#endif /* ACE_WIN32 */
}
+
ACE_INLINE int
fstat (ACE_HANDLE handle, ACE_stat *stp)
{
@@ -30,6 +35,7 @@ namespace ACE_OS
ACE_OSCALL_RETURN (::_fxstat (_STAT_VER, handle, stp), int, -1);
#elif defined (ACE_WIN32)
BY_HANDLE_FILE_INFORMATION fdata;
+
if (::GetFileInformationByHandle (handle, &fdata) == FALSE)
{
ACE_OS::set_errno_to_last_error ();
@@ -62,8 +68,10 @@ namespace ACE_OS
ACE_OSCALL_RETURN (::fstat (handle, stp), int, -1);
# endif /* !ACE_HAS_X86_STAT_MACROS */
}
+
// This function returns the number of bytes in the file referenced by
// FD.
+
ACE_INLINE ACE_OFF_T
filesize (ACE_HANDLE handle)
{
@@ -88,10 +96,12 @@ namespace ACE_OS
static_cast<ACE_OFF_T> (-1) : sb.st_size;
#endif
}
+
ACE_INLINE ACE_OFF_T
filesize (const ACE_TCHAR *filename)
{
ACE_OS_TRACE ("ACE_OS::filesize");
+
ACE_HANDLE const h = ACE_OS::open (filename, O_RDONLY);
if (h != ACE_INVALID_HANDLE)
{
@@ -102,6 +112,7 @@ namespace ACE_OS
else
return -1;
}
+
ACE_INLINE int
lstat (const char *file, ACE_stat *stp)
{
@@ -116,6 +127,7 @@ namespace ACE_OS
ACE_OSCALL_RETURN (::lstat (file, stp), int, -1);
# endif /* ACE_LACKS_LSTAT */
}
+
#if defined (ACE_HAS_WCHAR)
ACE_INLINE int
lstat (const wchar_t *file, ACE_stat *stp)
@@ -128,6 +140,7 @@ namespace ACE_OS
# endif /* ACE_LACKS_LSTAT */
}
#endif /* ACE_HAS_WCHAR */
+
ACE_INLINE int
mkdir (const char *path, mode_t mode)
{
@@ -143,7 +156,9 @@ namespace ACE_OS
ACE_OSCALL_RETURN (::mkdir (path, mode), int, -1);
#endif
}
+
#if defined (ACE_HAS_WCHAR)
+
ACE_INLINE int
mkdir (const wchar_t *path, mode_t mode)
{
@@ -159,7 +174,9 @@ namespace ACE_OS
return ACE_OS::mkdir (ACE_Wide_To_Ascii (path).char_rep (), mode);
#endif /* ACE_HAS_WINCE */
}
+
#endif /* ACE_HAS_WCHAR */
+
ACE_INLINE int
mkfifo (const ACE_TCHAR *file, mode_t mode)
{
@@ -172,6 +189,7 @@ namespace ACE_OS
ACE_OSCALL_RETURN (::mkfifo (ACE_TEXT_ALWAYS_CHAR (file), mode), int, -1);
#endif /* ACE_LACKS_MKFIFO */
}
+
ACE_INLINE int
stat (const char *file, ACE_stat *stp)
{
@@ -180,7 +198,9 @@ namespace ACE_OS
ACE_OSCALL_RETURN (::stat (const_cast <char *> (file), stp), int, -1);
#elif defined (ACE_HAS_WINCE)
ACE_TEXT_WIN32_FIND_DATA fdata;
+
HANDLE fhandle;
+
fhandle = ::FindFirstFile (ACE_TEXT_CHAR_TO_TCHAR (file), &fdata);
if (fhandle == INVALID_HANDLE_VALUE)
{
@@ -208,6 +228,7 @@ namespace ACE_OS
ACE_OSCALL_RETURN (ACE_STAT_FUNC_NAME (file, stp), int, -1);
#endif /* ACE_HAS_NONCONST_STAT */
}
+
#if defined (ACE_HAS_WCHAR)
ACE_INLINE int
stat (const wchar_t *file, ACE_stat *stp)
@@ -215,7 +236,9 @@ namespace ACE_OS
ACE_OS_TRACE ("ACE_OS::stat");
#if defined (ACE_HAS_WINCE)
WIN32_FIND_DATAW fdata;
+
HANDLE fhandle;
+
fhandle = ::FindFirstFileW (file, &fdata);
if (fhandle == INVALID_HANDLE_VALUE)
{
@@ -245,6 +268,7 @@ namespace ACE_OS
#endif /* ACE_HAS_WINCE */
}
#endif /* ACE_HAS_WCHAR */
+
ACE_INLINE mode_t
umask (mode_t cmask)
{
@@ -262,5 +286,7 @@ namespace ACE_OS
return ::umask (cmask); // This call shouldn't fail...
# endif /* ACE_LACKS_UMASK */
}
+
} // ACE_OS namespace
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_NS_sys_time.cpp b/dep/ACE_wrappers/ace/OS_NS_sys_time.cpp
index 6c22b54b6b9..25c80834830 100644
--- a/dep/ACE_wrappers/ace/OS_NS_sys_time.cpp
+++ b/dep/ACE_wrappers/ace/OS_NS_sys_time.cpp
@@ -1,7 +1,11 @@
// $Id: OS_NS_sys_time.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_sys_time.h"
+
ACE_RCSID(ace, OS_NS_sys_time, "$Id: OS_NS_sys_time.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if !defined (ACE_HAS_INLINED_OSCALLS)
# include "ace/OS_NS_sys_time.inl"
#endif /* ACE_HAS_INLINED_OSCALLS */
+
diff --git a/dep/ACE_wrappers/ace/OS_NS_sys_time.h b/dep/ACE_wrappers/ace/OS_NS_sys_time.h
index 85de5f4fbda..1efb8c036fd 100644
--- a/dep/ACE_wrappers/ace/OS_NS_sys_time.h
+++ b/dep/ACE_wrappers/ace/OS_NS_sys_time.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file OS_NS_sys_time.h
@@ -12,20 +13,28 @@
* Originally in OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_NS_SYS_TIME_H
# define ACE_OS_NS_SYS_TIME_H
+
# include /**/ "ace/pre.h"
+
# include "ace/config-all.h"
+
# if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
# endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Time_Value.h"
#include /**/ "ace/ACE_export.h"
+
#if defined (ACE_EXPORT_MACRO)
# undef ACE_EXPORT_MACRO
#endif
#define ACE_EXPORT_MACRO ACE_Export
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE_OS
{
#if defined (ACE_WIN32) && defined (_WIN32_WCE)
@@ -37,13 +46,17 @@ namespace ACE_OS
// - Steve Huston, 23-Aug-2004
extern "C++" {
#endif
+
ACE_NAMESPACE_INLINE_FUNCTION
ACE_Time_Value gettimeofday (void);
+
#if defined (ACE_WIN32) && defined (_WIN32_WCE)
}
#endif
} /* namespace ACE_OS */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# if defined (ACE_HAS_INLINED_OSCALLS)
# if defined (ACE_INLINE)
# undef ACE_INLINE
@@ -51,6 +64,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_INLINE inline
# include "ace/OS_NS_sys_time.inl"
# endif /* ACE_HAS_INLINED_OSCALLS */
+
# include /**/ "ace/post.h"
#endif /* ACE_OS_NS_SYS_TIME_H */
diff --git a/dep/ACE_wrappers/ace/OS_NS_sys_time.inl b/dep/ACE_wrappers/ace/OS_NS_sys_time.inl
index ad275bd174a..1be2d2f3dec 100644
--- a/dep/ACE_wrappers/ace/OS_NS_sys_time.inl
+++ b/dep/ACE_wrappers/ace/OS_NS_sys_time.inl
@@ -1,12 +1,16 @@
// -*- C++ -*-
//
// $Id: OS_NS_sys_time.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/os_include/sys/os_time.h"
#include "ace/os_include/os_errno.h"
+
#if defined (ACE_VXWORKS)
# include "ace/OS_NS_time.h"
#endif /* ACE_VXWORKS */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_WIN32) && defined (_WIN32_WCE)
// Something is a bit brain-damaged here and I'm not sure what... this code
// compiled before the OS reorg for ACE 5.4. Since then it hasn't - eVC
@@ -16,19 +20,24 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
// - Steve Huston, 23-Aug-2004
extern "C++" {
#endif
+
ACE_INLINE ACE_Time_Value
ACE_OS::gettimeofday (void)
{
// ACE_OS_TRACE ("ACE_OS::gettimeofday");
+
#if !defined (ACE_HAS_WINCE)&& !defined (ACE_WIN32)
timeval tv;
int result = 0;
#endif // !defined (ACE_HAS_WINCE)&& !defined (ACE_WIN32)
+
#if (0)
struct timespec ts;
+
ACE_OSCALL (ACE_OS::clock_gettime (CLOCK_REALTIME, &ts), int, -1, result);
tv.tv_sec = ts.tv_sec;
tv.tv_usec = ts.tv_nsec / 1000L; // timespec has nsec, but timeval has usec
+
#elif defined (ACE_HAS_WINCE)
SYSTEMTIME tsys;
FILETIME tfile;
@@ -48,8 +57,10 @@ ACE_OS::gettimeofday (void)
#endif /* 0 */
#elif defined (ACE_HAS_AIX_HI_RES_TIMER)
timebasestruct_t tb;
+
::read_real_time (&tb, TIMEBASE_SZ);
::time_base_to_time (&tb, TIMEBASE_SZ);
+
tv.tv_sec = tb.tb_high;
tv.tv_usec = tb.tb_low / 1000L;
#else
@@ -62,6 +73,7 @@ ACE_OS::gettimeofday (void)
// which assumes that time_t is a long: it currently (VxWorks
// 5.2/5.3) is.
struct timespec ts;
+
ACE_OSCALL (ACE_OS::clock_gettime (CLOCK_REALTIME, &ts), int, -1, result);
tv.tv_sec = ts.tv_sec;
tv.tv_usec = ts.tv_nsec / 1000L; // timespec has nsec, but timeval has usec
@@ -76,7 +88,9 @@ ACE_OS::gettimeofday (void)
return ACE_Time_Value (tv);
#endif // !defined (ACE_HAS_WINCE)&& !defined (ACE_WIN32)
}
+
#if defined (ACE_WIN32) && defined (_WIN32_WCE)
}
#endif
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_NS_sys_uio.cpp b/dep/ACE_wrappers/ace/OS_NS_sys_uio.cpp
index 19bd61cf7fb..e4cac846e57 100644
--- a/dep/ACE_wrappers/ace/OS_NS_sys_uio.cpp
+++ b/dep/ACE_wrappers/ace/OS_NS_sys_uio.cpp
@@ -1,32 +1,44 @@
// $Id: OS_NS_sys_uio.cpp 81756 2008-05-22 09:47:33Z johnnyw $
+
#include "ace/OS_NS_sys_uio.h"
+
ACE_RCSID(ace, OS_NS_sys_uio, "$Id: OS_NS_sys_uio.cpp 81756 2008-05-22 09:47:33Z johnnyw $")
+
#if !defined (ACE_HAS_INLINED_OSCALLS)
# include "ace/OS_NS_sys_uio.inl"
#endif /* ACE_HAS_INLINED_OSCALLS */
+
#include "ace/OS_Memory.h"
#include "ace/OS_NS_string.h"
#include "ace/OS_NS_unistd.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
# if defined (ACE_LACKS_READV)
+
// "Fake" readv for operating systems without it. Note that this is
// thread-safe.
+
ssize_t
ACE_OS::readv_emulation (ACE_HANDLE handle,
const iovec *iov,
int n)
{
ACE_OS_TRACE ("ACE_OS::readv_emulation");
+
// In case there's a single element, skip the memcpy.
if (1 == n)
return ACE_OS::read (handle, iov[0].iov_base, iov[0].iov_len);
+
ssize_t length = 0;
int i;
+
for (i = 0; i < n; ++i)
if (static_cast<int> (iov[i].iov_len) < 0)
return -1;
else
length += iov[i].iov_len;
+
char *buf;
# if defined (ACE_HAS_ALLOCA)
buf = (char *) alloca (length);
@@ -35,11 +47,14 @@ ACE_OS::readv_emulation (ACE_HANDLE handle,
char[length],
-1);
# endif /* !defined (ACE_HAS_ALLOCA) */
+
length = ACE_OS::read (handle, buf, length);
+
if (length != -1)
{
char *ptr = buf;
ssize_t copyn = length;
+
for (i = 0;
i < n && copyn > 0;
++i)
@@ -53,27 +68,35 @@ ACE_OS::readv_emulation (ACE_HANDLE handle,
copyn -= iov[i].iov_len;
}
}
+
# if !defined (ACE_HAS_ALLOCA)
delete [] buf;
# endif /* !defined (ACE_HAS_ALLOCA) */
return length;
}
# endif /* ACE_LACKS_READV */
+
# if defined (ACE_LACKS_WRITEV)
+
// "Fake" writev for operating systems without it. Note that this is
// thread-safe.
+
ssize_t
ACE_OS::writev_emulation (ACE_HANDLE handle, const iovec *iov, int n)
{
ACE_OS_TRACE ("ACE_OS::writev_emulation");
+
// To avoid having to allocate a temporary buffer to which all of
// the data will be copied and then written, this implementation
// performs incremental writes.
+
ssize_t bytes_sent = 0;
+
for (int i = 0; i < n; ++i)
{
ssize_t const result =
ACE_OS::write (handle, iov[i].iov_base, iov[i].iov_len);
+
if (result == -1)
{
// There is a subtle difference in behaviour depending on
@@ -89,6 +112,7 @@ ACE_OS::writev_emulation (ACE_HANDLE handle, const iovec *iov, int n)
else
{
bytes_sent += result;
+
// Do not continue on to the next loop iteration if the
// amount of data sent was less than the amount data given.
// This avoids a subtle problem where "holes" in the data
@@ -98,8 +122,10 @@ ACE_OS::writev_emulation (ACE_HANDLE handle, const iovec *iov, int n)
break;
}
}
+
return bytes_sent;
}
# endif /* ACE_LACKS_WRITEV */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_NS_sys_uio.h b/dep/ACE_wrappers/ace/OS_NS_sys_uio.h
index b77e8e44a2f..c0e54d09770 100644
--- a/dep/ACE_wrappers/ace/OS_NS_sys_uio.h
+++ b/dep/ACE_wrappers/ace/OS_NS_sys_uio.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file OS_NS_sys_uio.h
@@ -12,36 +13,48 @@
* Originally in OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_NS_SYS_UIO_H
# define ACE_OS_NS_SYS_UIO_H
+
# include /**/ "ace/pre.h"
+
# include "ace/config-all.h"
+
# if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
# endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/sys/os_uio.h"
#include /**/ "ace/ACE_export.h"
+
#if defined (ACE_EXPORT_MACRO)
# undef ACE_EXPORT_MACRO
#endif
#define ACE_EXPORT_MACRO ACE_Export
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE_OS
{
+
ACE_NAMESPACE_INLINE_FUNCTION
ssize_t readv (ACE_HANDLE handle,
const iovec *iov,
int iovlen);
+
#if defined (ACE_LACKS_READV)
extern ACE_Export
ssize_t readv_emulation (ACE_HANDLE handle,
const iovec *iov,
int iovcnt);
#endif /* ACE_LACKS_READV */
+
ACE_NAMESPACE_INLINE_FUNCTION
ssize_t writev (ACE_HANDLE handle,
const iovec *iov,
int iovcnt);
+
// these don't need to be in the header, better to put them in the cpp
// or inl.
#if defined (ACE_LACKS_WRITEV)
@@ -50,8 +63,11 @@ namespace ACE_OS
const iovec *iov,
int iovcnt);
#endif /* ACE_LACKS_WRITEV */
+
} /* namespace ACE_OS */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# if defined (ACE_HAS_INLINED_OSCALLS)
# if defined (ACE_INLINE)
# undef ACE_INLINE
@@ -59,6 +75,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_INLINE inline
# include "ace/OS_NS_sys_uio.inl"
# endif /* ACE_HAS_INLINED_OSCALLS */
+
# include /**/ "ace/post.h"
#endif /* ACE_OS_NS_SYS_UIO_H */
diff --git a/dep/ACE_wrappers/ace/OS_NS_sys_uio.inl b/dep/ACE_wrappers/ace/OS_NS_sys_uio.inl
index 179a8081df6..c704e07ea44 100644
--- a/dep/ACE_wrappers/ace/OS_NS_sys_uio.inl
+++ b/dep/ACE_wrappers/ace/OS_NS_sys_uio.inl
@@ -1,8 +1,11 @@
// -*- C++ -*-
//
// $Id: OS_NS_sys_uio.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/os_include/os_errno.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE ssize_t
ACE_OS::readv (ACE_HANDLE handle,
const iovec *iov,
@@ -25,6 +28,7 @@ ACE_OS::readv (ACE_HANDLE handle,
#endif /* ACE_HAS_NONCONST_READV */
#endif /* ACE_LACKS_READV */
}
+
ACE_INLINE ssize_t
ACE_OS::writev (ACE_HANDLE handle,
const iovec *iov,
@@ -47,4 +51,5 @@ ACE_OS::writev (ACE_HANDLE handle,
#endif /* ACE_HAS_NONCONST_WRITEV */
#endif /* ACE_LACKS_WRITEV */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_NS_sys_utsname.cpp b/dep/ACE_wrappers/ace/OS_NS_sys_utsname.cpp
index dac7534e692..d5450bcf35b 100644
--- a/dep/ACE_wrappers/ace/OS_NS_sys_utsname.cpp
+++ b/dep/ACE_wrappers/ace/OS_NS_sys_utsname.cpp
@@ -1,16 +1,22 @@
// $Id: OS_NS_sys_utsname.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_sys_utsname.h"
+
ACE_RCSID(ace, OS_NS_sys_utsname, "$Id: OS_NS_sys_utsname.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#include "ace/OS_NS_string.h"
#include "ace/OS_NS_stdio.h"
#include "ace/OS_NS_unistd.h"
+
#if defined (ACE_VXWORKS) && defined (ACE_LACKS_UNAME)
// for sysBspRev(), sysModel()
# include /**/ <sysLib.h>
// for kernelVersion()
# include /**/ <kernelLib.h>
#endif /* ACE_VXWORKS && ACE_LACKS_UNAME */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
int
ACE_OS::uname (ACE_utsname *name)
{
@@ -20,9 +26,11 @@ ACE_OS::uname (ACE_utsname *name)
#elif defined (ACE_WIN32)
size_t maxnamelen = sizeof name->nodename;
ACE_OS::strcpy (name->sysname, "Win32");
+
ACE_TEXT_OSVERSIONINFO vinfo;
vinfo.dwOSVersionInfoSize = sizeof(ACE_TEXT_OSVERSIONINFO);
ACE_TEXT_GetVersionEx (&vinfo);
+
SYSTEM_INFO sinfo;
# if defined (ACE_HAS_PHARLAP)
// PharLap doesn't do GetSystemInfo. What's really wanted is the
@@ -39,7 +47,9 @@ ACE_OS::uname (ACE_utsname *name)
# else
::GetSystemInfo(&sinfo);
# endif /* ACE_HAS_PHARLAP */
+
const char* unknown = "???";
+
if (
vinfo.dwPlatformId == VER_PLATFORM_WIN32_NT
# if defined (VER_PLATFORM_WIN32_CE)
@@ -61,6 +71,7 @@ ACE_OS::uname (ACE_utsname *name)
"Build %d %s",
(int) vinfo.dwBuildNumber,
ACE_TEXT_ALWAYS_CHAR (vinfo.szCSDVersion));
+
// We have to make sure that the size of (processor + subtype)
// is not greater than the size of name->machine. So we give
// half the space to the processor and half the space to
@@ -69,11 +80,13 @@ ACE_OS::uname (ACE_utsname *name)
const int bufsize = (sizeof (name->machine) / 2) - 1;
char processor[bufsize] = "Unknown";
char subtype[bufsize] = "Unknown";
+
# if defined (ghs)
WORD arch = sinfo.u.s.wProcessorArchitecture;
# else
WORD arch = sinfo.wProcessorArchitecture;
# endif
+
switch (arch)
{
case PROCESSOR_ARCHITECTURE_INTEL:
@@ -173,6 +186,7 @@ ACE_OS::uname (ACE_utsname *name)
{
ACE_OS::strcpy (name->release, unknown);
}
+
ACE_OS::sprintf (name->version, "%d", LOWORD (vinfo.dwBuildNumber));
if (sinfo.dwProcessorType == PROCESSOR_INTEL_386)
ACE_OS::strcpy (name->machine, "Intel 80386");
@@ -186,21 +200,25 @@ ACE_OS::uname (ACE_utsname *name)
else
{
// We don't know what this is!
+
ACE_OS::strcpy (name->release, unknown);
ACE_OS::strcpy (name->version, unknown);
ACE_OS::strcpy (name->machine, unknown);
}
+
# if defined (ACE_LACKS_HOSTNAME)
return 0;
# else /* ACE_LACKS_HOSTNAME */
return ACE_OS::hostname (name->nodename, maxnamelen);
# endif /* ACE_LACKS_HOSTNAME */
+
#elif defined (ACE_VXWORKS)
size_t maxnamelen = sizeof name->nodename;
ACE_OS::strcpy (name->sysname, "VxWorks");
ACE_OS::strcpy (name->release, kernelVersion());
ACE_OS::strcpy (name->version, sysBspRev ());
ACE_OS::strcpy (name->machine, sysModel ());
+
return ACE_OS::hostname (name->nodename, maxnamelen);
#elif defined (INTEGRITY)
if(!name) {
@@ -215,5 +233,6 @@ ACE_OS::uname (ACE_utsname *name)
return status;
#endif /* ACE_WIN32 */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_NS_sys_utsname.h b/dep/ACE_wrappers/ace/OS_NS_sys_utsname.h
index 8e3a0104b1f..fe3cda91b21 100644
--- a/dep/ACE_wrappers/ace/OS_NS_sys_utsname.h
+++ b/dep/ACE_wrappers/ace/OS_NS_sys_utsname.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file OS_NS_sys_utsname.h
@@ -12,18 +13,25 @@
* Originally in OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_NS_SYS_UTSNAME_H
# define ACE_OS_NS_SYS_UTSNAME_H
+
# include /**/ "ace/pre.h"
+
# include "ace/config-all.h"
+
# if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
# endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include /**/ "ace/ACE_export.h"
+
#if defined (ACE_EXPORT_MACRO)
# undef ACE_EXPORT_MACRO
#endif
#define ACE_EXPORT_MACRO ACE_Export
+
#if defined (ACE_LACKS_UTSNAME_T)
# if !defined (SYS_NMLN)
# define SYS_NMLN 257
@@ -47,12 +55,18 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
typedef struct utsname ACE_utsname;
ACE_END_VERSIONED_NAMESPACE_DECL
# endif /* ACE_LACKS_UTSNAME_T */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE_OS {
+
extern ACE_Export
int uname (ACE_utsname *name);
+
} /* namespace ACE_OS */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# include /**/ "ace/post.h"
#endif /* ACE_OS_NS_SYS_UTSNAME_H */
diff --git a/dep/ACE_wrappers/ace/OS_NS_sys_wait.cpp b/dep/ACE_wrappers/ace/OS_NS_sys_wait.cpp
index 0fe64823d6d..beec3030232 100644
--- a/dep/ACE_wrappers/ace/OS_NS_sys_wait.cpp
+++ b/dep/ACE_wrappers/ace/OS_NS_sys_wait.cpp
@@ -1,6 +1,9 @@
// $Id: OS_NS_sys_wait.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_sys_wait.h"
+
ACE_RCSID(ace, OS_NS_sys_wait, "$Id: OS_NS_sys_wait.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if !defined (ACE_HAS_INLINED_OSCALLS)
# include "ace/OS_NS_sys_wait.inl"
#endif /* ACE_HAS_INLINED_OSCALLS */
diff --git a/dep/ACE_wrappers/ace/OS_NS_sys_wait.h b/dep/ACE_wrappers/ace/OS_NS_sys_wait.h
index 9f7925b7829..801b9b08bb6 100644
--- a/dep/ACE_wrappers/ace/OS_NS_sys_wait.h
+++ b/dep/ACE_wrappers/ace/OS_NS_sys_wait.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file OS_NS_sys_wait.h
@@ -12,26 +13,36 @@
* Originally in OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_NS_SYS_WAIT_H
# define ACE_OS_NS_SYS_WAIT_H
+
# include /**/ "ace/pre.h"
+
# include "ace/config-all.h"
+
# if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
# endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/sys/os_wait.h"
#include /**/ "ace/ACE_export.h"
+
#if defined (ACE_EXPORT_MACRO)
# undef ACE_EXPORT_MACRO
#endif
#define ACE_EXPORT_MACRO ACE_Export
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE_OS
{
+
/// Calls OS @c ::wait function, so it's only portable to UNIX/POSIX
/// platforms.
ACE_NAMESPACE_INLINE_FUNCTION
pid_t wait (int * = 0);
+
/**
* Calls @c ::WaitForSingleObject on Win32 and ACE::waitpid ()
* otherwise. Returns the passed in @a pid_t on success and -1 on
@@ -46,6 +57,7 @@ namespace ACE_OS
ACE_exitcode *status,
int wait_options = 0,
ACE_HANDLE handle = 0);
+
/**
* Calls @c ::waitpid on UNIX/POSIX platforms Does not work on Vxworks 5.5.x.
* On Win32, @a pid is ignored if the @a handle is not equal to 0.
@@ -58,8 +70,11 @@ namespace ACE_OS
ACE_exitcode *status = 0,
int wait_options = 0,
ACE_HANDLE handle = 0);
+
} /* namespace ACE_OS */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# if defined (ACE_HAS_INLINED_OSCALLS)
# if defined (ACE_INLINE)
# undef ACE_INLINE
@@ -67,6 +82,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_INLINE inline
# include "ace/OS_NS_sys_wait.inl"
# endif /* ACE_HAS_INLINED_OSCALLS */
+
# include /**/ "ace/post.h"
#endif /* ACE_OS_NS_SYS_WAIT_H */
diff --git a/dep/ACE_wrappers/ace/OS_NS_sys_wait.inl b/dep/ACE_wrappers/ace/OS_NS_sys_wait.inl
index 2025e82e93e..f24c09267d5 100644
--- a/dep/ACE_wrappers/ace/OS_NS_sys_wait.inl
+++ b/dep/ACE_wrappers/ace/OS_NS_sys_wait.inl
@@ -1,9 +1,12 @@
// -*- C++ -*-
//
// $Id: OS_NS_sys_wait.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_errno.h"
#include "ace/Global_Macros.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE pid_t
ACE_OS::wait (int *status)
{
@@ -15,6 +18,7 @@ ACE_OS::wait (int *status)
ACE_OSCALL_RETURN (::wait (status), pid_t, -1);
#endif /* ACE_LACKS_WAIT */
}
+
ACE_INLINE pid_t
ACE_OS::waitpid (pid_t pid,
ACE_exitcode *status,
@@ -27,24 +31,30 @@ ACE_OS::waitpid (pid_t pid,
ACE_UNUSED_ARG (status);
ACE_UNUSED_ARG (wait_options);
ACE_UNUSED_ARG (handle);
+
ACE_NOTSUP_RETURN (0);
#elif defined (ACE_WIN32)
int blocking_period = ACE_BIT_ENABLED (wait_options, WNOHANG)
? 0 /* don't hang */
: INFINITE;
+
ACE_HANDLE phandle = handle;
+
if (phandle == 0)
{
phandle = ::OpenProcess (SYNCHRONIZE,
FALSE,
pid);
+
if (phandle == 0)
{
ACE_OS::set_errno_to_last_error ();
return -1;
}
}
+
pid_t result = pid;
+
// Don't try to get the process exit status if wait failed so we can
// keep the original error code intact.
switch (::WaitForSingleObject (phandle,
@@ -78,6 +88,7 @@ ACE_OS::waitpid (pid_t pid,
pid_t, -1);
#endif /* ACE_LACKS_WAITPID */
}
+
ACE_INLINE pid_t
ACE_OS::wait (pid_t pid,
ACE_exitcode *status,
@@ -90,4 +101,5 @@ ACE_OS::wait (pid_t pid,
wait_options,
handle);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_NS_time.cpp b/dep/ACE_wrappers/ace/OS_NS_time.cpp
index a70a2f67906..1ac31e31080 100644
--- a/dep/ACE_wrappers/ace/OS_NS_time.cpp
+++ b/dep/ACE_wrappers/ace/OS_NS_time.cpp
@@ -1,16 +1,23 @@
// $Id: OS_NS_time.cpp 82693 2008-09-09 11:37:41Z johnnyw $
+
#include "ace/OS_NS_time.h"
+
ACE_RCSID(ace, OS_NS_time, "$Id: OS_NS_time.cpp 82693 2008-09-09 11:37:41Z johnnyw $")
+
#if !defined (ACE_HAS_INLINED_OSCALLS)
# include "ace/OS_NS_time.inl"
#endif /* ACE_HAS_INLINED_OSCALLS */
+
#if defined (ACE_LACKS_STRPTIME)
# include "ace/os_include/os_ctype.h"
#endif /* ACE_LACKS_STRPTIME */
+
#include "ace/OS_NS_Thread.h"
#include "ace/Object_Manager_Base.h"
+
#if defined (ACE_HAS_WINCE)
# include "ace/OS_NS_stdio.h" /* Need ACE_OS::sprintf() */
+
namespace
{
ACE_TCHAR const * const ACE_OS_day_of_week_name[] =
@@ -23,6 +30,7 @@ namespace
ACE_TEXT ("Fri"),
ACE_TEXT ("Sat")
};
+
ACE_TCHAR const * const ACE_OS_month_name[] =
{
ACE_TEXT ("Jan"),
@@ -38,10 +46,13 @@ namespace
ACE_TEXT ("Nov"),
ACE_TEXT ("Dec")
};
+
static ACE_TCHAR const ACE_OS_CTIME_R_FMTSTR[] = ACE_TEXT ("%3s %3s %02d %02d:%02d:%02d %04d\n");
} /* end blank namespace */
#endif /* ACE_HAS_WINCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
# if defined (ACE_HAS_WINCE)
ACE_TCHAR *
ACE_OS::ctime_r (const time_t *clock, ACE_TCHAR *buf, int buflen)
@@ -61,6 +72,7 @@ ACE_OS::ctime_r (const time_t *clock, ACE_TCHAR *buf, int buflen)
FILETIME file_time;
file_time.dwLowDateTime = _100ns.LowPart;
file_time.dwHighDateTime = _100ns.HighPart;
+
FILETIME localtime;
SYSTEMTIME systime;
FileTimeToLocalFileTime (&file_time, &localtime);
@@ -76,6 +88,7 @@ ACE_OS::ctime_r (const time_t *clock, ACE_TCHAR *buf, int buflen)
return buf;
}
# endif /* ACE_HAS_WINCE */
+
# if defined (ACE_LACKS_DIFFTIME)
double
ACE_OS::difftime (time_t t1, time_t t0)
@@ -84,11 +97,14 @@ ACE_OS::difftime (time_t t1, time_t t0)
struct tm tms[2], *ptms[2], temp;
double seconds;
int swap = 0;
+
/* extract the tm structure from time_t */
ptms[1] = ::gmtime_r (&t1, &tms[1]);
if (ptms[1] == 0) return 0.0;
+
ptms[0] = ::gmtime_r (&t0, &tms[0]);
if (ptms[0] == 0) return 0.0;
+
/* make sure t1 is > t0 */
if (tms[1].tm_year < tms[0].tm_year)
swap = 1;
@@ -112,8 +128,10 @@ ACE_OS::difftime (time_t t1, time_t t0)
}
}
}
+
if (swap)
temp = tms[0], tms[0] = tms[1], tms[1] = temp;
+
seconds = 0.0;
if (tms[1].tm_year > tms[0].tm_year)
{
@@ -127,22 +145,29 @@ ACE_OS::difftime (time_t t1, time_t t0)
seconds += 60*60 * (24 - tms[0].tm_hour);
tms[0].tm_hour = 0;
tms[0].tm_yday += 1;
+
# define ISLEAPYEAR(y) ((y)&3u?0:(y)%25u?1:(y)/25u&12?0:1)
+
if (ISLEAPYEAR(tms[0].tm_year))
seconds += 60*60*24 * (366 - tms[0].tm_yday);
else
seconds += 60*60*24 * (365 - tms[0].tm_yday);
+
tms[0].tm_yday = 0;
tms[0].tm_year += 1;
+
while (tms[1].tm_year > tms[0].tm_year)
{
if (ISLEAPYEAR(tms[0].tm_year))
seconds += 60*60*24 * 366;
else
seconds += 60*60*24 * 365;
+
tms[0].tm_year += 1;
}
+
# undef ISLEAPYEAR
+
}
else
{
@@ -163,6 +188,7 @@ ACE_OS::difftime (time_t t1, time_t t0)
tms[1].tm_sec += 60;
}
tms[1].tm_sec -= tms[0].tm_sec;
+
if (tms[1].tm_min < tms[0].tm_min)
{
if (tms[1].tm_hour == 0)
@@ -174,22 +200,27 @@ ACE_OS::difftime (time_t t1, time_t t0)
tms[1].tm_min += 60;
}
tms[1].tm_min -= tms[0].tm_min;
+
if (tms[1].tm_hour < tms[0].tm_hour)
{
tms[1].tm_yday -= 1;
tms[1].tm_hour += 24;
}
tms[1].tm_hour -= tms[0].tm_hour;
+
tms[1].tm_yday -= tms[0].tm_yday;
}
+
// accumulate the seconds
seconds += tms[1].tm_sec;
seconds += 60 * tms[1].tm_min;
seconds += 60*60 * tms[1].tm_hour;
seconds += 60*60*24 * tms[1].tm_yday;
+
return seconds;
}
# endif /* ACE_LACKS_DIFFTIME */
+
struct tm *
ACE_OS::localtime_r (const time_t *t, struct tm *res)
{
@@ -205,6 +236,7 @@ ACE_OS::localtime_r (const time_t *t, struct tm *res)
return res;
#elif !defined (ACE_HAS_WINCE)
ACE_OS_GUARD
+
ACE_UNUSED_ARG (res);
struct tm * res_ptr = 0;
ACE_OSCALL (::localtime (t), struct tm *, 0, res_ptr);
@@ -219,7 +251,9 @@ ACE_OS::localtime_r (const time_t *t, struct tm *res)
// This is really stupid, converting FILETIME to timeval back and
// forth. It assumes FILETIME and DWORDLONG are the same structure
// internally.
+
TIME_ZONE_INFORMATION pTz;
+
const unsigned short int __mon_yday[2][13] =
{
/* Normal years. */
@@ -227,24 +261,31 @@ ACE_OS::localtime_r (const time_t *t, struct tm *res)
/* Leap years. */
{ 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }
};
+
ULARGE_INTEGER _100ns;
::GetTimeZoneInformation (&pTz);
+
_100ns.QuadPart = (DWORDLONG) *t * 10000 * 1000 + ACE_Time_Value::FILETIME_to_timval_skew;
FILETIME file_time;
file_time.dwLowDateTime = _100ns.LowPart;
file_time.dwHighDateTime = _100ns.HighPart;
+
FILETIME localtime;
SYSTEMTIME systime;
FileTimeToLocalFileTime (&file_time, &localtime);
FileTimeToSystemTime (&localtime, &systime);
+
res->tm_hour = systime.wHour;
+
if(pTz.DaylightBias!=0)
res->tm_isdst = 1;
else
res->tm_isdst = 1;
+
int iLeap;
iLeap = (res->tm_year % 4 == 0 && (res->tm_year% 100 != 0 || res->tm_year % 400 == 0));
// based on leap select which group to use
+
res->tm_mday = systime.wDay;
res->tm_min = systime.wMinute;
res->tm_mon = systime.wMonth - 1;
@@ -253,6 +294,7 @@ ACE_OS::localtime_r (const time_t *t, struct tm *res)
res->tm_yday = __mon_yday[iLeap][systime.wMonth] + systime.wDay;
res->tm_year = systime.wYear;// this the correct year but bias the value to start at the 1900
res->tm_year = res->tm_year - 1900;
+
return res;
#else
// @@ Same as ACE_OS::localtime (), you need to implement it
@@ -262,6 +304,7 @@ ACE_OS::localtime_r (const time_t *t, struct tm *res)
ACE_NOTSUP_RETURN (0);
#endif /* ACE_HAS_REENTRANT_FUNCTIONS */
}
+
time_t
ACE_OS::mktime (struct tm *t)
{
@@ -284,14 +327,17 @@ ACE_OS::mktime (struct tm *t)
# if defined (ACE_HAS_THREADS) && !defined (ACE_HAS_MT_SAFE_MKTIME)
ACE_OS_GUARD
# endif /* ACE_HAS_THREADS && ! ACE_HAS_MT_SAFE_MKTIME */
+
ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::mktime (t), time_t, (time_t) -1);
# endif /* ACE_HAS_WINCE */
}
+
#if defined (ACE_HAS_POWERPC_TIMER) && defined (ghs)
void
ACE_OS::readPPCTimeBase (u_long &most, u_long &least)
{
ACE_OS_TRACE ("ACE_OS::readPPCTimeBase");
+
// This function can't be inline because it depends on the arguments
// being in particular registers (r3 and r4), in conformance with the
// EABI standard. It would be nice if we knew how to put the variable
@@ -302,10 +348,12 @@ ACE_OS::readPPCTimeBase (u_long &most, u_long &least)
asm("mftb r7,TBU");
asm("cmpw r5,r7");
asm("bne aclock");
+
asm("stw r5, 0(r3)");
asm("stw r6, 0(r4)");
}
#endif /* ACE_HAS_POWERPC_TIMER && ghs */
+
#if defined (ACE_LACKS_STRPTIME) && !defined (ACE_REFUSE_STRPTIME_EMULATION)
char *
ACE_OS::strptime_emulation (const char *buf, const char *format, struct tm *tm)
@@ -313,9 +361,12 @@ ACE_OS::strptime_emulation (const char *buf, const char *format, struct tm *tm)
int bi = 0;
int fi = 0;
bool percent = false;
+
if (!buf || !format)
return 0;
+
ACE_OS::memset (tm, 0, sizeof (struct tm));
+
while (format[fi] != '\0')
{
if (percent)
@@ -332,12 +383,14 @@ ACE_OS::strptime_emulation (const char *buf, const char *format, struct tm *tm)
else
return const_cast<char*> (buf + bi);
break;
+
/* not supported yet: weekday via locale long/short names
case 'a': / * weekday via locale * /
/ * FALL THROUGH * /
case 'A': / * long/short names * /
break;
*/
+
/* not supported yet:
case 'b': / * month via locale * /
/ * FALL THROUGH * /
@@ -346,34 +399,44 @@ ACE_OS::strptime_emulation (const char *buf, const char *format, struct tm *tm)
case 'h':
break;
*/
+
/* not supported yet:
case 'c': / * %x %X * /
break;
*/
+
/* not supported yet:
case 'C': / * date & time - * /
/ * locale long format * /
break;
*/
+
case 'd': /* day of month (1-31) */
/* FALL THROUGH */
case 'e':
if (!ACE_OS::strptime_getnum
(buf + bi, &tm->tm_mday, &bi, &fi, 1, 31))
return const_cast<char*> (buf + bi);
+
break;
+
case 'D': /* %m/%d/%y */
if (!ACE_OS::strptime_getnum
(buf + bi, &tm->tm_mon, &bi, &fi, 1, 12))
return const_cast<char*> (buf + bi);
+
--fi;
tm->tm_mon--;
+
if (buf[bi] != '/')
return const_cast<char*> (buf + bi);
+
++bi;
+
if (!ACE_OS::strptime_getnum
(buf + bi, &tm->tm_mday, &bi, &fi, 1, 31))
return const_cast<char*> (buf + bi);
+
--fi;
if (buf[bi] != '/')
return const_cast<char*> (buf + bi);
@@ -384,6 +447,7 @@ ACE_OS::strptime_emulation (const char *buf, const char *format, struct tm *tm)
if (tm->tm_year < 69)
tm->tm_year += 100;
break;
+
case 'H': /* hour (0-23) */
/* FALL THROUGH */
case 'k':
@@ -391,41 +455,52 @@ ACE_OS::strptime_emulation (const char *buf, const char *format, struct tm *tm)
(buf + bi, &tm->tm_hour, &bi, &fi, 0, 23))
return const_cast<char*> (buf + bi);
break;
+
/* not supported yet:
case 'I': / * hour (0-12) * /
/ * FALL THROUGH * /
case 'l':
break;
*/
+
case 'j': /* day of year (0-366) */
if (!ACE_OS::strptime_getnum
(buf + bi, &tm->tm_yday, &bi, &fi, 1, 366))
return const_cast<char*> (buf + bi);
+
tm->tm_yday--;
break;
+
case 'm': /* an escaped % */
if (!ACE_OS::strptime_getnum
(buf + bi, &tm->tm_mon, &bi, &fi, 1, 12))
return const_cast<char*> (buf + bi);
+
tm->tm_mon--;
break;
+
case 'M': /* minute (0-59) */
if (!ACE_OS::strptime_getnum
(buf + bi, &tm->tm_min, &bi, &fi, 0, 59))
return const_cast<char*> (buf + bi);
+
break;
+
/* not supported yet:
case 'p': / * am or pm for locale * /
break;
*/
+
/* not supported yet:
case 'r': / * %I:%M:%S %p * /
break;
*/
+
case 'R': /* %H:%M */
if (!ACE_OS::strptime_getnum
(buf + bi, &tm->tm_hour, &bi, &fi, 0, 23))
return const_cast<char*> (buf + bi);
+
--fi;
if (buf[bi] != ':')
return const_cast<char*> (buf + bi);
@@ -433,16 +508,20 @@ ACE_OS::strptime_emulation (const char *buf, const char *format, struct tm *tm)
if (!ACE_OS::strptime_getnum
(buf + bi, &tm->tm_min, &bi, &fi, 0, 59))
return const_cast<char*> (buf + bi);
+
break;
+
case 'S': /* seconds (0-61) */
if (!ACE_OS::strptime_getnum
(buf + bi, &tm->tm_sec, &bi, &fi, 0, 61))
return const_cast<char*> (buf + bi);
break;
+
case 'T': /* %H:%M:%S */
if (!ACE_OS::strptime_getnum
(buf + bi, &tm->tm_hour, &bi, &fi, 0, 23))
return const_cast<char*> (buf + bi);
+
--fi;
if (buf[bi] != ':')
return const_cast<char*> (buf + bi);
@@ -450,6 +529,7 @@ ACE_OS::strptime_emulation (const char *buf, const char *format, struct tm *tm)
if (!ACE_OS::strptime_getnum
(buf + bi, &tm->tm_min, &bi, &fi, 0, 59))
return const_cast<char*> (buf + bi);
+
--fi;
if (buf[bi] != ':')
return const_cast<char*> (buf + bi);
@@ -457,36 +537,47 @@ ACE_OS::strptime_emulation (const char *buf, const char *format, struct tm *tm)
if (!ACE_OS::strptime_getnum
(buf + bi, &tm->tm_sec, &bi, &fi, 0, 61))
return const_cast<char*> (buf + bi);
+
break;
+
case 'w': /* day of week (0=Sun-6) */
if (!ACE_OS::strptime_getnum
(buf + bi, &tm->tm_wday, &bi, &fi, 0, 6))
return const_cast<char*> (buf + bi);
+
break;
+
/* not supported yet: date, based on locale
case 'x': / * date, based on locale * /
break;
*/
+
/* not supported yet:
case 'X': / * time, based on locale * /
break;
*/
+
case 'y': /* the year - 1900 (0-99) */
if (!ACE_OS::strptime_getnum
(buf + bi, &tm->tm_year, &bi, &fi, 0, 99))
return const_cast<char*> (buf + bi);
+
if (tm->tm_year < 69)
tm->tm_year += 100;
break;
+
case 'Y': /* the full year (1999) */
if (!ACE_OS::strptime_getnum
(buf + bi, &tm->tm_year, &bi, &fi, 0, 0))
return const_cast<char*> (buf + bi);
+
tm->tm_year -= 1900;
break;
+
default: /* unrecognised */
return const_cast<char*> (buf + bi);
} /* switch (format[fi]) */
+
}
else
{ /* if (percent) */
@@ -507,8 +598,10 @@ ACE_OS::strptime_emulation (const char *buf, const char *format, struct tm *tm)
}
} /* if (percent) */
} /* while (format[fi] */
+
return const_cast<char*> (buf + bi);
}
+
int
ACE_OS::strptime_getnum (const char *buf,
int *num,
@@ -518,6 +611,7 @@ ACE_OS::strptime_getnum (const char *buf,
int max)
{
int i = 0, tmp = 0;
+
while (isdigit (buf[i]))
{
tmp = (tmp * 10) + (buf[i] - '0');
@@ -525,6 +619,7 @@ ACE_OS::strptime_getnum (const char *buf,
return 0;
++i;
}
+
if (tmp < min)
return 0;
else if (i)
@@ -538,5 +633,6 @@ ACE_OS::strptime_getnum (const char *buf,
return 0;
}
#endif /* ACE_LACKS_STRPTIME && !ACE_REFUSE_STRPTIME_EMULATION */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_NS_time.h b/dep/ACE_wrappers/ace/OS_NS_time.h
index 7924fc1fd3a..61b51ffebf1 100644
--- a/dep/ACE_wrappers/ace/OS_NS_time.h
+++ b/dep/ACE_wrappers/ace/OS_NS_time.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file OS_NS_time.h
@@ -12,30 +13,40 @@
* Originally in OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_NS_TIME_H
# define ACE_OS_NS_TIME_H
+
# include /**/ "ace/pre.h"
+
# include "ace/config-all.h"
+
# if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
# endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/OS_NS_errno.h"
#include "ace/Basic_Types.h"
#include "ace/os_include/os_time.h"
#include /**/ "ace/ACE_export.h"
+
#if defined (ACE_EXPORT_MACRO)
# undef ACE_EXPORT_MACRO
#endif
#define ACE_EXPORT_MACRO ACE_Export
+
# if defined (ACE_HAS_BROKEN_R_ROUTINES)
# undef ctime_r
# undef asctime_r
# endif /* ACE_HAS_BROKEN_R_ROUTINES */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Type-safe, and unsigned.
static const ACE_UINT32 ACE_U_ONE_SECOND_IN_MSECS = 1000U;
static const ACE_UINT32 ACE_U_ONE_SECOND_IN_USECS = 1000000U;
static const ACE_UINT32 ACE_U_ONE_SECOND_IN_NSECS = 1000000000U;
+
#if defined (ACE_LACKS_STRUCT_TM)
struct tm {
int tm_sec;
@@ -49,6 +60,7 @@ struct tm {
int tm_isdst; // >0 if dst in effet; 0 if not; <0 if unknown
};
#endif /* ACE_LACKS_STRUCT_TM */
+
/// Helper for the ACE_OS::timezone() function
/**
* We put all the timezone stuff that used to be in ACE_OS::timezone()
@@ -84,6 +96,7 @@ inline long ace_timezone()
#endif
}
+
#if !defined (ACE_LACKS_DIFFTIME)
/// Helper for the ACE_OS::difftime() function
/**
@@ -99,6 +112,7 @@ inline double ace_difftime(time_t t1, time_t t0)
return difftime (t1, t0);
}
#endif /* !ACE_LACKS_DIFFTIME */
+
# if defined (ACE_WIN32)
# if !defined (ACE_LACKS_LONGLONG_T)
// 64-bit quad-word definitions.
@@ -121,6 +135,7 @@ typedef long long ACE_hrtime_t;
typedef ACE_UINT64 ACE_hrtime_t;
# endif /* ! ACE_HAS_HI_RES_TIMER || ACE_LACKS_LONGLONG_T */
# endif /* ACE_WIN32 */
+
# if defined (ACE_LACKS_UNSIGNEDLONGLONG_T)
# define ACE_HRTIME_CONVERSION(VAL) ACE_U64_TO_U32(VAL)
# define ACE_HRTIME_TO_U64(VAL) ACE_U_LongLong(VAL)
@@ -128,6 +143,7 @@ typedef long long ACE_hrtime_t;
# define ACE_HRTIME_CONVERSION(VAL) (VAL)
# define ACE_HRTIME_TO_U64(VAL) (VAL)
# endif
+
namespace ACE_OS
{
enum ACE_HRTimer_Op
@@ -137,29 +153,38 @@ namespace ACE_OS
ACE_HRTIMER_STOP = 0x2, // the timed interval!!!!
ACE_HRTIMER_GETTIME = 0xFFFF
};
+
//@{ @name A set of wrappers for operations on time.
+
ACE_NAMESPACE_INLINE_FUNCTION
char *asctime (const struct tm *tm);
+
ACE_NAMESPACE_INLINE_FUNCTION
char *asctime_r (const struct tm *tm,
char *buf, int buflen);
+
ACE_NAMESPACE_INLINE_FUNCTION
int clock_gettime (clockid_t,
struct timespec *);
+
ACE_NAMESPACE_INLINE_FUNCTION
int clock_settime (clockid_t,
const struct timespec *);
+
ACE_NAMESPACE_INLINE_FUNCTION
ACE_TCHAR *ctime (const time_t *t);
+
#if defined (ACE_HAS_WINCE) && !defined (_DEBUG)
extern ACE_EXPORT_MACRO
#else
ACE_NAMESPACE_INLINE_FUNCTION
#endif
ACE_TCHAR *ctime_r (const time_t *clock, ACE_TCHAR *buf, int buflen);
+
# if defined (difftime)
# undef difftime
# endif /* difftime */
+
#if !defined (ACE_LACKS_DIFFTIME)
ACE_NAMESPACE_INLINE_FUNCTION
#else
@@ -167,60 +192,79 @@ namespace ACE_OS
#endif /* ! ACE_LACKS_DIFFTIME */
double difftime (time_t t1,
time_t t0);
+
ACE_NAMESPACE_INLINE_FUNCTION
ACE_hrtime_t gethrtime (const ACE_HRTimer_Op = ACE_HRTIMER_GETTIME);
+
ACE_NAMESPACE_INLINE_FUNCTION
struct tm *gmtime (const time_t *clock);
+
ACE_NAMESPACE_INLINE_FUNCTION
struct tm *gmtime_r (const time_t *clock,
struct tm *res);
+
ACE_NAMESPACE_INLINE_FUNCTION
struct tm *localtime (const time_t *clock);
+
extern ACE_Export
struct tm *localtime_r (const time_t *clock,
struct tm *res);
+
// Get the current time.
extern ACE_Export
time_t mktime (struct tm *timeptr);
+
ACE_NAMESPACE_INLINE_FUNCTION
int nanosleep (const struct timespec *requested,
struct timespec *remaining = 0);
+
# if defined (ACE_HAS_POWERPC_TIMER) && defined (ghs)
extern ACE_Export
void readPPCTimeBase (u_long &most,
u_long &least);
# endif /* ACE_HAS_POWERPC_TIMER && ghs */
+
ACE_NAMESPACE_INLINE_FUNCTION
size_t strftime (char *s,
size_t maxsize,
const char *format,
const struct tm *timeptr);
+
ACE_NAMESPACE_INLINE_FUNCTION
char *strptime (const char *buf,
const char *format,
struct tm *tm);
+
# if defined (ACE_LACKS_STRPTIME) && !defined (ACE_REFUSE_STRPTIME_EMULATION)
extern ACE_Export
char *strptime_emulation (const char *buf,
const char *format,
struct tm *tm);
+
extern ACE_Export
int strptime_getnum (const char *buf, int *num, int *bi,
int *fi, int min, int max);
# endif /* ACE_LACKS_STRPTIME && !ACE_REFUSE_STRPTIME_EMULATION */
+
ACE_NAMESPACE_INLINE_FUNCTION
time_t time (time_t *tloc = 0);
+
# if defined (timezone)
# undef timezone
# endif /* timezone */
+
ACE_NAMESPACE_INLINE_FUNCTION
long timezone (void);
+
// wrapper for time zone information.
ACE_NAMESPACE_INLINE_FUNCTION
void tzset (void);
+
//@}
} /* namespace ACE_OS */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if (defined (ACE_HAS_VERSIONED_NAMESPACE) \
&& ACE_HAS_VERSIONED_NAMESPACE == 1) \
&& defined (ghs) \
@@ -231,6 +275,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_GETHRTIME_NAME ACE_gethrtime
#endif /* ACE_HAS_VERSIONED_NAMESPACE == 1 */
+
# if defined (ACE_HAS_INLINED_OSCALLS)
# if defined (ACE_INLINE)
# undef ACE_INLINE
@@ -238,6 +283,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_INLINE inline
# include "ace/OS_NS_time.inl"
# endif /* ACE_HAS_INLINED_OSCALLS */
+
# include /**/ "ace/post.h"
#endif /* ACE_OS_NS_TIME_H */
diff --git a/dep/ACE_wrappers/ace/OS_NS_time.inl b/dep/ACE_wrappers/ace/OS_NS_time.inl
index e01471faf65..661ecb81748 100644
--- a/dep/ACE_wrappers/ace/OS_NS_time.inl
+++ b/dep/ACE_wrappers/ace/OS_NS_time.inl
@@ -1,12 +1,15 @@
// -*- C++ -*-
//
// $Id: OS_NS_time.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_string.h"
#include "ace/OS_NS_errno.h"
#include "ace/Time_Value.h"
#include "ace/OS_NS_unistd.h"
#include "ace/OS_NS_sys_time.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE char *
ACE_OS::asctime (const struct tm *t)
{
@@ -18,6 +21,7 @@ ACE_OS::asctime (const struct tm *t)
ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::asctime (t), char *, 0);
#endif /* ACE_LACKS_ASCTIME */
}
+
ACE_INLINE char *
ACE_OS::asctime_r (const struct tm *t, char *buf, int buflen)
{
@@ -56,6 +60,7 @@ ACE_OS::asctime_r (const struct tm *t, char *buf, int buflen)
return buf;
#endif /* ACE_HAS_REENTRANT_FUNCTIONS */
}
+
ACE_INLINE int
ACE_OS::clock_gettime (clockid_t clockid, struct timespec *ts)
{
@@ -68,6 +73,7 @@ ACE_OS::clock_gettime (clockid_t clockid, struct timespec *ts)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_CLOCK_GETTIME */
}
+
ACE_INLINE int
ACE_OS::clock_settime (clockid_t clockid, const struct timespec *ts)
{
@@ -83,8 +89,10 @@ ACE_OS::clock_settime (clockid_t clockid, const struct timespec *ts)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_CLOCK_SETTIME */
}
+
// Magic number declaration and definition for ctime and ctime_r ()
static const int ctime_buf_size = 26;
+
ACE_INLINE ACE_TCHAR *
ACE_OS::ctime (const time_t *t)
{
@@ -118,12 +126,15 @@ ACE_OS::ctime (const time_t *t)
# endif /* ACE_USES_WCHAR */
# endif /* ACE_HAS_BROKEN_CTIME */
}
+
#if !defined (ACE_HAS_WINCE) /* CE version in OS.cpp */
ACE_INLINE ACE_TCHAR *
ACE_OS::ctime_r (const time_t *t, ACE_TCHAR *buf, int buflen)
{
ACE_OS_TRACE ("ACE_OS::ctime_r");
+
#if defined (ACE_HAS_REENTRANT_FUNCTIONS)
+
char *bufp = 0;
# if defined (ACE_USES_WCHAR)
char narrow_buf[ctime_buf_size];
@@ -131,6 +142,7 @@ ACE_OS::ctime_r (const time_t *t, ACE_TCHAR *buf, int buflen)
# else
bufp = buf;
# endif /* ACE_USES_WCHAR */
+
if (buflen < ctime_buf_size)
{
errno = ERANGE;
@@ -143,14 +155,18 @@ ACE_OS::ctime_r (const time_t *t, ACE_TCHAR *buf, int buflen)
ACE_OSCALL (::ctime_r (t, bufp), char *, 0, bufp);
# endif /* DIGITAL_UNIX */
# else /* ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R */
+
# if defined (ACE_HAS_SIZET_PTR_ASCTIME_R_AND_CTIME_R)
bufp = ::ctime_r (t, bufp, reinterpret_cast<size_t*>(&buflen));
# else /* ACE_CTIME_R_RETURNS_INT */
bufp = ::ctime_r (t, bufp, buflen);
# endif /* ACE_CTIME_R_RETURNS_INT */
+
# endif /* ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R */
+
if (bufp == 0)
return 0;
+
# if defined (ACE_USES_WCHAR)
ACE_Ascii_To_Wide wide_buf (bufp);
ACE_OS_String::strcpy (buf, wide_buf.wchar_rep ());
@@ -158,6 +174,7 @@ ACE_OS::ctime_r (const time_t *t, ACE_TCHAR *buf, int buflen)
# else
return bufp;
# endif /* ACE_USES_WCHAR */
+
#elif defined (ACE_HAS_TR24731_2005_CRT)
if (buflen < ctime_buf_size)
{
@@ -171,12 +188,14 @@ ACE_OS::ctime_r (const time_t *t, ACE_TCHAR *buf, int buflen)
ACE_SECURECRTCALL (ctime_s (buf, buflen, t), char *, 0, result);
# endif
return result;
+
#else /* ACE_HAS_REENTRANT_FUNCTIONS */
if (buflen < ctime_buf_size)
{
errno = ERANGE;
return 0;
}
+
ACE_TCHAR *result;
# if defined (ACE_USES_WCHAR)
ACE_OSCALL (::_wctime (t), wchar_t *, 0, result);
@@ -189,6 +208,7 @@ ACE_OS::ctime_r (const time_t *t, ACE_TCHAR *buf, int buflen)
#endif /* ACE_HAS_REENTRANT_FUNCTIONS */
}
#endif /* !ACE_HAS_WINCE */
+
#if !defined (ACE_LACKS_DIFFTIME)
ACE_INLINE double
ACE_OS::difftime (time_t t1, time_t t0)
@@ -196,9 +216,11 @@ ACE_OS::difftime (time_t t1, time_t t0)
return ::ace_difftime (t1, t0);
}
#endif /* ! ACE_LACKS_DIFFTIME */
+
#if defined (ghs) && defined (ACE_HAS_PENTIUM) && !defined (ACE_WIN32)
extern "C" ACE_hrtime_t ACE_GETHRTIME_NAME ();
#endif /* ghs && ACE_HAS_PENTIUM */
+
ACE_INLINE ACE_hrtime_t
ACE_OS::gethrtime (const ACE_HRTimer_Op op)
{
@@ -209,13 +231,17 @@ ACE_OS::gethrtime (const ACE_HRTimer_Op op)
#elif defined (ACE_HAS_AIX_HI_RES_TIMER)
ACE_UNUSED_ARG (op);
timebasestruct_t tb;
+
::read_real_time(&tb, TIMEBASE_SZ);
::time_base_to_time(&tb, TIMEBASE_SZ);
+
return ACE_hrtime_t(tb.tb_high) * ACE_ONE_SECOND_IN_NSECS + tb.tb_low;
#elif defined (ACE_WIN32)
ACE_UNUSED_ARG(op);
LARGE_INTEGER freq;
+
::QueryPerformanceCounter (&freq);
+
# if defined (ACE_LACKS_LONGLONG_T)
ACE_UINT64 uint64_freq (freq.u.LowPart,
static_cast<unsigned int> (freq.u.HighPart));
@@ -234,8 +260,9 @@ ACE_OS::gethrtime (const ACE_HRTimer_Op op)
# else /* ! ACE_LACKS_LONGLONG_T */
ACE_hrtime_t now;
# endif /* ! ACE_LACKS_LONGLONG_T */
+
#if defined (__amd64__) || defined (__x86_64__)
- // Read the high res tick counter into 32 bit int variables "eax" and
+ // Read the high res tick counter into 32 bit int variables "eax" and
// "edx", and then combine them into 64 bit int "now"
ACE_UINT32 eax, edx;
asm volatile ("rdtsc" : "=a" (eax), "=d" (edx) : : "memory");
@@ -245,11 +272,13 @@ ACE_OS::gethrtime (const ACE_HRTimer_Op op)
// The A constraint signifies a 64-bit int.
asm volatile ("rdtsc" : "=A" (now) : : "memory");
#endif
+
# if defined (ACE_LACKS_LONGLONG_T)
ACE_UINT32 least, most;
ACE_OS::memcpy (&least, &now, sizeof (ACE_UINT32));
ACE_OS::memcpy (&most, (u_char *) &now + sizeof (ACE_UINT32),
sizeof (ACE_UINT32));
+
ACE_hrtime_t ret (least, most);
return ret;
# else /* ! ACE_LACKS_LONGLONG_T */
@@ -263,21 +292,26 @@ ACE_OS::gethrtime (const ACE_HRTimer_Op op)
// the time that the process was running. This information is from
// David Mosberger's article, see comment below.
ACE_UINT32 now;
+
// The following statement is based on code published by:
// Mosberger, David, "How to Make Your Applications Fly, Part 1",
// Linux Journal Issue 42, October 1997, page 50. It reads the
// high-res tick counter directly into the memory variable.
asm volatile ("rpcc %0" : "=r" (now) : : "memory");
+
return now;
#elif defined (ACE_HAS_POWERPC_TIMER) && (defined (ghs) || defined (__GNUG__))
// PowerPC w/ GreenHills or g++.
+
ACE_UNUSED_ARG (op);
u_long most;
u_long least;
+
#if defined (ghs)
ACE_OS::readPPCTimeBase (most, least);
#else
u_long scratch;
+
do {
asm volatile ("mftbu %0\n"
"mftb %1\n"
@@ -285,21 +319,25 @@ ACE_OS::gethrtime (const ACE_HRTimer_Op op)
: "=r" (most), "=r" (least), "=r" (scratch));
} while (most != scratch);
#endif
+
#if defined (ACE_LACKS_LONGLONG_T)
return ACE_U_LongLong (least, most);
#else /* ! ACE_LACKS_LONGLONG_T */
return 0x100000000llu * most + least;
#endif /* ! ACE_LACKS_LONGLONG_T */
+
#elif defined (ACE_HAS_CLOCK_GETTIME)
// e.g., VxWorks (besides POWERPC && GreenHills) . . .
ACE_UNUSED_ARG (op);
struct timespec ts;
+
ACE_OS::clock_gettime (
#if defined (ACE_HAS_CLOCK_GETTIME_MONOTONIC)
CLOCK_MONOTONIC,
#endif /* !ACE_HAS_CLOCK_GETTIME_MONOTONIC */
CLOCK_REALTIME,
&ts);
+
// Carefully create the return value to avoid arithmetic overflow
// if ACE_hrtime_t is ACE_U_LongLong.
return static_cast<ACE_hrtime_t> (ts.tv_sec) *
@@ -307,12 +345,14 @@ ACE_OS::gethrtime (const ACE_HRTimer_Op op)
#else
ACE_UNUSED_ARG (op);
ACE_Time_Value const now = ACE_OS::gettimeofday ();
+
// Carefully create the return value to avoid arithmetic overflow
// if ACE_hrtime_t is ACE_U_LongLong.
return (static_cast<ACE_hrtime_t> (now.sec ()) * (ACE_UINT32) 1000000 +
static_cast<ACE_hrtime_t> (now.usec ())) * (ACE_UINT32) 1000;
#endif /* ACE_HAS_HI_RES_TIMER */
}
+
ACE_INLINE struct tm *
ACE_OS::gmtime (const time_t *t)
{
@@ -324,6 +364,7 @@ ACE_OS::gmtime (const time_t *t)
ACE_OSCALL_RETURN (::gmtime (t), struct tm *, 0);
#endif /* ACE_LACKS_GMTIME */
}
+
ACE_INLINE struct tm *
ACE_OS::gmtime_r (const time_t *t, struct tm *res)
{
@@ -350,6 +391,7 @@ ACE_OS::gmtime_r (const time_t *t, struct tm *res)
return res;
#endif /* ACE_HAS_REENTRANT_FUNCTIONS */
}
+
ACE_INLINE struct tm *
ACE_OS::localtime (const time_t *t)
{
@@ -361,6 +403,7 @@ ACE_OS::localtime (const time_t *t)
ACE_OSCALL_RETURN (::localtime (t), struct tm *, 0);
#endif /* ACE_LACKS_LOCALTIME */
}
+
ACE_INLINE int
ACE_OS::nanosleep (const struct timespec *requested,
struct timespec *remaining)
@@ -374,12 +417,14 @@ ACE_OS::nanosleep (const struct timespec *requested,
return ::nanosleep ((ACE_TIMESPEC_PTR) requested, remaining);
#else
ACE_UNUSED_ARG (remaining);
+
// Convert into seconds and microseconds.
ACE_Time_Value tv (requested->tv_sec,
requested->tv_nsec / 1000);
return ACE_OS::sleep (tv);
#endif /* ACE_HAS_CLOCK_GETTIME */
}
+
ACE_INLINE size_t
ACE_OS::strftime (char *s, size_t maxsize, const char *format,
const struct tm *timeptr)
@@ -394,6 +439,7 @@ ACE_OS::strftime (char *s, size_t maxsize, const char *format,
return ACE_STD_NAMESPACE::strftime (s, maxsize, format, timeptr);
#endif /* ACE_LACKS_STRFTIME */
}
+
ACE_INLINE char *
ACE_OS::strptime (const char *buf, const char *format, struct tm *tm)
{
@@ -410,6 +456,7 @@ ACE_OS::strptime (const char *buf, const char *format, struct tm *tm)
return ::strptime (buf, format, tm);
#endif /* ACE_LACKS_STRPTIME */
}
+
ACE_INLINE time_t
ACE_OS::time (time_t *tloc)
{
@@ -423,6 +470,7 @@ ACE_OS::time (time_t *tloc)
return retv;
#endif /* ACE_HAS_WINCE */
}
+
// Linux won't compile unless we explicitly use a namespace here.
#if defined (__GNUG__)
namespace ACE_OS {
@@ -439,6 +487,7 @@ ACE_OS::timezone (void)
return ::ace_timezone ();
}
#endif /* linux */
+
ACE_INLINE void
ACE_OS::tzset (void)
{
@@ -452,4 +501,5 @@ ACE_OS::tzset (void)
errno = ENOTSUP;
# endif /* ACE_HAS_WINCE && !VXWORKS && !ACE_HAS_RTEMS && !ACE_HAS_DINKUM_STL */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_NS_unistd.cpp b/dep/ACE_wrappers/ace/OS_NS_unistd.cpp
index 918ed9d991c..7aa77e4f693 100644
--- a/dep/ACE_wrappers/ace/OS_NS_unistd.cpp
+++ b/dep/ACE_wrappers/ace/OS_NS_unistd.cpp
@@ -1,9 +1,13 @@
// $Id: OS_NS_unistd.cpp 82559 2008-08-07 20:23:07Z parsons $
+
#include "ace/OS_NS_unistd.h"
+
ACE_RCSID (ace, OS_NS_unistd, "$Id: OS_NS_unistd.cpp 82559 2008-08-07 20:23:07Z parsons $")
+
#if !defined (ACE_HAS_INLINED_OSCALLS)
# include "ace/OS_NS_unistd.inl"
#endif /* ACE_HAS_INLINED_OSCALLS */
+
#include "ace/Base_Thread_Adapter.h"
#include "ace/OS_NS_stdlib.h"
#include "ace/OS_NS_ctype.h"
@@ -14,6 +18,7 @@ ACE_RCSID (ace, OS_NS_unistd, "$Id: OS_NS_unistd.cpp 82559 2008-08-07 20:23:07Z
#include "ace/Auto_Ptr.h"
#include "ace/os_include/sys/os_pstat.h"
#include "ace/os_include/sys/os_sysctl.h"
+
#if defined (ACE_NEEDS_FTRUNCATE)
extern "C" int
ftruncate (ACE_HANDLE handle, long len)
@@ -23,11 +28,15 @@ ftruncate (ACE_HANDLE handle, long len)
fl.l_len = 0;
fl.l_start = len;
fl.l_type = F_WRLCK;
+
return ACE_OS::fcntl (handle, F_FREESP, reinterpret_cast <long> (&fl));
}
#endif /* ACE_NEEDS_FTRUNCATE */
+
/*****************************************************************************/
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
int
ACE_OS::argv_to_string (ACE_TCHAR **argv,
ACE_TCHAR *&buf,
@@ -36,15 +45,18 @@ ACE_OS::argv_to_string (ACE_TCHAR **argv,
{
if (argv == 0 || argv[0] == 0)
return 0;
+
int argc;
for (argc = 0; argv[argc] != 0; ++argc)
continue;
+
return argv_to_string (argc,
argv,
buf,
substitute_env_args,
quote_args);
}
+
int
ACE_OS::argv_to_string (int argc,
ACE_TCHAR **argv,
@@ -54,9 +66,13 @@ ACE_OS::argv_to_string (int argc,
{
if (argc <= 0 || argv == 0 || argv[0] == 0)
return 0;
+
size_t buf_len = 0;
+
// Determine the length of the buffer.
+
ACE_TCHAR **argv_p = argv;
+
for (int i = 0; i < argc; ++i)
{
#if !defined (ACE_LACKS_ENV)
@@ -119,7 +135,9 @@ ACE_OS::argv_to_string (int argc,
return 0;
}
ACE_TCHAR *end = argv_p[i];
+
*end++ = ACE_TEXT ('"');
+
if (quotes > 0)
{
for (ACE_TCHAR *p = temp;
@@ -127,43 +145,55 @@ ACE_OS::argv_to_string (int argc,
*end++ = *p++)
if (*p == ACE_TEXT ('"'))
*end++ = ACE_TEXT ('\\');
+
*end++ = ACE_TEXT ('\0');
}
else
end = ACE_OS::strecpy (end, temp);
+
end[-1] = ACE_TEXT ('"');
+
*end = ACE_TEXT ('\0');
if (temp != argv[i])
ACE_OS::free (temp);
}
buf_len += ACE_OS::strlen (argv_p[i]);
+
// Add one for the extra space between each string.
buf_len++;
}
+
// Step through all argv params and copy each one into buf; separate
// each param with white space.
+
ACE_NEW_RETURN (buf,
ACE_TCHAR[buf_len + 1],
0);
+
// Initial null charater to make it a null string.
buf[0] = ACE_TEXT ('\0');
ACE_TCHAR *end = buf;
+
for (int i = 0; i < argc; ++i)
{
end = ACE_OS::strecpy (end, argv_p[i]);
if (argv_p[i] != argv[i])
ACE_OS::free (argv_p[i]);
+
// Replace the null char that strecpy put there with white
// space.
end[-1] = ACE_TEXT (' ');
}
// Null terminate the string.
*end = ACE_TEXT ('\0');
+
if (argv_p != argv)
ACE_OS::free (argv_p);
+
// The number of arguments.
return argc;
}
+
int
ACE_OS::execl (const char * /* path */, const char * /* arg0 */, ...)
{
@@ -172,6 +202,7 @@ ACE_OS::execl (const char * /* path */, const char * /* arg0 */, ...)
// Need to write this code.
// ACE_OSCALL_RETURN (::execv (path, argv), int, -1);
}
+
int
ACE_OS::execle (const char * /* path */, const char * /* arg0 */, ...)
{
@@ -180,6 +211,7 @@ ACE_OS::execle (const char * /* path */, const char * /* arg0 */, ...)
// Need to write this code.
// ACE_OSCALL_RETURN (::execve (path, argv, envp), int, -1);
}
+
int
ACE_OS::execlp (const char * /* file */, const char * /* arg0 */, ...)
{
@@ -188,6 +220,7 @@ ACE_OS::execlp (const char * /* file */, const char * /* arg0 */, ...)
// Need to write this code.
// ACE_OSCALL_RETURN (::execvp (file, argv), int, -1);
}
+
pid_t
ACE_OS::fork (const ACE_TCHAR *program_name)
{
@@ -202,7 +235,9 @@ ACE_OS::fork (const ACE_TCHAR *program_name)
#else
::fork ();
#endif /* ACE_HAS_STHREADS */
+
#if !defined (ACE_HAS_MINIMAL_ACE_OS) && !defined (ACE_HAS_THREADS)
+
// ACE_Base_Thread_Adapter::sync_log_msg() is used to update the
// program name and process id in ACE's log framework. However, we
// can't invoke it from (the child process of) threaded programs
@@ -214,20 +249,28 @@ ACE_OS::fork (const ACE_TCHAR *program_name)
// process will undoubtedly call async signal unsafe functions too.
// So it doesn't really matter that the program name and process id
// will not be updated.
+
if (pid == 0)
ACE_Base_Thread_Adapter::sync_log_msg (program_name);
+
#else
+
ACE_UNUSED_ARG (program_name);
+
#endif /* ! ACE_HAS_MINIMAL_ACE_OS && !ACE_HAS_THREADS */
+
return pid;
# endif /* ACE_WIN32 */
}
+
// Create a contiguous command-line argument buffer with each arg
// separated by spaces.
+
pid_t
ACE_OS::fork_exec (ACE_TCHAR *argv[])
{
# if defined (ACE_WIN32)
+
ACE_TCHAR *buf = 0;
ACE_Auto_Basic_Array_Ptr<ACE_TCHAR> safe_ptr (buf);
if (ACE_OS::argv_to_string (argv, buf) != -1)
@@ -239,6 +282,7 @@ ACE_OS::fork_exec (ACE_TCHAR *argv[])
0,
sizeof startup_info);
startup_info.cb = sizeof startup_info;
+
if (ACE_TEXT_CreateProcess (0,
buf,
0, // No process attributes.
@@ -269,16 +313,19 @@ ACE_OS::fork_exec (ACE_TCHAR *argv[])
return process_info.dwProcessId;
}
}
+
// CreateProcess failed.
return -1;
# else
pid_t const result = ACE_OS::fork ();
+
# if defined (ACE_USES_WCHAR)
// Wide-char builds need to convert the command-line args to
// narrow char strings for execv ().
char **cargv = 0;
int arg_count;
# endif /* ACE_HAS_WCHAR */
+
switch (result)
{
case -1:
@@ -307,20 +354,24 @@ ACE_OS::fork_exec (ACE_TCHAR *argv[])
// The OS layer should not print stuff out
// ACE_ERROR ((LM_ERROR,
// "%p Exec failed\n"));
+
// If the execv fails, this child needs to exit.
ACE_OS::exit (errno);
}
# endif /* ACE_HAS_WCHAR */
+
default:
// Server process. The fork succeeded.
return result;
}
# endif /* ACE_WIN32 */
}
+
long
ACE_OS::num_processors (void)
{
ACE_OS_TRACE ("ACE_OS::num_processors");
+
#if defined (ACE_HAS_PHARLAP)
return 1;
#elif defined (ACE_WIN32)
@@ -347,10 +398,12 @@ ACE_OS::num_processors (void)
ACE_NOTSUP_RETURN (-1);
#endif
}
+
long
ACE_OS::num_processors_online (void)
{
ACE_OS_TRACE ("ACE_OS::num_processors_online");
+
#if defined (ACE_HAS_PHARLAP)
return 1;
#elif defined (ACE_WIN32)
@@ -385,6 +438,7 @@ ACE_OS::num_processors_online (void)
ACE_NOTSUP_RETURN (-1);
#endif
}
+
ssize_t
ACE_OS::read_n (ACE_HANDLE handle,
void *buf,
@@ -394,6 +448,7 @@ ACE_OS::read_n (ACE_HANDLE handle,
size_t temp;
size_t &bytes_transferred = bt == 0 ? temp : *bt;
ssize_t n = 0;
+
for (bytes_transferred = 0;
bytes_transferred < len;
bytes_transferred += n)
@@ -401,13 +456,16 @@ ACE_OS::read_n (ACE_HANDLE handle,
n = ACE_OS::read (handle,
(char *) buf + bytes_transferred,
len - bytes_transferred);
+
if (n == -1 || n == 0)
{
return n;
}
}
+
return ACE_Utils::truncate_cast<ssize_t> (bytes_transferred);
}
+
ssize_t
ACE_OS::pread (ACE_HANDLE handle,
void *buf,
@@ -416,16 +474,20 @@ ACE_OS::pread (ACE_HANDLE handle,
{
# if defined (ACE_HAS_P_READ_WRITE)
# if defined (ACE_WIN32)
+
ACE_OS_GUARD
+
// Remember the original file pointer position
LONG original_high_position = 0;
DWORD original_low_position = ::SetFilePointer (handle,
0,
&original_high_position,
FILE_CURRENT);
+
if (original_low_position == INVALID_SET_FILE_POINTER
&& GetLastError () != NO_ERROR)
return -1;
+
// Go to the correct position
LONG low_offset = ACE_LOW_PART (offset);
LONG high_offset = ACE_HIGH_PART (offset);
@@ -436,23 +498,29 @@ ACE_OS::pread (ACE_HANDLE handle,
if (altered_position == INVALID_SET_FILE_POINTER
&& GetLastError () != NO_ERROR)
return -1;
+
DWORD bytes_read;
+
# if defined (ACE_HAS_WIN32_OVERLAPPED_IO)
+
OVERLAPPED overlapped;
overlapped.Internal = 0;
overlapped.InternalHigh = 0;
overlapped.Offset = low_offset;
overlapped.OffsetHigh = high_offset;
overlapped.hEvent = 0;
+
BOOL result = ::ReadFile (handle,
buf,
static_cast <DWORD> (nbytes),
&bytes_read,
&overlapped);
+
if (result == FALSE)
{
if (::GetLastError () != ERROR_IO_PENDING)
return -1;
+
else
{
result = ::GetOverlappedResult (handle,
@@ -463,7 +531,9 @@ ACE_OS::pread (ACE_HANDLE handle,
return -1;
}
}
+
# else /* ACE_HAS_WIN32_OVERLAPPED_IO */
+
BOOL result = ::ReadFile (handle,
buf,
nbytes,
@@ -471,7 +541,9 @@ ACE_OS::pread (ACE_HANDLE handle,
0);
if (result == FALSE)
return -1;
+
# endif /* ACE_HAS_WIN32_OVERLAPPED_IO */
+
// Reset the original file pointer position
if (::SetFilePointer (handle,
original_low_position,
@@ -479,32 +551,48 @@ ACE_OS::pread (ACE_HANDLE handle,
FILE_BEGIN) == INVALID_SET_FILE_POINTER
&& GetLastError () != NO_ERROR)
return -1;
+
return (ssize_t) bytes_read;
+
# else /* ACE_WIN32 */
+
return ::pread (handle, buf, nbytes, offset);
+
# endif /* ACE_WIN32 */
+
# else /* ACE_HAS_P_READ_WRITE */
+
ACE_OS_GUARD
+
// Remember the original file pointer position
ACE_OFF_T original_position = ACE_OS::lseek (handle,
0,
SEEK_CUR);
+
if (original_position == -1)
return -1;
+
// Go to the correct position
ACE_OFF_T altered_position = ACE_OS::lseek (handle, offset, SEEK_SET);
+
if (altered_position == -1)
return -1;
+
ssize_t const bytes_read = ACE_OS::read (handle, buf, nbytes);
+
if (bytes_read == -1)
return -1;
+
if (ACE_OS::lseek (handle,
original_position,
SEEK_SET) == -1)
return -1;
+
return bytes_read;
+
# endif /* ACE_HAD_P_READ_WRITE */
}
+
ssize_t
ACE_OS::pwrite (ACE_HANDLE handle,
const void *buf,
@@ -513,7 +601,9 @@ ACE_OS::pwrite (ACE_HANDLE handle,
{
# if defined (ACE_HAS_P_READ_WRITE)
# if defined (ACE_WIN32)
+
ACE_OS_GUARD
+
// Remember the original file pointer position
LARGE_INTEGER orig_position;
orig_position.QuadPart = 0;
@@ -524,25 +614,31 @@ ACE_OS::pwrite (ACE_HANDLE handle,
if (orig_position.LowPart == INVALID_SET_FILE_POINTER
&& GetLastError () != NO_ERROR)
return -1;
+
DWORD bytes_written;
LARGE_INTEGER loffset;
loffset.QuadPart = offset;
+
# if defined (ACE_HAS_WIN32_OVERLAPPED_IO)
+
OVERLAPPED overlapped;
overlapped.Internal = 0;
overlapped.InternalHigh = 0;
overlapped.Offset = loffset.LowPart;
overlapped.OffsetHigh = loffset.HighPart;
overlapped.hEvent = 0;
+
BOOL result = ::WriteFile (handle,
buf,
static_cast <DWORD> (nbytes),
&bytes_written,
&overlapped);
+
if (result == FALSE)
{
if (::GetLastError () != ERROR_IO_PENDING)
return -1;
+
result = ::GetOverlappedResult (handle,
&overlapped,
&bytes_written,
@@ -550,7 +646,9 @@ ACE_OS::pwrite (ACE_HANDLE handle,
if (result == FALSE)
return -1;
}
+
# else /* ACE_HAS_WIN32_OVERLAPPED_IO */
+
// Go to the correct position; if this is a Windows variant without
// overlapped I/O, it probably doesn't have SetFilePointerEx either,
// so manage this with SetFilePointer, changing calls based on the use
@@ -572,6 +670,7 @@ ACE_OS::pwrite (ACE_HANDLE handle,
ACE_OS::set_errno_to_last_error ();
return -1;
}
+
BOOL result = ::WriteFile (handle,
buf,
nbytes,
@@ -579,7 +678,9 @@ ACE_OS::pwrite (ACE_HANDLE handle,
0);
if (result == FALSE)
return -1;
+
# endif /* ACE_HAS_WIN32_OVERLAPPED_IO */
+
// Reset the original file pointer position
if (::SetFilePointer (handle,
orig_position.LowPart,
@@ -587,36 +688,46 @@ ACE_OS::pwrite (ACE_HANDLE handle,
FILE_BEGIN) == INVALID_SET_FILE_POINTER
&& GetLastError () != NO_ERROR)
return -1;
+
return (ssize_t) bytes_written;
+
# else /* ACE_WIN32 */
+
return ::pwrite (handle, buf, nbytes, offset);
# endif /* ACE_WIN32 */
# else /* ACE_HAS_P_READ_WRITE */
+
ACE_OS_GUARD
+
// Remember the original file pointer position
ACE_OFF_T original_position = ACE_OS::lseek (handle,
0,
SEEK_CUR);
if (original_position == -1)
return -1;
+
// Go to the correct position
ACE_OFF_T altered_position = ACE_OS::lseek (handle,
offset,
SEEK_SET);
if (altered_position == -1)
return -1;
+
ssize_t const bytes_written = ACE_OS::write (handle,
buf,
nbytes);
if (bytes_written == -1)
return -1;
+
if (ACE_OS::lseek (handle,
original_position,
SEEK_SET) == -1)
return -1;
+
return bytes_written;
# endif /* ACE_HAS_P_READ_WRITE */
}
+
int
ACE_OS::string_to_argv (ACE_TCHAR *buf,
int &argc,
@@ -625,29 +736,37 @@ ACE_OS::string_to_argv (ACE_TCHAR *buf,
{
// Reset the number of arguments
argc = 0;
+
if (buf == 0)
return -1;
+
ACE_TCHAR *cp = buf;
+
// First pass: count arguments.
+
// '#' is the start-comment token..
while (*cp != ACE_TEXT ('\0') && *cp != ACE_TEXT ('#'))
{
// Skip whitespace..
while (ACE_OS::ace_isspace (*cp))
++cp;
+
// Increment count and move to next whitespace..
if (*cp != ACE_TEXT ('\0'))
++argc;
+
while (*cp != ACE_TEXT ('\0') && !ACE_OS::ace_isspace (*cp))
{
// Grok quotes....
if (*cp == ACE_TEXT ('\'') || *cp == ACE_TEXT ('"'))
{
ACE_TCHAR quote = *cp;
+
// Scan past the string..
for (++cp; *cp != ACE_TEXT ('\0')
&& (*cp != quote || cp[-1] == ACE_TEXT ('\\')); ++cp)
continue;
+
// '\0' implies unmatched quote..
if (*cp == ACE_TEXT ('\0'))
{
@@ -661,47 +780,58 @@ ACE_OS::string_to_argv (ACE_TCHAR *buf,
++cp;
}
}
+
// Second pass: copy arguments.
ACE_TCHAR arg[ACE_DEFAULT_ARGV_BUFSIZ];
ACE_TCHAR *argp = arg;
+
// Make sure that the buffer we're copying into is always large
// enough.
if (cp - buf >= ACE_DEFAULT_ARGV_BUFSIZ)
ACE_NEW_RETURN (argp,
ACE_TCHAR[cp - buf + 1],
-1);
+
// Make a new argv vector of argc + 1 elements.
ACE_NEW_RETURN (argv,
ACE_TCHAR *[argc + 1],
-1);
+
ACE_TCHAR *ptr = buf;
+
for (int i = 0; i < argc; ++i)
{
// Skip whitespace..
while (ACE_OS::ace_isspace (*ptr))
++ptr;
+
// Copy next argument and move to next whitespace..
cp = argp;
while (*ptr != ACE_TEXT ('\0') && !ACE_OS::ace_isspace (*ptr))
if (*ptr == ACE_TEXT ('\'') || *ptr == ACE_TEXT ('"'))
{
ACE_TCHAR quote = *ptr++;
+
while (*ptr != ACE_TEXT ('\0')
&& (*ptr != quote || ptr[-1] == ACE_TEXT ('\\')))
{
if (*ptr == quote && ptr[-1] == ACE_TEXT ('\\')) --cp;
*cp++ = *ptr++;
}
+
if (*ptr == quote)
++ptr;
}
else
*cp++ = *ptr++;
+
*cp = ACE_TEXT ('\0');
+
#if !defined (ACE_LACKS_ENV)
// Check for environment variable substitution here.
if (substitute_env_args) {
argv[i] = ACE_OS::strenvdup (argp);
+
if (argv[i] == 0)
{
if (argp != arg)
@@ -714,26 +844,32 @@ ACE_OS::string_to_argv (ACE_TCHAR *buf,
#endif /* ACE_LACKS_ENV */
{
argv[i] = ACE_OS::strdup (argp);
+
if (argv[i] == 0)
{
if (argp != arg)
{
delete [] argp;
}
+
errno = ENOMEM;
return -1;
}
}
}
+
if (argp != arg)
{
delete [] argp;
}
+
argv[argc] = 0;
return 0;
}
+
// Write <len> bytes from <buf> to <handle> (uses the <write>
// system call on UNIX and the <WriteFile> call on Win32).
+
ssize_t
ACE_OS::write_n (ACE_HANDLE handle,
const void *buf,
@@ -743,6 +879,7 @@ ACE_OS::write_n (ACE_HANDLE handle,
size_t temp;
size_t &bytes_transferred = bt == 0 ? temp : *bt;
ssize_t n;
+
for (bytes_transferred = 0;
bytes_transferred < len;
bytes_transferred += n)
@@ -750,12 +887,15 @@ ACE_OS::write_n (ACE_HANDLE handle,
n = ACE_OS::write (handle,
(char *) buf + bytes_transferred,
len - bytes_transferred);
+
if (n == -1 || n == 0)
{
return n;
}
}
+
return ACE_Utils::truncate_cast<ssize_t> (bytes_transferred);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_NS_unistd.h b/dep/ACE_wrappers/ace/OS_NS_unistd.h
index 11e65552b6a..576cf37bae4 100644
--- a/dep/ACE_wrappers/ace/OS_NS_unistd.h
+++ b/dep/ACE_wrappers/ace/OS_NS_unistd.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file OS_NS_unistd.h
@@ -12,41 +13,55 @@
* Originally in OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_NS_UNISTD_H
# define ACE_OS_NS_UNISTD_H
+
# include /**/ "ace/pre.h"
+
# include "ace/config-all.h"
+
# if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
# endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include /**/ "ace/ACE_export.h"
#include "ace/Time_Value.h"
#include "ace/Basic_Types.h"
#include "ace/os_include/os_unistd.h"
#include "ace/os_include/os_stdio.h"
+
#if defined (ACE_EXPORT_MACRO)
# undef ACE_EXPORT_MACRO
#endif
#define ACE_EXPORT_MACRO ACE_Export
+
// This should go in os_unistd.h, but since we don't yet implement any code
// at that level, we put it here. It used to be in OS.i.
#if defined (ACE_NEEDS_FTRUNCATE)
extern "C" ACE_Export int ftruncate (ACE_HANDLE handle, long len);
#endif /* ACE_NEEDS_FTRUNCATE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE_OS
{
+
ACE_NAMESPACE_INLINE_FUNCTION
int access (const char *path, int amode);
+
#if defined (ACE_HAS_WCHAR)
ACE_NAMESPACE_INLINE_FUNCTION
int access (const wchar_t *path, int amode);
#endif /* ACE_HAS_WCHAR */
+
ACE_NAMESPACE_INLINE_FUNCTION
unsigned int alarm (u_int secs);
+
ACE_NAMESPACE_INLINE_FUNCTION
long allocation_granularity (void);
+
// used by ARGV::argv_to_string() and ACE_OS::fork_exec()
extern ACE_Export
int argv_to_string (int argc,
@@ -54,144 +69,189 @@ namespace ACE_OS
ACE_TCHAR *&buf,
bool substitute_env_args = true,
bool quote_args = false);
+
extern ACE_Export
int argv_to_string (ACE_TCHAR **argv,
ACE_TCHAR *&buf,
bool substitute_env_args = true,
bool quote_args = false);
+
#if !defined (ACE_LACKS_CHDIR)
ACE_NAMESPACE_INLINE_FUNCTION
int chdir (const char *path);
+
#if defined (ACE_HAS_WCHAR)
ACE_NAMESPACE_INLINE_FUNCTION
int chdir (const wchar_t *path);
#endif /* ACE_HAS_WCHAR */
#endif /* ACE_LACKS_CHDIR */
+
ACE_NAMESPACE_INLINE_FUNCTION
int rmdir (const char *path);
+
#if defined (ACE_HAS_WCHAR)
ACE_NAMESPACE_INLINE_FUNCTION
int rmdir (const wchar_t *path);
#endif /* ACE_HAS_WCHAR */
+
ACE_NAMESPACE_INLINE_FUNCTION
int close (ACE_HANDLE handle);
+
ACE_NAMESPACE_INLINE_FUNCTION
ACE_HANDLE dup (ACE_HANDLE handle);
+
ACE_NAMESPACE_INLINE_FUNCTION
int dup2 (ACE_HANDLE oldfd,
ACE_HANDLE newfd);
+
extern ACE_Export
int execl (const char *path,
const char *arg0, ...);
+
extern ACE_Export
int execle (const char *path,
const char *arg0, ...);
+
extern ACE_Export
int execlp (const char *file,
const char *arg0, ...);
+
ACE_NAMESPACE_INLINE_FUNCTION
int execv (const char *path,
char *const argv[]);
+
ACE_NAMESPACE_INLINE_FUNCTION
int execve (const char *path,
char *const argv[],
char *const envp[]);
+
ACE_NAMESPACE_INLINE_FUNCTION
int execvp (const char *file,
char *const argv[]);
+
//@{
/// Forks and exec's a process in a manner that works on Solaris and
/// NT. argv[0] must be the full path name to the executable.
ACE_NAMESPACE_INLINE_FUNCTION
pid_t fork (void);
+
// not in susv3
extern ACE_Export
pid_t fork (const ACE_TCHAR *program_name);
+
extern ACE_Export
pid_t fork_exec (ACE_TCHAR *argv[]);
+
//@}
+
ACE_NAMESPACE_INLINE_FUNCTION
int fsync (ACE_HANDLE handle);
+
ACE_NAMESPACE_INLINE_FUNCTION
int ftruncate (ACE_HANDLE handle, ACE_OFF_T offset);
+
ACE_NAMESPACE_INLINE_FUNCTION
char *getcwd (char *, size_t);
+
#if defined (ACE_HAS_WCHAR)
ACE_NAMESPACE_INLINE_FUNCTION
wchar_t *getcwd (wchar_t *, size_t);
#endif /* ACE_HAS_WCHAR */
+
ACE_NAMESPACE_INLINE_FUNCTION
gid_t getgid (void);
+
ACE_NAMESPACE_INLINE_FUNCTION
gid_t getegid (void);
+
ACE_NAMESPACE_INLINE_FUNCTION
int getopt (int argc,
char *const *argv,
const char *optstring);
+
ACE_NAMESPACE_INLINE_FUNCTION
long getpagesize (void);
+
ACE_NAMESPACE_INLINE_FUNCTION
pid_t getpgid (pid_t pid);
+
ACE_NAMESPACE_INLINE_FUNCTION
pid_t getpid (void);
+
ACE_NAMESPACE_INLINE_FUNCTION
pid_t getppid (void);
+
ACE_NAMESPACE_INLINE_FUNCTION
uid_t getuid (void);
+
ACE_NAMESPACE_INLINE_FUNCTION
uid_t geteuid (void);
+
// should call gethostname()
ACE_NAMESPACE_INLINE_FUNCTION
int hostname (char *name,
size_t maxnamelen);
+
#if defined (ACE_HAS_WCHAR)
ACE_NAMESPACE_INLINE_FUNCTION
int hostname (wchar_t *name,
size_t maxnamelen);
#endif /* ACE_HAS_WCHAR */
+
ACE_NAMESPACE_INLINE_FUNCTION
int isatty (int handle);
+
#if defined (ACE_WIN32)
ACE_NAMESPACE_INLINE_FUNCTION
int isatty (ACE_HANDLE handle);
#endif /* ACE_WIN32 */
+
ACE_NAMESPACE_INLINE_FUNCTION
ACE_OFF_T lseek (ACE_HANDLE handle,
ACE_OFF_T offset,
int whence);
+
#if defined (ACE_HAS_LLSEEK) || defined (ACE_HAS_LSEEK64)
ACE_NAMESPACE_INLINE_FUNCTION
ACE_LOFF_T llseek (ACE_HANDLE handle,
ACE_LOFF_T offset,
int whence);
#endif /* ACE_HAS_LLSEEK */
+
/// Get the number of CPUs configured in the machine.
extern ACE_Export
long num_processors (void);
+
/// Get the number of CPUs currently online.
extern ACE_Export
long num_processors_online (void);
+
ACE_NAMESPACE_INLINE_FUNCTION
int pipe (ACE_HANDLE handles[]);
+
extern ACE_Export
ssize_t pread (ACE_HANDLE handle,
void *buf,
size_t nbyte,
ACE_OFF_T offset);
+
extern ACE_Export
ssize_t pwrite (ACE_HANDLE handle,
const void *buf,
size_t nbyte,
ACE_OFF_T offset);
+
ACE_NAMESPACE_INLINE_FUNCTION
ssize_t read (ACE_HANDLE handle,
void *buf,
size_t len);
+
ACE_NAMESPACE_INLINE_FUNCTION
ssize_t read (ACE_HANDLE handle,
void *buf,
size_t len,
ACE_OVERLAPPED *);
+
/**
* Receive @a len bytes into @a buf from <handle> (uses the
* <ACE_OS::read> call, which uses the <read> system call on UNIX
@@ -205,70 +265,94 @@ namespace ACE_OS
void *buf,
size_t len,
size_t *bytes_transferred = 0);
+
ACE_NAMESPACE_INLINE_FUNCTION
ssize_t readlink (const char *path,
char *buf,
size_t bufsiz);
+
ACE_NAMESPACE_INLINE_FUNCTION
void *sbrk (intptr_t brk);
+
ACE_NAMESPACE_INLINE_FUNCTION
int setgid (gid_t);
+
ACE_NAMESPACE_INLINE_FUNCTION
int setegid (gid_t);
+
ACE_NAMESPACE_INLINE_FUNCTION
int setpgid (pid_t pid, pid_t pgid);
+
ACE_NAMESPACE_INLINE_FUNCTION
int setregid (gid_t rgid, gid_t egid);
+
ACE_NAMESPACE_INLINE_FUNCTION
int setreuid (uid_t ruid, uid_t euid);
+
ACE_NAMESPACE_INLINE_FUNCTION
pid_t setsid (void);
+
ACE_NAMESPACE_INLINE_FUNCTION
int setuid (uid_t);
+
ACE_NAMESPACE_INLINE_FUNCTION
int seteuid (uid_t);
+
ACE_NAMESPACE_INLINE_FUNCTION
int sleep (u_int seconds);
+
ACE_NAMESPACE_INLINE_FUNCTION
int sleep (const ACE_Time_Value &tv);
+
// used by ARGV::string_to_argv
extern ACE_Export
int string_to_argv (ACE_TCHAR *buf,
int &argc,
ACE_TCHAR **&argv,
bool substitute_env_args = true);
+
ACE_NAMESPACE_INLINE_FUNCTION
void swab (const void *src, void *dest, ssize_t n);
+
ACE_NAMESPACE_INLINE_FUNCTION
long sysconf (int);
+
// not in susv3
ACE_NAMESPACE_INLINE_FUNCTION
long sysinfo (int cmd,
char *buf,
long count);
+
ACE_NAMESPACE_INLINE_FUNCTION
int truncate (const ACE_TCHAR *filename, ACE_OFF_T length);
+
ACE_NAMESPACE_INLINE_FUNCTION
useconds_t ualarm (useconds_t usecs,
useconds_t interval = 0);
+
ACE_NAMESPACE_INLINE_FUNCTION
useconds_t ualarm (const ACE_Time_Value &tv,
const ACE_Time_Value &tv_interval = ACE_Time_Value::zero);
+
ACE_NAMESPACE_INLINE_FUNCTION
int unlink (const char *path);
+
#if defined (ACE_HAS_WCHAR)
ACE_NAMESPACE_INLINE_FUNCTION
int unlink (const wchar_t *path);
#endif /* ACE_HAS_WCHAR */
+
ACE_NAMESPACE_INLINE_FUNCTION
ssize_t write (ACE_HANDLE handle,
const void *buf,
size_t nbyte);
+
ACE_NAMESPACE_INLINE_FUNCTION
ssize_t write (ACE_HANDLE handle,
const void *buf,
size_t nbyte,
ACE_OVERLAPPED *);
+
/**
* Send @a len bytes from @a buf to @a handle (uses the <ACE_OS::write>
* calls, which is uses the <write> system call on UNIX and the
@@ -281,8 +365,11 @@ namespace ACE_OS
const void *buf,
size_t len,
size_t *bytes_transferred = 0);
+
} /* namespace ACE_OS */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# if defined (ACE_HAS_INLINED_OSCALLS)
# if defined (ACE_INLINE)
# undef ACE_INLINE
@@ -290,6 +377,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_INLINE inline
# include "ace/OS_NS_unistd.inl"
# endif /* ACE_HAS_INLINED_OSCALLS */
+
# include /**/ "ace/post.h"
#endif /* ACE_OS_NS_UNISTD_H */
diff --git a/dep/ACE_wrappers/ace/OS_NS_unistd.inl b/dep/ACE_wrappers/ace/OS_NS_unistd.inl
index a164814c517..806a895d8b3 100644
--- a/dep/ACE_wrappers/ace/OS_NS_unistd.inl
+++ b/dep/ACE_wrappers/ace/OS_NS_unistd.inl
@@ -1,6 +1,7 @@
// -*- C++ -*-
//
// $Id: OS_NS_unistd.inl 81696 2008-05-14 18:15:31Z johnnyw $
+
#include "ace/OS_NS_sys_utsname.h"
#include "ace/OS_NS_string.h"
#include "ace/OS_NS_errno.h"
@@ -9,12 +10,15 @@
#include "ace/Default_Constants.h"
#include "ace/OS_Memory.h"
#include "ace/Truncate.h"
+
#if defined (ACE_HAS_CLOCK_GETTIME)
# include "ace/os_include/os_time.h"
#endif /* ACE_HAS_CLOCK_GETTIME */
+
#if defined (ACE_LACKS_ACCESS)
# include "ace/OS_NS_stdio.h"
#endif /* ACE_LACKS_ACCESS */
+
#if defined (ACE_VXWORKS) || defined (ACE_HAS_WINCE)
# include "ace/os_include/os_unistd.h"
# if defined (ACE_VXWORKS) && (((ACE_VXWORKS >= 0x620) && (ACE_VXWORKS <= 0x660)) || defined (ACE_HAS_VXWORKS551_MEDUSA))
@@ -25,7 +29,9 @@
# endif
# endif
#endif /* VXWORKS || ACE_HAS_WINCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE int
ACE_OS::access (const char *path, int amode)
{
@@ -56,6 +62,7 @@ ACE_OS::access (const char *path, int amode)
#endif /* ACE_LACKS_ACCESS */
}
+
#if defined (ACE_HAS_WCHAR)
ACE_INLINE int
ACE_OS::access (const wchar_t *path, int amode)
@@ -67,6 +74,7 @@ ACE_OS::access (const wchar_t *path, int amode)
#endif /* ACE_WIN32 && !ACE_HAS_WINCE */
}
#endif /* ACE_HAS_WCHAR */
+
ACE_INLINE u_int
ACE_OS::alarm (u_int secs)
{
@@ -78,6 +86,7 @@ ACE_OS::alarm (u_int secs)
return ::alarm (secs);
#endif /* ACE_LACKS_ALARM */
}
+
ACE_INLINE long
ACE_OS::getpagesize (void)
{
@@ -95,6 +104,7 @@ ACE_OS::getpagesize (void)
return ACE_PAGE_SIZE;
#endif /* ACE_WIN32 */
}
+
ACE_INLINE long
ACE_OS::allocation_granularity (void)
{
@@ -106,6 +116,7 @@ ACE_OS::allocation_granularity (void)
return ACE_OS::getpagesize ();
#endif /* ACE_WIN32 */
}
+
#if !defined (ACE_LACKS_CHDIR)
ACE_INLINE int
ACE_OS::chdir (const char *path)
@@ -120,6 +131,7 @@ ACE_OS::chdir (const char *path)
ACE_OSCALL_RETURN (::chdir (path), int, -1);
#endif /* ACE_HAS_NONCONST_CHDIR */
}
+
#if defined (ACE_HAS_WCHAR)
ACE_INLINE int
ACE_OS::chdir (const wchar_t *path)
@@ -132,6 +144,7 @@ ACE_OS::chdir (const wchar_t *path)
}
#endif /* ACE_HAS_WCHAR */
#endif /* ACE_LACKS_CHDIR */
+
ACE_INLINE int
ACE_OS::rmdir (const char *path)
{
@@ -143,6 +156,7 @@ ACE_OS::rmdir (const char *path)
ACE_OSCALL_RETURN (::rmdir (path), int, -1);
#endif /* ACE_WIN32 */
}
+
#if defined (ACE_HAS_WCHAR)
ACE_INLINE int
ACE_OS::rmdir (const wchar_t *path)
@@ -159,9 +173,11 @@ ACE_OS::rmdir (const wchar_t *path)
#endif /* ACE_HAS_WINCE */
}
#endif /* ACE_HAS_WCHAR */
+
// @todo: which 4 and why??? dhinton
// NOTE: The following four function definitions must appear before
// ACE_OS::sema_init ().
+
ACE_INLINE int
ACE_OS::close (ACE_HANDLE handle)
{
@@ -172,6 +188,7 @@ ACE_OS::close (ACE_HANDLE handle)
ACE_OSCALL_RETURN (::close (handle), int, -1);
#endif /* ACE_WIN32 */
}
+
ACE_INLINE ACE_HANDLE
ACE_OS::dup (ACE_HANDLE handle)
{
@@ -199,6 +216,7 @@ ACE_OS::dup (ACE_HANDLE handle)
ACE_OSCALL_RETURN (::dup (handle), ACE_HANDLE, ACE_INVALID_HANDLE);
#endif /* ACE_WIN32 && !ACE_HAS_WINCE */
}
+
ACE_INLINE int
ACE_OS::dup2 (ACE_HANDLE oldhandle, ACE_HANDLE newhandle)
{
@@ -212,6 +230,7 @@ ACE_OS::dup2 (ACE_HANDLE oldhandle, ACE_HANDLE newhandle)
ACE_OSCALL_RETURN (::dup2 (oldhandle, newhandle), int, -1);
#endif /* ACE_LACKS_DUP2 */
}
+
ACE_INLINE int
ACE_OS::execv (const char *path,
char *const argv[])
@@ -220,6 +239,7 @@ ACE_OS::execv (const char *path,
#if defined (ACE_LACKS_EXEC)
ACE_UNUSED_ARG (path);
ACE_UNUSED_ARG (argv);
+
ACE_NOTSUP_RETURN (-1);
#elif defined (ACE_WIN32)
# if defined (__BORLANDC__) /* VSB */
@@ -238,6 +258,7 @@ ACE_OS::execv (const char *path,
ACE_OSCALL_RETURN (::execv (path, argv), int, -1);
#endif /* ACE_LACKS_EXEC */
}
+
ACE_INLINE int
ACE_OS::execve (const char *path,
char *const argv[],
@@ -248,6 +269,7 @@ ACE_OS::execve (const char *path,
ACE_UNUSED_ARG (path);
ACE_UNUSED_ARG (argv);
ACE_UNUSED_ARG (envp);
+
ACE_NOTSUP_RETURN (-1);
#elif defined (ACE_WIN32)
# if defined (__BORLANDC__) /* VSB */
@@ -266,6 +288,7 @@ ACE_OS::execve (const char *path,
ACE_OSCALL_RETURN (::execve (path, argv, envp), int, -1);
#endif /* ACE_LACKS_EXEC */
}
+
ACE_INLINE int
ACE_OS::execvp (const char *file,
char *const argv[])
@@ -274,6 +297,7 @@ ACE_OS::execvp (const char *file,
#if defined (ACE_LACKS_EXEC)
ACE_UNUSED_ARG (file);
ACE_UNUSED_ARG (argv);
+
ACE_NOTSUP_RETURN (-1);
#elif defined (ACE_WIN32)
# if defined (__BORLANDC__) /* VSB */
@@ -292,6 +316,7 @@ ACE_OS::execvp (const char *file,
ACE_OSCALL_RETURN (::execvp (file, argv), int, -1);
#endif /* ACE_LACKS_EXEC */
}
+
ACE_INLINE pid_t
ACE_OS::fork (void)
{
@@ -302,6 +327,7 @@ ACE_OS::fork (void)
ACE_OSCALL_RETURN (::fork (), pid_t, -1);
#endif /* ACE_LACKS_FORK */
}
+
ACE_INLINE int
ACE_OS::fsync (ACE_HANDLE handle)
{
@@ -315,6 +341,7 @@ ACE_OS::fsync (ACE_HANDLE handle)
ACE_OSCALL_RETURN (::fsync (handle), int, -1);
# endif /* ACE_LACKS_FSYNC */
}
+
ACE_INLINE int
ACE_OS::ftruncate (ACE_HANDLE handle, ACE_OFF_T offset)
{
@@ -337,6 +364,7 @@ ACE_OS::ftruncate (ACE_HANDLE handle, ACE_OFF_T offset)
ACE_OSCALL_RETURN (::ftruncate (handle, offset), int, -1);
#endif /* ACE_WIN32 */
}
+
ACE_INLINE char *
ACE_OS::getcwd (char *buf, size_t size)
{
@@ -351,6 +379,7 @@ ACE_OS::getcwd (char *buf, size_t size)
ACE_OSCALL_RETURN (::getcwd (buf, size), char *, 0);
#endif /* ACE_LACKS_GETCWD */
}
+
#if defined (ACE_HAS_WCHAR)
ACE_INLINE wchar_t *
ACE_OS::getcwd (wchar_t *buf, size_t size)
@@ -373,6 +402,7 @@ ACE_OS::getcwd (wchar_t *buf, size_t size)
# endif /* ACE_WIN32 */
}
#endif /* ACE_HAS_WCHAR */
+
ACE_INLINE gid_t
ACE_OS::getgid (void)
{
@@ -383,6 +413,7 @@ ACE_OS::getgid (void)
ACE_OSCALL_RETURN (::getgid (), gid_t, static_cast<gid_t> (-1));
# endif /* ACE_LACKS_GETGID */
}
+
ACE_INLINE gid_t
ACE_OS::getegid (void)
{
@@ -393,6 +424,7 @@ ACE_OS::getegid (void)
ACE_OSCALL_RETURN (::getegid (), gid_t, static_cast<gid_t> (-1));
# endif /* ACE_LACKS_GETEGID */
}
+
ACE_INLINE int
ACE_OS::getopt (int argc, char *const *argv, const char *optstring)
{
@@ -406,6 +438,7 @@ ACE_OS::getopt (int argc, char *const *argv, const char *optstring)
ACE_OSCALL_RETURN (::getopt (argc, argv, optstring), int, -1);
# endif /* ACE_LACKS_GETOPT */
}
+
ACE_INLINE pid_t
ACE_OS::getpgid (pid_t pid)
{
@@ -423,6 +456,7 @@ ACE_OS::getpgid (pid_t pid)
ACE_OSCALL_RETURN (::getpgid (pid), pid_t, -1);
#endif /* ACE_LACKS_GETPGID */
}
+
ACE_INLINE pid_t
ACE_OS::getpid (void)
{
@@ -435,6 +469,7 @@ ACE_OS::getpid (void)
ACE_OSCALL_RETURN (::getpid (), int, -1);
#endif /* ACE_LACKS_GETPID */
}
+
ACE_INLINE pid_t
ACE_OS::getppid (void)
{
@@ -445,6 +480,7 @@ ACE_OS::getppid (void)
ACE_OSCALL_RETURN (::getppid (), pid_t, -1);
#endif /* ACE_LACKS_GETPPID */
}
+
ACE_INLINE uid_t
ACE_OS::getuid (void)
{
@@ -455,6 +491,7 @@ ACE_OS::getuid (void)
ACE_OSCALL_RETURN (::getuid (), uid_t, static_cast<uid_t> (-1));
# endif /* ACE_LACKS_GETUID*/
}
+
ACE_INLINE uid_t
ACE_OS::geteuid (void)
{
@@ -465,6 +502,7 @@ ACE_OS::geteuid (void)
ACE_OSCALL_RETURN (::geteuid (), uid_t, (uid_t) -1);
# endif /* ACE_LACKS_GETEUID */
}
+
ACE_INLINE int
ACE_OS::hostname (char name[], size_t maxnamelen)
{
@@ -496,6 +534,7 @@ ACE_OS::hostname (char name[], size_t maxnamelen)
}
#else /* ACE_HAS_PHARLAP */
ACE_utsname host_info;
+
if (ACE_OS::uname (&host_info) == -1)
return -1;
else
@@ -505,6 +544,7 @@ ACE_OS::hostname (char name[], size_t maxnamelen)
}
#endif /* ACE_HAS_PHARLAP */
}
+
#if defined (ACE_HAS_WCHAR)
ACE_INLINE int
ACE_OS::hostname (wchar_t name[], size_t maxnamelen)
@@ -517,14 +557,18 @@ ACE_OS::hostname (wchar_t name[], size_t maxnamelen)
// Emulate using the char version
char *char_name = 0;
int result = 0;
+
ACE_NEW_RETURN (char_name, char[maxnamelen], -1);
+
result = ACE_OS::hostname(char_name, maxnamelen);
ACE_OS::strcpy (name, ACE_Ascii_To_Wide (char_name).wchar_rep ());
+
delete [] char_name;
return result;
#endif /* ACE_WIN32 && !ACE_HAS_WINCE */
}
#endif /* ACE_HAS_WCHAR */
+
ACE_INLINE int
ACE_OS::isatty (int handle)
{
@@ -538,6 +582,7 @@ ACE_OS::isatty (int handle)
ACE_OSCALL_RETURN (::isatty (handle), int, -1);
# endif /* ACE_LACKS_ISATTY */
}
+
#if defined (ACE_WIN32)
ACE_INLINE int
ACE_OS::isatty (ACE_HANDLE handle)
@@ -552,7 +597,9 @@ ACE_OS::isatty (ACE_HANDLE handle)
return status;
#endif /* ACE_LACKS_ISATTY */
}
+
#endif /* ACE_WIN32 */
+
ACE_INLINE ACE_OFF_T
ACE_OS::lseek (ACE_HANDLE handle, ACE_OFF_T offset, int whence)
{
@@ -588,11 +635,13 @@ ACE_OS::lseek (ACE_HANDLE handle, ACE_OFF_T offset, int whence)
ACE_OSCALL_RETURN (::lseek (handle, offset, whence), ACE_OFF_T, -1);
#endif /* ACE_WIN32 */
}
+
#if defined (ACE_HAS_LLSEEK) || defined (ACE_HAS_LSEEK64)
ACE_INLINE ACE_LOFF_T
ACE_OS::llseek (ACE_HANDLE handle, ACE_LOFF_T offset, int whence)
{
ACE_OS_TRACE ("ACE_OS::llseek");
+
#if ACE_SIZEOF_LONG == 8
/* The native lseek is 64 bit. Use it. */
return ACE_OS::lseek (handle, offset, whence);
@@ -604,7 +653,9 @@ ACE_OS::llseek (ACE_HANDLE handle, ACE_LOFF_T offset, int whence)
# if defined (ACE_WIN32)
# ifndef ACE_LACKS_WIN32_SETFILEPOINTEREX
LARGE_INTEGER distance, new_file_pointer;
+
distance.QuadPart = offset;
+
return
(::SetFilePointerEx (handle, distance, &new_file_pointer, whence)
? new_file_pointer.QuadPart
@@ -614,6 +665,7 @@ ACE_OS::llseek (ACE_HANDLE handle, ACE_LOFF_T offset, int whence)
l_offset.QuadPart = offset;
LONG low_offset = l_offset.LowPart;
LONG high_offset = l_offset.HighPart;
+
l_offset.LowPart = ::SetFilePointer (handle,
low_offset,
&high_offset,
@@ -630,6 +682,7 @@ ACE_OS::llseek (ACE_HANDLE handle, ACE_LOFF_T offset, int whence)
#endif
}
#endif /* ACE_HAS_LLSEEK || ACE_HAS_LSEEK64 */
+
ACE_INLINE ssize_t
ACE_OS::read (ACE_HANDLE handle, void *buf, size_t len)
{
@@ -641,12 +694,15 @@ ACE_OS::read (ACE_HANDLE handle, void *buf, size_t len)
else
ACE_FAIL_RETURN (-1);
#else
+
ssize_t result;
+
# if defined (ACE_HAS_CHARPTR_SOCKOPT)
ACE_OSCALL (::read (handle, static_cast <char *> (buf), len), ssize_t, -1, result);
# else
ACE_OSCALL (::read (handle, buf, len), ssize_t, -1, result);
# endif /* ACE_HAS_CHARPTR_SOCKOPT */
+
# if !(defined (EAGAIN) && defined (EWOULDBLOCK) && EAGAIN == EWOULDBLOCK)
// Optimize this code out if we can detect that EAGAIN ==
// EWOULDBLOCK at compile time. If we cannot detect equality at
@@ -662,9 +718,11 @@ ACE_OS::read (ACE_HANDLE handle, void *buf, size_t len)
errno = EWOULDBLOCK;
}
# endif /* EAGAIN != EWOULDBLOCK*/
+
return result;
#endif /* ACE_WIN32 */
}
+
ACE_INLINE ssize_t
ACE_OS::read (ACE_HANDLE handle, void *buf, size_t len,
ACE_OVERLAPPED *overlapped)
@@ -682,6 +740,7 @@ ACE_OS::read (ACE_HANDLE handle, void *buf, size_t len,
return ACE_OS::read (handle, buf, len);
#endif /* ACE_WIN32 */
}
+
ACE_INLINE ssize_t
ACE_OS::readlink (const char *path, char *buf, size_t bufsiz)
{
@@ -700,6 +759,7 @@ ACE_OS::readlink (const char *path, char *buf, size_t bufsiz)
# endif
# endif /* ACE_LACKS_READLINK */
}
+
ACE_INLINE int
ACE_OS::pipe (ACE_HANDLE fds[])
{
@@ -715,6 +775,7 @@ ACE_OS::pipe (ACE_HANDLE fds[])
ACE_OSCALL_RETURN (::pipe (fds), int, -1);
# endif /* ACE_LACKS_PIPE */
}
+
ACE_INLINE void *
ACE_OS::sbrk (intptr_t brk)
{
@@ -725,6 +786,7 @@ ACE_OS::sbrk (intptr_t brk)
ACE_OSCALL_RETURN (::sbrk (brk), void *, 0);
#endif /* ACE_LACKS_SBRK */
}
+
ACE_INLINE int
ACE_OS::setgid (gid_t gid)
{
@@ -736,6 +798,7 @@ ACE_OS::setgid (gid_t gid)
ACE_OSCALL_RETURN (::setgid (gid), int, -1);
# endif /* ACE_LACKS_SETGID */
}
+
ACE_INLINE int
ACE_OS::setegid (gid_t gid)
{
@@ -747,6 +810,7 @@ ACE_OS::setegid (gid_t gid)
ACE_OSCALL_RETURN (::setegid (gid), int, -1);
# endif /* ACE_LACKS_SETEGID */
}
+
ACE_INLINE int
ACE_OS::setpgid (pid_t pid, pid_t pgid)
{
@@ -759,6 +823,7 @@ ACE_OS::setpgid (pid_t pid, pid_t pgid)
ACE_OSCALL_RETURN (::setpgid (pid, pgid), int, -1);
#endif /* ACE_LACKS_SETPGID */
}
+
ACE_INLINE int
ACE_OS::setregid (gid_t rgid, gid_t egid)
{
@@ -771,6 +836,7 @@ ACE_OS::setregid (gid_t rgid, gid_t egid)
ACE_OSCALL_RETURN (::setregid (rgid, egid), int, -1);
#endif /* ACE_LACKS_SETREGID */
}
+
ACE_INLINE int
ACE_OS::setreuid (uid_t ruid, uid_t euid)
{
@@ -783,6 +849,7 @@ ACE_OS::setreuid (uid_t ruid, uid_t euid)
ACE_OSCALL_RETURN (::setreuid (ruid, euid), int, -1);
#endif /* ACE_LACKS_SETREUID */
}
+
ACE_INLINE pid_t
ACE_OS::setsid (void)
{
@@ -793,6 +860,7 @@ ACE_OS::setsid (void)
ACE_OSCALL_RETURN (::setsid (), int, -1);
# endif /* ACE_LACKS_SETSID */
}
+
ACE_INLINE int
ACE_OS::setuid (uid_t uid)
{
@@ -804,6 +872,7 @@ ACE_OS::setuid (uid_t uid)
ACE_OSCALL_RETURN (::setuid (uid), int, -1);
# endif /* ACE_LACKS_SETUID */
}
+
ACE_INLINE int
ACE_OS::seteuid (uid_t uid)
{
@@ -815,6 +884,7 @@ ACE_OS::seteuid (uid_t uid)
ACE_OSCALL_RETURN (::seteuid (uid), int, -1);
# endif /* ACE_LACKS_SETEUID */
}
+
ACE_INLINE int
ACE_OS::sleep (u_int seconds)
{
@@ -834,6 +904,7 @@ ACE_OS::sleep (u_int seconds)
ACE_OSCALL_RETURN (::sleep (seconds), int, -1);
#endif /* ACE_WIN32 */
}
+
ACE_INLINE int
ACE_OS::sleep (const ACE_Time_Value &tv)
{
@@ -866,6 +937,7 @@ ACE_OS::sleep (const ACE_Time_Value &tv)
# endif /* ACE_HAS_NONCONST_SELECT_TIMEVAL */
#endif /* ACE_WIN32 */
}
+
ACE_INLINE void
ACE_OS::swab (const void *src,
void *dest,
@@ -878,6 +950,7 @@ ACE_OS::swab (const void *src,
// ------------------------------------------------------------
/*
Copyright (c) 1994-2006 Red Hat, Inc. All rights reserved.
+
This copyrighted material is made available to anyone wishing to
use, modify, copy, or redistribute it subject to the terms and
conditions of the BSD License. This program is distributed in
@@ -890,6 +963,7 @@ ACE_OS::swab (const void *src,
subject to the BSD License and may only be used or replicated with
the express permission of Red Hat, Inc.
*/
+
const char *from = static_cast<const char*> (src);
char *to = static_cast<char *> (dest);
ssize_t ptr = 0;
@@ -914,7 +988,9 @@ ACE_OS::swab (const void *src,
#else
::swab (src, dest, length);
#endif /* ACE_LACKS_SWAB */
+
}
+
ACE_INLINE long
ACE_OS::sysconf (int name)
{
@@ -926,6 +1002,7 @@ ACE_OS::sysconf (int name)
ACE_OSCALL_RETURN (::sysconf (name), long, -1);
#endif /* ACE_LACKS_SYSCONF */
}
+
ACE_INLINE long
ACE_OS::sysinfo (int cmd, char *buf, long count)
{
@@ -936,9 +1013,11 @@ ACE_OS::sysinfo (int cmd, char *buf, long count)
ACE_UNUSED_ARG (cmd);
ACE_UNUSED_ARG (buf);
ACE_UNUSED_ARG (count);
+
ACE_NOTSUP_RETURN (0);
#endif /* ACE_HAS_SYSINFO */
}
+
ACE_INLINE int
ACE_OS::truncate (const ACE_TCHAR *filename,
ACE_OFF_T offset)
@@ -948,6 +1027,7 @@ ACE_OS::truncate (const ACE_TCHAR *filename,
ACE_HANDLE handle = ACE_OS::open (filename,
O_WRONLY,
ACE_DEFAULT_FILE_PERMS);
+
# if !defined (ACE_LACKS_WIN32_SETFILEPOINTEREX)
LARGE_INTEGER loffset;
loffset.QuadPart = offset;
@@ -955,8 +1035,10 @@ ACE_OS::truncate (const ACE_TCHAR *filename,
LONG low_offset = ACE_LOW_PART(offset);
LONG high_offset = ACE_HIGH_PART(offset);
#endif
+
if (handle == ACE_INVALID_HANDLE)
ACE_FAIL_RETURN (-1);
+
# if !defined (ACE_LACKS_WIN32_SETFILEPOINTEREX)
else if (::SetFilePointerEx (handle,
loffset,
@@ -989,10 +1071,12 @@ ACE_OS::truncate (const ACE_TCHAR *filename,
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_WIN32 */
}
+
ACE_INLINE useconds_t
ACE_OS::ualarm (useconds_t usecs, useconds_t interval)
{
ACE_OS_TRACE ("ACE_OS::ualarm");
+
#if defined (ACE_HAS_UALARM)
return ::ualarm (usecs, interval);
#elif !defined (ACE_LACKS_UNIX_SIGNALS)
@@ -1004,11 +1088,13 @@ ACE_OS::ualarm (useconds_t usecs, useconds_t interval)
ACE_NOTSUP_RETURN (0);
#endif /* ACE_HAS_UALARM */
}
+
ACE_INLINE useconds_t
ACE_OS::ualarm (const ACE_Time_Value &tv,
const ACE_Time_Value &tv_interval)
{
ACE_OS_TRACE ("ACE_OS::ualarm");
+
#if defined (ACE_HAS_UALARM)
useconds_t usecs = (tv.sec () * ACE_ONE_SECOND_IN_USECS) + tv.usec ();
useconds_t interval =
@@ -1023,6 +1109,7 @@ ACE_OS::ualarm (const ACE_Time_Value &tv,
ACE_NOTSUP_RETURN (0);
#endif /* ACE_HAS_UALARM */
}
+
ACE_INLINE int
ACE_OS::unlink (const char *path)
{
@@ -1040,6 +1127,7 @@ ACE_OS::unlink (const char *path)
ACE_OSCALL_RETURN (::unlink (path), int, -1);
# endif /* ACE_HAS_NONCONST_UNLINK */
}
+
#if defined (ACE_HAS_WCHAR)
ACE_INLINE int
ACE_OS::unlink (const wchar_t *path)
@@ -1057,12 +1145,14 @@ ACE_OS::unlink (const wchar_t *path)
# endif /* ACE_HAS_WINCE */
}
#endif /* ACE_HAS_WCHAR */
+
ACE_INLINE ssize_t
ACE_OS::write (ACE_HANDLE handle, const void *buf, size_t nbyte)
{
ACE_OS_TRACE ("ACE_OS::write");
#if defined (ACE_WIN32)
DWORD bytes_written; // This is set to 0 byte WriteFile.
+
// Strictly correctly, we should loop writing all the data if more
// than a DWORD length can hold.
DWORD short_nbyte = static_cast<DWORD> (nbyte);
@@ -1078,6 +1168,7 @@ ACE_OS::write (ACE_HANDLE handle, const void *buf, size_t nbyte)
# endif /* ACE_HAS_CHARPTR_SOCKOPT */
#endif /* ACE_WIN32 */
}
+
ACE_INLINE ssize_t
ACE_OS::write (ACE_HANDLE handle,
const void *buf,
@@ -1088,6 +1179,7 @@ ACE_OS::write (ACE_HANDLE handle,
overlapped = overlapped;
#if defined (ACE_WIN32)
DWORD bytes_written; // This is set to 0 byte WriteFile.
+
DWORD short_nbyte = static_cast<DWORD> (nbyte);
if (::WriteFile (handle, buf, short_nbyte, &bytes_written, overlapped))
return (ssize_t) bytes_written;
@@ -1097,4 +1189,5 @@ ACE_OS::write (ACE_HANDLE handle,
return ACE_OS::write (handle, buf, nbyte);
#endif /* ACE_WIN32 */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_NS_wchar.cpp b/dep/ACE_wrappers/ace/OS_NS_wchar.cpp
index d36382057a2..a29f0597224 100644
--- a/dep/ACE_wrappers/ace/OS_NS_wchar.cpp
+++ b/dep/ACE_wrappers/ace/OS_NS_wchar.cpp
@@ -1,13 +1,18 @@
// $Id: OS_NS_wchar.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_wchar.h"
+
ACE_RCSID(ace, OS_NS_wchar, "$Id: OS_NS_wchar.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if !defined (ACE_HAS_INLINED_OSCALLS)
# include "ace/OS_NS_wchar.inl"
#endif /* ACE_HAS_INLINED_OSCALLS */
+
#if defined (ACE_HAS_WCHAR)
# include "ace/OS_NS_ctype.h"
# include "ace/OS_NS_string.h"
#endif /* ACE_HAS_WCHAR */
+
// The following wcs*_emulation methods were created based on BSD code:
/*-
* Copyright (c) 1991, 1993
@@ -44,18 +49,22 @@ ACE_RCSID(ace, OS_NS_wchar, "$Id: OS_NS_wchar.cpp 80826 2008-03-04 14:51:23Z wot
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSCAT)
wchar_t *
ACE_OS::wcscat_emulation (wchar_t *destination,
const wchar_t *source)
{
wchar_t *save = destination;
+
for (; *destination; ++destination);
while ((*destination++ = *source++));
return save;
}
#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSCAT */
+
#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSCHR)
wchar_t *
ACE_OS::wcschr_emulation (const wchar_t *string, wchar_t c)
@@ -63,9 +72,11 @@ ACE_OS::wcschr_emulation (const wchar_t *string, wchar_t c)
for (;*string ; ++string)
if (*string == c)
return const_cast<wchar_t *> (string);
+
return 0;
}
#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSCHR */
+
#if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSCMP)
int
ACE_OS::wcscmp_emulation (const ACE_WCHAR_T *string1,
@@ -77,16 +88,19 @@ ACE_OS::wcscmp_emulation (const ACE_WCHAR_T *string1,
return (*string1 - *--string2);
}
#endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSCMP */
+
#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSCPY)
wchar_t *
ACE_OS::wcscpy_emulation (wchar_t *destination,
const wchar_t *source)
{
wchar_t *save = destination;
+
for (; (*destination = *source); ++source, ++destination);
return save;
}
#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSCPY */
+
#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSCSPN)
size_t
ACE_OS::wcscspn_emulation (const wchar_t *s, const wchar_t *reject)
@@ -94,22 +108,28 @@ ACE_OS::wcscspn_emulation (const wchar_t *s, const wchar_t *reject)
const wchar_t *scan = 0;
const wchar_t *rej_scan = 0;
int count = 0;
+
for (scan = s; *scan; scan++)
{
+
for (rej_scan = reject; *rej_scan; rej_scan++)
if (*scan == *rej_scan)
return count;
+
count++;
}
+
return count;
}
#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSCSPN */
+
#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSICMP)
int
ACE_OS::wcsicmp_emulation (const wchar_t *s, const wchar_t *t)
{
const wchar_t *scan1 = s;
const wchar_t *scan2 = t;
+
while (*scan1 != 0
&& ACE_OS::ace_towlower (*scan1)
== ACE_OS::ace_towlower (*scan2))
@@ -117,9 +137,11 @@ ACE_OS::wcsicmp_emulation (const wchar_t *s, const wchar_t *t)
++scan1;
++scan2;
}
+
// The following case analysis is necessary so that characters which
// look negative collate low against normal characters but high
// against the end-of-string NUL.
+
if (*scan1 == '\0' && *scan2 == '\0')
return 0;
else if (*scan1 == '\0')
@@ -130,16 +152,20 @@ ACE_OS::wcsicmp_emulation (const wchar_t *s, const wchar_t *t)
return ACE_OS::ace_tolower (*scan1) - ACE_OS::ace_towlower (*scan2);
}
#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSICMP */
+
#if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSLEN)
size_t
ACE_OS::wcslen_emulation (const ACE_WCHAR_T *string)
{
const ACE_WCHAR_T *s;
+
for (s = string; *s; ++s)
continue;
+
return s - string;
}
#endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSLEN */
+
#if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSNCAT)
ACE_WCHAR_T *
ACE_OS::wcsncat_emulation (ACE_WCHAR_T *destination,
@@ -150,19 +176,25 @@ ACE_OS::wcsncat_emulation (ACE_WCHAR_T *destination,
{
ACE_WCHAR_T *d = destination;
const ACE_WCHAR_T *s = source;
+
while (*d != 0)
d++;
+
do
{
if ((*d = *s++) == 0)
break;
+
d++;
} while (--count != 0);
+
*d = 0;
}
+
return destination;
}
#endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSCAT */
+
#if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSNCMP)
int
ACE_OS::wcsncmp_emulation (const ACE_WCHAR_T *s1,
@@ -171,6 +203,7 @@ ACE_OS::wcsncmp_emulation (const ACE_WCHAR_T *s1,
{
if (len == 0)
return 0;
+
do
{
if (*s1 != *s2++)
@@ -178,9 +211,11 @@ ACE_OS::wcsncmp_emulation (const ACE_WCHAR_T *s1,
if (*s1++ == 0)
break;
} while (--len != 0);
+
return 0;
}
#endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSNCMP */
+
#if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSNCPY)
ACE_WCHAR_T *
ACE_OS::wcsncpy_emulation (ACE_WCHAR_T *destination,
@@ -191,6 +226,7 @@ ACE_OS::wcsncpy_emulation (ACE_WCHAR_T *destination,
{
ACE_WCHAR_T *d = destination;
const ACE_WCHAR_T *s = source;
+
do
{
if ((*d++ = *s++) == 0)
@@ -202,9 +238,11 @@ ACE_OS::wcsncpy_emulation (ACE_WCHAR_T *destination,
}
} while (--len != 0);
}
+
return destination;
}
#endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSNCPY */
+
#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSNICMP)
int
ACE_OS::wcsnicmp_emulation (const wchar_t *s,
@@ -214,6 +252,7 @@ ACE_OS::wcsnicmp_emulation (const wchar_t *s,
const wchar_t *scan1 = s;
const wchar_t *scan2 = t;
size_t count = 0;
+
while (count++ < len
&& *scan1 != 0
&& ACE_OS::ace_towlower (*scan1)
@@ -222,11 +261,14 @@ ACE_OS::wcsnicmp_emulation (const wchar_t *s,
++scan1;
++scan2;
}
+
if (count > len)
return 0;
+
// The following case analysis is necessary so that characters which
// look negative collate low against normal characters but high
// against the end-of-string NUL.
+
if (*scan1 == '\0' && *scan2 == '\0')
return 0;
else if (*scan1 == '\0')
@@ -237,6 +279,7 @@ ACE_OS::wcsnicmp_emulation (const wchar_t *s,
return ACE_OS::ace_towlower (*scan1) - ACE_OS::ace_towlower (*scan2);
}
#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSNICMP */
+
#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSPBRK)
wchar_t *
ACE_OS::wcspbrk_emulation (const wchar_t *string,
@@ -244,39 +287,48 @@ ACE_OS::wcspbrk_emulation (const wchar_t *string,
{
const wchar_t *scanp;
int c, sc;
+
while ((c = *string++) != 0)
{
for (scanp = charset; (sc = *scanp++) != 0;)
if (sc == c)
return const_cast<wchar_t *> (string - 1);
}
+
return 0;
}
#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSPBRK */
+
#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSRCHR)
const wchar_t *
ACE_OS::wcsrchr_emulation (const wchar_t *s, wint_t c)
{
const wchar_t *p = s + ACE_OS::strlen (s);
+
while (*p != static_cast<wchar_t> (c))
if (p == s)
return 0;
else
p--;
+
return p;
}
+
wchar_t *
ACE_OS::wcsrchr_emulation (wchar_t *s, wint_t c)
{
wchar_t *p = s + ACE_OS::strlen (s);
+
while (*p != static_cast<wchar_t> (c))
if (p == s)
return 0;
else
p--;
+
return p;
}
#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSRCHR */
+
#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSSPN)
size_t
ACE_OS::wcsspn_emulation (const wchar_t *string,
@@ -285,6 +337,7 @@ ACE_OS::wcsspn_emulation (const wchar_t *string,
const wchar_t *p = string;
const wchar_t *spanp;
wchar_t c, sc;
+
// Skip any characters in charset, excluding the terminating \0.
cont:
c = *p++;
@@ -294,6 +347,7 @@ cont:
return (p - 1 - string);
}
#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSSPN */
+
#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSSTR)
wchar_t *
ACE_OS::wcsstr_emulation (const wchar_t *string,
@@ -301,6 +355,7 @@ ACE_OS::wcsstr_emulation (const wchar_t *string,
{
wchar_t c, sc;
size_t len;
+
if ((c = *charset++) != 0)
{
len = ACE_OS::strlen (charset);
@@ -314,8 +369,10 @@ ACE_OS::wcsstr_emulation (const wchar_t *string,
} while (ACE_OS::strncmp (string, charset, len) != 0);
string--;
}
+
return const_cast<wchar_t *> (string);
}
#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSSTR */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_NS_wchar.h b/dep/ACE_wrappers/ace/OS_NS_wchar.h
index c0860d25554..e1201d3884f 100644
--- a/dep/ACE_wrappers/ace/OS_NS_wchar.h
+++ b/dep/ACE_wrappers/ace/OS_NS_wchar.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file OS_NS_wchar.h
@@ -12,69 +13,88 @@
* Originally in OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_NS_WCHAR_H
# define ACE_OS_NS_WCHAR_H
+
# include /**/ "ace/pre.h"
+
# include "ace/config-all.h"
+
# if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
# endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/os_wchar.h"
#include "ace/Basic_Types.h"
#include /**/ "ace/ACE_export.h"
#include "ace/ace_wchar.h" // include for the time being, but this code needs to be moved. dhinton
+
#include "ace/os_include/os_errno.h"
+
#if defined (ACE_EXPORT_MACRO)
# undef ACE_EXPORT_MACRO
#endif
#define ACE_EXPORT_MACRO ACE_Export
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE_OS
{
+
typedef ACE_WCHAR_T WChar;
+
#if defined (ACE_HAS_WCHAR)
ACE_NAMESPACE_INLINE_FUNCTION
wint_t fgetwc (FILE* fp);
#endif /* ACE_HAS_WCHAR */
+
#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSCAT)
/// Emulated wcscat - Appends a string.
extern ACE_Export
wchar_t *wcscat_emulation (wchar_t *destination,
const wchar_t *source);
#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSCAT */
+
#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSCHR)
/// Emulated wcschr - Finds a character in a string.
extern ACE_Export
wchar_t *wcschr_emulation (const wchar_t *string, wchar_t c);
#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSCHR */
+
#if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSCMP)
/// Emulated wcscmp - Compares strings.
extern ACE_Export
int wcscmp_emulation (const ACE_WCHAR_T *string1, const ACE_WCHAR_T *string2);
#endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSCMP */
+
#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSCPY)
/// Emulated wcscpy - Copies a string.
extern ACE_Export
wchar_t *wcscpy_emulation (wchar_t *destination,
const wchar_t *source);
#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSCPY */
+
#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSCSPN)
/// Emulated wcscspn.
extern ACE_Export
size_t wcscspn_emulation (const wchar_t *string,
const wchar_t *reject);
#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSCSPN */
+
#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSICMP)
/// Emulated wcsicmp - Performs a case insensitive comparison of strings.
extern ACE_Export
int wcsicmp_emulation (const wchar_t *string1,
const wchar_t *string2);
#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSICMP */
+
#if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSLEN)
/// Emulated wcslen - Returns the length of a string.
extern ACE_Export
size_t wcslen_emulation (const ACE_WCHAR_T *string);
#endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSLEN */
+
#if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSNCAT)
/// Emulated wcscat - Appends a string.
extern ACE_Export
@@ -82,6 +102,7 @@ namespace ACE_OS
const ACE_WCHAR_T *source,
size_t count);
#endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSCAT */
+
#if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSNCMP)
/// Emulated wcsncmp - Compares two arrays.
extern ACE_Export
@@ -89,6 +110,7 @@ namespace ACE_OS
const ACE_WCHAR_T *string2,
size_t len);
#endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSNCMP */
+
#if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSNCPY)
/// Emulated wcsncpy - Copies an array.
extern ACE_Export
@@ -96,6 +118,7 @@ namespace ACE_OS
const ACE_WCHAR_T *source,
size_t len);
#endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSNCPY */
+
#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSNICMP)
/// Emulated wcsnicmp - Performs a case insensitive comparison of two
/// arrays
@@ -104,53 +127,66 @@ namespace ACE_OS
const wchar_t *string2,
size_t len);
#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSNICMP */
+
#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSPBRK)
/// Emulated wcspbrk - Searches for characters in a string.
extern ACE_Export
wchar_t *wcspbrk_emulation (const wchar_t *string,
const wchar_t *charset);
#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSPBRK */
+
#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSRCHR)
/// Emulated wcsrchr (wchar_t version) - Finds the last occurance of a
/// character in a string.
extern ACE_Export
wchar_t *wcsrchr_emulation (wchar_t *string, wint_t c);
+
/// Emulated wcsrchr (const wchar_t version) - Finds the last occurance of a
/// character in a string.
extern ACE_Export
const wchar_t *wcsrchr_emulation (const wchar_t *string, wint_t c);
#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSRCHR */
+
#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSSPN)
/// Emulated wcsspn.
extern ACE_Export
size_t wcsspn_emulation (const wchar_t *string,
const wchar_t *charset);
#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSSPN */
+
#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSSTR)
/// Emulated wcsstr - Performs a case insensitive comparison of two strings.
extern ACE_Export
wchar_t *wcsstr_emulation (const wchar_t *string,
const wchar_t *charset);
#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSSTR */
+
// these are named wrong. should be wcslen, etc... dhinton
ACE_NAMESPACE_INLINE_FUNCTION
u_int wslen (const WChar *);
+
ACE_NAMESPACE_INLINE_FUNCTION
WChar *wscpy (WChar *,
const WChar *);
+
ACE_NAMESPACE_INLINE_FUNCTION
int wscmp (const WChar *,
const WChar *);
+
ACE_NAMESPACE_INLINE_FUNCTION
int wsncmp (const WChar *,
const WChar *,
size_t len);
+
#if defined (ACE_HAS_WCHAR)
ACE_NAMESPACE_INLINE_FUNCTION
wint_t ungetwc (wint_t c, FILE* fp);
#endif /* ACE_HAS_WCHAR */
+
} /* namespace ACE_OS */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# if defined (ACE_HAS_INLINED_OSCALLS)
# if defined (ACE_INLINE)
# undef ACE_INLINE
@@ -158,6 +194,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_INLINE inline
# include "ace/OS_NS_wchar.inl"
# endif /* ACE_HAS_INLINED_OSCALLS */
+
# include /**/ "ace/post.h"
#endif /* ACE_OS_NS_STDIO_H */
diff --git a/dep/ACE_wrappers/ace/OS_NS_wchar.inl b/dep/ACE_wrappers/ace/OS_NS_wchar.inl
index b2140eab99d..a11a0fb23e0 100644
--- a/dep/ACE_wrappers/ace/OS_NS_wchar.inl
+++ b/dep/ACE_wrappers/ace/OS_NS_wchar.inl
@@ -1,7 +1,9 @@
// -*- C++ -*-
//
// $Id: OS_NS_wchar.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_HAS_WCHAR)
ACE_INLINE wint_t
ACE_OS::fgetwc (FILE* fp)
@@ -14,47 +16,60 @@ ACE_OS::fgetwc (FILE* fp)
# endif /* ACE_LACKS_FGETWC */
}
#endif /* ACE_HAS_WCHAR */
+
ACE_INLINE u_int
ACE_OS::wslen (const WChar *s)
{
u_int len = 0;
+
while (*s++ != 0)
len++;
+
return len;
}
+
ACE_INLINE ACE_OS::WChar *
ACE_OS::wscpy (WChar *dest, const WChar *src)
{
WChar *original_dest = dest;
+
while ((*dest++ = *src++) != 0)
continue;
+
return original_dest;
}
+
ACE_INLINE int
ACE_OS::wscmp (const WChar *s, const WChar *t)
{
const WChar *scan1 = s;
const WChar *scan2 = t;
+
while (*scan1 != 0 && *scan1 == *scan2)
{
++scan1;
++scan2;
}
+
return *scan1 - *scan2;
}
+
ACE_INLINE int
ACE_OS::wsncmp (const WChar *s, const WChar *t, size_t len)
{
const WChar *scan1 = s;
const WChar *scan2 = t;
+
while (len != 0 && *scan1 != 0 && *scan1 == *scan2)
{
++scan1;
++scan2;
--len;
}
+
return len == 0 ? 0 : *scan1 - *scan2;
}
+
#if defined (ACE_HAS_WCHAR)
ACE_INLINE wint_t
ACE_OS::ungetwc (wint_t c, FILE* fp)
@@ -68,4 +83,5 @@ ACE_OS::ungetwc (wint_t c, FILE* fp)
# endif /* ACE_LACKS_FGETWC */
}
#endif /* ACE_HAS_WCHAR */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_QoS.cpp b/dep/ACE_wrappers/ace/OS_QoS.cpp
index bc7f3f28923..0adf6efc01e 100644
--- a/dep/ACE_wrappers/ace/OS_QoS.cpp
+++ b/dep/ACE_wrappers/ace/OS_QoS.cpp
@@ -9,9 +9,12 @@
// * @author Craig Rodrigues <crodrigu@bbn.com>
// */
//=============================================================================
+
#include "ace/OS_QoS.h"
#include "ace/OS_NS_errno.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_Flow_Spec::ACE_Flow_Spec (unsigned long token_rate,
unsigned long token_bucket_size,
unsigned long peak_bandwidth,
@@ -41,6 +44,7 @@ ACE_Flow_Spec::ACE_Flow_Spec (unsigned long token_rate,
ACE_UNUSED_ARG (ttl);
ACE_UNUSED_ARG (priority);
#else
+
this->token_rate_ = token_rate;
this->token_bucket_size_ = token_bucket_size;
this->peak_bandwidth_ = peak_bandwidth;
@@ -51,8 +55,10 @@ ACE_Flow_Spec::ACE_Flow_Spec (unsigned long token_rate,
this->minimum_policed_size_ = minimum_policed_size;
this->ttl_ = ttl;
this->priority_ = priority;
+
#endif /* defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) */
}
+
ACE_Flow_Spec::ACE_Flow_Spec (void)
{
#if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) && \
@@ -68,6 +74,7 @@ ACE_Flow_Spec::ACE_Flow_Spec (void)
this->MinimumPolicedSize = 0;
#endif /* ACE_HAS_WINSOCK2_GQOS */
#else
+
this->token_rate_ = 0;
this->token_bucket_size_ = 0;
this->peak_bandwidth_ = 0;
@@ -78,8 +85,10 @@ ACE_Flow_Spec::ACE_Flow_Spec (void)
this->minimum_policed_size_ = 0;
this->ttl_ = 0;
this->priority_ = 0;
+
#endif /* defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) */
}
+
unsigned long
ACE_Flow_Spec::token_rate (void) const
{
@@ -89,6 +98,7 @@ ACE_Flow_Spec::token_rate (void) const
return this->token_rate_;
#endif /* ACE_HAS_WINSOCK2 */
}
+
void
ACE_Flow_Spec::token_rate (unsigned long tr)
{
@@ -98,6 +108,7 @@ ACE_Flow_Spec::token_rate (unsigned long tr)
this->token_rate_ = tr;
#endif /* ACE_HAS_WINSOCK2 */
}
+
unsigned long
ACE_Flow_Spec::token_bucket_size (void) const
{
@@ -107,6 +118,7 @@ ACE_Flow_Spec::token_bucket_size (void) const
return this->token_bucket_size_;
#endif /* ACE_HAS_WINSOCK2 */
}
+
void
ACE_Flow_Spec::token_bucket_size (unsigned long tbs)
{
@@ -116,6 +128,7 @@ ACE_Flow_Spec::token_bucket_size (unsigned long tbs)
this->token_bucket_size_ = tbs;
#endif /* ACE_HAS_WINSOCK2 */
}
+
unsigned long
ACE_Flow_Spec::peak_bandwidth (void) const
{
@@ -125,6 +138,7 @@ ACE_Flow_Spec::peak_bandwidth (void) const
return this->peak_bandwidth_;
#endif /* ACE_HAS_WINSOCK2 */
}
+
void
ACE_Flow_Spec::peak_bandwidth (unsigned long pb)
{
@@ -134,6 +148,7 @@ ACE_Flow_Spec::peak_bandwidth (unsigned long pb)
this->peak_bandwidth_ = pb;
#endif /* ACE_HAS_WINSOCK2 */
}
+
unsigned long
ACE_Flow_Spec::latency (void) const
{
@@ -143,6 +158,7 @@ ACE_Flow_Spec::latency (void) const
return this->latency_;
#endif /* ACE_HAS_WINSOCK2 */
}
+
void
ACE_Flow_Spec::latency (unsigned long l)
{
@@ -152,6 +168,7 @@ ACE_Flow_Spec::latency (unsigned long l)
this->latency_ = l;
#endif /* ACE_HAS_WINSOCK2 */
}
+
unsigned long
ACE_Flow_Spec::delay_variation (void) const
{
@@ -170,6 +187,7 @@ ACE_Flow_Spec::delay_variation (unsigned long dv)
this->delay_variation_ = dv;
#endif /* ACE_HAS_WINSOCK2 */
}
+
ACE_SERVICE_TYPE
ACE_Flow_Spec::service_type (void) const
{
@@ -180,6 +198,7 @@ ACE_Flow_Spec::service_type (void) const
return this->service_type_;
#endif /* ACE_HAS_WINSOCK2 */
}
+
void
ACE_Flow_Spec::service_type (ACE_SERVICE_TYPE st)
{
@@ -190,6 +209,7 @@ ACE_Flow_Spec::service_type (ACE_SERVICE_TYPE st)
this->service_type_ = st;
#endif /* ACE_HAS_WINSOCK2 */
}
+
unsigned long
ACE_Flow_Spec::max_sdu_size (void) const
{
@@ -200,6 +220,7 @@ ACE_Flow_Spec::max_sdu_size (void) const
return this->max_sdu_size_;
#endif /* ACE_HAS_WINSOCK2 */
}
+
void
ACE_Flow_Spec::max_sdu_size (unsigned long mss)
{
@@ -210,6 +231,7 @@ ACE_Flow_Spec::max_sdu_size (unsigned long mss)
this->max_sdu_size_ = mss;
#endif /* ACE_HAS_WINSOCK2 */
}
+
unsigned long
ACE_Flow_Spec::minimum_policed_size (void) const
{
@@ -220,6 +242,7 @@ ACE_Flow_Spec::minimum_policed_size (void) const
return this->minimum_policed_size_;
#endif /* ACE_HAS_WINSOCK2 */
}
+
void
ACE_Flow_Spec::minimum_policed_size (unsigned long mps)
{
@@ -230,6 +253,7 @@ ACE_Flow_Spec::minimum_policed_size (unsigned long mps)
this->minimum_policed_size_ = mps;
#endif /* ACE_HAS_WINSOCK2 */
}
+
int
ACE_Flow_Spec::ttl (void) const
{
@@ -240,6 +264,7 @@ ACE_Flow_Spec::ttl (void) const
return this->ttl_;
#endif /* ACE_HAS_WINSOCK2 */
}
+
void
ACE_Flow_Spec::ttl (int t)
{
@@ -251,6 +276,7 @@ ACE_Flow_Spec::ttl (int t)
this->ttl_ = t;
#endif /* ACE_HAS_WINSOCK2 */
}
+
int
ACE_Flow_Spec::priority (void) const
{
@@ -261,6 +287,7 @@ ACE_Flow_Spec::priority (void) const
return this->priority_;
#endif /* ACE_HAS_WINSOCK2 */
}
+
void
ACE_Flow_Spec::priority (int p)
{
@@ -272,6 +299,7 @@ ACE_Flow_Spec::priority (int p)
this->priority_ = p;
#endif /* ACE_HAS_WINSOCK2 */
}
+
ACE_QoS::ACE_QoS (void)
#if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
#else
@@ -280,6 +308,7 @@ ACE_QoS::ACE_QoS (void)
#endif /* ACE_HAS_WINSOCK2 */
{
}
+
ACE_Flow_Spec*
ACE_QoS::sending_flowspec (void) const
{
@@ -289,6 +318,7 @@ ACE_QoS::sending_flowspec (void) const
return this->sending_flowspec_;
#endif /* ACE_HAS_WINSOCK2 */
}
+
void
ACE_QoS::sending_flowspec (ACE_Flow_Spec *fs)
{
@@ -298,6 +328,7 @@ ACE_QoS::sending_flowspec (ACE_Flow_Spec *fs)
this->sending_flowspec_ = fs;
#endif /* ACE_HAS_WINSOCK2 */
}
+
ACE_Flow_Spec*
ACE_QoS::receiving_flowspec (void) const
{
@@ -307,6 +338,7 @@ ACE_QoS::receiving_flowspec (void) const
return receiving_flowspec_;
#endif /* ACE_HAS_WINSOCK2 */
}
+
void
ACE_QoS::receiving_flowspec (ACE_Flow_Spec *fs)
{
@@ -316,6 +348,7 @@ ACE_QoS::receiving_flowspec (ACE_Flow_Spec *fs)
this->receiving_flowspec_ = fs;
#endif /* ACE_HAS_WINSOCK2 */
}
+
iovec
ACE_QoS::provider_specific (void) const
{
@@ -325,6 +358,7 @@ ACE_QoS::provider_specific (void) const
ACE_NOTSUP_RETURN (iovec ());
#endif /* ACE_HAS_WINSOCK2 */
}
+
void
ACE_QoS::provider_specific (const iovec &ps)
{
@@ -334,6 +368,7 @@ ACE_QoS::provider_specific (const iovec &ps)
ACE_UNUSED_ARG (ps);
#endif /* ACE_HAS_WINSOCK2 */
}
+
ACE_QoS_Params::ACE_QoS_Params (iovec *caller_data,
iovec *callee_data,
ACE_QoS *socket_qos,
@@ -346,81 +381,97 @@ ACE_QoS_Params::ACE_QoS_Params (iovec *caller_data,
flags_ (flags)
{
}
+
iovec *
ACE_QoS_Params::caller_data (void) const
{
return this->caller_data_;
}
+
void
ACE_QoS_Params::caller_data (iovec *cd)
{
this->caller_data_ = cd;
}
+
iovec *
ACE_QoS_Params::callee_data (void) const
{
return this->callee_data_;
}
+
void
ACE_QoS_Params::callee_data (iovec *cd)
{
this->callee_data_ = cd;
}
+
ACE_QoS *
ACE_QoS_Params::socket_qos (void) const
{
return this->socket_qos_;
}
+
void
ACE_QoS_Params::socket_qos (ACE_QoS *sq)
{
this->socket_qos_ = sq;
}
+
ACE_QoS *
ACE_QoS_Params::group_socket_qos (void) const
{
return this->group_socket_qos_;
}
+
void
ACE_QoS_Params::group_socket_qos (ACE_QoS *gsq)
{
this->group_socket_qos_ = gsq;
}
+
unsigned long
ACE_QoS_Params::flags (void) const
{
return this->flags_;
}
+
void
ACE_QoS_Params::flags (unsigned long f)
{
this->flags_ = f;
}
+
ACE_Accept_QoS_Params::ACE_Accept_QoS_Params (ACE_QOS_CONDITION_FUNC qos_condition_callback,
unsigned long callback_data)
: qos_condition_callback_ (qos_condition_callback),
callback_data_ (callback_data)
{
}
+
ACE_QOS_CONDITION_FUNC
ACE_Accept_QoS_Params::qos_condition_callback (void) const
{
return this->qos_condition_callback_;
}
+
void
ACE_Accept_QoS_Params::qos_condition_callback (ACE_QOS_CONDITION_FUNC qcc)
{
this->qos_condition_callback_ = qcc;
}
+
unsigned long
ACE_Accept_QoS_Params::callback_data (void) const
{
return this->callback_data_;
}
+
void
ACE_Accept_QoS_Params::callback_data (unsigned long cd)
{
this->callback_data_ = cd;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_QoS.h b/dep/ACE_wrappers/ace/OS_QoS.h
index 046f581b4fb..022a17bee30 100644
--- a/dep/ACE_wrappers/ace/OS_QoS.h
+++ b/dep/ACE_wrappers/ace/OS_QoS.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file OS_QoS.h
@@ -10,122 +11,149 @@
* @author Craig Rodrigues <crodrigu@bbn.com>
*/
//=============================================================================
+
#ifndef ACE_OS_QOS_H
#define ACE_OS_QOS_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/sys/os_uio.h"
#include "ace/OS_NS_stropts.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) && defined (ACE_HAS_WINSOCK2_GQOS)
typedef SERVICETYPE ACE_SERVICE_TYPE;
#else
typedef unsigned long ACE_SERVICE_TYPE;
#endif /* ACE_HAS_WINSOCK2 && ACE_HAS_WINSOCK2 != 0 */
+
#if defined (WSA_FLAG_OVERLAPPED)
# define ACE_OVERLAPPED_SOCKET_FLAG WSA_FLAG_OVERLAPPED
#else
# define ACE_OVERLAPPED_SOCKET_FLAG 0
#endif
+
#if defined (XP1_QOS_SUPPORTED)
# define ACE_XP1_QOS_SUPPORTED XP1_QOS_SUPPORTED
#else
# define ACE_XP1_QOS_SUPPORTED 0x00002000
#endif
+
#if defined (XP1_SUPPORT_MULTIPOINT)
# define ACE_XP1_SUPPORT_MULTIPOINT XP1_SUPPORT_MULTIPOINT
#else
# define ACE_XP1_SUPPORT_MULTIPOINT 0x00000400
#endif
+
#if defined (WSABASEERR)
# define ACE_BASEERR WSABASEERR
#else
# define ACE_BASEERR 10000
#endif
+
#if defined (WSAENOBUFS)
# define ACE_ENOBUFS WSAENOBUFS
#else
# define ACE_ENOBUFS (ACE_BASEERR+55)
#endif
+
#if defined (FROM_PROTOCOL_INFO)
# define ACE_FROM_PROTOCOL_INFO FROM_PROTOCOL_INFO
#else
# define ACE_FROM_PROTOCOL_INFO (-1)
#endif
+
#if defined (WSA_FLAG_MULTIPOINT_C_ROOT)
# define ACE_FLAG_MULTIPOINT_C_ROOT WSA_FLAG_MULTIPOINT_C_ROOT
#else
# define ACE_FLAG_MULTIPOINT_C_ROOT 0x02
#endif
+
#if defined (WSA_FLAG_MULTIPOINT_C_LEAF)
# define ACE_FLAG_MULTIPOINT_C_LEAF WSA_FLAG_MULTIPOINT_C_LEAF
#else
# define ACE_FLAG_MULTIPOINT_C_LEAF 0x04
#endif
+
#if defined (WSA_FLAG_MULTIPOINT_D_ROOT)
# define ACE_FLAG_MULTIPOINT_D_ROOT WSA_FLAG_MULTIPOINT_D_ROOT
#else
# define ACE_FLAG_MULTIPOINT_D_ROOT 0x08
#endif
+
#if defined (WSA_FLAG_MULTIPOINT_D_LEAF)
# define ACE_FLAG_MULTIPOINT_D_LEAF WSA_FLAG_MULTIPOINT_D_LEAF
#else
# define ACE_FLAG_MULTIPOINT_D_LEAF 0x10
#endif
+
#if defined (QOS_NOT_SPECIFIED)
# define ACE_QOS_NOT_SPECIFIED QOS_NOT_SPECIFIED
#else
# define ACE_QOS_NOT_SPECIFIED 0xFFFFFFFF
#endif
+
#if defined (SERVICETYPE_NOTRAFFIC)
# define ACE_SERVICETYPE_NOTRAFFIC SERVICETYPE_NOTRAFFIC
#else
# define ACE_SERVICETYPE_NOTRAFFIC 0x00000000 /* No data in this */
/* direction. */
#endif
+
#if defined (SERVICETYPE_CONTROLLEDLOAD)
# define ACE_SERVICETYPE_CONTROLLEDLOAD SERVICETYPE_CONTROLLEDLOAD
#else
# define ACE_SERVICETYPE_CONTROLLEDLOAD 0x00000001 /* Controlled Load. */
#endif
+
#if defined (SERVICETYPE_GUARANTEED)
# define ACE_SERVICETYPE_GUARANTEED SERVICETYPE_GUARANTEED
#else
# define ACE_SERVICETYPE_GUARANTEED 0x00000003 /* Guaranteed. */
#endif
+
#if defined (JL_SENDER_ONLY)
# define ACE_JL_SENDER_ONLY JL_SENDER_ONLY
#else
# define ACE_JL_SENDER_ONLY 0x01
#endif
+
#if defined (JL_BOTH)
# define ACE_JL_BOTH JL_BOTH
#else
# define ACE_JL_BOTH 0x04
#endif
+
#if defined (SIO_GET_QOS)
# define ACE_SIO_GET_QOS SIO_GET_QOS
#else
# define ACE_SIO_GET_QOS (0x40000000 | 0x08000000 | 7)
#endif
+
#if defined (SIO_MULTIPOINT_LOOPBACK)
# define ACE_SIO_MULTIPOINT_LOOPBACK SIO_MULTIPOINT_LOOPBACK
#else
# define ACE_SIO_MULTIPOINT_LOOPBACK (0x08000000 | 9)
#endif
+
#if defined (SIO_MULTICAST_SCOPE)
# define ACE_SIO_MULTICAST_SCOPE SIO_MULTICAST_SCOPE
#else
# define ACE_SIO_MULTICAST_SCOPE (0x08000000 | 10)
#endif
+
#if defined (SIO_SET_QOS)
# define ACE_SIO_SET_QOS SIO_SET_QOS
#else
# define ACE_SIO_SET_QOS (0x08000000 | 11)
#endif
+
/**
* @class ACE_Flow_Spec
*
@@ -140,6 +168,7 @@ class ACE_Export ACE_Flow_Spec
public:
/// Default constructor.
ACE_Flow_Spec (void);
+
/// Constructor that initializes all the fields.
ACE_Flow_Spec (unsigned long token_rate,
unsigned long token_bucket_size,
@@ -151,46 +180,67 @@ public:
unsigned long minimum_policed_size,
int ttl,
int priority);
+
/// Get the token rate in bytes/sec.
unsigned long token_rate (void) const;
+
/// Set the token rate in bytes/sec.
void token_rate (unsigned long tr);
+
/// Get the token bucket size in bytes.
unsigned long token_bucket_size (void) const;
+
/// Set the token bucket size in bytes.
void token_bucket_size (unsigned long tbs);
+
/// Get the PeakBandwidth in bytes/sec.
unsigned long peak_bandwidth (void) const;
+
/// Set the PeakBandwidth in bytes/sec.
void peak_bandwidth (unsigned long pb);
+
/// Get the latency in microseconds.
unsigned long latency (void) const;
+
/// Set the latency in microseconds.
void latency (unsigned long l);
+
/// Get the delay variation in microseconds.
unsigned long delay_variation (void) const;
+
/// Set the delay variation in microseconds.
void delay_variation (unsigned long dv);
+
/// Get the service type.
ACE_SERVICE_TYPE service_type (void) const;
+
/// Set the service type.
void service_type (ACE_SERVICE_TYPE st);
+
/// Get the maximum SDU size in bytes.
unsigned long max_sdu_size (void) const;
+
/// Set the maximum SDU size in bytes.
void max_sdu_size (unsigned long mss);
+
/// Get the minimum policed size in bytes.
unsigned long minimum_policed_size (void) const;
+
/// Set the minimum policed size in bytes.
void minimum_policed_size (unsigned long mps);
+
/// Get the time-to-live.
int ttl (void) const;
+
/// Set the time-to-live.
void ttl (int t);
+
/// Get the priority.
int priority (void) const;
+
/// Set the priority.
void priority (int p);
+
#if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) && \
defined (ACE_HAS_WINSOCK2_GQOS)
#else
@@ -208,6 +258,7 @@ private:
#endif /* defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) && \
defined (ACE_HAS_WINSOCK2_GQOS) */
};
+
/**
* @class ACE_QoS
*
@@ -222,25 +273,35 @@ class ACE_Export ACE_QoS
public:
/// Constructor
ACE_QoS (void);
+
/// Get the flow spec for data sending.
ACE_Flow_Spec *sending_flowspec (void) const;
+
/// Set the flow spec for data sending.
void sending_flowspec (ACE_Flow_Spec *fs);
+
/// Get the flow spec for data receiving.
ACE_Flow_Spec *receiving_flowspec (void) const;
+
/// Set the flow spec for data receiving.
void receiving_flowspec (ACE_Flow_Spec *fs);
+
/// Get the provider specific information.
iovec provider_specific (void) const;
+
/// Set the provider specific information.
void provider_specific (const iovec &ps);
+
#if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
#else
private:
+
ACE_Flow_Spec *sending_flowspec_;
ACE_Flow_Spec *receiving_flowspec_;
#endif
+
};
+
/**
* @class ACE_QoS_Params
*
@@ -266,42 +327,58 @@ public:
ACE_QoS *socket_qos = 0,
ACE_QoS *group_socket_qos = 0,
unsigned long flags = 0);
+
/// Get caller data.
iovec *caller_data (void) const;
+
/// Set caller data.
void caller_data (iovec *);
+
/// Get callee data.
iovec *callee_data (void) const;
+
/// Set callee data.
void callee_data (iovec *);
+
/// Get socket qos.
ACE_QoS *socket_qos (void) const;
+
/// Set socket qos.
void socket_qos (ACE_QoS *);
+
/// Get group socket qos.
ACE_QoS *group_socket_qos (void) const;
+
/// Set group socket qos.
void group_socket_qos (ACE_QoS *);
+
/// Get flags.
unsigned long flags (void) const;
+
/// Set flags.
void flags (unsigned long);
+
private:
/// A pointer to the user data that is to be transferred to the peer
/// during connection establishment.
iovec *caller_data_;
+
/// A pointer to the user data that is to be transferred back from
/// the peer during connection establishment.
iovec *callee_data_;
+
/// A pointer to the flow speicfications for the socket, one for each
/// direction.
ACE_QoS *socket_qos_;
+
/// A pointer to the flow speicfications for the socket group, if
/// applicable.
ACE_QoS *group_socket_qos_;
+
/// Flags that indicate if we're a sender, receiver, or both.
unsigned long flags_;
};
+
// Callback function that's used by the QoS-enabled <ACE_OS::accept>
// method.
typedef int (*ACE_QOS_CONDITION_FUNC) (iovec *caller_id,
@@ -313,6 +390,7 @@ typedef int (*ACE_QOS_CONDITION_FUNC) (iovec *caller_id,
ACE_SOCK_GROUP *g,
unsigned long callbackdata);
+
/**
* @class ACE_Accept_QoS_Params
*
@@ -334,14 +412,19 @@ public:
*/
ACE_Accept_QoS_Params (ACE_QOS_CONDITION_FUNC qos_condition_callback = 0,
unsigned long callback_data = 0);
+
/// Get QoS condition callback.
ACE_QOS_CONDITION_FUNC qos_condition_callback (void) const;
+
/// Set QoS condition callback.
void qos_condition_callback (ACE_QOS_CONDITION_FUNC qcc);
+
/// Get callback data.
unsigned long callback_data (void) const;
+
/// Set callback data.
void callback_data (unsigned long cd);
+
private:
/**
* This is the address of an optional, application-supplied
@@ -351,6 +434,7 @@ private:
* to the result parameter <g> of this function.
*/
ACE_QOS_CONDITION_FUNC qos_condition_callback_;
+
/**
* This data is passed back to the application as a condition
* function parameter, i.e., it is an Asynchronous Completion Token
@@ -358,7 +442,9 @@ private:
*/
unsigned long callback_data_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_QOS_H */
diff --git a/dep/ACE_wrappers/ace/OS_String.h b/dep/ACE_wrappers/ace/OS_String.h
index f84ee7b8924..10ea346fc9c 100644
--- a/dep/ACE_wrappers/ace/OS_String.h
+++ b/dep/ACE_wrappers/ace/OS_String.h
@@ -12,17 +12,22 @@
* @author and a cast of thousands...
*/
//=============================================================================
+
#ifndef ACE_OS_STRING_H
#define ACE_OS_STRING_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/OS_NS_string.h"
#include "ace/OS_NS_strings.h"
#include "ace/OS_NS_wchar.h"
#include "ace/OS_NS_ctype.h"
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_STRING_H */
diff --git a/dep/ACE_wrappers/ace/OS_TLI.cpp b/dep/ACE_wrappers/ace/OS_TLI.cpp
index dc78b49b581..c2754b7b36d 100644
--- a/dep/ACE_wrappers/ace/OS_TLI.cpp
+++ b/dep/ACE_wrappers/ace/OS_TLI.cpp
@@ -1,6 +1,9 @@
// $Id: OS_TLI.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_TLI.h"
+
ACE_RCSID(ace, OS_TLI, "$Id: OS_TLI.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if !defined (ACE_HAS_INLINED_OSCALLS)
# include "ace/OS_TLI.inl"
#endif /* !ACE_HAS_INLINED_OSCALLS */
diff --git a/dep/ACE_wrappers/ace/OS_TLI.h b/dep/ACE_wrappers/ace/OS_TLI.h
index 898b9bf1d2a..8e607acd4b4 100644
--- a/dep/ACE_wrappers/ace/OS_TLI.h
+++ b/dep/ACE_wrappers/ace/OS_TLI.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file OS_TLI.h
@@ -9,19 +10,25 @@
*/
//=============================================================================
+
#ifndef ACE_OS_TLI_H
# define ACE_OS_TLI_H
# include /**/ "ace/pre.h"
+
# include "ace/config-all.h"
+
# if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
# endif /* ACE_LACKS_PRAGMA_ONCE */
+
# include "ace/OS_Errno.h"
# include "ace/ACE_export.h"
+
# if defined (ACE_EXPORT_MACRO)
# undef ACE_EXPORT_MACRO
# endif
# define ACE_EXPORT_MACRO ACE_Export
+
# if !(defined(ACE_HAS_TLI) || defined(ACE_HAS_XTI))
// Dummies to help compilation.
struct t_call { };
@@ -32,13 +39,16 @@ struct t_discon { };
struct t_unitdata { };
struct t_uderr { };
struct netbuf { };
+
# else /* !(ACE_HAS_TLI || ACE_HAS_XTI) */
+
# if defined (ACE_HAS_CONFLICTING_XTI_MACROS)
// Make sure tcp.h gets included before sys/xti.h.
# include "ace/os_include/netinet/os_tcp.h"
# undef TCP_NODELAY
# undef TCP_MAXSEG
# endif /* ACE_HAS_CONFLICTING_XTI_MACROS */
+
# if defined (ACE_HAS_XTI)
# if defined (ACE_HAS_SYS_XTI_H) /* Nonstandard header placement */
# define class ace_xti_class
@@ -53,6 +63,7 @@ struct netbuf { };
# else
# include /**/ <xti.h>
# endif /* ACE_HAS_SYS_XTI_H */
+
// The XTI API for obtaining local/peer addresses is t_getprotaddr().
// The ACE API was developed in TLI days and so uses t_getname().
// t_getname() has a type argument that specifies which address is
@@ -66,8 +77,10 @@ struct netbuf { };
# if !defined (REMOTENAME)
# define REMOTENAME 1
# endif
+
# else /* !ACE_HAS_XTI, so this is a TLI system */
# if !defined (ACE_HAS_TLI_PROTOTYPES)
+
// Define ACE_TLI headers for systems that don't prototype them....
extern "C"
{
@@ -101,6 +114,7 @@ extern "C"
int t_unbind(int fildes);
}
# endif /* !ACE_HAS_TLI_PROTOTYPES */
+
# if defined (ACE_HAS_TIUSER_H_BROKEN_EXTERN_C)
extern "C" {
# endif /* ACE_HAS_TIUSER_H_BROKEN_EXTERN_C */
@@ -112,6 +126,7 @@ extern "C" {
# if defined (ACE_HAS_TIUSER_H_BROKEN_EXTERN_C)
}
# endif /* ACE_HAS_TIUSER_H_BROKEN_EXTERN_C */
+
# if defined (ACE_HAS_SVR4_TLI)
// t_getname is a TLI extension added by some platforms before XTI
// was widely available. However, it's not often in the system's
@@ -119,8 +134,11 @@ extern "C" {
extern "C" int t_getname (int, struct netbuf *, int);
# endif /* ACE_HAS_SVR4_TLI */
# endif /* !ACE_HAS_XTI */
+
# endif /* ACE_HAS_XTI || ACE_HAS_TLI */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// This hack is needed to get around an odd and hard-to-reproduce problem
// with HP aC++. If struct sigaction is defined extern "C" and the sigaction
// function in namespace ACE_OS, the compiler sometimes gets confused.
@@ -139,6 +157,7 @@ typedef extern "C" struct t_bind ACE_TBIND;
typedef struct t_optmgmt ACE_TOPTMGMT;
typedef struct t_bind ACE_TBIND;
#endif
+
/**
* @namespace ACE_OS
*
@@ -153,81 +172,107 @@ namespace ACE_OS
ACE_HANDLE resfd,
struct t_call
*call);
+
ACE_NAMESPACE_INLINE_FUNCTION
char *t_alloc (ACE_HANDLE fildes,
int struct_type,
int
fields);
+
ACE_NAMESPACE_INLINE_FUNCTION
int t_bind (ACE_HANDLE fildes,
ACE_TBIND *req,
ACE_TBIND *ret);
+
ACE_NAMESPACE_INLINE_FUNCTION
int t_close (ACE_HANDLE fildes);
+
ACE_NAMESPACE_INLINE_FUNCTION
int t_connect (ACE_HANDLE fildes,
struct t_call *sndcall,
struct t_call *rcvcall);
+
ACE_NAMESPACE_INLINE_FUNCTION
void t_error (const char *errmsg);
+
ACE_NAMESPACE_INLINE_FUNCTION
int t_free (char *ptr,
int struct_type);
+
ACE_NAMESPACE_INLINE_FUNCTION
int t_getinfo (ACE_HANDLE fildes,
struct t_info *info);
+
ACE_NAMESPACE_INLINE_FUNCTION
int t_getname (ACE_HANDLE fildes,
struct netbuf *namep,
int type);
+
ACE_NAMESPACE_INLINE_FUNCTION
int t_getstate (ACE_HANDLE fildes);
+
ACE_NAMESPACE_INLINE_FUNCTION
int t_listen (ACE_HANDLE fildes,
struct t_call *call);
+
ACE_NAMESPACE_INLINE_FUNCTION
int t_look (ACE_HANDLE fildes);
+
ACE_NAMESPACE_INLINE_FUNCTION
ACE_HANDLE t_open (char *path,
int oflag,
struct t_info *info);
+
ACE_NAMESPACE_INLINE_FUNCTION
int t_optmgmt (ACE_HANDLE handle,
ACE_TOPTMGMT *req,
ACE_TOPTMGMT *ret);
+
ACE_NAMESPACE_INLINE_FUNCTION
int t_rcv (ACE_HANDLE fildes,
char *buf,
unsigned int nbytes,
int *flags);
+
ACE_NAMESPACE_INLINE_FUNCTION
int t_rcvdis (ACE_HANDLE fildes,
struct t_discon *discon);
+
ACE_NAMESPACE_INLINE_FUNCTION
int t_rcvrel (ACE_HANDLE fildes);
+
ACE_NAMESPACE_INLINE_FUNCTION
int t_rcvudata (ACE_HANDLE fildes,
struct t_unitdata *unitdata,
int *flags);
+
ACE_NAMESPACE_INLINE_FUNCTION
int t_rcvuderr (ACE_HANDLE fildes,
struct t_uderr *uderr);
+
ACE_NAMESPACE_INLINE_FUNCTION
int t_snd (ACE_HANDLE fildes,
const char *buf,
unsigned int nbytes,
int flags);
+
ACE_NAMESPACE_INLINE_FUNCTION
int t_snddis (ACE_HANDLE fildes,
struct t_call *call);
+
ACE_NAMESPACE_INLINE_FUNCTION
int t_sndrel (ACE_HANDLE fildes);
+
ACE_NAMESPACE_INLINE_FUNCTION
int t_sync (ACE_HANDLE fildes);
+
ACE_NAMESPACE_INLINE_FUNCTION
int t_unbind (ACE_HANDLE fildes);
+
} /* namespace ACE_OS */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# if defined (ACE_HAS_INLINED_OSCALLS)
# if defined (ACE_INLINE)
# undef ACE_INLINE
@@ -235,6 +280,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_INLINE inline
# include "ace/OS_TLI.inl"
# endif /* ACE_HAS_INLINED_OSCALLS */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_TLI_H */
diff --git a/dep/ACE_wrappers/ace/OS_TLI.inl b/dep/ACE_wrappers/ace/OS_TLI.inl
index 63a01aff716..bbca38b2cd8 100644
--- a/dep/ACE_wrappers/ace/OS_TLI.inl
+++ b/dep/ACE_wrappers/ace/OS_TLI.inl
@@ -1,9 +1,13 @@
// -*- C++ -*-
//
// $Id: OS_TLI.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_errno.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE_OS {
+
ACE_INLINE int
t_accept (ACE_HANDLE handle, ACE_HANDLE reshandle, struct t_call *call)
{
@@ -13,9 +17,11 @@ t_accept (ACE_HANDLE handle, ACE_HANDLE reshandle, struct t_call *call)
ACE_UNUSED_ARG (call);
ACE_UNUSED_ARG (reshandle);
ACE_UNUSED_ARG (handle);
+
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_TLI */
}
+
ACE_INLINE char *
t_alloc (ACE_HANDLE handle, int struct_type, int fields)
{
@@ -34,9 +40,11 @@ t_alloc (ACE_HANDLE handle, int struct_type, int fields)
ACE_UNUSED_ARG (fields);
ACE_UNUSED_ARG (struct_type);
ACE_UNUSED_ARG (handle);
+
ACE_NOTSUP_RETURN (0);
#endif /* ACE_HAS_TLI */
}
+
ACE_INLINE int
t_bind (ACE_HANDLE handle, ACE_TBIND *req, ACE_TBIND *ret)
{
@@ -46,9 +54,11 @@ t_bind (ACE_HANDLE handle, ACE_TBIND *req, ACE_TBIND *ret)
ACE_UNUSED_ARG (ret);
ACE_UNUSED_ARG (req);
ACE_UNUSED_ARG (handle);
+
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_TLI */
}
+
ACE_INLINE int
t_close (ACE_HANDLE handle)
{
@@ -56,9 +66,11 @@ t_close (ACE_HANDLE handle)
ACE_OSCALL_RETURN (::t_close (handle), int, -1);
#else
ACE_UNUSED_ARG (handle);
+
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_TLI */
}
+
ACE_INLINE int
t_connect(ACE_HANDLE fildes,
struct t_call *sndcall,
@@ -70,9 +82,11 @@ t_connect(ACE_HANDLE fildes,
ACE_UNUSED_ARG (fildes);
ACE_UNUSED_ARG (sndcall);
ACE_UNUSED_ARG (rcvcall);
+
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_TLI */
}
+
ACE_INLINE void
t_error (const char *errmsg)
{
@@ -86,6 +100,7 @@ t_error (const char *errmsg)
ACE_UNUSED_ARG (errmsg);
#endif /* ACE_HAS_TLI */
}
+
ACE_INLINE int
t_free (char *ptr, int struct_type)
{
@@ -96,9 +111,11 @@ t_free (char *ptr, int struct_type)
#else
ACE_UNUSED_ARG (struct_type);
ACE_UNUSED_ARG (ptr);
+
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_TLI */
}
+
ACE_INLINE int
t_getinfo (ACE_HANDLE handle, struct t_info *info)
{
@@ -107,9 +124,11 @@ t_getinfo (ACE_HANDLE handle, struct t_info *info)
#else
ACE_UNUSED_ARG (info);
ACE_UNUSED_ARG (handle);
+
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_TLI */
}
+
ACE_INLINE int
t_getname (ACE_HANDLE handle, struct netbuf *namep, int type)
{
@@ -148,15 +167,18 @@ t_getname (ACE_HANDLE handle, struct netbuf *namep, int type)
else
namep->len = peer.addr.len;
return 0;
+
#elif defined (ACE_HAS_SVR4_TLI)
ACE_OSCALL_RETURN (::t_getname (handle, namep, type), int, -1);
#else
ACE_UNUSED_ARG (handle);
ACE_UNUSED_ARG (namep);
ACE_UNUSED_ARG (type);
+
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_SVR4_TLI */
}
+
ACE_INLINE int
t_getstate (ACE_HANDLE handle)
{
@@ -164,9 +186,11 @@ t_getstate (ACE_HANDLE handle)
ACE_OSCALL_RETURN (::t_getstate (handle), int, -1);
#else
ACE_UNUSED_ARG (handle);
+
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_TLI */
}
+
ACE_INLINE int
t_listen (ACE_HANDLE handle, struct t_call *call)
{
@@ -175,9 +199,11 @@ t_listen (ACE_HANDLE handle, struct t_call *call)
#else
ACE_UNUSED_ARG (handle);
ACE_UNUSED_ARG (call);
+
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_TLI */
}
+
ACE_INLINE int
t_look (ACE_HANDLE handle)
{
@@ -185,9 +211,11 @@ t_look (ACE_HANDLE handle)
ACE_OSCALL_RETURN (::t_look (handle), int, -1);
#else
ACE_UNUSED_ARG (handle);
+
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_TLI */
}
+
ACE_INLINE ACE_HANDLE
t_open (char *path, int oflag, struct t_info *info)
{
@@ -197,9 +225,11 @@ t_open (char *path, int oflag, struct t_info *info)
ACE_UNUSED_ARG (path);
ACE_UNUSED_ARG (oflag);
ACE_UNUSED_ARG (info);
+
ACE_NOTSUP_RETURN (ACE_INVALID_HANDLE);
#endif /* ACE_HAS_TLI */
}
+
ACE_INLINE int
t_optmgmt (ACE_HANDLE handle, ACE_TOPTMGMT *req, ACE_TOPTMGMT *ret)
{
@@ -209,9 +239,11 @@ t_optmgmt (ACE_HANDLE handle, ACE_TOPTMGMT *req, ACE_TOPTMGMT *ret)
ACE_UNUSED_ARG (handle);
ACE_UNUSED_ARG (req);
ACE_UNUSED_ARG (ret);
+
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_TLI */
}
+
ACE_INLINE int
t_rcv (ACE_HANDLE handle,
char *buf,
@@ -226,9 +258,11 @@ t_rcv (ACE_HANDLE handle,
ACE_UNUSED_ARG (buf);
ACE_UNUSED_ARG (nbytes);
ACE_UNUSED_ARG (flags);
+
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_TLI */
}
+
ACE_INLINE int
t_rcvdis (ACE_HANDLE handle, struct t_discon *discon)
{
@@ -237,9 +271,11 @@ t_rcvdis (ACE_HANDLE handle, struct t_discon *discon)
#else
ACE_UNUSED_ARG (handle);
ACE_UNUSED_ARG (discon);
+
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_TLI */
}
+
ACE_INLINE int
t_rcvrel (ACE_HANDLE handle)
{
@@ -247,9 +283,11 @@ t_rcvrel (ACE_HANDLE handle)
ACE_OSCALL_RETURN (::t_rcvrel (handle), int, -1);
#else
ACE_UNUSED_ARG (handle);
+
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_TLI */
}
+
ACE_INLINE int
t_rcvudata (ACE_HANDLE handle,
struct t_unitdata *unitdata,
@@ -262,9 +300,11 @@ t_rcvudata (ACE_HANDLE handle,
ACE_UNUSED_ARG (handle);
ACE_UNUSED_ARG (unitdata);
ACE_UNUSED_ARG (flags);
+
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_TLI */
}
+
ACE_INLINE int
t_rcvuderr (ACE_HANDLE handle, struct t_uderr *uderr)
{
@@ -273,9 +313,11 @@ t_rcvuderr (ACE_HANDLE handle, struct t_uderr *uderr)
#else
ACE_UNUSED_ARG (handle);
ACE_UNUSED_ARG (uderr);
+
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_TLI */
}
+
ACE_INLINE int
t_snd (ACE_HANDLE handle,
const char *buf,
@@ -289,9 +331,11 @@ t_snd (ACE_HANDLE handle,
ACE_UNUSED_ARG (buf);
ACE_UNUSED_ARG (nbytes);
ACE_UNUSED_ARG (flags);
+
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_TLI */
}
+
ACE_INLINE int
t_snddis (ACE_HANDLE handle, struct t_call *call)
{
@@ -300,9 +344,11 @@ t_snddis (ACE_HANDLE handle, struct t_call *call)
#else
ACE_UNUSED_ARG (handle);
ACE_UNUSED_ARG (call);
+
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_TLI */
}
+
ACE_INLINE int
t_sndrel (ACE_HANDLE handle)
{
@@ -310,9 +356,11 @@ t_sndrel (ACE_HANDLE handle)
ACE_OSCALL_RETURN (::t_sndrel (handle), int, -1);
#else
ACE_UNUSED_ARG (handle);
+
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_TLI */
}
+
ACE_INLINE int
t_sync (ACE_HANDLE handle)
{
@@ -320,9 +368,11 @@ t_sync (ACE_HANDLE handle)
ACE_OSCALL_RETURN (::t_sync (handle), int, -1);
#else
ACE_UNUSED_ARG (handle);
+
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_TLI */
}
+
ACE_INLINE int
t_unbind (ACE_HANDLE handle)
{
@@ -330,8 +380,11 @@ t_unbind (ACE_HANDLE handle)
ACE_OSCALL_RETURN (::t_unbind (handle), int, -1);
#else
ACE_UNUSED_ARG (handle);
+
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_TLI */
}
+
} /* end namespace ACE_OS */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_Thread_Adapter.cpp b/dep/ACE_wrappers/ace/OS_Thread_Adapter.cpp
index ede22efe1a5..7fa4d1a4896 100644
--- a/dep/ACE_wrappers/ace/OS_Thread_Adapter.cpp
+++ b/dep/ACE_wrappers/ace/OS_Thread_Adapter.cpp
@@ -1,13 +1,18 @@
// $Id: OS_Thread_Adapter.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_Thread_Adapter.h"
+
ACE_RCSID (ace,
OS_Thread_Adapter,
"$Id: OS_Thread_Adapter.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#include "ace/Thread_Hook.h"
#include "ace/Object_Manager_Base.h"
#include "ace/Global_Macros.h"
#include "ace/OS_NS_Thread.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_OS_Thread_Adapter::ACE_OS_Thread_Adapter (
ACE_THR_FUNC user_func
, void *arg
@@ -26,22 +31,27 @@ ACE_OS_Thread_Adapter::ACE_OS_Thread_Adapter (
)
{
}
+
ACE_OS_Thread_Adapter::~ACE_OS_Thread_Adapter (void)
{
}
+
ACE_THR_FUNC_RETURN
ACE_OS_Thread_Adapter::invoke (void)
{
// Inherit the logging features if the parent thread has an
// ACE_Log_Msg instance in thread-specific storage.
this->inherit_log_msg ();
+
// Extract the arguments.
ACE_THR_FUNC_INTERNAL func =
reinterpret_cast<ACE_THR_FUNC_INTERNAL> (this->user_func_);
void *arg = this->arg_;
+
// Delete ourselves since we don't need <this> anymore. Make sure
// not to access <this> anywhere below this point.
delete this;
+
#if defined (ACE_NEEDS_LWP_PRIO_SET)
// On SunOS, the LWP priority needs to be set in order to get
// preemption when running in the RT class. This is the ACE way to
@@ -49,19 +59,25 @@ ACE_OS_Thread_Adapter::invoke (void)
ACE_hthread_t thr_handle;
ACE_OS::thr_self (thr_handle);
int prio;
+
// thr_getprio () on the current thread should never fail.
ACE_OS::thr_getprio (thr_handle, prio);
+
// ACE_OS::thr_setprio () has the special logic to set the LWP priority,
// if running in the RT class.
ACE_OS::thr_setprio (prio);
+
#endif /* ACE_NEEDS_LWP_PRIO_SET */
+
ACE_THR_FUNC_RETURN status = 0;
+
ACE_SEH_TRY
{
ACE_SEH_TRY
{
ACE_Thread_Hook *hook =
ACE_OS_Object_Manager::thread_hook ();
+
if (hook)
// Invoke the start hook to give the user a chance to
// perform some initialization processing before the
@@ -74,6 +90,7 @@ ACE_OS_Thread_Adapter::invoke (void)
status = (*func) (arg);
}
}
+
#if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS)
ACE_SEH_EXCEPT (ACE_OS_Object_Manager::seh_except_selector ()(
(void *) GetExceptionInformation ()))
@@ -82,6 +99,7 @@ ACE_OS_Thread_Adapter::invoke (void)
}
#endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */
}
+
ACE_SEH_FINALLY
{
// If we changed this to 1, change the respective if in
@@ -92,16 +110,20 @@ ACE_OS_Thread_Adapter::invoke (void)
{
ACE_Task_Base *task_ptr = (ACE_Task_Base *) arg;
ACE_Thread_Manager *thr_mgr_ptr = task_ptr->thr_mgr ();
+
// This calls the Task->close () hook.
task_ptr->cleanup (task_ptr, 0);
+
// This prevents a second invocation of the cleanup code
// (called later by <ACE_Thread_Manager::exit>.
thr_mgr_ptr->at_exit (task_ptr, 0, 0);
}
#endif /* 0 */
+
#if defined (ACE_WIN32) || defined (ACE_HAS_TSS_EMULATION)
// Call TSS destructors.
ACE_OS::cleanup_tss (0 /* not main thread */);
+
# if defined (ACE_WIN32)
// Exit the thread. Allow CWinThread-destructor to be invoked
// from AfxEndThread. _endthreadex will be called from
@@ -113,6 +135,7 @@ ACE_OS_Thread_Adapter::invoke (void)
// ACE_Thread_Manager to spawn threads. The following code
// is know to cause some problem.
CWinThread *pThread = ::AfxGetThread ();
+
if (!pThread || pThread->m_nThreadID != ACE_OS::thr_self ())
ACE_ENDTHREADEX (status);
else
@@ -123,7 +146,9 @@ ACE_OS_Thread_Adapter::invoke (void)
# endif /* ACE_WIN32 */
#endif /* ACE_WIN32 || ACE_HAS_TSS_EMULATION */
}
+
return status;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/OS_Thread_Adapter.h b/dep/ACE_wrappers/ace/OS_Thread_Adapter.h
index 6415570764f..d51bc772168 100644
--- a/dep/ACE_wrappers/ace/OS_Thread_Adapter.h
+++ b/dep/ACE_wrappers/ace/OS_Thread_Adapter.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file OS_Thread_Adapter.h
@@ -8,15 +9,21 @@
* @author Carlos O'Ryan <coryan@uci.edu>
*/
//=============================================================================
+
#ifndef ACE_OS_THREAD_ADAPTER_H
#define ACE_OS_THREAD_ADAPTER_H
#include /**/ "ace/pre.h"
+
#include "ace/Base_Thread_Adapter.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include /**/ "ace/ACE_export.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_OS_Thread_Adapter
*
@@ -44,17 +51,23 @@ public:
, ACE_SEH_EXCEPT_HANDLER handler = 0
# endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */
);
+
/**
* Execute the @a user_func_ with the @a arg. This function deletes
* @c this, thereby rendering the object useless after the call
* returns.
*/
virtual ACE_THR_FUNC_RETURN invoke (void);
+
protected:
+
/// Ensure that this object is allocated on the heap.
~ACE_OS_Thread_Adapter (void);
+
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
#endif /* ACE_THREAD_ADAPTER_H */
diff --git a/dep/ACE_wrappers/ace/OS_main.cpp b/dep/ACE_wrappers/ace/OS_main.cpp
index 43f78ef887e..18bcae32d50 100644
--- a/dep/ACE_wrappers/ace/OS_main.cpp
+++ b/dep/ACE_wrappers/ace/OS_main.cpp
@@ -1,12 +1,19 @@
// $Id: OS_main.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_main.h"
+
ACE_RCSID(ace, OS_main, "$Id: OS_main.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if defined (ACE_HAS_NONSTATIC_OBJECT_MANAGER) && !defined (ACE_DOESNT_INSTANTIATE_NONSTATIC_OBJECT_MANAGER)
+
#include "ace/Init_ACE.h"
+
# if !defined (ACE_HAS_MINIMAL_ACE_OS)
# include "ace/Object_Manager.h"
# endif /* ! ACE_HAS_MINIMAL_ACE_OS */
+
// Rename "main ()" on platforms that don't allow it to be called "main ()".
+
// Also, create ACE_Object_Manager static instance(s) in "main ()".
// ACE_MAIN_OBJECT_MANAGER defines the ACE_Object_Manager(s) that will
// be instantiated on the stack of main (). Note that it is only used
@@ -17,14 +24,19 @@ ACE_RCSID(ace, OS_main, "$Id: OS_main.cpp 80826 2008-03-04 14:51:23Z wotte $")
ACE_OS_Object_Manager ace_os_object_manager; \
ACE_Object_Manager ace_object_manager;
# endif /* ! ACE_MAIN_OBJECT_MANAGER */
+
# if !defined (ACE_WIN32)
+
# if !(defined (ACE_VXWORKS) && !defined (__RTP__))
/* forward declaration */
extern int ace_main_i (int, char *[]);
# endif
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
# if defined (ACE_VXWORKS) && !defined (__RTP__)
ace_main_proc_ptr vx_ace_main_i_ptr = 0;
+
int ace_os_main_i (int argc, char *argv[]) /* user's entry point, e.g., main */
{
ACE_MAIN_OBJECT_MANAGER
@@ -37,14 +49,19 @@ int ace_os_main_i (int argc, char *argv[]) /* user's entry point, e.g., main */
return ace_main_i (argc, argv); /* what the user calls "main" */
}
# endif
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# elif !defined (ACE_HAS_WINCE)
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
# if defined (ACE_WIN32) && defined (ACE_USES_WCHAR)
int ACE_Main_Base::run (int argc, ACE_TCHAR *argv[])
{
return this->run_i (argc, argv);
}
+
ACE_Export int
ace_os_wmain_i (ACE_Main_Base &mbase, int argc, ACE_TCHAR *argv[]) /* user's entry point, e.g., main */
{
@@ -52,18 +69,22 @@ ace_os_wmain_i (ACE_Main_Base &mbase, int argc, ACE_TCHAR *argv[]) /* user's ent
return mbase.run (argc, argv); /* what the user calls "main" */
}
# else /* ! (ACE_WIN32 && ACE_USES_WCHAR) */
+
ACE_Main_Base::ACE_Main_Base ()
{
ACE::init ();
}
+
ACE_Main_Base::~ACE_Main_Base ()
{
ACE::fini ();
}
+
int ACE_Main_Base::run (int argc, char *argv[])
{
return this->run_i (argc, argv);
}
+
ACE_Export int
ace_os_main_i (ACE_Main_Base &mbase, int argc, char *argv[]) /* user's entry point, e.g., main */
{
@@ -71,14 +92,19 @@ ace_os_main_i (ACE_Main_Base &mbase, int argc, char *argv[]) /* user's entry poi
return mbase.run (argc, argv); /* what the user calls "main" */
}
# endif /* ACE_WIN32 && ACE_USES_WCHAR */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# else /* ACE_HAS_WINCE */
+
// CE only gets a command line string; no argv. So we need to convert it
// when the main entrypoint expects argc/argv. ACE_ARGV supports this.
# include "ace/OS_NS_string.h"
# include "ace/ACE.h"
# include "ace/ARGV.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
int ACE_Main_Base::run (HINSTANCE,
HINSTANCE,
LPWSTR lpCmdLine,
@@ -95,6 +121,8 @@ int ACE_Main_Base::run (HINSTANCE,
return i;
}
ACE_END_VERSIONED_NAMESPACE_DECL
+
# endif /* !ACE_HAS_WINCE */
+
# endif /* ACE_HAS_NONSTATIC_OBJECT_MANAGER && !ACE_HAS_WINCE && !ACE_DOESNT_INSTANTIATE_NONSTATIC_OBJECT_MANAGER */
diff --git a/dep/ACE_wrappers/ace/OS_main.h b/dep/ACE_wrappers/ace/OS_main.h
index e75ce876afc..502aa5da67e 100644
--- a/dep/ACE_wrappers/ace/OS_main.h
+++ b/dep/ACE_wrappers/ace/OS_main.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file OS_main.h
@@ -12,25 +13,34 @@
* Originally in OS.h.
*/
//=============================================================================
+
#include /**/ "ace/ACE_export.h"
+
#ifndef ACE_OS_MAIN_H
# define ACE_OS_MAIN_H
+
# include /**/ "ace/pre.h"
+
# if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
# endif /* ACE_LACKS_PRAGMA_ONCE */
+
# if defined (ACE_HAS_RTEMS)
extern char* rtems_progname;
# endif /* ACE_HAS_RTEMS */
+
#if defined (ACE_VXWORKS) && (ACE_VXWORKS <= 0x640) && defined (__RTP__)
# include <resolvLib.h>
#endif
+
# if !defined (ACE_MAIN)
# define ACE_MAIN main
# endif /* ! ACE_MAIN */
+
# if !defined (ACE_WMAIN)
# define ACE_WMAIN wmain
# endif /* ! ACE_WMAIN */
+
# if defined (ACE_WIN32) && defined (ACE_USES_WCHAR)
# define ACE_TMAIN wmain
# else
@@ -49,23 +59,31 @@ extern char* rtems_progname;
# define ACE_TMAIN main
# endif /* ACE_USES_WCHAR */
# endif
+
# if defined (ACE_DOESNT_INSTANTIATE_NONSTATIC_OBJECT_MANAGER)
# if !defined (ACE_HAS_NONSTATIC_OBJECT_MANAGER)
# define ACE_HAS_NONSTATIC_OBJECT_MANAGER
# endif /* ACE_HAS_NONSTATIC_OBJECT_MANAGER */
# endif /* ACE_DOESNT_INSTANTIATE_NONSTATIC_OBJECT_MANAGER */
+
# if defined (ACE_HAS_NONSTATIC_OBJECT_MANAGER) \
&& !defined (ACE_DOESNT_INSTANTIATE_NONSTATIC_OBJECT_MANAGER)
+
// Rename "main ()" on platforms that don't allow it to be called "main ()".
+
# if defined (ACE_VXWORKS) && !defined (__RTP__)
+
typedef int (*ace_main_proc_ptr)(int, char *[]);
+
extern ace_main_proc_ptr vx_ace_main_i_ptr;
+
// Declare ACE_MAIN as extern C so that it can be retrieved
// using symFindByName
extern "C"
{
int ACE_MAIN (int, char* []);
}
+
# define main \
ACE_MAIN (int, char *[]); /* forward decl to gobble up the 'int' if there is one */ \
ACE_BEGIN_VERSIONED_NAMESPACE_DECL \
@@ -80,7 +98,9 @@ ACE_MAIN (int argc, char *argv[]) /* user's entry point, e.g., main */ \
} \
int \
ace_main_i
+
# elif defined (ACE_HAS_RTEMS)
+
# define main \
ACE_MAIN (int, char *[]); /* forward decl to gobble up the 'int' if there is one */ \
ACE_BEGIN_VERSIONED_NAMESPACE_DECL \
@@ -97,7 +117,9 @@ ACE_MAIN (int argc, char *argv[]) /* user's entry point, e.g., main */ \
} \
int \
ace_main_i
+
# elif defined (ACE_VXWORKS) && (ACE_VXWORKS <= 0x640) && defined (__RTP__)
+
# define main \
ACE_MAIN (int, char *[]); /* forward decl to gobble up the 'int' if there is one */ \
ACE_BEGIN_VERSIONED_NAMESPACE_DECL \
@@ -111,7 +133,9 @@ ACE_MAIN (int argc, char *argv[]) /* user's entry point, e.g., main */ \
} \
int \
ace_main_i
+
# elif !defined (ACE_WIN32)
+
# define main \
ACE_MAIN (int, char *[]); /* forward decl to gobble up the 'int' if there is one */ \
ACE_BEGIN_VERSIONED_NAMESPACE_DECL \
@@ -124,16 +148,22 @@ ACE_MAIN (int argc, char *argv[]) /* user's entry point, e.g., main */ \
} \
int \
ace_main_i
+
# elif !defined (ACE_HAS_WINCE)
+
# if defined (ACE_WIN32) && defined (ACE_USES_WCHAR)
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Export ACE_Main_Base
{
public:
int run (int, ACE_TCHAR *[]);
virtual int run_i (int, ACE_TCHAR *[]) = 0;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# define wmain \
ace_wmain_i (int, ACE_TCHAR *[]); \
ACE_BEGIN_VERSIONED_NAMESPACE_DECL \
@@ -152,8 +182,11 @@ ACE_WMAIN (int argc, ACE_TCHAR *argv[]) /* user's entry point, e.g., wmain */ \
} \
int \
ace_wmain_i
+
# else /* ! (ACE_WIN32 && ACE_USES_WCHAR) */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Export ACE_Main_Base
{
public:
@@ -162,7 +195,9 @@ public:
int run (int, char *[]);
virtual int run_i (int, char *[]) = 0;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
/*
** LabVIEW RT cannot directly use an executable. Need to build the program
** as a DLL and call it from something else. The ACE test framework knows this
@@ -172,6 +207,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# if defined (ACE_BUILD_LABVIEW_EXE_AS_DLL)
extern "C" __declspec (dllexport) int main (int, char *[]);
# endif /* ACE_BUILD_LABVIEW_EXE_AS_DLL) */
+
# define main \
ace_main_i (int, char *[]); \
ACE_BEGIN_VERSIONED_NAMESPACE_DECL \
@@ -190,21 +226,29 @@ ACE_MAIN (int argc, char *argv[]) /* user's entry point, e.g., wmain */ \
} \
int \
ace_main_i
+
# endif /* ACE_WIN32 && ACE_USES_WCHAR */
+
# else /* ACE_HAS_WINCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Export ACE_Main_Base
{
public:
int run (HINSTANCE, HINSTANCE, LPWSTR, int);
virtual int run_i (int, ACE_TCHAR *[]) = 0;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# if defined (ACE_TMAIN) // Use WinMain on CE; others give warning/error.
# undef ACE_TMAIN
# endif // ACE_TMAIN
+
// Support for ACE_TMAIN, which is a recommended way. It would be nice if
// CE had CommandLineToArgvW()... but it's only on NT3.5 and up.
+
# define ACE_TMAIN \
ace_tmain_i (int, ACE_TCHAR *[]); \
class ACE_Main : public ACE_Main_Base {int run_i (int argc, ACE_TCHAR *argv[]);}; \
@@ -218,6 +262,7 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLi
return m.run (hInstance, hPrevInstance, lpCmdLine, nCmdShow); \
} \
int ace_tmain_i
+
// Support for wchar_t but still can't fit to CE because of the command
// line parameters.
# define wmain \
@@ -233,6 +278,7 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLi
return ace_os_winwmain_i (hInstance, hPrevInstance, lpCmdLine, nCmdShow); \
} \
int ace_wmain_i
+
// Supporting legacy 'main' is A LOT easier for users than changing existing
// code on WinCE. Unfortunately, evc 3 can't grok a #include within the macro
// expansion, so it needs to go out here.
@@ -250,8 +296,11 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLi
return ace_os_winmain_i (hInstance, hPrevInstance, lpCmdLine, nCmdShow); \
} \
int ace_main_i
+
# endif /* ACE_PSOSIM */
# endif /* ACE_HAS_NONSTATIC_OBJECT_MANAGER && !ACE_HAS_WINCE && !ACE_DOESNT_INSTANTIATE_NONSTATIC_OBJECT_MANAGER */
+
# include /**/ "ace/post.h"
+
#endif /* ACE_OS_MAIN_H */
diff --git a/dep/ACE_wrappers/ace/Obchunk.cpp b/dep/ACE_wrappers/ace/Obchunk.cpp
index cd412e5d008..71a69d1a3e7 100644
--- a/dep/ACE_wrappers/ace/Obchunk.cpp
+++ b/dep/ACE_wrappers/ace/Obchunk.cpp
@@ -1,22 +1,30 @@
// $Id: Obchunk.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Obchunk.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Obchunk.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace, Obchunk, "$Id: Obchunk.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_Obchunk)
+
void
ACE_Obchunk::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_Obchunk::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("end_ = %x\n"), this->end_));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("cur_ = %x\n"), this->cur_));
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
ACE_Obchunk::ACE_Obchunk (size_t size)
: end_ (contents_ + size),
block_ (contents_),
@@ -24,5 +32,6 @@ ACE_Obchunk::ACE_Obchunk (size_t size)
next_ (0)
{
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Obchunk.h b/dep/ACE_wrappers/ace/Obchunk.h
index 2ca439c6392..1cb7c24b76c 100644
--- a/dep/ACE_wrappers/ace/Obchunk.h
+++ b/dep/ACE_wrappers/ace/Obchunk.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Obchunk.h
@@ -9,14 +10,19 @@
*/
//=============================================================================
+
#ifndef ACE_OBCHUNK_H
#define ACE_OBCHUNK_H
#include /**/ "ace/pre.h"
+
#include "ace/Malloc.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Obchunk
*
@@ -31,20 +37,28 @@ class ACE_Export ACE_Obchunk
public:
/// Constructor.
ACE_Obchunk (size_t size);
+
/// Dtor.
~ACE_Obchunk (void);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
/// Pointer to the end of the chunk.
char *end_;
+
/// Pointer to the head of the current building block.
char *block_;
+
/// Pointer to the current location in the chunk.
char *cur_;
+
/// Next chunk in the chain.
ACE_Obchunk *next_;
+
/**
* Pointer to the beginning contents of this chunk. This field is
* actually overlayed by the memory allocated by
@@ -52,10 +66,13 @@ public:
*/
char contents_[4];
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Obchunk.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_OBCHUNK_H */
diff --git a/dep/ACE_wrappers/ace/Obchunk.inl b/dep/ACE_wrappers/ace/Obchunk.inl
index 27e2a945ac8..b2c71684904 100644
--- a/dep/ACE_wrappers/ace/Obchunk.inl
+++ b/dep/ACE_wrappers/ace/Obchunk.inl
@@ -1,9 +1,12 @@
// -*- C++ -*-
//
// $Id: Obchunk.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_Obchunk::~ACE_Obchunk (void)
{
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Object_Manager.cpp b/dep/ACE_wrappers/ace/Object_Manager.cpp
index e3b5cb81dd3..bd97cc9ecaf 100644
--- a/dep/ACE_wrappers/ace/Object_Manager.cpp
+++ b/dep/ACE_wrappers/ace/Object_Manager.cpp
@@ -1,4 +1,5 @@
// $Id: Object_Manager.cpp 81450 2008-04-25 21:24:33Z mitza $
+
#include "ace/Object_Manager.h"
#if !defined (ACE_LACKS_ACE_TOKEN)
# include "ace/Token_Manager.h"
@@ -16,36 +17,49 @@
#include "ace/DLL_Manager.h"
#include "ace/Atomic_Op.h"
#include "ace/OS_NS_sys_time.h"
+
#if defined (ACE_HAS_TRACE)
#include "ace/Trace.h"
#endif /* ACE_HAS_TRACE */
+
#if !defined (__ACE_INLINE__)
# include "ace/Object_Manager.inl"
#endif /* __ACE_INLINE__ */
+
#include "ace/Guard_T.h"
#include "ace/Null_Mutex.h"
#include "ace/Mutex.h"
#include "ace/RW_Thread_Mutex.h"
+
ACE_RCSID(ace, Object_Manager, "$Id: Object_Manager.cpp 81450 2008-04-25 21:24:33Z mitza $")
+
#if ! defined (ACE_APPLICATION_PREALLOCATED_OBJECT_DEFINITIONS)
# define ACE_APPLICATION_PREALLOCATED_OBJECT_DEFINITIONS
#endif /* ACE_APPLICATION_PREALLOCATED_OBJECT_DEFINITIONS */
+
#if ! defined (ACE_APPLICATION_PREALLOCATED_ARRAY_DEFINITIONS)
# define ACE_APPLICATION_PREALLOCATED_ARRAY_DEFINITIONS
#endif /* ACE_APPLICATION_PREALLOCATED_ARRAY_DEFINITIONS */
+
#if ! defined (ACE_APPLICATION_PREALLOCATED_OBJECT_DELETIONS)
# define ACE_APPLICATION_PREALLOCATED_OBJECT_DELETIONS
#endif /* ACE_APPLICATION_PREALLOCATED_OBJECT_DELETIONS */
+
#if ! defined (ACE_APPLICATION_PREALLOCATED_ARRAY_DELETIONS)
# define ACE_APPLICATION_PREALLOCATED_ARRAY_DELETIONS
#endif /* ACE_APPLICATION_PREALLOCATED_ARRAY_DELETIONS */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Singleton pointer.
ACE_Object_Manager *ACE_Object_Manager::instance_ = 0;
+
void *ACE_Object_Manager::preallocated_object[
ACE_Object_Manager::ACE_PREALLOCATED_OBJECTS] = { 0 };
+
void *ACE_Object_Manager::preallocated_array[
ACE_Object_Manager::ACE_PREALLOCATED_ARRAYS] = { 0 };
+
// Handy macros for use by ACE_Object_Manager constructor to
// preallocate or delete an object or array, either statically (in
// global data) or dynamically (on the heap).
@@ -81,7 +95,9 @@ void *ACE_Object_Manager::preallocated_array[
delete (ACE_Cleanup_Adapter<TYPE[COUNT]> *) preallocated_array[ID];\
preallocated_array[ID] = 0;
#endif /* ACE_HAS_STATIC_PREALLOCATION */
+
#if !defined (ACE_LACKS_ACE_SVCCONF)
+
/**
* @class ACE_Object_Manager_Preallocations
*
@@ -93,9 +109,11 @@ class ACE_Object_Manager_Preallocations
public:
ACE_Object_Manager_Preallocations (void);
~ACE_Object_Manager_Preallocations (void);
+
private:
ACE_Static_Svc_Descriptor ace_svc_desc_ACE_Service_Manager;
};
+
ACE_Object_Manager_Preallocations::ACE_Object_Manager_Preallocations (void)
{
ACE_STATIC_SVC_DEFINE (ACE_Service_Manager_initializer,
@@ -105,40 +123,50 @@ ACE_Object_Manager_Preallocations::ACE_Object_Manager_Preallocations (void)
ACE_Service_Type::DELETE_THIS |
ACE_Service_Type::DELETE_OBJ,
0)
+
// Initialize the static service objects using the descriptors created
// above.
ace_svc_desc_ACE_Service_Manager =
ace_svc_desc_ACE_Service_Manager_initializer;
+
// Add to the list of static configured services.
ACE_Service_Config::static_svcs ()->
insert (&ace_svc_desc_ACE_Service_Manager);
}
+
ACE_Object_Manager_Preallocations::~ACE_Object_Manager_Preallocations (void)
{
}
+
#endif /* ! ACE_LACKS_ACE_SVCCONF */
+
int
ACE_Object_Manager::starting_up (void)
{
return ACE_Object_Manager::instance_ ? instance_->starting_up_i () : 1;
}
+
int
ACE_Object_Manager::shutting_down (void)
{
return ACE_Object_Manager::instance_ ? instance_->shutting_down_i () : 1;
}
+
#if defined (ACE_DISABLE_WIN32_ERROR_WINDOWS)
// Instead of popping up a window for exceptions, just print something out
LONG _stdcall ACE_UnhandledExceptionFilter (PEXCEPTION_POINTERS pExceptionInfo)
{
DWORD dwExceptionCode = pExceptionInfo->ExceptionRecord->ExceptionCode;
+
if (dwExceptionCode == EXCEPTION_ACCESS_VIOLATION)
ACE_ERROR ((LM_ERROR, ACE_TEXT ("\nERROR: ACCESS VIOLATION\n")));
else
ACE_ERROR ((LM_ERROR, ACE_TEXT ("\nERROR: UNHANDLED EXCEPTION\n")));
+
return EXCEPTION_EXECUTE_HANDLER;
}
#endif /* ACE_DISABLE_WIN32_ERROR_WINDOWS */
+
// Initialize an ACE_Object_Manager. There can be instances of this object
// other than The Instance. This can happen if a user creates one for some
// reason. All objects set up their per-object information and managed
@@ -152,6 +180,7 @@ ACE_Object_Manager::init (void)
// First, indicate that the ACE_Object_Manager instance is being
// initialized.
object_manager_state_ = OBJ_MAN_INITIALIZING;
+
// Only The Instance sets up with ACE_OS_Object_Manager and initializes
// the preallocated objects.
if (this == instance_)
@@ -159,16 +188,19 @@ ACE_Object_Manager::init (void)
// Make sure that the ACE_OS_Object_Manager has been created,
// and register with it for chained fini ().
ACE_OS_Object_Manager::instance ()->next_ = this;
+
# if defined (ACE_HAS_BUILTIN_ATOMIC_OP)
ACE_Atomic_Op<ACE_Thread_Mutex, long>::init_functions ();
ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::init_functions ();
# endif /* ACE_HAS_BUILTIN_ATOMIC_OP */
+
# if !defined (ACE_LACKS_ACE_SVCCONF)
// Construct the ACE_Service_Config's signal handler.
ACE_NEW_RETURN (ace_service_config_sig_handler_,
ACE_Sig_Adapter (&ACE_Service_Config::handle_signal), -1);
ACE_Service_Config::signal_handler (ace_service_config_sig_handler_);
# endif /* ! ACE_LACKS_ACE_SVCCONF */
+
// Allocate the preallocated (hard-coded) object instances.
ACE_PREALLOCATE_OBJECT (ACE_SYNCH_RW_MUTEX, ACE_FILECACHE_LOCK)
# if defined (ACE_HAS_THREADS)
@@ -195,11 +227,13 @@ ACE_Object_Manager::init (void)
ACE_PROACTOR_EVENT_LOOP_LOCK)
# endif /* ACE_MT_SAFE */
}
+
if (this == instance_)
{
// Hooks for preallocated objects and arrays provided by application.
ACE_APPLICATION_PREALLOCATED_OBJECT_DEFINITIONS
ACE_APPLICATION_PREALLOCATED_ARRAY_DEFINITIONS
+
# if defined (ACE_HAS_TSS_EMULATION)
// Initialize the main thread's TS storage.
if (!ts_storage_initialized_)
@@ -208,6 +242,7 @@ ACE_Object_Manager::init (void)
ts_storage_initialized_ = true;
}
# endif /* ACE_HAS_TSS_EMULATION */
+
#if defined (ACE_DISABLE_WIN32_ERROR_WINDOWS) && \
defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)
#if defined (_DEBUG) && (defined (_MSC_VER) || defined (__INTEL_COMPILER))
@@ -216,53 +251,66 @@ ACE_Object_Manager::init (void)
_CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE );
_CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDERR );
#endif /* _DEBUG && _MSC_VER || __INTEL_COMPILER */
+
// The system does not display the critical-error-handler message box
SetErrorMode(SEM_FAILCRITICALERRORS);
+
// And this will catch all unhandled exceptions.
SetUnhandledExceptionFilter (&ACE_UnhandledExceptionFilter);
#endif /* ACE_DISABLE_WIN32_ERROR_WINDOWS && ACE_WIN32 && !ACE_HAS_WINCE */
+
# if !defined (ACE_LACKS_ACE_SVCCONF)
ACE_NEW_RETURN (preallocations_,
ACE_Object_Manager_Preallocations,
-1);
# endif /* ! ACE_LACKS_ACE_SVCCONF */
+
// Open the main thread's ACE_Log_Msg.
if (0 == ACE_LOG_MSG)
return -1;
}
+
// Finally, indicate that the ACE_Object_Manager instance has
// been initialized.
object_manager_state_ = OBJ_MAN_INITIALIZED;
+
#if defined (ACE_HAS_TRACE)
// Allow tracing again (useful if user does init/fini/init)
ACE_Trace::start_tracing ();
#endif /* ACE_HAS_TRACE */
+
return 0;
} else {
// Had already initialized.
return 1;
}
}
+
#if defined (ACE_HAS_TSS_EMULATION)
int
ACE_Object_Manager::init_tss (void)
{
return ACE_Object_Manager::instance ()->init_tss_i ();
}
+
int
ACE_Object_Manager::init_tss_i (void)
{
ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon,
*instance_->internal_lock_, -1));
+
if (!ts_storage_initialized_)
{
ACE_TSS_Emulation::tss_open (ts_storage_);
ts_storage_initialized_ = true;
}
+
return 0;
}
+
#endif
+
ACE_Object_Manager::ACE_Object_Manager (void)
// With ACE_HAS_TSS_EMULATION, ts_storage_ is initialized by the call to
// ACE_OS::tss_open () in the function body.
@@ -282,6 +330,7 @@ ACE_Object_Manager::ACE_Object_Manager (void)
#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
ACE_NEW (internal_lock_, ACE_Recursive_Thread_Mutex);
# endif /* ACE_MT_SAFE */
+
// If instance_ was not 0, then another ACE_Object_Manager has
// already been instantiated (it is likely to be one initialized by way
// of library/DLL loading). Let this one go through construction in
@@ -290,35 +339,44 @@ ACE_Object_Manager::ACE_Object_Manager (void)
// ACE_HAS_NONSTATIC_OBJECT_MANAGER, or the user has a good reason for
// creating a separate one) but the original one will be the one retrieved
// from calls to ACE_Object_Manager::instance().
+
// Be sure that no further instances are created via instance ().
if (instance_ == 0)
instance_ = this;
+
init ();
}
+
ACE_Object_Manager::~ACE_Object_Manager (void)
{
dynamically_allocated_ = false; // Don't delete this again in fini()
fini ();
}
+
ACE_Object_Manager *
ACE_Object_Manager::instance (void)
{
// This function should be called during construction of static
// instances, or before any other threads have been created in
// the process. So, it's not thread safe.
+
if (instance_ == 0)
{
ACE_Object_Manager *instance_pointer = 0;
+
ACE_NEW_RETURN (instance_pointer,
ACE_Object_Manager,
0);
ACE_ASSERT (instance_pointer == instance_);
+
instance_pointer->dynamically_allocated_ = true;
+
return instance_pointer;
}
else
return instance_;
}
+
int
ACE_Object_Manager::at_exit_i (void *object,
ACE_CLEANUP_FUNC cleanup_hook,
@@ -326,20 +384,25 @@ ACE_Object_Manager::at_exit_i (void *object,
{
ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon,
*instance_->internal_lock_, -1));
+
if (shutting_down_i ())
{
errno = EAGAIN;
return -1;
}
+
if (exit_info_.find (object))
{
// The object has already been registered.
errno = EEXIST;
return -1;
}
+
return exit_info_.at_exit_i (object, cleanup_hook, param);
}
+
#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
+
int
ACE_Object_Manager::get_singleton_lock (ACE_Null_Mutex *&lock)
{
@@ -357,10 +420,12 @@ ACE_Object_Manager::get_singleton_lock (ACE_Null_Mutex *&lock)
singleton_null_lock_,
ACE_Cleanup_Adapter<ACE_Null_Mutex>,
-1);
+
// Can't register with the ACE_Object_Manager here! The
// lock's declaration is visible to the ACE_Object_Manager
// destructor, so it will clean it up as a special case.
}
+
if (ACE_Object_Manager::instance ()->singleton_null_lock_ != 0)
lock = &ACE_Object_Manager::instance ()->singleton_null_lock_->
object ();
@@ -369,8 +434,10 @@ ACE_Object_Manager::get_singleton_lock (ACE_Null_Mutex *&lock)
// Use the Object_Manager's preallocated lock.
lock = ACE_Managed_Object<ACE_Null_Mutex>::get_preallocated_object
(ACE_Object_Manager::ACE_SINGLETON_NULL_LOCK);
+
return 0;
}
+
int
ACE_Object_Manager::get_singleton_lock (ACE_Thread_Mutex *&lock)
{
@@ -397,6 +464,7 @@ ACE_Object_Manager::get_singleton_lock (ACE_Thread_Mutex *&lock)
*ACE_Object_Manager::instance ()->
internal_lock_,
-1));
+
if (lock == 0)
{
ACE_Cleanup_Adapter<ACE_Thread_Mutex> *lock_adapter;
@@ -404,6 +472,7 @@ ACE_Object_Manager::get_singleton_lock (ACE_Thread_Mutex *&lock)
ACE_Cleanup_Adapter<ACE_Thread_Mutex>,
-1);
lock = &lock_adapter->object ();
+
// Register the lock for destruction at program
// termination. This call will cause us to grab the
// ACE_Object_Manager::instance ()->internal_lock_
@@ -412,8 +481,10 @@ ACE_Object_Manager::get_singleton_lock (ACE_Thread_Mutex *&lock)
}
}
}
+
return 0;
}
+
int
ACE_Object_Manager::get_singleton_lock (ACE_Mutex *&lock)
{
@@ -427,6 +498,7 @@ ACE_Object_Manager::get_singleton_lock (ACE_Mutex *&lock)
// instance has been destroyed, so the internal lock is not
// available. Either way, we can not use double-checked
// locking. So, we'll leak the lock.
+
ACE_NEW_RETURN (lock,
ACE_Mutex,
-1);
@@ -440,6 +512,7 @@ ACE_Object_Manager::get_singleton_lock (ACE_Mutex *&lock)
*ACE_Object_Manager::instance ()->
internal_lock_,
-1));
+
if (lock == 0)
{
ACE_Cleanup_Adapter<ACE_Mutex> *lock_adapter;
@@ -447,6 +520,7 @@ ACE_Object_Manager::get_singleton_lock (ACE_Mutex *&lock)
ACE_Cleanup_Adapter<ACE_Mutex>,
-1);
lock = &lock_adapter->object ();
+
// Register the lock for destruction at program
// termination. This call will cause us to grab the
// ACE_Object_Manager::instance ()->internal_lock_
@@ -455,8 +529,10 @@ ACE_Object_Manager::get_singleton_lock (ACE_Mutex *&lock)
}
}
}
+
return 0;
}
+
int
ACE_Object_Manager::get_singleton_lock (ACE_Recursive_Thread_Mutex *&lock)
{
@@ -473,9 +549,11 @@ ACE_Object_Manager::get_singleton_lock (ACE_Recursive_Thread_Mutex *&lock)
singleton_recursive_lock_,
ACE_Cleanup_Adapter<ACE_Recursive_Thread_Mutex>,
-1);
+
// Can't register with the ACE_Object_Manager here! The lock's
// declaration is visible to the ACE_Object_Manager destructor,
// so it will clean it up as a special case.
+
if (ACE_Object_Manager::instance ()->singleton_recursive_lock_ != 0)
lock = &ACE_Object_Manager::instance ()->singleton_recursive_lock_->
object ();
@@ -487,8 +565,10 @@ ACE_Object_Manager::get_singleton_lock (ACE_Recursive_Thread_Mutex *&lock)
get_preallocated_object (ACE_Object_Manager::
ACE_SINGLETON_RECURSIVE_THREAD_LOCK);
}
+
return 0;
}
+
int
ACE_Object_Manager::get_singleton_lock (ACE_RW_Thread_Mutex *&lock)
{
@@ -502,6 +582,7 @@ ACE_Object_Manager::get_singleton_lock (ACE_RW_Thread_Mutex *&lock)
// instance has been destroyed, so the internal lock is not
// available. Either way, we can not use double-checked
// locking. So, we'll leak the lock.
+
ACE_NEW_RETURN (lock,
ACE_RW_Thread_Mutex,
-1);
@@ -515,6 +596,7 @@ ACE_Object_Manager::get_singleton_lock (ACE_RW_Thread_Mutex *&lock)
*ACE_Object_Manager::instance ()->
internal_lock_,
-1));
+
if (lock == 0)
{
ACE_Cleanup_Adapter<ACE_RW_Thread_Mutex> *lock_adapter;
@@ -523,6 +605,7 @@ ACE_Object_Manager::get_singleton_lock (ACE_RW_Thread_Mutex *&lock)
-1);
lock = &lock_adapter->object ();
+
// Register the lock for destruction at program
// termination. This call will cause us to grab the
// ACE_Object_Manager::instance ()->internal_lock_
@@ -531,9 +614,11 @@ ACE_Object_Manager::get_singleton_lock (ACE_RW_Thread_Mutex *&lock)
}
}
}
+
return 0;
}
#endif /* ACE_MT_SAFE */
+
// Clean up an ACE_Object_Manager. There can be instances of this object
// other than The Instance. This can happen if (on Win32) the ACE DLL
// causes one to be created, or if a user creates one for some reason.
@@ -546,52 +631,67 @@ ACE_Object_Manager::fini (void)
// Too late. Or, maybe too early. Either fini () has already
// been called, or init () was never called.
return object_manager_state_ == OBJ_MAN_SHUT_DOWN ? 1 : -1;
+
// No mutex here. Only the main thread should destroy the singleton
// ACE_Object_Manager instance.
+
// Indicate that this ACE_Object_Manager instance is being
// shut down.
object_manager_state_ = OBJ_MAN_SHUTTING_DOWN;
+
// Call all registered cleanup hooks, in reverse order of
// registration.
exit_info_.call_hooks ();
+
if (this == instance_)
{
#if !defined (ACE_LACKS_ACE_SVCCONF)
delete preallocations_;
preallocations_ = 0;
#endif /* ! ACE_LACKS_ACE_SVCCONF */
+
#if defined (ACE_HAS_TRACE)
ACE_Trace::stop_tracing ();
#endif /* ACE_HAS_TRACE */
+
#if !defined (ACE_LACKS_ACE_SVCCONF)
// Close and possibly delete all service instances in the Service
// Repository.
ACE_Service_Config::fini_svcs ();
+
// Unlink all services in the Service Repository and close/delete
// all ACE library services and singletons.
ACE_Service_Config::close ();
#endif /* ! ACE_LACKS_ACE_SVCCONF */
+
// This must come after closing ACE_Service_Config, since it will
// close down it's dlls--it manages ACE_DLL_Manager.
ACE_Framework_Repository::close_singleton ();
ACE_DLL_Manager::close_singleton ();
+
# if ! defined (ACE_THREAD_MANAGER_LACKS_STATICS)
ACE_Thread_Manager::close_singleton ();
# endif /* ! ACE_THREAD_MANAGER_LACKS_STATICS */
+
// Close the main thread's TSS, including its Log_Msg instance.
ACE_OS::cleanup_tss (1 /* main thread */);
+
//
// Note: Do not access Log Msg after this since it is gone
//
+
// Close the ACE_Allocator.
ACE_Allocator::close_singleton ();
+
#if ! defined (ACE_HAS_STATIC_PREALLOCATION)
// Hooks for deletion of preallocated objects and arrays provided by
// application.
ACE_APPLICATION_PREALLOCATED_ARRAY_DELETIONS
ACE_APPLICATION_PREALLOCATED_OBJECT_DELETIONS
+
// Cleanup the dynamically preallocated arrays.
// (none)
+
// Cleanup the dynamically preallocated objects.
ACE_DELETE_PREALLOCATED_OBJECT (ACE_SYNCH_RW_MUTEX, ACE_FILECACHE_LOCK)
#if defined (ACE_HAS_THREADS)
@@ -619,36 +719,47 @@ ACE_Object_Manager::fini (void)
ACE_PROACTOR_EVENT_LOOP_LOCK)
# endif /* ACE_MT_SAFE */
#endif /* ! ACE_HAS_STATIC_PREALLOCATION */
+
#if defined (ACE_HAS_THREADS)
ACE_Static_Object_Lock::cleanup_lock ();
#endif /* ACE_HAS_THREADS */
}
+
#if !defined (ACE_LACKS_ACE_SVCCONF)
delete ace_service_config_sig_handler_;
ace_service_config_sig_handler_ = 0;
#endif /* ! ACE_LACKS_ACE_SVCCONF */
+
#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
delete internal_lock_;
internal_lock_ = 0;
+
delete singleton_null_lock_;
singleton_null_lock_ = 0;
+
delete singleton_recursive_lock_;
singleton_recursive_lock_ = 0;
#endif /* ACE_MT_SAFE */
+
// Indicate that this ACE_Object_Manager instance has been shut down.
object_manager_state_ = OBJ_MAN_SHUT_DOWN;
+
// Then, ensure that the ACE_OS_Object_Manager gets shut down.
if (this == instance_ && ACE_OS_Object_Manager::instance_)
ACE_OS_Object_Manager::instance_->fini ();
+
if (dynamically_allocated_)
{
delete this;
}
+
if (this == instance_)
instance_ = 0;
+
return 0;
}
+
#if !defined (ACE_HAS_NONSTATIC_OBJECT_MANAGER)
/**
* @class ACE_Object_Manager_Manager
@@ -665,10 +776,12 @@ class ACE_Export ACE_Object_Manager_Manager
public:
ACE_Object_Manager_Manager (void);
~ACE_Object_Manager_Manager (void);
+
private:
/// Save the main thread ID, so that destruction can be suppressed.
ACE_thread_t saved_main_thread_id_;
};
+
ACE_Object_Manager_Manager::ACE_Object_Manager_Manager (void)
: saved_main_thread_id_ (ACE_OS::thr_self ())
{
@@ -678,6 +791,7 @@ ACE_Object_Manager_Manager::ACE_Object_Manager_Manager (void)
// case.
(void) ACE_Object_Manager::instance ();
}
+
ACE_Object_Manager_Manager::~ACE_Object_Manager_Manager (void)
{
if (ACE_OS::thr_equal (ACE_OS::thr_self (),
@@ -690,9 +804,12 @@ ACE_Object_Manager_Manager::~ACE_Object_Manager_Manager (void)
// not delete the ACE_Object_Manager. That causes problems, on
// WIN32 at least.
}
+
static ACE_Object_Manager_Manager ACE_Object_Manager_Manager_instance;
#endif /* ! ACE_HAS_NONSTATIC_OBJECT_MANAGER */
+
#if defined (ACE_HAS_THREADS)
+
// hack to get around errors while compiling using split-cpp
#if !defined (ACE_IS_SPLITTING)
// This is global so that it doesn't have to be declared in the header
@@ -700,10 +817,12 @@ static ACE_Object_Manager_Manager ACE_Object_Manager_Manager_instance;
typedef ACE_Cleanup_Adapter<ACE_Recursive_Thread_Mutex> ACE_Static_Object_Lock_Type;
static ACE_Static_Object_Lock_Type *ACE_Static_Object_Lock_lock = 0;
#endif /* ! ACE_IS_SPLITTING */
+
// ACE_SHOULD_MALLOC_STATIC_OBJECT_LOCK isn't (currently) used by ACE.
// But, applications may find it useful for avoiding recursive calls
// if they have overridden operator new. Thanks to Jody Hagins
// <jody@atdesk.com> for contributing it.
+
ACE_Recursive_Thread_Mutex *
ACE_Static_Object_Lock::instance (void)
{
@@ -730,15 +849,18 @@ ACE_Static_Object_Lock::instance (void)
// do not use ACE_NEW macros for placement new
ACE_Static_Object_Lock_lock = new (buffer)
ACE_Static_Object_Lock_Type ();
+
# else /* ! ACE_SHOULD_MALLOC_STATIC_OBJECT_LOCK */
ACE_NEW_RETURN (ACE_Static_Object_Lock_lock,
ACE_Cleanup_Adapter<ACE_Recursive_Thread_Mutex>,
0);
# endif /* ! ACE_SHOULD_MALLOC_STATIC_OBJECT_LOCK */
}
+
// Can't register with the ACE_Object_Manager here! The lock's
// declaration is visible to the ACE_Object_Manager destructor,
// so it will clean it up as a special case.
+
return &ACE_Static_Object_Lock_lock->object ();
}
else
@@ -747,6 +869,7 @@ ACE_Static_Object_Lock::instance (void)
ACE_Managed_Object<ACE_Recursive_Thread_Mutex>::get_preallocated_object
(ACE_Object_Manager::ACE_STATIC_OBJECT_LOCK);
}
+
void
ACE_Static_Object_Lock::cleanup_lock (void)
{
@@ -762,5 +885,6 @@ ACE_Static_Object_Lock::cleanup_lock (void)
ACE_Static_Object_Lock_lock = 0;
}
#endif /* ACE_HAS_THREADS */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Object_Manager.h b/dep/ACE_wrappers/ace/Object_Manager.h
index 431e2e938f5..741b9e3eebf 100644
--- a/dep/ACE_wrappers/ace/Object_Manager.h
+++ b/dep/ACE_wrappers/ace/Object_Manager.h
@@ -1,4 +1,5 @@
/* -*- C++ -*- */
+
//=============================================================================
/**
* @file Object_Manager.h
@@ -10,50 +11,68 @@
* @author Per Andersson
*/
//=============================================================================
+
#ifndef ACE_OBJECT_MANAGER_H
#define ACE_OBJECT_MANAGER_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
#include "ace/Object_Manager_Base.h"
#include "ace/Global_Macros.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward declarations.
class ACE_Object_Manager_Preallocations;
class ACE_Sig_Adapter;
class ACE_Sig_Set;
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Mutex;
class ACE_Null_Mutex;
class ACE_Thread_Mutex;
class ACE_Recursive_Thread_Mutex;
class ACE_RW_Thread_Mutex;
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# include "ace/Recursive_Thread_Mutex.h"
#endif /* ACE_MT_SAFE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// only used by ACE_OS_Object_Manager::ctor
# if defined (ACE_WIN32)
// Default WIN32 structured exception handler.
int ACE_SEH_Default_Exception_Selector (void *);
int ACE_SEH_Default_Exception_Handler (void *);
# endif /* ACE_WIN32 */
+
class ACE_Cleanup_Info_Node;
template <class T> class ACE_Cleanup_Adapter;
+
// Configuration parameters.
#if !defined (ACE_MAX_MANAGED_OBJECTS)
# define ACE_MAX_MANAGED_OBJECTS 128
#endif /* ! ACE_MAX_MANAGED_OBJECTS */
+
#if !defined (ACE_APPLICATION_PREALLOCATED_OBJECT_DECLARATIONS)
# define ACE_APPLICATION_PREALLOCATED_OBJECT_DECLARATIONS
#endif /* ! ACE_APPLICATION_PREALLOCATED_OBJECT_DECLARATIONS */
+
#if !defined (ACE_APPLICATION_PREALLOCATED_ARRAY_DECLARATIONS)
# define ACE_APPLICATION_PREALLOCATED_ARRAY_DECLARATIONS
#endif /* ! ACE_APPLICATION_PREALLOCATED_ARRAY_DECLARATIONS */
+
/**
* @class ACE_Object_Manager
*
@@ -178,6 +197,7 @@ template <class T> class ACE_Cleanup_Adapter;
*/
class ACE_Export ACE_Object_Manager : public ACE_Object_Manager_Base
{
+
public:
/**
* Explicitly initialize (construct the singleton instance of) the
@@ -185,12 +205,14 @@ public:
* if it had already been called.
*/
virtual int init (void);
+
/**
* Explicitly destroy the singleton instance of the
* ACE_Object_Manager. Returns 0 on success, -1 on failure, and 1
* if it had already been called.
*/
virtual int fini (void);
+
/**
* Returns 1 before the ACE_Object_Manager has been constructed.
* This flag can be used to determine if the program is constructing
@@ -201,6 +223,7 @@ public:
* defined.)
*/
static int starting_up (void);
+
/**
* Returns 1 after the ACE_Object_Manager has been destroyed. This
* flag can be used to determine if the program is in the midst of
@@ -209,6 +232,7 @@ public:
* ACE_HAS_NONSTATIC_OBJECT_MANAGER is not defined.)
*/
static int shutting_down (void);
+
/**
* Register an ACE_Cleanup object for cleanup at process
* termination. The object is deleted via the
@@ -220,10 +244,12 @@ public:
* if the object (or array) had already been registered.
*/
static int at_exit (ACE_Cleanup *object, void *param = 0);
+
#if defined (ACE_HAS_TSS_EMULATION)
static int init_tss (void);
int init_tss_i (void);
#endif
+
/**
* Register an object (or array) for cleanup at process termination.
* "cleanup_hook" points to a (global, or static member) function
@@ -241,6 +267,7 @@ public:
static int at_exit (void *object,
ACE_CLEANUP_FUNC cleanup_hook,
void *param);
+
#if 0 /* not implemented yet */
/// Similar to <at_exit>, except that the cleanup_hook is called
/// when the current thread exits instead of when the program terminates.
@@ -248,6 +275,7 @@ public:
ACE_CLEANUP_FUNC cleanup_hook,
void *param);
#endif /* 0 */
+
/// Unique identifiers for preallocated objects. Please see
/// ace/Managed_Object.h for information on accessing preallocated
/// objects.
@@ -270,10 +298,13 @@ public:
#endif /* ! ACE_LACKS_ACE_TOKEN */
ACE_PROACTOR_EVENT_LOOP_LOCK,
#endif /* ACE_MT_SAFE */
+
// Hook for preallocated objects provided by application.
ACE_APPLICATION_PREALLOCATED_OBJECT_DECLARATIONS
+
ACE_PREALLOCATED_OBJECTS // This enum value must be last!
};
+
/// Unique identifiers for preallocated arrays. Please see
/// ace/Managed_Object.h for information on accessing preallocated
/// arrays.
@@ -284,56 +315,69 @@ public:
/// the the preallocated_array size is at least one by declaring
/// this dummy . . .
ACE_EMPTY_PREALLOCATED_ARRAY,
+
/// Hook for preallocated arrays provided by application.
ACE_APPLICATION_PREALLOCATED_ARRAY_DECLARATIONS
+
ACE_PREALLOCATED_ARRAYS // This enum value must be last!
};
+
/**
* @deprecated Accesses a default signal set used, for example,
* in ACE_Sig_Guard methods.
* Deprecated: use ACE_Object_Manager::default_mask () instead.
*/
static ACE_Sig_Set &default_mask (void);
+
private:
/// For at_exit support.
ACE_OS_Exit_Info exit_info_;
+
#if !defined (ACE_LACKS_ACE_SVCCONF)
/// Preallocated objects collection.
ACE_Object_Manager_Preallocations *preallocations_;
+
/// ACE_Service_Config signal handler.
ACE_Sig_Adapter *ace_service_config_sig_handler_;
#endif /* ! ACE_LACKS_ACE_SVCCONF */
+
/// Register an object or array for deletion at program termination.
/// See description of static version above for return values.
int at_exit_i (void *object, ACE_CLEANUP_FUNC cleanup_hook, void *param);
+
#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
public:
// = The <get_singleton_lock> accessors are for internal
// use by ACE_Singleton _only_.
+
/**
* Accesses an ACE_Null_Mutex to be used for construction of
* ACE_Singletons. Returns 0, and the lock in the argument, on
* success; returns -1 on failure.
*/
static int get_singleton_lock (ACE_Null_Mutex *&);
+
/**
* Accesses a non-recursive ACE_Thread_Mutex to be used for
* construction of ACE_Singletons. Returns 0, and the lock in the
* argument, on success; returns -1 on failure.
*/
static int get_singleton_lock (ACE_Thread_Mutex *&);
+
/**
* Accesses a non-recursive ACE_Mutex to be used for construction
* of ACE_Singletons. Returns 0, and the lock in the argument, on
* success; returns -1 on failure.
*/
static int get_singleton_lock (ACE_Mutex *&);
+
/**
* Accesses a recursive ACE_Recursive_Thread_Mutex to be used for
* construction of ACE_Singletons. Returns 0, and the lock in the
* argument, on success; returns -1 on failure.
*/
static int get_singleton_lock (ACE_Recursive_Thread_Mutex *&);
+
/**
* Accesses a readers/writer ACE_RW_Thread_Mutex to be used for
* construction of ACE_Singletons. Returns 0, and the lock in the
@@ -341,18 +385,23 @@ public:
*/
static int get_singleton_lock (ACE_RW_Thread_Mutex *&);
#endif /* ACE_MT_SAFE */
+
public:
// For internal use only by ACE_Managed_Objects.
+
/**
* Accessor to singleton instance. Because static member functions
* are provided in the interface, this should not be public. However,
* it is public so that ACE_Managed_Object<TYPE> can access it.
*/
static ACE_Object_Manager *instance (void);
+
/// Table of preallocated objects.
static void *preallocated_object[ACE_PREALLOCATED_OBJECTS];
+
/// Table of preallocated arrays.
static void *preallocated_array[ACE_PREALLOCATED_ARRAYS];
+
public:
// Application code should not use these explicitly, so they're
// hidden here. They're public so that the ACE_Object_Manager can
@@ -360,36 +409,48 @@ public:
// ACE_HAS_NONSTATIC_OBJECT_MANAGER.
ACE_Object_Manager (void);
~ACE_Object_Manager (void);
+
private:
/// Singleton pointer.
static ACE_Object_Manager *instance_;
+
#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
/// Lock that is used to guard internal structures.
ACE_Recursive_Thread_Mutex *internal_lock_;
+
/// Null lock for guarding singleton creation.
ACE_Cleanup_Adapter<ACE_Null_Mutex> *singleton_null_lock_;
+
/// Lock for guarding singleton creation, when Object_Manager
/// hasn't been started up, or has already been shut down.
ACE_Cleanup_Adapter<ACE_Recursive_Thread_Mutex> *singleton_recursive_lock_;
#endif /* ACE_MT_SAFE */
+
#if defined (ACE_HAS_TSS_EMULATION)
// Main thread's thread-specific storage array.
void *ts_storage_[ACE_TSS_Emulation::ACE_TSS_THREAD_KEYS_MAX];
bool ts_storage_initialized_;
#endif /* ACE_HAS_TSS_EMULATION */
+
#if !defined (ACE_HAS_NONSTATIC_OBJECT_MANAGER)
friend class ACE_Object_Manager_Manager;
#endif /* ACE_HAS_NONSTATIC_OBJECT_MANAGER */
+
// Disallow copying by not implementing the following . . .
ACE_Object_Manager (const ACE_Object_Manager &);
ACE_Object_Manager &operator= (const ACE_Object_Manager &);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include "ace/Static_Object_Lock.h"
+
#if defined (__ACE_INLINE__)
#include "ace/Object_Manager.inl"
#endif /* __ACE_INLINE__ */
+
#include "ace/Managed_Object.h"
+
#if !defined (ACE_LACKS_ACE_SVCCONF)
// We can't use the ACE_SVC_FACTORY_DECLARE macro here because this
// needs to be in the ACE_Export context rather than the
@@ -400,6 +461,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
ACE_FACTORY_DECLARE (ACE, ACE_Service_Manager)
#endif /* ! ACE_LACKS_ACE_SVCCONF */
+
#include /**/ "ace/post.h"
#endif /* ACE_OBJECT_MANAGER_H */
diff --git a/dep/ACE_wrappers/ace/Object_Manager.inl b/dep/ACE_wrappers/ace/Object_Manager.inl
index b3b9f1f6d5f..bcc27af91bf 100644
--- a/dep/ACE_wrappers/ace/Object_Manager.inl
+++ b/dep/ACE_wrappers/ace/Object_Manager.inl
@@ -1,7 +1,9 @@
// -*- C++ -*-
//
// $Id: Object_Manager.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
int
ACE_Object_Manager::at_exit (ACE_Cleanup *object,
@@ -12,6 +14,7 @@ ACE_Object_Manager::at_exit (ACE_Cleanup *object,
(ACE_CLEANUP_FUNC) ACE_CLEANUP_DESTROYER_NAME,
param);
}
+
ACE_INLINE
int
ACE_Object_Manager::at_exit (void *object,
@@ -23,6 +26,7 @@ ACE_Object_Manager::at_exit (void *object,
cleanup_hook,
param);
}
+
ACE_INLINE
ACE_Sig_Set &
ACE_Object_Manager::default_mask (void)
@@ -32,4 +36,5 @@ ACE_Object_Manager::default_mask (void)
return
*reinterpret_cast<ACE_Sig_Set *> (ACE_OS_Object_Manager::default_mask ());
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Object_Manager_Base.cpp b/dep/ACE_wrappers/ace/Object_Manager_Base.cpp
index e1f49d105b6..cc615fa48b9 100644
--- a/dep/ACE_wrappers/ace/Object_Manager_Base.cpp
+++ b/dep/ACE_wrappers/ace/Object_Manager_Base.cpp
@@ -1,12 +1,17 @@
// $Id: Object_Manager_Base.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Object_Manager_Base.h"
+
ACE_RCSID(ace, Object_Manager_Base, "$Id: Object_Manager_Base.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#include "ace/OS_Memory.h"
#include "ace/OS_NS_Thread.h"
#include "ace/OS_NS_sys_socket.h"
#include "ace/OS_NS_signal.h"
#include "ace/OS_NS_stdio.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS)
int ACE_SEH_Default_Exception_Selector (void *)
{
@@ -18,11 +23,13 @@ int ACE_SEH_Default_Exception_Selector (void *)
// defined in ace/config-win32-common.h.
return (DWORD) ACE_SEH_DEFAULT_EXCEPTION_HANDLING_ACTION;
}
+
int ACE_SEH_Default_Exception_Handler (void *)
{
return 0;
}
#endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */
+
# define ACE_OS_PREALLOCATE_OBJECT(TYPE, ID)\
{\
TYPE *obj_p = 0;\
@@ -32,12 +39,14 @@ int ACE_SEH_Default_Exception_Handler (void *)
# define ACE_OS_DELETE_PREALLOCATED_OBJECT(TYPE, ID)\
delete (TYPE *) preallocated_object[ID];\
preallocated_object[ID] = 0;
+
ACE_Object_Manager_Base::ACE_Object_Manager_Base (void)
: object_manager_state_ (OBJ_MAN_UNINITIALIZED)
, dynamically_allocated_ (false)
, next_ (0)
{
}
+
ACE_Object_Manager_Base::~ACE_Object_Manager_Base (void)
{
#if defined (ACE_HAS_NONSTATIC_OBJECT_MANAGER)
@@ -45,17 +54,21 @@ ACE_Object_Manager_Base::~ACE_Object_Manager_Base (void)
dynamically_allocated_ = false;
#endif /* ACE_HAS_NONSTATIC_OBJECT_MANAGER */
}
+
int
ACE_Object_Manager_Base::starting_up_i ()
{
return object_manager_state_ < OBJ_MAN_INITIALIZED;
}
+
int
ACE_Object_Manager_Base::shutting_down_i ()
{
return object_manager_state_ > OBJ_MAN_INITIALIZED;
}
+
/*****************************************************************************/
+
extern "C"
void
ACE_OS_Object_Manager_Internal_Exit_Hook (void)
@@ -63,9 +76,12 @@ ACE_OS_Object_Manager_Internal_Exit_Hook (void)
if (ACE_OS_Object_Manager::instance_)
ACE_OS_Object_Manager::instance ()->fini ();
}
+
ACE_OS_Object_Manager *ACE_OS_Object_Manager::instance_ = 0;
+
void *ACE_OS_Object_Manager::preallocated_object[
ACE_OS_Object_Manager::ACE_OS_PREALLOCATED_OBJECTS] = { 0 };
+
ACE_OS_Object_Manager::ACE_OS_Object_Manager (void)
// default_mask_ isn't initialized, because it's defined by <init>.
: thread_hook_ (0)
@@ -84,56 +100,68 @@ ACE_OS_Object_Manager::ACE_OS_Object_Manager (void)
// a good reason for creating a separate one) but the original one
// will be the one retrieved from calls to
// ACE_Object_Manager::instance().
+
// Be sure that no further instances are created via instance ().
if (instance_ == 0)
instance_ = this;
+
init ();
}
+
ACE_OS_Object_Manager::~ACE_OS_Object_Manager (void)
{
dynamically_allocated_ = false; // Don't delete this again in fini()
fini ();
}
+
sigset_t *
ACE_OS_Object_Manager::default_mask (void)
{
return ACE_OS_Object_Manager::instance ()->default_mask_;
}
+
ACE_Thread_Hook *
ACE_OS_Object_Manager::thread_hook (void)
{
return ACE_OS_Object_Manager::instance ()->thread_hook_;
}
+
#if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS)
ACE_SEH_EXCEPT_HANDLER
ACE_OS_Object_Manager::seh_except_selector (void)
{
return ACE_OS_Object_Manager::instance ()->seh_except_selector_;
}
+
ACE_SEH_EXCEPT_HANDLER
ACE_OS_Object_Manager::seh_except_selector (ACE_SEH_EXCEPT_HANDLER n)
{
ACE_OS_Object_Manager *instance =
ACE_OS_Object_Manager::instance ();
+
ACE_SEH_EXCEPT_HANDLER retv = instance->seh_except_selector_;
instance->seh_except_selector_ = n;
return retv;
}
+
ACE_SEH_EXCEPT_HANDLER
ACE_OS_Object_Manager::seh_except_handler (void)
{
return ACE_OS_Object_Manager::instance ()->seh_except_handler_;
}
+
ACE_SEH_EXCEPT_HANDLER
ACE_OS_Object_Manager::seh_except_handler (ACE_SEH_EXCEPT_HANDLER n)
{
ACE_OS_Object_Manager *instance =
ACE_OS_Object_Manager::instance ();
+
ACE_SEH_EXCEPT_HANDLER retv = instance->seh_except_handler_;
instance->seh_except_handler_ = n;
return retv;
}
#endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */
+
ACE_Thread_Hook *
ACE_OS_Object_Manager::thread_hook (ACE_Thread_Hook *new_thread_hook)
{
@@ -142,25 +170,32 @@ ACE_OS_Object_Manager::thread_hook (ACE_Thread_Hook *new_thread_hook)
os_om->thread_hook_ = new_thread_hook;
return old_hook;
}
+
ACE_OS_Object_Manager *
ACE_OS_Object_Manager::instance (void)
{
// This function should be called during construction of static
// instances, or before any other threads have been created in the
// process. So, it's not thread safe.
+
if (instance_ == 0)
{
ACE_OS_Object_Manager *instance_pointer = 0;
+
ACE_NEW_RETURN (instance_pointer,
ACE_OS_Object_Manager,
0);
// I (coryan) removed it, using asserts in the OS layer
// brings down the Log msg stuff
// ACE_ASSERT (instance_pointer == instance_);
+
instance_pointer->dynamically_allocated_ = true;
+
}
+
return instance_;
}
+
int
ACE_OS_Object_Manager::init (void)
{
@@ -169,6 +204,7 @@ ACE_OS_Object_Manager::init (void)
// First, indicate that this ACE_OS_Object_Manager instance is being
// initialized.
object_manager_state_ = OBJ_MAN_INITIALIZING;
+
if (this == instance_)
{
# if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
@@ -214,16 +250,21 @@ ACE_OS_Object_Manager::init (void)
# endif /* ACE_HAS_THREAD_SPECIFIC_STORAGE */
# endif /* ACE_HAS_TSS_EMULATION */
# endif /* ACE_MT_SAFE */
+
// Open Winsock (no-op on other platforms).
ACE_OS::socket_init (ACE_WSOCK_VERSION);
+
// Register the exit hook, for use by ACE_OS::exit ().
ACE_OS::set_exit_hook (&ACE_OS_Object_Manager_Internal_Exit_Hook);
}
+
ACE_NEW_RETURN (default_mask_, sigset_t, -1);
ACE_OS::sigfillset (default_mask_);
+
// Finally, indicate that the ACE_OS_Object_Manager instance has
// been initialized.
object_manager_state_ = OBJ_MAN_INITIALIZED;
+
# if defined (ACE_WIN32)
ACE_OS::win32_versioninfo_.dwOSVersionInfoSize =
sizeof (ACE_TEXT_OSVERSIONINFO);
@@ -235,6 +276,7 @@ ACE_OS_Object_Manager::init (void)
return 1;
}
}
+
// Clean up an ACE_OS_Object_Manager. There can be instances of this object
// other than The Instance. This can happen if a user creates one for some
// reason. All objects clean up their per-object information and managed
@@ -246,27 +288,33 @@ ACE_OS_Object_Manager::fini (void)
// Too late. Or, maybe too early. Either fini () has already
// been called, or init () was never called.
return object_manager_state_ == OBJ_MAN_SHUT_DOWN ? 1 : -1;
+
// No mutex here. Only the main thread should destroy the singleton
// ACE_OS_Object_Manager instance.
+
// Indicate that the ACE_OS_Object_Manager instance is being shut
// down. This object manager should be the last one to be shut
// down.
object_manager_state_ = OBJ_MAN_SHUTTING_DOWN;
+
// If another Object_Manager has registered for termination, do it.
if (next_)
{
next_->fini ();
next_ = 0; // Protect against recursive calls.
}
+
// Call all registered cleanup hooks, in reverse order of
// registration.
exit_info_.call_hooks ();
+
// Only clean up preallocated objects when the singleton Instance is being
// destroyed.
if (this == instance_)
{
// Close down Winsock (no-op on other platforms).
ACE_OS::socket_fini ();
+
#if ! defined (ACE_HAS_STATIC_PREALLOCATION)
// Cleanup the dynamically preallocated objects.
# if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
@@ -325,19 +373,26 @@ ACE_OS_Object_Manager::fini (void)
# endif /* ACE_MT_SAFE */
#endif /* ! ACE_HAS_STATIC_PREALLOCATION */
}
+
delete default_mask_;
default_mask_ = 0;
+
// Indicate that this ACE_OS_Object_Manager instance has been shut down.
object_manager_state_ = OBJ_MAN_SHUT_DOWN;
+
if (dynamically_allocated_)
{
delete this;
}
+
if (this == instance_)
instance_ = 0;
+
return 0;
}
+
int ace_exit_hook_marker = 0;
+
int
ACE_OS_Object_Manager::at_exit (ACE_EXIT_HOOK func)
{
@@ -345,6 +400,7 @@ ACE_OS_Object_Manager::at_exit (ACE_EXIT_HOOK func)
reinterpret_cast <ACE_CLEANUP_FUNC> (func),
0);
}
+
void
ACE_OS_Object_Manager::print_error_message (unsigned int line_number,
const ACE_TCHAR *message)
@@ -359,6 +415,7 @@ ACE_OS_Object_Manager::print_error_message (unsigned int line_number,
// @@ Need to use the following information.
ACE_UNUSED_ARG (line_number);
ACE_UNUSED_ARG (message);
+
ACE_TCHAR *lpMsgBuf = 0;
::FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM,
@@ -376,6 +433,7 @@ ACE_OS_Object_Manager::print_error_message (unsigned int line_number,
MB_OK);
#endif
}
+
int
ACE_OS_Object_Manager::starting_up (void)
{
@@ -383,6 +441,7 @@ ACE_OS_Object_Manager::starting_up (void)
? instance_->starting_up_i ()
: 1;
}
+
int
ACE_OS_Object_Manager::shutting_down (void)
{
@@ -390,7 +449,9 @@ ACE_OS_Object_Manager::shutting_down (void)
? instance_->shutting_down_i ()
: 1;
}
+
/*****************************************************************************/
+
#if !defined (ACE_HAS_NONSTATIC_OBJECT_MANAGER)
/**
* @class ACE_OS_Object_Manager_Manager
@@ -407,12 +468,15 @@ class ACE_OS_Object_Manager_Manager
public:
/// Constructor.
ACE_OS_Object_Manager_Manager (void);
+
/// Destructor.
~ACE_OS_Object_Manager_Manager (void);
+
private:
/// Save the main thread ID, so that destruction can be suppressed.
ACE_thread_t saved_main_thread_id_;
};
+
ACE_OS_Object_Manager_Manager::ACE_OS_Object_Manager_Manager (void)
: saved_main_thread_id_ (ACE_OS::thr_self ())
{
@@ -422,6 +486,7 @@ ACE_OS_Object_Manager_Manager::ACE_OS_Object_Manager_Manager (void)
// case.
(void) ACE_OS_Object_Manager::instance ();
}
+
ACE_OS_Object_Manager_Manager::~ACE_OS_Object_Manager_Manager (void)
{
if (ACE_OS::thr_equal (ACE_OS::thr_self (),
@@ -434,7 +499,9 @@ ACE_OS_Object_Manager_Manager::~ACE_OS_Object_Manager_Manager (void)
// not delete the ACE_OS_Object_Manager. That causes problems, on
// WIN32 at least.
}
+
static ACE_OS_Object_Manager_Manager ACE_OS_Object_Manager_Manager_instance;
#endif /* ! ACE_HAS_NONSTATIC_OBJECT_MANAGER */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Object_Manager_Base.h b/dep/ACE_wrappers/ace/Object_Manager_Base.h
index 65f79c4ba71..d1058874d7d 100644
--- a/dep/ACE_wrappers/ace/Object_Manager_Base.h
+++ b/dep/ACE_wrappers/ace/Object_Manager_Base.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Object_Manager_Base.h
@@ -12,24 +13,31 @@
* Originally in OS.h.
*/
//=============================================================================
+
#ifndef ACE_OBJECT_MANAGER_BASE_H
#define ACE_OBJECT_MANAGER_BASE_H
#include /**/ "ace/pre.h"
+
#include "ace/config-lite.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include /**/ "ace/ACE_export.h"
#include "ace/Cleanup.h"
#include "ace/os_include/sys/os_types.h"
#include "ace/os_include/os_signal.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Object_Manager;
class ACE_OS_Object_Manager_Manager;
class ACE_TSS_Cleanup;
class ACE_TSS_Emulation;
class ACE_Log_Msg;
class ACE_Thread_Hook;
+
/**
* @class ACE_Object_Manager_Base
*
@@ -42,8 +50,10 @@ class ACE_Export ACE_Object_Manager_Base
protected:
/// Default constructor.
ACE_Object_Manager_Base (void);
+
/// Destructor.
virtual ~ACE_Object_Manager_Base (void);
+
public:
/**
* Explicitly initialize. Returns 0 on success, -1 on failure due
@@ -51,12 +61,14 @@ public:
* ENOMEM), or 1 if it had already been called.
*/
virtual int init (void) = 0;
+
/**
* Explicitly destroy. Returns 0 on success, -1 on failure because
* the number of fini () calls hasn't reached the number of init ()
* calls, or 1 if it had already been called.
*/
virtual int fini (void) = 0;
+
enum Object_Manager_State
{
OBJ_MAN_UNINITIALIZED = 0,
@@ -65,6 +77,7 @@ public:
OBJ_MAN_SHUTTING_DOWN,
OBJ_MAN_SHUT_DOWN
};
+
protected:
/**
* Returns 1 before ACE_Object_Manager_Base has been constructed.
@@ -76,6 +89,7 @@ protected:
* defined.)
*/
int starting_up_i (void);
+
/**
* Returns 1 after ACE_Object_Manager_Base has been destroyed. This
* flag can be used to determine if the program is in the midst of
@@ -84,8 +98,10 @@ protected:
* ACE_HAS_NONSTATIC_OBJECT_MANAGER is not defined.)
*/
int shutting_down_i (void);
+
/// State of the Object_Manager;
Object_Manager_State object_manager_state_;
+
/**
* Flag indicating whether the ACE_Object_Manager was dynamically
* allocated by ACE. (If is was dynamically allocated by the
@@ -93,6 +109,7 @@ protected:
* it.)
*/
bool dynamically_allocated_;
+
/// Link to next Object_Manager, for chaining.
ACE_Object_Manager_Base *next_;
private:
@@ -100,28 +117,35 @@ private:
ACE_Object_Manager_Base (const ACE_Object_Manager_Base &);
ACE_Object_Manager_Base &operator= (const ACE_Object_Manager_Base &);
};
+
extern "C"
void
ACE_OS_Object_Manager_Internal_Exit_Hook (void);
+
// @@ This forward declaration should go away.
class ACE_Log_Msg;
+
class ACE_Export ACE_OS_Object_Manager : public ACE_Object_Manager_Base
{
public:
/// Explicitly initialize.
virtual int init (void);
+
/// Explicitly destroy.
virtual int fini (void);
+
/**
* Returns 1 before the ACE_OS_Object_Manager has been
* constructed. See <ACE_Object_Manager::starting_up> for more
* information.
*/
static int starting_up (void);
+
/// Returns 1 after the ACE_OS_Object_Manager has been destroyed.
/// See <ACE_Object_Manager::shutting_down> for more information.
static int shutting_down (void);
+
/// Unique identifiers for preallocated objects.
enum Preallocated_Object
{
@@ -141,55 +165,74 @@ public:
// declaring this dummy . . .
ACE_OS_EMPTY_PREALLOCATED_OBJECT,
# endif /* ACE_MT_SAFE */
+
/// This enum value must be last!
ACE_OS_PREALLOCATED_OBJECTS
};
+
/// Accesses a default signal set used, for example, in
/// ACE_Sig_Guard methods.
static sigset_t *default_mask (void);
+
/// Returns the current thread hook for the process.
static ACE_Thread_Hook *thread_hook (void);
+
/// Returns the existing thread hook and assign a <new_thread_hook>.
static ACE_Thread_Hook *thread_hook (ACE_Thread_Hook *new_thread_hook);
+
#if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS)
/// Get/Set TSS exception action.
static ACE_SEH_EXCEPT_HANDLER seh_except_selector (void);
static ACE_SEH_EXCEPT_HANDLER seh_except_selector (ACE_SEH_EXCEPT_HANDLER);
+
static ACE_SEH_EXCEPT_HANDLER seh_except_handler (void);
static ACE_SEH_EXCEPT_HANDLER seh_except_handler (ACE_SEH_EXCEPT_HANDLER);
#endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */
+
public:
// = Applications shouldn't use these so they're hidden here.
+
// They're public so that the ACE_Object_Manager can be
// constructed/destructed in <main> with
// <ACE_HAS_NONSTATIC_OBJECT_MANAGER>.
/// Constructor.
ACE_OS_Object_Manager (void);
+
/// Destructor.
~ACE_OS_Object_Manager (void);
+
/// Accessor to singleton instance.
static ACE_OS_Object_Manager *instance (void);
+
/// For <ACE_OS::atexit> support.
int at_exit (ACE_EXIT_HOOK func);
+
//private:
/// Singleton instance pointer.
static ACE_OS_Object_Manager *instance_;
+
/// Table of preallocated objects.
static void *preallocated_object[ACE_OS_PREALLOCATED_OBJECTS];
+
/// Default signal set used, for example, in ACE_Sig_Guard.
sigset_t *default_mask_;
+
/// Thread hook that's used by this process.
ACE_Thread_Hook *thread_hook_;
+
/// For at_exit support.
ACE_OS_Exit_Info exit_info_;
+
#if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS)
/// These handlers determine how a thread handles win32 structured
/// exception.
ACE_SEH_EXCEPT_HANDLER seh_except_selector_;
ACE_SEH_EXCEPT_HANDLER seh_except_handler_;
#endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */
+
/// For use by init () and fini (), to consolidate error reporting.
static void print_error_message (unsigned int line_number, const ACE_TCHAR *message);
+
/// This class is for internal use by ACE_OS, etc., only.
friend class ACE_Object_Manager;
friend class ACE_OS_Object_Manager_Manager;
@@ -198,7 +241,9 @@ public:
friend class ACE_Log_Msg;
friend void ACE_OS_Object_Manager_Internal_Exit_Hook ();
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
#endif /* ACE_OBJECT_MANAGER_BASE_H */
diff --git a/dep/ACE_wrappers/ace/Obstack.h b/dep/ACE_wrappers/ace/Obstack.h
index a7581a8a73b..24ccd6bdfbf 100644
--- a/dep/ACE_wrappers/ace/Obstack.h
+++ b/dep/ACE_wrappers/ace/Obstack.h
@@ -8,17 +8,25 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_OBSTACK_H
#define ACE_OBSTACK_H
#include /**/ "ace/pre.h"
+
#include "ace/Obstack_T.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_SINGLETON_DECLARATION (ACE_Obstack_T <char>;)
+
typedef ACE_Obstack_T<char> ACE_Obstack;
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
#endif /* ACE_OBSTACK_H */
diff --git a/dep/ACE_wrappers/ace/Obstack_T.h b/dep/ACE_wrappers/ace/Obstack_T.h
index 6917eaa4536..130d818199b 100644
--- a/dep/ACE_wrappers/ace/Obstack_T.h
+++ b/dep/ACE_wrappers/ace/Obstack_T.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Obstack_T.h
@@ -9,15 +10,22 @@
* @author Nanbor Wang <nanbor@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_OBSTACK_T_H
#define ACE_OBSTACK_T_H
+
#include /**/ "ace/pre.h"
+
#include "ace/Obchunk.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Allocator;
+
/**
* @class ACE_Obstack_T
*
@@ -34,29 +42,35 @@ public:
ACE_Obstack_T (size_t size = (4096 * sizeof (CHAR)) - sizeof (ACE_Obchunk),
ACE_Allocator *allocator_strategy = 0);
~ACE_Obstack_T (void);
+
/// Request Obstack to prepare a block at least @a len long for building
/// a new string. Return -1 if fail, 0 if success.
int request (size_t len);
+
/// Inserting a new CHAR \a c into the current building
/// block without freezing (null terminating) the block.
/// This function will create new chunk by checking the
/// boundary of current Obchunk. Return
/// the location \a c gets inserted to, or 0 if error.
CHAR *grow (CHAR c);
+
/// Inserting a new CHAR \a c into the current building
/// block without freezing (null terminating) the block and without
/// checking for out-of-bound error.
void grow_fast (CHAR c);
+
/// Freeze the current building block by null terminating it.
/// Return the starting address of the current building block, 0
/// if error occurs.
CHAR *freeze (void);
+
/// Copy the data into the current Obchunk and freeze the current
/// block. Return the starting address of the current building
/// block, 0 if error occurs. @a len specify the string length,
/// not the actually data size.
CHAR *copy (const CHAR *data,
size_t len);
+
/// Return the maximum @a length or @a size of a string that can be put
/// into this Obstack. @a size = @a length * sizeof (CHAR).
///
@@ -64,43 +78,58 @@ public:
/// arbitrary lengths into the obstack now.
size_t length (void) const;
size_t size (void) const;
+
/// "Unwind" the stack. If @a obj is a null pointer, everything allocated
/// in the stack is released. Otherwise, @a obj must be an address of an
/// object allocated in the stack. In this case, @a obj is released along
/// with everthing allocated in the Obstack since @a obj.
void unwind (void* obj);
+
/// "Release" the entire stack of Obchunks, putting it back on the free
/// list.
void release (void);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
class ACE_Obchunk *new_chunk (void);
+
/// Search through the list of Obchunks and release them. Helper funtion
/// used by unwind.
void unwind_i (void* obj);
+
/// Pointer to the allocator used by this Obstack.
ACE_Allocator *allocator_strategy_;
+
/// Current size of the Obstack;
size_t size_;
+
// Don't change the order of the following two fields.
/// Head of the Obchunk chain.
class ACE_Obchunk *head_;
+
/// Pointer to the current Obchunk.
class ACE_Obchunk *curr_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Obstack_T.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Obstack_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Obstack_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
#endif /* ACE_OBSTACK_T_H */
diff --git a/dep/ACE_wrappers/ace/Obstack_T.inl b/dep/ACE_wrappers/ace/Obstack_T.inl
index b7c311444e2..b3e8669a3ce 100644
--- a/dep/ACE_wrappers/ace/Obstack_T.inl
+++ b/dep/ACE_wrappers/ace/Obstack_T.inl
@@ -1,15 +1,19 @@
// -*- C++ -*-
//
// $Id: Obstack_T.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template <class CHAR> ACE_INLINE size_t
ACE_Obstack_T<CHAR>::length () const
{
return this->size_ / sizeof (CHAR);
}
+
template <class CHAR> ACE_INLINE size_t
ACE_Obstack_T<CHAR>::size () const
{
return this->size_;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/PI_Malloc.cpp b/dep/ACE_wrappers/ace/PI_Malloc.cpp
index 142f1c60eee..4e27441f405 100644
--- a/dep/ACE_wrappers/ace/PI_Malloc.cpp
+++ b/dep/ACE_wrappers/ace/PI_Malloc.cpp
@@ -1,28 +1,37 @@
#ifndef ACE_PI_MALLOC_CPP
#define ACE_PI_MALLOC_CPP
+
#include "ace/PI_Malloc.h"
+
ACE_RCSID (ace,
PI_Malloc,
"$Id: PI_Malloc.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1)
+
#if !defined (__ACE_INLINE__)
#include "ace/PI_Malloc.inl"
#endif /* __ACE_INLINE__ */
+
#include "ace/Object_Manager.h"
#include "ace/Process_Mutex.h"
#include "ace/OS_NS_string.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
void
ACE_PI_Control_Block::ACE_Malloc_Header::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_PI_Control_Block::ACE_Malloc_Header::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nnext_block = %x"), (ACE_Malloc_Header *) this->next_block_));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nsize = %d\n"), this->size_));
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
void
ACE_PI_Control_Block::print_alignment_info (void)
{
@@ -58,32 +67,39 @@ ACE_PI_Control_Block::print_alignment_info (void)
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("End <--- ACE_PI_Control_Block::print_alignment_info:\n")));
#endif /* ACE_HAS_DUMP */
}
+
void
ACE_PI_Control_Block::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_PI_Control_Block::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Name Node:\n")));
for (ACE_Name_Node *nextn = this->name_head_;
nextn != 0;
nextn = nextn->next_)
nextn->dump ();
+
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("freep_ = %x"), (ACE_Malloc_Header *) this->freep_));
this->base_.dump ();
+
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nMalloc Header:\n")));
for (ACE_Malloc_Header *nexth = ((ACE_Malloc_Header *)this->freep_)->next_block_;
nexth != 0 && nexth != &this->base_;
nexth = nexth->next_block_)
nexth->dump ();
+
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n")));
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
ACE_PI_Control_Block::ACE_Name_Node::ACE_Name_Node (void)
{
ACE_TRACE ("ACE_PI_Control_Block::ACE_Name_Node::ACE_Name_Node");
}
+
ACE_PI_Control_Block::ACE_Name_Node::ACE_Name_Node (const char *name,
char *name_ptr,
char *pointer,
@@ -99,31 +115,37 @@ ACE_PI_Control_Block::ACE_Name_Node::ACE_Name_Node (const char *name,
if (next != 0)
next->prev_ = this;
}
+
ACE_PI_Control_Block::ACE_Name_Node::ACE_Name_Node (const ACE_Name_Node &)
{
ACE_TRACE ("ACE_PI_Control_Block::ACE_Name_Node::ACE_Name_Node");
ACE_ASSERT (0); // not implemented!
}
+
const char *
ACE_PI_Control_Block::ACE_Name_Node::name (void) const
{
return this->name_;
}
+
void
ACE_PI_Control_Block::ACE_Name_Node::name (const char *)
{
ACE_ASSERT (0); // not implemented yet.
}
+
ACE_PI_Control_Block::ACE_Malloc_Header::ACE_Malloc_Header (void)
: next_block_ (0),
size_ (0)
{
}
+
void
ACE_PI_Control_Block::ACE_Name_Node::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_PI_Control_Block::ACE_Name_Node::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT("pointer = %x"), (const char *) this->pointer_));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT("\nnext_ = %x"), (ACE_Name_Node *) this->next_));
@@ -135,7 +157,10 @@ ACE_PI_Control_Block::ACE_Name_Node::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1*/
+
#endif /* ACE_PI_MALLOC_CPP */
diff --git a/dep/ACE_wrappers/ace/PI_Malloc.h b/dep/ACE_wrappers/ace/PI_Malloc.h
index aa5c2040a4c..a1167fb6fad 100644
--- a/dep/ACE_wrappers/ace/PI_Malloc.h
+++ b/dep/ACE_wrappers/ace/PI_Malloc.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file PI_Malloc.h
@@ -9,17 +10,25 @@
* @author Based on code that existed in other ACE files.
*/
//==========================================================================
+
#ifndef ACE_PI_MALLOC_H
#define ACE_PI_MALLOC_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1)
+
#include "ace/Malloc.h"
#include "ace/Based_Pointer_T.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// prepare for position independent malloc
/**
* @class ACE_PI_Control_Block
@@ -37,9 +46,11 @@ class ACE_Export ACE_PI_Control_Block
public:
class ACE_Malloc_Header;
class ACE_Name_Node;
+
typedef ACE_Based_Pointer<ACE_Malloc_Header> MALLOC_HEADER_PTR;
typedef ACE_Based_Pointer<ACE_Name_Node> NAME_NODE_PTR;
typedef ACE_Based_Pointer_Basic<char> CHAR_PTR;
+
/**
* @class ACE_Malloc_Header
*
@@ -51,25 +62,34 @@ public:
{
public:
ACE_Malloc_Header (void);
+
/// Points to next block if on free list.
MALLOC_HEADER_PTR next_block_;
+
/// Initialize a malloc header pointer.
static void init_ptr (MALLOC_HEADER_PTR *ptr,
ACE_Malloc_Header *init,
void *base_addr);
+
/// Size of this header control block.
size_t size_;
+
# if !defined (ACE_PI_MALLOC_PADDING_SIZE)
# define ACE_PI_MALLOC_PADDING_SIZE ACE_MALLOC_ROUNDUP (ACE_MALLOC_HEADER_SIZE + sizeof (MALLOC_HEADER_PTR) + sizeof (size_t), ACE_MALLOC_ALIGN) - (sizeof (MALLOC_HEADER_PTR) + sizeof (size_t))
# endif /* !ACE_PI_MALLOC_PADDING_SIZE */
char padding_[(ACE_PI_MALLOC_PADDING_SIZE) ? ACE_PI_MALLOC_PADDING_SIZE : ACE_MALLOC_ALIGN];
+
/// Dump the state of the object.
void dump (void) const;
+
private:
+
// Disallow copy construction and assignment.
ACE_Malloc_Header (ACE_Malloc_Header const &);
void operator= (ACE_Malloc_Header const &);
+
};
+
/**
* @class ACE_Name_Node
*
@@ -89,44 +109,63 @@ public:
char *name_ptr,
char *pointer,
ACE_Name_Node *head);
+
/// Copy constructor.
ACE_Name_Node (const ACE_Name_Node &);
+
/// Constructor.
ACE_Name_Node (void);
+
/// Constructor.
~ACE_Name_Node (void);
+
/// Initialize a name node pointer.
static void init_ptr (NAME_NODE_PTR *ptr,
ACE_Name_Node *init,
void *base_addr);
+
/// Return a pointer to the name of this node.
const char *name (void) const;
+
/// Assign a name;
void name (const char *);
+
/// Name of the Node.
CHAR_PTR name_;
+
/// Pointer to the contents.
CHAR_PTR pointer_;
+
/// Pointer to the next node in the doubly-linked list.
NAME_NODE_PTR next_;
+
/// Pointer to the previous node in the doubly-linked list.
NAME_NODE_PTR prev_;
+
/// Dump the state of the object.
void dump (void) const;
+
private:
+
// Disallow assignment.
void operator= (const ACE_Name_Node &);
};
+
/// Print out a bunch of size info for debugging.
static void print_alignment_info (void);
+
/// Reference counter.
int ref_counter_;
+
/// Head of the linked list of Name Nodes.
NAME_NODE_PTR name_head_;
+
/// Current head of the freelist.
MALLOC_HEADER_PTR freep_;
+
/// Name of lock thats ensures mutual exclusion.
char lock_name_[MAXNAMELEN];
+
#if defined (ACE_HAS_MALLOC_STATS)
/// Keep statistics about ACE_Malloc state and performance.
ACE_Malloc_Stats malloc_stats_;
@@ -141,25 +180,35 @@ public:
+ sizeof (int) \
+ MAXNAMELEN))
#endif /* ACE_HAS_MALLOC_STATS */
+
# if !defined (ACE_PI_CONTROL_BLOCK_ALIGN_BYTES)
# define ACE_PI_CONTROL_BLOCK_ALIGN_BYTES \
ACE_MALLOC_ROUNDUP (ACE_PI_CONTROL_BLOCK_SIZE, ACE_MALLOC_ALIGN) - ACE_PI_CONTROL_BLOCK_SIZE
# endif /* !ACE_PI_CONTROL_BLOCK_ALIGN_LONGS */
/// Force alignment.
char align_[(ACE_PI_CONTROL_BLOCK_ALIGN_BYTES) ? ACE_PI_CONTROL_BLOCK_ALIGN_BYTES : ACE_MALLOC_ALIGN];
+
/// Dummy node used to anchor the freelist. This needs to come last...
ACE_Malloc_Header base_;
+
/// Dump the state of the object.
void dump (void) const;
+
private:
+
// Disallow assignment.
void operator= (const ACE_Control_Block &);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/PI_Malloc.inl"
#endif /* __ACE_INLINE__ */
+
#endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_PI_MALLOC_H */
diff --git a/dep/ACE_wrappers/ace/PI_Malloc.inl b/dep/ACE_wrappers/ace/PI_Malloc.inl
index 2af02889884..0828ebb8358 100644
--- a/dep/ACE_wrappers/ace/PI_Malloc.inl
+++ b/dep/ACE_wrappers/ace/PI_Malloc.inl
@@ -1,12 +1,16 @@
// -*- C++ -*-
//
// $Id: PI_Malloc.inl 80826 2008-03-04 14:51:23Z wotte $
+
#if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1)
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_PI_Control_Block::ACE_Name_Node::~ACE_Name_Node (void)
{
}
+
ACE_INLINE void
ACE_PI_Control_Block::ACE_Malloc_Header::init_ptr
(MALLOC_HEADER_PTR *ptr, ACE_Malloc_Header *init, void *base_addr)
@@ -14,6 +18,7 @@ ACE_PI_Control_Block::ACE_Malloc_Header::init_ptr
new ((void *) ptr) MALLOC_HEADER_PTR (base_addr, 0);
*ptr = init;
}
+
ACE_INLINE void
ACE_PI_Control_Block::ACE_Name_Node::init_ptr
(NAME_NODE_PTR *ptr, ACE_Name_Node *init, void *base_addr)
@@ -21,6 +26,8 @@ ACE_PI_Control_Block::ACE_Name_Node::init_ptr
new ((void *) ptr) NAME_NODE_PTR (base_addr, 0);
*ptr = init;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */
diff --git a/dep/ACE_wrappers/ace/POSIX_Asynch_IO.cpp b/dep/ACE_wrappers/ace/POSIX_Asynch_IO.cpp
index f540c7f9f99..26b9eb33164 100644
--- a/dep/ACE_wrappers/ace/POSIX_Asynch_IO.cpp
+++ b/dep/ACE_wrappers/ace/POSIX_Asynch_IO.cpp
@@ -1,6 +1,9 @@
// $Id: POSIX_Asynch_IO.cpp 81535 2008-04-29 20:08:52Z shuston $
+
#include "ace/POSIX_Asynch_IO.h"
+
#if defined (ACE_HAS_AIO_CALLS)
+
#include "ace/Flag_Manip.h"
#include "ace/Proactor.h"
#include "ace/Message_Block.h"
@@ -10,41 +13,50 @@
#include "ace/OS_NS_errno.h"
#include "ace/OS_NS_sys_socket.h"
#include "ace/OS_NS_sys_stat.h"
+
ACE_RCSID (ace,
POSIX_Asynch_IO,
"$Id: POSIX_Asynch_IO.cpp 81535 2008-04-29 20:08:52Z shuston $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
size_t
ACE_POSIX_Asynch_Result::bytes_transferred (void) const
{
return this->bytes_transferred_;
}
+
void
ACE_POSIX_Asynch_Result::set_bytes_transferred (size_t nbytes)
{
this->bytes_transferred_= nbytes;
}
+
const void *
ACE_POSIX_Asynch_Result::act (void) const
{
return this->act_;
}
+
int
ACE_POSIX_Asynch_Result::success (void) const
{
return this->success_;
}
+
const void *
ACE_POSIX_Asynch_Result::completion_key (void) const
{
return this->completion_key_;
}
+
u_long
ACE_POSIX_Asynch_Result::error (void) const
{
return this->error_;
}
+
void
ACE_POSIX_Asynch_Result::set_error (u_long errcode)
{
@@ -55,11 +67,13 @@ ACE_POSIX_Asynch_Result::event (void) const
{
return ACE_INVALID_HANDLE;
}
+
u_long
ACE_POSIX_Asynch_Result::offset (void) const
{
return this->aio_offset;
}
+
u_long
ACE_POSIX_Asynch_Result::offset_high (void) const
{
@@ -68,29 +82,36 @@ ACE_POSIX_Asynch_Result::offset_high (void) const
//
ACE_NOTSUP_RETURN (0);
}
+
int
ACE_POSIX_Asynch_Result::priority (void) const
{
return this->aio_reqprio;
}
+
int
ACE_POSIX_Asynch_Result::signal_number (void) const
{
return this->aio_sigevent.sigev_signo;
}
+
int
ACE_POSIX_Asynch_Result::post_completion (ACE_Proactor_Impl *proactor_impl)
{
// Get to the platform specific implementation.
ACE_POSIX_Proactor *posix_proactor = dynamic_cast<ACE_POSIX_Proactor *> (proactor_impl);
+
if (posix_proactor == 0)
ACE_ERROR_RETURN ((LM_ERROR, "Dynamic cast to POSIX Proactor failed\n"), -1);
+
// Post myself.
return posix_proactor->post_completion (this);
}
+
ACE_POSIX_Asynch_Result::~ACE_POSIX_Asynch_Result (void)
{
}
+
ACE_POSIX_Asynch_Result::ACE_POSIX_Asynch_Result
(const ACE_Handler::Proxy_Ptr &handler_proxy,
const void* act,
@@ -109,14 +130,18 @@ ACE_POSIX_Asynch_Result::ACE_POSIX_Asynch_Result
aio_offset = offset;
aio_reqprio = priority;
aio_sigevent.sigev_signo = signal_number;
+
//
// @@ Support offset_high with aiocb64.
//
ACE_UNUSED_ARG (offset_high);
+
// Other fields in the <aiocb> will be initialized by the
// subclasses.
}
+
// ****************************************************************
+
int
ACE_POSIX_Asynch_Operation::open (const ACE_Handler::Proxy_Ptr &handler_proxy,
ACE_HANDLE handle,
@@ -126,6 +151,7 @@ ACE_POSIX_Asynch_Operation::open (const ACE_Handler::Proxy_Ptr &handler_proxy,
this->proactor_ = proactor;
this->handler_proxy_ = handler_proxy;
this->handle_ = handle;
+
// Grab the handle from the <handler> if <handle> is invalid
if (this->handle_ == ACE_INVALID_HANDLE)
{
@@ -135,10 +161,12 @@ ACE_POSIX_Asynch_Operation::open (const ACE_Handler::Proxy_Ptr &handler_proxy,
}
if (this->handle_ == ACE_INVALID_HANDLE)
return -1;
+
#if 0
// @@ If <proactor> is 0, let us not bother about getting this
// Proactor, we have already got the specific implementation
// Proactor.
+
// If no proactor was passed
if (this->proactor_ == 0)
{
@@ -149,8 +177,10 @@ ACE_POSIX_Asynch_Operation::open (const ACE_Handler::Proxy_Ptr &handler_proxy,
this->proactor_ = ACE_Proactor::instance();
}
#endif /* 0 */
+
return 0;
}
+
int
ACE_POSIX_Asynch_Operation::cancel (void)
{
@@ -158,40 +188,49 @@ ACE_POSIX_Asynch_Operation::cancel (void)
return -1;
return posix_proactor_->cancel_aio (this->handle_);
}
+
ACE_Proactor *
ACE_POSIX_Asynch_Operation::proactor (void) const
{
return this->proactor_;
}
+
ACE_POSIX_Proactor *
ACE_POSIX_Asynch_Operation::posix_proactor (void) const
{
return this->posix_proactor_;
}
+
ACE_POSIX_Asynch_Operation::~ACE_POSIX_Asynch_Operation (void)
{
}
+
ACE_POSIX_Asynch_Operation::ACE_POSIX_Asynch_Operation (ACE_POSIX_Proactor *posix_proactor)
: posix_proactor_ (posix_proactor),
handle_ (ACE_INVALID_HANDLE)
{
}
+
// *********************************************************************
+
size_t
ACE_POSIX_Asynch_Read_Stream_Result::bytes_to_read (void) const
{
return this->aio_nbytes;
}
+
ACE_Message_Block &
ACE_POSIX_Asynch_Read_Stream_Result::message_block (void) const
{
return this->message_block_;
}
+
ACE_HANDLE
ACE_POSIX_Asynch_Read_Stream_Result::handle (void) const
{
return this->aio_fildes;
}
+
ACE_POSIX_Asynch_Read_Stream_Result::ACE_POSIX_Asynch_Read_Stream_Result
(const ACE_Handler::Proxy_Ptr &handler_proxy,
ACE_HANDLE handle,
@@ -209,6 +248,7 @@ ACE_POSIX_Asynch_Read_Stream_Result::ACE_POSIX_Asynch_Read_Stream_Result
this->aio_buf = message_block.wr_ptr ();
this->aio_nbytes = bytes_to_read;
}
+
void
ACE_POSIX_Asynch_Read_Stream_Result::complete (size_t bytes_transferred,
int success,
@@ -219,25 +259,33 @@ ACE_POSIX_Asynch_Read_Stream_Result::complete (size_t bytes_transferred,
this->success_ = success;
this->completion_key_ = completion_key;
this->error_ = error;
+
// <errno> is available in the aiocb.
ACE_UNUSED_ARG (error);
+
// Appropriately move the pointers in the message block.
this->message_block_.wr_ptr (bytes_transferred);
+
// Create the interface result class.
ACE_Asynch_Read_Stream::Result result (this);
+
// Call the application handler.
ACE_Handler *handler = this->handler_proxy_.get ()->handler ();
if (handler != 0)
handler->handle_read_stream (result);
}
+
ACE_POSIX_Asynch_Read_Stream_Result::~ACE_POSIX_Asynch_Read_Stream_Result (void)
{
}
+
// ************************************************************
+
ACE_POSIX_Asynch_Read_Stream::ACE_POSIX_Asynch_Read_Stream (ACE_POSIX_Proactor *posix_proactor)
: ACE_POSIX_Asynch_Operation (posix_proactor)
{
}
+
int
ACE_POSIX_Asynch_Read_Stream::read (ACE_Message_Block &message_block,
size_t bytes_to_read,
@@ -248,11 +296,13 @@ ACE_POSIX_Asynch_Read_Stream::read (ACE_Message_Block &message_block,
size_t space = message_block.space ();
if (bytes_to_read > space)
bytes_to_read=space;
+
if (bytes_to_read == 0)
{
errno = ENOSPC;
return -1;
}
+
// Create the Asynch_Result.
ACE_POSIX_Asynch_Read_Stream_Result *result = 0;
ACE_POSIX_Proactor *proactor = this->posix_proactor ();
@@ -266,30 +316,38 @@ ACE_POSIX_Asynch_Read_Stream::read (ACE_Message_Block &message_block,
priority,
signal_number),
-1);
+
int return_val = proactor->start_aio (result, ACE_POSIX_Proactor::ACE_OPCODE_READ);
if (return_val == -1)
delete result;
+
return return_val;
}
+
ACE_POSIX_Asynch_Read_Stream::~ACE_POSIX_Asynch_Read_Stream (void)
{
}
+
// *********************************************************************
+
size_t
ACE_POSIX_Asynch_Write_Stream_Result::bytes_to_write (void) const
{
return this->aio_nbytes;
}
+
ACE_Message_Block &
ACE_POSIX_Asynch_Write_Stream_Result::message_block (void) const
{
return this->message_block_;
}
+
ACE_HANDLE
ACE_POSIX_Asynch_Write_Stream_Result::handle (void) const
{
return this->aio_fildes;
}
+
ACE_POSIX_Asynch_Write_Stream_Result::ACE_POSIX_Asynch_Write_Stream_Result
(const ACE_Handler::Proxy_Ptr &handler_proxy,
ACE_HANDLE handle,
@@ -307,6 +365,7 @@ ACE_POSIX_Asynch_Write_Stream_Result::ACE_POSIX_Asynch_Write_Stream_Result
this->aio_buf = message_block.rd_ptr ();
this->aio_nbytes = bytes_to_write;
}
+
void
ACE_POSIX_Asynch_Write_Stream_Result::complete (size_t bytes_transferred,
int success,
@@ -318,25 +377,33 @@ ACE_POSIX_Asynch_Write_Stream_Result::complete (size_t bytes_transferred,
this->success_ = success;
this->completion_key_ = completion_key;
this->error_ = error;
+
// <errno> is available in the aiocb.
ACE_UNUSED_ARG (error);
+
// Appropriately move the pointers in the message block.
this->message_block_.rd_ptr (bytes_transferred);
+
// Create the interface result class.
ACE_Asynch_Write_Stream::Result result (this);
+
// Call the application handler.
ACE_Handler *handler = this->handler_proxy_.get ()->handler ();
if (handler != 0)
handler->handle_write_stream (result);
}
+
ACE_POSIX_Asynch_Write_Stream_Result::~ACE_POSIX_Asynch_Write_Stream_Result (void)
{
}
+
// *********************************************************************
+
ACE_POSIX_Asynch_Write_Stream::ACE_POSIX_Asynch_Write_Stream (ACE_POSIX_Proactor *posix_proactor)
: ACE_POSIX_Asynch_Operation (posix_proactor)
{
}
+
int
ACE_POSIX_Asynch_Write_Stream::write (ACE_Message_Block &message_block,
size_t bytes_to_write,
@@ -347,12 +414,14 @@ ACE_POSIX_Asynch_Write_Stream::write (ACE_Message_Block &message_block,
size_t len = message_block.length ();
if (bytes_to_write > len)
bytes_to_write = len;
+
if (bytes_to_write == 0)
ACE_ERROR_RETURN
((LM_ERROR,
ACE_TEXT ("ACE_POSIX_Asynch_Write_Stream::write:")
ACE_TEXT ("Attempt to write 0 bytes\n")),
-1);
+
ACE_POSIX_Asynch_Write_Stream_Result *result = 0;
ACE_POSIX_Proactor *proactor = this->posix_proactor ();
ACE_NEW_RETURN (result,
@@ -365,15 +434,20 @@ ACE_POSIX_Asynch_Write_Stream::write (ACE_Message_Block &message_block,
priority,
signal_number),
-1);
+
int return_val = proactor->start_aio (result, ACE_POSIX_Proactor::ACE_OPCODE_WRITE);
if (return_val == -1)
delete result;
+
return return_val;
}
+
ACE_POSIX_Asynch_Write_Stream::~ACE_POSIX_Asynch_Write_Stream (void)
{
}
+
// *********************************************************************
+
ACE_POSIX_Asynch_Read_File_Result::ACE_POSIX_Asynch_Read_File_Result
(const ACE_Handler::Proxy_Ptr &handler_proxy,
ACE_HANDLE handle,
@@ -400,6 +474,7 @@ ACE_POSIX_Asynch_Read_File_Result::ACE_POSIX_Asynch_Read_File_Result
//
ACE_UNUSED_ARG (offset_high);
}
+
void
ACE_POSIX_Asynch_Read_File_Result::complete (size_t bytes_transferred,
int success,
@@ -411,25 +486,33 @@ ACE_POSIX_Asynch_Read_File_Result::complete (size_t bytes_transferred,
this->success_ = success;
this->completion_key_ = completion_key;
this->error_ = error;
+
// <errno> is available in the aiocb.
ACE_UNUSED_ARG (error);
+
// Appropriately move the pointers in the message block.
this->message_block_.wr_ptr (bytes_transferred);
+
// Create the interface result class.
ACE_Asynch_Read_File::Result result (this);
+
// Call the application handler.
ACE_Handler *handler = this->handler_proxy_.get ()->handler ();
if (handler != 0)
handler->handle_read_file (result);
}
+
ACE_POSIX_Asynch_Read_File_Result::~ACE_POSIX_Asynch_Read_File_Result (void)
{
}
+
// *********************************************************************
+
ACE_POSIX_Asynch_Read_File::ACE_POSIX_Asynch_Read_File (ACE_POSIX_Proactor *posix_proactor)
: ACE_POSIX_Asynch_Read_Stream (posix_proactor)
{
}
+
int
ACE_POSIX_Asynch_Read_File::read (ACE_Message_Block &message_block,
size_t bytes_to_read,
@@ -442,12 +525,14 @@ ACE_POSIX_Asynch_Read_File::read (ACE_Message_Block &message_block,
size_t space = message_block.space ();
if ( bytes_to_read > space )
bytes_to_read=space;
+
if ( bytes_to_read == 0 )
ACE_ERROR_RETURN
((LM_ERROR,
ACE_TEXT ("ACE_POSIX_Asynch_Read_File::read:")
ACE_TEXT ("Attempt to read 0 bytes or no space in the message block\n")),
-1);
+
ACE_POSIX_Asynch_Read_File_Result *result = 0;
ACE_POSIX_Proactor *proactor = this->posix_proactor ();
ACE_NEW_RETURN (result,
@@ -462,14 +547,18 @@ ACE_POSIX_Asynch_Read_File::read (ACE_Message_Block &message_block,
priority,
signal_number),
-1);
+
int return_val = proactor->start_aio (result, ACE_POSIX_Proactor::ACE_OPCODE_READ);
if (return_val == -1)
delete result;
+
return return_val;
}
+
ACE_POSIX_Asynch_Read_File::~ACE_POSIX_Asynch_Read_File (void)
{
}
+
int
ACE_POSIX_Asynch_Read_File::read (ACE_Message_Block &message_block,
size_t bytes_to_read,
@@ -483,7 +572,9 @@ ACE_POSIX_Asynch_Read_File::read (ACE_Message_Block &message_block,
priority,
signal_number);
}
+
// ************************************************************
+
ACE_POSIX_Asynch_Write_File_Result::ACE_POSIX_Asynch_Write_File_Result
(const ACE_Handler::Proxy_Ptr &handler_proxy,
ACE_HANDLE handle,
@@ -510,6 +601,7 @@ ACE_POSIX_Asynch_Write_File_Result::ACE_POSIX_Asynch_Write_File_Result
//
ACE_UNUSED_ARG (offset_high);
}
+
void
ACE_POSIX_Asynch_Write_File_Result::complete (size_t bytes_transferred,
int success,
@@ -521,25 +613,33 @@ ACE_POSIX_Asynch_Write_File_Result::complete (size_t bytes_transferred,
this->success_ = success;
this->completion_key_ = completion_key;
this->error_ = error;
+
// <error> is available in <aio_resultp.aio_error>
ACE_UNUSED_ARG (error);
+
// Appropriately move the pointers in the message block.
this->message_block_.rd_ptr (bytes_transferred);
+
// Create the interface result class.
ACE_Asynch_Write_File::Result result (this);
+
// Call the application handler.
ACE_Handler *handler = this->handler_proxy_.get ()->handler ();
if (handler != 0)
handler->handle_write_file (result);
}
+
ACE_POSIX_Asynch_Write_File_Result::~ACE_POSIX_Asynch_Write_File_Result (void)
{
}
+
// *********************************************************************
+
ACE_POSIX_Asynch_Write_File::ACE_POSIX_Asynch_Write_File (ACE_POSIX_Proactor *posix_proactor)
: ACE_POSIX_Asynch_Write_Stream (posix_proactor)
{
}
+
int
ACE_POSIX_Asynch_Write_File::write (ACE_Message_Block &message_block,
size_t bytes_to_write,
@@ -552,12 +652,14 @@ ACE_POSIX_Asynch_Write_File::write (ACE_Message_Block &message_block,
size_t len = message_block.length ();
if (bytes_to_write > len)
bytes_to_write = len;
+
if (bytes_to_write == 0)
ACE_ERROR_RETURN
((LM_ERROR,
ACE_TEXT ("ACE_POSIX_Asynch_Write_File::write:")
ACE_TEXT ("Attempt to write 0 bytes\n")),
-1);
+
ACE_POSIX_Asynch_Write_File_Result *result = 0;
ACE_POSIX_Proactor *proactor = this->posix_proactor ();
ACE_NEW_RETURN (result,
@@ -572,14 +674,18 @@ ACE_POSIX_Asynch_Write_File::write (ACE_Message_Block &message_block,
priority,
signal_number),
-1);
+
int return_val = proactor->start_aio (result, ACE_POSIX_Proactor::ACE_OPCODE_WRITE);
if (return_val == -1)
delete result;
+
return return_val;
}
+
ACE_POSIX_Asynch_Write_File::~ACE_POSIX_Asynch_Write_File (void)
{
}
+
int
ACE_POSIX_Asynch_Write_File::write (ACE_Message_Block &message_block,
size_t bytes_to_write,
@@ -593,28 +699,34 @@ ACE_POSIX_Asynch_Write_File::write (ACE_Message_Block &message_block,
priority,
signal_number);
}
+
// *********************************************************************
+
size_t
ACE_POSIX_Asynch_Accept_Result::bytes_to_read (void) const
{
return this->aio_nbytes;
}
+
ACE_Message_Block &
ACE_POSIX_Asynch_Accept_Result::message_block (void) const
{
return this->message_block_;
}
+
ACE_HANDLE
ACE_POSIX_Asynch_Accept_Result::listen_handle (void) const
{
return this->listen_handle_;
}
+
ACE_HANDLE
ACE_POSIX_Asynch_Accept_Result::accept_handle (void) const
{
return this->aio_fildes;
}
+
ACE_POSIX_Asynch_Accept_Result::ACE_POSIX_Asynch_Accept_Result
(const ACE_Handler::Proxy_Ptr &handler_proxy,
ACE_HANDLE listen_handle,
@@ -625,6 +737,7 @@ ACE_POSIX_Asynch_Accept_Result::ACE_POSIX_Asynch_Accept_Result
ACE_HANDLE event,
int priority,
int signal_number)
+
: ACE_POSIX_Asynch_Result
(handler_proxy, act, event, 0, 0, priority, signal_number),
message_block_ (message_block),
@@ -633,6 +746,7 @@ ACE_POSIX_Asynch_Accept_Result::ACE_POSIX_Asynch_Accept_Result
this->aio_fildes = accept_handle;
this->aio_nbytes = bytes_to_read;
}
+
void
ACE_POSIX_Asynch_Accept_Result::complete (size_t bytes_transferred,
int success,
@@ -644,40 +758,50 @@ ACE_POSIX_Asynch_Accept_Result::complete (size_t bytes_transferred,
this->success_ = success;
this->completion_key_ = completion_key;
this->error_ = error;
+
// Appropriately move the pointers in the message block.
this->message_block_.wr_ptr (bytes_transferred);
+
// Create the interface result class.
ACE_Asynch_Accept::Result result (this);
+
// Call the application handler.
ACE_Handler *handler = this->handler_proxy_.get ()->handler ();
if (handler != 0)
handler->handle_accept (result);
}
+
ACE_POSIX_Asynch_Accept_Result::~ACE_POSIX_Asynch_Accept_Result (void)
{
}
+
// *********************************************************************
+
ACE_POSIX_Asynch_Accept::ACE_POSIX_Asynch_Accept (ACE_POSIX_Proactor * posix_proactor)
: ACE_POSIX_Asynch_Operation (posix_proactor),
flg_open_ (false)
{
}
+
ACE_POSIX_Asynch_Accept::~ACE_POSIX_Asynch_Accept (void)
{
this->close ();
this->reactor (0); // to avoid purge_pending_notifications
}
+
ACE_HANDLE
ACE_POSIX_Asynch_Accept::get_handle (void) const
{
return this->handle_;
}
+
void
ACE_POSIX_Asynch_Accept::set_handle (ACE_HANDLE handle)
{
ACE_ASSERT (handle_ == ACE_INVALID_HANDLE);
this->handle_ = handle;
}
+
int
ACE_POSIX_Asynch_Accept::open (const ACE_Handler::Proxy_Ptr &handler_proxy,
ACE_HANDLE handle,
@@ -685,6 +809,7 @@ ACE_POSIX_Asynch_Accept::open (const ACE_Handler::Proxy_Ptr &handler_proxy,
ACE_Proactor *proactor)
{
ACE_TRACE ("ACE_POSIX_Asynch_Accept::open");
+
// if we are already opened,
// we could not create a new handler without closing the previous
if (this->flg_open_)
@@ -692,14 +817,18 @@ ACE_POSIX_Asynch_Accept::open (const ACE_Handler::Proxy_Ptr &handler_proxy,
ACE_TEXT("%N:%l:ACE_POSIX_Asynch_Accept::open:")
ACE_TEXT("acceptor already open \n")),
-1);
+
if (-1 == ACE_POSIX_Asynch_Operation::open (handler_proxy,
handle,
completion_key,
proactor))
return -1;
+
flg_open_ = true;
+
ACE_Asynch_Pseudo_Task & task =
this->posix_proactor ()->get_asynch_pseudo_task ();
+
if (-1 == task.register_io_handler (this->get_handle(),
this,
ACE_Event_Handler::ACCEPT_MASK,
@@ -709,8 +838,10 @@ ACE_POSIX_Asynch_Accept::open (const ACE_Handler::Proxy_Ptr &handler_proxy,
this->handle_ = ACE_INVALID_HANDLE;
return -1 ;
}
+
return 0;
}
+
int
ACE_POSIX_Asynch_Accept::accept (ACE_Message_Block &message_block,
size_t bytes_to_read,
@@ -721,11 +852,13 @@ ACE_POSIX_Asynch_Accept::accept (ACE_Message_Block &message_block,
int addr_family)
{
ACE_TRACE ("ACE_POSIX_Asynch_Accept::accept");
+
if (!this->flg_open_)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT("%N:%l:ACE_POSIX_Asynch_Accept::accept")
ACE_TEXT("acceptor was not opened before\n")),
-1);
+
// Sanity check: make sure that enough space has been allocated by
// the caller.
size_t address_size = sizeof (sockaddr_in);
@@ -737,11 +870,13 @@ ACE_POSIX_Asynch_Accept::accept (ACE_Message_Block &message_block,
#endif
size_t available_space = message_block.space ();
size_t space_needed = bytes_to_read + 2 * address_size;
+
if (available_space < space_needed)
{
ACE_OS::last_error (ENOBUFS);
return -1;
}
+
// Common code for both WIN and POSIX.
// Create future Asynch_Accept_Result
ACE_POSIX_Asynch_Accept_Result *result = 0;
@@ -756,6 +891,7 @@ ACE_POSIX_Asynch_Accept::accept (ACE_Message_Block &message_block,
priority,
signal_number),
-1);
+
// Enqueue result
{
ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1));
@@ -767,15 +903,20 @@ ACE_POSIX_Asynch_Accept::accept (ACE_Message_Block &message_block,
delete result; // to avoid memory leak
return -1;
}
+
if (this->result_queue_.size () > 1)
return 0;
}
+
// If this is the only item, then it means there the set was empty
// before. So enable the accept handle in the reactor.
+
ACE_Asynch_Pseudo_Task & task =
this->posix_proactor ()->get_asynch_pseudo_task ();
+
return task.resume_io_handler (this->get_handle ());
}
+
//@@ New method cancel_uncompleted
// It performs cancellation of all pending requests
//
@@ -787,17 +928,23 @@ ACE_POSIX_Asynch_Accept::accept (ACE_Message_Block &message_block,
//
// Return value : number of cancelled requests
//
+
int
ACE_POSIX_Asynch_Accept::cancel_uncompleted (int flg_notify)
{
ACE_TRACE ("ACE_POSIX_Asynch_Accept::cancel_uncompleted");
+
int retval = 0;
+
for (; ; retval++)
{
ACE_POSIX_Asynch_Accept_Result* result = 0;
+
this->result_queue_.dequeue_head (result);
+
if (result == 0)
break;
+
if (this->flg_open_ == 0 || flg_notify == 0) //if we should not notify
delete result ; // we have to delete result
else //else notify as any cancelled AIO
@@ -806,6 +953,7 @@ ACE_POSIX_Asynch_Accept::cancel_uncompleted (int flg_notify)
result->aio_fildes = ACE_INVALID_HANDLE ;
result->set_bytes_transferred (0);
result->set_error (ECANCELED);
+
if (this->posix_proactor ()->post_completion (result) == -1)
ACE_ERROR ((LM_ERROR,
ACE_TEXT("(%P | %t):%p\n"),
@@ -816,33 +964,44 @@ ACE_POSIX_Asynch_Accept::cancel_uncompleted (int flg_notify)
}
return retval;
}
+
int
ACE_POSIX_Asynch_Accept::cancel (void)
{
ACE_TRACE ("ACE_POSIX_Asynch_Accept::cancel");
+
// Since this is not a real POSIX asynch I/O operation, we can't
// call ::aiocancel () or ACE_POSIX_Asynch_Operation::cancel ().
// We delegate real cancelation to cancel_uncompleted (1)
+
int rc = -1 ; // ERRORS
+
{
ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1));
+
int num_cancelled = cancel_uncompleted (flg_open_);
+
if (num_cancelled == 0)
rc = 1 ; // AIO_ALLDONE
else if (num_cancelled > 0)
rc = 0 ; // AIO_CANCELED
+
if (!this->flg_open_)
return rc ;
}
+
ACE_Asynch_Pseudo_Task & task =
this->posix_proactor ()->get_asynch_pseudo_task ();
+
task.suspend_io_handler (this->get_handle());
return 0;
}
+
int
ACE_POSIX_Asynch_Accept::close ()
{
ACE_TRACE ("ACE_POSIX_Asynch_Accept::close");
+
// 1. It performs cancellation of all pending requests
// 2. Removes itself from Reactor ( ACE_Asynch_Pseudo_Task)
// 3. close the socket
@@ -855,10 +1014,12 @@ ACE_POSIX_Asynch_Accept::close ()
//
// Return codes : 0 - OK ,
// -1 - Errors
+
{
ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1));
this->cancel_uncompleted (flg_open_);
}
+
if (!this->flg_open_)
{
if (this->handle_ != ACE_INVALID_HANDLE)
@@ -868,65 +1029,86 @@ ACE_POSIX_Asynch_Accept::close ()
}
return 0;
}
+
if (this->handle_ == ACE_INVALID_HANDLE)
return 0;
+
ACE_Asynch_Pseudo_Task & task =
this->posix_proactor ()->get_asynch_pseudo_task ();
+
task.remove_io_handler (this->get_handle ());
if (this->handle_ != ACE_INVALID_HANDLE)
{
ACE_OS::closesocket (this->handle_);
this->handle_ = ACE_INVALID_HANDLE;
}
+
this->flg_open_ = false;
+
return 0;
}
+
int
ACE_POSIX_Asynch_Accept::handle_close (ACE_HANDLE, ACE_Reactor_Mask)
{
ACE_TRACE ("ACE_POSIX_Asynch_Accept::handle_close");
+
ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, 0));
+
// handle_close is called in two cases:
// 1. Pseudo task is closing (i.e. proactor destructor)
// 2. The listen handle is closed (we don't have exclusive access to this)
+
this->cancel_uncompleted (0);
+
this->flg_open_ = false;
this->handle_ = ACE_INVALID_HANDLE;
return 0;
}
+
int
ACE_POSIX_Asynch_Accept::handle_input (ACE_HANDLE /* fd */)
{
ACE_TRACE ("ACE_POSIX_Asynch_Accept::handle_input");
+
// An <accept> has been sensed on the <listen_handle>. We should be
// able to just go ahead and do the <accept> now on this <fd>. This
// should be the same as the <listen_handle>.
+
ACE_POSIX_Asynch_Accept_Result* result = 0;
+
{
ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, 0));
+
// Deregister this info pertaining to this accept call.
if (this->result_queue_.dequeue_head (result) != 0)
ACE_ERROR ((LM_ERROR,
ACE_TEXT("%N:%l:(%P | %t):%p\n"),
ACE_TEXT("ACE_POSIX_Asynch_Accept::handle_input:")
ACE_TEXT( " dequeueing failed")));
+
// Disable the handle in the reactor if no more accepts are pending.
if (this->result_queue_.size () == 0)
{
ACE_Asynch_Pseudo_Task & task =
this->posix_proactor ()->get_asynch_pseudo_task ();
+
task.suspend_io_handler (this->get_handle());
}
}
+
// Issue <accept> now.
// @@ We shouldnt block here since we have already done poll/select
// thru reactor. But are we sure?
+
ACE_HANDLE new_handle = ACE_OS::accept (this->handle_, 0, 0);
+
if (result == 0) // there is nobody to notify
{
ACE_OS::closesocket (new_handle);
return 0;
}
+
if (new_handle == ACE_INVALID_HANDLE)
{
result->set_error (errno);
@@ -934,10 +1116,13 @@ ACE_POSIX_Asynch_Accept::handle_input (ACE_HANDLE /* fd */)
ACE_TEXT("%N:%l:(%P | %t):%p\n"),
ACE_TEXT("ACE_POSIX_Asynch_Accept::handle_input: ")
ACE_TEXT("accept")));
+
// Notify client as usual, "AIO" finished with errors
}
+
// Store the new handle.
result->aio_fildes = new_handle;
+
// Notify the main process about this completion
// Send the Result through the notification pipe.
if (this->posix_proactor ()->post_completion (result) == -1)
@@ -945,19 +1130,24 @@ ACE_POSIX_Asynch_Accept::handle_input (ACE_HANDLE /* fd */)
ACE_TEXT("Error:(%P | %t):%p\n"),
ACE_TEXT("ACE_POSIX_Asynch_Accept::handle_input: ")
ACE_TEXT(" <post_completion> failed")));
+
return 0;
}
+
// *********************************************************************
+
ACE_HANDLE
ACE_POSIX_Asynch_Connect_Result::connect_handle (void) const
{
return this->aio_fildes;
}
+
void ACE_POSIX_Asynch_Connect_Result::connect_handle (ACE_HANDLE handle)
{
this->aio_fildes = handle;
}
+
ACE_POSIX_Asynch_Connect_Result::ACE_POSIX_Asynch_Connect_Result
(const ACE_Handler::Proxy_Ptr &handler_proxy,
ACE_HANDLE connect_handle,
@@ -971,6 +1161,7 @@ ACE_POSIX_Asynch_Connect_Result::ACE_POSIX_Asynch_Connect_Result
this->aio_fildes = connect_handle;
this->aio_nbytes = 0;
}
+
void
ACE_POSIX_Asynch_Connect_Result::complete (size_t bytes_transferred,
int success,
@@ -982,38 +1173,47 @@ ACE_POSIX_Asynch_Connect_Result::complete (size_t bytes_transferred,
this->success_ = success;
this->completion_key_ = completion_key;
this->error_ = error;
+
// Create the interface result class.
ACE_Asynch_Connect::Result result (this);
+
// Call the application handler.
ACE_Handler *handler = this->handler_proxy_.get ()->handler ();
if (handler != 0)
handler->handle_connect (result);
}
+
ACE_POSIX_Asynch_Connect_Result::~ACE_POSIX_Asynch_Connect_Result (void)
{
}
+
// *********************************************************************
+
ACE_POSIX_Asynch_Connect::ACE_POSIX_Asynch_Connect (ACE_POSIX_Proactor * posix_proactor)
: ACE_POSIX_Asynch_Operation (posix_proactor),
flg_open_ (false)
{
}
+
ACE_POSIX_Asynch_Connect::~ACE_POSIX_Asynch_Connect (void)
{
this->close ();
this->reactor(0); // to avoid purge_pending_notifications
}
+
ACE_HANDLE
ACE_POSIX_Asynch_Connect::get_handle (void) const
{
ACE_ASSERT (0);
return ACE_INVALID_HANDLE;
}
+
void
ACE_POSIX_Asynch_Connect::set_handle (ACE_HANDLE)
{
ACE_ASSERT (0) ;
}
+
int
ACE_POSIX_Asynch_Connect::open (const ACE_Handler::Proxy_Ptr &handler_proxy,
ACE_HANDLE handle,
@@ -1021,19 +1221,25 @@ ACE_POSIX_Asynch_Connect::open (const ACE_Handler::Proxy_Ptr &handler_proxy,
ACE_Proactor *proactor)
{
ACE_TRACE ("ACE_POSIX_Asynch_Connect::open");
+
if (this->flg_open_)
return -1;
+
//int result =
ACE_POSIX_Asynch_Operation::open (handler_proxy,
handle,
completion_key,
proactor);
+
// Ignore result as we pass ACE_INVALID_HANDLE
//if (result == -1)
// return result;
+
this->flg_open_ = true;
+
return 0;
}
+
int
ACE_POSIX_Asynch_Connect::connect (ACE_HANDLE connect_handle,
const ACE_Addr & remote_sap,
@@ -1044,11 +1250,13 @@ ACE_POSIX_Asynch_Connect::connect (ACE_HANDLE connect_handle,
int signal_number)
{
ACE_TRACE ("ACE_POSIX_Asynch_Connect::connect");
+
if (this->flg_open_ == 0)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT("%N:%l:ACE_POSIX_Asynch_Connect::connect")
ACE_TEXT("connector was not opened before\n")),
-1);
+
// Common code for both WIN and POSIX.
// Create future Asynch_Connect_Result
ACE_POSIX_Asynch_Connect_Result *result = 0;
@@ -1060,29 +1268,37 @@ ACE_POSIX_Asynch_Connect::connect (ACE_HANDLE connect_handle,
priority,
signal_number),
-1);
+
int rc = connect_i (result,
remote_sap,
local_sap,
reuse_addr);
+
// update handle
connect_handle = result->connect_handle ();
+
if (rc != 0)
return post_result (result, true);
+
// Enqueue result we will wait for completion
{
ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1));
+
if (this->result_map_.bind (connect_handle, result) == -1)
{
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("%N:%l:%p\n"),
ACE_TEXT ("ACE_POSIX_Asynch_Connect::connect:")
ACE_TEXT ("bind")));
+
result->set_error (EFAULT);
return post_result (result, true);
}
}
+
ACE_Asynch_Pseudo_Task & task =
this->posix_proactor ()->get_asynch_pseudo_task ();
+
rc = task.register_io_handler (connect_handle,
this,
ACE_Event_Handler::CONNECT_MASK,
@@ -1091,6 +1307,7 @@ ACE_POSIX_Asynch_Connect::connect (ACE_HANDLE connect_handle,
{
{
ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1));
+
this->result_map_.unbind (connect_handle, result);
}
if (result != 0)
@@ -1103,8 +1320,10 @@ ACE_POSIX_Asynch_Connect::connect (ACE_HANDLE connect_handle,
else
result = 0;
+
return 0;
}
+
int ACE_POSIX_Asynch_Connect::post_result (ACE_POSIX_Asynch_Connect_Result * result,
bool post_enable)
{
@@ -1112,22 +1331,29 @@ int ACE_POSIX_Asynch_Connect::post_result (ACE_POSIX_Asynch_Connect_Result * res
{
if (this->posix_proactor ()->post_completion (result) == 0)
return 0;
+
ACE_ERROR ((LM_ERROR,
ACE_TEXT("Error:(%P | %t):%p\n"),
ACE_TEXT("ACE_POSIX_Asynch_Connect::post_result: ")
ACE_TEXT(" <post_completion> failed")));
}
+
ACE_HANDLE handle = result->connect_handle ();
+
if (handle != ACE_INVALID_HANDLE)
ACE_OS::closesocket (handle);
+
delete result;
+
return -1;
}
+
//connect_i
// return code :
// -1 errors before attempt to connect
// 0 connect started
// 1 connect finished ( may be unsuccessfully)
+
int
ACE_POSIX_Asynch_Connect::connect_i (ACE_POSIX_Asynch_Connect_Result *result,
const ACE_Addr & remote_sap,
@@ -1135,10 +1361,13 @@ ACE_POSIX_Asynch_Connect::connect_i (ACE_POSIX_Asynch_Connect_Result *result,
int reuse_addr)
{
result->set_bytes_transferred (0);
+
ACE_HANDLE handle = result->connect_handle ();
+
if (handle == ACE_INVALID_HANDLE)
{
int protocol_family = remote_sap.get_type ();
+
handle = ACE_OS::socket (protocol_family,
SOCK_STREAM,
0);
@@ -1153,6 +1382,7 @@ ACE_POSIX_Asynch_Connect::connect_i (ACE_POSIX_Asynch_Connect_Result *result,
ACE_TEXT("socket")),
-1);
}
+
// Reuse the address
int one = 1;
if (protocol_family != PF_UNIX &&
@@ -1171,10 +1401,12 @@ ACE_POSIX_Asynch_Connect::connect_i (ACE_POSIX_Asynch_Connect_Result *result,
-1);
}
}
+
if (local_sap != ACE_Addr::sap_any)
{
sockaddr * laddr = reinterpret_cast<sockaddr *> (local_sap.get_addr ());
size_t size = local_sap.get_size ();
+
if (ACE_OS::bind (handle, laddr, size) == -1)
{
result->set_error (errno);
@@ -1185,6 +1417,7 @@ ACE_POSIX_Asynch_Connect::connect_i (ACE_POSIX_Asynch_Connect_Result *result,
-1);
}
}
+
// set non blocking mode
if (ACE::set_flags (handle, ACE_NONBLOCK) != 0)
{
@@ -1195,6 +1428,7 @@ ACE_POSIX_Asynch_Connect::connect_i (ACE_POSIX_Asynch_Connect_Result *result,
ACE_TEXT("set_flags")),
-1);
}
+
for (;;)
{
int rc = ACE_OS::connect
@@ -1205,15 +1439,20 @@ ACE_POSIX_Asynch_Connect::connect_i (ACE_POSIX_Asynch_Connect_Result *result,
{
if (errno == EWOULDBLOCK || errno == EINPROGRESS)
return 0; // connect started
+
if (errno == EINTR)
continue;
+
result->set_error (errno);
}
+
return 1 ; // connect finished
}
+
ACE_NOTREACHED (return 0);
}
+
//@@ New method cancel_uncompleted
// It performs cancellation of all pending requests
//
@@ -1225,35 +1464,48 @@ ACE_POSIX_Asynch_Connect::connect_i (ACE_POSIX_Asynch_Connect_Result *result,
//
// Return value : number of cancelled requests
//
+
int
ACE_POSIX_Asynch_Connect::cancel_uncompleted (bool flg_notify,
ACE_Handle_Set & set)
{
ACE_TRACE ("ACE_POSIX_Asynch_Connect::cancel_uncompleted");
+
int retval = 0;
+
MAP_MANAGER::ITERATOR iter (result_map_);
MAP_MANAGER::ENTRY * me = 0;
+
set.reset ();
+
for (; iter.next (me) != 0; retval++ , iter.advance ())
{
ACE_HANDLE handle = me->ext_id_;
ACE_POSIX_Asynch_Connect_Result* result = me->int_id_ ;
+
set.set_bit (handle);
+
result->set_bytes_transferred (0);
result->set_error (ECANCELED);
this->post_result (result, flg_notify);
}
+
result_map_.unbind_all ();
+
return retval;
}
+
int
ACE_POSIX_Asynch_Connect::cancel (void)
{
ACE_TRACE ("ACE_POSIX_Asynch_Connect::cancel");
+
// Since this is not a real asynch I/O operation, we can't just call
// ::aiocancel () or ACE_POSIX_Asynch_Operation::cancel ().
// Delegate real cancelation to cancel_uncompleted (1)
+
int rc = -1 ; // ERRORS
+
ACE_Handle_Set set;
int num_cancelled = 0;
{
@@ -1264,53 +1516,69 @@ ACE_POSIX_Asynch_Connect::cancel (void)
rc = 1 ; // AIO_ALLDONE
else if (num_cancelled > 0)
rc = 0 ; // AIO_CANCELED
+
if (!this->flg_open_)
return rc ;
+
ACE_Asynch_Pseudo_Task & task =
this->posix_proactor ()->get_asynch_pseudo_task ();
+
task.remove_io_handler (set);
return rc;
}
+
int
ACE_POSIX_Asynch_Connect::close (void)
{
ACE_TRACE ("ACE_POSIX_Asynch_Connect::close");
+
ACE_Handle_Set set ;
int num_cancelled = 0;
{
ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1));
num_cancelled = cancel_uncompleted (flg_open_, set);
}
+
if (num_cancelled == 0 || !this->flg_open_)
{
this->flg_open_ = false;
return 0;
}
+
ACE_Asynch_Pseudo_Task & task =
this->posix_proactor ()->get_asynch_pseudo_task ();
+
task.remove_io_handler (set);
this->flg_open_ = false;
+
return 0;
}
+
int
ACE_POSIX_Asynch_Connect::handle_output (ACE_HANDLE fd)
{
ACE_TRACE ("ACE_POSIX_Asynch_Connect::handle_output");
+
ACE_POSIX_Asynch_Connect_Result* result = 0;
+
{
ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, 0));
if (this->result_map_.unbind (fd, result) != 0) // not found
return -1;
}
+
int sockerror = 0 ;
int lsockerror = sizeof sockerror;
+
ACE_OS::getsockopt (fd,
SOL_SOCKET,
SO_ERROR,
(char*) &sockerror,
&lsockerror);
+
result->set_bytes_transferred (0);
result->set_error (sockerror);
+
// This previously just did a "return -1" and let handle_close() clean
// things up. However, this entire object may be gone as a result of
// the application's completion handler, so don't count on 'this' being
@@ -1321,55 +1589,70 @@ ACE_POSIX_Asynch_Connect::handle_output (ACE_HANDLE fd)
return 0;
}
+
int
ACE_POSIX_Asynch_Connect::handle_close (ACE_HANDLE fd, ACE_Reactor_Mask)
{
ACE_TRACE ("ACE_POSIX_Asynch_Connect::handle_close");
+
ACE_Asynch_Pseudo_Task &task =
this->posix_proactor ()->get_asynch_pseudo_task ();
+
task.remove_io_handler (fd);
+
ACE_POSIX_Asynch_Connect_Result* result = 0;
+
{
ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, 0));
if (this->result_map_.unbind (fd, result) != 0) // not found
return -1;
}
+
result->set_bytes_transferred (0);
result->set_error (ECANCELED);
this->post_result (result, this->flg_open_);
+
return 0;
}
+
// *********************************************************************
+
ACE_HANDLE
ACE_POSIX_Asynch_Transmit_File_Result::socket (void) const
{
return this->socket_;
}
+
ACE_HANDLE
ACE_POSIX_Asynch_Transmit_File_Result::file (void) const
{
return this->aio_fildes;
}
+
ACE_Asynch_Transmit_File::Header_And_Trailer *
ACE_POSIX_Asynch_Transmit_File_Result::header_and_trailer (void) const
{
return this->header_and_trailer_;
}
+
size_t
ACE_POSIX_Asynch_Transmit_File_Result::bytes_to_write (void) const
{
return this->aio_nbytes;
}
+
size_t
ACE_POSIX_Asynch_Transmit_File_Result::bytes_per_send (void) const
{
return this->bytes_per_send_;
}
+
u_long
ACE_POSIX_Asynch_Transmit_File_Result::flags (void) const
{
return this->flags_;
}
+
ACE_POSIX_Asynch_Transmit_File_Result::ACE_POSIX_Asynch_Transmit_File_Result
(const ACE_Handler::Proxy_Ptr &handler_proxy,
ACE_HANDLE socket,
@@ -1394,6 +1677,7 @@ ACE_POSIX_Asynch_Transmit_File_Result::ACE_POSIX_Asynch_Transmit_File_Result
this->aio_fildes = file;
this->aio_nbytes = bytes_to_write;
}
+
void
ACE_POSIX_Asynch_Transmit_File_Result::complete (size_t bytes_transferred,
int success,
@@ -1405,6 +1689,7 @@ ACE_POSIX_Asynch_Transmit_File_Result::complete (size_t bytes_transferred,
this->success_ = success;
this->completion_key_ = completion_key;
this->error_ = error;
+
// We will not do this because (a) the header and trailer blocks may
// be the same message_blocks and (b) in cases of failures we have
// no idea how much of what (header, data, trailer) was sent.
@@ -1414,23 +1699,29 @@ ACE_POSIX_Asynch_Transmit_File_Result::complete (size_t bytes_transferred,
ACE_Message_Block *header = this->header_and_trailer_->header ();
if (header != 0)
header->rd_ptr (this->header_and_trailer_->header_bytes ());
+
ACE_Message_Block *trailer = this->header_and_trailer_->trailer ();
if (trailer != 0)
trailer->rd_ptr (this->header_and_trailer_->trailer_bytes ());
}
*/
+
// Create the interface result class.
ACE_Asynch_Transmit_File::Result result (this);
+
// Call the application handler.
ACE_Handler *handler = this->handler_proxy_.get ()->handler ();
if (handler != 0)
handler->handle_transmit_file (result);
}
+
ACE_POSIX_Asynch_Transmit_File_Result::~ACE_POSIX_Asynch_Transmit_File_Result (void)
{
}
+
// *********************************************************************
+
/**
* @class ACE_POSIX_Asynch_Transmit_Handler
*
@@ -1448,47 +1739,66 @@ public:
/// to write).
ACE_POSIX_Asynch_Transmit_Handler (ACE_POSIX_Proactor *posix_proactor,
ACE_POSIX_Asynch_Transmit_File_Result *result);
+
/// Destructor.
virtual ~ACE_POSIX_Asynch_Transmit_Handler (void);
+
/// Do the transmission. All the info to do the transmission is in
/// the <result> member.
int transmit (void);
+
protected:
+
/// The asynch result pointer made from the initial transmit file
/// request.
ACE_POSIX_Asynch_Transmit_File_Result *result_;
+
/// Message bloack used to do the transmission.
ACE_Message_Block *mb_;
+
enum ACT
{
HEADER_ACT = 1,
DATA_ACT = 2,
TRAILER_ACT = 3
};
+
/// ACT to transmit header.
ACT header_act_;
+
/// ACT to transmit data.
ACT data_act_;
+
/// ACT to transmit trailer.
ACT trailer_act_;
+
/// Current offset of the file being transmitted.
size_t file_offset_;
+
/// Total size of the file.
size_t file_size_;
+
/// Number of bytes transferred on the stream.
size_t bytes_transferred_;
+
/// This is called when asynchronous writes from the socket complete.
virtual void handle_write_stream (const ACE_Asynch_Write_Stream::Result &result);
+
/// This is called when asynchronous reads from the file complete.
virtual void handle_read_file (const ACE_Asynch_Read_File::Result &result);
+
/// Issue asynch read from the file.
int initiate_read_file (void);
+
/// To read from the file to be transmitted.
ACE_POSIX_Asynch_Read_File rf_;
+
/// Write stream to write the header, trailer and the data.
ACE_POSIX_Asynch_Write_Stream ws_;
};
+
// ************************************************************
+
// Constructor.
ACE_POSIX_Asynch_Transmit_Handler::ACE_POSIX_Asynch_Transmit_Handler
(ACE_POSIX_Proactor *posix_proactor,
@@ -1511,6 +1821,7 @@ ACE_POSIX_Asynch_Transmit_Handler::ACE_POSIX_Asynch_Transmit_Handler
// Init the file size.
file_size_ = ACE_OS::filesize (this->result_->file ());
}
+
// Destructor.
ACE_POSIX_Asynch_Transmit_Handler::~ACE_POSIX_Asynch_Transmit_Handler (void)
{
@@ -1518,6 +1829,7 @@ ACE_POSIX_Asynch_Transmit_Handler::~ACE_POSIX_Asynch_Transmit_Handler (void)
mb_->release ();
}
+
// Do the transmission.
// Initiate transmitting the header. When that completes
// handle_write_stream will be called, there start transmitting the file.
@@ -1528,6 +1840,7 @@ ACE_POSIX_Asynch_Transmit_Handler::transmit (void)
// concrete implementations of the Asynch_Operations, and we have
// already given them the specific proactor, so they wont need the
// general <proactor> interface pointer.
+
// Open Asynch_Read_File.
if (this->rf_.open (this->proxy (),
this->result_->file (),
@@ -1536,6 +1849,7 @@ ACE_POSIX_Asynch_Transmit_Handler::transmit (void)
ACE_ERROR_RETURN ((LM_ERROR,
"ACE_Asynch_Transmit_Handler:read_file open failed\n"),
-1);
+
// Open Asynch_Write_Stream.
if (this->ws_.open (this->proxy (),
this->result_->socket (),
@@ -1544,6 +1858,7 @@ ACE_POSIX_Asynch_Transmit_Handler::transmit (void)
ACE_ERROR_RETURN ((LM_ERROR,
"ACE_Asynch_Transmit_Handler:write_stream open failed\n"),
-1);
+
// Transmit the header.
if (this->ws_.write (*this->result_->header_and_trailer ()->header (),
this->result_->header_and_trailer ()->header_bytes (),
@@ -1554,17 +1869,21 @@ ACE_POSIX_Asynch_Transmit_Handler::transmit (void)
-1);
return 0;
}
+
void
ACE_POSIX_Asynch_Transmit_Handler::handle_write_stream (const ACE_Asynch_Write_Stream::Result &result)
{
// Update bytes transferred so far.
this->bytes_transferred_ += result.bytes_transferred ();
+
// Check the success parameter.
if (result.success () == 0)
{
// Failure.
+
ACE_ERROR ((LM_ERROR,
"Asynch_Transmit_File failed.\n"));
+
ACE_SEH_TRY
{
this->result_->complete (this->bytes_transferred_,
@@ -1579,13 +1898,16 @@ ACE_POSIX_Asynch_Transmit_Handler::handle_write_stream (const ACE_Asynch_Write_S
delete this;
}
}
+
// Write stream successful.
+
// Partial write to socket.
size_t unsent_data = result.bytes_to_write () - result.bytes_transferred ();
if (unsent_data != 0)
{
ACE_DEBUG ((LM_DEBUG,
"%N:%l:Partial write to socket: Asynch_write called again\n"));
+
// Duplicate the message block and retry remaining data
if (this->ws_.write (*result.message_block ().duplicate (),
unsent_data,
@@ -1598,6 +1920,7 @@ ACE_POSIX_Asynch_Transmit_Handler::handle_write_stream (const ACE_Asynch_Write_S
"Asynch_Transmit_Handler:write_stream failed\n"));
return;
}
+
// @@ Handling *partial write* to a socket. Let us not continue
// further before this write finishes. Because proceeding with
// another read and then write might change the order of the
@@ -1605,9 +1928,12 @@ ACE_POSIX_Asynch_Transmit_Handler::handle_write_stream (const ACE_Asynch_Write_S
// always possible.
return;
}
+
// Not a partial write. A full write.
+
// Check ACT to see what was sent.
ACT act = * (ACT *) result.act ();
+
switch (act)
{
case TRAILER_ACT:
@@ -1626,6 +1952,7 @@ ACE_POSIX_Asynch_Transmit_Handler::handle_write_stream (const ACE_Asynch_Write_S
delete this;
}
break;
+
case HEADER_ACT:
case DATA_ACT:
// If header/data was sent, initiate the file data transmission.
@@ -1634,12 +1961,14 @@ ACE_POSIX_Asynch_Transmit_Handler::handle_write_stream (const ACE_Asynch_Write_S
ACE_ERROR ((LM_ERROR,
"Error:Asynch_Transmit_Handler:read_file couldnt be initiated\n"));
break;
+
default:
// @@ Handle this error.
ACE_ERROR ((LM_ERROR,
"Error:ACE_Asynch_Transmit_Handler::handle_write_stream::Unexpected act\n"));
}
}
+
void
ACE_POSIX_Asynch_Transmit_Handler::handle_read_file (const ACE_Asynch_Read_File::Result &result)
{
@@ -1660,11 +1989,14 @@ ACE_POSIX_Asynch_Transmit_Handler::handle_read_file (const ACE_Asynch_Read_File:
}
return;
}
+
// Read successful.
if (result.bytes_transferred () == 0)
return;
+
// Increment offset.
this->file_offset_ += result.bytes_transferred ();
+
// Write data to network.
if (this->ws_.write (result.message_block (),
result.bytes_transferred (),
@@ -1678,6 +2010,7 @@ ACE_POSIX_Asynch_Transmit_Handler::handle_read_file (const ACE_Asynch_Read_File:
return;
}
}
+
int
ACE_POSIX_Asynch_Transmit_Handler::initiate_read_file (void)
{
@@ -1702,6 +2035,7 @@ ACE_POSIX_Asynch_Transmit_Handler::initiate_read_file (void)
// the wr_ptr and the rd_ptr to the beginning.
this->mb_->rd_ptr (this->mb_->base ());
this->mb_->wr_ptr (this->mb_->base ());
+
// Inititiate an asynchronous read from the file.
if (this->rf_.read (*this->mb_,
this->mb_->size () - 1,
@@ -1716,11 +2050,14 @@ ACE_POSIX_Asynch_Transmit_Handler::initiate_read_file (void)
return 0;
}
}
+
// *********************************************************************
+
ACE_POSIX_Asynch_Transmit_File::ACE_POSIX_Asynch_Transmit_File (ACE_POSIX_Proactor *posix_proactor)
: ACE_POSIX_Asynch_Operation (posix_proactor)
{
}
+
int
ACE_POSIX_Asynch_Transmit_File::transmit_file (ACE_HANDLE file,
ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer,
@@ -1735,24 +2072,31 @@ ACE_POSIX_Asynch_Transmit_File::transmit_file (ACE_HANDLE file,
{
// Adjust these parameters if there are default values specified.
ssize_t file_size = ACE_OS::filesize (file);
+
if (file_size == -1)
ACE_ERROR_RETURN ((LM_ERROR,
"Error:%N:%l:%p\n",
"POSIX_Asynch_Transmit_File:filesize failed"),
-1);
+
if (bytes_to_write == 0)
bytes_to_write = file_size;
+
if (offset > (size_t) file_size)
ACE_ERROR_RETURN ((LM_ERROR,
"Error:%p\n",
"Asynch_Transmit_File:File size is less than offset"),
-1);
+
if (offset != 0)
bytes_to_write = file_size - offset + 1;
+
if (bytes_per_send == 0)
bytes_per_send = bytes_to_write;
+
// Configure the result parameter.
ACE_POSIX_Asynch_Transmit_File_Result *result = 0;
+
ACE_NEW_RETURN (result,
ACE_POSIX_Asynch_Transmit_File_Result (this->handler_proxy_,
this->handle_,
@@ -1768,31 +2112,40 @@ ACE_POSIX_Asynch_Transmit_File::transmit_file (ACE_HANDLE file,
priority,
signal_number),
-1);
+
// Make the auxillary handler and initiate transmit.
ACE_POSIX_Asynch_Transmit_Handler *transmit_handler = 0;
+
ACE_NEW_RETURN (transmit_handler,
ACE_POSIX_Asynch_Transmit_Handler (this->posix_proactor (),
result),
-1);
+
ssize_t return_val = transmit_handler->transmit ();
+
if (return_val == -1)
// This deletes the <result> in it too.
delete transmit_handler;
+
return 0;
}
+
ACE_POSIX_Asynch_Transmit_File::~ACE_POSIX_Asynch_Transmit_File (void)
{
}
+
// *********************************************************************
size_t
ACE_POSIX_Asynch_Read_Dgram_Result::bytes_to_read (void) const
{
return this->bytes_to_read_;
}
+
int
ACE_POSIX_Asynch_Read_Dgram_Result::remote_address (ACE_Addr& addr) const
{
int retVal = -1; // failure
+
// make sure the addresses are of the same type
if (addr.get_type () == this->remote_address_->get_type ())
{ // copy the remote_address_ into addr
@@ -1800,29 +2153,35 @@ ACE_POSIX_Asynch_Read_Dgram_Result::remote_address (ACE_Addr& addr) const
this->remote_address_->get_size ());
retVal = 0; // success
}
+
return retVal;
}
+
sockaddr *
ACE_POSIX_Asynch_Read_Dgram_Result::saddr () const
{
return (sockaddr *) this->remote_address_->get_addr ();
}
+
int
ACE_POSIX_Asynch_Read_Dgram_Result::flags (void) const
{
return this->flags_;
}
+
ACE_HANDLE
ACE_POSIX_Asynch_Read_Dgram_Result::handle (void) const
{
return this->handle_;
}
+
ACE_Message_Block*
ACE_POSIX_Asynch_Read_Dgram_Result::message_block () const
{
return this->message_block_;
}
+
ACE_POSIX_Asynch_Read_Dgram_Result::ACE_POSIX_Asynch_Read_Dgram_Result
(const ACE_Handler::Proxy_Ptr &handler_proxy,
ACE_HANDLE handle,
@@ -1849,6 +2208,7 @@ ACE_POSIX_Asynch_Read_Dgram_Result::ACE_POSIX_Asynch_Read_Dgram_Result
this->aio_nbytes = bytes_to_read;
ACE_NEW (this->remote_address_, ACE_INET_Addr);
}
+
void
ACE_POSIX_Asynch_Read_Dgram_Result::complete (size_t bytes_transferred,
int success,
@@ -1860,44 +2220,55 @@ ACE_POSIX_Asynch_Read_Dgram_Result::complete (size_t bytes_transferred,
this->success_ = success;
this->completion_key_ = completion_key;
this->error_ = error;
+
// Appropriately move the pointers in the message block.
this->message_block_->wr_ptr (bytes_transferred);
+
// <errno> is available in the aiocb.
ACE_UNUSED_ARG (error);
+
this->remote_address_->set_size(this->addr_len_);
+
// Create the interface result class.
ACE_Asynch_Read_Dgram::Result result (this);
+
// Call the application handler.
ACE_Handler *handler = this->handler_proxy_.get ()->handler ();
if (handler != 0)
handler->handle_read_dgram (result);
}
+
ACE_POSIX_Asynch_Read_Dgram_Result::~ACE_POSIX_Asynch_Read_Dgram_Result (void)
{
delete this->remote_address_;
}
+
//***************************************************************************
size_t
ACE_POSIX_Asynch_Write_Dgram_Result::bytes_to_write (void) const
{
return this->bytes_to_write_;
}
+
int
ACE_POSIX_Asynch_Write_Dgram_Result::flags (void) const
{
return this->flags_;
}
+
ACE_HANDLE
ACE_POSIX_Asynch_Write_Dgram_Result::handle (void) const
{
return this->handle_;
}
+
ACE_Message_Block*
ACE_POSIX_Asynch_Write_Dgram_Result::message_block () const
{
return this->message_block_;
}
+
ACE_POSIX_Asynch_Write_Dgram_Result::ACE_POSIX_Asynch_Write_Dgram_Result
(const ACE_Handler::Proxy_Ptr &handler_proxy,
ACE_HANDLE handle,
@@ -1914,11 +2285,13 @@ ACE_POSIX_Asynch_Write_Dgram_Result::ACE_POSIX_Asynch_Write_Dgram_Result
message_block_ (message_block),
flags_ (flags),
handle_ (handle)
+
{
this->aio_fildes = handle;
this->aio_buf = message_block->rd_ptr ();
this->aio_nbytes = bytes_to_write;
}
+
void
ACE_POSIX_Asynch_Write_Dgram_Result::complete (size_t bytes_transferred,
int success,
@@ -1930,24 +2303,31 @@ ACE_POSIX_Asynch_Write_Dgram_Result::complete (size_t bytes_transferred,
this->success_ = success;
this->completion_key_ = completion_key;
this->error_ = error;
+
// <errno> is available in the aiocb.
ACE_UNUSED_ARG (error);
+
// Appropriately move the pointers in the message block.
this->message_block_->rd_ptr (bytes_transferred);
+
// Create the interface result class.
ACE_Asynch_Write_Dgram::Result result (this);
+
// Call the application handler.
ACE_Handler *handler = this->handler_proxy_.get ()->handler ();
if (handler != 0)
handler->handle_write_dgram (result);
}
+
ACE_POSIX_Asynch_Write_Dgram_Result::~ACE_POSIX_Asynch_Write_Dgram_Result (void)
{
}
+
/***************************************************************************/
ACE_POSIX_Asynch_Read_Dgram::~ACE_POSIX_Asynch_Read_Dgram (void)
{
}
+
ssize_t
ACE_POSIX_Asynch_Read_Dgram::recv (ACE_Message_Block *message_block,
size_t & /*number_of_bytes_recvd*/,
@@ -1973,19 +2353,25 @@ ACE_POSIX_Asynch_Read_Dgram::recv (ACE_Message_Block *message_block,
priority,
signal_number),
-1);
+
int return_val = proactor->start_aio (result, ACE_POSIX_Proactor::ACE_OPCODE_READ);
if (return_val == -1)
delete result;
+
return return_val;
}
+
ACE_POSIX_Asynch_Read_Dgram::ACE_POSIX_Asynch_Read_Dgram (ACE_POSIX_Proactor *posix_proactor)
: ACE_POSIX_Asynch_Operation (posix_proactor)
{
}
+
//***************************************************************************
+
ACE_POSIX_Asynch_Write_Dgram::~ACE_POSIX_Asynch_Write_Dgram (void)
{
}
+
ssize_t
ACE_POSIX_Asynch_Write_Dgram::send (ACE_Message_Block *message_block,
size_t &/*number_of_bytes_sent*/,
@@ -2002,6 +2388,7 @@ ACE_POSIX_Asynch_Write_Dgram::send (ACE_Message_Block *message_block,
ACE_TEXT ("ACE_POSIX_Asynch_Write_Stream::write:")
ACE_TEXT ("Attempt to write 0 bytes\n")),
-1);
+
ACE_POSIX_Asynch_Write_Dgram_Result *result = 0;
ACE_POSIX_Proactor *proactor = this->posix_proactor ();
ACE_NEW_RETURN (result,
@@ -2015,16 +2402,21 @@ ACE_POSIX_Asynch_Write_Dgram::send (ACE_Message_Block *message_block,
priority,
signal_number),
-1);
+
int return_val = proactor->start_aio (result, ACE_POSIX_Proactor::ACE_OPCODE_WRITE);
if (return_val == -1)
delete result;
+
return return_val;
}
+
ACE_POSIX_Asynch_Write_Dgram::ACE_POSIX_Asynch_Write_Dgram
(ACE_POSIX_Proactor *posix_proactor)
: ACE_POSIX_Asynch_Operation (posix_proactor)
{
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_AIO_CALLS */
diff --git a/dep/ACE_wrappers/ace/POSIX_Asynch_IO.h b/dep/ACE_wrappers/ace/POSIX_Asynch_IO.h
index 314c5725b7a..79e46f47c79 100644
--- a/dep/ACE_wrappers/ace/POSIX_Asynch_IO.h
+++ b/dep/ACE_wrappers/ace/POSIX_Asynch_IO.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file POSIX_Asynch_IO.h
@@ -15,14 +16,20 @@
* @author Alexander Libman <alibman@baltimore.com>
*/
//=============================================================================
+
#ifndef ACE_POSIX_ASYNCH_IO_H
#define ACE_POSIX_ASYNCH_IO_H
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
#pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_AIO_CALLS)
+
#include "ace/os_include/os_aio.h"
+
#include "ace/Asynch_IO_Impl.h"
#include "ace/Unbounded_Queue.h"
#include "ace/Map_Manager.h"
@@ -30,12 +37,16 @@
#if defined(INTEGRITY)
#include "ace/ACE.h"
#endif
+
#include "ace/Null_Mutex.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward declarations
class ACE_POSIX_Proactor;
class ACE_Proactor_Impl;
class ACE_Handle_Set;
+
/**
* @class ACE_POSIX_Asynch_Result
*
@@ -49,10 +60,13 @@ class ACE_Export ACE_POSIX_Asynch_Result : public virtual ACE_Asynch_Result_Impl
public:
/// Number of bytes transferred by the operation.
size_t bytes_transferred (void) const;
+
/// ACT associated with the operation.
const void *act (void) const;
+
/// Did the operation succeed?
int success (void) const;
+
/**
* This is the ACT associated with the handle on which the
* Asynch_Operation takes place.
@@ -60,10 +74,13 @@ public:
* @note This is not implemented for POSIX4 platforms.
*/
const void *completion_key (void) const;
+
/// Error value if the operation fails.
u_long error (void) const;
+
/// This returns ACE_INVALID_HANDLE on POSIX4 platforms.
ACE_HANDLE event (void) const;
+
/**
* This really make sense only when doing file I/O.
*
@@ -73,22 +90,29 @@ public:
*/
u_long offset (void) const;
u_long offset_high (void) const;
+
/// Priority of the operation.
int priority (void) const;
+
/**
* POSIX4 realtime signal number to be used for the
* operation. <signal_number> ranges from SIGRTMIN to SIGRTMAX. By
* default, SIGRTMIN is used to issue <aio_> calls.
*/
int signal_number (void) const;
+
/// Post @c this to the Proactor.
int post_completion (ACE_Proactor_Impl *proactor);
+
/// Destructor.
virtual ~ACE_POSIX_Asynch_Result (void);
+
/// Simulate error value to use in the post_completion ()
void set_error (u_long errcode);
+
/// Simulate value to use in the post_completion ()
void set_bytes_transferred (size_t nbytes);
+
protected:
/// Constructor. <Event> is not used on POSIX.
ACE_POSIX_Asynch_Result (const ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -98,8 +122,10 @@ protected:
u_long offset_high,
int priority,
int signal_number);
+
/// Handler that will be called back.
ACE_Handler::Proxy_Ptr handler_proxy_;
+
/**
* ACT for this operation.
* We could use <aiocb::aio_sigevent.sigev_value.sival_ptr> for
@@ -107,15 +133,20 @@ protected:
* better.
*/
const void *act_;
+
/// Bytes transferred by this operation.
size_t bytes_transferred_;
+
/// Success indicator.
int success_;
+
/// ACT associated with handle.
const void *completion_key_;
+
/// Error if operation failed.
u_long error_;
};
+
/**
* @class ACE_POSIX_Asynch_Operation
*
@@ -139,18 +170,25 @@ public:
ACE_HANDLE handle,
const void *completion_key,
ACE_Proactor *proactor = 0);
+
/// Check the documentation for ACE_Asynch_Operation::cancel.
int cancel (void);
+
// = Access methods.
+
/// Return the underlying proactor.
ACE_Proactor* proactor (void) const;
+
/// Return the underlying Proactor implementation.
ACE_POSIX_Proactor * posix_proactor (void) const;
+
protected:
/// Contructor.
ACE_POSIX_Asynch_Operation (ACE_POSIX_Proactor *posix_proactor);
+
/// Destructor.
virtual ~ACE_POSIX_Asynch_Operation (void);
+
// This call is for the POSIX implementation. This method is used by
// ACE_Asynch_Operation to store some information with the
// Proactor after an <aio_> call is issued, so that the Proactor can
@@ -158,6 +196,7 @@ protected:
// Passing a '0' ptr returns the status, indicating whether there
// are slots available or no. Passing a valid ptr stores the ptr
// with the Proactor.
+
/**
* It is easy to get this specific implementation proactor here,
* since it is the one that creates the correct POSIX_Asynch_*
@@ -165,13 +204,17 @@ protected:
* directly.
*/
ACE_POSIX_Proactor *posix_proactor_;
+
/// Proactor that this Asynch IO will be registered with.
ACE_Proactor *proactor_;
+
/// Handler that will receive the callback.
ACE_Handler::Proxy_Ptr handler_proxy_;
+
/// I/O handle used for reading.
ACE_HANDLE handle_;
};
+
/**
* @class ACE_POSIX_Asynch_Read_Stream_Result
*
@@ -181,18 +224,24 @@ protected:
class ACE_Export ACE_POSIX_Asynch_Read_Stream_Result : public virtual ACE_Asynch_Read_Stream_Result_Impl,
public ACE_POSIX_Asynch_Result
{
+
/// Factory classes will have special permissions.
friend class ACE_POSIX_Asynch_Read_Stream;
+
/// The Proactor constructs the Result class for faking results.
friend class ACE_POSIX_Proactor;
+
public:
/// The number of bytes which were requested at the start of the
/// asynchronous read.
size_t bytes_to_read (void) const;
+
/// Message block which contains the read data.
ACE_Message_Block &message_block (void) const;
+
/// I/O handle used for reading.
ACE_HANDLE handle (void) const;
+
protected:
ACE_POSIX_Asynch_Read_Stream_Result (const ACE_Handler::Proxy_Ptr &handler_proxy,
ACE_HANDLE handle,
@@ -204,21 +253,27 @@ protected:
int signal_number);
// Constructor is protected since creation is limited to
// ACE_Asynch_Read_Stream factory.
+
/// Get the data copied to this class, before calling application
/// handler.
virtual void complete (size_t bytes_transferred,
int success,
const void *completion_key,
u_long error);
+
/// Destructor.
virtual ~ACE_POSIX_Asynch_Read_Stream_Result (void);
+
// aiocb::aio_nbytes
// Bytes requested when the asynchronous read was initiated.
+
/// Message block for reading the data into.
ACE_Message_Block &message_block_;
+
// aiocb::aio_filedes
// I/O handle used for reading.
};
+
/**
* @class ACE_POSIX_Asynch_Read_Stream
*
@@ -232,6 +287,7 @@ class ACE_Export ACE_POSIX_Asynch_Read_Stream : public virtual ACE_Asynch_Read_S
public:
/// Constructor.
ACE_POSIX_Asynch_Read_Stream (ACE_POSIX_Proactor *posix_proactor);
+
/// This starts off an asynchronous read. Upto @a bytes_to_read will
/// be read and stored in the @a message_block.
int read (ACE_Message_Block &message_block,
@@ -239,10 +295,12 @@ public:
const void *act,
int priority,
int signal_number = 0);
+
/// Destructor.
virtual ~ACE_POSIX_Asynch_Read_Stream (void);
};
+
/**
* @class ACE_POSIX_Asynch_Write_Stream_Result
*
@@ -259,16 +317,21 @@ class ACE_Export ACE_POSIX_Asynch_Write_Stream_Result : public virtual ACE_Async
{
/// Factory classes will have special privilages.
friend class ACE_POSIX_Asynch_Write_Stream;
+
/// The Proactor constructs the Result class for faking results.
friend class ACE_POSIX_Proactor;
+
public:
/// The number of bytes which were requested at the start of the
/// asynchronous write.
size_t bytes_to_write (void) const;
+
/// Message block that contains the data to be written.
ACE_Message_Block &message_block (void) const;
+
/// I/O handle used for writing.
ACE_HANDLE handle (void) const;
+
protected:
/// Constructor is protected since creation is limited to
/// ACE_Asynch_Write_Stream factory.
@@ -280,22 +343,28 @@ protected:
ACE_HANDLE event,
int priority,
int signal_number);
+
/// ACE_Proactor will call this method when the write completes.
virtual void complete (size_t bytes_transferred,
int success,
const void *completion_key,
u_long error);
+
/// Destructor.
virtual ~ACE_POSIX_Asynch_Write_Stream_Result (void);
+
protected:
// aiocb::aio_nbytes
// The number of bytes which were requested at the start of the
// asynchronous write.
+
/// Message block that contains the data to be written.
ACE_Message_Block &message_block_;
+
// aiocb::aio_filedes
// I/O handle used for writing.
};
+
/**
* @class ACE_POSIX_Asynch_Write_Stream
*
@@ -308,6 +377,7 @@ class ACE_Export ACE_POSIX_Asynch_Write_Stream : public virtual ACE_Asynch_Write
public:
/// Constructor.
ACE_POSIX_Asynch_Write_Stream (ACE_POSIX_Proactor *posix_proactor);
+
/// This starts off an asynchronous write. Upto @a bytes_to_write
/// will be written from the @a message_block.
int write (ACE_Message_Block &message_block,
@@ -315,9 +385,11 @@ public:
const void *act,
int priority,
int signal_number = 0);
+
/// Destructor.
virtual ~ACE_POSIX_Asynch_Write_Stream (void);
};
+
/**
* @class ACE_POSIX_Asynch_Read_File_Result
*
@@ -329,9 +401,12 @@ class ACE_Export ACE_POSIX_Asynch_Read_File_Result : public virtual ACE_Asynch_R
{
/// Factory classes will have special permissions.
friend class ACE_POSIX_Asynch_Read_File;
+
/// The Proactor constructs the Result class for faking results.
friend class ACE_POSIX_Proactor;
+
public:
+
protected:
/// Constructor is protected since creation is limited to
/// ACE_Asynch_Read_File factory.
@@ -345,14 +420,17 @@ protected:
ACE_HANDLE event,
int priority,
int signal_number);
+
/// ACE_Proactor will call this method when the read completes.
virtual void complete (size_t bytes_transferred,
int success,
const void *completion_key,
u_long error);
+
/// Destructor.
virtual ~ACE_POSIX_Asynch_Read_File_Result (void);
};
+
/**
* @class ACE_POSIX_Asynch_Read_File
*
@@ -372,9 +450,11 @@ protected:
class ACE_Export ACE_POSIX_Asynch_Read_File : public virtual ACE_Asynch_Read_File_Impl,
public ACE_POSIX_Asynch_Read_Stream
{
+
public:
/// Constructor.
ACE_POSIX_Asynch_Read_File (ACE_POSIX_Proactor *posix_proactor);
+
/**
* This starts off an asynchronous read. Upto @a bytes_to_read will
* be read and stored in the @a message_block. The read will start
@@ -387,8 +467,10 @@ public:
const void *act,
int priority,
int signal_number = 0);
+
/// Destructor.
virtual ~ACE_POSIX_Asynch_Read_File (void);
+
private:
/**
* This belongs to ACE_POSIX_Asynch_Read_Stream. We have
@@ -402,6 +484,7 @@ private:
int signal_number = 0);
};
+
/**
* @class ACE_POSIX_Asynch_Write_File_Result
*
@@ -424,8 +507,10 @@ class ACE_Export ACE_POSIX_Asynch_Write_File_Result : public virtual ACE_Asynch_
{
/// Factory classes will have special permissions.
friend class ACE_POSIX_Asynch_Write_File;
+
/// The Proactor constructs the Result class for faking results.
friend class ACE_POSIX_Proactor;
+
protected:
/// Constructor is protected since creation is limited to
/// ACE_Asynch_Write_File factory.
@@ -439,14 +524,17 @@ protected:
ACE_HANDLE event,
int priority,
int signal_number);
+
/// ACE_Proactor will call this method when the write completes.
virtual void complete (size_t bytes_transferred,
int success,
const void *completion_key,
u_long error);
+
/// Destructor.
virtual ~ACE_POSIX_Asynch_Write_File_Result (void);
};
+
/**
* @class ACE_POSIX_Asynch_Write_File
*
@@ -462,6 +550,7 @@ class ACE_Export ACE_POSIX_Asynch_Write_File : public virtual ACE_Asynch_Write_F
public:
/// Constructor.
ACE_POSIX_Asynch_Write_File (ACE_POSIX_Proactor *posix_proactor);
+
/**
* This starts off an asynchronous write. Upto @a bytes_to_write
* will be written and stored in the @a message_block. The write will
@@ -474,8 +563,10 @@ public:
const void *act,
int priority,
int signal_number = 0);
+
/// Destructor.
virtual ~ACE_POSIX_Asynch_Write_File (void);
+
private:
/**
* This <write> belongs to ACE_POSIX_Asynch_Write_Stream. We
@@ -489,6 +580,7 @@ private:
int priority,
int signal_number = 0);
};
+
/**
* @class ACE_POSIX_Asynch_Accept_Result
*
@@ -505,18 +597,24 @@ class ACE_Export ACE_POSIX_Asynch_Accept_Result : public virtual ACE_Asynch_Acce
{
/// Factory classes will have special permissions.
friend class ACE_POSIX_Asynch_Accept;
+
/// The Proactor constructs the Result class for faking results.
friend class ACE_POSIX_Proactor;
+
public:
/// The number of bytes which were requested at the start of the
/// asynchronous accept.
size_t bytes_to_read (void) const;
+
/// Message block which contains the read data.
ACE_Message_Block &message_block (void) const;
+
/// I/O handle used for accepting new connections.
ACE_HANDLE listen_handle (void) const;
+
/// I/O handle for the new connection.
ACE_HANDLE accept_handle (void) const;
+
protected:
/// Constructor is protected since creation is limited to
/// ACE_Asynch_Accept factory.
@@ -529,24 +627,31 @@ protected:
ACE_HANDLE event,
int priority,
int signal_number);
+
/// ACE_Proactor will call this method when the accept completes.
virtual void complete (size_t bytes_transferred,
int success,
const void *completion_key,
u_long error);
+
/// Destructor.
virtual ~ACE_POSIX_Asynch_Accept_Result (void);
+
// aiocb::aio_nbytes
// Bytes requested when the asynchronous read was initiated.
// Actually, on POSIX implementation, we dont read any intial data.
+
/// Message block for reading the data into.
ACE_Message_Block &message_block_;
+
/// I/O handle used for accepting new connections.
ACE_HANDLE listen_handle_;
+
// aiocb::aio_filedes
// I/O handle for the new connection.
};
+
/**
* @class ACE_POSIX_Asynch_Accept
*
@@ -559,10 +664,13 @@ class ACE_Export ACE_POSIX_Asynch_Accept :
public ACE_Event_Handler
{
public:
+
/// Constructor.
ACE_POSIX_Asynch_Accept (ACE_POSIX_Proactor * posix_proactor);
+
/// Destructor.
virtual ~ACE_POSIX_Asynch_Accept (void);
+
/**
* This <open> belongs to ACE_POSIX_Asynch_Operation. We forward
* this call to that method. We have put this here to avoid the
@@ -572,6 +680,7 @@ public:
ACE_HANDLE handle,
const void *completion_key,
ACE_Proactor *proactor = 0);
+
/**
* This starts off an asynchronous accept. The asynchronous accept
* call also allows any initial data to be returned to the
@@ -590,25 +699,32 @@ public:
int priority,
int signal_number = 0,
int addr_family = AF_INET);
+
/**
* Cancel all pending pseudo-asynchronus requests
* Behavior as usual AIO request
*/
int cancel (void);
+
/**
* Close performs cancellation of all pending requests
* and closure the listen handle
*/
int close ();
+
/// virtual from ACE_Event_Handler
ACE_HANDLE get_handle (void) const;
+
/// virtual from ACE_Event_Handler
void set_handle (ACE_HANDLE handle);
+
/// virtual from ACE_Event_Handler
/// Called when accept event comes up on <listen_handle>
int handle_input (ACE_HANDLE handle);
+
/// virtual from ACE_Event_Handler
int handle_close (ACE_HANDLE handle, ACE_Reactor_Mask close_mask);
+
private:
/// flg_notify points whether or not we should send notification about
/// canceled accepts
@@ -618,18 +734,22 @@ private:
/// according POSIX standards we should receive notifications
/// on canceled AIO requests
int cancel_uncompleted (int flg_notify);
+
/// true - Accept is registered in ACE_Asynch_Pseudo_Task
/// false - Accept is deregisted in ACE_Asynch_Pseudo_Task
bool flg_open_ ;
+
/// Queue of Result pointers that correspond to all the pending
/// accept operations.
ACE_Unbounded_Queue<ACE_POSIX_Asynch_Accept_Result*> result_queue_;
+
/// The lock to protect the result queue which is shared. The queue
/// is updated by main thread in the register function call and
/// through the auxillary thread in the deregister fun. So let us
/// mutex it.
ACE_SYNCH_MUTEX lock_;
};
+
/**
* @class ACE_POSIX_Asynch_Connect_Result
*
@@ -645,11 +765,15 @@ class ACE_Export ACE_POSIX_Asynch_Connect_Result : public virtual ACE_Asynch_Con
{
/// Factory classes will have special permissions.
friend class ACE_POSIX_Asynch_Connect;
+
/// The Proactor constructs the Result class for faking results.
friend class ACE_POSIX_Proactor;
+
public:
+
/// I/O handle for the connection.
ACE_HANDLE connect_handle (void) const;
+
protected:
/// Constructor is protected since creation is limited to
/// ACE_Asynch_Connect factory.
@@ -659,18 +783,22 @@ protected:
ACE_HANDLE event,
int priority,
int signal_number);
+
/// ACE_Proactor will call this method when the accept completes.
virtual void complete (size_t bytes_transferred,
int success,
const void *completion_key,
u_long error);
+
/// Destructor.
virtual ~ACE_POSIX_Asynch_Connect_Result (void);
+
// aiocb::aio_filedes
// I/O handle for the new connection.
void connect_handle (ACE_HANDLE handle);
};
+
/**
* @class ACE_POSIX_Asynch_Connect
*
@@ -681,10 +809,13 @@ class ACE_Export ACE_POSIX_Asynch_Connect :
public ACE_Event_Handler
{
public:
+
/// Constructor.
ACE_POSIX_Asynch_Connect (ACE_POSIX_Proactor * posix_proactor);
+
/// Destructor.
virtual ~ACE_POSIX_Asynch_Connect (void);
+
/**
* This belongs to ACE_POSIX_Asynch_Operation. We forward
* this call to that method. We have put this here to avoid the
@@ -694,6 +825,7 @@ public:
ACE_HANDLE handle,
const void *completion_key,
ACE_Proactor *proactor = 0);
+
/**
* This starts off an asynchronous connect.
*
@@ -708,32 +840,41 @@ public:
const void *act,
int priority,
int signal_number = 0);
+
/**
* Cancel all pending pseudo-asynchronus requests
* Behavior as usual AIO request
*/
int cancel (void);
+
/**
* Close performs cancellation of all pending requests.
*/
int close (void);
+
/// virtual from ACE_Event_Handler
ACE_HANDLE get_handle (void) const;
+
/// virtual from ACE_Event_Handler
void set_handle (ACE_HANDLE handle);
+
/// virtual from ACE_Event_Handler
/// The default action on handle_input() and handle_exception is to
/// return -1. Since that's what we want to do, just reuse them.
/// handle_output(), however, is where successful connects are reported.
int handle_output (ACE_HANDLE handle);
+
/// virtual from ACE_Event_Handler
int handle_close (ACE_HANDLE handle, ACE_Reactor_Mask close_mask) ;
+
private:
int connect_i (ACE_POSIX_Asynch_Connect_Result *result,
const ACE_Addr & remote_sap,
const ACE_Addr & local_sap,
int reuse_addr);
+
int post_result (ACE_POSIX_Asynch_Connect_Result *result, bool flg_post);
+
/// Cancel uncompleted connect operations.
/**
* @arg flg_notify Indicates whether or not we should send notification
@@ -744,22 +885,28 @@ private:
* AIO requests.
*/
int cancel_uncompleted (bool flg_notify, ACE_Handle_Set &set);
+
bool flg_open_ ;
/// true - Connect is registered in ACE_Asynch_Pseudo_Task
/// false - Aceept is deregisted in ACE_Asynch_Pseudo_Task
+
typedef ACE_Map_Manager<ACE_HANDLE, ACE_POSIX_Asynch_Connect_Result *, ACE_SYNCH_NULL_MUTEX>
MAP_MANAGER;
+
/// @deprecated (Two) Deprecated typedefs. Use the map traits instead.
typedef MAP_MANAGER::ITERATOR MAP_ITERATOR;
typedef MAP_MANAGER::ENTRY MAP_ENTRY;
+
/// Map of Result pointers that correspond to all the pending connects.
MAP_MANAGER result_map_;
+
/// The lock to protect the result map which is shared. The queue
/// is updated by main thread in the register function call and
/// through the auxillary thread in the asynch pseudo task.
ACE_SYNCH_MUTEX lock_;
};
+
/**
* @class ACE_POSIX_Asynch_Transmit_File_Result
*
@@ -775,25 +922,34 @@ class ACE_Export ACE_POSIX_Asynch_Transmit_File_Result : public virtual ACE_Asyn
{
/// Factory classes will have special permissions.
friend class ACE_POSIX_Asynch_Transmit_File;
+
/// Handlers do all the job.
friend class ACE_POSIX_Asynch_Transmit_Handler;
+
/// The Proactor constructs the Result class for faking results.
friend class ACE_POSIX_Proactor;
+
public:
/// Socket used for transmitting the file.
ACE_HANDLE socket (void) const;
+
/// File from which the data is read.
ACE_HANDLE file (void) const;
+
/// Header and trailer data associated with this transmit file.
ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer (void) const;
+
/// The number of bytes which were requested at the start of the
/// asynchronous transmit file.
size_t bytes_to_write (void) const;
+
/// Number of bytes per send requested at the start of the transmit
/// file.
size_t bytes_per_send (void) const;
+
/// Flags which were passed into transmit file.
u_long flags (void) const;
+
protected:
ACE_POSIX_Asynch_Transmit_File_Result (const ACE_Handler::Proxy_Ptr &handler_proxy,
ACE_HANDLE socket,
@@ -810,28 +966,37 @@ protected:
int signal_number);
// Constructor is protected since creation is limited to
// ACE_Asynch_Transmit_File factory.
+
/// ACE_Proactor will call this method when the write completes.
virtual void complete (size_t bytes_transferred,
int success,
const void *completion_key,
u_long error);
+
/// Destructor.
virtual ~ACE_POSIX_Asynch_Transmit_File_Result (void);
+
/// Network I/O handle.
ACE_HANDLE socket_;
+
// aiocb::aio_filedes
// File I/O handle.
+
/// Header and trailer data associated with this transmit file.
ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer_;
+
// aiocb::aio_nbytes
// The number of bytes which were requested at the start of the
// asynchronous transmit file.
+
/// Number of bytes per send requested at the start of the transmit
/// file.
size_t bytes_per_send_;
+
/// Flags which were passed into transmit file.
u_long flags_;
};
+
/**
* @class ACE_POSIX_Asynch_Transmit_File
*
@@ -844,6 +1009,7 @@ class ACE_Export ACE_POSIX_Asynch_Transmit_File : public virtual ACE_Asynch_Tran
public:
/// Constructor.
ACE_POSIX_Asynch_Transmit_File (ACE_POSIX_Proactor *posix_proactor);
+
/**
* This starts off an asynchronous transmit file. The <file> is a
* handle to an open file. <header_and_trailer> is a pointer to a
@@ -865,10 +1031,12 @@ public:
const void *act,
int priority,
int signal_number = 0);
+
/// Destructor.
virtual ~ACE_POSIX_Asynch_Transmit_File (void);
};
+
/**
* @class ACE_POSIX_Asynch_Read_Dgram
*
@@ -889,6 +1057,7 @@ public:
/// Constructor.
ACE_POSIX_Asynch_Read_Dgram (ACE_POSIX_Proactor *posix_proactor);
virtual ~ACE_POSIX_Asynch_Read_Dgram (void);
+
/** This method queues an asynchronous read. Up to
* @a message_block->total_size() bytes will be read and stored in the
* @a message_block beginning at its write pointer. The @a message_block
@@ -917,10 +1086,12 @@ public:
const void *act,
int priority,
int signal_number);
+
protected:
/// Do-nothing constructor.
ACE_POSIX_Asynch_Read_Dgram (void);
};
+
/**
* @class ACE_POSIX__Asynch_Write_Dgram_Result
*
@@ -932,18 +1103,24 @@ class ACE_Export ACE_POSIX_Asynch_Write_Dgram_Result : public virtual ACE_Asynch
{
/// Factory classes will have special permissions.
friend class ACE_POSIX_Asynch_Write_Dgram;
+
/// Proactor class has special permission.
friend class ACE_POSIX_Proactor;
+
public:
/// The number of bytes which were requested at the start of the
/// asynchronous write.
size_t bytes_to_write (void) const;
+
/// Message block which contains the sent data
ACE_Message_Block *message_block (void) const;
+
/// The flags using in the write
int flags (void) const;
+
/// I/O handle used for writing.
ACE_HANDLE handle (void) const;
+
protected:
/// Constructor is protected since creation is limited to
/// ACE_Asynch_Write_Stream factory.
@@ -956,23 +1133,31 @@ protected:
ACE_HANDLE event,
int priority,
int signal_number);
+
/// ACE_Proactor will call this method when the write completes.
virtual void complete (size_t bytes_transferred,
int success,
const void *completion_key,
u_long error);
+
/// Destructor.
virtual ~ACE_POSIX_Asynch_Write_Dgram_Result (void);
+
/// The number of bytes which were requested at the start of the
/// asynchronous write.
size_t bytes_to_write_;
+
/// Message block used for the send.
ACE_Message_Block *message_block_;
+
/// The flags using in the write
int flags_;
+
/// I/O handle used for writing.
ACE_HANDLE handle_;
+
};
+
/**
* @class ACE_POSIX_Asynch_Write_Dgram
*
@@ -993,8 +1178,10 @@ class ACE_Export ACE_POSIX_Asynch_Write_Dgram : public virtual ACE_Asynch_Write_
public:
/// Constructor.
ACE_POSIX_Asynch_Write_Dgram (ACE_POSIX_Proactor *posix_proactor);
+
/// Destructor
virtual ~ACE_POSIX_Asynch_Write_Dgram (void);
+
/** This method queues an asynchronous send. Up to
* @a message_block->total_length bytes will be sent, beginning at the
* read pointer. The @a message_block read pointer will be updated to
@@ -1023,12 +1210,15 @@ public:
const void *act,
int priority,
int signal_number);
+
protected:
/// Do-nothing constructor.
ACE_POSIX_Asynch_Write_Dgram (void);
};
+
/*****************************************************/
+
/**
* @class ACE_POSIX_Asynch_Read_Dgram_Result
*
@@ -1038,23 +1228,32 @@ protected:
class ACE_Export ACE_POSIX_Asynch_Read_Dgram_Result : public virtual ACE_Asynch_Read_Dgram_Result_Impl,
public virtual ACE_POSIX_Asynch_Result
{
+
/// Factory classes will have special permissions.
friend class ACE_POSIX_Asynch_Read_Dgram;
+
/// Proactor class has special permission.
friend class ACE_POSIX_Proactor;
+
public:
/// The number of bytes which were requested at the start of the
/// asynchronous read.
size_t bytes_to_read (void) const;
+
/// Message block which contains the read data
ACE_Message_Block *message_block (void) const;
+
/// The address of where the packet came from
int remote_address (ACE_Addr& addr) const;
+
sockaddr *saddr (void) const;
+
/// The flags used in the read
int flags (void) const;
+
/// I/O handle used for reading.
ACE_HANDLE handle (void) const;
+
protected:
/// Constructor is protected since creation is limited to
/// ACE_Asynch_Read_Dgram factory.
@@ -1068,26 +1267,37 @@ protected:
ACE_HANDLE event,
int priority,
int signal_number = 0);
+
/// Proactor will call this method when the read completes.
virtual void complete (size_t bytes_transferred,
int success,
const void *completion_key,
u_long error);
+
/// Destructor.
virtual ~ACE_POSIX_Asynch_Read_Dgram_Result (void);
+
/// Bytes requested when the asynchronous read was initiated.
size_t bytes_to_read_;
+
/// Message block for reading the data into.
ACE_Message_Block *message_block_;
+
/// The address of where the packet came from
ACE_Addr *remote_address_;
+
int addr_len_;
+
/// The flags used in the read
int flags_;
+
/// I/O handle used for reading.
ACE_HANDLE handle_;
+
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_AIO_CALLS */
#endif /* ACE_POSIX_ASYNCH_IO_H */
diff --git a/dep/ACE_wrappers/ace/POSIX_CB_Proactor.cpp b/dep/ACE_wrappers/ace/POSIX_CB_Proactor.cpp
index cf42c9b6d78..8bf356d5f58 100644
--- a/dep/ACE_wrappers/ace/POSIX_CB_Proactor.cpp
+++ b/dep/ACE_wrappers/ace/POSIX_CB_Proactor.cpp
@@ -1,14 +1,20 @@
// $Id: POSIX_CB_Proactor.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/POSIX_CB_Proactor.h"
+
#if defined (ACE_HAS_AIO_CALLS) && !defined (ACE_HAS_BROKEN_SIGEVENT_STRUCT)
+
#include "ace/Task_T.h"
#include "ace/Log_Msg.h"
#include "ace/Object_Manager.h"
#include "ace/OS_NS_sys_time.h"
+
ACE_RCSID (ace,
POSIX_CB_Proactor,
"$Id: POSIX_CB_Proactor.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_POSIX_CB_Proactor::ACE_POSIX_CB_Proactor (size_t max_aio_operations)
: ACE_POSIX_AIOCB_Proactor (max_aio_operations,
ACE_POSIX_Proactor::PROACTOR_CB),
@@ -16,24 +22,29 @@ ACE_POSIX_CB_Proactor::ACE_POSIX_CB_Proactor (size_t max_aio_operations)
{
// we should start pseudo-asynchronous accept task
// one per all future acceptors
+
this->get_asynch_pseudo_task ().start ();
}
+
// Destructor.
ACE_POSIX_CB_Proactor::~ACE_POSIX_CB_Proactor (void)
{
this->close ();
}
+
ACE_POSIX_Proactor::Proactor_Type
ACE_POSIX_CB_Proactor::get_impl_type (void)
{
return PROACTOR_CB;
}
+
void ACE_POSIX_CB_Proactor::aio_completion_func (sigval cb_data)
{
ACE_POSIX_CB_Proactor * impl = static_cast<ACE_POSIX_CB_Proactor *> (cb_data.sival_ptr);
if ( impl != 0 )
impl->notify_completion (0);
}
+
#if defined (ACE_HAS_SIG_C_FUNC)
extern "C" void
ACE_POSIX_CB_Proactor_aio_completion (sigval cb_data)
@@ -41,6 +52,7 @@ ACE_POSIX_CB_Proactor_aio_completion (sigval cb_data)
ACE_POSIX_CB_Proactor::aio_completion_func (cb_data);
}
#endif /* ACE_HAS_SIG_C_FUNC */
+
int
ACE_POSIX_CB_Proactor::handle_events (ACE_Time_Value &wait_time)
{
@@ -48,24 +60,29 @@ ACE_POSIX_CB_Proactor::handle_events (ACE_Time_Value &wait_time)
ACE_Countdown_Time countdown (&wait_time);
return this->handle_events_i (wait_time.msec ());
}
+
int
ACE_POSIX_CB_Proactor::handle_events (void)
{
return this->handle_events_i (ACE_INFINITE);
}
+
int
ACE_POSIX_CB_Proactor::notify_completion (int sig_num)
{
ACE_UNUSED_ARG (sig_num);
+
return this->sema_.release();
}
+
ssize_t
ACE_POSIX_CB_Proactor::allocate_aio_slot (ACE_POSIX_Asynch_Result *result)
{
ssize_t slot = ACE_POSIX_AIOCB_Proactor::allocate_aio_slot (result);
if (slot == -1)
return -1;
+
// setup OS notification methods for this aio
// @@ TODO: This gets the completion method back to this proactor to
// find the completed aiocb. It would be so much better to not only get
@@ -83,13 +100,18 @@ ACE_POSIX_CB_Proactor::allocate_aio_slot (ACE_POSIX_Asynch_Result *result)
# endif /* ACE_HAS_SIG_C_FUNC */
result->aio_sigevent.sigev_notify_attributes = 0;
#endif /* __sgi */
+
result->aio_sigevent.sigev_value.sival_ptr = this ;
+
return slot;
}
+
int
ACE_POSIX_CB_Proactor::handle_events_i (u_long milli_seconds)
{
+
int result_wait=0;
+
// Wait for the signals.
if (milli_seconds == ACE_INFINITE)
{
@@ -100,8 +122,10 @@ ACE_POSIX_CB_Proactor::handle_events_i (u_long milli_seconds)
// Wait for <milli_seconds> amount of time.
ACE_Time_Value abs_time = ACE_OS::gettimeofday ()
+ ACE_Time_Value (0, milli_seconds * 1000);
+
result_wait = this->sema_.acquire(abs_time);
}
+
// Check for errors
// but let continue work in case of errors
// we should check "post_completed" queue
@@ -116,12 +140,16 @@ ACE_POSIX_CB_Proactor::handle_events_i (u_long milli_seconds)
"semaphore acquire failed"
));
}
+
size_t index = 0; // start index to scan aiocb list
size_t count = this->aiocb_list_max_size_; // max number to iterate
+
int error_status = 0;
size_t return_status = 0;
+
int ret_aio = 0;
int ret_que = 0;
+
for (;; ret_aio++)
{
ACE_POSIX_Asynch_Result * asynch_result =
@@ -129,23 +157,30 @@ ACE_POSIX_CB_Proactor::handle_events_i (u_long milli_seconds)
return_status,
index,
count);
+
if (asynch_result == 0)
break;
+
// Call the application code.
this->application_specific_code (asynch_result,
return_status, // Bytes transferred.
0, // No completion key.
error_status); // Error
}
+
// process post_completed results
ret_que = this->process_result_queue ();
+
// Uncomment this if you want to test
// and research the behavior of you system
// ACE_DEBUG ((LM_DEBUG,
// "(%t) NumAIO=%d NumQueue=%d\n",
// ret_aio, ret_que));
+
return ret_aio + ret_que > 0 ? 1 : 0;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_AIO_CALLS && !ACE_HAS_BROKEN_SIGEVENT_STRUCT */
diff --git a/dep/ACE_wrappers/ace/POSIX_CB_Proactor.h b/dep/ACE_wrappers/ace/POSIX_CB_Proactor.h
index 043f3fb3b99..1900a9422c5 100644
--- a/dep/ACE_wrappers/ace/POSIX_CB_Proactor.h
+++ b/dep/ACE_wrappers/ace/POSIX_CB_Proactor.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file POSIX_CB_Proactor.h
@@ -8,19 +9,27 @@
* @author Alexander Libman <alibman@ihug.com.au>
*/
//=============================================================================
+
#ifndef ACE_POSIX_CB_PROACTOR_H
#define ACE_POSIX_CB_PROACTOR_H
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_AIO_CALLS)
+
#include "ace/Synch_Traits.h"
#include "ace/Thread_Semaphore.h"
#include "ace/Null_Semaphore.h"
+
#include "ace/POSIX_Proactor.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_POSIX_CB_Proactor
*
@@ -29,17 +38,23 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
*/
class ACE_Export ACE_POSIX_CB_Proactor : public ACE_POSIX_AIOCB_Proactor
{
+
public:
virtual Proactor_Type get_impl_type (void);
+
/// Destructor.
virtual ~ACE_POSIX_CB_Proactor (void);
+
/// Constructor defines max number asynchronous operations that can
/// be started at the same time.
ACE_POSIX_CB_Proactor (size_t max_aio_operations = ACE_AIO_DEFAULT_SIZE);
+
// This only public so the "extern C" completion function can see it
// when needed.
static void aio_completion_func (sigval cb_data);
+
protected:
+
/**
* Dispatch a single set of events. If @a wait_time elapses before
* any events occur, return 0. Return 1 on success i.e., when a
@@ -47,6 +62,7 @@ protected:
* set accordingly.
*/
virtual int handle_events (ACE_Time_Value &wait_time);
+
/**
* Block indefinitely until at least one event is dispatched.
* Dispatch a single set of events. If @a wait_time elapses before
@@ -55,22 +71,28 @@ protected:
* set accordingly.
*/
virtual int handle_events (void);
+
/// Find free slot to store result and aiocb pointer
virtual ssize_t allocate_aio_slot (ACE_POSIX_Asynch_Result *result);
+
/// Notify queue of "post_completed" ACE_POSIX_Asynch_Results
/// called from post_completion method
virtual int notify_completion (int sig_num);
+
/**
* Dispatch a single set of events. If @a milli_seconds elapses
* before any events occur, return 0. Return 1 if a completion is
* dispatched. Return -1 on errors.
*/
int handle_events_i (u_long milli_seconds);
+
/// Semaphore variable to notify
/// used to wait the first AIO start
ACE_SYNCH_SEMAPHORE sema_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_AIO_CALLS */
#endif /* ACE_POSIX_CB_PROACTOR_H*/
diff --git a/dep/ACE_wrappers/ace/POSIX_Proactor.cpp b/dep/ACE_wrappers/ace/POSIX_Proactor.cpp
index 1f7e9e4b0b0..8079ac40fd8 100644
--- a/dep/ACE_wrappers/ace/POSIX_Proactor.cpp
+++ b/dep/ACE_wrappers/ace/POSIX_Proactor.cpp
@@ -1,12 +1,17 @@
// $Id: POSIX_Proactor.cpp 81697 2008-05-14 18:33:11Z johnnyw $
+
#include "ace/POSIX_Proactor.h"
+
#if defined (ACE_HAS_AIO_CALLS)
+
#if !defined (__ACE_INLINE__)
#include "ace/POSIX_Proactor.inl"
#endif /* __ACE_INLINE__ */
+
# if defined (ACE_HAS_SYS_SYSTEMINFO_H)
# include /**/ <sys/systeminfo.h>
# endif /* ACE_HAS_SYS_SYSTEMINFO_H */
+
#include "ace/ACE.h"
#include "ace/Flag_Manip.h"
#include "ace/Task_T.h"
@@ -15,11 +20,15 @@
#include "ace/OS_NS_sys_socket.h"
#include "ace/OS_NS_signal.h"
#include "ace/OS_NS_unistd.h"
+
#if defined (sun)
# include "ace/OS_NS_strings.h"
#endif /* sun */
+
// *********************************************************************
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_POSIX_Wakeup_Completion
*
@@ -36,50 +45,69 @@ public:
ACE_HANDLE event = ACE_INVALID_HANDLE,
int priority = 0,
int signal_number = ACE_SIGRTMIN);
+
/// Destructor.
virtual ~ACE_POSIX_Wakeup_Completion (void);
+
/// This method calls the <handler>'s <handle_wakeup> method.
virtual void complete (size_t bytes_transferred = 0,
int success = 1,
const void *completion_key = 0,
u_long error = 0);
};
+
// *********************************************************************
ACE_POSIX_Proactor::ACE_POSIX_Proactor (void)
: os_id_ (ACE_OS_UNDEFINED)
{
#if defined(sun)
+
os_id_ = ACE_OS_SUN; // set family
+
char Buf [32];
+
::memset(Buf,0,sizeof(Buf));
+
ACE_OS::sysinfo (SI_RELEASE , Buf, sizeof(Buf)-1);
+
if (ACE_OS::strcasecmp (Buf , "5.6") == 0)
os_id_ = ACE_OS_SUN_56;
else if (ACE_OS::strcasecmp (Buf , "5.7") == 0)
os_id_ = ACE_OS_SUN_57;
else if (ACE_OS::strcasecmp (Buf , "5.8") == 0)
os_id_ = ACE_OS_SUN_58;
+
#elif defined(HPUX)
+
os_id_ = ACE_OS_HPUX; // set family
+
#elif defined(__sgi)
+
os_id_ = ACE_OS_IRIX; // set family
+
#elif defined(__OpenBSD)
+
os_id_ = ACE_OS_OPENBSD; // set family
+
// do the same
+
//#else defined (LINUX, __FreeBSD__ ...)
//setup here os_id_
#endif
}
+
ACE_POSIX_Proactor::~ACE_POSIX_Proactor (void)
{
this->close ();
}
+
int
ACE_POSIX_Proactor::close (void)
{
return 0;
}
+
int
ACE_POSIX_Proactor::register_handle (ACE_HANDLE handle,
const void *completion_key)
@@ -88,33 +116,39 @@ ACE_POSIX_Proactor::register_handle (ACE_HANDLE handle,
ACE_UNUSED_ARG (completion_key);
return 0;
}
+
int
ACE_POSIX_Proactor::wake_up_dispatch_threads (void)
{
return 0;
}
+
int
ACE_POSIX_Proactor::close_dispatch_threads (int)
{
return 0;
}
+
size_t
ACE_POSIX_Proactor::number_of_threads (void) const
{
// @@ Implement it.
ACE_NOTSUP_RETURN (0);
}
+
void
ACE_POSIX_Proactor::number_of_threads (size_t threads)
{
// @@ Implement it.
ACE_UNUSED_ARG (threads);
}
+
ACE_HANDLE
ACE_POSIX_Proactor::get_handle (void) const
{
return ACE_INVALID_HANDLE;
}
+
ACE_Asynch_Read_Stream_Impl *
ACE_POSIX_Proactor::create_asynch_read_stream (void)
{
@@ -124,6 +158,7 @@ ACE_POSIX_Proactor::create_asynch_read_stream (void)
0);
return implementation;
}
+
ACE_Asynch_Read_Stream_Result_Impl *
ACE_POSIX_Proactor::create_asynch_read_stream_result
(const ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -149,6 +184,7 @@ ACE_POSIX_Proactor::create_asynch_read_stream_result
return implementation;
}
+
ACE_Asynch_Write_Stream_Impl *
ACE_POSIX_Proactor::create_asynch_write_stream (void)
{
@@ -158,6 +194,7 @@ ACE_POSIX_Proactor::create_asynch_write_stream (void)
0);
return implementation;
}
+
ACE_Asynch_Write_Stream_Result_Impl *
ACE_POSIX_Proactor::create_asynch_write_stream_result
(const ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -183,6 +220,7 @@ ACE_POSIX_Proactor::create_asynch_write_stream_result
return implementation;
}
+
ACE_Asynch_Read_File_Impl *
ACE_POSIX_Proactor::create_asynch_read_file (void)
{
@@ -192,6 +230,7 @@ ACE_POSIX_Proactor::create_asynch_read_file (void)
0);
return implementation;
}
+
ACE_Asynch_Read_File_Result_Impl *
ACE_POSIX_Proactor::create_asynch_read_file_result
(const ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -221,6 +260,7 @@ ACE_POSIX_Proactor::create_asynch_read_file_result
return implementation;
}
+
ACE_Asynch_Write_File_Impl *
ACE_POSIX_Proactor::create_asynch_write_file (void)
{
@@ -230,6 +270,7 @@ ACE_POSIX_Proactor::create_asynch_write_file (void)
0);
return implementation;
}
+
ACE_Asynch_Write_File_Result_Impl *
ACE_POSIX_Proactor::create_asynch_write_file_result
(const ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -259,6 +300,7 @@ ACE_POSIX_Proactor::create_asynch_write_file_result
return implementation;
}
+
ACE_Asynch_Read_Dgram_Impl *
ACE_POSIX_Proactor::create_asynch_read_dgram (void)
{
@@ -268,6 +310,7 @@ ACE_POSIX_Proactor::create_asynch_read_dgram (void)
0);
return implementation;
}
+
ACE_Asynch_Read_Dgram_Result_Impl *
ACE_POSIX_Proactor::create_asynch_read_dgram_result
(const ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -294,9 +337,11 @@ ACE_POSIX_Proactor::create_asynch_read_dgram_result
priority,
signal_number),
0);
+
return implementation;
}
+
ACE_Asynch_Write_Dgram_Impl *
ACE_POSIX_Proactor::create_asynch_write_dgram (void)
{
@@ -304,8 +349,10 @@ ACE_POSIX_Proactor::create_asynch_write_dgram (void)
ACE_NEW_RETURN (implementation,
ACE_POSIX_Asynch_Write_Dgram (this),
0);
+
return implementation;
}
+
ACE_Asynch_Write_Dgram_Result_Impl *
ACE_POSIX_Proactor::create_asynch_write_dgram_result
(const ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -330,9 +377,11 @@ ACE_POSIX_Proactor::create_asynch_write_dgram_result
priority,
signal_number),
0);
+
return implementation;
}
+
ACE_Asynch_Accept_Impl *
ACE_POSIX_Proactor::create_asynch_accept (void)
{
@@ -340,8 +389,10 @@ ACE_POSIX_Proactor::create_asynch_accept (void)
ACE_NEW_RETURN (implementation,
ACE_POSIX_Asynch_Accept (this),
0);
+
return implementation;
}
+
ACE_Asynch_Accept_Result_Impl *
ACE_POSIX_Proactor::create_asynch_accept_result
(const ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -369,6 +420,7 @@ ACE_POSIX_Proactor::create_asynch_accept_result
return implementation;
}
+
ACE_Asynch_Connect_Impl *
ACE_POSIX_Proactor::create_asynch_connect (void)
{
@@ -376,8 +428,10 @@ ACE_POSIX_Proactor::create_asynch_connect (void)
ACE_NEW_RETURN (implementation,
ACE_POSIX_Asynch_Connect (this),
0);
+
return implementation;
}
+
ACE_Asynch_Connect_Result_Impl *
ACE_POSIX_Proactor::create_asynch_connect_result
(const ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -399,6 +453,7 @@ ACE_POSIX_Proactor::create_asynch_connect_result
return implementation;
}
+
ACE_Asynch_Transmit_File_Impl *
ACE_POSIX_Proactor::create_asynch_transmit_file (void)
{
@@ -408,6 +463,7 @@ ACE_POSIX_Proactor::create_asynch_transmit_file (void)
0);
return implementation;
}
+
ACE_Asynch_Transmit_File_Result_Impl *
ACE_POSIX_Proactor::create_asynch_transmit_file_result
(const ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -442,6 +498,7 @@ ACE_POSIX_Proactor::create_asynch_transmit_file_result
0);
return implementation;
}
+
ACE_Asynch_Result_Impl *
ACE_POSIX_Proactor::create_asynch_timer
(const ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -462,33 +519,40 @@ ACE_POSIX_Proactor::create_asynch_timer
0);
return implementation;
}
+
#if 0
int
ACE_POSIX_Proactor::handle_signal (int, siginfo_t *, ucontext_t *)
{
// Perform a non-blocking "poll" for all the I/O events that have
// completed in the I/O completion queue.
+
ACE_Time_Value timeout (0, 0);
int result = 0;
+
for (;;)
{
result = this->handle_events (timeout);
if (result != 0 || errno == ETIME)
break;
}
+
// If our handle_events failed, we'll report a failure to the
// Reactor.
return result == -1 ? -1 : 0;
}
+
int
ACE_POSIX_Proactor::handle_close (ACE_HANDLE handle,
ACE_Reactor_Mask close_mask)
{
ACE_UNUSED_ARG (close_mask);
ACE_UNUSED_ARG (handle);
+
return this->close ();
}
#endif /* 0 */
+
void
ACE_POSIX_Proactor::application_specific_code (ACE_POSIX_Asynch_Result *asynch_result,
size_t bytes_transferred,
@@ -509,10 +573,12 @@ ACE_POSIX_Proactor::application_specific_code (ACE_POSIX_Asynch_Result *asynch_r
delete asynch_result;
}
}
+
int
ACE_POSIX_Proactor::post_wakeup_completions (int how_many)
{
ACE_POSIX_Wakeup_Completion *wakeup_completion = 0;
+
for (int ci = 0; ci < how_many; ci++)
{
ACE_NEW_RETURN
@@ -522,14 +588,17 @@ ACE_POSIX_Proactor::post_wakeup_completions (int how_many)
if (this->post_completion (wakeup_completion) == -1)
return -1;
}
+
return 0;
}
+
ACE_POSIX_Proactor::Proactor_Type
ACE_POSIX_Proactor::get_impl_type (void)
{
return PROACTOR_POSIX;
}
+
/**
* @class ACE_AIOCB_Notify_Pipe_Manager
*
@@ -540,6 +609,7 @@ ACE_POSIX_Proactor::get_impl_type (void)
* class is very useful in implementing <Asynch_Accept> operation
* class for the <AIOCB_Proactor>. This is also useful for
* implementing <post_completion> for <AIOCB_Proactor>.
+
* <AIOCB_Proactor> class issues a <Asynch_Read> on
* the pipe, using this class as the
* Handler. <POSIX_Asynch_Result *>'s are sent through the
@@ -562,26 +632,35 @@ public:
/// Constructor. You need the posix proactor because you need to call
/// <application_specific_code>
ACE_AIOCB_Notify_Pipe_Manager (ACE_POSIX_AIOCB_Proactor *posix_aiocb_proactor);
+
/// Destructor.
virtual ~ACE_AIOCB_Notify_Pipe_Manager (void);
+
/// Send the result pointer through the notification pipe.
int notify ();
+
/// This is the call back method when <Asynch_Read> from the pipe is
/// complete.
virtual void handle_read_stream (const ACE_Asynch_Read_Stream::Result &result);
+
private:
/// The implementation proactor class.
ACE_POSIX_AIOCB_Proactor *posix_aiocb_proactor_;
+
/// Message block to get ACE_POSIX_Asynch_Result pointer from the pipe.
ACE_Message_Block message_block_;
+
/// Pipe for the communication between Proactor and the
/// Asynch_Accept/Asynch_Connect and other post_completions
ACE_Pipe pipe_;
+
/// To do asynch_read on the pipe.
ACE_POSIX_Asynch_Read_Stream read_stream_;
+
/// Default constructor. Shouldnt be called.
ACE_AIOCB_Notify_Pipe_Manager (void);
};
+
ACE_AIOCB_Notify_Pipe_Manager::ACE_AIOCB_Notify_Pipe_Manager (ACE_POSIX_AIOCB_Proactor *posix_aiocb_proactor)
: posix_aiocb_proactor_ (posix_aiocb_proactor),
message_block_ (sizeof (2)),
@@ -589,12 +668,16 @@ ACE_AIOCB_Notify_Pipe_Manager::ACE_AIOCB_Notify_Pipe_Manager (ACE_POSIX_AIOCB_Pr
{
// Open the pipe.
this->pipe_.open ();
+
// Set write side in NONBLOCK mode
ACE::set_flags (this->pipe_.write_handle (), ACE_NONBLOCK);
+
// Set read side in BLOCK mode
ACE::clr_flags (this->pipe_.read_handle (), ACE_NONBLOCK);
+
// Let AIOCB_Proactor know about our handle
posix_aiocb_proactor_->set_notify_handle (this->pipe_.read_handle ());
+
// Open the read stream.
if (this->read_stream_.open (this->proxy (),
this->pipe_.read_handle (),
@@ -605,6 +688,7 @@ ACE_AIOCB_Notify_Pipe_Manager::ACE_AIOCB_Notify_Pipe_Manager (ACE_POSIX_AIOCB_Pr
"%N:%l:%p\n",
"ACE_AIOCB_Notify_Pipe_Manager::ACE_AIOCB_Notify_Pipe_Manager:"
"Open on Read Stream failed"));
+
// Issue an asynch_read on the read_stream of the notify pipe.
if (this->read_stream_.read (this->message_block_,
1, // enough to read 1 byte
@@ -616,10 +700,12 @@ ACE_AIOCB_Notify_Pipe_Manager::ACE_AIOCB_Notify_Pipe_Manager (ACE_POSIX_AIOCB_Pr
"ACE_AIOCB_Notify_Pipe_Manager::ACE_AIOCB_Notify_Pipe_Manager:"
"Read from pipe failed"));
}
+
ACE_AIOCB_Notify_Pipe_Manager::~ACE_AIOCB_Notify_Pipe_Manager (void)
{
// 1. try to cancel pending aio
this->read_stream_.cancel ();
+
// 2. close both handles
// Destuctor of ACE_Pipe does not close handles.
// We can not use ACE_Pipe::close() as it
@@ -629,14 +715,18 @@ ACE_AIOCB_Notify_Pipe_Manager::~ACE_AIOCB_Notify_Pipe_Manager (void)
// So we should close write_handle firstly
// to force read completion ( if 1. does not help )
// and then read_handle and not vice versa
+
ACE_HANDLE h = this->pipe_.write_handle ();
if (h != ACE_INVALID_HANDLE)
ACE_OS::closesocket (h);
+
h = this->pipe_.read_handle ();
if ( h != ACE_INVALID_HANDLE)
ACE_OS::closesocket (h);
+
}
+
int
ACE_AIOCB_Notify_Pipe_Manager::notify ()
{
@@ -645,6 +735,7 @@ ACE_AIOCB_Notify_Pipe_Manager::notify ()
ssize_t ret_val = ACE::send (this->pipe_.write_handle (),
&char_send,
sizeof (char_send));
+
if (ret_val < 0)
{
if (errno != EWOULDBLOCK)
@@ -656,17 +747,21 @@ ACE_AIOCB_Notify_Pipe_Manager::notify ()
#endif /* 0 */
return -1;
}
+
return 0;
}
+
void
ACE_AIOCB_Notify_Pipe_Manager::handle_read_stream
(const ACE_Asynch_Read_Stream::Result & /*result*/)
{
// 1. Start new read to avoid pipe overflow
+
// Set the message block properly. Put the <wr_ptr> back in the
// initial position.
if (this->message_block_.length () > 0)
this->message_block_.wr_ptr (this->message_block_.rd_ptr ());
+
// One accept has completed. Issue a read to handle any
// <post_completion>s in the future.
if (-1 == this->read_stream_.read (this->message_block_,
@@ -678,9 +773,11 @@ ACE_AIOCB_Notify_Pipe_Manager::handle_read_stream
ACE_TEXT ("ACE_AIOCB_Notify_Pipe_Manager::handle_read_stream:")
ACE_TEXT ("Read from pipe failed")));
+
// 2. Do the upcalls
// this->posix_aiocb_proactor_->process_result_queue ();
}
+
// Public constructor for common use.
ACE_POSIX_AIOCB_Proactor::ACE_POSIX_AIOCB_Proactor (size_t max_aio_operations)
: aiocb_notify_pipe_manager_ (0),
@@ -694,12 +791,17 @@ ACE_POSIX_AIOCB_Proactor::ACE_POSIX_AIOCB_Proactor (size_t max_aio_operations)
{
// Check for correct value for max_aio_operations
check_max_aio_num ();
+
this->create_result_aiocb_list ();
+
this->create_notify_manager ();
+
// start pseudo-asynchronous accept task
// one per all future acceptors
this->get_asynch_pseudo_task().start ();
+
}
+
// Special protected constructor for ACE_SUN_Proactor
ACE_POSIX_AIOCB_Proactor::ACE_POSIX_AIOCB_Proactor (size_t max_aio_operations,
ACE_POSIX_Proactor::Proactor_Type)
@@ -714,71 +816,92 @@ ACE_POSIX_AIOCB_Proactor::ACE_POSIX_AIOCB_Proactor (size_t max_aio_operations,
{
//check for correct value for max_aio_operations
this->check_max_aio_num ();
+
this->create_result_aiocb_list ();
+
// @@ We should create Notify_Pipe_Manager in the derived class to
// provide correct calls for virtual functions !!!
}
+
// Destructor.
ACE_POSIX_AIOCB_Proactor::~ACE_POSIX_AIOCB_Proactor (void)
{
this->close();
}
+
ACE_POSIX_Proactor::Proactor_Type
ACE_POSIX_AIOCB_Proactor::get_impl_type (void)
{
return PROACTOR_AIOCB;
}
+
int
ACE_POSIX_AIOCB_Proactor::close (void)
{
// stop asynch accept task
this->get_asynch_pseudo_task().stop ();
+
this->delete_notify_manager ();
+
this->clear_result_queue ();
+
return this->delete_result_aiocb_list ();
}
+
void ACE_POSIX_AIOCB_Proactor::set_notify_handle (ACE_HANDLE h)
{
notify_pipe_read_handle_ = h;
}
+
int ACE_POSIX_AIOCB_Proactor::create_result_aiocb_list (void)
{
if (aiocb_list_ != 0)
return 0;
+
ACE_NEW_RETURN (aiocb_list_, aiocb *[aiocb_list_max_size_], -1);
+
ACE_NEW_RETURN (result_list_,
ACE_POSIX_Asynch_Result *[aiocb_list_max_size_],
-1);
+
// Initialize the array.
for (size_t ai = 0; ai < this->aiocb_list_max_size_; ai++)
{
aiocb_list_[ai] = 0;
result_list_[ai] = 0;
}
+
return 0;
}
+
int ACE_POSIX_AIOCB_Proactor::delete_result_aiocb_list (void)
{
if (aiocb_list_ == 0) // already deleted
return 0;
+
size_t ai;
+
// Try to cancel all uncompleted operations; POSIX systems may have
// hidden system threads that still can work with our aiocbs!
for (ai = 0; ai < aiocb_list_max_size_; ai++)
if (this->aiocb_list_[ai] != 0) // active operation
this->cancel_aiocb (result_list_[ai]);
+
int num_pending = 0;
+
for (ai = 0; ai < aiocb_list_max_size_; ai++)
{
if (this->aiocb_list_[ai] == 0 ) // not active operation
continue;
+
// Get the error and return status of the aio_ operation.
int error_status = 0;
size_t transfer_count = 0;
int flg_completed = this->get_result_status (result_list_[ai],
error_status,
transfer_count);
+
//don't delete uncompleted AIOCB's
if (flg_completed == 0) // not completed !!!
{
@@ -787,9 +910,11 @@ int ACE_POSIX_AIOCB_Proactor::delete_result_aiocb_list (void)
char * errtxt = ACE_OS::strerror (error_status);
if (errtxt == 0)
errtxt ="?????????";
+
char * op = (aiocb_list_[ai]->aio_lio_opcode == LIO_WRITE )?
"WRITE":"READ" ;
+
ACE_ERROR ((LM_ERROR,
ACE_TEXT("slot=%d op=%s status=%d xfercnt=%d %s\n"),
ai,
@@ -806,6 +931,7 @@ int ACE_POSIX_AIOCB_Proactor::delete_result_aiocb_list (void)
this->aiocb_list_[ai] = 0;
}
}
+
// If it is not possible cancel some operation (num_pending > 0 ),
// we can do only one thing -report about this
// and complain about POSIX implementation.
@@ -816,53 +942,72 @@ int ACE_POSIX_AIOCB_Proactor::delete_result_aiocb_list (void)
ACE_TEXT("ACE_POSIX_AIOCB_Proactor::delete_result_aiocb_list\n")
ACE_TEXT(" number pending AIO=%d\n"),
num_pending));
+
delete [] this->aiocb_list_;
this->aiocb_list_ = 0;
+
delete [] this->result_list_;
this->result_list_ = 0;
+
return (num_pending == 0 ? 0 : -1);
// ?? or just always return 0;
}
+
void ACE_POSIX_AIOCB_Proactor::check_max_aio_num ()
{
long max_os_aio_num = ACE_OS::sysconf (_SC_AIO_MAX);
+
// Define max limit AIO's for concrete OS
// -1 means that there is no limit, but it is not true
// (example, SunOS 5.6)
+
if (max_os_aio_num > 0 &&
aiocb_list_max_size_ > (unsigned long) max_os_aio_num)
aiocb_list_max_size_ = max_os_aio_num;
+
#if defined (HPUX) || defined (__FreeBSD__)
// Although HPUX 11.00 allows to start 2048 AIO's for all process in
// system it has a limit 256 max elements for aio_suspend () It is a
// pity, but ...
+
long max_os_listio_num = ACE_OS::sysconf (_SC_AIO_LISTIO_MAX);
if (max_os_listio_num > 0
&& aiocb_list_max_size_ > (unsigned long) max_os_listio_num)
aiocb_list_max_size_ = max_os_listio_num;
#endif /* HPUX || __FreeBSD__ */
+
// check for user-defined value
// ACE_AIO_MAX_SIZE if defined in POSIX_Proactor.h
+
if (aiocb_list_max_size_ <= 0
|| aiocb_list_max_size_ > ACE_AIO_MAX_SIZE)
aiocb_list_max_size_ = ACE_AIO_MAX_SIZE;
+
// check for max number files to open
+
int max_num_files = ACE::max_handles ();
+
if (max_num_files > 0
&& aiocb_list_max_size_ > (unsigned long) max_num_files)
{
ACE::set_handle_limit (aiocb_list_max_size_);
+
max_num_files = ACE::max_handles ();
}
+
if (max_num_files > 0
&& aiocb_list_max_size_ > (unsigned long) max_num_files)
aiocb_list_max_size_ = (unsigned long) max_num_files;
+
ACE_DEBUG ((LM_DEBUG,
"(%P | %t) ACE_POSIX_AIOCB_Proactor::Max Number of AIOs=%d\n",
aiocb_list_max_size_));
+
#if defined(__sgi)
+
ACE_DEBUG((LM_DEBUG,
ACE_TEXT( "SGI IRIX specific: aio_init!\n")));
+
//typedef struct aioinit {
// int aio_threads; /* The number of aio threads to start (5) */
// int aio_locks; /* Initial number of preallocated locks (3) */
@@ -872,7 +1017,9 @@ void ACE_POSIX_AIOCB_Proactor::check_max_aio_num ()
// int aio_numusers; /* max number of user sprocs making aio_* calls (5) */
// int aio_reserved[3];
//} aioinit_t;
+
aioinit_t aioinit;
+
aioinit.aio_threads = 10; /* The number of aio threads to start (5) */
aioinit.aio_locks = 20; /* Initial number of preallocated locks (3) */
/* estimated total simultaneous aiobc structs (1000) */
@@ -883,27 +1030,35 @@ void ACE_POSIX_AIOCB_Proactor::check_max_aio_num ()
aioinit.aio_reserved[0] = 0;
aioinit.aio_reserved[1] = 0;
aioinit.aio_reserved[2] = 0;
+
aio_sgi_init (&aioinit);
+
#endif
+
return;
}
+
void
ACE_POSIX_AIOCB_Proactor::create_notify_manager (void)
{
// Remember! this issues a Asynch_Read
// on the notify pipe for doing the Asynch_Accept/Connect.
+
if (aiocb_notify_pipe_manager_ == 0)
ACE_NEW (aiocb_notify_pipe_manager_,
ACE_AIOCB_Notify_Pipe_Manager (this));
}
+
void
ACE_POSIX_AIOCB_Proactor::delete_notify_manager (void)
{
// We are responsible for delete as all pointers set to 0 after
// delete, it is save to delete twice
+
delete aiocb_notify_pipe_manager_;
aiocb_notify_pipe_manager_ = 0;
}
+
int
ACE_POSIX_AIOCB_Proactor::handle_events (ACE_Time_Value &wait_time)
{
@@ -911,70 +1066,92 @@ ACE_POSIX_AIOCB_Proactor::handle_events (ACE_Time_Value &wait_time)
ACE_Countdown_Time countdown (&wait_time);
return this->handle_events_i (wait_time.msec ());
}
+
int
ACE_POSIX_AIOCB_Proactor::handle_events (void)
{
return this->handle_events_i (ACE_INFINITE);
}
+
int
ACE_POSIX_AIOCB_Proactor::notify_completion(int sig_num)
{
ACE_UNUSED_ARG (sig_num);
+
return this->aiocb_notify_pipe_manager_->notify ();
}
+
int
ACE_POSIX_AIOCB_Proactor::post_completion (ACE_POSIX_Asynch_Result *result)
{
ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->mutex_, -1));
+
int ret_val = this->putq_result (result);
+
return ret_val;
}
+
int
ACE_POSIX_AIOCB_Proactor::putq_result (ACE_POSIX_Asynch_Result *result)
{
// this protected method should be called with locked mutex_
// we can't use GUARD as Proactor uses non-recursive mutex
+
if (!result)
return -1;
+
int sig_num = result->signal_number ();
int ret_val = this->result_queue_.enqueue_tail (result);
+
if (ret_val == -1)
ACE_ERROR_RETURN ((LM_ERROR,
"%N:%l:ACE_POSIX_AIOCB_Proactor::putq_result failed\n"),
-1);
+
this->notify_completion (sig_num);
+
return 0;
}
+
ACE_POSIX_Asynch_Result * ACE_POSIX_AIOCB_Proactor::getq_result (void)
{
ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->mutex_, 0));
+
ACE_POSIX_Asynch_Result* result = 0;
+
if (this->result_queue_.dequeue_head (result) != 0)
return 0;
+
// don't waste time if queue is empty - it is normal
// or check queue size before dequeue_head
// ACE_ERROR_RETURN ((LM_ERROR,
// "%N:%l:(%P | %t):%p\n",
// "ACE_POSIX_AIOCB_Proactor::getq_result failed"),
// 0);
+
return result;
}
+
int ACE_POSIX_AIOCB_Proactor::clear_result_queue (void)
{
int ret_val = 0;
ACE_POSIX_Asynch_Result* result = 0;
+
while ((result = this->getq_result ()) != 0)
{
delete result;
ret_val++;
}
+
return ret_val;
}
+
int ACE_POSIX_AIOCB_Proactor::process_result_queue (void)
{
int ret_val = 0;
ACE_POSIX_Asynch_Result* result = 0;
+
while ((result = this->getq_result ()) != 0)
{
this->application_specific_code
@@ -982,15 +1159,19 @@ int ACE_POSIX_AIOCB_Proactor::process_result_queue (void)
result->bytes_transferred(), // 0, No bytes transferred.
0, // No completion key.
result->error()); //0, No error.
+
ret_val++;
}
+
return ret_val;
}
+
int
ACE_POSIX_AIOCB_Proactor::handle_events_i (u_long milli_seconds)
{
int result_suspend = 0;
int retval= 0;
+
if (milli_seconds == ACE_INFINITE)
// Indefinite blocking.
result_suspend = aio_suspend (aiocb_list_,
@@ -1006,6 +1187,7 @@ ACE_POSIX_AIOCB_Proactor::handle_events_i (u_long milli_seconds)
aiocb_list_max_size_,
&timeout);
}
+
// Check for errors
if (result_suspend == -1)
{
@@ -1023,6 +1205,7 @@ ACE_POSIX_AIOCB_Proactor::handle_events_i (u_long milli_seconds)
size_t count = aiocb_list_max_size_; // max number to iterate
int error_status = 0;
size_t transfer_count = 0;
+
for (;; retval++)
{
ACE_POSIX_Asynch_Result *asynch_result =
@@ -1030,8 +1213,10 @@ ACE_POSIX_AIOCB_Proactor::handle_events_i (u_long milli_seconds)
transfer_count,
index,
count);
+
if (asynch_result == 0)
break;
+
// Call the application code.
this->application_specific_code (asynch_result,
transfer_count,
@@ -1039,26 +1224,32 @@ ACE_POSIX_AIOCB_Proactor::handle_events_i (u_long milli_seconds)
error_status);
}
}
+
// process post_completed results
retval += this->process_result_queue ();
+
return retval > 0 ? 1 : 0;
}
+
int
ACE_POSIX_AIOCB_Proactor::get_result_status (ACE_POSIX_Asynch_Result *asynch_result,
int &error_status,
size_t &transfer_count)
{
transfer_count = 0;
+
// Get the error status of the aio_ operation.
error_status = aio_error (asynch_result);
if (error_status == EINPROGRESS)
return 0; // not completed
+
ssize_t op_return = aio_return (asynch_result);
if (op_return > 0)
transfer_count = static_cast<size_t> (op_return);
// else transfer_count is already 0, error_status reports the error.
return 1; // completed
}
+
ACE_POSIX_Asynch_Result *
ACE_POSIX_AIOCB_Proactor::find_completed_aio (int &error_status,
size_t &transfer_count,
@@ -1067,54 +1258,73 @@ ACE_POSIX_AIOCB_Proactor::find_completed_aio (int &error_status,
{
// parameter index defines initial slot to scan
// parameter count tells us how many slots should we scan
+
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->mutex_, 0));
+
ACE_POSIX_Asynch_Result *asynch_result = 0;
+
if (num_started_aio_ == 0) // save time
return 0;
+
for (; count > 0; index++ , count--)
{
if (index >= aiocb_list_max_size_) // like a wheel
index = 0;
+
if (aiocb_list_[index] == 0) // Dont process null blocks.
continue;
+
if (0 != this->get_result_status (result_list_[index],
error_status,
transfer_count)) // completed
break;
+
} // end for
+
if (count == 0) // all processed , nothing found
return 0;
asynch_result = result_list_[index];
+
aiocb_list_[index] = 0;
result_list_[index] = 0;
aiocb_list_cur_size_--;
+
num_started_aio_--; // decrement count active aios
index++; // for next iteration
count--; // for next iteration
+
this->start_deferred_aio ();
//make attempt to start deferred AIO
//It is safe as we are protected by mutex_
+
return asynch_result;
}
+
int
ACE_POSIX_AIOCB_Proactor::start_aio (ACE_POSIX_Asynch_Result *result,
ACE_POSIX_Proactor::Opcode op)
{
ACE_TRACE ("ACE_POSIX_AIOCB_Proactor::start_aio");
+
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->mutex_, -1));
+
int ret_val = (aiocb_list_cur_size_ >= aiocb_list_max_size_) ? -1 : 0;
+
if (result == 0) // Just check the status of the list
return ret_val;
+
// Save operation code in the aiocb
switch (op)
{
case ACE_POSIX_Proactor::ACE_OPCODE_READ:
result->aio_lio_opcode = LIO_READ;
break;
+
case ACE_POSIX_Proactor::ACE_OPCODE_WRITE:
result->aio_lio_opcode = LIO_WRITE;
break;
+
default:
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("%N:%l:(%P|%t)::")
@@ -1122,40 +1332,53 @@ ACE_POSIX_AIOCB_Proactor::start_aio (ACE_POSIX_Asynch_Result *result,
op),
-1);
}
+
if (ret_val != 0) // No free slot
{
errno = EAGAIN;
return -1;
}
+
// Find a free slot and store.
+
ssize_t slot = allocate_aio_slot (result);
+
if (slot < 0)
return -1;
+
size_t index = static_cast<size_t> (slot);
+
result_list_[index] = result; //Store result ptr anyway
aiocb_list_cur_size_++;
+
ret_val = start_aio_i (result);
switch (ret_val)
{
case 0: // started OK
aiocb_list_[index] = result;
return 0;
+
case 1: // OS AIO queue overflow
num_deferred_aiocb_ ++;
return 0;
+
default: // Invalid request, there is no point
break; // to start it later
}
+
result_list_[index] = 0;
aiocb_list_cur_size_--;
return -1;
}
+
ssize_t
ACE_POSIX_AIOCB_Proactor::allocate_aio_slot (ACE_POSIX_Asynch_Result *result)
{
size_t i = 0;
+
// we reserve zero slot for ACE_AIOCB_Notify_Pipe_Manager
// so make check for ACE_AIOCB_Notify_Pipe_Manager request
+
if (notify_pipe_read_handle_ == result->aio_fildes) // Notify_Pipe ?
{ // should be free,
if (result_list_[i] != 0) // only 1 request
@@ -1174,27 +1397,35 @@ ACE_POSIX_AIOCB_Proactor::allocate_aio_slot (ACE_POSIX_Asynch_Result *result)
if (result_list_[i] == 0)
break;
}
+
if (i >= this->aiocb_list_max_size_)
ACE_ERROR_RETURN ((LM_ERROR,
"%N:%l:(%P | %t)::\n"
"ACE_POSIX_AIOCB_Proactor::allocate_aio_slot:"
"internal Proactor error 1\n"),
-1);
+
//setup OS notification methods for this aio
result->aio_sigevent.sigev_notify = SIGEV_NONE;
+
return static_cast<ssize_t> (i);
}
+
// start_aio_i has new return codes
// 0 AIO was started successfully
// 1 AIO was not started, OS AIO queue overflow
// -1 AIO was not started, other errors
+
int
ACE_POSIX_AIOCB_Proactor::start_aio_i (ACE_POSIX_Asynch_Result *result)
{
ACE_TRACE ("ACE_POSIX_AIOCB_Proactor::start_aio_i");
+
int ret_val;
const ACE_TCHAR *ptype = 0;
+
// Start IO
+
switch (result->aio_lio_opcode )
{
case LIO_READ :
@@ -1210,6 +1441,7 @@ ACE_POSIX_AIOCB_Proactor::start_aio_i (ACE_POSIX_Asynch_Result *result)
ret_val = -1;
break;
}
+
if (ret_val == 0)
{
++this->num_started_aio_;
@@ -1224,13 +1456,16 @@ ACE_POSIX_AIOCB_Proactor::start_aio_i (ACE_POSIX_Asynch_Result *result)
ptype,
ACE_TEXT ("queueing failed")));
}
+
return ret_val;
}
+
int
ACE_POSIX_AIOCB_Proactor::start_deferred_aio ()
{
ACE_TRACE ("ACE_POSIX_AIOCB_Proactor::start_deferred_aio");
+
// This protected method is called from
// find_completed_aio after any AIO completion
// We should call this method always with locked
@@ -1238,41 +1473,56 @@ ACE_POSIX_AIOCB_Proactor::start_deferred_aio ()
//
// It tries to start the first deferred AIO
// if such exists
+
if (num_deferred_aiocb_ == 0)
return 0; // nothing to do
+
size_t i = 0;
+
for (i= 0; i < this->aiocb_list_max_size_; i++)
if (result_list_[i] !=0 // check for
&& aiocb_list_[i] ==0) // deferred AIO
break;
+
if (i >= this->aiocb_list_max_size_)
ACE_ERROR_RETURN ((LM_ERROR,
"%N:%l:(%P | %t)::\n"
"start_deferred_aio:"
"internal Proactor error 3\n"),
-1);
+
ACE_POSIX_Asynch_Result *result = result_list_[i];
+
int ret_val = start_aio_i (result);
+
switch (ret_val)
{
case 0 : //started OK , decrement count of deferred AIOs
aiocb_list_[i] = result;
num_deferred_aiocb_ --;
return 0;
+
case 1 :
return 0; //try again later
+
default : // Invalid Parameters , should never be
break;
}
+
//AL notify user
+
result_list_[i] = 0;
--aiocb_list_cur_size_;
+
--num_deferred_aiocb_;
+
result->set_error (errno);
result->set_bytes_transferred (0);
this->putq_result (result); // we are with locked mutex_ here !
+
return -1;
}
+
int
ACE_POSIX_AIOCB_Proactor::cancel_aio (ACE_HANDLE handle)
{
@@ -1288,27 +1538,38 @@ ACE_POSIX_AIOCB_Proactor::cancel_aio (ACE_HANDLE handle)
// it calls ::aio_cancel. According to the POSIX standards
// we will receive ECANCELED for all ::aio_canceled AIO requests
// later on return from ::aio_suspend
+
ACE_TRACE ("ACE_POSIX_AIOCB_Proactor::cancel_aio");
+
int num_total = 0;
int num_cancelled = 0;
+
{
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->mutex_, -1));
+
size_t ai = 0;
+
for (ai = 0; ai < this->aiocb_list_max_size_; ai++)
{
if (this->result_list_[ai] == 0) // Skip empty slot
continue;
+
if (this->result_list_[ai]->aio_fildes != handle) // Not ours
continue;
+
++num_total;
+
ACE_POSIX_Asynch_Result *asynch_result = this->result_list_[ai];
+
if (this->aiocb_list_[ai] == 0) // Canceling a deferred operation
{
num_cancelled++;
this->num_deferred_aiocb_--;
+
this->aiocb_list_[ai] = 0;
this->result_list_[ai] = 0;
this->aiocb_list_cur_size_--;
+
asynch_result->set_error (ECANCELED);
asynch_result->set_bytes_transferred (0);
this->putq_result (asynch_result);
@@ -1317,23 +1578,30 @@ ACE_POSIX_AIOCB_Proactor::cancel_aio (ACE_HANDLE handle)
else // Cancel started aio
{
int rc_cancel = this->cancel_aiocb (asynch_result);
+
if (rc_cancel == 0) //notification in the future
num_cancelled++; //it is OS responsiblity
}
}
+
} // release mutex_
+
if (num_total == 0)
return 1; // ALLDONE
+
if (num_cancelled == num_total)
return 0; // CANCELLED
+
return 2; // NOT CANCELLED
}
+
int
ACE_POSIX_AIOCB_Proactor::cancel_aiocb (ACE_POSIX_Asynch_Result * result)
{
// This method is called from cancel_aio
// to cancel a previously submitted AIO request
int rc = ::aio_cancel (0, result);
+
// Check the return value and return 0/1/2 appropriately.
if (rc == AIO_CANCELED)
return 0;
@@ -1343,8 +1611,11 @@ ACE_POSIX_AIOCB_Proactor::cancel_aiocb (ACE_POSIX_Asynch_Result * result)
return 2;
}
+
// *********************************************************************
+
#if defined(ACE_HAS_POSIX_REALTIME_SIGNALS)
+
ACE_POSIX_SIG_Proactor::ACE_POSIX_SIG_Proactor (size_t max_aio_operations)
: ACE_POSIX_AIOCB_Proactor (max_aio_operations,
ACE_POSIX_Proactor::PROACTOR_SIG)
@@ -1352,8 +1623,10 @@ ACE_POSIX_SIG_Proactor::ACE_POSIX_SIG_Proactor (size_t max_aio_operations)
// = Set up the mask we'll use to block waiting for SIGRTMIN. Use that
// to add it to the signal mask for this thread, and also set the process
// signal action to pass signal information when we want it.
+
// Clear the signal set.
ACE_OS::sigemptyset (&this->RT_completion_signals_);
+
// Add the signal number to the signal set.
if (ACE_OS::sigaddset (&this->RT_completion_signals_, ACE_SIGRTMIN) == -1)
ACE_ERROR ((LM_ERROR, ACE_TEXT ("ACE_POSIX_SIG_Proactor: %p\n"),
@@ -1361,12 +1634,15 @@ ACE_POSIX_SIG_Proactor::ACE_POSIX_SIG_Proactor (size_t max_aio_operations)
this->block_signals ();
// Set up the signal action for SIGRTMIN.
this->setup_signal_handler (ACE_SIGRTMIN);
+
// we do not have to create notify manager
// but we should start pseudo-asynchronous accept task
// one per all future acceptors
+
this->get_asynch_pseudo_task().start ();
return;
}
+
ACE_POSIX_SIG_Proactor::ACE_POSIX_SIG_Proactor (const sigset_t signal_set,
size_t max_aio_operations)
: ACE_POSIX_AIOCB_Proactor (max_aio_operations,
@@ -1374,12 +1650,15 @@ ACE_POSIX_SIG_Proactor::ACE_POSIX_SIG_Proactor (const sigset_t signal_set,
{
// = Keep <Signal_set> with the Proactor, mask all the signals and
// setup signal actions for the signals in the <signal_set>.
+
// = Keep <signal_set> with the Proactor.
+
// Empty the signal set first.
if (sigemptyset (&this->RT_completion_signals_) == -1)
ACE_ERROR ((LM_ERROR,
"Error:(%P | %t):%p\n",
"sigemptyset failed"));
+
// For each signal number present in the <signal_set>, add it to
// the signal set we use, and also set up its process signal action
// to allow signal info to be passed into sigwait/sigtimedwait.
@@ -1399,24 +1678,31 @@ ACE_POSIX_SIG_Proactor::ACE_POSIX_SIG_Proactor (const sigset_t signal_set,
this->setup_signal_handler (si);
}
}
+
// Mask all the signals.
this->block_signals ();
+
// we do not have to create notify manager
// but we should start pseudo-asynchronous accept task
// one per all future acceptors
+
this->get_asynch_pseudo_task().start ();
return;
}
+
ACE_POSIX_SIG_Proactor::~ACE_POSIX_SIG_Proactor (void)
{
this->close ();
+
// @@ Enable the masked signals again.
}
+
ACE_POSIX_Proactor::Proactor_Type
ACE_POSIX_SIG_Proactor::get_impl_type (void)
{
return PROACTOR_SIG;
}
+
int
ACE_POSIX_SIG_Proactor::handle_events (ACE_Time_Value &wait_time)
{
@@ -1424,11 +1710,13 @@ ACE_POSIX_SIG_Proactor::handle_events (ACE_Time_Value &wait_time)
ACE_Countdown_Time countdown (&wait_time);
return this->handle_events_i (&wait_time);
}
+
int
ACE_POSIX_SIG_Proactor::handle_events (void)
{
return this->handle_events_i (0);
}
+
int
ACE_POSIX_SIG_Proactor::notify_completion (int sig_num)
{
@@ -1439,6 +1727,7 @@ ACE_POSIX_SIG_Proactor::notify_completion (int sig_num)
"Error:%N:%l(%P | %t):%p",
"<getpid> failed"),
-1);
+
// Set the signal information.
sigval value;
#if defined (ACE_HAS_SIGVAL_SIGVAL_INT)
@@ -1446,9 +1735,11 @@ ACE_POSIX_SIG_Proactor::notify_completion (int sig_num)
#else
value.sival_int = -1;
#endif /* ACE_HAS_SIGVAL_SIGVAL_INT */
+
// Queue the signal.
if (sigqueue (pid, sig_num, value) == 0)
return 0;
+
if (errno != EAGAIN)
ACE_ERROR_RETURN ((LM_ERROR,
"Error:%N:%l:(%P | %t):%p\n",
@@ -1456,6 +1747,7 @@ ACE_POSIX_SIG_Proactor::notify_completion (int sig_num)
-1);
return -1;
}
+
ACE_Asynch_Result_Impl *
ACE_POSIX_SIG_Proactor::create_asynch_timer
(const ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -1466,6 +1758,7 @@ ACE_POSIX_SIG_Proactor::create_asynch_timer
int signal_number)
{
int is_member = 0;
+
// Fix the signal number.
if (signal_number == -1)
{
@@ -1483,6 +1776,7 @@ ACE_POSIX_SIG_Proactor::create_asynch_timer
"sigismember failed"),
0);
}
+
if (is_member == 0)
ACE_ERROR_RETURN ((LM_ERROR,
"Error:%N:%l:(%P | %t)::%s\n",
@@ -1493,6 +1787,7 @@ ACE_POSIX_SIG_Proactor::create_asynch_timer
// + 1 to nullify loop increment.
signal_number = si + 1;
}
+
ACE_Asynch_Result_Impl *implementation;
ACE_NEW_RETURN (implementation,
ACE_POSIX_Asynch_Timer (handler_proxy,
@@ -1504,6 +1799,7 @@ ACE_POSIX_SIG_Proactor::create_asynch_timer
0);
return implementation;
}
+
#if 0
static void
sig_handler (int sig_num, siginfo_t *, ucontext_t *)
@@ -1514,6 +1810,7 @@ sig_handler (int sig_num, siginfo_t *, ucontext_t *)
sig_num));
}
#endif /*if 0*/
+
int
ACE_POSIX_SIG_Proactor::setup_signal_handler (int signal_number) const
{
@@ -1521,6 +1818,7 @@ ACE_POSIX_SIG_Proactor::setup_signal_handler (int signal_number) const
// passed to sigwaitinfo/sigtimedwait. Don't change the default
// signal handler - having a handler and waiting for the signal can
// produce undefined behavior.
+
// But can not use SIG_DFL
// With SIG_DFL after delivering the first signal
// SIG_DFL handler resets SA_SIGINFO flags
@@ -1545,25 +1843,30 @@ ACE_POSIX_SIG_Proactor::setup_signal_handler (int signal_number) const
return 0;
}
+
int
ACE_POSIX_SIG_Proactor::block_signals (void) const
{
return ACE_OS::pthread_sigmask (SIG_BLOCK, &this->RT_completion_signals_, 0);
}
+
ssize_t
ACE_POSIX_SIG_Proactor::allocate_aio_slot (ACE_POSIX_Asynch_Result *result)
{
size_t i = 0;
+
//try to find free slot as usual, starting from 0
for (i = 0; i < this->aiocb_list_max_size_; i++)
if (result_list_[i] == 0)
break;
+
if (i >= this->aiocb_list_max_size_)
ACE_ERROR_RETURN ((LM_ERROR,
"%N:%l:(%P | %t)::\n"
"ACE_POSIX_SIG_Proactor::allocate_aio_slot "
"internal Proactor error 1\n"),
-1);
+
// setup OS notification methods for this aio
// store index!!, not pointer in signal info
result->aio_sigevent.sigev_notify = SIGEV_SIGNAL;
@@ -1573,13 +1876,16 @@ ACE_POSIX_SIG_Proactor::allocate_aio_slot (ACE_POSIX_Asynch_Result *result)
#else
result->aio_sigevent.sigev_value.sival_int = static_cast<int> (i);
#endif /* ACE_HAS_SIGVAL_SIGVAL_INT */
+
return static_cast<ssize_t> (i);
}
+
int
ACE_POSIX_SIG_Proactor::handle_events_i (const ACE_Time_Value *timeout)
{
int result_sigwait = 0;
siginfo_t sig_info;
+
do
{
// Wait for the signals.
@@ -1598,16 +1904,20 @@ ACE_POSIX_SIG_Proactor::handle_events_i (const ACE_Time_Value *timeout)
}
}
while (result_sigwait == -1 && errno == EINTR);
+
if (result_sigwait == -1) // Not a timeout, not EINTR: tell caller of error
return -1;
+
// Decide what to do. We always check the completion queue since it's an
// easy, quick check. What is decided here is whether to check for
// I/O completions and, if so, how completely to scan.
int flg_aio = 0; // 1 if AIO Completion possible
+
size_t index = 0; // start index to scan aiocb list
size_t count = 1; // max number of aiocbs to scan
int error_status = 0;
size_t transfer_count = 0;
+
if (sig_info.si_code == SI_ASYNCIO || this->os_id_ == ACE_OS_SUN_56)
{
flg_aio = 1; // AIO signal received
@@ -1648,8 +1958,10 @@ ACE_POSIX_SIG_Proactor::handle_events_i (const ACE_Time_Value *timeout)
result_sigwait, sig_info.si_code));
flg_aio = 1;
}
+
int ret_aio = 0;
int ret_que = 0;
+
if (flg_aio)
for (;; ret_aio++)
{
@@ -1658,16 +1970,20 @@ ACE_POSIX_SIG_Proactor::handle_events_i (const ACE_Time_Value *timeout)
transfer_count,
index,
count);
+
if (asynch_result == 0)
break;
+
// Call the application code.
this->application_specific_code (asynch_result,
transfer_count,
0, // No completion key.
error_status); // Error
}
+
// process post_completed results
ret_que = this->process_result_queue ();
+
// Uncomment this if you want to test
// and research the behavior of you system
#if 0
@@ -1675,10 +1991,14 @@ ACE_POSIX_SIG_Proactor::handle_events_i (const ACE_Time_Value *timeout)
"(%t) NumAIO=%d NumQueue=%d\n",
ret_aio, ret_que));
#endif
+
return ret_aio + ret_que > 0 ? 1 : 0;
}
+
#endif /* ACE_HAS_POSIX_REALTIME_SIGNALS */
+
// *********************************************************************
+
ACE_POSIX_Asynch_Timer::ACE_POSIX_Asynch_Timer
(const ACE_Handler::Proxy_Ptr &handler_proxy,
const void *act,
@@ -1691,6 +2011,7 @@ ACE_POSIX_Asynch_Timer::ACE_POSIX_Asynch_Timer
time_ (tv)
{
}
+
void
ACE_POSIX_Asynch_Timer::complete (size_t /* bytes_transferred */,
int /* success */,
@@ -1702,7 +2023,9 @@ ACE_POSIX_Asynch_Timer::complete (size_t /* bytes_transferred */,
handler->handle_time_out (this->time_, this->act ());
}
+
// *********************************************************************
+
ACE_POSIX_Wakeup_Completion::ACE_POSIX_Wakeup_Completion
(const ACE_Handler::Proxy_Ptr &handler_proxy,
const void *act,
@@ -1719,19 +2042,24 @@ ACE_POSIX_Wakeup_Completion::ACE_POSIX_Wakeup_Completion
signal_number)
{
}
+
ACE_POSIX_Wakeup_Completion::~ACE_POSIX_Wakeup_Completion (void)
{
}
+
void
ACE_POSIX_Wakeup_Completion::complete (size_t /* bytes_transferred */,
int /* success */,
const void * /* completion_key */,
u_long /* error */)
{
+
ACE_Handler *handler = this->handler_proxy_.get ()->handler ();
if (handler != 0)
handler->handle_wakeup ();
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_AIO_CALLS */
diff --git a/dep/ACE_wrappers/ace/POSIX_Proactor.h b/dep/ACE_wrappers/ace/POSIX_Proactor.h
index 4e7b170fd2d..e3088d756a5 100644
--- a/dep/ACE_wrappers/ace/POSIX_Proactor.h
+++ b/dep/ACE_wrappers/ace/POSIX_Proactor.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file POSIX_Proactor.h
@@ -12,23 +13,31 @@
* @author Alexander Libman <alibman@baltimore.com>
*/
//=============================================================================
+
#ifndef ACE_POSIX_PROACTOR_H
#define ACE_POSIX_PROACTOR_H
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
#pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_AIO_CALLS)
// POSIX implementation of Proactor depends on the <aio_> family of
// system calls.
+
#include "ace/Proactor_Impl.h"
#include "ace/Free_List.h"
#include "ace/Pipe.h"
#include "ace/POSIX_Asynch_IO.h"
#include "ace/Asynch_Pseudo_Task.h"
+
#define ACE_AIO_MAX_SIZE 2048
#define ACE_AIO_DEFAULT_SIZE 1024
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_POSIX_Proactor
*
@@ -50,16 +59,21 @@ public:
{
/// Base class type
PROACTOR_POSIX = 0,
+
/// Aio_suspend() based
PROACTOR_AIOCB = 1,
+
/// Signals notifications
PROACTOR_SIG = 2,
+
/// SUN specific aiowait()
PROACTOR_SUN = 3,
+
/// Callback notifications
PROACTOR_CB = 4
};
+
enum SystemType // open for future extention
{
ACE_OS_UNDEFINED= 0x0000,
@@ -78,15 +92,20 @@ public:
ACE_OS_IRIX = 0x2000, // SGI IRIX family
ACE_OS_OPENBSD = 0x4000 // OpenBSD familty
};
+
enum Opcode {
ACE_OPCODE_READ = 1,
ACE_OPCODE_WRITE = 2
};
+
virtual Proactor_Type get_impl_type (void);
+
/// Virtual destructor.
virtual ~ACE_POSIX_Proactor (void);
+
/// Close down the Proactor.
virtual int close (void);
+
/**
* Dispatch a single set of events. If @a wait_time elapses before
* any events occur, return 0. Return 1 on success i.e., when a
@@ -94,6 +113,7 @@ public:
* set accordingly.
*/
virtual int handle_events (ACE_Time_Value &wait_time) = 0;
+
/**
* Block indefinitely until at least one event is dispatched.
* Dispatch a single set of events.Return 1 on success i.e., when a
@@ -101,6 +121,7 @@ public:
* set accordingly.
*/
virtual int handle_events (void) = 0;
+
/**
* Post a result to the completion port of the Proactor. If errors
* occur, the result will be deleted by this method. If successful,
@@ -110,24 +131,34 @@ public:
* user once this method is called.
*/
virtual int post_completion (ACE_POSIX_Asynch_Result *result) = 0;
+
virtual int start_aio (ACE_POSIX_Asynch_Result *result, Opcode op) = 0;
+
virtual int cancel_aio (ACE_HANDLE h) = 0;
+
/// Task to process pseudo-asynchronous operations
ACE_Asynch_Pseudo_Task &get_asynch_pseudo_task ();
+
/// This function is a no-op function for Unix systems. Returns 0.
virtual int register_handle (ACE_HANDLE handle,
const void *completion_key);
+
/// @@ This is a no-op on POSIX platforms. Returns 0.
int wake_up_dispatch_threads (void);
+
/// @@ This is a no-op on POSIX platforms. Returns 0.
int close_dispatch_threads (int wait);
+
/// @@ This is a no-op on POSIX platforms. Returns 0.
size_t number_of_threads (void) const;
void number_of_threads (size_t threads);
+
/// This is a no-op in POSIX. Returns ACE_INVALID_HANDLE.
virtual ACE_HANDLE get_handle (void) const;
+
// Methods used to create Asynch IO factory and result objects. We
// create the right objects here in these methods.
+
virtual ACE_Asynch_Read_Stream_Impl *create_asynch_read_stream (void);
virtual ACE_Asynch_Read_Stream_Result_Impl *
create_asynch_read_stream_result (const ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -138,6 +169,7 @@ public:
ACE_HANDLE event = ACE_INVALID_HANDLE,
int priority = 0,
int signal_number = ACE_SIGRTMIN);
+
virtual ACE_Asynch_Write_Stream_Impl *create_asynch_write_stream (void);
virtual ACE_Asynch_Write_Stream_Result_Impl *
create_asynch_write_stream_result (const ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -148,6 +180,7 @@ public:
ACE_HANDLE event = ACE_INVALID_HANDLE,
int priority = 0,
int signal_number = ACE_SIGRTMIN);
+
virtual ACE_Asynch_Read_File_Impl *create_asynch_read_file (void);
virtual ACE_Asynch_Read_File_Result_Impl *
create_asynch_read_file_result (const ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -160,6 +193,7 @@ public:
ACE_HANDLE event = ACE_INVALID_HANDLE,
int priority = 0,
int signal_number = ACE_SIGRTMIN);
+
virtual ACE_Asynch_Write_File_Impl *create_asynch_write_file (void);
virtual ACE_Asynch_Write_File_Result_Impl *
create_asynch_write_file_result (const ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -172,6 +206,7 @@ public:
ACE_HANDLE event = ACE_INVALID_HANDLE,
int priority = 0,
int signal_number = ACE_SIGRTMIN);
+
virtual ACE_Asynch_Read_Dgram_Impl *create_asynch_read_dgram (void);
virtual ACE_Asynch_Read_Dgram_Result_Impl *
create_asynch_read_dgram_result (const ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -184,6 +219,7 @@ public:
ACE_HANDLE event = ACE_INVALID_HANDLE,
int priority = 0,
int signal_number = ACE_SIGRTMIN);
+
virtual ACE_Asynch_Write_Dgram_Impl *create_asynch_write_dgram (void);
virtual ACE_Asynch_Write_Dgram_Result_Impl *
create_asynch_write_dgram_result (const ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -195,6 +231,7 @@ public:
ACE_HANDLE event = ACE_INVALID_HANDLE,
int priority = 0,
int signal_number = ACE_SIGRTMIN);
+
virtual ACE_Asynch_Accept_Impl *create_asynch_accept (void);
virtual ACE_Asynch_Accept_Result_Impl *
create_asynch_accept_result (const ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -206,6 +243,7 @@ public:
ACE_HANDLE event = ACE_INVALID_HANDLE,
int priority = 0,
int signal_number = ACE_SIGRTMIN);
+
virtual ACE_Asynch_Connect_Impl *create_asynch_connect (void);
virtual ACE_Asynch_Connect_Result_Impl *
create_asynch_connect_result (const ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -214,6 +252,7 @@ public:
ACE_HANDLE event = ACE_INVALID_HANDLE,
int priority = 0,
int signal_number = ACE_SIGRTMIN);
+
virtual ACE_Asynch_Transmit_File_Impl *create_asynch_transmit_file (void);
virtual ACE_Asynch_Transmit_File_Result_Impl *
create_asynch_transmit_file_result (const ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -229,6 +268,7 @@ public:
ACE_HANDLE event = ACE_INVALID_HANDLE,
int priority = 0,
int signal_number = ACE_SIGRTMIN);
+
/// Create a timer result object which can be used with the Timer
/// mechanism of the Proactor.
virtual ACE_Asynch_Result_Impl *
@@ -238,9 +278,11 @@ public:
ACE_HANDLE event = ACE_INVALID_HANDLE,
int priority = 0,
int signal_number = ACE_SIGRTMIN);
+
protected:
/// Constructor.
ACE_POSIX_Proactor (void);
+
/**
* Protect against structured exceptions caused by user code when
* dispatching handles. The <completion_key> is not very useful
@@ -252,23 +294,29 @@ protected:
size_t bytes_transferred,
const void *completion_key,
u_long error);
+
/**
* Post <how_many> completions to the completion port so that all
* threads can wake up. This is used in conjunction with the
* <run_event_loop>.
*/
virtual int post_wakeup_completions (int how_many);
+
protected:
/// Handler to handle the wakeups. This works in conjunction with the
/// <ACE_Proactor::run_event_loop>.
ACE_Handler wakeup_handler_;
int os_id_;
+
private:
/// Task to process pseudo-asynchronous accept/connect
ACE_Asynch_Pseudo_Task pseudo_task_;
+
};
+
// Forward declarations.
class ACE_AIOCB_Notify_Pipe_Manager;
+
/**
* @class ACE_POSIX_AIOCB_Proactor
*
@@ -278,23 +326,30 @@ class ACE_AIOCB_Notify_Pipe_Manager;
*/
class ACE_Export ACE_POSIX_AIOCB_Proactor : public ACE_POSIX_Proactor
{
+
/// Handler needs to call application specific code.
friend class ACE_AIOCB_Notify_Pipe_Manager;
+
/// This class does the registering of Asynch Operations with the
/// Proactor which is necessary in the AIOCB strategy.
friend class ACE_POSIX_Asynch_Operation;
friend class ACE_POSIX_Asynch_Accept;
friend class ACE_POSIX_Asynch_Connect;
+
public:
/// Constructor defines max number asynchronous operations
/// which can be started at the same time
ACE_POSIX_AIOCB_Proactor (size_t nmaxop = ACE_AIO_DEFAULT_SIZE);
+
virtual Proactor_Type get_impl_type (void);
+
/// Destructor.
virtual ~ACE_POSIX_AIOCB_Proactor (void);
+
/// Close down the Proactor.
virtual int close (void);
+
/**
* Dispatch a single set of events. If @a wait_time elapses before
* any events occur, return 0. Return 1 on success i.e., when a
@@ -302,6 +357,7 @@ public:
* set accordingly.
*/
virtual int handle_events (ACE_Time_Value &wait_time);
+
/**
* Block indefinitely until at least one event is dispatched.
* Dispatch a single set of events. If @a wait_time elapses before
@@ -310,10 +366,13 @@ public:
* set accordingly.
*/
virtual int handle_events (void);
+
/// Post a result to the completion port of the Proactor.
virtual int post_completion (ACE_POSIX_Asynch_Result *result);
+
virtual int start_aio (ACE_POSIX_Asynch_Result *result,
ACE_POSIX_Proactor::Opcode op);
+
/**
* This method should be called from
* ACE_POSIX_Asynch_Operation::cancel()
@@ -326,86 +385,115 @@ public:
* later on return from ::aio_suspend
*/
virtual int cancel_aio (ACE_HANDLE h);
+
protected:
+
/// Special constructor for ACE_SUN_Proactor
/// and ACE_POSIX_SIG_Proactor
ACE_POSIX_AIOCB_Proactor (size_t nmaxop,
ACE_POSIX_Proactor::Proactor_Type ptype);
+
/// Check AIO for completion, error and result status
/// Return: 1 - AIO completed , 0 - not completed yet
virtual int get_result_status (ACE_POSIX_Asynch_Result *asynch_result,
int &error_status,
size_t &transfer_count);
+
/// Create aiocb list
int create_result_aiocb_list (void);
+
/// Call this method from derived class when virtual table is
/// built.
int delete_result_aiocb_list (void);
+
/// Call these methods from derived class when virtual table is
/// built.
void create_notify_manager (void);
void delete_notify_manager (void);
+
/// Define the maximum number of asynchronous I/O requests
/// for the current OS
void check_max_aio_num (void) ;
+
/// To identify requests from Notify_Pipe_Manager
void set_notify_handle (ACE_HANDLE h);
+
/**
* Dispatch a single set of events. If <milli_seconds> elapses
* before any events occur, return 0. Return 1 if a completion
* dispatched. Return -1 on errors.
*/
int handle_events_i (u_long milli_seconds);
+
/// Start deferred AIO if necessary
int start_deferred_aio (void);
+
/// Cancel running or deferred AIO
virtual int cancel_aiocb (ACE_POSIX_Asynch_Result * result);
+
/// Extract the results of aio.
ACE_POSIX_Asynch_Result *find_completed_aio (int &error_status,
size_t &transfer_count,
size_t &index,
size_t &count);
+
/// Find free slot to store result and aiocb pointer
virtual ssize_t allocate_aio_slot (ACE_POSIX_Asynch_Result *result);
+
/// Initiate an aio operation.
virtual int start_aio_i (ACE_POSIX_Asynch_Result *result);
+
/// Notify queue of "post_completed" ACE_POSIX_Asynch_Results
/// called from post_completion method
virtual int notify_completion (int sig_num);
+
/// Put "post_completed" result into the internal queue
int putq_result (ACE_POSIX_Asynch_Result *result);
+
/// Get "post_completed" result from the internal queue
ACE_POSIX_Asynch_Result * getq_result (void);
+
/// Clear the internal results queue
int clear_result_queue (void);
+
/// Process the internal results queue
int process_result_queue (void);
+
/// This class takes care of doing <accept> when we use
/// AIO_CONTROL_BLOCKS strategy.
ACE_AIOCB_Notify_Pipe_Manager *aiocb_notify_pipe_manager_;
+
/// Use a dynamically allocated array to keep track of all the aio's
/// issued currently.
aiocb **aiocb_list_;
ACE_POSIX_Asynch_Result **result_list_;
+
/// To maintain the maximum size of the array (list).
size_t aiocb_list_max_size_;
+
/// To maintain the current size of the array (list).
size_t aiocb_list_cur_size_;
+
/// Mutex to protect work with lists.
ACE_SYNCH_MUTEX mutex_;
+
/// The purpose of this member is only to identify asynchronous request
/// from NotifyManager. We will reserve for it always slot 0
/// in the list of aiocb's to be sure that don't lose notifications.
ACE_HANDLE notify_pipe_read_handle_ ;
+
/// Number of ACE_POSIX_Asynch_Result's waiting for start
/// i.e. deferred AIOs
size_t num_deferred_aiocb_ ;
+
/// Number active,i.e. running requests
size_t num_started_aio_ ;
+
/// Queue which keeps "post_completed" ACE_POSIX_Asynch_Result's
ACE_Unbounded_Queue<ACE_POSIX_Asynch_Result *> result_queue_;
};
+
#if defined(ACE_HAS_POSIX_REALTIME_SIGNALS)
/**
* @class ACE_POSIX_SIG_Proactor
@@ -419,12 +507,14 @@ protected:
*/
class ACE_Export ACE_POSIX_SIG_Proactor : public ACE_POSIX_AIOCB_Proactor
{
+
/**
* This class does the registering of Asynch Operations with the
* Proactor which is necessary in the SIG strategy, because we need
* to store the signal number.
*/
friend class ACE_POSIX_SIG_Asynch_Operation;
+
public:
/**
* This constructor masks only the <ACE_SIGRTMIN>
@@ -432,7 +522,9 @@ public:
* asynchronous operations using this Proctor.
*/
ACE_POSIX_SIG_Proactor (size_t nmaxop = ACE_AIO_DEFAULT_SIZE);
+
virtual Proactor_Type get_impl_type (void);
+
/**
* This constructor should be used to tell the Proactor to mask and
* wait for the real-time signals specified in this set. Only these
@@ -441,8 +533,10 @@ public:
*/
ACE_POSIX_SIG_Proactor (const sigset_t mask_set,
size_t nmaxop = ACE_AIO_DEFAULT_SIZE);
+
/// Destructor.
virtual ~ACE_POSIX_SIG_Proactor (void);
+
/**
* Dispatch a single set of events. If @a wait_time elapses before
* any events occur, return 0. Return 1 on success i.e., when a
@@ -450,6 +544,7 @@ public:
* set accordingly.
*/
virtual int handle_events (ACE_Time_Value &wait_time);
+
/**
* Block indefinitely until at least one event is dispatched.
* Dispatch a single set of events. If <wait_time> elapses before
@@ -458,9 +553,11 @@ public:
* set accordingly.
*/
virtual int handle_events (void);
+
/// Post a result to the completion port of the Proactor.
/// now it is implemented in base ACE_POSIX_AIOCB_Proactor class
///virtual int post_completion (ACE_POSIX_Asynch_Result *result);
+
/**
* If @a signal_number is -1, check with the Proactor and use one of
* the signals that is present in the mask set (i.e., the signals for
@@ -474,11 +571,14 @@ public:
ACE_HANDLE event = ACE_INVALID_HANDLE,
int priority = 0,
int signal_number = ACE_SIGRTMIN);
+
protected:
/// To setup the handler for a real-time signbal.
int setup_signal_handler (int signal_number) const;
+
/// Insures that RT_completion_signals_ are blocked in the calling thread.
int block_signals (void) const;
+
/**
* Dispatch a single set of events. @a timeout is a pointer to a
* relative time representing the maximum amount of time to wait for
@@ -489,11 +589,14 @@ protected:
* @retval -1 An error occurred; errno contains an error code.
*/
virtual int handle_events_i (const ACE_Time_Value *timeout);
+
/// Find free slot to store result and aiocb pointer
virtual ssize_t allocate_aio_slot (ACE_POSIX_Asynch_Result *result);
+
/// Notify queue of "post_completed" ACE_POSIX_Asynch_Results
/// called from post_completion method
virtual int notify_completion (int sig_num);
+
/**
* These signals are used for completion notification by the
* Proactor. The signals specified while issuing asynchronous
@@ -503,7 +606,9 @@ protected:
sigset_t RT_completion_signals_;
};
+
#endif /* ACE_HAS_POSIX_REALTIME_SIGNALS */
+
/**
* @class ACE_POSIX_Asynch_Timer
*
@@ -514,12 +619,14 @@ protected:
*/
class ACE_Export ACE_POSIX_Asynch_Timer : public ACE_POSIX_Asynch_Result
{
+
/// The factory method for this class is with the POSIX_Proactor
/// class.
friend class ACE_POSIX_Proactor;
#if defined(ACE_HAS_POSIX_REALTIME_SIGNALS)
friend class ACE_POSIX_SIG_Proactor;
#endif
+
protected:
/// Constructor.
ACE_POSIX_Asynch_Timer (const ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -528,20 +635,26 @@ protected:
ACE_HANDLE event = ACE_INVALID_HANDLE,
int priority = 0,
int signal_number = ACE_SIGRTMIN);
+
/// Destructor.
virtual ~ACE_POSIX_Asynch_Timer (void) {}
+
/// This method calls the handler's handle_timeout method.
virtual void complete (size_t bytes_transferred,
int success,
const void *completion_key,
u_long error = 0);
+
/// Time value requested by caller
ACE_Time_Value time_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/POSIX_Proactor.inl"
#endif /* __ACE_INLINE__ */
+
#endif /* ACE_HAS_AIO_CALLS && ACE_HAS_POSIX_REALTIME_SIGNALS */
#endif /* ACE_POSIX_PROACTOR_H */
diff --git a/dep/ACE_wrappers/ace/POSIX_Proactor.inl b/dep/ACE_wrappers/ace/POSIX_Proactor.inl
index 8bc92e78711..da52de69a97 100644
--- a/dep/ACE_wrappers/ace/POSIX_Proactor.inl
+++ b/dep/ACE_wrappers/ace/POSIX_Proactor.inl
@@ -1,10 +1,13 @@
// -*- C++ -*-
//
// $Id: POSIX_Proactor.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_Asynch_Pseudo_Task& ACE_POSIX_Proactor::get_asynch_pseudo_task (void)
{
return this->pseudo_task_;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Pagefile_Memory_Pool.cpp b/dep/ACE_wrappers/ace/Pagefile_Memory_Pool.cpp
index f48c3725c91..37ac4016fad 100644
--- a/dep/ACE_wrappers/ace/Pagefile_Memory_Pool.cpp
+++ b/dep/ACE_wrappers/ace/Pagefile_Memory_Pool.cpp
@@ -1,9 +1,12 @@
// $Id: Pagefile_Memory_Pool.cpp 82559 2008-08-07 20:23:07Z parsons $
+
// Pagefile_Memory_Pool.cpp
#include "ace/Pagefile_Memory_Pool.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Pagefile_Memory_Pool.inl"
#endif /* __ACE_INLINE__ */
+
#include "ace/Log_Msg.h"
#include "ace/Auto_Ptr.h"
#include "ace/RW_Thread_Mutex.h"
@@ -12,11 +15,14 @@
#include "ace/OS_NS_sys_stat.h"
#include "ace/OS_NS_unistd.h"
#include "ace/Truncate.h"
+
#if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1)
#include "ace/Based_Pointer_T.h"
#include "ace/Based_Pointer_Repository.h"
#endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */
+
ACE_RCSID(ace, Pagefile_Memory_Pool, "$Id: Pagefile_Memory_Pool.cpp 82559 2008-08-07 20:23:07Z parsons $")
+
#if defined (ACE_WIN32) && !defined (ACE_HAS_PHARLAP)
#if !defined (ACE_HAS_WINCE)
#define ACE_MAP_FILE(_hnd, _access, _offHigh, _offLow, _nBytes, _baseAdd)\
@@ -25,7 +31,9 @@ ACE_RCSID(ace, Pagefile_Memory_Pool, "$Id: Pagefile_Memory_Pool.cpp 82559 2008-0
#define ACE_MAP_FILE(_hnd, _access, _offHigh, _offLow, _nBytes, _baseAdd)\
MapViewOfFile (_hnd, _access, _offHigh, _offLow, _nBytes)
#endif /* !ACE_HAS_WINCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_Pagefile_Memory_Pool_Options::ACE_Pagefile_Memory_Pool_Options (
void *base_addr,
size_t max_size)
@@ -33,11 +41,13 @@ ACE_Pagefile_Memory_Pool_Options::ACE_Pagefile_Memory_Pool_Options (
max_size_ (max_size)
{
}
+
int
ACE_Pagefile_Memory_Pool::release (int)
{
return this->unmap ();
}
+
ACE_Pagefile_Memory_Pool::ACE_Pagefile_Memory_Pool (const ACE_TCHAR *backing_store_name,
const OPTIONS *options)
: shared_cb_ (0),
@@ -67,19 +77,24 @@ ACE_Pagefile_Memory_Pool::ACE_Pagefile_Memory_Pool (const ACE_TCHAR *backing_sto
this->local_cb_.sh_.mapped_size_;
this->local_cb_.sh_.free_size_ = 0;
}
+
int update_backing_store_name = backing_store_name == 0 ? 0 : 1;
+
if (backing_store_name == 0)
// Only create a new unique filename for the backing store file if
// the user didn't supply one...
backing_store_name = ACE_DEFAULT_PAGEFILE_POOL_NAME;
+
ACE_OS::strsncpy (this->backing_store_name_,
backing_store_name,
(sizeof this->backing_store_name_ / sizeof (ACE_TCHAR)));
+
if (update_backing_store_name
&& ACE_OS::strlen (this->backing_store_name_) < sizeof this->backing_store_name_)
ACE_OS::strcat (this->backing_store_name_,
ACE_TEXT ("_"));
}
+
void *
ACE_Pagefile_Memory_Pool::acquire (size_t nbytes,
size_t &rounded_bytes)
@@ -87,6 +102,7 @@ ACE_Pagefile_Memory_Pool::acquire (size_t nbytes,
rounded_bytes = round_to_page_size (nbytes);
void *result = 0;
int first_time = 0;
+
// Check local_cb_ for consistency. Remap, if extra space is too
// small and/or we didn't map the whole shared memory section
if (this->shared_cb_->sh_.mapped_size_
@@ -96,20 +112,25 @@ ACE_Pagefile_Memory_Pool::acquire (size_t nbytes,
size_t append = 0;
if (rounded_bytes > this->shared_cb_->sh_.free_size_)
append = rounded_bytes - this->shared_cb_->sh_.free_size_;
+
if (this->map (first_time, append) < 0)
return result;
}
+
// Get the block from extra space and update shared and local
// control block
if (this->shared_cb_->sh_.free_size_ < rounded_bytes)
return result;
+
result = (void *)((char *) this->local_cb_.mapped_base_
+ this->shared_cb_->sh_.free_offset_);
this->shared_cb_->sh_.free_offset_ += rounded_bytes;
this->shared_cb_->sh_.free_size_ -= rounded_bytes;
this->local_cb_.sh_ = this->shared_cb_->sh_;
+
return result;
}
+
void *
ACE_Pagefile_Memory_Pool::init_acquire (size_t nbytes,
size_t &rounded_bytes,
@@ -119,6 +140,7 @@ ACE_Pagefile_Memory_Pool::init_acquire (size_t nbytes,
// shared memory.
if (this->map (first_time) < 0)
return 0;
+
if (first_time != 0)
// We created the shared memory. So we have to allocate the
// requested memory.
@@ -129,19 +151,24 @@ ACE_Pagefile_Memory_Pool::init_acquire (size_t nbytes,
+ ACE_Pagefile_Memory_Pool::round_to_page_size
((int) sizeof (Control_Block)));
}
+
int
ACE_Pagefile_Memory_Pool::seh_selector (void *ep)
{
DWORD ecode = ((EXCEPTION_POINTERS *) ep)->ExceptionRecord->ExceptionCode;
+
if (ecode == EXCEPTION_ACCESS_VIOLATION)
{
void * fault_addr = (void *)
((EXCEPTION_POINTERS *) ep)->ExceptionRecord->ExceptionInformation[1];
+
if (this->remap (fault_addr) == 0)
return 1;
}
+
return 0;
}
+
int
ACE_Pagefile_Memory_Pool::remap (void *addr)
{
@@ -153,10 +180,12 @@ ACE_Pagefile_Memory_Pool::remap (void *addr)
|| addr >= (void *)((char *) this->local_cb_.mapped_base_
+ this->shared_cb_->sh_.mapped_size_))
return -1;
+
// We can solve the problem by committing additional chunks.
int first_time = 0;
return this->map (first_time);
}
+
int
ACE_Pagefile_Memory_Pool::unmap (void)
{
@@ -164,10 +193,13 @@ ACE_Pagefile_Memory_Pool::unmap (void)
ACE_BASED_POINTER_REPOSITORY::instance ()->unbind
(this->local_cb_.mapped_base_);
#endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */
+
// Cleanup cached pool pointer.
this->shared_cb_ = 0;
+
if (this->local_cb_.sh_.mapped_size_ > 0)
::UnmapViewOfFile (this->local_cb_.mapped_base_);
+
// Reset local pool statistics.
this->local_cb_.req_base_ =
ACE_DEFAULT_PAGEFILE_POOL_BASE;
@@ -178,6 +210,7 @@ ACE_Pagefile_Memory_Pool::unmap (void)
this->local_cb_.sh_.free_offset_ =
this->local_cb_.sh_.mapped_size_;
this->local_cb_.sh_.free_size_ = 0;
+
// Release the pool
if (this->object_handle_ != 0)
{
@@ -186,12 +219,14 @@ ACE_Pagefile_Memory_Pool::unmap (void)
}
return 0;
}
+
int
ACE_Pagefile_Memory_Pool::map (int &first_time,
size_t append_bytes)
{
size_t map_size;
void *map_addr;
+
// Create file mapping, if not yet done
if (object_handle_ == 0)
{
@@ -209,6 +244,7 @@ ACE_Pagefile_Memory_Pool::map (int &first_time,
sa.lpSecurityDescriptor = &sd;
sa.bInheritHandle = FALSE;
#endif /* ACE_LACKS_WIN32_SECURITY_DESCRIPTORS */
+
// Get an object handle to the named reserved memory object.
DWORD size_high;
DWORD size_low;
@@ -219,6 +255,7 @@ ACE_Pagefile_Memory_Pool::map (int &first_time,
size_high = 0;
size_low = ACE_Utils::truncate_cast<DWORD> (this->local_cb_.sh_.max_size_);
#endif
+
object_handle_ =
ACE_TEXT_CreateFileMapping (INVALID_HANDLE_VALUE,
#if !defined (ACE_LACKS_WIN32_SECURITY_DESCRIPTORS)
@@ -237,6 +274,7 @@ ACE_Pagefile_Memory_Pool::map (int &first_time,
? 0
: 1;
}
+
// Do the initial mapping.
if (this->shared_cb_ == 0)
{
@@ -251,6 +289,7 @@ ACE_Pagefile_Memory_Pool::map (int &first_time,
this->local_cb_.req_base_);
if (this->shared_cb_ == 0)
return -1;
+
// There was no previous mapping, so we map the first chunk and
// initialize the shared pool statistics.
if (first_time)
@@ -261,11 +300,13 @@ ACE_Pagefile_Memory_Pool::map (int &first_time,
(ACE_Pagefile_Memory_Pool::round_to_page_size
((int) sizeof(Control_Block))
+ append_bytes);
+
if (::VirtualAlloc ((void *) this->shared_cb_,
map_size,
MEM_COMMIT,
PAGE_READWRITE) == 0)
return -1;
+
this->shared_cb_->req_base_ = 0;
this->shared_cb_->mapped_base_ = 0;
this->local_cb_.mapped_base_ = this->shared_cb_;
@@ -277,6 +318,7 @@ ACE_Pagefile_Memory_Pool::map (int &first_time,
this->local_cb_.sh_.free_offset_;
this->shared_cb_->sh_ = this->local_cb_.sh_;
}
+
// The shared memory exists, so we map the first chunk to the
// base address of the pool to get the shared pool statistics.
else
@@ -285,6 +327,7 @@ ACE_Pagefile_Memory_Pool::map (int &first_time,
map_size =
ACE_Pagefile_Memory_Pool::round_to_chunk_size
((int) sizeof (Control_Block));
+
if (::VirtualAlloc ((void *) this->shared_cb_,
map_size,
MEM_COMMIT,
@@ -294,6 +337,7 @@ ACE_Pagefile_Memory_Pool::map (int &first_time,
this->local_cb_.sh_.mapped_size_ = map_size;
}
}
+
// If the shared memory is larger than the part we've already
// committed, we have to remap it.
if (this->shared_cb_->sh_.mapped_size_ >
@@ -305,8 +349,10 @@ ACE_Pagefile_Memory_Pool::map (int &first_time,
this->local_cb_.sh_.mapped_size_)
+ ACE_Pagefile_Memory_Pool::round_to_chunk_size
(append_bytes);
+
map_addr = (void *)((char *) this->shared_cb_ +
this->local_cb_.sh_.mapped_size_);
+
if (::VirtualAlloc (map_addr,
map_size,
MEM_COMMIT,
@@ -321,6 +367,7 @@ ACE_Pagefile_Memory_Pool::map (int &first_time,
this->shared_cb_->sh_.free_offset_;
}
}
+
// Update local copy of the shared memory statistics.
this->local_cb_.sh_ =
this->shared_cb_->sh_;
@@ -329,8 +376,11 @@ ACE_Pagefile_Memory_Pool::map (int &first_time,
(this->local_cb_.mapped_base_,
this->local_cb_.sh_.mapped_size_);
#endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */
+
return 0;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_WIN32 && !ACE_HAS_PHARLAP */
diff --git a/dep/ACE_wrappers/ace/Pagefile_Memory_Pool.h b/dep/ACE_wrappers/ace/Pagefile_Memory_Pool.h
index b34e7e7d0ff..888ca897fac 100644
--- a/dep/ACE_wrappers/ace/Pagefile_Memory_Pool.h
+++ b/dep/ACE_wrappers/ace/Pagefile_Memory_Pool.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Pagefile_Memory_Pool.h
@@ -9,17 +10,25 @@
* @author Prashant Jain <pjain@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_PAGEFILE_MEMORY_POOL_H
#define ACE_PAGEFILE_MEMORY_POOL_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_WIN32) && !defined (ACE_HAS_PHARLAP)
+
#include "ace/ACE.h"
#include "ace/os_include/sys/os_mman.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Pagefile_Memory_Pool_Options
*
@@ -35,11 +44,14 @@ public:
ACE_Pagefile_Memory_Pool_Options (
void *base_addr = ACE_DEFAULT_PAGEFILE_POOL_BASE,
size_t max_size = ACE_DEFAULT_PAGEFILE_POOL_SIZE);
+
/// Base address of the memory-mapped backing store.
void *base_addr_;
+
/// Maximum size the pool may grow.
size_t max_size_;
};
+
/**
* @class ACE_Pagefile_Memory_Pool
*
@@ -50,25 +62,31 @@ class ACE_Export ACE_Pagefile_Memory_Pool
{
public:
typedef ACE_Pagefile_Memory_Pool_Options OPTIONS;
+
/// Initialize the pool.
ACE_Pagefile_Memory_Pool (const ACE_TCHAR *backing_store_name = 0,
const OPTIONS *options = 0);
+
/// Ask system for initial chunk of shared memory.
void *init_acquire (size_t nbytes,
size_t &rounded_bytes,
int &first_time);
+
/// Acquire at least @a nbytes from the memory pool. <rounded_bytes>
/// is the actual number of bytes allocated.
void *acquire (size_t nbytes,
size_t &rounded_bytes);
+
/// Instruct the memory pool to release all of its resources.
int release (int destroy = 1);
+
/**
* Win32 Structural exception selector. The return value decides
* how to handle memory pool related structural exceptions. Returns
* 1, 0, or , -1.
*/
virtual int seh_selector (void *);
+
/**
* Try to extend the virtual address space so that @a addr is now
* covered by the address mapping. The method succeeds and returns
@@ -80,29 +98,39 @@ public:
* (yet).
*/
int remap (void *addr);
+
/// Round up to system page size.
size_t round_to_page_size (size_t nbytes);
+
/// Round up to the chunk size required by the operation system
size_t round_to_chunk_size (size_t nbytes);
+
// = Don't need this methods here ...
int sync (ssize_t = -1, int = MS_SYNC);
int sync (void *, size_t, int = MS_SYNC);
int protect (ssize_t = -1, int = PROT_RDWR);
int protect (void *, size_t, int = PROT_RDWR);
+
/// Return the base address of this memory pool, 0 if base_addr
/// never changes.
virtual void *base_addr (void) const;
+
void dump (void) const {}
+
protected:
+
/**
* Map portions or the entire pool into the local virtual address
* space. To do this, we compute the new @c file_offset of the
* backing store and commit the memory.
*/
int map (int &firstTime, size_t appendBytes = 0);
+
/// Release the mapping.
int unmap (void);
+
private:
+
/**
* @class Control_Block
*
@@ -113,8 +141,10 @@ private:
public:
/// Required base address
void *req_base_;
+
/// Base address returned from system call
void *mapped_base_;
+
/**
* @class Shared_Control_Block
*
@@ -125,34 +155,48 @@ private:
public:
/// Maximum size the pool may grow
size_t max_size_;
+
/// Size of mapped shared memory segment
size_t mapped_size_;
+
/// Offset to mapped but not yet acquired address space
ptrdiff_t free_offset_;
+
/// Size of mapped but not yet acquired address space
size_t free_size_;
};
+
Shared_Control_Block sh_;
};
+
// Base of mapped region. If this has the value of 0 then the OS is
// free to select any address to map the file, otherwise this value
// is what the OS must try to use to mmap the file.
+
/// Description of what our process mapped.
Control_Block local_cb_;
+
/// Shared memory pool statistics.
Control_Block *shared_cb_;
+
/// File mapping handle.
ACE_HANDLE object_handle_;
+
/// System page size.
size_t page_size_;
+
/// Name of the backing store where the shared memory pool is kept.
ACE_TCHAR backing_store_name_[MAXPATHLEN];
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_WIN32 && !ACE_HAS_PHARLAP */
+
#if defined (__ACE_INLINE__)
#include "ace/Pagefile_Memory_Pool.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_MEMORY_POOL_H */
diff --git a/dep/ACE_wrappers/ace/Pagefile_Memory_Pool.inl b/dep/ACE_wrappers/ace/Pagefile_Memory_Pool.inl
index a507867b2aa..fc499ec1708 100644
--- a/dep/ACE_wrappers/ace/Pagefile_Memory_Pool.inl
+++ b/dep/ACE_wrappers/ace/Pagefile_Memory_Pool.inl
@@ -1,43 +1,54 @@
// -*- C++ -*-
//
// $Id: Pagefile_Memory_Pool.inl 80826 2008-03-04 14:51:23Z wotte $
+
#if defined (ACE_WIN32) && !defined (ACE_HAS_PHARLAP)
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE size_t
ACE_Pagefile_Memory_Pool::round_to_chunk_size (size_t nbytes)
{
return (nbytes + ACE_DEFAULT_PAGEFILE_POOL_CHUNK - 1)
& (~(ACE_DEFAULT_PAGEFILE_POOL_CHUNK - 1));
}
+
ACE_INLINE size_t
ACE_Pagefile_Memory_Pool::round_to_page_size (size_t nbytes)
{
return ACE::round_to_pagesize (nbytes);
}
+
ACE_INLINE int
ACE_Pagefile_Memory_Pool::sync (ssize_t, int)
{
return 0;
}
+
ACE_INLINE int
ACE_Pagefile_Memory_Pool::sync (void *, size_t, int)
{
return 0;
}
+
ACE_INLINE int
ACE_Pagefile_Memory_Pool::protect (ssize_t, int)
{
return 0;
}
+
ACE_INLINE int
ACE_Pagefile_Memory_Pool::protect (void *, size_t, int)
{
return 0;
}
+
ACE_INLINE void *
ACE_Pagefile_Memory_Pool::base_addr (void) const
{
return 0;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_WIN32 &7 !ACE_HAS_PHARLAP */
diff --git a/dep/ACE_wrappers/ace/Pair.h b/dep/ACE_wrappers/ace/Pair.h
index 537fcef7741..e1d8b526639 100644
--- a/dep/ACE_wrappers/ace/Pair.h
+++ b/dep/ACE_wrappers/ace/Pair.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Pair.h
@@ -11,15 +12,22 @@
*/
//=============================================================================
+
#ifndef ACE_PAIR_H
#define ACE_PAIR_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
// Include the templates here.
#include "ace/Pair_T.h"
+
#include /**/ "ace/post.h"
+
#endif /* ACE_PAIR_H */
diff --git a/dep/ACE_wrappers/ace/Pair_T.h b/dep/ACE_wrappers/ace/Pair_T.h
index 616423320d0..09629b49a26 100644
--- a/dep/ACE_wrappers/ace/Pair_T.h
+++ b/dep/ACE_wrappers/ace/Pair_T.h
@@ -1,4 +1,5 @@
/* -*- C++ -*- */
+
//=============================================================================
/**
* @file Pair_T.h
@@ -9,14 +10,19 @@
*/
//=============================================================================
+
#ifndef ACE_PAIR_T_H
#define ACE_PAIR_T_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Pair
*
@@ -28,33 +34,44 @@ template <class T1, class T2>
class ACE_Pair
{
public:
+
// = Traits.
typedef T1 first_type;
typedef T2 second_type;
+
// = Initialization and termination methods.
/// Constructor.
ACE_Pair (const T1 &t1,
const T2 &t2);
+
/// Default constructor.
ACE_Pair (void);
+
/// Get first.
T1 &first (void);
const T1 &first (void) const;
+
/// Set first.
void first (const T1 &t1);
+
/// Get second.
T2 &second (void);
const T2 &second (void) const;
+
/// Set second.
void second (const T2 &t2);
+
// Compare pairs.
bool operator== (const ACE_Pair<T1, T2> &rhs) const;
+
protected:
/// First.
T1 first_;
+
/// Second.
T2 second_;
};
+
/**
* @class ACE_Reference_Pair
*
@@ -67,35 +84,47 @@ template <class T1, class T2>
class ACE_Reference_Pair
{
public:
+
// = Traits.
typedef T1 first_type;
typedef T2 second_type;
+
// = Initialization and termination methods.
/// Constructor.
ACE_Reference_Pair (T1 &t1,
T2 &t2);
+
/// Access first.
T1 &first (void) const;
+
/// Access second.
T2 &second (void) const;
+
// Compare pairs.
bool operator== (const ACE_Reference_Pair<T1, T2> &rhs) const;
+
protected:
/// First.
T1 &first_;
+
/// Second.
T2 &second_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Pair_T.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Pair_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Pair_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
#endif /* ACE_PAIR_T_H */
diff --git a/dep/ACE_wrappers/ace/Pair_T.inl b/dep/ACE_wrappers/ace/Pair_T.inl
index 53547d71362..99c5bcd1917 100644
--- a/dep/ACE_wrappers/ace/Pair_T.inl
+++ b/dep/ACE_wrappers/ace/Pair_T.inl
@@ -1,7 +1,9 @@
// -*- C++ -*-
//
// $Id: Pair_T.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template <class T1, class T2> ACE_INLINE
ACE_Pair<T1, T2>::ACE_Pair (const T1 &t1,
const T2 &t2)
@@ -9,46 +11,55 @@ ACE_Pair<T1, T2>::ACE_Pair (const T1 &t1,
second_ (t2)
{
}
+
template <class T1, class T2> ACE_INLINE
ACE_Pair<T1, T2>::ACE_Pair (void)
{
}
+
template <class T1, class T2> ACE_INLINE T1 &
ACE_Pair<T1, T2>::first (void)
{
return this->first_;
}
+
template <class T1, class T2> ACE_INLINE const T1 &
ACE_Pair<T1, T2>::first (void) const
{
return this->first_;
}
+
template <class T1, class T2> ACE_INLINE void
ACE_Pair<T1, T2>::first (const T1 &t1)
{
this->first_ = t1;
}
+
template <class T1, class T2> ACE_INLINE T2 &
ACE_Pair<T1, T2>::second (void)
{
return this->second_;
}
+
template <class T1, class T2> ACE_INLINE const T2 &
ACE_Pair<T1, T2>::second (void) const
{
return this->second_;
}
+
template <class T1, class T2> ACE_INLINE void
ACE_Pair<T1, T2>::second (const T2 &t2)
{
this->second_ = t2;
}
+
template <class T1, class T2> ACE_INLINE bool
ACE_Pair<T1, T2>::operator== (const ACE_Pair<T1, T2> &rhs) const
{
return (this->first_ == rhs.first_ &&
this->second_ == rhs.second_);
}
+
template <class T1, class T2> ACE_INLINE
ACE_Reference_Pair<T1, T2>::ACE_Reference_Pair (T1 &t1,
T2 &t2)
@@ -56,20 +67,24 @@ ACE_Reference_Pair<T1, T2>::ACE_Reference_Pair (T1 &t1,
second_ (t2)
{
}
+
template <class T1, class T2> ACE_INLINE T1 &
ACE_Reference_Pair<T1, T2>::first (void) const
{
return this->first_;
}
+
template <class T1, class T2> ACE_INLINE T2 &
ACE_Reference_Pair<T1, T2>::second (void) const
{
return this->second_;
}
+
template <class T1, class T2> ACE_INLINE bool
ACE_Reference_Pair<T1, T2>::operator== (const ACE_Reference_Pair<T1, T2> &rhs) const
{
return (this->first_ == rhs.first_ &&
this->second_ == rhs.second_);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Parse_Node.cpp b/dep/ACE_wrappers/ace/Parse_Node.cpp
index d40140a1494..1132a345feb 100644
--- a/dep/ACE_wrappers/ace/Parse_Node.cpp
+++ b/dep/ACE_wrappers/ace/Parse_Node.cpp
@@ -1,5 +1,7 @@
#include "ace/Parse_Node.h"
+
#if (ACE_USES_CLASSIC_SVC_CONF == 1)
+
#include "ace/Service_Config.h"
#include "ace/Service_Repository.h"
#include "ace/Service_Types.h"
@@ -8,14 +10,19 @@
#include "ace/ACE.h"
#include "ace/OS_NS_string.h"
#include "ace/ARGV.h"
+
ACE_RCSID (ace,
Parse_Node,
"$Id: Parse_Node.cpp 81245 2008-04-05 13:37:47Z johnnyw $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE (ACE_Stream_Node)
+
// Provide the class hierarchy that defines the parse tree of Service
// Nodes.
+
void
ACE_Stream_Node::dump (void) const
{
@@ -23,25 +30,32 @@ ACE_Stream_Node::dump (void) const
ACE_TRACE ("ACE_Stream_Node::dump");
#endif /* ACE_HAS_DUMP */
}
+
void
ACE_Stream_Node::apply (ACE_Service_Gestalt *config, int &yyerrno)
{
ACE_TRACE ("ACE_Stream_Node::apply");
+
const ACE_Service_Type *sst = this->node_->record (config);
if (sst == 0)
const_cast<ACE_Static_Node *> (this->node_)->apply (config, yyerrno);
+
if (yyerrno != 0) return;
+
sst = this->node_->record (config);
ACE_Stream_Type *st =
dynamic_cast<ACE_Stream_Type *> (const_cast<ACE_Service_Type_Impl *> (sst->type ()));
+
for (const ACE_Static_Node *module = dynamic_cast<const ACE_Static_Node*> (this->mods_);
module != 0;
module = dynamic_cast<ACE_Static_Node*> (module->link()))
{
ACE_ARGV args (module->parameters ());
+
const ACE_Service_Type *mst = module->record (config);
if (mst == 0)
const_cast<ACE_Static_Node *> (module)->apply (config, yyerrno);
+
if (yyerrno != 0)
{
ACE_ERROR ((LM_ERROR,
@@ -49,9 +63,12 @@ ACE_Stream_Node::apply (ACE_Service_Gestalt *config, int &yyerrno)
module->name ()));
++yyerrno;
}
+
ACE_Module_Type const * const mt1 =
static_cast <ACE_Module_Type const *> (module->record (config)->type());
+
ACE_Module_Type *mt = const_cast<ACE_Module_Type *>(mt1);
+
if (st->push (mt) == -1)
{
ACE_ERROR ((LM_ERROR,
@@ -59,7 +76,9 @@ ACE_Stream_Node::apply (ACE_Service_Gestalt *config, int &yyerrno)
this->node_->name ()));
++yyerrno;
}
+
}
+
#ifndef ACE_NLOGGING
if (ACE::debug ())
ACE_DEBUG ((LM_DEBUG,
@@ -68,7 +87,9 @@ ACE_Stream_Node::apply (ACE_Service_Gestalt *config, int &yyerrno)
yyerrno));
#endif /* ACE_NLOGGING */
}
+
ACE_ALLOC_HOOK_DEFINE (ACE_Parse_Node)
+
void
ACE_Parse_Node::dump (void) const
{
@@ -76,29 +97,35 @@ ACE_Parse_Node::dump (void) const
ACE_TRACE ("ACE_Parse_Node::dump");
#endif /* ACE_HAS_DUMP */
}
+
const ACE_TCHAR *
ACE_Parse_Node::name (void) const
{
ACE_TRACE ("ACE_Parse_Node::name");
return this->name_;
}
+
ACE_Parse_Node *
ACE_Parse_Node::link (void) const
{
ACE_TRACE ("ACE_Parse_Node::link");
return this->next_;
}
+
void
ACE_Parse_Node::link (ACE_Parse_Node *n)
{
ACE_TRACE ("ACE_Parse_Node::link");
+
// Find the last list entry (if any) ...
ACE_Parse_Node *t = this;
while (t->next_ != 0)
t = t->next_;
+
// ... and insert n there.
t->next_ = n;
}
+
ACE_Stream_Node::ACE_Stream_Node (const ACE_Static_Node *str_ops,
const ACE_Parse_Node *str_mods)
: ACE_Parse_Node ((str_ops == 0 ? ACE_TEXT ("<unknown>") : str_ops->name ())),
@@ -108,6 +135,7 @@ ACE_Stream_Node::ACE_Stream_Node (const ACE_Static_Node *str_ops,
ACE_TRACE ("ACE_Stream_Node::ACE_Stream_Node");
}
+
ACE_Stream_Node::~ACE_Stream_Node (void)
{
ACE_TRACE ("ACE_Stream_Node::~ACE_Stream_Node");
@@ -116,6 +144,7 @@ ACE_Stream_Node::~ACE_Stream_Node (void)
ACE_Parse_Node *m = const_cast<ACE_Parse_Node *> (this->mods_);
delete m;
}
+
ACE_Parse_Node::ACE_Parse_Node (void)
: name_ (0),
next_ (0)
@@ -123,30 +152,37 @@ ACE_Parse_Node::ACE_Parse_Node (void)
ACE_TRACE ("ACE_Parse_Node::ACE_Parse_Node");
}
+
ACE_Parse_Node::ACE_Parse_Node (const ACE_TCHAR *nm)
: name_ (ACE::strnew (nm)),
next_ (0)
{
ACE_TRACE ("ACE_Parse_Node::ACE_Parse_Node");
}
+
void
ACE_Parse_Node::print (void) const
{
ACE_TRACE ("ACE_Parse_Node::print");
+
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("svc = %s\n"),
this->name ()));
+
if (this->next_)
this->next_->print ();
}
+
ACE_Parse_Node::~ACE_Parse_Node (void)
{
ACE_TRACE ("ACE_Parse_Node::~ACE_Parse_Node");
delete[] const_cast<ACE_TCHAR*> (this->name_);
delete this->next_;
}
+
ACE_ALLOC_HOOK_DEFINE (ACE_Suspend_Node)
+
void
ACE_Suspend_Node::dump (void) const
{
@@ -154,15 +190,19 @@ ACE_Suspend_Node::dump (void) const
ACE_TRACE ("ACE_Suspend_Node::dump");
#endif /* ACE_HAS_DUMP */
}
+
ACE_Suspend_Node::ACE_Suspend_Node (const ACE_TCHAR *name)
: ACE_Parse_Node (name)
{
ACE_TRACE ("ACE_Suspend_Node::ACE_Suspend_Node");
}
+
ACE_Suspend_Node::~ACE_Suspend_Node (void)
{
}
+
ACE_ALLOC_HOOK_DEFINE (ACE_Resume_Node)
+
void
ACE_Resume_Node::dump (void) const
{
@@ -170,20 +210,25 @@ ACE_Resume_Node::dump (void) const
ACE_TRACE ("ACE_Resume_Node::dump");
#endif /* ACE_HAS_DUMP */
}
+
ACE_Resume_Node::ACE_Resume_Node (const ACE_TCHAR *name)
: ACE_Parse_Node (name)
{
ACE_TRACE ("ACE_Resume_Node::ACE_Resume_Node");
}
+
ACE_Resume_Node::~ACE_Resume_Node (void)
{
}
+
void
ACE_Suspend_Node::apply (ACE_Service_Gestalt *config, int &yyerrno)
{
ACE_TRACE ("ACE_Suspend_Node::apply");
+
if (config->suspend (this->name ()) == -1)
++yyerrno;
+
#ifndef ACE_NLOGGING
if (ACE::debug ())
ACE_DEBUG ((LM_DEBUG,
@@ -192,12 +237,15 @@ ACE_Suspend_Node::apply (ACE_Service_Gestalt *config, int &yyerrno)
yyerrno));
#endif /* ACE_NLOGGING */
}
+
void
ACE_Resume_Node::apply (ACE_Service_Gestalt *config, int &yyerrno)
{
ACE_TRACE ("ACE_Resume_Node::apply");
+
if (config->resume (this->name ()) == -1)
++yyerrno;
+
#ifndef ACE_NLOGGING
if (ACE::debug ())
ACE_DEBUG ((LM_DEBUG,
@@ -206,7 +254,9 @@ ACE_Resume_Node::apply (ACE_Service_Gestalt *config, int &yyerrno)
yyerrno));
#endif /* ACE_NLOGGING */
}
+
ACE_ALLOC_HOOK_DEFINE (ACE_Remove_Node)
+
void
ACE_Remove_Node::dump (void) const
{
@@ -214,20 +264,25 @@ ACE_Remove_Node::dump (void) const
ACE_TRACE ("ACE_Remove_Node::dump");
#endif /* ACE_HAS_DUMP */
}
+
ACE_Remove_Node::ACE_Remove_Node (const ACE_TCHAR *name)
: ACE_Parse_Node (name)
{
ACE_TRACE ("ACE_Remove_Node::ACE_Remove_Node");
}
+
ACE_Remove_Node::~ACE_Remove_Node (void)
{
}
+
void
ACE_Remove_Node::apply (ACE_Service_Gestalt *config, int &yyerrno)
{
ACE_TRACE ("ACE_Remove_Node::apply");
+
if (config->remove (this->name ()) == -1)
++yyerrno;
+
#ifndef ACE_NLOGGING
if (ACE::debug ())
ACE_DEBUG ((LM_DEBUG,
@@ -238,6 +293,7 @@ ACE_Remove_Node::apply (ACE_Service_Gestalt *config, int &yyerrno)
#endif /* ACE_NLOGGING */
}
+
ACE_Dynamic_Node::ACE_Dynamic_Node (ACE_Service_Type_Factory const *stf,
ACE_TCHAR *parms)
: ACE_Static_Node (stf->name (), parms)
@@ -245,13 +301,16 @@ ACE_Dynamic_Node::ACE_Dynamic_Node (ACE_Service_Type_Factory const *stf,
{
ACE_TRACE ("ACE_Dynamic_Node::ACE_Dynamic_Node");
}
+
void
ACE_Dynamic_Node::apply (ACE_Service_Gestalt *config, int &yyerrno)
{
ACE_TRACE ("ACE_Dynamic_Node::apply");
+
if (config->initialize (this->factory_.get (),
this->parameters ()) == -1)
++yyerrno;
+
#ifndef ACE_NLOGGING
if (ACE::debug ())
ACE_DEBUG ((LM_DEBUG,
@@ -261,7 +320,9 @@ ACE_Dynamic_Node::apply (ACE_Service_Gestalt *config, int &yyerrno)
yyerrno));
#endif /* ACE_NLOGGING */
}
+
ACE_ALLOC_HOOK_DEFINE (ACE_Dynamic_Node)
+
void
ACE_Dynamic_Node::dump (void) const
{
@@ -269,11 +330,14 @@ ACE_Dynamic_Node::dump (void) const
ACE_TRACE ("ACE_Dynamic_Node::dump");
#endif /* ACE_HAS_DUMP */
}
+
ACE_Dynamic_Node::~ACE_Dynamic_Node (void)
{
ACE_TRACE ("ACE_Dynamic_Node::~ACE_Dynamic_Node");
}
+
ACE_ALLOC_HOOK_DEFINE (ACE_Static_Node)
+
void
ACE_Static_Node::dump (void) const
{
@@ -281,6 +345,7 @@ ACE_Static_Node::dump (void) const
ACE_TRACE ("ACE_Static_Node::dump");
#endif /* ACE_HAS_DUMP */
}
+
ACE_Static_Node::ACE_Static_Node (const ACE_TCHAR *nm,
ACE_TCHAR *params)
: ACE_Parse_Node (nm),
@@ -288,21 +353,26 @@ ACE_Static_Node::ACE_Static_Node (const ACE_TCHAR *nm,
{
ACE_TRACE ("ACE_Static_Node::ACE_Static_Node");
}
+
const ACE_Service_Type *
ACE_Static_Node::record (const ACE_Service_Gestalt *config) const
{
ACE_TRACE ("ACE_Static_Node::record");
ACE_Service_Type *sr = 0;
+
if (config->find (this->name (), (const ACE_Service_Type **) &sr) == -1)
return 0;
+
return sr;
}
+
ACE_TCHAR *
ACE_Static_Node::parameters (void) const
{
ACE_TRACE ("ACE_Static_Node::parameters");
return this->parameters_;
}
+
void
ACE_Static_Node::apply (ACE_Service_Gestalt *config, int &yyerrno)
{
@@ -310,6 +380,7 @@ ACE_Static_Node::apply (ACE_Service_Gestalt *config, int &yyerrno)
if (config->initialize (this->name (),
this->parameters ()) == -1)
++yyerrno;
+
#ifndef ACE_NLOGGING
if (ACE::debug ())
ACE_DEBUG ((LM_DEBUG,
@@ -319,13 +390,16 @@ ACE_Static_Node::apply (ACE_Service_Gestalt *config, int &yyerrno)
yyerrno));
#endif /* ACE_NLOGGING */
}
+
ACE_Static_Node::~ACE_Static_Node (void)
{
ACE_TRACE ("ACE_Static_Node::~ACE_Static_Node");
delete[] this->parameters_;
}
+
ACE_ALLOC_HOOK_DEFINE (ACE_Location_Node)
+
void
ACE_Location_Node::dump (void) const
{
@@ -333,6 +407,7 @@ ACE_Location_Node::dump (void) const
ACE_TRACE ("ACE_Location_Node::dump");
#endif /* ACE_HAS_DUMP */
}
+
ACE_Location_Node::ACE_Location_Node (void)
: pathname_ (0),
dll_ (),
@@ -340,46 +415,55 @@ ACE_Location_Node::ACE_Location_Node (void)
{
ACE_TRACE ("ACE_Location_Node::ACE_Location_Node");
}
+
ACE_Location_Node::~ACE_Location_Node (void)
{
ACE_TRACE ("ACE_Location_Node::~ACE_Location_Node");
}
+
const ACE_DLL &
ACE_Location_Node::dll (void)
{
return this->dll_;
}
+
const ACE_TCHAR *
ACE_Location_Node::pathname (void) const
{
ACE_TRACE ("ACE_Location_Node::pathname");
return this->pathname_;
}
+
void
ACE_Location_Node::pathname (const ACE_TCHAR *p)
{
ACE_TRACE ("ACE_Location_Node::pathname");
this->pathname_ = p;
}
+
int
ACE_Location_Node::dispose (void) const
{
ACE_TRACE ("ACE_Location_Node::dispose");
return this->must_delete_;
}
+
int
ACE_Location_Node::open_dll (int & yyerrno)
{
ACE_TRACE ("ACE_Location_Node::open_dll");
+
#ifndef ACE_NLOGGING
if (ACE::debug ())
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("ACE (%P|%t) LN::open_dll - path=%s\n"),
this->pathname ()));
#endif /* ACE_NLOGGING */
+
if (-1 == this->dll_.open (this->pathname ()))
{
++yyerrno;
+
#ifndef ACE_NLOGGING
ACE_TCHAR *errmsg = this->dll_.error ();
ACE_ERROR ((LM_ERROR,
@@ -387,17 +471,23 @@ ACE_Location_Node::open_dll (int & yyerrno)
this->pathname (),
errmsg ? errmsg : ACE_TEXT ("no error reported")));
#endif /* ACE_NLOGGING */
+
return -1;
}
+
return 0;
+
}
+
void
ACE_Location_Node::set_symbol (void *s)
{
ACE_TRACE ("ACE_Location_Node::set_symbol");
this->symbol_ = s;
}
+
ACE_ALLOC_HOOK_DEFINE (ACE_Object_Node)
+
void
ACE_Object_Node::dump (void) const
{
@@ -405,6 +495,7 @@ ACE_Object_Node::dump (void) const
ACE_TRACE ("ACE_Object_Node::dump");
#endif /* ACE_HAS_DUMP */
}
+
ACE_Object_Node::ACE_Object_Node (const ACE_TCHAR *path,
const ACE_TCHAR *obj_name)
: object_name_ (ACE::strnew (obj_name))
@@ -413,6 +504,7 @@ ACE_Object_Node::ACE_Object_Node (const ACE_TCHAR *path,
this->pathname (ACE::strnew (path));
this->must_delete_ = 0;
}
+
void *
ACE_Object_Node::symbol (ACE_Service_Gestalt *,
int &yyerrno,
@@ -422,10 +514,12 @@ ACE_Object_Node::symbol (ACE_Service_Gestalt *,
if (this->open_dll (yyerrno) == 0)
{
ACE_TCHAR *object_name = const_cast<ACE_TCHAR *> (this->object_name_);
+
this->symbol_ = this->dll_.symbol (object_name);
if (this->symbol_ == 0)
{
++yyerrno;
+
#ifndef ACE_NLOGGING
ACE_TCHAR *errmsg = this->dll_.error ();
ACE_ERROR ((LM_ERROR,
@@ -434,18 +528,24 @@ ACE_Object_Node::symbol (ACE_Service_Gestalt *,
object_name,
errmsg ? errmsg : ACE_TEXT ("no error reported")));
#endif /* ACE_NLOGGING */
+
return 0;
}
+
return this->symbol_;
}
+
return 0;
}
+
ACE_Object_Node::~ACE_Object_Node (void)
{
ACE_TRACE ("ACE_Object_Node::~ACE_Object_Node");
delete[] const_cast<ACE_TCHAR *> (this->object_name_);
}
+
ACE_ALLOC_HOOK_DEFINE (ACE_Function_Node)
+
void
ACE_Function_Node::dump (void) const
{
@@ -453,6 +553,7 @@ ACE_Function_Node::dump (void) const
ACE_TRACE ("ACE_Function_Node::dump");
#endif /* ACE_HAS_DUMP */
}
+
ACE_Function_Node::ACE_Function_Node (const ACE_TCHAR *path,
const ACE_TCHAR *func_name)
: function_name_ (make_func_name (func_name))
@@ -461,6 +562,7 @@ ACE_Function_Node::ACE_Function_Node (const ACE_TCHAR *path,
this->pathname (ACE::strnew (path));
this->must_delete_ = 1;
}
+
ACE_TCHAR *
ACE_Function_Node::make_func_name (ACE_TCHAR const * func_name)
{
@@ -472,44 +574,55 @@ ACE_Function_Node::make_func_name (ACE_TCHAR const * func_name)
# define ACE_MAKE_VERSIONED_NAMESPACE_NAME_STRING_IMPL(NAME) #NAME
# define ACE_MAKE_VERSIONED_NAMESPACE_NAME_STRING(NAME) ACE_MAKE_VERSIONED_NAMESPACE_NAME_STRING_IMPL(NAME)
# define ACE_VERSIONED_NAMESPACE_NAME_STRING ACE_MAKE_VERSIONED_NAMESPACE_NAME_STRING(ACE_VERSIONED_NAMESPACE_NAME)
+
// Check if function is using the ACE naming convention. If so,
// it is likely that the ACE factory function macros
// (e.g. ACE_FACTORY_DECLARE) were used to declare and define it, so
// mangle the function name to include the ACE versioned namespace
// name as is done in the ACE macros. Otherwise, leave the function
// name as is.
+
static ACE_TCHAR const make_prefix[] = ACE_TEXT ("_make_");
static size_t const make_prefix_len =
sizeof (make_prefix) / sizeof (make_prefix[0]) - 1;
+
if (ACE_OS::strncmp (make_prefix, func_name, make_prefix_len) == 0)
{
static ACE_TCHAR const versioned_namespace_name[] =
ACE_TEXT (ACE_VERSIONED_NAMESPACE_NAME_STRING) ACE_TEXT("_") ;
+
// Null terminator included in versioned_namespace_name_len since
// it is static constant.
static size_t const versioned_namespace_name_len =
sizeof (versioned_namespace_name)
/ sizeof (versioned_namespace_name[0]); // - 1;
+
size_t const len =
ACE_OS::strlen (func_name)
+ versioned_namespace_name_len;
// + 1; // Null terminator.
+
ACE_TCHAR * mangled_func_name;
ACE_NEW_RETURN (mangled_func_name,
ACE_TCHAR[len],
0);
+
ACE_Auto_Basic_Array_Ptr<ACE_TCHAR> safe (mangled_func_name);
+
ACE_OS::snprintf (mangled_func_name,
len,
ACE_TEXT ("%s%s%s"),
make_prefix,
versioned_namespace_name,
func_name + make_prefix_len);
+
return safe.release ();
}
#endif /* ACE_HAS_VERSIONED_NAMESPACE == 1 */
+
return ACE::strnew (func_name);
}
+
void *
ACE_Function_Node::symbol (ACE_Service_Gestalt *,
int &yyerrno,
@@ -517,18 +630,22 @@ ACE_Function_Node::symbol (ACE_Service_Gestalt *,
{
typedef ACE_Service_Object *(*ACE_Service_Factory_Ptr)
(ACE_Service_Object_Exterminator *);
+
ACE_TRACE ("ACE_Function_Node::symbol");
if (this->open_dll (yyerrno) == 0)
{
this->symbol_ = 0;
+
// Locate the factory function <function_name> in the shared
// object.
ACE_TCHAR * const function_name =
const_cast<ACE_TCHAR *> (this->function_name_);
+
void * const func_p = this->dll_.symbol (function_name);
if (func_p == 0)
{
++yyerrno;
+
#ifndef ACE_NLOGGING
ACE_TCHAR * const errmsg = this->dll_.error ();
ACE_ERROR ((LM_ERROR,
@@ -537,17 +654,22 @@ ACE_Function_Node::symbol (ACE_Service_Gestalt *,
function_name,
errmsg ? errmsg : ACE_TEXT ("no error reported")));
#endif /* ACE_NLOGGING */
+
return 0;
}
+
#if defined (ACE_OPENVMS) && (!defined (__INITIAL_POINTER_SIZE) || (__INITIAL_POINTER_SIZE < 64))
int const temp_p = reinterpret_cast<int> (func_p);
#else
intptr_t const temp_p = reinterpret_cast<intptr_t> (func_p);
#endif
+
ACE_Service_Factory_Ptr func =
reinterpret_cast<ACE_Service_Factory_Ptr> (temp_p);
+
// Invoke the factory function and record it's return value.
this->symbol_ = (*func) (gobbler);
+
if (this->symbol_ == 0)
{
++yyerrno;
@@ -559,13 +681,16 @@ ACE_Function_Node::symbol (ACE_Service_Gestalt *,
}
return this->symbol_;
}
+
ACE_Function_Node::~ACE_Function_Node (void)
{
ACE_TRACE ("ACE_Function_Node::~ACE_Function_Node");
delete[] const_cast<ACE_TCHAR *> (function_name_);
delete[] const_cast<ACE_TCHAR *> (pathname_);
}
+
ACE_ALLOC_HOOK_DEFINE (ACE_Dummy_Node)
+
void
ACE_Dummy_Node::dump (void) const
{
@@ -573,6 +698,7 @@ ACE_Dummy_Node::dump (void) const
ACE_TRACE ("ACE_Dummy_Node::dump");
#endif /* ACE_HAS_DUMP */
}
+
ACE_Dummy_Node::ACE_Dummy_Node (const ACE_Static_Node *static_node,
const ACE_Parse_Node *str_mods)
: ACE_Parse_Node (static_node->name ()),
@@ -581,10 +707,12 @@ ACE_Dummy_Node::ACE_Dummy_Node (const ACE_Static_Node *static_node,
{
ACE_TRACE ("ACE_Dummy_Node::ACE_Dummy_Node");
}
+
void
ACE_Dummy_Node::apply (ACE_Service_Gestalt *, int &yyerrno)
{
ACE_TRACE ("ACE_Dummy_Node::apply");
+
#ifndef ACE_NLOGGING
if (ACE::debug ())
ACE_DEBUG ((LM_DEBUG,
@@ -595,6 +723,7 @@ ACE_Dummy_Node::apply (ACE_Service_Gestalt *, int &yyerrno)
ACE_UNUSED_ARG (yyerrno);
#endif /* ACE_NLOGGING */
}
+
ACE_Dummy_Node::~ACE_Dummy_Node (void)
{
ACE_TRACE ("ACE_Dummy_Node::~ACE_Dummy_Node");
@@ -603,7 +732,9 @@ ACE_Dummy_Node::~ACE_Dummy_Node (void)
ACE_Parse_Node *m = const_cast<ACE_Parse_Node *> (this->mods_);
delete m;
}
+
ACE_ALLOC_HOOK_DEFINE (ACE_Static_Function_Node)
+
void
ACE_Static_Function_Node::dump (void) const
{
@@ -611,21 +742,26 @@ ACE_Static_Function_Node::dump (void) const
ACE_TRACE ("ACE_Static_Function_Node::dump");
#endif /* ACE_HAS_DUMP */
}
+
ACE_Static_Function_Node::ACE_Static_Function_Node (const ACE_TCHAR *func_name)
: function_name_ (ACE::strnew (func_name))
{
ACE_TRACE ("ACE_Static_Function_Node::ACE_Static_Function_Node");
this->must_delete_ = 1;
}
+
void *
ACE_Static_Function_Node::symbol (ACE_Service_Gestalt *config,
int &yyerrno,
ACE_Service_Object_Exterminator *gobbler)
{
ACE_TRACE ("ACE_Static_Function_Node::symbol");
+
this->symbol_ = 0;
+
// Locate the factory function <function_name> in the statically
// linked svcs.
+
ACE_Static_Svc_Descriptor *ssd = 0;
if (config->find_static_svc_descriptor (this->function_name_, &ssd) == -1)
{
@@ -636,12 +772,15 @@ ACE_Static_Function_Node::symbol (ACE_Service_Gestalt *config,
this->function_name_),
0);
}
+
if (ssd->alloc_ == 0)
{
++yyerrno;
+
if (this->symbol_ == 0)
{
++yyerrno;
+
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("(%P|%t) No static service factory ")
ACE_TEXT ("function registered for function %s\n"),
@@ -649,8 +788,10 @@ ACE_Static_Function_Node::symbol (ACE_Service_Gestalt *config,
0);
}
}
+
// Invoke the factory function and record it's return value.
this->symbol_ = (*ssd->alloc_) (gobbler);
+
if (this->symbol_ == 0)
{
++yyerrno;
@@ -659,14 +800,18 @@ ACE_Static_Function_Node::symbol (ACE_Service_Gestalt *config,
this->function_name_),
0);
}
+
return this->symbol_;
}
+
ACE_Static_Function_Node::~ACE_Static_Function_Node (void)
{
ACE_TRACE ("ACE_Static_Function_Node::~ACE_Static_Function_Node");
delete[] const_cast<ACE_TCHAR *> (this->function_name_);
}
+
ACE_ALLOC_HOOK_DEFINE (ACE_Service_Type_Factory)
+
ACE_Service_Type_Factory::ACE_Service_Type_Factory (ACE_TCHAR const *name,
int type,
ACE_Location_Node *location,
@@ -678,19 +823,25 @@ ACE_Service_Type_Factory::ACE_Service_Type_Factory (ACE_TCHAR const *name,
{
}
+
ACE_Service_Type_Factory::~ACE_Service_Type_Factory (void)
{
}
+
ACE_Service_Type *
ACE_Service_Type_Factory::make_service_type (ACE_Service_Gestalt *cfg) const
{
ACE_TRACE ("ACE_Service_Type_Factory::make_service_type");
+
u_int flags = ACE_Service_Type::DELETE_THIS
| (this->location_->dispose () == 0 ? 0 : ACE_Service_Type::DELETE_OBJ);
+
int yyerrno = 0;
ACE_Service_Object_Exterminator gobbler = 0;
+
void *sym = this->location_->symbol (cfg, yyerrno, &gobbler);
+
if (sym != 0)
{
ACE_Service_Type_Impl *stp =
@@ -701,6 +852,7 @@ ACE_Service_Type_Factory::make_service_type (ACE_Service_Gestalt *cfg) const
gobbler);
if (stp == 0)
++yyerrno;
+
ACE_Service_Type *tmp = 0;
ACE_NEW_RETURN (tmp,
ACE_Service_Type (this->name (),
@@ -710,6 +862,7 @@ ACE_Service_Type_Factory::make_service_type (ACE_Service_Gestalt *cfg) const
0);
return tmp;
}
+
#ifndef ACE_NLOGGING
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("ACE (%P|%t) Unable to create ")
@@ -719,12 +872,15 @@ ACE_Service_Type_Factory::make_service_type (ACE_Service_Gestalt *cfg) const
++yyerrno;
return 0;
}
+
ACE_TCHAR const*
ACE_Service_Type_Factory::name (void) const
{
return name_.c_str ();
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_USES_CLASSIC_SVC_CONF == 1 */
diff --git a/dep/ACE_wrappers/ace/Parse_Node.h b/dep/ACE_wrappers/ace/Parse_Node.h
index 8255eb9bbce..232b3890396 100644
--- a/dep/ACE_wrappers/ace/Parse_Node.h
+++ b/dep/ACE_wrappers/ace/Parse_Node.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Parse_Node.h
@@ -9,21 +10,30 @@
*/
//=============================================================================
+
#ifndef ACE_PARSE_NODE_H
#define ACE_PARSE_NODE_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if (ACE_USES_CLASSIC_SVC_CONF == 1)
+
#include "ace/DLL.h"
#include "ace/SString.h"
#include "ace/Svc_Conf.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/// Forward declarations.
class ACE_Service_Config;
class ACE_Service_Type;
+
/**
* @class ACE_Parse_Node
*
@@ -40,23 +50,31 @@ public:
ACE_Parse_Node (void);
explicit ACE_Parse_Node (const ACE_TCHAR *name);
virtual ~ACE_Parse_Node (void);
+
ACE_Parse_Node *link (void) const;
void link (ACE_Parse_Node *);
+
/// Will update the yyereno member and/or the corresponding configuration
virtual void apply (ACE_Service_Gestalt *cfg, int &yyerrno) = 0;
+
const ACE_TCHAR *name (void) const;
void print (void) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
const ACE_TCHAR *name_;
ACE_Parse_Node *next_;
+
private:
ACE_UNIMPLEMENTED_FUNC (ACE_Parse_Node (const ACE_Parse_Node&))
ACE_UNIMPLEMENTED_FUNC (ACE_Parse_Node& operator= (const ACE_Parse_Node&))
};
+
/**
* @class ACE_Suspend_Node
*
@@ -71,15 +89,20 @@ class ACE_Suspend_Node : public ACE_Parse_Node
public:
ACE_Suspend_Node (const ACE_TCHAR *name);
~ACE_Suspend_Node (void);
+
virtual void apply (ACE_Service_Gestalt *cfg, int &yyerrno);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
ACE_UNIMPLEMENTED_FUNC (ACE_Suspend_Node (const ACE_Suspend_Node&))
ACE_UNIMPLEMENTED_FUNC (ACE_Suspend_Node& operator= (const ACE_Suspend_Node&))
};
+
/**
* @class ACE_Resume_Node
*
@@ -94,15 +117,20 @@ class ACE_Resume_Node : public ACE_Parse_Node
public:
ACE_Resume_Node (const ACE_TCHAR *name);
~ACE_Resume_Node (void);
+
virtual void apply (ACE_Service_Gestalt *cfg, int &yyerrno);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
ACE_UNIMPLEMENTED_FUNC (ACE_Resume_Node (const ACE_Resume_Node&))
ACE_UNIMPLEMENTED_FUNC (ACE_Resume_Node& operator= (const ACE_Resume_Node&))
};
+
/**
* @class ACE_Remove_Node
*
@@ -117,15 +145,20 @@ class ACE_Remove_Node : public ACE_Parse_Node
public:
ACE_Remove_Node (const ACE_TCHAR *name);
~ACE_Remove_Node (void);
+
virtual void apply (ACE_Service_Gestalt *cfg, int &yyerrno);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
ACE_UNIMPLEMENTED_FUNC (ACE_Remove_Node (const ACE_Remove_Node&))
ACE_UNIMPLEMENTED_FUNC (ACE_Remove_Node& operator= (const ACE_Remove_Node&))
};
+
/**
* @class ACE_Static_Node
*
@@ -140,22 +173,30 @@ class ACE_Static_Node : public ACE_Parse_Node
public:
ACE_Static_Node (const ACE_TCHAR *name, ACE_TCHAR *params = 0);
virtual ~ACE_Static_Node (void);
+
virtual void apply (ACE_Service_Gestalt *cfg, int &yyerrno);
virtual const ACE_Service_Type *record (const ACE_Service_Gestalt *g) const;
+
ACE_TCHAR *parameters (void) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// "Command-line" parameters.
ACE_TCHAR *parameters_;
+
private:
ACE_UNIMPLEMENTED_FUNC (ACE_Static_Node (const ACE_Static_Node&))
ACE_UNIMPLEMENTED_FUNC (ACE_Static_Node& operator= (const ACE_Static_Node&))
};
+
class ACE_Service_Type_Factory;
+
/**
* @class ACE_Dynamic_Node
*
@@ -169,20 +210,27 @@ class ACE_Dynamic_Node : public ACE_Static_Node
{
public:
ACE_Dynamic_Node (ACE_Service_Type_Factory const *, ACE_TCHAR *params);
+
virtual ~ACE_Dynamic_Node (void);
+
// virtual const ACE_Service_Type *record (void) const;
virtual void apply (ACE_Service_Gestalt *cfg, int &yyerrno);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Pointer to a descriptor that describes this node.
ACE_Auto_Ptr<const ACE_Service_Type_Factory> factory_;
+
private:
ACE_UNIMPLEMENTED_FUNC (ACE_Dynamic_Node (const ACE_Dynamic_Node&))
ACE_UNIMPLEMENTED_FUNC (ACE_Dynamic_Node& operator= (const ACE_Dynamic_Node&))
};
+
/**
* @class ACE_Stream_Node
*
@@ -197,19 +245,25 @@ class ACE_Stream_Node : public ACE_Parse_Node
public:
ACE_Stream_Node (const ACE_Static_Node *, const ACE_Parse_Node *);
virtual ~ACE_Stream_Node (void);
+
virtual void apply (ACE_Service_Gestalt *cfg, int &yyerrno);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Linked list of modules that are part of the stream.
const ACE_Static_Node *node_;
const ACE_Parse_Node *mods_;
+
private:
ACE_UNIMPLEMENTED_FUNC (ACE_Stream_Node (const ACE_Stream_Node&))
ACE_UNIMPLEMENTED_FUNC (ACE_Stream_Node& operator= (const ACE_Stream_Node&))
};
+
/**
* @class ACE_Dummy_Node
*
@@ -223,19 +277,25 @@ class ACE_Dummy_Node : public ACE_Parse_Node
public:
ACE_Dummy_Node (const ACE_Static_Node *, const ACE_Parse_Node *);
~ACE_Dummy_Node (void);
+
virtual void apply (ACE_Service_Gestalt *cfg, int &yyerrno);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Linked list of modules that we're dealing with.
const ACE_Static_Node *node_;
const ACE_Parse_Node *mods_;
+
private:
ACE_UNIMPLEMENTED_FUNC (ACE_Dummy_Node (const ACE_Dummy_Node&))
ACE_UNIMPLEMENTED_FUNC (ACE_Dummy_Node& operator= (const ACE_Dummy_Node&))
};
+
/**
* @class ACE_Location_Node
*
@@ -253,35 +313,46 @@ public:
const ACE_TCHAR *pathname (void) const;
void pathname (const ACE_TCHAR *h);
int dispose (void) const;
+
virtual ~ACE_Location_Node (void);
virtual void set_symbol (void *h);
+
/// Will update the yyerrno member and/or corresponding configuration
/// repository
virtual void *symbol (ACE_Service_Gestalt *cfgptr,
int &yyerrno,
ACE_Service_Object_Exterminator * = 0) = 0;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
int open_dll (int & yyerrno);
+
/// Pathname to the shared library we are working on.
const ACE_TCHAR *pathname_;
+
/**
* Flag indicating whether the Service_Object generated by this
* Location Node should be deleted or not
* (ACE_Service_Type::DELETE_OBJ.)
*/
int must_delete_;
+
/// The open shared library.
ACE_DLL dll_;
+
/// Symbol that we've obtained from the shared library.
void *symbol_;
+
private:
ACE_UNIMPLEMENTED_FUNC (ACE_Location_Node (const ACE_Location_Node&))
ACE_UNIMPLEMENTED_FUNC (ACE_Location_Node& operator= (const ACE_Location_Node&))
};
+
/**
* @class ACE_Object_Node
*
@@ -299,17 +370,22 @@ public:
int &yyerrno,
ACE_Service_Object_Exterminator * = 0);
virtual ~ACE_Object_Node (void);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Name of the object that we're parsing.
const ACE_TCHAR *object_name_;
+
private:
ACE_UNIMPLEMENTED_FUNC (ACE_Object_Node (const ACE_Object_Node&))
ACE_UNIMPLEMENTED_FUNC (ACE_Object_Node& operator= (const ACE_Object_Node&))
};
+
/**
* @class ACE_Function_Node
*
@@ -327,11 +403,15 @@ public:
int &yyerrno,
ACE_Service_Object_Exterminator *gobbler = 0);
virtual ~ACE_Function_Node (void);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
+
/// Return mangled function name that takes into account ACE
/// versioned namespace.
/**
@@ -350,13 +430,17 @@ private:
* delete[] or ACE::strdelete() on the returned string.
*/
ACE_TCHAR * make_func_name (ACE_TCHAR const * func_name);
+
private:
+
/// Name of the function that we're parsing.
const ACE_TCHAR *function_name_;
+
private:
ACE_UNIMPLEMENTED_FUNC (ACE_Function_Node (const ACE_Function_Node&))
ACE_UNIMPLEMENTED_FUNC (ACE_Function_Node& operator= (const ACE_Function_Node&))
};
+
/**
* @class ACE_Static_Function_Node
*
@@ -376,17 +460,22 @@ public:
int &yyerrno,
ACE_Service_Object_Exterminator * = 0);
virtual ~ACE_Static_Function_Node (void);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Name of the function that we're parsing.
const ACE_TCHAR *function_name_;
+
private:
ACE_UNIMPLEMENTED_FUNC (ACE_Static_Function_Node (const ACE_Static_Function_Node&))
ACE_UNIMPLEMENTED_FUNC (ACE_Static_Function_Node& operator= (const ACE_Static_Function_Node&))
};
+
/// A helper class used to safely register dynamic services, which may contains
/// subordinate static services. It is used to capture the necessary data during
/// the parsing, but perform the actuall instantiation later.
@@ -397,27 +486,39 @@ public:
int type,
ACE_Location_Node *location,
int active);
+
~ACE_Service_Type_Factory (void);
+
ACE_Service_Type *make_service_type (ACE_Service_Gestalt *pcfg) const;
+
ACE_TCHAR const* name (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
+
/**
* Not implemented to enforce no copying
*/
ACE_UNIMPLEMENTED_FUNC
(ACE_Service_Type_Factory(const ACE_Service_Type_Factory&))
+
ACE_UNIMPLEMENTED_FUNC
(ACE_Service_Type_Factory& operator=(const ACE_Service_Type_Factory&))
+
private:
ACE_TString name_;
int type_;
ACE_Auto_Ptr<ACE_Location_Node> location_;
int is_active_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_USES_CLASSIC_SVC_CONF == 1 */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_PARSE_NODE_H */
diff --git a/dep/ACE_wrappers/ace/Ping_Socket.cpp b/dep/ACE_wrappers/ace/Ping_Socket.cpp
index 987b911c18a..a09e3731a80 100644
--- a/dep/ACE_wrappers/ace/Ping_Socket.cpp
+++ b/dep/ACE_wrappers/ace/Ping_Socket.cpp
@@ -1,41 +1,57 @@
// $Id: Ping_Socket.cpp 81737 2008-05-20 09:46:39Z johnnyw $
+
#include "ace/Ping_Socket.h"
+
#if defined (ACE_HAS_ICMP_SUPPORT) && (ACE_HAS_ICMP_SUPPORT == 1)
+
#include "ace/INET_Addr.h"
#include "ace/Log_Msg.h"
#include "ace/OS_NS_string.h"
#include "ace/OS_NS_sys_time.h"
#include "ace/OS_NS_sys_socket.h"
+
#if !defined (__ACE_INLINE__)
# include "ace/Ping_Socket.inl"
#endif /* !__ACE_INLINE__ */
+
ACE_RCSID (ace,
Ping_Socket,
"$Id: Ping_Socket.cpp 81737 2008-05-20 09:46:39Z johnnyw $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE (ACE_Ping_Socket)
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
//---------------------------------------------------------------------------
// Better to arrange some os_include/netinet/ip.h and
// os_include/netinet/icmp.h files ?
//---------------------------------------------------------------------------
+
#if !defined (ACE_WIN32)
+
/*
* This is where ICMP-related stuff is defined on any sane system...
*/
#include /**/ <netinet/in_systm.h>
#include /**/ <netinet/ip.h>
#include /**/ <netinet/ip_icmp.h>
+
#else /* #if ! defined (ACE_WIN32) */
+
/*
* This was a surpise to me... This stuff is not defined anywhere under MSVC.
* These values have only been checked for NT4 and Win2K. They were taken from
* the MSDN ping.c program and modified.
*/
+
#define ICMP_ECHO 8
#define ICMP_ECHOREPLY 0
+
#pragma pack(1)
+
struct ip
{
ACE_UINT8 ip_hl:4; // length of the header
@@ -50,6 +66,7 @@ struct ip
ACE_UINT32 sourceIP;
ACE_UINT32 destIP;
};
+
struct icmp
{
ACE_UINT8 icmp_type;
@@ -59,23 +76,30 @@ struct icmp
ACE_UINT16 icmp_seq;
ACE_UINT32 icmp_data; // time data
};
+
#pragma pack()
+
#endif /* #if ! defined (ACE_WIN32) */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
int const ICMP_MIN = 8; // Minimal size of ICMP packet, header only
int const ICMP_DATA_LENGTH = 56; // For ICMP data with Echo request
ACE_Time_Value const ACE_Ping_Socket::time_default_ (0, 500000);
+
void
ACE_Ping_Socket::dump (void) const
{
ACE_TRACE ("ACE_Ping_Socket::dump");
}
+
ACE_Ping_Socket::ACE_Ping_Socket (void)
{
ACE_TRACE ("ACE_Ping_Socket::ACE_Ping_Socket");
}
+
ACE_Ping_Socket::ACE_Ping_Socket (ACE_Addr const & local,
int protocol,
int reuse_addr)
@@ -83,8 +107,10 @@ ACE_Ping_Socket::ACE_Ping_Socket (ACE_Addr const & local,
connected_socket_ (false)
{
ACE_TRACE ("ACE_Ping_Socket::ACE_Ping_Socket");
+
ACE_OS::memset (icmp_send_buff_, 0, sizeof (icmp_send_buff_));
ACE_OS::memset (icmp_recv_buff_, 0, sizeof (icmp_recv_buff_));
+
if (this->open (local, protocol, reuse_addr) == -1)
{
ACE_DEBUG ((LM_DEBUG,
@@ -92,6 +118,7 @@ ACE_Ping_Socket::ACE_Ping_Socket (ACE_Addr const & local,
ACE_TEXT ("open")));
return;
}
+
// trying to increase the size of socket receive buffer - some
// protection from multiple responces e.g., when falling to the
// multi-cast address
@@ -101,10 +128,12 @@ ACE_Ping_Socket::ACE_Ping_Socket (ACE_Addr const & local,
(void *) &size,
sizeof (size));
}
+
ACE_Ping_Socket::~ACE_Ping_Socket (void)
{
ACE_TRACE ("ACE_Ping_Socket::~ACE_Ping_Socket");
}
+
int
ACE_Ping_Socket::open (ACE_Addr const & local,
int protocol,
@@ -113,16 +142,20 @@ ACE_Ping_Socket::open (ACE_Addr const & local,
ACE_TRACE ("ACE_Ping_Socket::open");
return inherited::open (local, protocol, reuse_addr);
}
+
int
ACE_Ping_Socket::receive_echo_reply (ACE_Time_Value const * timeout)
{
ACE_TRACE ("ACE_Ping_Socket::receive_echo_reply");
+
ACE_Time_Value before = ACE_OS::gettimeofday ();
ACE_Time_Value after;
ACE_Time_Value time_left;
ACE_Time_Value *wait_time = const_cast<ACE_Time_Value *> (timeout);
const ACE_Time_Value half_millisec (0, 500);
+
ACE_OS::memset (icmp_recv_buff_, 0, sizeof icmp_recv_buff_);
+
do
{
int rval_recv = inherited::recv (icmp_recv_buff_,
@@ -135,6 +168,7 @@ ACE_Ping_Socket::receive_echo_reply (ACE_Time_Value const * timeout)
{
after = ACE_OS::gettimeofday ();
time_left = *timeout - after + before;
+
// If more than .5 ms left, wait on select()
if (time_left > half_millisec)
{
@@ -164,9 +198,11 @@ ACE_Ping_Socket::receive_echo_reply (ACE_Time_Value const * timeout)
*wait_time = *timeout - after + before;
}
} while (*wait_time >= half_millisec);
+
errno = ETIMEDOUT;
return -1;
}
+
int
ACE_Ping_Socket::process_incoming_dgram (char * ptr, ssize_t len)
{
@@ -174,7 +210,9 @@ ACE_Ping_Socket::process_incoming_dgram (char * ptr, ssize_t len)
int icmplen;
struct ip * ip;
struct icmp * icmp;
+
ip = (struct ip *) ptr; // start of IP header
+
// Warning... using knowledge of IP header layout. This avoids a maze of
// #if blocks for various systems. The first byte of the header has the
// IP version in the left-most 4 bits and the length in the other 4 bits.
@@ -186,7 +224,9 @@ ACE_Ping_Socket::process_incoming_dgram (char * ptr, ssize_t len)
hlen1 >>= 4; // Zero-extended length remains
#endif
hlen1 <<= 2; // Now it counts bytes, not words
+
icmp = (struct icmp *) (ptr + hlen1); // start of ICMP header
+
if ((icmplen = len - hlen1) < ICMP_MIN)
{
ACE_DEBUG
@@ -200,12 +240,14 @@ ACE_Ping_Socket::process_incoming_dgram (char * ptr, ssize_t len)
ACE_TEXT ("The ICMP header either not received or is corrupted.")),
-1);
}
+
if (icmp->icmp_type == ICMP_ECHOREPLY)
{
ACE_DEBUG
((LM_DEBUG,
ACE_TEXT ("(%P|%t) ACE_Ping_Socket::process_incoming_dgram")
ACE_TEXT (" - ICMP_ECHOREPLY received.\n")));
+
if (icmp->icmp_id != getpid ())
{
ACE_ERROR_RETURN
@@ -226,6 +268,7 @@ ACE_Ping_Socket::process_incoming_dgram (char * ptr, ssize_t len)
icmplen),
-1);
}
+
ACE_DEBUG
((LM_DEBUG,
ACE_TEXT ("(%P|%t) ACE::Ping_Socket::process_incoming_dgram - ")
@@ -233,14 +276,18 @@ ACE_Ping_Socket::process_incoming_dgram (char * ptr, ssize_t len)
ACE_TEXT ("ICMP datagram with length of %d bytes (not counting ")
ACE_TEXT ("IP-header): seq=%u, ttl=%d.\n"),
icmplen, icmp->icmp_seq, ip->ip_ttl));
+
return 0; //= success
}
+
ACE_DEBUG
((LM_DEBUG,
ACE_TEXT ("(%P|%t) ACE::Ping_Socket::process_incoming_dgram - ")
ACE_TEXT ("received datagram that is not ICMP_ECHOREPLY.\n")));
+
return -1;
}
+
int
ACE_Ping_Socket::send_echo_check (ACE_INET_Addr &remote_addr,
bool to_connect)
@@ -250,8 +297,10 @@ ACE_Ping_Socket::send_echo_check (ACE_INET_Addr &remote_addr,
errno = EBADF;
return -1;
}
+
sockaddr_in *addr_connect = 0;
addr_connect = (sockaddr_in *) remote_addr.get_addr ();
+
/*
* Nulling port field to prevent strange behavior, when a raw
* socket is "connected" to a sockaddr_in with a non-nulled port.
@@ -259,6 +308,7 @@ ACE_Ping_Socket::send_echo_check (ACE_INET_Addr &remote_addr,
ACE_OS::memset ((void*) &addr_connect->sin_port,
0,
sizeof (addr_connect->sin_port));
+
// to connect the socket
if (to_connect && !this->connected_socket_)
{
@@ -271,24 +321,29 @@ ACE_Ping_Socket::send_echo_check (ACE_INET_Addr &remote_addr,
}
this->connected_socket_ = true;
}
+
ACE_OS::memset (this->icmp_send_buff_, 0, sizeof this->icmp_send_buff_);
int datalen = ICMP_DATA_LENGTH;
struct icmp *_icmp = 0;
+
_icmp = (struct icmp *) this->icmp_send_buff_;
_icmp->icmp_type = ICMP_ECHO;
_icmp->icmp_code = 0;
_icmp->icmp_id = getpid ();
_icmp->icmp_seq = sequence_number_++;
+
#if defined (ACE_WIN32)
_icmp->icmp_data = GetTickCount ();
#else /* #if defined (ACE_WIN32) */
gettimeofday ((struct timeval *) &_icmp->icmp_data, 0);
#endif /* #if defined (ACE_WIN32) */
+
int length_icmp = ICMP_MIN + datalen; // checksum ICMP header and data.
_icmp->icmp_cksum = 0;
_icmp->icmp_cksum = inherited::calculate_checksum ((u_short *) _icmp,
length_icmp);
int rval_send = -1;
+
if ((rval_send = send ((void const *) icmp_send_buff_,
length_icmp,
remote_addr)) != length_icmp)
@@ -297,21 +352,27 @@ ACE_Ping_Socket::send_echo_check (ACE_INET_Addr &remote_addr,
}
return 0;
}
+
int
ACE_Ping_Socket::make_echo_check (ACE_INET_Addr & remote_addr,
bool to_connect,
ACE_Time_Value const * timeout)
{
int rval_send = -1;
+
if ((rval_send = this->send_echo_check (remote_addr,
to_connect)) == -1)
return -1;
+
ACE_DEBUG
((LM_DEBUG,
ACE_TEXT ("(%P|%t) ACE_Ping_Socket::make_echo_check - sent %d.\n"),
rval_send));
+
return this->receive_echo_reply (timeout);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_ICMP_SUPPORT == 1 */
diff --git a/dep/ACE_wrappers/ace/Ping_Socket.h b/dep/ACE_wrappers/ace/Ping_Socket.h
index 4a3e3f01c6d..6681d013dbc 100644
--- a/dep/ACE_wrappers/ace/Ping_Socket.h
+++ b/dep/ACE_wrappers/ace/Ping_Socket.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Ping_Socket.h
@@ -9,17 +10,26 @@
* @author Gonzalo A. Diethelm <gonzalo.diethelm@aditiva.com>
*/
//=============================================================================
+
#ifndef ACE_PING_SOCKET_H
#define ACE_PING_SOCKET_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_ICMP_SUPPORT) && (ACE_HAS_ICMP_SUPPORT == 1)
+
#include "ace/ICMP_Socket.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_INET_Addr;
+
/**
* @class ACE_Ping_Socket
*
@@ -30,54 +40,80 @@ class ACE_INET_Addr;
class ACE_Export ACE_Ping_Socket : public ACE_ICMP_Socket
{
typedef ACE_ICMP_Socket inherited;
+
public:
+
// = Initialization and termination methods.
+
/// Default constructor.
ACE_Ping_Socket (void);
+
ACE_Ping_Socket (ACE_Addr const & local,
int protocol = IPPROTO_ICMP,
int reuse_addr = 0);
+
/// Destructor.
~ACE_Ping_Socket (void);
+
/// Wrapper around the BSD-style @c socket system call (no QoS).
int open (ACE_Addr const & local = ACE_Addr::sap_any,
int protocol = IPPROTO_ICMP,
int reuse_addr = 0);
+
/// @a toConnect = 1 - makes connect to remote address
int send_echo_check (ACE_INET_Addr & remote_addr,
bool to_connect = false);
+
/// To receive @c ICMP_ECHOREPLY. To be called after successfully
/// sending @c ICMP_ECHO.
int process_incoming_dgram (char * ptr, ssize_t len);
+
/// @a toConnect = 1 - makes connect to remote address
int make_echo_check (ACE_INET_Addr & remote_addr,
bool to_connect = false,
ACE_Time_Value const * timeout = &time_default_);
+
char * icmp_recv_buff (void);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
public:
+
enum
{
PING_BUFFER_SIZE = (1024 * 2)
};
+
static ACE_Time_Value const time_default_;
+
private:
+
int receive_echo_reply (ACE_Time_Value const * timeout);
+
/// Do not allow this function to percolate up to this interface.
int get_remote_addr (ACE_INET_Addr &addr) const;
+
char icmp_send_buff_[PING_BUFFER_SIZE];
char icmp_recv_buff_[PING_BUFFER_SIZE];
+
ACE_UINT16 sequence_number_;
+
bool connected_socket_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
# include "ace/Ping_Socket.inl"
#endif /* __ACE_INLINE__ */
+
#endif /* ACE_HAS_ICMP_SUPPORT == 1 */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_PING_SOCKET_H */
diff --git a/dep/ACE_wrappers/ace/Ping_Socket.inl b/dep/ACE_wrappers/ace/Ping_Socket.inl
index 893838c22ae..bce261d91e6 100644
--- a/dep/ACE_wrappers/ace/Ping_Socket.inl
+++ b/dep/ACE_wrappers/ace/Ping_Socket.inl
@@ -1,10 +1,13 @@
// -*- C++ -*-
//
// $Id: Ping_Socket.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE char *
ACE_Ping_Socket::icmp_recv_buff (void)
{
return this->icmp_recv_buff_;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Pipe.cpp b/dep/ACE_wrappers/ace/Pipe.cpp
index 95075772f0e..717f72e52ea 100644
--- a/dep/ACE_wrappers/ace/Pipe.cpp
+++ b/dep/ACE_wrappers/ace/Pipe.cpp
@@ -1,4 +1,5 @@
// $Id: Pipe.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Pipe.h"
#include "ace/SOCK_Acceptor.h"
#include "ace/SOCK_Connector.h"
@@ -6,15 +7,21 @@
#include "ace/OS_NS_sys_socket.h"
#include "ace/OS_Memory.h"
#include "ace/Truncate.h"
+
#if defined (ACE_HAS_STREAM_PIPES) || defined (__QNX__)
# include "ace/OS_NS_unistd.h"
#endif // ACE_HAS_STREAM_PIPES || __QNX__
+
#include "ace/os_include/netinet/os_tcp.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Pipe.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace, Pipe, "$Id: Pipe.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
void
ACE_Pipe::dump (void) const
{
@@ -27,10 +34,12 @@ ACE_Pipe::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
int
ACE_Pipe::open (int buffer_size)
{
ACE_TRACE ("ACE_Pipe::open");
+
#if defined (ACE_LACKS_SOCKETPAIR) || defined (__Lynx__)
ACE_INET_Addr my_addr;
ACE_SOCK_Acceptor acceptor;
@@ -43,6 +52,7 @@ ACE_Pipe::open (int buffer_size)
# else
ACE_Addr local_any = ACE_Addr::sap_any;
# endif /* ACE_WIN32 */
+
// Bind listener to any port and then find out what the port was.
if (acceptor.open (local_any) == -1
|| acceptor.get_local_addr (my_addr) == -1)
@@ -51,6 +61,7 @@ ACE_Pipe::open (int buffer_size)
{
ACE_INET_Addr sv_addr (my_addr.get_port_number (),
ACE_LOCALHOST);
+
// Establish a connection within the same process.
if (connector.connect (writer, sv_addr) == -1)
result = -1;
@@ -60,17 +71,22 @@ ACE_Pipe::open (int buffer_size)
result = -1;
}
}
+
// Close down the acceptor endpoint since we don't need it anymore.
acceptor.close ();
if (result == -1)
return -1;
+
this->handles_[0] = reader.get_handle ();
this->handles_[1] = writer.get_handle ();
+
# if !defined (ACE_LACKS_TCP_NODELAY)
int one = 1;
+
// Make sure that the TCP stack doesn't try to buffer small writes.
// Since this communication is purely local to the host it doesn't
// affect network performance.
+
if (writer.set_option (ACE_IPPROTO_TCP,
TCP_NODELAY,
&one,
@@ -80,6 +96,7 @@ ACE_Pipe::open (int buffer_size)
return -1;
}
# endif /* ! ACE_LACKS_TCP_NODELAY */
+
# if defined (ACE_LACKS_SOCKET_BUFSIZ)
ACE_UNUSED_ARG (buffer_size);
# else /* ! ACE_LACKS_SOCKET_BUFSIZ */
@@ -102,6 +119,7 @@ ACE_Pipe::open (int buffer_size)
return -1;
}
# endif /* ! ACE_LACKS_SOCKET_BUFSIZ */
+
#elif defined (ACE_HAS_STREAM_PIPES) || defined (__QNX__)
ACE_UNUSED_ARG (buffer_size);
if (ACE_OS::pipe (this->handles_) == -1)
@@ -109,8 +127,10 @@ ACE_Pipe::open (int buffer_size)
ACE_TEXT ("%p\n"),
ACE_TEXT ("pipe")),
-1);
+
#if !defined(__QNX__)
int arg = RMSGN;
+
// Enable "msg no discard" mode, which ensures that record
// boundaries are maintained when messages are sent and received.
if (ACE_OS::ioctl (this->handles_[0],
@@ -126,6 +146,7 @@ ACE_Pipe::open (int buffer_size)
ACE_TEXT ("ioctl")), -1);
}
#endif /* __QNX__ */
+
#else /* ! ACE_LACKS_SOCKETPAIR && ! ACE_HAS_STREAM_PIPES */
if (ACE_OS::socketpair (AF_UNIX,
SOCK_STREAM,
@@ -177,12 +198,15 @@ ACE_Pipe::open (int buffer_size)
#endif /* ! ACE_LACKS_SOCKETPAIR && ! ACE_HAS_STREAM_PIPES */
// Point both the read and write HANDLES to the appropriate socket
// HANDLEs.
+
return 0;
}
+
int
ACE_Pipe::open (ACE_HANDLE handles[2])
{
ACE_TRACE ("ACE_Pipe::open");
+
if (this->open () == -1)
return -1;
else
@@ -192,20 +216,26 @@ ACE_Pipe::open (ACE_HANDLE handles[2])
return 0;
}
}
+
// Do nothing...
+
ACE_Pipe::ACE_Pipe (void)
{
ACE_TRACE ("ACE_Pipe::ACE_Pipe");
+
this->handles_[0] = ACE_INVALID_HANDLE;
this->handles_[1] = ACE_INVALID_HANDLE;
}
+
ACE_Pipe::ACE_Pipe (ACE_HANDLE handles[2])
{
ACE_TRACE ("ACE_Pipe::ACE_Pipe");
+
if (this->open (handles) == -1)
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("ACE_Pipe::ACE_Pipe")));
}
+
ACE_Pipe::ACE_Pipe (ACE_HANDLE read,
ACE_HANDLE write)
{
@@ -213,26 +243,34 @@ ACE_Pipe::ACE_Pipe (ACE_HANDLE read,
this->handles_[0] = read;
this->handles_[1] = write;
}
+
int
ACE_Pipe::close (void)
{
ACE_TRACE ("ACE_Pipe::close");
+
int result = 0;
+
// Note that the following will work even if we aren't closing down
// sockets because <ACE_OS::closesocket> will just call <::close> in
// that case!
+
if (this->handles_[0] != ACE_INVALID_HANDLE)
result = ACE_OS::closesocket (this->handles_[0]);
this->handles_[0] = ACE_INVALID_HANDLE;
+
if (this->handles_[1] != ACE_INVALID_HANDLE)
result |= ACE_OS::closesocket (this->handles_[1]);
this->handles_[1] = ACE_INVALID_HANDLE;
+
return result;
}
+
// Send N char *ptrs and int lengths. Note that the char *'s precede
// the ints (basically, an varargs version of writev). The count N is
// the *total* number of trailing arguments, *not* a couple of the
// number of tuple pairs!
+
ssize_t
ACE_Pipe::send (size_t n, ...) const
{
@@ -247,12 +285,15 @@ ACE_Pipe::send (size_t n, ...) const
iovec[total_tuples],
-1);
#endif /* !defined (ACE_HAS_ALLOCA) */
+
va_start (argp, n);
+
for (int i = 0; i < total_tuples; ++i)
{
iovp[i].iov_base = va_arg (argp, char *);
iovp[i].iov_len = va_arg (argp, int);
}
+
#if defined (ACE_WIN32)
ssize_t result = ACE::sendv (this->write_handle (),
iovp,
@@ -262,17 +303,20 @@ ACE_Pipe::send (size_t n, ...) const
iovp,
total_tuples);
#endif /* ACE_WIN32 */
+
#if !defined (ACE_HAS_ALLOCA)
delete [] iovp;
#endif /* !defined (ACE_HAS_ALLOCA) */
va_end (argp);
return result;
}
+
// This is basically an interface to ACE_OS::readv, that doesn't use
// the struct iovec explicitly. The ... can be passed as an arbitrary
// number of (char *ptr, int len) tuples. However, the count N is the
// *total* number of trailing arguments, *not* a couple of the number
// of tuple pairs!
+
ssize_t
ACE_Pipe::recv (size_t n, ...) const
{
@@ -287,12 +331,15 @@ ACE_Pipe::recv (size_t n, ...) const
iovec[total_tuples],
-1);
#endif /* !defined (ACE_HAS_ALLOCA) */
+
va_start (argp, n);
+
for (int i = 0; i < total_tuples; ++i)
{
iovp[i].iov_base = va_arg (argp, char *);
iovp[i].iov_len = va_arg (argp, int);
}
+
#if defined (ACE_WIN32)
ssize_t const result = ACE::recvv (this->read_handle (),
iovp,
@@ -302,11 +349,13 @@ ACE_Pipe::recv (size_t n, ...) const
iovp,
total_tuples);
#endif /* ACE_WIN32 */
+
#if !defined (ACE_HAS_ALLOCA)
delete [] iovp;
#endif /* !defined (ACE_HAS_ALLOCA) */
va_end (argp);
return result;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Pipe.h b/dep/ACE_wrappers/ace/Pipe.h
index a1a4f94876f..0dd37ed14d0 100644
--- a/dep/ACE_wrappers/ace/Pipe.h
+++ b/dep/ACE_wrappers/ace/Pipe.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file Pipe.h
@@ -8,20 +9,29 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//==========================================================================
+
#ifndef ACE_PIPE_H
#define ACE_PIPE_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Default_Constants.h"
+
#include "ace/OS_NS_sys_uio.h"
#include "ace/OS_NS_unistd.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward decl.
class ACE_Message_Block;
class ACE_Time_Value;
+
/**
* @class ACE_Pipe
*
@@ -37,51 +47,69 @@ public:
// = Initialization and termination.
/// Default constructor (does nothing...).
ACE_Pipe (void);
+
/// Open the pipe and initialize the handles.
ACE_Pipe (ACE_HANDLE handles[2]);
+
/// Initialize the ACE_Pipe from the @a read and @a write handles.
ACE_Pipe (ACE_HANDLE read, ACE_HANDLE write);
+
/// Default dtor. It doesn't close the handles for you.
~ACE_Pipe (void);
+
/// Open the pipe and initialize the handles.
int open (ACE_HANDLE handles[2]);
+
/// Open the pipe, setting the buffer size to the maximum.
int open (int buffer_size = ACE_DEFAULT_MAX_SOCKET_BUFSIZ);
+
/// Close down the pipe HANDLEs;
int close (void);
+
// = Accessors.
+
/**
* This is the "read" side of the pipe. Note, however, that
* processes can also write to this handle as well since pipes are
* bi-directional.
*/
ACE_HANDLE read_handle (void) const;
+
/**
* This is the "write" side of the pipe. Note, however, that
* processes can also read to this handle as well since pipes are
* bi-directional.
*/
ACE_HANDLE write_handle (void) const;
+
/// Dump the state of the object.
void dump (void) const;
+
/// send upto @a n bytes in @a buf.
ssize_t send (const void *buf, size_t n) const;
+
/// Recv upto @a n bytes in @a buf.
ssize_t recv (void *buf, size_t n) const;
+
/// Send n bytes, keep trying until n are sent.
ssize_t send_n (const void *buf, size_t n) const;
+
/// Send all the @a message_blocks chained through their <next> and
/// <cont> pointers. This call uses the underlying OS gather-write
/// operation to reduce the domain-crossing penalty.
ssize_t send_n (const ACE_Message_Block *message_block,
const ACE_Time_Value *timeout = 0,
size_t *bytes_transferred = 0);
+
/// Recv n bytes, keep trying until n are received.
ssize_t recv_n (void *buf, size_t n) const;
+
/// Send iovecs via <::writev>.
ssize_t send (const iovec iov[], int n) const;
+
/// Recv iovecs via <::readv>.
ssize_t recv (iovec iov[], int n) const;
+
/**
* Send N char *ptrs and int lengths. Note that the char *'s
* precede the ints (basically, an varargs version of writev). The
@@ -89,6 +117,7 @@ public:
* couple of the number of tuple pairs!
*/
ssize_t send (size_t n, ...) const;
+
/**
* This is an interface to ::readv, that doesn't use the struct
* iovec explicitly. The ... can be passed as an arbitrary number
@@ -97,31 +126,41 @@ public:
* number of tuple pairs!
*/
ssize_t recv (size_t n, ...) const;
+
/// Send @a n bytes via Win32 WriteFile using overlapped I/O.
ssize_t send (const void *buf,
size_t n,
ACE_OVERLAPPED *overlapped) const;
+
/// Recv @a n bytes via Win32 ReadFile using overlapped I/O.
ssize_t recv (void *buf,
size_t n,
ACE_OVERLAPPED *overlapped) const;
+
/// Send an <iovec> of size @a n to the file.
ssize_t sendv (const iovec iov[],
int n) const;
+
/// Send an @c iovec of size @a n to the file. Will block until all
/// bytes are sent or an error occurs.
ssize_t sendv_n (const iovec iov[],
int n) const;
+
/// Receive an @c iovec of size @a n to the file.
ssize_t recvv_n (iovec iov[],
int n) const;
+
private:
ACE_HANDLE handles_[2];
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Pipe.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_PIPE_H */
diff --git a/dep/ACE_wrappers/ace/Pipe.inl b/dep/ACE_wrappers/ace/Pipe.inl
index 9ea6f3cb9c9..63e6ea5d4fb 100644
--- a/dep/ACE_wrappers/ace/Pipe.inl
+++ b/dep/ACE_wrappers/ace/Pipe.inl
@@ -1,27 +1,33 @@
// -*- C++ -*-
//
// $Id: Pipe.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Global_Macros.h"
#include "ace/ACE.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_Pipe::~ACE_Pipe (void)
{
ACE_TRACE ("ACE_Pipe::~ACE_Pipe");
// Notice that the destructor doesn't close the handles for you.
}
+
ACE_INLINE ACE_HANDLE
ACE_Pipe::read_handle (void) const
{
ACE_TRACE ("ACE_Pipe::read_handle");
return this->handles_[0];
}
+
ACE_INLINE ACE_HANDLE
ACE_Pipe::write_handle (void) const
{
ACE_TRACE ("ACE_Pipe::write_handle");
return this->handles_[1];
}
+
ACE_INLINE ssize_t
ACE_Pipe::sendv_n (const iovec iov[], int n) const
{
@@ -36,6 +42,7 @@ ACE_Pipe::sendv_n (const iovec iov[], int n) const
n);
#endif /* ACE_WIN32 */
}
+
ACE_INLINE ssize_t
ACE_Pipe::send_n (const ACE_Message_Block *message_block,
const ACE_Time_Value *timeout,
@@ -54,7 +61,9 @@ ACE_Pipe::send_n (const ACE_Message_Block *message_block,
bytes_transferred);
#endif /* ACE_WIN32 */
}
+
// Recv an n byte message from the file.
+
ACE_INLINE ssize_t
ACE_Pipe::recvv_n (iovec iov[], int n) const
{
@@ -71,7 +80,9 @@ ACE_Pipe::recvv_n (iovec iov[], int n) const
n);
#endif /* ACE_WIN32 */
}
+
// Send an <iovec> of size <n> to the file.
+
ACE_INLINE ssize_t
ACE_Pipe::sendv (const iovec iov[], int n) const
{
@@ -82,8 +93,10 @@ ACE_Pipe::sendv (const iovec iov[], int n) const
return ACE_OS::writev (this->write_handle (), iov, n);
#endif /* ACE_WIN32 */
}
+
// Send exactly N bytes from BUF to this file. Keeping trying until
// this many bytes are sent.
+
ACE_INLINE ssize_t
ACE_Pipe::send_n (const void *buf, size_t n) const
{
@@ -94,8 +107,10 @@ ACE_Pipe::send_n (const void *buf, size_t n) const
return ACE::write_n (this->write_handle (), buf, n);
#endif /* ACE_WIN32 */
}
+
// Receive exactly N bytes from this file into BUF. Keep trying until
// this many bytes are received.
+
ACE_INLINE ssize_t
ACE_Pipe::recv_n (void *buf, size_t n) const
{
@@ -106,6 +121,7 @@ ACE_Pipe::recv_n (void *buf, size_t n) const
return ACE::read_n (this->read_handle (), buf, n);
#endif /* ACE_WIN32 */
}
+
ACE_INLINE ssize_t
ACE_Pipe::send (const void *buf, size_t n) const
{
@@ -116,6 +132,7 @@ ACE_Pipe::send (const void *buf, size_t n) const
return ACE_OS::write (this->write_handle (), static_cast <const char *> (buf), n);
#endif /* ACE_WIN32 */
}
+
ACE_INLINE ssize_t
ACE_Pipe::recv (void *buf, size_t n) const
{
@@ -126,6 +143,7 @@ ACE_Pipe::recv (void *buf, size_t n) const
return ACE_OS::read (this->read_handle (), static_cast <char *> (buf), n);
#endif /* ACE_WIN32 */
}
+
ACE_INLINE ssize_t
ACE_Pipe::send (const iovec iov[], int n) const
{
@@ -136,6 +154,7 @@ ACE_Pipe::send (const iovec iov[], int n) const
return ACE_OS::writev (this->write_handle (), iov, n);
#endif /* ACE_WIN32 */
}
+
ACE_INLINE ssize_t
ACE_Pipe::recv (iovec iov[], int n) const
{
@@ -146,6 +165,7 @@ ACE_Pipe::recv (iovec iov[], int n) const
return ACE_OS::readv (this->read_handle (), iov, n);
#endif /* ACE_WIN32 */
}
+
ACE_INLINE ssize_t
ACE_Pipe::send (const void *buf, size_t n,
ACE_OVERLAPPED *overlapped) const
@@ -155,6 +175,7 @@ ACE_Pipe::send (const void *buf, size_t n,
static_cast <const char *> (buf), n,
overlapped);
}
+
ACE_INLINE ssize_t
ACE_Pipe::recv (void *buf, size_t n,
ACE_OVERLAPPED *overlapped) const
@@ -163,4 +184,5 @@ ACE_Pipe::recv (void *buf, size_t n,
return ACE_OS::read (this->read_handle (), static_cast <char *> (buf), n,
overlapped);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Priority_Reactor.cpp b/dep/ACE_wrappers/ace/Priority_Reactor.cpp
index e6aabebd106..10a3a80567e 100644
--- a/dep/ACE_wrappers/ace/Priority_Reactor.cpp
+++ b/dep/ACE_wrappers/ace/Priority_Reactor.cpp
@@ -1,17 +1,26 @@
// $Id: Priority_Reactor.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Priority_Reactor.h"
#include "ace/Malloc_T.h"
+
ACE_RCSID(ace, Priority_Reactor, "$Id: Priority_Reactor.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
typedef ACE_Unbounded_Queue_Iterator<ACE_Event_Tuple> QUEUE_ITERATOR;
// Its iterator.
+
typedef ACE_Cached_Allocator<ACE_Node<ACE_Event_Tuple>, ACE_SYNCH_NULL_MUTEX> TUPLE_ALLOCATOR;
// Defines the memory allocator used, no need for locking because it
// is only used in one thread of control.
+
ACE_ALLOC_HOOK_DEFINE(ACE_Priority_Reactor)
+
// Initialize ACE_Select_Reactor.
+
#define npriorities \
ACE_Event_Handler::HI_PRIORITY-ACE_Event_Handler::LO_PRIORITY+1
+
void
ACE_Priority_Reactor::init_bucket (void)
{
@@ -20,14 +29,17 @@ ACE_Priority_Reactor::init_bucket (void)
// allocator here?
ACE_NEW (this->tuple_allocator_,
TUPLE_ALLOCATOR (ACE_Select_Reactor::DEFAULT_SIZE));
+
// The event handlers are assigned to a new As the Event
ACE_NEW (this->bucket_,
QUEUE *[npriorities]);
+
// This loops "ensures" exception safety.
for (int i = 0; i < npriorities; ++i)
ACE_NEW (this->bucket_[i],
QUEUE (this->tuple_allocator_));
}
+
ACE_Priority_Reactor::ACE_Priority_Reactor (ACE_Sig_Handler *sh,
ACE_Timer_Queue *tq)
: ACE_Select_Reactor(sh, tq),
@@ -37,6 +49,7 @@ ACE_Priority_Reactor::ACE_Priority_Reactor (ACE_Sig_Handler *sh,
ACE_TRACE ("ACE_Priority_Reactor::ACE_Priority_Reactor");
this->init_bucket ();
}
+
ACE_Priority_Reactor::ACE_Priority_Reactor (size_t size,
int rs,
ACE_Sig_Handler *sh,
@@ -48,20 +61,25 @@ ACE_Priority_Reactor::ACE_Priority_Reactor (size_t size,
ACE_TRACE ("ACE_Priority_Reactor::ACE_Priority_Reactor");
this->init_bucket ();
}
+
ACE_Priority_Reactor::~ACE_Priority_Reactor (void)
{
ACE_TRACE ("ACE_Priority_Reactor::~ACE_Priority_Reactor");
+
for (int i = 0; i < npriorities; ++i)
delete this->bucket_[i];
+
delete[] this->bucket_;
delete tuple_allocator_;
}
+
int
ACE_Priority_Reactor::build_bucket (ACE_Handle_Set &dispatch_mask,
int &min_priority,
int &max_priority)
{
ACE_Handle_Set_Iterator handle_iter (dispatch_mask);
+
for (ACE_HANDLE handle;
(handle = handle_iter ()) != ACE_INVALID_HANDLE;
)
@@ -70,23 +88,29 @@ ACE_Priority_Reactor::build_bucket (ACE_Handle_Set &dispatch_mask,
this->handler_rep_.find (handle);
if (event_handler == 0)
return -1;
+
ACE_Event_Tuple et (event_handler,
handle);
int prio = et.event_handler_->priority ();
+
// If the priority is out of range assign the minimum priority.
if (prio < ACE_Event_Handler::LO_PRIORITY
|| prio > ACE_Event_Handler::HI_PRIORITY)
prio = ACE_Event_Handler::LO_PRIORITY;
+
if (bucket_[prio]->enqueue_tail (et) == -1)
return -1;
+
// Update the priority ranges....
if (min_priority > prio)
min_priority = prio;
if (max_priority < prio)
max_priority = prio;
}
+
return 0;
}
+
int
ACE_Priority_Reactor::dispatch_io_set (int number_of_active_handles,
int& number_dispatched,
@@ -96,54 +120,70 @@ ACE_Priority_Reactor::dispatch_io_set (int number_of_active_handles,
ACE_EH_PTMF callback)
{
ACE_TRACE ("ACE_Priority_Reactor::dispatch_io_set");
+
if (number_of_active_handles == 0)
return 0;
+
// The range for which there exists any Event_Tuple is computed on
// the ordering loop, minimizing iterations on the dispatching loop.
int min_priority =
ACE_Event_Handler::HI_PRIORITY;
int max_priority =
ACE_Event_Handler::LO_PRIORITY;
+
if (this->build_bucket (dispatch_mask,
min_priority,
max_priority) == -1)
return -1;
+
for (int i = max_priority; i >= min_priority; --i)
{
while (!bucket_[i]->is_empty ()
&& number_dispatched < number_of_active_handles)
{
+
ACE_Event_Tuple et;
+
bucket_[i]->dequeue_head (et);
+
this->notify_handle (et.handle_,
mask,
ready_mask,
et.event_handler_,
callback);
number_dispatched++;
+
// clear the bit from that dispatch mask,
// so when we need to restart the iteration (rebuilding the iterator...)
// we will not dispatch the already dipatched handlers
this->clear_dispatch_mask (et.handle_,
mask);
+
if (this->state_changed_)
this->state_changed_ = false; // so it will not rebuild it ...
}
+
// Even if we are aborting the loop due to this->state_changed
// or another error we still want to cleanup the buckets.
bucket_[i]->reset ();
}
+
return 0;
}
+
void
ACE_Priority_Reactor::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_Priority_Reactor::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
+
ACE_Select_Reactor::dump ();
+
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Priority_Reactor.h b/dep/ACE_wrappers/ace/Priority_Reactor.h
index b796f987698..bdca70ece7a 100644
--- a/dep/ACE_wrappers/ace/Priority_Reactor.h
+++ b/dep/ACE_wrappers/ace/Priority_Reactor.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Priority_Reactor.h
@@ -8,16 +9,22 @@
* @author Carlos O'Ryan <coryan@uci.edu>
*/
//=============================================================================
+
#ifndef ACE_PRIORITY_REACTOR_H
#define ACE_PRIORITY_REACTOR_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Select_Reactor.h"
#include "ace/Unbounded_Queue.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Priority_Reactor
*
@@ -31,22 +38,29 @@ class ACE_Export ACE_Priority_Reactor : public ACE_Select_Reactor
{
public:
// = Initialization and termination methods.
+
/// Initialize ACE_Priority_Reactor with the default size.
ACE_Priority_Reactor (ACE_Sig_Handler * = 0,
ACE_Timer_Queue * = 0);
+
/// Initialize ACE_Priority_Reactor with size @a size.
ACE_Priority_Reactor (size_t size,
int restart = 0,
ACE_Sig_Handler * = 0,
ACE_Timer_Queue * = 0);
+
/// Close down the select_reactor and release all of its resources.
virtual ~ACE_Priority_Reactor (void);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
// = Dispatching methods.
+
/// We simply override this function to implement the priority
/// dispatching.
virtual int dispatch_io_set (int number_of_active_handles,
@@ -55,26 +69,33 @@ protected:
ACE_Handle_Set &dispatch_mask,
ACE_Handle_Set &ready_mask,
ACE_EH_PTMF callback);
+
private:
/// A small helper to initialize the bucket.
void init_bucket (void);
+
/// Build the bucket from the given dispatch_mask. Return -1 on
/// failure, 0 otherwise.
int build_bucket (ACE_Handle_Set& dispatch_mask,
int &min_priority,
int &max_priority);
+
/// There is a queue per-priority, which simply holds the
/// Event_Handlers until we know who goes first.
typedef ACE_Unbounded_Queue<ACE_Event_Tuple> QUEUE;
QUEUE** bucket_;
+
/// The queues themselves use this allocator to minimize dynamic
/// memory usage.
ACE_Allocator* tuple_allocator_;
+
/// Deny access since member-wise won't work...
ACE_Priority_Reactor (const ACE_Priority_Reactor &);
ACE_Priority_Reactor &operator = (const ACE_Priority_Reactor &);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
#endif /* ACE_PRIORITY_REACTOR_H */
diff --git a/dep/ACE_wrappers/ace/Proactor.cpp b/dep/ACE_wrappers/ace/Proactor.cpp
index ae7cdd7e50a..c56f352e789 100644
--- a/dep/ACE_wrappers/ace/Proactor.cpp
+++ b/dep/ACE_wrappers/ace/Proactor.cpp
@@ -1,40 +1,53 @@
// $Id: Proactor.cpp 81535 2008-04-29 20:08:52Z shuston $
+
#include "ace/config-lite.h"
#include "ace/Proactor.h"
#if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS)
+
// This only works on Win32 platforms and on Unix platforms with aio
// calls.
+
#include "ace/Auto_Ptr.h"
#include "ace/Proactor_Impl.h"
#include "ace/Object_Manager.h"
#include "ace/Task_T.h"
+
#if !defined (ACE_HAS_WINCE) && !defined (ACE_LACKS_ACE_SVCCONF)
# include "ace/Service_Config.h"
#endif /* !ACE_HAS_WINCE && !ACE_LACKS_ACE_SVCCONF */
+
ACE_RCSID (ace,
Proactor,
"$Id: Proactor.cpp 81535 2008-04-29 20:08:52Z shuston $")
+
#include "ace/Task_T.h"
#include "ace/Log_Msg.h"
#include "ace/Framework_Component.h"
+
#if defined (ACE_HAS_AIO_CALLS)
# include "ace/POSIX_Proactor.h"
# include "ace/POSIX_CB_Proactor.h"
#else /* !ACE_HAS_AIO_CALLS */
# include "ace/WIN32_Proactor.h"
#endif /* ACE_HAS_AIO_CALLS */
+
#if !defined (__ACE_INLINE__)
#include "ace/Proactor.inl"
#endif /* __ACE_INLINE__ */
+
#include "ace/Auto_Event.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/// Process-wide ACE_Proactor.
ACE_Proactor *ACE_Proactor::proactor_ = 0;
+
/// Controls whether the Proactor is deleted when we shut down (we can
/// only delete it safely if we created it!)
bool ACE_Proactor::delete_proactor_ = false;
+
/**
* @class ACE_Proactor_Timer_Handler
*
@@ -50,51 +63,65 @@ bool ACE_Proactor::delete_proactor_ = false;
*/
class ACE_Proactor_Timer_Handler : public ACE_Task<ACE_NULL_SYNCH>
{
+
/// Proactor has special privileges
/// Access needed to: timer_event_
friend class ACE_Proactor;
+
public:
/// Constructor.
ACE_Proactor_Timer_Handler (ACE_Proactor &proactor);
+
/// Destructor.
virtual ~ACE_Proactor_Timer_Handler (void);
+
/// Proactor calls this to shut down the timer handler
/// gracefully. Just calling the destructor alone doesnt do what
/// <destroy> does. <destroy> make sure the thread exits properly.
int destroy (void);
+
protected:
/// Run by a daemon thread to handle deferred processing. In other
/// words, this method will do the waiting on the earliest timer and
/// event.
virtual int svc (void);
+
/// Event to wait on.
ACE_Auto_Event timer_event_;
+
/// Proactor.
ACE_Proactor &proactor_;
+
/// Flag used to indicate when we are shutting down.
int shutting_down_;
};
+
ACE_Proactor_Timer_Handler::ACE_Proactor_Timer_Handler (ACE_Proactor &proactor)
: ACE_Task <ACE_NULL_SYNCH> (&proactor.thr_mgr_),
proactor_ (proactor),
shutting_down_ (0)
{
}
+
ACE_Proactor_Timer_Handler::~ACE_Proactor_Timer_Handler (void)
{
// Mark for closing down.
this->shutting_down_ = 1;
+
// Signal timer event.
this->timer_event_.signal ();
+
// Wait for the Timer Handler thread to exit.
this->wait ();
}
+
int
ACE_Proactor_Timer_Handler::svc (void)
{
ACE_Time_Value absolute_time;
ACE_Time_Value relative_time;
int result = 0;
+
while (this->shutting_down_ == 0)
{
// Check whether the timer queue has any items in it.
@@ -102,21 +129,25 @@ ACE_Proactor_Timer_Handler::svc (void)
{
// Get the earliest absolute time.
absolute_time = this->proactor_.timer_queue ()->earliest_time ();
+
// Get current time from timer queue since we don't know
// which <gettimeofday> was used.
ACE_Time_Value cur_time = this->proactor_.timer_queue ()->gettimeofday ();
+
// Compare absolute time with curent time received from the
// timer queue.
if (absolute_time > cur_time)
relative_time = absolute_time - cur_time;
else
relative_time = ACE_Time_Value::zero;
+
// Block for relative time.
result = this->timer_event_.wait (&relative_time, 0);
}
else
// The timer queue has no entries, so wait indefinitely.
result = this->timer_event_.wait ();
+
// Check for timer expiries.
if (result == -1)
{
@@ -137,11 +168,14 @@ ACE_Proactor_Timer_Handler::svc (void)
}
return 0;
}
+
// *********************************************************************
+
ACE_Proactor_Handle_Timeout_Upcall::ACE_Proactor_Handle_Timeout_Upcall (void)
: proactor_ (0)
{
}
+
int
ACE_Proactor_Handle_Timeout_Upcall::registration (TIMER_QUEUE &,
ACE_Handler *,
@@ -149,6 +183,7 @@ ACE_Proactor_Handle_Timeout_Upcall::registration (TIMER_QUEUE &,
{
return 0;
}
+
int
ACE_Proactor_Handle_Timeout_Upcall::preinvoke (TIMER_QUEUE &,
ACE_Handler *,
@@ -159,6 +194,7 @@ ACE_Proactor_Handle_Timeout_Upcall::preinvoke (TIMER_QUEUE &,
{
return 0;
}
+
int
ACE_Proactor_Handle_Timeout_Upcall::postinvoke (TIMER_QUEUE &,
ACE_Handler *,
@@ -169,6 +205,7 @@ ACE_Proactor_Handle_Timeout_Upcall::postinvoke (TIMER_QUEUE &,
{
return 0;
}
+
int
ACE_Proactor_Handle_Timeout_Upcall::timeout (TIMER_QUEUE &,
ACE_Handler *handler,
@@ -181,6 +218,7 @@ ACE_Proactor_Handle_Timeout_Upcall::timeout (TIMER_QUEUE &,
ACE_TEXT ("(%t) No Proactor set in ACE_Proactor_Handle_Timeout_Upcall,")
ACE_TEXT (" no completion port to post timeout to?!@\n")),
-1);
+
// Create the Asynch_Timer.
ACE_Asynch_Result_Impl *asynch_timer =
this->proactor_->create_asynch_timer (handler->proxy (),
@@ -189,13 +227,16 @@ ACE_Proactor_Handle_Timeout_Upcall::timeout (TIMER_QUEUE &,
ACE_INVALID_HANDLE,
0,
-1);
+
if (asynch_timer == 0)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("%N:%l:(%P | %t):%p\n"),
ACE_TEXT ("ACE_Proactor_Handle_Timeout_Upcall::timeout:")
ACE_TEXT ("create_asynch_timer failed")),
-1);
+
auto_ptr<ACE_Asynch_Result_Impl> safe_asynch_timer (asynch_timer);
+
// Post a completion.
if (-1 == safe_asynch_timer->post_completion
(this->proactor_->implementation ()))
@@ -203,11 +244,14 @@ ACE_Proactor_Handle_Timeout_Upcall::timeout (TIMER_QUEUE &,
ACE_TEXT ("Failure in dealing with timers: ")
ACE_TEXT ("PostQueuedCompletionStatus failed\n")),
-1);
+
// The completion has been posted. The proactor is now responsible
// for managing the asynch_timer memory.
(void) safe_asynch_timer.release ();
+
return 0;
}
+
int
ACE_Proactor_Handle_Timeout_Upcall::cancel_type (TIMER_QUEUE &,
ACE_Handler *,
@@ -217,6 +261,7 @@ ACE_Proactor_Handle_Timeout_Upcall::cancel_type (TIMER_QUEUE &,
// Do nothing
return 0;
}
+
int
ACE_Proactor_Handle_Timeout_Upcall::cancel_timer (TIMER_QUEUE &,
ACE_Handler *,
@@ -226,6 +271,7 @@ ACE_Proactor_Handle_Timeout_Upcall::cancel_timer (TIMER_QUEUE &,
// Do nothing
return 0;
}
+
int
ACE_Proactor_Handle_Timeout_Upcall::deletion (TIMER_QUEUE &,
ACE_Handler *,
@@ -234,6 +280,7 @@ ACE_Proactor_Handle_Timeout_Upcall::deletion (TIMER_QUEUE &,
// Do nothing
return 0;
}
+
int
ACE_Proactor_Handle_Timeout_Upcall::proactor (ACE_Proactor &proactor)
{
@@ -248,7 +295,9 @@ ACE_Proactor_Handle_Timeout_Upcall::proactor (ACE_Proactor &proactor)
ACE_TEXT (" to be used with ONE (and only one) Proactor\n")),
-1);
}
+
// *********************************************************************
+
ACE_Proactor::ACE_Proactor (ACE_Proactor_Impl *implementation,
bool delete_implementation,
TIMER_QUEUE *tq)
@@ -261,6 +310,7 @@ ACE_Proactor::ACE_Proactor (ACE_Proactor_Impl *implementation,
event_loop_thread_count_ (0)
{
this->implementation (implementation);
+
if (this->implementation () == 0)
{
#if defined (ACE_HAS_AIO_CALLS)
@@ -288,60 +338,76 @@ ACE_Proactor::ACE_Proactor (ACE_Proactor_Impl *implementation,
this->implementation (implementation);
this->delete_implementation_ = true;
}
+
// Set the timer queue.
this->timer_queue (tq);
+
// Create the timer handler
ACE_NEW (this->timer_handler_,
ACE_Proactor_Timer_Handler (*this));
+
// Activate <timer_handler>.
if (this->timer_handler_->activate () == -1)
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("%N:%l:(%P | %t):%p\n"),
ACE_TEXT ("Task::activate:could not create thread\n")));
}
+
ACE_Proactor::~ACE_Proactor (void)
{
this->close ();
}
+
ACE_Proactor *
ACE_Proactor::instance (size_t /* threads */)
{
ACE_TRACE ("ACE_Proactor::instance");
+
if (ACE_Proactor::proactor_ == 0)
{
// Perform Double-Checked Locking Optimization.
ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon,
*ACE_Static_Object_Lock::instance (),
0));
+
if (ACE_Proactor::proactor_ == 0)
{
ACE_NEW_RETURN (ACE_Proactor::proactor_,
ACE_Proactor,
0);
+
ACE_Proactor::delete_proactor_ = true;
ACE_REGISTER_FRAMEWORK_COMPONENT(ACE_Proactor, ACE_Proactor::proactor_);
}
}
return ACE_Proactor::proactor_;
}
+
ACE_Proactor *
ACE_Proactor::instance (ACE_Proactor * r, bool delete_proactor)
{
ACE_TRACE ("ACE_Proactor::instance");
+
ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon,
*ACE_Static_Object_Lock::instance (), 0));
+
ACE_Proactor *t = ACE_Proactor::proactor_;
+
ACE_Proactor::delete_proactor_ = delete_proactor;
ACE_Proactor::proactor_ = r;
ACE_REGISTER_FRAMEWORK_COMPONENT(ACE_Proactor, ACE_Proactor::proactor_);
+
return t;
}
+
void
ACE_Proactor::close_singleton (void)
{
ACE_TRACE ("ACE_Proactor::close_singleton");
+
ACE_MT (ACE_GUARD (ACE_Recursive_Thread_Mutex, ace_mon,
*ACE_Static_Object_Lock::instance ()));
+
if (ACE_Proactor::delete_proactor_)
{
delete ACE_Proactor::proactor_;
@@ -349,16 +415,19 @@ ACE_Proactor::close_singleton (void)
ACE_Proactor::delete_proactor_ = false;
}
}
+
const ACE_TCHAR *
ACE_Proactor::dll_name (void)
{
return ACE_TEXT ("ACE");
}
+
const ACE_TCHAR *
ACE_Proactor::name (void)
{
return ACE_TEXT ("ACE_Proactor");
}
+
int
ACE_Proactor::check_reconfiguration (ACE_Proactor *)
{
@@ -371,20 +440,25 @@ ACE_Proactor::check_reconfiguration (ACE_Proactor *)
#endif /* ! ACE_HAS_WINCE || ! ACE_LACKS_ACE_SVCCONF */
return 0;
}
+
int
ACE_Proactor::proactor_run_event_loop (PROACTOR_EVENT_HOOK eh)
{
ACE_TRACE ("ACE_Proactor::proactor_run_event_loop");
int result = 0;
+
{
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1));
+
// Early check. It is ok to do this without lock, since we care just
// whether it is zero or non-zero.
if (this->end_event_loop_ != 0)
return 0;
+
// First time you are in. Increment the thread count.
this->event_loop_thread_count_ ++;
}
+
// Run the event loop.
for (;;)
{
@@ -392,25 +466,34 @@ ACE_Proactor::proactor_run_event_loop (PROACTOR_EVENT_HOOK eh)
// since we care just whether it is zero or non-zero.
if (this->end_event_loop_ != 0)
break;
+
// <end_event_loop> is not set. Ready to do <handle_events>.
result = this->handle_events ();
+
if (eh != 0 && (*eh) (this))
continue;
+
if (result == -1)
break;
}
+
// Leaving the event loop. Decrement the thread count.
+
{
// Obtain the lock in the MT environments.
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1));
+
// Decrement the thread count.
this->event_loop_thread_count_ --;
+
if (this->event_loop_thread_count_ > 0
&& this->end_event_loop_ != 0)
this->proactor_post_wakeup_completions (1);
}
+
return result;
}
+
// Handle events for -tv- time. handle_events updates -tv- to reflect
// time elapsed, so do not return until -tv- == 0, or an error occurs.
int
@@ -419,16 +502,20 @@ ACE_Proactor::proactor_run_event_loop (ACE_Time_Value &tv,
{
ACE_TRACE ("ACE_Proactor::proactor_run_event_loop");
int result = 0;
+
{
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1));
+
// Early check. It is ok to do this without lock, since we care just
// whether it is zero or non-zero.
if (this->end_event_loop_ != 0
|| tv == ACE_Time_Value::zero)
return 0;
+
// First time you are in. Increment the thread count.
this->event_loop_thread_count_ ++;
}
+
// Run the event loop.
for (;;)
{
@@ -436,60 +523,81 @@ ACE_Proactor::proactor_run_event_loop (ACE_Time_Value &tv,
// since we care just whether it is zero or non-zero.
if (this->end_event_loop_ != 0)
break;
+
// <end_event_loop> is not set. Ready to do <handle_events>.
result = this->handle_events (tv);
+
if (eh != 0 && (*eh) (this))
continue;
+
if (result == -1 || result == 0)
break;
}
+
// Leaving the event loop. Decrement the thread count.
+
{
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1));
+
// Decrement the thread count.
this->event_loop_thread_count_ --;
+
if (this->event_loop_thread_count_ > 0
&& this->end_event_loop_ != 0)
this->proactor_post_wakeup_completions (1);
}
+
return result;
}
+
int
ACE_Proactor::proactor_reset_event_loop(void)
{
ACE_TRACE ("ACE_Proactor::proactor_reset_event_loop");
+
// Obtain the lock in the MT environments.
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1));
+
this->end_event_loop_ = 0;
return 0;
}
+
int
ACE_Proactor::proactor_end_event_loop (void)
{
ACE_TRACE ("ACE_Proactor::proactor_end_event_loop");
+
int how_many = 0;
+
{
// Obtain the lock, set the end flag and post the wakeup
// completions.
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1));
+
// Set the end flag.
this->end_event_loop_ = 1;
+
// Number of completions to post.
how_many = this->event_loop_thread_count_;
if (how_many == 0)
return 0;
}
+
// Post completions to all the threads so that they will all wake
// up.
return this->proactor_post_wakeup_completions (how_many);
}
+
int
ACE_Proactor::proactor_event_loop_done (void)
{
ACE_TRACE ("ACE_Proactor::proactor_event_loop_done");
+
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1));
+
return this->end_event_loop_ != 0 ? 1 : 0 ;
}
+
int
ACE_Proactor::close (void)
{
@@ -498,18 +606,21 @@ ACE_Proactor::close (void)
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("%N:%l:(%P | %t):%p\n"),
ACE_TEXT ("ACE_Proactor::close: implementation close")));
+
// Delete the implementation.
if (this->delete_implementation_)
{
delete this->implementation ();
this->implementation_ = 0;
}
+
// Delete the timer handler.
if (this->timer_handler_)
{
delete this->timer_handler_;
this->timer_handler_ = 0;
}
+
// Delete the timer queue.
if (this->delete_timer_queue_)
{
@@ -517,8 +628,10 @@ ACE_Proactor::close (void)
this->timer_queue_ = 0;
this->delete_timer_queue_ = 0;
}
+
return 0;
}
+
int
ACE_Proactor::register_handle (ACE_HANDLE handle,
const void *completion_key)
@@ -526,6 +639,7 @@ ACE_Proactor::register_handle (ACE_HANDLE handle,
return this->implementation ()->register_handle (handle,
completion_key);
}
+
long
ACE_Proactor::schedule_timer (ACE_Handler &handler,
const void *act,
@@ -536,6 +650,7 @@ ACE_Proactor::schedule_timer (ACE_Handler &handler,
time,
ACE_Time_Value::zero);
}
+
long
ACE_Proactor::schedule_repeating_timer (ACE_Handler &handler,
const void *act,
@@ -546,6 +661,7 @@ ACE_Proactor::schedule_repeating_timer (ACE_Handler &handler,
interval,
interval);
}
+
long
ACE_Proactor::schedule_timer (ACE_Handler &handler,
const void *act,
@@ -555,15 +671,19 @@ ACE_Proactor::schedule_timer (ACE_Handler &handler,
// absolute time.
ACE_Time_Value absolute_time =
this->timer_queue_->gettimeofday () + time;
+
// Only one guy goes in here at a time
ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_RECURSIVE_MUTEX,
ace_mon,
this->timer_queue_->mutex (),
-1));
+
// Remember the old proactor.
ACE_Proactor *old_proactor = handler.proactor ();
+
// Assign *this* Proactor to the handler.
handler.proactor (this);
+
// Schedule the timer
long result = this->timer_queue_->schedule (&handler,
act,
@@ -573,6 +693,7 @@ ACE_Proactor::schedule_timer (ACE_Handler &handler,
{
// no failures: check to see if we are the earliest time
if (this->timer_queue_->earliest_time () == absolute_time)
+
// wake up the timer thread
if (this->timer_handler_->timer_event_.signal () == -1)
{
@@ -581,13 +702,16 @@ ACE_Proactor::schedule_timer (ACE_Handler &handler,
result = -1;
}
}
+
if (result == -1)
{
// Reset the old proactor in case of failures.
handler.proactor (old_proactor);
}
+
return result;
}
+
int
ACE_Proactor::cancel_timer (long timer_id,
const void **arg,
@@ -599,6 +723,7 @@ ACE_Proactor::cancel_timer (long timer_id,
arg,
dont_call_handle_close);
}
+
int
ACE_Proactor::cancel_timer (ACE_Handler &handler,
int dont_call_handle_close)
@@ -608,41 +733,49 @@ ACE_Proactor::cancel_timer (ACE_Handler &handler,
return this->timer_queue_->cancel (&handler,
dont_call_handle_close);
}
+
int
ACE_Proactor::handle_events (ACE_Time_Value &wait_time)
{
return implementation ()->handle_events (wait_time);
}
+
int
ACE_Proactor::handle_events (void)
{
return this->implementation ()->handle_events ();
}
+
int
ACE_Proactor::wake_up_dispatch_threads (void)
{
return 0;
}
+
int
ACE_Proactor::close_dispatch_threads (int)
{
return 0;
}
+
size_t
ACE_Proactor::number_of_threads (void) const
{
return this->implementation ()->number_of_threads ();
}
+
void
ACE_Proactor::number_of_threads (size_t threads)
{
this->implementation ()->number_of_threads (threads);
}
+
ACE_Proactor::TIMER_QUEUE *
ACE_Proactor::timer_queue (void) const
{
return this->timer_queue_;
}
+
void
ACE_Proactor::timer_queue (TIMER_QUEUE *tq)
{
@@ -652,6 +785,7 @@ ACE_Proactor::timer_queue (TIMER_QUEUE *tq)
delete this->timer_queue_;
this->delete_timer_queue_ = 0;
}
+
// New timer queue.
if (tq == 0)
{
@@ -664,65 +798,78 @@ ACE_Proactor::timer_queue (TIMER_QUEUE *tq)
this->timer_queue_ = tq;
this->delete_timer_queue_ = 0;
}
+
// Set the proactor in the timer queue's functor
this->timer_queue_->upcall_functor ().proactor (*this);
}
+
ACE_HANDLE
ACE_Proactor::get_handle (void) const
{
return this->implementation ()->get_handle ();
}
+
ACE_Proactor_Impl *
ACE_Proactor::implementation (void) const
{
return this->implementation_;
}
+
ACE_Asynch_Read_Stream_Impl *
ACE_Proactor::create_asynch_read_stream (void)
{
return this->implementation ()->create_asynch_read_stream ();
}
+
ACE_Asynch_Write_Stream_Impl *
ACE_Proactor::create_asynch_write_stream (void)
{
return this->implementation ()->create_asynch_write_stream ();
}
+
ACE_Asynch_Read_Dgram_Impl *
ACE_Proactor::create_asynch_read_dgram (void)
{
return this->implementation ()->create_asynch_read_dgram ();
}
+
ACE_Asynch_Write_Dgram_Impl *
ACE_Proactor::create_asynch_write_dgram (void)
{
return this->implementation ()->create_asynch_write_dgram ();
}
+
ACE_Asynch_Read_File_Impl *
ACE_Proactor::create_asynch_read_file (void)
{
return this->implementation ()->create_asynch_read_file ();
}
+
ACE_Asynch_Write_File_Impl *
ACE_Proactor::create_asynch_write_file (void)
{
return this->implementation ()->create_asynch_write_file ();
}
+
ACE_Asynch_Accept_Impl *
ACE_Proactor::create_asynch_accept (void)
{
return this->implementation ()->create_asynch_accept ();
}
+
ACE_Asynch_Connect_Impl *
ACE_Proactor::create_asynch_connect (void)
{
return this->implementation ()->create_asynch_connect ();
}
+
ACE_Asynch_Transmit_File_Impl *
ACE_Proactor::create_asynch_transmit_file (void)
{
return this->implementation ()->create_asynch_transmit_file ();
}
+
ACE_Asynch_Read_Stream_Result_Impl *
ACE_Proactor::create_asynch_read_stream_result
(ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -745,6 +892,7 @@ ACE_Proactor::create_asynch_read_stream_result
signal_number);
}
+
ACE_Asynch_Write_Stream_Result_Impl *
ACE_Proactor::create_asynch_write_stream_result
(ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -766,6 +914,7 @@ ACE_Proactor::create_asynch_write_stream_result
priority,
signal_number);
}
+
ACE_Asynch_Read_File_Result_Impl *
ACE_Proactor::create_asynch_read_file_result
(ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -791,6 +940,7 @@ ACE_Proactor::create_asynch_read_file_result
priority,
signal_number);
}
+
ACE_Asynch_Write_File_Result_Impl *
ACE_Proactor::create_asynch_write_file_result
(ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -816,6 +966,7 @@ ACE_Proactor::create_asynch_write_file_result
priority,
signal_number);
}
+
ACE_Asynch_Read_Dgram_Result_Impl *
ACE_Proactor::create_asynch_read_dgram_result
(ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -841,6 +992,7 @@ ACE_Proactor::create_asynch_read_dgram_result
priority,
signal_number);
}
+
ACE_Asynch_Write_Dgram_Result_Impl *
ACE_Proactor::create_asynch_write_dgram_result
(ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -864,6 +1016,7 @@ ACE_Proactor::create_asynch_write_dgram_result
priority,
signal_number);
}
+
ACE_Asynch_Accept_Result_Impl *
ACE_Proactor::create_asynch_accept_result
(ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -887,6 +1040,7 @@ ACE_Proactor::create_asynch_accept_result
priority,
signal_number);
}
+
ACE_Asynch_Connect_Result_Impl *
ACE_Proactor::create_asynch_connect_result
(ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -904,6 +1058,7 @@ ACE_Proactor::create_asynch_connect_result
priority,
signal_number);
}
+
ACE_Asynch_Transmit_File_Result_Impl *
ACE_Proactor::create_asynch_transmit_file_result
(ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -935,6 +1090,7 @@ ACE_Proactor::create_asynch_transmit_file_result
priority,
signal_number);
}
+
ACE_Asynch_Result_Impl *
ACE_Proactor::create_asynch_timer
(ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -952,56 +1108,70 @@ ACE_Proactor::create_asynch_timer
priority,
signal_number);
}
+
int
ACE_Proactor::proactor_post_wakeup_completions (int how_many)
{
return this->implementation ()->post_wakeup_completions (how_many);
}
+
void
ACE_Proactor::implementation (ACE_Proactor_Impl *implementation)
{
this->implementation_ = implementation;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#else /* !ACE_WIN32 || !ACE_HAS_AIO_CALLS */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_Proactor *
ACE_Proactor::instance (size_t /* threads */)
{
return 0;
}
+
ACE_Proactor *
ACE_Proactor::instance (ACE_Proactor *)
{
return 0;
}
+
void
ACE_Proactor::close_singleton (void)
{
}
+
int
ACE_Proactor::run_event_loop (void)
{
// not implemented
return -1;
}
+
int
ACE_Proactor::run_event_loop (ACE_Time_Value &)
{
// not implemented
return -1;
}
+
int
ACE_Proactor::end_event_loop (void)
{
// not implemented
return -1;
}
+
sig_atomic_t
ACE_Proactor::event_loop_done (void)
{
return sig_atomic_t (1);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */
diff --git a/dep/ACE_wrappers/ace/Proactor.h b/dep/ACE_wrappers/ace/Proactor.h
index e0d571ee4b9..04e4aac19a5 100644
--- a/dep/ACE_wrappers/ace/Proactor.h
+++ b/dep/ACE_wrappers/ace/Proactor.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Proactor.h
@@ -11,17 +12,23 @@
* @author Alexander Libman <alibman@ihug.com.au>
*/
//=============================================================================
+
#ifndef ACE_PROACTOR_H
#define ACE_PROACTOR_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
#pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS)
// This only works on Win32 platforms and on Unix platforms supporting
// POSIX aio calls.
+
# include "ace/Asynch_IO.h"
# include "ace/Asynch_IO_Impl.h"
# include "ace/Thread_Manager.h"
@@ -29,10 +36,13 @@
# include "ace/Timer_List.h"
# include "ace/Timer_Heap.h"
# include "ace/Timer_Wheel.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward declarations.
class ACE_Proactor_Impl;
class ACE_Proactor_Timer_Handler;
+
/**
* @class ACE_Proactor_Handle_Timeout_Upcall
*
@@ -43,20 +53,25 @@ class ACE_Proactor_Timer_Handler;
*/
class ACE_Proactor_Handle_Timeout_Upcall
{
+
/// Type def for the timer queue.
typedef ACE_Timer_Queue_T<ACE_Handler *,
ACE_Proactor_Handle_Timeout_Upcall,
ACE_SYNCH_RECURSIVE_MUTEX>
TIMER_QUEUE;
+
/// The main Proactor class has special permissions.
friend class ACE_Proactor;
+
public:
/// Constructor.
ACE_Proactor_Handle_Timeout_Upcall (void);
+
/// This method is called when a timer is registered.
int registration (TIMER_QUEUE &timer_queue,
ACE_Handler *handler,
const void *arg);
+
/// This method is called before the timer expires.
int preinvoke (TIMER_QUEUE &timer_queue,
ACE_Handler *handler,
@@ -64,12 +79,14 @@ public:
int recurring_timer,
const ACE_Time_Value &cur_time,
const void *&upcall_act);
+
/// This method is called when the timer expires.
int timeout (TIMER_QUEUE &timer_queue,
ACE_Handler *handler,
const void *arg,
int recurring_timer,
const ACE_Time_Value &cur_time);
+
/// This method is called after the timer expires.
int postinvoke (TIMER_QUEUE &timer_queue,
ACE_Handler *handler,
@@ -77,28 +94,34 @@ public:
int recurring_timer,
const ACE_Time_Value &cur_time,
const void *upcall_act);
+
/// This method is called when a handler is canceled.
int cancel_type (TIMER_QUEUE &timer_queue,
ACE_Handler *handler,
int dont_call_handle_close,
int &requires_reference_counting);
+
/// This method is called when a timer is canceled.
int cancel_timer (TIMER_QUEUE &timer_queue,
ACE_Handler *handler,
int dont_call_handle_close,
int requires_reference_counting);
+
/// This method is called when the timer queue is destroyed and the
/// timer is still contained in it.
int deletion (TIMER_QUEUE &timer_queue,
ACE_Handler *handler,
const void *arg);
+
protected:
/// Set the proactor. This will fail, if one is already set!
int proactor (ACE_Proactor &proactor);
+
/// Handle to the proactor. This is needed for posting a timer result
/// to the Proactor's completion queue.
ACE_Proactor *proactor_;
};
+
/**
* @class ACE_Proactor
*
@@ -111,6 +134,7 @@ protected:
class ACE_Export ACE_Proactor
{
// = Here are the private typedefs that the ACE_Proactor uses.
+
typedef ACE_Timer_Queue_Iterator_T<ACE_Handler *,
ACE_Proactor_Handle_Timeout_Upcall,
ACE_SYNCH_RECURSIVE_MUTEX>
@@ -139,16 +163,20 @@ class ACE_Export ACE_Proactor
ACE_Proactor_Handle_Timeout_Upcall,
ACE_SYNCH_RECURSIVE_MUTEX>
TIMER_WHEEL_ITERATOR;
+
// = Friendship.
+
/// Timer handler runs a thread and manages the timers, on behalf of
/// the Proactor.
friend class ACE_Proactor_Timer_Handler;
+
public:
/// Public type.
typedef ACE_Timer_Queue_T<ACE_Handler *,
ACE_Proactor_Handle_Timeout_Upcall,
ACE_SYNCH_RECURSIVE_MUTEX>
TIMER_QUEUE;
+
/**
* Constructor. If @a implementation is 0, the correct implementation
* object will be created. @a delete_implementation flag determines
@@ -158,34 +186,45 @@ public:
ACE_Proactor (ACE_Proactor_Impl *implementation = 0,
bool delete_implementation = false,
TIMER_QUEUE *tq = 0);
+
/// Destruction.
~ACE_Proactor (void);
+
/// Get pointer to a process-wide ACE_Proactor. @a threads should
/// be part of another method.
static ACE_Proactor *instance (size_t threads = 0);
+
/// Set pointer to a process-wide ACE_Proactor and return existing
/// pointer.
static ACE_Proactor *instance (ACE_Proactor * proactor,
bool delete_proactor = false);
+
/// Delete the dynamically allocated Singleton.
static void close_singleton (void);
+
/// Cleanup method, used by the ACE_Object_Manager to destroy the
/// singleton.
static void cleanup (void *instance, void *arg);
+
/// Name of dll in which the singleton instance lives.
static const ACE_TCHAR *dll_name (void);
+
/// Name of component--ACE_Proactor in this case.
static const ACE_TCHAR *name (void);
+
// = Proactor event loop management methods.
+
/// Run the event loop until the <ACE_Proactor::handle_events> method
/// returns -1 or the <end_event_loop> method is invoked.
static int run_event_loop (void);
+
/**
* Run the event loop until the <ACE_Proactor::handle_events> method
* returns -1, the <end_event_loop> method is invoked, or the
* ACE_Time_Value expires, in which case 0 is returned.
*/
static int run_event_loop (ACE_Time_Value &tv);
+
/**
* Instruct the <ACE_Proactor::instance> to terminate its event
* loop.
@@ -193,25 +232,30 @@ public:
* completions and end the event loop.
*/
static int end_event_loop (void);
+
/**
* Resets the <ACE_Proactor::end_event_loop_> static so that the
* <run_event_loop> method can be restarted.
*/
static int reset_event_loop (void);
+
/**
* The singleton proactor is used by the ACE_Service_Config.
* Therefore, we must check for the reconfiguration request and
* handle it after handling an event.
*/
static int check_reconfiguration (ACE_Proactor *);
+
/// Report if the <ACE_Proactor::instance> event loop is finished.
static int event_loop_done (void);
+
/// Close the associated @c ACE_Proactor_Impl implementation object.
/**
* If @arg delete_implementation was specified to the @c open() method,
* the implementation object is also deleted.
*/
int close (void);
+
/**
* You can add a hook to various run_event methods and the hook will
* be called after handling every proactor event. If this function
@@ -220,6 +264,7 @@ public:
* (pre-maturely.)
*/
typedef int (*PROACTOR_EVENT_HOOK)(ACE_Proactor *);
+
// These methods work with an instance of a proactor.
/**
* Run the event loop until the
@@ -227,6 +272,7 @@ public:
* method returns -1 or the <end_proactor_event_loop> method is invoked.
*/
int proactor_run_event_loop (PROACTOR_EVENT_HOOK = 0);
+
/**
* Run the event loop until the <ACE_Proactor::handle_events>
* method returns -1, the
@@ -236,22 +282,27 @@ public:
*/
int proactor_run_event_loop (ACE_Time_Value &tv,
PROACTOR_EVENT_HOOK = 0);
+
/**
* Instruct the ACE_Proactor to terminate its event loop
* and notifies the ACE_Proactor so that it can wake up
* and close down gracefully.
*/
int proactor_end_event_loop (void);
+
/// Report if the ACE_Proactor event loop is finished.
int proactor_event_loop_done (void);
+
/// Resets the <ACE_Proactor::end_event_loop_> static so that the
/// <run_event_loop> method can be restarted.
int proactor_reset_event_loop (void);
+
/// This method adds the @a handle to the I/O completion port. This
/// function is a no-op function for Unix systems and returns 0;
int register_handle (ACE_HANDLE handle,
const void *completion_key);
+
// = Timer management.
/**
* Schedule a @a handler that will expire after <time>. If it
@@ -267,21 +318,26 @@ public:
long schedule_timer (ACE_Handler &handler,
const void *act,
const ACE_Time_Value &time);
+
long schedule_repeating_timer (ACE_Handler &handler,
const void *act,
const ACE_Time_Value &interval);
+
// Same as above except @a interval it is used to reschedule the
// @a handler automatically.
+
/// This combines the above two methods into one. Mostly for backward
/// compatibility.
long schedule_timer (ACE_Handler &handler,
const void *act,
const ACE_Time_Value &time,
const ACE_Time_Value &interval);
+
/// Cancel all timers associated with this @a handler. Returns number
/// of timers cancelled.
int cancel_timer (ACE_Handler &handler,
int dont_call_handle_close = 1);
+
/**
* Cancel the single <ACE_Handler> that matches the @a timer_id value
* (which was returned from the <schedule> method). If @a act is
@@ -294,6 +350,7 @@ public:
int cancel_timer (long timer_id,
const void **act = 0,
int dont_call_handle_close = 1);
+
/**
* Dispatch a single set of events, waiting up to a specified time limit
* if necessary.
@@ -305,63 +362,86 @@ public:
* and sets errno accordingly.
*/
int handle_events (ACE_Time_Value &wait_time);
+
/**
* Block indefinitely until at least one event is dispatched.
* @return Returns 1 when a completion is dispatched. On error, returns -1
* and sets errno accordingly.
*/
int handle_events (void);
+
/// Add wakeup dispatch threads (reinit).
int wake_up_dispatch_threads (void);
+
/// Close all dispatch threads.
int close_dispatch_threads (int wait);
+
/// Get number of thread used as a parameter to CreatIoCompletionPort.
size_t number_of_threads (void) const;
+
/// Set number of thread used as a parameter to CreatIoCompletionPort.
void number_of_threads (size_t threads);
+
/// Get timer queue.
TIMER_QUEUE *timer_queue (void) const;
+
/// Set timer queue.
void timer_queue (TIMER_QUEUE *timer_queue);
+
/**
* Get the event handle.
* It is a no-op in POSIX platforms and it returns
* ACE_INVALID_HANDLE.
*/
ACE_HANDLE get_handle (void) const;
+
/// Get the implementation class.
ACE_Proactor_Impl *implementation (void) const;
+
// = Factory methods for the operations
+
// Note that the user does not have to use or know about these
// methods.
+
/// Create the correct implementation class for doing
/// Asynch_Read_Stream.
ACE_Asynch_Read_Stream_Impl *create_asynch_read_stream (void);
+
/// Create the correct implementation class for doing
/// Asynch_Write_Stream.
ACE_Asynch_Write_Stream_Impl *create_asynch_write_stream (void);
+
/// Create the correct implementation class for doing
/// Asynch_Read_File.
ACE_Asynch_Read_File_Impl *create_asynch_read_file (void);
+
/// Create the correct implementation class for doing
/// Asynch_Write_File.
ACE_Asynch_Write_File_Impl *create_asynch_write_file (void);
+
/// Create the correct implementation class for doing Asynch_Accept.
ACE_Asynch_Accept_Impl *create_asynch_accept (void);
+
/// Create the correct implementation class for doing Asynch_Connect.
ACE_Asynch_Connect_Impl *create_asynch_connect (void);
+
/// Create the correct implementation class for doing
/// Asynch_Transmit_File.
ACE_Asynch_Transmit_File_Impl *create_asynch_transmit_file (void);
+
/// Create the correct implementation class for doing
/// Asynch_Read_Dgram.
ACE_Asynch_Read_Dgram_Impl *create_asynch_read_dgram (void);
+
/// Create the correct implementation class for doing
/// Asynch_Write_Dgram.
ACE_Asynch_Write_Dgram_Impl *create_asynch_write_dgram (void);
+
// = Factory methods for the results
+
// Note that the user does not have to use or know about these
// methods unless they want to "fake" results.
+
/// Create the correct implementation class for
/// ACE_Asynch_Read_Stream::Result class.
ACE_Asynch_Read_Stream_Result_Impl *
@@ -373,6 +453,7 @@ public:
ACE_HANDLE event = ACE_INVALID_HANDLE,
int priority = 0,
int signal_number = ACE_SIGRTMIN);
+
/// Create the correct implementation class for
/// ACE_Asynch_Write_Stream::Result.
ACE_Asynch_Write_Stream_Result_Impl *
@@ -384,6 +465,7 @@ public:
ACE_HANDLE event = ACE_INVALID_HANDLE,
int priority = 0,
int signal_number = ACE_SIGRTMIN);
+
/// Create the correct implementation class for
/// ACE_Asynch_Read_File::Result.
ACE_Asynch_Read_File_Result_Impl *
@@ -397,6 +479,7 @@ public:
ACE_HANDLE event = ACE_INVALID_HANDLE,
int priority = 0,
int signal_number = ACE_SIGRTMIN);
+
/// Create the correct implementation class for
/// ACE_Asynch_Write_File::Result.
ACE_Asynch_Write_File_Result_Impl *
@@ -410,6 +493,7 @@ public:
ACE_HANDLE event = ACE_INVALID_HANDLE,
int priority = 0,
int signal_number = ACE_SIGRTMIN);
+
/// Create the correct implementation class for
/// ACE_Asynch_Read_Dgram::Result.
ACE_Asynch_Read_Dgram_Result_Impl *
@@ -423,6 +507,7 @@ public:
ACE_HANDLE event = ACE_INVALID_HANDLE,
int priority = 0,
int signal_number = ACE_SIGRTMIN);
+
/// Create the correct implementation class for
/// ACE_Asynch_Write_Dgram::Result.
ACE_Asynch_Write_Dgram_Result_Impl *
@@ -435,6 +520,7 @@ public:
ACE_HANDLE event = ACE_INVALID_HANDLE,
int priority = 0,
int signal_number = ACE_SIGRTMIN);
+
/// Create the correct implementation class for ACE_Asynch_Accept::Result.
ACE_Asynch_Accept_Result_Impl *
create_asynch_accept_result (ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -446,6 +532,7 @@ public:
ACE_HANDLE event = ACE_INVALID_HANDLE,
int priority = 0,
int signal_number = ACE_SIGRTMIN);
+
/// Create the correct implementation class for ACE_Asynch_Connect::Result
ACE_Asynch_Connect_Result_Impl *
create_asynch_connect_result (ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -454,6 +541,7 @@ public:
ACE_HANDLE event = ACE_INVALID_HANDLE,
int priority = 0,
int signal_number = ACE_SIGRTMIN);
+
/// Create the correct implementation class for
/// ACE_Asynch_Transmit_File::Result.
ACE_Asynch_Transmit_File_Result_Impl *
@@ -470,6 +558,7 @@ public:
ACE_HANDLE event = ACE_INVALID_HANDLE,
int priority = 0,
int signal_number = ACE_SIGRTMIN);
+
/**
* Create a timer result object which can be used with the Timer
* mechanism of the Proactor.
@@ -484,60 +573,83 @@ public:
ACE_HANDLE event = ACE_INVALID_HANDLE,
int priority = 0,
int signal_number = ACE_SIGRTMIN);
+
protected:
+
/**
* Post <how_many> completions to the completion port so that all
* threads can wake up. This is used in conjunction with the
* <run_event_loop>.
*/
static int post_wakeup_completions (int how_many);
+
/**
* Post <how_many> completions to the completion port so that all
* threads can wake up. This is used in conjunction with the
* <proactor_run_event_loop>.
*/
int proactor_post_wakeup_completions (int how_many);
+
/// Set the implementation class.
void implementation (ACE_Proactor_Impl *implementation);
+
/// Delegation/implementation class that all methods will be
/// forwarded to.
ACE_Proactor_Impl *implementation_;
+
/// Flag used to indicate whether we are responsible for cleaning up
/// the implementation instance.
bool delete_implementation_;
+
/// Pointer to a process-wide ACE_Proactor.
static ACE_Proactor *proactor_;
+
/// Must delete the <proactor_> if true.
static bool delete_proactor_;
+
/// Handles timeout events.
ACE_Proactor_Timer_Handler *timer_handler_;
+
/// This will manage the thread in the Timer_Handler.
ACE_Thread_Manager thr_mgr_;
+
/// Timer Queue.
TIMER_QUEUE *timer_queue_;
+
/// Flag on whether to delete the timer queue.
int delete_timer_queue_;
+
/// Terminate the proactor event loop.
sig_atomic_t end_event_loop_;
+
/// Number of threads in the event loop.
sig_atomic_t event_loop_thread_count_;
+
/// Mutex to protect work with lists.
ACE_SYNCH_MUTEX mutex_;
+
private:
/// Deny access since member-wise won't work...
ACE_Proactor (const ACE_Proactor &);
ACE_Proactor &operator= (const ACE_Proactor &);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# if defined (__ACE_INLINE__)
# include "ace/Proactor.inl"
# endif /* __ACE_INLINE__ */
+
#else /* NOT WIN32 or POSIX with AIO features. */
+
# include "ace/os_include/os_stddef.h"
# include "ace/os_include/os_signal.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Time_Value;
+
class ACE_Export ACE_Proactor
{
public:
@@ -547,23 +659,34 @@ public:
~ACE_Proactor (void) {}
int handle_events (void) { return -1; }
int handle_events (ACE_Time_Value &) { return -1; }
+
/// Placeholder to enable compilation on non-Win32 platforms
static ACE_Proactor *instance (size_t threads = 0);
+
/// Placeholder to enable compilation on non-Win32 platforms
static ACE_Proactor *instance (ACE_Proactor *);
+
/// Placeholder to enable compilation on non-Win32 platforms
static void close_singleton (void);
+
/// Placeholder to enable compilation on non-Win32 platforms
static int run_event_loop (void);
+
/// Placeholder to enable compilation on non-Win32 platforms
static int run_event_loop (ACE_Time_Value &tv);
+
/// Placeholder to enable compilation on non-Win32 platforms
static int end_event_loop (void);
+
/// Placeholder to enable compilation on non-Win32 platforms
static sig_atomic_t event_loop_done (void);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_PROACTOR_H */
diff --git a/dep/ACE_wrappers/ace/Proactor.inl b/dep/ACE_wrappers/ace/Proactor.inl
index 2257ae0f8ab..a62e7936e4c 100644
--- a/dep/ACE_wrappers/ace/Proactor.inl
+++ b/dep/ACE_wrappers/ace/Proactor.inl
@@ -1,60 +1,80 @@
// -*- C++ -*-
//
// $Id: Proactor.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE int
ACE_Proactor::run_event_loop (void)
{
ACE_TRACE ("ACE_Proactor::run_event_loop");
ACE_Proactor * const p = ACE_Proactor::instance ();
+
if (p == 0)
return -1;
+
return p->proactor_run_event_loop (ACE_Proactor::check_reconfiguration);
}
+
ACE_INLINE int
ACE_Proactor::run_event_loop (ACE_Time_Value &tv)
{
ACE_TRACE ("ACE_Proactor::run_event_loop (tv)");
ACE_Proactor * const p = ACE_Proactor::instance ();
+
if (p == 0)
return -1;
+
return p->proactor_run_event_loop
(tv, ACE_Proactor::check_reconfiguration);
}
+
ACE_INLINE int
ACE_Proactor::reset_event_loop(void)
{
ACE_TRACE ("ACE_Proactor::reset_event_loop");
ACE_Proactor * const p = ACE_Proactor::instance ();
+
if (p == 0)
return -1;
+
return p->proactor_reset_event_loop ();
}
+
ACE_INLINE int
ACE_Proactor::end_event_loop (void)
{
ACE_TRACE ("ACE_Proactor::end_event_loop");
ACE_Proactor * const p = ACE_Proactor::instance ();
+
if (p == 0)
return -1;
+
return p->proactor_end_event_loop ();
}
+
ACE_INLINE int
ACE_Proactor::event_loop_done (void)
{
ACE_TRACE ("ACE_Proactor::event_loop_done");
ACE_Proactor * const p = ACE_Proactor::instance ();
+
if (p == 0)
return -1;
+
return p->proactor_event_loop_done ();
}
+
ACE_INLINE int
ACE_Proactor::post_wakeup_completions (int how_many)
{
ACE_TRACE ("ACE_Proactor::post_wakeup_completions");
ACE_Proactor * const p = ACE_Proactor::instance ();
+
if (p == 0)
return -1;
+
return p->proactor_post_wakeup_completions (how_many);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Proactor_Impl.cpp b/dep/ACE_wrappers/ace/Proactor_Impl.cpp
index 4792dfa9c75..8a7d9b8e6e0 100644
--- a/dep/ACE_wrappers/ace/Proactor_Impl.cpp
+++ b/dep/ACE_wrappers/ace/Proactor_Impl.cpp
@@ -1,15 +1,22 @@
// $Id: Proactor_Impl.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Proactor_Impl.h"
+
ACE_RCSID (ace,
Proactor_Impl,
"$Id: Proactor_Impl.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS)
// This only works on standard Win32 platforms and on Unix platforms supporting
// aio calls.
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_Proactor_Impl::~ACE_Proactor_Impl (void)
{
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif
diff --git a/dep/ACE_wrappers/ace/Proactor_Impl.h b/dep/ACE_wrappers/ace/Proactor_Impl.h
index f36bd1584e5..dc79c8f57c1 100644
--- a/dep/ACE_wrappers/ace/Proactor_Impl.h
+++ b/dep/ACE_wrappers/ace/Proactor_Impl.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Proactor_Impl.h
@@ -10,17 +11,23 @@
*/
//=============================================================================
+
#ifndef ACE_PROACTOR_IMPL_H
#define ACE_PROACTOR_IMPL_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS)
// This only works on standard Win32 platforms and on Unix platforms supporting
// aio calls.
+
#include "ace/Asynch_IO.h"
#include "ace/Reactor.h"
#include "ace/Countdown_Time.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Proactor_Impl
*
@@ -34,15 +41,19 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
*/
class ACE_Export ACE_Proactor_Impl : public ACE_Event_Handler
{
+
public:
/// Virtual destruction.
virtual ~ACE_Proactor_Impl (void);
+
/// Close the IO completion port.
virtual int close (void) = 0;
+
/// This method adds the @a handle to the I/O completion port. This
/// function is a no-op function for Unix systems.
virtual int register_handle (ACE_HANDLE handle,
const void *completion_key) = 0;
+
/**
* Dispatch a single set of events. If @a wait_time elapses before
* any events occur, return 0. Return 1 on success i.e., when a
@@ -50,6 +61,7 @@ public:
* set accordingly.
*/
virtual int handle_events (ACE_Time_Value &wait_time) = 0;
+
/**
* Block indefinitely until at least one event is dispatched.
* Dispatch a single set of events. If <wait_time> elapses before
@@ -58,46 +70,63 @@ public:
* set accordingly.
*/
virtual int handle_events (void) = 0;
+
/// Add wakeup dispatch threads (reinit).
virtual int wake_up_dispatch_threads (void) = 0;
+
/// Close all dispatch threads.
virtual int close_dispatch_threads (int wait) = 0;
+
/// Get number of thread used as a parameter to CreatIoCompletionPort.
virtual size_t number_of_threads (void) const = 0;
+
/// Set number of thread used as a parameter to CreatIoCompletionPort.
virtual void number_of_threads (size_t threads) = 0;
+
/// Get the event handle.
virtual ACE_HANDLE get_handle (void) const = 0;
+
//
// = Factory methods for the operations
//
// Note that the user does not have to use or know about these
// methods.
+
/// Create the correct implementation class for doing Asynch_Read_Stream.
virtual ACE_Asynch_Read_Stream_Impl *create_asynch_read_stream (void) = 0;
+
/// Create the correct implementation class for doing Asynch_Write_Stream.
virtual ACE_Asynch_Write_Stream_Impl *create_asynch_write_stream (void) = 0;
+
/// Create the correct implementation class for doing Asynch_Read_File.
virtual ACE_Asynch_Read_File_Impl *create_asynch_read_file (void) = 0;
+
/// Create the correct implementation class for doing Asynch_Write_File.
virtual ACE_Asynch_Write_File_Impl *create_asynch_write_file (void) = 0;
+
/// Create the correct implementation class for doing Asynch_Accept.
virtual ACE_Asynch_Accept_Impl *create_asynch_accept (void) = 0;
+
/// Create the correct implementation class for doing Asynch_Connect.
virtual ACE_Asynch_Connect_Impl *create_asynch_connect (void) = 0;
+
/// Create the correct implementation class for doing Asynch_Transmit_File.
virtual ACE_Asynch_Transmit_File_Impl *create_asynch_transmit_file (void) = 0;
+
/// Create the correct implementation class for doing
/// Asynch_Read_Dgram.
virtual ACE_Asynch_Read_Dgram_Impl *create_asynch_read_dgram (void) = 0;
+
/// Create the correct implementation class for doing
/// Asynch_Write_Dgram.
virtual ACE_Asynch_Write_Dgram_Impl *create_asynch_write_dgram (void) = 0;
+
//
// = Factory methods for the results
//
// Note that the user does not have to use or know about these
// methods unless they want to "fake" results.
+
/// Create the correct implementation class for ACE_Asynch_Read_Stream::Result class.
virtual ACE_Asynch_Read_Stream_Result_Impl *
create_asynch_read_stream_result (const ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -108,6 +137,7 @@ public:
ACE_HANDLE event = ACE_INVALID_HANDLE,
int priority = 0,
int signal_number = ACE_SIGRTMIN) = 0;
+
/// Create the correct implementation class for ACE_Asynch_Write_Stream::Result.
virtual ACE_Asynch_Write_Stream_Result_Impl *
create_asynch_write_stream_result (const ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -118,6 +148,7 @@ public:
ACE_HANDLE event = ACE_INVALID_HANDLE,
int priority = 0,
int signal_number = ACE_SIGRTMIN) = 0;
+
/// Create the correct implementation class for ACE_Asynch_Read_File::Result.
virtual ACE_Asynch_Read_File_Result_Impl *
create_asynch_read_file_result (const ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -130,6 +161,7 @@ public:
ACE_HANDLE event = ACE_INVALID_HANDLE,
int priority = 0,
int signal_number = ACE_SIGRTMIN) = 0;
+
/// Create the correct implementation class for ACE_Asynch_Write_File::Result.
virtual ACE_Asynch_Write_File_Result_Impl *
create_asynch_write_file_result (const ACE_Handler::Proxy_Ptr &handler,
@@ -142,6 +174,7 @@ public:
ACE_HANDLE event = ACE_INVALID_HANDLE,
int priority = 0,
int signal_number = ACE_SIGRTMIN) = 0;
+
/// Create the correct implementation class for ACE_Asynch_Read_Dgram::Result.
virtual ACE_Asynch_Read_Dgram_Result_Impl *
create_asynch_read_dgram_result (const ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -154,6 +187,7 @@ public:
ACE_HANDLE event = ACE_INVALID_HANDLE,
int priority = 0,
int signal_number = ACE_SIGRTMIN) = 0;
+
/// Create the correct implementation class for ACE_Asynch_Write_Dgram::Result.
virtual ACE_Asynch_Write_Dgram_Result_Impl *
create_asynch_write_dgram_result (const ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -165,6 +199,7 @@ public:
ACE_HANDLE event = ACE_INVALID_HANDLE,
int priority = 0,
int signal_number = ACE_SIGRTMIN) = 0;
+
/// Create the correct implementation class for ACE_Asynch_Accept::Result.
virtual ACE_Asynch_Accept_Result_Impl *
create_asynch_accept_result (const ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -176,6 +211,7 @@ public:
ACE_HANDLE event = ACE_INVALID_HANDLE,
int priority = 0,
int signal_number = ACE_SIGRTMIN) = 0;
+
/// Create the correct implementation class for ACE_Asynch_Connect::Result.
virtual ACE_Asynch_Connect_Result_Impl *
create_asynch_connect_result (const ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -184,6 +220,7 @@ public:
ACE_HANDLE event = ACE_INVALID_HANDLE,
int priority = 0,
int signal_number = ACE_SIGRTMIN) = 0;
+
/// Create the correct implementation class for ACE_Asynch_Transmit_File::Result.
virtual ACE_Asynch_Transmit_File_Result_Impl *
create_asynch_transmit_file_result (const ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -199,6 +236,7 @@ public:
ACE_HANDLE event = ACE_INVALID_HANDLE,
int priority = 0,
int signal_number = ACE_SIGRTMIN) = 0;
+
/**
* Create the correct implementation object for the Timer
* result. POSIX_SIG_Proactor will create a Timer object with a
@@ -211,6 +249,7 @@ public:
ACE_HANDLE event = ACE_INVALID_HANDLE,
int priority = 0,
int signal_number = 0) = 0;
+
/**
* Post @a how_many completions to the completion port so that all
* threads can wake up. This is used in conjunction with the
@@ -218,7 +257,9 @@ public:
*/
virtual int post_wakeup_completions (int how_many) = 0;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */
#include /**/ "ace/post.h"
#endif /* ACE_PROACTOR_IMPL_H */
diff --git a/dep/ACE_wrappers/ace/Process.cpp b/dep/ACE_wrappers/ace/Process.cpp
index a8e29b02b69..a39a02beb52 100644
--- a/dep/ACE_wrappers/ace/Process.cpp
+++ b/dep/ACE_wrappers/ace/Process.cpp
@@ -1,8 +1,11 @@
// $Id: Process.cpp 82499 2008-08-04 20:01:17Z shuston $
+
#include "ace/Process.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Process.inl"
#endif /* __ACE_INLINE__ */
+
#include "ace/ARGV.h"
#include "ace/Auto_Ptr.h"
#include "ace/Signal.h"
@@ -18,11 +21,14 @@
#include "ace/Countdown_Time.h"
#include "ace/Truncate.h"
#include "ace/Vector_T.h"
+
#if defined (ACE_VXWORKS) && (ACE_VXWORKS > 0x600) && defined (__RTP__)
# include <rtpLib.h>
# include <taskLib.h>
#endif
+
ACE_RCSID (ace, Process, "$Id: Process.cpp 82499 2008-08-04 20:01:17Z shuston $")
+
// This function acts as a signal handler for SIGCHLD. We don't really want
// to do anything with the signal - it's just needed to interrupt a sleep.
// See wait() for more info.
@@ -34,7 +40,9 @@ sigchld_nop (int, siginfo_t *, ucontext_t *)
}
#endif /* ACE_WIN32 */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_Process::ACE_Process (void)
:
#if !defined (ACE_WIN32)
@@ -48,6 +56,7 @@ ACE_Process::ACE_Process (void)
sizeof this->process_info_);
#endif /* ACE_WIN32 */
}
+
ACE_Process::~ACE_Process (void)
{
#if defined (ACE_WIN32)
@@ -59,16 +68,19 @@ ACE_Process::~ACE_Process (void)
// still not closed, get them now.
this->close_dup_handles ();
}
+
int
ACE_Process::prepare (ACE_Process_Options &)
{
return 0;
}
+
pid_t
ACE_Process::spawn (ACE_Process_Options &options)
{
if (this->prepare (options) < 0)
return ACE_INVALID_PID;
+
// Stash the passed/duped handle sets away in this object for later
// closing if needed or requested. At the same time, figure out which
// ones to include in command line options if that's needed below.
@@ -77,6 +89,7 @@ ACE_Process::spawn (ACE_Process_Options &options)
set_p = &this->dup_handles_;
else if (options.passed_handles (this->handles_passed_))
set_p = &this->handles_passed_;
+
// If we are going to end up running a new program (i.e. Win32, or
// NO_EXEC option is set) then get any handles passed in the options,
// and tack them onto the command line with +H <handle> options,
@@ -118,11 +131,13 @@ ACE_Process::spawn (ACE_Process_Options &options)
#endif /* ACE_WIN32 */
}
}
+
#if defined (ACE_HAS_WINCE)
// Note that WinCE does not have process name included in the command line as argv[0]
// like other OS environment. Therefore, it is user's whole responsibility to call
// 'ACE_Process_Options::process_name(const ACE_TCHAR *name)' to set the proper
// process name (the execution file name with path if needed).
+
BOOL fork_result =
ACE_TEXT_CreateProcess (options.process_name(),
options.command_line_buf(),
@@ -134,12 +149,14 @@ ACE_Process::spawn (ACE_Process_Options &options)
options.working_directory(), // must be NULL in CE
options.startup_info(), // must be NULL in CE
&this->process_info_);
+
if (fork_result)
{
parent (this->getpid ());
return this->getpid ();
}
return ACE_INVALID_PID;
+
#elif defined (ACE_WIN32)
void* env_buf = options.env_buf ();
DWORD flags = options.creation_flags ();
@@ -152,6 +169,7 @@ ACE_Process::spawn (ACE_Process_Options &options)
flags |= CREATE_UNICODE_ENVIRONMENT;
}
# endif
+
BOOL fork_result =
ACE_TEXT_CreateProcess (0,
options.command_line_buf (),
@@ -163,20 +181,24 @@ ACE_Process::spawn (ACE_Process_Options &options)
options.working_directory (),
options.startup_info (),
&this->process_info_);
+
# if defined (ACE_HAS_WCHAR) && !defined (ACE_USES_WCHAR)
if (options.use_unicode_environment ())
delete wenv_buf;
# endif
+
if (fork_result)
{
parent (this->getpid ());
return this->getpid ();
}
return ACE_INVALID_PID;
+
#elif defined(ACE_OPENVMS)
if (ACE_BIT_ENABLED (options.creation_flags (),
ACE_Process_Options::NO_EXEC))
ACE_NOTSUP_RETURN (ACE_INVALID_PID);
+
int saved_stdin = ACE_STDIN;
int saved_stdout = ACE_STDOUT;
int saved_stderr = ACE_STDERR;
@@ -199,8 +221,10 @@ ACE_Process::spawn (ACE_Process_Options &options)
if (ACE_OS::dup2 (options.get_stderr (), ACE_STDERR) == -1)
ACE_OS::exit (errno);
}
+
if (options.working_directory () != 0)
ACE_NOTSUP_RETURN (ACE_INVALID_PID);
+
this->child_id_ = vfork();
if (this->child_id_ == 0) {
ACE_OS::execvp (options.process_name (),
@@ -208,6 +232,7 @@ ACE_Process::spawn (ACE_Process_Options &options)
// something went wrong
this->child_id_ = ACE_INVALID_PID;
}
+
// restore STD file descriptors (if necessary)
if (options.get_stdin () != ACE_INVALID_HANDLE) {
if (saved_stdin == -1)
@@ -227,13 +252,16 @@ ACE_Process::spawn (ACE_Process_Options &options)
else
ACE_OS::dup2 (saved_stderr, ACE_STDERR);
}
+
return this->child_id_;
#elif (defined (ACE_VXWORKS) && (ACE_VXWORKS > 0x600)) && defined (__RTP__)
if (ACE_BIT_ENABLED (options.creation_flags (),
ACE_Process_Options::NO_EXEC))
ACE_NOTSUP_RETURN (ACE_INVALID_PID);
+
if (options.working_directory () != 0)
ACE_NOTSUP_RETURN (ACE_INVALID_PID);
+
int saved_stdin = ACE_STDIN;
int saved_stdout = ACE_STDOUT;
int saved_stderr = ACE_STDERR;
@@ -256,6 +284,7 @@ ACE_Process::spawn (ACE_Process_Options &options)
if (ACE_OS::dup2 (options.get_stderr (), ACE_STDERR) == -1)
ACE_OS::exit (errno);
}
+
// Wide-char builds need narrow-char strings for commandline and
// environment variables.
# if defined (ACE_USES_WCHAR)
@@ -267,6 +296,7 @@ ACE_Process::spawn (ACE_Process_Options &options)
procargv[vcount] = 0;
for (i = 0; i < vcount; ++i)
procargv[i] = ACE_Wide_To_Ascii::convert (wargv[i]);
+
char **procenv = 0;
if (options.inherit_environment ())
{
@@ -282,6 +312,7 @@ ACE_Process::spawn (ACE_Process_Options &options)
const char **procargv = const_cast<const char**> (options.command_line_argv ());
const char **procenv = const_cast<const char**> (options.env_argv ());
# endif /* ACE_USES_WCHAR */
+
this->child_id_ = ::rtpSpawn (procargv[0],
procargv,
procenv,
@@ -294,10 +325,12 @@ ACE_Process::spawn (ACE_Process_Options &options)
// something went wrong
this->child_id_ = ACE_INVALID_PID;
}
+
# if defined (ACE_USES_WCHAR)
if (procenv)
delete procenv;
# endif /* ACE_USES_WCHAR */
+
// restore STD file descriptors (if necessary)
if (options.get_stdin () != ACE_INVALID_HANDLE) {
if (saved_stdin == -1)
@@ -317,15 +350,18 @@ ACE_Process::spawn (ACE_Process_Options &options)
else
ACE_OS::dup2 (saved_stderr, ACE_STDERR);
}
+
if (this->child_id_ == ACE_INVALID_PID)
{
errno = my_errno_;
}
+
return this->child_id_;
#else /* ACE_WIN32 */
// Fork the new process.
this->child_id_ = ACE::fork (options.process_name (),
options.avoid_zombies ());
+
if (this->child_id_ == 0)
{
# if !defined (ACE_LACKS_SETPGID)
@@ -347,6 +383,7 @@ ACE_Process::spawn (ACE_Process_Options &options)
#endif
}
# endif /* ACE_LACKS_SETPGID */
+
# if !defined (ACE_LACKS_SETREGID)
if (options.getrgid () != (uid_t) -1
|| options.getegid () != (uid_t) -1)
@@ -363,6 +400,7 @@ ACE_Process::spawn (ACE_Process_Options &options)
#endif
}
# endif /* ACE_LACKS_SETREGID */
+
# if !defined (ACE_LACKS_SETREUID)
// Set user and group id's.
if (options.getruid () != (uid_t) -1
@@ -380,14 +418,17 @@ ACE_Process::spawn (ACE_Process_Options &options)
#endif
}
# endif /* ACE_LACKS_SETREUID */
+
this->child (ACE_OS::getppid ());
}
else if (this->child_id_ != -1)
this->parent (this->child_id_);
+
// If we're not supposed to exec, return the process id.
if (ACE_BIT_ENABLED (options.creation_flags (),
ACE_Process_Options::NO_EXEC))
return this->child_id_;
+
switch (this->child_id_)
{
case -1:
@@ -408,17 +449,21 @@ ACE_Process::spawn (ACE_Process_Options &options)
&& ACE_OS::dup2 (options.get_stderr (),
ACE_STDERR) == -1)
ACE_OS::exit (errno);
+
// close down unneeded descriptors
ACE_OS::close (options.get_stdin ());
ACE_OS::close (options.get_stdout ());
ACE_OS::close (options.get_stderr ());
+
// If we must, set the working directory for the child
// process.
if (options.working_directory () != 0)
ACE_OS::chdir (options.working_directory ());
// Should check for error here!
+
// Child process executes the command.
int result = 0;
+
// Wide-char builds not on Windows need narrow-char strings for
// exec() and environment variables. Don't need to worry about
// releasing any of the converted string memory since this
@@ -426,6 +471,7 @@ ACE_Process::spawn (ACE_Process_Options &options)
# if defined (ACE_USES_WCHAR)
ACE_Wide_To_Ascii n_procname (options.process_name ());
const char *procname = n_procname.char_rep ();
+
wchar_t * const *wargv = options.command_line_argv ();
size_t vcount, i;
for (vcount = 0; wargv[vcount] != 0; ++vcount)
@@ -434,6 +480,7 @@ ACE_Process::spawn (ACE_Process_Options &options)
procargv[vcount] = 0;
for (i = 0; i < vcount; ++i)
procargv[i] = ACE_Wide_To_Ascii::convert (wargv[i]);
+
wargv = options.env_argv ();
for (vcount = 0; wargv[vcount] != 0; ++vcount)
;
@@ -446,6 +493,7 @@ ACE_Process::spawn (ACE_Process_Options &options)
char *const *procargv = options.command_line_argv ();
char *const *procenv = options.env_argv ();
# endif /* ACE_USES_WCHAR */
+
if (options.inherit_environment ())
{
// Add the new environment variables to the environment
@@ -453,6 +501,7 @@ ACE_Process::spawn (ACE_Process_Options &options)
for (size_t i = 0; procenv[i] != 0; i++)
if (ACE_OS::putenv (procenv[i]) != 0)
return ACE_INVALID_PID;
+
// Now the forked process has both inherited variables and
// the user's supplied variables.
result = ACE_OS::execvp (procname, procargv);
@@ -470,6 +519,7 @@ ACE_Process::spawn (ACE_Process_Options &options)
if (result == -1)
{
// If the execv fails, this child needs to exit.
+
// Exit with the errno so that the calling process can
// catch this and figure out what went wrong.
ACE_OS::_exit (errno);
@@ -483,26 +533,31 @@ ACE_Process::spawn (ACE_Process_Options &options)
}
#endif /* ACE_WIN32 */
}
+
void
ACE_Process::parent (pid_t)
{
// nothing to do
}
+
void
ACE_Process::child (pid_t)
{
// nothing to do
}
+
void
ACE_Process::unmanage (void)
{
// nothing to do
}
+
int
ACE_Process::running (void) const
{
#if defined (ACE_WIN32)
DWORD code;
+
BOOL result = ::GetExitCodeProcess (this->gethandle (),
&code);
return result && code == STILL_ACTIVE;
@@ -515,6 +570,7 @@ ACE_Process::running (void) const
|| errno != ESRCH;
#endif /* ACE_WIN32 */
}
+
pid_t
ACE_Process::wait (const ACE_Time_Value &tv,
ACE_exitcode *status)
@@ -549,8 +605,10 @@ ACE_Process::wait (const ACE_Time_Value &tv,
WNOHANG);
if (status != 0)
*status = this->exit_code_;
+
return retv;
}
+
if (tv == ACE_Time_Value::max_time)
# if defined (ACE_VXWORKS)
{
@@ -561,6 +619,7 @@ ACE_Process::wait (const ACE_Time_Value &tv,
# else
return this->wait (status);
# endif
+
pid_t pid = 0;
ACE_Time_Value sleeptm (1); // 1 msec
if (sleeptm > tv) // if sleeptime > waittime
@@ -573,12 +632,15 @@ ACE_Process::wait (const ACE_Time_Value &tv,
WNOHANG);
if (status != 0)
*status = this->exit_code_;
+
if (pid > 0 || pid == ACE_INVALID_PID)
break; // Got a child or an error - all done
+
// pid 0, nothing is ready yet, so wait.
// Do a (very) short sleep (only this thread sleeps).
ACE_OS::sleep (sleeptm);
}
+
return pid;
#else /* !ACE_WIN32 && !ACE_LACKS_UNIX_SIGNALS */
if (tv == ACE_Time_Value::zero)
@@ -589,10 +651,13 @@ ACE_Process::wait (const ACE_Time_Value &tv,
WNOHANG);
if (status != 0)
*status = this->exit_code_;
+
return retv;
}
+
if (tv == ACE_Time_Value::max_time)
return this->wait (status);
+
// Need to wait but limited to specified time.
// Force generation of SIGCHLD, even though we don't want to
// catch it - just need it to interrupt the sleep below.
@@ -602,6 +667,7 @@ ACE_Process::wait (const ACE_Time_Value &tv,
ACE_Sig_Action old_action;
ACE_Sig_Action do_sigchld ((ACE_SignalHandler)sigchld_nop);
do_sigchld.register_action (SIGCHLD, &old_action);
+
pid_t pid;
ACE_Time_Value tmo (tv); // Need one we can change
for (ACE_Countdown_Time time_left (&tmo); ; time_left.update ())
@@ -611,8 +677,10 @@ ACE_Process::wait (const ACE_Time_Value &tv,
WNOHANG);
if (status != 0)
*status = this->exit_code_;
+
if (pid > 0 || pid == ACE_INVALID_PID)
break; // Got a child or an error - all done
+
// pid 0, nothing is ready yet, so wait.
// Do a sleep (only this thread sleeps) til something
// happens. This relies on SIGCHLD interrupting the sleep.
@@ -624,11 +692,14 @@ ACE_Process::wait (const ACE_Time_Value &tv,
pid = 0;
break;
}
+
// Restore the previous SIGCHLD action if it was changed.
old_action.register_action (SIGCHLD);
+
return pid;
#endif /* ACE_WIN32 */
}
+
void
ACE_Process::close_dup_handles (void)
{
@@ -643,6 +714,7 @@ ACE_Process::close_dup_handles (void)
}
return;
}
+
void
ACE_Process::close_passed_handles (void)
{
@@ -657,6 +729,7 @@ ACE_Process::close_passed_handles (void)
}
return;
}
+
#if defined (ACE_WIN32) && \
defined (ACE_HAS_WCHAR) && !defined (ACE_USES_WCHAR) && \
!defined (ACE_HAS_WINCE)
@@ -665,6 +738,7 @@ ACE_Process::convert_env_buffer (const char* env) const
{
// Total starts out at 1 due to the final block nul terminator
size_t total = 1;
+
// Convert each individual character string to the equivalent wide
// character string.
ACE_Vector<wchar_t*> buffer;
@@ -676,8 +750,10 @@ ACE_Process::convert_env_buffer (const char* env) const
{
// Convert the char string to wchar_t
wchar_t* str = ACE_Ascii_To_Wide::convert (env + start);
+
// Add the length of the string plus the nul terminator
total += ACE_OS::strlen (str) + 1;
+
// Save it and set up for the next string
buffer.push_back (str);
start = ++i;
@@ -689,6 +765,7 @@ ACE_Process::convert_env_buffer (const char* env) const
i += ACE_OS::strlen (env + i);
}
}
+
// Copy each string into the buffer leaving a nul terminator between
// each string and adding a second nul terminator at the end
start = 0;
@@ -704,6 +781,7 @@ ACE_Process::convert_env_buffer (const char* env) const
return wenv;
}
#endif
+
ACE_Process_Options::ACE_Process_Options (bool inherit_environment,
int command_line_buf_len,
int env_buf_len,
@@ -747,6 +825,7 @@ ACE_Process_Options::ACE_Process_Options (bool inherit_environment,
ACE_NEW (command_line_buf_,
ACE_TCHAR[command_line_buf_len]);
command_line_buf_[0] = '\0';
+
#if !defined (ACE_HAS_WINCE)
working_directory_[0] = '\0';
ACE_NEW (environment_buf_,
@@ -764,6 +843,7 @@ ACE_Process_Options::ACE_Process_Options (bool inherit_environment,
#endif /* ACE_WIN32 */
#endif /* !ACE_HAS_WINCE */
}
+
#if !defined (ACE_HAS_WINCE)
#if defined (ACE_WIN32)
void
@@ -773,6 +853,7 @@ ACE_Process_Options::inherit_environment (void)
if (environment_inherited_)
return;
environment_inherited_ = 1;
+
// Get the existing environment.
ACE_TCHAR *existing_environment = 0;
#if defined (ACE_HAS_WCHAR) && !defined (ACE_USES_WCHAR)
@@ -796,10 +877,13 @@ ACE_Process_Options::inherit_environment (void)
else
#endif
existing_environment = ACE_OS::getenvstrings ();
+
size_t slot = 0;
+
while (existing_environment[slot] != '\0')
{
size_t len = ACE_OS::strlen (existing_environment + slot);
+
// Add the string to our env buffer.
if (this->setenv_i (existing_environment + slot, len) == -1)
{
@@ -808,9 +892,11 @@ ACE_Process_Options::inherit_environment (void)
ACE_TEXT ("ACE_Process_Options::ACE_Process_Options")));
break;
}
+
// Skip to the next word.
slot += len + 1;
}
+
#if defined (ACE_HAS_WCHAR) && !defined (ACE_USES_WCHAR)
if (this->use_unicode_environment_)
::FreeEnvironmentStringsW (existing_wide_env);
@@ -818,28 +904,35 @@ ACE_Process_Options::inherit_environment (void)
#endif
ACE_TEXT_FreeEnvironmentStrings (existing_environment);
}
+
#else /* defined ACE_WIN32 */
+
ACE_TCHAR * const *
ACE_Process_Options::env_argv (void)
{
return environment_argv_;
}
+
#endif /* ACE_WIN32 */
+
void
ACE_Process_Options::enable_unicode_environment (void)
{
this->use_unicode_environment_ = true;
}
+
void
ACE_Process_Options::disable_unicode_environment (void)
{
this->use_unicode_environment_ = false;
}
+
bool
ACE_Process_Options::use_unicode_environment (void) const
{
return this->use_unicode_environment_;
}
+
int
ACE_Process_Options::setenv (ACE_TCHAR *envp[])
{
@@ -851,35 +944,44 @@ ACE_Process_Options::setenv (ACE_TCHAR *envp[])
return -1;
i++;
}
+
#if defined (ACE_WIN32)
if (inherit_environment_)
this->inherit_environment ();
#endif /* ACE_WIN32 */
+
return 0;
}
+
int
ACE_Process_Options::setenv (const ACE_TCHAR *format, ...)
{
ACE_TCHAR stack_buf[DEFAULT_COMMAND_LINE_BUF_LEN];
+
// Start varargs.
va_list argp;
va_start (argp, format);
+
// Add the rest of the varargs.
ACE_OS::vsprintf (stack_buf,
format,
argp);
// End varargs.
va_end (argp);
+
// Append the string to are environment buffer.
if (this->setenv_i (stack_buf,
ACE_OS::strlen (stack_buf)) == -1)
return -1;
+
#if defined (ACE_WIN32)
if (inherit_environment_)
this->inherit_environment ();
#endif /* ACE_WIN32 */
+
return 0;
}
+
int
ACE_Process_Options::setenv (const ACE_TCHAR *variable_name,
const ACE_TCHAR *format, ...)
@@ -890,21 +992,26 @@ ACE_Process_Options::setenv (const ACE_TCHAR *variable_name,
ACE_TCHAR *newformat = 0;
ACE_NEW_RETURN (newformat, ACE_TCHAR[buflen], -1);
ACE_Auto_Basic_Array_Ptr<ACE_TCHAR> safe_newformat (newformat);
+
// Add in the variable name.
ACE_OS::sprintf (safe_newformat.get (),
ACE_TEXT ("%s=%s"),
variable_name,
format);
+
// Start varargs.
va_list argp;
va_start (argp, format);
+
// Add the rest of the varargs.
size_t tmp_buflen = DEFAULT_COMMAND_LINE_BUF_LEN > buflen
? static_cast<size_t> (DEFAULT_COMMAND_LINE_BUF_LEN) : buflen;
int retval = 0;
+
ACE_TCHAR *stack_buf = 0;
ACE_NEW_RETURN (stack_buf, ACE_TCHAR[tmp_buflen], -1);
ACE_Auto_Basic_Array_Ptr<ACE_TCHAR> safe_stack_buf (stack_buf);
+
do
{
retval = ACE_OS::vsnprintf (safe_stack_buf.get (), tmp_buflen, safe_newformat.get (), argp);
@@ -918,6 +1025,7 @@ ACE_Process_Options::setenv (const ACE_TCHAR *variable_name,
break;
}
while (1);
+
if (retval == -1)
{
// In case that vsnprintf is not supported,
@@ -937,43 +1045,54 @@ ACE_Process_Options::setenv (const ACE_TCHAR *variable_name,
// vsnprintf is failed.
return -1;
}
+
// End varargs.
va_end (argp);
+
// Append the string to our environment buffer.
if (this->setenv_i (safe_stack_buf.get (),
ACE_OS::strlen (safe_stack_buf.get ())) == -1)
return -1;
+
#if defined (ACE_WIN32)
if (inherit_environment_)
this->inherit_environment ();
#endif /* ACE_WIN32 */
+
return 0;
}
+
int
ACE_Process_Options::setenv_i (ACE_TCHAR *assignment,
size_t len)
{
// Add one for the null char.
++len;
+
// If environment larger than allocated buffer return. Also check to
// make sure we have enough room.
if (environment_argv_index_ == max_environ_argv_index_
|| (len + environment_buf_index_) >= environment_buf_len_)
return -1;
+
// Copy the new environment string.
ACE_OS::memcpy (environment_buf_ + environment_buf_index_,
assignment,
len * sizeof (ACE_TCHAR));
+
// Update the argv array.
environment_argv_[environment_argv_index_++] =
environment_buf_ + environment_buf_index_;
environment_argv_[environment_argv_index_] = 0;
+
// Update our index.
environment_buf_index_ += len;
+
// Make sure the buffer is null-terminated.
environment_buf_[environment_buf_index_] = '\0';
return 0;
}
+
int
ACE_Process_Options::set_handles (ACE_HANDLE std_in,
ACE_HANDLE std_out,
@@ -981,14 +1100,17 @@ ACE_Process_Options::set_handles (ACE_HANDLE std_in,
{
this->set_handles_called_ = 1;
#if defined (ACE_WIN32)
+
// Tell the new process to use our std handles.
this->startup_info_.dwFlags = STARTF_USESTDHANDLES;
+
if (std_in == ACE_INVALID_HANDLE)
std_in = ACE_STDIN;
if (std_out == ACE_INVALID_HANDLE)
std_out = ACE_STDOUT;
if (std_err == ACE_INVALID_HANDLE)
std_err = ACE_STDERR;
+
if (!::DuplicateHandle (::GetCurrentProcess (),
std_in,
::GetCurrentProcess (),
@@ -997,6 +1119,7 @@ ACE_Process_Options::set_handles (ACE_HANDLE std_in,
TRUE,
DUPLICATE_SAME_ACCESS))
return -1;
+
if (!::DuplicateHandle (::GetCurrentProcess (),
std_out,
::GetCurrentProcess (),
@@ -1005,6 +1128,7 @@ ACE_Process_Options::set_handles (ACE_HANDLE std_in,
TRUE,
DUPLICATE_SAME_ACCESS))
return -1;
+
if (!::DuplicateHandle (::GetCurrentProcess (),
std_err,
::GetCurrentProcess (),
@@ -1018,9 +1142,11 @@ ACE_Process_Options::set_handles (ACE_HANDLE std_in,
this->stdout_ = ACE_OS::dup (std_out);
this->stderr_ = ACE_OS::dup (std_err);
#endif /* ACE_WIN32 */
+
return 0; // Success.
}
+
void
ACE_Process_Options::release_handles ()
{
@@ -1040,6 +1166,7 @@ ACE_Process_Options::release_handles ()
}
#endif /* !ACE_HAS_WINCE */
+
ACE_Process_Options::~ACE_Process_Options (void)
{
#if !defined (ACE_HAS_WINCE)
@@ -1050,11 +1177,13 @@ ACE_Process_Options::~ACE_Process_Options (void)
delete [] command_line_buf_;
ACE::strdelete (command_line_copy_);
}
+
int
ACE_Process_Options::command_line (const ACE_TCHAR *const argv[])
{
// @@ Factor out the code between this
int i = 0;
+
if (argv[i])
{
ACE_OS::strcat (command_line_buf_, argv[i]);
@@ -1066,17 +1195,21 @@ ACE_Process_Options::command_line (const ACE_TCHAR *const argv[])
argv[i]);
}
}
+
command_line_argv_calculated_ = 0;
return 0; // Success.
}
+
int
ACE_Process_Options::command_line (const ACE_TCHAR *format, ...)
{
// Store all ... args in argp.
va_list argp;
va_start (argp, format);
+
if (command_line_buf_len_ < 1)
return -1;
+
#if !defined (ACE_LACKS_VSNPRINTF) || defined (ACE_HAS_TRIO)
// vsnprintf the format and args into command_line_buf__.
ACE_OS::vsnprintf (command_line_buf_,
@@ -1089,11 +1222,14 @@ ACE_Process_Options::command_line (const ACE_TCHAR *format, ...)
format,
argp);
#endif
+
// Useless macro.
va_end (argp);
+
command_line_argv_calculated_ = 0;
return 0;
}
+
#if defined (ACE_HAS_WCHAR) && !defined (ACE_HAS_WINCE)
/**
* @note Not available on Windows CE because it doesn't have a char version of
@@ -1106,22 +1242,29 @@ ACE_Process_Options::command_line (const ACE_ANTI_TCHAR *format, ...)
ACE_NEW_RETURN (anti_clb,
ACE_ANTI_TCHAR[this->command_line_buf_len_],
-1);
+
// Store all ... args in argp.
va_list argp;
va_start (argp, format);
+
// sprintf the format and args into command_line_buf_.
ACE_OS::vsprintf (anti_clb,
format,
argp);
+
// Useless macro.
va_end (argp);
+
ACE_OS::strcpy (this->command_line_buf_,
ACE_TEXT_ANTI_TO_TCHAR (anti_clb));
+
delete [] anti_clb;
+
command_line_argv_calculated_ = 0;
return 0;
}
#endif /* ACE_HAS_WCHAR && !ACE_HAS_WINCE */
+
ACE_TCHAR *
ACE_Process_Options::env_buf (void)
{
@@ -1134,14 +1277,17 @@ ACE_Process_Options::env_buf (void)
return 0;
#endif /* !ACE_HAS_WINCE */
}
+
ACE_TCHAR * const *
ACE_Process_Options::command_line_argv (void)
{
if (command_line_argv_calculated_ == 0)
{
command_line_argv_calculated_ = 1;
+
// We need to free up any previous allocated memory first.
ACE::strdelete (command_line_copy_);
+
// We need to make a dynamically allocated copy here since
// ACE_Tokenizer modifies its arguments.
command_line_copy_ = ACE::strnew (command_line_buf_);
@@ -1151,16 +1297,20 @@ ACE_Process_Options::command_line_argv (void)
parser.delimiter_replace (' ', '\0');
parser.preserve_designators ('\"', '\"'); // "
parser.preserve_designators ('\'', '\'');
+
int x = 0;
do
command_line_argv_[x] = parser.next ();
while (command_line_argv_[x] != 0
// substract one for the ending zero.
&& ++x < MAX_COMMAND_LINE_OPTIONS - 1);
+
command_line_argv_[x] = 0;
}
+
return command_line_argv_;
}
+
// Cause the specified handle to be passed to a child process
// when it's spawned.
int
@@ -1170,6 +1320,7 @@ ACE_Process_Options::pass_handle (ACE_HANDLE h)
# if defined (ACE_HAS_WINCE)
ACE_NOTSUP_RETURN (-1);
# else
+
// This is oriented towards socket handles... may need some adjustment
// for non-sockets.
// This is all based on an MSDN article:
@@ -1197,9 +1348,12 @@ ACE_Process_Options::pass_handle (ACE_HANDLE h)
}
# endif /* ACE_HAS_WINCE */
#endif /* ACE_WIN32 */
+
this->handles_passed_.set_bit (h);
+
return 0;
}
+
// Get a copy of the handles the ACE_Process_Options duplicated
// for the spawned process.
int
@@ -1211,6 +1365,7 @@ ACE_Process_Options::dup_handles (ACE_Handle_Set &set) const
set = this->dup_handles_;
return 1;
}
+
// Get a copy of the handles passed to the spawned process. This
// will be the set of handles previously passed to @arg pass_handle().
int
@@ -1222,13 +1377,16 @@ ACE_Process_Options::passed_handles (ACE_Handle_Set &set) const
set = this->handles_passed_;
return 1;
}
+
ACE_Managed_Process::~ACE_Managed_Process (void)
{
}
+
void
ACE_Managed_Process::unmanage (void)
{
delete this;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Process.h b/dep/ACE_wrappers/ace/Process.h
index 6a89e5825e4..908d3d0cf97 100644
--- a/dep/ACE_wrappers/ace/Process.h
+++ b/dep/ACE_wrappers/ace/Process.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Process.h
@@ -8,19 +9,27 @@
* @author Tim Harrison <harrison@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_PROCESS_H
#define ACE_PROCESS_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Handle_Set.h"
#include "ace/Global_Macros.h"
#include "ace/os_include/sys/os_types.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward declaration
class ACE_Time_Value;
+
/**
* @class ACE_Process_Options
*
@@ -53,6 +62,7 @@ public:
NO_EXEC = 1
#endif /* ACE_WIN32 */
};
+
protected:
// = Default settings not part of public Interface.
//
@@ -64,6 +74,7 @@ protected:
ENVIRONMENT_BUFFER = 16 * 1024, // 16K
MAX_ENVIRONMENT_ARGS = 512 //
};
+
public:
/**
* If @a inherit_environment == true, the new process will inherit the
@@ -74,9 +85,12 @@ public:
int command_line_buf_len = DEFAULT_COMMAND_LINE_BUF_LEN,
int env_buf_len = ENVIRONMENT_BUFFER,
int max_env_args = MAX_ENVIRONMENT_ARGS);
+
/// Destructor.
~ACE_Process_Options (void);
+
// = Methods to set process creation options portably.
+
/**
* Set the standard handles of the new process to the respective
* handles. If you want to affect a subset of the handles, make
@@ -86,12 +100,15 @@ public:
int set_handles (ACE_HANDLE std_in,
ACE_HANDLE std_out = ACE_INVALID_HANDLE,
ACE_HANDLE std_err = ACE_INVALID_HANDLE);
+
/// Release the standard handles previously set with set_handles;
void release_handles (void);
+
/// @param format must be of the form "VARIABLE=VALUE". There can not be
/// any spaces between VARIABLE and the equal sign.
int setenv (const ACE_TCHAR *format,
...);
+
/**
* Set a single environment variable, @a variable_name. Since
* different platforms separate each environment variable
@@ -103,15 +120,19 @@ public:
int setenv (const ACE_TCHAR *variable_name,
const ACE_TCHAR *format,
...);
+
/// Same as above with argv format. @a envp must be null terminated.
int setenv (ACE_TCHAR *envp[]);
+
/// Set the working directory for the process. strlen of @a wd must
/// be <= MAXPATHLEN.
void working_directory (const char *wd);
+
#if defined (ACE_HAS_WCHAR)
/// wchar_t version of working_directory
void working_directory (const wchar_t *wd);
#endif /* ACE_HAS_WCHAR */
+
/**
* Set the command-line arguments. @a format can use any printf
* formats. The first token in @a format should be the path to the
@@ -122,12 +143,15 @@ public:
* on success, -1 on failure.
*/
int command_line (const ACE_TCHAR *format, ...);
+
#if defined (ACE_HAS_WCHAR) && !defined (ACE_HAS_WINCE)
/// Anti-TChar version of command_line ()
int command_line (const ACE_ANTI_TCHAR *format, ...);
#endif /* ACE_HAS_WCHAR && !ACE_HAS_WINCE */
+
/// Same as above in argv format. @a argv must be null terminated.
int command_line (const ACE_TCHAR * const argv[]);
+
/**
* Specify the full path or relative path, or just the executable
* name for the process. If this is set, then @a name will be used to
@@ -136,11 +160,14 @@ public:
* executable name as argv[0].
*/
void process_name (const ACE_TCHAR *name);
+
/// Return the process_name. If the <process_name(name)> set
/// method is not called, this method will return argv[0].
const ACE_TCHAR *process_name (void);
+
/// Get the creation flags.
u_long creation_flags (void) const;
+
/**
* Set the creation flags to affect how a new process is spawned.
* The only ACE-defined flag is @c NO_EXEC which prevents the new process
@@ -153,8 +180,10 @@ public:
* system call as the value of the @c dwCreationFlags parameter.
*/
void creation_flags (u_long);
+
/// Current working directory. Returns "" if nothing has been set.
ACE_TCHAR *working_directory (void);
+
/// Buffer of command-line options. Returns a pointer to a buffer that
/// contains the list of command line options. Prior to a call to
/// command_line_argv(), this is a single string of space separated
@@ -166,6 +195,7 @@ public:
/// providing max_len. @arg max_len, if non-zero, provides a location
/// into which the total length of the command line buffer is returned.
ACE_TCHAR *command_line_buf (int *max_len = 0);
+
/**
* argv-style command-line options. Parses and modifies the string
* created from <command_line_>. All spaces not in quotes ("" or
@@ -174,21 +204,26 @@ public:
* null-terminated string. Returns { 0 } if nothing has been set.
*/
ACE_TCHAR * const *command_line_argv (void);
+
/**
* Null-terminated buffer of null terminated strings. Each string
* is an environment assignment "VARIABLE=value". This buffer
* should end with two null characters.
*/
ACE_TCHAR *env_buf (void);
+
/// Get the process group. On UNIX, these methods are used by the
/// ACE_Process_Manager to manage groups of processes.
pid_t getgroup (void) const;
+
/// Set the process group. On UNIX, these methods are used by the
/// ACE_Process_Manager to manage groups of processes.
pid_t setgroup (pid_t pgrp);
+
/// Allows disabling of handle inheritence, default is TRUE.
int handle_inheritence (void);
void handle_inheritence (int);
+
/// Cause the specified handle to be passed to a child process
/// when it runs a new program image.
/**
@@ -200,6 +235,7 @@ public:
* @return 0 if success, -1 if failure.
*/
int pass_handle (ACE_HANDLE);
+
/// Get a copy of the handles the ACE_Process_Options duplicated
/// for the spawned process.
/**
@@ -208,6 +244,7 @@ public:
* @return 0 if there were no handles to return; 1 if there were.
*/
int dup_handles (ACE_Handle_Set &set) const;
+
/// Get a copy of the handles passed to the spawned process. This
/// will be the set of handles previously passed to @arg pass_handle().
/**
@@ -216,40 +253,55 @@ public:
* @return 0 if there were no handles to return; 1 if there were.
*/
int passed_handles (ACE_Handle_Set &set) const;
+
/// Set value for avoid_zombies (has no real effect except on *nix).
void avoid_zombies (int);
+
/// Get current value for avoid_zombies.
int avoid_zombies (void);
+
/// Enable the use of a Unicode environment. This only makes sense
/// for Win32 when ACE_USES_WCHAR is not defined.
void enable_unicode_environment (void);
+
/// Disable the use of a Unicode environment.
void disable_unicode_environment (void);
+
/// Return the unicode environment status
bool use_unicode_environment (void) const;
+
#if defined (ACE_WIN32)
// = Non-portable accessors for when you "just have to use them."
+
/// Used for setting and getting.
ACE_TEXT_STARTUPINFO *startup_info (void);
+
/// Get the process_attributes. Returns NULL if
/// set_process_attributes has not been set.
LPSECURITY_ATTRIBUTES get_process_attributes (void) const;
+
/// If this is called, a non-null process attributes is sent to
/// CreateProcess.
LPSECURITY_ATTRIBUTES set_process_attributes (void);
+
/// Get the thread_attributes. Returns NULL if set_thread_attributes
/// has not been set.
LPSECURITY_ATTRIBUTES get_thread_attributes (void) const;
+
/// If this is called, a non-null thread attributes is sent to
/// CreateProcess.
LPSECURITY_ATTRIBUTES set_thread_attributes (void);
+
#else /* All things not WIN32 */
+
/// argv-style array of environment settings.
ACE_TCHAR *const *env_argv (void);
+
// = Accessors for the standard handles.
ACE_HANDLE get_stdin (void) const;
ACE_HANDLE get_stdout (void) const;
ACE_HANDLE get_stderr (void) const;
+
// = Set/get real & effective user & group id associated with user.
int setreugid (const ACE_TCHAR* user);
void setruid (uid_t id);
@@ -260,49 +312,65 @@ public:
uid_t geteuid (void) const;
uid_t getrgid (void) const;
uid_t getegid (void) const;
+
/**
* Get the inherit_environment flag.
*/
bool inherit_environment (void) const;
+
/**
* Set the inherit_environment flag.
*/
void inherit_environment (bool nv);
#endif /* ACE_WIN32 */
protected:
+
#if !defined (ACE_HAS_WINCE)
/// Add @a assignment to environment_buf_ and adjust
/// environment_argv_. @a len is the strlen of @a assignment.
int setenv_i (ACE_TCHAR *assignment, size_t len);
+
/// Whether the child process inherits the current process
/// environment.
bool inherit_environment_;
#endif /* !ACE_HAS_WINCE */
+
/// Default 0.
u_long creation_flags_;
+
/// Avoid zombies for spawned processes.
int avoid_zombies_;
+
#if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)
/// Helper function to grab win32 environment and stick it in
/// environment_buf_ using this->setenv_i.
void inherit_environment (void);
+
/// Ensures once only call to inherit environment.
int environment_inherited_;
+
ACE_TEXT_STARTUPINFO startup_info_;
+
/// Default TRUE.
BOOL handle_inheritence_;
+
/// Pointer to security_buf1_.
LPSECURITY_ATTRIBUTES process_attributes_;
+
/// Pointer to security_buf2_.
LPSECURITY_ATTRIBUTES thread_attributes_;
+
/// Data for process_attributes_.
SECURITY_ATTRIBUTES security_buf1_;
+
/// Data for thread_attributes_.
SECURITY_ATTRIBUTES security_buf2_;
+
#else /* !ACE_WIN32 */
ACE_HANDLE stdin_;
ACE_HANDLE stdout_;
ACE_HANDLE stderr_;
+
// = Real & effective user & group id's.
// These should be set to -1 to leave unchanged (default).
uid_t ruid_;
@@ -310,51 +378,72 @@ protected:
uid_t rgid_;
uid_t egid_;
#endif /* ACE_WIN32 */
+
#if !defined (ACE_HAS_WINCE)
/// Is 1 if stdhandles was called.
int set_handles_called_;
+
/// Pointer into environment_buf_. This should point to the next
/// free spot.
size_t environment_buf_index_;
+
/// Pointer to environment_argv_.
int environment_argv_index_;
+
/// Pointer to buffer of the environment settings.
ACE_TCHAR *environment_buf_;
+
/// Size of the environment buffer. Configurable
size_t environment_buf_len_;
+
/// Pointers into environment_buf_.
ACE_TCHAR **environment_argv_;
+
/// Maximum number of environment variables. Configurable
int max_environment_args_;
+
/// Maximum index of environment_argv_ buffer
int max_environ_argv_index_;
+
/// The current working directory.
ACE_TCHAR working_directory_[MAXPATHLEN + 1];
#endif /* !ACE_HAS_WINCE */
+
/// Ensures command_line_argv is only calculated once.
int command_line_argv_calculated_;
+
/// Pointer to buffer of command-line arguments. E.g., "-f foo -b bar".
ACE_TCHAR *command_line_buf_;
+
/// Pointer to copy of command-line arguments, which is needed when
/// converting a command-line string into a command-line argv.
ACE_TCHAR *command_line_copy_;
+
/// Max length of command_line_buf_
int command_line_buf_len_;
+
/// Argv-style command-line arguments.
ACE_TCHAR *command_line_argv_[MAX_COMMAND_LINE_OPTIONS];
+
/// Process-group on Unix; unused on Win32.
pid_t process_group_;
+
/// Set of handles that were passed in pass_handle ().
ACE_Handle_Set handles_passed_;
+
/// Results of duplicating handles passed in pass_handle ().
ACE_Handle_Set dup_handles_;
+
/// Pathname for the process. Relative path or absolute path or just
/// the program name.
ACE_TCHAR process_name_[MAXPATHLEN + 1];
+
/// Indicate if a Unicode environment should be used
bool use_unicode_environment_;
};
+
//class ACE_Process_Manager;
+
/**
* @class ACE_Process
*
@@ -372,16 +461,20 @@ class ACE_Export ACE_Process
{
public:
friend class ACE_Process_Manager;
+
/// Default construction. Must use <ACE_Process::spawn> to start.
ACE_Process (void);
+
/// Destructor.
virtual ~ACE_Process (void);
+
/**
* Called just before <ACE_OS::fork> in the <spawn>. If this
* returns non-zero, the <spawn> is aborted (and returns
* ACE_INVALID_PID). The default simply returns zero.
*/
virtual int prepare (ACE_Process_Options &options);
+
/**
* Launch a new process as described by @a options. On success,
* returns 1 if the option avoid_zombies is set, else returns the
@@ -390,18 +483,22 @@ public:
* the process id of the child will be returned regardless of the option.
*/
virtual pid_t spawn (ACE_Process_Options &options);
+
/// Called just after <ACE_OS::fork> in the parent's context, if the
/// <fork> succeeds. The default is to do nothing.
virtual void parent (pid_t child);
+
/**
* Called just after <ACE_OS::fork> in the child's context. The
* default does nothing. This function is *not* called on Win32
* because the process-creation scheme does not allow it.
*/
virtual void child (pid_t parent);
+
/// Called by a <Process_Manager> that is removing this Process from
/// its table of managed Processes. Default is to do nothing.
virtual void unmanage (void);
+
/**
* Wait for the process we've created to exit. If <status> != 0, it
* points to an integer where the function store the exit status of
@@ -412,6 +509,7 @@ public:
*/
pid_t wait (ACE_exitcode *status = 0,
int wait_options = 0);
+
/**
* Timed wait for the process we've created to exit. A return value
* of -1 indicates that the something failed; 0 indicates that a
@@ -427,48 +525,62 @@ public:
*/
pid_t wait (const ACE_Time_Value &tv,
ACE_exitcode *status = 0);
+
/// Send the process a signal. This is only portable to operating
/// systems that support signals, such as UNIX/POSIX.
int kill (int signum = SIGINT);
+
/**
* Terminate the process abruptly using <ACE::terminate_process>.
* This call doesn't give the process a chance to cleanup, so use it
* with caution...
*/
int terminate (void);
+
/// Return the process id of the new child process.
pid_t getpid (void) const;
+
/// Return the handle of the process, if it has one.
ACE_HANDLE gethandle (void) const;
+
/// Return 1 if running; 0 otherwise.
int running (void) const;
+
/// Return the Process' exit code. This method returns the raw
/// exit status returned from system APIs (such as <wait> or
/// <waitpid>). This value is system dependent.
ACE_exitcode exit_code (void) const;
+
/// Return the Process' return value. This method returns the
/// actual return value that a child process returns or <exit>s.
int return_value (void) const;
+
/// Close all the handles in the set obtained from the
/// @arg ACE_Process_Options::dup_handles object used to spawn
/// the process.
void close_dup_handles (void);
+
/// Close all the handles in the set obtained from the
/// @arg ACE_Process_Options::passed_handles object used to spawn
/// the process.
void close_passed_handles (void);
+
#if defined (ACE_WIN32)
PROCESS_INFORMATION process_info (void);
#endif /* ACE_WIN32 */
+
private:
+
// Disallow copying and assignment since we don't support this (yet).
ACE_Process (const ACE_Process &);
void operator= (const ACE_Process &);
+
protected:
/// Set this process' <exit_code_>. ACE_Process_Manager uses this
/// method to set the <exit_code_> after successfully waiting for
/// this process to exit.
void exit_code (ACE_exitcode code);
+
#if defined (ACE_WIN32)
PROCESS_INFORMATION process_info_;
#else /* ACE_WIN32 */
@@ -476,10 +588,12 @@ protected:
pid_t child_id_;
#endif /* ACE_WIN32 */
ACE_exitcode exit_code_;
+
/// Set of handles that were passed to the child process.
ACE_Handle_Set handles_passed_;
/// Handle duplicates made for the child process.
ACE_Handle_Set dup_handles_;
+
private:
#if defined (ACE_WIN32) && \
defined (ACE_HAS_WCHAR) && !defined (ACE_USES_WCHAR) && \
@@ -488,6 +602,7 @@ private:
#endif
};
+
/**
* @class ACE_Managed_Process
*
@@ -500,16 +615,22 @@ private:
class ACE_Export ACE_Managed_Process : public ACE_Process
{
public:
+
/// Cleanup by deleting @c this.
virtual void unmanage (void);
+
protected:
+
/// Make sure that we're allocated dynamically!
virtual ~ACE_Managed_Process (void);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Process.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_PROCESS_H */
diff --git a/dep/ACE_wrappers/ace/Process.inl b/dep/ACE_wrappers/ace/Process.inl
index 648f47ecfa2..9723ebc8c44 100644
--- a/dep/ACE_wrappers/ace/Process.inl
+++ b/dep/ACE_wrappers/ace/Process.inl
@@ -1,19 +1,24 @@
// -*- C++ -*-
//
// $Id: Process.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/ACE.h"
#include "ace/OS_NS_sys_wait.h"
#include "ace/OS_NS_signal.h"
#include "ace/OS_NS_pwd.h"
#include "ace/OS_NS_string.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_WIN32)
+
ACE_INLINE PROCESS_INFORMATION
ACE_Process::process_info (void)
{
return process_info_;
}
#endif /* ACE_WIN32 */
+
ACE_INLINE ACE_HANDLE
ACE_Process::gethandle (void) const
{
@@ -23,6 +28,7 @@ ACE_Process::gethandle (void) const
return ACE_HANDLE (child_id_);
#endif /* ACE_WIN32 */
}
+
ACE_INLINE pid_t
ACE_Process::getpid (void)
const
@@ -33,6 +39,7 @@ ACE_Process::getpid (void)
return child_id_;
#endif /* ACE_WIN32 */
}
+
ACE_INLINE pid_t
ACE_Process::wait (ACE_exitcode *status,
int wait_options)
@@ -47,8 +54,10 @@ ACE_Process::wait (ACE_exitcode *status,
);
if (status != 0)
*status = this->exit_code_;
+
return retv;
}
+
ACE_INLINE int
ACE_Process::kill (int signum)
{
@@ -57,6 +66,7 @@ ACE_Process::kill (int signum)
else
return -1;
}
+
ACE_INLINE int
ACE_Process::terminate (void)
{
@@ -65,6 +75,7 @@ ACE_Process::terminate (void)
else
return -1;
}
+
ACE_INLINE int
ACE_Process::return_value (void) const
{
@@ -74,16 +85,19 @@ ACE_Process::return_value (void) const
return WEXITSTATUS (this->exit_code_);
#endif /* ACE_WIN32 */
}
+
ACE_INLINE ACE_exitcode
ACE_Process::exit_code (void) const
{
return this->exit_code_;
}
+
ACE_INLINE void
ACE_Process::exit_code (ACE_exitcode code)
{
this->exit_code_ = code;
}
+
ACE_INLINE u_long
ACE_Process_Options::creation_flags (void) const
{
@@ -93,16 +107,19 @@ ACE_Process_Options::creation_flags (void) const
return creation_flags_;
#endif /* ACE_USES_WCHAR */
}
+
ACE_INLINE void
ACE_Process_Options::creation_flags (u_long cf)
{
creation_flags_ = cf;
}
+
ACE_INLINE pid_t
ACE_Process_Options::getgroup (void) const
{
return process_group_;
}
+
ACE_INLINE pid_t
ACE_Process_Options::setgroup (pid_t pgrp)
{
@@ -110,6 +127,7 @@ ACE_Process_Options::setgroup (pid_t pgrp)
process_group_ = pgrp;
return old;
}
+
ACE_INLINE int
ACE_Process_Options::handle_inheritence (void)
{
@@ -119,6 +137,7 @@ ACE_Process_Options::handle_inheritence (void)
ACE_NOTSUP_RETURN (0); // This is a benign error.
#endif /* ACE_WIN32 && ! ACE_HAS_WINCE */
}
+
ACE_INLINE void
ACE_Process_Options::handle_inheritence (int hi)
{
@@ -129,6 +148,7 @@ ACE_Process_Options::handle_inheritence (int hi)
ACE_NOTSUP;
#endif /* !ACE_HAS_WINCE */
}
+
ACE_INLINE int
ACE_Process_Options::avoid_zombies (void)
{
@@ -139,7 +159,9 @@ ACE_Process_Options::avoid_zombies (int avoid_zombies)
{
avoid_zombies_ = avoid_zombies;
}
+
#if defined (ACE_WIN32)
+
ACE_INLINE ACE_TEXT_STARTUPINFO *
ACE_Process_Options::startup_info (void)
{
@@ -149,6 +171,7 @@ ACE_Process_Options::startup_info (void)
return 0;
#endif /* !ACE_HAS_WINCE */
}
+
ACE_INLINE LPSECURITY_ATTRIBUTES
ACE_Process_Options::get_process_attributes (void) const
{
@@ -158,6 +181,7 @@ ACE_Process_Options::get_process_attributes (void) const
return 0;
#endif /* !ACE_HAS_WINCE */
}
+
ACE_INLINE LPSECURITY_ATTRIBUTES
ACE_Process_Options::set_process_attributes (void)
{
@@ -168,6 +192,7 @@ ACE_Process_Options::set_process_attributes (void)
return 0;
#endif /* !ACE_HAS_WINCE */
}
+
ACE_INLINE LPSECURITY_ATTRIBUTES
ACE_Process_Options::get_thread_attributes (void) const
{
@@ -177,6 +202,7 @@ ACE_Process_Options::get_thread_attributes (void) const
return 0;
#endif /* !ACE_HAS_WINCE */
}
+
ACE_INLINE LPSECURITY_ATTRIBUTES
ACE_Process_Options::set_thread_attributes (void)
{
@@ -187,37 +213,45 @@ ACE_Process_Options::set_thread_attributes (void)
return 0;
#endif /* !ACE_HAS_WINCE */
}
+
#else /* !defined (ACE_WIN32) */
+
ACE_INLINE ACE_HANDLE
ACE_Process_Options::get_stdin (void) const
{
return stdin_;
}
+
ACE_INLINE ACE_HANDLE
ACE_Process_Options::get_stdout (void) const
{
return stdout_;
}
+
ACE_INLINE ACE_HANDLE
ACE_Process_Options::get_stderr (void) const
{
return stderr_;
}
+
ACE_INLINE bool
ACE_Process_Options::inherit_environment (void) const
{
return inherit_environment_;
}
+
ACE_INLINE void
ACE_Process_Options::inherit_environment (bool nv)
{
inherit_environment_ = nv;
}
+
ACE_INLINE int
ACE_Process_Options::setreugid (const ACE_TCHAR* user)
{
#if !defined (ACE_LACKS_PWD_FUNCTIONS)
struct passwd *ent = ACE_OS::getpwnam (ACE_TEXT_ALWAYS_CHAR (user));
+
if (ent != 0)
{
this->euid_ = ent->pw_uid;
@@ -233,47 +267,56 @@ ACE_Process_Options::setreugid (const ACE_TCHAR* user)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_LACKS_PWD_FUNCTIONS */
}
+
ACE_INLINE void
ACE_Process_Options::setruid (uid_t id)
{
this->ruid_ = id;
}
+
ACE_INLINE void
ACE_Process_Options::seteuid (uid_t id)
{
this->euid_ = id;
}
+
ACE_INLINE void
ACE_Process_Options::setrgid (uid_t id)
{
this->rgid_ = id;
}
+
ACE_INLINE void
ACE_Process_Options::setegid (uid_t id)
{
this->egid_ = id;
}
+
ACE_INLINE uid_t
ACE_Process_Options::getruid (void) const
{
return this->ruid_;
}
+
ACE_INLINE uid_t
ACE_Process_Options::geteuid (void) const
{
return this->euid_;
}
+
ACE_INLINE uid_t
ACE_Process_Options::getrgid (void) const
{
return this->rgid_;
}
+
ACE_INLINE uid_t
ACE_Process_Options::getegid (void) const
{
return this->egid_;
}
#endif /* ACE_WIN32 */
+
ACE_INLINE ACE_TCHAR *
ACE_Process_Options::command_line_buf (int *max_lenp)
{
@@ -281,6 +324,7 @@ ACE_Process_Options::command_line_buf (int *max_lenp)
*max_lenp = this->command_line_buf_len_;
return this->command_line_buf_;
}
+
ACE_INLINE ACE_TCHAR *
ACE_Process_Options::working_directory (void)
{
@@ -293,6 +337,7 @@ ACE_Process_Options::working_directory (void)
return 0;
#endif /* !ACE_HAS_WINCE */
}
+
ACE_INLINE void
ACE_Process_Options::working_directory (const char *wd)
{
@@ -302,6 +347,7 @@ ACE_Process_Options::working_directory (const char *wd)
ACE_UNUSED_ARG (wd);
#endif /* !ACE_HAS_WINCE */
}
+
#if defined (ACE_HAS_WCHAR)
ACE_INLINE void
ACE_Process_Options::working_directory (const wchar_t *wd)
@@ -313,31 +359,38 @@ ACE_Process_Options::working_directory (const wchar_t *wd)
#endif /* !ACE_HAS_WINCE */
}
#endif /* ACE_HAS_WCHAR */
+
ACE_INLINE void
ACE_Process_Options::process_name (const ACE_TCHAR *p)
{
ACE_OS::strcpy (this->process_name_, p);
}
+
ACE_INLINE const ACE_TCHAR *
ACE_Process_Options::process_name (void)
{
if (process_name_[0] == '\0')
this->process_name (this->command_line_argv ()[0]);
+
return this->process_name_;
}
+
#if defined (ACE_HAS_WINCE)
// Here is a collection of inline functions which are defined only
// under CE. They are not empty on most other platforms.
+
ACE_INLINE int
ACE_Process_Options::setenv (ACE_TCHAR * /* envp */[])
{
return -1;
}
+
ACE_INLINE int
ACE_Process_Options::setenv (const ACE_TCHAR * /* format */, ...)
{
return -1;
}
+
ACE_INLINE int
ACE_Process_Options::setenv (const ACE_TCHAR * /* variable_name */,
const ACE_TCHAR * /* format */,
@@ -345,6 +398,7 @@ ACE_Process_Options::setenv (const ACE_TCHAR * /* variable_name */,
{
return -1;
}
+
ACE_INLINE int
ACE_Process_Options::set_handles (ACE_HANDLE /* std_in */,
ACE_HANDLE /* std_out */,
@@ -352,5 +406,7 @@ ACE_Process_Options::set_handles (ACE_HANDLE /* std_in */,
{
return -1;
}
+
#endif /* ACE_HAS_WINCE */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Process_Manager.cpp b/dep/ACE_wrappers/ace/Process_Manager.cpp
index a071a38bc18..95c92329a65 100644
--- a/dep/ACE_wrappers/ace/Process_Manager.cpp
+++ b/dep/ACE_wrappers/ace/Process_Manager.cpp
@@ -1,9 +1,12 @@
// $Id: Process_Manager.cpp 82559 2008-08-07 20:23:07Z parsons $
+
// Process_Manager.cpp
#include "ace/Process_Manager.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Process_Manager.inl"
#endif /* __ACE_INLINE__ */
+
#include "ace/ACE.h"
#include "ace/Guard_T.h"
#include "ace/Process.h"
@@ -17,9 +20,11 @@
#include "ace/OS_NS_unistd.h"
#include "ace/OS_NS_sys_time.h"
#include "ace/Truncate.h"
+
ACE_RCSID (ace,
Process_Manager,
"$Id: Process_Manager.cpp 82559 2008-08-07 20:23:07Z parsons $")
+
#if defined (ACE_HAS_SIG_C_FUNC)
extern "C" void
ACE_Process_Manager_cleanup (void *instance, void *arg)
@@ -27,12 +32,15 @@ ACE_Process_Manager_cleanup (void *instance, void *arg)
ACE_Process_Manager::cleanup (instance, arg);
}
#endif
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
void
ACE_Process_Manager::cleanup (void *, void *)
{
ACE_Process_Manager::close_singleton ();
}
+
// This function acts as a signal handler for SIGCHLD. We don't really
// want to do anything with the signal - it's just needed to interrupt
// a sleep. See wait() for more info.
@@ -44,63 +52,82 @@ sigchld_nop (int, siginfo_t *, ucontext_t *)
}
#endif /* ACE_WIN32 */
+
ACE_ALLOC_HOOK_DEFINE(ACE_Process_Manager)
+
// Singleton instance.
ACE_Process_Manager *ACE_Process_Manager::instance_ = 0;
+
// Controls whether the <Process_Manager> is deleted when we shut down
// (we can only delete it safely if we created it!)
bool ACE_Process_Manager::delete_instance_ = false;
+
ACE_Process_Manager::Process_Descriptor::~Process_Descriptor (void)
{
}
+
void
ACE_Process_Manager::Process_Descriptor::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_Process_Manager::Process_Descriptor::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
+
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nproc_id_ = %d"),
this->process_->getpid( )));
+
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
void
ACE_Process_Manager::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_Process_Manager::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
+
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nmax_process_table_size_ = %d"), this->max_process_table_size_));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\ncurrent_count_ = %d"), this->current_count_));
+
for (size_t i = 0; i < this->current_count_; i++)
this->process_table_[i].dump ();
+
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
ACE_Process_Manager::Process_Descriptor::Process_Descriptor (void)
: process_ (0),
exit_notify_ (0)
{
ACE_TRACE ("ACE_Process_Manager::Process_Descriptor::Process_Descriptor");
}
+
ACE_Process_Manager *
ACE_Process_Manager::instance (void)
{
ACE_TRACE ("ACE_Process_Manager::instance");
+
if (ACE_Process_Manager::instance_ == 0)
{
// Perform Double-Checked Locking Optimization.
ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon,
*ACE_Static_Object_Lock::instance (), 0));
+
if (ACE_Process_Manager::instance_ == 0)
{
ACE_NEW_RETURN (ACE_Process_Manager::instance_,
ACE_Process_Manager,
0);
ACE_Process_Manager::delete_instance_ = true;
+
// Register with the Object_Manager so that the wrapper to
// delete the proactor will be called when Object_Manager is
// being terminated.
+
#if defined ACE_HAS_SIG_C_FUNC
ACE_Object_Manager::at_exit (ACE_Process_Manager::instance_,
ACE_Process_Manager_cleanup,
@@ -110,22 +137,28 @@ ACE_Process_Manager::instance (void)
ACE_Process_Manager::cleanup,
0);
#endif /* ACE_HAS_SIG_C_FUNC */
+
}
}
+
return ACE_Process_Manager::instance_;
}
+
ACE_Process_Manager *
ACE_Process_Manager::instance (ACE_Process_Manager *tm)
{
ACE_TRACE ("ACE_Process_Manager::instance");
ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon,
*ACE_Static_Object_Lock::instance (), 0));
+
ACE_Process_Manager *t = ACE_Process_Manager::instance_;
// We can't safely delete it since we don't know who created it!
ACE_Process_Manager::delete_instance_ = false;
+
// Register with the Object_Manager so that the wrapper to
// delete the proactor will be called when Object_Manager is
// being terminated.
+
#if defined ACE_HAS_SIG_C_FUNC
ACE_Object_Manager::at_exit (ACE_Process_Manager::instance_,
ACE_Process_Manager_cleanup,
@@ -135,15 +168,19 @@ ACE_Process_Manager::instance (ACE_Process_Manager *tm)
ACE_Process_Manager::cleanup,
0);
#endif /* ACE_HAS_SIG_C_FUNC */
+
ACE_Process_Manager::instance_ = tm;
return t;
}
+
void
ACE_Process_Manager::close_singleton( void )
{
ACE_TRACE ("ACE_Process_Manager::close_singleton");
+
ACE_MT (ACE_GUARD (ACE_Recursive_Thread_Mutex, ace_mon,
*ACE_Static_Object_Lock::instance ()));
+
if (ACE_Process_Manager::delete_instance_)
{
delete ACE_Process_Manager::instance_;
@@ -151,31 +188,42 @@ ACE_Process_Manager::close_singleton( void )
ACE_Process_Manager::delete_instance_ = false;
}
}
+
int
ACE_Process_Manager::resize (size_t size)
{
ACE_TRACE ("ACE_Process_Manager::resize");
+
if (size <= this->max_process_table_size_)
return 0;
+
Process_Descriptor *temp = 0;
+
ACE_NEW_RETURN (temp,
Process_Descriptor[size],
-1);
+
for (size_t i = 0;
i < this->current_count_;
i++)
// Structure assignment.
temp[i] = this->process_table_[i];
+
this->max_process_table_size_ = size;
+
delete [] this->process_table_;
+
this->process_table_ = temp;
return 0;
}
+
// Create and initialize the table to keep track of the process pool.
+
int
ACE_Process_Manager::open (size_t size, ACE_Reactor *r)
{
ACE_TRACE ("ACE_Process_Manager::open");
+
if (r)
{
this->reactor (r);
@@ -185,12 +233,16 @@ ACE_Process_Manager::open (size_t size, ACE_Reactor *r)
return -1;
#endif /* !defined(ACE_WIN32) */
}
+
ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, this->lock_, -1));
+
if (this->max_process_table_size_ < size)
this->resize (size);
return 0;
}
+
// Initialize the synchronization variables.
+
ACE_Process_Manager::ACE_Process_Manager (size_t size,
ACE_Reactor *r)
: ACE_Event_Handler (),
@@ -203,17 +255,21 @@ ACE_Process_Manager::ACE_Process_Manager (size_t size,
#endif /* ACE_HAS_THREADS */
{
ACE_TRACE ("ACE_Process_Manager::ACE_Process_Manager");
+
if (this->open (size,
r) == -1)
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_Process_Manager")));
}
+
// Close up and release all resources.
+
int
ACE_Process_Manager::close (void)
{
ACE_TRACE ("ACE_Process_Manager::close");
+
if (this->reactor () != 0)
{
#if !defined (ACE_WIN32) && !defined (ACE_LACKS_UNIX_SIGNALS)
@@ -221,44 +277,58 @@ ACE_Process_Manager::close (void)
#endif /* !ACE_WIN32 */
this->reactor (0);
}
+
ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, this->lock_, -1));
+
if (this->process_table_ != 0)
{
while (this->current_count_ > 0)
this->remove_proc (0);
+
delete [] this->process_table_;
this->process_table_ = 0;
this->max_process_table_size_ = 0;
this->current_count_ = 0;
}
+
if (this->default_exit_handler_ != 0)
this->default_exit_handler_->handle_close (ACE_INVALID_HANDLE,0);
this->default_exit_handler_ = 0;
+
return 0;
}
+
ACE_Process_Manager::~ACE_Process_Manager (void)
{
ACE_TRACE ("ACE_Process_Manager::~ACE_Process_Manager");
this->close ();
}
+
#if !defined (ACE_WIN32)
+
// This is called when the Reactor notices that a Process has exited.
// What has actually happened is a SIGCHLD invoked the <handle_signal>
// routine, which fooled the Reactor into thinking that this routine
// needed to be called. Since we don't know which Process exited, we
// must reap as many exit statuses as are immediately available.
+
int
ACE_Process_Manager::handle_input (ACE_HANDLE)
{
ACE_TRACE ("ACE_Process_Manager::handle_input");
+
pid_t pid;
+
do
pid = this->wait (0,
ACE_Time_Value::zero);
while (pid != 0 && pid != ACE_INVALID_PID);
+
return 0;
}
+
#endif /* !ACE_WIN32 */
+
// On Unix, this routine is called asynchronously when a SIGCHLD is
// received. We just tweak the reactor so that it'll call back our
// <handle_input> function, which allows us to handle Process exits
@@ -266,6 +336,7 @@ ACE_Process_Manager::handle_input (ACE_HANDLE)
//
// On Win32, this routine is called synchronously, and is passed the
// HANDLE of the Process that exited, so we can do all our work here.
+
int
ACE_Process_Manager::handle_signal (int,
siginfo_t *si,
@@ -282,6 +353,7 @@ ACE_Process_Manager::handle_signal (int,
{
{
ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, lock_, -1));
+
ssize_t const i = this->find_proc (proc);
if (i == -1)
return -1;
@@ -313,11 +385,13 @@ ACE_Process_Manager::handle_signal (int,
return reactor ()->notify (this, ACE_Event_Handler::READ_MASK);
#endif /* !ACE_WIN32 */
}
+
int
ACE_Process_Manager::register_handler (ACE_Event_Handler *eh,
pid_t pid)
{
ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, this->lock_, -1));
+
if (pid == ACE_INVALID_PID)
{
if (this->default_exit_handler_ != 0)
@@ -325,19 +399,25 @@ ACE_Process_Manager::register_handler (ACE_Event_Handler *eh,
this->default_exit_handler_ = eh;
return 0;
}
+
ssize_t const i = this->find_proc (pid);
+
if (i == -1)
{
errno = EINVAL;
return -1;
}
+
Process_Descriptor &proc_desc = this->process_table_[i];
+
if (proc_desc.exit_notify_ != 0)
proc_desc.exit_notify_->handle_close (ACE_INVALID_HANDLE, 0);
proc_desc.exit_notify_ = eh;
return 0;
}
+
// Create a new process.
+
pid_t
ACE_Process_Manager::spawn (ACE_Process_Options &options,
ACE_Event_Handler *event_handler)
@@ -346,30 +426,41 @@ ACE_Process_Manager::spawn (ACE_Process_Options &options,
ACE_NEW_RETURN (process,
ACE_Managed_Process,
ACE_INVALID_PID);
+
pid_t const pid = spawn (process, options, event_handler);
if (pid == ACE_INVALID_PID || pid == 0)
delete process;
+
return pid;
}
+
// Create a new process.
+
pid_t
ACE_Process_Manager::spawn (ACE_Process *process,
ACE_Process_Options &options,
ACE_Event_Handler *event_handler)
{
ACE_TRACE ("ACE_Process_Manager::spawn");
+
pid_t const pid = process->spawn (options);
+
// Only include the pid in the parent's table.
if (pid == ACE_INVALID_PID || pid == 0)
return pid;
+
ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex,
ace_mon, this->lock_, -1));
+
if (this->append_proc (process, event_handler) == -1)
// bad news: spawned, but not registered in table.
return ACE_INVALID_PID;
+
return pid;
}
+
// Create N new processs.
+
int
ACE_Process_Manager::spawn_n (size_t n,
ACE_Process_Options &options,
@@ -377,11 +468,13 @@ ACE_Process_Manager::spawn_n (size_t n,
ACE_Event_Handler *event_handler)
{
ACE_TRACE ("ACE_Process_Manager::spawn_n");
+
if (child_pids != 0)
for (size_t i = 0;
i < n;
++i)
child_pids[i] = ACE_INVALID_PID;
+
for (size_t i = 0;
i < n;
i++)
@@ -393,15 +486,19 @@ ACE_Process_Manager::spawn_n (size_t n,
else if (child_pids != 0)
child_pids[i] = pid;
}
+
return 0;
}
+
// Append a process into the pool (does not check for duplicates).
// Must be called with locks held.
+
int
ACE_Process_Manager::append_proc (ACE_Process *proc,
ACE_Event_Handler *event_handler)
{
ACE_TRACE ("ACE_Process_Manager::append_proc");
+
// Try to resize the array to twice its existing size (or the DEFAULT_SIZE,
// if there are no array entries) if we run out of space...
if (this->current_count_ >= this->max_process_table_size_)
@@ -412,10 +509,13 @@ ACE_Process_Manager::append_proc (ACE_Process *proc,
if (this->resize (new_size) == -1)
return -1;
}
+
Process_Descriptor &proc_desc =
this->process_table_[this->current_count_];
+
proc_desc.process_ = proc;
proc_desc.exit_notify_ = event_handler;
+
#if defined (ACE_WIN32)
// If we have a Reactor, then we're supposed to reap Processes
// automagically. Get a handle to this new Process and tell the
@@ -424,41 +524,56 @@ ACE_Process_Manager::append_proc (ACE_Process *proc,
if (r != 0)
r->register_handler (this, proc->gethandle ());
#endif /* ACE_WIN32 */
+
++this->current_count_;
return 0;
}
+
// Insert a process into the pool (checks for duplicates and doesn't
// allow them to be inserted twice).
+
int
ACE_Process_Manager::insert_proc (ACE_Process *proc,
ACE_Event_Handler *event_handler)
{
ACE_TRACE ("ACE_Process_Manager::insert_proc");
+
// Check for duplicates and bail out if they're already
// registered...
if (this->find_proc (proc->getpid ()) != -1)
return -1;
+
return this->append_proc (proc, event_handler);
}
+
// Remove a process from the pool.
+
int
ACE_Process_Manager::remove (pid_t pid)
{
ACE_TRACE ("ACE_Process_Manager::remove");
+
ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, this->lock_, -1));
+
ssize_t const i = this->find_proc (pid);
+
if (i != -1)
return this->remove_proc (i);
+
// set "process not found" error
return -1;
}
+
// Remove a process from the pool. Must be called with locks held.
+
int
ACE_Process_Manager::remove_proc (size_t i)
{
ACE_TRACE ("ACE_Process_Manager::remove_proc");
+
// If there's an exit_notify_ <Event_Handler> for this pid, call its
// <handle_close> method.
+
if (this->process_table_[i].exit_notify_ != 0)
{
this->process_table_[i].exit_notify_->handle_close
@@ -466,70 +581,94 @@ ACE_Process_Manager::remove_proc (size_t i)
0);
this->process_table_[i].exit_notify_ = 0;
}
+
#if defined (ACE_WIN32)
ACE_Reactor * const r = this->reactor ();
if (r != 0)
r->remove_handler (this->process_table_[i].process_->gethandle (),
ACE_Event_Handler::DONT_CALL);
#endif /* ACE_WIN32 */
+
this->process_table_[i].process_->unmanage ();
+
this->process_table_[i].process_ = 0;
+
this->current_count_--;
+
if (this->current_count_ > 0)
// Compact the table by moving the last item into the slot vacated
// by the index being removed (this is a structure assignment).
this->process_table_[i] =
this->process_table_[this->current_count_];
+
return 0;
}
+
int
ACE_Process_Manager::terminate (pid_t pid)
{
ACE_TRACE ("ACE_Process_Manager::terminate");
+
ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, this->lock_, -1));
+
// Check for duplicates and bail out if they're already
// registered...
ssize_t const i = this->find_proc (pid);
+
if (i == -1)
// set "no such process" error
return -1;
+
return ACE::terminate_process (pid);
}
+
int
ACE_Process_Manager::terminate (pid_t pid, int sig)
{
ACE_TRACE ("ACE_Process_Manager::terminate");
+
ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, this->lock_, -1));
+
// Check for duplicates and bail out if they're already
// registered...
ssize_t const i = this->find_proc (pid);
+
if (i == -1)
// set "no such process" error
return -1;
+
return ACE_OS::kill (pid, sig);
}
+
int
ACE_Process_Manager::set_scheduler (const ACE_Sched_Params & params,
pid_t pid)
{
ACE_TRACE ("ACE_Process_Manager::set_scheduler");
+
ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex,
ace_mon, this->lock_, -1));
+
// Check to see if the process identified by the given pid is managed by
// this instance of ACE_Process_Manager.
ssize_t const i = this->find_proc (pid);
+
if (i == -1)
// set "no such process" error
return ACE_INVALID_PID;
+
return ACE_OS::sched_params (params, pid);
}
+
int
ACE_Process_Manager::set_scheduler_all (const ACE_Sched_Params & params)
{
ACE_TRACE ("ACE_Process_Manager::set_scheduler_all");
+
ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex,
ace_mon, this->lock_, -1));
+
for (size_t i = 0; i < this->current_count_; ++i)
{
pid_t const pid = this->process_table_[i].process_->getpid ();
@@ -538,12 +677,15 @@ ACE_Process_Manager::set_scheduler_all (const ACE_Sched_Params & params)
}
return 0;
}
+
// Locate the index in the table associated with <pid>. Must be
// called with the lock held.
+
ssize_t
ACE_Process_Manager::find_proc (pid_t pid)
{
ACE_TRACE ("ACE_Process_Manager::find_proc");
+
for (size_t i = 0; i < this->current_count_; ++i)
{
if (pid == this->process_table_[i].process_->getpid ())
@@ -551,15 +693,19 @@ ACE_Process_Manager::find_proc (pid_t pid)
return ACE_Utils::truncate_cast<ssize_t> (i);
}
}
+
return -1;
}
+
#if defined (ACE_WIN32)
// Locate the index in the table associated with <h>. Must be
// called with the lock held.
+
ssize_t
ACE_Process_Manager::find_proc (ACE_HANDLE h)
{
ACE_TRACE ("ACE_Process_Manager::find_proc");
+
for (size_t i = 0; i < this->current_count_; ++i)
{
if (h == this->process_table_[i].process_->gethandle ())
@@ -567,68 +713,88 @@ ACE_Process_Manager::find_proc (ACE_HANDLE h)
return ACE_Utils::truncate_cast<ssize_t> (i);
}
}
+
return -1;
}
#endif /* ACE_WIN32 */
+
// Wait for all the Processs to exit, or until <timeout> elapses.
// Returns the number of Processes remaining, or -1 on an error.
+
int
ACE_Process_Manager::wait (const ACE_Time_Value &timeout)
{
ACE_TRACE ("ACE_Process_Manager::wait");
+
ACE_Time_Value until = timeout;
ACE_Time_Value remaining = timeout;
+
if (until < ACE_Time_Value::max_time)
until += ACE_OS::gettimeofday ();
+
while (this->current_count_ > 0)
{
pid_t const pid = this->wait (0, remaining);
+
if (pid == ACE_INVALID_PID) // wait() failed
return -1;
else if (pid == 0) // timeout
break;
+
remaining = until < ACE_Time_Value::max_time
? until - ACE_OS::gettimeofday ()
: ACE_Time_Value::max_time;
+
if (remaining <= ACE_Time_Value::zero)
break;
+
// else Process terminated...wait for more...
}
return static_cast<int> (this->current_count_);
}
+
// Collect a single child process' exit status. Store the exit code
// in *<stat_loc> if non-zero. Call the appropriate exit_notify. If
// <pid> == 0, wait for any of the Process_Manager's children (or as
// near as possible -- on Unix, we might accidentally get some other
// Process_Manager's Process, or an unmanaged Process, or a child
// process started by some other means.
+
pid_t
ACE_Process_Manager::wait (pid_t pid,
ACE_exitcode *status)
{
ACE_TRACE ("ACE_Process_Manager::wait");
+
return this->wait (pid,
ACE_Time_Value::max_time,
status);
}
+
// Collect a single child processes' exit status, unless <timeout>
// elapses before the process exits. Same caveats about accidental
// Process reaping on Unix as above.
+
pid_t
ACE_Process_Manager::wait (pid_t pid,
const ACE_Time_Value &timeout,
ACE_exitcode *status)
{
ACE_TRACE ("ACE_Process_Manager::wait");
+
ACE_exitcode local_stat = 0;
if (status == 0)
status = &local_stat;
+
*status = 0;
+
ssize_t idx = -1;
ACE_Process *proc = 0;
+
{
// fake context after which the lock is released
ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, this->lock_, -1));
+
if (pid != 0)
{
idx = this->find_proc (pid);
@@ -647,14 +813,17 @@ ACE_Process_Manager::wait (pid_t pid,
// Wait for any Process spawned by this Process_Manager.
#if defined (ACE_WIN32)
HANDLE *handles = 0;
+
ACE_NEW_RETURN (handles,
HANDLE[this->current_count_],
ACE_INVALID_PID);
+
for (size_t i = 0;
i < this->current_count_;
++i)
handles[i] =
process_table_[i].process_->gethandle ();
+
DWORD handle_count = static_cast<DWORD> (this->current_count_);
DWORD result = ::WaitForMultipleObjects (handle_count,
handles,
@@ -678,7 +847,9 @@ ACE_Process_Manager::wait (pid_t pid,
ACE_ASSERT (result >= WAIT_OBJECT_0
&& result < WAIT_OBJECT_0 + this->current_count_);
# endif
+
idx = this->find_proc (handles[result - WAIT_OBJECT_0]);
+
if (idx != -1)
{
pid = process_table_[idx].process_->getpid ();
@@ -702,6 +873,7 @@ ACE_Process_Manager::wait (pid_t pid,
-1);
}
}
+
delete [] handles;
#else /* !defined(ACE_WIN32) */
if (timeout == ACE_Time_Value::max_time)
@@ -721,6 +893,7 @@ ACE_Process_Manager::wait (pid_t pid,
pid = ACE_OS::waitpid (-1, status, WNOHANG);
if (pid > 0 || pid == ACE_INVALID_PID)
break; // Got a child or an error - all done
+
// pid 0, nothing is ready yet, so wait.
// Do a (very) short sleep (only this thread sleeps).
ACE_OS::sleep (sleeptm);
@@ -737,6 +910,7 @@ ACE_Process_Manager::wait (pid_t pid,
ACE_Sig_Action do_sigchld ((ACE_SignalHandler)sigchld_nop);
do_sigchld.register_action (SIGCHLD, &old_action);
}
+
ACE_Time_Value tmo (timeout); // Need one we can change
for (ACE_Countdown_Time time_left (&tmo); ; time_left.update ())
{
@@ -747,6 +921,7 @@ ACE_Process_Manager::wait (pid_t pid,
if (pid > 0 || pid == ACE_INVALID_PID)
# endif
break; // Got a child or an error - all done
+
// pid 0, nothing is ready yet, so wait.
// Do a sleep (only this thread sleeps) til something
// happens. This relies on SIGCHLD interrupting the sleep.
@@ -758,6 +933,7 @@ ACE_Process_Manager::wait (pid_t pid,
pid = 0;
break;
}
+
// Restore the previous SIGCHLD action if it was changed.
if (this->reactor () == 0)
old_action.register_action (SIGCHLD);
@@ -765,6 +941,7 @@ ACE_Process_Manager::wait (pid_t pid,
}
#endif /* !defined (ACE_WIN32) */
}
+
ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, this->lock_, -1));
if (pid != ACE_INVALID_PID && pid != 0)
{
@@ -782,28 +959,35 @@ ACE_Process_Manager::wait (pid_t pid,
proc = process_table_[idx].process_;
if (proc != 0)
ACE_ASSERT (pid == proc->getpid ());
+
this->notify_proc_handler (idx,
*status);
this->remove (pid);
}
+
return pid;
}
+
// Legacy method:
+
int
ACE_Process_Manager::reap (pid_t pid,
ACE_exitcode *stat_loc,
int options)
{
ACE_TRACE ("ACE_Process_Manager::reap");
+
return this->wait (pid,
(ACE_BIT_ENABLED (options, WNOHANG)
? ACE_Time_Value::zero
: ACE_Time_Value::max_time),
stat_loc);
}
+
// Notify either the process-specific handler or the generic handler.
// If process-specific, call handle_close on the handler. Returns 1
// if process found, 0 if not. Must be called with locks held.
+
int
ACE_Process_Manager::notify_proc_handler (size_t i,
ACE_exitcode exit_code)
@@ -812,7 +996,9 @@ ACE_Process_Manager::notify_proc_handler (size_t i,
{
Process_Descriptor &proc_desc =
this->process_table_[i];
+
proc_desc.process_->exit_code (exit_code);
+
if (proc_desc.exit_notify_ != 0)
proc_desc.exit_notify_->handle_exit (proc_desc.process_);
else if (this->default_exit_handler_ != 0
@@ -833,5 +1019,6 @@ ACE_Process_Manager::notify_proc_handler (size_t i,
return 0;
}
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Process_Manager.h b/dep/ACE_wrappers/ace/Process_Manager.h
index 57f3b1c800f..53b5ad7d55b 100644
--- a/dep/ACE_wrappers/ace/Process_Manager.h
+++ b/dep/ACE_wrappers/ace/Process_Manager.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Process_Manager.h
@@ -8,21 +9,30 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_PROCESS_MANAGER_H
#define ACE_PROCESS_MANAGER_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Process.h"
#include "ace/Event_Handler.h"
#include "ace/Time_Value.h"
+
#if defined (ACE_HAS_THREADS)
# include "ace/Recursive_Thread_Mutex.h"
#endif /* ACE_HAS_THREADS */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Reactor;
+
/**
* @class ACE_Process_Manager
*
@@ -89,10 +99,12 @@ class ACE_Export ACE_Process_Manager : protected ACE_Event_Handler
{
public:
friend class ACE_Process_Control;
+
enum
{
DEFAULT_SIZE = 100
};
+
/**
* @name Initialization and termination methods
*/
@@ -107,6 +119,7 @@ public:
*/
ACE_Process_Manager (size_t size = ACE_Process_Manager::DEFAULT_SIZE,
ACE_Reactor *reactor = 0);
+
/**
* Initialize an ACE_Process_Manager with a table containing up to
* @a size processes. This table resizes itself automatically as
@@ -117,27 +130,36 @@ public:
*/
int open (size_t size = ACE_Process_Manager::DEFAULT_SIZE,
ACE_Reactor *r = 0);
+
/// Release all resources. Do not wait for processes to exit.
int close (void);
+
/// Destructor releases all resources and does not wait for processes
/// to exit.
virtual ~ACE_Process_Manager (void);
+
//@}
+
/**
* @name Singleton access and control
*/
//@{
/// Get pointer to a process-wide ACE_Process_Manager.
static ACE_Process_Manager *instance (void);
+
/// Set pointer to a process-wide ACE_Process_Manager and return
/// existing pointer.
static ACE_Process_Manager *instance (ACE_Process_Manager *);
+
/// Delete the dynamically allocated singleton.
static void close_singleton (void);
+
/// Cleanup method, used by the ACE_Object_Manager to destroy the
/// singleton.
static void cleanup (void *instance, void *arg);
+
//@}
+
/**
* @name Process creation methods
*/
@@ -152,6 +174,7 @@ public:
pid_t spawn (ACE_Process *proc,
ACE_Process_Options &options,
ACE_Event_Handler *event_handler = 0);
+
/**
* Create a new process with the specified @a options.
* Register @a event_handler to be called back when the process exits.
@@ -161,6 +184,7 @@ public:
*/
pid_t spawn (ACE_Process_Options &options,
ACE_Event_Handler *event_handler = 0);
+
/**
* Create @a n new processes with the same @a options.
* If @a child_pids is non-0 it is expected to be an array of at least
@@ -174,6 +198,7 @@ public:
pid_t *child_pids = 0,
ACE_Event_Handler *event_Handler = 0);
//@}
+
/**
* @name Process synchronization operations
*/
@@ -189,6 +214,7 @@ public:
* @retval 0 on success and -1 on failure.
*/
int terminate (pid_t pid);
+
/**
* Sends the specified signal to the specified process.
*
@@ -198,6 +224,7 @@ public:
* @retval 0 on success and -1 on failure.
*/
int terminate (pid_t pid, int sig);
+
/**
* Block until there are no more child processes running that were
* spawned by this ACE_Process_Manager. Unlike the wait() method
@@ -213,6 +240,7 @@ public:
* @retval 0 on success; -1 on failure.
*/
int wait (const ACE_Time_Value &timeout = ACE_Time_Value::max_time);
+
/**
* Wait up to @a timeout for a single specified process to terminate.
* If @a pid is 0, this method waits for any of the managed processes
@@ -229,6 +257,7 @@ public:
pid_t wait (pid_t pid,
const ACE_Time_Value &timeout,
ACE_exitcode *status = 0);
+
/**
* Wait indefinitely for a single, specified process to terminate.
* If @a pid is 0, waits for any of the managed processes (but see the
@@ -240,6 +269,7 @@ public:
*/
pid_t wait (pid_t pid,
ACE_exitcode *status = 0);
+
/**
* @deprecated
* Reap the result of a single process by calling ACE_OS::waitpid(),
@@ -251,6 +281,7 @@ public:
ACE_exitcode *stat_loc = 0,
int options = WNOHANG);
//@}
+
/**
* @name Utility methods
*/
@@ -267,6 +298,7 @@ public:
*/
int register_handler (ACE_Event_Handler *event_handler,
pid_t pid = ACE_INVALID_PID);
+
/**
* Remove process @a pid from the ACE_Process_Manager's internal records.
* This is called automatically by the reap() method after it successfully
@@ -275,8 +307,10 @@ public:
* remove()!
*/
int remove (pid_t pid);
+
/// Return the number of managed processes.
size_t managed (void) const;
+
/**
* Sets the scheduling parameters for process identified by @a pid by
* passing @a params, @a pid to ACE_OS::sched_params().
@@ -285,6 +319,7 @@ public:
* specified @a pid is not managed by this ACE_Process_Manager.
*/
int set_scheduler (const ACE_Sched_Params &params, pid_t pid);
+
/**
* Sets the scheduling parameters for all the processes managed by
* this ACE_Process_Manager by passing @a params to
@@ -293,17 +328,22 @@ public:
* @retval 0 on success, -1 on failure.
*/
int set_scheduler_all (const ACE_Sched_Params &params);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
//@}
+
protected:
// = These methods allow a <Process_Manager> to be an <Event_Handler>.
+
// As an <Event_Handler>, the <Process_Manager> automagically
// detects child Processes exiting and calls notify_proc_handler()
// and remove(). This means that you don't have to (shouldn't!)
// call the wait(...) methods yourself.
+
// On Unix, we can't detect individual process termination very
// well; the best method is to catch SIGCHLD and then call the
// polling wait() function to collect any available exit statuses.
@@ -315,13 +355,16 @@ protected:
// handle is readable. That will cause the handle_input() function
// to be called once we're out of the interrupt context, and
// handle_input() collects exit statuses.
+
// On Win32, we simply register ourself with the Reactor to deal
// with the Process handle becoming signaled. No muss, no fuss, no
// signal handler, and no dummy handle.
+
#if !defined(ACE_WIN32)
/// Collect one (or more, on unix) process exit status.
virtual int handle_input (ACE_HANDLE proc);
#endif // !defined(ACE_WIN32)
+
/**
* On Unix, this routine is called asynchronously when a SIGCHLD is
* received. We just tweak the reactor so that it'll call back our
@@ -334,7 +377,9 @@ protected:
virtual int handle_signal (int signum,
siginfo_t * = 0,
ucontext_t * = 0);
+
private:
+
/**
* @struct Process_Descriptor
*
@@ -348,28 +393,36 @@ private:
/// Default ctor/dtor.
Process_Descriptor (void);
~Process_Descriptor (void);
+
/// Describes the process itself.
ACE_Process *process_;
+
/// Function to call when process exits
ACE_Event_Handler *exit_notify_;
+
/// Dump the state of an object.
void dump (void) const;
};
+
/// Resize the pool of Process_Descriptors.
int resize (size_t);
+
/// Locate the index of the table slot occupied by @a process_id.
/// Returns -1 if @a process_id is not in the @c process_table_
ssize_t find_proc (pid_t process_id);
+
#if defined (ACE_WIN32)
/// Locate the index of the table slot occupied by @a process_handle.
/// Returns ~0 if @a process_handle is not in the @c process_table_
ssize_t find_proc (ACE_HANDLE process_handle);
#endif /* ACE_WIN32 */
+
/// Insert a process in the table (checks for duplicates). Omitting
/// the process handle won't work on Win32...
/// Register @a event_handler to be called back when the process exits.
int insert_proc (ACE_Process *process,
ACE_Event_Handler *event_handler = 0);
+
/**
* Append information about a process, i.e., its <process_id> in the
* @c process_table_. Each entry is added at the end, growing the
@@ -378,36 +431,48 @@ private:
*/
int append_proc (ACE_Process *process,
ACE_Event_Handler *event_handler = 0);
+
/// Actually removes the process at index @a n from the table. This method
/// must be called with locks held.
int remove_proc (size_t n);
+
/// If there's a specific handler for the Process at index @a n in the
/// table, or there's a default handler, call it.
int notify_proc_handler (size_t n, ACE_exitcode status);
+
/// Vector that describes process state within the Process_Manager.
Process_Descriptor *process_table_;
+
/// Maximum number of processes we can manage (should be dynamically
/// allocated).
size_t max_process_table_size_;
+
/// Current number of processes we are managing.
size_t current_count_;
+
/// This event handler is used to notify when a process we control
/// exits.
ACE_Event_Handler *default_exit_handler_;
+
/// Singleton pointer.
static ACE_Process_Manager *instance_;
+
/// Controls whether the <Process_Manager> is deleted when we shut
/// down (we can only delete it safely if we created it!)
static bool delete_instance_;
+
#if defined (ACE_HAS_THREADS)
/// This lock protects access/ops on @c process_table_.
ACE_Recursive_Thread_Mutex lock_;
#endif /* ACE_HAS_THREADS */
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Process_Manager.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_PROCESS_MANAGER_H */
diff --git a/dep/ACE_wrappers/ace/Process_Manager.inl b/dep/ACE_wrappers/ace/Process_Manager.inl
index a161115d062..be8b53cab58 100644
--- a/dep/ACE_wrappers/ace/Process_Manager.inl
+++ b/dep/ACE_wrappers/ace/Process_Manager.inl
@@ -1,10 +1,13 @@
// -*- C++ -*-
//
// $Id: Process_Manager.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE size_t
ACE_Process_Manager::managed (void) const
{
return current_count_;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Process_Mutex.cpp b/dep/ACE_wrappers/ace/Process_Mutex.cpp
index d90d5a4d11d..fb86e8af00a 100644
--- a/dep/ACE_wrappers/ace/Process_Mutex.cpp
+++ b/dep/ACE_wrappers/ace/Process_Mutex.cpp
@@ -1,16 +1,22 @@
// $Id: Process_Mutex.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Process_Mutex.h"
#include "ace/Log_Msg.h"
#include "ace/ACE.h"
#include "ace/Guard_T.h"
#include "ace/Process_Mutex.h"
#include "ace/Malloc_T.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Process_Mutex.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace, Process_Mutex, "$Id: Process_Mutex.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_Process_Mutex)
+
void
ACE_Process_Mutex::dump (void) const
{
@@ -21,6 +27,7 @@ ACE_Process_Mutex::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
const ACE_TCHAR *
ACE_Process_Mutex::unique_name (void)
{
@@ -30,6 +37,7 @@ ACE_Process_Mutex::unique_name (void)
ACE::unique_name (this, this->name_, ACE_UNIQUE_NAME_LEN);
return this->name_;
}
+
ACE_Process_Mutex::ACE_Process_Mutex (const char *name, void *arg, mode_t mode)
#if defined (_ACE_USE_SV_SEM)
: lock_ (name ? name : ACE_TEXT_ALWAYS_CHAR (this->unique_name ()),
@@ -49,6 +57,7 @@ ACE_Process_Mutex::ACE_Process_Mutex (const char *name, void *arg, mode_t mode)
ACE_UNUSED_ARG (arg);
#endif /* !_ACE_USE_SV_SEM */
}
+
#if defined (ACE_HAS_WCHAR)
ACE_Process_Mutex::ACE_Process_Mutex (const wchar_t *name,
void *arg,
@@ -77,5 +86,6 @@ ACE_Process_Mutex::ACE_Process_Mutex (const wchar_t *name,
ACE_Process_Mutex::~ACE_Process_Mutex (void)
{
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Process_Mutex.h b/dep/ACE_wrappers/ace/Process_Mutex.h
index 3ae89d6a734..8f23211a378 100644
--- a/dep/ACE_wrappers/ace/Process_Mutex.h
+++ b/dep/ACE_wrappers/ace/Process_Mutex.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Process_Mutex.h
@@ -11,27 +12,36 @@
* @author Douglas C. Schmidt <schmidt@uci.edu>
*/
//=============================================================================
+
#ifndef ACE_PROCESS_MUTEX_H
#define ACE_PROCESS_MUTEX_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
// To make it easier to carry the setting though this file as well as
// Process_Mutex.{cpp inl}, set a private macro here.
#ifdef _ACE_USE_SV_SEM
# undef _ACE_USE_SV_SEM
#endif /* _ACE_USE_SV_SEM */
+
#if defined (ACE_HAS_SYSV_IPC) && !defined (ACE_USES_MUTEX_FOR_PROCESS_MUTEX)
# include "ace/SV_Semaphore_Complex.h"
# define _ACE_USE_SV_SEM
#else
# include "ace/Mutex.h"
#endif /* ACE_HAS_SYSV_IPC && !ACE_USES_MUTEX_FOR_PROCESS_MUTEX */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward declarations
class ACE_Time_Value;
+
/**
* @class ACE_Process_Mutex
*
@@ -80,6 +90,7 @@ public:
ACE_Process_Mutex (const char *name = 0,
void *arg = 0,
mode_t mode = ACE_DEFAULT_FILE_PERMS);
+
#if defined (ACE_HAS_WCHAR)
/**
* Create a Process_Mutex, passing in the optional @c name. (@c wchar_t
@@ -99,7 +110,9 @@ public:
void *arg = 0,
mode_t mode = ACE_DEFAULT_FILE_PERMS);
#endif /* ACE_HAS_WCHAR */
+
~ACE_Process_Mutex (void);
+
/**
* Explicitly destroy the mutex. Note that only one thread should
* call this method since it doesn't protect against race
@@ -108,12 +121,14 @@ public:
* @return 0 on success; -1 on failure.
*/
int remove (void);
+
/**
* Acquire lock ownership (wait on queue if necessary).
*
* @return 0 on success; -1 on failure.
*/
int acquire (void);
+
/**
* Acquire lock ownership, but timeout if lock if hasn't been
* acquired by given time.
@@ -124,6 +139,7 @@ public:
* @return 0 on success; -1 on failure.
*/
int acquire (ACE_Time_Value &tv);
+
/**
* Conditionally acquire lock (i.e., don't wait on queue).
*
@@ -131,44 +147,56 @@ public:
* because someone else already had the lock, @c errno is set to @c EBUSY.
*/
int tryacquire (void);
+
/// Release lock and unblock a thread at head of queue.
int release (void);
+
/// Acquire lock ownership (wait on queue if necessary).
int acquire_read (void);
+
/// Acquire lock ownership (wait on queue if necessary).
int acquire_write (void);
+
/**
* Conditionally acquire a lock (i.e., won't block). Returns -1 on
* failure. If we "failed" because someone else already had the
* lock, @c errno is set to @c EBUSY.
*/
int tryacquire_read (void);
+
/**
* Conditionally acquire a lock (i.e., won't block). Returns -1 on
* failure. If we "failed" because someone else already had the
* lock, @c errno is set to @c EBUSY.
*/
int tryacquire_write (void);
+
/**
* This is only here for consistency with the other synchronization
* APIs and usability with Lock adapters. Assumes the caller already has
* acquired the mutex and returns 0 in all cases.
*/
int tryacquire_write_upgrade (void);
+
#if !defined (_ACE_USE_SV_SEM)
/// Return the underlying mutex.
const ACE_mutex_t &lock (void) const;
#endif /* !_ACE_USE_SV_SEM */
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// If the user does not provide a name we generate a unique name in
/// this buffer.
ACE_TCHAR name_[ACE_UNIQUE_NAME_LEN];
+
/// Create and return the unique name.
const ACE_TCHAR *unique_name (void);
+
#if defined (_ACE_USE_SV_SEM)
/// We need this to get the right semantics...
ACE_SV_Semaphore_Complex lock_;
@@ -176,10 +204,14 @@ private:
ACE_Mutex lock_;
#endif /* _ACE_USE_SV_SEM */
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Process_Mutex.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_PROCESS_MUTEX_H */
diff --git a/dep/ACE_wrappers/ace/Process_Mutex.inl b/dep/ACE_wrappers/ace/Process_Mutex.inl
index 0dab9cedc1b..00c84e6a5bc 100644
--- a/dep/ACE_wrappers/ace/Process_Mutex.inl
+++ b/dep/ACE_wrappers/ace/Process_Mutex.inl
@@ -1,7 +1,9 @@
// -*- C++ -*-
//
// $Id: Process_Mutex.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
#if !defined (_ACE_USE_SV_SEM)
ACE_INLINE const ACE_mutex_t &
ACE_Process_Mutex::lock (void) const
@@ -10,12 +12,14 @@ ACE_Process_Mutex::lock (void) const
return this->lock_.lock ();
}
#endif /* !_ACE_USE_SV_SEM */
+
// Explicitly destroy the mutex.
ACE_INLINE int
ACE_Process_Mutex::remove (void)
{
return this->lock_.remove ();
}
+
// Acquire lock ownership (wait on priority queue if necessary).
ACE_INLINE int
ACE_Process_Mutex::acquire (void)
@@ -26,6 +30,7 @@ ACE_Process_Mutex::acquire (void)
return this->lock_.acquire ();
#endif // _ACE_USE_SV_SEM
}
+
// Acquire lock ownership (wait on priority queue if necessary).
ACE_INLINE int
ACE_Process_Mutex::acquire (ACE_Time_Value &tv)
@@ -37,6 +42,7 @@ ACE_Process_Mutex::acquire (ACE_Time_Value &tv)
ACE_NOTSUP_RETURN (-1);
#endif /* !_ACE_USE_SV_SEM */
}
+
// Conditionally acquire lock (i.e., don't wait on queue).
ACE_INLINE int
ACE_Process_Mutex::tryacquire (void)
@@ -47,6 +53,7 @@ ACE_Process_Mutex::tryacquire (void)
return this->lock_.tryacquire ();
#endif // _ACE_USE_SV_SEM
}
+
// Release lock and unblock a thread at head of priority queue.
ACE_INLINE int
ACE_Process_Mutex::release (void)
@@ -57,6 +64,7 @@ ACE_Process_Mutex::release (void)
return this->lock_.release ();
#endif // _ACE_USE_SV_SEM
}
+
// Acquire lock ownership (wait on priority queue if necessary).
ACE_INLINE int
ACE_Process_Mutex::acquire_read (void)
@@ -67,6 +75,7 @@ ACE_Process_Mutex::acquire_read (void)
return this->lock_.acquire_read ();
#endif // _ACE_USE_SV_SEM
}
+
// Acquire lock ownership (wait on priority queue if necessary).
ACE_INLINE int
ACE_Process_Mutex::acquire_write (void)
@@ -77,6 +86,7 @@ ACE_Process_Mutex::acquire_write (void)
return this->lock_.acquire_write ();
#endif // _ACE_USE_SV_SEM
}
+
// Conditionally acquire a lock (i.e., won't block).
ACE_INLINE int
ACE_Process_Mutex::tryacquire_read (void)
@@ -87,6 +97,7 @@ ACE_Process_Mutex::tryacquire_read (void)
return this->lock_.tryacquire_read ();
#endif // _ACE_USE_SV_SEM
}
+
// Conditionally acquire a lock (i.e., won't block).
ACE_INLINE int
ACE_Process_Mutex::tryacquire_write (void)
@@ -97,9 +108,11 @@ ACE_Process_Mutex::tryacquire_write (void)
return this->lock_.tryacquire_write ();
#endif // _ACE_USE_SV_SEM
}
+
ACE_INLINE int
ACE_Process_Mutex::tryacquire_write_upgrade (void)
{
return 0;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Process_Semaphore.cpp b/dep/ACE_wrappers/ace/Process_Semaphore.cpp
index 25693eff417..8be6ecf292c 100644
--- a/dep/ACE_wrappers/ace/Process_Semaphore.cpp
+++ b/dep/ACE_wrappers/ace/Process_Semaphore.cpp
@@ -1,13 +1,19 @@
// $Id: Process_Semaphore.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Process_Semaphore.h"
#include "ace/Log_Msg.h"
#include "ace/OS_Memory.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Process_Semaphore.inl"
#endif /* __ACE_INLINE__ */
+
#include "ace/ACE.h"
+
ACE_RCSID(ace, Process_Semaphore, "$Id: Process_Semaphore.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
void
ACE_Process_Semaphore::dump (void) const
{
@@ -18,6 +24,7 @@ ACE_Process_Semaphore::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
ACE_Process_Semaphore::ACE_Process_Semaphore (u_int count,
const ACE_TCHAR *name,
void *arg,
@@ -34,15 +41,19 @@ ACE_Process_Semaphore::ACE_Process_Semaphore (u_int count,
ACE_UNUSED_ARG (max);
// ACE_TRACE ("ACE_Process_Semaphore::ACE_Process_Semaphore");
}
+
// Explicitly destroy the semaphore.
+
int
ACE_Process_Semaphore::remove (void)
{
// ACE_TRACE ("ACE_Process_Semaphore::remove");
return this->lock_.remove ();
}
+
// Block the thread until the semaphore count becomes
// greater than 0, then decrement it.
+
int
ACE_Process_Semaphore::acquire (void)
{
@@ -53,8 +64,10 @@ ACE_Process_Semaphore::acquire (void)
return this->lock_.acquire (0, SEM_UNDO);
#endif /* defined (ACE_WIN32) || defined (ACE_HAS_POSIX_SEM) */
}
+
// Conditionally decrement the semaphore if count is greater
// than 0 (i.e., won't block).
+
int
ACE_Process_Semaphore::tryacquire (void)
{
@@ -65,8 +78,10 @@ ACE_Process_Semaphore::tryacquire (void)
return this->lock_.tryacquire (0, SEM_UNDO);
#endif /* defined (ACE_WIN32) || defined (ACE_HAS_POSIX_SEM) */
}
+
// Increment the semaphore, potentially unblocking
// a waiting thread.
+
int
ACE_Process_Semaphore::release (void)
{
@@ -77,7 +92,9 @@ ACE_Process_Semaphore::release (void)
return this->lock_.release (0, SEM_UNDO);
#endif /* defined (ACE_WIN32) || defined (ACE_HAS_POSIX_SEM) */
}
+
/*****************************************************************************/
+
ACE_Process_Semaphore *
ACE_Malloc_Lock_Adapter_T<ACE_Process_Semaphore>::operator () (const ACE_TCHAR *name)
{
@@ -90,5 +107,6 @@ ACE_Malloc_Lock_Adapter_T<ACE_Process_Semaphore>::operator () (const ACE_TCHAR *
0);
return p;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Process_Semaphore.h b/dep/ACE_wrappers/ace/Process_Semaphore.h
index 3cacfa1dc19..7a3e148ace3 100644
--- a/dep/ACE_wrappers/ace/Process_Semaphore.h
+++ b/dep/ACE_wrappers/ace/Process_Semaphore.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Process_Semaphore.h
@@ -11,19 +12,26 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_PROCESS_SEMAPHORE_H
#define ACE_PROCESS_SEMAPHORE_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if !(defined (ACE_WIN32) || defined (ACE_HAS_POSIX_SEM))
# include "ace/SV_Semaphore_Complex.h"
#else
# include "ace/Semaphore.h"
#endif /* !(ACE_WIN32 || ACE_HAS_POSIX_SEM) */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Process_Semaphore
*
@@ -39,15 +47,18 @@ public:
const ACE_TCHAR *name = 0,
void * = 0,
int max = 0x7FFFFFFF);
+
/**
* Explicitly destroy the semaphore. Note that only one thread
* should call this method since it doesn't protect against race
* conditions.
*/
int remove (void);
+
/// Block the thread until the semaphore count becomes greater than
/// 0, then decrement it.
int acquire (void);
+
/**
* Conditionally decrement the semaphore if count is greater than 0
* (i.e., won't block). Returns -1 on failure. If we "failed"
@@ -55,20 +66,24 @@ public:
* @c EBUSY.
*/
int tryacquire (void);
+
/// Increment the semaphore, potentially unblocking a waiting thread.
int release (void);
+
/**
* Acquire semaphore ownership. This calls <acquire> and is only
* here to make the ACE_Process_Semaphore interface consistent
* with the other synchronization APIs.
*/
int acquire_read (void);
+
/**
* Acquire semaphore ownership. This calls <acquire> and is only
* here to make the ACE_Process_Semaphore interface consistent
* with the other synchronization APIs.
*/
int acquire_write (void);
+
/**
* Conditionally acquire semaphore (i.e., won't block). This calls
* <tryacquire> and is only here to make the ACE_Process_Semaphore
@@ -77,6 +92,7 @@ public:
* already had the lock, @c errno is set to @c EBUSY.
*/
int tryacquire_read (void);
+
/**
* Conditionally acquire semaphore (i.e., won't block). This calls
* <tryacquire> and is only here to make the ACE_Process_Semaphore
@@ -85,6 +101,7 @@ public:
* already had the lock, @c errno is set to @c EBUSY.
*/
int tryacquire_write (void);
+
/**
* This is only here to make the ACE_Process_Semaphore
* interface consistent with the other synchronization APIs.
@@ -92,14 +109,18 @@ public:
* the above calls, and returns 0 (success) always.
*/
int tryacquire_write_upgrade (void);
+
#if defined (ACE_WIN32) || defined (ACE_HAS_POSIX_SEM)
/// Return the underlying lock.
const ACE_sema_t &lock (void) const;
#endif /* ACE_WIN32 || ACE_HAS_POSIX_SEM */
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
#if defined (ACE_WIN32) || defined (ACE_HAS_POSIX_SEM)
ACE_Semaphore lock_;
@@ -108,8 +129,11 @@ protected:
ACE_SV_Semaphore_Complex lock_;
#endif /* ACE_WIN32 || ACE_HAS_POSIX_SEM */
};
+
/*****************************************************************************/
+
template <class T> class ACE_Malloc_Lock_Adapter_T;
+
/**
* @class ACE_Malloc_Lock_Adapter_T<ACE_Process_Semaphore>
*
@@ -125,11 +149,14 @@ class ACE_Export ACE_Malloc_Lock_Adapter_T<ACE_Process_Semaphore>
public:
ACE_Process_Semaphore * operator () (const ACE_TCHAR *name);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Process_Semaphore.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_PROCESS_SEMAPHORE_H */
diff --git a/dep/ACE_wrappers/ace/Process_Semaphore.inl b/dep/ACE_wrappers/ace/Process_Semaphore.inl
index 5918a7f91da..0874b2d51dd 100644
--- a/dep/ACE_wrappers/ace/Process_Semaphore.inl
+++ b/dep/ACE_wrappers/ace/Process_Semaphore.inl
@@ -1,7 +1,9 @@
// -*- C++ -*-
//
// $Id: Process_Semaphore.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_WIN32) || defined (ACE_HAS_POSIX_SEM)
ACE_INLINE const ACE_sema_t &
ACE_Process_Semaphore::lock (void) const
@@ -10,38 +12,47 @@ ACE_Process_Semaphore::lock (void) const
return this->lock_.lock ();
}
#endif /* ACE_WIN32 || ACE_HAS_POSIX_SEM */
+
// Acquire semaphore ownership. This calls <acquire> and is only here
// to make the ACE_Process_Semaphore interface consistent with the
// other synchronization APIs.
+
ACE_INLINE int
ACE_Process_Semaphore::acquire_read (void)
{
return this->acquire ();
}
+
// Acquire semaphore ownership. This calls <acquire> and is only here
// to make the ACE_Process_Semaphore interface consistent with the
// other synchronization APIs.
+
ACE_INLINE int
ACE_Process_Semaphore::acquire_write (void)
{
return this->acquire ();
}
+
// Conditionally acquire semaphore (i.e., won't block). This calls
// <tryacquire> and is only here to make the ACE_Process_Semaphore
// interface consistent with the other synchronization APIs.
+
ACE_INLINE int
ACE_Process_Semaphore::tryacquire_read (void)
{
return this->tryacquire ();
}
+
// Conditionally acquire semaphore (i.e., won't block). This calls
// <tryacquire> and is only here to make the ACE_Process_Semaphore
// interface consistent with the other synchronization APIs.
+
ACE_INLINE int
ACE_Process_Semaphore::tryacquire_write (void)
{
return this->tryacquire ();
}
+
// This is only here to make the ACE_Process_Semaphore
// interface consistent with the other synchronization APIs.
// Assumes the caller has already acquired the semaphore using one of
@@ -51,4 +62,5 @@ ACE_Process_Semaphore::tryacquire_write_upgrade (void)
{
return 0;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Profile_Timer.cpp b/dep/ACE_wrappers/ace/Profile_Timer.cpp
index 824c838121d..2680ad06810 100644
--- a/dep/ACE_wrappers/ace/Profile_Timer.cpp
+++ b/dep/ACE_wrappers/ace/Profile_Timer.cpp
@@ -1,20 +1,30 @@
// $Id: Profile_Timer.cpp 82208 2008-06-26 20:44:51Z jtc $
+
#include "ace/Profile_Timer.h"
+
#if !defined (__ACE_INLINE__)
# include "ace/Profile_Timer.inl"
#endif /* __ACE_INLINE__ */
+
#include "ace/Log_Msg.h"
#include "ace/OS_NS_string.h"
+
#if defined (ACE_HAS_PRUSAGE_T)
#include "ace/OS_NS_fcntl.h"
#include "ace/OS_NS_unistd.h"
#endif
+
ACE_RCSID(ace, Profile_Timer, "$Id: Profile_Timer.cpp 82208 2008-06-26 20:44:51Z jtc $")
+
#if (defined (ACE_HAS_PRUSAGE_T) || defined (ACE_HAS_GETRUSAGE)) && !defined (ACE_WIN32)
+
#include "ace/OS_NS_stdio.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_Profile_Timer)
+
void
ACE_Profile_Timer::dump (void) const
{
@@ -22,17 +32,21 @@ ACE_Profile_Timer::dump (void) const
ACE_TRACE ("ACE_Profile_Timer::dump");
#endif /* ACE_HAS_DUMP */
}
+
// Initialize interval timer.
+
ACE_Profile_Timer::ACE_Profile_Timer (void)
{
ACE_TRACE ("ACE_Profile_Timer::ACE_Profile_Timer");
ACE_OS::memset (&this->end_usage_, 0, sizeof this->end_usage_);
ACE_OS::memset (&this->begin_usage_, 0, sizeof this->begin_usage_);
ACE_OS::memset (&this->last_usage_, 0, sizeof this->last_usage_);
+
# if defined (ACE_HAS_PRUSAGE_T)
ACE_OS::memset (&this->last_usage_, 0, sizeof this->last_usage_);
char buf[20];
ACE_OS::sprintf (buf, "/proc/%d", static_cast<int> (ACE_OS::getpid ()));
+
this->proc_handle_ = ACE_OS::open (buf, O_RDONLY, 0);
if (this->proc_handle_ == -1)
ACE_ERROR ((LM_ERROR,
@@ -44,6 +58,7 @@ ACE_Profile_Timer::ACE_Profile_Timer (void)
ACE_OS::memset (&this->last_time_, 0, sizeof this->last_time_);
# endif /* ACE_HAS_PRUSAGE_T */
}
+
// Terminate the interval timer.
ACE_Profile_Timer::~ACE_Profile_Timer (void)
{
@@ -54,15 +69,20 @@ ACE_Profile_Timer::~ACE_Profile_Timer (void)
ACE_TEXT ("ACE_Profile_Timer::~ACE_Profile_Timer")));
# endif /* ACE_HAS_PRUSAGE_T */
}
+
// Return the resource utilization.
+
void
ACE_Profile_Timer::get_rusage (ACE_Profile_Timer::Rusage &usage)
{
ACE_TRACE ("ACE_Profile_Timer::get_rusage");
usage = this->end_usage_;
}
+
# if defined (ACE_HAS_PRUSAGE_T)
+
// Compute the amount of resource utilization since the start time.
+
void
ACE_Profile_Timer::elapsed_rusage (ACE_Profile_Timer::Rusage &rusage)
{
@@ -103,14 +123,18 @@ ACE_Profile_Timer::elapsed_rusage (ACE_Profile_Timer::Rusage &rusage)
rusage.pr_ioch =
this->end_usage_.pr_ioch - this->last_usage_.pr_ioch;
}
+
// Compute the elapsed time.
+
void
ACE_Profile_Timer::compute_times (ACE_Elapsed_Time &et)
{
ACE_TRACE ("ACE_Profile_Timer::compute_times");
timespec_t td;
+
ACE_Profile_Timer::Rusage &end = this->end_usage_;
ACE_Profile_Timer::Rusage &begin = this->begin_usage_;
+
this->subtract (td, end.pr_tstamp, begin.pr_tstamp);
// Convert nanoseconds into seconds.
et.real_time = td.tv_sec + ((double) td.tv_nsec) / ACE_ONE_SECOND_IN_NSECS;
@@ -121,22 +145,28 @@ ACE_Profile_Timer::compute_times (ACE_Elapsed_Time &et)
// Convert nanoseconds into seconds.
et.system_time = td.tv_sec + ((double) td.tv_nsec) / ACE_ONE_SECOND_IN_NSECS;
}
+
// Determine the difference between T1 and T2.
+
void
ACE_Profile_Timer::subtract (timespec_t &tdiff, timespec_t &t1, timespec_t &t0)
{
ACE_TRACE ("ACE_Profile_Timer::subtract");
tdiff.tv_sec = t1.tv_sec - t0.tv_sec;
tdiff.tv_nsec = t1.tv_nsec - t0.tv_nsec;
+
// Normalize the time.
+
while (tdiff.tv_nsec < 0)
{
tdiff.tv_sec--;
tdiff.tv_nsec += ACE_ONE_SECOND_IN_NSECS;
}
}
+
# elif defined (ACE_HAS_GETRUSAGE)
// Compute the amount of resource utilization since the start time.
+
void
ACE_Profile_Timer::elapsed_rusage (ACE_Profile_Timer::Rusage &usage)
{
@@ -191,34 +221,46 @@ ACE_Profile_Timer::elapsed_rusage (ACE_Profile_Timer::Rusage &usage)
ACE_UNUSED_ARG(usage);
# endif /* ACE_HAS_LIMITED_RUSAGE_T */
}
+
void
ACE_Profile_Timer::compute_times (ACE_Elapsed_Time &et)
{
ACE_TRACE ("ACE_Profile_Timer::compute_times");
+
timeval td;
+
this->subtract (td, this->end_time_, this->begin_time_);
et.real_time = td.tv_sec + ((double) td.tv_usec) / ACE_ONE_SECOND_IN_USECS;
+
this->subtract (td, this->end_usage_.ru_utime, this->begin_usage_.ru_utime);
et.user_time = td.tv_sec + ((double) td.tv_usec) / ACE_ONE_SECOND_IN_USECS;
+
this->subtract (td, this->end_usage_.ru_stime, this->begin_usage_.ru_stime);
et.system_time = td.tv_sec + ((double) td.tv_usec) / ACE_ONE_SECOND_IN_USECS;
}
+
// Determine the difference between T1 and T2.
+
void
ACE_Profile_Timer::subtract (timeval &tdiff, timeval &t1, timeval &t0)
{
ACE_TRACE ("ACE_Profile_Timer::subtract");
tdiff.tv_sec = t1.tv_sec - t0.tv_sec;
tdiff.tv_usec = t1.tv_usec - t0.tv_usec;
+
// Normalize the time.
+
while (tdiff.tv_usec < 0)
{
tdiff.tv_sec--;
tdiff.tv_usec += ACE_ONE_SECOND_IN_USECS;
}
}
+
# endif /* ACE_HAS_PRUSAGE_T */
+
// Compute the amount of time that has elapsed between start and stop.
+
int
ACE_Profile_Timer::elapsed_time (ACE_Elapsed_Time &et)
{
@@ -226,9 +268,13 @@ ACE_Profile_Timer::elapsed_time (ACE_Elapsed_Time &et)
this->compute_times (et);
return 0;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#elif defined (ACE_WIN32) /* defined (ACE_HAS_PRUSAGE_T) || defined (ACE_HAS_GETRUSAGE) */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
void
ACE_Profile_Timer::dump (void) const
{
@@ -237,24 +283,29 @@ ACE_Profile_Timer::dump (void) const
timer_.dump ();
#endif /* ACE_HAS_DUMP */
}
+
// Initialize interval timer.
ACE_Profile_Timer::ACE_Profile_Timer (void)
: timer_ ()
{
ACE_TRACE ("ACE_Profile_Timer::ACE_Profile_Timer");
# if defined (ACE_HAS_GETRUSAGE)
+
ACE_OS::memset (&this->end_usage_, 0, sizeof this->end_usage_);
ACE_OS::memset (&this->begin_usage_, 0, sizeof this->begin_usage_);
ACE_OS::memset (&this->last_usage_, 0, sizeof this->last_usage_);
+
ACE_OS::memset (&this->begin_time_, 0, sizeof this->begin_time_);
ACE_OS::memset (&this->end_time_, 0, sizeof this->end_time_);
ACE_OS::memset (&this->last_time_, 0, sizeof this->last_time_);
# endif /* ACE_HAS_GETRUSAGE */
}
+
int
ACE_Profile_Timer::elapsed_time (ACE_Elapsed_Time &et)
{
ACE_TRACE ("ACE_Profile_Timer::elapsed_time");
+
ACE_hrtime_t delta_t; // nanoseconds
timer_.elapsed_time (delta_t);
# if defined (ACE_LACKS_LONGLONG_T)
@@ -266,6 +317,7 @@ ACE_Profile_Timer::elapsed_time (ACE_Elapsed_Time &et)
ACE_Time_Value atv = ACE_Time_Value (this->end_usage_.ru_utime)
- ACE_Time_Value (this->begin_usage_.ru_utime);
et.user_time = atv.sec () + ((double) atv.usec ()) / ACE_ONE_SECOND_IN_USECS;
+
atv = ACE_Time_Value (this->end_usage_.ru_stime)
- ACE_Time_Value (this->begin_usage_.ru_stime);
et.system_time = atv.sec () + ((double) atv.usec ()) / ACE_ONE_SECOND_IN_USECS;
@@ -273,9 +325,12 @@ ACE_Profile_Timer::elapsed_time (ACE_Elapsed_Time &et)
et.user_time = 0;
et.system_time = 0;
# endif /* ACE_HAS_GETRUSAGE */
+
return 0;
}
+
// Return the resource utilization.
+
void
ACE_Profile_Timer::get_rusage (ACE_Profile_Timer::Rusage &usage)
{
@@ -286,11 +341,14 @@ ACE_Profile_Timer::get_rusage (ACE_Profile_Timer::Rusage &usage)
usage = 0;
# endif /* ACE_HAS_GETRUSAGE */
}
+
// Compute the amount of resource utilization since the start time.
+
void
ACE_Profile_Timer::elapsed_rusage (ACE_Profile_Timer::Rusage &usage)
{
ACE_TRACE ("ACE_Profile_Timer::elapsed_rusage");
+
# if defined (ACE_HAS_GETRUSAGE)
// Use ACE_Time_Value's as intermediate because the type of ru_utime can
// be multiple types and using the - operator is not safe when this are
@@ -298,6 +356,7 @@ ACE_Profile_Timer::elapsed_rusage (ACE_Profile_Timer::Rusage &usage)
ACE_Time_Value end_ru_utime (this->end_usage_.ru_utime);
ACE_Time_Value begin_ru_utime (this->begin_usage_.ru_utime);
usage.ru_utime = end_ru_utime - begin_ru_utime;
+
ACE_Time_Value end_ru_stime (this->end_usage_.ru_stime);
ACE_Time_Value begin_ru_stime (this->begin_usage_.ru_stime);
usage.ru_stime = end_ru_stime - begin_ru_stime;
@@ -305,15 +364,19 @@ ACE_Profile_Timer::elapsed_rusage (ACE_Profile_Timer::Rusage &usage)
usage = 0;
# endif /* ACE_HAS_GETRUSAGE */
}
+
# if defined (ACE_HAS_GETRUSAGE)
// Determine the difference between T1 and T2.
+
void
ACE_Profile_Timer::subtract (timeval &tdiff, timeval &t1, timeval &t0)
{
ACE_TRACE ("ACE_Profile_Timer::subtract");
tdiff.tv_sec = t1.tv_sec - t0.tv_sec;
tdiff.tv_usec = t1.tv_usec - t0.tv_usec;
+
// Normalize the time.
+
while (tdiff.tv_usec < 0)
{
tdiff.tv_sec--;
@@ -321,9 +384,13 @@ ACE_Profile_Timer::subtract (timeval &tdiff, timeval &t1, timeval &t0)
}
}
# endif /* ACE_HAS_GETRUSAGE */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#else
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
void
ACE_Profile_Timer::dump (void) const
{
@@ -332,22 +399,29 @@ ACE_Profile_Timer::dump (void) const
timer_.dump ();
#endif /* ACE_HAS_DUMP */
}
+
ACE_Profile_Timer::ACE_Profile_Timer (void)
: timer_ ()
{
ACE_TRACE ("ACE_Profile_Timer::ACE_Profile_Timer");
}
+
int
ACE_Profile_Timer::elapsed_time (ACE_Elapsed_Time &et)
{
ACE_TRACE ("ACE_Profile_Timer::elapsed_time");
+
ACE_hrtime_t delta_t; /* nanoseconds */
timer_.elapsed_time (delta_t);
+
et.real_time = delta_t / (double) ACE_ONE_SECOND_IN_NSECS;
+
et.user_time = 0;
et.system_time = 0;
+
return 0;
}
+
void
ACE_Profile_Timer::get_rusage (ACE_Profile_Timer::Rusage &usage)
{
@@ -355,13 +429,16 @@ ACE_Profile_Timer::get_rusage (ACE_Profile_Timer::Rusage &usage)
usage = 0;
}
+
void
ACE_Profile_Timer::elapsed_rusage (ACE_Profile_Timer::Rusage &usage)
{
ACE_TRACE ("ACE_Profile_Timer::elapsed_rusage");
usage = 0;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* defined (ACE_HAS_PRUSAGE_T) ||
defined (ACE_HAS_GETRUSAGE) && !defined (ACE_WIN32) */
diff --git a/dep/ACE_wrappers/ace/Profile_Timer.h b/dep/ACE_wrappers/ace/Profile_Timer.h
index 89bc95d8932..c46cdab2168 100644
--- a/dep/ACE_wrappers/ace/Profile_Timer.h
+++ b/dep/ACE_wrappers/ace/Profile_Timer.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file Profile_Timer.h
@@ -9,15 +10,21 @@
*/
//==========================================================================
+
#ifndef ACE_PROFILE_TIMER_H
#define ACE_PROFILE_TIMER_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/High_Res_Timer.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Profile_Timer
*
@@ -27,6 +34,7 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
class ACE_Export ACE_Profile_Timer
{
public:
+
/**
* @class ACE_Elapsed_Time
*
@@ -38,69 +46,95 @@ public:
public:
/// Elapsed wall clock time.
ACE_timer_t real_time;
+
/// CPU time spent in user space.
ACE_timer_t user_time;
+
/// CPU time spent in system space.
ACE_timer_t system_time;
};
+
typedef ACE_Rusage Rusage;
+
// = Initialization and termination methods.
/// Default constructor. Clears all time values to 0.
ACE_Profile_Timer (void);
+
/// Shutdown the timer.
~ACE_Profile_Timer (void);
+
// = Timer methods.
/// Activate the timer.
int start (void);
+
/// Stop the timer.
int stop (void);
+
// = Resource utilization methods.
/// Compute the time elapsed between calls to @c start() and @c stop().
int elapsed_time (ACE_Elapsed_Time &et);
+
/// Compute the amount of resource utilization between calls to @c start()
/// and @c stop().
void elapsed_rusage (ACE_Profile_Timer::Rusage &rusage);
+
/// Return the resource utilization (don't recompute it).
void get_rusage (ACE_Profile_Timer::Rusage &rusage);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Compute how much time has elapsed.
void compute_times (ACE_Elapsed_Time &et);
+
/// Keep track of the starting resource utilization.
ACE_Profile_Timer::Rusage begin_usage_;
+
/// Keep track of the ending resource utilization.
ACE_Profile_Timer::Rusage end_usage_;
+
/// Keep track of the last rusage for incremental timing.
ACE_Profile_Timer::Rusage last_usage_;
+
#if defined (ACE_HAS_PRUSAGE_T)
/// Substract two timestructs and store their difference.
void subtract (timespec_t &tdiff, timespec_t &t0, timespec_t &t1);
+
/// I/O handle for /proc file system.
ACE_HANDLE proc_handle_;
+
#elif defined (ACE_HAS_GETRUSAGE)
/// Substract two timestructs and store their difference.
void subtract (timeval &tdiff,
timeval &t0,
timeval &t1);
+
/// Keep track of the beginning time.
timeval begin_time_;
+
/// Keep track of the ending time.
timeval end_time_;
+
/// Keep track of the last time for incremental timing.
timeval last_time_;
#endif /* ACE_HAS_PRUSAGE_T */
+
#if defined (ACE_WIN32) || (!defined (ACE_HAS_PRUSAGE_T) && !defined (ACE_HAS_GETRUSAGE))
/// The high resolution timer
ACE_High_Res_Timer timer_;
#endif /* ACE_WIN32 || !ACE_HAS_PRUSAGE_T && !ACE_HAS_GETRUSAGE */
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
# include "ace/Profile_Timer.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_PROFILE_TIMER_H */
diff --git a/dep/ACE_wrappers/ace/Profile_Timer.inl b/dep/ACE_wrappers/ace/Profile_Timer.inl
index 501f316fa06..9990585cef6 100644
--- a/dep/ACE_wrappers/ace/Profile_Timer.inl
+++ b/dep/ACE_wrappers/ace/Profile_Timer.inl
@@ -1,13 +1,18 @@
// -*- C++ -*-
//
// $Id: Profile_Timer.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_sys_time.h"
#include "ace/OS_NS_sys_resource.h"
#include "ace/Global_Macros.h"
+
#if (defined (ACE_HAS_PRUSAGE_T) || defined (ACE_HAS_GETRUSAGE)) && !defined (ACE_WIN32)
+
# if defined (ACE_HAS_PRUSAGE_T)
# include "ace/OS_NS_stropts.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE int
ACE_Profile_Timer::start (void)
{
@@ -16,6 +21,7 @@ ACE_Profile_Timer::start (void)
PIOCUSAGE,
&this->begin_usage_);
}
+
ACE_INLINE int
ACE_Profile_Timer::stop (void)
{
@@ -25,9 +31,13 @@ ACE_Profile_Timer::stop (void)
PIOCUSAGE,
&this->end_usage_);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# elif defined (ACE_HAS_GETRUSAGE)
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE int
ACE_Profile_Timer::start (void)
{
@@ -37,6 +47,7 @@ ACE_Profile_Timer::start (void)
&this->begin_usage_);
return 0;
}
+
ACE_INLINE int
ACE_Profile_Timer::stop (void)
{
@@ -48,14 +59,20 @@ ACE_Profile_Timer::stop (void)
&this->end_usage_);
return 0;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# endif /* ACE_HAS_PRUSAGE_T */
+
#elif defined (ACE_WIN32)
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_Profile_Timer::~ACE_Profile_Timer (void)
{
}
+
ACE_INLINE int
ACE_Profile_Timer::start (void)
{
@@ -67,6 +84,7 @@ ACE_Profile_Timer::start (void)
this->timer_.start ();
return 0;
}
+
ACE_INLINE int
ACE_Profile_Timer::stop (void)
{
@@ -78,9 +96,13 @@ ACE_Profile_Timer::stop (void)
# endif /* ACE_HAS_GETRUSAGE */
return 0;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#else
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE int
ACE_Profile_Timer::start (void)
{
@@ -88,6 +110,7 @@ ACE_Profile_Timer::start (void)
this->timer_.start ();
return 0;
}
+
ACE_INLINE int
ACE_Profile_Timer::stop (void)
{
@@ -95,9 +118,12 @@ ACE_Profile_Timer::stop (void)
this->timer_.stop ();
return 0;
}
+
ACE_INLINE
ACE_Profile_Timer::~ACE_Profile_Timer (void)
{
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* defined (ACE_HAS_PRUSAGE_T) || defined (ACE_HAS_GETRUSAGE) */
diff --git a/dep/ACE_wrappers/ace/RB_Tree.h b/dep/ACE_wrappers/ace/RB_Tree.h
index 6ef33cdca37..536d7073ccc 100644
--- a/dep/ACE_wrappers/ace/RB_Tree.h
+++ b/dep/ACE_wrappers/ace/RB_Tree.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file RB_Tree.h
@@ -9,31 +10,41 @@
*/
//=============================================================================
+
#ifndef ACE_RB_TREE_H
#define ACE_RB_TREE_H
#include /**/ "ace/pre.h"
+
#include "ace/Global_Macros.h"
#include "ace/Functor_T.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward decl.
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
class ACE_RB_Tree_Iterator_Base;
+
// Forward decl.
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
class ACE_RB_Tree_Iterator;
+
// Forward decl.
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
class ACE_RB_Tree_Reverse_Iterator;
+
// Forward decl.
class ACE_Allocator;
+
class ACE_RB_Tree_Node_Base
{
public:
enum RB_Tree_Node_Color {RED, BLACK};
};
+
/**
* @class ACE_RB_Tree_Node
*
@@ -44,49 +55,70 @@ class ACE_RB_Tree_Node : public ACE_RB_Tree_Node_Base
{
public:
// = Initialization and termination methods.
+
/// Constructor.
ACE_RB_Tree_Node (const EXT_ID &k, const INT_ID &t);
+
/// Destructor.
~ACE_RB_Tree_Node (void);
+
/// Key accessor.
EXT_ID &key (void);
+
/// Item accessor.
INT_ID &item (void);
+
/// Set color of the node.
void color (RB_Tree_Node_Color c);
+
/// Get color of the node.
RB_Tree_Node_Color color (void);
+
/// Accessor for node's parent pointer.
ACE_RB_Tree_Node<EXT_ID, INT_ID> *parent (void);
+
/// Mutator for node's parent pointer.
void parent (ACE_RB_Tree_Node<EXT_ID, INT_ID> * p);
+
/// Accessor for node's left child pointer.
ACE_RB_Tree_Node<EXT_ID, INT_ID> *left (void);
+
/// Mutator for node's left child pointer.
void left (ACE_RB_Tree_Node<EXT_ID, INT_ID> *l);
+
/// Accessor for node's right child pointer.
ACE_RB_Tree_Node<EXT_ID, INT_ID> *right (void);
+
/// Mutator for node's right child pointer
void right (ACE_RB_Tree_Node<EXT_ID, INT_ID> * r);
+
private:
+
/// The key.
EXT_ID k_;
+
/// The item.
INT_ID t_;
+
/// Color of the node.
RB_Tree_Node_Color color_;
+
/// Pointer to node's parent.
ACE_RB_Tree_Node<EXT_ID, INT_ID> *parent_;
+
/// Pointer to node's left child.
ACE_RB_Tree_Node<EXT_ID, INT_ID> *left_;
+
/// Pointer to node's right child.
ACE_RB_Tree_Node<EXT_ID, INT_ID> *right_;
};
+
class ACE_RB_Tree_Base
{
public:
/// Search result enumeration.
enum RB_SearchResult {LEFT, EXACT, RIGHT};
+
/// Get the allocator;
/**
* @note This method is inlined here rather than in RB_Tree.inl
@@ -98,11 +130,14 @@ public:
* the header avoids such errors.
*/
ACE_Allocator * allocator (void) const { return this->allocator_; }
+
protected:
// = Protected members.
+
/// Pointer to a memory allocator.
ACE_Allocator *allocator_;
};
+
/**
* @class ACE_RB_Tree
*
@@ -149,34 +184,46 @@ protected:
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
class ACE_RB_Tree : public ACE_RB_Tree_Base
{
+
public:
friend class ACE_RB_Tree_Iterator_Base<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>;
friend class ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>;
friend class ACE_RB_Tree_Reverse_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>;
+
typedef EXT_ID KEY;
typedef INT_ID VALUE;
typedef ACE_LOCK lock_type;
typedef ACE_RB_Tree_Node<EXT_ID, INT_ID> ENTRY;
+
// = ACE-style iterator typedefs.
typedef ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> ITERATOR;
typedef ACE_RB_Tree_Reverse_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> REVERSE_ITERATOR;
+
// = STL-style iterator typedefs.
typedef ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> iterator;
typedef ACE_RB_Tree_Reverse_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> reverse_iterator;
+
// = Initialization and termination methods.
+
/// Constructor.
ACE_RB_Tree (ACE_Allocator *alloc = 0);
+
/// Copy constructor.
ACE_RB_Tree (const ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> &rbt);
+
/// Initialize an RB Tree.
int open (ACE_Allocator *alloc = 0);
+
/// Close down an RB_Tree and release dynamically allocated
/// resources.
int close (void);
+
/// Destructor.
virtual ~ACE_RB_Tree (void);
+
// = insertion, removal, and search methods.
+
/**
* Associate @a ext_id with @a int_id. If @a ext_id is already in the
* tree then the <ACE_RB_Tree_Node> is not changed. Returns 0 if a
@@ -185,6 +232,7 @@ public:
*/
int bind (const EXT_ID &item,
const INT_ID &int_id);
+
/**
* Same as a normal bind, except the tree entry is also passed back
* to the caller. The entry in this case will either be the newly
@@ -194,6 +242,7 @@ public:
const INT_ID &int_id,
ACE_RB_Tree_Node<EXT_ID, INT_ID> *&entry);
+
/**
* Associate @a ext_id with @a int_id if and only if @a ext_id is not
* in the tree. If @a ext_id is already in the tree then the @a int_id
@@ -203,6 +252,7 @@ public:
*/
int trybind (const EXT_ID &ext_id,
INT_ID &int_id);
+
/**
* Same as a normal trybind, except the tree entry is also passed
* back to the caller. The entry in this case will either be the
@@ -211,6 +261,7 @@ public:
int trybind (const EXT_ID &ext_id,
INT_ID &int_id,
ACE_RB_Tree_Node<EXT_ID, INT_ID> *&entry);
+
/**
* Reassociate @a ext_id with @a int_id. If @a ext_id is not in the
* tree then behaves just like <bind>. Returns 0 if a new entry is
@@ -219,6 +270,7 @@ public:
*/
int rebind (const EXT_ID &ext_id,
const INT_ID &int_id);
+
/**
* Same as a normal rebind, except the tree entry is also passed back
* to the caller. The entry in this case will either be the newly
@@ -227,6 +279,7 @@ public:
int rebind (const EXT_ID &ext_id,
const INT_ID &int_id,
ACE_RB_Tree_Node<EXT_ID, INT_ID> *&entry);
+
/**
* Associate @a ext_id with @a int_id. If @a ext_id is not in the tree
* then behaves just like <bind>. Otherwise, store the old value of
@@ -237,6 +290,7 @@ public:
int rebind (const EXT_ID &ext_id,
const INT_ID &int_id,
INT_ID &old_int_id);
+
/**
* Same as a normal rebind, except the tree entry is also passed back
* to the caller. The entry in this case will either be the newly
@@ -246,6 +300,7 @@ public:
const INT_ID &int_id,
INT_ID &old_int_id,
ACE_RB_Tree_Node<EXT_ID, INT_ID> *&entry);
+
/**
* Associate @a ext_id with @a int_id. If @a ext_id is not in the tree
* then behaves just like <bind>. Otherwise, store the old values
@@ -260,6 +315,7 @@ public:
const INT_ID &int_id,
EXT_ID &old_ext_id,
INT_ID &old_int_id);
+
/**
* Same as a normal rebind, except the tree entry is also passed back
* to the caller. The entry in this case will either be the newly
@@ -270,38 +326,47 @@ public:
EXT_ID &old_ext_id,
INT_ID &old_int_id,
ACE_RB_Tree_Node<EXT_ID, INT_ID> *&entry);
+
/// Locate @a ext_id and pass out parameter via @a int_id. If found,
/// return 0, returns -1 if not found.
int find (const EXT_ID &ext_id,
INT_ID &int_id);
+
/// Locate @a ext_id and pass out parameter via @a entry. If found,
/// return 0, returns -1 if not found.
int find (const EXT_ID &ext_id,
ACE_RB_Tree_Node<EXT_ID, INT_ID> *&entry);
+
/**
* Unbind (remove) the @a ext_id from the tree. Don't return the
* @a int_id to the caller (this is useful for collections where the
* @c int_ids are *not* dynamically allocated...)
*/
int unbind (const EXT_ID &ext_id);
+
/// Break any association of @a ext_id. Returns the value of @a int_id
/// in case the caller needs to deallocate memory.
int unbind (const EXT_ID &ext_id,
INT_ID &int_id);
+
/**
* Remove entry from tree. This method should be used with *extreme*
* caution, and only for optimization purposes. The node being passed
* in had better have been allocated by the tree that is unbinding it.
*/
int unbind (ACE_RB_Tree_Node<EXT_ID, INT_ID> *entry);
+
// = Public helper methods.
+
/// Returns the current number of nodes in the tree.
size_t current_size (void) const;
+
/// Assignment operator.
void operator= (const ACE_RB_Tree<EXT_ID,
INT_ID,
COMPARE_KEYS,
ACE_LOCK> &rbt);
+
/**
* Returns a reference to the underlying <ACE_LOCK>. This makes it
* possible to acquire the lock explicitly, which can be useful in
@@ -311,25 +376,34 @@ public:
* @note The right name would be <lock>, but HP/C++ will choke on that!
*/
ACE_LOCK &mutex (void);
+
/// Dump the state of an object.
void dump (void) const;
+
// = STL styled iterator factory functions.
+
/// Return forward iterator positioned at first node in tree.
ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> begin (void);
+
/// Return forward iterator positioned at last node in tree.
ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> end (void);
+
/// Return reverse iterator positioned at last node in tree.
ACE_RB_Tree_Reverse_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> rbegin (void);
+
/// Return reverse iterator positioned at first node in tree.
ACE_RB_Tree_Reverse_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> rend (void);
+
/// Recursively tests the invariant red-black properties at each
/// node of the tree. Returns 0 if invariant holds, else -1.
/// This method is computationally expensive, and should only be
/// called for testing purposes, and not in code that depends on the
/// algorithmic complexity bounds provided by the other methods.
int test_invariant (void);
+
// = DEPRECATED methods.
// Please migrate your code to use the new methods instead
+
/**
* Returns a pointer to the item corresponding to the
* given key, or 0 if it cannot find the key in the tree.
@@ -339,6 +413,7 @@ public:
* 0 if the @a ext_id is in the tree, otherwise -1.
*/
INT_ID* find (const EXT_ID &k);
+
/**
* Inserts a *copy* of the key and the item into the tree: both the
* key type EXT_ID and the item type INT_ID must have well defined semantics
@@ -351,6 +426,7 @@ public:
* @deprecated
*/
INT_ID* insert (const EXT_ID &k, const INT_ID &t);
+
/**
* Removes the item associated with the given key from the tree and
* destroys it. Returns 1 if it found the item and successfully
@@ -359,9 +435,11 @@ public:
* @deprecated
*/
int remove (const EXT_ID &k);
+
/// @deprecated
/// Destroys all nodes and sets the root pointer null.
void clear (void);
+
protected:
/// Reinitialize constructor.
/**
@@ -371,34 +449,44 @@ protected:
*/
ACE_RB_Tree (void *location,
ACE_Allocator *alloc);
+
// = Protected methods. These should only be called with locks held.
+
/// Recursively tests the invariant red-black properties at each
/// node of the tree. Returns 0 if invariant holds, else -1.
int test_invariant_recurse (ACE_RB_Tree_Node<EXT_ID, INT_ID> * x,
int & expected_black_height,
int measured_black_height);
+
/// Method for right rotation of the tree about a given node.
void RB_rotate_right (ACE_RB_Tree_Node<EXT_ID, INT_ID> * x);
+
/// Method for left rotation of the tree about a given node.
void RB_rotate_left (ACE_RB_Tree_Node<EXT_ID, INT_ID> * x);
+
/// Method for restoring Red-Black properties after deletion.
void RB_delete_fixup (ACE_RB_Tree_Node<EXT_ID, INT_ID> * x,
ACE_RB_Tree_Node<EXT_ID, INT_ID> * parent);
+
/// Method to find the successor node of the given node in the tree.
ACE_RB_Tree_Node<EXT_ID, INT_ID> *
RB_tree_successor (ACE_RB_Tree_Node<EXT_ID, INT_ID> *x) const;
+
/// Method to find the predecessor node of the given node in the
/// tree.
ACE_RB_Tree_Node<EXT_ID, INT_ID> *
RB_tree_predecessor (ACE_RB_Tree_Node<EXT_ID, INT_ID> *x) const;
+
/// Method to find the minimum node of the subtree rooted at the
/// given node.
ACE_RB_Tree_Node<EXT_ID, INT_ID> *
RB_tree_minimum (ACE_RB_Tree_Node<EXT_ID, INT_ID> *x) const;
+
/// Method to find the maximum node of the subtree rooted at the
/// given node.
ACE_RB_Tree_Node<EXT_ID, INT_ID> *
RB_tree_maximum (ACE_RB_Tree_Node<EXT_ID, INT_ID> *x) const;
+
/**
* Returns a pointer to a matching node if there is one, a pointer
* to the node under which to insert the item if the tree is not
@@ -410,14 +498,18 @@ protected:
*/
ACE_RB_Tree_Node<EXT_ID, INT_ID> *find_node (const EXT_ID &k,
ACE_RB_Tree_Base::RB_SearchResult &result);
+
/// Rebalance the tree after insertion of a node.
void RB_rebalance (ACE_RB_Tree_Node<EXT_ID, INT_ID> * x);
+
/// Delete children (left and right) of the node. Must be called with
/// lock held.
void delete_children_i (ACE_RB_Tree_Node<EXT_ID, INT_ID> *parent);
+
/// Close down an RB_Tree. this method should
/// only be called with locks already held.
int close_i (void);
+
/**
* Retrieves a pointer to the item corresponding to the
* given key. If find_exact==1, find the exact match node,
@@ -425,6 +517,7 @@ protected:
* Returns 0 for success, or -1 if it cannot find the key in the tree.
*/
int find_i (const EXT_ID &ext_id, ACE_RB_Tree_Node<EXT_ID, INT_ID>* &entry, int find_exact = 1);
+
/**
* Inserts a *copy* of the key and the item into the tree: both the
* key type EXT_ID and the item type INT_ID must have well defined semantics
@@ -436,6 +529,7 @@ protected:
* associated with the existing key.
*/
INT_ID* insert_i (const EXT_ID &k, const INT_ID &t);
+
/**
* Inserts a *copy* of the key and the item into the tree: both the
* key type EXT_ID and the item type INT_ID must have well defined semantics
@@ -448,6 +542,7 @@ protected:
*/
int insert_i (const EXT_ID &k, const INT_ID &t,
ACE_RB_Tree_Node<EXT_ID, INT_ID> *&entry);
+
/**
* Removes the item associated with the given key from the tree and
* destroys it. Returns 1 if it found the item and successfully
@@ -455,28 +550,39 @@ protected:
* occurred. Returns the stored internal id in the second argument.
*/
int remove_i (const EXT_ID &k, INT_ID &i);
+
/// Removes the item associated with the given key from the tree and
/// destroys it.
int remove_i (ACE_RB_Tree_Node<EXT_ID, INT_ID> *z);
+
/// Recursive function to dump the state of an object.
void dump_i (ACE_RB_Tree_Node<EXT_ID, INT_ID> *node) const;
+
/// Function to dump node contents. Does nothing in its
/// basic form, but template specialization can be used to
/// provide definitions for various EXT_ID and INT_ID types.
void dump_node_i (ACE_RB_Tree_Node<EXT_ID, INT_ID> &node) const;
+
/// Less than comparison function for keys, using comparison functor.
int lessthan (const EXT_ID &k1, const EXT_ID &k2);
+
private:
+
// = Private members.
+
/// Synchronization variable for the MT_SAFE ACE_RB_Tree.
ACE_LOCK lock_;
+
/// The root of the tree.
ACE_RB_Tree_Node<EXT_ID, INT_ID> *root_;
+
/// Comparison functor for comparing nodes in the tree.
COMPARE_KEYS compare_keys_;
+
/// The current number of nodes in the tree.
size_t current_size_;
};
+
/**
* @class ACE_RB_Tree_Iterator_Base
*
@@ -485,33 +591,48 @@ private:
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
class ACE_RB_Tree_Iterator_Base
{
+
public:
+
/// Copy constructor.
ACE_RB_Tree_Iterator_Base (const ACE_RB_Tree_Iterator_Base<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> &iter);
+
/// Assignment operator: copies both the tree reference and the position in the tree.
void operator= (const ACE_RB_Tree_Iterator_Base<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> &iter);
+
// = Iteration methods.
+
/// Returns 1 when the iteration has completed, otherwise 0.
int done (void) const;
+
/// STL-like iterator dereference operator: returns a reference
/// to the node underneath the iterator.
ACE_RB_Tree_Node<EXT_ID, INT_ID> & operator* (void) const;
+
/// STL-like iterator dereference operator: returns a pointer
/// to the node underneath the iterator.
ACE_RB_Tree_Node<EXT_ID, INT_ID> * operator-> (void) const;
+
/// Returns a const reference to the tree over which we're iterating.
const ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> &tree (void);
+
/// Comparison operator: returns 1 if both iterators point to the same position, otherwise 0.
bool operator== (const ACE_RB_Tree_Iterator_Base<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> &) const;
+
/// Comparison operator: returns 1 if the iterators point to different positions, otherwise 0.
bool operator!= (const ACE_RB_Tree_Iterator_Base<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> &) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
+
// = Initialization and termination methods.
+
/// Create the singular iterator. No valid iterator can be equal to
/// it, it is illegal to dereference a singular iterator, etc. etc.
ACE_RB_Tree_Iterator_Base (void);
+
/**
* Constructor. Takes an ACE_RB_Tree over which to iterate, and
* an integer indicating (if non-zero) to position the iterator
@@ -520,35 +641,47 @@ protected:
*/
ACE_RB_Tree_Iterator_Base (const ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> &tree,
int set_first);
+
/**
* Constructor. Takes an ACE_RB_Tree over which to iterate, and
* a pointer to a node in the tree.
*/
ACE_RB_Tree_Iterator_Base (const ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> &tree,
ACE_RB_Tree_Node<EXT_ID, INT_ID>* entry);
+
/**
* Constructor. Takes an ACE_RB_Tree over which to iterate, and a key.
* The key must come first to distinguish the case of EXT_ID == int.
*/
ACE_RB_Tree_Iterator_Base (const EXT_ID& key,
ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS,ACE_LOCK> &tree);
+
/// Destructor.
~ACE_RB_Tree_Iterator_Base (void);
+
// = Internal methods
+
/// Move forward by one element in the tree. Returns 0 when
/// there are no more elements in the tree, otherwise 1.
int forward_i (void);
+
/// Move back by one element in the tree. Returns 0 when
/// there are no more elements in the tree, otherwise 1.
int reverse_i (void);
+
/// Dump the state of an object.
void dump_i (void) const;
+
// = Protected members.
+
/// Reference to the ACE_RB_Tree over which we're iterating.
const ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> *tree_;
+
/// Pointer to the node currently under the iterator.
ACE_RB_Tree_Node <EXT_ID, INT_ID> *node_;
+
};
+
/**
* @class ACE_RB_Tree_Iterator
*
@@ -557,7 +690,9 @@ protected:
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
class ACE_RB_Tree_Iterator : public ACE_RB_Tree_Iterator_Base<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>
{
+
public:
+
// = Initialization and termination methods.
/**
* Create the singular iterator.
@@ -565,6 +700,7 @@ public:
* equal to a singular iterator, etc. etc.
*/
ACE_RB_Tree_Iterator (void);
+
/**
* Constructor. Takes an ACE_RB_Tree over which to iterate, and
* an integer indicating (if non-zero) to position the iterator
@@ -579,31 +715,43 @@ public:
*/
ACE_RB_Tree_Iterator (const ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> &tree,
ACE_RB_Tree_Node<EXT_ID, INT_ID>* entry);
+
/**
* Constructor. Takes an ACE_RB_Tree over which to iterate, and a key;
* the key comes first in order to distinguish the case of EXT_ID == int.
*/
ACE_RB_Tree_Iterator (const EXT_ID &key,
ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> &tree);
+
/// Destructor.
~ACE_RB_Tree_Iterator (void);
+
// = ACE-style iteration methods.
+
/// Move forward by one element in the tree. Returns
/// 0 when all elements have been seen, else 1.
int advance (void);
+
/// Dump the state of an object.
void dump (void) const;
+
// = STL-style iteration methods.
+
/// Prefix advance.
ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> & operator++ (void);
+
/// Postfix advance.
ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> operator++ (int);
+
/// Prefix reverse.
ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> & operator-- (void);
+
/// Postfix reverse.
ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> operator-- (int);
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
/**
* Passes back the <entry> under the iterator. Returns 0 if
* the iteration has completed, otherwise 1. This method must
@@ -616,32 +764,42 @@ public:
* from the derived classes and placed in the base class.
*/
int next (ACE_RB_Tree_Node<EXT_ID, INT_ID> *&next_entry) const;
+
// = DEPRECATED methods. Please migrate your code to use the new methods instead
+
/// @deprecated
/// Accessor for key of node under iterator (if any).
EXT_ID *key (void);
+
/// @deprecated
/// Accessor for item of node under iterator (if any).
INT_ID *item (void);
+
/// @deprecated
/// Move to the first item in the iteration (and in the tree).
int first (void);
+
/// @deprecated
/// Move to the last item in the iteration (and in the tree).
int last (void);
+
/// @deprecated
/// Move to the next item in the iteration (and in the tree).
int next (void);
+
/// @deprecated
/// Move to the previous item in the iteration (and in the tree).
int previous (void);
+
/**
* @deprecated: use the base class <done> method instead.
* Returns 0 if the iterator is positioned over a valid ACE_RB_Tree
* node, returns 1 if not.
*/
int is_done (void);
+
};
+
/**
* @class ACE_RB_Tree_Reverse_Iterator
*
@@ -650,7 +808,9 @@ public:
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
class ACE_RB_Tree_Reverse_Iterator : public ACE_RB_Tree_Iterator_Base<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>
{
+
public:
+
// = Initialization and termination methods.
/**
* Create the singular iterator.
@@ -658,6 +818,7 @@ public:
* equal to a singular iterator, etc. etc.
*/
ACE_RB_Tree_Reverse_Iterator (void);
+
/**
* Constructor. Takes an ACE_RB_Tree over which to iterate, and
* an integer indicating (if non-zero) to position the iterator
@@ -666,37 +827,50 @@ public:
*/
ACE_RB_Tree_Reverse_Iterator (const ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> &tree,
int set_last = 1);
+
/**
* Constructor. Takes an ACE_RB_Tree over which to iterate, and
* a point to a node in the tree.
*/
ACE_RB_Tree_Reverse_Iterator (const ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> &tree,
ACE_RB_Tree_Node<EXT_ID, INT_ID>* entry);
+
/**
* Constructor. Takes an ACE_RB_Tree over which to iterate, and a key;
* the key comes first in order to distinguish the case of EXT_ID == int.
*/
ACE_RB_Tree_Reverse_Iterator (const EXT_ID &key,
ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> &tree);
+
/// Destructor.
~ACE_RB_Tree_Reverse_Iterator (void);
+
// = ACE-style iteration methods.
+
/// Move forward by one element in the tree. Returns
/// 0 when all elements have been seen, else 1.
int advance (void);
+
/// Dump the state of an object.
void dump (void) const;
+
// = STL-style iteration methods.
+
/// Prefix advance.
ACE_RB_Tree_Reverse_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> & operator++ (void);
+
/// Postfix advance.
ACE_RB_Tree_Reverse_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> operator++ (int);
+
/// Prefix reverse.
ACE_RB_Tree_Reverse_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> & operator-- (void);
+
/// Postfix reverse.
ACE_RB_Tree_Reverse_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> operator-- (int);
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
/**
* Passes back the <entry> under the iterator. Returns 0 if
* the iteration has completed, otherwise 1. This method must
@@ -709,17 +883,23 @@ public:
* from the derived classes and placed in the base class.
*/
int next (ACE_RB_Tree_Node<EXT_ID, INT_ID> *&next_entry) const;
+
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/RB_Tree.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/RB_Tree.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("RB_Tree.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
#endif /* ! defined (ACE_RB_TREE_H) */
diff --git a/dep/ACE_wrappers/ace/RB_Tree.inl b/dep/ACE_wrappers/ace/RB_Tree.inl
index 02ff6dc4a5f..7de889abf5b 100644
--- a/dep/ACE_wrappers/ace/RB_Tree.inl
+++ b/dep/ACE_wrappers/ace/RB_Tree.inl
@@ -1,14 +1,19 @@
// -*- C++ -*-
//
// $Id: RB_Tree.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Guard_T.h"
#include "ace/Malloc_Base.h"
#include "ace/Log_Msg.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/////////////////////////////////////////////////////
// template class ACE_RB_Tree_Node<EXT_ID, INT_ID> //
/////////////////////////////////////////////////////
+
// Key accessor.
+
template <class EXT_ID, class INT_ID>
ACE_INLINE EXT_ID &
ACE_RB_Tree_Node<EXT_ID, INT_ID>::key ()
@@ -17,7 +22,9 @@ ACE_RB_Tree_Node<EXT_ID, INT_ID>::key ()
return k_;
}
+
// Item accessor.
+
template <class EXT_ID, class INT_ID>
ACE_INLINE INT_ID &
ACE_RB_Tree_Node<EXT_ID, INT_ID>::item ()
@@ -26,7 +33,9 @@ ACE_RB_Tree_Node<EXT_ID, INT_ID>::item ()
return t_;
}
+
// Set color of the node.
+
template <class EXT_ID, class INT_ID>
ACE_INLINE void
ACE_RB_Tree_Node<EXT_ID, INT_ID>::color (ACE_RB_Tree_Node_Base::RB_Tree_Node_Color c)
@@ -35,7 +44,9 @@ ACE_RB_Tree_Node<EXT_ID, INT_ID>::color (ACE_RB_Tree_Node_Base::RB_Tree_Node_Col
color_ = c;
}
+
// Get color of the node.
+
template <class EXT_ID, class INT_ID>
ACE_INLINE ACE_RB_Tree_Node_Base::RB_Tree_Node_Color
ACE_RB_Tree_Node<EXT_ID, INT_ID>::color ()
@@ -44,7 +55,9 @@ ACE_RB_Tree_Node<EXT_ID, INT_ID>::color ()
return color_;
}
+
// Accessor for node's parent pointer.
+
template <class EXT_ID, class INT_ID>
ACE_INLINE ACE_RB_Tree_Node<EXT_ID, INT_ID> *
ACE_RB_Tree_Node<EXT_ID, INT_ID>::parent ()
@@ -53,7 +66,9 @@ ACE_RB_Tree_Node<EXT_ID, INT_ID>::parent ()
return parent_;
}
+
// Mutator for node's parent pointer.
+
template <class EXT_ID, class INT_ID>
ACE_INLINE void
ACE_RB_Tree_Node<EXT_ID, INT_ID>::parent (ACE_RB_Tree_Node<EXT_ID, INT_ID> * p)
@@ -62,7 +77,10 @@ ACE_RB_Tree_Node<EXT_ID, INT_ID>::parent (ACE_RB_Tree_Node<EXT_ID, INT_ID> * p)
parent_ = p;
}
+
+
// Accessor for node's left child pointer.
+
template <class EXT_ID, class INT_ID>
ACE_INLINE ACE_RB_Tree_Node<EXT_ID, INT_ID> *
ACE_RB_Tree_Node<EXT_ID, INT_ID>::left ()
@@ -71,7 +89,9 @@ ACE_RB_Tree_Node<EXT_ID, INT_ID>::left ()
return left_;
}
+
// Mutator for node's left child pointer.
+
template <class EXT_ID, class INT_ID>
ACE_INLINE void
ACE_RB_Tree_Node<EXT_ID, INT_ID>::left (ACE_RB_Tree_Node<EXT_ID, INT_ID> * l)
@@ -80,7 +100,9 @@ ACE_RB_Tree_Node<EXT_ID, INT_ID>::left (ACE_RB_Tree_Node<EXT_ID, INT_ID> * l)
left_ = l;
}
+
// Accessor for node's right child pointer.
+
template <class EXT_ID, class INT_ID>
ACE_INLINE ACE_RB_Tree_Node<EXT_ID, INT_ID> *
ACE_RB_Tree_Node<EXT_ID, INT_ID>::right ()
@@ -89,7 +111,9 @@ ACE_RB_Tree_Node<EXT_ID, INT_ID>::right ()
return right_;
}
+
// Mutator for node's right child pointer.
+
template <class EXT_ID, class INT_ID>
ACE_INLINE void
ACE_RB_Tree_Node<EXT_ID, INT_ID>::right (ACE_RB_Tree_Node<EXT_ID, INT_ID> * r)
@@ -98,42 +122,55 @@ ACE_RB_Tree_Node<EXT_ID, INT_ID>::right (ACE_RB_Tree_Node<EXT_ID, INT_ID> * r)
right_ = r;
}
+
////////////////////////////////////////////////////////////////////////
// template class ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> //
////////////////////////////////////////////////////////////////////////
+
// Initialize an RB Tree.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int
ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::open (ACE_Allocator *alloc)
{
ACE_TRACE ("ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::open");
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
// Calling this->close_i () ensures we release previously allocated
// memory before allocating new memory.
this->close_i ();
+
// If we were passed an allocator use it,
// otherwise use the default instance.
+
if (alloc == 0)
alloc = ACE_Allocator::instance ();
+
this->allocator_ = alloc;
+
return 0;
}
+
// Close down an RB_Tree and release dynamically allocated
// resources.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int
ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::close (void)
{
ACE_TRACE ("ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::close");
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
return this->close_i ();
}
+
// Associate <ext_id> with <int_id>. If <ext_id> is already in the
// tree then the <ACE_RB_Tree_Node> is not changed. Returns 0 if a
// new entry is bound successfully, returns 1 if an attempt is made
// to bind an existing entry, and returns -1 if failures occur.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int
ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::bind (const EXT_ID &ext_id,
@@ -141,13 +178,16 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::bind (const EXT_ID &ext_id,
{
ACE_TRACE ("ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::bind (const EXT_ID &item, const INT_ID &int_id)");
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
ACE_RB_Tree_Node<EXT_ID, INT_ID> *entry;
return this->insert_i (ext_id, int_id, entry);
}
+
// Same as a normal bind, except the tree entry is also passed back
// to the caller. The entry in this case will either be the newly
// created entry, or the existing one.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int
ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::bind (const EXT_ID &ext_id,
@@ -157,14 +197,17 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::bind (const EXT_ID &ext_id,
ACE_TRACE ("ACE_RB_Tree::bind (const EXT_ID &ext_id, const INT_ID &int_id, "
"ACE_RB_Tree_Node<EXT_ID, INT_ID> *&entry)");
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
return this->insert_i (ext_id, int_id, entry);
}
+
// Associate <ext_id> with <int_id> if and only if <ext_id> is not
// in the tree. If <ext_id> is already in the tree then the <int_id>
// parameter is assigned the existing value in the tree. Returns 0
// if a new entry is bound successfully, returns 1 if an attempt is
// made to bind an existing entry, and returns -1 if failures occur.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int
ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::trybind (const EXT_ID &ext_id,
@@ -172,18 +215,23 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::trybind (const EXT_ID &ext_
{
ACE_TRACE ("ACE_RB_Tree::trybind (const EXT_ID &ext_id, INT_ID &int_id)");
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
ACE_RB_Tree_Node<EXT_ID, INT_ID> *entry;
int result = this->insert_i (ext_id, int_id, entry);
+
if (result == 1)
{
int_id = entry->item ();
}
+
return result;
}
+
// Same as a normal trybind, except the tree entry is also passed
// back to the caller. The entry in this case will either be the
// newly created entry, or the existing one.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int
ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::trybind (const EXT_ID &ext_id,
@@ -193,19 +241,24 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::trybind (const EXT_ID &ext_
ACE_TRACE ("ACE_RB_Tree::trybind (const EXT_ID &ext_id, INT_ID &int_id, "
"ACE_RB_Tree_Node<EXT_ID, INT_ID> *&entry)");
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
int result = this->insert_i (ext_id, int_id, entry);
+
if (result == 1)
{
int_id = entry->item ();
}
+
return result;
}
+
// Reassociate <ext_id> with <int_id>. If <ext_id> is not in the
// tree then behaves just like <bind>. Returns 0 if a new entry is
// bound successfully, returns 1 if an existing entry was rebound,
// and returns -1 if failures occur.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int
ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::rebind (const EXT_ID &ext_id,
@@ -213,19 +266,24 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::rebind (const EXT_ID &ext_i
{
ACE_TRACE ("ACE_RB_Tree::rebind (const EXT_ID &ext_id, const INT_ID &int_id)");
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
ACE_RB_Tree_Node<EXT_ID, INT_ID> *entry;
int result = this->insert_i (ext_id, int_id, entry);
+
if (result == 1)
{
entry->key () = ext_id;
entry->item () = int_id;
}
+
return result;
}
+
// Same as a normal rebind, except the tree entry is also passed back
// to the caller. The entry in this case will either be the newly
// created entry, or the existing one.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int
ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::rebind (const EXT_ID &ext_id,
@@ -235,20 +293,25 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::rebind (const EXT_ID &ext_i
ACE_TRACE ("ACE_RB_Tree::rebind (const EXT_ID &ext_id, const INT_ID &int_id, "
"ACE_RB_Tree_Node<EXT_ID, INT_ID> *&entry)");
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
int result = this->insert_i (ext_id, int_id, entry);
+
if (result == 1)
{
entry->key () = ext_id;
entry->item () = int_id;
}
+
return result;
}
+
// Associate <ext_id> with <int_id>. If <ext_id> is not in the tree
// then behaves just like <bind>. Otherwise, store the old value of
// <int_id> into the "out" parameter and rebind the new parameters.
// Returns 0 if a new entry is bound successfully, returns 1 if an
// existing entry was rebound, and returns -1 if failures occur.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int
ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::rebind (const EXT_ID &ext_id,
@@ -258,20 +321,25 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::rebind (const EXT_ID &ext_i
ACE_TRACE ("ACE_RB_Tree::rebind (const EXT_ID &ext_id, "
"const INT_ID &int_id, INT_ID &old_int_id)");
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
ACE_RB_Tree_Node<EXT_ID, INT_ID> *entry;
int result = this->insert_i (ext_id, int_id, entry);
+
if (result == 1)
{
old_int_id = entry->item ();
entry->key () = ext_id;
entry->item () = int_id;
}
+
return result;
}
+
// Same as a normal rebind, except the tree entry is also passed back
// to the caller. The entry in this case will either be the newly
// created entry, or the existing one.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int
ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::rebind (const EXT_ID &ext_id,
@@ -282,16 +350,20 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::rebind (const EXT_ID &ext_i
ACE_TRACE ("ACE_RB_Tree::rebind (const EXT_ID &ext_id, const INT_ID &int_id,"
"INT_ID &old_int_id, ACE_RB_Tree_Node<EXT_ID, INT_ID> *&entry)");
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
int result = this->insert_i (ext_id, int_id, entry);
+
if (result == 1)
{
old_int_id = entry->item ();
entry->key () = ext_id;
entry->item () = int_id;
}
+
return result;
}
+
// Associate <ext_id> with <int_id>. If <ext_id> is not in the tree
// then behaves just like <bind>. Otherwise, store the old values
// of <ext_id> and <int_id> into the "out" parameters and rebind the
@@ -300,6 +372,7 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::rebind (const EXT_ID &ext_i
// full control over memory allocation. Returns 0 if a new entry is
// bound successfully, returns 1 if an existing entry was rebound,
// and returns -1 if failures occur.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int
ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::rebind (const EXT_ID &ext_id,
@@ -310,8 +383,10 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::rebind (const EXT_ID &ext_i
ACE_TRACE ("ACE_RB_Tree::rebind (const EXT_ID &ext_id, const INT_ID &int_id,"
"EXT_ID &old_ext_id, INT_ID &old_int_id)");
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
ACE_RB_Tree_Node<EXT_ID, INT_ID> *entry;
int result = this->insert_i (ext_id, int_id, entry);
+
if (result == 1)
{
old_ext_id = entry->key ();
@@ -319,12 +394,15 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::rebind (const EXT_ID &ext_i
entry->key () = ext_id;
entry->item () = int_id;
}
+
return result;
}
+
// Same as a normal rebind, except the tree entry is also passed back
// to the caller. The entry in this case will either be the newly
// created entry, or the existing one.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int
ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::rebind (const EXT_ID &ext_id,
@@ -337,7 +415,9 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::rebind (const EXT_ID &ext_i
"EXT_ID &old_ext_id, INT_ID &old_int_id, "
"ACE_RB_Tree_Node<EXT_ID, INT_ID> *&entry)");
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
int result = this->insert_i (ext_id, int_id, entry);
+
if (result == 1)
{
old_ext_id = entry->key ();
@@ -345,11 +425,14 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::rebind (const EXT_ID &ext_i
entry->key () = ext_id;
entry->item () = int_id;
}
+
return result;
}
+
// Locate <ext_id> and pass out parameter via <int_id>. If found,
// return 0, returns -1 if not found.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int
ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::find (const EXT_ID &ext_id,
@@ -357,16 +440,21 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::find (const EXT_ID &ext_id,
{
ACE_TRACE ("ACE_RB_Tree::find (const EXT_ID &ext_id, INT_ID &int_id)");
ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
ACE_RB_Tree_Node<EXT_ID, INT_ID> *entry = 0;
+
int result = this->find_i (ext_id, entry);
if (result == 0)
{
int_id = entry->item ();
}
+
return result;
}
+
// Locate <ext_id> and pass out parameter via <entry>. If found,
// return 0, returns -1 if not found.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int
ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::find (const EXT_ID &ext_id,
@@ -374,20 +462,25 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::find (const EXT_ID &ext_id,
{
ACE_TRACE ("ACE_RB_Tree::find (const EXT_ID &ext_id, ACE_RB_Tree_Node<EXT_ID, INT_ID> *&entry)");
ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
return this->find_i (ext_id, entry);
}
+
// Unbind (remove) the <ext_id> from the tree. Don't return the
// <int_id> to the caller (this is useful for collections where the
// <int_id>s are *not* dynamically allocated...).
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int
ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::unbind (const EXT_ID &ext_id)
{
ACE_TRACE ("ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::unbind (const EXT_ID &ext_id)");
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
INT_ID int_id;
int result = this->remove_i (ext_id, int_id);
+
// Remap the return codes from the internal method: this
// is maintained this way in support of deprecated methods,
// and will be cleaned up when these methods are removed.
@@ -404,12 +497,15 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::unbind (const EXT_ID &ext_i
// If an error happened, just break.
break;
}
+
// Return an error if we didn't already return success.
return -1;
}
+
// Break any association of <ext_id>. Returns the value of <int_id>
// in case the caller needs to deallocate memory.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int
ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::unbind (const EXT_ID &ext_id,
@@ -417,7 +513,9 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::unbind (const EXT_ID &ext_i
{
ACE_TRACE ("ACE_RB_Tree::unbind (const EXT_ID &ext_id, INT_ID &int_id)");
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
int result = this->remove_i (ext_id, int_id);
+
// Remap the return codes from the internal method: this
// is maintained this way in support of deprecated methods,
// and will be cleaned up when these methods are removed.
@@ -434,10 +532,12 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::unbind (const EXT_ID &ext_i
// If an error happened, just break.
break;
}
+
// Return an error if we didn't already return success.
return -1;
}
+
// Remove entry from the tree. This method should be used with *extreme*
// caution, and only for optimization purposes. The node being passed
// in had better have been allocated by the tree that is unbinding it.
@@ -447,15 +547,18 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::unbind (ACE_RB_Tree_Node<EX
{
ACE_TRACE ("ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::unbind (ACE_RB_Tree_Node<EXT_ID, INT_ID> *entry)");
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
return this->remove_i (entry);
}
+
// Returns a reference to the underlying <ACE_LOCK>. This makes it
// possible to acquire the lock explicitly, which can be useful in
// some cases if you instantiate the <ACE_Atomic_Op> with an
// <ACE_Recursive_Mutex> or <ACE_Process_Mutex>, or if you need to
// guard the state of an iterator. NOTE: the right name would be
// <lock>, but HP/C++ will choke on that!
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE ACE_LOCK &
ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::mutex (void)
@@ -464,7 +567,9 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::mutex (void)
return this->lock_;
}
+
// Dump the state of an object.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE void
ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::dump (void) const
@@ -481,49 +586,64 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::dump (void) const
#endif /* ACE_HAS_DUMP */
}
+
// Return forward iterator positioned at first node in tree.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>
ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::begin (void)
{
ACE_TRACE ("ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::begin");
+
return ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> (*this);
}
+
// Return forward iterator positioned at last node in tree.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>
ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::end (void)
{
ACE_TRACE ("ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::end");
+
return ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> ();
}
+
// Return reverse iterator positioned at last node in tree.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE ACE_RB_Tree_Reverse_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>
ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::rbegin (void)
{
ACE_TRACE ("ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::rbegin");
+
return ACE_RB_Tree_Reverse_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> (*this);
}
+
// Return reverse iterator positioned at first node in tree.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE ACE_RB_Tree_Reverse_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>
ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::rend (void)
{
ACE_TRACE ("ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::rend");
+
return ACE_RB_Tree_Reverse_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> ();
}
+
// Returns a pointer to the item corresponding to the given key,
// or 0 if it cannot find the key in the tree. DEPRECATED.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE INT_ID*
ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::find (const EXT_ID &k)
{
ACE_TRACE ("ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::find (const EXT_ID &k)");
+
// The reinterpret cast is to ensure that when this deprecated
// method is removed, and is replaced (as planned) by a find method
// that takes the same argument signature but returns an int, that
@@ -534,10 +654,12 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::find (const EXT_ID &k)
ace_mon,
this->lock_,
reinterpret_cast<INT_ID*> (0L));
+
ACE_RB_Tree_Node<EXT_ID, INT_ID> *entry = 0;
int result = this->find_i (k, entry);
return (result == 0) ? &(entry->item ()) : 0;
}
+
// Inserts a *copy* of the key and the item into the tree:
// both the key type EXT_ID and the item type INT_ID must have well
// defined semantics for copy construction and < comparison.
@@ -546,6 +668,7 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::find (const EXT_ID &k)
// already exists in the tree, no new item is created, and
// the returned pointer addresses the existing item
// associated with the existing key. DEPRECATED.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE INT_ID*
ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::insert (const EXT_ID &k, const INT_ID &t)
@@ -555,33 +678,42 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::insert (const EXT_ID &k, co
ace_mon,
this->lock_,
reinterpret_cast<INT_ID*> (0L));
+
return this->insert_i (k, t);
}
+
// Removes the item associated with the given key from the
// tree and destroys it. Returns 1 if it found the item
// and successfully destroyed it, 0 if it did not find the
// item, or -1 if an error occurred. DEPRECATED.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int
ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::remove (const EXT_ID &k)
{
ACE_TRACE ("ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::remove");
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
INT_ID i;
return this->remove_i (k, i);
}
+
// Destroys all nodes and sets the root pointer null. DEPRECATED
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE void
ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::clear ()
{
ACE_TRACE ("ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::clear");
ACE_WRITE_GUARD (ACE_LOCK, ace_mon, this->lock_);
+
this->close_i ();
}
+
// Returns the current number of nodes in the tree.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE size_t
ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::current_size () const
@@ -590,10 +722,12 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::current_size () const
return current_size_;
}
+
///////////////////////////////////////////////////////////////////////
// template class //
// ACE_RB_Tree_Iterator_Base<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> //
///////////////////////////////////////////////////////////////////////
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE
ACE_RB_Tree_Iterator_Base<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::ACE_RB_Tree_Iterator_Base (void)
@@ -601,17 +735,22 @@ ACE_RB_Tree_Iterator_Base<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::ACE_RB_Tree_I
{
ACE_TRACE ("ACE_RB_Tree_Iterator_Base<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::ACE_RB_Tree_Iterator_Base (void)");
}
+
// Returns 1 when the iteration has completed, otherwise 0.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int
ACE_RB_Tree_Iterator_Base<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::done (void) const
{
ACE_TRACE ("ACE_RB_Tree_Iterator_Base<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::done");
+
return node_ ? 0 : 1;
}
+
// STL-like iterator dereference operator: returns a reference
// to the node underneath the iterator.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE ACE_RB_Tree_Node<EXT_ID, INT_ID> &
ACE_RB_Tree_Iterator_Base<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::operator* (void) const
@@ -620,8 +759,10 @@ ACE_RB_Tree_Iterator_Base<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::operator* (vo
return *(this->node_);
}
+
// STL-like iterator dereference operator: returns a reference
// to the node underneath the iterator.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE ACE_RB_Tree_Node<EXT_ID, INT_ID> *
ACE_RB_Tree_Iterator_Base<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::operator-> (void) const
@@ -630,7 +771,9 @@ ACE_RB_Tree_Iterator_Base<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::operator-> (v
return this->node_;
}
+
// Returns a reference to the tree over which we're iterating.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>ACE_INLINE const ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> &
ACE_RB_Tree_Iterator_Base<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::tree (void)
{
@@ -638,7 +781,9 @@ ACE_RB_Tree_Iterator_Base<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::tree (void)
return *tree_;
}
+
// Comparison operator: returns 1 if both iterators point to the same position, otherwise 0.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE bool
ACE_RB_Tree_Iterator_Base<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::operator==
@@ -648,7 +793,9 @@ ACE_RB_Tree_Iterator_Base<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::operator==
return (this->node_ == rbt.node_) ? true : false;
}
+
// Comparison operator: returns 1 if the iterators point to different positions, otherwise 0.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE bool
ACE_RB_Tree_Iterator_Base<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::operator!=
@@ -658,38 +805,48 @@ ACE_RB_Tree_Iterator_Base<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::operator!=
return (this->node_ == rbt.node_) ? false : true;
}
+
// Move forward by one element in the tree. Returns 0 when
// there are no more elements in the tree, otherwise 1.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int
ACE_RB_Tree_Iterator_Base<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::forward_i (void)
{
ACE_TRACE ("ACE_RB_Tree_Iterator_Base<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::forward_i");
+
if (node_)
{
node_ = tree_->RB_tree_successor (node_);
}
+
return node_ ? 1 : 0;
}
+
// Move back by one element in the tree. Returns 0 when
// there are no more elements in the tree, otherwise 1.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int
ACE_RB_Tree_Iterator_Base<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::reverse_i (void)
{
ACE_TRACE ("ACE_RB_Tree_Iterator_Base<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::reverse_i");
+
if (node_)
{
node_ = tree_->RB_tree_predecessor (node_);
}
+
return node_ ? 1 : 0;
}
+
//////////////////////////////////////////////////////////////////
// template class //
// ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> //
//////////////////////////////////////////////////////////////////
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE
ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::ACE_RB_Tree_Iterator (void)
@@ -697,69 +854,88 @@ ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::ACE_RB_Tree_Iterat
{
ACE_TRACE ("ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::ACE_RB_Tree_Iterator (void)");
}
+
// Move forward by one element in the tree. Returns
// 0 when all elements have been seen, else 1.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int
ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::advance (void)
{
ACE_TRACE ("ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::advance");
+
return this->forward_i ();
}
+
// Dump the state of an object.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE void
ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::dump");
+
this->dump_i ();
#endif /* ACE_HAS_DUMP */
}
+
// Prefix advance.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> &
ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::operator++ (void)
{
ACE_TRACE ("ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> operator++ (void)");
+
this->forward_i ();
return *this;
}
+
// Postfix advance.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>
ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::operator++ (int)
{
ACE_TRACE ("ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> operator++ (int)");
+
ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> retv (*this);
++*this;
return retv;
}
+
// Prefix reverse.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> &
ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::operator-- (void)
{
ACE_TRACE ("ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> operator-- (void)");
+
this->reverse_i ();
return *this;
}
+
// Postfix reverse.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>
ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::operator-- (int)
{
ACE_TRACE ("ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> operator-- (int)");
+
ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> retv (*this);
--*this;
return retv;
}
+
// Passes back the <entry> under the iterator. Returns 0 if
// the iteration has completed, otherwise 1. This method must
// be declared and defined in both the derived forward and
@@ -769,20 +945,25 @@ ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::operator-- (int)
// method in the derived forward iterator class. When that
// deprecated method is removed, this method should be removed
// from the derived classes and placed in the base class.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int
ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::next (ACE_RB_Tree_Node<EXT_ID, INT_ID> *&next_entry) const
{
ACE_TRACE ("ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::next");
+
if (this->node_)
{
next_entry = this->node_;
return 1;
}
+
return 0;
}
+
// Accessor for key of node under iterator (if any). DEPRECATED.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE EXT_ID *
ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::key ()
@@ -791,7 +972,9 @@ ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::key ()
return this->node_ ? (&(this->node_->key ())) : 0;
}
+
// Accessor for item of node under iterator (if any). DEPRECATED.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE INT_ID *
ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::item ()
@@ -800,7 +983,9 @@ ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::item ()
return this->node_ ? (&(this->node_->item ())) : 0;
}
+
// Move to the first item in the tree. DEPRECATED.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int
ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::first ()
@@ -810,7 +995,9 @@ ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::first ()
return this->node_ ? 1 : 0;
}
+
// Move to the last item in the tree. DEPRECATED.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int
ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::last ()
@@ -820,8 +1007,10 @@ ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::last ()
return this->node_ ? 1 : 0;
}
+
// Moves to the next item in the tree,
// returns 1 if there is a next item, 0 otherwise. DEPRECATED.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int
ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::next ()
@@ -831,8 +1020,10 @@ ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::next ()
return this->node_ ? 1 : 0;
}
+
// Moves to the previous item in the tree,
// returns 1 if there is a previous item, 0 otherwise. DEPRECATED.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int
ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::previous ()
@@ -842,8 +1033,10 @@ ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::previous ()
return this->node_ ? 1 : 0;
}
+
// Returns 0 if the iterator is positioned over a valid ACE_RB_Tree
// node, returns 1 if not. DEPRECATED.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int
ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::is_done ()
@@ -852,11 +1045,13 @@ ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::is_done ()
return this->node_ ? 0 : 1;
}
+
//////////////////////////////////////////////////////////////////////////
// template class //
// ACE_RB_Tree_Reverse_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> //
//////////////////////////////////////////////////////////////////////////
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE
ACE_RB_Tree_Reverse_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::ACE_RB_Tree_Reverse_Iterator (void)
@@ -864,69 +1059,88 @@ ACE_RB_Tree_Reverse_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::ACE_RB_Tre
{
ACE_TRACE ("ACE_RB_Tree_Reverse_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::ACE_RB_Tree_Reverse_Iterator (void)");
}
+
// Move forward by one element in the tree. Returns
// 0 when all elements have been seen, else 1.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int
ACE_RB_Tree_Reverse_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::advance (void)
{
ACE_TRACE ("ACE_RB_Tree_Reverse_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::advance");
+
return this->reverse_i ();
}
+
// Dump the state of an object.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE void
ACE_RB_Tree_Reverse_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_RB_Tree_Reverse_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::dump");
+
this->dump_i ();
#endif /* ACE_HAS_DUMP */
}
+
// Prefix advance.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE ACE_RB_Tree_Reverse_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> &
ACE_RB_Tree_Reverse_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::operator++ (void)
{
ACE_TRACE ("ACE_RB_Tree_Reverse_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::operator++ (void)");
+
this->reverse_i ();
return *this;
}
+
// Postfix advance.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE ACE_RB_Tree_Reverse_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>
ACE_RB_Tree_Reverse_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::operator++ (int)
{
ACE_TRACE ("ACE_RB_Tree_Reverse_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::operator++ (int)");
+
ACE_RB_Tree_Reverse_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> retv (*this);
++*this;
return retv;
}
+
// Prefix reverse.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE ACE_RB_Tree_Reverse_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> &
ACE_RB_Tree_Reverse_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::operator-- (void)
{
ACE_TRACE ("ACE_RB_Tree_Reverse_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::operator-- (void)");
+
this->forward_i ();
return *this;
}
+
// Postfix reverse.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE ACE_RB_Tree_Reverse_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>
ACE_RB_Tree_Reverse_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::operator-- (int)
{
ACE_TRACE ("ACE_RB_Tree_Reverse_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::operator-- (int)");
+
ACE_RB_Tree_Reverse_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> retv (*this);
--*this;
return retv;
}
+
// Passes back the <entry> under the iterator. Returns 0 if
// the iteration has completed, otherwise 1. This method must
// be declared and defined in both the derived forward and
@@ -936,16 +1150,20 @@ ACE_RB_Tree_Reverse_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::operator--
// method in the derived forward iterator class. When that
// deprecated method is removed, this method should be removed
// from the derived classes and placed in the base class.
+
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int
ACE_RB_Tree_Reverse_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::next (ACE_RB_Tree_Node<EXT_ID, INT_ID> *&next_entry) const
{
ACE_TRACE ("ACE_RB_Tree_Reverse_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::next");
+
if (this->node_)
{
next_entry = this->node_;
return 1;
}
+
return 0;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/RW_Mutex.cpp b/dep/ACE_wrappers/ace/RW_Mutex.cpp
index a99e663d12d..0bf52665615 100644
--- a/dep/ACE_wrappers/ace/RW_Mutex.cpp
+++ b/dep/ACE_wrappers/ace/RW_Mutex.cpp
@@ -7,24 +7,33 @@
*
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
+
#include "ace/RW_Mutex.h"
+
#if defined (ACE_HAS_THREADS)
+
#if !defined (__ACE_INLINE__)
#include "ace/RW_Mutex.inl"
#endif /* __ACE_INLINE__ */
+
#include "ace/Log_Msg.h"
+
ACE_RCSID(ace, RW_Mutex, "$Id: RW_Mutex.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
void
ACE_RW_Mutex::dump (void) const
{
#if defined (ACE_HAS_DUMP)
// ACE_TRACE ("ACE_RW_Mutex::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n")));
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
ACE_RW_Mutex::ACE_RW_Mutex (int type, const ACE_TCHAR *name, void *arg)
: removed_ (0)
{
@@ -34,11 +43,14 @@ ACE_RW_Mutex::ACE_RW_Mutex (int type, const ACE_TCHAR *name, void *arg)
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_RW_Mutex::ACE_RW_Mutex")));
}
+
ACE_RW_Mutex::~ACE_RW_Mutex (void)
{
// ACE_TRACE ("ACE_RW_Mutex::~ACE_RW_Mutex");
this->remove ();
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_THREADS */
diff --git a/dep/ACE_wrappers/ace/RW_Mutex.h b/dep/ACE_wrappers/ace/RW_Mutex.h
index ae735625c46..ffb31124475 100644
--- a/dep/ACE_wrappers/ace/RW_Mutex.h
+++ b/dep/ACE_wrappers/ace/RW_Mutex.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file RW_Mutex.h
@@ -10,17 +11,25 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//==========================================================================
+
#ifndef ACE_RW_MUTEX_H
#define ACE_RW_MUTEX_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
// ACE platform supports some form of threading.
#if defined (ACE_HAS_THREADS)
+
#include "ace/OS_NS_Thread.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_RW_Mutex
*
@@ -36,27 +45,34 @@ public:
ACE_RW_Mutex (int type = USYNC_THREAD,
const ACE_TCHAR *name = 0,
void *arg = 0);
+
/// Implicitly destroy a readers/writer lock
~ACE_RW_Mutex (void);
+
/**
* Explicitly destroy a readers/writer lock. Note that only one
* thread should call this method since it doesn't protect against
* race conditions.
*/
int remove (void);
+
/// Acquire a read lock, but block if a writer hold the lock.
int acquire_read (void);
+
/// Acquire a write lock, but block if any readers or a
/// writer hold the lock.
int acquire_write (void);
+
/**
* Conditionally acquire a read lock (i.e., won't block). Returns
* -1 on failure. If we "failed" because someone else already had
* the lock, @c errno is set to @c EBUSY.
*/
int tryacquire_read (void);
+
/// Conditionally acquire a write lock (i.e., won't block).
int tryacquire_write (void);
+
/**
* Conditionally upgrade a read lock to a write lock. This only
* works if there are no other readers present, in which case the
@@ -66,12 +82,14 @@ public:
* not checked by the current implementation).
*/
int tryacquire_write_upgrade (void);
+
/**
* Note, for interface uniformity with other synchronization
* wrappers we include the <acquire> method. This is implemented as
* a write-lock to safe...
*/
int acquire (void);
+
/**
* Note, for interface uniformity with other synchronization
* wrappers we include the <tryacquire> method. This is implemented
@@ -80,33 +98,45 @@ public:
* set to @c EBUSY.
*/
int tryacquire (void);
+
/// Unlock a readers/writer lock.
int release (void);
+
/// Return the underlying lock.
const ACE_rwlock_t &lock (void) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
/// Readers/writer lock.
ACE_rwlock_t lock_;
+
/// Keeps track of whether <remove> has been called yet to avoid
/// multiple <remove> calls, e.g., explicitly and implicitly in the
/// destructor. This flag isn't protected by a lock, so make sure
/// that you don't have multiple threads simultaneously calling
/// <remove> on the same object, which is a bad idea anyway...
int removed_;
+
private:
// = Prevent assignment and initialization.
void operator= (const ACE_RW_Mutex &);
ACE_RW_Mutex (const ACE_RW_Mutex &);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/RW_Mutex.inl"
#endif /* __ACE_INLINE__ */
+
#endif /* ACE_HAS_THREADS */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_RW_MUTEX_H */
diff --git a/dep/ACE_wrappers/ace/RW_Mutex.inl b/dep/ACE_wrappers/ace/RW_Mutex.inl
index 3befd5228e2..b26dc986cc1 100644
--- a/dep/ACE_wrappers/ace/RW_Mutex.inl
+++ b/dep/ACE_wrappers/ace/RW_Mutex.inl
@@ -1,13 +1,16 @@
// -*- C++ -*-
//
// $Id: RW_Mutex.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE const ACE_rwlock_t &
ACE_RW_Mutex::lock (void) const
{
// ACE_TRACE ("ACE_RW_Mutex::lock");
return this->lock_;
}
+
ACE_INLINE int
ACE_RW_Mutex::remove (void)
{
@@ -20,52 +23,61 @@ ACE_RW_Mutex::remove (void)
}
return result;
}
+
ACE_INLINE int
ACE_RW_Mutex::acquire_read (void)
{
// ACE_TRACE ("ACE_RW_Mutex::acquire_read");
return ACE_OS::rw_rdlock (&this->lock_);
}
+
ACE_INLINE int
ACE_RW_Mutex::acquire_write (void)
{
// ACE_TRACE ("ACE_RW_Mutex::acquire_write");
return ACE_OS::rw_wrlock (&this->lock_);
}
+
ACE_INLINE int
ACE_RW_Mutex::acquire (void)
{
// ACE_TRACE ("ACE_RW_Mutex::acquire");
return ACE_OS::rw_wrlock (&this->lock_);
}
+
ACE_INLINE int
ACE_RW_Mutex::tryacquire_read (void)
{
// ACE_TRACE ("ACE_RW_Mutex::tryacquire_read");
return ACE_OS::rw_tryrdlock (&this->lock_);
}
+
ACE_INLINE int
ACE_RW_Mutex::tryacquire_write (void)
{
// ACE_TRACE ("ACE_RW_Mutex::tryacquire_write");
return ACE_OS::rw_trywrlock (&this->lock_);
}
+
ACE_INLINE int
ACE_RW_Mutex::tryacquire_write_upgrade (void)
{
// ACE_TRACE ("ACE_RW_Mutex::tryacquire_write_upgrade");
return ACE_OS::rw_trywrlock_upgrade (&this->lock_);
}
+
ACE_INLINE int
ACE_RW_Mutex::tryacquire (void)
{
// ACE_TRACE ("ACE_RW_Mutex::tryacquire");
return this->tryacquire_write ();
}
+
ACE_INLINE int
ACE_RW_Mutex::release (void)
{
// ACE_TRACE ("ACE_RW_Mutex::release");
return ACE_OS::rw_unlock (&this->lock_);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/RW_Process_Mutex.cpp b/dep/ACE_wrappers/ace/RW_Process_Mutex.cpp
index 124d4ae2cb4..72a23b89d67 100644
--- a/dep/ACE_wrappers/ace/RW_Process_Mutex.cpp
+++ b/dep/ACE_wrappers/ace/RW_Process_Mutex.cpp
@@ -1,23 +1,32 @@
// $Id: RW_Process_Mutex.cpp 81509 2008-04-28 22:00:49Z shuston $
+
#include "ace/RW_Process_Mutex.h"
#include "ace/Log_Msg.h"
#include "ace/ACE.h"
+
ACE_RCSID(ace, RW_Process_Mutex, "$Id: RW_Process_Mutex.cpp 81509 2008-04-28 22:00:49Z shuston $")
+
#if !defined (__ACE_INLINE__)
#include "ace/RW_Process_Mutex.inl"
#endif /* __ACE_INLINE__ */
+
#include "ace/Malloc_T.h"
+
#if defined (ACE_WIN32)
#include "ace/OS_NS_fcntl.h"
#endif /* ACE_WIN32 */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_RW_Process_Mutex)
+
const ACE_TCHAR *
ACE_RW_Process_Mutex::unique_name (void)
{
ACE::unique_name (this, this->name_, ACE_UNIQUE_NAME_LEN);
return this->name_;
}
+
ACE_RW_Process_Mutex::ACE_RW_Process_Mutex (const ACE_TCHAR *name,
int flags,
mode_t mode )
@@ -25,10 +34,12 @@ ACE_RW_Process_Mutex::ACE_RW_Process_Mutex (const ACE_TCHAR *name,
{
// ACE_TRACE ("ACE_RW_Process_Mutex::ACE_RW_Process_Mutex");
}
+
ACE_RW_Process_Mutex::~ACE_RW_Process_Mutex (void)
{
// ACE_TRACE ("ACE_RW_Process_Mutex::~ACE_RW_Process_Mutex");
}
+
void
ACE_RW_Process_Mutex::dump (void) const
{
@@ -39,5 +50,6 @@ ACE_RW_Process_Mutex::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/RW_Process_Mutex.h b/dep/ACE_wrappers/ace/RW_Process_Mutex.h
index 23268d77edd..d6bb39f67c9 100644
--- a/dep/ACE_wrappers/ace/RW_Process_Mutex.h
+++ b/dep/ACE_wrappers/ace/RW_Process_Mutex.h
@@ -9,16 +9,23 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_RW_PROCESS_MUTEX_H
#define ACE_RW_PROCESS_MUTEX_H
+
#include /**/ "ace/pre.h"
+
#include "ace/File_Lock.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Default_Constants.h"
#include "ace/OS_NS_fcntl.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_RW_Process_Mutex
*
@@ -48,17 +55,21 @@ public:
int flags = O_CREAT|O_RDWR,
mode_t mode = S_IRUSR | S_IWUSR );
#endif /* ACE_WIN32 */
+
~ACE_RW_Process_Mutex (void);
+
/**
* Explicitly destroy the mutex. Note that only one thread should
* call this method since it doesn't protect against race
* conditions.
*/
int remove (void);
+
/// Same as acquire_write().
/// Acquire lock ownership; blocks until the lock is acquired or the
/// operation fails.
int acquire (void);
+
/**
* Same as tryacquire_write().
* Try to acquire the lock, but do not block if the lock is not immediately
@@ -68,14 +79,18 @@ public:
* to @c EBUSY.
*/
int tryacquire (void);
+
/// Release lock.
int release (void);
+
/// Acquire read lock; blocks until the lock is acquired or the
/// operation fails.
int acquire_read (void);
+
/// Acquire write lock; blocks until the lock is acquired or the
/// operation fails.
int acquire_write (void);
+
/**
* Try to acquire the read lock, but do not block if the lock is not
* immediately acquired.
@@ -84,6 +99,7 @@ public:
* to @c EBUSY.
*/
int tryacquire_read (void);
+
/**
* Try to acquire the write lock, but do not block if the lock is not
* immediately acquired.
@@ -92,28 +108,38 @@ public:
* to @c EBUSY.
*/
int tryacquire_write (void);
+
/// Attempt to upgrade a read lock to a write lock. Returns 0 on
/// success, -1 on failure.
int tryacquire_write_upgrade (void);
+
/// Return the underlying lock.
const ACE_File_Lock &lock (void) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// If the user does not provide a name we generate a unique name in
/// this buffer.
ACE_TCHAR name_[ACE_UNIQUE_NAME_LEN];
+
/// Create and return the unique name.
const ACE_TCHAR *unique_name (void);
+
/// We need this to get the readers/writer semantics...
ACE_File_Lock lock_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/RW_Process_Mutex.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_RW_PROCESS_MUTEX_H */
diff --git a/dep/ACE_wrappers/ace/RW_Process_Mutex.inl b/dep/ACE_wrappers/ace/RW_Process_Mutex.inl
index 60b54bdf564..42e92270a87 100644
--- a/dep/ACE_wrappers/ace/RW_Process_Mutex.inl
+++ b/dep/ACE_wrappers/ace/RW_Process_Mutex.inl
@@ -1,65 +1,77 @@
// -*- C++ -*-
//
// $Id: RW_Process_Mutex.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Explicitly destroy the mutex.
ACE_INLINE int
ACE_RW_Process_Mutex::remove (void)
{
return this->lock_.remove ();
}
+
// Acquire lock ownership (wait on priority queue if necessary).
ACE_INLINE int
ACE_RW_Process_Mutex::acquire (void)
{
return this->lock_.acquire ();
}
+
// Conditionally acquire lock (i.e., don't wait on queue).
ACE_INLINE int
ACE_RW_Process_Mutex::tryacquire (void)
{
return this->lock_.tryacquire ();
}
+
// Release lock and unblock a thread at head of priority queue.
ACE_INLINE int
ACE_RW_Process_Mutex::release (void)
{
return this->lock_.release ();
}
+
// Acquire lock ownership (wait on priority queue if necessary).
ACE_INLINE int
ACE_RW_Process_Mutex::acquire_read (void)
{
return this->lock_.acquire_read ();
}
+
// Acquire lock ownership (wait on priority queue if necessary).
ACE_INLINE int
ACE_RW_Process_Mutex::acquire_write (void)
{
return this->lock_.acquire_write ();
}
+
// Conditionally acquire a lock (i.e., won't block).
ACE_INLINE int
ACE_RW_Process_Mutex::tryacquire_read (void)
{
return this->lock_.tryacquire_read ();
}
+
// Conditionally acquire a lock (i.e., won't block).
ACE_INLINE int
ACE_RW_Process_Mutex::tryacquire_write (void)
{
return this->lock_.tryacquire_write ();
}
+
// Conditionally upgrade a lock (i.e., won't block).
ACE_INLINE int
ACE_RW_Process_Mutex::tryacquire_write_upgrade (void)
{
return this->lock_.tryacquire_write_upgrade ();
}
+
ACE_INLINE const ACE_File_Lock &
ACE_RW_Process_Mutex::lock (void) const
{
// ACE_TRACE ("ACE_RW_Process_Mutex::lock");
return this->lock_;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/RW_Thread_Mutex.cpp b/dep/ACE_wrappers/ace/RW_Thread_Mutex.cpp
index 6af6ba229e3..bd1b2ad6111 100644
--- a/dep/ACE_wrappers/ace/RW_Thread_Mutex.cpp
+++ b/dep/ACE_wrappers/ace/RW_Thread_Mutex.cpp
@@ -7,21 +7,30 @@
*
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
+
#include "ace/RW_Thread_Mutex.h"
+
#if defined (ACE_HAS_THREADS)
+
#if !defined (__ACE_INLINE__)
#include "ace/RW_Thread_Mutex.inl"
#endif /* __ACE_INLINE__ */
+
#include "ace/Guard_T.h"
+
ACE_RCSID(ace, RW_Thread_Mutex, "$Id: RW_Thread_Mutex.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_RW_Thread_Mutex)
+
ACE_RW_Thread_Mutex::ACE_RW_Thread_Mutex (const ACE_TCHAR *name,
void *arg)
: ACE_RW_Mutex (USYNC_THREAD, name, arg)
{
// ACE_TRACE ("ACE_RW_Thread_Mutex::ACE_RW_Thread_Mutex");
}
+
void
ACE_RW_Thread_Mutex::dump (void) const
{
@@ -30,6 +39,8 @@ ACE_RW_Thread_Mutex::dump (void) const
ACE_RW_Mutex::dump ();
#endif /* ACE_HAS_DUMP */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_THREADS */
diff --git a/dep/ACE_wrappers/ace/RW_Thread_Mutex.h b/dep/ACE_wrappers/ace/RW_Thread_Mutex.h
index dc76ee94514..b8c1c341754 100644
--- a/dep/ACE_wrappers/ace/RW_Thread_Mutex.h
+++ b/dep/ACE_wrappers/ace/RW_Thread_Mutex.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file RW_Thread_Mutex.h
@@ -10,19 +11,26 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//==========================================================================
+
#ifndef ACE_RW_THREAD_MUTEX_H
#define ACE_RW_THREAD_MUTEX_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if !defined (ACE_HAS_THREADS)
# include "ace/Null_Mutex.h"
#else /* ACE_HAS_THREADS */
// ACE platform supports some form of threading.
+
#include "ace/RW_Mutex.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_RW_Thread_Mutex
*
@@ -33,8 +41,10 @@ class ACE_Export ACE_RW_Thread_Mutex : public ACE_RW_Mutex
public:
ACE_RW_Thread_Mutex (const ACE_TCHAR *name = 0,
void *arg = 0);
+
/// Default dtor.
~ACE_RW_Thread_Mutex (void);
+
/**
* Conditionally upgrade a read lock to a write lock. This only
* works if there are no other readers present, in which case the
@@ -44,16 +54,22 @@ public:
* not checked by the current implementation).
*/
int tryacquire_write_upgrade (void);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/RW_Thread_Mutex.inl"
#endif /* __ACE_INLINE__ */
+
#endif /* !ACE_HAS_THREADS */
+
#include /**/ "ace/post.h"
#endif /* ACE_RW_THREAD_MUTEX_H */
diff --git a/dep/ACE_wrappers/ace/RW_Thread_Mutex.inl b/dep/ACE_wrappers/ace/RW_Thread_Mutex.inl
index eee6fa0d127..9e41cd9d967 100644
--- a/dep/ACE_wrappers/ace/RW_Thread_Mutex.inl
+++ b/dep/ACE_wrappers/ace/RW_Thread_Mutex.inl
@@ -1,15 +1,19 @@
// -*- C++ -*-
//
// $Id: RW_Thread_Mutex.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE int
ACE_RW_Thread_Mutex::tryacquire_write_upgrade (void)
{
// ACE_TRACE ("ACE_RW_Thread_Mutex::tryacquire_write_upgrade");
return ACE_OS::rw_trywrlock_upgrade (&this->lock_);
}
+
ACE_INLINE
ACE_RW_Thread_Mutex::~ACE_RW_Thread_Mutex (void)
{
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Reactor.cpp b/dep/ACE_wrappers/ace/Reactor.cpp
index adb6d400722..024a36129d2 100644
--- a/dep/ACE_wrappers/ace/Reactor.cpp
+++ b/dep/ACE_wrappers/ace/Reactor.cpp
@@ -1,8 +1,11 @@
// $Id: Reactor.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Reactor.h"
+
#if !defined (ACE_LACKS_ACE_SVCCONF)
# include "ace/Service_Config.h"
#endif /* !ACE_LACKS_ACE_SVCCONF */
+
/*
* Hook to specialize the includes directly with the concrete
* Reactor type, e.g., select, thread pool reactor
@@ -33,28 +36,36 @@
# include "ace/WFMO_Reactor.h"
# endif /* ACE_USE_MSG_WFMO_REACTOR_FOR_REACTOR_IMPL */
#endif /* !defined (ACE_WIN32) || !defined (ACE_HAS_WINSOCK2) || (ACE_HAS_WINSOCK2 == 0) || defined (ACE_USE_SELECT_REACTOR_FOR_REACTOR_IMPL) */
+
/*
* End comment hook.
*/
//@@ REACTOR_SPL_COMMENT_INCLUDE_END_HOOK
+
#include "ace/Static_Object_Lock.h"
#include "ace/Framework_Component.h"
#include "ace/Guard_T.h"
#include "ace/Recursive_Thread_Mutex.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Reactor.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID (ace,
Reactor,
"$Id: Reactor.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_Reactor)
+
ACE_Reactor::ACE_Reactor (ACE_Reactor_Impl *impl,
bool delete_implementation)
: implementation_ (0),
delete_implementation_ (delete_implementation)
{
this->implementation (impl);
+
if (this->implementation () == 0)
{
/*
@@ -90,34 +101,42 @@ ACE_Reactor::ACE_Reactor (ACE_Reactor_Impl *impl,
ACE_WFMO_Reactor);
#endif /* ACE_USE_MSG_WFMO_REACTOR_FOR_REACTOR_IMPL */
#endif /* !defined (ACE_WIN32) || !defined (ACE_HAS_WINSOCK2) || (ACE_HAS_WINSOCK2 == 0) || defined (ACE_USE_SELECT_REACTOR_FOR_REACTOR_IMPL) */
+
/*
* End hook.
*/
//@@ REACTOR_SPL_CONSTRUCTOR_COMMENT_HOOK_END
+
this->implementation (impl);
this->delete_implementation_ = true;
}
}
+
ACE_Reactor::~ACE_Reactor (void)
{
this->implementation ()->close ();
if (this->delete_implementation_)
delete this->implementation ();
}
+
// Process-wide ACE_Reactor.
ACE_Reactor *ACE_Reactor::reactor_ = 0;
+
// Controls whether the Reactor is deleted when we shut down (we can
// only delete it safely if we created it!)
bool ACE_Reactor::delete_reactor_ = false;
+
ACE_Reactor *
ACE_Reactor::instance (void)
{
ACE_TRACE ("ACE_Reactor::instance");
+
if (ACE_Reactor::reactor_ == 0)
{
// Perform Double-Checked Locking Optimization.
ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon,
*ACE_Static_Object_Lock::instance (), 0));
+
if (ACE_Reactor::reactor_ == 0)
{
ACE_NEW_RETURN (ACE_Reactor::reactor_,
@@ -129,28 +148,36 @@ ACE_Reactor::instance (void)
}
return ACE_Reactor::reactor_;
}
+
ACE_Reactor *
ACE_Reactor::instance (ACE_Reactor *r, bool delete_reactor)
{
ACE_TRACE ("ACE_Reactor::instance");
+
ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon,
*ACE_Static_Object_Lock::instance (), 0));
ACE_Reactor *t = ACE_Reactor::reactor_;
ACE_Reactor::delete_reactor_ = delete_reactor;
+
ACE_Reactor::reactor_ = r;
+
// We can't register the Reactor singleton as a framework component twice.
// Therefore we test to see if we had an existing reactor instance, which
// if so means it must have already been registered.
if (t == 0)
ACE_REGISTER_FRAMEWORK_COMPONENT(ACE_Reactor, ACE_Reactor::reactor_);
+
return t;
}
+
void
ACE_Reactor::close_singleton (void)
{
ACE_TRACE ("ACE_Reactor::close_singleton");
+
ACE_MT (ACE_GUARD (ACE_Recursive_Thread_Mutex, ace_mon,
*ACE_Static_Object_Lock::instance ()));
+
if (ACE_Reactor::delete_reactor_)
{
delete ACE_Reactor::reactor_;
@@ -158,16 +185,19 @@ ACE_Reactor::close_singleton (void)
ACE_Reactor::delete_reactor_ = false;
}
}
+
const ACE_TCHAR *
ACE_Reactor::dll_name (void)
{
return ACE_TEXT ("ACE");
}
+
const ACE_TCHAR *
ACE_Reactor::name (void)
{
return ACE_TEXT ("ACE_Reactor");
}
+
int
ACE_Reactor::check_reconfiguration (ACE_Reactor *)
{
@@ -180,15 +210,19 @@ ACE_Reactor::check_reconfiguration (ACE_Reactor *)
#endif /* ! ACE_HAS_WINCE || ! ACE_LACKS_ACE_SVCCONF */
return 0;
}
+
int
ACE_Reactor::run_reactor_event_loop (REACTOR_EVENT_HOOK eh)
{
ACE_TRACE ("ACE_Reactor::run_reactor_event_loop");
+
if (this->reactor_event_loop_done ())
return 0;
+
while (1)
{
int const result = this->implementation_->handle_events ();
+
if (eh != 0 && (*eh)(this))
continue;
else if (result == -1 && this->implementation_->deactivated ())
@@ -196,17 +230,22 @@ ACE_Reactor::run_reactor_event_loop (REACTOR_EVENT_HOOK eh)
else if (result == -1)
return -1;
}
+
ACE_NOTREACHED (return 0;)
}
+
int
ACE_Reactor::run_alertable_reactor_event_loop (REACTOR_EVENT_HOOK eh)
{
ACE_TRACE ("ACE_Reactor::run_alertable_reactor_event_loop");
+
if (this->reactor_event_loop_done ())
return 0;
+
while (1)
{
int const result = this->implementation_->alertable_handle_events ();
+
if (eh != 0 && (*eh)(this))
continue;
else if (result == -1 && this->implementation_->deactivated ())
@@ -214,18 +253,23 @@ ACE_Reactor::run_alertable_reactor_event_loop (REACTOR_EVENT_HOOK eh)
else if (result == -1)
return -1;
}
+
ACE_NOTREACHED (return 0;)
}
+
int
ACE_Reactor::run_reactor_event_loop (ACE_Time_Value &tv,
REACTOR_EVENT_HOOK eh)
{
ACE_TRACE ("ACE_Reactor::run_reactor_event_loop");
+
if (this->reactor_event_loop_done ())
return 0;
+
while (1)
{
int result = this->implementation_->handle_events (tv);
+
if (eh != 0 && (*eh) (this))
continue;
else if (result == -1)
@@ -251,18 +295,23 @@ ACE_Reactor::run_reactor_event_loop (ACE_Time_Value &tv,
}
// Else there were some events dispatched; go around again
}
+
ACE_NOTREACHED (return 0;)
}
+
int
ACE_Reactor::run_alertable_reactor_event_loop (ACE_Time_Value &tv,
REACTOR_EVENT_HOOK eh)
{
ACE_TRACE ("ACE_Reactor::run_alertable_reactor_event_loop");
+
if (this->reactor_event_loop_done ())
return 0;
+
for (;;)
{
int result = this->implementation_->alertable_handle_events (tv);
+
if (eh != 0 && (*eh)(this))
continue;
else if (result == -1 && this->implementation_->deactivated ())
@@ -271,20 +320,25 @@ ACE_Reactor::run_alertable_reactor_event_loop (ACE_Time_Value &tv,
return result;
}
}
+
int
ACE_Reactor::register_handler (ACE_Event_Handler *event_handler,
ACE_Reactor_Mask mask)
{
// Remember the old reactor.
ACE_Reactor *old_reactor = event_handler->reactor ();
+
// Assign *this* <Reactor> to the <Event_Handler>.
event_handler->reactor (this);
+
int result = this->implementation ()->register_handler (event_handler, mask);
if (result == -1)
// Reset the old reactor in case of failures.
event_handler->reactor (old_reactor);
+
return result;
}
+
int
ACE_Reactor::register_handler (ACE_HANDLE io_handle,
ACE_Event_Handler *event_handler,
@@ -292,33 +346,43 @@ ACE_Reactor::register_handler (ACE_HANDLE io_handle,
{
// Remember the old reactor.
ACE_Reactor *old_reactor = event_handler->reactor ();
+
// Assign *this* <Reactor> to the <Event_Handler>.
event_handler->reactor (this);
+
int result = this->implementation ()->register_handler (io_handle,
event_handler,
mask);
if (result == -1)
// Reset the old reactor in case of failures.
event_handler->reactor (old_reactor);
+
return result;
}
+
#if defined (ACE_WIN32)
+
int
ACE_Reactor::register_handler (ACE_Event_Handler *event_handler,
ACE_HANDLE event_handle)
{
// Remember the old reactor.
ACE_Reactor *old_reactor = event_handler->reactor ();
+
// Assign *this* <Reactor> to the <Event_Handler>.
event_handler->reactor (this);
+
int result = this->implementation ()->register_handler (event_handler,
event_handle);
if (result == -1)
// Reset the old reactor in case of failures.
event_handler->reactor (old_reactor);
+
return result;
}
+
#endif /* ACE_WIN32 */
+
int
ACE_Reactor::register_handler (ACE_HANDLE event_handle,
ACE_HANDLE io_handle,
@@ -327,8 +391,10 @@ ACE_Reactor::register_handler (ACE_HANDLE event_handle,
{
// Remember the old reactor.
ACE_Reactor *old_reactor = event_handler->reactor ();
+
// Assign *this* <Reactor> to the <Event_Handler>.
event_handler->reactor (this);
+
int result = this->implementation ()->register_handler (event_handle,
io_handle,
event_handler,
@@ -336,8 +402,10 @@ ACE_Reactor::register_handler (ACE_HANDLE event_handle,
if (result == -1)
// Reset the old reactor in case of failures.
event_handler->reactor (old_reactor);
+
return result;
}
+
int
ACE_Reactor::register_handler (const ACE_Handle_Set &handles,
ACE_Event_Handler *event_handler,
@@ -345,16 +413,20 @@ ACE_Reactor::register_handler (const ACE_Handle_Set &handles,
{
// Remember the old reactor.
ACE_Reactor *old_reactor = event_handler->reactor ();
+
// Assign *this* <Reactor> to the <Event_Handler>.
event_handler->reactor (this);
+
int result = this->implementation ()->register_handler (handles,
event_handler,
mask);
if (result == -1)
// Reset the old reactor in case of failures.
event_handler->reactor (old_reactor);
+
return result;
}
+
long
ACE_Reactor::schedule_timer (ACE_Event_Handler *event_handler,
const void *arg,
@@ -363,8 +435,10 @@ ACE_Reactor::schedule_timer (ACE_Event_Handler *event_handler,
{
// Remember the old reactor.
ACE_Reactor *old_reactor = event_handler->reactor ();
+
// Assign *this* <Reactor> to the <Event_Handler>.
event_handler->reactor (this);
+
long result = this->implementation ()->schedule_timer (event_handler,
arg,
delta,
@@ -372,23 +446,29 @@ ACE_Reactor::schedule_timer (ACE_Event_Handler *event_handler,
if (result == -1)
// Reset the old reactor in case of failures.
event_handler->reactor (old_reactor);
+
return result;
}
+
int
ACE_Reactor::schedule_wakeup (ACE_Event_Handler *event_handler,
ACE_Reactor_Mask masks_to_be_added)
{
// Remember the old reactor.
ACE_Reactor *old_reactor = event_handler->reactor ();
+
// Assign *this* <Reactor> to the <Event_Handler>.
event_handler->reactor (this);
+
int result = this->implementation ()->schedule_wakeup (event_handler,
masks_to_be_added);
if (result == -1)
// Reset the old reactor in case of failures.
event_handler->reactor (old_reactor);
+
return result;
}
+
int
ACE_Reactor::notify (ACE_Event_Handler *event_handler,
ACE_Reactor_Mask mask,
@@ -400,14 +480,17 @@ ACE_Reactor::notify (ACE_Event_Handler *event_handler,
event_handler->reactor (this);
return this->implementation ()->notify (event_handler, mask, tv);
}
+
int
ACE_Reactor::reset_timer_interval
(long timer_id,
const ACE_Time_Value &interval)
{
ACE_TRACE ("ACE_Reactor::reset_timer_interval");
+
return this->implementation ()->reset_timer_interval (timer_id, interval);
}
+
int
ACE_Reactor::cancel_timer (ACE_Event_Handler *event_handler,
int dont_call_handle_close)
@@ -415,6 +498,7 @@ ACE_Reactor::cancel_timer (ACE_Event_Handler *event_handler,
return this->implementation ()->cancel_timer (event_handler,
dont_call_handle_close);
}
+
int
ACE_Reactor::cancel_timer (long timer_id,
const void **arg,
@@ -424,5 +508,6 @@ ACE_Reactor::cancel_timer (long timer_id,
arg,
dont_call_handle_close);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Reactor.h b/dep/ACE_wrappers/ace/Reactor.h
index b5131f70f0c..223c25b103f 100644
--- a/dep/ACE_wrappers/ace/Reactor.h
+++ b/dep/ACE_wrappers/ace/Reactor.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Reactor.h
@@ -9,33 +10,44 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_REACTOR_H
#define ACE_REACTOR_H
+
#include /**/ "ace/pre.h"
+
// Timer Queue is a complicated template class. A simple forward
// declaration will not work.
#include "ace/Timer_Queuefwd.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
// Contains the timer related interface for the Reactor.
#include "ace/Reactor_Timer_Interface.h"
+
// Event_Handler.h contains the definition of ACE_Reactor_Mask
#include "ace/Event_Handler.h"
+
// Get ACE_Time_Value in
#include "ace/Time_Value.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Reactor_Impl;
class ACE_Handle_Set;
class ACE_Sig_Action;
class ACE_Sig_Handler;
class ACE_Sig_Set;
+
/*
* Hook to specialize the Reactor implementation with the concrete
* Reactor type, for exmaple, select, thread pool reactor known
* at compile time.
*/
//@@ REACTOR_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK
+
/**
* @class ACE_Reactor
*
@@ -60,6 +72,7 @@ public:
/// changes enabled bits).
CLR_MASK = 4
};
+
/**
* You can specify a hook function to event-handling methods that will
* be called after each iteration of event handling. If the hook function
@@ -71,21 +84,28 @@ public:
* as normal, just as if there is no hook function specified.
*/
typedef int (*REACTOR_EVENT_HOOK)(ACE_Reactor *);
+
/// Get pointer to a process-wide ACE_Reactor.
static ACE_Reactor *instance (void);
+
/**
* Set pointer to a process-wide ACE_Reactor and return existing
* pointer. If @a delete_reactor == true then we'll delete the Reactor
* at destruction time.
*/
static ACE_Reactor *instance (ACE_Reactor *, bool delete_reactor = false);
+
/// Delete the dynamically allocated Singleton
static void close_singleton (void);
+
/// Name of the dll in which the dll lives.
static const ACE_TCHAR *dll_name (void);
+
/// Name of the component--ACE_Reactor in this case.
static const ACE_TCHAR *name (void);
+
// = Singleton reactor event loop management methods.
+
// Note that these method ONLY work on the "Singleton Reactor,"
// i.e., the one returned from <ACE_Reactor::instance>.
/**
@@ -100,6 +120,7 @@ public:
*/
static int run_event_loop (void);
static int run_alertable_event_loop (void);
+
/**
* Run the event loop until the <ACE_Reactor::handle_events> or
* <ACE_Reactor::alertable_handle_events> methods returns -1, the
@@ -112,6 +133,7 @@ public:
*/
static int run_event_loop (ACE_Time_Value &tv);
static int run_alertable_event_loop (ACE_Time_Value &tv);
+
/**
* Instruct the <ACE_Reactor::instance> to terminate its event loop
* and notifies the <ACE_Reactor::instance> so that it can wake up
@@ -123,6 +145,7 @@ public:
* @deprecated Use ACE_Reactor::instance()->end_reactor_event_loop() instead
*/
static int end_event_loop (void);
+
/**
* Report if the <ACE_Reactor::instance>'s event loop is finished.
* Note that this method can only be used by the singleton
@@ -132,6 +155,7 @@ public:
* @deprecated Use ACE_Reactor::instance()->reactor_event_loop_done() instead
*/
static int event_loop_done (void);
+
/**
* Resets the <ACE_Reactor::end_event_loop_> static so that the
* <run_event_loop> method can be restarted. Note that this method
@@ -142,13 +166,16 @@ public:
* instead
*/
static void reset_event_loop (void);
+
/**
* The singleton reactor is used by the ACE_Service_Config.
* Therefore, we must check for the reconfiguration request and
* handle it after handling an event.
*/
static int check_reconfiguration (ACE_Reactor *);
+
// = Reactor event loop management methods.
+
// These methods work with an instance of a reactor.
/**
* Run the event loop until the
@@ -157,6 +184,7 @@ public:
*/
int run_reactor_event_loop (REACTOR_EVENT_HOOK = 0);
int run_alertable_reactor_event_loop (REACTOR_EVENT_HOOK = 0);
+
/**
* Run the event loop until the <ACE_Reactor::handle_events> or
* <ACE_Reactor::alertable_handle_events> methods returns -1, the
@@ -167,6 +195,7 @@ public:
REACTOR_EVENT_HOOK = 0);
int run_alertable_reactor_event_loop (ACE_Time_Value &tv,
REACTOR_EVENT_HOOK = 0);
+
/**
* Instruct the Reactor to terminate its event loop and notifies the
* Reactor so that it can wake up and deactivate
@@ -179,11 +208,14 @@ public:
* further dispatching, the notifications will be lost.
*/
int end_reactor_event_loop (void);
+
/// Indicate if the Reactor's event loop has been ended.
int reactor_event_loop_done (void);
+
/// Resets the <ACE_Reactor::end_event_loop_> static so that the
/// <run_event_loop> method can be restarted.
void reset_reactor_event_loop (void);
+
/**
* Create the Reactor using @a implementation. The flag
* @a delete_implementation tells the Reactor whether or not to
@@ -191,12 +223,14 @@ public:
*/
ACE_Reactor (ACE_Reactor_Impl *implementation = 0,
bool delete_implementation = false);
+
/// Close down and release all resources.
/**
* Any notifications that remain queued on this reactor instance are
* lost.
*/
virtual ~ACE_Reactor (void);
+
/**
* Initialize the ACE_Reactor to manage <max_number_of_handles>.
* If <restart> is non-0 then the ACE_Reactor's <handle_events>
@@ -208,21 +242,28 @@ public:
int restart = 0,
ACE_Sig_Handler *signal_handler = 0,
ACE_Timer_Queue *timer_queue = 0);
+
/// Use a user specified signal handler instead.
int set_sig_handler (ACE_Sig_Handler *signal_handler);
+
/// Set a user-specified timer queue.
int timer_queue (ACE_Timer_Queue *tq);
+
/// Return the current ACE_Timer_Queue.
ACE_Timer_Queue *timer_queue (void) const;
+
/// Close down and release all resources.
int close (void);
+
// = Event loop drivers.
+
/**
* Returns non-zero if there are I/O events "ready" for dispatching,
* but does not actually dispatch the event handlers. By default,
* don't block while checking this, i.e., "poll".
*/
int work_pending (const ACE_Time_Value &max_wait_time = ACE_Time_Value::zero);
+
/**
* This event loop driver blocks for up to @a max_wait_time before
* returning. It will return earlier if events occur. Note that
@@ -247,6 +288,7 @@ public:
*/
int handle_events (ACE_Time_Value *max_wait_time = 0);
int alertable_handle_events (ACE_Time_Value *max_wait_time = 0);
+
/**
* This method is just like the one above, except the
* @a max_wait_time value is a reference and can therefore never be
@@ -259,7 +301,9 @@ public:
*/
int handle_events (ACE_Time_Value &max_wait_time);
int alertable_handle_events (ACE_Time_Value &max_wait_time);
+
// = Register and remove handlers.
+
/**
* Register handler for I/O events.
*
@@ -282,6 +326,7 @@ public:
*/
int register_handler (ACE_Event_Handler *event_handler,
ACE_Reactor_Mask mask);
+
/**
* Register handler for I/O events.
*
@@ -291,7 +336,9 @@ public:
int register_handler (ACE_HANDLE io_handle,
ACE_Event_Handler *event_handler,
ACE_Reactor_Mask mask);
+
#if defined (ACE_WIN32)
+
/**
* Register handler for OS events.
*
@@ -310,7 +357,9 @@ public:
*/
int register_handler (ACE_Event_Handler *event_handler,
ACE_HANDLE event_handle = ACE_INVALID_HANDLE);
+
#endif /* ACE_WIN32 */
+
/**
* Register handler for I/O events.
*
@@ -324,6 +373,7 @@ public:
ACE_HANDLE io_handle,
ACE_Event_Handler *event_handler,
ACE_Reactor_Mask mask);
+
/**
* Register handler for multiple I/O events.
*
@@ -335,6 +385,7 @@ public:
int register_handler (const ACE_Handle_Set &handles,
ACE_Event_Handler *event_handler,
ACE_Reactor_Mask masks);
+
/**
* Register handler for signals.
*
@@ -350,6 +401,7 @@ public:
ACE_Sig_Action *new_disp = 0,
ACE_Event_Handler **old_sh = 0,
ACE_Sig_Action *old_disp = 0);
+
/**
* Register handler for multiple signals.
*
@@ -361,6 +413,7 @@ public:
int register_handler (const ACE_Sig_Set &sigset,
ACE_Event_Handler *event_handler,
ACE_Sig_Action *sig_action = 0);
+
/**
* Remove @a masks from @a handle registration.
*
@@ -378,6 +431,7 @@ public:
*/
int remove_handler (ACE_HANDLE handle,
ACE_Reactor_Mask masks);
+
/**
* Remove @a masks from @a event_handler registration.
*
@@ -386,6 +440,7 @@ public:
*/
int remove_handler (ACE_Event_Handler *event_handler,
ACE_Reactor_Mask masks);
+
/**
* Remove @a masks from multiple <handle> registrations.
*
@@ -394,6 +449,7 @@ public:
*/
int remove_handler (const ACE_Handle_Set &handles,
ACE_Reactor_Mask masks);
+
/**
* Remove signal handler registration.
*
@@ -415,6 +471,7 @@ public:
ACE_Sig_Action *new_disp,
ACE_Sig_Action *old_disp = 0,
int sigkey = -1);
+
/**
* Remove multiple signal handler registrations.
*
@@ -423,17 +480,21 @@ public:
* times for every signal in @a sigset.
*/
int remove_handler (const ACE_Sig_Set &sigset);
+
// = Suspend and resume Handlers.
+
/**
* Suspend @a handle temporarily.
*/
int suspend_handler (ACE_HANDLE handle);
+
/**
* Suspend @a event_handler temporarily.
*
* Handle is obtained from ACE_Event_Handler::get_handle().
*/
int suspend_handler (ACE_Event_Handler *event_handler);
+
/**
* Suspend @a handles temporarily.
*
@@ -441,20 +502,24 @@ public:
* @a handles.
*/
int suspend_handler (const ACE_Handle_Set &handles);
+
/**
* Suspend all registered handles temporarily.
*/
int suspend_handlers (void);
+
/**
* Resume @a handle.
*/
int resume_handler (ACE_HANDLE handle);
+
/**
* Resume @a event_handler.
*
* Handle is obtained from ACE_Event_Handler::get_handle().
*/
int resume_handler (ACE_Event_Handler *event_handler);
+
/**
* Resume @a handles.
*
@@ -462,16 +527,20 @@ public:
* <handles>.
*/
int resume_handler (const ACE_Handle_Set &handles);
+
/**
* Resume all registered handles.
*/
int resume_handlers (void);
+
/// Does the reactor allow the application to resume the handle on
/// its own ie. can it pass on the control of handle resumption to
/// the application. A positive value indicates that the handlers
/// are application resumable. A value of 0 indicates otherwise.
int resumable_handler (void);
+
// = Timer management.
+
/**
* Schedule a timer event.
*
@@ -503,6 +572,7 @@ public:
const ACE_Time_Value &delay,
const ACE_Time_Value &interval =
ACE_Time_Value::zero);
+
/**
* Reset recurring timer interval.
*
@@ -516,6 +586,7 @@ public:
*/
virtual int reset_timer_interval (long timer_id,
const ACE_Time_Value &interval);
+
/**
* Cancel timer.
*
@@ -533,6 +604,7 @@ public:
virtual int cancel_timer (long timer_id,
const void **arg = 0,
int dont_call_handle_close = 1);
+
/**
* Cancel all timers associated with event handler.
*
@@ -549,7 +621,9 @@ public:
*/
virtual int cancel_timer (ACE_Event_Handler *event_handler,
int dont_call_handle_close = 1);
+
// = High-level Event_Handler scheduling operations
+
/// Add @a masks_to_be_added to the @a event_handler's entry.
/// @a event_handler must already have been registered.
/// Note that this call does not cause the Reactor to re-examine
@@ -560,6 +634,7 @@ public:
/// use ACE_Reactor::register_handler instead.
int schedule_wakeup (ACE_Event_Handler *event_handler,
ACE_Reactor_Mask masks_to_be_added);
+
/// Add @a masks_to_be_added to the @a handle's entry. <event_handler>
/// associated with @a handle must already have been registered.
/// Note that this call does not cause the Reactor to re-examine
@@ -570,6 +645,7 @@ public:
/// or use ACE_Reactor::register_handler instead.
int schedule_wakeup (ACE_HANDLE handle,
ACE_Reactor_Mask masks_to_be_added);
+
/// Clear @a masks_to_be_cleared from the @a event_handler's entry.
/// Note that this call does not cause the Reactor to re-examine
/// its set of handlers - the new masks will be noticed the next
@@ -579,6 +655,7 @@ public:
/// call, or use ACE_Reactor::register_handler instead.
int cancel_wakeup (ACE_Event_Handler *event_handler,
ACE_Reactor_Mask masks_to_be_cleared);
+
/// Clear @a masks_to_be_cleared from the <handle>'s entry.
/// Note that this call does not cause the Reactor to re-examine
/// its set of handlers - the new masks will be noticed the next
@@ -588,7 +665,9 @@ public:
/// call, or use ACE_Reactor::register_handler instead.
int cancel_wakeup (ACE_HANDLE handle,
ACE_Reactor_Mask masks_to_be_cleared);
+
// = Notification methods.
+
/**
* Dispatch user specified events.
*
@@ -619,6 +698,7 @@ public:
int notify (ACE_Event_Handler *event_handler = 0,
ACE_Reactor_Mask masks = ACE_Event_Handler::EXCEPT_MASK,
ACE_Time_Value *timeout = 0);
+
/**
* Set the maximum number of times that ACE_Reactor will
* iterate and dispatch the ACE_Event_Handlers that are passed in
@@ -630,6 +710,7 @@ public:
* overhead.
*/
void max_notify_iterations (int iterations);
+
/**
* Get the maximum number of times that the ACE_Reactor will
* iterate and dispatch the ACE_Event_Handler's that are passed in
@@ -637,6 +718,7 @@ public:
* <ACE_Message_Queue::dequeue> loop.
*/
int max_notify_iterations (void);
+
/**
* Purge any notifications pending in this reactor for the specified
* ACE_Event_Handler object. If @a eh == 0, all notifications for
@@ -651,7 +733,9 @@ public:
int purge_pending_notifications (ACE_Event_Handler *eh,
ACE_Reactor_Mask =
ACE_Event_Handler::ALL_EVENTS_MASK);
+
// = Assorted helper methods.
+
/**
* Return the Event_Handler associated with @a handle. Return 0 if
* @a handle is not registered.
@@ -660,6 +744,7 @@ public:
* handler before returning it.
*/
ACE_Event_Handler *find_handler (ACE_HANDLE handle);
+
/**
* Check to see if @a handle is associated with a valid Event_Handler
* bound to @a mask. Return the @c event_handler associated with this
@@ -671,6 +756,7 @@ public:
int handler (ACE_HANDLE handle,
ACE_Reactor_Mask mask,
ACE_Event_Handler **event_handler = 0);
+
/**
* Check to see if @a signum is associated with a valid Event_Handler
* bound to a signal. Return the @a event_handler associated with
@@ -678,52 +764,69 @@ public:
*/
int handler (int signum,
ACE_Event_Handler **event_handler = 0);
+
/// Returns true if Reactor has been successfully initialized, else
/// false.
int initialized (void);
+
/// Returns the current size of the Reactor's internal descriptor
/// table.
size_t size (void) const;
+
/// Returns a reference to the Reactor's internal lock.
ACE_Lock &lock (void);
+
/// Wake up all threads in waiting in the event loop
void wakeup_all_threads (void);
+
/// Transfers ownership of Reactor to the @a new_owner.
int owner (ACE_thread_t new_owner,
ACE_thread_t *old_owner = 0);
+
/// Return the ID of the "owner" thread.
int owner (ACE_thread_t *owner);
+
/// Set position of the owner thread.
void requeue_position (int position);
+
/// Get position of the owner thread.
int requeue_position (void);
+
/// Get the existing restart value.
int restart (void);
+
/// Set a new value for restart and return the original value.
int restart (int r);
+
// = Low-level wait_set mask manipulation methods.
+
/// GET/SET/ADD/CLR the dispatch mask "bit" bound with the
/// @a event_handler and @a mask.
int mask_ops (ACE_Event_Handler *event_handler,
ACE_Reactor_Mask mask,
int ops);
+
/// GET/SET/ADD/CLR the dispatch MASK "bit" bound with the @a handle
/// and @a mask.
int mask_ops (ACE_HANDLE handle,
ACE_Reactor_Mask mask,
int ops);
+
// = Low-level ready_set mask manipulation methods.
/// GET/SET/ADD/CLR the ready "bit" bound with the @a event_handler
/// and @a mask.
int ready_ops (ACE_Event_Handler *event_handler,
ACE_Reactor_Mask mask,
int ops);
+
/// GET/SET/ADD/CLR the ready "bit" bound with the <handle> and @a mask.
int ready_ops (ACE_HANDLE handle,
ACE_Reactor_Mask mask,
int ops);
+
/// Get the implementation class
ACE_Reactor_Impl *implementation (void) const;
+
/**
* Returns 0, if the size of the current message has been put in
* @a size returns -1, if not. ACE_HANDLE allows the reactor to
@@ -731,35 +834,48 @@ public:
* implementation.
*/
int current_info (ACE_HANDLE handle, size_t &msg_size);
+
/// Return 1 if we any event associations were made by the reactor
/// for the handles that it waits on, 0 otherwise.
int uses_event_associations (void);
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
/// Dump the state of the object.
void dump (void) const;
+
protected:
/// Set the implementation class.
void implementation (ACE_Reactor_Impl *implementation);
+
/// Delegation/implementation class that all methods will be
/// forwarded to.
ACE_Reactor_Impl *implementation_;
+
/// Flag used to indicate whether we are responsible for cleaning up
/// the implementation instance
bool delete_implementation_;
+
/// Pointer to a process-wide ACE_Reactor singleton.
static ACE_Reactor *reactor_;
+
/// Must delete the reactor_ singleton if true.
static bool delete_reactor_;
+
/// Deny access since member-wise won't work...
ACE_Reactor (const ACE_Reactor &);
ACE_Reactor &operator = (const ACE_Reactor &);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Reactor.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_REACTOR_H */
diff --git a/dep/ACE_wrappers/ace/Reactor.inl b/dep/ACE_wrappers/ace/Reactor.inl
index 5656078ff9d..f3f5b17992c 100644
--- a/dep/ACE_wrappers/ace/Reactor.inl
+++ b/dep/ACE_wrappers/ace/Reactor.inl
@@ -1,13 +1,17 @@
// -*- C++ -*-
//
// $Id: Reactor.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Reactor_Impl.h"
+
/*
* Hook to specialize the Reactor with the concrete implementation
* known at compile time.
*/
//@@ REACTOR_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Run the event loop until the <ACE_Reactor::handle_events> method
// returns -1 or the <end_event_loop> method is invoked.
ACE_INLINE int
@@ -15,99 +19,128 @@ ACE_Reactor::run_event_loop (void)
{
ACE_TRACE ("ACE_Reactor::run_event_loop");
ACE_Reactor *r = ACE_Reactor::instance ();
+
if (r == 0)
return -1;
+
return r->run_reactor_event_loop (ACE_Reactor::check_reconfiguration);
}
+
// Run the event loop until the <ACE_Reactor::handle_events>
// method returns -1, the <end_event_loop> method
// is invoked, or the <ACE_Time_Value> expires.
+
ACE_INLINE int
ACE_Reactor::run_event_loop (ACE_Time_Value &tv)
{
ACE_TRACE ("ACE_Reactor::run_event_loop");
ACE_Reactor *r = ACE_Reactor::instance ();
+
if (r == 0)
return -1;
+
return r->run_reactor_event_loop
(tv, ACE_Reactor::check_reconfiguration);
}
+
// Run the event loop until the <ACE_Reactor::alertable_handle_events> method
// returns -1 or the <end_event_loop> method is invoked.
+
ACE_INLINE int
ACE_Reactor::run_alertable_event_loop (void)
{
ACE_TRACE ("ACE_Reactor::run_alertable_event_loop");
ACE_Reactor *r = ACE_Reactor::instance ();
+
if (r == 0)
return -1;
+
return r->run_alertable_reactor_event_loop (ACE_Reactor::check_reconfiguration);
}
+
// Run the event loop until the <ACE_Reactor::alertable_handle_events>
// method returns -1, the <end_event_loop> method
// is invoked, or the <ACE_Time_Value> expires.
+
ACE_INLINE int
ACE_Reactor::run_alertable_event_loop (ACE_Time_Value &tv)
{
ACE_TRACE ("ACE_Reactor::run_alertable_event_loop");
ACE_Reactor *r = ACE_Reactor::instance ();
+
if (r == 0)
return -1;
+
return r->run_alertable_reactor_event_loop
(tv, ACE_Reactor::check_reconfiguration);
}
+
ACE_INLINE void
ACE_Reactor::reset_event_loop (void)
{
ACE_TRACE ("ACE_Reactor::reset_event_loop");
+
ACE_Reactor::instance ()->reset_reactor_event_loop ();
}
+
ACE_INLINE int
ACE_Reactor::end_event_loop (void)
{
ACE_TRACE ("ACE_Reactor::end_event_loop");
ACE_Reactor::instance ()->end_reactor_event_loop ();
+
return 0;
}
+
ACE_INLINE int
ACE_Reactor::event_loop_done (void)
{
ACE_TRACE ("ACE_Reactor::event_loop_done");
return ACE_Reactor::instance ()->reactor_event_loop_done ();
}
+
ACE_INLINE int
ACE_Reactor::end_reactor_event_loop (void)
{
ACE_TRACE ("ACE_Reactor::end_reactor_event_loop");
+
this->implementation_->deactivate (1);
+
return 0;
}
+
ACE_INLINE void
ACE_Reactor::reset_reactor_event_loop (void)
{
ACE_TRACE ("ACE_Reactor::reset_reactor_event_loop");
+
this->implementation_->deactivate (0);
}
+
ACE_INLINE int
ACE_Reactor::resumable_handler (void)
{
return this->implementation ()->resumable_handler ();
}
+
ACE_INLINE ACE_Reactor_Impl *
ACE_Reactor::implementation (void) const
{
return this->implementation_;
}
+
ACE_INLINE void
ACE_Reactor::implementation (ACE_Reactor_Impl *impl)
{
this->implementation_ = impl;
}
+
ACE_INLINE int
ACE_Reactor::current_info (ACE_HANDLE handle, size_t &size)
{
return this->implementation ()->current_info (handle, size);
}
+
ACE_INLINE int
ACE_Reactor::open (size_t size,
int restart,
@@ -124,46 +157,55 @@ ACE_Reactor::set_sig_handler (ACE_Sig_Handler *signal_handler)
{
return this->implementation ()->set_sig_handler (signal_handler);
}
+
ACE_INLINE int
ACE_Reactor::timer_queue (ACE_Timer_Queue *tq)
{
return this->implementation ()->timer_queue (tq);
}
+
ACE_INLINE ACE_Timer_Queue *
ACE_Reactor::timer_queue (void) const
{
return this->implementation ()->timer_queue ();
}
+
ACE_INLINE int
ACE_Reactor::close (void)
{
return this->implementation ()->close ();
}
+
ACE_INLINE int
ACE_Reactor::work_pending (const ACE_Time_Value &max_wait_time)
{
return this->implementation ()->work_pending (max_wait_time);
}
+
ACE_INLINE int
ACE_Reactor::handle_events (ACE_Time_Value *max_wait_time)
{
return this->implementation ()->handle_events (max_wait_time);
}
+
ACE_INLINE int
ACE_Reactor::alertable_handle_events (ACE_Time_Value *max_wait_time)
{
return this->implementation ()->alertable_handle_events (max_wait_time);
}
+
ACE_INLINE int
ACE_Reactor::handle_events (ACE_Time_Value &max_wait_time)
{
return this->implementation ()->handle_events (max_wait_time);
}
+
ACE_INLINE int
ACE_Reactor::alertable_handle_events (ACE_Time_Value &max_wait_time)
{
return this->implementation ()->alertable_handle_events (max_wait_time);
}
+
ACE_INLINE int
ACE_Reactor::register_handler (int signum,
ACE_Event_Handler *new_sh,
@@ -177,6 +219,7 @@ ACE_Reactor::register_handler (int signum,
old_sh,
old_disp);
}
+
ACE_INLINE int
ACE_Reactor::register_handler (const ACE_Sig_Set &sigset,
ACE_Event_Handler *new_sh,
@@ -186,24 +229,28 @@ ACE_Reactor::register_handler (const ACE_Sig_Set &sigset,
new_sh,
new_disp);
}
+
ACE_INLINE int
ACE_Reactor::remove_handler (ACE_Event_Handler *event_handler,
ACE_Reactor_Mask mask)
{
return this->implementation ()->remove_handler (event_handler, mask);
}
+
ACE_INLINE int
ACE_Reactor::remove_handler (ACE_HANDLE handle,
ACE_Reactor_Mask mask)
{
return this->implementation ()->remove_handler (handle, mask);
}
+
ACE_INLINE int
ACE_Reactor::remove_handler (const ACE_Handle_Set &handle_set,
ACE_Reactor_Mask mask)
{
return this->implementation ()->remove_handler (handle_set, mask);
}
+
ACE_INLINE int
ACE_Reactor::remove_handler (int signum,
ACE_Sig_Action *new_disp,
@@ -215,57 +262,68 @@ ACE_Reactor::remove_handler (int signum,
old_disp,
sigkey);
}
+
ACE_INLINE int
ACE_Reactor::remove_handler (const ACE_Sig_Set &sigset)
{
return this->implementation ()->remove_handler (sigset);
}
+
ACE_INLINE int
ACE_Reactor::suspend_handler (ACE_Event_Handler *event_handler)
{
return this->implementation ()->suspend_handler (event_handler);
}
+
ACE_INLINE int
ACE_Reactor::suspend_handler (ACE_HANDLE handle)
{
return this->implementation ()->suspend_handler (handle);
}
+
ACE_INLINE int
ACE_Reactor::suspend_handler (const ACE_Handle_Set &handles)
{
return this->implementation ()->suspend_handler (handles);
}
+
ACE_INLINE int
ACE_Reactor::suspend_handlers (void)
{
return this->implementation ()->suspend_handlers ();
}
+
ACE_INLINE int
ACE_Reactor::resume_handler (ACE_Event_Handler *event_handler)
{
return this->implementation ()->resume_handler (event_handler);
}
+
ACE_INLINE int
ACE_Reactor::resume_handler (ACE_HANDLE handle)
{
return this->implementation ()->resume_handler (handle);
}
+
ACE_INLINE int
ACE_Reactor::resume_handler (const ACE_Handle_Set &handles)
{
return this->implementation ()->resume_handler (handles);
}
+
ACE_INLINE int
ACE_Reactor::resume_handlers (void)
{
return this->implementation ()->resume_handlers ();
}
+
ACE_INLINE int
ACE_Reactor::schedule_wakeup (ACE_HANDLE handle,
ACE_Reactor_Mask masks_to_be_added)
{
return implementation ()->schedule_wakeup (handle, masks_to_be_added);
}
+
ACE_INLINE int
ACE_Reactor::cancel_wakeup (ACE_Event_Handler *event_handler,
ACE_Reactor_Mask masks_to_be_cleared)
@@ -273,6 +331,7 @@ ACE_Reactor::cancel_wakeup (ACE_Event_Handler *event_handler,
return this->implementation ()->cancel_wakeup (event_handler,
masks_to_be_cleared);
}
+
ACE_INLINE int
ACE_Reactor::cancel_wakeup (ACE_HANDLE handle,
ACE_Reactor_Mask masks_to_be_cleared)
@@ -280,27 +339,32 @@ ACE_Reactor::cancel_wakeup (ACE_HANDLE handle,
return this->implementation ()->cancel_wakeup (handle,
masks_to_be_cleared);
}
+
ACE_INLINE void
ACE_Reactor::max_notify_iterations (int iterations)
{
this->implementation ()->max_notify_iterations (iterations);
}
+
ACE_INLINE int
ACE_Reactor::max_notify_iterations (void)
{
return this->implementation ()->max_notify_iterations ();
}
+
ACE_INLINE int
ACE_Reactor::purge_pending_notifications (ACE_Event_Handler *eh,
ACE_Reactor_Mask mask)
{
return this->implementation ()->purge_pending_notifications (eh, mask);
}
+
ACE_INLINE ACE_Event_Handler *
ACE_Reactor::find_handler (ACE_HANDLE handle)
{
return this->implementation ()->find_handler (handle);
}
+
ACE_INLINE int
ACE_Reactor::handler (ACE_HANDLE handle,
ACE_Reactor_Mask mask,
@@ -308,57 +372,68 @@ ACE_Reactor::handler (ACE_HANDLE handle,
{
return this->implementation ()->handler (handle, mask, event_handler);
}
+
ACE_INLINE int
ACE_Reactor::handler (int signum,
ACE_Event_Handler **event_handler)
{
return this->implementation ()->handler (signum, event_handler);
}
+
ACE_INLINE int
ACE_Reactor::initialized (void)
{
return this->implementation ()->initialized ();
}
+
ACE_INLINE ACE_Lock &
ACE_Reactor::lock (void)
{
return this->implementation ()->lock ();
}
+
ACE_INLINE void
ACE_Reactor::wakeup_all_threads (void)
{
this->implementation ()->wakeup_all_threads ();
}
+
ACE_INLINE int
ACE_Reactor::owner (ACE_thread_t new_owner, ACE_thread_t *old_owner)
{
return this->implementation ()->owner (new_owner, old_owner);
}
+
ACE_INLINE int
ACE_Reactor::owner (ACE_thread_t *owner)
{
return this->implementation ()->owner (owner);
}
+
ACE_INLINE int
ACE_Reactor::restart (void)
{
return this->implementation ()->restart ();
}
+
ACE_INLINE int
ACE_Reactor::restart (int r)
{
return this->implementation ()->restart (r);
}
+
ACE_INLINE void
ACE_Reactor::requeue_position (int position)
{
this->implementation ()->requeue_position (position);
}
+
ACE_INLINE int
ACE_Reactor::requeue_position (void)
{
return this->implementation ()->requeue_position ();
}
+
ACE_INLINE int
ACE_Reactor::mask_ops (ACE_Event_Handler *event_handler,
ACE_Reactor_Mask mask,
@@ -366,6 +441,7 @@ ACE_Reactor::mask_ops (ACE_Event_Handler *event_handler,
{
return this->implementation ()->mask_ops (event_handler, mask, ops);
}
+
ACE_INLINE int
ACE_Reactor::mask_ops (ACE_HANDLE handle,
ACE_Reactor_Mask mask,
@@ -373,6 +449,7 @@ ACE_Reactor::mask_ops (ACE_HANDLE handle,
{
return this->implementation ()->mask_ops (handle, mask, ops);
}
+
ACE_INLINE int
ACE_Reactor::ready_ops (ACE_Event_Handler *event_handler,
ACE_Reactor_Mask mask,
@@ -380,6 +457,7 @@ ACE_Reactor::ready_ops (ACE_Event_Handler *event_handler,
{
return this->implementation ()->ready_ops (event_handler, mask, ops);
}
+
ACE_INLINE int
ACE_Reactor::ready_ops (ACE_HANDLE handle,
ACE_Reactor_Mask mask,
@@ -387,28 +465,34 @@ ACE_Reactor::ready_ops (ACE_HANDLE handle,
{
return this->implementation ()->ready_ops (handle, mask, ops);
}
+
ACE_INLINE int
ACE_Reactor::reactor_event_loop_done (void)
{
ACE_TRACE ("ACE_Reactor::reactor_event_loop_done");
return this->implementation_->deactivated ();
}
+
ACE_INLINE size_t
ACE_Reactor::size (void) const
{
return this->implementation ()->size ();
}
+
ACE_INLINE int
ACE_Reactor::uses_event_associations (void)
{
return this->implementation ()->uses_event_associations ();
}
+
ACE_INLINE void
ACE_Reactor::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_Reactor::dump");
+
implementation_->dump ();
#endif /* ACE_HAS_DUMP */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Reactor_Impl.cpp b/dep/ACE_wrappers/ace/Reactor_Impl.cpp
index e611d630829..fe0ce99d0b8 100644
--- a/dep/ACE_wrappers/ace/Reactor_Impl.cpp
+++ b/dep/ACE_wrappers/ace/Reactor_Impl.cpp
@@ -1,11 +1,16 @@
// $Id: Reactor_Impl.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Reactor_Impl.h"
+
ACE_RCSID (ace,
Reactor_Impl,
"$Id: Reactor_Impl.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_Reactor_Impl::~ACE_Reactor_Impl (void)
{
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Reactor_Impl.h b/dep/ACE_wrappers/ace/Reactor_Impl.h
index 384dfa50f06..d943e9ee5ec 100644
--- a/dep/ACE_wrappers/ace/Reactor_Impl.h
+++ b/dep/ACE_wrappers/ace/Reactor_Impl.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Reactor_Impl.h
@@ -9,25 +10,32 @@
*/
//=============================================================================
+
#ifndef ACE_REACTOR_IMPL_H
#define ACE_REACTOR_IMPL_H
#include /**/ "ace/pre.h"
+
// Timer Queue is a complicated template class. A simple forward
// declaration will not work
#include "ace/Timer_Queuefwd.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
// Event_Handler.h contains the definition of ACE_Reactor_Mask
#include "ace/Event_Handler.h"
#include "ace/Countdown_Time.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward decls
class ACE_Handle_Set;
class ACE_Reactor_Impl;
class ACE_Sig_Action;
class ACE_Sig_Handler;
class ACE_Sig_Set;
+
/**
* @class ACE_Reactor_Notify
*
@@ -44,6 +52,7 @@ public:
ACE_Timer_Queue *timer_queue = 0,
int disable_notify = 0) = 0;
virtual int close (void) = 0;
+
/**
* Called by a thread when it wants to unblock the <Reactor_Impl>.
* This wakeups the <Reactor_Impl> if currently blocked. Pass over
@@ -57,19 +66,24 @@ public:
virtual int notify (ACE_Event_Handler *eh = 0,
ACE_Reactor_Mask mask = ACE_Event_Handler::EXCEPT_MASK,
ACE_Time_Value *timeout = 0) = 0;
+
/// Handles pending threads (if any) that are waiting to unblock the
/// <Reactor_Impl>.
virtual int dispatch_notifications (int &number_of_active_handles,
ACE_Handle_Set &rd_mask) = 0;
+
/// Returns the ACE_HANDLE of the notify pipe on which the reactor
/// is listening for notifications so that other threads can unblock
/// the <Reactor_Impl>
virtual ACE_HANDLE notify_handle (void) = 0;
+
/// Verify whether the buffer has dispatchable info or not.
virtual int is_dispatchable (ACE_Notification_Buffer &buffer)= 0;
+
/// Handle one of the notify call on the <handle>. This could be
/// because of a thread trying to unblock the <Reactor_Impl>
virtual int dispatch_notify (ACE_Notification_Buffer &buffer) = 0;
+
/// Read one of the notify call on the @a handle into the
/// @a buffer. This could be because of a thread trying to unblock
/// the <Reactor_Impl>
@@ -85,6 +99,7 @@ public:
* of slightly higher dispatching overhead.
*/
virtual void max_notify_iterations (int) = 0;
+
/**
* Get the maximum number of times that the <handle_input> method
* will iterate and dispatch the <ACE_Event_Handlers> that are
@@ -92,6 +107,7 @@ public:
* loop.
*/
virtual int max_notify_iterations (void) = 0;
+
/**
* Purge any notifications pending in this reactor for the specified
* ACE_Event_Handler object. Returns the number of notifications
@@ -99,9 +115,11 @@ public:
*/
virtual int purge_pending_notifications (ACE_Event_Handler * = 0,
ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK) = 0;
+
/// Dump the state of an object.
virtual void dump (void) const = 0;
};
+
/**
* @class ACE_Reactor_Impl
*
@@ -112,6 +130,7 @@ class ACE_Export ACE_Reactor_Impl
public:
/// Close down and release all resources.
virtual ~ACE_Reactor_Impl (void);
+
/// Initialization.
virtual int open (size_t size,
int restart = 0,
@@ -119,20 +138,26 @@ public:
ACE_Timer_Queue * = 0,
int disable_notify_pipe = 0,
ACE_Reactor_Notify * = 0) = 0;
+
/**
* Returns 0, if the size of the current message has been put in
* @a size Returns -1, if not. ACE_HANDLE allows the reactor to
* check if the caller is valid.
*/
virtual int current_info (ACE_HANDLE, size_t & /* size */) = 0;
+
/// Use a user specified signal handler instead.
virtual int set_sig_handler (ACE_Sig_Handler *signal_handler) = 0;
+
/// Set a user-specified timer queue.
virtual int timer_queue (ACE_Timer_Queue *tq) = 0;
+
/// Return the current ACE_Timer_Queue.
virtual ACE_Timer_Queue *timer_queue (void) const = 0;
+
/// Close down and release all resources.
virtual int close (void) = 0;
+
// = Event loop drivers.
/**
* Returns non-zero if there are I/O events "ready" for dispatching,
@@ -140,6 +165,7 @@ public:
* don't block while checking this, i.e., "poll".
*/
virtual int work_pending (const ACE_Time_Value &max_wait_time = ACE_Time_Value::zero) = 0;
+
/**
* This event loop driver blocks for up to @a max_wait_time before
* returning. It will return earlier if events occur. Note that
@@ -164,6 +190,7 @@ public:
*/
virtual int handle_events (ACE_Time_Value *max_wait_time = 0) = 0;
virtual int alertable_handle_events (ACE_Time_Value *max_wait_time = 0) = 0;
+
/**
* This method is just like the one above, except the
* @a max_wait_time value is a reference and can therefore never be
@@ -176,36 +203,45 @@ public:
*/
virtual int handle_events (ACE_Time_Value &max_wait_time) = 0;
virtual int alertable_handle_events (ACE_Time_Value &max_wait_time) = 0;
+
// = Event handling control.
+
/**
* Return the status of Reactor. If this function returns 0, the reactor is
* actively handling events. If it returns non-zero, <handling_events> and
* <handle_alertable_events> return -1 immediately.
*/
virtual int deactivated (void) = 0;
+
/**
* Control whether the Reactor will handle any more incoming events or not.
* If @a do_stop == 1, the Reactor will be disabled. By default, a reactor
* is in active state and can be deactivated/reactived as wish.
*/
virtual void deactivate (int do_stop) = 0;
+
// = Register and remove Handlers.
+
/// Register @a event_handler with @a mask. The I/O handle will always
/// come from <get_handle> on the @a event_handler.
virtual int register_handler (ACE_Event_Handler *event_handler,
ACE_Reactor_Mask mask) = 0;
+
/// Register @a event_handler with @a mask. The I/O handle is provided
/// through the <io_handle> parameter.
virtual int register_handler (ACE_HANDLE io_handle,
ACE_Event_Handler *event_handler,
ACE_Reactor_Mask mask) = 0;
+
#if defined (ACE_WIN32)
+
// Originally this interface was available for all platforms, but
// because ACE_HANDLE is an int on non-Win32 platforms, compilers
// are not able to tell the difference between
// register_handler(ACE_Event_Handler*,ACE_Reactor_Mask) and
// register_handler(ACE_Event_Handler*,ACE_HANDLE). Therefore, we
// have restricted this method to Win32 only.
+
/**
* Register an @a event_handler that will be notified when
* <event_handle> is signaled. Since no event mask is passed
@@ -214,7 +250,9 @@ public:
*/
virtual int register_handler (ACE_Event_Handler *event_handler,
ACE_HANDLE event_handle = ACE_INVALID_HANDLE) = 0;
+
#endif /* ACE_WIN32 */
+
/**
* Register an @a event_handler that will be notified when
* <event_handle> is signaled. @a mask specifies the network events
@@ -224,10 +262,12 @@ public:
ACE_HANDLE io_handle,
ACE_Event_Handler *event_handler,
ACE_Reactor_Mask mask) = 0;
+
/// Register @a event_handler with all the <handles> in the <Handle_Set>.
virtual int register_handler (const ACE_Handle_Set &handles,
ACE_Event_Handler *event_handler,
ACE_Reactor_Mask mask) = 0;
+
/**
* Register <new_sh> to handle the signal @a signum using the
* <new_disp>. Returns the <old_sh> that was previously registered
@@ -238,11 +278,13 @@ public:
ACE_Sig_Action *new_disp = 0,
ACE_Event_Handler **old_sh = 0,
ACE_Sig_Action *old_disp = 0) = 0;
+
/// Registers <new_sh> to handle a set of signals <sigset> using the
/// <new_disp>.
virtual int register_handler (const ACE_Sig_Set &sigset,
ACE_Event_Handler *new_sh,
ACE_Sig_Action *new_disp = 0) = 0;
+
/**
* Removes @a event_handler. Note that the I/O handle will be
* obtained using <get_handle> method of @a event_handler . If
@@ -251,6 +293,7 @@ public:
*/
virtual int remove_handler (ACE_Event_Handler *event_handler,
ACE_Reactor_Mask mask) = 0;
+
/**
* Removes <handle>. If @a mask == ACE_Event_Handler::DONT_CALL
* then the <handle_close> method of the associated <event_handler>
@@ -258,6 +301,7 @@ public:
*/
virtual int remove_handler (ACE_HANDLE handle,
ACE_Reactor_Mask mask) = 0;
+
/**
* Removes all handles in <handle_set>. If @a mask ==
* ACE_Event_Handler::DONT_CALL then the <handle_close> method of
@@ -265,6 +309,7 @@ public:
*/
virtual int remove_handler (const ACE_Handle_Set &handle_set,
ACE_Reactor_Mask mask) = 0;
+
/**
* Remove the ACE_Event_Handler currently associated with @a signum.
* Install the new disposition (if given) and return the previous
@@ -275,36 +320,51 @@ public:
ACE_Sig_Action *new_disp,
ACE_Sig_Action *old_disp = 0,
int sigkey = -1) = 0;
+
/// Calls <remove_handler> for every signal in <sigset>.
virtual int remove_handler (const ACE_Sig_Set &sigset) = 0;
+
// = Suspend and resume Handlers.
+
/// Suspend @a event_handler temporarily. Use
/// <ACE_Event_Handler::get_handle> to get the handle.
virtual int suspend_handler (ACE_Event_Handler *event_handler) = 0;
+
/// Suspend <handle> temporarily.
virtual int suspend_handler (ACE_HANDLE handle) = 0;
+
/// Suspend all <handles> in handle set temporarily.
virtual int suspend_handler (const ACE_Handle_Set &handles) = 0;
+
/// Suspend all <handles> temporarily.
virtual int suspend_handlers (void) = 0;
+
/// Resume @a event_handler. Use <ACE_Event_Handler::get_handle> to
/// get the handle.
virtual int resume_handler (ACE_Event_Handler *event_handler) = 0;
+
/// Resume <handle>.
virtual int resume_handler (ACE_HANDLE handle) = 0;
+
/// Resume all <handles> in handle set.
virtual int resume_handler (const ACE_Handle_Set &handles) = 0;
+
/// Resume all <handles>.
virtual int resume_handlers (void) = 0;
+
/// Does the reactor allow the application to resume the handle on
/// its own ie. can it pass on the control of handle resumption to
/// the application
virtual int resumable_handler (void) = 0;
+
/// Return 1 if we any event associations were made by the reactor
/// for the handles that it waits on, 0 otherwise.
virtual int uses_event_associations (void) = 0;
+
// If we need to reset handles returned from accept/connect.
+
// = Timer management.
+
/**
* Schedule an ACE_Event_Handler that will expire after an amount
* of time. The return value of this method, a timer_id value,
@@ -326,6 +386,7 @@ public:
const void *arg,
const ACE_Time_Value &delay,
const ACE_Time_Value &interval = ACE_Time_Value::zero) = 0;
+
/**
* Resets the interval of the timer represented by @a timer_id to
* @a interval, which is specified in relative time to the current
@@ -335,10 +396,12 @@ public:
*/
virtual int reset_timer_interval (long timer_id,
const ACE_Time_Value &interval) = 0;
+
/// Cancel all Event_Handlers that match the address of
/// @a event_handler. Returns number of handlers cancelled.
virtual int cancel_timer (ACE_Event_Handler *event_handler,
int dont_call_handle_close = 1) = 0;
+
/**
* Cancel the single Event_Handler that matches the @a timer_id value
* (which was returned from the schedule method). If arg is
@@ -351,22 +414,29 @@ public:
virtual int cancel_timer (long timer_id,
const void **arg = 0,
int dont_call_handle_close = 1) = 0;
+
// = High-level Event_Handler scheduling operations
+
/// Add @a masks_to_be_added to the @a event_handler's entry.
/// @a event_handler must already have been registered.
virtual int schedule_wakeup (ACE_Event_Handler *event_handler,
ACE_Reactor_Mask masks_to_be_added) = 0;
+
/// Add @a masks_to_be_added to the <handle>'s entry. <event_handler>
/// associated with <handle> must already have been registered.
virtual int schedule_wakeup (ACE_HANDLE handle,
ACE_Reactor_Mask masks_to_be_added) = 0;
+
/// Clear @a masks_to_be_cleared from the <event_handler>'s entry.
virtual int cancel_wakeup (ACE_Event_Handler *event_handler,
ACE_Reactor_Mask masks_to_be_cleared) = 0;
+
/// Clear @a masks_to_be_cleared from the <handle>'s entry.
virtual int cancel_wakeup (ACE_HANDLE handle,
ACE_Reactor_Mask masks_to_be_cleared) = 0;
+
// = Notification methods.
+
/**
* Notify @a event_handler of @a mask event. The ACE_Time_Value
* indicates how long to blocking trying to notify. If @a timeout ==
@@ -376,6 +446,7 @@ public:
virtual int notify (ACE_Event_Handler *event_handler = 0,
ACE_Reactor_Mask mask = ACE_Event_Handler::EXCEPT_MASK,
ACE_Time_Value * = 0) = 0;
+
/**
* Set the maximum number of times that ACE_Reactor_Impl will
* iterate and dispatch the <ACE_Event_Handlers> that are passed in
@@ -387,6 +458,7 @@ public:
* overhead.
*/
virtual void max_notify_iterations (int) = 0;
+
/**
* Get the maximum number of times that the ACE_Reactor_Impl will
* iterate and dispatch the <ACE_Event_Handlers> that are passed in
@@ -394,6 +466,7 @@ public:
* <ACE_Message_Queue::dequeue> loop.
*/
virtual int max_notify_iterations (void) = 0;
+
/**
* Purge any notifications pending in this reactor for the specified
* ACE_Event_Handler object. Returns the number of notifications
@@ -401,11 +474,13 @@ public:
*/
virtual int purge_pending_notifications (ACE_Event_Handler * = 0,
ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK) = 0;
+
/**
* Return the Event_Handler associated with <handle>. Return 0 if
* <handle> is not registered.
*/
virtual ACE_Event_Handler *find_handler (ACE_HANDLE handle) = 0;
+
/**
* Check to see if <handle> is associated with a valid Event_Handler
* bound to @a mask. Return the @a event_handler associated with this
@@ -414,6 +489,7 @@ public:
virtual int handler (ACE_HANDLE handle,
ACE_Reactor_Mask mask,
ACE_Event_Handler **event_handler = 0) = 0;
+
/**
* Check to see if @a signum is associated with a valid Event_Handler
* bound to a signal. Return the @a event_handler associated with
@@ -421,55 +497,74 @@ public:
*/
virtual int handler (int signum,
ACE_Event_Handler ** = 0) = 0;
+
/// Returns true if Reactor has been successfully initialized, else
/// false.
virtual bool initialized (void) = 0;
+
/// Returns the current size of the Reactor's internal descriptor
/// table.
virtual size_t size (void) const = 0;
+
/// Returns a reference to the Reactor's internal lock.
virtual ACE_Lock &lock (void) = 0;
+
/// Wake up all threads in waiting in the event loop
virtual void wakeup_all_threads (void) = 0;
+
/// Transfers ownership of Reactor_Impl to the <new_owner>.
virtual int owner (ACE_thread_t new_owner, ACE_thread_t *old_owner = 0) = 0;
+
/// Return the ID of the "owner" thread.
virtual int owner (ACE_thread_t *owner) = 0;
+
/// Get the existing restart value.
virtual int restart (void) = 0;
+
/// Set a new value for restart and return the original value.
virtual int restart (int r) = 0;
+
/// Set position of the owner thread.
virtual void requeue_position (int) = 0;
+
/// Get position of the owner thread.
virtual int requeue_position (void) = 0;
+
// = Low-level wait_set mask manipulation methods.
+
/// GET/SET/ADD/CLR the dispatch mask "bit" bound with the
/// @a event_handler and @a mask.
virtual int mask_ops (ACE_Event_Handler *event_handler,
ACE_Reactor_Mask mask,
int ops) = 0;
+
/// GET/SET/ADD/CLR the dispatch MASK "bit" bound with the <handle>
/// and @a mask.
virtual int mask_ops (ACE_HANDLE handle,
ACE_Reactor_Mask mask,
int ops) = 0;
+
// = Low-level ready_set mask manipulation methods.
/// GET/SET/ADD/CLR the ready "bit" bound with the @a event_handler
/// and @a mask.
virtual int ready_ops (ACE_Event_Handler *event_handler,
ACE_Reactor_Mask mask,
int ops) = 0;
+
/// GET/SET/ADD/CLR the ready "bit" bound with the <handle> and @a mask.
virtual int ready_ops (ACE_HANDLE handle,
ACE_Reactor_Mask,
int ops) = 0;
+
/// Dump the state of an object.
virtual void dump (void) const = 0;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
#endif /* ACE_REACTOR_IMPL_H */
diff --git a/dep/ACE_wrappers/ace/Reactor_Notification_Strategy.cpp b/dep/ACE_wrappers/ace/Reactor_Notification_Strategy.cpp
index c35e2056600..8c216b092de 100644
--- a/dep/ACE_wrappers/ace/Reactor_Notification_Strategy.cpp
+++ b/dep/ACE_wrappers/ace/Reactor_Notification_Strategy.cpp
@@ -1,10 +1,14 @@
#include "ace/Reactor_Notification_Strategy.h"
#include "ace/Reactor.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Reactor_Notification_Strategy.inl"
#endif /* __ACE_INLINE __ */
+
ACE_RCSID(ace, Reactor_Notification_Strategy, "$Id: Reactor_Notification_Strategy.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_Reactor_Notification_Strategy::ACE_Reactor_Notification_Strategy (
ACE_Reactor *reactor,
ACE_Event_Handler *eh,
@@ -13,19 +17,23 @@ ACE_Reactor_Notification_Strategy::ACE_Reactor_Notification_Strategy (
reactor_ (reactor)
{
}
+
ACE_Reactor_Notification_Strategy::~ACE_Reactor_Notification_Strategy (void)
{
}
+
int
ACE_Reactor_Notification_Strategy::notify (void)
{
return this->reactor_->notify (this->eh_, this->mask_);
}
+
int
ACE_Reactor_Notification_Strategy::notify (ACE_Event_Handler *eh,
ACE_Reactor_Mask mask)
{
return this->reactor_->notify (eh, mask);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Reactor_Notification_Strategy.h b/dep/ACE_wrappers/ace/Reactor_Notification_Strategy.h
index 8bbbed725ed..fd73b36bb67 100644
--- a/dep/ACE_wrappers/ace/Reactor_Notification_Strategy.h
+++ b/dep/ACE_wrappers/ace/Reactor_Notification_Strategy.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Reactor_Notification_Strategy.h
@@ -10,12 +11,17 @@
//=============================================================================
#ifndef ACE_REACTOR_NOTIFICATION_STRATEGY_H
#define ACE_REACTOR_NOTIFICATION_STRATEGY_H
+
#include /**/ "ace/pre.h"
+
#include "ace/Notification_Strategy.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Reactor_Notification_Strategy
*
@@ -30,22 +36,32 @@ public:
ACE_Reactor_Notification_Strategy (ACE_Reactor *reactor,
ACE_Event_Handler *eh,
ACE_Reactor_Mask mask);
+
/// Default dtor.
virtual ~ACE_Reactor_Notification_Strategy (void);
+
virtual int notify (void);
+
virtual int notify (ACE_Event_Handler *eh, ACE_Reactor_Mask mask);
+
/// Get the reactor
ACE_Reactor *reactor (void);
+
/// Set the reactor
void reactor (ACE_Reactor *r);
+
protected:
/// The Reactor
ACE_Reactor *reactor_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Reactor_Notification_Strategy.inl"
#endif /* __ACE_INLINE __ */
+
#include /**/ "ace/post.h"
+
#endif /*ACE_REACTOR_NOTIFICATION_STRATEGY_H */
diff --git a/dep/ACE_wrappers/ace/Reactor_Notification_Strategy.inl b/dep/ACE_wrappers/ace/Reactor_Notification_Strategy.inl
index 3bf0047d6b5..69a260d0f55 100644
--- a/dep/ACE_wrappers/ace/Reactor_Notification_Strategy.inl
+++ b/dep/ACE_wrappers/ace/Reactor_Notification_Strategy.inl
@@ -1,15 +1,19 @@
// -*- C++ -*-
//
// $Id: Reactor_Notification_Strategy.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE ACE_Reactor *
ACE_Reactor_Notification_Strategy::reactor (void)
{
return this->reactor_;
}
+
ACE_INLINE void
ACE_Reactor_Notification_Strategy::reactor (ACE_Reactor *r)
{
this->reactor_ = r;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Reactor_Timer_Interface.cpp b/dep/ACE_wrappers/ace/Reactor_Timer_Interface.cpp
index 859039bb670..91a4f48810a 100644
--- a/dep/ACE_wrappers/ace/Reactor_Timer_Interface.cpp
+++ b/dep/ACE_wrappers/ace/Reactor_Timer_Interface.cpp
@@ -1,12 +1,17 @@
// $Id: Reactor_Timer_Interface.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Reactor_Timer_Interface.h"
+
ACE_RCSID (ace,
Reactor_Timer_Interface,
"$Id: Reactor_Timer_Interface.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_Reactor_Timer_Interface::~ACE_Reactor_Timer_Interface()
{
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Reactor_Timer_Interface.h b/dep/ACE_wrappers/ace/Reactor_Timer_Interface.h
index 3aaba875ee3..aaa2a663b0a 100644
--- a/dep/ACE_wrappers/ace/Reactor_Timer_Interface.h
+++ b/dep/ACE_wrappers/ace/Reactor_Timer_Interface.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Reactor_Timer_Interface.h
@@ -8,15 +9,22 @@
* @author Irfan Pyarali <irfan@oomworks.com>
*/
//=============================================================================
+
#ifndef ACE_REACTOR_TIMER_INTERFACE_H
#define ACE_REACTOR_TIMER_INTERFACE_H
+
#include /**/ "ace/pre.h"
+
#include "ace/Time_Value.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Event_Handler;
+
/**
* @class ACE_Reactor_Timer_Interface
*
@@ -25,20 +33,29 @@ class ACE_Event_Handler;
class ACE_Export ACE_Reactor_Timer_Interface
{
public:
+
virtual ~ACE_Reactor_Timer_Interface (void);
+
virtual long schedule_timer (ACE_Event_Handler *event_handler,
const void *arg,
const ACE_Time_Value &delay,
const ACE_Time_Value &interval = ACE_Time_Value::zero) = 0;
+
virtual int reset_timer_interval (long timer_id,
const ACE_Time_Value &interval) = 0;
+
virtual int cancel_timer (long timer_id,
const void **arg = 0,
int dont_call_handle_close = 1) = 0;
+
virtual int cancel_timer (ACE_Event_Handler *event_handler,
int dont_call_handle_close = 1) = 0;
+
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
+
#endif /* ACE_REACTOR_TIMER_INTERFACE_H */
diff --git a/dep/ACE_wrappers/ace/Reactor_Token_T.h b/dep/ACE_wrappers/ace/Reactor_Token_T.h
index 7305bef9ec6..4fcd2dae4f2 100644
--- a/dep/ACE_wrappers/ace/Reactor_Token_T.h
+++ b/dep/ACE_wrappers/ace/Reactor_Token_T.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Reactor_Token_T.h
@@ -9,12 +10,16 @@
*/
//=============================================================================
+
#ifndef ACE_REACTOR_TOKEN_T_H
#define ACE_REACTOR_TOKEN_T_H
#include /**/ "ace/pre.h"
+
#include "ace/Reactor_Impl.h"
#include "ace/Token.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Reactor_Token_T
*
@@ -53,27 +58,37 @@ public:
int s_queue = ACE_TOKEN_TYPE::FIFO);
ACE_Reactor_Token_T (int s_queue = ACE_TOKEN_TYPE::FIFO);
virtual ~ACE_Reactor_Token_T (void);
+
/// Called just before a token waiter goes to sleep.
/// @see ACE_Token::sleep_hook
virtual void sleep_hook (void);
+
/// Get the reactor implementation
ACE_Reactor_Impl &reactor (void);
+
/// Set the reactor implementation
void reactor (ACE_Reactor_Impl &);
+
/// Dump the state of an object.
virtual void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
ACE_Reactor_Impl *reactor_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Reactor_Token_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Reactor_Token_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
#endif /* ACE_REACTOR_TOKEN_T_H */
diff --git a/dep/ACE_wrappers/ace/Read_Buffer.cpp b/dep/ACE_wrappers/ace/Read_Buffer.cpp
index f328b4fb8b8..d87e2c55d3c 100644
--- a/dep/ACE_wrappers/ace/Read_Buffer.cpp
+++ b/dep/ACE_wrappers/ace/Read_Buffer.cpp
@@ -1,16 +1,23 @@
// $Id: Read_Buffer.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Read_Buffer.h"
+
#include "ace/config-all.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Read_Buffer.inl"
#endif /* __ACE_INLINE__ */
+
#include "ace/Log_Msg.h"
#include "ace/Malloc_Base.h"
#include "ace/Service_Config.h"
#include "ace/OS_NS_stdio.h"
+
ACE_RCSID(ace, Read_Buffer, "$Id: Read_Buffer.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
void
ACE_Read_Buffer::dump (void) const
{
@@ -24,6 +31,7 @@ ACE_Read_Buffer::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
ACE_Read_Buffer::ACE_Read_Buffer (FILE *fp,
bool close_on_delete,
ACE_Allocator *alloc)
@@ -35,6 +43,7 @@ ACE_Read_Buffer::ACE_Read_Buffer (FILE *fp,
if (this->allocator_ == 0)
this->allocator_ = ACE_Allocator::instance ();
}
+
#if !defined (ACE_HAS_WINCE)
ACE_Read_Buffer::ACE_Read_Buffer (ACE_HANDLE handle,
bool close_on_delete,
@@ -44,21 +53,26 @@ ACE_Read_Buffer::ACE_Read_Buffer (ACE_HANDLE handle,
allocator_ (alloc)
{
ACE_TRACE ("ACE_Read_Buffer::ACE_Read_Buffer");
+
if (this->allocator_ == 0)
this->allocator_ = ACE_Allocator::instance ();
}
#endif // ACE_HAS_WINCE
+
ACE_Read_Buffer::~ACE_Read_Buffer (void)
{
ACE_TRACE ("ACE_Read_Buffer::~ACE_Read_Buffer");
+
if (this->close_on_delete_)
ACE_OS::fclose (this->stream_);
}
+
// Input: term the character to terminate on
// search the character to search for
// replace the character with which to replace search
// Output: a buffer containing the contents of stream
// Method: call the recursive helper function read_helper
+
char *
ACE_Read_Buffer::read (int term, int search, int replace)
{
@@ -67,6 +81,7 @@ ACE_Read_Buffer::read (int term, int search, int replace)
this->size_ = 0;
return this->rec_read (term, search, replace);
}
+
// Input: term the termination character
// search the character to search for
// replace the character with which to replace search
@@ -77,19 +92,23 @@ ACE_Read_Buffer::read (int term, int search, int replace)
// Allocate the final buffer based on the number of local
// buffers read and as the recursive calls bottom out,
// copy them in reverse order into the allocated buffer.
+
char *
ACE_Read_Buffer::rec_read (int term, int search, int replace)
{
ACE_TRACE ("ACE_Read_Buffer::rec_read");
// This is our temporary workspace.
char buf[BUFSIZ];
+
int c = EOF;
size_t slot = 0;
int done = 0;
+
// Read in the file char by char
while (slot < BUFSIZ)
{
c = ACE_OS::getc (this->stream_);
+
// Don't insert EOF into the buffer...
if (c == EOF)
{
@@ -98,24 +117,32 @@ ACE_Read_Buffer::rec_read (int term, int search, int replace)
}
else if (c == term)
done = 1;
+
// Check for possible substitutions.
if (c == search)
{
++this->occurrences_;
+
if (replace >= 0)
c = replace;
}
+
buf[slot++] = (char) c;
+
// Substitutions must be made before checking for termination.
if (done)
break;
}
+
// Increment the number of bytes.
this->size_ += slot;
+
// Don't bother going any farther if the total size is 0.
if (this->size_ == 0)
return 0;
+
char *result = 0;
+
// Recurse, when the recursion bottoms out, allocate the result
// buffer.
if (done || c == EOF)
@@ -123,23 +150,28 @@ ACE_Read_Buffer::rec_read (int term, int search, int replace)
// Use the allocator to acquire the memory. The + 1 allows
// space for the null terminator.
result = (char *) this->allocator_->malloc (this->size_ + 1);
+
if (result == 0)
{
errno = ENOMEM;
return 0;
}
result += this->size_;
+
// Null terminate the buffer.
*result = '\0';
}
else if ((result = this->rec_read (term, search, replace)) == 0)
return 0;
+
// Copy buf into the appropriate location starting from end of
// buffer. Peter says this is confusing and that we should use
// memcpy() ;-)
for (size_t j = slot; j > 0; j--)
*--result = buf[j - 1];
+
return result;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Read_Buffer.h b/dep/ACE_wrappers/ace/Read_Buffer.h
index d05abb70390..5dc1e9fa181 100644
--- a/dep/ACE_wrappers/ace/Read_Buffer.h
+++ b/dep/ACE_wrappers/ace/Read_Buffer.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file Read_Buffer.h
@@ -9,17 +10,25 @@
* @author Seth Widoff
*/
//==========================================================================
+
#ifndef ACE_READ_BUFFER_H
#define ACE_READ_BUFFER_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Global_Macros.h"
#include "ace/os_include/os_stdio.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Allocator;
+
/**
* @class ACE_Read_Buffer
*
@@ -42,15 +51,19 @@ public:
ACE_Read_Buffer (FILE *fp,
bool close_on_delete = false,
ACE_Allocator * = 0);
+
#if !defined (ACE_HAS_WINCE)
// Note that ACE_HANDLE = FILE under CE.
+
/// Read from an open HANDLE.
ACE_Read_Buffer (ACE_HANDLE handle,
bool close_on_delete = false,
ACE_Allocator * = 0);
#endif // ACE_HAS_WINCE
+
/// Closes the FILE *.
~ACE_Read_Buffer (void);
+
/**
* Returns a pointer dynamically allocated with
* ACE_Allocator::malloc to data from the input stream up to (and
@@ -64,38 +77,54 @@ public:
char *read (int terminator = EOF,
int search = '\n',
int replace = '\0');
+
/// Returns the number of characters replaced during a @c read.
size_t replaced (void) const;
+
/// Returns the size of the allocated buffer obtained during a
/// @c read, not including the null terminator.
size_t size (void) const;
+
/// Returns a pointer to its allocator.
ACE_Allocator *alloc (void) const;
+
/// Dump the state of the object.
void dump (void) const;
+
private:
+
// Disallow copying and assignment...
void operator= (const ACE_Read_Buffer &);
ACE_Read_Buffer (const ACE_Read_Buffer &);
+
private:
/// Recursive helper method that does the work...
char *rec_read (int term, int search, int replace);
+
/// The total number of characters in the buffer.
size_t size_;
+
/// The total number of characters replaced.
size_t occurrences_;
+
/// The stream we are reading from.
FILE *stream_;
+
/// Keeps track of whether we should close the FILE in the
/// destructor.
bool const close_on_delete_;
+
/// Pointer to the allocator.
ACE_Allocator *allocator_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
# include "ace/Read_Buffer.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_READ_BUFFER_H */
diff --git a/dep/ACE_wrappers/ace/Read_Buffer.inl b/dep/ACE_wrappers/ace/Read_Buffer.inl
index 0080dd2c7a5..4d104bd2af9 100644
--- a/dep/ACE_wrappers/ace/Read_Buffer.inl
+++ b/dep/ACE_wrappers/ace/Read_Buffer.inl
@@ -1,25 +1,32 @@
// -*- C++ -*-
//
// $Id: Read_Buffer.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Accessor to the number of bytes in the buffer.
+
ACE_INLINE size_t
ACE_Read_Buffer::size (void) const
{
ACE_TRACE ("ACE_Read_Buffer::size");
return this->size_;
}
+
// The total number of characters replaced.
+
ACE_INLINE size_t
ACE_Read_Buffer::replaced (void) const
{
ACE_TRACE ("ACE_Read_Buffer::replaced");
return this->occurrences_;
}
+
ACE_INLINE ACE_Allocator *
ACE_Read_Buffer::alloc (void) const
{
ACE_TRACE ("ACE_Read_Buffer::alloc");
return this->allocator_;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Recursive_Thread_Mutex.cpp b/dep/ACE_wrappers/ace/Recursive_Thread_Mutex.cpp
index 56b28fa45d3..a654fdd82f3 100644
--- a/dep/ACE_wrappers/ace/Recursive_Thread_Mutex.cpp
+++ b/dep/ACE_wrappers/ace/Recursive_Thread_Mutex.cpp
@@ -7,15 +7,23 @@
*
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
+
#include "ace/Recursive_Thread_Mutex.h"
+
#if defined (ACE_HAS_THREADS)
+
#if !defined (__ACE_INLINE__)
#include "ace/Recursive_Thread_Mutex.inl"
#endif /* __ACE_INLINE__ */
+
#include "ace/Log_Msg.h"
+
ACE_RCSID(ace, Recursive_Thread_Mutex, "$Id: Recursive_Thread_Mutex.cpp 82253 2008-07-04 20:18:14Z shuston $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_Recursive_Thread_Mutex)
+
ACE_Recursive_Thread_Mutex::ACE_Recursive_Thread_Mutex (const ACE_TCHAR *name,
ACE_mutexattr_t *arg)
: removed_ (false)
@@ -28,11 +36,13 @@ ACE_Recursive_Thread_Mutex::ACE_Recursive_Thread_Mutex (const ACE_TCHAR *name,
ACE_TEXT ("%p\n"),
ACE_TEXT ("recursive_mutex_init")));
}
+
ACE_Recursive_Thread_Mutex::~ACE_Recursive_Thread_Mutex (void)
{
// ACE_TRACE ("ACE_Recursive_Thread_Mutex::~ACE_Recursive_Thread_Mutex");
this->remove ();
}
+
int
ACE_Recursive_Thread_Mutex::remove (void)
{
@@ -45,6 +55,7 @@ ACE_Recursive_Thread_Mutex::remove (void)
}
return result;
}
+
// The counter part of the following two functions for Win32 are
// located in file Synch.i
ACE_thread_t
@@ -66,6 +77,7 @@ ACE_Recursive_Thread_Mutex::get_thread_id (void)
return owner_id;
#endif /* ACE_WIN32 */
}
+
int
ACE_Recursive_Thread_Mutex::get_nesting_level (void)
{
@@ -92,18 +104,23 @@ ACE_Recursive_Thread_Mutex::get_nesting_level (void)
return nesting_level;
#endif /* !ACE_HAS_WINCE */
}
+
ACE_Recursive_Thread_Mutex::ACE_Recursive_Thread_Mutex (const ACE_Recursive_Thread_Mutex &)
{
}
+
void
ACE_Recursive_Thread_Mutex::dump (void) const
{
#if defined (ACE_HAS_DUMP)
// ACE_TRACE ("ACE_Recursive_Thread_Mutex::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_THREADS */
diff --git a/dep/ACE_wrappers/ace/Recursive_Thread_Mutex.h b/dep/ACE_wrappers/ace/Recursive_Thread_Mutex.h
index 82a1ad96e98..0f61a75e300 100644
--- a/dep/ACE_wrappers/ace/Recursive_Thread_Mutex.h
+++ b/dep/ACE_wrappers/ace/Recursive_Thread_Mutex.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file Recursive_Thread_Mutex.h
@@ -11,19 +12,26 @@
* Abdullah Sowayan <abdullah.sowayan@lmco.com>
*/
//==========================================================================
+
#ifndef ACE_RECURSIVE_THREAD_MUTEX_H
#define ACE_RECURSIVE_THREAD_MUTEX_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if !defined (ACE_HAS_THREADS)
# include "ace/Null_Mutex.h"
#else /* ACE_HAS_THREADS */
// ACE platform supports some form of threading.
+
#include "ace/OS_NS_Thread.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Recursive_Thread_Mutex
*
@@ -36,20 +44,24 @@ public:
/// Initialize a recursive mutex.
ACE_Recursive_Thread_Mutex (const ACE_TCHAR *name = 0,
ACE_mutexattr_t *arg = 0);
+
/// Implicitly release a recursive mutex.
~ACE_Recursive_Thread_Mutex (void);
+
/**
* Implicitly release a recursive mutex. Note that only one thread
* should call this method since it doesn't protect against race
* conditions.
*/
int remove (void);
+
/**
* Acquire a recursive mutex (will increment the nesting level and
* not deadmutex if the owner of the mutex calls this method more
* than once).
*/
int acquire (void);
+
/**
* Block the thread until we acquire the mutex or until @a tv times
* out, in which case -1 is returned with @c errno == @c ETIME. Note
@@ -58,6 +70,7 @@ public:
* actual (absolute) acquisition time.
*/
int acquire (ACE_Time_Value &tv);
+
/**
* If @a tv == 0 the call <acquire()> directly. Otherwise, Block the
* thread until we acquire the mutex or until @a tv times out, in
@@ -67,24 +80,28 @@ public:
* (absolute) acquisition time.
*/
int acquire (ACE_Time_Value *tv);
+
/**
* Conditionally acquire a recursive mutex (i.e., won't block).
* Returns -1 on failure. If we "failed" because someone else
* already had the lock, @c errno is set to @c EBUSY.
*/
int tryacquire (void);
+
/**
* Acquire mutex ownership. This calls <acquire> and is only
* here to make the <ACE_Recusive_Thread_Mutex> interface consistent
* with the other synchronization APIs.
*/
int acquire_read (void);
+
/**
* Acquire mutex ownership. This calls <acquire> and is only
* here to make the <ACE_Recusive_Thread_Mutex> interface consistent
* with the other synchronization APIs.
*/
int acquire_write (void);
+
/**
* Conditionally acquire mutex (i.e., won't block). This calls
* <tryacquire> and is only here to make the
@@ -94,6 +111,7 @@ public:
* @c EBUSY.
*/
int tryacquire_read (void);
+
/**
* Conditionally acquire mutex (i.e., won't block). This calls
* <tryacquire> and is only here to make the
@@ -103,6 +121,7 @@ public:
* @c EBUSY.
*/
int tryacquire_write (void);
+
/**
* This is only here to make the ACE_Recursive_Thread_Mutex
* interface consistent with the other synchronization APIs.
@@ -110,14 +129,17 @@ public:
* the above calls, and returns 0 (success) always.
*/
int tryacquire_write_upgrade (void);
+
/**
* Releases a recursive mutex (will not release mutex until all the
* nesting level drops to 0, which means the mutex is no longer
* held).
*/
int release (void);
+
/// Return the id of the thread that currently owns the mutex.
ACE_thread_t get_thread_id (void);
+
/**
* Return the nesting level of the recursion. When a thread has
* acquired the mutex for the first time, the nesting level == 1.
@@ -127,35 +149,47 @@ public:
* do not expose the internal count.
*/
int get_nesting_level (void);
+
/// Returns a reference to the recursive mutex;
ACE_recursive_thread_mutex_t &mutex (void);
+
/// Returns a reference to the recursive mutex's internal mutex;
ACE_thread_mutex_t &get_nesting_mutex (void);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
// = This method should *not* be public (they hold no locks...)
void set_thread_id (ACE_thread_t t);
+
/// Recursive mutex.
ACE_recursive_thread_mutex_t lock_;
+
/// Keeps track of whether <remove> has been called yet to avoid
/// multiple <remove> calls, e.g., explicitly and implicitly in the
/// destructor. This flag isn't protected by a lock, so make sure
/// that you don't have multiple threads simultaneously calling
/// <remove> on the same object, which is a bad idea anyway...
bool removed_;
+
private:
// = Prevent assignment and initialization.
void operator= (const ACE_Recursive_Thread_Mutex &);
ACE_Recursive_Thread_Mutex (const ACE_Recursive_Thread_Mutex &);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Recursive_Thread_Mutex.inl"
#endif /* __ACE_INLINE__ */
+
#endif /* !ACE_HAS_THREADS */
+
#include /**/ "ace/post.h"
#endif /* ACE_RECURSIVE_THREAD_MUTEX_H */
diff --git a/dep/ACE_wrappers/ace/Recursive_Thread_Mutex.inl b/dep/ACE_wrappers/ace/Recursive_Thread_Mutex.inl
index 336d3b03ca3..fe282097eb2 100644
--- a/dep/ACE_wrappers/ace/Recursive_Thread_Mutex.inl
+++ b/dep/ACE_wrappers/ace/Recursive_Thread_Mutex.inl
@@ -1,12 +1,15 @@
// -*- C++ -*-
//
// $Id: Recursive_Thread_Mutex.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE ACE_recursive_thread_mutex_t &
ACE_Recursive_Thread_Mutex::mutex (void)
{
return lock_;
}
+
ACE_INLINE ACE_thread_mutex_t &
ACE_Recursive_Thread_Mutex::get_nesting_mutex (void)
{
@@ -16,6 +19,7 @@ ACE_Recursive_Thread_Mutex::get_nesting_mutex (void)
return lock_.nesting_mutex_;
#endif /* ACE_HAS_RECURSIVE_MUTEXES */
}
+
ACE_INLINE void
ACE_Recursive_Thread_Mutex::set_thread_id (ACE_thread_t t)
{
@@ -26,55 +30,66 @@ ACE_Recursive_Thread_Mutex::set_thread_id (ACE_thread_t t)
this->lock_.owner_id_ = t;
#endif /* ! ACE_HAS_RECURSIVE_MUTEXES */
}
+
ACE_INLINE int
ACE_Recursive_Thread_Mutex::acquire (void)
{
return ACE_OS::recursive_mutex_lock (&this->lock_);
}
+
ACE_INLINE int
ACE_Recursive_Thread_Mutex::release (void)
{
return ACE_OS::recursive_mutex_unlock (&this->lock_);
}
+
ACE_INLINE int
ACE_Recursive_Thread_Mutex::tryacquire (void)
{
return ACE_OS::recursive_mutex_trylock (&this->lock_);
}
+
ACE_INLINE int
ACE_Recursive_Thread_Mutex::acquire (ACE_Time_Value &tv)
{
return ACE_OS::recursive_mutex_lock (&this->lock_, tv);
}
+
ACE_INLINE int
ACE_Recursive_Thread_Mutex::acquire (ACE_Time_Value *tv)
{
return ACE_OS::recursive_mutex_lock (&this->lock_, tv);
}
+
ACE_INLINE int
ACE_Recursive_Thread_Mutex::acquire_read (void)
{
return this->acquire ();
}
+
ACE_INLINE int
ACE_Recursive_Thread_Mutex::acquire_write (void)
{
return this->acquire ();
}
+
ACE_INLINE int
ACE_Recursive_Thread_Mutex::tryacquire_read (void)
{
return this->tryacquire ();
}
+
ACE_INLINE int
ACE_Recursive_Thread_Mutex::tryacquire_write (void)
{
return this->tryacquire ();
}
+
ACE_INLINE int
ACE_Recursive_Thread_Mutex::tryacquire_write_upgrade (void)
{
return 0;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Recyclable.cpp b/dep/ACE_wrappers/ace/Recyclable.cpp
index 890ece7e265..1a31631fd9a 100644
--- a/dep/ACE_wrappers/ace/Recyclable.cpp
+++ b/dep/ACE_wrappers/ace/Recyclable.cpp
@@ -1,17 +1,23 @@
//$Id: Recyclable.cpp 80826 2008-03-04 14:51:23Z wotte $
#include "ace/Recyclable.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Recyclable.inl"
#endif /* __ACE_INLINE __ */
+
ACE_RCSID(ace, Recyclable, "$Id: Recyclable.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_Recyclable::ACE_Recyclable (ACE_Recyclable_State initial_state)
: recycle_state_ (initial_state)
{
}
+
ACE_Recyclable::~ACE_Recyclable (void)
{
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Recyclable.h b/dep/ACE_wrappers/ace/Recyclable.h
index 1a2bdac41e3..6053963d6e0 100644
--- a/dep/ACE_wrappers/ace/Recyclable.h
+++ b/dep/ACE_wrappers/ace/Recyclable.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Recyclable.h
@@ -11,27 +12,37 @@
#ifndef ACE_RECYCLABLE_H
#define ACE_RECYCLABLE_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/// States of a recyclable object.
enum ACE_Recyclable_State
{
/// Idle and can be purged.
ACE_RECYCLABLE_IDLE_AND_PURGABLE,
+
/// Idle but cannot be purged.
ACE_RECYCLABLE_IDLE_BUT_NOT_PURGABLE,
+
/// Can be purged, but is not idle (mostly for debugging).
ACE_RECYCLABLE_PURGABLE_BUT_NOT_IDLE,
+
/// Busy (i.e., cannot be recycled or purged).
ACE_RECYCLABLE_BUSY,
+
/// Closed.
ACE_RECYCLABLE_CLOSED,
+
/// Unknown state.
ACE_RECYCLABLE_UNKNOWN
};
+
/**
* @class ACE_Recyclable
*/
@@ -40,21 +51,30 @@ class ACE_Export ACE_Recyclable
public:
/// Destructor.
virtual ~ACE_Recyclable (void);
+
/// Get the recyclable bit
ACE_Recyclable_State recycle_state (void) const;
+
/// Set the recyclable bit
void recycle_state (ACE_Recyclable_State new_state);
+
protected:
+
/// Constructor.
ACE_Recyclable (ACE_Recyclable_State initial_state);
+
protected:
+
/// Our state.
ACE_Recyclable_State recycle_state_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Recyclable.inl"
#endif /* __ACE_INLINE __ */
+
#include /**/ "ace/post.h"
#endif /*ACE_RECYCLABLE_STATE_H*/
diff --git a/dep/ACE_wrappers/ace/Recyclable.inl b/dep/ACE_wrappers/ace/Recyclable.inl
index ba891343f04..c07d89a8505 100644
--- a/dep/ACE_wrappers/ace/Recyclable.inl
+++ b/dep/ACE_wrappers/ace/Recyclable.inl
@@ -1,16 +1,20 @@
// -*- C++ -*-
//
//$Id: Recyclable.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE ACE_Recyclable_State
ACE_Recyclable::recycle_state (void) const
{
return this->recycle_state_;
}
+
ACE_INLINE void
ACE_Recyclable::recycle_state (ACE_Recyclable_State new_state)
{
if (this->recycle_state_ != ACE_RECYCLABLE_CLOSED)
this->recycle_state_ = new_state;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Refcountable.h b/dep/ACE_wrappers/ace/Refcountable.h
index 72a6b0ddf34..19fc26601bc 100644
--- a/dep/ACE_wrappers/ace/Refcountable.h
+++ b/dep/ACE_wrappers/ace/Refcountable.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Refcountable.h
@@ -11,15 +12,22 @@
#ifndef ACE_REFCOUNTABLE_H
#define ACE_REFCOUNTABLE_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Refcountable_T.h"
#include "ace/Null_Mutex.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
typedef ACE_Refcountable_T<ACE_Null_Mutex> ACE_Refcountable;
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
#endif /*ACE_REFCOUNTABLE_H*/
diff --git a/dep/ACE_wrappers/ace/Refcountable_T.h b/dep/ACE_wrappers/ace/Refcountable_T.h
index 8c9841dd4ab..c18781f7954 100644
--- a/dep/ACE_wrappers/ace/Refcountable_T.h
+++ b/dep/ACE_wrappers/ace/Refcountable_T.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Refcountable_T.h
@@ -12,41 +13,56 @@
#ifndef ACE_REFCOUNTABLE_T_H
#define ACE_REFCOUNTABLE_T_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Atomic_Op.h"
#include "ace/Synch_Traits.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template <class ACE_LOCK>
class ACE_Refcountable_T
{
public:
/// Destructor.
virtual ~ACE_Refcountable_T (void);
+
// = Increment/Decrement refcount
long increment (void);
long decrement (void);
+
/// Returns the current refcount.
long refcount (void) const;
+
protected:
/// Protected constructor.
ACE_Refcountable_T (long refcount);
+
/// Current refcount.
ACE_Atomic_Op <ACE_LOCK, long> refcount_;
};
+
typedef ACE_Refcountable_T<ACE_Null_Mutex> ACE_Refcountable;
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Refcountable_T.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Refcountable_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Refcountable_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
#endif /*ACE_REFCOUNTABLE_T_H*/
diff --git a/dep/ACE_wrappers/ace/Refcountable_T.inl b/dep/ACE_wrappers/ace/Refcountable_T.inl
index 02c617e977f..b66e3f9e236 100644
--- a/dep/ACE_wrappers/ace/Refcountable_T.inl
+++ b/dep/ACE_wrappers/ace/Refcountable_T.inl
@@ -1,29 +1,35 @@
// -*- C++ -*-
//
//$Id: Refcountable_T.inl 81407 2008-04-24 05:59:30Z johnnyw $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template <class ACE_LOCK>
ACE_INLINE
ACE_Refcountable_T<ACE_LOCK>::ACE_Refcountable_T (long refcount)
: refcount_ (refcount)
{
}
+
template <class ACE_LOCK>
ACE_INLINE long
ACE_Refcountable_T<ACE_LOCK>::increment (void)
{
return ++this->refcount_;
}
+
template <class ACE_LOCK>
ACE_INLINE long
ACE_Refcountable_T<ACE_LOCK>::decrement (void)
{
return --this->refcount_;
}
+
template <class ACE_LOCK>
ACE_INLINE long
ACE_Refcountable_T<ACE_LOCK>::refcount (void) const
{
return this->refcount_.value ();
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Refcounted_Auto_Ptr.h b/dep/ACE_wrappers/ace/Refcounted_Auto_Ptr.h
index cbb2cf8cbb6..43f639e8516 100644
--- a/dep/ACE_wrappers/ace/Refcounted_Auto_Ptr.h
+++ b/dep/ACE_wrappers/ace/Refcounted_Auto_Ptr.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Refcounted_Auto_Ptr.h
@@ -8,18 +9,25 @@
* @author John Tucker <JTucker@infoglide.com>
*/
//=============================================================================
+
#ifndef ACE_REFCOUNTED_AUTO_PTR_H
#define ACE_REFCOUNTED_AUTO_PTR_H
+
#include /**/ "ace/pre.h"
+
#include "ace/Auto_Ptr.h"
#include "ace/Atomic_Op.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward decl.
template <class X, class ACE_LOCK> class ACE_Refcounted_Auto_Ptr_Rep;
template <class X, class ACE_LOCK> class ACE_Refcounted_Auto_Ptr;
+
/**
* @class ACE_Refcounted_Auto_Ptr
*
@@ -39,22 +47,28 @@ template <class X, class ACE_LOCK>
class ACE_Refcounted_Auto_Ptr
{
public:
+
// = Initialization and termination methods.
+
/// Constructor that initializes an ACE_Refcounted_Auto_Ptr to
/// the specified pointer value.
explicit ACE_Refcounted_Auto_Ptr (X *p = 0);
+
/// Copy constructor binds the new ACE_Refcounted_Auto_Ptr to the
/// representation object referenced by @a r.
/// An ACE_Refcounted_Auto_Ptr_Rep is created if necessary.
ACE_Refcounted_Auto_Ptr (const ACE_Refcounted_Auto_Ptr<X, ACE_LOCK> &r);
+
/// Destructor. Releases the reference to the underlying representation.
/// If the release of that reference causes its reference count to reach 0,
/// the representation object will also be destroyed.
virtual ~ACE_Refcounted_Auto_Ptr (void);
+
/// Assignment operator that binds the current object and @a r to the same
/// ACE_Refcounted_Auto_Ptr_Rep. An ACE_Refcounted_Auto_Ptr_Rep
/// is created if necessary.
void operator = (const ACE_Refcounted_Auto_Ptr<X, ACE_LOCK> &r);
+
/// Equality operator that returns @c true if both
/// ACE_Refcounted_Auto_Ptr objects point to the same underlying
/// representation. It does not compare the actual pointers.
@@ -63,36 +77,50 @@ public:
* instantiated and not used yet.
*/
bool operator == (const ACE_Refcounted_Auto_Ptr<X, ACE_LOCK> &r) const;
+
/// Inequality operator, which is the opposite of equality.
bool operator != (const ACE_Refcounted_Auto_Ptr<X, ACE_LOCK> &r) const;
+
/// Redirection operator
X *operator-> (void) const;
+
/// Accessor method.
X &operator *() const;
+
/// Check rep easily.
bool operator !() const;
+
/// Check rep easily.
operator bool () const;
+
/// Releases the reference to the underlying representation object.
/// @retval The pointer value prior to releasing it.
X *release (void);
+
/// Releases the current pointer value and then sets a new
/// pointer value specified by @a p.
void reset (X *p = 0);
+
/// Get the pointer value.
X *get (void) const;
+
/// Get the reference count value.
long count (void) const;
+
/// Returns @c true if this object does not contain a valid pointer.
bool null (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
/// the ACE_Refcounted_Auto_Ptr_Rep
typedef ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK> AUTO_REFCOUNTED_PTR_REP;
+
/// Protect operations on the ACE_Refcounted_Auto_Ptr.
AUTO_REFCOUNTED_PTR_REP *rep_;
};
+
/**
* @class ACE_Refcounted_Auto_Ptr_Rep
*
@@ -108,48 +136,65 @@ class ACE_Refcounted_Auto_Ptr_Rep
{
private:
friend class ACE_Refcounted_Auto_Ptr<X, ACE_LOCK>;
+
/// Get the pointer value.
X *get (void) const;
+
/// Get the reference count value.
long count (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
// = Encapsulate reference count and object lifetime of instances.
// These methods must go after the others to work around a bug with
// Borland's C++ Builder...
+
/// Allocate a new ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK> instance,
/// returning NULL if it cannot be created.
static ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK> *internal_create (X *p);
+
/// Create a ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK> and initialize
/// the reference count.
static ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK> *create (X *p);
+
/// Increase the reference count on @a rep.
///
/// @retval @a rep if success, 0 if there's an error obtaining the lock
/// on @a rep.
static ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK> *attach (ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK> *&rep);
+
/// Decreases the reference count and and deletes rep if there are no
/// more references to rep.
///
/// Precondition (rep != 0)
static void detach (ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK> *&rep);
+
/// Pointer to the result.
ACE_Auto_Basic_Ptr<X> ptr_;
+
/// Reference count.
mutable ACE_Atomic_Op<ACE_LOCK, long> ref_count_;
+
private:
// = Constructor and destructor private.
ACE_Refcounted_Auto_Ptr_Rep (X *p = 0);
~ACE_Refcounted_Auto_Ptr_Rep (void);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include "ace/Refcounted_Auto_Ptr.inl"
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Refcounted_Auto_Ptr.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Refcounted_Auto_Ptr.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_REFCOUNTED_AUTO_PTR_H */
diff --git a/dep/ACE_wrappers/ace/Refcounted_Auto_Ptr.inl b/dep/ACE_wrappers/ace/Refcounted_Auto_Ptr.inl
index 2b0f30dd525..d9aacfacc74 100644
--- a/dep/ACE_wrappers/ace/Refcounted_Auto_Ptr.inl
+++ b/dep/ACE_wrappers/ace/Refcounted_Auto_Ptr.inl
@@ -1,24 +1,30 @@
// -*- C++ -*-
//
// $Id: Refcounted_Auto_Ptr.inl 81179 2008-03-31 19:00:29Z iliyan $
+
#include "ace/Guard_T.h"
#include "ace/Log_Msg.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template <class X, class ACE_LOCK> inline long
ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK>::count (void) const
{
return this->ref_count_.value();
}
+
template <class X, class ACE_LOCK> inline long
ACE_Refcounted_Auto_Ptr<X, ACE_LOCK>::count (void) const
{
return this->rep_->count ();
}
+
template <class X, class ACE_LOCK> inline bool
ACE_Refcounted_Auto_Ptr<X, ACE_LOCK>::null (void) const
{
return (this->rep_ == 0 || this->rep_->get () == 0);
}
+
template <class X, class ACE_LOCK> inline ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK> *
ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK>::internal_create (X *p)
{
@@ -28,6 +34,7 @@ ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK>::internal_create (X *p)
0);
return temp;
}
+
template <class X, class ACE_LOCK> inline ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK> *
ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK>::create (X *p)
{
@@ -41,83 +48,101 @@ ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK>::create (X *p)
#endif /* ACE_NEW_THROWS_EXCEPTIONS */
return temp;
}
+
template <class X, class ACE_LOCK> inline ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK> *
ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK>::attach (ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK>*& rep)
{
if (rep == 0)
return 0;
+
++rep->ref_count_;
+
return rep;
}
+
template <class X, class ACE_LOCK> inline void
ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK>::detach (ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK>*& rep)
{
if (rep == 0)
return;
+
if (rep->ref_count_-- == 0)
delete rep;
}
+
template <class X, class ACE_LOCK> inline
ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK>::ACE_Refcounted_Auto_Ptr_Rep (X *p)
: ptr_ (p),
ref_count_ (0)
{
}
+
template <class X, class ACE_LOCK> inline
ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK>::~ACE_Refcounted_Auto_Ptr_Rep (void)
{
}
+
template <class X, class ACE_LOCK> inline X *
ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK>::get (void) const
{
return this->ptr_.get ();
}
+
template <class X, class ACE_LOCK> inline
ACE_Refcounted_Auto_Ptr<X, ACE_LOCK>::ACE_Refcounted_Auto_Ptr (X *p)
: rep_ (AUTO_REFCOUNTED_PTR_REP::create (p))
{
}
+
template <class X, class ACE_LOCK> inline
ACE_Refcounted_Auto_Ptr<X, ACE_LOCK>::ACE_Refcounted_Auto_Ptr (const ACE_Refcounted_Auto_Ptr<X, ACE_LOCK> &r)
: rep_ (AUTO_REFCOUNTED_PTR_REP::attach (((ACE_Refcounted_Auto_Ptr<X, ACE_LOCK> &) r).rep_))
{
}
+
template <class X, class ACE_LOCK> inline bool
ACE_Refcounted_Auto_Ptr<X, ACE_LOCK>::operator== (const ACE_Refcounted_Auto_Ptr<X, ACE_LOCK> &r) const
{
return r.rep_ == this->rep_;
}
+
template <class X, class ACE_LOCK> inline bool
ACE_Refcounted_Auto_Ptr<X, ACE_LOCK>::operator!= (const ACE_Refcounted_Auto_Ptr<X, ACE_LOCK> &r) const
{
return r.rep_ != this->rep_;
}
+
template <class X, class ACE_LOCK> inline X *
ACE_Refcounted_Auto_Ptr<X, ACE_LOCK>::operator-> (void) const
{
return this->rep_->get();
}
+
template<class X, class ACE_LOCK> inline X &
ACE_Refcounted_Auto_Ptr<X, ACE_LOCK>::operator *() const
{
return *this->rep_->get ();
}
+
template<class X, class ACE_LOCK> inline bool
ACE_Refcounted_Auto_Ptr<X, ACE_LOCK>::operator !() const
{
return this->rep_->get () == 0;
}
+
template<class X, class ACE_LOCK> inline
ACE_Refcounted_Auto_Ptr<X, ACE_LOCK>::operator bool () const
{
return this->rep_->get () != 0;
}
+
template <class X, class ACE_LOCK> inline X*
ACE_Refcounted_Auto_Ptr<X, ACE_LOCK>::get (void) const
{
// We return the ACE_Future_rep.
return this->rep_->get ();
}
+
template<class X, class ACE_LOCK> inline X *
ACE_Refcounted_Auto_Ptr<X, ACE_LOCK>::release (void)
{
@@ -126,6 +151,7 @@ ACE_Refcounted_Auto_Ptr<X, ACE_LOCK>::release (void)
this->rep_ = 0;
return p;
}
+
template<class X, class ACE_LOCK> inline void
ACE_Refcounted_Auto_Ptr<X, ACE_LOCK>::reset (X *p)
{
@@ -133,6 +159,7 @@ ACE_Refcounted_Auto_Ptr<X, ACE_LOCK>::reset (X *p)
// pointer value.
if (this->get () == p)
return;
+
AUTO_REFCOUNTED_PTR_REP *old_rep = this->rep_;
if ((this->rep_ = AUTO_REFCOUNTED_PTR_REP::create (p)) != 0)
AUTO_REFCOUNTED_PTR_REP::detach (old_rep);
@@ -140,6 +167,7 @@ ACE_Refcounted_Auto_Ptr<X, ACE_LOCK>::reset (X *p)
this->rep_ = old_rep;
return;
}
+
template <class X, class ACE_LOCK> inline void
ACE_Refcounted_Auto_Ptr<X, ACE_LOCK>::operator = (const ACE_Refcounted_Auto_Ptr<X, ACE_LOCK> &rhs)
{
@@ -158,4 +186,5 @@ ACE_Refcounted_Auto_Ptr<X, ACE_LOCK>::operator = (const ACE_Refcounted_Auto_Ptr<
this->rep_ = 0;
}
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Registry.cpp b/dep/ACE_wrappers/ace/Registry.cpp
index ff41103b724..897df00a9af 100644
--- a/dep/ACE_wrappers/ace/Registry.cpp
+++ b/dep/ACE_wrappers/ace/Registry.cpp
@@ -1,11 +1,16 @@
// $Id: Registry.cpp 82435 2008-07-28 11:53:42Z johnnyw $
+
#include "ace/Registry.h"
+
ACE_RCSID (ace,
Registry,
"$Id: Registry.cpp 82435 2008-07-28 11:53:42Z johnnyw $")
+
#if defined (ACE_WIN32) && !defined (ACE_LACKS_WIN32_REGISTRY)
+
# include "ace/os_include/os_netdb.h"
# include "ace/OS_NS_unistd.h"
+
// Funky macro to deal with strange error passing semantics
// of Win32 Reg*() functions
#define ACE_REGISTRY_CALL_RETURN(X) \
@@ -19,8 +24,11 @@ ACE_RCSID (ace,
return 0; \
} while (0)
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_TCHAR const ACE_Registry::STRING_SEPARATOR[] = ACE_TEXT ("\\");
+
bool
ACE_Registry::Name_Component::operator== (const Name_Component &rhs) const
{
@@ -28,11 +36,13 @@ ACE_Registry::Name_Component::operator== (const Name_Component &rhs) const
rhs.id_ == this->id_ &&
rhs.kind_ == this->kind_;
}
+
bool
ACE_Registry::Name_Component::operator!= (const Name_Component &rhs) const
{
return !this->operator== (rhs);
}
+
// Simple binding constructor
ACE_Registry::Binding::Binding ()
: name_ (),
@@ -40,6 +50,7 @@ ACE_Registry::Binding::Binding ()
{
}
+
// Binding constructor
// (Name version)
ACE_Registry::Binding::Binding (const Name &name,
@@ -49,6 +60,7 @@ ACE_Registry::Binding::Binding (const Name &name,
{
}
+
// Binding constructor
// (String version)
ACE_Registry::Binding::Binding (const ACE_TString &name,
@@ -58,6 +70,7 @@ ACE_Registry::Binding::Binding (const ACE_TString &name,
{
}
+
bool
ACE_Registry::Binding::operator== (const Binding &rhs) const
{
@@ -65,11 +78,13 @@ ACE_Registry::Binding::operator== (const Binding &rhs) const
rhs.name_ == this->name_ &&
rhs.type_ == this->type_;
}
+
bool
ACE_Registry::Binding::operator!= (const Binding &rhs) const
{
return !this->operator== (rhs);
}
+
// Name accessor
// (Name version)
void
@@ -78,6 +93,7 @@ ACE_Registry::Binding::name (Name &name)
name = ACE_Registry::make_name (this->name_);
}
+
// Name accessors
// (String version)
void
@@ -86,6 +102,7 @@ ACE_Registry::Binding::name (ACE_TString &name)
name = this->name_;
}
+
// Name accessors
// (String version)
ACE_TString
@@ -94,6 +111,7 @@ ACE_Registry::Binding::name (void)
return this->name_;
}
+
// Type accessor
ACE_Registry::Binding_Type
ACE_Registry::Binding::type (void)
@@ -101,6 +119,7 @@ ACE_Registry::Binding::type (void)
return this->type_;
}
+
// Simple object constructor
ACE_Registry::Object::Object (void *data,
u_long size,
@@ -110,6 +129,7 @@ ACE_Registry::Object::Object (void *data,
type_ (type)
{
}
+
// Object accessors and set methods
void
ACE_Registry::Object::data (void *data)
@@ -117,36 +137,42 @@ ACE_Registry::Object::data (void *data)
this->data_ = data;
}
+
void *
ACE_Registry::Object::data (void) const
{
return this->data_;
}
+
void
ACE_Registry::Object::size (u_long size)
{
this->size_ = size;
}
+
u_long
ACE_Registry::Object::size (void) const
{
return this->size_;
}
+
void
ACE_Registry::Object::type (u_long type)
{
this->type_ = type;
}
+
u_long
ACE_Registry::Object::type (void) const
{
return this->type_;
}
+
// Simple context constructor
ACE_Registry::Naming_Context::Naming_Context (void)
: key_ ((HKEY) 0),
@@ -155,6 +181,7 @@ ACE_Registry::Naming_Context::Naming_Context (void)
{
}
+
// Context constructor
ACE_Registry::Naming_Context::Naming_Context (const HKEY &key)
: key_ (key),
@@ -163,6 +190,7 @@ ACE_Registry::Naming_Context::Naming_Context (const HKEY &key)
{
}
+
ACE_Registry::Naming_Context::Naming_Context (const Naming_Context &rhs)
: key_ (rhs.key_),
parent_key_ (rhs.parent_key_),
@@ -173,20 +201,24 @@ ACE_Registry::Naming_Context::Naming_Context (const Naming_Context &rhs)
// But since this is private (and not used), I don't care much
}
+
const ACE_Registry::Naming_Context &
ACE_Registry::Naming_Context::operator= (const Naming_Context &rhs)
{
ACE_UNUSED_ARG(rhs);
+
// Not implemented
return *this;
}
+
// Destructor
ACE_Registry::Naming_Context::~Naming_Context ()
{
this->close ();
}
+
// Insert <object> with <name> into <this> context
// (Name version)
int
@@ -196,6 +228,7 @@ ACE_Registry::Naming_Context::bind_new (const Name &name,
return this->bind_new (ACE_Registry::make_string (name), object);
}
+
// Insert <object> with <name> into <this> context
// (String version)
int
@@ -214,6 +247,7 @@ ACE_Registry::Naming_Context::bind_new (const ACE_TString &name,
return result;
}
+
// Insert or update <object> with <name> into <this> context
// (Name version)
int
@@ -223,6 +257,7 @@ ACE_Registry::Naming_Context::bind (const Name &name,
return this->bind (ACE_Registry::make_string (name), object);
}
+
// Insert or update <object> with <name> into <this> context
// (String version)
int
@@ -238,6 +273,7 @@ ACE_Registry::Naming_Context::bind (const ACE_TString &name,
ACE_REGISTRY_CALL_RETURN (result);
}
+
// Update <object> with <name> in <this> context
// (Name version)
int
@@ -247,6 +283,7 @@ ACE_Registry::Naming_Context::rebind (const Name &name,
return this->rebind (ACE_Registry::make_string (name), new_object);
}
+
// Update <object> with <name> in <this> context
// (String version)
int
@@ -262,6 +299,7 @@ ACE_Registry::Naming_Context::rebind (const ACE_TString &name,
return result;
}
+
// Find <object> with <name> in <this> context
// (Name version)
int
@@ -271,6 +309,7 @@ ACE_Registry::Naming_Context::resolve (const Name &name,
return this->resolve (ACE_Registry::make_string (name), object);
}
+
// Find <object> with <name> in <this> context
// (String version)
int
@@ -281,6 +320,7 @@ ACE_Registry::Naming_Context::resolve (const ACE_TString &name,
u_long type;
void *data = object.data ();
u_long size = object.size ();
+
long result = ACE_TEXT_RegQueryValueEx (this->key_,
name.c_str (),
0,
@@ -294,9 +334,11 @@ ACE_Registry::Naming_Context::resolve (const ACE_TString &name,
object.type (type);
object.size (size);
}
+
ACE_REGISTRY_CALL_RETURN (result);
}
+
// Remove object with <name> in <this> context
// (Name version)
int
@@ -305,6 +347,7 @@ ACE_Registry::Naming_Context::unbind (const Name &name)
return this->unbind (ACE_Registry::make_string (name));
}
+
// Remove object with <name> in <this> context
// (String version)
int
@@ -312,9 +355,11 @@ ACE_Registry::Naming_Context::unbind (const ACE_TString &name)
{
long result = ACE_TEXT_RegDeleteValue (this->key_,
name.c_str ());
+
ACE_REGISTRY_CALL_RETURN (result);
}
+
// Create new <naming_context> relative to <this> context
// This method may not mean a lot in this implementation
int
@@ -324,6 +369,7 @@ ACE_Registry::Naming_Context::new_context (Naming_Context &naming_context)
return naming_context.close ();
}
+
// Insert <naming_context> with <name> relative to <this> context
// (Name version)
int
@@ -340,6 +386,7 @@ ACE_Registry::Naming_Context::bind_new_context (const Name &name,
security_attributes);
}
+
// Insert <naming_context> with <name> relative to <this> context
// (String version)
int
@@ -350,6 +397,7 @@ ACE_Registry::Naming_Context::bind_new_context (const ACE_TString &name,
LPSECURITY_ATTRIBUTES security_attributes)
{
u_long reason;
+
long result = ACE_TEXT_RegCreateKeyEx (this->key_,
name.c_str (),
0,
@@ -382,9 +430,11 @@ ACE_Registry::Naming_Context::bind_new_context (const ACE_TString &name,
naming_context.key_ = (HKEY) 0;
}
}
+
ACE_REGISTRY_CALL_RETURN (result);
}
+
// Insert or update <naming_context> with <name> relative to <this> context
// (Name version)
int
@@ -401,6 +451,7 @@ ACE_Registry::Naming_Context::bind_context (const Name &name,
security_attributes);
}
+
// Insert or update <naming_context> with <name> relative to <this> context
// (String version)
int
@@ -411,6 +462,7 @@ ACE_Registry::Naming_Context::bind_context (const ACE_TString &name,
LPSECURITY_ATTRIBUTES security_attributes)
{
u_long reason;
+
long result = ACE_TEXT_RegCreateKeyEx (this->key_,
name.c_str (),
0,
@@ -427,9 +479,11 @@ ACE_Registry::Naming_Context::bind_context (const ACE_TString &name,
// Set the correct name
naming_context.name (name);
}
+
ACE_REGISTRY_CALL_RETURN (result);
}
+
// Rename <naming_context> to <name>
// (Name version)
int
@@ -440,6 +494,7 @@ ACE_Registry::Naming_Context::rebind_context (const Name &name,
new_naming_context);
}
+
// Rename <naming_context> to <name>
// (String version)
int
@@ -465,6 +520,7 @@ ACE_Registry::Naming_Context::rebind_context (const ACE_TString &name,
return result;
}
+
// Remove naming_context with <name> from <this> context
// (Name version)
int
@@ -473,6 +529,7 @@ ACE_Registry::Naming_Context::unbind_context (const Name &name)
return this->unbind_context (ACE_Registry::make_string (name));
}
+
// Remove naming_context with <name> from <this> context
// (String version)
int
@@ -480,9 +537,11 @@ ACE_Registry::Naming_Context::unbind_context (const ACE_TString &name)
{
long result = ACE_TEXT_RegDeleteKey (this->key_,
name.c_str ());
+
ACE_REGISTRY_CALL_RETURN (result);
}
+
// Find <naming_context> with <name> in <this> context
// (Name version)
int
@@ -495,6 +554,7 @@ ACE_Registry::Naming_Context::resolve_context (const Name &name,
security_access);
}
+
// Find <naming_context> with <name> in <this> context
// (String version)
int
@@ -514,9 +574,11 @@ ACE_Registry::Naming_Context::resolve_context (const ACE_TString &name,
// set the correct name
naming_context.name (name);
}
+
ACE_REGISTRY_CALL_RETURN (result);
}
+
// Same as unbind_context() with <this> as naming_context
int
ACE_Registry::Naming_Context::destroy (void)
@@ -524,9 +586,11 @@ ACE_Registry::Naming_Context::destroy (void)
// hopefully the parent_key_ is still open
long result = ACE_TEXT_RegDeleteKey (this->parent_key_,
this->name_.c_str ());
+
ACE_REGISTRY_CALL_RETURN (result);
}
+
// Sync content of context to disk
int
ACE_Registry::Naming_Context::flush (void)
@@ -535,6 +599,7 @@ ACE_Registry::Naming_Context::flush (void)
ACE_REGISTRY_CALL_RETURN (result);
}
+
// Close the handle of the context
int
ACE_Registry::Naming_Context::close (void)
@@ -543,12 +608,14 @@ ACE_Registry::Naming_Context::close (void)
ACE_REGISTRY_CALL_RETURN (result);
}
+
// Convert a <name> to a <string>
ACE_TString
ACE_Registry::make_string (const Name &const_name)
{
ACE_TString string;
Name &name = const_cast<Name &> (const_name);
+
// Iterator through the components of name
for (Name::iterator iterator = name.begin ();
iterator != name.end ();
@@ -561,9 +628,11 @@ ACE_Registry::make_string (const Name &const_name)
// Add to string
string += component.id_;
}
+
return string;
}
+
// Convert a <string> to a <name>
ACE_Registry::Name
ACE_Registry::make_name (const ACE_TString &string)
@@ -571,6 +640,7 @@ ACE_Registry::make_name (const ACE_TString &string)
ACE_TString::size_type new_position = 0;
ACE_TString::size_type last_position = 0;
Name name;
+
// Rememeber: NPOS is -1
while (new_position != ACE_TString::npos)
{
@@ -597,9 +667,11 @@ ACE_Registry::make_name (const ACE_TString &string)
// Insert component into name
name.insert (component);
}
+
return name;
}
+
// Set key
void
ACE_Registry::Naming_Context::key (HKEY key)
@@ -607,6 +679,7 @@ ACE_Registry::Naming_Context::key (HKEY key)
this->key_ = key;
}
+
// Get key
HKEY
ACE_Registry::Naming_Context::key (void)
@@ -614,6 +687,7 @@ ACE_Registry::Naming_Context::key (void)
return this->key_;
}
+
// Set parent
void
ACE_Registry::Naming_Context::parent (HKEY parent)
@@ -621,6 +695,7 @@ ACE_Registry::Naming_Context::parent (HKEY parent)
this->parent_key_ = parent;
}
+
// Get parent
HKEY
ACE_Registry::Naming_Context::parent (void)
@@ -628,6 +703,7 @@ ACE_Registry::Naming_Context::parent (void)
return this->parent_key_;
}
+
// Set name
// (Name version)
void
@@ -636,6 +712,7 @@ ACE_Registry::Naming_Context::name (const Name &name)
this->name_ = ACE_Registry::make_string (name);
}
+
// Get name
// (Name version)
void
@@ -644,6 +721,7 @@ ACE_Registry::Naming_Context::name (Name &name)
name = ACE_Registry::make_name (this->name_);
}
+
// Set name
// (String version)
void
@@ -652,6 +730,7 @@ ACE_Registry::Naming_Context::name (const ACE_TString &name)
this->name_ = name;
}
+
// Get name
// (String version)
ACE_TString
@@ -660,6 +739,7 @@ ACE_Registry::Naming_Context::name (void)
return this->name_;
}
+
// Get name
// (String version)
void
@@ -667,8 +747,10 @@ ACE_Registry::Naming_Context::name (ACE_TString &name)
{
name = this->name_;
}
+
// Empty list
static const ACE_Registry::Binding_List ace_binding_empty_list;
+
// listing function: iterator creator
// This is useful when there are many objects and contexts
// in <this> context and you only want to look at a few entries
@@ -680,16 +762,21 @@ ACE_Registry::Naming_Context::list (u_long how_many,
{
// Make sure that the list is empty
list = ace_binding_empty_list;
+
// Correctly initalize the iterator
iter.reset ();
+
// Make sure that the iterator uses <this> naming context
iter.naming_context (*this);
+
// Start iterations from the objects
iter.current_enumeration (iter.object_iteration_);
+
// Get the next <how_many> values
return iter.next_n (how_many, list);
}
+
// listing function: iterator creator
// This gives back a listing of all entries in <this> context.
int
@@ -697,12 +784,16 @@ ACE_Registry::Naming_Context::list (Binding_List &list)
{
// Make sure that the list is empty
list = ace_binding_empty_list;
+
// Create an iterator
ACE_Registry::Binding_Iterator iterator;
+
// Make sure that the iterator uses <this> naming context
iterator.naming_context (*this);
+
// Start iterations from the objects
iterator.current_enumeration (iterator.object_iteration_);
+
long result = 0;
while (1)
{
@@ -716,6 +807,7 @@ ACE_Registry::Naming_Context::list (Binding_List &list)
return 0;
}
+
// Default constructor
ACE_Registry::Binding_Iterator::Binding_Iterator ()
{
@@ -725,6 +817,7 @@ ACE_Registry::Binding_Iterator::Binding_Iterator ()
this->reset ();
}
+
void
ACE_Registry::Binding_Iterator::reset ()
{
@@ -734,37 +827,45 @@ ACE_Registry::Binding_Iterator::reset ()
this->context_iteration_.reset ();
}
+
void
ACE_Registry::Binding_Iterator::Iteration_State::reset ()
{
this->index_ = 0;
}
+
void
ACE_Registry::Binding_Iterator::Iteration_State::iterator (Binding_Iterator *iter)
{
this->parent_ = iter;
}
+
ACE_Registry::Binding_Iterator::Iteration_State::Iteration_State ()
: index_ (0)
{
}
+
// Next entry
int
ACE_Registry::Binding_Iterator::next_one (Binding &binding)
{
u_long how_many = 1;
Binding_List list;
+
// Get next n (where n is one)
long result = this->next_n (how_many, list);
+
if (result == 0)
// Success
binding = (*list.begin ());
+
return result;
}
+
// Next <how_many> entries
int
ACE_Registry::Binding_Iterator::next_n (u_long how_many,
@@ -772,9 +873,11 @@ ACE_Registry::Binding_Iterator::next_n (u_long how_many,
{
// Make sure that the list is empty
list = ace_binding_empty_list;
+
return this->current_enumeration_->next_n (how_many, list);
}
+
// Destroy iterator
int
ACE_Registry::Binding_Iterator::destroy (void)
@@ -783,6 +886,7 @@ ACE_Registry::Binding_Iterator::destroy (void)
return 0;
}
+
// Set/Get naming_context
void
ACE_Registry::Binding_Iterator::naming_context (Naming_Context &naming_context)
@@ -790,12 +894,14 @@ ACE_Registry::Binding_Iterator::naming_context (Naming_Context &naming_context)
this->naming_context_ = &naming_context;
}
+
ACE_Registry::Naming_Context &
ACE_Registry::Binding_Iterator::naming_context (void)
{
return *this->naming_context_;
}
+
// Set/Get current enumeration
void
ACE_Registry::Binding_Iterator::current_enumeration (Iteration_State &current_enumeration)
@@ -803,18 +909,21 @@ ACE_Registry::Binding_Iterator::current_enumeration (Iteration_State &current_en
this->current_enumeration_ = &current_enumeration;
}
+
ACE_Registry::Binding_Iterator::Iteration_State &
ACE_Registry::Binding_Iterator::current_enumeration (void)
{
return *this->current_enumeration_;
}
+
int
ACE_Registry::Binding_Iterator::Object_Iteration::next_n (u_long how_many,
Binding_List &list)
{
// Make a copy
u_long requested = how_many;
+
// While there are more entries to be added to the list
while (how_many > 0)
{
@@ -836,6 +945,7 @@ ACE_Registry::Binding_Iterator::Object_Iteration::next_n (u_long how_many,
// Readjust counters
this->index_++;
how_many--;
+
// Add to list
// Create binding
Binding binding (string, OBJECT);
@@ -844,10 +954,12 @@ ACE_Registry::Binding_Iterator::Object_Iteration::next_n (u_long how_many,
}
// Continue to add to list
break;
+
case ERROR_NO_MORE_ITEMS:
// Enumeration of objects complete
// Reset index
this->index_ = 0;
+
// Current enumeration will become CONTEXTS
this->parent_->current_enumeration (this->parent_->context_iteration_);
result = this->parent_->current_enumeration ().next_n (how_many,
@@ -857,6 +969,7 @@ ACE_Registry::Binding_Iterator::Object_Iteration::next_n (u_long how_many,
return 0;
else
return result;
+
default:
// Strange error
// Reset index
@@ -873,12 +986,14 @@ ACE_Registry::Binding_Iterator::Object_Iteration::next_n (u_long how_many,
return 0;
}
+
int
ACE_Registry::Binding_Iterator::Context_Iteration::next_n (u_long how_many,
Binding_List &list)
{
// Make a copy
u_long requested = how_many;
+
// While there are more entries to be added to the list
while (how_many > 0)
{
@@ -900,6 +1015,7 @@ ACE_Registry::Binding_Iterator::Context_Iteration::next_n (u_long how_many,
// Readjust counters
this->index_++;
how_many--;
+
// Add to list
// Create binding
Binding binding (string, CONTEXT);
@@ -908,15 +1024,20 @@ ACE_Registry::Binding_Iterator::Context_Iteration::next_n (u_long how_many,
}
// Continue to add to list
break;
+
case ERROR_NO_MORE_ITEMS:
// Enumeration of objects complete
+
/* FALL THROUGH */
+
default:
// Strange error
+
// Reset index
this->index_ = 0;
// Current enumeration will become CONTEXTS
this->parent_->current_enumeration (this->parent_->iteration_complete_);
+
// If we were able to add contexts
if (requested != how_many)
return 0;
@@ -930,16 +1051,19 @@ ACE_Registry::Binding_Iterator::Context_Iteration::next_n (u_long how_many,
return 0;
}
+
int
ACE_Registry::Binding_Iterator::Iteration_Complete::next_n (u_long how_many,
Binding_List &list)
{
ACE_UNUSED_ARG(list);
ACE_UNUSED_ARG(how_many);
+
// No more values
return -1;
}
+
// Factory method to connect to predefined registries
// This method works for both remote and local machines
// However, for remote machines CLASSES_ROOT and CURRENT_USER
@@ -954,8 +1078,10 @@ ACE_Predefined_Naming_Contexts::connect (ACE_Registry::Naming_Context &naming_co
return -1;
#else
long result = -1;
+
if (machine_name != 0 && ACE_OS::strcmp (ACE_TEXT ("localhost"), machine_name) == 0)
machine_name = 0;
+
if (predefined == HKEY_LOCAL_MACHINE || predefined == HKEY_USERS)
result =
ACE_TEXT_RegConnectRegistry (const_cast<ACE_TCHAR *> (machine_name),
@@ -971,9 +1097,11 @@ ACE_Predefined_Naming_Contexts::connect (ACE_Registry::Naming_Context &naming_co
}
else
result = -1;
+
ACE_REGISTRY_CALL_RETURN (result);
#endif // ACE_HAS_WINCE
}
+
// Check if <machine_name> is the local host
/* static */
int
@@ -987,6 +1115,8 @@ ACE_Predefined_Naming_Contexts::is_local_host (const ACE_TCHAR *machine_name)
result = 0;
return result;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_WIN32 && !ACE_LACKS_WIN32_REGISTRY */
diff --git a/dep/ACE_wrappers/ace/Registry.h b/dep/ACE_wrappers/ace/Registry.h
index 3eb54c1b3e7..2fc7a37d6d1 100644
--- a/dep/ACE_wrappers/ace/Registry.h
+++ b/dep/ACE_wrappers/ace/Registry.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Registry.h
@@ -9,18 +10,25 @@
*/
//=============================================================================
+
#ifndef ACE_REGISTRY_H
#define ACE_REGISTRY_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_WIN32) && !defined (ACE_LACKS_WIN32_REGISTRY)
// This only works on registry-capable Win32 platforms.
+
#include "ace/Containers.h"
#include "ace/SString.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Registry
*
@@ -36,61 +44,81 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
class ACE_Export ACE_Registry
{
public:
+
/// International string
struct ACE_Export Name_Component
{
ACE_TString id_;
ACE_TString kind_;
+
bool operator== (const Name_Component &rhs) const;
bool operator!= (const Name_Component &rhs) const;
// Comparison
};
// The <id_> field is used,
// but the <kind_> field is currently ignored
+
/// A Name is an ordered collections of components (ids)
typedef ACE_Unbounded_Set<Name_Component> Name;
+
/// Separator for components in a name
static const ACE_TCHAR STRING_SEPARATOR[];
+
/// Convert a @a name to a @c string
static ACE_TString make_string (const Name &name);
+
/// Convert a @a string to a @c name
static Name make_name (const ACE_TString &string);
+
/// There are two types of bindings
enum Binding_Type {INVALID, OBJECT, CONTEXT};
+
struct ACE_Export Binding
{
/// Empty (default) constructor
Binding (void);
+
/// Constructor
/// (Name version)
Binding (const Name &binding_name,
Binding_Type binding_type);
+
/// Constructor
/// (String version)
Binding (const ACE_TString &binding_name,
Binding_Type binding_type);
+
bool operator== (const Binding &rhs) const;
bool operator!= (const Binding &rhs) const;
// Comparison
+
/// Name accessor
/// (Name version)
void name (Name &name);
+
/// Set Name (String version)
void name (ACE_TString &name);
+
/// Get Name (String version)
ACE_TString name (void);
+
/// Type accessor
Binding_Type type (void);
+
private:
/// A binding has a name
ACE_TString name_;
+
/// .... and a type
Binding_Type type_;
};
+
/// A list of bindings
typedef ACE_Unbounded_Set<Binding> Binding_List;
+
// Forward declaration of iterator
class Binding_Iterator;
+
/**
* @class Object
*
@@ -109,26 +137,36 @@ public:
Object (void *data = 0,
u_long size = 0,
u_long type = REG_NONE);
+
/// Set data
void data (void *data);
+
/// Get data
void *data (void) const;
+
/// Set size
void size (u_long size);
+
/// Get size
u_long size (void) const;
+
/// Set type
void type (u_long type);
+
/// Get type
u_long type (void) const;
+
private:
/// Pointer to data
void *data_;
+
/// Size of the data
u_long size_;
+
/// Type of data
u_long type_;
};
+
/**
* @class Naming_Context
*
@@ -142,20 +180,27 @@ public:
public:
/// Friend factory
friend class ACE_Predefined_Naming_Contexts;
+
enum {
/// Max sizes of names
/// (Not too sure about this value)
MAX_OBJECT_NAME_SIZE = BUFSIZ,
+
/// Max size of context name
MAX_CONTEXT_NAME_SIZE = MAXPATHLEN + 1
};
+
/// Empty constructor: keys will be NULL
Naming_Context (void);
+
/// Constructor: key_ will be set to @a key
Naming_Context (const HKEY &key);
+
/// Destructor will call <Naming_Context::close>.
~Naming_Context (void);
+
// The following interfaces are for objects
+
/**
* Insert @a object with @a name into @c this context.
* This will fail if @a name already exists
@@ -163,6 +208,7 @@ public:
*/
int bind_new (const Name &name,
const Object &object);
+
/**
* Insert @a object with @a name into @c this context
* This will fail if @a name already exists
@@ -170,6 +216,7 @@ public:
*/
int bind_new (const ACE_TString &name,
const Object &object);
+
/**
* Insert or update @a object with @a name into @c this context
* This will not fail if @a name already exists
@@ -177,6 +224,7 @@ public:
*/
int bind (const Name &name,
const Object &object);
+
/**
* Insert or update <object> with @a name into @c this context
* This will not fail if @a name already exists
@@ -184,29 +232,38 @@ public:
*/
int bind (const ACE_TString &name,
const Object &object);
+
/// Update <object> with @a name in @c this context
/// (Name version)
int rebind (const Name &name,
const Object &object);
+
/// Update <object> with @a name in @c this context
int rebind (const ACE_TString &name,
const Object &object);
+
/// Find <object> with @a name in @c this context
/// (Name version)
int resolve (const Name &name,
Object &object);
+
/// Find <object> with @a name in @c this context
int resolve (const ACE_TString &name,
Object &object);
+
/// Delete object with @a name in @c this context
/// (Name version)
int unbind (const Name &name);
+
/// Delete object with @a name in @c this context
int unbind (const ACE_TString &name);
+
// The following interfaces are for Naming Context
+
/// Create new @c naming_context
int new_context (Naming_Context &naming_context);
+
/**
* Insert <naming_context> with @a name relative to @c this context
* This will fail if @a name already exists
@@ -217,6 +274,7 @@ public:
u_long persistence = REG_OPTION_NON_VOLATILE,
u_long security_access = KEY_ALL_ACCESS,
LPSECURITY_ATTRIBUTES security_attributes = 0);
+
/// Insert <naming_context> with @a name relative to @c this context
/// This will fail if @a name already exists
int bind_new_context (const ACE_TString &name,
@@ -224,6 +282,7 @@ public:
u_long persistence = REG_OPTION_NON_VOLATILE,
u_long security_access = KEY_ALL_ACCESS,
LPSECURITY_ATTRIBUTES security_attributes = 0);
+
/**
* Insert or update <naming_context> with @a name relative to @c this context
* This will not fail if @a name already exists
@@ -234,6 +293,7 @@ public:
u_long persistence = REG_OPTION_NON_VOLATILE,
u_long security_access = KEY_ALL_ACCESS,
LPSECURITY_ATTRIBUTES security_attributes = 0);
+
/// Insert or update <naming_context> with @a name relative to @c this context
/// This will not fail if @a name already exists
int bind_context (const ACE_TString &name,
@@ -241,29 +301,37 @@ public:
u_long persistence = REG_OPTION_NON_VOLATILE,
u_long security_access = KEY_ALL_ACCESS,
LPSECURITY_ATTRIBUTES security_attributes = 0);
+
/// Rename <naming_context> to @a name
/// (Name version)
int rebind_context (const Name &name,
/* const */ Naming_Context &naming_context);
+
/// Rename <naming_context> to @a name
int rebind_context (const ACE_TString &name,
/* const */ Naming_Context &naming_context);
+
/// Find <naming_context> with @a name in @c this context
/// (Name version)
int resolve_context (const Name &name,
Naming_Context &naming_context,
u_long security_access = KEY_ALL_ACCESS);
+
/// Find <naming_context> with @a name in @c this context
int resolve_context (const ACE_TString &name,
Naming_Context &naming_context,
u_long security_access = KEY_ALL_ACCESS);
+
/// Remove naming_context with @a name from @c this context
/// (Name version)
int unbind_context (const Name &name);
+
/// Remove naming_context with @a name from @c this context
int unbind_context (const ACE_TString &name);
+
/// Same as <unbind_context> with @c this as naming_context
int destroy (void);
+
/**
* listing function: iterator creator
* This is useful when there are many objects and contexts
@@ -273,52 +341,72 @@ public:
int list (u_long how_many,
Binding_List &list,
Binding_Iterator &iterator);
+
/// listing function: iterator creator
/// This gives back a listing of all entries in @c this context.
int list (Binding_List &list);
+
// Some other necessary functions which are
// not part of the CORBA interface
+
/// Sync content of context to disk
int flush (void);
+
/// Close the handle of the context
/// @note <close> does not call <flush>
int close (void);
+
// Accessors
+
/// Get key
HKEY key (void);
+
// void parent (HKEY parent);
/// Get parent
HKEY parent (void);
+
/// Get name
/// (Name version)
void name (Name &name);
+
/// Set name (String version)
void name (ACE_TString &name);
+
/// Get name (String version)
ACE_TString name (void);
+
protected:
/// Set key
void key (HKEY key);
+
/// Set parent
void parent (HKEY parent);
+
/// Set name
/// (Name version)
void name (const Name &name);
+
/// Set name
/// (String version)
void name (const ACE_TString &name);
+
private:
/// Disallow copy constructors
Naming_Context (const Naming_Context &rhs);
+
/// Disallow assignment
const Naming_Context &operator= (const Naming_Context &rhs);
+
/// Key for self
HKEY key_;
+
/// Key for parent
HKEY parent_key_;
+
/// Name of self
ACE_TString name_;
};
+
/**
* @class Binding_Iterator
*
@@ -331,27 +419,38 @@ public:
public:
/// Friend factory
friend class Naming_Context;
+
/// Default constructor
Binding_Iterator (void);
+
/// Next entry
int next_one (Binding &binding);
+
/// Next <how_many> entries
int next_n (u_long how_many,
Binding_List &list);
+
/// Cleanup
int destroy (void);
+
/// Reset the internal state of the iterator
void reset (void);
+
/// Get naming_context that the iterator is iterating over
Naming_Context &naming_context (void);
+
private:
+
/// Set naming_context that the iterator is iterating over
void naming_context (Naming_Context& naming_context);
+
/// Reference to context
Naming_Context *naming_context_;
+
public:
// This should really be private
// But the compiler is broken
+
/**
* @class Iteration_State
*
@@ -362,18 +461,24 @@ public:
public:
/// Constructor
Iteration_State ();
+
/// Set the iterator reference.
void iterator (Binding_Iterator *iterator);
+
/// Next <how_many> entries
virtual int next_n (u_long how_many,
Binding_List &list) = 0;
+
/// Reset state
void reset (void);
+
protected:
/// Pointer to parent iterator
Binding_Iterator *parent_;
+
u_long index_;
};
+
private:
class ACE_Export Object_Iteration : public Iteration_State
{
@@ -381,6 +486,7 @@ public:
int next_n (u_long how_many,
Binding_List &list);
};
+
class ACE_Export Context_Iteration : public Iteration_State
{
public:
@@ -388,6 +494,7 @@ public:
int next_n (u_long how_many,
Binding_List &list);
};
+
class ACE_Export Iteration_Complete : public Iteration_State
{
public:
@@ -395,23 +502,29 @@ public:
int next_n (u_long how_many,
Binding_List &list);
};
+
/// Friend states
friend class Iteration_State;
friend class Object_Iteration;
friend class Context_Iteration;
friend class Iteration_Complete;
+
/// Instances of all states
Object_Iteration object_iteration_;
Context_Iteration context_iteration_;
Iteration_Complete iteration_complete_;
+
/// Pointer to current state
Iteration_State *current_enumeration_;
+
/// Set current_enumeration
void current_enumeration (Iteration_State& current_enumeration);
+
/// Get current_enumeration
Iteration_State &current_enumeration (void);
};
};
+
/**
* @class ACE_Predefined_Naming_Contexts
*
@@ -433,11 +546,14 @@ public:
static int connect (ACE_Registry::Naming_Context &naming_context,
HKEY predefined = HKEY_LOCAL_MACHINE,
const ACE_TCHAR *machine_name = 0);
+
private:
/// Check if @a machine_name is the local host
static int is_local_host (const ACE_TCHAR *machine_name);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_WIN32 && !ACE_LACKS_WIN32_REGISTRY */
#include /**/ "ace/post.h"
#endif /* ACE_REGISTRY_H */
diff --git a/dep/ACE_wrappers/ace/Registry_Name_Space.cpp b/dep/ACE_wrappers/ace/Registry_Name_Space.cpp
index 4f07b69655e..f59890e6c23 100644
--- a/dep/ACE_wrappers/ace/Registry_Name_Space.cpp
+++ b/dep/ACE_wrappers/ace/Registry_Name_Space.cpp
@@ -1,12 +1,18 @@
// $Id: Registry_Name_Space.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Registry_Name_Space.h"
+
ACE_RCSID(ace, Registry_Name_Space, "$Id: Registry_Name_Space.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if (defined (ACE_WIN32) && defined (ACE_USES_WCHAR))
// This only works on Win32 platforms when ACE_USES_WCHAR is turned on
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_Registry_Name_Space::ACE_Registry_Name_Space (void)
{
}
+
ACE_Registry_Name_Space::ACE_Registry_Name_Space (ACE_Name_Options *name_options)
{
if (this->open (name_options) != 0)
@@ -14,15 +20,18 @@ ACE_Registry_Name_Space::ACE_Registry_Name_Space (ACE_Name_Options *name_options
ACE_TEXT ("ACE_Registry_Name_Space::open")));
}
+
ACE_Registry_Name_Space::~ACE_Registry_Name_Space (void)
{
}
+
int
ACE_Registry_Name_Space::open (ACE_Name_Options *name_options)
{
const ACE_TCHAR *host = name_options->nameserver_host ();
ACE_Registry::Naming_Context predefined;
+
int result = ACE_Predefined_Naming_Contexts::connect (predefined,
HKEY_LOCAL_MACHINE,
host);
@@ -38,6 +47,7 @@ ACE_Registry_Name_Space::open (ACE_Name_Options *name_options)
name += ACE_Registry::STRING_SEPARATOR;
// Filename
name += name_options->database ();
+
// Create new context or bind to existing one
result = predefined.bind_context (name,
this->context_);
@@ -47,16 +57,20 @@ ACE_Registry_Name_Space::open (ACE_Name_Options *name_options)
return 0;
}
+
int
ACE_Registry_Name_Space::bind (const ACE_NS_WString &name,
const ACE_NS_WString &value,
const char *type)
{
ACE_UNUSED_ARG(type);
+
// Pointer to data
const ACE_WSTRING_TYPE *data = value.fast_rep ();
+
// Size
size_t size = value.length () * sizeof (ACE_WSTRING_TYPE);
+
// Represent value as an ACE_Registry::Object
ACE_Registry::Object object ((void *) data,
static_cast<u_long> (size),
@@ -71,16 +85,20 @@ ACE_Registry_Name_Space::bind (const ACE_NS_WString &name,
#endif /* ACE_HAS_WCHAR */
}
+
int
ACE_Registry_Name_Space::rebind (const ACE_NS_WString &name,
const ACE_NS_WString &value,
const char *type)
{
ACE_UNUSED_ARG(type);
+
// Pointer to data
const ACE_WSTRING_TYPE *data = value.fast_rep ();
+
// Size
size_t size = value.length () * sizeof (ACE_WSTRING_TYPE);
+
// Represent value as an ACE_Registry::Object
ACE_Registry::Object object ((void *) data,
static_cast<u_long> (size),
@@ -95,6 +113,7 @@ ACE_Registry_Name_Space::rebind (const ACE_NS_WString &name,
#endif /* ACE_USES_WCHAR */
}
+
int
ACE_Registry_Name_Space::unbind (const ACE_NS_WString &name)
{
@@ -105,12 +124,14 @@ ACE_Registry_Name_Space::unbind (const ACE_NS_WString &name)
#endif /* ACE_USES_WCHAR */
}
+
int
ACE_Registry_Name_Space::resolve (const ACE_NS_WString &name,
ACE_NS_WString &value,
char *&type)
{
ACE_UNUSED_ARG(type);
+
// This object will be used to query the size of the data.
// Note: The query_object.data will be null for this invocation.
ACE_Registry::Object query_object;
@@ -122,13 +143,16 @@ ACE_Registry_Name_Space::resolve (const ACE_NS_WString &name,
#endif /* ACE_USES_WCHAR */
if (result != 0)
return result;
+
// Resize the value passed by the user
// Note: -1 is used because the size includes the null terminator
value.resize ((query_object.size () - 1) / sizeof (ACE_WSTRING_TYPE));
+
// Represent new space as an ACE_Registry::Object
ACE_Registry::Object object ((void *) value.fast_rep (),
query_object.size (),
REG_SZ);
+
#if defined (ACE_USES_WCHAR)
result = this->context_.resolve (name.fast_rep (), object);
#else
@@ -138,9 +162,11 @@ ACE_Registry_Name_Space::resolve (const ACE_NS_WString &name,
return -1;
if (result != 0)
return result;
+
return 0;
}
+
int
ACE_Registry_Name_Space:: list_names (ACE_WSTRING_SET &set,
const ACE_NS_WString &pattern)
@@ -150,7 +176,9 @@ ACE_Registry_Name_Space:: list_names (ACE_WSTRING_SET &set,
pattern);
if (result != 0)
return result;
+
ACE_BINDING_ITERATOR iterator (binding_set);
+
for (ACE_Name_Binding *entry = 0;
iterator.next (entry) !=0;
iterator.advance())
@@ -160,6 +188,7 @@ ACE_Registry_Name_Space:: list_names (ACE_WSTRING_SET &set,
return 0;
}
+
int
ACE_Registry_Name_Space::list_values (ACE_WSTRING_SET &set,
const ACE_NS_WString &pattern)
@@ -169,7 +198,9 @@ ACE_Registry_Name_Space::list_values (ACE_WSTRING_SET &set,
pattern);
if (result != 0)
return result;
+
ACE_BINDING_ITERATOR iterator (binding_set);
+
for (ACE_Name_Binding *entry = 0;
iterator.next (entry) !=0;
iterator.advance())
@@ -179,24 +210,29 @@ ACE_Registry_Name_Space::list_values (ACE_WSTRING_SET &set,
return 0;
}
+
int
ACE_Registry_Name_Space::list_types (ACE_WSTRING_SET &set,
const ACE_NS_WString &pattern)
{
ACE_UNUSED_ARG(set);
ACE_UNUSED_ARG(pattern);
+
return 0;
}
+
int
ACE_Registry_Name_Space::list_name_entries (ACE_BINDING_SET &set,
const ACE_NS_WString &pattern)
{
ACE_UNUSED_ARG(pattern);
+
ACE_Registry::Binding_List list;
int result = this->context_.list (list);
if (result != 0)
return result;
+
// Iterator through all entries
for (ACE_Registry::Binding_List::iterator i = list.begin ();
i != list.end ();
@@ -204,11 +240,13 @@ ACE_Registry_Name_Space::list_name_entries (ACE_BINDING_SET &set,
{
// Yeeesss! STL rules!
ACE_Registry::Binding &binding = *i;
+
if (binding.type () == ACE_Registry::OBJECT)
{
// Key
ACE_TString string = binding.name ();
ACE_NS_WString key (string.c_str ());
+
// Value
ACE_NS_WString value;
char *type = 0;
@@ -217,6 +255,7 @@ ACE_Registry_Name_Space::list_name_entries (ACE_BINDING_SET &set,
type);
if (result != 0)
ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ACE_Registry::Naming_Context::resolve")), result);
+
// Complete binding
ACE_Name_Binding binding (key, value, type);
set.insert (binding);
@@ -225,6 +264,7 @@ ACE_Registry_Name_Space::list_name_entries (ACE_BINDING_SET &set,
return 0;
}
+
int
ACE_Registry_Name_Space::list_value_entries (ACE_BINDING_SET &set,
const ACE_NS_WString &pattern)
@@ -232,6 +272,7 @@ ACE_Registry_Name_Space::list_value_entries (ACE_BINDING_SET &set,
return this->list_name_entries (set, pattern);
}
+
int
ACE_Registry_Name_Space::list_type_entries (ACE_BINDING_SET &set,
const ACE_NS_WString &pattern)
@@ -239,12 +280,15 @@ ACE_Registry_Name_Space::list_type_entries (ACE_BINDING_SET &set,
return this->list_name_entries (set, pattern);
}
+
void
ACE_Registry_Name_Space::dump (void) const
{
#if defined (ACE_HAS_DUMP)
#endif /* ACE_HAS_DUMP */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_WIN32 && ACE_USES_WCHAR */
diff --git a/dep/ACE_wrappers/ace/Registry_Name_Space.h b/dep/ACE_wrappers/ace/Registry_Name_Space.h
index 4fd4ec53ebb..842231777b6 100644
--- a/dep/ACE_wrappers/ace/Registry_Name_Space.h
+++ b/dep/ACE_wrappers/ace/Registry_Name_Space.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Registry_Name_Space.h
@@ -9,19 +10,26 @@
*/
//=============================================================================
+
#ifndef ACE_REGISTRY_NAME_SPACE_H
#define ACE_REGISTRY_NAME_SPACE_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if (defined (ACE_WIN32) && defined (ACE_USES_WCHAR))
// This only works on Win32 platforms when ACE_USES_WCHAR is turned on
+
#include "ace/Registry.h"
#include "ace/Naming_Context.h"
#include "ace/Name_Space.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Registry_Name_Space
*
@@ -38,18 +46,24 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
class ACE_Export ACE_Registry_Name_Space : public ACE_Name_Space
{
public:
+
/// Constructor
ACE_Registry_Name_Space (void);
+
/// Contacts and opens the registry on the specified server
ACE_Registry_Name_Space (ACE_Name_Options *name_options);
+
/// Destructor
~ACE_Registry_Name_Space (void);
+
/// Contacts and opens the registry on the specified server
int open (ACE_Name_Options *name_options);
+
/// Bind a new name to a naming context (Wide character strings).
int bind (const ACE_NS_WString &name_in,
const ACE_NS_WString &value_in,
const char *type_in = "");
+
/**
* Overwrite the value or type of an existing name in a
* ACE_Name_Space or bind a new name to the context, if it didn't
@@ -58,26 +72,32 @@ public:
int rebind (const ACE_NS_WString &name_in,
const ACE_NS_WString &value_in,
const char *type_in = "");
+
/// Delete a name from a ACE_Name_Space (Wide charcter strings
/// Interface).
int unbind (const ACE_NS_WString &name_in);
+
/// Get value and type of a given name binding (Wide chars). The
/// caller is responsible for deleting both <value_out> and <type_out>!
int resolve (const ACE_NS_WString &name_in,
ACE_NS_WString &value_out,
char *&type_out);
+
/// Get a set of names matching a specified pattern (wchars). Matching
/// means the names must begin with the pattern string.
int list_names (ACE_WSTRING_SET &set_out,
const ACE_NS_WString &pattern_in);
+
/// Get a set of values matching a specified pattern (wchars). Matching
/// means the values must begin with the pattern string.
int list_values (ACE_WSTRING_SET &set_out,
const ACE_NS_WString &pattern_in);
+
/// Get a set of types matching a specified pattern (wchars). Matching
/// means the types must begin with the pattern string.
int list_types (ACE_WSTRING_SET &set_out,
const ACE_NS_WString &pattern_in);
+
/**
* Get a set of names matching a specified pattern (wchars). Matching
* means the names must begin with the pattern string. Returns the
@@ -85,6 +105,7 @@ public:
*/
int list_name_entries (ACE_BINDING_SET &set,
const ACE_NS_WString &pattern);
+
/**
* Get a set of values matching a specified pattern (wchars). Matching
* means the values must begin with the pattern string. Returns the
@@ -92,6 +113,7 @@ public:
*/
int list_value_entries (ACE_BINDING_SET &set,
const ACE_NS_WString &pattern);
+
/**
* Get a set of types matching a specified pattern (wchars). Matching
* means the types must begin with the pattern string. Returns the
@@ -99,14 +121,21 @@ public:
*/
int list_type_entries (ACE_BINDING_SET &set,
const ACE_NS_WString &pattern);
+
/// Dump the state of the object
void dump (void) const;
+
private:
+
/// current context
ACE_Registry::Naming_Context context_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_WIN32 && ACE_USES_WCHAR */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_REGISTRY_NAME_SPACE_H */
diff --git a/dep/ACE_wrappers/ace/Remote_Name_Space.cpp b/dep/ACE_wrappers/ace/Remote_Name_Space.cpp
index 66a6f7503ee..5d609ec86ce 100644
--- a/dep/ACE_wrappers/ace/Remote_Name_Space.cpp
+++ b/dep/ACE_wrappers/ace/Remote_Name_Space.cpp
@@ -3,27 +3,35 @@
#include "ace/Log_Msg.h"
#include "ace/SString.h"
#include "ace/OS_NS_string.h"
+
ACE_RCSID (ace,
Remote_Name_Space,
"$Id: Remote_Name_Space.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
int
ACE_Remote_Name_Space::open (const ACE_TCHAR *servername, u_short port)
{
ACE_TRACE ("ACE_Remote_Name_Space::open");
ACE_INET_Addr servaddr;
+
// Initialize Addr
if (servaddr.set (port, servername) == -1)
return -1;
+
// Connect to Name Server process.
if (this->ns_proxy_.open (servaddr) == -1)
return -1;
+
return 0;
}
+
ACE_Remote_Name_Space::ACE_Remote_Name_Space (void)
{
ACE_TRACE ("ACE_Remote_Name_Space::ACE_Remote_Name_Space");
}
+
ACE_Remote_Name_Space::ACE_Remote_Name_Space (const ACE_TCHAR *hostname,
u_short port)
{
@@ -31,6 +39,7 @@ ACE_Remote_Name_Space::ACE_Remote_Name_Space (const ACE_TCHAR *hostname,
if (this->open (hostname, port) == -1)
ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ACE_Remote_Name_Space::ACE_Remote_Name_Space")));
}
+
int
ACE_Remote_Name_Space::bind (const ACE_NS_WString &name,
const ACE_NS_WString &value,
@@ -54,6 +63,7 @@ ACE_Remote_Name_Space::bind (const ACE_NS_WString &name,
type_len);
return this->ns_proxy_.request_reply (request);
}
+
int
ACE_Remote_Name_Space::rebind (const ACE_NS_WString &name,
const ACE_NS_WString &value,
@@ -77,6 +87,7 @@ ACE_Remote_Name_Space::rebind (const ACE_NS_WString &name,
type_len);
return this->ns_proxy_.request_reply (request);
}
+
int
ACE_Remote_Name_Space::resolve (const ACE_NS_WString &name,
ACE_NS_WString &value,
@@ -90,11 +101,15 @@ ACE_Remote_Name_Space::resolve (const ACE_NS_WString &name,
name_urep.get (),
name_len,
0, 0, 0, 0);
+
if (this->ns_proxy_.send_request (request) == -1)
return -1;
+
ACE_Name_Request reply;
+
if (this->ns_proxy_.recv_reply (reply) == -1)
return -1;
+
ACE_NS_WString temp (reply.value (), reply.value_len () / sizeof (ACE_WCHAR_T));
value = temp;
ACE_NEW_RETURN (type,
@@ -103,6 +118,7 @@ ACE_Remote_Name_Space::resolve (const ACE_NS_WString &name,
ACE_OS::strcpy (type, reply.type ());
return 0;
}
+
int
ACE_Remote_Name_Space::unbind (const ACE_NS_WString &name)
{
@@ -116,6 +132,7 @@ ACE_Remote_Name_Space::unbind (const ACE_NS_WString &name)
0, 0, 0, 0);
return this->ns_proxy_.request_reply (request);
}
+
int
ACE_Remote_Name_Space::list_names (ACE_WSTRING_SET &set,
const ACE_NS_WString &pattern)
@@ -130,7 +147,9 @@ ACE_Remote_Name_Space::list_names (ACE_WSTRING_SET &set,
0, 0, 0, 0);
if (this->ns_proxy_.send_request (request) == -1)
return -1;
+
ACE_Name_Request reply (0, 0, 0, 0, 0, 0, 0, 0);
+
while (reply.msg_type () != ACE_Name_Request::MAX_ENUM)
{
if (this->ns_proxy_.recv_reply (reply) == -1)
@@ -147,6 +166,7 @@ ACE_Remote_Name_Space::list_names (ACE_WSTRING_SET &set,
}
return 0;
}
+
int
ACE_Remote_Name_Space::list_values (ACE_WSTRING_SET &set,
const ACE_NS_WString &pattern)
@@ -161,7 +181,9 @@ ACE_Remote_Name_Space::list_values (ACE_WSTRING_SET &set,
0, 0, 0, 0);
if (this->ns_proxy_.send_request (request) == -1)
return -1;
+
ACE_Name_Request reply (0, 0, 0, 0, 0, 0, 0, 0);
+
while (reply.msg_type () != ACE_Name_Request::MAX_ENUM)
{
if (this->ns_proxy_.recv_reply (reply) == -1)
@@ -176,8 +198,10 @@ ACE_Remote_Name_Space::list_values (ACE_WSTRING_SET &set,
set.insert (value);
}
}
+
return 0;
}
+
int
ACE_Remote_Name_Space::list_types (ACE_WSTRING_SET &set,
const ACE_NS_WString &pattern)
@@ -190,9 +214,12 @@ ACE_Remote_Name_Space::list_types (ACE_WSTRING_SET &set,
pattern_urep.get (),
pattern_len,
0, 0, 0, 0);
+
if (this->ns_proxy_.send_request (request) == -1)
return -1;
+
ACE_Name_Request reply (0, 0, 0, 0, 0, 0, 0, 0);
+
while (reply.msg_type () != ACE_Name_Request::MAX_ENUM)
{
if (this->ns_proxy_.recv_reply (reply) == -1)
@@ -206,8 +233,10 @@ ACE_Remote_Name_Space::list_types (ACE_WSTRING_SET &set,
set.insert (type);
}
}
+
return 0;
}
+
int
ACE_Remote_Name_Space::list_name_entries (ACE_BINDING_SET &set,
const ACE_NS_WString &pattern)
@@ -220,9 +249,12 @@ ACE_Remote_Name_Space::list_name_entries (ACE_BINDING_SET &set,
pattern_urep.get (),
pattern_len,
0, 0, 0, 0);
+
if (this->ns_proxy_.send_request (request) == -1)
return -1;
+
ACE_Name_Request reply (0, 0, 0, 0, 0, 0, 0, 0);
+
while (reply.msg_type () != ACE_Name_Request::MAX_ENUM)
{
if (this->ns_proxy_.recv_reply (reply) == -1)
@@ -245,6 +277,7 @@ ACE_Remote_Name_Space::list_name_entries (ACE_BINDING_SET &set,
}
return 0;
}
+
int
ACE_Remote_Name_Space::list_value_entries (ACE_BINDING_SET &set,
const ACE_NS_WString &pattern)
@@ -257,9 +290,12 @@ ACE_Remote_Name_Space::list_value_entries (ACE_BINDING_SET &set,
pattern_urep.get (),
pattern_len,
0, 0, 0, 0);
+
if (this->ns_proxy_.send_request (request) == -1)
return -1;
+
ACE_Name_Request reply (0, 0, 0, 0, 0, 0, 0, 0);
+
while (reply.msg_type () != ACE_Name_Request::MAX_ENUM)
{
if (this->ns_proxy_.recv_reply (reply) == -1)
@@ -282,6 +318,7 @@ ACE_Remote_Name_Space::list_value_entries (ACE_BINDING_SET &set,
}
return 0;
}
+
int
ACE_Remote_Name_Space::list_type_entries (ACE_BINDING_SET &set,
const ACE_NS_WString &pattern)
@@ -294,9 +331,12 @@ ACE_Remote_Name_Space::list_type_entries (ACE_BINDING_SET &set,
pattern_urep.get (),
pattern_len,
0, 0, 0, 0);
+
if (this->ns_proxy_.send_request (request) == -1)
return -1;
+
ACE_Name_Request reply (0, 0, 0, 0, 0, 0, 0, 0);
+
while (reply.msg_type () != ACE_Name_Request::MAX_ENUM)
{
if (this->ns_proxy_.recv_reply (reply) == -1)
@@ -319,19 +359,23 @@ ACE_Remote_Name_Space::list_type_entries (ACE_BINDING_SET &set,
}
return 0;
}
+
ACE_Remote_Name_Space::~ACE_Remote_Name_Space (void)
{
ACE_TRACE ("ACE_Remote_Name_Space::~ACE_Remote_Name_Space");
}
+
void
ACE_Remote_Name_Space::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_Remote_Name_Space::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
this->ns_proxy_.dump ();
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Remote_Name_Space.h b/dep/ACE_wrappers/ace/Remote_Name_Space.h
index 047865a4450..8b4ebdfc65e 100644
--- a/dep/ACE_wrappers/ace/Remote_Name_Space.h
+++ b/dep/ACE_wrappers/ace/Remote_Name_Space.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file Remote_Name_Space.h
@@ -9,18 +10,27 @@
*/
//==========================================================================
+
#ifndef ACE_REMOTE_NAME_SPACE_H
#define ACE_REMOTE_NAME_SPACE_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Name_Proxy.h"
#include "ace/Name_Space.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_NS_WString;
+
typedef ACE_Unbounded_Set<ACE_NS_WString> ACE_WSTRING_SET;
+
/**
* @class ACE_Remote_Name_Space
*
@@ -40,25 +50,30 @@ public:
// = Initialization and termination methods.
/// "Do-nothing" constructor.
ACE_Remote_Name_Space (void);
+
/**
* Specifies the scope of this namespace, opens and memory-maps the
* associated file (if accessible) or contacts the dedicated name
* server process for NET_LOCAL namespace.
*/
ACE_Remote_Name_Space (const ACE_TCHAR *hostname, u_short port);
+
/**
* Specifies the scope of this namespace, opens and memory-maps the
* associated file (if accessible) or contacts the dedicated name
* server process for NET_LOCAL namespace.
*/
int open (const ACE_TCHAR *servername, u_short port);
+
/// destructor, do some cleanup :TBD: last dtor should "compress"
/// file
~ACE_Remote_Name_Space (void);
+
/// Bind a new name to a naming context (Wide character strings).
virtual int bind (const ACE_NS_WString &name_in,
const ACE_NS_WString &value_in,
const char *type_in = "");
+
/**
* Overwrite the value or type of an existing name in a
* ACE_Remote_Name_Space or bind a new name to the context, if it
@@ -67,26 +82,32 @@ public:
virtual int rebind (const ACE_NS_WString &name_in,
const ACE_NS_WString &value_in,
const char *type_in = "");
+
/// Delete a name from a ACE_Remote_Name_Space (Wide charcter strings
/// Interface).
virtual int unbind (const ACE_NS_WString &name_in);
+
/// Get value and type of a given name binding (Wide chars). The
/// caller is responsible for deleting both <value_out> and <type_out>!
virtual int resolve (const ACE_NS_WString &name_in,
ACE_NS_WString &value_out,
char *&type_out);
+
/// Get a set of names matching a specified pattern (wchars). Matching
/// means the names must begin with the pattern string.
virtual int list_names (ACE_WSTRING_SET &set_out,
const ACE_NS_WString &pattern_in);
+
/// Get a set of values matching a specified pattern (wchars). Matching
/// means the values must begin with the pattern string.
virtual int list_values (ACE_WSTRING_SET &set_out,
const ACE_NS_WString &pattern_in);
+
/// Get a set of types matching a specified pattern (wchars). Matching
/// means the types must begin with the pattern string.
virtual int list_types (ACE_WSTRING_SET &set_out,
const ACE_NS_WString &pattern_in);
+
/**
* Get a set of names matching a specified pattern (wchars). Matching
* means the names must begin with the pattern string. Returns the
@@ -94,6 +115,7 @@ public:
*/
virtual int list_name_entries (ACE_BINDING_SET &set,
const ACE_NS_WString &pattern);
+
/**
* Get a set of values matching a specified pattern (wchars). Matching
* means the values must begin with the pattern string. Returns the
@@ -101,6 +123,7 @@ public:
*/
virtual int list_value_entries (ACE_BINDING_SET &set,
const ACE_NS_WString &pattern);
+
/**
* Get a set of types matching a specified pattern (wchars). Matching
* means the types must begin with the pattern string. Returns the
@@ -108,13 +131,18 @@ public:
*/
virtual int list_type_entries (ACE_BINDING_SET &set,
const ACE_NS_WString &pattern);
+
/// Dump the state of the object.
virtual void dump (void) const;
+
private:
/// Interface to Name server process for NET_LOCAL namespace.
ACE_Name_Proxy ns_proxy_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
+
#endif /* ACE_REMOTE_NAME_SPACE_H */
diff --git a/dep/ACE_wrappers/ace/Remote_Tokens.cpp b/dep/ACE_wrappers/ace/Remote_Tokens.cpp
index cf80bfe788a..3df59910fa7 100644
--- a/dep/ACE_wrappers/ace/Remote_Tokens.cpp
+++ b/dep/ACE_wrappers/ace/Remote_Tokens.cpp
@@ -1,68 +1,89 @@
// $Id: Remote_Tokens.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Remote_Tokens.h"
+
#if defined (ACE_HAS_TOKENS_LIBRARY)
+
#include "ace/Singleton.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Remote_Tokens.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID (ace,
Remote_Tokens,
"$Id: Remote_Tokens.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
#define ACE_TSS_CONNECTION_MUTEX ACE_Thread_Mutex
#else
#define ACE_TSS_CONNECTION_MUTEX ACE_Null_Mutex
#endif /* ACE_MT_SAFE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Make a typedef to simplify access to the Singleton below.
typedef ACE_Singleton<ACE_TSS_Connection, ACE_TSS_CONNECTION_MUTEX> ACE_Token_Connections;
+
// Initialize the statics from ACE_TSS_Connection;
ACE_INET_Addr ACE_TSS_Connection::server_address_;
+
// ************************************************************
+
void
ACE_TSS_Connection::set_server_address (const ACE_INET_Addr &server_address)
{
ACE_TRACE ("ACE_TSS_Connection::set_server_address");
server_address_ = server_address;
}
+
// Necessary to make some compilers work...
ACE_TSS_Connection::ACE_TSS_Connection (void)
{
ACE_TRACE ("ACE_TSS_Connection::ACE_TSS_Connection");
}
+
ACE_TSS_Connection::~ACE_TSS_Connection (void)
{
ACE_TRACE ("ACE_TSS_Connection::~ACE_TSS_Connection");
}
+
ACE_SOCK_Stream *
ACE_TSS_Connection::get_connection (void)
{
return ACE_TSS<ACE_SOCK_Stream>::operator-> ();
}
+
ACE_SOCK_Stream *
ACE_TSS_Connection::make_TSS_TYPE (void) const
{
ACE_TRACE ("ACE_TSS_Connection::make_TSS_TYPE");
+
ACE_SOCK_Connector connector;
ACE_SOCK_Stream *stream = 0;
+
ACE_NEW_RETURN (stream,
ACE_SOCK_Stream,
0);
+
if (connector.connect (*stream, server_address_) == -1)
{
delete stream;
errno = ECONNREFUSED;
return 0;
}
+
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("ACE_TSS_Connection new connection\n")));
return stream;
}
+
ACE_TSS_Connection::operator ACE_SOCK_Stream *(void)
{
return this->get_connection ();
}
+
void
ACE_TSS_Connection::dump (void) const
{
@@ -77,14 +98,17 @@ ACE_TSS_Connection::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
ACE_Remote_Token_Proxy::ACE_Remote_Token_Proxy (void)
{
ACE_TRACE ("ACE_Remote_Token_Proxy::ACE_Remote_Token_Proxy");
}
+
ACE_Remote_Token_Proxy::~ACE_Remote_Token_Proxy (void)
{
ACE_TRACE ("ACE_Remote_Token_Proxy::~ACE_Remote_Token_Proxy");
}
+
int
ACE_Remote_Token_Proxy::open (const ACE_TCHAR *name,
int ignore_deadlock,
@@ -94,12 +118,14 @@ ACE_Remote_Token_Proxy::open (const ACE_TCHAR *name,
ignore_shadow_deadlock_ = ignore_deadlock;
return ACE_Token_Proxy::open (name, 0, debug);
}
+
void
ACE_Remote_Token_Proxy::set_server_address (const ACE_INET_Addr &server_address)
{
ACE_TRACE ("ACE_Remote_Token_Proxy::set_server_address");
ACE_Token_Connections::instance ()->set_server_address (server_address);
}
+
int
ACE_Remote_Token_Proxy::initiate_connection (void)
{
@@ -110,10 +136,13 @@ ACE_Remote_Token_Proxy::initiate_connection (void)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("ACE_Remote_Token_Proxy not open.\n")), -1);
}
+
ACE_SOCK_Stream *peer = ACE_Token_Connections::instance ()->get_connection ();
return peer == 0 ? 0 : 1;
}
+
// Do the work of sending a request and getting a reply.
+
int
ACE_Remote_Token_Proxy::request_reply (ACE_Token_Request &request,
ACE_Synch_Options &)
@@ -121,22 +150,31 @@ ACE_Remote_Token_Proxy::request_reply (ACE_Token_Request &request,
ACE_TRACE ("ACE_Remote_Token_Proxy::request_reply");
void *buffer;
ssize_t length;
+
if ((length = request.encode (buffer)) == -1)
ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("encode failed")), -1);
+
ACE_SOCK_Stream *peer = ACE_Token_Connections::instance ()->get_connection ();
+
if (peer == 0)
ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) %p\n", "BIG PROBLEMS with get_connection"), -1);
+
// Transmit request via a blocking send.
+
if (peer->send_n (buffer, length) != length)
ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("send_n failed")), -1);
else
{
ACE_Token_Reply reply;
+
// Receive reply via blocking read.
+
if (peer->recv (&reply, sizeof reply) != sizeof reply)
ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("recv failed")), -1);
+
if (reply.decode () == -1)
ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("decode failed")), -1);
+
errno = int (reply.errnum ());
if (errno != 0)
return -1;
@@ -144,12 +182,14 @@ ACE_Remote_Token_Proxy::request_reply (ACE_Token_Request &request,
return 0;
}
}
+
int
ACE_Remote_Token_Proxy::acquire (int notify,
void (*sleep_hook)(void *),
ACE_Synch_Options &options)
{
ACE_TRACE ("ACE_Remote_Token_Proxy::acquire");
+
// First grab the local shadow mutex.
if (ACE_Token_Proxy::acquire (notify,
sleep_hook,
@@ -165,9 +205,11 @@ ACE_Remote_Token_Proxy::acquire (int notify,
this->token_->owner_id ()));
// No error, but would block,
break;
+
case EDEADLK :
if (debug_)
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) shadow: deadlock detected\n")));
+
if (ignore_shadow_deadlock_)
break;
else
@@ -175,6 +217,7 @@ ACE_Remote_Token_Proxy::acquire (int notify,
errno = EDEADLK;
ACE_RETURN (-1);
}
+
default :
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("(%t) %p shadow acquire failed\n"),
@@ -182,14 +225,18 @@ ACE_Remote_Token_Proxy::acquire (int notify,
-1);
}
}
+
ACE_Token_Request request (token_->type (),
this->type (),
ACE_Token_Request::ACQUIRE,
this->name (),
this->client_id (),
options);
+
request.notify (notify);
+
int result = this->request_reply (request, options);
+
if (result == -1)
{
// Update the local shadow copy.
@@ -206,12 +253,15 @@ ACE_Remote_Token_Proxy::acquire (int notify,
// is moved to the front of the waiter list.
token_->make_owner (waiter_);
}
+
return result;
}
+
int
ACE_Remote_Token_Proxy::tryacquire (void (*sleep_hook)(void *))
{
ACE_TRACE ("ACE_Remote_Token_Proxy::tryacquire");
+
// If we can detect locally that the tryacquire will fail, there is
// no need to go remote.
if (ACE_Token_Proxy::tryacquire (sleep_hook) == -1)
@@ -223,22 +273,27 @@ ACE_Remote_Token_Proxy::tryacquire (void (*sleep_hook)(void *))
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("shadow try acquire failed\n")));
}
+
return -1;
}
+
ACE_Token_Request request (token_->type (),
this->type (),
ACE_Token_Request::TRY_ACQUIRE,
this->name (),
this->client_id (),
ACE_Synch_Options::synch);
+
return this->request_reply (request,
ACE_Synch_Options::synch);
}
+
int
ACE_Remote_Token_Proxy::renew (int requeue_position,
ACE_Synch_Options &options)
{
ACE_TRACE ("ACE_Remote_Token_Proxy::renew");
+
if (ACE_Token_Proxy::renew (requeue_position,
ACE_Synch_Options::asynch) == -1)
{
@@ -250,14 +305,18 @@ ACE_Remote_Token_Proxy::renew (int requeue_position,
ACE_TEXT ("(%t) shadow: renew would block. owner %s.\n"),
this->token_->owner_id ()));
}
+
ACE_Token_Request request (token_->type (),
this->type (),
ACE_Token_Request::RENEW,
this->name (),
this->client_id (),
options);
+
request.requeue_position (requeue_position);
+
int result = this->request_reply (request, options);
+
if (result == -1)
{
{
@@ -278,32 +337,39 @@ ACE_Remote_Token_Proxy::renew (int requeue_position,
return result;
}
}
+
int
ACE_Remote_Token_Proxy::release (ACE_Synch_Options &options)
{
ACE_TRACE ("ACE_Remote_Token_Proxy::release");
+
ACE_Token_Request request (token_->type (),
this->type (),
ACE_Token_Request::RELEASE,
this->name (),
this->client_id (),
options);
+
int result = this->request_reply (request, options);
if (result == 0)
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) released %s remotely.\n"), this->name ()));
+
// whether success or failure, we're going to release the shadow.
// If race conditions exist such that we are no longer the owner,
// this release will perform a remove.
if (ACE_Token_Proxy::release () == -1)
ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) shadow: release failed\n")));
+
return result;
}
+
int
ACE_Remote_Token_Proxy::remove (ACE_Synch_Options &)
{
ACE_TRACE ("ACE_Remote_Token_Proxy::remove");
return 0;
}
+
void
ACE_Remote_Token_Proxy::token_acquired (ACE_TPQ_Entry *)
{
@@ -313,6 +379,7 @@ ACE_Remote_Token_Proxy::token_acquired (ACE_TPQ_Entry *)
this->name ()));
// ACE_Token_Proxy::token_acquired (vp);
}
+
const ACE_TCHAR*
ACE_Remote_Token_Proxy::owner_id (void)
{
@@ -321,6 +388,7 @@ ACE_Remote_Token_Proxy::owner_id (void)
// @@ special operation
return 0;
}
+
void
ACE_Remote_Token_Proxy::dump (void) const
{
@@ -335,6 +403,7 @@ ACE_Remote_Token_Proxy::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
ACE_Token_Proxy *
ACE_Remote_Mutex::clone (void) const
{
@@ -346,6 +415,7 @@ ACE_Remote_Mutex::clone (void) const
0);
return temp;
}
+
ACE_Tokens *
ACE_Remote_Mutex::create_token (const ACE_TCHAR *name)
{
@@ -355,6 +425,7 @@ ACE_Remote_Mutex::create_token (const ACE_TCHAR *name)
0);
return temp;
}
+
void
ACE_Remote_Mutex::dump (void) const
{
@@ -367,6 +438,7 @@ ACE_Remote_Mutex::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
ACE_Tokens *
ACE_Remote_RLock::create_token (const ACE_TCHAR *name)
{
@@ -376,11 +448,13 @@ ACE_Remote_RLock::create_token (const ACE_TCHAR *name)
0);
return temp;
}
+
int
ACE_Remote_RLock::type (void) const
{
return ACE_RW_Token::READER;
}
+
ACE_Token_Proxy *
ACE_Remote_RLock::clone (void) const
{
@@ -392,6 +466,7 @@ ACE_Remote_RLock::clone (void) const
0);
return temp;
}
+
void
ACE_Remote_RLock::dump (void) const
{
@@ -405,6 +480,7 @@ ACE_Remote_RLock::dump (void) const
#endif /* ACE_HAS_DUMP */
}
+
ACE_Tokens *
ACE_Remote_WLock::create_token (const ACE_TCHAR *name)
{
@@ -414,11 +490,13 @@ ACE_Remote_WLock::create_token (const ACE_TCHAR *name)
0);
return temp;
}
+
int
ACE_Remote_WLock::type (void) const
{
return ACE_RW_Token::WRITER;
}
+
ACE_Token_Proxy *
ACE_Remote_WLock::clone (void) const
{
@@ -430,6 +508,7 @@ ACE_Remote_WLock::clone (void) const
0);
return temp;
}
+
void
ACE_Remote_WLock::dump (void) const
{
@@ -442,6 +521,8 @@ ACE_Remote_WLock::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_TOKENS_LIBRARY */
diff --git a/dep/ACE_wrappers/ace/Remote_Tokens.h b/dep/ACE_wrappers/ace/Remote_Tokens.h
index c2c032f97ef..d9a47cf7aa8 100644
--- a/dep/ACE_wrappers/ace/Remote_Tokens.h
+++ b/dep/ACE_wrappers/ace/Remote_Tokens.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Remote_Tokens.h
@@ -9,20 +10,28 @@
* @author Tim Harrison (harrison@cs.wustl.edu)
*/
//=============================================================================
+
#ifndef ACE_REMOTE_MUTEX_H
#define ACE_REMOTE_MUTEX_H
+
#include /**/ "ace/pre.h"
+
#include "ace/INET_Addr.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/SOCK_Connector.h"
#include "ace/SOCK_Stream.h"
#include "ace/Synch_Options.h"
#include "ace/Local_Tokens.h"
#include "ace/Token_Request_Reply.h"
+
#if defined (ACE_HAS_TOKENS_LIBRARY)
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Remote_Token_Proxy
*
@@ -41,8 +50,10 @@ class ACE_Export ACE_Remote_Token_Proxy : public ACE_Token_Proxy
public:
/// Null construction.
ACE_Remote_Token_Proxy (void);
+
/// Death.
virtual ~ACE_Remote_Token_Proxy (void);
+
/**
* Same as Token_Proxy. @a name is the string uniquely identifying
* the token. <ignore_deadlock> can be 1 to disable deadlock
@@ -52,6 +63,7 @@ public:
int ignore_deadlock = 0,
int debug = 0);
+
/**
* Open a connection with the token server. This only need be used
* when the user wishes to explicitly open a connection to check if
@@ -61,6 +73,7 @@ public:
* remote tokens.
*/
int initiate_connection (void);
+
/**
* Acquire the distributed token. If notify is specified and the
* token is already held, the owner is notified. options contains
@@ -72,6 +85,7 @@ public:
void (*sleep_hook)(void *) = 0,
ACE_Synch_Options &options =
ACE_Synch_Options::synch);
+
/**
* Try to acquire the distributed token. If the token is already
* held, the call returns without queueing the caller as a waiter.
@@ -79,6 +93,7 @@ public:
* EWOULDBLOCK if the token was already held.
*/
virtual int tryacquire (void (*sleep_hook)(void *) = 0);
+
/**
* Renew the token by offering to release it if there are any other
* waiters, otherwise get the token back immediately. This renew
@@ -95,6 +110,7 @@ public:
virtual int renew (int requeue_position = 0,
ACE_Synch_Options &options =
ACE_Synch_Options::synch);
+
/**
* Release the distributed token. Similar to ACE_Local_Mutex, if the
* caller is not the owner, it is removed from the waiter list (if
@@ -103,14 +119,18 @@ public:
*/
virtual int release (ACE_Synch_Options &options =
ACE_Synch_Options::synch);
+
/// Become interface compliant for ACE_Guard<>. This has no
/// functionality.
virtual int remove (ACE_Synch_Options &options =
ACE_Synch_Options::synch);
+
/// Override the default to do nothing.
virtual void token_acquired (ACE_TPQ_Entry *);
+
/// The client id of the current token holder
virtual const ACE_TCHAR* owner_id (void);
+
/**
* Sets the server address for all instances of ACE_Remote_Token_Proxy
* If this isn't called, the environment variable TOKEN_SERVER is
@@ -118,15 +138,20 @@ public:
* ACE_Remote_** operations will fail.
*/
static void set_server_address (const ACE_INET_Addr &server_address);
+
/// Dump the state of the class.
void dump (void) const;
+
protected:
+
/// If shadows report deadlock, go remote anyway
int ignore_shadow_deadlock_;
+
/// Perform the request and wait for the reply.
int request_reply (ACE_Token_Request &request,
ACE_Synch_Options &options);
};
+
/**
* @class ACE_Remote_Mutex
*
@@ -146,19 +171,24 @@ class ACE_Export ACE_Remote_Mutex : public ACE_Remote_Token_Proxy
public:
/// Null creation. Remote_Token_Proxy::open must be called.
ACE_Remote_Mutex (void);
+
/// Calls Remote_Token_Proxy::open for you.
ACE_Remote_Mutex (const ACE_TCHAR *token_name,
int ignore_deadlock = 0,
int debug = 0);
+
/// Dump the state of the class.
void dump (void) const;
+
/// Return deep copy.
virtual ACE_Token_Proxy *clone (void) const;
+
protected:
/// Make the correct type of ACE_Tokens.
/// This is called by the ACE_Token_Manager.
virtual ACE_Tokens *create_token (const ACE_TCHAR *name);
};
+
/**
* @class ACE_Remote_RLock
*
@@ -176,21 +206,28 @@ class ACE_Export ACE_Remote_RLock : public ACE_Remote_Token_Proxy
{
public:
ACE_Remote_RLock (void);
+
ACE_Remote_RLock (const ACE_TCHAR *token_name,
int ignore_deadlock = 0,
int debug = 0);
+
ACE_Remote_RLock (const ACE_Remote_RLock &mutex);
+
/// Dump the state of the class.
void dump (void) const;
+
/// Returns ACE_RW_Token::RLOCK;
virtual int type (void) const;
+
/// Return deep copy.
virtual ACE_Token_Proxy *clone (void) const;
+
protected:
/// Make the correct type of ACE_Tokens. This is called by the Token
/// Manager.
virtual ACE_Tokens *create_token (const ACE_TCHAR *name);
};
+
/**
* @class ACE_Remote_WLock
*
@@ -207,21 +244,28 @@ class ACE_Export ACE_Remote_WLock : public ACE_Remote_Token_Proxy
{
public:
ACE_Remote_WLock (void);
+
ACE_Remote_WLock (const ACE_TCHAR *token_name,
int ignore_deadlock = 0,
int debug = 0);
+
ACE_Remote_WLock (const ACE_Remote_WLock &mutex);
+
/// Dump the state of the class.
void dump (void) const;
+
/// Returns ACE_RW_Token::WLOCK;
virtual int type (void) const;
+
/// Return deep copy.
virtual ACE_Token_Proxy *clone (void) const;
+
protected:
/// Make the correct type of ACE_Tokens. This is called by the Token
/// Manager.
virtual ACE_Tokens *create_token (const ACE_TCHAR *name);
};
+
/**
* @class ACE_TSS_Connection
*
@@ -237,31 +281,43 @@ public:
// Necessary to make some compilers work...
ACE_TSS_Connection (void);
~ACE_TSS_Connection (void);
+
/// Retrieve the thread's connection
ACE_SOCK_Stream *get_connection (void);
+
/// Factory Method that creates a new SOCK Stream.
virtual ACE_SOCK_Stream *make_TSS_TYPE (void) const;
+
/// Inheritence and operator overloading don't mix. Redefine this
/// from ACE_TSS so that we can use it.
operator ACE_SOCK_Stream *(void);
+
/// Set the server address.
static void set_server_address (const ACE_INET_Addr &server_address);
+
/// Dump the state of the class.
void dump (void) const;
+
protected:
/// The address of the Token Server used by all instances of
/// Token_Proxy.
static ACE_INET_Addr server_address_;
+
private:
/// Private: should not be used
ACE_TSS_Connection (const ACE_TSS_Connection &);
void operator= (const ACE_TSS_Connection &);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_TOKENS_LIBRARY */
+
#if defined (__ACE_INLINE__)
#include "ace/Remote_Tokens.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_REMOTE_TOKEN_H */
diff --git a/dep/ACE_wrappers/ace/Remote_Tokens.inl b/dep/ACE_wrappers/ace/Remote_Tokens.inl
index e474d8733cb..3d811c00836 100644
--- a/dep/ACE_wrappers/ace/Remote_Tokens.inl
+++ b/dep/ACE_wrappers/ace/Remote_Tokens.inl
@@ -1,13 +1,17 @@
// -*- C++ -*-
//
// $Id: Remote_Tokens.inl 80826 2008-03-04 14:51:23Z wotte $
+
#if defined (ACE_HAS_TOKENS_LIBRARY)
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_Remote_Mutex::ACE_Remote_Mutex (void)
{
ACE_TRACE ("ACE_Remote_Mutex::ACE_Remote_Mutex");
}
+
ACE_INLINE
ACE_Remote_Mutex::ACE_Remote_Mutex (const ACE_TCHAR *token_name,
int ignore_deadlock,
@@ -16,7 +20,9 @@ ACE_Remote_Mutex::ACE_Remote_Mutex (const ACE_TCHAR *token_name,
ACE_TRACE ("ACE_Remote_Mutex::ACE_Remote_Mutex");
this->open (token_name, ignore_deadlock, debug);
}
+
// ************************************************************
+
ACE_INLINE
ACE_Remote_RLock::ACE_Remote_RLock (const ACE_TCHAR *token_name,
int ignore_deadlock,
@@ -25,7 +31,9 @@ ACE_Remote_RLock::ACE_Remote_RLock (const ACE_TCHAR *token_name,
ACE_TRACE ("ACE_Remote_RLock::ACE_Remote_RLock");
this->open (token_name, ignore_deadlock, debug);
}
+
// ************************************************************
+
ACE_INLINE
ACE_Remote_WLock::ACE_Remote_WLock (const ACE_TCHAR *token_name,
int ignore_deadlock,
@@ -34,5 +42,7 @@ ACE_Remote_WLock::ACE_Remote_WLock (const ACE_TCHAR *token_name,
ACE_TRACE ("ACE_Remote_WLock::ACE_Remote_WLock");
this->open (token_name, ignore_deadlock, debug);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_TOKENS_LIBRARY */
diff --git a/dep/ACE_wrappers/ace/Reverse_Lock_T.h b/dep/ACE_wrappers/ace/Reverse_Lock_T.h
index ca6866b3c93..979ee34ce63 100644
--- a/dep/ACE_wrappers/ace/Reverse_Lock_T.h
+++ b/dep/ACE_wrappers/ace/Reverse_Lock_T.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file Reverse_Lock_T.h
@@ -10,14 +11,19 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//==========================================================================
+
#ifndef ACE_REVERSE_LOCK_T_H
#define ACE_REVERSE_LOCK_T_H
#include /**/ "ace/pre.h"
+
#include "ace/Lock.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @namespace ACE_Acquire_Method
*
@@ -43,6 +49,7 @@ namespace ACE_Acquire_Method
ACE_WRITE
};
}
+
/**
* @class ACE_Reverse_Lock
*
@@ -65,49 +72,69 @@ template <class ACE_LOCKING_MECHANISM>
class ACE_Reverse_Lock : public ACE_Lock
{
public:
+
typedef ACE_LOCKING_MECHANISM ACE_LOCK;
+
// = Initialization/Finalization methods.
+
/// Constructor. All locking requests will be forwarded to <lock>.
ACE_Reverse_Lock (ACE_LOCKING_MECHANISM &lock,
ACE_Acquire_Method::METHOD_TYPE acquire_method = ACE_Acquire_Method::ACE_REGULAR);
+
/// Destructor. If <lock_> was not passed in by the user, it will be
/// deleted.
virtual ~ACE_Reverse_Lock (void);
+
// = Lock accessors.
/// Release the lock.
virtual int acquire (void);
+
/// Release the lock.
virtual int tryacquire (void);
+
/// Acquire the lock.
virtual int release (void);
+
/// Release the lock.
virtual int acquire_read (void);
+
/// Release the lock.
virtual int acquire_write (void);
+
/// Release the lock.
virtual int tryacquire_read (void);
+
/// Release the lock.
virtual int tryacquire_write (void);
+
/// Release the lock.
virtual int tryacquire_write_upgrade (void);
+
/// Explicitly destroy the lock.
virtual int remove (void);
+
private:
/// The concrete locking mechanism that all the methods delegate to.
ACE_LOCKING_MECHANISM &lock_;
+
/// This indicates what kind of acquire method will be called.
ACE_Acquire_Method::METHOD_TYPE acquire_method_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Reverse_Lock_T.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Reverse_Lock_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Reverse_Lock_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
#endif /* ACE_REVERSE_LOCK_T_H */
diff --git a/dep/ACE_wrappers/ace/Reverse_Lock_T.inl b/dep/ACE_wrappers/ace/Reverse_Lock_T.inl
index 567fefdcff4..27e3a9a5040 100644
--- a/dep/ACE_wrappers/ace/Reverse_Lock_T.inl
+++ b/dep/ACE_wrappers/ace/Reverse_Lock_T.inl
@@ -1,9 +1,12 @@
// -*- C++ -*-
//
// $Id: Reverse_Lock_T.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/config-all.h"
#include "ace/OS_NS_errno.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template <class ACE_LOCKING_MECHANISM> ACE_INLINE
ACE_Reverse_Lock<ACE_LOCKING_MECHANISM>::ACE_Reverse_Lock (
ACE_LOCKING_MECHANISM &lock,
@@ -12,4 +15,5 @@ ACE_Reverse_Lock<ACE_LOCKING_MECHANISM>::ACE_Reverse_Lock (
acquire_method_ (acquire_method)
{
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Rtems_init.c b/dep/ACE_wrappers/ace/Rtems_init.c
index faf8b63526b..3aad4d5a029 100644
--- a/dep/ACE_wrappers/ace/Rtems_init.c
+++ b/dep/ACE_wrappers/ace/Rtems_init.c
@@ -1,10 +1,13 @@
/*
* $Id: Rtems_init.c 80826 2008-03-04 14:51:23Z wotte $
*/
+
#if defined (ACE_HAS_RTEMS)
+
#define RTEMS_BSP_NETWORK_DRIVER_NAME "ne1"
#define RTEMS_BSP_NETWORK_DRIVER_ATTACH rtems_ne_driver_attach
#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 256
+
#define CONFIGURE_MAXIMUM_POSIX_THREADS 100
#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 300
#define CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES 300
@@ -16,10 +19,14 @@
#define CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT Init
#define CONFIGURE_MEMORY_FOR_POSIX (10*1024)
#define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE (10*1024)
+
#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
#define CONFIGURE_EXECUTIVE_RAM_SIZE (512*1024)
+
#define CONFIGURE_MICROSECONDS_PER_TICK 10000
+
#define CONFIGURE_MAXIMUM_SEMAPHORES 100
#define CONFIGURE_MAXIMUM_TASKS 100
#define CONFIGURE_INIT_TASK_PRIORITY 120
@@ -27,14 +34,23 @@
RTEMS_NO_TIMESLICE | \
RTEMS_NO_ASR | \
RTEMS_INTERRUPT_LEVEL(0))
+
#include <bsp.h>
+
char *rtems_progname;
+
#define CONFIGURE_INIT
+
rtems_task Init (rtems_task_argument argument);
+
#include <confdefs.h>
+
#include <stdio.h>
+
#if !defined (ACE_LACKS_NETWORKING)
+
#include <rtems/rtems_bsdnet.h>
+
/*
* Network configuration
*
@@ -43,18 +59,24 @@ rtems_task Init (rtems_task_argument argument);
* BEFORE RUNNING ANY RTEMS PROGRAMS WHICH USE THE NETWORK! *
************************************************************
*/
+
#ifndef _RTEMS_NETWORKCONFIG_H_
#define _RTEMS_NETWORKCONFIG_H_
+
#ifndef RTEMS_BSP_NETWORK_DRIVER_NAME
#warning "RTEMS_BSP_NETWORK_DRIVER_NAME is not defined"
#define RTEMS_BSP_NETWORK_DRIVER_NAME "no_network1"
#endif
+
#ifndef RTEMS_BSP_NETWORK_DRIVER_ATTACH
#warning "RTEMS_BSP_NETWORK_DRIVER_ATTACH is not defined"
#define RTEMS_BSP_NETWORK_DRIVER_ATTACH 0
#endif
+
/* #define RTEMS_USE_BOOTP */
+
#include <bsp.h>
+
/*
* Define RTEMS_SET_ETHERNET_ADDRESS if you want to specify the
* Ethernet address here. If RTEMS_SET_ETHERNET_ADDRESS is not
@@ -63,13 +85,17 @@ rtems_task Init (rtems_task_argument argument);
#define RTEMS_SET_ETHERNET_ADDRESS
#if (defined (RTEMS_SET_ETHERNET_ADDRESS))
static char ethernet_address[6] = { 0x00, 0x80, 0x7F, 0x22, 0x61, 0x77 };
+
#endif
+
#define RTEMS_USE_LOOPBACK
+
#ifdef RTEMS_USE_LOOPBACK
/*
* Loopback interface
*/
int rtems_bsdnet_loopattach(struct rtems_bsdnet_ifconfig *, int);
+
#ifdef RTEMS_USE_LOOPBACK_ONLY
static struct rtems_bsdnet_ifconfig netdriver_config = {
#else
@@ -82,6 +108,7 @@ static struct rtems_bsdnet_ifconfig loopback_config = {
"255.0.0.0", /* IP net mask */
};
#endif
+
/*
* Default network interface
*/
@@ -89,11 +116,13 @@ static struct rtems_bsdnet_ifconfig loopback_config = {
static struct rtems_bsdnet_ifconfig netdriver_config = {
RTEMS_BSP_NETWORK_DRIVER_NAME, /* name */
RTEMS_BSP_NETWORK_DRIVER_ATTACH, /* attach function */
+
#ifdef RTEMS_USE_LOOPBACK
&loopback_config, /* link to next interface */
#else
0, /* No more interfaces */
#endif
+
#if (defined (RTEMS_USE_BOOTP))
0, /* BOOTP supplies IP address */
0, /* BOOTP supplies IP net mask */
@@ -101,6 +130,7 @@ static struct rtems_bsdnet_ifconfig netdriver_config = {
"XXX.YYY.ZZZ.XYZ", /* IP address */
"255.255.255.0", /* IP net mask */
#endif /* !RTEMS_USE_BOOTP */
+
#if (defined (RTEMS_SET_ETHERNET_ADDRESS))
ethernet_address, /* Ethernet hardware address */
#else
@@ -109,19 +139,23 @@ static struct rtems_bsdnet_ifconfig netdriver_config = {
0 /* Use default driver parameters */
};
#endif
+
/*
* Network configuration
*/
struct rtems_bsdnet_config rtems_bsdnet_config = {
&netdriver_config,
+
#if (defined (RTEMS_USE_BOOTP))
rtems_bsdnet_do_bootp,
#else
0,
#endif
+
0, /* Default network task priority */
0, /* Default mbuf capacity */
0, /* Default mbuf cluster capacity */
+
#if (!defined (RTEMS_USE_BOOTP))
"rtems_host", /* Host name */
"nodomain.com", /* Domain name */
@@ -129,9 +163,11 @@ struct rtems_bsdnet_config rtems_bsdnet_config = {
"XXX.YYY.ZZZ.1", /* Log host */
{"XXX.YYY.ZZZ.1" }, /* Name server(s) */
{"XXX.YYY.ZZZ.1" }, /* NTP server(s) */
+
/*
* A real example -- DO NOT USE THIS YOURSELF!!!
*/
+
#if 0
"dy4", /* Host name */
"NOT_oarcorp.com", /* Domain name */
@@ -141,7 +177,9 @@ struct rtems_bsdnet_config rtems_bsdnet_config = {
{"192.168.1.2" }, /* NTP server(s) */
#endif
#endif /* !RTEMS_USE_BOOTP */
+
};
+
/*
* For TFTP test application
*/
@@ -152,9 +190,13 @@ struct rtems_bsdnet_config rtems_bsdnet_config = {
#define RTEMS_TFTP_TEST_HOST_NAME "XXX.YYY.ZZZ.XYZ"
#define RTEMS_TFTP_TEST_FILE_NAME "tftptest"
#endif
+
#endif /* _RTEMS_NETWORKCONFIG_H_ */
+
#endif /* ACE_LACKS_NETWORKING */
+
extern int main (int, char *[]);
+
/*
* RTEMS Startup Task
*/
@@ -170,6 +212,7 @@ Init (rtems_task_argument not_used)
retval = main (0, 0);
}
}
+
#elif !defined (__GNUC__) && !defined (__INTEL_COMPILER)
/* Make compilers stop complaining about an empty translation unit */
static int shut_up_compiler = 0;
diff --git a/dep/ACE_wrappers/ace/SOCK.cpp b/dep/ACE_wrappers/ace/SOCK.cpp
index 0890e7ae73b..555e5876873 100644
--- a/dep/ACE_wrappers/ace/SOCK.cpp
+++ b/dep/ACE_wrappers/ace/SOCK.cpp
@@ -1,12 +1,18 @@
// $Id: SOCK.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/SOCK.h"
#include "ace/Log_Msg.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/SOCK.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace, SOCK, "$Id: SOCK.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_SOCK)
+
void
ACE_SOCK::dump (void) const
{
@@ -14,46 +20,59 @@ ACE_SOCK::dump (void) const
ACE_TRACE ("ACE_SOCK::dump");
#endif /* ACE_HAS_DUMP */
}
+
ACE_SOCK::ACE_SOCK (void)
{
// ACE_TRACE ("ACE_SOCK::ACE_SOCK");
}
+
// Returns information about the remote peer endpoint (if there is
// one).
+
int
ACE_SOCK::get_remote_addr (ACE_Addr &sa) const
{
ACE_TRACE ("ACE_SOCK::get_remote_addr");
+
int len = sa.get_size ();
sockaddr *addr = reinterpret_cast<sockaddr *> (sa.get_addr ());
+
if (ACE_OS::getpeername (this->get_handle (),
addr,
&len) == -1)
return -1;
+
sa.set_size (len);
sa.set_type (addr->sa_family);
return 0;
}
+
int
ACE_SOCK::get_local_addr (ACE_Addr &sa) const
{
ACE_TRACE ("ACE_SOCK::get_local_addr");
+
int len = sa.get_size ();
sockaddr *addr = reinterpret_cast<sockaddr *> (sa.get_addr ());
+
if (ACE_OS::getsockname (this->get_handle (),
addr,
&len) == -1)
return -1;
+
sa.set_type (addr->sa_family);
sa.set_size (len);
return 0;
}
+
// Close down a ACE_SOCK.
+
int
ACE_SOCK::close (void)
{
ACE_TRACE ("ACE_SOCK::close");
int result = 0;
+
if (this->get_handle () != ACE_INVALID_HANDLE)
{
result = ACE_OS::closesocket (this->get_handle ());
@@ -61,6 +80,7 @@ ACE_SOCK::close (void)
}
return result;
}
+
int
ACE_SOCK::open (int type,
int protocol_family,
@@ -69,9 +89,11 @@ ACE_SOCK::open (int type,
{
ACE_TRACE ("ACE_SOCK::open");
int one = 1;
+
this->set_handle (ACE_OS::socket (protocol_family,
type,
protocol));
+
if (this->get_handle () == ACE_INVALID_HANDLE)
return -1;
else if (protocol_family != PF_UNIX
@@ -86,8 +108,10 @@ ACE_SOCK::open (int type,
}
return 0;
}
+
// General purpose constructor for performing server ACE_SOCK
// creation.
+
ACE_SOCK::ACE_SOCK (int type,
int protocol_family,
int protocol,
@@ -102,6 +126,7 @@ ACE_SOCK::ACE_SOCK (int type,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_SOCK::ACE_SOCK")));
}
+
int
ACE_SOCK::open (int type,
int protocol_family,
@@ -112,6 +137,7 @@ ACE_SOCK::open (int type,
int reuse_addr)
{
ACE_TRACE ("ACE_SOCK::open");
+
this->set_handle (ACE_OS::socket (protocol_family,
type,
protocol,
@@ -119,6 +145,7 @@ ACE_SOCK::open (int type,
g,
flags));
int one = 1;
+
if (this->get_handle () == ACE_INVALID_HANDLE)
return -1;
else if (reuse_addr
@@ -133,6 +160,7 @@ ACE_SOCK::open (int type,
else
return 0;
}
+
ACE_SOCK::ACE_SOCK (int type,
int protocol_family,
int protocol,
@@ -153,5 +181,6 @@ ACE_SOCK::ACE_SOCK (int type,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_SOCK::ACE_SOCK")));
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/SOCK.h b/dep/ACE_wrappers/ace/SOCK.h
index ea44671ef71..3d8b13cf24f 100644
--- a/dep/ACE_wrappers/ace/SOCK.h
+++ b/dep/ACE_wrappers/ace/SOCK.h
@@ -1,4 +1,5 @@
/* -*- C++ -*- */
+
//=============================================================================
/**
* @file SOCK.h
@@ -8,17 +9,23 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_SOCK_H
#define ACE_SOCK_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Addr.h"
#include "ace/IPC_SAP.h"
#include "ace/OS_NS_stropts.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_SOCK
*
@@ -34,16 +41,19 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
class ACE_Export ACE_SOCK : public ACE_IPC_SAP
{
public:
+
/// Wrapper around the @c setsockopt system call.
int set_option (int level,
int option,
void *optval,
int optlen) const;
+
/// Wrapper around the @c getsockopt system call.
int get_option (int level,
int option,
void *optval,
int *optlen) const;
+
/**
* Close the socket.
* This method also sets the object's handle value to ACE_INVALID_HANDLE.
@@ -52,24 +62,30 @@ public:
* was already ACE_INVALID_HANDLE.
*/
int close (void);
+
/// Return the local endpoint address in the referenced <ACE_Addr>.
/// Returns 0 if successful, else -1.
int get_local_addr (ACE_Addr &) const;
+
/**
* Return the address of the remotely connected peer (if there is
* one), in the referenced ACE_Addr. Returns 0 if successful, else
* -1.
*/
int get_remote_addr (ACE_Addr &) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
/// Wrapper around the BSD-style @c socket system call (no QoS).
int open (int type,
int protocol_family,
int protocol,
int reuse_addr);
+
/// Wrapper around the QoS-enabled @c WSASocket function.
int open (int type,
int protocol_family,
@@ -78,13 +94,16 @@ public:
ACE_SOCK_GROUP g,
u_long flags,
int reuse_addr);
+
protected:
+
/// Constructor with arguments to call the BSD-style @c socket system
/// call (no QoS).
ACE_SOCK (int type,
int protocol_family,
int protocol = 0,
int reuse_addr = 0);
+
/// Constructor with arguments to call the QoS-enabled @c WSASocket
/// function.
ACE_SOCK (int type,
@@ -94,9 +113,11 @@ protected:
ACE_SOCK_GROUP g,
u_long flags,
int reuse_addr);
+
/// Default constructor is protected to prevent instances of this class
/// from being defined.
ACE_SOCK (void);
+
/// Protected destructor.
/**
* Not a virtual destructor. Protected destructor to prevent
@@ -104,11 +125,15 @@ protected:
* pointer/reference.
*/
~ACE_SOCK (void);
+
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/SOCK.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_SOCK_H */
diff --git a/dep/ACE_wrappers/ace/SOCK.inl b/dep/ACE_wrappers/ace/SOCK.inl
index 6285f1a6f48..957ad5ac50c 100644
--- a/dep/ACE_wrappers/ace/SOCK.inl
+++ b/dep/ACE_wrappers/ace/SOCK.inl
@@ -1,13 +1,17 @@
// -*- C++ -*-
//
// $Id: SOCK.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_sys_socket.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_SOCK::~ACE_SOCK (void)
{
// ACE_TRACE ("ACE_SOCK::~ACE_SOCK");
}
+
ACE_INLINE int
ACE_SOCK::set_option (int level,
int option,
@@ -18,7 +22,9 @@ ACE_SOCK::set_option (int level,
return ACE_OS::setsockopt (this->get_handle (), level,
option, (char *) optval, optlen);
}
+
// Provides access to the ACE_OS::getsockopt system call.
+
ACE_INLINE int
ACE_SOCK::get_option (int level,
int option,
@@ -29,4 +35,5 @@ ACE_SOCK::get_option (int level,
return ACE_OS::getsockopt (this->get_handle (), level,
option, (char *) optval, optlen);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/SOCK_Acceptor.cpp b/dep/ACE_wrappers/ace/SOCK_Acceptor.cpp
index 1fe0fb3e557..3dd98cbd335 100644
--- a/dep/ACE_wrappers/ace/SOCK_Acceptor.cpp
+++ b/dep/ACE_wrappers/ace/SOCK_Acceptor.cpp
@@ -1,32 +1,45 @@
// $Id: SOCK_Acceptor.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/SOCK_Acceptor.h"
+
#include "ace/Log_Msg.h"
#include "ace/OS_Errno.h"
#include "ace/OS_NS_string.h"
#include "ace/OS_NS_sys_socket.h"
#include "ace/os_include/os_fcntl.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/SOCK_Acceptor.inl"
#endif /* __ACE_INLINE__ */
+
#if !defined (ACE_HAS_WINCE)
#include "ace/OS_QoS.h"
#endif // ACE_HAS_WINCE
+
ACE_RCSID(ace, SOCK_Acceptor, "$Id: SOCK_Acceptor.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_SOCK_Acceptor)
+
// Do nothing routine for constructor.
+
ACE_SOCK_Acceptor::ACE_SOCK_Acceptor (void)
{
ACE_TRACE ("ACE_SOCK_Acceptor::ACE_SOCK_Acceptor");
}
+
// Performs the timed accept operation.
+
int
ACE_SOCK_Acceptor::shared_accept_start (ACE_Time_Value *timeout,
int restart,
int &in_blocking_mode) const
{
ACE_TRACE ("ACE_SOCK_Acceptor::shared_accept_start");
+
ACE_HANDLE handle = this->get_handle ();
+
// Handle the case where we're doing a timed <accept>.
if (timeout != 0)
{
@@ -46,15 +59,19 @@ ACE_SOCK_Acceptor::shared_accept_start (ACE_Time_Value *timeout,
return -1;
}
}
+
return 0;
}
+
int
ACE_SOCK_Acceptor::shared_accept_finish (ACE_SOCK_Stream new_stream,
int in_blocking_mode,
int reset_new_handle) const
{
ACE_TRACE ("ACE_SOCK_Acceptor::shared_accept_finish ()");
+
ACE_HANDLE new_handle = new_stream.get_handle ();
+
// Check to see if we were originally in blocking mode, and if so,
// set the <new_stream>'s handle and <this> handle to be in blocking
// mode.
@@ -62,6 +79,7 @@ ACE_SOCK_Acceptor::shared_accept_finish (ACE_SOCK_Stream new_stream,
{
// Save/restore errno.
ACE_Errno_Guard error (errno);
+
// Only disable ACE_NONBLOCK if we weren't in non-blocking mode
// originally.
ACE::clr_flags (this->get_handle (),
@@ -69,6 +87,7 @@ ACE_SOCK_Acceptor::shared_accept_finish (ACE_SOCK_Stream new_stream,
ACE::clr_flags (new_handle,
ACE_NONBLOCK);
}
+
#if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
if (reset_new_handle)
// Reset the event association inherited by the new handle.
@@ -76,9 +95,12 @@ ACE_SOCK_Acceptor::shared_accept_finish (ACE_SOCK_Stream new_stream,
#else
ACE_UNUSED_ARG (reset_new_handle);
#endif /* ACE_WIN32 */
+
return new_handle == ACE_INVALID_HANDLE ? -1 : 0;
}
+
// General purpose routine for accepting new connections.
+
int
ACE_SOCK_Acceptor::accept (ACE_SOCK_Stream &new_stream,
ACE_Addr *remote_addr,
@@ -87,6 +109,7 @@ ACE_SOCK_Acceptor::accept (ACE_SOCK_Stream &new_stream,
int reset_new_handle) const
{
ACE_TRACE ("ACE_SOCK_Acceptor::accept");
+
int in_blocking_mode = 0;
if (this->shared_accept_start (timeout,
restart,
@@ -99,12 +122,14 @@ ACE_SOCK_Acceptor::accept (ACE_SOCK_Stream &new_stream,
int *len_ptr = 0;
sockaddr *addr = 0;
int len = 0;
+
if (remote_addr != 0)
{
len = remote_addr->get_size ();
len_ptr = &len;
addr = (sockaddr *) remote_addr->get_addr ();
}
+
do
new_stream.set_handle (ACE_OS::accept (this->get_handle (),
addr,
@@ -113,6 +138,7 @@ ACE_SOCK_Acceptor::accept (ACE_SOCK_Stream &new_stream,
&& restart != 0
&& errno == EINTR
&& timeout == 0);
+
// Reset the size of the addr, so the proper UNIX/IPv4/IPv6 family
// is known.
if (new_stream.get_handle () != ACE_INVALID_HANDLE
@@ -123,10 +149,12 @@ ACE_SOCK_Acceptor::accept (ACE_SOCK_Stream &new_stream,
remote_addr->set_type (addr->sa_family);
}
}
+
return this->shared_accept_finish (new_stream,
in_blocking_mode,
reset_new_handle);
}
+
#if !defined (ACE_HAS_WINCE)
int
ACE_SOCK_Acceptor::accept (ACE_SOCK_Stream &new_stream,
@@ -137,6 +165,7 @@ ACE_SOCK_Acceptor::accept (ACE_SOCK_Stream &new_stream,
int reset_new_handle) const
{
ACE_TRACE ("ACE_SOCK_Acceptor::accept");
+
int in_blocking_mode = 0;
if (this->shared_accept_start (timeout,
restart,
@@ -149,12 +178,14 @@ ACE_SOCK_Acceptor::accept (ACE_SOCK_Stream &new_stream,
int *len_ptr = 0;
int len = 0;
sockaddr *addr = 0;
+
if (remote_addr != 0)
{
len = remote_addr->get_size ();
len_ptr = &len;
addr = (sockaddr *) remote_addr->get_addr ();
}
+
do
new_stream.set_handle (ACE_OS::accept (this->get_handle (),
addr,
@@ -164,17 +195,20 @@ ACE_SOCK_Acceptor::accept (ACE_SOCK_Stream &new_stream,
&& restart != 0
&& errno == EINTR
&& timeout == 0);
+
// Reset the size of the addr, which is only necessary for UNIX
// domain sockets.
if (new_stream.get_handle () != ACE_INVALID_HANDLE
&& remote_addr != 0)
remote_addr->set_size (len);
}
+
return this->shared_accept_finish (new_stream,
in_blocking_mode,
reset_new_handle);
}
#endif // ACE_HAS_WINCE
+
void
ACE_SOCK_Acceptor::dump (void) const
{
@@ -182,6 +216,7 @@ ACE_SOCK_Acceptor::dump (void) const
ACE_TRACE ("ACE_SOCK_Acceptor::dump");
#endif /* ACE_HAS_DUMP */
}
+
int
ACE_SOCK_Acceptor::shared_open (const ACE_Addr &local_sap,
int protocol_family,
@@ -189,6 +224,7 @@ ACE_SOCK_Acceptor::shared_open (const ACE_Addr &local_sap,
{
ACE_TRACE ("ACE_SOCK_Acceptor::shared_open");
int error = 0;
+
#if defined (ACE_HAS_IPV6)
if (protocol_family == PF_INET6)
{
@@ -196,6 +232,7 @@ ACE_SOCK_Acceptor::shared_open (const ACE_Addr &local_sap,
ACE_OS::memset (reinterpret_cast<void *> (&local_inet6_addr),
0,
sizeof local_inet6_addr);
+
if (local_sap == ACE_Addr::sap_any)
{
local_inet6_addr.sin6_family = AF_INET6;
@@ -204,6 +241,7 @@ ACE_SOCK_Acceptor::shared_open (const ACE_Addr &local_sap,
}
else
local_inet6_addr = *reinterpret_cast<sockaddr_in6 *> (local_sap.get_addr ());
+
// We probably don't need a bind_port written here.
// There are currently no supported OS's that define
// ACE_LACKS_WILDCARD_BIND.
@@ -220,6 +258,7 @@ ACE_SOCK_Acceptor::shared_open (const ACE_Addr &local_sap,
ACE_OS::memset (reinterpret_cast<void *> (&local_inet_addr),
0,
sizeof local_inet_addr);
+
if (local_sap == ACE_Addr::sap_any)
{
local_inet_addr.sin_port = 0;
@@ -241,6 +280,7 @@ ACE_SOCK_Acceptor::shared_open (const ACE_Addr &local_sap,
(sockaddr *) local_sap.get_addr (),
local_sap.get_size ()) == -1)
error = 1;
+
if (error != 0
|| ACE_OS::listen (this->get_handle (),
backlog) == -1)
@@ -249,8 +289,10 @@ ACE_SOCK_Acceptor::shared_open (const ACE_Addr &local_sap,
error = 1;
this->close ();
}
+
return error ? -1 : 0;
}
+
int
ACE_SOCK_Acceptor::open (const ACE_Addr &local_sap,
ACE_Protocol_Info *protocolinfo,
@@ -262,8 +304,10 @@ ACE_SOCK_Acceptor::open (const ACE_Addr &local_sap,
int protocol)
{
ACE_TRACE ("ACE_SOCK_Acceptor::open");
+
if (protocol_family == PF_UNSPEC)
protocol_family = local_sap.get_type ();
+
if (ACE_SOCK::open (SOCK_STREAM,
protocol_family,
protocol,
@@ -277,6 +321,7 @@ ACE_SOCK_Acceptor::open (const ACE_Addr &local_sap,
protocol_family,
backlog);
}
+
ACE_SOCK_Acceptor::ACE_SOCK_Acceptor (const ACE_Addr &local_sap,
ACE_Protocol_Info *protocolinfo,
ACE_SOCK_GROUP g,
@@ -299,7 +344,9 @@ ACE_SOCK_Acceptor::ACE_SOCK_Acceptor (const ACE_Addr &local_sap,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_SOCK_Acceptor")));
}
+
// General purpose routine for performing server ACE_SOCK creation.
+
int
ACE_SOCK_Acceptor::open (const ACE_Addr &local_sap,
int reuse_addr,
@@ -308,6 +355,7 @@ ACE_SOCK_Acceptor::open (const ACE_Addr &local_sap,
int protocol)
{
ACE_TRACE ("ACE_SOCK_Acceptor::open");
+
if (local_sap != ACE_Addr::sap_any)
protocol_family = local_sap.get_type ();
else if (protocol_family == PF_UNSPEC)
@@ -318,6 +366,7 @@ ACE_SOCK_Acceptor::open (const ACE_Addr &local_sap,
protocol_family = PF_INET;
#endif /* ACE_HAS_IPV6 */
}
+
if (ACE_SOCK::open (SOCK_STREAM,
protocol_family,
protocol,
@@ -328,7 +377,9 @@ ACE_SOCK_Acceptor::open (const ACE_Addr &local_sap,
protocol_family,
backlog);
}
+
// General purpose routine for performing server ACE_SOCK creation.
+
ACE_SOCK_Acceptor::ACE_SOCK_Acceptor (const ACE_Addr &local_sap,
int reuse_addr,
int protocol_family,
@@ -345,10 +396,12 @@ ACE_SOCK_Acceptor::ACE_SOCK_Acceptor (const ACE_Addr &local_sap,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_SOCK_Acceptor")));
}
+
int
ACE_SOCK_Acceptor::close (void)
{
return ACE_SOCK::close ();
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/SOCK_Acceptor.h b/dep/ACE_wrappers/ace/SOCK_Acceptor.h
index 231d1e0f57e..e854ec07737 100644
--- a/dep/ACE_wrappers/ace/SOCK_Acceptor.h
+++ b/dep/ACE_wrappers/ace/SOCK_Acceptor.h
@@ -1,4 +1,5 @@
/* -*- C++ -*- */
+
//=============================================================================
/**
* @file SOCK_Acceptor.h
@@ -8,16 +9,22 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_SOCK_ACCEPTOR_H
#define ACE_SOCK_ACCEPTOR_H
#include /**/ "ace/pre.h"
+
#include "ace/SOCK_Stream.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Time_Value;
class ACE_Accept_QoS_Params;
+
/**
* @class ACE_SOCK_Acceptor
*
@@ -35,6 +42,7 @@ public:
// = Initialization and termination methods.
/// Default constructor.
ACE_SOCK_Acceptor (void);
+
/**
* Initialize a passive-mode BSD-style acceptor socket (no QoS).
* @a local_sap is the address that we're going to listen for
@@ -46,6 +54,7 @@ public:
int protocol_family = PF_UNSPEC,
int backlog = ACE_DEFAULT_BACKLOG,
int protocol = 0);
+
/// Initialize a passive-mode QoS-enabled acceptor socket. Returns 0
/// on success and -1 on failure.
ACE_SOCK_Acceptor (const ACE_Addr &local_sap,
@@ -56,6 +65,7 @@ public:
int protocol_family = PF_UNSPEC,
int backlog = ACE_DEFAULT_BACKLOG,
int protocol = 0);
+
/**
* Initialize a passive-mode BSD-style acceptor socket (no QoS).
* @a local_sap is the address that we're going to listen for
@@ -68,6 +78,7 @@ public:
int protocol_family = PF_UNSPEC,
int backlog = ACE_DEFAULT_BACKLOG,
int protocol = 0);
+
/// Initialize a passive-mode QoS-enabled acceptor socket. Returns 0
/// on success and -1 on failure.
int open (const ACE_Addr &local_sap,
@@ -78,10 +89,13 @@ public:
int protocol_family = PF_UNSPEC,
int backlog = ACE_DEFAULT_BACKLOG,
int protocol = 0);
+
/// Close the socket. Returns 0 on success and -1 on failure.
int close (void);
+
/// Default dtor.
~ACE_SOCK_Acceptor (void);
+
// = Passive connection <accept> methods.
/**
* Accept a new ACE_SOCK_Stream connection. A @a timeout of 0
@@ -97,6 +111,7 @@ public:
ACE_Time_Value *timeout = 0,
int restart = 1,
int reset_new_handle = 0) const;
+
#if !defined (ACE_HAS_WINCE)
/**
* Accept a new ACE_SOCK_Stream connection using the QoS
@@ -115,24 +130,30 @@ public:
int restart = 1,
int reset_new_handle = 0) const;
#endif // ACE_HAS_WINCE
+
// = Meta-type info
typedef ACE_INET_Addr PEER_ADDR;
typedef ACE_SOCK_Stream PEER_STREAM;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
/// Perform operations that must occur before <ACE_OS::accept> is
/// called.
int shared_accept_start (ACE_Time_Value *timeout,
int restart,
int &in_blocking_mode) const;
+
/// Perform operations that must occur after <ACE_OS::accept> is
/// called.
int shared_accept_finish (ACE_SOCK_Stream new_stream,
int in_blocking_mode,
int reset_new_handle) const;
+
/**
* This method factors out the common <open> code and is called by
* both the QoS-enabled <open> method and the BSD-style <open>
@@ -141,14 +162,18 @@ protected:
int shared_open (const ACE_Addr &local_sap,
int protocol_family,
int backlog);
+
private:
/// Do not allow this function to percolate up to this interface...
int get_remote_addr (ACE_Addr &) const;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/SOCK_Acceptor.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_SOCK_ACCEPTOR_H */
diff --git a/dep/ACE_wrappers/ace/SOCK_Acceptor.inl b/dep/ACE_wrappers/ace/SOCK_Acceptor.inl
index b2d8e1022b0..fec79aeecd6 100644
--- a/dep/ACE_wrappers/ace/SOCK_Acceptor.inl
+++ b/dep/ACE_wrappers/ace/SOCK_Acceptor.inl
@@ -1,10 +1,13 @@
// -*- C++ -*-
//
// $Id: SOCK_Acceptor.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_SOCK_Acceptor::~ACE_SOCK_Acceptor (void)
{
ACE_TRACE ("ACE_SOCK_Acceptor::~ACE_SOCK_Acceptor");
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/SOCK_CODgram.cpp b/dep/ACE_wrappers/ace/SOCK_CODgram.cpp
index 6a19ba699c6..97fb7ec0391 100644
--- a/dep/ACE_wrappers/ace/SOCK_CODgram.cpp
+++ b/dep/ACE_wrappers/ace/SOCK_CODgram.cpp
@@ -1,13 +1,19 @@
// $Id: SOCK_CODgram.cpp 82540 2008-08-06 13:02:53Z johnnyw $
+
#include "ace/SOCK_CODgram.h"
#include "ace/Log_Msg.h"
#include "ace/OS_NS_sys_socket.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/SOCK_CODgram.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace, SOCK_CODgram, "$Id: SOCK_CODgram.cpp 82540 2008-08-06 13:02:53Z johnnyw $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_SOCK_CODgram)
+
void
ACE_SOCK_CODgram::dump (void) const
{
@@ -15,7 +21,9 @@ ACE_SOCK_CODgram::dump (void) const
ACE_TRACE ("ACE_SOCK_CODgram::dump");
#endif /* ACE_HAS_DUMP */
}
+
// Here's the general-purpose constructor.
+
ACE_SOCK_CODgram::ACE_SOCK_CODgram (const ACE_Addr &remote,
const ACE_Addr &local,
int protocol_family,
@@ -30,22 +38,28 @@ ACE_SOCK_CODgram::ACE_SOCK_CODgram (const ACE_Addr &remote,
reuse_addr) == -1)
ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ACE_SOCK_CODgram")));
}
+
/* This is the general-purpose open routine. Note that it performs
a different set of functions depending on the LOCAL and REMOTE
addresses passed to it. Here's the basic logic:
+
1. remote == ACE_Addr::sap_any && local == ACE_Addr::sap_any
if protocol_family == PF_INET || PF_INET6 then
bind the local address to a randomly generated port number...
+
2. remote == ACE_Addr::sap_any && local != ACE_Addr::sap_any
we are just binding the local address
(used primarily by servers)
+
3. remote != ACE_Addr::sap_any && local == ACE_Addr::sap_any
we are connecting to the remote address
(used primarily by clients)
+
4. remote != ACE_Addr::sap_any && local != ACE_Addr::sap_any
we are binding to the local address
and connecting to the remote address
*/
+
int
ACE_SOCK_CODgram::open (const ACE_Addr &remote, const ACE_Addr &local,
int protocol_family, int protocol,
@@ -86,6 +100,7 @@ ACE_SOCK_CODgram::open (const ACE_Addr &remote, const ACE_Addr &local,
else
{
bool error = false;
+
if (local == ACE_Addr::sap_any && remote == ACE_Addr::sap_any)
{
// Assign an arbitrary port number from the transient range!!
@@ -132,5 +147,6 @@ ACE_SOCK_CODgram::open (const ACE_Addr &remote, const ACE_Addr &local,
return error ? -1 : 0;
}
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/SOCK_CODgram.h b/dep/ACE_wrappers/ace/SOCK_CODgram.h
index 4c9c6187708..761a92d9d31 100644
--- a/dep/ACE_wrappers/ace/SOCK_CODgram.h
+++ b/dep/ACE_wrappers/ace/SOCK_CODgram.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file SOCK_CODgram.h
@@ -9,17 +10,23 @@
*/
//=============================================================================
+
#ifndef ACE_SOCK_CODGRAM_H
#define ACE_SOCK_CODGRAM_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/SOCK_IO.h"
#include "ace/Addr.h"
#include "ace/INET_Addr.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_SOCK_CODgram
*
@@ -31,6 +38,7 @@ class ACE_Export ACE_SOCK_CODgram : public ACE_SOCK_IO
public:
/// Default constructor.
ACE_SOCK_CODgram (void);
+
/**
* Constructor with addresses specified. Calls open().
* This constructor binds and/or connects to a specified address,
@@ -70,9 +78,12 @@ public:
int protocol_family = ACE_PROTOCOL_FAMILY_INET,
int protocol = 0,
int reuse_addr = 0);
+
/// Default dtor.
~ACE_SOCK_CODgram (void);
+
// Initiate a connected dgram.
+
/**
* Initiate a connected datagram socket, optionally binding an
* unused port number.
@@ -111,17 +122,23 @@ public:
int protocol_family = ACE_PROTOCOL_FAMILY_INET,
int protocol = 0,
int reuse_addr = 0);
+
// = Meta-type info.
typedef ACE_INET_Addr PEER_ADDR;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/SOCK_CODgram.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_SOCK_CODGRAM_H */
diff --git a/dep/ACE_wrappers/ace/SOCK_CODgram.inl b/dep/ACE_wrappers/ace/SOCK_CODgram.inl
index 26b3b370064..a05228b3654 100644
--- a/dep/ACE_wrappers/ace/SOCK_CODgram.inl
+++ b/dep/ACE_wrappers/ace/SOCK_CODgram.inl
@@ -1,15 +1,19 @@
// -*- C++ -*-
//
// $Id: SOCK_CODgram.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_SOCK_CODgram::ACE_SOCK_CODgram (void)
{
ACE_TRACE ("ACE_SOCK_CODgram::ACE_SOCK_CODgram");
}
+
ACE_INLINE
ACE_SOCK_CODgram::~ACE_SOCK_CODgram (void)
{
ACE_TRACE ("ACE_SOCK_CODgram::~ACE_SOCK_CODgram");
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/SOCK_Connector.cpp b/dep/ACE_wrappers/ace/SOCK_Connector.cpp
index d633ec5c871..df09a46b4d2 100644
--- a/dep/ACE_wrappers/ace/SOCK_Connector.cpp
+++ b/dep/ACE_wrappers/ace/SOCK_Connector.cpp
@@ -1,19 +1,26 @@
// $Id: SOCK_Connector.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/SOCK_Connector.h"
#include "ace/INET_Addr.h"
#include "ace/Log_Msg.h"
#include "ace/OS_NS_unistd.h"
#include "ace/OS_NS_sys_socket.h"
#include "ace/os_include/os_fcntl.h"
+
#if !defined (ACE_HAS_WINCE)
#include "ace/OS_QoS.h"
#endif // ACE_HAS_WINCE
+
#if !defined (__ACE_INLINE__)
#include "ace/SOCK_Connector.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace, SOCK_Connector, "$Id: SOCK_Connector.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_SOCK_Connector)
+
void
ACE_SOCK_Connector::dump (void) const
{
@@ -21,6 +28,7 @@ ACE_SOCK_Connector::dump (void) const
ACE_TRACE ("ACE_SOCK_Connector::dump");
#endif /* ACE_HAS_DUMP */
}
+
int
ACE_SOCK_Connector::shared_open (ACE_SOCK_Stream &new_stream,
int protocol_family,
@@ -28,6 +36,7 @@ ACE_SOCK_Connector::shared_open (ACE_SOCK_Stream &new_stream,
int reuse_addr)
{
ACE_TRACE ("ACE_SOCK_Connector::shared_open");
+
// Only open a new socket if we don't already have a valid handle.
if (new_stream.get_handle () == ACE_INVALID_HANDLE
&& new_stream.open (SOCK_STREAM,
@@ -38,6 +47,7 @@ ACE_SOCK_Connector::shared_open (ACE_SOCK_Stream &new_stream,
else
return 0;
}
+
int
ACE_SOCK_Connector::shared_open (ACE_SOCK_Stream &new_stream,
int protocol_family,
@@ -48,6 +58,7 @@ ACE_SOCK_Connector::shared_open (ACE_SOCK_Stream &new_stream,
int reuse_addr)
{
ACE_TRACE ("ACE_SOCK_Connector::shared_open");
+
// Only open a new socket if we don't already have a valid handle.
if (new_stream.get_handle () == ACE_INVALID_HANDLE
&& new_stream.open (SOCK_STREAM,
@@ -61,16 +72,19 @@ ACE_SOCK_Connector::shared_open (ACE_SOCK_Stream &new_stream,
else
return 0;
}
+
int
ACE_SOCK_Connector::shared_connect_start (ACE_SOCK_Stream &new_stream,
const ACE_Time_Value *timeout,
const ACE_Addr &local_sap)
{
ACE_TRACE ("ACE_SOCK_Connector::shared_connect_start");
+
if (local_sap != ACE_Addr::sap_any)
{
sockaddr *laddr = reinterpret_cast<sockaddr *> (local_sap.get_addr ());
int size = local_sap.get_size ();
+
if (ACE_OS::bind (new_stream.get_handle (),
laddr,
size) == -1)
@@ -81,6 +95,7 @@ ACE_SOCK_Connector::shared_connect_start (ACE_SOCK_Stream &new_stream,
return -1;
}
}
+
// Enable non-blocking, if required.
if (timeout != 0
&& new_stream.enable (ACE_NONBLOCK) == -1)
@@ -88,6 +103,7 @@ ACE_SOCK_Connector::shared_connect_start (ACE_SOCK_Stream &new_stream,
else
return 0;
}
+
int
ACE_SOCK_Connector::shared_connect_finish (ACE_SOCK_Stream &new_stream,
const ACE_Time_Value *timeout,
@@ -96,6 +112,7 @@ ACE_SOCK_Connector::shared_connect_finish (ACE_SOCK_Stream &new_stream,
ACE_TRACE ("ACE_SOCK_Connector::shared_connect_finish");
// Save/restore errno.
ACE_Errno_Guard error (errno);
+
if (result == -1 && timeout != 0)
{
// Check whether the connection is in progress.
@@ -143,6 +160,7 @@ ACE_SOCK_Connector::shared_connect_finish (ACE_SOCK_Stream &new_stream,
return 0;
}
}
+
// EISCONN is treated specially since this routine may be used to
// check if we are already connected.
if (result != -1 || error == EISCONN)
@@ -150,9 +168,12 @@ ACE_SOCK_Connector::shared_connect_finish (ACE_SOCK_Stream &new_stream,
new_stream.disable (ACE_NONBLOCK);
else if (!(error == EWOULDBLOCK || error == ETIMEDOUT))
new_stream.close ();
+
return result;
}
+
// Actively connect and produce a new ACE_SOCK_Stream if things go well...
+
int
ACE_SOCK_Connector::connect (ACE_SOCK_Stream &new_stream,
const ACE_Addr &remote_sap,
@@ -164,6 +185,7 @@ ACE_SOCK_Connector::connect (ACE_SOCK_Stream &new_stream,
int protocol)
{
ACE_TRACE ("ACE_SOCK_Connector::connect");
+
if (this->shared_open (new_stream,
remote_sap.get_type (),
protocol,
@@ -173,13 +195,16 @@ ACE_SOCK_Connector::connect (ACE_SOCK_Stream &new_stream,
timeout,
local_sap) == -1)
return -1;
+
int result = ACE_OS::connect (new_stream.get_handle (),
reinterpret_cast<sockaddr *> (remote_sap.get_addr ()),
remote_sap.get_size ());
+
return this->shared_connect_finish (new_stream,
timeout,
result);
}
+
#if !defined (ACE_HAS_WINCE)
int
ACE_SOCK_Connector::connect (ACE_SOCK_Stream &new_stream,
@@ -194,6 +219,7 @@ ACE_SOCK_Connector::connect (ACE_SOCK_Stream &new_stream,
int /* perms */)
{
ACE_TRACE ("ACE_SOCK_Connector::connect");
+
if (this->shared_open (new_stream,
remote_sap.get_type (),
0,
@@ -206,16 +232,20 @@ ACE_SOCK_Connector::connect (ACE_SOCK_Stream &new_stream,
timeout,
local_sap) == -1)
return -1;
+
int result = ACE_OS::connect (new_stream.get_handle (),
reinterpret_cast<sockaddr *> (remote_sap.get_addr ()),
remote_sap.get_size (),
qos_params);
+
return this->shared_connect_finish (new_stream,
timeout,
result);
}
#endif // ACE_HAS_WINCE
+
// Try to complete a non-blocking connection.
+
int
ACE_SOCK_Connector::complete (ACE_SOCK_Stream &new_stream,
ACE_Addr *remote_sap,
@@ -247,6 +277,7 @@ ACE_SOCK_Connector::complete (ACE_SOCK_Stream &new_stream,
}
#endif /* ACE_WIN32 */
}
+
if (remote_sap != 0)
{
int len = remote_sap->get_size ();
@@ -261,10 +292,12 @@ ACE_SOCK_Connector::complete (ACE_SOCK_Stream &new_stream,
return -1;
}
}
+
// Start out with non-blocking disabled on the <new_stream>.
new_stream.disable (ACE_NONBLOCK);
return 0;
}
+
ACE_SOCK_Connector::ACE_SOCK_Connector (ACE_SOCK_Stream &new_stream,
const ACE_Addr &remote_sap,
const ACE_Time_Value *timeout,
@@ -275,6 +308,7 @@ ACE_SOCK_Connector::ACE_SOCK_Connector (ACE_SOCK_Stream &new_stream,
int protocol)
{
ACE_TRACE ("ACE_SOCK_Connector::ACE_SOCK_Connector");
+
if (this->connect (new_stream,
remote_sap,
timeout,
@@ -289,6 +323,7 @@ ACE_SOCK_Connector::ACE_SOCK_Connector (ACE_SOCK_Stream &new_stream,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_SOCK_Connector::ACE_SOCK_Connector")));
}
+
#if !defined (ACE_HAS_WINCE)
ACE_SOCK_Connector::ACE_SOCK_Connector (ACE_SOCK_Stream &new_stream,
const ACE_Addr &remote_sap,
@@ -302,6 +337,7 @@ ACE_SOCK_Connector::ACE_SOCK_Connector (ACE_SOCK_Stream &new_stream,
int perms)
{
ACE_TRACE ("ACE_SOCK_Connector::ACE_SOCK_Connector");
+
if (this->connect (new_stream,
remote_sap,
qos_params,
@@ -319,5 +355,6 @@ ACE_SOCK_Connector::ACE_SOCK_Connector (ACE_SOCK_Stream &new_stream,
ACE_TEXT ("ACE_SOCK_Connector::ACE_SOCK_Connector")));
}
#endif // ACE_HAS_WINCE
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/SOCK_Connector.h b/dep/ACE_wrappers/ace/SOCK_Connector.h
index a2fee9c9682..9b77e7d61dd 100644
--- a/dep/ACE_wrappers/ace/SOCK_Connector.h
+++ b/dep/ACE_wrappers/ace/SOCK_Connector.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file SOCK_Connector.h
@@ -8,16 +9,22 @@
* @author Doug Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_SOCK_CONNECTOR_H
#define ACE_SOCK_CONNECTOR_H
#include /**/ "ace/pre.h"
+
#include "ace/SOCK_Stream.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_QoS_Params;
class ACE_Time_Value;
+
/**
* @class ACE_SOCK_Connector
*
@@ -39,6 +46,7 @@ public:
// = Initialization and termination methods.
/// Default constructor.
ACE_SOCK_Connector (void);
+
/**
* Actively connect to a peer, producing a connected @c ACE_SOCK_Stream
* object if the connection succeeds.
@@ -84,6 +92,7 @@ public:
int flags = 0,
int perms = 0,
int protocol = 0);
+
#if !defined (ACE_HAS_WINCE)
/**
* Actively connect to a peer, producing a connected @c ACE_SOCK_Stream
@@ -134,6 +143,7 @@ public:
int reuse_addr = 0,
int perms = 0);
#endif // ACE_HAS_WINCE
+
/**
* Actively connect to a peer, producing a connected @c ACE_SOCK_Stream
* object if the connection succeeds.
@@ -183,6 +193,7 @@ public:
int flags = 0,
int perms = 0,
int protocol = 0);
+
#if !defined (ACE_HAS_WINCE)
/**
* Actively connect to a peer, producing a connected @c ACE_SOCK_Stream
@@ -237,8 +248,10 @@ public:
int reuse_addr = 0,
int perms = 0);
#endif // ACE_HAS_WINCE
+
/// Default dtor.
~ACE_SOCK_Connector (void);
+
// = Completion routine.
/**
* Try to complete a nonblocking connection that was begun by a
@@ -255,15 +268,20 @@ public:
int complete (ACE_SOCK_Stream &new_stream,
ACE_Addr *remote_sap = 0,
const ACE_Time_Value *timeout = 0);
+
/// Resets any event associations on this handle
int reset_new_handle (ACE_HANDLE handle);
+
// = Meta-type info
typedef ACE_INET_Addr PEER_ADDR;
typedef ACE_SOCK_Stream PEER_STREAM;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
/// Perform operations that ensure the socket is opened using
/// BSD-style semantics (no QoS).
@@ -271,6 +289,7 @@ protected:
int protocol_family,
int protocol,
int reuse_addr);
+
/// Perform operations that ensure the socket is opened using
/// QoS-enabled semantics.
int shared_open (ACE_SOCK_Stream &new_stream,
@@ -280,19 +299,24 @@ protected:
ACE_SOCK_GROUP g,
u_long flags,
int reuse_addr);
+
/// Perform operations that must be called before <ACE_OS::connect>.
int shared_connect_start (ACE_SOCK_Stream &new_stream,
const ACE_Time_Value *timeout,
const ACE_Addr &local_sap);
+
/// Perform operations that must be called after <ACE_OS::connect>.
int shared_connect_finish (ACE_SOCK_Stream &new_stream,
const ACE_Time_Value *timeout,
int result);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/SOCK_Connector.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_SOCK_CONNECTOR_H */
diff --git a/dep/ACE_wrappers/ace/SOCK_Connector.inl b/dep/ACE_wrappers/ace/SOCK_Connector.inl
index 9434c3e8bd6..ec99a5f38db 100644
--- a/dep/ACE_wrappers/ace/SOCK_Connector.inl
+++ b/dep/ACE_wrappers/ace/SOCK_Connector.inl
@@ -1,20 +1,26 @@
// -*- C++ -*-
//
// $Id: SOCK_Connector.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// This constructor is used by a client when it wants to connect to
// the specified REMOTE_SAP address using a blocking open.
+
ACE_INLINE
ACE_SOCK_Connector::~ACE_SOCK_Connector (void)
{
ACE_TRACE ("ACE_SOCK_Connector::~ACE_SOCK_Connector");
}
+
// Do-nothing constructor...
+
ACE_INLINE
ACE_SOCK_Connector::ACE_SOCK_Connector (void)
{
ACE_TRACE ("ACE_SOCK_Connector::ACE_SOCK_Connector");
}
+
ACE_INLINE int
ACE_SOCK_Connector::reset_new_handle (ACE_HANDLE handle)
{
@@ -28,4 +34,5 @@ ACE_SOCK_Connector::reset_new_handle (ACE_HANDLE handle)
return 0;
#endif /* ACE_WIN32 */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/SOCK_Dgram.cpp b/dep/ACE_wrappers/ace/SOCK_Dgram.cpp
index 907a37fb580..2a442e1c8b5 100644
--- a/dep/ACE_wrappers/ace/SOCK_Dgram.cpp
+++ b/dep/ACE_wrappers/ace/SOCK_Dgram.cpp
@@ -1,4 +1,5 @@
#include "ace/SOCK_Dgram.h"
+
#include "ace/Handle_Set.h"
#include "ace/Log_Msg.h"
#include "ace/INET_Addr.h"
@@ -9,22 +10,29 @@
#include "ace/OS_NS_ctype.h"
#include "ace/os_include/net/os_if.h"
#include "ace/Truncate.h"
+
#if !defined (__ACE_INLINE__)
# include "ace/SOCK_Dgram.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_HAS_IPV6) && defined (ACE_WIN32)
#include /**/ <Iphlpapi.h>
#endif
+
ACE_RCSID (ace,
SOCK_Dgram,
"$Id: SOCK_Dgram.cpp 82559 2008-08-07 20:23:07Z parsons $")
+
// This is a workaround for platforms with non-standard
// definitions of the ip_mreq structure
#if ! defined (IMR_MULTIADDR)
#define IMR_MULTIADDR imr_multiaddr
#endif /* ! defined (IMR_MULTIADDR) */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE (ACE_SOCK_Dgram)
+
void
ACE_SOCK_Dgram::dump (void) const
{
@@ -32,10 +40,12 @@ ACE_SOCK_Dgram::dump (void) const
ACE_TRACE ("ACE_SOCK_Dgram::dump");
#endif /* ACE_HAS_DUMP */
}
+
// Allows a client to read from a socket without having to provide a
// buffer to read. This method determines how much data is in the
// socket, allocates a buffer of this size, reads in the data, and
// returns the number of bytes read.
+
ssize_t
ACE_SOCK_Dgram::recv (iovec *io_vec,
ACE_Addr &addr,
@@ -47,6 +57,7 @@ ACE_SOCK_Dgram::recv (iovec *io_vec,
ACE_Handle_Set handle_set;
handle_set.reset ();
handle_set.set_bit (this->get_handle ());
+
// Check the status of the current socket to make sure there's data
// to recv (or time out).
int select_width;
@@ -73,9 +84,11 @@ ACE_SOCK_Dgram::recv (iovec *io_vec,
// Goes fine, fallthrough to get data
break;
}
+
sockaddr *saddr = (sockaddr *) addr.get_addr ();
int addr_len = addr.get_size ();
int inlen;
+
if (ACE_OS::ioctl (this->get_handle (),
FIONREAD,
&inlen) == -1)
@@ -113,16 +126,19 @@ ACE_SOCK_Dgram::recv (iovec *io_vec,
ACE_NOTSUP_RETURN (-1);
#endif /* FIONREAD */
}
+
// Here's the shared open function. Note that if we are using the
// PF_INET protocol family and the address of LOCAL == the address of
// the special variable SAP_ANY then we are going to arbitrarily bind
// to a portnumber.
+
int
ACE_SOCK_Dgram::shared_open (const ACE_Addr &local,
int protocol_family)
{
ACE_TRACE ("ACE_SOCK_Dgram::shared_open");
bool error = false;
+
if (local == ACE_Addr::sap_any)
{
if (protocol_family == PF_INET
@@ -141,10 +157,13 @@ ACE_SOCK_Dgram::shared_open (const ACE_Addr &local,
reinterpret_cast<sockaddr *> (local.get_addr ()),
local.get_size ()) == -1)
error = true;
+
if (error)
this->close ();
+
return error ? -1 : 0;
}
+
int
ACE_SOCK_Dgram::open (const ACE_Addr &local,
int protocol_family,
@@ -168,7 +187,9 @@ ACE_SOCK_Dgram::open (const ACE_Addr &local,
else
return 0;
}
+
// Here's the general-purpose open routine.
+
int
ACE_SOCK_Dgram::open (const ACE_Addr &local,
int protocol_family,
@@ -176,6 +197,7 @@ ACE_SOCK_Dgram::open (const ACE_Addr &local,
int reuse_addr)
{
ACE_TRACE ("ACE_SOCK_Dgram::open");
+
if (local != ACE_Addr::sap_any)
protocol_family = local.get_type ();
else if (protocol_family == PF_UNSPEC)
@@ -186,6 +208,7 @@ ACE_SOCK_Dgram::open (const ACE_Addr &local,
protocol_family = PF_INET;
#endif /* ACE_HAS_IPV6 */
}
+
if (ACE_SOCK::open (SOCK_DGRAM,
protocol_family,
protocol,
@@ -195,14 +218,17 @@ ACE_SOCK_Dgram::open (const ACE_Addr &local,
return this->shared_open (local,
protocol_family);
}
+
// Here's the general-purpose constructor used by a connectionless
// datagram ``server''...
+
ACE_SOCK_Dgram::ACE_SOCK_Dgram (const ACE_Addr &local,
int protocol_family,
int protocol,
int reuse_addr)
{
ACE_TRACE ("ACE_SOCK_Dgram::ACE_SOCK_Dgram");
+
if (this->open (local,
protocol_family,
protocol,
@@ -211,6 +237,7 @@ ACE_SOCK_Dgram::ACE_SOCK_Dgram (const ACE_Addr &local,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_SOCK_Dgram")));
}
+
ACE_SOCK_Dgram::ACE_SOCK_Dgram (const ACE_Addr &local,
int protocol_family,
int protocol,
@@ -231,9 +258,11 @@ ACE_SOCK_Dgram::ACE_SOCK_Dgram (const ACE_Addr &local,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_SOCK_Dgram")));
}
+
#if defined (ACE_HAS_MSG)
// Send an iovec of size N to ADDR as a datagram (connectionless
// version).
+
ssize_t
ACE_SOCK_Dgram::send (const iovec iov[],
int n,
@@ -242,6 +271,7 @@ ACE_SOCK_Dgram::send (const iovec iov[],
{
ACE_TRACE ("ACE_SOCK_Dgram::send");
msghdr send_msg;
+
send_msg.msg_iov = (iovec *) iov;
send_msg.msg_iovlen = n;
#if defined (ACE_HAS_SOCKADDR_MSG_NAME)
@@ -250,6 +280,7 @@ ACE_SOCK_Dgram::send (const iovec iov[],
send_msg.msg_name = (char *) addr.get_addr ();
#endif /* ACE_HAS_SOCKADDR_MSG_NAME */
send_msg.msg_namelen = addr.get_size ();
+
#if defined (ACE_HAS_4_4BSD_SENDMSG_RECVMSG)
send_msg.msg_control = 0;
send_msg.msg_controllen = 0;
@@ -258,12 +289,15 @@ ACE_SOCK_Dgram::send (const iovec iov[],
send_msg.msg_accrights = 0;
send_msg.msg_accrightslen = 0;
#endif /* ACE_HAS_4_4BSD_SENDMSG_RECVMSG */
+
return ACE_OS::sendmsg (this->get_handle (),
&send_msg,
flags);
}
+
// Recv an iovec of size N to ADDR as a datagram (connectionless
// version).
+
ssize_t
ACE_SOCK_Dgram::recv (iovec iov[],
int n,
@@ -272,6 +306,7 @@ ACE_SOCK_Dgram::recv (iovec iov[],
{
ACE_TRACE ("ACE_SOCK_Dgram::recv");
msghdr recv_msg;
+
recv_msg.msg_iov = (iovec *) iov;
recv_msg.msg_iovlen = n;
#if defined (ACE_HAS_SOCKADDR_MSG_NAME)
@@ -280,6 +315,7 @@ ACE_SOCK_Dgram::recv (iovec iov[],
recv_msg.msg_name = (char *) addr.get_addr ();
#endif /* ACE_HAS_SOCKADDR_MSG_NAME */
recv_msg.msg_namelen = addr.get_size ();
+
#if defined (ACE_HAS_4_4BSD_SENDMSG_RECVMSG)
recv_msg.msg_control = 0 ;
recv_msg.msg_controllen = 0 ;
@@ -287,6 +323,7 @@ ACE_SOCK_Dgram::recv (iovec iov[],
recv_msg.msg_accrights = 0;
recv_msg.msg_accrightslen = 0;
#endif /* ACE_HAS_4_4BSD_SENDMSG_RECVMSG */
+
ssize_t status = ACE_OS::recvmsg (this->get_handle (),
&recv_msg,
flags);
@@ -294,9 +331,12 @@ ACE_SOCK_Dgram::recv (iovec iov[],
addr.set_type (((sockaddr_in *) addr.get_addr())->sin_family);
return status;
}
+
#else /* ACE_HAS_MSG */
+
// Send an iovec of size N to ADDR as a datagram (connectionless
// version).
+
ssize_t
ACE_SOCK_Dgram::send (const iovec iov[],
int n,
@@ -304,8 +344,10 @@ ACE_SOCK_Dgram::send (const iovec iov[],
int flags) const
{
ACE_TRACE ("ACE_SOCK_Dgram::send");
+
size_t length = 0;
int i;
+
// Determine the total length of all the buffers in <iov>.
for (i = 0; i < n; i++)
#if ! (defined(__BORLANDC__) || defined(linux) || defined(ACE_HAS_RTEMS))
@@ -316,7 +358,9 @@ ACE_SOCK_Dgram::send (const iovec iov[],
else
#endif
length += iov[i].iov_len;
+
char *buf = 0;
+
#if defined (ACE_HAS_ALLOCA)
buf = alloca (length);
#else
@@ -324,20 +368,25 @@ ACE_SOCK_Dgram::send (const iovec iov[],
char[length],
-1);
#endif /* !defined (ACE_HAS_ALLOCA) */
+
char *ptr = buf;
+
for (i = 0; i < n; i++)
{
ACE_OS::memcpy (ptr, iov[i].iov_base, iov[i].iov_len);
ptr += iov[i].iov_len;
}
+
ssize_t result = ACE_SOCK_Dgram::send (buf, length, addr, flags);
#if !defined (ACE_HAS_ALLOCA)
delete [] buf;
#endif /* !defined (ACE_HAS_ALLOCA) */
return result;
}
+
// Recv an iovec of size N to ADDR as a datagram (connectionless
// version).
+
ssize_t
ACE_SOCK_Dgram::recv (iovec iov[],
int n,
@@ -345,8 +394,10 @@ ACE_SOCK_Dgram::recv (iovec iov[],
int flags) const
{
ACE_TRACE ("ACE_SOCK_Dgram::recv");
+
ssize_t length = 0;
int i;
+
for (i = 0; i < n; i++)
#if ! (defined(__BORLANDC__) || defined(linux) || defined(ACE_HAS_RTEMS))
// The iov_len is unsigned on Linux, RTEMS and with Borland. If we go
@@ -356,7 +407,9 @@ ACE_SOCK_Dgram::recv (iovec iov[],
else
#endif
length += iov[i].iov_len;
+
char *buf = 0;
+
#if defined (ACE_HAS_ALLOCA)
buf = alloca (length);
#else
@@ -364,11 +417,14 @@ ACE_SOCK_Dgram::recv (iovec iov[],
char[length],
-1);
#endif /* !defined (ACE_HAS_ALLOCA) */
+
length = ACE_SOCK_Dgram::recv (buf, length, addr, flags);
+
if (length != -1)
{
char *ptr = buf;
int copyn = length;
+
for (i = 0;
i < n && copyn > 0;
i++)
@@ -382,12 +438,15 @@ ACE_SOCK_Dgram::recv (iovec iov[],
copyn -= iov[i].iov_len;
}
}
+
#if !defined (ACE_HAS_ALLOCA)
delete [] buf;
#endif /* !defined (ACE_HAS_ALLOCA) */
return length;
}
+
#endif /* ACE_HAS_MSG */
+
ssize_t
ACE_SOCK_Dgram::recv (void *buf,
size_t n,
@@ -398,6 +457,7 @@ ACE_SOCK_Dgram::recv (void *buf,
ACE_Handle_Set handle_set;
handle_set.reset ();
handle_set.set_bit (this->get_handle ());
+
// Check the status of the current socket.
int select_width;
#if defined (ACE_WIN32)
@@ -425,6 +485,7 @@ ACE_SOCK_Dgram::recv (void *buf,
return this->recv (buf, n, addr, flags);
}
}
+
ssize_t
ACE_SOCK_Dgram::send (const void *buf,
size_t n,
@@ -435,6 +496,7 @@ ACE_SOCK_Dgram::send (const void *buf,
ACE_Handle_Set handle_set;
handle_set.reset ();
handle_set.set_bit (this->get_handle ());
+
// Check the status of the current socket.
int select_width;
#if defined (ACE_WIN32)
@@ -462,6 +524,7 @@ ACE_SOCK_Dgram::send (const void *buf,
return this->send (buf, n, addr, flags);
}
}
+
int
ACE_SOCK_Dgram::set_nic (const ACE_TCHAR *net_if,
int addr_family)
@@ -478,6 +541,7 @@ ACE_SOCK_Dgram::set_nic (const ACE_TCHAR *net_if,
addr,
net_if) == -1)
return -1;
+
// Only let this attempt to set unknown interface when INET6 is
// specifically requested. Otherwise we will just try INET.
if (send_mreq.ipv6mr_interface != 0 || addr_family == AF_INET6)
@@ -490,6 +554,7 @@ ACE_SOCK_Dgram::set_nic (const ACE_TCHAR *net_if,
}
ipv6_mif_set = send_mreq.ipv6mr_interface != 0;
}
+
# if defined (ACE_WIN32)
// For Win32 net_if is distintly different between INET6 and INET
// so it is always either an INET6 if or an INET if.
@@ -540,8 +605,10 @@ ACE_SOCK_Dgram::set_nic (const ACE_TCHAR *net_if,
ACE_TEXT ("Send interface specification not ")
ACE_TEXT ("supported - IGNORED.\n")));
#endif /* !IP_MULTICAST_IF */
+
return 0;
}
+
int
ACE_SOCK_Dgram::make_multicast_ifaddr (ip_mreq *ret_mreq,
const ACE_INET_Addr &mcast_addr,
@@ -560,11 +627,14 @@ ACE_SOCK_Dgram::make_multicast_ifaddr (ip_mreq *ret_mreq,
ACE_HTONL (interface_addr.get_ip_address ());
#else
ifreq if_address;
+
ACE_OS::strcpy (if_address.ifr_name, ACE_TEXT_ALWAYS_CHAR (net_if));
+
if (ACE_OS::ioctl (this->get_handle (),
SIOCGIFADDR,
&if_address) == -1)
return -1;
+
sockaddr_in *socket_address =
reinterpret_cast<sockaddr_in*> (&if_address.ifr_addr);
lmreq.imr_interface.s_addr = socket_address->sin_addr.s_addr;
@@ -572,12 +642,16 @@ ACE_SOCK_Dgram::make_multicast_ifaddr (ip_mreq *ret_mreq,
}
else
lmreq.imr_interface.s_addr = INADDR_ANY;
+
lmreq.IMR_MULTIADDR.s_addr = ACE_HTONL (mcast_addr.get_ip_address ());
+
// Set return info, if requested.
if (ret_mreq)
*ret_mreq = lmreq;
+
return 0;
}
+
#if defined (ACE_HAS_IPV6)
// XXX: This will not work on any operating systems that do not support
// if_nametoindex or that is not Win32 >= Windows XP/Server 2003
@@ -588,9 +662,11 @@ ACE_SOCK_Dgram::make_multicast_ifaddr6 (ipv6_mreq *ret_mreq,
{
ACE_TRACE ("ACE_SOCK_Dgram_Mcast::make_multicast_ifaddr6");
ipv6_mreq lmreq; // Scratch copy.
+
ACE_OS::memset (&lmreq,
0,
sizeof (lmreq));
+
#if defined(__linux__)
if (net_if != 0)
{
@@ -604,6 +680,7 @@ ACE_SOCK_Dgram::make_multicast_ifaddr6 (ipv6_mreq *ret_mreq,
bool num_if =
ACE_OS::ace_isdigit (net_if[0]) &&
(if_ix = ACE_OS::atoi (net_if)) > 0;
+
IP_ADAPTER_ADDRESSES tmp_addrs;
// Initial call to determine actual memory size needed
DWORD dwRetVal;
@@ -614,6 +691,7 @@ ACE_SOCK_Dgram::make_multicast_ifaddr6 (ipv6_mreq *ret_mreq,
&tmp_addrs,
&bufLen)) != ERROR_BUFFER_OVERFLOW)
return -1; // With output bufferlength 0 this can't be right.
+
// Get required output buffer and retrieve info for real.
PIP_ADAPTER_ADDRESSES pAddrs;
char *buf;
@@ -630,6 +708,7 @@ ACE_SOCK_Dgram::make_multicast_ifaddr6 (ipv6_mreq *ret_mreq,
delete[] buf; // clean up
return -1;
}
+
lmreq.ipv6mr_interface = 0; // initialize
while (pAddrs)
{
@@ -643,8 +722,10 @@ ACE_SOCK_Dgram::make_multicast_ifaddr6 (ipv6_mreq *ret_mreq,
lmreq.ipv6mr_interface = pAddrs->Ipv6IfIndex;
break;
}
+
pAddrs = pAddrs->Next;
}
+
delete[] buf; // clean up
}
else
@@ -652,15 +733,19 @@ ACE_SOCK_Dgram::make_multicast_ifaddr6 (ipv6_mreq *ret_mreq,
ACE_UNUSED_ARG(net_if);
#endif /* ACE_WIN32 */
lmreq.ipv6mr_interface = 0;
+
// now set the multicast address
ACE_OS::memcpy (&lmreq.ipv6mr_multiaddr,
&((sockaddr_in6 *) mcast_addr.get_addr ())->sin6_addr,
sizeof (in6_addr));
+
// Set return info, if requested.
if (ret_mreq)
*ret_mreq = lmreq;
+
return 0;
}
#endif /* __linux__ && ACE_HAS_IPV6 */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/SOCK_Dgram.h b/dep/ACE_wrappers/ace/SOCK_Dgram.h
index b2b37e1ea98..42696a51fdd 100644
--- a/dep/ACE_wrappers/ace/SOCK_Dgram.h
+++ b/dep/ACE_wrappers/ace/SOCK_Dgram.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file SOCK_Dgram.h
@@ -8,17 +9,24 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_SOCK_DGRAM_H
#define ACE_SOCK_DGRAM_H
#include /**/ "ace/pre.h"
+
#include "ace/SOCK.h"
#include "ace/INET_Addr.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Addr.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Time_Value;
+
/**
* @class ACE_SOCK_Dgram
*
@@ -31,12 +39,14 @@ public:
// = Initialization and termination methods.
/// Default constructor.
ACE_SOCK_Dgram (void);
+
/// This is a BSD-style method (i.e., no QoS) for initiating a socket
/// dgram that will accept datagrams at the <local> address.
ACE_SOCK_Dgram (const ACE_Addr &local,
int protocol_family = ACE_PROTOCOL_FAMILY_INET,
int protocol = 0,
int reuse_addr = 0);
+
/**
* This is a QoS-enabed method for initiating a socket dgram that
* will accept datagrams at the <local> address. The @a qos_params
@@ -49,12 +59,14 @@ public:
ACE_SOCK_GROUP g = 0,
u_long flags = 0,
int reuse_addr = 0);
+
/// This is a BSD-style method (i.e., no QoS) for initiating a socket
/// dgram that will accept datagrams at the <local> address.
int open (const ACE_Addr &local,
int protocol_family = ACE_PROTOCOL_FAMILY_INET,
int protocol = 0,
int reuse_addr = 0);
+
/**
* This is a QoS-enabed method for initiating a socket dgram that
* will accept datagrams at the <local> address. The @a qos_params
@@ -67,20 +79,24 @@ public:
ACE_SOCK_GROUP g = 0,
u_long flags = 0,
int reuse_addr = 0);
+
/// Default dtor.
~ACE_SOCK_Dgram (void);
+
// = Data transfer routines.
/// Send an @a n byte @a buf to the datagram socket (uses <sendto(3)>).
ssize_t send (const void *buf,
size_t n,
const ACE_Addr &addr,
int flags = 0) const;
+
/// Receive an @a n byte @a buf from the datagram socket (uses
/// <recvfrom(3)>).
ssize_t recv (void *buf,
size_t n,
ACE_Addr &addr,
int flags = 0) const;
+
/**
* Allows a client to read from a socket without having to provide a
* buffer to read. This method determines how much data is in the
@@ -93,18 +109,21 @@ public:
ACE_Addr &addr,
int flags = 0,
const ACE_Time_Value *timeout = 0) const;
+
/// Send an <iovec> of size @a n to the datagram socket (uses
/// <sendmsg(3)>).
ssize_t send (const iovec iov[],
int n,
const ACE_Addr &addr,
int flags = 0) const;
+
/// Recv an <iovec> of size @a n to the datagram socket (uses
/// <recvmsg(3)>).
ssize_t recv (iovec iov[],
int n,
ACE_Addr &addr,
int flags = 0) const;
+
/**
* Wait up to @a timeout amount of time to receive a datagram into
* @a buf. The ACE_Time_Value indicates how long to blocking
@@ -119,6 +138,7 @@ public:
ACE_Addr &addr,
int flags,
const ACE_Time_Value *timeout) const;
+
/**
* Wait up to @a timeout amount of time to send a datagram to
* @a buf. The ACE_Time_Value indicates how long to blocking
@@ -133,6 +153,7 @@ public:
const ACE_Addr &addr,
int flags,
const ACE_Time_Value *timeout) const;
+
/// Send <buffer_count> worth of @a buffers to @a addr using overlapped
/// I/O (uses <WSASendTo>). Returns 0 on success.
ssize_t send (const iovec buffers[],
@@ -142,6 +163,7 @@ public:
const ACE_Addr &addr,
ACE_OVERLAPPED *overlapped,
ACE_OVERLAPPED_COMPLETION_FUNC func) const;
+
/// Recv <buffer_count> worth of @a buffers from @a addr using
/// overlapped I/O (uses <WSARecvFrom>). Returns 0 on success.
ssize_t recv (iovec buffers[],
@@ -151,6 +173,7 @@ public:
ACE_Addr &addr,
ACE_OVERLAPPED *overlapped,
ACE_OVERLAPPED_COMPLETION_FUNC func) const;
+
/// Send an @a n byte @a buf to the datagram socket (uses <WSASendTo>).
ssize_t send (const void *buf,
size_t n,
@@ -158,6 +181,7 @@ public:
int flags,
ACE_OVERLAPPED *overlapped,
ACE_OVERLAPPED_COMPLETION_FUNC func) const;
+
/// Receive an @a n byte @a buf from the datagram socket (uses
/// <WSARecvFrom>).
ssize_t recv (void *buf,
@@ -166,39 +190,51 @@ public:
int flags,
ACE_OVERLAPPED *overlapped,
ACE_OVERLAPPED_COMPLETION_FUNC func) const;
+
// = Meta-type info.
typedef ACE_INET_Addr PEER_ADDR;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Set NIC to use as multicast interface.
int set_nic (const ACE_TCHAR *net_if,
int addr_family = AF_UNSPEC);
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
/// Open is shared by this and by <LSOCK_Dgram>.
int shared_open (const ACE_Addr &local,
int protocol_family);
+
/// Create a multicast addr/if pair, in format useful for system calls.
/// If mreq param is NULL, just verify the passed addr/interface specs.
int make_multicast_ifaddr (ip_mreq *mreq, // Put result here, if != NULL.
const ACE_INET_Addr &mcast_addr,
const ACE_TCHAR *net_if);
+
#if defined (ACE_HAS_IPV6)
/// Create a multicast addr/if pair, in format useful for system calls.
/// If mreq param is NULL, just verify the passed addr/interface specs.
int make_multicast_ifaddr6 (ipv6_mreq *mreq, // Put result here, if != NULL.
const ACE_INET_Addr &mcast_addr,
const ACE_TCHAR *net_if);
+
#endif /* ACE_HAS_IPV6 */
+
private:
/// Do not allow this function to percolate up to this interface...
int get_remote_addr (ACE_Addr &) const;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/SOCK_Dgram.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_SOCK_DGRAM_H */
diff --git a/dep/ACE_wrappers/ace/SOCK_Dgram.inl b/dep/ACE_wrappers/ace/SOCK_Dgram.inl
index ec813f54d5b..7bffb19ba70 100644
--- a/dep/ACE_wrappers/ace/SOCK_Dgram.inl
+++ b/dep/ACE_wrappers/ace/SOCK_Dgram.inl
@@ -1,21 +1,29 @@
// -*- C++ -*-
//
// $Id: SOCK_Dgram.inl 80826 2008-03-04 14:51:23Z wotte $
+
// SOCK_Dgram.i
+
#include "ace/OS_NS_sys_socket.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Here's the simple-minded constructor.
+
ACE_INLINE
ACE_SOCK_Dgram::ACE_SOCK_Dgram (void)
{
ACE_TRACE ("ACE_SOCK_Dgram::ACE_SOCK_Dgram");
}
+
ACE_INLINE
ACE_SOCK_Dgram::~ACE_SOCK_Dgram (void)
{
ACE_TRACE ("ACE_SOCK_Dgram::~ACE_SOCK_Dgram");
}
+
// <sendto> an N byte datagram to <addr> (connectionless version).
+
ACE_INLINE ssize_t
ACE_SOCK_Dgram::send (const void *buf,
size_t n,
@@ -32,7 +40,9 @@ ACE_SOCK_Dgram::send (const void *buf,
(struct sockaddr *) saddr,
len);
}
+
// <recvfrom> an n byte datagram (connectionless version).
+
ACE_INLINE ssize_t
ACE_SOCK_Dgram::recv (void *buf,
size_t n,
@@ -42,6 +52,7 @@ ACE_SOCK_Dgram::recv (void *buf,
ACE_TRACE ("ACE_SOCK_Dgram::recv");
sockaddr *saddr = (sockaddr *) addr.get_addr ();
int addr_len = addr.get_size ();
+
ssize_t const status = ACE_OS::recvfrom (this->get_handle (),
(char *) buf,
n,
@@ -52,6 +63,7 @@ ACE_SOCK_Dgram::recv (void *buf,
addr.set_type (saddr->sa_family);
return status;
}
+
ACE_INLINE ssize_t
ACE_SOCK_Dgram::send (const iovec buffers[],
int buffer_count,
@@ -74,6 +86,7 @@ ACE_SOCK_Dgram::send (const iovec buffers[],
overlapped,
func);
}
+
ACE_INLINE ssize_t
ACE_SOCK_Dgram::recv (iovec buffers[],
int buffer_count,
@@ -86,6 +99,7 @@ ACE_SOCK_Dgram::recv (iovec buffers[],
ACE_TRACE ("ACE_SOCK_Dgram::recv");
sockaddr *saddr = (sockaddr *) addr.get_addr ();
int addr_len = addr.get_size ();
+
ssize_t status = ACE_OS::recvfrom (this->get_handle (),
buffers,
buffer_count,
@@ -99,7 +113,9 @@ ACE_SOCK_Dgram::recv (iovec buffers[],
addr.set_type (saddr->sa_family);
return status;
}
+
// <sendto> an N byte datagram to <addr> (connectionless version).
+
ACE_INLINE ssize_t
ACE_SOCK_Dgram::send (const void *buf,
size_t n,
@@ -109,6 +125,7 @@ ACE_SOCK_Dgram::send (const void *buf,
ACE_OVERLAPPED_COMPLETION_FUNC func) const
{
ACE_TRACE ("ACE_SOCK_Dgram::send");
+
iovec buffer[1];
buffer[0].iov_len = static_cast<u_long> (n); // Betting on < 4G
buffer[0].iov_base = (char *) buf;
@@ -121,7 +138,9 @@ ACE_SOCK_Dgram::send (const void *buf,
overlapped,
func);
}
+
// <recvfrom> an n byte datagram (connectionless version).
+
ACE_INLINE ssize_t
ACE_SOCK_Dgram::recv (void *buf,
size_t n,
@@ -131,6 +150,7 @@ ACE_SOCK_Dgram::recv (void *buf,
ACE_OVERLAPPED_COMPLETION_FUNC func) const
{
ACE_TRACE ("ACE_SOCK_Dgram::recv");
+
iovec buffer[1];
buffer[0].iov_len = static_cast<u_long> (n); // Betting on < 4G
buffer[0].iov_base = (char *) buf;
@@ -143,4 +163,5 @@ ACE_SOCK_Dgram::recv (void *buf,
overlapped,
func);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/SOCK_Dgram_Bcast.cpp b/dep/ACE_wrappers/ace/SOCK_Dgram_Bcast.cpp
index b16e6977a77..0a55c5149fa 100644
--- a/dep/ACE_wrappers/ace/SOCK_Dgram_Bcast.cpp
+++ b/dep/ACE_wrappers/ace/SOCK_Dgram_Bcast.cpp
@@ -1,17 +1,24 @@
// $Id: SOCK_Dgram_Bcast.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/SOCK_Dgram_Bcast.h"
+
#include "ace/Log_Msg.h"
#include "ace/ACE.h"
#include "ace/OS_NS_string.h"
#include "ace/os_include/net/os_if.h"
#include "ace/OS_NS_netdb.h"
#include "ace/OS_Memory.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/SOCK_Dgram_Bcast.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace, SOCK_Dgram_Bcast, "$Id: SOCK_Dgram_Bcast.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_SOCK_Dgram_Bcast)
+
ACE_Bcast_Node::ACE_Bcast_Node (ACE_INET_Addr &addr,
ACE_Bcast_Node *next)
: bcast_addr_ (addr),
@@ -19,6 +26,7 @@ ACE_Bcast_Node::ACE_Bcast_Node (ACE_INET_Addr &addr,
{
ACE_TRACE ("ACE_Bcast_Node::ACE_Bcast_Node");
}
+
void
ACE_SOCK_Dgram_Bcast::dump (void) const
{
@@ -26,31 +34,41 @@ ACE_SOCK_Dgram_Bcast::dump (void) const
ACE_TRACE ("ACE_SOCK_Dgram_Bcast::dump");
#endif /* ACE_HAS_DUMP */
}
+
// Close up and release resources.
+
int
ACE_SOCK_Dgram_Bcast::close (void)
{
ACE_TRACE ("ACE_SOCK_Dgram_Bcast::close");
+
ACE_Bcast_Node *temp = this->if_list_;
this->if_list_ = 0;
+
// Release the dynamically allocated memory.
+
while (temp != 0)
{
ACE_Bcast_Node *hold = temp->next_;
delete temp;
temp = hold;
}
+
// Shut down the descriptor.
return ACE_SOCK::close ();
}
+
// Here's the simple-minded constructor.
+
ACE_SOCK_Dgram_Bcast::ACE_SOCK_Dgram_Bcast (void)
: if_list_ (0)
{
ACE_TRACE ("ACE_SOCK_Dgram_Bcast::ACE_SOCK_Dgram_Bcast");
}
+
// Here's the general-purpose constructor used by a connectionless
// datagram ``server''...
+
ACE_SOCK_Dgram_Bcast::ACE_SOCK_Dgram_Bcast (const ACE_Addr &local,
int protocol_family,
int protocol,
@@ -60,12 +78,15 @@ ACE_SOCK_Dgram_Bcast::ACE_SOCK_Dgram_Bcast (const ACE_Addr &local,
if_list_ (0)
{
ACE_TRACE ("ACE_SOCK_Dgram_Bcast::ACE_SOCK_Dgram_Bcast");
+
if (this->mk_broadcast (host_name) == -1)
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_SOCK_Dgram_Bcast")));
}
+
// Here's the general-purpose open routine.
+
int
ACE_SOCK_Dgram_Bcast::open (const ACE_Addr &local,
int protocol_family,
@@ -74,17 +95,23 @@ ACE_SOCK_Dgram_Bcast::open (const ACE_Addr &local,
const ACE_TCHAR *host_name)
{
ACE_TRACE ("ACE_SOCK_Dgram_Bcast::open");
+
if (this->ACE_SOCK_Dgram::open (local, protocol_family,
protocol, reuse_addr) == -1)
return -1;
+
return this->mk_broadcast (host_name);
}
+
// Make broadcast available for Datagram socket.
+
int
ACE_SOCK_Dgram_Bcast::mk_broadcast (const ACE_TCHAR *host_name)
{
ACE_TRACE ("ACE_SOCK_Dgram_Bcast::mk_broadcast");
+
int one = 1;
+
if (ACE_OS::setsockopt (this->get_handle (),
SOL_SOCKET,
SO_BROADCAST,
@@ -93,12 +120,16 @@ ACE_SOCK_Dgram_Bcast::mk_broadcast (const ACE_TCHAR *host_name)
ACE_ERROR_RETURN ((LM_ERROR, "%p\n",
"ACE_SOCK_Dgram_Bcast::mk_broadcast: setsockopt failed"),
-1);
+
#if !defined (ACE_WIN32) && !defined(__INTERIX)
ACE_HANDLE s = this->get_handle ();
+
char buf[BUFSIZ];
struct ifconf ifc;
+
ifc.ifc_len = sizeof buf;
ifc.ifc_buf = buf;
+
// Get interface structure and initialize the addresses using UNIX
// techniques.
if (ACE_OS::ioctl (s,
@@ -107,12 +138,16 @@ ACE_SOCK_Dgram_Bcast::mk_broadcast (const ACE_TCHAR *host_name)
ACE_ERROR_RETURN ((LM_ERROR, "%p\n",
"ACE_SOCK_Dgram_Bcast::mk_broadcast: ioctl (get interface configuration)"),
ACE_INVALID_HANDLE);
+
struct ifreq *ifr = ifc.ifc_req;
+
struct sockaddr_in host_addr;
+
// Get host ip address
if (host_name)
{
hostent *hp = ACE_OS::gethostbyname (ACE_TEXT_ALWAYS_CHAR (host_name));
+
if (hp == 0)
return -1;
else
@@ -130,6 +165,7 @@ ACE_SOCK_Dgram_Bcast::mk_broadcast (const ACE_TCHAR *host_name)
#endif /* ! _UNICOS */
}
+
#if !defined(AIX) && !defined (__QNX__) && !defined (__FreeBSD__) && !defined(__NetBSD__) && !defined (ACE_VXWORKS) && !defined(__APPLE__)
for (int n = ifc.ifc_len / sizeof (struct ifreq) ; n > 0;
n--, ifr++)
@@ -159,12 +195,15 @@ ACE_SOCK_Dgram_Bcast::mk_broadcast (const ACE_TCHAR *host_name)
if (host_name)
{
struct sockaddr_in if_addr;
+
ACE_OS::memcpy (&if_addr,
&ifr->ifr_addr,
sizeof if_addr);
+
if (host_addr.sin_addr.s_addr != if_addr.sin_addr.s_addr)
continue;
}
+
if (ifr->ifr_addr.sa_family != AF_INET)
{
// Note that some systems seem to generate 0 (AF_UNDEF) for
@@ -179,8 +218,10 @@ ACE_SOCK_Dgram_Bcast::mk_broadcast (const ACE_TCHAR *host_name)
ifr->ifr_addr.sa_family));
continue;
}
+
struct ifreq flags = *ifr;
struct ifreq if_req = *ifr;
+
if (ACE_OS::ioctl (s,
SIOCGIFFLAGS,
(char *) &flags) == -1)
@@ -190,6 +231,7 @@ ACE_SOCK_Dgram_Bcast::mk_broadcast (const ACE_TCHAR *host_name)
flags.ifr_name));
continue;
}
+
if (ACE_BIT_ENABLED (flags.ifr_flags,
IFF_UP) == 0)
{
@@ -198,9 +240,11 @@ ACE_SOCK_Dgram_Bcast::mk_broadcast (const ACE_TCHAR *host_name)
flags.ifr_name));
continue;
}
+
if (ACE_BIT_ENABLED (flags.ifr_flags,
IFF_LOOPBACK))
continue;
+
if (ACE_BIT_ENABLED (flags.ifr_flags,
IFF_BROADCAST))
{
@@ -231,6 +275,7 @@ ACE_SOCK_Dgram_Bcast::mk_broadcast (const ACE_TCHAR *host_name)
}
#else
ACE_UNUSED_ARG (host_name);
+
ACE_INET_Addr addr (u_short (0),
ACE_UINT32 (INADDR_BROADCAST));
ACE_NEW_RETURN (this->if_list_,
@@ -246,8 +291,10 @@ ACE_SOCK_Dgram_Bcast::mk_broadcast (const ACE_TCHAR *host_name)
else
return 0;
}
+
// Broadcast the datagram to every interface. Returns the average
// number of bytes sent.
+
ssize_t
ACE_SOCK_Dgram_Bcast::send (const void *buf,
size_t n,
@@ -257,27 +304,35 @@ ACE_SOCK_Dgram_Bcast::send (const void *buf,
ACE_TRACE ("ACE_SOCK_Dgram_Bcast::send");
ssize_t iterations = 0;
ssize_t total_bytes = 0;
+
if (this->if_list_ == 0)
return -1;
+
for (ACE_Bcast_Node *temp = this->if_list_;
temp != 0;
temp = temp->next_)
{
temp->bcast_addr_.set_port_number (port_number);
+
ssize_t bytes_sent = ACE_SOCK_Dgram::send (buf,
n,
temp->bcast_addr_,
flags);
+
if (bytes_sent == -1)
return -1;
else
total_bytes += bytes_sent;
+
iterations++;
}
+
return iterations == 0 ? 0 : total_bytes / iterations;
}
+
#if defined (ACE_HAS_MSG)
// Broadcast datagram to every interfaces.
+
ssize_t
ACE_SOCK_Dgram_Bcast::send (const iovec iov[],
int n,
@@ -285,24 +340,31 @@ ACE_SOCK_Dgram_Bcast::send (const iovec iov[],
int flags) const
{
ACE_TRACE ("ACE_SOCK_Dgram_Bcast::send");
+
if (this->if_list_ == 0)
return -1;
+
// Send the message to every interface.
+
for (ACE_Bcast_Node *temp = this->if_list_;
temp != 0;
temp = temp->next_)
{
temp->bcast_addr_.set_port_number (port_number);
+
if (ACE_SOCK_Dgram::send (iov,
n,
temp->bcast_addr_,
flags) == -1)
return -1;
}
+
return 0;
}
+
// Broadcast an iovec of size N to ADDR as a datagram (note that addr
// must be preassigned to the broadcast address of the subnet...).
+
ssize_t
ACE_SOCK_Dgram_Bcast::send (const iovec iov[],
int n,
@@ -310,8 +372,10 @@ ACE_SOCK_Dgram_Bcast::send (const iovec iov[],
int flags) const
{
ACE_TRACE ("ACE_SOCK_Dgram_Bcast::send");
+
return ACE_SOCK_Dgram::send (iov, n, addr, flags);
}
#endif /* ACE_HAS_MSG */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/SOCK_Dgram_Bcast.h b/dep/ACE_wrappers/ace/SOCK_Dgram_Bcast.h
index 4fc0cdc5944..a85ffc22052 100644
--- a/dep/ACE_wrappers/ace/SOCK_Dgram_Bcast.h
+++ b/dep/ACE_wrappers/ace/SOCK_Dgram_Bcast.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file SOCK_Dgram_Bcast.h
@@ -9,16 +10,22 @@
*/
//=============================================================================
+
#ifndef ACE_SOCK_DGRAM_BCAST_H
#define ACE_SOCK_DGRAM_BCAST_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/SOCK_Dgram.h"
#include "ace/INET_Addr.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Bcast_Node
*
@@ -30,13 +37,17 @@ public:
/// Default constructor.
ACE_Bcast_Node (ACE_INET_Addr &,
ACE_Bcast_Node *);
+
/// Destructor.
~ACE_Bcast_Node (void);
+
/// Broadcast address for the interface.
ACE_INET_Addr bcast_addr_;
+
/// Pointer to the next interface in the chain.
ACE_Bcast_Node *next_;
};
+
/**
* @class ACE_SOCK_Dgram_Bcast
*
@@ -49,40 +60,49 @@ public:
// = Initialization and termination methods.
/// Default constructor.
ACE_SOCK_Dgram_Bcast (void);
+
ACE_SOCK_Dgram_Bcast (const ACE_Addr &local,
int protocol_family = PF_INET,
int protocol = 0,
int reuse_addr = 0,
const ACE_TCHAR *host_name = 0);
+
/// Default dtor.
~ACE_SOCK_Dgram_Bcast (void);
+
// Initiate a connectionless datagram broadcast endpoint.
+
/// Initiate a connectionless datagram broadcast endpoint.
int open (const ACE_Addr &local,
int protocol_family = PF_INET,
int protocol = 0,
int reuse_addr = 0,
const ACE_TCHAR *host_name = 0);
+
/// Close up and release dynamically allocated resources.
int close (void);
+
/// Broadcast the datagram to every interface. Returns the average
/// number of bytes sent.
ssize_t send (const void *buf,
size_t n,
u_short portnum,
int flags = 0) const;
+
/// Broadcast the @c iov datagrams to every interface. Returns the
/// average number of bytes sent.
ssize_t send (const iovec iov[],
int n,
u_short portnum,
int flags = 0) const;
+
/// Broadcast an N byte datagram to ADDR (note that addr must be
/// preassigned to the broadcast address of the subnet...).
ssize_t send (const void *buf,
size_t n,
const ACE_Addr &addr,
int flags = 0) const;
+
/**
* Broadcast an @a iovec of size @a n to @a addr as a datagram (note
* that addr must be preassigned to the broadcast address of the
@@ -92,22 +112,30 @@ public:
int n,
const ACE_Addr &addr,
int flags = 0) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Make broadcast available for Datagram socket.
int mk_broadcast (const ACE_TCHAR *host_name);
+
/// Points to the head of the list of broadcast interfaces.
ACE_Bcast_Node *if_list_;
+
/// Do not allow this function to percolate up to this interface...
int get_remote_addr (ACE_Addr &) const;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/SOCK_Dgram_Bcast.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_SOCK_DGRAM_BCAST_H */
diff --git a/dep/ACE_wrappers/ace/SOCK_Dgram_Bcast.inl b/dep/ACE_wrappers/ace/SOCK_Dgram_Bcast.inl
index 7eb16f8b751..16597248829 100644
--- a/dep/ACE_wrappers/ace/SOCK_Dgram_Bcast.inl
+++ b/dep/ACE_wrappers/ace/SOCK_Dgram_Bcast.inl
@@ -1,19 +1,25 @@
// -*- C++ -*-
//
// $Id: SOCK_Dgram_Bcast.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_sys_socket.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_Bcast_Node::~ACE_Bcast_Node (void)
{
}
+
ACE_INLINE
ACE_SOCK_Dgram_Bcast::~ACE_SOCK_Dgram_Bcast (void)
{
ACE_TRACE ("ACE_SOCK_Dgram_Bcast::~ACE_SOCK_Dgram_Bcast");
}
+
// Broadcast an N byte datagram to ADDR (note that addr must be
// preassigned to the broadcast address of the subnet...)
+
ACE_INLINE ssize_t
ACE_SOCK_Dgram_Bcast::send (const void *buf,
size_t n,
@@ -21,9 +27,11 @@ ACE_SOCK_Dgram_Bcast::send (const void *buf,
int flags) const
{
ACE_TRACE ("ACE_SOCK_Dgram_Bcast::send");
+
sockaddr *saddr = (sockaddr *) addr.get_addr ();
int len = addr.get_size ();
return ACE_OS::sendto (this->get_handle (), (const char *) buf, n, flags,
(struct sockaddr *) saddr, len);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/SOCK_Dgram_Mcast.cpp b/dep/ACE_wrappers/ace/SOCK_Dgram_Mcast.cpp
index 440793c14db..81ea48352d1 100644
--- a/dep/ACE_wrappers/ace/SOCK_Dgram_Mcast.cpp
+++ b/dep/ACE_wrappers/ace/SOCK_Dgram_Mcast.cpp
@@ -1,34 +1,45 @@
// $Id: SOCK_Dgram_Mcast.cpp 82390 2008-07-23 08:13:52Z johnnyw $
+
#include "ace/SOCK_Dgram_Mcast.h"
+
#include "ace/OS_Memory.h"
#include "ace/OS_NS_string.h"
#include "ace/OS_NS_errno.h"
#include "ace/os_include/net/os_if.h"
#include "ace/os_include/arpa/os_inet.h"
+
#if defined (__linux__) && defined (ACE_HAS_IPV6)
#include "ace/OS_NS_sys_socket.h"
#endif
+
#if defined (ACE_HAS_IPV6) && defined (ACE_WIN32)
#include /**/ <Iphlpapi.h>
#endif
+
#if !defined (__ACE_INLINE__)
#include "ace/SOCK_Dgram_Mcast.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID (ace,
SOCK_Dgram_Mcast,
"$Id: SOCK_Dgram_Mcast.cpp 82390 2008-07-23 08:13:52Z johnnyw $")
+
#include "ace/Log_Msg.h"
+
// This is a workaround for platforms with non-standard
// definitions of the ip_mreq structure
#if ! defined (IMR_MULTIADDR)
#define IMR_MULTIADDR imr_multiaddr
#endif /* ! defined (IMR_MULTIADDR) */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Helper (inline) functions.
class ACE_SDM_helpers
{
public:
// Convert ACE_INET_Addr to string, using local formatting rules.
+
static void addr_to_string (const ACE_INET_Addr &ip_addr,
ACE_TCHAR *ret_string, // results here.
size_t len,
@@ -50,21 +61,27 @@ public:
&& m1.imr_interface.s_addr == m2.imr_interface.s_addr;
}
};
+
ACE_ALLOC_HOOK_DEFINE (ACE_SOCK_Dgram_Mcast)
+
void
ACE_SOCK_Dgram_Mcast::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_SOCK_Dgram_Mcast::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
+
# if defined (ACE_SOCK_DGRAM_MCAST_DUMPABLE)
ACE_TCHAR addr_string[MAXNAMELEN + 1];
+
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("\nOptions: bindaddr=%s, nulliface=%s\n"),
ACE_BIT_ENABLED (this->opts_, OPT_BINDADDR_YES) ?
ACE_TEXT ("<Bound>") : ACE_TEXT ("<Not Bound>"),
ACE_BIT_ENABLED (this->opts_, OPT_NULLIFACE_ALL) ?
ACE_TEXT ("<All Ifaces>") : ACE_TEXT ("<Default Iface>")));
+
// Show default send addr, port#, and interface.
ACE_SDM_helpers::addr_to_string (this->send_addr_, addr_string,
sizeof addr_string, 0);
@@ -73,19 +90,23 @@ ACE_SOCK_Dgram_Mcast::dump (void) const
addr_string,
this->send_net_if_ ? this->send_net_if_
: ACE_TEXT ("<default>")));
+
// Show list of subscribed addresses.
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Subscription list:\n")));
+
ACE_MT (ACE_GUARD (ACE_SDM_LOCK, guard, this->subscription_list_lock_));
subscription_list_iter_t iter (this->subscription_list_);
for ( ; !iter.done (); iter.advance ())
{
ACE_TCHAR iface_string[MAXNAMELEN + 1];
ip_mreq *pm = iter.next ();
+
// Get subscribed address (w/out port# info - not relevant).
ACE_INET_Addr ip_addr (static_cast<u_short> (0),
ACE_NTOHL (pm->IMR_MULTIADDR.s_addr));
ACE_SDM_helpers::addr_to_string (ip_addr, addr_string,
sizeof addr_string, 1);
+
// Get interface address/specification.
ACE_INET_Addr if_addr (static_cast<u_short> (0),
ACE_NTOHL (pm->imr_interface.s_addr));
@@ -95,6 +116,7 @@ ACE_SOCK_Dgram_Mcast::dump (void) const
// Receives on system default iface. (Note that null_iface_opt_
// option processing has already occurred.)
ACE_OS::strcpy (iface_string, ACE_TEXT ("<default>"));
+
// Dump info.
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("\taddr=%s iface=%s\n"),
@@ -105,6 +127,7 @@ ACE_SOCK_Dgram_Mcast::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
// Constructor.
ACE_SOCK_Dgram_Mcast::ACE_SOCK_Dgram_Mcast
(ACE_SOCK_Dgram_Mcast::options opts)
@@ -113,34 +136,41 @@ ACE_SOCK_Dgram_Mcast::ACE_SOCK_Dgram_Mcast
{
ACE_TRACE ("ACE_SOCK_Dgram_Mcast::ACE_SOCK_Dgram_Mcast");
}
+
// Destructor.
ACE_SOCK_Dgram_Mcast::~ACE_SOCK_Dgram_Mcast (void)
{
ACE_TRACE ("ACE_SOCK_Dgram_Mcast::~ACE_SOCK_Dgram_Mcast");
+
// Free memory and optionally unsubscribe from currently subscribed group(s).
delete [] this->send_net_if_;
this->clear_subs_list ();
}
+
int
ACE_SOCK_Dgram_Mcast::open (const ACE_INET_Addr &mcast_addr,
const ACE_TCHAR *net_if,
int reuse_addr)
{
ACE_TRACE ("ACE_SOCK_Dgram_Mcast::open");
+
// Only perform the <open> initialization if we haven't been opened
// earlier.
// No sanity check? We should probably flag an error if the user
// makes multiple calls to open().
if (this->get_handle () != ACE_INVALID_HANDLE)
return 0;
+
// Invoke lower-layer ::open.
if (ACE_SOCK::open (SOCK_DGRAM,
mcast_addr.get_type (),
0, // always use 0
reuse_addr) == -1)
return -1;
+
return this->open_i (mcast_addr, net_if, reuse_addr);
}
+
int
ACE_SOCK_Dgram_Mcast::open_i (const ACE_INET_Addr &mcast_addr,
const ACE_TCHAR *net_if,
@@ -160,6 +190,7 @@ ACE_SOCK_Dgram_Mcast::open_i (const ACE_INET_Addr &mcast_addr,
return -1;
#endif /* SO_REUSEPORT */
}
+
// Create an address/port# to bind the socket to. Use mcast_addr to
// initialize bind_addy to pick up the correct protocol family. If
// OPT_BINDADDR_YES is set, then we're done. Else use mcast_addr's
@@ -184,9 +215,11 @@ ACE_SOCK_Dgram_Mcast::open_i (const ACE_INET_Addr &mcast_addr,
return -1;
#endif /* ACE_HAS_IPV6 */
}
+
// Bind to the address (which may be INADDR_ANY) and port# (which may be 0)
if (ACE_SOCK_Dgram::shared_open (bind_addy, bind_addy.get_type ()) == -1)
return -1;
+
// Cache the actual bound address (which may be INADDR_ANY)
// and the actual bound port# (which will be a valid, non-zero port#).
ACE_INET_Addr bound_addy;
@@ -199,23 +232,28 @@ ACE_SOCK_Dgram_Mcast::open_i (const ACE_INET_Addr &mcast_addr,
return -1;
}
}
+
this->send_addr_ = mcast_addr;
this->send_addr_.set_port_number (bound_addy.get_port_number ());
if (net_if)
{
if (this->set_nic (net_if, mcast_addr.get_type ()))
return -1;
+
this->send_net_if_ = new ACE_TCHAR[ACE_OS::strlen (net_if) + 1];
ACE_OS::strcpy (this->send_net_if_, net_if);
}
+
return 0;
}
+
int
ACE_SOCK_Dgram_Mcast::subscribe_ifs (const ACE_INET_Addr &mcast_addr,
const ACE_TCHAR *net_if,
int reuse_addr)
{
ACE_TRACE ("ACE_SOCK_Dgram_Mcast::subscribe_ifs");
+
if (ACE_BIT_ENABLED (this->opts_, OPT_NULLIFACE_ALL)
&& net_if == 0)
{
@@ -225,19 +263,26 @@ ACE_SOCK_Dgram_Mcast::subscribe_ifs (const ACE_INET_Addr &mcast_addr,
size_t nr_subscribed = 0;
# if defined(__linux__)
struct if_nameindex *intf;
+
intf = ACE_OS::if_nameindex ();
+
if (intf == 0)
return -1;
+
int index = 0;
while (intf[index].if_index != 0 || intf[index].if_name != 0)
{
if (this->join (mcast_addr, reuse_addr,
ACE_TEXT_CHAR_TO_TCHAR(intf[index].if_name)) == 0)
++nr_subscribed;
+
++index;
}
+
ACE_OS::if_freenameindex (intf);
+
# elif defined (ACE_WIN32)
+
IP_ADAPTER_ADDRESSES tmp_addrs;
// Initial call to determine actual memory size needed
DWORD dwRetVal;
@@ -248,6 +293,7 @@ ACE_SOCK_Dgram_Mcast::subscribe_ifs (const ACE_INET_Addr &mcast_addr,
&tmp_addrs,
&bufLen)) != ERROR_BUFFER_OVERFLOW)
return -1; // With output bufferlength 0 this can't be right.
+
// Get required output buffer and retrieve info for real.
PIP_ADAPTER_ADDRESSES pAddrs;
char *buf;
@@ -264,31 +310,41 @@ ACE_SOCK_Dgram_Mcast::subscribe_ifs (const ACE_INET_Addr &mcast_addr,
delete[] buf; // clean up
return -1;
}
+
while (pAddrs)
{
if (this->join (mcast_addr, reuse_addr,
ACE_TEXT_CHAR_TO_TCHAR(pAddrs->AdapterName)) == 0)
++nr_subscribed;
+
pAddrs = pAddrs->Next;
}
+
delete[] buf; // clean up
+
# endif /* ACE_WIN32 */
+
if (nr_subscribed == 0)
{
errno = ENODEV;
return -1;
}
+
return 1;
}
else
{
// Subscribe on all local multicast-capable network interfaces, by
// doing recursive calls with specific interfaces.
+
ACE_INET_Addr *if_addrs = 0;
size_t if_cnt;
+
if (ACE::get_ip_interfaces (if_cnt, if_addrs) != 0)
return -1;
+
size_t nr_subscribed = 0;
+
if (if_cnt < 2)
{
if (this->join (mcast_addr,
@@ -303,6 +359,7 @@ ACE_SOCK_Dgram_Mcast::subscribe_ifs (const ACE_INET_Addr &mcast_addr,
while (if_cnt > 0)
{
--if_cnt;
+
// Convert to 0-based for indexing, next loop check.
if (if_addrs[if_cnt].get_type () != AF_INET || if_addrs[if_cnt].is_loopback ())
continue;
@@ -314,24 +371,32 @@ ACE_SOCK_Dgram_Mcast::subscribe_ifs (const ACE_INET_Addr &mcast_addr,
++nr_subscribed;
}
}
+
delete [] if_addrs;
+
if (nr_subscribed == 0)
{
errno = ENODEV;
return -1;
}
+
// 1 indicates a "short-circuit" return. This handles the
// recursive behavior of checking all the interfaces.
return 1;
+
}
#else
// Subscribe on all local multicast-capable network interfaces, by
// doing recursive calls with specific interfaces.
+
ACE_INET_Addr *if_addrs = 0;
size_t if_cnt;
+
if (ACE::get_ip_interfaces (if_cnt, if_addrs) != 0)
return -1;
+
size_t nr_subscribed = 0;
+
if (if_cnt < 2)
{
if (this->join (mcast_addr,
@@ -346,6 +411,7 @@ ACE_SOCK_Dgram_Mcast::subscribe_ifs (const ACE_INET_Addr &mcast_addr,
while (if_cnt > 0)
{
--if_cnt;
+
// Convert to 0-based for indexing, next loop check.
if (if_addrs[if_cnt].is_loopback ())
continue;
@@ -357,17 +423,21 @@ ACE_SOCK_Dgram_Mcast::subscribe_ifs (const ACE_INET_Addr &mcast_addr,
++nr_subscribed;
}
}
+
delete [] if_addrs;
+
if (nr_subscribed == 0)
{
errno = ENODEV;
return -1;
}
+
// 1 indicates a "short-circuit" return. This handles the
// recursive behavior of checking all the interfaces.
return 1;
#endif /* ACE_HAS_IPV6 */
}
+
#if defined (ACE_HAS_IPV6)
if (mcast_addr.get_type () == AF_INET6)
{
@@ -389,8 +459,11 @@ ACE_SOCK_Dgram_Mcast::subscribe_ifs (const ACE_INET_Addr &mcast_addr,
net_if) == -1)
return -1;
#endif /* ACE_HAS_IPV6 */
+
return 0;
+
}
+
int
ACE_SOCK_Dgram_Mcast::join (const ACE_INET_Addr &mcast_addr,
int reuse_addr,
@@ -398,6 +471,7 @@ ACE_SOCK_Dgram_Mcast::join (const ACE_INET_Addr &mcast_addr,
{
ACE_TRACE ("ACE_SOCK_Dgram_Mcast::join");
ACE_INET_Addr subscribe_addr = mcast_addr;
+
// If port# is 0, insert bound port# if it is set. (To satisfy lower-level
// port# validation.)
u_short def_port_number = this->send_addr_.get_port_number ();
@@ -406,6 +480,7 @@ ACE_SOCK_Dgram_Mcast::join (const ACE_INET_Addr &mcast_addr,
{
subscribe_addr.set_port_number (def_port_number);
}
+
// Check for port# different than bound port#.
u_short sub_port_number = mcast_addr.get_port_number ();
if (sub_port_number != 0
@@ -420,6 +495,7 @@ ACE_SOCK_Dgram_Mcast::join (const ACE_INET_Addr &mcast_addr,
errno = ENXIO;
return -1;
}
+
// If bind_addr_opt_ is enabled, check for address different than
// bound address.
ACE_INET_Addr tmp_addr (this->send_addr_);
@@ -442,8 +518,10 @@ ACE_SOCK_Dgram_Mcast::join (const ACE_INET_Addr &mcast_addr,
errno = ENXIO;
return -1;
}
+
// Attempt subscription.
int result = this->subscribe_i (subscribe_addr, reuse_addr, net_if);
+
#if defined (ACE_SOCK_DGRAM_MCAST_DUMPABLE)
if (result == 0)
{
@@ -464,8 +542,10 @@ ACE_SOCK_Dgram_Mcast::join (const ACE_INET_Addr &mcast_addr,
delete pmreq;
}
#endif /* ACE_SOCK_DGRAM_MCAST_DUMPABLE */
+
return result >= 0 ? 0 : result;
}
+
// Attempt subscribe and return status.
int
ACE_SOCK_Dgram_Mcast::subscribe_i (const ACE_INET_Addr &mcast_addr,
@@ -477,12 +557,14 @@ ACE_SOCK_Dgram_Mcast::subscribe_i (const ACE_INET_Addr &mcast_addr,
#if defined (ACE_HAS_IPV6)
ipv6_mreq mreq6;
#endif /* __linux__ && ACE_HAS_IPV6 */
+
// Open the socket IFF this is the first ::subscribe and ::open
// was not explicitly invoked.
if (this->open (mcast_addr,
net_if,
reuse_addr) == -1)
return -1;
+
// Only do this if net_if == 0, i.e., INADDR_ANY
if (net_if == 0)
{
@@ -493,6 +575,7 @@ ACE_SOCK_Dgram_Mcast::subscribe_i (const ACE_INET_Addr &mcast_addr,
if (result != 0)
return result;
}
+
#if defined (ACE_HAS_IPV6)
if (mcast_addr.get_type () == AF_INET6)
{
@@ -504,10 +587,12 @@ ACE_SOCK_Dgram_Mcast::subscribe_i (const ACE_INET_Addr &mcast_addr,
&mreq6,
sizeof mreq6) == -1)
return -1;
+
return 0;
}
// Fall through for IPv4 case
#endif /* ACE_HAS_IPV6 */
+
// Create multicast addr/if struct.
if (this->make_multicast_ifaddr (&mreq, mcast_addr, net_if) == -1)
return -1;
@@ -517,14 +602,17 @@ ACE_SOCK_Dgram_Mcast::subscribe_i (const ACE_INET_Addr &mcast_addr,
&mreq,
sizeof mreq) == -1)
return -1;
+
return 0;
}
+
int
ACE_SOCK_Dgram_Mcast::unsubscribe_ifs (const ACE_INET_Addr &mcast_addr,
const ACE_TCHAR *net_if)
{
ACE_TRACE ("ACE_SOCK_Dgram_Mcast::unsubscribe_ifs");
+
if (ACE_BIT_ENABLED (this->opts_, OPT_NULLIFACE_ALL)
&& net_if == 0)
{
@@ -533,19 +621,27 @@ ACE_SOCK_Dgram_Mcast::unsubscribe_ifs (const ACE_INET_Addr &mcast_addr,
{
size_t nr_unsubscribed = 0;
# if defined(__linux__)
+
struct if_nameindex *intf;
+
intf = ACE_OS::if_nameindex ();
+
if (intf == 0)
return -1;
+
int index = 0;
while (intf[index].if_index != 0 || intf[index].if_name != 0)
{
if (this->leave (mcast_addr, ACE_TEXT_CHAR_TO_TCHAR(intf[index].if_name)) == 0)
++nr_unsubscribed;
+
++index;
}
+
ACE_OS::if_freenameindex (intf);
+
# elif defined (ACE_WIN32)
+
IP_ADAPTER_ADDRESSES tmp_addrs;
// Initial call to determine actual memory size needed
DWORD dwRetVal;
@@ -556,6 +652,7 @@ ACE_SOCK_Dgram_Mcast::unsubscribe_ifs (const ACE_INET_Addr &mcast_addr,
&tmp_addrs,
&bufLen)) != ERROR_BUFFER_OVERFLOW)
return -1; // With output bufferlength 0 this can't be right.
+
// Get required output buffer and retrieve info for real.
PIP_ADAPTER_ADDRESSES pAddrs;
char *buf;
@@ -572,28 +669,37 @@ ACE_SOCK_Dgram_Mcast::unsubscribe_ifs (const ACE_INET_Addr &mcast_addr,
delete[] buf; // clean up
return -1;
}
+
while (pAddrs)
{
if (this->leave (mcast_addr, ACE_TEXT_CHAR_TO_TCHAR(pAddrs->AdapterName)) == 0)
++nr_unsubscribed;
+
pAddrs = pAddrs->Next;
}
+
delete[] buf; // clean up
+
# endif /* ACE_WIN32 */
+
if (nr_unsubscribed == 0)
{
errno = ENODEV;
return -1;
}
+
return 1;
+
}
else
{
// Unsubscribe on all local multicast-capable network interfaces, by
// doing recursive calls with specific interfaces.
+
ACE_INET_Addr *if_addrs = 0;
size_t if_cnt;
+
// NOTE - <get_ip_interfaces> doesn't always get all of the
// interfaces. In particular, it may not get a PPP interface. This
// is a limitation of the way <get_ip_interfaces> works with
@@ -601,7 +707,9 @@ ACE_SOCK_Dgram_Mcast::unsubscribe_ifs (const ACE_INET_Addr &mcast_addr,
// list is available only with MSVC 5 and newer.
if (ACE::get_ip_interfaces (if_cnt, if_addrs) != 0)
return -1;
+
size_t nr_unsubscribed = 0;
+
if (if_cnt < 2)
{
if (this->leave (mcast_addr,
@@ -623,19 +731,25 @@ ACE_SOCK_Dgram_Mcast::unsubscribe_ifs (const ACE_INET_Addr &mcast_addr,
++nr_unsubscribed;
}
}
+
delete [] if_addrs;
+
if (nr_unsubscribed == 0)
{
errno = ENODEV;
return -1;
}
+
return 1;
+
}
#else /* ACE_HAS_IPV6 */
// Unsubscribe on all local multicast-capable network interfaces, by
// doing recursive calls with specific interfaces.
+
ACE_INET_Addr *if_addrs = 0;
size_t if_cnt;
+
// NOTE - <get_ip_interfaces> doesn't always get all of the
// interfaces. In particular, it may not get a PPP interface. This
// is a limitation of the way <get_ip_interfaces> works with
@@ -643,7 +757,9 @@ ACE_SOCK_Dgram_Mcast::unsubscribe_ifs (const ACE_INET_Addr &mcast_addr,
// is available only with MSVC 5 and newer.
if (ACE::get_ip_interfaces (if_cnt, if_addrs) != 0)
return -1;
+
size_t nr_unsubscribed = 0;
+
if (if_cnt < 2)
{
if (this->leave (mcast_addr,
@@ -665,18 +781,23 @@ ACE_SOCK_Dgram_Mcast::unsubscribe_ifs (const ACE_INET_Addr &mcast_addr,
++nr_unsubscribed;
}
}
+
delete [] if_addrs;
+
if (nr_unsubscribed == 0)
{
errno = ENODEV;
return -1;
}
+
return 1;
#endif /* !ACE_HAS_IPV6 */
}
+
return 0;
}
+
int
ACE_SOCK_Dgram_Mcast::leave (const ACE_INET_Addr &mcast_addr,
const ACE_TCHAR *net_if)
@@ -685,6 +806,7 @@ ACE_SOCK_Dgram_Mcast::leave (const ACE_INET_Addr &mcast_addr,
// Unsubscribe.
int result = this->unsubscribe_i (mcast_addr,
net_if);
+
#if defined (ACE_SOCK_DGRAM_MCAST_DUMPABLE)
// (Unconditionally) Remove this addr/if from subscription list.
// (Addr/if is removed even if unsubscribe failed)
@@ -708,19 +830,24 @@ ACE_SOCK_Dgram_Mcast::leave (const ACE_INET_Addr &mcast_addr,
}
}
#endif /* ACE_SOCK_DGRAM_MCAST_DUMPABLE */
+
return result >= 0 ? 0 : result;
}
+
// Attempt unsubscribe and return status.
int
ACE_SOCK_Dgram_Mcast::unsubscribe_i (const ACE_INET_Addr &mcast_addr,
const ACE_TCHAR *net_if)
{
ACE_TRACE ("ACE_SOCK_Dgram_Mcast::unsubscribe_i");
+
int result = this->unsubscribe_ifs (mcast_addr,
net_if);
+
// Check for error or "short-circuit" return.
if (result != 0)
return result;
+
#if defined (ACE_HAS_IPV6)
if (mcast_addr.get_type () == AF_INET6)
{
@@ -739,6 +866,7 @@ ACE_SOCK_Dgram_Mcast::unsubscribe_i (const ACE_INET_Addr &mcast_addr,
{
return -1;
}
+
}
else // IPv4
{
@@ -757,6 +885,7 @@ ACE_SOCK_Dgram_Mcast::unsubscribe_i (const ACE_INET_Addr &mcast_addr,
{
return -1;
}
+
}
#else
// Validate addr/if specifications and create addr/if struct.
@@ -776,13 +905,16 @@ ACE_SOCK_Dgram_Mcast::unsubscribe_i (const ACE_INET_Addr &mcast_addr,
return -1;
}
#endif /* ACE_HAS_IPV6 */
+
return 0;
}
+
int
ACE_SOCK_Dgram_Mcast::clear_subs_list (void)
{
ACE_TRACE ("ACE_SOCK_Dgram_Mcast::clear_subs_list");
int result = 0;
+
#if defined (ACE_SOCK_DGRAM_MCAST_DUMPABLE)
ACE_MT (ACE_GUARD_RETURN (ACE_SDM_LOCK, guard,
this->subscription_list_lock_, -1));
@@ -796,5 +928,6 @@ ACE_SOCK_Dgram_Mcast::clear_subs_list (void)
#endif /* ACE_SOCK_DGRAM_MCAST_DUMPABLE */
return result;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/SOCK_Dgram_Mcast.h b/dep/ACE_wrappers/ace/SOCK_Dgram_Mcast.h
index af814093e26..a14e1fc0994 100644
--- a/dep/ACE_wrappers/ace/SOCK_Dgram_Mcast.h
+++ b/dep/ACE_wrappers/ace/SOCK_Dgram_Mcast.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file SOCK_Dgram_Mcast.h
@@ -12,15 +13,21 @@
* @author Don Hinton <dhinton@objectsciences.com>
*/
//=============================================================================
+
#ifndef ACE_SOCK_DGRAM_MCAST_H
#define ACE_SOCK_DGRAM_MCAST_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/SOCK_Dgram.h"
#include "ace/INET_Addr.h"
+
#if defined (ACE_SOCK_DGRAM_MCAST_DUMPABLE)
# include "ace/Containers_T.h"
# include "ace/Synch_Traits.h"
@@ -29,7 +36,9 @@
# define ACE_SDM_LOCK ACE_SYNCH_MUTEX
# endif /* ACE_SDM_LOCK */
#endif /* ACE_SOCK_DGRAM_MCAST_DUMPABLE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_SOCK_Dgram_Mcast
*
@@ -85,6 +94,7 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
class ACE_Export ACE_SOCK_Dgram_Mcast : public ACE_SOCK_Dgram
{
public:
+
/**
* @brief Option parameters.
*
@@ -166,7 +176,9 @@ public:
/// All default options.
DEFOPTS = DEFOPT_BINDADDR | DEFOPT_NULLIFACE
};
+
// = Initialization routines.
+
/// Ctor - Create an unitialized instance and define per-instance optional
/// functionality.
/**
@@ -174,6 +186,7 @@ public:
* operational parameters, before performing any I/O with this instance.
*/
ACE_SOCK_Dgram_Mcast (options opts = DEFOPTS);
+
/// Dtor - Release all resources and implicitly or explicitly unsubscribe
/// from all currently subscribed groups.
/**
@@ -182,6 +195,7 @@ public:
* unsubscribe upon the close of the socket.
*/
~ACE_SOCK_Dgram_Mcast (void);
+
/// Explicitly open/bind the socket and define the network interface
/// and default multicast address used for sending messages.
/**
@@ -207,7 +221,9 @@ public:
int open (const ACE_INET_Addr &mcast_addr, // Bound & sendto address.
const ACE_TCHAR *net_if = 0, // Net interface for sends.
int reuse_addr = 1); // Reuse addr/port sock opt.
+
// = Multicast group subscribe/unsubscribe routines.
+
/// Join a multicast group on a given interface (or all interfaces, if
/// supported).
/**
@@ -241,6 +257,7 @@ public:
int reuse_addr = 1, // (see above)
const ACE_TCHAR *net_if = 0);
+
/// Leave a multicast group on a given interface (or all interfaces, if
/// supported).
/**
@@ -260,18 +277,23 @@ public:
*/
int leave (const ACE_INET_Addr &mcast_addr,
const ACE_TCHAR *net_if = 0);
+
// = Data transfer routines.
+
/// Send @a n bytes in @a buf, using the multicast address and network interface
/// defined by the first <open> or <subscribe>.
ssize_t send (const void *buf,
size_t n,
int flags = 0) const;
+
/// Send @a n <iovecs>, using the multicast address and network interface
/// defined by the first <open> or <subscribe>.
ssize_t send (const iovec iov[],
int n,
int flags = 0) const;
+
// = Options.
+
/// Set a socket option.
/**
* Set an IP option that takes a char as input, such as IP_MULTICAST_LOOP
@@ -285,47 +307,61 @@ public:
* easily with with IPv6 options. Use ACE_SOCK::set_option instead.
*/
int set_option (int option, char optval);
+
/// Dump the state of an object.
/**
* Logs the setting of all options, the bound address, the send address and
* interface, and the list of current subscriptions.
*/
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
+
/// Subscribe to a multicast address on one or more network interface(s).
/// (No QoS support.)
int subscribe_ifs (const ACE_INET_Addr &mcast_addr,
const ACE_TCHAR *net_if,
int reuse_addr);
+
/// Do subscription processing w/out updating the subscription list.
// (Layered method for <subscribe> processing).
int subscribe_i (const ACE_INET_Addr &mcast_addr,
int reuse_addr = 1,
const ACE_TCHAR *net_if = 0);
+
/// Unsubscribe from a multicast address on one or more network interface(s).
int unsubscribe_ifs (const ACE_INET_Addr &mcast_addr,
const ACE_TCHAR *net_if = 0);
+
/// Do unsubscription processing w/out udpating subscription list.
// (Layered method for <unsubscribe> processing).
int unsubscribe_i (const ACE_INET_Addr &mcast_addr,
const ACE_TCHAR *net_if = 0);
+
protected:
+
/// Contains common open functionality so that inheriting classes can
/// reuse it.
int open_i (const ACE_INET_Addr &mcast_addr, // Bound & sendto address.
const ACE_TCHAR *net_if = 0, // Net interface for sends.
int reuse_addr = 1);
+
/// Empty the dynamic subscription list.
int clear_subs_list (void);
+
private:
+
/// Per-instance options..
int opts_;
+
/// Multicast address to which local <send> methods send datagrams.
ACE_INET_Addr send_addr_;
/// Network interface to which all <send> methods send multicast datagrams.
ACE_TCHAR *send_net_if_;
+
#if defined (ACE_SOCK_DGRAM_MCAST_DUMPABLE)
typedef ACE_DLList<ip_mreq> subscription_list_t;
typedef ACE_DLList_Iterator<ip_mreq> subscription_list_iter_t;
@@ -335,11 +371,15 @@ private:
mutable ACE_SDM_LOCK subscription_list_lock_;
// (Lock type does not need to support recursive locking.)
#endif /* ACE_SOCK_DGRAM_MCAST_DUMPABLE */
+
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/SOCK_Dgram_Mcast.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_SOCK_DGRAM_MCAST_H */
diff --git a/dep/ACE_wrappers/ace/SOCK_Dgram_Mcast.inl b/dep/ACE_wrappers/ace/SOCK_Dgram_Mcast.inl
index 70b3c1e4f65..75457d32d92 100644
--- a/dep/ACE_wrappers/ace/SOCK_Dgram_Mcast.inl
+++ b/dep/ACE_wrappers/ace/SOCK_Dgram_Mcast.inl
@@ -1,24 +1,30 @@
// -*- C++ -*-
//
// $Id: SOCK_Dgram_Mcast.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE int
ACE_SOCK_Dgram_Mcast::set_option (int option,
char optval)
{
ACE_TRACE ("ACE_SOCK_Dgram_Mcast::set_option");
+
if (this->get_handle () == ACE_INVALID_HANDLE)
return -1;
+
int level = IPPROTO_IP;
#if defined (IPPROTO_IPV6) && ! defined (INTEGRITY)
if (this->send_addr_.get_type () == PF_INET6)
level = IPPROTO_IPV6;
#endif /* IPPROTO_IPV6 */
+
return this->ACE_SOCK::set_option (level,
option,
&optval,
sizeof (optval));
}
+
ACE_INLINE ssize_t
ACE_SOCK_Dgram_Mcast::send (const void *buf,
size_t n,
@@ -30,6 +36,7 @@ ACE_SOCK_Dgram_Mcast::send (const void *buf,
this->send_addr_,
flags);
}
+
ACE_INLINE ssize_t
ACE_SOCK_Dgram_Mcast::send (const iovec iov[],
int n,
@@ -41,4 +48,5 @@ ACE_SOCK_Dgram_Mcast::send (const iovec iov[],
this->send_addr_,
flags);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/SOCK_IO.cpp b/dep/ACE_wrappers/ace/SOCK_IO.cpp
index bd6d25d884f..7d5befad8fd 100644
--- a/dep/ACE_wrappers/ace/SOCK_IO.cpp
+++ b/dep/ACE_wrappers/ace/SOCK_IO.cpp
@@ -1,16 +1,23 @@
// $Id: SOCK_IO.cpp 82294 2008-07-12 13:03:37Z johnnyw $
+
#include "ace/SOCK_IO.h"
+
#include "ace/Handle_Set.h"
#include "ace/OS_NS_sys_select.h"
#include "ace/OS_NS_sys_socket.h"
#include "ace/OS_Memory.h"
#include "ace/Truncate.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/SOCK_IO.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace, SOCK_IO, "$Id: SOCK_IO.cpp 82294 2008-07-12 13:03:37Z johnnyw $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_SOCK_IO)
+
void
ACE_SOCK_IO::dump (void) const
{
@@ -18,10 +25,12 @@ ACE_SOCK_IO::dump (void) const
ACE_TRACE ("ACE_SOCK_IO::dump");
#endif /* ACE_HAS_DUMP */
}
+
// Allows a client to read from a socket without having to provide
// a buffer to read. This method determines how much data is in the
// socket, allocates a buffer of this size, reads in the data, and
// returns the number of bytes read.
+
ssize_t
ACE_SOCK_IO::recvv (iovec *io_vec,
const ACE_Time_Value *timeout) const
@@ -31,7 +40,9 @@ ACE_SOCK_IO::recvv (iovec *io_vec,
ACE_Handle_Set handle_set;
handle_set.reset ();
handle_set.set_bit (this->get_handle ());
+
io_vec->iov_base = 0;
+
// Check the status of the current socket.
int select_width;
# if defined (ACE_WIN32)
@@ -57,7 +68,9 @@ ACE_SOCK_IO::recvv (iovec *io_vec,
// Goes fine, fallthrough to get data
break;
}
+
int inlen = 0;
+
if (ACE_OS::ioctl (this->get_handle (),
FIONREAD,
&inlen) == -1)
@@ -85,14 +98,17 @@ ACE_SOCK_IO::recvv (iovec *io_vec,
ACE_NOTSUP_RETURN (-1);
#endif /* FIONREAD */
}
+
// Send N char *ptrs and int lengths. Note that the char *'s precede
// the ints (basically, an varargs version of writev). The count N is
// the *total* number of trailing arguments, *not* a couple of the
// number of tuple pairs!
+
ssize_t
ACE_SOCK_IO::send (size_t n, ...) const
{
ACE_TRACE ("ACE_SOCK_IO::send");
+
va_list argp;
int const total_tuples = ACE_Utils::truncate_cast<int> (n / 2);
iovec *iovp = 0;
@@ -103,12 +119,15 @@ ACE_SOCK_IO::send (size_t n, ...) const
iovec[total_tuples],
-1);
#endif /* !defined (ACE_HAS_ALLOCA) */
+
va_start (argp, n);
+
for (int i = 0; i < total_tuples; i++)
{
iovp[i].iov_base = va_arg (argp, char *);
iovp[i].iov_len = va_arg (argp, int);
}
+
ssize_t const result = ACE_OS::sendv (this->get_handle (),
iovp,
total_tuples);
@@ -118,15 +137,18 @@ ACE_SOCK_IO::send (size_t n, ...) const
va_end (argp);
return result;
}
+
// This is basically an interface to ACE_OS::readv, that doesn't use
// the struct iovec_Base explicitly. The ... can be passed as an arbitrary
// number of (char *ptr, int len) tuples. However, the count N is the
// *total* number of trailing arguments, *not* a couple of the number
// of tuple pairs!
+
ssize_t
ACE_SOCK_IO::recv (size_t n, ...) const
{
ACE_TRACE ("ACE_SOCK_IO::recv");
+
va_list argp;
int const total_tuples = ACE_Utils::truncate_cast<int> (n / 2);
iovec *iovp;
@@ -137,12 +159,15 @@ ACE_SOCK_IO::recv (size_t n, ...) const
iovec[total_tuples],
-1);
#endif /* !defined (ACE_HAS_ALLOCA) */
+
va_start (argp, n);
+
for (int i = 0; i < total_tuples; i++)
{
iovp[i].iov_base = va_arg (argp, char *);
iovp[i].iov_len = va_arg (argp, int);
}
+
ssize_t const result = ACE_OS::recvv (this->get_handle (),
iovp,
total_tuples);
@@ -152,5 +177,6 @@ ACE_SOCK_IO::recv (size_t n, ...) const
va_end (argp);
return result;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/SOCK_IO.h b/dep/ACE_wrappers/ace/SOCK_IO.h
index 572290e9e35..ce14f87544b 100644
--- a/dep/ACE_wrappers/ace/SOCK_IO.h
+++ b/dep/ACE_wrappers/ace/SOCK_IO.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file SOCK_IO.h
@@ -8,15 +9,22 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//==========================================================================
+
#ifndef ACE_SOCK_IO_H
#define ACE_SOCK_IO_H
+
#include /**/ "ace/pre.h"
+
#include "ace/SOCK.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/ACE.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_SOCK_IO
*
@@ -42,23 +50,29 @@ class ACE_Export ACE_SOCK_IO : public ACE_SOCK
{
public:
// = Initialization and termination methods.
+
/// Constructor.
ACE_SOCK_IO (void);
+
/// Destructor.
~ACE_SOCK_IO (void);
+
/// Recv an @a n byte buffer from the connected socket.
ssize_t recv (void *buf,
size_t n,
int flags,
const ACE_Time_Value *timeout = 0) const;
+
/// Recv an @a n byte buffer from the connected socket.
ssize_t recv (void *buf,
size_t n,
const ACE_Time_Value *timeout = 0) const;
+
/// Recv an <iovec> of size @a n from the connected socket.
ssize_t recvv (iovec iov[],
int n,
const ACE_Time_Value *timeout = 0) const;
+
/**
* Allows a client to read from a socket without having to provide a
* buffer to read. This method determines how much data is in the
@@ -69,42 +83,55 @@ public:
*/
ssize_t recvv (iovec *io_vec,
const ACE_Time_Value *timeout = 0) const;
+
/// Recv @a n varargs messages to the connected socket.
ssize_t recv (size_t n,
...) const;
+
/// Recv @a n bytes via Win32 @c ReadFile using overlapped I/O.
ssize_t recv (void *buf,
size_t n,
ACE_OVERLAPPED *overlapped) const;
+
/// Send an @a n byte buffer to the connected socket.
ssize_t send (const void *buf,
size_t n,
int flags,
const ACE_Time_Value *timeout = 0) const;
+
/// Send an @a n byte buffer to the connected socket.
ssize_t send (const void *buf,
size_t n,
const ACE_Time_Value *timeout = 0) const;
+
/// Send an @c iovec of size @a n to the connected socket.
ssize_t sendv (const iovec iov[],
int n,
const ACE_Time_Value *timeout = 0) const;
+
/// Send @a n varargs messages to the connected socket.
ssize_t send (size_t n,
...) const;
+
/// Send @a n bytes via Win32 <WriteFile> using overlapped I/O.
ssize_t send (const void *buf,
size_t n,
ACE_OVERLAPPED *overlapped) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/SOCK_IO.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_SOCK_IO_H */
diff --git a/dep/ACE_wrappers/ace/SOCK_IO.inl b/dep/ACE_wrappers/ace/SOCK_IO.inl
index 65cbff07770..55716921dc5 100644
--- a/dep/ACE_wrappers/ace/SOCK_IO.inl
+++ b/dep/ACE_wrappers/ace/SOCK_IO.inl
@@ -1,19 +1,25 @@
// -*- C++ -*-
//
// $Id: SOCK_IO.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_unistd.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Send an n byte message to the connected socket.
+
ACE_INLINE
ACE_SOCK_IO::ACE_SOCK_IO (void)
{
// ACE_TRACE ("ACE_SOCK_IO::ACE_SOCK_IO");
}
+
ACE_INLINE
ACE_SOCK_IO::~ACE_SOCK_IO (void)
{
// ACE_TRACE ("ACE_SOCK_IO::~ACE_SOCK_IO");
}
+
ACE_INLINE ssize_t
ACE_SOCK_IO::recv (void *buf,
size_t len,
@@ -27,6 +33,7 @@ ACE_SOCK_IO::recv (void *buf,
flags,
timeout);
}
+
ACE_INLINE ssize_t
ACE_SOCK_IO::recv (void *buf,
size_t len,
@@ -38,6 +45,7 @@ ACE_SOCK_IO::recv (void *buf,
len,
timeout);
}
+
ACE_INLINE ssize_t
ACE_SOCK_IO::recvv (iovec iov[],
int n,
@@ -49,6 +57,7 @@ ACE_SOCK_IO::recvv (iovec iov[],
n,
timeout);
}
+
ACE_INLINE ssize_t
ACE_SOCK_IO::recv (void *buf,
size_t n,
@@ -60,6 +69,7 @@ ACE_SOCK_IO::recv (void *buf,
n,
overlapped);
}
+
ACE_INLINE ssize_t
ACE_SOCK_IO::send (const void *buf,
size_t len,
@@ -73,6 +83,7 @@ ACE_SOCK_IO::send (const void *buf,
flags,
timeout);
}
+
ACE_INLINE ssize_t
ACE_SOCK_IO::send (const void *buf,
size_t len,
@@ -84,6 +95,7 @@ ACE_SOCK_IO::send (const void *buf,
len,
timeout);
}
+
ACE_INLINE ssize_t
ACE_SOCK_IO::sendv (const iovec iov[],
int n,
@@ -95,6 +107,7 @@ ACE_SOCK_IO::sendv (const iovec iov[],
n,
timeout);
}
+
ACE_INLINE ssize_t
ACE_SOCK_IO::send (const void *buf,
size_t n,
@@ -106,4 +119,5 @@ ACE_SOCK_IO::send (const void *buf,
n,
overlapped);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/SOCK_Netlink.cpp b/dep/ACE_wrappers/ace/SOCK_Netlink.cpp
index 76e49052ef0..673b64b2958 100644
--- a/dep/ACE_wrappers/ace/SOCK_Netlink.cpp
+++ b/dep/ACE_wrappers/ace/SOCK_Netlink.cpp
@@ -1,28 +1,37 @@
// $Id: SOCK_Netlink.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include /* */ "ace/SOCK_Netlink.h"
+
#ifdef ACE_HAS_NETLINK
+
#include "ace/Log_Msg.h"
#include "ace/ACE.h"
#include "ace/OS_NS_string.h"
#include "ace/OS_NS_unistd.h"
#include "ace/SOCK_Netlink.h"
#include "ace/OS_NS_sys_socket.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/SOCK_Netlink.inl"
#endif /* __ACE_INLINE__ */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE (ACE_SOCK_Netlink)
+
int ACE_SOCK_Netlink::open (ACE_Netlink_Addr &local,
int protocol_family,
int protocol) //! protocol of your choosing
{
ACE_TRACE ("ACE_SOCK_Netlink::open");
+
if ( ACE_SOCK::open (SOCK_RAW,
protocol_family, //! RAW or DGRAM valid
protocol,0) < 0 ) {
ACE_TRACE ("ACE_SOCK_Netlink::open failed to open");
return -1;
}
+
if (ACE_OS::bind(this->get_handle(),
(sockaddr*)local.get_addr(),
local.get_addr_size()) == -1 ) {
@@ -32,11 +41,13 @@ int ACE_SOCK_Netlink::open (ACE_Netlink_Addr &local,
return 0;
}
+
ACE_SOCK_Netlink::ACE_SOCK_Netlink (ACE_Netlink_Addr &local,
int protocol_family,
int protocol)
{
ACE_TRACE ("ACE_SOCK_Netlink::ACE_SOCK_Netlink");
+
if (this->open (local,
protocol_family,
protocol) == -1)
@@ -44,6 +55,7 @@ ACE_SOCK_Netlink::ACE_SOCK_Netlink (ACE_Netlink_Addr &local,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_SOCK_Netlink")));
}
+
ssize_t
ACE_SOCK_Netlink::send (const iovec iov[],
int n,
@@ -52,6 +64,7 @@ ACE_SOCK_Netlink::send (const iovec iov[],
{
ACE_TRACE ("ACE_SOCK_Netlink::send");
msghdr send_msg;
+
send_msg.msg_iov = (iovec *) iov;
send_msg.msg_iovlen = n;
send_msg.msg_name = (char *) addr.get_addr ();
@@ -59,10 +72,12 @@ ACE_SOCK_Netlink::send (const iovec iov[],
send_msg.msg_control = 0;
send_msg.msg_controllen = 0;
send_msg.msg_flags = 0;
+
return ACE_OS::sendmsg (this->get_handle (),
&send_msg,
flags);
}
+
ssize_t
ACE_SOCK_Netlink::recv (iovec iov[],
int n,
@@ -71,6 +86,7 @@ ACE_SOCK_Netlink::recv (iovec iov[],
{
ACE_TRACE ("ACE_SOCK_Netlink::recv");
msghdr recv_msg;
+
recv_msg.msg_iov = (iovec *) iov;
recv_msg.msg_iovlen = n;
recv_msg.msg_name = (char *) addr.get_addr ();
@@ -78,15 +94,21 @@ ACE_SOCK_Netlink::recv (iovec iov[],
recv_msg.msg_control = 0;
recv_msg.msg_controllen = 0;
recv_msg.msg_flags = 0;
+
ssize_t status = ACE_OS::recvmsg (this->get_handle (),
&recv_msg,
flags);
+
if (recv_msg.msg_flags & MSG_TRUNC)
return -1;
+
addr.set_size (recv_msg.msg_namelen);
addr.set_type (((sockaddr_in *) addr.get_addr())->sin_family);
+
return status;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_NETLINK */
diff --git a/dep/ACE_wrappers/ace/SOCK_Netlink.h b/dep/ACE_wrappers/ace/SOCK_Netlink.h
index aeee54e0362..99d1198fa66 100644
--- a/dep/ACE_wrappers/ace/SOCK_Netlink.h
+++ b/dep/ACE_wrappers/ace/SOCK_Netlink.h
@@ -9,23 +9,32 @@
* @author Raz Ben Yehuda <raziebe@013.net.il>
*/
//=============================================================================
+
#ifndef ACE_SOCK_NETLINK_H
#define ACE_SOCK_NETLINK_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
#pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#ifdef ACE_HAS_NETLINK
+
#include "ace/SOCK.h"
#include "ace/Netlink_Addr.h"
#include "ace/Addr.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_SOCK_Netlink
*
* @brief Defines the member functions for the ACE_SOCK Netlink
* abstraction.
+
* Netlink sockets are used in Linux as a communication facilty of kernel to user
* and user to kernel.
* This code was created so one could use ACE reactor
@@ -48,6 +57,7 @@ public:
int open (ACE_Netlink_Addr &local,
int protocol_family,
int protocol);
+
/**
* receives abuffer with the size n
*/
@@ -61,6 +71,7 @@ public:
ssize_t send (void *buf,
size_t n,
int flags) const;
+
/**
* Recieves an iovec of size @a n to the netlink socket
*/
@@ -68,6 +79,7 @@ public:
int n,
ACE_Addr &addr,
int flags = 0) const;
+
/**
* Sends an iovec of size @a n to the netlink socket
*/
@@ -75,14 +87,21 @@ public:
int n,
const ACE_Addr &addr,
int flags = 0) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/SOCK_Netlink.inl"
#endif /* __ACE_INLINE__ */
+
#endif /* ACE_HAS_NETLINK */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_SOCK_NETLINK_H */
+
diff --git a/dep/ACE_wrappers/ace/SOCK_Netlink.inl b/dep/ACE_wrappers/ace/SOCK_Netlink.inl
index d7d30780190..0a0504ce16c 100644
--- a/dep/ACE_wrappers/ace/SOCK_Netlink.inl
+++ b/dep/ACE_wrappers/ace/SOCK_Netlink.inl
@@ -1,16 +1,21 @@
// $Id: SOCK_Netlink.inl 80826 2008-03-04 14:51:23Z wotte $
+
#ifdef ACE_HAS_NETLINK
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_SOCK_Netlink::ACE_SOCK_Netlink (void)
{
ACE_TRACE ("ACE_SOCK_Netlink::ACE_SOCK_Netlink");
}
+
ACE_INLINE
ACE_SOCK_Netlink::~ACE_SOCK_Netlink (void)
{
ACE_TRACE ("ACE_SOCK_Netlink::~ACE_SOCK_Netlink");
}
+
ACE_INLINE ssize_t ACE_SOCK_Netlink::recv ( void *buf,
size_t n,
int flags) const
@@ -18,6 +23,7 @@ ACE_INLINE ssize_t ACE_SOCK_Netlink::recv ( void *buf,
ACE_TRACE ("ACE_SOCK_Netlink::recv");
return ACE_OS::recv (this->get_handle (),(char *) buf,n,flags);
}
+
ACE_INLINE ssize_t ACE_SOCK_Netlink::send (void *buf,
size_t n,
int flags) const
@@ -25,5 +31,7 @@ ACE_INLINE ssize_t ACE_SOCK_Netlink::send (void *buf,
ACE_TRACE ("ACE_SOCK_Netlink::send");
return ACE_OS::send (this->get_handle (),(char *) buf,n,flags);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_NETLINK */
diff --git a/dep/ACE_wrappers/ace/SOCK_SEQPACK_Acceptor.cpp b/dep/ACE_wrappers/ace/SOCK_SEQPACK_Acceptor.cpp
index a1e588e3f87..2fe58ab938c 100644
--- a/dep/ACE_wrappers/ace/SOCK_SEQPACK_Acceptor.cpp
+++ b/dep/ACE_wrappers/ace/SOCK_SEQPACK_Acceptor.cpp
@@ -1,30 +1,42 @@
// $Id: SOCK_SEQPACK_Acceptor.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/SOCK_SEQPACK_Acceptor.h"
+
#include "ace/Auto_Ptr.h"
#include "ace/Log_Msg.h"
#include "ace/OS_Memory.h"
#include "ace/OS_NS_string.h"
#include "ace/OS_NS_sys_socket.h"
#include "ace/os_include/os_fcntl.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/SOCK_SEQPACK_Acceptor.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace, SOCK_SEQPACK_Acceptor, "SOCK_SEQPACK_Acceptor.cpp,v 4.30 2002/03/08 23:18:09 spark Exp")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_SOCK_SEQPACK_Acceptor)
+
// Do nothing routine for constructor.
+
ACE_SOCK_SEQPACK_Acceptor::ACE_SOCK_SEQPACK_Acceptor (void)
{
ACE_TRACE ("ACE_SOCK_SEQPACK_Acceptor::ACE_SOCK_SEQPACK_Acceptor");
}
+
// Performs the timed accept operation.
+
int
ACE_SOCK_SEQPACK_Acceptor::shared_accept_start (ACE_Time_Value *timeout,
int restart,
int &in_blocking_mode) const
{
ACE_TRACE ("ACE_SOCK_SEQPACK_Acceptor::shared_accept_start");
+
ACE_HANDLE handle = this->get_handle ();
+
// Handle the case where we're doing a timed <accept>.
if (timeout != 0)
{
@@ -44,15 +56,19 @@ ACE_SOCK_SEQPACK_Acceptor::shared_accept_start (ACE_Time_Value *timeout,
return -1;
}
}
+
return 0;
}
+
int
ACE_SOCK_SEQPACK_Acceptor::shared_accept_finish (ACE_SOCK_SEQPACK_Association new_association,
int in_blocking_mode,
int reset_new_handle) const
{
ACE_TRACE ("ACE_SOCK_SEQPACK_Acceptor::shared_accept_finish ()");
+
ACE_HANDLE new_handle = new_association.get_handle ();
+
// Check to see if we were originally in blocking mode, and if so,
// set the <new_association>'s handle and <this> handle to be in blocking
// mode.
@@ -60,6 +76,7 @@ ACE_SOCK_SEQPACK_Acceptor::shared_accept_finish (ACE_SOCK_SEQPACK_Association ne
{
// Save/restore errno.
ACE_Errno_Guard error (errno);
+
// Only disable ACE_NONBLOCK if we weren't in non-blocking mode
// originally.
ACE::clr_flags (this->get_handle (),
@@ -67,6 +84,7 @@ ACE_SOCK_SEQPACK_Acceptor::shared_accept_finish (ACE_SOCK_SEQPACK_Association ne
ACE::clr_flags (new_handle,
ACE_NONBLOCK);
}
+
#if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
if (reset_new_handle)
// Reset the event association inherited by the new handle.
@@ -74,9 +92,12 @@ ACE_SOCK_SEQPACK_Acceptor::shared_accept_finish (ACE_SOCK_SEQPACK_Association ne
#else
ACE_UNUSED_ARG (reset_new_handle);
#endif /* ACE_WIN32 */
+
return new_handle == ACE_INVALID_HANDLE ? -1 : 0;
}
+
// General purpose routine for accepting new connections.
+
int
ACE_SOCK_SEQPACK_Acceptor::accept (ACE_SOCK_SEQPACK_Association &new_association,
ACE_Addr *remote_addr,
@@ -85,6 +106,7 @@ ACE_SOCK_SEQPACK_Acceptor::accept (ACE_SOCK_SEQPACK_Association &new_association
int reset_new_handle) const
{
ACE_TRACE ("ACE_SOCK_SEQPACK_Acceptor::accept");
+
int in_blocking_mode = 0;
if (this->shared_accept_start (timeout,
restart,
@@ -97,12 +119,14 @@ ACE_SOCK_SEQPACK_Acceptor::accept (ACE_SOCK_SEQPACK_Association &new_association
int *len_ptr = 0;
sockaddr *addr = 0;
int len = 0;
+
if (remote_addr != 0)
{
len = remote_addr->get_size ();
len_ptr = &len;
addr = (sockaddr *) remote_addr->get_addr ();
}
+
do
new_association.set_handle (ACE_OS::accept (this->get_handle (),
addr,
@@ -111,6 +135,7 @@ ACE_SOCK_SEQPACK_Acceptor::accept (ACE_SOCK_SEQPACK_Association &new_association
&& restart != 0
&& errno == EINTR
&& timeout == 0);
+
// Reset the size of the addr, so the proper UNIX/IPv4/IPv6 family
// is known.
if (new_association.get_handle () != ACE_INVALID_HANDLE
@@ -120,10 +145,12 @@ ACE_SOCK_SEQPACK_Acceptor::accept (ACE_SOCK_SEQPACK_Association &new_association
remote_addr->set_type (addr->sa_family);
}
}
+
return this->shared_accept_finish (new_association,
in_blocking_mode,
reset_new_handle);
}
+
void
ACE_SOCK_SEQPACK_Acceptor::dump (void) const
{
@@ -131,6 +158,7 @@ ACE_SOCK_SEQPACK_Acceptor::dump (void) const
ACE_TRACE ("ACE_SOCK_SEQPACK_Acceptor::dump");
#endif /* ACE_HAS_DUMP */
}
+
int
ACE_SOCK_SEQPACK_Acceptor::shared_open (const ACE_Addr &local_sap,
int protocol_family,
@@ -138,14 +166,17 @@ ACE_SOCK_SEQPACK_Acceptor::shared_open (const ACE_Addr &local_sap,
{
ACE_TRACE ("ACE_SOCK_SEQPACK_Acceptor::shared_open");
int error = 0;
+
#if defined (ACE_HAS_IPV6)
ACE_ASSERT (protocol_family == PF_INET || protocol_family == PF_INET6);
+
if (protocol_family == PF_INET6)
{
sockaddr_in6 local_inet6_addr;
ACE_OS::memset (reinterpret_cast<void *> (&local_inet6_addr),
0,
sizeof local_inet6_addr);
+
if (local_sap == ACE_Addr::sap_any)
{
local_inet6_addr.sin6_family = AF_INET6;
@@ -154,6 +185,7 @@ ACE_SOCK_SEQPACK_Acceptor::shared_open (const ACE_Addr &local_sap,
}
else
local_inet6_addr = *reinterpret_cast<sockaddr_in6 *> (local_sap.get_addr ());
+
// We probably don't need a bind_port written here.
// There are currently no supported OS's that define
// ACE_LACKS_WILDCARD_BIND.
@@ -170,6 +202,7 @@ ACE_SOCK_SEQPACK_Acceptor::shared_open (const ACE_Addr &local_sap,
ACE_OS::memset (reinterpret_cast<void *> (&local_inet_addr),
0,
sizeof local_inet_addr);
+
if (local_sap == ACE_Addr::sap_any)
{
local_inet_addr.sin_port = 0;
@@ -190,6 +223,7 @@ ACE_SOCK_SEQPACK_Acceptor::shared_open (const ACE_Addr &local_sap,
(sockaddr *) local_sap.get_addr (),
local_sap.get_size ()) == -1)
error = 1;
+
if (error != 0
|| ACE_OS::listen (this->get_handle (),
backlog) == -1)
@@ -197,9 +231,12 @@ ACE_SOCK_SEQPACK_Acceptor::shared_open (const ACE_Addr &local_sap,
error = 1;
this->close ();
}
+
return error ? -1 : 0;
}
+
// Multihomed version of same.
+
int
ACE_SOCK_SEQPACK_Acceptor::shared_open (const ACE_Multihomed_INET_Addr &local_sap,
int protocol_family,
@@ -207,15 +244,18 @@ ACE_SOCK_SEQPACK_Acceptor::shared_open (const ACE_Multihomed_INET_Addr &local_sa
{
ACE_TRACE ("ACE_SOCK_SEQPACK_Acceptor::shared_open");
int error = 0;
+
// TODO: Add multi-address support to IPV6
#if defined (ACE_HAS_IPV6)
ACE_ASSERT (protocol_family == PF_INET || protocol_family == PF_INET6);
+
if (protocol_family == PF_INET6)
{
sockaddr_in6 local_inet6_addr;
ACE_OS::memset (reinterpret_cast<void *> (&local_inet6_addr),
0,
sizeof local_inet6_addr);
+
if (local_sap.ACE_Addr::operator== (ACE_Addr::sap_any))
{
local_inet6_addr.sin6_family = AF_INET6;
@@ -224,6 +264,7 @@ ACE_SOCK_SEQPACK_Acceptor::shared_open (const ACE_Multihomed_INET_Addr &local_sa
}
else
local_inet6_addr = *reinterpret_cast<sockaddr_in6 *> (local_sap.get_addr ());
+
// We probably don't need a bind_port written here.
// There are currently no supported OS's that define
// ACE_LACKS_WILDCARD_BIND.
@@ -240,12 +281,14 @@ ACE_SOCK_SEQPACK_Acceptor::shared_open (const ACE_Multihomed_INET_Addr &local_sa
ACE_OS::memset (reinterpret_cast<void *> (&local_inet_addr),
0,
sizeof local_inet_addr);
+
if (local_sap.ACE_Addr::operator== (ACE_Addr::sap_any))
{
local_inet_addr.sin_port = 0;
}
else
local_inet_addr = *reinterpret_cast<sockaddr_in *> (local_sap.get_addr ());
+
// A port number of 0 means that the user is requesting that the
// operating system choose an arbitrary, unused port. Since some
// operating systems don't provide this service, ACE provides an
@@ -282,16 +325,19 @@ ACE_SOCK_SEQPACK_Acceptor::shared_open (const ACE_Multihomed_INET_Addr &local_sa
// the OpenSS7 and LKSCTP implmentations, which are available only on
// Linux. Linux has native support for the wildcard bind, so the
// following code works regardless of whether or not the port is 0.
+
{
// The total number of addresses is the number of secondary
// addresses plus one.
size_t num_addresses = local_sap.get_num_secondary_addresses() + 1;
+
// Create an array of sockaddr_in to hold the underlying
// representations of the primary and secondary
// addresses.
sockaddr_in* local_inet_addrs = 0;
ACE_NEW_NORETURN (local_inet_addrs,
sockaddr_in[num_addresses]);
+
if (!local_inet_addrs)
error = 1;
else
@@ -300,8 +346,11 @@ ACE_SOCK_SEQPACK_Acceptor::shared_open (const ACE_Multihomed_INET_Addr &local_sa
// on the Multihomed_INET_Addr
local_sap.get_addresses(local_inet_addrs,
num_addresses);
+
#if defined (ACE_HAS_LKSCTP)
+
sockaddr_in *local_sockaddr = 0;
+
// bind the primary first
if (ACE_OS::bind (this->get_handle (),
reinterpret_cast<sockaddr *> (&(local_inet_addrs[0])),
@@ -309,16 +358,19 @@ ACE_SOCK_SEQPACK_Acceptor::shared_open (const ACE_Multihomed_INET_Addr &local_sa
{
error = 1;
}
+
// do we need to bind multiple addresses?
if (num_addresses > 1)
{
ACE_NEW_NORETURN(local_sockaddr,
sockaddr_in[num_addresses - 1]);
+
// all of the secondary addresses need the local port set
for (size_t i = 1; i < num_addresses; i++)
{
local_inet_addrs[i].sin_port = local_inet_addrs[0].sin_port;
}
+
// copy only the sockaddrs that we need to bindx
for (size_t i = 0; i < num_addresses - 1; i++)
{
@@ -326,6 +378,7 @@ ACE_SOCK_SEQPACK_Acceptor::shared_open (const ACE_Multihomed_INET_Addr &local_sa
&(local_inet_addrs[i + 1]),
sizeof(sockaddr_in));
}
+
// now call bindx
if (!error && sctp_bindx(this->get_handle (),
reinterpret_cast<sockaddr *> (local_sockaddr),
@@ -334,6 +387,7 @@ ACE_SOCK_SEQPACK_Acceptor::shared_open (const ACE_Multihomed_INET_Addr &local_sa
{
error = 1;
}
+
delete [] local_sockaddr;
}
#else
@@ -345,6 +399,7 @@ ACE_SOCK_SEQPACK_Acceptor::shared_open (const ACE_Multihomed_INET_Addr &local_sa
error = 1;
#endif /* ACE_HAS_LKSCTP */
}
+
delete [] local_inet_addrs;
}
}
@@ -352,6 +407,7 @@ ACE_SOCK_SEQPACK_Acceptor::shared_open (const ACE_Multihomed_INET_Addr &local_sa
(sockaddr *) local_sap.get_addr (),
local_sap.get_size ()) == -1)
error = 1;
+
if (error != 0
|| ACE_OS::listen (this->get_handle (),
backlog) == -1)
@@ -359,8 +415,10 @@ ACE_SOCK_SEQPACK_Acceptor::shared_open (const ACE_Multihomed_INET_Addr &local_sa
error = 1;
this->close ();
}
+
return error ? -1 : 0;
}
+
int
ACE_SOCK_SEQPACK_Acceptor::open (const ACE_Addr &local_sap,
ACE_Protocol_Info *protocolinfo,
@@ -372,8 +430,10 @@ ACE_SOCK_SEQPACK_Acceptor::open (const ACE_Addr &local_sap,
int protocol)
{
ACE_TRACE ("ACE_SOCK_SEQPACK_Acceptor::open");
+
if (protocol_family == PF_UNSPEC)
protocol_family = local_sap.get_type ();
+
#if defined (ACE_HAS_LKSCTP)
if (ACE_SOCK::open (SOCK_STREAM,
#else
@@ -391,6 +451,7 @@ ACE_SOCK_SEQPACK_Acceptor::open (const ACE_Addr &local_sap,
protocol_family,
backlog);
}
+
ACE_SOCK_SEQPACK_Acceptor::ACE_SOCK_SEQPACK_Acceptor (const ACE_Addr &local_sap,
ACE_Protocol_Info *protocolinfo,
ACE_SOCK_GROUP g,
@@ -413,7 +474,9 @@ ACE_SOCK_SEQPACK_Acceptor::ACE_SOCK_SEQPACK_Acceptor (const ACE_Addr &local_sap,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_SOCK_SEQPACK_Acceptor")));
}
+
// General purpose routine for performing server ACE_SOCK creation.
+
int
ACE_SOCK_SEQPACK_Acceptor::open (const ACE_Addr &local_sap,
int reuse_addr,
@@ -422,6 +485,7 @@ ACE_SOCK_SEQPACK_Acceptor::open (const ACE_Addr &local_sap,
int protocol)
{
ACE_TRACE ("ACE_SOCK_SEQPACK_Acceptor::open");
+
if (local_sap != ACE_Addr::sap_any)
protocol_family = local_sap.get_type ();
else if (protocol_family == PF_UNSPEC)
@@ -432,6 +496,7 @@ ACE_SOCK_SEQPACK_Acceptor::open (const ACE_Addr &local_sap,
protocol_family = PF_INET;
#endif /* ACE_HAS_IPV6 */
}
+
#if defined (ACE_HAS_LKSCTP)
if (ACE_SOCK::open (SOCK_STREAM,
#else
@@ -446,7 +511,9 @@ ACE_SOCK_SEQPACK_Acceptor::open (const ACE_Addr &local_sap,
protocol_family,
backlog);
}
+
// Multihomed version of same.
+
int
ACE_SOCK_SEQPACK_Acceptor::open (const ACE_Multihomed_INET_Addr &local_sap,
int reuse_addr,
@@ -455,6 +522,7 @@ ACE_SOCK_SEQPACK_Acceptor::open (const ACE_Multihomed_INET_Addr &local_sap,
int protocol)
{
ACE_TRACE ("ACE_SOCK_SEQPACK_Acceptor::open");
+
if (local_sap.ACE_Addr::operator!= (ACE_Addr::sap_any))
protocol_family = local_sap.get_type ();
else if (protocol_family == PF_UNSPEC)
@@ -465,6 +533,7 @@ ACE_SOCK_SEQPACK_Acceptor::open (const ACE_Multihomed_INET_Addr &local_sap,
protocol_family = PF_INET;
#endif /* ACE_HAS_IPV6 */
}
+
#if defined (ACE_HAS_LKSCTP)
if (ACE_SOCK::open (SOCK_STREAM,
#else
@@ -479,7 +548,9 @@ ACE_SOCK_SEQPACK_Acceptor::open (const ACE_Multihomed_INET_Addr &local_sap,
protocol_family,
backlog);
}
+
// General purpose routine for performing server ACE_SOCK creation.
+
ACE_SOCK_SEQPACK_Acceptor::ACE_SOCK_SEQPACK_Acceptor (const ACE_Addr &local_sap,
int reuse_addr,
int protocol_family,
@@ -496,7 +567,9 @@ ACE_SOCK_SEQPACK_Acceptor::ACE_SOCK_SEQPACK_Acceptor (const ACE_Addr &local_sap,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_SOCK_SEQPACK_Acceptor")));
}
+
// Multihomed version of same.
+
ACE_SOCK_SEQPACK_Acceptor::ACE_SOCK_SEQPACK_Acceptor (const ACE_Multihomed_INET_Addr &local_sap,
int reuse_addr,
int protocol_family,
@@ -513,10 +586,12 @@ ACE_SOCK_SEQPACK_Acceptor::ACE_SOCK_SEQPACK_Acceptor (const ACE_Multihomed_INET_
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_SOCK_SEQPACK_Acceptor")));
}
+
int
ACE_SOCK_SEQPACK_Acceptor::close (void)
{
return ACE_SOCK::close ();
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/SOCK_SEQPACK_Acceptor.h b/dep/ACE_wrappers/ace/SOCK_SEQPACK_Acceptor.h
index 718d37860c5..2a524652f5b 100644
--- a/dep/ACE_wrappers/ace/SOCK_SEQPACK_Acceptor.h
+++ b/dep/ACE_wrappers/ace/SOCK_SEQPACK_Acceptor.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file SOCK_SEQPACK_Acceptor.h
@@ -11,17 +12,25 @@
*
*/
//=============================================================================
+
#ifndef ACE_SOCK_SEQ_ACCEPTOR_H
#define ACE_SOCK_SEQ_ACCEPTOR_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/SOCK_SEQPACK_Association.h"
#include "ace/Multihomed_INET_Addr.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Time_Value;
+
/**
* @class ACE_SOCK_SEQPACK_Acceptor
*
@@ -39,6 +48,7 @@ public:
// = Initialization and termination methods.
/// Default constructor.
ACE_SOCK_SEQPACK_Acceptor (void);
+
/**
* Initialize a passive-mode BSD-style acceptor socket (no QoS).
* @a local_sap is the address that we're going to listen for
@@ -50,12 +60,15 @@ public:
int protocol_family = PF_UNSPEC,
int backlog = ACE_DEFAULT_BACKLOG,
int protocol = 132);
+
/// Multihomed version of same
+
ACE_SOCK_SEQPACK_Acceptor (const ACE_Multihomed_INET_Addr &local_sap,
int reuse_addr = 0,
int protocol_family = PF_UNSPEC,
int backlog = ACE_DEFAULT_BACKLOG,
int protocol = 132);
+
/// Initialize a passive-mode QoS-enabled acceptor socket. Returns 0
/// on success and -1 on failure.
ACE_SOCK_SEQPACK_Acceptor (const ACE_Addr &local_sap,
@@ -67,6 +80,7 @@ public:
int backlog = ACE_DEFAULT_BACKLOG,
int protocol = 132);
+
/**
* Initialize a passive-mode BSD-style acceptor socket (no QoS).
* @a local_sap is the address that we're going to listen for
@@ -79,13 +93,16 @@ public:
int protocol_family = PF_UNSPEC,
int backlog = ACE_DEFAULT_BACKLOG,
int protocol = 132);
+
/// Multihomed version of same
+
int open (const ACE_Multihomed_INET_Addr &local_sap,
int reuse_addr = 0,
int protocol_family = PF_UNSPEC,
int backlog = ACE_DEFAULT_BACKLOG,
int protocol = 132);
+
/// Initialize a passive-mode QoS-enabled acceptor socket. Returns 0
/// on success and -1 on failure.
int open (const ACE_Addr &local_sap,
@@ -96,10 +113,13 @@ public:
int protocol_family = PF_UNSPEC,
int backlog = ACE_DEFAULT_BACKLOG,
int protocol = 132);
+
/// Close the socket. Returns 0 on success and -1 on failure.
int close (void);
+
/// Default dtor.
~ACE_SOCK_SEQPACK_Acceptor (void);
+
// = Passive connection <accept> methods.
/**
* Accept a new ACE_SOCK_SEQPACK_Association connection. A @a timeout of 0
@@ -115,24 +135,30 @@ public:
ACE_Time_Value *timeout = 0,
int restart = 1,
int reset_new_handle = 0) const;
+
// = Meta-type info
typedef ACE_Multihomed_INET_Addr PEER_ADDR;
typedef ACE_SOCK_SEQPACK_Association PEER_STREAM;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
/// Perform operations that must occur before <ACE_OS::accept> is
/// called.
int shared_accept_start (ACE_Time_Value *timeout,
int restart,
int &in_blocking_mode) const;
+
/// Perform operations that must occur after <ACE_OS::accept> is
/// called.
int shared_accept_finish (ACE_SOCK_SEQPACK_Association new_association,
int in_blocking_mode,
int reset_new_handle) const;
+
/**
* This method factors out the common <open> code and is called by
* both the QoS-enabled <open> method and the BSD-style <open>
@@ -141,18 +167,25 @@ protected:
int shared_open (const ACE_Addr &local_sap,
int protocol_family,
int backlog);
+
/// Multihomed version of same.
+
int shared_open (const ACE_Multihomed_INET_Addr &local_sap,
int protocol_family,
int backlog);
+
private:
/// Do not allow this function to percolate up to this interface...
int get_remote_addr (ACE_Addr &) const;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/SOCK_SEQPACK_Acceptor.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_SOCK_SEQ_ACCEPTOR_H */
diff --git a/dep/ACE_wrappers/ace/SOCK_SEQPACK_Acceptor.inl b/dep/ACE_wrappers/ace/SOCK_SEQPACK_Acceptor.inl
index 908253b52a1..00bfe399df3 100644
--- a/dep/ACE_wrappers/ace/SOCK_SEQPACK_Acceptor.inl
+++ b/dep/ACE_wrappers/ace/SOCK_SEQPACK_Acceptor.inl
@@ -1,10 +1,13 @@
// -*- C++ -*-
//
// $Id: SOCK_SEQPACK_Acceptor.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_SOCK_SEQPACK_Acceptor::~ACE_SOCK_SEQPACK_Acceptor (void)
{
ACE_TRACE ("ACE_SOCK_SEQPACK_Acceptor::~ACE_SOCK_SEQPACK_Acceptor");
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/SOCK_SEQPACK_Association.cpp b/dep/ACE_wrappers/ace/SOCK_SEQPACK_Association.cpp
index ce0c3b2ffad..13938988826 100644
--- a/dep/ACE_wrappers/ace/SOCK_SEQPACK_Association.cpp
+++ b/dep/ACE_wrappers/ace/SOCK_SEQPACK_Association.cpp
@@ -1,15 +1,22 @@
// $Id: SOCK_SEQPACK_Association.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/SOCK_SEQPACK_Association.h"
+
#include "ace/Auto_Ptr.h"
#include "ace/Log_Msg.h"
#include "ace/OS_Memory.h"
#include "ace/OS_NS_string.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/SOCK_SEQPACK_Association.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace, SOCK_SEQPACK_Association, "$Id: SOCK_SEQPACK_Association.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_SOCK_SEQPACK_Association)
+
void
ACE_SOCK_SEQPACK_Association::dump (void) const
{
@@ -17,6 +24,7 @@ ACE_SOCK_SEQPACK_Association::dump (void) const
ACE_TRACE ("ACE_SOCK_SEQPACK_Association::dump");
#endif /* ACE_HAS_DUMP */
}
+
int
ACE_SOCK_SEQPACK_Association::close (void)
{
@@ -32,6 +40,7 @@ ACE_SOCK_SEQPACK_Association::close (void)
// Close down the socket.
return ACE_SOCK::close ();
}
+
// Developed according to the API discussed in 7.1.4 of
// draft-ietf-tsvwg-sctpsocket-09.txt to abruptly free a transport
// transport association's resources.
@@ -43,8 +52,10 @@ ACE_SOCK_SEQPACK_Association::abort (void)
// Normal close then aborts the association.
//
linger slinger;
+
slinger.l_onoff = 1;
slinger.l_linger = 0;
+
if (-1 == ACE_OS::setsockopt (this->get_handle (),
SOL_SOCKET,
SO_LINGER,
@@ -53,12 +64,15 @@ ACE_SOCK_SEQPACK_Association::abort (void)
{
return -1;
}
+
return this->close ();
}
+
int
ACE_SOCK_SEQPACK_Association::get_local_addrs (ACE_INET_Addr *addrs, size_t &size) const
{
ACE_TRACE ("ACE_SOCK_SEQPACK_Association::get_local_addrs");
+
#if defined (ACE_HAS_LKSCTP)
/*
The size of ACE_INET_Addr must be large enough to hold the number of
@@ -66,18 +80,22 @@ ACE_SOCK_SEQPACK_Association::get_local_addrs (ACE_INET_Addr *addrs, size_t &siz
will only return the number of addresses that will fit. If the array is
too large, the 'size' parameter will be modified to indicate the number
of addrs.
+
We will call sctp_getladdrs() which accepts 3 parameters
1. a socket fd
2. a sctp association_id which will be ignored since we are using
tcp sockets
3. a pointer to sockaddr
+
lksctp/draft will allocate memory and we are responsible for freeing
it by calling sctp_freeladdrs().
*/
+
sockaddr_in *si = 0;
sockaddr *laddrs = 0;
int err = 0;
size_t len = 0;
+
err = sctp_getladdrs(this->get_handle(), 0, &laddrs);
if (err > 0)
{
@@ -90,11 +108,13 @@ ACE_SOCK_SEQPACK_Association::get_local_addrs (ACE_INET_Addr *addrs, size_t &siz
// few that fit
len = size;
}
+
for (size_t i = 0; i < len; i++)
{
// first we cast the sockaddr to sockaddr_in
// since we only support ipv4 at this time.
si = (sockaddr_in *) (&(laddrs[i]));
+
// now we fillup the ace_inet_addr array
addrs[i].set_addr(si, sizeof(sockaddr_in));
addrs[i].set_type(si->sin_family);
@@ -106,25 +126,34 @@ ACE_SOCK_SEQPACK_Association::get_local_addrs (ACE_INET_Addr *addrs, size_t &siz
// sctp_getladdrs will return -1 on error
return -1;
}
+
// indicate the num of addrs returned to the calling function
size = len;
+
// make sure we free the struct using the system function
sctp_freeladdrs(laddrs);
+
#else
+
/*
We will be calling ACE_OS::getsockname, which accepts (and
potentially modifies) two reference parameters:
+
1. a sockaddr_in* that points to a buffer
2. an int* that points to the size of this buffer
+
The OpenSS7 implementation of SCTP copies an array of ipv4
sockaddr_in into the buffer. Then, if the size of the buffer is
greater than the size used, the size parameter is reduced
accordingly.
+
*/
+
// The array of sockaddr_in will be stored in an ACE_Auto_Array_Ptr,
// which causes dynamically-allocated memory to be released as soon
// as the ACE_Auto_Array_Ptr goes out of scope.
ACE_Auto_Array_Ptr<sockaddr_in> addr_structs;
+
// Allocate memory for this array. Return -1 if the memory cannot
// be allocated. (This activity requires a temporary variable---a
// bare sockaddr_in* --- because ACE_NEW_RETURN cannot act directory on
@@ -134,13 +163,16 @@ ACE_SOCK_SEQPACK_Association::get_local_addrs (ACE_INET_Addr *addrs, size_t &siz
ACE_NEW_RETURN (addr_structs_bootstrap, sockaddr_in[size], -1);
addr_structs.reset(addr_structs_bootstrap);
}
+
// Physical size of this array is its logical size multiplied by
// the physical size of one of its elements.
size_t physical_size = size * sizeof(sockaddr_in);
+
/* Clear the array */
ACE_OS::memset(addr_structs.get(),
0,
physical_size);
+
/*
** Populate the array with real values from the getsockname system
** call. addr_structs is modified, and name_size is modified to contain
@@ -152,9 +184,11 @@ ACE_SOCK_SEQPACK_Association::get_local_addrs (ACE_INET_Addr *addrs, size_t &siz
reinterpret_cast<sockaddr *> (addr_structs.get()),
&name_size) == -1)
return -1;
+
/* Calculate the NEW physical size of the array */
name_size /= sizeof (sockaddr_in);
size = static_cast<size_t> (name_size);
+
/* Copy each sockaddr_in to the address structure of an ACE_Addr from
the passed-in array */
const int addrlen (static_cast<int> (sizeof (sockaddr_in)));
@@ -168,6 +202,7 @@ ACE_SOCK_SEQPACK_Association::get_local_addrs (ACE_INET_Addr *addrs, size_t &siz
return 0;
}
+
int
ACE_SOCK_SEQPACK_Association::get_remote_addrs (ACE_INET_Addr *addrs, size_t &size) const
{
@@ -179,18 +214,22 @@ ACE_SOCK_SEQPACK_Association::get_remote_addrs (ACE_INET_Addr *addrs, size_t &si
function will only return the number of addresses that will fit. If the
array is too large, the 'size' parameter will be modified to indicate
the number of addrs.
+
We will call sctp_getpaddrs() which accepts 3 parameters
1. a socket fd
2. a sctp association_id which will be ignored since we are using
tcp sockets
3. a pointer to a sockaddr
+
lksctp/draft will allocate memory and we are responsible for freeing
it by calling sctp_freepaddrs().
*/
+
sockaddr_in *si = 0;
sockaddr *paddrs = 0;
int err = 0;
size_t len = 0;
+
err = sctp_getpaddrs(this->get_handle(), 0, &paddrs);
if (err > 0)
{
@@ -203,11 +242,13 @@ ACE_SOCK_SEQPACK_Association::get_remote_addrs (ACE_INET_Addr *addrs, size_t &si
// few that fit
len = size;
}
+
for (size_t i = 0; i < len; i++)
{
// first we cast the sockaddr to sockaddr_in
// since we only support ipv4 at this time.
si = (sockaddr_in *) (&(paddrs[i]));
+
// now we fillup the ace_inet_addr array
addrs[i].set_addr(si, sizeof(sockaddr_in));
addrs[i].set_type(si->sin_family);
@@ -219,25 +260,34 @@ ACE_SOCK_SEQPACK_Association::get_remote_addrs (ACE_INET_Addr *addrs, size_t &si
// sctp_getpaddrs will return -1 on error
return -1;
}
+
// indicate the num of addrs returned to the calling function
size = len;
+
// make sure we free the struct using the system function
sctp_freepaddrs(paddrs);
+
#else
+
/*
We will be calling ACE_OS::getpeername, which accepts (and
potentially modifies) two reference parameters:
+
1. a sockaddr_in* that points to a buffer
2. an int* that points to the size of this buffer
+
The OpenSS7 implementation of SCTP copies an array of ipv4
sockaddr_in into the buffer. Then, if the size of the buffer is
greater than the size used, the size parameter is reduced
accordingly.
+
*/
+
// The array of sockaddr_in will be stored in an ACE_Auto_Array_Ptr,
// which causes dynamically-allocated memory to be released as soon
// as the ACE_Auto_Array_Ptr goes out of scope.
ACE_Auto_Array_Ptr<sockaddr_in> addr_structs;
+
// Allocate memory for this array. Return -1 if the memory cannot
// be allocated. (This activity requires a temporary variable---a
// bare sockaddr_in* --- because ACE_NEW_RETURN cannot act directory on
@@ -247,13 +297,16 @@ ACE_SOCK_SEQPACK_Association::get_remote_addrs (ACE_INET_Addr *addrs, size_t &si
ACE_NEW_RETURN (addr_structs_bootstrap, sockaddr_in[size], -1);
addr_structs.reset(addr_structs_bootstrap);
}
+
// Physical size of this array is its logical size multiplied by
// the physical size of one of its elements.
size_t physical_size = size * sizeof(sockaddr_in);
+
/* Clear the array */
ACE_OS::memset(addr_structs.get(),
0,
physical_size);
+
/*
** Populate the array with real values from the getpeername system
** call. addr_structs is modified, and name_size is modified to contain
@@ -265,9 +318,11 @@ ACE_SOCK_SEQPACK_Association::get_remote_addrs (ACE_INET_Addr *addrs, size_t &si
reinterpret_cast<sockaddr *> (addr_structs.get()),
&name_size) == -1)
return -1;
+
/* Calculate the NEW physical size of the array */
name_size /= sizeof (sockaddr_in);
size = static_cast<size_t> (name_size);
+
/* Copy each sockaddr_in to the address structure of an ACE_Addr from
the passed-in array */
const int addrlen (static_cast<int> (sizeof (sockaddr_in)));
@@ -280,5 +335,6 @@ ACE_SOCK_SEQPACK_Association::get_remote_addrs (ACE_INET_Addr *addrs, size_t &si
#endif /* ACE_HAS_LKSCTP */
return 0;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/SOCK_SEQPACK_Association.h b/dep/ACE_wrappers/ace/SOCK_SEQPACK_Association.h
index ff54c47db66..76cb3527a13 100644
--- a/dep/ACE_wrappers/ace/SOCK_SEQPACK_Association.h
+++ b/dep/ACE_wrappers/ace/SOCK_SEQPACK_Association.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
*
@@ -13,18 +14,26 @@
*
*/
//=============================================================================
+
#ifndef ACE_SOCK_SEQPACK_ASSOCIATION_H
#define ACE_SOCK_SEQPACK_ASSOCIATION_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/SOCK_IO.h"
#include "ace/Multihomed_INET_Addr.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward declarations.
class ACE_Message_Block;
+
/**
* @class ACE_SOCK_SEQPACK_Association
*
@@ -72,10 +81,13 @@ public:
// Initialization and termination methods.
/// Constructor.
ACE_SOCK_SEQPACK_Association (void);
+
/// Constructor (sets the underlying ACE_HANDLE with <h>).
ACE_SOCK_SEQPACK_Association (ACE_HANDLE h);
+
/// Destructor.
~ACE_SOCK_SEQPACK_Association (void);
+
/**
* Return local endpoint addresses in the referenced array of
* ACE_INET_Addr, which should have the specified @a size. If the
@@ -84,6 +96,7 @@ public:
* returns 0, otherwise returns -1.
*/
int get_local_addrs (ACE_INET_Addr *addrs, size_t &size) const;
+
/**
* Return remote endpoint addresses in the referenced array of
* ACE_INET_Addr, which should have the specified @a size. If the
@@ -92,78 +105,99 @@ public:
* returns 0, otherwise returns -1.
*/
int get_remote_addrs (ACE_INET_Addr *addrs, size_t &size) const;
+
// = I/O functions.
+
/// Try to recv exactly @a len bytes into @a buf from the connected socket.
ssize_t recv_n (void *buf,
size_t len,
int flags,
const ACE_Time_Value *timeout = 0,
size_t *bytes_transferred = 0) const;
+
/// Try to recv exactly @a len bytes into @a buf from the connected socket.
ssize_t recv_n (void *buf,
size_t len,
const ACE_Time_Value *timeout = 0,
size_t *bytes_transferred = 0) const;
+
/// Receive an <iovec> of size <iovcnt> from the connected socket.
ssize_t recvv_n (iovec iov[],
int iovcnt,
const ACE_Time_Value *timeout = 0,
size_t *bytes_transferred = 0) const;
+
/// Try to send exactly @a len bytes from @a buf to the connection socket.
ssize_t send_n (const void *buf,
size_t len,
int flags,
const ACE_Time_Value *timeout = 0,
size_t *bytes_transferred = 0) const;
+
/// Try to send exactly @a len bytes from @a buf to the connected socket.
ssize_t send_n (const void *buf,
size_t len,
const ACE_Time_Value *timeout = 0,
size_t *bytes_transferred = 0) const;
+
/// Send all the @a message_blocks chained through their <next> and
/// <cont> pointers. This call uses the underlying OS gather-write
/// operation to reduce the domain-crossing penalty.
ssize_t send_n (const ACE_Message_Block *message_block,
const ACE_Time_Value *timeout = 0,
size_t *bytes_transferred = 0) const;
+
/// Send an <iovec> of size <iovcnt> to the connected socket.
ssize_t sendv_n (const iovec iov[],
int iovcnt,
const ACE_Time_Value *timeout = 0,
size_t *bytes_transferred = 0) const;
+
// = Send/receive ``urgent'' data (see TCP specs...).
ssize_t send_urg (const void *ptr,
size_t len = sizeof (char),
const ACE_Time_Value *timeout = 0) const;
+
ssize_t recv_urg (void *ptr,
size_t len = sizeof (char),
const ACE_Time_Value *timeout = 0) const;
+
// = Selectively close endpoints.
/// Close down the reader.
int close_reader (void);
+
/// Close down the writer.
int close_writer (void);
+
/**
* Close down the socket (we need this to make things work correctly
* on Win32, which requires use to do a <close_writer> before doing
* the close to avoid losing data). */
int close (void);
+
/**
* Abort the association according to RFC 2960 9.1 through the API
* in draft-ietf-tsvwg-sctpsocket-09 7.1.4.
*/
int abort (void);
+
// = Meta-type info
typedef ACE_Multihomed_INET_Addr PEER_ADDR;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/SOCK_SEQPACK_Association.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_SOCK_SEQPACK_ASSOCIATION_H */
diff --git a/dep/ACE_wrappers/ace/SOCK_SEQPACK_Association.inl b/dep/ACE_wrappers/ace/SOCK_SEQPACK_Association.inl
index 3c63133700b..2aed02d0282 100644
--- a/dep/ACE_wrappers/ace/SOCK_SEQPACK_Association.inl
+++ b/dep/ACE_wrappers/ace/SOCK_SEQPACK_Association.inl
@@ -1,25 +1,31 @@
// -*- C++ -*-
//
// $Id: SOCK_SEQPACK_Association.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/SOCK_SEQPACK_Association.h"
#include "ace/OS_NS_sys_socket.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_SOCK_SEQPACK_Association::ACE_SOCK_SEQPACK_Association (void)
{
// ACE_TRACE ("ACE_SOCK_SEQPACK_Association::ACE_SOCK_SEQPACK_Association");
}
+
ACE_INLINE
ACE_SOCK_SEQPACK_Association::ACE_SOCK_SEQPACK_Association (ACE_HANDLE h)
{
// ACE_TRACE ("ACE_SOCK_SEQPACK_Association::ACE_SOCK_SEQPACK_Association");
this->set_handle (h);
}
+
ACE_INLINE
ACE_SOCK_SEQPACK_Association::~ACE_SOCK_SEQPACK_Association (void)
{
// ACE_TRACE ("ACE_SOCK_SEQPACK_Association::~ACE_SOCK_SEQPACK_Association");
}
+
ACE_INLINE int
ACE_SOCK_SEQPACK_Association::close_reader (void)
{
@@ -29,7 +35,9 @@ ACE_SOCK_SEQPACK_Association::close_reader (void)
else
return 0;
}
+
// Shut down just the writing end of a ACE_SOCK.
+
ACE_INLINE int
ACE_SOCK_SEQPACK_Association::close_writer (void)
{
@@ -39,6 +47,7 @@ ACE_SOCK_SEQPACK_Association::close_writer (void)
else
return 0;
}
+
ACE_INLINE ssize_t
ACE_SOCK_SEQPACK_Association::recv_n (void *buf,
size_t len,
@@ -54,6 +63,7 @@ ACE_SOCK_SEQPACK_Association::recv_n (void *buf,
timeout,
bytes_transferred);
}
+
ACE_INLINE ssize_t
ACE_SOCK_SEQPACK_Association::recv_n (void *buf,
size_t len,
@@ -67,6 +77,7 @@ ACE_SOCK_SEQPACK_Association::recv_n (void *buf,
timeout,
bytes_transferred);
}
+
ACE_INLINE ssize_t
ACE_SOCK_SEQPACK_Association::recvv_n (iovec iov[],
int n,
@@ -80,6 +91,7 @@ ACE_SOCK_SEQPACK_Association::recvv_n (iovec iov[],
timeout,
bytes_transferred);
}
+
ACE_INLINE ssize_t
ACE_SOCK_SEQPACK_Association::send_n (const void *buf,
size_t len,
@@ -95,6 +107,7 @@ ACE_SOCK_SEQPACK_Association::send_n (const void *buf,
timeout,
bytes_transferred);
}
+
ACE_INLINE ssize_t
ACE_SOCK_SEQPACK_Association::send_n (const void *buf,
size_t len,
@@ -108,6 +121,7 @@ ACE_SOCK_SEQPACK_Association::send_n (const void *buf,
timeout,
bytes_transferred);
}
+
ACE_INLINE ssize_t
ACE_SOCK_SEQPACK_Association::sendv_n (const iovec iov[],
int n,
@@ -121,6 +135,7 @@ ACE_SOCK_SEQPACK_Association::sendv_n (const iovec iov[],
timeout,
bytes_transferred);
}
+
ACE_INLINE ssize_t
ACE_SOCK_SEQPACK_Association::send_n (const ACE_Message_Block *message_block,
const ACE_Time_Value *timeout,
@@ -132,6 +147,7 @@ ACE_SOCK_SEQPACK_Association::send_n (const ACE_Message_Block *message_block,
timeout,
bytes_transferred);
}
+
ACE_INLINE ssize_t
ACE_SOCK_SEQPACK_Association::send_urg (const void *ptr,
size_t len,
@@ -144,6 +160,7 @@ ACE_SOCK_SEQPACK_Association::send_urg (const void *ptr,
MSG_OOB,
timeout);
}
+
ACE_INLINE ssize_t
ACE_SOCK_SEQPACK_Association::recv_urg (void *ptr,
size_t len,
@@ -156,4 +173,5 @@ ACE_SOCK_SEQPACK_Association::recv_urg (void *ptr,
MSG_OOB,
timeout);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/SOCK_SEQPACK_Connector.cpp b/dep/ACE_wrappers/ace/SOCK_SEQPACK_Connector.cpp
index c4516941be7..3b6adfd7755 100644
--- a/dep/ACE_wrappers/ace/SOCK_SEQPACK_Connector.cpp
+++ b/dep/ACE_wrappers/ace/SOCK_SEQPACK_Connector.cpp
@@ -1,5 +1,7 @@
// $Id: SOCK_SEQPACK_Connector.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/SOCK_SEQPACK_Connector.h"
+
#include "ace/INET_Addr.h"
#include "ace/Log_Msg.h"
#include "ace/Time_Value.h"
@@ -7,15 +9,21 @@
#include "ace/OS_NS_string.h"
#include "ace/OS_NS_sys_socket.h"
#include "ace/os_include/os_fcntl.h"
+
#if defined (ACE_WIN32)
#include "ace/OS_NS_unistd.h"
#endif /* ACE_WIN32 */
+
#if !defined (__ACE_INLINE__)
#include "ace/SOCK_SEQPACK_Connector.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace, SOCK_SEQPACK_Connector, "SOCK_SEQPACK_Connector.cpp,v 4.35 2002/03/08 23:18:09 spark Exp")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_SOCK_SEQPACK_Connector)
+
void
ACE_SOCK_SEQPACK_Connector::dump (void) const
{
@@ -23,6 +31,7 @@ ACE_SOCK_SEQPACK_Connector::dump (void) const
ACE_TRACE ("ACE_SOCK_SEQPACK_Connector::dump");
#endif /* ACE_HAS_DUMP */
}
+
int
ACE_SOCK_SEQPACK_Connector::shared_open (ACE_SOCK_SEQPACK_Association &new_association,
int protocol_family,
@@ -31,6 +40,8 @@ ACE_SOCK_SEQPACK_Connector::shared_open (ACE_SOCK_SEQPACK_Association &new_assoc
{
ACE_TRACE ("ACE_SOCK_SEQPACK_Connector::shared_open");
+
+
// Only open a new socket if we don't already have a valid handle.
if (new_association.get_handle () == ACE_INVALID_HANDLE &&
#if defined (ACE_HAS_LKSCTP)
@@ -45,6 +56,7 @@ ACE_SOCK_SEQPACK_Connector::shared_open (ACE_SOCK_SEQPACK_Association &new_assoc
else
return 0;
}
+
int
ACE_SOCK_SEQPACK_Connector::shared_open (ACE_SOCK_SEQPACK_Association &new_association,
int protocol_family,
@@ -55,6 +67,7 @@ ACE_SOCK_SEQPACK_Connector::shared_open (ACE_SOCK_SEQPACK_Association &new_assoc
int reuse_addr)
{
ACE_TRACE ("ACE_SOCK_SEQPACK_Connector::shared_open");
+
// Only open a new socket if we don't already have a valid handle.
if (new_association.get_handle () == ACE_INVALID_HANDLE &&
#if defined (ACE_HAS_LKSCTP)
@@ -72,16 +85,19 @@ ACE_SOCK_SEQPACK_Connector::shared_open (ACE_SOCK_SEQPACK_Association &new_assoc
else
return 0;
}
+
int
ACE_SOCK_SEQPACK_Connector::shared_connect_start (ACE_SOCK_SEQPACK_Association &new_association,
const ACE_Time_Value *timeout,
const ACE_Addr &local_sap)
{
ACE_TRACE ("ACE_SOCK_SEQPACK_Connector::shared_connect_start");
+
if (local_sap != ACE_Addr::sap_any)
{
sockaddr *laddr = reinterpret_cast<sockaddr *> (local_sap.get_addr ());
int size = local_sap.get_size ();
+
if (ACE_OS::bind (new_association.get_handle (),
laddr,
size) == -1)
@@ -92,6 +108,7 @@ ACE_SOCK_SEQPACK_Connector::shared_connect_start (ACE_SOCK_SEQPACK_Association &
return -1;
}
}
+
// Enable non-blocking, if required.
if (timeout != 0
&& new_association.enable (ACE_NONBLOCK) == -1)
@@ -99,6 +116,7 @@ ACE_SOCK_SEQPACK_Connector::shared_connect_start (ACE_SOCK_SEQPACK_Association &
else
return 0;
}
+
// Multihomed version of same
int
ACE_SOCK_SEQPACK_Connector::shared_connect_start (ACE_SOCK_SEQPACK_Association &new_association,
@@ -106,11 +124,13 @@ ACE_SOCK_SEQPACK_Connector::shared_connect_start (ACE_SOCK_SEQPACK_Association &
const ACE_Multihomed_INET_Addr &local_sap)
{
ACE_TRACE ("ACE_SOCK_SEQPACK_Connector::shared_connect_start");
+
if (local_sap.ACE_Addr::operator!= (ACE_Addr::sap_any))
{
// The total number of addresses is the number of secondary
// addresses plus one.
size_t num_addresses = local_sap.get_num_secondary_addresses() + 1;
+
// Create an array of sockaddr_in to hold the underlying
// representations of the primary and secondary
// addresses.
@@ -118,13 +138,16 @@ ACE_SOCK_SEQPACK_Connector::shared_connect_start (ACE_SOCK_SEQPACK_Association &
ACE_NEW_NORETURN (local_inet_addrs, sockaddr_in[num_addresses]);
if (!local_inet_addrs)
return -1;
+
// Populate the array by invoking the get_addresses method on
// the Multihomed_INET_Addr
local_sap.get_addresses(local_inet_addrs, num_addresses);
+
#if defined (ACE_HAS_LKSCTP)
sockaddr_in *local_sockaddr = 0;
sockaddr_in portst;
int sn = sizeof(sockaddr);
+
// bind to the primary addr first
if (ACE_OS::bind(new_association.get_handle (),
reinterpret_cast<sockaddr *> (&(local_inet_addrs[0])),
@@ -134,12 +157,14 @@ ACE_SOCK_SEQPACK_Connector::shared_connect_start (ACE_SOCK_SEQPACK_Association &
new_association.close ();
return -1;
}
+
// do we need to bind multiple addrs
if (num_addresses > 1)
{
// allocate enough memory to hold the number of secondary addrs
ACE_NEW_NORETURN(local_sockaddr,
sockaddr_in[num_addresses - 1]);
+
// get sockaddr_in for the local handle
if (ACE_OS::getsockname(new_association.get_handle (),
reinterpret_cast<sockaddr *> (&portst),
@@ -149,11 +174,13 @@ ACE_SOCK_SEQPACK_Connector::shared_connect_start (ACE_SOCK_SEQPACK_Association &
new_association.close ();
return -1;
}
+
// set the local port # assigned by the os to every secondary addr
for (size_t i = 1; i < num_addresses; i++)
{
local_inet_addrs[i].sin_port = portst.sin_port;
}
+
// copy all of the secondary addrs into a sockaddr structure
for (size_t i = 0; i < num_addresses - 1; i++)
{
@@ -161,6 +188,7 @@ ACE_SOCK_SEQPACK_Connector::shared_connect_start (ACE_SOCK_SEQPACK_Association &
&(local_inet_addrs[i + 1]),
sizeof(sockaddr_in));
}
+
// bind other ifaces
if (sctp_bindx(new_association.get_handle(),
reinterpret_cast<sockaddr *> (local_sockaddr),
@@ -171,9 +199,11 @@ ACE_SOCK_SEQPACK_Connector::shared_connect_start (ACE_SOCK_SEQPACK_Association &
new_association.close ();
return -1;
}
+
delete [] local_sockaddr;
}
#else
+
// Call bind
size_t name_len = (sizeof (sockaddr_in)) * num_addresses;
if (ACE_OS::bind (new_association.get_handle (),
@@ -186,8 +216,10 @@ ACE_SOCK_SEQPACK_Connector::shared_connect_start (ACE_SOCK_SEQPACK_Association &
return -1;
}
#endif /* ACE_HAS_LKSCTP */
+
delete [] local_inet_addrs;
}
+
// Enable non-blocking, if required.
if (timeout != 0
&& new_association.enable (ACE_NONBLOCK) == -1)
@@ -195,6 +227,7 @@ ACE_SOCK_SEQPACK_Connector::shared_connect_start (ACE_SOCK_SEQPACK_Association &
else
return 0;
}
+
int
ACE_SOCK_SEQPACK_Connector::shared_connect_finish (ACE_SOCK_SEQPACK_Association &new_association,
const ACE_Time_Value *timeout,
@@ -203,6 +236,7 @@ ACE_SOCK_SEQPACK_Connector::shared_connect_finish (ACE_SOCK_SEQPACK_Association
ACE_TRACE ("ACE_SOCK_SEQPACK_Connector::shared_connect_finish");
// Save/restore errno.
ACE_Errno_Guard error (errno);
+
if (result == -1 && timeout != 0)
{
// Check whether the connection is in progress.
@@ -221,6 +255,7 @@ ACE_SOCK_SEQPACK_Connector::shared_connect_finish (ACE_SOCK_SEQPACK_Association
return 0;
}
}
+
// EISCONN is treated specially since this routine may be used to
// check if we are already connected.
if (result != -1 || error == EISCONN)
@@ -228,10 +263,13 @@ ACE_SOCK_SEQPACK_Connector::shared_connect_finish (ACE_SOCK_SEQPACK_Association
new_association.disable (ACE_NONBLOCK);
else if (!(error == EWOULDBLOCK || error == ETIMEDOUT))
new_association.close ();
+
return result;
}
+
// Actively connect and produce a new ACE_SOCK_SEQPACK_Association if things go well...
+
int
ACE_SOCK_SEQPACK_Connector::connect (ACE_SOCK_SEQPACK_Association &new_association,
const ACE_Addr &remote_sap,
@@ -243,6 +281,7 @@ ACE_SOCK_SEQPACK_Connector::connect (ACE_SOCK_SEQPACK_Association &new_associati
int protocol)
{
ACE_TRACE ("ACE_SOCK_SEQPACK_Connector::connect");
+
if (this->shared_open (new_association,
remote_sap.get_type (),
protocol,
@@ -252,13 +291,16 @@ ACE_SOCK_SEQPACK_Connector::connect (ACE_SOCK_SEQPACK_Association &new_associati
timeout,
local_sap) == -1)
return -1;
+
int result = ACE_OS::connect (new_association.get_handle (),
reinterpret_cast<sockaddr *> (remote_sap.get_addr ()),
remote_sap.get_size ());
+
return this->shared_connect_finish (new_association,
timeout,
result);
}
+
// Multihomed version of same
int
ACE_SOCK_SEQPACK_Connector::connect (ACE_SOCK_SEQPACK_Association &new_association,
@@ -271,6 +313,7 @@ ACE_SOCK_SEQPACK_Connector::connect (ACE_SOCK_SEQPACK_Association &new_associati
int protocol)
{
ACE_TRACE ("ACE_SOCK_SEQPACK_Connector::connect");
+
if (this->shared_open (new_association,
remote_sap.get_type (),
protocol,
@@ -280,14 +323,18 @@ ACE_SOCK_SEQPACK_Connector::connect (ACE_SOCK_SEQPACK_Association &new_associati
timeout,
local_sap) == -1)
return -1;
+
int result = ACE_OS::connect (new_association.get_handle (),
reinterpret_cast<sockaddr *> (remote_sap.get_addr ()),
remote_sap.get_size ());
+
return this->shared_connect_finish (new_association,
timeout,
result);
}
+
// Try to complete a non-blocking connection.
+
int
ACE_SOCK_SEQPACK_Connector::complete (ACE_SOCK_SEQPACK_Association &new_association,
ACE_Addr *remote_sap,
@@ -319,6 +366,7 @@ ACE_SOCK_SEQPACK_Connector::complete (ACE_SOCK_SEQPACK_Association &new_associat
}
#endif /* ACE_WIN32 */
}
+
if (remote_sap != 0)
{
int len = remote_sap->get_size ();
@@ -333,10 +381,12 @@ ACE_SOCK_SEQPACK_Connector::complete (ACE_SOCK_SEQPACK_Association &new_associat
return -1;
}
}
+
// Start out with non-blocking disabled on the <new_association>.
new_association.disable (ACE_NONBLOCK);
return 0;
}
+
ACE_SOCK_SEQPACK_Connector::ACE_SOCK_SEQPACK_Connector (ACE_SOCK_SEQPACK_Association &new_association,
const ACE_Addr &remote_sap,
const ACE_Time_Value *timeout,
@@ -347,6 +397,7 @@ ACE_SOCK_SEQPACK_Connector::ACE_SOCK_SEQPACK_Connector (ACE_SOCK_SEQPACK_Associa
int protocol)
{
ACE_TRACE ("ACE_SOCK_SEQPACK_Connector::ACE_SOCK_SEQPACK_Connector");
+
if (this->connect (new_association,
remote_sap,
timeout,
@@ -361,6 +412,7 @@ ACE_SOCK_SEQPACK_Connector::ACE_SOCK_SEQPACK_Connector (ACE_SOCK_SEQPACK_Associa
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_SOCK_SEQPACK_Connector::ACE_SOCK_SEQPACK_Connector")));
}
+
// Multihomed version of same
ACE_SOCK_SEQPACK_Connector::ACE_SOCK_SEQPACK_Connector (ACE_SOCK_SEQPACK_Association &new_association,
const ACE_Addr &remote_sap,
@@ -372,6 +424,7 @@ ACE_SOCK_SEQPACK_Connector::ACE_SOCK_SEQPACK_Connector (ACE_SOCK_SEQPACK_Associa
int protocol)
{
ACE_TRACE ("ACE_SOCK_SEQPACK_Connector::ACE_SOCK_SEQPACK_Connector");
+
if (this->connect (new_association,
remote_sap,
timeout,
@@ -386,5 +439,6 @@ ACE_SOCK_SEQPACK_Connector::ACE_SOCK_SEQPACK_Connector (ACE_SOCK_SEQPACK_Associa
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_SOCK_SEQPACK_Connector::ACE_SOCK_SEQPACK_Connector")));
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/SOCK_SEQPACK_Connector.h b/dep/ACE_wrappers/ace/SOCK_SEQPACK_Connector.h
index c2daf8b083e..400161660e0 100644
--- a/dep/ACE_wrappers/ace/SOCK_SEQPACK_Connector.h
+++ b/dep/ACE_wrappers/ace/SOCK_SEQPACK_Connector.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file SOCK_SEQPACK_Connector.h
@@ -12,18 +13,26 @@
*
*/
//=============================================================================
+
#ifndef ACE_SOCK_SEQPACK_CONNECTOR_H
#define ACE_SOCK_SEQPACK_CONNECTOR_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#include "ace/SOCK_SEQPACK_Association.h"
#include "ace/Multihomed_INET_Addr.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward declarations.
class ACE_Time_Value;
+
/**
* @class ACE_SOCK_SEQPACK_Connector
*
@@ -45,6 +54,7 @@ public:
// = Initialization and termination methods.
/// Default constructor.
ACE_SOCK_SEQPACK_Connector (void);
+
/**
* Actively connect to a peer, producing a connected @c ACE_SOCK_SEQPACK_Association
* object if the connection succeeds.
@@ -94,6 +104,7 @@ public:
int flags = 0,
int perms = 0,
int protocol = 132);
+
/**
* Actively connect to a peer, producing a connected @c ACE_SOCK_SEQPACK_Association
* object if the connection succeeds.
@@ -142,6 +153,7 @@ public:
int flags = 0,
int perms = 0,
int protocol = 132);
+
/**
* Actively connect to a peer, producing a connected @c ACE_SOCK_SEQPACK_Association
* object if the connection succeeds.
@@ -191,6 +203,7 @@ public:
int flags = 0,
int perms = 0,
int protocol = 132);
+
/**
* Actively connect to a peer, producing a connected @c ACE_SOCK_SEQPACK_Association
* object if the connection succeeds.
@@ -231,6 +244,7 @@ public:
* -1 is returned and errno contains a specific error
* code.
*/
+
int connect (ACE_SOCK_SEQPACK_Association &new_association,
const ACE_Addr &remote_sap,
const ACE_Time_Value *timeout,
@@ -239,8 +253,10 @@ public:
int flags = 0,
int perms = 0,
int protocol = 132);
+
/// Default dtor.
~ACE_SOCK_SEQPACK_Connector (void);
+
// = Completion routine.
/**
* Try to complete a nonblocking connection that was begun by a
@@ -257,15 +273,20 @@ public:
int complete (ACE_SOCK_SEQPACK_Association &new_association,
ACE_Addr *remote_sap = 0,
const ACE_Time_Value *timeout = 0);
+
/// Resets any event associations on this handle
int reset_new_handle (ACE_HANDLE handle);
+
// = Meta-type info
typedef ACE_Multihomed_INET_Addr PEER_ADDR;
typedef ACE_SOCK_SEQPACK_Association PEER_STREAM;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
/// Perform operations that ensure the socket is opened using
/// BSD-style semantics (no QoS).
@@ -273,6 +294,7 @@ protected:
int protocol_family,
int protocol,
int reuse_addr);
+
/// Perform operations that ensure the socket is opened using
/// QoS-enabled semantics.
int shared_open (ACE_SOCK_SEQPACK_Association &new_association,
@@ -282,22 +304,29 @@ protected:
ACE_SOCK_GROUP g,
u_long flags,
int reuse_addr);
+
/// Perform operations that must be called before <ACE_OS::connect>.
int shared_connect_start (ACE_SOCK_SEQPACK_Association &new_association,
const ACE_Time_Value *timeout,
const ACE_Addr &local_sap);
+
int shared_connect_start (ACE_SOCK_SEQPACK_Association &new_association,
const ACE_Time_Value *timeout,
const ACE_Multihomed_INET_Addr &local_sap);
+
/// Perform operations that must be called after <ACE_OS::connect>.
int shared_connect_finish (ACE_SOCK_SEQPACK_Association &new_association,
const ACE_Time_Value *timeout,
int result);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/SOCK_SEQPACK_Connector.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_SOCK_SEQPACK_CONNECTOR_H */
diff --git a/dep/ACE_wrappers/ace/SOCK_SEQPACK_Connector.inl b/dep/ACE_wrappers/ace/SOCK_SEQPACK_Connector.inl
index c74c2d6a4d6..d11a69d31af 100644
--- a/dep/ACE_wrappers/ace/SOCK_SEQPACK_Connector.inl
+++ b/dep/ACE_wrappers/ace/SOCK_SEQPACK_Connector.inl
@@ -1,20 +1,26 @@
// -*- C++ -*-
//
// $Id: SOCK_SEQPACK_Connector.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// This constructor is used by a client when it wants to connect to
// the specified REMOTE_SAP address using a blocking open.
+
ACE_INLINE
ACE_SOCK_SEQPACK_Connector::~ACE_SOCK_SEQPACK_Connector (void)
{
ACE_TRACE ("ACE_SOCK_SEQPACK_Connector::~ACE_SOCK_SEQPACK_Connector");
}
+
// Do-nothing constructor...
+
ACE_INLINE
ACE_SOCK_SEQPACK_Connector::ACE_SOCK_SEQPACK_Connector (void)
{
ACE_TRACE ("ACE_SOCK_SEQPACK_Connector::ACE_SOCK_SEQPACK_Connector");
}
+
ACE_INLINE int
ACE_SOCK_SEQPACK_Connector::reset_new_handle (ACE_HANDLE handle)
{
@@ -28,4 +34,5 @@ ACE_SOCK_SEQPACK_Connector::reset_new_handle (ACE_HANDLE handle)
return 0;
#endif /* ACE_WIN32 */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/SOCK_Stream.cpp b/dep/ACE_wrappers/ace/SOCK_Stream.cpp
index eece06b9503..abff10c5811 100644
--- a/dep/ACE_wrappers/ace/SOCK_Stream.cpp
+++ b/dep/ACE_wrappers/ace/SOCK_Stream.cpp
@@ -1,11 +1,17 @@
// $Id: SOCK_Stream.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/SOCK_Stream.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/SOCK_Stream.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace, SOCK_Stream, "$Id: SOCK_Stream.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_SOCK_Stream)
+
void
ACE_SOCK_Stream::dump (void) const
{
@@ -13,6 +19,7 @@ ACE_SOCK_Stream::dump (void) const
ACE_TRACE ("ACE_SOCK_Stream::dump");
#endif /* ACE_HAS_DUMP */
}
+
int
ACE_SOCK_Stream::close (void)
{
@@ -25,8 +32,10 @@ ACE_SOCK_Stream::close (void)
// that fork() works.
(void) this->close_writer ();
#endif /* ACE_WIN32 */
+
// Close down the socket.
return ACE_SOCK::close ();
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/SOCK_Stream.h b/dep/ACE_wrappers/ace/SOCK_Stream.h
index 68437736888..d717d4f3eab 100644
--- a/dep/ACE_wrappers/ace/SOCK_Stream.h
+++ b/dep/ACE_wrappers/ace/SOCK_Stream.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file SOCK_Stream.h
@@ -8,17 +9,24 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_SOCK_STREAM_H
#define ACE_SOCK_STREAM_H
#include /**/ "ace/pre.h"
+
#include "ace/SOCK_IO.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/INET_Addr.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward declarations.
class ACE_Message_Block;
+
/**
* @class ACE_SOCK_Stream
*
@@ -35,10 +43,13 @@ public:
// Initialization and termination methods.
/// Constructor.
ACE_SOCK_Stream (void);
+
/// Constructor (sets the underlying ACE_HANDLE with @a h).
ACE_SOCK_Stream (ACE_HANDLE h);
+
/// Destructor.
~ACE_SOCK_Stream (void);
+
/** @name Counted send/receive methods
*
* The counted send/receive methods attempt to transfer a specified number
@@ -89,68 +100,86 @@ public:
int flags,
const ACE_Time_Value *timeout = 0,
size_t *bytes_transferred = 0) const;
+
/// Try to recv exactly @a len bytes into @a buf from the connected socket.
ssize_t recv_n (void *buf,
size_t len,
const ACE_Time_Value *timeout = 0,
size_t *bytes_transferred = 0) const;
+
/// Receive an @c iovec of size @a iovcnt from the connected socket.
ssize_t recvv_n (iovec iov[],
int iovcnt,
const ACE_Time_Value *timeout = 0,
size_t *bytes_transferred = 0) const;
+
/// Try to send exactly @a len bytes from @a buf to the connection socket.
ssize_t send_n (const void *buf,
size_t len,
int flags,
const ACE_Time_Value *timeout = 0,
size_t *bytes_transferred = 0) const;
+
/// Try to send exactly @a len bytes from @a buf to the connected socket.
ssize_t send_n (const void *buf,
size_t len,
const ACE_Time_Value *timeout = 0,
size_t *bytes_transferred = 0) const;
+
/// Send all the message blocks chained through their @c next and
/// @c cont pointers. This call uses the underlying OS gather-write
/// operation to reduce the domain-crossing penalty.
ssize_t send_n (const ACE_Message_Block *message_block,
const ACE_Time_Value *timeout = 0,
size_t *bytes_transferred = 0) const;
+
/// Send an @c iovec of size @a iovcnt to the connected socket.
ssize_t sendv_n (const iovec iov[],
int iovcnt,
const ACE_Time_Value *timeout = 0,
size_t *bytes_transferred = 0) const;
+
//@}
+
// = Send/receive ``urgent'' data (see TCP specs...).
ssize_t send_urg (const void *ptr,
size_t len = sizeof (char),
const ACE_Time_Value *timeout = 0) const;
+
ssize_t recv_urg (void *ptr,
size_t len = sizeof (char),
const ACE_Time_Value *timeout = 0) const;
+
// = Selectively close endpoints.
/// Close down the reader.
int close_reader (void);
+
/// Close down the writer.
int close_writer (void);
+
/**
* Close down the socket (we need this to make things work correctly
* on Win32, which requires use to do a close_writer() before doing
* the close to avoid losing data).
*/
int close (void);
+
// = Meta-type info
typedef ACE_INET_Addr PEER_ADDR;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/SOCK_Stream.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_SOCK_STREAM_H */
diff --git a/dep/ACE_wrappers/ace/SOCK_Stream.inl b/dep/ACE_wrappers/ace/SOCK_Stream.inl
index 6b8b45dcca9..cbe6cd3d9ce 100644
--- a/dep/ACE_wrappers/ace/SOCK_Stream.inl
+++ b/dep/ACE_wrappers/ace/SOCK_Stream.inl
@@ -1,25 +1,31 @@
// -*- C++ -*-
//
// $Id: SOCK_Stream.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/SOCK_Stream.h"
#include "ace/OS_NS_sys_socket.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_SOCK_Stream::ACE_SOCK_Stream (void)
{
// ACE_TRACE ("ACE_SOCK_Stream::ACE_SOCK_Stream");
}
+
ACE_INLINE
ACE_SOCK_Stream::ACE_SOCK_Stream (ACE_HANDLE h)
{
// ACE_TRACE ("ACE_SOCK_Stream::ACE_SOCK_Stream");
this->set_handle (h);
}
+
ACE_INLINE
ACE_SOCK_Stream::~ACE_SOCK_Stream (void)
{
// ACE_TRACE ("ACE_SOCK_Stream::~ACE_SOCK_Stream");
}
+
ACE_INLINE int
ACE_SOCK_Stream::close_reader (void)
{
@@ -29,7 +35,9 @@ ACE_SOCK_Stream::close_reader (void)
else
return 0;
}
+
// Shut down just the writing end of a ACE_SOCK.
+
ACE_INLINE int
ACE_SOCK_Stream::close_writer (void)
{
@@ -39,6 +47,7 @@ ACE_SOCK_Stream::close_writer (void)
else
return 0;
}
+
ACE_INLINE ssize_t
ACE_SOCK_Stream::recv_n (void *buf,
size_t len,
@@ -54,6 +63,7 @@ ACE_SOCK_Stream::recv_n (void *buf,
timeout,
bytes_transferred);
}
+
ACE_INLINE ssize_t
ACE_SOCK_Stream::recv_n (void *buf,
size_t len,
@@ -67,6 +77,7 @@ ACE_SOCK_Stream::recv_n (void *buf,
timeout,
bytes_transferred);
}
+
ACE_INLINE ssize_t
ACE_SOCK_Stream::recvv_n (iovec iov[],
int n,
@@ -80,6 +91,7 @@ ACE_SOCK_Stream::recvv_n (iovec iov[],
timeout,
bytes_transferred);
}
+
ACE_INLINE ssize_t
ACE_SOCK_Stream::send_n (const void *buf,
size_t len,
@@ -95,6 +107,7 @@ ACE_SOCK_Stream::send_n (const void *buf,
timeout,
bytes_transferred);
}
+
ACE_INLINE ssize_t
ACE_SOCK_Stream::send_n (const void *buf,
size_t len,
@@ -108,6 +121,7 @@ ACE_SOCK_Stream::send_n (const void *buf,
timeout,
bytes_transferred);
}
+
ACE_INLINE ssize_t
ACE_SOCK_Stream::sendv_n (const iovec iov[],
int n,
@@ -121,6 +135,7 @@ ACE_SOCK_Stream::sendv_n (const iovec iov[],
timeout,
bytes_transferred);
}
+
ACE_INLINE ssize_t
ACE_SOCK_Stream::send_n (const ACE_Message_Block *message_block,
const ACE_Time_Value *timeout,
@@ -132,6 +147,7 @@ ACE_SOCK_Stream::send_n (const ACE_Message_Block *message_block,
timeout,
bytes_transferred);
}
+
ACE_INLINE ssize_t
ACE_SOCK_Stream::send_urg (const void *ptr,
size_t len,
@@ -144,6 +160,7 @@ ACE_SOCK_Stream::send_urg (const void *ptr,
MSG_OOB,
timeout);
}
+
ACE_INLINE ssize_t
ACE_SOCK_Stream::recv_urg (void *ptr,
size_t len,
@@ -156,4 +173,5 @@ ACE_SOCK_Stream::recv_urg (void *ptr,
MSG_OOB,
timeout);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/SPIPE.cpp b/dep/ACE_wrappers/ace/SPIPE.cpp
index 40874a78013..e26e027cbff 100644
--- a/dep/ACE_wrappers/ace/SPIPE.cpp
+++ b/dep/ACE_wrappers/ace/SPIPE.cpp
@@ -1,17 +1,26 @@
// $Id: SPIPE.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/SPIPE.h"
+
#include "ace/OS_NS_unistd.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/SPIPE.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace, SPIPE, "$Id: SPIPE.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_SPIPE)
+
// This is the do-nothing constructor.
+
ACE_SPIPE::ACE_SPIPE (void)
{
// ACE_TRACE ("ACE_SPIPE::ACE_SPIPE");
}
+
void
ACE_SPIPE::dump (void) const
{
@@ -19,7 +28,9 @@ ACE_SPIPE::dump (void) const
ACE_TRACE ("ACE_SPIPE::dump");
#endif /* ACE_HAS_DUMP */
}
+
// Close down a ACE_SPIPE.
+
int
ACE_SPIPE::get_local_addr (ACE_SPIPE_Addr &local_sap) const
{
@@ -27,12 +38,15 @@ ACE_SPIPE::get_local_addr (ACE_SPIPE_Addr &local_sap) const
local_sap = this->local_addr_;
return 0;
}
+
// Close down the STREAM pipe without removing the rendezvous point.
+
int
ACE_SPIPE::close (void)
{
ACE_TRACE ("ACE_SPIPE::close");
int result = 0;
+
if (this->get_handle () != ACE_INVALID_HANDLE)
{
result = ACE_OS::close (this->get_handle ());
@@ -43,8 +57,10 @@ ACE_SPIPE::close (void)
}
return result;
}
+
// Close down the STREAM pipe and remove the rendezvous point from the
// file system.
+
int
ACE_SPIPE::remove (void)
{
@@ -52,6 +68,7 @@ ACE_SPIPE::remove (void)
int result = this->close ();
return ACE_OS::unlink (this->local_addr_.get_path_name ()) == -1 || result == -1 ? -1 : 0;
}
+
#if defined (ACE_HAS_STREAM_PIPES)
/// Temporary store of duplex pipe handle.
void
@@ -61,5 +78,6 @@ ACE_SPIPE::set_duplex_handle (ACE_HANDLE handle)
this->duplex_pipe_handle_ = handle;
}
#endif /* ACE_HAS_STREAM_PIPES */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/SPIPE.h b/dep/ACE_wrappers/ace/SPIPE.h
index 89e99a96b8d..a65ade1db15 100644
--- a/dep/ACE_wrappers/ace/SPIPE.h
+++ b/dep/ACE_wrappers/ace/SPIPE.h
@@ -1,4 +1,5 @@
/* -*- C++ -*- */
+
//=============================================================================
/**
* @file SPIPE.h
@@ -9,15 +10,21 @@
*/
//=============================================================================
+
#ifndef ACE_SPIPE_H
#define ACE_SPIPE_H
#include /**/ "ace/pre.h"
+
#include "ace/IPC_SAP.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/SPIPE_Addr.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_SPIPE
*
@@ -47,6 +54,7 @@ public:
* error information is available from ACE_OS::last_error().
*/
int close (void);
+
/// Close down the SPIPE and remove the rendezvous point from
/// the file system.
/**
@@ -54,6 +62,7 @@ public:
* error information is available from ACE_OS::last_error().
*/
int remove (void);
+
/// Return the local address of this endpoint.
/**
* Returns the local address of the SPIPE's endpoint in @arg addr.
@@ -61,6 +70,7 @@ public:
* error information is available from ACE_OS::last_error().
*/
int get_local_addr (ACE_SPIPE_Addr &) const;
+
/**
* Disable signal @arg signum.
* @note This reimplements the inherited method from
@@ -69,30 +79,39 @@ public:
* it is passed through to ACE_IPC_SAP::disable().
*/
int disable (int signum) const ;
+
/// Dump the state of an object.
void dump (void) const;
+
#if defined (ACE_HAS_STREAM_PIPES)
/// Temporary store of duplex pipe handle.
void set_duplex_handle (ACE_HANDLE handle);
#endif /* ACE_HAS_STREAM_PIPES */
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
#if defined (ACE_HAS_STREAM_PIPES)
/// Duplex to the pipe I/O handle.
/// Stored here for latter cleaning.
ACE_HANDLE duplex_pipe_handle_;
#endif /* ACE_HAS_STREAM_PIPES */
+
protected:
/// Ensure that this class is an abstract base class
ACE_SPIPE (void);
+
/// Our local address.
ACE_SPIPE_Addr local_addr_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/SPIPE.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_SPIPE_H */
diff --git a/dep/ACE_wrappers/ace/SPIPE.inl b/dep/ACE_wrappers/ace/SPIPE.inl
index acb5f49c95d..6e4c7ed47be 100644
--- a/dep/ACE_wrappers/ace/SPIPE.inl
+++ b/dep/ACE_wrappers/ace/SPIPE.inl
@@ -1,7 +1,9 @@
// -*- C++ -*-
//
// $Id: SPIPE.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE int
ACE_SPIPE::disable (int signum) const
{
@@ -12,4 +14,5 @@ ACE_SPIPE::disable (int signum) const
return ACE_IPC_SAP::disable (signum) ;
#endif /* ACE_WIN32 */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/SPIPE_Acceptor.cpp b/dep/ACE_wrappers/ace/SPIPE_Acceptor.cpp
index e5e2ef4e64f..cc12c0c4b89 100644
--- a/dep/ACE_wrappers/ace/SPIPE_Acceptor.cpp
+++ b/dep/ACE_wrappers/ace/SPIPE_Acceptor.cpp
@@ -1,13 +1,18 @@
// $Id: SPIPE_Acceptor.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/SPIPE_Acceptor.h"
#include "ace/Log_Msg.h"
#include "ace/OS_NS_sys_stat.h"
#include "ace/OS_NS_sys_time.h"
+
#if defined (ACE_HAS_STREAM_PIPES)
# include "ace/OS_NS_unistd.h"
#endif // ACE_HAS_STREAM_PIPES
+
ACE_RCSID(ace, SPIPE_Acceptor, "$Id: SPIPE_Acceptor.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_SPIPE_Acceptor::ACE_SPIPE_Acceptor (void)
#if defined (ACE_HAS_WIN32_NAMED_PIPES)
: sa_ (0), pipe_handle_ (ACE_INVALID_HANDLE)
@@ -15,12 +20,14 @@ ACE_SPIPE_Acceptor::ACE_SPIPE_Acceptor (void)
{
ACE_TRACE ("ACE_SPIPE_Acceptor::ACE_SPIPE_Acceptor");
}
+
int
ACE_SPIPE_Acceptor::remove (void)
{
ACE_TRACE ("ACE_SPIPE_Acceptor::remove");
#if defined (ACE_HAS_STREAM_PIPES)
int result = this->close ();
+
// Remove the underlying file.
return ACE_OS::unlink (this->local_addr_.get_path_name ()) == -1
|| result == -1 ? -1 : 0;
@@ -29,7 +36,9 @@ ACE_SPIPE_Acceptor::remove (void)
return 0;
#endif
}
+
ACE_ALLOC_HOOK_DEFINE (ACE_SPIPE_Acceptor)
+
void
ACE_SPIPE_Acceptor::dump (void) const
{
@@ -37,7 +46,9 @@ ACE_SPIPE_Acceptor::dump (void) const
ACE_TRACE ("ACE_SPIPE_Acceptor::dump");
#endif /* ACE_HAS_DUMP */
}
+
// General purpose routine for performing server ACE_SPIPE creation.
+
int
ACE_SPIPE_Acceptor::open (const ACE_SPIPE_Addr &local_sap,
int reuse_addr,
@@ -47,6 +58,7 @@ ACE_SPIPE_Acceptor::open (const ACE_SPIPE_Addr &local_sap,
{
ACE_TRACE ("ACE_SPIPE_Acceptor::open");
ACE_UNUSED_ARG (reuse_addr);
+
this->local_addr_ = local_sap;
this->set_handle (ACE_INVALID_HANDLE);
#if defined (ACE_HAS_WIN32_NAMED_PIPES)
@@ -56,14 +68,17 @@ ACE_SPIPE_Acceptor::open (const ACE_SPIPE_Addr &local_sap,
ACE_UNUSED_ARG (sa);
ACE_UNUSED_ARG (pipe_mode);
#endif /* ACE_HAS_WIN32_NAMED_PIPES */
+
return this->create_new_instance (perms);
}
+
int
ACE_SPIPE_Acceptor::create_new_instance (int perms)
{
#if defined (ACE_HAS_STREAM_PIPES)
ACE_HANDLE spipe[2];
char module[] = "connld";
+
ACE_HANDLE handle = ACE_OS::creat (this->local_addr_.get_path_name (),
perms);
if (handle == ACE_INVALID_HANDLE)
@@ -80,18 +95,22 @@ ACE_SPIPE_Acceptor::create_new_instance (int perms)
ACE_TEXT_ALWAYS_CHAR (
this->local_addr_.get_path_name ())))
return -1;
+
this->set_duplex_handle (spipe[0]);
this->set_handle (spipe[1]);
return 0;
+
#elif defined (ACE_HAS_WIN32_NAMED_PIPES)
// Create a new instance of the Named Pipe (WIN32). A new instance
// of the named pipe must be created for every client process. If
// an instance of the named pipe that is already connected to a
// client process is reused with a new client process,
// ::ConnectNamedPipe () would fail.
+
ACE_UNUSED_ARG (perms);
ACE_TRACE ("ACE_SPIPE_Acceptor::create_new_instance");
int status;
+
// Create a new instance of the named pipe
this->pipe_handle_ =
#if defined (ACE_USES_WCHAR)
@@ -108,6 +127,7 @@ ACE_SPIPE_Acceptor::create_new_instance (int perms)
1024 * 10,
ACE_DEFAULT_TIMEOUT,
this->sa_);
+
if (this->pipe_handle_ == ACE_INVALID_HANDLE)
return -1;
else
@@ -125,12 +145,14 @@ ACE_SPIPE_Acceptor::create_new_instance (int perms)
this->set_handle (this->event_.handle ());
this->overlapped_.hEvent = this->event_.handle ();
this->event_.reset ();
+
BOOL result = ::ConnectNamedPipe (this->pipe_handle_,
&this->overlapped_);
ACE_UNUSED_ARG (result);
// ConnectNamePipe is suppose to always
// "fail" when passed in overlapped i/o
ACE_ASSERT (!result);
+
status = ::GetLastError ();
switch (status)
{
@@ -155,25 +177,33 @@ ACE_SPIPE_Acceptor::create_new_instance (int perms)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_STREAM_PIPES */
}
+
int
ACE_SPIPE_Acceptor::close (void)
{
ACE_TRACE ("ACE_SPIPE_Acceptor::close");
+
#if defined (ACE_HAS_WIN32_NAMED_PIPES)
+
// Check to see if we have a valid pipe; if not, nothing to do.
if (this->pipe_handle_ == ACE_INVALID_HANDLE)
return -1;
+
// Substitute the pipe handle back in so it's closed properly in the
// ACE_OS wrapper. But leave the pipe_handle_ value so we can clean up the
// hanging overlapped operation afterwards.
this->set_handle (this->pipe_handle_);
+
#endif /* ACE_HAS_WIN32_NAMED_PIPES */
+
// This behavior is shared by UNIX and Win32...
int result = this->ACE_SPIPE::close ();
this->set_handle (ACE_INVALID_HANDLE);
+
#if defined (ACE_HAS_STREAM_PIPES)
ACE_OS::fdetach (ACE_TEXT_ALWAYS_CHAR (this->local_addr_.get_path_name ()));
#elif defined (ACE_HAS_WIN32_NAMED_PIPES)
+
// open () started the Connect in asynchronous mode, and accept() restarts
// the ConnectNamedPipe in overlapped mode. To avoid leaving a hanging
// overlapped operation that'll write into members of this object,
@@ -194,8 +224,10 @@ ACE_SPIPE_Acceptor::close (void)
this->already_connected_ = 0;
}
#endif /* ACE_HAS_STREAM_PIPES */
+
return result;
}
+
ACE_SPIPE_Acceptor::ACE_SPIPE_Acceptor (const ACE_SPIPE_Addr &local_sap,
int reuse_addr,
int perms,
@@ -203,12 +235,15 @@ ACE_SPIPE_Acceptor::ACE_SPIPE_Acceptor (const ACE_SPIPE_Addr &local_sap,
int pipe_mode)
{
ACE_TRACE ("ACE_SPIPE_Acceptor::ACE_SPIPE_Acceptor");
+
if (this->open (local_sap, reuse_addr, perms, sa, pipe_mode) == -1)
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_SPIPE_Acceptor")));
}
+
// General purpose routine for accepting new connections.
+
int
ACE_SPIPE_Acceptor::accept (ACE_SPIPE_Stream &new_io,
ACE_SPIPE_Addr *remote_addr,
@@ -218,11 +253,14 @@ ACE_SPIPE_Acceptor::accept (ACE_SPIPE_Stream &new_io,
{
ACE_TRACE ("ACE_SPIPE_Acceptor::accept");
ACE_UNUSED_ARG (reset_new_handle);
+
#if defined (ACE_HAS_STREAM_PIPES)
strrecvfd r_handle;
+
// Note that if THIS->MILLI_SECOND_DELAY == -1 we block on
// ACE_OS::ioctl (). Otherwise, we will wait for the desired number
// of milli seconds using ACE_OS::poll.
+
if (timeout != 0 &&
ACE::handle_timed_accept (this->get_handle (),
timeout,
@@ -232,22 +270,27 @@ ACE_SPIPE_Acceptor::accept (ACE_SPIPE_Stream &new_io,
I_RECVFD,
&r_handle) == -1)
return -1;
+
new_io.set_handle (r_handle.fd);
new_io.local_addr_ = this->local_addr_;
new_io.remote_addr_.set_size (sizeof r_handle.gid + sizeof r_handle.uid);
new_io.remote_addr_.group_id (r_handle.gid);
new_io.remote_addr_.user_id (r_handle.uid);
+
// This is for compatibility with ACE_SOCK_Acceptor and
// ACE_TLI_Acceptor.
if (remote_addr != 0)
*remote_addr = new_io.remote_addr_;
+
return 0;
#elif defined (ACE_HAS_WIN32_NAMED_PIPES)
ACE_UNUSED_ARG (restart);
ACE_UNUSED_ARG (remote_addr);
+
// Check to see if we have a valid pipe
if (this->pipe_handle_ == ACE_INVALID_HANDLE)
return -1;
+
// open () started the Connect in asynchronous mode. Wait for the event
// in the OVERLAPPED structure to be signalled, then grab the status.
if (this->already_connected_ == 0)
@@ -261,6 +304,7 @@ ACE_SPIPE_Acceptor::accept (ACE_SPIPE_Stream &new_io,
else
if (this->event_.wait () == -1)
return -1;
+
// Should be here with the ConnectNamedPipe operation complete.
// Steal the already_connected_ flag to record the results.
DWORD unused;
@@ -269,11 +313,13 @@ ACE_SPIPE_Acceptor::accept (ACE_SPIPE_Stream &new_io,
&unused,
FALSE);
}
+
if (this->already_connected_)
{
new_io.set_handle (this->pipe_handle_);
this->pipe_handle_ = ACE_INVALID_HANDLE;
new_io.local_addr_ = this->local_addr_;
+
// Create a new instance of the pipe for the next connection.
this->create_new_instance ();
return 0;
@@ -287,5 +333,6 @@ ACE_SPIPE_Acceptor::accept (ACE_SPIPE_Stream &new_io,
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_STREAM_PIPES */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/SPIPE_Acceptor.h b/dep/ACE_wrappers/ace/SPIPE_Acceptor.h
index ac4e467ef54..bf3b3bba461 100644
--- a/dep/ACE_wrappers/ace/SPIPE_Acceptor.h
+++ b/dep/ACE_wrappers/ace/SPIPE_Acceptor.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file SPIPE_Acceptor.h
@@ -10,17 +11,23 @@
*/
//=============================================================================
+
#ifndef ACE_SPIPE_ACCEPTOR_H
#define ACE_SPIPE_ACCEPTOR_H
#include /**/ "ace/pre.h"
+
#include "ace/SPIPE_Stream.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_WIN32_NAMED_PIPES)
#include "ace/Manual_Event.h"
#endif /* ACE_HAS_WIN32_NAMED_PIPES */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_SPIPE_Acceptor
*
@@ -44,6 +51,7 @@ public:
// = Initialization and termination methods.
/// Default constructor.
ACE_SPIPE_Acceptor (void);
+
/// Initiate a passive-mode STREAM pipe listener.
/**
* @param local_sap The name of the pipe instance to open and listen on.
@@ -65,6 +73,7 @@ public:
int perms = ACE_DEFAULT_FILE_PERMS,
LPSECURITY_ATTRIBUTES sa = 0,
int pipe_mode = PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE);
+
/// Initiate a passive-mode STREAM pipe listener.
/**
* @param local_sap The name of the pipe instance to open and listen on.
@@ -89,10 +98,13 @@ public:
int perms = ACE_DEFAULT_FILE_PERMS,
LPSECURITY_ATTRIBUTES sa = 0,
int pipe_mode = PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE);
+
/// Close down the passive-mode STREAM pipe listener.
int close (void);
+
/// Remove the underlying mounted pipe from the file system.
int remove (void);
+
// = Passive connection acceptance method.
/**
* Accept a new data transfer connection.
@@ -111,23 +123,30 @@ public:
ACE_Time_Value *timeout = 0,
int restart = 1,
int reset_new_handle = 0);
+
// = Meta-type info
typedef ACE_SPIPE_Addr PEER_ADDR;
typedef ACE_SPIPE_Stream PEER_STREAM;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Create a new instance of an SPIPE.
int create_new_instance (int perms = 0);
+
#if defined (ACE_HAS_WIN32_NAMED_PIPES)
// On Windows, the SECURITY_ATTRIBUTES specified for the initial accept
// operation is reused on all subsequent pipe instances as well.
LPSECURITY_ATTRIBUTES sa_;
+
// On Windows, the pipe mode to create the pipe in. This can be in
// either a bytestream-oriented mode or a message-oriented mode.
DWORD pipe_mode_;
+
// On Windows, the handle maintained in the ACE_IPC_SAP class is the
// event handle from event_. The pipe handle is useless for telling
// when a pipe connect is done/ready, and it changes on each pipe
@@ -140,8 +159,11 @@ private:
ACE_HANDLE pipe_handle_;
int already_connected_;
#endif /* ACE_HAS_WIN32_NAMED_PIPES */
+
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
#endif /* ACE_SPIPE_ACCEPTOR_H */
diff --git a/dep/ACE_wrappers/ace/SPIPE_Addr.cpp b/dep/ACE_wrappers/ace/SPIPE_Addr.cpp
index f3c80dfbd67..3f84da76cc4 100644
--- a/dep/ACE_wrappers/ace/SPIPE_Addr.cpp
+++ b/dep/ACE_wrappers/ace/SPIPE_Addr.cpp
@@ -1,38 +1,50 @@
// $Id: SPIPE_Addr.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/SPIPE_Addr.h"
#include "ace/OS_NS_string.h"
#include "ace/OS_NS_unistd.h"
#include "ace/os_include/sys/os_socket.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/SPIPE_Addr.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace, SPIPE_Addr, "$Id: SPIPE_Addr.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_SPIPE_Addr)
+
void
ACE_SPIPE_Addr::dump (void) const
{
#if defined (ACE_HAS_DUMP)
#endif /* ACE_HAS_DUMP */
}
+
// Set a pointer to the address.
void
ACE_SPIPE_Addr::set_addr (void *addr, int len)
{
ACE_TRACE ("ACE_SPIPE_Addr::set_addr");
+
this->ACE_Addr::base_set (AF_SPIPE, len);
ACE_OS::memcpy ((void *) &this->SPIPE_addr_,
(void *) addr,
len);
}
+
// Return the address.
+
void *
ACE_SPIPE_Addr::get_addr (void) const
{
return (void *) &this->SPIPE_addr_;
}
+
// Do nothing constructor.
+
ACE_SPIPE_Addr::ACE_SPIPE_Addr (void)
: ACE_Addr (AF_SPIPE, sizeof this->SPIPE_addr_)
{
@@ -40,6 +52,7 @@ ACE_SPIPE_Addr::ACE_SPIPE_Addr (void)
0,
sizeof this->SPIPE_addr_);
}
+
int
ACE_SPIPE_Addr::addr_to_string (ACE_TCHAR *s, size_t len) const
{
@@ -48,16 +61,20 @@ ACE_SPIPE_Addr::addr_to_string (ACE_TCHAR *s, size_t len) const
len);
return 0;
}
+
// Transform the string into the current addressing format.
+
int
ACE_SPIPE_Addr::string_to_addr (const ACE_TCHAR *addr)
{
return this->set (addr);
}
+
int
ACE_SPIPE_Addr::set (const ACE_SPIPE_Addr &sa)
{
this->base_set (sa.get_type (), sa.get_size ());
+
if (sa.get_type () == AF_ANY)
(void) ACE_OS::memset ((void *) &this->SPIPE_addr_,
0,
@@ -68,12 +85,15 @@ ACE_SPIPE_Addr::set (const ACE_SPIPE_Addr &sa)
sa.get_size ());
return 0;
}
+
// Copy constructor.
+
ACE_SPIPE_Addr::ACE_SPIPE_Addr (const ACE_SPIPE_Addr &sa)
: ACE_Addr (AF_SPIPE, sizeof this->SPIPE_addr_)
{
this->set (sa);
}
+
int
ACE_SPIPE_Addr::set (const ACE_TCHAR *addr,
gid_t gid,
@@ -81,9 +101,11 @@ ACE_SPIPE_Addr::set (const ACE_TCHAR *addr,
{
int len = sizeof (this->SPIPE_addr_.uid_);
len += sizeof (this->SPIPE_addr_.gid_);
+
#if defined (ACE_WIN32)
const ACE_TCHAR *colonp = ACE_OS::strchr (addr, ':');
ACE_TCHAR temp[BUFSIZ];
+
if (colonp == 0) // Assume it's a local name.
{
ACE_OS::strcpy (temp, ACE_TEXT ( "\\\\.\\pipe\\"));
@@ -91,6 +113,7 @@ ACE_SPIPE_Addr::set (const ACE_TCHAR *addr,
}
else
{
+
if (ACE_OS::strncmp (addr,
ACE_TEXT ("localhost"),
ACE_OS::strlen ("localhost")) == 0)
@@ -99,19 +122,25 @@ ACE_SPIPE_Addr::set (const ACE_TCHAR *addr,
else
{
ACE_OS::strcpy (temp, ACE_TEXT ("\\\\"));
+
ACE_TCHAR *t;
+
// We need to allocate a duplicate so that we can write a
// NUL character into it.
ACE_ALLOCATOR_RETURN (t, ACE_OS::strdup (addr), -1);
+
t[colonp - addr] = ACE_TEXT ('\0');
ACE_OS::strcat (temp, t);
+
ACE_OS::free (t);
}
+
ACE_OS::strcat (temp, ACE_TEXT ("\\pipe\\"));
ACE_OS::strcat (temp, colonp + 1);
}
len += static_cast<int> (ACE_OS::strlen (temp));
this->ACE_Addr::base_set (AF_SPIPE, len);
+
ACE_OS::strcpy (this->SPIPE_addr_.rendezvous_, temp);
#else
this->ACE_Addr::base_set (AF_SPIPE,
@@ -124,7 +153,9 @@ ACE_SPIPE_Addr::set (const ACE_TCHAR *addr,
this->SPIPE_addr_.uid_ = uid == 0 ? ACE_OS::getuid () : uid;
return 0;
}
+
// Create a ACE_Addr from a ACE_SPIPE pathname.
+
ACE_SPIPE_Addr::ACE_SPIPE_Addr (const ACE_TCHAR *addr,
gid_t gid,
uid_t uid)
@@ -132,5 +163,6 @@ ACE_SPIPE_Addr::ACE_SPIPE_Addr (const ACE_TCHAR *addr,
{
this->set (addr, gid, uid);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/SPIPE_Addr.h b/dep/ACE_wrappers/ace/SPIPE_Addr.h
index 60248c895fd..46834b74727 100644
--- a/dep/ACE_wrappers/ace/SPIPE_Addr.h
+++ b/dep/ACE_wrappers/ace/SPIPE_Addr.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file SPIPE_Addr.h
@@ -8,17 +9,24 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//==========================================================================
+
#ifndef ACE_SPIPE_ADDR_H
#define ACE_SPIPE_ADDR_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Addr.h"
#include "ace/os_include/sys/os_types.h"
#include "ace/os_include/os_dirent.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_SPIPE_Addr
*
@@ -30,61 +38,86 @@ public:
// = Initialization methods.
/// Default constructor.
ACE_SPIPE_Addr (void);
+
/// Copy constructor.
ACE_SPIPE_Addr (const ACE_SPIPE_Addr &sa);
+
/// Create a ACE_SPIPE_Addr from a rendezvous point in the file
/// system.
ACE_SPIPE_Addr (const ACE_TCHAR *rendezvous_point, gid_t = 0, uid_t = 0);
+
/// Acts like a copy constructor...
int set (const ACE_SPIPE_Addr &sa);
+
/// Create a ACE_SPIPE_Addr from a rendezvous point in the file
/// system.
int set (const ACE_TCHAR *rendezvous_point, gid_t = 0, uid_t = 0);
+
/// Return a pointer to the address.
virtual void *get_addr (void) const;
+
/// Set a pointer to the underlying network address.
virtual void set_addr (void *addr, int len);
+
/// Transform the current address into string format.
virtual int addr_to_string (ACE_TCHAR *addr, size_t) const;
+
/// Transform the string into the current addressing format.
virtual int string_to_addr (const ACE_TCHAR *addr);
+
// = Equality/inequality tests
/// Check for equality.
bool operator == (const ACE_SPIPE_Addr &SAP) const;
+
/// Check for inequality
bool operator != (const ACE_SPIPE_Addr &SAP) const;
+
// = SPIPE-specific address operations
/// Pathname of rendezvous point in file system.
const ACE_TCHAR *get_path_name (void) const;
+
/// Get user id.
uid_t user_id (void) const;
+
/// Set user id.
void user_id (uid_t uid);
+
/// Set group ids.
void group_id (gid_t gid);
+
/// Get group ids.
gid_t group_id (void) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Contains security attributes.
struct SPIPE_Addr
{
/// Group id.
gid_t gid_;
+
/// User id.
uid_t uid_;
+
/// Pathname in the file system.
ACE_TCHAR rendezvous_[MAXPATHLEN + 1];
+
} SPIPE_addr_;
// Contents of an SPIPE address.
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/SPIPE_Addr.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_SPIPE_ADDR_H */
diff --git a/dep/ACE_wrappers/ace/SPIPE_Addr.inl b/dep/ACE_wrappers/ace/SPIPE_Addr.inl
index b92d31f8e25..a20e0e86f7c 100644
--- a/dep/ACE_wrappers/ace/SPIPE_Addr.inl
+++ b/dep/ACE_wrappers/ace/SPIPE_Addr.inl
@@ -2,45 +2,58 @@
//
// $Id: SPIPE_Addr.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/SString.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Compare two addresses for equality.
+
ACE_INLINE bool
ACE_SPIPE_Addr::operator == (const ACE_SPIPE_Addr &sap) const
{
return ACE_OS::strcmp (this->SPIPE_addr_.rendezvous_,
sap.SPIPE_addr_.rendezvous_ ) == 0;
}
+
// Compare two addresses for inequality.
+
ACE_INLINE bool
ACE_SPIPE_Addr::operator != (const ACE_SPIPE_Addr &sap) const
{
return !((*this) == sap); // This is lazy, of course... ;-)
}
+
// Return the path name used for the rendezvous point.
+
ACE_INLINE const ACE_TCHAR *
ACE_SPIPE_Addr::get_path_name (void) const
{
return this->SPIPE_addr_.rendezvous_;
}
+
ACE_INLINE uid_t
ACE_SPIPE_Addr::user_id (void) const
{
return this->SPIPE_addr_.uid_;
}
+
ACE_INLINE void
ACE_SPIPE_Addr::user_id (uid_t uid)
{
this->SPIPE_addr_.uid_ = uid;
}
+
ACE_INLINE gid_t
ACE_SPIPE_Addr::group_id (void) const
{
return this->SPIPE_addr_.gid_;
}
+
ACE_INLINE void
ACE_SPIPE_Addr::group_id (gid_t gid)
{
this->SPIPE_addr_.gid_ = gid;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/SPIPE_Connector.cpp b/dep/ACE_wrappers/ace/SPIPE_Connector.cpp
index 2f39caf3ef7..db49ca6c937 100644
--- a/dep/ACE_wrappers/ace/SPIPE_Connector.cpp
+++ b/dep/ACE_wrappers/ace/SPIPE_Connector.cpp
@@ -1,16 +1,23 @@
// $Id: SPIPE_Connector.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/SPIPE_Connector.h"
#include "ace/Log_Msg.h"
#include "ace/OS_NS_sys_time.h"
#include "ace/OS_NS_fcntl.h"
#include "ace/OS_NS_unistd.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/SPIPE_Connector.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace, SPIPE_Connector, "$Id: SPIPE_Connector.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_SPIPE_Connector)
+
// Creates a Local ACE_SPIPE.
+
ACE_SPIPE_Connector::ACE_SPIPE_Connector (ACE_SPIPE_Stream &new_io,
const ACE_SPIPE_Addr &remote_sap,
ACE_Time_Value *timeout,
@@ -28,6 +35,7 @@ ACE_SPIPE_Connector::ACE_SPIPE_Connector (ACE_SPIPE_Stream &new_io,
ACE_ERROR ((LM_ERROR, ACE_TEXT ("address %s, %p\n"),
remote_sap.get_path_name (), ACE_TEXT ("ACE_SPIPE_Connector")));
}
+
void
ACE_SPIPE_Connector::dump (void) const
{
@@ -35,10 +43,12 @@ ACE_SPIPE_Connector::dump (void) const
ACE_TRACE ("ACE_SPIPE_Connector::dump");
#endif /* ACE_HAS_DUMP */
}
+
ACE_SPIPE_Connector::ACE_SPIPE_Connector (void)
{
ACE_TRACE ("ACE_SPIPE_Connector::ACE_SPIPE_Connector");
}
+
int
ACE_SPIPE_Connector::connect (ACE_SPIPE_Stream &new_io,
const ACE_SPIPE_Addr &remote_sap,
@@ -53,7 +63,9 @@ ACE_SPIPE_Connector::connect (ACE_SPIPE_Stream &new_io,
ACE_TRACE ("ACE_SPIPE_Connector::connect");
// Make darn sure that the O_CREAT flag is not set!
ACE_CLR_BITS (flags, O_CREAT);
+
ACE_HANDLE handle;
+
ACE_UNUSED_ARG (pipe_mode);
#if defined (ACE_WIN32) && \
!defined (ACE_HAS_PHARLAP) && !defined (ACE_HAS_WINCE)
@@ -62,6 +74,7 @@ ACE_SPIPE_Connector::connect (ACE_SPIPE_Stream &new_io,
ACE_Time_Value absolute_time;
if (timeout != 0)
absolute_time = ACE_OS::gettimeofday () + *timeout;
+
// Loop until success or failure.
for (;;)
{
@@ -69,13 +82,16 @@ ACE_SPIPE_Connector::connect (ACE_SPIPE_Stream &new_io,
if (handle != ACE_INVALID_HANDLE)
// Success!
break;
+
// Check if we have a busy pipe condition.
if (::GetLastError() != ERROR_PIPE_BUSY)
// Nope, this is a failure condition.
break;
+
// This will hold the time out value used in the ::WaitNamedPipe
// call.
DWORD time_out_value;
+
// Check if we are to block until we connect.
if (timeout == 0)
// Wait for as long as it takes.
@@ -98,14 +114,18 @@ ACE_SPIPE_Connector::connect (ACE_SPIPE_Stream &new_io,
}
// Get the amount of time remaining for ::WaitNamedPipe.
time_out_value = relative_time.msec ();
+
}
+
// Wait for the named pipe to become available.
ACE_TEXT_WaitNamedPipe (remote_sap.get_path_name (),
time_out_value);
+
// Regardless of the return value, we'll do one more attempt to
// connect to see if it is now available and to return
// consistent error values.
}
+
// Set named pipe mode if we have a valid handle.
if (handle != ACE_INVALID_HANDLE)
{
@@ -130,9 +150,12 @@ ACE_SPIPE_Connector::connect (ACE_SPIPE_Stream &new_io,
remote_sap.get_path_name (),
flags, perms, sa);
#endif /* !ACE_WIN32 || ACE_HAS_PHARLAP || ACE_HAS_WINCE */
+
new_io.set_handle (handle);
new_io.remote_addr_ = remote_sap; // class copy.
+
return handle == ACE_INVALID_HANDLE ? -1 : 0;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/SPIPE_Connector.h b/dep/ACE_wrappers/ace/SPIPE_Connector.h
index 1a962854725..576cabaa073 100644
--- a/dep/ACE_wrappers/ace/SPIPE_Connector.h
+++ b/dep/ACE_wrappers/ace/SPIPE_Connector.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file SPIPE_Connector.h
@@ -9,15 +10,20 @@
* @author Prashant Jain <pjain@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_SPIPE_CONNECTOR_H
#define ACE_SPIPE_CONNECTOR_H
#include /**/ "ace/pre.h"
+
#include "ace/SPIPE_Stream.h"
#include "ace/os_include/os_fcntl.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_SPIPE_Connector
*
@@ -31,6 +37,7 @@ public:
// = Initialization method.
/// Default constructor.
ACE_SPIPE_Connector (void);
+
/**
* Actively connect and produce a <new_stream> if things go well.
* The @a remote_sap is the address that we are trying to connect
@@ -58,6 +65,7 @@ public:
int perms = 0,
LPSECURITY_ATTRIBUTES sa = 0,
int pipe_mode = PIPE_READMODE_MESSAGE | PIPE_WAIT);
+
/**
* Actively connect and produce a <new_stream> if things go well.
* The @a remote_sap is the address that we are trying to connect
@@ -85,20 +93,27 @@ public:
int perms = 0,
LPSECURITY_ATTRIBUTES sa = 0,
int pipe_mode = PIPE_READMODE_MESSAGE | PIPE_WAIT);
+
/// Resets any event associations on this handle
int reset_new_handle (ACE_HANDLE handle);
+
// = Meta-type info
typedef ACE_SPIPE_Addr PEER_ADDR;
typedef ACE_SPIPE_Stream PEER_STREAM;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/SPIPE_Connector.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_SPIPE_CONNECTOR_H */
diff --git a/dep/ACE_wrappers/ace/SPIPE_Connector.inl b/dep/ACE_wrappers/ace/SPIPE_Connector.inl
index fe9cff7c767..f61dd72d5a0 100644
--- a/dep/ACE_wrappers/ace/SPIPE_Connector.inl
+++ b/dep/ACE_wrappers/ace/SPIPE_Connector.inl
@@ -1,7 +1,9 @@
// -*- C++ -*-
//
// $Id: SPIPE_Connector.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE int
ACE_SPIPE_Connector::reset_new_handle (ACE_HANDLE handle)
{
@@ -9,4 +11,5 @@ ACE_SPIPE_Connector::reset_new_handle (ACE_HANDLE handle)
// Nothing to do here since the handle is not a socket
return 0;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/SPIPE_Stream.cpp b/dep/ACE_wrappers/ace/SPIPE_Stream.cpp
index 10688ec2666..008ce25ec3b 100644
--- a/dep/ACE_wrappers/ace/SPIPE_Stream.cpp
+++ b/dep/ACE_wrappers/ace/SPIPE_Stream.cpp
@@ -1,12 +1,18 @@
// $Id: SPIPE_Stream.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/SPIPE_Stream.h"
#include "ace/OS_Memory.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/SPIPE_Stream.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace, SPIPE_Stream, "$Id: SPIPE_Stream.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_SPIPE_Stream)
+
void
ACE_SPIPE_Stream::dump (void) const
{
@@ -14,15 +20,19 @@ ACE_SPIPE_Stream::dump (void) const
ACE_TRACE ("ACE_SPIPE_Stream::dump");
#endif /* ACE_HAS_DUMP */
}
+
// Simple-minded do nothing constructor.
+
ACE_SPIPE_Stream::ACE_SPIPE_Stream (void)
{
// ACE_TRACE ("ACE_SPIPE_Stream::ACE_SPIPE_Stream");
}
+
// Send N char *ptrs and int lengths. Note that the char *'s precede
// the ints (basically, an varargs version of writev). The count N is
// the *total* number of trailing arguments, *not* a couple of the
// number of tuple pairs!
+
ssize_t
ACE_SPIPE_Stream::send (size_t n, ...) const
{
@@ -37,12 +47,15 @@ ACE_SPIPE_Stream::send (size_t n, ...) const
iovec[total_tuples],
-1);
#endif /* !defined (ACE_HAS_ALLOCA) */
+
va_start (argp, n);
+
for (int i = 0; i < total_tuples; i++)
{
iovp[i].iov_base = va_arg (argp, char *);
iovp[i].iov_len = va_arg (argp, int);
}
+
ssize_t result = ACE_OS::writev (this->get_handle (), iovp, total_tuples);
#if !defined (ACE_HAS_ALLOCA)
delete [] iovp;
@@ -50,11 +63,13 @@ ACE_SPIPE_Stream::send (size_t n, ...) const
va_end (argp);
return result;
}
+
// This is basically an interface to ACE_OS::readv, that doesn't use
// the struct iovec explicitly. The ... can be passed as an arbitrary
// number of (char *ptr, int len) tuples. However, the count N is the
// *total* number of trailing arguments, *not* a couple of the number
// of tuple pairs!
+
ssize_t
ACE_SPIPE_Stream::recv (size_t n, ...) const
{
@@ -69,12 +84,15 @@ ACE_SPIPE_Stream::recv (size_t n, ...) const
iovec[total_tuples],
-1);
#endif /* !defined (ACE_HAS_ALLOCA) */
+
va_start (argp, n);
+
for (int i = 0; i < total_tuples; i++)
{
iovp[i].iov_base = va_arg (argp, char *);
iovp[i].iov_len = va_arg (argp, int);
}
+
ssize_t result = ACE_OS::readv (this->get_handle (), iovp, total_tuples);
#if !defined (ACE_HAS_ALLOCA)
delete [] iovp;
@@ -82,5 +100,6 @@ ACE_SPIPE_Stream::recv (size_t n, ...) const
va_end (argp);
return result;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/SPIPE_Stream.h b/dep/ACE_wrappers/ace/SPIPE_Stream.h
index 450dd307804..39a57a33126 100644
--- a/dep/ACE_wrappers/ace/SPIPE_Stream.h
+++ b/dep/ACE_wrappers/ace/SPIPE_Stream.h
@@ -1,4 +1,5 @@
/* -*- C++ -*- */
+
//=============================================================================
/**
* @file SPIPE_Stream.h
@@ -8,17 +9,23 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_SPIPE_STREAM_H
#define ACE_SPIPE_STREAM_H
#include /**/ "ace/pre.h"
+
#include "ace/SPIPE.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/SPIPE_Addr.h"
#include "ace/ACE.h"
#include "ace/OS_NS_stropts.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_SPIPE_Stream
*
@@ -48,47 +55,63 @@ class ACE_Export ACE_SPIPE_Stream : public ACE_SPIPE
public:
friend class ACE_SPIPE_Acceptor;
friend class ACE_SPIPE_Connector;
+
// = Initialization method.
/// Default constructor.
ACE_SPIPE_Stream (void);
+
/// Obtain the address of whom we are connected with.
int get_remote_addr (ACE_SPIPE_Addr &remote_sap) const;
+
/// Send an open FD to another process.
int send_handle (ACE_HANDLE handle) const;
+
/// Recv an open FD from another process.
int recv_handle (ACE_HANDLE &handle) const;
+
/// Recv an open FD from another process.
int recv_handle (strrecvfd &recvfd) const;
+
/// Send @a len bytes, keep trying until @a len are sent.
ssize_t send_n (const void *buf, size_t len) const;
+
/// Recv @a len bytes, keep trying until @a len are received.
ssize_t recv_n (void *buf, size_t len) const;
+
/// Send bytes via STREAM pipes using "band" mode.
ssize_t send (const void *buf, size_t len) const;
+
/// Recv bytes via STREAM pipes using "band" mode.
ssize_t recv (void *buf, size_t len) const;
+
/// Send <cntl> and <data> via STREAM pipes.
ssize_t send (const ACE_Str_Buf *cntl,
const ACE_Str_Buf *data,
int flags = 0) const;
+
/// Recv <cntl> and <data> via STREAM pipes.
ssize_t recv (ACE_Str_Buf *cntl,
ACE_Str_Buf *data,
int *flags) const;
+
/// Send bytes via STREAM pipes using "band" mode.
ssize_t send (const ACE_Str_Buf *cntl,
const ACE_Str_Buf *data,
int band,
int flags) const;
+
/// Recv bytes via STREAM pipes using "band" mode.
ssize_t recv (ACE_Str_Buf *cntl,
ACE_Str_Buf *data,
int *band,
int *flags) const;
+
/// Send iovecs via the OS "gather-write" operation.
ssize_t send (const iovec iov[], int len) const;
+
/// Recv iovecs via the OS "scatter-read" operation.
ssize_t recv (iovec iov[], int len) const;
+
/**
* Send N char *ptrs and int lengths. Note that the char *'s
* precede the ints (basically, an varargs version of writev). The
@@ -96,6 +119,7 @@ public:
* couple of the number of tuple pairs!
*/
ssize_t send (size_t len, ...) const;
+
/**
* This is an interface to ::readv, that doesn't use the struct
* iovec explicitly. The ... can be passed as an arbitrary number
@@ -104,33 +128,45 @@ public:
* number of tuple pairs!
*/
ssize_t recv (size_t len, ...) const;
+
/// Send @a len bytes via Win32 <WriteFile> using overlapped I/O.
ssize_t send (const void *buf, size_t len, ACE_OVERLAPPED *overlapped) const;
+
/// Recv @a len bytes via Win32 <ReadFile> using overlapped I/O.
ssize_t recv (void *buf, size_t len, ACE_OVERLAPPED *overlapped) const;
+
/// Send an <iovec> of size @a len to the stream.
ssize_t sendv (const iovec iov[],
int len) const;
+
/// Send an <iovec> of size @a len to the stream. Will block until all
/// bytes are sent or an error occurs.
ssize_t sendv_n (const iovec iov[],
int len) const;
+
/// Receive an <iovec> of size @a len to the stream.
ssize_t recvv_n (iovec iov[],
int len) const;
+
// = Meta-type info
typedef ACE_SPIPE_Addr PEER_ADDR;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
ACE_SPIPE_Addr remote_addr_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/SPIPE_Stream.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_SPIPE_STREAM_H */
diff --git a/dep/ACE_wrappers/ace/SPIPE_Stream.inl b/dep/ACE_wrappers/ace/SPIPE_Stream.inl
index 182918927f4..e52600d4888 100644
--- a/dep/ACE_wrappers/ace/SPIPE_Stream.inl
+++ b/dep/ACE_wrappers/ace/SPIPE_Stream.inl
@@ -1,14 +1,18 @@
// -*- C++ -*-
//
// $Id: SPIPE_Stream.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_sys_uio.h"
#include "ace/OS_NS_errno.h"
#include "ace/OS_NS_unistd.h"
#if defined (ACE_WIN32)
#include "ace/OS_NS_sys_socket.h"
#endif
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Create an ACE_SPIPE_Stream.
+
ACE_INLINE int
ACE_SPIPE_Stream::get_remote_addr (ACE_SPIPE_Addr &remote_sap) const
{
@@ -16,71 +20,85 @@ ACE_SPIPE_Stream::get_remote_addr (ACE_SPIPE_Addr &remote_sap) const
remote_sap = this->remote_addr_;
return 0;
}
+
// Send exactly N bytes from BUF to this socket. Keeping trying until
// this many bytes are sent.
+
ACE_INLINE ssize_t
ACE_SPIPE_Stream::send_n (const void *buf, size_t n) const
{
ACE_TRACE ("ACE_SPIPE_Stream::send_n");
return ACE::write_n (this->get_handle (), buf, n);
}
+
// Receive exactly N bytes from this socket into BUF. Keep trying
// until this many bytes are received.
+
ACE_INLINE ssize_t
ACE_SPIPE_Stream::recv_n (void *buf, size_t n) const
{
ACE_TRACE ("ACE_SPIPE_Stream::recv_n");
return ACE::read_n (this->get_handle (), buf, n);
}
+
ACE_INLINE ssize_t
ACE_SPIPE_Stream::send (const void *buf, size_t n) const
{
ACE_TRACE ("ACE_SPIPE_Stream::send");
return ACE_OS::write (this->get_handle (), (const char *) buf, n);
}
+
ACE_INLINE ssize_t
ACE_SPIPE_Stream::recv (void *buf, size_t n) const
{
ACE_TRACE ("ACE_SPIPE_Stream::recv");
return ACE_OS::read (this->get_handle (), (char *) buf, n);
}
+
ACE_INLINE ssize_t
ACE_SPIPE_Stream::send (const ACE_Str_Buf *cntl, const ACE_Str_Buf *data, int flags) const
{
ACE_TRACE ("ACE_SPIPE_Stream::send");
return ACE_OS::putmsg (this->get_handle (), (strbuf *) cntl, (strbuf *) data, flags);
}
+
ACE_INLINE ssize_t
ACE_SPIPE_Stream::recv (ACE_Str_Buf *cntl, ACE_Str_Buf *data, int *flags) const
{
ACE_TRACE ("ACE_SPIPE_Stream::recv");
return ACE_OS::getmsg (this->get_handle (), (strbuf *) cntl, (strbuf *) data, flags);
}
+
ACE_INLINE ssize_t
ACE_SPIPE_Stream::send (const ACE_Str_Buf *cntl, const ACE_Str_Buf *data, int band, int flags) const
{
ACE_TRACE ("ACE_SPIPE_Stream::send");
return ACE_OS::putpmsg (this->get_handle (), (strbuf *) cntl, (strbuf *) data, band, flags);
}
+
ACE_INLINE ssize_t
ACE_SPIPE_Stream::recv (ACE_Str_Buf *cntl, ACE_Str_Buf *data, int *band, int *flags) const
{
ACE_TRACE ("ACE_SPIPE_Stream::recv");
return ACE_OS::getpmsg (this->get_handle (), (strbuf *) cntl, (strbuf *) data, band, flags);
}
+
ACE_INLINE ssize_t
ACE_SPIPE_Stream::send (const iovec iov[], int n) const
{
ACE_TRACE ("ACE_SPIPE_Stream::send");
return ACE_OS::writev (this->get_handle (), iov, n);
}
+
ACE_INLINE ssize_t
ACE_SPIPE_Stream::recv (iovec iov[], int n) const
{
ACE_TRACE ("ACE_SPIPE_Stream::recv");
return ACE_OS::readv (this->get_handle (), iov, n);
}
+
// This routine sends an open file descriptor to this socket.
+
ACE_INLINE int
ACE_SPIPE_Stream::send_handle (ACE_HANDLE handle) const
{
@@ -125,13 +143,16 @@ ACE_SPIPE_Stream::send_handle (ACE_HANDLE handle) const
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_STREAM_PIPES */
}
+
// This file receives an open file descriptor from this socket.
+
ACE_INLINE int
ACE_SPIPE_Stream::recv_handle (ACE_HANDLE &handle) const
{
ACE_TRACE ("ACE_SPIPE_Stream::recv_handle");
#if defined (ACE_HAS_STREAM_PIPES)
strrecvfd recvfd;
+
if (ACE_OS::ioctl (this->get_handle (), I_RECVFD, (void *) &recvfd) == -1)
return -1;
else
@@ -178,8 +199,10 @@ ACE_SPIPE_Stream::recv_handle (ACE_HANDLE &handle) const
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_STREAM_PIPES */
}
+
// This file receives an open file descriptor from this socket and
// also passes back the information about the address...
+
ACE_INLINE int
ACE_SPIPE_Stream::recv_handle (strrecvfd &recvfd) const
{
@@ -191,6 +214,7 @@ ACE_SPIPE_Stream::recv_handle (strrecvfd &recvfd) const
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_STREAM_PIPES */
}
+
ACE_INLINE ssize_t
ACE_SPIPE_Stream::send (const void *buf, size_t n,
ACE_OVERLAPPED *overlapped) const
@@ -200,6 +224,7 @@ ACE_SPIPE_Stream::send (const void *buf, size_t n,
(const char *) buf, n,
overlapped);
}
+
ACE_INLINE ssize_t
ACE_SPIPE_Stream::recv (void *buf, size_t n,
ACE_OVERLAPPED *overlapped) const
@@ -209,6 +234,7 @@ ACE_SPIPE_Stream::recv (void *buf, size_t n,
(char *) buf, n,
overlapped);
}
+
ACE_INLINE ssize_t
ACE_SPIPE_Stream::sendv_n (const iovec iov[],
int n) const
@@ -218,7 +244,9 @@ ACE_SPIPE_Stream::sendv_n (const iovec iov[],
iov,
n);
}
+
// Recv an n byte message from the Stream.
+
ACE_INLINE ssize_t
ACE_SPIPE_Stream::recvv_n (iovec iov[],
int n) const
@@ -230,7 +258,9 @@ ACE_SPIPE_Stream::recvv_n (iovec iov[],
iov,
n);
}
+
// Send an <iovec> of size <n> to the Stream.
+
ACE_INLINE ssize_t
ACE_SPIPE_Stream::sendv (const iovec iov[],
int n) const
@@ -240,5 +270,6 @@ ACE_SPIPE_Stream::sendv (const iovec iov[],
iov,
n);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/SString.cpp b/dep/ACE_wrappers/ace/SString.cpp
index 7a78334547c..9548a4e6f38 100644
--- a/dep/ACE_wrappers/ace/SString.cpp
+++ b/dep/ACE_wrappers/ace/SString.cpp
@@ -1,4 +1,5 @@
// $Id: SString.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Malloc_T.h"
#include "ace/OS_Memory.h"
#if !defined (ACE_HAS_WINCE)
@@ -8,20 +9,26 @@
#include "ace/Auto_Ptr.h"
#include "ace/OS_NS_string.h"
#include "ace/Numeric_Limits.h"
+
#if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
// FUZZ: disable check_for_streams_include
# include "ace/streams.h"
#endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */
+
#if !defined (__ACE_INLINE__)
#include "ace/SString.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID (ace,
SString,
"SString.cpp,v 4.61 2001/03/04 00:55:30 brunsch Exp")
+
// ************************************************************
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
#if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
ACE_OSTREAM_TYPE &
operator<< (ACE_OSTREAM_TYPE &os, const ACE_CString &cs)
@@ -30,6 +37,7 @@ operator<< (ACE_OSTREAM_TYPE &os, const ACE_CString &cs)
os << cs.fast_rep ();
return os;
}
+
ACE_OSTREAM_TYPE &
operator<< (ACE_OSTREAM_TYPE &os, const ACE_WString &ws)
{
@@ -43,6 +51,7 @@ operator<< (ACE_OSTREAM_TYPE &os, const ACE_WString &ws)
#endif
return os;
}
+
ACE_OSTREAM_TYPE &
operator<< (ACE_OSTREAM_TYPE &os, const ACE_SString &ss)
{
@@ -51,7 +60,9 @@ operator<< (ACE_OSTREAM_TYPE &os, const ACE_SString &ss)
return os;
}
#endif /* !ACE_LACKS_IOSTREAM_TOTALLY */
+
// *****************************************************************
+
char *
ACE_NS_WString::char_rep (void) const
{
@@ -61,17 +72,21 @@ ACE_NS_WString::char_rep (void) const
else
{
char *t = 0;
+
ACE_NEW_RETURN (t,
char[this->len_ + 1],
0);
+
for (size_type i = 0; i < this->len_; ++i)
// Note that this cast may lose data if wide chars are
// actually used!
t[i] = char (this->rep_[i]);
+
t[this->len_] = '\0';
return t;
}
}
+
ACE_USHORT16 *
ACE_NS_WString::ushort_rep (void) const
{
@@ -81,26 +96,33 @@ ACE_NS_WString::ushort_rep (void) const
else
{
ACE_USHORT16 *t = 0;
+
ACE_NEW_RETURN (t,
ACE_USHORT16[this->len_ + 1],
0);
+
for (size_type i = 0; i < this->len_; ++i)
// Note that this cast may lose data if wide chars are
// actually used!
t[i] = (ACE_USHORT16)this->rep_[i];
+
t[this->len_] = 0;
return t;
}
}
+
ACE_NS_WString::ACE_NS_WString (const char *s,
ACE_Allocator *alloc)
: ACE_WString (alloc)
{
if (s == 0)
return;
+
this->len_ = this->buf_len_ = ACE_OS::strlen (s);
+
if (this->buf_len_ == 0)
return;
+
ACE_ALLOCATOR (this->rep_,
(ACE_WSTRING_TYPE *)
this->allocator_->malloc ((this->buf_len_ + 1) *
@@ -109,6 +131,7 @@ ACE_NS_WString::ACE_NS_WString (const char *s,
for (size_type i = 0; i <= this->buf_len_; ++i)
this->rep_[i] = s[i];
}
+
#if defined (ACE_WSTRING_HAS_USHORT_SUPPORT)
ACE_NS_WString::ACE_NS_WString (const ACE_USHORT16 *s,
size_type len,
@@ -117,9 +140,12 @@ ACE_NS_WString::ACE_NS_WString (const ACE_USHORT16 *s,
{
if (s == 0)
return;
+
this->buf_len_ = len;
+
if (this->buf_len_ == 0)
return;
+
ACE_ALLOCATOR (this->rep_,
(ACE_WSTRING_TYPE *)
this->allocator_->malloc ((this->buf_len_) *
@@ -129,10 +155,14 @@ ACE_NS_WString::ACE_NS_WString (const ACE_USHORT16 *s,
this->rep_[i] = s[i];
}
#endif /* ACE_WSTRING_HAS_USHORT_SUPPORT */
+
// *****************************************************************
+
ACE_SString::size_type const ACE_SString::npos =
ACE_Numeric_Limits<ACE_SString::size_type>::max ();
+
ACE_ALLOC_HOOK_DEFINE(ACE_SString)
+
void
ACE_SString::dump (void) const
{
@@ -140,52 +170,69 @@ ACE_SString::dump (void) const
ACE_TRACE ("ACE_SString::dump");
#endif /* ACE_HAS_DUMP */
}
+
// Copy constructor.
+
ACE_SString::ACE_SString (const ACE_SString &s)
: allocator_ (s.allocator_),
len_ (s.len_)
{
ACE_TRACE ("ACE_SString::ACE_SString");
+
if (this->allocator_ == 0)
this->allocator_ = ACE_Allocator::instance ();
+
this->rep_ = (char *) this->allocator_->malloc (s.len_ + 1);
ACE_OS::memcpy ((void *) this->rep_,
(const void *) s.rep_,
this->len_);
this->rep_[this->len_] = '\0';
}
+
// Default constructor.
+
ACE_SString::ACE_SString (ACE_Allocator *alloc)
: allocator_ (alloc),
len_ (0),
rep_ (0)
+
{
ACE_TRACE ("ACE_SString::ACE_SString");
+
if (this->allocator_ == 0)
this->allocator_ = ACE_Allocator::instance ();
+
this->len_ = 0;
this->rep_ = (char *) this->allocator_->malloc (this->len_ + 1);
this->rep_[this->len_] = '\0';
}
+
// Set the underlying pointer (does not copy memory).
+
void
ACE_SString::rep (char *s)
{
ACE_TRACE ("ACE_SString::rep");
+
this->rep_ = s;
+
if (s == 0)
this->len_ = 0;
else
this->len_ = ACE_OS::strlen (s);
}
+
// Constructor that actually copies memory.
+
ACE_SString::ACE_SString (const char *s,
ACE_Allocator *alloc)
: allocator_ (alloc)
{
ACE_TRACE ("ACE_SString::ACE_SString");
+
if (this->allocator_ == 0)
this->allocator_ = ACE_Allocator::instance ();
+
if (s == 0)
{
this->len_ = 0;
@@ -199,27 +246,34 @@ ACE_SString::ACE_SString (const char *s,
ACE_OS::strcpy (this->rep_, s);
}
}
+
ACE_SString::ACE_SString (char c,
ACE_Allocator *alloc)
: allocator_ (alloc)
{
ACE_TRACE ("ACE_SString::ACE_SString");
+
if (this->allocator_ == 0)
this->allocator_ = ACE_Allocator::instance ();
+
this->len_ = 1;
this->rep_ = (char *) this->allocator_->malloc (this->len_ + 1);
this->rep_[0] = c;
this->rep_[this->len_] = '\0';
}
+
// Constructor that actually copies memory.
+
ACE_SString::ACE_SString (const char *s,
size_type len,
ACE_Allocator *alloc)
: allocator_ (alloc)
{
ACE_TRACE ("ACE_SString::ACE_SString");
+
if (this->allocator_ == 0)
this->allocator_ = ACE_Allocator::instance ();
+
if (s == 0)
{
this->len_ = 0;
@@ -234,12 +288,15 @@ ACE_SString::ACE_SString (const char *s,
this->rep_[len] = '\0'; // Make sure to NUL terminate this!
}
}
+
// Assignment operator (does copy memory).
+
ACE_SString &
ACE_SString::operator= (const ACE_SString &s)
{
ACE_TRACE ("ACE_SString::operator=");
// Check for identify.
+
if (this != &s)
{
// Only reallocate if we don't have enough space...
@@ -251,26 +308,34 @@ ACE_SString::operator= (const ACE_SString &s)
this->len_ = s.len_;
ACE_OS::strcpy (this->rep_, s.rep_);
}
+
return *this;
}
+
// Return substring.
ACE_SString
ACE_SString::substring (size_type offset,
size_type length) const
{
size_t count = length;
+
// case 1. empty string
if (len_ == 0)
return ACE_SString ();
+
// case 2. start pos l
if (offset >= len_)
return ACE_SString ();
+
// get all remaining bytes
if (length == npos || count > (this->len_ - offset))
count = len_ - offset;
+
return ACE_SString (&rep_[offset], count, this->allocator_);
}
+
// ************************************************************
+
ACE_Tokenizer::ACE_Tokenizer (ACE_TCHAR *buffer)
: buffer_ (buffer),
index_ (0),
@@ -278,16 +343,19 @@ ACE_Tokenizer::ACE_Tokenizer (ACE_TCHAR *buffer)
delimiter_index_ (0)
{
}
+
int
ACE_Tokenizer::delimiter (ACE_TCHAR d)
{
if (delimiter_index_ == MAX_DELIMITERS)
return -1;
+
delimiters_[delimiter_index_].delimiter_ = d;
delimiters_[delimiter_index_].replace_ = 0;
delimiter_index_++;
return 0;
}
+
int
ACE_Tokenizer::delimiter_replace (ACE_TCHAR d,
ACE_TCHAR replacement)
@@ -302,14 +370,17 @@ ACE_Tokenizer::delimiter_replace (ACE_TCHAR d,
delimiters_[i].replace_ = 1;
return 0;
}
+
if (delimiter_index_ >= MAX_DELIMITERS)
return -1;
+
delimiters_[delimiter_index_].delimiter_ = d;
delimiters_[delimiter_index_].replacement_ = replacement;
delimiters_[delimiter_index_].replace_ = 1;
delimiter_index_++;
return 0;
}
+
int
ACE_Tokenizer::preserve_designators (ACE_TCHAR start,
ACE_TCHAR stop,
@@ -317,18 +388,21 @@ ACE_Tokenizer::preserve_designators (ACE_TCHAR start,
{
if (preserves_index_ == MAX_PRESERVES)
return -1;
+
preserves_[preserves_index_].start_ = start;
preserves_[preserves_index_].stop_ = stop;
preserves_[preserves_index_].strip_ = strip;
preserves_index_++;
return 0;
}
+
int
ACE_Tokenizer::is_delimiter (ACE_TCHAR d,
int &replace,
ACE_TCHAR &r)
{
replace = 0;
+
for (int x = 0; x < delimiter_index_; x++)
if (delimiters_[x].delimiter_ == d)
{
@@ -339,8 +413,10 @@ ACE_Tokenizer::is_delimiter (ACE_TCHAR d,
}
return 1;
}
+
return 0;
}
+
int
ACE_Tokenizer::is_preserve_designator (ACE_TCHAR start,
ACE_TCHAR &stop,
@@ -353,8 +429,10 @@ ACE_Tokenizer::is_preserve_designator (ACE_TCHAR start,
strip = preserves_[x].strip_;
return 1;
}
+
return 0;
}
+
ACE_TCHAR *
ACE_Tokenizer::next (void)
{
@@ -364,9 +442,11 @@ ACE_Tokenizer::next (void)
index_ = 0;
return 0;
}
+
ACE_TCHAR replacement = 0;
int replace;
ACE_TCHAR *next_token;
+
// Skip all leading delimiters.
for (;;)
{
@@ -377,6 +457,7 @@ ACE_Tokenizer::next (void)
index_ = 0;
return 0;
}
+
if (this->is_delimiter (buffer_[index_],
replace,
replacement))
@@ -384,9 +465,11 @@ ACE_Tokenizer::next (void)
else
break;
}
+
// When we reach this point, buffer_[index_] is a non-delimiter and
// not EOS - the start of our next_token.
next_token = buffer_ + index_;
+
// A preserved region is it's own token.
ACE_TCHAR stop;
int strip;
@@ -401,9 +484,11 @@ ACE_Tokenizer::next (void)
index_ = -1;
goto EXIT_LABEL;
}
+
if (buffer_[index_] == stop)
break;
}
+
if (strip)
{
// Skip start preserve designator.
@@ -413,13 +498,16 @@ ACE_Tokenizer::next (void)
// Increment to the next token.
index_++;
}
+
goto EXIT_LABEL;
}
+
// Step through finding the next delimiter or EOS.
for (;;)
{
// Advance pointer.
index_++;
+
// Check for delimiter.
if (this->is_delimiter (buffer_[index_],
replace,
@@ -428,15 +516,18 @@ ACE_Tokenizer::next (void)
// Replace the delimiter.
if (replace != 0)
buffer_[index_] = replacement;
+
// Move the pointer up and return.
index_++;
goto EXIT_LABEL;
}
+
// A preserve designator signifies the end of this token.
if (this->is_preserve_designator (buffer_[index_],
stop,
strip))
goto EXIT_LABEL;
+
// Check for end of string.
if (buffer_[index_] == '\0')
{
@@ -444,13 +535,17 @@ ACE_Tokenizer::next (void)
goto EXIT_LABEL;
}
}
+
EXIT_LABEL:
return next_token;
}
+
// *************************************************************
+
#if defined (ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION)
template char ACE_String_Base<char>::NULL_String_;
template ACE_WSTRING_TYPE ACE_String_Base<ACE_WSTRING_TYPE>::NULL_String_;
#endif /* ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/SString.h b/dep/ACE_wrappers/ace/SString.h
index d6187b3481f..b888521ba86 100644
--- a/dep/ACE_wrappers/ace/SString.h
+++ b/dep/ACE_wrappers/ace/SString.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file SString.h
@@ -8,17 +9,23 @@
* @author Douglas C. Schmidt (schmidt@cs.wustl.edu)
*/
//=============================================================================
+
#ifndef ACE_SSTRING_H
#define ACE_SSTRING_H
#include /**/ "ace/pre.h"
+
#include "ace/SStringfwd.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/String_Base.h"
+
#if !defined (ACE_DEFAULT_GROWSIZE)
#define ACE_DEFAULT_GROWSIZE 32
#endif /* ACE_DEFAULT_GROWSIZE */
+
#if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
#include "ace/iosfwd.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -26,11 +33,14 @@ ACE_Export ACE_OSTREAM_TYPE &operator << (ACE_OSTREAM_TYPE &, const ACE_CString
ACE_Export ACE_OSTREAM_TYPE &operator << (ACE_OSTREAM_TYPE &, const ACE_WString &);
ACE_END_VERSIONED_NAMESPACE_DECL
#endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
#if defined ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT
template class ACE_Export ACE_String_Base<char>;
template class ACE_Export ACE_String_Base<ACE_WSTRING_TYPE>;
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT */
+
/**
* @class ACE_NS_WString
*
@@ -42,15 +52,20 @@ template class ACE_Export ACE_String_Base<ACE_WSTRING_TYPE>;
class ACE_Export ACE_NS_WString : public ACE_WString
{
public:
+
using ACE_WString::size_type;
+
/// Default constructor.
ACE_NS_WString (ACE_Allocator *alloc = 0);
+
/// Constructor that copies @a s into dynamically allocated memory.
ACE_NS_WString (const char *s,
ACE_Allocator *alloc = 0);
+
/// Constructor that copies @a s into dynamically allocated memory.
ACE_NS_WString (const ACE_WSTRING_TYPE *s,
ACE_Allocator *alloc = 0);
+
#if defined (ACE_WSTRING_HAS_USHORT_SUPPORT)
/// Constructor that takes in a ushort16 string (mainly used by the
/// ACE Name_Space classes)
@@ -58,29 +73,38 @@ public:
size_type len,
ACE_Allocator *alloc = 0);
#endif /* ACE_WSTRING_HAS_USHORT_SUPPORT */
+
/// Constructor that copies @a len ACE_WSTRING_TYPE's of @a s into dynamically
/// allocated memory (will NUL terminate the result).
ACE_NS_WString (const ACE_WSTRING_TYPE *s,
size_type len,
ACE_Allocator *alloc = 0);
+
/// Constructor that dynamically allocates memory for @a len + 1
/// ACE_WSTRING_TYPE characters. The newly created memory is set memset to 0.
ACE_NS_WString (size_type len, ACE_Allocator *alloc = 0);
+
/// Copy constructor.
ACE_NS_WString (const ACE_NS_WString &s);
+
/// Constructor that copies @a c into dynamically allocated memory.
ACE_NS_WString (ACE_WSTRING_TYPE c, ACE_Allocator *alloc = 0);
+
/// Transform into a copy of the ASCII character representation.
/// (caller must delete)
char *char_rep (void) const;
+
/// Transform into a copy of a USHORT16 representation (caller must
/// delete). Note, behavior is undefined when sizeof (wchar_t) != 2.
ACE_USHORT16 *ushort_rep (void) const;
};
+
ACE_Export
ACE_NS_WString operator + (const ACE_NS_WString &,
const ACE_NS_WString &);
+
// -----------------------------------------------------------------
+
/**
* @class ACE_SString
*
@@ -103,91 +127,127 @@ ACE_NS_WString operator + (const ACE_NS_WString &,
class ACE_Export ACE_SString
{
public:
+
typedef ACE_Allocator::size_type size_type;
+
/// No position constant
static const size_type npos;
+
/// Default constructor.
ACE_SString (ACE_Allocator *alloc = 0);
+
/// Constructor that copies @a s into dynamically allocated memory.
ACE_SString (const char *s, ACE_Allocator *alloc = 0);
+
/// Constructor that copies @a len chars of @s into dynamically
/// allocated memory (will NUL terminate the result).
ACE_SString (const char *s, size_type len, ACE_Allocator *alloc = 0);
+
/// Copy constructor.
ACE_SString (const ACE_SString &);
+
/// Constructor that copies @a c into dynamically allocated memory.
ACE_SString (char c, ACE_Allocator *alloc = 0);
+
/// Default destructor.
~ACE_SString (void);
+
/// Return the <slot'th> character in the string (doesn't perform
/// bounds checking).
char operator [] (size_type slot) const;
+
/// Return the <slot'th> character by reference in the string
/// (doesn't perform bounds checking).
char &operator [] (size_type slot);
+
/// Assignment operator (does copy memory).
ACE_SString &operator = (const ACE_SString &);
+
/**
* Return a substring given an offset and length, if length == npos
* use rest of str return empty substring if offset or offset/length
* are invalid
*/
ACE_SString substring (size_type offset, size_type length = npos) const;
+
/// Same as substring
ACE_SString substr (size_type offset, size_type length = npos) const;
+
/// Returns a hash value for this string.
u_long hash (void) const;
+
/// Return the length of the string.
size_type length (void) const;
+
/// Set the underlying pointer. Since this does not copy memory or
/// delete existing memory use with extreme caution!!!
void rep (char *s);
+
/// Get the underlying pointer.
const char *rep (void) const;
+
/// Get the underlying pointer.
const char *fast_rep (void) const;
+
/// Same as STL String's <c_str> and <fast_rep>.
const char *c_str (void) const;
+
/// Comparison operator that will match substrings. Returns the
/// slot of the first location that matches, else @c npos.
size_type strstr (const ACE_SString &s) const;
+
/// Find <str> starting at pos. Returns the slot of the first
/// location that matches (will be >= pos), else npos.
size_type find (const ACE_SString &str, size_type pos = 0) const;
+
/// Find <s> starting at pos. Returns the slot of the first
/// location that matches (will be >= pos), else npos.
size_type find (const char *s, size_type pos = 0) const;
+
/// Find <c> starting at pos. Returns the slot of the first
/// location that matches (will be >= pos), else npos.
size_type find (char c, size_type pos = 0) const;
+
/// Find <c> starting at pos (counting from the end). Returns the
/// slot of the first location that matches, else npos.
size_type rfind (char c, size_type pos = npos) const;
+
/// Equality comparison operator (must match entire string).
bool operator == (const ACE_SString &s) const;
+
/// Less than comparison operator.
bool operator < (const ACE_SString &s) const;
+
/// Greater than comparison operator.
bool operator > (const ACE_SString &s) const;
+
/// Inequality comparison operator.
bool operator != (const ACE_SString &s) const;
+
/// Performs a <strcmp>-style comparison.
int compare (const ACE_SString &s) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Pointer to a memory allocator.
ACE_Allocator *allocator_;
+
/// Length of the ACE_SString (not counting the trailing '\0').
size_type len_;
+
/// Pointer to data.
char *rep_;
};
+
#if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
ACE_Export ACE_OSTREAM_TYPE &operator << (ACE_OSTREAM_TYPE &, const ACE_SString &);
#endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */
+
// This allows one to use W or C String based on the Unicode
// setting
#if defined (ACE_USES_WCHAR)
@@ -196,7 +256,9 @@ typedef ACE_WString ACE_TString;
typedef ACE_CString ACE_TString;
#endif /* ACE_USES_WCHAR */
+
// ************************************************************
+
/**
* @class ACE_Tokenizer
*
@@ -220,6 +282,7 @@ public:
* \sa preserve_designators
*/
ACE_Tokenizer (ACE_TCHAR *buffer);
+
/**
* \a d is a delimiter.
* \return Returns 0 on success, -1 if there is no memory left.
@@ -228,6 +291,7 @@ public:
* \verbatim
char buf[30];
ACE_OS::strcpy(buf, "William/Joseph/Hagins");
+
ACE_Tokenizer tok (buf);
tok.delimiter ('/');
for (char *p = tok.next (); p; p = tok.next ())
@@ -241,6 +305,7 @@ public:
Hagins \endverbatim
*/
int delimiter (ACE_TCHAR d);
+
/**
* \a d is a delimiter and, when found, will be replaced by
* \a replacement.
@@ -250,6 +315,7 @@ public:
* \verbatim
char buf[30];
ACE_OS::strcpy(buf, "William/Joseph/Hagins");
+
ACE_Tokenizer tok (buf);
tok.delimiter_replace ('/', 0);
for (char *p = tok.next (); p; p = tok.next ())
@@ -263,6 +329,7 @@ public:
Hagins \endverbatim
*/
int delimiter_replace (ACE_TCHAR d, ACE_TCHAR replacement);
+
/**
* Extract string between a pair of designator characters.
* For instance, quotes, or '(' and ')'.
@@ -276,6 +343,7 @@ public:
* \verbatim
char buf[30];
ACE_OS::strcpy(buf, "William(Joseph)Hagins");
+
ACE_Tokenizer tok (buf);
tok.preserve_designators ('(', ')', 0);
for (char *p = tok.next (); p; p = tok.next ())
@@ -292,6 +360,7 @@ public:
* \verbatim
char buf[30];
ACE_OS::strcpy(buf, "William(Joseph)Hagins");
+
ACE_Tokenizer tok (buf);
tok.preserve_designators ('(', ')', 1);
for (char *p = tok.next (); p; p = tok.next ())
@@ -305,24 +374,30 @@ public:
Hagins \endverbatim
*/
int preserve_designators (ACE_TCHAR start, ACE_TCHAR stop, int strip=1);
+
/// Returns the next token.
ACE_TCHAR *next (void);
+
enum {
MAX_DELIMITERS=16,
MAX_PRESERVES=16
};
+
protected:
/// Returns 1 if <d> is a delimiter, 0 otherwise. If <d> should be
/// replaced with @a r, <replace> is set to 1, otherwise 0.
int is_delimiter (ACE_TCHAR d, int &replace, ACE_TCHAR &r);
+
/**
* If <start> is a start preserve designator, returns 1 and sets
* <stop> to the stop designator. Returns 0 if <start> is not a
* preserve designator.
*/
int is_preserve_designator (ACE_TCHAR start, ACE_TCHAR &stop, int &strip);
+
ACE_TCHAR *buffer_;
int index_;
+
/**
* @class Preserve_Entry
*
@@ -347,10 +422,13 @@ protected:
ACE_TCHAR stop_;
int strip_;
};
+
/// The application can specify MAX_PRESERVES preserve designators.
Preserve_Entry preserves_[MAX_PRESERVES];
+
/// Pointer to the next free spot in preserves_.
int preserves_index_;
+
/**
* @class Delimiter_Entry
*
@@ -372,12 +450,16 @@ protected:
ACE_TCHAR replacement_;
int replace_;
};
+
/// The tokenizer allows MAX_DELIMITERS number of delimiters.
Delimiter_Entry delimiters_[MAX_DELIMITERS];
+
/// Pointer to the next free space in delimiters_.
int delimiter_index_;
};
+
// ****************************************************************
+
/**
* @class ACE_Auto_String_Free
*
@@ -396,18 +478,23 @@ public:
ACE_Auto_String_Free (ACE_Auto_String_Free &rhs);
ACE_Auto_String_Free& operator= (ACE_Auto_String_Free &rhs);
~ACE_Auto_String_Free (void);
+
char* operator* () const;
char operator[] (size_t i) const;
char* get (void) const;
char* release (void);
void reset (char* p = 0);
+
private:
char* p_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/SString.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_SSTRING_H */
diff --git a/dep/ACE_wrappers/ace/SString.inl b/dep/ACE_wrappers/ace/SString.inl
index fba59efaab4..2e4957e2397 100644
--- a/dep/ACE_wrappers/ace/SString.inl
+++ b/dep/ACE_wrappers/ace/SString.inl
@@ -1,19 +1,24 @@
// -*- C++ -*-
//
// $Id: SString.inl 80826 2008-03-04 14:51:23Z wotte $
+
// Include ACE.h only if it hasn't already been included, e.g., if
// ACE_TEMPLATES_REQUIRE_SOURCE, ACE.h won't have been pulled in by
// String_Base.cpp.
#ifndef ACE_ACE_H
# include "ace/ACE.h"
#endif /* !ACE_ACE_H */
+
#include "ace/OS_NS_stdlib.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_NS_WString::ACE_NS_WString (ACE_Allocator *alloc)
: ACE_WString (alloc)
{
}
+
ACE_INLINE
ACE_NS_WString::ACE_NS_WString (const ACE_WSTRING_TYPE *s,
size_type len,
@@ -21,27 +26,32 @@ ACE_NS_WString::ACE_NS_WString (const ACE_WSTRING_TYPE *s,
: ACE_WString (s, len, alloc)
{
}
+
ACE_INLINE
ACE_NS_WString::ACE_NS_WString (const ACE_WSTRING_TYPE *s,
ACE_Allocator *alloc)
: ACE_WString (s, alloc)
{
}
+
ACE_INLINE
ACE_NS_WString::ACE_NS_WString (size_type len, ACE_Allocator *alloc)
: ACE_WString (len, 0, alloc)
{
}
+
ACE_INLINE
ACE_NS_WString::ACE_NS_WString (const ACE_NS_WString &s)
: ACE_WString (s)
{
}
+
ACE_INLINE
ACE_NS_WString::ACE_NS_WString (ACE_WSTRING_TYPE c, ACE_Allocator *alloc)
: ACE_WString (c, alloc)
{
}
+
ACE_INLINE ACE_NS_WString
operator+ (const ACE_NS_WString &s, const ACE_NS_WString &t)
{
@@ -49,53 +59,68 @@ operator+ (const ACE_NS_WString &s, const ACE_NS_WString &t)
temp += t;
return temp;
}
+
// -------------------------------------------------------
+
ACE_INLINE
ACE_SString::~ACE_SString (void)
{
}
+
ACE_INLINE ACE_SString
ACE_SString::substr (size_type offset,
size_type length) const
{
return this->substring (offset, length);
}
+
// Return the <slot'th> character in the string.
+
ACE_INLINE char
ACE_SString::operator[] (size_type slot) const
{
ACE_TRACE ("ACE_SString::operator[]");
return this->rep_[slot];
}
+
// Return the <slot'th> character in the string by reference.
+
ACE_INLINE char &
ACE_SString::operator[] (size_type slot)
{
ACE_TRACE ("ACE_SString::operator[]");
return this->rep_[slot];
}
+
// Get the underlying pointer (does not make a copy, so beware!).
+
ACE_INLINE const char *
ACE_SString::rep (void) const
{
ACE_TRACE ("ACE_SString::rep");
return this->rep_;
}
+
// Get the underlying pointer (does not make a copy, so beware!).
+
ACE_INLINE const char *
ACE_SString::fast_rep (void) const
{
ACE_TRACE ("ACE_SString::fast_rep");
return this->rep_;
}
+
// Get the underlying pointer (does not make a copy, so beware!).
+
ACE_INLINE const char *
ACE_SString::c_str (void) const
{
ACE_TRACE ("ACE_SString::c_str");
return this->rep_;
}
+
// Comparison operator.
+
ACE_INLINE bool
ACE_SString::operator== (const ACE_SString &s) const
{
@@ -103,37 +128,47 @@ ACE_SString::operator== (const ACE_SString &s) const
return this->len_ == s.len_
&& ACE_OS::strcmp (this->rep_, s.rep_) == 0;
}
+
// Less than comparison operator.
+
ACE_INLINE bool
ACE_SString::operator < (const ACE_SString &s) const
{
ACE_TRACE ("ACE_SString::operator <");
+
return (this->rep_ && s.rep_)
? ACE_OS::strcmp (this->rep_, s.rep_) < 0
: ((s.rep_) ? true : false);
}
+
// Greater than comparison operator.
+
ACE_INLINE bool
ACE_SString::operator > (const ACE_SString &s) const
{
ACE_TRACE ("ACE_SString::operator >");
+
return (this->rep_ && s.rep_)
? ACE_OS::strcmp (this->rep_, s.rep_) > 0
: ((this->rep_) ? true : false );
}
+
// Comparison operator.
+
ACE_INLINE bool
ACE_SString::operator!= (const ACE_SString &s) const
{
ACE_TRACE ("ACE_SString::operator!=");
return !(*this == s);
}
+
ACE_INLINE int
ACE_SString::compare (const ACE_SString &s) const
{
ACE_TRACE ("ACE_SString::compare");
return ACE_OS::strcmp (this->rep_, s.rep_);
}
+
ACE_INLINE ACE_SString::size_type
ACE_SString::find (const char *s, size_type pos) const
{
@@ -144,6 +179,7 @@ ACE_SString::find (const char *s, size_type pos) const
else
return pointer - this->rep_;
}
+
ACE_INLINE ACE_SString::size_type
ACE_SString::find (char c, size_type pos) const
{
@@ -154,57 +190,69 @@ ACE_SString::find (char c, size_type pos) const
else
return pointer - this->rep_;
}
+
ACE_INLINE ACE_SString::size_type
ACE_SString::strstr (const ACE_SString &s) const
{
ACE_TRACE ("ACE_SString::strstr");
+
return this->find (s.rep_);
}
+
ACE_INLINE ACE_SString::size_type
ACE_SString::find (const ACE_SString &str, size_type pos) const
{
return this->find (str.rep_, pos);
}
+
ACE_INLINE ACE_SString::size_type
ACE_SString::rfind (char c, size_type pos) const
{
if (pos == ACE_SString::npos)
pos = this->len_;
+
// Do not change to prefix operator! Proper operation of this loop
// depends on postfix decrement behavior.
for (size_type i = pos; i-- != 0; )
if (this->rep_[i] == c)
return i;
+
return ACE_SString::npos;
}
+
ACE_INLINE u_long
ACE_SString::hash (void) const
{
return ACE::hash_pjw (this->rep_);
}
+
ACE_INLINE ACE_SString::size_type
ACE_SString::length (void) const
{
ACE_TRACE ("ACE_SString::length");
return this->len_;
}
+
ACE_INLINE
ACE_Auto_String_Free::ACE_Auto_String_Free (char* p)
: p_ (p)
{
}
+
ACE_INLINE
ACE_Auto_String_Free::ACE_Auto_String_Free (ACE_Auto_String_Free& rhs)
: p_ (rhs.p_)
{
rhs.p_ = 0;
}
+
ACE_INLINE void
ACE_Auto_String_Free::reset (char* p)
{
ACE_OS::free (this->p_);
this->p_ = p;
}
+
ACE_INLINE ACE_Auto_String_Free&
ACE_Auto_String_Free::operator= (ACE_Auto_String_Free& rhs)
{
@@ -215,26 +263,31 @@ ACE_Auto_String_Free::operator= (ACE_Auto_String_Free& rhs)
}
return *this;
}
+
ACE_INLINE
ACE_Auto_String_Free::~ACE_Auto_String_Free (void)
{
this->reset (0);
}
+
ACE_INLINE char*
ACE_Auto_String_Free::operator* (void) const
{
return this->p_;
}
+
ACE_INLINE char
ACE_Auto_String_Free::operator[] (size_t i) const
{
return this->p_[i];
}
+
ACE_INLINE char*
ACE_Auto_String_Free::get (void) const
{
return this->p_;
}
+
ACE_INLINE char*
ACE_Auto_String_Free::release (void)
{
@@ -242,4 +295,5 @@ ACE_Auto_String_Free::release (void)
this->p_ = 0;
return p;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/SStringfwd.h b/dep/ACE_wrappers/ace/SStringfwd.h
index 781deaa6cfd..f73a39d023b 100644
--- a/dep/ACE_wrappers/ace/SStringfwd.h
+++ b/dep/ACE_wrappers/ace/SStringfwd.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file SStringfwd.h
@@ -12,23 +13,33 @@
* @author Ossama Othman <ossama@uci.edu>
*/
//=============================================================================
+
#ifndef ACE_SSTRINGFWD_H
#define ACE_SSTRINGFWD_H
+
#include /**/ "ace/pre.h"
+
#include "ace/Basic_Types.h" /* ACE_WCHAR_T definition */
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if (defined (__HP_aCC) && (36300 <= __HP_aCC) && (__HP_aCC <= 37300))
// Due to a bug in the aCC 3.xx compiler need to define the ACE_String_Base
// template before we can typedef ACE_CString
# include "ace/String_Base.h"
#endif /* __HP_aCC */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template <class CHAR> class ACE_String_Base; // Forward declaration.
+
typedef ACE_WCHAR_T ACE_WSTRING_TYPE;
+
typedef ACE_String_Base<char> ACE_CString;
typedef ACE_String_Base<ACE_WSTRING_TYPE> ACE_WString;
+
// This allows one to use W or C String based on the Unicode
// setting
#if defined (ACE_USES_WCHAR)
@@ -36,7 +47,10 @@ typedef ACE_WString ACE_TString;
#else /* ACE_USES_WCHAR */
typedef ACE_CString ACE_TString;
#endif /* ACE_USES_WCHAR */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
+
#endif /* ACE_SSTRINGFWD_H */
diff --git a/dep/ACE_wrappers/ace/SUN_Proactor.cpp b/dep/ACE_wrappers/ace/SUN_Proactor.cpp
index fe682a02d25..56f2431c86e 100644
--- a/dep/ACE_wrappers/ace/SUN_Proactor.cpp
+++ b/dep/ACE_wrappers/ace/SUN_Proactor.cpp
@@ -1,15 +1,21 @@
// $Id: SUN_Proactor.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/SUN_Proactor.h"
+
#if defined (ACE_HAS_AIO_CALLS) && defined (sun)
+
#include "ace/Task_T.h"
#include "ace/Log_Msg.h"
#include "ace/Object_Manager.h"
+
ACE_RCSID (ace,
POSIX_CB_Proactor,
"$Id: SUN_Proactor.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_SUN_Proactor::ACE_SUN_Proactor (size_t max_aio_operations)
: ACE_POSIX_AIOCB_Proactor (max_aio_operations,
ACE_POSIX_Proactor::PROACTOR_SUN),
@@ -17,15 +23,19 @@ ACE_SUN_Proactor::ACE_SUN_Proactor (size_t max_aio_operations)
{
// To provide correct virtual calls.
create_notify_manager ();
+
// we should start pseudo-asynchronous accept task
// one per all future acceptors
+
this->get_asynch_pseudo_task ().start ();
}
+
// Destructor.
ACE_SUN_Proactor::~ACE_SUN_Proactor (void)
{
this->close ();
}
+
int
ACE_SUN_Proactor::handle_events (ACE_Time_Value &wait_time)
{
@@ -33,31 +43,42 @@ ACE_SUN_Proactor::handle_events (ACE_Time_Value &wait_time)
ACE_Countdown_Time countdown (&wait_time);
return this->handle_events_i (&wait_time);
}
+
int
ACE_SUN_Proactor::handle_events (void)
{
return this->handle_events_i (0);
}
+
int ACE_SUN_Proactor::wait_for_start (ACE_Time_Value * abstime)
{
#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
+
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1));
+
if (this->num_started_aio_ != 0) // double check
return 0;
+
return this->condition_.wait (abstime);
+
#else
+
return 0; // or -1 ???
+
#endif /* ACE_MT_SAFE */
}
+
int
ACE_SUN_Proactor::handle_events_i (ACE_Time_Value *delta)
{
int retval = 0;
aio_result_t *result = 0;
+
if (0 == delta)
{
if (this->num_started_aio_ == 0)
this->wait_for_start (0);
+
result = aiowait (0);
}
else
@@ -74,6 +95,7 @@ ACE_SUN_Proactor::handle_events_i (ACE_Time_Value *delta)
struct timeval delta_tv = *delta;
result = aiowait (&delta_tv);
}
+
if (result == 0)
{
// timeout, do nothing,
@@ -87,6 +109,7 @@ ACE_SUN_Proactor::handle_events_i (ACE_Time_Value *delta)
case EINTR : // aiowait() was interrupted by a signal.
case EINVAL: // there are no outstanding asynchronous I/O requests.
break; // we should process "post_completed" queue
+
default: // EFAULT
ACE_ERROR_RETURN ((LM_ERROR,
"%N:%l:(%P | %t)::%p \nNumAIO=%d\n",
@@ -99,10 +122,12 @@ ACE_SUN_Proactor::handle_events_i (ACE_Time_Value *delta)
{
int error_status = 0;
size_t transfer_count = 0;
+
ACE_POSIX_Asynch_Result *asynch_result =
find_completed_aio (result,
error_status,
transfer_count);
+
if (asynch_result != 0)
{
// Call the application code.
@@ -113,49 +138,65 @@ ACE_SUN_Proactor::handle_events_i (ACE_Time_Value *delta)
retval++;
}
}
+
// process post_completed results
retval += this->process_result_queue ();
+
return retval > 0 ? 1 : 0 ;
+
}
+
int
ACE_SUN_Proactor::get_result_status (ACE_POSIX_Asynch_Result* asynch_result,
int &error_status,
size_t &transfer_count)
{
+
// Get the error status of the aio_ operation.
error_status = asynch_result->aio_resultp.aio_errno;
ssize_t op_return = asynch_result->aio_resultp.aio_return;
+
// ****** from Sun man pages *********************
// Upon completion of the operation both aio_return and aio_errno
// are set to reflect the result of the operation.
// AIO_INPROGRESS is not a value used by the system
// so the client may detect a change in state
// by initializing aio_return to this value.
+
if (error_status == EINPROGRESS || op_return == AIO_INPROGRESS)
return 0; // not completed
+
if (op_return < 0)
transfer_count = 0; // zero bytes transferred
else
transfer_count = static_cast<size_t> (op_return);
+
return 1; // completed
}
+
ACE_POSIX_Asynch_Result *
ACE_SUN_Proactor::find_completed_aio (aio_result_t *result,
int &error_status,
size_t &transfer_count)
{
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, 0));
+
size_t ai;
error_status = -1;
transfer_count = 0;
+
// we call find_completed_aio always with result != 0
+
for (ai = 0; ai < aiocb_list_max_size_; ai++)
if (aiocb_list_[ai] != 0 && //check for non zero
result == &aiocb_list_[ai]->aio_resultp)
break;
+
if (ai >= aiocb_list_max_size_) // not found
return 0; // means somebody else uses aio directly!!!
+
ACE_POSIX_Asynch_Result *asynch_result = result_list_[ai];
+
if (this->get_result_status (asynch_result,
error_status,
transfer_count) == 0)
@@ -166,25 +207,33 @@ ACE_SUN_Proactor::find_completed_aio (aio_result_t *result,
"should never be !!!\n"));
return 0;
}
+
aiocb_list_[ai] = 0;
result_list_[ai] = 0;
aiocb_list_cur_size_--;
+
num_started_aio_--;
+
start_deferred_aio ();
//make attempt to start deferred AIO
//It is safe as we are protected by mutex_
+
return asynch_result;
}
+
// start_aio_i has new return codes
// 0 successful start
// 1 try later, OS queue overflow
// -1 invalid request and other errors
+
int
ACE_SUN_Proactor::start_aio_i (ACE_POSIX_Asynch_Result *result)
{
ACE_TRACE ("ACE_SUN_Proactor::start_aio_i");
+
int ret_val;
const ACE_TCHAR *ptype;
+
// ****** from Sun man pages *********************
// Upon completion of the operation both aio_return and aio_errno
// are set to reflect the result of the operation.
@@ -193,6 +242,7 @@ ACE_SUN_Proactor::start_aio_i (ACE_POSIX_Asynch_Result *result)
// by initializing aio_return to this value.
result->aio_resultp.aio_return = AIO_INPROGRESS;
result->aio_resultp.aio_errno = EINPROGRESS;
+
// Start IO
switch (result->aio_lio_opcode)
{
@@ -205,6 +255,7 @@ ACE_SUN_Proactor::start_aio_i (ACE_POSIX_Asynch_Result *result)
SEEK_SET,
&result->aio_resultp);
break;
+
case LIO_WRITE :
ptype = ACE_TEXT ("write");
ret_val = aiowrite (result->aio_fildes,
@@ -214,11 +265,13 @@ ACE_SUN_Proactor::start_aio_i (ACE_POSIX_Asynch_Result *result)
SEEK_SET,
&result->aio_resultp);
break;
+
default:
ptype = ACE_TEXT ("?????");
ret_val = -1;
break;
}
+
if (ret_val == 0)
{
this->num_started_aio_++;
@@ -235,8 +288,10 @@ ACE_SUN_Proactor::start_aio_i (ACE_POSIX_Asynch_Result *result)
ptype,
ACE_TEXT ("queueing failed\n")));
}
+
return ret_val;
}
+
int
ACE_SUN_Proactor::cancel_aiocb (ACE_POSIX_Asynch_Result *result)
{
@@ -248,18 +303,23 @@ ACE_SUN_Proactor::cancel_aiocb (ACE_POSIX_Asynch_Result *result)
// so we should send notification
// to save POSIX behavoir.
// Also we should do this for deffered aio's
+
result->set_error (ECANCELED);
result->set_bytes_transferred (0);
this->putq_result (result);
return 0;
}
+
return 2;
}
+
ACE_POSIX_Proactor::Proactor_Type
ACE_SUN_Proactor::get_impl_type (void)
{
return PROACTOR_SUN;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_AIO_CALLS && sun */
diff --git a/dep/ACE_wrappers/ace/SUN_Proactor.h b/dep/ACE_wrappers/ace/SUN_Proactor.h
index 9e5b5bc2a55..135b0f0e8ff 100644
--- a/dep/ACE_wrappers/ace/SUN_Proactor.h
+++ b/dep/ACE_wrappers/ace/SUN_Proactor.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file SUN_Proactor.h
@@ -8,16 +9,23 @@
* @author Alexander Libman <alibman@baltimore.com>
*/
//=============================================================================
+
#ifndef ACE_SUN_PROACTOR_H
#define ACE_SUN_PROACTOR_H
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_AIO_CALLS) && defined (sun)
+
#include "ace/POSIX_Proactor.h"
#include /**/ <sys/asynch.h> // Sun native aio calls
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_SUN_Proactor
*
@@ -55,13 +63,17 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
*/
class ACE_Export ACE_SUN_Proactor : public ACE_POSIX_AIOCB_Proactor
{
+
public:
virtual Proactor_Type get_impl_type (void);
+
/// Destructor.
virtual ~ACE_SUN_Proactor (void);
+
/// Constructor defines max number asynchronous operations that can
/// be started at the same time.
ACE_SUN_Proactor (size_t max_aio_operations = ACE_AIO_DEFAULT_SIZE);
+
protected:
/**
* Dispatch a single set of events. If @a wait_time elapses before
@@ -70,6 +82,7 @@ protected:
* set accordingly.
*/
virtual int handle_events (ACE_Time_Value &wait_time);
+
/**
* Block indefinitely until at least one event is dispatched.
* Dispatch a single set of events. Return 1 on success i.e., when a
@@ -77,29 +90,38 @@ protected:
* set accordingly.
*/
virtual int handle_events (void);
+
/// Internal completion detection and dispatching.
int handle_events_i (ACE_Time_Value *delta);
+
/// Initiate an aio operation.
virtual int start_aio_i (ACE_POSIX_Asynch_Result *result);
+
/// Check AIO for completion, error and result status
/// Return: 1 - AIO completed , 0 - not completed yet
virtual int get_result_status (ACE_POSIX_Asynch_Result* asynch_result,
int &error_status,
size_t &transfer_count);
+
/// Extract the results of aio.
ACE_POSIX_Asynch_Result *find_completed_aio (aio_result_t *result,
int &error_status,
size_t &transfer_count);
+
/// From ACE_POSIX_AIOCB_Proactor.
/// Attempt to cancel running request
virtual int cancel_aiocb (ACE_POSIX_Asynch_Result *result);
+
/// Specific Sun aiowait
int wait_for_start (ACE_Time_Value * abstime);
+
/// Condition variable .
/// used to wait the first AIO start
ACE_SYNCH_CONDITION condition_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_AIO_CALLS && sun */
#endif /* ACE_SUN_PROACTOR_H*/
diff --git a/dep/ACE_wrappers/ace/SV_Message.cpp b/dep/ACE_wrappers/ace/SV_Message.cpp
index ca5dafb5725..b060172e5ef 100644
--- a/dep/ACE_wrappers/ace/SV_Message.cpp
+++ b/dep/ACE_wrappers/ace/SV_Message.cpp
@@ -1,12 +1,18 @@
// SV_Message.cpp
// $Id: SV_Message.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/SV_Message.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/SV_Message.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace, SV_Message, "$Id: SV_Message.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_SV_Message)
+
void
ACE_SV_Message::dump (void) const
{
@@ -14,5 +20,6 @@ ACE_SV_Message::dump (void) const
ACE_TRACE ("ACE_SV_Message::dump");
#endif /* ACE_HAS_DUMP */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/SV_Message.h b/dep/ACE_wrappers/ace/SV_Message.h
index 5772c34c45a..cb428f12a3d 100644
--- a/dep/ACE_wrappers/ace/SV_Message.h
+++ b/dep/ACE_wrappers/ace/SV_Message.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file SV_Message.h
@@ -9,14 +10,20 @@
*/
//==========================================================================
+
#ifndef ACE_SV_MESSAGE_H
#define ACE_SV_MESSAGE_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_SV_Message
*
@@ -27,25 +34,35 @@ class ACE_Export ACE_SV_Message
public:
/// Constructor
ACE_SV_Message (long type = 0);
+
/// Destructor
~ACE_SV_Message (void);
+
/// Get the message type.
long type (void) const;
+
/// Set the message type.
void type (long);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
/// Type of the message.
long type_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/SV_Message.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_SV_MESSAGE_H */
diff --git a/dep/ACE_wrappers/ace/SV_Message.inl b/dep/ACE_wrappers/ace/SV_Message.inl
index 9baf900e472..4f43c170ace 100644
--- a/dep/ACE_wrappers/ace/SV_Message.inl
+++ b/dep/ACE_wrappers/ace/SV_Message.inl
@@ -1,30 +1,37 @@
// -*- C++ -*-
//
// $Id: SV_Message.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Global_Macros.h"
#include "ace/config-all.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_SV_Message::ACE_SV_Message (long t)
: type_ (t)
{
ACE_TRACE ("ACE_SV_Message::ACE_SV_Message");
}
+
ACE_INLINE
ACE_SV_Message::~ACE_SV_Message (void)
{
ACE_TRACE ("ACE_SV_Message::~ACE_SV_Message");
}
+
ACE_INLINE long
ACE_SV_Message::type (void) const
{
ACE_TRACE ("ACE_SV_Message::type");
return this->type_;
}
+
ACE_INLINE void
ACE_SV_Message::type (long t)
{
ACE_TRACE ("ACE_SV_Message::type");
this->type_ = t;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/SV_Message_Queue.cpp b/dep/ACE_wrappers/ace/SV_Message_Queue.cpp
index 98627d2151e..917b36829a0 100644
--- a/dep/ACE_wrappers/ace/SV_Message_Queue.cpp
+++ b/dep/ACE_wrappers/ace/SV_Message_Queue.cpp
@@ -1,12 +1,18 @@
// $Id: SV_Message_Queue.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/SV_Message_Queue.h"
#include "ace/Log_Msg.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/SV_Message_Queue.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace, SV_Message_Queue, "$Id: SV_Message_Queue.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_SV_Message_Queue)
+
void
ACE_SV_Message_Queue::dump (void) const
{
@@ -14,14 +20,17 @@ ACE_SV_Message_Queue::dump (void) const
ACE_TRACE ("ACE_SV_Message_Queue::dump");
#endif /* ACE_HAS_DUMP */
}
+
ACE_SV_Message_Queue::ACE_SV_Message_Queue (void)
{
ACE_TRACE ("ACE_SV_Message_Queue::ACE_SV_Message_Queue");
}
+
ACE_SV_Message_Queue::~ACE_SV_Message_Queue (void)
{
ACE_TRACE ("ACE_SV_Message_Queue::~ACE_SV_Message_Queue");
}
+
ACE_SV_Message_Queue::ACE_SV_Message_Queue (key_t external_id,
int create,
int perms)
@@ -31,5 +40,6 @@ ACE_SV_Message_Queue::ACE_SV_Message_Queue (key_t external_id,
ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_SV_Message_Queue::ACE_SV_Message_Queue")));
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/SV_Message_Queue.h b/dep/ACE_wrappers/ace/SV_Message_Queue.h
index c76dd8c0884..660fc9efb7a 100644
--- a/dep/ACE_wrappers/ace/SV_Message_Queue.h
+++ b/dep/ACE_wrappers/ace/SV_Message_Queue.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file SV_Message_Queue.h
@@ -8,18 +9,25 @@
* @author Douglas C. Schmidt <schmidt@uci.edu>
*/
//===========================================================================
+
#ifndef ACE_SV_MESSAGE_QUEUE_H
#define ACE_SV_MESSAGE_QUEUE_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/SV_Message.h"
#include "ace/os_include/sys/os_stat.h"
#include "ace/os_include/sys/os_ipc.h"
#include "ace/Default_Constants.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_SV_Message_Queue
*
@@ -36,6 +44,7 @@ public:
ACE_OPEN = 0,
ACE_NOWAIT = IPC_NOWAIT
};
+
// = Initialization and termination methods.
/// Open a message queue using the <external_id>.
ACE_SV_Message_Queue (void);
@@ -45,38 +54,53 @@ public:
int open (key_t external_id,
int create = ACE_SV_Message_Queue::ACE_OPEN,
int perms = ACE_DEFAULT_FILE_PERMS);
+
~ACE_SV_Message_Queue (void);
+
/// Close down this instance of the message queue without removing it
/// from the system.
int close (void);
+
/// Close down and remove the message queue from the system.
int remove (void);
+
// = Message transfer methods.
ssize_t recv (ACE_SV_Message &mb,
int length,
long mtype = 0,
int mflags = 0);
+
int send (const ACE_SV_Message &mb,
int length,
int mflags = 0);
+
/// Access the underlying control operations.
int control (int option, void *arg = 0);
+
/// Get the underly internal id.
int get_id (void) const;
+
/// Set the underly internal id.
void set_id (int);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
/// Returned from the underlying <msgget> system call.
int internal_id_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/SV_Message_Queue.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_SV_MESSAGE_QUEUE_H */
diff --git a/dep/ACE_wrappers/ace/SV_Message_Queue.inl b/dep/ACE_wrappers/ace/SV_Message_Queue.inl
index ed33209fb2b..f8118bd7604 100644
--- a/dep/ACE_wrappers/ace/SV_Message_Queue.inl
+++ b/dep/ACE_wrappers/ace/SV_Message_Queue.inl
@@ -1,17 +1,23 @@
// -*- C++ -*-
//
// $Id: SV_Message_Queue.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Global_Macros.h"
#include "ace/OS_NS_sys_msg.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Open a message queue using the <external_id>.
+
ACE_INLINE int
ACE_SV_Message_Queue::open (key_t external_id, int create, int perms)
{
ACE_TRACE ("ACE_SV_Message_Queue::open");
return this->internal_id_ = ACE_OS::msgget (external_id, create | perms);
}
+
// What does it mean to close a message queue?!
+
ACE_INLINE int
ACE_SV_Message_Queue::close (void)
{
@@ -19,6 +25,7 @@ ACE_SV_Message_Queue::close (void)
this->internal_id_ = -1;
return 1;
}
+
ACE_INLINE int
ACE_SV_Message_Queue::control (int option, void *arg)
{
@@ -26,6 +33,7 @@ ACE_SV_Message_Queue::control (int option, void *arg)
return ACE_OS::msgctl (this->internal_id_, option,
(struct msqid_ds *) arg);
}
+
ACE_INLINE int
ACE_SV_Message_Queue::remove (void)
{
@@ -34,18 +42,21 @@ ACE_SV_Message_Queue::remove (void)
this->internal_id_ = -1;
return result;
}
+
ACE_INLINE int
ACE_SV_Message_Queue::get_id (void) const
{
ACE_TRACE ("ACE_SV_Message_Queue::get_id");
return this->internal_id_;
}
+
ACE_INLINE void
ACE_SV_Message_Queue::set_id (int id)
{
ACE_TRACE ("ACE_SV_Message_Queue::set_id");
this->internal_id_ = id;
}
+
ACE_INLINE ssize_t
ACE_SV_Message_Queue::recv (ACE_SV_Message &mb,
int length,
@@ -56,6 +67,7 @@ ACE_SV_Message_Queue::recv (ACE_SV_Message &mb,
return ACE_OS::msgrcv (this->internal_id_, (void *) &mb,
length, type, mflags);
}
+
ACE_INLINE int
ACE_SV_Message_Queue::send (const ACE_SV_Message &mb,
int length,
@@ -65,4 +77,5 @@ ACE_SV_Message_Queue::send (const ACE_SV_Message &mb,
return ACE_OS::msgsnd (this->internal_id_, (void *) &mb,
length, mflags);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/SV_Semaphore_Complex.cpp b/dep/ACE_wrappers/ace/SV_Semaphore_Complex.cpp
index 0fd3de22f50..8ff99c052be 100644
--- a/dep/ACE_wrappers/ace/SV_Semaphore_Complex.cpp
+++ b/dep/ACE_wrappers/ace/SV_Semaphore_Complex.cpp
@@ -1,14 +1,20 @@
// SV_Semaphore_Complex.cpp
// $Id: SV_Semaphore_Complex.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/SV_Semaphore_Complex.h"
#include "ace/Log_Msg.h"
#include "ace/OS_NS_Thread.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/SV_Semaphore_Complex.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace, SV_Semaphore_Complex, "$Id: SV_Semaphore_Complex.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_SV_Semaphore_Complex)
+
void
ACE_SV_Semaphore_Complex::dump (void) const
{
@@ -16,8 +22,10 @@ ACE_SV_Semaphore_Complex::dump (void) const
ACE_TRACE ("ACE_SV_Semaphore_Complex::dump");
#endif /* ACE_HAS_DUMP */
}
+
// initial value of process
const int ACE_SV_Semaphore_Complex::BIGCOUNT_ = 10000;
+
// Define the ACE_SV_Semaphore operation arrays for the semop() calls.
sembuf ACE_SV_Semaphore_Complex::op_lock_[2] =
{
@@ -26,6 +34,7 @@ sembuf ACE_SV_Semaphore_Complex::op_lock_[2] =
// UNDO to release the lock if processes exit
// before explicitly unlocking.
};
+
sembuf ACE_SV_Semaphore_Complex::op_endcreate_[2] =
{
{1, -1, SEM_UNDO}, // Decrement [1] (proc counter) with undo on
@@ -33,22 +42,27 @@ sembuf ACE_SV_Semaphore_Complex::op_endcreate_[2] =
// process exits before explicitly calling close()
{0, -1, SEM_UNDO}, // the decrement [0] (lock) back to 0
};
+
sembuf ACE_SV_Semaphore_Complex::op_open_[1] =
{
{1, -1, SEM_UNDO}, // Decrement [1] (proc counter) with undo on
// exit.
};
+
sembuf ACE_SV_Semaphore_Complex::op_close_[3] =
{
{0, 0, 0}, // Wait for [0] (lock) to equal 0
{0, 1, SEM_UNDO}, // then increment [0] to 1 - this lock it
{1, 1, SEM_UNDO}, // then increment [1] (proc counter)
};
+
sembuf ACE_SV_Semaphore_Complex::op_unlock_[1] =
{
{0, -1, SEM_UNDO}, // Decrement [0] (lock) back to 0
};
+
// Open or create an array of SV_Semaphores. We return 0 if all is OK, else -1.
+
int
ACE_SV_Semaphore_Complex::open (key_t k,
short create,
@@ -59,25 +73,32 @@ ACE_SV_Semaphore_Complex::open (key_t k,
ACE_TRACE ("ACE_SV_Semaphore_Complex::open");
if (k == IPC_PRIVATE)
return -1;
+
this->key_ = k;
+
// Must include a count for the 2 additional semaphores we use
// internally.
this->sem_number_ = nsems + 2;
+
if (create == ACE_SV_Semaphore_Complex::ACE_CREATE)
{
int result;
+
do
{
this->internal_id_ = ACE_OS::semget
(this->key_,
(u_short) 2 + nsems,
perms | ACE_SV_Semaphore_Complex::ACE_CREATE);
+
if (this->internal_id_ == -1)
return -1; // permission problem or tables full
+
// When the <ACE_SV_Semaphore_Complex> is created, we know
// that the value of all 3 members is 0. Get a lock on the
// <ACE_SV_Semaphore_Complex> by waiting for [0] to equal 0,
// then increment it.
+
// There is a race condition here. There is the possibility
// that between the <semget> above and the <semop> below,
// another process can call out <close> function which can
@@ -90,11 +111,15 @@ ACE_SV_Semaphore_Complex::open (key_t k,
2);
}
while (result == -1 && (errno == EINVAL || errno == EIDRM));
+
if (result == -1)
return -1;
+
// Get the value of the process counter. If it equals 0, then no
// one has initialized the ACE_SV_Semaphore yet.
+
int semval = ACE_SV_Semaphore_Simple::control (GETVAL, 0, 1);
+
if (semval == -1)
return this->init ();
else if (semval == 0)
@@ -103,6 +128,7 @@ ACE_SV_Semaphore_Complex::open (key_t k,
// clear the adjust value that we set when we locked the
// ACE_SV_Semaphore above. Instead we do system calls to
// initialize [1], as well as all the nsems SV_Semaphores.
+
if (ACE_SV_Semaphore_Simple::control (SETVAL,
ACE_SV_Semaphore_Complex::BIGCOUNT_,
1) == -1)
@@ -112,6 +138,7 @@ ACE_SV_Semaphore_Complex::open (key_t k,
if (this->control (SETVAL, initial_value, i) == -1)
return -1;
}
+
// Decrement the process counter and then release the lock.
return ACE_OS::semop (this->internal_id_,
&ACE_SV_Semaphore_Complex::op_endcreate_[0],
@@ -122,6 +149,7 @@ ACE_SV_Semaphore_Complex::open (key_t k,
this->internal_id_ = ACE_OS::semget (this->key_, 2 + nsems, 0);
if (this->internal_id_ == -1)
return -1; // doesn't exist or tables full
+
// Decrement the process counter. We don't need a lock to do this.
if (ACE_OS::semop (this->internal_id_,
&ACE_SV_Semaphore_Complex::op_open_[0], 1) < 0)
@@ -129,6 +157,7 @@ ACE_SV_Semaphore_Complex::open (key_t k,
return 0;
}
}
+
int
ACE_SV_Semaphore_Complex::open (const char *name,
short flags,
@@ -140,29 +169,37 @@ ACE_SV_Semaphore_Complex::open (const char *name,
return this->open (ACE_SV_Semaphore_Simple::name_2_key (name),
flags, initial_value, nsems, perms);
}
+
// Close a ACE_SV_Semaphore. Unlike the remove above, this function
// is for a process to call before it exits, when it is done with the
// ACE_SV_Semaphore. We "decrement" the counter of processes using
// the ACE_SV_Semaphore, and if this was the last one, we can remove
// the ACE_SV_Semaphore.
+
int
ACE_SV_Semaphore_Complex::close (void)
{
ACE_TRACE ("ACE_SV_Semaphore_Complex::close");
int semval;
+
if (this->key_ == (key_t) - 1 || this->internal_id_ == -1)
return -1;
+
// The following semop() first gets a lock on the ACE_SV_Semaphore,
// then increments [1] - the process number.
+
if (ACE_OS::semop (this->internal_id_,
&ACE_SV_Semaphore_Complex::op_close_[0],
3) == -1)
return -1;
+
// Now that we have a lock, read the value of the process counter to
// see if this is the last reference to the ACE_SV_Semaphore. There
// is a race condition here - see the comments in create ().
+
if ((semval = ACE_SV_Semaphore_Simple::control (GETVAL, 0, 1)) == -1)
return -1;
+
if (semval > ACE_SV_Semaphore_Complex::BIGCOUNT_)
return -1;
else if (semval == ACE_SV_Semaphore_Complex::BIGCOUNT_)
@@ -175,6 +212,7 @@ ACE_SV_Semaphore_Complex::close (void)
return result;
}
}
+
ACE_SV_Semaphore_Complex::ACE_SV_Semaphore_Complex (key_t k,
short flags,
int initial_value,
@@ -185,6 +223,7 @@ ACE_SV_Semaphore_Complex::ACE_SV_Semaphore_Complex (key_t k,
if (this->open (k, flags, initial_value, nsems, perms) == -1)
ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ACE_SV_Semaphore_Complex")));
}
+
ACE_SV_Semaphore_Complex::ACE_SV_Semaphore_Complex (const char *name,
short flags,
int initial_value,
@@ -192,24 +231,30 @@ ACE_SV_Semaphore_Complex::ACE_SV_Semaphore_Complex (const char *name,
mode_t perms)
{
ACE_TRACE ("ACE_SV_Semaphore_Complex::ACE_SV_Semaphore_Complex");
+
key_t key;
+
if (name == 0)
key = ACE_DEFAULT_SEM_KEY;
else
key = this->name_2_key (name);
+
if (this->open (key, flags, initial_value, nsems, perms) == -1)
ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ACE_SV_Semaphore_Complex")));
}
+
ACE_SV_Semaphore_Complex::~ACE_SV_Semaphore_Complex (void)
{
ACE_TRACE ("ACE_SV_Semaphore_Complex::~ACE_SV_Semaphore_Complex");
if (this->internal_id_ >= 0)
this->close ();
}
+
ACE_SV_Semaphore_Complex::ACE_SV_Semaphore_Complex (void)
{
ACE_TRACE ("ACE_SV_Semaphore_Complex::ACE_SV_Semaphore_Complex");
this->init ();
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/SV_Semaphore_Complex.h b/dep/ACE_wrappers/ace/SV_Semaphore_Complex.h
index 5f02b0040a2..c4805a577e3 100644
--- a/dep/ACE_wrappers/ace/SV_Semaphore_Complex.h
+++ b/dep/ACE_wrappers/ace/SV_Semaphore_Complex.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file SV_Semaphore_Complex.h
@@ -8,14 +9,19 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_SV_SEMAPHORE_COMPLEX_H
#define ACE_SV_SEMAPHORE_COMPLEX_H
#include /**/ "ace/pre.h"
+
#include "ace/SV_Semaphore_Simple.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_SV_Semaphore_Complex
*
@@ -53,6 +59,7 @@ public:
ACE_CREATE = IPC_CREAT,
ACE_OPEN = 0
};
+
// = Initialization and termination methods.
ACE_SV_Semaphore_Complex (void);
ACE_SV_Semaphore_Complex (key_t key,
@@ -66,6 +73,7 @@ public:
u_short nsems = 1,
mode_t perms = ACE_DEFAULT_FILE_PERMS);
~ACE_SV_Semaphore_Complex (void);
+
/// Open or create an array of SV_Semaphores. We return 0 if all is
/// OK, else -1.
int open (const char *name,
@@ -73,6 +81,7 @@ public:
int initial_value = 1,
u_short nsems = 1,
mode_t perms = ACE_DEFAULT_FILE_PERMS);
+
/// Open or create an array of SV_Semaphores. We return 0 if all is
/// OK, else -1.
int open (key_t key,
@@ -80,6 +89,7 @@ public:
int initial_value = 1,
u_short nsems = 1,
mode_t perms = ACE_DEFAULT_FILE_PERMS);
+
/**
* Close an ACE_SV_Semaphore. Unlike the <remove> method, this
* method is for a process to call before it exits, when it is done
@@ -88,34 +98,48 @@ public:
* one, we can remove the ACE_SV_Semaphore.
*/
int close (void);
+
// = Semaphore acquire and release methods.
+
/// Acquire the semaphore.
int acquire (u_short n = 0, short flags = 0) const;
+
/// Acquire a semaphore for reading.
int acquire_read (u_short n = 0, short flags = 0) const;
+
/// Acquire a semaphore for writing
int acquire_write (u_short n = 0, short flags = 0) const;
+
/// Try to acquire the semaphore.
int tryacquire (u_short n = 0, short flags = 0) const;
+
/// Try to acquire the semaphore for reading.
int tryacquire_read (u_short n = 0, short flags = 0) const;
+
/// Try to acquire the semaphore for writing.
int tryacquire_write (u_short n = 0, short flags = 0) const;
+
/// Release the semaphore.
int release (u_short n = 0, short flags = 0) const;
+
// = Semaphore operation methods.
int op (short val, u_short n = 0, short flags = 0) const;
int op (sembuf op_vec[], u_short n) const;
+
// = Semaphore control methods.
int control (int cmd, semun arg, u_short n = 0) const;
int control (int cmd, int value = 0, u_short n = 0) const;
+
// = Upgrade access control...
using ACE_SV_Semaphore_Simple::get_id;
using ACE_SV_Semaphore_Simple::remove;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
static const int BIGCOUNT_;
static sembuf op_lock_[2];
@@ -124,10 +148,13 @@ private:
static sembuf op_close_[3];
static sembuf op_unlock_[1];
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/SV_Semaphore_Complex.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_SV_SEMAPHORE_COMPLEX_H */
diff --git a/dep/ACE_wrappers/ace/SV_Semaphore_Complex.inl b/dep/ACE_wrappers/ace/SV_Semaphore_Complex.inl
index ba709f1aee5..a1b6659feeb 100644
--- a/dep/ACE_wrappers/ace/SV_Semaphore_Complex.inl
+++ b/dep/ACE_wrappers/ace/SV_Semaphore_Complex.inl
@@ -1,71 +1,84 @@
// -*- C++ -*-
//
// $Id: SV_Semaphore_Complex.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE int
ACE_SV_Semaphore_Complex::acquire (u_short n, short flags) const
{
ACE_TRACE ("ACE_SV_Semaphore_Complex::acquire");
return ACE_SV_Semaphore_Simple::acquire ((u_short) n + 2, flags);
}
+
ACE_INLINE int
ACE_SV_Semaphore_Complex::acquire_read (u_short n, short flags) const
{
ACE_TRACE ("ACE_SV_Semaphore_Complex::acquire_read");
return this->acquire (n, flags);
}
+
ACE_INLINE int
ACE_SV_Semaphore_Complex::acquire_write (u_short n, short flags) const
{
ACE_TRACE ("ACE_SV_Semaphore_Complex::acquire_write");
return this->acquire (n, flags);
}
+
ACE_INLINE int
ACE_SV_Semaphore_Complex::tryacquire (u_short n, short flags) const
{
ACE_TRACE ("ACE_SV_Semaphore_Complex::tryacquire");
return ACE_SV_Semaphore_Simple::tryacquire ((u_short) n + 2, flags);
}
+
ACE_INLINE int
ACE_SV_Semaphore_Complex::tryacquire_read (u_short n, short flags) const
{
ACE_TRACE ("ACE_SV_Semaphore_Complex::tryacquire_read");
return this->tryacquire (n, flags);
}
+
ACE_INLINE int
ACE_SV_Semaphore_Complex::tryacquire_write (u_short n, short flags) const
{
ACE_TRACE ("ACE_SV_Semaphore_Complex::tryacquire_write");
return this->tryacquire (n, flags);
}
+
ACE_INLINE int
ACE_SV_Semaphore_Complex::release (u_short n, short flags) const
{
ACE_TRACE ("ACE_SV_Semaphore_Complex::release");
return ACE_SV_Semaphore_Simple::release ((u_short) n + 2, flags);
}
+
ACE_INLINE int
ACE_SV_Semaphore_Complex::op (short val, u_short n, short flags) const
{
ACE_TRACE ("ACE_SV_Semaphore_Complex::op");
return ACE_SV_Semaphore_Simple::op (val, (u_short) n + 2, flags);
}
+
ACE_INLINE int
ACE_SV_Semaphore_Complex::op (sembuf op_vec[], u_short n) const
{
ACE_TRACE ("ACE_SV_Semaphore_Complex::op");
return ACE_SV_Semaphore_Simple::op (op_vec, (u_short) n + 2);
}
+
ACE_INLINE int
ACE_SV_Semaphore_Complex::control (int cmd, semun arg, u_short n) const
{
ACE_TRACE ("ACE_SV_Semaphore_Complex::control");
return ACE_SV_Semaphore_Simple::control (cmd, arg, (u_short) n + 2);
}
+
ACE_INLINE int
ACE_SV_Semaphore_Complex::control (int cmd, int value, u_short n) const
{
ACE_TRACE ("ACE_SV_Semaphore_Complex::control");
return ACE_SV_Semaphore_Simple::control (cmd, value, (u_short) n + 2);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/SV_Semaphore_Simple.cpp b/dep/ACE_wrappers/ace/SV_Semaphore_Simple.cpp
index c01072683e0..f7727fd163d 100644
--- a/dep/ACE_wrappers/ace/SV_Semaphore_Simple.cpp
+++ b/dep/ACE_wrappers/ace/SV_Semaphore_Simple.cpp
@@ -2,14 +2,19 @@
#include "ace/Log_Msg.h"
#include "ace/ACE.h"
#include "ace/os_include/sys/os_sem.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/SV_Semaphore_Simple.inl"
#endif /* !__ACE_INLINE__ */
+
ACE_RCSID (ace,
SV_Semaphore_Simple,
"$Id: SV_Semaphore_Simple.cpp 82559 2008-08-07 20:23:07Z parsons $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE (ACE_SV_Semaphore_Simple)
+
void
ACE_SV_Semaphore_Simple::dump (void) const
{
@@ -17,6 +22,7 @@ ACE_SV_Semaphore_Simple::dump (void) const
ACE_TRACE ("ACE_SV_Semaphore_Simple::dump");
#endif /* ACE_HAS_DUMP */
}
+
int
ACE_SV_Semaphore_Simple::control (int cmd,
int value,
@@ -28,6 +34,7 @@ ACE_SV_Semaphore_Simple::control (int cmd,
else
{
semun semctl_arg;
+
semctl_arg.val = value;
return ACE_OS::semctl (this->internal_id_,
semnum,
@@ -35,6 +42,7 @@ ACE_SV_Semaphore_Simple::control (int cmd,
semctl_arg);
}
}
+
int
ACE_SV_Semaphore_Simple::init (key_t k, int i)
{
@@ -43,15 +51,19 @@ ACE_SV_Semaphore_Simple::init (key_t k, int i)
this->internal_id_ = i;
return 0;
}
+
// General ACE_SV_Semaphore operation. Increment or decrement by a
// specific amount (positive or negative; amount can`t be zero).
+
int
ACE_SV_Semaphore_Simple::op (short val, u_short n, short flags) const
{
ACE_TRACE ("ACE_SV_Semaphore_Simple::op");
sembuf op_op;
+
op_op.sem_num = n;
op_op.sem_flg = flags;
+
if (this->internal_id_ == -1)
return -1;
else if ((op_op.sem_op = val) == 0)
@@ -59,8 +71,10 @@ ACE_SV_Semaphore_Simple::op (short val, u_short n, short flags) const
else
return ACE_OS::semop (this->internal_id_, &op_op, 1);
}
+
// Open or create one or more SV_Semaphores. We return 0 if all is
// OK, else -1.
+
int
ACE_SV_Semaphore_Simple::open (key_t k,
short flags,
@@ -70,20 +84,27 @@ ACE_SV_Semaphore_Simple::open (key_t k,
{
ACE_TRACE ("ACE_SV_Semaphore_Simple::open");
union semun ivalue;
+
if (k == IPC_PRIVATE || k == static_cast<key_t> (ACE_INVALID_SEM_KEY))
return -1;
+
ivalue.val = initial_value;
this->key_ = k;
this->sem_number_ = n;
+
this->internal_id_ = ACE_OS::semget (this->key_, n, perms | flags);
+
if (this->internal_id_ == -1)
return -1;
+
if (ACE_BIT_ENABLED (flags, IPC_CREAT))
for (int i = 0; i < n; i++)
if (ACE_OS::semctl (this->internal_id_, i, SETVAL, ivalue) == -1)
return -1;
+
return 0;
}
+
ACE_SV_Semaphore_Simple::ACE_SV_Semaphore_Simple (key_t k,
short flags,
int initial_value,
@@ -95,21 +116,25 @@ ACE_SV_Semaphore_Simple::ACE_SV_Semaphore_Simple (key_t k,
if (this->open (k, flags, initial_value, n, perms) == -1)
ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ACE_SV_Semaphore::ACE_SV_Semaphore")));
}
+
// Convert name to key. This function is used internally to create keys
// for the semaphores.
//
// The method for generating names is a 32 bit CRC, but still we
// measured close to collition ratio of nearly 0.1% for
// ACE::unique_name()-like strings.
+
key_t
ACE_SV_Semaphore_Simple::name_2_key (const char *name)
{
ACE_TRACE ("ACE_SV_Semaphore_Simple::name_2_key");
+
if (name == 0)
{
errno = EINVAL;
return static_cast<key_t> (ACE_INVALID_SEM_KEY);
}
+
// Basically "hash" the values in the <name>. This won't
// necessarily guarantee uniqueness of all keys.
// But (IMHO) CRC32 is good enough for most purposes (Carlos)
@@ -123,8 +148,10 @@ ACE_SV_Semaphore_Simple::name_2_key (const char *name)
# pragma warning(pop)
#endif /* ACE_WIN64 */
}
+
// Open or create a ACE_SV_Semaphore. We return 1 if all is OK, else
// 0.
+
int
ACE_SV_Semaphore_Simple::open (const char *name,
short flags,
@@ -133,13 +160,17 @@ ACE_SV_Semaphore_Simple::open (const char *name,
mode_t perms)
{
ACE_TRACE ("ACE_SV_Semaphore_Simple::open");
+
key_t key;
+
if (name == 0)
key = ACE_DEFAULT_SEM_KEY;
else
key = this->name_2_key (name);
+
return this->open (key, flags, initial_value, n, perms);
}
+
ACE_SV_Semaphore_Simple::ACE_SV_Semaphore_Simple (const char *name,
short flags,
int initial_value,
@@ -156,6 +187,7 @@ ACE_SV_Semaphore_Simple::ACE_SV_Semaphore_Simple (const char *name,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_SV_Semaphore_Simple::ACE_SV_Semaphore_Simple")));
}
+
#if defined (ACE_HAS_WCHAR)
ACE_SV_Semaphore_Simple::ACE_SV_Semaphore_Simple (const wchar_t *name,
short flags,
@@ -174,21 +206,25 @@ ACE_SV_Semaphore_Simple::ACE_SV_Semaphore_Simple (const wchar_t *name,
ACE_TEXT ("ACE_SV_Semaphore_Simple::ACE_SV_Semaphore_Simple")));
}
#endif /* ACE_HAS_WCHAR */
+
ACE_SV_Semaphore_Simple::~ACE_SV_Semaphore_Simple (void)
{
ACE_TRACE ("ACE_SV_Semaphore_Simple::~ACE_SV_Semaphore_Simple");
this->close ();
}
+
ACE_SV_Semaphore_Simple::ACE_SV_Semaphore_Simple (void)
{
ACE_TRACE ("ACE_SV_Semaphore_Simple::ACE_SV_Semaphore_Simple");
this->init ();
}
+
// Remove all SV_Semaphores associated with a particular key. This
// call is intended to be called from a server, for example, when it
// is being shut down, as we do an IPC_RMID on the ACE_SV_Semaphore,
// regardless of whether other processes may be using it or not. Most
// other processes should use close() below.
+
int
ACE_SV_Semaphore_Simple::remove (void) const
{
@@ -197,5 +233,6 @@ ACE_SV_Semaphore_Simple::remove (void) const
((ACE_SV_Semaphore_Simple *) this)->init ();
return result;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/SV_Semaphore_Simple.h b/dep/ACE_wrappers/ace/SV_Semaphore_Simple.h
index 47965747182..d51034e59e4 100644
--- a/dep/ACE_wrappers/ace/SV_Semaphore_Simple.h
+++ b/dep/ACE_wrappers/ace/SV_Semaphore_Simple.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file SV_Semaphore_Simple.h
@@ -8,17 +9,23 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//==========================================================================
+
#ifndef ACE_SV_SEMAPHORE_SIMPLE_H
#define ACE_SV_SEMAPHORE_SIMPLE_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/sys/os_stat.h"
#include "ace/os_include/sys/os_ipc.h"
#include "ace/os_include/sys/os_sem.h"
#include "ace/Default_Constants.h"
+
#if defined (ACE_WIN32)
// Default semaphore key and mutex name
# if !defined (ACE_DEFAULT_SEM_KEY)
@@ -30,7 +37,9 @@
# define ACE_DEFAULT_SEM_KEY 1234
# endif /* ACE_DEFAULT_SEM_KEY */
#endif /* ACE_WIN32 */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_SV_Semaphore_Simple
*
@@ -47,6 +56,7 @@ public:
ACE_EXCL = IPC_EXCL,
ACE_OPEN = 0
};
+
// = Initialization and termination methods.
ACE_SV_Semaphore_Simple (void);
ACE_SV_Semaphore_Simple (key_t key,
@@ -66,12 +76,15 @@ public:
u_short nsems = 1,
mode_t perms = ACE_DEFAULT_FILE_PERMS);
#endif /* ACE_HAS_WCHAR */
+
~ACE_SV_Semaphore_Simple (void);
+
int open (const char *name,
short flags = ACE_SV_Semaphore_Simple::ACE_CREATE,
int initial_value = 1,
u_short nsems = 1,
mode_t perms = ACE_DEFAULT_FILE_PERMS);
+
#if defined (ACE_HAS_WCHAR)
int open (const wchar_t *name,
short flags = ACE_SV_Semaphore_Simple::ACE_CREATE,
@@ -79,6 +92,7 @@ public:
u_short nsems = 1,
mode_t perms = ACE_DEFAULT_FILE_PERMS);
#endif /* ACE_HAS_WCHAR */
+
/// Open or create one or more SV_Semaphores. We return 0 if all is
/// OK, else -1.
int open (key_t key,
@@ -86,9 +100,11 @@ public:
int initial_value = 1,
u_short nsems = 1,
mode_t perms = ACE_DEFAULT_FILE_PERMS);
+
/// Close a ACE_SV_Semaphore, marking it as invalid for subsequent
/// operations...
int close (void);
+
/**
* Remove all SV_Semaphores associated with a particular key. This
* call is intended to be called from a server, for example, when it
@@ -97,6 +113,7 @@ public:
* Most other processes should use <close> below.
*/
int remove (void) const;
+
// = Semaphore acquire and release methods.
/**
* Wait until a ACE_SV_Semaphore's value is greater than 0, the
@@ -104,41 +121,57 @@ public:
* DOWN operation.
*/
int acquire (u_short n = 0, short flags = 0) const;
+
/// Acquire a semaphore for reading.
int acquire_read (u_short n = 0, short flags = 0) const;
+
/// Acquire a semaphore for writing
int acquire_write (u_short n = 0, short flags = 0) const;
+
/// Non-blocking version of <acquire>.
int tryacquire (u_short n = 0, short flags = 0) const;
+
/// Try to acquire the semaphore for reading.
int tryacquire_read (u_short n = 0, short flags = 0) const;
+
/// Try to acquire the semaphore for writing.
int tryacquire_write (u_short n = 0, short flags = 0) const;
+
/// Increment ACE_SV_Semaphore by one. Dijkstra's V operation,
/// Tannenbaums UP operation.
int release (u_short n = 0, short flags = 0) const;
+
// = Semaphore operation methods.
/// General ACE_SV_Semaphore operation. Increment or decrement by a
/// specific amount (positive or negative; amount can`t be zero).
int op (short val, u_short semnum = 0, short flags = SEM_UNDO) const;
+
/// General ACE_SV_Semaphore operation on an array of SV_Semaphores.
int op (sembuf op_vec[], u_short nsems) const;
+
// = Semaphore control methods.
int control (int cmd, semun arg, u_short n = 0) const;
int control (int cmd, int value = 0, u_short n = 0) const;
+
/// Get underlying internal id.
int get_id (void) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
/// Semaphore key.
key_t key_;
+
/// Internal ID to identify the semaphore group within this process.
int internal_id_;
+
/// Number of semaphores we're creating.
int sem_number_;
+
/**
* Convert name to key This function is used internally to create
* keys for the semaphores. A valid name contains letters and
@@ -152,10 +185,14 @@ protected:
int i = -1);
key_t name_2_key (const char *name);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/SV_Semaphore_Simple.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
+
#endif /* _SV_SEMAPHORE_SIMPLE_H */
diff --git a/dep/ACE_wrappers/ace/SV_Semaphore_Simple.inl b/dep/ACE_wrappers/ace/SV_Semaphore_Simple.inl
index 33317d98f8d..777e85fbf43 100644
--- a/dep/ACE_wrappers/ace/SV_Semaphore_Simple.inl
+++ b/dep/ACE_wrappers/ace/SV_Semaphore_Simple.inl
@@ -1,9 +1,12 @@
// -*- C++ -*-
//
// $Id: SV_Semaphore_Simple.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Global_Macros.h"
#include "ace/OS_NS_Thread.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_HAS_WCHAR)
// Semaphores don't offer wide-char names, so convert the name and forward
// to the narrow-char open().
@@ -22,6 +25,7 @@ ACE_SV_Semaphore_Simple::open (const wchar_t *name,
perms);
}
#endif /* ACE_HAS_WCHAR */
+
ACE_INLINE int
ACE_SV_Semaphore_Simple::control (int cmd,
semun arg,
@@ -31,15 +35,19 @@ ACE_SV_Semaphore_Simple::control (int cmd,
return this->internal_id_ == -1 ?
-1 : ACE_OS::semctl (this->internal_id_, n, cmd, arg);
}
+
// Close a ACE_SV_Semaphore, marking it as invalid for subsequent
// operations...
+
ACE_INLINE int
ACE_SV_Semaphore_Simple::close (void)
{
ACE_TRACE ("ACE_SV_Semaphore_Simple::close");
return this->init ();
}
+
// General ACE_SV_Semaphore operation on an array of SV_Semaphores.
+
ACE_INLINE int
ACE_SV_Semaphore_Simple::op (sembuf op_vec[], u_short n) const
{
@@ -47,60 +55,74 @@ ACE_SV_Semaphore_Simple::op (sembuf op_vec[], u_short n) const
return this->internal_id_ == -1
? -1 : ACE_OS::semop (this->internal_id_, op_vec, n);
}
+
// Wait until a ACE_SV_Semaphore's value is greater than 0, the
// decrement it by 1 and return. Dijkstra's P operation, Tannenbaums
// DOWN operation.
+
ACE_INLINE int
ACE_SV_Semaphore_Simple::acquire (u_short n, short flags) const
{
ACE_TRACE ("ACE_SV_Semaphore_Simple::acquire");
return this->op (-1, n, flags);
}
+
ACE_INLINE int
ACE_SV_Semaphore_Simple::acquire_read (u_short n, short flags) const
{
ACE_TRACE ("ACE_SV_Semaphore_Simple::acquire_read");
return this->acquire (n, flags);
}
+
ACE_INLINE int
ACE_SV_Semaphore_Simple::acquire_write (u_short n, short flags) const
{
ACE_TRACE ("ACE_SV_Semaphore_Simple::acquire_write");
return this->acquire (n, flags);
}
+
// Non-blocking version of acquire().
+
ACE_INLINE int
ACE_SV_Semaphore_Simple::tryacquire (u_short n, short flags) const
{
ACE_TRACE ("ACE_SV_Semaphore_Simple::tryacquire");
return this->op (-1, n, flags | IPC_NOWAIT);
}
+
// Non-blocking version of acquire().
+
ACE_INLINE int
ACE_SV_Semaphore_Simple::tryacquire_read (u_short n, short flags) const
{
ACE_TRACE ("ACE_SV_Semaphore_Simple::tryacquire_read");
return this->tryacquire (n, flags);
}
+
// Non-blocking version of acquire().
+
ACE_INLINE int
ACE_SV_Semaphore_Simple::tryacquire_write (u_short n, short flags) const
{
ACE_TRACE ("ACE_SV_Semaphore_Simple::tryacquire_write");
return this->tryacquire (n, flags);
}
+
// Increment ACE_SV_Semaphore by one. Dijkstra's V operation,
// Tannenbaums UP operation.
+
ACE_INLINE int
ACE_SV_Semaphore_Simple::release (u_short n, short flags) const
{
ACE_TRACE ("ACE_SV_Semaphore_Simple::release");
return this->op (1, n, flags);
}
+
ACE_INLINE int
ACE_SV_Semaphore_Simple::get_id (void) const
{
ACE_TRACE ("ACE_SV_Semaphore_Simple::get_id");
return this->internal_id_;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/SV_Shared_Memory.cpp b/dep/ACE_wrappers/ace/SV_Shared_Memory.cpp
index a5746ddd4ed..122753989c2 100644
--- a/dep/ACE_wrappers/ace/SV_Shared_Memory.cpp
+++ b/dep/ACE_wrappers/ace/SV_Shared_Memory.cpp
@@ -1,12 +1,18 @@
// $Id: SV_Shared_Memory.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/SV_Shared_Memory.h"
#include "ace/Log_Msg.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/SV_Shared_Memory.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace, SV_Shared_Memory, "$Id: SV_Shared_Memory.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_SV_Shared_Memory)
+
void
ACE_SV_Shared_Memory::dump (void) const
{
@@ -14,8 +20,10 @@ ACE_SV_Shared_Memory::dump (void) const
ACE_TRACE ("ACE_SV_Shared_Memory::dump");
#endif /* ACE_HAS_DUMP */
}
+
// Creates a shared memory segment of SIZE bytes and *does* attach to
// this segment.
+
int
ACE_SV_Shared_Memory::open_and_attach (key_t external_id,
size_t sz,
@@ -32,7 +40,9 @@ ACE_SV_Shared_Memory::open_and_attach (key_t external_id,
else
return 0;
}
+
// Constructor interface to this->open_and_attach () member function.
+
ACE_SV_Shared_Memory::ACE_SV_Shared_Memory (key_t external_id,
size_t sz,
int create,
@@ -46,7 +56,9 @@ ACE_SV_Shared_Memory::ACE_SV_Shared_Memory (key_t external_id,
ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_SV_Shared_Memory::ACE_SV_Shared_Memory")));
}
+
// The "do nothing" constructor.
+
ACE_SV_Shared_Memory::ACE_SV_Shared_Memory (void)
: internal_id_ (0),
size_ (0),
@@ -54,12 +66,14 @@ ACE_SV_Shared_Memory::ACE_SV_Shared_Memory (void)
{
ACE_TRACE ("ACE_SV_Shared_Memory::ACE_SV_Shared_Memory");
}
+
// Added this constructor to accept an internal id, the one generated
// when a server constructs with the key IPC_PRIVATE. The client can
// be passed ACE_SV_Shared_Memory::internal_id via a socket and call
// this construtor to attach the existing segment. This prevents
// having to hard-code a key in advance. Courtesy of Marvin Wolfthal
// (maw@fsg.com).
+
ACE_SV_Shared_Memory::ACE_SV_Shared_Memory (ACE_HANDLE int_id,
int flags)
: internal_id_ (int_id),
@@ -70,5 +84,6 @@ ACE_SV_Shared_Memory::ACE_SV_Shared_Memory (ACE_HANDLE int_id,
ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_SV_Shared_Memory::ACE_SV_Shared_Memory")));
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/SV_Shared_Memory.h b/dep/ACE_wrappers/ace/SV_Shared_Memory.h
index fc10ecb9bf9..f4bc944efa2 100644
--- a/dep/ACE_wrappers/ace/SV_Shared_Memory.h
+++ b/dep/ACE_wrappers/ace/SV_Shared_Memory.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file SV_Shared_Memory.h
@@ -8,17 +9,24 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//==========================================================================
+
#ifndef ACE_SV_SHARED_MEMORY_H
#define ACE_SV_SHARED_MEMORY_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/sys/os_stat.h"
#include "ace/os_include/sys/os_ipc.h"
#include "ace/Default_Constants.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_SV_Shared_Memory
*
@@ -32,6 +40,7 @@ public:
ACE_CREATE = IPC_CREAT,
ACE_OPEN = 0
};
+
// = Initialization and termination methods.
ACE_SV_Shared_Memory (void);
ACE_SV_Shared_Memory (key_t external_id,
@@ -40,54 +49,74 @@ public:
int perms = ACE_DEFAULT_FILE_PERMS,
void *virtual_addr = 0,
int flags = 0);
+
ACE_SV_Shared_Memory (ACE_HANDLE internal_id,
int flags = 0);
+
int open (key_t external_id,
size_t size,
int create = ACE_SV_Shared_Memory::ACE_OPEN,
int perms = ACE_DEFAULT_FILE_PERMS);
+
int open_and_attach (key_t external_id,
size_t size,
int create = ACE_SV_Shared_Memory::ACE_OPEN,
int perms = ACE_DEFAULT_FILE_PERMS,
void *virtual_addr = 0,
int flags = 0);
+
/// Attach this shared memory segment.
int attach (void *virtual_addr = 0, int flags = 0);
+
/// Detach this shared memory segment.
int detach (void);
+
/// Remove this shared memory segment.
int remove (void);
+
/// Forward to underlying System V <shmctl>.
int control (int cmd, void *buf);
+
// = Segment-related info.
void *get_segment_ptr (void) const;
size_t get_segment_size (void) const;
+
/// Return the ID of the shared memory segment (i.e., an ACE_HANDLE).
ACE_HANDLE get_id (void) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
enum
{
/// Most restrictive alignment.
ALIGN_WORDB = 8
};
+
/// Internal identifier.
ACE_HANDLE internal_id_;
+
/// Size of the mapped segment.
size_t size_;
+
/// Pointer to the beginning of the segment.
void *segment_ptr_;
+
/// Round up to an appropriate page size.
size_t round_up (size_t len);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/SV_Shared_Memory.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_SV_SHARED_MEMORY_H */
diff --git a/dep/ACE_wrappers/ace/SV_Shared_Memory.inl b/dep/ACE_wrappers/ace/SV_Shared_Memory.inl
index bb44980bb7e..e6a61948da8 100644
--- a/dep/ACE_wrappers/ace/SV_Shared_Memory.inl
+++ b/dep/ACE_wrappers/ace/SV_Shared_Memory.inl
@@ -1,18 +1,23 @@
// -*- C++ -*-
//
// $Id: SV_Shared_Memory.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_sys_shm.h"
#include "ace/Global_Macros.h"
#include "ace/OS_NS_errno.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE size_t
ACE_SV_Shared_Memory::round_up (size_t len)
{
ACE_TRACE ("ACE_SV_Shared_Memory::round_up");
return (len + ACE_SV_Shared_Memory::ALIGN_WORDB - 1) & ~(ACE_SV_Shared_Memory::ALIGN_WORDB - 1);
}
+
// Creates a shared memory segment of SIZE bytes. Does *not* attach
// this memory segment...
+
ACE_INLINE int
ACE_SV_Shared_Memory::open (key_t external_id, size_t sz, int create, int perms)
{
@@ -26,11 +31,15 @@ ACE_SV_Shared_Memory::open (key_t external_id, size_t sz, int create, int perms)
#else
this->segment_ptr_ = 0;
this->size_ = sz;
+
this->internal_id_ = ACE_OS::shmget (external_id, sz, create | perms);
+
return this->internal_id_ == -1 ? -1 : 0;
#endif /* ACE_WIN32 */
}
+
// Attachs to the shared memory segment.
+
ACE_INLINE int
ACE_SV_Shared_Memory::attach (void *virtual_addr, int flags)
{
@@ -44,7 +53,9 @@ ACE_SV_Shared_Memory::attach (void *virtual_addr, int flags)
return this->segment_ptr_ == (void *) -1 ? -1 : 0;
#endif /* ACE_WIN32 */
}
+
// Interface to the underlying shared memory control function.
+
ACE_INLINE int
ACE_SV_Shared_Memory::control (int cmd, void *buf)
{
@@ -57,14 +68,18 @@ ACE_SV_Shared_Memory::control (int cmd, void *buf)
return ACE_OS::shmctl (this->internal_id_, cmd, (struct shmid_ds *) buf);
#endif /* ACE_WIN32 */
}
+
// The overall size of the segment.
+
ACE_INLINE size_t
ACE_SV_Shared_Memory::get_segment_size (void) const
{
ACE_TRACE ("ACE_SV_Shared_Memory::get_segment_size");
return this->size_;
}
+
// Removes the shared memory segment.
+
ACE_INLINE int
ACE_SV_Shared_Memory::remove (void)
{
@@ -75,24 +90,29 @@ ACE_SV_Shared_Memory::remove (void)
return ACE_OS::shmctl (this->internal_id_, IPC_RMID, 0);
#endif /* ACE_WIN32 */
}
+
// Detach the current binding between this->segment_ptr and the shared
// memory segment.
+
ACE_INLINE int
ACE_SV_Shared_Memory::detach (void)
{
ACE_TRACE ("ACE_SV_Shared_Memory::detach");
return ACE_OS::shmdt (this->segment_ptr_);
}
+
ACE_INLINE void *
ACE_SV_Shared_Memory::get_segment_ptr (void) const
{
ACE_TRACE ("ACE_SV_Shared_Memory::get_segment_ptr");
return this->segment_ptr_;
}
+
ACE_INLINE ACE_HANDLE
ACE_SV_Shared_Memory::get_id (void) const
{
ACE_TRACE ("ACE_SV_Shared_Memory::get_id");
return this->internal_id_;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Sample_History.cpp b/dep/ACE_wrappers/ace/Sample_History.cpp
index 8fb332ee572..86a8f449fa2 100644
--- a/dep/ACE_wrappers/ace/Sample_History.cpp
+++ b/dep/ACE_wrappers/ace/Sample_History.cpp
@@ -1,34 +1,44 @@
// $Id: Sample_History.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Sample_History.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Sample_History.inl"
#endif /* __ACE_INLINE__ */
+
#include "ace/Basic_Stats.h"
#include "ace/Log_Msg.h"
#include "ace/OS_Memory.h"
+
ACE_RCSID(ace, Sample_History, "$Id: Sample_History.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_Sample_History::ACE_Sample_History (size_t max_samples)
: max_samples_ (max_samples)
, sample_count_ (0)
{
ACE_NEW(this->samples_, ACE_UINT64[this->max_samples_]);
}
+
ACE_Sample_History::~ACE_Sample_History (void)
{
delete[] this->samples_;
}
+
size_t
ACE_Sample_History::max_samples (void) const
{
return this->max_samples_;
}
+
size_t
ACE_Sample_History::sample_count (void) const
{
return this->sample_count_;
}
+
void
ACE_Sample_History::dump_samples (const ACE_TCHAR *msg,
ACE_UINT32 scale_factor) const
@@ -50,6 +60,7 @@ ACE_Sample_History::dump_samples (const ACE_TCHAR *msg,
ACE_UNUSED_ARG (scale_factor);
#endif /* ACE_NLOGGING */
}
+
void
ACE_Sample_History::collect_basic_stats (ACE_Basic_Stats &stats) const
{
@@ -58,5 +69,6 @@ ACE_Sample_History::collect_basic_stats (ACE_Basic_Stats &stats) const
stats.sample (this->samples_[i]);
}
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Sample_History.h b/dep/ACE_wrappers/ace/Sample_History.h
index f04d2d99669..fe7dd0aa14e 100644
--- a/dep/ACE_wrappers/ace/Sample_History.h
+++ b/dep/ACE_wrappers/ace/Sample_History.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Sample_History.h
@@ -9,16 +10,22 @@
*/
//=============================================================================
+
#ifndef ACE_SAMPLE_HISTORY_H
#define ACE_SAMPLE_HISTORY_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
#include "ace/Basic_Types.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Basic_Stats;
+
/// Save multiple samples in an array
/**
* Save multiple samples (usually latency numbers), into an array, and
@@ -33,17 +40,22 @@ public:
* the class is initialized.
*/
ACE_Sample_History (size_t max_samples);
+
/// Destructor
~ACE_Sample_History (void);
+
/// Record one sample.
/**
* Return 0 on success, -1 if the sample could not be stored
*/
int sample (ACE_UINT64 value);
+
/// Returns the maximum number of samples
size_t max_samples (void) const;
+
/// Returns the current number of samples
size_t sample_count (void) const;
+
/// Dump all the samples
/**
* Prints out all the samples, using @a msg as a prefix for each
@@ -51,22 +63,30 @@ public:
*/
void dump_samples (const ACE_TCHAR *msg,
ACE_UINT32 scale_factor) const;
+
/// Collect the summary for all the samples
void collect_basic_stats (ACE_Basic_Stats &) const;
+
/// Get a sample
ACE_UINT64 get_sample (size_t i) const;
+
private:
/// The maximum number of samples
size_t max_samples_;
+
/// The current number of samples
size_t sample_count_;
+
/// The samples
ACE_UINT64 *samples_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Sample_History.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_SAMPLE_HISTORY_H */
diff --git a/dep/ACE_wrappers/ace/Sample_History.inl b/dep/ACE_wrappers/ace/Sample_History.inl
index 72f5bf3b21b..9945bfe14ec 100644
--- a/dep/ACE_wrappers/ace/Sample_History.inl
+++ b/dep/ACE_wrappers/ace/Sample_History.inl
@@ -1,20 +1,26 @@
// -*- C++ -*-
//
// $Id: Sample_History.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE int
ACE_Sample_History::sample (ACE_UINT64 value)
{
if (this->sample_count_ >= this->max_samples_)
return -1;
+
this->samples_[this->sample_count_++] = value;
return 0;
}
+
ACE_INLINE ACE_UINT64
ACE_Sample_History::get_sample (size_t i) const
{
if (this->sample_count_ <= i)
return 0;
+
return this->samples_[i];
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Sbrk_Memory_Pool.cpp b/dep/ACE_wrappers/ace/Sbrk_Memory_Pool.cpp
index f5b9d26daa8..ec17dfcd291 100644
--- a/dep/ACE_wrappers/ace/Sbrk_Memory_Pool.cpp
+++ b/dep/ACE_wrappers/ace/Sbrk_Memory_Pool.cpp
@@ -1,12 +1,19 @@
// $Id: Sbrk_Memory_Pool.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_unistd.h"
#include "ace/Sbrk_Memory_Pool.h"
#include "ace/Log_Msg.h"
+
ACE_RCSID(ace, Sbrk_Memory_Pool, "$Id: Sbrk_Memory_Pool.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if !defined (ACE_LACKS_SBRK)
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_Sbrk_Memory_Pool)
+
// Ask system for more local memory via sbrk(2).
+
void *
ACE_Sbrk_Memory_Pool::acquire (size_t nbytes,
size_t &rounded_bytes)
@@ -15,6 +22,7 @@ ACE_Sbrk_Memory_Pool::acquire (size_t nbytes,
rounded_bytes = this->round_up (nbytes);
// ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) acquiring more chunks, nbytes = %d, rounded_bytes = %d\n"), nbytes, rounded_bytes));
void *cp = ACE_OS::sbrk (rounded_bytes);
+
if (cp == MAP_FAILED)
ACE_ERROR_RETURN ((LM_ERROR,
"(%P|%t) cp = %u\n",
@@ -24,38 +32,46 @@ ACE_Sbrk_Memory_Pool::acquire (size_t nbytes,
// ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) acquired more chunks, nbytes = %d, rounded_bytes = %d, new break = %u\n"), nbytes, rounded_bytes, cp));
return cp;
}
+
/* No-op for now... */
+
int
ACE_Sbrk_Memory_Pool::release (int)
{
ACE_TRACE ("ACE_Sbrk_Memory_Pool::release");
return 0;
}
+
int
ACE_Sbrk_Memory_Pool::sync (ssize_t, int)
{
ACE_TRACE ("ACE_Sbrk_Memory_Pool::sync");
return 0;
}
+
int
ACE_Sbrk_Memory_Pool::sync (void *, size_t, int)
{
ACE_TRACE ("ACE_Sbrk_Memory_Pool::sync");
return 0;
}
+
int
ACE_Sbrk_Memory_Pool::protect (ssize_t, int)
{
ACE_TRACE ("ACE_Sbrk_Memory_Pool::protect");
return 0;
}
+
int
ACE_Sbrk_Memory_Pool::protect (void *, size_t, int)
{
ACE_TRACE ("ACE_Sbrk_Memory_Pool::protect");
return 0;
}
+
// Ask system for initial chunk of local memory.
+
void *
ACE_Sbrk_Memory_Pool::init_acquire (size_t nbytes,
size_t &rounded_bytes,
@@ -65,9 +81,11 @@ ACE_Sbrk_Memory_Pool::init_acquire (size_t nbytes,
// Note that we assume that when ACE_Sbrk_Memory_Pool is used,
// ACE_Malloc's constructor will only get called once. If this
// assumption doesn't hold, we are in deep trouble!
+
first_time = 1;
return this->acquire (nbytes, rounded_bytes);
}
+
void
ACE_Sbrk_Memory_Pool::dump (void) const
{
@@ -75,26 +93,33 @@ ACE_Sbrk_Memory_Pool::dump (void) const
ACE_TRACE ("ACE_Sbrk_Memory_Pool::dump");
#endif /* ACE_HAS_DUMP */
}
+
ACE_Sbrk_Memory_Pool::ACE_Sbrk_Memory_Pool (const ACE_TCHAR *,
const OPTIONS *)
{
ACE_TRACE ("ACE_Sbrk_Memory_Pool::ACE_Sbrk_Memory_Pool");
}
+
ACE_Sbrk_Memory_Pool::~ACE_Sbrk_Memory_Pool (void)
{
}
+
void *
ACE_Sbrk_Memory_Pool::base_addr (void) const
{
return 0;
}
+
// Round up the request to a multiple of the page size.
+
size_t
ACE_Sbrk_Memory_Pool::round_up (size_t nbytes)
{
ACE_TRACE ("ACE_Sbrk_Memory_Pool::round_up");
return ACE::round_to_pagesize (nbytes);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* !ACE_LACKS_SBRK */
diff --git a/dep/ACE_wrappers/ace/Sbrk_Memory_Pool.h b/dep/ACE_wrappers/ace/Sbrk_Memory_Pool.h
index 0741ebfb268..05fdcdadb30 100644
--- a/dep/ACE_wrappers/ace/Sbrk_Memory_Pool.h
+++ b/dep/ACE_wrappers/ace/Sbrk_Memory_Pool.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Sbrk_Memory_Pool.h
@@ -9,18 +10,26 @@
* @author Prashant Jain <pjain@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_SBRK_MEMORY_POOL_H
#define ACE_SBRK_MEMORY_POOL_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if !defined (ACE_LACKS_SBRK)
+
#include "ace/ACE.h"
#include "ace/os_include/sys/os_mman.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Sbrk_Memory_Pool_Options
*
@@ -32,6 +41,7 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
class ACE_Export ACE_Sbrk_Memory_Pool_Options
{
};
+
/**
* @class ACE_Sbrk_Memory_Pool
*
@@ -41,53 +51,69 @@ class ACE_Export ACE_Sbrk_Memory_Pool
{
public:
typedef ACE_Sbrk_Memory_Pool_Options OPTIONS;
+
/// Initialize the pool.
ACE_Sbrk_Memory_Pool (const ACE_TCHAR *backing_store_name = 0,
const OPTIONS *options = 0);
+
virtual ~ACE_Sbrk_Memory_Pool (void);
+
// = Implementor operations.
/// Ask system for initial chunk of local memory.
virtual void *init_acquire (size_t nbytes,
size_t &rounded_bytes,
int &first_time);
+
/// Acquire at least @a nbytes from the memory pool. @a rounded_bytes is
/// the actual number of bytes allocated.
virtual void *acquire (size_t nbytes,
size_t &rounded_bytes);
+
/// Instruct the memory pool to release all of its resources.
virtual int release (int destroy = 1);
+
/**
* Sync @a len bytes of the memory region to the backing store
* starting at @c this->base_addr_. If @a len == -1 then sync the
* whole region.
*/
virtual int sync (ssize_t len = -1, int flags = MS_SYNC);
+
/// Sync @a len bytes of the memory region to the backing store
/// starting at @a addr.
virtual int sync (void *addr, size_t len, int flags = MS_SYNC);
+
/**
* Change the protection of the pages of the mapped region to @a prot
* starting at @c this->base_addr_ up to @a len bytes. If @a len == -1
* then change protection of all pages in the mapped region.
*/
virtual int protect (ssize_t len = -1, int prot = PROT_RDWR);
+
/// Change the protection of the pages of the mapped region to @a prot
/// starting at @a addr up to @a len bytes.
virtual int protect (void *addr, size_t len, int prot = PROT_RDWR);
+
/// Dump the state of an object.
virtual void dump (void) const;
+
/// Return the base address of this memory pool, 0 if base_addr
/// never changes.
virtual void *base_addr (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
/// Implement the algorithm for rounding up the request to an
/// appropriate chunksize.
virtual size_t round_up (size_t nbytes);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* !ACE_LACKS_SBRK */
+
#include /**/ "ace/post.h"
#endif /* ACE_SBRK_MEMORY_POOL_H */
diff --git a/dep/ACE_wrappers/ace/Sched_Params.cpp b/dep/ACE_wrappers/ace/Sched_Params.cpp
index dd65d136742..34000a91cbc 100644
--- a/dep/ACE_wrappers/ace/Sched_Params.cpp
+++ b/dep/ACE_wrappers/ace/Sched_Params.cpp
@@ -9,24 +9,32 @@
*/
//=============================================================================
+
#include "ace/Sched_Params.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Sched_Params.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_HAS_PRIOCNTL) && defined (ACE_HAS_STHREADS)
# include "ace/OS_NS_string.h"
# include /**/ <sys/priocntl.h>
#endif /* ACE_HAS_PRIOCNTL && ACE_HAS_THREADS */
+
ACE_RCSID(ace, Sched_Params, "$Id: Sched_Params.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
int
ACE_Sched_Params::priority_min (const Policy policy,
const int scope)
{
#if defined (ACE_HAS_PRIOCNTL) && defined (ACE_HAS_STHREADS)
ACE_UNUSED_ARG (scope);
+
// Assume that ACE_SCHED_OTHER indicates TS class, and that other
// policies indicate RT class.
+
// Call ACE_OS::priority_control only for processes (lightweight
// or otherwise). Calling ACE_OS::priority_control for thread
// priorities gives incorrect results.
@@ -40,6 +48,7 @@ ACE_Sched_Params::priority_min (const Policy policy,
// memory reads.
ACE_OS::memset (&pcinfo, 0, sizeof pcinfo);
ACE_OS::strcpy (pcinfo.pc_clname, "TS");
+
if (ACE_OS::priority_control (P_ALL /* ignored */,
P_MYID /* ignored */,
PC_GETCID,
@@ -47,10 +56,12 @@ ACE_Sched_Params::priority_min (const Policy policy,
// Just hope that priority range wasn't configured from -1
// .. 1
return -1;
+
// OK, now we've got the class ID in pcinfo.pc_cid. In
// addition, the maximum configured time-share priority is in
// ((tsinfo_t *) pcinfo.pc_clinfo)->ts_maxupri. The minimum
// priority is just the negative of that.
+
return -((tsinfo_t *) pcinfo.pc_clinfo)->ts_maxupri;
}
else
@@ -75,6 +86,7 @@ ACE_Sched_Params::priority_min (const Policy policy,
#elif defined(ACE_HAS_PTHREADS) && \
(!defined(ACE_LACKS_SETSCHED) || defined (ACE_TANDEM_T1248_PTHREADS) || \
defined (ACE_HAS_PTHREAD_SCHEDPARAM))
+
switch (scope)
{
case ACE_SCOPE_THREAD:
@@ -88,6 +100,7 @@ ACE_Sched_Params::priority_min (const Policy policy,
default:
return ACE_THR_PRI_OTHER_MIN;
}
+
case ACE_SCOPE_PROCESS:
default:
switch (policy)
@@ -101,6 +114,7 @@ ACE_Sched_Params::priority_min (const Policy policy,
return ACE_PROC_PRI_OTHER_MIN;
}
}
+
#elif defined (ACE_HAS_WTHREADS)
ACE_UNUSED_ARG (policy);
ACE_UNUSED_ARG (scope);
@@ -119,12 +133,14 @@ ACE_Sched_Params::priority_min (const Policy policy,
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_PRIOCNTL && defined (ACE_HAS_STHREADS) */
}
+
int
ACE_Sched_Params::priority_max (const Policy policy,
const int scope)
{
#if defined (ACE_HAS_PRIOCNTL) && defined (ACE_HAS_STHREADS)
ACE_UNUSED_ARG (scope);
+
// Call ACE_OS::priority_control only for processes (lightweight
// or otherwise). Calling ACE_OS::priority_control for thread
// priorities gives incorrect results.
@@ -132,6 +148,7 @@ ACE_Sched_Params::priority_max (const Policy policy,
{
// Assume that ACE_SCHED_OTHER indicates TS class, and that other
// policies indicate RT class.
+
// Get the priority class ID and attributes.
pcinfo_t pcinfo;
// The following is just to avoid Purify warnings about unitialized
@@ -139,14 +156,17 @@ ACE_Sched_Params::priority_max (const Policy policy,
ACE_OS::memset (&pcinfo, 0, sizeof pcinfo);
ACE_OS::strcpy (pcinfo.pc_clname,
policy == ACE_SCHED_OTHER ? "TS" : "RT");
+
if (ACE_OS::priority_control (P_ALL /* ignored */,
P_MYID /* ignored */,
PC_GETCID,
(char *) &pcinfo) == -1)
return -1;
+
// OK, now we've got the class ID in pcinfo.pc_cid. In addition,
// the maximum configured real-time priority is in ((rtinfo_t *)
// pcinfo.pc_clinfo)->rt_maxpri, or similarly for the TS class.
+
return policy == ACE_SCHED_OTHER
? ((tsinfo_t *) pcinfo.pc_clinfo)->ts_maxupri
: ((rtinfo_t *) pcinfo.pc_clinfo)->rt_maxpri;
@@ -170,6 +190,7 @@ ACE_Sched_Params::priority_max (const Policy policy,
#elif defined(ACE_HAS_PTHREADS) && \
(!defined(ACE_LACKS_SETSCHED) || defined (ACE_TANDEM_T1248_PTHREADS) || \
defined (ACE_HAS_PTHREAD_SCHEDPARAM))
+
switch (scope)
{
case ACE_SCOPE_THREAD:
@@ -183,6 +204,7 @@ ACE_Sched_Params::priority_max (const Policy policy,
default:
return ACE_THR_PRI_OTHER_MAX;
}
+
case ACE_SCOPE_PROCESS:
default:
switch (policy)
@@ -196,6 +218,7 @@ ACE_Sched_Params::priority_max (const Policy policy,
return ACE_PROC_PRI_OTHER_MAX;
}
}
+
#elif defined (ACE_HAS_WTHREADS)
ACE_UNUSED_ARG (policy);
ACE_UNUSED_ARG (scope);
@@ -214,6 +237,7 @@ ACE_Sched_Params::priority_max (const Policy policy,
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_PRIOCNTL && defined (ACE_HAS_STHREADS) */
}
+
int
ACE_Sched_Params::next_priority (const Policy policy,
const int priority,
@@ -258,6 +282,7 @@ ACE_Sched_Params::next_priority (const Policy policy,
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_THREADS */
}
+
int
ACE_Sched_Params::previous_priority (const Policy policy,
const int priority,
@@ -290,6 +315,7 @@ ACE_Sched_Params::previous_priority (const Policy policy,
defined (ACE_HAS_PTHREAD_SCHEDPARAM))
// including STHREADS and PTHREADS
int const min = priority_min (policy, scope);
+
return priority > min ? priority - 1 : min;
#elif defined (ACE_VXWORKS)
return priority < priority_min (policy, scope)
@@ -302,5 +328,6 @@ ACE_Sched_Params::previous_priority (const Policy policy,
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_THREADS */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Sched_Params.h b/dep/ACE_wrappers/ace/Sched_Params.h
index 8be51428708..29983a36a92 100644
--- a/dep/ACE_wrappers/ace/Sched_Params.h
+++ b/dep/ACE_wrappers/ace/Sched_Params.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Sched_Params.h
@@ -9,16 +10,22 @@
* @author Carlos O'Ryan <coryan@uci.edu>
*/
//=============================================================================
+
#ifndef ACE_SCHED_PARAMS_H
#define ACE_SCHED_PARAMS_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Time_Value.h"
#include "ace/OS_NS_Thread.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Sched_Params
*
@@ -56,6 +63,7 @@ class ACE_Export ACE_Sched_Params
// priority of their LWP. The only way to do that through ACE is
// for the RT thread itself to call <ACE_OS::thr_setprio> with
// it's own priority.
+
// OS Scheduling parameters are complicated and often confusing.
// Many thanks to Thilo Kielmann
// <kielmann@informatik.uni-siegen.de> for his careful review of
@@ -64,27 +72,35 @@ class ACE_Export ACE_Sched_Params
// send any comments or corrections to the ACE developers.
public:
typedef int Policy;
+
// = Initialization and termination methods.
/// Constructor.
ACE_Sched_Params (const Policy policy,
const ACE_Sched_Priority priority,
const int scope = ACE_SCOPE_THREAD,
const ACE_Time_Value &quantum = ACE_Time_Value::zero);
+
/// Termination.
~ACE_Sched_Params (void);
+
// = Get/Set methods:
+
// = Get/Set policy
Policy policy (void) const;
void policy (const Policy);
+
// = Get/Set priority.
ACE_Sched_Priority priority (void) const;
void priority (const ACE_Sched_Priority);
+
// = Get/Set scope.
int scope (void) const;
void scope(const int);
+
// = Get/Set quantum.
const ACE_Time_Value &quantum (void) const;
void quantum (const ACE_Time_Value &);
+
// = Accessors for OS-specific priorities.
// These return priority values for ACE_SCHED_OTHER if the Policy value
// is invalid.
@@ -92,6 +108,7 @@ public:
const int scope = ACE_SCOPE_THREAD);
static int priority_max (const Policy,
const int scope = ACE_SCOPE_THREAD);
+
/**
* The next higher priority. "Higher" refers to scheduling priority,
* not to the priority value itself. (On some platforms, higher scheduling
@@ -102,6 +119,7 @@ public:
static int next_priority (const Policy,
const int priority,
const int scope = ACE_SCOPE_THREAD);
+
/**
* The previous, lower priority. "Lower" refers to scheduling priority,
* not to the priority value itself. (On some platforms, lower scheduling
@@ -112,12 +130,15 @@ public:
static int previous_priority (const Policy,
const int priority,
const int scope = ACE_SCOPE_THREAD);
+
private:
/// Scheduling policy.
Policy policy_;
+
/// Default <priority_>: for setting the priority for the process, LWP,
/// or thread, as indicated by the scope_ parameter.
ACE_Sched_Priority priority_;
+
/**
* <scope_> must be one of the following:
* ACE_SCOPE_PROCESS: sets the scheduling policy for the
@@ -135,6 +156,7 @@ private:
* by using system calls outside of ACE.
*/
int scope_;
+
/**
* The <quantum_> is for time slicing. An ACE_Time_Value of 0 has
* special significance: it means time-slicing is disabled; with
@@ -145,6 +167,7 @@ private:
*/
ACE_Time_Value quantum_;
};
+
/**
* @class ACE_Sched_Priority_Iterator
*
@@ -162,26 +185,35 @@ public:
/// policy and scope for the priorities (see ACE_Sched_Param).
ACE_Sched_Priority_Iterator (const ACE_Sched_Params::Policy &policy,
int scope = ACE_SCOPE_THREAD);
+
/// Default dtor.
~ACE_Sched_Priority_Iterator (void);
+
/// Check if there are more priorities.
int more (void) const;
+
/// Return the current priority.
int priority (void) const;
+
/// Move to the next priority.
/// The iteration is from lowest to highest importance.
void next (void);
+
/// Accessor for the scheduling policy over which we are iterating.
const ACE_Sched_Params::Policy &policy (void) const;
+
/// Accessor for the scheduling
int scope (void) const;
+
private:
/// The Scheduling policy (FIFO, RR, etc.) and scheduling scope
/// (PROCESS, SYSTEM) we are iterating on.
ACE_Sched_Params::Policy policy_;
int scope_;
+
/// The current priority.
int priority_;
+
/**
* This is set to 1 when there are no more priorities. Cannot easily
* compare against the highest priority on platforms were priorities
@@ -189,10 +221,13 @@ private:
*/
int done_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Sched_Params.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_SCHED_PARAMS_H */
diff --git a/dep/ACE_wrappers/ace/Sched_Params.inl b/dep/ACE_wrappers/ace/Sched_Params.inl
index e44c14d4bb1..73803ac1785 100644
--- a/dep/ACE_wrappers/ace/Sched_Params.inl
+++ b/dep/ACE_wrappers/ace/Sched_Params.inl
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Sched_Params.inl
@@ -9,7 +10,9 @@
*/
//=============================================================================
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_Sched_Params::ACE_Sched_Params (
const Policy policy,
@@ -22,59 +25,71 @@ ACE_Sched_Params::ACE_Sched_Params (
quantum_ (quantum)
{
}
+
ACE_INLINE ACE_Sched_Params::~ACE_Sched_Params (void)
{
}
+
ACE_INLINE ACE_Sched_Params::Policy
ACE_Sched_Params::policy (void) const
{
return this->policy_;
}
+
ACE_INLINE void
ACE_Sched_Params::policy (const ACE_Sched_Params::Policy policy)
{
this->policy_ = policy;
}
+
ACE_INLINE ACE_Sched_Priority
ACE_Sched_Params::priority (void) const
{
return this->priority_;
}
+
ACE_INLINE void
ACE_Sched_Params::priority (const ACE_Sched_Priority priority)
{
this->priority_ = priority;
}
+
ACE_INLINE int
ACE_Sched_Params::scope (void) const
{
return this->scope_;
}
+
ACE_INLINE void
ACE_Sched_Params::scope (const int scope)
{
this->scope_ = scope;
}
+
ACE_INLINE const ACE_Time_Value &
ACE_Sched_Params::quantum (void) const
{
return this->quantum_;
}
+
ACE_INLINE void
ACE_Sched_Params::quantum (const ACE_Time_Value &quant)
{
this->quantum_ = quant;
}
+
ACE_INLINE const ACE_Sched_Params::Policy &
ACE_Sched_Priority_Iterator::policy (void) const
{
return this->policy_;
}
+
ACE_INLINE int
ACE_Sched_Priority_Iterator::scope (void) const
{
return this->scope_;
}
+
ACE_INLINE
ACE_Sched_Priority_Iterator::ACE_Sched_Priority_Iterator (const ACE_Sched_Params::Policy &policy,
int scope)
@@ -85,29 +100,35 @@ ACE_Sched_Priority_Iterator::ACE_Sched_Priority_Iterator (const ACE_Sched_Params
{
priority_ = ACE_Sched_Params::priority_min (this->policy (), this->scope ());
}
+
ACE_INLINE
ACE_Sched_Priority_Iterator::~ACE_Sched_Priority_Iterator (void)
{
}
+
ACE_INLINE int
ACE_Sched_Priority_Iterator::more (void) const
{
return !this->done_;
}
+
ACE_INLINE int
ACE_Sched_Priority_Iterator::priority (void) const
{
return this->priority_;
}
+
ACE_INLINE void
ACE_Sched_Priority_Iterator::next (void)
{
if (this->done_)
return;
+
int old_priority = this->priority_;
priority_ = ACE_Sched_Params::next_priority (this->policy (),
this->priority (),
this->scope ());
this->done_ = old_priority == priority_;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Select_Reactor.h b/dep/ACE_wrappers/ace/Select_Reactor.h
index b74bcc5f28d..f3595e0474f 100644
--- a/dep/ACE_wrappers/ace/Select_Reactor.h
+++ b/dep/ACE_wrappers/ace/Select_Reactor.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Select_Reactor.h
@@ -8,19 +9,26 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_SELECT_REACTOR_H
#define ACE_SELECT_REACTOR_H
#include /**/ "ace/pre.h"
+
#include "ace/Select_Reactor_T.h"
#include "ace/Reactor_Token_T.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
//@@ TAO_REACTOR_SPL_COMMENT_HOOK_START
typedef ACE_Reactor_Token_T<ACE_SELECT_TOKEN> ACE_Select_Reactor_Token;
+
typedef ACE_Select_Reactor_T<ACE_Select_Reactor_Token> ACE_Select_Reactor;
//@@ TAO_REACTOR_SPL_COMMENT_HOOK_END
+
#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE == 0)
/**
* @class ACE_Guard< ACE_Reactor_Token_T<ACE_Noop_Token> >
@@ -39,19 +47,24 @@ public:
ACE_Guard (ACE_Reactor_Token_T<ACE_Noop_Token> &) {}
ACE_Guard (ACE_Reactor_Token_T<ACE_Noop_Token> &, int) {}
~ACE_Guard (void) {}
+
int acquire (void) { return 0; }
int tryacquire (void) { return 0; }
int release (void) { return 0; }
int locked (void) { return 1; }
int remove (void) { return 0; }
void dump (void) const {}
+
private:
// Disallow copying and assignment.
ACE_Guard (const ACE_Guard< ACE_Reactor_Token_T<ACE_Noop_Token> > &);
void operator= (const ACE_Guard< ACE_Reactor_Token_T<ACE_Noop_Token> > &);
+
};
#endif /* ACE_MT_SAFE && ACE_MT_SAFE == 0 */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
#endif /* ACE_SELECT_REACTOR_H */
diff --git a/dep/ACE_wrappers/ace/Select_Reactor_Base.cpp b/dep/ACE_wrappers/ace/Select_Reactor_Base.cpp
index aa3d547bc0f..ecd5d4bd746 100644
--- a/dep/ACE_wrappers/ace/Select_Reactor_Base.cpp
+++ b/dep/ACE_wrappers/ace/Select_Reactor_Base.cpp
@@ -1,4 +1,5 @@
// $Id: Select_Reactor_Base.cpp 81153 2008-03-29 08:17:58Z johnnyw $
+
#include "ace/Select_Reactor_Base.h"
#include "ace/Reactor.h"
#include "ace/Thread.h"
@@ -8,17 +9,22 @@
#include "ace/Log_Msg.h"
#include "ace/Signal.h"
#include "ace/OS_NS_fcntl.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Select_Reactor_Base.inl"
#endif /* __ACE_INLINE__ */
+
#ifndef ACE_WIN32
# include <algorithm>
#endif /* !ACE_WIN32 */
+
ACE_RCSID (ace,
Select_Reactor_Base,
"$Id: Select_Reactor_Base.cpp 81153 2008-03-29 08:17:58Z johnnyw $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template<typename iterator>
inline ACE_Event_Handler *
ACE_SELECT_REACTOR_EVENT_HANDLER (iterator i)
@@ -29,7 +35,9 @@ ACE_SELECT_REACTOR_EVENT_HANDLER (iterator i)
return (*i);
#endif /* ACE_WIN32 */
}
+
// Performs sanity checking on the ACE_HANDLE.
+
bool
ACE_Select_Reactor_Handler_Repository::invalid_handle (ACE_HANDLE handle)
{
@@ -46,9 +54,12 @@ ACE_Select_Reactor_Handler_Repository::invalid_handle (ACE_HANDLE handle)
errno = EINVAL;
return true;
}
+
return false;
}
+
// Performs sanity checking on the ACE_HANDLE.
+
bool
ACE_Select_Reactor_Handler_Repository::handle_in_range (ACE_HANDLE handle)
{
@@ -63,32 +74,41 @@ ACE_Select_Reactor_Handler_Repository::handle_in_range (ACE_HANDLE handle)
{
return true;
}
+
// Don't bother setting errno. It isn't used in the select()-based
// reactors and incurs a TSS access.
// errno = EINVAL;
+
return false;
}
+
int
ACE_Select_Reactor_Handler_Repository::open (size_t size)
{
ACE_TRACE ("ACE_Select_Reactor_Handler_Repository::open");
+
#if defined (ACE_WIN32)
if (this->event_handlers_.open (size) == -1)
return -1;
#else
if (this->event_handlers_.size (size) == -1)
return -1;
+
// Initialize the ACE_Event_Handler pointers to 0.
std::fill (this->event_handlers_.begin (),
this->event_handlers_.end (),
static_cast<ACE_Event_Handler *> (0));
+
this->max_handlep1_ = 0;
#endif /* ACE_WIN32 */
+
// Try to increase the number of handles if <size> is greater than
// the current limit.
return ACE::set_handle_limit (static_cast<int> (size), 1);
}
+
// Initialize a repository of the appropriate <size>.
+
ACE_Select_Reactor_Handler_Repository::ACE_Select_Reactor_Handler_Repository (ACE_Select_Reactor_Impl &select_reactor)
: select_reactor_ (select_reactor),
#ifndef ACE_WIN32
@@ -98,6 +118,7 @@ ACE_Select_Reactor_Handler_Repository::ACE_Select_Reactor_Handler_Repository (AC
{
ACE_TRACE ("ACE_Select_Reactor_Handler_Repository::ACE_Select_Reactor_Handler_Repository");
}
+
int
ACE_Select_Reactor_Handler_Repository::unbind_all (void)
{
@@ -112,6 +133,7 @@ ACE_Select_Reactor_Handler_Repository::unbind_all (void)
// the current iterator will be invalidated during the unbind()
// operation.
map_type::iterator const the_pos (pos++);
+
ACE_HANDLE const handle = (*the_pos).key ();
(void) this->unbind (handle,
the_pos,
@@ -123,6 +145,7 @@ ACE_Select_Reactor_Handler_Repository::unbind_all (void)
// handler pointers.
map_type::iterator pos =
this->event_handlers_.begin (); // iterator == ACE_Event_Handler*
+
for (ACE_HANDLE handle = 0;
handle < this->max_handlep1_;
++handle)
@@ -133,29 +156,38 @@ ACE_Select_Reactor_Handler_Repository::unbind_all (void)
++pos;
}
#endif /* ACE_WIN32 */
+
return 0;
}
+
int
ACE_Select_Reactor_Handler_Repository::close (void)
{
ACE_TRACE ("ACE_Select_Reactor_Handler_Repository::close");
+
return this->unbind_all ();
}
+
ACE_Select_Reactor_Handler_Repository::map_type::iterator
ACE_Select_Reactor_Handler_Repository::find_eh (ACE_HANDLE handle)
{
ACE_TRACE ("ACE_Select_Reactor_Handler_Repository::find_eh");
+
map_type::iterator pos (this->event_handlers_.end ());
+
// this code assumes the handle is in range.
#if defined (ACE_WIN32)
this->event_handlers_.find (handle, pos);
#else
map_type::iterator const tmp = &this->event_handlers_[handle];
+
if (*tmp != 0)
pos = tmp;
#endif /* ACE_WIN32 */
+
return pos;
}
+
// Bind the <ACE_Event_Handler *> to the <ACE_HANDLE>.
int
ACE_Select_Reactor_Handler_Repository::bind (ACE_HANDLE handle,
@@ -163,18 +195,26 @@ ACE_Select_Reactor_Handler_Repository::bind (ACE_HANDLE handle,
ACE_Reactor_Mask mask)
{
ACE_TRACE ("ACE_Select_Reactor_Handler_Repository::bind");
+
if (event_handler == 0)
return -1;
+
if (handle == ACE_INVALID_HANDLE)
handle = event_handler->get_handle ();
+
if (this->invalid_handle (handle))
return -1;
+
// Is this handle already in the Reactor?
bool existing_handle = false;
+
#if defined (ACE_WIN32)
+
map_type::ENTRY * entry = 0;
+
int const result =
this->event_handlers_.bind (handle, event_handler, entry);
+
if (result == -1)
{
return -1;
@@ -193,23 +233,31 @@ ACE_Select_Reactor_Handler_Repository::bind (ACE_HANDLE handle,
existing_handle = true;
}
}
+
#else
+
// Check if this handle is already registered.
ACE_Event_Handler * const current_handler =
this->event_handlers_[handle];
+
if (current_handler)
{
// Cannot use a different handler for an existing handle.
if (current_handler != event_handler)
return -1;
+
// Remember that this handle is already registered in the
// Reactor.
existing_handle = true;
}
+
this->event_handlers_[handle] = event_handler;
+
if (this->max_handlep1_ < handle + 1)
this->max_handlep1_ = handle + 1;
+
#endif /* ACE_WIN32 */
+
if (this->select_reactor_.is_suspended_i (handle))
{
this->select_reactor_.bit_ops (handle,
@@ -223,17 +271,22 @@ ACE_Select_Reactor_Handler_Repository::bind (ACE_HANDLE handle,
mask,
this->select_reactor_.wait_set_,
ACE_Reactor::ADD_MASK);
+
// Note the fact that we've changed the state of the <wait_set_>,
// which is used by the dispatching loop to determine whether it can
// keep going or if it needs to reconsult select().
// this->select_reactor_.state_changed_ = 1;
}
+
// If new entry, call add_reference() if needed.
if (!existing_handle)
event_handler->add_reference ();
+
return 0;
}
+
// Remove the binding of <ACE_HANDLE>.
+
int
ACE_Select_Reactor_Handler_Repository::unbind (
ACE_HANDLE handle,
@@ -241,6 +294,7 @@ ACE_Select_Reactor_Handler_Repository::unbind (
ACE_Reactor_Mask mask)
{
ACE_TRACE ("ACE_Select_Reactor_Handler_Repository::unbind");
+
// Retrieve event handler before unbinding it from the map. The
// iterator pointing to it will no longer be valid once the handler
// is unbound.
@@ -248,22 +302,27 @@ ACE_Select_Reactor_Handler_Repository::unbind (
(pos == this->event_handlers_.end ()
? 0
: ACE_SELECT_REACTOR_EVENT_HANDLER (pos));
+
// Clear out the <mask> bits in the Select_Reactor's wait_set.
this->select_reactor_.bit_ops (handle,
mask,
this->select_reactor_.wait_set_,
ACE_Reactor::CLR_MASK);
+
// And suspend_set.
this->select_reactor_.bit_ops (handle,
mask,
this->select_reactor_.suspend_set_,
ACE_Reactor::CLR_MASK);
+
// Note the fact that we've changed the state of the <wait_set_>,
// which is used by the dispatching loop to determine whether it can
// keep going or if it needs to reconsult select().
// this->select_reactor_.state_changed_ = 1;
+
// If there are no longer any outstanding events on this <handle>
// then we can totally shut down the Event_Handler.
+
bool const has_any_wait_mask =
(this->select_reactor_.wait_set_.rd_mask_.is_set (handle)
|| this->select_reactor_.wait_set_.wr_mask_.is_set (handle)
@@ -272,7 +331,9 @@ ACE_Select_Reactor_Handler_Repository::unbind (
(this->select_reactor_.suspend_set_.rd_mask_.is_set (handle)
|| this->select_reactor_.suspend_set_.wr_mask_.is_set (handle)
|| this->select_reactor_.suspend_set_.ex_mask_.is_set (handle));
+
bool complete_removal = false;
+
if (!has_any_wait_mask && !has_any_suspend_mask)
{
#if defined (ACE_WIN32)
@@ -280,6 +341,7 @@ ACE_Select_Reactor_Handler_Repository::unbind (
return -1; // Should not happen!
#else
this->event_handlers_[handle] = 0;
+
if (this->max_handlep1_ == handle + 1)
{
// We've deleted the last entry, so we need to figure out
@@ -291,47 +353,59 @@ ACE_Select_Reactor_Handler_Repository::unbind (
this->select_reactor_.wait_set_.wr_mask_.max_set ();
ACE_HANDLE const wait_ex_max =
this->select_reactor_.wait_set_.ex_mask_.max_set ();
+
ACE_HANDLE const suspend_rd_max =
this->select_reactor_.suspend_set_.rd_mask_.max_set ();
ACE_HANDLE const suspend_wr_max =
this->select_reactor_.suspend_set_.wr_mask_.max_set ();
ACE_HANDLE const suspend_ex_max =
this->select_reactor_.suspend_set_.ex_mask_.max_set ();
+
// Compute the maximum of six values.
this->max_handlep1_ = wait_rd_max;
if (this->max_handlep1_ < wait_wr_max)
this->max_handlep1_ = wait_wr_max;
if (this->max_handlep1_ < wait_ex_max)
this->max_handlep1_ = wait_ex_max;
+
if (this->max_handlep1_ < suspend_rd_max)
this->max_handlep1_ = suspend_rd_max;
if (this->max_handlep1_ < suspend_wr_max)
this->max_handlep1_ = suspend_wr_max;
if (this->max_handlep1_ < suspend_ex_max)
this->max_handlep1_ = suspend_ex_max;
+
++this->max_handlep1_;
}
+
#endif /* ACE_WIN32 */
+
// The handle has been completely removed.
complete_removal = true;
}
+
if (event_handler == 0)
return -1;
+
bool const requires_reference_counting =
event_handler->reference_counting_policy ().value () ==
ACE_Event_Handler::Reference_Counting_Policy::ENABLED;
+
// Close down the <Event_Handler> unless we've been instructed not
// to.
if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::DONT_CALL) == 0)
(void) event_handler->handle_close (handle, mask);
+
// Call remove_reference() if the removal is complete and reference
// counting is needed.
if (complete_removal && requires_reference_counting)
{
(void) event_handler->remove_reference ();
}
+
return 0;
}
+
ACE_Select_Reactor_Handler_Repository_Iterator::ACE_Select_Reactor_Handler_Repository_Iterator
(ACE_Select_Reactor_Handler_Repository const * s)
: rep_ (s),
@@ -342,6 +416,7 @@ ACE_Select_Reactor_Handler_Repository_Iterator::ACE_Select_Reactor_Handler_Repos
// event_handlers[max_handlep1_].
const_base_iterator const end =
&this->rep_->event_handlers_[this->rep_->max_handlep1 ()];
+
// Advance to the next element containing a non-zero event handler.
// There's no need to do this for the Windows case since the hash
// map will only contain non-zero event handlers.
@@ -349,20 +424,26 @@ ACE_Select_Reactor_Handler_Repository_Iterator::ACE_Select_Reactor_Handler_Repos
++this->current_;
#endif
}
+
// Pass back the <next_item> that hasn't been seen in the Set.
// Returns 0 when all items have been seen, else 1.
+
bool
ACE_Select_Reactor_Handler_Repository_Iterator::next (
ACE_Event_Handler *&next_item)
{
bool result = true;
+
if (this->done ())
result = false;
else
next_item = ACE_SELECT_REACTOR_EVENT_HANDLER (this->current_);
+
return result;
}
+
// Move forward by one element in the set.
+
bool
ACE_Select_Reactor_Handler_Repository_Iterator::advance (void)
{
@@ -376,8 +457,10 @@ ACE_Select_Reactor_Handler_Repository_Iterator::advance (void)
const_base_iterator const end =
&this->rep_->event_handlers_[this->rep_->max_handlep1 ()];
#endif /* ACE_WIN32 */
+
if (this->current_ != end)
++this->current_;
+
#ifndef ACE_WIN32
// Advance to the next element containing a non-zero event handler.
// There's no need to do this for the Windows case since the hash
@@ -385,14 +468,18 @@ ACE_Select_Reactor_Handler_Repository_Iterator::advance (void)
while (this->current_ != end && (*(this->current_) == 0))
++this->current_;
#endif /* !ACE_WIN32 */
+
return this->current_ != end;
}
+
// Dump the state of an object.
+
void
ACE_Select_Reactor_Handler_Repository_Iterator::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_Select_Reactor_Handler_Repository_Iterator::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("rep_ = %u"), this->rep_));
# ifdef ACE_WIN32
@@ -404,11 +491,13 @@ ACE_Select_Reactor_Handler_Repository_Iterator::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
void
ACE_Select_Reactor_Handler_Repository::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_Select_Reactor_Handler_Repository::dump");
+
# ifdef ACE_WIN32
# define ACE_HANDLE_FORMAT_SPECIFIER ACE_TEXT("%@")
# define ACE_MAX_HANDLEP1_FORMAT_SPECIFIER ACE_TEXT("%u")
@@ -416,6 +505,7 @@ ACE_Select_Reactor_Handler_Repository::dump (void) const
# define ACE_HANDLE_FORMAT_SPECIFIER ACE_TEXT("%d")
# define ACE_MAX_HANDLEP1_FORMAT_SPECIFIER ACE_TEXT("%d")
# endif /* ACE_WIN32 */
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("max_handlep1_ = ")
@@ -423,7 +513,9 @@ ACE_Select_Reactor_Handler_Repository::dump (void) const
ACE_TEXT ("\n"),
this->max_handlep1 ()));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("[")));
+
ACE_Event_Handler *event_handler = 0;
+
for (ACE_Select_Reactor_Handler_Repository_Iterator iter (this);
iter.next (event_handler) != 0;
iter.advance ())
@@ -434,31 +526,39 @@ ACE_Select_Reactor_Handler_Repository::dump (void) const
ACE_TEXT ("\n"),
event_handler,
event_handler->get_handle ()));
+
ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" ]\n")));
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
ACE_ALLOC_HOOK_DEFINE(ACE_Select_Reactor_Handler_Repository_Iterator)
+
ACE_Select_Reactor_Notify::ACE_Select_Reactor_Notify (void)
: max_notify_iterations_ (-1)
{
}
+
ACE_Select_Reactor_Notify::~ACE_Select_Reactor_Notify (void)
{
}
+
void
ACE_Select_Reactor_Notify::max_notify_iterations (int iterations)
{
// Must always be > 0 or < 0 to optimize the loop exit condition.
if (iterations == 0)
iterations = 1;
+
this->max_notify_iterations_ = iterations;
}
+
int
ACE_Select_Reactor_Notify::max_notify_iterations (void)
{
return this->max_notify_iterations_;
}
+
// purge_pending_notifications
// Removes all entries from the notify_queue_ and each one that
// matches <eh> is put on the free_queue_. The rest are saved on a
@@ -470,52 +570,63 @@ ACE_Select_Reactor_Notify::purge_pending_notifications (ACE_Event_Handler *eh,
ACE_Reactor_Mask mask )
{
ACE_TRACE ("ACE_Select_Reactor_Notify::purge_pending_notifications");
+
#if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE)
+
return notification_queue_.purge_pending_notifications(eh, mask);
+
#else /* defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) */
ACE_UNUSED_ARG (eh);
ACE_UNUSED_ARG (mask);
ACE_NOTSUP_RETURN (-1);
#endif /* defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) */
}
+
void
ACE_Select_Reactor_Notify::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_Select_Reactor_Notify::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("select_reactor_ = %x"), this->select_reactor_));
this->notification_pipe_.dump ();
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
int
ACE_Select_Reactor_Notify::open (ACE_Reactor_Impl *r,
ACE_Timer_Queue *,
int disable_notify_pipe)
{
ACE_TRACE ("ACE_Select_Reactor_Notify::open");
+
if (disable_notify_pipe == 0)
{
this->select_reactor_ =
dynamic_cast<ACE_Select_Reactor_Impl *> (r);
+
if (select_reactor_ == 0)
{
errno = EINVAL;
return -1;
}
+
if (this->notification_pipe_.open () == -1)
return -1;
#if defined (F_SETFD)
ACE_OS::fcntl (this->notification_pipe_.read_handle (), F_SETFD, 1);
ACE_OS::fcntl (this->notification_pipe_.write_handle (), F_SETFD, 1);
#endif /* F_SETFD */
+
#if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE)
if (notification_queue_.open() == -1)
{
return -1;
}
#endif /* ACE_HAS_REACTOR_NOTIFICATION_QUEUE */
+
// There seems to be a Win32 bug with this... Set this into
// non-blocking mode.
if (ACE::set_flags (this->notification_pipe_.read_handle (),
@@ -533,10 +644,12 @@ ACE_Select_Reactor_Notify::open (ACE_Reactor_Impl *r,
return 0;
}
}
+
int
ACE_Select_Reactor_Notify::close (void)
{
ACE_TRACE ("ACE_Select_Reactor_Notify::close");
+
#if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE)
notification_queue_.reset();
#else
@@ -559,55 +672,72 @@ ACE_Select_Reactor_Notify::close (void)
}
}
#endif /* ACE_HAS_REACTOR_NOTIFICATION_QUEUE */
+
return this->notification_pipe_.close ();
}
+
int
ACE_Select_Reactor_Notify::notify (ACE_Event_Handler *event_handler,
ACE_Reactor_Mask mask,
ACE_Time_Value *timeout)
{
ACE_TRACE ("ACE_Select_Reactor_Notify::notify");
+
// Just consider this method a "no-op" if there's no
// <ACE_Select_Reactor> configured.
if (this->select_reactor_ == 0)
return 0;
+
ACE_Event_Handler_var safe_handler (event_handler);
+
if (event_handler)
event_handler->add_reference ();
+
ACE_Notification_Buffer buffer (event_handler, mask);
+
#if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE)
int const notification_required =
notification_queue_.push_new_notification(buffer);
+
if (notification_required == -1)
{
return -1;
}
+
if (notification_required == 0)
{
// No failures, the handler is now owned by the notification queue
safe_handler.release ();
+
return 0;
}
#endif /* ACE_HAS_REACTOR_NOTIFICATION_QUEUE */
+
ssize_t const n = ACE::send (this->notification_pipe_.write_handle (),
(char *) &buffer,
sizeof buffer,
timeout);
if (n == -1)
return -1;
+
// No failures.
safe_handler.release ();
+
return 0;
}
+
// Handles pending threads (if any) that are waiting to unblock the
// Select_Reactor.
+
int
ACE_Select_Reactor_Notify::dispatch_notifications (int &number_of_active_handles,
ACE_Handle_Set &rd_mask)
{
ACE_TRACE ("ACE_Select_Reactor_Notify::dispatch_notifications");
+
ACE_HANDLE const read_handle =
this->notification_pipe_.read_handle ();
+
if (read_handle != ACE_INVALID_HANDLE
&& rd_mask.is_set (read_handle))
{
@@ -619,13 +749,16 @@ ACE_Select_Reactor_Notify::dispatch_notifications (int &number_of_active_handles
return 0;
}
+
ACE_HANDLE
ACE_Select_Reactor_Notify::notify_handle (void)
{
ACE_TRACE ("ACE_Select_Reactor_Notify::notify_handle");
+
return this->notification_pipe_.read_handle ();
}
+
int
ACE_Select_Reactor_Notify::is_dispatchable (ACE_Notification_Buffer &buffer)
{
@@ -649,33 +782,41 @@ ACE_Select_Reactor_Notify::is_dispatchable (ACE_Notification_Buffer &buffer)
}
#endif /*ACE_HAS_REACTOR_NOTIFICATION_QUEUE */
}
+
int
ACE_Select_Reactor_Notify::dispatch_notify (ACE_Notification_Buffer &buffer)
{
int result = 0;
+
#if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE)
// Dispatch one message from the notify queue, and put another in
// the pipe if one is available. Remember, the idea is to keep
// exactly one message in the pipe at a time.
+
bool more_messages_queued = false;
ACE_Notification_Buffer next;
+
result = notification_queue_.pop_next_notification(buffer,
more_messages_queued,
next);
+
if (result == 0)
{
return 0;
}
+
if (result == -1)
{
return -1;
}
+
if(more_messages_queued)
{
(void) ACE::send(this->notification_pipe_.write_handle(),
(char *)&next, sizeof(ACE_Notification_Buffer));
}
#endif /* ACE_HAS_REACTOR_NOTIFICATION_QUEUE */
+
// If eh == 0 then another thread is unblocking the
// <ACE_Select_Reactor> to update the <ACE_Select_Reactor>'s
// internal structures. Otherwise, we need to dispatch the
@@ -684,9 +825,11 @@ ACE_Select_Reactor_Notify::dispatch_notify (ACE_Notification_Buffer &buffer)
if (buffer.eh_ != 0)
{
ACE_Event_Handler *event_handler = buffer.eh_;
+
bool const requires_reference_counting =
event_handler->reference_counting_policy ().value () ==
ACE_Event_Handler::Reference_Counting_Policy::ENABLED;
+
switch (buffer.mask_)
{
case ACE_Event_Handler::READ_MASK:
@@ -711,28 +854,35 @@ ACE_Select_Reactor_Notify::dispatch_notify (ACE_Notification_Buffer &buffer)
ACE_TEXT ("invalid mask = %d\n"),
buffer.mask_));
}
+
if (result == -1)
event_handler->handle_close (ACE_INVALID_HANDLE,
ACE_Event_Handler::EXCEPT_MASK);
+
if (requires_reference_counting)
{
event_handler->remove_reference ();
}
}
+
return 1;
}
+
int
ACE_Select_Reactor_Notify::read_notify_pipe (ACE_HANDLE handle,
ACE_Notification_Buffer &buffer)
{
ACE_TRACE ("ACE_Select_Reactor_Notify::read_notify_pipe");
+
ssize_t const n = ACE::recv (handle, (char *) &buffer, sizeof buffer);
+
if (n > 0)
{
// Check to see if we've got a short read.
if (n != sizeof buffer)
{
ssize_t const remainder = sizeof buffer - n;
+
// If so, try to recover by reading the remainder. If this
// doesn't work we're in big trouble since the input stream
// won't be aligned correctly. I'm not sure quite what to
@@ -743,39 +893,48 @@ ACE_Select_Reactor_Notify::read_notify_pipe (ACE_HANDLE handle,
return -1;
}
+
return 1;
}
+
// Return -1 if things have gone seriously wrong.
if (n <= 0 && (errno != EWOULDBLOCK && errno != EAGAIN))
return -1;
+
return 0;
}
+
int
ACE_Select_Reactor_Notify::handle_input (ACE_HANDLE handle)
{
ACE_TRACE ("ACE_Select_Reactor_Notify::handle_input");
// Precondition: this->select_reactor_.token_.current_owner () ==
// ACE_Thread::self ();
+
int number_dispatched = 0;
int result = 0;
ACE_Notification_Buffer buffer;
+
while ((result = this->read_notify_pipe (handle, buffer)) > 0)
{
// Dispatch the buffer
// NOTE: We count only if we made any dispatches ie. upcalls.
if (this->dispatch_notify (buffer) > 0)
++number_dispatched;
+
// Bail out if we've reached the <notify_threshold_>. Note that
// by default <notify_threshold_> is -1, so we'll loop until all
// the notifications in the pipe have been dispatched.
if (number_dispatched == this->max_notify_iterations_)
break;
}
+
// Reassign number_dispatched to -1 if things have gone seriously
// wrong.
if (result < 0)
number_dispatched = -1;
+
// Enqueue ourselves into the list of waiting threads. When we
// reacquire the token we'll be off and running again with ownership
// of the token. The postcondition of this call is that
@@ -783,7 +942,9 @@ ACE_Select_Reactor_Notify::handle_input (ACE_HANDLE handle)
this->select_reactor_->renew ();
return number_dispatched;
}
+
// -------------------------------------------
+
int
ACE_Select_Reactor_Impl::purge_pending_notifications (ACE_Event_Handler *eh,
ACE_Reactor_Mask mask)
@@ -794,6 +955,7 @@ ACE_Select_Reactor_Impl::purge_pending_notifications (ACE_Event_Handler *eh,
return this->notify_handler_->purge_pending_notifications (eh, mask);
}
+
// Perform GET, CLR, SET, and ADD operations on the Handle_Sets.
//
// GET = 1, Retrieve current value
@@ -813,12 +975,15 @@ ACE_Select_Reactor_Impl::bit_ops (ACE_HANDLE handle,
ACE_TRACE ("ACE_Select_Reactor_Impl::bit_ops");
if (this->handler_rep_.handle_in_range (handle) == 0)
return -1;
+
#if !defined (ACE_WIN32)
ACE_Sig_Guard sb (0,
this->mask_signals_); // Block out all signals until method returns.
#endif /* ACE_WIN32 */
+
ACE_FDS_PTMF ptmf = &ACE_Handle_Set::set_bit;
u_long omask = ACE_Event_Handler::NULL_MASK;
+
// Find the old reactor masks. This automatically does the work of
// the GET_MASK operation.
if (handle_set.rd_mask_.is_set (handle))
@@ -827,6 +992,7 @@ ACE_Select_Reactor_Impl::bit_ops (ACE_HANDLE handle,
ACE_SET_BITS (omask, ACE_Event_Handler::WRITE_MASK);
if (handle_set.ex_mask_.is_set (handle))
ACE_SET_BITS (omask, ACE_Event_Handler::EXCEPT_MASK);
+
switch (ops)
{
case ACE_Reactor::GET_MASK:
@@ -844,12 +1010,14 @@ ACE_Select_Reactor_Impl::bit_ops (ACE_HANDLE handle,
case ACE_Reactor::SET_MASK:
/* FALLTHRU */
case ACE_Reactor::ADD_MASK:
+
// The following code is rather subtle... Note that if we are
// doing a ACE_Reactor::SET_MASK then if the bit is not enabled
// in the mask we need to clear the bit from the ACE_Handle_Set.
// On the other hand, if we are doing a ACE_Reactor::CLR_MASK or
// a ACE_Reactor::ADD_MASK we just carry out the operations
// specified by the mask.
+
// READ, ACCEPT, and CONNECT flag will place the handle in the
// read set.
if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::READ_MASK)
@@ -860,6 +1028,7 @@ ACE_Select_Reactor_Impl::bit_ops (ACE_HANDLE handle,
}
else if (ops == ACE_Reactor::SET_MASK)
handle_set.rd_mask_.clr_bit (handle);
+
// WRITE and CONNECT flag will place the handle in the write set
if (ACE_BIT_ENABLED (mask,
ACE_Event_Handler::WRITE_MASK)
@@ -870,6 +1039,7 @@ ACE_Select_Reactor_Impl::bit_ops (ACE_HANDLE handle,
}
else if (ops == ACE_Reactor::SET_MASK)
handle_set.wr_mask_.clr_bit (handle);
+
// EXCEPT (and CONNECT on Win32) flag will place the handle in
// the except set.
if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::EXCEPT_MASK)
@@ -888,11 +1058,13 @@ ACE_Select_Reactor_Impl::bit_ops (ACE_HANDLE handle,
}
return omask;
}
+
void
ACE_Select_Reactor_Impl::clear_dispatch_mask (ACE_HANDLE handle,
ACE_Reactor_Mask mask)
{
ACE_TRACE ("ACE_Select_Reactor_Impl::clear_dispatch_mask");
+
// Use handle and mask in order to modify the sets
// (wait/suspend/ready/dispatch), that way, the dispatch_io_set loop
// will not be interrupt, and there will no reason to rescan the
@@ -904,9 +1076,11 @@ ACE_Select_Reactor_Impl::clear_dispatch_mask (ACE_HANDLE handle,
// that dispatch_set to be member of the ACE_Select_Reactor_impl in
// Select_Reactor_Base.h file That way we will have access to that
// member in that function.
+
// We kind of invalidate the iterator in dispatch_io_set because its
// an array and index built from the original dispatch-set. Take a
// look at dispatch_io_set for more details.
+
// We only need to clr_bit, because we are interested in clearing the
// handles that was removed, so no dispatching to these handles will
// occur.
@@ -923,17 +1097,21 @@ ACE_Select_Reactor_Impl::clear_dispatch_mask (ACE_HANDLE handle,
{
this->dispatch_set_.ex_mask_.clr_bit (handle);
}
+
// That will make the dispatch_io_set iterator re-start and rescan
// the dispatch set.
this->state_changed_ = true;
}
+
int
ACE_Select_Reactor_Impl::resumable_handler (void)
{
// The select reactor has no handlers that can be resumed by the
// application. So return 0;
+
return 0;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Select_Reactor_Base.h b/dep/ACE_wrappers/ace/Select_Reactor_Base.h
index 60979891350..65b24cd5f23 100644
--- a/dep/ACE_wrappers/ace/Select_Reactor_Base.h
+++ b/dep/ACE_wrappers/ace/Select_Reactor_Base.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Select_Reactor_Base.h
@@ -8,20 +9,27 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_SELECT_REACTOR_BASE_H
#define ACE_SELECT_REACTOR_BASE_H
+
#include /**/ "ace/pre.h"
+
#include "ace/Timer_Queuefwd.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Event_Handler.h"
#include "ace/Handle_Set.h"
#include "ace/Pipe.h"
#include "ace/Reactor_Impl.h"
+
#if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE)
# include "ace/Notification_Queue.h"
#endif /* ACE_HAS_REACTOR_NOTIFICATION_QUEUE */
+
#ifdef ACE_WIN32
# include "ace/Null_Mutex.h"
# include "ace/Hash_Map_Manager_T.h"
@@ -30,22 +38,28 @@
#else
# include "ace/Array_Base.h"
#endif /* ACE_WIN32 */
+
#if !defined (ACE_DISABLE_NOTIFY_PIPE_DEFAULT)
# define ACE_DISABLE_NOTIFY_PIPE_DEFAULT 0
#endif /* ACE_DISABLE_NOTIFY_PIPE_DEFAULT */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Add useful typedefs to simplify the following code.
typedef void (ACE_Handle_Set::*ACE_FDS_PTMF) (ACE_HANDLE);
typedef int (ACE_Event_Handler::*ACE_EH_PTMF) (ACE_HANDLE);
+
// Forward declaration.
class ACE_Select_Reactor_Impl;
class ACE_Sig_Handler;
+
/*
* Hook to specialize the Select_Reactor_Base implementation
* with the concrete reactor, e.g., select or tp reactor
* specified at build/compilation time.
*/
//@@ REACTOR_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK
+
/**
* @class ACE_Select_Reactor_Handle_Set
*
@@ -56,12 +70,15 @@ class ACE_Export ACE_Select_Reactor_Handle_Set
public:
/// Read events (e.g., input pending, accept pending).
ACE_Handle_Set rd_mask_;
+
/// Write events (e.g., flow control abated, non-blocking connection
/// complete).
ACE_Handle_Set wr_mask_;
+
/// Exception events (e.g., SIG_URG).
ACE_Handle_Set ex_mask_;
};
+
/**
* @class ACE_Event_Tuple
*
@@ -75,20 +92,29 @@ public:
class ACE_Event_Tuple
{
public:
+
/// Default constructor.
ACE_Event_Tuple (void);
+
/// Constructor.
ACE_Event_Tuple (ACE_Event_Handler *eh, ACE_HANDLE h);
+
/// Equality operator.
bool operator== (const ACE_Event_Tuple &rhs) const;
+
/// Inequality operator.
bool operator!= (const ACE_Event_Tuple &rhs) const;
+
public:
+
/// Handle.
ACE_HANDLE handle_;
+
/// ACE_Event_Handler associated with the ACE_HANDLE.
ACE_Event_Handler *event_handler_;
+
};
+
/**
* @class ACE_Select_Reactor_Notify
*
@@ -109,15 +135,19 @@ class ACE_Export ACE_Select_Reactor_Notify : public ACE_Reactor_Notify
public:
/// Constructor.
ACE_Select_Reactor_Notify (void);
+
/// Destructor.
virtual ~ACE_Select_Reactor_Notify (void);
+
// = Initialization and termination methods.
/// Initialize.
virtual int open (ACE_Reactor_Impl *,
ACE_Timer_Queue * = 0,
int disable_notify_pipe = ACE_DISABLE_NOTIFY_PIPE_DEFAULT);
+
/// Destroy.
virtual int close (void);
+
/**
* Called by a thread when it wants to unblock the
* ACE_Select_Reactor. This wakeups the ACE_Select_Reactor if
@@ -132,27 +162,34 @@ public:
virtual int notify (ACE_Event_Handler * = 0,
ACE_Reactor_Mask = ACE_Event_Handler::EXCEPT_MASK,
ACE_Time_Value * timeout = 0);
+
/// Handles pending threads (if any) that are waiting to unblock the
/// ACE_Select_Reactor.
virtual int dispatch_notifications (int &number_of_active_handles,
ACE_Handle_Set &rd_mask);
+
/// Returns the ACE_HANDLE of the notify pipe on which the reactor
/// is listening for notifications so that other threads can unblock
/// the Select_Reactor
virtual ACE_HANDLE notify_handle (void);
+
/// Handle one of the notify call on the @c handle. This could be
/// because of a thread trying to unblock the Reactor_Impl
virtual int dispatch_notify (ACE_Notification_Buffer &buffer);
+
/// Read one of the notify call on the @a handle into the
/// @a buffer. This could be because of a thread trying to unblock
/// the Reactor_Impl
virtual int read_notify_pipe (ACE_HANDLE handle,
ACE_Notification_Buffer &buffer);
+
/// Verify whether the buffer has dispatchable info or not.
virtual int is_dispatchable (ACE_Notification_Buffer &buffer);
+
/// Called back by the ACE_Select_Reactor when a thread wants to
/// unblock us.
virtual int handle_input (ACE_HANDLE handle);
+
/**
* Set the maximum number of times that the
* ACE_Select_Reactor_Notify::handle_input() method will iterate and
@@ -164,6 +201,7 @@ public:
* dispatching overhead.
*/
virtual void max_notify_iterations (int);
+
/**
* Get the maximum number of times that the
* ACE_Select_Reactor_Notify::handle_input() method will iterate and
@@ -171,6 +209,7 @@ public:
* notify pipe before breaking out of its recv loop.
*/
virtual int max_notify_iterations (void);
+
/**
* Purge any notifications pending in this reactor for the specified
* ACE_Event_Handler object. If @a eh == 0, all notifications for all
@@ -181,10 +220,13 @@ public:
virtual int purge_pending_notifications (
ACE_Event_Handler *sh,
ACE_Reactor_Mask mask = ACE_Event_Handler::ALL_EVENTS_MASK);
+
/// Dump the state of an object.
virtual void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
/**
* Keep a back pointer to the ACE_Select_Reactor. If this value
@@ -192,12 +234,14 @@ protected:
* disable_notify_pipe.
*/
ACE_Select_Reactor_Impl *select_reactor_;
+
/**
* Contains the ACE_HANDLE the ACE_Select_Reactor is listening
* on, as well as the ACE_HANDLE that threads wanting the
* attention of the ACE_Select_Reactor will write to.
*/
ACE_Pipe notification_pipe_;
+
/**
* Keeps track of the maximum number of times that the
* ACE_Select_Reactor_Notify::handle_input() method will iterate and
@@ -206,6 +250,7 @@ protected:
* this is set to -1, which means "iterate until the pipe is empty."
*/
int max_notify_iterations_;
+
#if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE)
/**
* @brief A user-space queue to store the notifications.
@@ -221,6 +266,7 @@ protected:
ACE_Notification_Queue notification_queue_;
#endif /* ACE_HAS_REACTOR_NOTIFICATION_QUEUE */
};
+
/**
* @class ACE_Select_Reactor_Handler_Repository
*
@@ -237,8 +283,10 @@ class ACE_Export ACE_Select_Reactor_Handler_Repository
{
public:
friend class ACE_Select_Reactor_Handler_Repository_Iterator;
+
typedef ACE_HANDLE key_type;
typedef ACE_Event_Handler * value_type;
+
// = The mapping from <HANDLES> to <Event_Handlers>.
#ifdef ACE_WIN32
/**
@@ -252,6 +300,7 @@ public:
ACE_Hash<key_type>,
std::equal_to<key_type>,
ACE_Null_Mutex> map_type;
+
typedef map_type::size_type max_handlep1_type;
#else
/**
@@ -262,10 +311,13 @@ public:
typedef ACE_Array_Base<value_type> map_type;
typedef ACE_HANDLE max_handlep1_type;
#endif /* ACE_WIN32 */
+
typedef map_type::size_type size_type;
+
// = Initialization and termination methods.
/// Default "do-nothing" constructor.
ACE_Select_Reactor_Handler_Repository (ACE_Select_Reactor_Impl &);
+
/// Initialize a repository of the appropriate @a size.
/**
* On Unix platforms, the size parameter should be as large as the
@@ -276,62 +328,82 @@ public:
* reasons.
*/
int open (size_type size);
+
/// Close down the repository.
int close (void);
+
// = Search structure operations.
+
/**
* Return the @c ACE_Event_Handler* associated with @c ACE_HANDLE.
*/
ACE_Event_Handler * find (ACE_HANDLE handle);
+
/// Bind the ACE_Event_Handler * to the ACE_HANDLE with the
/// appropriate ACE_Reactor_Mask settings.
int bind (ACE_HANDLE,
ACE_Event_Handler *,
ACE_Reactor_Mask);
+
/// Remove the binding of ACE_HANDLE in accordance with the @a mask.
int unbind (ACE_HANDLE,
ACE_Reactor_Mask mask);
+
/// Remove all the <ACE_HANDLE, ACE_Event_Handler> tuples.
int unbind_all (void);
+
// = Sanity checking.
+
// Check the @a handle to make sure it's a valid @c ACE_HANDLE that
// is within the range of legal handles (i.e., >= 0 && < max_size_).
bool invalid_handle (ACE_HANDLE handle);
+
// Check the @a handle to make sure it's a valid @c ACE_HANDLE that
// within the range of currently registered handles (i.e., >= 0 && <
// @c max_handlep1_).
bool handle_in_range (ACE_HANDLE handle);
+
// = Accessors.
/// Returns the current table size.
size_type size (void) const;
+
/// Maximum ACE_HANDLE value, plus 1.
max_handlep1_type max_handlep1 (void) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
+
/// Remove the binding of @a handle corresponding to position @a pos
/// in accordance with the @a mask.
int unbind (ACE_HANDLE handle,
map_type::iterator pos,
ACE_Reactor_Mask mask);
+
/**
* @return @c iterator corresponding @c ACE_Event_Handler*
* associated with @c ACE_HANDLE.
*/
map_type::iterator find_eh (ACE_HANDLE handle);
+
private:
/// Reference to our @c Select_Reactor.
ACE_Select_Reactor_Impl &select_reactor_;
+
#ifndef ACE_WIN32
/// The highest currently active handle, plus 1 (ranges between 0 and
/// @c max_size_.
max_handlep1_type max_handlep1_;
#endif /* !ACE_WIN32 */
+
/// Underlying table of event handlers.
map_type event_handlers_;
};
+
/**
* @class ACE_Select_Reactor_Handler_Repository_Iterator
*
@@ -340,30 +412,42 @@ private:
class ACE_Export ACE_Select_Reactor_Handler_Repository_Iterator
{
public:
+
typedef
ACE_Select_Reactor_Handler_Repository::map_type::const_iterator const_base_iterator;
+
// = Initialization method.
explicit ACE_Select_Reactor_Handler_Repository_Iterator (
ACE_Select_Reactor_Handler_Repository const * s);
+
// = Iteration methods.
+
/// Pass back the @a next_item that hasn't been seen in the Set.
/// Returns @c false when all items have been seen, else @c true.
bool next (ACE_Event_Handler* & next_item);
+
/// Returns @c true when all items have been seen, else @c false.
bool done (void) const;
+
/// Move forward by one element in the set. Returns @c false when
/// all the items in the set have been seen, else @c true.
bool advance (void);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
+
/// Reference to the Handler_Repository we are iterating over.
ACE_Select_Reactor_Handler_Repository const * const rep_;
+
/// Pointer to the current iteration level.
const_base_iterator current_;
};
+
/**
* @class ACE_Select_Reactor_Impl
*
@@ -379,10 +463,13 @@ public:
/// Default size of the Select_Reactor's handle table.
DEFAULT_SIZE = ACE_DEFAULT_SELECT_REACTOR_SIZE
};
+
/// Constructor.
ACE_Select_Reactor_Impl (bool mask_signals = true);
+
friend class ACE_Select_Reactor_Notify;
friend class ACE_Select_Reactor_Handler_Repository;
+
/**
* Purge any notifications pending in this reactor for the specified
* ACE_Event_Handler object. Returns the number of notifications
@@ -390,65 +477,85 @@ public:
*/
virtual int purge_pending_notifications (ACE_Event_Handler * = 0,
ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK);
+
/// Does the reactor allow the application to resume the handle on
/// its own ie. can it pass on the control of handle resumption to
/// the application. The select reactor has no handlers that can be
/// resumed by the application. So return 0;
virtual int resumable_handler (void);
+
/*
* Hook to add concrete methods required to specialize the
* implementation with concrete methods required for the concrete
* reactor implementation, for example, select, tp reactors.
*/
//@@ REACTOR_SPL_PUBLIC_METHODS_ADD_HOOK
+
protected:
/// Allow manipulation of the <wait_set_> mask and <ready_set_> mask.
virtual int bit_ops (ACE_HANDLE handle,
ACE_Reactor_Mask mask,
ACE_Select_Reactor_Handle_Set &handle_set,
int ops);
+
/// Enqueue ourselves into the list of waiting threads at the
/// appropriate point specified by <requeue_position_>.
virtual void renew (void) = 0;
+
/// Check to see if the <Event_Handler> associated with @a handle is
/// suspended. Returns 0 if not, 1 if so.
virtual int is_suspended_i (ACE_HANDLE handle) = 0;
+
/// When register/unregister occur, then we need to re-eval our
/// wait/suspend/dispatch set.
virtual void clear_dispatch_mask (ACE_HANDLE handle,
ACE_Reactor_Mask mask);
+
/// Table that maps <ACE_HANDLEs> to <ACE_Event_Handler *>'s.
ACE_Select_Reactor_Handler_Repository handler_rep_;
+
/// Tracks handles that are ready for dispatch from <select>
ACE_Select_Reactor_Handle_Set dispatch_set_;
+
/// Tracks handles that are waited for by <select>.
ACE_Select_Reactor_Handle_Set wait_set_;
+
/// Tracks handles that are currently suspended.
ACE_Select_Reactor_Handle_Set suspend_set_;
+
/// Track HANDLES we are interested in for various events that must
/// be dispatched *without* going through <select>.
ACE_Select_Reactor_Handle_Set ready_set_;
+
/// Defined as a pointer to allow overriding by derived classes...
ACE_Timer_Queue *timer_queue_;
+
/// Handle signals without requiring global/static variables.
ACE_Sig_Handler *signal_handler_;
+
/// Callback object that unblocks the ACE_Select_Reactor if it's
/// sleeping.
ACE_Reactor_Notify *notify_handler_;
+
/// Keeps track of whether we should delete the timer queue (if we
/// didn't create it, then we don't delete it).
bool delete_timer_queue_;
+
/// Keeps track of whether we should delete the signal handler (if we
/// didn't create it, then we don't delete it).
bool delete_signal_handler_;
+
/// Keeps track of whether we need to delete the notify handler (if
/// we didn't create it, then we don't delete it).
bool delete_notify_handler_;
+
/// True if we've been initialized yet...
bool initialized_;
+
/// Restart the <handle_events> event-loop method automatically when
/// <select> is interrupted via <EINTR>.
int restart_;
+
/**
* Position that the main ACE_Select_Reactor thread is requeued in
* the list of waiters during a <notify> callback. If this value ==
@@ -457,8 +564,10 @@ protected:
* that indicates the number of waiters to skip over.
*/
int requeue_position_;
+
/// The original thread that created this Select_Reactor.
ACE_thread_t owner_;
+
/**
* True if state has changed during dispatching of
* <ACE_Event_Handlers>, else false. This is used to determine
@@ -466,6 +575,7 @@ protected:
* <Select_Reactor>'s <wait_for_multiple_events> loop.
*/
bool state_changed_;
+
/**
* If false then the Reactor will not mask the signals during the event
* dispatching. This is useful for applications that do not
@@ -473,22 +583,30 @@ protected:
* introduce by the kernel level locks required to change the mask.
*/
bool mask_signals_;
+
/// Controls/access whether the notify handler should renew the
/// Select_Reactor's token or not.
int supress_notify_renew (void);
void supress_notify_renew (int sr);
+
private:
+
/// Determine whether we should renew Select_Reactor's token after handling
/// the notification message.
int supress_renew_;
+
/// Deny access since member-wise won't work...
ACE_Select_Reactor_Impl (const ACE_Select_Reactor_Impl &);
ACE_Select_Reactor_Impl &operator = (const ACE_Select_Reactor_Impl &);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Select_Reactor_Base.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_SELECT_REACTOR_BASE_H */
diff --git a/dep/ACE_wrappers/ace/Select_Reactor_Base.inl b/dep/ACE_wrappers/ace/Select_Reactor_Base.inl
index 450e75d6066..d91492b3734 100644
--- a/dep/ACE_wrappers/ace/Select_Reactor_Base.inl
+++ b/dep/ACE_wrappers/ace/Select_Reactor_Base.inl
@@ -1,8 +1,11 @@
// -*- C++ -*-
//
// $Id: Select_Reactor_Base.inl 81138 2008-03-28 09:18:15Z johnnyw $
+
#include "ace/Reactor.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE ACE_Select_Reactor_Handler_Repository::size_type
ACE_Select_Reactor_Handler_Repository::size (void) const
{
@@ -12,6 +15,7 @@ ACE_Select_Reactor_Handler_Repository::size (void) const
return this->event_handlers_.size ();
#endif /* ACE_WIN32 */
}
+
ACE_INLINE ACE_Select_Reactor_Handler_Repository::max_handlep1_type
ACE_Select_Reactor_Handler_Repository::max_handlep1 (void) const
{
@@ -21,6 +25,7 @@ ACE_Select_Reactor_Handler_Repository::max_handlep1 (void) const
return this->max_handlep1_;
#endif /* ACE_WIN32 */
}
+
ACE_INLINE int
ACE_Select_Reactor_Handler_Repository::unbind (ACE_HANDLE handle,
ACE_Reactor_Mask mask)
@@ -28,19 +33,24 @@ ACE_Select_Reactor_Handler_Repository::unbind (ACE_HANDLE handle,
// Do not refactor this code to optimize the call to the unbind impl.
// To resolve bug 2653, unbind must be called even when find_eh returns
// event_handlers_.end().
+
return !this->handle_in_range (handle) ? -1
: this->unbind (handle,
this->find_eh (handle),
mask);
}
+
ACE_INLINE ACE_Event_Handler *
ACE_Select_Reactor_Handler_Repository::find (ACE_HANDLE handle)
{
ACE_TRACE ("ACE_Select_Reactor_Handler_Repository::find");
+
ACE_Event_Handler * eh = 0;
+
if (this->handle_in_range (handle))
{
map_type::iterator const pos = this->find_eh (handle);
+
if (pos != this->event_handlers_.end ())
{
#ifdef ACE_WIN32
@@ -56,9 +66,12 @@ ACE_Select_Reactor_Handler_Repository::find (ACE_HANDLE handle)
// {
// errno = ENOENT;
// }
+
return eh;
}
+
// ------------------------------------------------------------------
+
ACE_INLINE bool
ACE_Select_Reactor_Handler_Repository_Iterator::done (void) const
{
@@ -69,13 +82,16 @@ ACE_Select_Reactor_Handler_Repository_Iterator::done (void) const
+ this->rep_->max_handlep1 ());
#endif /* ACE_WIN32 */
}
+
// ------------------------------------------------------------------
+
ACE_INLINE
ACE_Event_Tuple::ACE_Event_Tuple (void)
: handle_ (ACE_INVALID_HANDLE),
event_handler_ (0)
{
}
+
ACE_INLINE
ACE_Event_Tuple::ACE_Event_Tuple (ACE_Event_Handler* eh,
ACE_HANDLE h)
@@ -83,16 +99,19 @@ ACE_Event_Tuple::ACE_Event_Tuple (ACE_Event_Handler* eh,
event_handler_ (eh)
{
}
+
ACE_INLINE bool
ACE_Event_Tuple::operator== (const ACE_Event_Tuple &rhs) const
{
return this->handle_ == rhs.handle_;
}
+
ACE_INLINE bool
ACE_Event_Tuple::operator!= (const ACE_Event_Tuple &rhs) const
{
return !(*this == rhs);
}
+
#if defined (ACE_WIN32_VC8) || defined (ACE_WIN32_VC9)
# pragma warning (push)
# pragma warning (disable:4355) /* Use of 'this' in initializer list */
@@ -117,14 +136,17 @@ ACE_Select_Reactor_Impl::ACE_Select_Reactor_Impl (bool ms)
#if defined (ACE_WIN32_VC8) || defined (ACE_WIN32_VC9)
# pragma warning (pop)
#endif
+
ACE_INLINE int
ACE_Select_Reactor_Impl::supress_notify_renew (void)
{
return this->supress_renew_;
}
+
ACE_INLINE void
ACE_Select_Reactor_Impl::supress_notify_renew (int sr)
{
this->supress_renew_ = sr;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Select_Reactor_T.h b/dep/ACE_wrappers/ace/Select_Reactor_T.h
index 25b0d60adf7..e3d8fe299ce 100644
--- a/dep/ACE_wrappers/ace/Select_Reactor_T.h
+++ b/dep/ACE_wrappers/ace/Select_Reactor_T.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Select_Reactor_T.h
@@ -8,26 +9,34 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_SELECT_REACTOR_T_H
#define ACE_SELECT_REACTOR_T_H
#include /**/ "ace/pre.h"
+
#include "ace/Select_Reactor_Base.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Lock_Adapter_T.h"
#include "ace/Token.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/*
* Hook for specializing the reactor with the concrete
* type, for example, select, or thread pool.
*/
//@@ REACTOR_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK
+
#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
typedef ACE_Token ACE_SELECT_TOKEN;
#else
typedef ACE_Noop_Token ACE_SELECT_TOKEN;
#endif /* ACE_MT_SAFE && ACE_MT_SAFE != 0 */
+
/**
* @class ACE_Select_Reactor_T
*
@@ -46,7 +55,9 @@ template <class ACE_SELECT_REACTOR_TOKEN>
class ACE_Select_Reactor_T : public ACE_Select_Reactor_Impl
{
public:
+
// = Initialization and termination methods.
+
/// If @a disable_notify_pipe is non-0 then the reactor will
/// not create a notification pipe, which will save two I/O handles
/// but will elide the <notify()> feature. If @a mask_signals is
@@ -60,6 +71,7 @@ public:
ACE_Reactor_Notify *notify = 0,
bool mask_signals = true,
int s_queue = ACE_SELECT_TOKEN::FIFO);
+
/// Initialize @c ACE_Select_Reactor with size @arg size.
/// If @arg disable_notify_pipe is non-0 then the reactor will
/// not create a notification pipe, which will save two I/O handles
@@ -84,6 +96,7 @@ public:
ACE_Reactor_Notify *notify = 0,
bool mask_signals = true,
int s_queue = ACE_SELECT_TOKEN::FIFO);
+
/**
* Initialize the @c ACE_Select_Reactor to manage
* @arg max_number_of_handles. If @arg restart is non-0 then the
@@ -107,25 +120,34 @@ public:
ACE_Timer_Queue * = 0,
int disable_notify_pipe = ACE_DISABLE_NOTIFY_PIPE_DEFAULT,
ACE_Reactor_Notify * = 0);
+
/// Returns -1 (not used in this implementation);
virtual int current_info (ACE_HANDLE, size_t &size);
+
/// Use a user specified signal handler instead.
virtual int set_sig_handler (ACE_Sig_Handler *signal_handler);
+
/// Set a user-specified timer queue.
virtual int timer_queue (ACE_Timer_Queue *tq);
+
/// Return the current ACE_Timer_Queue.
virtual ACE_Timer_Queue *timer_queue (void) const;
+
/// Close down the select_reactor and release all of its resources.
virtual int close (void);
+
/// Close down the select_reactor and release all of its resources.
virtual ~ACE_Select_Reactor_T (void);
+
// = Event loop drivers.
+
/**
* Returns non-zero if there are I/O events "ready" for dispatching,
* but does not actually dispatch the event handlers. By default,
* don't block while checking this, i.e., "poll".
*/
virtual int work_pending (const ACE_Time_Value &max_wait_time = ACE_Time_Value::zero);
+
/**
* This event loop driver that blocks for @a max_wait_time before
* returning. It will return earlier if timer events, I/O events,
@@ -148,6 +170,7 @@ public:
*/
virtual int handle_events (ACE_Time_Value *max_wait_time = 0);
virtual int alertable_handle_events (ACE_Time_Value *max_wait_time = 0);
+
/**
* This method is just like the one above, except the
* @a max_wait_time value is a reference and can therefore never be
@@ -158,19 +181,23 @@ public:
*/
virtual int handle_events (ACE_Time_Value &max_wait_time);
virtual int alertable_handle_events (ACE_Time_Value &max_wait_time);
+
// = Event handling control.
+
/**
* Return the status of Reactor. If this function returns 0, the reactor is
* actively handling events. If it returns non-zero, <handling_events> and
* <handle_alertable_events> return -1 immediately.
*/
virtual int deactivated (void);
+
/**
* Control whether the Reactor will handle any more incoming events or not.
* If @a do_stop == 1, the Reactor will be disabled. By default, a reactor
* is in active state and can be deactivated/reactived as wish.
*/
virtual void deactivate (int do_stop);
+
// = Register and remove ACE_Event_Handlers.
/**
* Register a @a eh with a particular @a mask. Note that the
@@ -179,6 +206,7 @@ public:
*/
virtual int register_handler (ACE_Event_Handler *eh,
ACE_Reactor_Mask mask);
+
/**
* Register a @a eh with a particular @a mask. Note that since the
* @a handle is given the Select_Reactor will *not* call
@@ -188,26 +216,33 @@ public:
virtual int register_handler (ACE_HANDLE handle,
ACE_Event_Handler *eh,
ACE_Reactor_Mask mask);
+
#if defined (ACE_WIN32)
+
// Originally this interface was available for all platforms, but
// because ACE_HANDLE is an int on non-Win32 platforms, compilers
// are not able to tell the difference between
// register_handler(ACE_Event_Handler*,ACE_Reactor_Mask) and
// register_handler(ACE_Event_Handler*,ACE_HANDLE). Therefore, we
// have restricted this method to Win32 only.
+
/// Not implemented.
virtual int register_handler (ACE_Event_Handler *event_handler,
ACE_HANDLE event_handle = ACE_INVALID_HANDLE);
+
#endif /* ACE_WIN32 */
+
/// Not implemented.
virtual int register_handler (ACE_HANDLE event_handle,
ACE_HANDLE io_handle,
ACE_Event_Handler *event_handler,
ACE_Reactor_Mask mask);
+
/// Register @a eh with all the @a handles in the <Handle_Set>.
virtual int register_handler (const ACE_Handle_Set &handles,
ACE_Event_Handler *eh,
ACE_Reactor_Mask mask);
+
/**
* Register @a new_sh to handle the signal @a signum using the
* @a new_disp. Returns the @a old_sh that was previously registered
@@ -218,11 +253,13 @@ public:
ACE_Sig_Action *new_disp = 0,
ACE_Event_Handler **old_sh = 0,
ACE_Sig_Action *old_disp = 0);
+
/// Registers @a new_sh to handle a set of signals @a sigset using the
/// @a new_disp.
virtual int register_handler (const ACE_Sig_Set &sigset,
ACE_Event_Handler *new_sh,
ACE_Sig_Action *new_disp = 0);
+
/**
* Removes the @a mask binding of <eh> from the Select_Reactor. If
* there are no more bindings for this <eh> then it is removed from
@@ -232,6 +269,7 @@ public:
*/
virtual int remove_handler (ACE_Event_Handler *eh,
ACE_Reactor_Mask mask);
+
/**
* Removes the @a mask bind of <Event_Handler> whose handle is
* <handle> from the Select_Reactor. If there are no more bindings
@@ -239,6 +277,7 @@ public:
*/
virtual int remove_handler (ACE_HANDLE handle,
ACE_Reactor_Mask);
+
/**
* Removes all the @a mask bindings for handles in the <handle_set>
* bind of <Event_Handler>. If there are no more bindings for any
@@ -246,6 +285,7 @@ public:
*/
virtual int remove_handler (const ACE_Handle_Set &handle_set,
ACE_Reactor_Mask);
+
/**
* Remove the ACE_Event_Handler currently associated with @a signum.
* <sigkey> is ignored in this implementation since there is only
@@ -257,27 +297,38 @@ public:
ACE_Sig_Action *new_disp,
ACE_Sig_Action *old_disp = 0,
int sigkey = -1);
+
/// Calls <remove_handler> for every signal in <sigset>.
virtual int remove_handler (const ACE_Sig_Set &sigset);
+
// = Suspend and resume Handlers.
+
/// Temporarily suspend the <Event_Handler> associated with <eh>.
virtual int suspend_handler (ACE_Event_Handler *eh);
+
/// Temporarily suspend the <Event_Handler> associated with <handle>.
virtual int suspend_handler (ACE_HANDLE handle);
+
/// Suspend all <handles> in handle set temporarily.
virtual int suspend_handler (const ACE_Handle_Set &handles);
+
/// Suspend all the <Event_Handlers> in the Select_Reactor.
virtual int suspend_handlers (void);
+
/// Resume a temporarily suspend <Event_Handler> associated with
/// <eh>.
virtual int resume_handler (ACE_Event_Handler *eh);
+
/// Resume a temporarily suspended <Event_Handler> associated with
/// <handle>.
virtual int resume_handler (ACE_HANDLE handle);
+
/// Resume all <handles> in handle set.
virtual int resume_handler (const ACE_Handle_Set &handles);
+
/// Resume all the <Event_Handlers> in the Select_Reactor.
virtual int resume_handlers (void);
+
/**
* Return 1 if we any event associations were made by the reactor
* for the handles that it waits on, 0 otherwise. Since the
@@ -285,6 +336,7 @@ public:
* always return 0.
*/
virtual int uses_event_associations (void);
+
// = Timer management.
/**
* Schedule an ACE_Event_Handler that will expire after an amount
@@ -308,6 +360,7 @@ public:
const void *arg,
const ACE_Time_Value &delay,
const ACE_Time_Value &interval = ACE_Time_Value::zero);
+
/**
* Resets the interval of the timer represented by @a timer_id to
* @a interval, which is specified in relative time to the current
@@ -317,6 +370,7 @@ public:
*/
virtual int reset_timer_interval (long timer_id,
const ACE_Time_Value &interval);
+
/**
* Cancel all <event_handlers> that match the address of
* <event_handler>. If @a dont_call_handle_close is 0 then the
@@ -325,6 +379,7 @@ public:
*/
virtual int cancel_timer (ACE_Event_Handler *event_handler,
int dont_call_handle_close = 1);
+
/**
* Cancel the single ACE_Event_Handler that matches the @a timer_id
* value (which was returned from the <schedule> method). If arg is
@@ -338,19 +393,25 @@ public:
virtual int cancel_timer (long timer_id,
const void **arg = 0,
int dont_call_handle_close = 1);
+
// = High-level Event_Handler scheduling operations
+
/// ADD the dispatch MASK "bit" bound with the <eh> and the @a mask.
virtual int schedule_wakeup (ACE_Event_Handler *eh,
ACE_Reactor_Mask mask);
+
/// ADD the dispatch MASK "bit" bound with the <handle> and the @a mask.
virtual int schedule_wakeup (ACE_HANDLE handle,
ACE_Reactor_Mask mask);
+
/// CLR the dispatch MASK "bit" bound with the <eh> and the @a mask.
virtual int cancel_wakeup (ACE_Event_Handler *eh,
ACE_Reactor_Mask mask);
+
/// CLR the dispatch MASK "bit" bound with the <handle> and the @a mask.
virtual int cancel_wakeup (ACE_HANDLE handle,
ACE_Reactor_Mask mask);
+
// = Notification methods.
/**
* Called by a thread when it wants to unblock the Select_Reactor.
@@ -366,6 +427,7 @@ public:
virtual int notify (ACE_Event_Handler * = 0,
ACE_Reactor_Mask = ACE_Event_Handler::EXCEPT_MASK,
ACE_Time_Value * = 0);
+
/**
* Set the maximum number of times that the
* <ACE_Select_Reactor_Notify::handle_input> method will iterate and
@@ -377,6 +439,7 @@ public:
* dispatching overhead.
*/
virtual void max_notify_iterations (int);
+
/**
* Get the maximum number of times that the
* <ACE_Select_Reactor_Notify::handle_input> method will iterate and
@@ -384,49 +447,64 @@ public:
* notify pipe before breaking out of its <recv> loop.
*/
virtual int max_notify_iterations (void);
+
/// Get the existing restart value.
virtual int restart (void);
+
/// Set a new value for restart and return the original value.
virtual int restart (int r);
+
/// Set position that the main ACE_Select_Reactor thread is requeued in the
/// list of waiters during a <notify> callback.
virtual void requeue_position (int);
+
/// Get position that the main ACE_Select_Reactor thread is requeued in the
/// list of waiters during a <notify> callback.
virtual int requeue_position (void);
+
// = Low-level wait_set mask manipulation methods.
/// GET/SET/ADD/CLR the dispatch mask "bit" bound with the <eh> and
/// @a mask.
virtual int mask_ops (ACE_Event_Handler *eh,
ACE_Reactor_Mask mask,
int ops);
+
/// GET/SET/ADD/CLR the dispatch MASK "bit" bound with the <handle>
/// and @a mask.
virtual int mask_ops (ACE_HANDLE handle,
ACE_Reactor_Mask mask,
int ops);
+
// = Low-level ready_set mask manipulation methods.
/// GET/SET/ADD/CLR the ready "bit" bound with the <eh> and @a mask.
virtual int ready_ops (ACE_Event_Handler *eh,
ACE_Reactor_Mask mask,
int ops);
+
/// GET/SET/ADD/CLR the ready "bit" bound with the <handle> and @a mask.
virtual int ready_ops (ACE_HANDLE handle,
ACE_Reactor_Mask,
int ops);
+
/// Wake up all threads in waiting in the event loop
virtual void wakeup_all_threads (void);
+
// = Only the owner thread can perform a <handle_events>.
+
/// Set the new owner of the thread and return the old owner.
virtual int owner (ACE_thread_t n_id, ACE_thread_t *o_id = 0);
+
/// Return the current owner of the thread.
virtual int owner (ACE_thread_t *);
+
// = Miscellaneous Handler operations.
+
/**
* Return the Event_Handler associated with <handle>. Return 0 if
* <handle> is not registered.
*/
virtual ACE_Event_Handler *find_handler (ACE_HANDLE handle);
+
/**
* Check to see if <handle> is associated with a valid Event_Handler
* bound to @a mask. Return the @a eh associated with this @a handler
@@ -435,6 +513,7 @@ public:
virtual int handler (ACE_HANDLE handle,
ACE_Reactor_Mask mask,
ACE_Event_Handler **eh = 0);
+
/**
* Check to see if @a signum is associated with a valid Event_Handler
* bound to a signal. Return the <eh> associated with this
@@ -442,11 +521,14 @@ public:
*/
virtual int handler (int signum,
ACE_Event_Handler ** = 0);
+
/// Returns true if we've been successfully initialized, else false.
virtual bool initialized (void);
+
/// Returns the current size of the Reactor's internal descriptor
/// table.
virtual size_t size (void) const;
+
/**
* Returns a reference to the ACE_Reactor_Token that is
* used to serialize the internal processing logic.
@@ -455,62 +537,83 @@ public:
* multiple threads.
*/
virtual ACE_Lock &lock (void);
+
/// Dump the state of an object.
virtual void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
// = Internal methods that do the actual work.
+
// All of these methods assume that the token
// lock is held by the public methods that call down to them.
+
/// Do the work of actually binding the <handle> and <eh> with the
/// @a mask.
virtual int register_handler_i (ACE_HANDLE handle,
ACE_Event_Handler *eh,
ACE_Reactor_Mask mask);
+
/// Register a set of <handles>.
virtual int register_handler_i (const ACE_Handle_Set &handles,
ACE_Event_Handler *handler,
ACE_Reactor_Mask mask);
+
/// Do the work of actually unbinding the <handle> and <eh> with the
/// @a mask.
virtual int remove_handler_i (ACE_HANDLE handle,
ACE_Reactor_Mask);
+
/// Remove a set of <handles>.
virtual int remove_handler_i (const ACE_Handle_Set &handles,
ACE_Reactor_Mask);
+
/// Suspend the <Event_Handler> associated with <handle>
virtual int suspend_i (ACE_HANDLE handle);
+
/// Check to see if the <Event_Handler> associated with <handle> is
/// suspended. Returns 0 if not, 1 if so.
virtual int is_suspended_i (ACE_HANDLE handle);
+
/// Resume the <Event_Handler> associated with <handle>
virtual int resume_i (ACE_HANDLE handle);
+
/// Implement the public handler method.
virtual ACE_Event_Handler *find_handler_i (ACE_HANDLE handle);
+
/// Implement the public handler method.
virtual int handler_i (ACE_HANDLE handle,
ACE_Reactor_Mask,
ACE_Event_Handler ** = 0);
+
/// Implement the public handler method.
virtual int handler_i (int signum, ACE_Event_Handler ** = 0);
+
/**
* Check if there are any HANDLEs enabled in the <ready_set_>, and
* if so, update the <handle_set> and return the number ready. If
* there aren't any HANDLEs enabled return 0.
*/
virtual int any_ready (ACE_Select_Reactor_Handle_Set &handle_set);
+
/// Implement the <any_ready> method, assuming that the Sig_Guard is
/// beign held
virtual int any_ready_i (ACE_Select_Reactor_Handle_Set &handle_set);
+
/// Take corrective action when errors occur.
virtual int handle_error (void);
+
/// Make sure the handles are all valid.
virtual int check_handles (void);
+
/// Wait for events to occur.
virtual int wait_for_multiple_events (ACE_Select_Reactor_Handle_Set &,
ACE_Time_Value *);
+
// = Dispatching methods.
+
/**
* Template Method that dispatches ACE_Event_Handlers for time
* events, I/O events, and signal events. Returns the total number
@@ -519,6 +622,7 @@ protected:
*/
virtual int dispatch (int nfound,
ACE_Select_Reactor_Handle_Set &);
+
/**
* Dispatch all timer handlers that have expired. Returns -1 if the
* state of the <wait_set_> has changed, else 0.
@@ -526,6 +630,7 @@ protected:
* dispatched.
*/
virtual int dispatch_timer_handlers (int &number_dispatched);
+
/**
* Dispatch any notification handlers. Returns -1 if the state of
* the <wait_set_> has changed, else returns number of handlers
@@ -534,6 +639,7 @@ protected:
virtual int dispatch_notification_handlers (ACE_Select_Reactor_Handle_Set &dispatch_set,
int &number_of_active_handles,
int &number_of_handlers_dispatched);
+
/**
* Dispatch all the input/output/except handlers that are enabled in
* the <dispatch_set>. Updates <number_of_active_handles> and
@@ -544,6 +650,7 @@ protected:
virtual int dispatch_io_handlers (ACE_Select_Reactor_Handle_Set &dispatch_set,
int &number_of_active_handles,
int &number_of_handlers_dispatched);
+
/**
* Factors the dispatching of an io handle set (each WRITE, EXCEPT
* or READ set of handles). It updates the
@@ -558,6 +665,7 @@ protected:
ACE_Handle_Set& dispatch_mask,
ACE_Handle_Set& ready_mask,
ACE_EH_PTMF callback);
+
/// Notify the appropriate <callback> in the context of the <eh>
/// associated with <handle> that a particular event has occurred.
virtual void notify_handle (ACE_HANDLE handle,
@@ -565,35 +673,47 @@ protected:
ACE_Handle_Set &,
ACE_Event_Handler *eh,
ACE_EH_PTMF callback);
+
/// Enqueue ourselves into the list of waiting threads at the
/// appropriate point specified by <requeue_position_>.
virtual void renew (void);
+
/// Synchronization token for the MT_SAFE ACE_Select_Reactor.
ACE_SELECT_REACTOR_TOKEN token_;
+
/// Adapter used to return internal lock to outside world.
ACE_Lock_Adapter<ACE_SELECT_REACTOR_TOKEN> lock_adapter_;
+
/// Release the token lock when a Win32 structured exception occurs.
int release_token (void);
+
/// Stops the VC++ compiler from bitching about exceptions and destructors
int handle_events_i (ACE_Time_Value *max_wait_time = 0);
+
/// This flag is used to keep track of whether we are actively handling
/// events or not.
sig_atomic_t deactivated_;
+
private:
/// Deny access since member-wise won't work...
ACE_UNIMPLEMENTED_FUNC (ACE_Select_Reactor_T (const ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN> &))
ACE_UNIMPLEMENTED_FUNC (ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN> &operator= (const ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN> &) )
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Select_Reactor_T.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Select_Reactor_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Select_Reactor_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
#endif /* ACE_SELECT_REACTOR_T_H */
diff --git a/dep/ACE_wrappers/ace/Select_Reactor_T.inl b/dep/ACE_wrappers/ace/Select_Reactor_T.inl
index 3c41ff68a90..05405a5b17b 100644
--- a/dep/ACE_wrappers/ace/Select_Reactor_T.inl
+++ b/dep/ACE_wrappers/ace/Select_Reactor_T.inl
@@ -1,10 +1,13 @@
// -*- C++ -*-
//
// $Id: Select_Reactor_T.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Reactor.h"
#include "ace/Signal.h"
#include "ace/Sig_Handler.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template <class ACE_SELECT_REACTOR_TOKEN>
ACE_INLINE int
ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::resume_handler (ACE_Event_Handler *h)
@@ -12,6 +15,7 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::resume_handler (ACE_Event_Handle
ACE_TRACE ("ACE_Select_Reactor_T::resume_handler");
return this->resume_handler (h->get_handle ());
}
+
template <class ACE_SELECT_REACTOR_TOKEN>
ACE_INLINE int
ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::resume_handler (const ACE_Handle_Set &handles)
@@ -19,12 +23,16 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::resume_handler (const ACE_Handle
ACE_TRACE ("ACE_Select_Reactor_T::resume_handler");
ACE_Handle_Set_Iterator handle_iter (handles);
ACE_HANDLE h;
+
ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1));
+
while ((h = handle_iter ()) != ACE_INVALID_HANDLE)
if (this->resume_i (h) == -1)
return -1;
+
return 0;
}
+
template <class ACE_SELECT_REACTOR_TOKEN>
ACE_INLINE int
ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::suspend_handler (ACE_Event_Handler *h)
@@ -32,6 +40,7 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::suspend_handler (ACE_Event_Handl
ACE_TRACE ("ACE_Select_Reactor_T::suspend_handler");
return this->suspend_handler (h->get_handle ());
}
+
template <class ACE_SELECT_REACTOR_TOKEN>
ACE_INLINE int
ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::suspend_handler (const ACE_Handle_Set &handles)
@@ -39,12 +48,16 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::suspend_handler (const ACE_Handl
ACE_TRACE ("ACE_Select_Reactor_T::suspend_handler");
ACE_Handle_Set_Iterator handle_iter (handles);
ACE_HANDLE h;
+
ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1));
+
while ((h = handle_iter ()) != ACE_INVALID_HANDLE)
if (this->suspend_i (h) == -1)
return -1;
+
return 0;
}
+
template <class ACE_SELECT_REACTOR_TOKEN>
ACE_INLINE int
ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::register_handler (int signum,
@@ -58,7 +71,9 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::register_handler (int signum,
new_sh, new_disp,
old_sh, old_disp);
}
+
#if defined (ACE_WIN32)
+
template <class ACE_SELECT_REACTOR_TOKEN>
ACE_INLINE int
ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::register_handler (ACE_Event_Handler *,
@@ -67,7 +82,9 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::register_handler (ACE_Event_Hand
// Don't have an implementation for this yet...
ACE_NOTSUP_RETURN (-1);
}
+
#endif /* ACE_WIN32 */
+
template <class ACE_SELECT_REACTOR_TOKEN>
ACE_INLINE int
ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::register_handler (ACE_HANDLE ,
@@ -78,6 +95,7 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::register_handler (ACE_HANDLE ,
// Don't have an implementation for this yet...
ACE_NOTSUP_RETURN (-1);
}
+
template <class ACE_SELECT_REACTOR_TOKEN>
ACE_INLINE int
ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::handler (int signum, ACE_Event_Handler **handler)
@@ -85,6 +103,7 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::handler (int signum, ACE_Event_H
ACE_TRACE ("ACE_Select_Reactor_T::handler");
return this->handler_i (signum, handler);
}
+
template <class ACE_SELECT_REACTOR_TOKEN>
ACE_INLINE int
ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::remove_handler (int signum,
@@ -95,6 +114,7 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::remove_handler (int signum,
ACE_TRACE ("ACE_Select_Reactor_T::remove_handler");
return this->signal_handler_->remove_handler (signum, new_disp, old_disp, sigkey);
}
+
template <class ACE_SELECT_REACTOR_TOKEN>
ACE_INLINE int
ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::uses_event_associations (void)
@@ -103,9 +123,12 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::uses_event_associations (void)
// function always return 0.
return 0;
}
+
// = The remaining methods in this file must be called with locks
// held.
+
// Performs operations on the "ready" bits.
+
template <class ACE_SELECT_REACTOR_TOKEN> ACE_INLINE int
ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::ready_ops (ACE_Event_Handler *handler,
ACE_Reactor_Mask mask,
@@ -114,7 +137,9 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::ready_ops (ACE_Event_Handler *ha
ACE_TRACE ("ACE_Select_Reactor_T::ready_ops");
return this->ready_ops (handler->get_handle (), mask, ops);
}
+
// Performs operations on the "dispatch" masks.
+
template <class ACE_SELECT_REACTOR_TOKEN> ACE_INLINE int
ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::mask_ops (ACE_Event_Handler *handler,
ACE_Reactor_Mask mask,
@@ -123,6 +148,7 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::mask_ops (ACE_Event_Handler *han
ACE_TRACE ("ACE_Select_Reactor_T::mask_ops");
return this->mask_ops (handler->get_handle (), mask, ops);
}
+
template <class ACE_SELECT_REACTOR_TOKEN> ACE_INLINE int
ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::schedule_wakeup (ACE_Event_Handler *eh,
ACE_Reactor_Mask mask)
@@ -130,6 +156,7 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::schedule_wakeup (ACE_Event_Handl
ACE_TRACE ("ACE_Select_Reactor_T::schedule_wakeup");
return this->mask_ops (eh->get_handle (), mask, ACE_Reactor::ADD_MASK);
}
+
template <class ACE_SELECT_REACTOR_TOKEN> ACE_INLINE int
ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::cancel_wakeup (ACE_Event_Handler *eh,
ACE_Reactor_Mask mask)
@@ -137,6 +164,7 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::cancel_wakeup (ACE_Event_Handler
ACE_TRACE ("ACE_Select_Reactor_T::cancel_wakeup");
return this->mask_ops (eh->get_handle (), mask, ACE_Reactor::CLR_MASK);
}
+
template <class ACE_SELECT_REACTOR_TOKEN> ACE_INLINE int
ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::schedule_wakeup (ACE_HANDLE handle,
ACE_Reactor_Mask mask)
@@ -144,6 +172,7 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::schedule_wakeup (ACE_HANDLE hand
ACE_TRACE ("ACE_Select_Reactor_T::schedule_wakeup");
return this->mask_ops (handle, mask, ACE_Reactor::ADD_MASK);
}
+
template <class ACE_SELECT_REACTOR_TOKEN> ACE_INLINE int
ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::cancel_wakeup (ACE_HANDLE handle,
ACE_Reactor_Mask mask)
@@ -151,12 +180,14 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::cancel_wakeup (ACE_HANDLE handle
ACE_TRACE ("ACE_Select_Reactor_T::cancel_wakeup");
return this->mask_ops (handle, mask, ACE_Reactor::CLR_MASK);
}
+
template <class ACE_SELECT_REACTOR_TOKEN> ACE_INLINE ACE_Lock &
ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::lock (void)
{
ACE_TRACE ("ACE_Select_Reactor_T::lock");
return this->lock_adapter_;
}
+
template <class ACE_SELECT_REACTOR_TOKEN> ACE_INLINE void
ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::wakeup_all_threads (void)
{
@@ -164,21 +195,25 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::wakeup_all_threads (void)
// it.
this->notify (0, ACE_Event_Handler::NULL_MASK, (ACE_Time_Value *) &ACE_Time_Value::zero);
}
+
template <class ACE_SELECT_REACTOR_TOKEN> ACE_INLINE int
ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::alertable_handle_events (ACE_Time_Value *max_wait_time)
{
return this->handle_events (max_wait_time);
}
+
template <class ACE_SELECT_REACTOR_TOKEN> ACE_INLINE int
ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::alertable_handle_events (ACE_Time_Value &max_wait_time)
{
return this->handle_events (max_wait_time);
}
+
template <class ACE_SELECT_REACTOR_TOKEN> ACE_INLINE int
ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::deactivated (void)
{
return this->deactivated_;
}
+
template <class ACE_SELECT_REACTOR_TOKEN> ACE_INLINE void
ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::deactivate (int do_stop)
{
@@ -188,11 +223,14 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::deactivate (int do_stop)
this->token_));
this->deactivated_ = do_stop;
}
+
this->wakeup_all_threads ();
}
+
template <class ACE_SELECT_REACTOR_TOKEN> ACE_INLINE size_t
ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::size (void) const
{
return this->handler_rep_.size ();
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Semaphore.cpp b/dep/ACE_wrappers/ace/Semaphore.cpp
index 0a57df0cc62..987a2014852 100644
--- a/dep/ACE_wrappers/ace/Semaphore.cpp
+++ b/dep/ACE_wrappers/ace/Semaphore.cpp
@@ -1,23 +1,32 @@
// $Id: Semaphore.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Semaphore.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Semaphore.inl"
#endif /* __ACE_INLINE__ */
+
#include "ace/Log_Msg.h"
#include "ace/ACE.h"
+
ACE_RCSID (ace,
Semaphore,
"$Id: Semaphore.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_Semaphore)
+
void
ACE_Semaphore::dump (void) const
{
// ACE_TRACE ("ACE_Semaphore::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n")));
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
}
+
ACE_Semaphore::ACE_Semaphore (unsigned int count,
int type,
const ACE_TCHAR *name,
@@ -42,10 +51,13 @@ ACE_Semaphore::ACE_Semaphore (unsigned int count,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_Semaphore::ACE_Semaphore")));
}
+
ACE_Semaphore::~ACE_Semaphore (void)
{
// ACE_TRACE ("ACE_Semaphore::~ACE_Semaphore");
+
this->remove ();
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Semaphore.h b/dep/ACE_wrappers/ace/Semaphore.h
index 6727421205f..82709ab6beb 100644
--- a/dep/ACE_wrappers/ace/Semaphore.h
+++ b/dep/ACE_wrappers/ace/Semaphore.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file Semaphore.h
@@ -10,16 +11,23 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//==========================================================================
+
#ifndef ACE_SEMAPHORE_H
#define ACE_SEMAPHORE_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/OS_NS_Thread.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Time_Value;
+
/**
* @class ACE_Semaphore
*
@@ -35,17 +43,21 @@ public:
const ACE_TCHAR *name = 0,
void * = 0,
int max = 0x7fffffff);
+
/// Implicitly destroy the semaphore.
~ACE_Semaphore (void);
+
/**
* Explicitly destroy the semaphore. Note that only one thread
* should call this method since it doesn't protect against race
* conditions.
*/
int remove (void);
+
/// Block the thread until the semaphore count becomes
/// greater than 0, then decrement it.
int acquire (void);
+
/**
* Block the thread until the semaphore count becomes greater than 0
* (at which point it is decremented) or until @a tv times out (in
@@ -62,6 +74,7 @@ public:
* -DACE_HAS_POSIX_SEM.
*/
int acquire (ACE_Time_Value &tv);
+
/**
* If @a tv == 0 then call <acquire()> directly. Otherwise, Block
* the thread until the semaphore count becomes greater than 0
@@ -78,6 +91,7 @@ public:
* -DACE_HAS_PTHREADS, rather than -DACE_HAS_STHREADS or
* -DACE_HAS_POSIX_SEM. */
int acquire (ACE_Time_Value *tv);
+
/**
* Conditionally decrement the semaphore if count is greater than 0
* (i.e., won't block). Returns -1 on failure. If we "failed"
@@ -85,24 +99,29 @@ public:
* @c EBUSY.
*/
int tryacquire (void);
+
/// Increment the semaphore by 1, potentially unblocking a waiting
/// thread.
int release (void);
+
/// Increment the semaphore by @a release_count, potentially
/// unblocking waiting threads.
int release (unsigned int release_count);
+
/**
* Acquire semaphore ownership. This calls <acquire> and is only
* here to make the ACE_Semaphore interface consistent with the
* other synchronization APIs.
*/
int acquire_read (void);
+
/**
* Acquire semaphore ownership. This calls <acquire> and is only
* here to make the ACE_Semaphore interface consistent with the
* other synchronization APIs.
*/
int acquire_write (void);
+
/**
* Conditionally acquire semaphore (i.e., won't block). This calls
* <tryacquire> and is only here to make the ACE_Semaphore
@@ -111,6 +130,7 @@ public:
* already had the lock, @c errno is set to @c EBUSY.
*/
int tryacquire_read (void);
+
/**
* Conditionally acquire semaphore (i.e., won't block). This calls
* <tryacquire> and is only here to make the ACE_Semaphore
@@ -119,6 +139,7 @@ public:
* already had the lock, @c errno is set to @c EBUSY.
*/
int tryacquire_write (void);
+
/**
* This is only here to make the ACE_Semaphore
* interface consistent with the other synchronization APIs.
@@ -126,29 +147,38 @@ public:
* the above calls, and returns 0 (success) always.
*/
int tryacquire_write_upgrade (void);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
/// Return the underlying lock.
const ACE_sema_t &lock (void) const;
+
protected:
ACE_sema_t semaphore_;
+
/// Keeps track of whether remove() has been called yet to avoid
/// multiple remove() calls, e.g., explicitly and implicitly in the
/// destructor. This flag isn't protected by a lock, so make sure
/// that you don't have multiple threads simultaneously calling
/// remove () on the same object, which is a bad idea anyway...
bool removed_;
+
private:
// = Prevent assignment and initialization.
void operator= (const ACE_Semaphore &);
ACE_Semaphore (const ACE_Semaphore &);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Semaphore.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_SEMAPHORE_H */
diff --git a/dep/ACE_wrappers/ace/Semaphore.inl b/dep/ACE_wrappers/ace/Semaphore.inl
index 0185eff490c..e0162dc247b 100644
--- a/dep/ACE_wrappers/ace/Semaphore.inl
+++ b/dep/ACE_wrappers/ace/Semaphore.inl
@@ -1,13 +1,16 @@
// -*- C++ -*-
//
// $Id: Semaphore.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE const ACE_sema_t &
ACE_Semaphore::lock (void) const
{
// ACE_TRACE ("ACE_Semaphore::lock");
return this->semaphore_;
}
+
ACE_INLINE int
ACE_Semaphore::remove (void)
{
@@ -20,74 +23,89 @@ ACE_Semaphore::remove (void)
}
return result;
}
+
ACE_INLINE int
ACE_Semaphore::acquire (void)
{
// ACE_TRACE ("ACE_Semaphore::acquire");
return ACE_OS::sema_wait (&this->semaphore_);
}
+
ACE_INLINE int
ACE_Semaphore::acquire (ACE_Time_Value &tv)
{
// ACE_TRACE ("ACE_Semaphore::acquire");
return ACE_OS::sema_wait (&this->semaphore_, tv);
}
+
ACE_INLINE int
ACE_Semaphore::acquire (ACE_Time_Value *tv)
{
// ACE_TRACE ("ACE_Semaphore::acquire");
return ACE_OS::sema_wait (&this->semaphore_, tv);
}
+
ACE_INLINE int
ACE_Semaphore::tryacquire (void)
{
// ACE_TRACE ("ACE_Semaphore::tryacquire");
return ACE_OS::sema_trywait (&this->semaphore_);
}
+
ACE_INLINE int
ACE_Semaphore::release (void)
{
// ACE_TRACE ("ACE_Semaphore::release");
return ACE_OS::sema_post (&this->semaphore_);
}
+
ACE_INLINE int
ACE_Semaphore::release (unsigned int release_count)
{
// ACE_TRACE ("ACE_Semaphore::release");
return ACE_OS::sema_post (&this->semaphore_, release_count);
}
+
// Acquire semaphore ownership. This calls <acquire> and is only
// here to make the <ACE_Semaphore> interface consistent with the
// other synchronization APIs.
+
ACE_INLINE int
ACE_Semaphore::acquire_read (void)
{
return this->acquire ();
}
+
// Acquire semaphore ownership. This calls <acquire> and is only
// here to make the <ACE_Semaphore> interface consistent with the
// other synchronization APIs.
+
ACE_INLINE int
ACE_Semaphore::acquire_write (void)
{
return this->acquire ();
}
+
// Conditionally acquire semaphore (i.e., won't block). This calls
// <tryacquire> and is only here to make the <ACE_Semaphore>
// interface consistent with the other synchronization APIs.
+
ACE_INLINE int
ACE_Semaphore::tryacquire_read (void)
{
return this->tryacquire ();
}
+
// Conditionally acquire semaphore (i.e., won't block). This calls
// <tryacquire> and is only here to make the <ACE_Semaphore>
// interface consistent with the other synchronization APIs.
+
ACE_INLINE int
ACE_Semaphore::tryacquire_write (void)
{
return this->tryacquire ();
}
+
// This is only here to make the <ACE_Semaphore> interface consistent
// with the other synchronization APIs. Assumes the caller has
// already acquired the semaphore using one of the above calls, and
@@ -97,4 +115,5 @@ ACE_Semaphore::tryacquire_write_upgrade (void)
{
return 0;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Service_Config.cpp b/dep/ACE_wrappers/ace/Service_Config.cpp
index 1f29d236031..6a1cd533e98 100644
--- a/dep/ACE_wrappers/ace/Service_Config.cpp
+++ b/dep/ACE_wrappers/ace/Service_Config.cpp
@@ -1,15 +1,20 @@
// $Id: Service_Config.cpp 81756 2008-05-22 09:47:33Z johnnyw $
+
#include "ace/Service_Config.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Service_Config.inl"
#endif /* __ACE_INLINE__ */
+
#include "ace/Service_Types.h"
#include "ace/Reactor.h"
#include "ace/Singleton.h"
#include "ace/Service_Repository.h"
+
#ifndef ACE_LACKS_UNIX_SIGNALS
# include "ace/Sig_Adapter.h"
#endif /* !ACE_LACKS_UNIX_SIGNALS */
+
#include "ace/OS_NS_time.h"
#include "ace/OS_NS_stdio.h"
#include "ace/OS_NS_unistd.h"
@@ -18,21 +23,26 @@
#include "ace/ARGV.h"
#include "ace/Log_Msg.h"
#include "ace/ACE.h"
+
ACE_RCSID (ace,
Service_Config,
"$Id: Service_Config.cpp 81756 2008-05-22 09:47:33Z johnnyw $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_Threading_Helper<ACE_Thread_Mutex>::~ACE_Threading_Helper ()
{
ACE_OS::thr_key_detach (this->key_, 0);
ACE_OS::thr_keyfree (this->key_);
}
+
ACE_Threading_Helper<ACE_Thread_Mutex>::ACE_Threading_Helper ()
: key_ (ACE_OS::NULL_key)
{
# if defined (ACE_HAS_TSS_EMULATION)
ACE_Object_Manager::init_tss ();
# endif
+
if (ACE_Thread::keycreate (&key_, 0, 0) == -1)
{
ACE_ERROR ((LM_ERROR,
@@ -40,6 +50,7 @@ ACE_Threading_Helper<ACE_Thread_Mutex>::ACE_Threading_Helper ()
""));
}
}
+
void
ACE_Threading_Helper<ACE_Thread_Mutex>::set (void* p)
{
@@ -48,6 +59,7 @@ ACE_Threading_Helper<ACE_Thread_Mutex>::set (void* p)
ACE_TEXT ("(%P|%t) Service Config failed to set thread key value: %p\n"),
""));
}
+
void*
ACE_Threading_Helper<ACE_Thread_Mutex>::get (void)
{
@@ -59,21 +71,26 @@ ACE_Threading_Helper<ACE_Thread_Mutex>::get (void)
0);
return temp;
}
+
ACE_Threading_Helper<ACE_Null_Mutex>::~ACE_Threading_Helper ()
{
}
+
ACE_Threading_Helper<ACE_Null_Mutex>::ACE_Threading_Helper ()
{
}
+
void
ACE_Threading_Helper<ACE_Null_Mutex>::set (void*)
{
}
+
void*
ACE_Threading_Helper<ACE_Null_Mutex>::get (void)
{
return ACE_Service_Config::singleton()->instance_.get ();
}
+
/**
* @c ACE_Service_Config is supposed to be a Singleton. This is the
* only Configuration Gestalt available for access from static
@@ -86,6 +103,7 @@ ACE_Threading_Helper<ACE_Null_Mutex>::get (void)
typedef ACE_Unmanaged_Singleton<ACE_Service_Config,
ACE_SYNCH_RECURSIVE_MUTEX> ACE_SERVICE_CONFIG_SINGLETON;
+
/// ctor
ACE_Service_Config_Guard::ACE_Service_Config_Guard (ACE_Service_Gestalt * psg)
: saved_ (ACE_Service_Config::current ())
@@ -98,14 +116,18 @@ ACE_Service_Config_Guard::ACE_Service_Config_Guard (ACE_Service_Gestalt * psg)
this->saved_.get (),
this->saved_->repo_,
psg->repo_));
+
// Modify the TSS if the repo has changed
ACE_Service_Config::current (psg);
}
+
ACE_Service_Config_Guard::~ACE_Service_Config_Guard (void)
{
ACE_Service_Gestalt* s = this->saved_.get ();
ACE_ASSERT (s != 0);
+
ACE_Service_Config::current (s);
+
if (ACE::debug ())
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("ACE (%P|%t) SCG:<dtor=%@>")
@@ -114,18 +136,26 @@ ACE_Service_Config_Guard::~ACE_Service_Config_Guard (void)
this->saved_->repo_));
}
+
ACE_ALLOC_HOOK_DEFINE (ACE_Service_Config)
+
// Set the signal handler to point to the handle_signal() function.
ACE_Sig_Adapter *ACE_Service_Config::signal_handler_ = 0;
+
// Trigger a reconfiguration.
sig_atomic_t ACE_Service_Config::reconfig_occurred_ = 0;
+
// = Set by command-line options.
+
/// Pathname of file to write process id.
ACE_TCHAR *ACE_Service_Config::pid_file_name_ = 0;
+
/// Shall we become a daemon process?
bool ACE_Service_Config::be_a_daemon_ = false;
+
/// Number of the signal used to trigger reconfiguration.
int ACE_Service_Config::signum_ = SIGHUP;
+
void
ACE_Service_Config::dump (void) const
{
@@ -133,10 +163,12 @@ ACE_Service_Config::dump (void) const
ACE_TRACE ("ACE_Service_Config::dump");
#endif /* ACE_HAS_DUMP */
}
+
int
ACE_Service_Config::parse_args_i (int argc, ACE_TCHAR *argv[])
{
ACE_TRACE ("ACE_Service_Config::parse_args_i");
+
// Using PERMUTE_ARGS (default) in order to have all
// unrecognized options and their value arguments moved
// to the end of the argument vector. We'll pick them up
@@ -150,10 +182,12 @@ ACE_Service_Config::parse_args_i (int argc, ACE_TCHAR *argv[])
0, // Do not report errors
ACE_Get_Opt::RETURN_IN_ORDER);
//FUZZ: enable check_for_lack_ACE_OS
+
// Keep a list of all unknown arguments, begin with the
// executable's name
ACE_ARGV superargv;
superargv.add (argv[0]);
+
//FUZZ: disable check_for_lack_ACE_OS
for (int c; (c = getopt ()) != -1; )
//FUZZ: enable check_for_lack_ACE_OS
@@ -172,6 +206,7 @@ ACE_Service_Config::parse_args_i (int argc, ACE_TCHAR *argv[])
#if !defined (ACE_LACKS_UNIX_SIGNALS)
ACE_Service_Config::signum_ =
ACE_OS::atoi (getopt.opt_arg ());
+
if (ACE_Reactor::instance ()->register_handler
(ACE_Service_Config::signum_,
ACE_Service_Config::signal_handler_) == -1)
@@ -184,15 +219,19 @@ ACE_Service_Config::parse_args_i (int argc, ACE_TCHAR *argv[])
default:
superargv.add (argv[getopt.opt_ind () - 1], true);
}
+
// Collect any argumets that were left
for (int c = getopt.opt_ind (); c < argc; ++c)
superargv.add (argv[c-1], true);
+
bool ignore_default_svc_conf_file = false;
return instance_->parse_args_i (superargv.argc (),
superargv.argv (),
ignore_default_svc_conf_file);
+
} /* parse_args_i () */
+
int
ACE_Service_Config::open_i (const ACE_TCHAR program_name[],
const ACE_TCHAR *logger_key,
@@ -202,25 +241,33 @@ ACE_Service_Config::open_i (const ACE_TCHAR program_name[],
{
ACE_TRACE ("ACE_Service_Config::open_i");
ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1));
+
ACE_Log_Msg *log_msg = ACE_LOG_MSG;
+
if (ACE::debug ())
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("ACE (%P|%t) SC::open_i - this=%@, opened=%d\n"),
this, this->is_opened_));
+
// Guard against reentrant processing.
if (this->is_opened_)
return 0;
+
this->is_opened_ = true;
+
// Check for things we need to do on a per-process basis and which
// may not be safe, or wise to do an a per instance basis
+
// Become a daemon before doing anything else.
if (ACE_Service_Config::be_a_daemon_)
ACE::daemonize ();
+
// Write process id to file.
if (this->pid_file_name_ != 0)
{
FILE* pidf = ACE_OS::fopen (this->pid_file_name_,
ACE_TEXT("w"));
+
if (pidf != 0)
{
ACE_OS::fprintf (pidf,
@@ -229,11 +276,15 @@ ACE_Service_Config::open_i (const ACE_TCHAR program_name[],
ACE_OS::fclose (pidf);
}
}
+
u_long flags = log_msg->flags ();
+
// Only use STDERR if the caller hasn't already set the flags.
if (flags == 0)
flags = (u_long) ACE_Log_Msg::STDERR;
+
const ACE_TCHAR *key = logger_key;
+
if (key == 0 || ACE_OS::strcmp (key, ACE_DEFAULT_LOGGER_KEY) == 0)
// Only use the static <logger_key_> if the caller doesn't
// override it in the parameter list or if the key supplied is
@@ -241,19 +292,24 @@ ACE_Service_Config::open_i (const ACE_TCHAR program_name[],
key = ACE_Service_Config::current()->logger_key_;
else
ACE_SET_BITS (flags, ACE_Log_Msg::LOGGER);
+
if (log_msg->open (program_name,
flags,
key) == -1)
return -1;
+
if (ACE::debug ())
ACE_DEBUG ((LM_STARTUP,
ACE_TEXT ("starting up daemon %n\n")));
+
// Initialize the Service Repository (this will still work if
// user forgets to define an object of type ACE_Service_Config).
ACE_Service_Repository::instance (ACE_Service_Gestalt::MAX_SERVICES);
+
// Initialize the ACE_Reactor (the ACE_Reactor should be the
// same size as the ACE_Service_Repository).
ACE_Reactor::instance ();
+
// There's no point in dealing with this on NT since it doesn't
// really support signals very well...
#if !defined (ACE_LACKS_UNIX_SIGNALS)
@@ -270,8 +326,10 @@ ACE_Service_Config::open_i (const ACE_TCHAR program_name[],
ACE_TEXT ("can't register signal handler\n")));
}
#endif /* ACE_LACKS_UNIX_SIGNALS */
+
return 0;
}
+
/// Return the global configuration instance. Always returns the same
/// instance
ACE_Service_Config *
@@ -279,12 +337,14 @@ ACE_Service_Config::singleton (void)
{
return ACE_SERVICE_CONFIG_SINGLETON::instance ();
}
+
int
ACE_Service_Config::insert (ACE_Static_Svc_Descriptor* stsd)
{
return ACE_Service_Config::instance ()->insert (stsd);
}
+
// Totally remove <svc_name> from the daemon by removing it from the
// ACE_Reactor, and unlinking it if necessary.
int
@@ -293,19 +353,23 @@ ACE_Service_Config::remove (const ACE_TCHAR svc_name[])
ACE_TRACE ("ACE_Service_Config::remove");
return ACE_Service_Repository::instance ()->remove (svc_name);
}
+
// Suspend <svc_name>. Note that this will not unlink the service
// from the daemon if it was dynamically linked, it will mark it as
// being suspended in the Service Repository and call the <suspend>
// member function on the appropriate <ACE_Service_Object>. A service
// can be resumed later on by calling the <resume> method...
+
int
ACE_Service_Config::suspend (const ACE_TCHAR svc_name[])
{
ACE_TRACE ("ACE_Service_Config::suspend");
return ACE_Service_Repository::instance ()->suspend (svc_name);
}
+
// Resume a SVC_NAME that was previously suspended or has not yet
// been resumed (e.g., a static service).
+
int
ACE_Service_Config::resume (const ACE_TCHAR svc_name[])
{
@@ -313,35 +377,43 @@ ACE_Service_Config::resume (const ACE_TCHAR svc_name[])
return ACE_Service_Repository::instance ()->resume (svc_name);
}
+
ACE_Service_Config::ACE_Service_Config (bool ignore_static_svcs,
size_t size,
int signum)
{
ACE_TRACE ("ACE_Service_Config::ACE_Service_Config");
+
// TODO: Need to find a more customizable way of instantiating the
// gestalt but perhaps we should leave this out untill such
// customizations are identified.
ACE_Service_Gestalt* tmp = 0;
ACE_NEW_NORETURN (tmp,
ACE_Service_Gestalt (size, false, ignore_static_svcs));
+
this->is_opened_ = false;
this->instance_ = tmp;
this->threadkey_.set (tmp);
+
ACE_Service_Config::signum_ = signum;
}
+
ACE_Service_Config::ACE_Service_Config (const ACE_TCHAR program_name[],
const ACE_TCHAR *logger_key)
{
ACE_TRACE ("ACE_Service_Config::ACE_Service_Config");
+
// TODO: Need to find a more customizable way of instantiating the
// gestalt but perhaps we should leave this out untill such
// customizations are identified.
ACE_Service_Gestalt* tmp = 0;
ACE_NEW_NORETURN (tmp,
ACE_Service_Gestalt (ACE_Service_Repository::DEFAULT_SIZE, false));
+
this->is_opened_ = false;
this->instance_ = tmp;
this->threadkey_.set (tmp);
+
if (this->open (program_name,
logger_key) == -1 && errno != ENOENT)
{
@@ -352,6 +424,7 @@ ACE_Service_Config::ACE_Service_Config (const ACE_TCHAR program_name[],
program_name));
}
}
+
/// Return the "global" configuration instance, for the current
/// thread. This may be the same as instance(), but on some occasions,
/// it may be a different one. For example, ACE_Service_Config_Guard
@@ -362,6 +435,7 @@ ACE_Service_Config::current (void)
{
void* temp = ACE_Service_Config::singleton()->threadkey_.get ();
if (temp == 0) {
+
// The most likely reason is that the current thread was spawned
// by some native primitive, like pthreads or Windows API - not
// from ACE. This is perfectly legal for callers who are not, or
@@ -370,11 +444,14 @@ ACE_Service_Config::current (void)
// support will work - they would always get the global context,
// because at this point there is no information what the "parent"
// thread's configuration context was.
+
temp = global();
singleton()->threadkey_.set (temp);
}
+
return static_cast<ACE_Service_Gestalt*> (temp);
}
+
/// A mutator to set the "current" (TSS) gestalt instance.
void
ACE_Service_Config::current (ACE_Service_Gestalt* newcurrent)
@@ -382,6 +459,8 @@ ACE_Service_Config::current (ACE_Service_Gestalt* newcurrent)
ACE_Service_Config::singleton()->threadkey_.set (newcurrent);
}
+
+
#if (ACE_USES_CLASSIC_SVC_CONF == 0)
ACE_Service_Type *
ACE_Service_Config::create_service_type (const ACE_TCHAR *n,
@@ -396,6 +475,7 @@ ACE_Service_Config::create_service_type (const ACE_TCHAR *n,
return sp;
}
#endif /* ACE_USES_CLASSIC_SVC_CONF == 0 */
+
ACE_Service_Type_Impl *
ACE_Service_Config::create_service_type_impl (const ACE_TCHAR *name,
int type,
@@ -404,9 +484,11 @@ ACE_Service_Config::create_service_type_impl (const ACE_TCHAR *name,
ACE_Service_Object_Exterminator gobbler)
{
ACE_Service_Type_Impl *stp = 0;
+
// Note, the only place we need to put a case statement. This is
// also the place where we'd put the RTTI tests, if the compiler
// actually supported them!
+
switch (type)
{
case ACE_Service_Type::SERVICE_OBJECT:
@@ -432,8 +514,10 @@ ACE_Service_Config::create_service_type_impl (const ACE_TCHAR *name,
break;
}
return stp;
+
}
+
// Signal handling API to trigger dynamic reconfiguration.
void
ACE_Service_Config::handle_signal (int sig,
@@ -445,14 +529,18 @@ ACE_Service_Config::handle_signal (int sig,
#else /* ! ACE_NDEBUG */
ACE_ASSERT (ACE_Service_Config::signum_ == sig);
#endif /* ! ACE_NDEBUG */
+
ACE_Service_Config::reconfig_occurred_ = 1;
}
+
// Trigger reconfiguration to re-read configuration files.
void
ACE_Service_Config::reconfigure (void)
{
ACE_TRACE ("ACE_Service_Config::reconfigure");
+
ACE_Service_Config::reconfig_occurred_ = 0;
+
if (ACE::debug ())
{
#if !defined (ACE_NLOGGING)
@@ -468,39 +556,51 @@ ACE_Service_Config::reconfigure (void)
ACE_TEXT ("%p\n"),
ACE_TEXT ("process_directives")));
}
+
// Tidy up and perform last rites on a terminating ACE_Service_Config.
int
ACE_Service_Config::close (void)
{
ACE_Service_Config::singleton ()->instance_->close ();
+
// Delete the service repository. All the objects inside the
// service repository should already have been finalized.
ACE_Service_Repository::close_singleton ();
+
// Do away with the singleton ACE_Service_Config (calls dtor)
ACE_SERVICE_CONFIG_SINGLETON::close ();
+
return 0;
}
+
int
ACE_Service_Config::fini_svcs (void)
{
ACE_TRACE ("ACE_Service_Config::fini_svcs");
+
// Clear the LM_DEBUG bit from log messages if appropriate
if (ACE::debug ())
ACE_Log_Msg::disable_debug_messages ();
+
int result = 0;
if (ACE_Service_Repository::instance () != 0)
result = ACE_Service_Repository::instance ()->fini ();
+
if (ACE::debug ())
ACE_Log_Msg::enable_debug_messages ();
+
return result;
}
+
/// Perform user-specified close activities and remove dynamic memory.
ACE_Service_Config::~ACE_Service_Config (void)
{
ACE_TRACE ("ACE_Service_Config::~ACE_Service_Config");
}
+
// ************************************************************
+
/* static */
int
ACE_Service_Config::reconfig_occurred (void)
@@ -508,11 +608,13 @@ ACE_Service_Config::reconfig_occurred (void)
ACE_TRACE ("ACE_Service_Config::reconfig_occurred");
return ACE_Service_Config::reconfig_occurred_ != 0;
}
+
void
ACE_Service_Config::reconfig_occurred (int config_occurred)
{
ACE_TRACE ("ACE_Service_Config::reconfig_occurred");
ACE_Service_Config::reconfig_occurred_ = config_occurred;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Service_Config.h b/dep/ACE_wrappers/ace/Service_Config.h
index a10411c3679..6b7241e46ae 100644
--- a/dep/ACE_wrappers/ace/Service_Config.h
+++ b/dep/ACE_wrappers/ace/Service_Config.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//====================================================================
/**
* @file Service_Config.h
@@ -8,19 +9,26 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//====================================================================
+
#ifndef ACE_SERVICE_CONFIG_H
#define ACE_SERVICE_CONFIG_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
#include "ace/Default_Constants.h"
#include "ace/Intrusive_Auto_Ptr.h"
#include "ace/Service_Gestalt.h"
#include "ace/Synch_Traits.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/OS_NS_signal.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward decl.
class ACE_Service_Object;
class ACE_Service_Type;
@@ -31,6 +39,7 @@ class ACE_Allocator;
class ACE_Reactor;
class ACE_Thread_Manager;
class ACE_DLL;
+
#if (ACE_USES_CLASSIC_SVC_CONF == 1)
#define ACE_STATIC_SERVICE_DIRECTIVE(ident, parameters) \
ACE_TEXT ("static ") \
@@ -77,12 +86,16 @@ class ACE_Svc_Conf_Param;
ACE_TEXT ("\"></remove></ACE_Svc_Conf>")
class ACE_XML_Svc_Conf;
#endif /* ACE_USES_CLASSIC_SVC_CONF == 1 */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
extern "C"
{
typedef ACE_Service_Object *(*ACE_SERVICE_ALLOCATOR) (ACE_Service_Object_Exterminator *);
}
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Static_Svc_Descriptor
*
@@ -94,25 +107,34 @@ class ACE_Static_Svc_Descriptor
public:
/// Name of the service.
const ACE_TCHAR *name_;
+
/// Type of service.
int type_;
+
/// Factory function that allocates the service.
ACE_SERVICE_ALLOCATOR alloc_;
+
/// Bitmask flags indicating how the framework should delete memory.
u_int flags_;
+
/// Flag indicating whether the service starts out active.
int active_;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
public:
/// Compare two service descriptors for equality.
bool operator== (ACE_Static_Svc_Descriptor &) const;
+
/// Compare two service descriptors for inequality.
bool operator!= (ACE_Static_Svc_Descriptor &) const;
};
+
/**
* @class ACE_Threading_Helper
*
@@ -129,6 +151,7 @@ template <typename LOCK>
class ACE_Threading_Helper
{
};
+
/*
* Specialization for a multi threaded program
*/
@@ -138,13 +161,16 @@ class ACE_Export ACE_Threading_Helper<ACE_Thread_Mutex>
public:
ACE_Threading_Helper ();
~ACE_Threading_Helper ();
+
void set (void*);
void* get (void);
+
private:
/// Key for the thread-specific data, which is a simple pointer to
/// the thread's (currently-) global configuration context.
ACE_thread_key_t key_;
};
+
/*
* Specialization for a single threaded program
*/
@@ -154,10 +180,13 @@ class ACE_Export ACE_Threading_Helper<ACE_Null_Mutex>
public:
ACE_Threading_Helper ();
~ACE_Threading_Helper ();
+
void set (void*);
void* get (void);
};
+
#define ACE_Component_Config ACE_Service_Config
+
/**
* @class ACE_Service_Config
*
@@ -191,18 +220,23 @@ public:
*/
class ACE_Export ACE_Service_Config
{
+
/// The Instance, or the global (default) configuration context.
/// The monostate would forward the calls to that instance. The TSS
/// will point here
ACE_Intrusive_Auto_Ptr<ACE_Service_Gestalt> instance_;
+
/// A helper instance to manage thread-specific key creation.
/// Dependent on the syncronization mutex ACE uses, the corresponding
/// partial template instantiation will perform the right services
/// that have to do with managing thread-specific storage. Note that,
/// for single-threaded builds they would do (next to) nothing.
ACE_Threading_Helper<ACE_SYNCH_MUTEX> threadkey_;
+
public:
+
// = Initialization and termination methods.
+
/**
* Initialize the Service Repository. Note that initialising @a
* signum to a negative number will prevent a signal handler being
@@ -211,6 +245,7 @@ public:
ACE_Service_Config (bool ignore_static_svcs = true,
size_t size = ACE_DEFAULT_SERVICE_REPOSITORY_SIZE,
int signum = SIGHUP);
+
/**
* Performs an open without parsing command-line arguments. The
* @a logger_key indicates where to write the logging output, which
@@ -218,10 +253,13 @@ public:
*/
ACE_Service_Config (const ACE_TCHAR program_name[],
const ACE_TCHAR *logger_key = ACE_DEFAULT_LOGGER_KEY);
+
/// Perform user-specified close activities and remove dynamic
/// memory.
virtual ~ACE_Service_Config (void);
+
private:
+
/**
* Performs an open without parsing command-line arguments.
* Implements whats different in the opening sequence
@@ -240,18 +278,22 @@ private:
bool ignore_static_svcs,
bool ignore_default_svc_conf_file,
bool ignore_debug_flag);
+
/**
* Implements whats different in the command line parameter processing
* for this class, as opposed to the base class.
*/
virtual int parse_args_i (int argc, ACE_TCHAR *argv[]);
+
/// = Static interfaces
+
public:
/**
* Returns the process-wide global singleton instance. It would
* have been created and will be managed by the Object Manager.
*/
static ACE_Service_Config* singleton (void);
+
/**
* Mutator for the currently active configuration context instance
* (gestalt). Intended for use by helper classes like @see
@@ -260,10 +302,12 @@ private:
* initializers (especially those in DLLs loaded at run-time).
*/
static void current (ACE_Service_Gestalt*);
+
/**
* Accessor for the "current" service gestalt
*/
static ACE_Service_Gestalt* current (void);
+
/**
* This is what the static service initializators are hard-wired to
* use, so in order to avoid interface changes this method merely
@@ -276,6 +320,7 @@ private:
* @deprecated Use current() instead.
*/
static ACE_Service_Gestalt* instance (void);
+
/**
* Returns a process-wide global singleton instance in contrast with
* current (), which may return a different instance at different
@@ -285,6 +330,7 @@ private:
* caution!
*/
static ACE_Service_Gestalt* global (void);
+
/**
* Performs an open without parsing command-line arguments. The
* @a logger_key indicates where to write the logging output, which
@@ -304,6 +350,7 @@ private:
bool ignore_static_svcs = true,
bool ignore_default_svc_conf_file = false,
bool ignore_debug_flag = false);
+
/**
* This is the primary entry point into the ACE_Service_Config (the
* constructor just handles simple initializations). It parses
@@ -360,28 +407,37 @@ private:
bool ignore_static_svcs = true,
bool ignore_default_svc_conf_file = false,
bool ignore_debug_flag = false);
+
/// Tidy up and perform last rites when ACE_Service_Config is shut
/// down. This method calls close_svcs(). Returns 0.
static int close (void);
+
/// Perform user-specified close hooks and possibly delete all of the
/// configured services in the <Service_Repository>.
static int fini_svcs (void);
+
/// True if reconfiguration occurred.
static int reconfig_occurred (void);
+
/// Indicate that reconfiguration occurred.
static void reconfig_occurred (int);
+
/// Perform the reconfiguration process.
static void reconfigure (void);
+
// = The following methods are static in order to enforce Singleton
// semantics for the Reactor, Service_Repository, Thread_Manager,
// and Acceptor/Connector Strategy factory. Other portions of the
// system may need to access them at some point or another...
+
// = This is not strictly needed, anymore since the service configurator
// has been refactored to allow multiple service configuration
// instances (called gestalts). The interfaces, however were retained in for
// the sake of maintaining source-code compatibility.
+
// = Accessors and mutators for process-wide Singletons.
+
/// Returns a pointer to the list of statically linked services.
///
/// @deprecated - Same as instance(), but still useful in legacy code,
@@ -390,6 +446,7 @@ private:
///
/// ACE_Service_Config::static_svcs ()->insert (...);
static ACE_Service_Gestalt* static_svcs (void);
+
/// Insert a static service descriptor for processing on open_i(). The
/// corresponding ACE_STATIC_SVC_* macros were chaged to use this method
/// instead of obtaining a ptr to a container. See the note on static_svcs().
@@ -397,17 +454,21 @@ private:
/// services repository and provide a better way of debugging service
/// loading and registration problems.
static int insert (ACE_Static_Svc_Descriptor *svc);
+
// = Utility methods.
/// Dynamically link the shared object file and retrieve a pointer to
/// the designated shared object in this file.
static int initialize (const ACE_Service_Type *,
const ACE_TCHAR *parameters);
+
/// Initialize and activate a statically @a svc_name service.
static int initialize (const ACE_TCHAR *svc_name,
const ACE_TCHAR *parameters);
+
/// Resume a @a svc_name that was previously suspended or has not yet
/// been resumed (e.g., a static service).
static int resume (const ACE_TCHAR svc_name[]);
+
/**
* Suspend @a svc_name. Note that this will not unlink the service
* from the daemon if it was dynamically linked, it will mark it as
@@ -417,9 +478,11 @@ private:
* function...
*/
static int suspend (const ACE_TCHAR svc_name[]);
+
/// Totally remove @a svc_name from the daemon by removing it
/// from the ACE_Reactor, and unlinking it if necessary.
static int remove (const ACE_TCHAR svc_name[]);
+
#if defined (ACE_HAS_WINCE) && defined (ACE_USES_WCHAR)
// We must provide these function to bridge the Svc_Conf parser
// with ACE.
@@ -429,18 +492,24 @@ private:
static int suspend (const ACE_ANTI_TCHAR svc_name[]);
static int remove (const ACE_ANTI_TCHAR svc_name[]);
#endif /* ACE_HAS_WINCE */
+
/// Dump the state of an object.
void dump (void) const;
+
/// Set the signal_handler;for internal use by ACE_Object_Manager only.
static ACE_INLINE void signal_handler (ACE_Sig_Adapter *);
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
/// Process a file containing a list of service configuration
/// directives.
static int process_file (const ACE_TCHAR file[]);
+
/// Process one service configuration @a directive, which is passed as
/// a string. Returns the number of errors that occurred.
static int process_directive (const ACE_TCHAR directive[]);
+
/**
* Process one static service definition. Load a new static service
* into the ACE_Service_Repository.
@@ -455,14 +524,17 @@ private:
*/
static int process_directive (const ACE_Static_Svc_Descriptor &ssd,
bool force_replace = false);
+
/**
* Process (or re-process) service configuration requests that are
* provided in the svc.conf file(s). Returns the number of errors
* that occurred.
*/
static int process_directives (void);
+
/// Handles signals to trigger reconfigurations.
static void handle_signal (int sig, siginfo_t *, ucontext_t *);
+
/**
* Handle the command-line options intended for the
* ACE_Service_Config. Note that @c argv[0] is assumed to be the
@@ -481,29 +553,36 @@ private:
* for a list of files and here a list of services.
*/
static int parse_args (int, ACE_TCHAR *argv[]);
+
#if (ACE_USES_CLASSIC_SVC_CONF == 0)
static ACE_Service_Type *create_service_type (const ACE_TCHAR *n,
ACE_Service_Type_Impl *o,
ACE_DLL &dll,
int active);
#endif /* ACE_USES_CLASSIC_SVC_CONF == 0 */
+
static ACE_Service_Type_Impl *
create_service_type_impl (const ACE_TCHAR *name,
int type,
void *symbol,
u_int flags,
ACE_Service_Object_Exterminator gobbler);
+
/// @deprecated
/// Process service configuration requests that were provided on the
/// command-line. Returns the number of errors that occurred.
static int process_commandline_directives (void);
+
/// Become a daemon.
static int start_daemon (void);
+
// @deprecated
// Add the default statically-linked services to the
// ACE_Service_Repository.
static int load_static_svcs (void);
+
protected:
+
#if (ACE_USES_CLASSIC_SVC_CONF == 1)
/// @deprecated
/// This is the implementation function that process_directives()
@@ -512,25 +591,35 @@ protected:
static int process_directives_i (ACE_Svc_Conf_Param *param);
#endif /* ACE_USES_CLASSIC_SVC_CONF == 1 */
+
// = Process-wide state.
+
private:
+
/// Have we called ACE_Service_Config::open() yet?
bool is_opened_;
+
#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
/// Synchronization variable for open, etc.
mutable ACE_SYNCH_MUTEX lock_;
#endif /* ACE_MT_SAFE */
+
/// True if reconfiguration occurred.
static sig_atomic_t reconfig_occurred_;
+
// = Set by command-line options.
/// Shall we become a daemon process?
static bool be_a_daemon_;
+
/// Pathname of file to write process id.
static ACE_TCHAR *pid_file_name_;
+
/// Number of the signal used to trigger reconfiguration.
static int signum_;
+
/// Handles the reconfiguration signals.
static ACE_Sig_Adapter *signal_handler_;
+
/// Pointer to the Singleton (ACE_Cleanup) Gestalt instance.
/// There is thread-specific global instance pointer, which is used to
/// temporarily change which Gestalt instance is used for static service
@@ -547,13 +636,16 @@ private:
/// deallocated, but the global service repository will still "think"
/// it must finalize the (DLL's) static services - with disastrous
/// consequences, occurring in the post-main code (at_exit()).
+
/// This class needs the intimate access to be able to swap the
/// current TSS pointer for the global Gestalt.
friend class ACE_Service_Config_Guard;
+
/// The helper needs intimate access (when building with no threads)
friend class ACE_Threading_Helper <ACE_Thread_Mutex>;
friend class ACE_Threading_Helper <ACE_Null_Mutex>;
};
+
/**
* @class ACE_Service_Config_Guard
*
@@ -570,18 +662,24 @@ class ACE_Export ACE_Service_Config_Guard
public:
ACE_Service_Config_Guard (ACE_Service_Gestalt* psg);
~ACE_Service_Config_Guard (void);
+
private:
// Private AND not implemented to disable copying
ACE_Service_Config_Guard(const ACE_Service_Config_Guard&);
ACE_Service_Config_Guard& operator= (const ACE_Service_Config_Guard&);
+
private:
ACE_Intrusive_Auto_Ptr<ACE_Service_Gestalt> saved_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Service_Config.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_SERVICE_CONFIG_H */
diff --git a/dep/ACE_wrappers/ace/Service_Config.inl b/dep/ACE_wrappers/ace/Service_Config.inl
index f06e8e51a1d..a03e7124eb1 100644
--- a/dep/ACE_wrappers/ace/Service_Config.inl
+++ b/dep/ACE_wrappers/ace/Service_Config.inl
@@ -1,8 +1,11 @@
// -*- C++ -*-
//
// $Id: Service_Config.inl 81673 2008-05-09 19:09:43Z iliyan $
+
#include "ace/OS_NS_string.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// This is the primary entry point into the ACE_Service_Config (the
// constructor just handles simple initializations).
ACE_INLINE int
@@ -19,6 +22,7 @@ ACE_Service_Config::open (const ACE_TCHAR program_name[],
ignore_default_svc_conf,
ignore_debug_flag) == -1)
return -1;
+
return current()->open (program_name,
logger_key,
ignore_static_svcs,
@@ -26,6 +30,7 @@ ACE_Service_Config::open (const ACE_TCHAR program_name[],
ignore_debug_flag);
}
+
ACE_INLINE int
ACE_Service_Config::open (int argc,
ACE_TCHAR *argv[],
@@ -41,6 +46,7 @@ ACE_Service_Config::open (int argc,
ignore_default_svc_conf,
ignore_debug_flag) == -1)
return -1;
+
return current()->open (argc,
argv,
logger_key,
@@ -48,6 +54,7 @@ ACE_Service_Config::open (int argc,
ignore_default_svc_conf,
ignore_debug_flag);
}
+
// Handle the command-line options intended for the
// ACE_Service_Config.
ACE_INLINE int
@@ -55,6 +62,7 @@ ACE_Service_Config::parse_args (int argc, ACE_TCHAR *argv[])
{
return ACE_Service_Config::current ()->parse_args (argc, argv);
}
+
/// Return the global configuration instance. Allways returns the same
/// instance
ACE_INLINE ACE_Service_Gestalt *
@@ -62,6 +70,7 @@ ACE_Service_Config::global (void)
{
return ACE_Service_Config::singleton()->instance_.get ();
}
+
/// Return the configuration instance, considered "global" in the
/// current thread. This may be the same as instance(), but on some
/// occasions, it may be a different one. For example,
@@ -72,6 +81,7 @@ ACE_Service_Config::instance (void)
{
return ACE_Service_Config::current ();
}
+
// This method has changed to return the gestalt instead of the
// container, underlying the service repository and defined
// ACE_Service_Gestalt::insert (ACE_Static_Svc_Descriptor*). This way
@@ -79,28 +89,33 @@ ACE_Service_Config::instance (void)
// ACE_Service_Config::static_svcs(), however now it is not necessary
// to expose the repository storage *and* it is much easier to debug
// service registration problems.
+
ACE_INLINE ACE_Service_Gestalt*
ACE_Service_Config::static_svcs (void)
{
return ACE_Service_Config::current ();
}
+
/// Compare two service descriptors for equality.
ACE_INLINE bool
ACE_Static_Svc_Descriptor::operator== (ACE_Static_Svc_Descriptor &d) const
{
return ACE_OS::strcmp (name_, d.name_) == 0;
}
+
/// Compare two service descriptors for inequality.
ACE_INLINE bool
ACE_Static_Svc_Descriptor::operator!= (ACE_Static_Svc_Descriptor &d) const
{
return !(*this == d);
}
+
ACE_INLINE void
ACE_Service_Config::signal_handler (ACE_Sig_Adapter *signal_handler)
{
signal_handler_ = signal_handler;
}
+
/// Initialize and activate a statically linked service.
ACE_INLINE int
ACE_Service_Config::initialize (const ACE_TCHAR *svc_name,
@@ -110,6 +125,7 @@ ACE_Service_Config::initialize (const ACE_TCHAR *svc_name,
return ACE_Service_Config::current ()->initialize (svc_name,
parameters);
}
+
/// Dynamically link the shared object file and retrieve a pointer to
/// the designated shared object in this file.
ACE_INLINE int
@@ -119,18 +135,21 @@ ACE_Service_Config::initialize (const ACE_Service_Type *sr,
ACE_TRACE ("ACE_Service_Config::initialize");
return ACE_Service_Config::current ()->initialize (sr, parameters);
}
+
/// Process a file containing a list of service configuration
/// directives.
ACE_INLINE int ACE_Service_Config::process_file (const ACE_TCHAR file[])
{
return ACE_Service_Config::current ()->process_file (file);
}
+
///
ACE_INLINE int
ACE_Service_Config::process_directive (const ACE_TCHAR directive[])
{
return ACE_Service_Config::current ()->process_directive (directive);
}
+
/// Process service configuration requests as indicated in the queue of
/// svc.conf files.
ACE_INLINE int
@@ -138,6 +157,7 @@ ACE_Service_Config::process_directives (void)
{
return ACE_Service_Config::current ()->process_directives (false);
}
+
ACE_INLINE int
ACE_Service_Config::process_directive (const ACE_Static_Svc_Descriptor &ssd,
bool force_replace)
@@ -145,33 +165,40 @@ ACE_Service_Config::process_directive (const ACE_Static_Svc_Descriptor &ssd,
return ACE_Service_Config::current ()->process_directive (ssd, force_replace);
}
+
#if defined (ACE_HAS_WINCE) && defined (ACE_USES_WCHAR)
// We must provide these function to bridge Svc_Conf parser with ACE.
+
ACE_INLINE int
ACE_Service_Config::initialize (const ACE_Service_Type *sp, ACE_ANTI_TCHAR parameters[])
{
return ACE_Service_Config::initialize (sp, ACE_TEXT_ANTI_TO_TCHAR (parameters));
}
+
ACE_INLINE int
ACE_Service_Config::initialize (const ACE_ANTI_TCHAR svc_name[], ACE_ANTI_TCHAR parameters[])
{
return ACE_Service_Config::initialize (ACE_TEXT_ANTI_TO_TCHAR (svc_name),
ACE_TEXT_ANTI_TO_TCHAR (parameters));
}
+
ACE_INLINE int
ACE_Service_Config::resume (const ACE_ANTI_TCHAR svc_name[])
{
return ACE_Service_Config::resume (ACE_TEXT_ANTI_TO_TCHAR (svc_name));
}
+
ACE_INLINE int
ACE_Service_Config::suspend (const ACE_ANTI_TCHAR svc_name[])
{
return ACE_Service_Config::suspend (ACE_TEXT_ANTI_TO_TCHAR (svc_name));
}
+
ACE_INLINE int
ACE_Service_Config::remove (const ACE_ANTI_TCHAR svc_name[])
{
return ACE_Service_Config::remove (ACE_TEXT_ANTI_TO_TCHAR (svc_name));
}
#endif /* ACE_HAS_WINCE && !ACE_USES_WCHAR */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Service_Gestalt.cpp b/dep/ACE_wrappers/ace/Service_Gestalt.cpp
index 6a1b47863cb..cf177525ab4 100644
--- a/dep/ACE_wrappers/ace/Service_Gestalt.cpp
+++ b/dep/ACE_wrappers/ace/Service_Gestalt.cpp
@@ -1,4 +1,5 @@
// $Id: Service_Gestalt.cpp 81673 2008-05-09 19:09:43Z iliyan $
+
#include "ace/Svc_Conf.h"
#include "ace/Get_Opt.h"
#include "ace/ARGV.h"
@@ -12,21 +13,28 @@
#include "ace/DLL.h"
#include "ace/XML_Svc_Conf.h"
#include "ace/SString.h"
+
#ifndef ACE_LACKS_UNIX_SIGNALS
# include "ace/Signal.h"
#endif /* !ACE_LACKS_UNIX_SIGNALS */
+
#include "ace/OS_NS_stdio.h"
#include "ace/OS_NS_string.h"
#include "ace/OS_NS_time.h"
#include "ace/OS_NS_unistd.h"
#include "ace/OS_NS_sys_stat.h"
+
#include "ace/TSS_T.h"
#include "ace/Service_Gestalt.h"
+
#include "ace/Svc_Conf_Param.h"
+
ACE_RCSID (ace,
Service_Gestalt,
"$Id: Service_Gestalt.cpp 81673 2008-05-09 19:09:43Z iliyan $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_Service_Type_Dynamic_Guard::ACE_Service_Type_Dynamic_Guard
(ACE_Service_Repository &r, const ACE_TCHAR *name)
: repo_ (r)
@@ -60,18 +68,23 @@ ACE_Service_Type_Dynamic_Guard::ACE_Service_Type_Dynamic_Guard
&this->repo_,
this->name_,
this->repo_begin_));
+
ACE_ASSERT (this->name_ != 0); // No name?
}
+
/// Destructor
+
ACE_Service_Type_Dynamic_Guard::~ACE_Service_Type_Dynamic_Guard (void)
{
const ACE_Service_Type *tmp = 0;
+
// Lookup without ignoring suspended services. Making sure
// not to ignore any inactive services, since those may be forward
// declarations
size_t slot = 0;
int const ret = this->repo_.find_i (this->name_, slot, &tmp, false);
+
// We inserted it (as inactive), so we expect to find it, right?
if ((ret < 0 && ret != -2) || tmp == 0)
{
@@ -81,10 +94,12 @@ ACE_Service_Type_Dynamic_Guard::~ACE_Service_Type_Dynamic_Guard (void)
ret, this->name_, tmp));
return;
}
+
if (tmp->type () != 0)
{
// Something has registered a proper (non-forward-decl) service with
// the same name as our dummy.
+
if (ACE::debug ())
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("ACE (%P|%t) STDG::<dtor>, repo=%@ [%d], ")
@@ -94,11 +109,13 @@ ACE_Service_Type_Dynamic_Guard::~ACE_Service_Type_Dynamic_Guard (void)
this->name_,
this->repo_begin_,
this->repo_.current_size ()));
+
// Relocate any services inserted since we were created.
// Any (static, i.e. DLL = 0) services registered in
// the context of this guard aren't really static because
// their code belongs in the DLL's code segment
this->repo_.relocate_i (this->repo_begin_, this->repo_.current_size (), tmp->dll());
+
if (ACE::debug ())
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("ACE (%P|%t) STDG::<dtor>, repo=%@ [%d], ")
@@ -113,7 +130,10 @@ ACE_Service_Type_Dynamic_Guard::~ACE_Service_Type_Dynamic_Guard (void)
}
}
+
+
// ----------------------------------------
+
ACE_Service_Gestalt::Processed_Static_Svc::
Processed_Static_Svc (const ACE_Static_Svc_Descriptor *assd)
:name_(0),
@@ -122,10 +142,12 @@ Processed_Static_Svc (const ACE_Static_Svc_Descriptor *assd)
ACE_NEW_NORETURN (name_, ACE_TCHAR[ACE_OS::strlen(assd->name_)+1]);
ACE_OS::strcpy(name_,assd->name_);
}
+
ACE_Service_Gestalt::Processed_Static_Svc::~Processed_Static_Svc (void)
{
delete [] name_;
}
+
void
ACE_Service_Gestalt::intrusive_add_ref (ACE_Service_Gestalt* g)
{
@@ -135,6 +157,7 @@ ACE_Service_Gestalt::intrusive_add_ref (ACE_Service_Gestalt* g)
ACE_ASSERT (g->refcnt_ > 0);
}
}
+
void
ACE_Service_Gestalt::intrusive_remove_ref (ACE_Service_Gestalt* g)
{
@@ -146,13 +169,18 @@ ACE_Service_Gestalt::intrusive_remove_ref (ACE_Service_Gestalt* g)
}
}
+
ACE_Service_Gestalt::~ACE_Service_Gestalt (void)
{
+
if (this->svc_repo_is_owned_)
delete this->repo_;
+
this->repo_ =0;
+
delete this->static_svcs_;
this->static_svcs_ = 0;
+
// Delete the dynamically allocated static_svcs instance.
#ifndef ACE_NLOGGING
if (ACE::debug ())
@@ -160,6 +188,7 @@ ACE_Service_Gestalt::~ACE_Service_Gestalt (void)
ACE_TEXT ("ACE (%P|%t) SG::~SG - this=%@, pss = %@\n"),
this, this->processed_static_svcs_));
#endif
+
if (this->processed_static_svcs_ &&
!this->processed_static_svcs_->is_empty())
{
@@ -171,11 +200,14 @@ ACE_Service_Gestalt::~ACE_Service_Gestalt (void)
delete *pss;
}
}
+
delete this->processed_static_svcs_;
this->processed_static_svcs_ = 0;
+
delete this->svc_conf_file_queue_;
this->svc_conf_file_queue_ = 0;
}
+
ACE_Service_Gestalt::ACE_Service_Gestalt (size_t size,
bool svc_repo_is_owned,
bool no_static_svcs)
@@ -192,6 +224,7 @@ ACE_Service_Gestalt::ACE_Service_Gestalt (size_t size,
, refcnt_ (0)
{
(void)this->init_i ();
+
#ifndef ACE_NLOGGING
if (ACE::debug ())
ACE_DEBUG ((LM_DEBUG,
@@ -199,6 +232,7 @@ ACE_Service_Gestalt::ACE_Service_Gestalt (size_t size,
this, this->processed_static_svcs_));
#endif
}
+
/// Performs the common initialization tasks for a new or previously
/// closed instance. Must not be virtual, as it is also called from
/// the constructor.
@@ -222,8 +256,10 @@ ACE_Service_Gestalt::init_i (void)
ACE_Service_Repository::instance (this->svc_repo_size_);
}
}
+
if (init_svc_conf_file_queue () == -1)
return -1;
+
if ( svc_conf_file_queue_->is_empty ())
{
// Check if the default file exists before attempting to queue it
@@ -233,6 +269,7 @@ ACE_Service_Gestalt::init_i (void)
bool skip_static_svcs = (fp == 0);
if (fp != 0)
ACE_OS::fclose (fp);
+
if (!skip_static_svcs) {
// Load the default "svc.conf" entry here if there weren't
// overriding -f arguments in <parse_args>.
@@ -248,37 +285,49 @@ ACE_Service_Gestalt::init_i (void)
}
}
}
+
return 0;
}
+
// Add the default statically-linked services to the Service
// Repository.
+
int
ACE_Service_Gestalt::load_static_svcs (void)
{
ACE_TRACE ("ACE_Service_Gestalt::load_static_svcs");
+
if (this->static_svcs_ == 0)
return 0; // Nothing to do
+
ACE_Static_Svc_Descriptor **ssdp = 0;
for (ACE_STATIC_SVCS_ITERATOR iter (*this->static_svcs_);
iter.next (ssdp) != 0;
iter.advance ())
{
ACE_Static_Svc_Descriptor *ssd = *ssdp;
+
if (this->process_directive (*ssd, 1) == -1)
return -1;
}
return 0;
+
} /* load_static_svcs () */
+
+
/// Find a static service descriptor by name
+
int
ACE_Service_Gestalt::find_static_svc_descriptor (const ACE_TCHAR* name,
ACE_Static_Svc_Descriptor **ssd) const
{
ACE_TRACE ("ACE_Service_Gestalt::find_static_svc_descriptor");
+
if (this->static_svcs_ == 0)
return -1;
+
ACE_Static_Svc_Descriptor **ssdp = 0;
for (ACE_STATIC_SVCS_ITERATOR iter ( *this->static_svcs_);
iter.next (ssdp) != 0;
@@ -288,17 +337,22 @@ ACE_Service_Gestalt::find_static_svc_descriptor (const ACE_TCHAR* name,
{
if (ssd != 0)
*ssd = *ssdp;
+
return 0;
}
}
+
return -1;
}
+
/// @brief
+
const ACE_Static_Svc_Descriptor*
ACE_Service_Gestalt::find_processed_static_svc (const ACE_TCHAR* name)
{
if (this->processed_static_svcs_ == 0 || name == 0)
return 0;
+
Processed_Static_Svc **pss = 0;
for (ACE_PROCESSED_STATIC_SVCS_ITERATOR iter (*this->processed_static_svcs_);
iter.next (pss) != 0;
@@ -310,16 +364,20 @@ ACE_Service_Gestalt::find_processed_static_svc (const ACE_TCHAR* name)
return 0;
}
+
+
/// @brief Captures a list of the direcives processed (explicitely) for this
/// Gestalt so that services can be replicated in other repositories
/// upon their first initialization.
///
/// This is part of the mechanism ensuring distinct local instances
/// for static service objects, loaded in another repository.
+
void
ACE_Service_Gestalt::add_processed_static_svc
(const ACE_Static_Svc_Descriptor *assd)
{
+
/// When process_directive(Static_Svc_Descriptor&) is called, it
/// associates a service object with the Gestalt and makes the
/// resource (a Service Object) local to the repository. This is but
@@ -334,9 +392,11 @@ ACE_Service_Gestalt::add_processed_static_svc
/// that durig the "static" initialization there's no specific
/// information about the hosting repository and the gestalt must
/// employ some lookup strategy to find it elsewhere.
+
if (this->processed_static_svcs_ == 0)
ACE_NEW (this->processed_static_svcs_,
ACE_PROCESSED_STATIC_SVCS);
+
Processed_Static_Svc **pss = 0;
for (ACE_PROCESSED_STATIC_SVCS_ITERATOR iter (*this->processed_static_svcs_);
iter.next (pss) != 0;
@@ -351,6 +411,7 @@ ACE_Service_Gestalt::add_processed_static_svc
Processed_Static_Svc *tmp = 0;
ACE_NEW (tmp,Processed_Static_Svc(assd));
this->processed_static_svcs_->insert(tmp);
+
if (ACE::debug ())
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("ACE (%P|%t) SG::add_processed_static_svc, ")
@@ -359,10 +420,12 @@ ACE_Service_Gestalt::add_processed_static_svc
assd->name_));
}
+
/// Queues a static service object descriptor which, during open()
/// will be given to process_directive() to create the Service
/// Object. Normally, only called from static initializers, prior to
/// calling open() but loading a service from a DLL can cause it too.
+
int
ACE_Service_Gestalt::insert (ACE_Static_Svc_Descriptor *stsd)
{
@@ -370,11 +433,14 @@ ACE_Service_Gestalt::insert (ACE_Static_Svc_Descriptor *stsd)
ACE_NEW_RETURN (this->static_svcs_,
ACE_STATIC_SVCS,
-1);
+
return this->static_svcs_->insert (stsd);
}
+
ACE_ALLOC_HOOK_DEFINE (ACE_Service_Gestalt)
+
void
ACE_Service_Gestalt::dump (void) const
{
@@ -383,13 +449,17 @@ ACE_Service_Gestalt::dump (void) const
#endif /* ACE_HAS_DUMP */
}
+
+
///
+
int
ACE_Service_Gestalt::initialize (const ACE_TCHAR *svc_name,
const ACE_TCHAR *parameters)
{
ACE_TRACE ("ACE_Service_Gestalt_Base::initialize (repo)");
ACE_ARGV args (parameters);
+
#ifndef ACE_NLOGGING
if (ACE::debug ())
{
@@ -401,6 +471,7 @@ ACE_Service_Gestalt::initialize (const ACE_TCHAR *svc_name,
svc_name));
}
#endif
+
const ACE_Service_Type *srp = 0;
for (int i = 0; this->find (svc_name, &srp) == -1 && i < 2; i++)
// if (this->repo_->find (svc_name, &srp) == -1)
@@ -426,6 +497,7 @@ ACE_Service_Gestalt::initialize (const ACE_TCHAR *svc_name,
ACE_TEXT (" was not located.\n"),
svc_name),
-1);
+
/// If initialization fails ...
if (srp->type ()->init (args.argc (),
args.argv ()) == -1)
@@ -438,17 +510,20 @@ ACE_Service_Gestalt::initialize (const ACE_TCHAR *svc_name,
this->repo_->remove (svc_name);
return -1;
}
+
// If everything is ok, activate it
const_cast<ACE_Service_Type *>(srp)->active (1);
return 0;
}
+
#if (ACE_USES_CLASSIC_SVC_CONF == 1)
int
ACE_Service_Gestalt::initialize (const ACE_Service_Type_Factory *stf,
const ACE_TCHAR *parameters)
{
ACE_TRACE ("ACE_Service_Gestalt::initialize");
+
#ifndef ACE_NLOGGING
if (ACE::debug ())
ACE_DEBUG ((LM_DEBUG,
@@ -457,9 +532,11 @@ ACE_Service_Gestalt::initialize (const ACE_Service_Type_Factory *stf,
this->repo_,
stf->name ()));
#endif
+
ACE_Service_Type *srp = 0;
int const retv = this->repo_->find (stf->name (),
(const ACE_Service_Type **) &srp);
+
// If there is an active service already, remove it first
// before it can be re-installed.
if (retv >= 0)
@@ -474,6 +551,7 @@ ACE_Service_Gestalt::initialize (const ACE_Service_Type_Factory *stf,
#endif
this->repo_->remove (stf->name ());
}
+
// If there is an inactive service by that name it may have been
// either inactivated, or just a forward declaration for a service,
// that is in the process of being initialized. If it is the latter,
@@ -493,6 +571,7 @@ ACE_Service_Gestalt::initialize (const ACE_Service_Type_Factory *stf,
this->repo_,
stf->name ()),
-1);
+
// Reserve a spot for the dynamic service by inserting an incomplete
// service declaration, i.e. one that can not produce a service
// object if asked (a forward declaration). This declaration
@@ -503,9 +582,11 @@ ACE_Service_Gestalt::initialize (const ACE_Service_Type_Factory *stf,
// finalizing the dynamic service.
ACE_Service_Type_Dynamic_Guard dummy (*this->repo_,
stf->name ());
+
// make_service_type() is doing the dynamic loading and also runs
// any static initializers
ACE_Auto_Ptr<ACE_Service_Type> tmp (stf->make_service_type (this));
+
if (tmp.get () != 0 &&
this->initialize_i (tmp.get (), parameters) == 0)
{
@@ -515,10 +596,12 @@ ACE_Service_Gestalt::initialize (const ACE_Service_Type_Factory *stf,
tmp.release ();
return 0;
}
+
return -1;
}
#endif /* (ACE_USES_CLASSIC_SVC_CONF == 1) */
+
// Dynamically link the shared object file and retrieve a pointer to
// the designated shared object in this file.
// @note This is obsolete (and error-prone) in the presense of dynamic
@@ -529,17 +612,20 @@ ACE_Service_Gestalt::initialize (const ACE_Service_Type_Factory *stf,
// the memory in which the static services reside.
// It may not crash, for instance, when the first static service to register
// is the same as the dynamic service being loaded. You should be so lucky! ..
+
int
ACE_Service_Gestalt::initialize (const ACE_Service_Type *sr,
const ACE_TCHAR *parameters)
{
ACE_TRACE ("ACE_Service_Gestalt::initialize");
+
if (ACE::debug ())
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("ACE (%P|%t) SG::initialize - repo=%@, name=%s")
ACE_TEXT (" - looking up in the repo\n"),
this->repo_,
sr->name ()));
+
ACE_Service_Type *srp = 0;
if (this->repo_->find (sr->name (),
(const ACE_Service_Type **) &srp) >= 0)
@@ -553,8 +639,11 @@ ACE_Service_Gestalt::initialize (const ACE_Service_Type *sr,
#endif
this->repo_->remove (sr->name ());
}
+
return this->initialize_i (sr, parameters);
+
}
+
// Dynamically link the shared object file and retrieve a pointer to
// the designated shared object in this file.
int
@@ -569,6 +658,7 @@ ACE_Service_Gestalt::initialize_i (const ACE_Service_Type *sr,
// We just get ps to avoid having remove() delete it.
ACE_Service_Type *ps = 0;
this->repo_->remove (sr->name (), &ps);
+
#ifndef ACE_NLOGGING
// Not using LM_ERROR here to avoid confusing the test harness
if (ACE::debug ())
@@ -581,6 +671,7 @@ ACE_Service_Gestalt::initialize_i (const ACE_Service_Type *sr,
#endif
return -1;
}
+
if (this->repo_->insert (sr) == -1)
{
#ifndef ACE_NLOGGING
@@ -595,42 +686,53 @@ ACE_Service_Gestalt::initialize_i (const ACE_Service_Type *sr,
#endif
return -1;
}
+
return 0;
}
+
// Totally remove <svc_name> from the daemon by removing it from the
// ACE_Reactor, and unlinking it if necessary.
+
int
ACE_Service_Gestalt::remove (const ACE_TCHAR svc_name[])
{
ACE_TRACE ("ACE_Service_Gestalt::remove");
if (this->repo_ == 0)
return -1;
+
return this->repo_->remove (svc_name);
}
+
// Suspend <svc_name>. Note that this will not unlink the service
// from the daemon if it was dynamically linked, it will mark it as
// being suspended in the Service Repository and call the <suspend>
// member function on the appropriate <ACE_Service_Object>. A service
// can be resumed later on by calling the <resume> method...
+
int
ACE_Service_Gestalt::suspend (const ACE_TCHAR svc_name[])
{
ACE_TRACE ("ACE_Service_Gestalt::suspend");
if (this->repo_ == 0)
return -1;
+
return this->repo_->suspend (svc_name);
}
+
// Resume a SVC_NAME that was previously suspended or has not yet
// been resumed (e.g., a static service).
+
int
ACE_Service_Gestalt::resume (const ACE_TCHAR svc_name[])
{
ACE_TRACE ("ACE_Service_Gestalt::resume");
if (this->repo_ == 0)
return -1;
+
return this->repo_->resume (svc_name);
}
+
int
ACE_Service_Gestalt::process_directive (const ACE_Static_Svc_Descriptor &ssd,
bool force_replace)
@@ -642,12 +744,14 @@ ACE_Service_Gestalt::process_directive (const ACE_Static_Svc_Descriptor &ssd,
}
return result;
}
+
int
ACE_Service_Gestalt::process_directive_i (const ACE_Static_Svc_Descriptor &ssd,
bool force_replace)
{
if (this->repo_ == 0)
return -1;
+
if (!force_replace)
{
if (this->repo_->find (ssd.name_, 0, 0) >= 0)
@@ -657,8 +761,10 @@ ACE_Service_Gestalt::process_directive_i (const ACE_Static_Svc_Descriptor &ssd,
}
}
+
ACE_Service_Object_Exterminator gobbler;
void *sym = (ssd.alloc_)(&gobbler);
+
ACE_Service_Type_Impl *stp =
ACE_Service_Config::create_service_type_impl (ssd.name_,
ssd.type_,
@@ -667,18 +773,22 @@ ACE_Service_Gestalt::process_directive_i (const ACE_Static_Svc_Descriptor &ssd,
gobbler);
if (stp == 0)
return 0;
+
ACE_Service_Type *service_type = 0;
+
// This is just a temporary to force the compiler to use the right
// constructor in ACE_Service_Type. Note that, in cases where we are
// called from a static initializer which is part of a DLL, there is
// not enough information about the actuall DLL in this context.
ACE_DLL tmp_dll;
+
ACE_NEW_RETURN (service_type,
ACE_Service_Type (ssd.name_,
stp,
tmp_dll,
ssd.active_),
-1);
+
#ifndef ACE_NLOGGING
if (ACE::debug ())
ACE_DEBUG ((LM_DEBUG,
@@ -689,9 +799,12 @@ ACE_Service_Gestalt::process_directive_i (const ACE_Static_Svc_Descriptor &ssd,
(tmp_dll.dll_name_ == 0) ? ACE_TEXT ("<null>") : tmp_dll.dll_name_,
force_replace));
#endif
+
return this->repo_->insert (service_type);
}
+
#if (ACE_USES_CLASSIC_SVC_CONF == 1)
+
int
ACE_Service_Gestalt::process_directives_i (ACE_Svc_Conf_Param *param)
{
@@ -705,11 +818,14 @@ ACE_Service_Gestalt::process_directives_i (ACE_Svc_Conf_Param *param)
? ACE_TEXT ("<from file>")
: param->source.directive));
#endif
+
// AC 970827 Skip the heap check because yacc allocates a buffer
// here which will be reported as a memory leak for some reason.
ACE_NO_HEAP_CHECK
+
// Were we called in the context of the current instance?
ACE_ASSERT (this == param->config);
+
// Temporarily (for the duration of this call) make sure that *any*
// static service registrations will happen with this instance. Such
// registrations are possible as a side-effect of dynamically
@@ -718,7 +834,9 @@ ACE_Service_Gestalt::process_directives_i (ACE_Svc_Conf_Param *param)
// which implies that their finalization will be performed in the
// correct order, i.e. prior to finalizing the DLL
ACE_Service_Config_Guard guard (this);
+
::ace_yyparse (param);
+
// This is a hack, better errors should be provided...
if (param->yyerrno > 0)
{
@@ -731,7 +849,9 @@ ACE_Service_Gestalt::process_directives_i (ACE_Svc_Conf_Param *param)
else
return 0;
}
+
#else
+
ACE_XML_Svc_Conf *
ACE_Service_Gestalt::get_xml_svc_conf (ACE_DLL &xmldll)
{
@@ -740,8 +860,10 @@ ACE_Service_Gestalt::get_xml_svc_conf (ACE_DLL &xmldll)
ACE_TEXT ("ACE (%P|%t) Failure to open ACEXML_XML_Svc_Conf_Parser: %p\n"),
"ACE_Service_Config::get_xml_svc_conf"),
0);
+
void * foo =
xmldll.symbol (ACE_TEXT ("_ACEXML_create_XML_Svc_Conf_Object"));
+
ACE_XML_Svc_Conf::Factory factory =
reinterpret_cast<ACE_XML_Svc_Conf::Factory> (foo);
if (factory == 0)
@@ -749,13 +871,16 @@ ACE_Service_Gestalt::get_xml_svc_conf (ACE_DLL &xmldll)
ACE_TEXT ("ACE (%P|%t) Unable to resolve factory: %p\n"),
xmldll.error ()),
0);
+
return factory ();
}
#endif /* ACE_USES_CLASSIC_SVC_CONF == 1 */
+
int
ACE_Service_Gestalt::process_file (const ACE_TCHAR file[])
{
ACE_TRACE ("ACE_Service_Gestalt::process_file");
+
// To avoid recursive processing of the same file and the same repository
// we maintain an implicit stack of dummy "services" named after the file
// being processed. Anytime we have to open a new file, we then can check
@@ -769,17 +894,21 @@ ACE_Service_Gestalt::process_file (const ACE_TCHAR file[])
file));
return 0;
}
+
// Register a dummy service as a forward decl, using the file name as name.
// The entry will be automaticaly removed once the thread exits this block.
ACE_Service_Type_Dynamic_Guard recursion_guard (*this->repo_,
file);
+
/*
* @TODO: Test with ACE_USES_CLASSIC_SVC_CONF turned off!
*/
#if (ACE_USES_CLASSIC_SVC_CONF == 1)
int result = 0;
+
FILE *fp = ACE_OS::fopen (file,
ACE_TEXT ("r"));
+
if (fp == 0)
{
// Invalid svc.conf file. We'll report it here and break out of
@@ -788,6 +917,7 @@ ACE_Service_Gestalt::process_file (const ACE_TCHAR file[])
ACE_DEBUG ((LM_ERROR,
ACE_TEXT ("ACE (%P|%t): %p\n"),
file));
+
// Use stat to find out if the file exists. I didn't use access()
// because stat is better supported on most non-unix platforms.
ACE_stat exists;
@@ -802,24 +932,31 @@ ACE_Service_Gestalt::process_file (const ACE_TCHAR file[])
else
{
ACE_Svc_Conf_Param f (this, fp);
+
// Keep track of the number of errors.
result = this->process_directives_i (&f);
+
(void) ACE_OS::fclose (fp);
}
return result;
#else
ACE_DLL dll;
+
auto_ptr<ACE_XML_Svc_Conf>
xml_svc_conf (this->get_xml_svc_conf (dll));
+
if (xml_svc_conf.get () == 0)
return -1;
+
return xml_svc_conf->parse_file (file);
#endif /* ACE_USES_CLASSIC_SVC_CONF == 1 */
}
+
int
ACE_Service_Gestalt::process_directive (const ACE_TCHAR directive[])
{
ACE_TRACE ("ACE_Service_Gestalt::process_directive");
+
#ifndef ACE_NLOGGING
if (ACE::debug ())
ACE_DEBUG ((LM_DEBUG,
@@ -827,16 +964,22 @@ ACE_Service_Gestalt::process_directive (const ACE_TCHAR directive[])
this->repo_,
directive));
#endif
+
#if (ACE_USES_CLASSIC_SVC_CONF == 1)
ACE_UNUSED_ARG (directive);
+
ACE_Svc_Conf_Param d (this, directive);
+
return this->process_directives_i (&d);
#else
ACE_DLL dll;
+
auto_ptr<ACE_XML_Svc_Conf>
xml_svc_conf (this->get_xml_svc_conf (dll));
+
if (xml_svc_conf.get () == 0)
return -1;
+
// Temporarily (for the duration of this call) make sure that *any* static
// service registrations will happen with this instance. Such registrations
// are possible as a side-effect of dynamically loading a DLL, which has
@@ -844,10 +987,13 @@ ACE_Service_Gestalt::process_directive (const ACE_TCHAR directive[])
// DLL and those static services, which implies that their finalization
// will be performed in the correct order, i.e. prior to finalizing the DLL
ACE_Service_Config_Guard guard (this);
+
return xml_svc_conf->parse_string (directive);
#endif /* ACE_USES_CLASSIC_SVC_CONF == 1 */
+
} /* process_directive () */
+
int
ACE_Service_Gestalt::init_svc_conf_file_queue (void)
{
@@ -859,6 +1005,7 @@ ACE_Service_Gestalt::init_svc_conf_file_queue (void)
-1);
this->svc_conf_file_queue_ = tmp;
}
+
#ifndef ACE_NLOGGING
if (ACE::debug ())
ACE_DEBUG ((LM_DEBUG,
@@ -866,9 +1013,12 @@ ACE_Service_Gestalt::init_svc_conf_file_queue (void)
ACE_TEXT ("- this=%@, repo=%@\n"),
this, this->repo_));
#endif
+
return 0;
+
} /* init_svc_conf_file_queue () */
+
int
ACE_Service_Gestalt::open_i (const ACE_TCHAR /*program_name*/[],
const ACE_TCHAR* /*logger_key*/,
@@ -879,12 +1029,16 @@ ACE_Service_Gestalt::open_i (const ACE_TCHAR /*program_name*/[],
ACE_TRACE ("ACE_Service_Gestalt::open_i");
int result = 0;
ACE_Log_Msg *log_msg = ACE_LOG_MSG;
+
no_static_svcs_ = ignore_static_svcs;
+
// Record the current log setting upon entering this thread.
u_long old_process_mask = log_msg->priority_mask
(ACE_Log_Msg::PROCESS);
+
u_long old_thread_mask = log_msg->priority_mask
(ACE_Log_Msg::THREAD);
+
#ifndef ACE_NLOGGING
if (ACE::debug ())
ACE_DEBUG ((LM_DEBUG,
@@ -892,13 +1046,16 @@ ACE_Service_Gestalt::open_i (const ACE_TCHAR /*program_name*/[],
ACE_TEXT ("opened=%d, loadstatics=%d\n"),
this, this->is_opened_, this->no_static_svcs_));
#endif
+
// Guard against reentrant processing. For example,
// if the singleton gestalt (ubergestalt) was already open,
// do not open it again...
if (this->is_opened_++ != 0)
return 0;
+
if (this->init_i () != 0)
return -1;
+
if (!ignore_debug_flag)
{
// If -d was included as a startup parameter, the user wants debug
@@ -909,6 +1066,7 @@ ACE_Service_Gestalt::open_i (const ACE_TCHAR /*program_name*/[],
// The user has requested no debugging info.
ACE_Log_Msg::disable_debug_messages ();
}
+
// See if we need to load the static services.
if (this->no_static_svcs_ == 0
&& this->load_static_svcs () == -1)
@@ -921,25 +1079,30 @@ ACE_Service_Gestalt::open_i (const ACE_TCHAR /*program_name*/[],
result = this->process_directives (ignore_default_svc_conf_file);
}
+
// Reset debugging back to the way it was when we came into
// into <open_i>.
{
// Make sure to save/restore errno properly.
ACE_Errno_Guard error (errno);
+
if (!ignore_debug_flag)
{
log_msg->priority_mask (old_process_mask, ACE_Log_Msg::PROCESS);
log_msg->priority_mask (old_thread_mask, ACE_Log_Msg::THREAD);
}
}
+
return result;
} /* open_i () */
+
int
ACE_Service_Gestalt::is_opened (void)
{
return this->is_opened_;
}
+
int
ACE_Service_Gestalt::process_commandline_directives (void)
{
@@ -960,12 +1123,16 @@ ACE_Service_Gestalt::process_commandline_directives (void)
result = -1;
}
}
+
delete this->svc_queue_;
this->svc_queue_ = 0;
}
+
return result;
+
} /* process_commandline_directives () */
+
int
ACE_Service_Gestalt::parse_args (int argc, ACE_TCHAR *argv[])
{
@@ -973,6 +1140,7 @@ ACE_Service_Gestalt::parse_args (int argc, ACE_TCHAR *argv[])
bool unused_ignore_default_svc_conf = true;
return parse_args_i (argc, argv, unused_ignore_default_svc_conf);
}
+
int
ACE_Service_Gestalt::parse_args_i (int argc,
ACE_TCHAR *argv[],
@@ -985,8 +1153,10 @@ ACE_Service_Gestalt::parse_args_i (int argc,
ACE_TEXT ("df:k:nyS:"),
1); // Start at argv[1].
//FUZZ: enable check_for_lack_ACE_OS
+
if (this->init_svc_conf_file_queue () == -1)
return -1;
+
//FUZZ: disable check_for_lack_ACE_OS
for (int c; (argc != 0) && ((c = getopt ()) != -1); )
//FUZZ: enable check_for_lack_ACE_OS
@@ -1023,6 +1193,7 @@ ACE_Service_Gestalt::parse_args_i (int argc,
ACE_SVC_QUEUE,
-1);
}
+
if (this->svc_queue_->enqueue_tail (ACE_TString (getopt.opt_arg ())) == -1)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("%p\n"),
@@ -1035,20 +1206,26 @@ ACE_Service_Gestalt::parse_args_i (int argc,
ACE_TEXT ("ACE (%P|%t) %c is not a ACE_Service_Config option\n"),
c));
}
+
return 0;
} /* parse_args_i () */
+
+
// Process service configuration directives from the files queued for
// processing
int
ACE_Service_Gestalt::process_directives (bool ignore_default_svc_conf_file)
{
ACE_TRACE ("ACE_Service_Gestalt::process_directives");
+
if (this->svc_conf_file_queue_ == 0
|| this->svc_conf_file_queue_->is_empty ())
return 0;
+
ACE_TString *sptr = 0;
ACE_TString default_svc_conf (ACE_DEFAULT_SVC_CONF);
+
// Iterate through all the svc.conf files.
for (ACE_SVC_QUEUE_ITERATOR iter (*this->svc_conf_file_queue_);
iter.next (sptr) != 0;
@@ -1056,22 +1233,29 @@ ACE_Service_Gestalt::process_directives (bool ignore_default_svc_conf_file)
{
if (*sptr == default_svc_conf && ignore_default_svc_conf_file)
continue;
+
int result = this->process_file (sptr->fast_rep ());
if (result < 0)
return result;
}
+
return 0;
+
} /* process_directives () */
+
// Tidy up and perform last rites on a terminating ACE_Service_Gestalt.
int
ACE_Service_Gestalt::close (void)
{
ACE_TRACE ("ACE_Service_Gestalt::close");
+
if (!this->is_opened_ || --this->is_opened_ != 0)
return 0;
+
// Delete the list fo svc.conf files
delete this->svc_conf_file_queue_;
this->svc_conf_file_queue_ = 0;
+
if (this->processed_static_svcs_ &&
!this->processed_static_svcs_->is_empty())
{
@@ -1085,22 +1269,29 @@ ACE_Service_Gestalt::close (void)
}
delete this->processed_static_svcs_;
this->processed_static_svcs_ = 0;
+
#ifndef ACE_NLOGGING
if (ACE::debug ())
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("ACE (%P|%t) SG::close - complete this=%@, repo=%@, owned=%d\n"),
this, this->repo_, this->svc_repo_is_owned_));
#endif
+
if (this->svc_repo_is_owned_)
delete this->repo_;
+
this->repo_ = 0;
+
return 0;
} /* close () */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if !defined (__ACE_INLINE__)
#include "ace/Service_Gestalt.inl"
#endif /* __ACE_INLINE__ */
+
// Allocate a Service Manager.
ACE_FACTORY_DEFINE (ACE, ACE_Service_Manager)
diff --git a/dep/ACE_wrappers/ace/Service_Gestalt.h b/dep/ACE_wrappers/ace/Service_Gestalt.h
index 520072840c6..2be4de5ba02 100644
--- a/dep/ACE_wrappers/ace/Service_Gestalt.h
+++ b/dep/ACE_wrappers/ace/Service_Gestalt.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//====================================================================
/**
* @file Service_Gestalt.h
@@ -8,14 +9,19 @@
* @author Iliyan Jeliazkov <iliyan@ociweb.com>
*/
//====================================================================
+
#ifndef ACE_SERVICE_GESTALT_H
#define ACE_SERVICE_GESTALT_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
#include "ace/Default_Constants.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Auto_Ptr.h"
#include "ace/SString.h"
#include "ace/Unbounded_Queue.h"
@@ -26,7 +32,9 @@
#include "ace/Synch_Traits.h"
#include "ace/Atomic_Op.h"
#include "ace/Guard_T.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
#if (ACE_USES_CLASSIC_SVC_CONF == 1)
class ACE_Service_Type_Factory;
class ACE_Location_Node;
@@ -34,8 +42,10 @@ class ACE_Location_Node;
class ACE_XML_Svc_Conf;
class ACE_DLL;
#endif /* ACE_USES_CLASSIC_SVC_CONF == 1 */
+
class ACE_Static_Svc_Descriptor;
class ACE_Svc_Conf_Param;
+
/**
* @class ACE_Service_Gestalt
*
@@ -65,22 +75,27 @@ private:
//
ACE_UNIMPLEMENTED_FUNC (ACE_Service_Gestalt(const ACE_Service_Gestalt&))
ACE_UNIMPLEMENTED_FUNC (ACE_Service_Gestalt& operator=(const ACE_Service_Gestalt&))
+
public:
enum
{
MAX_SERVICES = ACE_DEFAULT_SERVICE_REPOSITORY_SIZE
};
+
/// Constructor either associates the instance with the process-wide
/// singleton instance of ACE_Service_Repository, or creates and
/// manages its own instance of the specified size.
ACE_Service_Gestalt (size_t size = 1024,
bool svc_repo_is_owned = true,
bool no_static_svcs = true);
+
/// Perform user-specified close activities and remove dynamic
/// memory.
~ACE_Service_Gestalt (void);
+
/// Dump the state of an object.
void dump (void) const;
+
/**
* Performs an open without parsing command-line arguments. The
* @a logger_key indicates where to write the logging output, which
@@ -100,6 +115,7 @@ public:
bool ignore_static_svcs = true,
bool ignore_default_svc_conf_file = false,
bool ignore_debug_flag = false);
+
/**
* This is the primary entry point into the ACE_Service_Config (the
* constructor just handles simple initializations). It parses
@@ -156,14 +172,18 @@ public:
bool ignore_static_svcs = true,
bool ignore_default_svc_conf_file = false,
bool ignore_debug_flag = false);
+
/// Has it been opened? Returns the difference between the times
/// open and close have been called on this instance
int is_opened (void);
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
/// Process one service configuration @a directive, which is passed as
/// a string. Returns the number of errors that occurred.
int process_directive (const ACE_TCHAR directive[]);
+
/// Process one static service definition.
/**
* Load a new static service.
@@ -178,9 +198,11 @@ public:
*/
int process_directive (const ACE_Static_Svc_Descriptor &ssd,
bool force_replace = false);
+
/// Process a file containing a list of service configuration
/// directives.
int process_file (const ACE_TCHAR file[]);
+
/**
* Locate an entry with @a name in the table. If @a ignore_suspended
* is set then only consider services marked as resumed. If the
@@ -192,6 +214,7 @@ public:
int find (const ACE_TCHAR name[],
const ACE_Service_Type **srp = 0,
bool ignore_suspended = true) const;
+
/**
* Handle the command-line options intended for the
* ACE_Service_Gestalt. Note that <argv[0]> is assumed to be the
@@ -210,19 +233,24 @@ public:
* for a list of files and here a list of services.
*/
int parse_args (int, ACE_TCHAR *argv[]);
+
/**
* Process (or re-process) service configuration requests that are
* provided in the svc.conf file(s). Returns the number of errors
* that occurred.
*/
int process_directives (bool ignore_default_svc_conf_file);
+
/// Tidy up and perform last rites when ACE_Service_Config is shut
/// down. This method calls <close_svcs>. Returns 0.
int close (void);
+
// Registers a service descriptor for a static service object
int insert (ACE_Static_Svc_Descriptor *stsd);
+
// = Utility methods.
+
#if (ACE_USES_CLASSIC_SVC_CONF == 1)
/// Dynamically link the shared object file and retrieve a pointer to
/// the designated shared object in this file. Also account for the
@@ -233,6 +261,7 @@ public:
int initialize (const ACE_Service_Type_Factory *,
const ACE_TCHAR *parameters);
#endif /* (ACE_USES_CLASSIC_SVC_CONF == 1) */
+
/// Dynamically link the shared object file and retrieve a pointer to
/// the designated shared object in this file.
/// @deprecated
@@ -247,12 +276,15 @@ public:
/// as the dynamic service being loaded. You should be so lucky!
int initialize (const ACE_Service_Type *,
const ACE_TCHAR *parameters);
+
/// Initialize and activate a statically @a svc_name service.
int initialize (const ACE_TCHAR *svc_name,
const ACE_TCHAR *parameters);
+
/// Resume a @a svc_name that was previously suspended or has not yet
/// been resumed (e.g., a static service).
int resume (const ACE_TCHAR svc_name[]);
+
/**
* Suspend @a svc_name. Note that this will not unlink the service
* from the daemon if it was dynamically linked, it will mark it as
@@ -262,15 +294,18 @@ public:
* function...
*/
int suspend (const ACE_TCHAR svc_name[]);
+
/// Totally remove @a svc_name from the daemon by removing it
/// from the ACE_Reactor, and unlinking it if necessary.
int remove (const ACE_TCHAR svc_name[]);
+
/**
* Using the supplied name, finds and (if needed) returns a pointer to a
* static service descriptor. Returns 0 for success and -1 for failure
*/
int find_static_svc_descriptor (const ACE_TCHAR* name,
ACE_Static_Svc_Descriptor **ssd = 0) const;
+
struct Processed_Static_Svc
{
Processed_Static_Svc (const ACE_Static_Svc_Descriptor *);
@@ -278,11 +313,15 @@ public:
ACE_TCHAR * name_;
const ACE_Static_Svc_Descriptor *assd_;
};
+
/// Get the current ACE_Service_Repository held by this object.
ACE_Service_Repository* current_service_repository (void);
+
protected:
+
int parse_args_i (int, ACE_TCHAR *argv[],
bool& ignore_default_svc_conf_file);
+
/**
* Performs an open without parsing command-line arguments. The
* @a logger_key indicates where to write the logging output, which
@@ -298,19 +337,24 @@ protected:
bool ignore_static_svcs = true,
bool ignore_default_svc_conf_file = false,
bool ignore_debug_flag = false);
+
/// Initialize the <svc_conf_file_queue_> if necessary.
int init_svc_conf_file_queue (void);
+
/// Add the default statically-linked services to the
/// ACE_Service_Repository.
int load_static_svcs (void);
+
/// Process service configuration requests that were provided on the
/// command-line. Returns the number of errors that occurred.
int process_commandline_directives (void);
+
/// Process a static directive without also inserting its descriptor
/// the global table. This avoids multiple additions when processing
/// directives in non-global gestalts.
int process_directive_i (const ACE_Static_Svc_Descriptor &ssd,
bool force_replace = false);
+
#if (ACE_USES_CLASSIC_SVC_CONF == 1)
/// This is the implementation function that process_directives()
/// and process_directive() both call. Returns the number of errors
@@ -321,40 +365,54 @@ protected:
/// parser.
ACE_XML_Svc_Conf* get_xml_svc_conf (ACE_DLL &d);
#endif /* ACE_USES_CLASSIC_SVC_CONF == 1 */
+
/// Dynamically link the shared object file and retrieve a pointer to
/// the designated shared object in this file.
int initialize_i (const ACE_Service_Type *sr, const ACE_TCHAR *parameters);
+
const ACE_Static_Svc_Descriptor* find_processed_static_svc (const ACE_TCHAR*);
void add_processed_static_svc (const ACE_Static_Svc_Descriptor *);
+
/// Performs the common initialization tasks for a new or previously
/// closed instance. Must not be virtual, as it is called from the
/// constructor.
int init_i (void);
+
protected:
+
// Maintain a queue of services to be configured from the
// command-line.
typedef ACE_Unbounded_Queue<ACE_TString> ACE_SVC_QUEUE;
typedef ACE_Unbounded_Queue_Iterator<ACE_TString> ACE_SVC_QUEUE_ITERATOR;
+
// Maintain a set of the statically linked service descriptors.
typedef ACE_Unbounded_Set<ACE_Static_Svc_Descriptor *>
ACE_STATIC_SVCS;
+
typedef ACE_Unbounded_Set_Iterator<ACE_Static_Svc_Descriptor *>
ACE_STATIC_SVCS_ITERATOR;
+
typedef ACE_Unbounded_Set<Processed_Static_Svc *>
ACE_PROCESSED_STATIC_SVCS;
+
typedef ACE_Unbounded_Set_Iterator<Processed_Static_Svc *>
ACE_PROCESSED_STATIC_SVCS_ITERATOR;
+
friend class ACE_Dynamic_Service_Base;
friend class ACE_Service_Object;
friend class ACE_Service_Config;
friend class ACE_Service_Config_Guard;
+
protected:
+
/// Do we own the service repository instance, or have only been
/// given a ptr to the singleton?
bool svc_repo_is_owned_;
+
/// Repository size is necessary, so that we can close (which may
/// destroy the repository instance), and then re-open again.
size_t svc_repo_size_;
+
/// Keep track of the number of times the instance has been
/// initialized (opened). "If so, we can't allow <yyparse> to be called since
/// it's not reentrant" is the original motivation, but that does not seem
@@ -362,32 +420,43 @@ protected:
/// <ACE_Service_Gestalt::open> method and decremented by the
/// <ACE_Service_Gestalt::close> method.
int is_opened_;
+
/// Indicates where to write the logging output. This is typically
/// either a STREAM pipe or a socket
const ACE_TCHAR *logger_key_;
+
/// Should we avoid loading the static services?
bool no_static_svcs_;
+
/// Queue of services specified on the command-line.
ACE_SVC_QUEUE* svc_queue_;
+
/** Queue of svc.conf files specified on the command-line.
* @@ This should probably be made to handle unicode filenames...
*/
ACE_SVC_QUEUE* svc_conf_file_queue_;
+
/// The service repository to hold the services.
ACE_Service_Repository* repo_;
+
/// Repository of statically linked services.
ACE_STATIC_SVCS* static_svcs_;
+
/// Repository of statically linked services for which process
/// directive was called, but the service is not already a member of
/// the static_svcs_ list.
ACE_PROCESSED_STATIC_SVCS* processed_static_svcs_;
+
/// Support for intrusive reference counting
ACE_Atomic_Op<ACE_SYNCH_MUTEX, long> refcnt_;
+
public:
static void intrusive_add_ref (ACE_Service_Gestalt*);
static void intrusive_remove_ref (ACE_Service_Gestalt*);
+
}; /* class ACE_Service_Gestalt */
+
/**
* @class ACE_Service_Type_Dynamic_Guard
*
@@ -414,22 +483,29 @@ class ACE_Export ACE_Service_Type_Dynamic_Guard
public:
ACE_Service_Type_Dynamic_Guard (ACE_Service_Repository &r,
ACE_TCHAR const *name);
+
~ACE_Service_Type_Dynamic_Guard (void);
+
private:
ACE_Service_Repository & repo_;
size_t repo_begin_;
ACE_TCHAR const * const name_;
+
# if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
ACE_Guard< ACE_Recursive_Thread_Mutex > repo_monitor_;
#endif
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Service_Gestalt.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_SERVICE_GESTALT_H */
diff --git a/dep/ACE_wrappers/ace/Service_Gestalt.inl b/dep/ACE_wrappers/ace/Service_Gestalt.inl
index b9bb37a1495..d7de81361ec 100644
--- a/dep/ACE_wrappers/ace/Service_Gestalt.inl
+++ b/dep/ACE_wrappers/ace/Service_Gestalt.inl
@@ -2,10 +2,13 @@
//
// $Id: Service_Gestalt.inl 81388 2008-04-23 14:02:05Z johnnyw $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// This is the primary entry point into the ACE_Service_Config (the
// constructor just handles simple initializations).
+
ACE_INLINE int
ACE_Service_Gestalt::open (const ACE_TCHAR program_name[],
const ACE_TCHAR *logger_key,
@@ -15,12 +18,14 @@ ACE_Service_Gestalt::open (const ACE_TCHAR program_name[],
{
ACE_TRACE ("ACE_Service_Gestalt::open");
this->no_static_svcs_ = ignore_static_svcs;
+
return this->open_i (program_name,
logger_key,
ignore_static_svcs,
ignore_default_svc_conf,
ignore_debug_flag);
}
+
ACE_INLINE int
ACE_Service_Gestalt::open (int argc,
ACE_TCHAR *argv[],
@@ -30,18 +35,23 @@ ACE_Service_Gestalt::open (int argc,
bool ignore_debug_flag)
{
ACE_TRACE ("ACE_Service_Gestalt::open");
+
this->no_static_svcs_ = ignore_static_svcs;
+
if (this->parse_args_i (argc,
argv,
ignore_default_svc_conf) == -1)
return -1;
+
return this->open_i (argv == 0 ? 0 : argv[0],
logger_key,
ignore_static_svcs,
ignore_default_svc_conf,
ignore_debug_flag);
}
+
/// Searches for a service object declaration in the local repo, only
+
ACE_INLINE int
ACE_Service_Gestalt::find (const ACE_TCHAR name[],
const ACE_Service_Type **srp,
@@ -53,11 +63,14 @@ ACE_Service_Gestalt::find (const ACE_TCHAR name[],
// doing anything with it.
if (this->repo_ != 0)
return this->repo_->find (name, srp, ignore_suspended);
+
return 0;
}
+
ACE_INLINE ACE_Service_Repository*
ACE_Service_Gestalt::current_service_repository (void)
{
return this->repo_;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Service_Manager.cpp b/dep/ACE_wrappers/ace/Service_Manager.cpp
index 0c1ce8d8b5a..b67b34d26be 100644
--- a/dep/ACE_wrappers/ace/Service_Manager.cpp
+++ b/dep/ACE_wrappers/ace/Service_Manager.cpp
@@ -1,5 +1,7 @@
// $Id: Service_Manager.cpp 82513 2008-08-05 18:52:53Z parsons $
+
#include "ace/Service_Manager.h"
+
#include "ace/Get_Opt.h"
#include "ace/Log_Msg.h"
#include "ace/Service_Repository.h"
@@ -9,11 +11,15 @@
#include "ace/WFMO_Reactor.h"
#include "ace/OS_NS_stdio.h"
#include "ace/OS_NS_string.h"
+
ACE_RCSID (ace,
Service_Manager,
"$Id: Service_Manager.cpp 82513 2008-08-05 18:52:53Z parsons $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE (ACE_Service_Manager)
+
void
ACE_Service_Manager::dump (void) const
{
@@ -21,56 +27,69 @@ ACE_Service_Manager::dump (void) const
ACE_TRACE ("ACE_Service_Manager::dump");
#endif /* ACE_HAS_DUMP */
}
+
// Static variables.
+
u_short ACE_Service_Manager::DEFAULT_PORT_ = 10000;
+
ACE_Service_Manager::ACE_Service_Manager (void)
: debug_ (false),
signum_ (SIGHUP)
{
ACE_TRACE ("ACE_Service_Manager::ACE_Service_Manager");
}
+
ACE_Service_Manager::~ACE_Service_Manager (void)
{
ACE_TRACE ("ACE_Service_Manager::~ACE_Service_Manager");
}
+
int
ACE_Service_Manager::suspend (void)
{
ACE_TRACE ("ACE_Service_Manager::suspend");
return ACE_Reactor::instance ()->suspend_handler (this);
}
+
int
ACE_Service_Manager::resume (void)
{
ACE_TRACE ("ACE_Service_Manager::resume");
return ACE_Reactor::instance ()->resume_handler (this);
}
+
int
ACE_Service_Manager::open (const ACE_INET_Addr &sia)
{
ACE_TRACE ("ACE_Service_Manager::open");
+
// Reuse the listening address, even if it's already in use!
if (this->acceptor_.open (sia, 1) == -1)
{
return -1;
}
+
return 0;
}
+
int
ACE_Service_Manager::info (ACE_TCHAR **strp, size_t length) const
{
ACE_TRACE ("ACE_Service_Manager::info");
ACE_INET_Addr sa;
ACE_TCHAR buf[BUFSIZ];
+
if (this->acceptor_.get_local_addr (sa) == -1)
{
return -1;
}
+
ACE_OS::sprintf (buf,
ACE_TEXT ("%d/%s %s"),
sa.get_port_number (),
ACE_TEXT ("tcp"),
ACE_TEXT ("# lists all services in the daemon\n"));
+
if (*strp == 0 && (*strp = ACE_OS::strdup (buf)) == 0)
{
return -1;
@@ -79,15 +98,19 @@ ACE_Service_Manager::info (ACE_TCHAR **strp, size_t length) const
{
ACE_OS::strsncpy (*strp, buf, length);
}
+
return static_cast<int> (ACE_OS::strlen (buf));
}
+
int
ACE_Service_Manager::init (int argc, ACE_TCHAR *argv[])
{
ACE_TRACE ("ACE_Service_Manager::init");
ACE_INET_Addr local_addr (ACE_Service_Manager::DEFAULT_PORT_);
+
//FUZZ: disable check_for_lack_ACE_OS
ACE_Get_Opt getopt (argc, argv, ACE_TEXT ("dp:s:"), 0); // Start at argv[0]
+
for (int c; (c = getopt ()) != -1; )
//FUZZ: enable check_for_lack_ACE_OS
switch (c)
@@ -104,6 +127,7 @@ ACE_Service_Manager::init (int argc, ACE_TCHAR *argv[])
default:
break;
}
+
if (this->get_handle () == ACE_INVALID_HANDLE &&
this->open (local_addr) == -1)
{
@@ -119,48 +143,60 @@ ACE_Service_Manager::init (int argc, ACE_TCHAR *argv[])
ACE_TEXT ("registering service with ACE_Reactor\n")),
-1);
}
+
return 0;
}
+
int
ACE_Service_Manager::handle_close (ACE_HANDLE, ACE_Reactor_Mask)
{
ACE_TRACE ("ACE_Service_Manager::handle_close");
return this->acceptor_.close ();
}
+
int
ACE_Service_Manager::fini (void)
{
ACE_TRACE ("ACE_Service_Manager::fini");
+
int retv = 0;
+
if (this->get_handle () != ACE_INVALID_HANDLE)
{
retv =
ACE_Reactor::instance ()->remove_handler (
this,
ACE_Event_Handler::ACCEPT_MASK | ACE_Event_Handler::DONT_CALL);
+
this->handle_close (ACE_INVALID_HANDLE,
ACE_Event_Handler::NULL_MASK);
}
+
return retv;
}
+
ACE_HANDLE
ACE_Service_Manager::get_handle (void) const
{
ACE_TRACE ("ACE_Service_Manager::get_handle");
return this->acceptor_.get_handle ();
}
+
int
ACE_Service_Manager::handle_signal (int, siginfo_t *, ucontext_t *)
{
return 0;
}
+
// Determine all the services offered by this daemon and return the
// information back to the client.
+
int
ACE_Service_Manager::list_services (void)
{
ACE_TRACE ("ACE_Service_Manager::list_services");
ACE_Service_Repository_Iterator sri (*ACE_Service_Repository::instance (), 0);
+
for (const ACE_Service_Type *sr;
sri.next (sr) != 0;
sri.advance ())
@@ -168,13 +204,17 @@ ACE_Service_Manager::list_services (void)
ssize_t len = static_cast<ssize_t> (ACE_OS::strlen (sr->name ())) + 11;
ACE_TCHAR buf[BUFSIZ];
ACE_TCHAR *p = buf + len;
+
ACE_OS::strcpy (buf, sr->name ());
ACE_OS::strcat (buf, (sr->active ()) ?
ACE_TEXT (" (active) ") :
ACE_TEXT (" (paused) "));
+
p[-1] = ' ';
p[0] = '\0';
+
len += sr->type ()->info (&p, sizeof buf - len);
+
if (this->debug_)
{
ACE_DEBUG ((LM_DEBUG,
@@ -183,9 +223,11 @@ ACE_Service_Manager::list_services (void)
buf,
buf[len - 1] == '\n' ? ACE_TEXT ("") : ACE_TEXT ("\n")));
}
+
if (len > 0)
{
ssize_t n = this->client_stream_.send_n (buf, len);
+
if (n <= 0 && errno != EPIPE)
{
ACE_ERROR ((LM_ERROR,
@@ -194,18 +236,23 @@ ACE_Service_Manager::list_services (void)
}
}
}
+
return 0;
}
+
// Trigger a reconfiguration of the Service Configurator via its
// svc.conf file.
+
int
ACE_Service_Manager::reconfigure_services (void)
{
ACE_TRACE ("ACE_Service_Manager::reconfigure_services");
+
#if 0
// Send ourselves a signal! ACE_OS::kill (ACE_OS::getpid (),
// this->signum_);
#endif /* 0 */
+
// Flag the main event loop that a reconfiguration should occur.
// The next trip through the <ACE_Reactor::run_event_loop> should
// pick this up and cause a reconfiguration. Note that we can't
@@ -216,12 +263,14 @@ ACE_Service_Manager::reconfigure_services (void)
return static_cast<int> (this->client_stream_.send_n ("done\n",
sizeof ("done\n")));
}
+
// isolate the request-processing code
void
ACE_Service_Manager::process_request (ACE_TCHAR *request)
{
ACE_TRACE("ACE_Service_Manager::process_request");
ACE_TCHAR *p;
+
// Kill trailing newlines.
for (p = request;
(*p != '\0') && (*p != '\r') && (*p != '\n');
@@ -229,7 +278,9 @@ ACE_Service_Manager::process_request (ACE_TCHAR *request)
{
continue;
}
+
*p = '\0';
+
if (ACE_OS::strcmp (request, ACE_TEXT ("help")) == 0)
{
// Return a list of the configured services.
@@ -247,14 +298,18 @@ ACE_Service_Manager::process_request (ACE_TCHAR *request)
ACE_Service_Config_Guard guard (ACE_Service_Config::global ());
ACE_Service_Config::process_directive (request);
}
+
// Additional management services may be handled here...
}
+
// Accept new connection from client and carry out the service they
// request.
+
int
ACE_Service_Manager::handle_input (ACE_HANDLE)
{
ACE_TRACE ("ACE_Service_Manager::handle_input");
+
// Try to find out if the implementation of the reactor that we are
// using requires us to reset the event association for the newly
// created handle. This is because the newly created handle will
@@ -262,6 +317,7 @@ ACE_Service_Manager::handle_input (ACE_HANDLE)
// associations.
int reset_new_handle =
ACE_Reactor::instance ()->uses_event_associations ();
+
if (this->acceptor_.accept (this->client_stream_, // stream
0, // remote address
0, // timeout
@@ -271,40 +327,51 @@ ACE_Service_Manager::handle_input (ACE_HANDLE)
{
return -1;
}
+
if (this->debug_)
{
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("client_stream fd = %d\n"),
this->client_stream_.get_handle ()));
ACE_INET_Addr sa;
+
if (this->client_stream_.get_remote_addr (sa) == -1)
{
return -1;
}
+
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("accepted from host %C at port %d\n"),
sa.get_host_name (),
sa.get_port_number ()));
}
+
ACE_TCHAR request[BUFSIZ];
ACE_TCHAR* offset = request;
ssize_t remaining = sizeof (request);
+
// Read service request from client.
+
ssize_t result;
+
// Keep looping until we actually get the request. Note that Win32
// sets the socket into non-blocking mode, so we may need to loop if
// the system is heavily loaded. Read bytes into the buffer until a
// '\n' or '\r' is found in the buffer, otherwise the buffer
// contains an incomplete string.
+
int error;
+
do
{
result = client_stream_.recv (offset, remaining);
error = errno;
+
if (result == 0 && error != EWOULDBLOCK)
{
remaining = 0;
}
+
if (result >= 0)
{
if ((remaining -= result) <= 0)
@@ -314,8 +381,10 @@ ACE_Service_Manager::handle_input (ACE_HANDLE)
result = 0;
break;
}
+
offset += result;
*offset = 0;
+
if (ACE_OS::strchr (request, '\r') != 0
|| ACE_OS::strchr (request, '\n') != 0)
{
@@ -324,6 +393,7 @@ ACE_Service_Manager::handle_input (ACE_HANDLE)
}
}
while ((result == -1 && error == EWOULDBLOCK) || remaining > 0);
+
switch (result)
{
case -1:
@@ -333,6 +403,7 @@ ACE_Service_Manager::handle_input (ACE_HANDLE)
ACE_TEXT ("%p\n"),
ACE_TEXT ("recv")));
}
+
break;
case 0:
return 0;
@@ -344,19 +415,24 @@ ACE_Service_Manager::handle_input (ACE_HANDLE)
this,
0,
&old_signal_handler);
+
this->process_request (request);
+
// Restore existing SIGPIPE handler
ACE_Reactor::instance ()->register_handler (SIGPIPE,
old_signal_handler);
}
}
+
if (this->client_stream_.close () == -1 && this->debug_)
{
ACE_DEBUG ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("close")));
}
+
return 0;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Service_Manager.h b/dep/ACE_wrappers/ace/Service_Manager.h
index 5483973c96e..8238da7ef78 100644
--- a/dep/ACE_wrappers/ace/Service_Manager.h
+++ b/dep/ACE_wrappers/ace/Service_Manager.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Service_Manager.h
@@ -8,17 +9,23 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_SERVICE_MANAGER_H
#define ACE_SERVICE_MANAGER_H
#include /**/ "ace/pre.h"
+
#include "ace/SOCK_Stream.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/SOCK_Acceptor.h"
#include "ace/INET_Addr.h"
#include "ace/Service_Object.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Service_Manager
*
@@ -48,49 +55,67 @@ public:
// = Initialization and termination hooks.
/// Constructor.
ACE_Service_Manager (void);
+
/// Destructor.
virtual ~ACE_Service_Manager (void);
+
protected:
// = Perform the various meta-services.
+
/// Trigger a reconfiguration of the Service Configurator by
/// re-reading its local <svc.conf> file.
virtual int reconfigure_services (void);
+
/// Determine all the services offered by this daemon and return the
/// information back to the client.
virtual int list_services (void);
+
// = Dynamic linking hooks.
virtual int init (int argc, ACE_TCHAR *argv[]);
virtual int info (ACE_TCHAR **info_string, size_t length) const;
virtual int fini (void);
+
// = Scheduling hooks.
virtual int suspend (void);
virtual int resume (void);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
int open (const ACE_INET_Addr &sia);
+
// = Demultiplexing hooks.
virtual ACE_HANDLE get_handle (void) const;
virtual int handle_input (ACE_HANDLE fd);
virtual int handle_close (ACE_HANDLE fd, ACE_Reactor_Mask);
virtual int handle_signal (int signum, siginfo_t *, ucontext_t *);
+
/// Handle one request.
virtual void process_request (ACE_TCHAR *request);
+
/// Connection to the client (we only support one client connection
/// at a time).
ACE_SOCK_Stream client_stream_;
+
/// Acceptor instance.
ACE_SOCK_Acceptor acceptor_;
+
/// Keep track whether we debug or not.
bool debug_;
+
/// The signal used to trigger reconfiguration.
int signum_;
+
/// Default port for the Acceptor to listen on.
static u_short DEFAULT_PORT_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
#endif /* _SERVICE_MANAGER_H */
diff --git a/dep/ACE_wrappers/ace/Service_Object.cpp b/dep/ACE_wrappers/ace/Service_Object.cpp
index dc454749dff..f737d6a3136 100644
--- a/dep/ACE_wrappers/ace/Service_Object.cpp
+++ b/dep/ACE_wrappers/ace/Service_Object.cpp
@@ -1,9 +1,13 @@
// $Id: Service_Object.cpp 81826 2008-06-02 15:29:53Z schmidt $
+
#include "ace/config-all.h"
+
#include "ace/Service_Object.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Service_Object.inl"
#endif /* __ACE_INLINE__ */
+
#include "ace/OS_NS_stdio.h"
#include "ace/Service_Types.h"
#include "ace/DLL.h"
@@ -12,12 +16,16 @@
#if defined (ACE_OPENVMS)
# include "ace/Lib_Find.h"
#endif
+
ACE_RCSID (ace,
Service_Object,
"$Id: Service_Object.cpp 81826 2008-06-02 15:29:53Z schmidt $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_Service_Object)
ACE_ALLOC_HOOK_DEFINE(ACE_Service_Type)
+
void
ACE_Service_Type::dump (void) const
{
@@ -25,6 +33,7 @@ ACE_Service_Type::dump (void) const
ACE_TRACE ("ACE_Service_Type::dump");
#endif /* ACE_HAS_DUMP */
+
// Using printf, since the log facility may not have been
// initialized yet. Using a "//" prefix, in case the executable
// happens to be a code generator and the output gets embedded in
@@ -36,7 +45,9 @@ ACE_Service_Type::dump (void) const
this->type_,
(this->type_ != 0) ? this->type_->object () : 0,
this->active_);
+
}
+
ACE_Service_Type::ACE_Service_Type (const ACE_TCHAR *n,
ACE_Service_Type_Impl *t,
const ACE_DLL &dll,
@@ -50,6 +61,7 @@ ACE_Service_Type::ACE_Service_Type (const ACE_TCHAR *n,
ACE_TRACE ("ACE_Service_Type::ACE_Service_Type");
this->name (n);
}
+
ACE_Service_Type::ACE_Service_Type (const ACE_TCHAR *n,
ACE_Service_Type_Impl *t,
ACE_SHLIB_HANDLE handle,
@@ -63,12 +75,15 @@ ACE_Service_Type::ACE_Service_Type (const ACE_TCHAR *n,
this->dll_.set_handle (handle);
this->name (n);
}
+
ACE_Service_Type::~ACE_Service_Type (void)
{
ACE_TRACE ("ACE_Service_Type::~ACE_Service_Type");
this->fini ();
+
delete [] const_cast <ACE_TCHAR *> (this->name_);
}
+
int
ACE_Service_Type::fini (void)
{
@@ -77,9 +92,12 @@ ACE_Service_Type::fini (void)
ACE_TEXT ("ACE (%P|%t) ST::fini - destroying name=%s, dll=%s\n"),
this->name_,
this->dll_.dll_name_));
+
if (this->fini_already_called_)
return 0;
+
this->fini_already_called_ = true;
+
if (this->type_ == 0)
{
// Returning 1 currently only makes sense for dummy instances, used
@@ -87,14 +105,19 @@ ACE_Service_Type::fini (void)
// dynamic service. This is necessary to help enforce the correct
// finalization order, when such service also has any (dependent)
// static services
+
return 1; // No implementation was found.
}
+
int ret = this->type_->fini ();
+
// Ensure that closing the DLL is done after type_->fini() as it may
// require access to the code for the service object destructor,
// which resides in the DLL
+
return (ret | this->dll_.close ());
}
+
int
ACE_Service_Type::suspend (void) const
{
@@ -102,6 +125,7 @@ ACE_Service_Type::suspend (void) const
(const_cast<ACE_Service_Type *> (this))->active_ = false;
return this->type_->suspend ();
}
+
int
ACE_Service_Type::resume (void) const
{
@@ -109,34 +133,41 @@ ACE_Service_Type::resume (void) const
(const_cast<ACE_Service_Type *> (this))->active_ = true;
return this->type_->resume ();
}
+
ACE_Service_Object::ACE_Service_Object (ACE_Reactor *r)
: ACE_Event_Handler (r)
{
ACE_TRACE ("ACE_Service_Object::ACE_Service_Object");
}
+
ACE_Service_Object::~ACE_Service_Object (void)
{
ACE_TRACE ("ACE_Service_Object::~ACE_Service_Object");
}
+
int
ACE_Service_Object::suspend (void)
{
ACE_TRACE ("ACE_Service_Object::suspend");
return 0;
}
+
int
ACE_Service_Object::resume (void)
{
ACE_TRACE ("ACE_Service_Object::resume");
return 0;
}
+
void
ACE_Service_Type::name (const ACE_TCHAR *n)
{
ACE_TRACE ("ACE_Service_Type::name");
+
delete [] const_cast <ACE_TCHAR *> (this->name_);
this->name_ = ACE::strnew (n);
}
+
#if defined (ACE_OPENVMS)
ACE_Dynamic_Svc_Registrar::ACE_Dynamic_Svc_Registrar (const ACE_TCHAR* alloc_name,
void* svc_allocator)
@@ -145,5 +176,6 @@ ACE_Dynamic_Svc_Registrar::ACE_Dynamic_Svc_Registrar (const ACE_TCHAR* alloc_nam
ACE::ldregister (alloc_name, svc_allocator);
}
#endif
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Service_Object.h b/dep/ACE_wrappers/ace/Service_Object.h
index b87e9eed405..fd69ba76f17 100644
--- a/dep/ACE_wrappers/ace/Service_Object.h
+++ b/dep/ACE_wrappers/ace/Service_Object.h
@@ -1,4 +1,5 @@
/* -*- C++ -*- */
+
//=============================================================================
/**
* @file Service_Object.h
@@ -8,19 +9,27 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_SERVICE_OBJECT_H
#define ACE_SERVICE_OBJECT_H
#include /**/ "ace/pre.h"
+
#include "ace/Shared_Object.h"
#include "ace/Svc_Conf_Tokens.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Event_Handler.h"
#include "ace/DLL.h"
+
#include "ace/Service_Gestalt.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
#define ACE_Component ACE_Service_Object
+
/**
* @class ACE_Service_Object
*
@@ -40,15 +49,20 @@ public:
// = Initialization and termination methods.
/// Constructor.
ACE_Service_Object (ACE_Reactor * = 0);
+
/// Destructor.
virtual ~ACE_Service_Object (void);
+
/// Temporarily disable a service without removing it completely.
virtual int suspend (void);
+
/// Re-enable a previously suspended service.
virtual int resume (void);
};
+
// Forward decl.
class ACE_Service_Type_Impl;
+
/**
* @class ACE_Service_Type
*
@@ -64,9 +78,11 @@ public:
{
/// Delete the payload object.
DELETE_OBJ = 1,
+
/// Delete the enclosing object.
DELETE_THIS = 2
};
+
enum
{
SERVICE_OBJECT = ACE_SVC_OBJ_T,
@@ -74,6 +90,7 @@ public:
STREAM = ACE_STREAM_T,
INVALID_TYPE = -1
};
+
// = Initialization and termination methods.
ACE_Service_Type (const ACE_TCHAR *n,
ACE_Service_Type_Impl *o,
@@ -84,41 +101,57 @@ public:
ACE_SHLIB_HANDLE handle,
bool active);
~ACE_Service_Type (void);
+
const ACE_TCHAR *name (void) const;
void name (const ACE_TCHAR *);
+
const ACE_Service_Type_Impl *type (void) const;
void type (const ACE_Service_Type_Impl *, bool active = true);
+
/// Is this just a stub for the real thing?
bool is_forward_declaration (void) const;
+
int suspend (void) const;
int resume (void) const;
bool active (void) const;
void active (bool turnon);
+
/// Calls <fini> on <type_>
int fini (void);
+
/// Check if the service has been fini'ed.
bool fini_called (void) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Get to the DLL's implentation
const ACE_DLL & dll (void) const;
+
/// Sets the DLL
void dll (const ACE_DLL&);
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Humanly readible name of svc.
const ACE_TCHAR *name_;
+
/// Pointer to C++ object that implements the svc.
const ACE_Service_Type_Impl *type_;
+
/// ACE_DLL representing the shared object file (non-zero if
/// dynamically linked).
mutable ACE_DLL dll_;
+
/// true if svc is currently active, otherwise false.
bool active_;
+
/// true if <fini> on <type_> has already been called, otherwise false.
bool fini_already_called_;
};
+
/**
* @class ACE_Service_Object_Ptr
*
@@ -138,14 +171,18 @@ public:
// = Initialization and termination methods.
/// Acquire ownership of the @a so.
ACE_Service_Object_Ptr (ACE_Service_Object *so);
+
/// Release the held ACE_Service_Object by calling its <fini> hook.
~ACE_Service_Object_Ptr (void);
+
/// Smart pointer to access the underlying ACE_Service_Object.
ACE_Service_Object *operator-> ();
+
private:
/// Holds the service object until we're done.
ACE_Service_Object *service_object_;
};
+
#if defined (ACE_OPENVMS)
/**
* @class ACE_Dynamic_Svc_Registrar
@@ -159,10 +196,13 @@ public:
void* svc_allocator);
};
#endif
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Service_Object.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_SERVICE_OBJECT_H */
diff --git a/dep/ACE_wrappers/ace/Service_Object.inl b/dep/ACE_wrappers/ace/Service_Object.inl
index 22b3db4ccd6..6283f3e9981 100644
--- a/dep/ACE_wrappers/ace/Service_Object.inl
+++ b/dep/ACE_wrappers/ace/Service_Object.inl
@@ -1,32 +1,39 @@
// -*- C++ -*-
// $Id: Service_Object.inl 81388 2008-04-23 14:02:05Z johnnyw $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE ACE_Service_Object_Ptr::ACE_Service_Object_Ptr (ACE_Service_Object *so)
: service_object_ (so)
{
}
+
ACE_INLINE ACE_Service_Object_Ptr::~ACE_Service_Object_Ptr (void)
{
this->service_object_->fini ();
delete this->service_object_;
}
+
ACE_INLINE ACE_Service_Object *
ACE_Service_Object_Ptr::operator-> ()
{
return this->service_object_;
}
+
ACE_INLINE const ACE_TCHAR *
ACE_Service_Type::name (void) const
{
ACE_TRACE ("ACE_Service_Type::name");
return this->name_;
}
+
ACE_INLINE const ACE_Service_Type_Impl *
ACE_Service_Type::type (void) const
{
ACE_TRACE ("ACE_Service_Type::type");
return this->type_;
}
+
ACE_INLINE void
ACE_Service_Type::type (const ACE_Service_Type_Impl *o, bool enabled)
{
@@ -34,33 +41,39 @@ ACE_Service_Type::type (const ACE_Service_Type_Impl *o, bool enabled)
this->type_ = o;
((ACE_Service_Type *) this)->active_ = enabled;
}
+
ACE_INLINE bool
ACE_Service_Type::active (void) const
{
ACE_TRACE ("ACE_Service_Type::active");
return this->active_;
}
+
ACE_INLINE void
ACE_Service_Type::active (bool turnon)
{
ACE_TRACE ("ACE_Service_Type::active");
this->active_ = turnon;
}
+
ACE_INLINE bool
ACE_Service_Type::fini_called (void) const
{
ACE_TRACE ("ACE_Service_Type::fini_called");
return this->fini_already_called_;
}
+
ACE_INLINE const ACE_DLL & ACE_Service_Type::dll () const
{
ACE_TRACE ("ACE_Service_Type::dll");
return this->dll_;
}
+
ACE_INLINE void ACE_Service_Type::dll (const ACE_DLL &adll)
{
ACE_TRACE ("ACE_Service_Type::dll");
this->dll_ = adll;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Service_Repository.cpp b/dep/ACE_wrappers/ace/Service_Repository.cpp
index da0accdb998..d7d673ae756 100644
--- a/dep/ACE_wrappers/ace/Service_Repository.cpp
+++ b/dep/ACE_wrappers/ace/Service_Repository.cpp
@@ -1,8 +1,11 @@
// $Id: Service_Repository.cpp 81388 2008-04-23 14:02:05Z johnnyw $
+
#include "ace/Service_Repository.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Service_Repository.inl"
#endif /* __ACE_INLINE__ */
+
#include "ace/Service_Types.h"
#include "ace/Object_Manager.h"
#include "ace/Log_Msg.h"
@@ -10,16 +13,22 @@
#include "ace/OS_NS_unistd.h"
#include "ace/OS_NS_errno.h"
#include "ace/OS_NS_string.h"
+
ACE_RCSID (ace,
Service_Repository,
"$Id: Service_Repository.cpp 81388 2008-04-23 14:02:05Z johnnyw $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_Service_Repository)
+
// Process-wide Service Repository.
ACE_Service_Repository *ACE_Service_Repository::svc_rep_ = 0;
+
// Controls whether the Service_Repository is deleted when we shut
// down (we can only delete it safely if we created it)!
bool ACE_Service_Repository::delete_svc_rep_ = false;
+
void
ACE_Service_Repository::dump (void) const
{
@@ -27,6 +36,7 @@ ACE_Service_Repository::dump (void) const
ACE_TRACE ("ACE_Service_Repository::dump");
#endif /* ACE_HAS_DUMP */
}
+
ACE_Service_Repository::ACE_Service_Repository (void)
: service_vector_ (0),
current_size_ (0),
@@ -34,10 +44,12 @@ ACE_Service_Repository::ACE_Service_Repository (void)
{
ACE_TRACE ("ACE_Service_Repository::ACE_Service_Repository");
}
+
ACE_Service_Repository *
ACE_Service_Repository::instance (size_t size /* = ACE_Service_Repository::DEFAULT_SIZE */)
{
ACE_TRACE ("ACE_Service_Repository::instance");
+
if (ACE_Service_Repository::svc_rep_ == 0)
{
// Perform Double-Checked Locking Optimization.
@@ -55,26 +67,33 @@ ACE_Service_Repository::instance (size_t size /* = ACE_Service_Repository::DEFAU
}
}
}
+
return ACE_Service_Repository::svc_rep_;
}
+
ACE_Service_Repository *
ACE_Service_Repository::instance (ACE_Service_Repository *s)
{
ACE_TRACE ("ACE_Service_Repository::instance");
ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon,
*ACE_Static_Object_Lock::instance (), 0));
+
ACE_Service_Repository *t = ACE_Service_Repository::svc_rep_;
// We can't safely delete it since we don't know who created it!
ACE_Service_Repository::delete_svc_rep_ = false;
+
ACE_Service_Repository::svc_rep_ = s;
return t;
}
+
void
ACE_Service_Repository::close_singleton (void)
{
ACE_TRACE ("ACE_Service_Repository::close_singleton");
+
ACE_MT (ACE_GUARD (ACE_Recursive_Thread_Mutex, ace_mon,
*ACE_Static_Object_Lock::instance ()));
+
if (ACE_Service_Repository::delete_svc_rep_)
{
delete ACE_Service_Repository::svc_rep_;
@@ -82,37 +101,49 @@ ACE_Service_Repository::close_singleton (void)
ACE_Service_Repository::delete_svc_rep_ = false;
}
}
+
// Initialize the Repository to a clean slate.
+
int
ACE_Service_Repository::open (size_t size)
{
ACE_TRACE ("ACE_Service_Repository::open");
+
ACE_Service_Type **temp = 0;
+
ACE_NEW_RETURN (temp,
ACE_Service_Type *[size],
-1);
+
this->service_vector_ = const_cast<const ACE_Service_Type **> (temp);
this->total_size_ = size;
return 0;
}
+
ACE_Service_Repository::ACE_Service_Repository (size_t size)
: current_size_ (0)
{
ACE_TRACE ("ACE_Service_Repository::ACE_Service_Repository");
+
if (this->open (size) == -1)
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_Service_Repository")));
}
+
// Finalize (call <fini> and possibly delete) all the services.
+
int
ACE_Service_Repository::fini (void)
{
ACE_TRACE ("ACE_Service_Repository::fini");
ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, this->lock_, -1));
+
if (this->service_vector_ == 0)
return 0;
+
int retval = 0;
+
// Do not be tempted to use the prefix decrement operator. Use
// postfix decrement operator since the index is unsigned and may
// wrap around the 0
@@ -121,6 +152,7 @@ ACE_Service_Repository::fini (void)
// <fini> the services in reverse order.
ACE_Service_Type *s =
const_cast<ACE_Service_Type *> (this->service_vector_[i]);
+
#ifndef ACE_NLOGGING
if (ACE::debug ())
{
@@ -143,20 +175,26 @@ ACE_Service_Repository::fini (void)
this->total_size_));
}
#endif
+
// Collect any errors.
if (s != 0)
retval += s->fini ();
}
+
return (retval == 0) ? 0 : -1;
}
+
// Close down all the services.
+
int
ACE_Service_Repository::close (void)
{
ACE_TRACE ("ACE_Service_Repository::close");
ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, this->lock_, -1));
+
if (this->service_vector_ == 0)
return 0;
+
#ifndef ACE_NLOGGING
if(ACE::debug ())
ACE_DEBUG ((LM_DEBUG,
@@ -164,6 +202,7 @@ ACE_Service_Repository::close (void)
this,
this->current_size_));
#endif
+
// Do not use the prefix decrement operator since the index is
// unsigned and may wrap around the 0.
for (size_t i = this->current_size_; i-- != 0; )
@@ -171,6 +210,7 @@ ACE_Service_Repository::close (void)
// Delete services in reverse order.
ACE_Service_Type *s =
const_cast<ACE_Service_Type *> (this->service_vector_[i]);
+
#ifndef ACE_NLOGGING
if(ACE::debug ())
{
@@ -191,11 +231,14 @@ ACE_Service_Repository::close (void)
--this->current_size_;
delete s;
}
+
delete [] this->service_vector_;
this->service_vector_ = 0;
this->current_size_ = 0;
+
return 0;
}
+
ACE_Service_Repository::~ACE_Service_Repository (void)
{
ACE_TRACE ("ACE_Service_Repository::~ACE_Service_Repository");
@@ -205,12 +248,14 @@ ACE_Service_Repository::~ACE_Service_Repository (void)
#endif
this->close ();
}
+
// Locate an entry with <name> in the table. If <ignore_suspended> is
// set then only consider services marked as resumed. If the caller
// wants the located entry, pass back a pointer to the located entry
// via <srp>. If <name> is not found -1 is returned. If <name> is
// found, but it is suspended and the caller wants to ignore suspended
// services a -2 is returned. Must be called with locks held.
+
int
ACE_Service_Repository::find_i (const ACE_TCHAR name[],
size_t &slot,
@@ -219,6 +264,7 @@ ACE_Service_Repository::find_i (const ACE_TCHAR name[],
{
ACE_TRACE ("ACE_Service_Repository::find_i");
size_t i;
+
for (i = 0; i < this->current_size_; i++)
{
if (this->service_vector_[i] != 0 // skip any empty slots
@@ -226,6 +272,7 @@ ACE_Service_Repository::find_i (const ACE_TCHAR name[],
this->service_vector_[i]->name ()) == 0)
break;
}
+
if (i < this->current_size_)
{
slot = i;
@@ -235,34 +282,43 @@ ACE_Service_Repository::find_i (const ACE_TCHAR name[],
*srp = 0;
return -1;
}
+
if (srp != 0)
*srp = this->service_vector_[i];
+
if (ignore_suspended
&& this->service_vector_[i]->active () == 0)
return -2;
+
return 0;
}
+
return -1;
}
+
/// @brief Relocate (a static) service to another DLL.
///
/// Works by having the service type keep a reference to a specific
/// DLL. No locking, caller makes sure calling it is safe. You can
/// forcefully relocate any DLLs in the given range, not only the
/// static ones - but that will cause Very Bad Things (tm) to happen.
+
int
ACE_Service_Repository::relocate_i (size_t begin,
size_t end,
const ACE_DLL& adll)
{
ACE_SHLIB_HANDLE new_handle = adll.get_handle (0);
+
for (size_t i = begin; i < end; i++)
{
ACE_Service_Type *type =
const_cast<ACE_Service_Type *> (this->service_vector_[i]);
+
ACE_SHLIB_HANDLE old_handle = (type == 0) ? ACE_SHLIB_INVALID_HANDLE
: type->dll ().get_handle (0);
+
#ifndef ACE_NLOGGING
if (ACE::debug ())
{
@@ -285,6 +341,7 @@ ACE_Service_Repository::relocate_i (size_t begin,
new_handle));
}
#endif
+
if (type != 0 // skip any gaps
&& old_handle == ACE_SHLIB_INVALID_HANDLE
&& new_handle != old_handle)
@@ -304,8 +361,10 @@ ACE_Service_Repository::relocate_i (size_t begin,
type->dll (adll); // ups the refcount on adll
}
}
+
return 0;
}
+
int
ACE_Service_Repository::find (const ACE_TCHAR name[],
const ACE_Service_Type **srp,
@@ -317,6 +376,7 @@ ACE_Service_Repository::find (const ACE_TCHAR name[],
return this->find_i (name, ignore_location, srp, ignore_suspended);
}
+
// Insert the ACE_Service_Type SR into the repository. Note that
// services may be inserted either resumed or suspended. Using same
// name as in an existing service causes the delete () to be called
@@ -325,9 +385,11 @@ int
ACE_Service_Repository::insert (const ACE_Service_Type *sr)
{
ACE_TRACE ("ACE_Service_Repository::insert");
+
size_t i = 0;
int return_value = -1;
ACE_Service_Type const *s = 0;
+
// Establish scope for locking while manipulating the service
// storage
{
@@ -336,7 +398,9 @@ ACE_Service_Repository::insert (const ACE_Service_Type *sr)
ace_mon,
this->lock_,
-1));
+
return_value = find_i (sr->name (), i, &s, false);
+
// Adding an entry.
if (s != 0)
{
@@ -349,8 +413,10 @@ ACE_Service_Repository::insert (const ACE_Service_Type *sr)
// performed on services with indexes between some old
// current_size_ and the new current_size_ value. See
// ACE_Service_Type_Dynamic_Guard ctor and dtor for details.
+
if (i < this->current_size_)
i = this->current_size_;
+
if (i < this->total_size_)
{
this->service_vector_[i] = sr;
@@ -361,6 +427,7 @@ ACE_Service_Repository::insert (const ACE_Service_Type *sr)
{
return_value = -1; // no space left
}
+
// Since there may be "holes" left by removed services one
// could consider wrapping current_size_ modulo
// total_size_. This is going to impact
@@ -384,13 +451,17 @@ ACE_Service_Repository::insert (const ACE_Service_Type *sr)
(sr->type () != 0) ? sr->type ()->object () : 0,
sr->active ()));
#endif
+
// If necessary, delete but outside the lock. (s may be 0, but
// that's okay, too)
delete s;
+
if (return_value == -1)
ACE_OS::last_error (ENOSPC);
+
return return_value;
}
+
// Resume a service that was previously suspended.
int
ACE_Service_Repository::resume (const ACE_TCHAR name[],
@@ -398,13 +469,17 @@ ACE_Service_Repository::resume (const ACE_TCHAR name[],
{
ACE_TRACE ("ACE_Service_Repository::resume");
ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, this->lock_, -1));
+
size_t i = 0;
if (-1 == this->find_i (name, i, srp, 0))
return -1;
+
return this->service_vector_[i]->resume ();
}
+
// Suspend a service so that it will not be considered active under
// most circumstances by other portions of the ACE_Service_Repository.
+
int
ACE_Service_Repository::suspend (const ACE_TCHAR name[],
const ACE_Service_Type **srp)
@@ -414,13 +489,16 @@ ACE_Service_Repository::suspend (const ACE_TCHAR name[],
size_t i = 0;
if (-1 == this->find_i (name, i, srp, 0))
return -1;
+
return this->service_vector_[i]->suspend ();
}
+
/**
* @brief Completely remove a <name> entry from the Repository and
* dynamically unlink it if it was originally dynamically linked.
*/
+
int
ACE_Service_Repository::remove (const ACE_TCHAR name[], ACE_Service_Type **ps)
{
@@ -428,16 +506,19 @@ ACE_Service_Repository::remove (const ACE_TCHAR name[], ACE_Service_Type **ps)
ACE_Service_Type *s = 0;
{
ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, this->lock_, -1));
+
// Not found!?
if (this->remove_i (name, &s) == -1)
return -1;
}
+
if (ps != 0)
*ps = s;
else
delete s;
return 0;
}
+
/**
* @brief Completely remove a <name> entry from the Repository and
* dynamically unlink it if it was originally dynamically linked.
@@ -464,8 +545,10 @@ ACE_Service_Repository::remove_i (const ACE_TCHAR name[], ACE_Service_Type **ps)
size_t i = 0;
if (-1 == this->find_i (name, i, 0, false))
return -1; // Not found
+
// We may need the old ptr - to be delete outside the lock!
*ps = const_cast<ACE_Service_Type *> (this->service_vector_[i]);
+
#ifndef ACE_NLOGGING
if (ACE::debug ())
ACE_DEBUG ((LM_DEBUG,
@@ -478,10 +561,13 @@ ACE_Service_Repository::remove_i (const ACE_TCHAR name[], ACE_Service_Type **ps)
*ps,
(*ps)->active ()));
#endif
+
this->service_vector_[i] = 0; // simply leave a gap
return 0;
}
+
ACE_ALLOC_HOOK_DEFINE(ACE_Service_Repository_Iterator)
+
void
ACE_Service_Repository_Iterator::dump (void) const
{
@@ -490,9 +576,11 @@ ACE_Service_Repository_Iterator::dump (void) const
#endif /* ACE_HAS_DUMP */
}
+
// Initializes the iterator and skips over any suspended entries at
// the beginning of the table, if necessary. Note, you must not
// perform destructive operations on elements during this iteration...
+
ACE_Service_Repository_Iterator::ACE_Service_Repository_Iterator
(ACE_Service_Repository &sr, int ignr_suspended)
: svc_rep_ (sr),
@@ -502,37 +590,49 @@ ACE_Service_Repository_Iterator::ACE_Service_Repository_Iterator
while (!(done() || valid()))
this->next_++;
}
+
// Obtains a pointer to the next valid service in the table. If there
// are no more entries, returns 0, else 1.
+
int
ACE_Service_Repository_Iterator::next (const ACE_Service_Type *&sr)
{
ACE_TRACE ("ACE_Service_Repository_Iterator::next");
+
if (done ())
return 0;
+
sr = this->svc_rep_.service_vector_[this->next_];
return 1;
}
+
// Advance the iterator by the proper amount. If we are ignoring
// suspended entries and the current entry is suspended, then we must
// skip over this entry. Otherwise, we must advance the NEXT index to
// reference the next valid service entry.
+
int
ACE_Service_Repository_Iterator::advance (void)
{
ACE_TRACE ("ACE_Service_Repository_Iterator::advance");
+
if (done()) return 0;
+
do this->next_++; while (!(done () || valid ()));
+
return !done();
}
+
bool
ACE_Service_Repository_Iterator::valid (void) const
{
ACE_TRACE ("ACE_Service_Repository_Iterator::valid");
if (!this->ignore_suspended_)
return (this->svc_rep_.service_vector_[this->next_] != 0); // skip over gaps
+
return (this->svc_rep_.service_vector_[this->next_] != 0
&& this->svc_rep_.service_vector_[this->next_]->active ());
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Service_Repository.h b/dep/ACE_wrappers/ace/Service_Repository.h
index 8570f816959..77b4955683c 100644
--- a/dep/ACE_wrappers/ace/Service_Repository.h
+++ b/dep/ACE_wrappers/ace/Service_Repository.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Service_Repository.h
@@ -8,18 +9,26 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_SERVICE_REPOSITORY_H
#define ACE_SERVICE_REPOSITORY_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Default_Constants.h"
#include "ace/Recursive_Thread_Mutex.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Service_Type;
class ACE_DLL;
+
#define ACE_Component_Repository ACE_Service_Repository
/**
* @class ACE_Service_Repository
@@ -40,38 +49,51 @@ class ACE_Export ACE_Service_Repository
{
public:
friend class ACE_Service_Repository_Iterator;
+
enum
{
DEFAULT_SIZE = ACE_DEFAULT_SERVICE_REPOSITORY_SIZE
};
+
// = Initialization and termination methods.
/// Initialize the repository.
ACE_Service_Repository (void);
+
/// Initialize the repository.
ACE_Service_Repository (size_t size);
+
/// Initialize the repository.
int open (size_t size = DEFAULT_SIZE);
+
/// Close down the repository and free up dynamically allocated
/// resources.
~ACE_Service_Repository (void);
+
/// Close down the repository and free up dynamically allocated
/// resources.
int close (void);
+
/// Finalize all the services by calling <fini> and deleting
/// dynamically allocated services.
int fini (void);
+
/// Get pointer to a process-wide ACE_Service_Repository.
static ACE_Service_Repository * instance
(size_t size = ACE_Service_Repository::DEFAULT_SIZE);
+
/// Set pointer to a process-wide ACE_Service_Repository and return
/// existing pointer.
static ACE_Service_Repository *instance (ACE_Service_Repository *);
+
/// Delete the dynamically allocated Singleton.
static void close_singleton (void);
+
// = Search structure operations (all acquire locks as necessary).
+
/// Insert a new service record. Returns -1 when the service repository
/// is full and 0 on success.
int insert (const ACE_Service_Type *);
+
/**
* Locate a named entry in the service table, optionally ignoring
* suspended entries.
@@ -91,31 +113,42 @@ public:
int find (const ACE_TCHAR name[],
const ACE_Service_Type **srp = 0,
bool ignore_suspended = true) const;
+
/// Remove an existing service record. If @a sr == 0, the service record
/// is deleted before control is returned to the caller. If @a sr != 0,
/// the service's record is removed from the repository, but not deleted;
/// *sr receives the service record pointer and the caller is responsible
/// for properly disposing of it.
int remove (const ACE_TCHAR[], ACE_Service_Type **sr = 0);
+
// = Liveness control
/// Resume a service record.
int resume (const ACE_TCHAR[], const ACE_Service_Type ** = 0);
+
/// Suspend a service record.
int suspend (const ACE_TCHAR[], const ACE_Service_Type ** = 0);
+
/// Return the current size of the repository.
size_t current_size (void) const;
+
/// Return the total size of the repository.
size_t total_size (void) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
+
friend class ACE_Service_Type_Dynamic_Guard;
+
/// Remove an existing service record. It requires @a sr != 0, which
/// receives the service record pointer and the caller is
/// responsible for properly disposing of it.
int remove_i (const ACE_TCHAR[], ACE_Service_Type **sr);
+
/**
* Locate a named entry in the service table, optionally ignoring
* suspended entries.
@@ -140,6 +173,7 @@ private:
size_t &slot,
const ACE_Service_Type **srp = 0,
bool ignore_suspended = true) const;
+
/// @brief Relocate (static) services to another DLL.
///
/// If any have been registered in the context of a "forward
@@ -153,24 +187,32 @@ private:
/// DLL. No locking, caller makes sure calling it is safe. You can
/// forcefully relocate any DLLs in the given range, not only the
/// static ones - but that will cause Very Bad Things (tm) to happen.
+
int relocate_i (size_t begin,
size_t end,
const ACE_DLL &adll);
+
/// Contains all the configured services.
const ACE_Service_Type **service_vector_;
+
/// Current number of services.
size_t current_size_;
+
/// Maximum number of services.
size_t total_size_;
+
/// Pointer to a process-wide ACE_Service_Repository.
static ACE_Service_Repository *svc_rep_;
+
/// Must delete the <svc_rep_> if true.
static bool delete_svc_rep_;
+
#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
/// Synchronization variable for the MT_SAFE Repository
mutable ACE_Recursive_Thread_Mutex lock_;
#endif /* ACE_MT_SAFE */
};
+
/**
* @class ACE_Service_Repository_Iterator
*
@@ -186,38 +228,54 @@ public:
/// Constructor initializes the iterator.
ACE_Service_Repository_Iterator (ACE_Service_Repository &sr,
int ignored_suspended = 1);
+
/// Destructor.
~ACE_Service_Repository_Iterator (void);
+
public:
// = Iteration methods.
+
/// Pass back the <next_item> that hasn't been seen in the repository.
/// Returns 0 when all items have been seen, else 1.
int next (const ACE_Service_Type *&next_item);
+
/// Returns 1 when all items have been seen, else 0.
int done (void) const;
+
/// Move forward by one element in the repository. Returns 0 when all the
/// items in the set have been seen, else 1.
int advance (void);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
bool valid (void) const;
+
private:
ACE_Service_Repository_Iterator (const ACE_Service_Repository_Iterator&);
+
/// Reference to the Service Repository we are iterating over.
ACE_Service_Repository &svc_rep_;
+
/// Next index location that we haven't yet seen.
size_t next_;
+
/// Are we ignoring suspended services?
bool ignore_suspended_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Service_Repository.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
+
#endif /* _SERVICE_REPOSITORY_H */
diff --git a/dep/ACE_wrappers/ace/Service_Repository.inl b/dep/ACE_wrappers/ace/Service_Repository.inl
index 20c52a488d3..621c837ef53 100644
--- a/dep/ACE_wrappers/ace/Service_Repository.inl
+++ b/dep/ACE_wrappers/ace/Service_Repository.inl
@@ -1,13 +1,17 @@
// -*- C++ -*-
//
// $Id: Service_Repository.inl 80826 2008-03-04 14:51:23Z wotte $
+
// Returns a count of the number of currently valid entries (counting
// both resumed and suspended entries).
+
#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
#include "ace/Guard_T.h"
#include "ace/Thread_Mutex.h"
#endif /* ACE_MT_SAFE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE size_t
ACE_Service_Repository::current_size (void) const
{
@@ -17,8 +21,10 @@ ACE_Service_Repository::current_size (void) const
(ACE_Recursive_Thread_Mutex &) this->lock_, 0));
return this->current_size_;
}
+
// Returns a count of the total number of possible entries in the
// table.
+
ACE_INLINE size_t
ACE_Service_Repository::total_size (void) const
{
@@ -28,14 +34,18 @@ ACE_Service_Repository::total_size (void) const
(ACE_Recursive_Thread_Mutex &) this->lock_, 0));
return this->total_size_;
}
+
ACE_INLINE int
ACE_Service_Repository_Iterator::done (void) const
{
ACE_TRACE ("ACE_Service_Repository_Iterator::done");
+
return this->next_ >= this->svc_rep_.current_size_;
}
+
ACE_INLINE
ACE_Service_Repository_Iterator::~ACE_Service_Repository_Iterator (void)
{
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Service_Templates.h b/dep/ACE_wrappers/ace/Service_Templates.h
index 722713efcbb..34ab6a10eda 100644
--- a/dep/ACE_wrappers/ace/Service_Templates.h
+++ b/dep/ACE_wrappers/ace/Service_Templates.h
@@ -9,17 +9,22 @@
*/
//=============================================================================
+
#ifndef ACE_SERVICE_TEMPLATES_H
#define ACE_SERVICE_TEMPLATES_H
#include /**/ "ace/pre.h"
+
#include "ace/Svc_Conf.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Auto_Ptr.h"
#include "ace/Thread_Manager.h"
#include "ace/Stream_Modules.h"
#include "ace/Stream.h"
+
#include /**/ "ace/post.h"
#endif /* ACE_SERVICE_TEMPLATES_H */
diff --git a/dep/ACE_wrappers/ace/Service_Types.cpp b/dep/ACE_wrappers/ace/Service_Types.cpp
index 3048c925542..5eb8765337e 100644
--- a/dep/ACE_wrappers/ace/Service_Types.cpp
+++ b/dep/ACE_wrappers/ace/Service_Types.cpp
@@ -1,21 +1,29 @@
// $Id: Service_Types.cpp 81826 2008-06-02 15:29:53Z schmidt $
+
#include "ace/Service_Types.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Service_Types.inl"
#endif /* __ACE_INLINE__ */
+
#include "ace/Stream_Modules.h"
#include "ace/Stream.h"
#include "ace/OS_NS_stdio.h"
#include "ace/OS_NS_string.h"
+
ACE_RCSID (ace,
Service_Types,
"$Id: Service_Types.cpp 81826 2008-06-02 15:29:53Z schmidt $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
typedef ACE_Stream<ACE_SYNCH> MT_Stream;
typedef ACE_Module<ACE_SYNCH> MT_Module;
typedef ACE_Task<ACE_SYNCH> MT_Task;
+
ACE_ALLOC_HOOK_DEFINE(ACE_Service_Type_Impl)
+
void
ACE_Service_Type_Impl::dump (void) const
{
@@ -23,6 +31,7 @@ ACE_Service_Type_Impl::dump (void) const
ACE_TRACE ("ACE_Service_Type_Impl::dump");
#endif /* ACE_HAS_DUMP */
}
+
ACE_Service_Type_Impl::ACE_Service_Type_Impl (void *so,
const ACE_TCHAR *s_name,
u_int f,
@@ -35,19 +44,24 @@ ACE_Service_Type_Impl::ACE_Service_Type_Impl (void *so,
ACE_TRACE ("ACE_Service_Type_Impl::ACE_Service_Type_Impl");
this->name (s_name);
}
+
ACE_Service_Type_Impl::~ACE_Service_Type_Impl (void)
{
ACE_TRACE ("ACE_Service_Type_Impl::~ACE_Service_Type_Impl");
+
// It's ok to call this, even though we may have already deleted it
// in the fini() method since it would then be NULL.
delete [] const_cast <ACE_TCHAR *> (this->name_);
}
+
int
ACE_Service_Type_Impl::fini (void) const
{
ACE_TRACE ("ACE_Service_Type_Impl::fini");
+
delete [] const_cast <ACE_TCHAR *> (this->name_);
(const_cast <ACE_Service_Type_Impl *> (this))->name_ = 0;
+
if (ACE_BIT_ENABLED (this->flags_,
ACE_Service_Type::DELETE_OBJ))
{
@@ -57,11 +71,14 @@ ACE_Service_Type_Impl::fini (void) const
// Cast to remove const-ness.
operator delete ((void *) this->object ());
}
+
if (ACE_BIT_ENABLED (this->flags_,
ACE_Service_Type::DELETE_THIS))
delete const_cast <ACE_Service_Type_Impl *> (this);
+
return 0;
}
+
ACE_Service_Object_Type::ACE_Service_Object_Type (void *so,
const ACE_TCHAR *s_name,
u_int f,
@@ -71,55 +88,72 @@ ACE_Service_Object_Type::ACE_Service_Object_Type (void *so,
{
ACE_TRACE ("ACE_Service_Object_Type::ACE_Service_Object_Type");
}
+
int
ACE_Service_Object_Type::init (int argc, ACE_TCHAR *argv[]) const
{
ACE_TRACE ("ACE_Service_Object_Type::init");
+
void * const obj = this->object ();
+
ACE_Service_Object * const so =
static_cast<ACE_Service_Object *> (obj);
+
if (so == 0)
return -1;
+
this->initialized_ = so->init (argc, argv);
+
return this->initialized_;
}
+
int
ACE_Service_Object_Type::fini (void) const
{
ACE_TRACE ("ACE_Service_Object_Type::fini");
+
void * const obj = this->object ();
+
ACE_Service_Object * const so =
static_cast<ACE_Service_Object *> (obj);
+
// Call fini() if an only if, the object was successfuly
// initialized, i.e. init() returned 0. This is necessary to
// maintain the ctor/dtor-like semantics for init/fini.
if (so != 0 && this->initialized_ == 0)
so->fini ();
+
return ACE_Service_Type_Impl::fini ();
}
+
ACE_Service_Object_Type::~ACE_Service_Object_Type (void)
{
ACE_TRACE ("ACE_Service_Object_Type::~ACE_Service_Object_Type");
}
+
int
ACE_Service_Object_Type::suspend (void) const
{
ACE_TRACE ("ACE_Service_Object_Type::suspend");
return static_cast<ACE_Service_Object *> (this->object ())->suspend ();
}
+
int
ACE_Service_Object_Type::resume (void) const
{
ACE_TRACE ("ACE_Service_Object_Type::resume");
return static_cast<ACE_Service_Object *> (this->object ())->resume ();
}
+
int
ACE_Service_Object_Type::info (ACE_TCHAR **str, size_t len) const
{
ACE_TRACE ("ACE_Service_Object_Type::info");
return static_cast<ACE_Service_Object *> (this->object ())->info (str, len);
}
+
ACE_ALLOC_HOOK_DEFINE(ACE_Module_Type)
+
void
ACE_Module_Type::dump (void) const
{
@@ -127,6 +161,7 @@ ACE_Module_Type::dump (void) const
ACE_TRACE ("ACE_Module_Type::dump");
#endif /* ACE_HAS_DUMP */
}
+
ACE_Module_Type::ACE_Module_Type (void *m,
const ACE_TCHAR *m_name,
u_int f)
@@ -134,10 +169,12 @@ ACE_Module_Type::ACE_Module_Type (void *m,
{
ACE_TRACE ("ACE_Module_Type::ACE_Module_Type");
}
+
ACE_Module_Type::~ACE_Module_Type (void)
{
ACE_TRACE ("ACE_Module_Type::~ACE_Module_Type");
}
+
int
ACE_Module_Type::init (int argc, ACE_TCHAR *argv[]) const
{
@@ -146,12 +183,14 @@ ACE_Module_Type::init (int argc, ACE_TCHAR *argv[]) const
MT_Module *mod = (MT_Module *) obj;
MT_Task *reader = mod->reader ();
MT_Task *writer = mod->writer ();
+
if (reader->init (argc, argv) == -1
|| writer->init (argc, argv) == -1)
return -1;
else
return 0;
}
+
int
ACE_Module_Type::suspend (void) const
{
@@ -160,12 +199,14 @@ ACE_Module_Type::suspend (void) const
MT_Module *mod = (MT_Module *) obj;
MT_Task *reader = mod->reader ();
MT_Task *writer = mod->writer ();
+
if (reader->suspend () == -1
|| writer->suspend () == -1)
return -1;
else
return 0;
}
+
int
ACE_Module_Type::resume (void) const
{
@@ -174,58 +215,72 @@ ACE_Module_Type::resume (void) const
MT_Module *mod = (MT_Module *) obj;
MT_Task *reader = mod->reader ();
MT_Task *writer = mod->writer ();
+
if (reader->resume () == -1
|| writer->resume () == -1)
return -1;
else
return 0;
}
+
// Note, these operations are somewhat too familiar with the
// implementation of ACE_Module and ACE_Module::close...
+
int
ACE_Module_Type::fini (void) const
{
ACE_TRACE ("ACE_Module_Type::fini");
+
void *obj = this->object ();
MT_Module *mod = (MT_Module *) obj;
MT_Task *reader = mod->reader ();
MT_Task *writer = mod->writer ();
+
if (reader != 0)
reader->fini ();
+
if (writer != 0)
writer->fini ();
+
// Close the module and delete the memory.
mod->close (MT_Module::M_DELETE);
return ACE_Service_Type_Impl::fini ();
}
+
int
ACE_Module_Type::info (ACE_TCHAR **str, size_t len) const
{
ACE_TRACE ("ACE_Module_Type::info");
ACE_TCHAR buf[BUFSIZ];
+
ACE_OS::sprintf (buf,
ACE_TEXT ("%s\t %s"),
this->name (),
ACE_TEXT ("# ACE_Module\n"));
+
if (*str == 0 && (*str = ACE_OS::strdup (buf)) == 0)
return -1;
else
ACE_OS::strsncpy (*str, buf, len);
return static_cast<int> (ACE_OS::strlen (buf));
}
+
void
ACE_Module_Type::link (ACE_Module_Type *n)
{
ACE_TRACE ("ACE_Module_Type::link");
this->link_ = n;
}
+
ACE_Module_Type *
ACE_Module_Type::link (void) const
{
ACE_TRACE ("ACE_Module_Type::link");
return this->link_;
}
+
ACE_ALLOC_HOOK_DEFINE(ACE_Stream_Type)
+
void
ACE_Stream_Type::dump (void) const
{
@@ -233,32 +288,40 @@ ACE_Stream_Type::dump (void) const
ACE_TRACE ("ACE_Stream_Type::dump");
#endif /* ACE_HAS_DUMP */
}
+
int
ACE_Stream_Type::init (int, ACE_TCHAR *[]) const
{
ACE_TRACE ("ACE_Stream_Type::init");
return 0;
}
+
int
ACE_Stream_Type::suspend (void) const
{
ACE_TRACE ("ACE_Stream_Type::suspend");
+
for (ACE_Module_Type *m = this->head_;
m != 0;
m = m->link ())
m->suspend ();
+
return 0;
}
+
int
ACE_Stream_Type::resume (void) const
{
ACE_TRACE ("ACE_Stream_Type::resume");
+
for (ACE_Module_Type *m = this->head_;
m != 0;
m = m->link ())
m->resume ();
+
return 0;
}
+
ACE_Stream_Type::ACE_Stream_Type (void *s,
const ACE_TCHAR *s_name,
u_int f)
@@ -267,100 +330,125 @@ ACE_Stream_Type::ACE_Stream_Type (void *s,
{
ACE_TRACE ("ACE_Stream_Type::ACE_Stream_Type");
}
+
ACE_Stream_Type::~ACE_Stream_Type (void)
{
ACE_TRACE ("ACE_Stream_Type::~ACE_Stream_Type");
}
+
int
ACE_Stream_Type::info (ACE_TCHAR **str, size_t len) const
{
ACE_TRACE ("ACE_Stream_Type::info");
ACE_TCHAR buf[BUFSIZ];
+
ACE_OS::sprintf (buf,
ACE_TEXT ("%s\t %s"),
this->name (),
ACE_TEXT ("# STREAM\n"));
+
if (*str == 0 && (*str = ACE_OS::strdup (buf)) == 0)
return -1;
else
ACE_OS::strsncpy (*str, buf, len);
return static_cast<int> (ACE_OS::strlen (buf));
}
+
int
ACE_Stream_Type::fini (void) const
{
ACE_TRACE ("ACE_Stream_Type::fini");
void *obj = this->object ();
MT_Stream *str = (MT_Stream *) obj;
+
for (ACE_Module_Type *m = this->head_; m != 0; )
{
ACE_Module_Type *t = m->link ();
+
// Final arg is an indication to *not* delete the Module.
str->remove (m->name (),
MT_Module::M_DELETE_NONE);
+
// Finalize the Module (this may delete it, but we don't really
// care since we don't access it again).
m->fini ();
m = t;
}
str->close ();
+
return ACE_Service_Type_Impl::fini ();
}
+
// Locate and remove <mod_name> from the ACE_Stream.
+
int
ACE_Stream_Type::remove (ACE_Module_Type *mod)
{
ACE_TRACE ("ACE_Stream_Type::remove");
+
ACE_Module_Type *prev = 0;
void *obj = this->object ();
MT_Stream *str = (MT_Stream *) obj;
int result = 0;
+
for (ACE_Module_Type *m = this->head_; m != 0; )
{
// We need to do this first so we don't bomb out if we delete m!
ACE_Module_Type *link = m->link ();
+
if (m == mod)
{
if (prev == 0)
this->head_ = link;
else
prev->link (link);
+
// Final arg is an indication to *not* delete the Module.
if (str->remove (m->name (),
MT_Module::M_DELETE_NONE) == -1)
result = -1;
+
// This call may end up deleting m, which is ok since we
// don't access it again!
m->fini ();
}
else
prev = m;
+
m = link;
}
+
return result;
}
+
int
ACE_Stream_Type::push (ACE_Module_Type *new_module)
{
ACE_TRACE ("ACE_Stream_Type::push");
void *obj = this->object ();
MT_Stream *str = (MT_Stream *) obj;
+
new_module->link (this->head_);
this->head_ = new_module;
obj = new_module->object ();
return str->push ((MT_Module *) obj);
}
+
ACE_Module_Type *
ACE_Stream_Type::find (const ACE_TCHAR *mod_name) const
{
ACE_TRACE ("ACE_Stream_Type::find");
+
for (ACE_Module_Type *m = this->head_;
m != 0;
m = m->link ())
if (ACE_OS::strcmp (m->name (), mod_name) == 0)
return m;
+
return 0;
}
+
// @@@ Eliminated ommented out explicit template instantiation code
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Service_Types.h b/dep/ACE_wrappers/ace/Service_Types.h
index b0eb8b34ae0..e7ab9874ac2 100644
--- a/dep/ACE_wrappers/ace/Service_Types.h
+++ b/dep/ACE_wrappers/ace/Service_Types.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file Service_Types.h
@@ -8,14 +9,20 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//==========================================================================
+
#ifndef ACE_SERVICE_TYPE_H
#define ACE_SERVICE_TYPE_H
+
#include /**/ "ace/pre.h"
+
#include "ace/Service_Object.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Service_Type_Impl
*
@@ -38,33 +45,44 @@ public:
u_int flags = 0,
ACE_Service_Object_Exterminator gobbler = 0);
virtual ~ACE_Service_Type_Impl (void);
+
// = Pure virtual interface (must be defined by the subclass).
virtual int suspend (void) const = 0;
virtual int resume (void) const = 0;
virtual int init (int argc, ACE_TCHAR *argv[]) const = 0;
virtual int fini (void) const;
virtual int info (ACE_TCHAR **str, size_t len) const = 0;
+
/// The pointer to the service.
void *object (void) const;
+
/// Get the name of the service.
const ACE_TCHAR *name (void) const;
+
/// Set the name of the service.
void name (const ACE_TCHAR *);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
/// Name of the service.
const ACE_TCHAR *name_;
+
/// Pointer to object that implements the service. This actually
/// points to an ACE_Service_Object, ACE_Module, or ACE_Stream.
void *obj_;
+
/// Destroy function to deallocate obj_.
ACE_Service_Object_Exterminator gobbler_;
+
/// Flags that control serivce behavior (particularly deletion).
u_int flags_;
};
+
/**
* @class ACE_Service_Object_Type
*
@@ -79,17 +97,21 @@ public:
const ACE_TCHAR *name,
u_int flags = 0,
ACE_Service_Object_Exterminator gobbler = 0);
+
~ACE_Service_Object_Type (void);
+
// = Implement the hooks for <ACE_Service_Objects>.
virtual int suspend (void) const;
virtual int resume (void) const;
virtual int init (int argc, ACE_TCHAR *argv[]) const;
virtual int fini (void) const;
virtual int info (ACE_TCHAR **str, size_t len) const;
+
private:
/// Holds the initialization status (result of object->init())
mutable int initialized_;
};
+
/**
* @class ACE_Module_Type
*
@@ -103,25 +125,33 @@ public:
ACE_Module_Type (void *m, // Really an ACE_Module *.
const ACE_TCHAR *identifier,
u_int flags = 0);
+
~ACE_Module_Type (void);
+
// = Implement the hooks for <ACE_Modules>.
virtual int suspend (void) const;
virtual int resume (void) const;
virtual int init (int argc, ACE_TCHAR *argv[]) const;
virtual int fini (void) const;
virtual int info (ACE_TCHAR **str, size_t len) const;
+
/// Get the link pointer.
ACE_Module_Type *link (void) const;
+
/// Set the link pointer.
void link (ACE_Module_Type *);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Pointer to the next ACE_Module_Type in an ACE_Stream_Type.
ACE_Module_Type *link_;
};
+
/**
* @class ACE_Stream_Type
*
@@ -135,31 +165,43 @@ public:
ACE_Stream_Type (void *s, // Really an ACE_Stream *.
const ACE_TCHAR *identifier,
u_int flags = 0);
+
~ACE_Stream_Type (void);
+
// = Implement the hooks for <ACE_Streams>.
virtual int suspend (void) const;
virtual int resume (void) const;
virtual int init (int argc, ACE_TCHAR *argv[]) const;
virtual int fini (void) const;
virtual int info (ACE_TCHAR **str, size_t len) const;
+
/// Add a new ACE_Module to the top of the ACE_Stream.
int push (ACE_Module_Type *new_module);
+
/// Search for @a module and remove it from the ACE_Stream.
int remove (ACE_Module_Type *module);
+
/// Locate the ACE_Module with @a mod_name.
ACE_Module_Type *find (const ACE_TCHAR *mod_name) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Pointer to the head of the ACE_Module list.
ACE_Module_Type *head_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Service_Types.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
+
#endif /* _SERVICE_TYPE_H */
diff --git a/dep/ACE_wrappers/ace/Service_Types.inl b/dep/ACE_wrappers/ace/Service_Types.inl
index 7819e7bb916..f7f93591562 100644
--- a/dep/ACE_wrappers/ace/Service_Types.inl
+++ b/dep/ACE_wrappers/ace/Service_Types.inl
@@ -1,25 +1,32 @@
// -*- C++ -*-
//
// $Id: Service_Types.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/ACE.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE void *
ACE_Service_Type_Impl::object (void) const
{
ACE_TRACE ("ACE_Service_Type_Impl::object");
return this->obj_;
}
+
ACE_INLINE const ACE_TCHAR *
ACE_Service_Type_Impl::name (void) const
{
ACE_TRACE ("ACE_Service_Type_Impl::name");
return this->name_;
}
+
ACE_INLINE void
ACE_Service_Type_Impl::name (const ACE_TCHAR *n)
{
ACE_TRACE ("ACE_Service_Type_Impl::name");
+
ACE::strdelete (const_cast<ACE_TCHAR*> (this->name_));
this->name_ = ACE::strnew (n);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Shared_Memory.cpp b/dep/ACE_wrappers/ace/Shared_Memory.cpp
index 8d6c6f7356c..6b3d4fa8792 100644
--- a/dep/ACE_wrappers/ace/Shared_Memory.cpp
+++ b/dep/ACE_wrappers/ace/Shared_Memory.cpp
@@ -1,9 +1,14 @@
// $Id: Shared_Memory.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Shared_Memory.h"
+
ACE_RCSID(ace, Shared_Memory, "$Id: Shared_Memory.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_Shared_Memory::~ACE_Shared_Memory (void)
{
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Shared_Memory.h b/dep/ACE_wrappers/ace/Shared_Memory.h
index 9dfc18918b8..cda765b4d4d 100644
--- a/dep/ACE_wrappers/ace/Shared_Memory.h
+++ b/dep/ACE_wrappers/ace/Shared_Memory.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file Shared_Memory.h
@@ -9,15 +10,22 @@
*/
//==========================================================================
+
#ifndef ACE_SHARED_MEMORY_H
#define ACE_SHARED_MEMORY_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#include "ace/os_include/os_stddef.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Shared_Memory
*
@@ -33,6 +41,7 @@ class ACE_Export ACE_Shared_Memory
{
public:
virtual ~ACE_Shared_Memory (void);
+
// = Note that all the following methods are pure virtual.
virtual int close (void) = 0;
virtual int remove (void) = 0;
@@ -41,7 +50,10 @@ public:
virtual size_t get_segment_size (void) const = 0;
virtual ACE_HANDLE get_id (void) const = 0;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
+
#endif /* ACE_SHARED_MEMORY_H */
diff --git a/dep/ACE_wrappers/ace/Shared_Memory_MM.cpp b/dep/ACE_wrappers/ace/Shared_Memory_MM.cpp
index 585a4c6301a..25ece407bc5 100644
--- a/dep/ACE_wrappers/ace/Shared_Memory_MM.cpp
+++ b/dep/ACE_wrappers/ace/Shared_Memory_MM.cpp
@@ -1,14 +1,20 @@
// $Id: Shared_Memory_MM.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Shared_Memory_MM.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Shared_Memory_MM.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID (ace,
Shared_Memory_MM,
"$Id: Shared_Memory_MM.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_Shared_Memory_MM)
+
void
ACE_Shared_Memory_MM::dump (void) const
{
@@ -16,7 +22,9 @@ ACE_Shared_Memory_MM::dump (void) const
ACE_TRACE ("ACE_Shared_Memory_MM::dump");
#endif /* ACE_HAS_DUMP */
}
+
// Creates a shared memory segment of SIZE bytes.
+
ACE_Shared_Memory_MM::ACE_Shared_Memory_MM (ACE_HANDLE handle,
size_t length,
int prot,
@@ -27,6 +35,7 @@ ACE_Shared_Memory_MM::ACE_Shared_Memory_MM (ACE_HANDLE handle,
{
ACE_TRACE ("ACE_Shared_Memory_MM::ACE_Shared_Memory_MM");
}
+
ACE_Shared_Memory_MM::ACE_Shared_Memory_MM (const ACE_TCHAR *file_name,
size_t len,
int flags,
@@ -40,12 +49,16 @@ ACE_Shared_Memory_MM::ACE_Shared_Memory_MM (const ACE_TCHAR *file_name,
{
ACE_TRACE ("ACE_Shared_Memory_MM::ACE_Shared_Memory_MM");
}
+
// The "do-nothing" constructor.
+
ACE_Shared_Memory_MM::ACE_Shared_Memory_MM (void)
{
ACE_TRACE ("ACE_Shared_Memory_MM::ACE_Shared_Memory_MM");
}
+
// The overall size of the segment.
+
size_t
ACE_Shared_Memory_MM::get_segment_size (void) const
{
@@ -53,38 +66,47 @@ ACE_Shared_Memory_MM::get_segment_size (void) const
// This cast is legit since the original length in open() is an int.
return this->shared_memory_.size ();
}
+
// Unmaps the shared memory segment.
+
int
ACE_Shared_Memory_MM::remove (void)
{
ACE_TRACE ("ACE_Shared_Memory_MM::remove");
return shared_memory_.remove ();
}
+
// Closes (unmaps) the shared memory segment.
+
int
ACE_Shared_Memory_MM::close (void)
{
ACE_TRACE ("ACE_Shared_Memory_MM::close");
return shared_memory_.unmap ();
}
+
void *
ACE_Shared_Memory_MM::malloc (size_t)
{
ACE_TRACE ("ACE_Shared_Memory_MM::malloc");
void *addr = 0;
+
return this->shared_memory_ (addr) == -1 ? 0 : addr;
}
+
ACE_HANDLE
ACE_Shared_Memory_MM::get_id (void) const
{
ACE_TRACE ("ACE_Shared_Memory_MM::get_id");
return this->shared_memory_.handle ();
}
+
int
ACE_Shared_Memory_MM::free (void *p)
{
ACE_TRACE ("ACE_Shared_Memory_MM::free");
return p != 0;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Shared_Memory_MM.h b/dep/ACE_wrappers/ace/Shared_Memory_MM.h
index f6d9af1145c..27dda8eff57 100644
--- a/dep/ACE_wrappers/ace/Shared_Memory_MM.h
+++ b/dep/ACE_wrappers/ace/Shared_Memory_MM.h
@@ -1,4 +1,5 @@
/* -*- C++ -*- */
+
//=============================================================================
/**
* @file Shared_Memory_MM.h
@@ -9,15 +10,21 @@
*/
//=============================================================================
+
#ifndef ACE_SHARED_MALLOC_MM_H
#define ACE_SHARED_MALLOC_MM_H
#include /**/ "ace/pre.h"
+
#include "ace/Shared_Memory.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Mem_Map.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Shared_Memory_MM
*
@@ -33,6 +40,7 @@ public:
// = Initialization and termination methods.
/// Default constructor.
ACE_Shared_Memory_MM (void);
+
/// Constructor.
ACE_Shared_Memory_MM (ACE_HANDLE handle,
size_t length = static_cast<size_t> (-1),
@@ -40,6 +48,7 @@ public:
int share = ACE_MAP_PRIVATE,
char *addr = 0,
ACE_OFF_T pos = 0);
+
/// Constructor.
ACE_Shared_Memory_MM (const ACE_TCHAR *file_name,
size_t length = static_cast<size_t> (-1),
@@ -48,6 +57,7 @@ public:
int prot = PROT_RDWR,
int share = ACE_MAP_SHARED,
char *addr = 0, ACE_OFF_T pos = 0);
+
/// Open method.
int open (ACE_HANDLE handle,
size_t length = static_cast<size_t> (-1),
@@ -55,6 +65,7 @@ public:
int share = ACE_MAP_PRIVATE,
char *addr = 0,
ACE_OFF_T pos = 0);
+
/// Open method.
int open (const ACE_TCHAR *file_name,
size_t length = static_cast<size_t> (-1),
@@ -64,34 +75,47 @@ public:
int share = ACE_MAP_SHARED,
char *addr = 0,
ACE_OFF_T pos = 0);
+
/// Return the name of file that is mapped (if any).
const ACE_TCHAR *filename (void) const;
+
/// Close down the shared memory segment.
virtual int close (void);
+
/// Remove the shared memory segment and the underlying file.
virtual int remove (void);
+
// = Allocation and deallocation methods.
/// Create a new chuck of memory containing @a size bytes.
virtual void *malloc (size_t size = 0);
+
/// Free a chuck of memory allocated by
/// <ACE_Shared_Memory_MM::malloc>.
virtual int free (void *p);
+
/// Return the size of the shared memory segment.
virtual size_t get_segment_size (void) const;
+
/// Return the ID of the shared memory segment (i.e., an ACE_HANDLE).
virtual ACE_HANDLE get_id (void) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// This version is implemented with memory-mapped files.
ACE_Mem_Map shared_memory_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Shared_Memory_MM.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_SHARED_MALLOC_MM_H */
diff --git a/dep/ACE_wrappers/ace/Shared_Memory_MM.inl b/dep/ACE_wrappers/ace/Shared_Memory_MM.inl
index 61b1c6d2eb4..6e1f4b76616 100644
--- a/dep/ACE_wrappers/ace/Shared_Memory_MM.inl
+++ b/dep/ACE_wrappers/ace/Shared_Memory_MM.inl
@@ -1,13 +1,17 @@
// -*- C++ -*-
//
// $Id: Shared_Memory_MM.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Return the name of file that is mapped (if any).
+
ACE_INLINE const ACE_TCHAR *
ACE_Shared_Memory_MM::filename (void) const
{
return this->shared_memory_.filename ();
}
+
ACE_INLINE int
ACE_Shared_Memory_MM::open (ACE_HANDLE handle,
size_t length,
@@ -19,6 +23,7 @@ ACE_Shared_Memory_MM::open (ACE_HANDLE handle,
ACE_TRACE ("ACE_Shared_Memory_MM::open");
return shared_memory_.map (handle, length, prot, share, addr, pos);
}
+
ACE_INLINE int
ACE_Shared_Memory_MM::open (const ACE_TCHAR *file_name,
size_t len,
@@ -33,4 +38,5 @@ ACE_Shared_Memory_MM::open (const ACE_TCHAR *file_name,
return shared_memory_.map (file_name, len, flags, mode,
prot, share, addr, pos);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Shared_Memory_Pool.cpp b/dep/ACE_wrappers/ace/Shared_Memory_Pool.cpp
index a90d6d491d9..6a67c9235f8 100644
--- a/dep/ACE_wrappers/ace/Shared_Memory_Pool.cpp
+++ b/dep/ACE_wrappers/ace/Shared_Memory_Pool.cpp
@@ -1,12 +1,18 @@
// $Id: Shared_Memory_Pool.cpp 80826 2008-03-04 14:51:23Z wotte $
+
// Shared_Memory_Pool.cpp
#include "ace/Shared_Memory_Pool.h"
#include "ace/OS_NS_sys_shm.h"
#include "ace/Log_Msg.h"
+
ACE_RCSID(ace, Shared_Memory_Pool, "$Id: Shared_Memory_Pool.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if !defined (ACE_LACKS_SYSV_SHMEM)
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_Shared_Memory_Pool)
+
ACE_Shared_Memory_Pool_Options::ACE_Shared_Memory_Pool_Options (
const char *base_addr,
size_t max_segments,
@@ -21,6 +27,7 @@ ACE_Shared_Memory_Pool_Options::ACE_Shared_Memory_Pool_Options (
{
ACE_TRACE ("ACE_Shared_Memory_Pool_Options::ACE_Shared_Memory_Pool_Options");
}
+
void
ACE_Shared_Memory_Pool::dump (void) const
{
@@ -28,6 +35,7 @@ ACE_Shared_Memory_Pool::dump (void) const
ACE_TRACE ("ACE_Shared_Memory_Pool::dump");
#endif /* ACE_HAS_DUMP */
}
+
int
ACE_Shared_Memory_Pool::in_use (ACE_OFF_T &offset,
size_t &counter)
@@ -35,6 +43,7 @@ ACE_Shared_Memory_Pool::in_use (ACE_OFF_T &offset,
offset = 0;
SHM_TABLE *st = reinterpret_cast<SHM_TABLE *> (this->base_addr_);
shmid_ds buf;
+
for (counter = 0;
counter < this->max_segments_ && st[counter].used_ == 1;
counter++)
@@ -47,8 +56,10 @@ ACE_Shared_Memory_Pool::in_use (ACE_OFF_T &offset,
offset += buf.shm_segsz;
// ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) segment size = %d, offset = %d\n"), buf.shm_segsz, offset));
}
+
return 0;
}
+
int
ACE_Shared_Memory_Pool::find_seg (const void* const searchPtr,
ACE_OFF_T &offset,
@@ -57,6 +68,7 @@ ACE_Shared_Memory_Pool::find_seg (const void* const searchPtr,
offset = 0;
SHM_TABLE *st = reinterpret_cast<SHM_TABLE *> (this->base_addr_);
shmid_ds buf;
+
for (counter = 0;
counter < this->max_segments_
&& st[counter].used_ == 1;
@@ -68,6 +80,7 @@ ACE_Shared_Memory_Pool::find_seg (const void* const searchPtr,
ACE_TEXT ("shmctl")),
-1);
offset += buf.shm_segsz;
+
// If segment 'counter' starts at a location greater than the
// place we are searching for. We then decrement the offset to
// the start of counter-1. (flabar@vais.net)
@@ -79,17 +92,22 @@ ACE_Shared_Memory_Pool::find_seg (const void* const searchPtr,
}
// ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) segment size = %d, offset = %d\n"), buf.shm_segsz, offset));
}
+
return 0;
}
+
int
ACE_Shared_Memory_Pool::commit_backing_store_name (size_t rounded_bytes,
ACE_OFF_T &offset)
{
ACE_TRACE ("ACE_Shared_Memory_Pool::commit_backing_store_name");
+
size_t counter;
SHM_TABLE *st = reinterpret_cast<SHM_TABLE *> (this->base_addr_);
+
if (this->in_use (offset, counter) == -1)
return -1;
+
if (counter == this->max_segments_)
ACE_ERROR_RETURN ((LM_ERROR,
"exceeded max number of segments = %d, base = %u, offset = %u\n",
@@ -109,10 +127,12 @@ ACE_Shared_Memory_Pool::commit_backing_store_name (size_t rounded_bytes,
-1);
st[counter].shmid_ = shmid;
st[counter].used_ = 1;
+
void *address = (void *) (((char *) this->base_addr_) + offset);
void *shmem = ACE_OS::shmat (st[counter].shmid_,
(char *) address,
0);
+
if (shmem != address)
ACE_ERROR_RETURN ((LM_ERROR,
"(%P|%t) %p, shmem = %u, address = %u\n",
@@ -123,12 +143,15 @@ ACE_Shared_Memory_Pool::commit_backing_store_name (size_t rounded_bytes,
}
return 0;
}
+
// Handle SIGSEGV and SIGBUS signals to remap shared memory properly.
+
int
ACE_Shared_Memory_Pool::handle_signal (int , siginfo_t *siginfo, ucontext_t *)
{
ACE_TRACE ("ACE_Shared_Memory_Pool::handle_signal");
// ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("signal %S occurred\n"), signum));
+
// While FreeBSD 5.X has a siginfo_t struct with a si_addr field,
// it does not define SEGV_MAPERR.
#if defined (ACE_HAS_SIGINFO_T) && !defined (ACE_LACKS_SI_ADDR) && \
@@ -136,6 +159,7 @@ ACE_Shared_Memory_Pool::handle_signal (int , siginfo_t *siginfo, ucontext_t *)
ACE_OFF_T offset;
// Make sure that the pointer causing the problem is within the
// range of the backing store.
+
if (siginfo != 0)
{
// ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) si_signo = %d, si_code = %d, addr = %u\n"), siginfo->si_signo, siginfo->si_code, siginfo->si_addr));
@@ -162,11 +186,14 @@ ACE_Shared_Memory_Pool::handle_signal (int , siginfo_t *siginfo, ucontext_t *)
-1);
#endif /* ! _UNICOS */
}
+
// The above if case will check to see that the address is in the
// proper range. Therefore there is a segment out there that the
// pointer wants to point into. Find the segment that someone else
// has used and attach to it (flabar@vais.net)
+
size_t counter; // ret value to get shmid from the st table.
+
#if !defined(_UNICOS)
if (this->find_seg (siginfo->si_addr, offset, counter) == -1)
#else /* ! _UNICOS */
@@ -176,9 +203,12 @@ ACE_Shared_Memory_Pool::handle_signal (int , siginfo_t *siginfo, ucontext_t *)
ACE_TEXT ("(%P|%t) %p\n"),
ACE_TEXT ("in_use")),
-1);
+
void *address = (void *) (((char *) this->base_addr_) + offset);
SHM_TABLE *st = reinterpret_cast<SHM_TABLE *> (this->base_addr_);
+
void *shmem = ACE_OS::shmat (st[counter].shmid_, (char *) address, 0);
+
if (shmem != address)
ACE_ERROR_RETURN ((LM_ERROR,
"(%P|%t) %p, shmem = %u, address = %u\n",
@@ -186,12 +216,15 @@ ACE_Shared_Memory_Pool::handle_signal (int , siginfo_t *siginfo, ucontext_t *)
shmem,
address),
-1);
+
// NOTE: this won't work if we dont have SIGINFO_T or SI_ADDR
#else
ACE_UNUSED_ARG (siginfo);
#endif /* ACE_HAS_SIGINFO_T && !defined (ACE_LACKS_SI_ADDR) */
+
return 0;
}
+
ACE_Shared_Memory_Pool::ACE_Shared_Memory_Pool (
const ACE_TCHAR *backing_store_name,
const OPTIONS *options)
@@ -202,6 +235,7 @@ ACE_Shared_Memory_Pool::ACE_Shared_Memory_Pool (
segment_size_ (ACE_DEFAULT_SEGMENT_SIZE)
{
ACE_TRACE ("ACE_Shared_Memory_Pool::ACE_Shared_Memory_Pool");
+
// Only change the defaults if <options> != 0.
if (options)
{
@@ -212,14 +246,17 @@ ACE_Shared_Memory_Pool::ACE_Shared_Memory_Pool (
this->minimum_bytes_ = options->minimum_bytes_;
this->segment_size_ = options->segment_size_;
}
+
if (backing_store_name)
{
// Convert the string into a number that is used as the segment
// key.
+
int segment_key;
int result = ::sscanf (ACE_TEXT_ALWAYS_CHAR (backing_store_name),
"%d",
&segment_key);
+
if (result == 0 || result == EOF)
// The conversion to a number failed so hash with crc32
// ACE::crc32 is also used in <SV_Semaphore_Simple>.
@@ -227,6 +264,7 @@ ACE_Shared_Memory_Pool::ACE_Shared_Memory_Pool (
(key_t) ACE::crc32 (ACE_TEXT_ALWAYS_CHAR (backing_store_name));
else
this->base_shm_key_ = segment_key;
+
if (this->base_shm_key_ == IPC_PRIVATE)
// Make sure that the segment can be shared between unrelated
// processes.
@@ -234,41 +272,55 @@ ACE_Shared_Memory_Pool::ACE_Shared_Memory_Pool (
}
else
this->base_shm_key_ = ACE_DEFAULT_SHM_KEY;
+
if (this->signal_handler_.register_handler (SIGSEGV, this) == -1)
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_Sig_Handler::register_handler")));
}
+
ACE_Shared_Memory_Pool::~ACE_Shared_Memory_Pool (void)
{
}
+
// Ask system for more shared memory.
+
void *
ACE_Shared_Memory_Pool::acquire (size_t nbytes,
size_t &rounded_bytes)
{
ACE_TRACE ("ACE_Shared_Memory_Pool::acquire");
+
rounded_bytes = this->round_up (nbytes);
+
// ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) acquiring more chunks, nbytes = %d, rounded_bytes = %d\n"), nbytes, rounded_bytes));
+
ACE_OFF_T offset;
+
if (this->commit_backing_store_name (rounded_bytes, offset) == -1)
return 0;
+
// ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) acquired more chunks, nbytes = %d, rounded_bytes = %d\n"), nbytes, rounded_bytes));
return ((char *) this->base_addr_) + offset;
}
+
// Ask system for initial chunk of shared memory.
+
void *
ACE_Shared_Memory_Pool::init_acquire (size_t nbytes,
size_t &rounded_bytes,
int &first_time)
{
ACE_TRACE ("ACE_Shared_Memory_Pool::init_acquire");
+
ACE_OFF_T shm_table_offset = ACE::round_to_pagesize (sizeof (SHM_TABLE));
rounded_bytes = this->round_up (nbytes > (size_t) this->minimum_bytes_
? nbytes
: (size_t) this->minimum_bytes_);
+
// Acquire the semaphore to serialize initialization and prevent
// race conditions.
+
int shmid = ACE_OS::shmget (this->base_shm_key_,
rounded_bytes + shm_table_offset,
this->file_perms_ | IPC_CREAT | IPC_EXCL);
@@ -280,12 +332,15 @@ ACE_Shared_Memory_Pool::init_acquire (size_t nbytes,
ACE_TEXT ("shmget")),
0);
first_time = 0;
+
shmid = ACE_OS::shmget (this->base_shm_key_, 0, 0);
+
if (shmid == -1)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("(%P|%t) %p\n"),
ACE_TEXT ("shmget")),
0);
+
// This implementation doesn't care if we don't get the key we
// want...
this->base_addr_ =
@@ -302,6 +357,7 @@ ACE_Shared_Memory_Pool::init_acquire (size_t nbytes,
else
{
first_time = 1;
+
// This implementation doesn't care if we don't get the key we
// want...
this->base_addr_ =
@@ -313,10 +369,13 @@ ACE_Shared_Memory_Pool::init_acquire (size_t nbytes,
"(%P|%t) %p, base_addr = %u\n",
"shmat",
this->base_addr_), 0);
+
SHM_TABLE *st = reinterpret_cast<SHM_TABLE *> (this->base_addr_);
st[0].key_ = this->base_shm_key_;
st[0].shmid_ = shmid;
+
st[0].used_ = 1;
+
for (size_t counter = 1; // Skip over the first entry...
counter < this->max_segments_;
counter++)
@@ -326,62 +385,78 @@ ACE_Shared_Memory_Pool::init_acquire (size_t nbytes,
st[counter].used_ = 0;
}
}
+
return (void *) (((char *) this->base_addr_) + shm_table_offset);
}
+
// Instruct the memory pool to release all of its resources.
+
int
ACE_Shared_Memory_Pool::release (int)
{
ACE_TRACE ("ACE_Shared_Memory_Pool::release");
+
int result = 0;
SHM_TABLE *st = reinterpret_cast<SHM_TABLE *> (this->base_addr_);
+
for (size_t counter = 0;
counter < this->max_segments_ && st[counter].used_ == 1;
counter++)
if (ACE_OS::shmctl (st[counter].shmid_, IPC_RMID, 0) == -1)
result = -1;
+
return result;
}
+
int
ACE_Shared_Memory_Pool::sync (ssize_t, int)
{
ACE_TRACE ("ACE_Shared_Memory_Pool::sync");
return 0;
}
+
int
ACE_Shared_Memory_Pool::sync (void *, size_t, int)
{
ACE_TRACE ("ACE_Shared_Memory_Pool::sync");
return 0;
}
+
int
ACE_Shared_Memory_Pool::protect (ssize_t, int)
{
ACE_TRACE ("ACE_Shared_Memory_Pool::protect");
return 0;
}
+
int
ACE_Shared_Memory_Pool::protect (void *, size_t, int)
{
ACE_TRACE ("ACE_Shared_Memory_Pool::protect");
return 0;
}
+
void *
ACE_Shared_Memory_Pool::base_addr (void) const
{
ACE_TRACE ("ACE_Shared_Memory_Pool::base_addr");
return this->base_addr_;
}
+
// Implement the algorithm for rounding up the request to an
// appropriate chunksize.
+
size_t
ACE_Shared_Memory_Pool::round_up (size_t nbytes)
{
ACE_TRACE ("ACE_Shared_Memory_Pool::round_up");
if (nbytes < this->segment_size_)
nbytes = this->segment_size_;
+
return ACE::round_to_pagesize (nbytes);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* !ACE_LACKS_SYSV_SHMEM */
diff --git a/dep/ACE_wrappers/ace/Shared_Memory_Pool.h b/dep/ACE_wrappers/ace/Shared_Memory_Pool.h
index 482a2ded809..ea1a5e7d3c6 100644
--- a/dep/ACE_wrappers/ace/Shared_Memory_Pool.h
+++ b/dep/ACE_wrappers/ace/Shared_Memory_Pool.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Shared_Memory_Pool.h
@@ -9,19 +10,27 @@
* @author Prashant Jain <pjain@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_SHARED_MEMORY_POOL_H
#define ACE_SHARED_MEMORY_POOL_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if !defined (ACE_LACKS_SYSV_SHMEM)
+
#include "ace/ACE.h"
#include "ace/Event_Handler.h"
#include "ace/Sig_Handler.h"
#include "ace/os_include/sys/os_mman.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Shared_Memory_Pool_Options
*
@@ -40,17 +49,23 @@ public:
size_t file_perms = ACE_DEFAULT_FILE_PERMS,
ACE_OFF_T minimum_bytes = 0,
size_t segment_size = ACE_DEFAULT_SEGMENT_SIZE);
+
/// Base address of the memory-mapped backing store.
const char *base_addr_;
+
/// Number of shared memory segments to allocate.
size_t max_segments_;
+
/// What the minimum bytes of the initial segment should be.
ACE_OFF_T minimum_bytes_;
+
/// File permissions to use when creating/opening a segment.
size_t file_perms_;
+
/// Shared memory segment size.
size_t segment_size_;
};
+
/**
* @class ACE_Shared_Memory_Pool
*
@@ -68,14 +83,18 @@ class ACE_Export ACE_Shared_Memory_Pool : public ACE_Event_Handler
{
public:
typedef ACE_Shared_Memory_Pool_Options OPTIONS;
+
/// Initialize the pool.
ACE_Shared_Memory_Pool (const ACE_TCHAR *backing_store_name = 0,
const OPTIONS *options = 0);
+
virtual ~ACE_Shared_Memory_Pool (void);
+
/// Ask system for initial chunk of local memory.
virtual void *init_acquire (size_t nbytes,
size_t &rounded_bytes,
int &first_time);
+
/**
* Acquire at least @a nbytes from the memory pool. @a rounded_byes is
* the actual number of bytes allocated. Also acquires an internal
@@ -84,33 +103,43 @@ public:
*/
virtual void *acquire (size_t nbytes,
size_t &rounded_bytes);
+
/// Instruct the memory pool to release all of its resources.
virtual int release (int destroy = 1);
+
/// Sync the memory region to the backing store starting at
/// @c this->base_addr_.
virtual int sync (ssize_t len = -1, int flags = MS_SYNC);
+
/// Sync the memory region to the backing store starting at @a addr.
virtual int sync (void *addr, size_t len, int flags = MS_SYNC);
+
/**
* Change the protection of the pages of the mapped region to @a prot
* starting at @c this->base_addr_ up to @a len bytes. If @a len == -1
* then change protection of all pages in the mapped region.
*/
virtual int protect (ssize_t len = -1, int prot = PROT_RDWR);
+
/// Change the protection of the pages of the mapped region to @a prot
/// starting at @a addr up to @a len bytes.
virtual int protect (void *addr, size_t len, int prot = PROT_RDWR);
+
/// Return the base address of this memory pool, 0 if base_addr
/// never changes.
virtual void *base_addr (void) const;
+
/// Dump the state of an object.
virtual void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
/// Implement the algorithm for rounding up the request to an
/// appropriate chunksize.
virtual size_t round_up (size_t nbytes);
+
/**
* Commits a new shared memory segment if necessary after an
* <acquire> or a signal. @a offset is set to the new offset into
@@ -118,16 +147,20 @@ protected:
*/
virtual int commit_backing_store_name (size_t rounded_bytes,
ACE_OFF_T &offset);
+
/// Keeps track of all the segments being used.
struct SHM_TABLE
{
/// Shared memory segment key.
key_t key_;
+
/// Shared memory segment internal id.
int shmid_;
+
/// Is the segment currently used.;
int used_;
};
+
/**
* Base address of the shared memory segment. If this has the value
* of 0 then the OS is free to select any address, otherwise this
@@ -135,31 +168,44 @@ protected:
* segment.
*/
void *base_addr_;
+
/// File permissions to use when creating/opening a segment.
size_t file_perms_;
+
/// Number of shared memory segments in the <SHM_TABLE> table.
size_t max_segments_;
+
/// What the minimim bytes of the initial segment should be.
ACE_OFF_T minimum_bytes_;
+
/// Shared memory segment size.
size_t segment_size_;
+
/// Base shared memory key for the segment.
key_t base_shm_key_;
+
/// Find the segment that contains the @a searchPtr
virtual int find_seg (const void *const searchPtr,
ACE_OFF_T &offset,
size_t &counter);
+
/// Determine how much memory is currently in use.
virtual int in_use (ACE_OFF_T &offset,
size_t &counter);
+
/// Handles SIGSEGV.
ACE_Sig_Handler signal_handler_;
+
/// Handle SIGSEGV and SIGBUS signals to remap shared memory
/// properly.
virtual int handle_signal (int signum, siginfo_t *, ucontext_t *);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* !ACE_LACKS_SYSV_SHMEM */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_SHARED_MEMORY_POOL_H */
diff --git a/dep/ACE_wrappers/ace/Shared_Memory_SV.cpp b/dep/ACE_wrappers/ace/Shared_Memory_SV.cpp
index fca14252e8f..9cad5d247e2 100644
--- a/dep/ACE_wrappers/ace/Shared_Memory_SV.cpp
+++ b/dep/ACE_wrappers/ace/Shared_Memory_SV.cpp
@@ -1,15 +1,21 @@
// $Id: Shared_Memory_SV.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Shared_Memory_SV.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Shared_Memory_SV.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID (ace,
Shared_Memory_SV,
"$Id: Shared_Memory_SV.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_Shared_Memory_SV)
+
void
ACE_Shared_Memory_SV::dump (void) const
{
@@ -17,6 +23,7 @@ ACE_Shared_Memory_SV::dump (void) const
ACE_TRACE ("ACE_Shared_Memory_SV::dump");
#endif /* ACE_HAS_DUMP */
}
+
ACE_Shared_Memory_SV::ACE_Shared_Memory_SV (key_t id,
size_t length,
int create,
@@ -27,7 +34,9 @@ ACE_Shared_Memory_SV::ACE_Shared_Memory_SV (key_t id,
{
ACE_TRACE ("ACE_Shared_Memory_SV::ACE_Shared_Memory_SV");
}
+
// The overall size of the segment.
+
size_t
ACE_Shared_Memory_SV::get_segment_size (void) const
{
@@ -36,37 +45,45 @@ ACE_Shared_Memory_SV::get_segment_size (void) const
// an 'int' size. Therefore, this case should not lose information.
return this->shared_memory_.get_segment_size ();
}
+
// Removes the shared memory segment.
+
int
ACE_Shared_Memory_SV::remove (void)
{
ACE_TRACE ("ACE_Shared_Memory_SV::remove");
return shared_memory_.remove ();
}
+
// Closes (detaches) the shared memory segment.
+
int
ACE_Shared_Memory_SV::close (void)
{
ACE_TRACE ("ACE_Shared_Memory_SV::close");
return shared_memory_.detach ();
}
+
void *
ACE_Shared_Memory_SV::malloc (size_t)
{
ACE_TRACE ("ACE_Shared_Memory_SV::malloc");
return this->shared_memory_.get_segment_ptr ();
}
+
ACE_HANDLE
ACE_Shared_Memory_SV::get_id (void) const
{
ACE_TRACE ("ACE_Shared_Memory_SV::get_id");
return this->shared_memory_.get_id ();
}
+
int
ACE_Shared_Memory_SV::free (void *p)
{
ACE_TRACE ("ACE_Shared_Memory_SV::free");
return p != 0;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Shared_Memory_SV.h b/dep/ACE_wrappers/ace/Shared_Memory_SV.h
index fb07bf2b0ea..ff0268cfda8 100644
--- a/dep/ACE_wrappers/ace/Shared_Memory_SV.h
+++ b/dep/ACE_wrappers/ace/Shared_Memory_SV.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Shared_Memory_SV.h
@@ -9,15 +10,21 @@
*/
//=============================================================================
+
#ifndef ACE_SHARED_MALLOC_SV_H
#define ACE_SHARED_MALLOC_SV_H
#include /**/ "ace/pre.h"
+
#include "ace/Shared_Memory.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/SV_Shared_Memory.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Shared_Memory_SV
*
@@ -35,6 +42,7 @@ public:
ACE_CREATE = IPC_CREAT,
ACE_OPEN = 0
};
+
// = Initialization and termination methods.
ACE_Shared_Memory_SV (void);
ACE_Shared_Memory_SV (key_t id,
@@ -43,39 +51,52 @@ public:
int perms = ACE_DEFAULT_FILE_PERMS,
void *addr = 0,
int flags = 0);
+
int open (key_t id,
size_t length,
int create = ACE_Shared_Memory_SV::ACE_OPEN,
int perms = ACE_DEFAULT_FILE_PERMS,
void *addr = 0,
int flags = 0);
+
/// Close down the shared memory segment.
virtual int close (void);
+
/// Remove the underlying shared memory segment.
virtual int remove (void);
+
// = Allocation and deallocation methods.
/// Create a new chuck of memory containing @a size bytes.
virtual void *malloc (size_t = 0);
+
/// Free a chuck of memory allocated by <ACE_Shared_Memory_SV::malloc>.
virtual int free (void *p);
+
/// Return the size of the shared memory segment.
virtual size_t get_segment_size (void) const;
+
/// Return the ID of the shared memory segment (i.e., a System V
/// shared memory internal id).
virtual ACE_HANDLE get_id (void) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// This version is implemented with System V shared memory
/// segments.
ACE_SV_Shared_Memory shared_memory_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Shared_Memory_SV.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_SHARED_MALLOC_SV_H */
diff --git a/dep/ACE_wrappers/ace/Shared_Memory_SV.inl b/dep/ACE_wrappers/ace/Shared_Memory_SV.inl
index e1a80b06472..1a586701cc3 100644
--- a/dep/ACE_wrappers/ace/Shared_Memory_SV.inl
+++ b/dep/ACE_wrappers/ace/Shared_Memory_SV.inl
@@ -1,8 +1,11 @@
// -*- C++ -*-
//
// $Id: Shared_Memory_SV.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Global_Macros.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE int
ACE_Shared_Memory_SV::open (key_t id,
size_t length,
@@ -15,10 +18,13 @@ ACE_Shared_Memory_SV::open (key_t id,
return shared_memory_.open_and_attach (id, length, create,
perms, addr, flags);
}
+
// The "do-nothing" constructor.
+
ACE_INLINE
ACE_Shared_Memory_SV::ACE_Shared_Memory_SV (void)
{
ACE_TRACE ("ACE_Shared_Memory_SV::ACE_Shared_Memory_SV");
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Shared_Object.cpp b/dep/ACE_wrappers/ace/Shared_Object.cpp
index 9d2b41d7f30..13b4ac72030 100644
--- a/dep/ACE_wrappers/ace/Shared_Object.cpp
+++ b/dep/ACE_wrappers/ace/Shared_Object.cpp
@@ -1,41 +1,55 @@
// $Id: Shared_Object.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Shared_Object.h"
#include "ace/Global_Macros.h"
#include "ace/config-all.h"
+
/* Provide the abstract base class used to access dynamic linking
facilities */
+
#if !defined (__ACE_INLINE__)
#include "ace/Shared_Object.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID (ace,
Shared_Object,
"$Id: Shared_Object.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Initializes object when dynamic linking occurs.
+
int
ACE_Shared_Object::init (int, ACE_TCHAR *[])
{
ACE_TRACE ("ACE_Shared_Object::init");
return 0;
}
+
// Terminates object when dynamic unlinking occurs.
+
int
ACE_Shared_Object::fini (void)
{
ACE_TRACE ("ACE_Shared_Object::fini");
return 0;
}
+
// Returns information on active object.
+
int
ACE_Shared_Object::info (ACE_TCHAR **, size_t) const
{
ACE_TRACE ("ACE_Shared_Object::info");
return 0;
}
+
// Need to give a default implementation.
+
ACE_Shared_Object::~ACE_Shared_Object (void)
{
ACE_TRACE ("ACE_Shared_Object::~ACE_Shared_Object");
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Shared_Object.h b/dep/ACE_wrappers/ace/Shared_Object.h
index d74384a2ec9..17f6dca54dd 100644
--- a/dep/ACE_wrappers/ace/Shared_Object.h
+++ b/dep/ACE_wrappers/ace/Shared_Object.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file Shared_Object.h
@@ -8,15 +9,22 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//==========================================================================
+
#ifndef ACE_SHARED_OBJECT_H
#define ACE_SHARED_OBJECT_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/sys/os_types.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Shared_Object
*
@@ -28,19 +36,28 @@ class ACE_Export ACE_Shared_Object
public:
/// Constructor
ACE_Shared_Object (void);
+
/// Destructor
virtual ~ACE_Shared_Object (void);
+
/// Initializes object when dynamic linking occurs.
virtual int init (int argc, ACE_TCHAR *argv[]);
+
/// Terminates object when dynamic unlinking occurs.
virtual int fini (void);
+
/// Returns information on a service object.
virtual int info (ACE_TCHAR **info_string, size_t length = 0) const;
+
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Shared_Object.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_SHARED_OBJECT_H */
diff --git a/dep/ACE_wrappers/ace/Shared_Object.inl b/dep/ACE_wrappers/ace/Shared_Object.inl
index 32a9bfbd689..4f5f0020604 100644
--- a/dep/ACE_wrappers/ace/Shared_Object.inl
+++ b/dep/ACE_wrappers/ace/Shared_Object.inl
@@ -1,9 +1,12 @@
// -*- C++ -*-
//
// $Id: Shared_Object.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_Shared_Object::ACE_Shared_Object (void)
{
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Sig_Adapter.cpp b/dep/ACE_wrappers/ace/Sig_Adapter.cpp
index dad3fc334ef..78683d1c911 100644
--- a/dep/ACE_wrappers/ace/Sig_Adapter.cpp
+++ b/dep/ACE_wrappers/ace/Sig_Adapter.cpp
@@ -1,7 +1,10 @@
// $Id: Sig_Adapter.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Sig_Adapter.h"
+
ACE_RCSID(ace, Sig_Adapter, "$Id: Sig_Adapter.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_Sig_Adapter::ACE_Sig_Adapter (ACE_Sig_Action &sa, int sigkey)
: sigkey_ (sigkey),
type_ (SIG_ACTION),
@@ -9,6 +12,7 @@ ACE_Sig_Adapter::ACE_Sig_Adapter (ACE_Sig_Action &sa, int sigkey)
{
// ACE_TRACE ("ACE_Sig_Adapter::ACE_Sig_Adapter");
}
+
ACE_Sig_Adapter::ACE_Sig_Adapter (ACE_Event_Handler *eh,
int sigkey)
: sigkey_ (sigkey),
@@ -17,6 +21,7 @@ ACE_Sig_Adapter::ACE_Sig_Adapter (ACE_Event_Handler *eh,
{
// ACE_TRACE ("ACE_Sig_Adapter::ACE_Sig_Adapter");
}
+
ACE_Sig_Adapter::ACE_Sig_Adapter (ACE_Sig_Handler_Ex sig_func,
int sigkey)
: sigkey_ (sigkey),
@@ -25,32 +30,40 @@ ACE_Sig_Adapter::ACE_Sig_Adapter (ACE_Sig_Handler_Ex sig_func,
{
// ACE_TRACE ("ACE_Sig_Adapter::ACE_Sig_Adapter");
}
+
ACE_Sig_Adapter::~ACE_Sig_Adapter ()
{
}
+
int
ACE_Sig_Adapter::sigkey (void)
{
ACE_TRACE ("ACE_Sig_Adapter::sigkey");
return this->sigkey_;
}
+
int
ACE_Sig_Adapter::handle_signal (int signum,
siginfo_t *siginfo,
ucontext_t *ucontext)
{
ACE_TRACE ("ACE_Sig_Adapter::handle_signal");
+
switch (this->type_)
{
case SIG_ACTION:
{
// We have to dispatch a handler that was registered by a
// third-party library.
+
ACE_Sig_Action old_disp;
+
// Make sure this handler executes in the context it was
// expecting...
this->sa_.register_action (signum, &old_disp);
+
ACE_Sig_Handler_Ex sig_func = ACE_Sig_Handler_Ex (this->sa_.handler ());
+
(*sig_func) (signum, siginfo, ucontext);
// Restore the original disposition.
old_disp.register_action (signum);
diff --git a/dep/ACE_wrappers/ace/Sig_Adapter.h b/dep/ACE_wrappers/ace/Sig_Adapter.h
index c64b034f65e..f0013ede558 100644
--- a/dep/ACE_wrappers/ace/Sig_Adapter.h
+++ b/dep/ACE_wrappers/ace/Sig_Adapter.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Sig_Adapter.h
@@ -8,16 +9,23 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_SIG_ADAPTER_H
#define ACE_SIG_ADAPTER_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Event_Handler.h"
#include "ace/Signal.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Sig_Adapter
*
@@ -31,14 +39,18 @@ public:
ACE_Sig_Adapter (ACE_Event_Handler *, int sigkey);
ACE_Sig_Adapter (ACE_Sig_Handler_Ex, int sigkey = 0);
~ACE_Sig_Adapter (void);
+
/// Returns this signal key that's used to remove this from the
/// ACE_Reactor's internal table.
int sigkey (void);
+
/// Called by the <Reactor> to dispatch the signal handler.
virtual int handle_signal (int, siginfo_t *, ucontext_t *);
+
private:
/// Key for this signal handler (used to remove it).
int sigkey_;
+
/// Is this an external handler or an ACE handler?
enum
{
@@ -49,16 +61,22 @@ private:
/// A normal C function.
C_FUNCTION
} type_;
+
// = This should be a union, but C++ won't allow that because the
// <ACE_Sig_Action> has a constructor.
/// This is an external handler (ugh).
ACE_Sig_Action sa_;
+
/// This is an ACE hander.
ACE_Event_Handler *eh_;
+
/// This is a normal C function.
ACE_Sig_Handler_Ex sig_func_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
+
#endif /* ACE_SIG_ADAPTER_H */
diff --git a/dep/ACE_wrappers/ace/Sig_Handler.cpp b/dep/ACE_wrappers/ace/Sig_Handler.cpp
index 23cf915bc28..2829edcef94 100644
--- a/dep/ACE_wrappers/ace/Sig_Handler.cpp
+++ b/dep/ACE_wrappers/ace/Sig_Handler.cpp
@@ -1,4 +1,5 @@
// $Id: Sig_Handler.cpp 81388 2008-04-23 14:02:05Z johnnyw $
+
#include "ace/Sig_Handler.h"
#include "ace/Sig_Adapter.h"
#include "ace/Signal.h"
@@ -6,40 +7,55 @@
#include "ace/Managed_Object.h"
#include "ace/Containers.h"
#include "ace/Guard_T.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Sig_Handler.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace, Sig_Handler, "$Id: Sig_Handler.cpp 81388 2008-04-23 14:02:05Z johnnyw $")
+
#if defined (ACE_HAS_SIG_C_FUNC)
+
extern "C" void
ace_sig_handler_dispatch (int signum, siginfo_t *info, ucontext_t *context)
{
ACE_TRACE ("ace_sig_handler_dispatch");
ACE_Sig_Handler::dispatch (signum, info, context);
}
+
#define ace_signal_handler_dispatcher ACE_SignalHandler(ace_sig_handler_dispatch)
+
extern "C" void
ace_sig_handlers_dispatch (int signum, siginfo_t *info, ucontext_t *context)
{
ACE_TRACE ("ace_sig_handlers_dispatch");
ACE_Sig_Handlers::dispatch (signum, info, context);
}
+
#define ace_signal_handlers_dispatcher ACE_SignalHandler(ace_sig_handlers_dispatch)
+
#else
#define ace_signal_handler_dispatcher ACE_SignalHandler(ACE_Sig_Handler::dispatch)
+
#define ace_signal_handlers_dispatcher ACE_SignalHandler(ACE_Sig_Handlers::dispatch)
#endif /* ACE_HAS_SIG_C_FUNC */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Array of Event_Handlers that will handle the signals.
ACE_Event_Handler *ACE_Sig_Handler::signal_handlers_[ACE_NSIG];
+
// Remembers if a signal has occurred.
sig_atomic_t ACE_Sig_Handler::sig_pending_ = 0;
+
ACE_ALLOC_HOOK_DEFINE(ACE_Sig_Handler)
+
ACE_Sig_Handler::~ACE_Sig_Handler (void)
{
}
+
void
ACE_Sig_Handler::dump (void) const
{
@@ -47,6 +63,7 @@ ACE_Sig_Handler::dump (void) const
ACE_TRACE ("ACE_Sig_Handler::dump");
#endif /* ACE_HAS_DUMP */
}
+
int
ACE_Sig_Handler::sig_pending (void)
{
@@ -57,16 +74,19 @@ ACE_Sig_Handler::sig_pending (void)
ACE_Guard<ACE_Recursive_Thread_Mutex> m (*lock));
return ACE_Sig_Handler::sig_pending_ != 0;
}
+
void
ACE_Sig_Handler::sig_pending (int pending)
{
ACE_TRACE ("ACE_Sig_Handler::sig_pending");
+
ACE_MT (ACE_Recursive_Thread_Mutex *lock =
ACE_Managed_Object<ACE_Recursive_Thread_Mutex>::get_preallocated_object
(ACE_Object_Manager::ACE_SIG_HANDLER_LOCK);
ACE_Guard<ACE_Recursive_Thread_Mutex> m (*lock));
ACE_Sig_Handler::sig_pending_ = pending;
}
+
ACE_Event_Handler *
ACE_Sig_Handler::handler (int signum)
{
@@ -75,25 +95,30 @@ ACE_Sig_Handler::handler (int signum)
ACE_Managed_Object<ACE_Recursive_Thread_Mutex>::get_preallocated_object
(ACE_Object_Manager::ACE_SIG_HANDLER_LOCK);
ACE_Guard<ACE_Recursive_Thread_Mutex> m (*lock));
+
if (ACE_Sig_Handler::in_range (signum))
return ACE_Sig_Handler::signal_handlers_[signum];
else
return 0;
}
+
ACE_Event_Handler *
ACE_Sig_Handler::handler_i (int signum,
ACE_Event_Handler *new_sh)
{
ACE_TRACE ("ACE_Sig_Handler::handler_i");
+
if (ACE_Sig_Handler::in_range (signum))
{
ACE_Event_Handler *sh = ACE_Sig_Handler::signal_handlers_[signum];
+
ACE_Sig_Handler::signal_handlers_[signum] = new_sh;
return sh;
}
else
return 0;
}
+
ACE_Event_Handler *
ACE_Sig_Handler::handler (int signum,
ACE_Event_Handler *new_sh)
@@ -103,11 +128,14 @@ ACE_Sig_Handler::handler (int signum,
ACE_Managed_Object<ACE_Recursive_Thread_Mutex>::get_preallocated_object
(ACE_Object_Manager::ACE_SIG_HANDLER_LOCK);
ACE_Guard<ACE_Recursive_Thread_Mutex> m (*lock));
+
return ACE_Sig_Handler::handler_i (signum, new_sh);
}
+
// Register an ACE_Event_Handler along with the corresponding SIGNUM.
// This method does NOT acquire any locks, so it can be called from a
// signal handler.
+
int
ACE_Sig_Handler::register_handler_i (int signum,
ACE_Event_Handler *new_sh,
@@ -116,19 +144,23 @@ ACE_Sig_Handler::register_handler_i (int signum,
ACE_Sig_Action *old_disp)
{
ACE_TRACE ("ACE_Sig_Handler::register_handler_i");
+
if (ACE_Sig_Handler::in_range (signum))
{
ACE_Sig_Action sa; // Define a "null" action.
ACE_Event_Handler *sh = ACE_Sig_Handler::handler_i (signum,
new_sh);
+
// Return a pointer to the old <ACE_Sig_Handler> if the user
// asks for this.
if (old_sh != 0)
*old_sh = sh;
+
// Make sure that <new_disp> points to a valid location if the
// user doesn't care...
if (new_disp == 0)
new_disp = &sa;
+
new_disp->handler (ace_signal_handler_dispatcher);
#if !defined (ACE_HAS_LYNXOS_SIGNALS)
new_disp->flags (new_disp->flags () | SA_SIGINFO);
@@ -138,9 +170,11 @@ ACE_Sig_Handler::register_handler_i (int signum,
else
return -1;
}
+
// Register an ACE_Event_Handler along with the corresponding SIGNUM.
// This method acquires a lock, so it can't be called from a signal
// handler, e.g., <dispatch>.
+
int
ACE_Sig_Handler::register_handler (int signum,
ACE_Event_Handler *new_sh,
@@ -153,13 +187,16 @@ ACE_Sig_Handler::register_handler (int signum,
ACE_Managed_Object<ACE_Recursive_Thread_Mutex>::get_preallocated_object
(ACE_Object_Manager::ACE_SIG_HANDLER_LOCK);
ACE_Guard<ACE_Recursive_Thread_Mutex> m (*lock));
+
return ACE_Sig_Handler::register_handler_i (signum,
new_sh,
new_disp,
old_sh,
old_disp);
}
+
// Remove an ACE_Event_Handler.
+
int
ACE_Sig_Handler::remove_handler (int signum,
ACE_Sig_Action *new_disp,
@@ -171,43 +208,58 @@ ACE_Sig_Handler::remove_handler (int signum,
ACE_Managed_Object<ACE_Recursive_Thread_Mutex>::get_preallocated_object
(ACE_Object_Manager::ACE_SIG_HANDLER_LOCK);
ACE_Guard<ACE_Recursive_Thread_Mutex> m (*lock));
+
if (ACE_Sig_Handler::in_range (signum))
{
ACE_Sig_Action sa (SIG_DFL, (sigset_t *) 0); // Define the default disposition.
+
if (new_disp == 0)
new_disp = &sa;
+
ACE_Sig_Handler::signal_handlers_[signum] = 0;
+
// Register either the new disposition or restore the default.
return new_disp->register_action (signum, old_disp);
}
+
return -1;
}
+
// Master dispatcher function that gets called by a signal handler and
// dispatches one handler...
+
void
ACE_Sig_Handler::dispatch (int signum,
siginfo_t *siginfo,
ucontext_t *ucontext)
{
ACE_TRACE ("ACE_Sig_Handler::dispatch");
+
// Save/restore errno.
ACE_Errno_Guard error (errno);
+
// We can't use the <sig_pending> call here because that acquires
// the lock, which is non-portable...
ACE_Sig_Handler::sig_pending_ = 1;
+
// 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];
+
if (eh != 0)
{
if (eh->handle_signal (signum, siginfo, ucontext) == -1)
{
// Define the default disposition.
ACE_Sig_Action sa ((ACE_SignalHandler) SIG_DFL, (sigset_t *) 0);
+
ACE_Sig_Handler::signal_handlers_[signum] = 0;
+
// Remove the current disposition by registering the default
// disposition.
sa.register_action (signum);
+
// Allow the event handler to close down if necessary.
eh->handle_close (ACE_INVALID_HANDLE,
ACE_Event_Handler::SIGNAL_MASK);
@@ -224,30 +276,39 @@ ACE_Sig_Handler::dispatch (int signum,
#endif /* ACE_WIN32*/
}
}
+
// ----------------------------------------
// The following classes are local to this file.
+
// There are bugs with HP/UX's C++ compiler that prevents this stuff
// from compiling...
#define ACE_MAX_SIGNAL_HANDLERS ((size_t) 20)
+
// Keeps track of the id that uniquely identifies each registered
// signal handler. This id can be used to cancel a timer via the
// <remove_handler> method.
int ACE_Sig_Handlers::sigkey_ = 0;
+
// If this is true then a 3rd party library has registered a
// handler...
bool ACE_Sig_Handlers::third_party_sig_handler_ = false;
+
// Make life easier by defining typedefs...
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> 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_[ACE_NSIG];
};
+
/* static */
ACE_SIG_HANDLERS_SET *ACE_Sig_Handlers_Set::sig_handlers_[ACE_NSIG];
+
/* static */
ACE_SIG_HANDLERS_SET *
ACE_Sig_Handlers_Set::instance (int signum)
@@ -260,7 +321,9 @@ ACE_Sig_Handlers_Set::instance (int signum)
0);
return ACE_Sig_Handlers_Set::sig_handlers_[signum];
}
+
ACE_ALLOC_HOOK_DEFINE(ACE_Sig_Handlers)
+
void
ACE_Sig_Handlers::dump (void) const
{
@@ -268,8 +331,10 @@ ACE_Sig_Handlers::dump (void) const
ACE_TRACE ("ACE_Sig_Handlers::dump");
#endif /* ACE_HAS_DUMP */
}
+
// This is the method that does all the dirty work... The basic
// structure of this method was devised by Detlef Becker.
+
int
ACE_Sig_Handlers::register_handler (int signum,
ACE_Event_Handler *new_sh,
@@ -282,29 +347,37 @@ ACE_Sig_Handlers::register_handler (int signum,
ACE_Managed_Object<ACE_Recursive_Thread_Mutex>::get_preallocated_object
(ACE_Object_Manager::ACE_SIG_HANDLER_LOCK);
ACE_Guard<ACE_Recursive_Thread_Mutex> m (*lock));
+
if (ACE_Sig_Handler::in_range (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;
+
// Get current signal disposition.
sa.retrieve_action (signum);
+
// Check whether we are already in control of the signal
// handling disposition...
+
if (!(sa.handler () == ace_signal_handlers_dispatcher
|| sa.handler () == ACE_SignalHandler (SIG_IGN)
|| sa.handler () == ACE_SignalHandler (SIG_DFL)))
{
// Drat, a 3rd party library has already installed a signal ;-(
+
// Upto here we never disabled RESTART_MODE. Thus,
// RESTART_MODE can only be changed by 3rd party libraries.
+
if (ACE_BIT_DISABLED (sa.flags (), SA_RESTART)
&& ACE_Sig_Handlers::third_party_sig_handler_)
// Toggling is disallowed since we might break 3rd party
// code.
return -1;
+
// Note that we've seen a 3rd party handler...
ACE_Sig_Handlers::third_party_sig_handler_ = true;
+
// Create a new 3rd party disposition, remembering its
// preferred signal blocking etc...;
ACE_NEW_RETURN (extern_sh,
@@ -342,6 +415,7 @@ ACE_Sig_Handlers::register_handler (int signum,
// If ACE_Sig_Handlers::dispatch() was set we're done.
else if (sa.handler () == ace_signal_handlers_dispatcher)
return ace_sig_adapter->sigkey ();
+
// Otherwise, we need to register our handler function so that
// all signals will be dispatched through ACE.
else
@@ -350,10 +424,13 @@ ACE_Sig_Handlers::register_handler (int signum,
// user doesn't care...
if (new_disp == 0)
new_disp = &sa;
+
new_disp->handler (ace_signal_handlers_dispatcher);
+
// Default is to restart signal handlers.
new_disp->flags (new_disp->flags () | SA_RESTART);
new_disp->flags (new_disp->flags () | SA_SIGINFO);
+
// Finally install (possibly reinstall) the ACE signal
// handler disposition with the SA_RESTART mode enabled.
if (new_disp->register_action (signum, old_disp) == -1)
@@ -361,6 +438,7 @@ ACE_Sig_Handlers::register_handler (int signum,
// Yikes, lots of roll back at this point...
ACE_Sig_Handlers_Set::instance (signum)->remove (ace_sig_adapter);
delete ace_sig_adapter;
+
if (extern_sh)
{
ACE_Sig_Handlers_Set::instance (signum)->remove (extern_sh);
@@ -373,12 +451,15 @@ ACE_Sig_Handlers::register_handler (int signum,
return ace_sig_adapter->sigkey ();
}
}
+
return -1;
}
+
// Remove the ACE_Event_Handler currently associated with <signum>.
// Install the new disposition (if given) and return the previous
// disposition (if desired by the caller). Returns 0 on success and
// -1 if <signum> is invalid.
+
int
ACE_Sig_Handlers::remove_handler (int signum,
ACE_Sig_Action *new_disp,
@@ -390,35 +471,45 @@ ACE_Sig_Handlers::remove_handler (int signum,
ACE_Managed_Object<ACE_Recursive_Thread_Mutex>::get_preallocated_object
(ACE_Object_Manager::ACE_SIG_HANDLER_LOCK);
ACE_Guard<ACE_Recursive_Thread_Mutex> m (*lock));
+
if (ACE_Sig_Handler::in_range (signum))
{
ACE_SIG_HANDLERS_SET *handler_set =
ACE_Sig_Handlers_Set::instance (signum);
+
ACE_SIG_HANDLERS_ITERATOR handler_iterator (*handler_set);
+
// Iterate through the set of handlers for this signal.
+
for (ACE_Event_Handler **eh;
handler_iterator.next (eh) != 0;
handler_iterator.advance ())
{
// Type-safe downcast would be nice here...
ACE_Sig_Adapter *sh = (ACE_Sig_Adapter *) *eh;
+
// Remove the handler if (1) its key matches the key we've
// been told to remove or (2) if we've been told to remove
// *all* handlers (i.e., <sigkey> == -1).
+
if (sh->sigkey () == sigkey || sigkey == -1)
{
handler_set->remove (*eh);
delete *eh;
}
}
+
if (handler_set->size () == 0)
{
// If there are no more handlers left for a signal then
// register the new disposition or restore the default
// disposition.
+
ACE_Sig_Action sa (SIG_DFL, (sigset_t *) 0);
+
if (new_disp == 0)
new_disp = &sa;
+
return new_disp->register_action (signum, old_disp);
}
return 0;
@@ -426,8 +517,10 @@ ACE_Sig_Handlers::remove_handler (int signum,
else
return -1;
}
+
// Master dispatcher function that gets called by a signal handler and
// dispatches *all* the handlers...
+
void
ACE_Sig_Handlers::dispatch (int signum,
siginfo_t *siginfo,
@@ -442,14 +535,20 @@ ACE_Sig_Handlers::dispatch (int signum,
(ACE_Object_Manager::ACE_SIG_HANDLER_LOCK);
ACE_TSS_Guard<ACE_Recursive_Thread_Mutex> m (*lock));
#endif /* 0 */
+
// Save/restore errno.
ACE_Errno_Guard error (errno);
+
ACE_Sig_Handler::sig_pending_ = 1;
+
// Darn well better be in range since the OS dispatched this...
ACE_ASSERT (ACE_Sig_Handler::in_range (signum));
+
ACE_SIG_HANDLERS_SET *handler_set =
ACE_Sig_Handlers_Set::instance (signum);
+
ACE_SIG_HANDLERS_ITERATOR handler_iterator (*handler_set);
+
for (ACE_Event_Handler **eh = 0;
handler_iterator.next (eh) != 0;
handler_iterator.advance ())
@@ -461,9 +560,11 @@ ACE_Sig_Handlers::dispatch (int signum,
}
}
}
+
// Return the first item in the list of handlers. Note that this will
// trivially provide the same behavior as the ACE_Sig_Handler
// version if there is only 1 handler registered!
+
ACE_Event_Handler *
ACE_Sig_Handlers::handler (int signum)
{
@@ -475,11 +576,13 @@ ACE_Sig_Handlers::handler (int signum)
handler_iterator.next (eh);
return *eh;
}
+
// The following is a strange bit of logic that tries to give the same
// semantics as what happens in ACE_Sig_Handler when we replace the
// current signal handler with a new one. Note that if there is only
// one signal handler the behavior will be identical. If there is
// more than one handler then things get weird...
+
ACE_Event_Handler *
ACE_Sig_Handlers::handler (int signum, ACE_Event_Handler *new_sh)
{
@@ -488,14 +591,18 @@ ACE_Sig_Handlers::handler (int signum, ACE_Event_Handler *new_sh)
ACE_Sig_Handlers_Set::instance (signum);
ACE_SIG_HANDLERS_ITERATOR handler_iterator (*handler_set);
ACE_Event_Handler **eh = 0;
+
// Find the first handler...
handler_iterator.next (eh);
+
// ... then remove it from the set ...
handler_set->remove (*eh);
+
// ... and then insert the new signal handler into the beginning of
// the set (note, this is a bit too tied up in the implementation of
// ACE_Unbounded_Set...).
ACE_Sig_Adapter *temp = 0;
+
ACE_NEW_RETURN (temp,
ACE_Sig_Adapter (new_sh,
++ACE_Sig_Handlers::sigkey_),
@@ -503,5 +610,6 @@ ACE_Sig_Handlers::handler (int signum, ACE_Event_Handler *new_sh)
handler_set->insert (temp);
return *eh;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Sig_Handler.h b/dep/ACE_wrappers/ace/Sig_Handler.h
index fc6e76f7084..ea58980154e 100644
--- a/dep/ACE_wrappers/ace/Sig_Handler.h
+++ b/dep/ACE_wrappers/ace/Sig_Handler.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Sig_Handler.h
@@ -8,16 +9,23 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_SIGNAL_HANDLER_H
#define ACE_SIGNAL_HANDLER_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Event_Handler.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Sig_Action;
+
/**
* @class ACE_Sig_Handler
*
@@ -37,8 +45,10 @@ class ACE_Export ACE_Sig_Handler
public:
/// Default constructor.
ACE_Sig_Handler (void);
+
/// Destructor
virtual ~ACE_Sig_Handler (void);
+
// = Registration and removal methods.
/**
* Add a new ACE_Event_Handler and a new sigaction associated with
@@ -51,6 +61,7 @@ public:
ACE_Sig_Action *new_disp = 0,
ACE_Event_Handler **old_sh = 0,
ACE_Sig_Action *old_disp = 0);
+
/**
* Remove the ACE_Event_Handler currently associated with
* @a signum. @a sigkey is ignored in this implementation since there
@@ -63,17 +74,23 @@ public:
ACE_Sig_Action *new_disp = 0,
ACE_Sig_Action *old_disp = 0,
int sigkey = -1);
+
// Set/get signal status.
/// True if there is a pending signal.
static int sig_pending (void);
+
/// Reset the value of <sig_pending_> so that no signal is pending.
static void sig_pending (int);
+
// = Set/get the handler associated with a particular signal.
+
/// Return the ACE_Sig_Handler associated with @a signum.
virtual ACE_Event_Handler *handler (int signum);
+
/// Set a new ACE_Event_Handler that is associated with @a signum.
/// Return the existing handler.
virtual ACE_Event_Handler *handler (int signum, ACE_Event_Handler *);
+
/**
* Callback routine registered with sigaction(2) that dispatches the
* <handle_signal> method of the appropriate pre-registered
@@ -81,12 +98,16 @@ public:
*/
static void dispatch (int, siginfo_t *,
ucontext_t *);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
// = These methods and data members are shared by derived classes.
+
/**
* Set a new ACE_Event_Handler that is associated with @a signum.
* Return the existing handler. Does not acquire any locks so that
@@ -94,6 +115,7 @@ protected:
*/
static ACE_Event_Handler *handler_i (int signum,
ACE_Event_Handler *);
+
/**
* This implementation method is called by <register_handler> and
* @c dispatch. It doesn't do any locking so that it can be called
@@ -108,15 +130,19 @@ protected:
ACE_Sig_Action *new_disp = 0,
ACE_Event_Handler **old_sh = 0,
ACE_Sig_Action *old_disp = 0);
+
/// Check whether the SIGNUM is within the legal range of signals.
static int in_range (int signum);
+
/// Keeps track of whether a signal is pending.
static sig_atomic_t sig_pending_;
+
private:
/// Array used to store one user-defined Event_Handler for every
/// signal.
static ACE_Event_Handler *signal_handlers_[ACE_NSIG];
};
+
/**
* @class ACE_Sig_Handlers
*
@@ -146,6 +172,7 @@ public:
ACE_Sig_Action *new_disp = 0,
ACE_Event_Handler **old_sh = 0,
ACE_Sig_Action *old_disp = 0);
+
/**
* Remove an ACE_Event_Handler currently associated with @a signum.
* We remove the handler if (1) its sigkey> matches the @a sigkey
@@ -159,10 +186,13 @@ public:
ACE_Sig_Action *new_disp = 0,
ACE_Sig_Action *old_disp = 0,
int sigkey = -1);
+
// = Set/get the handler associated with a particular signal.
+
/// Return the head of the list of <ACE_Sig_Handler>s associated with
/// SIGNUM.
virtual ACE_Event_Handler *handler (int signum);
+
/**
* Set a new ACE_Event_Handler that is associated with SIGNUM at
* the head of the list of signals. Return the existing handler
@@ -170,16 +200,20 @@ public:
*/
virtual ACE_Event_Handler *handler (int signum,
ACE_Event_Handler *);
+
/**
* Callback routine registered with sigaction(2) that dispatches the
* <handle_signal> method of all the pre-registered
* ACE_Event_Handlers for @a signum
*/
static void dispatch (int signum, siginfo_t *, ucontext_t *);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/**
* Keeps track of the id that uniquely identifies each registered
@@ -187,14 +221,18 @@ private:
* <remove_handler> method.
*/
static int sigkey_;
+
/// If this is true then a 3rd party library has registered a
/// handler...
static bool third_party_sig_handler_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Sig_Handler.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_SIG_HANDLER_H */
diff --git a/dep/ACE_wrappers/ace/Sig_Handler.inl b/dep/ACE_wrappers/ace/Sig_Handler.inl
index ea466a0e1d0..de02c09ab16 100644
--- a/dep/ACE_wrappers/ace/Sig_Handler.inl
+++ b/dep/ACE_wrappers/ace/Sig_Handler.inl
@@ -1,10 +1,12 @@
// -*- C++ -*-
//
// $Id: Sig_Handler.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_INLINE
ACE_Sig_Handler::ACE_Sig_Handler (void)
{
}
+
ACE_INLINE int
ACE_Sig_Handler::in_range (int signum)
{
diff --git a/dep/ACE_wrappers/ace/Signal.cpp b/dep/ACE_wrappers/ace/Signal.cpp
index b1604dab174..8c9647ca55f 100644
--- a/dep/ACE_wrappers/ace/Signal.cpp
+++ b/dep/ACE_wrappers/ace/Signal.cpp
@@ -1,13 +1,19 @@
// $Id: Signal.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Signal.h"
// #include "ace/Log_Msg.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Signal.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace, Signal, "$Id: Signal.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_Sig_Action)
+
void
ACE_Sig_Action::dump (void) const
{
@@ -15,22 +21,28 @@ ACE_Sig_Action::dump (void) const
ACE_TRACE ("ACE_Sig_Action::dump");
#endif /* ACE_HAS_DUMP */
}
+
ACE_ALLOC_HOOK_DEFINE(ACE_Sig_Set)
+
ACE_Sig_Set::~ACE_Sig_Set (void)
{
ACE_TRACE ("ACE_Sig_Set::~ACE_Sig_Set");
ACE_OS::sigemptyset (&this->sigset_);
}
+
ACE_Sig_Action::~ACE_Sig_Action (void)
{
ACE_TRACE ("ACE_Sig_Action::~ACE_Sig_Action");
}
+
// Restore the signal mask.
+
ACE_Sig_Guard::~ACE_Sig_Guard (void)
{
//ACE_TRACE ("ACE_Sig_Guard::~ACE_Sig_Guard");
if (!this->condition_)
return;
+
#if !defined (ACE_LACKS_UNIX_SIGNALS)
#if defined (ACE_LACKS_PTHREAD_THR_SIGSETMASK)
ACE_OS::sigprocmask (SIG_SETMASK,
@@ -43,6 +55,7 @@ ACE_Sig_Guard::~ACE_Sig_Guard (void)
#endif /* ACE_LACKS_PTHREAD_THR_SIGSETMASK */
#endif /* !ACE_LACKS_UNIX_SIGNALS */
}
+
void
ACE_Sig_Set::dump (void) const
{
@@ -50,7 +63,9 @@ ACE_Sig_Set::dump (void) const
ACE_TRACE ("ACE_Sig_Set::dump");
#endif /* ACE_HAS_DUMP */
}
+
ACE_ALLOC_HOOK_DEFINE(ACE_Sig_Guard)
+
void
ACE_Sig_Guard::dump (void) const
{
@@ -58,10 +73,12 @@ ACE_Sig_Guard::dump (void) const
ACE_TRACE ("ACE_Sig_Guard::dump");
#endif /* ACE_HAS_DUMP */
}
+
ACE_Sig_Action::ACE_Sig_Action (void)
{
// ACE_TRACE ("ACE_Sig_Action::ACE_Sig_Action");
this->sa_.sa_flags = 0;
+
// Since Service_Config::signal_handler_ is static and has an
// ACE_Sig_Action instance, Win32 will get errno set unless this is
// commented out.
@@ -70,36 +87,43 @@ ACE_Sig_Action::ACE_Sig_Action (void)
#endif /* ACE_WIN32 */
this->sa_.sa_handler = 0;
}
+
ACE_Sig_Action::ACE_Sig_Action (ACE_SignalHandler sig_handler,
sigset_t *sig_mask,
int sig_flags)
{
// ACE_TRACE ("ACE_Sig_Action::ACE_Sig_Action");
this->sa_.sa_flags = sig_flags;
+
if (sig_mask == 0)
ACE_OS::sigemptyset (&this->sa_.sa_mask);
else
this->sa_.sa_mask = *sig_mask; // Structure assignment...
+
#if !defined(ACE_HAS_TANDEM_SIGNALS)
this->sa_.sa_handler = ACE_SignalHandlerV (sig_handler);
#else
this->sa_.sa_handler = (void (*)()) ACE_SignalHandlerV (sig_handler);
#endif /* !ACE_HAS_TANDEM_SIGNALS */
}
+
ACE_Sig_Action::ACE_Sig_Action (ACE_SignalHandler sig_handler,
const ACE_Sig_Set &sig_mask,
int sig_flags)
{
// ACE_TRACE ("ACE_Sig_Action::ACE_Sig_Action");
this->sa_.sa_flags = sig_flags;
+
// Structure assignment...
this->sa_.sa_mask = sig_mask.sigset ();
+
#if !defined(ACE_HAS_TANDEM_SIGNALS)
this->sa_.sa_handler = ACE_SignalHandlerV (sig_handler);
#else
this->sa_.sa_handler = (void (*)()) ACE_SignalHandlerV (sig_handler);
#endif /* !ACE_HAS_TANDEM_SIGNALS */
}
+
ACE_Sig_Action::ACE_Sig_Action (ACE_SignalHandler sig_handler,
int signum,
sigset_t *sig_mask,
@@ -107,10 +131,12 @@ ACE_Sig_Action::ACE_Sig_Action (ACE_SignalHandler sig_handler,
{
// ACE_TRACE ("ACE_Sig_Action::ACE_Sig_Action");
this->sa_.sa_flags = sig_flags;
+
if (sig_mask == 0)
ACE_OS::sigemptyset (&this->sa_.sa_mask);
else
this->sa_.sa_mask = *sig_mask; // Structure assignment...
+
#if !defined(ACE_HAS_TANDEM_SIGNALS)
this->sa_.sa_handler = ACE_SignalHandlerV (sig_handler);
#else
@@ -118,6 +144,7 @@ ACE_Sig_Action::ACE_Sig_Action (ACE_SignalHandler sig_handler,
#endif /* !ACE_HAS_TANDEM_SIGNALS */
ACE_OS::sigaction (signum, &this->sa_, 0);
}
+
ACE_Sig_Action::ACE_Sig_Action (ACE_SignalHandler sig_handler,
int signum,
const ACE_Sig_Set &sig_mask,
@@ -125,8 +152,10 @@ ACE_Sig_Action::ACE_Sig_Action (ACE_SignalHandler sig_handler,
{
// ACE_TRACE ("ACE_Sig_Action::ACE_Sig_Action");
this->sa_.sa_flags = sig_flags;
+
// Structure assignment...
this->sa_.sa_mask = sig_mask.sigset ();
+
#if !defined(ACE_HAS_TANDEM_SIGNALS)
this->sa_.sa_handler = ACE_SignalHandlerV (sig_handler);
#else
@@ -134,6 +163,7 @@ ACE_Sig_Action::ACE_Sig_Action (ACE_SignalHandler sig_handler,
#endif /* !ACE_HAS_TANDEM_SIGNALS */
ACE_OS::sigaction (signum, &this->sa_, 0);
}
+
ACE_Sig_Action::ACE_Sig_Action (const ACE_Sig_Set &signals,
ACE_SignalHandler sig_handler,
const ACE_Sig_Set &sig_mask,
@@ -141,13 +171,16 @@ ACE_Sig_Action::ACE_Sig_Action (const ACE_Sig_Set &signals,
{
// ACE_TRACE ("ACE_Sig_Action::ACE_Sig_Action");
this->sa_.sa_flags = sig_flags;
+
// Structure assignment...
this->sa_.sa_mask = sig_mask.sigset ();
+
#if !defined(ACE_HAS_TANDEM_SIGNALS)
this->sa_.sa_handler = ACE_SignalHandlerV (sig_handler);
#else
this->sa_.sa_handler = (void (*)()) ACE_SignalHandlerV (sig_handler);
#endif /* !ACE_HAS_TANDEM_SIGNALS */
+
#if (ACE_NSIG > 0)
for (int s = 1; s < ACE_NSIG; s++)
if ((signals.is_member (s)) == 1)
@@ -156,6 +189,7 @@ ACE_Sig_Action::ACE_Sig_Action (const ACE_Sig_Set &signals,
ACE_UNUSED_ARG (signals);
#endif /* ACE_NSIG <= 0 */
}
+
ACE_Sig_Action::ACE_Sig_Action (const ACE_Sig_Set &signals,
ACE_SignalHandler sig_handler,
sigset_t *sig_mask,
@@ -163,15 +197,18 @@ ACE_Sig_Action::ACE_Sig_Action (const ACE_Sig_Set &signals,
{
// ACE_TRACE ("ACE_Sig_Action::ACE_Sig_Action");
this->sa_.sa_flags = sig_flags;
+
if (sig_mask == 0)
ACE_OS::sigemptyset (&this->sa_.sa_mask);
else
this->sa_.sa_mask = *sig_mask; // Structure assignment...
+
#if !defined(ACE_HAS_TANDEM_SIGNALS)
this->sa_.sa_handler = ACE_SignalHandlerV (sig_handler);
#else
this->sa_.sa_handler = (void (*)()) ACE_SignalHandlerV (sig_handler);
#endif /* !ACE_HAS_TANDEM_SIGNALS */
+
#if (ACE_NSIG > 0)
for (int s = 1; s < ACE_NSIG; s++)
if ((signals.is_member (s)) == 1)
@@ -180,5 +217,6 @@ ACE_Sig_Action::ACE_Sig_Action (const ACE_Sig_Set &signals,
ACE_UNUSED_ARG (signals);
#endif /* ACE_NSIG <= 0 */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Signal.h b/dep/ACE_wrappers/ace/Signal.h
index 080d13ad3f8..7af918cc6e4 100644
--- a/dep/ACE_wrappers/ace/Signal.h
+++ b/dep/ACE_wrappers/ace/Signal.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Signal.h
@@ -8,21 +9,30 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_SIGNAL_H
#define ACE_SIGNAL_H
#include /**/ "ace/pre.h"
+
#include "ace/config-lite.h"
+
#if defined (ACE_DONT_INCLUDE_ACE_SIGNAL_H)
# error ace/Signal.h was #included instead of signal.h by ace/OS_NS_signal.h: fix!!!!
#endif /* ACE_DONT_INCLUDE_ACE_SIGNAL_H */
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/OS_NS_signal.h"
+
// Type of the extended signal handler.
typedef void (*ACE_Sig_Handler_Ex) (int, siginfo_t *siginfo, ucontext_t *ucontext);
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Sig_Set
*
@@ -39,35 +49,49 @@ public:
/// Initialize <sigset_> with @a sigset. If @a sigset == 0 then fill
/// the set.
ACE_Sig_Set (sigset_t *sigset);
+
/// Initialize <sigset_> with @a sigset. If @a sigset == 0 then fill
/// the set.
ACE_Sig_Set (ACE_Sig_Set *sigset);
+
/// If @a fill == 0 then initialize the <sigset_> to be empty, else
/// full.
ACE_Sig_Set (int fill = 0);
+
~ACE_Sig_Set (void);
+
/// Create a set that excludes all signals defined by the system.
int empty_set (void);
+
/// Create a set that includes all signals defined by the system.
int fill_set (void);
+
/// Adds the individual signal specified by @a signo to the set.
int sig_add (int signo);
+
/// Deletes the individual signal specified by @a signo from the set.
int sig_del (int signo);
+
/// Checks whether the signal specified by @a signo is in the set.
int is_member (int signo) const;
+
/// Returns a pointer to the underlying @c sigset_t.
operator sigset_t *();
+
/// Returns a copy of the underlying @c sigset_t.
sigset_t sigset (void) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Set of signals.
sigset_t sigset_;
};
+
/**
* @class ACE_Sig_Action
*
@@ -79,16 +103,19 @@ public:
// = Initialization methods.
/// Default constructor. Initializes everything to 0.
ACE_Sig_Action (void);
+
/// Assigns the various fields of a @c sigaction struct but doesn't
/// register for signal handling via the @c sigaction function.
ACE_Sig_Action (ACE_SignalHandler handler,
sigset_t *sigmask = 0,
int flags = 0);
+
/// Assigns the various fields of a @c sigaction struct but doesn't
/// register for signal handling via the @c sigaction function.
ACE_Sig_Action (ACE_SignalHandler handler,
const ACE_Sig_Set &sigmask,
int flags = 0);
+
/**
* Assigns the various fields of a @c sigaction struct and registers
* the @a handler to process signal @a signum via the @c sigaction
@@ -98,6 +125,7 @@ public:
int signum,
sigset_t *sigmask = 0,
int flags = 0);
+
/**
* Assigns the various fields of a @c sigaction struct and registers
* the @a handler to process signal @a signum via the @c sigaction
@@ -108,15 +136,18 @@ public:
const ACE_Sig_Set &sigmask,
int flags = 0);
+
// @@ The next two methods have a parameter as "signalss". Please do
// not change the argument name as "signals". This causes the
// following problem as reported by
// <James.Briggs@dsto.defence.gov.au>.
+
// In the file Signal.h two of the functions have and argument name
// of signals. signals is a Qt macro (to do with their meta object
// stuff.
// We could as well have it as "signal", but I am nost sure whether
// that would cause a problem with something else - Bala <bala@cs>
+
/**
* Assigns the various fields of a @c sigaction struct and registers
* the @a handler to process all @a signalss via the @c sigaction
@@ -126,6 +157,7 @@ public:
ACE_SignalHandler handler,
const ACE_Sig_Set &sigmask,
int flags = 0);
+
/**
* Assigns the various fields of a @c sigaction struct and registers
* the @a handler to process all @a signalss via the @c sigaction
@@ -135,47 +167,64 @@ public:
ACE_SignalHandler handler,
sigset_t *sigmask = 0,
int flags = 0);
+
/// Copy constructor.
ACE_Sig_Action (const ACE_Sig_Action &s);
+
/// Default dtor.
~ACE_Sig_Action (void);
+
// = Signal action management.
/// Register @c this as the current disposition and store old
/// disposition into @a oaction if it is non-NULL.
int register_action (int signum,
ACE_Sig_Action *oaction = 0);
+
/// Assign the value of @a oaction to @c this and make it become the
/// new signal disposition.
int restore_action (int signum,
ACE_Sig_Action &oaction);
+
/// Retrieve the current disposition into @c this.
int retrieve_action (int signum);
+
/// Set current signal action.
void set (struct sigaction *);
+
/// Get current signal action.
struct sigaction *get (void);
operator struct sigaction *();
+
/// Set current signal flags.
void flags (int);
+
/// Get current signal flags.
int flags (void);
+
/// Set current signal mask.
void mask (sigset_t *);
void mask (ACE_Sig_Set &);
+
/// Get current signal mask.
sigset_t *mask (void);
+
/// Set current signal handler (pointer to function).
void handler (ACE_SignalHandler);
+
/// Get current signal handler (pointer to function).
ACE_SignalHandler handler (void);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Controls signal behavior.
struct sigaction sa_;
};
+
/**
* @class ACE_Sig_Guard
*
@@ -190,22 +239,30 @@ public:
/// activated only when a spcific condition met. When condition ==
/// true (default), Guard is activated
ACE_Sig_Guard (ACE_Sig_Set *mask = 0, bool condition = true);
+
/// Restore blocked signals.
~ACE_Sig_Guard (void);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Original signal mask.
ACE_Sig_Set omask_;
+
/// Guard Condition
bool condition_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Signal.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_SIGNAL_HANDLER_H */
diff --git a/dep/ACE_wrappers/ace/Signal.inl b/dep/ACE_wrappers/ace/Signal.inl
index e467b92e6e2..858c33c26fb 100644
--- a/dep/ACE_wrappers/ace/Signal.inl
+++ b/dep/ACE_wrappers/ace/Signal.inl
@@ -1,103 +1,122 @@
// -*- C++ -*-
//
// $Id: Signal.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_signal.h"
#include "ace/config-all.h"
#include "ace/Trace.h"
#include "ace/Object_Manager_Base.h"
#include "ace/OS_NS_Thread.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_Sig_Set::ACE_Sig_Set (sigset_t *ss)
// : sigset_ ()
{
ACE_TRACE ("ACE_Sig_Set::ACE_Sig_Set");
+
if (ss == 0)
ACE_OS::sigfillset (&this->sigset_);
else
// Structure assignment.
this->sigset_ = *ss;
}
+
ACE_INLINE
ACE_Sig_Set::ACE_Sig_Set (int fill)
// : sigset_ ()
{
ACE_TRACE ("ACE_Sig_Set::ACE_Sig_Set");
+
if (fill)
ACE_OS::sigfillset (&this->sigset_);
else
ACE_OS::sigemptyset (&this->sigset_);
}
+
ACE_INLINE
ACE_Sig_Set::ACE_Sig_Set (ACE_Sig_Set *ss)
// : sigset_ ()
{
ACE_TRACE ("ACE_Sig_Set::ACE_Sig_Set");
+
if (ss == 0)
ACE_OS::sigfillset (&this->sigset_);
else
this->sigset_ = ss->sigset_;
}
+
ACE_INLINE int
ACE_Sig_Set::empty_set (void)
{
ACE_TRACE ("ACE_Sig_Set::empty_set");
return ACE_OS::sigemptyset (&this->sigset_);
}
+
ACE_INLINE int
ACE_Sig_Set::fill_set (void)
{
ACE_TRACE ("ACE_Sig_Set::fill_set");
return ACE_OS::sigfillset (&this->sigset_);
}
+
ACE_INLINE int
ACE_Sig_Set::sig_add (int signo)
{
ACE_TRACE ("ACE_Sig_Set::sig_add");
return ACE_OS::sigaddset (&this->sigset_, signo);
}
+
ACE_INLINE int
ACE_Sig_Set::sig_del (int signo)
{
ACE_TRACE ("ACE_Sig_Set::sig_del");
return ACE_OS::sigdelset (&this->sigset_, signo);
}
+
ACE_INLINE int
ACE_Sig_Set::is_member (int signo) const
{
ACE_TRACE ("ACE_Sig_Set::is_member");
return ACE_OS::sigismember (const_cast<sigset_t *> (&this->sigset_), signo);
}
+
ACE_INLINE
ACE_Sig_Set::operator sigset_t *(void)
{
ACE_TRACE ("ACE_Sig_Set::operator sigset_t *");
return &this->sigset_;
}
+
ACE_INLINE sigset_t
ACE_Sig_Set::sigset (void) const
{
ACE_TRACE ("ACE_Sig_Set::sigset");
return this->sigset_;
}
+
ACE_INLINE int
ACE_Sig_Action::flags (void)
{
ACE_TRACE ("ACE_Sig_Action::flags");
return this->sa_.sa_flags;
}
+
ACE_INLINE void
ACE_Sig_Action::flags (int flags)
{
ACE_TRACE ("ACE_Sig_Action::flags");
this->sa_.sa_flags = flags;
}
+
ACE_INLINE sigset_t *
ACE_Sig_Action::mask (void)
{
ACE_TRACE ("ACE_Sig_Action::mask");
return &this->sa_.sa_mask;
}
+
ACE_INLINE void
ACE_Sig_Action::mask (sigset_t *ss)
{
@@ -105,18 +124,21 @@ ACE_Sig_Action::mask (sigset_t *ss)
if (ss != 0)
this->sa_.sa_mask = *ss; // Structure assignment
}
+
ACE_INLINE void
ACE_Sig_Action::mask (ACE_Sig_Set &ss)
{
ACE_TRACE ("ACE_Sig_Action::mask");
this->sa_.sa_mask = ss.sigset (); // Structure assignment
}
+
ACE_INLINE ACE_SignalHandler
ACE_Sig_Action::handler (void)
{
ACE_TRACE ("ACE_Sig_Action::handler");
return ACE_SignalHandler (this->sa_.sa_handler);
}
+
ACE_INLINE void
ACE_Sig_Action::handler (ACE_SignalHandler handler)
{
@@ -127,6 +149,7 @@ ACE_Sig_Action::handler (ACE_SignalHandler handler)
this->sa_.sa_handler = (void (*)()) ACE_SignalHandlerV (handler);
#endif /* !ACE_HAS_TANDEM_SIGNALS */
}
+
#if 0
ACE_INLINE ACE_SignalHandler
ACE_Sig_Action::sigaction (void)
@@ -134,6 +157,7 @@ ACE_Sig_Action::sigaction (void)
ACE_TRACE ("ACE_Sig_Action::sigaction");
return ACE_SignalHandler (this->sa_.sa_sigaction);
}
+
ACE_INLINE void
ACE_Sig_Action::sigaction (ACE_SignalHandler handler)
{
@@ -141,24 +165,28 @@ ACE_Sig_Action::sigaction (ACE_SignalHandler handler)
this->sa_.sa_sigaction = (void (*)()) ACE_SignalHandlerV (handler);
}
#endif /* 0 */
+
ACE_INLINE void
ACE_Sig_Action::set (struct sigaction *sa)
{
ACE_TRACE ("ACE_Sig_Action::set");
this->sa_ = *sa; // Structure assignment.
}
+
ACE_INLINE struct sigaction *
ACE_Sig_Action::get (void)
{
ACE_TRACE ("ACE_Sig_Action::get");
return &this->sa_;
}
+
ACE_INLINE
ACE_Sig_Action::operator struct sigaction * ()
{
ACE_TRACE ("ACE_Sig_Action::operator struct sigaction *");
return &this->sa_;
}
+
ACE_INLINE
ACE_Sig_Action::ACE_Sig_Action (const ACE_Sig_Action &s)
// : sa_ ()
@@ -166,19 +194,23 @@ ACE_Sig_Action::ACE_Sig_Action (const ACE_Sig_Action &s)
ACE_TRACE ("ACE_Sig_Action::ACE_Sig_Action");
*this = s; // structure copy.
}
+
ACE_INLINE int
ACE_Sig_Action::register_action (int signum, ACE_Sig_Action *oaction)
{
ACE_TRACE ("ACE_Sig_Action::register_action");
struct sigaction *sa = oaction == 0 ? 0 : oaction->get ();
+
return ACE_OS::sigaction (signum, &this->sa_, sa);
}
+
ACE_INLINE int
ACE_Sig_Action::retrieve_action (int signum)
{
ACE_TRACE ("ACE_Sig_Action::retrieve_action");
return ACE_OS::sigaction (signum, 0, &this->sa_);
}
+
ACE_INLINE int
ACE_Sig_Action::restore_action (int signum, ACE_Sig_Action &oaction)
{
@@ -186,7 +218,9 @@ ACE_Sig_Action::restore_action (int signum, ACE_Sig_Action &oaction)
this->sa_ = *oaction.get (); // Structure assignment
return ACE_OS::sigaction (signum, &this->sa_, 0);
}
+
// Block out the signal MASK until the destructor is called.
+
ACE_INLINE
ACE_Sig_Guard::ACE_Sig_Guard (ACE_Sig_Set *mask,
bool condition)
@@ -196,6 +230,7 @@ ACE_Sig_Guard::ACE_Sig_Guard (ACE_Sig_Set *mask,
//ACE_TRACE ("ACE_Sig_Guard::ACE_Sig_Guard");
if (!this->condition_)
return;
+
#if defined (ACE_LACKS_UNIX_SIGNALS)
ACE_UNUSED_ARG (mask);
#else
@@ -226,4 +261,5 @@ ACE_Sig_Guard::ACE_Sig_Guard (ACE_Sig_Set *mask,
# endif /* ACE_LACKS_PTHREAD_THR_SIGSETMASK */
#endif /* ACE_LACKS_UNIX_SIGNALS */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Singleton.h b/dep/ACE_wrappers/ace/Singleton.h
index 82b35f658f7..2d9c8e937ef 100644
--- a/dep/ACE_wrappers/ace/Singleton.h
+++ b/dep/ACE_wrappers/ace/Singleton.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Singleton.h
@@ -14,16 +15,21 @@
* @author David Levine <levine@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_SINGLETON_H
#define ACE_SINGLETON_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
#include "ace/TSS_T.h"
#include "ace/Cleanup.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Singleton
*
@@ -75,23 +81,30 @@ class ACE_Singleton : public ACE_Cleanup
public:
/// Global access point to the Singleton.
static TYPE *instance (void);
+
/// Cleanup method, used by <ace_cleanup_destroyer> to destroy the
/// ACE_Singleton.
virtual void cleanup (void *param = 0);
+
/// Dump the state of the object.
static void dump (void);
+
protected:
/// Default constructor.
ACE_Singleton (void);
+
/// Contained instance.
TYPE instance_;
+
#if !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES)
/// Pointer to the Singleton (ACE_Cleanup) instance.
static ACE_Singleton<TYPE, ACE_LOCK> *singleton_;
#endif /* ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES */
+
/// Get pointer to the Singleton instance.
static ACE_Singleton<TYPE, ACE_LOCK> *&instance_i (void);
};
+
/**
* @class ACE_Unmanaged_Singleton
*
@@ -115,20 +128,26 @@ class ACE_Unmanaged_Singleton : public ACE_Singleton <TYPE, ACE_LOCK>
public:
/// Global access point to the Singleton.
static TYPE *instance (void);
+
/// Explicitly delete the Singleton instance.
static void close (void);
+
/// Dump the state of the object.
static void dump (void);
+
protected:
/// Default constructor.
ACE_Unmanaged_Singleton (void);
+
#if !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES)
/// Pointer to the Singleton (ACE_Cleanup) instance.
static ACE_Unmanaged_Singleton<TYPE, ACE_LOCK> *singleton_;
#endif /* ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES */
+
/// Get pointer to the Singleton instance.
static ACE_Unmanaged_Singleton<TYPE, ACE_LOCK> *&instance_i (void);
};
+
/**
* @class ACE_TSS_Singleton
*
@@ -153,25 +172,33 @@ class ACE_TSS_Singleton : public ACE_Cleanup
public:
/// Global access point to the singleton.
static TYPE *instance (void);
+
/// Cleanup method, used by <ace_cleanup_destroyer> to destroy the
/// singleton.
virtual void cleanup (void *param = 0);
+
/// Dump the state of the object.
static void dump (void);
+
protected:
/// Default constructor.
ACE_TSS_Singleton (void);
+
/// Contained instance.
ACE_TSS_TYPE (TYPE) instance_;
+
ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_TSS_Singleton<TYPE,ACE_LOCK> &))
ACE_UNIMPLEMENTED_FUNC (ACE_TSS_Singleton (const ACE_TSS_Singleton<TYPE,ACE_LOCK> &))
+
#if !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES)
/// Pointer to the Singleton (ACE_Cleanup) instance.
static ACE_TSS_Singleton<TYPE, ACE_LOCK> *singleton_;
#endif /* ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES */
+
/// Get pointer to the TSS Singleton instance.
static ACE_TSS_Singleton<TYPE, ACE_LOCK> *&instance_i (void);
};
+
/**
* @class ACE_Unmanaged_TSS_Singleton
*
@@ -191,20 +218,26 @@ class ACE_Unmanaged_TSS_Singleton : public ACE_TSS_Singleton <TYPE, ACE_LOCK>
public:
/// Global access point to the singleton.
static TYPE *instance (void);
+
/// Explicitly delete the singleton instance.
static void close (void);
+
/// Dump the state of the object.
static void dump (void);
+
protected:
/// Default constructor.
ACE_Unmanaged_TSS_Singleton (void);
+
#if !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES)
/// Pointer to the Singleton (ACE_Cleanup) instance.
static ACE_Unmanaged_TSS_Singleton<TYPE, ACE_LOCK> *singleton_;
#endif /* ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES */
+
/// Get pointer to the Singleton instance.
static ACE_Unmanaged_TSS_Singleton<TYPE, ACE_LOCK> *&instance_i (void);
};
+
/**
* @class ACE_DLL_Singleton_T
*
@@ -234,45 +267,62 @@ class ACE_DLL_Singleton_T
{
public:
//void cleanup (void *param = 0);
+
/// Global access point to the Singleton.
static TYPE *instance (void);
+
/// Explicitly delete the Singleton instance.
static void close (void);
+
static void close_singleton (void);
+
/// Dump the state of the object.
static void dump (void);
+
const ACE_TCHAR *dll_name (void);
+
const ACE_TCHAR *name (void);
+
protected:
/// Default constructor.
ACE_DLL_Singleton_T (void);
+
/// Destructor.
~ACE_DLL_Singleton_T (void);
+
/// Contained instance.
TYPE instance_;
+
#if !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES)
/// Pointer to the Singleton instance.
static ACE_DLL_Singleton_T<TYPE, ACE_LOCK> *singleton_;
#endif /* ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES */
+
/// Get pointer to the singleton instance.
static ACE_DLL_Singleton_T<TYPE, ACE_LOCK> *&instance_i (void);
};
+
template <class TYPE>
class ACE_DLL_Singleton_Adapter_T : public TYPE
{
public:
const ACE_TCHAR *dll_name (void);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Singleton.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Singleton.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Singleton.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
#endif /* ACE_SINGLETON_H */
diff --git a/dep/ACE_wrappers/ace/Singleton.inl b/dep/ACE_wrappers/ace/Singleton.inl
index 63efbdc9787..107a8b78c6d 100644
--- a/dep/ACE_wrappers/ace/Singleton.inl
+++ b/dep/ACE_wrappers/ace/Singleton.inl
@@ -1,33 +1,42 @@
// -*- C++ -*-
//
// $Id: Singleton.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Default constructors.
//
// Note: don't explicitly initialize "instance_", because TYPE may not
// have a default constructor. Let the compiler figure it out . . .
+
template <class TYPE, class ACE_LOCK> ACE_INLINE
ACE_Singleton<TYPE, ACE_LOCK>::ACE_Singleton (void)
{
}
+
template <class TYPE, class ACE_LOCK> ACE_INLINE
ACE_Unmanaged_Singleton<TYPE, ACE_LOCK>::ACE_Unmanaged_Singleton (void)
{
}
+
template <class TYPE, class ACE_LOCK> ACE_INLINE
ACE_TSS_Singleton<TYPE, ACE_LOCK>::ACE_TSS_Singleton (void)
{
}
+
template <class TYPE, class ACE_LOCK> ACE_INLINE
ACE_Unmanaged_TSS_Singleton<TYPE, ACE_LOCK>::ACE_Unmanaged_TSS_Singleton (void)
{
}
+
template <class TYPE, class ACE_LOCK> ACE_INLINE
ACE_DLL_Singleton_T<TYPE, ACE_LOCK>::ACE_DLL_Singleton_T (void)
{
}
+
template <class TYPE, class ACE_LOCK>
ACE_DLL_Singleton_T<TYPE, ACE_LOCK>::~ACE_DLL_Singleton_T (void)
{
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Sock_Connect.cpp b/dep/ACE_wrappers/ace/Sock_Connect.cpp
index d6d99dbb06e..a6b2359c95c 100644
--- a/dep/ACE_wrappers/ace/Sock_Connect.cpp
+++ b/dep/ACE_wrappers/ace/Sock_Connect.cpp
@@ -1,4 +1,5 @@
// $Id: Sock_Connect.cpp 82276 2008-07-09 17:35:49Z jtc $
+
#include "ace/Sock_Connect.h"
#include "ace/INET_Addr.h"
#include "ace/Log_Msg.h"
@@ -8,15 +9,18 @@
#include "ace/OS_Memory.h"
#include "ace/OS_NS_stdio.h"
#include "ace/ACE.h"
+
#if defined (sparc)
# include "ace/OS_NS_fcntl.h"
#endif // sparc
+
#include "ace/OS_NS_stdlib.h"
#include "ace/OS_NS_string.h"
#include "ace/OS_NS_sys_socket.h"
#include "ace/OS_NS_netdb.h"
#include "ace/OS_NS_unistd.h"
#include "ace/os_include/net/os_if.h"
+
#if defined (ACE_HAS_IPV6)
# include "ace/Guard_T.h"
# include "ace/Recursive_Thread_Mutex.h"
@@ -24,6 +28,7 @@
# include /**/ <netinet/in6_var.h>
# endif /* _AIX */
#endif /* ACE_HAS_IPV6 */
+
# if defined (ACE_HAS_GETIFADDRS)
# if defined (ACE_VXWORKS)
# include /**/ <net/ifaddrs.h>
@@ -31,6 +36,7 @@
# include /**/ <ifaddrs.h>
# endif /*ACE_VXWORKS */
# endif /* ACE_HAS_GETIFADDRS */
+
#if defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x600)
#include /**/ <inetLib.h>
#include /**/ <netinet/in_var.h>
@@ -43,12 +49,14 @@ extern "C" {
#endif /* ACE_HAS_IPV6 */
#include "ace/OS_NS_stdio.h"
#endif /* ACE_VXWORKS < 0x600 */
+
#if defined (ACE_VXWORKS) && ((ACE_VXWORKS == 0x630) || (ACE_VXWORKS == 0x640)) && defined (__RTP__) && defined (ACE_HAS_IPV6)
const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT;
const struct in6_addr in6addr_nodelocal_allnodes = IN6ADDR_NODELOCAL_ALLNODES_INIT;
const struct in6_addr in6addr_linklocal_allnodes = IN6ADDR_LINKLOCAL_ALLNODES_INIT;
const struct in6_addr in6addr_linklocal_allrouters = IN6ADDR_LINKLOCAL_ALLROUTERS_INIT;
#endif /* ACE_VXWORKS == 0x630 && __RTP__ && ACE_HAS_IPV6 */
+
#if defined (ACE_HAS_WINCE)
#include /**/ <Iphlpapi.h>
// The following code is suggested by microsoft as a workaround to the fact
@@ -58,12 +66,16 @@ const struct in6_addr in6addr_linklocal_allrouters = IN6ADDR_LINKLOCAL_ALLROUTER
const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT;
const struct in6_addr in6addr_loopback = IN6ADDR_LOOPBACK_INIT;
#endif // ACE_HAS_WINCE
+
#if defined (ACE_WIN32) && defined (ACE_HAS_PHARLAP)
# include "ace/OS_NS_stdio.h"
#endif
+
#if defined (ACE_HAS_IPV6)
+
// These defines support a generic usage based on
// the various SIGCF*IF ioctl implementations
+
# if defined (SIOCGLIFCONF)
# define SIOCGIFCONF_CMD SIOCGLIFCONF
# if defined (__hpux)
@@ -104,17 +116,22 @@ const struct in6_addr in6addr_loopback = IN6ADDR_LOOPBACK_INIT;
# undef SETFAMILY
# define SA_FAMILY sa_family
# endif /* SIOCGLIFCONF */
+
# if defined (ACE_HAS_THREADS)
# include "ace/Object_Manager.h"
# endif /* ACE_HAS_THREADS */
+
namespace
{
// private:
// Used internally so not exported.
+
// Does this box have ipv4 turned on?
int ace_ipv4_enabled = -1;
+
// Does this box have ipv6 turned on?
int ace_ipv6_enabled = -1;
+
}
#else /* ACE_HAS_IPV6 */
# define SIOCGIFCONF_CMD SIOCGIFCONF
@@ -129,6 +146,7 @@ namespace
# undef SETFAMILY
# define SA_FAMILY sa_family
#endif /* ACE_HAS_IPV6 */
+
// This is a hack to work around a problem with Visual Age C++ 5 and 6 on AIX.
// Without this, the compiler auto-instantiates the ACE_Auto_Array_Ptr for
// ifreq (contained in this module) but only adds the #include for <net/if.h>
@@ -139,17 +157,23 @@ namespace
static ACE_Auto_Array_Ptr<sockaddr> force_compiler_to_include_socket_h;
#endif /* AIX && __IBMCPP__ >= 500 */
+
ACE_RCSID (ace,
Sock_Connect,
"$Id: Sock_Connect.cpp 82276 2008-07-09 17:35:49Z jtc $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Bind socket to an unused port.
+
int
ACE::bind_port (ACE_HANDLE handle, ACE_UINT32 ip_addr, int address_family)
{
ACE_TRACE ("ACE::bind_port");
+
ACE_INET_Addr addr;
+
#if defined (ACE_HAS_IPV6)
if (address_family != PF_INET6)
// What do we do if it is PF_"INET6? Since it's 4 bytes, it must be an
@@ -164,11 +188,13 @@ ACE::bind_port (ACE_HANDLE handle, ACE_UINT32 ip_addr, int address_family)
// to the IPv4-mapped IPv6 address
addr.set ((u_short)0, ip_addr, 1, 1);
#endif /* ACE_HAS_IPV6 */
+
// The OS kernel should select a free port for us.
return ACE_OS::bind (handle,
(sockaddr*)addr.get_addr(),
addr.get_size());
}
+
int
ACE::get_bcast_addr (ACE_UINT32 &bcast_addr,
const ACE_TCHAR *host_name,
@@ -176,6 +202,7 @@ ACE::get_bcast_addr (ACE_UINT32 &bcast_addr,
ACE_HANDLE handle)
{
ACE_TRACE ("ACE::get_bcast_addr");
+
#if defined (ACE_LACKS_GET_BCAST_ADDR)
ACE_UNUSED_ARG (bcast_addr);
ACE_UNUSED_ARG (host_name);
@@ -184,17 +211,22 @@ ACE::get_bcast_addr (ACE_UINT32 &bcast_addr,
ACE_NOTSUP_RETURN (-1);
#elif !defined(ACE_WIN32) && !defined(__INTERIX)
ACE_HANDLE s = handle;
+
if (s == ACE_INVALID_HANDLE)
s = ACE_OS::socket (AF_INET, SOCK_STREAM, 0);
+
if (s == ACE_INVALID_HANDLE)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_OS::socket")),
-1);
+
struct ifconf ifc;
char buf[BUFSIZ];
+
ifc.ifc_len = sizeof buf;
ifc.ifc_buf = buf;
+
// Get interface structure and initialize the addresses using UNIX
// techniques
if (ACE_OS::ioctl (s, SIOCGIFCONF_CMD, (char *) &ifc) == -1)
@@ -203,12 +235,16 @@ ACE::get_bcast_addr (ACE_UINT32 &bcast_addr,
ACE_TEXT ("ACE::get_bcast_addr:")
ACE_TEXT ("ioctl (get interface configuration)")),
-1);
+
struct ifreq *ifr = ifc.ifc_req;
+
struct sockaddr_in ip_addr;
+
// Get host ip address if necessary.
if (host_name)
{
hostent *hp = ACE_OS::gethostbyname (ACE_TEXT_ALWAYS_CHAR (host_name));
+
if (hp == 0)
return -1;
else
@@ -236,6 +272,7 @@ ACE::get_bcast_addr (ACE_UINT32 &bcast_addr,
ip_addr.sin_addr.s_addr = host_addr; // just copy to the bitfield
#endif /* ! _UNICOS */
}
+
#if !defined(AIX) && !defined (__QNX__) && !defined (__FreeBSD__) && !defined(__NetBSD__)
for (int n = ifc.ifc_len / sizeof (struct ifreq) ; n > 0;
n--, ifr++)
@@ -252,12 +289,15 @@ ACE::get_bcast_addr (ACE_UINT32 &bcast_addr,
#endif /* !defined(AIX) && !defined (__QNX__) && !defined (__FreeBSD__) && !defined(__NetBSD__) */
{
struct sockaddr_in if_addr;
+
// Compare host ip address with interface ip address.
ACE_OS::memcpy (&if_addr,
&ifr->ifr_addr,
sizeof if_addr);
+
if (ip_addr.sin_addr.s_addr != if_addr.sin_addr.s_addr)
continue;
+
if (ifr->ifr_addr.sa_family != AF_INET)
{
ACE_ERROR ((LM_ERROR,
@@ -266,8 +306,10 @@ ACE::get_bcast_addr (ACE_UINT32 &bcast_addr,
ACE_TEXT ("Not AF_INET")));
continue;
}
+
struct ifreq flags = *ifr;
struct ifreq if_req = *ifr;
+
if (ACE_OS::ioctl (s, SIOCGIFFLAGS, (char *) &flags) == -1)
{
ACE_ERROR ((LM_ERROR,
@@ -276,6 +318,7 @@ ACE::get_bcast_addr (ACE_UINT32 &bcast_addr,
ACE_TEXT (" ioctl (get interface flags)")));
continue;
}
+
if (ACE_BIT_DISABLED (flags.ifr_flags, IFF_UP))
{
ACE_ERROR ((LM_ERROR,
@@ -284,8 +327,10 @@ ACE::get_bcast_addr (ACE_UINT32 &bcast_addr,
ACE_TEXT ("Network interface is not up")));
continue;
}
+
if (ACE_BIT_ENABLED (flags.ifr_flags, IFF_LOOPBACK))
continue;
+
if (ACE_BIT_ENABLED (flags.ifr_flags, IFF_BROADCAST))
{
if (ACE_OS::ioctl (s,
@@ -300,11 +345,14 @@ ACE::get_bcast_addr (ACE_UINT32 &bcast_addr,
ACE_OS::memcpy (&ip_addr,
&if_req.ifr_broadaddr,
sizeof if_req.ifr_broadaddr);
+
ACE_OS::memcpy ((void *) &host_addr,
(void *) &ip_addr.sin_addr,
sizeof host_addr);
+
if (handle == ACE_INVALID_HANDLE)
ACE_OS::close (s);
+
bcast_addr = host_addr;
return 0;
}
@@ -314,11 +362,14 @@ ACE::get_bcast_addr (ACE_UINT32 &bcast_addr,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE::get_bcast_addr:")
ACE_TEXT ("Broadcast is not enable for this interface.")));
+
if (handle == ACE_INVALID_HANDLE)
ACE_OS::close (s);
+
bcast_addr = host_addr;
return 0;
}
+
return 0;
#else
ACE_UNUSED_ARG (handle);
@@ -328,6 +379,7 @@ ACE::get_bcast_addr (ACE_UINT32 &bcast_addr,
return 0;
#endif /* !ACE_WIN32 && !__INTERIX */
}
+
int
ACE::get_fqdn (ACE_INET_Addr const & addr,
char hostname[],
@@ -336,6 +388,7 @@ ACE::get_fqdn (ACE_INET_Addr const & addr,
int h_error; // Not the same as errno!
hostent hentry;
ACE_HOSTENT_DATA buf;
+
char * ip_addr = 0;
int ip_addr_size = 0;
if (addr.get_type () == AF_INET)
@@ -350,10 +403,12 @@ ACE::get_fqdn (ACE_INET_Addr const & addr,
{
sockaddr_in6 * sock_addr =
reinterpret_cast<sockaddr_in6 *> (addr.get_addr ());
+
ip_addr_size = sizeof sock_addr->sin6_addr;
ip_addr = (char*) &sock_addr->sin6_addr;
}
#endif /* ACE_HAS_IPV6 */
+
// get the host entry for the address in question
hostent * const hp = ACE_OS::gethostbyaddr_r (ip_addr,
ip_addr_size,
@@ -361,15 +416,18 @@ ACE::get_fqdn (ACE_INET_Addr const & addr,
&hentry,
buf,
&h_error);
+
// if it's not found in the host file or the DNS datase, there is nothing
// much we can do. embed the IP address
if (hp == 0 || hp->h_name == 0)
return -1;
+
if (ACE::debug())
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%P|%t) - ACE::get_fqdn, ")
ACE_TEXT ("canonical host name is %s\n"),
ACE_TEXT_CHAR_TO_TCHAR (hp->h_name)));
+
// check if the canonical name is the FQDN
if (!ACE_OS::strchr(hp->h_name, '.'))
{
@@ -377,6 +435,7 @@ ACE::get_fqdn (ACE_INET_Addr const & addr,
char** p;
// list of aliases
char** q;
+
// for every address and for every alias within the address, check and
// see if we can locate a FQDN
for (p = hp->h_addr_list; *p != 0; ++p)
@@ -395,17 +454,20 @@ ACE::get_fqdn (ACE_INET_Addr const & addr,
// is atleast better than embedding the IP
// address in the profile
continue;
+
if (ACE::debug ())
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%P|%t) - ACE::get_fqdn, ")
ACE_TEXT ("found fqdn within alias as %s\n"),
ACE_TEXT_CHAR_TO_TCHAR(*q)));
ACE_OS::strcpy (hostname, *q);
+
return 0;
}
}
}
}
+
// The canonical name may be an FQDN when we reach here.
// Alternatively, the canonical name (a non FQDN) may be the best
// we can do.
@@ -419,9 +481,12 @@ ACE::get_fqdn (ACE_INET_Addr const & addr,
{
ACE_OS::strcpy (hostname, hp->h_name);
}
+
return 0;
}
+
#if defined (ACE_WIN32)
+
static int
get_ip_interfaces_win32 (size_t &count,
ACE_INET_Addr *&addrs)
@@ -434,29 +499,35 @@ get_ip_interfaces_win32 (size_t &count,
ULONG OutBufferLength = 0;
ULONG RetVal = 0;
unsigned char *octet_buffer = 0;
+
RetVal =
GetAdaptersAddresses(AF_UNSPEC,
0,
0,
AdapterAddresses,
&OutBufferLength);
+
if (RetVal != ERROR_BUFFER_OVERFLOW)
{
return -1;
}
+
ACE_NEW_RETURN (octet_buffer, unsigned char[OutBufferLength],-1);
AdapterAddresses = (IP_ADAPTER_ADDRESSES *)octet_buffer;
+
RetVal =
GetAdaptersAddresses(AF_UNSPEC,
0,
0,
AdapterAddresses,
&OutBufferLength);
+
if (RetVal != NO_ERROR)
{
delete [] octet_buffer;
return -1;
}
+
// If successful, output some information from the data we received
PIP_ADAPTER_ADDRESSES AdapterList = AdapterAddresses;
while (AdapterList)
@@ -470,7 +541,9 @@ get_ip_interfaces_win32 (size_t &count,
}
AdapterList = AdapterList->Next;
}
+
AdapterList = AdapterAddresses;
+
ACE_NEW_RETURN (addrs, ACE_INET_Addr[count],-1);
count = 0;
for (AdapterList = AdapterAddresses;
@@ -479,6 +552,7 @@ get_ip_interfaces_win32 (size_t &count,
{
if (AdapterList->OperStatus != IfOperStatusUp)
continue;
+
IP_ADAPTER_UNICAST_ADDRESS *uni = 0;
if (AdapterList->IfIndex != 0)
for (uni = AdapterList->FirstUnicastAddress;
@@ -511,14 +585,17 @@ get_ip_interfaces_win32 (size_t &count,
}
}
}
+
delete [] octet_buffer;
return 0;
+
# elif defined (ACE_HAS_PHARLAP)
// PharLap ETS has its own kernel routines to rummage through the device
// configs and extract the interface info, but only for Pharlap RT.
# if !defined (ACE_HAS_PHARLAP_RT)
ACE_NOTSUP_RETURN (-1);
# endif /* ACE_HAS_PHARLAP_RT */
+
// Locate all of the IP devices in the system, saving a DEVHANDLE
// for each. Then allocate the ACE_INET_Addrs needed and fetch all
// the IP addresses. To locate the devices, try the available
@@ -529,6 +606,7 @@ get_ip_interfaces_win32 (size_t &count,
EK_TCPIPCFG *devp;
size_t i, j;
ACE_TCHAR dev_name[16];
+
count = 0;
for (i = 0; count < ACE_MAX_ETS_DEVICES; i++, ++count)
{
@@ -560,12 +638,14 @@ get_ip_interfaces_win32 (size_t &count,
if (ip_dev[count] == 0)
break;
}
+
if (count > 0)
ACE_NEW_RETURN (addrs,
ACE_INET_Addr[count],
-1);
else
addrs = 0;
+
for (i = 0, j = 0; i < count; i++)
{
devp = EtsTCPGetDeviceCfg (ip_dev[i]);
@@ -578,23 +658,30 @@ get_ip_interfaces_win32 (size_t &count,
}
// There's no call to close the DEVHANDLE.
}
+
count = j;
if (count == 0 && addrs != 0)
{
delete [] addrs;
addrs = 0;
}
+
return 0;
+
# else
// All non-CE, non-Pharlap Windows. Must support Winsock2.
+
int i, n_interfaces, status;
+
INTERFACE_INFO info[64];
SOCKET sock;
+
// Get an (overlapped) DGRAM socket to test with
sock = socket (AF_INET, SOCK_DGRAM, 0);
if (sock == INVALID_SOCKET)
return -1;
+
DWORD bytes;
status = WSAIoctl(sock,
SIO_GET_INTERFACE_LIST,
@@ -608,13 +695,17 @@ get_ip_interfaces_win32 (size_t &count,
closesocket (sock);
if (status == SOCKET_ERROR)
return -1;
+
n_interfaces = bytes / sizeof(INTERFACE_INFO);
+
// SIO_GET_INTERFACE_LIST does not work for IPv6
// Instead recent versions of Winsock2 add the new opcode
// SIO_ADDRESS_LIST_QUERY.
// If this is not available forget about IPv6 local interfaces:-/
int n_v6_interfaces = 0;
+
# if defined (ACE_HAS_IPV6) && defined (SIO_ADDRESS_LIST_QUERY)
+
LPSOCKET_ADDRESS_LIST v6info;
char *buffer;
DWORD buflen = sizeof (SOCKET_ADDRESS_LIST) + (63 * sizeof (SOCKET_ADDRESS));
@@ -622,6 +713,7 @@ get_ip_interfaces_win32 (size_t &count,
char[buflen],
-1);
v6info = reinterpret_cast<LPSOCKET_ADDRESS_LIST> (buffer);
+
// Get an (overlapped) DGRAM socket to test with.
// If it fails only return IPv4 interfaces.
sock = socket (AF_INET6, SOCK_DGRAM, IPPROTO_UDP);
@@ -641,49 +733,62 @@ get_ip_interfaces_win32 (size_t &count,
n_v6_interfaces = v6info->iAddressCount;
}
# endif /* ACE_HAS_IPV6 */
+
ACE_NEW_RETURN (addrs,
ACE_INET_Addr[n_interfaces + n_v6_interfaces],
-1);
+
// Now go through the list and transfer the good ones to the list of
// because they're down or don't have an IP address.
for (count = 0, i = 0; i < n_interfaces; ++i)
{
LPINTERFACE_INFO lpii;
struct sockaddr_in *addrp = 0;
+
lpii = &info[i];
if (!(lpii->iiFlags & IFF_UP))
continue;
+
// We assume IPv4 addresses here
addrp = reinterpret_cast<struct sockaddr_in *> (&lpii->iiAddress.AddressIn);
if (addrp->sin_addr.s_addr == INADDR_ANY)
continue;
+
// Set the address for the caller.
addrs[count].set(addrp, sizeof(sockaddr_in));
++count;
}
+
# if defined (ACE_HAS_IPV6) && defined (SIO_ADDRESS_LIST_QUERY)
// Now go through the list and transfer the good ones to the list of
// because they're down or don't have an IP address.
for (i = 0; i < n_v6_interfaces; i++)
{
struct sockaddr_in6 *addr6p;
+
if (v6info->Address[i].lpSockaddr->sa_family != AF_INET6)
continue;
+
addr6p = reinterpret_cast<struct sockaddr_in6 *> (v6info->Address[i].lpSockaddr);
if (IN6_IS_ADDR_UNSPECIFIED(&addr6p->sin6_addr)) // IN6ADDR_ANY?
continue;
+
// Set the address for the caller.
addrs[count].set(reinterpret_cast<struct sockaddr_in *> (addr6p), sizeof(sockaddr_in6));
++count;
}
+
delete [] buffer; // Clean up
# endif /* ACE_HAS_IPV6 */
+
if (count == 0)
{
delete [] addrs;
addrs = 0;
}
+
return 0;
+
# endif /* ACE_HAS_WINCE */
}
#elif defined (ACE_HAS_GETIFADDRS)
@@ -695,21 +800,26 @@ get_ip_interfaces_getifaddrs (size_t &count,
// access to connected interfaces.
struct ifaddrs *ifap = 0;
struct ifaddrs *p_if = 0;
+
if (::getifaddrs (&ifap) != 0)
return -1;
+
// Count number of interfaces.
size_t num_ifs = 0;
for (p_if = ifap; p_if != 0; p_if = p_if->ifa_next)
++num_ifs;
+
// Now create and initialize output array.
ACE_NEW_RETURN (addrs,
ACE_INET_Addr[num_ifs],
-1); // caller must free
+
// Pull the address out of each INET interface. Not every interface
// is for IP, so be careful to count properly. When setting the
// INET_Addr, 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 (p_if = ifap;
p_if != 0;
p_if = p_if->ifa_next)
@@ -719,6 +829,7 @@ get_ip_interfaces_getifaddrs (size_t &count,
{
struct sockaddr_in *addr =
reinterpret_cast<sockaddr_in *> (p_if->ifa_addr);
+
// Sometimes the kernel returns 0.0.0.0 as the interface
// address, skip those...
if (addr->sin_addr.s_addr != INADDR_ANY)
@@ -735,6 +846,7 @@ get_ip_interfaces_getifaddrs (size_t &count,
{
struct sockaddr_in6 *addr =
reinterpret_cast<sockaddr_in6 *> (p_if->ifa_addr);
+
// Skip the ANY address
if (!IN6_IS_ADDR_UNSPECIFIED(&addr->sin6_addr))
{
@@ -745,7 +857,9 @@ get_ip_interfaces_getifaddrs (size_t &count,
}
# endif /* ACE_HAS_IPV6 */
}
+
::freeifaddrs (ifap);
+
return 0;
}
#elif defined (__hpux)
@@ -755,21 +869,26 @@ get_ip_interfaces_hpux (size_t &count,
{
size_t num_ifs = 0;
size_t num_ifs_found = 0;
+
// Call specific routine as necessary.
ACE_HANDLE handle = ACE_OS::socket (PF_INET, SOCK_DGRAM, 0);
ACE_HANDLE handle_ipv6 = ACE_INVALID_HANDLE;
+
if (handle == ACE_INVALID_HANDLE)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE::get_ip_interfaces:open")),
-1);
+
int result = 0;
int tmp_how_many = 0;
+
result = ACE_OS::ioctl (handle,
SIOCGIFNUM,
(caddr_t) &tmp_how_many);
if (result != -1)
num_ifs = (size_t)tmp_how_many;
+
# if defined (ACE_HAS_IPV6)
tmp_how_many = 0;
handle_ipv6 = ACE_OS::socket (PF_INET6, SOCK_DGRAM, 0);
@@ -779,22 +898,28 @@ get_ip_interfaces_hpux (size_t &count,
if (result != -1)
num_ifs += (size_t)tmp_how_many;
# endif
+
if (num_ifs == 0)
{
ACE_OS::close (handle);
ACE_OS::close (handle_ipv6);
return -1;
}
+
// ioctl likes to have an extra IFREQ structure to mark the end of
// what it returned, so increase the num_ifs by one.
++num_ifs;
+
//HPUX requires two passes, First for IPv4, then for IPv6
+
struct ifreq *ifs = 0;
ACE_NEW_RETURN (ifs,
struct ifreq[num_ifs],
-1);
ACE_OS::memset (ifs, 0, num_ifs * sizeof (struct ifreq));
+
ACE_Auto_Array_Ptr<struct ifreq> p_ifs (ifs);
+
if (p_ifs.get() == 0)
{
ACE_OS::close (handle);
@@ -802,10 +927,13 @@ get_ip_interfaces_hpux (size_t &count,
errno = ENOMEM;
return -1;
}
+
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);
+
if (ACE_OS::ioctl (handle,
SIOCGIFCONF,
(char *) &ifcfg) == -1)
@@ -817,13 +945,18 @@ get_ip_interfaces_hpux (size_t &count,
ACE_TEXT ("ioctl - SIOCGIFCONF failed")),
-1);
}
+
ACE_OS::close (handle);
+
// Now create and initialize output array.
+
ACE_NEW_RETURN (addrs,
ACE_INET_Addr[num_ifs],
-1); // caller must free
+
struct ifreq *pcur = p_ifs.get ();
num_ifs_found = ifcfg.ifc_len / sizeof (struct ifreq); // get the number of returned ifs
+
for (size_t i = 0;
i < num_ifs_found;
i++)
@@ -839,7 +972,9 @@ get_ip_interfaces_hpux (size_t &count,
}
++pcur;
}
+
# if defined (ACE_HAS_IPV6)
+
if (handle_ipv6 != ACE_INVALID_HANDLE)
{
struct if_laddrreq *lifs = 0;
@@ -847,7 +982,9 @@ get_ip_interfaces_hpux (size_t &count,
struct if_laddrreq[num_ifs],
-1);
ACE_OS::memset (lifs, 0, num_ifs * sizeof (struct if_laddrreq));
+
ACE_Auto_Array_Ptr<struct if_laddrreq> p_lifs (lifs);
+
if (p_lifs.get() == 0)
{
ACE_OS::close (handle);
@@ -855,10 +992,13 @@ get_ip_interfaces_hpux (size_t &count,
errno = ENOMEM;
return -1;
}
+
struct if_laddrconf lifcfg;
ACE_OS::memset (&lifcfg, 0, sizeof (struct if_laddrconf));
+
lifcfg.iflc_req = p_lifs.get ();
lifcfg.iflc_len = num_ifs * sizeof (struct if_laddrreq);
+
if (ACE_OS::ioctl (handle_ipv6,
SIOCGLIFCONF,
(char *) &lifcfg) == -1)
@@ -870,9 +1010,12 @@ get_ip_interfaces_hpux (size_t &count,
ACE_TEXT ("ioctl - SIOCGLIFCONF failed")),
-1);
}
+
ACE_OS::close (handle_ipv6);
+
struct if_laddrreq *plcur = p_lifs.get ();
num_ifs_found = lifcfg.iflc_len / sizeof (struct if_laddrreq);
+
for (size_t i = 0;
i < num_ifs_found;
i++)
@@ -898,11 +1041,13 @@ get_ip_interfaces_aix (size_t &count,
ACE_HANDLE handle = ACE::get_handle();
size_t num_ifs = 0;
struct ifconf ifc;
+
if (handle == ACE_INVALID_HANDLE)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE::get_ip_interfaces_aix:")),
-1);
+
if (ACE_OS::ioctl (handle,
SIOCGSIZIFCONF,
(caddr_t)&ifc.ifc_len) == -1)
@@ -913,9 +1058,12 @@ get_ip_interfaces_aix (size_t &count,
ACE_TEXT ("get ifconf size")),
-1);
}
+
ACE_NEW_RETURN (ifc.ifc_buf,char [ifc.ifc_len], -1);
+
ACE_Auto_Array_Ptr<char> safe_buf (ifc.ifc_buf);
ACE_OS::memset (safe_buf.get(), 0, ifc.ifc_len);
+
if (ACE_OS::ioctl(handle, SIOCGIFCONF, (caddr_t)&ifc) == -1)
{
ACE_OS::close (handle);
@@ -924,9 +1072,12 @@ get_ip_interfaces_aix (size_t &count,
ACE_TEXT ("get ifconf")),
-1);
}
+
ACE_OS::close (handle);
+
char *buf_start = safe_buf.get();
char *buf_end = buf_start + ifc.ifc_len;
+
num_ifs = 0;
for (char *ptr = buf_start; ptr < buf_end; )
{
@@ -941,6 +1092,7 @@ get_ip_interfaces_aix (size_t &count,
++num_ifs;
}
ACE_NEW_RETURN (addrs,ACE_INET_Addr[num_ifs], -1);
+
for (char * ptr = buf_start; ptr < buf_end; )
{
struct ifreq *req = reinterpret_cast<struct ifreq *>(ptr);
@@ -957,8 +1109,10 @@ get_ip_interfaces_aix (size_t &count,
}
ptr += req->ifr_addr.sa_len;
}
+
return 0;
}
+
#elif defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x600) && !defined (ACE_HAS_VXWORKS551_MEDUSA)
int
get_ip_interfaces_vxworks_lt600 (size_t &count,
@@ -966,13 +1120,16 @@ get_ip_interfaces_vxworks_lt600 (size_t &count,
{
count = 0;
// Loop through each address structure
+
# if defined (ACE_HAS_IPV6) && defined (TAILQ_ENTRY)
# define ia_next ia_link.tqe_next
# endif /* TAILQ_ENTRY */
+
for (struct in_ifaddr* ia = in_ifaddr; ia != 0; ia = ia->ia_next)
{
++count;
}
+
// Now create and initialize output array.
ACE_NEW_RETURN (addrs,
ACE_INET_Addr[count],
@@ -986,9 +1143,11 @@ get_ip_interfaces_vxworks_lt600 (size_t &count,
// Get the current interface name
char interface[64];
ACE_OS::sprintf(interface, "%s%d", ifp->if_name, ifp->if_unit);
+
// Get the address for the current interface
char address [INET_ADDR_LEN];
STATUS status = ifAddrGet(interface, address);
+
if (status == OK)
{
// Concatenate a ':' at the end. This is because in
@@ -1013,16 +1172,20 @@ get_ip_interfaces_vxworks_lt600 (size_t &count,
}
#endif // ACE_WIN32 || ACE_HAS_GETIFADDRS || __hpux || _AIX || ACE_VXWORKS < 0x600
+
// return an array of all configured IP interfaces on this host, count
// rc = 0 on success (count == number of interfaces else -1 caller is
// responsible for calling delete [] on parray
+
int
ACE::get_ip_interfaces (size_t &count,
ACE_INET_Addr *&addrs)
{
ACE_TRACE ("ACE::get_ip_interfaces");
+
count = 0;
addrs = 0;
+
#if defined (ACE_WIN32)
return get_ip_interfaces_win32 (count, addrs);
#elif defined (ACE_HAS_GETIFADDRS)
@@ -1035,42 +1198,54 @@ ACE::get_ip_interfaces (size_t &count,
return get_ip_interfaces_vxworks_lt600 (count, addrs);
#elif (defined (__unix) || defined (__unix__) || defined (__Lynx__) || defined (ACE_OPENVMS) || (defined (ACE_VXWORKS) && (ACE_VXWORKS == 0x650)) || defined (ACE_HAS_RTEMS)) && !defined (ACE_LACKS_NETWORKING)
// COMMON (SVR4 and BSD) UNIX CODE
+
// Call specific routine as necessary.
ACE_HANDLE handle = ACE::get_handle();
+
if (handle == ACE_INVALID_HANDLE)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE::get_ip_interfaces:open")),
-1);
+
size_t num_ifs, num_ifs_found;
+
if (ACE::count_interfaces (handle, num_ifs))
{
ACE_OS::close (handle);
return -1;
}
+
// ioctl likes to have an extra ifreq structure to mark the end of
// what it returned, so increase the num_ifs by one.
++num_ifs;
+
struct IFREQ *ifs = 0;
ACE_NEW_RETURN (ifs,
struct IFREQ[num_ifs],
-1);
ACE_OS::memset (ifs, 0, num_ifs * sizeof (struct IFREQ));
+
ACE_Auto_Array_Ptr<struct IFREQ> p_ifs (ifs);
+
if (p_ifs.get() == 0)
{
ACE_OS::close (handle);
errno = ENOMEM;
return -1;
}
+
struct IFCONF ifcfg;
ACE_OS::memset (&ifcfg, 0, sizeof (struct IFCONF));
+
# ifdef SETFAMILY
ifcfg.IFC_FAMILY = AF_UNSPEC; // request all families be returned
ifcfg.IFC_FLAGS = 0;
# endif
+
ifcfg.IFC_REQ = p_ifs.get ();
ifcfg.IFC_LEN = num_ifs * sizeof (struct IFREQ);
+
if (ACE_OS::ioctl (handle,
SIOCGIFCONF_CMD,
(caddr_t) &ifcfg) == -1)
@@ -1082,18 +1257,24 @@ ACE::get_ip_interfaces (size_t &count,
ACE_TEXT ("ioctl - SIOCGIFCONF failed")),
-1);
}
+
ACE_OS::close (handle);
+
// Now create and initialize output array.
+
ACE_NEW_RETURN (addrs,
ACE_INET_Addr[num_ifs],
-1); // caller must free
+
struct IFREQ *pcur = p_ifs.get ();
num_ifs_found = ifcfg.IFC_LEN / sizeof (struct IFREQ); // get the number of returned ifs
+
// Pull the address out of each INET interface. Not every interface
// is for IP, so be careful to count properly. When setting the
// INET_Addr, 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_found;
i++)
@@ -1103,10 +1284,12 @@ ACE::get_ip_interfaces (size_t &count,
|| pcur->IFR_ADDR.SA_FAMILY == AF_INET6
# endif
)
+
{
# if !defined(_UNICOS)
struct sockaddr_in *addr =
reinterpret_cast<sockaddr_in *> (&pcur->IFR_ADDR);
+
// Sometimes the kernel returns 0.0.0.0 as an IPv4 interface
// address; skip those...
if (addr->sin_addr.s_addr != 0
@@ -1128,11 +1311,13 @@ ACE::get_ip_interfaces (size_t &count,
// need to explicitly copy on the Cray, since the bitfields kinda
// screw things up here
struct sockaddr_in inAddr;
+
inAddr.sin_len = pcur->IFR_ADDR.sa_len;
inAddr.sin_family = pcur->IFR_ADDR.sa_family;
memcpy((void *)&(inAddr.sin_addr),
(const void *)&(pcur->IFR_ADDR.sa_data[8]),
sizeof(struct in_addr));
+
if (inAddr.sin_addr.s_addr != 0)
{
addrs[count].set(&inAddr, sizeof(struct sockaddr_in));
@@ -1140,6 +1325,7 @@ ACE::get_ip_interfaces (size_t &count,
}
# endif /* ! _UNICOS */
}
+
#if !defined (__QNX__) && !defined (__FreeBSD__) && !defined(__NetBSD__) && !defined (ACE_HAS_RTEMS)
++pcur;
#else
@@ -1154,6 +1340,7 @@ ACE::get_ip_interfaces (size_t &count,
}
#endif /* !defined (__QNX__) && !defined (__FreeBSD__) && !defined(__NetBSD__) */
}
+
# if defined (ACE_HAS_IPV6)
// Retrieve IPv6 local interfaces by scanning /proc/net/if_inet6 if
// it exists. If we cannot open it then ignore possible IPv6
@@ -1164,9 +1351,11 @@ ACE::get_ip_interfaces (size_t &count,
int scopeid;
struct addrinfo hints, *res0;
int error;
+
ACE_OS::memset (&hints, 0, sizeof (hints));
hints.ai_flags = AI_NUMERICHOST;
hints.ai_family = AF_INET6;
+
if ((fp = ACE_OS::fopen (ACE_TEXT ("/proc/net/if_inet6"), ACE_TEXT ("r"))) != 0)
{
while (fscanf (fp,
@@ -1176,14 +1365,17 @@ ACE::get_ip_interfaces (size_t &count,
{
// Format the address intoa proper IPv6 decimal address specification and
// resolve the resulting text using getaddrinfo().
+
const char* ip_fmt = "%s:%s:%s:%s:%s:%s:%s:%s%%%d";
ACE_OS::sprintf (s_ipaddr,
ip_fmt,
addr_p[0], addr_p[1], addr_p[2], addr_p[3],
addr_p[4], addr_p[5], addr_p[6], addr_p[7], scopeid);
+
error = getaddrinfo (s_ipaddr, 0, &hints, &res0);
if (error)
continue;
+
if (res0->ai_family == AF_INET6 &&
!IN6_IS_ADDR_UNSPECIFIED (&reinterpret_cast<sockaddr_in6 *> (res0->ai_addr)->sin6_addr))
{
@@ -1191,10 +1383,12 @@ ACE::get_ip_interfaces (size_t &count,
++count;
}
freeaddrinfo (res0);
+
}
ACE_OS::fclose (fp);
}
# endif /* ACE_HAS_IPV6 */
+
return 0;
#else
ACE_UNUSED_ARG (count);
@@ -1202,9 +1396,11 @@ ACE::get_ip_interfaces (size_t &count,
ACE_NOTSUP_RETURN (-1); // no implementation
#endif /* ACE_WIN32 */
}
+
// Helper routine for get_ip_interfaces, differs by UNIX platform so
// put into own subroutine. perform some ioctls to retrieve ifconf
// list of ifreq structs.
+
int
ACE::count_interfaces (ACE_HANDLE handle,
size_t &how_many)
@@ -1214,6 +1410,7 @@ ACE::count_interfaces (ACE_HANDLE handle,
ACE_UNUSED_ARG (handle);
ACE_UNUSED_ARG (how_many);
ACE_NOTSUP_RETURN (-1); // no implementation
+
#elif defined (SIOCGIFNUM)
# if defined (SIOCGLIFNUM)
int cmd = SIOCGLIFNUM;
@@ -1234,28 +1431,36 @@ ACE::count_interfaces (ACE_HANDLE handle,
how_many = if_num;
# endif /* SIOCGLIFNUM */
return 0;
+
#elif (defined (__unix) || defined (__unix__) || defined (__Lynx__) || defined (ACE_OPENVMS) || defined (ACE_HAS_RTEMS)) && !defined (ACE_LACKS_NETWORKING)
// Note: DEC CXX doesn't define "unix". BSD compatible OS: HP UX,
// AIX, SunOS 4.x perform some ioctls to retrieve ifconf list of
// ifreq structs no SIOCGIFNUM on SunOS 4.x, so use guess and scan
// algorithm
+
// Probably hard to put this many ifs in a unix box..
const int MAX_IF = 50;
+
// HACK - set to an unreasonable number
int num_ifs = MAX_IF;
+
struct ifconf ifcfg;
size_t ifreq_size = num_ifs * sizeof (struct ifreq);
struct ifreq *p_ifs =
(struct ifreq *) ACE_OS::malloc (ifreq_size);
+
if (!p_ifs)
{
errno = ENOMEM;
return -1;
}
+
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_CMD,
(caddr_t) &ifcfg) == -1)
@@ -1267,7 +1472,9 @@ return 0;
ACE_TEXT ("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;
@@ -1278,6 +1485,7 @@ return 0;
ifcfg.ifc_len -= sizeof (struct ifreq);
if (ifcfg.ifc_len < 0)
break;
+
++if_count;
#if !defined (__QNX__) && !defined (__FreeBSD__) && !defined(__NetBSD__) && !defined (ACE_HAS_RTEMS)
++p_ifs;
@@ -1293,9 +1501,12 @@ return 0;
}
#endif /* !defined (__QNX__) && !defined (__FreeBSD__) && !defined(__NetBSD__) */
}
+
ACE_OS::free (ifcfg.ifc_req);
+
# if defined (ACE_HAS_IPV6)
FILE* fp = 0;
+
if ((fp = ACE_OS::fopen (ACE_TEXT ("/proc/net/if_inet6"), ACE_TEXT ("r"))) != 0)
{
// Scan the lines according to the expected format but don't really read any input
@@ -1306,6 +1517,7 @@ return 0;
ACE_OS::fclose (fp);
}
# endif /* ACE_HAS_IPV6 */
+
how_many = if_count;
return 0;
#else
@@ -1314,7 +1526,9 @@ return 0;
ACE_NOTSUP_RETURN (-1); // no implementation
#endif /* sparc && SIOCGIFNUM */
}
+
// Routine to return a handle from which ioctl() requests can be made.
+
ACE_HANDLE
ACE::get_handle (void)
{
@@ -1325,11 +1539,13 @@ ACE::get_handle (void)
#elif defined (__unix) || defined (__unix__) || defined (__Lynx__) || defined (_AIX) || defined (__hpux) || (defined (ACE_VXWORKS) && (ACE_VXWORKS >= 0x600)) || defined (ACE_OPENVMS) || defined (ACE_HAS_RTEMS)
// Note: DEC CXX doesn't define "unix" BSD compatible OS: HP UX,
// AIX, SunOS 4.x
+
handle = ACE_OS::socket (PF_INET, SOCK_DGRAM, 0);
#endif /* sparc */
return handle;
}
+
#if defined (ACE_HAS_IPV6)
static int
ip_check (int &ipvn_enabled, int pf)
@@ -1338,6 +1554,7 @@ ip_check (int &ipvn_enabled, int pf)
// Perform Double-Checked Locking Optimization.
ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon,
*ACE_Static_Object_Lock::instance (), 0));
+
if (ipvn_enabled == -1)
{
// Determine if the kernel has IPv6 support by attempting to
@@ -1356,6 +1573,7 @@ ip_check (int &ipvn_enabled, int pf)
return ipvn_enabled;
}
#endif /* ACE_HAS_IPV6 */
+
bool
ACE::ipv4_enabled (void)
{
@@ -1369,6 +1587,7 @@ ACE::ipv4_enabled (void)
return true;
#endif /* ACE_HAS_IPV6*/
}
+
int
ACE::ipv6_enabled (void)
{
@@ -1380,5 +1599,6 @@ ACE::ipv6_enabled (void)
return 0;
#endif /* !ACE_HAS_IPV6 */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Sock_Connect.h b/dep/ACE_wrappers/ace/Sock_Connect.h
index 451ee09aa1e..195dfcdf116 100644
--- a/dep/ACE_wrappers/ace/Sock_Connect.h
+++ b/dep/ACE_wrappers/ace/Sock_Connect.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file Sock_Connect.h
@@ -9,25 +10,35 @@
* @author Based on code that existed formerly in ACE.h.
*/
//==========================================================================
+
#ifndef ACE_SOCK_CONNECT_H
#define ACE_SOCK_CONNECT_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Basic_Types.h"
#include "ace/os_include/netinet/os_in.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward Declarations
class ACE_INET_Addr;
+
namespace ACE
{
// = Socket connection establishment calls.
+
/// Bind a new unused port to @a handle.
extern ACE_Export int bind_port (ACE_HANDLE handle,
ACE_UINT32 ip_addr = INADDR_ANY,
int address_family = AF_UNSPEC);
+
/**
* Get our broadcast address based on our @a host_addr. If
* @a hostname is non-0 we'll use it to determine our IP address. If
@@ -41,10 +52,12 @@ namespace ACE
const ACE_TCHAR *hostname = 0,
ACE_UINT32 host_addr = 0,
ACE_HANDLE handle = ACE_INVALID_HANDLE);
+
/// Get fully qualified host/domain name.
extern ACE_Export int get_fqdn (ACE_INET_Addr const & addr,
char hostname[],
size_t len);
+
/**
* Return count and array of all configured IP interfaces on this
* host, rc = 0 on success (count == number of interfaces else -1).
@@ -52,6 +65,7 @@ namespace ACE
*/
extern ACE_Export int get_ip_interfaces (size_t &count,
ACE_INET_Addr *&addr_array);
+
/**
* Helper routine for get_ip_interfaces, differs by UNIX platform so
* put into own subroutine. perform some ioctls to retrieve ifconf
@@ -59,9 +73,11 @@ namespace ACE
*/
extern ACE_Export int count_interfaces (ACE_HANDLE handle,
size_t &how_many);
+
/// Routine to return a handle from which @c ioctl requests can be
/// made. Caller must close the handle.
extern ACE_Export ACE_HANDLE get_handle (void);
+
/// Returns @c true if IPv4 is enabled on the current host; @c false
/// if not.
/**
@@ -72,6 +88,7 @@ namespace ACE
gets checked once.
*/
extern ACE_Export bool ipv4_enabled (void);
+
/**
* Returns 1 if IPv6 is enabled on the current host; 0 if not.
* This is an execution-time check. If ACE has not been compiled
@@ -82,7 +99,10 @@ namespace ACE
*/
extern ACE_Export int ipv6_enabled (void);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
+
#endif /* ACE_SOCK_CONNECT_H */
diff --git a/dep/ACE_wrappers/ace/Stack_Trace.cpp b/dep/ACE_wrappers/ace/Stack_Trace.cpp
index e1e072de96e..1654e599336 100644
--- a/dep/ACE_wrappers/ace/Stack_Trace.cpp
+++ b/dep/ACE_wrappers/ace/Stack_Trace.cpp
@@ -11,16 +11,21 @@
* VxWorks FAQ, etc., and adapted for use here.
*/
//=============================================================================
+
#include "ace/Stack_Trace.h"
#include "ace/Min_Max.h"
#include "ace/OS_NS_string.h"
#include "ace/OS_NS_stdio.h"
+
ACE_RCSID (ace, Stack_Trace, "$Id: Stack_Trace.cpp 82575 2008-08-08 20:36:10Z mitza $")
+
/*
This is ugly, simply because it's very platform-specific.
*/
+
const char ACE_Stack_Trace::UNSUPPORTED[] = "<stack traces unsupported platform>";
const char ACE_Stack_Trace::UNABLE_TO_GET_TRACE[] = "<unable to get trace>";
+
ACE_Stack_Trace::ACE_Stack_Trace (ssize_t starting_frame_offset, size_t num_frames)
: buflen_(0)
{
@@ -28,35 +33,44 @@ ACE_Stack_Trace::ACE_Stack_Trace (ssize_t starting_frame_offset, size_t num_fram
this->buf_[0] = '\0';
this->generate_trace (starting_frame_offset, num_frames);
}
+
const char*
ACE_Stack_Trace::c_str () const
{
return &this->buf_[0];
}
+
static inline size_t
determine_starting_frame (ssize_t initial_frame, ssize_t offset)
{
return ACE_MAX( initial_frame + offset, static_cast<ssize_t>(0));
}
+
#if (defined(__GLIBC__) || defined(ACE_HAS_EXECINFO_H)) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
// This is the code for glibc
# include <execinfo.h>
+
void
ACE_Stack_Trace::generate_trace (ssize_t starting_frame_offset, size_t num_frames)
{
const size_t MAX_FRAMES = 128;
const ssize_t INITIAL_FRAME = 3;
+
void* stack[MAX_FRAMES];
size_t stack_size = 0;
char** stack_syms;
+
if (num_frames == 0)
num_frames = MAX_FRAMES;
+
size_t starting_frame =
determine_starting_frame (INITIAL_FRAME, starting_frame_offset);
+
stack_size = ::backtrace (&stack[0], sizeof(stack)/sizeof(stack[0]));
if (stack_size != 0)
{
stack_syms = ::backtrace_symbols (stack, stack_size);
+
for (size_t i = starting_frame;
i < stack_size && num_frames > 0;
i++, num_frames--)
@@ -70,6 +84,7 @@ ACE_Stack_Trace::generate_trace (ssize_t starting_frame_offset, size_t num_frame
this->buf_[this->buflen_++] = '\n'; // put a newline at the end
}
this->buf_[this->buflen_+1] = '\0'; // zero terminate the string
+
::free (stack_syms);
}
else
@@ -80,19 +95,23 @@ ACE_Stack_Trace::generate_trace (ssize_t starting_frame_offset, size_t num_frame
#elif defined(VXWORKS) && !defined(__RTP__)
# include <trcLib.h>
# include <taskLib.h> // hopefully this is enough to get all the necessary #defines.
+
struct ACE_Stack_Trace_stackstate
{
ACE_Stack_Trace_stackstate (char* b, size_t& bl, size_t nf, size_t sf)
: buf(b), buflen(bl), num_frames(nf), starting_frame(sf)
{ }
+
char* buf;
size_t& buflen;
size_t num_frames;
size_t starting_frame;
};
+
//@TODO: Replace with a TSS-based pointer to avoid problems in multithreaded environs,
// or use a mutex to serialize access to this.
static ACE_Stack_Trace_stackstate* ACE_Stack_Trace_stateptr = 0;
+
static void
ACE_Stack_Trace_Add_Frame_To_Buf (INSTR *caller,
unsigned int func,
@@ -101,21 +120,28 @@ ACE_Stack_Trace_Add_Frame_To_Buf (INSTR *caller,
{
if (ACE_Stack_Trace_stateptr == 0)
return;
+
ACE_Stack_Trace_stackstate *stackstate = ACE_Stack_Trace_stateptr;
+
// Decrement the num_frames and starting_frame elements,
// then see if we're ready to start or ready to finish.
--stackstate->num_frames;
--stackstate->starting_frame;
+
if (stackstate->num_frames == 0 || stackstate->starting_frame > 0)
return;
+
// These are references so that the structure gets updated
// in the code below.
char*& buf = stackstate->buf;
unsigned int& len = stackstate->buflen;
+
// At some point try using symFindByValue() to lookup func (and caller?)
// to print out symbols rather than simply addresses.
+
// VxWorks can pass -1 for "nargs" if there was an error
if (nargs == static_cast<unsigned int> (-1)) nargs = 0;
+
len += ACE_OS::sprintf (&buf[len], "%#10x: %#10x (", (int)caller, func);
for (unsigned int i = 0; i < nargs; ++i)
{
@@ -123,81 +149,104 @@ ACE_Stack_Trace_Add_Frame_To_Buf (INSTR *caller,
len += ACE_OS::sprintf (&buf[len], ", ");
len += ACE_OS::sprintf(&buf [len], "%#x", args [i]);
}
+
len += ACE_OS::sprintf(&buf[len], ")\n");
}
+
void
ACE_Stack_Trace::generate_trace (ssize_t starting_frame_offset,
size_t num_frames)
{
const size_t MAX_FRAMES = 128;
const ssize_t INITIAL_FRAME = 3;
+
if (num_frames == 0)
num_frames = MAX_FRAMES;
+
size_t starting_frame =
determine_starting_frame (INITIAL_FRAME, starting_frame_offset);
+
ACE_Stack_Trace_stackstate state (&this->buf_[0], this->buflen_,
num_frames, starting_frame);
+
REG_SET regs;
+
taskRegsGet ((int)taskIdSelf(), &regs);
// Maybe we should take a lock here to guard stateptr?
ACE_Stack_Trace_stateptr = &state;
trcStack (&regs, (FUNCPTR)ACE_Stack_Trace_Add_Frame_To_Buf, taskIdSelf ());
}
+
#elif defined(VXWORKS) && defined(__RTP__)
# include <setjmp.h>
# include <taskLib.h>
# include <private/trcLibP.h>
+
// See memEdrLib.c in VxWorks RTP sources for an example of stack tracing.
+
static STATUS ace_vx_rtp_pc_validate (INSTR *pc, TRC_OS_CTX *pOsCtx)
{
return ALIGNED (pc, sizeof (INSTR)) ? OK : ERROR;
}
+
void
ACE_Stack_Trace::generate_trace (ssize_t starting_frame_offset,
size_t num_frames)
{
const size_t MAX_FRAMES = 128;
const ssize_t INITIAL_FRAME = 2;
+
if (num_frames == 0) num_frames = MAX_FRAMES;
size_t starting_frame =
determine_starting_frame (INITIAL_FRAME, starting_frame_offset);
+
jmp_buf regs;
setjmp (regs);
+
TASK_DESC desc;
if (taskInfoGet (taskIdSelf (), &desc) == ERROR) return;
+
TRC_OS_CTX osCtx;
osCtx.stackBase = desc.td_pStackBase;
osCtx.stackEnd = desc.td_pStackEnd;
osCtx.pcValidateRtn = reinterpret_cast<FUNCPTR> (ace_vx_rtp_pc_validate);
+
char *fp = _WRS_FRAMEP_FROM_JMP_BUF (regs);
INSTR *pc = _WRS_RET_PC_FROM_JMP_BUF (regs);
+
for (size_t depth = 0; depth < num_frames + starting_frame; ++depth)
{
char *prevFp;
INSTR *prevPc;
INSTR *prevFn;
+
if (trcLibFuncs.lvlInfoGet (fp, pc, &osCtx, &prevFp, &prevPc, &prevFn)
== ERROR)
{
ACE_OS::strcpy (this->buf_, UNABLE_TO_GET_TRACE);
return;
}
+
if(prevPc == 0 || prevFp == 0) break;
+
if (depth >= starting_frame)
{
//Hopefully a future version of VxWorks will have a system call
//for an RTP to query its own symbols, but this is not possible now.
//An enhancement request has been filed under WIND00123307.
const char *fnName = "(no symbols)";
+
static const int N_ARGS = 12;
int buf[N_ARGS];
int *pArgs = 0;
int numArgs =
trcLibFuncs.lvlArgsGet (prevPc, prevFn, prevFp,
buf, N_ARGS, &pArgs);
+
// VxWorks can return -1 for "numArgs" if there was an error
if (numArgs == -1) numArgs = 0;
+
size_t len = ACE_OS::strlen (this->buf_);
size_t space = SYMBUFSIZ - len - 1;
char *cursor = this->buf_ + len;
@@ -205,6 +254,7 @@ ACE_Stack_Trace::generate_trace (ssize_t starting_frame_offset,
prevFn, fnName);
cursor += written;
space -= written;
+
if (space < 1) return; //no point in logging when we're out of buffer
for (int arg = 0; numArgs != -1 && pArgs && arg < numArgs; ++arg)
{
@@ -219,20 +269,24 @@ ACE_Stack_Trace::generate_trace (ssize_t starting_frame_offset,
if (space) *cursor++ = '\n', --space;
*cursor++ = 0; //we saved space for the null terminator
}
+
fp = prevFp;
pc = prevPc;
}
}
+
#elif defined(sun)
/*
* walks up call stack, printing library:routine+offset for each routine
*/
+
# include <dlfcn.h>
# include <setjmp.h>
# include <sys/types.h>
# include <sys/reg.h>
# include <sys/frame.h>
# define ACE_STACK_TRACE_BIAS 0
+
# if defined(sparc) || defined(__sparc)
# define ACE_STACK_TRACE_FLUSHWIN() asm("ta 3");
# define ACE_STACK_TRACE_FRAME_PTR_INDEX 1
@@ -242,21 +296,25 @@ ACE_Stack_Trace::generate_trace (ssize_t starting_frame_offset,
# define ACE_STACK_TRACE_BIAS 2047
# endif
# endif
+
# if defined(i386) || defined(__i386)
# define ACE_STACK_TRACE_FLUSHWIN()
# define ACE_STACK_TRACE_FRAME_PTR_INDEX 3
# define ACE_STACK_TRACE_SKIP_FRAMES 0
# endif
+
# if defined(__amd64) || defined(__x86_64)
# define ACE_STACK_TRACE_FLUSHWIN()
# define ACE_STACK_TRACE_FRAME_PTR_INDEX 5
# define ACE_STACK_TRACE_SKIP_FRAMES 0
# endif
+
# if defined(ppc) || defined(__ppc)
# define ACE_STACK_TRACE_FLUSHWIN()
# define ACE_STACK_TRACE_FRAME_PTR_INDEX 0
# define ACE_STACK_TRACE_SKIP_FRAMES 2
# endif
+
static frame*
cs_frame_adjust(frame* sp)
{
@@ -264,23 +322,28 @@ cs_frame_adjust(frame* sp)
sp_byte += ACE_STACK_TRACE_BIAS;
return (frame*) sp_byte;
}
+
/*
this function walks up call stack, calling user-supplied
function once for each stack frame, passing the pc and the user-supplied
usrarg as the argument.
*/
+
static int
cs_operate(int (*func)(void *, void *), void * usrarg,
size_t starting_frame, size_t num_frames_arg)
{
ACE_STACK_TRACE_FLUSHWIN();
+
jmp_buf env;
setjmp(env);
frame* sp = cs_frame_adjust((frame*) env[ACE_STACK_TRACE_FRAME_PTR_INDEX]);
+
// make a copy of num_frames_arg to eliminate the following warning on some
// solaris platforms:
// Stack_Trace.cpp:318: warning: argument `size_t num_frames' might be clobbered by `longjmp' or `vfork'
size_t num_frames = num_frames_arg;
+
// I would like to use ACE_MAX below rather than ?:, but
// I get linker relocation errors such as the following when
// I use it:
@@ -302,7 +365,9 @@ cs_operate(int (*func)(void *, void *), void * usrarg,
{
sp = cs_frame_adjust((frame*) sp->fr_savfp);
}
+
i = 0;
+
while ( sp
&& sp->fr_savpc
&& ++i
@@ -311,8 +376,10 @@ cs_operate(int (*func)(void *, void *), void * usrarg,
{
sp = cs_frame_adjust((frame*) sp->fr_savfp);
}
+
return(i);
}
+
static int
add_frame_to_buf (void* pc, void* usrarg)
{
@@ -320,11 +387,13 @@ add_frame_to_buf (void* pc, void* usrarg)
Dl_info info;
const char* func = "??";
const char* lib = "??";
+
if(dladdr(pc, & info) != 0)
{
lib = (const char *) info.dli_fname;
func = (const char *) info.dli_sname;
}
+
(void) ACE_OS::snprintf(buf,
ACE_Stack_Trace::SYMBUFSIZ,
"%s%s:%s+0x%x\n",
@@ -336,20 +405,26 @@ add_frame_to_buf (void* pc, void* usrarg)
//would be ptrdiff_t, and what is the correct
//sprintf() conversion character for that?
(size_t)pc - (size_t)info.dli_saddr);
+
return(1);
}
+
void
ACE_Stack_Trace::generate_trace (ssize_t starting_frame_offset,
size_t num_frames)
{
const size_t MAX_FRAMES = 128;
const ssize_t INITIAL_FRAME = 3;
+
if (num_frames == 0)
num_frames = MAX_FRAMES;
+
size_t starting_frame =
determine_starting_frame (INITIAL_FRAME, starting_frame_offset);
+
cs_operate (&add_frame_to_buf, &this->buf_[0], starting_frame, num_frames);
}
+
#elif defined(ACE_WIN64) && (_WIN32_WINNT <= _WIN32_WINNT_WIN2K)
# if defined(_MSC_VER)
# define STRING2(X) #X
@@ -366,34 +441,45 @@ ACE_Stack_Trace::generate_trace (ssize_t, size_t)
ACE_OS::strcpy (&this->buf_[0], "<stack traces unsupported on Win64 unless "
"ACE is built with _WIN32_WINNT set to 0x501 or above>");
}
+
#elif defined(ACE_WIN32) && !defined(ACE_HAS_WINCE) && !defined (__MINGW32__) \
&& !defined(__BORLANDC__)
# include <windows.h>
# include <Dbghelp.h>
+
# define MAXTEXT 5000
# define SYMSIZE 100
+
//@TODO: Test with WCHAR
//@TODO: Need a common CriticalSection since dbghelp is not thread-safe
+
typedef struct _dbghelp_functions
{
HMODULE hMod; //our handle to dbghelp.dll
+
//these already have typedefs in DbgHelp.h
DWORD64 (WINAPI *SymGetModuleBase64) (HANDLE hProc, DWORD64 dwAddr);
PVOID (WINAPI *SymFunctionTableAccess64) (HANDLE hProc, DWORD64 AddrBase);
+
typedef BOOL (WINAPI *SymFromAddr_t)
(HANDLE hProc, DWORD64 Addr, PDWORD64 Disp, PSYMBOL_INFO Symbol);
SymFromAddr_t SymFromAddr;
+
typedef BOOL (WINAPI *SymGetLineFromAddr64_t) (HANDLE hProc, DWORD64 dwAddr,
PDWORD pdwDisplacement,
PIMAGEHLP_LINE64 Line);
SymGetLineFromAddr64_t SymGetLineFromAddr64;
+
typedef DWORD (WINAPI *SymSetOptions_t) (DWORD SymOptions);
SymSetOptions_t SymSetOptions;
+
typedef DWORD (WINAPI *SymGetOptions_t) ();
SymGetOptions_t SymGetOptions;
+
typedef BOOL (WINAPI *SymInitialize_t) (HANDLE hProc, PCTSTR UserSearchPath,
BOOL invasive);
SymInitialize_t SymInitialize;
+
typedef BOOL
(WINAPI *StackWalk64_t) (DWORD MachineType, HANDLE hPRoc, HANDLE hThr,
LPSTACKFRAME64 StackFrame, PVOID ContextRecord,
@@ -402,10 +488,12 @@ typedef struct _dbghelp_functions
PGET_MODULE_BASE_ROUTINE64 GMBRoutine,
PTRANSLATE_ADDRESS_ROUTINE64 TranslateAddress);
StackWalk64_t StackWalk64;
+
typedef BOOL (WINAPI *SymCleanup_t) (HANDLE hProc);
SymCleanup_t SymCleanup;
} dbghelp_functions;
+
# pragma warning (push)
# pragma warning (disable:4706)
static bool load_dbghelp_library_if_needed (dbghelp_functions *pDbg)
@@ -415,7 +503,9 @@ static bool load_dbghelp_library_if_needed (dbghelp_functions *pDbg)
//first on the path.
if (!(pDbg->hMod = ACE_TEXT_LoadLibrary (ACE_TEXT ("Dbghelp"))))
return false;
+
//@TODO: Cache this so we don't have to re-link every time. When to unload?
+
# define LINK(TYPE, NAME) (pDbg->NAME = \
(TYPE) GetProcAddress (pDbg->hMod, #NAME))
# define LINK_T(NAME) LINK (dbghelp_functions::NAME##_t, NAME)
@@ -429,17 +519,21 @@ static bool load_dbghelp_library_if_needed (dbghelp_functions *pDbg)
}
# pragma warning (pop)
+
struct frame_state {
STACKFRAME64 sf;
PSYMBOL_INFO pSym;
dbghelp_functions *pDbg;
};
+
static int
add_frame_to_buf (struct frame_state const *fs, void *usrarg)
{
if (fs == 0 || usrarg == 0)
return -1;
+
char *buf = static_cast<char *> (usrarg);
+
DWORD64 disp;
DWORD64 dwModBase = fs->pDbg->SymGetModuleBase64 (GetCurrentProcess (),
fs->sf.AddrPC.Offset);
@@ -473,7 +567,9 @@ add_frame_to_buf (struct frame_state const *fs, void *usrarg)
}
return 0;
}
+
static void emptyStack () { }
+
static int
cs_operate(int (*func)(struct frame_state const *, void *), void *usrarg,
size_t starting_frame, size_t num_frames)
@@ -486,13 +582,16 @@ cs_operate(int (*func)(struct frame_state const *, void *), void *usrarg,
if (dbg.hMod) FreeLibrary (dbg.hMod);
return 1;
}
+
frame_state fs;
ZeroMemory (&fs.sf, sizeof (fs.sf));
fs.pDbg = &dbg;
emptyStack (); //Not sure what this should do, Chad?
+
CONTEXT c;
ZeroMemory (&c, sizeof (CONTEXT));
c.ContextFlags = CONTEXT_FULL;
+
# if defined (_M_IX86)
DWORD machine = IMAGE_FILE_MACHINE_I386;
__asm {
@@ -529,6 +628,7 @@ cs_operate(int (*func)(struct frame_state const *, void *), void *usrarg,
fs.sf.AddrBStore.Mode = AddrModeFlat;
fs.sf.AddrStack.Mode = AddrModeFlat;
# endif
+
fs.pSym = (PSYMBOL_INFO) GlobalAlloc (GMEM_FIXED,
sizeof (SYMBOL_INFO) +
sizeof (ACE_TCHAR) * (SYMSIZE - 1));
@@ -538,6 +638,7 @@ cs_operate(int (*func)(struct frame_state const *, void *), void *usrarg,
| SYMOPT_FAIL_CRITICAL_ERRORS | dbg.SymGetOptions ());
dbg.SymInitialize (GetCurrentProcess (), 0, true);
//What does the "true" parameter mean when tracing the current process?
+
for (size_t current_frame = 0; current_frame < num_frames + starting_frame;
++current_frame)
{
@@ -549,27 +650,36 @@ cs_operate(int (*func)(struct frame_state const *, void *), void *usrarg,
dbg.SymGetModuleBase64, 0);
if (!ok || fs.sf.AddrFrame.Offset == 0)
break;
+
if (current_frame < starting_frame)
continue;
+
func (&fs, usrarg);
}
+
dbg.SymCleanup (GetCurrentProcess ());
GlobalFree (fs.pSym);
FreeLibrary (dbg.hMod);
+
return 0;
}
+
void
ACE_Stack_Trace::generate_trace (ssize_t starting_frame_offset,
size_t num_frames)
{
const size_t MAX_FRAMES = 128;
const ssize_t INITIAL_FRAME = 3;
+
if (num_frames == 0)
num_frames = MAX_FRAMES;
+
size_t starting_frame =
determine_starting_frame (INITIAL_FRAME, starting_frame_offset);
+
cs_operate (&add_frame_to_buf, &this->buf_[0], starting_frame, num_frames);
}
+
#else // Unsupported platform
void
ACE_Stack_Trace::generate_trace (ssize_t, size_t)
@@ -579,7 +689,9 @@ ACE_Stack_Trace::generate_trace (ssize_t, size_t)
#if defined (__HP_aCC)
size_t starting_frame = determine_starting_frame (0, 0);
#endif
+
ACE_OS::strcpy (&this->buf_[0], UNSUPPORTED);
}
#endif
+
diff --git a/dep/ACE_wrappers/ace/Stack_Trace.h b/dep/ACE_wrappers/ace/Stack_Trace.h
index 4f664c72e44..b2fc0174ab6 100644
--- a/dep/ACE_wrappers/ace/Stack_Trace.h
+++ b/dep/ACE_wrappers/ace/Stack_Trace.h
@@ -8,17 +8,23 @@
* @author Chris Cleeland (cleeland.ociweb.com)
*/
//=============================================================================
+
#ifndef ACE_STACK_TRACE_H
#define ACE_STACK_TRACE_H
+
#include /**/ "ace/pre.h"
+
#include "ace/ACE_export.h"
#include "ace/Basic_Types.h"
+
# if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
# endif /* ACE_LACKS_PRAGMA_ONCE */
+
# ifndef ACE_STACK_TRACE_SYMBUFSIZ
# define ACE_STACK_TRACE_SYMBUFSIZ 4096
# endif
+
/**
* @class ACE_Stack_Trace
*
@@ -76,20 +82,27 @@ public:
*
*/
explicit ACE_Stack_Trace (ssize_t starting_frame_offset = 0, size_t num_frames = 0);
+
/**
* @brief Return buffer as a C-style string.
* @return C-style string with string representation of stack trace.
* @note Lifecycle of string follows lifecycle of ACE_Stack_Trace instance.
*/
const char* c_str() const;
+
static const size_t SYMBUFSIZ = ACE_STACK_TRACE_SYMBUFSIZ;
+
private:
char buf_[SYMBUFSIZ];
size_t buflen_;
+
static const char UNSUPPORTED[];
static const char UNABLE_TO_GET_TRACE[];
+
void generate_trace (ssize_t starting_frame_offset, size_t num_frames);
};
+
#include /**/ "ace/post.h"
#endif /* ACE_STACK_TRACE_H */
+
diff --git a/dep/ACE_wrappers/ace/Static_Object_Lock.h b/dep/ACE_wrappers/ace/Static_Object_Lock.h
index 14d57dfe451..c1d533552cb 100644
--- a/dep/ACE_wrappers/ace/Static_Object_Lock.h
+++ b/dep/ACE_wrappers/ace/Static_Object_Lock.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Static_Object_Lock.h
@@ -10,16 +11,23 @@
* @author Per Andersson
*/
//=============================================================================
+
#ifndef ACE_STATIC_OBJECT_LOCK_H
#define ACE_STATIC_OBJECT_LOCK_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_THREADS)
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Recursive_Thread_Mutex;
+
/**
* @class ACE_Static_Object_Lock
*
@@ -35,26 +43,37 @@ class ACE_Export ACE_Static_Object_Lock
public:
/// Static lock access point.
static ACE_Recursive_Thread_Mutex *instance (void);
+
/// For use only by ACE_Object_Manager to clean up lock if it
/// what dynamically allocated.
static void cleanup_lock (void);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_THREADS */
+
// hack to get around errors while compiling using split-cpp
#if defined (ACE_HAS_THREADS)
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
# if defined (ACE_IS_SPLITTING)
typedef ACE_Cleanup_Adapter<ACE_Recursive_Thread_Mutex> ACE_Static_Object_Lock_Type;
+
# if defined (__GNUC__)
// With g++, suppress the warning that this is unused.
static ACE_Static_Object_Lock_Type *ACE_Static_Object_Lock_lock __attribute__ ((unused)) = 0;
# else
static ACE_Static_Object_Lock_Type *ACE_Static_Object_Lock_lock = 0;
# endif /* __GNUC__ */
+
# endif /* ACE_IS_SPLITTING */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_THREADS */
+
#include /**/ "ace/post.h"
#endif /* ACE_STATIC_OBJECT_LOCK_H */
diff --git a/dep/ACE_wrappers/ace/Stats.cpp b/dep/ACE_wrappers/ace/Stats.cpp
index 6375616c3a6..eac726e52df 100644
--- a/dep/ACE_wrappers/ace/Stats.cpp
+++ b/dep/ACE_wrappers/ace/Stats.cpp
@@ -1,12 +1,18 @@
// $Id: Stats.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Stats.h"
+
#if !defined (__ACE_INLINE__)
# include "ace/Stats.inl"
#endif /* __ACE_INLINE__ */
+
#include "ace/OS_NS_stdio.h"
#include "ace/OS_NS_string.h"
+
ACE_RCSID(ace, Stats, "$Id: Stats.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_UINT32
ACE_Stats_Value::fractional_field (void) const
{
@@ -21,9 +27,11 @@ ACE_Stats_Value::fractional_field (void) const
{
field *= 10;
}
+
return field;
}
}
+
int
ACE_Stats::sample (const ACE_INT32 value)
{
@@ -36,10 +44,13 @@ ACE_Stats::sample (const ACE_INT32 value)
overflow_ = EFAULT;
return -1;
}
+
if (value < min_)
min_ = value;
+
if (value > max_)
max_ = value;
+
return 0;
}
else
@@ -50,6 +61,7 @@ ACE_Stats::sample (const ACE_INT32 value)
return -1;
}
}
+
void
ACE_Stats::mean (ACE_Stats_Value &m,
const ACE_UINT32 scale_factor)
@@ -65,6 +77,7 @@ ACE_Stats::mean (ACE_Stats_Value &m,
const ACE_UINT64 ACE_STATS_INTERNAL_OFFSET =
ACE_UINT64_LITERAL (0x100000000);
#endif /* ! ACE_LACKS_LONGLONG_T */
+
ACE_UINT64 sum = ACE_STATS_INTERNAL_OFFSET;
ACE_Unbounded_Queue_Iterator<ACE_INT32> i (samples_);
while (! i.done ())
@@ -76,6 +89,7 @@ ACE_Stats::mean (ACE_Stats_Value &m,
i.advance ();
}
}
+
// sum_ was initialized with ACE_STATS_INTERNAL_OFFSET, so
// subtract that off here.
quotient (sum - ACE_STATS_INTERNAL_OFFSET,
@@ -88,6 +102,7 @@ ACE_Stats::mean (ACE_Stats_Value &m,
m.fractional (0);
}
}
+
int
ACE_Stats::std_dev (ACE_Stats_Value &std_dev,
const ACE_UINT32 scale_factor)
@@ -100,15 +115,18 @@ ACE_Stats::std_dev (ACE_Stats_Value &std_dev,
else
{
const ACE_UINT32 field = std_dev.fractional_field ();
+
// The sample standard deviation is:
//
// sqrt (sum (sample_i - mean)^2 / (number_of_samples_ - 1))
+
ACE_UINT64 mean_scaled;
// Calculate the mean, scaled, so that we don't lose its
// precision.
ACE_Stats_Value avg (std_dev.precision ());
mean (avg, 1u);
avg.scaled_value (mean_scaled);
+
// Calculate the summation term, of squared differences from the
// mean.
ACE_UINT64 sum_of_squares = 0;
@@ -119,9 +137,11 @@ ACE_Stats::std_dev (ACE_Stats_Value &std_dev,
if (i.next (sample))
{
const ACE_UINT64 original_sum_of_squares = sum_of_squares;
+
// Scale up by field width so that we don't lose the
// precision of the mean. Carefully . . .
const ACE_UINT64 product (*sample * field);
+
ACE_UINT64 difference;
// NOTE: please do not reformat this code! It //
// works with the Diab compiler the way it is! //
@@ -135,9 +155,11 @@ ACE_Stats::std_dev (ACE_Stats_Value &std_dev,
} //
// NOTE: please do not reformat this code! It //
// works with the Diab compiler the way it is! //
+
// Square using 64-bit arithmetic.
sum_of_squares += difference * ACE_U64_TO_U32 (difference);
i.advance ();
+
if (sum_of_squares < original_sum_of_squares)
{
overflow_ = ENOSPC;
@@ -145,6 +167,7 @@ ACE_Stats::std_dev (ACE_Stats_Value &std_dev,
}
}
}
+
// Divide the summation by (number_of_samples_ - 1), to get the
// variance. In addition, scale the variance down to undo the
// mean scaling above. Otherwise, it can get too big.
@@ -152,24 +175,29 @@ ACE_Stats::std_dev (ACE_Stats_Value &std_dev,
quotient (sum_of_squares,
(number_of_samples_ - 1) * field * field,
variance);
+
// Take the square root of the variance to get the standard
// deviation. First, scale up . . .
ACE_UINT64 scaled_variance;
variance.scaled_value (scaled_variance);
+
// And scale up, once more, because we'll be taking the square
// root.
scaled_variance *= field;
ACE_Stats_Value unscaled_standard_deviation (std_dev.precision ());
square_root (scaled_variance,
unscaled_standard_deviation);
+
// Unscale.
quotient (unscaled_standard_deviation,
scale_factor * field,
std_dev);
}
+
return 0;
}
+
void
ACE_Stats::reset (void)
{
@@ -179,6 +207,7 @@ ACE_Stats::reset (void)
max_ = -0x8000 * 0x10000;
samples_.reset ();
}
+
int
ACE_Stats::print_summary (const u_int precision,
const ACE_UINT32 scale_factor,
@@ -189,6 +218,7 @@ ACE_Stats::print_summary (const u_int precision,
ACE_TCHAR min_string [128];
ACE_TCHAR max_string [128];
int success = 0;
+
for (int tmp_precision = precision;
! overflow_ && ! success && tmp_precision >= 0;
--tmp_precision)
@@ -199,9 +229,11 @@ ACE_Stats::print_summary (const u_int precision,
ACE_OS::sprintf (format, ACE_TEXT ("%%%d"), tmp_precision);
else
ACE_OS::sprintf (format, ACE_TEXT ("%%d.%%0%du"), tmp_precision);
+
ACE_Stats_Value u (tmp_precision);
((ACE_Stats *) this)->mean (u, scale_factor);
ACE_OS::sprintf (mean_string, format, u.whole (), u.fractional ());
+
ACE_Stats_Value sd (tmp_precision);
if (((ACE_Stats *) this)->std_dev (sd, scale_factor))
{
@@ -213,6 +245,7 @@ ACE_Stats::print_summary (const u_int precision,
success = 1;
}
ACE_OS::sprintf (std_dev_string, format, sd.whole (), sd.fractional ());
+
ACE_Stats_Value minimum (tmp_precision), maximum (tmp_precision);
if (min_ != 0)
{
@@ -229,6 +262,7 @@ ACE_Stats::print_summary (const u_int precision,
ACE_OS::sprintf (max_string, format,
maximum.whole (), maximum.fractional ());
}
+
if (success == 1)
{
ACE_OS::fprintf (file, ACE_TEXT ("samples: %u (%s - %s); mean: ")
@@ -251,6 +285,7 @@ ACE_Stats::print_summary (const u_int precision,
return -1;
}
}
+
void
ACE_Stats::quotient (const ACE_UINT64 dividend,
const ACE_UINT32 divisor,
@@ -259,10 +294,13 @@ ACE_Stats::quotient (const ACE_UINT64 dividend,
// The whole part of the division comes from simple integer division.
quotient.whole (static_cast<ACE_UINT32> (divisor == 0
? 0 : dividend / divisor));
+
if (quotient.precision () > 0 || divisor == 0)
{
const ACE_UINT32 field = quotient.fractional_field ();
+
// Fractional = (dividend % divisor) * 10^precision / divisor
+
// It would be nice to add round-up term:
// Fractional = (dividend % divisor) * 10^precision / divisor +
// 10^precision/2 / 10^precision
@@ -278,6 +316,7 @@ ACE_Stats::quotient (const ACE_UINT64 dividend,
quotient.fractional (0);
}
}
+
void
ACE_Stats::quotient (const ACE_Stats_Value &dividend,
const ACE_UINT32 divisor,
@@ -285,9 +324,11 @@ ACE_Stats::quotient (const ACE_Stats_Value &dividend,
{
// The whole part of the division comes from simple integer division.
quotient.whole (divisor == 0 ? 0 : dividend.whole () / divisor);
+
if (quotient.precision () > 0 || divisor == 0)
{
const ACE_UINT32 field = quotient.fractional_field ();
+
// Fractional = (dividend % divisor) * 10^precision / divisor.
quotient.fractional (dividend.whole () % divisor * field / divisor +
dividend.fractional () / divisor);
@@ -299,6 +340,7 @@ ACE_Stats::quotient (const ACE_Stats_Value &dividend,
quotient.fractional (0);
}
}
+
void
ACE_Stats::square_root (const ACE_UINT64 n,
ACE_Stats_Value &square_root)
@@ -307,6 +349,7 @@ ACE_Stats::square_root (const ACE_UINT64 n,
ACE_UINT32 ceiling = 0xFFFFFFFFu;
ACE_UINT32 mid = 0;
u_int i;
+
// The maximum number of iterations is log_2 (2^64) == 64.
for (i = 0; i < 64; ++i)
{
@@ -326,26 +369,35 @@ ACE_Stats::square_root (const ACE_UINT64 n,
ceiling = mid;
}
}
+
square_root.whole (mid);
ACE_UINT64 mid_squared = mid; mid_squared *= mid;
+
if (square_root.precision () && mid_squared < n)
{
// (mid * 10^precision + fractional)^2 ==
// n^2 * 10^(precision * 2)
+
const ACE_UINT32 field = square_root.fractional_field ();
+
floor = 0;
ceiling = field;
mid = 0;
+
// Do the 64-bit arithmetic carefully to avoid overflow.
ACE_UINT64 target = n;
target *= field;
target *= field;
+
ACE_UINT64 difference = 0;
+
for (i = 0; i < square_root.precision (); ++i)
{
mid = (ceiling - floor) / 2 + floor;
+
ACE_UINT64 current = square_root.whole () * field + mid;
current *= square_root.whole () * field + mid;
+
if (floor == mid)
{
difference = target - current;
@@ -356,9 +408,11 @@ ACE_Stats::square_root (const ACE_UINT64 n,
else
ceiling = mid;
}
+
// Check to see if the fractional part should be one greater.
ACE_UINT64 next = square_root.whole () * field + mid + 1;
next *= square_root.whole () * field + mid + 1;
+
square_root.fractional (next - target < difference ? mid + 1 : mid);
}
else
@@ -368,5 +422,6 @@ ACE_Stats::square_root (const ACE_UINT64 n,
square_root.fractional (0);
}
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Stats.h b/dep/ACE_wrappers/ace/Stats.h
index 5f833d241c3..1e60ef34dc1 100644
--- a/dep/ACE_wrappers/ace/Stats.h
+++ b/dep/ACE_wrappers/ace/Stats.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file Stats.h
@@ -9,17 +10,24 @@
*/
//==========================================================================
+
#ifndef ACE_STATS_H
#define ACE_STATS_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Unbounded_Queue.h"
#include "ace/Log_Msg.h"
#include "ace/Basic_Stats.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Stats_Value
*
@@ -42,41 +50,56 @@ public:
* non-trivial data sets.
*/
ACE_Stats_Value (const u_int precision);
+
/// Accessor for precision.
u_int precision (void) const;
+
/// Set the whole_ field.
void whole (const ACE_UINT32);
+
/// Accessor for the whole_ field.
ACE_UINT32 whole (void) const;
+
/// Set the fractional_ field.
void fractional (const ACE_UINT32);
+
/// Accessor for the fractional_ field.
ACE_UINT32 fractional (void) const;
+
/// Calculates the maximum value of the fractional portion, given its
/// precision.
ACE_UINT32 fractional_field (void) const;
+
/**
* Access the value as an _unsigned_ 64 bit quantity. It scales the
* value up by {precision} decimal digits, so that no precision will
* be lost. It assumes that {whole_} is >= 0.
*/
void scaled_value (ACE_UINT64 &) const;
+
/// Print to stdout.
void dump (void) const;
+
private:
+
ACE_Stats_Value (void) {}
+
private:
/// The integer portion of the value.
ACE_UINT32 whole_;
+
/// The fractional portion of the value.
ACE_UINT32 fractional_;
+
/**
* The number of decimal digits of precision represented by
* {fractional_}. Not declared const, so the only way to change it
* is via the assignment operator.
*/
u_int precision_;
+
};
+
/**
* @class ACE_Stats
*
@@ -108,15 +131,20 @@ class ACE_Export ACE_Stats
public:
/// Default constructor.
ACE_Stats (void);
+
/// Provide a new sample. Returns 0 on success, -1 if it fails due
/// to running out of memory, or to rolling over of the sample count.
int sample (const ACE_INT32 value);
+
/// Access the number of samples provided so far.
ACE_UINT32 samples (void) const;
+
/// Value of the minimum sample provided so far.
ACE_INT32 min_value (void) const;
+
/// Value of the maximum sample provided so far.
ACE_INT32 max_value (void) const;
+
/**
* Access the mean of all samples provided so far. The fractional
* part is to the specified number of digits. E.g., 3 fractional
@@ -124,10 +152,12 @@ public:
*/
void mean (ACE_Stats_Value &mean,
const ACE_UINT32 scale_factor = 1);
+
/// Access the standard deviation, whole and fractional parts. See
/// description of {mean} method for argument descriptions.
int std_dev (ACE_Stats_Value &std_dev,
const ACE_UINT32 scale_factor = 1);
+
/**
* Print summary statistics. If scale_factor is not 1, then the
* results are divided by it, i.e., each of the samples is scaled
@@ -138,16 +168,20 @@ public:
int print_summary (const u_int precision,
const ACE_UINT32 scale_factor = 1,
FILE * = stdout) const;
+
/// Initialize internal state.
void reset (void);
+
/// Utility division function, for ACE_UINT64 dividend.
static void quotient (const ACE_UINT64 dividend,
const ACE_UINT32 divisor,
ACE_Stats_Value &quotient);
+
/// Utility division function, for ACE_Stats_Value dividend.
static void quotient (const ACE_Stats_Value &dividend,
const ACE_UINT32 divisor,
ACE_Stats_Value &quotient);
+
/**
* Sqrt function, which uses an oversimplified version of Newton's
* method. It's not fast, but it doesn't require floating point
@@ -155,25 +189,35 @@ public:
*/
static void square_root (const ACE_UINT64 n,
ACE_Stats_Value &square_root);
+
/// Print summary statistics to stdout.
void dump (void) const;
+
protected:
/// Internal indication of whether there has been overflow. Contains
/// the errno corresponding to the cause of overflow.
u_int overflow_;
+
/// Number of samples.
ACE_UINT32 number_of_samples_;
+
/// Minimum sample value.
ACE_INT32 min_;
+
/// Maximum sample value.
ACE_INT32 max_;
+
/// The samples.
ACE_Unbounded_Queue <ACE_INT32> samples_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
# include "ace/Stats.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
+
#endif /* ! ACE_STATS_H */
diff --git a/dep/ACE_wrappers/ace/Stats.inl b/dep/ACE_wrappers/ace/Stats.inl
index 3901b3aa81b..4c76838c207 100644
--- a/dep/ACE_wrappers/ace/Stats.inl
+++ b/dep/ACE_wrappers/ace/Stats.inl
@@ -1,7 +1,9 @@
// -*- C++ -*-
//
// $Id: Stats.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_Stats_Value::ACE_Stats_Value (const u_int precision)
: whole_ (0),
@@ -9,42 +11,49 @@ ACE_Stats_Value::ACE_Stats_Value (const u_int precision)
precision_ (precision)
{
}
+
ACE_INLINE
u_int
ACE_Stats_Value::precision (void) const
{
return precision_;
}
+
ACE_INLINE
void
ACE_Stats_Value::whole (const ACE_UINT32 value)
{
whole_ = value;
}
+
ACE_INLINE
ACE_UINT32
ACE_Stats_Value::whole (void) const
{
return whole_;
}
+
ACE_INLINE
void
ACE_Stats_Value::fractional (const ACE_UINT32 value)
{
fractional_ = value;
}
+
ACE_INLINE
ACE_UINT32
ACE_Stats_Value::fractional (void) const
{
return fractional_;
}
+
ACE_INLINE
void
ACE_Stats_Value::scaled_value (ACE_UINT64 &sv) const
{
sv = whole () * fractional_field () + fractional ();
}
+
ACE_INLINE
void
ACE_Stats_Value::dump (void) const
@@ -55,29 +64,34 @@ ACE_Stats_Value::dump (void) const
precision_, whole_, fractional_));
#endif /* ACE_HAS_DUMP */
}
+
ACE_INLINE
ACE_Stats::ACE_Stats (void)
{
reset ();
}
+
ACE_INLINE
ACE_UINT32
ACE_Stats::samples (void) const
{
return number_of_samples_;
}
+
ACE_INLINE
ACE_INT32
ACE_Stats::min_value (void) const
{
return min_;
}
+
ACE_INLINE
ACE_INT32
ACE_Stats::max_value (void) const
{
return max_;
}
+
ACE_INLINE
void
ACE_Stats::dump (void) const
@@ -86,4 +100,5 @@ ACE_Stats::dump (void) const
print_summary (3u);
#endif /* ACE_HAS_DUMP */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Strategies.h b/dep/ACE_wrappers/ace/Strategies.h
index c57a08dba21..6ce48398f6e 100644
--- a/dep/ACE_wrappers/ace/Strategies.h
+++ b/dep/ACE_wrappers/ace/Strategies.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Strategies.h
@@ -8,13 +9,17 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_STRATEGIES_H
#define ACE_STRATEGIES_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
/// Place holder for backward compatibility..
#include "ace/Connection_Recycling_Strategy.h"
#include "ace/Hashable.h"
@@ -23,6 +28,7 @@
#include "ace/Recyclable.h"
#include "ace/Refcountable.h"
+
#include /**/ "ace/post.h"
#endif /*ACE_STRATEGIES_H*/
diff --git a/dep/ACE_wrappers/ace/Strategies_T.h b/dep/ACE_wrappers/ace/Strategies_T.h
index 2061bc7c74a..7bd0d6bb1a3 100644
--- a/dep/ACE_wrappers/ace/Strategies_T.h
+++ b/dep/ACE_wrappers/ace/Strategies_T.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Strategies_T.h
@@ -8,13 +9,18 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_STRATEGIES_T_H
#define ACE_STRATEGIES_T_H
+
#include /**/ "ace/pre.h"
+
#include "ace/Hash_Map_Manager_T.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Reactor.h"
#include "ace/Thread_Manager.h"
#include "ace/Connection_Recycling_Strategy.h"
@@ -22,10 +28,14 @@
#include "ace/Hashable.h"
#include "ace/Recyclable.h"
#include "ace/Reverse_Lock_T.h"
+
// Needed for broken linkers that can't grok long symbols.
#define ACE_Refcounted_Hash_Recyclable ARHR
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Service_Repository;
+
/**
* @class ACE_Recycling_Strategy
*
@@ -39,20 +49,25 @@ template<class SVC_HANDLER>
class ACE_Recycling_Strategy
{
public:
+
// Useful STL-style traits.
typedef typename SVC_HANDLER::addr_type addr_type;
typedef SVC_HANDLER handler_type;
typedef typename SVC_HANDLER::stream_type stream_type;
+
/// Virtual Destructor
virtual ~ACE_Recycling_Strategy (void);
+
/// Tell the Svc_Handler something about the recycler, so that it can
/// reach the recycler when necessary.
virtual int assign_recycler (SVC_HANDLER *svc_handler,
ACE_Connection_Recycling_Strategy *recycler,
const void *recycling_act);
+
/// This allows us to prepare the svc_handler for recycling.
virtual int prepare_for_recycling (SVC_HANDLER *svc_handler);
};
+
/**
* @class ACE_Creation_Strategy
*
@@ -69,19 +84,25 @@ template <class SVC_HANDLER>
class ACE_Creation_Strategy
{
public:
+
// Useful STL-style traits.
typedef typename SVC_HANDLER::addr_type addr_type;
typedef SVC_HANDLER handler_type;
typedef typename SVC_HANDLER::stream_type stream_type;
+
// = Initialization and termination methods.
+
/// Default constructor.
ACE_Creation_Strategy (ACE_Thread_Manager * = 0,
ACE_Reactor * = ACE_Reactor::instance ());
+
/// An ACE_Thread_Manager is useful when creating active objects and
/// the ACE_Reactor is used to initialize the service handler's reactor.
int open (ACE_Thread_Manager * = 0,
ACE_Reactor * = ACE_Reactor::instance ());
+
virtual ~ACE_Creation_Strategy (void);
+
// = Factory method.
/**
* Create a SVC_HANDLER with the appropriate creation strategy. The
@@ -90,16 +111,21 @@ public:
* unchanged. Returns -1 on failure, else 0.
*/
virtual int make_svc_handler (SVC_HANDLER *&sh);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
/// Pointer to a thread manager.
ACE_Thread_Manager *thr_mgr_;
+
/// Pointer to an ACE_Reactor.
ACE_Reactor *reactor_;
};
+
/**
* @class ACE_Singleton_Strategy
*
@@ -115,28 +141,36 @@ template <class SVC_HANDLER>
class ACE_Singleton_Strategy : public ACE_Creation_Strategy<SVC_HANDLER>
{
public:
+
// Useful STL-style traits.
typedef ACE_Creation_Strategy<SVC_HANDLER> base_type;
+
// = Initialization and termination methods.
ACE_Singleton_Strategy (SVC_HANDLER * = 0,
ACE_Thread_Manager * = 0);
int open (SVC_HANDLER *,
ACE_Thread_Manager * = 0);
virtual ~ACE_Singleton_Strategy (void);
+
// = Factory method.
/// Create a Singleton SVC_HANDLER by always returning the same
/// SVC_HANDLER. Returns -1 on failure, else 0.
virtual int make_svc_handler (SVC_HANDLER *&);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
/// Pointer to the Singleton svc_handler.
SVC_HANDLER *svc_handler_;
+
/// Keep track of whether we need to delete the SVC_HANDLER.
bool delete_svc_handler_;
};
+
/**
* @class ACE_DLL_Strategy
*
@@ -147,11 +181,15 @@ template <class SVC_HANDLER>
class ACE_DLL_Strategy : public ACE_Creation_Strategy<SVC_HANDLER>
{
public:
+
// Useful STL-style traits.
typedef ACE_Creation_Strategy<SVC_HANDLER> base_type;
+
// = Intialization and termination methods.
+
/// "Do-nothing" constructor.
ACE_DLL_Strategy (void);
+
/// Initialize the DLL strategy based upon the service's DLL
/// information contained in the <svc_dll_info> string.
ACE_DLL_Strategy (const ACE_TCHAR dll_name[],
@@ -159,6 +197,7 @@ public:
const ACE_TCHAR svc_name[],
ACE_Service_Repository *,
ACE_Thread_Manager * = 0);
+
/// Initialize the DLL strategy based upon the service's DLL
/// information contained in the <svc_dll_info> string.
int open (const ACE_TCHAR dll_name[],
@@ -166,26 +205,35 @@ public:
const ACE_TCHAR svc_name[],
ACE_Service_Repository *,
ACE_Thread_Manager * = 0);
+
// = Factory method.
/// Create a SVC_HANDLER by dynamically linking it from a DLL.
/// Returns -1 on failure, else 0.
virtual int make_svc_handler (SVC_HANDLER *&);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
typedef ACE_Creation_Strategy<SVC_HANDLER> inherited;
+
/// Name of the DLL to dynamically link.
ACE_TCHAR dll_name_[MAXPATHLEN + 1];
+
/// Name of the factory function in the shared library to use to
/// obtain a pointer to the new SVC_HANDLER.
ACE_TCHAR factory_function_[MAXPATHLEN + 1];
+
/// Name of the service.
ACE_TCHAR svc_name_[MAXNAMELEN + 1];
+
/// Pointer to the <Service_Repository>.
ACE_Service_Repository *svc_rep_;
};
+
/**
* @class ACE_Concurrency_Strategy
*
@@ -203,12 +251,15 @@ template <class SVC_HANDLER>
class ACE_Concurrency_Strategy
{
public:
+
// Useful STL-style traits.
typedef typename SVC_HANDLER::addr_type addr_type;
typedef SVC_HANDLER handler_type;
typedef typename SVC_HANDLER::stream_type stream_type;
+
/// Constructor
ACE_Concurrency_Strategy (int flags = 0);
+
// = Factory method.
/**
* Activate the <svc_handler> with an appropriate concurrency
@@ -218,16 +269,22 @@ public:
*/
virtual int activate_svc_handler (SVC_HANDLER *svc_handler,
void *arg = 0);
+
virtual ~ACE_Concurrency_Strategy (void);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
+
/// Flags that are parsed to set options for the connected
/// SVC_HANDLER.
int flags_;
};
+
/**
* @class ACE_Reactive_Strategy
*
@@ -242,38 +299,50 @@ template <class SVC_HANDLER>
class ACE_Reactive_Strategy : public ACE_Concurrency_Strategy <SVC_HANDLER>
{
public:
+
// Useful STL-style traits.
typedef ACE_Concurrency_Strategy<SVC_HANDLER> base_type;
+
// = Intialization and termination methods.
/// "Do-nothing constructor"
ACE_Reactive_Strategy (int flags = 0);
+
/// Initialize the strategy.
ACE_Reactive_Strategy (ACE_Reactor *reactor,
ACE_Reactor_Mask = ACE_Event_Handler::READ_MASK,
int flags = 0);
+
/// Initialize the strategy.
virtual int open (ACE_Reactor *reactor,
ACE_Reactor_Mask = ACE_Event_Handler::READ_MASK,
int flags = 0);
+
/// Destructor.
virtual ~ACE_Reactive_Strategy (void);
+
// = Factory method.
/// Activate the <svc_handler> by registering it with the <Reactor>
/// and then calling it's <open> hook.
virtual int activate_svc_handler (SVC_HANDLER *svc_handler,
void *arg = 0);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
typedef ACE_Concurrency_Strategy<SVC_HANDLER> inherited;
+
/// Pointer to the Reactor we'll use to register the SVC_HANDLER.
ACE_Reactor *reactor_;
+
/// The mask that we pass to the <Reactor> when we register the
/// SVC_HANDLER.
ACE_Reactor_Mask mask_;
};
+
/**
* @class ACE_Thread_Strategy
*
@@ -290,22 +359,28 @@ template <class SVC_HANDLER>
class ACE_Thread_Strategy : public ACE_Concurrency_Strategy<SVC_HANDLER>
{
public:
+
// Useful STL-style traits.
typedef ACE_Concurrency_Strategy<SVC_HANDLER> base_type;
+
// = Intialization and termination methods.
/// "Do-nothing constructor"
ACE_Thread_Strategy (int flags = 0);
+
/// Initialize the strategy.
ACE_Thread_Strategy (ACE_Thread_Manager *tm,
long thr_flags,
int n_threads = 1,
int flags = 0);
+
/// Initialize the strategy.
virtual int open (ACE_Thread_Manager *tm,
long thr_flags,
int n_threads = 1,
int flags = 0);
+
virtual ~ACE_Thread_Strategy (void);
+
// = Factory method.
/**
* Activate the @a svc_handler with an appropriate concurrency
@@ -315,19 +390,26 @@ public:
*/
virtual int activate_svc_handler (SVC_HANDLER *svc_handler,
void *arg = 0);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
typedef ACE_Concurrency_Strategy<SVC_HANDLER> inherited;
+
/// Thread manager for this class (must be provided).
ACE_Thread_Manager *thr_mgr_;
+
/// Flags to pass into the <SVC_HANDLER::activate> method.
long thr_flags_;
+
/// Number of threads to spawn.
int n_threads_;
};
+
/**
* @class ACE_Process_Strategy
*
@@ -344,22 +426,28 @@ template <class SVC_HANDLER>
class ACE_Process_Strategy : public ACE_Concurrency_Strategy<SVC_HANDLER>
{
public:
+
// Useful STL-style traits.
typedef ACE_Concurrency_Strategy<SVC_HANDLER> base_type;
+
// = Intialization and termination methods.
+
/// Initialize the strategy. If @a avoid_zombies is non-0 then set a
/// flag to ACE::fork() to avoid zombies.
ACE_Process_Strategy (size_t n_processes = 1,
ACE_Event_Handler *acceptor = 0,
ACE_Reactor * = 0,
int avoid_zombies = 0);
+
/// Initialize the strategy. If @a avoid_zombies is non-0 then set a
/// flag to ACE::fork() to avoid zombies.
virtual int open (size_t n_processes = 1,
ACE_Event_Handler *acceptor = 0,
ACE_Reactor * = 0,
int avoid_zombies = 0);
+
virtual ~ACE_Process_Strategy (void);
+
// = Factory method.
/**
* Activate the @a svc_handler with an appropriate concurrency
@@ -369,20 +457,26 @@ public:
*/
virtual int activate_svc_handler (SVC_HANDLER *svc_handler,
void *arg = 0);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
typedef ACE_Concurrency_Strategy<SVC_HANDLER> inherited;
+
/// Number of processes to spawn.
size_t n_processes_;
+
/**
* This is the @c Acceptor in the parent is listening on. We need to
* make sure that we remove it from the Reactor and close it down in
* the child.
*/
ACE_Event_Handler *acceptor_;
+
/**
* This is the reactor the child is using in conjunction with the
* acceptor. We need to remove the acceptor from this reactor
@@ -390,6 +484,7 @@ protected:
*/
ACE_Reactor *reactor_;
};
+
/**
* @class ACE_Accept_Strategy
*
@@ -403,45 +498,60 @@ template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1>
class ACE_Accept_Strategy
{
public:
+
// Useful STL-style traits.
typedef ACE_PEER_ACCEPTOR_ADDR addr_type;
typedef ACE_PEER_ACCEPTOR acceptor_type;
typedef SVC_HANDLER handler_type;
typedef typename SVC_HANDLER::stream_type stream_type;
+
// = Initialization and termination methods.
/// Default constructor.
ACE_Accept_Strategy (ACE_Reactor *reactor = ACE_Reactor::instance ());
+
/// Initialize the @c peer_acceptor_ with @a local_addr.
ACE_Accept_Strategy (const ACE_PEER_ACCEPTOR_ADDR &local_addr,
int restart = 0,
ACE_Reactor *reactor = ACE_Reactor::instance ());
+
/// Initialize the <peer_acceptor_> with @a local_addr, indicating
/// whether to @a reuse_addr if it's already in use.
virtual int open (const ACE_PEER_ACCEPTOR_ADDR &local_addr,
int reuse_addr = 0);
+
/// Return the underlying ACE_HANDLE of the <peer_acceptor_>.
virtual ACE_HANDLE get_handle (void) const;
+
/// Return a reference to the <peer_acceptor_>.
virtual ACE_PEER_ACCEPTOR &acceptor (void) const;
+
virtual ~ACE_Accept_Strategy (void);
+
// = Factory method.
/// The default behavior delegates to the <accept> method of the
/// PEER_ACCEPTOR.
virtual int accept_svc_handler (SVC_HANDLER *);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
/// Factory that establishes connections passively.
ACE_PEER_ACCEPTOR peer_acceptor_;
+
/// Pointer to the reactor used by the Acceptor.
ACE_Reactor *reactor_;
+
/// Needed to reopen the socket if <accept> fails.
int reuse_addr_;
+
/// Needed to reopen the socket if <accept> fails.
ACE_PEER_ACCEPTOR_ADDR peer_acceptor_addr_;
};
+
/**
* @class ACE_Connect_Strategy
*
@@ -455,17 +565,22 @@ template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1>
class ACE_Connect_Strategy
{
public:
+
// Useful STL-style traits.
typedef ACE_PEER_CONNECTOR_ADDR addr_type;
typedef ACE_PEER_CONNECTOR connector_type;
typedef SVC_HANDLER handler_type;
typedef typename SVC_HANDLER::stream_type stream_type;
+
// = Initialization and termination methods.
/// Default constructor.
ACE_Connect_Strategy (void);
+
/// Return a reference to the <peer_connector_>.
virtual ACE_PEER_CONNECTOR &connector (void) const;
+
virtual ~ACE_Connect_Strategy (void);
+
// = Factory method.
/// The default behavior delegates to the <connect> method of the
/// <PEER_CONNECTOR::connect>.
@@ -476,6 +591,7 @@ public:
int reuse_addr,
int flags,
int perms);
+
/**
* The default behavior delegates to the <connect> method of the
* <PEER_CONNECTOR::connect>.
@@ -489,14 +605,18 @@ public:
int reuse_addr,
int flags,
int perms);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
/// Factory that establishes connections actively.
ACE_PEER_CONNECTOR connector_;
};
+
/**
* @class ACE_Scheduling_Strategy
*
@@ -511,23 +631,32 @@ template <class SVC_HANDLER>
class ACE_Scheduling_Strategy
{
public:
+
// Useful STL-style traits.
typedef typename SVC_HANDLER::addr_type addr_type;
typedef SVC_HANDLER handler_type;
typedef typename SVC_HANDLER::stream_type stream_type;
+
// = Initialization and termination methods.
+
/// Constructor
ACE_Scheduling_Strategy (SVC_HANDLER * = 0);
+
/// Destructor
virtual ~ACE_Scheduling_Strategy (void);
+
// = Scheduling methods
+
/// Suspend hook.
virtual int suspend (void);
+
/// Resume hook.
virtual int resume (void);
+
/// Dump the state of the object.
virtual void dump (void) const;
};
+
/**
* @class ACE_Schedule_All_Reactive_Strategy
*
@@ -542,22 +671,31 @@ class ACE_Schedule_All_Reactive_Strategy
: public ACE_Scheduling_Strategy<SVC_HANDLER>
{
public:
+
// Useful STL-style traits.
typedef ACE_Scheduling_Strategy<SVC_HANDLER> base_type;
+
// = Initialization and termination methods.
/// Constructor
ACE_Schedule_All_Reactive_Strategy (SVC_HANDLER * = 0);
+
// = Scheduling methods
+
/// Suspend hook.
virtual int suspend (void);
+
/// Resume hook.
virtual int resume (void);
+
/// Dump the state of the object.
virtual void dump (void) const;
+
protected:
+
/// Reactor
ACE_Reactor *reactor_;
};
+
/**
* @class ACE_Schedule_All_Threaded_Strategy
*
@@ -572,22 +710,31 @@ class ACE_Schedule_All_Threaded_Strategy
: public ACE_Scheduling_Strategy<SVC_HANDLER>
{
public:
+
// Useful STL-style traits.
typedef ACE_Scheduling_Strategy<SVC_HANDLER> base_type;
+
// = Initialization and termination methods.
/// Constructor
ACE_Schedule_All_Threaded_Strategy (SVC_HANDLER * = 0);
+
// = Scheduling methods
+
/// Suspend hook.
virtual int suspend (void);
+
/// Resume hook.
virtual int resume (void);
+
/// Dump the state of the object.
virtual void dump (void) const;
+
protected:
+
/// Thread Manager
ACE_Thread_Manager *thr_mgr_;
};
+
/**
* @class ACE_NOOP_Creation_Strategy
*
@@ -603,11 +750,14 @@ template <class SVC_HANDLER>
class ACE_NOOP_Creation_Strategy : public ACE_Creation_Strategy<SVC_HANDLER>
{
public:
+
// Useful STL-style traits.
typedef ACE_Creation_Strategy<SVC_HANDLER> base_type;
+
/// This is a no-op.
virtual int make_svc_handler (SVC_HANDLER *&);
};
+
/**
* @class ACE_NOOP_Concurrency_Strategy
*
@@ -624,13 +774,16 @@ class ACE_NOOP_Concurrency_Strategy
: public ACE_Concurrency_Strategy<SVC_HANDLER>
{
public:
+
// Useful STL-style traits.
typedef ACE_Concurrency_Strategy<SVC_HANDLER> base_type;
+
// = Factory method.
/// This is a no-op.
virtual int activate_svc_handler (SVC_HANDLER *svc_handler,
void *arg = 0);
};
+
template <class T>
class ACE_Refcounted_Hash_Recyclable : public ACE_Refcountable,
public ACE_Hashable,
@@ -639,21 +792,28 @@ class ACE_Refcounted_Hash_Recyclable : public ACE_Refcountable,
public:
/// Default constructor.
ACE_Refcounted_Hash_Recyclable (void);
+
/// Constructor.
ACE_Refcounted_Hash_Recyclable (const T &t,
long refcount = 0,
ACE_Recyclable_State state = ACE_RECYCLABLE_UNKNOWN);
+
/// Destructor
virtual ~ACE_Refcounted_Hash_Recyclable (void);
+
/// Compares two instances.
bool operator== (const ACE_Refcounted_Hash_Recyclable<T> &rhs) const;
bool operator!= (const ACE_Refcounted_Hash_Recyclable<T> &rhs) const;
+
T &subject ();
+
protected:
/// Computes and returns hash value.
u_long hash_i (void) const;
+
T t_;
};
+
/**
* @class ACE_Cached_Connect_Strategy
*
@@ -671,6 +831,7 @@ class ACE_Cached_Connect_Strategy
public ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2>
{
public:
+
// Useful STL-style traits.
typedef ACE_Creation_Strategy<SVC_HANDLER>
creation_strategy_type;
@@ -679,6 +840,7 @@ public:
typedef ACE_Concurrency_Strategy<SVC_HANDLER>
concurrency_strategy_type;
typedef ACE_Recycling_Strategy<SVC_HANDLER> recycling_strategy_type;
+
// = Define some useful (old style) traits.
typedef ACE_Creation_Strategy<SVC_HANDLER>
CREATION_STRATEGY;
@@ -686,35 +848,45 @@ public:
CONCURRENCY_STRATEGY;
typedef ACE_Recycling_Strategy<SVC_HANDLER>
RECYCLING_STRATEGY;
+
// = Super class
typedef ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2>
CONNECT_STRATEGY;
+
typedef ACE_Cached_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX> SELF;
+
/// Constructor
ACE_Cached_Connect_Strategy (ACE_Creation_Strategy<SVC_HANDLER> *cre_s = 0,
ACE_Concurrency_Strategy<SVC_HANDLER> *con_s = 0,
ACE_Recycling_Strategy<SVC_HANDLER> *rec_s = 0,
MUTEX *mutex = 0,
bool delete_lock = false);
+
/// Destructor
virtual ~ACE_Cached_Connect_Strategy (void);
+
/// This methods allow you to change the strategies used by the
/// cached connector.
virtual int open (ACE_Creation_Strategy<SVC_HANDLER> *cre_s,
ACE_Concurrency_Strategy<SVC_HANDLER> *con_s,
ACE_Recycling_Strategy<SVC_HANDLER> *rec_s);
+
/// Template method for making a new <svc_handler>
virtual int make_svc_handler (SVC_HANDLER *&sh);
+
/// Template method for activating a new <svc_handler>
virtual int activate_svc_handler (SVC_HANDLER *svc_handler);
+
/// Template method for setting the recycler information of the
/// svc_handler.
virtual int assign_recycler (SVC_HANDLER *svc_handler,
ACE_Connection_Recycling_Strategy *recycler,
const void *recycling_act);
+
/// Template method for preparing the svc_handler for recycling.
virtual int prepare_for_recycling (SVC_HANDLER *svc_handler);
+
/**
* Checks to see if there is already a <SVC_HANDLER> in the cache
* connected to the <remote_addr>. If so, we return this pointer.
@@ -744,38 +916,50 @@ public:
int reuse_addr,
int flags,
int perms);
+
/// Remove from cache.
virtual int purge (const void *recycling_act);
+
/// Add to cache.
virtual int cache (const void *recycling_act);
+
/// Get/Set <recycle_state>.
virtual int recycle_state (const void *recycling_act,
ACE_Recyclable_State new_state);
virtual ACE_Recyclable_State recycle_state (const void *recycling_act) const;
+
/// Mark as closed.
virtual int mark_as_closed (const void *recycling_act);
+
/**
* Mark as closed (non-locking version). This method needs to be public
* as it is used in the cleanup of handlers where teh locked version causes
* a deadlock.
*/
virtual int mark_as_closed_i (const void *recycling_act);
+
/// Cleanup hint and reset <*act_holder> to zero if <act_holder != 0>.
virtual int cleanup_hint (const void *recycling_act,
void **act_holder = 0);
+
// = Traits for managing the map
typedef ACE_Refcounted_Hash_Recyclable<ACE_PEER_CONNECTOR_ADDR>
REFCOUNTED_HASH_RECYCLABLE_ADDRESS;
typedef ACE_Hash_Map_Manager_Ex<REFCOUNTED_HASH_RECYCLABLE_ADDRESS, SVC_HANDLER *, ACE_Hash<REFCOUNTED_HASH_RECYCLABLE_ADDRESS>, ACE_Equal_To<REFCOUNTED_HASH_RECYCLABLE_ADDRESS>, ACE_Null_Mutex>
CONNECTION_MAP;
+
typedef typename CONNECTION_MAP::ITERATOR CONNECTION_MAP_ITERATOR;
typedef typename CONNECTION_MAP::ENTRY CONNECTION_MAP_ENTRY;
+
typedef ACE_Reverse_Lock<MUTEX> REVERSE_MUTEX;
+
// = Strategy accessors
virtual ACE_Creation_Strategy<SVC_HANDLER> *creation_strategy (void) const;
virtual ACE_Recycling_Strategy<SVC_HANDLER> *recycling_strategy (void) const;
virtual ACE_Concurrency_Strategy<SVC_HANDLER> *concurrency_strategy (void) const;
+
protected:
+
/// Creates a new connection.
virtual int new_connection (SVC_HANDLER *&sh,
const ACE_PEER_CONNECTOR_ADDR &remote_addr,
@@ -784,21 +968,28 @@ protected:
int reuse_addr,
int flags,
int perms);
+
/// Find an idle handle.
int find (REFCOUNTED_HASH_RECYCLABLE_ADDRESS &search_addr,
CONNECTION_MAP_ENTRY *&entry);
+
/// Remove from cache (non-locking version).
virtual int purge_i (const void *recycling_act);
+
/// Add to cache (non-locking version).
virtual int cache_i (const void *recycling_act);
+
/// Set <recycle_state> (non-locking version).
virtual int recycle_state_i (const void *recycling_act,
ACE_Recyclable_State new_state);
+
/// Get <recycle_state> (non-locking version).
virtual ACE_Recyclable_State recycle_state_i (const void *recycling_act) const;
+
/// Cleanup hint and reset <*act_holder> to zero if <act_holder != 0>.
virtual int cleanup_hint_i (const void *recycling_act,
void **act_holder);
+
// = Helpers
int check_hint_i (SVC_HANDLER *&sh,
const ACE_PEER_CONNECTOR_ADDR &remote_addr,
@@ -809,6 +1000,7 @@ protected:
int perms,
CONNECTION_MAP_ENTRY *&entry,
int &found);
+
int find_or_create_svc_handler_i (SVC_HANDLER *&sh,
const ACE_PEER_CONNECTOR_ADDR &remote_addr,
ACE_Time_Value *timeout,
@@ -818,6 +1010,7 @@ protected:
int perms,
CONNECTION_MAP_ENTRY *&entry,
int &found);
+
virtual int connect_svc_handler_i (
SVC_HANDLER *&sh,
const ACE_PEER_CONNECTOR_ADDR &remote_addr,
@@ -827,41 +1020,58 @@ protected:
int flags,
int perms,
int &found);
+
/// Table that maintains the cache of connected SVC_HANDLERs.
CONNECTION_MAP connection_map_;
+
/// Mutual exclusion for this object.
MUTEX *lock_;
+
/// Mutual exclusion for this object.
bool delete_lock_;
+
/// Reverse lock.
REVERSE_MUTEX *reverse_lock_;
+
// = Strategy objects.
+
/// Creation strategy for an <Connector>.
CREATION_STRATEGY *creation_strategy_;
+
/// true if <Connector> created the creation strategy and thus should
/// delete it, else false.
bool delete_creation_strategy_;
+
/// Concurrency strategy for an <Connector>.
CONCURRENCY_STRATEGY *concurrency_strategy_;
+
/// true if <Connector> created the concurrency strategy and thus should
/// delete it, else false.
bool delete_concurrency_strategy_;
+
/// Recycling strategy for an <Connector>.
RECYCLING_STRATEGY *recycling_strategy_;
+
/// true if <Connector> created the recycling strategy and thus should
/// delete it, else false.
bool delete_recycling_strategy_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Strategies_T.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Strategies_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Strategies_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_STRATEGIES_T_H */
diff --git a/dep/ACE_wrappers/ace/Strategies_T.inl b/dep/ACE_wrappers/ace/Strategies_T.inl
index 2a199d11b9e..f3ae267bc13 100644
--- a/dep/ACE_wrappers/ace/Strategies_T.inl
+++ b/dep/ACE_wrappers/ace/Strategies_T.inl
@@ -1,7 +1,9 @@
// -*- C++ -*-
//
// $Id: Strategies_T.inl 81503 2008-04-28 18:28:15Z johnnyw $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template <class SVC_HANDLER> ACE_INLINE
ACE_Singleton_Strategy<SVC_HANDLER>::ACE_Singleton_Strategy (SVC_HANDLER *sh,
ACE_Thread_Manager *tm)
@@ -14,6 +16,7 @@ ACE_Singleton_Strategy<SVC_HANDLER>::ACE_Singleton_Strategy (SVC_HANDLER *sh,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_Singleton_Strategy")));
}
+
template <class SVC_HANDLER> ACE_INLINE int
ACE_Creation_Strategy<SVC_HANDLER>::open (ACE_Thread_Manager *thr_mgr,
ACE_Reactor *reactor)
@@ -23,6 +26,7 @@ ACE_Creation_Strategy<SVC_HANDLER>::open (ACE_Thread_Manager *thr_mgr,
this->reactor_ = reactor;
return 0;
}
+
template <class SVC_HANDLER> ACE_INLINE
ACE_Creation_Strategy<SVC_HANDLER>::ACE_Creation_Strategy (ACE_Thread_Manager *thr_mgr,
ACE_Reactor *reactor)
@@ -33,6 +37,7 @@ ACE_Creation_Strategy<SVC_HANDLER>::ACE_Creation_Strategy (ACE_Thread_Manager *t
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_Creation_Strategy")));
}
+
template <class SVC_HANDLER> ACE_INLINE
ACE_DLL_Strategy<SVC_HANDLER>::ACE_DLL_Strategy (const ACE_TCHAR dll_name[],
const ACE_TCHAR factory_function[],
@@ -50,23 +55,27 @@ ACE_DLL_Strategy<SVC_HANDLER>::ACE_DLL_Strategy (const ACE_TCHAR dll_name[],
ACE_TEXT ("%p\n"),
ACE_TEXT ("open")));
}
+
template <class SVC_HANDLER> ACE_INLINE
ACE_DLL_Strategy<SVC_HANDLER>::ACE_DLL_Strategy (void)
{
ACE_TRACE ("ACE_DLL_Strategy<SVC_HANDLER>::ACE_DLL_Strategy");
}
+
template <class SVC_HANDLER> ACE_INLINE
ACE_Concurrency_Strategy<SVC_HANDLER>::ACE_Concurrency_Strategy (int flags)
: flags_ (flags)
{
ACE_TRACE ("ACE_Concurrency_Strategy<SVC_HANDLER>::ACE_Concurrency_Strategy");
}
+
template <class SVC_HANDLER> ACE_INLINE
ACE_Reactive_Strategy<SVC_HANDLER>::ACE_Reactive_Strategy (ACE_Reactor *reactor,
ACE_Reactor_Mask mask,
int flags)
{
ACE_TRACE ("ACE_Reactive_Strategy<SVC_HANDLER>::ACE_Reactive_Strategy");
+
if (this->open (reactor,
mask,
flags) == -1)
@@ -74,6 +83,7 @@ ACE_Reactive_Strategy<SVC_HANDLER>::ACE_Reactive_Strategy (ACE_Reactor *reactor,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_Reactive_Strategy<SVC_HANDLER>::ACE_Reactive_Strategy")));
}
+
template <class SVC_HANDLER> ACE_INLINE
ACE_Reactive_Strategy<SVC_HANDLER>::ACE_Reactive_Strategy (int flags)
: ACE_Concurrency_Strategy<SVC_HANDLER> (flags),
@@ -82,6 +92,7 @@ ACE_Reactive_Strategy<SVC_HANDLER>::ACE_Reactive_Strategy (int flags)
{
ACE_TRACE ("ACE_Reactive_Strategy<SVC_HANDLER>::ACE_Reactive_Strategy");
}
+
template <class SVC_HANDLER> ACE_INLINE
ACE_Thread_Strategy<SVC_HANDLER>::ACE_Thread_Strategy (ACE_Thread_Manager *thr_mgr,
long thr_flags,
@@ -89,6 +100,7 @@ ACE_Thread_Strategy<SVC_HANDLER>::ACE_Thread_Strategy (ACE_Thread_Manager *thr_m
int flags)
{
ACE_TRACE ("ACE_Thread_Strategy<SVC_HANDLER>::ACE_Thread_Strategy");
+
if (this->open (thr_mgr,
thr_flags,
n_threads,
@@ -97,6 +109,7 @@ ACE_Thread_Strategy<SVC_HANDLER>::ACE_Thread_Strategy (ACE_Thread_Manager *thr_m
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_Thread_Strategy<SVC_HANDLER>::ACE_Thread_Strategy")));
}
+
template <class SVC_HANDLER> ACE_INLINE
ACE_Thread_Strategy<SVC_HANDLER>::ACE_Thread_Strategy (int flags)
: ACE_Concurrency_Strategy<SVC_HANDLER> (flags),
@@ -106,17 +119,20 @@ ACE_Thread_Strategy<SVC_HANDLER>::ACE_Thread_Strategy (int flags)
{
ACE_TRACE ("ACE_Thread_Strategy<SVC_HANDLER>::ACE_Thread_Strategy");
}
+
template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> ACE_INLINE
ACE_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::ACE_Accept_Strategy (ACE_Reactor *reactor)
: reactor_ (reactor)
{
ACE_TRACE ("ACE_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::ACE_Accept_Strategy");
}
+
template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1> ACE_INLINE
ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::ACE_Connect_Strategy (void)
{
ACE_TRACE ("ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::ACE_Connect_Strategy");
}
+
template <class SVC_HANDLER> ACE_INLINE
ACE_Process_Strategy<SVC_HANDLER>::ACE_Process_Strategy (size_t n_processes,
ACE_Event_Handler *acceptor,
@@ -132,33 +148,39 @@ ACE_Process_Strategy<SVC_HANDLER>::ACE_Process_Strategy (size_t n_processes,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_Process_Strategy")));
}
+
template <class SVC_HANDLER> ACE_INLINE
ACE_Scheduling_Strategy<SVC_HANDLER>::ACE_Scheduling_Strategy (SVC_HANDLER *)
{
ACE_TRACE ("ACE_Scheduling_Strategy<SVC_HANDLER>::ACE_Scheduling_Strategy");
}
+
template <class SVC_HANDLER> ACE_INLINE
ACE_Schedule_All_Reactive_Strategy<SVC_HANDLER>::ACE_Schedule_All_Reactive_Strategy
(SVC_HANDLER *scheduler)
: ACE_Scheduling_Strategy<SVC_HANDLER> (scheduler)
{
ACE_TRACE ("ACE_Schedule_All_Reactive_Strategy<SVC_HANDLER>::ACE_Schedule_All_Reactive_Strategy");
+
if (scheduler == 0 || scheduler->reactor () == 0)
this->reactor_ = ACE_Reactor::instance ();
else
this->reactor_ = scheduler->reactor ();
}
+
template <class SVC_HANDLER> ACE_INLINE
ACE_Schedule_All_Threaded_Strategy<SVC_HANDLER>::ACE_Schedule_All_Threaded_Strategy
(SVC_HANDLER *scheduler)
: ACE_Scheduling_Strategy<SVC_HANDLER> (scheduler)
{
ACE_TRACE ("ACE_Schedule_All_Threaded_Strategy<SVC_HANDLER>::ACE_Schedule_All_Threaded_Strategy");
+
if (scheduler == 0 || scheduler->thr_mgr () == 0)
this->thr_mgr_ = ACE_Thread_Manager::instance ();
else
this->thr_mgr_ = scheduler->thr_mgr ();
}
+
template <class T> ACE_INLINE
ACE_Refcounted_Hash_Recyclable<T>::ACE_Refcounted_Hash_Recyclable (void)
: ACE_Refcountable (0),
@@ -167,6 +189,7 @@ ACE_Refcounted_Hash_Recyclable<T>::ACE_Refcounted_Hash_Recyclable (void)
t_ ()
{
}
+
template <class T> ACE_INLINE
ACE_Refcounted_Hash_Recyclable<T>::ACE_Refcounted_Hash_Recyclable (const T &t,
long refcount,
@@ -177,16 +200,19 @@ ACE_Refcounted_Hash_Recyclable<T>::ACE_Refcounted_Hash_Recyclable (const T &t,
t_ (t)
{
}
+
template <class T> ACE_INLINE u_long
ACE_Refcounted_Hash_Recyclable<T>::hash_i (void) const
{
return this->t_.hash ();
}
+
template <class T> ACE_INLINE T &
ACE_Refcounted_Hash_Recyclable<T>::subject (void)
{
return this->t_;
}
+
template <class T> ACE_INLINE bool
ACE_Refcounted_Hash_Recyclable<T>::operator== (const ACE_Refcounted_Hash_Recyclable<T> &rhs) const
{
@@ -194,9 +220,11 @@ ACE_Refcounted_Hash_Recyclable<T>::operator== (const ACE_Refcounted_Hash_Recycla
this->recycle_state () == rhs.recycle_state ()
&& this->t_ == rhs.t_;
}
+
template <class T> ACE_INLINE bool
ACE_Refcounted_Hash_Recyclable<T>::operator!= (const ACE_Refcounted_Hash_Recyclable<T> &rhs) const
{
return !this->operator== (rhs);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Stream.h b/dep/ACE_wrappers/ace/Stream.h
index b816aeb33f0..9dc426fcf0f 100644
--- a/dep/ACE_wrappers/ace/Stream.h
+++ b/dep/ACE_wrappers/ace/Stream.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file Stream.h
@@ -8,20 +9,28 @@
* @author Douglas C. Schmidt <schmidt@uci.edu>
*/
//==========================================================================
+
#ifndef ACE_STREAM_H
#define ACE_STREAM_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/IO_Cntl_Msg.h"
#include "ace/Message_Block.h"
#include "ace/Module.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward decls.
template<ACE_SYNCH_DECL> class ACE_Stream_Iterator;
class ACE_Time_Value;
+
/**
* @class ACE_Stream
*
@@ -41,12 +50,14 @@ class ACE_Stream
{
public:
friend class ACE_Stream_Iterator<ACE_SYNCH_USE>;
+
enum
{
/// Indicates that <close> deletes the Tasks. Don't change this
/// value without updating the same enum in class ACE_Module...
M_DELETE = 3
};
+
// = Initializatation and termination methods.
/**
* Create a Stream consisting of <head> and <tail> as the Stream
@@ -57,6 +68,7 @@ public:
ACE_Stream (void *arg = 0,
ACE_Module<ACE_SYNCH_USE> *head = 0,
ACE_Module<ACE_SYNCH_USE> *tail = 0);
+
/**
* Create a Stream consisting of <head> and <tail> as the Stream
* head and Stream tail, respectively. If these are 0 then the
@@ -66,43 +78,58 @@ public:
virtual int open (void *arg,
ACE_Module<ACE_SYNCH_USE> *head = 0,
ACE_Module<ACE_SYNCH_USE> *tail = 0);
+
/// Close down the stream and release all the resources.
virtual int close (int flags = M_DELETE);
+
/// Close down the stream and release all the resources.
virtual ~ACE_Stream (void);
+
// = ACE_Stream plumbing operations
+
/// Add a new module <mod> right below the Stream head. The
/// <open()> hook methods of the <ACE_Tasks> in this ACE_Module
/// are invoked to initialize the tasks.
virtual int push (ACE_Module<ACE_SYNCH_USE> *mod);
+
/// Remove the <mod> right below the Stream head and close it down.
// The <close()> hook methods of the <ACE_Tasks> in this ACE_Module
/// are invoked to cleanup the tasks.
virtual int pop (int flags = M_DELETE);
+
/// Return the top module on the stream (right below the stream
/// head).
virtual int top (ACE_Module<ACE_SYNCH_USE> *&mod);
+
/// Insert a new module <mod> below the named module <prev_name>.
virtual int insert (const ACE_TCHAR *prev_name,
ACE_Module<ACE_SYNCH_USE> *mod);
+
/// Replace the named module <replace_name> with a new module <mod>.
virtual int replace (const ACE_TCHAR *replace_name,
ACE_Module<ACE_SYNCH_USE> *mod,
int flags = M_DELETE);
+
/// Remove the named module <mod> from the stream. This bypasses the
/// strict LIFO ordering of <push> and <pop>.
virtual int remove (const ACE_TCHAR *mod,
int flags = M_DELETE);
+
/// Return current stream head.
virtual ACE_Module<ACE_SYNCH_USE> *head (void);
+
/// Return current stream tail.
virtual ACE_Module<ACE_SYNCH_USE> *tail (void);
+
/// Find a particular ACE_Module.
virtual ACE_Module<ACE_SYNCH_USE> *find (const ACE_TCHAR *mod);
+
/// Create a pipe between two Streams.
virtual int link (ACE_Stream<ACE_SYNCH_USE> &);
+
/// Remove a pipe formed between two Streams.
virtual int unlink (void);
+
// = Blocking data transfer operations
/**
* Send the message @a mb down the stream, starting at the Module
@@ -112,6 +139,7 @@ public:
*/
virtual int put (ACE_Message_Block *mb,
ACE_Time_Value *timeout = 0);
+
/**
* Read the message @a mb that is stored in the stream head.
* Wait for upto @a timeout amount of absolute time for the operation
@@ -119,38 +147,51 @@ public:
*/
virtual int get (ACE_Message_Block *&mb,
ACE_Time_Value *timeout = 0);
+
/// Send control message down the stream.
virtual int control (ACE_IO_Cntl_Msg::ACE_IO_Cntl_Cmds cmd,
void *args);
+
/// Synchronize with the final close of the stream.
virtual int wait (void);
+
/// Dump the state of an object.
virtual void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Actually perform the unlinking of two Streams (must be called
/// with locks held).
int unlink_i (void);
+
/// Actually perform the linking of two Streams (must be called with
/// locks held).
int link_i (ACE_Stream<ACE_SYNCH_USE> &);
+
/// Must a new module onto the Stream.
int push_module (ACE_Module<ACE_SYNCH_USE> *,
ACE_Module<ACE_SYNCH_USE> * = 0,
ACE_Module<ACE_SYNCH_USE> * = 0);
+
/// Pointer to the head of the stream.
ACE_Module<ACE_SYNCH_USE> *stream_head_;
+
/// Pointer to the tail of the stream.
ACE_Module<ACE_SYNCH_USE> *stream_tail_;
+
/// Pointer to an adjoining linked stream.
ACE_Stream<ACE_SYNCH_USE> *linked_us_;
+
// = Synchronization objects used for thread-safe streams.
/// Protect the stream against race conditions.
ACE_SYNCH_MUTEX_T lock_;
+
/// Use to tell all threads waiting on the close that we are done.
ACE_SYNCH_CONDITION_T final_close_;
};
+
/**
* @class ACE_Stream_Iterator
*
@@ -162,29 +203,40 @@ class ACE_Stream_Iterator
public:
// = Initialization method.
ACE_Stream_Iterator (const ACE_Stream<ACE_SYNCH_USE> &sr);
+
// = Iteration methods.
+
/// Pass back the <next_item> that hasn't been seen in the set.
/// Returns 0 when all items have been seen, else 1.
int next (const ACE_Module<ACE_SYNCH_USE> *&next_item);
+
/// Returns 1 when all items have been seen, else 0.
int done (void) const;
+
/// Move forward by one element in the set. Returns 0 when all the
/// items in the set have been seen, else 1.
int advance (void);
+
private:
/// Next <Module> that we haven't yet seen.
ACE_Module<ACE_SYNCH_USE> *next_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Stream.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Stream.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Stream.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_STREAM_H */
diff --git a/dep/ACE_wrappers/ace/Stream.inl b/dep/ACE_wrappers/ace/Stream.inl
index fb7a3ed23f0..6263d431147 100644
--- a/dep/ACE_wrappers/ace/Stream.inl
+++ b/dep/ACE_wrappers/ace/Stream.inl
@@ -1,25 +1,30 @@
// -*- C++ -*-
//
// $Id: Stream.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template <ACE_SYNCH_DECL> ACE_INLINE ACE_Module<ACE_SYNCH_USE> *
ACE_Stream<ACE_SYNCH_USE>::head (void)
{
ACE_TRACE ("ACE_Stream<ACE_SYNCH_USE>::head");
return this->stream_head_;
}
+
template <ACE_SYNCH_DECL> ACE_INLINE ACE_Module<ACE_SYNCH_USE> *
ACE_Stream<ACE_SYNCH_USE>::tail (void)
{
ACE_TRACE ("ACE_Stream<ACE_SYNCH_USE>::tail");
return this->stream_tail_;
}
+
template <ACE_SYNCH_DECL> ACE_INLINE int
ACE_Stream<ACE_SYNCH_USE>::wait (void)
{
ACE_TRACE ("ACE_Stream<ACE_SYNCH_USE>::wait");
return this->final_close_.wait ();
}
+
template <ACE_SYNCH_DECL> ACE_INLINE int
ACE_Stream_Iterator<ACE_SYNCH_USE>::next (const ACE_Module<ACE_SYNCH_USE> *&mod)
{
@@ -27,12 +32,14 @@ ACE_Stream_Iterator<ACE_SYNCH_USE>::next (const ACE_Module<ACE_SYNCH_USE> *&mod)
mod = this->next_;
return this->next_ != 0;
}
+
template <ACE_SYNCH_DECL> ACE_INLINE int
ACE_Stream_Iterator<ACE_SYNCH_USE>::done (void) const
{
ACE_TRACE ("ACE_Stream_Iterator<ACE_SYNCH_USE>::done");
return this->next_ == 0;
}
+
template <ACE_SYNCH_DECL> int
ACE_Stream_Iterator<ACE_SYNCH_USE>::advance (void)
{
@@ -40,4 +47,5 @@ ACE_Stream_Iterator<ACE_SYNCH_USE>::advance (void)
this->next_ = this->next_->next ();
return this->next_ != 0;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Stream_Modules.h b/dep/ACE_wrappers/ace/Stream_Modules.h
index dbab6166160..8b718b6013d 100644
--- a/dep/ACE_wrappers/ace/Stream_Modules.h
+++ b/dep/ACE_wrappers/ace/Stream_Modules.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Stream_Modules.h
@@ -8,15 +9,20 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
// This needs to go outside of the #if !defined() block. Don't ask...
#include "ace/Task.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#ifndef ACE_STREAM_MODULES
#define ACE_STREAM_MODULES
#include /**/ "ace/pre.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Stream_Head
*
@@ -47,26 +53,33 @@ class ACE_Stream_Head : public ACE_Task<ACE_SYNCH_USE>
public:
/// Construction
ACE_Stream_Head (void);
+
/// Destruction
~ACE_Stream_Head (void);
+
// = ACE_Task hooks
virtual int open (void *a = 0);
virtual int close (u_long flags = 0);
virtual int put (ACE_Message_Block *msg, ACE_Time_Value * = 0);
virtual int svc (void);
+
// = Dynamic linking hooks
virtual int init (int argc, ACE_TCHAR *argv[]);
virtual int info (ACE_TCHAR **info_string, size_t length) const;
virtual int fini (void);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Performs canonical flushing at the ACE_Stream Head.
int control (ACE_Message_Block *);
int canonical_flush (ACE_Message_Block *);
};
+
/**
* @class ACE_Stream_Tail
*
@@ -78,26 +91,33 @@ class ACE_Stream_Tail : public ACE_Task<ACE_SYNCH_USE>
public:
/// Construction
ACE_Stream_Tail (void);
+
/// Destruction
~ACE_Stream_Tail (void);
+
// = ACE_Task hooks
virtual int open (void *a = 0);
virtual int close (u_long flags = 0);
virtual int put (ACE_Message_Block *msg, ACE_Time_Value * = 0);
virtual int svc (void);
+
// = Dynamic linking hooks
virtual int init (int argc, ACE_TCHAR *argv[]);
virtual int info (ACE_TCHAR **info_string, size_t length) const;
virtual int fini (void);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Performs canonical flushing at the ACE_Stream tail.
int control (ACE_Message_Block *);
int canonical_flush (ACE_Message_Block *);
};
+
/**
* @class ACE_Thru_Task
*
@@ -110,29 +130,38 @@ class ACE_Thru_Task : public ACE_Task<ACE_SYNCH_USE>
public:
/// Construction
ACE_Thru_Task (void);
+
/// Destruction
~ACE_Thru_Task (void);
+
// = ACE_Task hooks
virtual int open (void *a = 0);
virtual int close (u_long flags = 0);
virtual int put (ACE_Message_Block *msg, ACE_Time_Value * = 0);
virtual int svc (void);
+
// = Dynamic linking hooks
virtual int init (int argc, ACE_TCHAR *argv[]);
virtual int info (ACE_TCHAR **info_string, size_t length) const;
virtual int fini (void);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Stream_Modules.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Stream_Modules.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
#endif /* ACE_STREAM_MODULES */
diff --git a/dep/ACE_wrappers/ace/String_Base.h b/dep/ACE_wrappers/ace/String_Base.h
index bd65af585cc..c3ecbd8148b 100644
--- a/dep/ACE_wrappers/ace/String_Base.h
+++ b/dep/ACE_wrappers/ace/String_Base.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file String_Base.h
@@ -9,15 +10,22 @@
* @author Nanbor Wang <nanbor@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_STRING_BASE_H
#define ACE_STRING_BASE_H
+
#include /**/ "ace/pre.h"
+
#include "ace/Global_Macros.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/String_Base_Const.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_String_Base
*
@@ -50,7 +58,9 @@ template <class CHAR>
class ACE_String_Base : public ACE_String_Base_Const
{
public:
+
using ACE_String_Base_Const::size_type;
+
/**
* Default constructor.
*
@@ -58,6 +68,7 @@ public:
* @return Default ACE_String_Base string.
*/
ACE_String_Base (ACE_Allocator *the_allocator = 0);
+
/**
* Constructor that copies @a s into dynamically allocated memory.
*
@@ -76,6 +87,7 @@ public:
ACE_String_Base (const CHAR *s,
ACE_Allocator *the_allocator = 0,
bool release = true);
+
/**
* Constructor that copies @a len CHARs of @a s into dynamically
* allocated memory (will zero terminate the result).
@@ -97,6 +109,7 @@ public:
size_type len,
ACE_Allocator *the_allocator = 0,
bool release = true);
+
/**
* Copy constructor.
*
@@ -104,6 +117,7 @@ public:
* @return Copy of input string @a s
*/
ACE_String_Base (const ACE_String_Base < CHAR > &s);
+
/**
* Constructor that copies @a c into dynamically allocated memory.
*
@@ -112,6 +126,7 @@ public:
* @return ACE_String_Base containing CHAR 'c'
*/
ACE_String_Base (CHAR c, ACE_Allocator *the_allocator = 0);
+
/**
* Constructor that allocates a len long string.
*
@@ -128,10 +143,12 @@ public:
ACE_String_Base (size_type len,
CHAR c = 0,
ACE_Allocator *the_allocator = 0);
+
/**
* Deletes the memory...
*/
~ACE_String_Base (void);
+
/**
* Return the <slot'th> character in the string (doesn't perform
* bounds checking).
@@ -140,6 +157,7 @@ public:
* @return The character at index @a slot
*/
const CHAR & operator[] (size_type slot) const;
+
/**
* Return the <slot'th> character by reference in the string
* (doesn't perform bounds checking).
@@ -148,6 +166,7 @@ public:
* @return The character at index @a slot
*/
CHAR & operator[] (size_type slot);
+
/**
* Assignment operator (does copy memory).
*
@@ -155,6 +174,7 @@ public:
* @return Return a copy of the this string.
*/
ACE_String_Base < CHAR > &operator = (const CHAR * s);
+
/**
* Assignment operator (does copy memory).
*
@@ -162,6 +182,7 @@ public:
* @return Return a copy of the this string.
*/
ACE_String_Base < CHAR > &operator = (const ACE_String_Base < CHAR > &s);
+
/**
* Assignment alternative method (does not copy memory).
*
@@ -169,6 +190,7 @@ public:
* @return Return this string.
*/
ACE_String_Base < CHAR > &assign_nocopy (const ACE_String_Base < CHAR > &s);
+
/**
* Copy @a s into this @a ACE_String_Base.
*
@@ -187,6 +209,7 @@ public:
* freeing memory.
*/
void set (const CHAR * s, bool release = true);
+
/**
* Copy @a len bytes of @a s (will zero terminate the result).
*
@@ -206,6 +229,7 @@ public:
* freeing memory.
*/
void set (const CHAR * s, size_type len, bool release);
+
/**
* Clear this string. Memory is _not_ freed if @a release is false.
*
@@ -218,6 +242,7 @@ public:
* @param release Memory is freed if true, and not freed if false.
*/
void clear (bool release = false);
+
/**
* A more specialized version of clear(): "fast clear". fast_clear()
* resets the string to 0 length. If the string owns the buffer
@@ -237,6 +262,7 @@ public:
* allocated internally.
*/
void fast_clear (void);
+
/**
* Return a substring given an offset and length.
* If length == @c npos use rest of str. Return empty substring if
@@ -248,6 +274,7 @@ public:
*/
ACE_String_Base < CHAR > substring (size_type offset,
size_type length = npos) const;
+
/**
* Same as <substring>.
*
@@ -257,6 +284,7 @@ public:
*/
ACE_String_Base < CHAR > substr (size_type offset,
size_type length = npos) const;
+
/**
* Concat operator (copies memory).
*
@@ -265,6 +293,7 @@ public:
* string is zero terminated.
*/
ACE_String_Base < CHAR > &operator += (const ACE_String_Base < CHAR > &s);
+
/**
* Concat operator (copies memory).
*
@@ -273,6 +302,7 @@ public:
* string is zero terminated.
*/
ACE_String_Base < CHAR >& operator += (const CHAR* s);
+
/**
* Concat operator (copies memory).
*
@@ -281,6 +311,7 @@ public:
* string is zero terminated.
*/
ACE_String_Base < CHAR >& operator += (const CHAR c);
+
/**
* Append function (copies memory).
*
@@ -290,18 +321,21 @@ public:
* string is zero terminated.
*/
ACE_String_Base < CHAR >& append (const CHAR* s, size_type slen);
+
/**
* Returns a hash value for this string.
*
* @return Hash value of string
*/
u_long hash (void) const;
+
/**
* Return the length of the string.
*
* @return Length of stored string
*/
size_type length (void) const;
+
/**
* Return the number of allocated CHARs in the string object.
* This may be greater than the current length of the string.
@@ -310,16 +344,19 @@ public:
* any terminating nul that may be needed.
*/
size_t capacity (void) const;
+
/**
* Return @c true if the length of the string is zero, else @c false.
*/
bool is_empty (void) const;
+
/**
* Return @c true if the length of the string is zero, else @c
* false. We recommend using @c is_empty() instead since it's more
* consistent with the ACE container naming conventions.
*/
bool empty (void) const;
+
/**
* Get a copy of the underlying representation.
*
@@ -331,6 +368,7 @@ public:
* zero terminated.
*/
CHAR *rep (void) const;
+
/**
* Get at the underlying representation directly!
* _Don't_ even think about casting the result to (char *) and modifying it,
@@ -341,10 +379,12 @@ public:
*
*/
const CHAR *fast_rep (void) const;
+
/**
* Same as STL String's <c_str> and <fast_rep>.
*/
const CHAR *c_str (void) const;
+
/**
* Comparison operator that will match substrings. Returns the
* slot of the first location that matches, else @c npos.
@@ -354,6 +394,7 @@ public:
* @c npos (not found).
*/
size_type strstr (const ACE_String_Base<CHAR> &s) const;
+
/**
* Find <str> starting at pos. Returns the slot of the first
* location that matches (will be >= pos), else @c npos.
@@ -364,6 +405,7 @@ public:
* @c npos.
*/
size_type find (const ACE_String_Base<CHAR> &str, size_type pos = 0) const;
+
/**
* Find @a s starting at pos. Returns the slot of the first
* location that matches (will be >= pos), else @c npos.
@@ -374,6 +416,7 @@ public:
* @c npos.
*/
size_type find (const CHAR *s, size_type pos = 0) const;
+
/**
* Find @a c starting at pos. Returns the slot of the first
* location that matches (will be >= pos), else @c npos.
@@ -384,6 +427,7 @@ public:
* @c npos.
*/
size_type find (CHAR c, size_type pos = 0) const;
+
/**
* Find @a c starting at pos (counting from the end). Returns the
* slot of the first location that matches, else @c npos.
@@ -394,6 +438,7 @@ public:
* @c npos.
*/
size_type rfind (CHAR c, size_type pos = npos) const;
+
/**
* Equality comparison operator (must match entire string).
*
@@ -401,6 +446,7 @@ public:
* @return @c true if equal, @c false otherwise.
*/
bool operator == (const ACE_String_Base<CHAR> &s) const;
+
/**
* Equality comparison operator (must match entire string).
*
@@ -408,6 +454,7 @@ public:
* @return @c true if equal, @c false otherwise.
*/
bool operator == (const CHAR *s) const;
+
/**
* Less than comparison operator.
*
@@ -415,6 +462,7 @@ public:
* @return @c true if less than, @c false otherwise.
*/
bool operator < (const ACE_String_Base<CHAR> &s) const;
+
/**
* Greater than comparison operator.
*
@@ -422,6 +470,7 @@ public:
* @return @c true if greater than, @c false otherwise.
*/
bool operator > (const ACE_String_Base<CHAR> &s) const;
+
/**
* Inequality comparison operator.
*
@@ -429,6 +478,7 @@ public:
* @return @c true if not equal, @c false otherwise.
*/
bool operator != (const ACE_String_Base<CHAR> &s) const;
+
/**
* Inequality comparison operator.
*
@@ -436,6 +486,7 @@ public:
* @return @c true if not equal, @c false otherwise.
*/
bool operator != (const CHAR *s) const;
+
/**
* Performs a strncmp comparison.
*
@@ -444,10 +495,12 @@ public:
* depending on how input string @a s is to the stored string.
*/
int compare (const ACE_String_Base<CHAR> &s) const;
+
/**
* Dump the state of an object.
*/
void dump (void) const;
+
/**
* This method is designed for high-performance. Please use with
* care ;-)
@@ -469,42 +522,51 @@ public:
*/
void resize (size_type len, CHAR c = 0);
void fast_resize (size_t len);
+
/// Swap the contents of this @c ACE_String_Base with @a str.
/**
* @note This is non-throwing operation.
*/
void swap (ACE_String_Base<CHAR> & str);
+
/**
* Declare the dynamic allocation hooks.
*/
ACE_ALLOC_HOOK_DECLARE;
+
protected:
/**
* Pointer to a memory allocator.
*/
ACE_Allocator *allocator_;
+
/**
* Length of the ACE_String_Base data (not counting the trailing '\0').
*/
size_type len_;
+
/**
* Length of the ACE_String_Base data buffer. Keeping track of the
* length allows to avoid unnecessary dynamic allocations.
*/
size_type buf_len_;
+
/**
* Pointer to data.
*/
CHAR *rep_;
+
/**
* Flag that indicates if we own the memory
*/
bool release_;
+
/**
* Represents the "NULL" string to simplify the internal logic.
*/
static CHAR NULL_String_;
};
+
template < class CHAR >
ACE_String_Base < CHAR > operator + (const ACE_String_Base < CHAR > &,
const ACE_String_Base < CHAR > &);
@@ -514,28 +576,38 @@ template < class CHAR >
template < class CHAR >
ACE_String_Base < CHAR > operator + (const CHAR *,
const ACE_String_Base < CHAR > &);
+
template < class CHAR >
ACE_String_Base < CHAR > operator + (const ACE_String_Base < CHAR > &t,
const CHAR c);
+
template < class CHAR >
ACE_String_Base < CHAR > operator + (const CHAR c,
const ACE_String_Base < CHAR > &t);
+
template <class CHAR>
bool operator == (const CHAR *s,
const ACE_String_Base<CHAR> &t);
+
template <class CHAR>
bool operator != (const CHAR *s,
const ACE_String_Base<CHAR> &t);
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/String_Base.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/String_Base.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("String_Base.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_STRING_BASE_H */
diff --git a/dep/ACE_wrappers/ace/String_Base.inl b/dep/ACE_wrappers/ace/String_Base.inl
index 784b01cc8d4..859bceb4a34 100644
--- a/dep/ACE_wrappers/ace/String_Base.inl
+++ b/dep/ACE_wrappers/ace/String_Base.inl
@@ -1,11 +1,14 @@
// -*- C++ -*-
//
// $Id: String_Base.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Malloc_Base.h"
#include "ace/Min_Max.h"
#include "ace/OS_NS_string.h"
#include "ace/OS_Memory.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template <class CHAR> ACE_INLINE void
ACE_String_Base<CHAR>::dump (void) const
{
@@ -13,6 +16,7 @@ ACE_String_Base<CHAR>::dump (void) const
ACE_TRACE ("ACE_String_Base<CHAR>::dump");
#endif /* ACE_HAS_DUMP */
}
+
// Assignment method (does not copy memory)
template <class CHAR> ACE_INLINE ACE_String_Base<CHAR> &
ACE_String_Base<CHAR>::assign_nocopy (const ACE_String_Base<CHAR> &s)
@@ -21,28 +25,33 @@ ACE_String_Base<CHAR>::assign_nocopy (const ACE_String_Base<CHAR> &s)
this->set (s.rep_, s.len_, false);
return *this;
}
+
template <class CHAR> ACE_INLINE typename ACE_String_Base<CHAR>::size_type
ACE_String_Base<CHAR>::length (void) const
{
ACE_TRACE ("ACE_String_Base<CHAR>::length");
return this->len_;
}
+
template <class CHAR> ACE_INLINE size_t
ACE_String_Base<CHAR>::capacity (void) const
{
ACE_TRACE ("ACE_String_Base<CHAR>::capacity");
return this->buf_len_;
}
+
template <class CHAR> ACE_INLINE bool
ACE_String_Base<CHAR>::is_empty (void) const
{
return this->len_ == 0;
}
+
template <class CHAR> ACE_INLINE bool
ACE_String_Base<CHAR>::empty (void) const
{
return this->is_empty ();
}
+
template <class CHAR> ACE_INLINE ACE_String_Base<CHAR>
ACE_String_Base<CHAR>::substr (
typename ACE_String_Base<CHAR>::size_type offset,
@@ -51,7 +60,9 @@ ACE_String_Base<CHAR>::substr (
ACE_TRACE ("ACE_String_Base<CHAR>::substr");
return this->substring (offset, length);
}
+
// Return the <slot'th> character in the string.
+
template <class CHAR> ACE_INLINE const CHAR &
ACE_String_Base<CHAR>::operator[] (
typename ACE_String_Base<CHAR>::size_type slot) const
@@ -59,7 +70,9 @@ ACE_String_Base<CHAR>::operator[] (
ACE_TRACE ("ACE_String_Base<CHAR>::operator[]");
return this->rep_[slot];
}
+
// Return the <slot'th> character in the string by reference.
+
template <class CHAR> ACE_INLINE CHAR &
ACE_String_Base<CHAR>::operator[] (
typename ACE_String_Base<CHAR>::size_type slot)
@@ -67,24 +80,30 @@ ACE_String_Base<CHAR>::operator[] (
ACE_TRACE ("ACE_String_Base<CHAR>::operator[]");
return this->rep_[slot];
}
+
template <class CHAR> ACE_INLINE const CHAR *
ACE_String_Base<CHAR>::fast_rep (void) const
{
return this->rep_;
}
+
template <class CHAR> ACE_INLINE const CHAR *
ACE_String_Base<CHAR>::c_str (void) const
{
return this->rep_;
}
+
// Less than comparison operator.
+
template <class CHAR> ACE_INLINE bool
ACE_String_Base<CHAR>::operator < (const ACE_String_Base<CHAR> &s) const
{
ACE_TRACE ("ACE_String_Base<CHAR>::operator <");
return compare (s) < 0;
}
+
// Greater than comparison operator.
+
template <class CHAR> ACE_INLINE bool
ACE_String_Base<CHAR>::operator > (const ACE_String_Base &s) const
{
@@ -92,18 +111,22 @@ ACE_String_Base<CHAR>::operator > (const ACE_String_Base &s) const
return compare (s) > 0;
}
+
// Comparison operator.
+
template <class CHAR> ACE_INLINE bool
ACE_String_Base<CHAR>::operator!= (const ACE_String_Base<CHAR> &s) const
{
ACE_TRACE ("ACE_String_Base<CHAR>::operator!=");
return !(*this == s);
}
+
template <class CHAR> ACE_INLINE bool
ACE_String_Base<CHAR>::operator!= (const CHAR *s) const
{
return !(*this == s);
}
+
template <class CHAR> ACE_INLINE typename ACE_String_Base<CHAR>::size_type
ACE_String_Base<CHAR>::find (const ACE_String_Base<CHAR>&str,
typename ACE_String_Base<CHAR>::size_type pos) const
@@ -111,22 +134,26 @@ ACE_String_Base<CHAR>::find (const ACE_String_Base<CHAR>&str,
ACE_TRACE ("ACE_String_Base<CHAR>::find");
return this->find (str.rep_, pos);
}
+
template <class CHAR> ACE_INLINE typename ACE_String_Base<CHAR>::size_type
ACE_String_Base<CHAR>::strstr (const ACE_String_Base<CHAR> &s) const
{
ACE_TRACE ("ACE_String_Base<CHAR>::strstr");
return this->find (s.rep_);
}
+
template <class CHAR> ACE_INLINE bool
operator== (const CHAR *s,
const ACE_String_Base<CHAR> &t)
{
return t == s;
}
+
template <class CHAR> ACE_INLINE bool
operator!= (const CHAR *s,
const ACE_String_Base<CHAR> &t)
{
return !(t == s);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/String_Base_Const.cpp b/dep/ACE_wrappers/ace/String_Base_Const.cpp
index 8c27f3e3405..85ebef15086 100644
--- a/dep/ACE_wrappers/ace/String_Base_Const.cpp
+++ b/dep/ACE_wrappers/ace/String_Base_Const.cpp
@@ -1,7 +1,10 @@
// $Id: String_Base_Const.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/String_Base_Const.h"
#include "ace/Numeric_Limits.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_String_Base_Const::size_type const ACE_String_Base_Const::npos =
#if defined (AIX) //&& (defined (__xlC__) || defined (__IBMCPP__))
// Under some mixed shared/static linking conditions, this constant
@@ -13,5 +16,6 @@ ACE_String_Base_Const::size_type const ACE_String_Base_Const::npos =
#else
ACE_Numeric_Limits<ACE_String_Base_Const::size_type>::max ();
#endif /* AIX */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/String_Base_Const.h b/dep/ACE_wrappers/ace/String_Base_Const.h
index 766f75c9c7b..ac76e511289 100644
--- a/dep/ACE_wrappers/ace/String_Base_Const.h
+++ b/dep/ACE_wrappers/ace/String_Base_Const.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file String_Base_Const.h
@@ -8,16 +9,22 @@
* @author Nanbor Wang <nanbor@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_STRING_BASE_CONST_H
#define ACE_STRING_BASE_CONST_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
#include "ace/Malloc_Base.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_String_Base_Const
*
@@ -30,12 +37,17 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
class ACE_Export ACE_String_Base_Const
{
public:
+
typedef ACE_Allocator::size_type size_type;
+
/// Constant that denotes case where no such character position
/// exists.
static size_type const npos;
+
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
#endif /* ACE_STRING_BASE_CONST_H */
diff --git a/dep/ACE_wrappers/ace/Svc_Conf.h b/dep/ACE_wrappers/ace/Svc_Conf.h
index e8f01f58a00..db10481a1f0 100644
--- a/dep/ACE_wrappers/ace/Svc_Conf.h
+++ b/dep/ACE_wrappers/ace/Svc_Conf.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Svc_Conf.h
@@ -9,18 +10,25 @@
*/
//=============================================================================
+
#ifndef ACE_SVC_CONF_H
#define ACE_SVC_CONF_H
+
#include /**/ "ace/pre.h"
+
#include "ace/Service_Config.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Parse_Node.h"
#include "ace/Svc_Conf_Param.h"
+
// Make sure the yacc(1) function declarations are _outside_
// any ACE versioned namespace. The block below is verbatim
// from the template that comes with bison (ver. 2.3).
+
#ifdef YYPARSE_PARAM
#if defined __STDC__ || defined __cplusplus
int ace_yyparse (void *YYPARSE_PARAM);
@@ -35,16 +43,21 @@ int ace_yyparse ();
#endif
#endif /* ! YYPARSE_PARAM */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
#if (ACE_USES_CLASSIC_SVC_CONF == 1)
+
// The following yylex() declarations require support for reentrant
// parser generation (e.g. from GNU Bison).
#define YY_DECL extern "C" int ace_yylex (YYSTYPE *ace_yylval, void *YYLEX_PARAM)
+
// Forward declarations
class ACE_Location_Node;
class ACE_Parse_Node;
class ACE_Static_Node;
class ACE_Service_Type_Factory;
+
// The following definition for the YYSTYPE must occur before
// YY_DECL is declared since YY_DECL expands to function
// prototypes that use YYSTYPE.
@@ -57,21 +70,30 @@ typedef union
ACE_Service_Type_Factory *svc_record_;
ACE_TCHAR *ident_;
} YYSTYPE;
+
#define YYSTYPE_IS_DECLARED
+
// Forward declaration
struct ace_yy_buffer_state;
+
/// Performs the lexical analysis
YY_DECL;
+
/// Name of input stream
extern FILE *ace_yyin;
+
/// Error handling routines required by YACC or BISON
extern void ace_yyerror (ACE_TCHAR const *);
extern void ace_yyerror (int yyerrno, int yylineno, ACE_TCHAR const *);
+
/// Holds the lexeme for the current token
extern ACE_TCHAR *ace_yytext;
+
/// Holds the length of the lexeme for the current token
extern int ace_yyleng;
+
#endif /* ACE_USES_CLASSIC_SVC_CONF == 1 */
+
/// Factory that creates a new ACE_Service_Type_Impl.
extern ACE_Service_Type_Impl *
ace_create_service_type (ACE_TCHAR const *,
@@ -80,7 +102,10 @@ ace_create_service_type (ACE_TCHAR const *,
unsigned int,
ACE_Service_Object_Exterminator = 0);
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
+
#endif /* ACE_SVC_CONF_H */
diff --git a/dep/ACE_wrappers/ace/Svc_Conf_Lexer.cpp b/dep/ACE_wrappers/ace/Svc_Conf_Lexer.cpp
index a2d7ec89d1c..b55af3b4439 100644
--- a/dep/ACE_wrappers/ace/Svc_Conf_Lexer.cpp
+++ b/dep/ACE_wrappers/ace/Svc_Conf_Lexer.cpp
@@ -1,10 +1,13 @@
// $Id: Svc_Conf_Lexer.cpp 81312 2008-04-09 21:01:34Z iliyan $
#include "ace/Svc_Conf_Lexer.h"
+
#if (ACE_USES_CLASSIC_SVC_CONF == 1)
+
#if defined (ACE_USES_WCHAR)
#include "ace/Encoding_Converter.h"
#include "ace/Encoding_Converter_Factory.h"
#endif /* ACE_USES_WCHAR */
+
#include "ace/Svc_Conf_Tokens.h"
#include "ace/Recursive_Thread_Mutex.h"
#include "ace/Static_Object_Lock.h"
@@ -14,13 +17,17 @@
#include "ace/Guard_T.h"
#include "ace/Synch_Traits.h"
#include "ace/os_include/os_ctype.h"
+
#if !defined (__GNUG__)
# include "ace/Auto_Ptr.h"
#endif
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
#define ACE_YY_BUF_SIZE 4096
#define ACE_MAX_BYTES_PER_CHAR 4
#define ACE_YY_CONVERSION_SPACE ACE_YY_BUF_SIZE * ACE_MAX_BYTES_PER_CHAR
+
#if defined (__GNUG__)
# define ACE_TEMPORARY_STRING(X,SIZE) \
__extension__ char X[SIZE]
@@ -37,9 +44,11 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
X = X ## buf; \
}
#endif /* __GNUG__ */
+
// These are states not covered by the tokens in Svc_Conf_Tokens.h
#define ACE_NO_STATE -1
#define ACE_COMMENT 0
+
#if defined (_MSC_VER) && (_MSC_VER >= 1400)
// Visual Studio .NET 2005 (VC8) issues warning C4351 for input_ in the
// constructor initializer list below. Since we like the warned-of new
@@ -48,6 +57,7 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
# pragma warning (push)
# pragma warning (disable:4351)
#endif /* VC8 */
+
struct ace_yy_buffer_state
{
ace_yy_buffer_state (void)
@@ -67,12 +77,14 @@ struct ace_yy_buffer_state
#if defined (_MSC_VER) && (_MSC_VER >= 1400)
# pragma warning (pop)
#endif /* VC8 */
+
~ace_yy_buffer_state (void)
{
#if defined (ACE_USES_WCHAR)
delete converter_;
#endif /* ACE_USES_WCHAR */
}
+
// Input related
char input_[ACE_YY_CONVERSION_SPACE];
size_t index_;
@@ -80,17 +92,21 @@ struct ace_yy_buffer_state
size_t start_;
bool need_more_;
bool eof_;
+
// Parsing related
int state_;
char string_start_;
+
#if defined (ACE_USES_WCHAR)
// Code set conversion related
ACE_Encoding_Converter* converter_;
#endif /* ACE_USES_WCHAR */
};
+
// ******************************************************************
// Global functions
// ******************************************************************
+
int
ace_yylex (YYSTYPE *ace_yylval, void *YYLEX_PARAM)
{
@@ -98,16 +114,21 @@ ace_yylex (YYSTYPE *ace_yylval, void *YYLEX_PARAM)
ace_mon,
*ACE_Static_Object_Lock::instance (),
-1));
+
return ACE_Svc_Conf_Lexer::yylex (ace_yylval, ACE_SVC_CONF_PARAM);
+
}
+
void
ace_yy_delete_buffer (ace_yy_buffer_state *buffer)
{
delete buffer;
}
+
// ******************************************************************
// Inline methods
// ******************************************************************
+
inline size_t
normalize (size_t length)
{
@@ -115,9 +136,11 @@ normalize (size_t length)
(length / ACE_MAX_BYTES_PER_CHAR) * ACE_MAX_BYTES_PER_CHAR :
length);
}
+
// ******************************************************************
// Static class methods
// ******************************************************************
+
int
ACE_Svc_Conf_Lexer::yylex (YYSTYPE* ace_yylval,
ACE_Svc_Conf_Param* param)
@@ -136,6 +159,7 @@ ACE_Svc_Conf_Lexer::yylex (YYSTYPE* ace_yylval,
ace_yy_buffer_state,
-1);
}
+
int token = ACE_NO_STATE;
do {
if (param->buffer->need_more_)
@@ -162,8 +186,10 @@ ACE_Svc_Conf_Lexer::yylex (YYSTYPE* ace_yylval,
if (look_for_bom)
{
size_t read_more = 0;
+
look_for_bom = false;
hint = locate_bom (param->buffer->input_, amount, read_more);
+
if (read_more != 0)
{
input (param,
@@ -178,6 +204,7 @@ ACE_Svc_Conf_Lexer::yylex (YYSTYPE* ace_yylval,
#endif /* ACE_USES_WCHAR */
param->buffer->size_ += amount;
}
+
#if defined (ACE_USES_WCHAR)
if (!convert_to_utf8 (param, skip_bytes, hint))
{
@@ -188,15 +215,19 @@ ACE_Svc_Conf_Lexer::yylex (YYSTYPE* ace_yylval,
}
#endif /* ACE_USES_WCHAR */
}
+
token = scan (ace_yylval, param);
} while (token == ACE_NO_STATE && param->buffer->need_more_);
+
return token;
}
+
size_t
ACE_Svc_Conf_Lexer::input (ACE_Svc_Conf_Param* param,
char* buf, size_t max_size)
{
size_t result = 0;
+
switch (param->type)
{
case ACE_Svc_Conf_Param::SVC_CONF_FILE:
@@ -242,13 +273,17 @@ ACE_Svc_Conf_Lexer::input (ACE_Svc_Conf_Param* param,
ACE_TEXT ("Invalid Service Configurator type in ")
ACE_TEXT ("ACE_Svc_Conf_Lexer::input"));
}
+
return result;
}
+
int
ACE_Svc_Conf_Lexer::scan (YYSTYPE* ace_yylval,
ACE_Svc_Conf_Param* param)
+
{
ace_yy_buffer_state* buffer = param->buffer;
+
// If we are not currently in any state, skip over whitespace
if (buffer->state_ == ACE_NO_STATE)
{
@@ -263,6 +298,7 @@ ACE_Svc_Conf_Lexer::scan (YYSTYPE* ace_yylval,
++buffer->index_;
}
}
+
size_t current;
size_t last = buffer->size_ + (buffer->eof_ ? 1 : 0);
for (current = buffer->index_; current < last; current++)
@@ -286,8 +322,10 @@ ACE_Svc_Conf_Lexer::scan (YYSTYPE* ace_yylval,
// The character at currrent is definitely not part of
// the string so we need to move current back one.
--current;
+
// Get the starting point of our string (skipping the quote)
char* source = buffer->input_ + buffer->index_ + 1;
+
// Now, we need to move back in the string until we find the
// same character that started the string
bool string_end_found = false;
@@ -303,6 +341,7 @@ ACE_Svc_Conf_Lexer::scan (YYSTYPE* ace_yylval,
}
}
}
+
if (!string_end_found)
{
ace_yyerror (++param->yyerrno,
@@ -310,6 +349,7 @@ ACE_Svc_Conf_Lexer::scan (YYSTYPE* ace_yylval,
ACE_TEXT ("Unable to find the end of the string"));
return ACE_NO_STATE;
}
+
size_t amount = (current - buffer->index_) - 1;
#if defined (ACE_USES_WCHAR)
ACE_TCHAR target[ACE_YY_CONVERSION_SPACE] = ACE_TEXT ("");
@@ -352,6 +392,7 @@ ACE_Svc_Conf_Lexer::scan (YYSTYPE* ace_yylval,
{
++param->yylineno;
}
+
if (current == buffer->index_ + 1)
{
int lower = ACE_OS::ace_tolower (
@@ -366,6 +407,7 @@ ACE_Svc_Conf_Lexer::scan (YYSTYPE* ace_yylval,
break;
}
}
+
if (current == buffer->index_)
{
buffer->index_ = current + 1;
@@ -380,6 +422,7 @@ ACE_Svc_Conf_Lexer::scan (YYSTYPE* ace_yylval,
return c;
}
}
+
// String from buffer->index_ to current (inclusive)
size_t size = (current - buffer->index_) + 1;
ACE_TEMPORARY_STRING (str, size);
@@ -387,6 +430,7 @@ ACE_Svc_Conf_Lexer::scan (YYSTYPE* ace_yylval,
size - 1);
str[size - 1] = '\0';
+
if (ACE_OS::strcmp (str, "dynamic") == 0)
{
buffer->index_ = current;
@@ -468,6 +512,7 @@ ACE_Svc_Conf_Lexer::scan (YYSTYPE* ace_yylval,
char* target = str;
#endif /* ACE_USES_WCHAR */
ace_yylval->ident_ = param->obstack.copy (target, amount);
+
// Determine the difference between pathname and ident
if (ACE_OS::ace_isdigit (ace_yylval->ident_[0]))
{
@@ -486,6 +531,7 @@ ACE_Svc_Conf_Lexer::scan (YYSTYPE* ace_yylval,
}
}
}
+
buffer->state_ = ACE_NO_STATE;
buffer->index_ = current;
return token;
@@ -499,6 +545,7 @@ ACE_Svc_Conf_Lexer::scan (YYSTYPE* ace_yylval,
return ACE_NO_STATE;
}
}
+
// We need more from the input source so, we will move the remainder of
// the buffer to the front and signal that we need more
if (!buffer->eof_)
@@ -521,7 +568,9 @@ ACE_Svc_Conf_Lexer::scan (YYSTYPE* ace_yylval,
}
return ACE_NO_STATE;
}
+
#if defined (ACE_USES_WCHAR)
+
bool
ACE_Svc_Conf_Lexer::convert_to_utf8 (
ACE_Svc_Conf_Param* param,
@@ -537,6 +586,7 @@ ACE_Svc_Conf_Lexer::convert_to_utf8 (
param->buffer->size_ - skip_bytes,
hint);
}
+
if (param->buffer->converter_ != 0)
{
char target[ACE_YY_CONVERSION_SPACE] = "";
@@ -551,8 +601,10 @@ ACE_Svc_Conf_Lexer::convert_to_utf8 (
status = true;
}
}
+
return status;
}
+
bool
ACE_Svc_Conf_Lexer::convert_from_utf8 (ACE_Encoding_Converter* converter,
const char* source,
@@ -577,9 +629,11 @@ ACE_Svc_Conf_Lexer::convert_from_utf8 (ACE_Encoding_Converter* converter,
ACE_OS::strncpy (target, ACE_TEXT_CHAR_TO_TCHAR (source), source_size);
target[source_size] = 0;
}
+
length = ACE_OS::strlen (target);
return true;
}
+
ACE_Encoding_Converter_Factory::Encoding_Hint
ACE_Svc_Conf_Lexer::locate_bom (char* source,
size_t source_size,
@@ -597,6 +651,7 @@ ACE_Svc_Conf_Lexer::locate_bom (char* source,
{ 2, "\xff\xfe", ACE_Encoding_Converter_Factory::ACE_UTF_16LE },
{ 3, "\xef\xbb\xbf", ACE_Encoding_Converter_Factory::ACE_UTF_8 },
};
+
for (size_t i = 0; i < sizeof (boms) / sizeof (bom); i++)
{
if (source_size >= boms[i].length_)
@@ -609,11 +664,14 @@ ACE_Svc_Conf_Lexer::locate_bom (char* source,
}
}
}
+
// No BOM was found
bytes_used = 0;
return ACE_Encoding_Converter_Factory::ACE_NONE;
}
+
#endif /* ACE_USES_WCHAR */
+
ACE_END_VERSIONED_NAMESPACE_DECL
#endif /* ACE_USES_CLASSIC_SVC_CONF = 1 */
diff --git a/dep/ACE_wrappers/ace/Svc_Conf_Lexer.h b/dep/ACE_wrappers/ace/Svc_Conf_Lexer.h
index 94772312b1f..c1759577e7e 100644
--- a/dep/ACE_wrappers/ace/Svc_Conf_Lexer.h
+++ b/dep/ACE_wrappers/ace/Svc_Conf_Lexer.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=========================================================================
/**
* @file Svc_Conf_Lexer.h
@@ -11,14 +12,20 @@
* @author Chad Elliott <elliott_c@ociweb.com>
*/
//=========================================================================
+
#ifndef SVC_CONF_LEXER_H
#define SVC_CONF_LEXER_H
+
#include /**/ "ace/pre.h"
#include "ace/Svc_Conf.h"
+
#if (ACE_USES_CLASSIC_SVC_CONF == 1)
#include "ace/Encoding_Converter_Factory.h"
+
class ACE_Encoding_Converter;
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/** This class lexes the classic ACE Service Configurator language.
* The entry point is similar to what flex would generate. However, it
* is a static method in this class (which is really just name space).
@@ -31,9 +38,12 @@ public:
/// parameter and uses input stored in the param parameter.
static int yylex (YYSTYPE* ace_yylval,
ACE_Svc_Conf_Param* param);
+
private:
static size_t input(ACE_Svc_Conf_Param* param, char* buf, size_t max_size);
+
static int scan (YYSTYPE* ace_yylval, ACE_Svc_Conf_Param* param);
+
#if defined (ACE_USES_WCHAR)
static bool convert_to_utf8 (
ACE_Svc_Conf_Param* param,
@@ -51,8 +61,11 @@ private:
size_t& bytes_used);
#endif /* ACE_USES_WCHAR */
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
#endif /* ACE_USES_CLASSIC_SVC_CONF = 1 */
+
#include /**/ "ace/post.h"
+
#endif /* SVC_CONF_LEXER_H */
diff --git a/dep/ACE_wrappers/ace/Svc_Conf_Param.h b/dep/ACE_wrappers/ace/Svc_Conf_Param.h
index 8354c00e231..a1c51844cec 100644
--- a/dep/ACE_wrappers/ace/Svc_Conf_Param.h
+++ b/dep/ACE_wrappers/ace/Svc_Conf_Param.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Svc_Conf_Param.h
@@ -11,20 +12,29 @@
*/
//=============================================================================
+
#ifndef ACE_SVC_CONF_PARAM_H
#define ACE_SVC_CONF_PARAM_H
+
#include /**/ "ace/pre.h"
+
// Globally visible macros, type decls, and extern var decls for
// Service Configurator utility.
+
#include "ace/Obstack.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward declarations.
struct ace_yy_buffer_state;
class ACE_Service_Gestalt;
+
extern void ace_yy_delete_buffer (ace_yy_buffer_state *buffer);
+
/**
* @class ACE_Svc_Conf_Param
*
@@ -44,13 +54,16 @@ extern void ace_yy_delete_buffer (ace_yy_buffer_state *buffer);
class ACE_Svc_Conf_Param
{
public:
+
enum SVC_CONF_PARAM_TYPE
{
/// The lexer will scan a file containing one or more directives.
SVC_CONF_FILE,
+
/// The lexer will scan a string containing a directive.
SVC_CONF_DIRECTIVE
};
+
/// Constructor
ACE_Svc_Conf_Param (ACE_Service_Gestalt* config, FILE *file)
: type (SVC_CONF_FILE),
@@ -62,6 +75,7 @@ public:
{
source.file = file;
}
+
/// Constructor
ACE_Svc_Conf_Param (ACE_Service_Gestalt* config, const ACE_TCHAR *directive)
: type (SVC_CONF_DIRECTIVE),
@@ -73,40 +87,57 @@ public:
{
source.directive = directive;
}
+
~ACE_Svc_Conf_Param (void)
{
ace_yy_delete_buffer (this->buffer);
}
+
public:
+
union
{
/// FILE stream from which directives will be scanned and parsed.
FILE *file;
+
/// String containing directive that will be scanned and parsed.
const ACE_TCHAR *directive;
+
} source;
+
/// Discriminant use to determine which union member to use.
SVC_CONF_PARAM_TYPE type;
+
/// Keeps track of the number of errors encountered so far.
int yyerrno;
+
/// Keeps track of the current line number for error-handling routine.
int yylineno;
+
/// Lexer buffer that corresponds to the current Service
/// Configurator file/direct scan.
ace_yy_buffer_state *buffer;
+
/// Obstack used for efficient memory allocation when
/// parsing/scanning a service configurator directive.
ACE_Obstack_T<ACE_TCHAR> obstack;
+
/// A reference to the configuration
ACE_Service_Gestalt *config;
};
+
// Parameter that is passed down to the yyparse() function, and
// eventually to yylex().
#define YYPARSE_PARAM ace_svc_conf_parameter
+
#define YYLEX_PARAM YYPARSE_PARAM
+
#define ACE_SVC_CONF_PARAM (static_cast<ACE_Svc_Conf_Param *> (YYLEX_PARAM))
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
+
#endif /* ACE_SVC_CONF_PARAM_H */
diff --git a/dep/ACE_wrappers/ace/Svc_Conf_Token_Table.h b/dep/ACE_wrappers/ace/Svc_Conf_Token_Table.h
index 5dd27408ec2..0ce301a6e15 100644
--- a/dep/ACE_wrappers/ace/Svc_Conf_Token_Table.h
+++ b/dep/ACE_wrappers/ace/Svc_Conf_Token_Table.h
@@ -1,20 +1,27 @@
/* A Bison parser, made by GNU Bison 2.3. */
+
/* Skeleton interface for Bison's Yacc-like parsers in C
+
$Id: Svc_Conf_Token_Table.h 82145 2008-06-24 11:03:50Z sma $
+
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
+
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
+
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
@@ -24,8 +31,10 @@
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
+
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
+
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
@@ -65,6 +74,8 @@
#define ACE_STRING 271
+
+
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef int YYSTYPE;
# define ace_yystype YYSTYPE /* obsolescent; will be withdrawn */
diff --git a/dep/ACE_wrappers/ace/Svc_Conf_Tokens.h b/dep/ACE_wrappers/ace/Svc_Conf_Tokens.h
index 98e1a019085..56a5820f46d 100644
--- a/dep/ACE_wrappers/ace/Svc_Conf_Tokens.h
+++ b/dep/ACE_wrappers/ace/Svc_Conf_Tokens.h
@@ -9,16 +9,22 @@
*/
//====================================================================
+
#ifndef BISON_SVC_CONF_TAB_H
# define BISON_SVC_CONF_TAB_H
+
/// This file "wraps" around the one produced by yacc(1) and ensures
/// that various symbols do not polute the global namespace. This
/// allows ACE-based applications to incorporate other yacc(1)-derived
/// parsers.
+
# if !defined (YYSTYPE_IS_DECLARED)
# define YYSTYPE_IS_DECLARED 1
# endif
+
# include "ace/Svc_Conf_Token_Table.h"
+
# undef YYSTYPE_IS_DECLARED
+
#endif /* ifndef BISON_SVC_CONF_TAB_H */
diff --git a/dep/ACE_wrappers/ace/Svc_Conf_y.cpp b/dep/ACE_wrappers/ace/Svc_Conf_y.cpp
index 97337bc2204..52b2bcbb2aa 100644
--- a/dep/ACE_wrappers/ace/Svc_Conf_y.cpp
+++ b/dep/ACE_wrappers/ace/Svc_Conf_y.cpp
@@ -1,19 +1,25 @@
/* A Bison parser, made by GNU Bison 2.3. */
+
/* Skeleton implementation for Bison's Yacc-like parsers in C
+
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
+
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
+
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
@@ -23,27 +29,37 @@
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
+
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
+
/* C LALR(1) parser skeleton written by Richard Stallman, by
simplifying the original so-called "semantic" parser. */
+
/* All symbols defined below should begin with ace_yy or YY, to avoid
infringing on user name space. This should be done even for local
variables, as they might otherwise be expanded by user macros.
There are some unavoidable exceptions within include files to
define necessary library symbols; they are noted "INFRINGES ON
USER NAME SPACE" below. */
+
/* Identify Bison output. */
#define YYBISON 1
+
/* Bison version. */
#define YYBISON_VERSION "2.3"
+
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
+
/* Pure parsers. */
#define YYPURE 1
+
/* Using locations. */
#define YYLSP_NEEDED 0
+
+
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
@@ -83,47 +99,66 @@
#define ACE_STRING 271
+
+
/* Copy the first part of user declarations. */
+
// $Id: Svc_Conf_y.cpp 82137 2008-06-23 15:30:20Z sma $
+
#include "ace/Svc_Conf.h"
+
#if (ACE_USES_CLASSIC_SVC_CONF == 1)
+
#include "ace/Module.h"
#include "ace/Stream.h"
#include "ace/Service_Types.h"
#include "ace/ace_wchar.h"
+
ACE_RCSID (ace,
Svc_Conf_y,
"$Id: Svc_Conf_y.cpp 82137 2008-06-23 15:30:20Z sma $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Prototypes.
+
static ACE_Module_Type *
ace_get_module (ACE_Service_Type const * sr,
ACE_TCHAR const * svc_name,
int & ace_ace_yyerrno);
+
#define YYDEBUG_LEXER_TEXT (ace_yytext[ace_yyleng] = '\0', ace_yytext)
+
// Force the pretty debugging code to compile.
// #define YYDEBUG 1
+
// Bison 2.3 template contains switch statement with a "default:", but
// without a "case:" label. Suppressing a compiler warning for Visual
// C++.
#if defined (_MSC_VER)
# pragma warning ( disable : 4065 )
#endif
+
// Normalize the message literal's type to match ace_yyerror() prototype
#define YY_ ACE_TEXT
+
// Prevent yacc(1) from declaring a trivial YYSTYPE just because
// YYSTYPE is not a macro definition. On the other hand we want
// YYSTYPE_IS_DECLARED to be as localized as possible to avoid
// poluting the global namespace - there may be other yacc(1) parsers
// that want to play nice with ACE
#define YYSTYPE_IS_DECLARED
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
+
/* Enabling traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
#endif
+
/* Enabling verbose error messages. */
#ifdef YYERROR_VERBOSE
# undef YYERROR_VERBOSE
@@ -131,10 +166,12 @@ ACE_END_VERSIONED_NAMESPACE_DECL
#else
# define YYERROR_VERBOSE 0
#endif
+
/* Enabling the token table. */
#ifndef YYTOKEN_TABLE
# define YYTOKEN_TABLE 0
#endif
+
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef int YYSTYPE;
# define ace_yystype YYSTYPE /* obsolescent; will be withdrawn */
@@ -142,18 +179,24 @@ typedef int YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
#endif
+
+
/* Copy the second part of user declarations. */
+
/* Line 216 of yacc.c. */
+
#ifdef short
# undef short
#endif
+
#ifdef YYTYPE_UINT8
typedef YYTYPE_UINT8 ace_yytype_uint8;
#else
typedef unsigned char ace_yytype_uint8;
#endif
+
#ifdef YYTYPE_INT8
typedef YYTYPE_INT8 ace_yytype_int8;
#elif (defined __STDC__ || defined __C99__FUNC__ \
@@ -162,16 +205,19 @@ typedef signed char ace_yytype_int8;
#else
typedef short int ace_yytype_int8;
#endif
+
#ifdef YYTYPE_UINT16
typedef YYTYPE_UINT16 ace_yytype_uint16;
#else
typedef unsigned short int ace_yytype_uint16;
#endif
+
#ifdef YYTYPE_INT16
typedef YYTYPE_INT16 ace_yytype_int16;
#else
typedef short int ace_yytype_int16;
#endif
+
#ifndef YYSIZE_T
# ifdef __SIZE_TYPE__
# define YYSIZE_T __SIZE_TYPE__
@@ -185,7 +231,9 @@ typedef short int ace_yytype_int16;
# define YYSIZE_T unsigned int
# endif
#endif
+
#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
+
#ifndef YY_
# if YYENABLE_NLS
# if ENABLE_NLS
@@ -197,12 +245,14 @@ typedef short int ace_yytype_int16;
# define YY_(msgid) msgid
# endif
#endif
+
/* Suppress unused-variable warnings by "using" E. */
#if ! defined lint || defined __GNUC__
# define YYUSE(e) ((void) (e))
#else
# define YYUSE(e) /* empty */
#endif
+
/* Identity function, used to suppress warnings about constant conditions. */
#ifndef lint
# define YYID(n) (n)
@@ -220,8 +270,11 @@ YYID (i)
return i;
}
#endif
+
#if ! defined ace_yyoverflow || YYERROR_VERBOSE
+
/* The parser invokes alloca or malloc; define the necessary symbols. */
+
# ifdef YYSTACK_USE_ALLOCA
# if YYSTACK_USE_ALLOCA
# ifdef __GNUC__
@@ -245,6 +298,7 @@ YYID (i)
# endif
# endif
# endif
+
# ifdef YYSTACK_ALLOC
/* Pacify GCC's `empty if-body' warning. */
# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
@@ -286,22 +340,27 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
# endif
#endif /* ! defined ace_yyoverflow || YYERROR_VERBOSE */
+
#if (! defined ace_yyoverflow \
&& (! defined __cplusplus \
|| (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
+
/* A type that is properly aligned for any stack member. */
union ace_yyalloc
{
ace_yytype_int16 ace_yyss;
YYSTYPE ace_yyvs;
};
+
/* The size of the maximum gap between one aligned stack and the next. */
# define YYSTACK_GAP_MAXIMUM (sizeof (union ace_yyalloc) - 1)
+
/* The size of an array large to enough to hold all stacks, each with
N elements. */
# define YYSTACK_BYTES(N) \
((N) * (sizeof (ace_yytype_int16) + sizeof (YYSTYPE)) \
+ YYSTACK_GAP_MAXIMUM)
+
/* Copy COUNT objects from FROM to TO. The source and destination do
not overlap. */
# ifndef YYCOPY
@@ -319,6 +378,7 @@ union ace_yyalloc
while (YYID (0))
# endif
# endif
+
/* Relocate STACK from its old location to the new one. The
local variables YYSIZE and YYSTACKSIZE give the old and new number of
elements in the stack, and YYPTR gives the new location of the
@@ -334,11 +394,14 @@ union ace_yyalloc
ace_yyptr += ace_yynewbytes / sizeof (*ace_yyptr); \
} \
while (YYID (0))
+
#endif
+
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 2
/* YYLAST -- Last index in YYTABLE. */
#define YYLAST 62
+
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 23
/* YYNNTS -- Number of nonterminals. */
@@ -347,11 +410,14 @@ union ace_yyalloc
#define YYNRULES 45
/* YYNRULES -- Number of states. */
#define YYNSTATES 66
+
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
#define YYMAXUTOK 271
+
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? ace_yytranslate[YYX] : YYUNDEFTOK)
+
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
static const ace_yytype_uint8 ace_yytranslate[] =
{
@@ -384,6 +450,7 @@ static const ace_yytype_uint8 ace_yytranslate[] =
5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16
};
+
#if YYDEBUG
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
YYRHS. */
@@ -395,6 +462,7 @@ static const ace_yytype_uint8 ace_yyprhs[] =
72, 74, 79, 81, 83, 84, 88, 94, 99, 102,
105, 108, 110, 111, 113, 115
};
+
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const ace_yytype_int8 ace_yyrhs[] =
{
@@ -411,6 +479,7 @@ static const ace_yytype_int8 ace_yyrhs[] =
22, -1, 11, 22, -1, 10, 22, -1, 16, -1,
-1, 14, -1, 15, -1, 16, -1
};
+
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const ace_yytype_uint16 ace_yyrline[] =
{
@@ -421,6 +490,7 @@ static const ace_yytype_uint16 ace_yyrline[] =
284, 291, 292, 296, 297, 298
};
#endif
+
#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
@@ -437,6 +507,7 @@ static const char *const ace_yytname[] =
"pathname", 0
};
#endif
+
# ifdef YYPRINT
/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
token YYLEX-NUM. */
@@ -447,6 +518,7 @@ static const ace_yytype_uint16 ace_yytoknum[] =
40, 41, 42
};
# endif
+
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const ace_yytype_uint8 ace_yyr1[] =
{
@@ -456,6 +528,7 @@ static const ace_yytype_uint8 ace_yyr1[] =
37, 38, 39, 39, 39, 40, 40, 40, 41, 41,
41, 42, 42, 43, 43, 43
};
+
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
static const ace_yytype_uint8 ace_yyr2[] =
{
@@ -465,6 +538,7 @@ static const ace_yytype_uint8 ace_yyr2[] =
1, 4, 1, 1, 0, 3, 5, 4, 2, 2,
2, 1, 0, 1, 1, 1
};
+
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
STATE-NUM when YYTABLE doesn't specify something else to do. Zero
means the default is an error. */
@@ -478,6 +552,7 @@ static const ace_yytype_uint8 ace_yydefact[] =
33, 31, 0, 0, 0, 35, 22, 26, 27, 28,
29, 30, 24, 37, 0, 36
};
+
/* YYDEFGOTO[NTERM-NUM]. */
static const ace_yytype_int8 ace_yydefgoto[] =
{
@@ -485,6 +560,7 @@ static const ace_yytype_int8 ace_yydefgoto[] =
26, 36, 47, 53, 62, 18, 51, 44, 30, 32,
45
};
+
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
#define YYPACT_NINF -13
@@ -498,6 +574,7 @@ static const ace_yytype_int8 ace_yypact[] =
-13, -13, 25, -1, 26, 23, -13, -13, -13, -13,
-13, -13, -13, -13, 27, -13
};
+
/* YYPGOTO[NTERM-NUM]. */
static const ace_yytype_int8 ace_yypgoto[] =
{
@@ -505,6 +582,7 @@ static const ace_yytype_int8 ace_yypgoto[] =
-13, 28, -13, -13, -13, -13, -13, -13, -13, 31,
-13
};
+
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
positive, shift that token. If negative, reduce the rule which
number is the opposite. If zero, do what YYDEFACT says.
@@ -520,6 +598,7 @@ static const ace_yytype_uint8 ace_yytable[] =
33, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 46
};
+
static const ace_yytype_int8 ace_yycheck[] =
{
9, 9, 3, 4, 5, 6, 7, 3, 4, 14,
@@ -530,6 +609,7 @@ static const ace_yytype_int8 ace_yycheck[] =
19, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 34
};
+
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const ace_yytype_uint8 ace_yystos[] =
@@ -542,19 +622,25 @@ static const ace_yytype_uint8 ace_yystos[] =
13, 39, 19, 36, 20, 15, 18, 26, 27, 28,
29, 30, 37, 21, 20, 21
};
+
#define ace_yyerrok (ace_yyerrstatus = 0)
#define ace_yyclearin (ace_yychar = YYEMPTY)
#define YYEMPTY (-2)
#define YYEOF 0
+
#define YYACCEPT goto ace_yyacceptlab
#define YYABORT goto ace_yyabortlab
#define YYERROR goto ace_yyerrorlab
+
/* Like YYERROR except do call ace_yyerror. This remains here temporarily
to ease the transition to the new meaning of YYERROR, for GCC.
Once GCC version 2 has supplanted version 1, this can go. */
+
#define YYFAIL goto ace_yyerrlab
+
#define YYRECOVERING() (!!ace_yyerrstatus)
+
#define YYBACKUP(Token, Value) \
do \
if (ace_yychar == YYEMPTY && ace_yylen == 1) \
@@ -572,12 +658,15 @@ do \
} \
while (YYID (0))
+
#define YYTERROR 1
#define YYERRCODE 256
+
/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
If N is 0, then set CURRENT to the empty location which ends
the previous symbol: RHS[0] (always defined). */
+
#define YYRHSLOC(Rhs, K) ((Rhs)[K])
#ifndef YYLLOC_DEFAULT
# define YYLLOC_DEFAULT(Current, Rhs, N) \
@@ -599,9 +688,11 @@ while (YYID (0))
while (YYID (0))
#endif
+
/* YY_LOCATION_PRINT -- Print the location on the stream.
This macro was not mandated originally: define only if we know
we won't break user code: when these are the locations we know. */
+
#ifndef YY_LOCATION_PRINT
# if YYLTYPE_IS_TRIVIAL
# define YY_LOCATION_PRINT(File, Loc) \
@@ -613,23 +704,29 @@ while (YYID (0))
# endif
#endif
+
/* YYLEX -- calling `ace_yylex' with the right arguments. */
+
#ifdef YYLEX_PARAM
# define YYLEX ace_yylex (&ace_yylval, YYLEX_PARAM)
#else
# define YYLEX ace_yylex (&ace_yylval)
#endif
+
/* Enable debugging if requested. */
#if YYDEBUG
+
# ifndef YYFPRINTF
# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
# define YYFPRINTF ACE_OS::fprintf
# endif
+
# define YYDPRINTF(Args) \
do { \
if (ace_yydebug) \
YYFPRINTF Args; \
} while (YYID (0))
+
# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
do { \
if (ace_yydebug) \
@@ -641,9 +738,11 @@ do { \
} \
} while (YYID (0))
+
/*--------------------------------.
| Print this symbol on YYOUTPUT. |
`--------------------------------*/
+
/*ARGSUSED*/
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
@@ -672,9 +771,11 @@ ace_yy_symbol_value_print (ace_yyoutput, ace_yytype, ace_yyvaluep)
}
}
+
/*--------------------------------.
| Print this symbol on YYOUTPUT. |
`--------------------------------*/
+
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static void
@@ -691,13 +792,16 @@ ace_yy_symbol_print (ace_yyoutput, ace_yytype, ace_yyvaluep)
YYFPRINTF (ace_yyoutput, "token %s (", ace_yytname[ace_yytype]);
else
YYFPRINTF (ace_yyoutput, "nterm %s (", ace_yytname[ace_yytype]);
+
ace_yy_symbol_value_print (ace_yyoutput, ace_yytype, ace_yyvaluep);
YYFPRINTF (ace_yyoutput, ")");
}
+
/*------------------------------------------------------------------.
| ace_yy_stack_print -- Print the state stack from its BOTTOM up to its |
| TOP (included). |
`------------------------------------------------------------------*/
+
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static void
@@ -714,15 +818,18 @@ ace_yy_stack_print (bottom, top)
YYFPRINTF (stderr, " %d", *bottom);
YYFPRINTF (stderr, "\n");
}
+
# define YY_STACK_PRINT(Bottom, Top) \
do { \
if (ace_yydebug) \
ace_yy_stack_print ((Bottom), (Top)); \
} while (YYID (0))
+
/*------------------------------------------------.
| Report that the YYRULE is going to be reduced. |
`------------------------------------------------*/
+
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static void
@@ -749,11 +856,13 @@ ace_yy_reduce_print (ace_yyvsp, ace_yyrule)
ACE_OS::fprintf (stderr, "\n");
}
}
+
# define YY_REDUCE_PRINT(Rule) \
do { \
if (ace_yydebug) \
ace_yy_reduce_print (ace_yyvsp, Rule); \
} while (YYID (0))
+
/* Nonzero means print parse trace. It is left uninitialized so that
multiple parsers can coexist. */
int ace_yydebug;
@@ -764,20 +873,27 @@ int ace_yydebug;
# define YY_REDUCE_PRINT(Rule)
#endif /* !YYDEBUG */
+
/* YYINITDEPTH -- initial size of the parser's stacks. */
#ifndef YYINITDEPTH
# define YYINITDEPTH 200
#endif
+
/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
if the built-in stack extension method is used).
+
Do not make this value too large; the results are undefined if
YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
evaluated with infinite-precision integer arithmetic. */
+
#ifndef YYMAXDEPTH
# define YYMAXDEPTH 10000
#endif
+
+
#if YYERROR_VERBOSE
+
# ifndef ace_yystrlen
# if defined __GLIBC__ && defined _STRING_H
# define ace_yystrlen strlen
@@ -800,6 +916,7 @@ ace_yystrlen (ace_yystr)
}
# endif
# endif
+
# ifndef ace_yystpcpy
# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
# define ace_yystpcpy stpcpy
@@ -819,12 +936,15 @@ ace_yystpcpy (ace_yydest, ace_yysrc)
{
char *ace_yyd = ace_yydest;
const char *ace_yys = ace_yysrc;
+
while ((*ace_yyd++ = *ace_yys++) != '\0')
continue;
+
return ace_yyd - 1;
}
# endif
# endif
+
# ifndef ace_yytnamerr
/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
quotes and backslashes, so that it's suitable for ace_yyerror. The
@@ -840,12 +960,14 @@ ace_yytnamerr (char *ace_yyres, const char *ace_yystr)
{
YYSIZE_T ace_yyn = 0;
char const *ace_yyp = ace_yystr;
+
for (;;)
switch (*++ace_yyp)
{
case '\'':
case ',':
goto do_not_strip_quotes;
+
case '\\':
if (*++ace_yyp != '\\')
goto do_not_strip_quotes;
@@ -855,6 +977,7 @@ ace_yytnamerr (char *ace_yyres, const char *ace_yystr)
ace_yyres[ace_yyn] = *ace_yyp;
ace_yyn++;
break;
+
case '"':
if (ace_yyres)
ace_yyres[ace_yyn] = '\0';
@@ -862,11 +985,14 @@ ace_yytnamerr (char *ace_yyres, const char *ace_yystr)
}
do_not_strip_quotes: ;
}
+
if (! ace_yyres)
return ace_yystrlen (ace_yystr);
+
return ace_yystpcpy (ace_yyres, ace_yystr) - ace_yyres;
}
# endif
+
/* Copy into YYRESULT an error message about the unexpected token
YYCHAR while in state YYSTATE. Return the number of bytes copied,
including the terminating null byte. If YYRESULT is null, do not
@@ -878,6 +1004,7 @@ static YYSIZE_T
ace_yysyntax_error (char *ace_yyresult, int ace_yystate, int ace_yychar)
{
int ace_yyn = ace_yypact[ace_yystate];
+
if (! (YYPACT_NINF < ace_yyn && ace_yyn <= YYLAST))
return 0;
else
@@ -890,6 +1017,7 @@ ace_yysyntax_error (char *ace_yyresult, int ace_yystate, int ace_yychar)
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
char const *ace_yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
int ace_yyx;
+
# if 0
/* This is so xgettext sees the translatable formats that are
constructed on the fly. */
@@ -909,15 +1037,19 @@ ace_yysyntax_error (char *ace_yyresult, int ace_yystate, int ace_yychar)
+ ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
* (sizeof ace_yyor - 1))];
char const *ace_yyprefix = ace_yyexpecting;
+
/* Start YYX at -YYN if negative to avoid negative indexes in
YYCHECK. */
int ace_yyxbegin = ace_yyn < 0 ? -ace_yyn : 0;
+
/* Stay within bounds of both ace_yycheck and ace_yytname. */
int ace_yychecklim = YYLAST - ace_yyn + 1;
int ace_yyxend = ace_yychecklim < YYNTOKENS ? ace_yychecklim : YYNTOKENS;
int ace_yycount = 1;
+
ace_yyarg[0] = ace_yytname[ace_yytype];
ace_yyfmt = ace_yystpcpy (ace_yyformat, ace_yyunexpected);
+
for (ace_yyx = ace_yyxbegin; ace_yyx < ace_yyxend; ++ace_yyx)
if (ace_yycheck[ace_yyx + ace_yyn] == ace_yyx && ace_yyx != YYTERROR)
{
@@ -935,12 +1067,15 @@ ace_yysyntax_error (char *ace_yyresult, int ace_yystate, int ace_yychar)
ace_yyfmt = ace_yystpcpy (ace_yyfmt, ace_yyprefix);
ace_yyprefix = ace_yyor;
}
+
ace_yyf = YY_(ace_yyformat);
ace_yysize1 = ace_yysize + ace_yystrlen (ace_yyf);
ace_yysize_overflow |= (ace_yysize1 < ace_yysize);
ace_yysize = ace_yysize1;
+
if (ace_yysize_overflow)
return YYSIZE_MAXIMUM;
+
if (ace_yyresult)
{
/* Avoid sprintf, as that infringes on the user's name space.
@@ -967,9 +1102,11 @@ ace_yysyntax_error (char *ace_yyresult, int ace_yystate, int ace_yychar)
}
#endif /* YYERROR_VERBOSE */
+
/*-----------------------------------------------.
| Release the memory associated to this symbol. |
`-----------------------------------------------*/
+
/*ARGSUSED*/
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
@@ -984,17 +1121,22 @@ ace_yydestruct (ace_yymsg, ace_yytype, ace_yyvaluep)
#endif
{
YYUSE (ace_yyvaluep);
+
if (!ace_yymsg)
ace_yymsg = "Deleting";
YY_SYMBOL_PRINT (ace_yymsg, ace_yytype, ace_yyvaluep, ace_yylocationp);
+
switch (ace_yytype)
{
+
default:
break;
}
}
+
/* Prevent warnings from -Wmissing-prototypes. */
+
#ifdef YYPARSE_PARAM
#if defined __STDC__ || defined __cplusplus
int ace_yyparse (void *YYPARSE_PARAM);
@@ -1011,9 +1153,13 @@ int ace_yyparse ();
+
+
+
/*----------.
| ace_yyparse. |
`----------*/
+
#ifdef YYPARSE_PARAM
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
@@ -1032,15 +1178,19 @@ ace_yyparse (void)
#else
int
ace_yyparse ()
+
#endif
#endif
{
/* The look-ahead symbol. */
int ace_yychar;
+
/* The semantic value of the look-ahead symbol. */
YYSTYPE ace_yylval;
+
/* Number of syntax errors so far. */
int ace_yynerrs;
+
int ace_yystate;
int ace_yyn;
int ace_yyresult;
@@ -1054,42 +1204,57 @@ int ace_yynerrs;
char *ace_yymsg = ace_yymsgbuf;
YYSIZE_T ace_yymsg_alloc = sizeof ace_yymsgbuf;
#endif
+
/* Three stacks and their tools:
`ace_yyss': related to states,
`ace_yyvs': related to semantic values,
`ace_yyls': related to locations.
+
Refer to the stacks thru separate pointers, to allow ace_yyoverflow
to reallocate them elsewhere. */
+
/* The state stack. */
ace_yytype_int16 ace_yyssa[YYINITDEPTH];
ace_yytype_int16 *ace_yyss = ace_yyssa;
ace_yytype_int16 *ace_yyssp;
+
/* The semantic value stack. */
YYSTYPE ace_yyvsa[YYINITDEPTH];
YYSTYPE *ace_yyvs = ace_yyvsa;
YYSTYPE *ace_yyvsp;
+
+
#define YYPOPSTACK(N) (ace_yyvsp -= (N), ace_yyssp -= (N))
+
YYSIZE_T ace_yystacksize = YYINITDEPTH;
+
/* The variables used to return semantic value and location from the
action routines. */
YYSTYPE ace_yyval;
+
/* The number of symbols on the RHS of the reduced rule.
Keep to zero when no symbol should be popped. */
int ace_yylen = 0;
+
YYDPRINTF ((stderr, "Starting parse\n"));
+
ace_yystate = 0;
ace_yyerrstatus = 0;
ace_yynerrs = 0;
ace_yychar = YYEMPTY; /* Cause a token to be read. */
+
/* Initialize stack pointers.
Waste one element of value and location stack
so that they stay on the same level as the state stack.
The wasted elements are never initialized. */
+
ace_yyssp = ace_yyss;
ace_yyvsp = ace_yyvs;
+
goto ace_yysetstate;
+
/*------------------------------------------------------------.
| ace_yynewstate -- Push a new state, which is found in ace_yystate. |
`------------------------------------------------------------*/
@@ -1097,12 +1262,15 @@ int ace_yynerrs;
/* In all cases, when you get here, the value and location stacks
have just been pushed. So pushing a state here evens the stacks. */
ace_yyssp++;
+
ace_yysetstate:
*ace_yyssp = ace_yystate;
+
if (ace_yyss + ace_yystacksize - 1 <= ace_yyssp)
{
/* Get the current used size of the three stacks, in elements. */
YYSIZE_T ace_yysize = ace_yyssp - ace_yyss + 1;
+
#ifdef ace_yyoverflow
{
/* Give user a chance to reallocate the stack. Use copies of
@@ -1111,6 +1279,7 @@ int ace_yynerrs;
YYSTYPE *ace_yyvs1 = ace_yyvs;
ace_yytype_int16 *ace_yyss1 = ace_yyss;
+
/* Each stack pointer address is followed by the size of the
data in use in that stack, in bytes. This used to be a
conditional around just the two extra args, but that might
@@ -1118,7 +1287,9 @@ int ace_yynerrs;
ace_yyoverflow (YY_("memory exhausted"),
&ace_yyss1, ace_yysize * sizeof (*ace_yyssp),
&ace_yyvs1, ace_yysize * sizeof (*ace_yyvsp),
+
&ace_yystacksize);
+
ace_yyss = ace_yyss1;
ace_yyvs = ace_yyvs1;
}
@@ -1132,6 +1303,7 @@ int ace_yynerrs;
ace_yystacksize *= 2;
if (YYMAXDEPTH < ace_yystacksize)
ace_yystacksize = YYMAXDEPTH;
+
{
ace_yytype_int16 *ace_yyss1 = ace_yyss;
union ace_yyalloc *ace_yyptr =
@@ -1140,39 +1312,51 @@ int ace_yynerrs;
goto ace_yyexhaustedlab;
YYSTACK_RELOCATE (ace_yyss);
YYSTACK_RELOCATE (ace_yyvs);
+
# undef YYSTACK_RELOCATE
if (ace_yyss1 != ace_yyssa)
YYSTACK_FREE (ace_yyss1);
}
# endif
#endif /* no ace_yyoverflow */
+
ace_yyssp = ace_yyss + ace_yysize - 1;
ace_yyvsp = ace_yyvs + ace_yysize - 1;
+
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
(unsigned long int) ace_yystacksize));
+
if (ace_yyss + ace_yystacksize - 1 <= ace_yyssp)
YYABORT;
}
+
YYDPRINTF ((stderr, "Entering state %d\n", ace_yystate));
+
goto ace_yybackup;
+
/*-----------.
| ace_yybackup. |
`-----------*/
ace_yybackup:
+
/* Do appropriate processing given the current state. Read a
look-ahead token if we need one and don't already have one. */
+
/* First try to decide what to do without reference to look-ahead token. */
ace_yyn = ace_yypact[ace_yystate];
if (ace_yyn == YYPACT_NINF)
goto ace_yydefault;
+
/* Not known => get a look-ahead token if don't already have one. */
+
/* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
if (ace_yychar == YYEMPTY)
{
YYDPRINTF ((stderr, "Reading a token: "));
ace_yychar = YYLEX;
}
+
if (ace_yychar <= YYEOF)
{
ace_yychar = ace_yytoken = YYEOF;
@@ -1183,6 +1367,7 @@ ace_yybackup:
ace_yytoken = YYTRANSLATE (ace_yychar);
YY_SYMBOL_PRINT ("Next token is", ace_yytoken, &ace_yylval, &ace_yylloc);
}
+
/* If the proper action on seeing token YYTOKEN is to reduce or to
detect an error, take that action. */
ace_yyn += ace_yytoken;
@@ -1196,21 +1381,28 @@ ace_yybackup:
ace_yyn = -ace_yyn;
goto ace_yyreduce;
}
+
if (ace_yyn == YYFINAL)
YYACCEPT;
+
/* Count tokens shifted since error; after three, turn off error
status. */
if (ace_yyerrstatus)
ace_yyerrstatus--;
+
/* Shift the look-ahead token. */
YY_SYMBOL_PRINT ("Shifting", ace_yytoken, &ace_yylval, &ace_yylloc);
+
/* Discard the shifted token unless it is eof. */
if (ace_yychar != YYEOF)
ace_yychar = YYEMPTY;
+
ace_yystate = ace_yyn;
*++ace_yyvsp = ace_yylval;
+
goto ace_yynewstate;
+
/*-----------------------------------------------------------.
| ace_yydefault -- do the default action for the current state. |
`-----------------------------------------------------------*/
@@ -1220,14 +1412,17 @@ ace_yydefault:
goto ace_yyerrlab;
goto ace_yyreduce;
+
/*-----------------------------.
| ace_yyreduce -- Do a reduction. |
`-----------------------------*/
ace_yyreduce:
/* ace_yyn is the number of a rule to reduce with. */
ace_yylen = ace_yyr2[ace_yyn];
+
/* If YYLEN is nonzero, implement the default value of the action:
`$$ = $1'.
+
Otherwise, the following line sets YYVAL to garbage.
This behavior is undocumented and Bison
users should not rely upon it. Assigning to YYVAL
@@ -1235,10 +1430,12 @@ ace_yyreduce:
GCC warning that YYVAL may be used uninitialized. */
ace_yyval = ace_yyvsp[1-ace_yylen];
+
YY_REDUCE_PRINT (ace_yyn);
switch (ace_yyn)
{
case 2:
+
{
if ((ace_yyvsp[(2) - (2)].parse_node_) != 0)
{
@@ -1248,12 +1445,16 @@ ace_yyreduce:
ACE_SVC_CONF_PARAM->obstack.release ();
;}
break;
+
case 3:
+
{
ACE_SVC_CONF_PARAM->obstack.release ();
;}
break;
+
case 11:
+
{
if ((ace_yyvsp[(2) - (3)].svc_record_) != 0)
(ace_yyval.parse_node_) = new ACE_Dynamic_Node ((ace_yyvsp[(2) - (3)].svc_record_), (ace_yyvsp[(3) - (3)].ident_));
@@ -1261,63 +1462,89 @@ ace_yyreduce:
(ace_yyval.parse_node_) = 0;
;}
break;
+
case 12:
+
{
(ace_yyval.parse_node_) = new ACE_Static_Node ((ace_yyvsp[(2) - (3)].ident_), (ace_yyvsp[(3) - (3)].ident_));
;}
break;
+
case 13:
+
{
(ace_yyval.parse_node_) = new ACE_Suspend_Node ((ace_yyvsp[(2) - (2)].ident_));
;}
break;
+
case 14:
+
{
(ace_yyval.parse_node_) = new ACE_Resume_Node ((ace_yyvsp[(2) - (2)].ident_));
;}
break;
+
case 15:
+
{
(ace_yyval.parse_node_) = new ACE_Remove_Node ((ace_yyvsp[(2) - (2)].ident_));
;}
break;
+
case 16:
+
{
(ace_yyval.parse_node_) = new ACE_Stream_Node ((ace_yyvsp[(2) - (3)].static_node_), (ace_yyvsp[(3) - (3)].parse_node_));
;}
break;
+
case 17:
+
{ (ace_yyval.static_node_) = new ACE_Static_Node ((ace_yyvsp[(2) - (2)].ident_)); ;}
break;
+
case 18:
+
{
(ace_yyval.parse_node_) = new ACE_Dummy_Node ((ace_yyvsp[(3) - (4)].static_node_), (ace_yyvsp[(4) - (4)].parse_node_));
;}
break;
+
case 19:
+
{
;}
break;
+
case 20:
+
{
;}
break;
+
case 21:
+
{
// Initialize left context...
(ace_yyval.static_node_) = (ace_yyvsp[(0) - (1)].static_node_);
;}
break;
+
case 22:
+
{
ACE_UNUSED_ARG ((ace_yyvsp[(2) - (4)]));
(ace_yyval.parse_node_) = (ace_yyvsp[(3) - (4)].parse_node_);
;}
break;
+
case 23:
+
{ (ace_yyval.parse_node_) = 0; ;}
break;
+
case 24:
+
{
if ((ace_yyvsp[(2) - (2)].parse_node_) != 0)
{
@@ -1326,19 +1553,26 @@ ace_yyreduce:
}
;}
break;
+
case 25:
+
{ (ace_yyval.parse_node_) = 0; ;}
break;
+
case 26:
+
{
;}
break;
+
case 27:
+
{
ACE_Static_Node *sn = (ace_yyvsp[(-1) - (1)].static_node_);
ACE_Module_Type *mt = ace_get_module (sn->record (ACE_SVC_CONF_PARAM->config),
(ace_yyvsp[(1) - (1)].static_node_)->name (),
ACE_SVC_CONF_PARAM->yyerrno);
+
if (((ACE_Stream_Type *) sn->record (ACE_SVC_CONF_PARAM->config)->type ())->push (mt) == -1)
{
ACE_ERROR ((LM_ERROR,
@@ -1347,7 +1581,9 @@ ace_yyreduce:
}
;}
break;
+
case 28:
+
{
ACE_Static_Node *sn = (ace_yyvsp[(-1) - (1)].static_node_);
ACE_Module_Type *mt = ace_get_module (sn->record (ACE_SVC_CONF_PARAM->config),
@@ -1357,7 +1593,9 @@ ace_yyreduce:
mt->suspend ();
;}
break;
+
case 29:
+
{
ACE_Static_Node *sn = (ace_yyvsp[(-1) - (1)].static_node_);
ACE_Module_Type *mt = ace_get_module (sn->record (ACE_SVC_CONF_PARAM->config),
@@ -1367,13 +1605,16 @@ ace_yyreduce:
mt->resume ();
;}
break;
+
case 30:
+
{
ACE_Static_Node *stream = (ace_yyvsp[(-1) - (1)].static_node_);
ACE_Static_Node *module = (ace_yyvsp[(1) - (1)].static_node_);
ACE_Module_Type *mt = ace_get_module (stream->record (ACE_SVC_CONF_PARAM->config),
module->name (),
ACE_SVC_CONF_PARAM->yyerrno);
+
ACE_Stream_Type *st =
dynamic_cast<ACE_Stream_Type *> (const_cast<ACE_Service_Type_Impl *> (stream->record (ACE_SVC_CONF_PARAM->config)->type ()));
if (!st || (mt != 0 && st->remove (mt) == -1))
@@ -1386,80 +1627,111 @@ ace_yyreduce:
}
;}
break;
+
case 31:
+
{
(ace_yyval.svc_record_) = new ACE_Service_Type_Factory ((ace_yyvsp[(1) - (4)].ident_), (ace_yyvsp[(2) - (4)].type_), (ace_yyvsp[(3) - (4)].location_node_), (ace_yyvsp[(4) - (4)].type_));
;}
break;
+
case 32:
+
{
(ace_yyval.type_) = 1;
;}
break;
+
case 33:
+
{
(ace_yyval.type_) = 0;
;}
break;
+
case 34:
+
{
(ace_yyval.type_) = 1;
;}
break;
+
case 35:
+
{
(ace_yyval.location_node_) = new ACE_Object_Node ((ace_yyvsp[(1) - (3)].ident_), (ace_yyvsp[(3) - (3)].ident_));
;}
break;
+
case 36:
+
{
(ace_yyval.location_node_) = new ACE_Function_Node ((ace_yyvsp[(1) - (5)].ident_), (ace_yyvsp[(3) - (5)].ident_));
;}
break;
+
case 37:
+
{
(ace_yyval.location_node_) = new ACE_Static_Function_Node ((ace_yyvsp[(2) - (4)].ident_));
;}
break;
+
case 38:
+
{
(ace_yyval.type_) = ACE_MODULE_T;
;}
break;
+
case 39:
+
{
(ace_yyval.type_) = ACE_SVC_OBJ_T;
;}
break;
+
case 40:
+
{
(ace_yyval.type_) = ACE_STREAM_T;
;}
break;
+
case 42:
+
{ (ace_yyval.ident_) = 0; ;}
break;
+
/* Line 1267 of yacc.c. */
+
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", ace_yyr1[ace_yyn], &ace_yyval, &ace_yyloc);
+
YYPOPSTACK (ace_yylen);
ace_yylen = 0;
YY_STACK_PRINT (ace_yyss, ace_yyssp);
+
*++ace_yyvsp = ace_yyval;
+
/* Now `shift' the result of the reduction. Determine what state
that goes to, based on the state we popped back to and the rule
number reduced by. */
+
ace_yyn = ace_yyr1[ace_yyn];
+
ace_yystate = ace_yypgoto[ace_yyn - YYNTOKENS] + *ace_yyssp;
if (0 <= ace_yystate && ace_yystate <= YYLAST && ace_yycheck[ace_yystate] == *ace_yyssp)
ace_yystate = ace_yytable[ace_yystate];
else
ace_yystate = ace_yydefgoto[ace_yyn - YYNTOKENS];
+
goto ace_yynewstate;
+
/*------------------------------------.
| ace_yyerrlab -- here on detecting error |
`------------------------------------*/
@@ -1489,6 +1761,7 @@ ace_yyerrlab:
ace_yymsg_alloc = sizeof ace_yymsgbuf;
}
}
+
if (0 < ace_yysize && ace_yysize <= ace_yymsg_alloc)
{
(void) ace_yysyntax_error (ace_yymsg, ace_yystate, ace_yychar);
@@ -1504,10 +1777,13 @@ ace_yyerrlab:
#endif
}
+
+
if (ace_yyerrstatus == 3)
{
/* If just tried and failed to reuse look-ahead token after an
error, discard it. */
+
if (ace_yychar <= YYEOF)
{
/* Return failure if at end of input. */
@@ -1521,19 +1797,23 @@ ace_yyerrlab:
ace_yychar = YYEMPTY;
}
}
+
/* Else will try to reuse look-ahead token after shifting the error
token. */
goto ace_yyerrlab1;
+
/*---------------------------------------------------.
| ace_yyerrorlab -- error raised explicitly by YYERROR. |
`---------------------------------------------------*/
ace_yyerrorlab:
+
/* Pacify compilers like GCC when the user code never invokes
YYERROR and the label ace_yyerrorlab therefore never appears in user
code. */
if (/*CONSTCOND*/ 0)
goto ace_yyerrorlab;
+
/* Do not reclaim the symbols of the rule which action triggered
this YYERROR. */
YYPOPSTACK (ace_yylen);
@@ -1542,11 +1822,13 @@ ace_yyerrorlab:
ace_yystate = *ace_yyssp;
goto ace_yyerrlab1;
+
/*-------------------------------------------------------------.
| ace_yyerrlab1 -- common code for both syntax error and YYERROR. |
`-------------------------------------------------------------*/
ace_yyerrlab1:
ace_yyerrstatus = 3; /* Each real token shifted decrements this. */
+
for (;;)
{
ace_yyn = ace_yypact[ace_yystate];
@@ -1560,37 +1842,46 @@ ace_yyerrlab1:
break;
}
}
+
/* Pop the current state because it cannot handle the error token. */
if (ace_yyssp == ace_yyss)
YYABORT;
+
ace_yydestruct ("Error: popping",
ace_yystos[ace_yystate], ace_yyvsp);
YYPOPSTACK (1);
ace_yystate = *ace_yyssp;
YY_STACK_PRINT (ace_yyss, ace_yyssp);
}
+
if (ace_yyn == YYFINAL)
YYACCEPT;
+
*++ace_yyvsp = ace_yylval;
+
/* Shift the error token. */
YY_SYMBOL_PRINT ("Shifting", ace_yystos[ace_yyn], ace_yyvsp, ace_yylsp);
+
ace_yystate = ace_yyn;
goto ace_yynewstate;
+
/*-------------------------------------.
| ace_yyacceptlab -- YYACCEPT comes here. |
`-------------------------------------*/
ace_yyacceptlab:
ace_yyresult = 0;
goto ace_yyreturn;
+
/*-----------------------------------.
| ace_yyabortlab -- YYABORT comes here. |
`-----------------------------------*/
ace_yyabortlab:
ace_yyresult = 1;
goto ace_yyreturn;
+
#ifndef ace_yyoverflow
/*-------------------------------------------------.
| ace_yyexhaustedlab -- memory exhaustion comes here. |
@@ -1600,6 +1891,7 @@ ace_yyexhaustedlab:
ace_yyresult = 2;
/* Fall through. */
#endif
+
ace_yyreturn:
if (ace_yychar != YYEOF && ace_yychar != YYEMPTY)
ace_yydestruct ("Cleanup: discarding lookahead",
@@ -1627,9 +1919,14 @@ ace_yyreturn:
}
+
+
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Prints the error string to standard output. Cleans up the error
// messages.
+
void
ace_yyerror (int ace_yyerrno, int ace_yylineno, ACE_TCHAR const * s)
{
@@ -1638,19 +1935,23 @@ ace_yyerror (int ace_yyerrno, int ace_yylineno, ACE_TCHAR const * s)
ACE_UNUSED_ARG (ace_yylineno);
ACE_UNUSED_ARG (s);
#endif /* ACE_NLOGGING */
+
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("ACE (%P|%t) [error %d] on line %d: %C\n"),
ace_yyerrno,
ace_yylineno,
s));
}
+
void
ace_yyerror (ACE_TCHAR const * s)
{
ace_yyerror (-1, -1, s);
}
+
// Note that SRC_REC represents left context, which is the STREAM *
// record.
+
static ACE_Module_Type *
ace_get_module (ACE_Service_Type const * sr,
ACE_TCHAR const * svc_name,
@@ -1662,6 +1963,7 @@ ace_get_module (ACE_Service_Type const * sr,
? 0
: dynamic_cast<ACE_Stream_Type const *> (type));
ACE_Module_Type const * const mt = (st == 0 ? 0 : st->find (svc_name));
+
if (sr == 0 || st == 0 || mt == 0)
{
ACE_ERROR ((LM_ERROR,
@@ -1671,20 +1973,27 @@ ace_get_module (ACE_Service_Type const * sr,
(sr ? sr->name () : ACE_TEXT ("(nil)"))));
++ace_yyerrno;
}
+
return const_cast<ACE_Module_Type *> (mt);
}
+
#if defined (SVC_CONF_Y_DEBUGGING)
// Main driver program.
+
int
ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
ACE_Svc_Conf_Param param (0, stdin);
+
// Try to reopen any filename argument to use YYIN.
if (argc > 1 && (ace_yyin = freopen (argv[1], "r", stdin)) == 0)
(void) ACE_OS::ACE_OS::fprintf (stderr, ACE_TEXT ("usage: %s [file]\n"), argv[0]), ACE_OS::exit (1);
+
return ::ace_yyparse (&param);
}
#endif /* SVC_CONF_Y_DEBUGGING */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_USES_CLASSIC_SVC_CONF == 1 */
diff --git a/dep/ACE_wrappers/ace/Svc_Handler.h b/dep/ACE_wrappers/ace/Svc_Handler.h
index 12e93f1fa91..f42cf42c4c0 100644
--- a/dep/ACE_wrappers/ace/Svc_Handler.h
+++ b/dep/ACE_wrappers/ace/Svc_Handler.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Svc_Handler.h
@@ -9,24 +10,33 @@
* @author Irfan Pyarali <irfan@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_SVC_HANDLER_H
#define ACE_SVC_HANDLER_H
+
#include /**/ "ace/pre.h"
+
#include "ace/Synch_Options.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Task.h"
#include "ace/Recyclable.h"
#include "ace/Reactor.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward decls.
class ACE_Connection_Recycling_Strategy;
+
// This enum is used as the flags parameter when calling the close()
// method on the ACE_Svc_Handler.
enum ACE_Svc_Handler_Close { NORMAL_CLOSE_OPERATION = 0x00,
CLOSE_DURING_NEW_CONNECTION = 0x01
};
+
/**
* @class ACE_Svc_Handler
*
@@ -47,9 +57,11 @@ template <ACE_PEER_STREAM_1, ACE_SYNCH_DECL>
class ACE_Svc_Handler : public ACE_Task<ACE_SYNCH_USE>
{
public:
+
// Useful STL-style traits.
typedef ACE_PEER_STREAM_ADDR addr_type;
typedef ACE_PEER_STREAM stream_type;
+
/**
* Constructor initializes the @a thr_mgr and @a mq by passing them
* down to the ACE_Task base class. The @a reactor is passed to
@@ -58,11 +70,14 @@ public:
ACE_Svc_Handler (ACE_Thread_Manager *thr_mgr = 0,
ACE_Message_Queue<ACE_SYNCH_USE> *mq = 0,
ACE_Reactor *reactor = ACE_Reactor::instance ());
+
/// Destructor.
virtual ~ACE_Svc_Handler (void);
+
/// Activate the client handler. This is typically called by the
/// ACE_Acceptor or ACE_Connector.
virtual int open (void * = 0);
+
/**
* Object termination hook -- application-specific cleanup code goes
* here. This function is called by the idle() function if the object
@@ -73,12 +88,14 @@ public:
* function is to call handle_close() with the default arguments.
*/
virtual int close (u_long flags = 0);
+
/**
* Call this method if you want to recycling the @c Svc_Handler
* instead of closing it. If the object does not have a recycler,
* it will be closed.
*/
virtual int idle (u_long flags = 0);
+
/**
* Call this method if you want to get/set the state of the
* @c Svc_Handler. If the object does not have a recycler, this call
@@ -87,23 +104,29 @@ public:
*/
virtual ACE_Recyclable_State recycle_state (void) const;
virtual int recycle_state (ACE_Recyclable_State new_state);
+
/**
* When the svc_handle is no longer needed around as a hint, call
* this method. In addition, reset @c *act_holder to zero if
* @a act_holder != 0.
*/
virtual void cleanup_hint (void **act_holder = 0);
+
// = Dynamic linking hooks.
/// Default version does no work and returns -1. Must be overloaded
/// by application developer to do anything meaningful.
virtual int init (int argc, ACE_TCHAR *argv[]);
+
/// Default version does no work and returns -1. Must be overloaded
/// by application developer to do anything meaningful.
virtual int fini (void);
+
/// Default version does no work and returns -1. Must be overloaded
/// by application developer to do anything meaningful.
virtual int info (ACE_TCHAR **info_string, size_t length) const;
+
// = Demultiplexing hooks.
+
/**
* Perform termination activities on the SVC_HANDLER. The default
* behavior is to close down the <peer_> (to avoid descriptor leaks)
@@ -112,22 +135,28 @@ public:
*/
virtual int handle_close (ACE_HANDLE = ACE_INVALID_HANDLE,
ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK);
+
/// Default behavior when timeouts occur is to close down the
/// <Svc_Handler> by calling <handle_close>.
virtual int handle_timeout (const ACE_Time_Value &time,
const void *);
+
/// Get the underlying handle associated with the <peer_>.
virtual ACE_HANDLE get_handle (void) const;
+
/// Set the underlying handle associated with the <peer_>.
virtual void set_handle (ACE_HANDLE);
+
/// Returns the underlying PEER_STREAM. Used by
/// <ACE_Acceptor::accept> and <ACE_Connector::connect> factories
ACE_PEER_STREAM &peer (void) const;
+
/// Overloaded new operator. This method unobtrusively records if a
/// <Svc_Handler> is allocated dynamically, which allows it to clean
/// itself up correctly whether or not it's allocated statically or
/// dynamically.
void *operator new (size_t n);
+
#if defined (ACE_HAS_NEW_NOTHROW)
/// Overloaded new operator, nothrow_t variant. Unobtrusively records if a
/// <Svc_Handler> is allocated dynamically, which allows it to clean
@@ -138,8 +167,10 @@ public:
void operator delete (void *p, const ACE_nothrow_t&) throw ();
#endif /* ACE_LACKS_PLACEMENT_OPERATOR_DELETE */
#endif
+
/// This operator permits "placement new" on a per-object basis.
void * operator new (size_t n, void *p);
+
/**
* Call this to free up dynamically allocated <Svc_Handlers>
* (otherwise you will get memory leaks). In general, you should
@@ -148,6 +179,7 @@ public:
* accordingly (i.e., deleting it if it was allocated dynamically).
*/
virtual void destroy (void);
+
/**
* This really should be private so that users are forced to call
* <destroy>. Unfortunately, the C++ standard doesn't allow there
@@ -156,6 +188,7 @@ public:
* know for sure that you've allocated the object dynamically.
*/
void operator delete (void *);
+
#if !defined (ACE_LACKS_PLACEMENT_OPERATOR_DELETE)
/**
* This operator is necessary to complement the class-specific
@@ -164,23 +197,33 @@ public:
*/
void operator delete (void *, void *);
#endif /* ACE_LACKS_PLACEMENT_OPERATOR_DELETE */
+
/// Close down the descriptor and unregister from the Reactor
void shutdown (void);
+
/// Dump the state of an object.
void dump (void) const;
+
public:
+
// = The following methods are not suppose to be public.
+
// Because friendship is *not* inherited in C++, these methods have
// to be public.
+
// = Accessors to set/get the connection recycler.
+
/// Set the recycler and the @a recycling_act that is used during
/// purging and caching.
virtual void recycler (ACE_Connection_Recycling_Strategy *recycler,
const void *recycling_act);
+
/// Get the recycler.
virtual ACE_Connection_Recycling_Strategy *recycler (void) const;
+
/// Get the recycling act.
virtual const void *recycling_act (void) const;
+
/**
* Upcall made by the recycler when it is about to recycle the
* connection. This gives the object a chance to prepare itself for
@@ -188,20 +231,26 @@ public:
* failures.
*/
virtual int recycle (void * = 0);
+
protected:
/// Maintain connection with client.
ACE_PEER_STREAM peer_;
+
/// Have we been dynamically created?
bool dynamic_;
+
/// Keeps track of whether we are in the process of closing (required
/// to avoid circular calls to <handle_close>).
bool closing_;
+
/// Pointer to the connection recycler.
ACE_Connection_Recycling_Strategy *recycler_;
+
/// Asynchronous Completion Token (ACT) to be used to when talking to
/// the recycler.
const void *recycling_act_;
};
+
/**
* @class ACE_Buffered_Svc_Handler
*
@@ -232,8 +281,10 @@ public:
ACE_Reactor *reactor = ACE_Reactor::instance (),
size_t max_buffer_size = 0,
ACE_Time_Value *relative_timeout = 0);
+
/// Destructor, which calls <flush>.
virtual ~ACE_Buffered_Svc_Handler (void);
+
/**
* Insert the ACE_Message_Block chain rooted at @a message_block
* into the ACE_Message_Queue with the designated @a timeout. The
@@ -243,39 +294,53 @@ public:
*/
virtual int put (ACE_Message_Block *message_block,
ACE_Time_Value *timeout = 0);
+
/// Flush the ACE_Message_Queue, which writes all the queued
/// ACE_Message_Blocks to the <PEER_STREAM>.
virtual int flush (void);
+
/// This method is not currently implemented -- this is where the
/// integration with the <Reactor> would occur.
virtual int handle_timeout (const ACE_Time_Value &time,
const void *);
+
/// Dump the state of an object.
void dump (void) const;
+
protected:
/// Implement the flush operation on the ACE_Message_Queue, which
/// writes all the queued ACE_Message_Blocks to the <PEER_STREAM>.
/// Assumes that the caller holds the lock.
virtual int flush_i (void);
+
/// Maximum size the <Message_Queue> can be before we have to flush
/// the buffer.
size_t maximum_buffer_size_;
+
/// Current size in bytes of the <Message_Queue> contents.
size_t current_buffer_size_;
+
/// Timeout value used to control when the buffer is flushed.
ACE_Time_Value next_timeout_;
+
/// Interval of the timeout.
ACE_Time_Value interval_;
+
/// Timeout pointer.
ACE_Time_Value *timeoutp_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Svc_Handler.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Svc_Handler.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_SVC_HANDLER_H */
diff --git a/dep/ACE_wrappers/ace/Synch.h b/dep/ACE_wrappers/ace/Synch.h
index caf1da4865c..756b969ea6d 100644
--- a/dep/ACE_wrappers/ace/Synch.h
+++ b/dep/ACE_wrappers/ace/Synch.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file Synch.h
@@ -10,16 +11,22 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//==========================================================================
+
#ifndef ACE_SYNCH_H
#define ACE_SYNCH_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if !defined (DO_NOT_INCLUDE_SYNCH_H)
+
/* All the classes have been moved out into their own headers as part of
the compile-time and footprint reduction effort. */
+
#include "ace/Auto_Event.h"
#include "ace/Barrier.h"
#include "ace/Condition_Thread_Mutex.h"
@@ -39,9 +46,11 @@
#include "ace/Thread_Mutex.h"
#include "ace/Thread_Semaphore.h"
#include "ace/TSS_Adapter.h"
+
// Include the templates here.
// FUZZ: disable check_for_synch_include
#include "ace/Synch_T.h"
+
#if defined (ACE_LEGACY_MODE)
# include "ace/File_Lock.h"
# include "ace/Process_Semaphore.h"
@@ -49,7 +58,9 @@
# include "ace/RW_Process_Mutex.h"
# include "ace/Test_and_Set.h"
#endif /* ACE_LEGACY_MODE */
+
#endif /* DO_NOT_INCLUDE_SYNCH_H */
+
#include /**/ "ace/post.h"
#endif /* ACE_SYNCH_H */
diff --git a/dep/ACE_wrappers/ace/Synch_Options.cpp b/dep/ACE_wrappers/ace/Synch_Options.cpp
index a7bb44128df..c6e2997ab3d 100644
--- a/dep/ACE_wrappers/ace/Synch_Options.cpp
+++ b/dep/ACE_wrappers/ace/Synch_Options.cpp
@@ -1,11 +1,16 @@
#include "ace/Synch_Options.h"
+
#include "ace/Global_Macros.h"
#include "ace/config-all.h"
+
ACE_RCSID (ace,
Synch_Options,
"$Id: Synch_Options.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE (ACE_Synch_Options)
+
void
ACE_Synch_Options::dump (void) const
{
@@ -13,14 +18,19 @@ ACE_Synch_Options::dump (void) const
ACE_TRACE ("ACE_Synch_Options::dump");
#endif /* ACE_HAS_DUMP */
}
+
// Static initialization.
// Note: these three objects require static construction and destruction.
+
/* static */
ACE_Synch_Options ACE_Synch_Options::defaults;
+
/* static */
ACE_Synch_Options ACE_Synch_Options::synch;
+
/* static */
ACE_Synch_Options ACE_Synch_Options::asynch (ACE_Synch_Options::USE_REACTOR);
+
ACE_Synch_Options::ACE_Synch_Options (unsigned long options,
const ACE_Time_Value &timeout,
const void *arg)
@@ -28,6 +38,7 @@ ACE_Synch_Options::ACE_Synch_Options (unsigned long options,
// ACE_TRACE ("ACE_Synch_Options::ACE_Synch_Options");
this->set (options, timeout, arg);
}
+
void
ACE_Synch_Options::set (unsigned long options,
const ACE_Time_Value &timeout,
@@ -36,55 +47,65 @@ ACE_Synch_Options::set (unsigned long options,
// ACE_TRACE ("ACE_Synch_Options::set");
this->options_ = options;
this->timeout_ = timeout;
+
// Whoa, possible dependence on static initialization here. This
// function is called during initialization of the statics above.
// But, ACE_Time_Value::zero is a static object. Very fortunately,
// its bits have a value of 0.
if (this->timeout_ != ACE_Time_Value::zero)
ACE_SET_BITS (this->options_, ACE_Synch_Options::USE_TIMEOUT);
+
this->arg_ = arg;
}
+
bool
ACE_Synch_Options::operator[] (unsigned long option) const
{
ACE_TRACE ("ACE_Synch_Options::operator[]");
return (this->options_ & option) != 0;
}
+
void
ACE_Synch_Options::operator= (unsigned long option)
{
ACE_TRACE ("ACE_Synch_Options::operator=");
this->options_ |= option;
}
+
const ACE_Time_Value &
ACE_Synch_Options::timeout (void) const
{
ACE_TRACE ("ACE_Synch_Options::timeout");
return this->timeout_;
}
+
void
ACE_Synch_Options::timeout (const ACE_Time_Value &tv)
{
ACE_TRACE ("ACE_Synch_Options::timeout");
this->timeout_ = tv;
}
+
const ACE_Time_Value *
ACE_Synch_Options::time_value (void) const
{
ACE_TRACE ("ACE_Synch_Options::time_value");
return (*this)[USE_TIMEOUT] ? &this->timeout_ : 0;
}
+
const void *
ACE_Synch_Options::arg (void) const
{
ACE_TRACE ("ACE_Synch_Options::arg");
return this->arg_;
}
+
void
ACE_Synch_Options::arg (const void *a)
{
ACE_TRACE ("ACE_Synch_Options::arg");
this->arg_ = a;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Synch_Options.h b/dep/ACE_wrappers/ace/Synch_Options.h
index a351b91ae08..6c39dd55218 100644
--- a/dep/ACE_wrappers/ace/Synch_Options.h
+++ b/dep/ACE_wrappers/ace/Synch_Options.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file Synch_Options.h
@@ -8,15 +9,22 @@
* @author Douglas C. Schmidt <schmidt@uci.edu>
*/
//==========================================================================
+
#ifndef ACE_SYNCH_OPTIONS_H
#define ACE_SYNCH_OPTIONS_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Time_Value.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Synch_Options
*
@@ -60,6 +68,7 @@ public:
/// Use the supplied timeout value.
USE_TIMEOUT = 02
};
+
/**
* Initialize the object to default values unless specified otherwise.
*
@@ -79,49 +88,66 @@ public:
ACE_Synch_Options (unsigned long options = 0,
const ACE_Time_Value &timeout = ACE_Time_Value::zero,
const void *arg = 0);
+
/// Initialize the object; arguments are the same as for the
/// constructor.
void set (unsigned long options = 0,
const ACE_Time_Value &timeout = ACE_Time_Value::zero,
const void *arg = 0);
+
/// Returns true if the specified option(s) are enabled, false otherwise.
bool operator[] (unsigned long option) const;
+
/// Adds the specified option(s) to the object; does not replace them.
void operator= (unsigned long option);
+
/// Returns the "magic cookie" argument.
const void *arg (void) const;
+
/// Set the "magic cookie" argument.
void arg (const void *);
+
/// Returns a reference to the ACE_Time_Value. This value only makes
/// sense if (*this)[USE_TIMEOUT] is true.
const ACE_Time_Value &timeout (void) const;
+
/// Set the timeout value. This method does not alter the options; in
/// particular, it doesn't add USE_TIMEOUT to the options when a non-zero
/// timeout is specified as the constructor and set() do.
void timeout (const ACE_Time_Value &tv);
+
/**
* Returns a timeout pointer if (*this)[USE_TIMEOUT] is true, else 0.
* This should be used with care, e.g., the timeout pointer should not
* be stored in a manner that will lead to dangling pointers.
*/
const ACE_Time_Value *time_value (void) const;
+
// = Static data members (singletons)
+
/// This is the default setting for options, which will block
/// synchronously.
static ACE_Synch_Options defaults;
+
/// This is the default synchronous setting.
static ACE_Synch_Options synch;
+
/// This is the default asynchronous setting.
static ACE_Synch_Options asynch;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Keeps track of the enabled options.
unsigned long options_;
+
/// Amount of time to wait for timeouts.
ACE_Time_Value timeout_;
+
/**
* "Magic cookie" always passed in as an argument to the ACE_Reactor's
* schedule_timer() method. Used to communicate values for
@@ -129,7 +155,10 @@ private:
*/
const void *arg_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
+
#endif /* ACE_SYNCH_OPTIONS_H */
diff --git a/dep/ACE_wrappers/ace/Synch_T.h b/dep/ACE_wrappers/ace/Synch_T.h
index c10d512f072..acd6da6eb86 100644
--- a/dep/ACE_wrappers/ace/Synch_T.h
+++ b/dep/ACE_wrappers/ace/Synch_T.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Synch_T.h
@@ -8,27 +9,35 @@
* @author Douglas C. Schmidt <schmidt@uci.edu>
*/
//=============================================================================
+
#ifndef ACE_SYNCH_T_H
#define ACE_SYNCH_T_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
// FUZZ: disable check_for_synch_include
#include "ace/Synch.h"
+
#include "ace/Lock_Adapter_T.h"
#include "ace/Reverse_Lock_T.h"
#include "ace/Guard_T.h"
#include "ace/TSS_T.h"
#include "ace/Condition_T.h"
#include "ace/Synch_Traits.h"
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Synch_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Synch_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
#endif /* ACE_SYNCH_T_H */
diff --git a/dep/ACE_wrappers/ace/Synch_Traits.h b/dep/ACE_wrappers/ace/Synch_Traits.h
index c30b9c6b609..c6649f9fdc8 100644
--- a/dep/ACE_wrappers/ace/Synch_Traits.h
+++ b/dep/ACE_wrappers/ace/Synch_Traits.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file Synch_Traits.h
@@ -10,15 +11,20 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//==========================================================================
+
#ifndef ACE_SYNCH_TRAITS_H
#define ACE_SYNCH_TRAITS_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h" /* Need to know threads, template settings */
#include "ace/Lock.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward decl
class ACE_Null_Mutex;
class ACE_Null_Condition;
@@ -31,7 +37,9 @@ class ACE_RW_Thread_Mutex;
class ACE_Condition_Thread_Mutex;
class ACE_Condition_Recursive_Thread_Mutex;
class ACE_Thread_Semaphore;
+
#if defined (ACE_HAS_TEMPLATE_TYPEDEFS)
+
/**
* @class ACE_NULL_SYNCH
*
@@ -52,9 +60,12 @@ public:
typedef ACE_Null_Semaphore SEMAPHORE;
typedef ACE_Null_Mutex NULL_SEMAPHORE;
};
+
#if defined (ACE_HAS_THREADS)
+
class ACE_Process_Mutex;
class ACE_Condition_Recursive_Thread_Mutex;
+
/**
* @class ACE_MT_SYNCH
*
@@ -78,7 +89,9 @@ public:
typedef ACE_Thread_Semaphore SEMAPHORE;
typedef ACE_Null_Semaphore NULL_SEMAPHORE;
};
+
#endif /* ACE_HAS_THREADS */
+
#define ACE_SYNCH_MUTEX ACE_SYNCH::MUTEX
#define ACE_SYNCH_NULL_MUTEX ACE_SYNCH::NULL_MUTEX
#define ACE_SYNCH_RECURSIVE_MUTEX ACE_SYNCH::RECURSIVE_MUTEX
@@ -87,7 +100,9 @@ public:
#define ACE_SYNCH_RECURSIVE_CONDITION ACE_SYNCH::RECURSIVE_CONDITION
#define ACE_SYNCH_NULL_SEMAPHORE ACE_SYNCH::NULL_SEMAPHORE
#define ACE_SYNCH_SEMAPHORE ACE_SYNCH::SEMAPHORE
+
#else /* !ACE_HAS_TEMPLATE_TYPEDEFS */
+
#if defined (ACE_HAS_OPTIMIZED_MESSAGE_QUEUE)
#define ACE_NULL_SYNCH ACE_Null_Mutex, ACE_Null_Condition, ACE_Null_Mutex
#define ACE_MT_SYNCH ACE_Thread_Mutex, ACE_Condition_Thread_Mutex, ACE_Thread_Semaphore
@@ -95,7 +110,9 @@ public:
#define ACE_NULL_SYNCH ACE_Null_Mutex, ACE_Null_Condition
#define ACE_MT_SYNCH ACE_Thread_Mutex, ACE_Condition_Thread_Mutex
#endif /* ACE_HAS_OPTIMIZED_MESSAGE_QUEUE */
+
#if defined (ACE_HAS_THREADS)
+
#define ACE_SYNCH_MUTEX ACE_Thread_Mutex
#define ACE_SYNCH_NULL_MUTEX ACE_Null_Mutex
#define ACE_SYNCH_RECURSIVE_MUTEX ACE_Recursive_Thread_Mutex
@@ -104,7 +121,9 @@ public:
#define ACE_SYNCH_RECURSIVE_CONDITION ACE_Condition_Recursive_Thread_Mutex
#define ACE_SYNCH_SEMAPHORE ACE_Thread_Semaphore
#define ACE_SYNCH_NULL_SEMAPHORE ACE_Null_Semaphore
+
#else /* ACE_HAS_THREADS */
+
#define ACE_SYNCH_MUTEX ACE_Null_Mutex
#define ACE_SYNCH_NULL_MUTEX ACE_Null_Mutex
#define ACE_SYNCH_RECURSIVE_MUTEX ACE_Null_Mutex
@@ -113,17 +132,22 @@ public:
#define ACE_SYNCH_RECURSIVE_CONDITION ACE_Null_Condition
#define ACE_SYNCH_SEMAPHORE ACE_Null_Semaphore
#define ACE_SYNCH_NULL_SEMAPHORE ACE_Null_Mutex
+
#endif /* ACE_HAS_THREADS */
#endif /* ACE_HAS_TEMPLATE_TYPEDEFS */
+
// These are available on *all* platforms
#define ACE_SYNCH_PROCESS_SEMAPHORE ACE_Process_Semaphore
#define ACE_SYNCH_PROCESS_MUTEX ACE_Process_Mutex
+
#if defined (ACE_HAS_THREADS)
#define ACE_SYNCH ACE_MT_SYNCH
#else /* ACE_HAS_THREADS */
#define ACE_SYNCH ACE_NULL_SYNCH
#endif /* ACE_HAS_THREADS */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
#endif /* ACE_SYNCH_TRAITS_H */
diff --git a/dep/ACE_wrappers/ace/System_Time.cpp b/dep/ACE_wrappers/ace/System_Time.cpp
index da99ece0c7d..bda4db87afe 100644
--- a/dep/ACE_wrappers/ace/System_Time.cpp
+++ b/dep/ACE_wrappers/ace/System_Time.cpp
@@ -1,4 +1,5 @@
// $Id: System_Time.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/System_Time.h"
#include "ace/MMAP_Memory_Pool.h"
#include "ace/Malloc_T.h"
@@ -6,13 +7,17 @@
#include "ace/Time_Value.h"
#include "ace/OS_NS_string.h"
#include "ace/OS_NS_time.h"
+
ACE_RCSID(ace, System_Time, "$Id: System_Time.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_System_Time::ACE_System_Time (const ACE_TCHAR *poolname)
: shmem_ (0)
, delta_time_ (0)
{
ACE_TRACE ("ACE_System_Time::ACE_System_Time");
+
// Only create a new unique filename for the memory pool file
// if the user didn't supply one...
if (poolname == 0)
@@ -31,23 +36,29 @@ ACE_System_Time::ACE_System_Time (const ACE_TCHAR *poolname)
ACE_TEXT ("defaulting to current directory\n")));
this->poolname_[0] = 0;
}
+
// Add the filename to the end
ACE_OS::strcat (this->poolname_, ACE_TEXT ("ace-malloc-XXXXXX"));
+
#endif /* ACE_DEFAULT_BACKING_STORE */
}
else
ACE_OS::strsncpy (this->poolname_,
poolname,
(sizeof this->poolname_ / sizeof (ACE_TCHAR)));
+
ACE_NEW (this->shmem_,
ALLOCATOR (this->poolname_));
}
+
ACE_System_Time::~ACE_System_Time (void)
{
ACE_TRACE ("ACE_System_Time::~ACE_System_Time");
delete this->shmem_;
}
+
// Get the local system time.
+
int
ACE_System_Time::get_local_system_time (time_t & time_out)
{
@@ -55,6 +66,7 @@ ACE_System_Time::get_local_system_time (time_t & time_out)
time_out = ACE_OS::time (0);
return 0;
}
+
int
ACE_System_Time::get_local_system_time (ACE_Time_Value &time_out)
{
@@ -62,11 +74,14 @@ ACE_System_Time::get_local_system_time (ACE_Time_Value &time_out)
time_out.set (ACE_OS::time (0), 0);
return 0;
}
+
// Get the system time of the central time server.
+
int
ACE_System_Time::get_master_system_time (time_t &time_out)
{
ACE_TRACE ("ACE_System_Time::get_master_system_time");
+
if (this->delta_time_ == 0)
{
// Try to find it
@@ -81,7 +96,9 @@ ACE_System_Time::get_master_system_time (time_t &time_out)
// Extract the delta time.
this->delta_time_ = static_cast<long *> (temp);
}
+
time_t local_time;
+
// If delta_time is positive, it means that the system clock is
// ahead of our local clock so add delta to the local time to get an
// approximation of the system time. Else if delta time is negative,
@@ -98,6 +115,7 @@ ACE_System_Time::get_master_system_time (time_t &time_out)
time_out = *(this->delta_time_ + 1);
return 0;
}
+
int
ACE_System_Time::get_master_system_time (ACE_Time_Value &time_out)
{
@@ -108,13 +126,16 @@ ACE_System_Time::get_master_system_time (ACE_Time_Value &time_out)
time_out.sec (to);
return 0;
}
+
// Synchronize local system time with the central time server using
// specified mode (currently unimplemented).
+
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);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/System_Time.h b/dep/ACE_wrappers/ace/System_Time.h
index 9c1ec51820d..2b1c329108e 100644
--- a/dep/ACE_wrappers/ace/System_Time.h
+++ b/dep/ACE_wrappers/ace/System_Time.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file System_Time.h
@@ -10,23 +11,31 @@
* @author Douglas C. Schmidt
*/
//=============================================================================
+
#ifndef ACE_SYSTEM_TIME_H
#define ACE_SYSTEM_TIME_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Global_Macros.h"
#include "ace/os_include/os_time.h" /* For time_t. */
#include "ace/os_include/os_limits.h" /* For MAXPATHLEN. */
#include "ace/MMAP_Memory_Pool.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template<ACE_MEM_POOL_1, class ACE_LOCK> class ACE_Malloc;
template<class MALLOC> class ACE_Allocator_Adapter;
+
class ACE_Null_Mutex;
class ACE_Time_Value;
class ACE_MMAP_Memory_Pool;
+
/**
* @class ACE_System_Time
*
@@ -45,34 +54,47 @@ public:
* the system time of the master clock.
*/
enum Sync_Mode { Jump, Adjust };
+
/// Default constructor.
ACE_System_Time (const ACE_TCHAR *poolname = 0);
+
/// Default destructor.
~ACE_System_Time (void);
+
/// Get the local system time, i.e., the value returned by
/// ACE_OS::time().
static int get_local_system_time (time_t & time_out);
+
/// Get the local system time, i.e., the value returned by
/// ACE_OS::time().
static int get_local_system_time (ACE_Time_Value &time_out);
+
/// Get the system time of the central time server.
int get_master_system_time (time_t & time_out);
+
/// Get the system time of the central time server.
int get_master_system_time (ACE_Time_Value &time_out);
+
/// Synchronize local system time with the central time server using
/// specified mode.
int sync_local_system_time (ACE_System_Time::Sync_Mode mode);
+
private:
typedef ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex> MALLOC;
typedef ACE_Allocator_Adapter<MALLOC> ALLOCATOR;
+
/// Our allocator (used for obtaining system time from shared memory).
ALLOCATOR * shmem_;
+
/// The name of the pool used by the allocator.
ACE_TCHAR poolname_[MAXPATHLEN + 1];
+
/// Pointer to delta time kept in shared memory.
long * delta_time_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
#endif /* ACE_SYSTEM_TIME_H */
diff --git a/dep/ACE_wrappers/ace/TLI.cpp b/dep/ACE_wrappers/ace/TLI.cpp
index 9e3ddf6a9eb..3f3431a3d9b 100644
--- a/dep/ACE_wrappers/ace/TLI.cpp
+++ b/dep/ACE_wrappers/ace/TLI.cpp
@@ -1,6 +1,8 @@
// $Id: TLI.cpp 80826 2008-03-04 14:51:23Z wotte $
+
// Defines the member functions for the base class of the ACE_TLI
// abstraction.
+
#include "ace/TLI.h"
#include "ace/Log_Msg.h"
#include "ace/OS_Memory.h"
@@ -8,13 +10,19 @@
#include "ace/OS_NS_string.h"
#include "ace/OS_NS_sys_socket.h"
#include "ace/Auto_Ptr.h"
+
ACE_RCSID(ace, TLI, "$Id: TLI.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if defined (ACE_HAS_TLI)
+
#if !defined (__ACE_INLINE__)
#include "ace/TLI.inl"
#endif /* __ACE_INLINE__ */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_TLI)
+
void
ACE_TLI::dump (void) const
{
@@ -22,6 +30,7 @@ ACE_TLI::dump (void) const
ACE_TRACE ("ACE_TLI::dump");
#endif /* ACE_HAS_DUMP */
}
+
ACE_TLI::ACE_TLI (void)
{
ACE_TRACE ("ACE_TLI::ACE_TLI");
@@ -29,12 +38,15 @@ ACE_TLI::ACE_TLI (void)
// Solaris 2.4 ACE_TLI option handling is broken. Thus, we must do
// the memory allocation ourselves... Thanks to John P. Hearn
// (jph@ccrl.nj.nec.com) for the help.
+
this->so_opt_req.opt.maxlen = sizeof (opthdr) + sizeof (long);
ACE_NEW (this->so_opt_req.opt.buf,
char[this->so_opt_req.opt.maxlen]);
+
this->so_opt_ret.opt.maxlen = sizeof (opthdr) + sizeof (long);
ACE_NEW (this->so_opt_ret.opt.buf,
char[this->so_opt_ret.opt.maxlen]);
+
if (this->so_opt_ret.opt.buf == 0)
{
delete [] this->so_opt_req.opt.buf;
@@ -43,6 +55,7 @@ ACE_TLI::ACE_TLI (void)
}
#endif /* ACE_HAS_SVR4_TLI */
}
+
ACE_HANDLE
ACE_TLI::open (const char device[], int oflag, struct t_info *info)
{
@@ -50,8 +63,10 @@ ACE_TLI::open (const char device[], int oflag, struct t_info *info)
if (oflag == 0)
oflag = O_RDWR;
this->set_handle (ACE_OS::t_open ((char *) device, oflag, info));
+
return this->get_handle ();
}
+
ACE_TLI::~ACE_TLI (void)
{
ACE_TRACE ("ACE_TLI::~ACE_TLI");
@@ -65,6 +80,7 @@ ACE_TLI::~ACE_TLI (void)
}
#endif /* ACE_HAS_SVR4_TLI */
}
+
ACE_TLI::ACE_TLI (const char device[], int oflag, struct t_info *info)
{
ACE_TRACE ("ACE_TLI::ACE_TLI");
@@ -73,23 +89,28 @@ ACE_TLI::ACE_TLI (const char device[], int oflag, struct t_info *info)
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_TLI::ACE_TLI")));
}
+
int
ACE_TLI::get_local_addr (ACE_Addr &sa) const
{
ACE_TRACE ("ACE_TLI::get_local_addr");
struct netbuf name;
+
name.maxlen = sa.get_size ();
name.buf = (char *) sa.get_addr ();
+
if (ACE_OS::t_getname (this->get_handle (), &name, LOCALNAME) == -1)
return -1;
else
return 0;
}
+
int
ACE_TLI::close (void)
{
ACE_TRACE ("ACE_TLI::close");
int result = 0; // Geisler: result must be int
+
if (this->get_handle () != ACE_INVALID_HANDLE)
{
result = ACE_OS::t_close (this->get_handle ());
@@ -97,11 +118,13 @@ ACE_TLI::close (void)
}
return result;
}
+
int
ACE_TLI::set_option (int level, int option, void *optval, int optlen)
{
/* Set up options for ACE_TLI */
ACE_TRACE ("ACE_TLI::set_option");
+
#if defined (ACE_HAS_XTI)
// ret will get the negotiated option back after attempting to set it.
// Assume this will fit in the requested size.
@@ -120,6 +143,7 @@ ACE_TLI::set_option (int level, int option, void *optval, int optlen)
# else
ACE_Auto_Array_Ptr<char> ret_opt_buf_p (ret.opt.buf);
# endif /* XPG5 vs XPG4 */
+
req.flags = T_NEGOTIATE;
req.opt.len = sizeof *opthdr + optlen;
ret.opt.maxlen = req.opt.len;
@@ -128,10 +152,13 @@ ACE_TLI::set_option (int level, int option, void *optval, int optlen)
opthdr->len = req.opt.len; // We only request one option at a time.
ACE_OS::memcpy (&opthdr[1], optval, optlen);
return ACE_OS::t_optmgmt (this->get_handle (), &req, &ret);
+
#elif defined (ACE_HAS_SVR4_TLI)
struct opthdr *opthdr = 0; /* See <sys/socket.h> for info on this format */
+
this->so_opt_req.flags = T_NEGOTIATE;
this->so_opt_req.opt.len = sizeof *opthdr + OPTLEN (optlen);
+
if (this->so_opt_req.opt.len > this->so_opt_req.opt.maxlen)
{
# if !defined (ACE_HAS_SET_T_ERRNO)
@@ -141,11 +168,13 @@ ACE_TLI::set_option (int level, int option, void *optval, int optlen)
# endif /* ACE_HAS_SET_T_ERRNO */
return -1;
}
+
opthdr = reinterpret_cast<struct opthdr *> (this->so_opt_req.opt.buf);
opthdr->level = level;
opthdr->name = option;
opthdr->len = OPTLEN (optlen);
ACE_OS::memcpy (OPTVAL (opthdr), optval, optlen);
+
return ACE_OS::t_optmgmt (this->get_handle (),
&this->so_opt_req,
&this->so_opt_ret);
@@ -157,6 +186,7 @@ ACE_TLI::set_option (int level, int option, void *optval, int optlen)
return -1;
#endif /* ACE_HAS_XTI, else ACE_HAS_SVR4_TLI */
}
+
int
ACE_TLI::get_option (int level, int option, void *optval, int &optlen)
{
@@ -178,6 +208,7 @@ ACE_TLI::get_option (int level, int option, void *optval, int &optlen)
# else
ACE_Auto_Array_Ptr<char> ret_opt_buf_p (ret.opt.buf);
# endif /* XPG5 vs XPG4 */
+
req.flags = T_CURRENT;
req.opt.len = sizeof *opthdr;
ret.opt.maxlen = sizeof (struct t_opthdr) + optlen;
@@ -200,10 +231,13 @@ ACE_TLI::get_option (int level, int option, void *optval, int &optlen)
return 0;
}
}
+
#elif defined (ACE_HAS_SVR4_TLI)
struct opthdr *opthdr = 0; /* See <sys/socket.h> for details on this format */
+
this->so_opt_req.flags = T_CHECK;
this->so_opt_ret.opt.len = sizeof *opthdr + OPTLEN (optlen);
+
if (this->so_opt_ret.opt.len > this->so_opt_ret.opt.maxlen)
{
#if !defined (ACE_HAS_SET_T_ERRNO)
@@ -213,6 +247,7 @@ ACE_TLI::get_option (int level, int option, void *optval, int &optlen)
#endif /* ACE_HAS_SET_T_ERRNO */
return -1;
}
+
opthdr = (struct opthdr *) this->so_opt_req.opt.buf;
opthdr->level = level;
opthdr->name = option;
@@ -232,6 +267,8 @@ ACE_TLI::get_option (int level, int option, void *optval, int &optlen)
return -1;
#endif /* ACE_HAS_SVR4_TLI */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_TLI */
diff --git a/dep/ACE_wrappers/ace/TLI.h b/dep/ACE_wrappers/ace/TLI.h
index c474eb88f4c..0beab16a1f8 100644
--- a/dep/ACE_wrappers/ace/TLI.h
+++ b/dep/ACE_wrappers/ace/TLI.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file TLI.h
@@ -9,24 +10,32 @@
*/
//=============================================================================
+
#ifndef ACE_TLI_H
#define ACE_TLI_H
#include /**/ "ace/pre.h"
+
#include "ace/config-lite.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/OS_TLI.h"
+
#if defined (ACE_HAS_TLI)
+
#include "ace/IPC_SAP.h"
#include "ace/Addr.h"
#include "ace/os_include/os_fcntl.h"
+
// There's not a universal device name for TLI devices. If the platform
// needs something other than /dev/tcp, it needs to be set up in the config.h
// file as ACE_TLI_TCP_DEVICE.
#ifndef ACE_TLI_TCP_DEVICE
#define ACE_TLI_TCP_DEVICE "/dev/tcp"
#endif
+
// There's not a universal device name for XTI/ATM devices. If the platform
// needs something other than /dev/xtisvc0, it needs to be set up in the
// config.h file as ACE_XTI_ATM_DEVICE. This may be FORE vendor specific and
@@ -34,7 +43,9 @@
#ifndef ACE_XTI_ATM_DEVICE
#define ACE_XTI_ATM_DEVICE "/dev/xtisvc0"
#endif
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_TLI
*
@@ -49,32 +60,43 @@ public:
ACE_HANDLE open (const char device[],
int oflag = O_RDWR,
struct t_info *info = 0);
+
/// Close a TLI endpoint and release resources.
int close (void);
+
/// Set underlying protocol options.
int set_option (int level, int option, void *optval, int optlen);
+
/// Get underlying protocol options.
int get_option (int level, int option, void *optval, int &optlen);
+
// = Calls to underlying TLI operations.
int look (void) const;
int rcvdis (struct t_discon * = 0) const;
int snddis (struct t_call * = 0) const;
int sndrel (void) const;
int rcvrel (void) const;
+
/// Return our local endpoint address.
int get_local_addr (ACE_Addr &) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
// = Ensure we are an abstract class.
/// Default constructor.
ACE_TLI (void);
+
/// Destructor.
~ACE_TLI (void);
+
/// Initialize a TLI endpoint.
ACE_TLI (const char device[], int oflag = O_RDWR, struct t_info *info = 0);
+
private:
#if defined (ACE_HAS_SVR4_TLI)
// XTI/TLI option management.
@@ -82,10 +104,13 @@ private:
struct t_optmgmt so_opt_ret;
#endif /* ACE_HAS_SVR4_TLI */
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/TLI.inl"
#endif /* __ACE_INLINE__ */
+
#endif /* ACE_HAS_TLI */
#include /**/ "ace/post.h"
#endif /* ACE_TLI_H */
diff --git a/dep/ACE_wrappers/ace/TLI.inl b/dep/ACE_wrappers/ace/TLI.inl
index 6c089ba7374..001d8c65292 100644
--- a/dep/ACE_wrappers/ace/TLI.inl
+++ b/dep/ACE_wrappers/ace/TLI.inl
@@ -1,9 +1,12 @@
// -*- C++ -*-
//
// $Id: TLI.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/TLI.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
int
ACE_TLI::look (void) const
@@ -11,6 +14,7 @@ ACE_TLI::look (void) const
ACE_TRACE ("ACE_TLI::look");
return ACE_OS::t_look (this->get_handle ());
}
+
ACE_INLINE
int
ACE_TLI::rcvdis (struct t_discon *discon) const
@@ -18,6 +22,7 @@ ACE_TLI::rcvdis (struct t_discon *discon) const
ACE_TRACE ("ACE_TLI::rcvdis");
return ACE_OS::t_rcvdis (this->get_handle (), discon);
}
+
ACE_INLINE
int
ACE_TLI::snddis (struct t_call *call) const
@@ -25,6 +30,7 @@ ACE_TLI::snddis (struct t_call *call) const
ACE_TRACE ("ACE_TLI::snddis");
return ACE_OS::t_snddis (this->get_handle (), call);
}
+
ACE_INLINE
int
ACE_TLI::rcvrel (void) const
@@ -32,6 +38,7 @@ ACE_TLI::rcvrel (void) const
ACE_TRACE ("ACE_TLI::rcvrel");
return ACE_OS::t_rcvrel (this->get_handle ());
}
+
ACE_INLINE
int
ACE_TLI::sndrel (void) const
@@ -39,4 +46,5 @@ ACE_TLI::sndrel (void) const
ACE_TRACE ("ACE_TLI::sndrel");
return ACE_OS::t_sndrel (this->get_handle ());
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/TLI_Acceptor.cpp b/dep/ACE_wrappers/ace/TLI_Acceptor.cpp
index 1c6d7e14fe8..8c223f313c0 100644
--- a/dep/ACE_wrappers/ace/TLI_Acceptor.cpp
+++ b/dep/ACE_wrappers/ace/TLI_Acceptor.cpp
@@ -1,37 +1,51 @@
// $Id: TLI_Acceptor.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/TLI_Acceptor.h"
#include "ace/Log_Msg.h"
#include "ace/ACE.h"
#include "ace/OS_NS_string.h"
#include "ace/OS_Memory.h"
+
ACE_RCSID(ace, TLI_Acceptor, "$Id: TLI_Acceptor.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if defined (ACE_HAS_TLI)
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Put the actual definitions of the ACE_TLI_Request and
// ACE_TLI_Request_Queue classes here to hide them from clients...
+
struct ACE_TLI_Request
{
struct t_call *callp_;
ACE_HANDLE handle_;
ACE_TLI_Request *next_;
};
+
class ACE_TLI_Request_Queue
{
public:
ACE_TLI_Request_Queue (void);
+
ACE_HANDLE open (ACE_HANDLE fd, int size);
int close (void);
+
int enqueue (const char device[], int restart, int rwflag);
int dequeue (ACE_TLI_Request *&ptr);
int remove (int sequence_number);
+
int is_empty (void) const;
int is_full (void) const;
+
ACE_TLI_Request *alloc (void);
void free (ACE_TLI_Request *node);
+
void dump (void) const;
// Dump the state of an object.
+
ACE_ALLOC_HOOK_DECLARE;
// Declare the dynamic allocation hooks.
+
private:
ACE_HANDLE handle_;
int size_;
@@ -40,7 +54,9 @@ private:
ACE_TLI_Request *tail_;
ACE_TLI_Request *free_list_;
};
+
ACE_ALLOC_HOOK_DEFINE(ACE_TLI_Request_Queue)
+
void
ACE_TLI_Request_Queue::dump (void) const
{
@@ -48,19 +64,23 @@ ACE_TLI_Request_Queue::dump (void) const
ACE_TRACE ("ACE_TLI_Request_Queue::dump");
#endif /* ACE_HAS_DUMP */
}
+
int
ACE_TLI_Request_Queue::is_empty (void) const
{
ACE_TRACE ("ACE_TLI_Request_Queue::is_empty");
return this->current_count_ == 0;
}
+
int
ACE_TLI_Request_Queue::is_full (void) const
{
ACE_TRACE ("ACE_TLI_Request_Queue::is_full");
return this->current_count_ + 1 == this->size_; // Add 1 for the dummy.
}
+
// Add a node to the free list stack.
+
void
ACE_TLI_Request_Queue::free (ACE_TLI_Request *node)
{
@@ -68,7 +88,9 @@ ACE_TLI_Request_Queue::free (ACE_TLI_Request *node)
node->next_ = this->free_list_;
this->free_list_ = node;
}
+
// Remove a node from the free list stack.
+
ACE_TLI_Request *
ACE_TLI_Request_Queue::alloc (void)
{
@@ -77,7 +99,9 @@ ACE_TLI_Request_Queue::alloc (void)
this->free_list_ = this->free_list_->next_;
return temp;
}
+
ACE_ALLOC_HOOK_DEFINE(ACE_TLI_Acceptor)
+
void
ACE_TLI_Acceptor::dump (void) const
{
@@ -85,11 +109,13 @@ ACE_TLI_Acceptor::dump (void) const
ACE_TRACE ("ACE_TLI_Acceptor::dump");
#endif /* ACE_HAS_DUMP */
}
+
ACE_TLI_Acceptor::ACE_TLI_Acceptor (void)
: queue_ (0)
{
ACE_TRACE ("ACE_TLI_Acceptor::ACE_TLI_Acceptor");
}
+
int
ACE_TLI_Request_Queue::dequeue (ACE_TLI_Request *&ptr)
{
@@ -99,7 +125,9 @@ ACE_TLI_Request_Queue::dequeue (ACE_TLI_Request *&ptr)
this->current_count_--;
return 0;
}
+
// This is hideous...
+
static ACE_HANDLE
open_new_endpoint (ACE_HANDLE listen_handle,
const char dev[],
@@ -111,6 +139,7 @@ open_new_endpoint (ACE_HANDLE listen_handle,
ACE_HANDLE fd = ACE_OS::t_open ((char *) dev,
O_RDWR,
0);
+
struct t_bind req, *req_p = 0;
if (remote_sap != 0)
{
@@ -120,6 +149,7 @@ open_new_endpoint (ACE_HANDLE listen_handle,
req.addr.maxlen = remote_sap->get_size ();
req_p = &req;
}
+
if (fd == ACE_INVALID_HANDLE
|| ACE_OS::t_bind (fd, req_p, 0) == -1)
fd = ACE_INVALID_HANDLE;
@@ -132,43 +162,54 @@ open_new_endpoint (ACE_HANDLE listen_handle,
#else
ACE_UNUSED_ARG(rwf);
#endif /* I_PUSH */
+
if (fd == ACE_INVALID_HANDLE)
ACE_OS::t_snddis (listen_handle,
callp);
return fd;
}
+
// Close down the acceptor and release resources.
+
int
ACE_TLI_Request_Queue::close (void)
{
ACE_TRACE ("ACE_TLI_Request_Queue::close");
int res = 0;
+
for (int i = 0; i < this->size_; i++)
{
ACE_TLI_Request &item = this->base_[i];
+
item.handle_ = ACE_INVALID_HANDLE;
if (ACE_OS::t_free ((char *) item.callp_,
T_CALL) != 0)
res = -1;
}
+
delete [] this->base_;
this->base_ = 0;
return res;
}
+
ACE_HANDLE
ACE_TLI_Request_Queue::open (ACE_HANDLE f, int sz)
{
ACE_TRACE ("ACE_TLI_Request_Queue::open");
this->handle_ = f;
this->size_ = sz + 1; // Add one more for the dummy node.
+
ACE_NEW_RETURN (this->base_,
ACE_TLI_Request[this->size_],
ACE_INVALID_HANDLE);
+
// Initialize the ACE_Queue and the free list.
+
for (int i = 0; i < this->size_; i++)
{
ACE_TLI_Request *item = &this->base_[i];
this->free (item);
+
item->handle_ = ACE_INVALID_HANDLE;
item->callp_ = (t_call *) ACE_OS::t_alloc (this->handle_,
T_CALL,
@@ -176,10 +217,12 @@ ACE_TLI_Request_Queue::open (ACE_HANDLE f, int sz)
if (item->callp_ == 0)
return ACE_INVALID_HANDLE;
}
+
this->tail_ = this->alloc ();
this->tail_->next_ = this->tail_;
return 0;
}
+
ACE_TLI_Request_Queue::ACE_TLI_Request_Queue (void)
: size_ (0),
current_count_ (0),
@@ -189,8 +232,10 @@ ACE_TLI_Request_Queue::ACE_TLI_Request_Queue (void)
{
ACE_TRACE ("ACE_TLI_Request_Queue::ACE_TLI_Request_Queue");
}
+
// Listen for a new connection request and allocate appropriate data
// structures when one arrives.
+
int
ACE_TLI_Request_Queue::enqueue (const char device[],
int restart, int rwflag)
@@ -199,12 +244,14 @@ ACE_TLI_Request_Queue::enqueue (const char device[],
ACE_TLI_Request *temp = this->alloc ();
ACE_TLI_Request &req = *this->tail_;
int res;
+
do
res = ACE_OS::t_listen (this->handle_, req.callp_);
while (res == -1
&& restart
&& t_errno == TSYSERR
&& errno == EINTR);
+
if (res != -1)
{
req.handle_ = open_new_endpoint (this->handle_,
@@ -220,24 +267,31 @@ ACE_TLI_Request_Queue::enqueue (const char device[],
return 0;
}
}
+
// Something must have gone wrong, so free up allocated space.
this->free (temp);
return -1;
}
+
// Locate and remove SEQUENCE_NUMBER from the list of pending
// connections.
+
int
ACE_TLI_Request_Queue::remove (int sequence_number)
{
ACE_TRACE ("ACE_TLI_Request_Queue::remove");
ACE_TLI_Request *prev = this->tail_;
+
// Put the sequence # in the dummy node to simply the search...
prev->callp_->sequence = sequence_number;
+
ACE_TLI_Request *temp;
+
for (temp = this->tail_->next_;
temp->callp_->sequence != sequence_number;
temp = temp->next_)
prev = temp;
+
if (temp == this->tail_)
// Sequence # was not found, since we're back at the dummy node!
return -1;
@@ -250,6 +304,7 @@ ACE_TLI_Request_Queue::remove (int sequence_number)
return 0;
}
}
+
ACE_HANDLE
ACE_TLI_Acceptor::open (const ACE_Addr &remote_sap,
int reuse_addr,
@@ -261,7 +316,9 @@ ACE_TLI_Acceptor::open (const ACE_Addr &remote_sap,
ACE_TRACE ("ACE_TLI_Acceptor::open");
ACE_HANDLE res = 0;
int one = 1;
+
this->disp_ = 0;
+
ACE_ALLOCATOR_RETURN (this->device_,
ACE_OS::strdup (dev),
ACE_INVALID_HANDLE);
@@ -290,6 +347,7 @@ ACE_TLI_Acceptor::open (const ACE_Addr &remote_sap,
else
{
struct t_bind req;
+
#if defined (ACE_HAS_FORE_ATM_XTI)
// Not sure why but FORE's t_bind call won't work if t_bind.qlen
// != 1 Adjust the backlog accordingly.
@@ -300,6 +358,7 @@ ACE_TLI_Acceptor::open (const ACE_Addr &remote_sap,
req.qlen = qlen;
#endif /* ACE_HAS_FORE_ATM_XTI */
req.addr.maxlen = remote_sap.get_size ();
+
if (remote_sap == ACE_Addr::sap_any)
// Note that if addr.len == 0 then ACE_TLI selects the port
// number.
@@ -309,6 +368,7 @@ ACE_TLI_Acceptor::open (const ACE_Addr &remote_sap,
req.addr.buf = (char *) remote_sap.get_addr ();
req.addr.len = remote_sap.get_size ();
}
+
res = (ACE_HANDLE) ACE_OS::t_bind (this->get_handle (),
&req,
0);
@@ -325,6 +385,7 @@ ACE_TLI_Acceptor::open (const ACE_Addr &remote_sap,
this->close ();
return this->get_handle ();
}
+
ACE_TLI_Acceptor::ACE_TLI_Acceptor (const ACE_Addr &remote_sap,
int reuse_addr,
int oflag,
@@ -343,6 +404,7 @@ ACE_TLI_Acceptor::ACE_TLI_Acceptor (const ACE_Addr &remote_sap,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_TLI_Acceptor::ACE_TLI_Acceptor")));
}
+
int
ACE_TLI_Acceptor::close (void)
{
@@ -354,6 +416,7 @@ ACE_TLI_Acceptor::close (void)
this->queue_->close ();
delete this->queue_;
}
+
ACE_OS::t_free ((char *) this->disp_, T_DIS);
ACE_OS::free (ACE_MALLOC_T (this->device_));
this->disp_ = 0;
@@ -362,13 +425,16 @@ ACE_TLI_Acceptor::close (void)
}
return 0;
}
+
// Perform the logic required to handle the arrival of asynchronous
// events while we are trying to accept a new connection request.
+
int
ACE_TLI_Acceptor::handle_async_event (int restart, int rwf)
{
ACE_TRACE ("ACE_TLI_Acceptor::handle_async_event");
int event = this->look ();
+
switch (event)
{
case T_DISCONNECT:
@@ -385,6 +451,7 @@ ACE_TLI_Acceptor::handle_async_event (int restart, int rwf)
}
return 0;
}
+
int
ACE_TLI_Acceptor::accept (ACE_TLI_Stream &new_tli_sap,
ACE_Addr *remote_addr,
@@ -397,6 +464,7 @@ ACE_TLI_Acceptor::accept (ACE_TLI_Stream &new_tli_sap,
{
ACE_TRACE ("ACE_TLI_Acceptor::accept");
ACE_UNUSED_ARG (reset_new_handle);
+
ACE_TLI_Request *req = 0;
int res = 0;
if (timeout != 0
@@ -407,12 +475,14 @@ ACE_TLI_Acceptor::accept (ACE_TLI_Stream &new_tli_sap,
else if (this->queue_->is_empty ())
{
req = this->queue_->alloc ();
+
do
res = ACE_OS::t_listen (this->get_handle (),
req->callp_);
while (res == -1
&& restart
&& errno == EINTR);
+
if (res != -1)
{
req->handle_ = open_new_endpoint (this->get_handle (),
@@ -431,6 +501,7 @@ ACE_TLI_Acceptor::accept (ACE_TLI_Stream &new_tli_sap,
}
else
res = this->queue_->dequeue (req);
+
if (udata != 0)
ACE_OS::memcpy ((void *) &req->callp_->udata,
(void *) udata,
@@ -439,6 +510,7 @@ ACE_TLI_Acceptor::accept (ACE_TLI_Stream &new_tli_sap,
ACE_OS::memcpy ((void *) &req->callp_->opt,
(void *) opt,
sizeof *opt);
+
while (res != -1)
{
res = ACE_OS::t_accept (this->get_handle (),
@@ -451,6 +523,7 @@ ACE_TLI_Acceptor::accept (ACE_TLI_Stream &new_tli_sap,
else if (restart && t_errno == TSYSERR && errno == EINTR)
res = 0;
}
+
if (res == -1)
{
if (errno != EWOULDBLOCK)
@@ -463,15 +536,19 @@ ACE_TLI_Acceptor::accept (ACE_TLI_Stream &new_tli_sap,
else
{
new_tli_sap.set_handle (req->handle_);
+
if (remote_addr != 0)
remote_addr->set_addr ((void *) req->callp_->addr.buf,
req->callp_->addr.len);
}
+
req->handle_ = ACE_INVALID_HANDLE;
this->queue_->free (req);
new_tli_sap.set_rwflag (rwf);
return new_tli_sap.get_handle () == ACE_INVALID_HANDLE ? -1 : 0;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_TLI */
diff --git a/dep/ACE_wrappers/ace/TLI_Acceptor.h b/dep/ACE_wrappers/ace/TLI_Acceptor.h
index 5498d8cbc64..d6851aa0f01 100644
--- a/dep/ACE_wrappers/ace/TLI_Acceptor.h
+++ b/dep/ACE_wrappers/ace/TLI_Acceptor.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file TLI_Acceptor.h
@@ -9,20 +10,28 @@
*/
//=============================================================================
+
#ifndef ACE_TLI_ACCEPTOR_H
#define ACE_TLI_ACCEPTOR_H
#include /**/ "ace/pre.h"
+
#include "ace/TLI.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/TLI_Stream.h"
#include "ace/Default_Constants.h"
+
#if defined (ACE_HAS_TLI)
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward reference...
class ACE_TLI_Request_Queue;
class ACE_Time_Value;
+
/**
* @class ACE_TLI_Acceptor
*
@@ -37,9 +46,11 @@ class ACE_Export ACE_TLI_Acceptor : public ACE_TLI
{
public:
friend class ACE_Request_Queue;
+
// = Initialization and termination methods.
/// Default constructor.
ACE_TLI_Acceptor (void);
+
/// Initiate a passive mode socket.
ACE_TLI_Acceptor (const ACE_Addr &remote_sap,
int reuse_addr = 0,
@@ -47,6 +58,7 @@ public:
struct t_info *info = 0,
int backlog = ACE_DEFAULT_BACKLOG,
const char device[] = ACE_TLI_TCP_DEVICE);
+
/// Initiate a passive mode socket.
ACE_HANDLE open (const ACE_Addr &remote_sap,
int reuse_addr = 0,
@@ -54,9 +66,12 @@ public:
struct t_info *info = 0,
int backlog = ACE_DEFAULT_BACKLOG,
const char device[] = ACE_TLI_TCP_DEVICE);
+
/// Close down the acceptor and release resources.
int close (void);
+
// = Passive connection acceptance method.
+
/**
* Accept a new data transfer connection. A @a timeout of 0 means
* block forever, a @a timeout of {0, 0} means poll. <restart> == 1
@@ -70,28 +85,39 @@ public:
int rwflag = 1,
netbuf *udata = 0,
netbuf *opt = 0);
+
// = Meta-type info
typedef ACE_INET_Addr PEER_ADDR;
typedef ACE_TLI_Stream PEER_STREAM;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Network "device" we are using.
const char *device_;
+
/// Number of connections to queue.
int backlog_;
+
/// Are we using "tirdwr" mod?
int rwflag_;
+
/// Handle TLI accept insanity...
int handle_async_event (int restart, int rwflag);
+
/// Used for queueing up pending requests.
ACE_TLI_Request_Queue *queue_;
+
/// Used for handling disconnects
struct t_discon *disp_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_TLI */
#include /**/ "ace/post.h"
#endif /* ACE_TLI_ACCEPTOR_H */
diff --git a/dep/ACE_wrappers/ace/TLI_Connector.cpp b/dep/ACE_wrappers/ace/TLI_Connector.cpp
index ead22898213..a237305971f 100644
--- a/dep/ACE_wrappers/ace/TLI_Connector.cpp
+++ b/dep/ACE_wrappers/ace/TLI_Connector.cpp
@@ -1,16 +1,24 @@
// $Id: TLI_Connector.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/TLI_Connector.h"
+
ACE_RCSID(ace, TLI_Connector, "$Id: TLI_Connector.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if defined (ACE_HAS_TLI)
+
#if !defined (__ACE_INLINE__)
#include "ace/TLI_Connector.inl"
#endif /* __ACE_INLINE__ */
+
#include "ace/Handle_Set.h"
#include "ace/ACE.h"
#include "ace/OS_NS_string.h"
#include "ace/Time_Value.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_TLI_Connector)
+
void
ACE_TLI_Connector::dump (void) const
{
@@ -18,13 +26,16 @@ ACE_TLI_Connector::dump (void) const
ACE_TRACE ("ACE_TLI_Connector::dump");
#endif /* ACE_HAS_DUMP */
}
+
ACE_TLI_Connector::ACE_TLI_Connector (void)
{
ACE_TRACE ("ACE_TLI_Connector::ACE_TLI_Connector");
}
+
// Connect the <new_stream> to the <remote_sap>, waiting up to
// <timeout> amount of time if necessary. It's amazing how
// complicated this is to do in TLI...
+
int
ACE_TLI_Connector::connect (ACE_TLI_Stream &new_stream,
const ACE_Addr &remote_sap,
@@ -41,16 +52,22 @@ ACE_TLI_Connector::connect (ACE_TLI_Stream &new_stream,
{
ACE_TRACE ("ACE_TLI_Connector::connect");
int result = 0;
+
// Only open a new endpoint if we don't already have a valid handle.
+
if (new_stream.get_handle () == ACE_INVALID_HANDLE
&& new_stream.open (device, flags, info) == ACE_INVALID_HANDLE)
return -1;
+
if (local_sap != ACE_Addr::sap_any)
{
// Bind the local endpoint to a specific addr.
+
struct t_bind *localaddr;
+
localaddr = (struct t_bind *)
ACE_OS::t_alloc (new_stream.get_handle (), T_BIND, T_ADDR);
+
if (localaddr == 0)
result = -1;
else
@@ -77,14 +94,17 @@ ACE_TLI_Connector::connect (ACE_TLI_Stream &new_stream,
ACE_OS::memcpy(localaddr->addr.buf,
addr_buf,
localaddr->addr.len);
+
if (ACE_OS::t_bind (new_stream.get_handle (),
localaddr,
localaddr) == -1)
result = -1;
+
ACE_OS::t_free ((char *) localaddr,
T_BIND);
}
}
+
if (result == -1)
{
new_stream.close ();
@@ -94,38 +114,47 @@ ACE_TLI_Connector::connect (ACE_TLI_Stream &new_stream,
// Let TLI select the local endpoint addr.
else if (ACE_OS::t_bind (new_stream.get_handle (), 0, 0) == -1)
return -1;
+
struct t_call *callptr = 0;
+
callptr = (struct t_call *)
ACE_OS::t_alloc (new_stream.get_handle (), T_CALL, T_ADDR);
+
if (callptr == 0)
{
new_stream.close ();
return -1;
}
+
void *addr_buf = remote_sap.get_addr ();
callptr->addr.len = remote_sap.get_size ();
ACE_OS::memcpy (callptr->addr.buf,
addr_buf,
callptr->addr.len);
//callptr->addr.buf = (char *) remote_sap.get_addr ();
+
if (udata != 0)
ACE_OS::memcpy ((void *) &callptr->udata, (void *) udata, sizeof *udata);
if (opt != 0)
ACE_OS::memcpy ((void *) &callptr->opt, (void *) opt, sizeof *opt);
+
// Connect to remote endpoint.
#if defined (ACE_HAS_FORE_ATM_XTI)
// FORE's XTI/ATM driver has problems with ioctl/fcntl calls so (at least
// for now) always have blocking calls.
timeout = 0;
#endif /* ACE_HAS_FORE_ATM_XTI */
+
if (timeout != 0) // Enable non-blocking, if required.
{
if (new_stream.enable (ACE_NONBLOCK) == -1)
result = -1;
+
// Do a non-blocking connect.
if (ACE_OS::t_connect (new_stream.get_handle (), callptr, 0) == -1)
{
result = -1;
+
// Check to see if we simply haven't connected yet on a
// non-blocking handle or whether there's really an error.
if (t_errno == TNODATA)
@@ -142,6 +171,7 @@ ACE_TLI_Connector::connect (ACE_TLI_Stream &new_stream,
// Do a blocking connect to the server.
else if (ACE_OS::t_connect (new_stream.get_handle (), callptr, 0) == -1)
result = -1;
+
if (result != -1)
{
new_stream.set_rwflag (rwf);
@@ -158,11 +188,14 @@ ACE_TLI_Connector::connect (ACE_TLI_Stream &new_stream,
new_stream.close ();
new_stream.set_handle (ACE_INVALID_HANDLE);
}
+
if (ACE_OS::t_free ((char *) callptr, T_CALL) == -1)
return -1;
return result;
}
+
// Try to complete a non-blocking connection.
+
int
ACE_TLI_Connector::complete (ACE_TLI_Stream &new_stream,
ACE_Addr *remote_sap,
@@ -194,8 +227,10 @@ ACE_TLI_Connector::complete (ACE_TLI_Stream &new_stream,
{
#if defined (ACE_HAS_XTI) || defined (ACE_HAS_SVR4_TLI)
struct netbuf name;
+
name.maxlen = remote_sap->get_size ();
name.buf = (char *) remote_sap->get_addr ();
+
if (ACE_OS::t_getname (new_stream.get_handle (),
&name,
REMOTENAME) == -1)
@@ -207,12 +242,16 @@ ACE_TLI_Connector::complete (ACE_TLI_Stream &new_stream,
return -1;
}
}
+
// Start out with non-blocking disabled on the <new_stream>.
new_stream.disable (ACE_NONBLOCK);
+
return 0;
}
#endif /* ACE_WIN32 */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_TLI */
diff --git a/dep/ACE_wrappers/ace/TLI_Connector.h b/dep/ACE_wrappers/ace/TLI_Connector.h
index 80e14ff0eb6..538cba1c699 100644
--- a/dep/ACE_wrappers/ace/TLI_Connector.h
+++ b/dep/ACE_wrappers/ace/TLI_Connector.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file TLI_Connector.h
@@ -9,16 +10,22 @@
*/
//=============================================================================
+
#ifndef ACE_TLI_CONNECTOR_H
#define ACE_TLI_CONNECTOR_H
#include /**/ "ace/pre.h"
+
#include "ace/TLI_Stream.h"
#include "ace/Log_Msg.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_TLI)
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_TLI_Connector
*
@@ -31,6 +38,7 @@ public:
// = Initialization methods.
/// Default constructor.
ACE_TLI_Connector (void);
+
/**
* Actively connect and produce a <new_stream> if things go well.
* The @a remote_sap is the address that we are trying to connect
@@ -58,6 +66,7 @@ public:
int rw_flag = 1,
struct netbuf *udata = 0,
struct netbuf *opt = 0);
+
/**
* Actively connect and produce a <new_stream> if things go well.
* The @a remote_sap is the address that we are trying to connect
@@ -85,6 +94,7 @@ public:
int rw_flag = 1,
struct netbuf *udata = 0,
struct netbuf *opt = 0);
+
/**
* Try to complete a non-blocking connection.
* If connection completion is successful then @a new_stream contains
@@ -94,20 +104,27 @@ public:
int complete (ACE_TLI_Stream &new_stream,
ACE_Addr *remote_sap,
ACE_Time_Value *tv);
+
/// Resets any event associations on this handle
int reset_new_handle (ACE_HANDLE handle);
+
// = Meta-type info
typedef ACE_INET_Addr PEER_ADDR;
typedef ACE_TLI_Stream PEER_STREAM;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/TLI_Connector.inl"
#endif /* __ACE_INLINE__ */
+
#endif /* ACE_HAS_TLI */
#include /**/ "ace/post.h"
#endif /* ACE_TLI_CONNECTOR_H */
diff --git a/dep/ACE_wrappers/ace/TLI_Connector.inl b/dep/ACE_wrappers/ace/TLI_Connector.inl
index 669f2f4991b..31bd3473509 100644
--- a/dep/ACE_wrappers/ace/TLI_Connector.inl
+++ b/dep/ACE_wrappers/ace/TLI_Connector.inl
@@ -1,7 +1,9 @@
// -*- C++ -*-
//
// $Id: TLI_Connector.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_TLI_Connector::ACE_TLI_Connector (ACE_TLI_Stream &new_stream,
const ACE_Addr &remote_sap,
@@ -34,6 +36,7 @@ ACE_TLI_Connector::ACE_TLI_Connector (ACE_TLI_Stream &new_stream,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_TLI_Stream::ACE_TLI_Stream")));
}
+
ACE_INLINE
int
ACE_TLI_Connector::reset_new_handle (ACE_HANDLE handle)
@@ -42,4 +45,5 @@ ACE_TLI_Connector::reset_new_handle (ACE_HANDLE handle)
// Nothing to do here since the handle is not a socket
return 0;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/TLI_Stream.cpp b/dep/ACE_wrappers/ace/TLI_Stream.cpp
index 758137e3ffb..b1097385058 100644
--- a/dep/ACE_wrappers/ace/TLI_Stream.cpp
+++ b/dep/ACE_wrappers/ace/TLI_Stream.cpp
@@ -1,16 +1,24 @@
// $Id: TLI_Stream.cpp 80826 2008-03-04 14:51:23Z wotte $
+
/* Defines the member functions for the base class of the ACE_TLI_Stream
abstraction. */
+
#include "ace/TLI_Stream.h"
#include "ace/ACE.h"
#include "ace/OS_NS_unistd.h"
+
ACE_RCSID(ace, TLI_Stream, "$Id: TLI_Stream.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if defined (ACE_HAS_TLI)
+
#if !defined (__ACE_INLINE__)
#include "ace/TLI_Stream.inl"
#endif /* __ACE_INLINE__ */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_TLI_Stream)
+
void
ACE_TLI_Stream::dump (void) const
{
@@ -18,29 +26,36 @@ ACE_TLI_Stream::dump (void) const
ACE_TRACE ("ACE_TLI_Stream::dump");
#endif /* ACE_HAS_DUMP */
}
+
ACE_TLI_Stream::ACE_TLI_Stream (void)
: rwflag_ (0)
{
ACE_TRACE ("ACE_TLI_Stream::ACE_TLI_Stream");
}
+
int
ACE_TLI_Stream::get_remote_addr (ACE_Addr &sa) const
{
ACE_TRACE ("ACE_TLI_Stream::get_remote_addr");
+
struct netbuf name;
name.maxlen = sa.get_size ();
name.buf = (char *) sa.get_addr ();
+
if (ACE_OS::t_getname (this->get_handle (), &name, REMOTENAME) == -1)
return -1;
else
return 0;
}
+
// Send a release and then await the release from the other side.
+
int
ACE_TLI_Stream::active_close (void)
{
ACE_TRACE ("ACE_TLI_Stream::active_close");
char buf;
+
if (this->sndrel () == -1)
return -1;
else if (this->recv (&buf, sizeof buf) == -1)
@@ -53,26 +68,35 @@ ACE_TLI_Stream::active_close (void)
else
return -1;
}
+
return this->close ();
}
+
// Acknowledge the release from the other side and then send the
// release to the other side.
+
int
ACE_TLI_Stream::passive_close (void)
{
ACE_TRACE ("ACE_TLI_Stream::passive_close");
+
if (this->rcvrel () == -1)
return -1;
else if (this->sndrel () == -1)
return -1;
+
return this->close ();
}
+
int
ACE_TLI_Stream::close (void)
{
ACE_TRACE ("ACE_TLI_Stream::close");
+
ACE_HANDLE fd = this->get_handle ();
+
this->set_handle (ACE_INVALID_HANDLE);
+
#if !defined (ACE_WIN32)
if (this->rwflag_)
return ACE_OS::close (fd);
@@ -80,6 +104,7 @@ ACE_TLI_Stream::close (void)
#endif /* ACE_WIN32 */
return ACE_OS::t_close (fd);
}
+
ssize_t
ACE_TLI_Stream::send (const void *buf,
size_t n,
@@ -91,6 +116,7 @@ ACE_TLI_Stream::send (const void *buf,
n,
timeout);
}
+
ssize_t
ACE_TLI_Stream::send (const void *buf,
size_t n,
@@ -104,6 +130,7 @@ ACE_TLI_Stream::send (const void *buf,
flags,
timeout);
}
+
ssize_t
ACE_TLI_Stream::recv (void *buf,
size_t n,
@@ -115,6 +142,7 @@ ACE_TLI_Stream::recv (void *buf,
n,
timeout);
}
+
ssize_t
ACE_TLI_Stream::recv (void *buf,
size_t n,
@@ -123,14 +151,17 @@ ACE_TLI_Stream::recv (void *buf,
{
ACE_TRACE ("ACE_TLI_Stream::recv");
int f = 0;
+
if (flags == 0)
flags = &f;
+
return ACE::t_rcv (this->get_handle (),
buf,
n,
flags,
timeout);
}
+
ssize_t
ACE_TLI_Stream::send_n (const void *buf,
size_t n,
@@ -144,6 +175,7 @@ ACE_TLI_Stream::send_n (const void *buf,
timeout,
bytes_transferred);
}
+
ssize_t
ACE_TLI_Stream::send_n (const void *buf,
size_t n,
@@ -152,6 +184,7 @@ ACE_TLI_Stream::send_n (const void *buf,
size_t *bytes_transferred) const
{
ACE_TRACE ("ACE_TLI_Stream::send_n");
+
return ACE::t_snd_n (this->get_handle (),
buf,
n,
@@ -159,6 +192,7 @@ ACE_TLI_Stream::send_n (const void *buf,
timeout,
bytes_transferred);
}
+
ssize_t
ACE_TLI_Stream::recv_n (void *buf,
size_t n,
@@ -172,6 +206,7 @@ ACE_TLI_Stream::recv_n (void *buf,
timeout,
bytes_transferred);
}
+
ssize_t
ACE_TLI_Stream::recv_n (void *buf,
size_t n,
@@ -180,6 +215,7 @@ ACE_TLI_Stream::recv_n (void *buf,
size_t *bytes_transferred) const
{
ACE_TRACE ("ACE_TLI_Stream::recv_n");
+
return ACE::t_rcv_n (this->get_handle (),
buf,
n,
@@ -187,6 +223,8 @@ ACE_TLI_Stream::recv_n (void *buf,
timeout,
bytes_transferred);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_TLI */
diff --git a/dep/ACE_wrappers/ace/TLI_Stream.h b/dep/ACE_wrappers/ace/TLI_Stream.h
index 6351dd85037..96f21de7e4c 100644
--- a/dep/ACE_wrappers/ace/TLI_Stream.h
+++ b/dep/ACE_wrappers/ace/TLI_Stream.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file TLI_Stream.h
@@ -9,18 +10,27 @@
*/
//=============================================================================
+
#ifndef ACE_TLI_STREAM_H
#define ACE_TLI_STREAM_H
#include /**/ "ace/pre.h"
+
#include "ace/config-lite.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/TLI.h"
+
#include "ace/INET_Addr.h"
+
#if defined (ACE_HAS_TLI)
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Time_Value;
+
/**
* @class ACE_TLI_Stream
*
@@ -31,79 +41,101 @@ class ACE_Export ACE_TLI_Stream : public ACE_TLI
public:
friend class ACE_TLI_Acceptor;
friend class ACE_TLI_Connector;
+
// = Initialization and termination methods.
/// Default constructor.
ACE_TLI_Stream (void);
+
// = TLI-specific shutdown operations.
/// Close down and release resources.
int close (void);
+
/// Send a release and then await the release from the other side.
int active_close (void);
+
/// Acknowledge the release from the other side and then send the
/// release to the other side.
int passive_close (void);
+
/// Return address of remotely connected peer.
int get_remote_addr (ACE_Addr &) const;
+
// = timod bindings
/// Send an n byte buffer to the connected socket (uses t_snd(3)).
ssize_t send (const void *buf,
size_t n,
int flags,
const ACE_Time_Value *timeout = 0) const;
+
/// Recv an n byte buffer from the connected socket (uses t_rcv(3)).
ssize_t recv (void *buf,
size_t n,
int *flags,
const ACE_Time_Value *timeout = 0) const;
+
/// Send exactly n bytes to the connected socket (uses t_snd(3)).
ssize_t send_n (const void *buf,
size_t n,
int flags,
const ACE_Time_Value *timeout = 0,
size_t *bytes_transferred = 0) const;
+
/// Recv exactly n bytes from the connected socket (uses t_rcv(3)).
ssize_t recv_n (void *buf,
size_t n,
int *flags,
const ACE_Time_Value *timeout = 0,
size_t *bytes_transferred = 0) const;
+
// = tirdwr bindings
/// Send an n byte buffer to the connected socket (uses write(2)).
ssize_t send (const void *buf,
size_t n,
const ACE_Time_Value *timeout = 0) const;
+
/// Recv an n byte buffer from the connected socket (uses read(2)).
ssize_t recv (void *buf,
size_t n,
const ACE_Time_Value *timeout = 0) const;
+
/// Send n bytes, keep trying until n are sent (uses write(2)).
ssize_t send_n (const void *buf,
size_t n,
const ACE_Time_Value *timeout = 0,
size_t *bytes_transferred = 0) const;
+
/// Recv n bytes, keep trying until n are received (uses read (2)).
ssize_t recv_n (void *buf,
size_t n,
const ACE_Time_Value *timeout = 0,
size_t *bytes_transferred = 0) const;
+
// = Meta-type info
typedef ACE_INET_Addr PEER_ADDR;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Indicates whether the tirdwr module should be pushed
int rwflag_;
+
/// Get rwflag
int get_rwflag (void) const;
+
/// Set rwflag
void set_rwflag (int value);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/TLI_Stream.inl"
#endif /* __ACE_INLINE__ */
+
#endif /* ACE_HAS_TLI */
#include /**/ "ace/post.h"
#endif /* ACE_TLI_STREAM_H */
diff --git a/dep/ACE_wrappers/ace/TLI_Stream.inl b/dep/ACE_wrappers/ace/TLI_Stream.inl
index b6e26af0c1e..1ef1a173e51 100644
--- a/dep/ACE_wrappers/ace/TLI_Stream.inl
+++ b/dep/ACE_wrappers/ace/TLI_Stream.inl
@@ -1,8 +1,11 @@
// -*- C++ -*-
//
// $Id: TLI_Stream.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/TLI_Stream.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
void
ACE_TLI_Stream::set_rwflag (int value)
@@ -10,6 +13,7 @@ ACE_TLI_Stream::set_rwflag (int value)
ACE_TRACE ("ACE_TLI_Stream::set_rwflag");
this->rwflag_ = value;
}
+
ACE_INLINE
int
ACE_TLI_Stream::get_rwflag (void) const
@@ -17,4 +21,5 @@ ACE_TLI_Stream::get_rwflag (void) const
ACE_TRACE ("ACE_TLI_Stream::get_rwflag");
return this->rwflag_;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/TP_Reactor.cpp b/dep/ACE_wrappers/ace/TP_Reactor.cpp
index 6f7c3c09b28..ffe47704953 100644
--- a/dep/ACE_wrappers/ace/TP_Reactor.cpp
+++ b/dep/ACE_wrappers/ace/TP_Reactor.cpp
@@ -1,30 +1,40 @@
// $Id: TP_Reactor.cpp 82393 2008-07-23 10:52:34Z johnnyw $
+
#include "ace/TP_Reactor.h"
#include "ace/Thread.h"
#include "ace/Timer_Queue.h"
#include "ace/Sig_Handler.h"
#include "ace/Log_Msg.h"
#include "ace/OS_NS_sys_time.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/TP_Reactor.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID (ace,
TP_Reactor,
"$Id: TP_Reactor.cpp 82393 2008-07-23 10:52:34Z johnnyw $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE (ACE_TP_Reactor)
+
int
ACE_TP_Token_Guard::acquire_read_token (ACE_Time_Value *max_wait_time)
{
ACE_TRACE ("ACE_TP_Token_Guard::acquire_read_token");
+
// The order of these events is very subtle, modify with care.
+
// Try to grab the lock. If someone if already there, don't wake
// them up, just queue up in the thread pool.
int result = 0;
+
if (max_wait_time)
{
ACE_Time_Value tv = ACE_OS::gettimeofday ();
tv += *max_wait_time;
+
ACE_MT (result = this->token_.acquire_read (&ACE_TP_Reactor::no_op_sleep_hook,
0,
&tv));
@@ -33,6 +43,7 @@ ACE_TP_Token_Guard::acquire_read_token (ACE_Time_Value *max_wait_time)
{
ACE_MT (result = this->token_.acquire_read (&ACE_TP_Reactor::no_op_sleep_hook));
}
+
// Check for timeouts and errors.
if (result == -1)
{
@@ -41,21 +52,27 @@ ACE_TP_Token_Guard::acquire_read_token (ACE_Time_Value *max_wait_time)
else
return -1;
}
+
// We got the token and so let us mark ourselves as owner
this->owner_ = 1;
+
return result;
}
+
int
ACE_TP_Token_Guard::acquire_token (ACE_Time_Value *max_wait_time)
{
ACE_TRACE ("ACE_TP_Token_Guard::acquire_token");
+
// Try to grab the lock. If someone if already there, don't wake
// them up, just queue up in the thread pool.
int result = 0;
+
if (max_wait_time)
{
ACE_Time_Value tv = ACE_OS::gettimeofday ();
tv += *max_wait_time;
+
ACE_MT (result = this->token_.acquire (0,
0,
&tv));
@@ -64,6 +81,7 @@ ACE_TP_Token_Guard::acquire_token (ACE_Time_Value *max_wait_time)
{
ACE_MT (result = this->token_.acquire ());
}
+
// Check for timeouts and errors.
if (result == -1)
{
@@ -72,11 +90,14 @@ ACE_TP_Token_Guard::acquire_token (ACE_Time_Value *max_wait_time)
else
return -1;
}
+
// We got the token and so let us mark ourselves as owner
this->owner_ = 1;
+
return result;
}
+
ACE_TP_Reactor::ACE_TP_Reactor (ACE_Sig_Handler *sh,
ACE_Timer_Queue *tq,
bool mask_signals,
@@ -86,6 +107,7 @@ ACE_TP_Reactor::ACE_TP_Reactor (ACE_Sig_Handler *sh,
ACE_TRACE ("ACE_TP_Reactor::ACE_TP_Reactor");
this->supress_notify_renew (1);
}
+
ACE_TP_Reactor::ACE_TP_Reactor (size_t max_number_of_handles,
int restart,
ACE_Sig_Handler *sh,
@@ -97,62 +119,81 @@ ACE_TP_Reactor::ACE_TP_Reactor (size_t max_number_of_handles,
ACE_TRACE ("ACE_TP_Reactor::ACE_TP_Reactor");
this->supress_notify_renew (1);
}
+
int
ACE_TP_Reactor::owner (ACE_thread_t, ACE_thread_t *o_id)
{
ACE_TRACE ("ACE_TP_Reactor::owner");
if (o_id)
*o_id = ACE_Thread::self ();
+
return 0;
}
+
int
ACE_TP_Reactor::owner (ACE_thread_t *t_id)
{
ACE_TRACE ("ACE_TP_Reactor::owner");
*t_id = ACE_Thread::self ();
+
return 0;
}
+
int
ACE_TP_Reactor::handle_events (ACE_Time_Value *max_wait_time)
{
ACE_TRACE ("ACE_TP_Reactor::handle_events");
+
// Stash the current time -- the destructor of this object will
// automatically compute how much time elapsed since this method was
// called.
ACE_Countdown_Time countdown (max_wait_time);
+
//
// The order of these events is very subtle, modify with care.
//
+
// Instantiate the token guard which will try grabbing the token for
// this thread.
ACE_TP_Token_Guard guard (this->token_);
+
int const result = guard.acquire_read_token (max_wait_time);
+
// If the guard is NOT the owner just return the retval
if (!guard.is_owner ())
return result;
+
// After getting the lock just just for deactivation..
if (this->deactivated_)
return -1;
+
// Update the countdown to reflect time waiting for the token.
countdown.update ();
+
return this->dispatch_i (max_wait_time, guard);
}
+
int
ACE_TP_Reactor::dispatch_i (ACE_Time_Value *max_wait_time,
ACE_TP_Token_Guard &guard)
{
int event_count = this->get_event_for_dispatching (max_wait_time);
+
// We use this count to detect potential infinite loops as described
// in bug 2540.
int const initial_event_count = event_count;
+
int result = 0;
+
// Note: We are passing the <event_count> around, to have record of
// how many events still need processing. May be this could be
// useful in future.
+
#if 0
// @Ciju
// signal handling isn't in a production state yet.
// Commenting it out for now.
+
// Dispatch signals
if (event_count == -1)
{
@@ -165,51 +206,64 @@ ACE_TP_Reactor::dispatch_i (ACE_Time_Value *max_wait_time,
return this->handle_signals (event_count, guard);
}
#endif // #if 0
+
// If there are no signals and if we had received a proper
// event_count then first look at dispatching timeouts. We need to
// handle timers early since they may have higher latency
// constraints than I/O handlers. Ideally, the order of dispatching
// should be a strategy...
+
// NOTE: The event count does not have the number of timers that
// needs dispatching. But we are still passing this along. We dont
// need to do that. In the future we *may* have the timers also
// returned through the <event_count>. Just passing that along for
// that day.
result = this->handle_timer_events (event_count, guard);
+
if (result > 0)
return result;
+
// Else just go ahead fall through for further handling.
+
if (event_count > 0)
{
// Next dispatch the notification handlers (if there are any to
// dispatch). These are required to handle multiple-threads
// that are trying to update the <Reactor>.
result = this->handle_notify_events (event_count, guard);
+
if (result > 0)
return result;
+
// Else just fall through for further handling
}
+
if (event_count > 0)
{
// Handle socket events
result = this->handle_socket_events (event_count, guard);
}
+
if (event_count != 0 && event_count == initial_event_count)
{
this->state_changed_ = true;
}
+
return result;
}
+
#if 0
// @Ciju
// signal handling isn't in a production state yet.
// Commenting it out for now.
+
int
ACE_TP_Reactor::handle_signals (int & /*event_count*/,
ACE_TP_Token_Guard & /*guard*/)
{
ACE_TRACE ("ACE_TP_Reactor::handle_signals");
+
/*
*
* THIS METHOD SEEMS BROKEN
@@ -221,6 +275,7 @@ ACE_TP_Reactor::handle_signals (int & /*event_count*/,
if (ACE_Sig_Handler::sig_pending () != 0)
{
ACE_Sig_Handler::sig_pending (0);
+
// This piece of code comes from the old TP_Reactor. We did not
// handle signals at all then. If we happen to handle signals
// in the TP_Reactor, we should then start worryiung about this
@@ -228,6 +283,7 @@ ACE_TP_Reactor::handle_signals (int & /*event_count*/,
if 0
// Not sure if this should be done in the TP_Reactor
// case... leave it out for now. -Steve Huston 22-Aug-00
+
// If any HANDLES in the <ready_set_> are activated as a
// result of signals they should be dispatched since
// they may be time critical...
@@ -235,15 +291,18 @@ if 0
else
// active_handle_count = 0;
endif
+
// Record the fact that the Reactor has dispatched a
// handle_signal() method. We need this to return the
// appropriate count.
return 1;
}
+
return -1;
}
#endif // #if 0
+
int
ACE_TP_Reactor::handle_timer_events (int & /*event_count*/,
ACE_TP_Token_Guard &guard)
@@ -252,43 +311,58 @@ ACE_TP_Reactor::handle_timer_events (int & /*event_count*/,
{ // Empty timer queue so cannot have any expired timers.
return 0;
}
+
// Get the current time
ACE_Time_Value cur_time (this->timer_queue_->gettimeofday () +
this->timer_queue_->timer_skew ());
+
// Look for a node in the timer queue whose timer <= the present
// time.
ACE_Timer_Node_Dispatch_Info info;
+
if (this->timer_queue_->dispatch_info (cur_time, info))
{
const void *upcall_act = 0;
+
// Preinvoke.
this->timer_queue_->preinvoke (info, cur_time, upcall_act);
+
// Release the token before dispatching notifies...
guard.release_token ();
+
// call the functor
this->timer_queue_->upcall (info, cur_time);
+
// Postinvoke
this->timer_queue_->postinvoke (info, cur_time, upcall_act);
+
// We have dispatched a timer
return 1;
}
+
return 0;
}
+
int
ACE_TP_Reactor::handle_notify_events (int & /*event_count*/,
ACE_TP_Token_Guard &guard)
{
// Get the handle on which notify calls could have occured
ACE_HANDLE notify_handle = this->get_notify_handle ();
+
int result = 0;
+
// The notify was not in the list returned by
// wait_for_multiple_events ().
if (notify_handle == ACE_INVALID_HANDLE)
return result;
+
// Now just do a read on the pipe..
ACE_Notification_Buffer buffer;
+
// Clear the handle of the read_mask of our <ready_set_>
this->ready_set_.rd_mask_.clr_bit (notify_handle);
+
// Keep reading notifies till we empty it or till we have a
// dispatchable buffer
while (this->notify_handler_->read_notify_pipe (notify_handle, buffer) > 0)
@@ -302,26 +376,34 @@ ACE_TP_Reactor::handle_notify_events (int & /*event_count*/,
{
// Release the token before dispatching notifies...
guard.release_token ();
+
// Dispatch the upcall for the notify
this->notify_handler_->dispatch_notify (buffer);
+
// We had a successful dispatch.
result = 1;
+
// break out of the while loop
break;
}
}
+
// If we did some work, then we just return 1 which will allow us
// to get out of here. If we return 0, then we will be asked to do
// some work ie. dispacth socket events
return result;
}
+
int
ACE_TP_Reactor::handle_socket_events (int &event_count,
ACE_TP_Token_Guard &guard)
{
+
// We got the lock, lets handle some I/O events.
ACE_EH_Dispatch_Info dispatch_info;
+
this->get_socket_event_info (dispatch_info);
+
// If there is any event handler that is ready to be dispatched, the
// dispatch information is recorded in dispatch_info.
if (!dispatch_info.dispatch ())
@@ -333,8 +415,10 @@ ACE_TP_Reactor::handle_socket_events (int &event_count,
dispatch_info.mask_);
}
+
return 0;
}
+
// Suspend the handler so that other threads don't start dispatching
// it, if we can't suspend then return directly
//
@@ -343,20 +427,27 @@ ACE_TP_Reactor::handle_socket_events (int &event_count,
if (dispatch_info.event_handler_ != this->notify_handler_)
if (this->suspend_i (dispatch_info.handle_) == -1)
return 0;
+
// Call add_reference() if needed.
if (dispatch_info.reference_counting_required_)
dispatch_info.event_handler_->add_reference ();
+
// Release the lock. Others threads can start waiting.
guard.release_token ();
+
int result = 0;
+
// If there was an event handler ready, dispatch it.
// Decrement the event left
--event_count;
+
// Dispatched an event
if (this->dispatch_socket_event (dispatch_info) == 0)
++result;
+
return result;
}
+
int
ACE_TP_Reactor::get_event_for_dispatching (ACE_Time_Value *max_wait_time)
{
@@ -367,6 +458,7 @@ ACE_TP_Reactor::get_event_for_dispatching (ACE_Time_Value *max_wait_time)
this->ready_set_.rd_mask_.reset ();
this->ready_set_.wr_mask_.reset ();
this->ready_set_.ex_mask_.reset ();
+
this->state_changed_ = false;
}
else
@@ -375,12 +467,15 @@ ACE_TP_Reactor::get_event_for_dispatching (ACE_Time_Value *max_wait_time)
// I don't understand...) the mask will have all of its bits clear,
// yet have a size_ > 0. This is an attempt to remedy the affect,
// without knowing why it happens.
+
this->ready_set_.rd_mask_.sync (this->ready_set_.rd_mask_.max_set ());
this->ready_set_.wr_mask_.sync (this->ready_set_.wr_mask_.max_set ());
this->ready_set_.ex_mask_.sync (this->ready_set_.ex_mask_.max_set ());
}
+
return this->wait_for_multiple_events (this->ready_set_, max_wait_time);
}
+
int
ACE_TP_Reactor::get_socket_event_info (ACE_EH_Dispatch_Info &event)
{
@@ -391,67 +486,85 @@ ACE_TP_Reactor::get_socket_event_info (ACE_EH_Dispatch_Info &event)
// another part of ready_set_ kept it from being dispatched.
int found_io = 0;
ACE_HANDLE handle;
+
// @@todo: We can do quite a bit of code reduction here. Let me get
// it to work before I do this.
{
ACE_Handle_Set_Iterator handle_iter (this->ready_set_.wr_mask_);
+
while (!found_io && (handle = handle_iter ()) != ACE_INVALID_HANDLE)
{
if (this->is_suspended_i (handle))
continue;
+
// Remember this info
event.set (handle,
this->handler_rep_.find (handle),
ACE_Event_Handler::WRITE_MASK,
&ACE_Event_Handler::handle_output);
+
this->clear_handle_read_set (handle);
found_io = 1;
}
}
+
if (!found_io)
{
ACE_Handle_Set_Iterator handle_iter (this->ready_set_.ex_mask_);
+
while (!found_io && (handle = handle_iter ()) != ACE_INVALID_HANDLE)
{
if (this->is_suspended_i (handle))
continue;
+
// Remember this info
event.set (handle,
this->handler_rep_.find (handle),
ACE_Event_Handler::EXCEPT_MASK,
&ACE_Event_Handler::handle_exception);
+
this->clear_handle_read_set (handle);
+
found_io = 1;
}
}
+
if (!found_io)
{
ACE_Handle_Set_Iterator handle_iter (this->ready_set_.rd_mask_);
+
while (!found_io && (handle = handle_iter ()) != ACE_INVALID_HANDLE)
{
if (this->is_suspended_i (handle))
continue;
+
// Remember this info
event.set (handle,
this->handler_rep_.find (handle),
ACE_Event_Handler::READ_MASK,
&ACE_Event_Handler::handle_input);
+
this->clear_handle_read_set (handle);
found_io = 1;
}
}
+
return found_io;
}
+
// Dispatches a single event handler
int
ACE_TP_Reactor::dispatch_socket_event (ACE_EH_Dispatch_Info &dispatch_info)
{
ACE_TRACE ("ACE_TP_Reactor::dispatch_socket_event");
+
ACE_Event_Handler * const event_handler = dispatch_info.event_handler_;
ACE_EH_PTMF const callback = dispatch_info.callback_;
+
// Check for removed handlers.
if (event_handler == 0)
return -1;
+
// Upcall. If the handler returns positive value (requesting a
// reactor callback) don't set the ready-bit because it will be
// ignored if the reactor state has changed. Just call back
@@ -460,14 +573,17 @@ ACE_TP_Reactor::dispatch_socket_event (ACE_EH_Dispatch_Info &dispatch_info)
int status = 1;
while (status > 0)
status = (event_handler->*callback) (dispatch_info.handle_);
+
// Post process socket event
return this->post_process_socket_event (dispatch_info, status);
}
+
int
ACE_TP_Reactor::post_process_socket_event (ACE_EH_Dispatch_Info &dispatch_info,
int status)
{
int result = 0;
+
// First check if we really have to post process something, if not, then
// we don't acquire the token which saves us a lot of time.
if (status < 0 ||
@@ -480,16 +596,20 @@ ACE_TP_Reactor::post_process_socket_event (ACE_EH_Dispatch_Info &dispatch_info,
// bugzilla 2395. When this is not atomic it can be that we resume the
// handle after it is reused by the OS.
ACE_TP_Token_Guard guard (this->token_);
+
result = guard.acquire_token ();
+
// If the guard is NOT the owner just return the retval
if (!guard.is_owner ())
return result;
+
// A different event handler may have been registered during the
// upcall if the handle was closed and then reopened, for
// example. Make sure we're removing and/or resuming the event
// handler used during the upcall.
ACE_Event_Handler const * const eh =
this->handler_rep_.find (dispatch_info.handle_);
+
// Only remove or resume the event handler used during the
// upcall.
if (eh == dispatch_info.event_handler_)
@@ -500,6 +620,7 @@ ACE_TP_Reactor::post_process_socket_event (ACE_EH_Dispatch_Info &dispatch_info,
this->remove_handler_i (dispatch_info.handle_,
dispatch_info.mask_);
}
+
// Resume handler if required.
if (dispatch_info.event_handler_ != this->notify_handler_ &&
dispatch_info.resume_flag_ ==
@@ -507,21 +628,26 @@ ACE_TP_Reactor::post_process_socket_event (ACE_EH_Dispatch_Info &dispatch_info,
this->resume_i (dispatch_info.handle_);
}
}
+
// Call remove_reference() if needed.
if (dispatch_info.reference_counting_required_)
dispatch_info.event_handler_->remove_reference ();
+
return result;
}
+
int
ACE_TP_Reactor::resumable_handler (void)
{
return 1;
}
+
int
ACE_TP_Reactor::handle_events (ACE_Time_Value &max_wait_time)
{
return this->handle_events (&max_wait_time);
}
+
void
ACE_TP_Reactor::notify_handle (ACE_HANDLE,
ACE_Reactor_Mask,
@@ -532,9 +658,11 @@ ACE_TP_Reactor::notify_handle (ACE_HANDLE,
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("ACE_TP_Reactor::notify_handle: ")
ACE_TEXT ("Wrong version of notify_handle() got called \n")));
+
ACE_ASSERT (eh == 0);
ACE_UNUSED_ARG (eh);
}
+
ACE_HANDLE
ACE_TP_Reactor::get_notify_handle (void)
{
@@ -542,6 +670,7 @@ ACE_TP_Reactor::get_notify_handle (void)
// notify waiting
ACE_HANDLE const read_handle =
this->notify_handler_->notify_handle ();
+
// Check whether the rd_mask has been set on that handle. If so
// return the handle.
if (read_handle != ACE_INVALID_HANDLE &&
@@ -549,8 +678,10 @@ ACE_TP_Reactor::get_notify_handle (void)
{
return read_handle;
}
+
// None found..
return ACE_INVALID_HANDLE;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/TP_Reactor.h b/dep/ACE_wrappers/ace/TP_Reactor.h
index 5d11ab7c348..1d8a3f05a1e 100644
--- a/dep/ACE_wrappers/ace/TP_Reactor.h
+++ b/dep/ACE_wrappers/ace/TP_Reactor.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file TP_Reactor.h
@@ -24,15 +25,21 @@
*/
//=============================================================================
+
#ifndef ACE_TP_REACTOR_H
#define ACE_TP_REACTOR_H
+
#include /**/ "ace/pre.h"
+
#include "ace/Select_Reactor.h"
#include "ace/Timer_Queue.h" /* Simple forward decl won't work... */
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_EH_Dispatch_Info
*
@@ -43,24 +50,30 @@ class ACE_EH_Dispatch_Info
{
public:
ACE_EH_Dispatch_Info (void);
+
void set (ACE_HANDLE handle,
ACE_Event_Handler *event_handler,
ACE_Reactor_Mask mask,
ACE_EH_PTMF callback);
+
bool dispatch (void) const;
+
ACE_HANDLE handle_;
ACE_Event_Handler *event_handler_;
ACE_Reactor_Mask mask_;
ACE_EH_PTMF callback_;
int resume_flag_;
bool reference_counting_required_;
+
private:
bool dispatch_;
+
// Disallow copying and assignment.
ACE_EH_Dispatch_Info (const ACE_EH_Dispatch_Info &);
ACE_EH_Dispatch_Info &operator= (const ACE_EH_Dispatch_Info &);
};
+
/**
* @class ACE_TP_Token_Guard
*
@@ -71,22 +84,29 @@ private:
* stack. This class gives the status of the ownership of the token
* and manages the ownership
*/
+
class ACE_TP_Token_Guard
{
public:
+
/// Constructor that will grab the token for us
ACE_TP_Token_Guard (ACE_Select_Reactor_Token &token);
+
/// Destructor. This will release the token if it hasnt been
/// released till this point
~ACE_TP_Token_Guard (void);
+
/// Release the token ..
void release_token (void);
+
/// Returns whether the thread that created this object ownes the
/// token or not.
bool is_owner (void);
+
/// A helper method that grabs the token for us, after which the
/// thread that owns that can do some actual work.
int acquire_read_token (ACE_Time_Value *max_wait_time = 0);
+
/**
* A helper method that grabs the token for us, after which the
* thread that owns that can do some actual work. This differs from
@@ -94,21 +114,29 @@ public:
* acquire_read ()
*/
int acquire_token (ACE_Time_Value *max_wait_time = 0);
+
private:
+
// Disallow default construction.
ACE_TP_Token_Guard (void);
+
// Disallow copying and assignment.
ACE_TP_Token_Guard (const ACE_TP_Token_Guard &);
ACE_TP_Token_Guard &operator= (const ACE_TP_Token_Guard &);
+
private:
+
/// The Select Reactor token.
ACE_Select_Reactor_Token &token_;
+
/// Flag that indicate whether the thread that created this object
/// owns the token or not. A value of false indicates that this class
/// hasnt got the token (and hence the thread) and a value of true
/// vice-versa.
bool owner_;
+
};
+
/**
* @class ACE_TP_Reactor
*
@@ -148,11 +176,13 @@ private:
class ACE_Export ACE_TP_Reactor : public ACE_Select_Reactor
{
public:
+
/// Initialize ACE_TP_Reactor with the default size.
ACE_TP_Reactor (ACE_Sig_Handler * = 0,
ACE_Timer_Queue * = 0,
bool mask_signals = true,
int s_queue = ACE_Select_Reactor_Token::FIFO);
+
/**
* Initialize the ACE_TP_Reactor to manage
* @a max_number_of_handles. If @a restart is non-0 then the
@@ -167,6 +197,7 @@ public:
ACE_Timer_Queue *tq = 0,
bool mask_signals = true,
int s_queue = ACE_Select_Reactor_Token::FIFO);
+
/**
* This event loop driver that blocks for @a max_wait_time before
* returning. It will return earlier if timer events, I/O events,
@@ -185,53 +216,69 @@ public:
* if an error occurs (check @c errno for more information).
*/
virtual int handle_events (ACE_Time_Value *max_wait_time = 0);
+
virtual int handle_events (ACE_Time_Value &max_wait_time);
+
/// Does the reactor allow the application to resume the handle on
/// its own ie. can it pass on the control of handle resumption to
/// the application. The TP reactor has can allow applications to
/// resume handles. So return a positive value.
virtual int resumable_handler (void);
+
/// Called from handle events
static void no_op_sleep_hook (void *);
+
/// The ACE_TP_Reactor implementation does not have a single owner thread.
/// Attempts to set the owner explicitly are ignored. The reported owner
/// thread is the current Leader in the pattern.
virtual int owner (ACE_thread_t n_id, ACE_thread_t *o_id = 0);
+
/// Return the thread ID of the current Leader.
virtual int owner (ACE_thread_t *t_id);
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
// = Internal methods that do the actual work.
+
/// Template method from the base class.
virtual void clear_dispatch_mask (ACE_HANDLE handle,
ACE_Reactor_Mask mask);
+
/// Dispatch just 1 signal, timer, notification handlers
int dispatch_i (ACE_Time_Value *max_wait_time,
ACE_TP_Token_Guard &guard);
+
/// Get the event that needs dispatching. It could be either a
/// signal, timer, notification handlers or return possibly 1 I/O
/// handler for dispatching. In the most common use case, this would
/// return 1 I/O handler for dispatching
int get_event_for_dispatching (ACE_Time_Value *max_wait_time);
+
#if 0
// @Ciju
// signal handling isn't in a production state yet.
// Commenting it out for now.
+
/// Method to handle signals
/// @note It is just busted at this point in time.
int handle_signals (int &event_count,
ACE_TP_Token_Guard &g);
#endif // #if 0
+
/// Handle timer events
int handle_timer_events (int &event_count,
ACE_TP_Token_Guard &g);
+
/// Handle notify events
int handle_notify_events (int &event_count,
ACE_TP_Token_Guard &g);
+
/// handle socket events
int handle_socket_events (int &event_count,
ACE_TP_Token_Guard &g);
+
/// This method shouldn't get called.
virtual void notify_handle (ACE_HANDLE handle,
ACE_Reactor_Mask mask,
@@ -239,26 +286,36 @@ protected:
ACE_Event_Handler *eh,
ACE_EH_PTMF callback);
private:
+
/// Get the handle of the notify pipe from the ready set if there is
/// an event in the notify pipe.
ACE_HANDLE get_notify_handle (void);
+
/// Get socket event dispatch information.
int get_socket_event_info (ACE_EH_Dispatch_Info &info);
+
/// Notify the appropriate <callback> in the context of the <eh>
/// associated with <handle> that a particular event has occurred.
int dispatch_socket_event (ACE_EH_Dispatch_Info &dispatch_info);
+
/// Clear the @a handle from the read_set
void clear_handle_read_set (ACE_HANDLE handle);
+
int post_process_socket_event (ACE_EH_Dispatch_Info &dispatch_info,int status);
+
private:
/// Deny access since member-wise won't work...
ACE_TP_Reactor (const ACE_TP_Reactor &);
ACE_TP_Reactor &operator = (const ACE_TP_Reactor &);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/TP_Reactor.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_TP_REACTOR_H */
diff --git a/dep/ACE_wrappers/ace/TP_Reactor.inl b/dep/ACE_wrappers/ace/TP_Reactor.inl
index 319b8e564fe..2b14a8c9b96 100644
--- a/dep/ACE_wrappers/ace/TP_Reactor.inl
+++ b/dep/ACE_wrappers/ace/TP_Reactor.inl
@@ -1,10 +1,13 @@
// -*- C++ -*-
//
// $Id: TP_Reactor.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/************************************************************************/
// Methods for ACE_EH_Dispatch_Info
/************************************************************************/
+
ACE_INLINE
ACE_EH_Dispatch_Info::ACE_EH_Dispatch_Info (void) :
handle_ (ACE_INVALID_HANDLE),
@@ -16,6 +19,7 @@ ACE_EH_Dispatch_Info::ACE_EH_Dispatch_Info (void) :
dispatch_ (false)
{
}
+
ACE_INLINE void
ACE_EH_Dispatch_Info::set (ACE_HANDLE handle,
ACE_Event_Handler *event_handler,
@@ -23,6 +27,7 @@ ACE_EH_Dispatch_Info::set (ACE_HANDLE handle,
ACE_EH_PTMF callback)
{
this->dispatch_ = true;
+
this->handle_ = handle;
this->event_handler_ = event_handler;
this->mask_ = mask;
@@ -37,20 +42,25 @@ ACE_EH_Dispatch_Info::set (ACE_HANDLE handle,
else
this->dispatch_ = false;
}
+
ACE_INLINE bool
ACE_EH_Dispatch_Info::dispatch (void) const
{
return this->dispatch_;
}
+
/************************************************************************/
// Methods for ACE_TP_Token_Guard
/************************************************************************/
+
ACE_INLINE
ACE_TP_Token_Guard::ACE_TP_Token_Guard (ACE_Select_Reactor_Token &token)
+
: token_ (token),
owner_ (false)
{
}
+
ACE_INLINE
ACE_TP_Token_Guard::~ACE_TP_Token_Guard (void)
{
@@ -60,29 +70,35 @@ ACE_TP_Token_Guard::~ACE_TP_Token_Guard (void)
this->owner_ = false;
}
}
+
ACE_INLINE void
ACE_TP_Token_Guard::release_token (void)
{
if (this->owner_)
{
ACE_MT (this->token_.release ());
+
// We are not the owner anymore..
this->owner_ = false;
}
}
+
ACE_INLINE bool
ACE_TP_Token_Guard::is_owner (void)
{
return this->owner_;
}
+
/************************************************************************/
// Methods for ACE_TP_Reactor
/************************************************************************/
+
ACE_INLINE void
ACE_TP_Reactor::no_op_sleep_hook (void *)
{
}
+
ACE_INLINE void
ACE_TP_Reactor::clear_handle_read_set (ACE_HANDLE handle)
{
@@ -90,6 +106,7 @@ ACE_TP_Reactor::clear_handle_read_set (ACE_HANDLE handle)
this->ready_set_.ex_mask_.clr_bit (handle);
this->ready_set_.rd_mask_.clr_bit (handle);
}
+
ACE_INLINE void
ACE_TP_Reactor::clear_dispatch_mask (ACE_HANDLE ,
ACE_Reactor_Mask )
@@ -98,4 +115,5 @@ ACE_TP_Reactor::clear_dispatch_mask (ACE_HANDLE ,
this->ready_set_.wr_mask_.reset ();
this->ready_set_.ex_mask_.reset ();
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/TSS_Adapter.cpp b/dep/ACE_wrappers/ace/TSS_Adapter.cpp
index 52f273e2453..287dcac8b59 100644
--- a/dep/ACE_wrappers/ace/TSS_Adapter.cpp
+++ b/dep/ACE_wrappers/ace/TSS_Adapter.cpp
@@ -7,22 +7,29 @@
*
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
+
#include "ace/TSS_Adapter.h"
+
ACE_RCSID(ace, TSS_Adapter, "$Id: TSS_Adapter.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_TSS_Adapter::ACE_TSS_Adapter (void *object, ACE_THR_DEST f)
: ts_obj_ (object),
func_ (f)
{
// ACE_TRACE ("ACE_TSS_Adapter::ACE_TSS_Adapter");
}
+
void
ACE_TSS_Adapter::cleanup (void)
{
// ACE_TRACE ("ACE_TSS_Adapter::cleanup");
(*this->func_)(this->ts_obj_); // call cleanup routine for ts_obj_
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
extern "C" void
ACE_TSS_C_cleanup (void *object)
{
diff --git a/dep/ACE_wrappers/ace/TSS_Adapter.h b/dep/ACE_wrappers/ace/TSS_Adapter.h
index ee264889a42..0729c1a7886 100644
--- a/dep/ACE_wrappers/ace/TSS_Adapter.h
+++ b/dep/ACE_wrappers/ace/TSS_Adapter.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file TSS_Adapter.h
@@ -10,14 +11,19 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//==========================================================================
+
#ifndef ACE_TSS_ADAPTER_H
#define ACE_TSS_ADAPTER_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_TSS_Adapter
*
@@ -36,15 +42,21 @@ class ACE_Export ACE_TSS_Adapter
public:
/// Initialize the adapter.
ACE_TSS_Adapter (void *object, ACE_THR_DEST f);
+
/// Perform the cleanup operation.
void cleanup (void);
+
//private:
+
/// The real TS object.
void * const ts_obj_;
+
/// The real cleanup routine for ts_obj;
ACE_THR_DEST func_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
#endif /* ACE_TSS_ADAPTER_H */
diff --git a/dep/ACE_wrappers/ace/TSS_T.h b/dep/ACE_wrappers/ace/TSS_T.h
index f58c8f04f44..e00c1a0445e 100644
--- a/dep/ACE_wrappers/ace/TSS_T.h
+++ b/dep/ACE_wrappers/ace/TSS_T.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file TSS_T.h
@@ -10,13 +11,17 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//==========================================================================
+
#ifndef ACE_TSS_T_H
#define ACE_TSS_T_H
#include /**/ "ace/pre.h"
+
#include "ace/Lock.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
// This should probably go somewhere else, but it's only used here and
// in Thread_Manager.
// Note there is no ACE_TSS_SET because one would typicaly do
@@ -29,8 +34,11 @@
# define ACE_TSS_TYPE(T) T
# define ACE_TSS_GET(I, T) (I)
# endif /* ACE_HAS_THREADS && (ACE_HAS_THREAD_SPECIFIC_STORAGE || ACE_HAS_TSS_EMULATION) */
+
#include "ace/Thread_Mutex.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_TSS
*
@@ -81,9 +89,11 @@ public:
* a specific value.
*/
ACE_TSS (TYPE *ts_obj = 0);
+
/// Deregister this object from thread-specific storage administration.
/// Will cause all threads' copies of TYPE to be destroyed.
virtual ~ACE_TSS (void);
+
/**
* Set the thread-specific object for the calling thread.
* If this object has not been initialized yet, this method performs the
@@ -100,6 +110,7 @@ public:
* value if ts_object() returns 0.
*/
TYPE *ts_object (TYPE *new_ts_obj);
+
/** @name Accessors
*
* All accessors return a pointer to the calling thread's copy of the
@@ -117,6 +128,7 @@ public:
* information.
*/
TYPE *ts_object (void) const;
+
/**
* Use a "smart pointer" to get the thread-specific data associated
* with this object.
@@ -130,6 +142,7 @@ public:
* information.
*/
TYPE *operator-> () const;
+
/**
* Obtain a pointer to the calling thread's TYPE object.
* If this ACE_TSS object hasn't been initialized, this method
@@ -142,31 +155,42 @@ public:
* information.
*/
operator TYPE *(void) const;
+
//@}
+
/// Hook for construction parameters.
virtual TYPE *make_TSS_TYPE (void) const;
+
// = Utility methods.
+
/// Dump the state of an object.
void dump (void) const;
+
// ACE_ALLOC_HOOK_DECLARE;
// Declare the dynamic allocation hooks.
+
protected:
/// Actually implements the code that retrieves the object from
/// thread-specific storage.
TYPE *ts_get (void) const;
+
/// Factors out common code for initializing TSS. This must NOT be
/// called with the lock held...
int ts_init (void);
+
#if !(defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION)))
/// This implementation only works for non-threading systems...
TYPE *type_;
#else
/// Avoid race conditions during initialization.
ACE_Thread_Mutex keylock_;
+
/// "First time in" flag.
volatile bool once_;
+
/// Key for the thread-specific error data.
ACE_thread_key_t key_;
+
/// "Destructor" that deletes internal TYPE * when thread exits.
static void cleanup (void *ptr);
#endif /* defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION)) */
@@ -174,6 +198,7 @@ protected:
ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_TSS<TYPE> &))
ACE_UNIMPLEMENTED_FUNC (ACE_TSS (const ACE_TSS<TYPE> &))
};
+
/**
* @class ACE_TSS_Type_Adapter
*
@@ -196,26 +221,34 @@ class ACE_TSS_Type_Adapter
public:
/// Constructor. Inlined here so that it should _always_ be inlined.
ACE_TSS_Type_Adapter (const TYPE value = 0): value_ (value) {}
+
/// TYPE conversion. Inlined here so that it should _always_ be
/// inlined.
operator TYPE () const { return value_; };
+
/// TYPE & conversion. Inlined here so that it should _always_ be
/// inlined.
operator TYPE &() { return value_; };
+
private:
/// The wrapped value.
TYPE value_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/TSS_T.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/TSS_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("TSS_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
#endif /* ACE_TSS_T_H */
diff --git a/dep/ACE_wrappers/ace/TSS_T.inl b/dep/ACE_wrappers/ace/TSS_T.inl
index 2f0dde7d789..9959a2edd94 100644
--- a/dep/ACE_wrappers/ace/TSS_T.inl
+++ b/dep/ACE_wrappers/ace/TSS_T.inl
@@ -1,33 +1,42 @@
// -*- C++ -*-
//
// $Id: TSS_T.inl 80826 2008-03-04 14:51:23Z wotte $
+
#if !(defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION)))
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template <class TYPE> ACE_INLINE
ACE_TSS<TYPE>::ACE_TSS (TYPE *type)
: type_ (type)
{
}
+
template <class TYPE> ACE_INLINE int
-ACE_TSS<TYPE>::ts_init (void)
+ACE_TSS<TYPE>::ts_init (void)
{
return 0;
}
+
template <class TYPE> ACE_INLINE TYPE *
ACE_TSS<TYPE>::ts_object (void) const
{
return this->type_;
}
+
template <class TYPE> ACE_INLINE TYPE *
ACE_TSS<TYPE>::ts_object (TYPE *type)
{
this->type_ = type;
return this->type_;
}
+
template <class TYPE> ACE_INLINE TYPE *
ACE_TSS<TYPE>::ts_get (void) const
{
return this->type_;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ! (defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION))) */
diff --git a/dep/ACE_wrappers/ace/TTY_IO.cpp b/dep/ACE_wrappers/ace/TTY_IO.cpp
index 0f5086de2f1..106c7379ab9 100644
--- a/dep/ACE_wrappers/ace/TTY_IO.cpp
+++ b/dep/ACE_wrappers/ace/TTY_IO.cpp
@@ -1,16 +1,20 @@
// $Id: TTY_IO.cpp 82271 2008-07-09 09:23:03Z olli $
+
#include "ace/TTY_IO.h"
#include "ace/OS_NS_errno.h"
#include "ace/OS_NS_string.h"
#include "ace/OS_NS_strings.h"
+
#if defined (ACE_HAS_TERMIOS)
# include "ace/os_include/os_termios.h"
#elif defined (ACE_HAS_TERMIO)
# include <termio.h>
#endif
+
ACE_RCSID (ace,
TTY_IO,
"$Id: TTY_IO.cpp 82271 2008-07-09 09:23:03Z olli $")
+
namespace
{
const char ACE_TTY_IO_NONE[] = "none";
@@ -23,7 +27,9 @@ namespace
const char ACE_TTY_IO_SPACE[] = "space";
#endif /* ACE_WIN32 */
}
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_TTY_IO::Serial_Params::Serial_Params (void)
{
baudrate = 9600;
@@ -43,10 +49,13 @@ ACE_TTY_IO::Serial_Params::Serial_Params (void)
databits = 8;
stopbits = 1;
}
+
// Interface for reading/writing serial device parameters
+
int ACE_TTY_IO::control (Control_Mode cmd, Serial_Params *arg) const
{
#if defined (ACE_HAS_TERMIOS) || defined (ACE_HAS_TERMIO)
+
#if defined (ACE_HAS_TERMIOS)
struct termios devpar;
speed_t newbaudrate = 0;
@@ -63,6 +72,7 @@ int ACE_TTY_IO::control (Control_Mode cmd, Serial_Params *arg) const
errno = ENOSYS;
#endif /* ACE_HAS_TERMIOS */
return -1;
+
switch (cmd)
{
case SETPARAMS:
@@ -182,6 +192,7 @@ int ACE_TTY_IO::control (Control_Mode cmd, Serial_Params *arg) const
default:
return -1;
}
+
#if defined (ACE_HAS_TERMIOS)
// Can you really have different input and output baud rates?!
if (cfsetospeed (&devpar, newbaudrate) == -1)
@@ -195,6 +206,7 @@ int ACE_TTY_IO::control (Control_Mode cmd, Serial_Params *arg) const
# endif /* CBAUDEX */
devpar.c_cflag |= newbaudrate;
#endif /* ACE_HAS_TERMIOS */
+
devpar.c_cflag &= ~CSIZE;
switch (arg->databits)
{
@@ -213,6 +225,7 @@ int ACE_TTY_IO::control (Control_Mode cmd, Serial_Params *arg) const
default:
return -1;
}
+
switch (arg->stopbits)
{
case 1:
@@ -224,6 +237,7 @@ int ACE_TTY_IO::control (Control_Mode cmd, Serial_Params *arg) const
default:
return -1;
}
+
if (arg->paritymode)
{
if (ACE_OS::strcasecmp (arg->paritymode, ACE_TTY_IO_ODD) == 0)
@@ -245,6 +259,7 @@ int ACE_TTY_IO::control (Control_Mode cmd, Serial_Params *arg) const
{
devpar.c_cflag &= ~PARENB;
}
+
#if defined (CNEW_RTSCTS)
if ((arg->ctsenb) || (arg->rtsenb)) // Enable RTS/CTS protocol
devpar.c_cflag |= CNEW_RTSCTS;
@@ -256,6 +271,7 @@ int ACE_TTY_IO::control (Control_Mode cmd, Serial_Params *arg) const
else
devpar.c_cflag &= ~CRTSCTS;
#endif /* NEW_RTSCTS || CRTSCTS */
+
#if defined (CREAD)
// Enable/disable receiver
if (arg->rcvenb)
@@ -263,10 +279,12 @@ int ACE_TTY_IO::control (Control_Mode cmd, Serial_Params *arg) const
else
devpar.c_cflag &= ~CREAD;
#endif /* CREAD */
+
#if defined (HUPCL)
// Cause DTR to drop after port close.
devpar.c_cflag |= HUPCL;
#endif /* HUPCL */
+
#if defined (CLOCAL)
// If device is not a modem set to local device.
if (arg->modem)
@@ -274,9 +292,11 @@ int ACE_TTY_IO::control (Control_Mode cmd, Serial_Params *arg) const
else
devpar.c_cflag |= CLOCAL;
#endif /* CLOCAL */
+
devpar.c_iflag = IGNPAR | INPCK;
if (arg->databits < 8)
devpar.c_iflag |= ISTRIP;
+
#if defined (IGNBRK)
// If device is not a modem set to ignore break points
if(arg->modem)
@@ -284,6 +304,7 @@ int ACE_TTY_IO::control (Control_Mode cmd, Serial_Params *arg) const
else
devpar.c_iflag |= IGNBRK;
#endif /* IGNBRK */
+
#if defined (IXOFF)
// Enable/disable software flow control on input
if (arg->xinenb)
@@ -291,6 +312,7 @@ int ACE_TTY_IO::control (Control_Mode cmd, Serial_Params *arg) const
else
devpar.c_iflag &= ~IXOFF;
#endif /* IXOFF */
+
#if defined (IXON)
// Enable/disable software flow control on output
if (arg->xoutenb)
@@ -298,26 +320,32 @@ int ACE_TTY_IO::control (Control_Mode cmd, Serial_Params *arg) const
else
devpar.c_iflag &= ~IXON;
#endif /* IXON */
+
#if defined (ICANON)
// Enable noncanonical input processing mode
devpar.c_lflag &= ~ICANON;
#endif /* ICANON */
+
#if defined (ECHO)
// Disable echoing of input characters
devpar.c_lflag &= ~ECHO;
#endif /* ECHO */
+
#if defined (ECHOE)
// Disable echoing erase chareacter as BS-SP-BS
devpar.c_lflag &= ~ECHOE;
#endif /* ECHOE */
+
#if defined (ISIG)
// Disable SIGINTR, SIGSUSP, SIGDSUSP and SIGQUIT signals
devpar.c_lflag &= ~ISIG;
#endif /* ISIG */
+
#if defined (OPOST)
// Disable post-processing of output data
devpar.c_oflag &= ~OPOST;
#endif /* OPOST */
+
if (arg->readtimeoutmsec < 0)
{
// Settings for infinite timeout.
@@ -333,6 +361,7 @@ int ACE_TTY_IO::control (Control_Mode cmd, Serial_Params *arg) const
else
{
devpar.c_cc[VTIME] = static_cast<unsigned char>(arg->readtimeoutmsec / 100);
+
if (arg->readmincharacters > UCHAR_MAX)
devpar.c_cc[VMIN] = UCHAR_MAX;
else if (arg->readmincharacters < 1)
@@ -340,15 +369,19 @@ int ACE_TTY_IO::control (Control_Mode cmd, Serial_Params *arg) const
else
devpar.c_cc[VMIN] = static_cast<unsigned char>(arg->readmincharacters);
}
+
#if defined (TIOCMGET)
int status;
this->ACE_IO_SAP::control (TIOCMGET, &status);
+
if (arg->dtrdisable)
status &= ~TIOCM_DTR;
else
status |= TIOCM_DTR;
+
this->ACE_IO_SAP::control (TIOCMSET, &status);
#endif /* definded (TIOCMGET) */
+
#if defined (ACE_HAS_TERMIOS)
return tcsetattr (get_handle (), TCSANOW, &devpar);
#elif defined (TCSETS)
@@ -359,6 +392,7 @@ int ACE_TTY_IO::control (Control_Mode cmd, Serial_Params *arg) const
errno = ENOSYS;
return -1;
#endif /* ACE_HAS_TERMIOS */
+
case GETPARAMS:
return -1; // Not yet implemented.
default:
@@ -375,7 +409,9 @@ int ACE_TTY_IO::control (Control_Mode cmd, Serial_Params *arg) const
ACE_OS::set_errno_to_last_error ();
return -1;
}
+
dcb.BaudRate = arg->baudrate;
+
switch (arg->databits)
{
case 4:
@@ -388,6 +424,7 @@ int ACE_TTY_IO::control (Control_Mode cmd, Serial_Params *arg) const
default:
return -1;
}
+
switch (arg->stopbits)
{
case 1:
@@ -399,6 +436,7 @@ int ACE_TTY_IO::control (Control_Mode cmd, Serial_Params *arg) const
default:
return -1;
}
+
if (arg->paritymode)
{
dcb.fParity = TRUE;
@@ -420,6 +458,7 @@ int ACE_TTY_IO::control (Control_Mode cmd, Serial_Params *arg) const
dcb.fParity = FALSE;
dcb.Parity = NOPARITY;
}
+
// Enable/disable RTS protocol.
switch (arg->rtsenb)
{
@@ -435,51 +474,61 @@ int ACE_TTY_IO::control (Control_Mode cmd, Serial_Params *arg) const
default:
dcb.fRtsControl = RTS_CONTROL_DISABLE;
}
+
// Enable/disable CTS protocol.
if (arg->ctsenb)
dcb.fOutxCtsFlow = TRUE;
else
dcb.fOutxCtsFlow = FALSE;
+
// Enable/disable DSR protocol.
if (arg->dsrenb)
dcb.fOutxDsrFlow = TRUE;
else
dcb.fOutxDsrFlow = FALSE;
+
// Disable/enable DTR protocol
if (arg->dtrdisable)
dcb.fDtrControl = DTR_CONTROL_DISABLE;
else
dcb.fDtrControl = DTR_CONTROL_ENABLE;
+
// Enable/disable software flow control on input
if (arg->xinenb)
dcb.fInX = TRUE;
else
dcb.fInX = FALSE;
+
// Enable/disable software flow control on output
if (arg->xoutenb)
dcb.fOutX = TRUE;
else
dcb.fOutX = FALSE;
+
// Always set limits unless set to negative to use default.
if (arg->xonlim >= 0)
dcb.XonLim = static_cast<WORD>(arg->xonlim);
if (arg->xofflim >= 0)
dcb.XoffLim = static_cast<WORD>(arg->xofflim);
+
dcb.fAbortOnError = FALSE;
dcb.fErrorChar = FALSE;
dcb.fNull = FALSE;
dcb.fBinary = TRUE;
+
if (!::SetCommState (this->get_handle (), &dcb))
{
ACE_OS::set_errno_to_last_error ();
return -1;
}
+
COMMTIMEOUTS timeouts;
if (!::GetCommTimeouts (this->get_handle(), &timeouts))
{
ACE_OS::set_errno_to_last_error ();
return -1;
}
+
if (arg->readtimeoutmsec < 0)
{
// Settings for infinite timeout.
@@ -501,16 +550,20 @@ int ACE_TTY_IO::control (Control_Mode cmd, Serial_Params *arg) const
timeouts.ReadTotalTimeoutMultiplier = MAXDWORD;
timeouts.ReadTotalTimeoutConstant = arg->readtimeoutmsec;
}
+
if (!::SetCommTimeouts (this->get_handle (), &timeouts))
{
ACE_OS::set_errno_to_last_error ();
return -1;
}
+
return 0;
+
case GETPARAMS:
ACE_NOTSUP_RETURN (-1); // Not yet implemented.
default:
return -1; // Wrong cmd.
+
} // arg switch
#else
ACE_UNUSED_ARG (cmd);
@@ -518,11 +571,13 @@ int ACE_TTY_IO::control (Control_Mode cmd, Serial_Params *arg) const
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_TERMIOS || ACE_HAS_TERMIO */
}
+
#if defined (ACE_NEEDS_DEV_IO_CONVERSION)
ACE_TTY_IO::operator ACE_DEV_IO &()
{
return static_cast<ACE_DEV_IO &>(*this);
}
#endif /* ACE_NEEDS_DEV_IO_CONVERSION */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/TTY_IO.h b/dep/ACE_wrappers/ace/TTY_IO.h
index fca44069c1d..c7404e84af8 100644
--- a/dep/ACE_wrappers/ace/TTY_IO.h
+++ b/dep/ACE_wrappers/ace/TTY_IO.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file TTY_IO.h
@@ -8,13 +9,18 @@
* @author Douglas C. Schmidt <schmidt@uci.edu>
*/
//=============================================================================
+
#ifndef ACE_TTY_IO_H
#define ACE_TTY_IO_H
+
#include "ace/DEV_IO.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_TTY_IO
*
@@ -35,9 +41,11 @@ public:
SETPARAMS, ///< Set control parameters.
GETPARAMS ///< Get control parameters.
};
+
struct ACE_Export Serial_Params
{
Serial_Params (void);
+
/** Specifies the baudrate at which the communnication port operates. */
int baudrate;
/** Specifies the minimum number of bytes in input buffer before XON char
@@ -90,13 +98,17 @@ public:
/** Stop bits. Valid values are 1 and 2. */
unsigned char stopbits;
};
+
/** Interface for reading/writing serial device parameters. */
int control (Control_Mode cmd, Serial_Params *arg) const;
+
#if defined (ACE_NEEDS_DEV_IO_CONVERSION)
/** This is necessary to pass ACE_TTY_IO as parameter to DEV_Connector. */
operator ACE_DEV_IO &();
#endif /* ACE_NEEDS_DEV_IO_CONVERSION */
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_TTY_IO_H */
diff --git a/dep/ACE_wrappers/ace/Task.cpp b/dep/ACE_wrappers/ace/Task.cpp
index f96708389cf..3746b735811 100644
--- a/dep/ACE_wrappers/ace/Task.cpp
+++ b/dep/ACE_wrappers/ace/Task.cpp
@@ -1,14 +1,19 @@
// $Id: Task.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Task.h"
#include "ace/Module.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Task.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID (ace,
Task,
"$Id: Task.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_Task_Base::ACE_Task_Base (ACE_Thread_Manager *thr_man)
: thr_count_ (0),
thr_mgr_ (thr_man),
@@ -22,49 +27,63 @@ ACE_Task_Base::ACE_Task_Base (ACE_Thread_Manager *thr_man)
ACE_OS::memset( &this->last_thread_id_, '\0', sizeof( this->last_thread_id_ ));
#endif /* defined (ACE_MVS) */
}
+
ACE_Task_Base::~ACE_Task_Base (void)
{
}
+
// Default ACE_Task service routine
+
int
ACE_Task_Base::svc (void)
{
ACE_TRACE ("ACE_Task_Base::svc");
return 0;
}
+
// Default ACE_Task open routine
+
int
ACE_Task_Base::open (void *)
{
ACE_TRACE ("ACE_Task_Base::open");
return 0;
}
+
// Default ACE_Task close routine
+
int
ACE_Task_Base::close (u_long)
{
ACE_TRACE ("ACE_Task_Base::close");
return 0;
}
+
// Forward the call to close() so that existing applications don't
// break.
+
int
ACE_Task_Base::module_closed (void)
{
return this->close (1);
}
+
// Default ACE_Task put routine.
+
int
ACE_Task_Base::put (ACE_Message_Block *, ACE_Time_Value *)
{
ACE_TRACE ("ACE_Task_Base::put");
return 0;
}
+
// Wait for all threads running in a task to exit.
+
int
ACE_Task_Base::wait (void)
{
ACE_TRACE ("ACE_Task_Base::wait");
+
// If we don't have a thread manager, we probably were never
// activated.
if (this->thr_mgr () != 0)
@@ -72,6 +91,7 @@ ACE_Task_Base::wait (void)
else
return 0;
}
+
// Suspend a task.
int
ACE_Task_Base::suspend (void)
@@ -80,8 +100,10 @@ ACE_Task_Base::suspend (void)
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1));
if (this->thr_count_ > 0)
return this->thr_mgr_->suspend_task (this);
+
return 0;
}
+
// Resume a suspended task.
int
ACE_Task_Base::resume (void)
@@ -90,8 +112,10 @@ ACE_Task_Base::resume (void)
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1));
if (this->thr_count_ > 0)
return this->thr_mgr_->resume_task (this);
+
return 0;
}
+
int
ACE_Task_Base::activate (long flags,
int n_threads,
@@ -106,11 +130,14 @@ ACE_Task_Base::activate (long flags,
const char* thr_name[])
{
ACE_TRACE ("ACE_Task_Base::activate");
+
#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;
+
if (this->thr_count_ > 0 && force_active == 0)
return 1; // Already active.
else
@@ -121,6 +148,7 @@ ACE_Task_Base::activate (long flags,
grp_id = this->grp_id_;
this->thr_count_ += n_threads;
}
+
// 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.
@@ -130,6 +158,7 @@ ACE_Task_Base::activate (long flags,
# else /* ! ACE_THREAD_MANAGER_LACKS_STATICS */
this->thr_mgr_ = ACE_Thread_Manager::instance ();
# endif /* ACE_THREAD_MANAGER_LACKS_STATICS */
+
int grp_spawned = -1;
if (thread_ids == 0)
// Thread Ids were not specified
@@ -166,14 +195,18 @@ ACE_Task_Base::activate (long flags,
this->thr_count_ -= n_threads;
return -1;
}
+
if (this->grp_id_ == -1)
this->grp_id_ = grp_spawned;
+
#if defined (ACE_MVS) || defined(__TANDEM)
ACE_OS::memcpy( &this->last_thread_id_, '\0', sizeof(this->last_thread_id_));
#else
this->last_thread_id_ = 0; // Reset to prevent inadvertant match on ID
#endif /* defined (ACE_MVS) */
+
return 0;
+
#else
{
// Keep the compiler from complaining.
@@ -192,10 +225,12 @@ ACE_Task_Base::activate (long flags,
}
#endif /* ACE_MT_SAFE */
}
+
void
ACE_Task_Base::cleanup (void *object, void *)
{
ACE_Task_Base *t = (ACE_Task_Base *) object;
+
// The thread count must be decremented first in case the <close>
// hook does something crazy like "delete this".
{
@@ -204,11 +239,13 @@ ACE_Task_Base::cleanup (void *object, void *)
if (0 == t->thr_count_)
t->last_thread_id_ = ACE_Thread::self ();
}
+
// @@ Is it possible to pass in the exit status somehow?
t->close ();
// t is undefined here. close() could have deleted it.
}
+
#if defined (ACE_HAS_SIG_C_FUNC)
extern "C" void
ACE_Task_Base_cleanup (void *object, void *)
@@ -216,19 +253,24 @@ ACE_Task_Base_cleanup (void *object, void *)
ACE_Task_Base::cleanup (object, 0);
}
#endif /* ACE_HAS_SIG_C_FUNC */
+
ACE_THR_FUNC_RETURN
ACE_Task_Base::svc_run (void *args)
{
ACE_TRACE ("ACE_Task_Base::svc_run");
+
ACE_Task_Base *t = (ACE_Task_Base *) args;
+
// Register ourself with our <Thread_Manager>'s thread exit hook
// mechanism so that our close() hook will be sure to get invoked
// when this thread exits.
+
#if defined ACE_HAS_SIG_C_FUNC
t->thr_mgr ()->at_exit (t, ACE_Task_Base_cleanup, 0);
#else
t->thr_mgr ()->at_exit (t, ACE_Task_Base::cleanup, 0);
#endif /* ACE_HAS_SIG_C_FUNC */
+
// Call the Task's svc() hook method.
int const svc_status = t->svc ();
ACE_THR_FUNC_RETURN status;
@@ -238,17 +280,21 @@ ACE_Task_Base::svc_run (void *args)
#else
status = reinterpret_cast<ACE_THR_FUNC_RETURN> (svc_status);
#endif /* ACE_HAS_INTEGRAL_TYPE_THR_FUNC_RETURN */
+
// If we changed this zero change the other if in OS.cpp Thread_Adapter::invoke
#if 1
// Call the <Task->close> hook.
ACE_Thread_Manager *thr_mgr_ptr = t->thr_mgr ();
+
// This calls the Task->close () hook.
t->cleanup (t, 0);
+
// This prevents a second invocation of the cleanup code
// (called later by <ACE_Thread_Manager::exit>.
thr_mgr_ptr->at_exit (t, 0, 0);
#endif
return status;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Task.h b/dep/ACE_wrappers/ace/Task.h
index 128beab6813..fb3c8604c2c 100644
--- a/dep/ACE_wrappers/ace/Task.h
+++ b/dep/ACE_wrappers/ace/Task.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Task.h
@@ -8,15 +9,21 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_TASK_H
#define ACE_TASK_H
#include /**/ "ace/pre.h"
+
#include "ace/Service_Object.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Thread_Manager.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Task_Flags
*
@@ -45,6 +52,7 @@ namespace ACE_Task_Flags
ACE_FLUSHRW = 030
};
}
+
/**
* @class ACE_Task_Base
*
@@ -61,14 +69,19 @@ public:
// = Initialization and termination methods.
/// Constructor.
ACE_Task_Base (ACE_Thread_Manager * = 0);
+
/// Destructor.
virtual ~ACE_Task_Base (void);
+
// = Initialization and termination hooks.
+
// These methods should be overridden by subclasses if you'd like to
// provide <Task>-specific initialization and termination behavior.
+
/// Hook called to initialize a task and prepare it for execution.
/// @a args can be used to pass arbitrary information into <open>.
virtual int open (void *args = 0);
+
/**
* Hook called from ACE_Thread_Exit when during thread exit and from
* the default implementation of <module_closed>. In general, this
@@ -79,6 +92,7 @@ public:
* interpret this as a flag to shut down the <Task>.
*/
virtual int close (u_long flags = 0);
+
/**
* Hook called during <ACE_Module::close>. The default
* implementation calls forwards the call to close(1). Please
@@ -89,15 +103,20 @@ public:
* ACE_Task instance exits.
*/
virtual int module_closed (void);
+
// = Immediate and deferred processing methods, respectively.
+
// These methods should be overridden by subclasses if you'd like to
// provide <Task>-specific message processing behavior.
+
/// A hook method that can be used to pass a message to a
/// task, where it can be processed immediately or queued for subsequent
/// processing in the <svc> hook method.
virtual int put (ACE_Message_Block *, ACE_Time_Value * = 0);
+
/// Run by a daemon thread to handle deferred processing.
virtual int svc (void);
+
// = Active object activation method.
/**
* Turn the task into an active object, i.e., having @a n_threads of
@@ -168,6 +187,7 @@ public:
size_t stack_size[] = 0,
ACE_thread_t thread_ids[] = 0,
const char* thr_name[] = 0);
+
/**
* Block until there are no more threads running in this task.
* This method will not wait for either detached or daemon threads;
@@ -179,7 +199,9 @@ public:
* @retval -1 Failure (consult errno for further information).
*/
virtual int wait (void);
+
// = Suspend/resume a Task.
+
// Note that these methods are not portable and should be avoided
// since they are inherently error-prone to use. They are only here
// for (the rare) applications that know how to use them correctly.
@@ -187,24 +209,32 @@ public:
virtual int suspend (void);
/// Resume a suspended task.
virtual int resume (void);
+
/// Get the current group id.
int grp_id (void) const;
+
/// Set the current group id.
void grp_id (int);
+
/// Get the thread manager associated with this Task.
ACE_Thread_Manager *thr_mgr (void) const;
+
/// Set the thread manager associated with this Task.
void thr_mgr (ACE_Thread_Manager *);
+
/// True if queue is a reader, else false.
int is_reader (void) const;
+
/// True if queue is a writer, else false.
int is_writer (void) const;
+
/**
* Returns the number of threads currently running within a task.
* If we're a passive object this value is 0, else it's greater than
* 0.
*/
size_t thr_count (void) const;
+
/**
* Returns the thread ID of the thread whose exit caused this object's
* thread count to be decremented to 0.
@@ -222,11 +252,14 @@ public:
* multiple threads are active.
*/
ACE_thread_t last_thread (void) const;
+
/// Routine that runs the service routine as a daemon thread.
static ACE_THR_FUNC_RETURN svc_run (void *);
+
/// Cleanup hook that is called when a thread exits to gracefully
/// shutdown an ACE_Task.
static void cleanup (void *object, void *params);
+
protected:
/**
* Count of the number of threads running within the task. If this
@@ -235,30 +268,41 @@ protected:
* If the value == 0, then we're a passive object.
*/
size_t thr_count_;
+
/// Multi-threading manager.
ACE_Thread_Manager *thr_mgr_;
+
/// ACE_Task flags.
u_long flags_;
+
/// This maintains the group id of the Task.
int grp_id_;
+
#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
/// Protect the state of a Task during concurrent operations, but
/// only if we're configured as MT safe...
ACE_Thread_Mutex lock_;
#endif /* ACE_MT_SAFE */
+
/// Holds the thread ID of the last thread to exit svc() in this object.
ACE_thread_t last_thread_id_;
+
private:
+
// = Disallow these operations.
ACE_Task_Base &operator= (const ACE_Task_Base &);
ACE_Task_Base (const ACE_Task_Base &);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Task.inl"
#endif /* __ACE_INLINE__ */
+
// Include the ACE_Task templates classes at this point.
#include "ace/Task_T.h"
+
#include /**/ "ace/post.h"
#endif /* ACE_TASK_H */
diff --git a/dep/ACE_wrappers/ace/Task.inl b/dep/ACE_wrappers/ace/Task.inl
index 641057d803f..9f70371e5f5 100644
--- a/dep/ACE_wrappers/ace/Task.inl
+++ b/dep/ACE_wrappers/ace/Task.inl
@@ -1,7 +1,9 @@
// -*- C++ -*-
//
// $Id: Task.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Get the current group id.
ACE_INLINE int
ACE_Task_Base::grp_id (void) const
@@ -10,50 +12,60 @@ ACE_Task_Base::grp_id (void) const
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, const_cast <ACE_Thread_Mutex&>(this->lock_), -1));
return this->grp_id_;
}
+
// Set the current group id.
+
ACE_INLINE void
ACE_Task_Base::grp_id (int identifier)
{
ACE_TRACE ("ACE_Task_Base::grp_id");
ACE_MT (ACE_GUARD (ACE_Thread_Mutex, ace_mon, this->lock_));
+
// Cache the group id in the task and then set it in the
// Thread_Manager, if there is one.
this->grp_id_ = identifier;
if (this->thr_mgr ())
this->thr_mgr ()->set_grp (this, identifier);
}
+
ACE_INLINE ACE_Thread_Manager *
ACE_Task_Base::thr_mgr (void) const
{
ACE_TRACE ("ACE_Task_Base::thr_mgr");
return this->thr_mgr_;
}
+
ACE_INLINE void
ACE_Task_Base::thr_mgr (ACE_Thread_Manager *thr_mgr)
{
ACE_TRACE ("ACE_Task_Base::thr_mgr");
this->thr_mgr_ = thr_mgr;
}
+
ACE_INLINE int
ACE_Task_Base::is_reader (void) const
{
ACE_TRACE ("ACE_Task_Base::is_reader");
return (ACE_BIT_ENABLED (this->flags_, ACE_Task_Flags::ACE_READER));
}
+
ACE_INLINE int
ACE_Task_Base::is_writer (void) const
{
ACE_TRACE ("ACE_Task_Base::is_writer");
return (ACE_BIT_DISABLED (this->flags_, ACE_Task_Flags::ACE_READER));
}
+
// Return the count of the current number of threads.
ACE_INLINE size_t
ACE_Task_Base::thr_count (void) const
{
ACE_TRACE ("ACE_Task_Base::thr_count");
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, const_cast <ACE_Thread_Mutex&>(this->lock_), 0));
+
return this->thr_count_;
}
+
// Return the thread ID of the last thread to exit svc().
ACE_INLINE ACE_thread_t
ACE_Task_Base::last_thread (void) const
@@ -61,4 +73,5 @@ ACE_Task_Base::last_thread (void) const
ACE_TRACE ("ACE_Task_Base::last_thread");
return this->last_thread_id_;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Task_Ex_T.h b/dep/ACE_wrappers/ace/Task_Ex_T.h
index d7a84b4f5db..031b2a1f4f5 100644
--- a/dep/ACE_wrappers/ace/Task_Ex_T.h
+++ b/dep/ACE_wrappers/ace/Task_Ex_T.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Task_Ex_T.h
@@ -8,18 +9,25 @@
* @author Kobi Cohen-Arazi <kobi-co@barak-online.net>
*/
//=============================================================================
+
#ifndef ACE_TASK_EX_T_H
#define ACE_TASK_EX_T_H
#include /**/ "ace/pre.h"
+
#include "ace/Service_Object.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Synch_Traits.h"
#include "ace/Task.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward decls...
template <ACE_SYNCH_DECL> class ACE_Module;
+
/**
* @class ACE_Task_Ex
*
@@ -56,6 +64,7 @@ public:
friend class ACE_Module<ACE_SYNCH_USE>;
friend class ACE_Module_Type;
typedef ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE> MESSAGE_QUEUE_EX;
+
// = Initialization/termination methods.
/**
* Initialize a Task, supplying a thread manager and a message
@@ -65,63 +74,81 @@ public:
*/
ACE_Task_Ex (ACE_Thread_Manager *thr_mgr = 0,
MESSAGE_QUEUE_EX *mq = 0);
+
/// Destructor.
virtual ~ACE_Task_Ex (void);
+
/// Gets the message queue associated with this task.
MESSAGE_QUEUE_EX *msg_queue (void);
+
/// Sets the message queue associated with this task.
void msg_queue (MESSAGE_QUEUE_EX *);
+
public: // Should be protected:
// = Message queue manipulation methods.
+
// = Enqueue and dequeue methods.
+
// For the following five method if @a timeout == 0, the caller will
// block until action is possible, else will wait until the
// <{absolute}> time specified in *@a timeout elapses). These calls
// will return, however, when queue is closed, deactivated, when a
// signal occurs, or if the time specified in timeout elapses, (in
// which case errno = EWOULDBLOCK).
+
/// Insert message into the message queue. Note that @a timeout uses
/// <{absolute}> time rather than <{relative}> time.
int putq (ACE_MESSAGE_TYPE *, ACE_Time_Value *timeout = 0);
+
/**
* Extract the first message from the queue (blocking). Note that
* @a timeout uses <{absolute}> time rather than <{relative}> time.
* Returns number of items in queue if the call succeeds or -1 otherwise.
*/
int getq (ACE_MESSAGE_TYPE *&mb, ACE_Time_Value *timeout = 0);
+
/// Return a message to the queue. Note that @a timeout uses
/// <{absolute}> time rather than <{relative}> time.
int ungetq (ACE_MESSAGE_TYPE *, ACE_Time_Value *timeout = 0);
+
/**
* Turn the message around and send it back down the Stream. Note
* that @a timeout uses <{absolute}> time rather than <{relative}>
* time.
*/
int reply (ACE_MESSAGE_TYPE *, ACE_Time_Value *timeout = 0);
+
/**
* Transfer message to the adjacent ACE_Task_Ex in a ACE_Stream. Note
* that @a timeout uses <{absolute}> time rather than <{relative}>
* time.
*/
int put_next (ACE_MESSAGE_TYPE *msg, ACE_Time_Value *timeout = 0);
+
/**
* Tests whether we can enqueue a message without blocking.
* @deprecated This method is deprecated and will go away in the future.
*/
int can_put (ACE_MESSAGE_TYPE *);
+
// = ACE_Task utility routines to identify names et al.
/// Return the name of the enclosing Module if there's one associated
/// with the Task, else returns 0.
const ACE_TCHAR *name (void) const;
+
// = Pointers to next ACE_Task_Base (if ACE is part of an ACE_Stream).
/// Get next Task pointer.
ACE_Task<ACE_SYNCH_USE> *next (void);
+
/// Set next Task pointer.
void next (ACE_Task<ACE_SYNCH_USE> *);
+
/// Alwasy return 0. @todo FIXME
ACE_Task<ACE_SYNCH_USE> *sibling (void);
+
/// Return the Task's Module if there is one, else returns 0.
ACE_Module<ACE_SYNCH_USE> *module (void) const;
+
/**
* Flush the task's queue, i.e., free all of the enqueued
* message blocks and releases any threads blocked on the queue.
@@ -129,36 +156,51 @@ public: // Should be protected:
* function, just rewrite the iostream function as ::<flush>.
*/
int flush (u_long flag = ACE_Task_Flags::ACE_FLUSHALL);
+
// = Special routines corresponding to certain message types.
+
/// Manipulate watermarks.
void water_marks (ACE_IO_Cntl_Msg::ACE_IO_Cntl_Cmds, size_t);
+
/// Queue of messages on the ACE_Task..
MESSAGE_QUEUE_EX *msg_queue_;
+
/// true if should delete Message_Queue, false otherwise.
bool delete_msg_queue_;
+
/// Back-pointer to the enclosing module.
ACE_Module<ACE_SYNCH_USE> *mod_;
+
/// Pointer to adjacent ACE_Task.
ACE_Task<ACE_SYNCH_USE> *next_;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
+
// = Disallow these operations.
ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE> &))
ACE_UNIMPLEMENTED_FUNC (ACE_Task_Ex (const ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE> &))
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Task_Ex_T.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Task_Ex_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Task_Ex_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
#endif /* ACE_TASK_EX_H */
diff --git a/dep/ACE_wrappers/ace/Task_Ex_T.inl b/dep/ACE_wrappers/ace/Task_Ex_T.inl
index 90843d0d5c6..dd90bcd499a 100644
--- a/dep/ACE_wrappers/ace/Task_Ex_T.inl
+++ b/dep/ACE_wrappers/ace/Task_Ex_T.inl
@@ -1,7 +1,9 @@
// -*- C++ -*-
//
// $Id: Task_Ex_T.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template <ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE> ACE_INLINE void
ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::water_marks (ACE_IO_Cntl_Msg::ACE_IO_Cntl_Cmds cmd,
size_t wm_size)
@@ -12,30 +14,35 @@ ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::water_marks (ACE_IO_Cntl_Msg::ACE_I
else /* cmd == ACE_IO_Cntl_Msg::SET_HWM */
this->msg_queue_->high_water_mark (wm_size);
}
+
template <ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE> ACE_INLINE int
ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::getq (ACE_MESSAGE_TYPE *&mb, ACE_Time_Value *tv)
{
ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::getq");
return this->msg_queue_->dequeue_head (mb, tv);
}
+
template <ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE> ACE_INLINE int
ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::can_put (ACE_MESSAGE_TYPE *)
{
ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::can_put");
ACE_NOTSUP_RETURN (-1);
}
+
template <ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE> ACE_INLINE int
ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::putq (ACE_MESSAGE_TYPE *mb, ACE_Time_Value *tv)
{
ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::putq");
return this->msg_queue_->enqueue_tail (mb, tv);
}
+
template <ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE> ACE_INLINE int
ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::ungetq (ACE_MESSAGE_TYPE *mb, ACE_Time_Value *tv)
{
ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::ungetq");
return this->msg_queue_->enqueue_head (mb, tv);
}
+
template <ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE> ACE_INLINE int
ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::flush (u_long flag)
{
@@ -45,6 +52,7 @@ ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::flush (u_long flag)
else
return -1; // Note, need to be more careful about what we free...
}
+
template <ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE> ACE_INLINE void
ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::msg_queue (ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE> *mq)
{
@@ -56,12 +64,14 @@ ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::msg_queue (ACE_Message_Queue_Ex<ACE
}
this->msg_queue_ = mq;
}
+
template <ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE> ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE> *
ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::msg_queue (void)
{
ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::msg_queue");
return this->msg_queue_;
}
+
template <ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE> ACE_INLINE int
ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::reply (ACE_MESSAGE_TYPE *mb, ACE_Time_Value *tv)
{
@@ -70,19 +80,23 @@ ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::reply (ACE_MESSAGE_TYPE *mb, ACE_Ti
ACE_UNUSED_ARG (tv);
return -1 ; // this->sibling ()->put_next (mb, tv);
}
+
template <ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE> ACE_INLINE ACE_Task<ACE_SYNCH_USE> *
ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::next (void)
{
ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::next");
return this->next_;
}
+
template <ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE> ACE_INLINE void
ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::next (ACE_Task<ACE_SYNCH_USE> *q)
{
ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::next");
this->next_ = q;
}
+
// Transfer msg to the next ACE_Task_Ex.
+
template <ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE> ACE_INLINE int
ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::put_next (
ACE_MESSAGE_TYPE * /* msg */,
@@ -91,4 +105,5 @@ ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::put_next (
ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::put_next");
return -1; // this->next_ == 0 ? -1 : this->next_->put (msg, tv);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Task_T.h b/dep/ACE_wrappers/ace/Task_T.h
index 75064945c3e..5cd703d29ac 100644
--- a/dep/ACE_wrappers/ace/Task_T.h
+++ b/dep/ACE_wrappers/ace/Task_T.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Task_T.h
@@ -8,19 +9,26 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_TASK_T_H
#define ACE_TASK_T_H
#include /**/ "ace/pre.h"
+
#include "ace/Message_Queue.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Synch_Traits.h"
#include "ace/Task.h"
#include "ace/IO_Cntl_Msg.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward decls...
template <ACE_SYNCH_DECL> class ACE_Module;
+
/**
* @class ACE_Task
*
@@ -36,6 +44,7 @@ class ACE_Task : public ACE_Task_Base
public:
friend class ACE_Module<ACE_SYNCH_USE>;
friend class ACE_Module_Type;
+
// = Initialization/termination methods.
/**
* Initialize a Task, supplying a thread manager and a message
@@ -45,33 +54,43 @@ public:
*/
ACE_Task (ACE_Thread_Manager *thr_mgr = 0,
ACE_Message_Queue<ACE_SYNCH_USE> *mq = 0);
+
/// Destructor.
virtual ~ACE_Task (void);
+
/// Gets the message queue associated with this task.
ACE_Message_Queue<ACE_SYNCH_USE> *msg_queue (void);
+
/// Sets the message queue associated with this task.
void msg_queue (ACE_Message_Queue<ACE_SYNCH_USE> *);
+
public: // Should be protected:
// = Message queue manipulation methods.
+
// = Enqueue and dequeue methods.
+
// For the following five method if @a timeout == 0, the caller will
// block until action is possible, else will wait until the
// <{absolute}> time specified in *@a timeout elapses). These calls
// will return, however, when queue is closed, deactivated, when a
// signal occurs, or if the time specified in timeout elapses, (in
// which case errno = EWOULDBLOCK).
+
/// Insert message into the message queue. Note that @a timeout uses
/// <{absolute}> time rather than <{relative}> time.
int putq (ACE_Message_Block *, ACE_Time_Value *timeout = 0);
+
/**
* Extract the first message from the queue (blocking). Note that
* @a timeout uses <{absolute}> time rather than <{relative}> time.
* Returns number of items in queue if the call succeeds or -1 otherwise.
*/
int getq (ACE_Message_Block *&mb, ACE_Time_Value *timeout = 0);
+
/// Return a message to the queue. Note that @a timeout uses
/// <{absolute}> time rather than <{relative}> time.
int ungetq (ACE_Message_Block *, ACE_Time_Value *timeout = 0);
+
/**
* Turn the message around, sending it in the opposite direction in
* the stream. To do this, the message is put onto the task next in
@@ -84,32 +103,40 @@ public: // Should be protected:
* completed.
*/
int reply (ACE_Message_Block *, ACE_Time_Value *timeout = 0);
+
/**
* Transfer message to the adjacent ACE_Task in a ACE_Stream. Note
* that @a timeout uses <{absolute}> time rather than <{relative}>
* time.
*/
int put_next (ACE_Message_Block *msg, ACE_Time_Value *timeout = 0);
+
/**
* Tests whether we can enqueue a message without blocking.
*
* @deprecated This method is deprecated and will go away in the future.
*/
int can_put (ACE_Message_Block *);
+
// = ACE_Task utility routines to identify names et al.
/// Return the name of the enclosing Module if there's one associated
/// with the Task, else returns 0.
const ACE_TCHAR *name (void) const;
+
// = Pointers to next ACE_Task_Base (if ACE is part of an ACE_Stream).
/// Get next Task pointer.
ACE_Task<ACE_SYNCH_USE> *next (void);
+
/// Set next Task pointer.
void next (ACE_Task<ACE_SYNCH_USE> *);
+
/// Return the Task's sibling if there's one associated with the
/// Task's Module, else returns 0.
ACE_Task<ACE_SYNCH_USE> *sibling (void);
+
/// Return the Task's Module if there is one, else returns 0.
ACE_Module<ACE_SYNCH_USE> *module (void) const;
+
/**
* Flush the task's queue, i.e., free all of the enqueued
* message blocks and unblocks any threads waiting on the queue.
@@ -117,40 +144,56 @@ public: // Should be protected:
* function, just rewrite the iostream function as ::<flush>.
*/
int flush (u_long flag = ACE_Task_Flags::ACE_FLUSHALL);
+
// = Special routines corresponding to certain message types.
+
/// Manipulate watermarks.
void water_marks (ACE_IO_Cntl_Msg::ACE_IO_Cntl_Cmds, size_t);
+
/// Queue of messages on the ACE_Task..
ACE_Message_Queue<ACE_SYNCH_USE> *msg_queue_;
+
/// true if should delete Message_Queue, false otherwise.
bool delete_msg_queue_;
+
/// Back-pointer to the enclosing module.
ACE_Module<ACE_SYNCH_USE> *mod_;
+
/// Pointer to adjacent ACE_Task.
ACE_Task<ACE_SYNCH_USE> *next_;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
+
// = Disallow these operations.
ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Task<ACE_SYNCH_USE> &))
ACE_UNIMPLEMENTED_FUNC (ACE_Task (const ACE_Task<ACE_SYNCH_USE> &))
};
+
#if defined ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT
template class ACE_Export ACE_Task<ACE_MT_SYNCH>;
template class ACE_Export ACE_Task<ACE_NULL_SYNCH>;
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Task_T.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Task_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Task_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
#endif /* ACE_TASK_T_H */
diff --git a/dep/ACE_wrappers/ace/Task_T.inl b/dep/ACE_wrappers/ace/Task_T.inl
index 4f84afb9644..a441ca9d0b3 100644
--- a/dep/ACE_wrappers/ace/Task_T.inl
+++ b/dep/ACE_wrappers/ace/Task_T.inl
@@ -1,7 +1,9 @@
// -*- C++ -*-
//
// $Id: Task_T.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template <ACE_SYNCH_DECL> ACE_INLINE void
ACE_Task<ACE_SYNCH_USE>::water_marks (ACE_IO_Cntl_Msg::ACE_IO_Cntl_Cmds cmd,
size_t wm_size)
@@ -12,30 +14,35 @@ ACE_Task<ACE_SYNCH_USE>::water_marks (ACE_IO_Cntl_Msg::ACE_IO_Cntl_Cmds cmd,
else /* cmd == ACE_IO_Cntl_Msg::SET_HWM */
this->msg_queue_->high_water_mark (wm_size);
}
+
template <ACE_SYNCH_DECL> ACE_INLINE int
ACE_Task<ACE_SYNCH_USE>::getq (ACE_Message_Block *&mb, ACE_Time_Value *tv)
{
ACE_TRACE ("ACE_Task<ACE_SYNCH_USE>::getq");
return this->msg_queue_->dequeue_head (mb, tv);
}
+
template <ACE_SYNCH_DECL> ACE_INLINE int
ACE_Task<ACE_SYNCH_USE>::can_put (ACE_Message_Block *)
{
ACE_TRACE ("ACE_Task<ACE_SYNCH_USE>::can_put");
ACE_NOTSUP_RETURN (-1);
}
+
template <ACE_SYNCH_DECL> ACE_INLINE int
ACE_Task<ACE_SYNCH_USE>::putq (ACE_Message_Block *mb, ACE_Time_Value *tv)
{
ACE_TRACE ("ACE_Task<ACE_SYNCH_USE>::putq");
return this->msg_queue_->enqueue_tail (mb, tv);
}
+
template <ACE_SYNCH_DECL> ACE_INLINE int
ACE_Task<ACE_SYNCH_USE>::ungetq (ACE_Message_Block *mb, ACE_Time_Value *tv)
{
ACE_TRACE ("ACE_Task<ACE_SYNCH_USE>::ungetq");
return this->msg_queue_->enqueue_head (mb, tv);
}
+
template <ACE_SYNCH_DECL> ACE_INLINE int
ACE_Task<ACE_SYNCH_USE>::flush (u_long flag)
{
@@ -45,6 +52,7 @@ ACE_Task<ACE_SYNCH_USE>::flush (u_long flag)
else
return -1; // Note, need to be more careful about what we free...
}
+
template <ACE_SYNCH_DECL> ACE_INLINE void
ACE_Task<ACE_SYNCH_USE>::msg_queue (ACE_Message_Queue<ACE_SYNCH_USE> *mq)
{
@@ -56,35 +64,42 @@ ACE_Task<ACE_SYNCH_USE>::msg_queue (ACE_Message_Queue<ACE_SYNCH_USE> *mq)
}
this->msg_queue_ = mq;
}
+
template <ACE_SYNCH_DECL> ACE_Message_Queue<ACE_SYNCH_USE> *
ACE_Task<ACE_SYNCH_USE>::msg_queue (void)
{
ACE_TRACE ("ACE_Task<ACE_SYNCH_USE>::msg_queue");
return this->msg_queue_;
}
+
template <ACE_SYNCH_DECL> ACE_INLINE int
ACE_Task<ACE_SYNCH_USE>::reply (ACE_Message_Block *mb, ACE_Time_Value *tv)
{
ACE_TRACE ("ACE_Task<ACE_SYNCH_USE>::reply");
return this->sibling ()->put_next (mb, tv);
}
+
template <ACE_SYNCH_DECL> ACE_INLINE ACE_Task<ACE_SYNCH_USE> *
ACE_Task<ACE_SYNCH_USE>::next (void)
{
ACE_TRACE ("ACE_Task<ACE_SYNCH_USE>::next");
return this->next_;
}
+
template <ACE_SYNCH_DECL> ACE_INLINE void
ACE_Task<ACE_SYNCH_USE>::next (ACE_Task<ACE_SYNCH_USE> *q)
{
ACE_TRACE ("ACE_Task<ACE_SYNCH_USE>::next");
this->next_ = q;
}
+
// Transfer msg to the next ACE_Task.
+
template <ACE_SYNCH_DECL> ACE_INLINE int
ACE_Task<ACE_SYNCH_USE>::put_next (ACE_Message_Block *msg, ACE_Time_Value *tv)
{
ACE_TRACE ("ACE_Task<ACE_SYNCH_USE>::put_next");
return this->next_ == 0 ? -1 : this->next_->put (msg, tv);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Test_and_Set.h b/dep/ACE_wrappers/ace/Test_and_Set.h
index c6cdc65300c..e31d10f5460 100644
--- a/dep/ACE_wrappers/ace/Test_and_Set.h
+++ b/dep/ACE_wrappers/ace/Test_and_Set.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Test_and_Set.h
@@ -7,14 +8,19 @@
*/
//=============================================================================
+
#ifndef ACE_TEST_AND_SET_H
#define ACE_TEST_AND_SET_H
+
#include /**/ "ace/pre.h"
#include "ace/Event_Handler.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Test_and_Set
*
@@ -33,29 +39,38 @@ class ACE_Test_and_Set : public ACE_Event_Handler
{
public:
ACE_Test_and_Set (TYPE initial_value = 0);
+
/// Returns true if we are set, else false.
TYPE is_set (void) const;
+
/// Sets the <is_set_> status, returning the original value of
/// <is_set_>.
TYPE set (TYPE);
+
/// Called when object is signaled by OS (either via UNIX signals or
/// when a Win32 object becomes signaled).
virtual int handle_signal (int signum,
siginfo_t * = 0,
ucontext_t * = 0);
+
private:
/// Keeps track of our state.
TYPE is_set_;
+
/// Protect the state from race conditions.
ACE_LOCK lock_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Test_and_Set.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Test_and_Set.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
#endif /* ACE_TEST_AND_SET_H */
diff --git a/dep/ACE_wrappers/ace/Thread.cpp b/dep/ACE_wrappers/ace/Thread.cpp
index 29bd6d59584..1b4edd48825 100644
--- a/dep/ACE_wrappers/ace/Thread.cpp
+++ b/dep/ACE_wrappers/ace/Thread.cpp
@@ -1,13 +1,19 @@
// $Id: Thread.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Thread.h"
+
ACE_RCSID(ace,
Thread,
"$Id: Thread.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if !defined (__ACE_INLINE__)
#include "ace/Thread.inl"
#endif /* !defined (__ACE_INLINE__) */
+
#if defined (ACE_HAS_THREADS)
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
size_t
ACE_Thread::spawn_n (size_t n,
ACE_THR_FUNC func,
@@ -22,6 +28,7 @@ ACE_Thread::spawn_n (size_t n,
ACE_TRACE ("ACE_Thread::spawn_n");
ACE_thread_t t_id;
size_t i;
+
for (i = 0; i < n; i++)
// Bail out if error occurs.
if (ACE_OS::thr_create (func,
@@ -35,8 +42,10 @@ ACE_Thread::spawn_n (size_t n,
thread_adapter,
thr_name == 0 ? 0 : &thr_name[i]) != 0)
break;
+
return i;
}
+
size_t
ACE_Thread::spawn_n (ACE_thread_t thread_ids[],
size_t n,
@@ -52,10 +61,12 @@ ACE_Thread::spawn_n (ACE_thread_t thread_ids[],
{
ACE_TRACE ("ACE_Thread::spawn_n");
size_t i = 0;
+
for (i = 0; i < n; i++)
{
ACE_thread_t t_id;
ACE_hthread_t t_handle;
+
int const result =
ACE_OS::thr_create (func,
arg,
@@ -67,6 +78,7 @@ ACE_Thread::spawn_n (ACE_thread_t thread_ids[],
stack_size == 0 ? ACE_DEFAULT_THREAD_STACKSIZE : stack_size[i],
thread_adapter,
thr_name == 0 ? 0 : &thr_name[i]);
+
if (result == 0)
{
if (thread_ids != 0)
@@ -78,8 +90,11 @@ ACE_Thread::spawn_n (ACE_thread_t thread_ids[],
// Bail out if error occurs.
break;
}
+
return i;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_THREADS */
diff --git a/dep/ACE_wrappers/ace/Thread.h b/dep/ACE_wrappers/ace/Thread.h
index 72d6bf33406..6be139f9242 100644
--- a/dep/ACE_wrappers/ace/Thread.h
+++ b/dep/ACE_wrappers/ace/Thread.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file Thread.h
@@ -8,24 +9,33 @@
* @author Douglas Schmidt <schmidt@cs.wustl.edu>
*/
//==========================================================================
+
#ifndef ACE_THREAD_H
#define ACE_THREAD_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/OS_NS_Thread.h"
#include "ace/Thread_Adapter.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
struct cancel_state
{
/// e.g., PTHREAD_CANCEL_ENABLE, PTHREAD_CANCEL_DISABLE,
/// PTHREAD_CANCELED.
int cancelstate;
+
/// e.g., PTHREAD_CANCEL_DEFERRED and PTHREAD_CANCEL_ASYNCHRONOUS.
int canceltype;
};
+
/**
* @class ACE_Thread
*
@@ -81,6 +91,7 @@ public:
size_t stack_size = ACE_DEFAULT_THREAD_STACKSIZE,
ACE_Thread_Adapter *thread_adapter = 0,
const char** thr_name = 0);
+
/**
* Spawn N new threads, which execute @a func with argument @a arg (if
* @a thread_adapter is non-0 then @a func and @a args are ignored and
@@ -104,6 +115,7 @@ public:
size_t stack_size[] = 0,
ACE_Thread_Adapter *thread_adapter = 0,
const char* thr_name[] = 0);
+
/**
* Spawn @a n new threads, which execute @a func with argument @a arg
* (if @a thread_adapter is non-0 then @a func and @a args are ignored
@@ -133,6 +145,7 @@ public:
ACE_hthread_t thread_handles[] = 0,
ACE_Thread_Adapter *thread_adapter = 0,
const char* thr_name[] = 0);
+
/**
* Wait for one or more threads to exit and reap their exit status.
* thr_join() returns successfully when the target thread terminates.
@@ -154,23 +167,32 @@ public:
static int join (ACE_thread_t thread_id,
ACE_thread_t *departed,
ACE_THR_FUNC_RETURN *status);
+
/// Wait for one thread to exit and reap its exit status.
static int join (ACE_hthread_t,
ACE_THR_FUNC_RETURN * = 0);
+
/// Continue the execution of a previously suspended thread.
static int resume (ACE_hthread_t);
+
/// Suspend the execution of a particular thread.
static int suspend (ACE_hthread_t);
+
/// Get the priority of a particular thread.
static int getprio (ACE_hthread_t ht_id, int &priority);
+
/// Get the priority and policy of a particular thread.
static int getprio (ACE_hthread_t ht_id, int &priority, int &policy);
+
/// Set the priority of a particular thread.
static int setprio (ACE_hthread_t ht_id, int priority, int policy = -1);
+
/// Send a signal to the thread.
static int kill (ACE_thread_t, int signum);
+
/// Yield the thread to another.
static void yield (void);
+
/**
* Return the unique kernel handle of the thread. Note that on
* Win32 this is actually a pseudohandle, which cannot be shared
@@ -178,19 +200,25 @@ public:
* handle, please use the ACE_Thread_Manager::thr_self() method.
*/
static void self (ACE_hthread_t &t_handle);
+
/// Return the unique ID of the thread.
static ACE_thread_t self (void);
+
/// Exit the current thread and return "status".
/// Should _not_ be called by main thread.
static void exit (ACE_THR_FUNC_RETURN status = 0);
+
/// Get the LWP concurrency level of the process.
static int getconcurrency (void);
+
/// Set the LWP concurrency level of the process.
static int setconcurrency (int new_level);
+
/// Change and/or examine calling thread's signal mask.
static int sigsetmask (int how,
const sigset_t *sigset,
sigset_t *osigset = 0);
+
/**
* Allocates a @a keyp that is used to identify data that is specific
* to each thread in the process. The key is global to all threads
@@ -203,40 +231,53 @@ public:
ACE_THR_DEST destructor,
#endif /* ACE_HAS_THR_C_DEST */
void * = 0);
+
/// Free up the key so that other threads can reuse it.
static int keyfree (ACE_thread_key_t key);
+
/// Bind value to the thread-specific data key, @a key, for the calling
/// thread.
static int setspecific (ACE_thread_key_t key,
void *value);
+
/// Stores the current value bound to @a key for the calling thread
/// into the location pointed to by @a valuep.
static int getspecific (ACE_thread_key_t key,
void **valuep);
+
/// Disable thread cancellation.
static int disablecancel (struct cancel_state *old_state);
+
/// Enable thread cancellation.
static int enablecancel (struct cancel_state *old_state,
int flag);
+
/// Set the cancellation state.
static int setcancelstate (struct cancel_state &new_state,
struct cancel_state *old_state);
+
/**
* Cancel a thread.
* @note This method is only portable on platforms, such as POSIX pthreads,
* that support thread cancellation.
*/
static int cancel (ACE_thread_t t_id);
+
/// Test the cancel.
static void testcancel (void);
+
private:
/// Ensure that we don't get instantiated.
ACE_Thread (void);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Thread.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_THREAD_H */
diff --git a/dep/ACE_wrappers/ace/Thread.inl b/dep/ACE_wrappers/ace/Thread.inl
index d923c2b4bb8..87e47e13580 100644
--- a/dep/ACE_wrappers/ace/Thread.inl
+++ b/dep/ACE_wrappers/ace/Thread.inl
@@ -1,11 +1,15 @@
// -*- C++ -*-
//
// $Id: Thread.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_string.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Allocates a <keyp> that is used to identify data that is specific
// to each thread in the process. The key is global to all threads in
// the process.
+
ACE_INLINE int
ACE_Thread::keycreate (ACE_thread_key_t *keyp,
#if defined (ACE_HAS_THR_C_DEST)
@@ -18,47 +22,57 @@ ACE_Thread::keycreate (ACE_thread_key_t *keyp,
// ACE_TRACE ("ACE_Thread::keycreate");
return ACE_OS::thr_keycreate (keyp, destructor, inst);
}
+
// Free up the key so that other threads can reuse it.
+
ACE_INLINE int
ACE_Thread::keyfree (ACE_thread_key_t key)
{
ACE_TRACE ("ACE_Thread::keyfree");
return ACE_OS::thr_keyfree (key);
}
+
// Bind value to the thread-specific data key, <key>, for the calling
// thread.
+
ACE_INLINE int
ACE_Thread::setspecific (ACE_thread_key_t key, void *value)
{
// ACE_TRACE ("ACE_Thread::setspecific");
return ACE_OS::thr_setspecific (key, value);
}
+
// Stores the current value bound to <key> for the calling thread
// into the location pointed to by <valuep>.
+
ACE_INLINE int
ACE_Thread::getspecific (ACE_thread_key_t key, void **valuep)
{
// ACE_TRACE ("ACE_Thread::getspecific");
return ACE_OS::thr_getspecific (key, valuep);
}
+
ACE_INLINE ACE_thread_t
ACE_Thread::self (void)
{
// ACE_TRACE ("ACE_Thread::self");
return ACE_OS::thr_self ();
}
+
ACE_INLINE void
ACE_Thread::exit (ACE_THR_FUNC_RETURN status)
{
ACE_TRACE ("ACE_Thread::exit");
ACE_OS::thr_exit (status);
}
+
ACE_INLINE void
ACE_Thread::yield (void)
{
ACE_TRACE ("ACE_Thread::yield");
ACE_OS::thr_yield ();
}
+
ACE_INLINE int
ACE_Thread::spawn (ACE_THR_FUNC func,
void *arg,
@@ -72,6 +86,7 @@ ACE_Thread::spawn (ACE_THR_FUNC func,
const char** thr_name)
{
ACE_TRACE ("ACE_Thread::spawn");
+
return ACE_OS::thr_create (func,
arg,
flags,
@@ -83,24 +98,28 @@ ACE_Thread::spawn (ACE_THR_FUNC func,
thread_adapter,
thr_name);
}
+
ACE_INLINE int
ACE_Thread::resume (ACE_hthread_t t_id)
{
ACE_TRACE ("ACE_Thread::resume");
return ACE_OS::thr_continue (t_id);
}
+
ACE_INLINE int
ACE_Thread::suspend (ACE_hthread_t t_id)
{
ACE_TRACE ("ACE_Thread::suspend");
return ACE_OS::thr_suspend (t_id);
}
+
ACE_INLINE int
ACE_Thread::kill (ACE_thread_t t_id, int signum)
{
ACE_TRACE ("ACE_Thread::kill");
return ACE_OS::thr_kill (t_id, signum);
}
+
ACE_INLINE int
ACE_Thread::join (ACE_thread_t wait_for,
ACE_thread_t *departed,
@@ -109,6 +128,7 @@ ACE_Thread::join (ACE_thread_t wait_for,
ACE_TRACE ("ACE_Thread::join");
return ACE_OS::thr_join (wait_for, departed, status);
}
+
ACE_INLINE int
ACE_Thread::join (ACE_hthread_t wait_for,
ACE_THR_FUNC_RETURN *status)
@@ -116,18 +136,21 @@ ACE_Thread::join (ACE_hthread_t wait_for,
ACE_TRACE ("ACE_Thread::join");
return ACE_OS::thr_join (wait_for, status);
}
+
ACE_INLINE int
ACE_Thread::getconcurrency (void)
{
ACE_TRACE ("ACE_Thread::getconcurrency");
return ACE_OS::thr_getconcurrency ();
}
+
ACE_INLINE int
ACE_Thread::setconcurrency (int new_level)
{
ACE_TRACE ("ACE_Thread::setconcurrency");
return ACE_OS::thr_setconcurrency (new_level);
}
+
ACE_INLINE int
ACE_Thread::sigsetmask (int how,
const sigset_t *sigset,
@@ -136,6 +159,7 @@ ACE_Thread::sigsetmask (int how,
ACE_TRACE ("ACE_Thread::sigsetmask");
return ACE_OS::thr_sigsetmask (how, sigset, osigset);
}
+
ACE_INLINE int
ACE_Thread::disablecancel (struct cancel_state *old_state)
{
@@ -150,8 +174,10 @@ ACE_Thread::disablecancel (struct cancel_state *old_state)
sizeof (old_state));
old_state->cancelstate = old_cstate;
}
+
return result;
}
+
ACE_INLINE int
ACE_Thread::enablecancel (struct cancel_state *old_state,
int flag)
@@ -160,21 +186,26 @@ ACE_Thread::enablecancel (struct cancel_state *old_state,
int old_cstate = 0;
int old_ctype = 0;
int result;
+
result = ACE_OS::thr_setcancelstate (THR_CANCEL_ENABLE,
&old_cstate);
if (result != 0)
return result;
+
result = ACE_OS::thr_setcanceltype (flag,
&old_ctype);
if (result != 0)
return result;
+
if (old_state != 0)
{
old_state->cancelstate = old_cstate;
old_state->canceltype = old_ctype;
}
+
return 0;
}
+
ACE_INLINE int
ACE_Thread::setcancelstate (struct cancel_state &new_state,
struct cancel_state *old_state)
@@ -182,60 +213,74 @@ ACE_Thread::setcancelstate (struct cancel_state &new_state,
ACE_TRACE ("ACE_Thread::setcancelstate");
int old_cstate = 0;
int old_ctype = 0;
+
if (new_state.cancelstate != 0
&& ACE_OS::thr_setcancelstate (new_state.cancelstate,
&old_cstate) != 0)
return -1;
+
if (new_state.canceltype != 0
&& ACE_OS::thr_setcanceltype (new_state.canceltype,
&old_ctype) != 0)
{
int o_cstate;
+
ACE_OS::thr_setcancelstate (old_cstate,
&o_cstate);
return -1;
}
+
if (old_state != 0)
{
old_state->cancelstate = old_cstate;
old_state->canceltype = old_ctype;
}
+
return 0;
}
+
ACE_INLINE int
ACE_Thread::cancel (ACE_thread_t t_id)
{
ACE_TRACE ("ACE_Thread::cancel");
+
return ACE_OS::thr_cancel (t_id);
}
+
ACE_INLINE void
ACE_Thread::testcancel (void)
{
ACE_TRACE ("ACE_Thread::testcancel");
+
ACE_OS::thr_testcancel ();
}
+
ACE_INLINE void
ACE_Thread::self (ACE_hthread_t &t_id)
{
// ACE_TRACE ("ACE_Thread::self");
ACE_OS::thr_self (t_id);
}
+
ACE_INLINE int
ACE_Thread::getprio (ACE_hthread_t ht_id, int &priority)
{
ACE_TRACE ("ACE_Thread::getprio");
return ACE_OS::thr_getprio (ht_id, priority);
}
+
ACE_INLINE int
ACE_Thread::getprio (ACE_hthread_t ht_id, int &priority, int &policy)
{
ACE_TRACE ("ACE_Thread::getprio");
return ACE_OS::thr_getprio (ht_id, priority, policy);
}
+
ACE_INLINE int
ACE_Thread::setprio (ACE_hthread_t ht_id, int priority, int policy)
{
ACE_TRACE ("ACE_Thread::setprio");
return ACE_OS::thr_setprio (ht_id, priority, policy);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Thread_Adapter.cpp b/dep/ACE_wrappers/ace/Thread_Adapter.cpp
index f4555e00136..e9defa34e88 100644
--- a/dep/ACE_wrappers/ace/Thread_Adapter.cpp
+++ b/dep/ACE_wrappers/ace/Thread_Adapter.cpp
@@ -1,17 +1,22 @@
// $Id: Thread_Adapter.cpp 81239 2008-04-04 22:28:48Z iliyan $
+
#include "ace/Thread_Adapter.h"
#include "ace/Thread_Manager.h"
#include "ace/Thread_Exit.h"
#include "ace/Thread_Hook.h"
#include "ace/Object_Manager_Base.h"
#include "ace/Service_Config.h"
+
ACE_RCSID (ace,
Thread_Adapter,
"$Id: Thread_Adapter.cpp 81239 2008-04-04 22:28:48Z iliyan $")
+
#if !defined (ACE_HAS_INLINED_OSCALLS)
# include "ace/Thread_Adapter.inl"
#endif /* ACE_HAS_INLINED_OSCALLS */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_Thread_Adapter::ACE_Thread_Adapter (ACE_THR_FUNC user_func,
void *arg,
ACE_THR_C_FUNC entry_point,
@@ -36,16 +41,20 @@ ACE_Thread_Adapter::ACE_Thread_Adapter (ACE_THR_FUNC user_func,
{
ACE_OS_TRACE ("ACE_Thread_Adapter::ACE_Thread_Adapter");
}
+
ACE_Thread_Adapter::~ACE_Thread_Adapter (void)
{
}
+
ACE_THR_FUNC_RETURN
ACE_Thread_Adapter::invoke (void)
{
// Inherit the logging features if the parent thread has an
// ACE_Log_Msg instance in thread-specific storage.
this->inherit_log_msg ();
+
ACE_Service_Config::current (ACE_Service_Config::global());
+
#if !defined(ACE_USE_THREAD_MANAGER_ADAPTER)
// NOTE: this preprocessor directive should match the one in above
// ACE_Thread_Exit::instance (). With the Xavier Pthreads package,
@@ -56,14 +65,17 @@ ACE_Thread_Adapter::invoke (void)
// how to clean us up! Note that we never use this pointer directly
// (it's stored in thread-specific storage), so it's ok to
// dereference it here and only store it as a reference.
+
// Except if it is null, then the thr_mgr() method crashes.
// -jxh
+
ACE_Thread_Exit *exit_hook_instance = ACE_Thread_Exit::instance ();
ACE_Thread_Exit_Maybe exit_hook_maybe (exit_hook_instance == 0);
ACE_Thread_Exit *exit_hook_ptr = exit_hook_instance
? exit_hook_instance
: exit_hook_maybe.instance ();
ACE_Thread_Exit &exit_hook = *exit_hook_ptr;
+
if (this->thr_mgr () != 0)
{
// Keep track of the <Thread_Manager> that's associated with this
@@ -80,21 +92,27 @@ ACE_Thread_Adapter::invoke (void)
ACE_Thread_Exit exit_hook;
exit_hook.thr_mgr (this->thr_mgr ());
# endif /* ACE_HAS_THREAD_SPECIFIC_STORAGE || ACE_HAS_TSS_EMULATION */
+
#endif /* ! ACE_USE_THREAD_MANAGER_ADAPTER */
+
return this->invoke_i ();
}
+
ACE_THR_FUNC_RETURN
ACE_Thread_Adapter::invoke_i (void)
{
// Extract the arguments.
ACE_THR_FUNC func = reinterpret_cast<ACE_THR_FUNC> (this->user_func_);
void *arg = this->arg_;
+
#if defined (ACE_WIN32) && defined (ACE_HAS_MFC) && (ACE_HAS_MFC != 0)
ACE_OS_Thread_Descriptor *thr_desc = this->thr_desc_;
#endif /* ACE_WIN32 && ACE_HAS_MFC && (ACE_HAS_MFC != 0) */
+
// Delete ourselves since we don't need <this> anymore. Make sure
// not to access <this> anywhere below this point.
delete this;
+
#if defined (ACE_NEEDS_LWP_PRIO_SET)
// On SunOS, the LWP priority needs to be set in order to get
// preemption when running in the RT class. This is the ACE way to
@@ -102,19 +120,25 @@ ACE_Thread_Adapter::invoke_i (void)
ACE_hthread_t thr_handle;
ACE_OS::thr_self (thr_handle);
int prio;
+
// thr_getprio () on the current thread should never fail.
ACE_OS::thr_getprio (thr_handle, prio);
+
// ACE_OS::thr_setprio () has the special logic to set the LWP priority,
// if running in the RT class.
ACE_OS::thr_setprio (prio);
+
#endif /* ACE_NEEDS_LWP_PRIO_SET */
+
ACE_THR_FUNC_RETURN status = 0;
+
ACE_SEH_TRY
{
ACE_SEH_TRY
{
ACE_Thread_Hook *hook =
ACE_OS_Object_Manager::thread_hook ();
+
if (hook)
// Invoke the start hook to give the user a chance to
// perform some initialization processing before the
@@ -124,6 +148,7 @@ ACE_Thread_Adapter::invoke_i (void)
// Call thread entry point.
status = (*func) (arg);
}
+
#if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS)
ACE_SEH_EXCEPT (ACE_OS_Object_Manager::seh_except_selector ()(
(void *) GetExceptionInformation ()))
@@ -132,6 +157,7 @@ ACE_Thread_Adapter::invoke_i (void)
}
#endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */
}
+
ACE_SEH_FINALLY
{
// If we changed this to 1, change the respective if in
@@ -143,13 +169,16 @@ ACE_Thread_Adapter::invoke_i (void)
{
ACE_Task_Base *task_ptr = (ACE_Task_Base *) arg;
ACE_Thread_Manager *thr_mgr_ptr = task_ptr->thr_mgr ();
+
// This calls the Task->close () hook.
task_ptr->cleanup (task_ptr, 0);
+
// This prevents a second invocation of the cleanup code
// (called later by <ACE_Thread_Manager::exit>.
thr_mgr_ptr->at_exit (task_ptr, 0, 0);
}
#endif /* 0 */
+
#if defined (ACE_WIN32) || defined (ACE_HAS_TSS_EMULATION)
# if defined (ACE_WIN32) && defined (ACE_HAS_MFC) && (ACE_HAS_MFC != 0)
int using_afx = -1;
@@ -158,6 +187,7 @@ ACE_Thread_Adapter::invoke_i (void)
# endif /* ACE_WIN32 && ACE_HAS_MFC && (ACE_HAS_MFC != 0) */
// Call TSS destructors.
ACE_OS::cleanup_tss (0 /* not main thread */);
+
# if defined (ACE_WIN32)
// Exit the thread. Allow CWinThread-destructor to be invoked
// from AfxEndThread. _endthreadex will be called from
@@ -178,18 +208,22 @@ ACE_Thread_Adapter::invoke_i (void)
// ACE_Thread_Manager to spawn threads. The following code
// is know to cause some problem.
CWinThread *pThread = ::AfxGetThread ();
+
if (!pThread || pThread->m_nThreadID != ACE_OS::thr_self ())
ACE_ENDTHREADEX (status);
else
::AfxEndThread ((DWORD)status);
}
# else
+
ACE_ENDTHREADEX (status);
# endif /* ACE_HAS_MFC && ACE_HAS_MFS != 0*/
# endif /* ACE_WIN32 */
#endif /* ACE_WIN32 || ACE_HAS_TSS_EMULATION */
}
+
return status;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Thread_Adapter.h b/dep/ACE_wrappers/ace/Thread_Adapter.h
index 006cb590cee..015557b8e0d 100644
--- a/dep/ACE_wrappers/ace/Thread_Adapter.h
+++ b/dep/ACE_wrappers/ace/Thread_Adapter.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Thread_Adapter.h
@@ -8,18 +9,25 @@
* @author Carlos O'Ryan <coryan@uci.edu>
*/
//=============================================================================
+
#ifndef ACE_THREAD_ADAPTER_H
#define ACE_THREAD_ADAPTER_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Base_Thread_Adapter.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward decl.
class ACE_Thread_Manager;
class ACE_Thread_Descriptor;
+
/**
* @class ACE_Thread_Adapter
*
@@ -49,26 +57,37 @@ public:
ACE_SEH_EXCEPT_HANDLER handler = 0
# endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */
);
+
/**
* Execute the <user_func_> with the <arg>. This function deletes
* @c this, thereby rendering the object useless after the call
* returns.
*/
virtual ACE_THR_FUNC_RETURN invoke (void);
+
/// Accessor for the optional ACE_Thread_Manager.
ACE_Thread_Manager *thr_mgr (void);
+
protected:
+
/// Ensure that this object must be allocated on the heap.
~ACE_Thread_Adapter (void);
+
private:
+
/// Called by invoke, mainly here to separate the SEH stuff because
/// SEH on Win32 doesn't compile with local vars with destructors.
virtual ACE_THR_FUNC_RETURN invoke_i (void);
+
private:
+
/// Optional thread manager.
ACE_Thread_Manager *thr_mgr_;
+
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# if defined (ACE_HAS_INLINED_OSCALLS)
# if defined (ACE_INLINE)
# undef ACE_INLINE
@@ -76,6 +95,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_INLINE inline
# include "ace/Thread_Adapter.inl"
# endif /* ACE_HAS_INLINED_OSCALLS */
+
#include /**/ "ace/post.h"
#endif /* ACE_THREAD_ADAPTER_H */
diff --git a/dep/ACE_wrappers/ace/Thread_Adapter.inl b/dep/ACE_wrappers/ace/Thread_Adapter.inl
index daac89d0730..6def13be5ab 100644
--- a/dep/ACE_wrappers/ace/Thread_Adapter.inl
+++ b/dep/ACE_wrappers/ace/Thread_Adapter.inl
@@ -1,10 +1,13 @@
// -*- C++ -*-
//
// $Id: Thread_Adapter.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE ACE_Thread_Manager *
ACE_Thread_Adapter::thr_mgr (void)
{
return this->thr_mgr_;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Thread_Control.cpp b/dep/ACE_wrappers/ace/Thread_Control.cpp
index 5db7a8b29c2..c97f4eef58b 100644
--- a/dep/ACE_wrappers/ace/Thread_Control.cpp
+++ b/dep/ACE_wrappers/ace/Thread_Control.cpp
@@ -1,4 +1,5 @@
// $Id: Thread_Control.cpp 80826 2008-03-04 14:51:23Z wotte $
+
// <HACK ON>
#include "ace/config-all.h"
#if defined (ACE_LEGACY_MODE)
@@ -7,13 +8,18 @@
# include "ace/Thread_Exit.h"
#endif /* ACE_LEGACY_MODE */
// </HACK OFF>
+
#include "ace/Thread_Control.h"
#include "ace/Thread_Manager.h"
+
ACE_RCSID(ace, Thread_Control, "$Id: Thread_Control.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if !defined (ACE_HAS_INLINED_OSCALLS)
# include "ace/Thread_Control.inl"
#endif /* ACE_HAS_INLINED_OSCALLS */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
void
ACE_Thread_Control::dump (void) const
{
@@ -21,25 +27,31 @@ ACE_Thread_Control::dump (void) const
ACE_OS_TRACE ("ACE_Thread_Control::dump");
#endif /* ACE_HAS_DUMP */
}
+
int
ACE_Thread_Control::insert (ACE_Thread_Manager *tm, int insert)
{
ACE_OS_TRACE ("ACE_Thread_Control::insert");
+
ACE_hthread_t t_id;
ACE_OS::thr_self (t_id);
this->tm_ = tm;
+
if (insert)
return this->tm_->insert_thr (ACE_OS::thr_self (), t_id);
else
return 0;
}
+
// Initialize the thread controller.
+
ACE_Thread_Control::ACE_Thread_Control (ACE_Thread_Manager *t,
int insert)
: tm_ (t),
status_ (0)
{
ACE_OS_TRACE ("ACE_Thread_Control::ACE_Thread_Control");
+
if (this->tm_ != 0 && insert)
{
ACE_hthread_t t_id;
@@ -47,21 +59,27 @@ ACE_Thread_Control::ACE_Thread_Control (ACE_Thread_Manager *t,
this->tm_->insert_thr (ACE_OS::thr_self (), t_id);
}
}
+
// Automatically kill thread on exit.
+
ACE_Thread_Control::~ACE_Thread_Control (void)
{
ACE_OS_TRACE ("ACE_Thread_Control::~ACE_Thread_Control");
+
#if defined (ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS) || defined (ACE_HAS_TSS_EMULATION) || defined (ACE_WIN32)
this->exit (this->status_, 0);
#else
this->exit (this->status_, 1);
#endif /* ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS */
}
+
// Exit from thread (but clean up first).
+
ACE_THR_FUNC_RETURN
ACE_Thread_Control::exit (ACE_THR_FUNC_RETURN exit_status, int do_thr_exit)
{
ACE_OS_TRACE ("ACE_Thread_Control::exit");
+
if (this->tm_ != 0)
return this->tm_->exit (exit_status, do_thr_exit);
else
@@ -74,5 +92,6 @@ ACE_Thread_Control::exit (ACE_THR_FUNC_RETURN exit_status, int do_thr_exit)
return 0;
}
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Thread_Control.h b/dep/ACE_wrappers/ace/Thread_Control.h
index 1614b49384d..8322e73a968 100644
--- a/dep/ACE_wrappers/ace/Thread_Control.h
+++ b/dep/ACE_wrappers/ace/Thread_Control.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Thread_Control.h
@@ -9,15 +10,21 @@
*/
//=============================================================================
+
#ifndef ACE_THREAD_CONTROL_H
#define ACE_THREAD_CONTROL_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Thread_Manager;
+
/**
* @class ACE_Thread_Control
*
@@ -40,36 +47,49 @@ public:
/// register the thread with the Thread_Manager.
ACE_Thread_Control (ACE_Thread_Manager *tm = 0,
int insert = 0);
+
/// Remove the thread from its associated <Thread_Manager> and exit
/// the thread if <do_thr_exit> is enabled.
~ACE_Thread_Control (void);
+
/// Remove this thread from its associated ACE_Thread_Manager and exit
/// the thread if @a do_thr_exit is enabled.
ACE_THR_FUNC_RETURN exit (ACE_THR_FUNC_RETURN status,
int do_thr_exit);
+
/// Store the <Thread_Manager> and use it to register ourselves for
/// correct shutdown.
int insert (ACE_Thread_Manager *tm, int insert = 0);
+
/// Returns the current <Thread_Manager>.
ACE_Thread_Manager *thr_mgr (void);
+
/// Atomically set a new <Thread_Manager> and return the old
/// <Thread_Manager>.
ACE_Thread_Manager *thr_mgr (ACE_Thread_Manager *);
+
/// Set the exit status (and return existing status).
ACE_THR_FUNC_RETURN status (ACE_THR_FUNC_RETURN status);
+
/// Get the current exit status.
ACE_THR_FUNC_RETURN status (void);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Pointer to the thread manager for this block of code.
ACE_Thread_Manager *tm_;
+
/// Keeps track of the exit status for the thread.
ACE_THR_FUNC_RETURN status_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
# if defined (ACE_HAS_INLINED_OSCALLS)
# if defined (ACE_INLINE)
# undef ACE_INLINE
@@ -77,6 +97,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_INLINE inline
# include "ace/Thread_Control.inl"
# endif /* ACE_HAS_INLINED_OSCALLS */
+
#include /**/ "ace/post.h"
#endif /* ACE_THREAD_CONTROL_H */
diff --git a/dep/ACE_wrappers/ace/Thread_Control.inl b/dep/ACE_wrappers/ace/Thread_Control.inl
index 5d55d171c58..6ebd3ac2c56 100644
--- a/dep/ACE_wrappers/ace/Thread_Control.inl
+++ b/dep/ACE_wrappers/ace/Thread_Control.inl
@@ -1,30 +1,39 @@
// -*- C++ -*-
//
// $Id: Thread_Control.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Set the exit status.
+
ACE_INLINE ACE_THR_FUNC_RETURN
ACE_Thread_Control::status (ACE_THR_FUNC_RETURN s)
{
ACE_OS_TRACE ("ACE_Thread_Control::status");
return this->status_ = s;
}
+
// Get the exit status.
+
ACE_INLINE ACE_THR_FUNC_RETURN
ACE_Thread_Control::status (void)
{
ACE_OS_TRACE ("ACE_Thread_Control::status");
return this->status_;
}
+
// Returns the current <Thread_Manager>.
+
ACE_INLINE ACE_Thread_Manager *
ACE_Thread_Control::thr_mgr (void)
{
ACE_OS_TRACE ("ACE_Thread_Control::thr_mgr");
return this->tm_;
}
+
// Atomically set a new <Thread_Manager> and return the old
// <Thread_Manager>.
+
ACE_INLINE ACE_Thread_Manager *
ACE_Thread_Control::thr_mgr (ACE_Thread_Manager *tm)
{
@@ -33,4 +42,5 @@ ACE_Thread_Control::thr_mgr (ACE_Thread_Manager *tm)
this->tm_ = tm;
return o_tm;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Thread_Exit.cpp b/dep/ACE_wrappers/ace/Thread_Exit.cpp
index d1d358d417d..ac7f09fb66c 100644
--- a/dep/ACE_wrappers/ace/Thread_Exit.cpp
+++ b/dep/ACE_wrappers/ace/Thread_Exit.cpp
@@ -1,74 +1,99 @@
// $Id: Thread_Exit.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Thread_Exit.h"
#include "ace/Managed_Object.h"
#include "ace/Thread_Manager.h"
#include "ace/Guard_T.h"
+
ACE_RCSID(ace, Thread_Exit, "$Id: Thread_Exit.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
bool ACE_Thread_Exit::is_constructed_ = false;
+
void
ACE_Thread_Exit::cleanup (void *instance)
{
ACE_OS_TRACE ("ACE_Thread_Exit::cleanup");
+
delete (ACE_TSS_TYPE (ACE_Thread_Exit) *) instance;
+
// Set the thr_exit_ static to null to keep things from crashing if
// ACE::fini() is enabled here.
ACE_Thread_Manager::thr_exit_ = 0;
+
ACE_Thread_Exit::is_constructed_ = false;
// All TSS objects have been destroyed. Reset this flag so
// ACE_Thread_Exit singleton can be created again.
}
+
// NOTE: this preprocessor directive should match the one in
// ACE_Task_Base::svc_run () below. This prevents the two statics
// from being defined.
+
ACE_Thread_Exit *
ACE_Thread_Exit::instance (void)
{
#if defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION)
ACE_OS_TRACE ("ACE_Thread_Exit::instance");
+
// Determines if we were dynamically allocated.
static ACE_TSS_TYPE (ACE_Thread_Exit) * volatile instance_;
+
// Implement the Double Check pattern.
+
if (!ACE_Thread_Exit::is_constructed_)
{
ACE_MT (ACE_Thread_Mutex *lock =
ACE_Managed_Object<ACE_Thread_Mutex>::get_preallocated_object
(ACE_Object_Manager::ACE_THREAD_EXIT_LOCK);
ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, *lock, 0));
+
if (!ACE_Thread_Exit::is_constructed_)
{
ACE_NEW_RETURN (instance_,
ACE_TSS_TYPE (ACE_Thread_Exit),
0);
+
ACE_Thread_Exit::is_constructed_ = true;
+
ACE_Thread_Manager::set_thr_exit (instance_);
}
}
+
return ACE_TSS_GET (instance_, ACE_Thread_Exit);
#else
return 0;
#endif /* ACE_HAS_THREAD_SPECIFIC_STORAGE || ACE_HAS_TSS_EMULATION */
}
+
// Grab hold of the Task * so that we can close() it in the
// destructor.
+
ACE_Thread_Exit::ACE_Thread_Exit (void)
{
ACE_OS_TRACE ("ACE_Thread_Exit::ACE_Thread_Exit");
}
+
// Set the this pointer...
+
void
ACE_Thread_Exit::thr_mgr (ACE_Thread_Manager *tm)
{
ACE_OS_TRACE ("ACE_Thread_Exit::thr_mgr");
+
if (tm != 0)
this->thread_control_.insert (tm, 0);
}
+
// When this object is destroyed the Task is automatically closed
// down!
+
ACE_Thread_Exit::~ACE_Thread_Exit (void)
{
ACE_OS_TRACE ("ACE_Thread_Exit::~ACE_Thread_Exit");
}
+
ACE_Thread_Exit_Maybe::ACE_Thread_Exit_Maybe (int flag)
: instance_ (0)
{
@@ -77,19 +102,23 @@ ACE_Thread_Exit_Maybe::ACE_Thread_Exit_Maybe (int flag)
ACE_NEW (instance_, ACE_Thread_Exit);
}
}
+
ACE_Thread_Exit_Maybe::~ACE_Thread_Exit_Maybe (void)
{
delete this->instance_;
}
+
ACE_Thread_Exit *
ACE_Thread_Exit_Maybe::operator -> (void) const
{
return this->instance_;
}
+
ACE_Thread_Exit *
ACE_Thread_Exit_Maybe::instance (void) const
{
return this->instance_;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Thread_Exit.h b/dep/ACE_wrappers/ace/Thread_Exit.h
index 2835d4b83ef..f56263c9db3 100644
--- a/dep/ACE_wrappers/ace/Thread_Exit.h
+++ b/dep/ACE_wrappers/ace/Thread_Exit.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Thread_Exit.h
@@ -9,15 +10,21 @@
*/
//=============================================================================
+
#ifndef ACE_THREAD_EXIT_H
#define ACE_THREAD_EXIT_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Thread_Control.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Thread_Exit
*
@@ -37,20 +44,26 @@ class ACE_Export ACE_Thread_Exit
public:
/// Capture the Thread that will be cleaned up automatically.
ACE_Thread_Exit (void);
+
/// Set the ACE_Thread_Manager.
void thr_mgr (ACE_Thread_Manager *tm);
+
/// Destructor calls the thread-specific exit hooks when a thread
/// exits.
~ACE_Thread_Exit (void);
+
/// Singleton access point.
static ACE_Thread_Exit *instance (void);
+
/// Cleanup method, used by the ACE_Object_Manager to destroy the
/// singleton.
static void cleanup (void *instance);
+
private:
/// Automatically add/remove the thread from the
/// ACE_Thread_Manager.
ACE_Thread_Control thread_control_;
+
/**
* Used to detect whether we should create a new instance (or not)
* within the instance method -- we don't trust the instance_ ptr
@@ -60,6 +73,7 @@ private:
*/
static bool is_constructed_;
};
+
/**
* @class ACE_Thread_Exit_Maybe
*
@@ -74,17 +88,25 @@ class ACE_Export ACE_Thread_Exit_Maybe
public:
/// Don't create an ACE_Thread_Exit instance by default.
ACE_Thread_Exit_Maybe (int flag = 0);
+
/// Destroys the underlying ACE_Thread_Exit instance if it exists.
~ACE_Thread_Exit_Maybe (void);
+
/// Delegates to underlying instance.
ACE_Thread_Exit * operator -> (void) const;
+
/// Returns the underlying instance.
ACE_Thread_Exit * instance (void) const;
+
private:
+
/// Holds the underlying instance.
ACE_Thread_Exit *instance_;
+
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
#endif /* ACE_THREAD_EXIT_H */
diff --git a/dep/ACE_wrappers/ace/Thread_Hook.cpp b/dep/ACE_wrappers/ace/Thread_Hook.cpp
index decfd14d3db..fcaecdd3301 100644
--- a/dep/ACE_wrappers/ace/Thread_Hook.cpp
+++ b/dep/ACE_wrappers/ace/Thread_Hook.cpp
@@ -1,26 +1,34 @@
// $Id: Thread_Hook.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Thread_Hook.h"
#include "ace/Object_Manager_Base.h"
+
ACE_RCSID(ace, Thread_Hook, "$Id: Thread_Hook.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_Thread_Hook::~ACE_Thread_Hook ()
{
}
+
ACE_THR_FUNC_RETURN
ACE_Thread_Hook::start (ACE_THR_FUNC func,
void *arg)
{
return (func) (arg);
}
+
ACE_Thread_Hook *
ACE_Thread_Hook::thread_hook (ACE_Thread_Hook *hook)
{
return ACE_OS_Object_Manager::thread_hook (hook);
}
+
ACE_Thread_Hook *
ACE_Thread_Hook::thread_hook (void)
{
return ACE_OS_Object_Manager::thread_hook ();
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Thread_Hook.h b/dep/ACE_wrappers/ace/Thread_Hook.h
index fce20093a26..16a24cc7afc 100644
--- a/dep/ACE_wrappers/ace/Thread_Hook.h
+++ b/dep/ACE_wrappers/ace/Thread_Hook.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Thread_Hook.h
@@ -9,15 +10,21 @@
*/
//=============================================================================
+
#ifndef ACE_THREAD_HOOK_H
#define ACE_THREAD_HOOK_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include /**/ "ace/ACE_export.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Thread_Hook
*
@@ -27,9 +34,12 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
*/
class ACE_Export ACE_Thread_Hook
{
+
public:
+
/// Destructor.
virtual ~ACE_Thread_Hook (void);
+
/**
* This method can be overridden in a subclass to customize this
* pre-function call "hook" invocation that can perform
@@ -40,13 +50,17 @@ public:
*/
virtual ACE_THR_FUNC_RETURN start (ACE_THR_FUNC func,
void *arg);
+
/// sets the system wide thread hook, returns the previous thread
/// hook or 0 if none is set.
static ACE_Thread_Hook *thread_hook (ACE_Thread_Hook *hook);
+
/// Returns the current system thread hook.
static ACE_Thread_Hook *thread_hook (void);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
#endif /* ACE_THREAD_HOOK_H */
diff --git a/dep/ACE_wrappers/ace/Thread_Manager.cpp b/dep/ACE_wrappers/ace/Thread_Manager.cpp
index 01e0a1371ac..3e1b9d3a091 100644
--- a/dep/ACE_wrappers/ace/Thread_Manager.cpp
+++ b/dep/ACE_wrappers/ace/Thread_Manager.cpp
@@ -1,4 +1,5 @@
// $Id: Thread_Manager.cpp 82600 2008-08-12 08:04:24Z johnnyw $
+
#include "ace/TSS_T.h"
#include "ace/Thread_Manager.h"
#include "ace/Dynamic.h"
@@ -9,36 +10,47 @@
#include "ace/Time_Value.h"
#include "ace/OS_NS_sys_time.h"
#include "ace/Truncate.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Thread_Manager.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID (ace,
Thread_Manager,
"$Id: Thread_Manager.cpp 82600 2008-08-12 08:04:24Z johnnyw $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_At_Thread_Exit::~ACE_At_Thread_Exit (void)
{
this->do_apply ();
}
+
ACE_At_Thread_Exit_Func::~ACE_At_Thread_Exit_Func (void)
{
this->do_apply ();
}
+
void
ACE_At_Thread_Exit_Func::apply (void)
{
this->func_ (this->object_, this->param_);
}
+
ACE_ALLOC_HOOK_DEFINE(ACE_Thread_Control)
ACE_ALLOC_HOOK_DEFINE(ACE_Thread_Manager)
+
#if ! defined (ACE_THREAD_MANAGER_LACKS_STATICS)
// Process-wide Thread Manager.
ACE_Thread_Manager *ACE_Thread_Manager::thr_mgr_ = 0;
+
// Controls whether the Thread_Manager is deleted when we shut down
// (we can only delete it safely if we created it!)
bool ACE_Thread_Manager::delete_thr_mgr_ = false;
#endif /* ! defined (ACE_THREAD_MANAGER_LACKS_STATICS) */
+
ACE_TSS_TYPE (ACE_Thread_Exit) *ACE_Thread_Manager::thr_exit_ = 0;
+
int
ACE_Thread_Manager::set_thr_exit (ACE_TSS_TYPE (ACE_Thread_Exit) *ptr)
{
@@ -48,6 +60,7 @@ ACE_Thread_Manager::set_thr_exit (ACE_TSS_TYPE (ACE_Thread_Exit) *ptr)
return -1;
return 0;
}
+
void
ACE_Thread_Manager::dump (void)
{
@@ -56,22 +69,28 @@ ACE_Thread_Manager::dump (void)
// Cast away const-ness of this in order to use its non-const lock_.
ACE_MT (ACE_GUARD (ACE_Thread_Mutex, ace_mon,
((ACE_Thread_Manager *) this)->lock_));
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
+
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\ngrp_id_ = %d"), this->grp_id_));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\ncurrent_count_ = %d"), this->thr_list_.size ()));
+
for (ACE_Double_Linked_List_Iterator<ACE_Thread_Descriptor> iter (this->thr_list_);
!iter.done ();
iter.advance ())
{
iter.next ()->dump ();
}
+
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
ACE_Thread_Descriptor::~ACE_Thread_Descriptor (void)
{
delete this->sync_;
}
+
void
ACE_Thread_Descriptor::at_pop (int apply)
{
@@ -93,6 +112,7 @@ ACE_Thread_Descriptor::at_pop (int apply)
if (!at->is_owner ())
delete at;
}
+
void
ACE_Thread_Descriptor::at_push (ACE_At_Thread_Exit* cleanup, bool is_owner)
{
@@ -102,6 +122,7 @@ ACE_Thread_Descriptor::at_push (ACE_At_Thread_Exit* cleanup, bool is_owner)
cleanup->next_ = at_exit_list_;
at_exit_list_ = cleanup;
}
+
int
ACE_Thread_Descriptor::at_exit (ACE_At_Thread_Exit& cleanup)
{
@@ -109,6 +130,7 @@ ACE_Thread_Descriptor::at_exit (ACE_At_Thread_Exit& cleanup)
at_push (&cleanup, 1);
return 0;
}
+
int
ACE_Thread_Descriptor::at_exit (ACE_At_Thread_Exit* cleanup)
{
@@ -121,6 +143,7 @@ ACE_Thread_Descriptor::at_exit (ACE_At_Thread_Exit* cleanup)
return 0;
}
}
+
void
ACE_Thread_Descriptor::do_at_exit ()
{
@@ -128,10 +151,12 @@ ACE_Thread_Descriptor::do_at_exit ()
while (at_exit_list_!=0)
this->at_pop ();
}
+
void
ACE_Thread_Descriptor::terminate ()
{
ACE_TRACE ("ACE_Thread_Descriptor::terminate");
+
if (!terminated_)
{
ACE_Log_Msg* log_msg = this->log_msg_;
@@ -142,9 +167,11 @@ ACE_Thread_Descriptor::terminate ()
if (this->tm_ != 0)
{
int close_handle = 0;
+
#if !defined (ACE_HAS_VXTHREADS)
// Threads created with THR_DAEMON shouldn't exist here, but
// just to be safe, let's put it here.
+
if (ACE_BIT_DISABLED (this->thr_state_, ACE_Thread_Manager::ACE_THR_JOINING))
{
if (ACE_BIT_DISABLED (this->flags_, THR_DETACHED | THR_DAEMON)
@@ -164,10 +191,12 @@ ACE_Thread_Descriptor::terminate ()
#endif /* ACE_WIN32 */
}
#endif /* !ACE_HAS_VXTHREADS */
+
// Remove thread descriptor from the table.
if (this->tm_ != 0)
tm_->remove_thr (this, close_handle);
}
+
// Check if we need delete ACE_Log_Msg instance
// If ACE_TSS_cleanup was not executed first log_msg == 0
if (log_msg == 0)
@@ -185,6 +214,7 @@ ACE_Thread_Descriptor::terminate ()
}
}
}
+
int
ACE_Thread_Descriptor::at_exit (void *object,
ACE_CLEANUP_FUNC cleanup_hook,
@@ -210,21 +240,25 @@ ACE_Thread_Descriptor::at_exit (void *object,
}
return 0;
}
+
void
ACE_Thread_Descriptor::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_Thread_Descriptor::dump");
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
+
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nthr_id_ = %d"), this->thr_id_));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nthr_handle_ = %d"), this->thr_handle_));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\ngrp_id_ = %d"), this->grp_id_));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nthr_state_ = %d"), this->thr_state_));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\ncleanup_info_.cleanup_hook_ = %x"), this->cleanup_info_.cleanup_hook_));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nflags_ = %x\n"), this->flags_));
+
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
ACE_Thread_Descriptor::ACE_Thread_Descriptor (void)
: log_msg_ (0),
at_exit_list_ (0),
@@ -234,6 +268,7 @@ ACE_Thread_Descriptor::ACE_Thread_Descriptor (void)
ACE_NEW (this->sync_,
ACE_DEFAULT_THREAD_MANAGER_LOCK);
}
+
void
ACE_Thread_Descriptor::acquire_release (void)
{
@@ -246,12 +281,15 @@ ACE_Thread_Descriptor::acquire_release (void)
// Acquire the lock before removing <td> from the thread table. If
// this thread is in the table already, it should simply acquire the
// lock easily.
+
// Once we get the lock, we must have registered.
ACE_ASSERT (ACE_BIT_ENABLED (this->thr_state_, ACE_Thread_Manager::ACE_THR_SPAWNED));
+
this->sync_->release ();
// Release the lock before putting it back to freelist.
}
}
+
void
ACE_Thread_Descriptor::acquire (void)
{
@@ -263,6 +301,7 @@ ACE_Thread_Descriptor::acquire (void)
this->sync_->acquire ();
}
}
+
void
ACE_Thread_Descriptor::release (void)
{
@@ -275,39 +314,51 @@ ACE_Thread_Descriptor::release (void)
// Release the lock before putting it back to freelist.
}
}
+
// The following macro simplifies subsequence code.
#define ACE_FIND(OP,INDEX) \
ACE_Thread_Descriptor *INDEX = OP; \
+
ACE_Thread_Descriptor *
ACE_Thread_Manager::thread_descriptor (ACE_thread_t thr_id)
{
ACE_TRACE ("ACE_Thread_Manager::thread_descriptor");
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, 0));
+
ACE_FIND (this->find_thread (thr_id), ptr);
return ptr;
}
+
ACE_Thread_Descriptor *
ACE_Thread_Manager::hthread_descriptor (ACE_hthread_t thr_handle)
{
ACE_TRACE ("ACE_Thread_Manager::hthread_descriptor");
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, 0));
+
ACE_FIND (this->find_hthread (thr_handle), ptr);
return ptr;
}
+
// Return the thread descriptor (indexed by ACE_hthread_t).
+
int
ACE_Thread_Manager::thr_self (ACE_hthread_t &self)
{
ACE_TRACE ("ACE_Thread_Manager::thr_self");
+
ACE_Thread_Descriptor *desc =
this->thread_desc_self ();
+
if (desc == 0)
return -1;
else
desc->self (self);
+
return 0;
}
+
// Initialize the synchronization variables.
+
ACE_Thread_Manager::ACE_Thread_Manager (size_t prealloc,
size_t lwm,
size_t inc,
@@ -322,16 +373,19 @@ ACE_Thread_Manager::ACE_Thread_Manager (size_t prealloc,
{
ACE_TRACE ("ACE_Thread_Manager::ACE_Thread_Manager");
}
+
#if ! defined (ACE_THREAD_MANAGER_LACKS_STATICS)
ACE_Thread_Manager *
ACE_Thread_Manager::instance (void)
{
ACE_TRACE ("ACE_Thread_Manager::instance");
+
if (ACE_Thread_Manager::thr_mgr_ == 0)
{
// Perform Double-Checked Locking Optimization.
ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon,
*ACE_Static_Object_Lock::instance (), 0));
+
if (ACE_Thread_Manager::thr_mgr_ == 0)
{
ACE_NEW_RETURN (ACE_Thread_Manager::thr_mgr_,
@@ -340,26 +394,33 @@ ACE_Thread_Manager::instance (void)
ACE_Thread_Manager::delete_thr_mgr_ = true;
}
}
+
return ACE_Thread_Manager::thr_mgr_;
}
+
ACE_Thread_Manager *
ACE_Thread_Manager::instance (ACE_Thread_Manager *tm)
{
ACE_TRACE ("ACE_Thread_Manager::instance");
ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon,
*ACE_Static_Object_Lock::instance (), 0));
+
ACE_Thread_Manager *t = ACE_Thread_Manager::thr_mgr_;
// We can't safely delete it since we don't know who created it!
ACE_Thread_Manager::delete_thr_mgr_ = false;
+
ACE_Thread_Manager::thr_mgr_ = tm;
return t;
}
+
void
ACE_Thread_Manager::close_singleton (void)
{
ACE_TRACE ("ACE_Thread_Manager::close_singleton");
+
ACE_MT (ACE_GUARD (ACE_Recursive_Thread_Mutex, ace_mon,
*ACE_Static_Object_Lock::instance ()));
+
if (ACE_Thread_Manager::delete_thr_mgr_)
{
// First, we clean up the thread descriptor list.
@@ -368,30 +429,38 @@ ACE_Thread_Manager::close_singleton (void)
ACE_Thread_Manager::thr_mgr_ = 0;
ACE_Thread_Manager::delete_thr_mgr_ = false;
}
+
ACE_Thread_Exit::cleanup (ACE_Thread_Manager::thr_exit_);
}
#endif /* ! defined (ACE_THREAD_MANAGER_LACKS_STATICS) */
+
// Close up and release all resources.
+
int
ACE_Thread_Manager::close ()
{
ACE_TRACE ("ACE_Thread_Manager::close");
+
// Clean up the thread descriptor list.
if (this->automatic_wait_)
this->wait (0, 1);
else
{
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1));
+
this->remove_thr_all ();
}
+
return 0;
}
+
ACE_Thread_Manager::~ACE_Thread_Manager (void)
{
ACE_TRACE ("ACE_Thread_Manager::~ACE_Thread_Manager");
this->close ();
}
+
// Run the entry point for thread spawned under the control of the
// <ACE_Thread_Manager>. This must be an extern "C" to make certain
// compilers happy...
@@ -421,6 +490,7 @@ ACE_Thread_Manager::~ACE_Thread_Manager (void)
// them, and just walks down the list and destroys each one.
//
// o That's where the ACE_Thread_Exit destructor gets called.
+
#if defined(ACE_USE_THREAD_MANAGER_ADAPTER)
extern "C" void *
ace_thread_manager_adapter (void *args)
@@ -432,7 +502,9 @@ ace_thread_manager_adapter (void *args)
void *ts_storage[ACE_TSS_Emulation::ACE_TSS_THREAD_KEYS_MAX];
ACE_TSS_Emulation::tss_open (ts_storage);
#endif /* ACE_HAS_TSS_EMULATION */
+
ACE_Thread_Adapter *thread_args = reinterpret_cast<ACE_Thread_Adapter *> (args);
+
// NOTE: this preprocessor directive should match the one in above
// ACE_Thread_Exit::instance (). With the Xavier Pthreads package,
// the exit_hook in TSS causes a seg fault. So, this works around
@@ -452,17 +524,22 @@ ace_thread_manager_adapter (void *args)
// from <svc>.
ACE_Thread_Exit exit_hook;
#endif /* ACE_HAS_THREAD_SPECIFIC_STORAGE || ACE_HAS_TSS_EMULATION */
+
// Keep track of the <Thread_Manager> that's associated with this
// <exit_hook>.
exit_hook.thr_mgr (thread_args->thr_mgr ());
+
// Invoke the user-supplied function with the args.
void *status = thread_args->invoke ();
+
delete static_cast<ACE_Base_Thread_Adapter *> (thread_args);
return status;
}
#endif
+
// Call the appropriate OS routine to spawn a thread. Should *not* be
// called with the lock_ held...
+
int
ACE_Thread_Manager::spawn_i (ACE_THR_FUNC func,
void *args,
@@ -481,12 +558,15 @@ ACE_Thread_Manager::spawn_i (ACE_THR_FUNC func,
// finding this kind of error as early as possible. Perhaps we can replace
// assertion by returning error.
ACE_ASSERT (ACE_BIT_DISABLED (flags, THR_DAEMON));
+
// Create a new thread running <func>. *Must* be called with the
// <lock_> held...
// Get a "new" Thread Descriptor from the freelist.
auto_ptr<ACE_Thread_Descriptor> new_thr_desc (this->thread_desc_freelist_.remove ());
+
// Reset thread descriptor status
new_thr_desc->reset (this);
+
ACE_Thread_Adapter *thread_args = 0;
# if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS)
ACE_NEW_RETURN (thread_args,
@@ -508,15 +588,19 @@ ACE_Thread_Manager::spawn_i (ACE_THR_FUNC func,
-1);
# endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */
auto_ptr <ACE_Base_Thread_Adapter> auto_thread_args (static_cast<ACE_Base_Thread_Adapter *> (thread_args));
+
ACE_TRACE ("ACE_Thread_Manager::spawn_i");
ACE_hthread_t thr_handle;
+
ACE_thread_t thr_id;
if (t_id == 0)
t_id = &thr_id;
+
// Acquire the <sync_> lock to block the spawned thread from
// removing this Thread Descriptor before it gets put into our
// thread table.
new_thr_desc->sync_->acquire ();
+
int const result = ACE_Thread::spawn (func,
args,
flags,
@@ -527,6 +611,7 @@ ACE_Thread_Manager::spawn_i (ACE_THR_FUNC func,
stack_size,
thread_args,
thr_name);
+
if (result != 0)
{
// _Don't_ clobber errno here! result is either 0 or -1, and
@@ -537,6 +622,7 @@ ACE_Thread_Manager::spawn_i (ACE_THR_FUNC func,
return -1;
}
auto_thread_args.release ();
+
#if defined (ACE_HAS_WTHREADS)
// Have to duplicate handle if client asks for it.
// @@ How are thread handles implemented on AIX? Do they
@@ -557,6 +643,7 @@ ACE_Thread_Manager::spawn_i (ACE_THR_FUNC func,
if (t_handle != 0)
*t_handle = thr_handle;
#endif /* ! ACE_HAS_WTHREADS */
+
// append_thr also put the <new_thr_desc> into Thread_Manager's
// double-linked list. Only after this point, can we manipulate
// double-linked list from a spawned thread's context.
@@ -568,6 +655,7 @@ ACE_Thread_Manager::spawn_i (ACE_THR_FUNC func,
flags,
new_thr_desc.release ());
}
+
int
ACE_Thread_Manager::spawn (ACE_THR_FUNC func,
void *args,
@@ -581,11 +669,15 @@ ACE_Thread_Manager::spawn (ACE_THR_FUNC func,
const char** thr_name)
{
ACE_TRACE ("ACE_Thread_Manager::spawn");
+
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1));
+
if (grp_id == -1)
grp_id = this->grp_id_++; // Increment the group id.
+
if (priority != ACE_DEFAULT_THREAD_PRIORITY)
ACE_CLR_BITS (flags, THR_INHERIT_SCHED);
+
if (this->spawn_i (func,
args,
flags,
@@ -598,9 +690,12 @@ ACE_Thread_Manager::spawn (ACE_THR_FUNC func,
0,
thr_name) == -1)
return -1;
+
return grp_id;
}
+
// Create N new threads running FUNC.
+
int
ACE_Thread_Manager::spawn_n (size_t n,
ACE_THR_FUNC func,
@@ -616,8 +711,10 @@ ACE_Thread_Manager::spawn_n (size_t n,
{
ACE_TRACE ("ACE_Thread_Manager::spawn_n");
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1));
+
if (grp_id == -1)
grp_id = this->grp_id_++; // Increment the group id.
+
for (size_t i = 0; i < n; i++)
{
// @@ What should happen if this fails?! e.g., should we try to
@@ -635,9 +732,12 @@ ACE_Thread_Manager::spawn_n (size_t n,
thr_name == 0 ? 0 : &thr_name [i]) == -1)
return -1;
}
+
return grp_id;
}
+
// Create N new threads running FUNC.
+
int
ACE_Thread_Manager::spawn_n (ACE_thread_t thread_ids[],
size_t n,
@@ -654,8 +754,10 @@ ACE_Thread_Manager::spawn_n (ACE_thread_t thread_ids[],
{
ACE_TRACE ("ACE_Thread_Manager::spawn_n");
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1));
+
if (grp_id == -1)
grp_id = this->grp_id_++; // Increment the group id.
+
for (size_t i = 0; i < n; i++)
{
// @@ What should happen if this fails?! e.g., should we try to
@@ -673,10 +775,13 @@ ACE_Thread_Manager::spawn_n (ACE_thread_t thread_ids[],
thr_name == 0 ? 0 : &thr_name [i]) == -1)
return -1;
}
+
return grp_id;
}
+
// Append a thread into the pool (does not check for duplicates).
// Must be called with locks held.
+
int
ACE_Thread_Manager::append_thr (ACE_thread_t t_id,
ACE_hthread_t t_handle,
@@ -688,6 +793,7 @@ ACE_Thread_Manager::append_thr (ACE_thread_t t_id,
{
ACE_TRACE ("ACE_Thread_Manager::append_thr");
ACE_Thread_Descriptor *thr_desc = 0;
+
if (td == 0)
{
ACE_NEW_RETURN (thr_desc,
@@ -698,17 +804,22 @@ ACE_Thread_Manager::append_thr (ACE_thread_t t_id,
}
else
thr_desc = td;
+
thr_desc->thr_id_ = t_id;
thr_desc->thr_handle_ = t_handle;
thr_desc->grp_id_ = grp_id;
thr_desc->task_ = task;
thr_desc->flags_ = flags;
+
this->thr_list_.insert_head (thr_desc);
ACE_SET_BITS (thr_desc->thr_state_, thr_state);
thr_desc->sync_->release ();
+
return 0;
}
+
// Return the thread descriptor (indexed by ACE_hthread_t).
+
ACE_Thread_Descriptor *
ACE_Thread_Manager::find_hthread (ACE_hthread_t h_id)
{
@@ -721,14 +832,18 @@ ACE_Thread_Manager::find_hthread (ACE_hthread_t h_id)
return iter.next ();
}
}
+
return 0;
}
+
// Locate the index in the table associated with <t_id>. Must be
// called with the lock held.
+
ACE_Thread_Descriptor *
ACE_Thread_Manager::find_thread (ACE_thread_t t_id)
{
ACE_TRACE ("ACE_Thread_Manager::find_thread");
+
for (ACE_Double_Linked_List_Iterator<ACE_Thread_Descriptor> iter (this->thr_list_);
!iter.done ();
iter.advance ())
@@ -740,8 +855,10 @@ ACE_Thread_Manager::find_thread (ACE_thread_t t_id)
}
return 0;
}
+
// Insert a thread into the pool (checks for duplicates and doesn't
// allow them to be inserted twice).
+
int
ACE_Thread_Manager::insert_thr (ACE_thread_t t_id,
ACE_hthread_t t_handle,
@@ -750,11 +867,14 @@ ACE_Thread_Manager::insert_thr (ACE_thread_t t_id,
{
ACE_TRACE ("ACE_Thread_Manager::insert_thr");
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1));
+
// Check for duplicates and bail out if we're already registered...
if (this->find_thread (t_id) != 0 )
return -1;
+
if (grp_id == -1)
grp_id = this->grp_id_++;
+
if (this->append_thr (t_id,
t_handle,
ACE_THR_SPAWNED,
@@ -762,22 +882,28 @@ ACE_Thread_Manager::insert_thr (ACE_thread_t t_id,
0,
flags) == -1)
return -1;
+
return grp_id;
}
+
// Run the registered hooks when the thread exits.
+
void
ACE_Thread_Manager::run_thread_exit_hooks (int i)
{
#if 0 // currently unused!
ACE_TRACE ("ACE_Thread_Manager::run_thread_exit_hooks");
+
// @@ Currently, we have just one hook. This should clearly be
// generalized to support an arbitrary number of hooks.
+
ACE_Thread_Descriptor *td = this->thread_desc_self ();
if (td != 0 && td->cleanup_info.cleanup_hook_ != 0)
{
(*td->cleanup_info_.cleanup_hook_)
(td->cleanup_info_.object_,
td->cleanup_info_.param_);
+
td->cleanup_info_.cleanup_hook_ = 0;
}
ACE_UNUSED_ARG (i);
@@ -785,38 +911,47 @@ ACE_Thread_Manager::run_thread_exit_hooks (int i)
ACE_UNUSED_ARG (i);
#endif /* 0 */
}
+
// Remove a thread from the pool. Must be called with locks held.
+
void
ACE_Thread_Manager::remove_thr (ACE_Thread_Descriptor *td,
int close_handler)
{
ACE_TRACE ("ACE_Thread_Manager::remove_thr");
+
td->tm_ = 0;
this->thr_list_.remove (td);
+
#if defined (ACE_WIN32)
if (close_handler != 0)
::CloseHandle (td->thr_handle_);
#else
ACE_UNUSED_ARG (close_handler);
#endif /* ACE_WIN32 */
+
this->thread_desc_freelist_.add (td);
+
#if defined (ACE_HAS_THREADS)
// Tell all waiters when there are no more threads left in the pool.
if (this->thr_list_.size () == 0)
this->zero_cond_.broadcast ();
#endif /* ACE_HAS_THREADS */
}
+
// Repeatedly call remove_thr on all table entries until there
// is no thread left. Must be called with lock held.
void
ACE_Thread_Manager::remove_thr_all (void)
{
ACE_Thread_Descriptor *td = 0;
+
while ((td = this->thr_list_.delete_head ()) != 0)
{
this->remove_thr (td, 1);
}
}
+
// ------------------------------------------------------------------
// Factor out some common behavior to simplify the following methods.
#define ACE_THR_OP(OP,STATE) \
@@ -830,6 +965,7 @@ ACE_Thread_Manager::remove_thr_all (void)
ACE_SET_BITS (td->thr_state_, STATE); \
return 0; \
}
+
int
ACE_Thread_Manager::join_thr (ACE_Thread_Descriptor *td, int)
{
@@ -839,16 +975,20 @@ ACE_Thread_Manager::join_thr (ACE_Thread_Descriptor *td, int)
{
// Since the thread are being joined, we should
// let it remove itself from the list.
+
// this->remove_thr (td);
errno = result;
return -1;
}
+
return 0;
}
+
int
ACE_Thread_Manager::suspend_thr (ACE_Thread_Descriptor *td, int)
{
ACE_TRACE ("ACE_Thread_Manager::suspend_thr");
+
int const result = ACE_Thread::suspend (td->thr_handle_);
if (result == -1) {
if (errno != ENOTSUP)
@@ -860,10 +1000,12 @@ ACE_Thread_Manager::suspend_thr (ACE_Thread_Descriptor *td, int)
return 0;
}
}
+
int
ACE_Thread_Manager::resume_thr (ACE_Thread_Descriptor *td, int)
{
ACE_TRACE ("ACE_Thread_Manager::resume_thr");
+
int const result = ACE_Thread::resume (td->thr_handle_);
if (result == -1) {
if (errno != ENOTSUP)
@@ -875,34 +1017,44 @@ ACE_Thread_Manager::resume_thr (ACE_Thread_Descriptor *td, int)
return 0;
}
}
+
int
ACE_Thread_Manager::cancel_thr (ACE_Thread_Descriptor *td, int async_cancel)
{
ACE_TRACE ("ACE_Thread_Manager::cancel_thr");
// Must set the state first and then try to cancel the thread.
ACE_SET_BITS (td->thr_state_, ACE_THR_CANCELLED);
+
if (async_cancel != 0)
// Note that this call only does something relevant if the OS
// platform supports asynchronous thread cancellation. Otherwise,
// it's a no-op.
return ACE_Thread::cancel (td->thr_id_);
+
return 0;
}
+
int
ACE_Thread_Manager::kill_thr (ACE_Thread_Descriptor *td, int signum)
{
ACE_TRACE ("ACE_Thread_Manager::kill_thr");
+
ACE_thread_t tid = td->thr_id_;
+
int const result = ACE_Thread::kill (tid, signum);
+
if (result != 0)
{
// Only remove a thread from us when there is a "real" error.
if (errno != ENOTSUP)
this->thr_to_be_removed_.enqueue_tail (td);
+
return -1;
}
+
return 0;
}
+
// ------------------------------------------------------------------
// Factor out some common behavior to simplify the following methods.
#define ACE_EXECUTE_OP(OP, ARG) \
@@ -922,34 +1074,43 @@ ACE_Thread_Manager::kill_thr (ACE_Thread_Descriptor *td, int signum)
this->remove_thr (td, 1); \
} \
return result
+
// Suspend a single thread.
+
int
ACE_Thread_Manager::suspend (ACE_thread_t t_id)
{
ACE_TRACE ("ACE_Thread_Manager::suspend");
ACE_EXECUTE_OP (this->suspend_thr, 0);
}
+
// Resume a single thread.
+
int
ACE_Thread_Manager::resume (ACE_thread_t t_id)
{
ACE_TRACE ("ACE_Thread_Manager::resume");
ACE_EXECUTE_OP (this->resume_thr, 0);
}
+
// Cancel a single thread.
+
int
ACE_Thread_Manager::cancel (ACE_thread_t t_id, int async_cancel)
{
ACE_TRACE ("ACE_Thread_Manager::cancel");
ACE_EXECUTE_OP (this->cancel_thr, async_cancel);
}
+
// Send a signal to a single thread.
+
int
ACE_Thread_Manager::kill (ACE_thread_t t_id, int signum)
{
ACE_TRACE ("ACE_Thread_Manager::kill");
ACE_EXECUTE_OP (this->kill_thr, signum);
}
+
int
ACE_Thread_Manager::check_state (ACE_UINT32 state,
ACE_thread_t id,
@@ -957,8 +1118,11 @@ ACE_Thread_Manager::check_state (ACE_UINT32 state,
{
ACE_TRACE ("ACE_Thread_Manager::check_state");
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1));
+
ACE_UINT32 thr_state;
+
int self_check = ACE_OS::thr_equal (id, ACE_OS::thr_self ());
+
// If we're checking the state of our thread, try to get the cached
// value out of TSS to avoid lookup.
if (self_check)
@@ -978,42 +1142,54 @@ ACE_Thread_Manager::check_state (ACE_UINT32 state,
}
if (enable)
return ACE_BIT_ENABLED (thr_state, state);
+
return ACE_BIT_DISABLED (thr_state, state);
}
+
// Test if a single thread has terminated.
+
int
ACE_Thread_Manager::testterminate (ACE_thread_t t_id)
{
ACE_TRACE ("ACE_Thread_Manager::testterminate");
return this->check_state (ACE_THR_TERMINATED, t_id);
}
+
// Test if a single thread is suspended.
+
int
ACE_Thread_Manager::testsuspend (ACE_thread_t t_id)
{
ACE_TRACE ("ACE_Thread_Manager::testsuspend");
return this->check_state (ACE_THR_SUSPENDED, t_id);
}
+
// Test if a single thread is active (i.e., resumed).
+
int
ACE_Thread_Manager::testresume (ACE_thread_t t_id)
{
ACE_TRACE ("ACE_Thread_Manager::testresume");
return this->check_state (ACE_THR_SUSPENDED, t_id, 0);
}
+
// Test if a single thread is cancelled.
+
int
ACE_Thread_Manager::testcancel (ACE_thread_t t_id)
{
ACE_TRACE ("ACE_Thread_Manager::testcancel");
return this->check_state (ACE_THR_CANCELLED, t_id);
}
+
// Thread information query functions.
+
int
ACE_Thread_Manager::hthread_within (ACE_hthread_t handle)
{
ACE_TRACE ("ACE_Thread_Manager::hthread_within");
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_monx, this->lock_, -1));
+
for (ACE_Double_Linked_List_Iterator<ACE_Thread_Descriptor> iter (this->thr_list_);
!iter.done ();
iter.advance ())
@@ -1023,13 +1199,16 @@ ACE_Thread_Manager::hthread_within (ACE_hthread_t handle)
return 1;
}
}
+
return 0;
}
+
int
ACE_Thread_Manager::thread_within (ACE_thread_t tid)
{
ACE_TRACE ("ACE_Thread_Manager::thread_within");
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_monx, this->lock_, -1));
+
for (ACE_Double_Linked_List_Iterator<ACE_Thread_Descriptor> iter (this->thr_list_);
!iter.done ();
iter.advance ())
@@ -1039,27 +1218,35 @@ ACE_Thread_Manager::thread_within (ACE_thread_t tid)
return 1;
}
}
+
return 0;
}
+
// Get group ids for a particular thread id.
+
int
ACE_Thread_Manager::get_grp (ACE_thread_t t_id, int &grp_id)
{
ACE_TRACE ("ACE_Thread_Manager::get_grp");
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1));
+
ACE_FIND (this->find_thread (t_id), ptr);
+
if (ptr)
grp_id = ptr->grp_id_;
else
return -1;
return 0;
}
+
// Set group ids for a particular thread id.
+
int
ACE_Thread_Manager::set_grp (ACE_thread_t t_id, int grp_id)
{
ACE_TRACE ("ACE_Thread_Manager::set_grp");
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1));
+
ACE_FIND (this->find_thread (t_id), ptr);
if (ptr)
ptr->grp_id_ = grp_id;
@@ -1067,7 +1254,9 @@ ACE_Thread_Manager::set_grp (ACE_thread_t t_id, int grp_id)
return -1;
return 0;
}
+
// Suspend a group of threads.
+
int
ACE_Thread_Manager::apply_grp (int grp_id,
ACE_THR_MEMBER_FUNC func,
@@ -1076,7 +1265,9 @@ ACE_Thread_Manager::apply_grp (int grp_id,
ACE_TRACE ("ACE_Thread_Manager::apply_grp");
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_monx, this->lock_, -1));
ACE_ASSERT (this->thr_to_be_removed_.is_empty ());
+
int result = 0;
+
for (ACE_Double_Linked_List_Iterator<ACE_Thread_Descriptor> iter (this->thr_list_);
!iter.done ();
iter.advance ())
@@ -1089,19 +1280,24 @@ ACE_Thread_Manager::apply_grp (int grp_id,
}
}
}
+
// Must remove threads after we have traversed the thr_list_ to
// prevent clobber thr_list_'s integrity.
+
if (! this->thr_to_be_removed_.is_empty ())
{
// Save/restore errno.
ACE_Errno_Guard error (errno);
+
for (ACE_Thread_Descriptor *td;
this->thr_to_be_removed_.dequeue_head (td) != -1;
)
this->remove_thr (td, 1);
}
+
return result;
}
+
int
ACE_Thread_Manager::suspend_grp (int grp_id)
{
@@ -1109,7 +1305,9 @@ ACE_Thread_Manager::suspend_grp (int grp_id)
return this->apply_grp (grp_id,
ACE_THR_MEMBER_FUNC (&ACE_Thread_Manager::suspend_thr));
}
+
// Resume a group of threads.
+
int
ACE_Thread_Manager::resume_grp (int grp_id)
{
@@ -1117,7 +1315,9 @@ ACE_Thread_Manager::resume_grp (int grp_id)
return this->apply_grp (grp_id,
ACE_THR_MEMBER_FUNC (&ACE_Thread_Manager::resume_thr));
}
+
// Kill a group of threads.
+
int
ACE_Thread_Manager::kill_grp (int grp_id, int signum)
{
@@ -1125,7 +1325,9 @@ ACE_Thread_Manager::kill_grp (int grp_id, int signum)
return this->apply_grp (grp_id,
ACE_THR_MEMBER_FUNC (&ACE_Thread_Manager::kill_thr), signum);
}
+
// Cancel a group of threads.
+
int
ACE_Thread_Manager::cancel_grp (int grp_id, int async_cancel)
{
@@ -1134,13 +1336,16 @@ ACE_Thread_Manager::cancel_grp (int grp_id, int async_cancel)
ACE_THR_MEMBER_FUNC (&ACE_Thread_Manager::cancel_thr),
async_cancel);
}
+
int
ACE_Thread_Manager::apply_all (ACE_THR_MEMBER_FUNC func, int arg)
{
ACE_TRACE ("ACE_Thread_Manager::apply_all");
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1));
ACE_ASSERT (this->thr_to_be_removed_.is_empty ());
+
int result = 0;
+
for (ACE_Double_Linked_List_Iterator<ACE_Thread_Descriptor> iter (this->thr_list_);
!iter.done ();
iter.advance ())
@@ -1150,38 +1355,47 @@ ACE_Thread_Manager::apply_all (ACE_THR_MEMBER_FUNC func, int arg)
result = -1;
}
}
+
// Must remove threads after we have traversed the thr_list_ to
// prevent clobber thr_list_'s integrity.
+
if (! this->thr_to_be_removed_.is_empty ())
{
// Save/restore errno.
ACE_Errno_Guard error (errno);
+
for (ACE_Thread_Descriptor *td;
this->thr_to_be_removed_.dequeue_head (td) != -1;
)
this->remove_thr (td, 1);
}
+
return result;
}
+
// Resume all threads that are suspended.
+
int
ACE_Thread_Manager::resume_all (void)
{
ACE_TRACE ("ACE_Thread_Manager::resume_all");
return this->apply_all (ACE_THR_MEMBER_FUNC (&ACE_Thread_Manager::resume_thr));
}
+
int
ACE_Thread_Manager::suspend_all (void)
{
ACE_TRACE ("ACE_Thread_Manager::suspend_all");
return this->apply_all (ACE_THR_MEMBER_FUNC (&ACE_Thread_Manager::suspend_thr));
}
+
int
ACE_Thread_Manager::kill_all (int sig)
{
ACE_TRACE ("ACE_Thread_Manager::kill_all");
return this->apply_all (&ACE_Thread_Manager::kill_thr, sig);
}
+
int
ACE_Thread_Manager::cancel_all (int async_cancel)
{
@@ -1189,14 +1403,18 @@ ACE_Thread_Manager::cancel_all (int async_cancel)
return this->apply_all (ACE_THR_MEMBER_FUNC (&ACE_Thread_Manager::cancel_thr),
async_cancel);
}
+
int
ACE_Thread_Manager::join (ACE_thread_t tid, ACE_THR_FUNC_RETURN *status)
{
ACE_TRACE ("ACE_Thread_Manager::join");
+
bool found = false;
ACE_Thread_Descriptor tdb;
+
{
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1));
+
#if !defined (ACE_HAS_VXTHREADS)
for (ACE_Double_Linked_List_Iterator<ACE_Thread_Descriptor_Base> biter (this->terminated_thr_list_);
!biter.done ();
@@ -1210,11 +1428,13 @@ ACE_Thread_Manager::join (ACE_thread_t tid, ACE_THR_FUNC_RETURN *status)
return -1;
}
delete tdb;
+
// return immediately if we've found the thread we want to join.
return 0;
}
}
#endif /* !ACE_HAS_VXTHREADS */
+
for (ACE_Double_Linked_List_Iterator<ACE_Thread_Descriptor> iter (this->thr_list_);
!iter.done ();
iter.advance ())
@@ -1231,26 +1451,34 @@ ACE_Thread_Manager::join (ACE_thread_t tid, ACE_THR_FUNC_RETURN *status)
break;
}
}
+
if (!found)
return -1;
// Didn't find the thread we want or the thread is not joinable.
}
+
if (ACE_Thread::join (tdb.thr_handle_, status) == -1)
return -1;
+
return 0;
}
+
// Wait for group of threads
+
int
ACE_Thread_Manager::wait_grp (int grp_id)
{
ACE_TRACE ("ACE_Thread_Manager::wait_grp");
+
int copy_count = 0;
ACE_Thread_Descriptor_Base *copy_table = 0;
+
// We have to make sure that while we wait for these threads to
// exit, we do not have the lock. Therefore we make a copy of all
// interesting entries and let go of the lock.
{
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1));
+
#if !defined (ACE_HAS_VXTHREADS)
ACE_NEW_RETURN (copy_table,
ACE_Thread_Descriptor_Base [this->thr_list_.size ()
@@ -1261,6 +1489,7 @@ ACE_Thread_Manager::wait_grp (int grp_id)
ACE_Thread_Descriptor_Base [this->thr_list_.size ()],
-1);
#endif /* !ACE_HAS_VXTHREADS */
+
for (ACE_Double_Linked_List_Iterator<ACE_Thread_Descriptor> iter (this->thr_list_);
!iter.done ();
iter.advance ())
@@ -1275,6 +1504,7 @@ ACE_Thread_Manager::wait_grp (int grp_id)
copy_table[copy_count++] = *iter.next ();
}
}
+
#if !defined (ACE_HAS_VXTHREADS)
for (ACE_Double_Linked_List_Iterator<ACE_Thread_Descriptor_Base> biter (this->terminated_thr_list_);
!biter.done ();
@@ -1291,8 +1521,10 @@ ACE_Thread_Manager::wait_grp (int grp_id)
}
#endif /* !ACE_HAS_VXTHREADS */
}
+
// Now actually join() with all the threads in this group.
int result = 0;
+
for (int i = 0;
i < copy_count && result != -1;
i++)
@@ -1300,22 +1532,28 @@ ACE_Thread_Manager::wait_grp (int grp_id)
if (ACE_Thread::join (copy_table[i].thr_handle_) == -1)
result = -1;
}
+
delete [] copy_table;
+
return result;
}
+
// Must be called when thread goes out of scope to clean up its table
// slot.
+
ACE_THR_FUNC_RETURN
ACE_Thread_Manager::exit (ACE_THR_FUNC_RETURN status, bool do_thread_exit)
{
ACE_TRACE ("ACE_Thread_Manager::exit");
#if defined (ACE_WIN32)
// Remove detached thread handle.
+
if (do_thread_exit)
{
#if 0
// @@ This callback is now taken care of by TSS_Cleanup. Do we
// need it anymore?
+
// On Win32, if we really wants to exit from a thread, we must
// first clean up the thread specific storage. By doing so,
// ACE_Thread_Manager::exit will be called again with
@@ -1327,9 +1565,11 @@ ACE_Thread_Manager::exit (ACE_THR_FUNC_RETURN status, bool do_thread_exit)
ACE_Thread::exit (status);
}
#endif /* ACE_WIN32 */
+
// Just hold onto the guard while finding this thread's id and
{
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, 0));
+
// Find the thread id, but don't use the cache. It might have been
// deleted already.
ACE_thread_t const id = ACE_OS::thr_self ();
@@ -1341,6 +1581,7 @@ ACE_Thread_Manager::exit (ACE_THR_FUNC_RETURN status, bool do_thread_exit)
td->terminate();
}
}
+
if (do_thread_exit)
{
ACE_Thread::exit (status);
@@ -1348,15 +1589,19 @@ ACE_Thread_Manager::exit (ACE_THR_FUNC_RETURN status, bool do_thread_exit)
// However, due to horrible semantics with Win32 thread-specific
// storage this call can return (don't ask...).
}
+
return 0;
}
+
// Wait for all the threads to exit.
+
int
ACE_Thread_Manager::wait (const ACE_Time_Value *timeout,
bool abandon_detached_threads,
bool use_absolute_time)
{
ACE_TRACE ("ACE_Thread_Manager::wait");
+
ACE_Time_Value local_timeout;
// Check to see if we're using absolute time or not.
if (use_absolute_time == false && timeout != 0)
@@ -1365,13 +1610,16 @@ ACE_Thread_Manager::wait (const ACE_Time_Value *timeout,
local_timeout += ACE_OS::gettimeofday ();
timeout = &local_timeout;
}
+
#if !defined (ACE_HAS_VXTHREADS)
ACE_Double_Linked_List<ACE_Thread_Descriptor_Base> term_thr_list_copy;
#endif /* ACE_HAS_VXTHREADS */
+
#if defined (ACE_HAS_THREADS)
{
// Just hold onto the guard while waiting.
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1));
+
if (ACE_Object_Manager::shutting_down () != 1)
{
// Program is not shutting down. Perform a normal wait on threads.
@@ -1391,6 +1639,7 @@ ACE_Thread_Manager::wait (const ACE_Time_Value *timeout,
ACE_SET_BITS (iter.next ()->thr_state_, ACE_THR_JOINING);
}
}
+
if (! this->thr_to_be_removed_.is_empty ())
{
ACE_Thread_Descriptor *td = 0;
@@ -1398,6 +1647,7 @@ ACE_Thread_Manager::wait (const ACE_Time_Value *timeout,
this->remove_thr (td, 1);
}
}
+
while (this->thr_list_.size () > 0)
if (this->zero_cond_.wait (timeout) == -1)
return -1;
@@ -1406,6 +1656,7 @@ ACE_Thread_Manager::wait (const ACE_Time_Value *timeout,
// Program is shutting down, no chance to wait on threads.
// Therefore, we'll just remove threads from the list.
this->remove_thr_all ();
+
#if !defined (ACE_HAS_VXTHREADS)
ACE_Thread_Descriptor_Base* item = 0;
while ((item = this->terminated_thr_list_.delete_head ()) != 0)
@@ -1415,25 +1666,31 @@ ACE_Thread_Manager::wait (const ACE_Time_Value *timeout,
#endif /* ACE_HAS_VXTHREADS */
// Release the guard, giving other threads a chance to run.
}
+
#if !defined (ACE_HAS_VXTHREADS)
// @@ VxWorks doesn't support thr_join (yet.) We are working
// on our implementation. Chorus'es thr_join seems broken.
ACE_Thread_Descriptor_Base *item = 0;
+
while ((item = term_thr_list_copy.delete_head ()) != 0)
{
if (ACE_BIT_DISABLED (item->flags_, THR_DETACHED | THR_DAEMON)
|| ACE_BIT_ENABLED (item->flags_, THR_JOINABLE))
// Detached handles shouldn't reached here.
(void) ACE_Thread::join (item->thr_handle_);
+
delete item;
}
+
#endif /* !ACE_HAS_VXTHREADS */
#else
ACE_UNUSED_ARG (timeout);
ACE_UNUSED_ARG (abandon_detached_threads);
#endif /* ACE_HAS_THREADS */
+
return 0;
}
+
int
ACE_Thread_Manager::apply_task (ACE_Task_Base *task,
ACE_THR_MEMBER_FUNC func,
@@ -1442,37 +1699,47 @@ ACE_Thread_Manager::apply_task (ACE_Task_Base *task,
ACE_TRACE ("ACE_Thread_Manager::apply_task");
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1));
ACE_ASSERT (this->thr_to_be_removed_.is_empty ());
+
int result = 0;
+
for (ACE_Double_Linked_List_Iterator<ACE_Thread_Descriptor> iter (this->thr_list_);
!iter.done ();
iter.advance ())
if (iter.next ()->task_ == task
&& (this->*func) (iter.next (), arg) == -1)
result = -1;
+
// Must remove threads after we have traversed the thr_list_ to
// prevent clobber thr_list_'s integrity.
+
if (! this->thr_to_be_removed_.is_empty ())
{
// Save/restore errno.
ACE_Errno_Guard error (errno);
+
for (ACE_Thread_Descriptor *td;
this->thr_to_be_removed_.dequeue_head (td) != -1;
)
this->remove_thr (td, 1);
}
+
return result;
}
+
// Wait for all threads to exit a task.
+
int
ACE_Thread_Manager::wait_task (ACE_Task_Base *task)
{
int copy_count = 0;
ACE_Thread_Descriptor_Base *copy_table = 0;
+
// We have to make sure that while we wait for these threads to
// exit, we do not have the lock. Therefore we make a copy of all
// interesting entries and let go of the lock.
{
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1));
+
#if !defined (ACE_HAS_VXTHREADS)
ACE_NEW_RETURN (copy_table,
ACE_Thread_Descriptor_Base [this->thr_list_.size ()
@@ -1483,6 +1750,7 @@ ACE_Thread_Manager::wait_task (ACE_Task_Base *task)
ACE_Thread_Descriptor_Base [this->thr_list_.size ()],
-1);
#endif /* !ACE_HAS_VXTHREADS */
+
for (ACE_Double_Linked_List_Iterator<ACE_Thread_Descriptor> iter (this->thr_list_);
!iter.done ();
iter.advance ())
@@ -1500,6 +1768,7 @@ ACE_Thread_Manager::wait_task (ACE_Task_Base *task)
copy_table[copy_count++] = *iter.next ();
}
}
+
#if !defined (ACE_HAS_VXTHREADS)
for (ACE_Double_Linked_List_Iterator<ACE_Thread_Descriptor_Base> titer (this->terminated_thr_list_);
!titer.done ();
@@ -1515,8 +1784,10 @@ ACE_Thread_Manager::wait_task (ACE_Task_Base *task)
}
#endif /* !ACE_HAS_VXTHREADS */
}
+
// Now to do the actual work
int result = 0;
+
for (int i = 0;
i < copy_count && result != -1;
i++)
@@ -1524,10 +1795,14 @@ ACE_Thread_Manager::wait_task (ACE_Task_Base *task)
if (ACE_Thread::join (copy_table[i].thr_handle_) == -1)
result = -1;
}
+
delete [] copy_table;
+
return result;
}
+
// Suspend a task
+
int
ACE_Thread_Manager::suspend_task (ACE_Task_Base *task)
{
@@ -1535,6 +1810,7 @@ ACE_Thread_Manager::suspend_task (ACE_Task_Base *task)
return this->apply_task (task,
ACE_THR_MEMBER_FUNC (&ACE_Thread_Manager::suspend_thr));
}
+
// Resume a task.
int
ACE_Thread_Manager::resume_task (ACE_Task_Base *task)
@@ -1543,7 +1819,9 @@ ACE_Thread_Manager::resume_task (ACE_Task_Base *task)
return this->apply_task (task,
ACE_THR_MEMBER_FUNC (&ACE_Thread_Manager::resume_thr));
}
+
// Kill a task.
+
int
ACE_Thread_Manager::kill_task (ACE_Task_Base *task, int /* signum */)
{
@@ -1551,6 +1829,7 @@ ACE_Thread_Manager::kill_task (ACE_Task_Base *task, int /* signum */)
return this->apply_task (task,
ACE_THR_MEMBER_FUNC (&ACE_Thread_Manager::kill_thr));
}
+
// Cancel a task.
int
ACE_Thread_Manager::cancel_task (ACE_Task_Base *task,
@@ -1561,34 +1840,45 @@ ACE_Thread_Manager::cancel_task (ACE_Task_Base *task,
ACE_THR_MEMBER_FUNC (&ACE_Thread_Manager::cancel_thr),
async_cancel);
}
+
// Locate the index in the table associated with <task> from the
// beginning of the table up to an index. Must be called with the
// lock held.
+
ACE_Thread_Descriptor *
ACE_Thread_Manager::find_task (ACE_Task_Base *task, size_t slot)
{
ACE_TRACE ("ACE_Thread_Manager::find_task");
+
size_t i = 0;
+
for (ACE_Double_Linked_List_Iterator<ACE_Thread_Descriptor> iter (this->thr_list_);
!iter.done ();
iter.advance ())
{
if (i >= slot)
break;
+
if (task == iter.next ()->task_)
return iter.next ();
+
++i;
}
+
return 0;
}
+
// Returns the number of ACE_Task in a group.
+
int
ACE_Thread_Manager::num_tasks_in_group (int grp_id)
{
ACE_TRACE ("ACE_Thread_Manager::num_tasks_in_group");
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1));
+
int tasks_count = 0;
size_t i = 0;
+
for (ACE_Double_Linked_List_Iterator<ACE_Thread_Descriptor> iter (this->thr_list_);
!iter.done ();
iter.advance ())
@@ -1599,17 +1889,22 @@ ACE_Thread_Manager::num_tasks_in_group (int grp_id)
{
++tasks_count;
}
+
++i;
}
return tasks_count;
}
+
// Returns the number of threads in an ACE_Task.
+
int
ACE_Thread_Manager::num_threads_in_task (ACE_Task_Base *task)
{
ACE_TRACE ("ACE_Thread_Manager::num_threads_in_task");
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1));
+
int threads_count = 0;
+
for (ACE_Double_Linked_List_Iterator<ACE_Thread_Descriptor> iter (this->thr_list_);
!iter.done ();
iter.advance ())
@@ -1619,16 +1914,21 @@ ACE_Thread_Manager::num_threads_in_task (ACE_Task_Base *task)
++threads_count;
}
}
+
return threads_count;
}
+
// Returns in task_list a list of ACE_Tasks registered with ACE_Thread_Manager.
+
ssize_t
ACE_Thread_Manager::task_all_list (ACE_Task_Base *task_list[],
size_t n)
{
ACE_TRACE ("ACE_Thread_Manager::task_all_list");
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1));
+
size_t task_list_count = 0;
+
for (ACE_Double_Linked_List_Iterator<ACE_Thread_Descriptor> iter (this->thr_list_);
!iter.done ();
iter.advance ())
@@ -1637,12 +1937,15 @@ ACE_Thread_Manager::task_all_list (ACE_Task_Base *task_list[],
{
break;
}
+
ACE_Task_Base *task_p = iter.next ()->task_;
+
if (0 != task_p)
{
// This thread has a task pointer; see if it's already in the
// list. Don't add duplicates.
size_t i = 0;
+
for (; i < task_list_count; ++i)
{
if (task_list[i] == task_p)
@@ -1650,22 +1953,28 @@ ACE_Thread_Manager::task_all_list (ACE_Task_Base *task_list[],
break;
}
}
+
if (i == task_list_count) // No match - add this one
{
task_list[task_list_count++] = task_p;
}
}
}
+
return ACE_Utils::truncate_cast<ssize_t> (task_list_count);
}
+
// Returns in thread_list a list of all thread ids
+
ssize_t
ACE_Thread_Manager::thread_all_list (ACE_thread_t thread_list[],
size_t n)
{
ACE_TRACE ("ACE_Thread_Manager::thread_all_list");
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1));
+
size_t thread_count = 0;
+
for (ACE_Double_Linked_List_Iterator<ACE_Thread_Descriptor> iter (this->thr_list_);
!iter.done ();
iter.advance ())
@@ -1674,43 +1983,55 @@ ACE_Thread_Manager::thread_all_list (ACE_thread_t thread_list[],
{
break;
}
+
thread_list[thread_count] = iter.next ()->thr_id_;
++thread_count;
}
+
return ACE_Utils::truncate_cast<ssize_t> (thread_count);
}
+
int
ACE_Thread_Manager::thr_state (ACE_thread_t id,
ACE_UINT32& state)
{
ACE_TRACE ("ACE_Thread_Manager::thr_state");
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1));
+
int const self_check = ACE_OS::thr_equal (id, ACE_OS::thr_self ());
+
// If we're checking the state of our thread, try to get the cached
// value out of TSS to avoid lookup.
if (self_check)
{
ACE_Thread_Descriptor *desc = ACE_LOG_MSG->thr_desc ();
+
if (desc == 0)
{
return 0; // Always return false.
}
+
state = desc->thr_state_;
}
else
{
// Not calling from self, have to look it up from the list.
ACE_FIND (this->find_thread (id), ptr);
+
if (ptr == 0)
{
return 0;
}
+
state = ptr->thr_state_;
}
+
return 1;
}
+
// Returns in task_list a list of ACE_Tasks in a group.
+
ssize_t
ACE_Thread_Manager::task_list (int grp_id,
ACE_Task_Base *task_list[],
@@ -1718,9 +2039,11 @@ ACE_Thread_Manager::task_list (int grp_id,
{
ACE_TRACE ("ACE_Thread_Manager::task_list");
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1));
+
ACE_Task_Base **task_list_iterator = task_list;
size_t task_list_count = 0;
size_t i = 0;
+
for (ACE_Double_Linked_List_Iterator<ACE_Thread_Descriptor> iter (this->thr_list_);
!iter.done ();
iter.advance ())
@@ -1729,17 +2052,22 @@ ACE_Thread_Manager::task_list (int grp_id,
{
break;
}
+
if (iter.next ()->grp_id_ == grp_id
&& this->find_task (iter.next ()->task_, i) == 0)
{
task_list_iterator[task_list_count] = iter.next ()->task_;
++task_list_count;
}
+
++i;
}
+
return ACE_Utils::truncate_cast<ssize_t> (task_list_count);
}
+
// Returns in thread_list a list of thread ids in an ACE_Task.
+
ssize_t
ACE_Thread_Manager::thread_list (ACE_Task_Base *task,
ACE_thread_t thread_list[],
@@ -1747,7 +2075,9 @@ ACE_Thread_Manager::thread_list (ACE_Task_Base *task,
{
ACE_TRACE ("ACE_Thread_Manager::thread_list");
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1));
+
size_t thread_count = 0;
+
for (ACE_Double_Linked_List_Iterator<ACE_Thread_Descriptor> iter (this->thr_list_);
!iter.done ();
iter.advance ())
@@ -1756,15 +2086,19 @@ ACE_Thread_Manager::thread_list (ACE_Task_Base *task,
{
break;
}
+
if (iter.next ()->task_ == task)
{
thread_list[thread_count] = iter.next ()->thr_id_;
++thread_count;
}
}
+
return ACE_Utils::truncate_cast<ssize_t> (thread_count);
}
+
// Returns in thread_list a list of thread handles in an ACE_Task.
+
ssize_t
ACE_Thread_Manager::hthread_list (ACE_Task_Base *task,
ACE_hthread_t hthread_list[],
@@ -1772,7 +2106,9 @@ ACE_Thread_Manager::hthread_list (ACE_Task_Base *task,
{
ACE_TRACE ("ACE_Thread_Manager::hthread_list");
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1));
+
size_t hthread_count = 0;
+
for (ACE_Double_Linked_List_Iterator<ACE_Thread_Descriptor> iter (this->thr_list_);
!iter.done ();
iter.advance ())
@@ -1781,14 +2117,17 @@ ACE_Thread_Manager::hthread_list (ACE_Task_Base *task,
{
break;
}
+
if (iter.next ()->task_ == task)
{
hthread_list[hthread_count] = iter.next ()->thr_handle_;
++hthread_count;
}
}
+
return ACE_Utils::truncate_cast<ssize_t> (hthread_count);
}
+
ssize_t
ACE_Thread_Manager::thread_grp_list (int grp_id,
ACE_thread_t thread_list[],
@@ -1796,7 +2135,9 @@ ACE_Thread_Manager::thread_grp_list (int grp_id,
{
ACE_TRACE ("ACE_Thread_Manager::thread_grp_list");
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1));
+
size_t thread_count = 0;
+
for (ACE_Double_Linked_List_Iterator<ACE_Thread_Descriptor> iter (this->thr_list_);
!iter.done ();
iter.advance ())
@@ -1805,15 +2146,19 @@ ACE_Thread_Manager::thread_grp_list (int grp_id,
{
break;
}
+
if (iter.next ()->grp_id_ == grp_id)
{
thread_list[thread_count] = iter.next ()->thr_id_;
thread_count++;
}
}
+
return ACE_Utils::truncate_cast<ssize_t> (thread_count);
}
+
// Returns in thread_list a list of thread handles in an ACE_Task.
+
ssize_t
ACE_Thread_Manager::hthread_grp_list (int grp_id,
ACE_hthread_t hthread_list[],
@@ -1821,7 +2166,9 @@ ACE_Thread_Manager::hthread_grp_list (int grp_id,
{
ACE_TRACE ("ACE_Thread_Manager::hthread_grp_list");
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1));
+
size_t hthread_count = 0;
+
for (ACE_Double_Linked_List_Iterator<ACE_Thread_Descriptor> iter (this->thr_list_);
!iter.done ();
iter.advance ())
@@ -1830,19 +2177,23 @@ ACE_Thread_Manager::hthread_grp_list (int grp_id,
{
break;
}
+
if (iter.next ()->grp_id_ == grp_id)
{
hthread_list[hthread_count] = iter.next ()->thr_handle_;
hthread_count++;
}
}
+
return ACE_Utils::truncate_cast<ssize_t> (hthread_count);
}
+
int
ACE_Thread_Manager::set_grp (ACE_Task_Base *task, int grp_id)
{
ACE_TRACE ("ACE_Thread_Manager::set_grp");
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1));
+
for (ACE_Double_Linked_List_Iterator<ACE_Thread_Descriptor> iter (this->thr_list_);
!iter.done ();
iter.advance ())
@@ -1852,16 +2203,20 @@ ACE_Thread_Manager::set_grp (ACE_Task_Base *task, int grp_id)
iter.next ()->grp_id_ = grp_id;
}
}
+
return 0;
}
+
int
ACE_Thread_Manager::get_grp (ACE_Task_Base *task, int &grp_id)
{
ACE_TRACE ("ACE_Thread_Manager::get_grp");
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1));
+
ACE_FIND (this->find_task (task), ptr);
grp_id = ptr->grp_id_;
return 0;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Thread_Manager.h b/dep/ACE_wrappers/ace/Thread_Manager.h
index b3515ee7763..1e891351167 100644
--- a/dep/ACE_wrappers/ace/Thread_Manager.h
+++ b/dep/ACE_wrappers/ace/Thread_Manager.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Thread_Manager.h
@@ -8,15 +9,19 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_THREAD_MANAGER_H
#define ACE_THREAD_MANAGER_H
#include /**/ "ace/pre.h"
+
#include "ace/Thread.h"
#include "ace/Thread_Adapter.h"
#include "ace/Thread_Exit.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Condition_Thread_Mutex.h"
#include "ace/Unbounded_Queue.h"
#include "ace/Containers.h"
@@ -25,6 +30,7 @@
#include "ace/Log_Msg.h"
#include "ace/Synch_Traits.h"
#include "ace/Basic_Types.h"
+
// The following macros control how a Thread Manager manages a pool of
// Thread_Descriptor. Currently, the default behavior is not to
// preallocate any thread descriptor and never (well, almost never)
@@ -39,33 +45,42 @@
// system with resources constraint, you may want to lower the size of
// ACE_DEFAULT_THREAD_MANAGER_HWM to avoid unused memory hanging
// around.
+
#if !defined (ACE_DEFAULT_THREAD_MANAGER_PREALLOC)
# define ACE_DEFAULT_THREAD_MANAGER_PREALLOC 0
#endif /* ACE_DEFAULT_THREAD_MANAGER_PREALLOC */
+
#if !defined (ACE_DEFAULT_THREAD_MANAGER_LWM)
# define ACE_DEFAULT_THREAD_MANAGER_LWM 1
#endif /* ACE_DEFAULT_THREAD_MANAGER_LWM */
+
#if !defined (ACE_DEFAULT_THREAD_MANAGER_INC)
# define ACE_DEFAULT_THREAD_MANAGER_INC 1
#endif /* ACE_DEFAULT_THREAD_MANAGER_INC */
+
#if !defined (ACE_DEFAULT_THREAD_MANAGER_HWM)
# define ACE_DEFAULT_THREAD_MANAGER_HWM ACE_DEFAULT_FREE_LIST_HWM
// this is a big number
#endif /* ACE_DEFAULT_THREAD_MANAGER_HWM */
+
// This is the synchronization mechanism used to prevent a thread
// descriptor gets removed from the Thread_Manager before it gets
// stash into it. If you want to disable this feature (and risk of
// corrupting the freelist,) you define the lock as ACE_Null_Mutex.
// Usually, if you can be sure that your threads will run for an
// extended period of time, you can safely disable the lock.
+
#if !defined (ACE_DEFAULT_THREAD_MANAGER_LOCK)
# define ACE_DEFAULT_THREAD_MANAGER_LOCK ACE_SYNCH_MUTEX
#endif /* ACE_DEFAULT_THREAD_MANAGER_LOCK */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward declarations.
class ACE_Task_Base;
class ACE_Thread_Manager;
class ACE_Thread_Descriptor;
+
/**
* @class ACE_At_Thread_Exit
*
@@ -78,30 +93,42 @@ class ACE_Export ACE_At_Thread_Exit
public:
/// Default constructor
ACE_At_Thread_Exit (void);
+
/// The destructor
virtual ~ACE_At_Thread_Exit (void);
+
/// At_Thread_Exit has the ownership?
bool is_owner (void) const;
+
/// Set the ownership of the At_Thread_Exit.
bool is_owner (bool owner);
+
/// This At_Thread_Exit was applied?
bool was_applied (void) const;
+
/// Set applied state of At_Thread_Exit.
bool was_applied (bool applied);
+
protected:
/// The next At_Thread_Exit hook in the list.
ACE_At_Thread_Exit *next_;
+
/// Do the apply if necessary
void do_apply (void);
+
/// The apply method.
virtual void apply (void) = 0;
+
/// The Thread_Descriptor where this at is registered.
ACE_Thread_Descriptor* td_;
+
/// The at was applied?
bool was_applied_;
+
/// The at has the ownership of this?
bool is_owner_;
};
+
class ACE_Export ACE_At_Thread_Exit_Func : public ACE_At_Thread_Exit
{
public:
@@ -109,17 +136,23 @@ public:
ACE_At_Thread_Exit_Func (void *object,
ACE_CLEANUP_FUNC func,
void *param = 0);
+
virtual ~ACE_At_Thread_Exit_Func (void);
+
protected:
/// The object to be cleanup
void *object_;
+
/// The cleanup func
ACE_CLEANUP_FUNC func_;
+
/// A param if required
void *param_;
+
/// The apply method
void apply (void);
};
+
/**
* @class ACE_Thread_Descriptor_Base
*
@@ -131,6 +164,7 @@ protected:
*/
class ACE_Export ACE_Thread_Descriptor_Base : public ACE_OS_Thread_Descriptor
{
+
friend class ACE_Thread_Manager;
friend class ACE_Double_Linked_List<ACE_Thread_Descriptor_Base>;
friend class ACE_Double_Linked_List_Iterator_Base<ACE_Thread_Descriptor_Base>;
@@ -141,37 +175,51 @@ class ACE_Export ACE_Thread_Descriptor_Base : public ACE_OS_Thread_Descriptor
public:
ACE_Thread_Descriptor_Base (void);
~ACE_Thread_Descriptor_Base (void);
+
// = We need the following operators to make Borland happy.
+
/// Equality operator.
bool operator== (const ACE_Thread_Descriptor_Base &rhs) const;
+
/// Inequality operator.
bool operator!= (const ACE_Thread_Descriptor_Base &rhs) const;
+
/// Group ID.
int grp_id (void) const;
+
/// Current state of the thread.
ACE_UINT32 state (void) const;
+
/// Return the pointer to an ACE_Task_Base or NULL if there's no
/// ACE_Task_Base associated with this thread.;
ACE_Task_Base *task (void) const;
+
protected:
/// Reset this base thread descriptor.
void reset (void);
+
/// Unique thread ID.
ACE_thread_t thr_id_;
+
/// Unique handle to thread (used by Win32 and AIX).
ACE_hthread_t thr_handle_;
+
/// Group ID.
int grp_id_;
+
/// Current state of the thread.
ACE_UINT32 thr_state_;
+
/// Pointer to an ACE_Task_Base or NULL if there's no
/// ACE_Task_Base.
ACE_Task_Base *task_;
+
/// We need these pointers to maintain the double-linked list in a
/// thread managers.
ACE_Thread_Descriptor_Base *next_;
ACE_Thread_Descriptor_Base *prev_;
};
+
/**
* @class ACE_Thread_Descriptor
*
@@ -187,28 +235,35 @@ class ACE_Export ACE_Thread_Descriptor : public ACE_Thread_Descriptor_Base
public:
// = Initialization method.
ACE_Thread_Descriptor (void);
+
// = Accessor methods.
/// Unique thread id.
ACE_thread_t self (void) const;
+
/// Unique handle to thread (used by Win32 and AIX).
void self (ACE_hthread_t &);
+
/// Dump the state of an object.
void dump (void) const;
+
/**
* This cleanup function must be called only for ACE_TSS_cleanup.
* The ACE_TSS_cleanup delegate Log_Msg instance destruction when
* Log_Msg cleanup is called before terminate.
*/
void log_msg_cleanup(ACE_Log_Msg* log_msg);
+
/**
* Register an At_Thread_Exit hook and the ownership is acquire by
* Thread_Descriptor, this is the usual case when the AT is dynamically
* allocated.
*/
int at_exit (ACE_At_Thread_Exit* cleanup);
+
/// Register an At_Thread_Exit hook and the ownership is retained for the
/// caller. Normally used when the at_exit hook is created in stack.
int at_exit (ACE_At_Thread_Exit& cleanup);
+
/**
* Register an object (or array) for cleanup at thread termination.
* "cleanup_hook" points to a (global, or static member) function
@@ -223,8 +278,10 @@ public:
int at_exit (void *object,
ACE_CLEANUP_FUNC cleanup_hook,
void *param);
+
/// Do nothing destructor to keep some compilers happy
~ACE_Thread_Descriptor (void);
+
/**
* Do nothing but to acquire the thread descriptor's lock and
* release. This will first check if the thread is registered or
@@ -237,46 +294,60 @@ public:
void acquire_release (void);
void acquire (void);
void release (void);
+
/**
* Set/get the @c next_ pointer. These are required by the
* ACE_Free_List.
*/
void set_next (ACE_Thread_Descriptor *td);
ACE_Thread_Descriptor *get_next (void) const;
+
private:
/// Reset this thread descriptor.
void reset (ACE_Thread_Manager *tm);
+
/// Pop an At_Thread_Exit from at thread termination list, apply the at
/// if apply is true.
void at_pop (int apply = 1);
+
/// Push an At_Thread_Exit to at thread termination list and set the
/// ownership of at.
void at_push (ACE_At_Thread_Exit* cleanup,
bool is_owner = false);
+
/// Run the AT_Thread_Exit hooks.
void do_at_exit (void);
+
/// Terminate realize the cleanup process to thread termination
void terminate (void);
+
/// Thread_Descriptor is the ownership of ACE_Log_Msg if log_msg_!=0
/// This can occur because ACE_TSS_cleanup was executed before terminate.
ACE_Log_Msg *log_msg_;
+
/// The AT_Thread_Exit list
ACE_At_Thread_Exit *at_exit_list_;
+
/**
* Stores the cleanup info for a thread.
* @note This should be generalized to be a stack of ACE_Cleanup_Info's.
*/
ACE_Cleanup_Info cleanup_info_;
+
/// Pointer to an ACE_Thread_Manager or NULL if there's no
/// ACE_Thread_Manager>
ACE_Thread_Manager* tm_;
+
/// Registration lock to prevent premature removal of thread descriptor.
ACE_DEFAULT_THREAD_MANAGER_LOCK *sync_;
+
/// Keep track of termination status.
bool terminated_;
};
+
// Forward declaration.
class ACE_Thread_Control;
+
// This typedef should be (and used to be) inside the
// ACE_Thread_Manager declaration. But, it caused compilation
// problems on g++/VxWorks/i960 with -g. Note that
@@ -286,6 +357,7 @@ class ACE_Thread_Control;
#if defined (__GNUG__)
typedef int (ACE_Thread_Manager::*ACE_THR_MEMBER_FUNC)(ACE_Thread_Descriptor *, int);
#endif /* __GNUG__ */
+
/**
* @class ACE_Thread_Manager
*
@@ -309,34 +381,44 @@ class ACE_Export ACE_Thread_Manager
{
public:
friend class ACE_Thread_Control;
+
// Allow ACE_THread_Exit to register the global TSS instance object.
friend class ACE_Thread_Exit;
friend class ACE_Thread_Descriptor;
+
#if !defined (__GNUG__)
typedef int (ACE_Thread_Manager::*ACE_THR_MEMBER_FUNC)(ACE_Thread_Descriptor *, int);
#endif /* !__GNUG__ */
+
/// These are the various states a thread managed by the
/// ACE_Thread_Manager can be in.
enum
{
/// Uninitialized.
ACE_THR_IDLE = 0x00000000,
+
/// Created but not yet running.
ACE_THR_SPAWNED = 0x00000001,
+
/// Thread is active (naturally, we don't know if it's actually
/// *running* because we aren't the scheduler...).
ACE_THR_RUNNING = 0x00000002,
+
/// Thread is suspended.
ACE_THR_SUSPENDED = 0x00000004,
+
/// Thread has been cancelled (which is an indiction that it needs to
/// terminate...).
ACE_THR_CANCELLED = 0x00000008,
+
/// Thread has shutdown, but the slot in the thread manager hasn't
/// been reclaimed yet.
ACE_THR_TERMINATED = 0x00000010,
+
/// Join operation has been invoked on the thread by thread manager.
ACE_THR_JOINING = 0x10000000
};
+
/**
* @brief Initialization and termination methods.
*
@@ -353,17 +435,22 @@ public:
size_t inc = ACE_DEFAULT_THREAD_MANAGER_INC,
size_t hwm = ACE_DEFAULT_THREAD_MANAGER_HWM);
~ACE_Thread_Manager (void);
+
#if ! defined (ACE_THREAD_MANAGER_LACKS_STATICS)
/// Get pointer to a process-wide ACE_Thread_Manager.
static ACE_Thread_Manager *instance (void);
+
/// Set pointer to a process-wide ACE_Thread_Manager and return
/// existing pointer.
static ACE_Thread_Manager *instance (ACE_Thread_Manager *);
+
/// Delete the dynamically allocated Singleton
static void close_singleton (void);
#endif /* ! defined (ACE_THREAD_MANAGER_LACKS_STATICS) */
+
/// No-op. Currently unused.
int open (size_t size = 0);
+
/**
* Release all resources.
* By default, this method will wait until all threads exit.
@@ -372,6 +459,7 @@ public:
* up internal thread records (the thread descriptor list).
*/
int close (void);
+
/**
* Create a new thread, which executes @a func with argument @a arg.
*
@@ -433,6 +521,7 @@ public:
void *stack = 0,
size_t stack_size = ACE_DEFAULT_THREAD_STACKSIZE,
const char** thr_name = 0);
+
/**
* Spawn a specified number of threads, all of which execute @a func
* with argument @a arg.
@@ -509,6 +598,7 @@ public:
void *stack[] = 0,
size_t stack_size[] = 0,
const char* thr_name[] = 0);
+
/**
* Spawn a specified number of threads, all of which execute @a func
* with argument @a arg.
@@ -577,6 +667,7 @@ public:
*
* @retval -1 on failure; @c errno contains an error value.
* @retval The group id of the threads.
+
*/
int spawn_n (ACE_thread_t thread_ids[],
size_t n,
@@ -590,6 +681,7 @@ public:
ACE_hthread_t thread_handles[] = 0,
ACE_Task_Base *task = 0,
const char* thr_name[] = 0);
+
/**
* Called to clean up when a thread exits.
*
@@ -601,6 +693,7 @@ public:
*/
ACE_THR_FUNC_RETURN exit (ACE_THR_FUNC_RETURN status = 0,
bool do_thread_exit = true);
+
/**
* Block until there are no more threads running in this thread
* manager or @c timeout expires.
@@ -635,14 +728,17 @@ public:
int wait (const ACE_Time_Value *timeout = 0,
bool abandon_detached_threads = false,
bool use_absolute_time = true);
+
/// Join a thread specified by @a tid. Do not wait on a detached thread.
int join (ACE_thread_t tid, ACE_THR_FUNC_RETURN *status = 0);
+
/**
* Block until there are no more threads running in a group.
* Returns 0 on success and -1 on failure. Notice that wait_grp
* will not wait on detached threads.
*/
int wait_grp (int grp_id);
+
/**
* Return the "real" handle to the calling thread, caching it if
* necessary in TSS to speed up subsequent lookups. This is
@@ -654,17 +750,20 @@ public:
* Return -1 if fail.
*/
int thr_self (ACE_hthread_t &);
+
/**
* Return the unique ID of the calling thread.
* Same as calling ACE_Thread::self().
*/
ACE_thread_t thr_self (void);
+
/**
* Returns a pointer to the current ACE_Task_Base we're executing
* in if this thread is indeed running in an ACE_Task_Base, else
* return 0.
*/
ACE_Task_Base *task (void);
+
/**
* @name Suspend and resume methods
*
@@ -672,29 +771,39 @@ public:
* does not support these functions.
*/
//@{
+
/// Suspend all threads
int suspend_all (void);
+
/// Suspend a single thread.
int suspend (ACE_thread_t);
+
/// Suspend a group of threads.
int suspend_grp (int grp_id);
+
/**
* True if @a t_id is inactive (i.e., suspended), else false. Always
* return false if @a t_id is not managed by the Thread_Manager.
*/
int testsuspend (ACE_thread_t t_id);
+
/// Resume all stopped threads
int resume_all (void);
+
/// Resume a single thread.
int resume (ACE_thread_t);
+
/// Resume a group of threads.
int resume_grp (int grp_id);
+
/**
* True if @a t_id is active (i.e., resumed), else false. Always
* return false if @a t_id is not managed by the Thread_Manager.
*/
int testresume (ACE_thread_t t_id);
+
//@}
+
// = Send signals to one or more threads without blocking.
/**
* Send @a signum to all stopped threads. Not supported on platforms
@@ -711,24 +820,29 @@ public:
* that do not have advanced signal support, such as Win32.
*/
int kill_grp (int grp_id, int signum);
+
// = Cancel methods, which provides a cooperative thread-termination mechanism (will not block).
/**
* Cancel's all the threads.
*/
int cancel_all (int async_cancel = 0);
+
/**
* Cancel a single thread.
*/
int cancel (ACE_thread_t, int async_cancel = 0);
+
/**
* Cancel a group of threads.
*/
int cancel_grp (int grp_id, int async_cancel = 0);
+
/**
* True if @a t_id is cancelled, else false. Always return false if
* @a t_id is not managed by the Thread_Manager.
*/
int testcancel (ACE_thread_t t_id);
+
/**
* True if @a t_id has terminated (i.e., is no longer running),
* but the slot in the thread manager hasn't been reclaimed yet,
@@ -736,12 +850,15 @@ public:
* Thread_Manager.
*/
int testterminate (ACE_thread_t t_id);
+
/// Set group ids for a particular thread id.
int set_grp (ACE_thread_t,
int grp_id);
+
/// Get group ids for a particular thread id.
int get_grp (ACE_thread_t,
int &grp_id);
+
/**
* @name Task-related operations
*/
@@ -759,18 +876,22 @@ public:
* @retval -1 Failure (consult errno for further information).
*/
int wait_task (ACE_Task_Base *task);
+
/**
* Suspend all threads in an ACE_Task.
*/
int suspend_task (ACE_Task_Base *task);
+
/**
* Resume all threads in an ACE_Task.
*/
int resume_task (ACE_Task_Base *task);
+
/**
* Send a signal @a signum to all threads in an ACE_Task.
*/
int kill_task (ACE_Task_Base *task, int signum);
+
/**
* Cancel all threads in an ACE_Task. If <async_cancel> is non-0,
* then asynchronously cancel these threads if the OS platform
@@ -778,17 +899,22 @@ public:
* cancellation.
*/
int cancel_task (ACE_Task_Base *task, int async_cancel = 0);
+
//@}
+
// = Collect thread handles in the thread manager. Notice that
// the collected information is just a snapshot.
/// Check if the thread is managed by the thread manager. Return true if
/// the thread is found, false otherwise.
int hthread_within (ACE_hthread_t handle);
int thread_within (ACE_thread_t tid);
+
/// Returns the number of ACE_Task_Base in a group.
int num_tasks_in_group (int grp_id);
+
/// Returns the number of threads in an ACE_Task_Base.
int num_threads_in_task (ACE_Task_Base *task);
+
/**
* Returns a list of ACE_Task_Base pointers corresponding to the tasks
* that have active threads in a specified thread group.
@@ -815,6 +941,7 @@ public:
ssize_t task_list (int grp_id,
ACE_Task_Base *task_list[],
size_t n);
+
/**
* Returns in @a thread_list a list of up to @a n thread ids in an
* ACE_Task_Base. The caller must allocate the memory for
@@ -825,6 +952,7 @@ public:
ssize_t thread_list (ACE_Task_Base *task,
ACE_thread_t thread_list[],
size_t n);
+
/**
* Returns in @a hthread_list a list of up to @a n thread handles in
* an ACE_Task_Base. The caller must allocate memory for
@@ -835,6 +963,7 @@ public:
ssize_t hthread_list (ACE_Task_Base *task,
ACE_hthread_t hthread_list[],
size_t n);
+
/**
* Returns in @a thread_list a list of up to @a n thread ids in a
* group @a grp_id. The caller must allocate the memory for
@@ -845,6 +974,7 @@ public:
ssize_t thread_grp_list (int grp_id,
ACE_thread_t thread_list[],
size_t n);
+
/**
* Returns in @a hthread_list a list of up to @a n thread handles in
* a group @a grp_id. The caller must allocate memory for
@@ -853,6 +983,7 @@ public:
ssize_t hthread_grp_list (int grp_id,
ACE_hthread_t hthread_list[],
size_t n);
+
/**
* Returns a list of ACE_Task_Base pointers corresponding to the tasks
* that have active threads managed by this instance.
@@ -876,6 +1007,7 @@ public:
*/
ssize_t task_all_list (ACE_Task_Base *task_list[],
size_t n);
+
/**
* Returns in @a thread_list a list of up to @a n thread ids. The
* caller must allocate the memory for @a thread_list. In case of an
@@ -885,25 +1017,32 @@ public:
*/
ssize_t thread_all_list (ACE_thread_t thread_list[],
size_t n);
+
/// Set group ids for a particular task.
int set_grp (ACE_Task_Base *task, int grp_id);
+
/// Get group ids for a particular task.
int get_grp (ACE_Task_Base *task, int &grp_id);
+
/// Return a count of the current number of threads active in the
/// <Thread_Manager>.
size_t count_threads (void) const;
+
/// Get the state of the thread. Returns false if the thread is not
/// managed by this thread manager.
int thr_state (ACE_thread_t id, ACE_UINT32& state);
+
/**
* Register an At_Thread_Exit hook and the ownership is acquire by
* Thread_Descriptor, this is the usual case when the AT is dynamically
* allocated.
*/
int at_exit (ACE_At_Thread_Exit* cleanup);
+
/// Register an At_Thread_Exit hook and the ownership is retained for the
/// caller. Normally used when the at_exit hook is created in stack.
int at_exit (ACE_At_Thread_Exit& cleanup);
+
/**
*
*****
@@ -927,14 +1066,18 @@ public:
int at_exit (void *object,
ACE_CLEANUP_FUNC cleanup_hook,
void *param);
+
/// Access function to determine whether the Thread_Manager will
/// wait for its thread to exit or not when being closing down.
void wait_on_exit (int dowait);
int wait_on_exit (void);
+
/// Dump the state of an object.
void dump (void);
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
// = Accessors for ACE_Thread_Descriptors.
/**
@@ -943,12 +1086,15 @@ protected:
* fetch the info from TSS.
*/
ACE_Thread_Descriptor *thread_desc_self (void);
+
/// Return a pointer to the thread's Thread_Descriptor,
/// 0 if fail.
ACE_Thread_Descriptor *thread_descriptor (ACE_thread_t);
+
/// Return a pointer to the thread's Thread_Descriptor,
/// 0 if fail.
ACE_Thread_Descriptor *hthread_descriptor (ACE_hthread_t);
+
/// Create a new thread (must be called with locks held).
int spawn_i (ACE_THR_FUNC func,
void *arg,
@@ -961,14 +1107,18 @@ protected:
size_t stack_size = 0,
ACE_Task_Base *task = 0,
const char** thr_name = 0);
+
/// Run the registered hooks when the thread exits.
void run_thread_exit_hooks (int i);
+
/// Locate the index of the table slot occupied by <t_id>. Returns
/// -1 if <t_id> is not in the table doesn't contain <t_id>.
ACE_Thread_Descriptor *find_thread (ACE_thread_t t_id);
+
/// Locate the index of the table slot occupied by <h_id>. Returns
/// -1 if <h_id> is not in the table doesn't contain <h_id>.
ACE_Thread_Descriptor *find_hthread (ACE_hthread_t h_id);
+
/**
* Locate the thread descriptor address of the list occupied by
* @a task. Returns 0 if @a task is not in the table doesn't contain
@@ -976,11 +1126,13 @@ protected:
*/
ACE_Thread_Descriptor *find_task (ACE_Task_Base *task,
size_t slot = 0);
+
/// Insert a thread in the table (checks for duplicates).
int insert_thr (ACE_thread_t t_id,
ACE_hthread_t,
int grp_id = -1,
long flags = 0);
+
/// Append a thread in the table (adds at the end, growing the table
/// if necessary).
int append_thr (ACE_thread_t t_id, ACE_hthread_t,
@@ -989,13 +1141,17 @@ protected:
ACE_Task_Base *task = 0,
long flags = 0,
ACE_Thread_Descriptor *td = 0);
+
/// Remove thread from the table.
void remove_thr (ACE_Thread_Descriptor *td,
int close_handler);
+
/// Remove all threads from the table.
void remove_thr_all (void);
+
// = The following four methods implement a simple scheme for
// operating on a collection of threads atomically.
+
/**
* Efficiently check whether @a thread is in a particular @a state.
* This call updates the TSS cache if possible to speed up
@@ -1004,36 +1160,47 @@ protected:
int check_state (ACE_UINT32 state,
ACE_thread_t thread,
int enable = 1);
+
/// Apply @a func to all members of the table that match the @a task
int apply_task (ACE_Task_Base *task,
ACE_THR_MEMBER_FUNC func,
int = 0);
+
/// Apply @a func to all members of the table that match the @a grp_id.
int apply_grp (int grp_id,
ACE_THR_MEMBER_FUNC func,
int arg = 0);
+
/// Apply @a func to all members of the table.
int apply_all (ACE_THR_MEMBER_FUNC,
int = 0);
+
/// Join the thread described in @a td.
int join_thr (ACE_Thread_Descriptor *td,
int = 0);
+
/// Resume the thread described in @a td.
int resume_thr (ACE_Thread_Descriptor *td,
int = 0);
+
/// Suspend the thread described in @a td.
int suspend_thr (ACE_Thread_Descriptor *td,
int = 0);
+
/// Send signal @a signum to the thread described in @a td.
int kill_thr (ACE_Thread_Descriptor *td,
int signum);
+
/// Set the cancellation flag for the thread described in @a td.
int cancel_thr (ACE_Thread_Descriptor *td,
int async_cancel = 0);
+
/// Register a thread as terminated and put it into the <terminated_thr_list_>.
int register_as_terminated (ACE_Thread_Descriptor *td);
+
/// Setting the static ACE_TSS_TYPE (ACE_Thread_Exit) *thr_exit_ pointer.
static int set_thr_exit (ACE_TSS_TYPE (ACE_Thread_Exit) *ptr);
+
/**
* Keeping a list of thread descriptors within the thread manager.
* Double-linked list enables us to cache the entries in TSS
@@ -1041,44 +1208,58 @@ protected:
* affecting other thread's descriptor entries.
*/
ACE_Double_Linked_List<ACE_Thread_Descriptor> thr_list_;
+
#if !defined (ACE_HAS_VXTHREADS)
/// Collect terminated but not yet joined thread entries.
ACE_Double_Linked_List<ACE_Thread_Descriptor_Base> terminated_thr_list_;
#endif /* !ACE_HAS_VXTHREADS */
+
/// Collect pointers to thread descriptors of threads to be removed later.
ACE_Unbounded_Queue<ACE_Thread_Descriptor*> thr_to_be_removed_;
+
/// Keeps track of the next group id to assign.
int grp_id_;
+
/// Set if we want the Thread_Manager to wait on all threads before
/// being closed, reset otherwise.
int automatic_wait_;
+
// = ACE_Thread_Mutex and condition variable for synchronizing termination.
#if defined (ACE_HAS_THREADS)
/// Serialize access to the <zero_cond_>.
ACE_Thread_Mutex lock_;
+
/// Keep track of when there are no more threads.
ACE_Condition_Thread_Mutex zero_cond_;
#endif /* ACE_HAS_THREADS */
+
ACE_Locked_Free_List<ACE_Thread_Descriptor, ACE_SYNCH_MUTEX> thread_desc_freelist_;
+
private:
#if ! defined (ACE_THREAD_MANAGER_LACKS_STATICS)
/// Pointer to a process-wide ACE_Thread_Manager.
static ACE_Thread_Manager *thr_mgr_;
+
/// Must delete the thr_mgr_ if true.
static bool delete_thr_mgr_;
+
/// Global ACE_TSS (ACE_Thread_Exit) object ptr.
static ACE_TSS_TYPE (ACE_Thread_Exit) *thr_exit_;
#endif /* ! defined (ACE_THREAD_MANAGER_LACKS_STATICS) */
};
+
#if defined (ACE_THREAD_MANAGER_LACKS_STATICS)
#define ACE_THREAD_MANAGER_SINGLETON_DEFINE \
ACE_Singleton<ACE_Thread_Manager, ACE_SYNCH_MUTEX>;
typedef ACE_Singleton<ACE_Thread_Manager, ACE_SYNCH_MUTEX> ACE_THREAD_MANAGER_SINGLETON;
#endif /* defined (ACE_THREAD_MANAGER_LACKS_STATICS) */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Thread_Manager.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_THREAD_MANAGER_H */
diff --git a/dep/ACE_wrappers/ace/Thread_Manager.inl b/dep/ACE_wrappers/ace/Thread_Manager.inl
index 8599a1f30bc..6be65a664fa 100644
--- a/dep/ACE_wrappers/ace/Thread_Manager.inl
+++ b/dep/ACE_wrappers/ace/Thread_Manager.inl
@@ -1,7 +1,9 @@
// -*- C++ -*-
//
// $Id: Thread_Manager.inl 82588 2008-08-11 13:37:41Z johnnyw $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_At_Thread_Exit::ACE_At_Thread_Exit (void)
: next_ (0),
@@ -10,11 +12,13 @@ ACE_At_Thread_Exit::ACE_At_Thread_Exit (void)
is_owner_ (true)
{
}
+
ACE_INLINE bool
ACE_At_Thread_Exit::was_applied() const
{
return was_applied_;
}
+
ACE_INLINE bool
ACE_At_Thread_Exit::was_applied (bool applied)
{
@@ -23,23 +27,27 @@ ACE_At_Thread_Exit::was_applied (bool applied)
td_ = 0;
return was_applied_;
}
+
ACE_INLINE bool
ACE_At_Thread_Exit::is_owner() const
{
return is_owner_;
}
+
ACE_INLINE bool
ACE_At_Thread_Exit::is_owner (bool owner)
{
is_owner_ = owner;
return is_owner_;
}
+
ACE_INLINE void
ACE_At_Thread_Exit::do_apply (void)
{
if (!this->was_applied_ && this->is_owner_)
td_->at_pop();
}
+
ACE_INLINE
ACE_At_Thread_Exit_Func::ACE_At_Thread_Exit_Func (void *object,
ACE_CLEANUP_FUNC func,
@@ -49,6 +57,7 @@ ACE_At_Thread_Exit_Func::ACE_At_Thread_Exit_Func (void *object,
param_(param)
{
}
+
ACE_INLINE
ACE_Thread_Descriptor_Base::ACE_Thread_Descriptor_Base (void)
: ACE_OS_Thread_Descriptor (),
@@ -61,10 +70,12 @@ ACE_Thread_Descriptor_Base::ACE_Thread_Descriptor_Base (void)
prev_ (0)
{
}
+
ACE_INLINE
ACE_Thread_Descriptor_Base::~ACE_Thread_Descriptor_Base (void)
{
}
+
ACE_INLINE bool
ACE_Thread_Descriptor_Base::operator== (
const ACE_Thread_Descriptor_Base &rhs) const
@@ -73,24 +84,29 @@ ACE_Thread_Descriptor_Base::operator== (
ACE_OS::thr_cmp (this->thr_handle_, rhs.thr_handle_)
&& ACE_OS::thr_equal (this->thr_id_, rhs.thr_id_);
}
+
ACE_INLINE bool
ACE_Thread_Descriptor_Base::operator!=(const ACE_Thread_Descriptor_Base &rhs) const
{
return !(*this == rhs);
}
+
ACE_INLINE ACE_Task_Base *
ACE_Thread_Descriptor_Base::task (void) const
{
ACE_TRACE ("ACE_Thread_Descriptor_Base::task");
return this->task_;
}
+
// Group ID.
+
ACE_INLINE int
ACE_Thread_Descriptor_Base::grp_id (void) const
{
ACE_TRACE ("ACE_Thread_Descriptor_Base::grp_id");
return grp_id_;
}
+
// Current state of the thread.
ACE_INLINE ACE_UINT32
ACE_Thread_Descriptor_Base::state (void) const
@@ -98,6 +114,7 @@ ACE_Thread_Descriptor_Base::state (void) const
ACE_TRACE ("ACE_Thread_Descriptor_Base::state");
return thr_state_;
}
+
// Reset this base descriptor.
ACE_INLINE void
ACE_Thread_Descriptor_Base::reset (void)
@@ -110,6 +127,7 @@ ACE_Thread_Descriptor_Base::reset (void)
this->task_ = 0;
this->flags_ = 0;
}
+
// Unique thread id.
ACE_INLINE ACE_thread_t
ACE_Thread_Descriptor::self (void) const
@@ -117,18 +135,23 @@ ACE_Thread_Descriptor::self (void) const
ACE_TRACE ("ACE_Thread_Descriptor::self");
return this->thr_id_;
}
+
// Unique kernel-level thread handle.
+
ACE_INLINE void
ACE_Thread_Descriptor::self (ACE_hthread_t &handle)
{
ACE_TRACE ("ACE_Thread_Descriptor::self");
handle = this->thr_handle_;
}
+
ACE_INLINE void
ACE_Thread_Descriptor::log_msg_cleanup (ACE_Log_Msg* log_msg)
+
{
log_msg_ = log_msg;
}
+
// Set the <next_> pointer
ACE_INLINE void
ACE_Thread_Descriptor::set_next (ACE_Thread_Descriptor *td)
@@ -136,6 +159,7 @@ ACE_Thread_Descriptor::set_next (ACE_Thread_Descriptor *td)
ACE_TRACE ("ACE_Thread_Descriptor::set_next");
this->next_ = td;
}
+
// Get the <next_> pointer
ACE_INLINE ACE_Thread_Descriptor *
ACE_Thread_Descriptor::get_next (void) const
@@ -143,6 +167,7 @@ ACE_Thread_Descriptor::get_next (void) const
ACE_TRACE ("ACE_Thread_Descriptor::get_next");
return static_cast<ACE_Thread_Descriptor * ACE_CAST_CONST> (this->next_);
}
+
// Reset this thread descriptor
ACE_INLINE void
ACE_Thread_Descriptor::reset (ACE_Thread_Manager *tm)
@@ -156,12 +181,15 @@ ACE_Thread_Descriptor::reset (ACE_Thread_Manager *tm)
this->log_msg_ = 0;
this->terminated_ = false;
}
+
ACE_INLINE ACE_Thread_Descriptor *
ACE_Thread_Manager::thread_desc_self (void)
{
// This method must be called with lock held.
+
// Try to get it from cache.
ACE_Thread_Descriptor *desc = ACE_LOG_MSG->thr_desc ();
+
#if 1
// ACE_ASSERT (desc != 0);
// Thread descriptor should always get cached.
@@ -169,7 +197,9 @@ ACE_Thread_Manager::thread_desc_self (void)
if (desc == 0)
{
ACE_thread_t id = ACE_OS::thr_self ();
+
desc = this->find_thread (id);
+
// Thread descriptor adapter might not have been put into the
// list yet.
if (desc != 0)
@@ -179,29 +209,36 @@ ACE_Thread_Manager::thread_desc_self (void)
#endif
return desc;
}
+
// Return the unique ID of the thread.
+
ACE_INLINE ACE_thread_t
ACE_Thread_Manager::thr_self (void)
{
ACE_TRACE ("ACE_Thread_Manager::thr_self");
return ACE_Thread::self ();
}
+
ACE_INLINE ACE_Task_Base *
ACE_Thread_Manager::task (void)
{
ACE_TRACE ("ACE_Thread_Manager::task");
+
ACE_Thread_Descriptor *td = this->thread_desc_self () ;
+
if (td == 0)
return 0;
else
return td->task ();
}
+
ACE_INLINE int
ACE_Thread_Manager::open (size_t)
{
// Currently no-op.
return 0;
}
+
ACE_INLINE int
ACE_Thread_Manager::at_exit (ACE_At_Thread_Exit* at)
{
@@ -211,6 +248,7 @@ ACE_Thread_Manager::at_exit (ACE_At_Thread_Exit* at)
else
return td->at_exit (at);
}
+
ACE_INLINE int
ACE_Thread_Manager::at_exit (ACE_At_Thread_Exit& at)
{
@@ -220,6 +258,7 @@ ACE_Thread_Manager::at_exit (ACE_At_Thread_Exit& at)
else
return td->at_exit (at);
}
+
ACE_INLINE int
ACE_Thread_Manager::at_exit (void *object,
ACE_CLEANUP_FUNC cleanup_hook,
@@ -233,16 +272,19 @@ ACE_Thread_Manager::at_exit (void *object,
cleanup_hook,
param);
}
+
ACE_INLINE void
ACE_Thread_Manager::wait_on_exit (int do_wait)
{
this->automatic_wait_ = do_wait;
}
+
ACE_INLINE int
ACE_Thread_Manager::wait_on_exit (void)
{
return this->automatic_wait_;
}
+
ACE_INLINE int
ACE_Thread_Manager::register_as_terminated (ACE_Thread_Descriptor *td)
{
@@ -255,9 +297,11 @@ ACE_Thread_Manager::register_as_terminated (ACE_Thread_Descriptor *td)
#endif /* !ACE_HAS_VXTHREADS */
return 0;
}
+
ACE_INLINE size_t
ACE_Thread_Manager::count_threads (void) const
{
return this->thr_list_.size ();
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Thread_Mutex.cpp b/dep/ACE_wrappers/ace/Thread_Mutex.cpp
index e2172fd576c..1681aead6f9 100644
--- a/dep/ACE_wrappers/ace/Thread_Mutex.cpp
+++ b/dep/ACE_wrappers/ace/Thread_Mutex.cpp
@@ -7,35 +7,47 @@
*
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
+
#include "ace/Thread_Mutex.h"
+
#if defined (ACE_HAS_THREADS)
+
#if !defined (__ACE_INLINE__)
#include "ace/Thread_Mutex.inl"
#endif /* __ACE_INLINE__ */
+
#include "ace/Log_Msg.h"
#include "ace/Malloc_T.h"
+
ACE_RCSID(ace, Thread_Mutex, "$Id: Thread_Mutex.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_Thread_Mutex)
+
void
ACE_Thread_Mutex::dump (void) const
{
#if defined (ACE_HAS_DUMP)
// ACE_TRACE ("ACE_Thread_Mutex::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n")));
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
ACE_Thread_Mutex::~ACE_Thread_Mutex (void)
{
// ACE_TRACE ("ACE_Thread_Mutex::~ACE_Thread_Mutex");
this->remove ();
}
+
ACE_Thread_Mutex::ACE_Thread_Mutex (const ACE_TCHAR *name, ACE_mutexattr_t *arg)
: removed_ (false)
{
// ACE_TRACE ("ACE_Thread_Mutex::ACE_Thread_Mutex");
+
if (ACE_OS::thread_mutex_init (&this->lock_,
0,
name,
@@ -44,6 +56,8 @@ ACE_Thread_Mutex::ACE_Thread_Mutex (const ACE_TCHAR *name, ACE_mutexattr_t *arg)
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_Thread_Mutex::ACE_Thread_Mutex")));
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_THREADS */
diff --git a/dep/ACE_wrappers/ace/Thread_Mutex.h b/dep/ACE_wrappers/ace/Thread_Mutex.h
index 2e9fdeceadb..0a1b1cae2af 100644
--- a/dep/ACE_wrappers/ace/Thread_Mutex.h
+++ b/dep/ACE_wrappers/ace/Thread_Mutex.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file Thread_Mutex.h
@@ -10,20 +11,27 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//==========================================================================
+
#ifndef ACE_THREAD_MUTEX_H
#define ACE_THREAD_MUTEX_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if !defined (ACE_HAS_THREADS)
# include "ace/Null_Mutex.h"
#else /* ACE_HAS_THREADS */
// ACE platform supports some form of threading.
+
#include /**/ "ace/ACE_export.h"
#include "ace/OS_NS_Thread.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Thread_Mutex
*
@@ -46,16 +54,20 @@ public:
/// Constructor.
ACE_Thread_Mutex (const ACE_TCHAR *name = 0,
ACE_mutexattr_t *attributes = 0);
+
/// Implicitly destroy the mutex.
~ACE_Thread_Mutex (void);
+
/**
* Explicitly destroy the mutex. Note that only one thread should
* call this method since it doesn't protect against race
* conditions.
*/
int remove (void);
+
/// Acquire lock ownership (wait on queue if necessary).
int acquire (void);
+
/**
* Block the thread until we acquire the mutex or until @a tv times
* out, in which case -1 is returned with @c errno == @c ETIME. Note
@@ -64,6 +76,7 @@ public:
* actual (absolute) acquisition time.
*/
int acquire (ACE_Time_Value &tv);
+
/**
* If @a tv == 0 the call <acquire()> directly. Otherwise, Block the
* thread until we acquire the mutex or until @a tv times out, in
@@ -73,26 +86,31 @@ public:
* (absolute) acquisition time.
*/
int acquire (ACE_Time_Value *tv);
+
/**
* Conditionally acquire lock (i.e., don't wait on queue). Returns
* -1 on failure. If we "failed" because someone else already had
* the lock, @c errno is set to @c EBUSY.
*/
int tryacquire (void);
+
/// Release lock and unblock a thread at head of queue.
int release (void);
+
/**
* Acquire mutex ownership. This calls acquire() and is only here
* to make the ACE_Thread_Mutex interface consistent with the
* other synchronization APIs.
*/
int acquire_read (void);
+
/**
* Acquire mutex ownership. This calls acquire() and is only here
* to make the ACE_Thread_Mutex interface consistent with the
* other synchronization APIs.
*/
int acquire_write (void);
+
/**
* Conditionally acquire mutex (i.e., won't block). This calls
* tryacquire() and is only here to make the ACE_Thread_Mutex
@@ -101,6 +119,7 @@ public:
* already had the lock, @c errno is set to @c EBUSY.
*/
int tryacquire_read (void);
+
/**
* Conditionally acquire mutex (i.e., won't block). This calls
* tryacquire() and is only here to make the ACE_Thread_Mutex
@@ -109,6 +128,7 @@ public:
* already had the lock, @c errno is set to @c EBUSY.
*/
int tryacquire_write (void);
+
/**
* This is only here to make the ACE_Thread_Mutex
* interface consistent with the other synchronization APIs.
@@ -116,31 +136,41 @@ public:
* the above calls, and returns 0 (success) always.
*/
int tryacquire_write_upgrade (void);
+
/// Return the underlying mutex.
const ACE_thread_mutex_t &lock (void) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
// protected:
/// Mutex type that supports single-process locking efficiently.
ACE_thread_mutex_t lock_;
+
/// Keeps track of whether remove() has been called yet to avoid
/// multiple <remove> calls, e.g., explicitly and implicitly in the
/// destructor. This flag isn't protected by a lock, so make sure
/// that you don't have multiple threads simultaneously calling
/// <remove> on the same object, which is a bad idea anyway...
bool removed_;
+
private:
// = Prevent assignment and initialization.
void operator= (const ACE_Thread_Mutex &);
ACE_Thread_Mutex (const ACE_Thread_Mutex &);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Thread_Mutex.inl"
#endif /* __ACE_INLINE__ */
+
#endif /* !ACE_HAS_THREADS */
+
#include /**/ "ace/post.h"
#endif /* ACE_THREAD_MUTEX_H */
diff --git a/dep/ACE_wrappers/ace/Thread_Mutex.inl b/dep/ACE_wrappers/ace/Thread_Mutex.inl
index 14a6c0cc8c6..ff744684c2b 100644
--- a/dep/ACE_wrappers/ace/Thread_Mutex.inl
+++ b/dep/ACE_wrappers/ace/Thread_Mutex.inl
@@ -1,73 +1,86 @@
// -*- C++ -*-
//
// $Id: Thread_Mutex.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE const ACE_thread_mutex_t &
ACE_Thread_Mutex::lock (void) const
{
// ACE_TRACE ("ACE_Thread_Mutex::lock");
return this->lock_;
}
+
ACE_INLINE int
ACE_Thread_Mutex::acquire_read (void)
{
// ACE_TRACE ("ACE_Thread_Mutex::acquire_read");
return ACE_OS::thread_mutex_lock (&this->lock_);
}
+
ACE_INLINE int
ACE_Thread_Mutex::acquire_write (void)
{
// ACE_TRACE ("ACE_Thread_Mutex::acquire_write");
return ACE_OS::thread_mutex_lock (&this->lock_);
}
+
ACE_INLINE int
ACE_Thread_Mutex::tryacquire_read (void)
{
// ACE_TRACE ("ACE_Thread_Mutex::tryacquire_read");
return ACE_OS::thread_mutex_trylock (&this->lock_);
}
+
ACE_INLINE int
ACE_Thread_Mutex::tryacquire_write (void)
{
// ACE_TRACE ("ACE_Thread_Mutex::tryacquire_write");
return ACE_OS::thread_mutex_trylock (&this->lock_);
}
+
ACE_INLINE int
ACE_Thread_Mutex::tryacquire_write_upgrade (void)
{
// ACE_TRACE ("ACE_Thread_Mutex::tryacquire_write_upgrade");
return 0;
}
+
ACE_INLINE int
ACE_Thread_Mutex::acquire (void)
{
// ACE_TRACE ("ACE_Thread_Mutex::acquire");
return ACE_OS::thread_mutex_lock (&this->lock_);
}
+
ACE_INLINE int
ACE_Thread_Mutex::acquire (ACE_Time_Value &tv)
{
// ACE_TRACE ("ACE_Thread_Mutex::acquire");
return ACE_OS::thread_mutex_lock (&this->lock_, tv);
}
+
ACE_INLINE int
ACE_Thread_Mutex::acquire (ACE_Time_Value *tv)
{
// ACE_TRACE ("ACE_Thread_Mutex::acquire");
return ACE_OS::thread_mutex_lock (&this->lock_, tv);
}
+
ACE_INLINE int
ACE_Thread_Mutex::tryacquire (void)
{
// ACE_TRACE ("ACE_Thread_Mutex::tryacquire");
return ACE_OS::thread_mutex_trylock (&this->lock_);
}
+
ACE_INLINE int
ACE_Thread_Mutex::release (void)
{
// ACE_TRACE ("ACE_Thread_Mutex::release");
return ACE_OS::thread_mutex_unlock (&this->lock_);
}
+
ACE_INLINE int
ACE_Thread_Mutex::remove (void)
{
@@ -80,4 +93,5 @@ ACE_Thread_Mutex::remove (void)
}
return result;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Thread_Semaphore.cpp b/dep/ACE_wrappers/ace/Thread_Semaphore.cpp
index 4059caa204c..13bab6ff340 100644
--- a/dep/ACE_wrappers/ace/Thread_Semaphore.cpp
+++ b/dep/ACE_wrappers/ace/Thread_Semaphore.cpp
@@ -7,23 +7,32 @@
*
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
+
#include "ace/Thread_Semaphore.h"
+
#if defined (ACE_HAS_THREADS)
+
#if !defined (__ACE_INLINE__)
#include "ace/Thread_Semaphore.inl"
#endif /* __ACE_INLINE__ */
+
#include "ace/ACE.h"
+
ACE_RCSID(ace, Thread_Semaphore, "$Id: Thread_Semaphore.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
void
ACE_Thread_Semaphore::dump (void) const
{
#if defined (ACE_HAS_DUMP)
// ACE_TRACE ("ACE_Thread_Semaphore::dump");
+
ACE_Semaphore::dump ();
#endif /* ACE_HAS_DUMP */
}
+
ACE_Thread_Semaphore::ACE_Thread_Semaphore (unsigned int count,
const ACE_TCHAR *name,
void *arg,
@@ -32,7 +41,9 @@ ACE_Thread_Semaphore::ACE_Thread_Semaphore (unsigned int count,
{
// ACE_TRACE ("ACE_Thread_Semaphore::ACE_Thread_Semaphore");
}
+
/*****************************************************************************/
+
ACE_Thread_Semaphore *
ACE_Malloc_Lock_Adapter_T<ACE_Thread_Semaphore>::operator () (const ACE_TCHAR *name)
{
@@ -45,6 +56,8 @@ ACE_Malloc_Lock_Adapter_T<ACE_Thread_Semaphore>::operator () (const ACE_TCHAR *n
0);
return p;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_THREADS */
diff --git a/dep/ACE_wrappers/ace/Thread_Semaphore.h b/dep/ACE_wrappers/ace/Thread_Semaphore.h
index c607d68a4e8..e6a9d008e68 100644
--- a/dep/ACE_wrappers/ace/Thread_Semaphore.h
+++ b/dep/ACE_wrappers/ace/Thread_Semaphore.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file Thread_Semaphore.h
@@ -10,19 +11,26 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//==========================================================================
+
#ifndef ACE_THREAD_SEMAPHORE_H
#define ACE_THREAD_SEMAPHORE_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if !defined (ACE_HAS_THREADS)
# include "ace/Null_Semaphore.h"
#else /* ACE_HAS_THREADS */
// ACE platform supports some form of threading.
+
#include "ace/Semaphore.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Thread_Semaphore
*
@@ -38,15 +46,21 @@ public:
const ACE_TCHAR *name = 0,
void * = 0,
int max = 0x7FFFFFFF);
+
/// Default dtor.
~ACE_Thread_Semaphore (void);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
};
+
/*****************************************************************************/
+
template <class T> class ACE_Malloc_Lock_Adapter_T;
+
/**
* @class ACE_Malloc_Lock_Adapter_T<ACE_Thread_Semaphore>
*
@@ -62,11 +76,15 @@ class ACE_Export ACE_Malloc_Lock_Adapter_T<ACE_Thread_Semaphore>
public:
ACE_Thread_Semaphore * operator () (const ACE_TCHAR *name);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Thread_Semaphore.inl"
#endif /* __ACE_INLINE__ */
+
#endif /* !ACE_HAS_THREADS */
+
#include /**/ "ace/post.h"
#endif /* ACE_THREAD_SEMAPHORE_H */
diff --git a/dep/ACE_wrappers/ace/Thread_Semaphore.inl b/dep/ACE_wrappers/ace/Thread_Semaphore.inl
index 93d5fc79ef7..b64ec3c08f5 100644
--- a/dep/ACE_wrappers/ace/Thread_Semaphore.inl
+++ b/dep/ACE_wrappers/ace/Thread_Semaphore.inl
@@ -1,9 +1,12 @@
// -*- C++ -*-
//
// $Id: Thread_Semaphore.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_Thread_Semaphore::~ACE_Thread_Semaphore (void)
{
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Throughput_Stats.cpp b/dep/ACE_wrappers/ace/Throughput_Stats.cpp
index 5c08d759d97..5e2288a39b7 100644
--- a/dep/ACE_wrappers/ace/Throughput_Stats.cpp
+++ b/dep/ACE_wrappers/ace/Throughput_Stats.cpp
@@ -1,11 +1,16 @@
// $Id: Throughput_Stats.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Throughput_Stats.h"
+
#include "ace/OS_NS_stdio.h"
#include "ace/OS_NS_string.h"
#include "ace/High_Res_Timer.h"
#include "ace/Log_Msg.h"
+
ACE_RCSID(ace, Throughput_Stats, "$Id: Throughput_Stats.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_Throughput_Stats::ACE_Throughput_Stats (void)
: ACE_Basic_Stats ()
, throughput_last_ (0)
@@ -20,13 +25,16 @@ ACE_Throughput_Stats::ACE_Throughput_Stats (void)
#endif /* 0 */
{
}
+
void
ACE_Throughput_Stats::sample (ACE_UINT64 throughput,
ACE_UINT64 latency)
{
this->ACE_Basic_Stats::sample (latency);
+
if (this->samples_count () == 1u)
{
+
this->throughput_last_ = throughput;
#if 0
// @@TODO: This is what I really wanted to compute, but it just
@@ -36,12 +44,14 @@ ACE_Throughput_Stats::sample (ACE_UINT64 throughput,
this->throughput_sum_x_ = throughput;
this->throughput_sum_x2_ = throughput * throughput;
this->throughput_sum_xy_ = throughput * this->samples_count_;
+
ACE_OS::printf ("%f %qu\n", throughput / 400000000.0, this->samples_count_);
#endif /* 0 */
}
else
{
this->throughput_last_ = throughput;
+
#if 0
// @@TODO: This is what I really wanted to compute, but it just
// does not work.
@@ -50,16 +60,20 @@ ACE_Throughput_Stats::sample (ACE_UINT64 throughput,
this->throughput_sum_x_ += throughput;
this->throughput_sum_x2_ += throughput * throughput;
this->throughput_sum_xy_ += throughput * this->samples_count_;
+
ACE_OS::printf ("%f %qu\n", throughput / 400000000.0, this->samples_count_);
#endif /* 0 */
}
}
+
void
ACE_Throughput_Stats::accumulate (const ACE_Throughput_Stats &rhs)
{
if (rhs.samples_count () == 0u)
return;
+
this->ACE_Basic_Stats::accumulate (rhs);
+
if (this->samples_count () == 0u)
{
this->throughput_last_ = rhs.throughput_last_;
@@ -72,11 +86,14 @@ ACE_Throughput_Stats::accumulate (const ACE_Throughput_Stats &rhs)
this->throughput_sum_y2_ = rhs.throughput_sum_y2_;
this->throughput_sum_xy_ = rhs.throughput_sum_xy_;
#endif /* 0 */
+
return;
}
+
if (this->throughput_last_ < rhs.throughput_last_)
this->throughput_last_ = rhs.throughput_last_;
+
#if 0
// @@TODO: This is what I really wanted to compute, but it just
// does not work.
@@ -87,6 +104,7 @@ ACE_Throughput_Stats::accumulate (const ACE_Throughput_Stats &rhs)
this->throughput_sum_xy_ += rhs.throughput_sum_xy_;
#endif /* 0 */
}
+
void
ACE_Throughput_Stats::dump_results (const ACE_TCHAR* msg,
ACE_UINT32 sf)
@@ -97,10 +115,13 @@ ACE_Throughput_Stats::dump_results (const ACE_TCHAR* msg,
ACE_TEXT ("%s : no data collected\n"), msg));
return;
}
+
this->ACE_Basic_Stats::dump_results (msg, sf);
+
ACE_Throughput_Stats::dump_throughput (msg, sf,
this->throughput_last_,
this->samples_count ());
+
#if 0
// @@TODO: This is what I really wanted to generate, but it just
// doesn't work.
@@ -120,11 +141,14 @@ ACE_Throughput_Stats::dump_results (const ACE_TCHAR* msg,
//t_sum_xy /= 1000000.0;
double t_avgx = t_sum_x / this->samples_count ();
double t_avgy = t_sum_y / this->samples_count ();
+
double t_a =
(this->samples_count () * t_sum_xy - t_sum_x * t_sum_y)
/ (this->samples_count () * t_sum_x2 - t_sum_x * t_sum_x);
double t_b = (t_avgy - t_a * t_avgx);
+
t_a *= 1000000.0;
+
double d_r =
(t_sum_xy - t_avgx * t_sum_y - t_avgy * t_sum_x
+ this->samples_count () * t_avgx * t_avgy);
@@ -134,6 +158,7 @@ ACE_Throughput_Stats::dump_results (const ACE_TCHAR* msg,
* (t_sum_y2
- this->samples_count () * t_avgy * t_avgy);
double t_r = d_r * d_r / n_r;
+
// ACE_DEBUG ((LM_DEBUG,
// "%s throughput: %.2f/%.2f/%.2f/%.6f/%.2f (avg/a/b/r/elapsed)\n",
// msg, t_avg, t_a, t_b, t_r, seconds));
@@ -142,6 +167,7 @@ ACE_Throughput_Stats::dump_results (const ACE_TCHAR* msg,
// msg, t_sum_x, t_sum_x2, t_sum_y, t_sum_y2, t_sum_xy));
#endif
}
+
void
ACE_Throughput_Stats::dump_throughput (const ACE_TCHAR *msg,
ACE_UINT32 sf,
@@ -159,7 +185,9 @@ ACE_Throughput_Stats::dump_throughput (const ACE_TCHAR *msg,
static_cast<double> (ACE_UINT64_DBLCAST_ADAPTER (elapsed_time / sf));
# endif /* ! ACE_LACKS_LONGLONG_T */
seconds /= ACE_HR_SCALE_CONVERSION;
+
const double t_avg = samples_count / seconds;
+
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("%s throughput: %.2f (events/second)\n"),
msg, t_avg));
@@ -170,5 +198,6 @@ ACE_Throughput_Stats::dump_throughput (const ACE_TCHAR *msg,
ACE_UNUSED_ARG (samples_count);
#endif /* ACE_NLOGGING */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Throughput_Stats.h b/dep/ACE_wrappers/ace/Throughput_Stats.h
index 3965a561969..66e57eee699 100644
--- a/dep/ACE_wrappers/ace/Throughput_Stats.h
+++ b/dep/ACE_wrappers/ace/Throughput_Stats.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file Throughput_Stats.h
@@ -9,15 +10,22 @@
*/
//==========================================================================
+
#ifndef ACE_THROUGHPUT_STATS_H
#define ACE_THROUGHPUT_STATS_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Basic_Stats.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/// A simple class to make throughput and latency analysis.
/**
*
@@ -39,12 +47,16 @@ class ACE_Export ACE_Throughput_Stats : public ACE_Basic_Stats
public:
/// Constructor
ACE_Throughput_Stats (void);
+
/// Store one sample
void sample (ACE_UINT64 throughput, ACE_UINT64 latency);
+
/// Update the values to reflect the stats in @a throughput
void accumulate (const ACE_Throughput_Stats &throughput);
+
/// Print down the stats
void dump_results (const ACE_TCHAR* msg, ACE_UINT32 scale_factor);
+
/// Dump the average throughput stats.
static void dump_throughput (const ACE_TCHAR *msg,
ACE_UINT32 scale_factor,
@@ -53,6 +65,7 @@ public:
private:
/// The last throughput measurement.
ACE_UINT64 throughput_last_;
+
#if 0
/// These are the fields that we should keep to perform linear
/// regression
@@ -65,7 +78,10 @@ private:
ACE_UINT64 throughput_sum_xy_;
#endif /* 0 */
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
+
#endif /* ! ACE_THROUGHPUT_STATS_H */
diff --git a/dep/ACE_wrappers/ace/Time_Value.cpp b/dep/ACE_wrappers/ace/Time_Value.cpp
index ef7b220eab3..86db481f042 100644
--- a/dep/ACE_wrappers/ace/Time_Value.cpp
+++ b/dep/ACE_wrappers/ace/Time_Value.cpp
@@ -1,17 +1,23 @@
#include "ace/Time_Value.h"
+
ACE_RCSID (ace,
Time_Value,
"$Id: Time_Value.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if !defined (__ACE_INLINE__)
#include "ace/Time_Value.inl"
#endif /* __ACE_INLINE__ */
+
#include "ace/Numeric_Limits.h"
#include "ace/If_Then_Else.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Static constant representing `zero-time'.
// Note: this object requires static construction.
const ACE_Time_Value ACE_Time_Value::zero;
+
// Constant for maximum time representable. Note that this time
// is not intended for use with select () or other calls that may
// have *their own* implementation-specific maximum time representations.
@@ -21,9 +27,12 @@ const ACE_Time_Value ACE_Time_Value::zero;
const ACE_Time_Value ACE_Time_Value::max_time (
ACE_Numeric_Limits<time_t>::max (),
ACE_ONE_SECOND_IN_USECS - 1);
+
ACE_ALLOC_HOOK_DEFINE (ACE_Time_Value)
+
// Increment microseconds (the only reason this is here is to allow
// the use of ACE_Atomic_Op with ACE_Time_Value).
+
ACE_Time_Value
ACE_Time_Value::operator ++ (int)
{
@@ -32,6 +41,7 @@ ACE_Time_Value::operator ++ (int)
++*this;
return tv;
}
+
ACE_Time_Value &
ACE_Time_Value::operator ++ (void)
{
@@ -40,8 +50,10 @@ ACE_Time_Value::operator ++ (void)
this->normalize ();
return *this;
}
+
// Decrement microseconds (the only reason this is here is / to allow
// the use of ACE_Atomic_Op with ACE_Time_Value).
+
ACE_Time_Value
ACE_Time_Value::operator -- (int)
{
@@ -50,6 +62,7 @@ ACE_Time_Value::operator -- (int)
--*this;
return tv;
}
+
ACE_Time_Value &
ACE_Time_Value::operator -- (void)
{
@@ -58,6 +71,7 @@ ACE_Time_Value::operator -- (void)
this->normalize ();
return *this;
}
+
#if defined (ACE_WIN32)
// Static constant to remove time skew between FILETIME and POSIX
// time. POSIX and Win32 use different epochs (Jan. 1, 1970 v.s.
@@ -73,12 +87,15 @@ ACE_U_LongLong (0xd53e8000, 0x19db1de);
const DWORDLONG ACE_Time_Value::FILETIME_to_timval_skew =
ACE_INT64_LITERAL (0x19db1ded53e8000);
# endif
+
// Initializes the ACE_Time_Value object from a Win32 FILETIME
+
ACE_Time_Value::ACE_Time_Value (const FILETIME &file_time)
{
// // ACE_OS_TRACE ("ACE_Time_Value::ACE_Time_Value");
this->set (file_time);
}
+
void ACE_Time_Value::set (const FILETIME &file_time)
{
// Initializes the ACE_Time_Value object from a Win32 FILETIME
@@ -94,7 +111,9 @@ void ACE_Time_Value::set (const FILETIME &file_time)
ULARGE_INTEGER _100ns;
_100ns.LowPart = file_time.dwLowDateTime;
_100ns.HighPart = file_time.dwHighDateTime;
+
_100ns.QuadPart -= ACE_Time_Value::FILETIME_to_timval_skew;
+
// Convert 100ns units to seconds;
this->tv_.tv_sec = (long) (_100ns.QuadPart / (10000 * 1000));
// Convert remainder to microseconds;
@@ -102,11 +121,14 @@ void ACE_Time_Value::set (const FILETIME &file_time)
#endif // ACE_LACKS_LONGLONG_T
this->normalize ();
}
+
// Returns the value of the object as a Win32 FILETIME.
+
ACE_Time_Value::operator FILETIME () const
{
FILETIME file_time;
// ACE_OS_TRACE ("ACE_Time_Value::operator FILETIME");
+
#if defined (ACE_LACKS_LONGLONG_T)
ACE_U_LongLong LL_sec(this->tv_.tv_sec);
ACE_U_LongLong LL_usec(this->tv_.tv_usec);
@@ -120,12 +142,16 @@ ACE_Time_Value::operator FILETIME () const
_100ns.QuadPart = (((DWORDLONG) this->tv_.tv_sec * (10000 * 1000) +
this->tv_.tv_usec * 10) +
ACE_Time_Value::FILETIME_to_timval_skew);
+
file_time.dwLowDateTime = _100ns.LowPart;
file_time.dwHighDateTime = _100ns.HighPart;
#endif //ACE_LACKS_LONGLONG_T
+
return file_time;
}
+
#endif /* ACE_WIN32 */
+
void
ACE_Time_Value::dump (void) const
{
@@ -139,11 +165,13 @@ ACE_Time_Value::dump (void) const
#endif /* 0 */
#endif /* ACE_HAS_DUMP */
}
+
void
ACE_Time_Value::normalize (void)
{
// // ACE_OS_TRACE ("ACE_Time_Value::normalize");
// From Hans Rohnert...
+
if (this->tv_.tv_usec >= ACE_ONE_SECOND_IN_USECS)
{
/*! \todo This loop needs some optimization.
@@ -166,6 +194,7 @@ ACE_Time_Value::normalize (void)
}
while (this->tv_.tv_usec <= -ACE_ONE_SECOND_IN_USECS);
}
+
if (this->tv_.tv_sec >= 1 && this->tv_.tv_usec < 0)
{
--this->tv_.tv_sec;
@@ -181,6 +210,7 @@ ACE_Time_Value::normalize (void)
#endif /* __QNXNTO__ */
}
+
ACE_Time_Value &
ACE_Time_Value::operator *= (double d)
{
@@ -197,29 +227,39 @@ ACE_Time_Value::operator *= (double d)
typedef ACE::If_Then_Else<(sizeof (double) > sizeof (time_t)),
double,
long double>::result_type float_type;
+
float_type time_total =
(this->sec ()
+ static_cast<float_type> (this->usec ()) / ACE_ONE_SECOND_IN_USECS) * d;
+
// shall we saturate the result?
static const float_type max_int =
ACE_Numeric_Limits<time_t>::max () + 0.999999;
static const float_type min_int =
ACE_Numeric_Limits<time_t>::min () - 0.999999;
+
if (time_total > max_int)
time_total = max_int;
if (time_total < min_int)
time_total = min_int;
+
const time_t time_sec = static_cast<time_t> (time_total);
+
time_total -= time_sec;
time_total *= ACE_ONE_SECOND_IN_USECS;
+
suseconds_t time_usec = static_cast<suseconds_t> (time_total);
+
// round up the result to save the last usec
if (time_usec > 0 && (time_total - time_usec) >= 0.5)
++time_usec;
else if (time_usec < 0 && (time_total - time_usec) <= -0.5)
--time_usec;
+
this->set (time_sec, time_usec);
+
return *this;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Time_Value.h b/dep/ACE_wrappers/ace/Time_Value.h
index f434e7a55be..ae75cc1c9de 100644
--- a/dep/ACE_wrappers/ace/Time_Value.h
+++ b/dep/ACE_wrappers/ace/Time_Value.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Time_Value.h
@@ -8,28 +9,38 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_TIME_VALUE_H
#define ACE_TIME_VALUE_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
# include "ace/os_include/os_time.h"
+
// Define some helpful constants.
// Not type-safe, and signed. For backward compatibility.
#define ACE_ONE_SECOND_IN_MSECS 1000L
suseconds_t const ACE_ONE_SECOND_IN_USECS = 1000000;
#define ACE_ONE_SECOND_IN_NSECS 1000000000L
+
// needed for ACE_UINT64
#include "ace/Basic_Types.h"
+
// This forward declaration is needed by the set() and FILETIME() functions
#if defined (ACE_LACKS_LONGLONG_T)
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
class ACE_Export ACE_U_LongLong;
ACE_END_VERSIONED_NAMESPACE_DECL
#endif /* ACE_LACKS_LONGLONG_T */
+
// -------------------------------------------------------------------
+
/**
* @class ACE_Time_Value
*
@@ -49,12 +60,16 @@ ACE_END_VERSIONED_NAMESPACE_DECL
// - Steve Huston, 23-Aug-2004
extern "C++" {
#endif
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Export ACE_Time_Value
{
public:
+
/// Constant "0".
static const ACE_Time_Value zero;
+
/**
* Constant for maximum time representable. Note that this time is
* not intended for use with <select> or other calls that may have
@@ -64,33 +79,46 @@ public:
* class.
*/
static const ACE_Time_Value max_time;
+
// = Initialization methods.
+
/// Default Constructor.
ACE_Time_Value (void);
+
/// Constructor.
explicit ACE_Time_Value (time_t sec, suseconds_t usec = 0);
+
// = Methods for converting to/from various time formats.
+
/// Construct the ACE_Time_Value from a timeval.
explicit ACE_Time_Value (const struct timeval &t);
+
/// Construct the ACE_Time_Value object from a timespec_t.
explicit ACE_Time_Value (const timespec_t &t);
+
# if defined (ACE_WIN32)
/// Construct the ACE_Time_Value object from a Win32 FILETIME
explicit ACE_Time_Value (const FILETIME &ft);
# endif /* ACE_WIN32 */
+
/// Initializes the ACE_Time_Value from seconds and useconds.
void set (time_t sec, suseconds_t usec);
+
/// Initializes the ACE_Time_Value from a double, which is assumed to be
/// in second format, with any remainder treated as microseconds.
void set (double d);
+
/// Initializes the ACE_Time_Value from a timeval.
void set (const timeval &t);
+
/// Initializes the ACE_Time_Value object from a timespec_t.
void set (const timespec_t &t);
+
# if defined (ACE_WIN32)
/// Initializes the ACE_Time_Value object from a Win32 FILETIME.
void set (const FILETIME &ft);
# endif /* ACE_WIN32 */
+
/// Converts from ACE_Time_Value format into milliseconds format.
/**
* @return Sum of second field (in milliseconds) and microsecond field
@@ -103,6 +131,7 @@ public:
* component in an ACE_Time_Value.
*/
unsigned long msec (void) const;
+
/// Converts from ACE_Time_Value format into milliseconds format.
/**
* @return Sum of second field (in milliseconds) and microsecond field
@@ -113,6 +142,7 @@ public:
* component in an ACE_Time_Value.
*/
void msec (ACE_UINT64 &ms) const;
+
/// Converts from ACE_Time_Value format into milliseconds format.
/**
* @return Sum of second field (in milliseconds) and microsecond field
@@ -123,6 +153,7 @@ public:
* component in an ACE_Time_Value.
*/
void msec (ACE_UINT64 &ms) /* const */;
+
/// Converts from milli-seconds format into ACE_Time_Value format.
/**
* @note The semantics of this method differs from the sec() and
@@ -130,6 +161,7 @@ public:
* component in an ACE_Time_Value.
*/
void msec (long);
+
/// Converts from milli-seconds format into ACE_Time_Value format.
/**
* @note The semantics of this method differs from the sec() and
@@ -137,17 +169,23 @@ public:
* component in an ACE_Time_Value.
*/
void msec (int); // converted to long then calls above.
+
/// Returns the value of the object as a timespec_t.
operator timespec_t () const;
+
/// Returns the value of the object as a timeval.
operator timeval () const;
+
/// Returns a pointer to the object as a timeval.
operator const timeval *() const;
+
# if defined (ACE_WIN32)
/// Returns the value of the object as a Win32 FILETIME.
operator FILETIME () const;
# endif /* ACE_WIN32 */
+
// = The following are accessor/mutator methods.
+
/// Get seconds.
/**
* @return The second field/component of this ACE_Time_Value.
@@ -156,8 +194,10 @@ public:
* method.
*/
time_t sec (void) const;
+
/// Set seconds.
void sec (time_t sec);
+
/// Get microseconds.
/**
* @return The microsecond field/component of this ACE_Time_Value.
@@ -166,26 +206,36 @@ public:
* method.
*/
suseconds_t usec (void) const;
+
/// Set microseconds.
void usec (suseconds_t usec);
+
/**
* @return Sum of second field (in microseconds) and microsecond field
* and return them via the @param usec parameter.
*/
void to_usec (ACE_UINT64 &usec) const;
+
// = The following arithmetic methods operate on ACE_Time_Value's.
+
/// Add @a tv to this.
ACE_Time_Value &operator += (const ACE_Time_Value &tv);
+
/// Add @a tv to this.
ACE_Time_Value &operator += (time_t tv);
+
/// Assign @ tv to this
ACE_Time_Value &operator = (const ACE_Time_Value &tv);
+
/// Assign @ tv to this
ACE_Time_Value &operator = (time_t tv);
+
/// Subtract @a tv to this.
ACE_Time_Value &operator -= (const ACE_Time_Value &tv);
+
/// Substract @a tv to this.
ACE_Time_Value &operator -= (time_t tv);
+
/**
\brief Multiply the time value by the @a d factor.
\note The result of the operator is valid for results from range
@@ -193,61 +243,76 @@ public:
outside this range are saturated to a limit.
*/
ACE_Time_Value &operator *= (double d);
+
/// Increment microseconds as postfix.
/**
* @note The only reason this is here is to allow the use of ACE_Atomic_Op
* with ACE_Time_Value.
*/
ACE_Time_Value operator++ (int);
+
/// Increment microseconds as prefix.
/**
* @note The only reason this is here is to allow the use of ACE_Atomic_Op
* with ACE_Time_Value.
*/
ACE_Time_Value &operator++ (void);
+
/// Decrement microseconds as postfix.
/**
* @note The only reason this is here is to allow the use of ACE_Atomic_Op
* with ACE_Time_Value.
*/
ACE_Time_Value operator-- (int);
+
/// Decrement microseconds as prefix.
/**
* @note The only reason this is here is to allow the use of ACE_Atomic_Op
* with ACE_Time_Value.
*/
ACE_Time_Value &operator-- (void);
+
/// Adds two ACE_Time_Value objects together, returns the sum.
friend ACE_Export ACE_Time_Value operator + (const ACE_Time_Value &tv1,
const ACE_Time_Value &tv2);
+
/// Subtracts two ACE_Time_Value objects, returns the difference.
friend ACE_Export ACE_Time_Value operator - (const ACE_Time_Value &tv1,
const ACE_Time_Value &tv2);
+
/// True if @a tv1 < @a tv2.
friend ACE_Export bool operator < (const ACE_Time_Value &tv1,
const ACE_Time_Value &tv2);
+
/// True if @a tv1 > @a tv2.
friend ACE_Export bool operator > (const ACE_Time_Value &tv1,
const ACE_Time_Value &tv2);
+
/// True if @a tv1 <= @a tv2.
friend ACE_Export bool operator <= (const ACE_Time_Value &tv1,
const ACE_Time_Value &tv2);
+
/// True if @a tv1 >= @a tv2.
friend ACE_Export bool operator >= (const ACE_Time_Value &tv1,
const ACE_Time_Value &tv2);
+
/// True if @a tv1 == @a tv2.
friend ACE_Export bool operator == (const ACE_Time_Value &tv1,
const ACE_Time_Value &tv2);
+
/// True if @a tv1 != @a tv2.
friend ACE_Export bool operator != (const ACE_Time_Value &tv1,
const ACE_Time_Value &tv2);
+
//@{
/// Multiplies the time value by @a d
friend ACE_Export ACE_Time_Value operator * (double d,
const ACE_Time_Value &tv);
+
friend ACE_Export ACE_Time_Value operator * (const ACE_Time_Value &tv,
double d);
//@}
+
/// Dump is a no-op.
/**
* The dump() method is a no-op. It's here for backwards compatibility
@@ -256,6 +321,7 @@ public:
* of the OS layer and @c ACE_Log_Msg is at a higher level.
*/
void dump (void) const;
+
# if defined (ACE_WIN32)
/// Const time difference between FILETIME and POSIX time.
# if defined (ACE_LACKS_LONGLONG_T)
@@ -264,9 +330,11 @@ public:
static const DWORDLONG FILETIME_to_timval_skew;
# endif // ACE_LACKS_LONGLONG_T
# endif /* ACE_WIN32 */
+
private:
/// Put the timevalue into a canonical form.
void normalize (void);
+
/// Store the values as a timeval.
#if defined (ACE_HAS_TIME_T_LONG_MISMATCH)
// Windows' timeval is non-conformant, so swap in a struct that conforms
@@ -286,13 +354,17 @@ private:
timeval tv_;
#endif /* ACE_HAS_TIME_T_LONG_MISMATCH */
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Time_Value.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_WIN32) && defined (_WIN32_WCE)
}
#endif
+
#if defined (__MINGW32__)
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
// The MingW linker has problems with the exported statics
@@ -302,6 +374,8 @@ static const ACE_Time_Value& __zero_time = ACE_Time_Value::zero;
static const ACE_Time_Value& __max_time = ACE_Time_Value::max_time;
ACE_END_VERSIONED_NAMESPACE_DECL
#endif /* __MINGW32__ */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_TIME_VALUE_H */
diff --git a/dep/ACE_wrappers/ace/Time_Value.inl b/dep/ACE_wrappers/ace/Time_Value.inl
index 908bae22640..27433389323 100644
--- a/dep/ACE_wrappers/ace/Time_Value.inl
+++ b/dep/ACE_wrappers/ace/Time_Value.inl
@@ -1,8 +1,11 @@
// -*- C++ -*-
//
// $Id: Time_Value.inl 82610 2008-08-12 19:46:36Z parsons $
+
#include "ace/Truncate.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_WIN32) && defined (_WIN32_WCE)
// Something is a bit brain-damaged here and I'm not sure what... this code
// compiled before the OS reorg for ACE 5.4. Since then it hasn't - eVC
@@ -12,7 +15,9 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
// - Steve Huston, 23-Aug-2004
extern "C++" {
#endif
+
// Returns the value of the object as a timeval.
+
ACE_INLINE
ACE_Time_Value::operator timeval () const
{
@@ -27,20 +32,24 @@ ACE_Time_Value::operator timeval () const
return this->tv_;
#endif /* ACE_HAS_TIME_T_LONG_MISMATCH */
}
+
ACE_INLINE void
ACE_Time_Value::set (const timeval &tv)
{
// ACE_OS_TRACE ("ACE_Time_Value::set");
this->tv_.tv_sec = tv.tv_sec;
this->tv_.tv_usec = tv.tv_usec;
+
this->normalize ();
}
+
ACE_INLINE
ACE_Time_Value::ACE_Time_Value (const struct timeval &tv)
{
// ACE_OS_TRACE ("ACE_Time_Value::ACE_Time_Value");
this->set (tv);
}
+
ACE_INLINE
ACE_Time_Value::operator const timeval * () const
{
@@ -55,6 +64,7 @@ ACE_Time_Value::operator const timeval * () const
return (const timeval *) &this->tv_;
#endif /* ACE_HAS_TIME_T_LONG_MISMATCH */
}
+
ACE_INLINE void
ACE_Time_Value::set (time_t sec, suseconds_t usec)
{
@@ -69,6 +79,7 @@ ACE_Time_Value::set (time_t sec, suseconds_t usec)
#endif
this->normalize ();
}
+
ACE_INLINE void
ACE_Time_Value::set (double d)
{
@@ -78,16 +89,20 @@ ACE_Time_Value::set (double d)
this->tv_.tv_usec = (suseconds_t) ((d - (double) l) * ACE_ONE_SECOND_IN_USECS + .5);
this->normalize ();
}
+
// Initializes a timespec_t. Note that this approach loses precision
// since it converts the nano-seconds into micro-seconds. But then
// again, do any real systems have nano-second timer precision?!
+
ACE_INLINE void
ACE_Time_Value::set (const timespec_t &tv)
{
// ACE_OS_TRACE ("ACE_Time_Value::set");
+
this->set (tv.tv_sec,
tv.tv_nsec / 1000); // Convert nanoseconds into microseconds.
}
+
ACE_INLINE
ACE_Time_Value::ACE_Time_Value (void)
// : tv_ ()
@@ -95,37 +110,46 @@ ACE_Time_Value::ACE_Time_Value (void)
// ACE_OS_TRACE ("ACE_Time_Value::ACE_Time_Value");
this->set (0, 0);
}
+
ACE_INLINE
ACE_Time_Value::ACE_Time_Value (time_t sec, suseconds_t usec)
{
// ACE_OS_TRACE ("ACE_Time_Value::ACE_Time_Value");
this->set (sec, usec);
}
+
// Returns number of seconds.
+
ACE_INLINE time_t
ACE_Time_Value::sec (void) const
{
// ACE_OS_TRACE ("ACE_Time_Value::sec");
return this->tv_.tv_sec;
}
+
// Sets the number of seconds.
+
ACE_INLINE void
ACE_Time_Value::sec (time_t sec)
{
// ACE_OS_TRACE ("ACE_Time_Value::sec");
this->tv_.tv_sec = ACE_Utils::truncate_cast<long> (sec);
}
+
// Converts from Time_Value format into milli-seconds format.
+
ACE_INLINE unsigned long
ACE_Time_Value::msec (void) const
{
// ACE_OS_TRACE ("ACE_Time_Value::msec");
+
// Note - we're truncating a value here, which can lose data. This is
// called out in the user documentation for this with a recommendation to
// use msec(ACE_UINT64&) instead, so just go ahead and truncate.
time_t secs = this->tv_.tv_sec * 1000 + this->tv_.tv_usec / 1000;
return ACE_Utils::truncate_cast<unsigned long> (secs);
}
+
ACE_INLINE void
ACE_Time_Value::msec (ACE_UINT64 &ms) const
{
@@ -134,6 +158,7 @@ ACE_Time_Value::msec (ACE_UINT64 &ms) const
ms *= 1000;
ms += (this->tv_.tv_usec / 1000);
}
+
ACE_INLINE void
ACE_Time_Value::msec (ACE_UINT64 &ms) /*const*/
{
@@ -141,7 +166,9 @@ ACE_Time_Value::msec (ACE_UINT64 &ms) /*const*/
const ACE_Time_Value *tv = this;
tv->msec (ms);
}
+
// Converts from milli-seconds format into Time_Value format.
+
ACE_INLINE void
ACE_Time_Value::msec (long milliseconds)
{
@@ -152,30 +179,38 @@ ACE_Time_Value::msec (long milliseconds)
// Convert remainder to microseconds;
this->tv_.tv_usec = (milliseconds - (secs * 1000)) * 1000;
}
+
// Converts from milli-seconds format into Time_Value format.
+
ACE_INLINE void
ACE_Time_Value::msec (int milliseconds)
{
ACE_Time_Value::msec (static_cast<long> (milliseconds));
}
+
// Returns number of micro-seconds.
+
ACE_INLINE suseconds_t
ACE_Time_Value::usec (void) const
{
// ACE_OS_TRACE ("ACE_Time_Value::usec");
return this->tv_.tv_usec;
}
+
// Sets the number of micro-seconds.
+
ACE_INLINE void
ACE_Time_Value::usec (suseconds_t usec)
{
// ACE_OS_TRACE ("ACE_Time_Value::usec");
this->tv_.tv_usec = usec;
}
+
ACE_INLINE void
ACE_Time_Value::to_usec (ACE_UINT64 & usec) const
{
// ACE_OS_TRACE ("ACE_Time_Value::to_usec");
+
#if defined (ACE_LACKS_UNSIGNEDLONGLONG_T)
usec = ACE_U_LongLong (static_cast<long long> (this->tv_.tv_sec));
#elif defined (ACE_LACKS_LONGLONG_T)
@@ -187,17 +222,21 @@ ACE_Time_Value::to_usec (ACE_UINT64 & usec) const
usec *= 1000000;
usec += this->tv_.tv_usec;
}
+
ACE_INLINE ACE_Time_Value
operator * (double d, const ACE_Time_Value &tv)
{
return ACE_Time_Value (tv) *= d;
}
+
ACE_INLINE ACE_Time_Value
operator * (const ACE_Time_Value &tv, double d)
{
return ACE_Time_Value (tv) *= d;
}
+
// True if tv1 > tv2.
+
ACE_INLINE bool
operator > (const ACE_Time_Value &tv1,
const ACE_Time_Value &tv2)
@@ -211,7 +250,9 @@ operator > (const ACE_Time_Value &tv1,
else
return 0;
}
+
// True if tv1 >= tv2.
+
ACE_INLINE bool
operator >= (const ACE_Time_Value &tv1,
const ACE_Time_Value &tv2)
@@ -225,7 +266,9 @@ operator >= (const ACE_Time_Value &tv1,
else
return 0;
}
+
// Returns the value of the object as a timespec_t.
+
ACE_INLINE
ACE_Time_Value::operator timespec_t () const
{
@@ -236,7 +279,9 @@ ACE_Time_Value::operator timespec_t () const
tv.tv_nsec = this->tv_.tv_usec * 1000;
return tv;
}
+
// Initializes the ACE_Time_Value object from a timespec_t.
+
ACE_INLINE
ACE_Time_Value::ACE_Time_Value (const timespec_t &tv)
// : tv_ ()
@@ -244,7 +289,9 @@ ACE_Time_Value::ACE_Time_Value (const timespec_t &tv)
// ACE_OS_TRACE ("ACE_Time_Value::ACE_Time_Value");
this->set (tv);
}
+
// True if tv1 < tv2.
+
ACE_INLINE bool
operator < (const ACE_Time_Value &tv1,
const ACE_Time_Value &tv2)
@@ -252,7 +299,9 @@ operator < (const ACE_Time_Value &tv1,
// ACE_OS_TRACE ("operator <");
return tv2 > tv1;
}
+
// True if tv1 >= tv2.
+
ACE_INLINE bool
operator <= (const ACE_Time_Value &tv1,
const ACE_Time_Value &tv2)
@@ -260,7 +309,9 @@ operator <= (const ACE_Time_Value &tv1,
// ACE_OS_TRACE ("operator <=");
return tv2 >= tv1;
}
+
// True if tv1 == tv2.
+
ACE_INLINE bool
operator == (const ACE_Time_Value &tv1,
const ACE_Time_Value &tv2)
@@ -269,7 +320,9 @@ operator == (const ACE_Time_Value &tv1,
return tv1.sec () == tv2.sec ()
&& tv1.usec () == tv2.usec ();
}
+
// True if tv1 != tv2.
+
ACE_INLINE bool
operator != (const ACE_Time_Value &tv1,
const ACE_Time_Value &tv2)
@@ -277,7 +330,9 @@ operator != (const ACE_Time_Value &tv1,
// ACE_OS_TRACE ("operator !=");
return !(tv1 == tv2);
}
+
// Add TV to this.
+
ACE_INLINE ACE_Time_Value &
ACE_Time_Value::operator+= (const ACE_Time_Value &tv)
{
@@ -287,6 +342,7 @@ ACE_Time_Value::operator+= (const ACE_Time_Value &tv)
this->normalize ();
return *this;
}
+
ACE_INLINE ACE_Time_Value &
ACE_Time_Value::operator+= (time_t tv)
{
@@ -294,6 +350,7 @@ ACE_Time_Value::operator+= (time_t tv)
this->sec (this->sec () + tv);
return *this;
}
+
ACE_INLINE ACE_Time_Value &
ACE_Time_Value::operator= (const ACE_Time_Value &tv)
{
@@ -302,6 +359,7 @@ ACE_Time_Value::operator= (const ACE_Time_Value &tv)
this->usec (tv.usec ());
return *this;
}
+
ACE_INLINE ACE_Time_Value &
ACE_Time_Value::operator= (time_t tv)
{
@@ -310,7 +368,9 @@ ACE_Time_Value::operator= (time_t tv)
this->usec (0);
return *this;
}
+
// Subtract TV to this.
+
ACE_INLINE ACE_Time_Value &
ACE_Time_Value::operator-= (const ACE_Time_Value &tv)
{
@@ -320,6 +380,7 @@ ACE_Time_Value::operator-= (const ACE_Time_Value &tv)
this->normalize ();
return *this;
}
+
ACE_INLINE ACE_Time_Value &
ACE_Time_Value::operator-= (time_t tv)
{
@@ -327,7 +388,9 @@ ACE_Time_Value::operator-= (time_t tv)
this->sec (this->sec () - tv);
return *this;
}
+
// Adds two ACE_Time_Value objects together, returns the sum.
+
ACE_INLINE ACE_Time_Value
operator + (const ACE_Time_Value &tv1,
const ACE_Time_Value &tv2)
@@ -335,9 +398,12 @@ operator + (const ACE_Time_Value &tv1,
// ACE_OS_TRACE ("operator +");
ACE_Time_Value sum (tv1);
sum += tv2;
+
return sum;
}
+
// Subtracts two ACE_Time_Value objects, returns the difference.
+
ACE_INLINE ACE_Time_Value
operator - (const ACE_Time_Value &tv1,
const ACE_Time_Value &tv2)
@@ -345,9 +411,12 @@ operator - (const ACE_Time_Value &tv1,
// ACE_OS_TRACE ("operator -");
ACE_Time_Value delta (tv1);
delta -= tv2;
+
return delta;
}
+
#if defined (ACE_WIN32) && defined (_WIN32_WCE)
}
#endif
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Timeprobe.cpp b/dep/ACE_wrappers/ace/Timeprobe.cpp
index 0d514fafc04..b92960415cf 100644
--- a/dep/ACE_wrappers/ace/Timeprobe.cpp
+++ b/dep/ACE_wrappers/ace/Timeprobe.cpp
@@ -1,10 +1,16 @@
// $Id: Timeprobe.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/config-all.h"
+
ACE_RCSID(ace, Timeprobe, "$Id: Timeprobe.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if defined (ACE_COMPILE_TIMEPROBES)
+
#include "ace/Timeprobe.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Timeprobe.inl"
#endif /* __ACE_INLINE__ */
+
#endif /* ACE_COMPILE_TIMEPROBES */
diff --git a/dep/ACE_wrappers/ace/Timeprobe.h b/dep/ACE_wrappers/ace/Timeprobe.h
index f70a80121b8..4ec811e6317 100644
--- a/dep/ACE_wrappers/ace/Timeprobe.h
+++ b/dep/ACE_wrappers/ace/Timeprobe.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Timeprobe.h
@@ -33,25 +34,33 @@
* ACE_TIMEPROBE_* macros should spring to life.
*/
//=============================================================================
+
#ifndef ACE_TIMEPROBE_H
#define ACE_TIMEPROBE_H
#include /**/ "ace/pre.h"
+
#include "ace/config-lite.h"
#include /**/ "ace/ACE_export.h"
#include "ace/Malloc_Allocator.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
/* Enable ACE Timeprobes */
#if defined (ACE_ENABLE_TIMEPROBES)
#if !defined (ACE_COMPILE_TIMEPROBES)
#define ACE_COMPILE_TIMEPROBES
#endif /* ACE_COMPILE_TIMEPROBES */
#endif /* ACE_ENABLE_TIMEPROBES */
+
#if defined (ACE_COMPILE_TIMEPROBES)
+
#include "ace/OS_NS_time.h"
#include "ace/OS_NS_Thread.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Event_Descriptions
*
@@ -62,11 +71,14 @@ class ACE_Export ACE_Event_Descriptions
public:
/// Event descriptions
const char **descriptions_;
+
/// Minimum id of this description set
u_long minimum_id_;
+
/// Comparison
bool operator== (const ACE_Event_Descriptions &rhs) const;
};
+
/**
* @class ACE_timeprobe_t
*
@@ -81,30 +93,40 @@ public:
u_long event_number_;
const char *event_description_;
};
+
/// Type of event.
enum event_type
{
NUMBER,
STRING
};
+
/// Event.
event event_;
+
/// Type of event.
event_type event_type_;
+
/// Timestamp.
ACE_hrtime_t time_;
+
/// Id of thread posting the time probe.
ACE_thread_t thread_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Timeprobe.inl"
#endif /* __ACE_INLINE__ */
+
#include "ace/Synch_Traits.h"
#include "ace/Null_Mutex.h"
#include "ace/Singleton.h"
#include "ace/Timeprobe_T.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// If ACE_MT_TIMEPROBES is defined, use a Thread_Mutex to lock the
// internal state of ACE_Timerprobe. This allows multiple threads to
// use the same ACE_Timerprobe.
@@ -113,13 +135,17 @@ typedef ACE_SYNCH_MUTEX ACE_TIMEPROBE_MUTEX;
# else /* ACE_MT_TIMEPROBES */
typedef ACE_SYNCH_NULL_MUTEX ACE_TIMEPROBE_MUTEX;
# endif /* ACE_MT_TIMEPROBES */
+
typedef ACE_New_Allocator ACE_TIMEPROBE_ALLOCATOR;
+
typedef ACE_Timeprobe_Ex<ACE_TIMEPROBE_MUTEX, ACE_TIMEPROBE_ALLOCATOR>
ACE_TIMEPROBE_WITH_LOCKING;
+
// If ACE_TSS_TIMEPROBES is defined, store the ACE_Timeprobe singleton
// in thread specific storage. This allows multiple threads to use
// their own instance of ACE_Timerprobe, without interfering with each
// other.
+
# if defined (ACE_TSS_TIMEPROBES)
# define ACE_TIMEPROBE_SINGLETON_TYPE ACE_TSS_Singleton
# define ACE_TIMEPROBE_SINGLETON_LOCK_TYPE ACE_SYNCH_NULL_MUTEX
@@ -127,35 +153,49 @@ typedef ACE_Timeprobe_Ex<ACE_TIMEPROBE_MUTEX, ACE_TIMEPROBE_ALLOCATOR>
# define ACE_TIMEPROBE_SINGLETON_TYPE ACE_Singleton
# define ACE_TIMEPROBE_SINGLETON_LOCK_TYPE ACE_SYNCH_MUTEX
# endif /* ACE_TSS_TIMEPROBES */
+
ACE_SINGLETON_DECLARE (ACE_TIMEPROBE_SINGLETON_TYPE, \
ACE_TIMEPROBE_WITH_LOCKING, \
ACE_TIMEPROBE_SINGLETON_LOCK_TYPE)
+
typedef ACE_TIMEPROBE_SINGLETON_TYPE<ACE_TIMEPROBE_WITH_LOCKING, ACE_TIMEPROBE_SINGLETON_LOCK_TYPE>
ACE_TIMEPROBE_SINGLETON;
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_COMPILE_TIMEPROBES */
+
// If ACE_ENABLE_TIMEPROBES is defined, the macros below will
// work. Otherwise, they just vanish. Using this macro, you can
// control which files/libraries are probed.
#if defined (ACE_ENABLE_TIMEPROBES) && defined (ACE_COMPILE_TIMEPROBES)
+
# define ACE_TIMEPROBE_RESET ACE_TIMEPROBE_SINGLETON::instance ()->reset ()
+
# define ACE_TIMEPROBE(id) ACE_TIMEPROBE_SINGLETON::instance ()->timeprobe (id)
+
# define ACE_TIMEPROBE_PRINT ACE_TIMEPROBE_SINGLETON::instance ()->print_times ()
+
# define ACE_TIMEPROBE_PRINT_ABSOLUTE ACE_TIMEPROBE_SINGLETON::instance ()->print_absolute_times ()
+
# define ACE_TIMEPROBE_EVENT_DESCRIPTIONS(descriptions, minimum_id) \
static int ace_timeprobe_##descriptions##_return = \
ACE_TIMEPROBE_SINGLETON::instance ()->event_descriptions \
(descriptions, minimum_id)
+
# define ACE_FUNCTION_TIMEPROBE(X) \
ACE_Function_Timeprobe<ACE_TIMEPROBE_WITH_LOCKING> function_timeprobe \
(*ACE_TIMEPROBE_SINGLETON::instance (), X)
+
#else /* ACE_ENABLE_TIMEPROBES && ACE_COMPILE_TIMEPROBES */
+
# define ACE_TIMEPROBE_RESET
# define ACE_TIMEPROBE(id)
# define ACE_TIMEPROBE_PRINT
# define ACE_TIMEPROBE_PRINT_ABSOLUTE
# define ACE_TIMEPROBE_EVENT_DESCRIPTIONS(descriptions, minimum_id)
# define ACE_FUNCTION_TIMEPROBE(X)
+
#endif /* ACE_ENABLE_TIMEPROBES && ACE_COMPILE_TIMEPROBES */
#include /**/ "ace/post.h"
#endif /* ACE_TIMEPROBE_H */
diff --git a/dep/ACE_wrappers/ace/Timeprobe.inl b/dep/ACE_wrappers/ace/Timeprobe.inl
index 27f75376273..aa7a9240648 100644
--- a/dep/ACE_wrappers/ace/Timeprobe.inl
+++ b/dep/ACE_wrappers/ace/Timeprobe.inl
@@ -1,11 +1,14 @@
// -*- C++ -*-
//
// $Id: Timeprobe.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE bool
ACE_Event_Descriptions::operator== (const ACE_Event_Descriptions &rhs) const
{
return this->minimum_id_ == rhs.minimum_id_ &&
this->descriptions_ == rhs.descriptions_;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Timeprobe_T.h b/dep/ACE_wrappers/ace/Timeprobe_T.h
index 0c9c2adf3e7..c180f7d7a72 100644
--- a/dep/ACE_wrappers/ace/Timeprobe_T.h
+++ b/dep/ACE_wrappers/ace/Timeprobe_T.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Timeprobe_T.h
@@ -9,16 +10,23 @@
*/
//=============================================================================
+
#ifndef ACE_TIMEPROBE_T_H
#define ACE_TIMEPROBE_T_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_COMPILE_TIMEPROBES)
+
#include "ace/Unbounded_Set.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Timeprobe_Ex
*
@@ -53,91 +61,126 @@ template <class ACE_LOCK, class ALLOCATOR>
class ACE_Timeprobe_Ex
{
public:
+
/// Self
typedef ACE_Timeprobe_Ex<ACE_LOCK, ALLOCATOR>
SELF;
+
/**
* ACE_Timeprobe
*/
typedef ACE_Timeprobe_Ex <ACE_LOCK, ACE_Allocator> ACE_Timeprobe;
+
/// We can hold multiple event description tables.
typedef ACE_Unbounded_Set<ACE_Event_Descriptions>
EVENT_DESCRIPTIONS;
+
/// Create Timeprobes with @a size slots
ACE_Timeprobe_Ex (u_long size = ACE_DEFAULT_TIMEPROBE_TABLE_SIZE);
+
/// Create Timeprobes with @a size slots
ACE_Timeprobe_Ex (ALLOCATOR *allocator,
u_long size = ACE_DEFAULT_TIMEPROBE_TABLE_SIZE);
/// Destructor.
~ACE_Timeprobe_Ex (void);
+
/// Record a time. @a event is used to describe this time probe.
void timeprobe (u_long event);
+
/// Record a time. @a id is used to describe this time probe.
void timeprobe (const char *id);
+
/// Record event descriptions.
int event_descriptions (const char **descriptions,
u_long minimum_id);
+
/// Print the time probes.
void print_times (void);
+
/// Print the time probes.
void print_absolute_times (void);
+
/// Reset the slots. All old time probes will be lost.
void reset (void);
+
void increase_size (u_long size);
+
/// Not implemented (stupid MSVC won't let it be protected).
ACE_Timeprobe_Ex (const ACE_Timeprobe_Ex<ACE_LOCK, ALLOCATOR> &);
+
// = (Somewhat private) Accessors
+
/// Event Descriptions
ACE_Unbounded_Set<ACE_Event_Descriptions> &event_descriptions (void);
+
/// Sorted Event Descriptions.
ACE_Unbounded_Set<ACE_Event_Descriptions> &sorted_event_descriptions (void);
+
/// Find description of event @a i
const char *find_description_i (u_long i);
+
/// Sort event descriptions
void sort_event_descriptions_i (void);
+
/// Time probe slots
ACE_timeprobe_t *timeprobes (void);
+
/// Synchronization variable.
ACE_LOCK &lock (void);
+
/// Max size of timestamp table
u_long max_size (void);
+
/// Current size of timestamp table
u_long current_size (void);
+
protected:
+
/// Obtain an allocator pointer. If there is no allocator stored in
/// the instance, the singleton allocator in the current process is used.
ALLOCATOR * allocator (void);
+
/// Event Descriptions
EVENT_DESCRIPTIONS event_descriptions_;
+
/// Sorted Event Descriptions.
EVENT_DESCRIPTIONS sorted_event_descriptions_;
+
/// Time probe slots
ACE_timeprobe_t *timeprobes_;
+
/// Synchronization variable.
ACE_LOCK lock_;
+
/// Max size of timestamp table
u_long max_size_;
+
/// Current size of timestamp table
u_long current_size_;
+
/// Flag indicating the report buffer has filled up, and is now
/// acting as a ring-buffer using modulus arithmetic: this saves the
/// max_size_ most recent time stamps and loses earlier ones until
/// drained.
u_short report_buffer_full_;
+
private:
ALLOCATOR * allocator_;
};
+
// template <class ACE_LOCK>
// class ACE_Timeprobe : public ACE_Timeprobe_Ex <ACE_LOCK, ACE_Allocator>
// {
// public:
// // Initialize a ACE_Timeprobe with default size
// ACE_Timeprobe (ACE_Allocator *allocator = ACE_Allocator::instance());
+
// /// Create Timeprobes with @a size slots
// ACE_Timeprobe (ACE_Allocator *allocator = ACE_Allocator::instance(),
// u_long size = ACE_DEFAULT_TIMEPROBE_TABLE_SIZE);
// };
+
/**
* @class ACE_Function_Timeprobe
*
@@ -150,21 +193,28 @@ class ACE_Function_Timeprobe
public:
/// Constructor.
ACE_Function_Timeprobe (Timeprobe &timeprobe, u_long event);
+
/// Destructor.
~ACE_Function_Timeprobe (void);
+
protected:
/// Reference to timeprobe.
Timeprobe &timeprobe_;
+
/// Event.
u_long event_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Timeprobe_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Timeprobe_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#endif /* ACE_COMPILE_TIMEPROBES */
#include /**/ "ace/post.h"
#endif /* ACE_TIMEPROBE_T_H */
diff --git a/dep/ACE_wrappers/ace/Timer_Hash.h b/dep/ACE_wrappers/ace/Timer_Hash.h
index f13f2b0dd2e..c19291efaf7 100644
--- a/dep/ACE_wrappers/ace/Timer_Hash.h
+++ b/dep/ACE_wrappers/ace/Timer_Hash.h
@@ -1,4 +1,5 @@
/* -*- C++ -*- */
+
//=============================================================================
/**
* @file Timer_Hash.h
@@ -9,51 +10,67 @@
*/
//=============================================================================
+
#ifndef ACE_TIMER_HASH_H
#define ACE_TIMER_HASH_H
#include /**/ "ace/pre.h"
+
#include "ace/Timer_Hash_T.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Timer_Heap_T.h"
#include "ace/Timer_List_T.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// The following typedef are here for ease of use
+
typedef ACE_Timer_Hash_Upcall <ACE_Event_Handler *,
ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>,
ACE_SYNCH_RECURSIVE_MUTEX>
ACE_Hash_Upcall;
+
typedef ACE_Timer_List_T <ACE_Event_Handler *,
ACE_Hash_Upcall,
ACE_Null_Mutex>
ACE_Hash_Timer_List;
+
typedef ACE_Timer_Heap_T <ACE_Event_Handler *,
ACE_Hash_Upcall,
ACE_Null_Mutex>
ACE_Hash_Timer_Heap;
+
typedef 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>
+
ACE_Timer_Hash;
+
typedef 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>
ACE_Timer_Hash_Iterator;
+
typedef 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>
ACE_Timer_Hash_Heap;
+
typedef 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>
ACE_Timer_Hash_Heap_Iterator;
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
#endif /* ACE_TIMER_HASH_H */
diff --git a/dep/ACE_wrappers/ace/Timer_Hash_T.h b/dep/ACE_wrappers/ace/Timer_Hash_T.h
index 63161031528..882369cf5c9 100644
--- a/dep/ACE_wrappers/ace/Timer_Hash_T.h
+++ b/dep/ACE_wrappers/ace/Timer_Hash_T.h
@@ -1,4 +1,5 @@
/* -*- C++ -*- */
+
//=============================================================================
/**
* @file Timer_Hash_T.h
@@ -8,20 +9,27 @@
* @author Darrell Brunsch <brunsch@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_TIMER_HASH_T_H
#define ACE_TIMER_HASH_T_H
#include /**/ "ace/pre.h"
+
#include "ace/Timer_Queue_T.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Free_List.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward declaration.
template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET>
class ACE_Timer_Hash_T;
template <typename TYPE>
class Hash_Token;
+
/**
* @class ACE_Timer_Hash_Upcall
*
@@ -38,15 +46,19 @@ public:
ACE_Timer_Hash_Upcall<TYPE, FUNCTOR, ACE_LOCK>,
ACE_Null_Mutex>
TIMER_QUEUE;
+
/// Default constructor (creates an invalid object, but needs to be here
/// so timer queues using this functor can be constructed)
ACE_Timer_Hash_Upcall (void);
+
/// Constructor that specifies a Timer_Hash to call up to
ACE_Timer_Hash_Upcall (ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK> *timer_hash);
+
/// This method is called when a timer is registered.
int registration (TIMER_QUEUE &timer_queue,
ACE_Event_Handler *handler,
const void *arg);
+
/// This method is called before the timer expires.
int preinvoke (TIMER_QUEUE &timer_queue,
ACE_Event_Handler *handler,
@@ -54,12 +66,14 @@ public:
int recurring_timer,
const ACE_Time_Value &cur_time,
const void *&upcall_act);
+
/// This method is called when the timer expires.
int timeout (TIMER_QUEUE &timer_queue,
ACE_Event_Handler *handler,
const void *arg,
int recurring_timer,
const ACE_Time_Value &cur_time);
+
/// This method is called after the timer expires.
int postinvoke (TIMER_QUEUE &timer_queue,
ACE_Event_Handler *handler,
@@ -67,28 +81,34 @@ public:
int recurring_timer,
const ACE_Time_Value &cur_time,
const void *upcall_act);
+
/// This method is called when a handler is cancelled
int cancel_type (TIMER_QUEUE &timer_queue,
ACE_Event_Handler *handler,
int dont_call,
int &requires_reference_counting);
+
/// This method is called when a timer is cancelled
int cancel_timer (TIMER_QUEUE &timer_queue,
ACE_Event_Handler *handler,
int dont_call,
int requires_reference_counting);
+
/// This method is called when the timer queue is destroyed and
/// the timer is still contained in it
int deletion (TIMER_QUEUE &timer_queue,
ACE_Event_Handler *handler,
const void *arg);
+
private:
/// Timer Queue to do the calling up to
ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK> *timer_hash_;
+
// = Don't allow these operations for now.
ACE_UNIMPLEMENTED_FUNC (ACE_Timer_Hash_Upcall (const ACE_Timer_Hash_Upcall<TYPE, FUNCTOR, ACE_LOCK> &))
ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Timer_Hash_Upcall<TYPE, FUNCTOR, ACE_LOCK> &))
};
+
/**
* @class ACE_Timer_Hash_Iterator_T
*
@@ -104,22 +124,30 @@ class ACE_Timer_Hash_Iterator_T : public ACE_Timer_Queue_Iterator_T <TYPE, FUNCT
public:
/// Constructor.
ACE_Timer_Hash_Iterator_T (ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET> &);
+
/// Positions the iterator at the earliest node in the Timer Queue
virtual void first (void);
+
/// Positions the iterator at the next node in the Timer Queue
virtual void next (void);
+
/// Returns true when there are no more nodes in the sequence
virtual bool isdone (void) const;
+
/// Returns the node at the current position in the sequence
virtual ACE_Timer_Node_T<TYPE> *item (void);
+
protected:
/// Pointer to the ACE_Timer_Hash that we are iterating over.
ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET> &timer_hash_;
+
/// Current position in <timer_hash_>'s table
size_t position_;
+
/// Current iterator used on <position>'s bucket
ACE_Timer_Queue_Iterator_T<TYPE, ACE_Timer_Hash_Upcall<TYPE, FUNCTOR, ACE_LOCK>, ACE_Null_Mutex> *iter_;
};
+
/**
* @class ACE_Timer_Hash_T
*
@@ -137,10 +165,13 @@ public:
/// Type of iterator
typedef ACE_Timer_Hash_Iterator_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>
HASH_ITERATOR;
+
/// Iterator is a friend
friend class ACE_Timer_Hash_Iterator_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>;
+
/// Type inherited from
typedef ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK> INHERITED;
+
// = Initialization and termination methods.
/**
* Default constructor. @a table_size determines the size of the
@@ -151,6 +182,7 @@ public:
ACE_Timer_Hash_T (size_t table_size,
FUNCTOR *upcall_functor = 0,
ACE_Free_List<ACE_Timer_Node_T <TYPE> > *freelist = 0);
+
/**
* Default constructor. @a upcall_functor is the instance of the
* FUNCTOR to be used by the queue. If @a upcall_functor is 0, Timer
@@ -159,13 +191,17 @@ public:
* size will be ACE_DEFAULT_TIMERS and there will be no preallocation.
*/
ACE_Timer_Hash_T (FUNCTOR *upcall_functor = 0, ACE_Free_List<ACE_Timer_Node_T <TYPE> > *freelist = 0);
+
/// Destructor
virtual ~ACE_Timer_Hash_T (void);
+
/// True if queue is empty, else false.
virtual bool is_empty (void) const;
+
/// Returns the time of the earlier node in the <ACE_Timer_Hash>.
/// Must be called on a non-empty queue.
virtual const ACE_Time_Value &earliest_time (void) const;
+
/**
* Resets the interval of the timer represented by @a timer_id to
* @a interval, which is specified in relative time to the current
@@ -175,6 +211,7 @@ public:
*/
virtual int reset_interval (long timer_id,
const ACE_Time_Value &interval);
+
/**
* Cancel all timer associated with @a type. If <dont_call> is 0
* then the <functor> will be invoked. Returns number of timers
@@ -184,6 +221,7 @@ public:
*/
virtual int cancel (const TYPE &type,
int dont_call_handle_close = 1);
+
/**
* Cancel the single timer that matches the @a timer_id value (which
* was returned from the <schedule> method). If act is non-NULL
@@ -198,30 +236,39 @@ public:
virtual int cancel (long timer_id,
const void **act = 0,
int dont_call_handle_close = 1);
+
/**
* Run the <functor> for all timers whose values are <=
* <ACE_OS::gettimeofday>. Also accounts for <timer_skew>. Returns
* the number of timers canceled.
*/
virtual int expire (void);
+
/**
* Run the <functor> for all timers whose values are <= @a current_time.
* This does not account for <timer_skew>. Returns the number of
* timers canceled.
*/
virtual int expire (const ACE_Time_Value &current_time);
+
/// Returns a pointer to this ACE_Timer_Queue's iterator.
virtual ACE_Timer_Queue_Iterator_T<TYPE, FUNCTOR, ACE_LOCK> &iter (void);
+
/// Removes the earliest node from the queue and returns it
virtual ACE_Timer_Node_T<TYPE> *remove_first (void);
+
/// Dump the state of an object.
virtual void dump (void) const;
+
/// Reads the earliest node from the queue and returns it.
virtual ACE_Timer_Node_T<TYPE> *get_first (void);
+
protected:
/// Factory method that frees a previously allocated node.
virtual void free_node (ACE_Timer_Node_T<TYPE> *);
+
private:
+
/**
* Schedule @a type that will expire at @a future_time,
* which is specified in absolute time. If it expires then @a act is
@@ -237,44 +284,60 @@ private:
const void *act,
const ACE_Time_Value &future_time,
const ACE_Time_Value &interval);
+
/// Non-locking version of dispatch_info ()
virtual int dispatch_info_i (const ACE_Time_Value &current_time,
ACE_Timer_Node_Dispatch_Info_T<TYPE> &info);
+
/// Reschedule an "interval" ACE_Timer_Node.
virtual void reschedule (ACE_Timer_Node_T<TYPE> *);
+
/// Finds the earliest node
void find_new_earliest (void);
+
/// Keeps track of the size of the queue
size_t size_;
+
/// Table of BUCKETS
BUCKET **table_;
+
/// Keeps track of the size of table_
size_t table_size_;
+
/// Functor used for the table's timer queues
ACE_Timer_Hash_Upcall<TYPE, FUNCTOR, ACE_LOCK> table_functor_;
+
/// Index to the position with the earliest entry
size_t earliest_position_;
+
/// Iterator used to expire timers.
HASH_ITERATOR *iterator_;
+
#if defined (ACE_WIN64)
// Part of a hack... see comments in schedule().
// This is, essentially, the upper 32 bits of a 64-bit pointer on Win64.
ptrdiff_t pointer_base_;
#endif
+
/// Hash_Token is usually allocated in schedule but its
/// deallocation is problematic and token_list_ helps with this.
ACE_Locked_Free_List<Hash_Token<TYPE>, ACE_Null_Mutex> token_list_;
+
// = Don't allow these operations for now.
ACE_UNIMPLEMENTED_FUNC (ACE_Timer_Hash_T (const ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET> &))
ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET> &))
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Timer_Hash_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Timer_Hash_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
#endif /* ACE_TIMER_HASH_T_H */
diff --git a/dep/ACE_wrappers/ace/Timer_Heap.h b/dep/ACE_wrappers/ace/Timer_Heap.h
index 668f6f04735..61673974068 100644
--- a/dep/ACE_wrappers/ace/Timer_Heap.h
+++ b/dep/ACE_wrappers/ace/Timer_Heap.h
@@ -1,4 +1,5 @@
/* -*- C++ -*- */
+
//=============================================================================
/**
* @file Timer_Heap.h
@@ -8,25 +9,34 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_TIMER_HEAP_H
#define ACE_TIMER_HEAP_H
#include /**/ "ace/pre.h"
+
#include "ace/Timer_Heap_T.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// The following typedefs are here for ease of use and backward
// compatibility.
+
typedef ACE_Timer_Heap_T<ACE_Event_Handler *,
ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>,
ACE_SYNCH_RECURSIVE_MUTEX>
ACE_Timer_Heap;
+
typedef ACE_Timer_Heap_Iterator_T<ACE_Event_Handler *,
ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>,
ACE_SYNCH_RECURSIVE_MUTEX>
ACE_Timer_Heap_Iterator;
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
#endif /* ACE_TIMER_HEAP_H */
diff --git a/dep/ACE_wrappers/ace/Timer_Heap_T.h b/dep/ACE_wrappers/ace/Timer_Heap_T.h
index c56584c3339..904e596e616 100644
--- a/dep/ACE_wrappers/ace/Timer_Heap_T.h
+++ b/dep/ACE_wrappers/ace/Timer_Heap_T.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Timer_Heap_T.h
@@ -8,19 +9,26 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_TIMER_HEAP_T_H
#define ACE_TIMER_HEAP_T_H
#include /**/ "ace/pre.h"
+
#include "ace/Timer_Queue_T.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Free_List.h"
#include "ace/Unbounded_Set.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward declaration
template <class TYPE, class FUNCTOR, class ACE_LOCK>
class ACE_Timer_Heap_T;
+
/**
* @class ACE_Timer_Heap_Iterator_T
*
@@ -36,22 +44,30 @@ class ACE_Timer_Heap_Iterator_T : public ACE_Timer_Queue_Iterator_T<TYPE, FUNCTO
public:
/// Constructor.
ACE_Timer_Heap_Iterator_T (ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK> &);
+
/// Destructor.
~ACE_Timer_Heap_Iterator_T (void);
+
/// Positions the iterator at the earliest node in the Timer Queue
virtual void first (void);
+
/// Positions the iterator at the next node in the Timer Queue
virtual void next (void);
+
/// Returns true when there are no more nodes in the sequence
virtual bool isdone (void) const;
+
/// Returns the node at the current position in the sequence
virtual ACE_Timer_Node_T<TYPE> *item (void);
+
protected:
/// Pointer to the ACE_Timer_Heap that we are iterating over.
ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK> &timer_heap_;
+
/// Position in the array where the iterator is at
size_t position_;
};
+
/**
* @class ACE_Timer_Heap_T
*
@@ -72,7 +88,9 @@ class ACE_Timer_Heap_T : public ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>
public:
typedef ACE_Timer_Heap_Iterator_T<TYPE, FUNCTOR, ACE_LOCK> HEAP_ITERATOR;
friend class ACE_Timer_Heap_Iterator_T<TYPE, FUNCTOR, ACE_LOCK>;
+
typedef ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK> INHERITED;
+
// = Initialization and termination methods.
/**
* The Constructor creates a heap with specified number of elements.
@@ -92,6 +110,7 @@ public:
bool preallocated = false,
FUNCTOR *upcall_functor = 0,
ACE_Free_List<ACE_Timer_Node_T <TYPE> > *freelist = 0);
+
/**
* Default constructor. @c upcall_functor is the instance of the
* FUNCTOR to be used by the queue. If @c upcall_functor is 0, Timer
@@ -101,13 +120,17 @@ public:
*/
ACE_Timer_Heap_T (FUNCTOR *upcall_functor = 0,
ACE_Free_List<ACE_Timer_Node_T <TYPE> > *freelist = 0);
+
/// Destructor.
virtual ~ACE_Timer_Heap_T (void);
+
/// True if heap is empty, else false.
virtual bool is_empty (void) const;
+
/// Returns the time of the earliest node in the Timer_Queue.
/// Must be called on a non-empty queue.
virtual const ACE_Time_Value &earliest_time (void) const;
+
/**
* Resets the interval of the timer represented by @a timer_id to
* @a interval, which is specified in relative time to the current
@@ -117,6 +140,7 @@ public:
*/
virtual int reset_interval (long timer_id,
const ACE_Time_Value &interval);
+
/**
* Cancel all timers associated with @a type. If @a dont_call_handle_close
* is 0then the <functor> will be invoked. Returns number of timers
@@ -124,6 +148,7 @@ public:
*/
virtual int cancel (const TYPE &type,
int dont_call_handle_close = 1);
+
/**
* Cancel the single timer that matches the @a timer_id value (which
* was returned from the <schedule> method). If act is non-NULL
@@ -136,8 +161,10 @@ public:
virtual int cancel (long timer_id,
const void **act = 0,
int dont_call_handle_close = 1);
+
/// Returns a pointer to this ACE_Timer_Queue's iterator.
virtual ACE_Timer_Queue_Iterator_T<TYPE, FUNCTOR, ACE_LOCK> &iter (void);
+
/**
* Removes the earliest node from the queue and returns it. Note that
* the timer is removed from the heap, but is not freed, and its ID
@@ -147,11 +174,15 @@ public:
* should not be used unadvisedly in other conditions.
*/
ACE_Timer_Node_T <TYPE> *remove_first (void);
+
/// Dump the state of an object.
virtual void dump (void) const;
+
/// Reads the earliest node from the queue and returns it.
virtual ACE_Timer_Node_T<TYPE> *get_first (void);
+
protected:
+
/**
* Schedule a timer that may optionally auto-reset.
* Schedule @a type that will expire at @a future_time,
@@ -172,40 +203,50 @@ protected:
const void *act,
const ACE_Time_Value &future_time,
const ACE_Time_Value &interval);
+
/// Reschedule an "interval" ACE_Timer_Node.
virtual void reschedule (ACE_Timer_Node_T<TYPE> *);
+
/// Factory method that allocates a new node (uses operator new if
/// we're *not* preallocating, otherwise uses an internal freelist).
virtual ACE_Timer_Node_T<TYPE> *alloc_node (void);
+
/**
* Factory method that frees a previously allocated node (uses
* operator delete if we're *not* preallocating, otherwise uses an
* internal freelist).
*/
virtual void free_node (ACE_Timer_Node_T<TYPE> *);
+
private:
/// Remove and return the @a sloth ACE_Timer_Node and restore the
/// heap property.
ACE_Timer_Node_T<TYPE> *remove (size_t slot);
+
/// Insert @a new_node into the heap and restore the heap property.
void insert (ACE_Timer_Node_T<TYPE> *new_node);
+
/**
* Doubles the size of the heap and the corresponding timer_ids array.
* If preallocation is used, will also double the size of the
* preallocated array of ACE_Timer_Nodes.
*/
void grow_heap (void);
+
/// Restore the heap property, starting at @a slot.
void reheap_up (ACE_Timer_Node_T<TYPE> *new_node,
size_t slot,
size_t parent);
+
/// Restore the heap property, starting at @a slot.
void reheap_down (ACE_Timer_Node_T<TYPE> *moved_node,
size_t slot,
size_t child);
+
/// Copy @a moved_node into the @a slot slot of <heap_> and move
/// @a slot into the corresponding slot in the <timer_id_> array.
void copy (size_t slot, ACE_Timer_Node_T<TYPE> *moved_node);
+
/**
* Returns a timer id that uniquely identifies this timer. This id
* can be used to cancel a timer via the <cancel (int)> method. The
@@ -213,19 +254,26 @@ private:
* conflicts with other failure return values.
*/
long timer_id (void);
+
/// Pops and returns a new timer id from the freelist.
long pop_freelist (void);
+
/// Pushes @a old_id onto the freelist.
void push_freelist (long old_id);
+
/// Maximum size of the heap.
size_t max_size_;
+
/// Current size of the heap.
size_t cur_size_;
+
/// Number of heap entries in transition (removed from the queue, but
/// not freed) and may be rescheduled or freed.
size_t cur_limbo_;
+
/// Iterator used to expire timers.
HEAP_ITERATOR *iterator_;
+
/**
* Current contents of the Heap, which is organized as a "heap" of
* ACE_Timer_Node *'s. In this context, a heap is a "partially
@@ -233,6 +281,7 @@ private:
* array.
*/
ACE_Timer_Node_T<TYPE> **heap_;
+
/**
* An array of "pointers" that allows each ACE_Timer_Node in the
* <heap_> to be located in O(1) time. Basically, <timer_id_[i]>
@@ -244,13 +293,16 @@ private:
* "pointers" into the <heap_> array for assigned timer IDs.
*/
ssize_t *timer_ids_;
+
/// "Pointer" to the element in the <timer_ids_> array that was
/// last given out as a timer ID.
size_t timer_ids_curr_;
+
/// Index representing the lowest timer ID that has been freed. When
/// the timer_ids_next_ value wraps around, it starts back at this
/// point.
size_t timer_ids_min_free_;
+
/**
* If this is non-0, then we preallocate <max_size_> number of
* ACE_Timer_Node objects in order to reduce dynamic allocation
@@ -258,23 +310,30 @@ private:
* last array of nodes allocated.
*/
ACE_Timer_Node_T<TYPE> *preallocated_nodes_;
+
/// This points to the head of the <preallocated_nodes_> freelist,
/// which is organized as a stack.
ACE_Timer_Node_T<TYPE> *preallocated_nodes_freelist_;
+
/// Set of pointers to the arrays of preallocated timer nodes.
/// Used to delete the allocated memory when required.
ACE_Unbounded_Set<ACE_Timer_Node_T<TYPE> *> preallocated_node_set_;
+
// = Don't allow these operations for now.
ACE_UNIMPLEMENTED_FUNC (ACE_Timer_Heap_T (const ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK> &))
ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK> &))
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Timer_Heap_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Timer_Heap_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
#endif /* ACE_TIMER_HEAP_T_H */
diff --git a/dep/ACE_wrappers/ace/Timer_List.h b/dep/ACE_wrappers/ace/Timer_List.h
index 09d21e9fcc5..847eac1a1e9 100644
--- a/dep/ACE_wrappers/ace/Timer_List.h
+++ b/dep/ACE_wrappers/ace/Timer_List.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Timer_List.h
@@ -9,25 +10,34 @@
*/
//=============================================================================
+
#ifndef ACE_TIMER_LIST_H
#define ACE_TIMER_LIST_H
#include /**/ "ace/pre.h"
+
#include "ace/Timer_List_T.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// The following typedefs are here for ease of use and backward
// compatibility.
+
typedef ACE_Timer_List_T<ACE_Event_Handler *,
ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>,
ACE_SYNCH_RECURSIVE_MUTEX>
ACE_Timer_List;
+
typedef ACE_Timer_List_Iterator_T<ACE_Event_Handler *,
ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>,
ACE_SYNCH_RECURSIVE_MUTEX>
ACE_Timer_List_Iterator;
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
#endif /* ACE_TIMER_LIST_H */
diff --git a/dep/ACE_wrappers/ace/Timer_List_T.h b/dep/ACE_wrappers/ace/Timer_List_T.h
index 4048d37f00a..66d148f81eb 100644
--- a/dep/ACE_wrappers/ace/Timer_List_T.h
+++ b/dep/ACE_wrappers/ace/Timer_List_T.h
@@ -1,4 +1,5 @@
/* -*- C++ -*- */
+
//=============================================================================
/**
* @file Timer_List_T.h
@@ -8,16 +9,21 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_TIMER_LIST_T_H
#define ACE_TIMER_LIST_T_H
#include /**/ "ace/pre.h"
+
#include "ace/Timer_Queue_T.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
// Forward declaration.
template <class TYPE, class FUNCTOR, class ACE_LOCK>
class ACE_Timer_List_T;
+
/**
* @class ACE_Timer_List_Iterator_T
*
@@ -34,22 +40,30 @@ public:
typedef ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK> List;
/// Constructor.
ACE_Timer_List_Iterator_T (List& lst);
+
/// Destructor.
virtual ~ACE_Timer_List_Iterator_T (void);
+
/// Positions the iterator at the earliest node in the Timer Queue
virtual void first (void);
+
/// Positions the iterator at the next node in the Timer Queue
virtual void next (void);
+
/// Returns true when there are no more nodes in the sequence
virtual bool isdone (void) const;
+
/// Returns the node at the current position in the sequence
virtual ACE_Timer_Node_T<TYPE> *item (void);
+
protected:
/// Pointer to the ACE_Timer_List that we are iterating over.
List& list_;
+
/// Current position in the ACE_Timer_List
ACE_Timer_Node_T<TYPE>* current_node_;
};
+
/**
* @class ACE_Timer_List_T
*
@@ -73,12 +87,15 @@ class ACE_Timer_List_T : public ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>
public:
/// Type of iterator
typedef ACE_Timer_List_Iterator_T<TYPE, FUNCTOR, ACE_LOCK> Iterator;
+
/// Iterator is a friend
friend class ACE_Timer_List_Iterator_T<TYPE, FUNCTOR, ACE_LOCK>;
+
typedef ACE_Timer_Node_T<TYPE> Node;
/// Type inherited from
typedef ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK> Base;
typedef ACE_Free_List<Node> FreeList;
+
// = Initialization and termination methods.
/**
* Default constructor. @a upcall_functor is the instance of the
@@ -87,13 +104,17 @@ public:
* timer nodes. If 0, then a default freelist will be created.
*/
ACE_Timer_List_T (FUNCTOR* upcall_functor = 0, FreeList* freelist = 0);
+
/// Destructor
virtual ~ACE_Timer_List_T (void);
+
/// True if queue is empty, else false.
virtual bool is_empty (void) const;
+
/// Returns the time of the earlier node in the ACE_Timer_List.
/// Must be called on a non-empty queue.
virtual const ACE_Time_Value& earliest_time (void) const;
+
/**
* Resets the interval of the timer represented by @a timer_id to
* @a interval, which is specified in relative time to the current
@@ -103,6 +124,7 @@ public:
*/
virtual int reset_interval (long timer_id,
const ACE_Time_Value& interval);
+
/**
* Cancel all timers associated with @a type. If dont_call_handle_close is 0
* then the @a functor will be invoked. Returns the number of timers
@@ -110,6 +132,7 @@ public:
*/
virtual int cancel (const TYPE& type,
int dont_call_handle_close = 1);
+
/**
* Cancel the single timer that matches the @a timer_id value (which
* was returned from the <schedule> method). If act is non-NULL
@@ -122,18 +145,25 @@ public:
virtual int cancel (long timer_id,
const void** act = 0,
int dont_call_handle_close = 1);
+
/// Returns a pointer to this ACE_Timer_Queue's iterator.
virtual ACE_Timer_Queue_Iterator_T<TYPE, FUNCTOR, ACE_LOCK>& iter (void);
+
/// Removes the earliest node from the queue and returns it
virtual ACE_Timer_Node_T<TYPE>* remove_first (void);
+
/// Dump the state of an object.
virtual void dump (void) const;
+
/// Reschedule an "interval" ACE_Timer_Node_T. This should be private
/// but for now it needs to be public for <ACE_Timer_Hash_T>
virtual void reschedule (ACE_Timer_Node_T<TYPE> *);
+
/// Reads the earliest node from the queue and returns it.
virtual ACE_Timer_Node_T<TYPE>* get_first (void);
+
private:
+
/**
* Schedule @a type that will expire at @a future_time, which is
* specified in absolute time. If it expires then @a act is passed
@@ -153,32 +183,45 @@ private:
const void* act,
const ACE_Time_Value& future_time,
const ACE_Time_Value& interval);
+
void schedule_i(ACE_Timer_Node_T<TYPE>* n, const ACE_Time_Value& exp);
+
ACE_Timer_Node_T<TYPE>* find_node(long timer_id) const;
+
void cancel_i (ACE_Timer_Node_T<TYPE>* n);
+
void unlink (ACE_Timer_Node_T<TYPE>* n);
+
ACE_Timer_Node_T<TYPE>* get_first_i(void) const;
+
private:
+
/// Pointer to linked list of <ACE_Timer_Handles>.
ACE_Timer_Node_T<TYPE>* head_;
+
/// Iterator used to expire timers.
Iterator* iterator_;
+
/**
* Keeps track of the timer id that uniquely identifies each timer.
* This id can be used to cancel a timer via the <cancel(long)>
* method.
*/
long id_counter_;
+
// = Don't allow these operations for now.
ACE_UNIMPLEMENTED_FUNC (ACE_Timer_List_T (const ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK> &))
ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK> &))
};
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Timer_List_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Timer_List_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
#endif /* ACE_TIMER_LIST_T_H */
diff --git a/dep/ACE_wrappers/ace/Timer_Queue.h b/dep/ACE_wrappers/ace/Timer_Queue.h
index 6c6b87fb688..0f5990ae546 100644
--- a/dep/ACE_wrappers/ace/Timer_Queue.h
+++ b/dep/ACE_wrappers/ace/Timer_Queue.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Timer_Queue.h
@@ -9,13 +10,18 @@
* @author Irfan Pyarali <irfan@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_TIMER_QUEUE_H
#define ACE_TIMER_QUEUE_H
+
#include /**/ "ace/pre.h"
+
#include "ace/Synch_Traits.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Timer_Queuefwd.h"
#include "ace/Timer_Queue_T.h"
#if defined (ACE_HAS_THREADS)
@@ -23,18 +29,25 @@
#else
# include "ace/Null_Mutex.h"
#endif /* ACE_HAS_THREADS */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// The following typedef are here for ease of use and backward
// compatibility.
typedef ACE_Timer_Node_Dispatch_Info_T<ACE_Event_Handler *>
ACE_Timer_Node_Dispatch_Info;
+
typedef ACE_Timer_Node_T<ACE_Event_Handler *>
ACE_Timer_Node;
+
typedef ACE_Timer_Queue_Iterator_T<ACE_Event_Handler *,
ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>,
ACE_SYNCH_RECURSIVE_MUTEX>
ACE_Timer_Queue_Iterator;
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
+
#endif /* ACE_TIMER_QUEUE_H */
diff --git a/dep/ACE_wrappers/ace/Timer_Queue_Adapters.h b/dep/ACE_wrappers/ace/Timer_Queue_Adapters.h
index f6d08e55730..390aed19da0 100644
--- a/dep/ACE_wrappers/ace/Timer_Queue_Adapters.h
+++ b/dep/ACE_wrappers/ace/Timer_Queue_Adapters.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Timer_Queue_Adapters.h
@@ -9,24 +10,32 @@
* Carlos O'Ryan <coryan@uci.edu>
*/
//=============================================================================
+
#ifndef ACE_TIMER_QUEUE_ADAPTERS_H
#define ACE_TIMER_QUEUE_ADAPTERS_H
#include /**/ "ace/pre.h"
+
#include "ace/Task.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Signal.h"
#include "ace/Sig_Handler.h"
#include "ace/Condition_Recursive_Thread_Mutex.h"
+
#if defined (ACE_HAS_DEFERRED_TIMER_COMMANDS)
# include "ace/Unbounded_Queue.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
class ACE_Command_Base;
ACE_END_VERSIONED_NAMESPACE_DECL
#endif /* ACE_HAS_DEFERRED_TIMER_COMMANDS */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Sig_Set;
+
/**
* @class ACE_Async_Timer_Queue_Adapter
*
@@ -45,6 +54,7 @@ class ACE_Async_Timer_Queue_Adapter : public ACE_Event_Handler
{
public:
typedef TQ TIMER_QUEUE;
+
/// Constructor
/**
* Register the SIGALRM handler. If @a mask == 0 then block all
@@ -52,6 +62,7 @@ public:
* indicated in @a mask.
*/
ACE_Async_Timer_Queue_Adapter (ACE_Sig_Set *mask = 0);
+
/// Schedule the timer according to the semantics of the
/// ACE_Timer_List.
/**
@@ -63,28 +74,37 @@ public:
const void *act,
const ACE_Time_Value &future_time,
const ACE_Time_Value &interval = ACE_Time_Value::zero);
+
/// Cancel the @a timer_id and pass back the @a act if an address is
/// passed in.
int cancel (long timer_id, const void **act = 0);
+
/// Dispatch all timers with expiry time at or before the current time.
/// Returns the number of timers expired.
int expire (void);
+
/// Return a reference to the underlying timer queue.
TQ &timer_queue (void);
+
private:
/// Perform the logic to compute the new ualarm(2) setting.
virtual int schedule_ualarm (void);
+
/// Called back by @c SIGALRM handler.
virtual int handle_signal (int signum, siginfo_t *, ucontext_t *);
+
/// Handler for the @c SIGALRM signal, so that we can access our state
/// without requiring any global variables.
ACE_Sig_Handler sig_handler_;
+
/// Implementation of the timer queue (e.g., ACE_Timer_List,
/// ACE_Timer_Heap, etc.).
TQ timer_queue_;
+
/// Mask of signals to be blocked when we're servicing @c SIGALRM.
ACE_Sig_Set mask_;
};
+
/**
* @class ACE_Thread_Timer_Queue_Adapter
*
@@ -105,39 +125,53 @@ class ACE_Thread_Timer_Queue_Adapter : public ACE_Task_Base
public:
/// Trait for the underlying queue type.
typedef TQ TIMER_QUEUE;
+
# if defined (ACE_HAS_DEFERRED_TIMER_COMMANDS)
+
/// Typedef for the position at which to enqueue a deferred
/// execution command.
enum COMMAND_ENQUEUE_POSITION {HEAD, TAIL};
+
# endif /* ACE_HAS_DEFERRED_TIMER_COMMANDS */
+
/// Creates the timer queue. Activation of the task is the user's
/// responsibility. Optionally a pointer to a timer queue can be passed,
/// when no pointer is passed, a TQ is dynamically created
ACE_Thread_Timer_Queue_Adapter (ACE_Thread_Manager * = ACE_Thread_Manager::instance (),
TQ* timer_queue = 0);
+
/// Destructor.
virtual ~ACE_Thread_Timer_Queue_Adapter (void);
+
/// Schedule the timer according to the semantics of the <TQ>; wakes
/// up the dispatching thread.
long schedule (ACE_Event_Handler *handler,
const void *act,
const ACE_Time_Value &future_time,
const ACE_Time_Value &interval = ACE_Time_Value::zero);
+
/// Cancel the @a timer_id and return the @a act parameter if an
/// address is passed in. Also wakes up the dispatching thread.
int cancel (long timer_id, const void **act = 0);
+
/// Runs the dispatching thread.
virtual int svc (void);
+
/// Inform the dispatching thread that it should terminate.
virtual void deactivate (void);
+
/// Access the locking mechanism, useful for iteration.
ACE_SYNCH_RECURSIVE_MUTEX &mutex (void);
+
/// Set a user-specified timer queue.
int timer_queue (TQ *tq);
+
/// Return the current <TQ>.
TQ *timer_queue (void) const;
+
/// Return the thread id of our active object.
ACE_thread_t thr_id (void) const;
+
/**
* We override the default activate() method so that we can ensure
* that only a single thread is ever spawned. Otherwise, too many
@@ -154,7 +188,9 @@ public:
size_t stack_size[] = 0,
ACE_thread_t thread_ids[] = 0,
const char* thr_name[] = 0);
+
# if defined (ACE_HAS_DEFERRED_TIMER_COMMANDS)
+
/**
* Enqueues a command object for execution just before waiting on the next
* timer event. This allows deferred execution of commands that cannot
@@ -164,47 +200,63 @@ public:
*/
int enqueue_command (ACE_Command_Base *command_,
COMMAND_ENQUEUE_POSITION pos = TAIL);
+
# endif /* ACE_HAS_DEFERRED_TIMER_COMMANDS */
+
private:
+
# if defined (ACE_HAS_DEFERRED_TIMER_COMMANDS)
/// Dispatches all command objects enqueued in the most
/// recent event handler context.
int dispatch_commands (void);
+
/// Queue of commands for deferred execution.
ACE_Unbounded_Queue<ACE_Command_Base *> command_queue_;
+
/// The mutual exclusion mechanism for the command queue.
ACE_SYNCH_MUTEX command_mutex_;
# endif /* ACE_HAS_DEFERRED_TIMER_COMMANDS */
+
/// The underlying Timer_Queue.
TQ* timer_queue_;
+
/// Keeps track of whether we should delete the timer queue (if we
/// didn't create it, then we don't delete it).
bool delete_timer_queue_;
+
/// The mutual exclusion mechanism that is required to use the
/// <condition_>.
ACE_SYNCH_RECURSIVE_MUTEX mutex_;
+
/**
* The dispatching thread sleeps on this condition while waiting to
* dispatch the next timer; it is used to wake it up if there is a
* change on the timer queue.
*/
ACE_SYNCH_RECURSIVE_CONDITION condition_;
+
/// When deactivate is called this variable turns to false and the
/// dispatching thread is signalled, to terminate its main loop.
bool active_;
+
/// Thread id of our active object task.
ACE_thread_t thr_id_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
# include "ace/Timer_Queue_Adapters.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
# include "ace/Timer_Queue_Adapters.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
# pragma implementation ("Timer_Queue_Adapters.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
#endif /* ACE_TIMER_QUEUE_ADAPTERS_H */
diff --git a/dep/ACE_wrappers/ace/Timer_Queue_Adapters.inl b/dep/ACE_wrappers/ace/Timer_Queue_Adapters.inl
index c44347e989a..77011eacf8b 100644
--- a/dep/ACE_wrappers/ace/Timer_Queue_Adapters.inl
+++ b/dep/ACE_wrappers/ace/Timer_Queue_Adapters.inl
@@ -1,12 +1,15 @@
// -*- C++ -*-
//
// $Id: Timer_Queue_Adapters.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template<class TQ> ACE_INLINE TQ *
ACE_Thread_Timer_Queue_Adapter<TQ>::timer_queue (void) const
{
return this->timer_queue_;
}
+
template<class TQ> ACE_INLINE int
ACE_Thread_Timer_Queue_Adapter<TQ>::timer_queue (TQ *tq)
{
@@ -16,9 +19,11 @@ ACE_Thread_Timer_Queue_Adapter<TQ>::timer_queue (TQ *tq)
this->delete_timer_queue_ = false;
return 0;
}
+
template<class TQ> ACE_INLINE ACE_thread_t
ACE_Thread_Timer_Queue_Adapter<TQ>::thr_id (void) const
{
return this->thr_id_;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Timer_Queue_T.h b/dep/ACE_wrappers/ace/Timer_Queue_T.h
index 2d11fc8072f..8e5478b3245 100644
--- a/dep/ACE_wrappers/ace/Timer_Queue_T.h
+++ b/dep/ACE_wrappers/ace/Timer_Queue_T.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Timer_Queue_T.h
@@ -10,16 +11,22 @@
* @author Darrell Brunsch <brunsch@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_TIMER_QUEUE_T_H
#define ACE_TIMER_QUEUE_T_H
#include /**/ "ace/pre.h"
+
#include "ace/Free_List.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Event_Handler.h"
#include "ace/Time_Value.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Timer_Node_Dispatch_Info_T
*
@@ -32,11 +39,14 @@ class ACE_Timer_Node_Dispatch_Info_T
public:
/// The type of object held in the queue
TYPE type_;
+
/// Asynchronous completion token associated with the timer.
const void *act_;
+
/// Flag to check if the timer is recurring.
int recurring_timer_;
};
+
/**
* @class ACE_Timer_Node_T
*
@@ -48,10 +58,13 @@ class ACE_Timer_Node_T
public:
/// Default constructor
ACE_Timer_Node_T (void);
+
/// Destructor
~ACE_Timer_Node_T (void);
+
/// Useful typedef ..
typedef ACE_Timer_Node_Dispatch_Info_T <TYPE> DISPATCH_INFO;
+
/// Singly linked list
void set (const TYPE &type,
const void *a,
@@ -59,6 +72,7 @@ public:
const ACE_Time_Value &i,
ACE_Timer_Node_T<TYPE> *n,
long timer_id);
+
/// Doubly linked list version
void set (const TYPE &type,
const void *a,
@@ -67,60 +81,85 @@ public:
ACE_Timer_Node_T<TYPE> *p,
ACE_Timer_Node_T<TYPE> *n,
long timer_id);
+
// = Accessors
+
/// Get the type.
TYPE &get_type (void);
+
/// Set the type.
void set_type (TYPE &type);
+
/// Get the asynchronous completion token.
const void *get_act (void);
+
/// Set the asynchronous completion token.
void set_act (void *act);
+
/// Get the timer value.
const ACE_Time_Value &get_timer_value (void) const;
+
/// Set the timer value.
void set_timer_value (const ACE_Time_Value &timer_value);
+
/// Get the timer interval.
const ACE_Time_Value &get_interval (void) const;
+
/// Set the timer interval.
void set_interval (const ACE_Time_Value &interval);
+
/// Get the previous pointer.
ACE_Timer_Node_T<TYPE> *get_prev (void);
+
/// Set the previous pointer.
void set_prev (ACE_Timer_Node_T<TYPE> *prev);
+
/// Get the next pointer.
ACE_Timer_Node_T<TYPE> *get_next (void);
+
/// Set the next pointer.
void set_next (ACE_Timer_Node_T<TYPE> *next);
+
/// Get the timer_id.
long get_timer_id (void) const;
+
/// Set the timer_id.
void set_timer_id (long timer_id);
+
/// Get the dispatch info. The dispatch information is got
/// through <info>. This form helps us in preventing allocation and
/// deleting data along the criticl path.
/// @@TODO: We may want to have a copying version too, so that our
/// interface will be complete..
void get_dispatch_info (ACE_Timer_Node_Dispatch_Info_T <TYPE> &info);
+
/// Dump the state of an TYPE.
void dump (void) const;
+
private:
/// Type of object stored in the Queue
TYPE type_;
+
/// Asynchronous completion token associated with the timer.
const void *act_;
+
/// Time until the timer expires.
ACE_Time_Value timer_value_;
+
/// If this is a periodic timer this holds the time until the next
/// timeout.
ACE_Time_Value interval_;
+
/// Pointer to previous timer.
ACE_Timer_Node_T<TYPE> *prev_;
+
/// Pointer to next timer.
ACE_Timer_Node_T<TYPE> *next_;
+
/// Id of this timer (used to cancel timers before they expire).
long timer_id_;
};
+
/**
* @class ACE_Timer_Queue_Iterator_T
*
@@ -138,17 +177,23 @@ public:
// = Initialization and termination methods.
/// Constructor.
ACE_Timer_Queue_Iterator_T (void);
+
/// Destructor.
virtual ~ACE_Timer_Queue_Iterator_T (void);
+
/// Positions the iterator at the earliest node in the Timer Queue
virtual void first (void) = 0;
+
/// Positions the iterator at the next node in the Timer Queue
virtual void next (void) = 0;
+
/// Returns true when there are no more nodes in the sequence
virtual bool isdone (void) const = 0;
+
/// Returns the node at the current position in the sequence
virtual ACE_Timer_Node_T<TYPE> *item (void) = 0;
};
+
/**
* @class ACE_Timer_Queue_T
*
@@ -164,6 +209,7 @@ class ACE_Timer_Queue_T
public:
/// Type of Iterator.
typedef ACE_Timer_Queue_Iterator_T<TYPE, FUNCTOR, ACE_LOCK> ITERATOR;
+
// = Initialization and termination methods.
/**
* Default constructor. @a upcall_functor is the instance of the
@@ -173,14 +219,18 @@ public:
*/
ACE_Timer_Queue_T (FUNCTOR *upcall_functor = 0,
ACE_Free_List<ACE_Timer_Node_T <TYPE> > *freelist = 0);
+
/// Destructor - make virtual for proper destruction of inherited
/// classes.
virtual ~ACE_Timer_Queue_T (void);
+
/// True if queue is empty, else false.
virtual bool is_empty (void) const = 0;
+
/// Returns the time of the earlier node in the Timer_Queue. Must
/// be called on a non-empty queue.
virtual const ACE_Time_Value &earliest_time (void) const = 0;
+
/**
* Schedule @a type that will expire at @a future_time, which is
* specified in absolute time. If it expires then @a act is passed
@@ -200,6 +250,7 @@ public:
const void *act,
const ACE_Time_Value &future_time,
const ACE_Time_Value &interval = ACE_Time_Value::zero);
+
/**
* Resets the interval of the timer represented by @a timer_id to
* @a interval, which is specified in relative time to the current
@@ -209,6 +260,7 @@ public:
*/
virtual int reset_interval (long timer_id,
const ACE_Time_Value &interval) = 0;
+
/**
* Cancel all timer associated with @a type. If
* @a dont_call_handle_close is 0 then the <functor> will be invoked,
@@ -217,6 +269,7 @@ public:
*/
virtual int cancel (const TYPE &type,
int dont_call_handle_close = 1) = 0;
+
/**
* Cancel the single timer that matches the @a timer_id value (which
* was returned from the <schedule> method). If act is non-NULL
@@ -230,12 +283,14 @@ public:
virtual int cancel (long timer_id,
const void **act = 0,
int dont_call_handle_close = 1) = 0;
+
/**
* Run the <functor> for all timers whose values are <= @a current_time.
* This does not account for <timer_skew>. Returns the number of
* timers canceled.
*/
virtual int expire (const ACE_Time_Value &current_time);
+
/**
* Get the dispatch information for a timer whose value is <= @a current_time.
* This does not account for <timer_skew>. Returns 1 if
@@ -244,6 +299,7 @@ public:
*/
virtual int dispatch_info (const ACE_Time_Value &current_time,
ACE_Timer_Node_Dispatch_Info_T<TYPE> &info);
+
/**
* Run the <functor> for all timers whose values are <=
* <ACE_OS::gettimeofday>. Also accounts for <timer_skew>.
@@ -280,20 +336,25 @@ public:
*
* Returns the number of timers canceled.
*/
+
/* virtual */ int expire (void);
+
/**
* Returns the current time of day. This method allows different
* implementations of the timer queue to use special high resolution
* timers.
*/
/* virtual */ ACE_Time_Value gettimeofday (void);
+
/// Allows applications to control how the timer queue gets the time
/// of day.
void gettimeofday (ACE_Time_Value (*gettimeofday)(void));
+
/// Determine the next event to timeout. Returns @a max if there are
/// no pending timers or if all pending timers are longer than max.
/// This method acquires a lock internally since it modifies internal state.
virtual ACE_Time_Value *calculate_timeout (ACE_Time_Value *max);
+
/**
* Determine the next event to timeout. Returns @a max if there are
* no pending timers or if all pending timers are longer than max.
@@ -306,73 +367,102 @@ public:
*/
virtual ACE_Time_Value *calculate_timeout (ACE_Time_Value *max,
ACE_Time_Value *the_timeout);
+
/// Set the timer skew for the Timer_Queue.
void timer_skew (const ACE_Time_Value &skew);
+
/// Get the timer skew for the Timer_Queue.
const ACE_Time_Value &timer_skew (void) const;
+
/// Synchronization variable used by the queue
ACE_LOCK &mutex (void);
+
/// Accessor to the upcall functor
FUNCTOR &upcall_functor (void);
+
/// Returns a pointer to this ACE_Timer_Queue's iterator.
virtual ITERATOR &iter (void) = 0;
+
/// Removes the earliest node from the queue and returns it
virtual ACE_Timer_Node_T<TYPE> *remove_first (void) = 0;
+
/// Dump the state of a object.
virtual void dump (void) const;
+
/// Reads the earliest node from the queue and returns it.
virtual ACE_Timer_Node_T<TYPE> *get_first (void) = 0;
+
/// Method used to return a timer node to the queue's ownership
/// after it is returned by a method like <remove_first>.
virtual void return_node (ACE_Timer_Node_T<TYPE> *);
+
/// This method will call the preinvoke() on <functor>.
void preinvoke (ACE_Timer_Node_Dispatch_Info_T<TYPE> &info,
const ACE_Time_Value &cur_time,
const void *&upcall_act);
+
/// This method will call the timeout() on <functor>.
void upcall (ACE_Timer_Node_Dispatch_Info_T<TYPE> &info,
const ACE_Time_Value &cur_time);
+
/// This method will call the postinvoke() on <functor>.
void postinvoke (ACE_Timer_Node_Dispatch_Info_T<TYPE> &info,
const ACE_Time_Value &cur_time,
const void *upcall_act);
+
protected:
+
/// Schedule a timer.
virtual long schedule_i (const TYPE &type,
const void *act,
const ACE_Time_Value &future_time,
const ACE_Time_Value &interval) = 0;
+
/// Reschedule an "interval" ACE_Timer_Node.
virtual void reschedule (ACE_Timer_Node_T<TYPE> *) = 0;
+
/// Factory method that allocates a new node.
virtual ACE_Timer_Node_T<TYPE> *alloc_node (void);
+
/// Factory method that frees a previously allocated node.
virtual void free_node (ACE_Timer_Node_T<TYPE> *);
+
/// Non-locking version of dispatch_info ()
virtual int dispatch_info_i (const ACE_Time_Value &current_time,
ACE_Timer_Node_Dispatch_Info_T<TYPE> &info);
+
/// Synchronization variable for ACE_Timer_Queue.
/// @note The right name would be lock_, but HP/C++ will choke on that!
ACE_LOCK mutex_;
+
/// Class that implements a free list
ACE_Free_List<ACE_Timer_Node_T<TYPE> > *free_list_;
+
/// Pointer to function that returns the current time of day.
ACE_Time_Value (*gettimeofday_)(void);
+
/// Upcall functor
FUNCTOR *upcall_functor_;
+
/// To delete or not to delete is the question?
bool const delete_upcall_functor_;
+
/// Flag to delete only if the class created the <free_list_>
bool const delete_free_list_;
+
private:
+
/// Returned by <calculate_timeout>.
ACE_Time_Value timeout_;
+
/// Adjusts for timer skew in various clocks.
ACE_Time_Value timer_skew_;
+
// = Don't allow these operations for now.
ACE_UNIMPLEMENTED_FUNC (ACE_Timer_Queue_T (const ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK> &))
ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK> &))
};
+
/**
* @class ACE_Event_Handler_Handle_Timeout_Upcall
*
@@ -389,15 +479,19 @@ public:
ACE_Event_Handler_Handle_Timeout_Upcall<ACE_LOCK>,
ACE_LOCK>
TIMER_QUEUE;
+
// = Initialization and termination methods.
/// Constructor.
ACE_Event_Handler_Handle_Timeout_Upcall (void);
+
/// Destructor.
~ACE_Event_Handler_Handle_Timeout_Upcall (void);
+
/// This method is called when a timer is registered.
int registration (TIMER_QUEUE &timer_queue,
ACE_Event_Handler *handler,
const void *arg);
+
/// This method is called before the timer expires.
int preinvoke (TIMER_QUEUE &timer_queue,
ACE_Event_Handler *handler,
@@ -405,12 +499,14 @@ public:
int recurring_timer,
const ACE_Time_Value &cur_time,
const void *&upcall_act);
+
/// This method is called when the timer expires.
int timeout (TIMER_QUEUE &timer_queue,
ACE_Event_Handler *handler,
const void *arg,
int recurring_timer,
const ACE_Time_Value &cur_time);
+
/// This method is called after the timer expires.
int postinvoke (TIMER_QUEUE &timer_queue,
ACE_Event_Handler *handler,
@@ -418,39 +514,50 @@ public:
int recurring_timer,
const ACE_Time_Value &cur_time,
const void *upcall_act);
+
/// This method is called when a handler is cancelled
int cancel_type (TIMER_QUEUE &timer_queue,
ACE_Event_Handler *handler,
int dont_call,
int &requires_reference_counting);
+
/// This method is called when a timer is cancelled
int cancel_timer (TIMER_QUEUE &timer_queue,
ACE_Event_Handler *handler,
int dont_call,
int requires_reference_counting);
+
/// This method is called when the timer queue is destroyed and
/// the timer is still contained in it
int deletion (TIMER_QUEUE &timer_queue,
ACE_Event_Handler *handler,
const void *arg);
+
private:
+
/// Flag indicating that reference counting is required for this
/// event handler upcall.
int requires_reference_counting_;
+
// = Don't allow these operations for now.
ACE_UNIMPLEMENTED_FUNC (ACE_Event_Handler_Handle_Timeout_Upcall (const ACE_Event_Handler_Handle_Timeout_Upcall<ACE_LOCK> &))
ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Event_Handler_Handle_Timeout_Upcall<ACE_LOCK> &))
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Timer_Queue_T.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Timer_Queue_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Timer_Queue_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
#endif /* ACE_TIMER_QUEUE_T_H */
diff --git a/dep/ACE_wrappers/ace/Timer_Queue_T.inl b/dep/ACE_wrappers/ace/Timer_Queue_T.inl
index a62ab8e9d35..7606a2e1f62 100644
--- a/dep/ACE_wrappers/ace/Timer_Queue_T.inl
+++ b/dep/ACE_wrappers/ace/Timer_Queue_T.inl
@@ -1,7 +1,9 @@
// -*- C++ -*-
//
// $Id: Timer_Queue_T.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template <class TYPE> ACE_INLINE void
ACE_Timer_Node_T<TYPE>::set (const TYPE &type,
const void *a,
@@ -17,6 +19,7 @@ ACE_Timer_Node_T<TYPE>::set (const TYPE &type,
this->next_ = n;
this->timer_id_ = timer_id;
}
+
template <class TYPE> ACE_INLINE void
ACE_Timer_Node_T<TYPE>::set (const TYPE &type,
const void *a,
@@ -34,76 +37,91 @@ ACE_Timer_Node_T<TYPE>::set (const TYPE &type,
this->next_ = n;
this->timer_id_ = timer_id;
}
+
template <class TYPE> ACE_INLINE TYPE &
ACE_Timer_Node_T<TYPE>::get_type (void)
{
return this->type_;
}
+
template <class TYPE> ACE_INLINE void
ACE_Timer_Node_T<TYPE>::set_type (TYPE &type)
{
this->type_ = type;
}
+
template <class TYPE> ACE_INLINE const void *
ACE_Timer_Node_T<TYPE>::get_act (void)
{
return this->act_;
}
+
template <class TYPE> ACE_INLINE void
ACE_Timer_Node_T<TYPE>::set_act (void *act)
{
this->act_ = act;
}
+
template <class TYPE> ACE_INLINE const ACE_Time_Value &
ACE_Timer_Node_T<TYPE>::get_timer_value (void) const
{
return this->timer_value_;
}
+
template <class TYPE> ACE_INLINE void
ACE_Timer_Node_T<TYPE>::set_timer_value (const ACE_Time_Value &timer_value)
{
this->timer_value_ = timer_value;
}
+
template <class TYPE> ACE_INLINE const ACE_Time_Value &
ACE_Timer_Node_T<TYPE>::get_interval (void) const
{
return this->interval_;
}
+
template <class TYPE> ACE_INLINE void
ACE_Timer_Node_T<TYPE>::set_interval (const ACE_Time_Value &interval)
{
this->interval_ = interval;
}
+
template <class TYPE> ACE_INLINE ACE_Timer_Node_T<TYPE> *
ACE_Timer_Node_T<TYPE>::get_prev (void)
{
return this->prev_;
}
+
template <class TYPE> ACE_INLINE void
ACE_Timer_Node_T<TYPE>::set_prev (ACE_Timer_Node_T<TYPE> *prev)
{
this->prev_ = prev;
}
+
template <class TYPE> ACE_INLINE ACE_Timer_Node_T<TYPE> *
ACE_Timer_Node_T<TYPE>::get_next (void)
{
return this->next_;
}
+
template <class TYPE> ACE_INLINE void
ACE_Timer_Node_T<TYPE>::set_next (ACE_Timer_Node_T<TYPE> *next)
{
this->next_ = next;
}
+
template <class TYPE> ACE_INLINE long
ACE_Timer_Node_T<TYPE>::get_timer_id (void) const
{
return this->timer_id_;
}
+
template <class TYPE> ACE_INLINE void
ACE_Timer_Node_T<TYPE>::set_timer_id (long timer_id)
{
this->timer_id_ = timer_id;
}
+
template <class TYPE> ACE_INLINE void
ACE_Timer_Node_T<TYPE>::get_dispatch_info (ACE_Timer_Node_Dispatch_Info_T<TYPE> &info)
{
@@ -113,16 +131,19 @@ ACE_Timer_Node_T<TYPE>::get_dispatch_info (ACE_Timer_Node_Dispatch_Info_T<TYPE>
info.recurring_timer_ =
this->interval_ > ACE_Time_Value::zero;
}
+
template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_INLINE void
ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::timer_skew (const ACE_Time_Value &skew)
{
timer_skew_ = skew;
}
+
template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_INLINE const ACE_Time_Value &
ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::timer_skew (void) const
{
return timer_skew_;
}
+
template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_INLINE int
ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::expire (void)
{
@@ -131,14 +152,17 @@ ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::expire (void)
else
return 0;
}
+
template <class TYPE, class FUNCTOR, class ACE_LOCK> int
ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::dispatch_info (const ACE_Time_Value &cur_time,
ACE_Timer_Node_Dispatch_Info_T<TYPE> &info)
{
ACE_TRACE ("ACE_Timer_Queue_T::dispatch_info");
ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, 0));
+
return this->dispatch_info_i (cur_time, info);
}
+
template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_INLINE void
ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::upcall (ACE_Timer_Node_Dispatch_Info_T<TYPE> &info,
const ACE_Time_Value &cur_time)
@@ -149,6 +173,7 @@ ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::upcall (ACE_Timer_Node_Dispatch_Info
info.recurring_timer_,
cur_time);
}
+
template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_INLINE void
ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::preinvoke (ACE_Timer_Node_Dispatch_Info_T<TYPE> &info,
const ACE_Time_Value &cur_time,
@@ -161,6 +186,7 @@ ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::preinvoke (ACE_Timer_Node_Dispatch_I
cur_time,
upcall_act);
}
+
template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_INLINE void
ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::postinvoke (ACE_Timer_Node_Dispatch_Info_T<TYPE> &info,
const ACE_Time_Value &cur_time,
@@ -173,20 +199,24 @@ ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::postinvoke (ACE_Timer_Node_Dispatch_
cur_time,
upcall_act);
}
+
template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_INLINE ACE_Time_Value
ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::gettimeofday (void)
{
// Invoke gettimeofday via pointer to function.
return this->gettimeofday_ ();
}
+
template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_INLINE void
ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::gettimeofday (ACE_Time_Value (*gettimeofday)(void))
{
this->gettimeofday_ = gettimeofday;
}
+
template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_INLINE FUNCTOR &
ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::upcall_functor (void)
{
return *this->upcall_functor_;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Timer_Queuefwd.h b/dep/ACE_wrappers/ace/Timer_Queuefwd.h
index 70cd3af4674..5ee99ff1823 100644
--- a/dep/ACE_wrappers/ace/Timer_Queuefwd.h
+++ b/dep/ACE_wrappers/ace/Timer_Queuefwd.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Timer_Queuefwd.h
@@ -10,19 +11,29 @@
* @author Ossama Othman <ossama@dre.vanderbilt.edu>
*/
//=============================================================================
+
#ifndef ACE_TIMER_QUEUE_FWD_H
#define ACE_TIMER_QUEUE_FWD_H
+
#include /**/ "ace/pre.h"
+
#include "ace/Synch_Traits.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template <class TYPE, class FUNCTOR, class ACE_LOCK> class ACE_Timer_Queue_T;
template <class ACE_LOCK> class ACE_Event_Handler_Handle_Timeout_Upcall;
+
class ACE_Event_Handler;
+
typedef ACE_Timer_Queue_T<ACE_Event_Handler *,
ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>,
ACE_SYNCH_RECURSIVE_MUTEX>
ACE_Timer_Queue;
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
+
#endif /* ACE_TIMER_QUEUE_FWD_H */
diff --git a/dep/ACE_wrappers/ace/Timer_Wheel.h b/dep/ACE_wrappers/ace/Timer_Wheel.h
index 68fd94065fb..888dc4a4470 100644
--- a/dep/ACE_wrappers/ace/Timer_Wheel.h
+++ b/dep/ACE_wrappers/ace/Timer_Wheel.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Timer_Wheel.h
@@ -9,25 +10,34 @@
*/
//=============================================================================
+
#ifndef ACE_TIMER_WHEEL_H
#define ACE_TIMER_WHEEL_H
#include /**/ "ace/pre.h"
+
#include "ace/Timer_Wheel_T.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// The following typedefs are here for ease of use and backward
// compatibility.
+
typedef ACE_Timer_Wheel_T<ACE_Event_Handler *,
ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>,
ACE_SYNCH_RECURSIVE_MUTEX>
ACE_Timer_Wheel;
+
typedef ACE_Timer_Wheel_Iterator_T<ACE_Event_Handler *,
ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>,
ACE_SYNCH_RECURSIVE_MUTEX>
ACE_Timer_Wheel_Iterator;
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
#endif /* ACE_TIMER_WHEEL_H */
diff --git a/dep/ACE_wrappers/ace/Timer_Wheel_T.h b/dep/ACE_wrappers/ace/Timer_Wheel_T.h
index 5cedf75ebe6..7222837011b 100644
--- a/dep/ACE_wrappers/ace/Timer_Wheel_T.h
+++ b/dep/ACE_wrappers/ace/Timer_Wheel_T.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Timer_Wheel_T.h
@@ -8,17 +9,23 @@
* @author Darrell Brunsch <brunsch@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_TIMER_WHEEL_T_H
#define ACE_TIMER_WHEEL_T_H
#include /**/ "ace/pre.h"
+
#include "ace/Timer_Queue_T.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward declaration
template <class TYPE, class FUNCTOR, class ACE_LOCK>
class ACE_Timer_Wheel_T;
+
/**
* @class ACE_Timer_Wheel_Iterator_T
*
@@ -35,28 +42,38 @@ class ACE_Timer_Wheel_Iterator_T
public:
typedef ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK> Wheel;
typedef ACE_Timer_Node_T<TYPE> Node;
+
/// Constructor
ACE_Timer_Wheel_Iterator_T (Wheel &);
+
/// Destructor
~ACE_Timer_Wheel_Iterator_T (void);
+
/// Positions the iterator at the earliest node in the Timer Queue
virtual void first (void);
+
/// Positions the iterator at the next node in the Timer Queue
virtual void next (void);
+
/// Returns true when there are no more nodes in the sequence
virtual bool isdone (void) const;
+
/// Returns the node at the current position in the sequence
virtual ACE_Timer_Node_T<TYPE>* item (void);
+
protected:
/// Pointer to the ACE_Timer_List that we are iterating over.
Wheel& timer_wheel_;
+
/// Current position in the timing wheel
u_int spoke_;
+
/// Pointer to the position in the the <pos_>th list
ACE_Timer_Node_T<TYPE>* current_node_;
private:
void goto_next(u_int start_spoke);
};
+
/**
* @class ACE_Timer_Wheel_T
*
@@ -83,58 +100,75 @@ public:
/// Type inherited from
typedef ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK> Base;
typedef ACE_Free_List<Node> FreeList;
+
/// Default constructor
ACE_Timer_Wheel_T (FUNCTOR* upcall_functor = 0, FreeList* freelist = 0);
+
/// Constructor with opportunities to set the wheelsize and resolution
ACE_Timer_Wheel_T (u_int spoke_count,
u_int resolution,
size_t prealloc = 0,
FUNCTOR* upcall_functor = 0,
FreeList* freelist = 0);
+
/// Destructor
virtual ~ACE_Timer_Wheel_T (void);
+
/// True if queue is empty, else false.
virtual bool is_empty (void) const;
+
/// Returns the time of the earlier node in the ACE_Timer_Wheel.
/// Must be called on a non-empty queue.
virtual const ACE_Time_Value& earliest_time (void) const;
+
/// Changes the interval of a timer (and can make it periodic or non
/// periodic by setting it to ACE_Time_Value::zero or not).
virtual int reset_interval (long timer_id,
const ACE_Time_Value& interval);
+
/// Cancel all timer associated with @a type. If <dont_call> is 0
/// then the <functor> will be invoked. Returns number of timers
/// cancelled.
virtual int cancel (const TYPE& type,
int dont_call_handle_close = 1);
+
// Cancel a timer, storing the magic cookie in act (if nonzero).
// Calls the functor if dont_call_handle_close is 0 and returns 1
// on success
virtual int cancel (long timer_id,
const void** act = 0,
int dont_call_handle_close = 1);
+
/// Run the <functor> for all timers whose values are <=
/// <ACE_OS::gettimeofday>. Also accounts for <timer_skew>. Returns
/// the number of timers canceled.
virtual int expire (void);
+
// Run the <functor> for all timers whose values are <= @a current_time.
// This does not account for <timer_skew>. Returns the number of
// timers canceled.
int expire (const ACE_Time_Value& current_time);
+
/// Returns a pointer to this <ACE_Timer_Queue_T>'s iterator.
virtual ACE_Timer_Queue_Iterator_T<TYPE, FUNCTOR, ACE_LOCK>& iter (void);
+
/// Removes the earliest node from the queue and returns it
virtual ACE_Timer_Node_T<TYPE>* remove_first (void);
+
/// Dump the state of an object.
virtual void dump (void) const;
+
/// Reads the earliest node from the queue and returns it.
virtual ACE_Timer_Node_T<TYPE>* get_first (void);
+
protected:
+
/// Schedules a timer.
virtual long schedule_i (const TYPE& type,
const void* act,
const ACE_Time_Value& future_time,
const ACE_Time_Value& interval);
+
private:
// The following are documented in the .cpp file.
ACE_Timer_Node_T<TYPE>* get_first_i (void) const;
@@ -149,8 +183,10 @@ private:
void cancel_i (ACE_Timer_Node_T<TYPE>* n);
void unlink (ACE_Timer_Node_T<TYPE>* n);
void recalc_earliest(const ACE_Time_Value& last);
+
private:
int power2bits (int n, int min_bits, int max_bits);
+
/// Timing Wheel.
ACE_Timer_Node_T<TYPE>** spokes_;
/// Size of the timing wheel.
@@ -169,18 +205,23 @@ private:
ACE_Time_Value wheel_time_;
/// The total number of timers currently scheduled.
u_int timer_count_;
+
// = Don't allow these operations for now, don't split into multiple lines
// breaks sun compilers
ACE_UNIMPLEMENTED_FUNC (ACE_Timer_Wheel_T (const ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK> &))
ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK> &))
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Timer_Wheel_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Timer_Wheel_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
#endif /* ACE_TIMER_WHEEL_T_H */
diff --git a/dep/ACE_wrappers/ace/Token.cpp b/dep/ACE_wrappers/ace/Token.cpp
index 89ad0599128..99686563f67 100644
--- a/dep/ACE_wrappers/ace/Token.cpp
+++ b/dep/ACE_wrappers/ace/Token.cpp
@@ -1,24 +1,35 @@
// $Id: Token.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Token.h"
+
#if !defined (__ACE_INLINE__)
# include "ace/Token.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace, Token, "$Id: Token.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if defined (ACE_HAS_THREADS)
+
#include "ace/Thread.h"
#include "ace/Log_Msg.h"
+
#if defined (ACE_TOKEN_DEBUGGING)
// FUZZ: disable check_for_streams_include
#include "ace/streams.h"
#endif /* ACE_TOKEN_DEBUGGING */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_Token)
+
void
ACE_Token::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_Token::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
+
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nthread = %d"), ACE_Thread::self ()));
// @@ Is there a portable way to do this?
// ACE_DEBUG ((LM_DEBUG, "\nowner_ = %d", (long) this->owner_));
@@ -29,6 +40,7 @@ ACE_Token::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
ACE_Token::ACE_Token_Queue_Entry::ACE_Token_Queue_Entry (ACE_Thread_Mutex &m,
ACE_thread_t t_id)
: next_ (0),
@@ -43,8 +55,10 @@ ACE_Token::ACE_Token_Queue_Entry::ACE_Token_Queue_Entry (ACE_Thread_Mutex &m,
#if defined (ACE_TOKEN_USES_SEMAPHORE)
ACE_UNUSED_ARG (m);
#endif /* ACE_TOKEN_USES_SEMAPHORE */
+
ACE_TRACE ("ACE_Token::ACE_Token_Queue_Entry::ACE_Token_Queue_Entry");
}
+
ACE_Token::ACE_Token_Queue_Entry::ACE_Token_Queue_Entry (ACE_Thread_Mutex &m,
ACE_thread_t t_id,
ACE_Condition_Attributes &attributes)
@@ -61,14 +75,17 @@ ACE_Token::ACE_Token_Queue_Entry::ACE_Token_Queue_Entry (ACE_Thread_Mutex &m,
ACE_UNUSED_ARG (m);
ACE_UNUSED_ARG (attributes);
#endif /* ACE_TOKEN_USES_SEMAPHORE */
+
ACE_TRACE ("ACE_Token::ACE_Token_Queue_Entry::ACE_Token_Queue_Entry");
}
+
ACE_Token::ACE_Token_Queue::ACE_Token_Queue (void)
: head_ (0),
tail_ (0)
{
ACE_TRACE ("ACE_Token::ACE_Token_Queue::ACE_Token_Queue");
}
+
//
// Remove an entry from the list. Must be called with locks held.
//
@@ -78,12 +95,15 @@ ACE_Token::ACE_Token_Queue::remove_entry (ACE_Token::ACE_Token_Queue_Entry *entr
ACE_TRACE ("ACE_Token::ACE_Token_Queue::remove_entry");
ACE_Token_Queue_Entry *curr = 0;
ACE_Token_Queue_Entry *prev = 0;
+
if (this->head_ == 0)
return;
+
for (curr = this->head_;
curr != 0 && curr != entry;
curr = curr->next_)
prev = curr;
+
if (curr == 0)
// Didn't find the entry...
return;
@@ -93,11 +113,13 @@ ACE_Token::ACE_Token_Queue::remove_entry (ACE_Token::ACE_Token_Queue_Entry *entr
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.
if (curr->next_ == 0)
this->tail_ = prev;
}
+
//
// Add an entry into the list. Must be called with locks held.
//
@@ -127,15 +149,20 @@ ACE_Token::ACE_Token_Queue::insert_entry (ACE_Token::ACE_Token_Queue_Entry &entr
// Insert in the middle of the queue somewhere.
{
// Determine where our thread should go in the queue of waiters.
+
ACE_Token::ACE_Token_Queue_Entry *insert_after = this->head_;
while (requeue_position-- && insert_after->next_ != 0)
insert_after = insert_after->next_;
+
entry.next_ = insert_after->next_;
+
if (entry.next_ == 0)
this->tail_ = &entry;
+
insert_after->next_ = &entry;
}
}
+
ACE_Token::ACE_Token (const ACE_TCHAR *name, void *any)
: lock_ (name, (ACE_mutexattr_t *) any),
owner_ (ACE_OS::NULL_thread),
@@ -147,10 +174,12 @@ ACE_Token::ACE_Token (const ACE_TCHAR *name, void *any)
{
// ACE_TRACE ("ACE_Token::ACE_Token");
}
+
ACE_Token::~ACE_Token (void)
{
ACE_TRACE ("ACE_Token::~ACE_Token");
}
+
int
ACE_Token::shared_acquire (void (*sleep_hook_func)(void *),
void *arg,
@@ -159,10 +188,13 @@ ACE_Token::shared_acquire (void (*sleep_hook_func)(void *),
{
ACE_TRACE ("ACE_Token::shared_acquire");
ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1);
+
#if defined (ACE_TOKEN_DEBUGGING)
this->dump ();
#endif /* ACE_TOKEN_DEBUGGING */
+
ACE_thread_t const thr_id = ACE_Thread::self ();
+
// Nobody holds the token.
if (!this->in_use_)
{
@@ -171,28 +203,34 @@ ACE_Token::shared_acquire (void (*sleep_hook_func)(void *),
this->owner_ = thr_id;
return 0;
}
+
//
// Someone already holds the token.
//
+
// Check if it is us.
if (ACE_OS::thr_equal (thr_id, this->owner_))
{
++this->nesting_level_;
return 0;
}
+
// Do a quick check for "polling" behavior.
if (timeout != 0 && timeout->sec () == 0 && timeout->usec () == 0)
{
errno = ETIME;
return -1;
}
+
//
// We've got to sleep until we get the token.
//
+
// Which queue we should end up in...
ACE_Token_Queue *queue = (op_type == ACE_Token::READ_TOKEN
? &this->readers_
: &this->writers_);
+
// Allocate queue entry on stack. This works since we don't exit
// this method's activation record until we've got the token.
ACE_Token::ACE_Token_Queue_Entry my_entry (this->lock_,
@@ -200,6 +238,7 @@ ACE_Token::shared_acquire (void (*sleep_hook_func)(void *),
this->attributes_);
queue->insert_entry (my_entry, this->queueing_strategy_);
++this->waiters_;
+
// Execute appropriate <sleep_hook> callback. (@@ should these
// methods return a success/failure status, and if so, what should
// we do with it?)
@@ -215,41 +254,50 @@ ACE_Token::shared_acquire (void (*sleep_hook_func)(void *),
this->sleep_hook ();
++ret;
}
+
bool timed_out = false;
bool error = false;
+
// Sleep until we've got the token (ignore signals).
do
{
int const result = my_entry.wait (timeout, this->lock_);
+
if (result == -1)
{
// Note, this should obey whatever thread-specific interrupt
// policy is currently in place...
if (errno == EINTR)
continue;
+
#if defined (ACE_TOKEN_DEBUGGING)
cerr << '(' << ACE_Thread::self () << ')'
<< " acquire: "
<< (errno == ETIME ? "timed out" : "error occurred")
<< endl;
#endif /* ACE_TOKEN_DEBUGGING */
+
// We come here if a timeout occurs or some serious
// ACE_Condition object error.
if (errno == ETIME)
timed_out = true;
else
error = true;
+
// Stop the loop.
break;
}
}
while (!ACE_OS::thr_equal (thr_id, this->owner_));
+
// Do this always and irrespective of the result of wait().
--this->waiters_;
queue->remove_entry (&my_entry);
+
#if defined (ACE_TOKEN_DEBUGGING)
ACE_DEBUG ((LM_DEBUG, "(%t) ACE_Token::shared_acquire (UNBLOCKED)\n"));
#endif /* ACE_TOKEN_DEBUGGING */
+
// If timeout occured
if (timed_out)
{
@@ -259,6 +307,7 @@ ACE_Token::shared_acquire (void (*sleep_hook_func)(void *),
// Wakeup next waiter since this thread timed out.
this->wakeup_next_waiter ();
}
+
// Return error.
return -1;
}
@@ -267,25 +316,32 @@ ACE_Token::shared_acquire (void (*sleep_hook_func)(void *),
// Return error.
return -1;
}
+
// If this is a normal wakeup, this thread should be runnable.
ACE_ASSERT (my_entry.runable_);
+
return ret;
}
+
// By default this is a no-op.
+
/* virtual */
void
ACE_Token::sleep_hook (void)
{
ACE_TRACE ("ACE_Token::sleep_hook");
}
+
int
ACE_Token::acquire (ACE_Time_Value *timeout)
{
ACE_TRACE ("ACE_Token::acquire");
return this->shared_acquire (0, 0, timeout, ACE_Token::WRITE_TOKEN);
}
+
// Acquire the token, sleeping until it is obtained or until <timeout>
// expires.
+
int
ACE_Token::acquire (void (*sleep_hook_func)(void *),
void *arg,
@@ -294,79 +350,100 @@ ACE_Token::acquire (void (*sleep_hook_func)(void *),
ACE_TRACE ("ACE_Token::acquire");
return this->shared_acquire (sleep_hook_func, arg, timeout, ACE_Token::WRITE_TOKEN);
}
+
// Try to renew the token.
+
int
ACE_Token::renew (int requeue_position,
ACE_Time_Value *timeout)
{
ACE_TRACE ("ACE_Token::renew");
ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1);
+
#if defined (ACE_TOKEN_DEBUGGING)
this->dump ();
#endif /* ACE_TOKEN_DEBUGGING */
// ACE_ASSERT (ACE_OS::thr_equal (ACE_Thread::self (), this->owner_));
+
// Check to see if there are any waiters worth giving up the lock
// for.
+
// If no writers and either we are a writer or there are no readers.
if (this->writers_.head_ == 0 &&
(this->in_use_ == ACE_Token::WRITE_TOKEN ||
this->readers_.head_ == 0))
// Immediate return.
return 0;
+
// We've got to sleep until we get the token again.
+
// Determine which queue should this thread go to.
ACE_Token::ACE_Token_Queue *this_threads_queue =
this->in_use_ == ACE_Token::READ_TOKEN ?
&this->readers_ : &this->writers_;
+
ACE_Token::ACE_Token_Queue_Entry my_entry (this->lock_,
this->owner_);
+
this_threads_queue->insert_entry (my_entry,
// if requeue_position == 0 then we want to go next,
// otherwise use the queueing strategy, which might also
// happen to be 0.
requeue_position == 0 ? 0 : this->queueing_strategy_);
++this->waiters_;
+
// Remember nesting level...
int const save_nesting_level_ = this->nesting_level_;
+
// Reset state for new owner.
this->nesting_level_ = 0;
+
// Wakeup waiter.
this->wakeup_next_waiter ();
+
bool timed_out = false;
bool error = false;
+
// Sleep until we've got the token (ignore signals).
do
{
int const result = my_entry.wait (timeout, this->lock_);
+
if (result == -1)
{
// Note, this should obey whatever thread-specific interrupt
// policy is currently in place...
if (errno == EINTR)
continue;
+
#if defined (ACE_TOKEN_DEBUGGING)
cerr << '(' << ACE_Thread::self () << ')'
<< " renew: "
<< (errno == ETIME ? "timed out" : "error occurred")
<< endl;
#endif /* ACE_TOKEN_DEBUGGING */
+
// We come here if a timeout occurs or some serious
// ACE_Condition object error.
if (errno == ETIME)
timed_out = true;
else
error = true;
+
// Stop the loop.
break;
}
}
while (!ACE_OS::thr_equal (my_entry.thread_id_, this->owner_));
+
// Do this always and irrespective of the result of wait().
--this->waiters_;
this_threads_queue->remove_entry (&my_entry);
+
#if defined (ACE_TOKEN_DEBUGGING)
ACE_DEBUG ((LM_DEBUG, "(%t) ACE_Token::renew (UNBLOCKED)\n"));
#endif /* ACE_TOKEN_DEBUGGING */
+
// If timeout occured
if (timed_out)
{
@@ -376,6 +453,7 @@ ACE_Token::renew (int requeue_position,
// Wakeup next waiter since this thread timed out.
this->wakeup_next_waiter ();
}
+
// Return error.
return -1;
}
@@ -384,22 +462,29 @@ ACE_Token::renew (int requeue_position,
// Return error.
return -1;
}
+
// If this is a normal wakeup, this thread should be runnable.
ACE_ASSERT (my_entry.runable_);
+
// Reinstate nesting level.
this->nesting_level_ = save_nesting_level_;
+
return 0;
}
+
// Release the current holder of the token (which had
// better be the caller's thread!).
+
int
ACE_Token::release (void)
{
ACE_TRACE ("ACE_Token::release");
ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1);
+
#if defined (ACE_TOKEN_DEBUGGING)
this->dump ();
#endif /* ACE_TOKEN_DEBUGGING */
+
// Nested release...
if (this->nesting_level_ > 0)
--this->nesting_level_;
@@ -408,18 +493,23 @@ ACE_Token::release (void)
//
// Regular release...
//
+
// Wakeup waiter.
this->wakeup_next_waiter ();
}
+
return 0;
}
+
void
ACE_Token::wakeup_next_waiter (void)
{
ACE_TRACE ("ACE_Token::wakeup_next_waiter");
+
// Reset state for new owner.
this->owner_ = ACE_OS::NULL_thread;
this->in_use_ = 0;
+
// Any waiters...
if (this->writers_.head_ == 0 &&
this->readers_.head_ == 0)
@@ -427,8 +517,10 @@ ACE_Token::wakeup_next_waiter (void)
// No more waiters...
return;
}
+
// Wakeup next waiter.
ACE_Token_Queue *queue = 0;
+
// Writer threads get priority to run first.
if (this->writers_.head_ != 0)
{
@@ -440,11 +532,15 @@ ACE_Token::wakeup_next_waiter (void)
this->in_use_ = ACE_Token::READ_TOKEN;
queue = &this->readers_;
}
+
// Wake up waiter and make it runable.
queue->head_->runable_ = 1;
queue->head_->signal ();
+
this->owner_ = queue->head_->thread_id_;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_THREADS */
diff --git a/dep/ACE_wrappers/ace/Token.h b/dep/ACE_wrappers/ace/Token.h
index 2368f264cde..e98e5f9a774 100644
--- a/dep/ACE_wrappers/ace/Token.h
+++ b/dep/ACE_wrappers/ace/Token.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Token.h
@@ -11,26 +12,38 @@
* @author Douglas C. Schmidt (schmidt@cs.wustl.edu)
*/
//=============================================================================
+
#ifndef ACE_TOKEN_H
#define ACE_TOKEN_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Null_Mutex.h"
+
#if defined (ACE_HAS_THREADS)
+
#include "ace/Thread_Mutex.h"
+
#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) || defined (ACE_HAS_VXTHREADS)
// If platforms support semaphores with timed wait, then we use semaphores instead of c.v.
# define ACE_TOKEN_USES_SEMAPHORE
#endif /* (ACE_WIN32 && !ACE_HAS_WINCE) || VXWORKS */
+
#if defined (ACE_TOKEN_USES_SEMAPHORE)
# include "ace/Semaphore.h"
#endif /* ACE_TOKEN_USES_SEMAPHORE */
+
#include "ace/Condition_Thread_Mutex.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Time_Value;
+
/**
* @class ACE_Token
*
@@ -63,6 +76,7 @@ class ACE_Time_Value;
class ACE_Export ACE_Token
{
public:
+
/**
* Available queueing strategies.
*/
@@ -73,17 +87,25 @@ public:
/// LIFO, Last In, First Out
LIFO = 0
};
+
// = Initialization and termination.
+
/// Constructor
ACE_Token (const ACE_TCHAR *name = 0, void * = 0);
+
/// Destructor
virtual ~ACE_Token (void);
+
// = Strategies
+
/// Retrieve the current queueing strategy.
int queueing_strategy (void);
+
/// Set the queueing strategy.
void queueing_strategy (int queueing_strategy);
+
// = Synchronization operations.
+
/**
* Acquire the token, sleeping until it is obtained or until the
* expiration of @a timeout, which is treated as "absolute" time. If
@@ -101,18 +123,21 @@ public:
int acquire (void (*sleep_hook)(void *),
void *arg = 0,
ACE_Time_Value *timeout = 0);
+
/**
* This behaves just like the previous <acquire> method, except that
* it invokes the virtual function called <sleep_hook> that can be
* overridden by a subclass of ACE_Token.
*/
int acquire (ACE_Time_Value *timeout = 0);
+
/**
* This should be overridden by a subclass to define the appropriate
* behavior before <acquire> goes to sleep. By default, this is a
* no-op...
*/
virtual void sleep_hook (void);
+
/**
* An optimized method that efficiently reacquires the token if no
* other threads are waiting. This is useful for situations where
@@ -133,19 +158,24 @@ public:
*/
int renew (int requeue_position = 0,
ACE_Time_Value *timeout = 0);
+
/// Become interface-compliant with other lock mechanisms (implements
/// a non-blocking <acquire>).
int tryacquire (void);
+
/// Shuts down the ACE_Token instance.
int remove (void);
+
/// Relinquish the token. If there are any waiters then the next one
/// in line gets it.
int release (void);
+
/// Behaves like acquire() but at a lower priority. It should probably
/// be called acquire_yield() since the semantics aren't really
/// what's commonly expected for readers/writer locks. See the class
/// documentation above for more details.
int acquire_read (void);
+
/// Behaves like acquire() but at a lower priority. It should probably
/// be called acquire_yield() since the semantics aren't really
/// what's commonly expected for readers/writer locks. See the class
@@ -153,28 +183,39 @@ public:
int acquire_read (void (*sleep_hook)(void *),
void *arg = 0,
ACE_Time_Value *timeout = 0);
+
/// Calls acquire().
int acquire_write (void);
+
/// Calls acquire().
int acquire_write (void (*sleep_hook)(void *),
void *arg = 0,
ACE_Time_Value *timeout = 0);
+
/// Lower priority try_acquire().
int tryacquire_read (void);
+
/// Just calls <tryacquire>.
int tryacquire_write (void);
+
/// Assumes the caller has acquired the token and returns 0.
int tryacquire_write_upgrade (void);
+
// = Accessor methods.
+
/// Return the number of threads that are currently waiting to get
/// the token.
int waiters (void);
+
/// Return the id of the current thread that owns the token.
ACE_thread_t current_owner (void);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
/// The following structure implements a LIFO/FIFO queue of waiter threads
/// that are asleep waiting to obtain the token.
struct ACE_Token_Queue_Entry
@@ -182,18 +223,24 @@ public:
/// Constructor
ACE_Token_Queue_Entry (ACE_Thread_Mutex &m,
ACE_thread_t t_id);
+
/// Constructor using a pre-allocated attributes
ACE_Token_Queue_Entry (ACE_Thread_Mutex &m,
ACE_thread_t t_id,
ACE_Condition_Attributes &attributes);
+
/// Entry blocks on the token.
int wait (ACE_Time_Value *timeout, ACE_Thread_Mutex &lock);
+
/// Notify (unblock) the entry.
int signal (void);
+
/// Pointer to next waiter.
ACE_Token_Queue_Entry *next_;
+
/// ACE_Thread id of this waiter.
ACE_thread_t thread_id_;
+
#if defined (ACE_TOKEN_USES_SEMAPHORE)
/// ACE_Semaphore object used to wake up waiter when it can run again.
ACE_Semaphore cv_;
@@ -201,59 +248,81 @@ public:
/// ACE_Condition object used to wake up waiter when it can run again.
ACE_Condition_Thread_Mutex cv_;
#endif /* ACE_TOKEN_USES_SEMAPHORE */
+
/// Ok to run.
int runable_;
};
+
private:
enum ACE_Token_Op_Type
{
READ_TOKEN = 1,
WRITE_TOKEN
};
+
struct ACE_Token_Queue
{
/// Constructor
ACE_Token_Queue (void);
+
/// Remove a waiter from the queue.
void remove_entry (ACE_Token_Queue_Entry *);
+
/// Insert a waiter into the queue.
void insert_entry (ACE_Token_Queue_Entry &entry,
int requeue_position = -1);
+
/// Head of the list of waiting threads.
ACE_Token_Queue_Entry *head_;
+
/// Tail of the list of waiting threads.
ACE_Token_Queue_Entry *tail_;
};
+
/// Implements the <acquire> and <tryacquire> methods above.
int shared_acquire (void (*sleep_hook_func)(void *),
void *arg,
ACE_Time_Value *timeout,
ACE_Token_Op_Type op_type);
+
/// Wake next in line for ownership.
void wakeup_next_waiter (void);
+
/// A queue of writer threads.
ACE_Token_Queue writers_;
+
/// A queue of reader threads.
ACE_Token_Queue readers_;
+
/// ACE_Thread_Mutex used to lock internal data structures.
ACE_Thread_Mutex lock_;
+
/// Current owner of the token.
ACE_thread_t owner_;
+
/// Some thread (i.e., <owner_>) is using the token. We need this
/// extra variable to deal with POSIX pthreads madness...
int in_use_;
+
/// Number of waiters.
int waiters_;
+
/// Current nesting level.
int nesting_level_;
+
/// The attributes for the condition variables, optimizes lock time.
ACE_Condition_Attributes attributes_;
+
/// Queueing strategy, LIFO/FIFO.
int queueing_strategy_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#else
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Export ACE_Token
{
public:
@@ -264,9 +333,13 @@ public:
int remove (void) { ACE_NOTSUP_RETURN (-1); }
int release (void) { ACE_NOTSUP_RETURN (-1); }
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_THREADS */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Export ACE_Noop_Token : public ACE_Null_Mutex
{
public:
@@ -276,21 +349,29 @@ public:
FIFO = -1,
LIFO = 0
};
+
/// Get queueing strategy.
int queueing_strategy (void);
+
/// Set queueing strategy.
void queueing_strategy (int queueing_strategy);
+
int renew (int = 0, ACE_Time_Value * =0);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Token.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_TOKEN_H */
diff --git a/dep/ACE_wrappers/ace/Token.inl b/dep/ACE_wrappers/ace/Token.inl
index 922ac3c3e43..f09a0e6f3de 100644
--- a/dep/ACE_wrappers/ace/Token.inl
+++ b/dep/ACE_wrappers/ace/Token.inl
@@ -1,21 +1,28 @@
// -*- C++ -*-
//
// $Id: Token.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/config-macros.h"
+
#if defined (ACE_HAS_THREADS)
+
#include "ace/Guard_T.h"
#include "ace/Time_Value.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE int
ACE_Token::queueing_strategy (void)
{
return this->queueing_strategy_;
}
+
ACE_INLINE void
ACE_Token::queueing_strategy (int queueing_strategy)
{
this->queueing_strategy_ = queueing_strategy == -1 ? -1 : 0;
}
+
ACE_INLINE int
ACE_Token::remove (void)
{
@@ -23,6 +30,7 @@ ACE_Token::remove (void)
// Don't have an implementation for this yet...
ACE_NOTSUP_RETURN (-1);
}
+
ACE_INLINE int
ACE_Token::tryacquire (void)
{
@@ -30,21 +38,26 @@ ACE_Token::tryacquire (void)
return this->shared_acquire
(0, 0, (ACE_Time_Value *) &ACE_Time_Value::zero, ACE_Token::WRITE_TOKEN);
}
+
ACE_INLINE int
ACE_Token::waiters (void)
{
ACE_TRACE ("ACE_Token::waiters");
ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1);
+
int const ret = this->waiters_;
return ret;
}
+
ACE_INLINE ACE_thread_t
ACE_Token::current_owner (void)
{
ACE_TRACE ("ACE_Token::current_owner");
ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, this->owner_);
+
return this->owner_;
}
+
ACE_INLINE int
ACE_Token::acquire_read (void)
{
@@ -52,6 +65,7 @@ ACE_Token::acquire_read (void)
return this->shared_acquire
(0, 0, 0, ACE_Token::READ_TOKEN);
}
+
ACE_INLINE int
ACE_Token::acquire_write (void)
{
@@ -59,6 +73,7 @@ ACE_Token::acquire_write (void)
return this->shared_acquire
(0, 0, 0, ACE_Token::WRITE_TOKEN);
}
+
ACE_INLINE int
ACE_Token::tryacquire_read (void)
{
@@ -66,6 +81,7 @@ ACE_Token::tryacquire_read (void)
return this->shared_acquire
(0, 0, (ACE_Time_Value *) &ACE_Time_Value::zero, ACE_Token::READ_TOKEN);
}
+
ACE_INLINE int
ACE_Token::acquire_read (void (*sleep_hook_func)(void *),
void *arg,
@@ -74,6 +90,7 @@ ACE_Token::acquire_read (void (*sleep_hook_func)(void *),
ACE_TRACE ("ACE_Token::acquire_read");
return this->shared_acquire (sleep_hook_func, arg, timeout, ACE_Token::READ_TOKEN);
}
+
ACE_INLINE int
ACE_Token::tryacquire_write (void)
{
@@ -81,12 +98,14 @@ ACE_Token::tryacquire_write (void)
return this->shared_acquire
(0, 0, (ACE_Time_Value *) &ACE_Time_Value::zero, ACE_Token::WRITE_TOKEN);
}
+
ACE_INLINE int
ACE_Token::tryacquire_write_upgrade (void)
{
ACE_TRACE ("ACE_Token::tryacquire_write_upgrade");
return 0;
}
+
ACE_INLINE int
ACE_Token::acquire_write (void (*sleep_hook_func)(void *),
void *arg,
@@ -95,6 +114,7 @@ ACE_Token::acquire_write (void (*sleep_hook_func)(void *),
ACE_TRACE ("ACE_Token::acquire_write");
return this->shared_acquire (sleep_hook_func, arg, timeout, ACE_Token::WRITE_TOKEN);
}
+
ACE_INLINE int
ACE_Token::ACE_Token_Queue_Entry::wait (ACE_Time_Value *timeout, ACE_Thread_Mutex &lock)
{
@@ -110,6 +130,7 @@ ACE_Token::ACE_Token_Queue_Entry::wait (ACE_Time_Value *timeout, ACE_Thread_Mute
return this->cv_.wait (timeout);
#endif /* ACE_TOKEN_USES_SEMAPHORE */
}
+
ACE_INLINE int
ACE_Token::ACE_Token_Queue_Entry::signal (void)
{
@@ -120,27 +141,36 @@ ACE_Token::ACE_Token_Queue_Entry::signal (void)
this->cv_.signal ();
#endif /* ACE_TOKEN_USES_SEMAPHORE */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_THREADS */
+
/*****************************************************************************/
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE int
ACE_Noop_Token::queueing_strategy (void)
{
return -1;
}
+
ACE_INLINE void
ACE_Noop_Token::queueing_strategy (int /* queueing_strategy */)
{
}
+
ACE_INLINE int
ACE_Noop_Token::renew (int, ACE_Time_Value *)
{
return 0;
}
+
ACE_INLINE void
ACE_Noop_Token::dump (void) const
{
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Token_Collection.cpp b/dep/ACE_wrappers/ace/Token_Collection.cpp
index 7e14d4742a3..e9c4964f19e 100644
--- a/dep/ACE_wrappers/ace/Token_Collection.cpp
+++ b/dep/ACE_wrappers/ace/Token_Collection.cpp
@@ -1,39 +1,52 @@
#include "ace/Token_Collection.h"
+
#if defined (ACE_HAS_TOKENS_LIBRARY)
+
#if !defined (__ACE_INLINE__)
#include "ace/Token_Collection.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID (ace,
Token_Collection,
"$Id: Token_Collection.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_Token_Collection::ACE_Token_Collection (bool debug,
const ACE_TCHAR *name)
: debug_ (debug)
{
ACE_TRACE ("ACE_Token_Collection::ACE_Token_Collection");
+
if (name == 0)
name = ACE_TEXT ("no name");
+
ACE_OS::strsncpy (this->name_,
const_cast<ACE_TCHAR *> (name),
ACE_MAXTOKENNAMELEN);
}
+
int
ACE_Token_Collection::insert (ACE_Token_Proxy &new_token)
{
ACE_TRACE ("ACE_Token_Collection::insert");
+
TOKEN_NAME name (new_token.name ());
+
// Check if the new_proxy is already in the list.
if (collection_.find (name) == 1)
// One already exists, so fail.
return -1;
+
// Clone the new token.
ACE_Token_Proxy *temp = new_token.clone ();
+
if (collection_.bind (name, temp) == -1)
ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("bind failed\n")), -1);
return 0;
}
+
int
ACE_Token_Collection::extract (const ACE_TCHAR *token_name, ACE_Token_Proxy *&proxy)
{
@@ -41,6 +54,7 @@ ACE_Token_Collection::extract (const ACE_TCHAR *token_name, ACE_Token_Proxy *&pr
TOKEN_NAME name (token_name);
return collection_.unbind (token_name, proxy);
}
+
ACE_Token_Proxy *
ACE_Token_Collection::is_member (const ACE_TCHAR *token_name)
{
@@ -50,6 +64,7 @@ ACE_Token_Collection::is_member (const ACE_TCHAR *token_name)
// Get the token from the collection.
return collection_.find (name, temp) == -1 ? 0 : temp;
}
+
int
ACE_Token_Collection::is_member (const ACE_Token_Proxy &token)
{
@@ -57,13 +72,16 @@ ACE_Token_Collection::is_member (const ACE_Token_Proxy &token)
TOKEN_NAME token_name (token.name ());
return collection_.find (token_name) == 0;
}
+
int
ACE_Token_Collection::acquire (int notify,
void (*sleep_hook)(void *),
ACE_Synch_Options &options)
{
ACE_TRACE ("ACE_Token_Collection::acquire");
+
COLLECTION::ITERATOR iterator (collection_);
+
for (COLLECTION::ENTRY *temp = 0;
iterator.next (temp) != 0;
iterator.advance ())
@@ -82,8 +100,10 @@ ACE_Token_Collection::acquire (int notify,
ACE_RETURN (-1);
}
}
+
return 0;
}
+
int
ACE_Token_Collection::acquire (const ACE_TCHAR *token_name,
int notify,
@@ -102,6 +122,7 @@ ACE_Token_Collection::acquire (const ACE_TCHAR *token_name,
return temp->acquire (notify, sleep_hook, options);
}
+
int
ACE_Token_Collection::tryacquire (const ACE_TCHAR *token_name,
void (*sleep_hook)(void *))
@@ -114,14 +135,18 @@ ACE_Token_Collection::tryacquire (const ACE_TCHAR *token_name,
// did we find it?
if (result == -1)
return result;
+
// perform the operation
return temp->tryacquire (sleep_hook);
}
+
int
ACE_Token_Collection::tryacquire (void (*sleep_hook)(void *))
{
ACE_TRACE ("ACE_Token_Collection::tryacquire");
+
COLLECTION::ITERATOR iterator (collection_);
+
for (COLLECTION::ENTRY *temp = 0;
iterator.next (temp) != 0;
iterator.advance ())
@@ -133,14 +158,18 @@ ACE_Token_Collection::tryacquire (void (*sleep_hook)(void *))
if (temp->int_id_->tryacquire (sleep_hook) == -1)
return -1;
}
+
return 0;
}
+
int
ACE_Token_Collection::renew (int requeue_position,
ACE_Synch_Options &options)
{
ACE_TRACE ("ACE_Token_Collection::renew");
+
COLLECTION::ITERATOR iterator (collection_);
+
for (COLLECTION::ENTRY *temp = 0;
iterator.next (temp) != 0;
iterator.advance ())
@@ -151,8 +180,10 @@ ACE_Token_Collection::renew (int requeue_position,
if (temp->int_id_->renew (requeue_position, options) == -1)
return -1;
}
+
return 0;
}
+
int
ACE_Token_Collection::renew (const ACE_TCHAR *token_name,
int requeue_position,
@@ -161,8 +192,10 @@ ACE_Token_Collection::renew (const ACE_TCHAR *token_name,
ACE_TRACE ("ACE_Token_Collection::renew");
TOKEN_NAME name (token_name);
ACE_Token_Proxy *temp;
+
// Get the token from the collection.
int result = collection_.find (name, temp);
+
// Did we find it?
if (result == -1)
ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT ("%p %s\n"),
@@ -171,11 +204,14 @@ ACE_Token_Collection::renew (const ACE_TCHAR *token_name,
// perform the operation
return temp->renew (requeue_position, options);
}
+
int
ACE_Token_Collection::release (ACE_Synch_Options &)
+
{
ACE_TRACE ("ACE_Token_Collection::release");
COLLECTION::ITERATOR iterator (collection_);
+
for (COLLECTION::ENTRY *temp = 0;
iterator.next (temp) != 0;
iterator.advance ())
@@ -185,8 +221,10 @@ ACE_Token_Collection::release (ACE_Synch_Options &)
temp->int_id_->name ()));
temp->int_id_->release ();
}
+
return 0;
}
+
int
ACE_Token_Collection::release (const ACE_TCHAR *token_name,
ACE_Synch_Options &options)
@@ -202,10 +240,12 @@ ACE_Token_Collection::release (const ACE_TCHAR *token_name,
// perform the operation
return temp->release (options);
}
+
ACE_Token_Collection::~ACE_Token_Collection (void)
{
ACE_TRACE ("ACE_Token_Collection::~ACE_Token_Collection");
COLLECTION::ITERATOR iterator (collection_);
+
for (COLLECTION::ENTRY *temp = 0;
iterator.next (temp) != 0;
iterator.advance ())
@@ -216,6 +256,7 @@ ACE_Token_Collection::~ACE_Token_Collection (void)
}
}
+
// This method doesn't mean anything for a collection.
ACE_Token_Proxy *
ACE_Token_Collection::clone (void) const
@@ -223,6 +264,7 @@ ACE_Token_Collection::clone (void) const
ACE_TRACE ("ACE_Token_Collection::clone");
return (ACE_Token_Proxy *) 0;
}
+
// This method doesn't mean anything for a collection.
ACE_Tokens *
ACE_Token_Collection::create_token (const ACE_TCHAR *)
@@ -230,6 +272,7 @@ ACE_Token_Collection::create_token (const ACE_TCHAR *)
ACE_TRACE ("ACE_Token_Collection::create_token");
return (ACE_Tokens *) 0;
}
+
void
ACE_Token_Collection::dump (void) const
{
@@ -245,6 +288,8 @@ ACE_Token_Collection::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_TOKENS_LIBRARY */
diff --git a/dep/ACE_wrappers/ace/Token_Collection.h b/dep/ACE_wrappers/ace/Token_Collection.h
index cd8fcc7c8bf..6dad64ac6f0 100644
--- a/dep/ACE_wrappers/ace/Token_Collection.h
+++ b/dep/ACE_wrappers/ace/Token_Collection.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Token_Collection.h
@@ -18,17 +19,24 @@
* @author Tim Harrison (harrison@cs.wustl.edu)
*/
//=============================================================================
+
#ifndef ACE_TOKEN_COLLECTION_H
#define ACE_TOKEN_COLLECTION_H
#include /**/ "ace/pre.h"
+
#include "ace/Map_Manager.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_TOKENS_LIBRARY)
+
#include "ace/Local_Tokens.h"
#include "ace/Null_Mutex.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Token_Collection
*
@@ -60,7 +68,9 @@ public:
*/
ACE_Token_Collection (bool debug = false,
const ACE_TCHAR *name = 0);
+
// Collection Management operations
+
/**
* Insert a Token into the collection. All ACE_Token type
* operations performed on the collection will also be performed on
@@ -74,6 +84,7 @@ public:
* changed explicity on each proxy using is_member.
*/
int insert (ACE_Token_Proxy &token);
+
/**
* Removes the ACE_Token matching the given token_name from the
* collection. On success, extract returns 0. On failure
@@ -82,15 +93,19 @@ public:
* The returned ACE_Token_Proxy* must be deleted by the user.
*/
int extract (const ACE_TCHAR *token_name, ACE_Token_Proxy *&proxy);
+
/// Returns the proxy if true. 0 otherwise.
ACE_Token_Proxy *is_member (const ACE_TCHAR *token_name);
+
/**
* Is the specified token in the collection?
* 1, yes.
* 0, no.
*/
int is_member (const ACE_Token_Proxy &token);
+
// = Collective operation semantics.
+
// For acquire, renew, and release, there are two interfaces. Once
// interface allows an operation on a single token in the
// collection. The collective interfaces perform atomic operations
@@ -101,6 +116,7 @@ public:
// the Collection steps through the tokens in the order they were
// inserted. For each one it performs the operation (acquire,
// renew, or release).
+
/**
* Acquire "atomically" all resources in the collection. This is
* only successfull if all tokens in the collection could be
@@ -119,6 +135,7 @@ public:
void (*sleep_hook)(void *) = 0,
ACE_Synch_Options &options =
ACE_Synch_Options::defaults);
+
/// Acquire the token corresponding to @a token_name. The other
/// parameters are passed to <token>::acquire.
virtual int acquire (const ACE_TCHAR *token_name,
@@ -126,11 +143,14 @@ public:
void (*sleep_hook)(void *) = 0,
ACE_Synch_Options &options =
ACE_Synch_Options::defaults);
+
/// Try to acquire all tokens in collection.
virtual int tryacquire (void (*sleep_hook)(void *) = 0);
+
/// Try to acquire @a token_name.
virtual int tryacquire (const ACE_TCHAR *token_name,
void (*sleep_hook)(void *) = 0);
+
/**
* Renews "atomically" all resources in the collection. This is
* only successfull if all tokens in the collection could be
@@ -142,12 +162,14 @@ public:
ACE_Synch_Options &options =
ACE_Synch_Options::defaults);
+
/// Renew the token corresponding to @a token_name. The other
/// parameters are passed to <token>::renew.
virtual int renew (const ACE_TCHAR *token_name,
int requeue_position = 0,
ACE_Synch_Options &options =
ACE_Synch_Options::defaults);
+
/**
* Releases "atomically" all resources in the collection. This is
* only successfull if all tokens in the collection could be
@@ -158,48 +180,65 @@ public:
virtual int release (ACE_Synch_Options &options =
ACE_Synch_Options::defaults);
+
/// Release the token corresponding to <token_name>. The other
/// parameters are passed to <token>::release.
virtual int release (const ACE_TCHAR *token_name,
ACE_Synch_Options &options =
ACE_Synch_Options::defaults);
+
~ACE_Token_Collection (void);
+
/// Dump the state of the class.
void dump (void) const;
+
/// Return the name of the collection. Not very functionally
/// important, but sometimes a useful debugging tool.
virtual const ACE_TCHAR *name (void) const;
+
protected:
+
typedef ACE_Token_Name TOKEN_NAME;
+
/// COLLECTION maintains a mapping from token names to ACE_Tokens*
typedef ACE_Map_Manager<TOKEN_NAME, ACE_Token_Proxy *, ACE_Null_Mutex>
COLLECTION;
+
/// Allows iterations through collection_
/**
* @deprecated Deprecated typedef. Use COLLECTION::ITERATOR trait instead.
*/
typedef COLLECTION::ITERATOR COLLECTION_ITERATOR;
+
/// Allows iterations through collection_
/**
* @deprecated Deprecated typedef. Use COLLECTION::ENTRY trait instead.
*/
typedef COLLECTION::ENTRY COLLECTION_ENTRY;
+
/// COLLECTION maintains a mapping from token names to ACE_Tokens*.
COLLECTION collection_;
+
/// Whether to print out debug messages or not.
bool debug_;
+
/// Name of the collection.
ACE_TCHAR name_[ACE_MAXTOKENNAMELEN];
+
// = I'm not sure what these mean, but they have to be defined since they're
// pure virtual in ACE_Token_Proxy.
virtual ACE_Token_Proxy *clone (void) const;
virtual ACE_Tokens *create_token (const ACE_TCHAR *name);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Token_Collection.inl"
#endif /* __ACE_INLINE__ */
+
#endif /* ACE_HAS_TOKENS_LIBRARY */
+
#include /**/ "ace/post.h"
#endif /* ACE_TOKEN_COLLECTION_H */
diff --git a/dep/ACE_wrappers/ace/Token_Collection.inl b/dep/ACE_wrappers/ace/Token_Collection.inl
index ff22563089b..73f1e95d76e 100644
--- a/dep/ACE_wrappers/ace/Token_Collection.inl
+++ b/dep/ACE_wrappers/ace/Token_Collection.inl
@@ -1,12 +1,17 @@
// -*- C++ -*-
//
// $Id: Token_Collection.inl 80826 2008-03-04 14:51:23Z wotte $
+
#if defined (ACE_HAS_TOKENS_LIBRARY)
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE const ACE_TCHAR *
ACE_Token_Collection::name (void) const
{
return name_;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_TOKENS_LIBRARY */
diff --git a/dep/ACE_wrappers/ace/Token_Invariants.cpp b/dep/ACE_wrappers/ace/Token_Invariants.cpp
index 2819813cae0..e0ca87bdcc4 100644
--- a/dep/ACE_wrappers/ace/Token_Invariants.cpp
+++ b/dep/ACE_wrappers/ace/Token_Invariants.cpp
@@ -1,15 +1,22 @@
#include "ace/Token_Invariants.h"
+
#if defined (ACE_HAS_TOKENS_LIBRARY)
+
#include "ace/Object_Manager.h"
+
ACE_RCSID (ace,
Token_Invariants,
"$Id: Token_Invariants.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_Token_Invariant_Manager *ACE_Token_Invariant_Manager::instance_ = 0;
+
ACE_Token_Invariant_Manager *
ACE_Token_Invariant_Manager::instance (void)
{
ACE_TRACE ("ACE_Token_Invariant_Manager::instance");
+
// Perform the Double-Check pattern...
if (instance_ == 0)
{
@@ -17,6 +24,7 @@ ACE_Token_Invariant_Manager::instance (void)
ACE_Managed_Object<ACE_TOKEN_CONST::MUTEX>::get_preallocated_object
(ACE_Object_Manager::ACE_TOKEN_INVARIANTS_CREATION_LOCK);
ACE_GUARD_RETURN (ACE_TOKEN_CONST::MUTEX, ace_mon, *lock, 0));
+
if (instance_ == 0)
{
ACE_NEW_RETURN (instance_,
@@ -26,26 +34,34 @@ ACE_Token_Invariant_Manager::instance (void)
ACE_Object_Manager::at_exit (instance_);
}
}
+
return instance_;
}
+
ACE_Token_Invariant_Manager::ACE_Token_Invariant_Manager (void)
{
ACE_TRACE ("ACE_Token_Invariant_Manager::ACE_Token_Invariant_Manager");
}
+
int
ACE_Token_Invariant_Manager::mutex_acquired (const ACE_TCHAR *token_name)
{
ACE_TRACE ("ACE_Token_Invariant_Manager::mutex_acquired");
+
ACE_GUARD_RETURN (ACE_TOKEN_CONST::MUTEX, ace_mon, this->lock_, -1);
+
ACE_Mutex_Invariants *inv = 0;
if (this->get_mutex (token_name, inv) == -1)
return -1;
+
return inv->acquired ();
}
+
int
ACE_Token_Invariant_Manager::acquired (const ACE_Token_Proxy *proxy)
{
ACE_TRACE ("ACE_Token_Invariant_Manager::acquired");
+
// Reach into the proxy to find the token type.
if (proxy->token_->type () == ACE_Tokens::MUTEX)
return this->mutex_acquired (proxy->name ());
@@ -57,54 +73,69 @@ 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)
{
ACE_TRACE ("ACE_Token_Invariant_Manager::releasing");
+
// Reach into the proxy to find the token type.
if (proxy->token_->type () == ACE_Tokens::MUTEX)
this->mutex_releasing (proxy->name ());
else // ACE_Tokens::RWLOCK.
this->rwlock_releasing (proxy->name ());
}
+
void
ACE_Token_Invariant_Manager::mutex_releasing (const ACE_TCHAR *token_name)
{
ACE_TRACE ("ACE_Token_Invariant_Manager::mutex_releasing");
ACE_GUARD (ACE_TOKEN_CONST::MUTEX, ace_mon, this->lock_);
+
ACE_Mutex_Invariants *inv = 0;
if (this->get_mutex (token_name, inv) == 0)
inv->releasing ();
}
+
int
ACE_Token_Invariant_Manager::reader_acquired (const ACE_TCHAR *token_name)
{
ACE_TRACE ("ACE_Token_Invariant_Manager::reader_acquired");
ACE_GUARD_RETURN (ACE_TOKEN_CONST::MUTEX, ace_mon, this->lock_, -1);
+
ACE_RWLock_Invariants *inv = 0;
if (this->get_rwlock (token_name, inv) == -1)
return -1;
+
return inv->reader_acquired ();
}
+
int
ACE_Token_Invariant_Manager::writer_acquired (const ACE_TCHAR *token_name)
{
ACE_TRACE ("ACE_Token_Invariant_Manager::writer_acquired");
+
ACE_GUARD_RETURN (ACE_TOKEN_CONST::MUTEX, ace_mon, this->lock_, -1);
+
ACE_RWLock_Invariants *inv = 0;
if (this->get_rwlock (token_name, inv) == -1)
return -1;
+
return inv->writer_acquired ();
}
+
void
ACE_Token_Invariant_Manager::rwlock_releasing (const ACE_TCHAR *token_name)
{
ACE_TRACE ("ACE_Token_Invariant_Manager::rwlock_releasing");
+
ACE_GUARD (ACE_TOKEN_CONST::MUTEX, ace_mon, this->lock_);
+
ACE_RWLock_Invariants *inv = 0;
if (this->get_rwlock (token_name, inv) == 0)
inv->releasing ();
}
+
void
ACE_Token_Invariant_Manager::dump (void) const
{
@@ -119,6 +150,7 @@ ACE_Token_Invariant_Manager::dump (void) const
#endif /* ACE_HAS_DUMP */
}
+
int
ACE_Token_Invariant_Manager::get_mutex (const ACE_TCHAR *token_name,
ACE_Mutex_Invariants *&inv)
@@ -129,6 +161,7 @@ ACE_Token_Invariant_Manager::get_mutex (const ACE_TCHAR *token_name,
// We did not find one in the collection.
{
ACE_Mutex_Invariants *new_invariant;
+
ACE_NEW_RETURN (new_invariant,
ACE_Mutex_Invariants,
-1);
@@ -137,12 +170,15 @@ ACE_Token_Invariant_Manager::get_mutex (const ACE_TCHAR *token_name,
delete new_invariant;
return -1;
}
+
if (mutex_collection_.find (name, inv) == -1)
// We did not find one in the collection.
return -1;
}
+
return 0;
}
+
int
ACE_Token_Invariant_Manager::get_rwlock (const ACE_TCHAR *token_name,
ACE_RWLock_Invariants *&inv)
@@ -153,39 +189,50 @@ ACE_Token_Invariant_Manager::get_rwlock (const ACE_TCHAR *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)
return -1;
+
if (rwlock_collection_.find (name, inv) == -1)
// We did not find one in the collection.
return -1;
}
+
return 0;
}
+
ACE_Token_Invariant_Manager::~ACE_Token_Invariant_Manager (void)
{
ACE_TRACE ("ACE_Token_Invariant_Manager::~ACE_Token_Invariant_Manager");
+
MUTEX_COLLECTION::ITERATOR iterator (mutex_collection_);
+
for (MUTEX_COLLECTION::ENTRY *temp = 0;
iterator.next (temp) != 0;
iterator.advance ())
delete temp->int_id_;
+
RWLOCK_COLLECTION::ITERATOR iterator2 (rwlock_collection_);
+
for (RWLOCK_COLLECTION::ENTRY *temp2 = 0;
iterator2.next (temp2) != 0;
iterator2.advance ())
delete temp2->int_id_;
}
+
// **************************************************
// **************************************************
// **************************************************
+
ACE_Mutex_Invariants::ACE_Mutex_Invariants (void)
: owners_ (0)
{
}
+
int
ACE_Mutex_Invariants::acquired (void)
{
@@ -197,21 +244,25 @@ ACE_Mutex_Invariants::acquired (void)
else
return 1;
}
+
void
ACE_Mutex_Invariants::releasing (void)
{
if (owners_ == 1)
--owners_;
}
+
ACE_Mutex_Invariants::ACE_Mutex_Invariants (const ACE_Mutex_Invariants &rhs)
: owners_ (rhs.owners_)
{
}
+
void
ACE_Mutex_Invariants::operator= (const ACE_Mutex_Invariants &rhs)
{
owners_ = rhs.owners_;
}
+
void
ACE_Mutex_Invariants::dump (void) const
{
@@ -222,14 +273,17 @@ ACE_Mutex_Invariants::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
// **************************************************
// **************************************************
// **************************************************
+
ACE_RWLock_Invariants::ACE_RWLock_Invariants (void)
: writers_ (0),
readers_ (0)
{
}
+
int
ACE_RWLock_Invariants::writer_acquired (void)
{
@@ -246,6 +300,7 @@ ACE_RWLock_Invariants::writer_acquired (void)
else
return 1;
}
+
int
ACE_RWLock_Invariants::reader_acquired (void)
{
@@ -260,6 +315,7 @@ ACE_RWLock_Invariants::reader_acquired (void)
return 1;
}
}
+
void
ACE_RWLock_Invariants::releasing (void)
{
@@ -268,17 +324,20 @@ ACE_RWLock_Invariants::releasing (void)
else if (readers_ > 0)
--readers_;
}
+
ACE_RWLock_Invariants::ACE_RWLock_Invariants (const ACE_RWLock_Invariants &rhs)
: writers_ (rhs.writers_),
readers_ (rhs.readers_)
{
}
+
void
ACE_RWLock_Invariants::operator= (const ACE_RWLock_Invariants &rhs)
{
writers_ = rhs.writers_;
readers_ = rhs.readers_;
}
+
void
ACE_RWLock_Invariants::dump (void) const
{
@@ -290,6 +349,8 @@ ACE_RWLock_Invariants::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_TOKENS_LIBRARY */
diff --git a/dep/ACE_wrappers/ace/Token_Invariants.h b/dep/ACE_wrappers/ace/Token_Invariants.h
index b0e7d43032a..1649e5937b3 100644
--- a/dep/ACE_wrappers/ace/Token_Invariants.h
+++ b/dep/ACE_wrappers/ace/Token_Invariants.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Token_Invariants.h
@@ -14,18 +15,25 @@
*
*/
//=============================================================================
+
#ifndef ACE_TOKEN_INVARIANTS_H
#define ACE_TOKEN_INVARIANTS_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_TOKENS_LIBRARY)
+
#include "ace/Map_Manager.h"
#include "ace/Local_Tokens.h"
#include "ace/Null_Mutex.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Mutex_Invariants
*
@@ -38,22 +46,30 @@ class ACE_Export ACE_Mutex_Invariants
public:
/// Default construction.
ACE_Mutex_Invariants (void);
+
/// Returns 1 on success, 0 when an invariant has been violated and
/// -1 on error.
int acquired (void);
+
/// Updates internal database.
void releasing (void);
+
// = Map_Manager operations.
+
/// Copy construction.
ACE_Mutex_Invariants (const ACE_Mutex_Invariants &rhs);
+
/// Copy.
void operator= (const ACE_Mutex_Invariants &rhs);
+
/// Dump the state of the class.
void dump (void) const;
+
private:
/// Number of owners. This had better be 0 >= owners_ <= 1;
int owners_;
};
+
/**
* @class ACE_RWLock_Invariants
*
@@ -68,27 +84,37 @@ class ACE_Export ACE_RWLock_Invariants
public:
/// Default construction.
ACE_RWLock_Invariants (void);
+
/// Returns 1 on success, 0 when an invariant has been violated and
/// -1 on error.
int writer_acquired (void);
+
/// Returns 1 on success, 0 when an invariant has been violated and
/// -1 on error.
int reader_acquired (void);
+
/// Updates internal database.
void releasing (void);
+
// = Map_Manager operations.
+
/// Copy construction.
ACE_RWLock_Invariants (const ACE_RWLock_Invariants &rhs);
+
/// Copy.
void operator= (const ACE_RWLock_Invariants &rhs);
+
/// Dump the state of the class.
void dump (void) const;
+
private:
/// Number of owning writers.
int writers_;
+
/// Number of owning readers.
int readers_;
};
+
/**
* @class ACE_Token_Invariant_Manager
*
@@ -104,88 +130,117 @@ private:
class ACE_Export ACE_Token_Invariant_Manager : public ACE_Cleanup
{
public:
+
/// Singleton access point.
static ACE_Token_Invariant_Manager *instance (void);
+
// = Polymorphic methods. Just pass in the proxy and the method
// figures out the type of the token.
+
/// Returns 1 on success, 0 when an invariant has been violated and
/// -1 on error.
int acquired (const ACE_Token_Proxy *proxy);
+
/// Updates internal database.
void releasing (const ACE_Token_Proxy *proxy);
+
// = Explicit methods. These to not require actual proxies in order
// to test a scenario.
+
/// Returns 1 on success, 0 when an invariant has been violated and
/// -1 on error.
int mutex_acquired (const ACE_TCHAR *token_name);
+
/// Updates internal database.
void mutex_releasing (const ACE_TCHAR *token_name);
+
/// Returns 1 on success, 0 when an invariant has been violated and
/// -1 on error.
int reader_acquired (const ACE_TCHAR *token_name);
+
/// Returns 1 on success, 0 when an invariant has been violated and
/// -1 on error.
int writer_acquired (const ACE_TCHAR *token_name);
+
/// Updates internal database.
void rwlock_releasing (const ACE_TCHAR *token_name);
+
/// Dump the state of the class.
void dump (void) const;
+
// = The following two method should be in the protected part of the
// class. Bugs with certain compilers preclude this.
/// Prevent non-singleton construction.
ACE_Token_Invariant_Manager (void);
+
/// Destruction.
virtual ~ACE_Token_Invariant_Manager (void);
+
protected:
/// Return or create.
int get_mutex (const ACE_TCHAR *token_name,
ACE_Mutex_Invariants *&inv);
+
/// Return or create.
int get_rwlock (const ACE_TCHAR *token_name,
ACE_RWLock_Invariants *&inv);
+
/// ACE_Mutex_Token used to lock internal data structures.
ACE_TOKEN_CONST::MUTEX lock_;
+
/// This may be changed to a template type.
typedef ACE_Token_Name TOKEN_NAME;
+
/// COLLECTION maintains a mapping from token names to mutexes.
typedef ACE_Map_Manager<TOKEN_NAME, ACE_Mutex_Invariants *, ACE_Null_Mutex>
MUTEX_COLLECTION;
+
/// Allows iterations through collection.
/**
* @deprecated Deprecated typedef. Use MUTEX_COLLECTION::ITERATOR trait
* instead.
*/
typedef MUTEX_COLLECTION::ITERATOR MUTEX_COLLECTION_ITERATOR;
+
/// Allows iterations through collection.
/**
* @deprecated Deprecated typedef. Use MUTEX_COLLECTION::ENTRY trait
* instead.
*/
typedef MUTEX_COLLECTION::ENTRY MUTEX_COLLECTION_ENTRY;
+
/// MUTEX_COLLECTION maintains a mapping from token names to mutexes.
MUTEX_COLLECTION mutex_collection_;
+
/// COLLECTION maintains a mapping from token names to mutexes.
typedef ACE_Map_Manager<TOKEN_NAME, ACE_RWLock_Invariants *, ACE_Null_Mutex>
RWLOCK_COLLECTION;
+
/// Allows iterations through collection.
/**
* @deprecated Deprecated typedef. Use RWLOCK_COLLECTION::ITERATOR trait
* instead.
*/
typedef RWLOCK_COLLECTION::ITERATOR RWLOCK_COLLECTION_ITERATOR;
+
/// Allows iterations through collection.
/**
* @deprecated Deprecated typedef. Use RWLOCK_COLLECTION::ENTRY trait
* instead.
*/
typedef RWLOCK_COLLECTION::ENTRY RWLOCK_COLLECTION_ENTRY;
+
/// MUTEX_COLLECTION maintains a mapping from token names to mutexes.
RWLOCK_COLLECTION rwlock_collection_;
+
/// Singleton pointer.
static ACE_Token_Invariant_Manager *instance_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_TOKENS_LIBRARY */
+
#include /**/ "ace/post.h"
#endif /* ACE_TOKEN_INVARIANTS_H */
diff --git a/dep/ACE_wrappers/ace/Token_Manager.cpp b/dep/ACE_wrappers/ace/Token_Manager.cpp
index bef609164e3..178a0e5c63b 100644
--- a/dep/ACE_wrappers/ace/Token_Manager.cpp
+++ b/dep/ACE_wrappers/ace/Token_Manager.cpp
@@ -1,23 +1,33 @@
#include "ace/Token_Manager.h"
+
#if defined (ACE_HAS_TOKENS_LIBRARY)
+
#include "ace/Object_Manager.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/Token_Manager.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID (ace,
Token_Manager,
"$Id: Token_Manager.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// singleton token manager
ACE_Token_Manager *ACE_Token_Manager::token_manager_ = 0;
+
ACE_Token_Manager::ACE_Token_Manager ()
{
ACE_TRACE ("ACE_Token_Manager::ACE_Token_Manager");
}
+
ACE_Token_Manager::~ACE_Token_Manager ()
{
ACE_TRACE ("ACE_Token_Manager::~ACE_Token_Manager");
+
COLLECTION::ITERATOR iterator (collection_);
+
for (COLLECTION::ENTRY *temp = 0;
iterator.next (temp) != 0;
iterator.advance ())
@@ -28,10 +38,12 @@ ACE_Token_Manager::~ACE_Token_Manager ()
// COLLECTION::ENTRYs goes away.
}
}
+
ACE_Token_Manager *
ACE_Token_Manager::instance (void)
{
ACE_TRACE ("ACE_Token_Manager::instance");
+
// This first check is to avoid acquiring the mutex in the common
// case. Double-Check pattern rules.
if (token_manager_ == 0)
@@ -42,6 +54,7 @@ ACE_Token_Manager::instance (void)
(ACE_Object_Manager::ACE_TOKEN_MANAGER_CREATION_LOCK);
ACE_GUARD_RETURN (ACE_TOKEN_CONST::MUTEX, ace_mon, *lock, 0);
#endif /* ACE_MT_SAFE */
+
if (token_manager_ == 0)
{
ACE_NEW_RETURN (token_manager_,
@@ -51,8 +64,10 @@ ACE_Token_Manager::instance (void)
ACE_Object_Manager::at_exit (token_manager_);
}
}
+
return token_manager_;
}
+
void
ACE_Token_Manager::get_token (ACE_Token_Proxy *proxy,
const ACE_TCHAR *token_name)
@@ -61,13 +76,17 @@ ACE_Token_Manager::get_token (ACE_Token_Proxy *proxy,
// 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.
{
// Make one.
proxy->token_ = proxy->create_token (token_name);
+
// Put it in the collection.
if (collection_.bind (name, proxy->token_) == -1)
{
@@ -75,11 +94,14 @@ ACE_Token_Manager::get_token (ACE_Token_Proxy *proxy,
proxy->token_ = 0;
}
}
+
if (proxy->token_ != 0)
proxy->token_->inc_reference ();
+
// We may be returning proxy->token_ == 0 if new failed, caller must
// check.
}
+
// 0. check_deadlock (TOKEN)
// 1. if TOKEN->visited (), return 0.
// 2. mark TOKEN visited.
@@ -89,12 +111,15 @@ ACE_Token_Manager::get_token (ACE_Token_Proxy *proxy,
// 6. if OWNER is not waiting for a NEW_TOKEN, continue.
// 7. else, if check_deadlock (NEW_TOKEN) == 1, return *DEADLOCK*
// 8. return 0.
+
int
ACE_Token_Manager::check_deadlock (ACE_Token_Proxy *proxy)
{
ACE_TRACE ("ACE_Token_Manager::check_deadlock");
+
// Start the recursive deadlock detection algorithm.
int result = this->check_deadlock (proxy->token_, proxy);
+
// Whether or not we detect deadlock, we have to unmark all tokens
// for the next time.
COLLECTION::ITERATOR iterator (collection_);
@@ -102,17 +127,24 @@ ACE_Token_Manager::check_deadlock (ACE_Token_Proxy *proxy)
iterator.next (temp) != 0;
iterator.advance ())
temp->int_id_->visit (0);
+
return result;
}
+
int
ACE_Token_Manager::check_deadlock (ACE_Tokens *token, ACE_Token_Proxy *proxy)
{
ACE_TRACE ("ACE_Token_Manager::check_deadlock");
+
if (token->visited ())
return 0;
+
token->visit (1);
+
ACE_Tokens::OWNER_STACK owners;
+
int is_owner = token->owners (owners, proxy->client_id ());
+
switch (is_owner)
{
case -1:
@@ -128,6 +160,7 @@ ACE_Token_Manager::check_deadlock (ACE_Tokens *token, ACE_Token_Proxy *proxy)
token->name (),
proxy->token_->name ()));
}
+
return 1;
case 0:
default:
@@ -153,11 +186,13 @@ ACE_Token_Manager::check_deadlock (ACE_Tokens *token, ACE_Token_Proxy *proxy)
}
// else, check the next owner.
}
+
// We've checked all the owners and found no deadlock.
return 0;
}
}
+
ACE_Tokens *
ACE_Token_Manager::token_waiting_for (const ACE_TCHAR *client_id)
{
@@ -169,9 +204,11 @@ ACE_Token_Manager::token_waiting_for (const ACE_TCHAR *client_id)
if (temp->int_id_->is_waiting_for (client_id))
return temp->int_id_;
}
+
// nothing was found, return NULL.
return 0;
}
+
// Notify the token manager that a token is has been released. If
// as a result, there is no owner of the token, the token is
// deleted.
@@ -180,13 +217,17 @@ ACE_Token_Manager::release_token (ACE_Tokens *&token)
{
ACE_TRACE ("ACE_Token_Manager::release_token");
// again, let's perform our own locking here.
+
ACE_GUARD (ACE_TOKEN_CONST::MUTEX, ace_mon, this->lock_);
+
if (token->dec_reference () == 0)
{
// No one has the token, so we can delete it and remove it from
// our collection. First, let's get it from the collection.
TOKEN_NAME token_name (token->name ());
+
ACE_Tokens *temp;
+
if (collection_.unbind (token_name, temp) == -1)
// we did not find one in the collection
{
@@ -211,6 +252,7 @@ ACE_Token_Manager::release_token (ACE_Tokens *&token)
// else
// someone is still interested in the token, so keep it around.
}
+
void
ACE_Token_Manager::dump (void) const
{
@@ -225,6 +267,8 @@ ACE_Token_Manager::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_TOKENS_LIBRARY */
diff --git a/dep/ACE_wrappers/ace/Token_Manager.h b/dep/ACE_wrappers/ace/Token_Manager.h
index 8a0211c503a..6a7c17d4167 100644
--- a/dep/ACE_wrappers/ace/Token_Manager.h
+++ b/dep/ACE_wrappers/ace/Token_Manager.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Token_Manager.h
@@ -8,20 +9,29 @@
* @author Tim Harrison (harrison@cs.wustl.edu)
*/
//=============================================================================
+
#ifndef ACE_TOKEN_MANAGER_H
#define ACE_TOKEN_MANAGER_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Local_Tokens.h"
+
#if defined (ACE_HAS_TOKENS_LIBRARY)
+
#include "ace/Null_Mutex.h"
#include "ace/Map_Manager.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Local_Mutex;
class ACE_Mutex_Token;
+
/**
* @class ACE_Token_Manager
*
@@ -35,6 +45,7 @@ class ACE_Mutex_Token;
*/
class ACE_Export ACE_Token_Manager : public ACE_Cleanup
{
+
// To add a new type of token (e.g. semaphore), do the following
// steps: 1. Create a new derivation of ACE_Token. This class
// defines the semantics of the new Token. 2. Create a
@@ -43,10 +54,13 @@ class ACE_Export ACE_Token_Manager : public ACE_Cleanup
public:
ACE_Token_Manager (void);
virtual ~ACE_Token_Manager (void);
+
/// Get the pointer to token manager singleton.
static ACE_Token_Manager *instance (void);
+
/// Set the pointer to token manager singleton.
void instance (ACE_Token_Manager *);
+
/**
* The Token manager uses ACE_Token_Proxy::token_id_ to look for
* an existing token. If none is found, the Token Manager calls
@@ -55,6 +69,7 @@ public:
* id's the token name.
*/
void get_token (ACE_Token_Proxy *, const ACE_TCHAR *token_name);
+
/**
* Check whether acquire will cause deadlock or not.
* returns 1 if the acquire will _not_ cause deadlock.
@@ -65,9 +80,11 @@ public:
*/
int check_deadlock (ACE_Token_Proxy *proxy);
int check_deadlock (ACE_Tokens *token, ACE_Token_Proxy *proxy);
+
/// Notify the token manager that a token has been released. If as a
/// result, there is no owner of the token, the token is deleted.
void release_token (ACE_Tokens *&token);
+
/**
* This is to allow Tokens to perform atomic transactions. The
* typical usage is to acquire this mutex, check for a safe_acquire,
@@ -76,44 +93,59 @@ public:
* the Token queues.
*/
ACE_TOKEN_CONST::MUTEX &mutex (void);
+
/// Dump the state of the class.
void dump (void) const;
+
/// Turn debug mode on/off.
void debug (bool d);
+
private:
/// Whether to print debug messages or not.
bool debug_;
+
/// pointer to singleton token manager.
static ACE_Token_Manager *token_manager_;
+
/// Return the token that the given client_id is waiting for, if any
ACE_Tokens *token_waiting_for (const ACE_TCHAR *client_id);
+
/// ACE_Mutex_Token used to lock internal data structures.
ACE_TOKEN_CONST::MUTEX lock_;
+
/// This may be changed to a template type.
typedef ACE_Token_Name TOKEN_NAME;
+
/// COLLECTION maintains a mapping from token names to ACE_Tokens*
typedef ACE_Map_Manager<TOKEN_NAME, ACE_Tokens *, ACE_Null_Mutex>
COLLECTION;
+
/// Allows iterations through collection_
/**
* @deprecated Deprecated typedef. Use COLLECTION::ITERATOR trait
* instead.
*/
typedef COLLECTION::ITERATOR COLLECTION_ITERATOR;
+
/// Allows iterations through collection_
/**
* @deprecated Deprecated typedef. Use COLLECTION::ENTRY trait
* instead.
*/
typedef COLLECTION::ENTRY COLLECTION_ENTRY;
+
/// COLLECTION maintains a mapping from token names to ACE_Tokens*.
COLLECTION collection_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Token_Manager.inl"
#endif /* __ACE_INLINE__ */
+
#endif /* ACE_HAS_TOKENS_LIBRARY */
+
#include /**/ "ace/post.h"
#endif /* ACE_TOKEN_MANAGER_H */
diff --git a/dep/ACE_wrappers/ace/Token_Manager.inl b/dep/ACE_wrappers/ace/Token_Manager.inl
index ac2bb417bf4..a44778c89b2 100644
--- a/dep/ACE_wrappers/ace/Token_Manager.inl
+++ b/dep/ACE_wrappers/ace/Token_Manager.inl
@@ -1,19 +1,25 @@
// -*- C++ -*-
//
// $Id: Token_Manager.inl 80826 2008-03-04 14:51:23Z wotte $
+
#if defined (ACE_HAS_TOKENS_LIBRARY)
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE ACE_TOKEN_CONST::MUTEX &
ACE_Token_Manager::mutex (void)
{
ACE_TRACE ("ACE_Token_Manager::mutex");
return lock_;
}
+
ACE_INLINE void
ACE_Token_Manager::debug (bool d)
{
ACE_TRACE ("ACE_Token_Manager::debug");
debug_ = d;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_TOKENS_LIBRARY */
diff --git a/dep/ACE_wrappers/ace/Token_Request_Reply.cpp b/dep/ACE_wrappers/ace/Token_Request_Reply.cpp
index 5fc66863be5..8950a47b2b0 100644
--- a/dep/ACE_wrappers/ace/Token_Request_Reply.cpp
+++ b/dep/ACE_wrappers/ace/Token_Request_Reply.cpp
@@ -1,18 +1,27 @@
// $Id: Token_Request_Reply.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Token_Request_Reply.h"
+
#if defined (ACE_HAS_TOKENS_LIBRARY)
+
#if !defined (__ACE_INLINE__)
#include "ace/Token_Request_Reply.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace, Token_Request_Reply, "$Id: Token_Request_Reply.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Default "do nothing" constructor.
+
ACE_Token_Request::ACE_Token_Request (void)
: token_name_ (0),
client_id_ (0)
{
}
+
// Create a ACE_Token_Request message.
+
ACE_Token_Request::ACE_Token_Request (int token_type,
int proxy_type,
ACE_UINT32 operation_type,
@@ -30,25 +39,32 @@ ACE_Token_Request::ACE_Token_Request (int token_type,
this->token_name (token_name, client_id);
this->options (options);
}
+
// Encode the transfer buffer into network byte order
// so that it can be sent to the server.
+
int
ACE_Token_Request::encode (void *&buf)
{
buf = (void *) &this->transfer_;
return this->length ();
}
+
// Decode the transfer buffer into host byte byte order
// so that it can be used by the server.
+
int
ACE_Token_Request::decode (void)
{
this->token_name_ = this->transfer_.data_;
+
options_.set (transfer_.use_timeout_ == 1 ? ACE_Synch_Options::USE_TIMEOUT : 0,
ACE_Time_Value (transfer_.sec_, transfer_.usec_),
(void *) transfer_.arg_);
+
// Decode the variable-sized portion.
size_t token_len = ACE_OS::strlen (this->token_name_);
+
// Check to make sure this->tokenName_ isn't too long!
if (token_len >= ACE_MAXTOKENNAMELEN)
{
@@ -58,6 +74,7 @@ ACE_Token_Request::decode (void)
else // Skip this->tokenName_ + '\0' + ':'.
this->client_id_ =
&this->token_name_[(token_len + 2) * sizeof (ACE_TCHAR)];
+
// Fixed size header
// token_name_ plus '\0'
// ':'
@@ -66,10 +83,13 @@ ACE_Token_Request::decode (void)
+ ACE_OS::strlen (this->token_name_) + 1
+ ACE_OS::strlen (this->client_id_) + 1
+ 1;
+
// Make sure the message was correctly received and framed.
return this->length () == data_size ? 0 : -1;
}
+
// Print out the current values of the ACE_Token_Request.
+
void
ACE_Token_Request::dump (void) const
{
@@ -78,6 +98,7 @@ ACE_Token_Request::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("*******\nlength = %d\ntoken name = %s\nclient id = %s\n"),
this->length (), this->token_name (), this->client_id ()));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("type = ")));
+
if (this->token_type () == ACE_Tokens::MUTEX)
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("MUTEX\n")));
else // == ACE_Tokens::RWLOCK
@@ -87,6 +108,7 @@ ACE_Token_Request::dump (void) const
else // == WRITER
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("WLOCK\n")));
}
+
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("operation = ")));
switch (this->operation_type ())
{
@@ -103,6 +125,7 @@ ACE_Token_Request::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("<unknown operation type> = %d\n"), this->operation_type ()));
break;
}
+
if (this->options ()[ACE_Synch_Options::USE_TIMEOUT] == 0)
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("blocking forever\n")));
else
@@ -113,32 +136,41 @@ ACE_Token_Request::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
// ************************************************************
// ************************************************************
// ************************************************************
+
// Create a ACE_Token_Reply message.
+
ACE_Token_Reply::ACE_Token_Reply (void) // Type of reply.
{
this->arg (0);
this->errnum (0);
this->length (sizeof (Transfer));
}
+
// Encode the transfer buffer into network byte order
// so that it can be sent to the client.
+
int
ACE_Token_Reply::encode (void *&buf)
{
buf = (void *) &this->transfer_;
return this->length ();
}
+
// Decode the transfer buffer into host byte order
// so that it can be used by the client.
+
int
ACE_Token_Reply::decode (void)
{
return 0;
}
+
// Print out current values of the ACE_Token_Reply object.
+
void
ACE_Token_Reply::dump (void) const
{
@@ -148,6 +180,8 @@ ACE_Token_Reply::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("arg = %d"), this->arg ()));
#endif /* ACE_HAS_DUMP */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_TOKENS_LIBRARY */
diff --git a/dep/ACE_wrappers/ace/Token_Request_Reply.h b/dep/ACE_wrappers/ace/Token_Request_Reply.h
index 15228922b74..1c09f7af8f6 100644
--- a/dep/ACE_wrappers/ace/Token_Request_Reply.h
+++ b/dep/ACE_wrappers/ace/Token_Request_Reply.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Token_Request_Reply.h
@@ -14,18 +15,25 @@
*/
//=============================================================================
+
#ifndef ACE_TOKEN_REQUEST_REPLY_H
#define ACE_TOKEN_REQUEST_REPLY_H
#include /**/ "ace/pre.h"
+
#include "ace/Local_Tokens.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_TOKENS_LIBRARY)
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/// Specifies the size of the fixed length portion of
/// the Transfer structure in ACE_Token_Request
#define ACE_TOKEN_REQUEST_HEADER_SIZE 40
+
/**
* @class ACE_Token_Request
*
@@ -51,8 +59,10 @@ public:
// Try to acquire the token.
TRY_ACQUIRE
};
+
/// Default constructor.
ACE_Token_Request (void);
+
/**
* @param token_type MUTEX, RWLOCK
* @param proxy_type MUTEX, RLOCK, WLOCK (acquires mean different things)
@@ -67,89 +77,124 @@ public:
const ACE_TCHAR token_name[],
const ACE_TCHAR client_id[],
const ACE_Synch_Options &options);
+
/// Get the length of the encoded/decoded message.
ACE_UINT32 length (void) const;
+
/// Set the length of the encoded/decoded message.
void length (ACE_UINT32);
+
/// Get the type of proxy
int proxy_type (void) const;
+
/// Set the type of proxy
void proxy_type (int proxy_type);
+
/// Get the type of token
int token_type (void) const;
+
/// Set the type of token
void token_type (int token_type);
+
/// Get the type of the operation.
ACE_UINT32 operation_type (void) const;
+
/// Set the type of the operation.
void operation_type (ACE_UINT32);
+
/// Get the requeue position. These should be used when renew
/// is the operation type.
ACE_UINT32 requeue_position (void) const;
+
/// Set the requeue position. These should be used when renew
/// is the operation type.
void requeue_position (ACE_UINT32);
+
/// Get notify. These should be used when acquire is the operation type.
ACE_UINT32 notify (void) const;
+
/// Set notify. These should be used when acquire is the operation type.
void notify (ACE_UINT32);
+
/// Get the timeout.
ACE_Synch_Options &options (void) const;
+
/// Set the timeout.
void options (const ACE_Synch_Options &options);
+
// = Set/get the name of the token and the client id. The set
// method is combined to make it easier on us. We're copying the
// names as a contiguous buffer.
ACE_TCHAR *token_name (void) const;
ACE_TCHAR *client_id (void) const;
void token_name (const ACE_TCHAR *token_name, const ACE_TCHAR *client_id);
+
/// Encode the message before transmission.
int encode (void *&);
+
/// Decode message after reception. This must be called to set the
/// internal options.
int decode (void);
+
/// Print out the values of the message for debugging purposes.
void dump (void) const;
+
private:
// = The 5 fields in the <Transfer> struct are transmitted to the server.
// The remaining 2 fields are not tranferred -- they are used only on
// the server-side to simplify lookups.
+
struct Transfer
{
/// Length of entire request.
ACE_UINT32 length_;
+
/// Type of the request (i.e., MUTEX, RLOCK, WLOCK...
ACE_UINT32 token_type_;
+
/// Type of the request (i.e., MUTEX, RLOCK, WLOCK...
ACE_UINT32 proxy_type_;
+
/// Type of the request (i.e., <ACQUIRE>, <RELEASE>, <RENEW>, and <REMOVE>).
ACE_UINT32 operation_type_;
+
/// this only makes sense when operation type is renew
ACE_UINT32 requeue_position_;
+
/// this only makes sense when operation type is renew
ACE_UINT32 notify_;
+
// = ACE_Synch_Options stuff
+
/// Indicates if we should block forever. If 1, then <secTimeout_>
/// and <usecTimeout_> indicates how long we should wait. If 0,
/// then we block forever.
ACE_UINT32 use_timeout_;
+
/// Max seconds willing to wait for token if not blocking forever.
ACE_UINT32 sec_;
+
/// Max micro seconds to wait for token if not blocking forever.
ACE_UINT32 usec_;
+
/// value returned in <Token_Reply::arg>;
ACE_UINT32 arg_;
+
/// The data portion contains the <tokenName_> including a 0 terminator,
/// a ':', then the <clientId> including a 0 terminator
ACE_TCHAR data_[ACE_MAXTOKENNAMELEN + ACE_MAXCLIENTIDLEN + 3];
} transfer_;
+
/// Pointer to the beginning of the token name in this->data_.
ACE_TCHAR *token_name_;
+
/// Pointer to the beginning of the client id in this->data_;
ACE_TCHAR *client_id_;
+
/// Holds arg, sec, usec, etc.
ACE_Synch_Options options_;
};
+
/**
* @class ACE_Token_Reply
*
@@ -163,30 +208,42 @@ class ACE_Export ACE_Token_Reply
public:
/// Default constructor.
ACE_Token_Reply (void);
+
/// Get the length of the encoded/decoded message.
ACE_UINT32 length (void) const;
+
/// Set the length of the encoded/decoded message.
void length (ACE_UINT32);
+
/// Get the errno of a reply.
ACE_UINT32 errnum (void) const;
+
/// Set the errno of a reply.
void errnum (ACE_UINT32);
+
/// Get the arg of a reply.
ACE_UINT32 arg (void) const;
+
/// Set the arg of a reply.
void arg (ACE_UINT32);
+
/// Encode the message before transfer.
int encode (void *&);
+
/// Decode a message after reception.
int decode (void);
+
/// Print out the values of the message for debugging purposes.
void dump (void) const;
+
private:
// = The 2 fields in the <Transfer> struct are transmitted to the server.
+
struct Transfer
{
/// Length of entire reply.
ACE_UINT32 length_;
+
/// Indicates why error occurred if <this->type_> == <FAILURE>.
/// Typical reasons include:
/// @c EWOULDBLOCK (if client requested a non-blocking check for the token).
@@ -194,15 +251,21 @@ private:
/// <ENOLCK> (if the token lock was removed out from underneath a waiter).
/// <EACCES> (attempt to renew a token that isn't owned by the client).
ACE_UINT32 errno_;
+
/// magic cookie
ACE_UINT32 arg_;
+
} transfer_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Token_Request_Reply.inl"
#endif /* __ACE_INLINE__ */
+
#endif /* ACE_HAS_TOKENS_LIBRARY */
+
#include /**/ "ace/post.h"
#endif /* ACE_TOKEN_REQUEST_REPLY_H */
diff --git a/dep/ACE_wrappers/ace/Token_Request_Reply.inl b/dep/ACE_wrappers/ace/Token_Request_Reply.inl
index 58eb0e3ff9d..4291bfa6089 100644
--- a/dep/ACE_wrappers/ace/Token_Request_Reply.inl
+++ b/dep/ACE_wrappers/ace/Token_Request_Reply.inl
@@ -1,86 +1,105 @@
// -*- C++ -*-
//
// $Id: Token_Request_Reply.inl 80826 2008-03-04 14:51:23Z wotte $
+
#if defined (ACE_HAS_TOKENS_LIBRARY)
+
#include "ace/Truncate.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// = Set/get the length of the encoded/decoded message.
+
ACE_INLINE ACE_UINT32
ACE_Token_Request::length (void) const
{
return ntohl (this->transfer_.length_);
}
+
ACE_INLINE void
ACE_Token_Request::length (ACE_UINT32 l)
{
this->transfer_.length_ = htonl (l);
}
+
// = Set/get the type of the message.
ACE_INLINE int
ACE_Token_Request::token_type (void) const
{
return (int) ntohl (this->transfer_.token_type_);
}
+
ACE_INLINE void
ACE_Token_Request::token_type (int t)
{
this->transfer_.token_type_ = htonl ((ACE_UINT32) t);
}
+
// = Set/get the type of the message.
ACE_INLINE int
ACE_Token_Request::proxy_type (void) const
{
return (int) ntohl (this->transfer_.proxy_type_);
}
+
ACE_INLINE void
ACE_Token_Request::proxy_type (int t)
{
this->transfer_.proxy_type_ = htonl ((ACE_UINT32) t);
}
+
// = Set/get the type of the message.
ACE_INLINE ACE_UINT32
ACE_Token_Request::operation_type (void) const
{
return ntohl (this->transfer_.operation_type_);
}
+
ACE_INLINE void
ACE_Token_Request::operation_type (ACE_UINT32 t)
{
this->transfer_.operation_type_ = htonl (t);
}
+
// = Set/get the requeue position
ACE_INLINE ACE_UINT32
ACE_Token_Request::requeue_position (void) const
{
return ntohl (this->transfer_.requeue_position_);
}
+
ACE_INLINE void
ACE_Token_Request::requeue_position (ACE_UINT32 rq)
{
this->transfer_.requeue_position_ = htonl (rq);
}
+
// = Set/get the requeue position
ACE_INLINE ACE_UINT32
ACE_Token_Request::notify (void) const
{
return ntohl (this->transfer_.notify_);
}
+
ACE_INLINE void
ACE_Token_Request::notify (ACE_UINT32 rq)
{
this->transfer_.notify_ = htonl (rq);
}
+
// = Set/get the blocking semantics.
ACE_INLINE ACE_Synch_Options &
ACE_Token_Request::options (void) const
{
return (ACE_Synch_Options &) options_;
}
+
ACE_INLINE void
ACE_Token_Request::options (const ACE_Synch_Options &opt)
{
// fight the friggin const from hell
ACE_Synch_Options *options = (ACE_Synch_Options *) &opt;
+
transfer_.use_timeout_ = options->operator[](ACE_Synch_Options::USE_TIMEOUT);
if (transfer_.use_timeout_ == 1)
{
@@ -96,75 +115,91 @@ ACE_Token_Request::options (const ACE_Synch_Options &opt)
transfer_.sec_ = 0;
}
}
+
// = Set/get the name of the token.
ACE_INLINE ACE_TCHAR *
ACE_Token_Request::token_name (void) const
{
return token_name_;
}
+
ACE_INLINE void
ACE_Token_Request::token_name (const ACE_TCHAR *token_name,
const ACE_TCHAR *client_id)
{
size_t token_name_length = ACE_OS::strlen (token_name) + 1; // Add 1 for '\0'.
size_t client_id_length = ACE_OS::strlen (client_id) + 1; // Add 1 for '\0'.
+
// Set up pointers and copy token_name and client_id into request.
token_name_ = this->transfer_.data_;
client_id_ = &this->token_name_[token_name_length + 1]; // Add 1 for ':';
client_id_[-1] = ACE_TEXT (':'); // Insert the ':' before this->clientId_.
+
(void) ACE_OS::memcpy (this->token_name_,
token_name,
token_name_length * sizeof (ACE_TCHAR));
(void) ACE_OS::memcpy (this->client_id_,
client_id,
client_id_length * sizeof (ACE_TCHAR));
+
// Fixed length header size
size_t len = ACE_TOKEN_REQUEST_HEADER_SIZE;
+
// ... then add in the amount of the variable-sized portion.
len += token_name_length + client_id_length + 1;
this->length (ACE_Utils::truncate_cast<ACE_UINT32> (len));
}
+
// = Set/get the id of the client.
ACE_INLINE ACE_TCHAR *
ACE_Token_Request::client_id (void) const
{
return this->client_id_;
}
+
// ************************************************************
// ************************************************************
// ************************************************************
+
// = Set/get the length of the encoded/decoded message.
ACE_INLINE ACE_UINT32
ACE_Token_Reply::length (void) const
{
return ntohl (this->transfer_.length_);
}
+
ACE_INLINE void
ACE_Token_Reply::length (ACE_UINT32 l)
{
this->transfer_.length_ = htonl (l);
}
+
// = Set/get the errno of a failed reply.
ACE_INLINE ACE_UINT32
ACE_Token_Reply::errnum (void) const
{
return ntohl (this->transfer_.errno_);
}
+
ACE_INLINE void
ACE_Token_Reply::errnum (ACE_UINT32 e)
{
this->transfer_.errno_ = htonl (e);
}
+
// = Set/get the length of the encoded/decoded message.
ACE_INLINE ACE_UINT32
ACE_Token_Reply::arg (void) const
{
return ntohl (this->transfer_.arg_);
}
+
ACE_INLINE void
ACE_Token_Reply::arg (ACE_UINT32 arg)
{
this->transfer_.arg_ = htonl (arg);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_TOKENS_LIBRARY */
diff --git a/dep/ACE_wrappers/ace/Trace.cpp b/dep/ACE_wrappers/ace/Trace.cpp
index 48122a8d98e..5592b8169a3 100644
--- a/dep/ACE_wrappers/ace/Trace.cpp
+++ b/dep/ACE_wrappers/ace/Trace.cpp
@@ -1,61 +1,83 @@
// $Id: Trace.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/Trace.h"
+
ACE_RCSID (ace,
Trace,
"$Id: Trace.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
// Turn off tracing for the duration of this file.
#if defined (ACE_NTRACE)
#undef ACE_NTRACE
#endif /* ACE_NTRACE */
#define ACE_NTRACE 1
+
#include "ace/Log_Msg.h"
#include "ace/Object_Manager_Base.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// = Static initialization.
+
// Keeps track of how far to indent per trace call.
int ACE_Trace::nesting_indent_ = ACE_Trace::DEFAULT_INDENT;
+
// Is tracing enabled?
int ACE_Trace::enable_tracing_ = ACE_Trace::DEFAULT_TRACING;
+
ACE_ALLOC_HOOK_DEFINE(ACE_Trace)
+
void
ACE_Trace::dump (void) const
{
#if defined (ACE_HAS_DUMP)
#endif /* ACE_HAS_DUMP */
}
+
// Determine whether or not tracing is enabled
+
int
ACE_Trace::is_tracing (void)
{
return ACE_Trace::enable_tracing_;
}
+
// Enable the tracing facility.
+
void
ACE_Trace::start_tracing (void)
{
ACE_Trace::enable_tracing_ = 1;
}
+
// Disable the tracing facility.
+
void
ACE_Trace::stop_tracing (void)
{
ACE_Trace::enable_tracing_ = 0;
}
+
// Change the nesting indentation level.
+
void
ACE_Trace::set_nesting_indent (int indent)
{
ACE_Trace::nesting_indent_ = indent;
}
+
// Get the nesting indentation level.
+
int
ACE_Trace::get_nesting_indent (void)
{
return ACE_Trace::nesting_indent_;
}
+
// Perform the first part of the trace, which prints out the string N,
// the LINE, and the ACE_FILE as the function is entered.
+
ACE_Trace::ACE_Trace (const ACE_TCHAR *n,
int line,
const ACE_TCHAR *file)
@@ -64,7 +86,9 @@ ACE_Trace::ACE_Trace (const ACE_TCHAR *n,
ACE_UNUSED_ARG (line);
ACE_UNUSED_ARG (file);
#endif /* ACE_NLOGGING */
+
this->name_ = n;
+
// If ACE has not yet been initialized, don't try to trace... there's
// too much stuff not yet initialized.
if (ACE_Trace::enable_tracing_ && !ACE_OS_Object_Manager::starting_up ())
@@ -85,8 +109,10 @@ ACE_Trace::ACE_Trace (const ACE_TCHAR *n,
}
}
}
+
// Perform the second part of the trace, which prints out the NAME as
// the function is exited.
+
ACE_Trace::~ACE_Trace (void)
{
// If ACE has not yet been initialized, don't try to trace... there's
@@ -107,5 +133,6 @@ ACE_Trace::~ACE_Trace (void)
}
}
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Trace.h b/dep/ACE_wrappers/ace/Trace.h
index 6f47ac167f6..f1c6aa86037 100644
--- a/dep/ACE_wrappers/ace/Trace.h
+++ b/dep/ACE_wrappers/ace/Trace.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Trace.h
@@ -8,14 +9,20 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_TRACE_H
#define ACE_TRACE_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Trace
*
@@ -30,37 +37,50 @@ class ACE_Export ACE_Trace
{
public:
// = Initialization and termination methods.
+
/// Perform the first part of the trace, which prints out the string
/// N, the LINE, and the ACE_FILE as the function is entered.
ACE_Trace (const ACE_TCHAR *n,
int line = 0,
const ACE_TCHAR *file = ACE_TEXT (""));
+
/// Perform the second part of the trace, which prints out the NAME
/// as the function is exited.
~ACE_Trace (void);
+
// = Control the tracing level.
/// Determine if tracing is enabled (return == 1) or not (== 0)
static int is_tracing(void);
+
/// Enable the tracing facility.
static void start_tracing (void);
+
/// Disable the tracing facility.
static void stop_tracing (void);
+
/// Change the nesting indentation level.
static void set_nesting_indent (int indent);
+
/// Get the nesting indentation level.
static int get_nesting_indent (void);
+
/// Dump the state of an object.
void dump (void) const;
+
private:
// Keeps track of how deeply the call stack is nested (this is
// maintained in thread-specific storage to ensure correctness in
// multiple threads of control.
+
/// Name of the method we are in.
const ACE_TCHAR *name_;
+
/// Keeps track of how far to indent per trace call.
static int nesting_indent_;
+
/// Is tracing enabled?
static int enable_tracing_;
+
/// Default values.
enum
{
@@ -68,7 +88,10 @@ private:
DEFAULT_TRACING = 1
};
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
+
#endif /* ACE_TRACE_H */
diff --git a/dep/ACE_wrappers/ace/Truncate.h b/dep/ACE_wrappers/ace/Truncate.h
index a95d03f3b68..aef1c4ea57e 100644
--- a/dep/ACE_wrappers/ace/Truncate.h
+++ b/dep/ACE_wrappers/ace/Truncate.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Truncate.h
@@ -10,25 +11,36 @@
* @author Russell Mora <russell_mora@symantec.com>
*/
//=============================================================================
+
#ifndef ACE_TRUNCATE_H
#define ACE_TRUNCATE_H
+
#include /**/ "ace/pre.h"
+
#include "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Global_Macros.h"
#include "ace/If_Then_Else.h"
#include "ace/Numeric_Limits.h"
+
#if defined (ACE_LACKS_LONGLONG_T) \
|| defined (__BORLANDC__) && __BORLANDC__ < 0x590
# include "ace/Basic_Types.h"
#endif /* ACE_LACKS_LONGLONG_T || __BORLANDC__ < 0x590 */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE_Utils
{
+
#if !defined (__BORLANDC__) || __BORLANDC__ >= 0x590
+
template<typename T> struct Sign_Check;
+
// Specialize the unsigned signed cases.
template<> struct Sign_Check<unsigned char> { ACE_STATIC_CONSTANT (bool, is_signed = 0); };
template<> struct Sign_Check<unsigned short> { ACE_STATIC_CONSTANT (bool, is_signed = 0); };
@@ -44,6 +56,7 @@ namespace ACE_Utils
#else
template<> struct Sign_Check<ACE_U_LongLong> { ACE_STATIC_CONSTANT (bool, is_signed = 0); };
#endif /* !ACE_LACKS_LONGLONG_T */
+
// Specialize the signed cases.
template<> struct Sign_Check<signed char> { ACE_STATIC_CONSTANT (bool, is_signed = 1); };
template<> struct Sign_Check<signed short> { ACE_STATIC_CONSTANT (bool, is_signed = 1); };
@@ -57,7 +70,9 @@ namespace ACE_Utils
# endif /* __GNUC__ */
template<> struct Sign_Check<signed long long> { ACE_STATIC_CONSTANT (bool, is_signed = 1); };
#endif /* !ACE_LACKS_LONGLONG_T */
+
// -----------------------------------------------------
+
/**
* @struct To_Unsigned
*
@@ -66,30 +81,39 @@ namespace ACE_Utils
* Retrieve unsigned counterpart to given type or value.
*/
template<typename T> struct To_Unsigned;
+
template<>
struct To_Unsigned<unsigned char>
{
typedef unsigned char unsigned_type;
+
unsigned_type operator() (unsigned_type x) { return x; }
};
+
template<>
struct To_Unsigned<unsigned short>
{
typedef unsigned short unsigned_type;
+
unsigned_type operator() (unsigned_type x) { return x; }
};
+
template<>
struct To_Unsigned<unsigned int>
{
typedef unsigned int unsigned_type;
+
unsigned_type operator() (unsigned_type x) { return x; }
};
+
template<>
struct To_Unsigned<unsigned long>
{
typedef unsigned long unsigned_type;
+
unsigned_type operator() (unsigned_type x) { return x; }
};
+
#if !(defined(ACE_LACKS_LONGLONG_T) || defined(ACE_LACKS_UNSIGNEDLONGLONG_T))
# ifdef __GNUC__
// Silence g++ "-pedantic" warnings regarding use of "long long"
@@ -100,6 +124,7 @@ namespace ACE_Utils
struct To_Unsigned<unsigned long long>
{
typedef unsigned long long unsigned_type;
+
unsigned_type operator() (unsigned_type x) { return x; }
};
#else
@@ -107,50 +132,61 @@ namespace ACE_Utils
struct To_Unsigned<ACE_U_LongLong>
{
typedef ACE_U_LongLong unsigned_type;
+
unsigned_type operator() (unsigned_type x) { return x; }
};
#endif /* !ACE_LACKS_LONGLONG_T */
+
// ----------------
+
template<>
struct To_Unsigned<signed char>
{
typedef signed char signed_type;
typedef unsigned char unsigned_type;
+
unsigned_type operator() (signed_type x)
{
return static_cast<unsigned_type> (x);
}
};
+
template<>
struct To_Unsigned<signed short>
{
typedef signed short signed_type;
typedef unsigned short unsigned_type;
+
unsigned_type operator() (signed_type x)
{
return static_cast<unsigned_type> (x);
}
};
+
template<>
struct To_Unsigned<signed int>
{
typedef signed int signed_type;
typedef unsigned int unsigned_type;
+
unsigned_type operator() (signed_type x)
{
return static_cast<unsigned_type> (x);
}
};
+
template<>
struct To_Unsigned<signed long>
{
typedef signed long signed_type;
typedef unsigned long unsigned_type;
+
unsigned_type operator() (signed_type x)
{
return static_cast<unsigned_type> (x);
}
};
+
#if !(defined(ACE_LACKS_LONGLONG_T) || defined(ACE_LACKS_UNSIGNEDLONGLONG_T))
# ifdef __GNUC__
// Silence g++ "-pedantic" warnings regarding use of "long long"
@@ -162,13 +198,16 @@ namespace ACE_Utils
{
typedef signed long long signed_type;
typedef unsigned long long unsigned_type;
+
unsigned_type operator() (signed_type x)
{
return static_cast<unsigned_type> (x);
}
};
#endif /* !ACE_LACKS_LONGLONG_T */
+
// -----------------------------------------------------
+
/**
* @struct Safe_Comparator
*
@@ -185,6 +224,7 @@ namespace ACE_Utils
typename RIGHT,
bool IS_LEFT_SIGNED,
bool IS_RIGHT_SIGNED> struct Safe_Comparator;
+
// LEFT: signed, RIGHT: unsigned
template<typename LEFT, typename RIGHT>
struct Safe_Comparator<LEFT, RIGHT, true, false>
@@ -201,6 +241,7 @@ namespace ACE_Utils
}
}
};
+
// LEFT: unsigned, RIGHT: signed
template<typename LEFT, typename RIGHT>
struct Safe_Comparator<LEFT, RIGHT, false, true>
@@ -217,6 +258,7 @@ namespace ACE_Utils
}
}
};
+
// LEFT: unsigned, RIGHT: unsigned
template<typename LEFT, typename RIGHT>
struct Safe_Comparator<LEFT, RIGHT, false, false>
@@ -227,6 +269,7 @@ namespace ACE_Utils
return lhs > rhs;
}
};
+
// LEFT: signed, RIGHT: signed
template<typename LEFT, typename RIGHT>
struct Safe_Comparator<LEFT, RIGHT, true, true>
@@ -237,7 +280,9 @@ namespace ACE_Utils
return lhs > rhs;
}
};
+
// -----------------------------------------------------
+
/**
* @struct Fast_Comparator
*
@@ -259,6 +304,7 @@ namespace ACE_Utils
USE_LEFT = ((sizeof (LEFT) > sizeof (RIGHT)
&& (Sign_Check<LEFT>::is_signed == 1
|| Sign_Check<RIGHT>::is_signed == 0))
+
// The following is basically the case where LEFT
// and RIGHT are the same integral type.
|| (sizeof (LEFT) == sizeof (RIGHT)
@@ -272,12 +318,15 @@ namespace ACE_Utils
&& Sign_Check<RIGHT>::is_signed == 1)
|| (Sign_Check<LEFT>::is_signed == 0
&& Sign_Check<RIGHT>::is_signed == 0)))));
+
ACE_STATIC_CONSTANT (
bool,
USE_RIGHT = (sizeof (RIGHT) > sizeof (LEFT)
&& (Sign_Check<RIGHT>::is_signed == 1
|| Sign_Check<LEFT>::is_signed == 0)));
+
ACE_STATIC_CONSTANT (bool, USABLE = (USE_LEFT || USE_RIGHT));
+
typedef typename ACE::If_Then_Else<
USE_LEFT,
LEFT,
@@ -285,6 +334,7 @@ namespace ACE_Utils
USE_RIGHT,
RIGHT,
void>::result_type>::result_type promote_type;
+
static bool greater_than (LEFT lhs, RIGHT rhs)
{
// The explicit cast is assumed to change the type of rhs without
@@ -292,8 +342,11 @@ namespace ACE_Utils
return
(static_cast<promote_type> (lhs) > static_cast<promote_type> (rhs));
}
+
};
+
// -----------------------------------------------------
+
/**
* @struct Comparator
*
@@ -331,7 +384,9 @@ namespace ACE_Utils
Sign_Check<LEFT>::is_signed,
Sign_Check<RIGHT>::is_signed> >::result_type comp_type;
};
+
// -----------------------------------------------------
+
/**
* @struct Truncator
*
@@ -349,10 +404,12 @@ namespace ACE_Utils
MAX_FROM_GT_MAX_TO = (sizeof(FROM) > sizeof (TO)
|| (sizeof(FROM) == sizeof (TO)
&& Sign_Check<FROM>::is_signed == 0)));
+
typedef typename ACE::If_Then_Else<
MAX_FROM_GT_MAX_TO,
FROM,
TO>::result_type comp_to_type;
+
// Take advantage of knowledge that we're casting a positive value
// to a type large enough to hold it so that we can bypass
// negative value checks at compile-time. Otherwise fallback on
@@ -361,6 +418,7 @@ namespace ACE_Utils
MAX_FROM_GT_MAX_TO,
Fast_Comparator<FROM, comp_to_type>,
typename Comparator<FROM, comp_to_type>::comp_type>::result_type comparator;
+
/// Truncate a value of type @c FROM to value of type @c TO, if
/// the value is larger than the maximum of value of type @c TO.
TO operator() (FROM val)
@@ -370,7 +428,9 @@ namespace ACE_Utils
? ACE_Numeric_Limits<TO>::max ()
: static_cast<TO> (val));
}
+
};
+
// Partial specialization for the case where the types are the same.
// No truncation is necessary.
template<typename T>
@@ -382,6 +442,7 @@ namespace ACE_Utils
}
};
+
#if defined (ACE_LACKS_LONGLONG_T) || defined (ACE_LACKS_UNSIGNEDLONGLONG_T)
// Partial specialization for the case where we're casting from
// ACE_U_LongLong to a smaller integer. We assume that we're always
@@ -403,6 +464,7 @@ namespace ACE_Utils
}
};
#endif /* ACE_LACKS_LONGLONG_T || ACE_LACKS_UNSIGNEDLONGLONG_T */
+
// -----------------------------------------------------
/**
* @struct Noop_Truncator
@@ -422,6 +484,7 @@ namespace ACE_Utils
}
};
// -----------------------------------------------------
+
/**
* @class truncate_cast
*
@@ -445,20 +508,27 @@ namespace ACE_Utils
(sizeof (FROM) < sizeof (TO)),
Noop_Truncator<FROM, TO>,
Truncator<FROM, TO> >::result_type truncator;
+
return truncator() (val);
}
+
#else
+
// Borland can't handle the template meta-programming above so
// provide explicit specializations for a few types. More will be
// added if necessary.
+
/**
* @deprecated Borland ACE_Utils::Truncator<> specializations should
* be removed.
*/
+
template<typename FROM, typename TO> struct Truncator;
+
//----------------------------------------------------------
// sizeof(FROM) > sizeof(TO)
//----------------------------------------------------------
+
template<>
struct Truncator<ACE_INT32, ACE_INT8>
{
@@ -470,6 +540,7 @@ namespace ACE_Utils
: static_cast<ACE_INT8> (val));
}
};
+
template<>
struct Truncator<ACE_UINT32, ACE_UINT8>
{
@@ -481,6 +552,7 @@ namespace ACE_Utils
: static_cast<ACE_UINT8> (val));
}
};
+
template<>
struct Truncator<ACE_INT32, ACE_UINT8>
{
@@ -492,6 +564,7 @@ namespace ACE_Utils
: static_cast<ACE_UINT8> (val));
}
};
+
template<>
struct Truncator<ACE_UINT32, ACE_INT8>
{
@@ -503,6 +576,7 @@ namespace ACE_Utils
: static_cast<ACE_INT8> (val));
}
};
+
#if defined (ACE_SIZEOF_LONG) && ACE_SIZEOF_LONG < 8
template<>
struct Truncator<ACE_INT64, signed long>
@@ -515,6 +589,7 @@ namespace ACE_Utils
: static_cast<signed long> (val));
}
};
+
template<>
struct Truncator<ACE_INT64, unsigned long>
{
@@ -526,6 +601,7 @@ namespace ACE_Utils
: static_cast<unsigned long> (val));
}
};
+
template<>
struct Truncator<ACE_UINT64, unsigned long>
{
@@ -537,6 +613,7 @@ namespace ACE_Utils
: static_cast<unsigned long> (val));
}
};
+
template<>
struct Truncator<ACE_UINT64, signed long>
{
@@ -548,6 +625,7 @@ namespace ACE_Utils
: static_cast<signed long> (val));
}
};
+
template<>
struct Truncator<const ACE_UINT64, signed long>
{
@@ -559,7 +637,9 @@ namespace ACE_Utils
: static_cast<signed long> (val));
}
};
+
#endif /* ACE_SIZEOF_LONG < 8 */
+
#if defined (ACE_SIZEOF_INT) && ACE_SIZEOF_INT < 8
template<>
struct Truncator<ACE_INT64, signed int>
@@ -572,6 +652,7 @@ namespace ACE_Utils
: static_cast<signed int> (val));
}
};
+
template<>
struct Truncator<ACE_INT64, unsigned int>
{
@@ -583,6 +664,7 @@ namespace ACE_Utils
: static_cast<unsigned int> (val));
}
};
+
template<>
struct Truncator<ACE_UINT64, unsigned int>
{
@@ -594,6 +676,7 @@ namespace ACE_Utils
: static_cast<unsigned int> (val));
}
};
+
template<>
struct Truncator<ACE_UINT64, signed int>
{
@@ -605,10 +688,13 @@ namespace ACE_Utils
: static_cast<signed int> (val));
}
};
+
#endif /* ACE_SIZEOF_INT < 8 */
+
//----------------------------------------------------------
// sizeof(FROM) == sizeof(TO)
//----------------------------------------------------------
+
template<>
struct Truncator<unsigned int, char>
{
@@ -617,6 +703,7 @@ namespace ACE_Utils
return static_cast<char> (val);
}
};
+
template<>
struct Truncator<unsigned int, wchar_t>
{
@@ -625,6 +712,7 @@ namespace ACE_Utils
return static_cast<wchar_t> (val);
}
};
+
template<>
struct Truncator<signed int, unsigned int>
{
@@ -633,6 +721,7 @@ namespace ACE_Utils
return static_cast<unsigned int> (val);
}
};
+
template<>
struct Truncator<unsigned int, signed int>
{
@@ -644,6 +733,7 @@ namespace ACE_Utils
: static_cast<signed int> (val));
}
};
+
template<>
struct Truncator<const unsigned int, signed int>
{
@@ -655,6 +745,7 @@ namespace ACE_Utils
: static_cast<signed int> (val));
}
};
+
template<>
struct Truncator<signed long, unsigned long>
{
@@ -663,6 +754,7 @@ namespace ACE_Utils
return static_cast<unsigned long> (val);
}
};
+
template<>
struct Truncator<unsigned long, signed long>
{
@@ -674,8 +766,10 @@ namespace ACE_Utils
: static_cast<signed long> (val));
}
};
+
#if defined (ACE_SIZEOF_INT) && defined (ACE_SIZEOF_LONG) \
&& ACE_SIZEOF_INT == ACE_SIZEOF_LONG
+
template<>
struct Truncator<signed int, unsigned long>
{
@@ -684,6 +778,7 @@ namespace ACE_Utils
return static_cast<unsigned long> (val);
}
};
+
template<>
struct Truncator<signed int, signed long>
{
@@ -692,6 +787,7 @@ namespace ACE_Utils
return static_cast<signed long> (val);
}
};
+
template<>
struct Truncator<unsigned long, signed int>
{
@@ -703,6 +799,7 @@ namespace ACE_Utils
: static_cast<signed int> (val));
}
};
+
template<>
struct Truncator<signed long, signed int>
{
@@ -717,6 +814,7 @@ namespace ACE_Utils
// : static_cast<signed int> (val));
}
};
+
template<>
struct Truncator<signed long, unsigned int>
{
@@ -725,6 +823,7 @@ namespace ACE_Utils
return static_cast<unsigned int> (val);
}
};
+
template<>
struct Truncator<const signed long, unsigned int>
{
@@ -734,6 +833,7 @@ namespace ACE_Utils
}
};
+
template<>
struct Truncator<unsigned int, signed long>
{
@@ -745,7 +845,9 @@ namespace ACE_Utils
: static_cast<signed long> (val));
}
};
+
#endif /* ACE_SIZEOF_INT == ACE_SIZEOF_LONG */
+
template<>
struct Truncator<ACE_INT64, ACE_UINT64>
{
@@ -754,6 +856,7 @@ namespace ACE_Utils
return static_cast<ACE_UINT64> (val);
}
};
+
template<>
struct Truncator<ACE_UINT64, ACE_INT64>
{
@@ -765,9 +868,11 @@ namespace ACE_Utils
: static_cast<ACE_INT64> (val));
}
};
+
//----------------------------------------------------------
// sizeof(FROM) < sizeof(TO)
//----------------------------------------------------------
+
template<>
struct Truncator<ACE_INT8, ACE_INT32>
{
@@ -776,6 +881,7 @@ namespace ACE_Utils
return static_cast<ACE_INT32> (val);
}
};
+
template<>
struct Truncator<ACE_UINT8, ACE_UINT32>
{
@@ -784,6 +890,7 @@ namespace ACE_Utils
return static_cast<ACE_UINT32> (val);
}
};
+
template<>
struct Truncator<ACE_UINT8, ACE_INT32>
{
@@ -792,6 +899,7 @@ namespace ACE_Utils
return static_cast<ACE_INT32> (val);
}
};
+
template<>
struct Truncator<ACE_INT8, ACE_UINT32>
{
@@ -800,6 +908,7 @@ namespace ACE_Utils
return static_cast<ACE_UINT32> (val);
}
};
+
#if defined (ACE_SIZEOF_LONG) && ACE_SIZEOF_LONG < 8
template<>
struct Truncator<signed long, ACE_INT64>
@@ -809,6 +918,7 @@ namespace ACE_Utils
return static_cast<ACE_INT64> (val);
}
};
+
template<>
struct Truncator<signed long, ACE_UINT64>
{
@@ -817,6 +927,7 @@ namespace ACE_Utils
return static_cast<ACE_UINT64> (val);
}
};
+
template<>
struct Truncator<const signed long, ACE_UINT64>
{
@@ -828,6 +939,7 @@ namespace ACE_Utils
: static_cast<signed long> (val));
}
};
+
template<>
struct Truncator<unsigned long, ACE_UINT64>
{
@@ -836,6 +948,7 @@ namespace ACE_Utils
return static_cast<ACE_UINT64> (val);
}
};
+
template<>
struct Truncator<unsigned long, ACE_INT64>
{
@@ -845,6 +958,7 @@ namespace ACE_Utils
}
};
#endif /* ACE_SIZEOF_LONG < 8 */
+
#if defined (ACE_SIZEOF_INT) && ACE_SIZEOF_INT < 8
template<>
struct Truncator<signed int, ACE_INT64>
@@ -854,6 +968,7 @@ namespace ACE_Utils
return static_cast<ACE_INT64> (val);
}
};
+
template<>
struct Truncator<signed int, ACE_UINT64>
{
@@ -862,6 +977,7 @@ namespace ACE_Utils
return static_cast<ACE_UINT64> (val);
}
};
+
template<>
struct Truncator<unsigned int, ACE_UINT64>
{
@@ -870,6 +986,7 @@ namespace ACE_Utils
return static_cast<ACE_UINT64> (val);
}
};
+
template<>
struct Truncator<unsigned int, ACE_INT64>
{
@@ -879,6 +996,7 @@ namespace ACE_Utils
}
};
#endif /* ACE_SIZEOF_INT < 8 */
+
template<>
struct Truncator<size_t, unsigned long>
{
@@ -890,6 +1008,7 @@ namespace ACE_Utils
: static_cast<size_t> (val));
}
};
+
// Partial specialization for the case where the types are the same.
// No truncation is necessary.
template<typename T>
@@ -900,6 +1019,7 @@ namespace ACE_Utils
return val;
}
};
+
// Partial specialization for the case where the types are the same,
// but the from type is const. No truncation is necessary.
//
@@ -913,16 +1033,24 @@ namespace ACE_Utils
return val;
}
};
+
// -------------------------------------
+
template<typename TO, typename FROM>
inline TO truncate_cast (FROM val)
{
typedef Truncator<FROM, TO> truncator;
+
return truncator() (val);
}
+
#endif /* !__BORLANDC__ || __BORLANDC__ >= 0x590 */
+
} // namespace ACE_Utils
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
+
#endif /* ACE_TRUNCATE_H*/
diff --git a/dep/ACE_wrappers/ace/Typed_SV_Message.h b/dep/ACE_wrappers/ace/Typed_SV_Message.h
index 3ef09104f37..69c87f73c2c 100644
--- a/dep/ACE_wrappers/ace/Typed_SV_Message.h
+++ b/dep/ACE_wrappers/ace/Typed_SV_Message.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file Typed_SV_Message.h
@@ -9,14 +10,20 @@
*/
//==========================================================================
+
#ifndef ACE_TYPED_SV_MESSAGE_H
#define ACE_TYPED_SV_MESSAGE_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Typed_SV_Message
*
@@ -36,46 +43,66 @@ public:
int length = sizeof (T),
int max_size = sizeof (T));
~ACE_Typed_SV_Message (void);
+
/// Get the type of the message.
long type (void) const;
+
/// Set the type of the message.
void type (long type);
+
/// Get the length of the message.
int length (void) const;
+
/// Set the length of the message.
void length (int l);
+
/// Get the maximum size of the message.
int max_size (void) const;
+
/// Set the maximum size of the message.
void max_size (int m);
+
/// Get a pointer to the data in the message.
T &data (void);
+
/// Set a pointer to the data in the message.
void data (const T &data);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Type of message.
long type_;
+
/// Length of this message.
int length_;
+
/// Maximum length of any message.
int max_;
+
/// Data stored in a message.
T data_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Typed_SV_Message.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Typed_SV_Message.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Typed_SV_Message.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_TYPED_SV_MESSAGE_H */
diff --git a/dep/ACE_wrappers/ace/Typed_SV_Message.inl b/dep/ACE_wrappers/ace/Typed_SV_Message.inl
index 0c394d7e648..6d8ea702321 100644
--- a/dep/ACE_wrappers/ace/Typed_SV_Message.inl
+++ b/dep/ACE_wrappers/ace/Typed_SV_Message.inl
@@ -1,9 +1,12 @@
// -*- C++ -*-
//
// $Id: Typed_SV_Message.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/config-all.h"
#include "ace/Global_Macros.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template <class T> ACE_INLINE
ACE_Typed_SV_Message<T>::ACE_Typed_SV_Message (long t,
int l,
@@ -14,6 +17,7 @@ ACE_Typed_SV_Message<T>::ACE_Typed_SV_Message (long t,
this->length (l);
this->max_size (m);
}
+
template <class T> ACE_INLINE
ACE_Typed_SV_Message<T>::ACE_Typed_SV_Message (const T &d,
long t,
@@ -26,57 +30,67 @@ ACE_Typed_SV_Message<T>::ACE_Typed_SV_Message (const T &d,
this->length (l);
this->max_size (m);
}
+
template <class T> ACE_INLINE
ACE_Typed_SV_Message<T>::~ACE_Typed_SV_Message (void)
{
ACE_TRACE ("ACE_Typed_SV_Message<T>::~ACE_Typed_SV_Message");
}
+
template <class T> ACE_INLINE long
ACE_Typed_SV_Message<T>::type (void) const
{
ACE_TRACE ("ACE_Typed_SV_Message<T>::type");
return this->type_;
}
+
template <class T> ACE_INLINE void
ACE_Typed_SV_Message<T>::type (long t)
{
ACE_TRACE ("ACE_Typed_SV_Message<T>::type");
this->type_ = t;
}
+
template <class T> ACE_INLINE int
ACE_Typed_SV_Message<T>::length (void) const
{
ACE_TRACE ("ACE_Typed_SV_Message<T>::length");
return this->length_;
}
+
template <class T> ACE_INLINE void
ACE_Typed_SV_Message<T>::length (int len)
{
ACE_TRACE ("ACE_Typed_SV_Message<T>::length");
this->length_ = len + (sizeof *this - (sizeof this->type_ + sizeof this->data_));
}
+
template <class T> ACE_INLINE int
ACE_Typed_SV_Message<T>::max_size (void) const
{
ACE_TRACE ("ACE_Typed_SV_Message<T>::max_size");
return this->max_;
}
+
template <class T> ACE_INLINE void
ACE_Typed_SV_Message<T>::max_size (int m)
{
ACE_TRACE ("ACE_Typed_SV_Message<T>::max_size");
this->max_ = m + (sizeof *this - (sizeof this->type_ + sizeof this->data_));
}
+
template <class T> T &
ACE_Typed_SV_Message<T>::data (void)
{
ACE_TRACE ("ACE_Typed_SV_Message<T>::data");
return this->data_;
}
+
template <class T> void
ACE_Typed_SV_Message<T>::data (const T &d)
{
ACE_TRACE ("ACE_Typed_SV_Message<T>::data");
this->data_ = d;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Typed_SV_Message_Queue.h b/dep/ACE_wrappers/ace/Typed_SV_Message_Queue.h
index d1c88b32931..f5f336b010d 100644
--- a/dep/ACE_wrappers/ace/Typed_SV_Message_Queue.h
+++ b/dep/ACE_wrappers/ace/Typed_SV_Message_Queue.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Typed_SV_Message_Queue.h
@@ -8,15 +9,21 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_TYPED_MESSAGE_QUEUE_H
#define ACE_TYPED_MESSAGE_QUEUE_H
#include /**/ "ace/pre.h"
+
#include "ace/SV_Message_Queue.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/Typed_SV_Message.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Typed_SV_Message_Queue
*
@@ -32,6 +39,7 @@ public:
ACE_OPEN = 0,
ACE_NOWAIT = IPC_NOWAIT
};
+
// = Initialization and termination operations.
ACE_Typed_SV_Message_Queue (void);
ACE_Typed_SV_Message_Queue (key_t external_id,
@@ -43,31 +51,43 @@ public:
int close (void);
int remove (void);
~ACE_Typed_SV_Message_Queue (void);
+
/// Send method.
int send (const ACE_Typed_SV_Message<T> &mb, int mflags = 0);
+
/// Recv method.
int recv (ACE_Typed_SV_Message<T> &mb, int mflags = 0);
+
/// Return the id of the underlying ACE_SV_Message_Queue.
int get_id (void) const;
+
/// Control the underlying message queue.
int control (int option, void *arg = 0);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
ACE_SV_Message_Queue message_queue_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Typed_SV_Message_Queue.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Typed_SV_Message_Queue.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Typed_SV_Message_Queue.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
#endif /* ACE_TYPED_MESSAGE_QUEUE_H */
diff --git a/dep/ACE_wrappers/ace/Typed_SV_Message_Queue.inl b/dep/ACE_wrappers/ace/Typed_SV_Message_Queue.inl
index 7115bb7fc20..90539936e62 100644
--- a/dep/ACE_wrappers/ace/Typed_SV_Message_Queue.inl
+++ b/dep/ACE_wrappers/ace/Typed_SV_Message_Queue.inl
@@ -1,8 +1,11 @@
// -*- C++ -*-
//
// $Id: Typed_SV_Message_Queue.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/SV_Message_Queue.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template <class T> ACE_INLINE int
ACE_Typed_SV_Message_Queue<T>::open (key_t external_id,
int create,
@@ -11,18 +14,22 @@ ACE_Typed_SV_Message_Queue<T>::open (key_t external_id,
ACE_TRACE ("ACE_Typed_SV_Message_Queue<T>::open");
return this->message_queue_.open (external_id, create, perms);
}
+
// What does it mean to close a message queue?!
+
template <class T> ACE_INLINE int
ACE_Typed_SV_Message_Queue<T>::close (void)
{
ACE_TRACE ("ACE_Typed_SV_Message_Queue<T>::close");
return 1;
}
+
template <class T> ACE_INLINE int
ACE_Typed_SV_Message_Queue<T>::recv (ACE_Typed_SV_Message<T> &mb,
int mflags)
{
ACE_TRACE ("ACE_Typed_SV_Message_Queue<T>::recv");
+
int length =
this->message_queue_.recv (reinterpret_cast<ACE_SV_Message &> (mb),
mb.max_size (),
@@ -30,8 +37,10 @@ ACE_Typed_SV_Message_Queue<T>::recv (ACE_Typed_SV_Message<T> &mb,
mflags);
if (length != -1)
mb.length (length);
+
return length;
}
+
template <class T> ACE_INLINE int
ACE_Typed_SV_Message_Queue<T>::send (const ACE_Typed_SV_Message<T> &mb,
int mflags)
@@ -44,22 +53,28 @@ ACE_Typed_SV_Message_Queue<T>::send (const ACE_Typed_SV_Message<T> &mb,
mb.length (),
mflags);
}
+
template <class T> ACE_INLINE int
ACE_Typed_SV_Message_Queue<T>::remove (void)
{
ACE_TRACE ("ACE_Typed_SV_Message_Queue<T>::remove");
+
return this->message_queue_.remove ();
}
+
template <class T> ACE_INLINE int
ACE_Typed_SV_Message_Queue<T>::control (int option,
void *arg)
{
ACE_TRACE ("ACE_Typed_SV_Message_Queue<T>::control");
+
return this->message_queue_.control (option, arg);
}
+
template <class T> ACE_INLINE int
ACE_Typed_SV_Message_Queue<T>::get_id (void) const
{
return this->message_queue_.get_id ();
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/UNIX_Addr.cpp b/dep/ACE_wrappers/ace/UNIX_Addr.cpp
index e342923833e..0f2a14d9c42 100644
--- a/dep/ACE_wrappers/ace/UNIX_Addr.cpp
+++ b/dep/ACE_wrappers/ace/UNIX_Addr.cpp
@@ -1,29 +1,41 @@
// $Id: UNIX_Addr.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/UNIX_Addr.h"
+
ACE_RCSID(ace, UNIX_Addr, "$Id: UNIX_Addr.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS)
+
#if !defined (__ACE_INLINE__)
#include "ace/UNIX_Addr.inl"
#endif /* __ACE_INLINE__ */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_UNIX_Addr)
+
// Set a pointer to the address.
void
ACE_UNIX_Addr::set_addr (void *addr, int len)
{
ACE_TRACE ("ACE_UNIX_Addr::set_addr");
+
this->ACE_Addr::base_set (AF_UNIX, len);
ACE_OS::memcpy ((void *) &this->unix_addr_,
(void *) addr,
len);
}
+
// Return a pointer to the underlying address.
+
void *
ACE_UNIX_Addr::get_addr (void) const
{
return (void *) &this->unix_addr_;
}
+
// Transform the string into the current addressing format.
+
int
ACE_UNIX_Addr::string_to_addr (const char addr[])
{
@@ -31,7 +43,9 @@ ACE_UNIX_Addr::string_to_addr (const char addr[])
sizeof this->unix_addr_.sun_path);
return 0;
}
+
// Transform the current address into string format.
+
int
ACE_UNIX_Addr::addr_to_string (ACE_TCHAR s[], size_t len) const
{
@@ -40,26 +54,32 @@ ACE_UNIX_Addr::addr_to_string (ACE_TCHAR s[], size_t len) const
len);
return 0;
}
+
u_long
ACE_UNIX_Addr::hash (void) const
{
return ACE::hash_pjw (this->unix_addr_.sun_path);
}
+
void
ACE_UNIX_Addr::dump (void) const
{
#if defined (ACE_HAS_DUMP)
#endif /* ACE_HAS_DUMP */
}
+
// Do nothing constructor.
+
ACE_UNIX_Addr::ACE_UNIX_Addr (void)
: ACE_Addr (AF_UNIX, sizeof this->unix_addr_)
{
(void) ACE_OS::memset ((void *) &this->unix_addr_,
0,
sizeof this->unix_addr_);
+
this->unix_addr_.sun_family = AF_UNIX;
}
+
int
ACE_UNIX_Addr::set (const ACE_UNIX_Addr &sa)
{
@@ -70,16 +90,21 @@ ACE_UNIX_Addr::set (const ACE_UNIX_Addr &sa)
else
ACE_OS::strcpy (this->unix_addr_.sun_path,
sa.unix_addr_.sun_path);
+
this->unix_addr_.sun_family = AF_UNIX;
this->base_set (sa.get_type (), sa.get_size ());
+
return 0;
}
+
// Copy constructor.
+
ACE_UNIX_Addr::ACE_UNIX_Addr (const ACE_UNIX_Addr &sa)
: ACE_Addr (AF_UNIX, sa.get_size ())
{
this->set (sa);
}
+
int
ACE_UNIX_Addr::set (const sockaddr_un *un, int len)
{
@@ -90,10 +115,12 @@ ACE_UNIX_Addr::set (const sockaddr_un *un, int len)
this->base_set (AF_UNIX, len);
return 0;
}
+
ACE_UNIX_Addr::ACE_UNIX_Addr (const sockaddr_un *un, int len)
{
this->set (un, len);
}
+
int
ACE_UNIX_Addr::set (const char rendezvous_point[])
{
@@ -104,17 +131,22 @@ ACE_UNIX_Addr::set (const char rendezvous_point[])
(void) ACE_OS::strsncpy (this->unix_addr_.sun_path,
rendezvous_point,
sizeof this->unix_addr_.sun_path);
+
this->ACE_Addr::base_set (AF_UNIX,
sizeof this->unix_addr_ -
sizeof (this->unix_addr_.sun_path) +
ACE_OS::strlen (this->unix_addr_.sun_path));
return 0;
}
+
// Create a ACE_Addr from a UNIX pathname.
+
ACE_UNIX_Addr::ACE_UNIX_Addr (const char rendezvous_point[])
{
this->set (rendezvous_point);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */
diff --git a/dep/ACE_wrappers/ace/UNIX_Addr.h b/dep/ACE_wrappers/ace/UNIX_Addr.h
index fca8745d4b4..6dd4130f251 100644
--- a/dep/ACE_wrappers/ace/UNIX_Addr.h
+++ b/dep/ACE_wrappers/ace/UNIX_Addr.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file UNIX_Addr.h
@@ -9,19 +10,27 @@
*/
//=============================================================================
+
#ifndef ACE_UNIX_ADDR_H
#define ACE_UNIX_ADDR_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS)
+
#include "ace/Addr.h"
#include "ace/Log_Msg.h"
#include "ace/ACE.h"
#include "ace/os_include/sys/os_un.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_UNIX_Addr
*
@@ -33,53 +42,77 @@ public:
// = Initialization methods.
/// Default constructor.
ACE_UNIX_Addr (void);
+
/// Copy constructor.
ACE_UNIX_Addr (const ACE_UNIX_Addr &sa);
+
/// Creates an ACE_UNIX_Addr from a string.
ACE_UNIX_Addr (const char rendezvous_point[]);
+
/// Creates an ACE_INET_Addr from a sockaddr_un structure.
ACE_UNIX_Addr (const sockaddr_un *, int len);
+
/// Creates an ACE_UNIX_Addr from another ACE_UNIX_Addr.
int set (const ACE_UNIX_Addr &sa);
+
/// Creates an ACE_UNIX_Addr from a string.
int set (const char rendezvous_point[]);
+
/// Creates an ACE_UNIX_Addr from a sockaddr_un structure.
int set (const sockaddr_un *, int len);
+
/// Return a pointer to the underlying network address.
virtual void *get_addr (void) const;
+
/// Set a pointer to the underlying network address.
virtual void set_addr (void *addr, int len);
+
/// Transform the current address into string format.
virtual int addr_to_string (ACE_TCHAR addr[], size_t) const;
+
/// Transform the string into the current addressing format.
virtual int string_to_addr (const char addr[]);
+
#if defined (ACE_HAS_WCHAR)
/// Creates an ACE_UNIX_Addr from a string.
ACE_UNIX_Addr (const wchar_t rendezvous_point[]);
+
/// Creates an ACE_UNIX_Addr from a string.
int set (const wchar_t rendezvous_point[]);
#endif /* ACE_HAS_WCHAR */
+
/// Compare two addresses for equality.
bool operator == (const ACE_UNIX_Addr &SAP) const;
+
/// Compare two addresses for inequality.
bool operator != (const ACE_UNIX_Addr &SAP) const;
+
/// Return the path name of the underlying rendezvous point.
const char *get_path_name (void) const;
+
/// Computes and returns hash value.
virtual u_long hash (void) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Underlying socket address.
sockaddr_un unix_addr_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/UNIX_Addr.inl"
#endif /* __ACE_INLINE__ */
+
#endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_UNIX_ADDR_H */
diff --git a/dep/ACE_wrappers/ace/UNIX_Addr.inl b/dep/ACE_wrappers/ace/UNIX_Addr.inl
index 513651fe1e4..5e801b56fea 100644
--- a/dep/ACE_wrappers/ace/UNIX_Addr.inl
+++ b/dep/ACE_wrappers/ace/UNIX_Addr.inl
@@ -2,10 +2,14 @@
//
// $Id: UNIX_Addr.inl 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/OS_NS_string.h"
+
#if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS)
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
#if defined (ACE_HAS_WCHAR)
/// Creates an ACE_UNIX_Addr from a string.
ACE_INLINE
@@ -13,6 +17,7 @@ ACE_UNIX_Addr::ACE_UNIX_Addr (const wchar_t rendezvous_point[])
{
this->set (ACE_Wide_To_Ascii (rendezvous_point).char_rep ());
}
+
/// Creates an ACE_UNIX_Addr from a string.
ACE_INLINE int
ACE_UNIX_Addr::set (const wchar_t rendezvous_point[])
@@ -20,7 +25,9 @@ ACE_UNIX_Addr::set (const wchar_t rendezvous_point[])
return this->set (ACE_Wide_To_Ascii (rendezvous_point).char_rep ());
}
#endif /* ACE_HAS_WCHAR */
+
// Compare two addresses for equality.
+
ACE_INLINE bool
ACE_UNIX_Addr::operator == (const ACE_UNIX_Addr &sap) const
{
@@ -28,17 +35,23 @@ ACE_UNIX_Addr::operator == (const ACE_UNIX_Addr &sap) const
sap.unix_addr_.sun_path,
sizeof this->unix_addr_.sun_path) == 0;
}
+
// Compare two addresses for inequality.
+
ACE_INLINE bool
ACE_UNIX_Addr::operator != (const ACE_UNIX_Addr &sap) const
{
return !((*this) == sap); // This is lazy, of course... ;-)
}
+
// Return the path name used for the rendezvous point.
+
ACE_INLINE const char *
ACE_UNIX_Addr::get_path_name (void) const
{
return this->unix_addr_.sun_path;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */
diff --git a/dep/ACE_wrappers/ace/UPIPE_Acceptor.cpp b/dep/ACE_wrappers/ace/UPIPE_Acceptor.cpp
index e83a675fdc4..97d90dfa570 100644
--- a/dep/ACE_wrappers/ace/UPIPE_Acceptor.cpp
+++ b/dep/ACE_wrappers/ace/UPIPE_Acceptor.cpp
@@ -1,13 +1,21 @@
// $Id: UPIPE_Acceptor.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/UPIPE_Acceptor.h"
+
ACE_RCSID(ace, UPIPE_Acceptor, "$Id: UPIPE_Acceptor.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if defined (ACE_HAS_THREADS)
+
#include "ace/OS_NS_unistd.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/UPIPE_Acceptor.inl"
#endif /* __ACE_INLINE__ */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_UPIPE_Acceptor)
+
void
ACE_UPIPE_Acceptor::dump (void) const
{
@@ -15,17 +23,22 @@ ACE_UPIPE_Acceptor::dump (void) const
ACE_TRACE ("ACE_UPIPE_Acceptor::dump");
#endif /* ACE_HAS_DUMP */
}
+
/* Do nothing routine for constructor. */
+
ACE_UPIPE_Acceptor::ACE_UPIPE_Acceptor (void)
: mb_ (sizeof (ACE_UPIPE_Stream *))
{
ACE_TRACE ("ACE_UPIPE_Acceptor::ACE_UPIPE_Acceptor");
}
+
ACE_UPIPE_Acceptor::~ACE_UPIPE_Acceptor (void)
{
ACE_TRACE ("ACE_UPIPE_Acceptor::~ACE_UPIPE_Acceptor");
}
+
// General purpose routine for performing server ACE_UPIPE.
+
int
ACE_UPIPE_Acceptor::open (const ACE_UPIPE_Addr &local_addr,
int reuse_addr)
@@ -33,23 +46,28 @@ ACE_UPIPE_Acceptor::open (const ACE_UPIPE_Addr &local_addr,
ACE_TRACE ("ACE_UPIPE_Acceptor::open");
return this->ACE_SPIPE_Acceptor::open (local_addr, reuse_addr);
}
+
int
ACE_UPIPE_Acceptor::close (void)
{
ACE_TRACE ("ACE_UPIPE_Acceptor::close");
return this->ACE_SPIPE_Acceptor::close ();
}
+
// General purpose routine for accepting new connections.
+
ACE_UPIPE_Acceptor::ACE_UPIPE_Acceptor (const ACE_UPIPE_Addr &local_addr,
int reuse_addr)
: mb_ (sizeof (ACE_UPIPE_Stream *))
{
ACE_TRACE ("ACE_UPIPE_Acceptor::ACE_UPIPE_Acceptor");
+
if (this->open (local_addr, reuse_addr) == -1)
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_UPIPE_Acceptor")));
}
+
int
ACE_UPIPE_Acceptor::accept (ACE_UPIPE_Stream &new_stream,
ACE_UPIPE_Addr *remote_addr,
@@ -59,22 +77,29 @@ ACE_UPIPE_Acceptor::accept (ACE_UPIPE_Stream &new_stream,
{
ACE_TRACE ("ACE_UPIPE_Acceptor::accept");
ACE_UNUSED_ARG (reset_new_handle);
+
ACE_SPIPE_Stream new_io;
+
if (this->ACE_SPIPE_Acceptor::accept (new_io, remote_addr,
timeout, restart) == -1)
return -1;
else
{
ACE_UPIPE_Stream *remote_stream = 0;
+
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, new_stream.lock_, -1));
+
new_stream.set_handle (new_io.get_handle ());
new_stream.reference_count_++;
+
// Transfer address ownership.
new_io.get_local_addr (new_stream.local_addr_);
new_io.get_remote_addr (new_stream.remote_addr_);
+
// Now that we got the handle, we'll read the address of the
// connector-side ACE_UPIPE_Stream out of the pipe and link that
// ACE_UPIPE_Stream to our ACE_UPIPE_Stream.
+
if (ACE_OS::read (new_stream.get_handle (),
(char *) &remote_stream,
sizeof remote_stream) == -1)
@@ -90,6 +115,7 @@ ACE_UPIPE_Acceptor::accept (ACE_UPIPE_Stream &new_stream,
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("ACE_UPIPE_Acceptor: %p\n"),
ACE_TEXT ("linked stream.put failed")));
+
// Close down the new_stream at this point in order to conserve
// handles. Note that we don't need the SPIPE connection
// anymore since we're now linked via the <Message_Queue>.
@@ -97,6 +123,8 @@ ACE_UPIPE_Acceptor::accept (ACE_UPIPE_Stream &new_stream,
return 0;
}
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_THREADS */
diff --git a/dep/ACE_wrappers/ace/UPIPE_Acceptor.h b/dep/ACE_wrappers/ace/UPIPE_Acceptor.h
index 0f419f04130..c23acd0fca0 100644
--- a/dep/ACE_wrappers/ace/UPIPE_Acceptor.h
+++ b/dep/ACE_wrappers/ace/UPIPE_Acceptor.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file UPIPE_Acceptor.h
@@ -10,17 +11,24 @@
*/
//=============================================================================
+
#ifndef ACE_UPIPE_ACCEPTOR_H
#define ACE_UPIPE_ACCEPTOR_H
#include /**/ "ace/pre.h"
+
#include "ace/UPIPE_Stream.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_THREADS)
+
#include "ace/SPIPE_Acceptor.h"
#include "ace/Thread_Manager.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_UPIPE_Acceptor
*
@@ -33,19 +41,25 @@ public:
// = Initialization and termination.
/// Default constructor.
ACE_UPIPE_Acceptor (void);
+
/// Initialize passive endpoint.
ACE_UPIPE_Acceptor (const ACE_UPIPE_Addr &local_sap,
int reuse_addr = 0);
+
/// Initialize passive endpoint.
int open (const ACE_UPIPE_Addr &local_sap,
int reuse_addr = 0);
+
/// Close down and release resources.
~ACE_UPIPE_Acceptor (void);
+
/// Close down and release resources.
int close (void);
+
/// Close down and release resources and remove the underlying SPIPE
/// rendezvous point.
int remove (void);
+
// = Passive connection acceptance method.
/**
* Accept a new data transfer connection. A @a timeout of 0 means
@@ -57,21 +71,30 @@ public:
ACE_Time_Value *timeout = 0,
int restart = 1,
int reset_new_handle = 0);
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Manage threads.
ACE_Thread_Manager tm;
+
/// To confirm connection establishment.
ACE_Message_Block mb_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/UPIPE_Acceptor.inl"
#endif /* __ACE_INLINE__ */
+
#endif /* ACE_HAS_THREADS */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_UPIPE_ACCEPTOR_H */
diff --git a/dep/ACE_wrappers/ace/UPIPE_Acceptor.inl b/dep/ACE_wrappers/ace/UPIPE_Acceptor.inl
index 963d247e245..9432ad7bb88 100644
--- a/dep/ACE_wrappers/ace/UPIPE_Acceptor.inl
+++ b/dep/ACE_wrappers/ace/UPIPE_Acceptor.inl
@@ -1,11 +1,14 @@
// -*- C++ -*-
//
// $Id: UPIPE_Acceptor.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE int
ACE_UPIPE_Acceptor::remove (void)
{
ACE_TRACE ("ACE_UPIPE_Acceptor::remove");
return this->ACE_SPIPE_Acceptor::remove ();
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/UPIPE_Addr.h b/dep/ACE_wrappers/ace/UPIPE_Addr.h
index 3b881f67abf..755e10ebefe 100644
--- a/dep/ACE_wrappers/ace/UPIPE_Addr.h
+++ b/dep/ACE_wrappers/ace/UPIPE_Addr.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file UPIPE_Addr.h
@@ -9,16 +10,25 @@
*/
//=============================================================================
+
#ifndef ACE_UPIPE_ADDR_H
#define ACE_UPIPE_ADDR_H
+
#include /**/ "ace/pre.h"
+
#include "ace/SPIPE_Addr.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
typedef ACE_SPIPE_Addr ACE_UPIPE_Addr;
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#include /**/ "ace/post.h"
+
#endif /* ACE_UPIPE_ADDR_H */
diff --git a/dep/ACE_wrappers/ace/UPIPE_Connector.cpp b/dep/ACE_wrappers/ace/UPIPE_Connector.cpp
index ad1947411cc..863dde91fc1 100644
--- a/dep/ACE_wrappers/ace/UPIPE_Connector.cpp
+++ b/dep/ACE_wrappers/ace/UPIPE_Connector.cpp
@@ -1,15 +1,23 @@
// $Id: UPIPE_Connector.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/UPIPE_Connector.h"
+
ACE_RCSID(ace, UPIPE_Connector, "$Id: UPIPE_Connector.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if defined (ACE_HAS_THREADS)
+
#include "ace/Handle_Ops.h"
#include "ace/OS_NS_unistd.h"
#include "ace/OS_NS_stropts.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/UPIPE_Connector.inl"
#endif /* __ACE_INLINE__ */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_UPIPE_Connector)
+
void
ACE_UPIPE_Connector::dump (void) const
{
@@ -17,10 +25,12 @@ ACE_UPIPE_Connector::dump (void) const
ACE_TRACE ("ACE_UPIPE_Connector::dump");
#endif /* ACE_HAS_DUMP */
}
+
ACE_UPIPE_Connector::ACE_UPIPE_Connector (void)
{
ACE_TRACE ("ACE_UPIPE_Connector::ACE_UPIPE_Connector");
}
+
int
ACE_UPIPE_Connector::connect (ACE_UPIPE_Stream &new_stream,
const ACE_UPIPE_Addr &addr,
@@ -32,9 +42,11 @@ ACE_UPIPE_Connector::connect (ACE_UPIPE_Stream &new_stream,
{
ACE_TRACE ("ACE_UPIPE_Connector::connect");
ACE_ASSERT (new_stream.get_handle () == ACE_INVALID_HANDLE);
+
ACE_HANDLE handle = ACE::handle_timed_open (timeout,
addr.get_path_name (),
flags, perms);
+
if (handle == ACE_INVALID_HANDLE)
return -1;
#if !defined (ACE_WIN32)
@@ -44,10 +56,13 @@ ACE_UPIPE_Connector::connect (ACE_UPIPE_Stream &new_stream,
else // We're connected!
{
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, new_stream.lock_, -1));
+
ACE_UPIPE_Stream *ustream = &new_stream;
+
new_stream.set_handle (handle);
new_stream.remote_addr_ = addr; // class copy.
new_stream.reference_count_++;
+
// Now send the address of our ACE_UPIPE_Stream over this pipe
// to our corresponding ACE_UPIPE_Acceptor, so he may link the
// two streams.
@@ -58,10 +73,13 @@ ACE_UPIPE_Connector::connect (ACE_UPIPE_Stream &new_stream,
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("ACE_UPIPE_Connector %p\n"),
ACE_TEXT ("write to pipe failed")));
+
// Wait for confirmation of stream linking.
ACE_Message_Block *mb_p = 0;
+
// Our part is done, wait for server to confirm connection.
result = new_stream.recv (mb_p, 0);
+
// Do *not* coalesce the following two checks for result == -1.
// They perform different checks and cannot be merged.
if (result == -1)
@@ -77,6 +95,8 @@ ACE_UPIPE_Connector::connect (ACE_UPIPE_Stream &new_stream,
return static_cast<int> (result);
}
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_THREADS */
diff --git a/dep/ACE_wrappers/ace/UPIPE_Connector.h b/dep/ACE_wrappers/ace/UPIPE_Connector.h
index e31cb37889f..328587f36a0 100644
--- a/dep/ACE_wrappers/ace/UPIPE_Connector.h
+++ b/dep/ACE_wrappers/ace/UPIPE_Connector.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file UPIPE_Connector.h
@@ -9,15 +10,21 @@
*/
//=============================================================================
+
#ifndef ACE_UPIPE_CONNECTOR_H
#define ACE_UPIPE_CONNECTOR_H
#include /**/ "ace/pre.h"
+
#include "ace/UPIPE_Stream.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_THREADS)
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_UPIPE_Connector
*
@@ -30,6 +37,7 @@ public:
// = Initialization methods.
/// Default constructor.
ACE_UPIPE_Connector (void);
+
/**
* Actively connect and produce a @a new_stream if things go well.
* The @a addr is the address that we are trying to connect
@@ -54,6 +62,7 @@ public:
int reuse_addr = 0,
int flags = O_RDWR,
int perms = 0);
+
/**
* Actively connect and produce a @a new_stream if things go well.
* The @a addr is the address that we are trying to connect
@@ -78,21 +87,30 @@ public:
int reuse_addr = 0,
int flags = O_RDWR,
int perms = 0);
+
/// Resets any event associations on this handle
int reset_new_handle (ACE_HANDLE handle);
+
// = Meta-type info
typedef ACE_UPIPE_Addr PEER_ADDR;
typedef ACE_UPIPE_Stream PEER_STREAM;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/UPIPE_Connector.inl"
#endif /* __ACE_INLINE__ */
+
#endif /* ACE_HAS_THREADS */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_UPIPE_CONNECTOR_H */
diff --git a/dep/ACE_wrappers/ace/UPIPE_Connector.inl b/dep/ACE_wrappers/ace/UPIPE_Connector.inl
index 01635c127a5..fa43dbea326 100644
--- a/dep/ACE_wrappers/ace/UPIPE_Connector.inl
+++ b/dep/ACE_wrappers/ace/UPIPE_Connector.inl
@@ -1,7 +1,9 @@
// -*- C++ -*-
//
// $Id: UPIPE_Connector.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Creates a Local ACE_UPIPE.
ACE_INLINE
ACE_UPIPE_Connector::ACE_UPIPE_Connector (ACE_UPIPE_Stream &new_stream,
@@ -21,10 +23,12 @@ ACE_UPIPE_Connector::ACE_UPIPE_Connector (ACE_UPIPE_Stream &new_stream,
addr.get_path_name (),
ACE_TEXT ("ACE_UPIPE_Connector")));
}
+
ACE_INLINE int
ACE_UPIPE_Connector::reset_new_handle (ACE_HANDLE /* handle */)
{
// Nothing to do here since the handle is not a socket
return 0;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/UPIPE_Stream.cpp b/dep/ACE_wrappers/ace/UPIPE_Stream.cpp
index ba477e4f312..66c537f9d5d 100644
--- a/dep/ACE_wrappers/ace/UPIPE_Stream.cpp
+++ b/dep/ACE_wrappers/ace/UPIPE_Stream.cpp
@@ -1,19 +1,28 @@
// $Id: UPIPE_Stream.cpp 82559 2008-08-07 20:23:07Z parsons $
+
#include "ace/UPIPE_Stream.h"
+
ACE_RCSID(ace, UPIPE_Stream, "$Id: UPIPE_Stream.cpp 82559 2008-08-07 20:23:07Z parsons $")
+
#if defined (ACE_HAS_THREADS)
+
#include "ace/OS_NS_string.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/UPIPE_Stream.inl"
#endif /* __ACE_INLINE__ */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_UPIPE_Stream)
+
ACE_UPIPE_Stream::ACE_UPIPE_Stream (void)
: mb_last_ (0),
reference_count_ (0)
{
ACE_TRACE ("ACE_UPIPE_Stream::ACE_UPIPE_STREAM");
}
+
ACE_UPIPE_Stream::~ACE_UPIPE_Stream (void)
{
if (this->mb_last_ != 0)
@@ -22,14 +31,17 @@ ACE_UPIPE_Stream::~ACE_UPIPE_Stream (void)
this->mb_last_ = 0;
}
}
+
int
ACE_UPIPE_Stream::control (int cmd,
void * val) const
{
ACE_TRACE ("ACE_UPIPE_Stream::control");
+
return ((ACE_UPIPE_Stream *) this)->stream_.control
((ACE_IO_Cntl_Msg::ACE_IO_Cntl_Cmds) cmd, val);
}
+
void
ACE_UPIPE_Stream::dump (void) const
{
@@ -37,23 +49,29 @@ ACE_UPIPE_Stream::dump (void) const
ACE_TRACE ("ACE_UPIPE_Stream::dump");
#endif /* ACE_HAS_DUMP */
}
+
int
ACE_UPIPE_Stream::close (void)
{
ACE_TRACE ("ACE_UPIPE_Stream::close");
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1));
+
this->reference_count_--;
+
if (this->reference_count_ == 0)
{
// Since the UPIPE should have been closed earlier we won't bother
// checking to see if closing it now fails.
+
if (this->ACE_SPIPE::get_handle () != ACE_INVALID_HANDLE)
this->ACE_SPIPE::close ();
+
// Close down the ACE_stream.
return this->stream_.close ();
}
return 0;
}
+
int
ACE_UPIPE_Stream::get_remote_addr (ACE_UPIPE_Addr &remote_sap) const
{
@@ -61,6 +79,7 @@ ACE_UPIPE_Stream::get_remote_addr (ACE_UPIPE_Addr &remote_sap) const
remote_sap = this->remote_addr_;
return 0;
}
+
int
ACE_UPIPE_Stream::send (ACE_Message_Block *mb_p,
ACE_Time_Value *timeout)
@@ -68,18 +87,22 @@ ACE_UPIPE_Stream::send (ACE_Message_Block *mb_p,
ACE_TRACE ("ACE_UPIPE_Stream::send_msg");
return this->stream_.put (mb_p, timeout) == -1 ? -1 : 0;
}
+
int ACE_UPIPE_Stream::recv (ACE_Message_Block *& mb_p,
ACE_Time_Value *timeout)
{
return this->stream_.get (mb_p, timeout) == -1 ? -1 : 0;
}
+
// Send a buffer.
+
ssize_t
ACE_UPIPE_Stream::send (const char *buffer,
size_t n,
ACE_Time_Value *timeout)
{
ACE_TRACE ("ACE_UPIPE_Stream::send");
+
ACE_Message_Block *mb_p;
ACE_NEW_RETURN (mb_p,
ACE_Message_Block (n),
@@ -90,7 +113,9 @@ ACE_UPIPE_Stream::send (const char *buffer,
? -1
: static_cast<ssize_t> (n);
}
+
// Receive a buffer.
+
ssize_t
ACE_UPIPE_Stream::recv (char *buffer,
size_t n,
@@ -99,6 +124,7 @@ ACE_UPIPE_Stream::recv (char *buffer,
ACE_TRACE ("ACE_UPIPE_Stream::recv");
// Index in buffer.
size_t bytes_read = 0;
+
while (bytes_read < n)
if (this->mb_last_ != 0)
{
@@ -107,6 +133,7 @@ ACE_UPIPE_Stream::recv (char *buffer,
if (this_len < n)
{
// The remaining data is not enough.
+
ACE_OS::memcpy ((void *) &buffer[bytes_read],
this->mb_last_->rd_ptr (),
this_len);
@@ -122,8 +149,10 @@ ACE_UPIPE_Stream::recv (char *buffer,
this->mb_last_->rd_ptr (),
n);
bytes_read += n;
+
// Advance rd_ptr.
this->mb_last_->rd_ptr (n);
+
if (this->mb_last_->length () == 0)
// Now the Message_Buffer is empty.
this->mb_last_ = this->mb_last_->release ();
@@ -133,6 +162,7 @@ ACE_UPIPE_Stream::recv (char *buffer,
{
// We have to get a new Message_Buffer from our stream.
int result = this->stream_.get (this->mb_last_, timeout);
+
if (result == -1)
{
if (errno == EWOULDBLOCK && bytes_read > 0)
@@ -142,28 +172,35 @@ ACE_UPIPE_Stream::recv (char *buffer,
return -1;
}
}
+
return static_cast<ssize_t> (bytes_read);
}
+
ssize_t
ACE_UPIPE_Stream::send_n (const char *buf,
size_t n,
ACE_Time_Value *timeout)
{
ACE_TRACE ("ACE_UPIPE_Stream::send_n");
+
size_t bytes_written;
ssize_t len = 0;
+
for (bytes_written = 0; bytes_written < n; bytes_written += len)
{
len = this->send (buf + bytes_written,
n - bytes_written,
timeout);
+
if (len == -1)
{
return -1;
}
}
+
return static_cast<ssize_t> (bytes_written);
}
+
ssize_t
ACE_UPIPE_Stream::recv_n (char *buf,
size_t n,
@@ -172,11 +209,13 @@ ACE_UPIPE_Stream::recv_n (char *buf,
ACE_TRACE ("ACE_UPIPE_Stream::recv_n");
size_t bytes_read;
ssize_t len = 0;
+
for (bytes_read = 0; bytes_read < n; bytes_read += len)
{
len = this->recv (buf + bytes_read,
n - bytes_read,
timeout);
+
if (len == -1)
{
return -1;
@@ -186,8 +225,11 @@ ACE_UPIPE_Stream::recv_n (char *buf,
break;
}
}
+
return static_cast< ssize_t> (bytes_read);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_THREADS */
diff --git a/dep/ACE_wrappers/ace/UPIPE_Stream.h b/dep/ACE_wrappers/ace/UPIPE_Stream.h
index 74402350135..2cf53b1e274 100644
--- a/dep/ACE_wrappers/ace/UPIPE_Stream.h
+++ b/dep/ACE_wrappers/ace/UPIPE_Stream.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file UPIPE_Stream.h
@@ -10,18 +11,25 @@
*/
//=============================================================================
+
#ifndef ACE_UPIPE_STREAM_H
#define ACE_UPIPE_STREAM_H
#include /**/ "ace/pre.h"
+
#include "ace/Stream.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_THREADS)
+
#include "ace/SPIPE.h"
#include "ace/Message_Queue.h"
#include "ace/UPIPE_Addr.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_UPIPE_Stream
*
@@ -32,75 +40,102 @@ class ACE_Export ACE_UPIPE_Stream : public ACE_SPIPE
public:
friend class ACE_UPIPE_Acceptor;
friend class ACE_UPIPE_Connector;
+
typedef ACE_Stream<ACE_SYNCH> MT_Stream;
+
// = Initialization and Termination.
+
ACE_UPIPE_Stream (void);
+
virtual ~ACE_UPIPE_Stream (void);
+
/// Shut down the UPIPE and release resources.
int close (void);
+
/// Return the underlying I/O handle.
ACE_HANDLE get_handle (void) const;
+
// = Send/recv ACE Message_Blocks.
/// Send a message through the message queue. Returns -1 on error,
/// else 0.
int send (ACE_Message_Block *mb_p,
ACE_Time_Value *timeout = 0);
+
/// Recv a message from the message queue. Returns -1 on error, else
/// 0.
int recv (ACE_Message_Block *&mb_p,
ACE_Time_Value *timeout = 0);
+
// = Send/recv char buffers.
/// Send a buffer of @a n bytes through the message queue. Returns -1
/// on error, else number of bytes sent.
ssize_t send (const char *buffer,
size_t n,
ACE_Time_Value *timeout = 0);
+
/// Recv a buffer of upto @a n bytes from the message queue. Returns
/// -1 on error, else number of bytes read.
ssize_t recv (char *buffer,
size_t n,
ACE_Time_Value *timeout = 0);
+
/// Send a buffer of exactly @a n bytes to the message queue. Returns
/// -1 on error, else number of bytes written (which should == n).
ssize_t send_n (const char *buffer,
size_t n,
ACE_Time_Value *timeout = 0);
+
/// Recv a buffer of exactly @a n bytes from the message queue.
/// Returns -1 on error, else the number of bytes read.
ssize_t recv_n (char *buffer,
size_t n,
ACE_Time_Value *timeout = 0);
+
/// Perform control operations on the UPIPE_Stream.
int control (int cmd, void *val) const;
+
/// Return the remote address we are connected to.
int get_remote_addr (ACE_UPIPE_Addr &remote_sap) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
// = Meta-type info
typedef ACE_UPIPE_Addr PEER_ADDR;
+
private:
/// To hold the last ACE_Message_Block read out of the stream. Thus
/// allowing subsequent reads from one ACE_Message_Block
ACE_Message_Block *mb_last_;
+
/// Address of who we are connected to.
ACE_UPIPE_Addr remote_addr_;
+
/// Stream component used by the @c UPIPE_Acceptor and
/// @c UPIPE_Connector to link together two UPIPE_Streams.
MT_Stream stream_;
+
/// Keep track of whether the sender and receiver have both shutdown.
int reference_count_;
+
#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
/// Ensure that we are thread-safe.
ACE_Thread_Mutex lock_;
#endif /* ACE_MT_SAFE */
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/UPIPE_Stream.inl"
#endif /* __ACE_INLINE__ */
+
#endif /* ACE_HAS_THREADS */
+
#include /**/ "ace/post.h"
+
#endif /*ACE_UPIPE_STREAM_H */
diff --git a/dep/ACE_wrappers/ace/UPIPE_Stream.inl b/dep/ACE_wrappers/ace/UPIPE_Stream.inl
index 72156d465ce..7a0d73c3179 100644
--- a/dep/ACE_wrappers/ace/UPIPE_Stream.inl
+++ b/dep/ACE_wrappers/ace/UPIPE_Stream.inl
@@ -1,11 +1,14 @@
// -*- C++ -*-
//
// $Id: UPIPE_Stream.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE ACE_HANDLE
ACE_UPIPE_Stream::get_handle (void) const
{
ACE_TRACE ("ACE_UPIPE_Stream::get_handle");
return this->ACE_SPIPE::get_handle ();
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/UTF16_Encoding_Converter.cpp b/dep/ACE_wrappers/ace/UTF16_Encoding_Converter.cpp
index c0eb127db9c..6c660a37c4b 100644
--- a/dep/ACE_wrappers/ace/UTF16_Encoding_Converter.cpp
+++ b/dep/ACE_wrappers/ace/UTF16_Encoding_Converter.cpp
@@ -1,4 +1,5 @@
// $Id: UTF16_Encoding_Converter.cpp 80826 2008-03-04 14:51:23Z wotte $
+
// ======================================================================
//
// The actual conversion methods are covered by the copyright information
@@ -17,18 +18,24 @@
// remains attached.
//
// ======================================================================
+
#include "ace/UTF16_Encoding_Converter.h"
+
#if defined (ACE_USES_WCHAR)
#include "ace/OS_NS_stdio.h"
#include "ace/OS_Memory.h"
#include "ace/Min_Max.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/UTF16_Encoding_Converter.inl"
#endif /* __ACE_INLINE__ */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
static const ACE_UINT32 halfShift = 10;
static const ACE_UINT32 halfBase = 0x00010000;
static const ACE_UINT32 halfMask = 0x000003FF;
+
static const ACE_UINT32 UNI_SUR_HIGH_START = 0x0000D800;
static const ACE_UINT32 UNI_SUR_HIGH_END = 0x0000DBFF;
static const ACE_UINT32 UNI_SUR_LOW_START = 0x0000DC00;
@@ -36,6 +43,7 @@ static const ACE_UINT32 UNI_SUR_LOW_END = 0x0000DFFF;
static const ACE_UINT32 UNI_REPLACEMENT_CHAR = 0x0000FFFD;
static const ACE_UINT32 UNI_MAX_BMP = 0x0000FFFF;
static const ACE_UINT32 UNI_MAX_UTF16 = 0x0010FFFF;
+
// Once the bits are split out into bytes of UTF-8, this is a mask OR-ed
// into the first byte, depending on how many bytes follow. There are
// as many entries in this table as there are UTF-8 sequence types.
@@ -43,6 +51,7 @@ static const ACE_UINT32 UNI_MAX_UTF16 = 0x0010FFFF;
// for *legal* UTF-8 will be 4 or fewer bytes total.
static const ACE_Byte firstByteMark[7] = { 0x00, 0x00, 0xC0,
0xE0, 0xF0, 0xF8, 0xFC };
+
// Index into the table below with the first byte of a UTF-8 sequence to
// get the number of trailing bytes that are supposed to follow it.
// Note that *legal* UTF-8 values can't have 4 or 5-bytes. The table is
@@ -58,6 +67,7 @@ static const ACE_Byte trailingBytesForUTF8[256] = {
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5
};
+
// Magic values subtracted from a buffer value during UTF8 conversion.
// This table contains as many values as there might be trailing bytes
// in a UTF-8 sequence.
@@ -65,13 +75,16 @@ static const ACE_UINT32 offsetsFromUTF8[6] = { 0x00000000, 0x00003080,
0x000E2080, 0x03C82080,
0xFA082080, 0x82082080 };
+
ACE_UTF16_Encoding_Converter::ACE_UTF16_Encoding_Converter (bool swap)
: swap_ (swap)
{
}
+
ACE_UTF16_Encoding_Converter::~ACE_UTF16_Encoding_Converter (void)
{
}
+
ACE_UTF16_Encoding_Converter::Result
ACE_UTF16_Encoding_Converter::to_utf8 (const void* source,
size_t source_size,
@@ -82,14 +95,17 @@ ACE_UTF16_Encoding_Converter::to_utf8 (const void* source,
static const ACE_UINT32 byteMask = 0xBF;
static const ACE_UINT32 byteMark = 0x80;
Result result = CONVERSION_OK;
+
ACE_Byte* targetEnd = target + target_size;
const ACE_UINT16* sourceStart = static_cast<const ACE_UINT16*> (source);
const ACE_UINT16* sourceEnd = sourceStart +
(source_size / sizeof (ACE_UINT16));
+
while (sourceStart < sourceEnd)
{
ACE_UINT16 nw = *sourceStart++;
ACE_UINT32 ch = (this->swap_ ? ACE_SWAP_WORD (nw) : nw);
+
// If we have a surrogate pair, convert to ACE_UINT32 first.
if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_HIGH_END)
{
@@ -129,6 +145,7 @@ ACE_UTF16_Encoding_Converter::to_utf8 (const void* source,
break;
}
}
+
// Figure out how many bytes the result will require
unsigned short bytesToWrite = 0;
if (ch < 0x80)
@@ -144,12 +161,14 @@ ACE_UTF16_Encoding_Converter::to_utf8 (const void* source,
bytesToWrite = 3;
ch = UNI_REPLACEMENT_CHAR;
}
+
target += bytesToWrite;
if (target > targetEnd)
{
result = TARGET_EXHAUSTED;
break;
}
+
// NOTE: Everything falls through for efficiency purposes.
switch (bytesToWrite)
{
@@ -167,8 +186,10 @@ ACE_UTF16_Encoding_Converter::to_utf8 (const void* source,
}
target += bytesToWrite;
}
+
return result;
}
+
ACE_UTF16_Encoding_Converter::Result
ACE_UTF16_Encoding_Converter::from_utf8 (const ACE_Byte* source,
size_t source_size,
@@ -180,6 +201,7 @@ ACE_UTF16_Encoding_Converter::from_utf8 (const ACE_Byte* source,
const ACE_Byte* sourceEnd = source + source_size;
ACE_UINT16* targetStart = static_cast<ACE_UINT16*> (target);
ACE_UINT16* targetEnd = targetStart + target_size;
+
while (source < sourceEnd)
{
ACE_UINT32 ch = 0;
@@ -189,12 +211,14 @@ ACE_UTF16_Encoding_Converter::from_utf8 (const ACE_Byte* source,
result = SOURCE_EXHAUSTED;
break;
}
+
// Do this check whether lenient or strict
if (!this->is_legal_utf8 (source, extraBytesToRead + 1))
{
result = SOURCE_ILLEGAL;
break;
}
+
// The cases all fall through. See "Note A" below.
switch (extraBytesToRead)
{
@@ -217,11 +241,13 @@ ACE_UTF16_Encoding_Converter::from_utf8 (const ACE_Byte* source,
ch += *source++;
}
ch -= offsetsFromUTF8[extraBytesToRead];
+
if (targetStart >= targetEnd)
{
result = TARGET_EXHAUSTED;
break;
}
+
if (ch <= UNI_MAX_BMP) // Target is a character <= 0xFFFF
{
// UTF-16 surrogate values are illegal in UTF-32
@@ -267,14 +293,17 @@ ACE_UTF16_Encoding_Converter::from_utf8 (const ACE_Byte* source,
*targetStart++ = (ACE_UINT16)((ch & halfMask) + UNI_SUR_LOW_START);
}
}
+
return result;
}
+
ACE_UTF16_Encoding_Converter*
ACE_UTF16_Encoding_Converter::encoded (const ACE_Byte* source,
size_t source_size)
{
static const size_t begin = 16;
static const size_t converted = begin * 4;
+
ACE_Byte target[converted];
ACE_UTF16_Encoding_Converter* converter;
ACE_NEW_RETURN (converter,
@@ -291,38 +320,46 @@ ACE_UTF16_Encoding_Converter::encoded (const ACE_Byte* source,
{
delete converter;
}
+
return 0;
}
+
ACE_UINT32
ACE_UTF16_Encoding_Converter::get_UNI_SUR_HIGH_START (void)
{
return UNI_SUR_HIGH_START;
}
+
ACE_UINT32
ACE_UTF16_Encoding_Converter::get_UNI_SUR_LOW_END (void)
{
return UNI_SUR_LOW_END;
}
+
ACE_UINT32
ACE_UTF16_Encoding_Converter::get_UNI_REPLACEMENT_CHAR (void)
{
return UNI_REPLACEMENT_CHAR;
}
+
const ACE_Byte*
ACE_UTF16_Encoding_Converter::get_first_byte_mark (void)
{
return firstByteMark;
}
+
const ACE_Byte*
ACE_UTF16_Encoding_Converter::get_trailing_bytes_for_utf8 (void)
{
return trailingBytesForUTF8;
}
+
const ACE_UINT32*
ACE_UTF16_Encoding_Converter::get_offsets_from_utf8 (void)
{
return offsetsFromUTF8;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
#endif /* ACE_USES_WCHAR */
diff --git a/dep/ACE_wrappers/ace/UTF16_Encoding_Converter.h b/dep/ACE_wrappers/ace/UTF16_Encoding_Converter.h
index 14b7fff3e46..231ce158dfa 100644
--- a/dep/ACE_wrappers/ace/UTF16_Encoding_Converter.h
+++ b/dep/ACE_wrappers/ace/UTF16_Encoding_Converter.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=========================================================================
/**
* @file UTF16_Encoding_Converter.h
@@ -11,12 +12,17 @@
* @author Chad Elliott <elliott_c@ociweb.com>
*/
//=========================================================================
+
#ifndef ACE_UTF16_ENCODING_CONVERTER_H
#define ACE_UTF16_ENCODING_CONVERTER_H
+
#include /**/ "ace/pre.h"
+
#include "ace/Encoding_Converter.h"
+
#if defined (ACE_USES_WCHAR)
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/** Convert from UTF-16 to UTF-8 and from UTF-8 to UTF-16.
* This class implements the ACE_Encoding_Converter interface.
*/
@@ -26,8 +32,10 @@ public:
/// The swap parameter determines whether we need to swap byte order on
/// the stream as each word is pulled off when converting to UTF-8.
ACE_UTF16_Encoding_Converter (bool swap = false);
+
/// This is a do nothing destructor.
virtual ~ACE_UTF16_Encoding_Converter (void);
+
/// Convert the source from UTF-16 to UTF-8 and store it in the
/// provided target buffer.
virtual Result to_utf8 (const void* source,
@@ -35,6 +43,7 @@ public:
ACE_Byte* target,
size_t target_size,
bool strict = true);
+
/// Convert the UTF-8 source into a UTF-16 encoding and store it
/// in the provided target buffer.
virtual Result from_utf8 (const ACE_Byte* source,
@@ -42,28 +51,37 @@ public:
void* target,
size_t target_size,
bool strict = true);
+
/// This factory helper method determines if the source stream is UTF-16
/// encoded. If it is, allocate an ACE_UTF16_Encoding_Converter and
/// return it. The caller then owns the allocated object.
static ACE_UTF16_Encoding_Converter* encoded (const ACE_Byte* source,
size_t source_size);
+
protected:
/// Determines if the source buffer is legal UTF-8
bool is_legal_utf8 (const ACE_Byte* source,
size_t length) const;
+
static ACE_UINT32 get_UNI_SUR_HIGH_START (void);
static ACE_UINT32 get_UNI_SUR_LOW_END (void);
static ACE_UINT32 get_UNI_REPLACEMENT_CHAR (void);
static const ACE_Byte* get_first_byte_mark (void);
static const ACE_Byte* get_trailing_bytes_for_utf8 (void);
static const ACE_UINT32* get_offsets_from_utf8 (void);
+
bool swap_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/UTF16_Encoding_Converter.inl"
#endif /* __ACE_INLINE__ */
+
#endif /* ACE_USES_WCHAR */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_UTF16_ENCODING_CONVERTER_H */
diff --git a/dep/ACE_wrappers/ace/UTF16_Encoding_Converter.inl b/dep/ACE_wrappers/ace/UTF16_Encoding_Converter.inl
index eb47e459646..e5292757889 100644
--- a/dep/ACE_wrappers/ace/UTF16_Encoding_Converter.inl
+++ b/dep/ACE_wrappers/ace/UTF16_Encoding_Converter.inl
@@ -1,5 +1,6 @@
/* -*- C++ -*- */
// $Id: UTF16_Encoding_Converter.inl 80826 2008-03-04 14:51:23Z wotte $
+
// ======================================================================
//
// The actual conversion methods are covered by the copyright information
@@ -17,21 +18,26 @@
// remains attached.
//
// ======================================================================
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE bool
ACE_UTF16_Encoding_Converter::is_legal_utf8 (const ACE_Byte* source,
size_t length) const
{
ACE_Byte a;
const ACE_Byte* srcptr = source + length;
+
switch (length)
{
default:
return false;
+
// Everything else falls through when "true"...
case 4: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false;
case 3: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false;
case 2: if ((a = (*--srcptr)) > 0xBF) return false;
+
switch (*source)
{
// no fall-through in this inner switch
@@ -55,12 +61,16 @@ ACE_UTF16_Encoding_Converter::is_legal_utf8 (const ACE_Byte* source,
if (a < 0x80)
return false;
}
+
case 1:
if (*source >= 0x80 && *source < 0xC2)
return false;
}
+
if (*source > 0xF4)
return false;
+
return true;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/UTF32_Encoding_Converter.cpp b/dep/ACE_wrappers/ace/UTF32_Encoding_Converter.cpp
index 66d13634216..325eded7428 100644
--- a/dep/ACE_wrappers/ace/UTF32_Encoding_Converter.cpp
+++ b/dep/ACE_wrappers/ace/UTF32_Encoding_Converter.cpp
@@ -1,4 +1,5 @@
// $Id: UTF32_Encoding_Converter.cpp 80826 2008-03-04 14:51:23Z wotte $
+
// ======================================================================
//
// The actual conversion methods are covered by the copyright information
@@ -18,20 +19,27 @@
// remains attached.
//
// ======================================================================
+
#include "ace/UTF32_Encoding_Converter.h"
+
#if defined (ACE_USES_WCHAR)
#include "ace/OS_NS_stdio.h"
#include "ace/OS_Memory.h"
#include "ace/Min_Max.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
static const ACE_UINT32 UNI_MAX_LEGAL_UTF32 = 0x0010FFFF;
+
ACE_UTF32_Encoding_Converter::ACE_UTF32_Encoding_Converter (bool swap)
: ACE_UTF16_Encoding_Converter (swap)
{
}
+
ACE_UTF32_Encoding_Converter::~ACE_UTF32_Encoding_Converter (void)
{
}
+
ACE_UTF32_Encoding_Converter::Result
ACE_UTF32_Encoding_Converter::to_utf8 (const void* source,
size_t source_size,
@@ -44,15 +52,18 @@ ACE_UTF32_Encoding_Converter::to_utf8 (const void* source,
static const ACE_UINT32 UNI_SUR_HIGH_START = get_UNI_SUR_HIGH_START ();
static const ACE_UINT32 UNI_SUR_LOW_END = get_UNI_SUR_LOW_END ();
static const ACE_Byte* firstByteMark = get_first_byte_mark ();
+
Result result = CONVERSION_OK;
ACE_Byte* targetEnd = target + target_size;
const ACE_UINT32* sourceStart = static_cast<const ACE_UINT32*> (source);
const ACE_UINT32* sourceEnd = sourceStart + (source_size / sizeof (ACE_UINT32));
+
while (sourceStart < sourceEnd)
{
ACE_UINT32 nw = *sourceStart++;
ACE_UINT32 ch = (this->swap_ ? ACE_SWAP_LONG (nw) : nw);
unsigned short bytesToWrite = 0;
+
if (strict)
{
// UTF-16 surrogate values are illegal in UTF-32
@@ -62,6 +73,7 @@ ACE_UTF32_Encoding_Converter::to_utf8 (const void* source,
break;
}
}
+
// Figure out how many bytes the result will require. Turn any
// illegally large ACE_UINT32 things (> Plane 17) into replacement
// chars.
@@ -86,12 +98,14 @@ ACE_UTF32_Encoding_Converter::to_utf8 (const void* source,
result = SOURCE_ILLEGAL;
break;
}
+
target += bytesToWrite;
if (target > targetEnd)
{
result = TARGET_EXHAUSTED;
break;
}
+
// NOTE: everything falls through.
switch (bytesToWrite)
{
@@ -109,8 +123,10 @@ ACE_UTF32_Encoding_Converter::to_utf8 (const void* source,
}
target += bytesToWrite;
}
+
return result;
}
+
ACE_UTF32_Encoding_Converter::Result
ACE_UTF32_Encoding_Converter::from_utf8 (const ACE_Byte* source,
size_t source_size,
@@ -123,10 +139,12 @@ ACE_UTF32_Encoding_Converter::from_utf8 (const ACE_Byte* source,
static const ACE_UINT32 UNI_REPLACEMENT_CHAR = get_UNI_REPLACEMENT_CHAR ();
static const ACE_Byte* trailingBytesForUTF8 = get_trailing_bytes_for_utf8 ();
static const ACE_UINT32* offsetsFromUTF8 = get_offsets_from_utf8 ();
+
Result result = CONVERSION_OK;
const ACE_Byte* sourceEnd = source + source_size;
ACE_UINT32* targetStart = static_cast<ACE_UINT32*> (target);
ACE_UINT32* targetEnd = targetStart + target_size;
+
while (source < sourceEnd)
{
ACE_UINT32 ch = 0;
@@ -136,12 +154,14 @@ ACE_UTF32_Encoding_Converter::from_utf8 (const ACE_Byte* source,
result = SOURCE_EXHAUSTED;
break;
}
+
// Do this check whether lenient or strict
if (!this->is_legal_utf8 (source, extraBytesToRead + 1))
{
result = SOURCE_ILLEGAL;
break;
}
+
// The cases all fall through. See "Note A" below.
switch (extraBytesToRead)
{
@@ -164,11 +184,13 @@ ACE_UTF32_Encoding_Converter::from_utf8 (const ACE_Byte* source,
ch += *source++;
}
ch -= offsetsFromUTF8[extraBytesToRead];
+
if (targetStart >= targetEnd)
{
result = TARGET_EXHAUSTED;
break;
}
+
if (ch <= UNI_MAX_LEGAL_UTF32)
{
// UTF-16 surrogate values are illegal in UTF-32, and anything
@@ -196,19 +218,23 @@ ACE_UTF32_Encoding_Converter::from_utf8 (const ACE_Byte* source,
break;
}
}
+
return result;
}
+
ACE_UTF32_Encoding_Converter*
ACE_UTF32_Encoding_Converter::encoded (const ACE_Byte* source,
size_t source_size)
{
static const size_t begin = 16;
static const size_t converted = begin * 4;
+
ACE_Byte target[converted];
ACE_UTF32_Encoding_Converter* converter = 0;
ACE_NEW_RETURN (converter,
ACE_UTF32_Encoding_Converter (false),
0);
+
if (converter->to_utf8 (source,
ACE_MIN (begin, source_size),
target,
@@ -220,8 +246,10 @@ ACE_UTF32_Encoding_Converter::encoded (const ACE_Byte* source,
{
delete converter;
}
+
return 0;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
#endif /* ACE_USES_WCHAR */
diff --git a/dep/ACE_wrappers/ace/UTF32_Encoding_Converter.h b/dep/ACE_wrappers/ace/UTF32_Encoding_Converter.h
index 4fc1cf0479b..dc811d7251d 100644
--- a/dep/ACE_wrappers/ace/UTF32_Encoding_Converter.h
+++ b/dep/ACE_wrappers/ace/UTF32_Encoding_Converter.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=========================================================================
/**
* @file UTF32_Encoding_Converter.h
@@ -11,12 +12,17 @@
* @author Chad Elliott <elliott_c@ociweb.com>
*/
//=========================================================================
+
#ifndef ACE_UTF32_ENCODING_CONVERTER_H
#define ACE_UTF32_ENCODING_CONVERTER_H
+
#include /**/ "ace/pre.h"
+
#include "ace/UTF16_Encoding_Converter.h"
+
#if defined (ACE_USES_WCHAR)
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/** Convert from UTF-32 to UTF-8 and from UTF-8 to UTF-32.
* This class implements the ACE_Encoding_Converter interface.
*/
@@ -26,8 +32,10 @@ public:
/// This class has some similarities to the UTF16 converter, so
/// we just construct our base class and pass the swap parameter.
ACE_UTF32_Encoding_Converter (bool swap = false);
+
/// This is a do nothing destructor.
virtual ~ACE_UTF32_Encoding_Converter (void);
+
/// Convert the source from UTF-32 to UTF-8 and store it in the
/// provided target buffer.
virtual Result to_utf8 (const void* source,
@@ -35,6 +43,7 @@ public:
ACE_Byte* target,
size_t target_size,
bool strict = true);
+
/// Convert the UTF-8 source into a UTF-32 encoding and store it
/// in the provided target buffer.
virtual Result from_utf8 (const ACE_Byte* source,
@@ -42,14 +51,18 @@ public:
void* target,
size_t target_size,
bool strict = true);
+
/// This factory helper method determines if the source stream is UTF-32
/// encoded. If it is, allocate an ACE_UTF32_Encoding_Converter and
/// return it. The caller then owns the allocated object.
static ACE_UTF32_Encoding_Converter* encoded (const ACE_Byte* source,
size_t source_size);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
#endif /* ACE_USES_WCHAR */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_UTF32_ENCODING_CONVERTER_H */
diff --git a/dep/ACE_wrappers/ace/UTF8_Encoding_Converter.cpp b/dep/ACE_wrappers/ace/UTF8_Encoding_Converter.cpp
index 14b79bae755..42e452150a4 100644
--- a/dep/ACE_wrappers/ace/UTF8_Encoding_Converter.cpp
+++ b/dep/ACE_wrappers/ace/UTF8_Encoding_Converter.cpp
@@ -1,11 +1,15 @@
// $Id: UTF8_Encoding_Converter.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/UTF8_Encoding_Converter.h"
+
#if defined (ACE_USES_WCHAR)
#include "ace/UTF16_Encoding_Converter.h"
#include "ace/UTF32_Encoding_Converter.h"
#include "ace/OS_NS_string.h"
#include "ace/OS_Memory.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_UTF8_Encoding_Converter::ACE_UTF8_Encoding_Converter (void)
: native_ (0)
{
@@ -22,10 +26,12 @@ ACE_UTF8_Encoding_Converter::ACE_UTF8_Encoding_Converter (void)
break;
}
}
+
ACE_UTF8_Encoding_Converter::~ACE_UTF8_Encoding_Converter (void)
{
delete native_;
}
+
ACE_UTF8_Encoding_Converter::Result
ACE_UTF8_Encoding_Converter::to_utf8 (const void* source,
size_t source_size,
@@ -38,8 +44,10 @@ ACE_UTF8_Encoding_Converter::to_utf8 (const void* source,
ACE_OS::memcpy (target, source, source_size);
return CONVERSION_OK;
}
+
return TARGET_EXHAUSTED;
}
+
ACE_UTF8_Encoding_Converter::Result
ACE_UTF8_Encoding_Converter::from_utf8 (const ACE_Byte* source,
size_t source_size,
@@ -52,6 +60,7 @@ ACE_UTF8_Encoding_Converter::from_utf8 (const ACE_Byte* source,
return this->native_->from_utf8(source, source_size,
target, target_size, strict);
}
+
ACE_TCHAR* targetStart = static_cast<ACE_TCHAR*> (target);
ACE_OS::strncpy (targetStart,
ACE_TEXT_CHAR_TO_TCHAR (
@@ -60,6 +69,7 @@ ACE_UTF8_Encoding_Converter::from_utf8 (const ACE_Byte* source,
targetStart[source_size] = 0;
return CONVERSION_OK;
}
+
ACE_UTF8_Encoding_Converter*
ACE_UTF8_Encoding_Converter::encoded (const ACE_Byte* source,
size_t source_size)
@@ -69,6 +79,7 @@ ACE_UTF8_Encoding_Converter::encoded (const ACE_Byte* source,
if (source[i] < 0x01 || source[i] > 0x7f)
return 0;
}
+
// All characters are "valid" ASCII
ACE_UTF8_Encoding_Converter* converter = 0;
ACE_NEW_RETURN (converter,
@@ -76,6 +87,7 @@ ACE_UTF8_Encoding_Converter::encoded (const ACE_Byte* source,
0);
return converter;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
#endif /* ACE_USES_WCHAR */
diff --git a/dep/ACE_wrappers/ace/UTF8_Encoding_Converter.h b/dep/ACE_wrappers/ace/UTF8_Encoding_Converter.h
index bd397ba9a1b..989adca194a 100644
--- a/dep/ACE_wrappers/ace/UTF8_Encoding_Converter.h
+++ b/dep/ACE_wrappers/ace/UTF8_Encoding_Converter.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=========================================================================
/**
* @file UTF8_Encoding_Converter.h
@@ -11,12 +12,17 @@
* @author Chad Elliott <elliott_c@ociweb.com>
*/
//=========================================================================
+
#ifndef ACE_UTF8_ENCODING_CONVERTER_H
#define ACE_UTF8_ENCODING_CONVERTER_H
+
#include /**/ "ace/pre.h"
+
#include "ace/Encoding_Converter.h"
+
#if defined (ACE_USES_WCHAR)
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/** Convert from UTF-16 or UTF-32 to UTF-8.
* This class implements the ACE_Encoding_Converter interface.
*/
@@ -26,8 +32,10 @@ public:
/// Allocate the converter to be used by the from_utf8() method based
/// on the size of the native wide character.
ACE_UTF8_Encoding_Converter (void);
+
/// De-allocate the native converter.
virtual ~ACE_UTF8_Encoding_Converter (void);
+
/// Since the source *must be* UTF-8, there is no conversion required.
/// This method just copies the source to the target given that there
/// is enough space.
@@ -36,6 +44,7 @@ public:
ACE_Byte* target,
size_t target_size,
bool strict = true);
+
/// Utilize the native converter to convert the UTF-8 source into an
/// alternate encoding and store it in the provided target buffer.
virtual Result from_utf8 (const ACE_Byte* source,
@@ -44,16 +53,21 @@ public:
size_t target_size,
bool strict = true);
+
/// This factory helper method determines if the source stream is UTF-8
/// encoded. If it is, allocate an ACE_UTF8_Encoding_Converter and
/// return it. The caller then owns the allocated object.
static ACE_UTF8_Encoding_Converter* encoded (const ACE_Byte* source,
size_t source_size);
+
private:
ACE_Encoding_Converter* native_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
#endif /* ACE_USES_WCHAR */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_UTF8_ENCODING_CONVERTER_H */
diff --git a/dep/ACE_wrappers/ace/UUID.cpp b/dep/ACE_wrappers/ace/UUID.cpp
index cd9aa519f4e..d27c8f8a33b 100644
--- a/dep/ACE_wrappers/ace/UUID.cpp
+++ b/dep/ACE_wrappers/ace/UUID.cpp
@@ -1,9 +1,12 @@
//$Id: UUID.cpp 81541 2008-04-30 13:56:12Z shuston $
+
#include "ace/UUID.h"
#include "ace/Guard_T.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/UUID.inl"
#endif /* __ACE_INLINE__ */
+
#include "ace/Log_Msg.h"
#include "ace/OS_NS_stdio.h"
#include "ace/OS_NS_string.h"
@@ -11,11 +14,14 @@
#include "ace/OS_NS_netdb.h"
#include "ace/OS_NS_unistd.h"
#include "ace/ACE.h"
+
ACE_RCSID (ace,
UUID,
"$Id: UUID.cpp 81541 2008-04-30 13:56:12Z shuston $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE_Utils
{
UUID_Node::UUID_Node (void)
@@ -23,18 +29,22 @@ namespace ACE_Utils
for (int i = 0; i < UUID_Node::NODE_ID_SIZE; ++i)
node_ID_[i] = 0;
}
+
UUID_Node::Node_ID&
UUID_Node::node_ID (void)
{
return node_ID_;
}
+
void
UUID_Node::node_ID (Node_ID& node_ID)
{
for (int i = 0; i < UUID_Node::NODE_ID_SIZE; ++i)
node_ID_[i] = node_ID[i];
}
+
UUID UUID::NIL_UUID;
+
/// Construct a nil UUID. Such a UUID has every one of it's data
/// elements set to zero.
UUID::UUID (void)
@@ -50,6 +60,7 @@ namespace ACE_Utils
ACE_NEW (node_,
UUID_Node);
}
+
/// Construct a UUID from a string representation of an UUID.
UUID::UUID (const ACE_CString& uuid_string)
: time_low_ (0),
@@ -63,8 +74,10 @@ namespace ACE_Utils
{
ACE_NEW (node_,
UUID_Node);
+
this->from_string_i (uuid_string);
}
+
UUID::UUID (const UUID &right)
: time_low_ (right.time_low_),
time_mid_ (right.time_mid_),
@@ -76,13 +89,16 @@ namespace ACE_Utils
ACE_NEW (node_,
UUID_Node (*right.node_));
}
+
UUID::~UUID (void)
{
if (node_release_)
delete node_;
+
if (as_string_ != 0)
delete as_string_;
}
+
const ACE_CString*
UUID::to_string (void)
{
@@ -93,12 +109,14 @@ namespace ACE_Utils
// gauge. Don't forget the trailing nul.
size_t UUID_STRING_LENGTH = 36 + thr_id_.length () + pid_.length ();
char *buf = 0;
+
if ((thr_id_.length () != 0) && (pid_.length () != 0))
{
UUID_STRING_LENGTH += 2; //for '-'
ACE_NEW_RETURN (buf,
char[UUID_STRING_LENGTH + 1],
0);
+
ACE_OS::sprintf (buf,
"%8.8x-%4.4x-%4.4x-%2.2x%2.2x-%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x-%s-%s",
this->time_low_,
@@ -121,6 +139,7 @@ namespace ACE_Utils
ACE_NEW_RETURN (buf,
char[UUID_STRING_LENGTH + 1],
0);
+
ACE_OS::sprintf (buf,
"%8.8x-%4.4x-%4.4x-%2.2x%2.2x-%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x",
this->time_low_,
@@ -136,19 +155,24 @@ namespace ACE_Utils
(this->node_->node_ID ()) [5]
);
}
+
// We allocated 'buf' above dynamically, so we shouldn't use
// ACE_NEW_RETURN here to avoid a possible memory leak.
ACE_NEW_NORETURN (this->as_string_,
ACE_CString (buf, UUID_STRING_LENGTH));
+
// we first free the dynamically allocated 'buf'.
delete [] buf;
+
// then we test that ACE_NEW succeded for 'as_string_'
// if not, we return 0 (NULL) to indicate failure.
if (this->as_string_ == 0 )
return 0;
}
+
return as_string_;
}
+
void
UUID::from_string_i (const ACE_CString& uuid_string)
{
@@ -159,6 +183,7 @@ namespace ACE_Utils
"IllegalArgument (incorrect string length)\n"));
return;
}
+
/// Special case for the nil UUID.
if (uuid_string == *NIL_UUID.to_string ())
{
@@ -168,6 +193,7 @@ namespace ACE_Utils
ACE_UNUSED_ARG (copy_constructor_not_supported);
return;
}
+
unsigned int time_low;
unsigned int time_mid;
unsigned int time_hi_and_version;
@@ -175,6 +201,7 @@ namespace ACE_Utils
unsigned int clock_seq_low;
unsigned int node [UUID_Node::NODE_ID_SIZE];
char thr_pid_buf [BUFSIZ];
+
if (uuid_string.length () == NIL_UUID.to_string ()->length ())
{
// This might seem quite strange this being in ACE, but it
@@ -202,6 +229,7 @@ namespace ACE_Utils
&node[4],
&node[5]
);
+
if (nScanned != 11)
{
ACE_DEBUG ((LM_DEBUG,
@@ -247,6 +275,7 @@ namespace ACE_Utils
thr_pid_buf
);
#endif /* ACE_HAS_TR24731_2005_CRT */
+
if (nScanned != 12)
{
ACE_DEBUG ((LM_DEBUG,
@@ -255,15 +284,19 @@ namespace ACE_Utils
return;
}
}
+
this->time_low_ = static_cast<ACE_UINT32> (time_low);
this->time_mid_ = static_cast<ACE_UINT16> (time_mid);
this->time_hi_and_version_ = static_cast<ACE_UINT16> (time_hi_and_version);
this->clock_seq_hi_and_reserved_ = static_cast<u_char> (clock_seq_hi_and_reserved);
this->clock_seq_low_ = static_cast<u_char> (clock_seq_low);
+
UUID_Node::Node_ID node_id;
for (int i = 0; i < UUID_Node::NODE_ID_SIZE; ++i)
node_id [i] = static_cast<u_char> (node[i]);
+
this->node_->node_ID (node_id);
+
// Support varient 10- only
if ((this->clock_seq_hi_and_reserved_ & 0xc0) != 0x80 && (this->clock_seq_hi_and_reserved_ & 0xc0) != 0xc0)
{
@@ -272,8 +305,10 @@ namespace ACE_Utils
"IllegalArgument (unsupported variant)\n"));
return;
}
+
/// Support versions 1, 3, and 4 only
ACE_UINT16 V1 = this->time_hi_and_version_;
+
if ((V1 & 0xF000) != 0x1000 &&
(V1 & 0xF000) != 0x3000 &&
(V1 & 0xF000) != 0x4000)
@@ -283,6 +318,7 @@ namespace ACE_Utils
"IllegalArgument (unsupported version)\n"));
return;
}
+
if ((this->clock_seq_hi_and_reserved_ & 0xc0) == 0xc0)
{
if (uuid_string.length () == NIL_UUID.to_string ()->length ())
@@ -298,10 +334,12 @@ namespace ACE_Utils
ACE_DEBUG ((LM_DEBUG,
"ACE_UUID::from_string_i - "
"IllegalArgument (Thread and Process Id format incorrect)\n"));
+
this->thr_id_ = thr_pid_str.substr (0, pos);
this->pid_ = thr_pid_str.substr (pos+1, thr_pid_str.length ()-pos-1);
}
}
+
UUID_Generator::UUID_Generator ()
: time_last_ (0),
destroy_lock_ (true)
@@ -309,16 +347,19 @@ namespace ACE_Utils
ACE_NEW (lock_,
ACE_SYNCH_MUTEX);
}
+
UUID_Generator::~UUID_Generator ()
{
if (destroy_lock_)
delete lock_;
}
+
void
UUID_Generator::init (void)
{
ACE_OS::macaddr_node_t macaddress;
int result = ACE_OS::getmacaddress (&macaddress);
+
UUID_Node::Node_ID node_id;
if (result != -1)
{
@@ -330,6 +371,7 @@ namespace ACE_Utils
// macaddress.node [3],
// macaddress.node [4],
// macaddress.node [5]));
+
ACE_OS::memcpy (&node_id,
macaddress.node,
sizeof (node_id));
@@ -343,46 +385,57 @@ namespace ACE_Utils
node_id [4] = static_cast<u_char> (ACE_OS::rand ());
node_id [5] = static_cast<u_char> (ACE_OS::rand ());
}
+
this->get_timestamp (time_last_);
+
{
ACE_GUARD (ACE_SYNCH_MUTEX, ace_mon, *lock_);
uuid_state_.timestamp = time_last_;
uuid_state_.node.node_ID (node_id);
}
}
+
void
UUID_Generator::generate_UUID (UUID& uuid,ACE_UINT16 version,
u_char variant)
{
UUID_Time timestamp;
ACE_UINT16 clock_sequence;
+
this->get_timestamp_and_clocksequence (timestamp,
clock_sequence);
+
// Construct a Version 1 UUID with the information in the arguements.
uuid.time_low (static_cast<ACE_UINT32> (timestamp & 0xFFFFFFFF));
uuid.time_mid (static_cast<ACE_UINT16> ((timestamp >> 32) & 0xFFFF));
+
ACE_UINT16 tHAV = static_cast<ACE_UINT16> ((timestamp >> 48) & 0xFFFF);
tHAV |= (version << 12);
uuid.time_hi_and_version (tHAV);
+
u_char cseqHAV;
uuid.clock_seq_low (static_cast<u_char> (clock_sequence & 0xFF));
cseqHAV = static_cast<u_char> ((clock_sequence & 0x3f00) >> 8);
uuid_state_.timestamp = timestamp;
+
cseqHAV |= variant;
uuid.clock_seq_hi_and_reserved (cseqHAV);
uuid.node (& (uuid_state_.node));
+
if (variant == 0xc0)
{
ACE_Thread_ID thread_id;
char buf [BUFSIZ];
thread_id.to_string (buf);
uuid.thr_id (buf);
+
ACE_OS::sprintf (buf,
"%d",
static_cast<int> (ACE_OS::getpid ()));
uuid.pid (buf);
}
}
+
UUID*
UUID_Generator::generate_UUID (ACE_UINT16 version, u_char variant)
{
@@ -390,16 +443,20 @@ namespace ACE_Utils
ACE_NEW_RETURN (uuid,
UUID,
0);
+
this->generate_UUID (*uuid, version, variant);
return uuid;
}
+
/// Obtain a new timestamp. If UUID's are being generated too quickly
/// the clock sequence will be incremented
void
UUID_Generator::get_timestamp (UUID_Time& timestamp)
{
ACE_GUARD (ACE_SYNCH_MUTEX, mon, *lock_);
+
this->get_systemtime (timestamp);
+
// Account for the clock being set back. Increment the clock /
// sequence.
if (timestamp <= time_last_)
@@ -413,25 +470,32 @@ namespace ACE_Utils
{
uuid_state_.clock_sequence = 0;
}
+
time_last_ = timestamp;
}
+
void
UUID_Generator::get_timestamp_and_clocksequence (UUID_Time& timestamp,
ACE_UINT16& clock_sequence)
{
ACE_GUARD (ACE_SYNCH_MUTEX, mon, *lock_);
+
this->get_systemtime (timestamp);
+
// Account for the clock being set back. Increment the clock /
// sequence.
if (timestamp <= time_last_)
uuid_state_.clock_sequence = static_cast<ACE_UINT16> ((uuid_state_.clock_sequence + 1) & ACE_UUID_CLOCK_SEQ_MASK);
+
// If the system time ticked since the last UUID was
// generated. Set / the clock sequence back.
else if (timestamp > time_last_)
uuid_state_.clock_sequence = 0;
+
time_last_ = timestamp;
clock_sequence = uuid_state_.clock_sequence;
}
+
/**
* ACE_Time_Value is in POSIX time, seconds since Jan 1, 1970. UUIDs use
* time in 100ns ticks since 15 October 1582. The difference is:
@@ -454,6 +518,7 @@ namespace ACE_Utils
#else
ACE_UINT64_LITERAL (0x1B21DD213814000);
#endif /* ACE_LACKS_UNSIGNEDLONGLONG_T */
+
/// Get the time of day, convert to 100ns ticks then add the offset.
ACE_Time_Value now = ACE_OS::gettimeofday ();
ACE_UINT64 time;
@@ -461,24 +526,30 @@ namespace ACE_Utils
time = time * 10;
timestamp = time + timeOffset;
}
+
ACE_SYNCH_MUTEX*
UUID_Generator::lock (void)
{
return this->lock_;
}
+
void
UUID_Generator::lock (ACE_SYNCH_MUTEX* lock,
bool release_lock)
{
if (this->destroy_lock_)
delete this->lock_;
+
this->lock_ = lock;
this->destroy_lock_ = release_lock;
}
+
}
+
#if defined (ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION)
template ACE_Singleton<ACE_Utils::UUID_Generator, ACE_SYNCH_MUTEX> *
ACE_Singleton<ACE_Utils::UUID_Generator, ACE_SYNCH_MUTEX>::singleton_;
#endif /* ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/UUID.h b/dep/ACE_wrappers/ace/UUID.h
index a29ba320b38..f2dceff3e51 100644
--- a/dep/ACE_wrappers/ace/UUID.h
+++ b/dep/ACE_wrappers/ace/UUID.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file UUID.h
@@ -9,37 +10,50 @@
* @author Yamuna Krishnmaurthy <yamuna@oomworks.com>
*/
//=============================================================================
+
#ifndef ACE_UUID_H
#define ACE_UUID_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/SString.h"
#include "ace/Singleton.h"
#include "ace/Synch_Traits.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE_Utils
{
/// Class to hold a MAC address
class ACE_Export UUID_Node
{
public:
+
/// Constructor
UUID_Node (void);
+
enum {NODE_ID_SIZE = 6};
typedef u_char Node_ID[NODE_ID_SIZE];
+
Node_ID &node_ID (void);
void node_ID (Node_ID&);
+
///// Equality Operations
bool operator == (const UUID_Node& right) const;
bool operator != (const UUID_Node& right) const;
+
///// Relational Operations
//bool operator < (const UUID_Node& right) const;
+
private:
Node_ID node_ID_;
};
+
/**
* @class ACE_UUID
*
@@ -61,45 +75,65 @@ namespace ACE_Utils
class ACE_Export UUID
{
public:
+
/// Constructor
UUID (void);
+
/// Constructs a UUID from a string representation.
UUID (const ACE_CString& uuidString);
+
UUID (const UUID &right);
+
// Destructor
~UUID (void);
+
ACE_UINT32 time_low (void) const;
void time_low (ACE_UINT32);
+
ACE_UINT16 time_mid (void) const;
void time_mid (ACE_UINT16);
+
ACE_UINT16 time_hi_and_version (void) const;
void time_hi_and_version (ACE_UINT16);
+
u_char clock_seq_hi_and_reserved (void) const;
void clock_seq_hi_and_reserved (u_char);
+
u_char clock_seq_low (void) const;
void clock_seq_low (u_char);
+
UUID_Node* node (void) const;
void node (UUID_Node*);
+
ACE_CString* thr_id (void);
void thr_id (char*);
+
ACE_CString* pid (void);
void pid (char*);
+
/// Returns a string representation of the UUID
const ACE_CString* to_string (void);
+
/// Set the value using a string
void from_string (const ACE_CString& uuid_string);
+
static UUID NIL_UUID;
+
/// Equality Operations
bool operator== (const UUID &right) const;
bool operator!= (const UUID &right) const;
+
/// Relational Operations
//bool operator< (const UUID &right) const;
//bool operator> (const UUID &right) const;
//bool operator<= (const UUID &right) const;
//bool operator>= (const UUID &right) const;
+
private:
void from_string_i (const ACE_CString& uuid_string);
+
UUID& operator= (const UUID&);
+
/// Data Members for Class Attributes
ACE_UINT32 time_low_;
ACE_UINT16 time_mid_;
@@ -110,10 +144,12 @@ namespace ACE_Utils
bool node_release_;
ACE_CString thr_id_;
ACE_CString pid_;
+
/// The string representation of the UUID. This is created and
/// updated only on demand.
ACE_CString *as_string_;
};
+
/**
* @class ACE_UUID_Generator
*
@@ -123,29 +159,40 @@ namespace ACE_Utils
class ACE_Export UUID_Generator
{
public:
+
enum {ACE_UUID_CLOCK_SEQ_MASK = 0x3FFF};
+
UUID_Generator();
~UUID_Generator();
+
void init (void);
+
/// Format timestamp, clockseq, and nodeID into an UUID of the
/// specified version and variant. For generating UUID's with
/// thread and process ids use variant=0xc0
void generate_UUID (UUID&, ACE_UINT16 version=0x0001, u_char variant=0x80);
+
/// Format timestamp, clockseq, and nodeID into a VI UUID. For
/// generating UUID's with thread and process ids use variant=0xc0
UUID* generate_UUID (ACE_UINT16 version=0x0001, u_char variant=0x80);
+
/// Type to represent UTC as a count of 100 nanosecond intervals
/// since 00:00:00.00, 15 October 1582.
typedef ACE_UINT64 UUID_Time;
+
/// The locking strategy prevents multiple generators from accessing
/// the UUID_state at the same time. Get the locking strategy.
ACE_SYNCH_MUTEX* lock (void);
+
/// Set a new locking strategy and return the old one.
void lock (ACE_SYNCH_MUTEX* lock,
bool release_lock);
+
private:
+
/// The system time when that last uuid was generated.
UUID_Time time_last_;
+
/// Type to contain the UUID generator persistent state. This will
/// be kept in memory mapped shared memory
struct UUID_State
@@ -154,29 +201,40 @@ namespace ACE_Utils
UUID_Node node;
ACE_UINT16 clock_sequence;
};
+
/// Obtain a UUID timestamp. Compensate for the fact that the time
/// obtained from getSystem time has a resolution less than 100ns.
void get_timestamp (UUID_Time& timestamp);
+
/// Obtain a UUID timestamp and clock sequence. Compensate for the
/// fact that the time obtained from getSystem time has a
/// resolution less than 100ns.
void get_timestamp_and_clocksequence (UUID_Time& timestamp,
ACE_UINT16& clockSequence);
+
/// Obtain the system time in UTC as a count of 100 nanosecond intervals
/// since 00:00:00.00, 15 October 1582 (the date of Gregorian reform to
/// the Christian calendar).
void get_systemtime( UUID_Time& timeNow);
+
/// The UUID generator persistent state.
UUID_State uuid_state_;
+
ACE_SYNCH_MUTEX* lock_;
bool destroy_lock_;
};
+
typedef ACE_Singleton<UUID_Generator, ACE_SYNCH_MUTEX> UUID_GENERATOR;
+
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/UUID.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif // ACE_UUID_H
+
diff --git a/dep/ACE_wrappers/ace/UUID.inl b/dep/ACE_wrappers/ace/UUID.inl
index b35db00eb54..a60fb6ce17f 100644
--- a/dep/ACE_wrappers/ace/UUID.inl
+++ b/dep/ACE_wrappers/ace/UUID.inl
@@ -1,98 +1,119 @@
// -*- C++ -*-
//
//$Id: UUID.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE_Utils
{
+
/// Data Members for Class Attributes
ACE_INLINE ACE_UINT32
UUID::time_low (void) const
{
return this->time_low_;
}
+
ACE_INLINE void
UUID::time_low (ACE_UINT32 timelow)
{
this->time_low_ = timelow;
}
+
ACE_INLINE ACE_UINT16
UUID::time_mid (void) const
{
return this->time_mid_;
}
+
ACE_INLINE void
UUID::time_mid (ACE_UINT16 time_mid)
{
this->time_mid_ = time_mid;
}
+
ACE_INLINE ACE_UINT16
UUID::time_hi_and_version (void) const
{
return this->time_hi_and_version_;
}
+
ACE_INLINE void
UUID::time_hi_and_version (ACE_UINT16 time_hi_and_version)
{
this->time_hi_and_version_ = time_hi_and_version;
}
+
ACE_INLINE u_char
UUID::clock_seq_hi_and_reserved (void) const
{
return this->clock_seq_hi_and_reserved_;
}
+
ACE_INLINE void
UUID::clock_seq_hi_and_reserved (u_char clock_seq_hi_and_reserved)
{
this->clock_seq_hi_and_reserved_ = clock_seq_hi_and_reserved;
}
+
ACE_INLINE u_char
UUID::clock_seq_low (void) const
{
return this->clock_seq_low_;
}
+
ACE_INLINE void
UUID::clock_seq_low (u_char clock_seq_low)
{
this->clock_seq_low_ = clock_seq_low;
}
+
ACE_INLINE UUID_Node*
UUID::node (void) const
{
return this->node_;
}
+
ACE_INLINE void
UUID::node (UUID_Node* node)
{
if (node_release_)
delete node_;
+
this->node_ = node;
node_release_ = false;
}
+
ACE_INLINE ACE_CString*
UUID::thr_id (void)
{
return &this->thr_id_;
}
+
ACE_INLINE void
UUID::thr_id (char* thr_id)
{
this->thr_id_ = thr_id;
}
+
ACE_INLINE ACE_CString*
UUID::pid (void)
{
return &this->pid_;
}
+
ACE_INLINE void
UUID::pid (char* pid)
{
this->pid_ = pid;
}
+
ACE_INLINE void
UUID::from_string (const ACE_CString& uuidString)
{
this->from_string_i (uuidString);
}
+
ACE_INLINE bool
UUID::operator == (const UUID &right) const
{
@@ -103,13 +124,16 @@ namespace ACE_Utils
(this->clock_seq_low_ != right.clock_seq_low ()) ||
(*this->node_ != *right.node ()))
return false;
+
return true;
}
+
ACE_INLINE bool
UUID::operator != (const UUID &right) const
{
return !(*this == right);
}
+
// ACE_INLINE bool
//UUID::operator < (const UUID &rt) const
// {
@@ -151,13 +175,16 @@ namespace ACE_Utils
for (size_t i = 0; i < NODE_ID_SIZE; ++i)
if (node_ID_ [i] != rt.node_ID_ [i])
return false;
+
return true;
}
+
ACE_INLINE bool
UUID_Node::operator != (const UUID_Node& right) const
{
return !(*this == right);
}
+
// ACE_INLINE bool
// UUID_node::operator < (const UUID_node& rt) const
// {
@@ -169,4 +196,5 @@ namespace ACE_Utils
// return false;
// }
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Unbounded_Queue.h b/dep/ACE_wrappers/ace/Unbounded_Queue.h
index ae349e3b791..0c16ac23388 100644
--- a/dep/ACE_wrappers/ace/Unbounded_Queue.h
+++ b/dep/ACE_wrappers/ace/Unbounded_Queue.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Unbounded_Queue.h
@@ -8,18 +9,26 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_UNBOUNDED_QUEUE_H
#define ACE_UNBOUNDED_QUEUE_H
#include /**/ "ace/pre.h"
+
#include "ace/Node.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/os_stddef.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Allocator;
+
template <class T>
class ACE_Unbounded_Queue;
+
/**
* @class ACE_Unbounded_Queue_Iterator
*
@@ -31,28 +40,38 @@ class ACE_Unbounded_Queue_Iterator
public:
// = Initialization method.
ACE_Unbounded_Queue_Iterator (ACE_Unbounded_Queue<T> &q, int end = 0);
+
// = Iteration methods.
+
/// Pass back the @a next_item that hasn't been seen in the queue.
/// Returns 0 when all items have been seen, else 1.
int next (T *&next_item);
+
/// Move forward by one element in the set. Returns 0 when all the
/// items in the queue have been seen, else 1.
int advance (void);
+
/// Move to the first element in the queue. Returns 0 if the
/// queue is empty, else 1.
int first (void);
+
/// Returns 1 when all items have been seen, else 0.
int done (void) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Pointer to the current node in the iteration.
ACE_Node<T> *current_;
+
/// Pointer to the queue we're iterating over.
ACE_Unbounded_Queue<T> &queue_;
};
+
/**
* @class ACE_Unbounded_Queue_Const_Iterator
*
@@ -64,28 +83,38 @@ class ACE_Unbounded_Queue_Const_Iterator
public:
// = Initialization method.
ACE_Unbounded_Queue_Const_Iterator (const ACE_Unbounded_Queue<T> &q, int end = 0);
+
// = Iteration methods.
+
/// Pass back the @a next_item that hasn't been seen in the queue.
/// Returns 0 when all items have been seen, else 1.
int next (T *&next_item);
+
/// Move forward by one element in the set. Returns 0 when all the
/// items in the queue have been seen, else 1.
int advance (void);
+
/// Move to the first element in the queue. Returns 0 if the
/// queue is empty, else 1.
int first (void);
+
/// Returns 1 when all items have been seen, else 0.
int done (void) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Pointer to the current node in the iteration.
ACE_Node<T> *current_;
+
/// Pointer to the queue we're iterating over.
const ACE_Unbounded_Queue<T> &queue_;
};
+
/**
* @class ACE_Unbounded_Queue
*
@@ -123,9 +152,11 @@ class ACE_Unbounded_Queue
public:
friend class ACE_Unbounded_Queue_Iterator<T>;
friend class ACE_Unbounded_Queue_Const_Iterator<T>;
+
// Trait definition.
typedef ACE_Unbounded_Queue_Iterator<T> ITERATOR;
typedef ACE_Unbounded_Queue_Const_Iterator<T> CONST_ITERATOR;
+
// = Initialization and termination methods.
/// Construction. Use user specified allocation strategy
/// if specified.
@@ -133,58 +164,71 @@ public:
* Initialize an empty queue using the strategy provided.
*/
ACE_Unbounded_Queue (ACE_Allocator *alloc = 0);
+
/// Copy constructor.
/**
* Initialize the queue to be a copy of the provided queue.
*/
ACE_Unbounded_Queue (const ACE_Unbounded_Queue<T> &);
+
/// Assignment operator.
/**
* Perform a deep copy of rhs.
*/
void operator= (const ACE_Unbounded_Queue<T> &);
+
/// Destructor.
/**
* Clean up the memory for the queue.
*/
~ACE_Unbounded_Queue (void);
+
// = Check boundary conditions.
+
/// Returns 1 if the container is empty, otherwise returns 0.
/**
* Constant time check to see if the queue is empty.
*/
int is_empty (void) const;
+
/// Returns 0.
/**
* The queue cannot be full, so it always returns 0.
*/
int is_full (void) const;
+
// = Classic queue operations.
+
/// Adds @a new_item to the tail of the queue. Returns 0 on success,
/// -1 on failure.
/**
* Insert an item at the end of the queue.
*/
int enqueue_tail (const T &new_item);
+
/// Adds @a new_item to the head of the queue. Returns 0 on success,
/// -1 on failure.
/**
* Insert an item at the head of the queue.
*/
int enqueue_head (const T &new_item);
+
/// Removes and returns the first @a item on the queue. Returns 0 on
/// success, -1 if the queue was empty.
/**
* Remove an item from the head of the queue.
*/
int dequeue_head (T &item);
+
// = Additional utility methods.
+
/// Reset the ACE_Unbounded_Queue to be empty and release all its
/// dynamically allocated resources.
/**
* Delete the queue nodes.
*/
void reset (void);
+
/// Get the @a slot th element in the set. Returns -1 if the element
/// isn't in the range {0..#cur_size_ - 1}, else 0.
/**
@@ -192,6 +236,7 @@ public:
* queue.
*/
int get (T *&item, size_t slot = 0) const;
+
/// Set the @a slot th element of the queue to @a item.
/**
* Set the @a slot th element in the set. Will pad out the set with
@@ -200,40 +245,54 @@ public:
* 0 otherwise.
*/
int set (const T &item, size_t slot);
+
/// The number of items in the queue.
/**
* Return the size of the queue.
*/
size_t size (void) const;
+
/// Dump the state of an object.
void dump (void) const;
+
// = STL-styled unidirectional iterator factory.
ACE_Unbounded_Queue_Iterator<T> begin (void);
ACE_Unbounded_Queue_Iterator<T> end (void);
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
protected:
/// Delete all the nodes in the queue.
void delete_nodes (void);
+
/// Copy nodes into this queue.
void copy_nodes (const ACE_Unbounded_Queue<T> &);
+
/// Pointer to the dummy node in the circular linked Queue.
ACE_Node<T> *head_;
+
/// Current size of the queue.
size_t cur_size_;
+
/// Allocation Strategy of the queue.
ACE_Allocator *allocator_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Unbounded_Queue.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Unbounded_Queue.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Unbounded_Queue.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
#endif /* ACE_UNBOUNDED_QUEUE_H */
diff --git a/dep/ACE_wrappers/ace/Unbounded_Queue.inl b/dep/ACE_wrappers/ace/Unbounded_Queue.inl
index f00a3b1d540..0758412b984 100644
--- a/dep/ACE_wrappers/ace/Unbounded_Queue.inl
+++ b/dep/ACE_wrappers/ace/Unbounded_Queue.inl
@@ -1,22 +1,27 @@
// -*- C++ -*-
//
// $Id: Unbounded_Queue.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template <class T> ACE_INLINE size_t
ACE_Unbounded_Queue<T>::size (void) const
{
return this->cur_size_;
}
+
template <class T> ACE_INLINE int
ACE_Unbounded_Queue<T>::is_empty (void) const
{
// ACE_TRACE ("ACE_Unbounded_Queue<T>::is_empty");
return this->head_ == this->head_->next_;
}
+
template <class T> ACE_INLINE int
ACE_Unbounded_Queue<T>::is_full (void) const
{
// ACE_TRACE ("ACE_Unbounded_Queue<T>::is_full");
return 0; // We should implement a "node of last resort for this..."
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Unbounded_Set.h b/dep/ACE_wrappers/ace/Unbounded_Set.h
index a56860fe8a8..44fb84068ee 100644
--- a/dep/ACE_wrappers/ace/Unbounded_Set.h
+++ b/dep/ACE_wrappers/ace/Unbounded_Set.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Unbounded_Set.h
@@ -8,15 +9,21 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_UNBOUNDED_SET_H
#define ACE_UNBOUNDED_SET_H
#include /**/ "ace/pre.h"
+
#include "ace/Unbounded_Set_Ex.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Allocator;
+
/**
* @struct ACE_Unbounded_Set_Default_Comparator
* @brief Simple comparator that evaluates equality using == operator.
@@ -26,8 +33,10 @@ struct ACE_Unbounded_Set_Default_Comparator
{
bool operator() (const T&lhs, const T&rhs) const;
};
+
template<typename T>
class ACE_Unbounded_Set;
+
/**
* @class ACE_Unbounded_Set_Iterator
* @brief Compatibility wrapper for ACE_Unbounded_Set_Ex_Iterator.
@@ -38,10 +47,13 @@ class ACE_Unbounded_Set_Iterator : public
{
public:
typedef ACE_Unbounded_Set_Ex_Iterator<T, ACE_Unbounded_Set_Default_Comparator<T> > base_type;
+
// = Initialization method.
ACE_Unbounded_Set_Iterator (ACE_Unbounded_Set<T> &s, bool end = false);
+
ACE_Unbounded_Set_Iterator (const base_type &s);
};
+
/**
* @class ACE_Unbounded_Set_Const_Iterator
* @brief Compatibility wrapper for ACE_Unbounded_Set_Ex_Const_Iterator.
@@ -51,12 +63,16 @@ class ACE_Unbounded_Set_Const_Iterator : public
ACE_Unbounded_Set_Ex_Const_Iterator<T, ACE_Unbounded_Set_Default_Comparator<T> >
{
public:
+
typedef ACE_Unbounded_Set_Ex_Const_Iterator<T, ACE_Unbounded_Set_Default_Comparator<T> > base_type;
+
// = Initialization method.
ACE_Unbounded_Set_Const_Iterator (const ACE_Unbounded_Set<T> &s,
bool end = false);
+
ACE_Unbounded_Set_Const_Iterator (const base_type &s);
};
+
/**
* @class ACE_Unbounded_Set
* @brief Compatibility wrapper for ACE_Unbounded_Set_Ex.
@@ -68,16 +84,21 @@ class ACE_Unbounded_Set : public
public:
ACE_Unbounded_Set (ACE_Allocator *alloc = 0);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Unbounded_Set.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Unbounded_Set.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Unbounded_Set.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
#endif /* ACE_UNBOUNDED_SET_H */
diff --git a/dep/ACE_wrappers/ace/Unbounded_Set.inl b/dep/ACE_wrappers/ace/Unbounded_Set.inl
index 4aa5fe5ce9b..365b025c0be 100644
--- a/dep/ACE_wrappers/ace/Unbounded_Set.inl
+++ b/dep/ACE_wrappers/ace/Unbounded_Set.inl
@@ -1,24 +1,30 @@
// -*- C++ -*-
//
// $Id: Unbounded_Set.inl 81642 2008-05-07 19:30:35Z shuston $
+
#include "ace/Global_Macros.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template <typename T> ACE_INLINE bool
ACE_Unbounded_Set_Default_Comparator<T>::operator () (const T &lhs, const T &rhs) const
{
return lhs == rhs;
}
+
template<typename T>
-ACE_Unbounded_Set_Iterator<T>::ACE_Unbounded_Set_Iterator (ACE_Unbounded_Set<T> &s,
+ACE_Unbounded_Set_Iterator<T>::ACE_Unbounded_Set_Iterator (ACE_Unbounded_Set<T> &s,
bool end)
: base_type (s, end)
{
}
+
template<typename T>
ACE_Unbounded_Set_Iterator<T>::ACE_Unbounded_Set_Iterator (const base_type & s)
: base_type (s)
{
}
+
template<typename T>
ACE_Unbounded_Set_Const_Iterator<T>::
ACE_Unbounded_Set_Const_Iterator (const ACE_Unbounded_Set<T> &s,
@@ -26,15 +32,18 @@ ACE_Unbounded_Set_Const_Iterator (const ACE_Unbounded_Set<T> &s,
: base_type (s, end)
{
}
+
template<typename T>
ACE_Unbounded_Set_Const_Iterator<T>::ACE_Unbounded_Set_Const_Iterator (const base_type & s)
: base_type (s)
{
}
+
template<typename T>
ACE_Unbounded_Set<T>::ACE_Unbounded_Set (ACE_Allocator *alloc)
: ACE_Unbounded_Set_Ex<T, ACE_Unbounded_Set_Default_Comparator<T> > (alloc)
{
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Unbounded_Set_Ex.h b/dep/ACE_wrappers/ace/Unbounded_Set_Ex.h
index df08645bda6..ab16a54be86 100644
--- a/dep/ACE_wrappers/ace/Unbounded_Set_Ex.h
+++ b/dep/ACE_wrappers/ace/Unbounded_Set_Ex.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Unbounded_Set_Ex.h
@@ -8,22 +9,31 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_UNBOUNDED_SET_EX_H
#define ACE_UNBOUNDED_SET_EX_H
#include /**/ "ace/pre.h"
+
#include "ace/Node.h"
#include "ace/os_include/os_stddef.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
class ACE_Allocator;
+
template <class T, class C>
class ACE_Unbounded_Set_Ex_Iterator;
+
template <class T, class C>
class ACE_Unbounded_Set_Ex_Const_Iterator;
+
template <class T, class C>
class ACE_Unbounded_Set_Ex;
+
/**
* @class ACE_Unbounded_Set_Ex_Iterator
*
@@ -35,38 +45,54 @@ class ACE_Unbounded_Set_Ex_Iterator
public:
// = Initialization method.
ACE_Unbounded_Set_Ex_Iterator (ACE_Unbounded_Set_Ex<T, C> &s, bool end = false);
+
// = Iteration methods.
+
/// Pass back the <next_item> that hasn't been seen in the Set.
/// Returns 0 when all items have been seen, else 1.
int next (T *&next_item);
+
/// Move forward by one element in the set. Returns 0 when all the
/// items in the set have been seen, else 1.
int advance (void);
+
/// Move to the first element in the set. Returns 0 if the
/// set is empty, else 1.
int first (void);
+
/// Returns 1 when all items have been seen, else 0.
int done (void) const;
+
/// Dump the state of an object.
void dump (void) const;
+
// = STL styled iteration, compare, and reference functions.
+
/// Postfix advance.
ACE_Unbounded_Set_Ex_Iterator<T, C> operator++ (int);
+
/// Prefix advance.
ACE_Unbounded_Set_Ex_Iterator<T, C>& operator++ (void);
+
/// Returns a reference to the internal element @c this is pointing to.
T& operator* (void);
+
/// Check if two iterators point to the same position
bool operator== (const ACE_Unbounded_Set_Ex_Iterator<T, C> &) const;
bool operator!= (const ACE_Unbounded_Set_Ex_Iterator<T, C> &) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
+
/// Pointer to the current node in the iteration.
ACE_Node<T, C> *current_;
+
/// Pointer to the set we're iterating over.
ACE_Unbounded_Set_Ex<T, C> *set_;
};
+
/**
* @class ACE_Unbounded_Set_Ex_Const_Iterator
*
@@ -79,38 +105,54 @@ public:
// = Initialization method.
ACE_Unbounded_Set_Ex_Const_Iterator (const ACE_Unbounded_Set_Ex<T, C> &s,
bool end = false);
+
// = Iteration methods.
+
/// Pass back the @a next_item that hasn't been seen in the Set.
/// @return Returns 0 when all items have been seen, else 1.
int next (T *&next_item);
+
/// Move forward by one element in the set. Returns 0 when all the
/// items in the set have been seen, else 1.
int advance (void);
+
/// Move to the first element in the set. Returns 0 if the
/// set is empty, else 1.
int first (void);
+
/// Returns 1 when all items have been seen, else 0.
int done (void) const;
+
/// Dump the state of an object.
void dump (void) const;
+
// = STL styled iteration, compare, and reference functions.
+
/// Postfix advance.
ACE_Unbounded_Set_Ex_Const_Iterator<T, C> operator++ (int);
+
/// Prefix advance.
ACE_Unbounded_Set_Ex_Const_Iterator<T, C>& operator++ (void);
+
/// Returns a reference to the internal element @c this is pointing to.
T& operator* (void);
+
/// Check if two iterators point to the same position
bool operator== (const ACE_Unbounded_Set_Ex_Const_Iterator<T, C> &) const;
bool operator!= (const ACE_Unbounded_Set_Ex_Const_Iterator<T, C> &) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
+
/// Pointer to the current node in the iteration.
ACE_Node<T, C> *current_;
+
/// Pointer to the set we're iterating over.
const ACE_Unbounded_Set_Ex<T, C> *set_;
};
+
/**
* @class ACE_Unbounded_Set_Ex
*
@@ -155,6 +197,7 @@ class ACE_Unbounded_Set_Ex
public:
friend class ACE_Unbounded_Set_Ex_Iterator<T, C>;
friend class ACE_Unbounded_Set_Ex_Const_Iterator<T, C>;
+
// Trait definition.
typedef ACE_Unbounded_Set_Ex_Iterator<T, C> ITERATOR;
typedef ACE_Unbounded_Set_Ex_Iterator<T, C> iterator;
@@ -162,6 +205,7 @@ public:
typedef ACE_Unbounded_Set_Ex_Const_Iterator<T, C> const_iterator;
typedef C COMP;
typedef ACE_Node<T, C> NODE;
+
// = Initialization and termination methods.
/// Constructor. Use user specified allocation strategy
/// if specified.
@@ -170,38 +214,47 @@ public:
* provided.
*/
ACE_Unbounded_Set_Ex (ACE_Allocator *alloc = 0);
+
/**
* Initialize an empty set using the allocation strategy of the user if
* provided, and a given comparator functor.
*/
ACE_Unbounded_Set_Ex (const C &comparator, ACE_Allocator *alloc = 0);
+
/// Copy constructor.
/**
* Initialize this set to be an exact copy of the set provided.
*/
ACE_Unbounded_Set_Ex (const ACE_Unbounded_Set_Ex<T, C> &);
+
/// Assignment operator.
/**
* Perform a deep copy of the rhs into the lhs.
*/
ACE_Unbounded_Set_Ex<T, C> & operator= (const ACE_Unbounded_Set_Ex<T, C> &);
+
/// Destructor.
/**
* Destroy the nodes of the set.
*/
~ACE_Unbounded_Set_Ex (void);
+
// = Check boundary conditions.
+
/// Returns @c true if the container is empty, otherwise returns @c false.
/**
* Constant time is_empty check.
*/
bool is_empty (void) const;
+
/// Returns @c false.
/**
* Always returns @c false since the set can never fill up.
*/
bool is_full (void) const;
+
// = Classic unordered set operations.
+
/// Linear insertion of an item.
/**
* Insert @a new_item into the set (doesn't allow duplicates).
@@ -209,12 +262,14 @@ public:
* 0.
*/
int insert (const T &new_item);
+
/// Insert @a item at the tail of the set (doesn't check for
/// duplicates).
/**
* Constant time insert at the end of the set.
*/
int insert_tail (const T &item);
+
/// Linear remove operation.
/**
* Remove first occurrence of @a item from the set. Returns 0 if
@@ -222,55 +277,72 @@ public:
* failure occurs.
*/
int remove (const T &item);
+
/// Finds if @a item occurs in the set. Returns 0 if find succeeds,
/// else -1.
/**
* Performs a linear find operation.
*/
int find (const T &item) const;
+
/// Size of the set.
/**
* Access the size of the set.
*/
size_t size (void) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Reset the ACE_Unbounded_Set_Ex to be empty.
/**
* Delete the nodes of the set.
*/
void reset (void);
+
// = STL-styled unidirectional iterator factory.
iterator begin (void);
iterator end (void);
const_iterator begin (void) const;
const_iterator end (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Delete all the nodes in the Set.
void delete_nodes (void);
+
/// Copy nodes into this set.
void copy_nodes (const ACE_Unbounded_Set_Ex<T, C> &);
+
/// Head of the linked list of Nodes.
NODE *head_;
+
/// Current size of the set.
size_t cur_size_;
+
/// Allocation strategy of the set.
ACE_Allocator *allocator_;
+
/// Comparator to be used
COMP comp_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Unbounded_Set_Ex.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Unbounded_Set_Ex.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Unbounded_Set_Ex.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
#endif /* ACE_UNBOUNDED_SET_H */
diff --git a/dep/ACE_wrappers/ace/Unbounded_Set_Ex.inl b/dep/ACE_wrappers/ace/Unbounded_Set_Ex.inl
index 00a06d18e95..356a1f58f1d 100644
--- a/dep/ACE_wrappers/ace/Unbounded_Set_Ex.inl
+++ b/dep/ACE_wrappers/ace/Unbounded_Set_Ex.inl
@@ -1,18 +1,23 @@
// -*- C++ -*-
//
// $Id: Unbounded_Set_Ex.inl 81624 2008-05-06 17:14:57Z wotte $
+
#include "ace/Global_Macros.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template <class T, class C> ACE_INLINE bool
ACE_Unbounded_Set_Ex<T,C>::is_empty (void) const
{
ACE_TRACE ("ACE_Unbounded_Set_Ex<T>::is_empty");
return this->head_ == this->head_->next_;
}
+
template <class T, class C> ACE_INLINE bool
ACE_Unbounded_Set_Ex<T, C>::is_full (void) const
{
ACE_TRACE ("ACE_Unbounded_Set_Ex<T>::is_full");
return 0; // We should implement a "node of last resort for this..."
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Value_Ptr.h b/dep/ACE_wrappers/ace/Value_Ptr.h
index 4fcd4f37b2b..f42beba0c99 100644
--- a/dep/ACE_wrappers/ace/Value_Ptr.h
+++ b/dep/ACE_wrappers/ace/Value_Ptr.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file Value_Ptr.h
@@ -11,11 +12,16 @@
* @author Ossama Othman <ossama@dre.vanderbilt.edu>
*/
//==========================================================================
+
#ifndef ACE_VALUE_PTR_H
#define ACE_VALUE_PTR_H
+
#include "ace/config-lite.h"
+
#include <algorithm>
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
namespace ACE
{
/**
@@ -40,6 +46,7 @@ namespace ACE
/// Copy the given object.
static T * clone (T const * p) { return new T (*p); }
};
+
/**
* @class Value_Ptr
*
@@ -60,14 +67,19 @@ namespace ACE
class Value_Ptr
{
public:
+
/// Constructor.
explicit Value_Ptr (T * p = 0) : p_ (p) { }
+
/// Destructor.
~Value_Ptr (void) { delete this->p_; }
+
/// Deference operator.
T & operator* (void) const { return *this->p_; }
+
/// Pointer operator.
T * operator-> (void) const { return this->p_; }
+
/// Non-throwing swap operation used to make assignment strongly
/// exception-safe.
/**
@@ -77,9 +89,11 @@ namespace ACE
* template class!?
*/
void swap (Value_Ptr & other) { std::swap (this->p_, other.p_); }
+
/// Copy constructor.
Value_Ptr (Value_Ptr const & other)
: p_ (create_from (other.p_)) { }
+
/// Assignment operator.
Value_Ptr & operator= (Value_Ptr const & other)
{
@@ -88,13 +102,17 @@ namespace ACE
this->swap (temp);
return *this;
}
+
#ifndef ACE_LACKS_MEMBER_TEMPLATES
+
// Compiler can't handle member templates so we lose converting
// copy operations.
+
/// Converting copy constructor.
template <typename U>
Value_Ptr (Value_Ptr<U> const & other)
: p_ (create_from (other.p_)) { }
+
/// Converting assignment operator.
template <typename U>
Value_Ptr & operator= (Value_Ptr<U> const & other)
@@ -104,32 +122,47 @@ namespace ACE
this->swap (temp);
return *this;
}
+
#endif /* !ACE_LACKS_MEMBER_TEMPLATES */
+
private:
+
#ifndef ACE_LACKS_MEMBER_TEMPLATES
+
/// Copying method invoked when copy constructing.
template <typename U>
T * create_from (U const * p) const
{
return p ? VP_traits<U>::clone (p) : 0;
}
+
#else
+
// Compiler can't handle member templates so we lose converting
// copy operations.
+
/// Copying method invoked when copy constructing.
T * create_from (T const * p) const
{
return p ? VP_traits<T>::clone (p) : 0;
}
+
#endif /* !ACE_LACKS_MEMBER_TEMPLATES */
+
private:
+
#ifndef ACE_LACKS_MEMBER_TEMPLATES
template <typename U> friend class Value_Ptr;
#endif /* !ACE_LACKS_MEMBER_TEMPLATES */
+
/// Object owned by this @c Value_Ptr.
T * p_;
+
};
+
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_VALUE_PTR_H */
diff --git a/dep/ACE_wrappers/ace/Vector_T.h b/dep/ACE_wrappers/ace/Vector_T.h
index 8b2c9a1db51..7be43bfd631 100644
--- a/dep/ACE_wrappers/ace/Vector_T.h
+++ b/dep/ACE_wrappers/ace/Vector_T.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file Vector_T.h
@@ -9,20 +10,28 @@
* @author Gonzalo Diethelm <gonzalo.diethelm@aditiva.com>
*/
//==========================================================================
+
#ifndef ACE_VECTOR_T_H
#define ACE_VECTOR_T_H
+
#include /**/ "ace/pre.h"
+
#include "ace/Array.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/*
* Default size for an ACE_Vector.
*/
static const size_t ACE_VECTOR_DEFAULT_SIZE = 32;
+
// Forward declaration.
template <class T, size_t DEFAULT_SIZE> class ACE_Vector_Iterator;
+
/**
* @class ACE_Vector
*
@@ -66,6 +75,7 @@ public:
*/
typedef ACE_Vector_Iterator<T, DEFAULT_SIZE> Iterator;
+
/**
* General constructor.
*
@@ -76,10 +86,12 @@ public:
*/
ACE_Vector (const size_t init_size = DEFAULT_SIZE,
ACE_Allocator* alloc = 0);
+
/**
* Destructor.
*/
~ACE_Vector ();
+
/**
* Returns the current vector capacity, that is, the currently
* allocated buffer size.
@@ -87,6 +99,7 @@ public:
* @return Current buffer size of the vector
*/
size_t capacity (void) const;
+
/**
* Returns the vector's dynamic size / actual current size of the
* vector. Do not confuse it with ACE_Array::size(), which returns
@@ -96,11 +109,13 @@ public:
* @return Dynamic size / actual current size of the vector.
*/
size_t size (void) const;
+
/**
* Clears out the vector. It does not reallocate the vector's
* buffer, it is just sets the vector's dynamic size to 0.
*/
void clear (void);
+
/**
* Resizes the vector to the new capacity. If the vector's current
* capacity is smaller than the size to be specified, then the
@@ -116,6 +131,7 @@ public:
*/
void resize (const size_t new_size,
const T& t);
+
/**
* Appends a new element to the vector ("push back"). If the
* dynamic size of the vector is equal to the capacity of the vector
@@ -127,6 +143,7 @@ public:
* default value of the class T.
*/
void push_back (const T& elem);
+
/**
* Deletes the last element from the vector ("pop back"). What this
* function really does is decrement the dynamic size of the
@@ -134,6 +151,7 @@ public:
* performance.
*/
void pop_back (void);
+
/**
* This function dumps the content of the vector. TO BE MOVED out
* of this class. It needs to be implemented as a global template
@@ -149,13 +167,16 @@ public:
* This function calls T::dump() for each element of the vector.
*/
void dump (void) const;
+
// = Compare operators
+
///Equality comparison operator.
/**
* Compare this vector with @arg s for equality. Two vectors are equal
* if their sizes are equal and all the elements are equal.
*/
bool operator== (const ACE_Vector<T, DEFAULT_SIZE> &s) const;
+
///Inequality comparison operator.
/**
* Compare this vector with @arg s for inequality such that @c *this !=
@@ -163,23 +184,30 @@ public:
* @c *this == @arg s.
*/
bool operator!= (const ACE_Vector<T, DEFAULT_SIZE> &s) const;
+
void swap (ACE_Vector &rhs);
+
protected:
+
/**
* Dynamic size (length) of the vector.
*/
size_t length_;
+
/**
* Current capacity (buffer size) of the vector.
*/
size_t curr_max_size_;
+
friend class ACE_Vector_Iterator<T, DEFAULT_SIZE>;
};
+
#if 0
/*
* Not sure about including these functions, if for no other reason,
* because they polute the global namespace!
*/
+
/**
* Compare two vectors in the range of [from_ndx..to_ndx]. This
* template function requires class T to have the bool operator!=()
@@ -201,6 +229,7 @@ int compare (const ACE_Vector<T>& v1,
const ACE_Vector<T>& v2,
const size_t from_ndx,
const size_t to_ndx);
+
/**
* Does a partial comparison of two vectors in the range of
* [from_ndx..to_ndx]. The only difference between this function and
@@ -216,6 +245,7 @@ int compare (const ACE_Vector<T>& v1,
* @return Returns true if vector v1 and v2 are equal in the specified
* index range.
*/
+
template<class T>
int partial_compare (const ACE_Vector<T>& v1,
const ACE_Vector<T>& v2,
@@ -223,6 +253,7 @@ int partial_compare (const ACE_Vector<T>& v1,
const size_t to_ndx);
#endif /* 0 */
// ****************************************************************
+
/**
* @class ACE_Vector_Iterator
*
@@ -238,35 +269,49 @@ class ACE_Vector_Iterator
public:
// = Initialization method.
ACE_Vector_Iterator (ACE_Vector<T, DEFAULT_SIZE> &);
+
// = Iteration methods.
+
/// Pass back the <next_item> that hasn't been seen in the vector.
/// Returns 0 when all items have been seen, else 1.
int next (T *&next_item);
+
/// Move forward by one element in the vector. Returns 0 when all the
/// items in the vector have been seen, else 1.
int advance (void);
+
/// Returns 1 when all items have been seen, else 0.
int done (void) const;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
private:
/// Pointer to the current item in the iteration.
size_t current_;
+
/// Reference to the vector we're iterating over.
ACE_Vector<T, DEFAULT_SIZE> &vector_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/Vector_T.inl"
#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Vector_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Vector_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_VECTOR_T_H */
diff --git a/dep/ACE_wrappers/ace/Vector_T.inl b/dep/ACE_wrappers/ace/Vector_T.inl
index 9ddbd308d27..4b773109a84 100644
--- a/dep/ACE_wrappers/ace/Vector_T.inl
+++ b/dep/ACE_wrappers/ace/Vector_T.inl
@@ -1,8 +1,11 @@
// -*- C++ -*-
//
// $Id: Vector_T.inl 81478 2008-04-28 13:22:26Z schmidt $
+
#include <algorithm>
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
template <class T, size_t DEFAULT_SIZE> ACE_INLINE
ACE_Vector<T, DEFAULT_SIZE>::ACE_Vector (const size_t init_size,
ACE_Allocator* alloc)
@@ -11,25 +14,30 @@ ACE_Vector<T, DEFAULT_SIZE>::ACE_Vector (const size_t init_size,
{
this->curr_max_size_ = this->max_size ();
}
+
template <class T, size_t DEFAULT_SIZE> ACE_INLINE
ACE_Vector<T, DEFAULT_SIZE>::~ACE_Vector ()
{
}
+
template <class T, size_t DEFAULT_SIZE> ACE_INLINE
size_t ACE_Vector<T, DEFAULT_SIZE>::capacity (void) const
{
return curr_max_size_;
}
+
template <class T, size_t DEFAULT_SIZE> ACE_INLINE
size_t ACE_Vector<T, DEFAULT_SIZE>::size (void) const
{
return length_;
}
+
template <class T, size_t DEFAULT_SIZE> ACE_INLINE
void ACE_Vector<T, DEFAULT_SIZE>::clear (void)
{
length_ = 0;
}
+
template <class T, size_t DEFAULT_SIZE> ACE_INLINE
void ACE_Vector<T, DEFAULT_SIZE>::pop_back (void)
{
@@ -39,12 +47,15 @@ void ACE_Vector<T, DEFAULT_SIZE>::pop_back (void)
ACE_Array<T>::size (length_);
}
}
+
// Compare this vector with <s> for inequality.
+
template <class T, size_t DEFAULT_SIZE> ACE_INLINE bool
ACE_Vector<T, DEFAULT_SIZE>::operator!= (const ACE_Vector<T, DEFAULT_SIZE> &s) const
{
return !(*this == s);
}
+
template <class T, size_t DEFAULT_SIZE> ACE_INLINE void
ACE_Vector<T, DEFAULT_SIZE>::swap (ACE_Vector &rhs)
{
@@ -52,12 +63,15 @@ ACE_Vector<T, DEFAULT_SIZE>::swap (ACE_Vector &rhs)
std::swap (this->length_, rhs.length_);
std::swap (this->curr_max_size_, rhs.curr_max_size_);
}
+
// ****************************************************************
+
template <class T, size_t DEFAULT_SIZE> ACE_INLINE void
ACE_Vector_Iterator<T, DEFAULT_SIZE>::dump (void) const
{
// ACE_TRACE ("ACE_Vector_Iterator<T>::dump");
}
+
template <class T, size_t DEFAULT_SIZE> ACE_INLINE
ACE_Vector_Iterator<T, DEFAULT_SIZE>::ACE_Vector_Iterator (ACE_Vector<T, DEFAULT_SIZE> &v)
: current_ (0),
@@ -65,10 +79,12 @@ ACE_Vector_Iterator<T, DEFAULT_SIZE>::ACE_Vector_Iterator (ACE_Vector<T, DEFAULT
{
// ACE_TRACE ("ACE_Vector_Iterator<T>::ACE_Vector_Iterator");
}
+
template <class T, size_t DEFAULT_SIZE> ACE_INLINE int
ACE_Vector_Iterator<T, DEFAULT_SIZE>::advance (void)
{
// ACE_TRACE ("ACE_Vector_Iterator<T>::advance");
+
if (this->current_ < vector_.size ())
{
++this->current_;
@@ -78,11 +94,14 @@ ACE_Vector_Iterator<T, DEFAULT_SIZE>::advance (void)
// Already finished iterating.
return 0;
}
+
template <class T, size_t DEFAULT_SIZE> ACE_INLINE int
ACE_Vector_Iterator<T, DEFAULT_SIZE>::done (void) const
{
ACE_TRACE ("ACE_Vector_Iterator<T>::done");
+
return this->current_ >= vector_.size ();
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/Version.h b/dep/ACE_wrappers/ace/Version.h
index 8fe7029d442..ff3f3e64074 100644
--- a/dep/ACE_wrappers/ace/Version.h
+++ b/dep/ACE_wrappers/ace/Version.h
@@ -2,6 +2,7 @@
// -*- C++ -*-
// $Id: Version.h 82705 2008-09-15 11:08:20Z sma $
// This is file was automatically generated by \$ACE_ROOT/bin/make_release.
+
#define ACE_MAJOR_VERSION 5
#define ACE_MINOR_VERSION 6
#define ACE_BETA_VERSION 6
diff --git a/dep/ACE_wrappers/ace/Versioned_Namespace.h b/dep/ACE_wrappers/ace/Versioned_Namespace.h
index 7e13cf0bcc4..9b71d0111fc 100644
--- a/dep/ACE_wrappers/ace/Versioned_Namespace.h
+++ b/dep/ACE_wrappers/ace/Versioned_Namespace.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file Versioned_Namespace.h
@@ -12,15 +13,20 @@
* @author Ossama Othman <ossama@dre.vanderbilt.edu>
*/
//=============================================================================
+
#ifndef ACE_VERSIONED_NAMESPACE_H
#define ACE_VERSIONED_NAMESPACE_H
+
#ifndef ACE_CONFIG_MACROS_H
# error This header is only meant to be included by or after "ace/config-lite.h".
#endif /* !ACE_CONFIG_LITE_H */
+
#if defined (ACE_HAS_VERSIONED_NAMESPACE) && ACE_HAS_VERSIONED_NAMESPACE == 1
+
# ifndef ACE_VERSIONED_NAMESPACE_NAME
//# include "ace/Version.h"
+
// Preprocessor symbols will not be expanded if they are
// concatenated. Force the preprocessor to expand them during the
// argument prescan by calling a macro that itself calls another that
@@ -29,13 +35,18 @@
# define ACE_MAKE_VERSIONED_NAMESPACE_NAME(MAJOR,MINOR,BETA) ACE_MAKE_VERSIONED_NAMESPACE_NAME_IMPL(MAJOR,MINOR,BETA)
# define ACE_VERSIONED_NAMESPACE_NAME ACE_MAKE_VERSIONED_NAMESPACE_NAME(ACE_MAJOR_VERSION,ACE_MINOR_VERSION,ACE_BETA_VERSION)
# endif /* !ACE_VERSIONED_NAMESPACE_NAME */
+
# define ACE_BEGIN_VERSIONED_NAMESPACE_DECL namespace ACE_VERSIONED_NAMESPACE_NAME {
# define ACE_END_VERSIONED_NAMESPACE_DECL } \
using namespace ACE_VERSIONED_NAMESPACE_NAME;
+
#else
+
# define ACE_VERSIONED_NAMESPACE_NAME
# define ACE_BEGIN_VERSIONED_NAMESPACE_DECL
# define ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_VERSIONED_NAMESPACE */
+
#endif /* !ACE_VERSIONED_NAMESPACE_H */
diff --git a/dep/ACE_wrappers/ace/WFMO_Reactor.cpp b/dep/ACE_wrappers/ace/WFMO_Reactor.cpp
index 09cc83eb982..7355a025bbd 100644
--- a/dep/ACE_wrappers/ace/WFMO_Reactor.cpp
+++ b/dep/ACE_wrappers/ace/WFMO_Reactor.cpp
@@ -1,21 +1,30 @@
// $Id: WFMO_Reactor.cpp 81138 2008-03-28 09:18:15Z johnnyw $
+
#include "ace/WFMO_Reactor.h"
+
#if defined (ACE_WIN32)
+
#include "ace/Handle_Set.h"
#include "ace/Timer_Heap.h"
#include "ace/Thread.h"
#include "ace/OS_NS_errno.h"
#include "ace/Null_Condition.h"
+
#if !defined (__ACE_INLINE__)
#include "ace/WFMO_Reactor.inl"
#endif /* __ACE_INLINE__ */
+
ACE_RCSID(ace, WFMO_Reactor, "$Id: WFMO_Reactor.cpp 81138 2008-03-28 09:18:15Z johnnyw $")
+
#include "ace/Auto_Ptr.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_WFMO_Reactor_Handler_Repository::ACE_WFMO_Reactor_Handler_Repository (ACE_WFMO_Reactor &wfmo_reactor)
: wfmo_reactor_ (wfmo_reactor)
{
}
+
int
ACE_WFMO_Reactor_Handler_Repository::open (size_t size)
{
@@ -25,6 +34,7 @@ ACE_WFMO_Reactor_Handler_Repository::open (size_t size)
size,
MAXIMUM_WAIT_OBJECTS),
-1);
+
// Dynamic allocation
ACE_NEW_RETURN (this->current_handles_,
ACE_HANDLE[size],
@@ -38,6 +48,7 @@ ACE_WFMO_Reactor_Handler_Repository::open (size_t size)
ACE_NEW_RETURN (this->to_be_added_info_,
To_Be_Added_Info[size],
-1);
+
// Initialization
this->max_size_ = size;
this->max_handlep1_ = 0;
@@ -46,10 +57,13 @@ ACE_WFMO_Reactor_Handler_Repository::open (size_t size)
this->handles_to_be_deleted_ = 0;
this->handles_to_be_suspended_ = 0;
this->handles_to_be_resumed_ = 0;
+
for (size_t i = 0; i < size; ++i)
this->current_handles_[i] = ACE_INVALID_HANDLE;
+
return 0;
}
+
ACE_WFMO_Reactor_Handler_Repository::~ACE_WFMO_Reactor_Handler_Repository (void)
{
// Free up dynamically allocated space
@@ -58,6 +72,7 @@ ACE_WFMO_Reactor_Handler_Repository::~ACE_WFMO_Reactor_Handler_Repository (void)
delete [] this->current_suspended_info_;
delete [] this->to_be_added_info_;
}
+
ACE_Reactor_Mask
ACE_WFMO_Reactor_Handler_Repository::bit_ops (long &existing_masks,
ACE_Reactor_Mask change_masks,
@@ -65,90 +80,127 @@ ACE_WFMO_Reactor_Handler_Repository::bit_ops (long &existing_masks,
{
// Find the old reactor masks. This automatically does the work of
// the GET_MASK operation.
+
ACE_Reactor_Mask old_masks = ACE_Event_Handler::NULL_MASK;
+
if (ACE_BIT_ENABLED (existing_masks, FD_READ)
|| ACE_BIT_ENABLED (existing_masks, FD_CLOSE))
ACE_SET_BITS (old_masks, ACE_Event_Handler::READ_MASK);
+
if (ACE_BIT_ENABLED (existing_masks, FD_WRITE))
ACE_SET_BITS (old_masks, ACE_Event_Handler::WRITE_MASK);
+
if (ACE_BIT_ENABLED (existing_masks, FD_OOB))
ACE_SET_BITS (old_masks, ACE_Event_Handler::EXCEPT_MASK);
+
if (ACE_BIT_ENABLED (existing_masks, FD_ACCEPT))
ACE_SET_BITS (old_masks, ACE_Event_Handler::ACCEPT_MASK);
+
if (ACE_BIT_ENABLED (existing_masks, FD_CONNECT))
ACE_SET_BITS (old_masks, ACE_Event_Handler::CONNECT_MASK);
+
if (ACE_BIT_ENABLED (existing_masks, FD_QOS))
ACE_SET_BITS (old_masks, ACE_Event_Handler::QOS_MASK);
+
if (ACE_BIT_ENABLED (existing_masks, FD_GROUP_QOS))
ACE_SET_BITS (old_masks, ACE_Event_Handler::GROUP_QOS_MASK);
+
switch (operation)
{
case ACE_Reactor::CLR_MASK:
// For the CLR_MASK operation, clear only the specific masks.
+
if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::READ_MASK))
{
ACE_CLR_BITS (existing_masks, FD_READ);
ACE_CLR_BITS (existing_masks, FD_CLOSE);
}
+
if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::WRITE_MASK))
ACE_CLR_BITS (existing_masks, FD_WRITE);
+
if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::EXCEPT_MASK))
ACE_CLR_BITS (existing_masks, FD_OOB);
+
if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::ACCEPT_MASK))
ACE_CLR_BITS (existing_masks, FD_ACCEPT);
+
if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::CONNECT_MASK))
ACE_CLR_BITS (existing_masks, FD_CONNECT);
+
if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::QOS_MASK))
ACE_CLR_BITS (existing_masks, FD_QOS);
+
if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::GROUP_QOS_MASK))
ACE_CLR_BITS (existing_masks, FD_GROUP_QOS);
+
break;
+
case ACE_Reactor::SET_MASK:
// If the operation is a set, first reset any existing masks
+
existing_masks = 0;
/* FALLTHRU */
+
case ACE_Reactor::ADD_MASK:
// For the ADD_MASK and the SET_MASK operation, add only the
// specific masks.
+
if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::READ_MASK))
{
ACE_SET_BITS (existing_masks, FD_READ);
ACE_SET_BITS (existing_masks, FD_CLOSE);
}
+
if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::WRITE_MASK))
ACE_SET_BITS (existing_masks, FD_WRITE);
+
if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::EXCEPT_MASK))
ACE_SET_BITS (existing_masks, FD_OOB);
+
if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::ACCEPT_MASK))
ACE_SET_BITS (existing_masks, FD_ACCEPT);
+
if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::CONNECT_MASK))
ACE_SET_BITS (existing_masks, FD_CONNECT);
+
if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::QOS_MASK))
ACE_SET_BITS (existing_masks, FD_QOS);
+
if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::GROUP_QOS_MASK))
ACE_SET_BITS (existing_masks, FD_GROUP_QOS);
+
break;
+
case ACE_Reactor::GET_MASK:
+
// The work for this operation is done in all cases at the
// begining of the function.
+
ACE_UNUSED_ARG (change_masks);
+
break;
}
+
return old_masks;
}
+
int
ACE_WFMO_Reactor_Handler_Repository::unbind_i (ACE_HANDLE handle,
ACE_Reactor_Mask mask,
bool &changes_required)
{
int error = 0;
+
// Remember this value; only if it changes do we need to wakeup
// the other threads
size_t const original_handle_count = this->handles_to_be_deleted_;
size_t i;
+
// Go through all the handles looking for <handle>. Even if we find
// it, we continue through the rest of the list since <handle> could
// appear multiple times. All handles are checked.
+
// First check the current entries
for (i = 0; i < this->max_handlep1_ && error == 0; ++i)
// Since the handle can either be the event or the I/O handle,
@@ -161,6 +213,7 @@ ACE_WFMO_Reactor_Handler_Repository::unbind_i (ACE_HANDLE handle,
if (this->remove_handler_i (i, mask) == -1)
error = 1;
}
+
// Then check the suspended entries
for (i = 0; i < this->suspended_handles_ && error == 0; ++i)
// Since the handle can either be the event or the I/O handle, we
@@ -174,6 +227,7 @@ ACE_WFMO_Reactor_Handler_Repository::unbind_i (ACE_HANDLE handle,
if (this->remove_suspended_handler_i (i, mask) == -1)
error = 1;
}
+
// Then check the to_be_added entries
for (i = 0; i < this->handles_to_be_added_ && error == 0; ++i)
// Since the handle can either be the event or the I/O handle,
@@ -187,12 +241,15 @@ ACE_WFMO_Reactor_Handler_Repository::unbind_i (ACE_HANDLE handle,
if (this->remove_to_be_added_handler_i (i, mask) == -1)
error = 1;
}
+
// Only if the number of handlers to be deleted changes do we need
// to wakeup the other threads
if (original_handle_count < this->handles_to_be_deleted_)
changes_required = true;
+
return error ? -1 : 0;
}
+
int
ACE_WFMO_Reactor_Handler_Repository::remove_handler_i (size_t slot,
ACE_Reactor_Mask to_be_removed_masks)
@@ -205,6 +262,7 @@ ACE_WFMO_Reactor_Handler_Repository::remove_handler_i (size_t slot,
this->bit_ops (this->current_info_[slot].network_events_,
to_be_removed_masks,
ACE_Reactor::CLR_MASK);
+
// Disassociate/Reassociate the event from/with the I/O handle.
// This will depend on the value of remaining set of network
// events that the <event_handler> is interested in. I don't
@@ -221,6 +279,7 @@ ACE_WFMO_Reactor_Handler_Repository::remove_handler_i (size_t slot,
else
// Make sure that the <to_be_removed_masks> is the NULL_MASK
to_be_removed_masks = ACE_Event_Handler::NULL_MASK;
+
// If this event was marked for suspension, undo the suspension flag
// and reduce the to be suspended count.
if (this->current_info_[slot].suspend_entry_)
@@ -230,6 +289,7 @@ ACE_WFMO_Reactor_Handler_Repository::remove_handler_i (size_t slot,
// Decrement the handle count
--this->handles_to_be_suspended_;
}
+
// If there are no more events that the <Event_Handler> is
// interested in, or this is a non-I/O entry, schedule the
// <Event_Handler> for removal
@@ -242,6 +302,7 @@ ACE_WFMO_Reactor_Handler_Repository::remove_handler_i (size_t slot,
// Increment the handle count
++this->handles_to_be_deleted_;
}
+
// Since it is not a complete removal, we'll call handle_close
// for all the masks that were removed. This does not change
// the internal state of the reactor.
@@ -253,8 +314,10 @@ ACE_WFMO_Reactor_Handler_Repository::remove_handler_i (size_t slot,
this->current_info_[slot].event_handler_->handle_close (handle,
to_be_removed_masks);
}
+
return 0;
}
+
int
ACE_WFMO_Reactor_Handler_Repository::remove_suspended_handler_i (size_t slot,
ACE_Reactor_Mask to_be_removed_masks)
@@ -267,6 +330,7 @@ ACE_WFMO_Reactor_Handler_Repository::remove_suspended_handler_i (size_t slot,
this->bit_ops (this->current_suspended_info_[slot].network_events_,
to_be_removed_masks,
ACE_Reactor::CLR_MASK);
+
// Disassociate/Reassociate the event from/with the I/O handle.
// This will depend on the value of remaining set of network
// events that the <event_handler> is interested in. I don't
@@ -283,6 +347,7 @@ ACE_WFMO_Reactor_Handler_Repository::remove_suspended_handler_i (size_t slot,
else
// Make sure that the <to_be_removed_masks> is the NULL_MASK
to_be_removed_masks = ACE_Event_Handler::NULL_MASK;
+
// If this event was marked for resumption, undo the resumption flag
// and reduce the to be resumed count.
if (this->current_suspended_info_[slot].resume_entry_)
@@ -292,6 +357,7 @@ ACE_WFMO_Reactor_Handler_Repository::remove_suspended_handler_i (size_t slot,
// Decrement the handle count
--this->handles_to_be_resumed_;
}
+
// If there are no more events that the <Event_Handler> is
// interested in, or this is a non-I/O entry, schedule the
// <Event_Handler> for removal
@@ -315,8 +381,10 @@ ACE_WFMO_Reactor_Handler_Repository::remove_suspended_handler_i (size_t slot,
this->current_suspended_info_[slot].event_handler_->handle_close (handle,
to_be_removed_masks);
}
+
return 0;
}
+
int
ACE_WFMO_Reactor_Handler_Repository::remove_to_be_added_handler_i (size_t slot,
ACE_Reactor_Mask to_be_removed_masks)
@@ -329,6 +397,7 @@ ACE_WFMO_Reactor_Handler_Repository::remove_to_be_added_handler_i (size_t slot,
this->bit_ops (this->to_be_added_info_[slot].network_events_,
to_be_removed_masks,
ACE_Reactor::CLR_MASK);
+
// Disassociate/Reassociate the event from/with the I/O handle.
// This will depend on the value of remaining set of network
// events that the <event_handler> is interested in. I don't
@@ -345,6 +414,7 @@ ACE_WFMO_Reactor_Handler_Repository::remove_to_be_added_handler_i (size_t slot,
else
// Make sure that the <to_be_removed_masks> is the NULL_MASK
to_be_removed_masks = ACE_Event_Handler::NULL_MASK;
+
// If this event was marked for suspension, undo the suspension flag
// and reduce the to be suspended count.
if (this->to_be_added_info_[slot].suspend_entry_)
@@ -354,6 +424,7 @@ ACE_WFMO_Reactor_Handler_Repository::remove_to_be_added_handler_i (size_t slot,
// Decrement the handle count
--this->handles_to_be_suspended_;
}
+
// If there are no more events that the <Event_Handler> is
// interested in, or this is a non-I/O entry, schedule the
// <Event_Handler> for removal
@@ -377,16 +448,20 @@ ACE_WFMO_Reactor_Handler_Repository::remove_to_be_added_handler_i (size_t slot,
this->to_be_added_info_[slot].event_handler_->handle_close (handle,
to_be_removed_masks);
}
+
return 0;
}
+
int
ACE_WFMO_Reactor_Handler_Repository::suspend_handler_i (ACE_HANDLE handle,
bool &changes_required)
{
size_t i = 0;
+
// Go through all the handles looking for <handle>. Even if we find
// it, we continue through the rest of the list since <handle> could
// appear multiple times. All handles are checked.
+
// Check the current entries first.
for (i = 0; i < this->max_handlep1_; ++i)
// Since the handle can either be the event or the I/O handle,
@@ -403,6 +478,7 @@ ACE_WFMO_Reactor_Handler_Repository::suspend_handler_i (ACE_HANDLE handle,
// Changes will be required
changes_required = true;
}
+
// Then check the suspended entries.
for (i = 0; i < this->suspended_handles_; ++i)
// Since the handle can either be the event or the I/O handle,
@@ -419,6 +495,7 @@ ACE_WFMO_Reactor_Handler_Repository::suspend_handler_i (ACE_HANDLE handle,
// Changes will be required
changes_required = true;
}
+
// Then check the to_be_added entries.
for (i = 0; i < this->handles_to_be_added_; ++i)
// Since the handle can either be the event or the I/O handle,
@@ -435,16 +512,20 @@ ACE_WFMO_Reactor_Handler_Repository::suspend_handler_i (ACE_HANDLE handle,
// Changes will be required
changes_required = true;
}
+
return 0;
}
+
int
ACE_WFMO_Reactor_Handler_Repository::resume_handler_i (ACE_HANDLE handle,
bool &changes_required)
{
size_t i = 0;
+
// Go through all the handles looking for <handle>. Even if we find
// it, we continue through the rest of the list since <handle> could
// appear multiple times. All handles are checked.
+
// Check the current entries first.
for (i = 0; i < this->max_handlep1_; ++i)
// Since the handle can either be the event or the I/O handle,
@@ -461,6 +542,7 @@ ACE_WFMO_Reactor_Handler_Repository::resume_handler_i (ACE_HANDLE handle,
// Changes will be required
changes_required = true;
}
+
// Then check the suspended entries.
for (i = 0; i < this->suspended_handles_; ++i)
// Since the handle can either be the event or the I/O handle,
@@ -477,6 +559,7 @@ ACE_WFMO_Reactor_Handler_Repository::resume_handler_i (ACE_HANDLE handle,
// Changes will be required
changes_required = true;
}
+
// Then check the to_be_added entries.
for (i = 0; i < this->handles_to_be_added_; ++i)
// Since the handle can either be the event or the I/O handle,
@@ -493,36 +576,45 @@ ACE_WFMO_Reactor_Handler_Repository::resume_handler_i (ACE_HANDLE handle,
// Changes will be required
changes_required = true;
}
+
return 0;
}
+
void
ACE_WFMO_Reactor_Handler_Repository::unbind_all (void)
{
{
ACE_GUARD (ACE_Process_Mutex, ace_mon, this->wfmo_reactor_.lock_);
+
bool dummy;
size_t i;
+
// Remove all the current handlers
for (i = 0; i < this->max_handlep1_; ++i)
this->unbind_i (this->current_handles_[i],
ACE_Event_Handler::ALL_EVENTS_MASK,
dummy);
+
// Remove all the suspended handlers
for (i = 0; i < this->suspended_handles_; ++i)
this->unbind_i (this->current_suspended_info_[i].event_handle_,
ACE_Event_Handler::ALL_EVENTS_MASK,
dummy);
+
// Remove all the to_be_added handlers
for (i = 0; i < this->handles_to_be_added_; ++i)
this->unbind_i (this->to_be_added_info_[i].event_handle_,
ACE_Event_Handler::ALL_EVENTS_MASK,
dummy);
}
+
// The guard is released here
+
// Wake up all threads in WaitForMultipleObjects so that they can
// reconsult the handle set
this->wfmo_reactor_.wakeup_all_threads ();
}
+
int
ACE_WFMO_Reactor_Handler_Repository::bind_i (bool io_entry,
ACE_Event_Handler *event_handler,
@@ -533,15 +625,18 @@ ACE_WFMO_Reactor_Handler_Repository::bind_i (bool io_entry,
{
if (event_handler == 0)
return -1;
+
// Make sure that the <handle> is valid
if (event_handle == ACE_INVALID_HANDLE)
event_handle = event_handler->get_handle ();
if (this->invalid_handle (event_handle))
return -1;
+
size_t current_size = this->max_handlep1_ +
this->handles_to_be_added_ -
this->handles_to_be_deleted_ +
this->suspended_handles_;
+
// Make sure that there's room in the table and that total pending
// additions should not exceed what the <to_be_added_info_> array
// can hold.
@@ -556,8 +651,11 @@ ACE_WFMO_Reactor_Handler_Repository::bind_i (bool io_entry,
io_handle,
network_events,
delete_event);
+
++this->handles_to_be_added_;
+
event_handler->add_reference ();
+
// Wake up all threads in WaitForMultipleObjects so that they can
// reconsult the handle set
this->wfmo_reactor_.wakeup_all_threads ();
@@ -567,8 +665,10 @@ ACE_WFMO_Reactor_Handler_Repository::bind_i (bool io_entry,
errno = EMFILE; // File descriptor table is full (better than nothing)
return -1;
}
+
return 0;
}
+
int
ACE_WFMO_Reactor_Handler_Repository::make_changes_in_current_infos (void)
{
@@ -586,6 +686,7 @@ ACE_WFMO_Reactor_Handler_Repository::make_changes_in_current_infos (void)
ACE_HANDLE handle = ACE_INVALID_HANDLE;
ACE_Reactor_Mask masks = ACE_Event_Handler::NULL_MASK;
ACE_Event_Handler *event_handler = 0;
+
// See if this entry is scheduled for deletion
if (this->current_info_[i].delete_entry_)
{
@@ -604,15 +705,19 @@ ACE_WFMO_Reactor_Handler_Repository::make_changes_in_current_infos (void)
handle = this->current_info_[i].io_handle_;
else
handle = this->current_handles_[i];
+
// Event handler
event_handler = this->current_info_[i].event_handler_;
}
+
// If <WFMO_Reactor> created the event, we need to clean it up
if (this->current_info_[i].delete_event_)
ACE_OS::event_destroy (&this->current_handles_[i]);
+
// Reduce count by one
--this->handles_to_be_deleted_;
}
+
// See if this entry is scheduled for suspension
else if (this->current_info_[i].suspend_entry_)
{
@@ -620,9 +725,11 @@ ACE_WFMO_Reactor_Handler_Repository::make_changes_in_current_infos (void)
this->current_info_[i]);
// Increase number of suspended handles
++this->suspended_handles_;
+
// Reduce count by one
--this->handles_to_be_suspended_;
}
+
// See if this entry is scheduled for deletion or suspension
// If so we need to clean up
if (this->current_info_[i].delete_entry_ ||
@@ -652,6 +759,7 @@ ACE_WFMO_Reactor_Handler_Repository::make_changes_in_current_infos (void)
// handles.
++i;
}
+
// Now that all internal structures have been updated, make
// the upcall.
if (event_handler != 0)
@@ -659,7 +767,9 @@ ACE_WFMO_Reactor_Handler_Repository::make_changes_in_current_infos (void)
bool const requires_reference_counting =
event_handler->reference_counting_policy ().value () ==
ACE_Event_Handler::Reference_Counting_Policy::ENABLED;
+
event_handler->handle_close (handle, masks);
+
if (requires_reference_counting)
{
event_handler->remove_reference ();
@@ -667,8 +777,10 @@ ACE_WFMO_Reactor_Handler_Repository::make_changes_in_current_infos (void)
}
}
}
+
return 0;
}
+
int
ACE_WFMO_Reactor_Handler_Repository::make_changes_in_suspension_infos (void)
{
@@ -685,6 +797,7 @@ ACE_WFMO_Reactor_Handler_Repository::make_changes_in_suspension_infos (void)
ACE_HANDLE handle = ACE_INVALID_HANDLE;
ACE_Reactor_Mask masks = ACE_Event_Handler::NULL_MASK;
ACE_Event_Handler *event_handler = 0;
+
// See if this entry is scheduled for deletion
if (this->current_suspended_info_[i].delete_entry_)
{
@@ -703,15 +816,19 @@ ACE_WFMO_Reactor_Handler_Repository::make_changes_in_suspension_infos (void)
handle = this->current_suspended_info_[i].io_handle_;
else
handle = this->current_suspended_info_[i].event_handle_;
+
// Upcall
event_handler = this->current_suspended_info_[i].event_handler_;
}
+
// If <WFMO_Reactor> created the event, we need to clean it up
if (this->current_suspended_info_[i].delete_event_)
ACE_OS::event_destroy (&this->current_suspended_info_[i].event_handle_);
+
// Reduce count by one
--this->handles_to_be_deleted_;
}
+
else if (this->current_suspended_info_[i].resume_entry_)
{
// Add to the end of the current handles set
@@ -719,9 +836,11 @@ ACE_WFMO_Reactor_Handler_Repository::make_changes_in_suspension_infos (void)
// Struct copy
this->current_info_[this->max_handlep1_].set (this->current_suspended_info_[i]);
++this->max_handlep1_;
+
// Reduce count by one
--this->handles_to_be_resumed_;
}
+
// If an entry needs to be removed, either because it
// was deleted or resumed, remove it now before doing
// the upcall.
@@ -748,6 +867,7 @@ ACE_WFMO_Reactor_Handler_Repository::make_changes_in_suspension_infos (void)
// suspended handles.
++i;
}
+
// Now that all internal structures have been updated, make
// the upcall.
if (event_handler != 0)
@@ -755,7 +875,9 @@ ACE_WFMO_Reactor_Handler_Repository::make_changes_in_suspension_infos (void)
int requires_reference_counting =
event_handler->reference_counting_policy ().value () ==
ACE_Event_Handler::Reference_Counting_Policy::ENABLED;
+
event_handler->handle_close (handle, masks);
+
if (requires_reference_counting)
{
event_handler->remove_reference ();
@@ -763,8 +885,10 @@ ACE_WFMO_Reactor_Handler_Repository::make_changes_in_suspension_infos (void)
}
}
}
+
return 0;
}
+
int
ACE_WFMO_Reactor_Handler_Repository::make_changes_in_to_be_added_infos (void)
{
@@ -778,6 +902,7 @@ ACE_WFMO_Reactor_Handler_Repository::make_changes_in_to_be_added_infos (void)
ACE_HANDLE handle = ACE_INVALID_HANDLE;
ACE_Reactor_Mask masks = ACE_Event_Handler::NULL_MASK;
ACE_Event_Handler *event_handler = 0;
+
// See if this entry is scheduled for deletion
if (this->to_be_added_info_[i].delete_entry_)
{
@@ -796,15 +921,19 @@ ACE_WFMO_Reactor_Handler_Repository::make_changes_in_to_be_added_infos (void)
handle = this->to_be_added_info_[i].io_handle_;
else
handle = this->to_be_added_info_[i].event_handle_;
+
// Upcall
event_handler = this->to_be_added_info_[i].event_handler_;
}
+
// If <WFMO_Reactor> created the event, we need to clean it up
if (this->to_be_added_info_[i].delete_event_)
ACE_OS::event_destroy (&this->to_be_added_info_[i].event_handle_);
+
// Reduce count by one
--this->handles_to_be_deleted_;
}
+
// See if this entry is scheduled for suspension
else if (this->to_be_added_info_[i].suspend_entry_)
{
@@ -812,9 +941,11 @@ ACE_WFMO_Reactor_Handler_Repository::make_changes_in_to_be_added_infos (void)
this->to_be_added_info_[i]);
// Increase number of suspended handles
++this->suspended_handles_;
+
// Reduce count by one
--this->handles_to_be_suspended_;
}
+
// If neither of the two flags are on, add to current
else
{
@@ -824,8 +955,10 @@ ACE_WFMO_Reactor_Handler_Repository::make_changes_in_to_be_added_infos (void)
this->current_info_[this->max_handlep1_].set (this->to_be_added_info_[i]);
++this->max_handlep1_;
}
+
// Reset the <to_be_added_info_>
this->to_be_added_info_[i].reset ();
+
// Now that all internal structures have been updated, make the
// upcall.
if (event_handler != 0)
@@ -833,28 +966,37 @@ ACE_WFMO_Reactor_Handler_Repository::make_changes_in_to_be_added_infos (void)
int requires_reference_counting =
event_handler->reference_counting_policy ().value () ==
ACE_Event_Handler::Reference_Counting_Policy::ENABLED;
+
event_handler->handle_close (handle, masks);
+
if (requires_reference_counting)
{
event_handler->remove_reference ();
}
}
}
+
// Since all to be added handles have been taken care of, reset the
// counter
this->handles_to_be_added_ = 0;
+
return 0;
}
+
void
ACE_WFMO_Reactor_Handler_Repository::dump (void) const
{
#if defined (ACE_HAS_DUMP)
size_t i = 0;
+
ACE_TRACE ("ACE_WFMO_Reactor_Handler_Repository::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
+
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("Max size = %d\n"),
this->max_size_));
+
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("Current info table\n\n")));
ACE_DEBUG ((LM_DEBUG,
@@ -863,19 +1005,25 @@ ACE_WFMO_Reactor_Handler_Repository::dump (void) const
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("\tHandles to be suspended = %d\n"),
this->handles_to_be_suspended_));
+
for (i = 0; i < this->max_handlep1_; ++i)
this->current_info_[i].dump (this->current_handles_[i]);
+
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("\n")));
+
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("To-be-added info table\n\n")));
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("\tSize = %d\n"),
this->handles_to_be_added_));
+
for (i = 0; i < this->handles_to_be_added_; ++i)
this->to_be_added_info_[i].dump ();
+
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("\n")));
+
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("Suspended info table\n\n")));
ACE_DEBUG ((LM_DEBUG,
@@ -884,23 +1032,30 @@ ACE_WFMO_Reactor_Handler_Repository::dump (void) const
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("\tHandles to be resumed = %d\n"),
this->handles_to_be_resumed_));
+
for (i = 0; i < this->suspended_handles_; ++i)
this->current_suspended_info_[i].dump ();
+
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("\n")));
+
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("Total handles to be deleted = %d\n"),
this->handles_to_be_deleted_));
+
ACE_DEBUG ((LM_DEBUG,
ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
/************************************************************/
+
int
ACE_WFMO_Reactor::work_pending (const ACE_Time_Value &)
{
ACE_NOTSUP_RETURN (-1);
}
+
#if defined (ACE_WIN32_VC8)
# pragma warning (push)
# pragma warning (disable:4355) /* Use of 'this' in initializer list */
@@ -935,6 +1090,7 @@ ACE_WFMO_Reactor::ACE_WFMO_Reactor (ACE_Sig_Handler *sh,
ACE_TEXT ("%p\n"),
ACE_TEXT ("WFMO_Reactor")));
}
+
ACE_WFMO_Reactor::ACE_WFMO_Reactor (size_t size,
int unused,
ACE_Sig_Handler *sh,
@@ -963,6 +1119,7 @@ ACE_WFMO_Reactor::ACE_WFMO_Reactor (size_t size,
deactivated_ (0)
{
ACE_UNUSED_ARG (unused);
+
if (this->open (size, 0, sh, tq, 0, notify) == -1)
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("%p\n"),
@@ -971,11 +1128,13 @@ ACE_WFMO_Reactor::ACE_WFMO_Reactor (size_t size,
#if defined (ACE_WIN32_VC8)
# pragma warning (pop)
#endif
+
int
ACE_WFMO_Reactor::current_info (ACE_HANDLE, size_t &)
{
return -1;
}
+
int
ACE_WFMO_Reactor::open (size_t size,
int unused,
@@ -986,14 +1145,18 @@ ACE_WFMO_Reactor::open (size_t size,
{
ACE_UNUSED_ARG (unused);
ACE_UNUSED_ARG (disable_notify_pipe);
+
// This GUARD is necessary since we are updating shared state.
ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1);
+
// If we are already open, return -1
if (this->open_for_business_)
return -1;
+
// Timer Queue
if (this->delete_timer_queue_)
delete this->timer_queue_;
+
if (tq == 0)
{
ACE_NEW_RETURN (this->timer_queue_,
@@ -1006,9 +1169,11 @@ ACE_WFMO_Reactor::open (size_t size,
this->timer_queue_ = tq;
this->delete_timer_queue_ = false;
}
+
// Signal Handler
if (this->delete_signal_handler_)
delete this->signal_handler_;
+
if (sh == 0)
{
ACE_NEW_RETURN (this->signal_handler_,
@@ -1021,9 +1186,11 @@ ACE_WFMO_Reactor::open (size_t size,
this->signal_handler_ = sh;
this->delete_signal_handler_ = false;
}
+
// Setup the atomic wait array (used later in <handle_events>)
this->atomic_wait_array_[0] = this->lock_.lock ().proc_mutex_;
this->atomic_wait_array_[1] = this->ok_to_wait_.handle ();
+
// Prevent memory leaks when the ACE_WFMO_Reactor is reopened.
if (this->delete_handler_rep_)
{
@@ -1035,8 +1202,10 @@ ACE_WFMO_Reactor::open (size_t size,
// have completed
this->wakeup_all_threads_.reset ();
}
+
this->handler_rep_.~ACE_WFMO_Reactor_Handler_Repository ();
}
+
// Open the handle repository. Two additional handles for internal
// purposes
if (this->handler_rep_.open (size + 2) == -1)
@@ -1045,27 +1214,34 @@ ACE_WFMO_Reactor::open (size_t size,
-1);
else
this->delete_handler_rep_ = true;
+
if (this->notify_handler_ != 0 && this->delete_notify_handler_)
delete this->notify_handler_;
+
this->notify_handler_ = notify;
+
if (this->notify_handler_ == 0)
{
ACE_NEW_RETURN (this->notify_handler_,
ACE_WFMO_Reactor_Notify,
-1);
+
if (this->notify_handler_ == 0)
return -1;
else
this->delete_notify_handler_ = true;
}
+
/* NOTE */
// The order of the following two registrations is very important
+
// Open the notification handler
if (this->notify_handler_->open (this, this->timer_queue_) == -1)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("opening notify handler ")),
-1);
+
// Register for <wakeup_all_threads> event
if (this->register_handler (&this->wakeup_all_threads_handler_,
this->wakeup_all_threads_.handle ()) == -1)
@@ -1073,6 +1249,7 @@ ACE_WFMO_Reactor::open (size_t size,
ACE_TEXT ("%p\n"),
ACE_TEXT ("registering thread wakeup handler")),
-1);
+
// Since we have added two handles into the handler repository,
// update the <handler_repository_>
if (this->handler_rep_.changes_required ())
@@ -1083,10 +1260,13 @@ ACE_WFMO_Reactor::open (size_t size,
// have completed
this->wakeup_all_threads_.reset ();
}
+
// We are open for business
this->open_for_business_ = true;
+
return 0;
}
+
int
ACE_WFMO_Reactor::set_sig_handler (ACE_Sig_Handler *signal_handler)
{
@@ -1096,11 +1276,13 @@ ACE_WFMO_Reactor::set_sig_handler (ACE_Sig_Handler *signal_handler)
this->delete_signal_handler_ = false;
return 0;
}
+
ACE_Timer_Queue *
ACE_WFMO_Reactor::timer_queue (void) const
{
return this->timer_queue_;
}
+
int
ACE_WFMO_Reactor::timer_queue (ACE_Timer_Queue *tq)
{
@@ -1110,41 +1292,51 @@ ACE_WFMO_Reactor::timer_queue (ACE_Timer_Queue *tq)
this->delete_timer_queue_ = false;
return 0;
}
+
int
ACE_WFMO_Reactor::close (void)
{
// This GUARD is necessary since we are updating shared state.
ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1);
+
// If we are already closed, return error
if (!this->open_for_business_)
return -1;
+
// We are now closed
this->open_for_business_ = false;
// This will unregister all handles
this->handler_rep_.close ();
+
return 0;
}
+
ACE_WFMO_Reactor::~ACE_WFMO_Reactor (void)
{
// Assumption: No threads are left in the Reactor when this method
// is called (i.e., active_threads_ == 0)
+
// Close down
this->close ();
+
// Make necessary changes to the handler repository that we caused
// by <close>.
this->handler_rep_.make_changes ();
+
if (this->delete_timer_queue_)
{
delete this->timer_queue_;
this->timer_queue_ = 0;
this->delete_timer_queue_ = false;
}
+
if (this->delete_signal_handler_)
{
delete this->signal_handler_;
this->signal_handler_ = 0;
this->delete_signal_handler_ = false;
}
+
if (this->delete_notify_handler_)
{
delete this->notify_handler_;
@@ -1152,6 +1344,7 @@ ACE_WFMO_Reactor::~ACE_WFMO_Reactor (void)
this->delete_notify_handler_ = false;
}
}
+
int
ACE_WFMO_Reactor::register_handler_i (ACE_HANDLE event_handle,
ACE_HANDLE io_handle,
@@ -1161,24 +1354,31 @@ ACE_WFMO_Reactor::register_handler_i (ACE_HANDLE event_handle,
// If this is a Winsock 1 system, the underlying event assignment will
// not work, so don't try. Winsock 1 must use ACE_Select_Reactor for
// reacting to socket activity.
+
#if !defined (ACE_HAS_WINSOCK2) || (ACE_HAS_WINSOCK2 == 0)
+
ACE_UNUSED_ARG (event_handle);
ACE_UNUSED_ARG (io_handle);
ACE_UNUSED_ARG (event_handler);
ACE_UNUSED_ARG (new_masks);
ACE_NOTSUP_RETURN (-1);
+
#else
+
// Make sure that the <handle> is valid
if (io_handle == ACE_INVALID_HANDLE)
io_handle = event_handler->get_handle ();
+
if (this->handler_rep_.invalid_handle (io_handle))
{
errno = ERROR_INVALID_HANDLE;
return -1;
}
+
long new_network_events = 0;
bool delete_event = false;
auto_ptr <ACE_Auto_Event> event;
+
// Look up the repository to see if the <event_handler> is already
// there.
ACE_Reactor_Mask old_masks;
@@ -1189,6 +1389,7 @@ ACE_WFMO_Reactor::register_handler_i (ACE_HANDLE event_handle,
event_handle,
delete_event,
ACE_Reactor::ADD_MASK);
+
// Check to see if the user passed us a valid event; If not then we
// need to create one
if (event_handle == ACE_INVALID_HANDLE)
@@ -1200,6 +1401,7 @@ ACE_WFMO_Reactor::register_handler_i (ACE_HANDLE event_handle,
event_handle = event->handle ();
delete_event = true;
}
+
int result = ::WSAEventSelect ((SOCKET) io_handle,
event_handle,
new_network_events);
@@ -1234,8 +1436,11 @@ ACE_WFMO_Reactor::register_handler_i (ACE_HANDLE event_handle,
}
else
return -1;
+
#endif /* ACE_HAS_WINSOCK2 || ACE_HAS_WINSOCK2 == 0 */
+
}
+
int
ACE_WFMO_Reactor::mask_ops_i (ACE_HANDLE io_handle,
ACE_Reactor_Mask new_masks,
@@ -1244,9 +1449,11 @@ ACE_WFMO_Reactor::mask_ops_i (ACE_HANDLE io_handle,
// Make sure that the <handle> is valid
if (this->handler_rep_.invalid_handle (io_handle))
return -1;
+
long new_network_events = 0;
bool delete_event = false;
ACE_HANDLE event_handle = ACE_INVALID_HANDLE;
+
// Look up the repository to see if the <Event_Handler> is already
// there.
ACE_Reactor_Mask old_masks;
@@ -1271,6 +1478,8 @@ ACE_WFMO_Reactor::mask_ops_i (ACE_HANDLE io_handle,
return -1;
}
+
+
int
ACE_WFMO_Reactor_Handler_Repository::modify_network_events_i (ACE_HANDLE io_handle,
ACE_Reactor_Mask new_masks,
@@ -1283,6 +1492,7 @@ ACE_WFMO_Reactor_Handler_Repository::modify_network_events_i (ACE_HANDLE io_hand
long *modified_network_events = &new_network_events;
int found = 0;
size_t i;
+
// First go through the current entries
//
// Look for all entries in the current handles for matching handle
@@ -1296,6 +1506,7 @@ ACE_WFMO_Reactor_Handler_Repository::modify_network_events_i (ACE_HANDLE io_hand
delete_event = this->current_info_[i].delete_event_;
event_handle = this->current_handles_[i];
}
+
// Then pass through the suspended handles
//
// Look for all entries in the suspended handles for matching handle
@@ -1309,6 +1520,7 @@ ACE_WFMO_Reactor_Handler_Repository::modify_network_events_i (ACE_HANDLE io_hand
delete_event = this->current_suspended_info_[i].delete_event_;
event_handle = this->current_suspended_info_[i].event_handle_;
}
+
// Then check the to_be_added handles
//
// Look for all entries in the to_be_added handles for matching
@@ -1322,18 +1534,23 @@ ACE_WFMO_Reactor_Handler_Repository::modify_network_events_i (ACE_HANDLE io_hand
delete_event = this->to_be_added_info_[i].delete_event_;
event_handle = this->to_be_added_info_[i].event_handle_;
}
+
old_masks = this->bit_ops (*modified_network_events,
new_masks,
operation);
+
new_network_events = *modified_network_events;
+
return found;
}
+
ACE_Event_Handler *
ACE_WFMO_Reactor_Handler_Repository::find_handler (ACE_HANDLE handle)
{
long existing_masks_ignored = 0;
return this->handler (handle, existing_masks_ignored);
}
+
ACE_Event_Handler *
ACE_WFMO_Reactor_Handler_Repository::handler (ACE_HANDLE handle,
long &existing_masks)
@@ -1342,7 +1559,9 @@ ACE_WFMO_Reactor_Handler_Repository::handler (ACE_HANDLE handle,
size_t i = 0;
ACE_Event_Handler *event_handler = 0;
existing_masks = 0;
+
// Look for the handle first
+
// First go through the current entries
//
// Look for all entries in the current handles for matching handle
@@ -1356,6 +1575,7 @@ ACE_WFMO_Reactor_Handler_Repository::handler (ACE_HANDLE handle,
event_handler = this->current_info_[i].event_handler_;
existing_masks = this->current_info_[i].network_events_;
}
+
// Then pass through the suspended handles
//
// Look for all entries in the suspended handles for matching handle
@@ -1369,6 +1589,7 @@ ACE_WFMO_Reactor_Handler_Repository::handler (ACE_HANDLE handle,
event_handler = this->current_suspended_info_[i].event_handler_;
existing_masks = this->current_suspended_info_[i].network_events_;
}
+
// Then check the to_be_added handles
//
// Look for all entries in the to_be_added handles for matching
@@ -1382,10 +1603,13 @@ ACE_WFMO_Reactor_Handler_Repository::handler (ACE_HANDLE handle,
event_handler = this->to_be_added_info_[i].event_handler_;
existing_masks = this->to_be_added_info_[i].network_events_;
}
+
if (event_handler)
event_handler->add_reference ();
+
return event_handler;
}
+
int
ACE_WFMO_Reactor_Handler_Repository::handler (ACE_HANDLE handle,
ACE_Reactor_Mask user_masks,
@@ -1393,13 +1617,17 @@ ACE_WFMO_Reactor_Handler_Repository::handler (ACE_HANDLE handle,
{
long existing_masks = 0;
int found = 0;
+
ACE_Event_Handler_var safe_event_handler =
this->handler (handle,
existing_masks);
+
if (safe_event_handler.handler ())
found = 1;
+
if (!found)
return -1;
+
// Otherwise, make sure that the masks that the user is looking for
// are on.
if (found &&
@@ -1407,38 +1635,47 @@ ACE_WFMO_Reactor_Handler_Repository::handler (ACE_HANDLE handle,
if (!ACE_BIT_ENABLED (existing_masks, FD_READ) &&
!ACE_BIT_ENABLED (existing_masks, FD_CLOSE))
found = 0;
+
if (found &&
ACE_BIT_ENABLED (user_masks, ACE_Event_Handler::WRITE_MASK))
if (!ACE_BIT_ENABLED (existing_masks, FD_WRITE))
found = 0;
+
if (found &&
ACE_BIT_ENABLED (user_masks, ACE_Event_Handler::EXCEPT_MASK))
if (!ACE_BIT_ENABLED (existing_masks, FD_OOB))
found = 0;
+
if (found &&
ACE_BIT_ENABLED (user_masks, ACE_Event_Handler::ACCEPT_MASK))
if (!ACE_BIT_ENABLED (existing_masks, FD_ACCEPT))
found = 0;
+
if (found &&
ACE_BIT_ENABLED (user_masks, ACE_Event_Handler::CONNECT_MASK))
if (!ACE_BIT_ENABLED (existing_masks, FD_CONNECT))
found = 0;
+
if (found &&
ACE_BIT_ENABLED (user_masks, ACE_Event_Handler::QOS_MASK))
if (!ACE_BIT_ENABLED (existing_masks, FD_QOS))
found = 0;
+
if (found &&
ACE_BIT_ENABLED (user_masks, ACE_Event_Handler::GROUP_QOS_MASK))
if (!ACE_BIT_ENABLED (existing_masks, FD_GROUP_QOS))
found = 0;
+
if (found &&
user_event_handler)
*user_event_handler = safe_event_handler.release ();
+
if (found)
return 0;
else
return -1;
}
+
// Waits for and dispatches all events. Returns -1 on error, 0 if
// max_wait_time expired, or the number of events that were dispatched.
int
@@ -1446,13 +1683,16 @@ ACE_WFMO_Reactor::event_handling (ACE_Time_Value *max_wait_time,
int alertable)
{
ACE_TRACE ("ACE_WFMO_Reactor::event_handling");
+
// Make sure we are not closed
if (!this->open_for_business_ || this->deactivated_)
return -1;
+
// Stash the current time -- the destructor of this object will
// automatically compute how much time elapsed since this method was
// called.
ACE_Countdown_Time countdown (max_wait_time);
+
int result;
do
{
@@ -1462,18 +1702,24 @@ ACE_WFMO_Reactor::event_handling (ACE_Time_Value *max_wait_time,
result = this->ok_to_wait (max_wait_time, alertable);
if (result != 1)
return result;
+
// Increment the number of active threads
++this->active_threads_;
+
// Release the <lock_>
this->lock_.release ();
+
// Update the countdown to reflect time waiting to play with the
// mut and event.
countdown.update ();
+
// Calculate timeout
int timeout = this->calculate_timeout (max_wait_time);
+
// Wait for event to happen
DWORD wait_status = this->wait_for_multiple_events (timeout,
alertable);
+
// Upcall
result = this->safe_dispatch (wait_status);
if (0 == result)
@@ -1492,8 +1738,10 @@ ACE_WFMO_Reactor::event_handling (ACE_Time_Value *max_wait_time,
}
}
while (result == 0);
+
return result;
}
+
int
ACE_WFMO_Reactor::ok_to_wait (ACE_Time_Value *max_wait_time,
int alertable)
@@ -1503,6 +1751,7 @@ ACE_WFMO_Reactor::ok_to_wait (ACE_Time_Value *max_wait_time,
// Note: There is really no need to involve the <timer_queue_> here
// because even if a timeout in the <timer_queue_> does expire we
// will not be able to dispatch it
+
// We need to wait for both the <lock_> and <ok_to_wait_> event.
// If not on WinCE, use WaitForMultipleObjects() to wait for both atomically.
// On WinCE, the waitAll arg to WFMO must be false, so wait for the
@@ -1530,6 +1779,7 @@ ACE_WFMO_Reactor::ok_to_wait (ACE_Time_Value *max_wait_time,
status = this->lock_.acquire (timeout);
if (status == -1)
return -1;
+
// Have the lock_, now re-check the event. If it's not signaled,
// another thread changed something so go back and wait again.
ACE_Time_Value poll_it = ACE_OS::gettimeofday ();
@@ -1538,6 +1788,7 @@ ACE_WFMO_Reactor::ok_to_wait (ACE_Time_Value *max_wait_time,
this->lock_.release ();
}
return 1;
+
#else
int timeout = max_wait_time == 0 ? INFINITE : max_wait_time->msec ();
DWORD result = 0;
@@ -1550,18 +1801,23 @@ ACE_WFMO_Reactor::ok_to_wait (ACE_Time_Value *max_wait_time,
this->atomic_wait_array_,
TRUE,
timeout);
+
if (result != WAIT_IO_COMPLETION)
break;
+
# else
result = ::WaitForMultipleObjectsEx (sizeof this->atomic_wait_array_ / sizeof (ACE_HANDLE),
this->atomic_wait_array_,
TRUE,
timeout,
alertable);
+
if (result != WAIT_IO_COMPLETION)
break;
+
# endif /* ACE_HAS_PHARLAP */
}
+
switch (result)
{
case WAIT_TIMEOUT:
@@ -1574,10 +1830,12 @@ ACE_WFMO_Reactor::ok_to_wait (ACE_Time_Value *max_wait_time,
default:
break;
}
+
// It is ok to enter ::WaitForMultipleObjects
return 1;
#endif /* ACE_HAS_WINCE */
}
+
DWORD
ACE_WFMO_Reactor::wait_for_multiple_events (int timeout,
int alertable)
@@ -1585,6 +1843,7 @@ ACE_WFMO_Reactor::wait_for_multiple_events (int timeout,
// Wait for any of handles_ to be active, or until timeout expires.
// If <alertable> is enabled allow asynchronous completion of
// ReadFile and WriteFile operations.
+
#if defined (ACE_HAS_PHARLAP) || defined (ACE_HAS_WINCE)
// PharLap doesn't do async I/O and doesn't implement
// WaitForMultipleObjectsEx, so use WaitForMultipleObjects.
@@ -1601,6 +1860,7 @@ ACE_WFMO_Reactor::wait_for_multiple_events (int timeout,
alertable);
#endif /* ACE_HAS_PHARLAP */
}
+
DWORD
ACE_WFMO_Reactor::poll_remaining_handles (DWORD slot)
{
@@ -1609,6 +1869,7 @@ ACE_WFMO_Reactor::poll_remaining_handles (DWORD slot)
FALSE,
0);
}
+
int
ACE_WFMO_Reactor::calculate_timeout (ACE_Time_Value *max_wait_time)
{
@@ -1617,12 +1878,14 @@ ACE_WFMO_Reactor::calculate_timeout (ACE_Time_Value *max_wait_time)
time = this->timer_queue_->calculate_timeout (max_wait_time);
else
time = max_wait_time;
+
if (time == 0)
return INFINITE;
else
return time->msec ();
}
+
int
ACE_WFMO_Reactor::expire_timers (void)
{
@@ -1630,34 +1893,42 @@ ACE_WFMO_Reactor::expire_timers (void)
if (ACE_Thread::self () == this->owner_)
// expire all pending timers.
return this->timer_queue_->expire ();
+
else
// Nothing to expire
return 0;
}
+
int
ACE_WFMO_Reactor::dispatch (DWORD wait_status)
{
int handlers_dispatched = 0;
+
// Expire timers
handlers_dispatched += this->expire_timers ();
+
switch (wait_status)
{
case WAIT_FAILED: // Failure.
ACE_OS::set_errno_to_last_error ();
return -1;
+
case WAIT_TIMEOUT: // Timeout.
errno = ETIME;
return handlers_dispatched;
+
#ifndef ACE_HAS_WINCE
case WAIT_IO_COMPLETION: // APC.
return handlers_dispatched;
#endif // ACE_HAS_WINCE
+
default: // Dispatch.
// We'll let dispatch worry about abandoned mutes.
handlers_dispatched += this->dispatch_handles (wait_status);
return handlers_dispatched;
}
}
+
// Dispatches any active handles from <handles_[slot]> to
// <handles_[max_handlep1_]>, polling through our handle set looking
// for active handles.
@@ -1667,11 +1938,14 @@ ACE_WFMO_Reactor::dispatch_handles (DWORD wait_status)
// dispatch_slot is the absolute slot. Only += is used to
// increment it.
DWORD dispatch_slot = 0;
+
// Cache this value, this is the absolute value.
DWORD max_handlep1 = this->handler_rep_.max_handlep1 ();
+
// nCount starts off at <max_handlep1>, this is a transient count of
// handles last waited on.
DWORD nCount = max_handlep1;
+
for (int number_of_handlers_dispatched = 1;
;
++number_of_handlers_dispatched)
@@ -1687,21 +1961,27 @@ ACE_WFMO_Reactor::dispatch_handles (DWORD wait_status)
wait_status >= WAIT_OBJECT_0 &&
#endif
wait_status <= (WAIT_OBJECT_0 + nCount));
+
if (ok)
dispatch_slot += wait_status - WAIT_OBJECT_0;
else
// Otherwise, a handle was abandoned.
dispatch_slot += wait_status - WAIT_ABANDONED_0;
+
// Dispatch handler
if (this->dispatch_handler (dispatch_slot, max_handlep1) == -1)
return -1;
+
// Increment slot
++dispatch_slot;
+
// We're done.
if (dispatch_slot >= max_handlep1)
return number_of_handlers_dispatched;
+
// Readjust nCount
nCount = max_handlep1 - dispatch_slot;
+
// Check the remaining handles
wait_status = this->poll_remaining_handles (dispatch_slot);
switch (wait_status)
@@ -1715,6 +1995,7 @@ ACE_WFMO_Reactor::dispatch_handles (DWORD wait_status)
}
}
}
+
int
ACE_WFMO_Reactor::dispatch_handler (DWORD slot,
DWORD max_handlep1)
@@ -1722,6 +2003,7 @@ ACE_WFMO_Reactor::dispatch_handler (DWORD slot,
// Check if there are window messages that need to be dispatched
if (slot == max_handlep1)
return this->dispatch_window_messages ();
+
// Dispatch the handler if it has not been scheduled for deletion.
// Note that this is a very week test if there are multiple threads
// dispatching this slot as no locks are held here. Generally, you
@@ -1731,6 +2013,7 @@ ACE_WFMO_Reactor::dispatch_handler (DWORD slot,
else if (!this->handler_rep_.scheduled_for_deletion (slot))
{
ACE_HANDLE event_handle = *(this->handler_rep_.handles () + slot);
+
if (this->handler_rep_.current_info ()[slot].io_entry_)
return this->complex_dispatch_handler (slot,
event_handle);
@@ -1742,41 +2025,52 @@ ACE_WFMO_Reactor::dispatch_handler (DWORD slot,
// The handle was scheduled for deletion, so we will skip it.
return 0;
}
+
int
ACE_WFMO_Reactor::simple_dispatch_handler (DWORD slot,
ACE_HANDLE event_handle)
{
// This dispatch is used for non-I/O entires
+
// Assign the ``signaled'' HANDLE so that callers can get it.
// siginfo_t is an ACE - specific fabrication. Constructor exists.
siginfo_t sig (event_handle);
+
ACE_Event_Handler *event_handler =
this->handler_rep_.current_info ()[slot].event_handler_;
+
int requires_reference_counting =
event_handler->reference_counting_policy ().value () ==
ACE_Event_Handler::Reference_Counting_Policy::ENABLED;
+
if (requires_reference_counting)
{
event_handler->add_reference ();
}
+
// Upcall
if (event_handler->handle_signal (0, &sig) == -1)
this->handler_rep_.unbind (event_handle,
ACE_Event_Handler::NULL_MASK);
+
// Call remove_reference() if needed.
if (requires_reference_counting)
{
event_handler->remove_reference ();
}
+
return 0;
}
+
int
ACE_WFMO_Reactor::complex_dispatch_handler (DWORD slot,
ACE_HANDLE event_handle)
{
// This dispatch is used for I/O entires.
+
ACE_WFMO_Reactor_Handler_Repository::Current_Info &current_info =
this->handler_rep_.current_info ()[slot];
+
WSANETWORKEVENTS events;
ACE_Reactor_Mask problems = ACE_Event_Handler::NULL_MASK;
if (::WSAEnumNetworkEvents ((SOCKET) current_info.io_handle_,
@@ -1801,32 +2095,40 @@ ACE_WFMO_Reactor::complex_dispatch_handler (DWORD slot,
{
ACE_Event_Handler *event_handler =
current_info.event_handler_;
+
int reference_counting_required =
event_handler->reference_counting_policy ().value () ==
ACE_Event_Handler::Reference_Counting_Policy::ENABLED;
+
// Call add_reference() if needed.
if (reference_counting_required)
{
event_handler->add_reference ();
}
+
// Upcall
problems |= this->upcall (current_info.event_handler_,
current_info.io_handle_,
events);
+
// Call remove_reference() if needed.
if (reference_counting_required)
{
event_handler->remove_reference ();
}
+
if (this->handler_rep_.scheduled_for_deletion (slot))
break;
}
}
+
if (problems != ACE_Event_Handler::NULL_MASK
&& !this->handler_rep_.scheduled_for_deletion (slot) )
this->handler_rep_.unbind (event_handle, problems);
+
return 0;
}
+
ACE_Reactor_Mask
ACE_WFMO_Reactor::upcall (ACE_Event_Handler *event_handler,
ACE_HANDLE io_handle,
@@ -1835,11 +2137,14 @@ ACE_WFMO_Reactor::upcall (ACE_Event_Handler *event_handler,
// This method figures out what exactly has happened to the socket
// and then calls appropriate methods.
ACE_Reactor_Mask problems = ACE_Event_Handler::NULL_MASK;
+
// Go through the events and do the indicated upcalls. If the handler
// doesn't want to be called back, clear the bit for that event.
// At the end, set the bits back to <events> to request a repeat call.
+
long actual_events = events.lNetworkEvents;
int action;
+
if (ACE_BIT_ENABLED (actual_events, FD_WRITE))
{
action = event_handler->handle_output (io_handle);
@@ -1850,6 +2155,7 @@ ACE_WFMO_Reactor::upcall (ACE_Event_Handler *event_handler,
ACE_SET_BITS (problems, ACE_Event_Handler::WRITE_MASK);
}
}
+
if (ACE_BIT_ENABLED (actual_events, FD_CONNECT))
{
if (events.iErrorCode[FD_CONNECT_BIT] == 0)
@@ -1877,6 +2183,7 @@ ACE_WFMO_Reactor::upcall (ACE_Event_Handler *event_handler,
}
}
}
+
if (ACE_BIT_ENABLED (actual_events, FD_OOB))
{
action = event_handler->handle_exception (io_handle);
@@ -1887,6 +2194,7 @@ ACE_WFMO_Reactor::upcall (ACE_Event_Handler *event_handler,
ACE_SET_BITS (problems, ACE_Event_Handler::EXCEPT_MASK);
}
}
+
if (ACE_BIT_ENABLED (actual_events, FD_READ))
{
action = event_handler->handle_input (io_handle);
@@ -1897,6 +2205,7 @@ ACE_WFMO_Reactor::upcall (ACE_Event_Handler *event_handler,
ACE_SET_BITS (problems, ACE_Event_Handler::READ_MASK);
}
}
+
if (ACE_BIT_ENABLED (actual_events, FD_CLOSE)
&& ACE_BIT_DISABLED (problems, ACE_Event_Handler::READ_MASK))
{
@@ -1908,6 +2217,7 @@ ACE_WFMO_Reactor::upcall (ACE_Event_Handler *event_handler,
ACE_SET_BITS (problems, ACE_Event_Handler::READ_MASK);
}
}
+
if (ACE_BIT_ENABLED (actual_events, FD_ACCEPT))
{
action = event_handler->handle_input (io_handle);
@@ -1918,6 +2228,7 @@ ACE_WFMO_Reactor::upcall (ACE_Event_Handler *event_handler,
ACE_SET_BITS (problems, ACE_Event_Handler::ACCEPT_MASK);
}
}
+
if (ACE_BIT_ENABLED (actual_events, FD_QOS))
{
action = event_handler->handle_qos (io_handle);
@@ -1928,6 +2239,7 @@ ACE_WFMO_Reactor::upcall (ACE_Event_Handler *event_handler,
ACE_SET_BITS (problems, ACE_Event_Handler::QOS_MASK);
}
}
+
if (ACE_BIT_ENABLED (actual_events, FD_GROUP_QOS))
{
action = event_handler->handle_group_qos (io_handle);
@@ -1938,17 +2250,21 @@ ACE_WFMO_Reactor::upcall (ACE_Event_Handler *event_handler,
ACE_SET_BITS (problems, ACE_Event_Handler::GROUP_QOS_MASK);
}
}
+
events.lNetworkEvents = actual_events;
return problems;
}
+
int
ACE_WFMO_Reactor::update_state (void)
{
// This GUARD is necessary since we are updating shared state.
ACE_GUARD_RETURN (ACE_Process_Mutex, monitor, this->lock_, -1);
+
// Decrement active threads
--this->active_threads_;
+
// Check if the state of the handler repository has changed or new
// owner has to be set
if (this->handler_rep_.changes_required () || this->new_owner ())
@@ -1960,6 +2276,7 @@ ACE_WFMO_Reactor::update_state (void)
this->change_state_thread_ = ACE_Thread::self ();
// Make sure no new threads are allowed to enter
this->ok_to_wait_.reset ();
+
if (this->active_threads_ > 0)
// Check for other active threads
{
@@ -1972,6 +2289,7 @@ ACE_WFMO_Reactor::update_state (void)
// Re-acquire <lock_> again
monitor.acquire ();
}
+
// Note that make_changes() calls into user code which can
// request other changes. So keep looping until all
// requested changes are completed.
@@ -1999,58 +2317,72 @@ ACE_WFMO_Reactor::update_state (void)
else if (this->active_threads_ == 0)
// Turn off <wakeup_all_threads_>
this->wakeup_all_threads_.reset ();
+
return 0;
}
+
void
ACE_WFMO_Reactor::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_WFMO_Reactor::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
+
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("Count of currently active threads = %d\n"),
this->active_threads_));
+
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("ID of owner thread = %d\n"),
this->owner_));
+
this->handler_rep_.dump ();
this->signal_handler_->dump ();
this->timer_queue_->dump ();
+
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
int
ACE_WFMO_Reactor_Notify::dispatch_notifications (int & /*number_of_active_handles*/,
ACE_Handle_Set & /*rd_mask*/)
{
return -1;
}
+
int
ACE_WFMO_Reactor_Notify::is_dispatchable (ACE_Notification_Buffer & /*buffer*/)
{
return 0;
}
+
ACE_HANDLE
ACE_WFMO_Reactor_Notify::notify_handle (void)
{
return ACE_INVALID_HANDLE;
}
+
int
ACE_WFMO_Reactor_Notify::read_notify_pipe (ACE_HANDLE ,
ACE_Notification_Buffer &)
{
return 0;
}
+
int
ACE_WFMO_Reactor_Notify::dispatch_notify (ACE_Notification_Buffer &)
{
return 0;
}
+
int
ACE_WFMO_Reactor_Notify::close (void)
{
return -1;
}
+
ACE_WFMO_Reactor_Notify::ACE_WFMO_Reactor_Notify (size_t max_notifies)
: timer_queue_ (0),
message_queue_ (max_notifies * sizeof (ACE_Notification_Buffer),
@@ -2058,6 +2390,7 @@ ACE_WFMO_Reactor_Notify::ACE_WFMO_Reactor_Notify (size_t max_notifies)
max_notify_iterations_ (-1)
{
}
+
int
ACE_WFMO_Reactor_Notify::open (ACE_Reactor_Impl *wfmo_reactor,
ACE_Timer_Queue *timer_queue,
@@ -2067,25 +2400,31 @@ ACE_WFMO_Reactor_Notify::open (ACE_Reactor_Impl *wfmo_reactor,
timer_queue_ = timer_queue;
return wfmo_reactor->register_handler (this);
}
+
ACE_HANDLE
ACE_WFMO_Reactor_Notify::get_handle (void) const
{
return this->wakeup_one_thread_.handle ();
}
+
// Handle all pending notifications.
+
int
ACE_WFMO_Reactor_Notify::handle_signal (int signum,
siginfo_t *siginfo,
ucontext_t *)
{
ACE_UNUSED_ARG (signum);
+
// Just check for sanity...
if (siginfo->si_handle_ != this->wakeup_one_thread_.handle ())
return -1;
+
// This will get called when <WFMO_Reactor->wakeup_one_thread_> event
// is signaled.
// ACE_DEBUG ((LM_DEBUG,
// ACE_TEXT ("(%t) waking up to handle internal notifications\n")));
+
for (int i = 1; ; ++i)
{
ACE_Message_Block *mb = 0;
@@ -2104,17 +2443,22 @@ ACE_WFMO_Reactor_Notify::handle_signal (int signum,
{
ACE_Notification_Buffer *buffer =
reinterpret_cast <ACE_Notification_Buffer *> (mb->base ());
+
// If eh == 0 then we've got major problems! Otherwise, we
// need to dispatch the appropriate handle_* method on the
// ACE_Event_Handler pointer we've been passed.
+
if (buffer->eh_ != 0)
{
ACE_Event_Handler *event_handler =
buffer->eh_;
+
bool const requires_reference_counting =
event_handler->reference_counting_policy ().value () ==
ACE_Event_Handler::Reference_Counting_Policy::ENABLED;
+
int result = 0;
+
switch (buffer->mask_)
{
case ACE_Event_Handler::READ_MASK:
@@ -2139,17 +2483,21 @@ ACE_WFMO_Reactor_Notify::handle_signal (int signum,
buffer->mask_));
break;
}
+
if (result == -1)
event_handler->handle_close (ACE_INVALID_HANDLE,
ACE_Event_Handler::EXCEPT_MASK);
+
if (requires_reference_counting)
{
event_handler->remove_reference ();
}
}
+
// Make sure to delete the memory regardless of success or
// failure!
mb->release ();
+
// Bail out if we've reached the <max_notify_iterations_>.
// Note that by default <max_notify_iterations_> is -1, so
// we'll loop until we're done.
@@ -2159,15 +2507,18 @@ ACE_WFMO_Reactor_Notify::handle_signal (int signum,
// to wake up again
if (!this->message_queue_.is_empty ())
this->wakeup_one_thread_.signal ();
+
// Break the loop as we have reached max_notify_iterations_
return 0;
}
}
}
}
+
// Notify the WFMO_Reactor, potentially enqueueing the
// <ACE_Event_Handler> for subsequent processing in the WFMO_Reactor
// thread of control.
+
int
ACE_WFMO_Reactor_Notify::notify (ACE_Event_Handler *event_handler,
ACE_Reactor_Mask mask,
@@ -2179,25 +2530,31 @@ ACE_WFMO_Reactor_Notify::notify (ACE_Event_Handler *event_handler,
ACE_NEW_RETURN (mb,
ACE_Message_Block (sizeof (ACE_Notification_Buffer)),
-1);
+
ACE_Notification_Buffer *buffer =
(ACE_Notification_Buffer *) mb->base ();
buffer->eh_ = event_handler;
buffer->mask_ = mask;
+
// Convert from relative time to absolute time by adding the
// current time of day. This is what <ACE_Message_Queue>
// expects.
if (timeout != 0)
*timeout += timer_queue_->gettimeofday ();
+
if (this->message_queue_.enqueue_tail
(mb, timeout) == -1)
{
mb->release ();
return -1;
}
+
event_handler->add_reference ();
}
+
return this->wakeup_one_thread_.signal ();
}
+
void
ACE_WFMO_Reactor_Notify::max_notify_iterations (int iterations)
{
@@ -2205,25 +2562,31 @@ ACE_WFMO_Reactor_Notify::max_notify_iterations (int iterations)
// Must always be > 0 or < 0 to optimize the loop exit condition.
if (iterations == 0)
iterations = 1;
+
this->max_notify_iterations_ = iterations;
}
+
int
ACE_WFMO_Reactor_Notify::max_notify_iterations (void)
{
ACE_TRACE ("ACE_WFMO_Reactor_Notify::max_notify_iterations");
return this->max_notify_iterations_;
}
+
int
ACE_WFMO_Reactor_Notify::purge_pending_notifications (ACE_Event_Handler *eh,
ACE_Reactor_Mask mask)
{
ACE_TRACE ("ACE_WFMO_Reactor_Notify::purge_pending_notifications");
+
// Go over message queue and take out all the matching event
// handlers. If eh == 0, purge all. Note that reactor notifies (no
// handler specified) are never purged, as this may lose a needed
// notify the reactor queued for itself.
+
if (this->message_queue_.is_empty ())
return 0;
+
// Guard against new and/or delivered notifications while purging.
// WARNING!!! The use of the notification queue's lock object for
// this guard makes use of the knowledge that on Win32, the mutex
@@ -2231,19 +2594,25 @@ ACE_WFMO_Reactor_Notify::purge_pending_notifications (ACE_Event_Handler *eh,
// recursive. This is how we can get away with locking it down here
// and still calling member functions on the queue object.
ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, monitor, this->message_queue_.lock(), -1);
+
// first, copy all to our own local queue. Since we've locked everyone out
// of here, there's no need to use any synchronization on this queue.
ACE_Message_Queue<ACE_NULL_SYNCH> local_queue;
+
size_t queue_size = this->message_queue_.message_count ();
int number_purged = 0;
+
size_t index;
+
for (index = 0; index < queue_size; ++index)
{
ACE_Message_Block *mb = 0;
if (-1 == this->message_queue_.dequeue_head (mb))
return -1; // This shouldn't happen...
+
ACE_Notification_Buffer *buffer =
reinterpret_cast<ACE_Notification_Buffer *> (mb->base ());
+
// If this is not a Reactor notify (it is for a particular handler),
// and it matches the specified handler (or purging all),
// and applying the mask would totally eliminate the notification, then
@@ -2255,7 +2624,9 @@ ACE_WFMO_Reactor_Notify::purge_pending_notifications (ACE_Event_Handler *eh,
// applying the mask
{
ACE_Event_Handler *event_handler = buffer->eh_;
+
event_handler->remove_reference ();
+
mb->release ();
++number_purged;
}
@@ -2272,11 +2643,13 @@ ACE_WFMO_Reactor_Notify::purge_pending_notifications (ACE_Event_Handler *eh,
return -1;
}
}
+
if (this->message_queue_.message_count ())
{ // Should be empty!
ACE_ASSERT (0);
return -1;
}
+
// Now copy back from the local queue to the class queue, taking
// care to preserve the original order...
queue_size = local_queue.message_count ();
@@ -2288,14 +2661,17 @@ ACE_WFMO_Reactor_Notify::purge_pending_notifications (ACE_Event_Handler *eh,
ACE_ASSERT (0);
return -1;
}
+
if (-1 == this->message_queue_.enqueue_head (mb))
{
ACE_ASSERT (0);
return -1;
}
}
+
return number_purged;
}
+
void
ACE_WFMO_Reactor_Notify::dump (void) const
{
@@ -2309,21 +2685,26 @@ ACE_WFMO_Reactor_Notify::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
void
ACE_WFMO_Reactor::max_notify_iterations (int iterations)
{
ACE_TRACE ("ACE_WFMO_Reactor::max_notify_iterations");
ACE_GUARD (ACE_Process_Mutex, monitor, this->lock_);
+
// Must always be > 0 or < 0 to optimize the loop exit condition.
this->notify_handler_->max_notify_iterations (iterations);
}
+
int
ACE_WFMO_Reactor::max_notify_iterations (void)
{
ACE_TRACE ("ACE_WFMO_Reactor::max_notify_iterations");
ACE_GUARD_RETURN (ACE_Process_Mutex, monitor, this->lock_, -1);
+
return this->notify_handler_->max_notify_iterations ();
}
+
int
ACE_WFMO_Reactor::purge_pending_notifications (ACE_Event_Handler *eh,
ACE_Reactor_Mask mask)
@@ -2334,6 +2715,7 @@ ACE_WFMO_Reactor::purge_pending_notifications (ACE_Event_Handler *eh,
else
return this->notify_handler_->purge_pending_notifications (eh, mask);
}
+
int
ACE_WFMO_Reactor::resumable_handler (void)
{
@@ -2341,6 +2723,7 @@ ACE_WFMO_Reactor::resumable_handler (void)
return 0;
}
+
// No-op WinSOCK2 methods to help WFMO_Reactor compile
#if !defined (ACE_HAS_WINSOCK2) || (ACE_HAS_WINSOCK2 == 0)
int
@@ -2350,6 +2733,7 @@ WSAEventSelect (SOCKET /* s */,
{
return -1;
}
+
int
WSAEnumNetworkEvents (SOCKET /* s */,
WSAEVENT /* hEventObject */,
@@ -2358,6 +2742,8 @@ WSAEnumNetworkEvents (SOCKET /* s */,
return -1;
}
#endif /* !defined ACE_HAS_WINSOCK2 */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_WIN32 */
diff --git a/dep/ACE_wrappers/ace/WFMO_Reactor.h b/dep/ACE_wrappers/ace/WFMO_Reactor.h
index b02ad8bf9f0..8a6a8af8ad1 100644
--- a/dep/ACE_wrappers/ace/WFMO_Reactor.h
+++ b/dep/ACE_wrappers/ace/WFMO_Reactor.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file WFMO_Reactor.h
@@ -10,14 +11,19 @@
* @author Doug Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_WFMO_REACTOR_H
#define ACE_WFMO_REACTOR_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_WIN32)
+
#include "ace/Signal.h"
#include "ace/Timer_Queue.h"
#include "ace/Event_Handler.h"
@@ -28,6 +34,7 @@
#include "ace/Reactor_Impl.h"
#include "ace/Message_Queue.h"
#include "ace/Process_Mutex.h"
+
// If we don't have WinSOCK2, we need these defined
#if !defined (ACE_HAS_WINSOCK2) || (ACE_HAS_WINSOCK2 == 0)
/*
@@ -41,28 +48,39 @@
#define FD_CLOSE_BIT 5
#define FD_QOS_BIT 6
#define FD_GROUP_QOS_BIT 7
+
#define FD_QOS (1 << FD_QOS_BIT)
#define FD_GROUP_QOS (1 << FD_GROUP_QOS_BIT)
+
#define FD_MAX_EVENTS 8
#define FD_ALL_EVENTS ((1 << FD_MAX_EVENTS) - 1)
+
#define WSAEVENT HANDLE
+
typedef struct _WSANETWORKEVENTS
{
long lNetworkEvents;
int iErrorCode[FD_MAX_EVENTS];
} WSANETWORKEVENTS, FAR * LPWSANETWORKEVENTS;
+
int WSAEventSelect (SOCKET s,
WSAEVENT hEventObject,
long lNetworkEvents);
+
int WSAEnumNetworkEvents (SOCKET s,
WSAEVENT hEventObject,
LPWSANETWORKEVENTS lpNetworkEvents);
+
#endif /* !defined ACE_HAS_WINSOCK2 */
+
class ACE_WFMO_Reactor_Test; // Must be out of versioned namespace.
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward decl.
class ACE_WFMO_Reactor;
class ACE_Handle_Set;
+
/**
* @class ACE_Wakeup_All_Threads_Handler
*
@@ -75,6 +93,7 @@ public:
/// Called when the <ACE_WFMO_Reactor->wakeup_all_threads_>
virtual int handle_signal (int signum, siginfo_t * = 0, ucontext_t * = 0);
};
+
/**
* @class ACE_WFMO_Reactor_Handler_Repository
*
@@ -88,6 +107,7 @@ class ACE_Export ACE_WFMO_Reactor_Handler_Repository
public:
friend class ACE_WFMO_Reactor;
friend class ACE_WFMO_Reactor_Test;
+
/**
* @class Common_Info
*
@@ -103,17 +123,21 @@ public:
/// This indicates whether this entry is for I/O or for a regular
/// event
bool io_entry_;
+
/// The assosiated <Event_Handler>
ACE_Event_Handler *event_handler_;
+
/// The I/O handle related to the <Event_Handler>. This entry is
/// only valid if the <io_entry_> flag is true.
ACE_HANDLE io_handle_;
+
/**
* This is the set of events that the <Event_Handler> is
* interested in. This entry is only valid if the <io_entry_> flag
* is true.
*/
long network_events_;
+
/**
* This flag indicates that <WFMO_Reactor> created the event on
* behalf of the user. Therefore we need to clean this up when the
@@ -121,18 +145,23 @@ public:
* is only valid if the <io_entry_> flag is true.
*/
bool delete_event_;
+
/// This is set when the entry needed to be deleted.
bool delete_entry_;
+
/**
* These are the masks related to <handle_close> for the
* <Event_Handler>. This is only valid when <delete_entry_> is
* set.
*/
ACE_Reactor_Mask close_masks_;
+
/// Constructor used for initializing the structure
Common_Info (void);
+
/// Reset the state of the structure
void reset (void);
+
/// Set the structure to these new values
void set (bool io_entry,
ACE_Event_Handler *event_handler,
@@ -141,11 +170,14 @@ public:
bool delete_event,
bool delete_entry,
ACE_Reactor_Mask close_masks);
+
/// Set the structure to these new values
void set (Common_Info &common_info);
+
/// Dump the state of an object.
void dump (void) const;
};
+
/**
* @class Current_Info
*
@@ -157,10 +189,13 @@ public:
public:
/// This is set when the entry needed to be suspended.
bool suspend_entry_;
+
/// Default constructor
Current_Info (void);
+
/// Reset the state of the structure
void reset (void);
+
/// Set the structure to these new values
void set (bool io_entry,
ACE_Event_Handler *event_handler,
@@ -170,12 +205,15 @@ public:
bool delete_entry = false,
ACE_Reactor_Mask close_masks = ACE_Event_Handler::NULL_MASK,
bool suspend_entry = false);
+
/// Set the structure to these new values
void set (Common_Info &common_info,
bool suspend_entry = false);
+
/// Dump the state of an object.
void dump (ACE_HANDLE event_handle) const;
};
+
/**
* @class To_Be_Added_Info
*
@@ -187,12 +225,16 @@ public:
public:
/// Handle for the event
ACE_HANDLE event_handle_;
+
/// This is set when the entry needed to be suspended.
bool suspend_entry_;
+
/// Default constructor
To_Be_Added_Info (void);
+
/// Reset the state of the structure
void reset (void);
+
/// Set the structure to these new values
void set (ACE_HANDLE event_handle,
bool io_entry,
@@ -203,13 +245,16 @@ public:
bool delete_entry = false,
ACE_Reactor_Mask close_masks = ACE_Event_Handler::NULL_MASK,
bool suspend_entry = false);
+
/// Set the structure to these new values
void set (ACE_HANDLE event_handle,
Common_Info &common_info,
bool suspend_entry = false);
+
/// Dump the state of an object.
void dump (void) const;
};
+
/**
* @class Suspended_Info
*
@@ -221,12 +266,16 @@ public:
public:
/// Handle for the event
ACE_HANDLE event_handle_;
+
/// This is set when the entry needed to be resumed.
bool resume_entry_;
+
/// Constructor used for initializing the structure
Suspended_Info (void);
+
/// Reset the state of the structure
void reset (void);
+
/// Set the structure to these new values
void set (ACE_HANDLE event_handle,
bool io_entry,
@@ -237,25 +286,34 @@ public:
bool delete_entry = false,
ACE_Reactor_Mask close_masks = 0,
bool resume_entry = false);
+
/// Set the structure to these new values
void set (ACE_HANDLE event_handle,
Common_Info &common_info,
bool resume_entry = false);
+
/// Dump the state of an object.
void dump (void) const;
};
+
/// Constructor.
ACE_WFMO_Reactor_Handler_Repository (ACE_WFMO_Reactor &wfmo_reactor);
+
/// Destructor.
virtual ~ACE_WFMO_Reactor_Handler_Repository (void);
+
/// Initialize the repository of the approriate @a size.
int open (size_t size);
+
/// Close down the handler repository.
int close (void);
+
// = Search structure operations.
+
/// Bind the <ACE_Event_Handler *> to the ACE_HANDLE. This is for
/// the simple event entry.
int bind (ACE_HANDLE, ACE_Event_Handler *);
+
/// Insert I/O <Event_Handler> entry into the system. This method
/// assumes that the lock are head *before* this method is invoked.
int bind_i (bool io_entry,
@@ -264,33 +322,45 @@ public:
ACE_HANDLE io_handle,
ACE_HANDLE event_handle,
bool delete_event);
+
/// Remove the binding of ACE_HANDLE in accordance with the @a mask.
int unbind (ACE_HANDLE,
ACE_Reactor_Mask mask);
+
/// Non-lock-grabbing version of <unbind>
int unbind_i (ACE_HANDLE,
ACE_Reactor_Mask mask,
bool &changes_required);
+
/// Remove all bindings of <ACE_HANDLE, ACE_Event_Handler> tuples.
void unbind_all (void);
+
// = Sanity checking.
+
// Check the <handle> to make sure it's a valid ACE_HANDLE
int invalid_handle (ACE_HANDLE handle) const;
+
// = Accessors.
/// Maximum ACE_HANDLE value, plus 1.
DWORD max_handlep1 (void) const;
+
/// Pointer to the beginning of the current array of ACE_HANDLE
/// *'s.
ACE_HANDLE *handles (void) const;
+
/// Pointer to the beginning of the current array of
/// ACE_Event_Handler *'s.
Current_Info *current_info (void) const;
+
/// Check if changes to the handle set are required.
virtual bool changes_required (void);
+
/// Make changes to the handle set
virtual int make_changes (void);
+
/// Check to see if @a slot has been scheduled for deletion
int scheduled_for_deletion (size_t slot) const;
+
/**
* This method is used to calculate the network mask after a mask_op
* request to <WFMO_Reactor>. Note that because the <Event_Handler>
@@ -304,38 +374,49 @@ public:
ACE_HANDLE &event_handle,
bool &delete_event,
int operation);
+
/// This method is used to change the network mask left (if any)
/// after a remove request to <WFMO_Reactor>
ACE_Reactor_Mask bit_ops (long &existing_masks,
ACE_Reactor_Mask to_be_removed_masks,
int operation);
+
/// Temporarily suspend entry
int suspend_handler_i (ACE_HANDLE handle,
bool &changes_required);
+
/// Resume suspended entry
int resume_handler_i (ACE_HANDLE handle,
bool &changes_required);
+
/// Deletions and suspensions in current_info_
int make_changes_in_current_infos (void);
+
/// Deletions and resumptions in current_suspended_info_
int make_changes_in_suspension_infos (void);
+
/// Deletions in to_be_added_info_, or transfers to current_info_ or
/// current_suspended_info_ from to_be_added_info_
int make_changes_in_to_be_added_infos (void);
+
/// Removes the ACE_Event_Handler at @a slot from the table.
int remove_handler_i (size_t slot,
ACE_Reactor_Mask mask);
+
/// Removes the ACE_Event_Handler at @a slot from the table.
int remove_suspended_handler_i (size_t slot,
ACE_Reactor_Mask mask);
+
/// Removes the ACE_Event_Handler at @a slot from the table.
int remove_to_be_added_handler_i (size_t slot,
ACE_Reactor_Mask to_be_removed_masks);
+
/**
* Return the Event_Handler associated with <handle>. Return 0 if
* <handle> is not registered.
*/
ACE_Event_Handler *find_handler (ACE_HANDLE handle);
+
/**
* Check to see if <handle> is associated with a valid Event_Handler
* bound to @a mask. Return the <event_handler> associated with this
@@ -344,44 +425,60 @@ public:
int handler (ACE_HANDLE handle,
ACE_Reactor_Mask mask,
ACE_Event_Handler **event_handler = 0);
+
/**
* Check to see if <handle> is associated with a valid
* Event_Handler. Return Event_Handler and associated masks.
*/
ACE_Event_Handler *handler (ACE_HANDLE handle,
long &existing_masks);
+
/// Dump the state of an object.
void dump (void) const;
+
protected:
/// Reference to our <WFMO_Reactor>.
ACE_WFMO_Reactor &wfmo_reactor_;
+
/// Maximum number of handles.
size_t max_size_;
+
/**
* Array of <ACE_HANDLEs> passed to <WaitForMultipleObjects>. This
* is not part of the structure as the handle array needs to be
* passed directly to <WaitForMultipleObjects>.
*/
ACE_HANDLE *current_handles_;
+
/// Array of current entries in the table
Current_Info *current_info_;
+
/// A count of the number of active handles.
DWORD max_handlep1_;
+
/// Information for entries to be added
To_Be_Added_Info *to_be_added_info_;
+
/// Number of records to be added
size_t handles_to_be_added_;
+
/// Currently suspended handles
Suspended_Info *current_suspended_info_;
+
/// Number of currently suspended handles
size_t suspended_handles_;
+
/// Number of records to be suspended
size_t handles_to_be_suspended_;
+
/// Number of records to be resumed
size_t handles_to_be_resumed_;
+
/// Number of records to be deleted
size_t handles_to_be_deleted_;
+
};
+
/**
* @class ACE_WFMO_Reactor_Notify
*
@@ -402,12 +499,15 @@ class ACE_Export ACE_WFMO_Reactor_Notify : public ACE_Reactor_Notify
public:
/// Constructor
ACE_WFMO_Reactor_Notify (size_t max_notifies = 1024);
+
/// Initialization. <timer_queue> is stored to call <gettimeofday>.
virtual int open (ACE_Reactor_Impl *wfmo_reactor,
ACE_Timer_Queue *timer_queue,
int disable_notify = 0);
+
/// No-op.
virtual int close (void);
+
/**
* Special trick to unblock <WaitForMultipleObjects> when updates
* occur. All we do is enqueue <event_handler> and @a mask onto the
@@ -420,25 +520,32 @@ public:
virtual int notify (ACE_Event_Handler *event_handler = 0,
ACE_Reactor_Mask mask = ACE_Event_Handler::EXCEPT_MASK,
ACE_Time_Value *timeout = 0);
+
/// No-op.
virtual int dispatch_notifications (int &number_of_active_handles,
ACE_Handle_Set &rd_mask);
+
/// Returns a handle to the <ACE_Auto_Event>.
virtual ACE_HANDLE get_handle (void) const;
+
/// Returns the ACE_HANDLE of the notify pipe on which the reactor
/// is listening for notifications so that other threads can unblock
/// the <Reactor_Impl>
virtual ACE_HANDLE notify_handle (void);
+
/// Handle one of the notify call on the <handle>. This could be
/// because of a thread trying to unblock the <Reactor_Impl>
virtual int dispatch_notify (ACE_Notification_Buffer &buffer);
+
/// Verify whether the buffer has dispatchable info or not.
virtual int is_dispatchable (ACE_Notification_Buffer &buffer);
+
/// Read one of the notify call on the <handle> into the
/// <buffer>. This could be because of a thread trying to unblock
/// the <Reactor_Impl>
virtual int read_notify_pipe (ACE_HANDLE handle,
ACE_Notification_Buffer &buffer);
+
/**
* Set the maximum number of times that the
* <ACE_WFMO_Reactor_Notify::handle_input> method will iterate and
@@ -451,6 +558,7 @@ public:
* overhead.
*/
void max_notify_iterations (int);
+
/**
* Get the maximum number of times that the
* <ACE_WFMO_Reactor_Notify::handle_input> method will iterate and
@@ -459,6 +567,7 @@ public:
* <ACE_Message_Queue::dequeue> loop.
*/
int max_notify_iterations (void);
+
/**
* Purge any notifications pending in this reactor for the specified
* ACE_Event_Handler object. If <eh> == 0, all notifications for all
@@ -468,24 +577,30 @@ public:
*/
virtual int purge_pending_notifications (ACE_Event_Handler *,
ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK);
+
/// Dump the state of an object.
virtual void dump (void) const;
+
private:
/// Pointer to the wfmo_reactor's timer queue.
ACE_Timer_Queue *timer_queue_;
+
/**
* Called when the notification event waited on by
* <ACE_WFMO_Reactor> is signaled. This dequeues all pending
* <ACE_Event_Handlers> and dispatches them.
*/
virtual int handle_signal (int signum, siginfo_t * = 0, ucontext_t * = 0);
+
/// An auto event is used so that we can <signal> it to wakeup one
/// thread up (e.g., when the <notify> method is called).
ACE_Auto_Event wakeup_one_thread_;
+
/// Message queue that keeps track of pending <ACE_Event_Handlers>.
/// This queue must be thread-safe because it can be called by
/// multiple threads of control.
ACE_Message_Queue<ACE_MT_SYNCH> message_queue_;
+
/**
* Keeps track of the maximum number of times that the
* <ACE_WFMO_Reactor_Notify::handle_input> method will iterate and
@@ -496,6 +611,7 @@ private:
*/
int max_notify_iterations_;
};
+
/**
* @class ACE_WFMO_Reactor
*
@@ -537,6 +653,7 @@ class ACE_Export ACE_WFMO_Reactor : public ACE_Reactor_Impl
public:
friend class ACE_WFMO_Reactor_Handler_Repository;
friend class ACE_WFMO_Reactor_Test;
+
enum
{
/// Default size of the WFMO_Reactor's handle table.
@@ -547,11 +664,14 @@ public:
*/
DEFAULT_SIZE = MAXIMUM_WAIT_OBJECTS - 2
};
+
// = Initialization and termination methods.
+
/// Initialize ACE_WFMO_Reactor with the default size.
ACE_WFMO_Reactor (ACE_Sig_Handler * = 0,
ACE_Timer_Queue * = 0,
ACE_Reactor_Notify * = 0);
+
/**
* Initialize ACE_WFMO_Reactor with the specified size.
*
@@ -566,6 +686,7 @@ public:
ACE_Sig_Handler * = 0,
ACE_Timer_Queue * = 0,
ACE_Reactor_Notify * = 0);
+
/**
* Initialize ACE_WFMO_Reactor with the specified size.
*
@@ -581,25 +702,34 @@ public:
ACE_Timer_Queue * = 0,
int disable_notify_pipe = 0,
ACE_Reactor_Notify * = 0);
+
/// Returns -1 (not used in this implementation);
virtual int current_info (ACE_HANDLE, size_t & /* size */);
+
/// Use a user specified signal handler instead.
virtual int set_sig_handler (ACE_Sig_Handler *signal_handler);
+
/// Set a user-specified timer queue.
virtual int timer_queue (ACE_Timer_Queue *tq);
+
/// Return the current ACE_Timer_Queue.
virtual ACE_Timer_Queue *timer_queue (void) const;
+
/// Close down the ACE_WFMO_Reactor and release all of its resources.
virtual int close (void);
+
/// Close down the ACE_WFMO_Reactor and release all of its resources.
virtual ~ACE_WFMO_Reactor (void);
+
// = Event loop drivers.
+
/**
* This method is not currently implemented. We recommend that you
* use handle_events (ACE_Time_Value::zero) to get basically the
* same effect, i.e., it won't block the caller if there are no events.
*/
virtual int work_pending (const ACE_Time_Value &max_wait_time = ACE_Time_Value::zero);
+
/**
* This event loop driver blocks for up to @a max_wait_time before
* returning. It will return earlier if timer events, I/O events,
@@ -625,6 +755,7 @@ public:
*/
virtual int handle_events (ACE_Time_Value *max_wait_time = 0);
virtual int alertable_handle_events (ACE_Time_Value *max_wait_time = 0);
+
/**
* This method is just like the one above, except the
* @a max_wait_time value is a reference and can therefore never be
@@ -637,20 +768,25 @@ public:
virtual int handle_events (ACE_Time_Value &max_wait_time);
virtual int alertable_handle_events (ACE_Time_Value &max_wait_time);
+
// = Event handling control.
+
/**
* Return the status of Reactor. If this function returns 0, the reactor is
* actively handling events. If it returns non-zero, <handling_events> and
* <handle_alertable_events> return -1 immediately.
*/
virtual int deactivated (void);
+
/**
* Control whether the Reactor will handle any more incoming events or not.
* If <do_stop> == 1, the Reactor will be disabled. By default, a reactor
* is in active state and can be deactivated/reactived as wish.
*/
virtual void deactivate (int do_stop);
+
// = Register and remove Handlers.
+
/**
* Register an ACE_Event_Handler <event_handler>. Since no Event
* Mask is passed through this interface, it is assumed that the
@@ -662,6 +798,7 @@ public:
*/
virtual int register_handler (ACE_Event_Handler *event_handler,
ACE_HANDLE event_handle = ACE_INVALID_HANDLE);
+
/**
* Register an ACE_Event_Handler <event_handle>. @a mask specifies
* the network events that the <event_handler> is interested in. If
@@ -677,6 +814,7 @@ public:
ACE_HANDLE io_handle,
ACE_Event_Handler *event_handler,
ACE_Reactor_Mask mask);
+
/**
* This is a simple version of the above <register_handler> method
* where the I/O handle is passed in and the event handle will
@@ -685,6 +823,7 @@ public:
virtual int register_handler (ACE_HANDLE io_handle,
ACE_Event_Handler *event_handler,
ACE_Reactor_Mask mask);
+
/**
* This is a simple version of the above <register_handler> method
* where the I/O handle will always come from <get_handle> on the
@@ -693,11 +832,13 @@ public:
*/
virtual int register_handler (ACE_Event_Handler *event_handler,
ACE_Reactor_Mask mask);
+
/// Register <event_handler> with all the <handles> in the
/// <Handle_Set>.
virtual int register_handler (const ACE_Handle_Set &handles,
ACE_Event_Handler *event_handler,
ACE_Reactor_Mask mask);
+
/**
* Register <new_sh> to handle the signal @a signum using the
* <new_disp>. Returns the <old_sh> that was previously registered
@@ -708,11 +849,13 @@ public:
ACE_Sig_Action *new_disp = 0,
ACE_Event_Handler **old_sh = 0,
ACE_Sig_Action *old_disp = 0);
+
/// Registers <new_sh> to handle a set of signals <sigset> using the
/// <new_disp>.
virtual int register_handler (const ACE_Sig_Set &sigset,
ACE_Event_Handler *new_sh,
ACE_Sig_Action *new_disp = 0);
+
/**
* Removes <event_handler> from the <ACE_WFMO_Reactor>. Note that
* the <ACE_WFMO_Reactor> will call the <get_handle> method of
@@ -723,6 +866,7 @@ public:
*/
virtual int remove_handler (ACE_Event_Handler *event_handler,
ACE_Reactor_Mask mask);
+
/**
* Removes <handle> from the <ACE_WFMO_Reactor>. If @a mask ==
* ACE_Event_Handler::DONT_CALL then the <handle_close> method of
@@ -738,6 +882,7 @@ public:
*/
virtual int remove_handler (ACE_HANDLE handle,
ACE_Reactor_Mask mask);
+
/**
* Removes all the @a mask bindings for handles in the <handle_set>
* bind of <Event_Handler>. If there are no more bindings for any
@@ -745,6 +890,7 @@ public:
*/
virtual int remove_handler (const ACE_Handle_Set &handle_set,
ACE_Reactor_Mask);
+
/**
* Remove the ACE_Event_Handler currently associated with @a signum.
* <sigkey> is ignored in this implementation since there is only
@@ -756,32 +902,44 @@ public:
ACE_Sig_Action *new_disp,
ACE_Sig_Action *old_disp = 0,
int sigkey = -1);
+
/// Calls <remove_handler> for every signal in <sigset>.
virtual int remove_handler (const ACE_Sig_Set &sigset);
+
// = Suspend and resume Handlers.
+
/// Suspend <event_handler> temporarily. Use
/// <ACE_Event_Handler::get_handle> to get the handle.
virtual int suspend_handler (ACE_Event_Handler *event_handler);
+
/// Suspend <handle> temporarily.
virtual int suspend_handler (ACE_HANDLE handle);
+
/// Suspend all <handles> in handle set temporarily.
virtual int suspend_handler (const ACE_Handle_Set &handles);
+
/// Suspend all <handles> temporarily.
virtual int suspend_handlers (void);
+
/// Resume <event_handler>. Use <ACE_Event_Handler::get_handle> to
/// get the handle.
virtual int resume_handler (ACE_Event_Handler *event_handler);
+
/// Resume <handle>.
virtual int resume_handler (ACE_HANDLE handle);
+
/// Resume all <handles> in handle set.
virtual int resume_handler (const ACE_Handle_Set &handles);
+
/// Resume all <handles>.
virtual int resume_handlers (void);
+
/// Does the reactor allow the application to resume the handle on
/// its own ie. can it pass on the control of handle resumption to
/// the application. A positive value indicates that the handlers
/// are application resumable. A value of 0 indicates otherwise.
virtual int resumable_handler (void);
+
/**
* Return 1 if we any event associations were made by the reactor
* for the handles that it waits on, 0 otherwise. Since the
@@ -789,7 +947,9 @@ public:
* return 1.
*/
virtual int uses_event_associations (void);
+
// Timer management.
+
/**
* Schedule an ACE_Event_Handler that will expire after an amount
* of time. The return value of this method, a timer_id value,
@@ -811,6 +971,7 @@ public:
const void *arg,
const ACE_Time_Value &delay,
const ACE_Time_Value &interval = ACE_Time_Value::zero);
+
/**
* Resets the interval of the timer represented by @a timer_id to
* @a interval, which is specified in relative time to the current
@@ -820,10 +981,12 @@ public:
*/
virtual int reset_timer_interval (long timer_id,
const ACE_Time_Value &interval);
+
/// Cancel all Event_Handlers that match the address of
/// <event_handler>. Returns number of handler's cancelled.
virtual int cancel_timer (ACE_Event_Handler *event_handler,
int dont_call_handle_close = 1);
+
/**
* Cancel the single Event_Handler that matches the @a timer_id value
* (which was returned from the schedule method). If arg is
@@ -836,7 +999,9 @@ public:
virtual int cancel_timer (long timer_id,
const void **arg = 0,
int dont_call_handle_close = 1);
+
// = High-level Event_Handler scheduling operations
+
/**
* Add @a masks_to_be_added to the <event_handler>'s entry in
* WFMO_Reactor. <event_handler> must already have been registered
@@ -844,6 +1009,7 @@ public:
*/
virtual int schedule_wakeup (ACE_Event_Handler *event_handler,
ACE_Reactor_Mask masks_to_be_added);
+
/**
* Add @a masks_to_be_added to the @a handle's entry in WFMO_Reactor.
* The Event_Handler associated with <handle> must already have been
@@ -851,6 +1017,7 @@ public:
*/
virtual int schedule_wakeup (ACE_HANDLE handle,
ACE_Reactor_Mask masks_to_be_added);
+
/**
* Remove <masks_to_be_deleted> to the <handle>'s entry in
* WFMO_Reactor. The Event_Handler associated with <handle> must
@@ -858,6 +1025,7 @@ public:
*/
virtual int cancel_wakeup (ACE_Event_Handler *event_handler,
ACE_Reactor_Mask masks_to_be_deleted);
+
/**
* Remove <masks_to_be_deleted> to the <handle>'s entry in
* WFMO_Reactor. The Event_Handler associated with <handle> must
@@ -865,7 +1033,9 @@ public:
*/
virtual int cancel_wakeup (ACE_HANDLE handle,
ACE_Reactor_Mask masks_to_be_deleted);
+
// = Notification methods.
+
/**
* Wakeup one <ACE_WFMO_Reactor> thread if it is currently blocked
* in <WaitForMultipleObjects>. The ACE_Time_Value indicates how
@@ -877,6 +1047,7 @@ public:
virtual int notify (ACE_Event_Handler * = 0,
ACE_Reactor_Mask = ACE_Event_Handler::EXCEPT_MASK,
ACE_Time_Value * = 0);
+
/**
* Set the maximum number of times that the
* <ACE_WFMO_Reactor_Notify::handle_input> method will iterate and
@@ -889,6 +1060,7 @@ public:
* overhead.
*/
virtual void max_notify_iterations (int);
+
/**
* Get the maximum number of times that the
* <ACE_WFMO_Reactor_Notify::handle_input> method will iterate and
@@ -897,6 +1069,7 @@ public:
* <ACE_Message_Queue::dequeue> loop.
*/
virtual int max_notify_iterations (void);
+
/**
* Purge any notifications pending in this reactor for the specified
* ACE_Event_Handler object. Returns the number of notifications
@@ -904,12 +1077,15 @@ public:
*/
virtual int purge_pending_notifications (ACE_Event_Handler * = 0,
ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK);
+
// = Assorted helper methods.
+
/**
* Return the Event_Handler associated with <handle>. Return 0 if
* <handle> is not registered.
*/
ACE_Event_Handler *find_handler (ACE_HANDLE handle);
+
/**
* Check to see if <handle> is associated with a valid Event_Handler
* bound to @a mask. Return the <event_handler> associated with this
@@ -918,6 +1094,7 @@ public:
virtual int handler (ACE_HANDLE handle,
ACE_Reactor_Mask mask,
ACE_Event_Handler **event_handler = 0);
+
/**
* Check to see if @a signum is associated with a valid Event_Handler
* bound to a signal. Return the <event_handler> associated with
@@ -925,34 +1102,46 @@ public:
*/
virtual int handler (int signum,
ACE_Event_Handler ** = 0);
+
/// Returns true if WFMO_Reactor has been successfully initialized, else
/// false.
virtual bool initialized (void);
+
/// Returns the current size of the WFMO_Reactor's internal
/// descriptor table.
virtual size_t size (void) const;
+
/// Returns a reference to the WFMO_Reactor's internal lock.
virtual ACE_Lock &lock (void);
+
/// Wake up all threads in WaitForMultipleObjects so that they can
/// reconsult the handle set
virtual void wakeup_all_threads (void);
+
/**
* Transfers ownership of the WFMO_Reactor to the <new_owner>. The
* transfer will not complete until all threads are ready (just like
* the handle set).
*/
virtual int owner (ACE_thread_t new_owner, ACE_thread_t *old_owner = 0);
+
/// Return the ID of the "owner" thread.
virtual int owner (ACE_thread_t *owner);
+
/// Get the existing restart value.
virtual int restart (void);
+
/// Set a new value for restart and return the original value.
virtual int restart (int r);
+
/// Not implemented
virtual void requeue_position (int);
+
/// Not implemented
virtual int requeue_position (void);
+
// = Low-level wait_set mask manipulation methods.
+
/**
* Modify @a masks of the <event_handler>'s entry in WFMO_Reactor
* depending upon <operation>. <event_handler> must already have
@@ -961,6 +1150,7 @@ public:
virtual int mask_ops (ACE_Event_Handler *event_handler,
ACE_Reactor_Mask masks,
int operation);
+
/**
* Modify @a masks of the <handle>'s entry in WFMO_Reactor depending
* upon <operation>. <handle> must already have been registered
@@ -969,99 +1159,132 @@ public:
virtual int mask_ops (ACE_HANDLE handle,
ACE_Reactor_Mask masks,
int ops);
+
// = Low-level ready_set mask manipulation methods.
+
/// Not implemented
virtual int ready_ops (ACE_Event_Handler *event_handler,
ACE_Reactor_Mask mask,
int ops);
+
/// Not implemented
virtual int ready_ops (ACE_HANDLE handle,
ACE_Reactor_Mask,
int ops);
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+
/// Dump the state of an object.
virtual void dump (void) const;
+
protected:
/// Registration workhorse
virtual int register_handler_i (ACE_HANDLE event_handle,
ACE_HANDLE io_handle,
ACE_Event_Handler *event_handler,
ACE_Reactor_Mask mask);
+
/// Event handling workhorse
virtual int event_handling (ACE_Time_Value *max_wait_time = 0,
int alertable = 0);
+
/// Bit masking workhorse
virtual int mask_ops_i (ACE_HANDLE io_handle,
ACE_Reactor_Mask masks,
int operation);
+
/// Return the ID of the "owner" thread. Does not do any locking.
virtual ACE_thread_t owner_i (void);
+
/// Wait up to @a max_wait_time until it's ok to enter
/// WaitForMultipleObjects. Returns 1 (and holding lock_) if ok to wait;
/// -1 (and not holding lock_) if not.
virtual int ok_to_wait (ACE_Time_Value *max_wait_time,
int alertable);
+
/// Wait for timer and I/O events to occur.
virtual DWORD wait_for_multiple_events (int timeout,
int alertable);
+
/// Check for activity on remaining handles.
virtual DWORD poll_remaining_handles (DWORD slot);
+
/// Expire timers. Only the owner thread does useful stuff in this
/// function.
virtual int expire_timers (void);
+
/// Dispatches the timers and I/O handlers.
virtual int dispatch (DWORD wait_status);
+
/// Protect against structured exceptions caused by user code when
/// dispatching handles
virtual int safe_dispatch (DWORD wait_status);
+
/**
* Dispatches any active handles from handles_[@a slot] to
* handles_[active_handles_] using <WaitForMultipleObjects> to poll
* through our handle set looking for active handles.
*/
virtual int dispatch_handles (DWORD slot);
+
/// Dispatches a single handler. Returns 0 on success, -1 if the
/// handler was removed.
virtual int dispatch_handler (DWORD slot,
DWORD max_handlep1);
+
/// Dispatches a single handler. Returns 0 on success, -1 if the
/// handler was removed.
virtual int simple_dispatch_handler (DWORD slot,
ACE_HANDLE event_handle);
+
/// Dispatches a single handler. Returns 0 on success, -1 if the
/// handler was removed.
virtual int complex_dispatch_handler (DWORD slot,
ACE_HANDLE event_handle);
+
/// Dispatches window messages. Noop for WFMO_Reactor.
virtual int dispatch_window_messages (void);
+
virtual ACE_Reactor_Mask upcall (ACE_Event_Handler *event_handler,
ACE_HANDLE io_handle,
WSANETWORKEVENTS &events);
+
/// Used to caluculate the next timeout
virtual int calculate_timeout (ACE_Time_Value *time);
+
/// Update the state of the handler repository
virtual int update_state (void);
+
/// Check to see if we have a new owner
virtual int new_owner (void);
+
/// Set owner to new owner
virtual int change_owner (void);
+
/// Handle signals without requiring global/static variables.
ACE_Sig_Handler *signal_handler_;
+
/// Keeps track of whether we should delete the signal handler (if we
/// didn't create it, then we don't delete it).
bool delete_signal_handler_;
+
/// Defined as a pointer to allow overriding by derived classes...
ACE_Timer_Queue *timer_queue_;
+
/// Keeps track of whether we should delete the timer queue (if we
/// didn't create it, then we don't delete it).
bool delete_timer_queue_;
+
/// Keeps track of whether we should delete the handler repository
bool delete_handler_rep_;
+
/// Used when <notify> is called.
ACE_Reactor_Notify *notify_handler_;
+
/// Keeps track of whether we should delete the notify handler.
bool delete_notify_handler_;
+
/**
* Synchronization for the ACE_WFMO_Reactor.
*
@@ -1072,26 +1295,34 @@ protected:
* named. No other process can use this mutex.
*/
ACE_Process_Mutex lock_;
+
/// Adapter used to return internal lock to outside world.
ACE_Lock_Adapter<ACE_Process_Mutex> lock_adapter_;
+
/// Table that maps <ACE_HANDLEs> to <ACE_Event_Handler *>'s.
ACE_WFMO_Reactor_Handler_Repository handler_rep_;
+
/// A manual event used to block threads from proceeding into
/// WaitForMultipleObjects
ACE_Manual_Event ok_to_wait_;
+
/**
* A manual event is used so that we can wake everyone up (e.g.,
* when <ACE_Event_Handlers> are bounded and unbound from the
* handler repository).
*/
ACE_Manual_Event wakeup_all_threads_;
+
/// Used when <wakeup_all_threads_> is signaled
ACE_Wakeup_All_Threads_Handler wakeup_all_threads_handler_;
+
/// The changing thread waits on this event, till all threads are not
/// active anymore
ACE_Auto_Event waiting_to_change_state_;
+
/// Count of currently active threads
size_t active_threads_;
+
/**
* The thread which is "owner" of the WFMO_Reactor. The owner
* concept is used because we don't want multiple threads to try to
@@ -1101,28 +1332,37 @@ protected:
* can be transferred.
*/
ACE_thread_t owner_;
+
/// The owner to be of the WFMO_Reactor
ACE_thread_t new_owner_;
+
/// This is the thread which is responsible for the changing the
/// state of the <WFMO_Reactor> handle set
ACE_thread_t change_state_thread_;
+
/// This is an array of ACE_HANDLEs which keep track of the <lock_>
/// and <ok_to_wait_> handles
ACE_HANDLE atomic_wait_array_ [2];
+
/// This flag is used to keep track of whether we are already closed.
bool open_for_business_;
+
/// This flag is used to keep track of whether we are actively handling
/// events or not.
sig_atomic_t deactivated_;
+
private:
/// Deny access since member-wise won't work...
ACE_WFMO_Reactor (const ACE_WFMO_Reactor &);
ACE_WFMO_Reactor &operator = (const ACE_WFMO_Reactor &);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/WFMO_Reactor.inl"
#endif /* __ACE_INLINE__ */
+
#endif /* ACE_WIN32 */
#include /**/ "ace/post.h"
#endif /* ACE_WFMO_REACTOR_H */
diff --git a/dep/ACE_wrappers/ace/WFMO_Reactor.inl b/dep/ACE_wrappers/ace/WFMO_Reactor.inl
index 2abf621f739..a155019d841 100644
--- a/dep/ACE_wrappers/ace/WFMO_Reactor.inl
+++ b/dep/ACE_wrappers/ace/WFMO_Reactor.inl
@@ -1,13 +1,17 @@
// -*- C++ -*-
//
// $Id: WFMO_Reactor.inl 81138 2008-03-28 09:18:15Z johnnyw $
+
#include "ace/Handle_Set.h"
#include "ace/Reactor.h"
#include "ace/Thread.h"
#include "ace/Sig_Handler.h"
#include "ace/OS_NS_errno.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/************************************************************/
+
ACE_INLINE int
ACE_Wakeup_All_Threads_Handler::handle_signal (int /* signum */,
siginfo_t * /* siginfo */,
@@ -18,8 +22,11 @@ ACE_Wakeup_All_Threads_Handler::handle_signal (int /* signum */,
// ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) waking up to get updated handle set info\n")));
return 0;
}
+
#if defined (ACE_WIN32)
+
/************************************************************/
+
ACE_INLINE
ACE_WFMO_Reactor_Handler_Repository::Common_Info::Common_Info (void)
: io_entry_ (false),
@@ -31,6 +38,7 @@ ACE_WFMO_Reactor_Handler_Repository::Common_Info::Common_Info (void)
close_masks_ (ACE_Event_Handler::NULL_MASK)
{
}
+
ACE_INLINE void
ACE_WFMO_Reactor_Handler_Repository::Common_Info::reset (void)
{
@@ -42,6 +50,7 @@ ACE_WFMO_Reactor_Handler_Repository::Common_Info::reset (void)
this->delete_entry_ = false;
this->close_masks_ = ACE_Event_Handler::NULL_MASK;
}
+
ACE_INLINE void
ACE_WFMO_Reactor_Handler_Repository::Common_Info::set (bool io_entry,
ACE_Event_Handler *event_handler,
@@ -59,47 +68,61 @@ ACE_WFMO_Reactor_Handler_Repository::Common_Info::set (bool io_entry,
this->delete_entry_ = delete_entry;
this->close_masks_ = close_masks;
}
+
ACE_INLINE void
ACE_WFMO_Reactor_Handler_Repository::Common_Info::set (Common_Info &common_info)
{
*this = common_info;
}
+
ACE_INLINE void
ACE_WFMO_Reactor_Handler_Repository::Common_Info::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_WFMO_Reactor_Handler_Repository::Common_Info::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
+
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("I/O Entry = %d\n"),
this->io_entry_));
+
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("Event Handler = %d\n"),
this->event_handler_));
+
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("I/O Handle = %d\n"),
this->io_handle_));
+
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("Network Events = %d\n"),
this->network_events_));
+
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("Delete Event = %d\n"),
this->delete_event_));
+
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("Delete Entry = %d\n"),
this->delete_entry_));
+
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("Close Masks = %d\n"),
this->close_masks_));
+
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
/************************************************************/
+
ACE_INLINE
ACE_WFMO_Reactor_Handler_Repository::Current_Info::Current_Info (void)
: suspend_entry_ (false)
{
}
+
ACE_INLINE void
ACE_WFMO_Reactor_Handler_Repository::Current_Info::set (bool io_entry,
ACE_Event_Handler *event_handler,
@@ -119,6 +142,7 @@ ACE_WFMO_Reactor_Handler_Repository::Current_Info::set (bool io_entry,
delete_entry,
close_masks);
}
+
ACE_INLINE void
ACE_WFMO_Reactor_Handler_Repository::Current_Info::set (Common_Info &common_info,
bool suspend_entry)
@@ -126,37 +150,47 @@ ACE_WFMO_Reactor_Handler_Repository::Current_Info::set (Common_Info &common_info
this->suspend_entry_ = suspend_entry;
Common_Info::set (common_info);
}
+
ACE_INLINE void
ACE_WFMO_Reactor_Handler_Repository::Current_Info::reset (void)
{
this->suspend_entry_ = false;
Common_Info::reset ();
}
+
ACE_INLINE void
ACE_WFMO_Reactor_Handler_Repository::Current_Info::dump (ACE_HANDLE event_handle) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_WFMO_Reactor_Handler_Repository::Current_Info::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
+
Common_Info::dump ();
+
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("Event Handle = %d\n"),
event_handle));
+
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("Suspend Entry = %d\n"),
this->suspend_entry_));
+
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#else /* !ACE_HAS_DUMP */
ACE_UNUSED_ARG (event_handle);
#endif /* ACE_HAS_DUMP */
}
+
/************************************************************/
+
ACE_INLINE
ACE_WFMO_Reactor_Handler_Repository::To_Be_Added_Info::To_Be_Added_Info (void)
: event_handle_ (ACE_INVALID_HANDLE),
suspend_entry_ (false)
{
}
+
ACE_INLINE void
ACE_WFMO_Reactor_Handler_Repository::To_Be_Added_Info::set (ACE_HANDLE event_handle,
bool io_entry,
@@ -178,6 +212,7 @@ ACE_WFMO_Reactor_Handler_Repository::To_Be_Added_Info::set (ACE_HANDLE event_han
delete_entry,
close_masks);
}
+
ACE_INLINE void
ACE_WFMO_Reactor_Handler_Repository::To_Be_Added_Info::set (ACE_HANDLE event_handle,
Common_Info &common_info,
@@ -187,6 +222,7 @@ ACE_WFMO_Reactor_Handler_Repository::To_Be_Added_Info::set (ACE_HANDLE event_han
this->suspend_entry_ = suspend_entry;
Common_Info::set (common_info);
}
+
ACE_INLINE void
ACE_WFMO_Reactor_Handler_Repository::To_Be_Added_Info::reset (void)
{
@@ -194,29 +230,38 @@ ACE_WFMO_Reactor_Handler_Repository::To_Be_Added_Info::reset (void)
this->suspend_entry_ = false;
Common_Info::reset ();
}
+
ACE_INLINE void
ACE_WFMO_Reactor_Handler_Repository::To_Be_Added_Info::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_WFMO_Reactor_Handler_Repository::To_Be_Added_Info::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
+
Common_Info::dump ();
+
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("Event Handle = %d\n"),
this->event_handle_));
+
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("Suspend Entry = %d\n"),
this->suspend_entry_));
+
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
/************************************************************/
+
ACE_INLINE
ACE_WFMO_Reactor_Handler_Repository::Suspended_Info::Suspended_Info (void)
: event_handle_ (ACE_INVALID_HANDLE),
resume_entry_ (false)
{
}
+
ACE_INLINE void
ACE_WFMO_Reactor_Handler_Repository::Suspended_Info::reset (void)
{
@@ -224,6 +269,7 @@ ACE_WFMO_Reactor_Handler_Repository::Suspended_Info::reset (void)
this->resume_entry_ = false;
Common_Info::reset ();
}
+
ACE_INLINE void
ACE_WFMO_Reactor_Handler_Repository::Suspended_Info::set (ACE_HANDLE event_handle,
bool io_entry,
@@ -245,6 +291,7 @@ ACE_WFMO_Reactor_Handler_Repository::Suspended_Info::set (ACE_HANDLE event_handl
delete_entry,
close_masks);
}
+
ACE_INLINE void
ACE_WFMO_Reactor_Handler_Repository::Suspended_Info::set (ACE_HANDLE event_handle,
Common_Info &common_info,
@@ -254,30 +301,40 @@ ACE_WFMO_Reactor_Handler_Repository::Suspended_Info::set (ACE_HANDLE event_handl
this->resume_entry_ = resume_entry;
Common_Info::set (common_info);
}
+
ACE_INLINE void
ACE_WFMO_Reactor_Handler_Repository::Suspended_Info::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_WFMO_Reactor_Handler_Repository::Suspended_Info::dump");
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
+
Common_Info::dump ();
+
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("Event Handle = %d\n"),
this->event_handle_));
+
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("Resume Entry = %d\n"),
this->resume_entry_));
+
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
+
/************************************************************/
+
ACE_INLINE int
ACE_WFMO_Reactor_Handler_Repository::close (void)
{
// Let all the handlers know that the <WFMO_Reactor> is closing down
this->unbind_all ();
+
return 0;
}
+
ACE_INLINE ACE_HANDLE *
ACE_WFMO_Reactor_Handler_Repository::handles (void) const
{
@@ -292,6 +349,7 @@ ACE_WFMO_Reactor_Handler_Repository::handles (void) const
else
return this->current_handles_ + 1;
}
+
ACE_INLINE ACE_WFMO_Reactor_Handler_Repository::Current_Info *
ACE_WFMO_Reactor_Handler_Repository::current_info (void) const
{
@@ -300,6 +358,7 @@ ACE_WFMO_Reactor_Handler_Repository::current_info (void) const
else
return this->current_info_ + 1;
}
+
ACE_INLINE DWORD
ACE_WFMO_Reactor_Handler_Repository::max_handlep1 (void) const
{
@@ -308,6 +367,7 @@ ACE_WFMO_Reactor_Handler_Repository::max_handlep1 (void) const
else
return this->max_handlep1_ - 1;
}
+
ACE_INLINE int
ACE_WFMO_Reactor_Handler_Repository::scheduled_for_deletion (size_t slot) const
{
@@ -316,6 +376,7 @@ ACE_WFMO_Reactor_Handler_Repository::scheduled_for_deletion (size_t slot) const
else
return this->current_info_[slot + 1].delete_entry_ == true;
}
+
ACE_INLINE int
ACE_WFMO_Reactor_Handler_Repository::invalid_handle (ACE_HANDLE handle) const
{
@@ -330,6 +391,7 @@ ACE_WFMO_Reactor_Handler_Repository::invalid_handle (ACE_HANDLE handle) const
else
return 0;
}
+
ACE_INLINE bool
ACE_WFMO_Reactor_Handler_Repository::changes_required (void)
{
@@ -339,6 +401,7 @@ ACE_WFMO_Reactor_Handler_Repository::changes_required (void)
|| this->handles_to_be_suspended_ > 0
|| this->handles_to_be_resumed_ > 0;
}
+
ACE_INLINE int
ACE_WFMO_Reactor_Handler_Repository::make_changes (void)
{
@@ -346,50 +409,65 @@ ACE_WFMO_Reactor_Handler_Repository::make_changes (void)
// <WFMO_Reactor->change_state_thread_>. We therefore assume that
// there will be no contention for this method and hence no guards
// are neccessary.
+
// Deletions and suspensions in current_info_
this->make_changes_in_current_infos ();
+
// Deletions and resumptions in current_suspended_info_
this->make_changes_in_suspension_infos ();
+
// Deletions in to_be_added_info_, or transfers to current_info_ or
// current_suspended_info_ from to_be_added_info_
this->make_changes_in_to_be_added_infos ();
+
return 0;
}
+
ACE_INLINE int
ACE_WFMO_Reactor_Handler_Repository::unbind (ACE_HANDLE handle,
ACE_Reactor_Mask mask)
{
if (this->invalid_handle (handle))
return -1;
+
ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->wfmo_reactor_.lock_, -1);
+
bool changes_required = false;
int const result = this->unbind_i (handle,
mask,
changes_required);
+
if (changes_required)
// Wake up all threads in WaitForMultipleObjects so that they can
// reconsult the handle set
this->wfmo_reactor_.wakeup_all_threads ();
+
return result;
}
+
ACE_INLINE int
ACE_WFMO_Reactor::reset_timer_interval
(long timer_id,
const ACE_Time_Value &interval)
{
ACE_TRACE ("ACE_WFMO_Reactor::reset_timer_interval");
+
if (0 != this->timer_queue_)
{
long result = this->timer_queue_->reset_interval
(timer_id,
interval);
+
// Wakeup the owner thread so that it gets the latest timer values
this->notify ();
+
return result;
}
+
errno = ESHUTDOWN;
return -1;
}
+
ACE_INLINE long
ACE_WFMO_Reactor::schedule_timer (ACE_Event_Handler *handler,
const void *arg,
@@ -397,6 +475,7 @@ ACE_WFMO_Reactor::schedule_timer (ACE_Event_Handler *handler,
const ACE_Time_Value &interval)
{
ACE_TRACE ("ACE_WFMO_Reactor::schedule_timer");
+
if (0 != this->timer_queue_)
{
long result = this->timer_queue_->schedule
@@ -404,13 +483,17 @@ ACE_WFMO_Reactor::schedule_timer (ACE_Event_Handler *handler,
arg,
timer_queue_->gettimeofday () + delay_time,
interval);
+
// Wakeup the owner thread so that it gets the latest timer values
this->notify ();
+
return result;
}
+
errno = ESHUTDOWN;
return -1;
}
+
ACE_INLINE int
ACE_WFMO_Reactor::cancel_timer (ACE_Event_Handler *handler,
int dont_call_handle_close)
@@ -420,6 +503,7 @@ ACE_WFMO_Reactor::cancel_timer (ACE_Event_Handler *handler,
return this->timer_queue_->cancel (handler, dont_call_handle_close);
return 0;
}
+
ACE_INLINE int
ACE_WFMO_Reactor::cancel_timer (long timer_id,
const void **arg,
@@ -430,12 +514,14 @@ ACE_WFMO_Reactor::cancel_timer (long timer_id,
return this->timer_queue_->cancel (timer_id, arg, dont_call_handle_close);
return 0;
}
+
ACE_INLINE int
ACE_WFMO_Reactor::register_handler (ACE_Event_Handler *event_handler,
ACE_HANDLE event_handle)
{
// This GUARD is necessary since we are updating shared state.
ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1);
+
return this->handler_rep_.bind_i (0,
event_handler,
0,
@@ -443,17 +529,20 @@ ACE_WFMO_Reactor::register_handler (ACE_Event_Handler *event_handler,
event_handle,
0);
}
+
ACE_INLINE int
ACE_WFMO_Reactor::register_handler (ACE_Event_Handler *event_handler,
ACE_Reactor_Mask mask)
{
// This GUARD is necessary since we are updating shared state.
ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1);
+
return this->register_handler_i (ACE_INVALID_HANDLE,
ACE_INVALID_HANDLE,
event_handler,
mask);
}
+
ACE_INLINE int
ACE_WFMO_Reactor::register_handler (ACE_HANDLE io_handle,
ACE_Event_Handler *event_handler,
@@ -461,11 +550,13 @@ ACE_WFMO_Reactor::register_handler (ACE_HANDLE io_handle,
{
// This GUARD is necessary since we are updating shared state.
ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1);
+
return this->register_handler_i (ACE_INVALID_HANDLE,
io_handle,
event_handler,
mask);
}
+
ACE_INLINE int
ACE_WFMO_Reactor::register_handler (ACE_HANDLE event_handle,
ACE_HANDLE io_handle,
@@ -474,11 +565,13 @@ ACE_WFMO_Reactor::register_handler (ACE_HANDLE event_handle,
{
// This GUARD is necessary since we are updating shared state.
ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1);
+
return this->register_handler_i (event_handle,
io_handle,
event_handler,
mask);
}
+
ACE_INLINE int
ACE_WFMO_Reactor::register_handler (const ACE_Handle_Set &handles,
ACE_Event_Handler *handler,
@@ -486,56 +579,68 @@ ACE_WFMO_Reactor::register_handler (const ACE_Handle_Set &handles,
{
// This GUARD is necessary since we are updating shared state.
ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1);
+
ACE_Handle_Set_Iterator handle_iter (handles);
ACE_HANDLE h;
+
while ((h = handle_iter ()) != ACE_INVALID_HANDLE)
if (this->register_handler_i (h,
ACE_INVALID_HANDLE,
handler,
mask) == -1)
return -1;
+
return 0;
}
+
ACE_INLINE int
ACE_WFMO_Reactor::schedule_wakeup (ACE_HANDLE io_handle,
ACE_Reactor_Mask masks_to_be_added)
{
// This GUARD is necessary since we are updating shared state.
ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1);
+
return this->mask_ops_i (io_handle,
masks_to_be_added,
ACE_Reactor::ADD_MASK);
}
+
ACE_INLINE int
ACE_WFMO_Reactor::schedule_wakeup (ACE_Event_Handler *event_handler,
ACE_Reactor_Mask masks_to_be_added)
{
// This GUARD is necessary since we are updating shared state.
ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1);
+
return this->mask_ops_i (event_handler->get_handle (),
masks_to_be_added,
ACE_Reactor::ADD_MASK);
}
+
ACE_INLINE int
ACE_WFMO_Reactor::cancel_wakeup (ACE_HANDLE io_handle,
ACE_Reactor_Mask masks_to_be_removed)
{
// This GUARD is necessary since we are updating shared state.
ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1);
+
return this->mask_ops_i (io_handle,
masks_to_be_removed,
ACE_Reactor::CLR_MASK);
}
+
ACE_INLINE int
ACE_WFMO_Reactor::cancel_wakeup (ACE_Event_Handler *event_handler,
ACE_Reactor_Mask masks_to_be_removed)
{
// This GUARD is necessary since we are updating shared state.
ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1);
+
return this->mask_ops_i (event_handler->get_handle (),
masks_to_be_removed,
ACE_Reactor::CLR_MASK);
}
+
ACE_INLINE int
ACE_WFMO_Reactor::remove_handler (ACE_Event_Handler *event_handler,
ACE_Reactor_Mask mask)
@@ -543,6 +648,7 @@ ACE_WFMO_Reactor::remove_handler (ACE_Event_Handler *event_handler,
return this->handler_rep_.unbind (event_handler->get_handle (),
mask);
}
+
ACE_INLINE int
ACE_WFMO_Reactor::remove_handler (ACE_HANDLE handle,
ACE_Reactor_Mask mask)
@@ -550,6 +656,7 @@ ACE_WFMO_Reactor::remove_handler (ACE_HANDLE handle,
return this->handler_rep_.unbind (handle,
mask);
}
+
ACE_INLINE int
ACE_WFMO_Reactor::remove_handler (const ACE_Handle_Set &handles,
ACE_Reactor_Mask mask)
@@ -557,60 +664,77 @@ ACE_WFMO_Reactor::remove_handler (const ACE_Handle_Set &handles,
ACE_Handle_Set_Iterator handle_iter (handles);
ACE_HANDLE h;
bool changes_required = false;
+
ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1);
+
while ((h = handle_iter ()) != ACE_INVALID_HANDLE)
if (this->handler_rep_.unbind_i (h,
mask,
changes_required) == -1)
return -1;
+
// Wake up all threads in WaitForMultipleObjects so that they can
// reconsult the handle set
this->wakeup_all_threads ();
+
return 0;
}
+
ACE_INLINE int
ACE_WFMO_Reactor::suspend_handler (ACE_HANDLE handle)
{
ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1);
+
bool changes_required = false;
int const result =
this->handler_rep_.suspend_handler_i (handle,
changes_required);
+
if (changes_required)
// Wake up all threads in WaitForMultipleObjects so that they can
// reconsult the handle set
this->wakeup_all_threads ();
+
return result;
}
+
ACE_INLINE int
ACE_WFMO_Reactor::suspend_handler (ACE_Event_Handler *event_handler)
{
return this->suspend_handler (event_handler->get_handle ());
}
+
ACE_INLINE int
ACE_WFMO_Reactor::suspend_handler (const ACE_Handle_Set &handles)
{
ACE_Handle_Set_Iterator handle_iter (handles);
ACE_HANDLE h;
bool changes_required = false;
+
ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1);
+
while ((h = handle_iter ()) != ACE_INVALID_HANDLE)
if (this->handler_rep_.suspend_handler_i (h,
changes_required) == -1)
return -1;
+
// Wake up all threads in WaitForMultipleObjects so that they can
// reconsult the handle set
this->wakeup_all_threads ();
+
return 0;
}
+
ACE_INLINE int
ACE_WFMO_Reactor::suspend_handlers (void)
{
bool error = false;
int result = 0;
ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1);
+
// First suspend all current handles
bool changes_required = false;
+
for (size_t i = 0;
i < this->handler_rep_.max_handlep1_ && !error;
i++)
@@ -621,6 +745,7 @@ ACE_WFMO_Reactor::suspend_handlers (void)
if (result == -1)
error = true;
}
+
// Then suspend all to_be_added_handles
for (size_t i = 0;
i < this->handler_rep_.handles_to_be_added_ && !error;
@@ -641,51 +766,65 @@ ACE_WFMO_Reactor::suspend_handlers (void)
if (result == -1)
error = true;
}
+
// Wake up all threads in WaitForMultipleObjects so that they can
// reconsult the handle set
this->wakeup_all_threads ();
+
return error ? -1 : 0;
}
+
ACE_INLINE int
ACE_WFMO_Reactor::resume_handler (ACE_HANDLE handle)
{
ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1);
+
bool changes_required = false;
int result =
this->handler_rep_.resume_handler_i (handle, changes_required);
+
if (changes_required)
// Wake up all threads in WaitForMultipleObjects so that they can
// reconsult the handle set
this->wakeup_all_threads ();
+
return result;
}
+
ACE_INLINE int
ACE_WFMO_Reactor::resume_handler (ACE_Event_Handler *event_handler)
{
return this->resume_handler (event_handler->get_handle ());
}
+
ACE_INLINE int
ACE_WFMO_Reactor::resume_handler (const ACE_Handle_Set &handles)
{
ACE_Handle_Set_Iterator handle_iter (handles);
ACE_HANDLE h;
bool changes_required = false;
+
ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1);
+
while ((h = handle_iter ()) != ACE_INVALID_HANDLE)
if (this->handler_rep_.resume_handler_i (h,
changes_required) == -1)
return -1;
+
// Wake up all threads in WaitForMultipleObjects so that they can
// reconsult the handle set
this->wakeup_all_threads ();
+
return 0;
}
+
ACE_INLINE int
ACE_WFMO_Reactor::resume_handlers (void)
{
bool error = false;
int result = 0;
ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1);
+
bool changes_required = false;
for (size_t i = 0;
i < this->handler_rep_.suspended_handles_ && !error;
@@ -697,6 +836,7 @@ ACE_WFMO_Reactor::resume_handlers (void)
if (result == -1)
error = true;
}
+
// Then resume all to_be_added_handles
for (size_t i = 0;
i < this->handler_rep_.handles_to_be_added_ && !error;
@@ -717,11 +857,14 @@ ACE_WFMO_Reactor::resume_handlers (void)
if (result == -1)
error = true;
}
+
// Wake up all threads in WaitForMultipleObjects so that they can
// reconsult the handle set
this->wakeup_all_threads ();
+
return error ? -1 : 0;
}
+
ACE_INLINE int
ACE_WFMO_Reactor::uses_event_associations (void)
{
@@ -729,37 +872,44 @@ ACE_WFMO_Reactor::uses_event_associations (void)
// always return 1.
return 1;
}
+
ACE_INLINE int
ACE_WFMO_Reactor::handle_events (ACE_Time_Value &how_long)
{
return this->event_handling (&how_long, FALSE);
}
+
ACE_INLINE int
ACE_WFMO_Reactor::alertable_handle_events (ACE_Time_Value &how_long)
{
return this->event_handling (&how_long, TRUE);
}
+
ACE_INLINE int
ACE_WFMO_Reactor::handle_events (ACE_Time_Value *how_long)
{
return this->event_handling (how_long, FALSE);
}
+
ACE_INLINE int
ACE_WFMO_Reactor::alertable_handle_events (ACE_Time_Value *how_long)
{
return this->event_handling (how_long, TRUE);
}
+
ACE_INLINE int
ACE_WFMO_Reactor::deactivated (void)
{
return this->deactivated_;
}
+
ACE_INLINE void
ACE_WFMO_Reactor::deactivate (int do_stop)
{
this->deactivated_ = do_stop;
this->wakeup_all_threads ();
}
+
ACE_INLINE int
ACE_WFMO_Reactor::owner (ACE_thread_t *t)
{
@@ -767,28 +917,35 @@ ACE_WFMO_Reactor::owner (ACE_thread_t *t)
*t = this->owner_i ();
return 0;
}
+
ACE_INLINE ACE_thread_t
ACE_WFMO_Reactor::owner_i (void)
{
return this->owner_;
}
+
ACE_INLINE int
ACE_WFMO_Reactor::owner (ACE_thread_t new_owner, ACE_thread_t *old_owner)
{
ACE_GUARD_RETURN (ACE_Process_Mutex, monitor, this->lock_, -1);
this->new_owner_ = new_owner;
+
if (old_owner != 0)
*old_owner = this->owner_i ();
+
// Wake up all threads in WaitForMultipleObjects so that they can
// reconsult the new owner responsibilities
this->wakeup_all_threads ();
+
return 0;
}
+
ACE_INLINE int
ACE_WFMO_Reactor::new_owner (void)
{
return this->new_owner_ != ACE_thread_t (0);
}
+
ACE_INLINE int
ACE_WFMO_Reactor::change_owner (void)
{
@@ -796,6 +953,7 @@ ACE_WFMO_Reactor::change_owner (void)
this->new_owner_ = ACE_thread_t (0);
return 0;
}
+
ACE_INLINE int
ACE_WFMO_Reactor::safe_dispatch (DWORD wait_status)
{
@@ -808,18 +966,22 @@ ACE_WFMO_Reactor::safe_dispatch (DWORD wait_status)
{
this->update_state ();
}
+
return result;
}
+
ACE_INLINE int
ACE_WFMO_Reactor::dispatch_window_messages (void)
{
return 0;
}
+
ACE_INLINE void
ACE_WFMO_Reactor::wakeup_all_threads (void)
{
this->wakeup_all_threads_.signal ();
}
+
ACE_INLINE int
ACE_WFMO_Reactor::notify (ACE_Event_Handler *event_handler,
ACE_Reactor_Mask mask,
@@ -827,6 +989,7 @@ ACE_WFMO_Reactor::notify (ACE_Event_Handler *event_handler,
{
return this->notify_handler_->notify (event_handler, mask, timeout);
}
+
ACE_INLINE int
ACE_WFMO_Reactor::register_handler (int signum,
ACE_Event_Handler *new_sh,
@@ -838,12 +1001,14 @@ ACE_WFMO_Reactor::register_handler (int signum,
new_sh, new_disp,
old_sh, old_disp);
}
+
ACE_INLINE int
ACE_WFMO_Reactor::register_handler (const ACE_Sig_Set &sigset,
ACE_Event_Handler *new_sh,
ACE_Sig_Action *new_disp)
{
int result = 0;
+
#if (ACE_NSIG > 0)
for (int s = 1; s < ACE_NSIG; s++)
if (sigset.is_member (s)
@@ -856,8 +1021,10 @@ ACE_WFMO_Reactor::register_handler (const ACE_Sig_Set &sigset,
ACE_UNUSED_ARG (new_sh);
ACE_UNUSED_ARG (new_disp);
#endif /* ACE_NSIG */
+
return result;
}
+
ACE_INLINE int
ACE_WFMO_Reactor::remove_handler (int signum,
ACE_Sig_Action *new_disp,
@@ -869,10 +1036,12 @@ ACE_WFMO_Reactor::remove_handler (int signum,
old_disp,
sigkey);
}
+
ACE_INLINE int
ACE_WFMO_Reactor::remove_handler (const ACE_Sig_Set &sigset)
{
int result = 0;
+
#if (ACE_NSIG > 0)
for (int s = 1; s < ACE_NSIG; s++)
if (sigset.is_member (s)
@@ -881,60 +1050,72 @@ ACE_WFMO_Reactor::remove_handler (const ACE_Sig_Set &sigset)
#else
ACE_UNUSED_ARG (sigset);
#endif /* ACE_NSIG */
+
return result;
}
+
ACE_INLINE int
ACE_WFMO_Reactor::handler (int signum, ACE_Event_Handler **eh)
{
ACE_Event_Handler *handler =
this->signal_handler_->handler (signum);
+
if (handler == 0)
return -1;
else if (eh != 0)
*eh = handler;
return 0;
}
+
ACE_INLINE int
ACE_WFMO_Reactor::mask_ops (ACE_Event_Handler *event_handler,
ACE_Reactor_Mask mask,
int operation)
{
ACE_GUARD_RETURN (ACE_Process_Mutex, monitor, this->lock_, -1);
+
return this->mask_ops_i (event_handler->get_handle (),
mask,
operation);
}
+
ACE_INLINE int
ACE_WFMO_Reactor::mask_ops (ACE_HANDLE io_handle,
ACE_Reactor_Mask mask,
int operation)
{
ACE_GUARD_RETURN (ACE_Process_Mutex, monitor, this->lock_, -1);
+
return this->mask_ops_i (io_handle,
mask,
operation);
}
+
ACE_INLINE void
ACE_WFMO_Reactor::requeue_position (int)
{
// Not implemented
}
+
ACE_INLINE int
ACE_WFMO_Reactor::requeue_position (void)
{
// Don't have an implementation for this yet...
ACE_NOTSUP_RETURN (-1);
}
+
ACE_INLINE int
ACE_WFMO_Reactor::restart (void)
{
return 0;
}
+
ACE_INLINE int
ACE_WFMO_Reactor::restart (int)
{
return 0;
}
+
ACE_INLINE int
ACE_WFMO_Reactor::ready_ops (ACE_Event_Handler *event_handler,
ACE_Reactor_Mask mask,
@@ -946,6 +1127,7 @@ ACE_WFMO_Reactor::ready_ops (ACE_Event_Handler *event_handler,
ACE_UNUSED_ARG (ops);
ACE_NOTSUP_RETURN (-1);
}
+
ACE_INLINE int
ACE_WFMO_Reactor::ready_ops (ACE_HANDLE handle,
ACE_Reactor_Mask,
@@ -956,32 +1138,39 @@ ACE_WFMO_Reactor::ready_ops (ACE_HANDLE handle,
ACE_UNUSED_ARG (ops);
ACE_NOTSUP_RETURN (-1);
}
+
ACE_INLINE ACE_Event_Handler *
ACE_WFMO_Reactor::find_handler (ACE_HANDLE handle)
{
ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, 0);
+
return this->handler_rep_.find_handler (handle);
}
+
ACE_INLINE int
ACE_WFMO_Reactor::handler (ACE_HANDLE handle,
ACE_Reactor_Mask mask,
ACE_Event_Handler **event_handler)
{
ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1);
+
return this->handler_rep_.handler (handle,
mask,
event_handler);
}
+
ACE_INLINE bool
ACE_WFMO_Reactor::initialized (void)
{
return this->open_for_business_;
}
+
ACE_INLINE ACE_Lock &
ACE_WFMO_Reactor::lock (void)
{
return this->lock_adapter_;
}
+
ACE_INLINE size_t
ACE_WFMO_Reactor::size (void) const
{
@@ -994,14 +1183,18 @@ ACE_WFMO_Reactor_Handler_Repository::changes_required (void)
{
return false;
}
+
ACE_INLINE int
ACE_WFMO_Reactor_Handler_Repository::make_changes (void)
{
return 0;
}
+
ACE_INLINE
ACE_WFMO_Reactor_Handler_Repository::~ACE_WFMO_Reactor_Handler_Repository (void)
{
}
+
#endif /* ACE_WIN32 */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/WIN32_Asynch_IO.cpp b/dep/ACE_wrappers/ace/WIN32_Asynch_IO.cpp
index b839aced003..43cb20c4343 100644
--- a/dep/ACE_wrappers/ace/WIN32_Asynch_IO.cpp
+++ b/dep/ACE_wrappers/ace/WIN32_Asynch_IO.cpp
@@ -1,10 +1,14 @@
// $Id: WIN32_Asynch_IO.cpp 82444 2008-07-28 13:33:07Z johnnyw $
+
#include "ace/WIN32_Asynch_IO.h"
+
ACE_RCSID (ace,
Win32_Asynch_IO,
"$Id: WIN32_Asynch_IO.cpp 82444 2008-07-28 13:33:07Z johnnyw $")
+
#if defined (ACE_HAS_WIN32_OVERLAPPED_IO) && \
(defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 == 1))
+
#include "ace/WIN32_Proactor.h"
#include "ace/Proactor.h"
#include "ace/Message_Block.h"
@@ -14,82 +18,100 @@ ACE_RCSID (ace,
#include "ace/OS_NS_errno.h"
#include "ace/OS_NS_unistd.h"
#include "ace/OS_NS_sys_socket.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
size_t
ACE_WIN32_Asynch_Result::bytes_transferred (void) const
{
return this->bytes_transferred_;
}
+
const void *
ACE_WIN32_Asynch_Result::act (void) const
{
return this->act_;
}
+
int
ACE_WIN32_Asynch_Result::success (void) const
{
return this->success_;
}
+
const void *
ACE_WIN32_Asynch_Result::completion_key (void) const
{
return this->completion_key_;
}
+
u_long
ACE_WIN32_Asynch_Result::error (void) const
{
return this->error_;
}
+
ACE_HANDLE
ACE_WIN32_Asynch_Result::event (void) const
{
return this->hEvent;
}
+
u_long
ACE_WIN32_Asynch_Result::offset (void) const
{
return this->Offset;
}
+
u_long
ACE_WIN32_Asynch_Result::offset_high (void) const
{
return this->OffsetHigh;
}
+
int
ACE_WIN32_Asynch_Result::priority (void) const
{
ACE_NOTSUP_RETURN (0);
}
+
int
ACE_WIN32_Asynch_Result::signal_number (void) const
{
ACE_NOTSUP_RETURN (0);
}
+
int
ACE_WIN32_Asynch_Result::post_completion (ACE_Proactor_Impl *proactor)
{
// Get to the platform specific implementation.
ACE_WIN32_Proactor *win32_proactor = dynamic_cast<ACE_WIN32_Proactor *> (proactor);
+
if (win32_proactor == 0)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("Dynamic cast to WIN32 Proactor failed\n")),
-1);
+
// Post myself.
return win32_proactor->post_completion (this);
}
+
void
ACE_WIN32_Asynch_Result::set_bytes_transferred (size_t nbytes)
{
this->bytes_transferred_ = nbytes;
}
+
void
ACE_WIN32_Asynch_Result::set_error (u_long errcode)
{
this->error_ = errcode;
}
+
ACE_WIN32_Asynch_Result::~ACE_WIN32_Asynch_Result (void)
{
}
+
ACE_WIN32_Asynch_Result::ACE_WIN32_Asynch_Result
(const ACE_Handler::Proxy_Ptr &handler_proxy,
const void* act,
@@ -113,9 +135,11 @@ ACE_WIN32_Asynch_Result::ACE_WIN32_Asynch_Result
this->Offset = offset;
this->OffsetHigh = offset_high;
this->hEvent = event;
+
ACE_UNUSED_ARG (priority);
ACE_UNUSED_ARG (signal_number);
}
+
int
ACE_WIN32_Asynch_Operation::open (const ACE_Handler::Proxy_Ptr &handler_proxy,
ACE_HANDLE handle,
@@ -125,6 +149,7 @@ ACE_WIN32_Asynch_Operation::open (const ACE_Handler::Proxy_Ptr &handler_proxy,
this->proactor_ = proactor;
this->handler_proxy_ = handler_proxy;
this->handle_ = handle;
+
// Grab the handle from the <handler> if <handle> is invalid
if (this->handle_ == ACE_INVALID_HANDLE)
{
@@ -134,14 +159,17 @@ ACE_WIN32_Asynch_Operation::open (const ACE_Handler::Proxy_Ptr &handler_proxy,
}
if (this->handle_ == ACE_INVALID_HANDLE)
return -1;
+
if (this->proactor_!= 0)
// update implementation.
this->win32_proactor_ =
dynamic_cast <ACE_WIN32_Proactor *>(this->proactor_->implementation ());
+
// Register with the <proactor>.
return this->win32_proactor_->register_handle (this->handle_,
completion_key);
}
+
int
ACE_WIN32_Asynch_Operation::cancel (void)
{
@@ -149,23 +177,29 @@ ACE_WIN32_Asynch_Operation::cancel (void)
// All I/O operations that are canceled will complete with the error
// ERROR_OPERATION_ABORTED. All completion notifications for the I/O
// operations will occur normally.
+
// @@ This API returns 0 on failure. So, I am returning -1 in that
// case. Is that right? (Alex).
int const result = (int) ::CancelIo (this->handle_);
+
if (result == 0)
// Couldn't cancel the operations.
return 2;
+
// result is non-zero. All the operations are cancelled then.
return 0;
+
#else /* !ACE_HAS_WIN32_OVERLAPPED_IO */
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_AIO_CALLS */
}
+
ACE_Proactor *
ACE_WIN32_Asynch_Operation::proactor (void) const
{
return this->proactor_;
}
+
ACE_WIN32_Asynch_Operation::ACE_WIN32_Asynch_Operation (ACE_WIN32_Proactor *win32_proactor)
: ACE_Asynch_Operation_Impl (),
win32_proactor_ (win32_proactor),
@@ -173,25 +207,31 @@ ACE_WIN32_Asynch_Operation::ACE_WIN32_Asynch_Operation (ACE_WIN32_Proactor *win3
handle_ (ACE_INVALID_HANDLE)
{
}
+
ACE_WIN32_Asynch_Operation::~ACE_WIN32_Asynch_Operation (void)
{
}
+
// ************************************************************
+
size_t
ACE_WIN32_Asynch_Read_Stream_Result::bytes_to_read (void) const
{
return this->bytes_to_read_;
}
+
ACE_Message_Block &
ACE_WIN32_Asynch_Read_Stream_Result::message_block (void) const
{
return this->message_block_;
}
+
ACE_HANDLE
ACE_WIN32_Asynch_Read_Stream_Result::handle (void) const
{
return this->handle_;
}
+
ACE_WIN32_Asynch_Read_Stream_Result::ACE_WIN32_Asynch_Read_Stream_Result (
const ACE_Handler::Proxy_Ptr &handler_proxy,
ACE_HANDLE handle,
@@ -217,6 +257,7 @@ ACE_WIN32_Asynch_Read_Stream_Result::ACE_WIN32_Asynch_Read_Stream_Result (
scatter_enabled_ (scatter_enabled)
{
}
+
void
ACE_WIN32_Asynch_Read_Stream_Result::complete (size_t bytes_transferred,
int success,
@@ -228,6 +269,7 @@ ACE_WIN32_Asynch_Read_Stream_Result::complete (size_t bytes_transferred,
this->success_ = success;
this->completion_key_ = completion_key;
this->error_ = error;
+
// Appropriately move the pointers in the message block.
if (!this->scatter_enabled ())
this->message_block_.wr_ptr (bytes_transferred);
@@ -238,90 +280,111 @@ ACE_WIN32_Asynch_Read_Stream_Result::complete (size_t bytes_transferred,
mb = mb->cont ())
{
size_t len_part = mb->space ();
+
if (len_part > bytes_transferred)
len_part = bytes_transferred;
+
mb->wr_ptr (len_part);
+
bytes_transferred -= len_part;
}
}
+
// Create the interface result class.
ACE_Asynch_Read_Stream::Result result (this);
+
// Call the application handler.
ACE_Handler *handler = this->handler_proxy_.get ()->handler ();
if (handler != 0)
handler->handle_read_stream (result);
}
+
ACE_WIN32_Asynch_Read_Stream_Result::~ACE_WIN32_Asynch_Read_Stream_Result (void)
{
}
+
// Base class operations. These operations are here to kill dominance
// warnings. These methods call the base class methods.
+
size_t
ACE_WIN32_Asynch_Read_Stream_Result::bytes_transferred (void) const
{
return ACE_WIN32_Asynch_Result::bytes_transferred ();
}
+
const void *
ACE_WIN32_Asynch_Read_Stream_Result::act (void) const
{
return ACE_WIN32_Asynch_Result::act ();
}
+
int
ACE_WIN32_Asynch_Read_Stream_Result::success (void) const
{
return ACE_WIN32_Asynch_Result::success ();
}
+
const void *
ACE_WIN32_Asynch_Read_Stream_Result::completion_key (void) const
{
return ACE_WIN32_Asynch_Result::completion_key ();
}
+
u_long
ACE_WIN32_Asynch_Read_Stream_Result::error (void) const
{
return ACE_WIN32_Asynch_Result::error ();
}
+
ACE_HANDLE
ACE_WIN32_Asynch_Read_Stream_Result::event (void) const
{
return ACE_WIN32_Asynch_Result::event ();
}
+
u_long
ACE_WIN32_Asynch_Read_Stream_Result::offset (void) const
{
return ACE_WIN32_Asynch_Result::offset ();
}
+
u_long
ACE_WIN32_Asynch_Read_Stream_Result::offset_high (void) const
{
return ACE_WIN32_Asynch_Result::offset_high ();
}
+
int
ACE_WIN32_Asynch_Read_Stream_Result::priority (void) const
{
return ACE_WIN32_Asynch_Result::priority ();
}
+
int
ACE_WIN32_Asynch_Read_Stream_Result::signal_number (void) const
{
return ACE_WIN32_Asynch_Result::signal_number ();
}
+
int
ACE_WIN32_Asynch_Read_Stream_Result::post_completion (ACE_Proactor_Impl *proactor)
{
return ACE_WIN32_Asynch_Result::post_completion (proactor);
}
+
int
ACE_WIN32_Asynch_Read_Stream_Result::scatter_enabled (void) const
{
return this->scatter_enabled_;
}
+
ACE_WIN32_Asynch_Read_Stream::ACE_WIN32_Asynch_Read_Stream (ACE_WIN32_Proactor *win32_proactor)
: ACE_Asynch_Operation_Impl (),
ACE_Asynch_Read_Stream_Impl (),
ACE_WIN32_Asynch_Operation (win32_proactor)
{
}
+
int
ACE_WIN32_Asynch_Read_Stream::read (ACE_Message_Block &message_block,
size_t bytes_to_read,
@@ -332,11 +395,13 @@ ACE_WIN32_Asynch_Read_Stream::read (ACE_Message_Block &message_block,
size_t space = message_block.space ();
if (bytes_to_read > space)
bytes_to_read = space;
+
if (bytes_to_read == 0)
{
errno = ENOSPC;
return -1;
}
+
// Create the Asynch_Result.
ACE_WIN32_Asynch_Read_Stream_Result *result = 0;
ACE_NEW_RETURN (result,
@@ -349,13 +414,17 @@ ACE_WIN32_Asynch_Read_Stream::read (ACE_Message_Block &message_block,
priority,
signal_number),
-1);
+
// Shared read
int const return_val = this->shared_read (result);
+
// Upon errors
if (return_val == -1)
delete result;
+
return return_val;
}
+
int
ACE_WIN32_Asynch_Read_Stream::readv (ACE_Message_Block &message_block,
size_t bytes_to_read,
@@ -366,24 +435,30 @@ ACE_WIN32_Asynch_Read_Stream::readv (ACE_Message_Block &message_block,
#if (defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0))
iovec iov[ACE_IOV_MAX];
int iovcnt = 0;
+
// We should not read more than user requested,
// but it is allowed to read less
+
for (const ACE_Message_Block* msg = &message_block;
msg != 0 && bytes_to_read > 0 && iovcnt < ACE_IOV_MAX;
msg = msg->cont () , ++iovcnt )
{
size_t msg_space = msg->space ();
+
// OS should correctly process zero length buffers
// if ( msg_space == 0 )
// ACE_ERROR_RETURN ((LM_ERROR,
// ACE_TEXT ("ACE_WIN32_Asynch_Read_Stream::readv:")
// ACE_TEXT ("No space in the message block\n")),
// -1);
+
if (msg_space > bytes_to_read)
msg_space = bytes_to_read;
bytes_to_read -= msg_space;
+
// Make as many iovec as needed to fit all of msg_space.
size_t wr_ptr_offset = 0;
+
while (msg_space > 0 && iovcnt < ACE_IOV_MAX)
{
u_long this_chunk_length;
@@ -396,6 +471,7 @@ ACE_WIN32_Asynch_Read_Stream::readv (ACE_Message_Block &message_block,
iov[iovcnt].iov_len = this_chunk_length;
msg_space -= this_chunk_length;
wr_ptr_offset += this_chunk_length;
+
// Increment iovec counter if there's more to do.
if (msg_space > 0)
++iovcnt;
@@ -406,15 +482,19 @@ ACE_WIN32_Asynch_Read_Stream::readv (ACE_Message_Block &message_block,
return -1;
}
}
+
// Re-calculate number bytes to read
bytes_to_read = 0;
+
for (int i = 0; i < iovcnt ; ++i)
bytes_to_read += iov[i].iov_len;
+
if (bytes_to_read == 0)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("ACE_WIN32_Asynch_Read_Stream::readv:")
ACE_TEXT ("Attempt to read 0 bytes\n")),
-1);
+
// Create the Asynch_Result.
ACE_WIN32_Asynch_Read_Stream_Result *result = 0;
ACE_NEW_RETURN (result,
@@ -428,10 +508,14 @@ ACE_WIN32_Asynch_Read_Stream::readv (ACE_Message_Block &message_block,
signal_number,
1), // scatter read enabled
-1);
+
// do the scatter recv
+
result->set_error (0); // Clear error before starting IO.
+
DWORD bytes_recvd = 0;
u_long flags = 0;
+
int initiate_result = ::WSARecv (reinterpret_cast<SOCKET> (result->handle ()),
reinterpret_cast<WSABUF *> (iov),
iovcnt,
@@ -439,10 +523,13 @@ ACE_WIN32_Asynch_Read_Stream::readv (ACE_Message_Block &message_block,
&flags,
result,
0);
+
if (0 == initiate_result)
// Immediate success: the OVERLAPPED will still get queued.
return 1;
+
ACE_ASSERT (initiate_result == SOCKET_ERROR);
+
// If initiate failed, check for a bad error.
ACE_OS::set_errno_to_last_error ();
switch (errno)
@@ -452,19 +539,23 @@ ACE_WIN32_Asynch_Read_Stream::readv (ACE_Message_Block &message_block,
// get queued.
initiate_result = 0;
break;
+
default:
// Something else went wrong: the OVERLAPPED will not get
// queued.
+
if (ACE::debug ())
{
ACE_DEBUG ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("WSARecv")));
}
+
delete result;
initiate_result = -1;
break;
}
+
return initiate_result;
#else
ACE_UNUSED_ARG (message_block);
@@ -475,9 +566,11 @@ ACE_WIN32_Asynch_Read_Stream::readv (ACE_Message_Block &message_block,
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_WINSOCK2 && ACE_HAS_WINSOCK2 != 0 */
}
+
ACE_WIN32_Asynch_Read_Stream::~ACE_WIN32_Asynch_Read_Stream (void)
{
}
+
int
ACE_WIN32_Asynch_Read_Stream::shared_read (ACE_WIN32_Asynch_Read_Stream_Result *result)
{
@@ -489,7 +582,9 @@ ACE_WIN32_Asynch_Read_Stream::shared_read (ACE_WIN32_Asynch_Read_Stream_Result *
}
DWORD bytes_to_read = static_cast<DWORD> (result->bytes_to_read ());
u_long bytes_read;
+
result->set_error (0); // Clear error before starting IO.
+
// Initiate the read
int initiate_result = ::ReadFile (result->handle (),
result->message_block ().wr_ptr (),
@@ -499,6 +594,7 @@ ACE_WIN32_Asynch_Read_Stream::shared_read (ACE_WIN32_Asynch_Read_Stream_Result *
if (initiate_result == 1)
// Immediate success: the OVERLAPPED will still get queued.
return 0;
+
// If initiate failed, check for a bad error.
ACE_OS::set_errno_to_last_error ();
switch (errno)
@@ -509,21 +605,26 @@ ACE_WIN32_Asynch_Read_Stream::shared_read (ACE_WIN32_Asynch_Read_Stream_Result *
// The IO will complete proactively: the OVERLAPPED will still
// get queued.
return 0;
+
default:
// Something else went wrong: the OVERLAPPED will not get
// queued.
+
if (ACE::debug ())
{
ACE_DEBUG ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ReadFile")));
}
+
return -1;
}
}
+
// Methods belong to ACE_WIN32_Asynch_Operation base class. These
// methods are defined here to avoid VC++ warnings. They route the
// call to the ACE_WIN32_Asynch_Operation base class.
+
int
ACE_WIN32_Asynch_Read_Stream::open (const ACE_Handler::Proxy_Ptr &handler_proxy,
ACE_HANDLE handle,
@@ -535,31 +636,37 @@ ACE_WIN32_Asynch_Read_Stream::open (const ACE_Handler::Proxy_Ptr &handler_proxy,
completion_key,
proactor);
}
+
int
ACE_WIN32_Asynch_Read_Stream::cancel (void)
{
return ACE_WIN32_Asynch_Operation::cancel ();
}
+
ACE_Proactor *
ACE_WIN32_Asynch_Read_Stream::proactor (void) const
{
return ACE_WIN32_Asynch_Operation::proactor ();
}
+
size_t
ACE_WIN32_Asynch_Write_Stream_Result::bytes_to_write (void) const
{
return this->bytes_to_write_;
}
+
ACE_Message_Block &
ACE_WIN32_Asynch_Write_Stream_Result::message_block (void) const
{
return this->message_block_;
}
+
ACE_HANDLE
ACE_WIN32_Asynch_Write_Stream_Result::handle (void) const
{
return this->handle_;
}
+
ACE_WIN32_Asynch_Write_Stream_Result::ACE_WIN32_Asynch_Write_Stream_Result (
const ACE_Handler::Proxy_Ptr &handler_proxy,
ACE_HANDLE handle,
@@ -580,6 +687,7 @@ ACE_WIN32_Asynch_Write_Stream_Result::ACE_WIN32_Asynch_Write_Stream_Result (
gather_enabled_ (gather_enabled)
{
}
+
void
ACE_WIN32_Asynch_Write_Stream_Result::complete (size_t bytes_transferred,
int success,
@@ -591,6 +699,7 @@ ACE_WIN32_Asynch_Write_Stream_Result::complete (size_t bytes_transferred,
this->success_ = success;
this->completion_key_ = completion_key;
this->error_ = error;
+
// Appropriately move the pointers in the message block.
if (!this->gather_enabled ())
this->message_block_.rd_ptr (bytes_transferred);
@@ -601,90 +710,111 @@ ACE_WIN32_Asynch_Write_Stream_Result::complete (size_t bytes_transferred,
mb = mb->cont ())
{
size_t len_part = mb->length ();
+
if ( len_part > bytes_transferred)
len_part = bytes_transferred;
+
mb->rd_ptr (len_part);
+
bytes_transferred -= len_part;
}
}
+
// Create the interface result class.
ACE_Asynch_Write_Stream::Result result (this);
+
// Call the application handler.
ACE_Handler *handler = this->handler_proxy_.get ()->handler ();
if (handler != 0)
handler->handle_write_stream (result);
}
+
ACE_WIN32_Asynch_Write_Stream_Result::~ACE_WIN32_Asynch_Write_Stream_Result (void)
{
}
+
// Base class operations. These operations are here to kill dominance
// warnings. These methods call the base class methods.
+
size_t
ACE_WIN32_Asynch_Write_Stream_Result::bytes_transferred (void) const
{
return ACE_WIN32_Asynch_Result::bytes_transferred ();
}
+
const void *
ACE_WIN32_Asynch_Write_Stream_Result::act (void) const
{
return ACE_WIN32_Asynch_Result::act ();
}
+
int
ACE_WIN32_Asynch_Write_Stream_Result::success (void) const
{
return ACE_WIN32_Asynch_Result::success ();
}
+
const void *
ACE_WIN32_Asynch_Write_Stream_Result::completion_key (void) const
{
return ACE_WIN32_Asynch_Result::completion_key ();
}
+
u_long
ACE_WIN32_Asynch_Write_Stream_Result::error (void) const
{
return ACE_WIN32_Asynch_Result::error ();
}
+
ACE_HANDLE
ACE_WIN32_Asynch_Write_Stream_Result::event (void) const
{
return ACE_WIN32_Asynch_Result::event ();
}
+
u_long
ACE_WIN32_Asynch_Write_Stream_Result::offset (void) const
{
return ACE_WIN32_Asynch_Result::offset ();
}
+
u_long
ACE_WIN32_Asynch_Write_Stream_Result::offset_high (void) const
{
return ACE_WIN32_Asynch_Result::offset_high ();
}
+
int
ACE_WIN32_Asynch_Write_Stream_Result::priority (void) const
{
return ACE_WIN32_Asynch_Result::priority ();
}
+
int
ACE_WIN32_Asynch_Write_Stream_Result::signal_number (void) const
{
return ACE_WIN32_Asynch_Result::signal_number ();
}
+
int
ACE_WIN32_Asynch_Write_Stream_Result::post_completion (ACE_Proactor_Impl *proactor)
{
return ACE_WIN32_Asynch_Result::post_completion (proactor);
}
+
int
ACE_WIN32_Asynch_Write_Stream_Result::gather_enabled (void) const
{
return this->gather_enabled_;
}
+
ACE_WIN32_Asynch_Write_Stream::ACE_WIN32_Asynch_Write_Stream (ACE_WIN32_Proactor *win32_proactor)
: ACE_Asynch_Operation_Impl (),
ACE_Asynch_Write_Stream_Impl (),
ACE_WIN32_Asynch_Operation (win32_proactor)
{
}
+
int
ACE_WIN32_Asynch_Write_Stream::write (ACE_Message_Block &message_block,
size_t bytes_to_write,
@@ -693,14 +823,17 @@ ACE_WIN32_Asynch_Write_Stream::write (ACE_Message_Block &message_block,
int signal_number)
{
size_t len = message_block.length();
+
if (bytes_to_write > len)
bytes_to_write = len ;
+
if (bytes_to_write == 0)
ACE_ERROR_RETURN
((LM_ERROR,
ACE_TEXT ("ACE_WIN32_Asynch_Write_Stream::write:")
ACE_TEXT ("Attempt to write 0 bytes\n")),
-1);
+
ACE_WIN32_Asynch_Write_Stream_Result *result = 0;
ACE_NEW_RETURN (result,
ACE_WIN32_Asynch_Write_Stream_Result (this->handler_proxy_,
@@ -712,13 +845,17 @@ ACE_WIN32_Asynch_Write_Stream::write (ACE_Message_Block &message_block,
priority,
signal_number),
-1);
+
// Shared write
int return_val = this->shared_write (result);
+
// Upon errors
if (return_val == -1)
delete result;
+
return return_val;
}
+
int
ACE_WIN32_Asynch_Write_Stream::writev (ACE_Message_Block &message_block,
size_t bytes_to_write,
@@ -729,21 +866,26 @@ ACE_WIN32_Asynch_Write_Stream::writev (ACE_Message_Block &message_block,
#if (defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0))
iovec iov[ACE_IOV_MAX];
int iovcnt = 0;
+
// We should not write more than user requested,
// but it is allowed to write less
+
for (const ACE_Message_Block* msg = &message_block;
msg != 0 && bytes_to_write > 0 && iovcnt < ACE_IOV_MAX;
msg = msg->cont ())
{
size_t msg_len = msg->length ();
+
// Skip 0-length blocks.
if (msg_len == 0)
continue;
if (msg_len > bytes_to_write)
msg_len = bytes_to_write;
bytes_to_write -= msg_len;
+
// Make as many iovec as needed to fit all of msg_len.
size_t rd_ptr_offset = 0;
+
while (msg_len > 0 && iovcnt < ACE_IOV_MAX)
{
u_long this_chunk_length;
@@ -756,6 +898,7 @@ ACE_WIN32_Asynch_Write_Stream::writev (ACE_Message_Block &message_block,
iov[iovcnt].iov_len = this_chunk_length;
msg_len -= this_chunk_length;
rd_ptr_offset += this_chunk_length;
+
// Increment iovec counter if there's more to do.
if (msg_len > 0)
iovcnt++;
@@ -767,16 +910,20 @@ ACE_WIN32_Asynch_Write_Stream::writev (ACE_Message_Block &message_block,
}
++iovcnt;
}
+
// Re-calculate number bytes to write
bytes_to_write = 0;
+
for ( int i=0; i < iovcnt ; ++i )
bytes_to_write += iov[i].iov_len;
+
if ( bytes_to_write == 0 )
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("ACE_WIN32_Asynch_Write_Stream::writev:")
ACE_TEXT ("Attempt to write 0 bytes\n")),
-1);
+
ACE_WIN32_Asynch_Write_Stream_Result *result = 0;
ACE_NEW_RETURN (result,
ACE_WIN32_Asynch_Write_Stream_Result (this->handler_proxy_,
@@ -789,8 +936,11 @@ ACE_WIN32_Asynch_Write_Stream::writev (ACE_Message_Block &message_block,
signal_number,
1), // gather write enabled
-1);
+
// do the gather send
+
u_long bytes_sent = 0;
+
int initiate_result = ::WSASend (reinterpret_cast<SOCKET> (result->handle ()),
reinterpret_cast<WSABUF *> (iov),
iovcnt,
@@ -798,10 +948,13 @@ ACE_WIN32_Asynch_Write_Stream::writev (ACE_Message_Block &message_block,
0, // flags
result,
0);
+
if (0 == initiate_result)
// Immediate success: the OVERLAPPED will still get queued.
return 1;
+
ACE_ASSERT (initiate_result == SOCKET_ERROR);
+
// If initiate failed, check for a bad error.
ACE_OS::set_errno_to_last_error ();
switch (errno)
@@ -811,19 +964,23 @@ ACE_WIN32_Asynch_Write_Stream::writev (ACE_Message_Block &message_block,
// get queued.
initiate_result = 0;
break;
+
default:
// Something else went wrong: the OVERLAPPED will not get
// queued.
+
if (ACE::debug ())
{
ACE_DEBUG ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("WSASend")));
}
+
delete result;
initiate_result = -1;
break;
}
+
return initiate_result;
#else
ACE_UNUSED_ARG (message_block);
@@ -834,9 +991,11 @@ ACE_WIN32_Asynch_Write_Stream::writev (ACE_Message_Block &message_block,
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_WINSOCK2 && ACE_HAS_WINSOCK2 != 0 */
}
+
ACE_WIN32_Asynch_Write_Stream::~ACE_WIN32_Asynch_Write_Stream (void)
{
}
+
int
ACE_WIN32_Asynch_Write_Stream::shared_write (ACE_WIN32_Asynch_Write_Stream_Result *result)
{
@@ -847,7 +1006,9 @@ ACE_WIN32_Asynch_Write_Stream::shared_write (ACE_WIN32_Asynch_Write_Stream_Resul
return -1;
}
DWORD bytes_to_write = static_cast<DWORD> (result->bytes_to_write ());
+
result->set_error (0); // Clear error before starting IO.
+
// Initiate the write; Winsock 2 is required for the higher-performing
// WSASend() function. For Winsock 1, fall back to the slower WriteFile().
int initiate_result = 0;
@@ -875,6 +1036,7 @@ ACE_WIN32_Asynch_Write_Stream::shared_write (ACE_WIN32_Asynch_Write_Stream_Resul
// Immediate success: the OVERLAPPED will still get queued.
return 0;
#endif /* ACE_HAS_WINSOCK2 */
+
// If initiate failed, check for a bad error.
ACE_OS::set_errno_to_last_error ();
switch (errno)
@@ -883,9 +1045,11 @@ ACE_WIN32_Asynch_Write_Stream::shared_write (ACE_WIN32_Asynch_Write_Stream_Resul
// The IO will complete proactively: the OVERLAPPED will still
// get queued.
return 0;
+
default:
// Something else went wrong: the OVERLAPPED will not get
// queued.
+
if (ACE::debug ())
ACE_DEBUG ((LM_ERROR,
ACE_TEXT ("%p\n"),
@@ -893,9 +1057,11 @@ ACE_WIN32_Asynch_Write_Stream::shared_write (ACE_WIN32_Asynch_Write_Stream_Resul
return -1;
}
}
+
// Methods belong to ACE_WIN32_Asynch_Operation base class. These
// methods are defined here to avoid VC++ warnings. They route the
// call to the ACE_WIN32_Asynch_Operation base class.
+
int
ACE_WIN32_Asynch_Write_Stream::open (const ACE_Handler::Proxy_Ptr &handler_proxy,
ACE_HANDLE handle,
@@ -907,16 +1073,19 @@ ACE_WIN32_Asynch_Write_Stream::open (const ACE_Handler::Proxy_Ptr &handler_proxy
completion_key,
proactor);
}
+
int
ACE_WIN32_Asynch_Write_Stream::cancel (void)
{
return ACE_WIN32_Asynch_Operation::cancel ();
}
+
ACE_Proactor *
ACE_WIN32_Asynch_Write_Stream::proactor (void) const
{
return ACE_WIN32_Asynch_Operation::proactor ();
}
+
ACE_WIN32_Asynch_Read_File_Result::ACE_WIN32_Asynch_Read_File_Result (
const ACE_Handler::Proxy_Ptr &handler_proxy,
ACE_HANDLE handle,
@@ -945,6 +1114,7 @@ ACE_WIN32_Asynch_Read_File_Result::ACE_WIN32_Asynch_Read_File_Result (
this->Offset = offset;
this->OffsetHigh = offset_high;
}
+
void
ACE_WIN32_Asynch_Read_File_Result::complete (size_t bytes_transferred,
int success,
@@ -956,12 +1126,14 @@ ACE_WIN32_Asynch_Read_File_Result::complete (size_t bytes_transferred,
this->success_ = success;
this->completion_key_ = completion_key;
this->error_ = error;
+
// Appropriately move the pointers in the message block.
if (!this->scatter_enabled ())
this->message_block_.wr_ptr (bytes_transferred);
else
{
static const size_t page_size = ACE_OS::getpagesize();
+
for (ACE_Message_Block* mb = &this->message_block_;
(mb != 0) && (bytes_transferred > 0);
mb = mb->cont ())
@@ -969,100 +1141,125 @@ ACE_WIN32_Asynch_Read_File_Result::complete (size_t bytes_transferred,
// mb->space () is ought to be >= page_size.
// this is verified in the readv method
// ACE_ASSERT (mb->space () >= page_size);
+
size_t len_part = page_size ;
+
if ( len_part > bytes_transferred)
len_part = bytes_transferred;
+
mb->wr_ptr (len_part);
+
bytes_transferred -= len_part;
}
}
+
// Create the interface result class.
ACE_Asynch_Read_File::Result result (this);
+
// Call the application handler.
ACE_Handler *handler = this->handler_proxy_.get ()->handler ();
if (handler != 0)
handler->handle_read_file (result);
}
+
ACE_WIN32_Asynch_Read_File_Result::~ACE_WIN32_Asynch_Read_File_Result (void)
{
}
+
// Base class operations. These operations are here to kill dominance
// warnings. These methods call the base class methods.
+
size_t
ACE_WIN32_Asynch_Read_File_Result::bytes_transferred (void) const
{
return ACE_WIN32_Asynch_Result::bytes_transferred ();
}
+
const void *
ACE_WIN32_Asynch_Read_File_Result::act (void) const
{
return ACE_WIN32_Asynch_Result::act ();
}
+
int
ACE_WIN32_Asynch_Read_File_Result::success (void) const
{
return ACE_WIN32_Asynch_Result::success ();
}
+
const void *
ACE_WIN32_Asynch_Read_File_Result::completion_key (void) const
{
return ACE_WIN32_Asynch_Result::completion_key ();
}
+
u_long
ACE_WIN32_Asynch_Read_File_Result::error (void) const
{
return ACE_WIN32_Asynch_Result::error ();
}
+
ACE_HANDLE
ACE_WIN32_Asynch_Read_File_Result::event (void) const
{
return ACE_WIN32_Asynch_Result::event ();
}
+
u_long
ACE_WIN32_Asynch_Read_File_Result::offset (void) const
{
return ACE_WIN32_Asynch_Result::offset ();
}
+
u_long
ACE_WIN32_Asynch_Read_File_Result::offset_high (void) const
{
return ACE_WIN32_Asynch_Result::offset_high ();
}
+
int
ACE_WIN32_Asynch_Read_File_Result::priority (void) const
{
return ACE_WIN32_Asynch_Result::priority ();
}
+
int
ACE_WIN32_Asynch_Read_File_Result::signal_number (void) const
{
return ACE_WIN32_Asynch_Result::signal_number ();
}
+
// The following methods belong to
// ACE_WIN32_Asynch_Read_Stream_Result. They are here to avoid VC++
// warnings. These methods route their call to the
// ACE_WIN32_Asynch_Read_Stream_Result base class.
+
size_t
ACE_WIN32_Asynch_Read_File_Result::bytes_to_read (void) const
{
return ACE_WIN32_Asynch_Read_Stream_Result::bytes_to_read ();
}
+
ACE_Message_Block &
ACE_WIN32_Asynch_Read_File_Result::message_block (void) const
{
return ACE_WIN32_Asynch_Read_Stream_Result::message_block ();
}
+
ACE_HANDLE
ACE_WIN32_Asynch_Read_File_Result::handle (void) const
{
return ACE_WIN32_Asynch_Read_Stream_Result::handle ();
}
+
int
ACE_WIN32_Asynch_Read_File_Result::post_completion (ACE_Proactor_Impl *proactor)
{
return ACE_WIN32_Asynch_Result::post_completion (proactor);
}
+
// ************************************************************
+
ACE_WIN32_Asynch_Read_File::ACE_WIN32_Asynch_Read_File (ACE_WIN32_Proactor *win32_proactor)
: ACE_Asynch_Operation_Impl (),
ACE_Asynch_Read_Stream_Impl (),
@@ -1070,6 +1267,7 @@ ACE_WIN32_Asynch_Read_File::ACE_WIN32_Asynch_Read_File (ACE_WIN32_Proactor *win3
ACE_WIN32_Asynch_Read_Stream (win32_proactor)
{
}
+
int
ACE_WIN32_Asynch_Read_File::read (ACE_Message_Block &message_block,
size_t bytes_to_read,
@@ -1082,6 +1280,7 @@ ACE_WIN32_Asynch_Read_File::read (ACE_Message_Block &message_block,
size_t space = message_block.space ();
if ( bytes_to_read > space )
bytes_to_read = space;
+
if ( bytes_to_read == 0 )
ACE_ERROR_RETURN
((LM_ERROR,
@@ -1089,6 +1288,7 @@ ACE_WIN32_Asynch_Read_File::read (ACE_Message_Block &message_block,
ACE_TEXT ("Attempt to read 0 bytes or no space in the message block\n")),
-1);
+
ACE_WIN32_Asynch_Read_File_Result *result = 0;
ACE_NEW_RETURN (result,
ACE_WIN32_Asynch_Read_File_Result (this->handler_proxy_,
@@ -1102,13 +1302,17 @@ ACE_WIN32_Asynch_Read_File::read (ACE_Message_Block &message_block,
priority,
signal_number),
-1);
+
// Shared read
int return_val = this->shared_read (result);
+
// Upon errors
if (return_val == -1)
delete result;
+
return return_val;
}
+
int
ACE_WIN32_Asynch_Read_File::readv (ACE_Message_Block &message_block,
size_t bytes_to_read,
@@ -1120,29 +1324,38 @@ ACE_WIN32_Asynch_Read_File::readv (ACE_Message_Block &message_block,
{
#if defined (ACE_HAS_WIN32_OVERLAPPED_IO)
static const size_t page_size = ACE_OS::getpagesize();
+
FILE_SEGMENT_ELEMENT buffer_pointers[ACE_IOV_MAX + 1];
int buffer_pointers_count = 0;
+
// Each buffer must be at least the size of a system memory page
// and must be aligned on a system memory page size boundary
+
// We should not read more than user requested,
// but it is allowed to read less
+
size_t total_space = 0;
+
for (const ACE_Message_Block* msg = &message_block;
msg != 0 && buffer_pointers_count < ACE_IOV_MAX && total_space < bytes_to_read;
msg = msg->cont(), ++buffer_pointers_count )
{
size_t msg_space = msg->space ();
+
if (msg_space < page_size)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("ACE_WIN32_Asynch_Read_File::readv:")
ACE_TEXT ("Invalid message block size\n")),
-1);
+
buffer_pointers[buffer_pointers_count].Buffer = msg->wr_ptr ();
total_space += page_size;
}
+
// not read more than buffers space
if (bytes_to_read > total_space)
bytes_to_read = total_space;
+
// ReadFileScatter API limits us to DWORD range.
if (bytes_to_read > MAXDWORD)
{
@@ -1150,8 +1363,10 @@ ACE_WIN32_Asynch_Read_File::readv (ACE_Message_Block &message_block,
return -1;
}
DWORD dword_bytes_to_read = static_cast<DWORD> (bytes_to_read);
+
// last one should be completely 0
buffer_pointers[buffer_pointers_count].Buffer = 0;
+
ACE_WIN32_Asynch_Read_File_Result *result = 0;
ACE_NEW_RETURN (result,
ACE_WIN32_Asynch_Read_File_Result (this->handler_proxy_,
@@ -1166,16 +1381,20 @@ ACE_WIN32_Asynch_Read_File::readv (ACE_Message_Block &message_block,
signal_number,
1), // scatter read enabled
-1);
+
// do the scatter read
result->set_error (0); // Clear error before starting IO.
+
int initiate_result = ::ReadFileScatter (result->handle (),
buffer_pointers,
dword_bytes_to_read,
0, // reserved, must be NULL
result);
+
if (0 != initiate_result)
// Immediate success: the OVERLAPPED will still get queued.
return 1;
+
// If initiate failed, check for a bad error.
ACE_OS::set_errno_to_last_error ();
switch (errno)
@@ -1185,28 +1404,34 @@ ACE_WIN32_Asynch_Read_File::readv (ACE_Message_Block &message_block,
// get queued.
initiate_result = 0;
break;
+
default:
// Something else went wrong: the OVERLAPPED will not get
// queued.
+
if (ACE::debug ())
{
ACE_DEBUG ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ReadFileScatter")));
}
+
delete result;
initiate_result = -1;
break;
}
+
return initiate_result;
#else
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_WIN32_OVERLAPPED_IO */
}
+
ACE_WIN32_Asynch_Read_File::~ACE_WIN32_Asynch_Read_File (void)
{
}
+
int
ACE_WIN32_Asynch_Read_File::read (ACE_Message_Block &message_block,
size_t bytes_to_read,
@@ -1220,6 +1445,7 @@ ACE_WIN32_Asynch_Read_File::read (ACE_Message_Block &message_block,
priority,
signal_number);
}
+
int
ACE_WIN32_Asynch_Read_File::readv (ACE_Message_Block &message_block,
size_t bytes_to_read,
@@ -1233,9 +1459,11 @@ ACE_WIN32_Asynch_Read_File::readv (ACE_Message_Block &message_block,
priority,
signal_number);
}
+
// Methods belong to ACE_WIN32_Asynch_Operation base class. These
// methods are defined here to avoid VC++ warnings. They route the
// call to the ACE_WIN32_Asynch_Operation base class.
+
int
ACE_WIN32_Asynch_Read_File::open (const ACE_Handler::Proxy_Ptr &handler_proxy,
ACE_HANDLE handle,
@@ -1247,16 +1475,19 @@ ACE_WIN32_Asynch_Read_File::open (const ACE_Handler::Proxy_Ptr &handler_proxy,
completion_key,
proactor);
}
+
int
ACE_WIN32_Asynch_Read_File::cancel (void)
{
return ACE_WIN32_Asynch_Operation::cancel ();
}
+
ACE_Proactor *
ACE_WIN32_Asynch_Read_File::proactor (void) const
{
return ACE_WIN32_Asynch_Operation::proactor ();
}
+
ACE_WIN32_Asynch_Write_File_Result::ACE_WIN32_Asynch_Write_File_Result (
const ACE_Handler::Proxy_Ptr &handler_proxy,
ACE_HANDLE handle,
@@ -1285,6 +1516,7 @@ ACE_WIN32_Asynch_Write_File_Result::ACE_WIN32_Asynch_Write_File_Result (
this->Offset = offset;
this->OffsetHigh = offset_high;
}
+
void
ACE_WIN32_Asynch_Write_File_Result::complete (size_t bytes_transferred,
int success,
@@ -1296,12 +1528,14 @@ ACE_WIN32_Asynch_Write_File_Result::complete (size_t bytes_transferred,
this->success_ = success;
this->completion_key_ = completion_key;
this->error_ = error;
+
// Appropriately move the pointers in the message block.
if (!this->gather_enabled ())
this->message_block_.rd_ptr (bytes_transferred);
else
{
static const size_t page_size = ACE_OS::getpagesize();
+
for (ACE_Message_Block* mb = &this->message_block_;
(mb != 0) && (bytes_transferred > 0);
mb = mb->cont ())
@@ -1309,99 +1543,124 @@ ACE_WIN32_Asynch_Write_File_Result::complete (size_t bytes_transferred,
// mb->length () is ought to be >= page_size.
// this is verified in the writev method
// ACE_ASSERT (mb->length () >= page_size);
+
size_t len_part = page_size;
+
if ( len_part > bytes_transferred)
len_part = bytes_transferred;
+
mb->rd_ptr (len_part);
+
bytes_transferred -= len_part;
}
+
}
+
// Create the interface result class.
ACE_Asynch_Write_File::Result result (this);
+
// Call the application handler.
ACE_Handler *handler = this->handler_proxy_.get ()->handler ();
if (handler != 0)
handler->handle_write_file (result);
}
+
ACE_WIN32_Asynch_Write_File_Result::~ACE_WIN32_Asynch_Write_File_Result (void)
{
}
+
// Base class operations. These operations are here to kill dominance
// warnings. These methods call the base class methods.
+
size_t
ACE_WIN32_Asynch_Write_File_Result::bytes_transferred (void) const
{
return ACE_WIN32_Asynch_Result::bytes_transferred ();
}
+
const void *
ACE_WIN32_Asynch_Write_File_Result::act (void) const
{
return ACE_WIN32_Asynch_Result::act ();
}
+
int
ACE_WIN32_Asynch_Write_File_Result::success (void) const
{
return ACE_WIN32_Asynch_Result::success ();
}
+
const void *
ACE_WIN32_Asynch_Write_File_Result::completion_key (void) const
{
return ACE_WIN32_Asynch_Result::completion_key ();
}
+
u_long
ACE_WIN32_Asynch_Write_File_Result::error (void) const
{
return ACE_WIN32_Asynch_Result::error ();
}
+
ACE_HANDLE
ACE_WIN32_Asynch_Write_File_Result::event (void) const
{
return ACE_WIN32_Asynch_Result::event ();
}
+
u_long
ACE_WIN32_Asynch_Write_File_Result::offset (void) const
{
return ACE_WIN32_Asynch_Result::offset ();
}
+
u_long
ACE_WIN32_Asynch_Write_File_Result::offset_high (void) const
{
return ACE_WIN32_Asynch_Result::offset_high ();
}
+
int
ACE_WIN32_Asynch_Write_File_Result::priority (void) const
{
return ACE_WIN32_Asynch_Result::priority ();
}
+
int
ACE_WIN32_Asynch_Write_File_Result::signal_number (void) const
{
return ACE_WIN32_Asynch_Result::signal_number ();
}
+
// The following methods belong to
// ACE_WIN32_Asynch_Write_Stream_Result. They are here to avoid VC++
// warnings. These methods route their call to the
// ACE_WIN32_Asynch_Write_Stream_Result base class.
+
size_t
ACE_WIN32_Asynch_Write_File_Result::bytes_to_write (void) const
{
return ACE_WIN32_Asynch_Write_Stream_Result::bytes_to_write ();
}
+
ACE_Message_Block &
ACE_WIN32_Asynch_Write_File_Result::message_block (void) const
{
return ACE_WIN32_Asynch_Write_Stream_Result::message_block ();
}
+
ACE_HANDLE
ACE_WIN32_Asynch_Write_File_Result::handle (void) const
{
return ACE_WIN32_Asynch_Write_Stream_Result::handle ();
}
+
int
ACE_WIN32_Asynch_Write_File_Result::post_completion (ACE_Proactor_Impl *proactor)
{
return ACE_WIN32_Asynch_Result::post_completion (proactor);
}
+
ACE_WIN32_Asynch_Write_File::ACE_WIN32_Asynch_Write_File (ACE_WIN32_Proactor *win32_proactor)
: ACE_Asynch_Operation_Impl (),
ACE_Asynch_Write_Stream_Impl (),
@@ -1409,6 +1668,7 @@ ACE_WIN32_Asynch_Write_File::ACE_WIN32_Asynch_Write_File (ACE_WIN32_Proactor *wi
ACE_WIN32_Asynch_Write_Stream (win32_proactor)
{
}
+
int
ACE_WIN32_Asynch_Write_File::write (ACE_Message_Block &message_block,
size_t bytes_to_write,
@@ -1421,12 +1681,14 @@ ACE_WIN32_Asynch_Write_File::write (ACE_Message_Block &message_block,
size_t len = message_block.length ();
if ( bytes_to_write > len )
bytes_to_write = len;
+
if ( bytes_to_write == 0 )
ACE_ERROR_RETURN
((LM_ERROR,
ACE_TEXT ("ACE_WIN32_Asynch_Write_File::write:")
ACE_TEXT ("Attempt to read 0 bytes\n")),
-1);
+
ACE_WIN32_Asynch_Write_File_Result *result = 0;
ACE_NEW_RETURN (result,
ACE_WIN32_Asynch_Write_File_Result (this->handler_proxy_,
@@ -1440,13 +1702,17 @@ ACE_WIN32_Asynch_Write_File::write (ACE_Message_Block &message_block,
priority,
signal_number),
-1);
+
// Shared write
int return_val = this->shared_write (result);
+
// Upon errors
if (return_val == -1)
delete result;
+
return return_val;
}
+
int
ACE_WIN32_Asynch_Write_File::writev (ACE_Message_Block &message_block,
size_t bytes_to_write,
@@ -1458,18 +1724,24 @@ ACE_WIN32_Asynch_Write_File::writev (ACE_Message_Block &message_block,
{
#if defined (ACE_HAS_WIN32_OVERLAPPED_IO)
static const size_t page_size = ACE_OS::getpagesize();
+
FILE_SEGMENT_ELEMENT buffer_pointers[ACE_IOV_MAX + 1];
int buffer_pointers_count = 0;
+
// Each buffer must be at least the size of a system memory page
// and must be aligned on a system memory page size boundary
+
// We should not read more than user requested,
// but it is allowed to read less
+
size_t total_len = 0;
+
for (const ACE_Message_Block* msg = &message_block;
msg != 0 && buffer_pointers_count < ACE_IOV_MAX && total_len < bytes_to_write;
msg = msg->cont (), ++buffer_pointers_count )
{
size_t msg_len = msg->length ();
+
// Don't allow writing less than page_size, unless
// the size of the message block is big enough (so we don't write from
// memory which does not belong to the message block), and the message
@@ -1481,9 +1753,11 @@ ACE_WIN32_Asynch_Write_File::writev (ACE_Message_Block &message_block,
ACE_TEXT ("ACE_WIN32_Asynch_Write_File::writev:")
ACE_TEXT ("Invalid message block length\n")),
-1);
+
buffer_pointers[buffer_pointers_count].Buffer = msg->rd_ptr ();
total_len += page_size;
}
+
// not write more than we have in buffers
if (bytes_to_write > total_len)
bytes_to_write = total_len;
@@ -1494,8 +1768,10 @@ ACE_WIN32_Asynch_Write_File::writev (ACE_Message_Block &message_block,
return -1;
}
DWORD dword_bytes_to_write = static_cast<DWORD> (bytes_to_write);
+
// last one should be completely 0
buffer_pointers[buffer_pointers_count].Buffer = 0;
+
ACE_WIN32_Asynch_Write_File_Result *result = 0;
ACE_NEW_RETURN (result,
ACE_WIN32_Asynch_Write_File_Result (this->handler_proxy_,
@@ -1510,16 +1786,20 @@ ACE_WIN32_Asynch_Write_File::writev (ACE_Message_Block &message_block,
signal_number,
1), // gather write enabled
-1);
+
result->set_error(0);
+
// do the gather write
int initiate_result = ::WriteFileGather (result->handle (),
buffer_pointers,
dword_bytes_to_write,
0, // reserved, must be NULL
result);
+
if (0 != initiate_result)
// Immediate success: the OVERLAPPED will still get queued.
return 1;
+
// If initiate failed, check for a bad error.
ACE_OS::set_errno_to_last_error ();
switch (errno)
@@ -1529,28 +1809,36 @@ ACE_WIN32_Asynch_Write_File::writev (ACE_Message_Block &message_block,
// get queued.
initiate_result = 0;
break;
+
default:
// Something else went wrong: the OVERLAPPED will not get
// queued.
+
if (ACE::debug ())
{
ACE_DEBUG ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("WriteFileGather")));
}
+
delete result;
initiate_result = -1;
break;
}
+
return initiate_result;
#else
+
ACE_NOTSUP_RETURN (-1);
+
#endif /* ACE_HAS_WIN32_OVERLAPPED_IO */
}
+
ACE_WIN32_Asynch_Write_File::~ACE_WIN32_Asynch_Write_File (void)
{
}
+
int
ACE_WIN32_Asynch_Write_File::write (ACE_Message_Block &message_block,
size_t bytes_to_write,
@@ -1564,6 +1852,7 @@ ACE_WIN32_Asynch_Write_File::write (ACE_Message_Block &message_block,
priority,
signal_number);
}
+
int
ACE_WIN32_Asynch_Write_File::writev (ACE_Message_Block &message_block,
size_t bytes_to_write,
@@ -1577,9 +1866,11 @@ ACE_WIN32_Asynch_Write_File::writev (ACE_Message_Block &message_block,
priority,
signal_number);
}
+
// Methods belong to ACE_WIN32_Asynch_Operation base class. These
// methods are defined here to avoid VC++ warnings. They route the
// call to the ACE_WIN32_Asynch_Operation base class.
+
int
ACE_WIN32_Asynch_Write_File::open (const ACE_Handler::Proxy_Ptr &handler_proxy,
ACE_HANDLE handle,
@@ -1591,36 +1882,43 @@ ACE_WIN32_Asynch_Write_File::open (const ACE_Handler::Proxy_Ptr &handler_proxy,
completion_key,
proactor);
}
+
int
ACE_WIN32_Asynch_Write_File::cancel (void)
{
return ACE_WIN32_Asynch_Operation::cancel ();
}
+
ACE_Proactor *
ACE_WIN32_Asynch_Write_File::proactor (void) const
{
return ACE_WIN32_Asynch_Operation::proactor ();
}
+
size_t
ACE_WIN32_Asynch_Accept_Result::bytes_to_read (void) const
{
return this->bytes_to_read_;
}
+
ACE_Message_Block &
ACE_WIN32_Asynch_Accept_Result::message_block (void) const
{
return this->message_block_;
}
+
ACE_HANDLE
ACE_WIN32_Asynch_Accept_Result::listen_handle (void) const
{
return this->listen_handle_;
}
+
ACE_HANDLE
ACE_WIN32_Asynch_Accept_Result::accept_handle (void) const
{
return this->accept_handle_;
}
+
ACE_WIN32_Asynch_Accept_Result::ACE_WIN32_Asynch_Accept_Result (
const ACE_Handler::Proxy_Ptr &handler_proxy,
ACE_HANDLE listen_handle,
@@ -1646,6 +1944,7 @@ ACE_WIN32_Asynch_Accept_Result::ACE_WIN32_Asynch_Accept_Result (
accept_handle_ (accept_handle)
{
}
+
void
ACE_WIN32_Asynch_Accept_Result::complete (size_t bytes_transferred,
int success,
@@ -1657,86 +1956,105 @@ ACE_WIN32_Asynch_Accept_Result::complete (size_t bytes_transferred,
this->success_ = success;
this->completion_key_ = completion_key;
this->error_ = error;
+
// Appropriately move the pointers in the message block.
this->message_block_.wr_ptr (bytes_transferred);
+
if (!success && this->accept_handle_ != ACE_INVALID_HANDLE)
{
ACE_OS::closesocket (this->accept_handle_);
this->accept_handle_ = ACE_INVALID_HANDLE;
}
+
// Create the interface result class.
ACE_Asynch_Accept::Result result (this);
+
// Call the application handler.
ACE_Handler *handler = this->handler_proxy_.get ()->handler ();
if (handler != 0)
handler->handle_accept (result);
}
+
ACE_WIN32_Asynch_Accept_Result::~ACE_WIN32_Asynch_Accept_Result (void)
{
}
+
// Base class operations. These operations are here to kill dominance
// warnings. These methods call the base class methods.
+
size_t
ACE_WIN32_Asynch_Accept_Result::bytes_transferred (void) const
{
return ACE_WIN32_Asynch_Result::bytes_transferred ();
}
+
const void *
ACE_WIN32_Asynch_Accept_Result::act (void) const
{
return ACE_WIN32_Asynch_Result::act ();
}
+
int
ACE_WIN32_Asynch_Accept_Result::success (void) const
{
return ACE_WIN32_Asynch_Result::success ();
}
+
const void *
ACE_WIN32_Asynch_Accept_Result::completion_key (void) const
{
return ACE_WIN32_Asynch_Result::completion_key ();
}
+
u_long
ACE_WIN32_Asynch_Accept_Result::error (void) const
{
return ACE_WIN32_Asynch_Result::error ();
}
+
ACE_HANDLE
ACE_WIN32_Asynch_Accept_Result::event (void) const
{
return ACE_WIN32_Asynch_Result::event ();
}
+
u_long
ACE_WIN32_Asynch_Accept_Result::offset (void) const
{
return ACE_WIN32_Asynch_Result::offset ();
}
+
u_long
ACE_WIN32_Asynch_Accept_Result::offset_high (void) const
{
return ACE_WIN32_Asynch_Result::offset_high ();
}
+
int
ACE_WIN32_Asynch_Accept_Result::priority (void) const
{
return ACE_WIN32_Asynch_Result::priority ();
}
+
int
ACE_WIN32_Asynch_Accept_Result::signal_number (void) const
{
return ACE_WIN32_Asynch_Result::signal_number ();
}
+
int
ACE_WIN32_Asynch_Accept_Result::post_completion (ACE_Proactor_Impl *proactor)
{
return ACE_WIN32_Asynch_Result::post_completion (proactor);
}
+
ACE_WIN32_Asynch_Accept::ACE_WIN32_Asynch_Accept (ACE_WIN32_Proactor *win32_proactor)
: ACE_Asynch_Operation_Impl (),
ACE_Asynch_Accept_Impl (),
ACE_WIN32_Asynch_Operation (win32_proactor)
{
}
+
int
ACE_WIN32_Asynch_Accept::accept (ACE_Message_Block &message_block,
size_t bytes_to_read,
@@ -1760,7 +2078,9 @@ ACE_WIN32_Asynch_Accept::accept (ACE_Message_Block &message_block,
size_t space_needed = bytes_to_read + 2 * address_size;
if (available_space < space_needed)
ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Buffer too small\n")), -1);
+
// WIN Specific.
+
// AcceptEx API limits us to DWORD range.
if (bytes_to_read > MAXDWORD)
{
@@ -1768,6 +2088,7 @@ ACE_WIN32_Asynch_Accept::accept (ACE_Message_Block &message_block,
return -1;
}
DWORD dword_bytes_to_read = static_cast<DWORD> (bytes_to_read);
+
int close_accept_handle = 0;
// If the <accept_handle> is invalid, we will create a new socket.
if (accept_handle == ACE_INVALID_HANDLE)
@@ -1789,6 +2110,7 @@ ACE_WIN32_Asynch_Accept::accept (ACE_Message_Block &message_block,
// Remember to close the socket down if failures occur.
close_accept_handle = 1;
}
+
// Common code for both WIN and POSIX.
ACE_WIN32_Asynch_Accept_Result *result = 0;
ACE_NEW_RETURN (result,
@@ -1802,7 +2124,9 @@ ACE_WIN32_Asynch_Accept::accept (ACE_Message_Block &message_block,
priority,
signal_number),
-1);
+
u_long bytes_read;
+
// Initiate the accept.
int initiate_result = ::AcceptEx ((SOCKET) result->listen_handle (),
(SOCKET) result->accept_handle (),
@@ -1815,6 +2139,7 @@ ACE_WIN32_Asynch_Accept::accept (ACE_Message_Block &message_block,
if (initiate_result == 1)
// Immediate success: the OVERLAPPED will still get queued.
return 1;
+
// If initiate failed, check for a bad error.
ACE_OS::set_errno_to_last_error ();
switch (errno)
@@ -1823,14 +2148,18 @@ ACE_WIN32_Asynch_Accept::accept (ACE_Message_Block &message_block,
// The IO will complete proactively: the OVERLAPPED will still
// get queued.
return 0;
+
default:
// Something else went wrong: the OVERLAPPED will not get
// queued.
+
if (close_accept_handle == 1)
// Close the newly created socket
ACE_OS::closesocket (accept_handle);
+
// Cleanup dynamically allocated Asynch_Result.
delete result;
+
if (ACE::debug ())
{
ACE_DEBUG ((LM_ERROR,
@@ -1850,12 +2179,15 @@ ACE_WIN32_Asynch_Accept::accept (ACE_Message_Block &message_block,
ACE_NOTSUP_RETURN (-1);
#endif /* defined (ACE_HAS_WIN32_OVERLAPPED_IO) || (defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)) */
}
+
ACE_WIN32_Asynch_Accept::~ACE_WIN32_Asynch_Accept (void)
{
}
+
// Methods belong to ACE_WIN32_Asynch_Operation base class. These
// methods are defined here to avoid VC++ warnings. They route the
// call to the ACE_WIN32_Asynch_Operation base class.
+
int
ACE_WIN32_Asynch_Accept::open (const ACE_Handler::Proxy_Ptr &handler_proxy,
ACE_HANDLE handle,
@@ -1867,27 +2199,33 @@ ACE_WIN32_Asynch_Accept::open (const ACE_Handler::Proxy_Ptr &handler_proxy,
completion_key,
proactor);
}
+
int
ACE_WIN32_Asynch_Accept::cancel (void)
{
return ACE_WIN32_Asynch_Operation::cancel ();
}
+
ACE_Proactor *
ACE_WIN32_Asynch_Accept::proactor (void) const
{
return ACE_WIN32_Asynch_Operation::proactor ();
}
+
// *********************************************************************
+
ACE_HANDLE
ACE_WIN32_Asynch_Connect_Result::connect_handle (void) const
{
return this->connect_handle_;
}
+
void ACE_WIN32_Asynch_Connect_Result::connect_handle ( ACE_HANDLE handle )
{
this->connect_handle_ = handle;
}
+
ACE_WIN32_Asynch_Connect_Result::ACE_WIN32_Asynch_Connect_Result
(const ACE_Handler::Proxy_Ptr &handler_proxy,
ACE_HANDLE connect_handle,
@@ -1903,6 +2241,7 @@ ACE_WIN32_Asynch_Connect_Result::ACE_WIN32_Asynch_Connect_Result
{
;
}
+
void
ACE_WIN32_Asynch_Connect_Result::complete (size_t bytes_transferred,
int success,
@@ -1914,74 +2253,91 @@ ACE_WIN32_Asynch_Connect_Result::complete (size_t bytes_transferred,
this->success_ = success;
this->completion_key_ = completion_key;
this->error_ = error;
+
// Create the interface result class.
ACE_Asynch_Connect::Result result (this);
+
// Call the application handler.
ACE_Handler *handler = this->handler_proxy_.get ()->handler ();
if (handler != 0)
handler->handle_connect (result);
}
+
ACE_WIN32_Asynch_Connect_Result::~ACE_WIN32_Asynch_Connect_Result (void)
{
}
+
// Base class operations. These operations are here to kill dominance
// warnings. These methods call the base class methods.
+
size_t
ACE_WIN32_Asynch_Connect_Result::bytes_transferred (void) const
{
return ACE_WIN32_Asynch_Result::bytes_transferred ();
}
+
const void *
ACE_WIN32_Asynch_Connect_Result::act (void) const
{
return ACE_WIN32_Asynch_Result::act ();
}
+
int
ACE_WIN32_Asynch_Connect_Result::success (void) const
{
return ACE_WIN32_Asynch_Result::success ();
}
+
const void *
ACE_WIN32_Asynch_Connect_Result::completion_key (void) const
{
return ACE_WIN32_Asynch_Result::completion_key ();
}
+
u_long
ACE_WIN32_Asynch_Connect_Result::error (void) const
{
return ACE_WIN32_Asynch_Result::error ();
}
+
ACE_HANDLE
ACE_WIN32_Asynch_Connect_Result::event (void) const
{
return ACE_WIN32_Asynch_Result::event ();
}
+
u_long
ACE_WIN32_Asynch_Connect_Result::offset (void) const
{
return ACE_WIN32_Asynch_Result::offset ();
}
+
u_long
ACE_WIN32_Asynch_Connect_Result::offset_high (void) const
{
return ACE_WIN32_Asynch_Result::offset_high ();
}
+
int
ACE_WIN32_Asynch_Connect_Result::priority (void) const
{
return ACE_WIN32_Asynch_Result::priority ();
}
+
int
ACE_WIN32_Asynch_Connect_Result::signal_number (void) const
{
return ACE_WIN32_Asynch_Result::signal_number ();
}
+
int
ACE_WIN32_Asynch_Connect_Result::post_completion (ACE_Proactor_Impl *proactor)
{
return ACE_WIN32_Asynch_Result::post_completion (proactor);
}
+
// *********************************************************************
+
ACE_WIN32_Asynch_Connect::ACE_WIN32_Asynch_Connect (ACE_WIN32_Proactor * win32_proactor)
: ACE_Asynch_Operation_Impl (),
ACE_Asynch_Connect_Impl (),
@@ -1989,27 +2345,33 @@ ACE_WIN32_Asynch_Connect::ACE_WIN32_Asynch_Connect (ACE_WIN32_Proactor * win32_p
flg_open_ (false)
{
}
+
ACE_WIN32_Asynch_Connect::~ACE_WIN32_Asynch_Connect (void)
{
this->close ();
this->reactor (0); // to avoid purge_pending_notifications
}
+
ACE_Proactor *
ACE_WIN32_Asynch_Connect::proactor (void) const
{
return ACE_WIN32_Asynch_Operation::proactor ();
}
+
ACE_HANDLE
ACE_WIN32_Asynch_Connect::get_handle (void) const
{
+
ACE_ASSERT (0);
return ACE_INVALID_HANDLE;
}
+
void
ACE_WIN32_Asynch_Connect::set_handle (ACE_HANDLE)
{
ACE_ASSERT (0) ;
}
+
int
ACE_WIN32_Asynch_Connect::open (const ACE_Handler::Proxy_Ptr &handler_proxy,
ACE_HANDLE,
@@ -2017,6 +2379,7 @@ ACE_WIN32_Asynch_Connect::open (const ACE_Handler::Proxy_Ptr &handler_proxy,
ACE_Proactor *proactor)
{
ACE_TRACE ("ACE_WIN32_Asynch_Connect::open");
+
// if we are already opened,
// we could not create a new handler without closing the previous
if (this->flg_open_)
@@ -2024,17 +2387,22 @@ ACE_WIN32_Asynch_Connect::open (const ACE_Handler::Proxy_Ptr &handler_proxy,
ACE_TEXT ("%N:%l:ACE_WIN32_Asynch_Connect::open:")
ACE_TEXT ("connector already open \n")),
-1);
+
//int result =
ACE_WIN32_Asynch_Operation::open (handler_proxy,
ACE_INVALID_HANDLE,
completion_key,
proactor);
+
// Ignore result as we pass ACE_INVALID_HANDLE
//if (result == -1)
// return result;
+
this->flg_open_ = true;
+
return 0;
}
+
int
ACE_WIN32_Asynch_Connect::connect (ACE_HANDLE connect_handle,
const ACE_Addr & remote_sap,
@@ -2045,11 +2413,13 @@ ACE_WIN32_Asynch_Connect::connect (ACE_HANDLE connect_handle,
int signal_number)
{
ACE_TRACE ("ACE_WIN32_Asynch_Connect::connect");
+
if (!this->flg_open_)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("%N:%l:ACE_WIN32_Asynch_Connect::connect")
ACE_TEXT ("connector was not opened before\n")),
-1);
+
// Common code for both WIN and WIN32.
// Create future Asynch_Connect_Result
ACE_WIN32_Asynch_Connect_Result *result = 0;
@@ -2061,17 +2431,22 @@ ACE_WIN32_Asynch_Connect::connect (ACE_HANDLE connect_handle,
priority,
signal_number),
-1);
+
int rc = connect_i (result,
remote_sap,
local_sap,
reuse_addr);
+
// update handle
connect_handle = result->connect_handle ();
+
if (rc != 0)
return post_result (result, true);
+
// Enqueue result we will wait for completion
{
ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1));
+
if (this->result_map_.bind (connect_handle, result) == -1)
{
ACE_ERROR ((LM_ERROR,
@@ -2081,8 +2456,10 @@ ACE_WIN32_Asynch_Connect::connect (ACE_HANDLE connect_handle,
return post_result (result, true);
}
}
+
ACE_Asynch_Pseudo_Task & task =
this->win32_proactor_->get_asynch_pseudo_task ();
+
if (-1 == task.register_io_handler (connect_handle,
this,
ACE_Event_Handler::CONNECT_MASK,
@@ -2099,8 +2476,10 @@ ACE_WIN32_Asynch_Connect::connect (ACE_HANDLE connect_handle,
this->post_result (result, true);
}
}
+
return 0;
}
+
int ACE_WIN32_Asynch_Connect::post_result (ACE_WIN32_Asynch_Connect_Result * result,
bool post_enable)
{
@@ -2112,6 +2491,7 @@ int ACE_WIN32_Asynch_Connect::post_result (ACE_WIN32_Asynch_Connect_Result * res
// or fail of the call.
if (this->win32_proactor_ ->post_completion (result) == 0)
return 0;
+
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("Error:(%P | %t):%p\n"),
ACE_TEXT ("ACE_WIN32_Asynch_Connect::post_result: ")
@@ -2122,15 +2502,19 @@ int ACE_WIN32_Asynch_Connect::post_result (ACE_WIN32_Asynch_Connect_Result * res
// There was no call to post_completion() so manually delete result.
delete result;
}
+
if (handle != ACE_INVALID_HANDLE)
ACE_OS::closesocket (handle);
+
return -1;
}
+
// connect_i
// return code :
// -1 errors before attempt to connect
// 0 connect started
// 1 connect finished ( may be unsuccessfully)
+
int
ACE_WIN32_Asynch_Connect::connect_i (ACE_WIN32_Asynch_Connect_Result *result,
const ACE_Addr & remote_sap,
@@ -2138,6 +2522,7 @@ ACE_WIN32_Asynch_Connect::connect_i (ACE_WIN32_Asynch_Connect_Result *result,
int reuse_addr)
{
result->set_bytes_transferred (0);
+
ACE_HANDLE handle = result->connect_handle ();
if (handle == ACE_INVALID_HANDLE)
{
@@ -2145,6 +2530,7 @@ ACE_WIN32_Asynch_Connect::connect_i (ACE_WIN32_Asynch_Connect_Result *result,
handle = ACE_OS::socket (protocol_family,
SOCK_STREAM,
0);
+
// save it
result->connect_handle (handle);
if (handle == ACE_INVALID_HANDLE)
@@ -2156,6 +2542,7 @@ ACE_WIN32_Asynch_Connect::connect_i (ACE_WIN32_Asynch_Connect_Result *result,
ACE_TEXT ("socket")),
-1);
}
+
// Reuse the address
int one = 1;
if (protocol_family != PF_UNIX &&
@@ -2174,6 +2561,7 @@ ACE_WIN32_Asynch_Connect::connect_i (ACE_WIN32_Asynch_Connect_Result *result,
-1);
}
}
+
if (local_sap != ACE_Addr::sap_any)
{
sockaddr * laddr = reinterpret_cast<sockaddr *> (local_sap.get_addr ());
@@ -2188,6 +2576,7 @@ ACE_WIN32_Asynch_Connect::connect_i (ACE_WIN32_Asynch_Connect_Result *result,
-1);
}
}
+
// set non blocking mode
if (ACE::set_flags (handle, ACE_NONBLOCK) != 0)
{
@@ -2198,24 +2587,29 @@ ACE_WIN32_Asynch_Connect::connect_i (ACE_WIN32_Asynch_Connect_Result *result,
ACE_TEXT ("set_flags")),
-1);
}
+
for (;;)
{
int rc = ACE_OS::connect
(handle,
reinterpret_cast<sockaddr *> (remote_sap.get_addr ()),
remote_sap.get_size ());
+
if (rc < 0) // failure
{
if (errno == EWOULDBLOCK || errno == EINPROGRESS)
return 0; // connect started
+
if (errno == EINTR)
continue;
+
result->set_error (errno);
}
return 1 ; // connect finished
}
}
+
// cancel_uncompleted
// It performs cancellation of all pending requests
//
@@ -2227,57 +2621,76 @@ ACE_WIN32_Asynch_Connect::connect_i (ACE_WIN32_Asynch_Connect_Result *result,
//
// Return value : number of cancelled requests
//
+
int
ACE_WIN32_Asynch_Connect::cancel_uncompleted (bool flg_notify,
ACE_Handle_Set &set)
{
ACE_TRACE ("ACE_WIN32_Asynch_Connect::cancel_uncompleted");
+
int retval = 0;
+
MAP_MANAGER::ITERATOR iter (result_map_);
MAP_MANAGER::ENTRY * me = 0;
+
set.reset ();
+
for (; iter.next (me) != 0; retval++, iter.advance ())
{
ACE_HANDLE handle = me->ext_id_;
ACE_WIN32_Asynch_Connect_Result* result = me->int_id_ ;
+
set.set_bit (handle);
+
result->set_bytes_transferred (0);
result->set_error (ERROR_OPERATION_ABORTED);
this->post_result (result, flg_notify);
}
+
result_map_.unbind_all ();
+
return retval;
}
+
int
ACE_WIN32_Asynch_Connect::cancel (void)
{
ACE_TRACE ("ACE_WIN32_Asynch_Connect::cancel");
+
int rc = -1 ; // ERRORS
+
ACE_Handle_Set set;
int num_cancelled = 0;
{
ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1));
+
num_cancelled = cancel_uncompleted (flg_open_, set);
}
if (num_cancelled == 0)
rc = 1; // AIO_ALLDONE
else if (num_cancelled > 0)
rc = 0; // AIO_CANCELED
+
if (!this->flg_open_)
return rc;
+
ACE_Asynch_Pseudo_Task & task =
this->win32_proactor_->get_asynch_pseudo_task ();
+
task.remove_io_handler (set);
return rc;
}
+
int
ACE_WIN32_Asynch_Connect::close (void)
{
ACE_TRACE ("ACE_WIN32_Asynch_Connect::close");
+
ACE_Handle_Set set;
int num_cancelled = 0;
{
ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1));
+
num_cancelled = cancel_uncompleted (flg_open_, set);
}
if (num_cancelled == 0 || this->flg_open_ == 0)
@@ -2285,101 +2698,126 @@ ACE_WIN32_Asynch_Connect::close (void)
this->flg_open_ = false;
return 0;
}
+
ACE_Asynch_Pseudo_Task & task =
this->win32_proactor_->get_asynch_pseudo_task ();
+
task.remove_io_handler (set);
return 0;
}
+
int
ACE_WIN32_Asynch_Connect::handle_exception (ACE_HANDLE fd)
{
ACE_TRACE ("ACE_WIN32_Asynch_Connect::handle_exception");
return handle_output (fd);
}
+
int
ACE_WIN32_Asynch_Connect::handle_input (ACE_HANDLE fd)
{
ACE_TRACE ("ACE_WIN32_Asynch_Connect::handle_input");
return handle_output (fd);
}
+
int
ACE_WIN32_Asynch_Connect::handle_output (ACE_HANDLE fd)
{
ACE_TRACE ("ACE_WIN32_Asynch_Connect::handle_output");
+
ACE_WIN32_Asynch_Connect_Result* result = 0;
+
{
ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, 0));
if (this->result_map_.unbind (fd, result) != 0) // not found
return -1;
}
+
int sockerror = 0 ;
int lsockerror = sizeof sockerror;
+
ACE_OS::getsockopt (fd,
SOL_SOCKET,
SO_ERROR,
(char*) & sockerror,
& lsockerror);
+
// This previously just did a "return -1" and let handle_close() clean
// things up. However, this entire object may be gone as a result of
// the application's completion handler, so don't count on 'this' being
// legitimate on return from post_result().
// remove_io_handler() contains flag DONT_CALL
this->win32_proactor_->get_asynch_pseudo_task().remove_io_handler (fd);
+
result->set_bytes_transferred (0);
result->set_error (sockerror);
this->post_result (result, this->flg_open_);
return 0;
}
+
int
ACE_WIN32_Asynch_Connect::handle_close (ACE_HANDLE fd, ACE_Reactor_Mask)
{
ACE_TRACE ("ACE_WIN32_Asynch_Connect::handle_close");
+
ACE_Asynch_Pseudo_Task & task =
this->win32_proactor_->get_asynch_pseudo_task ();
task.remove_io_handler (fd);
+
ACE_WIN32_Asynch_Connect_Result* result = 0;
+
{
ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, 0));
if (this->result_map_.unbind (fd, result) != 0) // not found
return -1;
}
+
result->set_bytes_transferred (0);
result->set_error (ERROR_OPERATION_ABORTED);
this->post_result (result, this->flg_open_);
+
return 0;
}
+
// *********************************************************************
+
ACE_HANDLE
ACE_WIN32_Asynch_Transmit_File_Result::socket (void) const
{
return this->socket_;
}
+
ACE_HANDLE
ACE_WIN32_Asynch_Transmit_File_Result::file (void) const
{
return this->file_;
}
+
ACE_Asynch_Transmit_File::Header_And_Trailer *
ACE_WIN32_Asynch_Transmit_File_Result::header_and_trailer (void) const
{
return this->header_and_trailer_;
}
+
size_t
ACE_WIN32_Asynch_Transmit_File_Result::bytes_to_write (void) const
{
return this->bytes_to_write_;
}
+
size_t
ACE_WIN32_Asynch_Transmit_File_Result::bytes_per_send (void) const
{
return this->bytes_per_send_;
}
+
u_long
ACE_WIN32_Asynch_Transmit_File_Result::flags (void) const
{
return this->flags_;
}
+
ACE_WIN32_Asynch_Transmit_File_Result::ACE_WIN32_Asynch_Transmit_File_Result (
const ACE_Handler::Proxy_Ptr &handler_proxy,
ACE_HANDLE socket,
@@ -2411,6 +2849,7 @@ ACE_WIN32_Asynch_Transmit_File_Result::ACE_WIN32_Asynch_Transmit_File_Result (
flags_ (flags)
{
}
+
void
ACE_WIN32_Asynch_Transmit_File_Result::complete (size_t bytes_transferred,
int success,
@@ -2422,6 +2861,7 @@ ACE_WIN32_Asynch_Transmit_File_Result::complete (size_t bytes_transferred,
this->success_ = success;
this->completion_key_ = completion_key;
this->error_ = error;
+
// We will not do this because (a) the header and trailer blocks may
// be the same message_blocks and (b) in cases of failures we have
// no idea how much of what (header, data, trailer) was sent.
@@ -2431,84 +2871,102 @@ ACE_WIN32_Asynch_Transmit_File_Result::complete (size_t bytes_transferred,
ACE_Message_Block *header = this->header_and_trailer_->header ();
if (header != 0)
header->rd_ptr (this->header_and_trailer_->header_bytes ());
+
ACE_Message_Block *trailer = this->header_and_trailer_->trailer ();
if (trailer != 0)
trailer->rd_ptr (this->header_and_trailer_->trailer_bytes ());
}
*/
+
// Create the interface result class.
ACE_Asynch_Transmit_File::Result result (this);
+
// Call the application handler.
ACE_Handler *handler = this->handler_proxy_.get ()->handler ();
if (handler != 0)
handler->handle_transmit_file (result);
}
+
ACE_WIN32_Asynch_Transmit_File_Result::~ACE_WIN32_Asynch_Transmit_File_Result (void)
{
}
+
// Base class operations. These operations are here to kill dominance
// warnings. These methods call the base class methods.
+
size_t
ACE_WIN32_Asynch_Transmit_File_Result::bytes_transferred (void) const
{
return ACE_WIN32_Asynch_Result::bytes_transferred ();
}
+
const void *
ACE_WIN32_Asynch_Transmit_File_Result::act (void) const
{
return ACE_WIN32_Asynch_Result::act ();
}
+
int
ACE_WIN32_Asynch_Transmit_File_Result::success (void) const
{
return ACE_WIN32_Asynch_Result::success ();
}
+
const void *
ACE_WIN32_Asynch_Transmit_File_Result::completion_key (void) const
{
return ACE_WIN32_Asynch_Result::completion_key ();
}
+
u_long
ACE_WIN32_Asynch_Transmit_File_Result::error (void) const
{
return ACE_WIN32_Asynch_Result::error ();
}
+
ACE_HANDLE
ACE_WIN32_Asynch_Transmit_File_Result::event (void) const
{
return ACE_WIN32_Asynch_Result::event ();
}
+
u_long
ACE_WIN32_Asynch_Transmit_File_Result::offset (void) const
{
return ACE_WIN32_Asynch_Result::offset ();
}
+
u_long
ACE_WIN32_Asynch_Transmit_File_Result::offset_high (void) const
{
return ACE_WIN32_Asynch_Result::offset_high ();
}
+
int
ACE_WIN32_Asynch_Transmit_File_Result::priority (void) const
{
return ACE_WIN32_Asynch_Result::priority ();
}
+
int
ACE_WIN32_Asynch_Transmit_File_Result::signal_number (void) const
{
return ACE_WIN32_Asynch_Result::signal_number ();
}
+
int
ACE_WIN32_Asynch_Transmit_File_Result::post_completion (ACE_Proactor_Impl *proactor)
{
return ACE_WIN32_Asynch_Result::post_completion (proactor);
}
+
ACE_WIN32_Asynch_Transmit_File::ACE_WIN32_Asynch_Transmit_File (ACE_WIN32_Proactor *win32_proactor)
: ACE_Asynch_Operation_Impl (),
ACE_Asynch_Transmit_File_Impl (),
ACE_WIN32_Asynch_Operation (win32_proactor)
{
}
+
int
ACE_WIN32_Asynch_Transmit_File::transmit_file (ACE_HANDLE file,
ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer,
@@ -2522,6 +2980,7 @@ ACE_WIN32_Asynch_Transmit_File::transmit_file (ACE_HANDLE file,
int signal_number)
{
#if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || (defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0))
+
// TransmitFile API limits us to DWORD range.
if (bytes_to_write > MAXDWORD || bytes_per_send > MAXDWORD)
{
@@ -2530,6 +2989,7 @@ ACE_WIN32_Asynch_Transmit_File::transmit_file (ACE_HANDLE file,
}
DWORD dword_bytes_to_write = static_cast<DWORD> (bytes_to_write);
DWORD dword_bytes_per_send = static_cast<DWORD> (bytes_per_send);
+
ACE_WIN32_Asynch_Transmit_File_Result *result = 0;
ACE_NEW_RETURN (result,
ACE_WIN32_Asynch_Transmit_File_Result (this->handler_proxy_,
@@ -2546,9 +3006,11 @@ ACE_WIN32_Asynch_Transmit_File::transmit_file (ACE_HANDLE file,
priority,
signal_number),
-1);
+
ACE_LPTRANSMIT_FILE_BUFFERS transmit_buffers = 0;
if (result->header_and_trailer () != 0)
transmit_buffers = result->header_and_trailer ()->transmit_buffers ();
+
// Initiate the transmit file
int initiate_result = ::TransmitFile ((SOCKET) result->socket (),
result->file (),
@@ -2560,6 +3022,7 @@ ACE_WIN32_Asynch_Transmit_File::transmit_file (ACE_HANDLE file,
if (initiate_result == 1)
// Immediate success: the OVERLAPPED will still get queued.
return 1;
+
// If initiate failed, check for a bad error.
ACE_OS::set_errno_to_last_error ();
switch (errno)
@@ -2568,11 +3031,14 @@ ACE_WIN32_Asynch_Transmit_File::transmit_file (ACE_HANDLE file,
// The IO will complete proactively: the OVERLAPPED will still
// get queued.
return 0;
+
default:
// Something else went wrong: the OVERLAPPED will not get
// queued.
+
// Cleanup dynamically allocated Asynch_Result
delete result;
+
if (ACE::debug ())
{
ACE_DEBUG ((LM_ERROR,
@@ -2595,12 +3061,15 @@ ACE_WIN32_Asynch_Transmit_File::transmit_file (ACE_HANDLE file,
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_WINSOCK2 */
}
+
ACE_WIN32_Asynch_Transmit_File::~ACE_WIN32_Asynch_Transmit_File (void)
{
}
+
// Methods belong to ACE_WIN32_Asynch_Operation base class. These
// methods are defined here to avoid VC++ warnings. They route the
// call to the ACE_WIN32_Asynch_Operation base class.
+
int
ACE_WIN32_Asynch_Transmit_File::open (const ACE_Handler::Proxy_Ptr &handler_proxy,
ACE_HANDLE handle,
@@ -2612,31 +3081,37 @@ ACE_WIN32_Asynch_Transmit_File::open (const ACE_Handler::Proxy_Ptr &handler_prox
completion_key,
proactor);
}
+
int
ACE_WIN32_Asynch_Transmit_File::cancel (void)
{
return ACE_WIN32_Asynch_Operation::cancel ();
}
+
ACE_Proactor *
ACE_WIN32_Asynch_Transmit_File::proactor (void) const
{
return ACE_WIN32_Asynch_Operation::proactor ();
}
+
size_t
ACE_WIN32_Asynch_Read_Dgram_Result::bytes_to_read (void) const
{
return this->bytes_to_read_;
}
+
ACE_Message_Block*
ACE_WIN32_Asynch_Read_Dgram_Result::message_block (void) const
{
return this->message_block_;
}
+
int
ACE_WIN32_Asynch_Read_Dgram_Result::remote_address (ACE_Addr& addr) const
{
int retVal = -1; // failure
+
// make sure the addresses are of the same type
if (addr.get_type () == this->remote_address_->get_type ())
{ // copy the remote_address_ into addr
@@ -2644,79 +3119,95 @@ ACE_WIN32_Asynch_Read_Dgram_Result::remote_address (ACE_Addr& addr) const
this->remote_address_->get_size ());
retVal = 0; // success
}
+
return retVal;
}
+
sockaddr *
ACE_WIN32_Asynch_Read_Dgram_Result::saddr () const
{
return (sockaddr *) this->remote_address_->get_addr ();
}
+
int
ACE_WIN32_Asynch_Read_Dgram_Result::flags (void) const
{
return this->flags_;
}
+
ACE_HANDLE
ACE_WIN32_Asynch_Read_Dgram_Result::handle (void) const
{
return this->handle_;
}
+
size_t
ACE_WIN32_Asynch_Read_Dgram_Result::bytes_transferred (void) const
{
return ACE_WIN32_Asynch_Result::bytes_transferred ();
}
+
const void *
ACE_WIN32_Asynch_Read_Dgram_Result::act (void) const
{
return ACE_WIN32_Asynch_Result::act ();
}
+
int
ACE_WIN32_Asynch_Read_Dgram_Result::success (void) const
{
return ACE_WIN32_Asynch_Result::success ();
}
+
const void *
ACE_WIN32_Asynch_Read_Dgram_Result::completion_key (void) const
{
return ACE_WIN32_Asynch_Result::completion_key ();
}
+
u_long
ACE_WIN32_Asynch_Read_Dgram_Result::error (void) const
{
return ACE_WIN32_Asynch_Result::error ();
}
+
ACE_HANDLE
ACE_WIN32_Asynch_Read_Dgram_Result::event (void) const
{
return ACE_WIN32_Asynch_Result::event ();
}
+
u_long
ACE_WIN32_Asynch_Read_Dgram_Result::offset (void) const
{
return ACE_WIN32_Asynch_Result::offset ();
}
+
u_long
ACE_WIN32_Asynch_Read_Dgram_Result::offset_high (void) const
{
return ACE_WIN32_Asynch_Result::offset_high ();
}
+
int
ACE_WIN32_Asynch_Read_Dgram_Result::priority (void) const
{
return ACE_WIN32_Asynch_Result::priority ();
}
+
int
ACE_WIN32_Asynch_Read_Dgram_Result::signal_number (void) const
{
return ACE_WIN32_Asynch_Result::signal_number ();
}
+
int
ACE_WIN32_Asynch_Read_Dgram_Result::post_completion (ACE_Proactor_Impl *proactor)
{
return ACE_WIN32_Asynch_Result::post_completion (proactor);
}
+
ACE_WIN32_Asynch_Read_Dgram_Result::ACE_WIN32_Asynch_Read_Dgram_Result (
const ACE_Handler::Proxy_Ptr &handler_proxy,
ACE_HANDLE handle,
@@ -2739,10 +3230,13 @@ ACE_WIN32_Asynch_Read_Dgram_Result::ACE_WIN32_Asynch_Read_Dgram_Result (
handle_ (handle)
{
ACE_ASSERT (protocol_family == PF_INET); // only supporting INET addresses
+
ACE_NEW (remote_address_, ACE_INET_Addr);
addr_len_ = remote_address_->get_size ();
+
ACE_UNUSED_ARG (protocol_family);
}
+
void
ACE_WIN32_Asynch_Read_Dgram_Result::complete (size_t bytes_transferred,
int success,
@@ -2754,34 +3248,45 @@ ACE_WIN32_Asynch_Read_Dgram_Result::complete (size_t bytes_transferred,
this->success_ = success;
this->completion_key_ = completion_key;
this->error_ = error;
+
// Appropriately move the pointers in the message block.
for (ACE_Message_Block* mb = this->message_block_;
(mb != 0) && (bytes_transferred > 0);
mb = mb->cont ())
{
size_t len_part = mb->space ();
+
if ( len_part > bytes_transferred)
len_part = bytes_transferred;
+
mb->wr_ptr (len_part);
+
bytes_transferred -= len_part;
}
+
// Adjust the address length
this->remote_address_->set_size (this->addr_len_);
+
// Create the interface result class.
ACE_Asynch_Read_Dgram::Result result (this);
+
// Call the application handler.
ACE_Handler *handler = this->handler_proxy_.get ()->handler ();
if (handler != 0)
handler->handle_read_dgram (result);
}
+
ACE_WIN32_Asynch_Read_Dgram_Result::~ACE_WIN32_Asynch_Read_Dgram_Result (void)
{
delete this->remote_address_;
}
+
//***************************************************************************
+
ACE_WIN32_Asynch_Read_Dgram::~ACE_WIN32_Asynch_Read_Dgram (void)
{
}
+
ssize_t
ACE_WIN32_Asynch_Read_Dgram::recv (ACE_Message_Block *message_block,
size_t & number_of_bytes_recvd,
@@ -2792,23 +3297,30 @@ ACE_WIN32_Asynch_Read_Dgram::recv (ACE_Message_Block *message_block,
int signal_number)
{
number_of_bytes_recvd = 0;
+
size_t bytes_to_read = 0;
+
iovec iov[ACE_IOV_MAX];
int iovcnt = 0;
+
for (const ACE_Message_Block* msg = message_block;
msg != 0 && iovcnt < ACE_IOV_MAX;
msg = msg->cont () , ++iovcnt )
{
size_t msg_space = msg->space ();
+
// OS should correctly process zero length buffers
// if ( msg_space == 0 )
// ACE_ERROR_RETURN ((LM_ERROR,
// ACE_TEXT ("ACE_WIN32_Asynch_Read_Dgram::recv:")
// ACE_TEXT ("No space in the message block\n")),
// -1);
+
bytes_to_read += msg_space;
+
// Make as many iovec as needed to fit all of msg_len.
size_t wr_ptr_offset = 0;
+
while (msg_space > 0 && iovcnt < ACE_IOV_MAX)
{
u_long this_chunk_length;
@@ -2821,6 +3333,7 @@ ACE_WIN32_Asynch_Read_Dgram::recv (ACE_Message_Block *message_block,
iov[iovcnt].iov_len = this_chunk_length;
msg_space -= this_chunk_length;
wr_ptr_offset += this_chunk_length;
+
// Increment iovec counter if there's more to do.
if (msg_space > 0)
iovcnt++;
@@ -2831,11 +3344,13 @@ ACE_WIN32_Asynch_Read_Dgram::recv (ACE_Message_Block *message_block,
return -1;
}
}
+
if (bytes_to_read == 0)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("ACE_WIN32_Asynch_Read_Dgram::recv:")
ACE_TEXT ("Attempt to read 0 bytes\n")),
-1);
+
// Create the Asynch_Result.
ACE_WIN32_Asynch_Read_Dgram_Result *result = 0;
ACE_NEW_RETURN (result,
@@ -2850,6 +3365,7 @@ ACE_WIN32_Asynch_Read_Dgram::recv (ACE_Message_Block *message_block,
priority,
signal_number),
-1);
+
// do the scatter/gather recv
ssize_t initiate_result = ACE_OS::recvfrom (result->handle (),
iov,
@@ -2871,19 +3387,23 @@ ACE_WIN32_Asynch_Read_Dgram::recv (ACE_Message_Block *message_block,
// get queued.
initiate_result = 0;
break;
+
default:
// Something else went wrong: the OVERLAPPED will not get
// queued.
+
if (ACE::debug ())
{
ACE_DEBUG ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("WSARecvFrom")));
}
+
delete result;
initiate_result = -1;
break;
}
+
}
else
{
@@ -2891,11 +3411,14 @@ ACE_WIN32_Asynch_Read_Dgram::recv (ACE_Message_Block *message_block,
// number_of_bytes_recvd contains the number of bytes recvd
// addr contains the peer address
// flags was updated
+
// number_of_bytes_recvd = bytes_recvd;
initiate_result = 1;
}
+
return initiate_result;
}
+
int
ACE_WIN32_Asynch_Read_Dgram::open (const ACE_Handler::Proxy_Ptr &handler_proxy,
ACE_HANDLE handle,
@@ -2907,98 +3430,118 @@ ACE_WIN32_Asynch_Read_Dgram::open (const ACE_Handler::Proxy_Ptr &handler_proxy,
completion_key,
proactor);
}
+
int
ACE_WIN32_Asynch_Read_Dgram::cancel (void)
{
return ACE_WIN32_Asynch_Operation::cancel ();
}
+
ACE_Proactor *
ACE_WIN32_Asynch_Read_Dgram::proactor (void) const
{
return ACE_WIN32_Asynch_Operation::proactor ();
}
+
ACE_WIN32_Asynch_Read_Dgram::ACE_WIN32_Asynch_Read_Dgram (ACE_WIN32_Proactor *win32_proactor)
: ACE_Asynch_Operation_Impl (),
ACE_Asynch_Read_Dgram_Impl (),
ACE_WIN32_Asynch_Operation (win32_proactor)
{
}
+
//***********************************************
+
size_t
ACE_WIN32_Asynch_Write_Dgram_Result::bytes_to_write (void) const
{
return this->bytes_to_write_;
}
+
ACE_Message_Block*
ACE_WIN32_Asynch_Write_Dgram_Result::message_block () const
{
return this->message_block_;
}
+
int
ACE_WIN32_Asynch_Write_Dgram_Result::flags (void) const
{
return this->flags_;
}
+
ACE_HANDLE
ACE_WIN32_Asynch_Write_Dgram_Result::handle (void) const
{
return this->handle_;
}
+
size_t
ACE_WIN32_Asynch_Write_Dgram_Result::bytes_transferred (void) const
{
return ACE_WIN32_Asynch_Result::bytes_transferred ();
}
+
const void *
ACE_WIN32_Asynch_Write_Dgram_Result::act (void) const
{
return ACE_WIN32_Asynch_Result::act ();
}
+
int
ACE_WIN32_Asynch_Write_Dgram_Result::success (void) const
{
return ACE_WIN32_Asynch_Result::success ();
}
+
const void *
ACE_WIN32_Asynch_Write_Dgram_Result::completion_key (void) const
{
return ACE_WIN32_Asynch_Result::completion_key ();
}
+
u_long
ACE_WIN32_Asynch_Write_Dgram_Result::error (void) const
{
return ACE_WIN32_Asynch_Result::error ();
}
+
ACE_HANDLE
ACE_WIN32_Asynch_Write_Dgram_Result::event (void) const
{
return ACE_WIN32_Asynch_Result::event ();
}
+
u_long
ACE_WIN32_Asynch_Write_Dgram_Result::offset (void) const
{
return ACE_WIN32_Asynch_Result::offset ();
}
+
u_long
ACE_WIN32_Asynch_Write_Dgram_Result::offset_high (void) const
{
return ACE_WIN32_Asynch_Result::offset_high ();
}
+
int
ACE_WIN32_Asynch_Write_Dgram_Result::priority (void) const
{
return ACE_WIN32_Asynch_Result::priority ();
}
+
int
ACE_WIN32_Asynch_Write_Dgram_Result::signal_number (void) const
{
return ACE_WIN32_Asynch_Result::signal_number ();
}
+
int
ACE_WIN32_Asynch_Write_Dgram_Result::post_completion (ACE_Proactor_Impl *proactor)
{
return ACE_WIN32_Asynch_Result::post_completion (proactor);
}
+
ACE_WIN32_Asynch_Write_Dgram_Result::ACE_WIN32_Asynch_Write_Dgram_Result (
const ACE_Handler::Proxy_Ptr &handler_proxy,
ACE_HANDLE handle,
@@ -3024,6 +3567,7 @@ ACE_WIN32_Asynch_Write_Dgram_Result::ACE_WIN32_Asynch_Write_Dgram_Result (
handle_ (handle)
{
}
+
void
ACE_WIN32_Asynch_Write_Dgram_Result::complete (size_t bytes_transferred,
int success,
@@ -3035,32 +3579,42 @@ ACE_WIN32_Asynch_Write_Dgram_Result::complete (size_t bytes_transferred,
this->success_ = success;
this->completion_key_ = completion_key;
this->error_ = error;
+
// Appropriately move the pointers in the message block.
for (ACE_Message_Block* mb = this->message_block_;
(mb != 0) && (bytes_transferred > 0);
mb = mb->cont ())
{
size_t len_part = mb->length ();
+
if ( len_part > bytes_transferred)
len_part = bytes_transferred;
+
mb->rd_ptr (len_part);
+
bytes_transferred -= len_part;
}
+
// Create the interface result class.
ACE_Asynch_Write_Dgram::Result result (this);
+
// Call the application handler.
ACE_Handler *handler = this->handler_proxy_.get ()->handler ();
if (handler != 0)
handler->handle_write_dgram (result);
}
+
ACE_WIN32_Asynch_Write_Dgram_Result::~ACE_WIN32_Asynch_Write_Dgram_Result (void)
{
}
+
//***********************************************
+
ACE_WIN32_Asynch_Write_Dgram::~ACE_WIN32_Asynch_Write_Dgram (void)
{
}
+
ssize_t
ACE_WIN32_Asynch_Write_Dgram::send (ACE_Message_Block *message_block,
size_t &number_of_bytes_sent,
@@ -3071,17 +3625,23 @@ ACE_WIN32_Asynch_Write_Dgram::send (ACE_Message_Block *message_block,
int signal_number)
{
number_of_bytes_sent = 0;
+
size_t bytes_to_write = 0;
+
iovec iov[ACE_IOV_MAX];
int iovcnt = 0;
+
for (const ACE_Message_Block* msg = message_block;
msg != 0 && iovcnt < ACE_IOV_MAX;
msg = msg->cont () , ++iovcnt )
{
size_t msg_len = msg->length ();
+
bytes_to_write += msg_len;
+
// Make as many iovec as needed to fit all of msg_len.
size_t rd_ptr_offset = 0;
+
do
{
if (msg_len >= 0 && iovcnt < ACE_IOV_MAX)
@@ -3091,23 +3651,27 @@ ACE_WIN32_Asynch_Write_Dgram::send (ACE_Message_Block *message_block,
this_chunk_length = ULONG_MAX;
else
this_chunk_length = static_cast<u_long> (msg_len);
+
// Collect the data in the iovec.
iov[iovcnt].iov_base = msg->rd_ptr () + rd_ptr_offset;
iov[iovcnt].iov_len = this_chunk_length;
msg_len -= this_chunk_length;
rd_ptr_offset += this_chunk_length;
+
// Increment iovec counter if there's more to do.
if (msg_len > 0)
iovcnt++;
}
}
while (msg_len > 0 && iovcnt < ACE_IOV_MAX);
+
if (msg_len > 0) // Ran out of iovecs before msg_space exhausted
{
errno = ERANGE;
return -1;
}
}
+
// Create the Asynch_Result.
ACE_WIN32_Asynch_Write_Dgram_Result *result = 0;
ACE_NEW_RETURN (result,
@@ -3121,7 +3685,9 @@ ACE_WIN32_Asynch_Write_Dgram::send (ACE_Message_Block *message_block,
priority,
signal_number),
-1);
+
// do the scatter/gather send
+
ssize_t initiate_result = ACE_OS::sendto (result->handle (),
iov,
iovcnt,
@@ -3132,6 +3698,7 @@ ACE_WIN32_Asynch_Write_Dgram::send (ACE_Message_Block *message_block,
result,
0);
+
if (initiate_result == SOCKET_ERROR)
{
// If initiate failed, check for a bad error.
@@ -3143,19 +3710,23 @@ ACE_WIN32_Asynch_Write_Dgram::send (ACE_Message_Block *message_block,
// get queued.
initiate_result = 0;
break;
+
default:
// Something else went wrong: the OVERLAPPED will not get
// queued.
+
if (ACE::debug ())
{
ACE_DEBUG ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("WSASendTo")));
}
+
delete result;
initiate_result = -1;
break;
}
+
}
else
{
@@ -3163,11 +3734,14 @@ ACE_WIN32_Asynch_Write_Dgram::send (ACE_Message_Block *message_block,
// number_of_bytes_recvd contains the number of bytes recvd
// addr contains the peer address
// flags was updated
+
// number_of_bytes_sent = bytes_sent;
initiate_result = 1;
}
+
return initiate_result;
}
+
int
ACE_WIN32_Asynch_Write_Dgram::open (const ACE_Handler::Proxy_Ptr &handler_proxy,
ACE_HANDLE handle,
@@ -3179,22 +3753,27 @@ ACE_WIN32_Asynch_Write_Dgram::open (const ACE_Handler::Proxy_Ptr &handler_proxy,
completion_key,
proactor);
}
+
int
ACE_WIN32_Asynch_Write_Dgram::cancel (void)
{
return ACE_WIN32_Asynch_Operation::cancel ();
}
+
ACE_Proactor *
ACE_WIN32_Asynch_Write_Dgram::proactor (void) const
{
return ACE_WIN32_Asynch_Operation::proactor ();
}
+
ACE_WIN32_Asynch_Write_Dgram::ACE_WIN32_Asynch_Write_Dgram (ACE_WIN32_Proactor *win32_proactor)
: ACE_Asynch_Operation_Impl (),
ACE_Asynch_Write_Dgram_Impl (),
ACE_WIN32_Asynch_Operation (win32_proactor)
{
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_WIN32_OVERLAPPED_IO && ACE_HAS_WINSOCK2 */
diff --git a/dep/ACE_wrappers/ace/WIN32_Asynch_IO.h b/dep/ACE_wrappers/ace/WIN32_Asynch_IO.h
index 76af1142d30..a1cf22ae0a0 100644
--- a/dep/ACE_wrappers/ace/WIN32_Asynch_IO.h
+++ b/dep/ACE_wrappers/ace/WIN32_Asynch_IO.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file WIN32_Asynch_IO.h
@@ -20,24 +21,32 @@
* @author Alexander Libman <alibman@ihug.com.au>
*/
//=============================================================================
+
#ifndef ACE_WIN32_ASYNCH_IO_H
#define ACE_WIN32_ASYNCH_IO_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
#pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_WIN32_OVERLAPPED_IO) && \
(defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 == 1))
+
#include "ace/Asynch_IO_Impl.h"
#include "ace/Addr.h"
#include "ace/Event_Handler.h"
#include "ace/Handle_Set.h"
#include "ace/Map_Manager.h"
#include "ace/Null_Mutex.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward declaration
class ACE_WIN32_Proactor;
+
/**
* @class ACE_WIN32_Asynch_Result
*
@@ -56,42 +65,58 @@ class ACE_Export ACE_WIN32_Asynch_Result : public virtual ACE_Asynch_Result_Impl
{
/// Factory class has special permissions.
friend class ACE_WIN32_Asynch_Accept;
+
/// Proactor class has special permission.
friend class ACE_WIN32_Proactor;
+
public:
/// Number of bytes transferred by the operation.
size_t bytes_transferred (void) const;
+
/// ACT associated with the operation.
const void *act (void) const;
+
/// Did the operation succeed?
int success (void) const;
+
/**
* This returns the ACT associated with the handle when it was
* registered with the I/O completion port. This ACT is not the
* same as the ACT associated with the asynchronous operation.
*/
const void *completion_key (void) const;
+
/// Error value if the operation fail.
u_long error (void) const;
+
/// Event associated with the OVERLAPPED structure.
ACE_HANDLE event (void) const;
+
/// This really make sense only when doing file I/O.
u_long offset (void) const;
+
/// Offset_high associated with the OVERLAPPED structure.
u_long offset_high (void) const;
+
/// The priority of the asynchronous operation. Currently, this is
/// not supported on Win32.
int priority (void) const;
+
/// Returns 0.
int signal_number (void) const;
+
/// Post @c this to the Proactor's completion port.
int post_completion (ACE_Proactor_Impl *proactor);
+
/// Destructor.
virtual ~ACE_WIN32_Asynch_Result (void);
+
/// Simulate error value to use in the post_completion ()
void set_error (u_long errcode);
+
/// Simulate value to use in the post_completion ()
void set_bytes_transferred (size_t nbytes);
+
protected:
/// Constructor.
ACE_WIN32_Asynch_Result (const ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -101,19 +126,26 @@ protected:
u_long offset_high,
int priority,
int signal_number = 0);
+
/// Proxy for the ACE_Handler that will be called back.
ACE_Handler::Proxy_Ptr handler_proxy_;
+
/// ACT for this operation.
const void *act_;
+
/// Bytes transferred by this operation.
size_t bytes_transferred_;
+
/// Success indicator.
int success_;
+
/// ACT associated with handle.
const void *completion_key_;
+
/// Error if operation failed.
u_long error_;
};
+
/**
* @class ACE_WIN32_Asynch_Operation
*
@@ -134,29 +166,39 @@ public:
ACE_HANDLE handle,
const void *completion_key,
ACE_Proactor *proactor);
+
/**
* This cancels all pending accepts operations that were issued by
* the calling thread. The function does not cancel asynchronous
* operations issued by other threads.
*/
int cancel (void);
+
// = Access methods.
+
/// Return the underlying proactor.
ACE_Proactor* proactor (void) const;
+
protected:
/// Constructor.
ACE_WIN32_Asynch_Operation (ACE_WIN32_Proactor *win32_proactor);
+
/// Destructor.
virtual ~ACE_WIN32_Asynch_Operation (void);
+
/// Win32 Proactor.
ACE_WIN32_Proactor *win32_proactor_;
+
/// Proactor that this asynch IO is registered with.
ACE_Proactor *proactor_;
+
/// Handler that will receive the callback.
ACE_Handler::Proxy_Ptr handler_proxy_;
+
/// I/O handle used for reading.
ACE_HANDLE handle_;
};
+
/**
* @class ACE_WIN32_Asynch_Read_Stream_Result
*
@@ -168,47 +210,65 @@ class ACE_Export ACE_WIN32_Asynch_Read_Stream_Result : public virtual ACE_Asynch
{
/// Factory class will have special permissions.
friend class ACE_WIN32_Asynch_Read_Stream;
+
/// Proactor class has special permission.
friend class ACE_WIN32_Proactor;
+
public:
/// The number of bytes which were requested at the start of the
/// asynchronous read.
size_t bytes_to_read (void) const;
+
/// Message block which contains the read data.
ACE_Message_Block &message_block (void) const;
+
/// I/O handle used for reading.
ACE_HANDLE handle (void) const;
+
// Base class operations. These operations are here to kill
// dominance warnings. These methods call the base class methods.
+
/// Number of bytes transferred by the operation.
size_t bytes_transferred (void) const;
+
/// ACT associated with the operation.
const void *act (void) const;
+
/// Did the operation succeed?
int success (void) const;
+
/**
* This returns the ACT associated with the handle when it was
* registered with the I/O completion port. This ACT is not the
* same as the ACT associated with the asynchronous operation.
*/
const void *completion_key (void) const;
+
/// Error value if the operation fail.
u_long error (void) const;
+
/// Event associated with the OVERLAPPED structure.
ACE_HANDLE event (void) const;
+
/// This really make sense only when doing file I/O.
u_long offset (void) const;
+
/// Offset_high associated with the OVERLAPPED structure.
u_long offset_high (void) const;
+
/// The priority of the asynchronous operation. Currently, this is
/// not supported on Win32.
int priority (void) const;
+
/// No-op. Returns 0.
int signal_number (void) const;
+
/// Post @c this to the Proactor's completion port.
int post_completion (ACE_Proactor_Impl *proactor);
+
/// Accessor for the scatter read flag
int scatter_enabled (void) const;
+
protected:
/// Constructor is protected since creation is limited to
/// ACE_Asynch_Read_Stream factory.
@@ -221,22 +281,29 @@ protected:
int priority,
int signal_number = 0,
int scatter_enabled = 0);
+
/// Proactor will call this method when the read completes.
virtual void complete (size_t bytes_transferred,
int success,
const void *completion_key,
u_long error);
+
/// Destructor.
virtual ~ACE_WIN32_Asynch_Read_Stream_Result (void);
+
/// Bytes requested when the asynchronous read was initiated.
size_t bytes_to_read_;
+
/// Message block for reading the data into.
ACE_Message_Block &message_block_;
+
/// I/O handle used for reading.
ACE_HANDLE handle_;
+
/// Flag for scatter read
int scatter_enabled_;
};
+
/**
* @class ACE_WIN32_Asynch_Read_Stream
*
@@ -252,9 +319,11 @@ protected:
class ACE_Export ACE_WIN32_Asynch_Read_Stream : public virtual ACE_Asynch_Read_Stream_Impl,
public ACE_WIN32_Asynch_Operation
{
+
public:
/// Constructor.
ACE_WIN32_Asynch_Read_Stream (ACE_WIN32_Proactor *win32_proactor);
+
/// This starts off an asynchronous read. Upto @a bytes_to_read will
/// be read and stored in the @a message_block.
int read (ACE_Message_Block &message_block,
@@ -262,6 +331,7 @@ public:
const void *act,
int priority,
int signal_number = 0);
+
/**
* Same as above but with scatter support, through chaining of composite
* message blocks using the continuation field.
@@ -271,11 +341,14 @@ public:
const void *act,
int priority,
int signal_number = 0);
+
/// Destructor.
virtual ~ACE_WIN32_Asynch_Read_Stream (void);
+
// Methods belong to ACE_WIN32_Asynch_Operation base class. These
// methods are defined here to avoid VC++ warnings. They route the
// call to the ACE_WIN32_Asynch_Operation base class.
+
/**
* Initializes the factory with information which will be used with
* each asynchronous call. If (<handle> == ACE_INVALID_HANDLE),
@@ -286,19 +359,23 @@ public:
ACE_HANDLE handle,
const void *completion_key,
ACE_Proactor *proactor);
+
/**
* This cancels all pending accepts operations that were issued by
* the calling thread. The function does not cancel asynchronous
* operations issued by other threads.
*/
int cancel (void);
+
/// Return the underlying proactor.
ACE_Proactor* proactor (void) const;
+
protected:
/// This is the method which does the real work and is there so that
/// the ACE_Asynch_Read_File class can use it too.
int shared_read (ACE_WIN32_Asynch_Read_Stream_Result *result);
};
+
/**
* @class ACE_WIN32_Asynch_Write_Stream_Result
*
@@ -310,47 +387,65 @@ class ACE_Export ACE_WIN32_Asynch_Write_Stream_Result : public virtual ACE_Async
{
/// Factory class willl have special permissions.
friend class ACE_WIN32_Asynch_Write_Stream;
+
/// Proactor class has special permission.
friend class ACE_WIN32_Proactor;
+
public:
/// The number of bytes which were requested at the start of the
/// asynchronous write.
size_t bytes_to_write (void) const;
+
/// Message block that contains the data to be written.
ACE_Message_Block &message_block (void) const;
+
/// I/O handle used for writing.
ACE_HANDLE handle (void) const;
+
// = Base class operations. These operations are here to kill some
// warnings. These methods call the base class methods.
+
/// Number of bytes transferred by the operation.
size_t bytes_transferred (void) const;
+
/// ACT associated with the operation.
const void *act (void) const;
+
/// Did the operation succeed?
int success (void) const;
+
/**
* This returns the ACT associated with the handle when it was
* registered with the I/O completion port. This ACT is not the
* same as the ACT associated with the asynchronous operation.
*/
const void *completion_key (void) const;
+
/// Error value if the operation fail.
u_long error (void) const;
+
/// Event associated with the OVERLAPPED structure.
ACE_HANDLE event (void) const;
+
/// This really make sense only when doing file I/O.
u_long offset (void) const;
+
/// Offset_high associated with the OVERLAPPED structure.
u_long offset_high (void) const;
+
/// The priority of the asynchronous operation. Currently, this is
/// not supported on Win32.
int priority (void) const;
+
/// No-op. Returns 0.
int signal_number (void) const;
+
/// Post @c this to the Proactor's completion port.
int post_completion (ACE_Proactor_Impl *proactor);
+
/// Accessor for the gather write flag
int gather_enabled (void) const;
+
protected:
/// Constructor is protected since creation is limited to
/// ACE_Asynch_Write_Stream factory.
@@ -363,23 +458,30 @@ protected:
int priority,
int signal_number = 0,
int gather_enabled = 0);
+
/// ACE_Proactor will call this method when the write completes.
virtual void complete (size_t bytes_transferred,
int success,
const void *completion_key,
u_long error);
+
/// Destructor.
virtual ~ACE_WIN32_Asynch_Write_Stream_Result (void);
+
/// The number of bytes which were requested at the start of the
/// asynchronous write.
size_t bytes_to_write_;
+
/// Message block that contains the data to be written.
ACE_Message_Block &message_block_;
+
/// I/O handle used for writing.
ACE_HANDLE handle_;
+
/// Flag for gather write
int gather_enabled_;
};
+
/**
* @class ACE_WIN32_Asynch_Write_Stream
*
@@ -399,6 +501,7 @@ class ACE_Export ACE_WIN32_Asynch_Write_Stream : public virtual ACE_Asynch_Write
public:
/// Constructor.
ACE_WIN32_Asynch_Write_Stream (ACE_WIN32_Proactor *win32_proactor);
+
/// This starts off an asynchronous write. Upto @a bytes_to_write
/// will be written from the @a message_block.
int write (ACE_Message_Block &message_block,
@@ -406,6 +509,7 @@ public:
const void *act,
int priority,
int signal_number = 0);
+
/**
* Same as above but with gather support, through chaining of composite
* message blocks using the continuation field.
@@ -415,11 +519,15 @@ public:
const void *act,
int priority,
int signal_number = 0);
+
/// Destructor.
virtual ~ACE_WIN32_Asynch_Write_Stream (void);
+
// = Methods belonging to <ACE_WIN32_Asynch_Operation> base class.
+
// These methods are defined here to avoid VC++ warnings. They route
// the call to the <ACE_WIN32_Asynch_Operation> base class.
+
/**
* Initializes the factory with information which will be used with
* each asynchronous call. If (<handle> == ACE_INVALID_HANDLE),
@@ -430,19 +538,23 @@ public:
ACE_HANDLE handle,
const void *completion_key,
ACE_Proactor *proactor);
+
/**
* This cancels all pending accepts operations that were issued by
* the calling thread. The function does not cancel asynchronous
* operations issued by other threads.
*/
int cancel (void);
+
/// Return the underlying proactor.
ACE_Proactor* proactor (void) const;
+
protected:
/// This is the method which does the real work and is there so that
/// the ACE_Asynch_Write_File class can use it too.
int shared_write (ACE_WIN32_Asynch_Write_Stream_Result *result);
};
+
/**
* @class ACE_WIN32_Asynch_Read_File_Result
*
@@ -454,50 +566,68 @@ class ACE_Export ACE_WIN32_Asynch_Read_File_Result : public virtual ACE_Asynch_R
{
/// Factory class will have special permissions.
friend class ACE_WIN32_Asynch_Read_File;
+
/// Proactor class has special permission.
friend class ACE_WIN32_Proactor;
+
public:
// = These methods belong to ACE_WIN32_Asynch_Result class base
// class. These operations are here to kill some warnings. These
// methods call the base class methods.
+
/// Number of bytes transferred by the operation.
size_t bytes_transferred (void) const;
+
/// ACT associated with the operation.
const void *act (void) const;
+
/// Did the operation succeed?
int success (void) const;
+
/**
* This returns the ACT associated with the handle when it was
* registered with the I/O completion port. This ACT is not the
* same as the ACT associated with the asynchronous operation.
*/
const void *completion_key (void) const;
+
/// Error value if the operation fail.
u_long error (void) const;
+
/// Event associated with the OVERLAPPED structure.
ACE_HANDLE event (void) const;
+
/// This really make sense only when doing file I/O.
u_long offset (void) const;
+
/// Offset_high associated with the OVERLAPPED structure.
u_long offset_high (void) const;
+
/// The priority of the asynchronous operation. Currently, this is
/// not supported on Win32.
int priority (void) const;
+
/// No-op. Returns 0.
int signal_number (void) const;
+
// The following methods belong to
// ACE_WIN32_Asynch_Read_Stream_Result. They are here to avoid VC++
// dominance warnings. These methods route their call to the
// ACE_WIN32_Asynch_Read_Stream_Result base class.
+
/// The number of bytes which were requested at the start of the
/// asynchronous read.
size_t bytes_to_read (void) const;
+
/// Message block which contains the read data.
ACE_Message_Block &message_block (void) const;
+
/// I/O handle used for reading.
ACE_HANDLE handle (void) const;
+
/// Post @c this to the Proactor's completion port.
int post_completion (ACE_Proactor_Impl *proactor);
+
protected:
/// Constructor is protected since creation is limited to
/// ACE_Asynch_Read_File factory.
@@ -512,14 +642,17 @@ protected:
int priority,
int signal_number = 0,
int scatter_enabled = 0);
+
/// ACE_Proactor will call this method when the read completes.
virtual void complete (size_t bytes_transferred,
int success,
const void *completion_key,
u_long error);
+
/// Destructor.
virtual ~ACE_WIN32_Asynch_Read_File_Result (void);
};
+
/**
* @class ACE_WIN32_Asynch_Read_File
*
@@ -538,9 +671,11 @@ protected:
class ACE_Export ACE_WIN32_Asynch_Read_File : public virtual ACE_Asynch_Read_File_Impl,
public ACE_WIN32_Asynch_Read_Stream
{
+
public:
/// Constructor.
ACE_WIN32_Asynch_Read_File (ACE_WIN32_Proactor *win32_proactor);
+
/**
* This starts off an asynchronous read. Upto @a bytes_to_read will
* be read and stored in the @a message_block. The read will start
@@ -553,6 +688,7 @@ public:
const void *act,
int priority,
int signal_number = 0);
+
/**
* Same as above but with scatter support, through chaining of
* composite message blocks using the continuation field.
@@ -568,11 +704,14 @@ public:
int priority,
int signal_number = 0);
+
/// Destructor.
virtual ~ACE_WIN32_Asynch_Read_File (void);
+
// = Methods belong to ACE_WIN32_Asynch_Operation base class. These
// methods are defined here to avoid VC++ warnings. They route the
// call to the ACE_WIN32_Asynch_Operation base class.
+
/**
* Initializes the factory with information which will be used with
* each asynchronous call. If (<handle> == ACE_INVALID_HANDLE),
@@ -583,14 +722,17 @@ public:
ACE_HANDLE handle,
const void *completion_key,
ACE_Proactor *proactor);
+
/**
* This cancels all pending accepts operations that were issued by
* the calling thread. The function does not cancel asynchronous
* operations issued by other threads.
*/
int cancel (void);
+
/// Return the underlying proactor.
ACE_Proactor* proactor (void) const;
+
private:
/**
* This method belongs to ACE_WIN32_Asynch_Read_Stream. It is here
@@ -602,6 +744,7 @@ private:
const void *act,
int priority,
int signal_number = 0);
+
/**
* Same as above but with scatter support, through chaining of composite
* message blocks using the continuation field.
@@ -612,6 +755,7 @@ private:
int priority,
int signal_number = 0);
};
+
/**
* @class ACE_WIN32_Asynch_Write_File_Result
*
@@ -634,49 +778,67 @@ class ACE_Export ACE_WIN32_Asynch_Write_File_Result : public virtual ACE_Asynch_
{
/// Factory class will have special permission.
friend class ACE_WIN32_Asynch_Write_File;
+
/// Proactor class has special permission.
friend class ACE_WIN32_Proactor;
+
public:
// = Base class operations. These operations are here to kill some
// warnings. These methods call the base class methods.
+
/// Number of bytes transferred by the operation.
size_t bytes_transferred (void) const;
+
/// ACT associated with the operation.
const void *act (void) const;
+
/// Did the operation succeed?
int success (void) const;
+
/**
* This returns the ACT associated with the handle when it was
* registered with the I/O completion port. This ACT is not the
* same as the ACT associated with the asynchronous operation.
*/
const void *completion_key (void) const;
+
/// Error value if the operation fail.
u_long error (void) const;
+
/// Event associated with the OVERLAPPED structure.
ACE_HANDLE event (void) const;
+
/// This really make sense only when doing file I/O.
u_long offset (void) const;
+
/// Offset_high associated with the OVERLAPPED structure.
u_long offset_high (void) const;
+
/// The priority of the asynchronous operation. Currently, this is
/// not supported on Win32.
int priority (void) const;
+
/// No-op. Returns 0.
int signal_number (void) const;
+
// The following methods belong to
// ACE_WIN32_Asynch_Read_Stream_Result. They are here to avoid VC++
// warnings. These methods route their call to the
// ACE_WIN32_Asynch_Read_Stream_Result base class.
+
/// The number of bytes which were requested at the start of the
/// asynchronous write.
size_t bytes_to_write (void) const;
+
/// Message block that contains the data to be written.
ACE_Message_Block &message_block (void) const;
+
/// I/O handle used for writing.
ACE_HANDLE handle (void) const;
+
/// Post @c this to the Proactor's completion port.
int post_completion (ACE_Proactor_Impl *proactor);
+
protected:
/// Constructor is protected since creation is limited to
/// ACE_Asynch_Write_File factory.
@@ -691,14 +853,17 @@ protected:
int priority,
int signal_number = 0,
int gather_enabled = 0);
+
/// ACE_Proactor will call this method when the write completes.
virtual void complete (size_t bytes_transferred,
int success,
const void *completion_key,
u_long error);
+
/// Destructor.
virtual ~ACE_WIN32_Asynch_Write_File_Result (void);
};
+
/**
* @class ACE_WIN32_Asynch_Write_File
*
@@ -717,6 +882,7 @@ class ACE_Export ACE_WIN32_Asynch_Write_File : public virtual ACE_Asynch_Write_F
public:
/// Constructor.
ACE_WIN32_Asynch_Write_File (ACE_WIN32_Proactor *win32_proactor);
+
/**
* This starts off an asynchronous write. Upto @a bytes_to_write
* will be write and stored in the @a message_block. The write will
@@ -729,6 +895,7 @@ public:
const void *act,
int priority,
int signal_number = 0);
+
/**
* Same as above but with gather support, through chaining of
* composite message blocks using the continuation field.
@@ -743,11 +910,14 @@ public:
const void *act,
int priority,
int signal_number = 0);
+
/// Destrcutor.
virtual ~ACE_WIN32_Asynch_Write_File (void);
+
// = Methods belong to ACE_WIN32_Asynch_Operation base class. These
// methods are defined here to avoid VC++ warnings. They route the
// call to the ACE_WIN32_Asynch_Operation base class.
+
/**
* Initializes the factory with information which will be used with
* each asynchronous call. If (<handle> == ACE_INVALID_HANDLE),
@@ -758,14 +928,17 @@ public:
ACE_HANDLE handle,
const void *completion_key,
ACE_Proactor *proactor);
+
/**
* This cancels all pending accepts operations that were issued by
* the calling thread. The function does not cancel asynchronous
* operations issued by other threads.
*/
int cancel (void);
+
/// Return the underlying proactor.
ACE_Proactor* proactor (void) const;
+
private:
/**
* This method belongs to ACE_WIN32_Asynch_Write_Stream. It is here
@@ -777,6 +950,7 @@ private:
const void *act,
int priority,
int signal_number = 0);
+
/**
* Same as above but with gather support, through chaining of composite
* message blocks using the continuation field.
@@ -787,6 +961,7 @@ private:
int priority,
int signal_number = 0);
};
+
/**
* @class ACE_WIN32_Asynch_Accept_Result
*
@@ -802,47 +977,65 @@ class ACE_Export ACE_WIN32_Asynch_Accept_Result : public virtual ACE_Asynch_Acce
{
/// Factory will have special permission.
friend class ACE_WIN32_Asynch_Accept;
+
/// Proactor class has special permission.
friend class ACE_WIN32_Proactor;
+
public:
/// The number of bytes which were requested at the start of the
/// asynchronous accept.
size_t bytes_to_read (void) const;
+
/// Message block which contains the read data.
ACE_Message_Block &message_block (void) const;
+
/// I/O handle used for accepting new connections.
ACE_HANDLE listen_handle (void) const;
+
/// I/O handle for the new connection.
ACE_HANDLE accept_handle (void) const;
+
// = Base class operations. These operations are here to kill some
// warnings. These methods call the base class methods.
+
/// Number of bytes transferred by the operation.
size_t bytes_transferred (void) const;
+
/// ACT associated with the operation.
const void *act (void) const;
+
/// Did the operation succeed?
int success (void) const;
+
/**
* This returns the ACT associated with the handle when it was
* registered with the I/O completion port. This ACT is not the
* same as the ACT associated with the asynchronous operation.
*/
const void *completion_key (void) const;
+
/// Error value if the operation fail.
u_long error (void) const;
+
/// Event associated with the OVERLAPPED structure.
ACE_HANDLE event (void) const;
+
/// This really make sense only when doing file I/O.
u_long offset (void) const;
+
/// Offset_high associated with the OVERLAPPED structure.
u_long offset_high (void) const;
+
/// The priority of the asynchronous operation. Currently, this is
/// not supported on Win32.
int priority (void) const;
+
/// No-op. Returns 0.
int signal_number (void) const;
+
/// Post @c this to the Proactor's completion port.
int post_completion (ACE_Proactor_Impl *proactor);
+
protected:
/// Constructor is protected since creation is limited to
/// ACE_Asynch_Accept factory.
@@ -855,22 +1048,29 @@ protected:
ACE_HANDLE event,
int priority,
int signal_number = 0);
+
/// ACE_Proactor will call this method when the accept completes.
virtual void complete (size_t bytes_transferred,
int success,
const void *completion_key,
u_long error);
+
/// Destructor.
virtual ~ACE_WIN32_Asynch_Accept_Result (void);
+
/// Bytes requested when the asynchronous read was initiated.
size_t bytes_to_read_;
+
/// Message block for reading the data into.
ACE_Message_Block &message_block_;
+
/// I/O handle used for accepting new connections.
ACE_HANDLE listen_handle_;
+
/// I/O handle for the new connection.
ACE_HANDLE accept_handle_;
};
+
/**
* @class ACE_WIN32_Asynch_Accept
*
@@ -889,6 +1089,7 @@ class ACE_Export ACE_WIN32_Asynch_Accept : public virtual ACE_Asynch_Accept_Impl
public:
/// Constructor.
ACE_WIN32_Asynch_Accept (ACE_WIN32_Proactor *win32_proactor);
+
/**
* This starts off an asynchronous accept. The asynchronous accept
* call also allows any initial data to be returned to the
@@ -907,11 +1108,14 @@ public:
int priority,
int signal_number = 0,
int addr_family = AF_INET);
+
/// Destructor.
~ACE_WIN32_Asynch_Accept (void);
+
// Methods belong to ACE_WIN32_Asynch_Operation base class. These
// methods are defined here to avoid VC++ warnings. They route the
// call to the ACE_WIN32_Asynch_Operation base class.
+
/**
* Initializes the factory with information which will be used with
* each asynchronous call. If (<handle> == ACE_INVALID_HANDLE),
@@ -922,15 +1126,18 @@ public:
ACE_HANDLE handle,
const void *completion_key,
ACE_Proactor *proactor);
+
/**
* This cancels all pending accepts operations that were issued by
* the calling thread. The function does not cancel asynchronous
* operations issued by other threads.
*/
int cancel (void);
+
/// Return the underlying proactor.
ACE_Proactor* proactor (void) const;
};
+
/**
* @class ACE_WIN32_Asynch_Connect_Result
*
@@ -946,40 +1153,56 @@ class ACE_Export ACE_WIN32_Asynch_Connect_Result : public virtual ACE_Asynch_Con
{
/// Factory classes will have special permissions.
friend class ACE_WIN32_Asynch_Connect;
+
/// The Proactor constructs the Result class for faking results.
friend class ACE_WIN32_Proactor;
+
public:
+
/// I/O handle for the connection.
ACE_HANDLE connect_handle (void) const;
+
// = Base class operations. These operations are here to kill some
// warnings. These methods call the base class methods.
+
/// Number of bytes transferred by the operation.
size_t bytes_transferred (void) const;
+
/// ACT associated with the operation.
const void *act (void) const;
+
/// Did the operation succeed?
int success (void) const;
+
/**
* Returns the ACT associated with the handle when it was
* registered with the I/O completion port. This ACT is not the
* same as the ACT associated with the asynchronous operation.
*/
const void *completion_key (void) const;
+
/// Error value if the operation fail.
u_long error (void) const;
+
/// Event associated with the OVERLAPPED structure.
ACE_HANDLE event (void) const;
+
/// This really make sense only when doing file I/O.
u_long offset (void) const;
+
/// Offset_high associated with the OVERLAPPED structure.
u_long offset_high (void) const;
+
/// The priority of the asynchronous operation. Currently, this is
/// not supported on Win32.
int priority (void) const;
+
/// No-op. Returns 0.
int signal_number (void) const;
+
/// Post this object to the Proactor's completion port.
int post_completion (ACE_Proactor_Impl *proactor);
+
protected:
/// Constructor is protected since creation is limited to
/// ACE_Asynch_Connect factory.
@@ -989,18 +1212,23 @@ protected:
ACE_HANDLE event,
int priority,
int signal_number);
+
/// ACE_Proactor will call this method when the accept completes.
virtual void complete (size_t bytes_transferred,
int success,
const void *completion_key,
u_long error);
+
/// Destructor.
virtual ~ACE_WIN32_Asynch_Connect_Result (void);
+
/// Set the I/O handle for the new connection.
void connect_handle (ACE_HANDLE handle);
+
ACE_HANDLE connect_handle_;
};
+
/**
* @class ACE_WIN32_Asynch_Connect
*/
@@ -1010,10 +1238,13 @@ class ACE_Export ACE_WIN32_Asynch_Connect :
public ACE_Event_Handler
{
public:
+
/// Constructor.
ACE_WIN32_Asynch_Connect (ACE_WIN32_Proactor * win32_proactor);
+
/// Destructor.
virtual ~ACE_WIN32_Asynch_Connect (void);
+
/**
* This open belongs to ACE_WIN32_Asynch_Operation. We forward
* this call to that method. We have put this here to avoid the
@@ -1023,6 +1254,7 @@ public:
ACE_HANDLE handle,
const void *completion_key,
ACE_Proactor *proactor = 0);
+
/**
* Start an asynchronous connect.
*
@@ -1039,37 +1271,47 @@ public:
const void *act,
int priority,
int signal_number = 0);
+
/**
* Cancel all pending pseudo-asynchronus requests
* Behavior as usual AIO request
*/
int cancel (void);
+
/**
* Close performs cancellation of all pending requests
* and close the connect handle
*/
int close (void);
+
/// Virtual from ACE_Event_Handler
ACE_HANDLE get_handle (void) const;
+
/// Virtual from ACE_Event_Handler
void set_handle (ACE_HANDLE handle);
+
/// Virtual from ACE_Event_Handler
int handle_input ( ACE_HANDLE handle);
int handle_output ( ACE_HANDLE handle);
int handle_exception ( ACE_HANDLE handle);
+
/// Virtual from ACE_Event_Handler
int handle_close (ACE_HANDLE handle, ACE_Reactor_Mask close_mask) ;
+
// = Methods belong to ACE_WIN32_Asynch_Operation base class. These
// methods are defined here to avoid dominace warnings. They route
// the call to the ACE_WIN32_Asynch_Operation base class.
/// Return the underlying proactor.
ACE_Proactor* proactor (void) const;
+
private:
int connect_i (ACE_WIN32_Asynch_Connect_Result *result,
const ACE_Addr &remote_sap,
const ACE_Addr &local_sap,
int reuse_addr);
+
int post_result (ACE_WIN32_Asynch_Connect_Result *result, bool flg_post);
+
/// Cancel uncompleted connect operations.
/**
* @param flg_notify Indicates whether or not to send notification about
@@ -1085,19 +1327,24 @@ private:
* replaced.
*/
int cancel_uncompleted (bool flg_notify, ACE_Handle_Set &set);
+
/// true - Connect is registered in ACE_Asynch_Pseudo_Task
/// false - Accept is deregisted in ACE_Asynch_Pseudo_Task
bool flg_open_ ;
+
typedef ACE_Map_Manager<ACE_HANDLE, ACE_WIN32_Asynch_Connect_Result *, ACE_SYNCH_NULL_MUTEX>
MAP_MANAGER;
+
/// Map of Result pointers that correspond to all the <accept>'s
/// pending.
MAP_MANAGER result_map_;
+
/// The lock to protect the result map which is shared. The queue
/// is updated by main thread in the register function call and
/// through the auxillary thread in the asynch pseudo task.
ACE_SYNCH_MUTEX lock_;
};
+
/**
* @class ACE_WIN32_Asynch_Transmit_File_Result
*
@@ -1114,52 +1361,72 @@ class ACE_Export ACE_WIN32_Asynch_Transmit_File_Result : public virtual ACE_Asyn
{
/// Factory class will have special permission.
friend class ACE_WIN32_Asynch_Transmit_File;
+
/// Proactor class has special permission.
friend class ACE_WIN32_Proactor;
+
public:
/// Socket used for transmitting the file.
ACE_HANDLE socket (void) const;
+
/// File from which the data is read.
ACE_HANDLE file (void) const;
+
/// Header and trailer data associated with this transmit file.
ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer (void) const;
+
/// The number of bytes which were requested at the start of the
/// asynchronous transmit file.
size_t bytes_to_write (void) const;
+
/// Number of bytes per send requested at the start of the transmit
/// file.
size_t bytes_per_send (void) const;
+
/// Flags which were passed into transmit file.
u_long flags (void) const;
+
// Base class operations. These operations are here to kill some
// warnings. These methods call the base class methods.
+
/// Number of bytes transferred by the operation.
size_t bytes_transferred (void) const;
+
/// ACT associated with the operation.
const void *act (void) const;
+
/// Did the operation succeed?
int success (void) const;
+
/**
* This returns the ACT associated with the handle when it was
* registered with the I/O completion port. This ACT is not the
* same as the ACT associated with the asynchronous operation.
*/
const void *completion_key (void) const;
+
/// Error value if the operation fail.
u_long error (void) const;
+
/// Event associated with the OVERLAPPED structure.
ACE_HANDLE event (void) const;
+
/// This really make sense only when doing file I/O.
u_long offset (void) const;
+
/// Offset_high associated with the OVERLAPPED structure.
u_long offset_high (void) const;
+
/// The priority of the asynchronous operation. Currently, this is
/// not supported on Win32.
int priority (void) const;
+
/// No-op. Returns 0.
int signal_number (void) const;
+
/// Post @c this to the Proactor's completion port.
int post_completion (ACE_Proactor_Impl *proactor);
+
protected:
/// Constructor is protected since creation is limited to
/// ACE_Asynch_Transmit_File factory.
@@ -1176,28 +1443,37 @@ protected:
ACE_HANDLE event,
int priority,
int signal_number = 0);
+
/// Proactor will call this method when the write completes.
virtual void complete (size_t bytes_transferred,
int success,
const void *completion_key,
u_long error);
+
/// Destructor.
virtual ~ACE_WIN32_Asynch_Transmit_File_Result (void);
+
/// Network I/O handle.
ACE_HANDLE socket_;
+
/// File I/O handle.
ACE_HANDLE file_;
+
/// Header and trailer data associated with this transmit file.
ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer_;
+
/// The number of bytes which were requested at the start of the
/// asynchronous transmit file.
size_t bytes_to_write_;
+
/// Number of bytes per send requested at the start of the transmit
/// file.
size_t bytes_per_send_;
+
/// Flags which were passed into transmit file.
u_long flags_;
};
+
/**
* @class ACE_WIN32_Asynch_Transmit_File
*
@@ -1223,6 +1499,7 @@ class ACE_Export ACE_WIN32_Asynch_Transmit_File : public virtual ACE_Asynch_Tran
public:
/// Constructor.
ACE_WIN32_Asynch_Transmit_File (ACE_WIN32_Proactor *win32_proactor);
+
/**
* This starts off an asynchronous transmit file. The <file> is a
* handle to an open file. <header_and_trailer> is a pointer to a
@@ -1244,11 +1521,14 @@ public:
const void *act,
int priority,
int signal_number = 0);
+
/// Destructor.
~ACE_WIN32_Asynch_Transmit_File (void);
+
// Methods belong to ACE_WIN32_Asynch_Operation base class. These
// methods are defined here to avoid VC++ warnings. They route the
// call to the ACE_WIN32_Asynch_Operation base class.
+
/**
* Initializes the factory with information which will be used with
* each asynchronous call. If (<handle> == ACE_INVALID_HANDLE),
@@ -1259,15 +1539,18 @@ public:
ACE_HANDLE handle,
const void *completion_key,
ACE_Proactor *proactor);
+
/**
* This cancels all pending accepts operations that were issued by
* the calling thread. The function does not cancel asynchronous
* operations issued by other threads.
*/
int cancel (void);
+
/// Return the underlying proactor.
ACE_Proactor* proactor (void) const;
};
+
/**
* @class ACE_WIN32_Asynch_Read_Dgram_Result
*
@@ -1279,50 +1562,70 @@ class ACE_Export ACE_WIN32_Asynch_Read_Dgram_Result : public virtual ACE_Asynch_
{
/// Factory class will have special permissions.
friend class ACE_WIN32_Asynch_Read_Dgram;
+
/// Proactor class has special permission.
friend class ACE_WIN32_Proactor;
+
public:
/// The number of bytes which were requested at the start of the
/// asynchronous read.
size_t bytes_to_read (void) const;
+
/// Message block which contains the read data
ACE_Message_Block *message_block (void) const;
+
/// The address of where the packet came from
int remote_address (ACE_Addr& addr) const;
+
sockaddr *saddr () const;
+
/// The flags used in the read
int flags (void) const;
+
/// I/O handle used for reading.
ACE_HANDLE handle (void) const;
+
// Base class operations. These operations are here to kill
// dominance warnings. These methods call the base class methods.
+
/// Number of bytes transferred by the operation.
size_t bytes_transferred (void) const;
+
/// ACT associated with the operation.
const void *act (void) const;
+
/// Did the operation succeed?
int success (void) const;
+
/**
* This returns the ACT associated with the handle when it was
* registered with the I/O completion port. This ACT is not the
* same as the ACT associated with the asynchronous operation.
*/
const void *completion_key (void) const;
+
/// Error value if the operation fail.
u_long error (void) const;
+
/// Event associated with the OVERLAPPED structure.
ACE_HANDLE event (void) const;
+
/// This really make sense only when doing file I/O.
u_long offset (void) const;
+
/// Offset_high associated with the OVERLAPPED structure.
u_long offset_high (void) const;
+
/// The priority of the asynchronous operation. Currently, this is
/// not supported on Win32.
int priority (void) const;
+
/// No-op. Returns 0.
int signal_number (void) const;
+
/// Post @c this to the Proactor's completion port.
int post_completion (ACE_Proactor_Impl *proactor);
+
protected:
/// Constructor is protected since creation is limited to
/// ACE_Asynch_Read_Dgram factory.
@@ -1336,25 +1639,34 @@ protected:
ACE_HANDLE event,
int priority,
int signal_number = 0);
+
/// Proactor will call this method when the read completes.
virtual void complete (size_t bytes_transferred,
int success,
const void *completion_key,
u_long error);
+
/// Destructor.
virtual ~ACE_WIN32_Asynch_Read_Dgram_Result (void);
+
/// Bytes requested when the asynchronous read was initiated.
size_t bytes_to_read_;
+
/// Message block for reading the data into.
ACE_Message_Block *message_block_;
+
/// The address of where the packet came from
ACE_Addr *remote_address_;
+
int addr_len_;
+
/// The flags used in the read
int flags_;
+
/// I/O handle used for reading.
ACE_HANDLE handle_;
};
+
/**
* @class ACE_WIN32_Asynch_Read_Dgram
*
@@ -1374,8 +1686,10 @@ class ACE_Export ACE_WIN32_Asynch_Read_Dgram : public virtual ACE_Asynch_Read_Dg
public:
/// Constructor.
ACE_WIN32_Asynch_Read_Dgram (ACE_WIN32_Proactor *win32_proactor);
+
/// Destructor.
virtual ~ACE_WIN32_Asynch_Read_Dgram (void);
+
/** This starts off an asynchronous read. Upto
* <message_block->total_size()> will be read and stored in the
* @a message_block. @a message_block's <wr_ptr> will be updated to reflect
@@ -1400,9 +1714,11 @@ public:
const void *act,
int priority,
int signal_number);
+
// Methods belong to ACE_WIN32_Asynch_Operation base class. These
// methods are defined here to avoid VC++ warnings. They route the
// call to the ACE_WIN32_Asynch_Operation base class.
+
/**
* Initializes the factory with information which will be used with
* each asynchronous call. If (<handle> == ACE_INVALID_HANDLE),
@@ -1413,18 +1729,22 @@ public:
ACE_HANDLE handle,
const void *completion_key,
ACE_Proactor *proactor);
+
/**
* This cancels all pending accepts operations that were issued by
* the calling thread. The function does not cancel asynchronous
* operations issued by other threads.
*/
int cancel (void);
+
/// Return the underlying proactor.
ACE_Proactor* proactor (void) const;
+
protected:
/// Do-nothing constructor.
ACE_WIN32_Asynch_Read_Dgram (void);
};
+
/**
* @class ACE_WIN32_Asynch_Write_Dgram_Result
*
@@ -1436,47 +1756,65 @@ class ACE_Export ACE_WIN32_Asynch_Write_Dgram_Result : public virtual ACE_Asynch
{
/// Factory class willl have special permissions.
friend class ACE_WIN32_Asynch_Write_Dgram;
+
/// Proactor class has special permission.
friend class ACE_WIN32_Proactor;
+
public:
/// The number of bytes which were requested at the start of the
/// asynchronous write.
size_t bytes_to_write (void) const;
+
/// Message block which contains the sent data
ACE_Message_Block *message_block (void) const;
+
/// The flags using in the write
int flags (void) const;
+
/// I/O handle used for writing.
ACE_HANDLE handle (void) const;
+
// = Base class operations. These operations are here to kill some
// warnings. These methods call the base class methods.
+
/// Number of bytes transferred by the operation.
size_t bytes_transferred (void) const;
+
/// ACT associated with the operation.
const void *act (void) const;
+
/// Did the operation succeed?
int success (void) const;
+
/**
* This returns the ACT associated with the handle when it was
* registered with the I/O completion port. This ACT is not the
* same as the ACT associated with the asynchronous operation.
*/
const void *completion_key (void) const;
+
/// Error value if the operation fail.
u_long error (void) const;
+
/// Event associated with the OVERLAPPED structure.
ACE_HANDLE event (void) const;
+
/// This really make sense only when doing file I/O.
u_long offset (void) const;
+
/// Offset_high associated with the OVERLAPPED structure.
u_long offset_high (void) const;
+
/// The priority of the asynchronous operation. Currently, this is
/// not supported on Win32.
int priority (void) const;
+
/// No-op. Returns 0.
int signal_number (void) const;
+
/// Post @c this to the Proactor's completion port.
int post_completion (ACE_Proactor_Impl *proactor);
+
protected:
/// Constructor is protected since creation is limited to
/// ACE_Asynch_Write_Stream factory.
@@ -1489,23 +1827,30 @@ protected:
ACE_HANDLE event,
int priority,
int signal_number = 0);
+
/// ACE_Proactor will call this method when the write completes.
virtual void complete (size_t bytes_transferred,
int success,
const void *completion_key,
u_long error);
+
/// Destructor.
virtual ~ACE_WIN32_Asynch_Write_Dgram_Result (void);
+
/// The number of bytes which were requested at the start of the
/// asynchronous write.
size_t bytes_to_write_;
+
/// Message block used for the send.
ACE_Message_Block *message_block_;
+
/// The flags using in the write
int flags_;
+
/// I/O handle used for writing.
ACE_HANDLE handle_;
};
+
/**
* @class ACE_WIN32_Asynch_Write_Dgram
*
@@ -1525,8 +1870,10 @@ class ACE_Export ACE_WIN32_Asynch_Write_Dgram : public virtual ACE_Asynch_Write_
public:
/// Constructor.
ACE_WIN32_Asynch_Write_Dgram (ACE_WIN32_Proactor *win32_proactor);
+
/// Destructor.
virtual ~ACE_WIN32_Asynch_Write_Dgram (void);
+
/** This starts off an asynchronous send. Upto
* <message_block->total_length()> will be sent. @a message_block's
* <rd_ptr> will be updated to reflect the sent bytes if the send operation
@@ -1551,9 +1898,12 @@ public:
const void *act,
int priority,
int signal_number);
+
// = Methods belonging to <ACE_WIN32_Asynch_Operation> base class.
+
// These methods are defined here to avoid VC++ warnings. They route
// the call to the <ACE_WIN32_Asynch_Operation> base class.
+
/**
* Initializes the factory with information which will be used with
* each asynchronous call. If (<handle> == ACE_INVALID_HANDLE),
@@ -1564,19 +1914,24 @@ public:
ACE_HANDLE handle,
const void *completion_key,
ACE_Proactor *proactor);
+
/**
* This cancels all pending accepts operations that were issued by
* the calling thread. The function does not cancel asynchronous
* operations issued by other threads.
*/
int cancel (void);
+
/// Return the underlying proactor.
ACE_Proactor* proactor (void) const;
+
protected:
/// Do-nothing constructor.
ACE_WIN32_Asynch_Write_Dgram (void);
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_WIN32_OVERLAPPED_IO && ACE_HAS_WINSOCK2 */
#include /**/ "ace/post.h"
#endif /* ACE_WIN32_ASYNCH_IO_H */
diff --git a/dep/ACE_wrappers/ace/WIN32_Proactor.cpp b/dep/ACE_wrappers/ace/WIN32_Proactor.cpp
index a7cb45a686e..dceb8336277 100644
--- a/dep/ACE_wrappers/ace/WIN32_Proactor.cpp
+++ b/dep/ACE_wrappers/ace/WIN32_Proactor.cpp
@@ -1,13 +1,19 @@
// $Id: WIN32_Proactor.cpp 80826 2008-03-04 14:51:23Z wotte $
+
// ACE_RCSID(ace, Proactor, "$Id: WIN32_Proactor.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#include "ace/WIN32_Proactor.h"
+
#if defined (ACE_WIN32) && defined (ACE_HAS_WIN32_OVERLAPPED_IO)
// WIN implemenatation of the Proactor.
+
#include "ace/Log_Msg.h"
#include "ace/Object_Manager.h"
#include "ace/OS_NS_errno.h"
#include "ace/OS_NS_unistd.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_WIN32_Wakeup_Completion
*
@@ -17,6 +23,7 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
*/
class ACE_WIN32_Wakeup_Completion : public ACE_WIN32_Asynch_Result
{
+
public:
/// Constructor.
ACE_WIN32_Wakeup_Completion (ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -24,14 +31,17 @@ public:
ACE_HANDLE event = ACE_INVALID_HANDLE,
int priority = 0,
int signal_number = ACE_SIGRTMIN);
+
/// Destructor.
virtual ~ACE_WIN32_Wakeup_Completion (void);
+
/// This method calls the <handler>'s <handle_wakeup> method.
virtual void complete (size_t bytes_transferred = 0,
int success = 1,
const void *completion_key = 0,
u_long error = 0);
};
+
ACE_WIN32_Proactor::ACE_WIN32_Proactor (size_t number_of_threads,
bool used_with_reactor_event_loop)
: completion_port_ (0),
@@ -48,18 +58,23 @@ ACE_WIN32_Proactor::ACE_WIN32_Proactor (size_t number_of_threads,
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("CreateIoCompletionPort")));
+
this->get_asynch_pseudo_task ().start ();
}
+
ACE_WIN32_Proactor::~ACE_WIN32_Proactor (void)
{
this->get_asynch_pseudo_task ().stop ();
+
this->close ();
}
+
ACE_Asynch_Pseudo_Task &
ACE_WIN32_Proactor::get_asynch_pseudo_task ()
{
return this->pseudo_task_;
}
+
int
ACE_WIN32_Proactor::close (void)
{
@@ -67,11 +82,13 @@ ACE_WIN32_Proactor::close (void)
if (this->completion_port_ != 0)
{
// To avoid memory leaks we should delete all results from queue.
+
for (;;)
{
ACE_OVERLAPPED *overlapped = 0;
u_long bytes_transferred = 0;
ULONG_PTR completion_key = 0;
+
// Get the next asynchronous operation that completes
BOOL res = ::GetQueuedCompletionStatus
(this->completion_port_,
@@ -79,23 +96,30 @@ ACE_WIN32_Proactor::close (void)
&completion_key,
&overlapped,
0); // poll
+
if (overlapped == 0 || res == FALSE)
break;
+
ACE_WIN32_Asynch_Result *asynch_result =
(ACE_WIN32_Asynch_Result *) overlapped;
+
delete asynch_result;
}
+
int result = ACE_OS::close (this->completion_port_);
this->completion_port_ = 0;
return result;
}
+
return 0;
}
+
int
ACE_WIN32_Proactor::register_handle (ACE_HANDLE handle,
const void *completion_key)
{
ULONG_PTR comp_key (reinterpret_cast<ULONG_PTR> (completion_key));
+
// No locking is needed here as no state changes.
ACE_HANDLE cp = ::CreateIoCompletionPort (handle,
this->completion_port_,
@@ -119,6 +143,7 @@ ACE_WIN32_Proactor::register_handle (ACE_HANDLE handle,
}
return 0;
}
+
ACE_Asynch_Read_Stream_Impl *
ACE_WIN32_Proactor::create_asynch_read_stream (void)
{
@@ -128,6 +153,7 @@ ACE_WIN32_Proactor::create_asynch_read_stream (void)
0);
return implementation;
}
+
ACE_Asynch_Write_Stream_Impl *
ACE_WIN32_Proactor::create_asynch_write_stream (void)
{
@@ -137,6 +163,7 @@ ACE_WIN32_Proactor::create_asynch_write_stream (void)
0);
return implementation;
}
+
ACE_Asynch_Read_Dgram_Impl *
ACE_WIN32_Proactor::create_asynch_read_dgram (void)
{
@@ -146,6 +173,7 @@ ACE_WIN32_Proactor::create_asynch_read_dgram (void)
0);
return implementation;
}
+
ACE_Asynch_Write_Dgram_Impl *
ACE_WIN32_Proactor::create_asynch_write_dgram (void)
{
@@ -155,6 +183,7 @@ ACE_WIN32_Proactor::create_asynch_write_dgram (void)
0);
return implementation;
}
+
ACE_Asynch_Read_File_Impl *
ACE_WIN32_Proactor::create_asynch_read_file (void)
{
@@ -164,6 +193,7 @@ ACE_WIN32_Proactor::create_asynch_read_file (void)
0);
return implementation;
}
+
ACE_Asynch_Write_File_Impl *
ACE_WIN32_Proactor::create_asynch_write_file (void)
{
@@ -173,6 +203,7 @@ ACE_WIN32_Proactor::create_asynch_write_file (void)
0);
return implementation;
}
+
ACE_Asynch_Accept_Impl *
ACE_WIN32_Proactor::create_asynch_accept (void)
{
@@ -182,6 +213,7 @@ ACE_WIN32_Proactor::create_asynch_accept (void)
0);
return implementation;
}
+
ACE_Asynch_Connect_Impl *
ACE_WIN32_Proactor::create_asynch_connect (void)
{
@@ -191,6 +223,7 @@ ACE_WIN32_Proactor::create_asynch_connect (void)
0);
return implementation;
}
+
ACE_Asynch_Transmit_File_Impl *
ACE_WIN32_Proactor::create_asynch_transmit_file (void)
{
@@ -200,6 +233,7 @@ ACE_WIN32_Proactor::create_asynch_transmit_file (void)
0);
return implementation;
}
+
ACE_Asynch_Read_Stream_Result_Impl *
ACE_WIN32_Proactor::create_asynch_read_stream_result
(const ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -224,6 +258,7 @@ ACE_WIN32_Proactor::create_asynch_read_stream_result
0);
return implementation;
}
+
ACE_Asynch_Write_Stream_Result_Impl *
ACE_WIN32_Proactor::create_asynch_write_stream_result
(const ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -248,6 +283,7 @@ ACE_WIN32_Proactor::create_asynch_write_stream_result
0);
return implementation;
}
+
ACE_Asynch_Read_File_Result_Impl *
ACE_WIN32_Proactor::create_asynch_read_file_result
(const ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -276,6 +312,7 @@ ACE_WIN32_Proactor::create_asynch_read_file_result
0);
return implementation;
}
+
ACE_Asynch_Write_File_Result_Impl *
ACE_WIN32_Proactor::create_asynch_write_file_result
(const ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -304,6 +341,7 @@ ACE_WIN32_Proactor::create_asynch_write_file_result
0);
return implementation;
}
+
ACE_Asynch_Read_Dgram_Result_Impl *
ACE_WIN32_Proactor::create_asynch_read_dgram_result
(const ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -332,6 +370,7 @@ ACE_WIN32_Proactor::create_asynch_read_dgram_result
0);
return implementation;
}
+
ACE_Asynch_Write_Dgram_Result_Impl *
ACE_WIN32_Proactor::create_asynch_write_dgram_result
(const ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -358,6 +397,7 @@ ACE_WIN32_Proactor::create_asynch_write_dgram_result
0);
return implementation;
}
+
ACE_Asynch_Accept_Result_Impl *
ACE_WIN32_Proactor::create_asynch_accept_result
(const ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -384,6 +424,7 @@ ACE_WIN32_Proactor::create_asynch_accept_result
0);
return implementation;
}
+
ACE_Asynch_Connect_Result_Impl *
ACE_WIN32_Proactor::create_asynch_connect_result
(const ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -404,6 +445,7 @@ ACE_WIN32_Proactor::create_asynch_connect_result
0);
return implementation;
}
+
ACE_Asynch_Transmit_File_Result_Impl *
ACE_WIN32_Proactor::create_asynch_transmit_file_result
(const ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -438,6 +480,7 @@ ACE_WIN32_Proactor::create_asynch_transmit_file_result
0);
return implementation;
}
+
ACE_Asynch_Result_Impl *
ACE_WIN32_Proactor::create_asynch_timer (const ACE_Handler::Proxy_Ptr &handler_proxy,
const void *act,
@@ -457,32 +500,40 @@ ACE_WIN32_Proactor::create_asynch_timer (const ACE_Handler::Proxy_Ptr &handler_p
0);
return implementation;
}
+
int
ACE_WIN32_Proactor::handle_signal (int, siginfo_t *, ucontext_t *)
{
// Perform a non-blocking "poll" for all the I/O events that have
// completed in the I/O completion queue.
+
int result = 0;
+
for (ACE_Time_Value timeout (0, 0);
;
)
{
result = this->handle_events (timeout);
+
if (result != 1)
break;
}
+
// If our handle_events failed, we'll report a failure to the
// Reactor.
return result == -1 ? -1 : 0;
}
+
int
ACE_WIN32_Proactor::handle_close (ACE_HANDLE handle,
ACE_Reactor_Mask close_mask)
{
ACE_UNUSED_ARG (close_mask);
ACE_UNUSED_ARG (handle);
+
return this->close ();
}
+
ACE_HANDLE
ACE_WIN32_Proactor::get_handle (void) const
{
@@ -491,6 +542,7 @@ ACE_WIN32_Proactor::get_handle (void) const
else
return 0;
}
+
int
ACE_WIN32_Proactor::handle_events (ACE_Time_Value &wait_time)
{
@@ -498,17 +550,20 @@ ACE_WIN32_Proactor::handle_events (ACE_Time_Value &wait_time)
ACE_Countdown_Time countdown (&wait_time);
return this->handle_events (wait_time.msec ());
}
+
int
ACE_WIN32_Proactor::handle_events (void)
{
return this->handle_events (ACE_INFINITE);
}
+
int
ACE_WIN32_Proactor::handle_events (unsigned long milli_seconds)
{
ACE_OVERLAPPED *overlapped = 0;
u_long bytes_transferred = 0;
ULONG_PTR completion_key = 0;
+
// Get the next asynchronous operation that completes
BOOL result = ::GetQueuedCompletionStatus (this->completion_port_,
&bytes_transferred,
@@ -518,16 +573,19 @@ ACE_WIN32_Proactor::handle_events (unsigned long milli_seconds)
if (result == FALSE && overlapped == 0)
{
ACE_OS::set_errno_to_last_error ();
+
switch (errno)
{
case WAIT_TIMEOUT:
errno = ETIME;
return 0;
+
case ERROR_SUCCESS:
// Calling GetQueuedCompletionStatus with timeout value 0
// returns FALSE with extended errno "ERROR_SUCCESS" errno =
// ETIME; ?? I don't know if this has to be done !!
return 0;
+
default:
if (ACE::debug ())
ACE_DEBUG ((LM_ERROR,
@@ -540,12 +598,15 @@ ACE_WIN32_Proactor::handle_events (unsigned long milli_seconds)
{
// Narrow the result.
ACE_WIN32_Asynch_Result *asynch_result = (ACE_WIN32_Asynch_Result *) overlapped;
+
// If errors happen, grab the error.
if (result == FALSE)
ACE_OS::set_errno_to_last_error ();
else
errno = 0;
+
u_long result_err = asynch_result->error ();
+
// if "result_err" is 0 than
// It is normal OS/WIN32 AIO completion.
// We have cleared asynch_result->error_
@@ -559,8 +620,10 @@ ACE_WIN32_Proactor::handle_events (unsigned long milli_seconds)
// it means we have "post_completed" result
// so pass this "result_err" code
// to the application_specific_code ()
+
if (result_err == 0)
result_err = errno ;
+
this->application_specific_code (asynch_result,
static_cast<size_t> (bytes_transferred),
(void *) completion_key,
@@ -568,6 +631,7 @@ ACE_WIN32_Proactor::handle_events (unsigned long milli_seconds)
}
return 1;
}
+
void
ACE_WIN32_Proactor::application_specific_code (ACE_WIN32_Asynch_Result *asynch_result,
size_t bytes_transferred,
@@ -588,18 +652,22 @@ ACE_WIN32_Proactor::application_specific_code (ACE_WIN32_Asynch_Result *asynch_r
delete asynch_result;
}
}
+
int
ACE_WIN32_Proactor::post_completion (ACE_WIN32_Asynch_Result *result)
{
// Grab the event associated with the Proactor
HANDLE handle = this->get_handle ();
+
// pass
// bytes_transferred
// completion_key
// to the ::PostQueuedCompletionStatus()
// error will be extracted later in handle_events()
+
DWORD bytes_transferred = 0;
const void * completion_key = 0 ;
+
if (result != 0)
{
// This cast is ok since the original API calls restricted the transfer
@@ -607,7 +675,9 @@ ACE_WIN32_Proactor::post_completion (ACE_WIN32_Asynch_Result *result)
bytes_transferred = static_cast<DWORD> (result->bytes_transferred ());
completion_key = result->completion_key();
}
+
ULONG_PTR comp_key (reinterpret_cast<ULONG_PTR> (completion_key));
+
// Post a completion
if (::PostQueuedCompletionStatus (this->completion_port_, // completion port
bytes_transferred, // xfer count
@@ -616,6 +686,7 @@ ACE_WIN32_Proactor::post_completion (ACE_WIN32_Asynch_Result *result)
) == FALSE)
{
delete result;
+
if (ACE::debug ())
{
ACE_DEBUG ((LM_ERROR,
@@ -624,47 +695,58 @@ ACE_WIN32_Proactor::post_completion (ACE_WIN32_Asynch_Result *result)
}
return -1;
}
+
// If Proactor event is valid, signal it
if (handle != ACE_INVALID_HANDLE
&& handle != 0)
ACE_OS::event_signal (&handle);
+
return 0;
}
+
int
ACE_WIN32_Proactor::post_wakeup_completions (int how_many)
{
ACE_WIN32_Wakeup_Completion *wakeup_completion = 0;
+
for (ssize_t ci = 0; ci < how_many; ci++)
{
ACE_NEW_RETURN
(wakeup_completion,
ACE_WIN32_Wakeup_Completion (this->wakeup_handler_.proxy ()),
-1);
+
if (wakeup_completion->post_completion (this) == -1)
return -1;
}
+
return 0;
}
+
int
ACE_WIN32_Proactor::wake_up_dispatch_threads (void)
{
return 0;
}
+
int
ACE_WIN32_Proactor::close_dispatch_threads (int)
{
return 0;
}
+
size_t
ACE_WIN32_Proactor::number_of_threads (void) const
{
return static_cast<size_t> (this->number_of_threads_);
}
+
void
ACE_WIN32_Proactor::number_of_threads (size_t threads)
{
this->number_of_threads_ = static_cast<DWORD> (threads);
}
+
ACE_WIN32_Asynch_Timer::ACE_WIN32_Asynch_Timer
(const ACE_Handler::Proxy_Ptr &handler_proxy,
const void *act,
@@ -678,6 +760,7 @@ ACE_WIN32_Asynch_Timer::ACE_WIN32_Asynch_Timer
time_ (tv)
{
}
+
void
ACE_WIN32_Asynch_Timer::complete (size_t,
int,
@@ -688,6 +771,7 @@ ACE_WIN32_Asynch_Timer::complete (size_t,
if (handler != 0)
handler->handle_time_out (this->time_, this->act ());
}
+
ACE_WIN32_Wakeup_Completion::ACE_WIN32_Wakeup_Completion
(ACE_Handler::Proxy_Ptr &handler_proxy,
const void *act,
@@ -699,9 +783,11 @@ ACE_WIN32_Wakeup_Completion::ACE_WIN32_Wakeup_Completion
(handler_proxy, act, event, 0, 0, priority, signal_number)
{
}
+
ACE_WIN32_Wakeup_Completion::~ACE_WIN32_Wakeup_Completion (void)
{
}
+
void
ACE_WIN32_Wakeup_Completion::complete (size_t /* bytes_transferred */,
int /* success */,
@@ -712,6 +798,8 @@ ACE_WIN32_Wakeup_Completion::complete (size_t /* bytes_transferred */,
if (handler != 0)
handler->handle_wakeup ();
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_WIN32 */
diff --git a/dep/ACE_wrappers/ace/WIN32_Proactor.h b/dep/ACE_wrappers/ace/WIN32_Proactor.h
index 3caccc45d95..1035021fb6d 100644
--- a/dep/ACE_wrappers/ace/WIN32_Proactor.h
+++ b/dep/ACE_wrappers/ace/WIN32_Proactor.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file WIN32_Proactor.h
@@ -12,24 +13,33 @@
* @author Alexander Libman <alibman@ihug.com.au>
*/
//=============================================================================
+
#ifndef ACE_WIN32_PROACTOR_H
#define ACE_WIN32_PROACTOR_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
#pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_WIN32) && defined (ACE_HAS_WIN32_OVERLAPPED_IO)
// WIN32 implementation of the Proactor.
+
#include "ace/WIN32_Asynch_IO.h"
#include "ace/Event_Handler.h"
+
#include "ace/Proactor_Impl.h"
#include "ace/Asynch_Pseudo_Task.h"
#include "ace/Auto_Event.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Forward declarations.
class ACE_WIN32_Asynch_Result;
class ACE_WIN32_Proactor_Timer_Handler;
+
/**
* @class ACE_WIN32_Proactor
*
@@ -42,18 +52,23 @@ class ACE_WIN32_Proactor_Timer_Handler;
class ACE_Export ACE_WIN32_Proactor : public ACE_Proactor_Impl
{
friend class ACE_WIN32_Asynch_Connect;
+
public:
/// A do nothing constructor.
ACE_WIN32_Proactor (size_t number_of_threads = 0,
bool used_with_reactor_event_loop = false);
+
/// Virtual destruction.
virtual ~ACE_WIN32_Proactor (void);
+
/// Close the IO completion port.
virtual int close (void);
+
/// This method adds the @a handle to the I/O completion port. This
/// function is a no-op function for Unix systems.
virtual int register_handle (ACE_HANDLE handle,
const void *completion_key);
+
/**
* Dispatch a single set of events. If @a wait_time elapses before
* any events occur, return 0. Return 1 on success i.e., when a
@@ -61,6 +76,7 @@ public:
* set accordingly.
*/
virtual int handle_events (ACE_Time_Value &wait_time);
+
/**
* Block indefinitely until at least one event is dispatched.
* Dispatch a single set of events. Return 1 on success i.e., when a
@@ -68,6 +84,7 @@ public:
* set accordingly.
*/
virtual int handle_events (void);
+
/**
* Post a result to the completion port of the Proactor. If errors
* occur, the result will be deleted by this method. If successful,
@@ -77,16 +94,22 @@ public:
* user once this method is called.
*/
virtual int post_completion (ACE_WIN32_Asynch_Result *result);
+
/// Add wakeup dispatch threads (reinit).
int wake_up_dispatch_threads (void);
+
/// Close all dispatch threads.
int close_dispatch_threads (int wait);
+
/// Get number of thread used as a parameter to @c CreateIoCompletionPort.
size_t number_of_threads (void) const;
+
/// Set number of thread used as a parameter to @c CreateIoCompletionPort.
void number_of_threads (size_t threads);
+
/// Get the event handle.
virtual ACE_HANDLE get_handle (void) const;
+
virtual ACE_Asynch_Read_Stream_Impl *create_asynch_read_stream (void);
virtual ACE_Asynch_Write_Stream_Impl *create_asynch_write_stream (void);
virtual ACE_Asynch_Read_File_Impl *create_asynch_read_file (void);
@@ -96,8 +119,10 @@ public:
virtual ACE_Asynch_Accept_Impl *create_asynch_accept (void);
virtual ACE_Asynch_Connect_Impl *create_asynch_connect (void);
virtual ACE_Asynch_Transmit_File_Impl *create_asynch_transmit_file (void);
+
// Methods used to create Asynch_IO_Result objects. We create the right
// objects here in these methods.
+
virtual ACE_Asynch_Read_Stream_Result_Impl *create_asynch_read_stream_result (const ACE_Handler::Proxy_Ptr &handler_proxy,
ACE_HANDLE handle,
ACE_Message_Block &message_block,
@@ -106,6 +131,7 @@ public:
ACE_HANDLE event,
int priority,
int signal_number = 0);
+
virtual ACE_Asynch_Write_Stream_Result_Impl *create_asynch_write_stream_result (const ACE_Handler::Proxy_Ptr &handler_proxy,
ACE_HANDLE handle,
ACE_Message_Block &message_block,
@@ -114,6 +140,7 @@ public:
ACE_HANDLE event,
int priority,
int signal_number = 0);
+
virtual ACE_Asynch_Read_File_Result_Impl *create_asynch_read_file_result (const ACE_Handler::Proxy_Ptr &handler_proxy,
ACE_HANDLE handle,
ACE_Message_Block &message_block,
@@ -124,6 +151,7 @@ public:
ACE_HANDLE event,
int priority,
int signal_number = 0);
+
virtual ACE_Asynch_Write_File_Result_Impl *create_asynch_write_file_result (const ACE_Handler::Proxy_Ptr &handler_proxy,
ACE_HANDLE handle,
ACE_Message_Block &message_block,
@@ -134,6 +162,7 @@ public:
ACE_HANDLE event,
int priority,
int signal_number = 0);
+
/// Create the correct implementation class for ACE_Asynch_Read_Dgram::Result.
virtual ACE_Asynch_Read_Dgram_Result_Impl *create_asynch_read_dgram_result (const ACE_Handler::Proxy_Ptr &handler_proxy,
ACE_HANDLE handle,
@@ -145,6 +174,7 @@ public:
ACE_HANDLE event,
int priority,
int signal_number = 0);
+
/// Create the correct implementation class for ACE_Asynch_Write_Dgram::Result.
virtual ACE_Asynch_Write_Dgram_Result_Impl *create_asynch_write_dgram_result (const ACE_Handler::Proxy_Ptr &handler_proxy,
ACE_HANDLE handle,
@@ -155,6 +185,7 @@ public:
ACE_HANDLE event,
int priority,
int signal_number = 0);
+
virtual ACE_Asynch_Accept_Result_Impl *create_asynch_accept_result (const ACE_Handler::Proxy_Ptr &handler_proxy,
ACE_HANDLE listen_handle,
ACE_HANDLE accept_handle,
@@ -164,6 +195,7 @@ public:
ACE_HANDLE event,
int priority,
int signal_number = 0);
+
virtual ACE_Asynch_Connect_Result_Impl *create_asynch_connect_result (const ACE_Handler::Proxy_Ptr &handler_proxy,
ACE_HANDLE connect_handle,
const void *act,
@@ -171,6 +203,7 @@ public:
int priority,
int signal_number = 0);
+
virtual ACE_Asynch_Transmit_File_Result_Impl *create_asynch_transmit_file_result (const ACE_Handler::Proxy_Ptr &handler_proxy,
ACE_HANDLE socket,
ACE_HANDLE file,
@@ -184,6 +217,7 @@ public:
ACE_HANDLE event,
int priority,
int signal_number = 0);
+
/// Create a timer result object which can be used with the Timer
/// mechanism of the Proactor.
virtual ACE_Asynch_Result_Impl *create_asynch_timer (const ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -192,52 +226,65 @@ public:
ACE_HANDLE event,
int priority,
int signal_number = 0);
+
protected:
/// Task to process pseudo-asynchronous operations
ACE_Asynch_Pseudo_Task & get_asynch_pseudo_task (void);
+
/// Called when object is signaled by OS (either via UNIX signals or
/// when a Win32 object becomes signaled).
virtual int handle_signal (int signum, siginfo_t * = 0, ucontext_t * = 0);
+
/// Called when object is removed from the ACE_Reactor.
virtual int handle_close (ACE_HANDLE handle,
ACE_Reactor_Mask close_mask);
+
/**
* Dispatch a single set of events. If @a milli_seconds elapses
* before any events occur, return 0. Return 1 if a completion is
* dispatched. Return -1 on errors.
*/
virtual int handle_events (unsigned long milli_seconds);
+
/// Protect against structured exceptions caused by user code when
/// dispatching handles.
void application_specific_code (ACE_WIN32_Asynch_Result *asynch_result,
size_t bytes_transferred,
const void *completion_key,
u_long error);
+
/**
* Post @a how_many completions to the completion port so that all
* threads can wake up. This is used in conjunction with the
* run_event_loop().
*/
virtual int post_wakeup_completions (int how_many);
+
/// Handle for the completion port. Unix doesnt have completion
/// ports.
ACE_HANDLE completion_port_;
+
/// This number is passed to the @c CreateIOCompletionPort system
/// call.
DWORD number_of_threads_;
+
/// This event is used in conjunction with Reactor when we try to
/// integrate the event loops of Reactor and the Proactor.
ACE_Auto_Event event_;
+
/// Flag that indicates whether we are used in conjunction with
/// Reactor.
bool const used_with_reactor_event_loop_;
+
/// Handler to handle the wakeups. This works in conjunction with the
/// ACE_Proactor::run_event_loop().
ACE_Handler wakeup_handler_;
+
/// Pseudo-task for asynch connect ( NT/2000)
/// In future should removed in XP with ConnectEx support
ACE_Asynch_Pseudo_Task pseudo_task_;
};
+
/**
* @class ACE_WIN32_Asynch_Timer
*
@@ -251,6 +298,7 @@ class ACE_WIN32_Asynch_Timer : public ACE_WIN32_Asynch_Result
/// The factory method for this class is with the POSIX_Proactor
/// class.
friend class ACE_WIN32_Proactor;
+
protected:
/// Constructor.
ACE_WIN32_Asynch_Timer (const ACE_Handler::Proxy_Ptr &handler_proxy,
@@ -259,15 +307,19 @@ protected:
ACE_HANDLE event = ACE_INVALID_HANDLE,
int priority = 0,
int signal_number = 0);
+
/// This method calls the @a handler's handle_timeout method.
virtual void complete (size_t bytes_transferred,
int success,
const void *completion_key,
u_long error = 0);
+
/// Time value requested by caller
ACE_Time_Value time_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_WIN32 */
#include /**/ "ace/post.h"
#endif /* ACE_PROACTOR_H */
diff --git a/dep/ACE_wrappers/ace/XML_Svc_Conf.cpp b/dep/ACE_wrappers/ace/XML_Svc_Conf.cpp
index 60633ccc59a..59d5649e508 100644
--- a/dep/ACE_wrappers/ace/XML_Svc_Conf.cpp
+++ b/dep/ACE_wrappers/ace/XML_Svc_Conf.cpp
@@ -1,10 +1,16 @@
// $Id: XML_Svc_Conf.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/XML_Svc_Conf.h"
+
#if (ACE_USES_CLASSIC_SVC_CONF == 0)
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_XML_Svc_Conf::~ACE_XML_Svc_Conf (void)
{
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_USES_CLASSIC_SVC_CONF == 0 */
diff --git a/dep/ACE_wrappers/ace/XML_Svc_Conf.h b/dep/ACE_wrappers/ace/XML_Svc_Conf.h
index cd76210dc0d..5455657ece2 100644
--- a/dep/ACE_wrappers/ace/XML_Svc_Conf.h
+++ b/dep/ACE_wrappers/ace/XML_Svc_Conf.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file XML_Svc_Conf.h
@@ -9,15 +10,22 @@
*/
//=============================================================================
+
#ifndef ACE_XML_SVC_CONF_H
#define ACE_XML_SVC_CONF_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/ACE_export.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if (ACE_USES_CLASSIC_SVC_CONF==0)
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_XML_Svc_Conf
*
@@ -35,16 +43,24 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
*
*
*/
+
class ACE_Export ACE_XML_Svc_Conf
{
public:
typedef ACE_XML_Svc_Conf *(*Factory)(void);
+
virtual ~ACE_XML_Svc_Conf (void) = 0;
+
virtual int parse_file (const ACE_TCHAR file[]) = 0;
+
virtual int parse_string (const ACE_TCHAR str[]) = 0;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_USES_CLASSIC_SVC_CONF == 0 */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_XML_SVC_CONF_H */
diff --git a/dep/ACE_wrappers/ace/XTI_ATM_Mcast.cpp b/dep/ACE_wrappers/ace/XTI_ATM_Mcast.cpp
index 2a7e8a335ae..ac3443ee8b5 100644
--- a/dep/ACE_wrappers/ace/XTI_ATM_Mcast.cpp
+++ b/dep/ACE_wrappers/ace/XTI_ATM_Mcast.cpp
@@ -1,12 +1,19 @@
// $Id: XTI_ATM_Mcast.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/XTI_ATM_Mcast.h"
+
ACE_RCSID(ace, XTI_ATM_Mcast, "$Id: XTI_ATM_Mcast.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if defined (ACE_HAS_XTI_ATM)
+
#if !defined (__ACE_INLINE__)
#include "ace/XTI_ATM_Mcast.inl"
#endif /* __ACE_INLINE__ */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_ALLOC_HOOK_DEFINE(ACE_XTI_ATM_Mcast)
+
void
ACE_XTI_ATM_Mcast::dump (void) const
{
@@ -14,11 +21,14 @@ ACE_XTI_ATM_Mcast::dump (void) const
ACE_TRACE ("ACE_XTI_ATM_Mcast::dump");
#endif /* ACE_HAS_DUMP */
}
+
ACE_XTI_ATM_Mcast::ACE_XTI_ATM_Mcast (void)
{
ACE_TRACE ("ACE_XTI_ATM_Mcast::ACE_XTI_ATM_Mcast");
}
+
// Add a leaf to the current connection (i.e., multicast).
+
int
ACE_XTI_ATM_Mcast::add_leaf (ACE_TLI_Stream &current_stream,
const ACE_Addr &remote_sap,
@@ -26,10 +36,12 @@ ACE_XTI_ATM_Mcast::add_leaf (ACE_TLI_Stream &current_stream,
ACE_Time_Value *timeout)
{
ACE_TRACE ("ACE_XTI_ATM_Mcast::add_leaf");
+
struct netbuf call_req;
memset(&call_req, 0, sizeof(call_req));
call_req.len = remote_sap.get_size ();
call_req.buf = (char *)remote_sap.get_addr ();
+
if (::t_addleaf(current_stream.get_handle(),
leaf_id,
&call_req) < 0)
@@ -49,8 +61,11 @@ ACE_XTI_ATM_Mcast::add_leaf (ACE_TLI_Stream &current_stream,
else
return -1;
}
+
return 0;
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_XTI_ATM */
diff --git a/dep/ACE_wrappers/ace/XTI_ATM_Mcast.h b/dep/ACE_wrappers/ace/XTI_ATM_Mcast.h
index 7327fca80ac..9cd01f8ac0b 100644
--- a/dep/ACE_wrappers/ace/XTI_ATM_Mcast.h
+++ b/dep/ACE_wrappers/ace/XTI_ATM_Mcast.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file XTI_ATM_Mcast.h
@@ -9,17 +10,24 @@
*/
//=============================================================================
+
#ifndef ACE_XTI_ATM_MCAST_H
#define ACE_XTI_ATM_MCAST_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
#pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_XTI_ATM)
+
#include "ace/TLI_Connector.h"
#include "ace/ATM_Addr.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_XTI_ATM_Mcast
*
@@ -32,6 +40,7 @@ public:
// = Initialization methods.
/// Default constructor.
ACE_XTI_ATM_Mcast (void);
+
/**
* Actively connect and produce a @a new_stream if things go well.
* The @a remote_sap is the address that we are trying to connect
@@ -59,6 +68,7 @@ public:
int rw_flag = 1,
struct netbuf *udata = 0,
struct netbuf *opt = 0);
+
/**
* Actively connect and produce a @a new_stream if things go well.
* The @a remote_sap is the address that we are trying to connect
@@ -86,6 +96,7 @@ public:
int rw_flag = 1,
struct netbuf *udata = 0,
struct netbuf *opt = 0);
+
/**
* Actively add a leaf to the currently connected stream (i.e.,
* multicast). The @a remote_sap is the address of the leaf that we
@@ -101,19 +112,27 @@ public:
const ACE_Addr &remote_sap,
ACE_INT32 leaf_id,
ACE_Time_Value *timeout = 0);
+
// = Meta-type info
typedef ACE_ATM_Addr PEER_ADDR;
typedef ACE_TLI_Stream PEER_STREAM;
+
/// Dump the state of an object.
void dump (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#if defined (__ACE_INLINE__)
#include "ace/XTI_ATM_Mcast.inl"
#endif /* __ACE_INLINE__ */
+
#endif /* ACE_HAS_XTI_ATM */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_XTI_ATM_MCAST_H */
diff --git a/dep/ACE_wrappers/ace/XTI_ATM_Mcast.inl b/dep/ACE_wrappers/ace/XTI_ATM_Mcast.inl
index aa5d9c3240f..b182bb41b20 100644
--- a/dep/ACE_wrappers/ace/XTI_ATM_Mcast.inl
+++ b/dep/ACE_wrappers/ace/XTI_ATM_Mcast.inl
@@ -1,7 +1,9 @@
// -*- C++ -*-
//
// $Id: XTI_ATM_Mcast.inl 80826 2008-03-04 14:51:23Z wotte $
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
ACE_INLINE
ACE_XTI_ATM_Mcast::ACE_XTI_ATM_Mcast (ACE_TLI_Stream &new_stream,
const ACE_Addr &remote_sap,
@@ -24,10 +26,12 @@ ACE_XTI_ATM_Mcast::ACE_XTI_ATM_Mcast (ACE_TLI_Stream &new_stream,
&& timeout != 0 && !(errno == EWOULDBLOCK || errno == ETIME))
ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ACE_TLI_Stream::ACE_TLI_Stream")));
}
+
// Connect the <new_stream> to the <remote_sap>, waiting up to
// <timeout> amount of time if necessary. This is simple a pass-
// through function to ACE_TLI_Connector::connect(). It is over-
// ridden to change the default device from TCP to XTI/ATM.
+
ACE_INLINE
int
ACE_XTI_ATM_Mcast::connect (ACE_TLI_Stream &new_stream,
@@ -57,4 +61,5 @@ ACE_XTI_ATM_Mcast::connect (ACE_TLI_Stream &new_stream,
udata,
opt);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/ace.rc b/dep/ACE_wrappers/ace/ace.rc
index 946f20c7c7c..54792491900 100644
--- a/dep/ACE_wrappers/ace/ace.rc
+++ b/dep/ACE_wrappers/ace/ace.rc
@@ -1,4 +1,5 @@
#include "Version.h"
+
1 VERSIONINFO
FILEVERSION ACE_MAJOR_VERSION,ACE_MINOR_VERSION,ACE_BETA_VERSION,0
PRODUCTVERSION ACE_MAJOR_VERSION,ACE_MINOR_VERSION,ACE_BETA_VERSION,0
@@ -27,6 +28,7 @@ BEGIN
VALUE "Translation", 0x409, 1200
END
END
+
/*
* The following resource is used by the ACE logger to write messages
* to the NT event log. If you are statically linking to the ACE
diff --git a/dep/ACE_wrappers/ace/ace_wchar.cpp b/dep/ACE_wrappers/ace/ace_wchar.cpp
index 4a006b50b24..4f7ca485585 100644
--- a/dep/ACE_wrappers/ace/ace_wchar.cpp
+++ b/dep/ACE_wrappers/ace/ace_wchar.cpp
@@ -1,13 +1,18 @@
// -*- C++ -*-
//
// $Id: ace_wchar.cpp 80826 2008-03-04 14:51:23Z wotte $
+
#include "ace/config-macros.h"
#include "ace/ace_wchar.h"
+
ACE_RCSID(ace, ace_wchar, "$Id: ace_wchar.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
#if defined(ACE_HAS_ICONV)
iconv_t ACE_Wide_To_Ascii::ACE_Wide_To_Ascii_iconv_env = 0;
iconv_t ACE_Ascii_To_Wide::ACE_Ascii_To_Wide_iconv_env = 0;
#endif
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/dep/ACE_wrappers/ace/ace_wchar.h b/dep/ACE_wrappers/ace/ace_wchar.h
index 0f399635d68..75afa83968b 100644
--- a/dep/ACE_wrappers/ace/ace_wchar.h
+++ b/dep/ACE_wrappers/ace/ace_wchar.h
@@ -1,4 +1,5 @@
//* -*- C++ -*- */
+
//=============================================================================
/**
* @file ace_wchar.h
@@ -8,12 +9,16 @@
* @author Darrell Brunsch <brunsch@uci.edu>
*/
//=============================================================================
+
#ifndef ACE_WCHAR_H
#define ACE_WCHAR_H
+
#include "ace/config-macros.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
// These macros have been deprecated and should be replaced by their
// ACE_TEXT_* equivalents. These macros are just hacks and may not
// completely provide the old functionality.
@@ -25,6 +30,7 @@
# if defined (ACE_HAS_UNICODE)
# define ACE_HAS_WCHAR
# endif /* ACE_HAS_UNICODE */
+
// These are defined to get older stuff to compile
// FUZZ: disable check_for_tchar
# define ASYS_TCHAR ACE_TCHAR
@@ -33,20 +39,25 @@
# define ASYS_MULTIBYTE_STRING ACE_TEXT_CHAR_TO_TCHAR
# define ASYS_WIDE_STRING ACE_TEXT_CHAR_TO_TCHAR
# define ACE_WIDE_STRING ACE_TEXT_CHAR_TO_TCHAR
+
# if defined (ACE_USES_WCHAR)
# define ASYS_ONLY_WIDE_STRING(STRING) STRING
# else /* ACE_USES_WCHAR */
# define ASYS_ONLY_WIDE_STRING(STRING) \
ACE_Ascii_To_Wide (STRING).wchar_rep ()
# endif /* ACE_USES_WCHAR */
+
# define ACE_TEXT_STRING ACE_TString
+
#endif /* ACE_LEGACY_MODE */
+
#if defined (ACE_HAS_XPG4_MULTIBYTE_CHAR)
# if !defined (ACE_HAS_WCHAR)
# define ACE_HAS_WCHAR
# endif
# include /**/ <wchar.h>
#endif /* ACE_HAS_XPG4_MULTIBYTE_CHAR */
+
#if defined (ACE_HAS_WCHAR)
# if defined (ACE_VXWORKS)
# include /**/ <types/vxTypes.h> /* For wchar_t */
@@ -71,16 +82,19 @@
# include /**/ <wchar.h>
# endif /* ACE_HAS_STANDARD_CPP_LIBRARY */
#endif /* ACE_HAS_WCHAR */
+
#if defined (ACE_HAS_ICONV)
# include /**/ <iconv.h>
# if !defined (ACE_MAX_ICONV_BUFFER)
# define ACE_MAX_ICONV_BUFFER 16*1024
# endif
#endif /* ACE_HAS_ICONV */
+
#if defined (ACE_USES_STD_NAMESPACE_FOR_STDC_LIB) && \
(ACE_USES_STD_NAMESPACE_FOR_STDC_LIB != 0)
using std::size_t;
#endif /* ACE_USES_STD_NAMESPACE_FOR_STDC_LIB */
+
// This makes the somewhat dubious assumption that if a platform lacks
// a native wchar_t type, then it will typedef it as unsigned short.
#if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_NATIVE_WCHAR_T)
@@ -88,11 +102,14 @@ using std::size_t;
# define ACE_WSTRING_HAS_USHORT_SUPPORT
# endif /* ACE_WSTRING_HAS_USHORT_SUPPORT */
#endif /* ACE_HAS_WCHAR && !ACE_LACKS_NATIVE_WCHAR_T */
+
// Set the default behaviour for ACE_TEXT_WIDE to use the L-prefix
#if !defined (ACE_USES_L_PREFIX)
# define ACE_USES_L_PREFIX 1
#endif /* ACE_USES_L_PREFIX */
+
// Define the unicode/wchar related macros correctly
+
# if !defined (ACE_TEXT_WIDE)
# if (ACE_USES_L_PREFIX == 1)
# define ACE_TEXT_WIDE_I(STRING) L##STRING
@@ -101,6 +118,7 @@ using std::size_t;
# endif /* ACE_USES_L_PREFIX */
# define ACE_TEXT_WIDE(STRING) ACE_TEXT_WIDE_I (STRING)
# endif /* ACE_TEXT_WIDE */
+
#if defined (ACE_USES_WCHAR)
typedef wchar_t ACE_TCHAR;
typedef char ACE_ANTI_TCHAR;
@@ -126,27 +144,36 @@ typedef wchar_t ACE_ANTI_TCHAR;
# define ACE_TEXT_WCHAR_TO_TCHAR(STRING) ACE_Wide_To_Ascii (STRING).char_rep ()
# define ACE_TEXT_ANTI_TO_TCHAR(STRING) ACE_Wide_To_Ascii (STRING).char_rep ()
#endif /* ACE_USES_WCHAR */
+
// The OS_String module defines some wide-char functions that are not
// universally available. In particular, they're not part of the
// XPG4 Worldwide Portability Interface wide-character string handling
// functions. So, if ACE_HAS_XPG4_MULTIBYTE_CHAR is defined, note that
// these functions are missing.
#if defined (ACE_HAS_XPG4_MULTIBYTE_CHAR)
+
# if !defined (ACE_LACKS_ITOW)
# define ACE_LACKS_ITOW
# endif
+
# if !defined (ACE_LACKS_WCSICMP)
# define ACE_LACKS_WCSICMP
# endif
+
# if !defined (ACE_LACKS_WCSNICMP)
# define ACE_LACKS_WCSNICMP
# endif
+
# if !defined (ACE_LACKS_WCSDUP)
# define ACE_LACKS_WCSDUP
# endif
+
#endif /* ACE_HAS_XPG4_MULTIBYTE_CHAR */
+
#if defined ACE_HAS_WCHAR
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class ACE_Wide_To_Ascii
*
@@ -161,23 +188,30 @@ class ACE_Wide_To_Ascii
public:
/// Ctor must take a wchar string.
ACE_Wide_To_Ascii (const wchar_t *s);
+
/// Dtor will free up the memory.
~ACE_Wide_To_Ascii (void);
+
/// Return the internal char* representation.
char *char_rep (void);
+
/// Converts an wchar_t string to ascii and returns a new string.
static char *convert (const wchar_t *wstr);
+
private:
/// Internal pointer to the converted string.
char *s_;
+
#if defined (ACE_HAS_ICONV)
static iconv_t ACE_Wide_To_Ascii_iconv_env;
#endif /* ACE_HAS_ICONV */
+
/// Disallow these operation.
ACE_Wide_To_Ascii (void);
ACE_Wide_To_Ascii (ACE_Wide_To_Ascii &);
ACE_Wide_To_Ascii& operator= (ACE_Wide_To_Ascii &);
};
+
/**
* @class ACE_Ascii_To_Wide
*
@@ -192,29 +226,39 @@ class ACE_Ascii_To_Wide
public:
/// Ctor must take a wchar string.
ACE_Ascii_To_Wide (const char *s);
+
/// Dtor will free up the memory.
~ACE_Ascii_To_Wide (void);
+
/// Return the internal wchar* representation.
wchar_t *wchar_rep (void);
+
/// Converts an char string to unicode/wide and returns a new string.
static wchar_t *convert (const char *str);
+
private:
/// Internal pointer to the converted string.
wchar_t *s_;
+
#if defined (ACE_HAS_ICONV)
static iconv_t ACE_Ascii_To_Wide_iconv_env;
#endif /* ACE_HAS_ICONV */
+
/// Disallow these operation.
ACE_Ascii_To_Wide (void);
ACE_Ascii_To_Wide (ACE_Ascii_To_Wide &);
ACE_Ascii_To_Wide operator= (ACE_Ascii_To_Wide &);
};
+
#if defined (ACE_LEGACY_MODE)
typedef ACE_Ascii_To_Wide ACE_OS_CString;
typedef ACE_Wide_To_Ascii ACE_OS_WString;
#endif /* ACE_LEGACY_MODE */
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_WCHAR */
+
#if defined (ACE_WIN32)
#if defined (ACE_USES_WCHAR)
#define ACE_LPSTR LPWSTR
@@ -223,6 +267,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
#define ACE_TEXT_WIN32_FIND_DATA WIN32_FIND_DATAW
#define ACE_TEXT_OSVERSIONINFO OSVERSIONINFOW
#define ACE_TEXT_EXPLICIT_ACCESS EXPLICIT_ACCESS_W
+
#define ACE_TEXT_CreateEvent ::CreateEventW
#define ACE_TEXT_CreateFile ::CreateFileW
#define ACE_TEXT_CreateFileMapping ::CreateFileMappingW
@@ -273,6 +318,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
#define ACE_TEXT_PdhExpandCounterPath ::PdhExpandCounterPathW
#define ACE_TEXT_PdhOpenQuery ::PdhOpenQueryW
#define ACE_TEXT_PdhAddCounter ::PdhAddCounterW
+
#else /* ACE_USES_WCHAR */
#define ACE_LPSTR LPSTR
#define ACE_TEXT_SERVICE_TABLE_ENTRY SERVICE_TABLE_ENTRYA
@@ -280,6 +326,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
#define ACE_TEXT_WIN32_FIND_DATA WIN32_FIND_DATAA
#define ACE_TEXT_OSVERSIONINFO OSVERSIONINFOA
#define ACE_TEXT_EXPLICIT_ACCESS EXPLICIT_ACCESS_A
+
#define ACE_TEXT_CreateEvent ::CreateEventA
#define ACE_TEXT_CreateFile ::CreateFileA
#define ACE_TEXT_CreateFileMapping ::CreateFileMappingA
@@ -332,6 +379,8 @@ ACE_END_VERSIONED_NAMESPACE_DECL
#define ACE_TEXT_PdhAddCounter ::PdhAddCounterA
#endif /* ACE_USES_WCHAR */
#endif /* ACE_WIN32 */
+
#include "ace/ace_wchar.inl"
+
#endif /* ACE_WCHAR_H */
diff --git a/dep/ACE_wrappers/ace/ace_wchar.inl b/dep/ACE_wrappers/ace/ace_wchar.inl
index b3e7078f458..744b44f5e73 100644
--- a/dep/ACE_wrappers/ace/ace_wchar.inl
+++ b/dep/ACE_wrappers/ace/ace_wchar.inl
@@ -1,29 +1,37 @@
// -*- C++ -*-
//
// $Id: ace_wchar.inl 80826 2008-03-04 14:51:23Z wotte $
+
// These are always inlined
// FUZZ: disable check_for_inline
+
#if defined (ACE_HAS_WCHAR)
+
#if !defined (ACE_WIN32)
# include /**/ <string.h> // Need to see strlen()
#endif /* ACE_WIN32 */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
inline
ACE_Wide_To_Ascii::~ACE_Wide_To_Ascii (void)
{
delete [] this->s_;
}
+
inline char *
ACE_Wide_To_Ascii::char_rep (void)
{
return this->s_;
}
+
inline char *
ACE_Wide_To_Ascii::convert (const wchar_t *wstr)
{
// Short circuit null pointer case
if (wstr == 0)
return 0;
+
# if defined (ACE_WIN32)
UINT const cp = GetACP (); // Codepage
int const len = ::WideCharToMultiByte (cp,
@@ -38,13 +46,16 @@ ACE_Wide_To_Ascii::convert (const wchar_t *wstr)
const wchar_t * wtemp = wstr;
while ((*wtemp) != 0) // Hopefully the string is null terminated!
++wtemp;
+
int const len = wtemp - wstr + 1;
# else /* ACE_WIN32 */
size_t const len = ::wcslen (wstr) + 1;
# endif /* ACE_WIN32 */
+
#if !defined (ACE_HAS_ICONV)
char *str = new char[len];
#endif
+
# if defined (ACE_WIN32)
::WideCharToMultiByte (cp, 0, wstr, -1, str, len, 0, 0);
# elif defined (ACE_VXWORKS)
@@ -55,6 +66,7 @@ ACE_Wide_To_Ascii::convert (const wchar_t *wstr)
size_t lenwi = len * sizeof(wchar_t);
char buf[ACE_MAX_ICONV_BUFFER];
char *stri = buf;
+
size_t hr = iconv (ACE_Wide_To_Ascii_iconv_env, (char**)&wstri, &lenwi, &stri, &lensi);
if ((hr==size_t(-1))||(lensi==ACE_MAX_ICONV_BUFFER))
{
@@ -64,6 +76,7 @@ ACE_Wide_To_Ascii::convert (const wchar_t *wstr)
wchar_t *t = const_cast <wchar_t *> (wstr);
str[i] = static_cast<char> (*(t + i));
}
+
return str;
}
char *str = new char[ACE_MAX_ICONV_BUFFER-lensi];
@@ -77,6 +90,7 @@ ACE_Wide_To_Ascii::convert (const wchar_t *wstr)
# endif /* ACE_WIN32 */
return str;
}
+
inline
ACE_Wide_To_Ascii::ACE_Wide_To_Ascii (const wchar_t *s)
{
@@ -88,31 +102,37 @@ ACE_Wide_To_Ascii::ACE_Wide_To_Ascii (const wchar_t *s)
#endif
s_ = ACE_Wide_To_Ascii::convert (s);
}
+
inline
ACE_Ascii_To_Wide::~ACE_Ascii_To_Wide (void)
{
delete [] this->s_;
}
+
inline wchar_t *
ACE_Ascii_To_Wide::wchar_rep (void)
{
return this->s_;
}
+
inline wchar_t *
ACE_Ascii_To_Wide::convert (const char *str)
{
// Short circuit null pointer case
if (str == 0)
return 0;
+
# if defined (ACE_WIN32)
UINT const cp = GetACP (); // Codepage
int const len = ::MultiByteToWideChar (cp, 0, str, -1, 0, 0);
# else /* ACE_WIN32 */
size_t const len = strlen (str) + 1;
# endif /* ACE_WIN32 */
+
#if !defined (ACE_HAS_ICONV)
wchar_t *wstr = new wchar_t[len];
#endif
+
# if defined (ACE_WIN32)
::MultiByteToWideChar (cp, 0, str, -1, wstr, len);
# elif defined (ACE_VXWORKS)
@@ -123,6 +143,7 @@ ACE_Ascii_To_Wide::convert (const char *str)
size_t lenwi = ACE_MAX_ICONV_BUFFER;
wchar_t buf[ACE_MAX_ICONV_BUFFER/sizeof(wchar_t)];
wchar_t *wstri=buf;
+
size_t hr=iconv(ACE_Ascii_To_Wide_iconv_env, &stri, &lensi, (char**)&wstri, &lenwi);
if((hr==size_t(-1))||(lenwi==ACE_MAX_ICONV_BUFFER)){
wchar_t *wstr=new wchar_t[len*sizeof(wchar_t)];
@@ -130,6 +151,7 @@ ACE_Ascii_To_Wide::convert (const char *str)
char *t = const_cast<char *> (str);
wstr[i] = static_cast<wchar_t> (*((unsigned char*)t + i));
}
+
return wstr;
}
wchar_t *wstr=new wchar_t[(ACE_MAX_ICONV_BUFFER-lenwi)/sizeof(wchar_t)];
@@ -143,6 +165,7 @@ ACE_Ascii_To_Wide::convert (const char *str)
# endif /* ACE_WIN32 */
return wstr;
}
+
inline
ACE_Ascii_To_Wide::ACE_Ascii_To_Wide (const char *s)
{
@@ -154,5 +177,7 @@ ACE_Ascii_To_Wide::ACE_Ascii_To_Wide (const char *s)
#endif
s_ = ACE_Ascii_To_Wide::convert (s);
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_WCHAR */
diff --git a/dep/ACE_wrappers/ace/checked_iterator.h b/dep/ACE_wrappers/ace/checked_iterator.h
index 5b9cacc8fe5..3f4c6c14a08 100644
--- a/dep/ACE_wrappers/ace/checked_iterator.h
+++ b/dep/ACE_wrappers/ace/checked_iterator.h
@@ -1,6 +1,8 @@
// -*- C++ -*-
+
#ifndef ACE_CHECKED_ITERATOR_H
#define ACE_CHECKED_ITERATOR_H
+
/**
* @file checked_iterator.h
*
@@ -29,10 +31,12 @@
*
* @author Ossama Othman
*/
+
# if defined (_MSC_VER) && (_MSC_FULL_VER >= 140050000)
// Checked iterators are currently only supported in MSVC++ 8 or better.
# include <iterator>
# endif /* _MSC_VER >= 1400 */
+
# if defined (_MSC_VER) && (_MSC_FULL_VER >= 140050000 && _MSC_FULL_VER < 160020506)
template <typename PTR>
stdext::checked_array_iterator<PTR>
@@ -50,5 +54,6 @@ ACE_make_checked_array_iterator (PTR buf, size_t /* len */)
return buf;
}
# endif /* _MSC_VER >= 1400 */
+
#endif /* ACE_CHECKED_ITERATOR_H */
diff --git a/dep/ACE_wrappers/ace/config-WinCE.h b/dep/ACE_wrappers/ace/config-WinCE.h
index 754899960eb..83db197b8e4 100644
--- a/dep/ACE_wrappers/ace/config-WinCE.h
+++ b/dep/ACE_wrappers/ace/config-WinCE.h
@@ -1,21 +1,28 @@
// $Id: config-WinCE.h 81693 2008-05-14 12:35:01Z johnnyw $
+
// Note: For WinCE build, simply use: #include "ace/config-win32.h"
// It is same as config.h for Windows NT/2k so that you can
// share same files and directories for both WinCE and NT/2k
// builds, unless you add additional definition(s) for each
// specific build or change the output directory.
+
#ifndef ACE_CONFIG_WINCE_H
#define ACE_CONFIG_WINCE_H
+
#include /**/ "ace/pre.h"
+
#ifndef ACE_CONFIG_WIN32_H
# error Use config-win32.h in config.h instead of this header
#endif // ACE_CONFIG_WIN32_H
+
#if !defined (UNDER_CE)
# error Define UNDER_CE to version (i.e. 300 = 3.0)
#endif // UNDER_CE
+
#if (UNDER_CE < 300)
# error ACE requires Windows CE 3.0 and later.
#endif // UNDER_CE
+
#if (UNDER_CE < 400)
// CE 3 doesn't have Winsock 2, but CE 4 does.
# if !defined (ACE_HAS_WINSOCK2)
@@ -28,9 +35,11 @@
# define ACE_LACKS_STDDEF_H
# define ACE_LACKS_PTRDIFF_T
#endif /* UNDER_CE < 400 */
+
#if !defined (ACE_HAS_WINCE)
# define ACE_HAS_WINCE 1
#endif
+
#if defined (_MSC_VER) && (_MSC_VER < 1400)
// WinCE prior to Visual Studio 2005 integration doesn't have most of
// the standard C library time functions. It also doesn't define struct tm.
@@ -39,18 +48,22 @@
// from the standard C library.
# define ACE_LACKS_STRUCT_TM
#endif
+
// We need these libraries to build:
#pragma comment(lib,"corelibc.lib")
#pragma comment(linker, "/nodefaultlib:oldnames.lib")
+
// Only DLL version is supported on CE.
//#if defined (ACE_HAS_DLL)
//# undef ACE_HAS_DLL
//#endif // ACE_HAS_DLL
//#define ACE_HAS_DLL 1
+
// Need to define LD search path explicitly on CE because
// CE doesn't have environment variables and we can't get
// the information using getenv.
#define ACE_DEFAULT_LD_SEARCH_PATH ACE_TEXT (".\\;\\windows")
+
#define ACE_LACKS_FCNTL_H
#define ACE_LACKS_SYS_TYPES_H
#define ACE_LACKS_GETCWD
@@ -67,57 +80,77 @@
#define ACE_LACKS_GETPROCESSTIMES
#define ACE_LACKS_PDH_H
#define ACE_LACKS_PDHMSG_H
+
#define ACE_HAS_POSITION_INDEPENDENT_POINTERS 1
+
#define ACE_LACKS_MSG_WFMO
#define ACE_LACKS_UMASK
+
// WinCE only supports the UNICODE API
#if !defined (ACE_USES_WCHAR)
# define ACE_USES_WCHAR
#endif /* ACE_USES_WCHAR */
+
#define ACE_USES_WINCE_SEMA_SIMULATION
+
#define ACE_HAS_NONSTATIC_OBJECT_MANAGER 1
+
// FILE stuff isn't always defined in CE
#if (_MSC_VER < 1400) && !defined (_FILE_DEFINED)
typedef void FILE;
# define _FILE_DEFINED
#endif /* _MSC_VER < 1400 && !_FILE_DEFINED */
+
// This was defined in previous versions of CE, but not 2.11
#define EXCEPTION_ACCESS_VIOLATION STATUS_ACCESS_VIOLATION
+
#define ACE_MAIN WINAPI WinMain
+
// SH3 cross-compiler can't handle inline functions correctly
// (along with other bugs.)
#if defined (SH3)
# define ACE_LACKS_INLINE_FUNCTIONS
#endif // SH3 && _DEBUG
+
#ifndef ACE_DEFAULT_SERVER_HOST
# define ACE_DEFAULT_SERVER_HOST ACE_TEXT("localhost")
#endif // ACE_DEFAULT_SERVER_HOST
+
// @@ Need to remap every function that uses any of these flags to
// Win32 API. These are for ANSI styled function and are not
// available on WinCE.
+
#define _O_RDONLY 0x0000 // open for reading only
#define _O_WRONLY 0x0001 // open for writing only
#define _O_RDWR 0x0002 // open for reading and writing
#define _O_APPEND 0x0008 // writes done at eof
+
#define _O_CREAT 0x0100 // create and open file
#define _O_TRUNC 0x0200 // open and truncate
#define _O_EXCL 0x0400 // open only if file doesn't already exist
+
// O_TEXT files have <cr><lf> sequences translated to <lf> on read()'s,
// and <lf> sequences translated to <cr><lf> on write()'s
#define _O_TEXT 0x4000 // file mode is text (translated)
#define _O_BINARY 0x8000 // file mode is binary (untranslated)
+
// macro to translate the C 2.0 name used to force binary mode for files
//#define _O_RAW _O_BINARY
+
// Open handle inherit bit
//#define _O_NOINHERIT 0x0080 // child process doesn't inherit file
+
// Temporary file bit - file is deleted when last handle is closed
#define _O_TEMPORARY 0x0040 // temporary file bit
+
// temporary access hint
//#define _O_SHORT_LIVED 0x1000 // temporary storage file, try not to flush
+
// sequential/random access hints
//#define _O_SEQUENTIAL 0x0020 // file access is primarily sequential
//#define _O_RANDOM 0x0010 // file access is primarily random
+
// Non-ANSI names
#define O_RDONLY _O_RDONLY
#define O_WRONLY _O_WRONLY
@@ -134,13 +167,16 @@
//#define O_SEQUENTIAL _O_SEQUENTIAL
//#define O_RANDOM _O_RANDOM
+
// @@ NSIG value. This is definitely not correct.
#define NSIG 23
+
// @@ For some reason, WinCE forgot to define this.
// Need to find out what it is. (Used in MapViewOfFile ().)
#define FILE_MAP_COPY 0
+
#define ACE_LACKS_STRCASECMP // WinCE doesn't support _stricmp
#define ACE_LACKS_GETSERVBYNAME
#define ACE_LACKS_ACCESS
@@ -155,6 +191,7 @@
#define ACE_LACKS_SYSTEM
#define ACE_LACKS_SIGACTION
#define ACE_LACKS_PIPE
+
//#define ACE_LACKS_CUSERID
//#define ACE_LACKS_CHDIR
#define ACE_LACKS_ENV
@@ -165,29 +202,40 @@
#define ACE_LACKS_TEMPNAM
#define ACE_LACKS_GETPROTOBYNUMBER
#define ACE_LACKS_GETPROTOBYNAME
+
#if defined (_WIN32_WCE_EMULATION)
// @@ For some reason, qsort isn't defined correctly (_stdcall vs _cdecl)
// under emulation. So for right now, exclude it.
# define ACE_LACKS_QSORT
#endif // _WIN32_WCE_EMULATION
+
#if !defined (BUFSIZ)
# define BUFSIZ 1024
#endif
+
typedef void (__cdecl * __sighandler_t)(int); // keep Signal compilation happy
typedef long off_t;
+
#define ACE_LACKS_MALLOC_H // We do have malloc.h, but don't use it.
+
#define ACE_HAS_WINCE_BROKEN_ERRNO
+
#define ACE_HAS_STRDUP_EMULATION
+
// WinCE can't do fixed addresses for memory-mapped files.
#if defined (ACE_DEFAULT_BASE_ADDR)
# undef ACE_DEFAULT_BASE_ADDR
#endif
#define ACE_DEFAULT_BASE_ADDR 0
+
#define ACE_HAS_TSS_EMULATION
+
// This is still true up thru VC8...
#define ACE_LACKS_ERRNO_H
#define ACE_LACKS_SIGNAL_H
#define ACE_LACKS_SYS_STAT_H
+
#include /**/ "ace/post.h"
+
#endif // ACE_CONFIG_WINCE_H
diff --git a/dep/ACE_wrappers/ace/config-aix-5.x.h b/dep/ACE_wrappers/ace/config-aix-5.x.h
index b0955aa2107..5c1972b5675 100644
--- a/dep/ACE_wrappers/ace/config-aix-5.x.h
+++ b/dep/ACE_wrappers/ace/config-aix-5.x.h
@@ -1,8 +1,10 @@
// $Id: config-aix-5.x.h 80826 2008-03-04 14:51:23Z wotte $
//
// Config file for AIX 5.1 and higher.
+
#ifndef ACE_CONFIG_AIX_5_X_H
#define ACE_CONFIG_AIX_5_X_H
+
// This define is needed for building with Visual Age C++ 5 in incremental
// mode. In the batch mode build, platform_aix_ibm.GNU sets it. The incremental
// mode compiler won't be supported after ACE 5.3, so this will also go away
@@ -10,6 +12,7 @@
#if !defined (ACE_AIX_VERS)
# define ACE_AIX_VERS 501
#endif
+
// AIX 5.1 has AIO, but it doesn't have the same API as other POSIX
// systems, and the semantics of operations are a bit different. Will take
// some real work to get this going.
@@ -23,6 +26,7 @@
#if !defined (ACE_HAS_AIO_CALLS)
# define _ACE_DISABLE_AIO_CALLS_
#endif
+
// Both IBM and g++ compilers set _THREAD_SAFE if compiler is asked to compile
// threaded code (xlC_r, as opposed to xlC; and g++ -pthread)
#if !defined (ACE_MT_SAFE) || (ACE_MT_SAFE != 0)
@@ -35,26 +39,32 @@
// # define ACE_HAS_THREADS 0
# endif /* _THREAD_SAFE */
#endif /* !ACE_MT_SAFE || (ACE_MT_SAFE != 0) */
+
#if defined (__xlC__) || defined (__IBMCPP__)
// AIX xlC, IBM C/C++, and Visual Age C++ compilers
//********************************************************************
//
+
// Compiler does this with a builtin - it's not in libc.
// Although ACE does have alloca() on this compiler/platform combination, it is
// disabled by default since it can be dangerous. Uncomment the following line
// if you ACE to use it.
//# define ACE_HAS_ALLOCA
+
// Compiler supports the ssize_t typedef.
# define ACE_HAS_SSIZE_T
+
// Keep an eye on this as the compiler and standards converge...
# define ACE_LACKS_LINEBUFFERED_STREAMBUF
# define ACE_LACKS_PRAGMA_ONCE
+
// C Set++ 3.1, IBM C/C++ 3.6, and Visual Age C++ 5 batch (__xlC__)
# if defined (__xlC__)
# if (__xlC__ < 0x0500)
# define ACE_LACKS_PLACEMENT_OPERATOR_DELETE
# endif /* __xlC__ < 0x0500 */
# endif
+
// These are for Visual Age C++ only
# if defined (__IBMCPP__) && (__IBMCPP__ >= 600)
# define ACE_EXPLICIT_TEMPLATE_DESTRUCTOR_TAKES_ARGS
@@ -71,10 +81,12 @@
# define ACE_TEMPLATES_REQUIRE_SOURCE
# endif
# endif /* __TEMPINC__ */
+
# undef WIFEXITED
# undef WEXITSTATUS
# define ACE_HAS_STANDARD_CPP_LIBRARY 1
# define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1
+
# if (__IBMCPP__ >= 600) /* Visual Age 6 and XL C/C++ 7 and up */
# define ACE_HAS_TEMPLATE_TYPEDEFS
# define ACE_HAS_CUSTOM_EXPORT_MACROS
@@ -83,116 +95,157 @@
# define ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) extern template class SINGLETON_TYPE < CLASS, LOCK >;
# endif /* __IBMCPP__ >= 600 */
# endif /* __IBMCPP__ */
+
#elif defined (__GNUG__)
// config-g++-common.h undef's ACE_HAS_STRING_CLASS with -frepo, so
// this must appear before its #include.
# define ACE_HAS_STRING_CLASS
+
# include "ace/config-g++-common.h"
// Denotes that GNU has cstring.h as standard, to redefine memchr().
# define ACE_HAS_GNU_CSTRING_H
# define ACE_HAS_SSIZE_T
+
# if (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ == 0))
// We have to explicitly instantiate static template members prior to g++ 4.1
# define ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION
#endif /* g++ prior to 4.1 */
+
# if !defined (ACE_MT_SAFE) || ACE_MT_SAFE != 0
// ACE_MT_SAFE is #defined below, for all compilers.
# if !defined (_REENTRANT)
# define _REENTRANT
# endif /* _REENTRANT */
# endif /* !ACE_MT_SAFE */
+
#else /* ! __xlC__ && ! __GNUG__ */
# ifdef __cplusplus /* Let it slide for C compilers. */
# error unsupported compiler in ace/config-aix-5.x.h
# endif /* __cplusplus */
#endif /* ! __xlC__ && ! __GNUG__ */
+
// Compiling for AIX.
#ifndef AIX
# define AIX
#endif /* AIX */
+
// Pick up all the detectable settings.
#include "ace/config-posix.h"
+
// Regardless of what config-posix.h may indicate, AIX 5.3 is the first
// to support sem_timedwait(). Prior to that, use the emulation.
#if defined (ACE_HAS_POSIX_SEM_TIMEOUT) && \
(defined (ACE_AIX_VERS) && (ACE_AIX_VERS < 503))
# undef ACE_HAS_POSIX_SEM_TIMEOUT
#endif /* ACE_HAS_POSIX_SEM_TIMEOUT && ACE_AIX_VERS < 503 */
+
#if defined (ACE_DLL_SUFFIX)
# undef ACE_DLL_SUFFIX
#endif
#define ACE_DLL_SUFFIX ".so"
+
#define ACE_DEFAULT_BASE_ADDR ((char *) 0x80000000)
+
#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R
+
#define ACE_HAS_SOCKLEN_T
#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG
+
// AIX has AIO, but the functions don't match those of other AIO-enabled
// platforms. If this is to work, it'll require some significant work,
// maybe moving the OS-abstraction stuff to an OS_AIO or some such thing.
//# define ACE_HAS_AIO_CALLS
+
#define ACE_HAS_AIX_HI_RES_TIMER
+
// Compiler/platform has correctly prototyped header files.
#define ACE_HAS_CPLUSPLUS_HEADERS
+
// Prototypes for both signal() and struct sigaction are consistent.
#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES
+
// OS has readdir and friends.
#define ACE_HAS_DIRENT
+
// OS supports the getrusage() system call
#define ACE_HAS_GETRUSAGE
+
#define ACE_HAS_GPERF
+
#define ACE_HAS_H_ERRNO
+
#define ACE_LACKS_STDINT_H
#define ACE_LACKS_SYS_SYSCTL_H
+
#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT
#define ACE_HAS_NONCONST_SELECT_TIMEVAL
#define ACE_HAS_IP_MULTICAST
+
// Lacks perfect filtering, must bind group address.
#if !defined ACE_LACKS_PERFECT_MULTICAST_FILTERING
# define ACE_LACKS_PERFECT_MULTICAST_FILTERING 1
#endif /* ACE_LACKS_PERFECT_MULTICAST_FILTERING */
+
#define ACE_HAS_MSG
+
// Compiler/platform supports poll().
#define ACE_HAS_POLL
+
// Platform supports POSIX O_NONBLOCK semantics.
#define ACE_HAS_POSIX_NONBLOCK
+
#define ACE_HAS_POSIX_TIME
// ... but needs to include another header for it on 4.2+
# define ACE_HAS_BROKEN_POSIX_TIME
// ... and needs another typedef
#define ACE_LACKS_TIMESPEC_T
#define ACE_HAS_SELECT_H
+
#define ACE_HAS_REENTRANT_FUNCTIONS
+
// Compiler/platform defines the sig_atomic_t typedef
#define ACE_HAS_SIG_ATOMIC_T
#define ACE_HAS_SIGINFO_T
#define ACE_LACKS_SIGINFO_H
#define ACE_HAS_P_READ_WRITE
+
#define ACE_HAS_SIGWAIT
#define ACE_HAS_SOCKADDR_IN_SIN_LEN
#define ACE_HAS_STRBUF_T
+
// Compiler supports stropts.h
#define ACE_HAS_STREAMS
// #define ACE_HAS_STREAM_PIPES
+
// Compiler/platform supports strerror ().
#define ACE_HAS_STRERROR
+
// AIX bzero()
#define ACE_HAS_STRINGS
+
#define ACE_HAS_STRUCT_NETDB_DATA
+
// Dynamic linking is in good shape on newer OS/patch levels. If you have
// trouble with the dynamic linking parts of ACE, and can't patch your OS
// up to latest levels, comment this out.
#define ACE_HAS_SVR4_DYNAMIC_LINKING
// This is tightly related to dynamic linking...
#define ACE_HAS_AUTOMATIC_INIT_FINI
+
#define ACE_HAS_SVR4_GETTIMEOFDAY
+
#define ACE_HAS_SYSV_IPC
#define ACE_HAS_TIMOD_H
#define ACE_HAS_XTI
#define ACE_HAS_BROKEN_T_ERROR
#define ACE_TLI_TCP_DEVICE "/dev/xti/tcp"
+
#define ACE_HAS_UALARM
+
#define ACE_HAS_UCONTEXT_T
+
#define ACE_HAS_UTIME
+
// Platform has XPG4 wide character type and functions. However, the size
// of wchar_t changes for 32- vs. 64-bit builds (unsigned short vs. unsigned
// int, respectively).
@@ -202,11 +255,15 @@
#else
# define ACE_SIZEOF_WCHAR 2
#endif /* __64BIT__ */
+
#define ACE_LACKS_NETINET_TCP_H
+
// AIX uses LIBPATH to search for libraries
#define ACE_LD_SEARCH_PATH "LIBPATH"
+
// Defines the page size of the system.
#define ACE_PAGE_SIZE 4096
+
//**************************************************************
//
// Threads related definitions.
@@ -217,10 +274,12 @@
// pthread_t, and can't derive one from the other - thread_self() gets
// the tid_t (kernel thread ID) if called from a thread.
// Thanks very much to Chris Lahey for straightening this out.
+
#if defined (ACE_HAS_THREADS)
# if !defined (ACE_MT_SAFE)
# define ACE_MT_SAFE 1
# endif
+
# define ACE_HAS_PTHREADS
# define ACE_HAS_PTHREADS_UNIX98_EXT
# define ACE_HAS_PTHREAD_CONTINUE_NP
@@ -229,20 +288,25 @@
# define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS
# define ACE_HAS_SIGTHREADMASK
# define ACE_HAS_THREAD_SPECIFIC_STORAGE
+
# define ACE_LACKS_THREAD_PROCESS_SCOPING
#else
# undef ACE_HAS_THREADS
#endif /* ACE_HAS_THREADS != 0 */
+
#define ACE_MALLOC_ALIGN 8
+
#if (defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) >= 500) && !defined(_UNIX95)
# define ACE_HAS_3_PARAM_WCSTOK
#endif /* (_XOPEN_SOURCE -0) >= 500 && !_UNIX95 */
+
#if defined (_ACE_DISABLE_AIO_CALLS_)
# if defined (ACE_HAS_AIO_CALLS)
# undef ACE_HAS_AIO_CALLS
# endif
# undef _ACE_DISABLE_AIO_CALLS_
#endif
+
// AIX's /usr/include/unistd.h sets _POSIX_SEMAPHORE to indicate the system
// supplies such a facility, but the headers don't enable it unless
// _XOPEN_SOURCE >= 500. So disable semaphores here if _XOPEN_SOURCE isn't
@@ -251,10 +315,13 @@
(!defined (_XOPEN_SOURCE) || (_XOPEN_SOURCE-0 < 500))
# undef ACE_HAS_POSIX_SEM
#endif
+
// I think this is correct, but needs to be verified... -Steve Huston
#define ACE_HAS_SIGTIMEDWAIT
+
// AIX 5.1 has netinet/tcp.h
#undef ACE_LACKS_NETINET_TCP_H
+
#define ACE_HAS_3_PARAM_READDIR_R
#define ACE_HAS_POSIX_GETPWNAM_R
#define ACE_HAS_SCANDIR
@@ -262,5 +329,6 @@
#define ACE_SCANDIR_SEL_LACKS_CONST
#define ACE_HAS_SIGSUSPEND
#define ACE_HAS_TIMEZONE /* Call tzset() to set timezone */
+
#endif /* ACE_CONFIG_AIX_5_X_H */
diff --git a/dep/ACE_wrappers/ace/config-all.h b/dep/ACE_wrappers/ace/config-all.h
index 781a5c9fba1..927bd14919b 100644
--- a/dep/ACE_wrappers/ace/config-all.h
+++ b/dep/ACE_wrappers/ace/config-all.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file config-all.h
@@ -10,13 +11,18 @@
* @author and a cast of thousands...
*/
//==========================================================================
+
#ifndef ACE_CONFIG_ALL_H
#define ACE_CONFIG_ALL_H
+
#include /**/ "ace/pre.h"
+
#include "ace/config-lite.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
// This is used to indicate that a platform doesn't support a
// particular feature.
#if defined ACE_HAS_VERBOSE_NOTSUP
@@ -29,12 +35,16 @@
# define ACE_NOTSUP_RETURN(FAILVALUE) do { errno = ENOTSUP ; return FAILVALUE; } while (0)
# define ACE_NOTSUP do { errno = ENOTSUP; return; } while (0)
#endif /* ! ACE_HAS_VERBOSE_NOTSUP */
+
// ----------------------------------------------------------------
+
# define ACE_TRACE_IMPL(X) ACE_Trace ____ (ACE_TEXT (X), __LINE__, ACE_TEXT (__FILE__))
+
// By default tracing is turned off.
#if !defined (ACE_NTRACE)
# define ACE_NTRACE 1
#endif /* ACE_NTRACE */
+
#if (ACE_NTRACE == 1)
# define ACE_TRACE(X)
#else
@@ -44,12 +54,14 @@
# define ACE_TRACE(X) ACE_TRACE_IMPL(X)
# include "ace/Trace.h"
#endif /* ACE_NTRACE */
+
// By default we perform no tracing on the OS layer, otherwise the
// coupling between the OS layer and Log_Msg is too tight. But the
// application can override the default if they wish to.
#if !defined (ACE_OS_NTRACE)
# define ACE_OS_NTRACE 1
#endif /* ACE_OS_NTRACE */
+
#if (ACE_OS_NTRACE == 1)
# define ACE_OS_TRACE(X)
#else
@@ -59,15 +71,20 @@
# define ACE_OS_TRACE(X) ACE_TRACE_IMPL(X)
# include "ace/Trace.h"
#endif /* ACE_OS_NTRACE */
+
#if !defined (ACE_HAS_MONITOR_FRAMEWORK)
# define ACE_HAS_MONITOR_FRAMEWORK 1
#endif
+
#if !defined (ACE_HAS_MONITOR_POINTS)
# define ACE_HAS_MONITOR_POINTS 0
#endif
+
// These includes are here to avoid circular dependencies.
// Keep this at the bottom of the file. It contains the main macros.
#include "ace/OS_main.h"
+
#include /**/ "ace/post.h"
+
#endif /* ACE_CONFIG_ALL_H */
diff --git a/dep/ACE_wrappers/ace/config-borland-common.h b/dep/ACE_wrappers/ace/config-borland-common.h
index 25b84bc4be8..5c80c872ad7 100644
--- a/dep/ACE_wrappers/ace/config-borland-common.h
+++ b/dep/ACE_wrappers/ace/config-borland-common.h
@@ -1,9 +1,12 @@
// -*- C++ -*-
//$Id: config-borland-common.h 82294 2008-07-12 13:03:37Z johnnyw $
+
// The following configuration file contains defines for Borland compilers.
+
#ifndef ACE_CONFIG_BORLAND_COMMON_H
#define ACE_CONFIG_BORLAND_COMMON_H
#include /**/ "ace/pre.h"
+
#define ACE_HAS_CUSTOM_EXPORT_MACROS
#define ACE_Proper_Export_Flag __declspec (dllexport)
#define ACE_Proper_Import_Flag __declspec (dllimport)
@@ -11,6 +14,7 @@
#define ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) template class __declspec (dllexport) SINGLETON_TYPE<CLASS, LOCK>;
#define ACE_IMPORT_SINGLETON_DECLARATION(T) template class __declspec (dllimport) T
#define ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) template class __declspec (dllimport) SINGLETON_TYPE <CLASS, LOCK>;
+
// In later versions of C++Builder we will prefer inline functions by
// default. The debug configuration of ACE is built with functions
// out-of-line, so when linking your application against a debug ACE
@@ -19,13 +23,16 @@
# if !defined (__ACE_INLINE__)
# define __ACE_INLINE__ 1
# endif /* __ACE_INLINE__ */
+
# define ACE_CC_NAME ACE_TEXT ("Borland C++ Builder")
# define ACE_CC_MAJOR_VERSION (__BORLANDC__ / 0x100)
# define ACE_CC_MINOR_VERSION (__BORLANDC__ % 0x100)
# define ACE_CC_BETA_VERSION (0)
+
# ifndef ACE_USING_MCPP_PREPROCESSOR
# define ACE_CC_PREPROCESSOR_ARGS "-q -P- -o%s"
# endif
+
# define ACE_EXPORT_NESTED_CLASSES 1
# define ACE_HAS_CPLUSPLUS_HEADERS 1
# define ACE_HAS_EXCEPTIONS
@@ -54,6 +61,7 @@
# define ACE_USES_STD_NAMESPACE_FOR_STDC_LIB 0
# define ACE_ENDTHREADEX(STATUS) ::_endthreadex ((DWORD) STATUS)
# define ACE_LACKS_SWAB
+
#include /**/ "ace/post.h"
#endif /* ACE_CONFIG_BORLAND_COMMON_H */
diff --git a/dep/ACE_wrappers/ace/config-cray.h b/dep/ACE_wrappers/ace/config-cray.h
index 825642c408c..87fe263503d 100644
--- a/dep/ACE_wrappers/ace/config-cray.h
+++ b/dep/ACE_wrappers/ace/config-cray.h
@@ -1,8 +1,10 @@
/* -*- C++ -*- */
// $Id: config-cray.h 81935 2008-06-12 22:01:53Z jtc $
+
#ifndef ACE_CONFIG_CRAY_H
#define ACE_CONFIG_CRAY_H
#include /**/ "ace/pre.h"
+
/*
The following predefined macros are used within ACE ifdefs.
These are defined when using the Cray compilers. _CRAYMPP
@@ -10,63 +12,105 @@
massively parallel machine. Moreover, in the case of the T3E,
_CRAYT3E will be defined. This is used to determine the
ACE_SIZEOF defines for primitive types.
+
_UNICOS is defined as either the major version of UNICOS being run,
e.g. 9 or 10 on the vector machines (e.g. C90, T90, J90, YMP, ...)
or the major+minor+level UNICOS/mk version, e.g. 2.0.3 => 203,
being run on an MPP machine.
+
Summary:
+
_CRAYMPP (defined only if running on MPP machine, e.g. T3E, UNICOS/mk)
_CRAYT3E (defined specifically if compiling on a Cray T3E)
_UNICOS (defined if running UNICOS or UNICOS/mk)
+
Tested on UNICOS 10.0.0.5, UNICOS/mk 2.0.4.57
Compiles on UNICOS 9.0.2.8, but some tests deadlock
+
Contributed by Doug Anderson <dla@home.com>
*/
+
#if defined (_UNICOS) && !defined (MAXPATHLEN)
#define MAXPATHLEN 1023
#endif /* _UNICOS */
+
#define ACE_DEFAULT_CLOSE_ALL_HANDLES 0
+
// Defines the page size of the system.
#define ACE_PAGE_SIZE 4096
+
#define ACE_HAS_CPLUSPLUS_HEADERS
+
#define ACE_HAS_SSIZE_T
+
#define ACE_HAS_SYSV_IPC
+
#define ACE_MT_SAFE 1
+
#define ACE_HAS_THREADS
+
#define ACE_HAS_PTHREADS
+
#define ACE_HAS_THREAD_SPECIFIC_STORAGE
+
#define ACE_HAS_PTHREAD_MUTEXATTR_SETKIND_NP
+
#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R
+
#define ACE_HAS_POSIX_TIME
+
#define ACE_HAS_TIMEZONE_GETTIMEOFDAY
+
#define ACE_HAS_POSIX_NONBLOCK
+
// Platform has POSIX terminal interface.
#define ACE_HAS_TERMIOS
+
#define ACE_HAS_DIRENT
+
#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT
+
#define ACE_HAS_IP_MULTICAST
+
#define ACE_HAS_SOCKADDR_IN_SIN_LEN
+
#define ACE_HAS_NONCONST_SELECT_TIMEVAL
+
#define ACE_HAS_NONCONST_READLINK
+
#define ACE_HAS_CHARPTR_SOCKOPT
+
#define ACE_HAS_NONCONST_GETBY
+
// has man pages, but links with missing symbols and I can't find lib yet
/* #define ACE_HAS_REGEX */
+
#define ACE_HAS_SIG_MACROS
+
#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES
+
#if _UNICOS > 9
# define ACE_HAS_SIGWAIT
#endif
+
#define ACE_HAS_SIG_ATOMIC_T
+
#define ACE_HAS_SIGISMEMBER_BUG
+
#define ACE_HAS_MSG
+
#define ACE_HAS_STRERROR
+
#define ACE_HAS_GPERF
+
// Special modifications that apply to UNICOS/mk
#if defined(_CRAYMPP)
+
# define ACE_HAS_SIGINFO_T
# define ACE_HAS_UCONTEXT_T
+
#endif
+
// The Cray T90 supposedly supports SYSV SHMEM, but I was unable to get it
// working. Of course, all other Cray PVP and MPP systems do NOT support it,
// so it's probably good to just define like this for consistency
@@ -81,10 +125,14 @@
#define ACE_LACKS_PTHREAD_CLEANUP
#define ACE_LACKS_CONDATTR_PSHARED
#define ACE_LACKS_THREAD_PROCESS_SCOPING
+
#if !defined(_CRAYMPP)
+
#define ACE_LACKS_PTHREAD_CANCEL
#define ACE_LACKS_PTHREAD_KILL
+
#endif
+
#define ACE_LACKS_MUTEXATTR_PSHARED
#define ACE_LACKS_RWLOCK_T
#define ACE_LACKS_PRI_T
@@ -96,18 +144,26 @@
#define ACE_LACKS_MSYNC
#define ACE_LACKS_READV
#define ACE_LACKS_RLIMIT
+
// we probably want to fake not having this, since Cray memory mgmt is different
#define ACE_LACKS_SBRK
+
#define ACE_LACKS_SETSCHED
+
#define ACE_LACKS_SIGINFO_H
+
#define ACE_LACKS_TIMESPEC_T
+
#define ACE_LACKS_WRITEV
+
// Cray vector machines are "word" oriented, and modern ones are hard 64-bit.
// "char" is somewhat of a special case. Most problems arise when code thinks
// it can address 32-bit quantities and the like. MPP crays are typically
// byte oriented, e.g. T3E uses Alpha processors, so we don't need as much
// special treatment.
+
#ifndef _CRAYMPP
+
# define ACE_SIZEOF_CHAR 1
# define ACE_SIZEOF_SHORT 8
# define ACE_SIZEOF_INT 8
@@ -117,7 +173,9 @@
# define ACE_SIZEOF_DOUBLE 8
# define ACE_SIZEOF_LONG_DOUBLE 16
# define ACE_SIZEOF_VOID_P 8
+
#elif defined(_CRAYT3E)
+
# define ACE_SIZEOF_CHAR 1
# define ACE_SIZEOF_SHORT 4
# define ACE_SIZEOF_INT 8
@@ -127,21 +185,30 @@
# define ACE_SIZEOF_DOUBLE 8
# define ACE_SIZEOF_LONG_DOUBLE 8
# define ACE_SIZEOF_VOID_P 8
+
#endif
+
// Ones to check out at some point
+
/* #define ACE_HAS_SYS_SIGLIST */
+
// C++ Compiler stuff to verify
/* #define ACE_NEW_THROWS_EXCEPTIONS */
/* #define ACE_HAS_TEMPLATE_TYPEDEFS */
+
// thread issues to check out
/* #define ACE_LACKS_TIMEDWAIT_PROTOTYPES */
+
// Cray does seem to support it, in -lnsl and has tiuser.h header
/* #define ACE_HAS_TLI */
/* #define ACE_HAS_TIUSER_H */
/* #define ACE_HAS_TLI_PROTOTYPES */
/* #define ACE_LACKS_T_ERRNO */
+
/* #define ACE_LACKS_NAMED_POSIX_SEM */
+
/* #define ACE_HAS_SYS_ERRLIST */
+
#include /**/ "ace/post.h"
#endif /* ACE_CONFIG_CRAY_H */
diff --git a/dep/ACE_wrappers/ace/config-cxx-common.h b/dep/ACE_wrappers/ace/config-cxx-common.h
index 94f5a8cdd9c..6d467d64964 100644
--- a/dep/ACE_wrappers/ace/config-cxx-common.h
+++ b/dep/ACE_wrappers/ace/config-cxx-common.h
@@ -1,12 +1,15 @@
// -*- C++ -*-
//
// $Id: config-cxx-common.h 81935 2008-06-12 22:01:53Z jtc $
+
#ifndef ACE_CXX_COMMON_H
#define ACE_CXX_COMMON_H
#include /**/ "ace/pre.h"
+
#if !defined (ACE_CONFIG_INCLUDE_CXX_COMMON)
# error ace/config-cxx-common.h: ACE configuration error! Do not #include this file directly!
#endif
+
#if defined (__DECCXX)
# if !defined (linux)
# define ACE_HAS_STRING_CLASS
@@ -14,6 +17,7 @@
# define ACE_HAS_STDCPP_STL_INCLUDES
# endif /* __DECCXX_VER < 60090010 */
# endif /* ! linux */
+
# define DEC_CXX
# define ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR
# define ACE_LACKS_LINEBUFFERED_STREAMBUF
@@ -28,8 +32,10 @@
# endif /* ACE_HAS_EXCEPTIONS */
# define ACE_HAS_STANDARD_CPP_LIBRARY 1
# define ACE_HAS_TEMPLATE_TYPEDEFS
+
# define ACE_ENDLESS_LOOP \
unsigned int ace_endless_loop____ = 0; if (ace_endless_loop____) break;
+
# if defined (__USE_STD_IOSTREAM)
# define ACE_LACKS_CHAR_RIGHT_SHIFTS
# define ACE_LACKS_IOSTREAM_FX
@@ -38,6 +44,7 @@
# else /* ! __USE_STD_IOSTREAM */
# define ACE_USES_OLD_IOSTREAMS
# endif /* ! __USE_STD_IOSTREAM */
+
// 9: nested comment not allowed. (/usr/include/pdsc.h!) (nestcomment)
// 177: variable was declared but never referenced (declbutnotref)
// 193: zero used for undefined preprocessing identifier (undpreid)
@@ -45,30 +52,36 @@
// 401: base_class_with_nonvirtual_dtor (basclsnondto)
// 1016: expected type is incompatible with declared type of int (incint)
// 1136: conversion to smaller size integer could lose data (intconlosbit)
+
# pragma message disable basclsnondto
# pragma message disable boolexprconst
# pragma message disable undpreid
# pragma message disable notusetmpfunprm
# pragma message disable bltinclnk
+
# if (__DECCXX_VER >= 60190029)
// 6.1-029 and later support msg 1136. Disable it because it
// causes warnings from ACE and/or TAO.
# pragma message disable intconlosbit
# endif /* __DECCXX_VER >= 60190029 */
+
# if (__DECCXX_VER == 60190027)
// Seems that this version of cxx doesn't have reset
# define ACE_AUTO_PTR_LACKS_RESET
# endif /* __DECCXX_VER == 60190027 */
+
# if defined (DIGITAL_UNIX) && DIGITAL_UNIX >= 0x40D
// variable "PTHREAD_THIS_CATCH_NP" was declared but never referenced
# pragma message disable declbutnotref
# endif /* DIGITAL_UNIX >= 4.0f */
+
# else /* __DECCXX_VER < 60090010 */
# define ACE_LACKS_PRAGMA_ONCE
# endif /* __DECCXX_VER < 60090010 */
#else /* ! __DECCXX */
# error ace/config-cxx-common.h can only be used with Compaq CXX!
#endif /* ! __DECCXX */
+
#include /**/ "ace/post.h"
#endif /* ACE_CXX_COMMON_H */
diff --git a/dep/ACE_wrappers/ace/config-cygwin32.h b/dep/ACE_wrappers/ace/config-cygwin32.h
index 4551b47b48f..e6683e29795 100644
--- a/dep/ACE_wrappers/ace/config-cygwin32.h
+++ b/dep/ACE_wrappers/ace/config-cygwin32.h
@@ -1,21 +1,29 @@
/* -*- C++ -*- */
// $Id: config-cygwin32.h 81809 2008-05-30 13:40:21Z vzykov $
+
// The following configuration file is designed to work for CygWin
// platforms using GNU C++.
+
#ifndef ACE_CONFIG_CYGWIN32_H
#define ACE_CONFIG_CYGWIN32_H
+
#include /**/ "ace/pre.h"
+
#if !defined (ACE_MT_SAFE)
#define ACE_MT_SAFE 1
#endif
+
#define CYGWIN32
+
// We trust this file will get included before <sys/types.h>
#if !defined(FD_SETSIZE)
# define FD_SETSIZE 1024
#endif
+
#if !defined (ACE_IOV_MAX)
# define ACE_IOV_MAX 64
#endif /* ACE_IOV_MAX */
+
// Define custom export macros for export/import of symbols from/of dll's
#define ACE_HAS_CUSTOM_EXPORT_MACROS
#define ACE_Proper_Export_Flag __declspec (dllexport)
@@ -24,18 +32,25 @@
#define ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) template class __declspec (dllexport) SINGLETON_TYPE<CLASS, LOCK>;
#define ACE_IMPORT_SINGLETON_DECLARATION(T) extern template class T
#define ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) extern template class SINGLETON_TYPE <CLASS, LOCK>;
+
#define ACE_HAS_SELECT_H
+
#define ACE_LACKS_PRAGMA_ONCE
+
#if ! defined (__ACE_INLINE__)
# define __ACE_INLINE__
#endif /* ! __ACE_INLINE__ */
+
#include /**/ <cygwin/version.h>
+
// Needed to differentiate between libc 5 and libc 6 (aka glibc).
// It's there on all libc 5 systems I checked.
#include /**/ <features.h>
+
// config-g++-common.h undef's ACE_HAS_STRING_CLASS with -frepo, so
// this must appear before its #include.
#define ACE_HAS_STRING_CLASS
+
#if defined (__GNUG__)
# include "ace/config-g++-common.h"
#else
@@ -43,6 +58,7 @@
# error unsupported compiler in ace/config-cygwin32.h
# endif /* __cplusplus */
#endif /* __GNUG__ */
+
#define ACE_HAS_VOIDPTR_SOCKOPT 1
#define ACE_HAS_UALARM 1
#define ACE_HAS_SYS_ERRLIST 1
@@ -64,32 +80,49 @@
#define ACE_HAS_SOCKADDR_MSG_NAME 1
#define ACE_LACKS_PRI_T 1
#define ACE_HAS_3_PARAM_READDIR_R
+
// Compiler/platform supports alloca().
// Although ACE does have alloca() on this compiler/platform combination, it is
// disabled by default since it can be dangerous. Uncomment the following line
// if you want ACE to use it.
//#define ACE_HAS_ALLOCA
+
// Compiler/platform has the getrusage() system call.
#define ACE_HAS_GETRUSAGE
+
#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES
+
// Optimize ACE_Handle_Set for select().
#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT
+
#define ACE_HAS_IP_MULTICAST
+
#define ACE_HAS_BIG_FD_SET
+
// Platform has POSIX terminal interface.
#define ACE_HAS_TERMIOS
+
#define ACE_DEFAULT_MAX_SOCKET_BUFSIZ 65535
+
#define ACE_DEFAULT_SELECT_REACTOR_SIZE 256
+
#define ACE_HAS_GETPAGESIZE
+
#define ACE_HAS_VOIDPTR_GETTIMEOFDAY
+
// Compiler/platform supports strerror ().
#define ACE_HAS_STRERROR
+
// Compiler supports the ssize_t typedef.
#define ACE_HAS_SSIZE_T
+
#define ACE_HAS_SOCKLEN_T 1
+
#define ACE_HAS_GPERF
+
#define ACE_HAS_DIRENT
#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG
+
#define ACE_LACKS_MKFIFO
#define ACE_LACKS_SIGINFO_H
#define ACE_LACKS_UCONTEXT_H
@@ -107,35 +140,49 @@
#define ACE_LACKS_RWLOCK_T 1
#define ACE_LACKS_SUSECONDS_T
#define ACE_LACKS_SYS_SYSCTL_H
+
#define ACE_LACKS_FGETWS 1
#define ACE_LACKS_FPUTWS 1
+
#define ACE_LACKS_WCSTOULL 1
+
#define ACE_HAS_AUTOMATIC_INIT_FINI
+
#define ACE_HAS_SIGWAIT
#define ACE_HAS_SIGINFO_T
#define ACE_HAS_SIGACTION_CONSTP2
#define ACE_HAS_SIGSUSPEND
#define ACE_HAS_SIG_C_FUNC 1
#define ACE_HAS_SIG_ATOMIC_T
+
#define ACE_HAS_POSIX_SEM
+
#define ACE_HAS_P_READ_WRITE
+
#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R
+
// Cygwin DLL suffix is .dll
#define ACE_DLL_SUFFIX ACE_TEXT (".dll")
+
// Cygwin runs on Windows, so we have to get the environment variable PATH and
// not LD_LIBRARY_PATH which is the default in ACE
#define ACE_LD_SEARCH_PATH ACE_TEXT ("PATH")
+
#if ACE_MT_SAFE
// Yes, we do have threads.
# define ACE_HAS_THREADS
// And they're even POSIX pthreads (LinuxThreads implementation)
# define ACE_HAS_PTHREADS
+
# define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS
+
// Compiler/platform has thread-specific storage
# define ACE_HAS_THREAD_SPECIFIC_STORAGE
+
# define ACE_HAS_PTHREADS_UNIX98_EXT
# define ACE_HAS_PTHREAD_CONTINUE 1
# define ACE_HAS_PTHREAD_SUSPEND 1
+
# define ACE_LACKS_PTHREAD_ATTR_SETSTACKADDR
// Cygwin (see pthread.h): Not supported or implemented.
# define ACE_LACKS_SETSCHED
@@ -147,10 +194,14 @@
# define ACE_LACKS_PTHREAD_THR_SIGSETMASK 1
# define ACE_LACKS_PTHREAD_YIELD 1
# define ACE_LACKS_PTHREAD_ATTR_SETSTACK
+
// In the 1.5.9 release of Cygwin the pthread_kill gives an access violation
// so for the time being we say Cygwin doesn't support pthread_kill.
# define ACE_LACKS_PTHREAD_KILL
+
#endif /* ACE_MT_SAFE */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_CONFIG_CYGWIN32_H */
diff --git a/dep/ACE_wrappers/ace/config-doxygen.h b/dep/ACE_wrappers/ace/config-doxygen.h
index dd0c14c506f..d4e8a068e43 100644
--- a/dep/ACE_wrappers/ace/config-doxygen.h
+++ b/dep/ACE_wrappers/ace/config-doxygen.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
/**
* This is a configuration file to define all the macros that Doxygen
* needs
@@ -13,10 +14,13 @@
*/
#ifndef ACE_CONFIG_DOXYGEN_H
#define ACE_CONFIG_DOXYGEN_H
+
/// Make sure that we always turn inlining on.
#define __ACE_INLINE__
+
/// Make the wchar_t interfaces available.
#define ACE_HAS_WCHAR
+
/// Make all the emulation versions of string operations visible
// #define ACE_LACKS_WCSTOK
#define ACE_LACKS_ITOW
@@ -37,27 +41,37 @@
#define ACE_LACKS_WCSCSPN
#define ACE_LACKS_WCSSPN
#define ACE_LACKS_WCSSTR
+
/// Support for threads enables several important classes
#define ACE_HAS_THREADS
+
/// Support for Win32 enables the WFMO_Reactor and several Async I/O
/// classes
#define ACE_WIN32
+
/// Enable support for POSIX Asynchronous I/O calls
#define ACE_HAS_AIO_CALLS
+
/// Enable support for TLI interfaces
#define ACE_HAS_TLI
+
/// Enable support for the SSL wrappers
#define ACE_HAS_SSL 1
+
/// Enable exceptions
#define ACE_HAS_EXCEPTIONS
+
/// Enable timeprobes
#define ACE_COMPILE_TIMEPROBES
+
/// Enable unicode to generate ACE_Registry_Name_Space
#define UNICODE
+
/// These defines make sure that Svc_Conf_y.cpp and Svc_Conf_l.cpp are correctly
/// parsed
#define __cplusplus
#define ACE_YY_USE_PROTOS
+
/// TAO features that should be documented too
#define TAO_HAS_RT_CORBA 1
#define TAO_HAS_MINIMUM_CORBA 0
@@ -66,29 +80,42 @@
#define TAO_HAS_SCIOP 1
#define TAO_HAS_COIOP 1
#define TAO_HAS_TRANSPORT_CURRENT 1
+
/// Generate token library documentation
#define ACE_HAS_TOKENS_LIBRARY
+
/// Generate ACE ATM classes documentation
#define ACE_HAS_ATM
+
/// Generate ACE XTI ATM class documentation
#define ACE_HAS_XTI_ATM
+
/// Generate ACE_Dev_Poll_Reactor documentation
#define ACE_HAS_DEV_POLL
+
/// Generate ACE_Event_Handler_T documentation
#define ACE_HAS_TEMPLATE_TYPEDEFS
+
/// Generate ACE_Log_Msg_NT_Event_Log documentation
#define ACE_HAS_LOG_MSG_NT_EVENT_LOG
+
/// Generate icmp documentation
#define ACE_HAS_ICMP_SUPPORT 1
+
/// Don't expand ACE_RCSID macro
#define ACE_USE_RCSID 0
+
/// Parse some ACE_SSL classes that depend on recent versions of
/// OpenSSL.
#define OPENSSL_VERSION_NUMBER 0x00905820L
+
/// Enable IPv6
#define ACE_HAS_IPV6
+
/// Enable netlink socket support
#define ACE_HAS_NETLINK
+
#define ACE_HAS_IP_MULTICAST
+
#endif /* ACE_CONFIG_DOXYGEN_H */
diff --git a/dep/ACE_wrappers/ace/config-freebsd.h b/dep/ACE_wrappers/ace/config-freebsd.h
index d392c9e9b77..d5ead871030 100644
--- a/dep/ACE_wrappers/ace/config-freebsd.h
+++ b/dep/ACE_wrappers/ace/config-freebsd.h
@@ -1,12 +1,16 @@
/* -*- C++ -*- */
// $Id: config-freebsd.h 80826 2008-03-04 14:51:23Z wotte $
+
// The following configuration file is designed to work for FreeBSD
+
#ifndef ACE_CONFIG_H
#define ACE_CONFIG_H
#include /**/ "ace/pre.h"
+
#if !defined (ACE_MT_SAFE)
# define ACE_MT_SAFE 1
#endif
+
#if ACE_MT_SAFE
// Yes, we do have threads.
# define ACE_HAS_THREADS 1
@@ -14,23 +18,30 @@
// Set to 0 since that's what config-posix.h checks for.
# define ACE_HAS_THREADS 0
#endif /* ACE_MT_SAFE */
+
#include "ace/config-posix.h"
+
#include <osreldate.h>
// Make sure we source in the OS version.
+
#if ! defined (__ACE_INLINE__)
#define __ACE_INLINE__
#endif /* ! __ACE_INLINE__ */
+
#if (__FreeBSD_version < 220000)
#if defined (ACE_HAS_THREADS)
#error Threads are not supported.
#endif /* ACE_HAS_THREADS */
#endif /* __FreeBSD_version < 220000 */
+
#if defined (__GNUG__)
# include "ace/config-g++-common.h"
#endif /* __GNUG__ */
+
#if defined (ACE_HAS_PENTIUM)
# undef ACE_HAS_PENTIUM
#endif /* ACE_HAS_PENTIUM */
+
// Platform specific directives
// gcc defines __FreeBSD__ automatically for us.
#ifdef ACE_HAS_THREADS
@@ -38,7 +49,9 @@
#define _THREAD_SAFE
#endif /* _THREAD_SAFE */
#endif
+
#define ACE_HAS_GPERF
+
#if (__FreeBSD_version < 420000)
#define ACE_LACKS_GETPGID
#define ACE_LACKS_SETPGID
@@ -46,6 +59,7 @@
#define ACE_LACKS_SETREUID
#define ACE_LACKS_PTHREAD_CANCEL
#endif /* __FreeBSD_version < 420000 */
+
#define ACE_HAS_ALT_CUSERID
#define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS
#define ACE_HAS_SIG_MACROS
@@ -53,6 +67,7 @@
#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT
#define ACE_HAS_NONCONST_SELECT_TIMEVAL
#define ACE_HAS_CHARPTR_DL
+
#if (__FreeBSD_version < 400000)
#define ACE_LACKS_SIGSET
#define ACE_LACKS_RWLOCK_T
@@ -62,7 +77,9 @@
#define ACE_LACKS_UCONTEXT_H
#define ACE_LACKS_RAND_REENTRANT_FUNCTIONS
#endif
+
#define ACE_NEEDS_SCHED_H
+
#if (__FreeBSD_version < 400000)
enum schedparam_policy {
SCHED_RR,
@@ -71,98 +88,135 @@ enum schedparam_policy {
SCHED_OTHER
};
#endif
+
// Use of <malloc.h> is deprecated.
#define ACE_LACKS_MALLOC_H
+
// This won't be necessary after it is fixed in the system include headers.
extern "C" { char * cuserid (char *s); }
+
// Platform supports POSIX timers via struct timespec.
#define ACE_HAS_POSIX_TIME
#define ACE_HAS_UALARM
+
// Platform defines struct timespec but not timespec_t
#define ACE_LACKS_TIMESPEC_T
+
#if (__FreeBSD_version < 501000)
#define ACE_LACKS_STDINT_H
#endif
+
#define ACE_HAS_SYSCTL
#define ACE_LACKS_STRRECVFD
+
#define ACE_HAS_SOCKADDR_IN_SIN_LEN
#define ACE_HAS_SOCKADDR_IN6_SIN6_LEN
+
// Platform supports System V IPC (most versions of UNIX, but not Win32)
#define ACE_HAS_SYSV_IPC
+
// Compiler/platform contains the <sys/syscall.h> file.
#define ACE_HAS_SYS_SYSCALL_H
+
#if (__FreeBSD_version >= 220000)
#define ACE_HAS_VASPRINTF
#endif
+
#if (__FreeBSD_version >= 300000)
#define ACE_HAS_SIGINFO_T
#endif /* __FreeBSD_version >= 300000 */
+
#if (__FreeBSD_version >= 320000)
#define ACE_HAS_REENTRANT_FUNCTIONS
#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS
#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R
#endif /* __FreeBSD_version >= 320000 */
+
#if (__FreeBSD_version >= 440000)
#define ACE_HAS_GETPROGNAME
#define ACE_HAS_SETPROGNAME
#endif
+
#if (__FreeBSD_version < 501000)
#define ACE_LACKS_PWD_REENTRANT_FUNCTIONS
#endif
+
#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES
#define ACE_LACKS_SIGINFO_H
#define ACE_LACKS_LOG2
#define ACE_LACKS_SI_ADDR
+
// Compiler/platform supports SVR4 signal typedef
#define ACE_HAS_SVR4_SIGNAL_T
+
// Compiler/platform supports alloca().
// Although ACE does have alloca() on this compiler/platform combination, it is
// disabled by default since it can be dangerous. Uncomment the following line
// if you ACE to use it.
//#define ACE_HAS_ALLOCA
+
// Compiler/platform supports SVR4 dynamic linking semantics..
#define ACE_HAS_SVR4_DYNAMIC_LINKING
+
// Compiler/platform correctly calls init()/fini() for shared libraries.
#define ACE_HAS_AUTOMATIC_INIT_FINI
+
// Explicit dynamic linking permits "lazy" symbol resolution
#define ACE_HAS_RTLD_LAZY_V
+
// platform supports POSIX O_NONBLOCK semantics
#define ACE_HAS_POSIX_NONBLOCK
+
// platform supports IP multicast
#define ACE_HAS_IP_MULTICAST
+
// Lacks perfect filtering, must bind group address.
#if !defined ACE_LACKS_PERFECT_MULTICAST_FILTERING
# define ACE_LACKS_PERFECT_MULTICAST_FILTERING 1
#endif /* ACE_LACKS_PERFECT_MULTICAST_FILTERING */
+
// Compiler/platform has <alloca.h>
//#define ACE_HAS_ALLOCA_H
+
// Compiler/platform has the getrusage() system call.
#define ACE_HAS_GETRUSAGE
+
// Compiler/platform defines the sig_atomic_t typedef.
#define ACE_HAS_SIG_ATOMIC_T
+
// Compiler/platform supports sys_siglist array.
// *** This refers to (_sys_siglist) instead of (sys_siglist)
// #define ACE_HAS_SYS_SIGLIST
+
// Compiler/platform defines a union semun for SysV shared memory.
#define ACE_HAS_SEMUN
+
// Compiler supports the ssize_t typedef.
#define ACE_HAS_SSIZE_T
+
// Compiler/platform supports strerror ().
#define ACE_HAS_STRERROR
+
// Compiler/platform provides the sockio.h file.
#define ACE_HAS_SYS_SOCKIO_H
+
// Defines the page size of the system.
#define ACE_PAGE_SIZE 4096
+
// Platform provides <sys/filio.h> header.
#define ACE_HAS_SYS_FILIO_H
+
// Platform/compiler supports timezone * as second parameter to gettimeofday().
#define ACE_HAS_TIMEZONE_GETTIMEOFDAY
+
#define ACE_HAS_MSG
#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG
+
#if (__FreeBSD_version < 500100)
# define ACE_HAS_NONCONST_MSGSND
#endif
+
// Thread specific settings
// Yes, we do have threads.
#ifdef ACE_HAS_THREADS
@@ -170,31 +224,39 @@ extern "C" { char * cuserid (char *s); }
# define ACE_MT_SAFE 1
#endif /* ! ACE_MT_SAFE */
#endif /* ACE_HAS_THREADS */
+
#define ACE_LACKS_THREAD_PROCESS_SCOPING
#define ACE_LACKS_CONDATTR_PSHARED
#define ACE_LACKS_MUTEXATTR_PSHARED
#define ACE_HAS_THREAD_SPECIFIC_STORAGE
#define ACE_HAS_DIRENT
+
#define ACE_HAS_SIGWAIT
+
// Platform has POSIX terminal interface.
#define ACE_HAS_TERMIOS
+
#if (__FreeBSD_version > 400000)
#define ACE_HAS_UCONTEXT_T
#define ACE_HAS_SOCKLEN_T
#define ACE_HAS_GETIFADDRS
#define ACE_HAS_PTHREADS_UNIX98_EXT
#endif
+
// Note, on FreeBSD 5, POSIX aio is now an optional kernel module which
// must be loaded.
// Read the aio(4) man page for what to do, otherwise any aio_* call
// will coredump.
+
// By default use Proactor which does not use POSIX Real-time Signals.
#ifdef ACE_HAS_AIO_CALLS
# ifndef ACE_POSIX_AIOCB_PROACTOR
# define ACE_POSIX_AIOCB_PROACTOR
# endif /* ACE_POSIX_AIOCB_PROACTOR */
#endif /* ACE_HAS_AIO_CALLS */
+
#define ACE_LACKS_STROPTS_H
+
// Needed when ACE_HAS_WCHAR is defined.
#define ACE_LACKS_WCSNICMP
#define ACE_LACKS_WCSICMP
@@ -202,17 +264,22 @@ extern "C" { char * cuserid (char *s); }
#define ACE_LACKS_ITOW
#define ACE_HAS_3_PARAM_WCSTOK
#define ACE_HAS_3_PARAM_READDIR_R
+
#if (__FreeBSD_version >= 501000)
# define ACE_HAS_PTHREAD_SETSTACK
#endif
+
#if (__FreeBSD_version < 700007)
# define ACE_HAS_SIGVAL_SIGVAL_INT
# define ACE_HAS_BROKEN_SIGEVENT_STRUCT
#endif
+
#if (__FreeBSD_version >= 700028)
# define ACE_HAS_SCTP
# define ACE_HAS_LKSCTP
#endif
+
#include /**/ "ace/post.h"
+
#endif /* ACE_CONFIG_H */
diff --git a/dep/ACE_wrappers/ace/config-g++-common.h b/dep/ACE_wrappers/ace/config-g++-common.h
index 86ff313e357..ff365a5890d 100644
--- a/dep/ACE_wrappers/ace/config-g++-common.h
+++ b/dep/ACE_wrappers/ace/config-g++-common.h
@@ -1,12 +1,15 @@
// -*- C++ -*-
//
// $Id: config-g++-common.h 82495 2008-08-04 07:23:01Z johnnyw $
+
// This configuration file is designed to be included by another,
// specific configuration file. It provides config information common
// to all g++ platforms, including egcs.
+
#ifndef ACE_GNUG_COMMON_H
#define ACE_GNUG_COMMON_H
#include /**/ "ace/pre.h"
+
#define ACE_HAS_CPLUSPLUS_HEADERS
#define ACE_HAS_STDCPP_STL_INCLUDES
#define ACE_HAS_TEMPLATE_TYPEDEFS
@@ -14,16 +17,20 @@
#define ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR
#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1
#define ACE_TEMPLATES_REQUIRE_SOURCE
+
#if ( __GNUC__ == 2 && __GNUC_MINOR__ < 97 )
// gcc 2.97 and lower use old iostreams
# define ACE_USES_OLD_IOSTREAMS
#endif /* __GNUC__ >= 2.97 */
+
#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
# define ACE_EXPLICIT_TEMPLATE_DESTRUCTOR_TAKES_ARGS
#endif /* __GNUC__ >= 3.4 */
+
#if (__GNUC__ < 3)
# define ACE_LACKS_MEMBER_TEMPLATES
#endif /* __GNUC__ < 3 */
+
// __EXCEPTIONS is defined with -fexceptions, the egcs default. It
// is not defined with -fno-exceptions, the ACE default for g++.
// ACE_HAS_EXCEPTIONS is defined in
@@ -32,6 +39,7 @@
#if defined (__EXCEPTIONS) && !defined (ACE_HAS_EXCEPTIONS)
# define ACE_HAS_EXCEPTIONS
#endif /* __EXCEPTIONS && ! ACE_HAS_EXCEPTIONS */
+
#if defined (ACE_HAS_EXCEPTIONS)
# define ACE_NEW_THROWS_EXCEPTIONS
# if (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
@@ -39,9 +47,11 @@
# define ACE_HAS_NEW_NOTHROW
# endif /* __GNUC__ >= 3.3 */
#endif /* ACE_HAS_EXCEPTIONS */
+
#if (defined (i386) || defined (__i386__)) && !defined (ACE_SIZEOF_LONG_DOUBLE)
# define ACE_SIZEOF_LONG_DOUBLE 12
#endif /* i386 */
+
#if !defined (__MINGW32__) && (defined (i386) || defined (__i386__))
// If running an Intel, assume that it's a Pentium so that
// ACE_OS::gethrtime () can use the RDTSC instruction. If running a
@@ -50,17 +60,21 @@
// protection, so it can be ignored.)
# define ACE_HAS_PENTIUM
#endif /* i386 */
+
#if (defined (ACE_HAS_PENTIUM) || defined (__amd64__) || defined (__x86_64__))
# define ACE_HAS_INTEL_ASSEMBLY
#endif
+
// GNU g++ >= 4.x implements "#pragma once".
#if (__GNUC__ < 4) && !defined (ACE_LACKS_PRAGMA_ONCE)
// We define it with a -D with make depend.
# define ACE_LACKS_PRAGMA_ONCE
#endif /* ! ACE_LACKS_PRAGMA_ONCE */
+
// Take advantage of G++ (>= 4.x) visibility attributes to generate
// improved shared library binaries.
#if (__GNUC__ >= 4) && !defined (__MINGW32__)
+
# if defined (ACE_HAS_CUSTOM_EXPORT_MACROS) && ACE_HAS_CUSTOM_EXPORT_MACROS == 0
# undef ACE_HAS_CUSTOM_EXPORT_MACROS
# if defined (ACE_GCC_HAS_TEMPLATE_INSTANTIATION_VISIBILITY_ATTRS)
@@ -73,6 +87,7 @@
# endif /* !ACE_HAS_CUSTOM_EXPORT_MACROS */
# define ACE_Proper_Export_Flag __attribute__ ((visibility("default")))
# define ACE_Proper_Import_Flag __attribute__ ((visibility("default")))
+
# if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2))
// Sadly, G++ 4.x silently ignores visibility attributes on
// template instantiations, which breaks singletons.
@@ -86,6 +101,7 @@
# define ACE_GCC_HAS_TEMPLATE_INSTANTIATION_VISIBILITY_ATTRS 1
# endif
# endif
+
# if defined (ACE_GCC_HAS_TEMPLATE_INSTANTIATION_VISIBILITY_ATTRS) && ACE_GCC_HAS_TEMPLATE_INSTANTIATION_VISIBILITY_ATTRS == 1
# define ACE_EXPORT_SINGLETON_DECLARATION(T) template class ACE_Proper_Export_Flag T
# define ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) template class ACE_Proper_Export_Flag SINGLETON_TYPE <CLASS, LOCK>;
@@ -99,12 +115,15 @@
template class SINGLETON_TYPE<CLASS, LOCK>; \
_Pragma ("GCC visibility pop")
# endif /* ACE_GCC_HAS_TEMPLATE_INSTANTIATION_VISIBILITY_ATTRS */
+
// Note that the "__extension__" is needed to prevent g++ from issuing
// an error when using its "-pedantic" command line flag.
# define ACE_IMPORT_SINGLETON_DECLARATION(T) __extension__ extern template class T
# define ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) __extension__ extern template class SINGLETON_TYPE<CLASS, LOCK>;
+
# endif /* ACE_HAS_CUSTOM_EXPORT_MACROS == 0 */
#endif /* __GNU__ >= 4 */
+
#if defined (ACE_HAS_GNU_REPO)
// -frepo causes unresolved symbols of basic_string left- and
// right-shift operators with ACE_HAS_STRING_CLASS.
@@ -112,6 +131,7 @@
# undef ACE_HAS_STRING_CLASS
# endif /* ACE_HAS_STRING_CLASS */
#endif /* ! ACE_HAS_GNU_REPO */
+
#include /**/ "ace/post.h"
#endif /* ACE_GNUG_COMMON_H */
diff --git a/dep/ACE_wrappers/ace/config-ghs-common.h b/dep/ACE_wrappers/ace/config-ghs-common.h
index 01b390d63ab..bb169ba06ba 100644
--- a/dep/ACE_wrappers/ace/config-ghs-common.h
+++ b/dep/ACE_wrappers/ace/config-ghs-common.h
@@ -1,20 +1,26 @@
/* -*- C++ -*- */
// $Id: config-ghs-common.h 80826 2008-03-04 14:51:23Z wotte $
+
// This configuration file is designed to be included by another,
// specific configuration file. It provides config information common
// to all Green Hills platforms.
+
#ifndef ACE_GHS_COMMON_H
#define ACE_GHS_COMMON_H
#include /**/ "ace/pre.h"
+
#if !defined (ACE_CONFIG_INCLUDE_GHS_COMMON)
# error ace/config-ghs-common.h: ACE configuration error! Do not #include this file directly!
#endif
+
#if defined (ghs)
+
# if defined (sun)
// Need nonstatic Object_Manager on Solaris to prevent seg fault
// on startup.
# define ACE_HAS_NONSTATIC_OBJECT_MANAGER
# endif /* sun */
+
# if defined (__STANDARD_CXX)
// Green Hills 1.8.9, but not 1.8.8.
# define ACE_HAS_STANDARD_CPP_LIBRARY 1
@@ -24,12 +30,15 @@
# else
# define ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA
# endif /* __STANDARD_CXX */
+
# define ACE_LACKS_LINEBUFFERED_STREAMBUF
# define ACE_LACKS_LONGLONG_T
# define ACE_LACKS_SIGNED_CHAR
+
#else /* ! ghs */
# error ace/config-ghs-common.h can only be used with Green Hills compilers!
#endif /* ! ghs */
+
#include /**/ "ace/post.h"
#endif /* ACE_GHS_COMMON_H */
diff --git a/dep/ACE_wrappers/ace/config-hpux-11.00.h b/dep/ACE_wrappers/ace/config-hpux-11.00.h
index 532153a06bc..17de9afa38c 100644
--- a/dep/ACE_wrappers/ace/config-hpux-11.00.h
+++ b/dep/ACE_wrappers/ace/config-hpux-11.00.h
@@ -1,19 +1,28 @@
/* -*- C++ -*- */
// $Id: config-hpux-11.00.h 81992 2008-06-16 19:09:50Z wotte $
+
// The following configuration file is designed to work for HP
// platforms running HP-UX 11.00 using aC++ or gcc (2.95 and up).
+
#ifndef ACE_CONFIG_H
#define ACE_CONFIG_H
#include /**/ "ace/pre.h"
+
#define ACE_LACKS_STDINT_H
#define ACE_LACKS_SYS_SELECT_H
+
#if defined (__GNUG__)
+
// config-g++-common.h undef's ACE_HAS_STRING_CLASS with -frepo, so
// this must appear before its #include.
# define ACE_HAS_STRING_CLASS
+
# include "ace/config-g++-common.h"
+
#else
+
// aC++...
+
// Precompiler needs extra flags to ignore "invalid #pragma directive"
# ifndef ACE_USING_MCPP_PREPROCESSOR
# define ACE_CC_PREPROCESSOR_ARGS "-E +W 67"
@@ -24,6 +33,7 @@
# if !defined (__HPACC_NOEH)
# define ACE_HAS_EXCEPTIONS 1
# endif
+
// If the -AA compile option is used, the compiler defines _HP_NAMESPACE_STD.
// The -AA option enables the 2.0 standard C++ library. If not used, then
// we have the old, 1.2.1 C++ library.
@@ -46,44 +56,58 @@
// aren't in std::
# define ACE_LACKS_NUMERIC_LIMITS
# endif /* _HP_NAMESPACE_STD */
+
// Compiler implements templates that support typedefs inside of classes
// used as formal arguments to a template class.
# define ACE_HAS_TEMPLATE_TYPEDEFS
+
# define ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR
+
// Platform lacks streambuf "linebuffered ()".
# define ACE_LACKS_LINEBUFFERED_STREAMBUF 1
+
// Lack of (and broken) support for placement operator delete is a known
// bug by HP, up until aC++ A.03.55.02.
# if (__HP_aCC < 35502)
# define ACE_LACKS_PLACEMENT_OPERATOR_DELETE
# endif /* __HP_aCC < 35502 */
+
// Compiler's 'new' throws exceptions on failure, regardless of whether or
// not exception handling is enabled in the compiler options. Fortunately,
// new(nothrow_t) is offered.
# define ACE_NEW_THROWS_EXCEPTIONS
# define ACE_HAS_NEW_NOTHROW
# define ACE_HAS_NEW_NO_H 1
+
// Compiler's template mechanism must see source code (i.e., .C files).
# define ACE_TEMPLATES_REQUIRE_SOURCE
+
// Compiler doesn't handle 'signed char' correctly (used in ace/IOStream.h)
# define ACE_LACKS_SIGNED_CHAR
+
#endif /* __GNUG__, HP */
+
//*********************************************************************
//
// From here down is the compiler-INdependent OS settings.
//
//*********************************************************************
+
// Compiling for HPUX.
#if !defined (HPUX)
#define HPUX
#endif /* HPUX */
#define HPUX_11
+
#ifndef _HPUX_SOURCE
#define _HPUX_SOURCE
#endif
+
#include /**/ <sys/stdsyms.h>
+
// HP-UX is a POSIX-compliant system - see what's available.
#include "ace/config-posix.h"
+
// config-posix.h sets up ACE_HAS_AIO_CALLS if the headers define the
// proper things. In HP-UX 11's case, the AIOCB Proactor works the best
// overall. If the user hasn't overridden it, select AIOCB.
@@ -92,11 +116,13 @@
# define ACE_POSIX_AIOCB_PROACTOR
# endif /* !ACE_HAS_POSIX_AIOCB_PROACTOR && !ACE_POSIX_SIG_PROACTOR */
#endif /* ACE_HAS_AIO_CALLS */
+
////////////////////////////////////////////////////////////////////////////
//
// General OS information - see README for more details on what they mean
//
///////////////////////////////////////////////////////////////////////////
+
// HP/UX needs to have these addresses in a special range.
// If this is on a 64-bit model, the default is to use 64-bit addressing.
// It can also be set so that the mapped region is shareable with 32-bit
@@ -106,17 +132,20 @@
# define ACE_DEFAULT_BASE_ADDR ((char *) 0x0000001100000000)
//# define ACE_DEFAULT_BASE_ADDR ((char *) 0x80000000)
//# define ACE_OS_EXTRA_MMAP_FLAGS MAP_ADDR32
+
# define ACE_DEFAULT_BASE_ADDRL (0x0000001100000000)
//# define ACE_DEFAULT_BASE_ADDRL (0x80000000)
#else
# define ACE_DEFAULT_BASE_ADDR ((char *) 0x80000000)
#endif /* __LP64__ */
+
// Preprocessor needs some help with data types
#if defined (__LP64__)
# define ACE_SIZEOF_LONG 8
#else
# define ACE_SIZEOF_LONG 4
#endif
+
// Platform can do async I/O (aio_*) (set up in config-posix.h)
// ... but seems to require this in order to keep from hanging. Needs some
// investigation, maybe with HP. John Mulhern determined this value
@@ -125,70 +154,97 @@
#if !defined (ACE_INFINITE)
# define ACE_INFINITE 10000000
#endif
+
/* Compiler/platform correctly calls init()/fini() for shared libraries. */
#define ACE_HAS_AUTOMATIC_INIT_FINI 1
+
// Manually tweak the malloc control block paddings to properly align
// things.
#define ACE_MALLOC_PADDING 16
#define ACE_MALLOC_ALIGN 8
#define ACE_PI_CONTROL_BLOCK_ALIGN_LONGS 3
+
// Compiler/platform contains the <sys/syscall.h> file.
#define ACE_HAS_SYS_SYSCALL_H
+
#define ACE_HAS_SYS_PSTAT_H
+
// But doesn't have a prototype for syscall()
#define ACE_LACKS_SYSCALL
+
// Platform supports POSIX.1b clock_gettime ()
#define ACE_HAS_CLOCK_GETTIME
#define ACE_HAS_CLOCK_SETTIME
+
// Prototypes for both signal() and struct sigaction are consistent.
#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES
+
// Compiler/platform has correctly prototyped header files.
#define ACE_HAS_CPLUSPLUS_HEADERS
+
// Compiler/platform has Dirent iterator functions.
#define ACE_HAS_DIRENT
+
#define ACE_HAS_VSWPRINTF
+
// Platform supports getpagesize() call
#define ACE_HAS_GETPAGESIZE
// But we define this just to be safe
#define ACE_PAGE_SIZE 4096
+
// Can run gperf on this platform (needed for TAO)
# define ACE_HAS_GPERF
+
// Optimize ACE_Handle_Set for select().
# define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT
+
// Platform supports IP multicast
#define ACE_HAS_IP_MULTICAST
// At least for 11iv2, lacks perfect filtering.
#if (HPUX_VERS >= 1123) && !defined (ACE_LACKS_PERFECT_MULTICAST_FILTERING)
# define ACE_LACKS_PERFECT_MULTICAST_FILTERING 1
#endif
+
/* Platform defines MAP_FAILED as a long constant. */
#define ACE_HAS_LONG_MAP_FAILED 1
+
// Platform supports recvmsg and sendmsg.
#define ACE_HAS_MSG
+
// Platform's select() has non-const timeval argument
#define ACE_HAS_NONCONST_SELECT_TIMEVAL
+
// Compiler/platform supports poll().
#define ACE_HAS_POLL
+
/* Platform supports "position-independent" features provided by
ACE_Based_Pointer<>. */
#define ACE_HAS_POSITION_INDEPENDENT_POINTERS 1
+
/* Platform supports POSIX getpwnam_r() function */
#define ACE_HAS_POSIX_GETPWNAM_R 1
+
// Platform supports POSIX O_NONBLOCK semantics.
#define ACE_HAS_POSIX_NONBLOCK
+
// Platform supports the POSIX struct timespec type
#define ACE_HAS_POSIX_TIME
+
/* Platform has pread() and pwrite() support. */
#define ACE_HAS_P_READ_WRITE 1
+
/* Platform will recurse infinitely on thread exits from TSS cleanup routines
(e.g., AIX) */
#define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS 1
+
// Platform supports reentrant functions (all the POSIX *_r functions).
#define ACE_HAS_REENTRANT_FUNCTIONS
// ctime_r and asctime_r conform to POSIX.1c (2 param version)
#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R
+
// Platform offers scandir(), and requires no adjustments for its API.
#define ACE_HAS_SCANDIR
+
// HP-UX 11 has reentrant netdb functions. The catch is that the old
// functions (gethostbyname, etc.) are thread-safe and the _r versions are
// not used and will be removed at some point. So, define things so
@@ -196,66 +252,96 @@
// the extra mutex lock in the ACE_NETDBCALL_RETURN macro, and will be fixed
// in the future (problem ID P64).
#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS
+
/* Platform lacks pri_t (e.g., Tandem NonStop UNIX). */
#define ACE_LACKS_PRI_T 1
+
// Platform has shm_open
#define ACE_HAS_SHM_OPEN
+
// Compiler/platform defines the sig_atomic_t typedef
#define ACE_HAS_SIG_ATOMIC_T
+
/* Compiler requires extern "C" functions for signals. */
#define ACE_HAS_SIG_C_FUNC 1
+
// Platform's sigaction() function takes const sigaction* as 2nd parameter.
#define ACE_HAS_SIGACTION_CONSTP2
+
#define ACE_HAS_SSIZE_T
+
// Platform supports SVR4 extended signals
#define ACE_HAS_SIGINFO_T
+
/* Define to 1 if platform has sigsuspend(). */
#define ACE_HAS_SIGSUSPEND 1
+
// Platform doesn't detect a signal out of range unless it's way out of range.
#define ACE_HAS_SIGISMEMBER_BUG
+
/* Platform provides socklen_t type, such as Linux with glibc2. */
#define ACE_HAS_SOCKLEN_T 1
+
#define ACE_HAS_XPG4_MULTIBYTE_CHAR
+
/* Platform/compiler supports _sys_errlist symbol */
#define ACE_HAS_SYS_ERRLIST 1
+
#define ACE_HAS_UALARM
+
// Platform supports ucontext_t (which is used in the extended signal API).
#define ACE_HAS_UCONTEXT_T
+
// Compiler/platform supports strerror ().
#define ACE_HAS_STRERROR
+
// Platform/compiler supports void * as second parameter to gettimeofday().
#define ACE_HAS_VOIDPTR_GETTIMEOFDAY
+
/* Platform requires void * for mmap(). */
#define ACE_HAS_VOIDPTR_MMAP 1
+
/* OS/compiler uses void * arg 4 setsockopt() rather than const char * */
#define ACE_HAS_VOIDPTR_SOCKOPT 1
+
// Platform supports SVR4 dynamic linking semantics.
// When used, this requires -ldl on the ACE library link line.
#define ACE_HAS_SVR4_DYNAMIC_LINKING
+
// Platform supports the getrusage() system call.
#define ACE_HAS_GETRUSAGE
+
/* Define to 1 if platform has the declaration of getrusage(). */
#define ACE_HAS_GETRUSAGE_PROTOTYPE 1
+
// Platform has the sigwait function in a header file
#define ACE_HAS_SIGWAIT
#define ACE_HAS_SIGTIMEDWAIT
+
// Platform supports System V IPC (most versions of UNIX, but not Win32)
#define ACE_HAS_SYSV_IPC
+
// accept() is thread-safe
#define ACE_HAS_THREAD_SAFE_ACCEPT
+
// Platform lacks a typedef for timespec_t, but has struct timespec
#define ACE_LACKS_TIMESPEC_T
+
// dlopen() takes a char* instead of const char*
#define ACE_HAS_CHARPTR_DL
+
// lacks setegid and seteuid
#define ACE_LACKS_SETEGID
#define ACE_LACKS_SETEUID
+
#define ACE_LACKS_SUSECONDS_T
#define ACE_LACKS_SYS_SYSCTL_H
+
// @@ TODO: It looks like HP-UX provides strtoull and wcstoull
// but some more work is needed to plug them in correctly.
#define ACE_LACKS_STRTOULL
#define ACE_LACKS_WCSTOULL
+
// Shared library name/path components
#if defined (__ia64)
# define ACE_DLL_SUFFIX ACE_TEXT (".so")
@@ -267,16 +353,20 @@
#else
# define ACE_LD_SEARCH_PATH ACE_TEXT ("SHLIB_PATH")
#endif /* __LP64__ */
+
#if defined (_INCLUDE__STDC_A1_SOURCE)
# define ACE_HAS_3_PARAM_WCSTOK
#endif
+
#define ACE_HAS_3_PARAM_READDIR_R
+
//////////////////////////////////////////////////////////////////////////
//
// STREAMS information
//
//////////////////////////////////////////////////////////////////////////
+
// Platform supports STREAMS
#define ACE_HAS_STREAMS
// Compiler/platform supports struct strbuf.
@@ -286,15 +376,18 @@
#define ACE_LACKS_CONST_STRBUF_PTR
/* Platform supports TLI timod STREAMS module */
#define ACE_HAS_TIMOD_H 1
+
// Platform supports STREAM pipes
// This is possible, but not by default - need to rebuild the kernel to
// get them enabled - see pipe(2) and "STREAMS/UX for the HP 9000"
// #define ACE_HAS_STREAM_PIPES
+
/////////////////////////////////////////////////////////////////////////
//
// TLI/XTI information
//
////////////////////////////////////////////////////////////////////////
+
// Platform supports XTI (includes TLI).
#define ACE_HAS_XTI
// HP-UX 11 conforms to the XPG4 spec, which ACE calls broken for the
@@ -305,6 +398,7 @@
#define ACE_HAS_CONFLICTING_XTI_MACROS
/* Platform provides <sys/xti.h> header */
#define ACE_HAS_SYS_XTI_H 1
+
/////////////////////////////////////////////////////////////////////////
//
// Threads information.
@@ -315,6 +409,7 @@
// on HP-UX 11, as opposed to 10.x where it was optional software.
//
////////////////////////////////////////////////////////////////////////
+
#if defined (ACE_HAS_THREADS)
# if (ACE_HAS_THREADS == 0)
# undef ACE_HAS_THREADS
@@ -322,10 +417,13 @@
#else
# define ACE_HAS_THREADS
#endif /* ACE_HAS_THREADS */
+
#if defined (ACE_HAS_THREADS)
+
# if !defined (ACE_MT_SAFE)
# define ACE_MT_SAFE 1
# endif
+
// HP-UX doesn't define _POSIX_THREADS since it doesn't implement all
// features (lacks thread priority inheritance and protection), so
// config-posix.h doesn't get this one...
@@ -338,11 +436,15 @@
# define ACE_HAS_THREAD_SPECIFIC_STORAGE
# define ACE_LACKS_PTHREAD_ATTR_SETSTACK
#endif /* ACE_HAS_THREADS */
+
#define ACE_HAS_POSIX_SEM
+
// Platform has POSIX terminal interface.
#define ACE_HAS_TERMIOS
+
// gethostbyaddr does not handle IPv6-mapped-IPv4 addresses
#define ACE_HAS_BROKEN_GETHOSTBYADDR_V4MAPPED
+
#include /**/ "ace/post.h"
#endif /* ACE_CONFIG_H */
diff --git a/dep/ACE_wrappers/ace/config-icc-common.h b/dep/ACE_wrappers/ace/config-icc-common.h
index a969f016c4e..290d2b60fc6 100644
--- a/dep/ACE_wrappers/ace/config-icc-common.h
+++ b/dep/ACE_wrappers/ace/config-icc-common.h
@@ -1,9 +1,11 @@
// -*- C++ -*-
//
// $Id: config-icc-common.h 81935 2008-06-12 22:01:53Z jtc $
+
#ifndef ACE_LINUX_ICC_COMMON_H
#define ACE_LINUX_ICC_COMMON_H
#include /**/ "ace/pre.h"
+
# define ACE_HAS_CPLUSPLUS_HEADERS
# define ACE_HAS_STDCPP_STL_INCLUDES
# define ACE_HAS_TEMPLATE_TYPEDEFS
@@ -11,6 +13,7 @@
# define ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR
# define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1
# define ACE_HAS_STRING_CLASS
+
#if defined (ACE_HAS_CUSTOM_EXPORT_MACROS) && ACE_HAS_CUSTOM_EXPORT_MACROS == 0
# undef ACE_HAS_CUSTOM_EXPORT_MACROS
# if defined (ACE_GCC_HAS_TEMPLATE_INSTANTIATION_VISIBILITY_ATTRS)
@@ -23,6 +26,7 @@
# endif /* !ACE_HAS_CUSTOM_EXPORT_MACROS */
# define ACE_Proper_Export_Flag __attribute__ ((visibility("default")))
# define ACE_Proper_Import_Flag __attribute__ ((visibility("default")))
+
# if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2))
// Sadly, G++ 4.x silently ignores visibility attributes on
// template instantiations, which breaks singletons.
@@ -36,6 +40,7 @@
# define ACE_GCC_HAS_TEMPLATE_INSTANTIATION_VISIBILITY_ATTRS 1
# endif
# endif
+
# if defined (ACE_GCC_HAS_TEMPLATE_INSTANTIATION_VISIBILITY_ATTRS) && ACE_GCC_HAS_TEMPLATE_INSTANTIATION_VISIBILITY_ATTRS == 1
# define ACE_EXPORT_SINGLETON_DECLARATION(T) template class ACE_Proper_Export_Flag T
# define ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) template class ACE_Proper_Export_Flag SINGLETON_TYPE <CLASS, LOCK>;
@@ -49,11 +54,13 @@
template class SINGLETON_TYPE<CLASS, LOCK>; \
_Pragma ("GCC visibility pop")
# endif /* ACE_GCC_HAS_TEMPLATE_INSTANTIATION_VISIBILITY_ATTRS */
+
// Note that the "__extension__" is needed to prevent g++ from issuing
// an error when using its "-pedantic" command line flag.
# define ACE_IMPORT_SINGLETON_DECLARATION(T) __extension__ extern template class T
# define ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) __extension__ extern template class SINGLETON_TYPE<CLASS, LOCK>;
#endif /* ACE_HAS_CUSTOM_EXPORT_MACROS == 0 */
+
// __EXCEPTIONS is defined with -fexceptions, the egcs default. It
// is not defined with -fno-exceptions, the ACE default for g++.
// ACE_HAS_EXCEPTIONS is defined in
@@ -62,12 +69,15 @@
# if defined (__EXCEPTIONS) && !defined (ACE_HAS_EXCEPTIONS)
# define ACE_HAS_EXCEPTIONS
# endif /* __EXCEPTIONS && ! ACE_HAS_EXCEPTIONS */
+
# if defined (ACE_HAS_EXCEPTIONS)
# define ACE_NEW_THROWS_EXCEPTIONS
# endif /* ACE_HAS_EXCEPTIONS */
+
#if (defined (i386) || defined (__i386__)) && !defined (ACE_SIZEOF_LONG_DOUBLE)
# define ACE_SIZEOF_LONG_DOUBLE 12
#endif /* i386 */
+
#if !defined (__MINGW32__) && (defined (i386) || defined (__i386__))
// If running an Intel, assume that it's a Pentium so that
// ACE_OS::gethrtime () can use the RDTSC instruction. If running a
@@ -76,23 +86,29 @@
// protection, so it can be ignored.)
# define ACE_HAS_PENTIUM
#endif /* i386 */
+
#if (defined (ACE_HAS_PENTIUM) || defined (__amd64__) || defined (__x86_64__))
# define ACE_HAS_INTEL_ASSEMBLY
#endif
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
// We define it with a -D with make depend.
# define ACE_LACKS_PRAGMA_ONCE
#endif /* ! ACE_LACKS_PRAGMA_ONCE */
+
#define ACE_TEMPLATES_REQUIRE_SOURCE
+
#if (__INTEL_COMPILER >= 910)
# define ACE_EXPLICIT_TEMPLATE_DESTRUCTOR_TAKES_ARGS
#endif
+
#if defined (__ia64)
# define ACE_HAS_IA64INTRIN_H
# define ACE_HAS_INTRINSIC_INTERLOCKED
#else
# define ACE_HAS_IA32INTRIN_H
#endif
+
#include /**/ "ace/post.h"
#endif /* ACE_LINUX_ICC_COMMON_H */
diff --git a/dep/ACE_wrappers/ace/config-integritySCA.h b/dep/ACE_wrappers/ace/config-integritySCA.h
index ceea3389eef..195027f94ec 100644
--- a/dep/ACE_wrappers/ace/config-integritySCA.h
+++ b/dep/ACE_wrappers/ace/config-integritySCA.h
@@ -1,6 +1,8 @@
// -*- C++ -*-
+
#ifndef ACE_INT_CONFIG_H
#define ACE_INT_CONFIG_H
+
/*
* This config.h file is for version 4.0.x of the
* Integrity RTOS with SCA from Green Hills Software
@@ -8,6 +10,7 @@
*
* $Id: config-integritySCA.h 81935 2008-06-12 22:01:53Z jtc $
*/
+
#define ghs
/* compilation defines */
#define ACE_LACKS_GETPGID
@@ -22,6 +25,7 @@
#define ACE_LACKS_GETUID
#define ACE_LACKS_GETEGID
#define ACE_LACKS_GETGID
+
#ifndef ACE_HAS_EXCEPTIONS
#define ACE_HAS_EXCEPTIONS
#endif
@@ -33,17 +37,24 @@
#define ACE_NEEDS_FUNC_DEFINITIONS
#define _REENTRANT
#define ACE_MT_SAFE 1
+
// Compiler/platform has correctly prototyped header files.
#define ACE_HAS_CPLUSPLUS_HEADERS
+
#define ACE_HAS_SHM_OPEN
+
/***** Operating System Defines *****/
+
/***** ANSI defines *****/
#define ACE_LACKS_TEMPNAM /* believe it or not, this is ANSI C */
#define ACE_HAS_STRERROR
+
#define ACE_LACKS_SENDMSG
+
/***** End Stack Defines *****/
+
/* SCA STUFF */
#if defined(INTEGRITY_VERSION) && (INTEGRITY_VERSION >= 40108)
#define ACE_HAS_SIG_ATOMIC_T
@@ -56,16 +67,22 @@
#define ACE_HAS_SIG_C_FUNC
#define ACE_LACKS_SI_ADDR
#define ACE_HAS_AIO_CALLS
+
#define ACE_HAS_POSIX_NONBLOCK
#define ACE_HAS_DIRENT
+
#define ACE_HAS_THREADS
+
#define ACE_HAS_PTHREADS
/***** End Threading Defines *****/
+
/***** Hardware Defines *****/
#define ACE_PAGE_SIZE 4096
/***** End Hardware Defines *****/
+
/****** SYSV_IPC STUFF *****/
#define ACE_LACKS_KEY_T
+
/****** Posix Defines *****/
#define ACE_LACKS_WAIT
#define ACE_LACKS_WAITPID
@@ -125,9 +142,11 @@
#define ACE_LACKS_GETOPT
/* below refers to fcntl style locking */
#define ACE_LACKS_FILELOCKS
+
#define ACE_LACKS_REALPATH
#define ACE_HAS_CONST_CHAR_SWAB
#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES
+
/***** Not tied to standards AFAIK ****/
#define ACE_LACKS_MADVISE /* paging optimization not needed with INTEGRITY */
#define ACE_LACKS_MALLOC_H /* netbsd's just includes stdlib.h */
@@ -145,20 +164,28 @@
#define ACE_LACKS_POLL_H
#define ACE_LACKS_SYS_SHM_H
#define ACE_LACKS_TERMIOS_H
+
/***** STUFF INTEGRITY 4.0.8 APPEARS TO SUPPORT ****/
/* note, possibly untested with ace */
+
/***** TAO STUFF ****/
#define TAO_USE_DOTTED_DECIMAL_ADDRESSES 1
+
#include <INTEGRITY.h>
+
#include <time.h>
+
typedef void (*__sighandler_t)(int);
+
extern "C"
{
inline int isatty(int) { return 0; }
}
+
#ifdef ppc
#define ACE_HAS_POWERPC_TIMER
#endif
+
/* MIKEC Addtions */
#define ACE_HAS_NONCONST_SELECT_TIMEVAL
#include <sys/uio.h> // needed to define iovec
@@ -182,10 +209,13 @@ extern "C"
#define ACE_THR_PRI_OTHER_DEF 127
#define ACE_PTHREAD_RETURN_ON_EXIT
#undef ACE_LACKS_UNLINK
+
#define ACE_HAS_TIMED_MESSAGE_BLOCKS
+
extern "C" {
int unlink(const char *);
}
+
#define ACE_LACKS_SETSID
#define ACE_HAS_VOIDPTR_GETTIMEOFDAY
#define ACE_LACKS_UNIX_SYSLOG
@@ -193,9 +223,12 @@ int unlink(const char *);
#define ACE_LACKS_SEEKDIR
#define ACE_LACKS_GETHOSTENT
+
/* end MIKEC Addtions */
+
// Hack to avoid ensure that things defined in ind_io.h
// have the right linkage
#include <unistd.h>
+
#endif /* ACE_CONFIG_H */
diff --git a/dep/ACE_wrappers/ace/config-irix6.5.x-sgic++.h b/dep/ACE_wrappers/ace/config-irix6.5.x-sgic++.h
index a7ed81d037a..a47126ff5f2 100644
--- a/dep/ACE_wrappers/ace/config-irix6.5.x-sgic++.h
+++ b/dep/ACE_wrappers/ace/config-irix6.5.x-sgic++.h
@@ -1,14 +1,19 @@
// -*- C++ -*-
// $Id: config-irix6.5.x-sgic++.h 80826 2008-03-04 14:51:23Z wotte $
+
// Use this file for IRIX 6.5.x
+
#ifndef ACE_CONFIG_IRIX65X_H
#define ACE_CONFIG_IRIX65X_H
#include /**/ "ace/pre.h"
+
// Include IRIX 6.[234] configuration
#include "ace/config-irix6.x-sgic++.h"
+
// Irix 6.5 man pages show that they exist
#undef ACE_LACKS_CONDATTR_PSHARED
#undef ACE_LACKS_MUTEXATTR_PSHARED
+
#include /**/ "ace/post.h"
#endif /* ACE_CONFIG_IRIX65X_H */
diff --git a/dep/ACE_wrappers/ace/config-irix6.x-common.h b/dep/ACE_wrappers/ace/config-irix6.x-common.h
index 63a1c906c1f..ab5413412c1 100644
--- a/dep/ACE_wrappers/ace/config-irix6.x-common.h
+++ b/dep/ACE_wrappers/ace/config-irix6.x-common.h
@@ -9,20 +9,27 @@
// get reliable operation with multi-threading and exceptions.
// Specifically you should get a reasonable current IRIX, Compiler
// and POSIX patch-sets.
+
// For IRIX 6.[34] it's less critical, but it's still recommended
// that you apply the applicable patch-sets (IRIX and Compiler I believe).
+
// These patches are updated frequently, so you should ask your support
// contact or search SGI's web site (http://www.sgi.com) for the latest
// version.
+
// Use this file for IRIX 6.[234] if you have the pthreads patches
// installed.
+
#ifndef ACE_CONFIG_IRIX6X_COMMON_H
+
#ifndef IRIX6
# define IRIX6
#endif
+
#if ! defined(ACE_CONFIG_H)
#error "This file may only be included by config-irix6.x-sgic++.h, config-irix6.x-kcc.h or config-irix6.x-g++.h"
#endif
+
// The Irix 6.x float.h doesn't allow us to distinguish between a
// double and a long double. So, we have to hard-code this. Thanks
// to Bob Laferriere <laferrie@gsao.med.ge.com> for figuring it out.
@@ -42,93 +49,130 @@
#else
# define ACE_SIZEOF_LONG_DOUBLE 8 /* 5.3 System */
#endif
+
// petern, Next part of it:
+
// Platform supports getpagesize() call.
#define ACE_HAS_GETPAGESIZE
+
// Platform has no implementation of pthread_condattr_setpshared(),
// even though it supports pthreads! (like Irix 6.2)
#define ACE_LACKS_CONDATTR_PSHARED
#define ACE_LACKS_MUTEXATTR_PSHARED
+
#define ACE_LACKS_SUSECONDS_T
+
// Platform/compiler has the sigwait(2) prototype
#define ACE_HAS_SIGWAIT
#define ACE_HAS_SIGTIMEDWAIT
#define ACE_HAS_SIGSUSPEND
+
// Platform supports System V IPC (most versions of UNIX, but not Win32)
#define ACE_HAS_SYSV_IPC
+
// Platform requires void * for mmap().
#define ACE_HAS_VOIDPTR_MMAP
+
// Platform supports recvmsg and sendmsg.
#define ACE_HAS_MSG
+
// Compiler/platform contains the <sys/syscall.h> file.
#define ACE_HAS_SYS_SYSCALL_H
+
// Compiler/platform supports alloca()
// Although ACE does have alloca() on this compiler/platform combination, it is
// disabled by default since it can be dangerous. Uncomment the following line
// if you ACE to use it.
//#define ACE_HAS_ALLOCA
+
// Compiler/platform has <alloca.h>
#define ACE_HAS_ALLOCA_H
+
// Irix needs to define bzero() in this odd file <bstring.h>
#define ACE_HAS_BSTRING
+
// Compiler/platform has the getrusage() system call.
#define ACE_HAS_GETRUSAGE
+
// Platform supports POSIX O_NONBLOCK semantics.
#define ACE_HAS_POSIX_NONBLOCK
+
// Compiler/platform has correctly prototyped header files.
#define ACE_HAS_CPLUSPLUS_HEADERS
+
// Platform contains <poll.h>.
#define ACE_HAS_POLL
+
// Platform supports the /proc file system.
#define ACE_HAS_PROC_FS
+
// Compiler/platform defines the sig_atomic_t typedef.
#define ACE_HAS_SIG_ATOMIC_T
+
// Platform supports SVR4 extended signals.
#define ACE_HAS_SIGINFO_T
#define ACE_HAS_UCONTEXT_T
+
// Compiler supports the ssize_t typedef.
#define ACE_HAS_SSIZE_T
+
// Platform supports STREAMS.
#define ACE_HAS_STREAMS
+
// Compiler/platform supports strerror ().
#define ACE_HAS_STRERROR
+
// Compiler/platform supports struct strbuf.
#define ACE_HAS_STRBUF_T
+
// Compiler/platform supports SVR4 dynamic linking semantics.
#define ACE_HAS_SVR4_DYNAMIC_LINKING
+
// Platform provides <sys/filio.h> header.
#define ACE_HAS_SYS_FILIO_H
+
// Compiler/platform defines a union semun for SysV shared memory.
#define ACE_HAS_SEMUN
+
// Platform supports IP multicast
#define ACE_HAS_IP_MULTICAST
#ifdef ACE_LACKS_PERFECT_MULTICAST_FILTERING
#undef ACE_LACKS_PERFECT_MULTICAST_FILTERING
#endif
#define ACE_LACKS_PERFECT_MULTICAST_FILTERING 1
+
//**************************************************************
// Not so sure how next lines should look like
+
// Platform supports POSIX timers via timestruc_t.
#define ACE_HAS_POSIX_TIME
+
//**************************************************************
+
// IRIX 6.4 and below do not support reentrant netdb functions
// (getprotobyname_r, getprotobynumber_r, gethostbyaddr_r,
// gethostbyname_r, getservbyname_r).
#if (ACE_IRIX_VERS <= 64) && !defined (ACE_HAS_NETDB_REENTRANT_FUNCTIONS)
#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS
#endif /* ACE_HAS_NETDB_REENTRANT_FUNCTIONS */
+
#define ACE_HAS_DIRENT
// Unless the thread enabled version is used the readdir_r interface
// does not get defined in IRIX 6.2
#define ACE_LACKS_READDIR_R
#define ACE_LACKS_RWLOCK_T
+
#define ACE_HAS_GPERF
+
#define ACE_HAS_NONCONST_SELECT_TIMEVAL
#define ACE_HAS_BROKEN_DGRAM_SENDV
+
#define ACE_LACKS_PLACEMENT_OPERATOR_DELETE
#define ACE_PI_CONTROL_BLOCK_ALIGN_LONGS 2
+
// Platform has POSIX terminal interface.
#define ACE_HAS_TERMIOS
+
// IRIX 6.5 supports AIO
#define ACE_HAS_AIO_CALLS
#define ACE_POSIX_AIOCB_PROACTOR
@@ -139,53 +183,76 @@
#define ACE_HAS_SYSENT_H
#define ACE_HAS_SYSINFO
#define ACE_HAS_SYS_SYSTEMINFO_H
+
// Platform has support for multi-byte character support compliant
// with the XPG4 Worldwide Portability Interface wide-character
// classification.
#define ACE_HAS_XPG4_MULTIBYTE_CHAR
+
// We need to setup a very high address or Naming_Test won't run.
#define ACE_DEFAULT_BASE_ADDR ((char *) (1024U * 1024 * 1024))
+
#define ACE_LACKS_SIGNED_CHAR
+
// Platform supports reentrant functions (i.e., all the POSIX *_r
// functions).
#define ACE_HAS_REENTRANT_FUNCTIONS
+
// Optimize ACE_Handle_Set for select().
#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT
+
// Platform does not support reentrant password file accessor functiions.
#define ACE_LACKS_PWD_REENTRANT_FUNCTIONS
+
// uses ctime_r & asctime_r with only two parameters vs. three
#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R
+
// Prototypes for both signal() and struct sigaction are consistent.
#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES
+
#define ACE_HAS_UALARM
+
// Scheduling functions are declared in <sched.h>
#define ACE_NEEDS_SCHED_H
+
// Compile using multi-thread libraries by default
#if !defined (ACE_MT_SAFE)
#define ACE_MT_SAFE 1
#endif /* ACE_MT_SAFE */
+
#if (ACE_MT_SAFE != 0)
+
// Add threading support
+
#define ACE_HAS_IRIX62_THREADS
+
// Needed for the threading stuff?
#include /**/ <task.h>
#define PTHREAD_MIN_PRIORITY PX_PRIO_MIN
#define PTHREAD_MAX_PRIORITY PX_PRIO_MAX
+
// ACE supports threads.
#define ACE_HAS_THREADS
+
// Platform has no implementation of pthread_condattr_setpshared(),
// even though it supports pthreads! (like Irix 6.2)
#define ACE_LACKS_CONDATTR_PSHARED
#define ACE_LACKS_MUTEXATTR_PSHARED
+
// IRIX 6.2 supports a variant of POSIX Pthreads, supposedly POSIX 1c
#define ACE_HAS_PTHREADS
+
// Compiler/platform has thread-specific storage
#define ACE_HAS_THREAD_SPECIFIC_STORAGE
+
// The pthread_cond_timedwait call does not reset the timer.
#define ACE_LACKS_COND_TIMEDWAIT_RESET 1
+
// When threads are enabled READDIR_R is supported on IRIX.
#undef ACE_LACKS_READDIR_R
+
#endif /* (ACE_MT_SAFE == 0) */
+
#endif /* ACE_CONFIG_IRIX6X_COMMON_H */
diff --git a/dep/ACE_wrappers/ace/config-irix6.x-g++.h b/dep/ACE_wrappers/ace/config-irix6.x-g++.h
index ca25e0bd1ea..91276bdbaad 100644
--- a/dep/ACE_wrappers/ace/config-irix6.x-g++.h
+++ b/dep/ACE_wrappers/ace/config-irix6.x-g++.h
@@ -1,18 +1,24 @@
/* -*- C++ -*- */
// $Id: config-irix6.x-g++.h 80826 2008-03-04 14:51:23Z wotte $
+
// The following configuration file is designed to work for the SGI
// Indigo2EX running Irix 6.2 platform using the GNU C++ Compiler
+
#ifndef ACE_CONFIG_H
#define ACE_CONFIG_H
#include /**/ "ace/pre.h"
+
// config-g++-common.h undef's ACE_HAS_STRING_CLASS with -frepo, so
// this must appear before its #include.
#define ACE_HAS_STRING_CLASS
+
#include "ace/config-g++-common.h"
#include "ace/config-irix6.x-common.h"
+
// Denotes that GNU has cstring.h as standard
// which redefines memchr()
#define ACE_HAS_GNU_CSTRING_H
+
#include /**/ "ace/post.h"
#endif /* ACE_CONFIG_H */
diff --git a/dep/ACE_wrappers/ace/config-irix6.x-sgic++.h b/dep/ACE_wrappers/ace/config-irix6.x-sgic++.h
index 13b23eb6040..d832995ea8c 100644
--- a/dep/ACE_wrappers/ace/config-irix6.x-sgic++.h
+++ b/dep/ACE_wrappers/ace/config-irix6.x-sgic++.h
@@ -1,29 +1,37 @@
/* -*- C++ -*- */
// $Id: config-irix6.x-sgic++.h 81935 2008-06-12 22:01:53Z jtc $
+
// Use this file for IRIX 6.[234] if you have the pthreads patches
// installed.
+
#ifndef ACE_CONFIG_H
#define ACE_CONFIG_H
#include /**/ "ace/pre.h"
+
#include "ace/config-irix6.x-common.h"
+
// This is the config file for IRIX 6.2, 6.4 and hopefully 6.3, using
// the SGI C++ compiler (7.1 or higher).
+
// The following three should be enabled/disabled together.
#if _COMPILER_VERSION < 720
#define ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA
#endif /* _COMPILER_VERSION < 720 */
#define ACE_TEMPLATES_REQUIRE_SOURCE
#define ACE_NEEDS_FUNC_DEFINITIONS
+
// Platform supports STREAM pipes (note that this is disabled by
// default, see the manual page on pipe(2) to find out how to enable
// it).
// #define ACE_HAS_STREAM_PIPES
+
#if defined (_COMPILER_VERSION)
# define ACE_CC_NAME ACE_TEXT ("SGI/MIPSPro")
# define ACE_CC_MAJOR_VERSION (_COMPILER_VERSION / 100)
# define ACE_CC_MINOR_VERSION (_COMPILER_VERSION % 100)
# define ACE_CC_BETA_VERSION (0)
#endif /* _COMPILER_VERSION */
+
#include /**/ "ace/post.h"
#endif /* ACE_CONFIG_H */
diff --git a/dep/ACE_wrappers/ace/config-linux-common.h b/dep/ACE_wrappers/ace/config-linux-common.h
index a0dda28c282..6743c53adfc 100644
--- a/dep/ACE_wrappers/ace/config-linux-common.h
+++ b/dep/ACE_wrappers/ace/config-linux-common.h
@@ -1,35 +1,46 @@
/* -*- C++ -*- */
// $Id: config-linux-common.h 82516 2008-08-05 19:22:59Z shuston $
+
// Do not use this configuration file directly since it's designed to
// be included by another, specific configuration file, such as
// config-linux.h. It provides config information common to all Linux
// platforms. It automatically determines the CPU architecture,
// compiler (g++ or egcs), and libc (libc5 or glibc), and configures
// based on those.
+
#ifndef ACE_LINUX_COMMON_H
#define ACE_LINUX_COMMON_H
#include /**/ "ace/pre.h"
+
#define ACE_HAS_BYTESEX_H
+
#if ! defined (__ACE_INLINE__)
#define __ACE_INLINE__
#endif /* ! __ACE_INLINE__ */
+
// Needed to differentiate between libc 5 and libc 6 (aka glibc).
#include <features.h>
+
#if (defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) >= 500)
# define ACE_HAS_PTHREADS_UNIX98_EXT
#endif /* _XOPEN_SOURCE - 0 >= 500 */
+
#if !defined (ACE_LACKS_LINUX_NPTL)
+
# include "ace/config-posix.h"
+
// Temporary fix because NPTL kernels do have shm_open but there is a problem
// with shm_open/shm_unlink pairing in ACE which needs to be fixed when I have time.
# if defined (ACE_HAS_SHM_OPEN)
# undef ACE_HAS_SHM_OPEN
# endif /* ACE_HAS_SHM_OPEN */
+
# if defined (ACE_USES_FIFO_SEM)
// Don't use this for Linux NPTL since this has complete
// POSIX semaphores which are more efficient
# undef ACE_USES_FIFO_SEM
# endif /* ACE_USES_FIFO_SEM */
+
# if defined (ACE_HAS_POSIX_SEM)
// Linux NPTL may not define the right POSIX macro
// but they have the actual runtime support for this stuff
@@ -38,7 +49,9 @@
# endif /* !ACE_HAS_POSIX_SEM_TIMEOUT && (((_POSIX_C_SOURCE - 0) >= 200112L) || (_XOPEN_SOURCE >= 600)) */
# endif /* ACE_HAS_POSIX_SEM */
#endif /* !ACE_LACKS_LINUX_NPTL */
+
// First the machine specific part
+
#if defined (__powerpc__) || defined (__x86_64__)
# if !defined (ACE_DEFAULT_BASE_ADDR)
# define ACE_DEFAULT_BASE_ADDR ((char *) 0x40000000)
@@ -50,7 +63,9 @@
# define ACE_DEFAULT_BASE_ADDR ((char *) 0x0000000000000000)
# endif /* ! ACE_DEFAULT_BASE_ADDR */
#endif /* ! __powerpc__ && ! __ia64 */
+
// Then glibc/libc5 specific parts
+
#if defined(__GLIBC__)
# if (__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 1)
# define ACE_HAS_NONCONST_SETRLIMIT
@@ -61,10 +76,12 @@
# endif
# define ACE_HAS_SOCKLEN_T
# define ACE_HAS_4_4BSD_SENDMSG_RECVMSG
+
// glibc defines both of these, used in OS_String.
# if defined (_GNU_SOURCE)
# define ACE_HAS_STRNLEN
# define ACE_HAS_WCSNLEN
+
// This is probably not a 100%-sure-fire check... Red Hat Linux 9
// and Enterprise Linux 3 and up have a new kernel that can send signals
// across threads. This was not possible prior because there was no real
@@ -75,23 +92,28 @@
// for most Linux platforms at this time. But we'll start to crawl...
# define ACE_POSIX_SIG_PROACTOR
# endif
+
// To avoid the strangeness with Linux's ::select (), which modifies
// its timeout argument, use ::poll () instead.
# define ACE_HAS_POLL
+
// Don't define _XOPEN_SOURCE and _XOPEN_SOURCE_EXTENDED in ACE to make
// getpgid() prototype visible. ACE shouldn't depend on feature test
// macros to make prototypes visible.
# define ACE_LACKS_GETPGID_PROTOTYPE
+
// @note the following defines are necessary with glibc 2.0 (0.961212-5)
// on Alpha. I assume that they're necessary on Intel as well,
// but that may depend on the version of glibc that is used.
//# define ACE_HAS_DLFCN_H_BROKEN_EXTERN_C
# define ACE_HAS_VOIDPTR_SOCKOPT
+
// Don't define _POSIX_SOURCE in ACE to make strtok() prototype
// visible. ACE shouldn't depend on feature test macros to make
// prototypes visible.
# define ACE_LACKS_STRTOK_R_PROTOTYPE
// @note end of glibc 2.0 (0.961212-5)-specific configuration.
+
# if __GLIBC__ > 1 && __GLIBC_MINOR__ >= 1
// These were suggested by Robert Hanzlik <robi@codalan.cz> to get
// ACE to compile on Linux using glibc 2.1 and libg++/gcc 2.8.
@@ -99,6 +121,7 @@
# define ACE_HAS_SIGINFO_T
# define ACE_LACKS_SIGINFO_H
# define ACE_HAS_UCONTEXT_T
+
// Pre-glibc (RedHat 5.2) doesn't have sigtimedwait.
# define ACE_HAS_SIGTIMEDWAIT
# endif /* __GLIBC__ 2.1+ */
@@ -107,6 +130,7 @@
# define ACE_LACKS_MADVISE
# define ACE_LACKS_MSG_ACCRIGHTS
#endif /* ! __GLIBC__ */
+
// Don't define _LARGEFILE64_SOURCE in ACE to make llseek() or
// lseek64() prototype visible. ACE shouldn't depend on feature test
// macros to make prototypes visible.
@@ -119,6 +143,7 @@
# define ACE_LACKS_LSEEK64_PROTOTYPE
# endif
#endif /* __GLIBC__ > 1 */
+
#if __GLIBC__ > 1 && __GLIBC_MINOR__ >= 1
# define ACE_HAS_P_READ_WRITE
# define ACE_LACKS_PREAD_PROTOTYPE
@@ -126,12 +151,15 @@
// system cuserid() is discouraged.
# define ACE_HAS_ALT_CUSERID
#endif /* __GLIBC__ > 1 && __GLIBC_MINOR__ >= 0 */
+
#if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)
# define ACE_HAS_ISASTREAM_PROTOTYPE
# define ACE_HAS_PTHREAD_SIGMASK_PROTOTYPE
# define ACE_HAS_CPU_SET_T
#endif /* __GLIBC__ > 2 || __GLIBC__ === 2 && __GLIBC_MINOR__ >= 3) */
+
// Then the compiler specific parts
+
#if defined (__INTEL_COMPILER)
# include "ace/config-icc-common.h"
#elif defined (__GNUG__)
@@ -176,130 +204,177 @@
# error unsupported compiler in ace/config-linux-common.h
# endif /* __cplusplus */
#endif /* ! __GNUG__*/
+
// Completely common part :-)
+
// Platform/compiler has the sigwait(2) prototype
# define ACE_HAS_SIGWAIT
+
# define ACE_HAS_SIGSUSPEND
+
# define ACE_HAS_UALARM
+
#if __GLIBC__ >= 2
#ifndef ACE_HAS_POSIX_REALTIME_SIGNALS
#define ACE_HAS_POSIX_REALTIME_SIGNALS
#endif /* ACE_HAS_POSIX_REALTIME_SIGNALS */
+
#ifndef ACE_HAS_AIO_CALLS
#define ACE_HAS_AIO_CALLS
#endif /* ACE_HAS_AIO_CALLS */
#endif
+
#if __GLIBC__ >= 2
// glibc 2 and higher has wchar support
# define ACE_HAS_XPG4_MULTIBYTE_CHAR
# define ACE_HAS_VFWPRINTF
#endif
+
#if __GLIBC__ < 2
// These are present in glibc 2 and higher
# define ACE_LACKS_WCSTOK
# define ACE_LACKS_WCSDUP_PROTOTYPE
#endif /* __GLIBC__ < 2 */
+
#define ACE_LACKS_ITOW
#define ACE_LACKS_WCSICMP
#define ACE_LACKS_WCSNICMP
+
#if __GLIBC__ >= 2
# define ACE_HAS_3_PARAM_WCSTOK
#endif
+
#define ACE_HAS_3_PARAM_READDIR_R
+
#if !defined (ACE_DEFAULT_BASE_ADDR)
# define ACE_DEFAULT_BASE_ADDR ((char *) 0x80000000)
#endif /* ! ACE_DEFAULT_BASE_ADDR */
+
// Compiler/platform supports alloca().
// Although ACE does have alloca() on this compiler/platform combination, it is
// disabled by default since it can be dangerous. Uncomment the following line
// if you ACE to use it.
//#define ACE_HAS_ALLOCA
+
// Compiler/platform has <alloca.h>
#define ACE_HAS_ALLOCA_H
#define ACE_HAS_SYS_SYSINFO_H
#define ACE_HAS_LINUX_SYSINFO
+
// Compiler/platform has the getrusage() system call.
#define ACE_HAS_GETRUSAGE
#define ACE_HAS_GETRUSAGE_PROTOTYPE
+
#define ACE_HAS_BYTESWAP_H
#define ACE_HAS_BSWAP_16
#define ACE_HAS_BSWAP_32
+
#if defined __GNUC__ && __GNUC__ >= 2
# define ACE_HAS_BSWAP_64
#endif
+
#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES
+
// Optimize ACE_Handle_Set for select().
#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT
+
// ONLY define this if you have config'd multicast into a 2.0.34 or
// prior kernel. It is enabled by default in 2.0.35 kernels.
#if !defined (ACE_HAS_IP_MULTICAST)
# define ACE_HAS_IP_MULTICAST
#endif /* ! ACE_HAS_IP_MULTICAST */
+
// At least for IPv4, Linux lacks perfect filtering.
#if !defined ACE_LACKS_PERFECT_MULTICAST_FILTERING
# define ACE_LACKS_PERFECT_MULTICAST_FILTERING 1
#endif /* ACE_LACKS_PERFECT_MULTICAST_FILTERING */
+
#define ACE_HAS_BIG_FD_SET
+
// Linux defines struct msghdr in /usr/include/socket.h
#define ACE_HAS_MSG
+
// Linux "improved" the interface to select() so that it modifies
// the struct timeval to reflect the amount of time not slept
// (see NOTES in Linux's select(2) man page).
#define ACE_HAS_NONCONST_SELECT_TIMEVAL
+
#define ACE_DEFAULT_MAX_SOCKET_BUFSIZ 65535
+
#define ACE_CDR_IMPLEMENT_WITH_NATIVE_DOUBLE 1
+
#define ACE_HAS_GETPAGESIZE 1
+
#if (__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 2)
// glibc supports wchar, but lacks fgetwc and ungetwc
# define ACE_LACKS_FGETWC
# define ACE_HAS_NONCONST_MSGSND
# define ACE_LACKS_STRNLEN_PROTOTYPE
#endif
+
// glibc requires _XOPEN_SOURCE_EXTENDED to make this prototype
// visible, so force ACE to declare one. Yuk!
#ifndef _XOPEN_SOURCE_EXTENDED
# define ACE_LACKS_MKSTEMP_PROTOTYPE
#endif /* !_XOPEN_SOURCE_EXTENDED */
+
// Platform defines struct timespec but not timespec_t
#define ACE_LACKS_TIMESPEC_T
+
// Platform supplies scandir()
#define ACE_HAS_SCANDIR
// Although the scandir man page says otherwise, this setting is correct.
#define ACE_SCANDIR_CMP_USES_CONST_VOIDPTR
+
// A conflict appears when including both <ucontext.h> and
// <sys/procfs.h> with recent glibc headers.
//#define ACE_HAS_PROC_FS
+
// Platform supports System V IPC (most versions of UNIX, but not Win32)
#define ACE_HAS_SYSV_IPC
+
// Compiler/platform contains the <sys/syscall.h> file.
#define ACE_HAS_SYS_SYSCALL_H
+
// Platform/compiler supports global timezone variable.
#define ACE_HAS_TIMEZONE
+
#define ACE_HAS_TIMEZONE_GETTIMEOFDAY
+
// Compiler/platform supports strerror ().
#define ACE_HAS_STRERROR
+
// Don't define _XOPEN_SOURCE in ACE to make strptime() prototype
// visible. ACE shouldn't depend on feature test macros to make
// prototypes visible.
#define ACE_LACKS_STRPTIME_PROTOTYPE
+
// Compiler supports the ssize_t typedef.
#define ACE_HAS_SSIZE_T
+
// Compiler/platform defines the sig_atomic_t typedef.
#define ACE_HAS_SIG_ATOMIC_T
+
// Compiler/platform defines a union semun for SysV shared memory.
#define ACE_HAS_SEMUN
+
#define ACE_HAS_POSIX_TIME
+
#define ACE_HAS_GPERF
+
#define ACE_HAS_DIRENT
+
// Starting with FC9 rawhide this file is not available anymore but
// this define is set
#if defined _XOPEN_STREAMS && _XOPEN_STREAMS == -1
# define ACE_LACKS_STROPTS_H
# define ACE_LACKS_STRRECVFD
#endif
+
#if !defined (ACE_LACKS_STROPTS_H)
# define ACE_HAS_STRBUF_T
#endif
+
#if defined (__ia64) || defined(__alpha) || defined (__x86_64__)
// On 64 bit platforms, the "long" type is 64-bits. Override the
// default 32-bit platform-specific format specifiers appropriately.
@@ -307,20 +382,27 @@
# define ACE_SSIZE_T_FORMAT_SPECIFIER ACE_TEXT ("%ld")
# define ACE_SIZE_T_FORMAT_SPECIFIER ACE_TEXT ("%lu")
#endif /* __ia64 */
+
#define ACE_SIZEOF_WCHAR 4
+
#define ACE_LACKS_GETIPNODEBYADDR
#define ACE_LACKS_GETIPNODEBYNAME
+
// Platform has POSIX terminal interface.
#define ACE_HAS_TERMIOS
+
// Linux implements sendfile().
#define ACE_HAS_SENDFILE
+
#define ACE_HAS_VOIDPTR_MMAP
+
#if defined (ACE_LACKS_NETWORKING)
# include "ace/config-posix-nonetworking.h"
#else
# define ACE_HAS_NETLINK
# define ACE_HAS_GETIFADDRS
#endif
+
#if !defined (ACE_GETNAME_RETURNS_RANDOM_SIN_ZERO)
// Detect if getsockname() and getpeername() returns random values in
// the sockaddr_in::sin_zero field by evaluation of the kernel
@@ -334,6 +416,7 @@
# define ACE_GETNAME_RETURNS_RANDOM_SIN_ZERO 1
# endif /* (LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,47)) */
#endif /* ACE_GETNAME_RETURNS_RANDOM_SIN_ZERO */
+
#if defined (ACE_HAS_EVENT_POLL)
// The sys_epoll interface was introduced in Linux kernel 2.5.45.
// Don't support backported versions since they appear to be buggy.
@@ -350,6 +433,7 @@
# endif /* LINUX_VERSION_CODE < KERNEL_VERSION (2,5,45) */
#endif /* ACE_HAS_EVENT_POLL */
#endif
+
#if !defined (ACE_HAS_EVENT_POLL) && !defined (ACE_HAS_DEV_POLL)
# if !defined (ACE_LACKS_LINUX_VERSION_H)
# include <linux/version.h>
@@ -358,6 +442,8 @@
# define ACE_HAS_EVENT_POLL
# endif
#endif
+
#include /**/ "ace/post.h"
+
#endif /* ACE_LINUX_COMMON_H */
diff --git a/dep/ACE_wrappers/ace/config-linux.h b/dep/ACE_wrappers/ace/config-linux.h
index dfa320d5a03..4c5dc3c4bdb 100644
--- a/dep/ACE_wrappers/ace/config-linux.h
+++ b/dep/ACE_wrappers/ace/config-linux.h
@@ -1,24 +1,32 @@
// -*- C++ -*-
//
// $Id: config-linux.h 80826 2008-03-04 14:51:23Z wotte $
+
// The following configuration file is designed to work for Linux
// platforms using GNU C++.
+
#ifndef ACE_CONFIG_LINUX_H
#define ACE_CONFIG_LINUX_H
#include /**/ "ace/pre.h"
+
#define ACE_PLATFORM_CONFIG config-linux.h
+
#include "ace/config-linux-common.h"
+
#define ACE_HAS_SVR4_DYNAMIC_LINKING
#define ACE_HAS_AUTOMATIC_INIT_FINI
#define ACE_HAS_DLSYM_SEGFAULT_ON_INVALID_HANDLE
+
#if !defined (ACE_MT_SAFE)
#define ACE_MT_SAFE 1 // JCEJ 12/22/96 #1
#endif
+
#if ACE_MT_SAFE
// Yes, we do have threads.
#define ACE_HAS_THREADS
// And they're even POSIX pthreads (LinuxThreads implementation)
#define ACE_HAS_PTHREADS
+
// On linux this is part of pthreads
# if (defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 199309L)
# if !defined (ACE_HAS_CLOCK_GETTIME)
@@ -28,31 +36,41 @@
# define ACE_HAS_CLOCK_SETTIME
# endif /* !ACE_HAS_CLOCK_GETTIME */
# endif /* _POSIX_C_SOURCE >= 199309L */
+
#if !defined (ACE_HAS_PTHREADS_UNIX98_EXT)
# define ACE_LACKS_RWLOCK_T
#else
# define ACE_HAS_RECURSIVE_MUTEXES
#endif /* !ACE_HAS_PTHREADS_UNIX98_EXT */
+
#define ACE_HAS_THREAD_SPECIFIC_STORAGE // jcej 12/22/96 #2
+
#define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS // JCEJ 1/7-8/96
+
#if defined(__GLIBC__)
// Platform supports reentrant functions (i.e., all the POSIX *_r
// functions).
#define ACE_HAS_REENTRANT_FUNCTIONS
+
#if (__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 1)
// Older versions of glibc lacked reentrant netdb functions
# define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS
+
// glibc < 2.1 lacks pthread_attr_setstacksize()
# define ACE_LACKS_PTHREAD_ATTR_SETSTACKSIZE
#endif /* (__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 1) */
+
// uses ctime_r & asctime_r with only two parameters vs. three
#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R
#endif
+
#else
// AIO support pulls in the rt library, which pulls in the pthread
// library. Disable AIO in single-threaded builds.
# undef ACE_HAS_AIO_CALLS
#endif /* ACE_MT_SAFE */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_CONFIG_LINUX_H */
diff --git a/dep/ACE_wrappers/ace/config-lite.h b/dep/ACE_wrappers/ace/config-lite.h
index fea774c648a..5af65ccc557 100644
--- a/dep/ACE_wrappers/ace/config-lite.h
+++ b/dep/ACE_wrappers/ace/config-lite.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file config-lite.h
@@ -14,35 +15,48 @@
* includes added to config-all.h, e.g., OS_main.h.
*/
//==========================================================================
+
#ifndef ACE_CONFIG_LITE_H
#define ACE_CONFIG_LITE_H
+
#include /**/ "ace/pre.h"
+
#include "ace/config-macros.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
// Empty ACE_OS namespace to help identify compiler errors more
// easily. -- @@ Do we really need this?
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
namespace ACE_OS {}
ACE_END_VERSIONED_NAMESPACE_DECL
+
// ============================================================================
// UNICODE macros (to be added later)
// ============================================================================
+
// Get the unicode (i.e. ACE_TCHAR) defines
# include "ace/ace_wchar.h"
+
// ============================================================================
// at_exit declarations
// ============================================================================
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
// Marker for cleanup, used by ACE_Exit_Info.
extern int ace_exit_hook_marker;
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
// For use by <ACE_OS::exit>.
extern "C"
{
typedef void (*ACE_EXIT_HOOK) (void);
}
+
// Signature for registering a cleanup function that is used by the
// ACE_Object_Manager and the ACE_Thread_Manager.
# if defined (ACE_HAS_SIG_C_FUNC)
@@ -52,16 +66,20 @@ typedef void (*ACE_CLEANUP_FUNC)(void *object, void *param) /* throw () */;
# if defined (ACE_HAS_SIG_C_FUNC)
}
# endif /* ACE_HAS_SIG_C_FUNC */
+
// ============================================================================
// log_msg declarations
// ============================================================================
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
# if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS)
typedef int (*ACE_SEH_EXCEPT_HANDLER)(void *);
// Prototype of win32 structured exception handler functions.
// They are used to get the exception handling expression or
// as exception handlers.
# endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */
+
class ACE_OS_Thread_Descriptor;
class ACE_OS_Log_Msg_Attributes;
typedef void (*ACE_INIT_LOG_MSG_HOOK) (ACE_OS_Log_Msg_Attributes &attr
@@ -72,10 +90,15 @@ typedef void (*ACE_INIT_LOG_MSG_HOOK) (ACE_OS_Log_Msg_Attributes &attr
);
typedef void (*ACE_INHERIT_LOG_MSG_HOOK) (ACE_OS_Thread_Descriptor*,
ACE_OS_Log_Msg_Attributes &);
+
typedef void (*ACE_CLOSE_LOG_MSG_HOOK) (void);
+
typedef void (*ACE_SYNC_LOG_MSG_HOOK) (const ACE_TCHAR *prog_name);
+
typedef ACE_OS_Thread_Descriptor *(*ACE_THR_DESC_LOG_MSG_HOOK) (void);
+
ACE_END_VERSIONED_NAMESPACE_DECL
+
/**
* @deprecated ACE_DECLARE_STL_REVERSE_ITERATORS is a crutch to be
* used until all C++ compiler supported by ACE support
@@ -135,6 +158,8 @@ ACE_END_VERSIONED_NAMESPACE_DECL
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
#endif /* _MSC_VER && _WIN64 */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_CONFIG_LITE_H */
diff --git a/dep/ACE_wrappers/ace/config-lynxos.h b/dep/ACE_wrappers/ace/config-lynxos.h
index 137b142078a..baeafa88bb8 100644
--- a/dep/ACE_wrappers/ace/config-lynxos.h
+++ b/dep/ACE_wrappers/ace/config-lynxos.h
@@ -1,20 +1,27 @@
// $Id: config-lynxos.h 81780 2008-05-26 13:56:49Z olli $
+
// The following configuration file is designed to work for LynxOS,
// version 4.0.0 and later, using the GNU g++ compiler.
+
#ifndef ACE_CONFIG_H
#define ACE_CONFIG_H
#include /**/ "ace/pre.h"
+
#if ! defined (__ACE_INLINE__)
# define __ACE_INLINE__
#endif /* ! __ACE_INLINE__ */
+
#if defined (__GNUG__)
# include "ace/config-g++-common.h"
#endif /* __GNUG__ */
+
// Compile using multi-thread libraries.
#if !defined (ACE_MT_SAFE)
# define ACE_MT_SAFE 1
#endif
+
#include "ace/config-posix.h"
+
#if defined (__x86__)
# define ACE_HAS_PENTIUM
#elif defined (__powerpc__)
@@ -24,6 +31,7 @@
// This doesn't work on LynxOS 3.0.0, because it resets the TimeBaseRegister.
// # define ACE_HAS_POWERPC_TIMER
#endif /* __x86__ || __powerpc__ */
+
#define ACE_DEFAULT_BASE_ADDR ((char *) 0)
#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG
#define ACE_HAS_ALLOCA
@@ -95,8 +103,10 @@
#define ACE_PAGE_SIZE 4096
#define ACE_POSIX_SIG_PROACTOR
#define ACE_SCANDIR_CMP_USES_CONST_VOIDPTR
+
// LynxOS has poll.h but it is unusable since implementation is not provided
#define ACE_LACKS_POLL_H
+
#if ACE_MT_SAFE == 1
// Platform supports threads.
# define ACE_HAS_PTHREADS
@@ -109,20 +119,25 @@
# define ACE_LACKS_PTHREAD_ATTR_SETSTACKADDR
# endif
#endif /* ACE_MT_SAFE */
+
#if __GNUC__ < 3
# define ACE_LACKS_NUMERIC_LIMITS
#endif /* __GNUC__ < 3 */
+
// By default, don't include RCS Id strings in object code.
#if !defined (ACE_USE_RCSID)
# define ACE_USE_RCSID 0
#endif /* ! ACE_USE_RCSID */
+
// System include files are not in sys/, this gets rid of warning.
#define __NO_INCLUDE_WARN__
+
// "changes signedness" error (OS.i and many other files)
#define ACE_HAS_SOCKLEN_T
// LSOCK.cpp uses a macro from param.h, not included
#define ALIGNBYTES (sizeof(int) - 1)
#define ALIGN(p) (((unsigned)p + ALIGNBYTES) & ~ALIGNBYTES)
+
#if ACE_LYNXOS_MAJOR == 4 && ACE_LYNXOS_MINOR == 0
# define ACE_LACKS_GETOPT_PROTOTYPE
# define ACE_LACKS_INET_ATON_PROTOTYPE
@@ -132,14 +147,17 @@
# define ACE_LACKS_SYS_SELECT_H
# define ACE_HAS_NONCONST_GETBY
#endif
+
#if (ACE_LYNXOS_MAJOR > 4) || (ACE_LYNXOS_MAJOR == 4 && ACE_LYNXOS_MINOR >= 2)
// LynxOS 4.2 additons
# define ACE_HAS_POSIX_SEM_TIMEOUT
# define ACE_HAS_MUTEX_TIMEOUTS
#endif
+
#if defined (ACE_HAS_SVR4_DYNAMIC_LINKING)
# define ACE_HAS_BROKEN_THREAD_KEYFREE
#endif /* ACE_HAS_SVR4_DYNAMIC_LINKING */
+
#include /**/ "ace/post.h"
#endif /* ACE_CONFIG_H */
diff --git a/dep/ACE_wrappers/ace/config-macosx-leopard.h b/dep/ACE_wrappers/ace/config-macosx-leopard.h
index e567017ceea..ef9ffc59a08 100644
--- a/dep/ACE_wrappers/ace/config-macosx-leopard.h
+++ b/dep/ACE_wrappers/ace/config-macosx-leopard.h
@@ -1,11 +1,15 @@
/* -*- C++ -*- */
// $Id: config-macosx-leopard.h 81858 2008-06-07 03:31:22Z dai_y $
+
// This configuration file is designed to work with the MacOS X operating system.
+
#ifndef ACE_CONFIG_MACOSX_LEOPARD_H
#define ACE_CONFIG_MACOSX_LEOPARD_H
+
#if ! defined (__ACE_INLINE__)
#define __ACE_INLINE__
#endif /* ! __ACE_INLINE__ */
+
#if !defined (ACE_SIZEOF_LONG_DOUBLE)
# if (__GNUC__ == 3 && __GNUC_MINOR__ == 3)
// Size of long double in GCC 3.3 is 8.
@@ -15,14 +19,19 @@
# define ACE_SIZEOF_LONG_DOUBLE 16
# endif // GCC 3.3
#endif // ACE_SIZEOF_LONG_DOUBLE
+
#if defined (__GNUG__)
# include "ace/config-g++-common.h"
#endif /* __GNUG__ */
+
#ifndef ACE_HAS_NONCONST_FD_ISSET
#define ACE_HAS_NONCONST_FD_ISSET
#endif
+
#define ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR
+
#define ACE_SIZE_T_FORMAT_SPECIFIER ACE_TEXT ("%lu")
+
#if !defined (__i386__)
# if defined (ACE_HAS_PENTIUM)
# undef ACE_HAS_PENTIUM
@@ -30,98 +39,140 @@
#else // __i386__
# define ACE_HAS_PENTIUM
#endif //__i386__
+
#if !defined (_THREAD_SAFE)
#define _THREAD_SAFE
#endif /* _THREAD_SAFE */
+
#define ACE_HAS_GPERF
#define ACE_HAS_POSIX_SEM
+
#define ACE_HAS_SUNOS4_GETTIMEOFDAY
+
#define ACE_LACKS_STROPTS_H
+
// Platform provides <execinfo.h> header.
#define ACE_HAS_EXECINFO_H
+
// Wcharness....
#define ACE_HAS_WCHAR
#define ACE_SIZEOF_WCHAR 4
+
#define ACE_HAS_3_PARAM_WCSTOK
#define ACE_LACKS_ITOW
#define ACE_LACKS_WCSICMP
#define ACE_LACKS_WCSNICMP
#define ACE_LACKS_WCSDUP
+
// Mac lacks the following pthread features
#define ACE_LACKS_MUTEXATTR_PSHARED
#define ACE_LACKS_CONDATTR_PSHARED
//
// Compiler/platform defines the sig_atomic_t typedef.
#define ACE_HAS_SIG_ATOMIC_T
+
// Compiler/platform supports SVR4 signal typedef
#define ACE_HAS_SVR4_SIGNAL_T
+
//Platform/compiler has the sigwait(2) prototype
#define ACE_HAS_SIGWAIT
+
#define ACE_HAS_AIO_CALLS
+
//Platform supports sigsuspend()
#define ACE_HAS_SIGSUSPEND
+
//Platform/compiler has macros for sig{empty,fill,add,del}set (e.g., SCO and FreeBSD)
#define ACE_HAS_SIG_MACROS
+
#define ACE_LACKS_GETPGID
#define ACE_LACKS_RWLOCK_T
+
// Optimize ACE_Handle_Set for select().
#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT
+
#define ACE_HAS_NONCONST_SELECT_TIMEVAL
+
//?
#define ACE_LACKS_SIGSET
+
#define ACE_NEEDS_SCHED_H
+
// Use of <malloc.h> is deprecated.
#define ACE_LACKS_MALLOC_H
+
#define ACE_HAS_ALT_CUSERID
+
// Platform supports POSIX timers via struct timespec.
#define ACE_HAS_POSIX_TIME
#define ACE_HAS_UALARM
+
// Platform defines struct timespec but not timespec_t
#define ACE_LACKS_TIMESPEC_T
+
#define ACE_LACKS_STRRECVFD
+
#define ACE_HAS_SOCKADDR_IN6_SIN6_LEN
+
// Platform supports System V IPC (most versions of UNIX, but not Win32)
#define ACE_HAS_SYSV_IPC
+
// Compiler/platform contains the <sys/syscall.h> file.
#define ACE_HAS_SYS_SYSCALL_H
+
#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES
+
// Compiler/platform supports alloca().
// Although ACE does have alloca() on this compiler/platform combination, it is
// disabled by default since it can be dangerous. Uncomment the following line
// if you ACE to use it.
//#define ACE_HAS_ALLOCA
+
// Compiler/platform correctly calls init()/fini() for shared libraries.
#define ACE_HAS_AUTOMATIC_INIT_FINI
+
// platform supports POSIX O_NONBLOCK semantics
#define ACE_HAS_POSIX_NONBLOCK
+
// platform supports IP multicast
#define ACE_HAS_IP_MULTICAST
#define ACE_LACKS_PERFECT_MULTICAST_FILTERING 1
+
// Compiler/platform has the getrusage() system call.
#define ACE_HAS_GETRUSAGE
+
// Compiler supports the ssize_t typedef.
#define ACE_HAS_SSIZE_T
+
// Compiler/platform supports strerror ().
#define ACE_HAS_STRERROR
+
// Compiler/platform provides the sockio.h file.
#define ACE_HAS_SYS_SOCKIO_H
+
// Compiler/platform provides the socklen_t type.
#define ACE_HAS_SOCKLEN_T
+
// Defines the page size of the system.
#define ACE_HAS_GETPAGESIZE
+
// Platform provides <sys/filio.h> header.
#define ACE_HAS_SYS_FILIO_H
+
// Platform/compiler supports timezone * as second parameter to gettimeofday().
#define ACE_HAS_TIMEZONE_GETTIMEOFDAY
+
#define ACE_LACKS_SYS_MSG_H
#define ACE_LACKS_SYSV_MSQ_PROTOS
#define ACE_HAS_MSG
#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG
#define ACE_HAS_NONCONST_MSGSND
+
#if !defined (ACE_MT_SAFE)
# define ACE_MT_SAFE 1
#endif
+
#if ACE_MT_SAFE == 1
// Yes, we do have threads.
# define ACE_HAS_THREADS
@@ -131,14 +182,19 @@
# define ACE_HAS_PTHREAD_SCHEDPARAM
# define ACE_HAS_THREAD_SPECIFIC_STORAGE
#endif /* ACE_MT_SAFE == 1 */
+
#define ACE_LACKS_THREAD_PROCESS_SCOPING
+
#define ACE_HAS_DIRENT
#define ACE_LACKS_POLL_H
#define ACE_LACKS_SEARCH_H
+
#define ACE_LACKS_SETSCHED
//#define ACE_HAS_RECURSIVE_MUTEXES
+
// Platform has POSIX terminal interface.
#define ACE_HAS_TERMIOS
+
#define ACE_HAS_SEMUN
#define ACE_HAS_SIGINFO_T
#define ACE_LACKS_SIGINFO_H
@@ -146,6 +202,7 @@
#define ACE_HAS_GETIFADDRS
#define ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES
#define ACE_LACKS_UNNAMED_SEMAPHORE
+
// dlcompat package (not part of base Darwin) is needed for dlopen().
// You may download directly from sourceforge and install or use fink
// Fink installer puts libraries in /sw/lib and headers in /sw/include
@@ -159,10 +216,13 @@
#define ACE_LD_SEARCH_PATH ACE_TEXT ("DYLD_LIBRARY_PATH")
#define ACE_DLL_SUFFIX ACE_TEXT (".dylib")
//#define ACE_LACKS_DLCLOSE
+
// gperf seems to need this
//#define ACE_HAS_NONSTATIC_OBJECT_MANAGER
+
#if defined(__APPLE_CC__) && (__APPLE_CC__ < 1173)
#error "Compiler must be upgraded, see http://developer.apple.com"
#endif /* __APPLE_CC__ */
+
#endif /* ACE_CONFIG_MACOSX_TIGER_H */
diff --git a/dep/ACE_wrappers/ace/config-macosx-panther.h b/dep/ACE_wrappers/ace/config-macosx-panther.h
index 443800d0ac8..e2b3361752f 100644
--- a/dep/ACE_wrappers/ace/config-macosx-panther.h
+++ b/dep/ACE_wrappers/ace/config-macosx-panther.h
@@ -1,99 +1,143 @@
/* -*- C++ -*- */
// $Id: config-macosx-panther.h 80826 2008-03-04 14:51:23Z wotte $
+
// This configuration file is designed to work with the MacOS X operating system.
+
#ifndef ACE_CONFIG_MACOSX_H
#define ACE_CONFIG_MACOSX_H
+
#if ! defined (__ACE_INLINE__)
#define __ACE_INLINE__
#endif /* ! __ACE_INLINE__ */
+
#if defined (__GNUG__)
# include "ace/config-g++-common.h"
#endif /* __GNUG__ */
+
#define ACE_LACKS_SUSECONDS_T
#define ACE_SIZE_T_FORMAT_SPECIFIER ACE_TEXT ("%lu")
+
#if defined (ACE_HAS_PENTIUM)
# undef ACE_HAS_PENTIUM
#endif /* ACE_HAS_PENTIUM */
+
#if !defined (_THREAD_SAFE)
#define _THREAD_SAFE
#endif /* _THREAD_SAFE */
+
#define ACE_HAS_GPERF
#define ACE_HAS_POSIX_SEM
+
//#define ACE_HAS_SVR4_TLI
+
#define ACE_LACKS_STROPTS_H
#define ACE_LACKS_WCHAR_H
+
//
// Compiler/platform defines the sig_atomic_t typedef.
#define ACE_HAS_SIG_ATOMIC_T
+
// Compiler/platform supports SVR4 signal typedef
#define ACE_HAS_SVR4_SIGNAL_T
+
//Platform/compiler has the sigwait(2) prototype
#define ACE_HAS_SIGWAIT
+
//Platform supports sigsuspend()
#define ACE_HAS_SIGSUSPEND
+
//Platform/compiler has macros for sig{empty,fill,add,del}set (e.g., SCO and FreeBSD)
#define ACE_HAS_SIG_MACROS
+
//#define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS
#define ACE_LACKS_GETPGID
#define ACE_LACKS_RWLOCK_T
+
// Optimize ACE_Handle_Set for select().
#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT
+
#define ACE_HAS_NONCONST_SELECT_TIMEVAL
+
//?
#define ACE_LACKS_SIGSET
+
#define ACE_NEEDS_SCHED_H
+
// Use of <malloc.h> is deprecated.
#define ACE_LACKS_MALLOC_H
+
#define ACE_HAS_ALT_CUSERID
+
// Platform supports POSIX timers via struct timespec.
#define ACE_HAS_POSIX_TIME
#define ACE_HAS_UALARM
+
// Platform defines struct timespec but not timespec_t
#define ACE_LACKS_TIMESPEC_T
+
#define ACE_LACKS_STRRECVFD
+
#define ACE_HAS_SOCKADDR_IN_SIN_LEN
#define ACE_HAS_SOCKADDR_IN6_SIN6_LEN
+
// Platform supports System V IPC (most versions of UNIX, but not Win32)
#define ACE_HAS_SYSV_IPC
+
// Compiler/platform contains the <sys/syscall.h> file.
#define ACE_HAS_SYS_SYSCALL_H
+
#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES
+
// Compiler/platform supports alloca().
// Although ACE does have alloca() on this compiler/platform combination, it is
// disabled by default since it can be dangerous. Uncomment the following line
// if you ACE to use it.
//#define ACE_HAS_ALLOCA
+
// Compiler/platform correctly calls init()/fini() for shared libraries.
#define ACE_HAS_AUTOMATIC_INIT_FINI
+
// Explicit dynamic linking permits "lazy" symbol resolution
//#define ACE_HAS_RTLD_LAZY_V
+
// platform supports POSIX O_NONBLOCK semantics
#define ACE_HAS_POSIX_NONBLOCK
+
// platform supports IP multicast
#define ACE_HAS_IP_MULTICAST
#define ACE_LACKS_PERFECT_MULTICAST_FILTERING 1
+
// Compiler/platform has the getrusage() system call.
#define ACE_HAS_GETRUSAGE
+
// Compiler supports the ssize_t typedef.
#define ACE_HAS_SSIZE_T
+
// Compiler/platform supports strerror ().
#define ACE_HAS_STRERROR
+
// Compiler/platform provides the sockio.h file.
#define ACE_HAS_SYS_SOCKIO_H
+
// Defines the page size of the system.
#define ACE_HAS_GETPAGESIZE
+
// Platform provides <sys/filio.h> header.
#define ACE_HAS_SYS_FILIO_H
+
// Platform/compiler supports timezone * as second parameter to gettimeofday().
#define ACE_HAS_TIMEZONE_GETTIMEOFDAY
+
#define ACE_LACKS_SYS_MSG_H
#define ACE_LACKS_SYSV_MSQ_PROTOS
#define ACE_HAS_MSG
#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG
#define ACE_HAS_NONCONST_MSGSND
+
#if !defined (ACE_MT_SAFE)
# define ACE_MT_SAFE 1
#endif
+
#if ACE_MT_SAFE == 1
// Yes, we do have threads.
# define ACE_HAS_THREADS
@@ -102,14 +146,19 @@
# define ACE_HAS_PTHREAD_SCHEDPARAM
# define ACE_HAS_THREAD_SPECIFIC_STORAGE
#endif /* ACE_MT_SAFE == 1 */
+
# define ACE_LACKS_THREAD_PROCESS_SCOPING
+
#define ACE_HAS_DIRENT
#define ACE_LACKS_POLL_H
#define ACE_LACKS_SEARCH_H
+
#define ACE_LACKS_SETSCHED
//#define ACE_HAS_RECURSIVE_MUTEXES
+
// Platform has POSIX terminal interface.
#define ACE_HAS_TERMIOS
+
#define ACE_HAS_SEMUN
#define ACE_HAS_SIGINFO_T
#define ACE_LACKS_SIGINFO_H
@@ -117,6 +166,7 @@
#define ACE_HAS_GETIFADDRS
#define ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES
#define ACE_LACKS_UNNAMED_SEMAPHORE
+
// dlcompat package (not part of base Darwin) is needed for dlopen().
// You may download directly from sourceforge and install or use fink
// Fink installer puts libraries in /sw/lib and headers in /sw/include
@@ -130,10 +180,13 @@
#define ACE_LD_SEARCH_PATH ACE_TEXT ("DYLD_LIBRARY_PATH")
#define ACE_DLL_SUFFIX ACE_TEXT (".dylib")
//#define ACE_LACKS_DLCLOSE
+
// gperf seems to need this
//#define ACE_HAS_NONSTATIC_OBJECT_MANAGER
+
#if defined(__APPLE_CC__) && (__APPLE_CC__ < 1173)
#error "Compiler must be upgraded, see http://developer.apple.com"
#endif /* __APPLE_CC__ */
+
#endif /* ACE_CONFIG_MACOSX_H */
diff --git a/dep/ACE_wrappers/ace/config-macosx-tiger.h b/dep/ACE_wrappers/ace/config-macosx-tiger.h
index 3fce4d269e2..282e8800c3c 100644
--- a/dep/ACE_wrappers/ace/config-macosx-tiger.h
+++ b/dep/ACE_wrappers/ace/config-macosx-tiger.h
@@ -1,11 +1,15 @@
/* -*- C++ -*- */
// $Id: config-macosx-tiger.h 82344 2008-07-19 20:04:18Z johnnyw $
+
// This configuration file is designed to work with the MacOS X operating system.
+
#ifndef ACE_CONFIG_MACOSX_TIGER_H
#define ACE_CONFIG_MACOSX_TIGER_H
+
#if ! defined (__ACE_INLINE__)
#define __ACE_INLINE__
#endif /* ! __ACE_INLINE__ */
+
#if !defined (ACE_SIZEOF_LONG_DOUBLE)
# if (__GNUC__ == 3 && __GNUC_MINOR__ == 3)
// Size of long double in GCC 3.3 is 8.
@@ -15,11 +19,15 @@
# define ACE_SIZEOF_LONG_DOUBLE 16
# endif // GCC 3.3
#endif // ACE_SIZEOF_LONG_DOUBLE
+
#if defined (__GNUG__)
# include "ace/config-g++-common.h"
#endif /* __GNUG__ */
+
#define ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR
+
#define ACE_SIZE_T_FORMAT_SPECIFIER ACE_TEXT ("%lu")
+
#if !defined (__i386__)
# if defined (ACE_HAS_PENTIUM)
# undef ACE_HAS_PENTIUM
@@ -27,96 +35,137 @@
#else // __i386__
# define ACE_HAS_PENTIUM
#endif //__i386__
+
#if !defined (_THREAD_SAFE)
#define _THREAD_SAFE
#endif /* _THREAD_SAFE */
+
#define ACE_HAS_GPERF
#define ACE_HAS_POSIX_SEM
+
#define ACE_HAS_SUNOS4_GETTIMEOFDAY
+
#define ACE_LACKS_STROPTS_H
+
// Wcharness....
#define ACE_HAS_WCHAR
#define ACE_SIZEOF_WCHAR 4
+
#define ACE_HAS_3_PARAM_WCSTOK
#define ACE_LACKS_ITOW
#define ACE_LACKS_WCSICMP
#define ACE_LACKS_WCSNICMP
#define ACE_LACKS_WCSDUP
+
// Mac lacks the following pthread features
#define ACE_LACKS_MUTEXATTR_PSHARED
#define ACE_LACKS_CONDATTR_PSHARED
//
// Compiler/platform defines the sig_atomic_t typedef.
#define ACE_HAS_SIG_ATOMIC_T
+
// Compiler/platform supports SVR4 signal typedef
#define ACE_HAS_SVR4_SIGNAL_T
+
//Platform/compiler has the sigwait(2) prototype
#define ACE_HAS_SIGWAIT
+
#define ACE_HAS_AIO_CALLS
+
//Platform supports sigsuspend()
#define ACE_HAS_SIGSUSPEND
+
//Platform/compiler has macros for sig{empty,fill,add,del}set (e.g., SCO and FreeBSD)
#define ACE_HAS_SIG_MACROS
+
#define ACE_LACKS_GETPGID
#define ACE_LACKS_RWLOCK_T
+
// Optimize ACE_Handle_Set for select().
#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT
+
#define ACE_HAS_NONCONST_SELECT_TIMEVAL
+
//?
#define ACE_LACKS_SIGSET
+
#define ACE_NEEDS_SCHED_H
+
// Use of <malloc.h> is deprecated.
#define ACE_LACKS_MALLOC_H
+
#define ACE_HAS_ALT_CUSERID
+
// Platform supports POSIX timers via struct timespec.
#define ACE_HAS_POSIX_TIME
#define ACE_HAS_UALARM
+
// Platform defines struct timespec but not timespec_t
#define ACE_LACKS_TIMESPEC_T
+
#define ACE_LACKS_STRRECVFD
+
#define ACE_HAS_SOCKADDR_IN6_SIN6_LEN
+
// Platform supports System V IPC (most versions of UNIX, but not Win32)
#define ACE_HAS_SYSV_IPC
+
// Compiler/platform contains the <sys/syscall.h> file.
#define ACE_HAS_SYS_SYSCALL_H
+
#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES
+
// Compiler/platform supports alloca().
// Although ACE does have alloca() on this compiler/platform combination, it is
// disabled by default since it can be dangerous. Uncomment the following line
// if you ACE to use it.
//#define ACE_HAS_ALLOCA
+
// Compiler/platform correctly calls init()/fini() for shared libraries.
#define ACE_HAS_AUTOMATIC_INIT_FINI
+
// platform supports POSIX O_NONBLOCK semantics
#define ACE_HAS_POSIX_NONBLOCK
+
// platform supports IP multicast
#define ACE_HAS_IP_MULTICAST
#define ACE_LACKS_PERFECT_MULTICAST_FILTERING 1
+
// Compiler/platform has the getrusage() system call.
#define ACE_HAS_GETRUSAGE
+
// Compiler supports the ssize_t typedef.
#define ACE_HAS_SSIZE_T
+
// Compiler/platform supports strerror ().
#define ACE_HAS_STRERROR
+
// Compiler/platform provides the sockio.h file.
#define ACE_HAS_SYS_SOCKIO_H
+
// Compiler/platform provides the socklen_t type.
#define ACE_HAS_SOCKLEN_T
+
// Defines the page size of the system.
#define ACE_HAS_GETPAGESIZE
+
// Platform provides <sys/filio.h> header.
#define ACE_HAS_SYS_FILIO_H
+
// Platform/compiler supports timezone * as second parameter to gettimeofday().
#define ACE_HAS_TIMEZONE_GETTIMEOFDAY
+
#define ACE_LACKS_SYS_MSG_H
#define ACE_LACKS_SYSV_MSQ_PROTOS
#define ACE_HAS_MSG
#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG
#define ACE_HAS_NONCONST_MSGSND
+
#if !defined (ACE_MT_SAFE)
# define ACE_MT_SAFE 1
#endif
+
#if ACE_MT_SAFE == 1
// Yes, we do have threads.
# define ACE_HAS_THREADS
@@ -125,14 +174,19 @@
# define ACE_HAS_PTHREAD_SCHEDPARAM
# define ACE_HAS_THREAD_SPECIFIC_STORAGE
#endif /* ACE_MT_SAFE == 1 */
+
#define ACE_LACKS_THREAD_PROCESS_SCOPING
+
#define ACE_HAS_DIRENT
#define ACE_LACKS_POLL_H
#define ACE_LACKS_SEARCH_H
+
#define ACE_LACKS_SETSCHED
//#define ACE_HAS_RECURSIVE_MUTEXES
+
// Platform has POSIX terminal interface.
#define ACE_HAS_TERMIOS
+
#define ACE_HAS_SEMUN
#define ACE_HAS_SIGINFO_T
#define ACE_LACKS_SIGINFO_H
@@ -140,6 +194,7 @@
#define ACE_HAS_GETIFADDRS
#define ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES
#define ACE_LACKS_UNNAMED_SEMAPHORE
+
// dlcompat package (not part of base Darwin) is needed for dlopen().
// You may download directly from sourceforge and install or use fink
// Fink installer puts libraries in /sw/lib and headers in /sw/include
@@ -153,10 +208,13 @@
#define ACE_LD_SEARCH_PATH ACE_TEXT ("DYLD_LIBRARY_PATH")
#define ACE_DLL_SUFFIX ACE_TEXT (".dylib")
//#define ACE_LACKS_DLCLOSE
+
// gperf seems to need this
//#define ACE_HAS_NONSTATIC_OBJECT_MANAGER
+
#if defined(__APPLE_CC__) && (__APPLE_CC__ < 1173)
#error "Compiler must be upgraded, see http://developer.apple.com"
#endif /* __APPLE_CC__ */
+
#endif /* ACE_CONFIG_MACOSX_TIGER_H */
diff --git a/dep/ACE_wrappers/ace/config-macosx.h b/dep/ACE_wrappers/ace/config-macosx.h
index 6ef585cc8d5..e8ec1af6e96 100644
--- a/dep/ACE_wrappers/ace/config-macosx.h
+++ b/dep/ACE_wrappers/ace/config-macosx.h
@@ -1,99 +1,145 @@
/* -*- C++ -*- */
// $Id: config-macosx.h 80826 2008-03-04 14:51:23Z wotte $
+
// This configuration file is designed to work with the MacOS X operating system, version 10.2 (Jaguar).
+
#ifndef ACE_CONFIG_MACOSX_H
#define ACE_CONFIG_MACOSX_H
+
#if ! defined (__ACE_INLINE__)
#define __ACE_INLINE__
#endif /* ! __ACE_INLINE__ */
+
#if defined (__GNUG__)
# include "ace/config-g++-common.h"
#endif /* __GNUG__ */
+
#define ACE_SIZE_T_FORMAT_SPECIFIER ACE_TEXT ("%lu")
+
#if defined (ACE_HAS_PENTIUM)
# undef ACE_HAS_PENTIUM
#endif /* ACE_HAS_PENTIUM */
+
#if !defined (_THREAD_SAFE)
#define _THREAD_SAFE
#endif /* _THREAD_SAFE */
+
#define ACE_HAS_GPERF
#define ACE_HAS_POSIX_SEM
+
//#define ACE_HAS_SVR4_TLI
+
#define ACE_LACKS_STROPTS_H
#define ACE_LACKS_WCHAR_H
+
#define ACE_SYS_SELECT_NEEDS_UNISTD_H
+
//
// Compiler/platform defines the sig_atomic_t typedef.
#define ACE_HAS_SIG_ATOMIC_T
+
// Compiler/platform supports SVR4 signal typedef
#define ACE_HAS_SVR4_SIGNAL_T
+
//Platform/compiler has the sigwait(2) prototype
#define ACE_HAS_SIGWAIT
+
//Platform supports sigsuspend()
#define ACE_HAS_SIGSUSPEND
+
//Platform/compiler has macros for sig{empty,fill,add,del}set (e.g., SCO and FreeBSD)
#define ACE_HAS_SIG_MACROS
+
//#define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS
#define ACE_LACKS_GETPGID
#define ACE_LACKS_RWLOCK_T
+
// Optimize ACE_Handle_Set for select().
#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT
+
#define ACE_HAS_NONCONST_SELECT_TIMEVAL
+
#define ACE_HAS_SYSCTL
+
//?
#define ACE_LACKS_SIGSET
+
#define ACE_NEEDS_SCHED_H
+
// Use of <malloc.h> is deprecated.
#define ACE_LACKS_MALLOC_H
+
#define ACE_HAS_ALT_CUSERID
+
// Platform supports POSIX timers via struct timespec.
#define ACE_HAS_POSIX_TIME
#define ACE_HAS_UALARM
+
// Platform defines struct timespec but not timespec_t
#define ACE_LACKS_TIMESPEC_T
+
#define ACE_LACKS_STRRECVFD
+
#define ACE_HAS_SOCKADDR_IN6_SIN6_LEN
+
// Platform supports System V IPC (most versions of UNIX, but not Win32)
//#define ACE_HAS_SYSV_IPC
+
// Compiler/platform contains the <sys/syscall.h> file.
#define ACE_HAS_SYS_SYSCALL_H
+
#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES
+
// Compiler/platform supports alloca().
// Although ACE does have alloca() on this compiler/platform combination, it is
// disabled by default since it can be dangerous. Uncomment the following line
// if you ACE to use it.
//#define ACE_HAS_ALLOCA
+
// Compiler/platform correctly calls init()/fini() for shared libraries.
#define ACE_HAS_AUTOMATIC_INIT_FINI
+
// Explicit dynamic linking permits "lazy" symbol resolution
//#define ACE_HAS_RTLD_LAZY_V
+
// platform supports POSIX O_NONBLOCK semantics
#define ACE_HAS_POSIX_NONBLOCK
+
// platform supports IP multicast
#define ACE_HAS_IP_MULTICAST
#define ACE_LACKS_PERFECT_MULTICAST_FILTERING 1
+
// Compiler/platform has the getrusage() system call.
#define ACE_HAS_GETRUSAGE
+
// Compiler supports the ssize_t typedef.
#define ACE_HAS_SSIZE_T
+
// Compiler/platform supports strerror ().
#define ACE_HAS_STRERROR
+
// Compiler/platform provides the sockio.h file.
#define ACE_HAS_SYS_SOCKIO_H
+
// Defines the page size of the system.
#define ACE_HAS_GETPAGESIZE
+
// Platform provides <sys/filio.h> header.
#define ACE_HAS_SYS_FILIO_H
+
// Platform/compiler supports timezone * as second parameter to gettimeofday().
#define ACE_HAS_TIMEZONE_GETTIMEOFDAY
+
#define ACE_LACKS_SYS_MSG_H
#define ACE_LACKS_SYSV_MSQ_PROTOS
#define ACE_HAS_MSG
#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG
#define ACE_HAS_NONCONST_MSGSND
+
#if !defined (ACE_MT_SAFE)
# define ACE_MT_SAFE 1
#endif
+
#if ACE_MT_SAFE == 1
// Yes, we do have threads.
# define ACE_HAS_THREADS
@@ -102,13 +148,17 @@
# define ACE_HAS_THREAD_SPECIFIC_STORAGE
# define ACE_LACKS_THREAD_PROCESS_SCOPING
#endif /* ACE_MT_SAFE == 1 */
+
#define ACE_HAS_DIRENT
#define ACE_LACKS_POLL_H
#define ACE_LACKS_SEARCH_H
+
#define ACE_LACKS_SETSCHED
//#define ACE_HAS_RECURSIVE_MUTEXES
+
// Platform has POSIX terminal interface.
#define ACE_HAS_TERMIOS
+
#define ACE_HAS_SEMUN
#define ACE_HAS_SIGINFO_T
#define ACE_LACKS_SIGINFO_H
@@ -116,6 +166,7 @@
#define ACE_HAS_GETIFADDRS
#define ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES
#define ACE_LACKS_UNNAMED_SEMAPHORE
+
// dlcompat package (not part of base Darwin) is needed for dlopen().
// You may download directly from sourceforge and install or use fink
// Fink installer puts libraries in /sw/lib and headers in /sw/include
@@ -129,10 +180,13 @@
#define ACE_LD_SEARCH_PATH ACE_TEXT ("DYLD_LIBRARY_PATH")
#define ACE_DLL_SUFFIX ACE_TEXT (".dylib")
#define ACE_LACKS_DLCLOSE
+
// gperf seems to need this
#define ACE_HAS_NONSTATIC_OBJECT_MANAGER
+
#if defined(__APPLE_CC__) && (__APPLE_CC__ < 1173)
#error "Compiler must be upgraded, see http://developer.apple.com"
#endif /* __APPLE_CC__ */
+
#endif /* ACE_CONFIG_MACOSX_H */
diff --git a/dep/ACE_wrappers/ace/config-macros.h b/dep/ACE_wrappers/ace/config-macros.h
index 5d213e5cdc4..5d1067e6c13 100644
--- a/dep/ACE_wrappers/ace/config-macros.h
+++ b/dep/ACE_wrappers/ace/config-macros.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//==========================================================================
/**
* @file config-macros.h
@@ -16,15 +17,19 @@
* language sources.
*/
//==========================================================================
+
#ifndef ACE_CONFIG_MACROS_H
#define ACE_CONFIG_MACROS_H
+
#ifdef _WIN32
#include "ace/config-win32.h"
#else
#include "ace/config.h"
#endif //_WIN32
+
#include "ace/Version.h"
#include "ace/Versioned_Namespace.h"
+
// ACE_HAS_TLI is used to decide whether to try any XTI/TLI functionality
// so if it isn't set, set it. Capabilities and differences between
// XTI and TLI favor XTI, but when deciding to do anything, as opposed to
@@ -34,7 +39,9 @@
# define ACE_HAS_TLI
# endif /* ACE_HAS_XTI */
#endif /* ACE_HAS_TLI */
+
#define ACE_BITS_PER_ULONG (8 * sizeof (u_long))
+
#if !defined (ACE_OSTREAM_TYPE)
# if defined (ACE_LACKS_IOSTREAM_TOTALLY)
# define ACE_OSTREAM_TYPE FILE
@@ -42,6 +49,7 @@
# define ACE_OSTREAM_TYPE ostream
# endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */
#endif /* ! ACE_OSTREAM_TYPE */
+
#if !defined (ACE_DEFAULT_LOG_STREAM)
# if defined (ACE_LACKS_IOSTREAM_TOTALLY)
# define ACE_DEFAULT_LOG_STREAM 0
@@ -49,6 +57,7 @@
# define ACE_DEFAULT_LOG_STREAM (&cerr)
# endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */
#endif /* ! ACE_DEFAULT_LOG_STREAM */
+
// These two are only for backward compatibility. You should avoid
// using them if not necessary.
#if !defined (ACE_LACKS_DEPRECATED_MACROS)
@@ -61,10 +70,12 @@
*/
# define ACE_SYNCH_2 ACE_SYNCH_USE
#endif
+
// For Win32 compatibility...
# if !defined (ACE_WSOCK_VERSION)
# define ACE_WSOCK_VERSION 0, 0
# endif /* ACE_WSOCK_VERSION */
+
# if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
# define ACE_MT(X) X
# if !defined (_REENTRANT)
@@ -73,18 +84,22 @@
# else
# define ACE_MT(X)
# endif /* ACE_MT_SAFE */
+
# if defined (ACE_HAS_PURIFY)
# define ACE_INITIALIZE_MEMORY_BEFORE_USE
# endif /* ACE_HAS_PURIFY */
+
# if defined (ACE_HAS_VALGRIND)
# define ACE_INITIALIZE_MEMORY_BEFORE_USE
# endif /* ACE_HAS_VALGRIND */
+
#if !defined (ACE_LACKS_DEPRECATED_MACROS)
/**
* @deprecated The @c ACE_HAS_USING macros are deprecated
*/
# define ACE_USING using
#endif /* !ACE_LACKS_DEPRECATED_MACROS */
+
#if !defined (ACE_LACKS_DEPRECATED_MACROS)
/**
* @deprecated The @c ACE_TYPENAME macros is deprecated. Use standard
@@ -92,6 +107,7 @@
*/
# define ACE_TYPENAME typename
#endif /* !ACE_LACKS_DEPRECATED_MACROS */
+
#if !defined (ACE_LACKS_DEPRECATED_MACROS)
/**
* @deprecated The @c ACE_TEMPLATE_SPECIALIZATION and
@@ -102,21 +118,26 @@
# define ACE_TEMPLATE_SPECIALIZATION template<>
# define ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION
#endif /* !ACE_LACKS_DEPRECATED_MACROS */
+
// =========================================================================
// Perfect Multicast filting refers to RFC 3376, where a socket is only
// delivered dgrams for groups joined even if it didn't bind the group
// address. We turn this option off by default, although most OS's
// except for Windows and Solaris probably lack perfect filtering.
// =========================================================================
+
# if !defined (ACE_LACKS_PERFECT_MULTICAST_FILTERING)
# define ACE_LACKS_PERFECT_MULTICAST_FILTERING 0
# endif /* ACE_LACKS_PERFECT_MULTICAST_FILTERING */
+
// =========================================================================
// Enable/Disable Features By Default
// =========================================================================
+
# if !defined (ACE_HAS_POSITION_INDEPENDENT_POINTERS)
# define ACE_HAS_POSITION_INDEPENDENT_POINTERS 1
# endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS */
+
# if !defined (ACE_HAS_PROCESS_SPAWN)
# if !defined (ACE_LACKS_FORK) || \
(defined (ACE_WIN32) && !defined (ACE_HAS_PHARLAP)) || \
@@ -124,25 +145,31 @@
# define ACE_HAS_PROCESS_SPAWN 1
# endif
# endif /* ACE_HAS_PROCESS_SPAWN */
+
# if !defined (ACE_HAS_DYNAMIC_LINKING)
# if defined (ACE_HAS_SVR4_DYNAMIC_LINKING) || defined (ACE_WIN32) || defined (ACE_VXWORKS) || defined (__hpux)
# define ACE_HAS_DYNAMIC_LINKING 1
# endif
# endif /* ACE_HAS_DYNAMIC_LINKING */
+
# if defined (ACE_USES_FIFO_SEM)
# if defined (ACE_HAS_POSIX_SEM) || defined (ACE_LACKS_MKFIFO) || defined (ACE_LACKS_FCNTL)
# undef ACE_USES_FIFO_SEM
# endif
# endif /* ACE_USES_FIFO_SEM */
+
// =========================================================================
// RCSID Macros
// =========================================================================
+
// By default, DO NOT include RCS Id strings in object code.
#if ! defined (ACE_USE_RCSID)
# define ACE_USE_RCSID 0
#endif /* #if ! defined (ACE_USE_RCSID) */
+
#if (defined (ACE_USE_RCSID) && (ACE_USE_RCSID != 0))
# if ! defined (ACE_RCSID)
+
// This hack has the following purposes:
// 1. To define the RCS id string variable as a static char*, so
// that there won't be any duplicate extern symbols at link
@@ -151,6 +178,7 @@
// file.
// 3. To avoid warnings of the type "variable declared and never
// used".
+
# define ACE_RCSID(path, file, id) \
static inline const char* get_rcsid_ ## path ## _ ## file (const char*) \
{ \
@@ -158,27 +186,33 @@
} \
static const char* rcsid_ ## path ## _ ## file = \
get_rcsid_ ## path ## _ ## file ( rcsid_ ## path ## _ ## file ) ;
+
# endif /* #if ! defined (ACE_RCSID) */
#else
+
// RCS id strings are not wanted.
# if defined (ACE_RCSID)
# undef ACE_RCSID
# endif /* #if defined (ACE_RCSID) */
# define ACE_RCSID(path, file, id) /* noop */
#endif /* #if (defined (ACE_USE_RCSID) && (ACE_USE_RCSID != 0)) */
+
// =========================================================================
// INLINE macros
//
// These macros handle all the inlining of code via the .i or .inl files
// =========================================================================
+
#if defined (ACE_LACKS_INLINE_FUNCTIONS) && !defined (ACE_NO_INLINE)
# define ACE_NO_INLINE
#endif /* defined (ACE_LACKS_INLINE_FUNCTIONS) && !defined (ACE_NO_INLINE) */
+
// ACE inlining has been explicitly disabled. Implement
// internally within ACE by undefining __ACE_INLINE__.
#if defined (ACE_NO_INLINE)
# undef __ACE_INLINE__
#endif /* ! ACE_NO_INLINE */
+
#if defined (__ACE_INLINE__)
# define ACE_INLINE inline
# if !defined (ACE_HAS_INLINED_OSCALLS)
@@ -187,20 +221,24 @@
#else
# define ACE_INLINE
#endif /* __ACE_INLINE__ */
+
#if !defined (ACE_LACKS_DEPRECATED_MACROS)
// =========================================================================
// EXPLICIT macro
// =========================================================================
+
/**
* @deprecated explicit is deprecated. ACE requires C++
* "explicit" keyword support.
*/
# define ACE_EXPLICIT explicit
#endif /* ACE_LACKS_DEPRECATED_MACROS */
+
#if !defined (ACE_LACKS_DEPRECATED_MACROS)
// =========================================================================
// MUTABLE macro
// =========================================================================
+
/**
* @deprecated ACE_MUTABLE is deprecated. ACE requires C++ "mutable"
* keyword support.
@@ -208,12 +246,14 @@
# define ACE_MUTABLE mutable
# define ACE_CONST_WHEN_MUTABLE const
#endif /* ACE_LACKS_DEPRECATED_MACROS */
+
// ============================================================================
// EXPORT macros
//
// Since Win32 DLL's do not export all symbols by default, they must be
// explicitly exported (which is done by *_Export macros).
// ============================================================================
+
// Win32 should have already defined the macros in config-win32-common.h
#if !defined (ACE_HAS_CUSTOM_EXPORT_MACROS)
# define ACE_Proper_Export_Flag
@@ -224,22 +264,29 @@
# define ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
#else
// An export macro should at the very least have been defined.
+
# ifndef ACE_Proper_Import_Flag
# define ACE_Proper_Import_Flag
# endif /* !ACE_Proper_Import_Flag */
+
# ifndef ACE_EXPORT_SINGLETON_DECLARATION
# define ACE_EXPORT_SINGLETON_DECLARATION(T)
# endif /* !ACE_EXPORT_SINGLETON_DECLARATION */
+
# ifndef ACE_IMPORT_SINGLETON_DECLARATION
# define ACE_IMPORT_SINGLETON_DECLARATION(T)
# endif /* !ACE_IMPORT_SINGLETON_DECLARATION */
+
# ifndef ACE_EXPORT_SINGLETON_DECLARE
# define ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
# endif /* !ACE_EXPORT_SINGLETON_DECLARE */
+
# ifndef ACE_IMPORT_SINGLETON_DECLARE
# define ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
# endif /* !ACE_IMPORT_SINGLETON_DECLARE */
+
#endif /* !ACE_HAS_CUSTOM_EXPORT_MACROS */
+
// This is a whim of mine -- that instead of annotating a class with
// ACE_Export in its declaration, we make the declaration near the TOP
// of the file with ACE_DECLARE_EXPORT.
@@ -252,13 +299,16 @@
// Someday, when template libraries are supported, we made need ...
// ACE_DECLARE_EXPORT(template class, sometemplate) <class TYPE, class LOCK>;
# define ACE_DECLARE_EXPORT(TS,ID) TS ACE_Export ID
+
// ============================================================================
// Cast macros
//
// These macros are used to choose between the old cast style and the new
// *_cast<> operators
// ============================================================================
+
# define ACE_sap_any_cast(TYPE) reinterpret_cast<TYPE> (const_cast<ACE_Addr &> (ACE_Addr::sap_any))
+
#if !defined (ACE_LACKS_DEPRECATED_MACROS)
/**
* @deprecated ACE_{static,reinterpret,dynamic,const}_cast@<@> is
@@ -275,6 +325,7 @@
# define ACE_static_cast_3_ref(TYPE, T1, T2, T3, EXPR) static_cast<TYPE<T1, T2, T3> &> (EXPR)
# define ACE_static_cast_4_ref(TYPE, T1, T2, T3, T4, EXPR) static_cast<TYPE<T1, T2, T3, T4> &> (EXPR)
# define ACE_static_cast_5_ref(TYPE, T1, T2, T3, T4, T5, EXPR) static_cast<TYPE<T1, T2, T3, T4, T5> &> (EXPR)
+
# define ACE_const_cast(TYPE, EXPR) const_cast<TYPE> (EXPR)
# define ACE_const_cast_1_ptr(TYPE, T1, EXPR) const_cast<TYPE<T1> *> (EXPR)
# define ACE_const_cast_2_ptr(TYPE, T1, T2, EXPR) const_cast<TYPE<T1, T2> *> (EXPR)
@@ -286,6 +337,7 @@
# define ACE_const_cast_3_ref(TYPE, T1, T2, T3, EXPR) const_cast<TYPE<T1, T2, T3> &> (EXPR)
# define ACE_const_cast_4_ref(TYPE, T1, T2, T3, T4, EXPR) const_cast<TYPE<T1, T2, T3, T4> &> (EXPR)
# define ACE_const_cast_5_ref(TYPE, T1, T2, T3, T4, T5, EXPR) const_cast<TYPE<T1, T2, T3, T4, T5> &> (EXPR)
+
# define ACE_reinterpret_cast(TYPE, EXPR) reinterpret_cast<TYPE> (EXPR)
# define ACE_reinterpret_cast_1_ptr(TYPE, T1, EXPR) reinterpret_cast<TYPE<T1> *> (EXPR)
# define ACE_reinterpret_cast_2_ptr(TYPE, T1, T2, EXPR) reinterpret_cast<TYPE<T1, T2> *> (EXPR)
@@ -297,6 +349,7 @@
# define ACE_reinterpret_cast_3_ref(TYPE, T1, T2, T3, EXPR) reinterpret_cast<TYPE<T1, T2, T3> &> (EXPR)
# define ACE_reinterpret_cast_4_ref(TYPE, T1, T2, T3, T4, EXPR) reinterpret_cast<TYPE<T1, T2, T3, T4> &> (EXPR)
# define ACE_reinterpret_cast_5_ref(TYPE, T1, T2, T3, T4, T5, EXPR) reinterpret_cast<TYPE<T1, T2, T3, T4, T5> &> (EXPR)
+
# define ACE_dynamic_cast(TYPE, EXPR) dynamic_cast<TYPE> (EXPR)
# define ACE_dynamic_cast_1_ptr(TYPE, T1, EXPR) dynamic_cast<TYPE<T1> *> (EXPR)
# define ACE_dynamic_cast_2_ptr(TYPE, T1, T2, EXPR) dynamic_cast<TYPE<T1, T2> *> (EXPR)
@@ -309,6 +362,7 @@
# define ACE_dynamic_cast_4_ref(TYPE, T1, T2, T3, T4, EXPR) dynamic_cast<TYPE<T1, T2, T3, T4> &> (EXPR)
# define ACE_dynamic_cast_5_ref(TYPE, T1, T2, T3, T4, T5, EXPR) dynamic_cast<TYPE<T1, T2, T3, T4, T5> &> (EXPR)
#endif /* ACE_LACKS_DEPRECATED_MACROS */
+
# if !defined (ACE_CAST_CONST)
// Sun CC 4.2, for example, requires const in reinterpret casts of
// data members in const member functions. But, other compilers
@@ -319,12 +373,14 @@
# define ACE_CAST_CONST
# endif /* ! __SUNPRO_CC */
# endif /* ! ACE_CAST_CONST */
+
// ============================================================================
// Compiler Silencing macros
//
// Some compilers complain about parameters that are not used. This macro
// should keep them quiet.
// ============================================================================
+
#if !defined (ACE_UNUSED_ARG)
# if defined (__GNUC__) && ((__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2)))
# define ACE_UNUSED_ARG(a) (void) (a)
@@ -342,20 +398,24 @@
# define ACE_UNUSED_ARG(a) (a)
# endif /* ghs || __GNUC__ || ..... */
#endif /* !ACE_UNUSED_ARG */
+
#if defined (_MSC_VER) || defined(__sgi) || defined (ghs) || defined (__DECCXX) || defined(__BORLANDC__) || defined (ACE_RM544) || defined (__USLC__) || defined (__DCC__) || defined (__PGI) || defined (__TANDEM) || (defined (__HP_aCC) && (__HP_aCC >= 60500))
# define ACE_NOTREACHED(a)
#else /* __sgi || ghs || ..... */
# define ACE_NOTREACHED(a) a
#endif /* __sgi || ghs || ..... */
+
// ============================================================================
// ACE_ALLOC_HOOK* macros
//
// Macros to declare and define class-specific allocation operators.
// ============================================================================
+
# if defined (ACE_HAS_ALLOC_HOOKS)
# define ACE_ALLOC_HOOK_DECLARE \
void *operator new (size_t bytes); \
void operator delete (void *ptr);
+
// Note that these are just place holders for now. Some day they
// may be be replaced by <ACE_Malloc>.
# define ACE_ALLOC_HOOK_DEFINE(CLASS) \
@@ -365,6 +425,7 @@
# define ACE_ALLOC_HOOK_DECLARE struct __Ace {} /* Just need a dummy... */
# define ACE_ALLOC_HOOK_DEFINE(CLASS)
# endif /* ACE_HAS_ALLOC_HOOKS */
+
// ============================================================================
/**
* ACE_OSCALL* macros
@@ -385,6 +446,7 @@
* determined dynamically at run-time.
*/
// ============================================================================
+
#define ACE_OSCALL_RETURN(X,TYPE,FAILVALUE) \
do \
return (TYPE) (X); \
@@ -393,6 +455,7 @@
do \
RESULT = (TYPE) (X); \
while (0)
+
#if defined (ACE_WIN32)
# define ACE_WIN32CALL_RETURN(X,TYPE,FAILVALUE) \
do { \
@@ -408,6 +471,7 @@
ACE_OS::set_errno_to_last_error (); \
} while (0)
#endif /* ACE_WIN32 */
+
// The C99 security-improved run-time returns an error value on failure;
// 0 on success.
#if defined (ACE_HAS_TR24731_2005_CRT)
@@ -417,18 +481,25 @@
if (___ != 0) { errno = ___; RESULT = FAILVALUE; } \
} while (0)
#endif /* ACE_HAS_TR24731_2005_CRT */
+
// ============================================================================
// Fundamental types
// ============================================================================
+
#if defined (ACE_WIN32)
+
typedef HANDLE ACE_HANDLE;
typedef SOCKET ACE_SOCKET;
# define ACE_INVALID_HANDLE INVALID_HANDLE_VALUE
+
#else /* ! ACE_WIN32 */
+
typedef int ACE_HANDLE;
typedef ACE_HANDLE ACE_SOCKET;
# define ACE_INVALID_HANDLE -1
+
#endif /* ACE_WIN32 */
+
// Define the type that's returned from the platform's native thread
// functions. ACE_THR_FUNC_RETURN is the type defined as the thread
// function's return type, except when the thread function doesn't return
@@ -447,6 +518,7 @@ typedef DWORD ACE_THR_FUNC_RETURN;
typedef void* ACE_THR_FUNC_RETURN;
# endif /* ACE_VXWORKS */
typedef ACE_THR_FUNC_RETURN (*ACE_THR_FUNC)(void *);
+
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
@@ -455,12 +527,14 @@ typedef void (*ACE_THR_C_DEST)(void *);
}
#endif /* __cplusplus */
typedef void (*ACE_THR_DEST)(void *);
+
// Now some platforms have special requirements...
# if defined (ACE_VXWORKS) && !defined (ACE_HAS_PTHREADS)
typedef FUNCPTR ACE_THR_FUNC_INTERNAL; // where typedef int (*FUNCPTR) (...)
# else
typedef ACE_THR_FUNC ACE_THR_FUNC_INTERNAL;
# endif /* ACE_VXWORKS */
+
# ifdef __cplusplus
extern "C"
{
@@ -473,6 +547,7 @@ typedef ACE_THR_FUNC_RETURN (*ACE_THR_C_FUNC)(void *);
# ifdef __cplusplus
}
# endif /* __cplusplus */
+
// ============================================================================
// Macros for controlling the lifetimes of dlls loaded by ACE_DLL--including
// all dlls loaded via the ACE Service Config framework.
@@ -480,6 +555,7 @@ typedef ACE_THR_FUNC_RETURN (*ACE_THR_C_FUNC)(void *);
// Please don't change these values or add new ones wantonly, since we use
// the ACE_BIT_ENABLED, etc..., macros to test them.
// ============================================================================
+
// Per-process policy that unloads dlls eagerly.
#define ACE_DLL_UNLOAD_POLICY_PER_PROCESS 0
// Apply policy on a per-dll basis. If the dll doesn't use one of the macros
@@ -491,14 +567,17 @@ typedef ACE_THR_FUNC_RETURN (*ACE_THR_C_FUNC)(void *);
// Default policy allows dlls to control their own destinies, but will
// unload those that don't make a choice eagerly.
#define ACE_DLL_UNLOAD_POLICY_DEFAULT ACE_DLL_UNLOAD_POLICY_PER_DLL
+
// Add this macro you one of your cpp file in your dll. X should
// be either ACE_DLL_UNLOAD_POLICY_DEFAULT or ACE_DLL_UNLOAD_POLICY_LAZY.
#define ACE_DLL_UNLOAD_POLICY(CLS,X) \
extern "C" u_long CLS##_Export _get_dll_unload_policy (void) \
{ return X;}
+
// ============================================================================
// ACE_USES_CLASSIC_SVC_CONF macro
// ============================================================================
+
// For now, default is to use the classic svc.conf format.
#if !defined (ACE_USES_CLASSIC_SVC_CONF)
# if defined (ACE_HAS_CLASSIC_SVC_CONF) && defined (ACE_HAS_XML_SVC_CONF)
@@ -512,6 +591,7 @@ extern "C" u_long CLS##_Export _get_dll_unload_policy (void) \
# define ACE_USES_CLASSIC_SVC_CONF 1
# endif /* ACE_HAS_XML_SVC_CONF */
#endif /* ACE_USES_CLASSIC_SVC_CONF */
+
// ============================================================================
// Default svc.conf file extension.
// ============================================================================
@@ -520,14 +600,17 @@ extern "C" u_long CLS##_Export _get_dll_unload_policy (void) \
#else
# define ACE_DEFAULT_SVC_CONF_EXT ".conf.xml"
#endif /* ACE_USES_CLASSIC_SVC_CONF && ACE_USES_CLASSIC_SVC_CONF == 1 */
+
// ============================================================================
// Miscellaneous macros
// ============================================================================
+
#if defined (ACE_USES_EXPLICIT_STD_NAMESPACE)
# define ACE_STD_NAMESPACE std
#else
# define ACE_STD_NAMESPACE
#endif
+
#if !defined (ACE_OS_String)
# define ACE_OS_String ACE_OS
#endif /* ACE_OS_String */
@@ -540,6 +623,7 @@ extern "C" u_long CLS##_Export _get_dll_unload_policy (void) \
#if !defined (ACE_OS_TLI)
# define ACE_OS_TLI ACE_OS
#endif /* ACE_OS_TLI */
+
// -------------------------------------------------------------------
// Preprocessor symbols will not be expanded if they are
// concatenated. Force the preprocessor to expand them during the
@@ -548,5 +632,6 @@ extern "C" u_long CLS##_Export _get_dll_unload_policy (void) \
#define ACE_PREPROC_CONCATENATE_IMPL(A,B) A ## B
#define ACE_PREPROC_CONCATENATE(A,B) ACE_PREPROC_CONCATENATE_IMPL(A,B)
// -------------------------------------------------------------------
+
#endif /* ACE_CONFIG_MACROS_H */
diff --git a/dep/ACE_wrappers/ace/config-minimal.h b/dep/ACE_wrappers/ace/config-minimal.h
index 24471ce9c18..5766987f07d 100644
--- a/dep/ACE_wrappers/ace/config-minimal.h
+++ b/dep/ACE_wrappers/ace/config-minimal.h
@@ -1,31 +1,40 @@
/* -*- C++ -*- */
// $Id: config-minimal.h 80826 2008-03-04 14:51:23Z wotte $
+
// This configuration file is designed to build only the minimal
// ACE_OS adaptation layer.
+
#ifndef ACE_CONFIG_MINIMAL_H
#define ACE_CONFIG_MINIMAL_H
#include /**/ "ace/pre.h"
+
#define ACE_HAS_MINIMAL_ACE_OS
+
// Only instantiate the ACE_OS_Object_Manager.
#define ACE_MAIN_OBJECT_MANAGER \
ACE_OS_Object_Manager ace_os_object_manager;
+
#if !defined(ACE_USE_THREAD_MANAGER_ADAPTER)
// To prevent use of ACE_Thread_Exit functions in
// ACE_Thread_Adapter::invoke ().
# define ACE_USE_THREAD_MANAGER_ADAPTER
#endif /* ! ACE_USE_THREAD_MANAGER_ADAPTER */
+
#if defined (ACE_ASSERT)
# undef ACE_ASSERT
#endif /* ACE_ASSERT */
#define ACE_ASSERT(x)
+
#if defined (ACE_DEBUG)
# undef ACE_DEBUG
#endif /* ACE_DEBUG */
#define ACE_DEBUG(x)
+
#if defined (ACE_ERROR)
# undef ACE_ERROR
#endif /* ACE_ERROR */
#define ACE_ERROR(x)
+
#include /**/ "ace/post.h"
#endif /* ACE_CONFIG_MINIMAL_H */
diff --git a/dep/ACE_wrappers/ace/config-mvs.h b/dep/ACE_wrappers/ace/config-mvs.h
index a75b57f7ac6..22ddffee139 100644
--- a/dep/ACE_wrappers/ace/config-mvs.h
+++ b/dep/ACE_wrappers/ace/config-mvs.h
@@ -1,9 +1,12 @@
/* -*- C++ -*- */
// $Id: config-mvs.h 81992 2008-06-16 19:09:50Z wotte $
+
// Config file for MVS with OpenEdition
+
#ifndef ACE_CONFIG_H
#define ACE_CONFIG_H
#include /**/ "ace/pre.h"
+
// The following #defines are hacks to get around things
// that seem to be missing or different in MVS land
#define MAXPATHLEN 1024 /* sys/param.h not on MVS */
@@ -15,23 +18,30 @@
#if defined (log) /* log is a macro in math.h */
# undef log /* conflicts with log function in ACE */
#endif /* log */
+
#define ACE_MVS
+
// Preprocesor requires an extra argument
#ifndef ACE_USING_MCPP_PREPROCESSOR
# define ACE_CC_PREPROCESSOR_ARGS "-+ -E"
#endif
+
// See the README file in this directory
// for a description of the following ACE_ macros
+
#if __COMPILER_VER__ >= 0x21020000 /* OS/390 r2 or higher */
# define ACE_HAS_4_4BSD_SENDMSG_RECVMSG
# define ACE_HAS_UCONTEXT_T
#else /* __COMPILER_VER__ < 0x21020000 */
# define ACE_LACKS_UCONTEXT_H
#endif /* __COMPILER_VER__ < 0x21020000 */
+
#if __COMPILER_VER__ < 0x22060000 /* before OS/390 r2.6 */
# define ACE_LACKS_LONGLONG_T
#endif /* __COMPILER_VER__ < 0x22060000 */
+
#define ERRMAX __sys_nerr
+
#define ACE_HAS_3_PARAM_WCSTOK
#define ACE_HAS_BROKEN_CTIME
#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES
@@ -72,6 +82,7 @@
#define ACE_HAS_VOIDPTR_MMAP
#define ACE_HAS_VOIDPTR_SOCKOPT
#define ACE_HAS_XPG4_MULTIBYTE_CHAR
+
#define ACE_LACKS_CONDATTR_PSHARED
#define ACE_LACKS_INET_ATON
#define ACE_LACKS_MSGBUF_T
@@ -100,15 +111,20 @@
#define ACE_LACKS_THREAD_PROCESS_SCOPING
#define ACE_LACKS_PTHREAD_ATTR_SETSTACKADDR
#define ACE_LACKS_TIMESPEC_T
+
#if !defined (ACE_MT_SAFE)
# define ACE_MT_SAFE 1
#endif
+
#define ACE_NEEDS_DEV_IO_CONVERSION
+
#define ACE_SIZEOF_FLOAT 4
#define ACE_SIZEOF_DOUBLE 8
#define ACE_SIZEOF_LONG_DOUBLE 16
#define ACE_HAS_EBCDIC
+
#define ACE_TEMPLATES_REQUIRE_SOURCE
+
#define IN_CLASSD(a) ((((in_addr_t)(a)) & 0xf0000000) == 0xe0000000)
#define IN_MULTICAST(a) IN_CLASSD(a)
#include /**/ "ace/post.h"
diff --git a/dep/ACE_wrappers/ace/config-netbsd.h b/dep/ACE_wrappers/ace/config-netbsd.h
index 75ffbe2fd6a..b05b26e3963 100644
--- a/dep/ACE_wrappers/ace/config-netbsd.h
+++ b/dep/ACE_wrappers/ace/config-netbsd.h
@@ -1,13 +1,17 @@
/* -*- C++ -*- */
// $Id: config-netbsd.h 80826 2008-03-04 14:51:23Z wotte $
+
#ifndef ACE_CONFIG_H
#define ACE_CONFIG_H
+
#ifndef ACE_MT_SAFE
#define ACE_MT_SAFE 1
#endif
+
#if defined (__GNUG__)
# include "ace/config-g++-common.h"
#endif /* __GNUG__ */
+
#if defined(ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
# define ACE_HAS_THREADS 1
# define ACE_HAS_PTHREADS 1
@@ -17,6 +21,7 @@
# define ACE_LACKS_PTHREAD_THR_SIGSETMASK 1
# define ACE_LACKS_PTHREAD_YIELD 1
#endif /* ACE_MT_SAFE */
+
#define ACE_HAS_CLOCK_SETTIME 1
#define ACE_HAS_CLOCK_GETTIME 1
#define ACE_HAS_SETTIMEOFDAY 1
@@ -118,6 +123,7 @@
#define ACE_LACKS_WCSICMP 1
#define ACE_LACKS_WCSNICMP 1
#define ACE_SCANDIR_CMP_USES_CONST_VOIDPTR 1
+
#if defined(__x86_64__)
#define ACE_SIZEOF_DOUBLE 8
#define ACE_SIZEOF_FLOAT 4
@@ -128,11 +134,15 @@
#define ACE_SIZEOF_SHORT 2
#define ACE_SIZEOF_VOID_P 8
#define ACE_SIZEOF_WCHAR 4
+
typedef unsigned long ACE_UINT64;
typedef signed long ACE_INT64;
+
#define ACE_SSIZE_T_FORMAT_SPECIFIER ACE_TEXT ("%ld")
#define ACE_SIZE_T_FORMAT_SPECIFIER ACE_TEXT ("%lu")
+
#elif defined(__i386__)
+
#define ACE_SIZEOF_DOUBLE 8
#define ACE_SIZEOF_FLOAT 4
#define ACE_SIZEOF_INT 4
@@ -142,12 +152,16 @@ typedef signed long ACE_INT64;
#define ACE_SIZEOF_SHORT 2
#define ACE_SIZEOF_VOID_P 4
#define ACE_SIZEOF_WCHAR 4
+
typedef unsigned long long ACE_UINT64;
typedef signed long long ACE_INT64;
+
#else
# error unknown CPU architecture
#endif
+
#endif /* ACE_CONFIG_H */
+
// Local Variables:
// mode:C++
// End:
diff --git a/dep/ACE_wrappers/ace/config-openbsd.h b/dep/ACE_wrappers/ace/config-openbsd.h
index 00c6da6b37e..e81e36bc613 100644
--- a/dep/ACE_wrappers/ace/config-openbsd.h
+++ b/dep/ACE_wrappers/ace/config-openbsd.h
@@ -1,28 +1,38 @@
/* -*- C++ -*- */
// $Id: config-openbsd.h 80826 2008-03-04 14:51:23Z wotte $
+
// The following configuration file is designed to work for OpenBSD
// platforms using GNU g++.
+
#ifndef ACE_CONFIG_H
#define ACE_CONFIG_H
#include /**/ "ace/pre.h"
+
#if defined (ACE_HAS_THREADS)
#include /**/ <pthread.h>
#endif /* ACE_HAS_THREADS */
+
#include "ace/config-posix.h"
+
#if ! defined (__ACE_INLINE__)
#define __ACE_INLINE__
#endif /* ! __ACE_INLINE__ */
+
#define ACE_SIZEOF_LONG_DOUBLE 12
+
#if defined (__GNUG__)
# include "ace/config-g++-common.h"
#endif /* __GNUG__ */
+
// Platform specific directives
// gcc defines __OpenBSD__ automatically for us.
#include <sys/param.h>
+
#if defined (ACE_HAS_THREADS)
#if !defined (_THREAD_SAFE)
#define _THREAD_SAFE
#endif /* _THREAD_SAFE */
+
// Check if pthreads and native exceptions are being used together.
// This causes SEGVs to tbe thrown somewhat randomly for some
// reason. According to newsgroup postings, it appears to be an
@@ -30,119 +40,166 @@
#if defined (ACE_USES_NATIVE_EXCEPTIONS)
#error "OpenBSD pthreads and native exceptions currently do not work. See OpenBSD bug #1750"
#endif /* ACE_USES_NATIVE_EXCEPTIONS */
+
#endif /* ACE_HAS_THREADS */
+
#define ACE_HAS_GPERF
+
// Platform specific directives
/* Are the following true? */
#define ACE_LACKS_GETPGID
#define ACE_LACKS_SETPGID
#define ACE_LACKS_SETREGID
#define ACE_LACKS_SETREUID
+
#define ACE_HAS_ALT_CUSERID
#define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS
+
#define ACE_LACKS_RWLOCK_T
#define ACE_HAS_SIG_MACROS
#define ACE_HAS_CHARPTR_DL
#define ACE_HAS_DIRENT
+
// OpenBSD 3.6
#if (OpenBSD < 200411)
# define ACE_USES_ASM_SYMBOL_IN_DLSYM
#endif
+
#define ACE_LACKS_UCONTEXT_H
+
// ucontext_t is in OpenBSD 3.5 and later.
#if (OpenBSD >= 200405)
# define ACE_HAS_UCONTEXT_T
#endif /* OpenBSD >= 200405 */
+
// OpenBSD has sigwait defined
#define ACE_HAS_SIGWAIT
#define ACE_HAS_SIGINFO_T
+
#define ACE_HAS_REENTRANT_FUNCTIONS
#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS
#define ACE_LACKS_PWD_REENTRANT_FUNCTIONS
#define ACE_LACKS_RAND_REENTRANT_FUNCTIONS
#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R
+
#define ACE_HAS_SOCKLEN_T
+
#define ACE_HAS_POLL
+
// Use of <malloc.h> is deprecated.
#define ACE_LACKS_MALLOC_H
+
// NetBSD appears to have a sigset_t type.
// #define ACE_LACKS_SIGSET
+
// Platform supports POSIX timers via struct timespec.
#define ACE_HAS_POSIX_TIME
#define ACE_HAS_UALARM
+
// Platform defines struct timespec but not timespec_t
#define ACE_LACKS_TIMESPEC_T
+
#define ACE_LACKS_STDINT_H
#define ACE_LACKS_STROPTS_H
#define ACE_LACKS_WCHAR_H
+
#define ACE_LACKS_STRRECVFD
+
#define ACE_HAS_SOCKADDR_IN_SIN_LEN
#define ACE_HAS_SOCKADDR_IN6_SIN6_LEN
+
// Platform supports System V IPC (most versions of UNIX, but not Win32)
#define ACE_HAS_SYSV_IPC
+
// Compiler/platform contains the <sys/syscall.h> file.
#define ACE_HAS_SYS_SYSCALL_H
+
// OpenBSD supports the getifaddrs interface
#define ACE_HAS_GETIFADDRS
+
// Compiler/platform supports SVR4 signal typedef
#define ACE_HAS_SVR4_SIGNAL_T
#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES
+
// Compiler/platform supports alloca().
// Although ACE does have alloca() on this compiler/platform combination, it is
// disabled by default since it can be dangerous. Uncomment the following line
// if you ACE to use it.
//#define ACE_HAS_ALLOCA
+
// Compiler/platform supports SVR4 dynamic linking semantics..
#define ACE_HAS_SVR4_DYNAMIC_LINKING
+
// Compiler/platform correctly calls init()/fini() for shared libraries.
#define ACE_HAS_AUTOMATIC_INIT_FINI
+
// Explicit dynamic linking permits "lazy" symbol resolution
#define ACE_HAS_RTLD_LAZY_V
+
// platform supports POSIX O_NONBLOCK semantics
#define ACE_HAS_POSIX_NONBLOCK
+
// platform supports IP multicast
#define ACE_HAS_IP_MULTICAST
+
// Lacks perfect filtering, must bind group address.
#if !defined ACE_LACKS_PERFECT_MULTICAST_FILTERING
# define ACE_LACKS_PERFECT_MULTICAST_FILTERING 1
#endif /* ACE_LACKS_PERFECT_MULTICAST_FILTERING */
+
// Compiler/platform has <alloca.h>
//#define ACE_HAS_ALLOCA_H
+
// Compiler/platform has the getrusage() system call.
#define ACE_HAS_GETRUSAGE
+
// Compiler/platform defines the sig_atomic_t typedef.
#define ACE_HAS_SIG_ATOMIC_T
+
// Compiler/platform defines a union semun for SysV shared memory.
#define ACE_HAS_SEMUN
+
// Compiler supports the ssize_t typedef.
#define ACE_HAS_SSIZE_T
+
// Compiler/platform supports strerror ().
#define ACE_HAS_STRERROR
+
// Compiler/platform provides the sockio.h file.
#define ACE_HAS_SYS_SOCKIO_H
+
// Defines the page size of the system.
#define ACE_PAGE_SIZE 4096
+
// Platform provides <sys/filio.h> header.
#define ACE_HAS_SYS_FILIO_H
+
#define ACE_HAS_SYSCTL
+
// Platform/compiler supports timezone * as second parameter to gettimeofday().
#define ACE_HAS_TIMEZONE_GETTIMEOFDAY
+
// OpenBSD's dlsym call segfaults when passed an invalid handle.
// It seems as if most other OSs detect this and just report an
// error.
#define ACE_HAS_DLSYM_SEGFAULT_ON_INVALID_HANDLE
+
#define ACE_HAS_MSG
#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG
#define ACE_HAS_NONCONST_MSGSND
+
#ifdef ACE_HAS_THREADS
// Thread specific settings
+
// And they're even POSIX pthreads
#if !defined (ACE_MT_SAFE)
# define ACE_MT_SAFE 1
#endif /* ! ACE_MT_SAFE */
#endif /* ACE_HAS_THREADS */
+
#define ACE_HAS_SIGWAIT
+
// Optimize ACE_Handle_Set for select().
#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT
#define ACE_HAS_NONCONST_SELECT_TIMEVAL
@@ -151,21 +208,29 @@
#define ACE_LACKS_MUTEXATTR_PSHARED
#define ACE_HAS_THREAD_SPECIFIC_STORAGE
#define ACE_HAS_DIRENT
+
#if !defined (ACE_HAS_THREADS)
// OpenBSD really has readdir_r () in single threaded mode,
// but the #ifdefs in OS.i select one with the wrong parameter
// sets if the ACE_HAS_POSIX_STD isn't defined (which is defined
// when ACE_HAS_THREADS is defined.)
+
#define ACE_LACKS_READDIR_R
+
#endif /* ! ACE_HAD_THREADS */
+
// Platform has POSIX terminal interface.
#define ACE_HAS_TERMIOS
+
// OpenBSD 3.2 lacks sched_setscheduler (see /usr/src/lib/libc_r/TODO)
#define ACE_LACKS_SETSCHED
+
// OpenBSD supports IPv6 by default, but ACE IPv6 code
// has compile errors.
//#define ACE_HAS_IPV6
+
#define ACE_HAS_3_PARAM_READDIR_R
+
#include /**/ "ace/post.h"
#endif /* ACE_CONFIG_H */
diff --git a/dep/ACE_wrappers/ace/config-openvms.h b/dep/ACE_wrappers/ace/config-openvms.h
index 50a7539666c..90541513f35 100644
--- a/dep/ACE_wrappers/ace/config-openvms.h
+++ b/dep/ACE_wrappers/ace/config-openvms.h
@@ -1,11 +1,15 @@
/* -*- C++ -*- */
// $Id: config-openvms.h 81935 2008-06-12 22:01:53Z jtc $
+
// The following configuration file is designed to work for OpenVMS 7.3-2
+
#ifndef ACE_CONFIG_H
#define ACE_CONFIG_H
+
#if !defined (ACE_USE_RCSID)
# define ACE_USE_RCSID 0
#endif
+
#ifdef __cplusplus
#pragma message disable CODCAUUNR
#pragma message disable CODEUNREACHABLE
@@ -16,11 +20,16 @@
//#pragma message disable LONGEXTERN
#pragma message disable UNSCOMZER
#endif
+
// Use a signed int to match POSIX
#define __SIGNED_INT_TIME_T
+
#define ACE_OPENVMS __VMS_VER
+
#define ACE_DLL_SUFFIX ACE_TEXT("")
+
#define ACE_HAS_DUMP 1
+
// need this includes to ensure proper sequence of definitions so that
// f.i. HP C/C++ does not '#define ' memcpy, memmove etc.
#include <stdarg.h>
@@ -30,6 +39,7 @@
#undef memset
#undef memcpy
#undef memmove
+
#if defined(__ia64__)
// on OpenVMS IA64 we need this get the singleton exported since we build
// ACE/TAO with the NOTEMPLATES export option which prohibits exporting
@@ -42,9 +52,13 @@
#else
#define ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION
#endif
+
#define ACE_DEFAULT_BASE_ADDR ((char*)(0x30000000))
+
#define ACE_MAX_UDP_PACKET_SIZE 65535
+
#define ACE_HAS_STDCPP_STL_INCLUDES 1
+
/* missing system headers */
#define ACE_LACKS_STDINT_H 1
#define ACE_LACKS_SYS_IPC_H 1
@@ -62,6 +76,7 @@
#define ACE_LACKS_SYS_PARAM_H 1
#define ACE_LACKS_SIGINFO_H 1
#define ACE_LACKS_UCONTEXT_H 1
+
/* missing rtl functions */
#define ACE_LACKS_SETPGID 1
#define ACE_LACKS_SETREUID 1
@@ -72,10 +87,14 @@
#define ACE_LACKS_FCNTL 1
#define ACE_LACKS_SETEGID 1
#define ACE_LACKS_SETEUID 1
+
#define ACE_LACKS_REALPATH 1
+
#define ACE_LACKS_SYMLINKS 1
+
#define ACE_LACKS_PWD_REENTRANT_FUNCTIONS 1
#define ACE_LACKS_RAND_REENTRANT_FUNCTIONS 1
+
#define ACE_HAS_P_READ_WRITE
#define ACE_HAS_CHARPTR_DL 1
#define ACE_HAS_CLOCK_GETTIME 1
@@ -91,6 +110,7 @@
#define ACE_HAS_SIG_MACROS 1
#define ACE_HAS_SIGWAIT 1
#define ACE_HAS_SIGTIMEDWAIT 1
+
#define ACE_HAS_SIG_C_FUNC 1
#define ACE_HAS_SIGISMEMBER_BUG
#define ACE_HAS_STRNLEN 1
@@ -109,6 +129,7 @@
#define ACE_LACKS_SETSCHED
#define ACE_LACKS_SYSCALL 1
#define ACE_LACKS_WCSTOULL 1
+
/* (missing) standard data types */
#define ACE_LACKS_CONST_TIMESPEC_PTR 1
#define ACE_LACKS_SUSECONDS_T 1
@@ -121,10 +142,12 @@
#define ACE_LACKS_SEMBUF_T 1
#define ACE_LACKS_STRRECVFD 1
#define ACE_LACKS_T_ERRNO 1
+
/* POSIX threads ompatibilities */
#define ACE_LACKS_RWLOCK_T 1
#define ACE_LACKS_PTHREAD_KILL 1
#define ACE_LACKS_THREAD_PROCESS_SCOPING 1
+
#define ACE_HAS_PTHREADS 1
#define ACE_HAS_PTHREAD_PROCESS_ENUM 1
#define ACE_LACKS_UNNAMED_SEMAPHORE 1
@@ -139,16 +162,19 @@
#define ACE_HAS_PTHREAD_SETCONCURRENCY 1
#define ACE_HAS_PTHREAD_GETCONCURRENCY 1
#define ACE_HAS_PTHREAD_SCHEDPARAM 1
+
/* language/platform conformance */
#define ACE_NEW_THROWS_EXCEPTIONS 1
#define ACE_TEMPLATES_REQUIRE_SOURCE 1
#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1
#define ACE_HAS_AUTOMATIC_INIT_FINI 1
#define ACE_LACKS_UNIX_SIGNALS 1
+
#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES 1
#define ACE_HAS_CPLUSPLUS_HEADERS 1
#define ACE_HAS_EXCEPTIONS 1
#define ACE_LACKS_LINEBUFFERED_STREAMBUF 1
+
#define ACE_HAS_GPERF 1
#define ACE_HAS_IP_MULTICAST 1
#define ACE_LACKS_PERFECT_MULTICAST_FILTERING 1
@@ -158,11 +184,13 @@
#define ACE_HAS_STANDARD_CPP_LIBRARY 1
#define ACE_HAS_STRING_CLASS 1
#define ACE_HAS_SVR4_DYNAMIC_LINKING 1
+
#define ACE_HAS_TEMPLATE_TYPEDEFS 1
#define ACE_LACKS_NAMED_POSIX_SEM 1
#define ACE_LACKS_SYSV_SHMEM 1
#define ACE_LACKS_UNIX_DOMAIN_SOCKETS 1
#define ACE_LACKS_UNIX_SYSLOG 1
#define ACE_LACKS_ALPHASORT 1
+
#endif
diff --git a/dep/ACE_wrappers/ace/config-pharlap.h b/dep/ACE_wrappers/ace/config-pharlap.h
index ef6c8fc1d2a..e0751c32f1c 100644
--- a/dep/ACE_wrappers/ace/config-pharlap.h
+++ b/dep/ACE_wrappers/ace/config-pharlap.h
@@ -1,10 +1,13 @@
/* -*- C++ -*- */
// $Id: config-pharlap.h 81837 2008-06-04 22:48:08Z shuston $
+
// This configuration file is for use with the PharLap Realtime ETS Kernel.
// It has been tested with PharLap TNT Embedded ToolSuite version 9.1.
+
#ifndef ACE_CONFIG_PHARLAP_H
#define ACE_CONFIG_PHARLAP_H
#include /**/ "ace/pre.h"
+
#define ACE_HAS_PHARLAP
// Some features are only available with the Realtime edition of ETS.
// Assume that if using ACE, the realtime version is also being used, but
@@ -16,12 +19,15 @@
# undef ACE_HAS_PHARLAP_RT
# endif
#endif
+
// Fortunately, PharLap ETS offers much of the Win32 API. But it's still on
// Winsock 1.1
#define ACE_HAS_WINSOCK2 0
+
// The TSS implementation doesn't pass muster on the TSS_Test, but it works
// well with ACE's TSS emulation.
#define ACE_HAS_TSS_EMULATION
+
#define ACE_LACKS_MMAP
#define ACE_LACKS_MPROTECT
#define ACE_LACKS_MSYNC
@@ -32,45 +38,54 @@
#define ACE_LACKS_WIN32_SECURITY_DESCRIPTORS
#define ACE_LACKS_WIN32_SERVICES
#define ACE_LACKS_WIN32_SETFILEPOINTEREX
+
// There's no host table, by default. So using "localhost" won't work.
// If your system does have the ability to use "localhost" and you want to,
// define it before including this file.
#if !defined (ACE_LOCALHOST)
# define ACE_LOCALHOST "127.0.0.1"
#endif /* ACE_LOCALHOST */
+
// The normal Windows default stack size doesn't hold for ETS. Set what you
// want explicitly.
#if !defined (ACE_DEFAULT_THREAD_STACKSIZE)
# define ACE_DEFAULT_THREAD_STACKSIZE (1024*1024)
#endif /* ACE_DEFAULT_THREAD_STACKSIZE */
+
// Don't know how to get the page size at execution time. This is most likely
// the correct value.
#define ACE_PAGE_SIZE 4096
+
#if defined (ACE_HAS_PHARLAP_RT)
# define ACE_HAS_IP_MULTICAST
// ETS winsock doesn't define IP level socket options
//# define IP_TOS 8
#endif /* ACE_HAS_PHARLAP_RT */
+
// Let the config-win32.h file do its thing
#undef ACE_CONFIG_H
#include "ace/config-win32.h"
// Now remove things that desktop/server Windows has but Pharlap ETS doesn't.
#undef ACE_HAS_INTERLOCKED_EXCHANGEADD
#undef ACE_HAS_WCHAR
+
// PharLap's exports apparantly define LockFile, but it's documented as
// unsupported. LockFileEx is not present.
#define ACE_LACKS_FILELOCKS
+
#include /**/ <embkern.h>
#if defined (ACE_HAS_PHARLAP_RT)
# include /**/ <embtcpip.h>
#define ACE_LACKS_IP_ADD_MEMBERSHIP
#endif /* ACE_HAS_PHARLAP_RT */
+
// Although IN_CLASSD is defined in both winsock.h and winsock2.h, it ends
// up undefined for Pharlap ETS builds. If this is the case, set things up
// so nothing looks like class D.
#if !defined (IN_CLASSD)
# define IN_CLASSD(i) (0)
#endif
+
#include /**/ "ace/post.h"
#endif /* ACE_CONFIG_PHARLAP_H */
diff --git a/dep/ACE_wrappers/ace/config-posix-nonetworking.h b/dep/ACE_wrappers/ace/config-posix-nonetworking.h
index d1e1f74e776..492692179d8 100644
--- a/dep/ACE_wrappers/ace/config-posix-nonetworking.h
+++ b/dep/ACE_wrappers/ace/config-posix-nonetworking.h
@@ -1,10 +1,13 @@
/* -*- C -*- */
// $Id: config-posix-nonetworking.h 80826 2008-03-04 14:51:23Z wotte $
+
/* The following configuration file is designed to work for RTEMS
platforms using GNU C.
*/
+
#ifndef ACE_CONFIG_POSIX_NONETWORKING_H
#define ACE_CONFIG_POSIX_NONETWORKING_H
+
// Missing header files
# define ACE_LACKS_SYS_UIO_H
# define ACE_LACKS_SYS_SOCKET_H
@@ -18,6 +21,7 @@
# define ACE_LACKS_MEMORY_H
# define ACE_LACKS_SYS_SYSCTL_H
# define ACE_LACKS_NETINET_TCP_H
+
// Missing types
# define ACE_LACKS_IOVEC
# define ACE_LACKS_IN_ADDR
@@ -31,6 +35,7 @@
# define ACE_LACKS_IFREQ
# define ACE_LACKS_IFCONF
# define ACE_LACKS_LINGER
+
// Missing methods
# define ACE_LACKS_GETHOSTBYADDR
# define ACE_LACKS_GETHOSTBYNAME
@@ -70,10 +75,13 @@
# define ACE_LACKS_WRITEV
# define ACE_LACKS_SOCKETPAIR
# undef ACE_HAS_MSG
+
// Missing OS features
# define ACE_LACKS_UNIX_SYSLOG
# define ACE_LACKS_TCP_NODELAY
+
// Missing ACE features
# define ACE_DISABLE_NOTIFY_PIPE_DEFAULT 1
+
#endif /* ACE_CONFIG_POSIX_NONETWORKING_H */
diff --git a/dep/ACE_wrappers/ace/config-posix.h b/dep/ACE_wrappers/ace/config-posix.h
index 6015293d546..a9cb744435b 100644
--- a/dep/ACE_wrappers/ace/config-posix.h
+++ b/dep/ACE_wrappers/ace/config-posix.h
@@ -1,8 +1,11 @@
/* -*- C++ -*- */
// $Id: config-posix.h 82517 2008-08-05 19:36:26Z shuston $
+
#ifndef ACE_CONFIG_POSIX_H
#define ACE_CONFIG_POSIX_H
+
#include <unistd.h>
+
/* The following POSIX constants are defined after <unistd.h> is
* included. They are documented in:
* http://www.opengroup.org/onlinepubs/007904975/basedefs/unistd.h.html
@@ -12,11 +15,13 @@
# define ACE_HAS_POSIX_REALTIME_SIGNALS
# endif /* ACE_HAS_POSIX_REALTIME_SIGNALS */
#endif /* _POSIX_REALTIME_SIGNALS */
+
#if defined(_POSIX_ASYNCHRONOUS_IO) && (_POSIX_ASYNCHRONOUS_IO-0 != -1 )
# if !defined(ACE_HAS_AIO_CALLS)
# define ACE_HAS_AIO_CALLS
# endif /* ACE_HAS_AIO_CALLS */
#endif /* _POSIX_ASYNCHRONOUS_IO */
+
#if !defined (ACE_MT_SAFE) || (ACE_MT_SAFE != 0)
# if defined(_POSIX_SEMAPHORES) && (_POSIX_SEMAPHORES-0 != -1 )
# if !defined(ACE_HAS_POSIX_SEM)
@@ -30,11 +35,13 @@
# endif /* ACE_HAS_POSIX_SEM */
# endif /* ACE_HAS_POSIX_SEM */
#endif /* !ACE_MT_SAFE */
+
#if defined(_POSIX_SHARED_MEMORY_OBJECTS) && (_POSIX_SHARED_MEMORY_OBJECTS-0 != -1 )
# if !defined(ACE_HAS_SHM_OPEN)
# define ACE_HAS_SHM_OPEN
# endif /* ACE_HAS_SHM_OPEN */
#endif /* _POSIX_SHARED_MEMORY_OBJECTS */
+
// Check if threading enabled/disable through platform_macros
#if !defined (ACE_MT_SAFE) || (ACE_MT_SAFE != 0)
// Allow the user to disable use of threads by setting ACE_HAS_THREADS to 0
@@ -48,16 +55,20 @@
# if !defined(ACE_HAS_THREADS)
# define ACE_HAS_THREADS
# endif /* ACE_HAS_THREADS */
+
# if !defined(ACE_HAS_PTHREADS)
# define ACE_HAS_PTHREADS
# endif /* ACE_HAS_PTHREADS */
+
# endif /* _POSIX_THREADS */
# endif /* ACE_HAS_THREADS */
#endif /* !ACE_MT_SAFE */
+
#if defined(_POSIX_MESSAGE_PASSING) && (_POSIX_MESSAGE_PASSING-0 != -1 )
# if !defined(ACE_HAS_POSIX_MESSAGE_PASSING)
# define ACE_HAS_POSIX_MESSAGE_PASSING
# endif /* ACE_HAS_POSIX_MESSAGE_PASSING */
#endif /* _POSIX_MESSAGE_PASSING */
+
#endif /* ACE_CONFIG_POSIX_H */
diff --git a/dep/ACE_wrappers/ace/config-qnx-neutrino.h b/dep/ACE_wrappers/ace/config-qnx-neutrino.h
index 923a68d073b..ef37758352a 100644
--- a/dep/ACE_wrappers/ace/config-qnx-neutrino.h
+++ b/dep/ACE_wrappers/ace/config-qnx-neutrino.h
@@ -2,15 +2,19 @@
// $Id: config-qnx-neutrino.h 80826 2008-03-04 14:51:23Z wotte $
// The following configuration file is designed to work for Neutrino
// 2.0 (Beta) with GNU C++ and the POSIX (pthread) threads package.
+
#ifndef ACE_CONFIG_H
#define ACE_CONFIG_H
#include /**/ "ace/pre.h"
+
#define _POSIX_C_SOURCE 199506
#define _QNX_SOURCE
+
// These constants are in i386-nto/include/limits.h, but egcs
// picks up its own limits.h instead:
#define _POSIX_NAME_MAX 14 /* Max bytes in a filename */
#define _POSIX_PATH_MAX 256 /* Num. bytes in pathname (excl. NULL) */
+
#if defined(__OPTIMIZE__)
# if defined(__X86__)
// string.h can't be used by ACE with __OPTIMIZE__.
@@ -19,7 +23,9 @@
# define __OPTIMIZE__
# endif /* __X86__ */
#endif /* __OPTIMIZE__ */
+
#include "ace/config-g++-common.h"
+
// The following defines the Neutrino compiler.
// gcc should know to call g++ as necessary
#ifdef __GNUC__
@@ -27,6 +33,7 @@
#else
# define ACE_CC_NAME ACE_TEXT ("NTO compiler ??")
#endif
+
// /usr/nto/include/float.h defines
// FLT_MAX_EXP 127
// DBL_MAX_EXP 1023
@@ -35,6 +42,7 @@
// These macros are:
// #define ACE_SIZEOF_DOUBLE 8
// #define ACE_SIZEOF_FLOAT 4
+
#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R
#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG
// Although ACE does have alloca() on this compiler/platform combination, it is
@@ -124,6 +132,7 @@
#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1
#define ACE_HAS_SIGTIMEDWAIT
#define ACE_HAS_SIGSUSPEND
+
#include /**/ "ace/post.h"
#endif /* ACE_CONFIG_H */
diff --git a/dep/ACE_wrappers/ace/config-qnx-rtp-62x.h b/dep/ACE_wrappers/ace/config-qnx-rtp-62x.h
index c2c63c33b58..5ad3326b412 100644
--- a/dep/ACE_wrappers/ace/config-qnx-rtp-62x.h
+++ b/dep/ACE_wrappers/ace/config-qnx-rtp-62x.h
@@ -7,6 +7,7 @@
#define ACE_CONFIG_QNX_RTP_62x_H
#include /**/ "ace/pre.h"
#include /**/ "ace/config-qnx-rtp-common.h"
+
/////////////////////////////////////////////////////////////////
// Definition of the features that are available.
//
@@ -68,6 +69,7 @@
#define ACE_HAS_UCONTEXT_T
#define ACE_HAS_VOIDPTR_MMAP
#define ACE_HAS_VOIDPTR_SOCKOPT
+
/////////////////////////////////////////////////////////////////
// Definition of the features that are not available.
//
@@ -97,7 +99,9 @@
#define ACE_LACKS_T_ERRNO
#define ACE_LACKS_U_LONGLONG_T
#define ACE_LACKS_ALPHASORT
+
#define ACE_LACKS_RLIMIT // QNX rlimit syscalls don't work properly with ACE.
+
#define ACE_MT_SAFE 1
#define ACE_NEEDS_FUNC_DEFINITIONS
#define ACE_NEEDS_HUGE_THREAD_STACKSIZE 64000
@@ -105,8 +109,11 @@
#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1
#define ACE_HAS_SIGTIMEDWAIT
#define ACE_HAS_SIGSUSPEND
+
#define ACE_HAS_BROKEN_PREALLOCATED_OBJECTS_AFTER_FORK 1
+
#define ACE_SIZEOF_WCHAR 4
+
// No prototypes
#define ACE_LACKS_ITOW
#define ACE_LACKS_WCSICMP
diff --git a/dep/ACE_wrappers/ace/config-qnx-rtp-common.h b/dep/ACE_wrappers/ace/config-qnx-rtp-common.h
index 7ed1a01a249..ee832adf604 100644
--- a/dep/ACE_wrappers/ace/config-qnx-rtp-common.h
+++ b/dep/ACE_wrappers/ace/config-qnx-rtp-common.h
@@ -1,15 +1,19 @@
// -*- C++ -*-
// $Id: config-qnx-rtp-common.h 80826 2008-03-04 14:51:23Z wotte $
// several macros common to various qnx neutrino version.
+
#ifndef ACE_CONFIG_QNX_RTP_COMMON_H
#define ACE_CONFIG_QNX_RTP_COMMON_H
#include /**/ "ace/pre.h"
+
#define _POSIX_C_SOURCE 199506
#define _QNX_SOURCE
+
// These constants are in i386-nto/include/limits.h, but egcs
// picks up its own limits.h instead:
#define _POSIX_NAME_MAX 14 /* Max bytes in a filename */
#define _POSIX_PATH_MAX 256 /* Num. bytes in pathname (excl. NULL) */
+
#if defined(__OPTIMIZE__)
# if defined(__X86__)
// string.h can't be used by ACE with __OPTIMIZE__.
@@ -18,7 +22,9 @@
# define __OPTIMIZE__
# endif /* __X86__ */
#endif /* __OPTIMIZE__ */
+
#include "ace/config-g++-common.h"
+
// The following defines the Neutrino compiler.
// gcc should know to call g++ as necessary
#ifdef __GNUC__
@@ -26,6 +32,7 @@
#else
# define ACE_CC_NAME ACE_TEXT ("QNX-RTP compiler ??")
#endif
+
// /usr/nto/include/float.h defines
// FLT_MAX_EXP 127
// DBL_MAX_EXP 1023
@@ -34,6 +41,7 @@
// These macros are:
#define ACE_SIZEOF_DOUBLE 8
#define ACE_SIZEOF_FLOAT 4
+
#include /**/ "ace/post.h"
#endif /* ACE_CONFIG_QNX_RTP_COMMON_H */
diff --git a/dep/ACE_wrappers/ace/config-qnx-rtp-pre62x.h b/dep/ACE_wrappers/ace/config-qnx-rtp-pre62x.h
index 577934b88f4..af55eeb6cae 100644
--- a/dep/ACE_wrappers/ace/config-qnx-rtp-pre62x.h
+++ b/dep/ACE_wrappers/ace/config-qnx-rtp-pre62x.h
@@ -3,15 +3,18 @@
// The following configuration file is designed to work for QNX RTP
// GNU C++ and the POSIX (pthread) threads package. You can get QNX
// RTP at http://get.qnx.com
+
#ifndef ACE_CONFIG_RTP_PRE62x_H
#define ACE_CONFIG_RTP_PRE62x_H
#include /**/ "ace/pre.h"
#include /**/ "ace/config-qnx-rtp-common.h"
+
/////////////////////////////////////////////////////////////////
// Definition of the features that are available.
//
// ACE_HAS Section
/////////////////////////////////////////////////////////////////
+
#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R
#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG
// Although ACE does have alloca() on this compiler/platform combination, it is
@@ -63,6 +66,7 @@
#define ACE_HAS_UCONTEXT_T
#define ACE_HAS_VOIDPTR_MMAP
#define ACE_HAS_VOIDPTR_SOCKOPT
+
/////////////////////////////////////////////////////////////////
// Definition of the features that are not available.
//
@@ -101,7 +105,9 @@
#define ACE_LACKS_UCONTEXT_H
#define ACE_LACKS_UNIX_DOMAIN_SOCKETS
#define ACE_LACKS_U_LONGLONG_T
+
#define ACE_LACKS_RLIMIT // QNX rlimit syscalls don't work properly with ACE.
+
#define ACE_MT_SAFE 1
#define ACE_NEEDS_FUNC_DEFINITIONS
#define ACE_NEEDS_HUGE_THREAD_STACKSIZE 64000
@@ -110,15 +116,20 @@
#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1
#define ACE_HAS_SIGTIMEDWAIT
#define ACE_HAS_SIGSUSPEND
+
#define ACE_HAS_BROKEN_PREALLOCATED_OBJECTS_AFTER_FORK 1
+
#define ACE_SIZEOF_WCHAR 4
+
// Not really, but the prototype returns wchar_t instead of wchar_t *
#define ACE_LACKS_WCSSTR
+
// No prototypes
#define ACE_LACKS_ITOW
#define ACE_LACKS_WCSICMP
#define ACE_LACKS_WCSNICMP
#define ACE_LACKS_WCSDUP
+
// And these have prototypes but no implementation
#define ACE_LACKS_WCSLEN
#define ACE_LACKS_WCSNCMP
@@ -133,7 +144,9 @@
#define ACE_LACKS_WCSCHR
#define ACE_LACKS_WCSPBRK
#define ACE_LACKS_WCSRCHR
+
#define ACE_LACKS_ACE_IOSTREAM
+
#include /**/ "ace/post.h"
#endif /* ACE_CONFIG_RTP_PRE62x_H */
diff --git a/dep/ACE_wrappers/ace/config-qnx-rtp.h b/dep/ACE_wrappers/ace/config-qnx-rtp.h
index 313a8184b6b..a176efd8f3e 100644
--- a/dep/ACE_wrappers/ace/config-qnx-rtp.h
+++ b/dep/ACE_wrappers/ace/config-qnx-rtp.h
@@ -8,6 +8,7 @@
#ifndef ACE_CONFIG_QNX_RTP_H
#define ACE_CONFIG_QNX_RTP_H
#include /**/ "ace/pre.h"
+
#include <sys/neutrino.h>
#if !defined(_NTO_VERSION)
# error "Could not detect QNX version from macro _NTO_VERSION"
@@ -19,6 +20,7 @@
# include /**/ "ace/config-qnx-rtp-62x.h"
# endif
#endif
+
#include /**/ "ace/post.h"
#endif /* ACE_CONFIG_QNX_RTP_H */
diff --git a/dep/ACE_wrappers/ace/config-rtems.h b/dep/ACE_wrappers/ace/config-rtems.h
index 95239f4f1a5..558a6e1007c 100644
--- a/dep/ACE_wrappers/ace/config-rtems.h
+++ b/dep/ACE_wrappers/ace/config-rtems.h
@@ -1,20 +1,26 @@
/* -*- C -*- */
// $Id: config-rtems.h 80826 2008-03-04 14:51:23Z wotte $
+
/* The following configuration file is designed to work for RTEMS
platforms using GNU C.
*/
+
#ifndef ACE_CONFIG_H
#define ACE_CONFIG_H
+
#if ! defined (__ACE_INLINE__)
#define __ACE_INLINE__
#endif /* ! __ACE_INLINE__ */
+
// Needed to make some prototypes visible.
// #if ! defined (_GNU_SOURCE)
// #define _GNU_SOURCE
// #endif /* ! _GNU_SOURCE */
+
// First the machine specific part
// There are no known port specific issues with the RTEMS port of ACE.
// XXX Pentium and PowerPC have high res timer support in ACE.
+
// Then the compiler specific parts
#if defined (__GNUG__)
// config-g-common.h undef's ACE_HAS_STRING_CLASS with -frepo, so
@@ -26,9 +32,13 @@
# error unsupported compiler in ace/config-rtems.h
# endif /* __cplusplus */
#endif /* ! __GNUG__ */
+
#include "ace/config-posix.h"
+
// Completely common part :-)
+
#define ACE_HAS_NONSTATIC_OBJECT_MANAGER
+
#define ACE_LACKS_ALPHASORT
#define ACE_LACKS_REGEX_H
#define ACE_LACKS_STROPTS_H
@@ -49,12 +59,15 @@
#define ACE_LACKS_RAND_REENTRANT_FUNCTIONS
#define ACE_LACKS_REALPATH
#define ACE_LACKS_TEMPNAM
+
// Temporarily, enabling this results in compile errors with
// rtems 4.6.6.
#define ACE_LACKS_WCHAR_H
+
#if !defined (ACE_MT_SAFE)
#define ACE_MT_SAFE 1
#endif
+
#if ACE_MT_SAFE
# define ACE_HAS_THREADS
# define ACE_HAS_PTHREADS
@@ -65,6 +78,7 @@
# define ACE_HAS_POSIX_GETPWNAM_R
# define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R
#endif
+
#define ACE_HAS_ALT_CUSERID
#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG
#define ACE_HAS_3_PARAM_READDIR_R
@@ -125,6 +139,7 @@
#define ACE_NEEDS_SCHED_H
#define ACE_HAS_POSIX_NONBLOCK
#define ACE_HAS_TERMIOS
+
// rtems 4.7 or higher
#if (__RTEMS_MAJOR__ > 4) || (__RTEMS_MAJOR__ == 4 && __RTEMS_MINOR__ > 6)
# define ACE_HAS_UALARM
@@ -135,13 +150,17 @@
# undef ACE_HAS_SHM_OPEN
# undef ACE_HAS_AIO_CALLS
#endif
+
// __RTEMS_REVISION__ could also be used but this is broken according
// to the rtems people
+
#if !defined (_POSIX_REALTIME_SIGNALS)
# define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES
#endif
+
#if defined (ACE_LACKS_NETWORKING)
# include "ace/config-posix-nonetworking.h"
#endif
+
#endif /* ACE_CONFIG_H */
diff --git a/dep/ACE_wrappers/ace/config-sco-5.0.0-nothread.h b/dep/ACE_wrappers/ace/config-sco-5.0.0-nothread.h
index 6cf82043688..7d5c4f4ebef 100644
--- a/dep/ACE_wrappers/ace/config-sco-5.0.0-nothread.h
+++ b/dep/ACE_wrappers/ace/config-sco-5.0.0-nothread.h
@@ -1,11 +1,15 @@
/* -*- C++ -*- */
// $Id: config-sco-5.0.0-nothread.h 80826 2008-03-04 14:51:23Z wotte $
+
#ifndef ACE_CONFIG_H
#define ACE_CONFIG_H
#include /**/ "ace/pre.h"
+
#include "ace/config-g++-common.h"
#include "ace/config-sco-5.0.0.h"
+
#define ACE_HAS_GNU_CSTRING_H
+
#include /**/ "ace/post.h"
#endif /* ACE_CONFIG_H */
diff --git a/dep/ACE_wrappers/ace/config-sco-5.0.0.h b/dep/ACE_wrappers/ace/config-sco-5.0.0.h
index 7ce4b215d1a..35c33a43fad 100644
--- a/dep/ACE_wrappers/ace/config-sco-5.0.0.h
+++ b/dep/ACE_wrappers/ace/config-sco-5.0.0.h
@@ -1,15 +1,19 @@
/* -*- C++ -*- */
// $Id: config-sco-5.0.0.h 80826 2008-03-04 14:51:23Z wotte $
+
#ifndef ACE_CONFIG_SCO_5_0_0_H
#define ACE_CONFIG_SCO_5_0_0_H
#include /**/ "ace/pre.h"
+
// Compiling for SCO.
#if !defined (SCO)
#define SCO
#endif /* SCO */
+
#if defined (SCO) && !defined (MAXPATHLEN)
#define MAXPATHLEN 1023
#endif /* SCO */
+
#define ACE_HAS_NONCONST_SELECT_TIMEVAL
#define ACE_HAS_SIG_MACROS
#define ACE_LACKS_CONST_TIMESPEC_PTR
@@ -18,55 +22,77 @@
#define ACE_NEEDS_FTRUNCATE
#define ACE_LACKS_MADVISE
#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS
+
#define ACE_DEFAULT_CLOSE_ALL_HANDLES 0
+
// Platform supports System V IPC (most versions of UNIX, but not Win32)
#define ACE_HAS_SYSV_IPC
#define ACE_HAS_NONCONST_MSGSND
#define ACE_HAS_BIG_FD_SET
#define ACE_HAS_SVR4_DYNAMIC_LINKING
#define ACE_HAS_AUTOMATIC_INIT_FINI
+
// Platform has POSIX terminal interface.
#define ACE_HAS_TERMIOS
+
// Compiler/platform contains the <sys/syscall.h> file.
//#define ACE_HAS_SYS_SYSCALL_H
+
// Fixes a problem with HP/UX not wrapping the mmap(2) header files
// with extern "C".
//#define ACE_HAS_BROKEN_MMAP_H
+
// Prototypes for both signal() and struct sigaction are consistent.
#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES
+
// Compiler/platform has correctly prototyped header files.
#define ACE_HAS_CPLUSPLUS_HEADERS
+
// Header files lack t_errno for ACE_TLI.
//#define ACE_LACKS_T_ERRNO
+
// Compiler/platform supports poll().
// #define ACE_HAS_POLL
+
// Platform supports POSIX O_NONBLOCK semantics.
#define ACE_HAS_POSIX_NONBLOCK
+
// Compiler/platform defines the sig_atomic_t typedef
#define ACE_HAS_SIG_ATOMIC_T
+
// Compiler supports the ssize_t typedef.
//#define ACE_HAS_SSIZE_T
+
// Defines the page size of the system.
#define ACE_PAGE_SIZE 4096
+
// Compiler/platform supports strerror ().
#define ACE_HAS_STRERROR
+
#define ACE_HAS_TIMEZONE_GETTIMEOFDAY
+
// Note, this only works if the flag is set above!
//#define ACE_HAS_GETRUSAGE
+
// Platform uses int for select() rather than fd_set.
#define ACE_HAS_SELECT_H
+
// Platform has prototypes for ACE_TLI.
#define ACE_HAS_TLI_PROTOTYPES
// Platform has the XLI version of ACE_TLI.
// #define ACE_HAS_XLI
+
#define ACE_HAS_SIGINFO_T
#define ACE_HAS_UCONTEXT_T
+
#define ACE_LACKS_STRCASECMP
+
// #define ACE_HAS_POSIX_TIME
#define ACE_HAS_IP_MULTICAST
#define ACE_HAS_DIRENT
#define ACE_LACKS_READDIR_R
#define ACE_HAS_GPERF
+
#include /**/ "ace/post.h"
#endif /* ACE_CONFIG_SCO_5_0_0_H */
diff --git a/dep/ACE_wrappers/ace/config-suncc-common.h b/dep/ACE_wrappers/ace/config-suncc-common.h
index 3c54e85f644..31d424d76b5 100644
--- a/dep/ACE_wrappers/ace/config-suncc-common.h
+++ b/dep/ACE_wrappers/ace/config-suncc-common.h
@@ -1,9 +1,11 @@
// -*- C++ -*-
//
// $Id: config-suncc-common.h 81935 2008-06-12 22:01:53Z jtc $
+
#ifndef ACE_SUNCC_COMMON_H
#define ACE_SUNCC_COMMON_H
#include /**/ "ace/pre.h"
+
# define ACE_HAS_CPLUSPLUS_HEADERS
# define ACE_HAS_STDCPP_STL_INCLUDES
# define ACE_HAS_TEMPLATE_TYPEDEFS
@@ -27,6 +29,7 @@
# define ACE_IMPORT_SINGLETON_DECLARATION(T) __extension__ extern template class T
# define ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) __extension__ extern template class SINGLETON_TYPE<CLASS, LOCK>;
#endif /* ACE_HAS_CUSTOM_EXPORT_MACROS == 0 */
+
// __EXCEPTIONS is defined with -fexceptions, the egcs default. It
// is not defined with -fno-exceptions, the ACE default for g++.
// ACE_HAS_EXCEPTIONS is defined in
@@ -35,12 +38,15 @@
# if defined (__EXCEPTIONS) && !defined (ACE_HAS_EXCEPTIONS)
# define ACE_HAS_EXCEPTIONS
# endif /* __EXCEPTIONS && ! ACE_HAS_EXCEPTIONS */
+
# if defined (ACE_HAS_EXCEPTIONS)
# define ACE_NEW_THROWS_EXCEPTIONS
# endif /* ACE_HAS_EXCEPTIONS */
+
#if (defined (i386) || defined (__i386__)) && !defined (ACE_SIZEOF_LONG_DOUBLE)
# define ACE_SIZEOF_LONG_DOUBLE 12
#endif /* i386 */
+
#if defined (i386) || defined (__i386__)
// If running an Intel, assume that it's a Pentium so that
// ACE_OS::gethrtime () can use the RDTSC instruction. If running a
@@ -49,11 +55,14 @@
// protection, so it can be ignored.)
# define ACE_HAS_PENTIUM
#endif /* i386 */
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
// We define it with a -D with make depend.
# define ACE_LACKS_PRAGMA_ONCE
#endif /* ! ACE_LACKS_PRAGMA_ONCE */
+
#define ACE_TEMPLATES_REQUIRE_SOURCE
+
#include /**/ "ace/post.h"
#endif /* ACE_SUNCC_COMMON_H */
diff --git a/dep/ACE_wrappers/ace/config-sunos5.10.h b/dep/ACE_wrappers/ace/config-sunos5.10.h
index 70da9c4ee14..7ba78c2b3bd 100644
--- a/dep/ACE_wrappers/ace/config-sunos5.10.h
+++ b/dep/ACE_wrappers/ace/config-sunos5.10.h
@@ -1,39 +1,52 @@
/* -*- C++ -*- */
// $Id: config-sunos5.10.h 81805 2008-05-30 10:14:59Z vzykov $
+
// The following configuration file is designed to work for SunOS 5.10
// (Solaris 10) platforms using the SunC++ 5.x (Sun Studio 8-10), or g++
// compilers.
+
#ifndef ACE_CONFIG_H
+
// ACE_CONFIG_H is defined by one of the following #included headers.
+
// #include the SunOS 5.9 config, then add any SunOS 5.10 updates below.
#include "ace/config-sunos5.9.h"
+
// Solaris 10 can do sem_timedwait() (see ACE_OS::sema_wait).
#define ACE_HAS_POSIX_SEM_TIMEOUT
+
#define ACE_HAS_SCANDIR
+
// Solaris 10 offers a useable alphasort() unlike previous Solaris versions.
#if defined (ACE_LACKS_ALPHASORT)
# undef ACE_LACKS_ALPHASORT
#endif
+
// Solaris 10 offers a useable log2() unlike previous Solaris versions.
#if defined (ACE_LACKS_LOG2)
# undef ACE_LACKS_LOG2
#endif
+
// Solaris 10 delivers pthread_attr_setstack
#if defined (ACE_LACKS_PTHREAD_ATTR_SETSTACK)
# undef ACE_LACKS_PTHREAD_ATTR_SETSTACK
#endif
+
// Solaris 10 introduced printf() modifiers for [s]size_t types.
#if defined (ACE_SSIZE_T_FORMAT_SPECIFIER)
# undef ACE_SSIZE_T_FORMAT_SPECIFIER
# define ACE_SSIZE_T_FORMAT_SPECIFIER ACE_TEXT ("%zd")
#endif /* ACE_SSIZE_T_FORMAT_SPECIFIER */
+
#if defined (ACE_SIZE_T_FORMAT_SPECIFIER)
# undef ACE_SIZE_T_FORMAT_SPECIFIER
# define ACE_SIZE_T_FORMAT_SPECIFIER ACE_TEXT ("%zu")
#endif /* ACE_SIZE_T_FORMAT_SPECIFIER */
+
// Solaris 10 offers wcstoull()
#if defined (ACE_LACKS_WCSTOULL)
# undef ACE_LACKS_WCSTOULL
#endif /* ACE_LACKS_WCSTOULL */
+
#endif /* ACE_CONFIG_H */
diff --git a/dep/ACE_wrappers/ace/config-sunos5.11.h b/dep/ACE_wrappers/ace/config-sunos5.11.h
index d1abcdf22ac..3f78c9f94e6 100644
--- a/dep/ACE_wrappers/ace/config-sunos5.11.h
+++ b/dep/ACE_wrappers/ace/config-sunos5.11.h
@@ -1,11 +1,16 @@
/* -*- C++ -*- */
// $Id: config-sunos5.11.h 80826 2008-03-04 14:51:23Z wotte $
+
// The following configuration file is designed to work for SunOS 5.11
// (Solaris 11) platforms using the SunC++ 5.x (Sun Studio 10-12), or g++
// compilers.
+
#ifndef ACE_CONFIG_H
+
// ACE_CONFIG_H is defined by one of the following #included headers.
+
// #include the SunOS 5.10 config, then add any SunOS 5.11 updates below.
#include "ace/config-sunos5.10.h"
+
#endif /* ACE_CONFIG_H */
diff --git a/dep/ACE_wrappers/ace/config-sunos5.4-g++.h b/dep/ACE_wrappers/ace/config-sunos5.4-g++.h
index eea5bcb7a41..9622a068232 100644
--- a/dep/ACE_wrappers/ace/config-sunos5.4-g++.h
+++ b/dep/ACE_wrappers/ace/config-sunos5.4-g++.h
@@ -1,93 +1,135 @@
/* -*- C++ -*- */
// $Id: config-sunos5.4-g++.h 81697 2008-05-14 18:33:11Z johnnyw $
+
// The following configuration file is designed to work for SunOS 5.4
// platforms using the GNU g++ compiler.
+
#ifndef ACE_CONFIG_H
#define ACE_CONFIG_H
#include /**/ "ace/pre.h"
+
#if ! defined (__ACE_INLINE__)
# define __ACE_INLINE__
#endif /* ! __ACE_INLINE__ */
+
// config-g++-common.h undef's ACE_HAS_STRING_CLASS with -frepo, so
// this must appear before its #include.
#define ACE_HAS_STRING_CLASS
+
#include "ace/config-g++-common.h"
#define ACE_HAS_GNU_CSTRING_H
+
#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT
+
// Platform supports pread() and pwrite()
#define ACE_HAS_P_READ_WRITE
+
#define ACE_HAS_XPG4_MULTIBYTE_CHAR
+
// Platform has POSIX terminal interface.
#define ACE_HAS_TERMIOS
+
// Platform supports System V IPC (most versions of UNIX, but not Win32)
#define ACE_HAS_SYSV_IPC
+
// Sun has the wrong prototype for sendmsg.
#define ACE_HAS_NONCONST_SENDMSG
+
// The SunOS 5.x version of rand_r is inconsistent with the header files...
#define ACE_HAS_BROKEN_RANDR
+
// Platform supports system configuration information.
#define ACE_HAS_SYS_SYSTEMINFO_H
#define ACE_HAS_SYSINFO
+
// Platform supports the POSIX regular expression library
#define ACE_HAS_REGEX
+
// Platform supports recvmsg and sendmsg.
#define ACE_HAS_MSG
+
// Compiler/platform contains the <sys/syscall.h> file.
#define ACE_HAS_SYS_SYSCALL_H
+
// Compiler/platform correctly calls init()/fini() for shared libraries.
#define ACE_HAS_AUTOMATIC_INIT_FINI
+
// Platform supports POSIX O_NONBLOCK semantics.
#define ACE_HAS_POSIX_NONBLOCK
+
// Compiler/platform has correctly prototyped header files.
#define ACE_HAS_CPLUSPLUS_HEADERS
+
// Compiler/platform supports SunOS high resolution timers.
#define ACE_HAS_HI_RES_TIMER
+
// Platform supports IP multicast
#define ACE_HAS_IP_MULTICAST
+
// Compiler/platform supports alloca()
// Although ACE does have alloca() on this compiler/platform combination, it is
// disabled by default since it can be dangerous. Uncomment the following line
// if you ACE to use it.
//#define ACE_HAS_ALLOCA
+
// Compiler/platform has <alloca.h>
#define ACE_HAS_ALLOCA_H
+
// Platform contains <poll.h>.
#define ACE_HAS_POLL
+
// Platform supports POSIX timers via timestruc_t.
#define ACE_HAS_POSIX_TIME
+
// Platform supports the /proc file system.
#define ACE_HAS_PROC_FS
+
// Platform supports the prusage_t struct.
#define ACE_HAS_PRUSAGE_T
+
// Compiler/platform defines the sig_atomic_t typedef.
#define ACE_HAS_SIG_ATOMIC_T
+
// Platform supports SVR4 extended signals.
#define ACE_HAS_SIGINFO_T
#define ACE_HAS_UCONTEXT_T
+
// Compiler/platform provides the sockio.h file.
#define ACE_HAS_SYS_SOCKIO_H
+
// Compiler supports the ssize_t typedef.
#define ACE_HAS_SSIZE_T
+
// Platform supports STREAMS.
#define ACE_HAS_STREAMS
+
// Platform supports STREAM pipes.
#define ACE_HAS_STREAM_PIPES
+
// Compiler/platform supports strerror ().
#define ACE_HAS_STRERROR
+
// Compiler/platform supports struct strbuf.
#define ACE_HAS_STRBUF_T
+
// Compiler/platform supports SVR4 dynamic linking semantics.
#define ACE_HAS_SVR4_DYNAMIC_LINKING
+
// Compiler/platform supports SVR4 gettimeofday() prototype.
#define ACE_HAS_SVR4_GETTIMEOFDAY
+
// Platform lacks pthread_sigaction
#define ACE_LACKS_PTHREAD_THR_SIGSETMASK
+
// Compiler/platform supports SVR4 TLI (in particular, T_GETNAME stuff)...
#define ACE_HAS_SVR4_TLI
+
// Platform provides <sys/filio.h> header.
#define ACE_HAS_SYS_FILIO_H
+
// Compiler/platform supports sys_siglist array.
#define ACE_HAS_SYS_SIGLIST
+
/* Turn off the following defines if you want to disable threading. */
// Compile using multi-thread libraries.
#if !defined (ACE_MT_SAFE)
@@ -96,32 +138,45 @@
# define _REENTRANT
# endif /* _REENTRANT */
#endif /* !ACE_MT_SAFE */
+
// Platform supports Solaris threads.
#define ACE_HAS_STHREADS
+
// Platform supports threads.
#define ACE_HAS_THREADS
+
// Compiler/platform has thread-specific storage
#define ACE_HAS_THREAD_SPECIFIC_STORAGE
+
// Platform supports reentrant functions (i.e., all the POSIX *_r functions).
#define ACE_HAS_REENTRANT_FUNCTIONS
+
/* end threading defines */
+
#define ACE_HAS_PRIOCNTL
#define ACE_NEEDS_LWP_PRIO_SET
+
// Platform supports TLI timod STREAMS module.
#define ACE_HAS_TIMOD_H
+
// Platform supports TLI tiuser header.
#define ACE_HAS_TIUSER_H
+
// Platform provides TLI function prototypes.
#define ACE_HAS_TLI_PROTOTYPES
+
// Platform supports TLI.
#define ACE_HAS_TLI
+
// Use the poll() event demultiplexor rather than select().
//#define ACE_USE_POLL
+
// Defines the page size of the system.
#define ACE_PAGE_SIZE 4096
#define ACE_HAS_IDTYPE_T
#define ACE_HAS_GPERF
#define ACE_HAS_DIRENT
+
#include /**/ "ace/post.h"
#endif /* ACE_CONFIG_H */
diff --git a/dep/ACE_wrappers/ace/config-sunos5.4-sunc++-4.x.h b/dep/ACE_wrappers/ace/config-sunos5.4-sunc++-4.x.h
index 2f988660fce..8714b8d72fc 100644
--- a/dep/ACE_wrappers/ace/config-sunos5.4-sunc++-4.x.h
+++ b/dep/ACE_wrappers/ace/config-sunos5.4-sunc++-4.x.h
@@ -1,132 +1,191 @@
/* -*- C++ -*- */
// $Id: config-sunos5.4-sunc++-4.x.h 81935 2008-06-12 22:01:53Z jtc $
+
// The following configuration file is designed to work for SunOS 5.4
// platforms using the SunC++ 4.0.x compiler.
+
#ifndef ACE_CONFIG_H
#define ACE_CONFIG_H
#include /**/ "ace/pre.h"
+
#if ! defined (__ACE_INLINE__)
# define __ACE_INLINE__
#endif /* ! __ACE_INLINE__ */
+
// Optimize ACE_Handle_Set for select().
#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT
+
// Platform supports pread() and pwrite()
#define ACE_HAS_P_READ_WRITE
+
#define ACE_HAS_XPG4_MULTIBYTE_CHAR
+
// Platform supports System V IPC (most versions of UNIX, but not Win32)
#define ACE_HAS_SYSV_IPC
+
// Sun has the wrong prototype for sendmsg.
#define ACE_HAS_NONCONST_SENDMSG
+
// The SunOS 5.x version of rand_r is inconsistent with the header files...
#define ACE_HAS_BROKEN_RANDR
+
// Platform supports system configuration information.
#define ACE_HAS_SYS_SYSTEMINFO_H
#define ACE_HAS_SYSINFO
+
// Platform supports the POSIX regular expression library.
#define ACE_HAS_REGEX
+
// Platform supports recvmsg and sendmsg.
#define ACE_HAS_MSG
+
// Compiler/platform contains the <sys/syscall.h> file.
#define ACE_HAS_SYS_SYSCALL_H
+
// Platform has POSIX terminal interface.
#define ACE_HAS_TERMIOS
+
// Compiler/platform correctly calls init()/fini() for shared libraries.
#define ACE_HAS_AUTOMATIC_INIT_FINI
+
// Platform supports POSIX O_NONBLOCK semantics.
#define ACE_HAS_POSIX_NONBLOCK
+
// Compiler/platform has correctly prototyped header files.
#define ACE_HAS_CPLUSPLUS_HEADERS
+
// Compiler/platform supports SunOS high resolution timers.
#define ACE_HAS_HI_RES_TIMER
+
// Platform supports IP multicast
#define ACE_HAS_IP_MULTICAST
+
// Compiler/platform supports alloca()
// Although ACE does have alloca() on this compiler/platform combination, it is
// disabled by default since it can be dangerous. Uncomment the following line
// if you ACE to use it.
//#define ACE_HAS_ALLOCA
+
// Compiler/platform has <alloca.h>
#define ACE_HAS_ALLOCA_H
+
// Platform contains <poll.h>.
#define ACE_HAS_POLL
+
// Platform supports POSIX timers via timestruc_t.
#define ACE_HAS_POSIX_TIME
+
// Platform supports the /proc file system.
#define ACE_HAS_PROC_FS
+
// Platform supports the prusage_t struct.
#define ACE_HAS_PRUSAGE_T
+
// Compiler/platform defines the sig_atomic_t typedef.
#define ACE_HAS_SIG_ATOMIC_T
+
// Platform supports SVR4 extended signals.
#define ACE_HAS_SIGINFO_T
#define ACE_HAS_UCONTEXT_T
+
// Compiler/platform provides the sockio.h file.
#define ACE_HAS_SYS_SOCKIO_H
+
// Compiler supports the ssize_t typedef.
#define ACE_HAS_SSIZE_T
+
// Platform supports STREAMS.
#define ACE_HAS_STREAMS
+
// Platform supports STREAM pipes.
#define ACE_HAS_STREAM_PIPES
+
// Compiler/platform supports strerror ().
#define ACE_HAS_STRERROR
+
// Compiler/platform supports struct strbuf.
#define ACE_HAS_STRBUF_T
+
// Compiler/platform supports SVR4 dynamic linking semantics.
#define ACE_HAS_SVR4_DYNAMIC_LINKING
+
// Compiler/platform supports SVR4 gettimeofday() prototype.
#define ACE_HAS_SVR4_GETTIMEOFDAY
+
// Compiler/platform supports SVR4 signal typedef.
#define ACE_HAS_SVR4_SIGNAL_T
+
// Platform lacks pthread_sigaction
#define ACE_LACKS_PTHREAD_THR_SIGSETMASK
+
// Compiler/platform supports SVR4 ACE_TLI (in particular, T_GETNAME stuff)...
#define ACE_HAS_SVR4_TLI
+
// Platform provides <sys/filio.h> header.
#define ACE_HAS_SYS_FILIO_H
+
// Compiler/platform supports sys_siglist array.
#define ACE_HAS_SYS_SIGLIST
+
/* Turn off the following defines if you want to disable threading. */
// Compile using multi-thread libraries.
#if !defined (ACE_MT_SAFE)
# define ACE_MT_SAFE 1
#endif
+
// Platform supports Solaris threads.
#define ACE_HAS_STHREADS
+
// Platform supports threads.
#define ACE_HAS_THREADS
+
// Compiler/platform has thread-specific storage
#define ACE_HAS_THREAD_SPECIFIC_STORAGE
+
// Platform supports reentrant functions (i.e., all the POSIX *_r functions).
#define ACE_HAS_REENTRANT_FUNCTIONS
+
/* end threading defines */
+
#define ACE_HAS_PRIOCNTL
#define ACE_NEEDS_LWP_PRIO_SET
+
// Reactor detects deadlock
// #define ACE_REACTOR_HAS_DEADLOCK_DETECTION
+
// Platform supports ACE_TLI timod STREAMS module.
#define ACE_HAS_TIMOD_H
+
// Platform supports ACE_TLI tiuser header.
#define ACE_HAS_TIUSER_H
+
// Platform provides ACE_TLI function prototypes.
#define ACE_HAS_TLI_PROTOTYPES
+
// Platform supports ACE_TLI.
#define ACE_HAS_TLI
+
#define ACE_LACKS_LINEBUFFERED_STREAMBUF
#define ACE_LACKS_SIGNED_CHAR
+
// Use the poll() event demultiplexor rather than select().
//#define ACE_USE_POLL
+
#define ACE_NEEDS_DEV_IO_CONVERSION
+
// Defines the page size of the system.
#define ACE_PAGE_SIZE 4096
#define ACE_HAS_IDTYPE_T
+
#define ACE_HAS_GPERF
#define ACE_HAS_DIRENT
+
# if defined (ACE_HAS_EXCEPTIONS)
// If exceptions are enabled and we are using Sun/CC then
// <operator new> throws an exception instead of returning 0.
# define ACE_NEW_THROWS_EXCEPTIONS
# endif /* ACE_HAS_EXCEPTIONS */
+
#include /**/ "ace/post.h"
#endif /* ACE_CONFIG_H */
diff --git a/dep/ACE_wrappers/ace/config-sunos5.5.h b/dep/ACE_wrappers/ace/config-sunos5.5.h
index 4c17ea67a27..83d4d164951 100644
--- a/dep/ACE_wrappers/ace/config-sunos5.5.h
+++ b/dep/ACE_wrappers/ace/config-sunos5.5.h
@@ -1,27 +1,36 @@
/* -*- C++ -*- */
// $Id: config-sunos5.5.h 81971 2008-06-16 12:15:00Z parsons $
+
// This configuration file is designed to work for SunOS 5.5 platforms
// using the following compilers:
// * Sun C++ 4.2 and later (including 5.x), patched as noted below
// * g++ 2.7.2 and later, including egcs
// * Green Hills 1.8.8 and later
+
#ifndef ACE_CONFIG_H
#define ACE_CONFIG_H
#include /**/ "ace/pre.h"
+
#define ACE_LACKS_STDINT_H
+
// alphasort() is present on earlier Solaris versions but is marked as not for
// use on non-BSD systems and not supported for use in applications that use
// system libraries or with multiple threads. So it's mostly useless.
#define ACE_LACKS_ALPHASORT
+
// Solaris doesn't support log2()
#define ACE_LACKS_LOG2
+
// SunOS 5.5 does not provide getloadavg()
#define ACE_LACKS_GETLOADAVG
+
// Before we do anything, we should include <sys/feature_tests.h> to
// ensure that things are set up properly.
#include <sys/feature_tests.h>
+
// Sun has the posix defines so let this file sort out what Sun delivers
#include "ace/config-posix.h"
+
// Compiler version-specific settings:
#if defined (__SUNPRO_CC)
# if (__SUNPRO_CC < 0x410)
@@ -50,12 +59,14 @@
# define ACE_LACKS_PLACEMENT_OPERATOR_DELETE
# endif /* __SUNPRO_CC >= 0x500 */
# endif /* __SUNPRO_CC >= 0x420 */
+
# define ACE_CAST_CONST const
# define ACE_HAS_HI_RES_TIMER
# define ACE_HAS_SIG_C_FUNC /* Sun CC 5.0 needs this, 4.2 doesn't mind. */
# define ACE_HAS_XPG4_MULTIBYTE_CHAR
# define ACE_LACKS_LINEBUFFERED_STREAMBUF
# define ACE_LACKS_SIGNED_CHAR
+
// ACE_HAS_EXCEPTIONS precludes -noex in
// include/makeinclude/platform_macros.GNU. But beware, we have
// seen problems with exception handling on multiprocessor
@@ -68,17 +79,21 @@
// default. It can be enabled by adding "exceptions=1" to the "make"
// invocation. See include/makeinclude/platform_sunos5_sunc++.GNU
// for details.
+
# if defined (ACE_HAS_EXCEPTIONS)
// If exceptions are enabled and we are using Sun/CC then
// <operator new> throws an exception instead of returning 0.
# define ACE_NEW_THROWS_EXCEPTIONS
# endif /* ACE_HAS_EXCEPTIONS */
+
/* If you want to disable threading with Sun CC, remove -mt
from your CFLAGS, e.g., using make threads=0. */
+
// Take advantage of Sun Studio 8 (Sun C++ 5.5) or better symbol
// visibility to generate improved shared library binaries.
# if (__SUNPRO_CC > 0x540)
+
# if defined (ACE_HAS_CUSTOM_EXPORT_MACROS) && ACE_HAS_CUSTOM_EXPORT_MACROS == 0
# undef ACE_HAS_CUSTOM_EXPORT_MACROS
# else
@@ -87,12 +102,16 @@
# endif /* !ACE_HAS_CUSTOM_EXPORT_MACROS */
# define ACE_Proper_Export_Flag __symbolic
# define ACE_Proper_Import_Flag __global
+
# define ACE_EXPORT_SINGLETON_DECLARATION(T) template class ACE_Proper_Export_Flag T
# define ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) template class ACE_Proper_Export_Flag SINGLETON_TYPE <CLASS, LOCK>;
+
// # define ACE_IMPORT_SINGLETON_DECLARATION(T) extern template class T
// # define ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) extern template class SINGLETON_TYPE<CLASS, LOCK>;
+
# endif /* ACE_HAS_CUSTOM_EXPORT_MACROS == 0 */
# endif /* __SUNPRO_CC > 0x540 (> Sun C++ 5.4) */
+
#elif defined (__GNUG__)
// config-g++-common.h undef's ACE_HAS_STRING_CLASS with -frepo, so
// this must appear before its #include.
@@ -102,6 +121,7 @@
// Denotes that GNU has cstring.h as standard, to redefine memchr().
# define ACE_HAS_GNU_CSTRING_H
# define ACE_HAS_XPG4_MULTIBYTE_CHAR
+
# if !defined (ACE_MT_SAFE) || ACE_MT_SAFE != 0
// ACE_MT_SAFE is #defined below, for all compilers.
# if !defined (_REENTRANT)
@@ -111,7 +131,9 @@
# define _REENTRANT
# endif /* _REENTRANT */
# endif /* !ACE_MT_SAFE */
+
#elif defined (ghs)
+
# if !defined (ACE_MT_SAFE) || ACE_MT_SAFE != 0
// ACE_MT_SAFE is #defined below, for all compilers.
# if !defined (_REENTRANT)
@@ -121,127 +143,173 @@
# define _REENTRANT
# endif /* _REENTRANT */
# endif /* !ACE_MT_SAFE */
+
# define ACE_CONFIG_INCLUDE_GHS_COMMON
# include "ace/config-ghs-common.h"
+
// To avoid warning about inconsistent declaration between Sun's
// stdlib.h and Green Hills' ctype.h.
# include <stdlib.h>
+
// IOStream_Test never halts with Green Hills 1.8.9.
# define ACE_LACKS_ACE_IOSTREAM
+
#else /* ! __SUNPRO_CC && ! __GNUG__ && ! ghs */
# ifdef __cplusplus /* Let it slide for C compilers. */
# error unsupported compiler in ace/config-sunos5.5.h
# endif /* __cplusplus */
#endif /* ! __SUNPRO_CC && ! __GNUG__ && ! ghs */
+
#if !defined (__ACE_INLINE__)
// @note If you have link problems with undefined inline template
// functions with Sun C++, be sure that the #define of __ACE_INLINE__
// below is not commented out.
# define __ACE_INLINE__
#endif /* ! __ACE_INLINE__ */
+
// Platform supports the POSIX regular expression library.
// @note Please comment out the ACE_HAS_REGEX #define if you
// have link problems with g++ or egcs on SunOS 5.5.
#define ACE_HAS_REGEX
+
// Optimize ACE_Handle_Set for select().
#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT
+
// select()'s timeval arg is not declared as const and may be modified
#define ACE_HAS_NONCONST_SELECT_TIMEVAL
+
// Platform supports pread() and pwrite()
#define ACE_HAS_P_READ_WRITE
#define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS
#define ACE_HAS_UALARM
#define ACE_LACKS_UALARM_PROTOTYPE
+
// Platform supports System V IPC (most versions of UNIX, but not Win32)
#define ACE_HAS_SYSV_IPC
+
#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES
+
// Platform supports system configuration information.
#define ACE_HAS_SYS_SYSTEMINFO_H
#define ACE_HAS_SYSINFO
+
// Platform supports recvmsg and sendmsg.
#define ACE_HAS_MSG
+
// Compiler/platform contains the <sys/syscall.h> file.
#define ACE_HAS_SYS_SYSCALL_H
+
// Platform has POSIX terminal interface.
#define ACE_HAS_TERMIOS
+
// Compiler/platform correctly calls init()/fini() for shared libraries.
#define ACE_HAS_AUTOMATIC_INIT_FINI
+
// Platform supports POSIX O_NONBLOCK semantics.
#define ACE_HAS_POSIX_NONBLOCK
+
// Compiler/platform has correctly prototyped header files.
#define ACE_HAS_CPLUSPLUS_HEADERS
+
// Platform supports IP multicast
#define ACE_HAS_IP_MULTICAST
+
// This setting was determined by running the autoconf tests. If it doesn't
// work uniformly, will need some tweaking, possibly based on other
// XPG feature-test macros.
#define ACE_HAS_CONST_CHAR_SWAB
+
// Compiler/platform supports alloca()
// Although ACE does have alloca() on this compiler/platform combination, it is
// disabled by default since it can be dangerous. Uncomment the following line
// if you ACE to use it.
//#define ACE_HAS_ALLOCA
+
// Compiler/platform has <alloca.h>
#define ACE_HAS_ALLOCA_H
+
// Platform contains <poll.h>.
#define ACE_HAS_POLL
+
// Platform supports POSIX timers via timestruc_t.
#define ACE_HAS_POSIX_TIME
+
// ACE_HAS_CLOCK_GETTIME requires linking with -lposix4.
#define ACE_HAS_CLOCK_GETTIME
#define ACE_HAS_CLOCK_SETTIME
+
// Platform supports the /proc file system.
#define ACE_HAS_PROC_FS
+
// Platform supports the prusage_t struct.
#define ACE_HAS_PRUSAGE_T
#define ACE_HAS_GETRUSAGE
+
// Compiler/platform defines the sig_atomic_t typedef.
#define ACE_HAS_SIG_ATOMIC_T
+
// Platform supports SVR4 extended signals.
#define ACE_HAS_SIGINFO_T
#define ACE_HAS_UCONTEXT_T
+
// Compiler/platform provides the sockio.h file.
#define ACE_HAS_SYS_SOCKIO_H
+
// Compiler supports the ssize_t typedef.
#define ACE_HAS_SSIZE_T
+
// Platform supports STREAMS.
#define ACE_HAS_STREAMS
+
// Platform supports STREAM pipes.
#define ACE_HAS_STREAM_PIPES
+
// Compiler/platform supports strerror ().
#define ACE_HAS_STRERROR
+
// Compiler/platform supports struct strbuf.
#define ACE_HAS_STRBUF_T
+
// Compiler/platform supports SVR4 dynamic linking semantics.
#define ACE_HAS_SVR4_DYNAMIC_LINKING
+
// Compiler/platform supports SVR4 gettimeofday() prototype.
#define ACE_HAS_SVR4_GETTIMEOFDAY
+
// Compiler/platform supports SVR4 ACE_TLI (in particular, T_GETNAME stuff)...
#define ACE_HAS_SVR4_TLI
+
// Platform provides <sys/filio.h> header.
#define ACE_HAS_SYS_FILIO_H
+
// Compiler/platform supports sys_siglist array.
#define ACE_HAS_SYS_SIGLIST
+
// SunOS 5.5.x does not support mkstemp
#define ACE_LACKS_MKSTEMP
#define ACE_LACKS_SYS_SYSCTL_H
+
#if !(defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4))
# define ACE_HAS_CHARPTR_SHMDT
#endif
+
// Platform has posix getpwnam_r
#if (defined (_POSIX_C_SOURCE) && _POSIX_C_SOURCE - 0 >= 199506L) || \
defined(_POSIX_PTHREAD_SEMANTICS)
# define ACE_HAS_POSIX_GETPWNAM_R
#endif /* _POSIX_C_SOURCE || _POSIX_PTHREAD_SEMANTICS */
+
#if !defined (ACE_MT_SAFE) || (ACE_MT_SAFE == 1)
#if defined (_REENTRANT) || \
(defined (_POSIX_C_SOURCE) && (_POSIX_C_SOURCE - 0 >= 199506L)) || \
defined (_POSIX_PTHREAD_SEMANTICS)
// Compile using multi-thread libraries.
# define ACE_HAS_THREADS
+
# if !defined (ACE_MT_SAFE)
# define ACE_MT_SAFE 1
# endif /* ACE_MT_SAFE */
+
// Platform supports POSIX pthreads *and* Solaris threads, by
// default! If you only want to use POSIX pthreads, add
// -D_POSIX_PTHREAD_SEMANTICS to your CFLAGS. Or, #define it right
@@ -252,6 +320,7 @@
# else
# define ACE_HAS_STHREADS
# endif /* ! _POSIX_PTHREAD_SEMANTICS */
+
# define ACE_HAS_PTHREADS
// . . . but only supports SCHED_OTHER scheduling policy
# define ACE_HAS_ONLY_SCHED_OTHER
@@ -259,32 +328,46 @@
# define ACE_HAS_SIGTIMEDWAIT
# define ACE_HAS_SIGSUSPEND
# define ACE_LACKS_PTHREAD_ATTR_SETSTACK
+
// Compiler/platform has thread-specific storage
# define ACE_HAS_THREAD_SPECIFIC_STORAGE
+
// Platform supports reentrant functions (i.e., all the POSIX *_r functions).
# define ACE_HAS_REENTRANT_FUNCTIONS
+
# define ACE_NEEDS_LWP_PRIO_SET
# define ACE_HAS_THR_YIELD
# define ACE_LACKS_PTHREAD_YIELD
#endif /* _REENTRANT || _POSIX_C_SOURCE >= 199506L || \
_POSIX_PTHREAD_SEMANTICS */
#endif /* !ACE_MT_SAFE || ACE_MT_SAFE == 1 */
+
#define ACE_HAS_PRIOCNTL
+
// Platform supports ACE_TLI timod STREAMS module.
#define ACE_HAS_TIMOD_H
+
// Platform supports ACE_TLI tiuser header.
#define ACE_HAS_TIUSER_H
+
// Platform provides ACE_TLI function prototypes.
#define ACE_HAS_TLI_PROTOTYPES
+
// Platform has broken t_error() prototype.
#define ACE_HAS_BROKEN_T_ERROR
+
// Platform supports ACE_TLI.
#define ACE_HAS_TLI
+
#define ACE_HAS_GETPAGESIZE 1
+
#define ACE_HAS_STL_MAP_CONFLICT
+
#define ACE_HAS_IDTYPE_T
+
#define ACE_HAS_GPERF
#define ACE_HAS_DIRENT
+
#if defined (__SUNPRO_CC)
# define ACE_CC_NAME ACE_TEXT ("SunPro C++")
# define ACE_CC_MAJOR_VERSION (__SUNPRO_CC >> 8)
@@ -300,28 +383,36 @@
# define ACE_CC_NAME ACE_TEXT ("g++")
# endif /* __GNUC_MINOR__ */
#endif /* __GNUG__ */
+
#if defined (i386) && (_FILE_OFFSET_BITS==32)
# define ACE_HAS_X86_STAT_MACROS
#endif /* i386 && _FILE_OFFSET_BITS==32 */
+
#define ACE_MALLOC_ALIGN ((size_t)8)
#define ACE_LACKS_SETREUID_PROTOTYPE
#define ACE_LACKS_SETREGID_PROTOTYPE
+
// Solaris does indeed implement the inet_aton() function, but it is
// found in `libresolv.*'. It doesn't seem worth it to link another
// library just for that function. Just use the emulation in ACE that
// has been used for years.
#define ACE_LACKS_INET_ATON
+
// Solaris doesn't have wcstoull
#define ACE_LACKS_WCSTOULL
+
#if defined (_LARGEFILE_SOURCE) || (_FILE_OFFSET_BITS==64)
#undef ACE_HAS_PROC_FS
#undef ACE_HAS_PRUSAGE_T
#endif /* (_LARGEFILE_SOURCE) || (_FILE_OFFSET_BITS==64) */
+
#if defined (_POSIX_PTHREAD_SEMANTICS) || (_FILE_OFFSET_BITS == 64) || (_POSIX_C_SOURCE - 0 >= 199506L)
# define ACE_HAS_3_PARAM_READDIR_R
#endif
+
// Sum of the iov_len values can't be larger then SSIZE_MAX
#define ACE_HAS_SOCK_BUF_SIZE_MAX
+
#include /**/ "ace/post.h"
#endif /* ACE_CONFIG_H */
diff --git a/dep/ACE_wrappers/ace/config-sunos5.6.h b/dep/ACE_wrappers/ace/config-sunos5.6.h
index 9108b6a0ed9..2ebf5a274a0 100644
--- a/dep/ACE_wrappers/ace/config-sunos5.6.h
+++ b/dep/ACE_wrappers/ace/config-sunos5.6.h
@@ -1,11 +1,17 @@
/* -*- C++ -*- */
// $Id: config-sunos5.6.h 81935 2008-06-12 22:01:53Z jtc $
+
// The following configuration file is designed to work for SunOS 5.6
// platforms using the SunC++ 4.x or g++ compilers.
+
#ifndef ACE_CONFIG_H
+
// ACE_CONFIG_H is defined by one of the following #included headers.
+
// #include the SunOS 5.5 config file, then add SunOS 5.6 updates below.
+
#include "ace/config-sunos5.5.h"
+
#if (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE > 2) || \
defined (__EXTENSIONS__)
// The asctime_r/ctime_r parameters change at POSIX.1c-1995
@@ -16,6 +22,7 @@
// Hack 'cuz _POSIX_C_SOURCE > 2 and -DEXTENSIONS hides this.
# define ACE_LACKS_MADVISE_PROTOTYPE
#endif /* _POSIX_C_SOURCE > 2 || __EXTENSIONS__ */
+
// Support for the SunC++ 5.2 compiler.
// Do not undefine for compat mode < 5
#if defined (__SUNPRO_CC) && __SUNPRO_CC > 0x510
@@ -24,6 +31,7 @@
#undef ACE_LACKS_ACE_IOSTREAM
#endif /* ACE_LACKS_ACE_IOSTREAM */
#endif /* defined (__SUNPRO_CC_COMPAT) && (__SUNPRO_CC_COMPAT >= 5) */
+
#ifndef ACE_LACKS_UNBUFFERED_STREAMBUF
#define ACE_LACKS_UNBUFFERED_STREAMBUF 1
#endif /* ACE_LACKS_UNBUFFERED_STREAMBUF */
@@ -70,29 +78,38 @@
#ifndef ACE_LACKS_LINEBUFFERED_STREAMBUF
#define ACE_LACKS_LINEBUFFERED_STREAMBUF 1
#endif /* ACE_LACKS_LINEBUFFERED_STREAMBUF */
+
#endif /* defined (__SUNPRO_CC) && __SUNPRO_CC > 0x510 */
+
// SunOS 5.6 and above support mkstemp
#undef ACE_LACKS_MKSTEMP
+
// SunOS 5.6 has AIO calls.
#if !defined (ACE_HAS_AIO_CALLS)
#define ACE_HAS_AIO_CALLS
#endif /* ACE_HAS_AIO_CALLS */
+
#if !defined (ACE_HAS_POSIX_REALTIME_SIGNALS)
#define ACE_HAS_POSIX_REALTIME_SIGNALS
#endif /* ACE_HAS_POSIX_REALTIME_SIGNALS */
+
#if !defined (ACE_HAS_POSIX_MESSAGE_PASSING)
#define ACE_HAS_POSIX_MESSAGE_PASSING
#endif /* ACE_HAS_POSIX_MESSAGE_PASSING */
+
#if !defined (ACE_HAS_POSIX_SEM)
#define ACE_HAS_POSIX_SEM
#endif /* ACE_HAS_POSIX_SEM */
+
// Sunos 5.6's aio_* with RT signals is broken.
#if !defined (ACE_POSIX_AIOCB_PROACTOR)
#define ACE_POSIX_AIOCB_PROACTOR
#endif /* ACE_POSIX_AIOCB_PROACTOR */
+
// SunOS 5.6 has a buggy select
#define ACE_HAS_LIMITED_SELECT
+
// SunOS 5.6 introduced shm_open, but need to turn on POSIX.1b or higher
// to pick it up.
#if defined (_POSIX_C_SOURCE) && (_POSIX_C_SOURCE > 2)
@@ -100,9 +117,11 @@
#else
# undef ACE_HAS_SHM_OPEN
#endif /* _POSIX_C_SOURCE > 2 */
+
// The struct msghdr is conditional on SunOS 5.6 based on _XPG4_2
#if defined(_XPG4_2)
# define ACE_HAS_4_4BSD_SENDMSG_RECVMSG
#endif /* _XPG4_2 */
+
#endif /* ACE_CONFIG_H */
diff --git a/dep/ACE_wrappers/ace/config-sunos5.7.h b/dep/ACE_wrappers/ace/config-sunos5.7.h
index 53a5e917f46..b2b62b7e7bb 100644
--- a/dep/ACE_wrappers/ace/config-sunos5.7.h
+++ b/dep/ACE_wrappers/ace/config-sunos5.7.h
@@ -1,58 +1,79 @@
/* -*- C++ -*- */
// $Id: config-sunos5.7.h 80826 2008-03-04 14:51:23Z wotte $
+
// The following configuration file is designed to work for SunOS 5.7
// (Solaris 7) platforms using the SunC++ 4.x, 5.x, or g++ compilers.
+
#ifndef ACE_CONFIG_H
+
// ACE_CONFIG_H is defined by one of the following #included headers.
+
// #include the SunOS 5.6 config file, then add SunOS 5.7 updates below.
+
#include "ace/config-sunos5.6.h"
+
// This may be true for earlier Solaris versions, but I can only verify
// it for Solaris 7 and later.
#define ACE_HAS_VFWPRINTF
#if defined (ACE_HAS_SHM_OPEN)
# define ACE_SHM_OPEN_REQUIRES_ONE_SLASH
#endif
+
// Sun began distributing <sys/loadavg.h> with SunOS 5.7
#define ACE_HAS_SYS_LOADAVG_H
+
// SunOS 5.7 has getloadavg()
#undef ACE_LACKS_GETLOADAVG
+
#if defined (ghs)
// SunOS 5.7's /usr/include/sys/procfs_isa.h needs uint64_t,
// but /usr/include/sys/int_types.h doesn't #define it because
// _NO_LONGLONG is #
# undef ACE_HAS_PROC_FS
# undef ACE_HAS_PRUSAGE_T
+
#elif defined (__SUNPRO_CC) && (__SUNPRO_CC <= 0x530)
// Wide character methods are in std:: when using SunCC 5.3
# define ACE_WCHAR_IN_STD_NAMESPACE
#endif /* __GNUG__ || ghs */
+
// SunOS 5.7 supports SCHED_FIFO and SCHED_RR, as well as SCHED_OTHER.
#undef ACE_HAS_ONLY_SCHED_OTHER
+
// SunOS 5.7 gets this right . . .
#undef ACE_HAS_BROKEN_T_ERROR
+
// And doesn't need to set LWP priorities, as shown by
// performance-tests/Misc/preempt.
#undef ACE_NEEDS_LWP_PRIO_SET
+
// SunOS 5.7 can support Real-Time Signals and POSIX4 AIO operations
// are supported.
+
#if !defined (ACE_HAS_AIO_CALLS)
#define ACE_HAS_AIO_CALLS
#endif /* !ACE_HAS_AIO_CALLS */
+
#ifdef ACE_HAS_LIMITED_SELECT
#undef ACE_HAS_LIMITED_SELECT
#endif /* ACE_HAS_LIMITED_SELECT */
+
// SunOS 5.7 has socklen_t
#define ACE_HAS_SOCKLEN_T
+
#if defined (__sparcv9)
#define _LP64
#define ACE_SIZEOF_LONG 8 /* Needed to circumvent compiler bug #4294969 */
#endif /* __sparcv9 */
+
#if (defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 == 4)) /* XPG4 or XPG4v2 */
// 2 parameter wcstok()
#else /* XPG4 or XPG4v2 */
# define ACE_HAS_3_PARAM_WCSTOK
#endif
+
// Solaris 7 started to support /dev/poll
#define ACE_HAS_DEV_POLL
+
#endif /* ACE_CONFIG_H */
diff --git a/dep/ACE_wrappers/ace/config-sunos5.8.h b/dep/ACE_wrappers/ace/config-sunos5.8.h
index 73a0f7ba8a6..36ce6d4a81a 100644
--- a/dep/ACE_wrappers/ace/config-sunos5.8.h
+++ b/dep/ACE_wrappers/ace/config-sunos5.8.h
@@ -1,29 +1,40 @@
/* -*- C++ -*- */
// $Id: config-sunos5.8.h 80826 2008-03-04 14:51:23Z wotte $
+
// The following configuration file is designed to work for SunOS 5.8
// (Solaris 8) platforms using the SunC++ 4.x, 5.x, 6.x, or g++ compilers.
+
#ifndef ACE_CONFIG_H
+
// ACE_CONFIG_H is defined by one of the following #included headers.
+
// #include the SunOS 5.7 config, then add any SunOS 5.8 updates below.
#include "ace/config-sunos5.7.h"
+
#undef ACE_WCHAR_IN_STD_NAMESPACE
+
// This may be true for versions prior to Solaris 8 as well, but I don't
// have any to try it on.
#if !defined (ACE_HAS_TIMEZONE)
# define ACE_HAS_TIMEZONE
#endif
+
// The range of thread priorities for 5.8 differs from 5.7 in the
// minimum priority for the SCHED_OTHER policy (i.e.,
// ACE_THR_PRI_OTHER_MIN)
# define ACE_THR_PRI_OTHER_MIN (long) -20
+
# if defined (_POSIX_PTHREAD_SEMANTICS)
# ifdef ACE_LACKS_RWLOCK_T
# undef ACE_LACKS_RWLOCK_T
# endif /* ACE_LACKS_RWLOCK_T */
# endif /* _POSIX_PTHREAD_SEMANTICS */
+
// This is no longer the case for Sun 5.9 onwards
# undef ACE_HAS_X86_STAT_MACROS
+
// gethostbyaddr does not handle IPv6-mapped-IPv4 addresses
#define ACE_HAS_BROKEN_GETHOSTBYADDR_V4MAPPED
+
#endif /* ACE_CONFIG_H */
diff --git a/dep/ACE_wrappers/ace/config-sunos5.9.h b/dep/ACE_wrappers/ace/config-sunos5.9.h
index cd42df15d0a..39b5721b527 100644
--- a/dep/ACE_wrappers/ace/config-sunos5.9.h
+++ b/dep/ACE_wrappers/ace/config-sunos5.9.h
@@ -1,13 +1,19 @@
/* -*- C++ -*- */
// $Id: config-sunos5.9.h 80826 2008-03-04 14:51:23Z wotte $
+
// The following configuration file is designed to work for SunOS 5.9
// (Solaris 9) platforms using the SunC++ 5.x (Forte 6 and 7), or g++
// compilers.
+
#ifndef ACE_CONFIG_H
+
// ACE_CONFIG_H is defined by one of the following #included headers.
+
// #include the SunOS 5.8 config, then add any SunOS 5.9 updates below.
#include "ace/config-sunos5.8.h"
+
#define ACE_HAS_SENDFILE
#define ACE_LACKS_THR_CONCURRENCY_FUNCS
+
#endif /* ACE_CONFIG_H */
diff --git a/dep/ACE_wrappers/ace/config-tandem-nsk-mips-v2.h b/dep/ACE_wrappers/ace/config-tandem-nsk-mips-v2.h
index f66f838002f..18e2cb23f79 100644
--- a/dep/ACE_wrappers/ace/config-tandem-nsk-mips-v2.h
+++ b/dep/ACE_wrappers/ace/config-tandem-nsk-mips-v2.h
@@ -1,28 +1,37 @@
// -*- C++ -*-
//
// $Id: config-tandem-nsk-mips-v2.h 81935 2008-06-12 22:01:53Z jtc $
+
#ifndef ACE_CONFIG_NSK_H
#define ACE_CONFIG_NSK_H
+
#include /**/ "ace/pre.h"
+
// The following configuration file contains defines for Tandem NSK
// platform, MIPS processor, version 2 C++ compiler.
+
//=========================================================================
// Tandem NSK specific parts
//=========================================================================
+
// Disable pthread renaming of symbols such as "open" and "close"
#define _CMA_NOWRAPPERS_ 1
+
// Get Handle_Set.cpp to generate correct bit operations for NSK platform
#define ACE_TANDEM_NSK_BIT_ORDER
+
// Use facilities provided by T1248 version of pthreads.
// (If not defined, will use old version of pthreads.)
#define ACE_TANDEM_T1248_PTHREADS
+
// Use all available T1248 thread aware wrapper functions for providing
// non-blocking I/O.
// [@note this causes a significant performance degradation]
//#define ACE_TANDEM_T1248_PTHREADS_ALL_IO_WRAPPERS
+
// Need this include here because some symbols defined by pthreads
// (e.g. timespec_t) are needed before spthread.h is normally included
// by ACE
@@ -32,6 +41,7 @@
#include "pthread.h"
#include "dce/cma_dispatch_coop.h"
#endif
+
// The following #defines are hacks to get around things
// that seem to be missing or different in Tandem land
#define NSIG 32 // missing from Signal.h
@@ -43,6 +53,7 @@ typedef long fd_mask; // should be in select.h but no such file
#define NFDBITS (sizeof (fd_mask) * NBBY) /* bits per mask */
#define MAXNAMLEN 248 // missing from dirent.h
#define ERRMAX 4218 // from errno.h
+
// Following seems to be missing from G06.20 version of standard
// pthreads includes (it appeared in older version of standard pthreads)
// (SCHED_FIFO (aka cma_c_sched_fifo) used in Dynamic_Priority_Test)
@@ -55,6 +66,7 @@ typedef enum CMA_T_SCHED_POLICY {
cma_c_sched_ada_low = 4
} cma_t_sched_policy;
#endif
+
// T1248 doesn't define these constants. They're defined in spt/cma.h
// (formerly dce/cma.h), but this header is not included or provided
// by T1248 G07-AAL.
@@ -70,226 +82,321 @@ typedef enum CMA_T_SCHED_POLICY {
#define cma_c_prio_back_min 1
#define cma_c_prio_back_mid 4
#define cma_c_prio_back_max 7
+
// Enable NSK Pluggable Protocols
#define TAO_HAS_NSKPW 1
#define TAO_HAS_NSKFS 1
+
//=========================================================================
// Platform specific parts
//=========================================================================
+
// Platform lacks getpwnam_r() methods (e.g., SGI 6.2).
#define ACE_LACKS_PWD_REENTRANT_FUNCTIONS
+
// Platform/compiler lacks {get,set}rlimit() function
#define ACE_LACKS_RLIMIT
+
// The platform doesn't have mmap(2)
#define ACE_LACKS_MMAP
+
// Platform lacks streambuf "linebuffered ()". [C++ iostream]
#define ACE_LACKS_LINEBUFFERED_STREAMBUF
+
// Platform supports recvmsg and sendmsg
#define ACE_HAS_MSG
+
// Platform defines ACE_HAS_MSG, but lacks msg_accrights{,len}.
#define ACE_LACKS_MSG_ACCRIGHTS
+
// Platform supports sigsuspend()
#define ACE_HAS_SIGSUSPEND
+
// Platform/compiler has the sigwait(2) prototype
#define ACE_HAS_SIGWAIT
+
// Compiler/platform defines the sig_atomic_t typedef
#define ACE_HAS_SIG_ATOMIC_T
+
// OS/compiler uses size_t * rather than int * for socket lengths
#define ACE_HAS_SIZET_SOCKET_LEN
+
// OS/compiler uses void * arg 4 setsockopt() rather than const char *
#define ACE_HAS_VOIDPTR_SOCKOPT
+
// The platform doesn't have mprotect(2)
#define ACE_LACKS_MPROTECT
+
// Platform lacks msync()
#define ACE_LACKS_MSYNC
+
// Platform does not support reentrant netdb functions (getprotobyname_r,
// getprotobynumber_r, gethostbyaddr_r, gethostbyname_r, getservbyname_r).
#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS Platform does not support
+
// Platform lacks madvise()
#define ACE_LACKS_MADVISE
+
// Platform lacks pri_t
#define ACE_LACKS_PRI_T
+
// Platform lacks a working sbrk()
#define ACE_LACKS_SBRK
+
// Platform doesn't have syscall() prototype
#define ACE_LACKS_SYSCALL
+
// Platform lacks the inet_aton() function.
#define ACE_LACKS_INET_ATON
+
// Compiler/platform has Dirent iterator functions
#define ACE_HAS_DIRENT
+
// Platform uses ACE_HAS_DIRENT but does not have readdir_r()
#define ACE_LACKS_READDIR_R
+
// Platform supports getpagesize() call (otherwise,
// ACE_PAGE_SIZE must be defined)
#define ACE_HAS_GETPAGESIZE
+
// Platform supports IP multicast
#define ACE_HAS_IP_MULTICAST
+
// Platform's select() uses non-const timeval*
#define ACE_HAS_NONCONST_SELECT_TIMEVAL
+
// Platform supports POSIX O_NONBLOCK semantics
#define ACE_HAS_POSIX_NONBLOCK
+
// Platform lacks named POSIX semaphores
#define ACE_LACKS_NAMED_POSIX_SEM
+
// Platform has support for multi-byte character support compliant
// with the XPG4 Worldwide Portability Interface wide-character
// classification.
#define ACE_HAS_XPG4_MULTIBYTE_CHAR
+
// No wcsstr function available for this compiler
#define ACE_LACKS_WCSSTR
+
// No wctype.h available for this compiler
#define ACE_LACKS_WCTYPE_H
+
// Platform supports the POSIX regular expression library.
// [Note Tandem NSK platform does have regular expresson support but it
// does not follow the assumptions made by ACE. To use it would need
// to make some ACE modifications.]
//#define ACE_HAS_REGEX
+
// Compiler/platform supports strerror ()
#define ACE_HAS_STRERROR
+
// Platform doesn't have truncate()
#define ACE_LACKS_TRUNCATE
+
// Platform lacks readers/writer locks.
#define ACE_LACKS_RWLOCK_T
+
// Compiler's 'new' throws exception on failure (ANSI C++ behavior).
#define ACE_NEW_THROWS_EXCEPTIONS
+
// Optimize ACE_Handle_Set::count_bits for select() operations (common
// case)
#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT
+
// Platform lacks setreuid()
#define ACE_LACKS_SETREUID
+
// Platform lacks setregid()
#define ACE_LACKS_SETREGID
+
// Compile using multi-thread libraries
#define ACE_MT_SAFE 1
+
+
// Platform supports System V IPC
#define ACE_HAS_SYSV_IPC
+
// Platform lacks the socketpair() call
// [Needed due to failure of Pipe_Test. even though nsk platform
// has socketpair(), Pipe.cpp tries to set socket buf size but this
// is not allowed for AF_UNIX protocol on nsk.]
#define ACE_LACKS_SOCKET_BUFSIZ
+
// Platform lacks the socketpair() call
#define ACE_LACKS_SOCKETPAIR
+
// Platform limits the maximum socket message size.
#define ACE_HAS_SOCK_BUF_SIZE_MAX
+
// hrtime_t is a basic type that doesn't require ACE_U64_TO_U32 conversion
#define ACE_HRTIME_T_IS_BASIC_TYPE
+
// printf format specifiers for 64 bit integers
# define ACE_UINT64_FORMAT_SPECIFIER ACE_TEXT ("%Ld")
# define ACE_INT64_FORMAT_SPECIFIER ACE_TEXT ("%Ld")
+
//=========================================================================
// Threads specific parts
//=========================================================================
+
// Platform supports threads
#define ACE_HAS_THREADS
+
// Platform supports POSIX Pthreads, of one form or another. This
// macro says the platform has a pthreads variety - should also define
// one of the below to say which one. Also may need some
// ACE_HAS_... thing for extensions.
#define ACE_HAS_PTHREADS
+
// Standard pthreads supports only SCHED_FIFO
#define ACE_HAS_ONLY_SCHED_FIFO
+
// Compiler/platform has thread-specific storage
#define ACE_HAS_THREAD_SPECIFIC_STORAGE
+
// Platform has no implementation of pthread_condattr_setpshared(),
// even though it supports pthreads!
#define ACE_LACKS_CONDATTR_PSHARED
+
// pthread_cond_timedwait does *not* reset the time argument when the
// lock is acquired.
#define ACE_LACKS_COND_TIMEDWAIT_RESET
+
// Platform lacks pthread_attr_setsched()
#define ACE_LACKS_SETSCHED
+
// Platform has pthread_mutexattr_setkind_np().
#define ACE_HAS_PTHREAD_MUTEXATTR_SETKIND_NP
+
// Platform lacks pthread_mutexattr_setpshared().
#define ACE_LACKS_MUTEXATTR_PSHARED
+
// Platform lacks pthread_attr_setscope()
#define ACE_LACKS_THREAD_PROCESS_SCOPING
+
// Platform lacks pthread_attr_setstackaddr
#define ACE_LACKS_PTHREAD_ATTR_SETSTACKADDR
+
// Defining ACE_HAS_UCONTEXT_T since G06.21 version of spthreads has
// a definition for it.
#ifdef ACE_TANDEM_T1248_PTHREADS
#define ACE_HAS_UCONTEXT_T
#endif
+
//=========================================================================
// Include file characteristics
//=========================================================================
+
// Compiler/platform contains the <sys/syscall.h> file.
#define ACE_HAS_SYS_SYSCALL_H
+
// Platform lacks malloc.h
#define ACE_LACKS_MALLOC_H
+
// Platform lacks the siginfo.h include file
#define ACE_LACKS_SIGINFO_H
+
// Platform doesn't define struct strrecvfd.
#define ACE_LACKS_STRRECVFD
+
// Platform lacks the ucontext.h file
#define ACE_LACKS_UCONTEXT_H
+
// Prototypes for both signal() and struct sigaction are consistent.
#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES
+
// Platform supports the POSIX struct timespec type
#define ACE_HAS_POSIX_TIME
+
// Platform/compiler supports timezone * as second parameter to gettimeofday()
#define ACE_HAS_TIMEZONE_GETTIMEOFDAY
+
// Platform has <strings.h> (which contains bzero() prototype)
#define ACE_HAS_STRINGS 1
+
// OS/compiler omits the const from the iovec parameter in the
// writev() prototype.
#define ACE_HAS_NONCONST_WRITEV
+
// Platform lacks <stdint.h>
#define ACE_LACKS_STDINT_H
+
// Platform lacks <inttypes.h>
#define ACE_LACKS_INTTYPES_H
+
// Platform lacks <sys/select.h>
#define ACE_LACKS_SYS_SELECT_H
+
// Platform lacks <dlfcn.h>
#define ACE_LACKS_DLFCN_H
+
// Platform lacks <semaphore.h>
#define ACE_LACKS_SEMAPHORE_H
+
// Platform lacks <poll.h>
#define ACE_LACKS_POLL_H
+
//=========================================================================
// Compiler specific parts
//=========================================================================
+
// Compiler supports C++ exception handling
#define ACE_HAS_EXCEPTIONS
+
// Compiler/platform has correctly prototyped header files
#define ACE_HAS_CPLUSPLUS_HEADERS
+
// Compiler/platform does not support the unsigned long long datatype.
#define ACE_LACKS_LONGLONG_T
+
// Compiler supports the ssize_t typedef
#define ACE_HAS_SSIZE_T
+
// Platform/compiler supports Standard C++ Library
#define ACE_HAS_STANDARD_CPP_LIBRARY 0
+
// Compiler's template mechanism must see source code (i.e.,
// .cpp files).
#define ACE_TEMPLATES_REQUIRE_SOURCE
+
// Compiler implements templates that support typedefs inside
// of classes used as formal arguments to a template class.
#define ACE_HAS_TEMPLATE_TYPEDEFS
+
// Platform has its standard c++ library in the namespace std.
#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1
+
// Compiler doesn't support static data member templates
#define ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES
+
// Platform lacks "signed char" type (broken!)
// Following will not be needed if use standard c library (G06.20 and later)
#define ACE_LACKS_SIGNED_CHAR
+
//=========================================================================
// Build options
//=========================================================================
+
// Disable the inclusion of RCS ids in the generated code.
#define ACE_USE_RCSID 0
+
// For debugging problems in os calls (but this doesn't work too well
// since output is not interleaved properly with output from ACE_TRACE
//# define ACE_OS_TRACE(X) ::printf(X)
+
// Uncomment the following if timed message blocks are needed (e.g.
// for Dynamic_Priority_Test. Otherwise leave this disabled because
// enabling it adds overhead to message blocks and timed message blocks
// are "rarely used."
//#define ACE_HAS_TIMED_MESSAGE_BLOCKS
+
// Uncomment the following if tokens library is needed.
//#define ACE_HAS_TOKENS_LIBRARY
+
#include /**/ "ace/post.h"
+
#endif /* ACE_CONFIG_NSK_H */
diff --git a/dep/ACE_wrappers/ace/config-tandem-nsk-mips-v3.h b/dep/ACE_wrappers/ace/config-tandem-nsk-mips-v3.h
index e0514100214..c002835a857 100644
--- a/dep/ACE_wrappers/ace/config-tandem-nsk-mips-v3.h
+++ b/dep/ACE_wrappers/ace/config-tandem-nsk-mips-v3.h
@@ -2,28 +2,37 @@
//
// $Id: config-tandem-nsk-mips-v3.h 81935 2008-06-12 22:01:53Z jtc $
+
#ifndef ACE_CONFIG_NSK_H
#define ACE_CONFIG_NSK_H
+
#include /**/ "ace/pre.h"
+
// The following configuration file contains defines for Tandem NSK
// platform, MIPS processor, version 3 C++ compiler.
+
//=========================================================================
// Tandem NSK specific parts
//=========================================================================
+
// Disable pthread renaming of symbols such as "open" and "close"
#define _CMA_NOWRAPPERS_ 1
+
// Get Handle_Set.cpp to generate correct bit operations for NSK platform
#define ACE_TANDEM_NSK_BIT_ORDER
+
// Use facilities provided by T1248 version of pthreads.
// (If not defined, will use old version of pthreads.)
#define ACE_TANDEM_T1248_PTHREADS
+
// Use all available T1248 thread aware wrapper functions for providing
// non-blocking I/O.
// [Note: this causes a significant performance degradation]
//#define ACE_TANDEM_T1248_PTHREADS_ALL_IO_WRAPPERS
+
// Need this include here because some symbols defined by pthreads
// (e.g. timespec_t) are needed before spthread.h is normally included
// by ACE
@@ -33,6 +42,7 @@
#include "pthread.h"
#include "dce/cma_dispatch_coop.h"
#endif
+
// The following #defines are hacks to get around things
// that seem to be missing or different in Tandem land
#define NSIG 32 // missing from Signal.h
@@ -44,6 +54,7 @@ typedef long fd_mask; // should be in select.h but no such file
#define NFDBITS (sizeof (fd_mask) * NBBY) /* bits per mask */
#define MAXNAMLEN 248 // missing from dirent.h
#define ERRMAX 4218 // from errno.h
+
// Following seems to be missing from G06.20 version of standard
// pthreads includes (it appeared in older version of standard pthreads)
// (SCHED_FIFO (aka cma_c_sched_fifo) used in Dynamic_Priority_Test)
@@ -56,6 +67,7 @@ typedef enum CMA_T_SCHED_POLICY {
cma_c_sched_ada_low = 4
} cma_t_sched_policy;
#endif
+
// T1248 doesn't define these constants. They're defined in spt/cma.h
// (formerly dce/cma.h), but this header is not included or provided
// by T1248 G07-AAL.
@@ -71,250 +83,354 @@ typedef enum CMA_T_SCHED_POLICY {
#define cma_c_prio_back_min 1
#define cma_c_prio_back_mid 4
#define cma_c_prio_back_max 7
+
// Enable NSK Pluggable Protocols
#define TAO_HAS_NSKPW 1
#define TAO_HAS_NSKFS 1
+
//=========================================================================
// Platform specific parts
//=========================================================================
+
// Platform lacks getpwnam_r() methods (e.g., SGI 6.2).
#define ACE_LACKS_PWD_REENTRANT_FUNCTIONS
+
// Platform/compiler lacks {get,set}rlimit() function
#define ACE_LACKS_RLIMIT
+
// The platform doesn't have mmap(2)
#define ACE_LACKS_MMAP
+
// Platform lacks streambuf "linebuffered ()". [C++ iostream]
#define ACE_LACKS_LINEBUFFERED_STREAMBUF
+
// Platform supports recvmsg and sendmsg
#define ACE_HAS_MSG
+
// Platform defines ACE_HAS_MSG, but lacks msg_accrights{,len}.
#define ACE_LACKS_MSG_ACCRIGHTS
+
// Platform supports sigsuspend()
#define ACE_HAS_SIGSUSPEND
+
// Platform/compiler has the sigwait(2) prototype
#define ACE_HAS_SIGWAIT
+
// Compiler/platform defines the sig_atomic_t typedef
#define ACE_HAS_SIG_ATOMIC_T
+
// OS/compiler uses size_t * rather than int * for socket lengths
#define ACE_HAS_SIZET_SOCKET_LEN
+
// OS/compiler uses void * arg 4 setsockopt() rather than const char *
#define ACE_HAS_VOIDPTR_SOCKOPT
+
// The platform doesn't have mprotect(2)
#define ACE_LACKS_MPROTECT
+
// Platform lacks msync()
#define ACE_LACKS_MSYNC
+
// Platform does not support reentrant netdb functions (getprotobyname_r,
// getprotobynumber_r, gethostbyaddr_r, gethostbyname_r, getservbyname_r).
#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS Platform does not support
+
// Platform lacks madvise()
#define ACE_LACKS_MADVISE
+
// Platform lacks pri_t
#define ACE_LACKS_PRI_T
+
// Platform lacks a working sbrk()
#define ACE_LACKS_SBRK
+
// Platform doesn't have syscall() prototype
#define ACE_LACKS_SYSCALL
+
// Platform lacks the inet_aton() function.
#define ACE_LACKS_INET_ATON
+
// Compiler/platform has Dirent iterator functions
#define ACE_HAS_DIRENT
+
// Platform uses ACE_HAS_DIRENT but does not have readdir_r()
#define ACE_LACKS_READDIR_R
+
// Platform supports getpagesize() call (otherwise,
// ACE_PAGE_SIZE must be defined)
#define ACE_HAS_GETPAGESIZE
+
// Platform supports IP multicast
#define ACE_HAS_IP_MULTICAST
+
// Platform's select() uses non-const timeval*
#define ACE_HAS_NONCONST_SELECT_TIMEVAL
+
// Platform supports POSIX O_NONBLOCK semantics
#define ACE_HAS_POSIX_NONBLOCK
+
// Platform lacks named POSIX semaphores
#define ACE_LACKS_NAMED_POSIX_SEM
+
// Platform has support for multi-byte character support compliant
// with the XPG4 Worldwide Portability Interface wide-character
// classification.
#define ACE_HAS_XPG4_MULTIBYTE_CHAR
+
// No wcsstr function available for this compiler
#define ACE_LACKS_WCSSTR
+
// No wctype.h available for this compiler
#define ACE_LACKS_WCTYPE_H
+
// Platform supports the POSIX regular expression library.
// [Note Tandem NSK platform does have regular expresson support but it
// does not follow the assumptions made by ACE. To use it would need
// to make some ACE modifications.]
//#define ACE_HAS_REGEX
+
// Compiler/platform supports strerror ()
#define ACE_HAS_STRERROR
+
// Platform doesn't have truncate()
#define ACE_LACKS_TRUNCATE
+
// Platform lacks readers/writer locks.
#define ACE_LACKS_RWLOCK_T
+
// Compiler's 'new' throws exception on failure (ANSI C++ behavior).
#define ACE_NEW_THROWS_EXCEPTIONS
+
// Optimize ACE_Handle_Set::count_bits for select() operations (common
// case)
#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT
+
// Platform lacks setreuid()
#define ACE_LACKS_SETREUID
+
// Platform lacks setregid()
#define ACE_LACKS_SETREGID
+
// Compile using multi-thread libraries
#define ACE_MT_SAFE 1
+
+
// Platform supports System V IPC
#define ACE_HAS_SYSV_IPC
+
// Platform lacks the socketpair() call
// [Needed due to failure of Pipe_Test. even though nsk platform
// has socketpair(), Pipe.cpp tries to set socket buf size but this
// is not allowed for AF_UNIX protocol on nsk.]
#define ACE_LACKS_SOCKET_BUFSIZ
+
// Platform lacks the socketpair() call
#define ACE_LACKS_SOCKETPAIR
+
// Platform limits the maximum socket message size.
#define ACE_HAS_SOCK_BUF_SIZE_MAX
+
// hrtime_t is a basic type that doesn't require ACE_U64_TO_U32 conversion
#define ACE_HRTIME_T_IS_BASIC_TYPE
+
// printf format specifiers for 64 bit integers
# define ACE_UINT64_FORMAT_SPECIFIER ACE_TEXT ("%Ld")
# define ACE_INT64_FORMAT_SPECIFIER ACE_TEXT ("%Ld")
+
// Use larger default buffer size for ease of interoperability
#define ACE_DEFAULT_CDR_BUFSIZE 4096
+
// Size of a wchar
#define ACE_SIZEOF_WCHAR 2
+
// Platform lacks time typedefs
#define ACE_LACKS_SUSECONDS_T
#define ACE_LACKS_USECONDS_T
+
// Platform lacks setegid() and seteuid()
#define ACE_LACKS_SETEGID
#define ACE_LACKS_SETEUID
+
// Platform lacks vsnprintf()
#define ACE_LACKS_VSNPRINTF
+
// Platform lacks log2()
#define ACE_LACKS_LOG2
+
// Platform lacks alphasort()
#define ACE_LACKS_ALPHASORT
+
//=========================================================================
// Threads specific parts
//=========================================================================
+
// Platform supports threads
#define ACE_HAS_THREADS
+
// Platform supports POSIX Pthreads, of one form or another. This
// macro says the platform has a pthreads variety - should also define
// one of the below to say which one. Also may need some
// ACE_HAS_... thing for extensions.
#define ACE_HAS_PTHREADS
+
// Standard pthreads supports only SCHED_FIFO
#define ACE_HAS_ONLY_SCHED_FIFO
+
// Compiler/platform has thread-specific storage
#define ACE_HAS_THREAD_SPECIFIC_STORAGE
+
// Platform has no implementation of pthread_condattr_setpshared(),
// even though it supports pthreads!
#define ACE_LACKS_CONDATTR_PSHARED
+
// pthread_cond_timedwait does *not* reset the time argument when the
// lock is acquired.
#define ACE_LACKS_COND_TIMEDWAIT_RESET
+
// Platform lacks pthread_attr_setsched()
#define ACE_LACKS_SETSCHED
+
// Platform has pthread_getschedparam and pthread_setschedparam
// even when ACE_LACKS_SETSCHED is defined.
#define ACE_HAS_PTHREAD_SCHEDPARAM
+
// Platform has pthread_mutexattr_setkind_np().
#define ACE_HAS_PTHREAD_MUTEXATTR_SETKIND_NP
+
// Platform lacks pthread_mutexattr_setpshared().
#define ACE_LACKS_MUTEXATTR_PSHARED
+
// Platform lacks pthread_attr_setscope()
#define ACE_LACKS_THREAD_PROCESS_SCOPING
+
// Platform lacks pthread_attr_setstackaddr
#define ACE_LACKS_PTHREAD_ATTR_SETSTACKADDR
+
// Platform lacks pthread_attr_setstack
#define ACE_LACKS_PTHREAD_ATTR_SETSTACK
+
// Defining ACE_HAS_UCONTEXT_T since G06.21 version of spthreads has
// a definition for it.
#ifdef ACE_TANDEM_T1248_PTHREADS
#define ACE_HAS_UCONTEXT_T
#endif
+
//=========================================================================
// Include file characteristics
//=========================================================================
+
// Compiler/platform contains the <sys/syscall.h> file.
#define ACE_HAS_SYS_SYSCALL_H
+
// Platform lacks malloc.h
#define ACE_LACKS_MALLOC_H
+
// Platform lacks the siginfo.h include file
#define ACE_LACKS_SIGINFO_H
+
// Platform doesn't define struct strrecvfd.
#define ACE_LACKS_STRRECVFD
+
// Platform lacks the ucontext.h file
#define ACE_LACKS_UCONTEXT_H
+
// Prototypes for both signal() and struct sigaction are consistent.
#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES
+
// Platform supports the POSIX struct timespec type
#define ACE_HAS_POSIX_TIME
+
// Platform/compiler supports timezone * as second parameter to gettimeofday()
#define ACE_HAS_TIMEZONE_GETTIMEOFDAY
+
// Platform has <strings.h> (which contains bzero() prototype)
#define ACE_HAS_STRINGS 1
+
// OS/compiler omits the const from the iovec parameter in the
// writev() prototype.
#define ACE_HAS_NONCONST_WRITEV
+
// Platform lacks <stdint.h>
#define ACE_LACKS_STDINT_H
+
// Platform lacks <inttypes.h>
#define ACE_LACKS_INTTYPES_H
+
// Platform lacks <sys/select.h>
#define ACE_LACKS_SYS_SELECT_H
+
// Platform lacks <dlfcn.h>
#define ACE_LACKS_DLFCN_H
+
// Platform lacks <semaphore.h>
#define ACE_LACKS_SEMAPHORE_H
+
// Platform lacks <poll.h>
#define ACE_LACKS_POLL_H
+
// Platform lacks <sys/sysctl.h>
#define ACE_LACKS_SYS_SYSCTL_H
+
//=========================================================================
// Compiler specific parts
//=========================================================================
+
// Compiler supports C++ exception handling
#define ACE_HAS_EXCEPTIONS 1
+
// Compiler/platform has correctly prototyped header files
#define ACE_HAS_CPLUSPLUS_HEADERS
+
// Compiler/platform does not support the unsigned long long datatype.
#define ACE_LACKS_UNSIGNEDLONGLONG_T
+
// Compiler supports the ssize_t typedef
#define ACE_HAS_SSIZE_T
+
// Platform/compiler supports Standard C++ Library
#define ACE_HAS_STANDARD_CPP_LIBRARY 1
+
// Compiler's template mechanism must see source code (i.e.,
// .cpp files).
#define ACE_TEMPLATES_REQUIRE_SOURCE
+
// Compiler implements templates that support typedefs inside
// of classes used as formal arguments to a template class.
#define ACE_HAS_TEMPLATE_TYPEDEFS
+
// Platform/Compiler supports a String class
#define ACE_HAS_STRING_CLASS
#define ACE_HAS_STDCPP_STL_INCLUDES
+
// Platform has its standard c++ library in the namespace std.
#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1
+
// Compiler doesn't support static data member templates
#define ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES
+
// Platform lacks "signed char" type (broken!)
// Following will not be needed if use standard c library (G06.20 and later)
#define ACE_LACKS_SIGNED_CHAR
+
// Compiler can handle any operators in namespace
#define ACE_ANY_OPS_USE_NAMESPACE
+
// Platform lacks intptr_t typedef
#define ACE_LACKS_INTPTR_T
+
//=========================================================================
// C++ version3 import/export macros
//=========================================================================
+
// Define the export macros needed to export symbols outside a DLL
// The ACE_IMPORT_SINGLETON_DECLARE macro has been modified to not explicitly
// instantiate the class template.
#if defined(USE_EXPLICIT_EXPORT)
#define ACE_LACKS_INLINE_FUNCTIONS
+
#define ACE_HAS_CUSTOM_EXPORT_MACROS
#define ACE_Proper_Export_Flag export$
#define ACE_Proper_Import_Flag import$
@@ -324,24 +440,33 @@ typedef enum CMA_T_SCHED_POLICY {
#define ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) template class import$ SINGLETON_TYPE <CLASS, LOCK>;
#endif
+
//=========================================================================
// Build options
//=========================================================================
+
// Disable the inclusion of RCS ids in the generated code.
#define ACE_USE_RCSID 0
+
// For debugging problems in os calls (but this doesn't work too well
// since output is not interleaved properly with output from ACE_TRACE
//# define ACE_OS_TRACE(X) ::printf(X)
+
// Uncomment the following if timed message blocks are needed (e.g.
// for Dynamic_Priority_Test. Otherwise leave this disabled because
// enabling it adds overhead to message blocks and timed message blocks
// are "rarely used."
//#define ACE_HAS_TIMED_MESSAGE_BLOCKS
+
// Uncomment the following if tokens library is needed.
//#define ACE_HAS_TOKENS_LIBRARY
+
// NonStop CORBA uses the XML Service Configurator
#define ACE_HAS_XML_SVC_CONF
+
#define ACE_LD_SEARCH_PATH "_RLD_LIB_PATH"
+
#include /**/ "ace/post.h"
+
#endif /* ACE_CONFIG_NSK_H */
diff --git a/dep/ACE_wrappers/ace/config-tandem.h b/dep/ACE_wrappers/ace/config-tandem.h
index 5b8e79627b8..1577e1e6866 100644
--- a/dep/ACE_wrappers/ace/config-tandem.h
+++ b/dep/ACE_wrappers/ace/config-tandem.h
@@ -1,8 +1,10 @@
/* -*- C++ -*- */
// Testing TANDEM
// $Id: config-tandem.h 81697 2008-05-14 18:33:11Z johnnyw $
+
// The following configuration file is designed to work for Tandems NonStop-UX
// 4.2MP platforms using the NCC 3.20 compiler.
+
// Note this is a test version it might include several errors I
// have done a test and set/unset until I errors disappered.
// Some of the options that should be set aren't because of the simple fact
@@ -12,53 +14,72 @@
// we must set _XOPEN_SOURCE and we get ALOT of errors and warnings.
// So this config is done to get things to start to work it isn't finished.
// Janne (Jan.Perman@osd.Ericsson.se)
+
#ifndef ACE_CONFIG_H
#define ACE_CONFIG_H
#include /**/ "ace/pre.h"
+
#if ! defined (__ACE_INLINE__)
# define __ACE_INLINE__
#endif /* ! __ACE_INLINE__ */
+
#define ACE_HAS_IDTYPE_T
// Optimize ACE_Handle_Set for select().
#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT
+
// Tandem doesn't include this although they are defined
// in sys/time.h and sys/resource.h
#define ACE_LACKS_RLIMIT_PROTOTYPE // jjpp
// Tandem has a function to set t_errno (set_t_errno)
#define ACE_HAS_SET_T_ERRNO // jjpp
+
//Platform supports System V IPC (most versions of UNIX, but not Win32)
#define ACE_HAS_SYSV_IPC
+
// OS/compiler omits the const from the sendmsg() prototype.
#define ACE_HAS_NONCONST_SENDMSG
+
//Platform supports system configuration information
#define ACE_HAS_SYS_SYSTEMINFO_H
#define ACE_HAS_SYSINFO
+
//Platform supports the POSIX regular expression library
#define ACE_HAS_REGEX
+
// Platform supports recvmsg and sendmsg
#define ACE_HAS_MSG
+
//Compiler/platform contains the <sys/syscall.h> file.
#define ACE_HAS_SYS_SYSCALL_H
+
//Platform provides <sysent.h> header
#define ACE_HAS_SYSENT_H
+
// Platform has POSIX terminal interface.
#define ACE_HAS_TERMIOS
+
//Platform supports POSIX O_NONBLOCK semantics
#define ACE_HAS_POSIX_NONBLOCK
+
// Compiler/platform has correctly prototyped header files
#define ACE_HAS_CPLUSPLUS_HEADERS
+
//Compiler/platform supports alloca()
// Although ACE does have alloca() on this compiler/platform combination, it is
// disabled by default since it can be dangerous. Uncomment the following line
// if you ACE to use it.
//#define ACE_HAS_ALLOCA
+
//Compiler/platform has <alloca.h>
#define ACE_HAS_ALLOCA_H
+
//Platform contains <poll.h>
#define ACE_HAS_POLL
+
// Platform supports the POSIX struct timespec type
#define ACE_HAS_POSIX_TIME // As i understand it, but i'm in deep water
//Platform supports the SVR4 timestruc_t type
+
// To get this to work a patch in sys/signal must be made
// typedef void SIG_FUNC_TYPE(int);
//#if defined (__cplusplus)
@@ -74,42 +95,58 @@
#define ACE_HAS_SIGINFO_T
//Platform supports ucontext_t (which is used in the extended signal API).
#define ACE_HAS_UCONTEXT_T
+
// Platform/compiler has the sigwait(2) prototype
#define ACE_HAS_SIGWAIT
+
//Compiler/platform provides the sockio.h file
#define ACE_HAS_SYS_SOCKIO_H
+
// Compiler supports the ssize_t typedef
#define ACE_HAS_SSIZE_T // Limits.h must be included
+
//Platform supports STREAMS
#define ACE_HAS_STREAMS
+
#define ACE_HAS_STREAM_PIPES
//Platform supports STREAM pipes
+
//Compiler/platform supports strerror ()
#define ACE_HAS_STRERROR
+
//Compiler/platform supports struct strbuf
#define ACE_HAS_STRBUF_T
+
//Compiler/platform supports SVR4 dynamic linking semantics
#define ACE_HAS_SVR4_DYNAMIC_LINKING
+
//Compiler/platform supports SVR4 TLI (in particular, T_GETNAME stuff)...
#define ACE_HAS_SVR4_TLI
+
//Platform provides <sys/filio.h> header
#define ACE_HAS_SYS_FILIO_H
+
//Platform supports TLI timod STREAMS module
#define ACE_HAS_TIMOD_H
//Platform supports TLI tiuser header
#define ACE_HAS_TIUSER_H
+
//Platform supports TLI
#define ACE_HAS_TLI
//Platform provides TLI function prototypes
#define ACE_HAS_TLI_PROTOTYPES
+
//Platform lacks streambuf "linebuffered ()".
#define ACE_LACKS_LINEBUFFERED_STREAMBUF
+
// Platform lacks "signed char" type (broken!)
#define ACE_LACKS_SIGNED_CHAR
+
#define ACE_PAGE_SIZE 4096
// Defines the page size of the system (not used on Win32 or
// with ACE_HAS_GETPAGESIZE).
+
/****** THREAD SPECIFIC **********/
/* If you want to remove threading then comment out the following four #defines .*/
#if !defined (ACE_MT_SAFE)
@@ -117,15 +154,21 @@
#endif
#define ACE_HAS_THREADS //Platform supports threads
#define ACE_HAS_STHREADS //Platform supports Solaris threads
+
// Compiler/platform has threadspecific storage
#define ACE_HAS_THREAD_SPECIFIC_STORAGE
//Platform supports thr_keydelete (e.g,. UNIXWARE)
+
#define ACE_HAS_THR_MINSTACK // Tandem uses thr_minstack instead of thr_min_stack
#define ACE_LACKS_PRI_T // Tandem lacks pri_t
#define ACE_HAS_THR_KEYDELETE
+
//*************************************
+
/*********************************/
+
/******* SIGNAL STUFF *******/
+
//Platform uses non-const char * in calls to gethostbyaddr, gethostbyname,
// getservbyname
#define ACE_HAS_NONCONST_GETBY
@@ -142,8 +185,10 @@
#define ACE_LACKS_MADVISE
//Compiler/platform lacks strcasecmp() (e.g., DG/UX, UNIXWARE, VXWORKS)
#define ACE_LACKS_STRCASECMP
+
// Defines the page size of the system.
#define ACE_PAGE_SIZE 4096
+
#include /**/ "ace/post.h"
#endif /* ACE_CONFIG_H */
diff --git a/dep/ACE_wrappers/ace/config-tru64.h b/dep/ACE_wrappers/ace/config-tru64.h
index 34cd823e757..db16845b529 100644
--- a/dep/ACE_wrappers/ace/config-tru64.h
+++ b/dep/ACE_wrappers/ace/config-tru64.h
@@ -1,42 +1,55 @@
/* -*- C++ -*- */
// $Id: config-tru64.h 81935 2008-06-12 22:01:53Z jtc $
+
// The following configuration file is designed to work for the
// Digital UNIX V4.0a and later platforms. It relies on
// config-osf1-4.0.h, and adds deltas for newer platforms.
+
#ifndef ACE_CONFIG_TRU64_H
#define ACE_CONFIG_TRU64_H
#include /**/ "ace/pre.h"
+
#if !defined (__ACE_INLINE__)
# define __ACE_INLINE__
#endif /* ! __ACE_INLINE__ */
+
// Compile using multi-thread libraries.
#if !defined (ACE_MT_SAFE)
# define ACE_MT_SAFE 1
#endif /* ! ACE_MT_SAFE */
+
/*clearerr is not defined when _REENTRANT is not defined*/
#if ACE_MT_SAFE == 0
#define ACE_LACKS_CLEARERR
#endif /* ACE_MT_SAFE == 0 */
+
#include "ace/config-posix.h"
+
// Configuration-specific #defines:
// 1) g++ or cxx
// 2) pthreads or DCE threads
#if defined (__GNUG__)
// g++ with pthreads
+
// config-g++-common.h undef's ACE_HAS_STRING_CLASS with -frepo, so
// this must appear before its #include.
# define ACE_HAS_STRING_CLASS
+
# include "ace/config-g++-common.h"
+
# define ACE_HAS_GNU_CSTRING_H
# define ACE_HAS_REENTRANT_FUNCTIONS
#elif defined (__DECCXX)
+
# define ACE_CONFIG_INCLUDE_CXX_COMMON
# include "ace/config-cxx-common.h"
+
#elif defined (__rational__)
# define ACE_HAS_REENTRANT_FUNCTIONS
# define ACE_HAS_STRING_CLASS
# define ACE_LACKS_LINEBUFFERED_STREAMBUF
# define ACE_LACKS_SIGNED_CHAR
+
// Exceptions are enabled by platform_osf1_4.0_rcc.GNU.
# define ACE_HAS_STDCPP_STL_INCLUDES
#else
@@ -44,6 +57,7 @@
# error unsupported compiler on Digital Unix
# endif /* __cplusplus */
#endif /* ! __GNUG__ && ! __DECCXX && ! __rational__ */
+
#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R
#define ACE_HAS_BROKEN_IF_HEADER
#define ACE_HAS_BROKEN_R_ROUTINES
@@ -55,7 +69,9 @@
#if !defined (DIGITAL_UNIX)
# define DIGITAL_UNIX 0x400
#endif /* ! DIGITAL_UNIX */
+
#define ACE_SIZEOF_LONG 8
+
#define ACE_DEFAULT_BASE_ADDR ((char *) 0x80000000)
#define ACE_HAS_AUTOMATIC_INIT_FINI
#define ACE_HAS_NONCONST_SETRLIMIT
@@ -110,6 +126,7 @@
#define ACE_PAGE_SIZE 8192
#define ACE_HAS_SIGTIMEDWAIT
#define ACE_HAS_SIGSUSPEND
+
// DJT 6/10/96 All these broken macro's can now be removed with the
// approporiate ordering of the include files. The Platinum release
// now temporarily supports both forms. Platform's implementation of
@@ -117,17 +134,22 @@
#define ACE_HAS_NONCONST_SENDMSG
#define ACE_HAS_IDTYPE_T
#define ACE_HAS_NONSTATIC_OBJECT_MANAGER
+
#if DIGITAL_UNIX >= 0x500
# define ACE_HAS_XPG4_MULTIBYTE_CHAR 1
#endif /* DIGITAL_UNIX >= 0x500 */
+
#if DIGITAL_UNIX >= 0x40E
# define ACE_LACKS_STDINT_H
#endif /* DIGITAL_UNIX >= 0x40E */
+
#if (DIGITAL_UNIX >= 0x400) && (DIGITAL_UNIX < 0x500)
#define ACE_LACKS_PREAD_PROTOTYPE
#endif /* (DIGITAL_UNIX >= 0x400) && (DIGITAL_UNIX < 0x500) */
+
// gethostbyaddr does not handle IPv6-mapped-IPv4 addresses
#define ACE_HAS_BROKEN_GETHOSTBYADDR_V4MAPPED
+
#include /**/ "ace/post.h"
#endif /* ACE_CONFIG_TRU64_H */
diff --git a/dep/ACE_wrappers/ace/config-unixware-7.1.0.h b/dep/ACE_wrappers/ace/config-unixware-7.1.0.h
index c6d329e9d93..03725638a70 100644
--- a/dep/ACE_wrappers/ace/config-unixware-7.1.0.h
+++ b/dep/ACE_wrappers/ace/config-unixware-7.1.0.h
@@ -1,38 +1,52 @@
/* -*- C++ -*- */
// $Id: config-unixware-7.1.0.h 82267 2008-07-08 16:39:19Z jtc $
+
#ifndef ACE_CONFIG_H
#define ACE_CONFIG_H
+
/* ACE configuration header file */
+
/* Include the commong gnu config file */
#include "config-g++-common.h"
+
/* For unixware 7.1 && g++ 2.91.57, see if this fixes my problem */
#ifndef UNIXWARE_7_1
#define UNIXWARE_7_1
#endif
+
/* Define if you have alloca, as a function or macro. */
#define HAVE_ALLOCA 1
+
/* Define if you have the strftime function. */
#define HAVE_STRFTIME 1
+
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
#define HAVE_SYS_WAIT_H 1
+
/* Define if you have the ANSI C header files. */
#define STDC_HEADERS 1
+
/* Define if lex declares yytext as a char * by default, not a char[]. */
#define YYTEXT_POINTER 1
+
/* Define _REENTRANT if reentrant functions should be used. */
#ifndef _REENTRANT
# define _REENTRANT 1
#endif
+
#define ACE_HAS_NEW_NO_H 1
#define ACE_HAS_STDEXCEPT_NO_H 1
+
#define ACE_THREAD_MIN_PRIORITY 0
#if defined (ACE_THREAD_MIN_PRIORITY)
# define PTHREAD_MIN_PRIORITY ACE_THREAD_MIN_PRIORITY
#endif /* #if defined (ACE_THREAD_MIN_PRIORITY) */
+
#define ACE_THREAD_MAX_PRIORITY 99
#if defined (ACE_THREAD_MAX_PRIORITY)
# define PTHREAD_MAX_PRIORITY ACE_THREAD_MAX_PRIORITY
#endif /* #if defined (ACE_THREAD_MAX_PRIORITY) */
+
/* Specify sizes of given built-in types. If a size isn't defined here,
then ace/Basic_Types.h will attempt to deduce the size. */
/* #undef ACE_SIZEOF_CHAR */
@@ -44,63 +58,86 @@
#define ACE_SIZEOF_FLOAT 4
#define ACE_SIZEOF_DOUBLE 8
#define ACE_SIZEOF_LONG_DOUBLE 12
+
/* Enable ACE inlining */
#define __ACE_INLINE__ 1
+
/* OS has priocntl (2) */
#define ACE_HAS_PRIOCNTL 1
+
/* Platform has pread() and pwrite() support */
#define ACE_HAS_P_READ_WRITE 1
+
/* Compiler/platform supports alloca() */
// Although ACE does have alloca() on this compiler/platform combination, it is
// disabled by default since it can be dangerous. Uncomment the following line
// if you ACE to use it.
//#define ACE_HAS_ALLOCA 1
+
/* Compiler/platform correctly calls init()/fini() for shared libraries */
#define ACE_HAS_AUTOMATIC_INIT_FINI 1
+
/* Platform doesn't cast MAP_FAILED to a (void *). */
/* #undef ACE_HAS_BROKEN_MAP_FAILED */
/* Staller: oh yes, let's do this! */
#define ACE_HAS_BROKEN_MAP_FAILED
+
/* Prototypes for both signal() and struct sigaction are consistent. */
#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES 1
+
/* Platform supports operations on directories via struct dirent,
readdir_r, etc. */
#define ACE_HAS_DIRENT 1
+
/* Compiler supports C++ exception handling */
// MM-Graz if ! defined inserted, to prevent warnings, because it is already
// defined in config-g++common.h
# if !defined (ACE_HAS_EXCEPTIONS)
#define ACE_HAS_EXCEPTIONS 1
# endif
+
/* Platform supports getpagesize() call (otherwise, ACE_PAGE_SIZE must be
defined, except on Win32) */
#define ACE_HAS_GETPAGESIZE 1
+
/* Platform supports the getrusage() system call. */
#define ACE_HAS_GETRUSAGE 1
+
/* Platform has a getrusage () prototype in sys/resource.h that differs from
the one in ace/OS.i. */
#define ACE_HAS_GETRUSAGE_PROTOTYPE 1
+
/* Denotes that GNU has cstring.h as standard which redefines memchr() */
#define ACE_HAS_GNU_CSTRING_H
+
/* The GPERF utility is compiled for this platform */
#define ACE_HAS_GPERF 1
+
/* Optimize ACE_Handle_Set::count_bits for select() operations (common case) */
#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT 1
+
/* Compiler/platform supports idtype_t. */
#define ACE_HAS_IDTYPE_T 1
+
/* Platform supports IP multicast */
#define ACE_HAS_IP_MULTICAST 1
+
/* Platform supports thr_keydelete (e.g,. UNIXWARE) */
#define ACE_HAS_THR_KEYDELETE 1
+
/* Platform calls thr_minstack() rather than thr_min_stack() (e.g., Tandem). */
#define ACE_HAS_THR_MINSTACK 1
+
/* Platform supports recvmsg and sendmsg */
#define ACE_HAS_MSG 1
+
/* Platform's select() uses non-const timeval* (only found on Linux right
now) */
#define ACE_HAS_NONCONST_SELECT_TIMEVAL 1
+
/* Uses ctime_r & asctime_r with only two parameters vs. three. */
#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R 1
+
/* Platform is an Intel Pentium microprocessor. */
/* There is a problem with the gethrtime() because of (apparently) a problem
with the inline assembly instruction. Hopefully there is a way to resolve
@@ -110,184 +147,267 @@
#undef ACE_HAS_PENTIUM
#endif /* ACE_HAS_PENTIUM */
+
/* Platform contains <poll.h> */
#define ACE_HAS_POLL 1
+
/* Platform supports POSIX O_NONBLOCK semantics */
#define ACE_HAS_POSIX_NONBLOCK 1
+
/* Platform supports the POSIX struct timespec type */
#define ACE_HAS_POSIX_TIME 1
+
/* Platform supports the /proc file system and defines tid_t
in <sys/procfs.h> */
#define ACE_HAS_PROC_FS 1
+
/* Platform supports POSIX Threads */
#define ACE_HAS_PTHREADS 1
+
/* pthread.h declares an enum with PTHREAD_PROCESS_PRIVATE and
PTHREAD_PROCESS_SHARED values */
#define ACE_HAS_PTHREAD_PROCESS_ENUM 1
+
/* Platform will recurse infinitely on thread exits from TSS cleanup routines
(e.g., AIX) */
#define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS 1
+
/* Platform supports reentrant functions (i.e., all the POSIX *_r
functions). */
#define ACE_HAS_REENTRANT_FUNCTIONS 1
+
/* Platform has support for multi-byte character support compliant with the
XPG4 Worldwide Portability Interface wide-character classification. */
#define ACE_HAS_XPG4_MULTIBYTE_CHAR 1
+
/* Platform does not support reentrant netdb functions (getprotobyname_r,
getprotobynumber_r, gethostbyaddr_r, gethostbyname_r, getservbyname_r). */
#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS 1
+
/* Platform supports the POSIX regular expression library */
#define ACE_HAS_REGEX 1
+
/* Platform has special header for select(). */
#define ACE_HAS_SELECT_H 1
+
/* Platform has a function to set t_errno (e.g., Tandem). */
#define ACE_HAS_SET_T_ERRNO 1
+
/* Platform supports SVR4 extended signals */
#define ACE_HAS_SIGINFO_T 1
+
/* Platform/compiler has the sigwait(2) prototype */
#define ACE_HAS_SIGWAIT 1
+
/* Compiler/platform defines the sig_atomic_t typedef */
#define ACE_HAS_SIG_ATOMIC_T 1
+
/* Platform supports new BSD inet_addr len field. */
#define ACE_HAS_SOCKADDR_IN_SIN_LEN 1
+
/* OS/compiler uses size_t * rather than int * for socket lengths */
#define ACE_HAS_SIZET_SOCKET_LEN 1
+
/* Compiler/platform provides the sys/sockio.h file */
#define ACE_HAS_SYS_SOCKIO_H 1
+
/* Compiler supports the ssize_t typedef */
#define ACE_HAS_SSIZE_T 1
+
/* Platform supports UNIX International Threads */
#define ACE_HAS_STHREADS 1
+
/* Platform has thr_yield() */
#define ACE_HAS_THR_YIELD 1
+
/* Compiler/platform supports struct strbuf */
#define ACE_HAS_STRBUF_T 1
+
/* Platform supports STREAMS */
#define ACE_HAS_STREAMS 1
+
/* Platform supports STREAM pipes */
#define ACE_HAS_STREAM_PIPES 1
+
/* Compiler/platform supports strerror () */
#define ACE_HAS_STRERROR 1
+
/* Platform/Compiler supports a String class (e.g., GNU or Win32). */
#define ACE_HAS_STRING_CLASS 1
+
/* Platform has <strings.h> (which contains bzero() prototype) */
#define ACE_HAS_STRINGS 1
+
/* Platform/compiler supports void * as second parameter to gettimeofday(). */
#define ACE_HAS_VOIDPTR_GETTIMEOFDAY 1
+
/* Compiler/platform supports SVR4 dynamic linking semantics */
#define ACE_HAS_SVR4_DYNAMIC_LINKING 1
+
/* Compiler/platform supports SVR4 TLI (in particular, T_GETNAME stuff)... */
#define ACE_HAS_SVR4_TLI 1
+
/* Compiler/platform contains the <sys/syscall.h> file. */
#define ACE_HAS_SYS_SYSCALL_H 1
+
/* Platform supports system configuration information */
#define ACE_HAS_SYS_SYSTEMINFO_H
#define ACE_HAS_SYSINFO 1
+
/* Platform supports System V IPC (most versions of UNIX, but not Win32) */
#define ACE_HAS_SYSV_IPC 1
+
/* Platform provides <sys/filio.h> header */
#define ACE_HAS_SYS_FILIO_H 1
+
/* Platform provides <sys/xti.h> header */
#define ACE_HAS_SYS_XTI_H 1
+
/* Platform has POSIX terminal interface. */
#define ACE_HAS_TERMIOS 1
+
/* Platform supports threads */
#define ACE_HAS_THREADS 1
+
/* Compiler/platform has thread-specific storage */
#define ACE_HAS_THREAD_SPECIFIC_STORAGE 1
+
/* Platform supports TLI timod STREAMS module */
#define ACE_HAS_TIMOD_H 1
+
/* Platform supports TLI tiuser header */
#define ACE_HAS_TIUSER_H 1
+
/* Platform supports TLI. Also see ACE_TLI_TCP_DEVICE. */
#define ACE_HAS_TLI 1
+
/* Platform provides TLI function prototypes */
#define ACE_HAS_TLI_PROTOTYPES 1
+
/* Platform supports ualarm() */
#define ACE_HAS_UALARM 1
+
/* Platform supports ucontext_t (which is used in the extended signal API). */
#define ACE_HAS_UCONTEXT_T 1
+
/* Platform has <utime.h> header file */
#define ACE_HAS_UTIME 1
+
/* Platform requires void * for mmap(). */
#define ACE_HAS_VOIDPTR_MMAP 1
+
/* Platform has XTI (X/Open-standardized superset of TLI). Implies
ACE_HAS_TLI but uses a different header file. */
#define ACE_HAS_XTI 1
+
/* Platform can not build ace/IOStream{,_T}.cpp. This does not necessarily
mean that the platform does not support iostreams. */
#define ACE_LACKS_ACE_IOSTREAM 1
+
/* Platform does not have u_longlong_t typedef */
#define ACE_LACKS_U_LONGLONG_T 1
+
/* Platform lacks madvise() (e.g., Linux) */
#define ACE_LACKS_MADVISE 1
+
/* Platform lacks pri_t (e.g., Tandem NonStop UNIX). */
#define ACE_LACKS_PRI_T 1
+
/* Platform lacks pthread_thr_sigsetmask (e.g., MVS, HP/UX, and OSF/1 3.2) */
#define ACE_LACKS_PTHREAD_THR_SIGSETMASK 1
+
/* Platfrom lack pthread_yield() support. */
#define ACE_LACKS_PTHREAD_YIELD 1
+
/* Platform lacks readers/writer locks. */
#define ACE_LACKS_RWLOCK_T 1
+
/* MIT pthreads platform lacks the timedwait prototypes */
#define ACE_LACKS_TIMEDWAIT_PROTOTYPES 1
+
/* Platform does not define timepec_t as a typedef for struct timespec. */
#define ACE_LACKS_TIMESPEC_T 1
+
/* Compile using multi-thread libraries */
#define ACE_MT_SAFE 1
+
/* Platform needs to #include <sched.h> to get thread scheduling defs. */
#define ACE_NEEDS_SCHED_H 1
+
/*********************************************************************/
/* Compiler's template mechanim must see source code (i.e., .cpp files). This
is used for GNU G++. */
/* Staller -> make 0 */
// #undef ACE_TEMPLATES_REQUIRE_SOURCE
+
/*********************************************************************/
+
/* The OS/platform supports the poll() event demultiplexor */
#define ACE_USE_POLL 1
+
/* Platform has its standard c++ library in the namespace std. */
#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1
+
/* The number of bytes in a double. */
#define SIZEOF_DOUBLE 8
+
/* The number of bytes in a float. */
#define SIZEOF_FLOAT 4
+
/* The number of bytes in a int. */
#define SIZEOF_INT 4
+
/* The number of bytes in a long. */
#define SIZEOF_LONG 4
+
/* The number of bytes in a long double. */
#define SIZEOF_LONG_DOUBLE 12
+
/* The number of bytes in a long long. */
#define SIZEOF_LONG_LONG 8
+
/* The number of bytes in a short. */
#define SIZEOF_SHORT 2
+
/* The number of bytes in a signed char. */
#define SIZEOF_SIGNED_CHAR 1
+
/* The number of bytes in a void *. */
#define SIZEOF_VOID_P 4
+
/* Define if you have the execv function. */
#define HAVE_EXECV 1
+
/* Define if you have the execve function. */
#define HAVE_EXECVE 1
+
/* Define if you have the execvp function. */
#define HAVE_EXECVP 1
+
/* Define if you have the <dirent.h> header file. */
#define HAVE_DIRENT_H 1
+
/* Define if you have the <fstream> header file. */
#define HAVE_FSTREAM 1
+
/* Define if you have the <iomanip> header file. */
#define HAVE_IOMANIP 1
+
/* Define if you have the <iostream> header file. */
#define HAVE_IOSTREAM 1
+
/* Define if you have the <pwd.h> header file. */
#define HAVE_PWD_H 1
+
/* Name of package */
#define PACKAGE "ace"
+
/* Added by Staller */
#define ENUM_BOOLEAN // See file /usr/local/lib/gcc-lib/i486-pc-sysv5/egcs-2.91.60/include/sys/types.h
#define howmany(x, y) (((x)+((y)-1))/(y))
#define ACE_HAS_BROKEN_T_ERROR // make a nasty warning disappear in OS.i
#define __USLC__ 1
#define __IOCTL_VERSIONED__ // By Carlo!
+
#endif /* ACE_CONFIG_H */
diff --git a/dep/ACE_wrappers/ace/config-unixware-7.1.0.udk.h b/dep/ACE_wrappers/ace/config-unixware-7.1.0.udk.h
index a81b546bca9..988c451effb 100644
--- a/dep/ACE_wrappers/ace/config-unixware-7.1.0.udk.h
+++ b/dep/ACE_wrappers/ace/config-unixware-7.1.0.udk.h
@@ -1,29 +1,42 @@
/* -*- C++ -*- */
#ifndef ACE_CONFIG_UNIXWARE_UDK_H
#define ACE_CONFIG_UNIXWARE_UDK_H
+
// $Id: config-unixware-7.1.0.udk.h 82267 2008-07-08 16:39:19Z jtc $
+
// Configuration for the unixware UDK compiler. derived from the unixware/g++ config
// which was itself derived from an autoconfig run.
+
/* ACE configuration header file */
+
#define ACE_TEMPLATES_REQUIRE_SOURCE
+
#ifndef UNIXWARE_7_1
#define UNIXWARE_7_1
#endif
+
#define ACE_LACKS_PLACEMENT_OPERATOR_DELETE
+
/* Define if you have the strftime function. */
#define HAVE_STRFTIME 1
+
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
#define HAVE_SYS_WAIT_H 1
+
/* Define if you have the ANSI C header files. */
#define STDC_HEADERS 1
+
/* Define if lex declares yytext as a char * by default, not a char[]. */
#define YYTEXT_POINTER 1
+
/* Define _REENTRANT if reentrant functions should be used. */
#ifndef _REENTRANT
# define _REENTRANT 1
#endif
+
#define ACE_HAS_NEW_NO_H 1
#define ACE_HAS_STDEXCEPT_NO_H 1
+
/*
* TODO: These two next #defines have an #undef before them, in
* case the variable being defined already had a value.
@@ -34,16 +47,20 @@
/* # undef PTHREAD_MIN_PRIORITY */
# define PTHREAD_MIN_PRIORITY ACE_THREAD_MIN_PRIORITY
#endif /* #if defined (ACE_THREAD_MIN_PRIORITY) */
+
#define ACE_THREAD_MAX_PRIORITY 99
#if defined (ACE_THREAD_MAX_PRIORITY)
/* # undef PTHREAD_MAX_PRIORITY */
# define PTHREAD_MAX_PRIORITY ACE_THREAD_MAX_PRIORITY
#endif /* #if defined (ACE_THREAD_MAX_PRIORITY) */
+
+
/* UnixWare specific configuration parameters */
/* #undef UNIXWARE */
/* #undef UNIXWARE_2_0 */
/* #undef UNIXWARE_2_1 */
+
/* Specify sizes of given built-in types. If a size isn't defined here,
then ace/Basic_Types.h will attempt to deduce the size. */
/* #undef ACE_SIZEOF_CHAR */
@@ -55,78 +72,106 @@
#define ACE_SIZEOF_FLOAT 4
#define ACE_SIZEOF_DOUBLE 8
#define ACE_SIZEOF_LONG_DOUBLE 12
+
/* Enable ACE inlining */
#define __ACE_INLINE__ 1
+
/* Platform supports Asynchronous IO calls */
/* #define ACE_HAS_AIO_CALLS */
+
/* Specify this if you don't want threads to inherit parent thread's
ACE_Log_Msg properties. */
/* #undef ACE_THREADS_DONT_INHERIT_LOG_MSG */
+
/* OS has priocntl (2) */
#define ACE_HAS_PRIOCNTL 1
+
/* Platform has pread() and pwrite() support */
#define ACE_HAS_P_READ_WRITE 1
+
/* Compiler/platform correctly calls init()/fini() for shared libraries */
#define ACE_HAS_AUTOMATIC_INIT_FINI 1
+
/* Compiler handles explicit calling of template destructor correctly.
See "ace/OS.h" for details. */
/* Staller: already defined by config-g++-common.h
#define ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR 1
*/
+
/* Platform doesn't cast MAP_FAILED to a (void *). */
/* #undef ACE_HAS_BROKEN_MAP_FAILED */
/* Staller: oh yes, let's do this! */
#define ACE_HAS_BROKEN_MAP_FAILED
+
/* Prototypes for both signal() and struct sigaction are consistent. */
#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES 1
+
/* Compiler/platform has correctly prototyped header files */
#define ACE_HAS_CPLUSPLUS_HEADERS
+
/* Platform supports operations on directories via struct dirent,
readdir_r, etc. */
#define ACE_HAS_DIRENT
+
/* Compiler supports C++ exception handling */
# if !defined (ACE_HAS_EXCEPTIONS)
#define ACE_HAS_EXCEPTIONS
# endif
+
/* Platform supports getpagesize() call (otherwise, ACE_PAGE_SIZE must be
defined, except on Win32) */
#define ACE_HAS_GETPAGESIZE
+
/* Platform supports the getrusage() system call. */
#define ACE_HAS_GETRUSAGE
+
/* Platform has a getrusage () prototype in sys/resource.h that differs from
the one in ace/OS.i. */
#define ACE_HAS_GETRUSAGE_PROTOTYPE
+
/* The GPERF utility is compiled for this platform */
#define ACE_HAS_GPERF
+
/* Optimize ACE_Handle_Set::count_bits for select() operations (common case) */
#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT 1
+
/* Compiler/platform supports SunOS high resolution timers */
/* #undef ACE_HAS_HI_RES_TIMER */
+
/* Compiler/platform supports idtype_t. */
#define ACE_HAS_IDTYPE_T
+
/* Inline all the static class OS methods to remove call overhead */
/* Note: This gets defined by OS.h if __ACE_INLINE__ is defined */
/* #undef ACE_HAS_INLINED_OSCALLS */
+
/* Platform supports IP multicast */
#define ACE_HAS_IP_MULTICAST
+
/* Platform supports thr_keydelete (e.g,. UNIXWARE) */
#define ACE_HAS_THR_KEYDELETE
+
/* Platform calls thr_minstack() rather than thr_min_stack() (e.g., Tandem). */
#define ACE_HAS_THR_MINSTACK
+
/* Some files, such as ace/streams.h, want to include new style C++ stream
headers. These headers are iomanip, ios, iostream, istream, ostream,
fstream and streambuf. If _all_ of these headers aren't available, then
assume that only iostream.h and fstream.h are available. */
/* #define ACE_USES_OLD_IOSTREAMS */
+
/* Platform supports recvmsg and sendmsg */
#define ACE_HAS_MSG
+
/* Platform's select() uses non-const timeval* (only found on Linux right
now) */
#define ACE_HAS_NONCONST_SELECT_TIMEVAL
+
/* Uses ctime_r & asctime_r with only two parameters vs. three. */
#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R
+
/* Platform is an Intel Pentium microprocessor. */
/* There is a problem with the gethrtime() because of (apparently) a problem
with the inline assembly instruction. Hopefully there is a way to resolve
@@ -136,186 +181,270 @@
//#undef ACE_HAS_PENTIUM
#endif /* ACE_HAS_PENTIUM */
+
/* Platform contains <poll.h> */
#define ACE_HAS_POLL
+
/* Platform supports POSIX O_NONBLOCK semantics */
#define ACE_HAS_POSIX_NONBLOCK
+
/* Platform supports the POSIX struct timespec type */
#define ACE_HAS_POSIX_TIME
+
/* Platform supports the /proc file system and defines tid_t
in <sys/procfs.h> */
#define ACE_HAS_PROC_FS
+
/* Platform supports POSIX Threads */
#define ACE_HAS_PTHREADS
+
/* pthread.h declares an enum with PTHREAD_PROCESS_PRIVATE and
PTHREAD_PROCESS_SHARED values */
#define ACE_HAS_PTHREAD_PROCESS_ENUM
+
/* Platform will recurse infinitely on thread exits from TSS cleanup routines
(e.g., AIX) */
#define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS
+
/* Platform supports reentrant functions (i.e., all the POSIX *_r
functions). */
#define ACE_HAS_REENTRANT_FUNCTIONS
+
/* Platform has support for multi-byte character support compliant with the
XPG4 Worldwide Portability Interface wide-character classification. */
#define ACE_HAS_XPG4_MULTIBYTE_CHAR
+
/* Platform does not support reentrant netdb functions (getprotobyname_r,
getprotobynumber_r, gethostbyaddr_r, gethostbyname_r, getservbyname_r). */
#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS
+
/* Platform supports the POSIX regular expression library */
#define ACE_HAS_REGEX
+
/* Platform has special header for select(). */
#define ACE_HAS_SELECT_H
+
/* Platform has a function to set t_errno (e.g., Tandem). */
#define ACE_HAS_SET_T_ERRNO
+
/* Platform supports SVR4 extended signals */
#define ACE_HAS_SIGINFO_T
+
/* Platform/compiler has the sigwait(2) prototype */
#define ACE_HAS_SIGWAIT
+
/* Compiler/platform defines the sig_atomic_t typedef */
#define ACE_HAS_SIG_ATOMIC_T
+
/* Platform supports new BSD inet_addr len field. */
#define ACE_HAS_SOCKADDR_IN_SIN_LEN
+
/* OS/compiler uses size_t * rather than int * for socket lengths */
#define ACE_HAS_SIZET_SOCKET_LEN
+
/* Compiler/platform provides the sys/sockio.h file */
#define ACE_HAS_SYS_SOCKIO_H
+
/* Compiler supports the ssize_t typedef */
#define ACE_HAS_SSIZE_T
+
/* Platform supports UNIX International Threads */
#define ACE_HAS_STHREADS
+
/* Platform has thr_yield() */
#define ACE_HAS_THR_YIELD
+
/* Platform/compiler supports Standard C++ Library */
/* It seems that UDK provides std-like declarations for only portions
such as <exception>
*/
#define ACE_HAS_STANDARD_CPP_LIBRARY 0
+
/* Compiler/platform supports struct strbuf */
#define ACE_HAS_STRBUF_T
+
/* Platform supports STREAMS */
#define ACE_HAS_STREAMS
+
/* Platform supports STREAM pipes */
#define ACE_HAS_STREAM_PIPES
+
/* Compiler/platform supports strerror () */
#define ACE_HAS_STRERROR
+
/* Platform/Compiler supports a String class (e.g., GNU or Win32). */
#define ACE_HAS_STRING_CLASS
+
/* Platform has <strings.h> (which contains bzero() prototype) */
#define ACE_HAS_STRINGS
+
/* Platform/compiler supports void * as second parameter to gettimeofday(). */
#define ACE_HAS_VOIDPTR_GETTIMEOFDAY
+
/* Compiler/platform supports SVR4 dynamic linking semantics */
#define ACE_HAS_SVR4_DYNAMIC_LINKING
+
/* Compiler/platform supports SVR4 TLI (in particular, T_GETNAME stuff)... */
#define ACE_HAS_SVR4_TLI
+
/* Compiler/platform contains the <sys/syscall.h> file. */
#define ACE_HAS_SYS_SYSCALL_H
+
/* Platform supports system configuration information */
#define ACE_HAS_SYS_SYSTEMINFO_H
#define ACE_HAS_SYSINFO 1
+
/* Platform supports System V IPC (most versions of UNIX, but not Win32) */
#define ACE_HAS_SYSV_IPC 1
+
/* Platform provides <sys/filio.h> header */
#define ACE_HAS_SYS_FILIO_H 1
+
/* Platform provides <sys/xti.h> header */
#define ACE_HAS_SYS_XTI_H 1
+
/* Compiler implements templates that support typedefs inside of classes used
as formal arguments to a template class. */
#define ACE_HAS_TEMPLATE_TYPEDEFS 1
+
/* Platform has POSIX terminal interface. */
#define ACE_HAS_TERMIOS 1
+
/* Platform supports threads */
#define ACE_HAS_THREADS 1
+
/* Compiler/platform has thread-specific storage */
#define ACE_HAS_THREAD_SPECIFIC_STORAGE 1
+
/* Platform supports TLI timod STREAMS module */
#define ACE_HAS_TIMOD_H 1
+
/* Platform supports TLI tiuser header */
#define ACE_HAS_TIUSER_H 1
+
/* Platform supports TLI. Also see ACE_TLI_TCP_DEVICE. */
#define ACE_HAS_TLI 1
+
/* Platform provides TLI function prototypes */
#define ACE_HAS_TLI_PROTOTYPES 1
+
/* Platform supports ualarm() */
#define ACE_HAS_UALARM 1
+
/* Platform supports ucontext_t (which is used in the extended signal API). */
#define ACE_HAS_UCONTEXT_T 1
+
/* Platform has <utime.h> header file */
#define ACE_HAS_UTIME 1
+
/* Prints out console message in ACE_NOTSUP. Useful for tracking down origin
of ACE_NOTSUP. */
/* #undef ACE_HAS_VERBOSE_NOTSUP */
+
/* Platform requires void * for mmap(). */
#define ACE_HAS_VOIDPTR_MMAP 1
+
/* Platform has XTI (X/Open-standardized superset of TLI). Implies
ACE_HAS_TLI but uses a different header file. */
#define ACE_HAS_XTI 1
+
/* Platform can not build ace/IOStream{,_T}.cpp. This does not necessarily
mean that the platform does not support iostreams. */
#define ACE_LACKS_ACE_IOSTREAM 1
+
/* Platform does not have u_longlong_t typedef */
#define ACE_LACKS_U_LONGLONG_T 1
+
/* Platform lacks madvise() (e.g., Linux) */
#define ACE_LACKS_MADVISE 1
+
/* Platform lacks pri_t (e.g., Tandem NonStop UNIX). */
#define ACE_LACKS_PRI_T 1
+
/* Platform lacks pthread_thr_sigsetmask (e.g., MVS, HP/UX, and OSF/1 3.2) */
#define ACE_LACKS_PTHREAD_THR_SIGSETMASK 1
+
/* Platfrom lack pthread_yield() support. */
#define ACE_LACKS_PTHREAD_YIELD 1
+
/* Platform lacks readers/writer locks. */
#define ACE_LACKS_RWLOCK_T 1
+
/* MIT pthreads platform lacks the timedwait prototypes */
#define ACE_LACKS_TIMEDWAIT_PROTOTYPES 1
+
/* Platform does not define timepec_t as a typedef for struct timespec. */
#define ACE_LACKS_TIMESPEC_T 1
+
/* Compile using multi-thread libraries */
#define ACE_MT_SAFE 1
+
/* Platform needs to #include <sched.h> to get thread scheduling defs. */
#define ACE_NEEDS_SCHED_H 1
+
/* The OS/platform supports the poll() event demultiplexor */
#define ACE_USE_POLL 1
+
/* Platform has its standard c++ library in the namespace std. */
#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1
+
/* The number of bytes in a double. */
#define SIZEOF_DOUBLE 8
+
/* The number of bytes in a float. */
#define SIZEOF_FLOAT 4
+
/* The number of bytes in a int. */
#define SIZEOF_INT 4
+
/* The number of bytes in a long. */
#define SIZEOF_LONG 4
+
/* The number of bytes in a long double. */
#define SIZEOF_LONG_DOUBLE 12
+
/* The number of bytes in a long long. */
#define SIZEOF_LONG_LONG 8
+
/* The number of bytes in a short. */
#define SIZEOF_SHORT 2
+
/* The number of bytes in a signed char. */
#define SIZEOF_SIGNED_CHAR 1
+
/* The number of bytes in a void *. */
#define SIZEOF_VOID_P 4
+
/* Define if you have the execv function. */
#define HAVE_EXECV 1
+
/* Define if you have the execve function. */
#define HAVE_EXECVE 1
+
/* Define if you have the execvp function. */
#define HAVE_EXECVP 1
+
/* Define if you have the <dirent.h> header file. */
#define HAVE_DIRENT_H 1
+
/* Define if you have the <fstream> header file. */
#define HAVE_FSTREAM 1
+
/* Define if you have the <iomanip> header file. */
#define HAVE_IOMANIP 1
+
/* Define if you have the <iostream> header file. */
#define HAVE_IOSTREAM 1
+
/* Define if you have the <pwd.h> header file. */
#define HAVE_PWD_H 1
+
/* Name of package */
#define PACKAGE "ace"
+
/* Version number of package */
#define VERSION "4.6.37"
+
/* Added by Staller */
#define ENUM_BOOLEAN // See file /usr/local/lib/gcc-lib/i486-pc-sysv5/egcs-2.91.60/include/sys/types.h
/* Hat nix gebracht
@@ -326,6 +455,7 @@
#if !defined (__USLC__)
# define __USLC__ 1
#endif
+
#define __IOCTL_VERSIONED__ // By Carlo!
#endif /* ACE_UNIXWARE_UDK_H */
diff --git a/dep/ACE_wrappers/ace/config-visualage.h b/dep/ACE_wrappers/ace/config-visualage.h
index 8c6baa29996..6d967b52217 100644
--- a/dep/ACE_wrappers/ace/config-visualage.h
+++ b/dep/ACE_wrappers/ace/config-visualage.h
@@ -1,10 +1,13 @@
/* -*- C++ -*- */
// $Id: config-visualage.h 80826 2008-03-04 14:51:23Z wotte $
+
// This configuration file automatically includes the proper
// configurations for IBM's VisualAge C++ compiler on Win32 and AIX.
+
#ifndef CONFIG_VISUALAGE_H
#define CONFIG_VISUALAGE_H
#include /**/ "ace/pre.h"
+
#ifdef __TOS_WIN__
#include "ace/config-win32.h"
#elif __TOS_AIX__
@@ -12,6 +15,7 @@
#else
#include "PLATFORM NOT SPECIFIED"
#endif /* __TOS_WIN__ */
+
#include /**/ "ace/post.h"
#endif //CONFIG_VISUALAGE_H
diff --git a/dep/ACE_wrappers/ace/config-vxworks.h b/dep/ACE_wrappers/ace/config-vxworks.h
index f856c805280..52c2958654d 100644
--- a/dep/ACE_wrappers/ace/config-vxworks.h
+++ b/dep/ACE_wrappers/ace/config-vxworks.h
@@ -1,10 +1,13 @@
//* -*- C++ -*- */
// $Id: config-vxworks.h 81046 2008-03-21 10:11:12Z johnnyw $
+
// The following configuration file is designed to work for VxWorks
// Based on ACE_VXWORKS it will select the correct config file
+
#ifndef ACE_CONFIG_VXWORKS_H
#define ACE_CONFIG_VXWORKS_H
#include /**/ "ace/pre.h"
+
// If ACE_VXWORKS is not defined try to figure out the VxWorks version
#if !defined (ACE_VXWORKS)
# include "vxWorks.h"
@@ -30,6 +33,7 @@
# endif
# endif
#endif /* ! ACE_VXWORKS */
+
#if (ACE_VXWORKS == 0x551)
# include "ace/config-vxworks5.x.h"
#elif (ACE_VXWORKS == 0x620)
@@ -45,6 +49,8 @@
#else
#error Unknown VxWorks version
#endif
+
#include /**/ "ace/post.h"
#endif /* ACE_CONFIG_VXWORKS_H */
+
diff --git a/dep/ACE_wrappers/ace/config-vxworks5.x.h b/dep/ACE_wrappers/ace/config-vxworks5.x.h
index d5c2dcf98b3..eeb22490090 100644
--- a/dep/ACE_wrappers/ace/config-vxworks5.x.h
+++ b/dep/ACE_wrappers/ace/config-vxworks5.x.h
@@ -1,34 +1,45 @@
/* -*- C++ -*- */
// $Id: config-vxworks5.x.h 81850 2008-06-06 08:39:54Z vzykov $
+
// The following configuration file is designed to work for VxWorks
// 5.5.x platforms using one of these compilers:
// 1) The GNU g++ compiler that is shipped with Tornado 2.2 or newer.
// 2) The Green Hills 1.8.8 and newer 1.8.9 compilers (not tested
// already for a long time)
// 3) The WindRiver Compiler (formerly known as Diab)
+
#ifndef ACE_CONFIG_H
#define ACE_CONFIG_H
#include /**/ "ace/pre.h"
+
#if ! defined (VXWORKS)
# define VXWORKS
#endif /* ! VXWORKS */
+
#if ! defined (ACE_VXWORKS)
# define ACE_VXWORKS 0x551
#endif /* ! ACE_VXWORKS */
+
#if ! defined (__ACE_INLINE__)
# define __ACE_INLINE__
#endif /* ! __ACE_INLINE__ */
+
// Compiler-specific configuration.
#if defined (__GNUG__)
# include "ace/config-g++-common.h"
+
# define ACE_LACKS_IOSTREAM_FX
+
# if !defined (ACE_MAIN)
# define ACE_MAIN ace_main
# endif /* ! ACE_MAIN */
+
# define ACE_LACKS_LINEBUFFERED_STREAMBUF
+
# if (__GNUC__ == 2)
# define ACE_CDR_IMPLEMENT_WITH_NATIVE_DOUBLE 1
# endif
+
# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
// GNU 3.3+ toolchain supports long long types but fails to define this so STL
// skips some definitions
@@ -36,37 +47,47 @@
# define _GLIBCPP_USE_LONG_LONG
# endif
# endif /* (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) */
+
#elif defined (ghs)
// Processor type, if necessary. Green Hills defines "ppc".
# if defined (ppc)
# define ACE_HAS_POWERPC_TIMER
# define ACE_LACKS_CLEARERR
# endif /* ppc */
+
# define ACE_CONFIG_INCLUDE_GHS_COMMON
# include "ace/config-ghs-common.h"
+
# define ACE_LACKS_UNISTD_H
# define ACE_LACKS_IOSTREAM_TOTALLY
+
// Short-circuit the include of <arpa/inet.h>
// Green Hills has a problem with multiply defined functions
// with different parameters.
# define __INCineth
+
#elif defined (__DCPLUSPLUS__) || defined (__DCC__)
// Diab 4.2a or later.
# if !defined (ACE_LACKS_PRAGMA_ONCE)
// We define it with a -D with make depend.
# define ACE_LACKS_PRAGMA_ONCE
# endif /* ! ACE_LACKS_PRAGMA_ONCE */
+
// Diab doesn't support VxWorks' iostream libraries.
# define ACE_LACKS_IOSTREAM_TOTALLY
# define ACE_LACKS_ACE_IOSTREAM
+
# define ACE_HAS_STANDARD_CPP_LIBRARY 1
# define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 0
+
# define ACE_TEMPLATES_REQUIRE_SOURCE
+
#else /* ! __GNUG__ && ! ghs && !__DCC__ */
# ifdef __cplusplus /* Let it slide for C compilers. */
# error unsupported compiler on VxWorks
# endif /* __cplusplus */
#endif /* ! __GNUG__ && ! ghs */
+
// OS-specific configuration
#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG
#define ACE_HAS_SIZET_PTR_ASCTIME_R_AND_CTIME_R
@@ -183,6 +204,7 @@
#if !defined (ACE_VXWORKS_SPARE)
# define ACE_VXWORKS_SPARE spare4
#endif /* ! ACE_VXWORKS_SPARE */
+
#define ACE_LACKS_SETEGID
#define ACE_LACKS_SETPGID
#define ACE_LACKS_SETREGID
@@ -196,6 +218,7 @@
#define ACE_LACKS_GETUID
#define ACE_LACKS_SETGID
#define ACE_LACKS_GETPGID
+
#define ACE_LACKS_PIPE
#define ACE_LACKS_STDINT_H
#define ACE_LACKS_INTTYPES_H
@@ -217,8 +240,10 @@
#define ACE_LACKS_TERMIOS_H
#define ACE_LACKS_POLL_H
#define ACE_LACKS_WCTYPE_H
+
// Not sure if these should always be defined.
#define ACE_LACKS_SYS_UN_H
+
// Some string things
#define ACE_LACKS_WCSCAT
#define ACE_LACKS_WCSCHR
@@ -245,16 +270,20 @@
#define ACE_LACKS_WCSDUP
#define ACE_LACKS_STRTOULL
#define ACE_LACKS_WCSTOULL
+
#define ACE_LACKS_SYMLINKS
#define ACE_LACKS_FGETWC
#define ACE_LACKS_FGETWS
#define ACE_LACKS_FPUTWS
+
#if defined (ACE_HAS_VXWORKS551_PID) || (ACE_HAS_VXWORKS551_PCD) || (ACE_HAS_VXWORKS551_PNE)
# define ACE_HAS_VXWORKS551_MEDUSA
#endif
+
#if defined (ACE_HAS_VXWORKS551_MEDUSA)
# define ACE_HAS_GETIFADDRS
#endif
+
// It is possible to enable pthread support with VxWorks, when the user decides
// to use this, we need some more defines
#if defined ACE_HAS_PTHREADS
@@ -279,9 +308,11 @@
#define ACE_HAS_MUTEX_TIMEOUTS
#define ACE_HAS_TSS_EMULATION
#endif
+
#if !defined (ACE_MT_SAFE)
# define ACE_MT_SAFE 1
#endif
+
// Needed include to get all VxWorks CPU types
#include "types/vxCpu.h"
#if (CPU == PENTIUM || CPU == PENTIUM2 || CPU == PENTIUM3 || CPU == PENTIUM4)
@@ -289,22 +320,27 @@
// ACE_OS::gethrtime () can use the RDTSC instruction.
# define ACE_HAS_PENTIUM
#endif
+
# if defined (TOOL) && (TOOL == gnu)
# if defined (CPU) && (CPU == PPC85XX || CPU == PPC604 || CPU == PPC603)
// These PPC's do lack log2
# define ACE_LACKS_LOG2
# endif
# endif
+
#if !defined (ACE_NEEDS_HUGE_THREAD_STACKSIZE)
# define ACE_NEEDS_HUGE_THREAD_STACKSIZE 65536
#endif /* ACE_NEEDS_HUGE_THREAD_STACKSIZE */
+
#if !defined (ACE_NTRACE)
# define ACE_NTRACE 1
#endif /* ACE_NTRACE */
+
// By default, don't include RCS Id strings in object code.
#if !defined (ACE_USE_RCSID)
#define ACE_USE_RCSID 0
#endif /* !ACE_USE_RCSID */
+
#include /**/ "ace/post.h"
#endif /* ACE_CONFIG_H */
diff --git a/dep/ACE_wrappers/ace/config-vxworks6.2.h b/dep/ACE_wrappers/ace/config-vxworks6.2.h
index d4717fd1749..f7978b0036e 100644
--- a/dep/ACE_wrappers/ace/config-vxworks6.2.h
+++ b/dep/ACE_wrappers/ace/config-vxworks6.2.h
@@ -1,33 +1,43 @@
/* -*- C++ -*- */
// $Id: config-vxworks6.2.h 81850 2008-06-06 08:39:54Z vzykov $
+
// The following configuration file is designed to work for VxWorks
// 6.2 platforms using one of these compilers:
// 1) The GNU g++ compiler that is shipped with VxWorks 6.2
+
#ifndef ACE_CONFIG_VXWORKS_6_2_H
#define ACE_CONFIG_VXWORKS_6_2_H
#include /**/ "ace/pre.h"
+
#if ! defined (VXWORKS)
# define VXWORKS
#endif /* ! VXWORKS */
+
#if ! defined (ACE_VXWORKS)
# define ACE_VXWORKS 0x620
#endif /* ! ACE_VXWORKS */
+
#if defined __RTP__
// Fix wrong typedef in unistd.h (unsigned short)
#define _SUSECONDS_T
typedef long suseconds_t;
#endif
#include <unistd.h>
+
// Fix for including right typedef for pid_t in VxTypes.h (int)
#include <vxWorksCommon.h>
+
#if ! defined (__ACE_INLINE__)
# define __ACE_INLINE__
#endif /* ! __ACE_INLINE__ */
+
// Compiler-specific configuration.
#if defined (__GNUG__)
# include "ace/config-g++-common.h"
+
# define ACE_LACKS_IOSTREAM_FX
# define ACE_LACKS_LINEBUFFERED_STREAMBUF
+
# if defined (__RTP__) && !defined (_HAS_C9X)
// Workaround for the fact that under RTP the log2 method can't be used
// without this define set, see TSR560446
@@ -35,20 +45,24 @@
# define _C99
# endif
# endif
+
#elif defined (__DCPLUSPLUS__) || defined (__DCC__)
// Diab 4.2a or later.
# if !defined (ACE_LACKS_PRAGMA_ONCE)
// We define it with a -D with make depend.
# define ACE_LACKS_PRAGMA_ONCE
# endif /* ! ACE_LACKS_PRAGMA_ONCE */
+
# define ACE_HAS_STANDARD_CPP_LIBRARY 1
# define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1
# define ACE_TEMPLATES_REQUIRE_SOURCE
+
#else /* ! __GNUG__ && ! ghs && !__DCC__ */
# ifdef __cplusplus /* Let it slide for C compilers. */
# error unsupported compiler on VxWorks
# endif /* __cplusplus */
#endif /* ! __GNUG__ && ! ghs */
+
#if !defined __RTP__
# if defined (TOOL) && (TOOL == gnu)
# if defined (CPU) && (CPU == PPC85XX || CPU == PPC604 || CPU == PPC603)
@@ -57,6 +71,7 @@
# endif
# endif
#endif
+
// OS-specific configuration
#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG
#define ACE_HAS_NONCONST_GETBY
@@ -146,6 +161,7 @@
# define ACE_VXWORKS_SPARE spare4
#endif /* ! ACE_VXWORKS_SPARE */
#define ACE_HAS_GETIFADDRS
+
#define ACE_LACKS_SETEGID
#define ACE_LACKS_SETPGID
#define ACE_LACKS_SETREGID
@@ -159,6 +175,7 @@
#define ACE_LACKS_GETEGID
#define ACE_LACKS_GETGID
#define ACE_LACKS_SETGID
+
#define ACE_LACKS_SYS_UIO_H
#define ACE_LACKS_SYS_IPC_H
#define ACE_LACKS_SYS_SEM_H
@@ -169,6 +186,7 @@
#define ACE_LACKS_TERMIOS_H
#define ACE_LACKS_POLL_H
#define ACE_LACKS_FCNTL
+
// Some string things
#define ACE_LACKS_STRCASECMP
#define ACE_LACKS_ITOW
@@ -177,8 +195,10 @@
#define ACE_LACKS_WCSNICMP
#define ACE_LACKS_STRTOULL
#define ACE_LACKS_WCSTOULL
+
#define ACE_HAS_CHARPTR_SOCKOPT
#define ACE_LACKS_SYMLINKS
+
#if defined __RTP__
// We are building for RTP mode
#if !defined (ACE_AS_STATIC_LIBS)
@@ -241,6 +261,7 @@
# define ACE_MAIN ace_main
#endif /* ! ACE_MAIN */
#endif
+
// It is possible to enable pthread support with VxWorks, when the user decides
// to use this, we need some more defines
#if defined ACE_HAS_PTHREADS
@@ -267,9 +288,11 @@
# define ACE_LACKS_COND_T
# define ACE_HAS_MUTEX_TIMEOUTS
#endif
+
#if !defined (ACE_MT_SAFE)
# define ACE_MT_SAFE 1
#endif
+
// Needed include to get all VxWorks CPU types
#include "types/vxCpu.h"
#if (CPU == PENTIUM || CPU == PENTIUM2 || CPU == PENTIUM3 || CPU == PENTIUM4)
@@ -277,24 +300,30 @@
// ACE_OS::gethrtime () can use the RDTSC instruction.
# define ACE_HAS_PENTIUM
#endif
+
// VxWorks defines the CPU define MAP, undef it to prevent problems with
// application code
#if defined (MAP)
#undef MAP
#endif /* MAP */
+
#if !defined (ACE_NEEDS_HUGE_THREAD_STACKSIZE)
# define ACE_NEEDS_HUGE_THREAD_STACKSIZE 65536
#endif /* ACE_NEEDS_HUGE_THREAD_STACKSIZE */
+
#if !defined (ACE_NTRACE)
# define ACE_NTRACE 1
#endif /* ACE_NTRACE */
+
// By default, don't include RCS Id strings in object code.
#if !defined (ACE_USE_RCSID)
#define ACE_USE_RCSID 0
#endif /* !ACE_USE_RCSID */
+
#if defined (ACE_HAS_IP_MULTICAST)
# define ACE_LACKS_PERFECT_MULTICAST_FILTERING 1
#endif /* ACE_HAS_IP_MULTICAST */
+
#include /**/ "ace/post.h"
#endif /* ACE_CONFIG_VXWORKS_6_2_H */
diff --git a/dep/ACE_wrappers/ace/config-vxworks6.3.h b/dep/ACE_wrappers/ace/config-vxworks6.3.h
index c383ef5d023..fe90626e3dc 100644
--- a/dep/ACE_wrappers/ace/config-vxworks6.3.h
+++ b/dep/ACE_wrappers/ace/config-vxworks6.3.h
@@ -1,25 +1,33 @@
/* -*- C++ -*- */
// $Id: config-vxworks6.3.h 81850 2008-06-06 08:39:54Z vzykov $
+
// The following configuration file is designed to work for VxWorks
// 6.3 platforms using one of these compilers:
// 1) The GNU g++ compiler that is shipped with VxWorks 6.3
+
#ifndef ACE_CONFIG_VXWORKS_6_3_H
#define ACE_CONFIG_VXWORKS_6_3_H
#include /**/ "ace/pre.h"
+
#if ! defined (VXWORKS)
# define VXWORKS
#endif /* ! VXWORKS */
+
#if ! defined (ACE_VXWORKS)
# define ACE_VXWORKS 0x630
#endif /* ! ACE_VXWORKS */
+
#if ! defined (__ACE_INLINE__)
# define __ACE_INLINE__
#endif /* ! __ACE_INLINE__ */
+
// Compiler-specific configuration.
#if defined (__GNUG__)
# include "ace/config-g++-common.h"
+
# define ACE_LACKS_IOSTREAM_FX
# define ACE_LACKS_LINEBUFFERED_STREAMBUF
+
# if defined (__RTP__) && !defined (_HAS_C9X)
// Workaround for the fact that under RTP the log2 method can't be used
// without this define set, see TSR560446
@@ -27,6 +35,7 @@
# define _C99
# endif
# endif
+
#elif defined (__DCC__)
# define ACE_HAS_STANDARD_CPP_LIBRARY 1
# define ACE_TEMPLATES_REQUIRE_SOURCE
@@ -35,6 +44,7 @@
# error unsupported compiler on VxWorks
# endif /* __cplusplus */
#endif /* ! __GNUG__ && ! ghs */
+
#if !defined __RTP__
# if defined (TOOL) && (TOOL == gnu)
# if defined (CPU) && (CPU == PPC85XX || CPU == PPC604 || CPU == PPC603)
@@ -43,6 +53,7 @@
# endif
# endif
#endif
+
// OS-specific configuration
#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG
#define ACE_HAS_NONCONST_GETBY
@@ -125,6 +136,7 @@
#define ACE_HAS_SIGTIMEDWAIT
#define ACE_HAS_SIGSUSPEND
#define ACE_HAS_GETIFADDRS
+
#define ACE_LACKS_SETEGID
#define ACE_LACKS_SETPGID
#define ACE_LACKS_SETREGID
@@ -138,6 +150,7 @@
#define ACE_LACKS_GETEGID
#define ACE_LACKS_GETGID
#define ACE_LACKS_SETGID
+
#define ACE_LACKS_SYS_UIO_H
#define ACE_LACKS_SYS_IPC_H
#define ACE_LACKS_SYS_SEM_H
@@ -148,6 +161,7 @@
#define ACE_LACKS_TERMIOS_H
#define ACE_LACKS_POLL_H
#define ACE_LACKS_FCNTL
+
// Some string things
#define ACE_LACKS_ITOW
#define ACE_LACKS_WCSDUP
@@ -155,8 +169,10 @@
#define ACE_LACKS_WCSNICMP
#define ACE_LACKS_STRTOULL
#define ACE_LACKS_WCSTOULL
+
#define ACE_HAS_CHARPTR_SOCKOPT
#define ACE_LACKS_SYMLINKS
+
#if defined __RTP__
// We are building for RTP mode
#if !defined (ACE_AS_STATIC_LIBS)
@@ -231,6 +247,7 @@
# define ACE_MAIN ace_main
#endif /* ! ACE_MAIN */
#endif
+
// It is possible to enable pthread support with VxWorks, when the user decides
// to use this, we need some more defines
#if defined ACE_HAS_PTHREADS
@@ -260,9 +277,11 @@
# define ACE_LACKS_COND_T
# define ACE_HAS_MUTEX_TIMEOUTS
#endif
+
#if !defined (ACE_MT_SAFE)
# define ACE_MT_SAFE 1
#endif
+
// Needed include to get all VxWorks CPU types
#include "types/vxCpu.h"
#if defined (CPU) && (CPU == PENTIUM || CPU == PENTIUM2 || CPU == PENTIUM3 || CPU == PENTIUM4)
@@ -270,24 +289,30 @@
// ACE_OS::gethrtime () can use the RDTSC instruction.
# define ACE_HAS_PENTIUM
#endif
+
// VxWorks defines the CPU define MAP, undef it to prevent problems with
// application code
#if defined (MAP)
#undef MAP
#endif /* MAP */
+
#if !defined (ACE_NEEDS_HUGE_THREAD_STACKSIZE)
# define ACE_NEEDS_HUGE_THREAD_STACKSIZE 65536
#endif /* ACE_NEEDS_HUGE_THREAD_STACKSIZE */
+
#if !defined (ACE_NTRACE)
# define ACE_NTRACE 1
#endif /* ACE_NTRACE */
+
// By default, don't include RCS Id strings in object code.
#if !defined (ACE_USE_RCSID)
#define ACE_USE_RCSID 0
#endif /* !ACE_USE_RCSID */
+
#if defined (ACE_HAS_IP_MULTICAST)
# define ACE_LACKS_PERFECT_MULTICAST_FILTERING 1
#endif /* ACE_HAS_IP_MULTICAST */
+
#include /**/ "ace/post.h"
#endif /* ACE_CONFIG_VXWORKS_6_3_H */
diff --git a/dep/ACE_wrappers/ace/config-vxworks6.4.h b/dep/ACE_wrappers/ace/config-vxworks6.4.h
index 6b80a57961b..80c28ab624c 100644
--- a/dep/ACE_wrappers/ace/config-vxworks6.4.h
+++ b/dep/ACE_wrappers/ace/config-vxworks6.4.h
@@ -1,18 +1,23 @@
//* -*- C++ -*- */
// $Id: config-vxworks6.4.h 81850 2008-06-06 08:39:54Z vzykov $
+
// The following configuration file is designed to work for VxWorks
// 6.4 platforms using one of these compilers:
// 1) The GNU g++ compiler that is shipped with VxWorks 6.4
// 2) The Diab compiler that is shipped with VxWorks 6.4
+
#ifndef ACE_CONFIG_VXWORKS_6_4_H
#define ACE_CONFIG_VXWORKS_6_4_H
#include /**/ "ace/pre.h"
+
#if ! defined (VXWORKS)
# define VXWORKS
#endif /* ! VXWORKS */
+
#if ! defined (ACE_VXWORKS)
# define ACE_VXWORKS 0x640
#endif /* ! ACE_VXWORKS */
+
#if !defined (__RTP__)
// Fix for wrong typedef of time_t in kernel mode
#ifndef _TIME_T
@@ -20,14 +25,18 @@
typedef long time_t;
#endif
#endif
+
#if ! defined (__ACE_INLINE__)
# define __ACE_INLINE__
#endif /* ! __ACE_INLINE__ */
+
// Compiler-specific configuration.
#if defined (__GNUG__)
# include "ace/config-g++-common.h"
+
# define ACE_LACKS_IOSTREAM_FX
# define ACE_LACKS_LINEBUFFERED_STREAMBUF
+
# if defined (__RTP__) && !defined (_HAS_C9X)
// Workaround for the fact that under RTP the log2 method can't be used
// without this define set, see TSR560446
@@ -35,6 +44,7 @@
# define _C99
# endif
# endif
+
#elif defined (__DCC__)
# define ACE_HAS_STANDARD_CPP_LIBRARY 1
# define ACE_TEMPLATES_REQUIRE_SOURCE
@@ -43,6 +53,7 @@
# error unsupported compiler on VxWorks
# endif /* __cplusplus */
#endif /* ! __GNUG__ && ! ghs */
+
// Needed include to get all VxWorks CPU types
#include "types/vxCpu.h"
#if defined __RTP__
@@ -58,6 +69,7 @@
# define ACE_HAS_PENTIUM
#endif
#endif
+
#if !defined __RTP__
# if defined (TOOL) && (TOOL == gnu)
# if defined (CPU) && (CPU == PPC85XX || CPU == PPC604 || CPU == PPC603)
@@ -66,6 +78,7 @@
# endif
# endif
#endif
+
// OS-specific configuration
#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG
#define ACE_HAS_3_PARAM_READDIR_R
@@ -148,6 +161,7 @@
#define ACE_HAS_SIGTIMEDWAIT
#define ACE_HAS_SIGSUSPEND
#define ACE_HAS_GETIFADDRS
+
#define ACE_LACKS_SETEGID
#define ACE_LACKS_SETPGID
#define ACE_LACKS_SETREGID
@@ -161,6 +175,7 @@
#define ACE_LACKS_GETEGID
#define ACE_LACKS_GETGID
#define ACE_LACKS_SETGID
+
#define ACE_LACKS_SYS_UIO_H
#define ACE_LACKS_SYS_IPC_H
#define ACE_LACKS_SYS_SEM_H
@@ -171,6 +186,7 @@
#define ACE_LACKS_TERMIOS_H
#define ACE_LACKS_POLL_H
#define ACE_LACKS_FCNTL
+
// Some string things
#define ACE_LACKS_ITOW
#define ACE_LACKS_WCSDUP
@@ -178,8 +194,10 @@
#define ACE_LACKS_WCSNICMP
#define ACE_LACKS_STRTOULL
#define ACE_LACKS_WCSTOULL
+
#define ACE_HAS_CHARPTR_SOCKOPT
#define ACE_LACKS_SYMLINKS
+
#if defined __RTP__
// We are building for RTP mode
#if !defined (ACE_AS_STATIC_LIBS)
@@ -256,6 +274,7 @@
# define ACE_MAIN ace_main
#endif /* ! ACE_MAIN */
#endif
+
// It is possible to enable pthread support with VxWorks, when the user decides
// to use this, we need some more defines
#if defined ACE_HAS_PTHREADS
@@ -289,27 +308,34 @@
# define ACE_LACKS_COND_T
# define ACE_HAS_MUTEX_TIMEOUTS
#endif
+
#if !defined (ACE_MT_SAFE)
# define ACE_MT_SAFE 1
#endif
+
// VxWorks defines the CPU define MAP, undef it to prevent problems with
// application code
#if defined (MAP)
#undef MAP
#endif /* MAP */
+
#if !defined (ACE_NEEDS_HUGE_THREAD_STACKSIZE)
# define ACE_NEEDS_HUGE_THREAD_STACKSIZE 65536
#endif /* ACE_NEEDS_HUGE_THREAD_STACKSIZE */
+
#if !defined (ACE_NTRACE)
# define ACE_NTRACE 1
#endif /* ACE_NTRACE */
+
// By default, don't include RCS Id strings in object code.
#if !defined (ACE_USE_RCSID)
#define ACE_USE_RCSID 0
#endif /* !ACE_USE_RCSID */
+
#if defined (ACE_HAS_IP_MULTICAST)
# define ACE_LACKS_PERFECT_MULTICAST_FILTERING 1
#endif /* ACE_HAS_IP_MULTICAST */
+
#include /**/ "ace/post.h"
#endif /* ACE_CONFIG_VXWORKS_6_4_H */
diff --git a/dep/ACE_wrappers/ace/config-vxworks6.5.h b/dep/ACE_wrappers/ace/config-vxworks6.5.h
index 1b9b0910b5f..d40f695774c 100644
--- a/dep/ACE_wrappers/ace/config-vxworks6.5.h
+++ b/dep/ACE_wrappers/ace/config-vxworks6.5.h
@@ -1,19 +1,26 @@
//* -*- C++ -*- */
// $Id: config-vxworks6.5.h 80826 2008-03-04 14:51:23Z wotte $
+
// The following configuration file is designed to work for VxWorks
// 6.5 platforms using one of these compilers:
// 1) The GNU g++ compiler that is shipped with VxWorks 6.5
// 2) The Diab compiler that is shipped with VxWorks 6.5
+
#ifndef ACE_CONFIG_VXWORKS_6_5_H
#define ACE_CONFIG_VXWORKS_6_5_H
#include /**/ "ace/pre.h"
+
#if !defined (ACE_VXWORKS)
# define ACE_VXWORKS 0x650
#endif /* ! ACE_VXWORKS */
+
#include "ace/config-vxworks6.4.h"
+
#if defined (__RTP__)
# undef ACE_HAS_GETIFADDRS
#endif
+
#include /**/ "ace/post.h"
#endif /* ACE_CONFIG_VXWORKS_6_5_H */
+
diff --git a/dep/ACE_wrappers/ace/config-vxworks6.6.h b/dep/ACE_wrappers/ace/config-vxworks6.6.h
index 047a373f8a8..a2058aa51c3 100644
--- a/dep/ACE_wrappers/ace/config-vxworks6.6.h
+++ b/dep/ACE_wrappers/ace/config-vxworks6.6.h
@@ -1,22 +1,30 @@
//* -*- C++ -*- */
// $Id: config-vxworks6.6.h 80826 2008-03-04 14:51:23Z wotte $
+
// The following configuration file is designed to work for VxWorks
// 6.6 platforms using one of these compilers:
// 1) The GNU g++ compiler that is shipped with VxWorks 6.6
// 2) The Diab compiler that is shipped with VxWorks 6.6
+
#ifndef ACE_CONFIG_VXWORKS_6_6_H
#define ACE_CONFIG_VXWORKS_6_6_H
#include /**/ "ace/pre.h"
+
#if !defined (ACE_VXWORKS)
# define ACE_VXWORKS 0x660
#endif /* ! ACE_VXWORKS */
+
#include "ace/config-vxworks6.5.h"
+
#if defined (ACE_HAS_PENTIUM)
# define ACE_LACKS_LOG2
#endif
+
#if !defined (__RTP__)
# undef ACE_HAS_IOCTL_INT_3_PARAM
#endif
+
#include /**/ "ace/post.h"
#endif /* ACE_CONFIG_VXWORKS_6_6_H */
+
diff --git a/dep/ACE_wrappers/ace/config-win32-borland.h b/dep/ACE_wrappers/ace/config-win32-borland.h
index e8acd200c4b..371919cfdc4 100644
--- a/dep/ACE_wrappers/ace/config-win32-borland.h
+++ b/dep/ACE_wrappers/ace/config-win32-borland.h
@@ -1,35 +1,48 @@
// -*- C++ -*-
//$Id: config-win32-borland.h 82643 2008-08-19 14:02:12Z johnnyw $
+
// The following configuration file contains defines for Borland compilers.
+
#ifndef ACE_CONFIG_WIN32_BORLAND_H
#define ACE_CONFIG_WIN32_BORLAND_H
#include /**/ "ace/pre.h"
+
#ifndef ACE_CONFIG_WIN32_H
#error Use config-win32.h in config.h instead of this header
#endif /* ACE_CONFIG_WIN32_H */
+
#include "config-borland-common.h"
+
// Automatically define WIN32 macro if the compiler tells us it is our
// target platform.
# if defined (__WIN32__) && !defined (WIN32)
# define WIN32 1
# endif
+
// When building a VCL application, the main VCL header file should be
// included before anything else. You can define ACE_HAS_VCL=1 in your
// project settings to have this file included for you automatically.
# if defined (ACE_HAS_VCL) && (ACE_HAS_VCL != 0)
# include /**/ <vcl.h>
# endif
+
# define ACE_CC_PREPROCESSOR "CPP32.EXE"
+
# include "ace/config-win32-common.h"
+
// Borland on win32 has swab
# undef ACE_LACKS_SWAB
+
# define ACE_WSTRING_HAS_USHORT_SUPPORT 1
# define ACE_HAS_DIRENT
+
#ifdef ACE_USES_STD_NAMESPACE_FOR_STDC_LIB
#undef ACE_USES_STD_NAMESPACE_FOR_STDC_LIB
#define ACE_USES_STD_NAMESPACE_FOR_STDC_LIB 1
#endif
+
#define ACE_NEEDS_DL_UNDERSCORE
+
#define ACE_LACKS_TERMIOS_H
#define ACE_LACKS_NETINET_TCP_H
#define ACE_LACKS_REGEX_H
@@ -56,17 +69,21 @@
#define ACE_LACKS_SYS_SEM_H
#define ACE_LACKS_SYS_IOCTL_H
#define ACE_LACKS_STROPTS_H
+
#undef ACE_LACKS_STRUCT_DIR
#undef ACE_LACKS_CLOSEDIR
#undef ACE_LACKS_OPENDIR
#undef ACE_LACKS_READDIR
#undef ACE_LACKS_REWINDDIR
+
#define ACE_HAS_WOPENDIR
#define ACE_HAS_WCLOSEDIR
#define ACE_HAS_WREADDIR
#define ACE_HAS_WREWINDDIR
+
#define ACE_LACKS_STRRECVFD
#define ACE_USES_EXPLICIT_STD_NAMESPACE
+
#if defined(ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
// must have _MT defined to include multithreading
// features from win32 headers
@@ -77,16 +94,19 @@
# error You must link against multi-threaded libraries when using ACE (check your project settings)
# endif /* !_MT && !ACE_HAS_WINCE */
#endif /* ACE_MT_SAFE && ACE_MT_SAFE != 0 */
+
#if (__BORLANDC__ < 0x580)
# define ACE_LACKS_INTPTR_T
# define ACE_HAS_NONCONST_SWAB
# define ACE_HAS_NONCONST_FDOPEN
#endif
+
#if (__BORLANDC__ < 0x610)
# define ACE_HAS_NONCONST_TEMPNAM
# define ACE_LACKS_STRTOULL
# define ACE_LACKS_WCSTOULL
#endif
+
#if (__BORLANDC__ <= 0x610)
// Older Borland compilers can't handle assembly in inline methods or
// templates (E2211). When we build for pentium optimized and we are inlining
@@ -95,10 +115,12 @@
# define ACE_LACKS_INLINE_ASSEMBLY
# endif
#endif
+
#define ACE_WCSDUP_EQUIVALENT ::_wcsdup
#define ACE_STRCASECMP_EQUIVALENT ::stricmp
#define ACE_STRNCASECMP_EQUIVALENT ::strnicmp
#define ACE_HAS_ITOA 1
+
#include /**/ "ace/post.h"
#endif /* ACE_CONFIG_WIN32_BORLAND_H */
diff --git a/dep/ACE_wrappers/ace/config-win32-common.h b/dep/ACE_wrappers/ace/config-win32-common.h
index c59b1257f76..1abeccd4c54 100644
--- a/dep/ACE_wrappers/ace/config-win32-common.h
+++ b/dep/ACE_wrappers/ace/config-win32-common.h
@@ -1,26 +1,32 @@
/* -*- C++ -*- */
// $Id: config-win32-common.h 82316 2008-07-15 01:28:39Z johnnyw $
+
#ifndef ACE_CONFIG_WIN32_COMMON_H
#define ACE_CONFIG_WIN32_COMMON_H
#include /**/ "ace/pre.h"
+
#ifndef ACE_CONFIG_WIN32_H
#error Use config-win32.h in config.h instead of this header
#endif /* ACE_CONFIG_WIN32_H */
+
// Windows Mobile (CE) stuff is primarily further restrictions to what's
// in the rest of this file. Also, it defined ACE_HAS_WINCE, which is used
// in this file.
#if defined (_WIN32_WCE)
# include "ace/config-WinCE.h"
#endif /* _WIN32_WCE */
+
// Complain if WIN32 is not already defined.
#if !defined (WIN32) && !defined (ACE_HAS_WINCE)
# error Please define WIN32 in your project settings.
#endif
+
#define ACE_WIN32
#if defined (_WIN64) || defined (WIN64)
# define ACE_WIN64
+
// Use 64-bit file offsets by default in the WIN64 case, similar to
// what 64-bit UNIX systems do.
//
@@ -30,9 +36,11 @@
# define _FILE_OFFSET_BITS 64
# endif /* !_FILE_OFFSET_BITS */
#endif /* _WIN64 || WIN64 */
+
#if !defined (_WIN32_WINNT)
# define _WIN32_WINNT 0x0501 // pretend it's at least Windows XP or Win2003
#endif
+
// If the invoking procedure turned off debugging by setting NDEBUG, then
// also set ACE_NDEBUG, unless the user has already set it.
#if defined (NDEBUG)
@@ -40,6 +48,7 @@
# define ACE_NDEBUG
# endif /* ACE_NDEBUG */
#endif /* NDEBUG */
+
// Define ACE_HAS_MFC to 1, if you want ACE to use CWinThread. This should
// be defined, if your application uses MFC.
// Setting applies to : building ACE
@@ -50,6 +59,7 @@
#if !defined (ACE_HAS_MFC)
# define ACE_HAS_MFC 0
#endif
+
// ACE_USES_STATIC_MFC always implies ACE_HAS_MFC
#if defined (ACE_USES_STATIC_MFC)
# if defined (ACE_HAS_MFC)
@@ -57,6 +67,7 @@
# endif
# define ACE_HAS_MFC 1
#endif /* ACE_USES_STATIC_MFC */
+
// Define ACE_HAS_STRICT to 1 in your config.h file if you want to use
// STRICT type checking. It is disabled by default because it will
// break existing application code. However, if ACE_HAS_MFC is turned on,
@@ -66,11 +77,13 @@
#if !defined (ACE_HAS_STRICT)
# define ACE_HAS_STRICT 0
#endif
+
// MFC itself defines STRICT.
#if defined (ACE_HAS_MFC) && (ACE_HAS_MFC != 0)
# undef ACE_HAS_STRICT
# define ACE_HAS_STRICT 1
#endif
+
// Turn off the following define if you want to disable threading.
// Compile using multi-thread libraries.
// Setting applies to : building ACE, linking with ACE
@@ -78,6 +91,7 @@
#if !defined (ACE_MT_SAFE)
# define ACE_MT_SAFE 1
#endif
+
// Build ACE services as DLLs. If you write a library and want it to
// use ACE_Svc_Export, this will cause those macros to build dlls. If
// you want your ACE service to be a static library, comment out this
@@ -87,6 +101,7 @@
// #if !defined (ACE_SVC_HAS_DLL)
// # define ACE_SVC_HAS_DLL 1
// #endif
+
// Define the special export macros needed to export symbols outside a dll
#if !defined(__BORLANDC__)
#define ACE_HAS_CUSTOM_EXPORT_MACROS 1
@@ -97,11 +112,13 @@
#define ACE_IMPORT_SINGLETON_DECLARATION(T) extern template class T
#define ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) extern template class SINGLETON_TYPE <CLASS, LOCK>;
#endif /* !__BORLANDC__ */
+
// Define ACE_HAS_WINSOCK2 to 0 in your config.h file if you do *not*
// want to compile with WinSock 2.0.
// Setting applies to : building ACE
// Runtime restrictions: winsock2 must be installed.
// #define ACE_HAS_WINSOCK2 0
+
// By default, we use non-static object manager on Win32. That is,
// the object manager is allocated in main's stack memory. If this
// does not suit your need, i.e., if your programs depend on the use
@@ -134,25 +151,32 @@
#elif (ACE_HAS_NONSTATIC_OBJECT_MANAGER == 0)
# undef ACE_HAS_NONSTATIC_OBJECT_MANAGER
#endif /* ACE_HAS_NONSTATIC_OBJECT_MANAGER */
+
#define ACE_HAS_GPERF
+
// By default, don't include RCS Id strings in object code.
#if !defined (ACE_USE_RCSID)
# define ACE_USE_RCSID 0
#endif /* ! ACE_USE_RCSID */
+
// ---------------- platform features or lack of them -------------
+
// By default WIN32 has FD_SETSIZE of 64, which places the limit
// between 61 and 64 on the number of clients a server using the
// Select Reactor can support at the same time (i.e., 64 - standard in,
// out, error). Here we raise the limit to 1024. Adjust the definition
// below if you need to raise or lower it.
+
#if !defined (FD_SETSIZE)
#define FD_SETSIZE 1024
#endif /* FD_SETSIZE */
+
// Windows doesn't like 65536 ;-) If 65536 is specified, it is
// silently ignored by the OS, i.e., setsockopt does not fail, and you
// get stuck with the default size of 8k.
#define ACE_DEFAULT_MAX_SOCKET_BUFSIZ 65535
+
// It seems like Win32 does not have a limit on the number of buffers
// that can be transferred by the scatter/gather type of I/O
// functions, e.g., WSASend and WSARecv. We are setting this to be 64
@@ -164,24 +188,30 @@
#if !defined (ACE_IOV_MAX)
# define ACE_IOV_MAX 64
#endif /* ACE_IOV_MAX */
+
#if !defined (ACE_HAS_WINCE)
// Platform supports pread() and pwrite()
# define ACE_HAS_P_READ_WRITE
#endif /* ! ACE_HAS_WINCE */
+
#if !defined (__MINGW32__)
# define ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS
#endif /* __MINGW32__ */
+
#define ACE_DEFAULT_THREAD_PRIORITY 0
+
#define ACE_HAS_DIRENT
#define ACE_HAS_MSG
#define ACE_HAS_RECURSIVE_MUTEXES
#define ACE_HAS_SOCKADDR_MSG_NAME
#define ACE_HAS_THREAD_SAFE_ACCEPT
+
/* LACKS dir-related facilities */
#define ACE_LACKS_READDIR_R
#define ACE_LACKS_REWINDDIR
#define ACE_LACKS_SEEKDIR
#define ACE_LACKS_TELLDIR
+
/* LACKS gid/pid/sid/uid facilities */
#define ACE_LACKS_GETPGID
#define ACE_LACKS_GETPPID
@@ -197,6 +227,7 @@
#define ACE_LACKS_GETUID
#define ACE_LACKS_GETEUID
#define ACE_LACKS_SETGID
+
/* LACKS miscellaneous */
#define ACE_LACKS_ALARM
#define ACE_LACKS_ARPA_INET_H
@@ -234,10 +265,14 @@
#define ACE_LACKS_WAIT
#define ACE_LACKS_IOVEC
#define ACE_LACKS_LOG2
+
#define ACE_HAS_PDH_H
#define ACE_HAS_PDHMSG_H
+
#define ACE_HAS_VFWPRINTF
+
#define ACE_MKDIR_LACKS_MODE
+
#define ACE_SIZEOF_LONG_LONG 8
// Green Hills Native x86 does not support __int64 keyword
// Neither does mingw32.
@@ -245,51 +280,72 @@
#define ACE_INT64_TYPE signed __int64
#define ACE_UINT64_TYPE unsigned __int64
#endif /* (ghs) */
+
#if defined (__MINGW32__)
#define ACE_INT64_TYPE signed long long
#define ACE_UINT64_TYPE unsigned long long
#endif
+
// Optimize ACE_Handle_Set for select().
#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT
+
// Win32 has wide-char support. Use of the compiler-defined wchar_t type
// is controlled in compiler configs since it's a compiler switch.
#define ACE_HAS_WCHAR
+
// Compiler/platform correctly calls init()/fini() for shared
// libraries. - applied for DLLs ?
//define ACE_HAS_AUTOMATIC_INIT_FINI
+
// Platform supports POSIX O_NONBLOCK semantics.
//define ACE_HAS_POSIX_NONBLOCK
+
// Platform contains <poll.h>.
//define ACE_HAS_POLL
+
// Platform supports the /proc file system.
//define ACE_HAS_PROC_FS
+
// Platform supports the rusage struct.
#define ACE_HAS_GETRUSAGE
+
// Compiler/platform supports SVR4 signal typedef.
//define ACE_HAS_SVR4_SIGNAL_T
+
// Platform provides <sys/filio.h> header.
//define ACE_HAS_SYS_FILIO_H
+
// Compiler/platform supports sys_siglist array.
//define ACE_HAS_SYS_SIGLIST
+
// Platform supports ACE_TLI timod STREAMS module.
//define ACE_HAS_TIMOD_H
+
// Platform supports ACE_TLI tiuser header.
//define ACE_HAS_TIUSER_H
+
// Platform provides ACE_TLI function prototypes.
// For Win32, this is not really true, but saves a lot of hassle!
#define ACE_HAS_TLI_PROTOTYPES
+
// Platform supports ACE_TLI.
//define ACE_HAS_TLI
+
// I'm pretty sure NT lacks these
#define ACE_LACKS_UNIX_DOMAIN_SOCKETS
+
// Windows NT needs readv() and writev()
#define ACE_LACKS_WRITEV
#define ACE_LACKS_READV
+
#define ACE_LACKS_COND_T
#define ACE_LACKS_RWLOCK_T
+
#define ACE_LACKS_KEY_T
+
// No system support for replacing any previous mappings.
#define ACE_LACKS_AUTO_MMAP_REPLACEMENT
+
// ACE_HAS_PENTIUM is used to optimize some CDR operations; it's used for
// some other time-related things using g++, but not for VC. Current VC
// compilers set _M_IX86 > 400 by default so if you're not using a Pentium
@@ -297,16 +353,22 @@
#if !defined(ACE_HAS_PENTIUM) && (_M_IX86 > 400)
# define ACE_HAS_PENTIUM
#endif
+
#if defined(ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
// Platform supports threads.
# define ACE_HAS_THREADS
+
// Platform supports Windows32 threads.
# define ACE_HAS_WTHREADS
+
// Compiler/platform has thread-specific storage
# define ACE_HAS_THREAD_SPECIFIC_STORAGE
+
// Win32 doesn't have fcntl
#define ACE_LACKS_FCNTL
+
#endif /* ACE_MT_SAFE && ACE_MT_SAFE != 0 */
+
#if !defined(_DEBUG)
// If we are making a release, and the user has not specified
// inline directives, we will default to inline
@@ -314,10 +376,12 @@
# define __ACE_INLINE__ 1
# endif /* __ACE_INLINE__ */
#endif
+
// If __ACE_INLINE__ is defined to be 0, we will undefine it
#if defined (__ACE_INLINE__) && (__ACE_INLINE__ == 0)
# undef __ACE_INLINE__
#endif /* __ACE_INLINE__ */
+
// We are build ACE and want to use MFC (multithreaded)
#if defined(ACE_HAS_MFC) && (ACE_HAS_MFC != 0) && defined (_MT)
# if (ACE_HAS_DLL != 0) && defined(ACE_BUILD_DLL) && !defined (_WINDLL)
@@ -328,6 +392,7 @@
# define _AFXDLL
# endif /* _AFXDLL */
#endif
+
// <windows.h> and MFC's <afxwin.h> are mutually
// incompatible. <windows.h> is brain-dead about MFC; it doesn't check
// to see whether MFC stuff is anticipated or already in progress
@@ -341,6 +406,7 @@
// macro itself to protect against double inclusion. We'll take
// advantage of all this to select the proper support for winsock. -
// trl 26-July-1996
+
// This is necessary since MFC users apparently can't #include
// <windows.h> directly.
#if defined (ACE_HAS_MFC) && (ACE_HAS_MFC != 0)
@@ -350,20 +416,25 @@
#elif defined (ACE_HAS_WINCE)
# include /**/ <windows.h>
#endif
+
#if !defined (_INC_WINDOWS) /* Already include windows.h ? */
// Must define strict before including windows.h !
# if defined (ACE_HAS_STRICT) && (ACE_HAS_STRICT != 0) && !defined (STRICT)
# define STRICT 1
# endif /* ACE_HAS_STRICT */
+
# if !defined (WIN32_LEAN_AND_MEAN) && !defined (ACE_NO_WIN32_LEAN_AND_MEAN)
# define WIN32_LEAN_AND_MEAN
# endif /* WIN32_LEAN_AND_MEAN */
+
#endif /* !defined (_INC_WINDOWS) */
+
// Always use WS2 when available
#if !defined(ACE_HAS_WINSOCK2)
# define ACE_HAS_WINSOCK2 1
#endif /* !defined(ACE_HAS_WINSOCK2) */
+
#if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
# if !defined (_WINSOCK2API_)
// will also include windows.h, if not present
@@ -410,13 +481,16 @@
# define EREMOTE WSAEREMOTE
# endif /* UNDER_CE */
# endif /* _WINSOCK2API */
+
# if defined (ACE_HAS_FORE_ATM_WS2)
# include /**/ <ws2atm.h>
# endif /*ACE_HAS_FORE_ATM_WS2 */
+
// CE doesn't have Microsoft Winsock 2 extensions
# if !defined _MSWSOCK_ && !defined (ACE_HAS_WINCE)
# include /**/ <mswsock.h>
# endif /* _MSWSOCK_ */
+
# if defined (_MSC_VER)
# if defined (ACE_HAS_WINCE)
# pragma comment(lib, "ws2.lib")
@@ -428,41 +502,51 @@
# endif
# endif /* ACE_HAS_WINCE */
# endif /* _MSC_VER */
+
# define ACE_WSOCK_VERSION 2, 0
#else
# if !defined (_WINSOCKAPI_)
// will also include windows.h, if not present
# include /**/ <winsock.h>
# endif /* _WINSOCKAPI */
+
// PharLap ETS has its own winsock lib, so don't grab the one
// supplied with the OS.
# if defined (_MSC_VER) && !defined (UNDER_CE) && !defined (ACE_HAS_PHARLAP)
# pragma comment(lib, "wsock32.lib")
# endif /* _MSC_VER */
+
// We can't use recvmsg and sendmsg unless WinSock 2 is available
# define ACE_LACKS_RECVMSG
# define ACE_LACKS_SENDMSG
+
// Version 1.1 of WinSock
# define ACE_WSOCK_VERSION 1, 1
#endif /* ACE_HAS_WINSOCK2 */
+
// Platform supports IP multicast on Winsock 2
#if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
# define ACE_HAS_IP_MULTICAST
#endif /* ACE_HAS_WINSOCK2 */
+
#if !defined (ACE_HAS_WINCE) || defined (PPC) /* CE only on some CPUs */
# define ACE_HAS_INTERLOCKED_EXCHANGEADD
#endif
#define ACE_HAS_WIN32_TRYLOCK
+
#if !defined (ACE_HAS_WINCE) && !defined (ACE_HAS_PHARLAP)
# define ACE_HAS_SIGNAL_OBJECT_AND_WAIT
+
// If CancelIO is undefined get the updated sp2-sdk from MS
# define ACE_HAS_CANCEL_IO
# define ACE_HAS_WIN32_OVERLAPPED_IO
# define ACE_HAS_WIN32_NAMED_PIPES
#endif /* !defined (ACE_USES_WINCE_SEMA_SIMULATION) && !ACE_HAS_PHARLAP */
+
#if !defined (ACE_SEH_DEFAULT_EXCEPTION_HANDLING_ACTION)
# define ACE_SEH_DEFAULT_EXCEPTION_HANDLING_ACTION EXCEPTION_CONTINUE_SEARCH
#endif /* ACE_SEH_DEFAULT_EXCEPTION_HANDLING_ACTION */
+
// ACE_HAS_QOS is defined in the qos.mpb base project.
// If qos=1 in default.features, then this macro will be defined.
#if defined (ACE_HAS_QOS) && !defined (ACE_HAS_WINSOCK2_GQOS)
@@ -470,6 +554,7 @@
# define ACE_HAS_WINSOCK2_GQOS 1
# endif /* WINSOCK_VERSION */
#endif /* ACE_HAS_WINSOCK2_GQOS */
+
// These are the defaults and can be overridden by a user's config.h
#if !defined (ACE_DEFAULT_FILE_PERMS)
# define ACE_DEFAULT_FILE_PERMS (FILE_SHARE_READ | FILE_SHARE_WRITE | \
@@ -478,6 +563,7 @@
// by knock-offs such as CE and Pharlap.
//# define ACE_DEFAULT_FILE_PERMS (FILE_SHARE_READ | FILE_SHARE_WRITE)
#endif /* !defined (ACE_DEFAULT_FILE_PERMS) */
+
#define ACE_SIZEOF_WCHAR 2
#define ACE_HAS_MUTEX_TIMEOUTS
#define ACE_LACKS_STRUCT_DIR
@@ -489,6 +575,7 @@
#define ACE_LACKS_LSTAT
// Looks like Win32 has a non-const swab function
#define ACE_HAS_NONCONST_SWAB
+
// If we are using winsock2 then the SO_REUSEADDR feature is broken
// SO_REUSEADDR=1 behaves like SO_REUSEPORT=1. (SO_REUSEPORT is an
// extension to sockets on some platforms)
@@ -497,21 +584,26 @@
#if defined (ACE_HAS_WINSOCK2) && ACE_HAS_WINSOCK2 != 0 && ! defined(SO_REUSEPORT)
#define SO_REUSEPORT 0x0400 // We just have to pick a value that won't conflict
#endif
+
#if defined (ACE_WIN64)
// Data must be aligned on 8-byte boundaries, at a minimum.
# define ACE_MALLOC_ALIGN 8
// Void pointers are 8 bytes
# define ACE_SIZEOF_VOID_P 8
#endif /* ACE_WIN64 */
+
#if !defined (ACE_DISABLES_THREAD_LIBRARY_CALLS)
# define ACE_DISABLES_THREAD_LIBRARY_CALLS 0
#endif /* ACE_DISABLES_THREAD_LIBRARY_CALLS */
+
#if !defined (ACE_HAS_WINCE) && !defined (ACE_HAS_PHARLAP)
# define ACE_HAS_LOG_MSG_NT_EVENT_LOG
#endif /* !ACE_HAS_WINCE && !ACE_HAS_PHARLAP */
+
#if !defined (ACE_HAS_WINCE)
# define ACE_HAS_LLSEEK
#endif /* !ACE_HAS_WINCE */
+
// Needed for obtaining the MAC address
// I dont believe this will work under CE, notice the
// check for ACE_HAS_WINCE.
@@ -521,15 +613,18 @@
# pragma comment(lib, "netapi32.lib") // needed for obtaing MACaddress
# endif
# endif /* !ACE_HAS_WINCE */
+
#if !defined (WINVER)
# define WINVER 0x0400 // pretend it's at least WinNT 4.0
#endif
+
///////////////////////////////////////
// windows version-specific definitions
// see: http://msdn2.microsoft.com/en-us/library/aa383745.aspx
//
// For TSS information
// see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/thread_local_storage.asp
+
#if (WINVER>=0x0600)
// Windows Server 2008 definitions go here
// Windows Vista defintions go here
@@ -562,9 +657,11 @@
# define ACE_DEFAULT_THREAD_KEYS 64
# endif // ! defined(ACE_DEFAULT_THREAD_KEYS)
#endif
+
#if !defined (ACE_DEFAULT_BACKLOG)
# define ACE_DEFAULT_BACKLOG SOMAXCONN
#endif /* ACE_DEFAULT_BACKLOG */
+
#include /**/ "ace/post.h"
#endif /* ACE_CONFIG_WIN32_COMMON_H */
diff --git a/dep/ACE_wrappers/ace/config-win32-dmc.h b/dep/ACE_wrappers/ace/config-win32-dmc.h
index d737efcac82..ca855f5bc97 100644
--- a/dep/ACE_wrappers/ace/config-win32-dmc.h
+++ b/dep/ACE_wrappers/ace/config-win32-dmc.h
@@ -1,21 +1,28 @@
// -*- C++ -*-
// $Id: config-win32-dmc.h 81992 2008-06-16 19:09:50Z wotte $
+
// The following configuration file contains defines for Digital Mars compilers.
+
#ifndef ACE_CONFIG_WIN32_DMC_H
#define ACE_CONFIG_WIN32_DMC_H
#include /**/ "ace/pre.h"
+
#ifndef ACE_CONFIG_WIN32_H
#error Use config-win32.h in config.h instead of this header
#endif /* ACE_CONFIG_WIN32_H */
+
#ifndef WIN32
# define WIN32
#endif /* WIN32 */
+
#undef _M_IX86
// This turns on ACE_HAS_PENTIUM
#define _M_IX86 500
+
#if defined ACE_LACKS_STRUCT_DIR
# undef ACE_LACKS_STRUCT_DIR
#endif
+
// Changed ACE_TEXT to ACE_TEXT in the following line
# define ACE_CC_NAME ACE_TEXT ("Digital Mars")
# define ACE_CC_MAJOR_VERSION (1)
@@ -25,9 +32,12 @@
# define ACE_CC_PREPROCESSOR "DMC.EXE"
# define ACE_CC_PREPROCESSOR_ARGS "-E"
# endif
+
// Microsoft's standard cpp library auto_ptr doesn't have reset ().
# define ACE_AUTO_PTR_LACKS_RESET
+
#define ACE_ENDTHREADEX(STATUS) ::_endthreadex ((DWORD) STATUS)
+
// This section below was extracted from config-win32-msvc
#define ACE_HAS_ITOA
#define ACE_ITOA_EQUIVALENT ::_itoa
@@ -35,6 +45,7 @@
#define ACE_STRNCASECMP_EQUIVALENT ::_strnicmp
#define ACE_WCSDUP_EQUIVALENT ::_wcsdup
// This section above was extracted from config-win32-msvc
+
# define ACE_EXPORT_NESTED_CLASSES 1
# define ACE_HAS_CPLUSPLUS_HEADERS 1
//# define ACE_HAS_EXCEPTIONS 1
@@ -82,15 +93,19 @@
#define ACE_LACKS_TERMIOS_H
#define ACE_LACKS_ACE_IOSTREAM
#define ACE_HAS_NONCONST_TEMPNAM
+
// Typedefs which we expect DMC to do, but they don't do that
typedef long o_uid_t;
typedef long o_gid_t;
+
#include "io.h"
#undef umask;
#undef tell;
+
# if !defined (ACE_LD_DECORATOR_STR) && defined (_DEBUG)
# define ACE_LD_DECORATOR_STR ACE_TEXT ("d")
# endif
+
#include /**/ "ace/post.h"
#endif /* ACE_CONFIG_WIN32_DMC_H */
diff --git a/dep/ACE_wrappers/ace/config-win32-ghs.h b/dep/ACE_wrappers/ace/config-win32-ghs.h
index b1b2db6f93a..775488f3f7f 100644
--- a/dep/ACE_wrappers/ace/config-win32-ghs.h
+++ b/dep/ACE_wrappers/ace/config-win32-ghs.h
@@ -1,15 +1,20 @@
// -*- C++ -*-
// $Id: config-win32-ghs.h 81992 2008-06-16 19:09:50Z wotte $
+
// The following configuration file contains defines for Green Hills compilers.
+
#ifndef ACE_CONFIG_WIN32_GHS_H
#define ACE_CONFIG_WIN32_GHS_H
#include /**/ "ace/pre.h"
+
#ifndef ACE_CONFIG_WIN32_H
#error Use config-win32.h in config.h instead of this header
#endif /* ACE_CONFIG_WIN32_H */
+
#ifndef WIN32
# define WIN32
#endif /* WIN32 */
+
#undef _M_IX86
// This turns on ACE_HAS_PENTIUM
#define _M_IX86 500
@@ -17,11 +22,13 @@
#define ACE_HAS_DLL 0
#define TAO_HAS_DLL 0
#undef _DLL
+
//Green Hills Native x86 does not support structural exceptions
# undef ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS
# undef ACE_HAS_WCHAR
# define ACE_CONFIG_INCLUDE_GHS_COMMON
# include "ace/config-ghs-common.h"
+
// Changed ACE_TEXT to ACE_TEXT in the following line
# define ACE_CC_NAME ACE_TEXT ("Green Hills C++")
# define ACE_CC_MAJOR_VERSION (1)
@@ -31,11 +38,14 @@
# define ACE_CC_PREPROCESSOR "GCX.EXE"
# define ACE_CC_PREPROCESSOR_ARGS "-E"
# endif
+
// GHS uses Microsoft's standard cpp library, which has auto_ptr.
# undef ACE_LACKS_AUTO_PTR
// Microsoft's standard cpp library auto_ptr doesn't have reset ().
# define ACE_AUTO_PTR_LACKS_RESET
+
#define ACE_ENDTHREADEX(STATUS) ::_endthreadex ((DWORD) STATUS)
+
// This section below was extracted from config-win32-msvc
#define ACE_HAS_ITOA
#define ACE_ITOA_EQUIVALENT ::_itoa
@@ -43,6 +53,7 @@
#define ACE_STRNCASECMP_EQUIVALENT ::_strnicmp
#define ACE_WCSDUP_EQUIVALENT ::_wcsdup
// This section above was extracted from config-win32-msvc
+
# define ACE_EXPORT_NESTED_CLASSES 1
# define ACE_HAS_CPLUSPLUS_HEADERS 1
//# define ACE_HAS_EXCEPTIONS 1
@@ -69,14 +80,18 @@
# define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1
// Set the following to zero to placate SString.h ACE_WString CTOR
# undef ACE_WSTRING_HAS_USHORT_SUPPORT
+
// Green Hills Native x86 does not support __int64 keyword
# define ACE_LACKS_LONGLONG_T
+
/* need to ensure these are included before <iomanip> */
# include <time.h>
# include <stdlib.h>
+
# if !defined (ACE_LD_DECORATOR_STR) && defined (_DEBUG)
# define ACE_LD_DECORATOR_STR ACE_TEXT ("d")
# endif
+
#include /**/ "ace/post.h"
#endif /* ACE_CONFIG_WIN32_GHS_H */
diff --git a/dep/ACE_wrappers/ace/config-win32-interix.h b/dep/ACE_wrappers/ace/config-win32-interix.h
index 58b7bf74fc5..71f521af45a 100644
--- a/dep/ACE_wrappers/ace/config-win32-interix.h
+++ b/dep/ACE_wrappers/ace/config-win32-interix.h
@@ -1,11 +1,14 @@
// -*- C++ -*-
// $Id: config-win32-interix.h 80826 2008-03-04 14:51:23Z wotte $
+
// The following configuration file is designed to work for Interix
// platforms using GNU g++ (Interix == Microsoft's Services for Unix)
+
#ifndef ACE_CONFIG_WIN32_INTERIX_H
#define ACE_CONFIG_WIN32_INTERIX_H
#include /**/ "ace/pre.h"
#include <arpa/inet.h>
+
# define ACE_LACKS_SENDMSG
# define ACE_LACKS_RECVMSG
# define ACE_LACKS_STDINT_H
@@ -23,8 +26,11 @@
# define ACE_HAS_NONCONST_SELECT_TIMEVAL
# define ACE_HAS_SIGWAIT
# define ACE_HAS_SIGINFO_T
+
#include "ace/config-g++-common.h"
+
#define ACE_HAS_NEW_NOTHROW // Need to know 'new's failure semantics.
+
#if defined (ACE_HAS_THREADS)
#define ACE_HAS_THREADS
#define ACE_HAS_PTHREADS
@@ -36,11 +42,14 @@
#else
error "You need to enable threads for this Interix port."
#endif /* ACE_HAS_THREADS */
+
// INTERIX has the following, just an issue with porting for the moment
#define ACE_LACKS_ACCESS
// END INTERIX has the following....
+
#define ACE_SIZEOF_LONG_DOUBLE 12
#define ACE_PAGE_SIZE 4096
+
#define ACE_HAS_SYSV_IPC
#define ACE_HAS_SVR4_SIGNAL_T
#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES
@@ -61,10 +70,12 @@
#define ACE_HAS_UALARM
#define ACE_HAS_TERMIOS
#define ACE_HAS_SIGWAIT
+
// Turns off the tracing feature.
#if !defined (ACE_NTRACE)
#define ACE_NTRACE 1
#endif /* ACE_NTRACE */
+
// NOTE: In debugging some of the test apps they would all memory fault in using
// ACE_Errno_Guard. Upon inspection of that code it uses TSS to save ERRNO in
// a TSS pointer. Access to that pointer caused the fault. The work around here
@@ -75,8 +86,10 @@
// however while many test programs that use TSS pass the TSS_Test program fails.
#define ACE_HAS_THREAD_SPECIFIC_STORAGE // We need thread specific storage even though...
#define ACE_HAS_TSS_EMULATION // It would appear to be broken in Interix!
+
#include /**/ "ace/post.h"
#endif /* ACE_CONFIG_WIN32_INTERIX_H */
+
/*
The following tests do not run.
Dynamic_Priority_Test.log ACE_HAS_TIMED_MESSAGE_BLOCKS
@@ -85,3 +98,4 @@ IOStream_Test.log ACE_IOSTREAM not supported on this platform
*/
+
diff --git a/dep/ACE_wrappers/ace/config-win32-mingw.h b/dep/ACE_wrappers/ace/config-win32-mingw.h
index 7ba9700da12..259e5d927fd 100644
--- a/dep/ACE_wrappers/ace/config-win32-mingw.h
+++ b/dep/ACE_wrappers/ace/config-win32-mingw.h
@@ -1,32 +1,43 @@
// -*- C++ -*-
// $Id: config-win32-mingw.h 81693 2008-05-14 12:35:01Z johnnyw $
+
//
// The following configuration file is designed to work for win32
// platforms using gcc/g++ with mingw32 (http://www.mingw.org).
//
+
#ifndef ACE_CONFIG_WIN32_MINGW_H
#define ACE_CONFIG_WIN32_MINGW_H
#include /**/ "ace/pre.h"
+
#ifndef ACE_CONFIG_WIN32_H
# error Use config-win32.h in config.h instead of this header
#endif /* ACE_CONFIG_WIN32_H */
+
#define ACE_CC_NAME ACE_TEXT ("g++")
#define ACE_CC_PREPROCESSOR "cpp"
#define ACE_CC_PREPROCESOR_ARGS ""
+
// Why all this is not in config-g++-common.h?
#define ACE_CC_MAJOR_VERSION __GNUC__
#define ACE_CC_MINOR_VERSION __GNUC_MINOR__
#define ACE_CC_BETA_VERSION (0)
+
#if !defined(__MINGW32__)
# error You do not seem to be using mingw32
#endif
+
#include "ace/config-g++-common.h"
+
#include /**/ <_mingw.h>
#include /**/ <w32api.h>
+
#define ACE_HAS_USER_MODE_MASKS
+
#if (__MINGW32_MAJOR_VERSION < 2)
# error You need a newer version (>= 2.0) of mingw32/w32api
#endif
+
#if (__MINGW32_MAJOR_VERSION >= 3)
# define ACE_HAS_SSIZE_T
# undef ACE_LACKS_STRUCT_DIR
@@ -39,7 +50,9 @@
#else
# define ACE_LACKS_DIRENT_H
#endif
+
#undef ACE_LACKS_SIGSET
+
#define ACE_LACKS_SIGSET_DEFINITIONS
#define ACE_LACKS_SYS_SHM_H
#define ACE_LACKS_TERMIOS_H
@@ -71,14 +84,18 @@
#define ACE_LACKS_PDHMSG_H
#define ACE_HAS_NONCONST_WCSDUP
#define ACE_HAS_WINSOCK2_GQOS
+
// We trust the user: He must have used -mpentiumpro or -mpentium
// if that is what he wants.
#if defined(pentiumpro) || defined(pentium)
# define ACE_HAS_PENTIUM
#endif
+
#define ACE_INT64_FORMAT_SPECIFIER ACE_TEXT ("%I64d")
#define ACE_UINT64_FORMAT_SPECIFIER ACE_TEXT ("%I64u")
+
#define ACE_ENDTHREADEX(STATUS) ::_endthreadex ((DWORD) (STATUS))
+
#include /**/ "ace/post.h"
#endif /* ACE_CONFIG_WIN32_MINGW_H */
diff --git a/dep/ACE_wrappers/ace/config-win32-msvc-7.h b/dep/ACE_wrappers/ace/config-win32-msvc-7.h
index a760b0182f9..b2b45c6894b 100644
--- a/dep/ACE_wrappers/ace/config-win32-msvc-7.h
+++ b/dep/ACE_wrappers/ace/config-win32-msvc-7.h
@@ -14,84 +14,113 @@
* @author Darrell Brunsch <brunsch@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_CONFIG_WIN32_MSVC_7_H
#define ACE_CONFIG_WIN32_MSVC_7_H
#include /**/ "ace/pre.h"
+
#ifndef ACE_CONFIG_WIN32_H
#error Use config-win32.h in config.h instead of this header
#endif /* ACE_CONFIG_WIN32_H */
+
// Visual C++ 7.0 (.NET) deprecated the old iostreams
#if !defined (ACE_HAS_STANDARD_CPP_LIBRARY)
#define ACE_HAS_STANDARD_CPP_LIBRARY 1
#endif
+
#if !defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB)
#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1
#endif
+
// Win64 SDK compiler claims std::auto_ptr<>::reset not available.
#if defined (_WIN64) || defined (WIN64)
#define ACE_AUTO_PTR_LACKS_RESET
#endif
+
#define ACE_HAS_ITOA
#define ACE_HAS_HEADER_ALLOCATED_CLASS_STATIC_CONST_INT_STOREAGE
#define ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR
+
#define ACE_ITOA_EQUIVALENT ::_itoa
#define ACE_STRCASECMP_EQUIVALENT ::_stricmp
#define ACE_STRNCASECMP_EQUIVALENT ::_strnicmp
#define ACE_WCSDUP_EQUIVALENT ::_wcsdup
+
#if !defined (ACE_HAS_WINCE) && !defined (ACE_HAS_EXCEPTIONS)
#define ACE_HAS_EXCEPTIONS
#endif /* ACE_HAS_WINCE */
+
#define ACE_HAS_STRERROR
#define ACE_LACKS_STRPTIME
+
#define ACE_HAS_SIG_ATOMIC_T
#define ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES
#define ACE_LACKS_STRRECVFD
#define ACE_HAS_CPLUSPLUS_HEADERS
+
#define ACE_HAS_TEMPLATE_TYPEDEFS
#define ACE_TEMPLATES_REQUIRE_SOURCE
+
// Platform provides ACE_TLI function prototypes.
// For Win32, this is not really true, but saves a lot of hassle!
#define ACE_HAS_TLI_PROTOTYPES
+
// Platform support linebuffered streaming is broken
#define ACE_LACKS_LINEBUFFERED_STREAMBUF
+
#if !defined (ACE_HAS_WINCE) && !(defined (__INTEL_COMPILER) && (__INTEL_COMPILER == 900))
# define ACE_HAS_INTRINSIC_INTERLOCKED
# define ACE_HAS_INTRINSIC_BYTESWAP
#endif
+
#if defined (ACE_HAS_STANDARD_CPP_LIBRARY) && (ACE_HAS_STANDARD_CPP_LIBRARY != 0)
+
// Platform has its Standard C++ library in the namespace std
# if !defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB)
# define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1
# endif /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */
+
// ace/iostream.h does not work with the standard cpp library (yet).
# if !defined (ACE_USES_OLD_IOSTREAMS)
# define ACE_LACKS_ACE_IOSTREAM
# endif /* ! ACE_USES_OLD_IOSTREAMS */
+
// Starting with MSVC 7.1, std::new throws std::bad_alloc on out-of-memory.
// Since we don't support MSVC 7.0, don't test for it.
# define ACE_NEW_THROWS_EXCEPTIONS
# define ACE_HAS_NEW_NOTHROW
+
#else
+
// iostream header lacks ipfx (), isfx (), etc., declarations
# define ACE_LACKS_IOSTREAM_FX
+
#endif
+
// There are too many instances of this warning to fix it right now.
// Maybe in the future.
// 'this' : used in base member initializer list
#pragma warning(disable:4355)
+
// 'class1' : inherits 'class2::member' via dominance
#pragma warning(disable:4250)
+
// C++ Exception Specification ignored
#pragma warning(disable:4290)
+
// Disable warning of using Microsoft Extension.
#pragma warning(disable:4231)
+
// 'function' : unreferenced local function has been removed
# pragma warning(disable:4505)
+
// A template can not be exported. Only an instantiation may be exported.
#define ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT
+
// At least for ACE_UNIMPLEMENTED_FUNC in class templates, this is needed to
// explicitly instantiate a template that has ACE_UNIMPLEMENTED_FUNC.
# define ACE_NEEDS_FUNC_DEFINITIONS
+
#include /**/ "ace/post.h"
#endif /* ACE_CONFIG_WIN32_MSVC_7_H */
diff --git a/dep/ACE_wrappers/ace/config-win32-msvc-8.h b/dep/ACE_wrappers/ace/config-win32-msvc-8.h
index e4878c41a3c..f35ba9f4f94 100644
--- a/dep/ACE_wrappers/ace/config-win32-msvc-8.h
+++ b/dep/ACE_wrappers/ace/config-win32-msvc-8.h
@@ -14,22 +14,28 @@
* @author Darrell Brunsch <brunsch@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_CONFIG_WIN32_MSVC_8_H
#define ACE_CONFIG_WIN32_MSVC_8_H
#include /**/ "ace/pre.h"
+
#ifndef ACE_CONFIG_WIN32_H
#error Use config-win32.h in config.h instead of this header
#endif /* ACE_CONFIG_WIN32_H */
+
#ifndef ACE_WIN32_VC8
# define ACE_WIN32_VC8
#endif
+
// Visual C++ 8.0 (.NET) deprecated the old iostreams
#if !defined (ACE_HAS_STANDARD_CPP_LIBRARY)
#define ACE_HAS_STANDARD_CPP_LIBRARY 1
#endif
+
#if !defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB)
#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1
#endif
+
// Windows' timeval is non-conformant (defined in terms of long instead of
// time_t) and VC8 (on desktop, not CE) changed time_t to a 64-bit value
// even when compiling a 32-bit application. Therefore, ace/Time_Value
@@ -38,61 +44,83 @@
#if !defined (ACE_HAS_WINCE)
# define ACE_HAS_TIME_T_LONG_MISMATCH
#endif
+
#define ACE_HAS_ITOA
#define ACE_HAS_HEADER_ALLOCATED_CLASS_STATIC_CONST_INT_STOREAGE
#define ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR
+
#define ACE_ITOA_EQUIVALENT ::_itoa
#define ACE_STRCASECMP_EQUIVALENT ::_stricmp
#define ACE_STRNCASECMP_EQUIVALENT ::_strnicmp
#define ACE_WCSDUP_EQUIVALENT ::_wcsdup
+
#define ACE_HAS_EXCEPTIONS
+
// Windows Mobile 5 doesn't do sig_atomic_t, but maybe future versions will.
# if !defined (_WIN32_WCE) || (_WIN32_WCE > 0x501)
# define ACE_HAS_SIG_ATOMIC_T
# endif /* !Win CE 5.0 or less */
+
#define ACE_HAS_STRERROR
#define ACE_LACKS_STRPTIME
+
#if !defined (ACE_HAS_WINCE)
# define ACE_HAS_INTRIN_H
# define ACE_HAS_INTRINSIC_INTERLOCKED
#endif
+
#if !defined (_WIN32_WCE) || (_WIN32_WCE >= 0x501)
# define ACE_HAS_INTRINSIC_BYTESWAP
#endif
+
#define ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES
#define ACE_LACKS_STRRECVFD
#define ACE_HAS_CPLUSPLUS_HEADERS
+
#define ACE_HAS_TEMPLATE_TYPEDEFS
#define ACE_TEMPLATES_REQUIRE_SOURCE
+
// Platform provides ACE_TLI function prototypes.
// For Win32, this is not really true, but saves a lot of hassle!
#define ACE_HAS_TLI_PROTOTYPES
+
// Platform support linebuffered streaming is broken
#define ACE_LACKS_LINEBUFFERED_STREAMBUF
+
#if defined (ACE_HAS_STANDARD_CPP_LIBRARY) && (ACE_HAS_STANDARD_CPP_LIBRARY != 0)
+
// Platform has its Standard C++ library in the namespace std
# if !defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB)
# define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1
# endif /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */
+
// ace/iostream.h does not work with the standard cpp library (yet).
# if !defined (ACE_USES_OLD_IOSTREAMS)
# define ACE_LACKS_ACE_IOSTREAM
# endif /* ! ACE_USES_OLD_IOSTREAMS */
+
// Starting with MSVC 7.1, std::new throws std::bad_alloc on out-of-memory.
#define ACE_NEW_THROWS_EXCEPTIONS
#define ACE_HAS_NEW_NOTHROW
+
#else
+
// iostream header lacks ipfx (), isfx (), etc., declarations
# define ACE_LACKS_IOSTREAM_FX
+
#endif
+
// There are too many instances of this warning to fix it right now.
// Maybe in the future.
+
// Disable warning of using Microsoft Extension.
# pragma warning(disable:4231)
+
// CE (at least thru Windows Mobile 5) doesn't have the new, secure CRT.
#if !defined (ACE_HAS_WINCE) && !defined (ACE_HAS_TR24731_2005_CRT)
# define ACE_HAS_TR24731_2005_CRT
#endif
+
//Detect Platform SDK 64-bit (AMD64) compiler using _MSC_FULL_VER
#if (defined (_WIN64) || defined (WIN64)) && _MSC_FULL_VER < 140050000
# define ACE_AUTO_PTR_LACKS_RESET
@@ -102,16 +130,20 @@
# undef ACE_HAS_TR24731_2005_CRT
# undef ACE_HAS_INTRIN_H
#endif
+
// On CE w/o MFC config-WinCE.h needs to declare a placement new. This
// triggers a warning that there's no placement delete, which can be ignored.
#if defined (ACE_HAS_WINCE) && !defined (ACE_HAS_MFC)
# pragma warning(disable:4291)
#endif
+
// A template can not be exported. Only an instantiation may be exported.
#define ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT
+
// At least for ACE_UNIMPLEMENTED_FUNC in class templates, this is needed to
// explicitly instantiate a template that has ACE_UNIMPLEMENTED_FUNC.
# define ACE_NEEDS_FUNC_DEFINITIONS
+
#include /**/ "ace/post.h"
#endif /* ACE_CONFIG_WIN32_MSVC_8_H */
diff --git a/dep/ACE_wrappers/ace/config-win32-msvc-9.h b/dep/ACE_wrappers/ace/config-win32-msvc-9.h
index 17545c36b0e..ee8feef52e1 100644
--- a/dep/ACE_wrappers/ace/config-win32-msvc-9.h
+++ b/dep/ACE_wrappers/ace/config-win32-msvc-9.h
@@ -12,22 +12,28 @@
* @note Do not include this file directly, include config-win32.h instead.
*/
//=============================================================================
+
#ifndef ACE_CONFIG_WIN32_MSVC_9_H
#define ACE_CONFIG_WIN32_MSVC_9_H
#include /**/ "ace/pre.h"
+
#ifndef ACE_CONFIG_WIN32_H
#error Use config-win32.h in config.h instead of this header
#endif /* ACE_CONFIG_WIN32_H */
+
#ifndef ACE_WIN32_VC9
# define ACE_WIN32_VC9
#endif
+
// Visual C++ 9.0 (.NET) deprecated the old iostreams
#if !defined (ACE_HAS_STANDARD_CPP_LIBRARY)
#define ACE_HAS_STANDARD_CPP_LIBRARY 1
#endif
+
#if !defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB)
#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1
#endif
+
// Windows' timeval is non-conformant (defined in terms of long instead of
// time_t) and VC9 (on desktop, not CE) changed time_t to a 64-bit value
// even when compiling a 32-bit application. Therefore, ace/Time_Value
@@ -36,74 +42,100 @@
#if !defined (ACE_HAS_WINCE)
# define ACE_HAS_TIME_T_LONG_MISMATCH
#endif
+
#define ACE_HAS_ITOA
#define ACE_HAS_HEADER_ALLOCATED_CLASS_STATIC_CONST_INT_STOREAGE
#define ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR
+
#define ACE_ITOA_EQUIVALENT ::_itoa
#define ACE_STRCASECMP_EQUIVALENT ::_stricmp
#define ACE_STRNCASECMP_EQUIVALENT ::_strnicmp
#define ACE_WCSDUP_EQUIVALENT ::_wcsdup
+
#define ACE_HAS_EXCEPTIONS
+
// Windows Mobile 5 doesn't do sig_atomic_t, but maybe future versions will.
# if !defined (_WIN32_WCE) || (_WIN32_WCE > 0x501)
# define ACE_HAS_SIG_ATOMIC_T
# endif /* !Win CE 5.0 or less */
+
#define ACE_HAS_STRERROR
#define ACE_LACKS_STRPTIME
+
// Evaluate this with a WinCE build; maybe things have improved since VC8.
//#if !defined (ACE_HAS_WINCE)
# define ACE_HAS_INTRIN_H
# define ACE_HAS_INTRINSIC_INTERLOCKED
//#endif
+
#if !defined (_WIN32_WCE) || (_WIN32_WCE >= 0x501)
# define ACE_HAS_INTRINSIC_BYTESWAP
#endif
+
#define ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES
#define ACE_LACKS_STRRECVFD
#define ACE_HAS_CPLUSPLUS_HEADERS
+
#define ACE_HAS_TEMPLATE_TYPEDEFS
#define ACE_TEMPLATES_REQUIRE_SOURCE
+
// Platform provides ACE_TLI function prototypes.
// For Win32, this is not really true, but saves a lot of hassle!
#define ACE_HAS_TLI_PROTOTYPES
+
// Platform support linebuffered streaming is broken
#define ACE_LACKS_LINEBUFFERED_STREAMBUF
+
#if defined (ACE_HAS_STANDARD_CPP_LIBRARY) && (ACE_HAS_STANDARD_CPP_LIBRARY != 0)
+
// Platform has its Standard C++ library in the namespace std
# if !defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB)
# define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1
# endif /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */
+
// ace/iostream.h does not work with the standard cpp library (yet).
# if !defined (ACE_USES_OLD_IOSTREAMS)
# define ACE_LACKS_ACE_IOSTREAM
# endif /* ! ACE_USES_OLD_IOSTREAMS */
+
// Starting with MSVC 7.1, std::new throws std::bad_alloc on out-of-memory.
#define ACE_NEW_THROWS_EXCEPTIONS
#define ACE_HAS_NEW_NOTHROW
+
#else
+
// iostream header lacks ipfx (), isfx (), etc., declarations
# define ACE_LACKS_IOSTREAM_FX
+
#endif
+
// There are too many instances of this warning to fix it right now.
// Maybe in the future.
+
// Disable warning of using Microsoft Extension.
# pragma warning(disable:4231)
+
// 'class1' : inherits 'class2::member' via dominance
#pragma warning(disable:4250)
+
// CE (at least thru Windows Mobile 5) doesn't have the new, secure CRT.
#if !defined (ACE_HAS_WINCE) && !defined (ACE_HAS_TR24731_2005_CRT)
# define ACE_HAS_TR24731_2005_CRT
#endif
+
// On CE w/o MFC config-WinCE.h needs to declare a placement new. This
// triggers a warning that there's no placement delete, which can be ignored.
#if defined (ACE_HAS_WINCE) && !defined (ACE_HAS_MFC)
# pragma warning(disable:4291)
#endif
+
// A template can not be exported. Only an instantiation may be exported.
#define ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT
+
// At least for ACE_UNIMPLEMENTED_FUNC in class templates, this is needed to
// explicitly instantiate a template that has ACE_UNIMPLEMENTED_FUNC.
# define ACE_NEEDS_FUNC_DEFINITIONS
+
#include /**/ "ace/post.h"
#endif /* ACE_CONFIG_WIN32_MSVC_9_H */
diff --git a/dep/ACE_wrappers/ace/config-win32-msvc.h b/dep/ACE_wrappers/ace/config-win32-msvc.h
index 738a9e2264e..7abad321c7d 100644
--- a/dep/ACE_wrappers/ace/config-win32-msvc.h
+++ b/dep/ACE_wrappers/ace/config-win32-msvc.h
@@ -12,34 +12,42 @@
* @author Darrell Brunsch <brunsch@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_CONFIG_WIN32_MSVC_H
#define ACE_CONFIG_WIN32_MSVC_H
#include /**/ "ace/pre.h"
+
#ifndef ACE_CONFIG_WIN32_H
#error Use config-win32.h in config.h instead of this header
#endif /* ACE_CONFIG_WIN32_H */
+
#define ACE_CC_NAME ACE_TEXT ("Visual C++")
#ifndef ACE_USING_MCPP_PREPROCESSOR
# define ACE_CC_PREPROCESSOR "CL.EXE"
# define ACE_CC_PREPROCESSOR_ARGS "-nologo -E"
#endif
+
#define ACE_CC_MAJOR_VERSION (_MSC_VER / 100 - 6)
#define ACE_CC_MINOR_VERSION (_MSC_VER % 100)
#define ACE_CC_BETA_VERSION (0)
+
#if !defined (ACE_LD_DECORATOR_STR)
# if defined (_DEBUG)
# define ACE_LD_DECORATOR_STR ACE_TEXT ("d")
# endif /* _DEBUG */
#endif /* ACE_LD_DECORATOR_STR */
+
#if !defined(_NATIVE_WCHAR_T_DEFINED)
#define ACE_LACKS_NATIVE_WCHAR_T
#endif
+
// Win Mobile still does thread exits differently than PC Windows.
#if defined (_WIN32_WCE)
# define ACE_ENDTHREADEX(STATUS) ExitThread ((DWORD) STATUS)
#else
# define ACE_ENDTHREADEX(STATUS) ::_endthreadex ((DWORD) STATUS)
#endif /* _WIN32_WCE */
+
#if (_MSC_VER >= 1500)
# include "ace/config-win32-msvc-9.h"
#elif (_MSC_VER >= 1400)
@@ -49,6 +57,7 @@
#else
# error This version of Microsoft Visual C++ is not supported.
#endif
+
// MFC changes the behavior of operator new at all MSVC versions from 6 up
// by throwing a static CMemoryException* instead of std::bad_alloc
// (see ace/OS_Memory.h). This MFC exception object needs to be cleaned up
@@ -66,6 +75,7 @@
# endif
# define ACE_del_bad_alloc e->Delete();
#endif /* ACE_HAS_MFC && ACE_HAS_MFC==1 */
+
#if defined(ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
// must have _MT defined to include multithreading
// features from win32 headers
@@ -77,11 +87,13 @@
# error You must link against multi-threaded libraries when using ACE (check your project settings)
# endif /* !_MT && !ACE_HAS_WINCE */
#endif /* ACE_MT_SAFE && ACE_MT_SAFE != 0 */
+
#include <malloc.h>
// Although ACE does have alloca() on this compiler/platform combination, it is
// disabled by default since it can be dangerous. Uncomment the following line
// if you ACE to use it.
//#define ACE_HAS_ALLOCA 1
+
#define ACE_LACKS_DIRENT_H
#define ACE_LACKS_DLFCN_H
#define ACE_LACKS_INTTYPES_H
@@ -101,6 +113,7 @@
#define ACE_LACKS_SYS_UIO_H
#define ACE_LACKS_SYS_WAIT_H
#define ACE_LACKS_UCONTEXT_H
+
#define ACE_LACKS_SEMAPHORE_H
#define ACE_LACKS_STRINGS_H
#define ACE_LACKS_PWD_H
@@ -110,13 +123,17 @@
#define ACE_LACKS_NETINET_TCP_H
#define ACE_LACKS_TERMIOS_H
#define ACE_LACKS_REGEX_H
+
#define ACE_INT64_FORMAT_SPECIFIER ACE_TEXT ("%I64d")
#define ACE_UINT64_FORMAT_SPECIFIER ACE_TEXT ("%I64u")
+
#define ACE_STRTOULL_EQUIVALENT ::_strtoui64
#define ACE_WCSTOOULL_EQUIVALENT ::_wcstoui64
+
// Turn off warnings for /W4
// To resume any of these warning: #pragma warning(default: 4xxx)
// which should be placed after these defines
+
#if !defined (ALL_WARNINGS) && defined(_MSC_VER) && !defined(ghs) && !defined(__MINGW32__)
# pragma warning(disable: 4127) /* constant expression for TRACE/ASSERT */
# pragma warning(disable: 4134) /* message map member fxn casts */
@@ -136,6 +153,7 @@
# pragma warning(disable: 1738)
# endif
#endif /* !ALL_WARNINGS && _MSV_VER && !ghs && !__MINGW32__ */
+
// STRICT type checking in WINDOWS.H enhances type safety for Windows
// programs by using distinct types to represent all the different
// HANDLES in Windows. So for example, STRICT prevents you from
@@ -146,6 +164,7 @@
# define STRICT
# endif /* !STRICT */
# endif /* ACE_HAS_STRICT */
+
#include /**/ "ace/post.h"
#endif /* ACE_CONFIG_WIN32_MSVC_H */
diff --git a/dep/ACE_wrappers/ace/config-win32.h b/dep/ACE_wrappers/ace/config-win32.h
index 1ec87c34f08..96c351bd567 100644
--- a/dep/ACE_wrappers/ace/config-win32.h
+++ b/dep/ACE_wrappers/ace/config-win32.h
@@ -14,36 +14,47 @@
* @author Darrell Brunsch <brunsch@cs.wustl.edu>
*/
//=============================================================================
+
#ifndef ACE_CONFIG_WIN32_H
#define ACE_CONFIG_WIN32_H
#include /**/ "ace/pre.h"
+
// by derex ,I include the win32 specific header here,
// this violates the idea of this file a bit ;)
#define ACE_HAS_REACTOR_NOTIFICATION_QUEUE
+
// Max amount of connections for non-epoll platforms
#ifndef FD_SETSIZE
#define FD_SETSIZE 4096
#endif
+
//disable some deprecate warnings on windows
#ifndef _CRT_NONSTDC_NO_WARNINGS
#define _CRT_NONSTDC_NO_WARNINGS
#endif
+
#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
+
#ifndef _CRT_SECURE_NO_DEPRECATE
#define _CRT_SECURE_NO_DEPRECATE
#endif
+
#ifndef _CRT_NONSTDC_NO_DEPRECATE
#define _CRT_NONSTDC_NO_DEPRECATE
#endif
+
#ifndef _WINDOWS
#define _WINDOWS
#endif
+
// end custom config stuff
+
// NOTE: Please do not add anything besides #include's here. Put other stuff
// (definitions, etc.) in the included headers
+
// We need to ensure that for Borland vcl.h can be included before
// windows.h. So we will not include config-win32-common.h from here,
// but instead let it be included at the appropriate place in
@@ -51,6 +62,7 @@
#if !defined (__BORLANDC__)
# include "ace/config-win32-common.h"
#endif /* !__BORLANDC__ */
+
// Include the config-win32-* file specific to the compiler
#if defined (__BORLANDC__)
# include "ace/config-win32-borland.h"
@@ -65,14 +77,18 @@
#else
# error Compiler is not supported
#endif
+
// gethostbyaddr does not handle IPv6-mapped-IPv4 addresses
#define ACE_HAS_BROKEN_GETHOSTBYADDR_V4MAPPED
+
// TODO remove this at some point when we add ACE::init and ACE::fini
// by derex
#ifdef ACE_HAS_NONSTATIC_OBJECT_MANAGER
#undef ACE_HAS_NONSTATIC_OBJECT_MANAGER
#endif //ACE_HAS_NONSTATIC_OBJECT_MANAGER
+
#include /**/ "ace/post.h"
#endif /* ACE_CONFIG_WIN32_H */
+
diff --git a/dep/ACE_wrappers/ace/gethrtime.cpp b/dep/ACE_wrappers/ace/gethrtime.cpp
index 360db7a78a3..163645cd68b 100644
--- a/dep/ACE_wrappers/ace/gethrtime.cpp
+++ b/dep/ACE_wrappers/ace/gethrtime.cpp
@@ -4,21 +4,28 @@
// that was compiled with GreenHills. It wouldn't be necessary if I
// knew a way to correctly move values from registers to a 64-bit
// variable in GHS asm code. That's easy with g++ asm.
+
#include "ace/config-all.h"
+
ACE_RCSID(ace, gethrtime, "$Id: gethrtime.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
#if defined (ghs) && (defined (i386) || defined(__i386__))
+
#include "ace/OS_NS_time.h"
+
extern "C"
ACE_hrtime_t
ACE_GETHRTIME_NAME (void)
{
#if defined (ACE_HAS_PENTIUM)
// ACE_TRACE ("ACE_GETHRTIME_NAME");
+
#if defined (ACE_LACKS_LONGLONG_T)
double now;
#else /* ! ACE_LACKS_LONGLONG_T */
ACE_hrtime_t now;
#endif /* ! ACE_LACKS_LONGLONG_T */
+
// Read the high-res tick counter directly into memory variable
// "now". The A constraint signifies a 64-bit int.
#if defined (__GNUG__)
@@ -31,6 +38,7 @@ ACE_GETHRTIME_NAME (void)
#else
# error unsupported compiler
#endif
+
#if defined (ACE_LACKS_LONGLONG_T)
// ACE_U_LongLong doesn't have the same layout as now, so construct
// it "properly".
@@ -38,11 +46,13 @@ ACE_GETHRTIME_NAME (void)
ACE_OS::memcpy (&least, &now, sizeof (ACE_UINT32));
ACE_OS::memcpy (&most, (unsigned char *) &now + sizeof (ACE_UINT32),
sizeof (ACE_UINT32));
+
const ACE_hrtime_t ret (least, most);
return ret;
#else /* ! ACE_LACKS_LONGLONG_T */
return now;
#endif /* ! ACE_LACKS_LONGLONG_T */
+
#else /* ! ACE_HAS_PENTIUM */
# error This file can _only_ be compiled with ACE_HAS_PENTIUM.
#endif /* ! ACE_HAS_PENTIUM */
diff --git a/dep/ACE_wrappers/ace/iosfwd.h b/dep/ACE_wrappers/ace/iosfwd.h
index bed916d560a..561e15e8ad8 100644
--- a/dep/ACE_wrappers/ace/iosfwd.h
+++ b/dep/ACE_wrappers/ace/iosfwd.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file iosfwd.h
@@ -18,21 +19,29 @@
*/
//=============================================================================
+
#ifndef ACE_IOSFWD_H
#define ACE_IOSFWD_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
+
#if defined (__APPLE_CC__)
// Should this really be here? dhinton
// FUZZ: disable check_for_streams_include
# include "ace/streams.h"
#endif
+
#if defined (ACE_HAS_STANDARD_CPP_LIBRARY) && \
(ACE_HAS_STANDARD_CPP_LIBRARY != 0)
+
# if !defined (ACE_USES_OLD_IOSTREAMS)
# include /**/ <iosfwd>
# else
@@ -50,8 +59,10 @@
class ofstream;
class fstream;
# endif /* ! ACE_USES_OLD_IOSTREAMS */
+
# if defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB) && \
(ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB != 0)
+
# if !defined (ACE_USES_OLD_IOSTREAMS)
// Make these available in the global name space
using std::ios;
@@ -64,8 +75,11 @@
using std::ofstream;
using std::fstream;
# endif /* ! ACE_USES_OLD_IOSTREAMS */
+
# endif /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */
+
#else /* ! ACE_HAS_STANDARD_CPP_LIBRARY */
+
class ios;
class streambuf;
class istream;
@@ -75,8 +89,12 @@
class ifstream;
class ofstream;
class fstream;
+
# endif /* ! ACE_HAS_STANDARD_CPP_LIBRARY */
+
#include /**/ "ace/post.h"
+
#endif /* ACE_LACKS_IOSTREAM_TOTALLY */
+
#endif /* ACE_IOSFWD_H */
diff --git a/dep/ACE_wrappers/ace/os_include/arpa/os_inet.h b/dep/ACE_wrappers/ace/os_include/arpa/os_inet.h
index bc40ed7a180..37538c0824d 100644
--- a/dep/ACE_wrappers/ace/os_include/arpa/os_inet.h
+++ b/dep/ACE_wrappers/ace/os_include/arpa/os_inet.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_inet.h
@@ -11,22 +12,30 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_ARPA_OS_INET_H
#define ACE_OS_INCLUDE_ARPA_OS_INET_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/netinet/os_in.h"
+
#if !defined (ACE_LACKS_ARPA_INET_H)
extern "C" {
# include /**/ <arpa/inet.h>
}
#endif /* !ACE_LACKS_ARPA_INET_H */
+
#if defined (ACE_VXWORKS)
# include /**/ <inetLib.h>
#endif /* ACE_VXWORKS */
+
/**
* In some environments it is useful to swap the bytes on write, for
* instance: a fast server can be feeding a lot of slow clients that
@@ -37,6 +46,7 @@
* activate it on a per-connection basis.
*/
// #define ACE_ENABLE_SWAP_ON_WRITE
+
/**
* In some environements we never need to swap bytes when reading, for
* instance embebbed systems (such as avionics) or homogenous
@@ -45,17 +55,21 @@
* in the wrong byte order.
*/
// #define ACE_DISABLE_SWAP_ON_READ
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#if defined (ACE_LACKS_INET_ATON_PROTOTYPE)
int inet_aton (const char *, struct in_addr *);
#endif /* ACE_LACKS_INET_ATON_PROTOTYPE */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_ARPA_OS_INET_H */
diff --git a/dep/ACE_wrappers/ace/os_include/net/os_if.h b/dep/ACE_wrappers/ace/os_include/net/os_if.h
index 1a3d2d0f1f2..da099f89dc2 100644
--- a/dep/ACE_wrappers/ace/os_include/net/os_if.h
+++ b/dep/ACE_wrappers/ace/os_include/net/os_if.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_if.h
@@ -11,13 +12,18 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_NET_OS_IF_H
#define ACE_OS_INCLUDE_NET_OS_IF_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if !defined (ACE_LACKS_NET_IF_H)
// This part if to avoid STL name conflict with the map structure
// in net/if.h.
@@ -37,17 +43,21 @@
# undef IOR
# endif /* HPUX && IOR */
#endif /* !ACE_LACKS_NET_IF_H */
+
#if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
# include /**/ <ws2tcpip.h>
#endif /* ACE_HAS_WINSOCK2 */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#if defined (ACE_HAS_BROKEN_IF_HEADER)
struct ifafilt;
#endif /* ACE_HAS_BROKEN_IF_HEADER */
+
#if defined (ACE_LACKS_IFREQ)
struct ifreq {
#define IFNAMSIZ 16
@@ -76,6 +86,7 @@ struct ifreq {
#define ifr_tap ifr_ifru.ifru_tap /* tap function */
};
#endif /* ACE_LACKS_IFREQ */
+
#if defined (ACE_LACKS_IFCONF)
struct ifconf {
int ifc_len;
@@ -87,18 +98,23 @@ struct ifconf {
#define ifc_req ifc_ifcu.ifcu_req /* array of structures returned */
};
#endif /* ACE_LACKS_IFCONF */
+
#if !defined (IFF_UP)
# define IFF_UP 0x1
#endif /* IFF_UP */
+
#if !defined (IFF_LOOPBACK)
# define IFF_LOOPBACK 0x8
#endif /* IFF_LOOPBACK */
+
#if !defined (IFF_BROADCAST)
# define IFF_BROADCAST 0x2
#endif /* IFF_BROADCAST */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_NET_OS_IF_H */
diff --git a/dep/ACE_wrappers/ace/os_include/netinet/os_in.h b/dep/ACE_wrappers/ace/os_include/netinet/os_in.h
index eaf1ad7589d..c90fb8fa8d4 100644
--- a/dep/ACE_wrappers/ace/os_include/netinet/os_in.h
+++ b/dep/ACE_wrappers/ace/os_include/netinet/os_in.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_in.h
@@ -11,18 +12,25 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_NETINET_OS_IN_H
#define ACE_OS_INCLUDE_NETINET_OS_IN_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/os_inttypes.h"
#include "ace/os_include/sys/os_socket.h"
+
#if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
# include /**/ <ws2tcpip.h>
#endif /* ACE_HAS_WINSOCK2 */
+
#if !defined (ACE_LACKS_NETINET_IN_H)
# if defined (ACE_HAS_STL_QUEUE_CONFLICT)
# define queue _Queue_
@@ -34,16 +42,19 @@
# undef queue
# endif /* ACE_HAS_STL_QUEUE_CONFLICT */
#endif /* !ACE_LACKS_NETINET_IN_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
# if defined (ACE_HAS_PHARLAP_RT)
# define ACE_IPPROTO_TCP SOL_SOCKET
# else
# define ACE_IPPROTO_TCP IPPROTO_TCP
# endif /* ACE_HAS_PHARLAP_RT */
+
# if !defined (ACE_HAS_IP_MULTICAST) && defined (ACE_LACKS_IP_ADD_MEMBERSHIP)
// Even if ACE_HAS_IP_MULTICAST is not defined, if IP_ADD_MEMBERSHIP
// is defined, assume that the ip_mreq struct is also defined
@@ -56,12 +67,14 @@ extern "C"
struct in_addr imr_interface;
};
# endif /* ! ACE_HAS_IP_MULTICAST && ACE_LACKS_IP_ADD_MEMBERSHIP */
+
# if defined (ACE_LACKS_IN_ADDR)
struct in_addr
{
u_long s_addr;
};
# endif /* ACE_LACKS_IN_ADDR */
+
# if defined (ACE_LACKS_SOCKADDR_IN)
struct sockaddr_in
{
@@ -71,6 +84,7 @@ extern "C"
char sin_zero[8]; // zero this if you want to
};
# endif /* ACE_LACKS_SOCKADDR_IN */
+
# if defined (ACE_LACKS_SOCKADDR_UN)
struct sockaddr_un {
u_char sun_len; /* sockaddr len including null */
@@ -78,6 +92,7 @@ extern "C"
char sun_path[104]; /* path name (gag) */
};
#endif /* ACE_LACKS_SOCKADDR_UN */
+
# if defined (ACE_LACKS_IP_MREQ)
struct ip_mreq
{
@@ -85,21 +100,26 @@ extern "C"
struct in_addr imr_interface; /* local IP address of interface */
};
# endif /* ACE_LACKS_IP_MREQ */
+
#if !defined (IPPORT_RESERVED)
# define IPPORT_RESERVED 1024
#endif /* !IPPORT_RESERVED */
+
#if !defined (IPPORT_USERRESERVED)
# define IPPORT_USERRESERVED 5000
#endif /* !IPPORT_USERRESERVED */
+
// Define INET loopback address constant if it hasn't been defined
// Dotted Decimal 127.0.0.1 == Hexidecimal 0x7f000001
#if !defined (INADDR_LOOPBACK)
# define INADDR_LOOPBACK ((ACE_UINT32) 0x7f000001)
#endif /* INADDR_LOOPBACK */
+
// The INADDR_NONE address is generally 255.255.255.255.
#if !defined (INADDR_NONE)
# define INADDR_NONE ((ACE_UINT32) 0xffffffff)
#endif /* INADDR_NONE */
+
// Define INET string length constants if they haven't been defined
//
// for IPv4 dotted-decimal
@@ -111,43 +131,56 @@ extern "C"
#if !defined (INET6_ADDRSTRLEN)
# define INET6_ADDRSTRLEN 46
#endif /* INET6_ADDRSTRLEN */
+
# if !defined (IP_DROP_MEMBERSHIP)
# define IP_DROP_MEMBERSHIP 0
# endif /* IP_DROP_MEMBERSHIP */
+
# if !defined (IP_ADD_MEMBERSHIP)
# define IP_ADD_MEMBERSHIP 0
# define ACE_LACKS_IP_ADD_MEMBERSHIP
# endif /* IP_ADD_MEMBERSHIP */
+
# if !defined (IP_DEFAULT_MULTICAST_TTL)
# define IP_DEFAULT_MULTICAST_TTL 0
# endif /* IP_DEFAULT_MULTICAST_TTL */
+
# if !defined (IP_DEFAULT_MULTICAST_LOOP)
# define IP_DEFAULT_MULTICAST_LOOP 0
# endif /* IP_DEFAULT_MULTICAST_LOOP */
+
# if !defined (IP_MULTICAST_IF)
# define IP_MULTICAST_IF 0
# endif /* IP_MULTICAST_IF */
+
# if !defined (IP_MULTICAST_TTL)
# define IP_MULTICAST_TTL 1
# endif /* IP_MULTICAST_TTL */
+
# if !defined (IP_MULTICAST_LOOP)
# define IP_MULTICAST_LOOP 2
# endif /* IP_MULTICAST_LOOP */
+
# if !defined (IP_MAX_MEMBERSHIPS)
# define IP_MAX_MEMBERSHIPS 0
# endif /* IP_MAX_MEMBERSHIP */
+
# if !defined (IPPROTO_IP)
# define IPPROTO_IP 0
# endif /* IPPROTO_IP */
+
# if !defined (IPPROTO_TCP)
# define IPPROTO_TCP 6
# endif /* IPPROTO_TCP */
+
# if !defined (INADDR_ANY)
# define INADDR_ANY (u_long)0x00000000
# endif /* INADDR_ANY */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_NETINET_OS_IN_H */
diff --git a/dep/ACE_wrappers/ace/os_include/netinet/os_tcp.h b/dep/ACE_wrappers/ace/os_include/netinet/os_tcp.h
index 47cbb5cdc85..9f60cd91af8 100644
--- a/dep/ACE_wrappers/ace/os_include/netinet/os_tcp.h
+++ b/dep/ACE_wrappers/ace/os_include/netinet/os_tcp.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_tcp.h
@@ -11,27 +12,36 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_NETINET_OS_TCP_H
#define ACE_OS_INCLUDE_NETINET_OS_TCP_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if !defined (ACE_LACKS_NETINET_TCP_H)
# include /**/ <netinet/tcp.h>
#endif /* !ACE_LACKS_NETIINET_TCP_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
# if !defined (TCP_NODELAY)
# define TCP_NODELAY 0x01
# endif /* TCP_NODELAY */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_NETINET_OS_TCP_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_aio.h b/dep/ACE_wrappers/ace/os_include/os_aio.h
index 23d7001cd43..2011403ff3c 100644
--- a/dep/ACE_wrappers/ace/os_include/os_aio.h
+++ b/dep/ACE_wrappers/ace/os_include/os_aio.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_aio.h
@@ -11,27 +12,37 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_AIO_H
#define ACE_OS_INCLUDE_OS_AIO_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
// Inclusion of the <aio.h> header may make visible symbols defined in
// the headers <fcntl.h>, <signal.h>, <sys/types.h>, and <time.h>.
+
#include "ace/os_include/os_signal.h" // for sigevent
+
#if !defined (ACE_LACKS_AIO_H)
# include /**/ <aio.h>
#endif /* !ACE_LACKS_AIO_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_AIO_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_assert.h b/dep/ACE_wrappers/ace/os_include/os_assert.h
index a4094cb3a85..1c1ed53d852 100644
--- a/dep/ACE_wrappers/ace/os_include/os_assert.h
+++ b/dep/ACE_wrappers/ace/os_include/os_assert.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_assert.h
@@ -11,27 +12,36 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_ASSERT_H
#define ACE_OS_INCLUDE_OS_ASSERT_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if !defined (ACE_LACKS_ASSERT_H)
# include /**/ <assert.h>
#endif /* !ACE_LACKS_ASSERT_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#if defined (ACE_LACKS_ASSERT_MACRO)
# define assert(expr)
#endif
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_ASSERT_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_byteswap.h b/dep/ACE_wrappers/ace/os_include/os_byteswap.h
index 8ffceb742d8..fd1ff253fce 100644
--- a/dep/ACE_wrappers/ace/os_include/os_byteswap.h
+++ b/dep/ACE_wrappers/ace/os_include/os_byteswap.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_byteswap.h
@@ -10,24 +11,32 @@
* @author Johnny Willemsen <jwillemsen@remedy.nl>
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_BYTESWAP_H
#define ACE_OS_INCLUDE_OS_BYTESWAP_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_BYTESWAP_H)
# include /**/ <byteswap.h>
#endif /* !ACE_HAS_INTRIN_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_BYTESWAP_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_complex.h b/dep/ACE_wrappers/ace/os_include/os_complex.h
index c71e90ee34d..27ce474b6dc 100644
--- a/dep/ACE_wrappers/ace/os_include/os_complex.h
+++ b/dep/ACE_wrappers/ace/os_include/os_complex.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_complex.h
@@ -11,24 +12,32 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_COMPLEX_H
#define ACE_OS_INCLUDE_OS_COMPLEX_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if !defined (ACE_LACKS_COMPLEX_H)
# include /**/ <complex.h>
#endif /* !ACE_LACKS_COMPLEX_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_COMPLEX_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_cpio.h b/dep/ACE_wrappers/ace/os_include/os_cpio.h
index 85f777e13a0..09e536d521a 100644
--- a/dep/ACE_wrappers/ace/os_include/os_cpio.h
+++ b/dep/ACE_wrappers/ace/os_include/os_cpio.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_cpio.h
@@ -11,24 +12,32 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_CPIO_H
#define ACE_OS_INCLUDE_OS_CPIO_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if !defined (ACE_LACKS_CPIO_H)
# include /**/ <cpio.h>
#endif /* !ACE_LACKS_CPIO_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_CPIO_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_ctype.h b/dep/ACE_wrappers/ace/os_include/os_ctype.h
index 03fc231da48..61a3df06375 100644
--- a/dep/ACE_wrappers/ace/os_include/os_ctype.h
+++ b/dep/ACE_wrappers/ace/os_include/os_ctype.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_ctype.h
@@ -11,26 +12,35 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_CTYPE_H
#define ACE_OS_INCLUDE_OS_CTYPE_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if !defined (ACE_LACKS_CTYPE_H)
# include /**/ <ctype.h>
#endif /* !ACE_LACKS_CTYPE_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
// @todo move the is* and is* emulation methods in ACE_OS here
// and let ACE_OS just call them.
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_CTYPE_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_dirent.h b/dep/ACE_wrappers/ace/os_include/os_dirent.h
index 3361fae8001..4e81e94d1bf 100644
--- a/dep/ACE_wrappers/ace/os_include/os_dirent.h
+++ b/dep/ACE_wrappers/ace/os_include/os_dirent.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_dirent.h
@@ -11,35 +12,46 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_DIRENT_H
#define ACE_OS_INCLUDE_OS_DIRENT_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/sys/os_types.h"
#include "ace/os_include/os_limits.h"
+
#if defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x620)
# include "ace/os_include/os_unistd.h" // VxWorks needs this to compile
#endif /* ACE_VXWORKS */
+
#if !defined (ACE_LACKS_DIRENT_H)
# include /**/ <dirent.h>
#endif /* !ACE_LACKS_DIRENT_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#if !defined (MAXNAMLEN)
# define MAXNAMLEN NAME_MAX
#endif /* !MAXNAMLEN */
+
// At least compile on some of the platforms without <ACE_DIR> info yet.
#if !defined (ACE_HAS_DIRENT)
typedef int ACE_DIR;
struct dirent {
};
#endif /* ACE_HAS_DIRENT */
+
#if defined (ACE_LACKS_STRUCT_DIR)
struct dirent {
unsigned short d_ino;
@@ -50,16 +62,22 @@ struct dirent {
// character builds with Visual C++ 6.0.
ACE_TCHAR *d_name;
};
+
#define ACE_DIRENT dirent
+
struct ACE_DIR {
/// The name of the directory we are looking into
ACE_TCHAR *directory_name_;
+
/// Remember the handle between calls.
HANDLE current_handle_;
+
/// The struct for the results
ACE_DIRENT *dirent_;
+
/// The struct for intermediate results.
ACE_TEXT_WIN32_FIND_DATA fdata_;
+
/// A flag to remember if we started reading already.
int started_reading_;
};
@@ -70,18 +88,22 @@ typedef wDIR ACE_DIR;
#define ACE_DIRENT dirent
typedef DIR ACE_DIR;
#endif /* ACE_LACKS_STRUCT_DIR */
+
#if defined (ACE_LACKS_SCANDIR_PROTOTYPE)
int scandir (const char *,
struct dirent ***,
int (*) (const struct dirent *),
int (*) (const void *, const void *));
#endif /* ACE_LACKS_SCANDIR_PROTOTYPE */
+
#if defined (ACE_LACKS_ALPHASORT_PROTOTYPE)
int alphasort (const void *, const void *);
#endif /* ACE_LACKS_ALPHASORT_PROTOTYPE */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_DIRENT_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_dlfcn.h b/dep/ACE_wrappers/ace/os_include/os_dlfcn.h
index 2b5741d1d9e..f7691ad8a58 100644
--- a/dep/ACE_wrappers/ace/os_include/os_dlfcn.h
+++ b/dep/ACE_wrappers/ace/os_include/os_dlfcn.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_dlfcn.h
@@ -11,16 +12,22 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_DLFCN_H
#define ACE_OS_INCLUDE_OS_DLFCN_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if !defined (ACE_LACKS_DLFCN_H)
# include /**/ <dlfcn.h>
#endif /* !ACE_LACKS_DLFCN_H */
+
#if defined (__hpux)
# if defined(__GNUC__) || __cplusplus >= 199707L
# include /**/ <dl.h>
@@ -28,23 +35,27 @@
# include /**/ <cxxdl.h>
# endif /* (g++ || HP aC++) vs. HP C++ */
#endif /* __hpux */
+
#if defined (ACE_VXWORKS) && !defined (__RTP__)
# include /**/ <loadLib.h> /* for module load */
# include /**/ <unldLib.h> /* for module unload */
# include /**/ <symLib.h> /* for findSymbol */
# include /**/ <sysSymTbl.h> /* for global symbol table */
#endif /* ACE_VXWORKS */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#if defined (_M_UNIX)
int _dlclose (void *);
char *_dlerror (void);
void *_dlopen (const char *, int);
void * _dlsym (void *, const char *);
#endif /* _M_UNIX */
+
/* Set the proper handle type for dynamically-loaded libraries. */
/* Also define a default 'mode' for loading a library - the names and values */
/* differ between OSes, so if you write code that uses the mode, be careful */
@@ -69,18 +80,23 @@ extern "C"
# define ACE_SHLIB_INVALID_HANDLE 0
# define ACE_DEFAULT_SHLIB_MODE RTLD_LAZY
#endif /* ACE_WIN32 */
+
#if !defined (RTLD_LAZY)
#define RTLD_LAZY 1
#endif /* !RTLD_LAZY */
+
#if !defined (RTLD_NOW)
#define RTLD_NOW 2
#endif /* !RTLD_NOW */
+
#if !defined (RTLD_GLOBAL)
#define RTLD_GLOBAL 3
#endif /* !RTLD_GLOBAL */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_DLFCN_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_errno.h b/dep/ACE_wrappers/ace/os_include/os_errno.h
index ec841acd9a5..6534aa8c7c8 100644
--- a/dep/ACE_wrappers/ace/os_include/os_errno.h
+++ b/dep/ACE_wrappers/ace/os_include/os_errno.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_errno.h
@@ -11,25 +12,33 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_ERRNO_H
#define ACE_OS_INCLUDE_OS_ERRNO_H
+
#include /**/ "ace/pre.h"
+
#include "ace/config-lite.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if !defined (ACE_LACKS_ERRNO_H)
# include /**/ <errno.h>
#endif /* !ACE_LACKS_ERRNO_H */
+
#if defined (ACE_VXWORKS)
// Needed for VxWorks to pickup errnoSet()
#include /**/ <errnoLib.h>
#endif /* ACE_VXWORKS */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#if defined (ACE_WIN32)
// error code mapping for windows
# define ETIME ERROR_SEM_TIMEOUT
@@ -72,57 +81,74 @@ extern "C"
// 'standard' library.
// #define ENAMETOOLONG WSAENAMETOOLONG
# define EADDRINUSE WSAEADDRINUSE
+
// CE needs this...
# if !defined (EPERM)
# define EPERM ERROR_ACCESS_DENIED
# endif
#endif /* ACE_WIN32 */
+
#if defined (ACE_HAS_H_ERRNO)
void herror (const char *str);
#endif /* ACE_HAS_H_ERRNO */
+
#if !defined (ACE_WIN32) && defined (ACE_LACKS_T_ERRNO)
extern int t_errno;
#endif /* ACE_WIN32 && ACE_LACKS_T_ERRNO */
+
#if !defined (ENOSYS)
# define ENOSYS EFAULT /* Operation not supported or unknown error. */
#endif /* !ENOSYS */
+
#if !defined (ENOTSUP)
# define ENOTSUP ENOSYS /* Operation not supported. */
#endif /* !ENOTSUP */
+
#if !defined (ESUCCESS)
# define ESUCCESS 0
#endif /* !ESUCCESS */
+
#if !defined (EIDRM)
# define EIDRM 0
#endif /* !EIDRM */
+
#if !defined (ENFILE)
# define ENFILE EMFILE /* No more socket descriptors are available. */
#endif /* !ENFILE */
+
#if !defined (ECOMM)
// Not the same, but ECONNABORTED is provided on NT.
# define ECOMM ECONNABORTED
#endif /* ECOMM */
+
#if !defined (EDEADLK)
# define EDEADLK 1000 /* Some large number.... */
#endif /* !EDEADLK */
+
#if !defined (ENXIO) /* Needed in SOCK_Dgram_Mcast */
# define ENXIO 6
#endif /* ENXIO */
+
#if !defined (ETIMEDOUT) && defined (ETIME)
# define ETIMEDOUT ETIME
#endif /* ETIMEDOUT */
+
#if !defined (ETIME) && defined (ETIMEDOUT)
# define ETIME ETIMEDOUT
#endif /* ETIMED */
+
#if !defined (EBUSY)
# define EBUSY ETIME
#endif /* EBUSY */
+
#if !defined (ECANCELED)
# define ECANCELED 125
#endif /* ECANCELED */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_ERRNO_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_fcntl.h b/dep/ACE_wrappers/ace/os_include/os_fcntl.h
index 1ed31de9022..ad5beeb9511 100644
--- a/dep/ACE_wrappers/ace/os_include/os_fcntl.h
+++ b/dep/ACE_wrappers/ace/os_include/os_fcntl.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_fcntl.h
@@ -11,27 +12,36 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_FCNTL_H
#define ACE_OS_INCLUDE_OS_FCNTL_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/sys/os_stat.h"
#include "ace/os_include/sys/os_types.h"
+
#if !defined (ACE_LACKS_FCNTL_H)
# include /**/ <fcntl.h>
#endif /* !ACE_LACKS_FCNTL_H */
+
#if defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x620)
// for creat(), open()
# include /**/ <ioLib.h>
#endif /* ACE_VXWORKS */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#if defined (__BORLANDC__)
# define _O_CREAT O_CREAT
# define _O_EXCL O_EXCL
@@ -45,9 +55,11 @@ extern "C"
# define _O_BINARY O_BINARY
# define _O_TEXT O_TEXT
#endif /* __BORLANDC__ */
+
#if defined (__DMC__)
# define _O_TEMPORARY 0x08 /* see fcntl.h */
#endif /* __DMC__ */
+
// defined Win32 specific macros for UNIX platforms
#if !defined (O_BINARY)
# define O_BINARY 0
@@ -67,23 +79,29 @@ extern "C"
#if !defined (_O_RAW)
# define _O_RAW O_RAW
#endif /* _O_RAW */
+
#if defined (ACE_WIN32)
# define O_NDELAY 1
#endif /* ACE_WIN32 */
+
# if !defined (O_NONBLOCK)
# define O_NONBLOCK 1
# endif /* O_NONBLOCK */
+
#if defined (ACE_HAS_POSIX_NONBLOCK)
# define ACE_NONBLOCK O_NONBLOCK
#else
# define ACE_NONBLOCK O_NDELAY
#endif /* ACE_HAS_POSIX_NONBLOCK */
+
# if !defined (F_GETFL)
# define F_GETFL 0
# endif /* F_GETFL */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_FCNTL_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_fenv.h b/dep/ACE_wrappers/ace/os_include/os_fenv.h
index cdba3cd5f76..a178c04c91b 100644
--- a/dep/ACE_wrappers/ace/os_include/os_fenv.h
+++ b/dep/ACE_wrappers/ace/os_include/os_fenv.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_fenv.h
@@ -11,24 +12,32 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_FENV_H
#define ACE_OS_INCLUDE_OS_FENV_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if !defined (ACE_LACKS_FENV_H)
# include /**/ <fenv.h>
#endif /* !ACE_LACKS_FENV_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_FENV_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_float.h b/dep/ACE_wrappers/ace/os_include/os_float.h
index accd8468db0..6b114a5dc3e 100644
--- a/dep/ACE_wrappers/ace/os_include/os_float.h
+++ b/dep/ACE_wrappers/ace/os_include/os_float.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_float.h
@@ -11,24 +12,32 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_FLOAT_H
#define ACE_OS_INCLUDE_OS_FLOAT_H
+
#include /**/ "ace/pre.h"
+
#include "ace/config-lite.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if !defined (ACE_LACKS_FLOAT_H)
# include /**/ <float.h>
#endif /* !ACE_LACKS_FLOAT_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_FLOAT_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_fmtmsg.h b/dep/ACE_wrappers/ace/os_include/os_fmtmsg.h
index d747adfcee9..391e8606e27 100644
--- a/dep/ACE_wrappers/ace/os_include/os_fmtmsg.h
+++ b/dep/ACE_wrappers/ace/os_include/os_fmtmsg.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_fmtmsg.h
@@ -11,24 +12,32 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_FMTMSG_H
#define ACE_OS_INCLUDE_OS_FMTMSG_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if !defined (ACE_LACKS_FMTMSG_H)
# include /**/ <fmtmsg.h>
#endif /* !ACE_LACKS_FMTMSG_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_FMTMSG_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_fnmatch.h b/dep/ACE_wrappers/ace/os_include/os_fnmatch.h
index e7e3a49eb7d..2f592ef46e1 100644
--- a/dep/ACE_wrappers/ace/os_include/os_fnmatch.h
+++ b/dep/ACE_wrappers/ace/os_include/os_fnmatch.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_fnmatch.h
@@ -11,24 +12,32 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_FNMATCH_H
#define ACE_OS_INCLUDE_OS_FNMATCH_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if !defined (ACE_LACKS_FNMATCH_H)
# include /**/ <fnmatch.h>
#endif /* !ACE_LACKS_FNMATCH_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_FNMATCH_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_ftw.h b/dep/ACE_wrappers/ace/os_include/os_ftw.h
index e687b4e35ea..ab4655f241b 100644
--- a/dep/ACE_wrappers/ace/os_include/os_ftw.h
+++ b/dep/ACE_wrappers/ace/os_include/os_ftw.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_ftw.h
@@ -11,25 +12,34 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_FTW_H
#define ACE_OS_INCLUDE_OS_FTW_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/sys/os_stat.h"
+
#if !defined (ACE_LACKS_FTW_H)
# include /**/ <ftw.h>
#endif /* !ACE_LACKS_FTW_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_FTW_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_glob.h b/dep/ACE_wrappers/ace/os_include/os_glob.h
index d02b2fd6dd6..2ffdbab53e6 100644
--- a/dep/ACE_wrappers/ace/os_include/os_glob.h
+++ b/dep/ACE_wrappers/ace/os_include/os_glob.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_glob.h
@@ -11,24 +12,32 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_GLOB_H
#define ACE_OS_INCLUDE_OS_GLOB_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if !defined (ACE_LACKS_GLOB_H)
# include /**/ <glob.h>
#endif /* !ACE_LACKS_GLOB_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_GLOB_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_grp.h b/dep/ACE_wrappers/ace/os_include/os_grp.h
index 173f8bee4f5..bc0741e9de2 100644
--- a/dep/ACE_wrappers/ace/os_include/os_grp.h
+++ b/dep/ACE_wrappers/ace/os_include/os_grp.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_grp.h
@@ -11,25 +12,34 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_GRP_H
#define ACE_OS_INCLUDE_OS_GRP_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/sys/os_types.h" // for gid_t
+
#if !defined (ACE_LACKS_GRP_H)
# include /**/ <grp.h>
#endif /* !ACE_LACKS_GRP_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_GRP_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_iconv.h b/dep/ACE_wrappers/ace/os_include/os_iconv.h
index cfb32ef11b7..14a69870112 100644
--- a/dep/ACE_wrappers/ace/os_include/os_iconv.h
+++ b/dep/ACE_wrappers/ace/os_include/os_iconv.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_iconv.h
@@ -11,25 +12,34 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_ICONV_H
#define ACE_OS_INCLUDE_OS_ICONV_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/sys/os_types.h"
+
#if !defined (ACE_LACKS_ICONV_H)
# include /**/ <iconv.h>
#endif /* !ACE_LACKS_ICONV_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_ICONV_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_intrin.h b/dep/ACE_wrappers/ace/os_include/os_intrin.h
index 1b02b8f4d23..d56951b6b57 100644
--- a/dep/ACE_wrappers/ace/os_include/os_intrin.h
+++ b/dep/ACE_wrappers/ace/os_include/os_intrin.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_intrin.h
@@ -10,27 +11,36 @@
* @author Johnny Willemsen <jwillemsen@remedy.nl>
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_INTRIN_H
#define ACE_OS_INCLUDE_OS_INTRIN_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_INTRIN_H)
# include /**/ <intrin.h>
#endif /* !ACE_HAS_INTRIN_H */
+
#if defined (ACE_HAS_IA64INTRIN_H)
# include /**/ <ia64intrin.h>
#endif /* !ACE_HAS_IA64INTRIN_H */
+
#if defined (ACE_HAS_IA32INTRIN_H)
# include /**/ <ia32intrin.h>
#endif /* !ACE_HAS_IA32INTRIN_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#if defined (_MSC_VER) && (_MSC_VER < 1400) && !(defined (__INTEL_COMPILER) && (__INTEL_COMPILER == 900))
// See http://msdn2.microsoft.com/en-us/library/f24ya7ct(VS.71).aspx
LONG __cdecl _InterlockedIncrement (LONG volatile *Addend);
@@ -38,9 +48,11 @@ LONG __cdecl _InterlockedDecrement (LONG volatile *Addend);
LONG __cdecl _InterlockedExchange (LONG volatile *Target, LONG Value);
LONG __cdecl _InterlockedExchangeAdd (LONG volatile *Addend, LONG Value);
#endif //_MSC_VER
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_INTRIN_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_inttypes.h b/dep/ACE_wrappers/ace/os_include/os_inttypes.h
index 8cf01535d58..86105a723a6 100644
--- a/dep/ACE_wrappers/ace/os_include/os_inttypes.h
+++ b/dep/ACE_wrappers/ace/os_include/os_inttypes.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_inttypes.h
@@ -11,26 +12,36 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_INTTYPES_H
#define ACE_OS_INCLUDE_OS_INTTYPES_H
+
#include /**/ "ace/pre.h"
+
#include "ace/config-lite.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/os_stdint.h"
+
#if !defined (ACE_LACKS_INTTYPES_H)
# include /**/ <inttypes.h>
#endif /* !ACE_LACKS_INTTYPES_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
// @todo if needbe, we can define the macros if they aren't available.
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_INTTYPES_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_iso646.h b/dep/ACE_wrappers/ace/os_include/os_iso646.h
index 54a1775ea3d..bccc85f17ad 100644
--- a/dep/ACE_wrappers/ace/os_include/os_iso646.h
+++ b/dep/ACE_wrappers/ace/os_include/os_iso646.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_iso646.h
@@ -11,24 +12,32 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_ISO646_H
#define ACE_OS_INCLUDE_OS_ISO646_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if !defined (ACE_LACKS_ISO646_H)
# include /**/ <iso646.h>
#endif /* !ACE_LACKS_ISO646_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_ISO646_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_kstat.h b/dep/ACE_wrappers/ace/os_include/os_kstat.h
index bb1349d83bb..5ca91673d8e 100644
--- a/dep/ACE_wrappers/ace/os_include/os_kstat.h
+++ b/dep/ACE_wrappers/ace/os_include/os_kstat.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_kstat.h
@@ -8,27 +9,36 @@
* @author Johnny Willemsen <jwillemsen@remedy.nl>
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_KSTAT_H
#define ACE_OS_INCLUDE_OS_KSTAT_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_KSTAT)
# define ACE_HAS_KSTAT_H
#endif /* ACE_HAS_KSTAT */
+
#if defined (ACE_HAS_KSTAT_H)
# include <kstat.h>
#endif /* ACE_HAS_KSTAT_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_KSTAT_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_langinfo.h b/dep/ACE_wrappers/ace/os_include/os_langinfo.h
index 4646849fc1d..29648b459d8 100644
--- a/dep/ACE_wrappers/ace/os_include/os_langinfo.h
+++ b/dep/ACE_wrappers/ace/os_include/os_langinfo.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_langinfo.h
@@ -11,25 +12,34 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_LANGINFO_H
#define ACE_OS_INCLUDE_OS_LANGINFO_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/os_nl_types.h"
+
#if !defined (ACE_LACKS_LANGINFO_H)
# include /**/ <langinfo.h>
#endif /* !ACE_LACKS_LANGINFO_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_LANGINFO_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_libgen.h b/dep/ACE_wrappers/ace/os_include/os_libgen.h
index 2e6aac3e3e6..5692f5effe1 100644
--- a/dep/ACE_wrappers/ace/os_include/os_libgen.h
+++ b/dep/ACE_wrappers/ace/os_include/os_libgen.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_libgen.h
@@ -11,24 +12,32 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_LIBGEN_H
#define ACE_OS_INCLUDE_OS_LIBGEN_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if !defined (ACE_LACKS_LIBGEN_H)
# include /**/ <libgen.h>
#endif /* !ACE_LACKS_LIBGEN_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_LIBGEN_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_local.h b/dep/ACE_wrappers/ace/os_include/os_local.h
index 014bf4d5521..64ff0d4d06f 100644
--- a/dep/ACE_wrappers/ace/os_include/os_local.h
+++ b/dep/ACE_wrappers/ace/os_include/os_local.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_local.h
@@ -11,25 +12,34 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_LOCAL_H
#define ACE_OS_INCLUDE_OS_LOCAL_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/os_stddef.h"
+
#if !defined (ACE_LACKS_LOCAL_H)
# include /**/ <local.h>
#endif /* !ACE_LACKS_LOCAL_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_LOCAL_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_math.h b/dep/ACE_wrappers/ace/os_include/os_math.h
index cd646baaddf..8a1fcd84790 100644
--- a/dep/ACE_wrappers/ace/os_include/os_math.h
+++ b/dep/ACE_wrappers/ace/os_include/os_math.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_math.h
@@ -11,25 +12,34 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_MATH_H
#define ACE_OS_INCLUDE_OS_MATH_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
// FUZZ: disable check_for_math_include
+
#if !defined (ACE_LACKS_MATH_H)
# include /**/ <math.h>
#endif /* !ACE_LACKS_MATH_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_MATH_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_monetary.h b/dep/ACE_wrappers/ace/os_include/os_monetary.h
index a7e8441929a..731dbc11210 100644
--- a/dep/ACE_wrappers/ace/os_include/os_monetary.h
+++ b/dep/ACE_wrappers/ace/os_include/os_monetary.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_monetary.h
@@ -11,25 +12,34 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_MONETARY_H
#define ACE_OS_INCLUDE_OS_MONETARY_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/sys/os_types.h"
+
#if !defined (ACE_LACKS_MONETARY_H)
# include /**/ <monetary.h>
#endif /* !ACE_LACKS_MONETARY_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_MONETARY_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_mqueue.h b/dep/ACE_wrappers/ace/os_include/os_mqueue.h
index 784d02db00f..186d10697e8 100644
--- a/dep/ACE_wrappers/ace/os_include/os_mqueue.h
+++ b/dep/ACE_wrappers/ace/os_include/os_mqueue.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_mqueue.h
@@ -11,25 +12,34 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_MQUEUE_H
#define ACE_OS_INCLUDE_OS_MQUEUE_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/os_signal.h"
+
#if !defined (ACE_LACKS_MQUEUE_H)
# include /**/ <mqueue.h>
#endif /* !ACE_LACKS_MQUEUE_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_MQUEUE_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_ndbm.h b/dep/ACE_wrappers/ace/os_include/os_ndbm.h
index 95c7cb35d4d..f3decb0064f 100644
--- a/dep/ACE_wrappers/ace/os_include/os_ndbm.h
+++ b/dep/ACE_wrappers/ace/os_include/os_ndbm.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_ndbm.h
@@ -11,25 +12,34 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_NDBM_H
#define ACE_OS_INCLUDE_OS_NDBM_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/sys/os_types.h"
+
#if !defined (ACE_LACKS_NDBM_H)
# include /**/ <ndbm.h>
#endif /* !ACE_LACKS_NDBM_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_NDBM_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_netdb.h b/dep/ACE_wrappers/ace/os_include/os_netdb.h
index 47335ce58f9..7c08f6df081 100644
--- a/dep/ACE_wrappers/ace/os_include/os_netdb.h
+++ b/dep/ACE_wrappers/ace/os_include/os_netdb.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_netdb.h
@@ -11,15 +12,21 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_NETDB_H
#define ACE_OS_INCLUDE_OS_NETDB_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/netinet/os_in.h"
#include "ace/os_include/os_limits.h"
+
#if !defined (ACE_LACKS_NETDB_H)
# if defined (ACE_HAS_STL_QUEUE_CONFLICT)
# define queue _Queue_
@@ -31,14 +38,17 @@
# undef queue
# endif /* ACE_HAS_STL_QUEUE_CONFLICT */
#endif /* !ACE_LACKS_NETDB_H */
+
#if defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x620)
# include /**/ <hostLib.h>
#endif /* ACE_VXWORKS */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#if defined (ACE_LACKS_HOSTENT)
struct hostent {
char *h_name; /* official name of host */
@@ -49,6 +59,7 @@ struct hostent {
#define h_addr h_addr_list[0] /* address, for backward compatibility */
};
#endif /* ACE_LACKS_HOSTENT */
+
#if defined (ACE_LACKS_PROTOENT)
struct protoent {
char *p_name; /* official protocol name */
@@ -56,6 +67,7 @@ struct protoent {
int p_proto; /* protocol # */
};
#endif /* ACE_LACKS_PROTOENT */
+
#if defined (ACE_LACKS_SERVENT)
struct servent {
char *s_name; /* official service name */
@@ -64,6 +76,7 @@ struct servent {
char *s_proto; /* protocol to use */
};
#endif /* ACE_LACKS_SERVENT */
+
#if defined (ACE_HAS_STRUCT_NETDB_DATA)
typedef char ACE_HOSTENT_DATA[sizeof(struct hostent_data)];
typedef char ACE_SERVENT_DATA[sizeof(struct servent_data)];
@@ -82,12 +95,15 @@ struct servent {
typedef char ACE_SERVENT_DATA[ACE_SERVENT_DATA_SIZE];
typedef char ACE_PROTOENT_DATA[ACE_PROTOENT_DATA_SIZE];
#endif /* ACE_HAS_STRUCT_NETDB_DATA */
+
# if !defined(MAXHOSTNAMELEN)
# define MAXHOSTNAMELEN HOST_NAME_MAX
# endif /* MAXHOSTNAMELEN */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_NETDB_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_nl_types.h b/dep/ACE_wrappers/ace/os_include/os_nl_types.h
index 33c9e66e23a..2b14f55c7ec 100644
--- a/dep/ACE_wrappers/ace/os_include/os_nl_types.h
+++ b/dep/ACE_wrappers/ace/os_include/os_nl_types.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_nl_types.h
@@ -11,24 +12,32 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_NL_TYPES_H
#define ACE_OS_INCLUDE_OS_NL_TYPES_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if !defined (ACE_LACKS_NL_TYPES_H)
# include /**/ <nl_types.h>
#endif /* !ACE_LACKS_nl_types_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_NL_TYPES_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_pdh.h b/dep/ACE_wrappers/ace/os_include/os_pdh.h
index 45110347ce2..4dd5b582f31 100644
--- a/dep/ACE_wrappers/ace/os_include/os_pdh.h
+++ b/dep/ACE_wrappers/ace/os_include/os_pdh.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_pdh.h
@@ -10,27 +11,36 @@
* @author Johnny Willemsen <jwillemsen@remedy.nl>
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_PDH_H
#define ACE_OS_INCLUDE_OS_PDH_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_PDH_H) && !defined (ACE_LACKS_PDH_H)
# include /**/ <pdh.h>
#endif /* ACE_HAS_PDH_H && !ACE_LACKS_PDH_H */
+
#if defined (ACE_HAS_PDH_H) && !defined (ACE_LACKS_PDH_H)
# define ACE_HAS_WIN32_PDH
#endif
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_PDH_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_pdhmsg.h b/dep/ACE_wrappers/ace/os_include/os_pdhmsg.h
index 493b1cd4922..4bd09ba9d54 100644
--- a/dep/ACE_wrappers/ace/os_include/os_pdhmsg.h
+++ b/dep/ACE_wrappers/ace/os_include/os_pdhmsg.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_pdhmsg.h
@@ -10,24 +11,32 @@
* @author Johnny Willemsen <jwillemsen@remedy.nl>
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_PDHMSG_H
#define ACE_OS_INCLUDE_OS_PDHMSG_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_PDHMSG_H) && !defined (ACE_LACKS_PDHMSG_H)
# include /**/ <pdhmsg.h>
#endif /* ACE_HAS_PDH_H && !ACE_LACKS_PDH_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_PDHMSG_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_poll.h b/dep/ACE_wrappers/ace/os_include/os_poll.h
index 359c5b38b94..e9597e5d50e 100644
--- a/dep/ACE_wrappers/ace/os_include/os_poll.h
+++ b/dep/ACE_wrappers/ace/os_include/os_poll.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_poll.h
@@ -11,24 +12,32 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_POLL_H
#define ACE_OS_INCLUDE_OS_POLL_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if !defined (ACE_LACKS_POLL_H)
# include /**/ <poll.h>
#endif /* !ACE_LACKS_POLL_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_POLL_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_pthread.h b/dep/ACE_wrappers/ace/os_include/os_pthread.h
index 24e1606f17b..6556a64576d 100644
--- a/dep/ACE_wrappers/ace/os_include/os_pthread.h
+++ b/dep/ACE_wrappers/ace/os_include/os_pthread.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_pthread.h
@@ -11,24 +12,32 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_PTHREAD_H
#define ACE_OS_INCLUDE_OS_PTHREAD_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_PRIOCNTL)
// Need to #include thread.h before #defining THR_BOUND, etc.,
// when building without threads on SunOS 5.x.
# if defined (sun)
# include /**/ <thread.h>
# endif /* sun */
+
// Need to #include these before #defining USYNC_PROCESS on SunOS 5.x.
# include /**/ <sys/rtpriocntl.h>
# include /**/ <sys/tspriocntl.h>
#endif /* ACE_HAS_PRIOCNTL */
+
#include "ace/os_include/sys/os_types.h"
+
// This needs to go here *first* to avoid problems with AIX.
# if defined (ACE_HAS_PTHREADS)
# define ACE_DONT_INCLUDE_ACE_SIGNAL_H
@@ -40,6 +49,7 @@ extern "C" pthread_t pthread_self (void);
# endif /* DIGITAL_UNIX */
# endif /* ACE_HAS_PTHREADS */
+
#if !defined (ACE_LACKS_PTHREAD_H)
extern "C" {
# if defined (ACE_TANDEM_T1248_PTHREADS)
@@ -49,21 +59,25 @@ extern "C" pthread_t pthread_self (void);
# endif
}
#endif /* !ACE_LACKS_PTHREAD_H */
+
#if defined (ACE_HAS_PTHREAD_NP_H)
// FreeBSD declares _np (non-portable) pthread extensions in <pthread_np.h>
# include /**/ <pthread_np.h>
#endif
+
// @todo: need to reoganize to put includes at the top and the rest of the
// code at the bottom. Also, move the classes out of this file.
#if defined (ACE_HAS_PTHREADS)
# define ACE_SCHED_OTHER SCHED_OTHER
# define ACE_SCHED_FIFO SCHED_FIFO
# define ACE_SCHED_RR SCHED_RR
+
// Definitions for THREAD- and PROCESS-LEVEL priorities...some
// implementations define these while others don't. In order to
// further complicate matters, we don't redefine the default (*_DEF)
// values if they've already been defined, which allows individual
// programs to have their own ACE-wide "default".
+
// PROCESS-level values
# if (defined (_POSIX_PRIORITY_SCHEDULING) || defined (ACE_TANDEM_T1248_PTHREADS)) \
&& !defined(_UNICOS) && !defined(UNIXWARE_7_1)
@@ -86,6 +100,7 @@ extern "C" pthread_t pthread_self (void);
# define ACE_PROC_PRI_RR_MIN 0
# define ACE_PROC_PRI_OTHER_MIN 0
# endif
+
# if defined (_POSIX_PRIORITY_SCHEDULING) && !defined(UNIXWARE_7_1)
# define ACE_PROC_PRI_FIFO_MAX (sched_get_priority_max(SCHED_FIFO))
# define ACE_PROC_PRI_RR_MAX (sched_get_priority_max(SCHED_RR))
@@ -100,6 +115,7 @@ extern "C" pthread_t pthread_self (void);
# define ACE_PROC_PRI_RR_MAX 59
# define ACE_PROC_PRI_OTHER_MAX 59
# endif
+
# if !defined(ACE_PROC_PRI_FIFO_DEF)
# define ACE_PROC_PRI_FIFO_DEF (ACE_PROC_PRI_FIFO_MIN + (ACE_PROC_PRI_FIFO_MAX - ACE_PROC_PRI_FIFO_MIN)/2)
# endif
@@ -109,6 +125,7 @@ extern "C" pthread_t pthread_self (void);
# if !defined(ACE_PROC_PRI_OTHER_DEF)
# define ACE_PROC_PRI_OTHER_DEF (ACE_PROC_PRI_OTHER_MIN + (ACE_PROC_PRI_OTHER_MAX - ACE_PROC_PRI_OTHER_MIN)/2)
# endif
+
// THREAD-level values
# if defined(PRI_FIFO_MIN) && defined(PRI_FIFO_MAX) && defined(PRI_RR_MIN) && defined(PRI_RR_MAX) && defined(PRI_OTHER_MIN) && defined(PRI_OTHER_MAX)
# if !defined (ACE_THR_PRI_FIFO_MIN)
@@ -204,6 +221,7 @@ extern "C" pthread_t pthread_self (void);
// Typedefs to help compatibility with Windows NT and Pthreads.
typedef pthread_t ACE_hthread_t;
typedef pthread_t ACE_thread_t;
+
// native TSS key type
typedef pthread_key_t ACE_OS_thread_key_t;
// TSS key type to be used by application
@@ -212,6 +230,7 @@ extern "C" pthread_t pthread_self (void);
# else /* ! ACE_HAS_TSS_EMULATION */
typedef ACE_OS_thread_key_t ACE_thread_key_t;
# endif /* ! ACE_HAS_TSS_EMULATION */
+
# if !defined (ACE_LACKS_COND_T)
typedef pthread_mutex_t ACE_mutex_t;
typedef pthread_cond_t ACE_cond_t;
@@ -219,22 +238,28 @@ extern "C" pthread_t pthread_self (void);
typedef pthread_mutexattr_t ACE_mutexattr_t;
# endif /* ! ACE_LACKS_COND_T */
typedef pthread_mutex_t ACE_thread_mutex_t;
+
# if !defined (PTHREAD_CANCEL_DISABLE)
# define PTHREAD_CANCEL_DISABLE 0
# endif /* PTHREAD_CANCEL_DISABLE */
+
# if !defined (PTHREAD_CANCEL_ENABLE)
# define PTHREAD_CANCEL_ENABLE 0
# endif /* PTHREAD_CANCEL_ENABLE */
+
# if !defined (PTHREAD_CANCEL_DEFERRED)
# define PTHREAD_CANCEL_DEFERRED 0
# endif /* PTHREAD_CANCEL_DEFERRED */
+
# if !defined (PTHREAD_CANCEL_ASYNCHRONOUS)
# define PTHREAD_CANCEL_ASYNCHRONOUS 0
# endif /* PTHREAD_CANCEL_ASYNCHRONOUS */
+
# define THR_CANCEL_DISABLE PTHREAD_CANCEL_DISABLE
# define THR_CANCEL_ENABLE PTHREAD_CANCEL_ENABLE
# define THR_CANCEL_DEFERRED PTHREAD_CANCEL_DEFERRED
# define THR_CANCEL_ASYNCHRONOUS PTHREAD_CANCEL_ASYNCHRONOUS
+
# if !defined (PTHREAD_CREATE_JOINABLE)
# if defined (PTHREAD_CREATE_UNDETACHED)
# define PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED
@@ -242,9 +267,11 @@ extern "C" pthread_t pthread_self (void);
# define PTHREAD_CREATE_JOINABLE 0
# endif /* PTHREAD_CREATE_UNDETACHED */
# endif /* PTHREAD_CREATE_JOINABLE */
+
# if !defined (PTHREAD_CREATE_DETACHED)
# define PTHREAD_CREATE_DETACHED 1
# endif /* PTHREAD_CREATE_DETACHED */
+
# if !defined (PTHREAD_PROCESS_PRIVATE) && !defined (ACE_HAS_PTHREAD_PROCESS_ENUM)
# if defined (PTHREAD_MUTEXTYPE_FAST)
# define PTHREAD_PROCESS_PRIVATE PTHREAD_MUTEXTYPE_FAST
@@ -252,6 +279,7 @@ extern "C" pthread_t pthread_self (void);
# define PTHREAD_PROCESS_PRIVATE 0
# endif /* PTHREAD_MUTEXTYPE_FAST */
# endif /* PTHREAD_PROCESS_PRIVATE */
+
# if !defined (PTHREAD_PROCESS_SHARED) && !defined (ACE_HAS_PTHREAD_PROCESS_ENUM)
# if defined (PTHREAD_MUTEXTYPE_FAST)
# define PTHREAD_PROCESS_SHARED PTHREAD_MUTEXTYPE_FAST
@@ -259,6 +287,7 @@ extern "C" pthread_t pthread_self (void);
# define PTHREAD_PROCESS_SHARED 1
# endif /* PTHREAD_MUTEXTYPE_FAST */
# endif /* PTHREAD_PROCESS_SHARED */
+
# if !defined (ACE_HAS_STHREADS)
# if !defined (USYNC_THREAD)
# define USYNC_THREAD PTHREAD_PROCESS_PRIVATE
@@ -267,6 +296,7 @@ extern "C" pthread_t pthread_self (void);
# define USYNC_PROCESS PTHREAD_PROCESS_SHARED
# endif /* ! USYNC_PROCESS */
# endif /* ACE_HAS_STHREADS */
+
/* MM-Graz: prevent warnings */
# if !defined (UNIXWARE_7_1)
# undef THR_BOUND
@@ -274,6 +304,7 @@ extern "C" pthread_t pthread_self (void);
# undef THR_DETACHED
# undef THR_SUSPENDED
# undef THR_DAEMON
+
# define THR_BOUND 0x00000001
# define THR_NEW_LWP 0x00000002
# define THR_DETACHED 0x00000040
@@ -283,18 +314,23 @@ extern "C" pthread_t pthread_self (void);
# define THR_SCHED_RR 0x00040000
# define THR_SCHED_DEFAULT 0x00080000
# endif /* UNIXWARE_7_1 */
+
# define THR_JOINABLE 0x00010000
+
# if defined (ACE_HAS_IRIX62_THREADS)
# define THR_SCOPE_SYSTEM 0x00100000
# else
# define THR_SCOPE_SYSTEM THR_BOUND
# endif /*ACE_HAS_IRIX62_THREADS*/
+
# define THR_SCOPE_PROCESS 0x00200000
# define THR_INHERIT_SCHED 0x00400000
# define THR_EXPLICIT_SCHED 0x00800000
# define THR_SCHED_IO 0x01000000
+
# if !defined (ACE_HAS_STHREADS)
# if !defined (ACE_HAS_POSIX_SEM) && !defined (ACE_USES_FIFO_SEM)
+
// This needs to be moved out of here.
#include /**/ "ace/ACE_export.h"
/**
@@ -309,14 +345,18 @@ class ACE_Export ACE_sema_t
public:
/// Serialize access to internal state.
ACE_mutex_t lock_;
+
/// Block until there are no waiters.
ACE_cond_t count_nonzero_;
+
/// Count of the semaphore.
u_long count_;
+
/// Number of threads that have called <ACE_OS::sema_wait>.
u_long waiters_;
};
# endif /* !ACE_HAS_POSIX_SEM */
+
# if defined (ACE_LACKS_PTHREAD_YIELD) && defined (ACE_HAS_THR_YIELD)
// If we are on Solaris we can just reuse the existing
// implementations of these synchronization types.
@@ -326,23 +366,29 @@ public:
# endif /* !ACE_LACKS_RWLOCK_T */
# include /**/ <thread.h>
# endif /* (ACE_LACKS_PTHREAD_YIELD) && defined (ACE_HAS_THR_YIELD) */
+
# else
# if !defined (ACE_HAS_POSIX_SEM)
typedef sema_t ACE_sema_t;
# endif /* !ACE_HAS_POSIX_SEM */
# endif /* !ACE_HAS_STHREADS */
+
# if defined (ACE_HAS_PTHREADS_UNIX98_EXT)
typedef pthread_rwlock_t ACE_rwlock_t;
# endif /* ACE_HAS_PTHREADS_UNIX98_EXT */
+
# if defined (__GLIBC__) && ((__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2))
+
// glibc 2.2.x or better has pthread_mutex_timedlock()
# ifndef ACE_HAS_MUTEX_TIMEOUTS
# define ACE_HAS_MUTEX_TIMEOUTS
# endif /* ACE_HAS_MUTEX_TIMEOUTS */
+
// Use new pthread_attr_setstack if XPG6 support is enabled.
# if defined (_XOPEN_SOURCE) && (_XOPEN_SOURCE - 0) < 600
# define ACE_LACKS_PTHREAD_ATTR_SETSTACK
# endif /* (_XOPEN_SOURCE - 0) < 600 */
+
# if !defined (_XOPEN_SOURCE) \
|| (defined (_XOPEN_SOURCE) && (_XOPEN_SOURCE - 0) < 600)
// pthread_mutex_timedlock() prototype is not visible if _XOPEN_SOURCE
@@ -350,7 +396,9 @@ public:
extern "C" int pthread_mutex_timedlock (pthread_mutex_t *mutex,
const struct timespec * abstime);
# endif /* _XOPEN_SOURCE && _XOPEN_SOURCE < 600 */
+
# endif /* linux && ((__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)) */
+
#elif defined (ACE_HAS_STHREADS)
# if !defined (ACE_THR_PRI_FIFO_MIN)
# define ACE_THR_PRI_FIFO_MIN (long) 0
@@ -371,6 +419,7 @@ public:
# define ACE_THR_PRI_OTHER_MAX (long) 127
# endif /* !ACE_THR_PRI_OTHER_MAX */
#endif /* ACE_HAS_PTHREADS */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_PTHREAD_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_pwd.h b/dep/ACE_wrappers/ace/os_include/os_pwd.h
index 71f510aed7f..f3cba066af9 100644
--- a/dep/ACE_wrappers/ace/os_include/os_pwd.h
+++ b/dep/ACE_wrappers/ace/os_include/os_pwd.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_pwd.h
@@ -11,22 +12,30 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_PWD_H
#define ACE_OS_INCLUDE_OS_PWD_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/sys/os_types.h"
+
#if !defined (ACE_LACKS_PWD_H)
# include /**/ <pwd.h>
#endif /* !ACE_LACKS_PWD_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#if !defined (ACE_WIN32)
// VAC++ doesn't correctly grok the ::getpwnam_r - the function is redefined
// in pwd.h, and that redefinition is used here
@@ -35,13 +44,16 @@ extern "C"
int, struct passwd **);
# endif /* AIX and VAC++ 4 */
#endif /* !ACE_WIN32 */
+
#if defined (DIGITAL_UNIX)
extern int _Pgetpwnam_r (const char *, struct passwd *,
char *, size_t, struct passwd **);
#endif /* DIGITAL_UNIX */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_PWD_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_regex.h b/dep/ACE_wrappers/ace/os_include/os_regex.h
index 265d34843e6..94606e45e58 100644
--- a/dep/ACE_wrappers/ace/os_include/os_regex.h
+++ b/dep/ACE_wrappers/ace/os_include/os_regex.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_regex.h
@@ -11,28 +12,38 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_REGEX_H
#define ACE_OS_INCLUDE_OS_REGEX_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/sys/os_types.h"
+
#if !defined (ACE_LACKS_REGEX_H)
# include /**/ <regex.h>
#endif /* !ACE_LACKS_REGEX_H */
+
#if defined (ACE_HAS_REGEX)
# include /**/ <regexpr.h>
#endif /* ACE_HAS_REGEX */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_REGEX_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_sched.h b/dep/ACE_wrappers/ace/os_include/os_sched.h
index 2d4030ea356..15279dbeef3 100644
--- a/dep/ACE_wrappers/ace/os_include/os_sched.h
+++ b/dep/ACE_wrappers/ace/os_include/os_sched.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_sched.h
@@ -11,22 +12,30 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_SCHED_H
#define ACE_OS_INCLUDE_OS_SCHED_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/os_time.h"
+
#if !defined (ACE_LACKS_SCHED_H)
# include /**/ <sched.h>
#endif /* !ACE_LACKS_SCHED_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#if !defined (__cpu_set_t_defined) || !defined (ACE_HAS_CPU_SET_T)
# define ACE_CPU_SETSIZE 1024
typedef struct
@@ -34,9 +43,11 @@ extern "C"
ACE_UINT32 bit_array_[ACE_CPU_SETSIZE / (8 * sizeof (ACE_UINT32))];
} cpu_set_t;
#endif /* !ACE_HAS_CPU_SET_T || !__cpu_set_t_defined */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_SCHED_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_search.h b/dep/ACE_wrappers/ace/os_include/os_search.h
index 5768092120e..b67d902e9af 100644
--- a/dep/ACE_wrappers/ace/os_include/os_search.h
+++ b/dep/ACE_wrappers/ace/os_include/os_search.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_search.h
@@ -11,25 +12,34 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_SEARCH_H
#define ACE_OS_INCLUDE_OS_SEARCH_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/sys/os_types.h"
+
#if !defined (ACE_LACKS_SEARCH_H)
# include /**/ <search.h>
#endif /* !ACE_LACKS_SEARCH_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_SEARCH_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_semaphore.h b/dep/ACE_wrappers/ace/os_include/os_semaphore.h
index f8dbd7c6bcf..e6ae6b19b40 100644
--- a/dep/ACE_wrappers/ace/os_include/os_semaphore.h
+++ b/dep/ACE_wrappers/ace/os_include/os_semaphore.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_semaphore.h
@@ -11,52 +12,67 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_SEMAPHORE_H
#define ACE_OS_INCLUDE_OS_SEMAPHORE_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/os_time.h"
+
#if !defined (ACE_LACKS_SEMAPHORE_H)
# include /**/ <semaphore.h>
#endif /* !ACE_LACKS_SEMAPHORE_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#if defined (ACE_HAS_POSIX_SEM)
# if !defined (SEM_FAILED) && !defined (ACE_LACKS_NAMED_POSIX_SEM)
# define SEM_FAILED ((sem_t *) -1)
# endif /* !SEM_FAILED */
+
typedef struct
{
/// Pointer to semaphore handle. This is allocated by ACE if we are
/// working with an unnamed POSIX semaphore or by the OS if we are
/// working with a named POSIX semaphore.
sem_t *sema_;
+
/// Name of the semaphore (if this is non-NULL then this is a named
/// POSIX semaphore, else its an unnamed POSIX semaphore).
char *name_;
+
# if defined (ACE_LACKS_NAMED_POSIX_SEM)
/// this->sema_ doesn't always get created dynamically if a platform
/// doesn't support named posix semaphores. We use this flag to
/// remember if we need to delete <sema_> or not.
bool new_sema_;
# endif /* ACE_LACKS_NAMED_POSIX_SEM */
+
# if !defined (ACE_HAS_POSIX_SEM_TIMEOUT) && !defined (ACE_DISABLE_POSIX_SEM_TIMEOUT_EMULATION)
/// Serialize access to internal state.
ACE_mutex_t lock_;
+
/// Block until there are no waiters.
ACE_cond_t count_nonzero_;
# endif /* !ACE_HAS_POSIX_SEM_TIMEOUT && !ACE_DISABLE_POSIX_SEM_TIMEOUT_EMULATION */
} ACE_sema_t;
#endif /* ACE_HAS_POSIX_SEM */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_SEMAPHORE_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_setjmp.h b/dep/ACE_wrappers/ace/os_include/os_setjmp.h
index 5310b2a6243..e5261965cd8 100644
--- a/dep/ACE_wrappers/ace/os_include/os_setjmp.h
+++ b/dep/ACE_wrappers/ace/os_include/os_setjmp.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_setjmp.h
@@ -11,24 +12,32 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_SETJMP_H
#define ACE_OS_INCLUDE_OS_SETJMP_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if !defined (ACE_LACKS_SETJMP_H)
# include /**/ <setjmp.h>
#endif /* !ACE_LACKS_SETJMP_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_SETJMP_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_signal.h b/dep/ACE_wrappers/ace/os_include/os_signal.h
index 1d84c0c430b..029e5553921 100644
--- a/dep/ACE_wrappers/ace/os_include/os_signal.h
+++ b/dep/ACE_wrappers/ace/os_include/os_signal.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_signal.h
@@ -11,24 +12,32 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_SIGNAL_H
#define ACE_OS_INCLUDE_OS_SIGNAL_H
+
#include /**/ "ace/pre.h"
+
#include "ace/config-lite.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/sys/os_types.h"
+
#if !defined (ACE_LACKS_SIGNAL_H)
extern "C" {
# include /**/ <signal.h>
}
#endif /* !ACE_LACKS_SIGNAL_H */
+
// This must come after signal.h is #included.
#if defined (SCO)
# define SIGIO SIGPOLL
# include /**/ <sys/regset.h>
#endif /* SCO */
+
#if defined (ACE_HAS_SIGINFO_T)
# if !defined (ACE_LACKS_SIGINFO_H)
# if defined (__QNX__) || defined (__OpenBSD__) || defined (__INTERIX)
@@ -38,17 +47,21 @@
# endif /* __QNX__ || __OpenBSD__ */
# endif /* ACE_LACKS_SIGINFO_H */
#endif /* ACE_HAS_SIGINFO_T */
+
#if defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x620) && !defined (__RTP__)
# include /**/ <sigLib.h>
#endif /* ACE_VXWORKS */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#if defined (ACE_LACKS_SIGSET)
typedef u_int sigset_t;
#endif /* ACE_LACKS_SIGSET */
+
#if defined (ACE_HAS_SIG_MACROS)
# undef sigemptyset
# undef sigfillset
@@ -56,6 +69,7 @@ extern "C"
# undef sigdelset
# undef sigismember
#endif /* ACE_HAS_SIG_MACROS */
+
// This must come after signal.h is #included. It's to counteract
// the sigemptyset and sigfillset #defines, which only happen
// when __OPTIMIZE__ is #defined (really!) on Linux.
@@ -63,57 +77,75 @@ extern "C"
# undef sigemptyset
# undef sigfillset
#endif /* linux && __OPTIMIZE__ */
+
#if !defined (ACE_HAS_SIG_ATOMIC_T)
typedef int sig_atomic_t;
#endif /* !ACE_HAS_SIG_ATOMIC_T */
+
# if !defined (SA_SIGINFO)
# define SA_SIGINFO 0
# endif /* SA_SIGINFO */
+
# if !defined (SA_RESTART)
# define SA_RESTART 0
# endif /* SA_RESTART */
+
#if !defined (SIGHUP)
# define SIGHUP 0
#endif /* SIGHUP */
+
#if !defined (SIGINT)
# define SIGINT 0
#endif /* SIGINT */
+
#if !defined (SIGSEGV)
# define SIGSEGV 0
#endif /* SIGSEGV */
+
#if !defined (SIGIO)
# define SIGIO 0
#endif /* SIGSEGV */
+
#if !defined (SIGUSR1)
# define SIGUSR1 0
#endif /* SIGUSR1 */
+
#if !defined (SIGUSR2)
# define SIGUSR2 0
#endif /* SIGUSR2 */
+
#if !defined (SIGCHLD)
# define SIGCHLD 0
#endif /* SIGCHLD */
+
#if !defined (SIGCLD)
# define SIGCLD SIGCHLD
#endif /* SIGCLD */
+
#if !defined (SIGQUIT)
# define SIGQUIT 0
#endif /* SIGQUIT */
+
#if !defined (SIGPIPE)
# define SIGPIPE 0
#endif /* SIGPIPE */
+
#if !defined (SIGALRM)
# define SIGALRM 0
#endif /* SIGALRM */
+
#if !defined (SIG_DFL)
# define SIG_DFL ((__sighandler_t) 0)
#endif /* SIG_DFL */
+
#if !defined (SIG_IGN)
# define SIG_IGN ((__sighandler_t) 1) /* ignore signal */
#endif /* SIG_IGN */
+
#if !defined (SIG_ERR)
# define SIG_ERR ((__sighandler_t) -1) /* error return from signal */
#endif /* SIG_ERR */
+
// These are used by the <ACE_IPC_SAP::enable> and
// <ACE_IPC_SAP::disable> methods. They must be unique and cannot
// conflict with the value of <ACE_NONBLOCK>. We make the numbers
@@ -122,6 +154,7 @@ extern "C"
# define ACE_SIGIO -1
# define ACE_SIGURG -2
# define ACE_CLOEXEC -3
+
#if defined (ACE_VXWORKS)
# define ACE_NSIG (_NSIGS + 1)
#elif defined (__Lynx__) || defined (ACE_HAS_RTEMS)
@@ -131,6 +164,7 @@ extern "C"
// highest-numbered signal.
# define ACE_NSIG NSIG
#endif /* __Lynx__ */
+
#if defined (ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES)
// Prototypes for both signal() and struct sigaction are consistent..
typedef void (*ACE_SignalHandler)(int);
@@ -162,6 +196,7 @@ extern "C"
# endif /* SIG_PF */
typedef void (*ACE_SignalHandlerV)(...);
#endif /* ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES */
+
#if defined (ACE_LACKS_SIGACTION)
struct sigaction
{
@@ -170,6 +205,7 @@ extern "C"
sigset_t sa_mask;
};
#endif /* ACE_LACKS_SIGACTION */
+
// Defining POSIX4 real-time signal range.
#if defined(ACE_HAS_POSIX_REALTIME_SIGNALS)
# define ACE_SIGRTMIN SIGRTMIN
@@ -182,6 +218,7 @@ extern "C"
# define ACE_SIGRTMAX 0
# endif /* ACE_SIGRTMAX */
#endif /* ACE_HAS_POSIX_REALTIME_SIGNALS */
+
#if defined (DIGITAL_UNIX)
// sigwait is yet another macro on Digital UNIX 4.0, just causing
// trouble when introducing member functions with the same name.
@@ -201,13 +238,17 @@ extern "C"
int sigwait (sigset_t *set);
# endif /* ACE_HAS_RTEMS */
#endif /* ! DIGITAL_UNIX && ! ACE_HAS_SIGWAIT */
+
#if !defined (ACE_HAS_PTHREAD_SIGMASK_PROTOTYPE)
int pthread_sigmask(int, const sigset_t *, sigset_t *);
#endif /*!ACE_HAS_PTHREAD_SIGMASK_PROTOTYPE */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include "ace/os_include/os_ucontext.h"
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_SIGNAL_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_spawn.h b/dep/ACE_wrappers/ace/os_include/os_spawn.h
index 74770aefb80..ffa80163f50 100644
--- a/dep/ACE_wrappers/ace/os_include/os_spawn.h
+++ b/dep/ACE_wrappers/ace/os_include/os_spawn.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_spawn.h
@@ -11,27 +12,36 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_SPAWN_H
#define ACE_OS_INCLUDE_OS_SPAWN_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/os_signal.h"
#include "ace/os_include/sys/os_types.h"
#include "ace/os_include/os_sched.h"
+
#if !defined (ACE_LACKS_SPAWN_H)
# include /**/ <spawn.h>
#endif /* !ACE_LACKS_SPAWN_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_SPAWN_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_stdarg.h b/dep/ACE_wrappers/ace/os_include/os_stdarg.h
index 23e03eee83b..7a9fcf5a928 100644
--- a/dep/ACE_wrappers/ace/os_include/os_stdarg.h
+++ b/dep/ACE_wrappers/ace/os_include/os_stdarg.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_stdarg.h
@@ -11,16 +12,22 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_STDARG_H
#define ACE_OS_INCLUDE_OS_STDARG_H
+
#include /**/ "ace/pre.h"
+
#include "ace/config-lite.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if !defined (ACE_LACKS_STDARG_H)
# include /**/ <stdarg.h>
#endif /* !ACE_LACKS_STDARG_H */
+
#if !defined (va_copy)
#if defined (__va_copy)
#define va_copy(d, s) __va_copy((d),(s))
@@ -28,14 +35,17 @@
#define va_copy(d, s) memcpy((void *)&(d),(void *)&(s),sizeof(va_list))
#endif
#endif
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_STDARG_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_stdbool.h b/dep/ACE_wrappers/ace/os_include/os_stdbool.h
index f30f85a4d0f..e739fddf26d 100644
--- a/dep/ACE_wrappers/ace/os_include/os_stdbool.h
+++ b/dep/ACE_wrappers/ace/os_include/os_stdbool.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_stdbool.h
@@ -11,24 +12,32 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_STDBOOL_H
#define ACE_OS_INCLUDE_OS_STDBOOL_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if !defined (ACE_LACKS_STDBOOL_H)
# include /**/ <stdbool.h>
#endif /* !ACE_LACKS_STDBOOL_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_STDBOOL_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_stddef.h b/dep/ACE_wrappers/ace/os_include/os_stddef.h
index f07731270be..34e6001925f 100644
--- a/dep/ACE_wrappers/ace/os_include/os_stddef.h
+++ b/dep/ACE_wrappers/ace/os_include/os_stddef.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_stddef.h
@@ -11,22 +12,30 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
// From http://www.UNIX-systems.org/single_unix_specification/
+
#ifndef ACE_OS_INCLUDE_OS_STDDEF_H
#define ACE_OS_INCLUDE_OS_STDDEF_H
+
#include /**/ "ace/pre.h"
+
#include "ace/config-lite.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if !defined (ACE_LACKS_STDDEF_H)
# include /**/ <stddef.h>
#endif /* !ACE_LACKS_STDDEF_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
//FUZZ: disable check_for_NULL
// NULL pointer constant
#if defined (ACE_LACKS_NULL)
@@ -38,6 +47,7 @@ extern "C"
# endif
#endif /* ACE_LACKS_NULL */
//FUZZ: enable check_for_NULL
+
/*
Integer constant expression of type size_t, the value of which is the offset
in bytes to the structure member (member-designator), from the beginning of
@@ -47,6 +57,7 @@ extern "C"
# undef offsetof
# define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
#endif /* ACE_LACKS_OFFSETOF */
+
// Signed integer type of the result of subtracting two pointers.
#if defined (ACE_LACKS_PTRDIFF_T)
# if !defined (ACE_PTRDIFF_T_TYPE)
@@ -54,6 +65,7 @@ extern "C"
# endif /* !ACE_PTRDIFF_T_TYPE */
typedef ACE_PTRDIFF_T_TYPE ptrdiff_t;
#endif /* ACE_LACKS_PTRDIFF_T */
+
/*
Integer type whose range of values can represent distinct wide-character
codes for all members of the largest character set specified among the
@@ -68,6 +80,7 @@ extern "C"
# endif /* !ACE_WCHAR_T_TYPE */
typedef ACE_WCHAR_T_TYPE wchar_t;
#endif /* ACE_LACKS_WCHAR_T */
+
// Unsigned integer type of the result of the sizeof operator.
#if defined (ACE_LACKS_SIZE_T)
# if !defined (ACE_SIZE_T_TYPE)
@@ -75,9 +88,11 @@ extern "C"
# endif /* !ACE_SIZE_T_TYPE */
typedef ACE_SIZE_T_TYPE size_t;
#endif /* ACE_LACKS_SIZE_T */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_STDDEF_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_stdint.h b/dep/ACE_wrappers/ace/os_include/os_stdint.h
index a391227f450..5786e2a2b71 100644
--- a/dep/ACE_wrappers/ace/os_include/os_stdint.h
+++ b/dep/ACE_wrappers/ace/os_include/os_stdint.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_stdint.h
@@ -11,21 +12,28 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_STDINT_H
#define ACE_OS_INCLUDE_OS_STDINT_H
+
#include /**/ "ace/pre.h"
+
#include "ace/config-lite.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if !defined (ACE_LACKS_STDINT_H)
# include /**/ <stdint.h>
#endif /* !ACE_LACKS_STDINT_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
// BSD style types
#if defined (ACE_LACKS_SYS_TYPES_H) \
|| (defined (__GLIBC__) && !defined (_BSD_SOURCE))
@@ -33,61 +41,74 @@ extern "C"
typedef unsigned short u_short;
typedef unsigned int u_int;
typedef unsigned long u_long;
+
typedef unsigned char uchar_t;
typedef unsigned short ushort_t;
typedef unsigned int uint_t;
typedef unsigned long ulong_t;
#endif /* ACE_LACKS_SYS_TYPES_H */
+
/* Define required types if missing */
+
#if defined (ACE_LACKS_INT8_T)
# if !defined (ACE_INT8_T_TYPE)
# define ACE_INT8_T_TYPE char
# endif /* !ACE_INT8_T_TYPE */
typedef ACE_INT8_T_TYPE int8_t;
#endif /* ACE_LACKS_INT8_T */
+
#if defined (ACE_LACKS_UINT8_T)
# if !defined (ACE_UINT8_T_TYPE)
# define ACE_UINT8_T_TYPE unsigned char
# endif /* !ACE_UINT8_T_TYPE */
typedef ACE_UINT8_T_TYPE int8_t;
#endif /* ACE_LACKS_UINT8_T */
+
#if defined (ACE_LACKS_INT16_T)
# if !defined (ACE_INT16_T_TYPE)
# define ACE_INT16_T_TYPE short
# endif /* !ACE_INT16_T_TYPE */
typedef ACE_INT16_T_TYPE int16_t;
#endif /* ACE_LACKS_INT16_T */
+
#if defined (ACE_LACKS_UINT16_T)
# if !defined (ACE_UINT16_T_TYPE)
# define ACE_UINT16_T_TYPE unsigned short
# endif /* !ACE_UINT16_T_TYPE */
typedef ACE_UINT16_T_TYPE int16_t;
#endif /* ACE_LACKS_UINT16_T */
+
#if defined (ACE_LACKS_INT32_T)
# if !defined (ACE_INT32_T_TYPE)
# define ACE_INT32_T_TYPE long
# endif /* !ACE_INT32_T_TYPE */
typedef ACE_INT32_T_TYPE int32_t;
#endif /* ACE_LACKS_INT32_T */
+
#if defined (ACE_LACKS_UINT32_T)
# if !defined (ACE_UINT32_T_TYPE)
# define ACE_UINT32_T_TYPE unsigned long
# endif /* !ACE_UINT32_T_TYPE */
typedef ACE_UINT32_T_TYPE int32_t;
#endif /* ACE_LACKS_UIN32_T */
+
// @todo pull in ACE class here
// 64 bit will be a problem, but stub it out for now
/*
If an implementation provides integer types with width 64 that meet
these requirements, then the following types are required: int64_t uint64_t
+
In particular, this will be the case if any of the following are true:
+
The implementation supports the _POSIX_V6_ILP32_OFFBIG programming
environment and the application is being built in the
_POSIX_V6_ILP32_OFFBIG programming environment (see the Shell and
Utilities volume of IEEE Std 1003.1-2001, c99, Programming Environments).
+
The implementation supports the _POSIX_V6_LP64_OFF64 programming
environment and the application is being built in the
_POSIX_V6_LP64_OFF64 programming environment.
+
The implementation supports the _POSIX_V6_LPBIG_OFFBIG programming
environment and the application is being built in the
_POSIX_V6_LPBIG_OFFBIG programming environment.
@@ -98,19 +119,24 @@ _POSIX_V6_LPBIG_OFFBIG programming environment.
# endif /* !ACE_INT64_T_TYPE */
typedef ACE_INT64_T_TYPE int64_t;
#endif /* ACE_LACKS_INT64_T */
+
#if defined (ACE_LACKS_UINT64_T)
# if !defined (ACE_UINT64_T_TYPE)
# define ACE_UINT64_T_TYPE unsigned long
# endif /* !ACE_UINT64_T_TYPE */
typedef ACE_UINT64_T_TYPE int64_t;
#endif /* ACE_LACKS_UIN64_T */
+
// @todo move the ACE_INT## typedefs here so that ACE_INT64 will
// always be available.
+
// @todo perhaps add macros
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_STDINT_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_stdio.h b/dep/ACE_wrappers/ace/os_include/os_stdio.h
index da3f6fe8298..23cec4d8eba 100644
--- a/dep/ACE_wrappers/ace/os_include/os_stdio.h
+++ b/dep/ACE_wrappers/ace/os_include/os_stdio.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_stdio.h
@@ -11,19 +12,26 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_STDIO_H
#define ACE_OS_INCLUDE_OS_STDIO_H
+
#include /**/ "ace/pre.h"
+
#include "ace/config-lite.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
// NOTE: stdarg.h must be #included before stdio.h on LynxOS.
#include "ace/os_include/os_stdarg.h"
#include "ace/os_include/os_stddef.h"
+
#if !defined (ACE_LACKS_STDIO_H)
# include /**/ <stdio.h>
#endif /* !ACE_LACKS_STDIO_H */
+
#if defined (ACE_VXWORKS)
// for remove(), rename()
# include /**/ <ioLib.h>
@@ -33,11 +41,13 @@
# define L_cuserid _PARM_L_cuserid
# endif
#endif /* ACE_VXWORKS */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
# if defined (INTEGRITY)
# define ACE_MAX_USERID 32
# elif defined (ACE_WIN32)
@@ -49,11 +59,13 @@ extern "C"
# define ACE_MAX_USERID 9
# endif
# endif /* INTEGRITY */
+
#if defined (BUFSIZ)
# define ACE_STREAMBUF_SIZE BUFSIZ
#else
# define ACE_STREAMBUF_SIZE 1024
#endif /* BUFSIZ */
+
#if defined (ACE_WIN32)
typedef OVERLAPPED ACE_OVERLAPPED;
#else
@@ -66,9 +78,11 @@ extern "C"
ACE_HANDLE hEvent;
};
#endif /* ACE_WIN32 */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_STDIO_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_stdlib.h b/dep/ACE_wrappers/ace/os_include/os_stdlib.h
index e66702829f2..4813f4e2bcc 100644
--- a/dep/ACE_wrappers/ace/os_include/os_stdlib.h
+++ b/dep/ACE_wrappers/ace/os_include/os_stdlib.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_stdlib.h
@@ -11,29 +12,39 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_STDLIB_H
#define ACE_OS_INCLUDE_OS_STDLIB_H
+
#include /**/ "ace/pre.h"
+
#include "ace/config-lite.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/os_stddef.h"
#include "ace/os_include/sys/os_wait.h"
+
#if defined (ACE_HAS_ALLOCA_H)
# include /**/ <alloca.h>
#endif /* ACE_HAS_ALLOCA_H */
+
#if !defined (ACE_LACKS_STDLIB_H)
# include /**/ <stdlib.h>
#endif /* !ACE_LACKS_STDLIB_H */
+
#if defined (ACE_VXWORKS) && !defined (__RTP__)
# include /**/ <envLib.h>
#endif /* ACE_VXWORKS */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
typedef u_int ACE_RANDR_TYPE;
#if defined (ACE_HAS_BROKEN_RANDR)
// The SunOS 5.4.X version of rand_r is inconsistent with the header
@@ -41,21 +52,27 @@ extern "C"
int rand_r (ACE_RANDR_TYPE seed);
#else
#endif /* ACE_HAS_BROKEN_RANDR */
+
#if defined (DIGITAL_UNIX)
extern int _Prand_r (unsigned int *seedptr);
#endif /* DIGITAL_UNIX */
+
#if defined (ACE_LACKS_PUTENV_PROTOTYPE)
int putenv (char *);
#endif /* ACE_LACKS_PUTENV_PROTOTYPE */
+
#if defined (ACE_LACKS_MKTEMP_PROTOTYPE)
char *mktemp (char *);
#endif /* ACE_LACKS_MKTEMP_PROTOTYPE */
+
#if defined (ACE_LACKS_MKSTEMP_PROTOTYPE)
int mkstemp(char *);
#endif /* ACE_LACKS_MKSTEMP_PROTOTYPE */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_STDLIB_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_string.h b/dep/ACE_wrappers/ace/os_include/os_string.h
index 217d7458622..cfbc4fd2fcf 100644
--- a/dep/ACE_wrappers/ace/os_include/os_string.h
+++ b/dep/ACE_wrappers/ace/os_include/os_string.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_string.h
@@ -11,14 +12,20 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_STRING_H
#define ACE_OS_INCLUDE_OS_STRING_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/os_stddef.h"
+
// Matthew Stevens 7-10-95 Fix GNU GCC 2.7 for memchr() problem.
#if defined (ACE_HAS_GNU_CSTRING_H)
// Define this file to keep /usr/include/memory.h from being included.
@@ -31,11 +38,13 @@
# include /**/ <string.h>
# endif /* !ACE_LACKS_STRING_H */
#endif /* ACE_HAS_GNU_CSTRING_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
// this looks fishy... dhinton
#if !defined (ACE_HAS_STRERROR)
# if defined (ACE_HAS_SYS_ERRLIST)
@@ -45,19 +54,24 @@ extern "C"
# define strerror(err) "strerror is unsupported"
# endif /* ACE_HAS_SYS_ERRLIST */
#endif /* !ACE_HAS_STRERROR */
+
#if defined (ACE_LACKS_STRTOK_R_PROTOTYPE) && !defined (_POSIX_SOURCE)
char *strtok_r (char *s, const char *delim, char **save_ptr);
#endif /* ACE_LACKS_STRTOK_R_PROTOTYPE */
+
#if defined (ACE_LACKS_STRNLEN_PROTOTYPE)
size_t strnlen(const char *s, size_t maxlen);
#endif /* ACE_LACKS_STRNLEN_PROTOTYPE */
+
#if defined (__BORLANDC__) && (__BORLANDC__ < 0x560)
# define _stricmp stricmp
# define _strnicmp strnicmp
#endif /* __BORLANDC__ */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_STRING_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_strings.h b/dep/ACE_wrappers/ace/os_include/os_strings.h
index d8a6a6acd7e..8bfc768962f 100644
--- a/dep/ACE_wrappers/ace/os_include/os_strings.h
+++ b/dep/ACE_wrappers/ace/os_include/os_strings.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_strings.h
@@ -11,31 +12,42 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_STRINGS_H
#define ACE_OS_INCLUDE_OS_STRINGS_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/os_stddef.h"
+
#if !defined (ACE_LACKS_STRINGS_H)
# include /**/ <strings.h>
#endif /* !ACE_LACKS_STRINGS_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#if defined (ACE_LACKS_STRCASECMP_PROTOTYPE)
int strcasecmp(const char *, const char *);
#endif /* ACE_LACKS_STRCASECMP_PROTOTYPE */
+
#if defined (ACE_LACKS_STRNCASECMP_PROTOTYPE)
int strncasecmp(const char *, const char *, size_t);
#endif /* ACE_LACKS_STRNCASECMP_PROTOTYPE */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_STRINGS_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_stropts.h b/dep/ACE_wrappers/ace/os_include/os_stropts.h
index 5139f85a516..961bd37feaa 100644
--- a/dep/ACE_wrappers/ace/os_include/os_stropts.h
+++ b/dep/ACE_wrappers/ace/os_include/os_stropts.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_stropts.h
@@ -11,14 +12,20 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_STROPTS_H
#define ACE_OS_INCLUDE_OS_STROPTS_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/os_unistd.h"
+
#if defined (ACE_HAS_TIMOD_H)
# if defined (ACE_HAS_STL_QUEUE_CONFLICT)
# define queue _Queue_
@@ -30,15 +37,19 @@
#elif defined (ACE_HAS_OSF_TIMOD_H)
# include /**/ <tli/timod.h>
#endif /* ACE_HAS_TIMOD_H */
+
#if !defined (ACE_LACKS_SYS_IOCTL_H)
# include /**/ <sys/ioctl.h>
#endif /* !ACE_LACKS_IOCTL_H */
+
#if defined (ACE_HAS_SYS_FILIO_H)
# include /**/ <sys/filio.h>
#endif /* ACE_HAS_SYS_FILIO_H */
+
#if defined (ACE_HAS_SYS_SOCKIO_H)
# include /**/ <sys/sockio.h>
#endif /* ACE_HAS_SOCKIO_H */
+
// This is sorta counter intuitive, but this is how it was done in OS.h
// @todo: fix this... dhinton
#if defined (ACE_HAS_STREAMS)
@@ -48,9 +59,11 @@
# endif /* !_XOPEN_EXTENDED_SOURCE */
# endif /* AIX */
#endif /* ACE_HAS_STREAMS */
+
#if !defined (ACE_LACKS_STROPTS_H)
# include /**/ <stropts.h>
#endif /* !ACE_LACKS_STROPTS_H */
+
// This is sorta counter intuitive, but this is how it was done in OS.h
// @todo: fix this... dhinton
#if defined (ACE_HAS_STREAMS)
@@ -58,24 +71,30 @@
# undef _XOPEN_EXTENDED_SOURCE
# endif /* AIX */
#endif /* ACE_HAS_STREAMS */
+
#if defined (ACE_VXWORKS)
// for ioctl()
# include /**/ <ioLib.h>
#endif /* ACE_VXWORKS */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#if defined (ACE_LACKS_STRRECVFD)
struct strrecvfd {};
#endif /* ACE_LACKS_STRRECVFD */
+
# if !defined (SIOCGIFBRDADDR)
# define SIOCGIFBRDADDR 0
# endif /* SIOCGIFBRDADDR */
+
# if !defined (SIOCGIFADDR)
# define SIOCGIFADDR 0
# endif /* SIOCGIFADDR */
+
# if !defined (ACE_HAS_STRBUF_T)
struct strbuf
{
@@ -87,13 +106,16 @@ struct strbuf
void *buf;
};
# endif /* ACE_HAS_STRBUF_T */
+
// These prototypes are chronically lacking from many versions of UNIX.
#if !defined (ACE_WIN32) && !defined (ACE_HAS_ISASTREAM_PROTOTYPE)
int isastream (int);
#endif /* !ACE_WIN32 && ACE_HAS_ISASTREAM_PROTOTYPE */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_STROPTS_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_syslog.h b/dep/ACE_wrappers/ace/os_include/os_syslog.h
index 612c34e29b6..f1713b47780 100644
--- a/dep/ACE_wrappers/ace/os_include/os_syslog.h
+++ b/dep/ACE_wrappers/ace/os_include/os_syslog.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_syslog.h
@@ -11,24 +12,32 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_SYSLOG_H
#define ACE_OS_INCLUDE_OS_SYSLOG_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if !defined (ACE_LACKS_SYSLOG_H)
# include /**/ <syslog.h>
#endif /* !ACE_LACKS_SYSLOG_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_SYSLOG_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_tar.h b/dep/ACE_wrappers/ace/os_include/os_tar.h
index 7c036cf1e9b..a0dc6ce2a76 100644
--- a/dep/ACE_wrappers/ace/os_include/os_tar.h
+++ b/dep/ACE_wrappers/ace/os_include/os_tar.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_tar.h
@@ -11,24 +12,32 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_TAR_H
#define ACE_OS_INCLUDE_OS_TAR_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if !defined (ACE_LACKS_TAR_H)
# include /**/ <tar.h>
#endif /* !ACE_LACKS_TAR_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_TAR_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_termios.h b/dep/ACE_wrappers/ace/os_include/os_termios.h
index eee01454fd0..d67aa4a1aa9 100644
--- a/dep/ACE_wrappers/ace/os_include/os_termios.h
+++ b/dep/ACE_wrappers/ace/os_include/os_termios.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_termios.h
@@ -11,27 +12,36 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_TERMIOS_H
#define ACE_OS_INCLUDE_OS_TERMIOS_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if !defined (ACE_LACKS_TERMIOS_H)
# include /**/ <termios.h>
#endif /* !ACE_LACKS_TERMIOS_H */
+
#if defined (HPUX)
# include /**/ <sys/modem.h>
#endif /* HPUX */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_TERMIOS_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_tgmath.h b/dep/ACE_wrappers/ace/os_include/os_tgmath.h
index 8a0dfc5f05a..2b112a12875 100644
--- a/dep/ACE_wrappers/ace/os_include/os_tgmath.h
+++ b/dep/ACE_wrappers/ace/os_include/os_tgmath.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_tgmath.h
@@ -11,26 +12,35 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_TGMATH_H
#define ACE_OS_INCLUDE_OS_TGMATH_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/os_math.h"
#include "ace/os_include/os_complex.h"
+
#if !defined (ACE_LACKS_TGMATH_H)
# include /**/ <tgmath.h>
#endif /* !ACE_LACKS_TGMATH_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_TGMATH_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_time.h b/dep/ACE_wrappers/ace/os_include/os_time.h
index 38a60fb4e1e..3670f3b492d 100644
--- a/dep/ACE_wrappers/ace/os_include/os_time.h
+++ b/dep/ACE_wrappers/ace/os_include/os_time.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_time.h
@@ -11,15 +12,21 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_TIME_H
#define ACE_OS_INCLUDE_OS_TIME_H
+
#include /**/ "ace/pre.h"
+
#include "ace/config-lite.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
// @todo should we include anything from signal.h?
#include "ace/os_include/sys/os_types.h"
+
// To get the proper select() signature, this is required for HP-UX, and
// maybe other platforms that offer both int and fdset forms of select().
// For HP-UX, sys/time.h must be included before time.h, or
@@ -28,9 +35,11 @@
#if !defined (ACE_LACKS_SYS_TIME_H)
# include /**/ <sys/time.h>
#endif /* !ACE_LACKS_SYS_TIME_H */
+
#if !defined (ACE_LACKS_TIME_H)
# include /**/ <time.h>
#endif /* !ACE_LACKS_TIME_H */
+
# if defined (ACE_USES_STD_NAMESPACE_FOR_STDC_LIB) && \
(ACE_USES_STD_NAMESPACE_FOR_STDC_LIB != 0)
using std::tm;
@@ -43,6 +52,7 @@ using std::timezone;
# endif
using std::difftime;
# endif /* ACE_USES_STD_NAMESPACE_FOR_STDC_LIB */
+
# if !defined (ACE_HAS_POSIX_TIME)
// Definition per POSIX.
typedef struct timespec
@@ -60,17 +70,21 @@ typedef struct timespec
# include /**/ <sys/timers.h>
# endif
# endif /* !ACE_HAS_POSIX_TIME */
+
# if defined(ACE_LACKS_TIMESPEC_T)
typedef struct timespec timespec_t;
# endif /* ACE_LACKS_TIMESPEC_T */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#if defined (ACE_HAS_BROKEN_CTIME)
# undef ctime
#endif /* ACE_HAS_BROKEN_CTIME */
+
// There are a lot of threads-related macro definitions in the config files.
// They came in at different times and from different places and platform
// requirements as threads evolved. They are probably not all needed - some
@@ -83,23 +97,28 @@ extern "C"
# define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R
# endif
#endif /* ACE_HAS_PTHREADS */
+
#if defined (ACE_LACKS_STRPTIME_PROTOTYPE) && !defined (_XOPEN_SOURCE)
extern char *strptime (const char *s, const char *fmt, struct tm *tp);
#endif /* ACE_LACKS_STRPTIME_PROTOTYPE */
+
#if defined (ACE_LACKS_CONST_TIMESPEC_PTR)
typedef struct timespec * ACE_TIMESPEC_PTR;
#else
typedef const struct timespec * ACE_TIMESPEC_PTR;
#endif /* ACE_LACKS_CONST_TIMESPEC_PTR */
+
#if defined (DIGITAL_UNIX)
extern char *_Pctime_r (const time_t *, char *);
extern struct tm *_Plocaltime_r (const time_t *, struct tm *);
extern struct tm *_Pgmtime_r (const time_t *, struct tm *);
extern char *_Pasctime_r (const struct tm *, char *);
#endif /* DIGITAL_UNIX */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_TIME_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_trace.h b/dep/ACE_wrappers/ace/os_include/os_trace.h
index 719ee83def0..0eacf9dc4bb 100644
--- a/dep/ACE_wrappers/ace/os_include/os_trace.h
+++ b/dep/ACE_wrappers/ace/os_include/os_trace.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_trace.h
@@ -11,25 +12,34 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_TRACE_H
#define ACE_OS_INCLUDE_OS_TRACE_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/sys/os_types.h"
+
#if !defined (ACE_LACKS_TRACE_H)
# include /**/ <trace.h>
#endif /* !ACE_LACKS_TRACE_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_TRACE_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_ucontext.h b/dep/ACE_wrappers/ace/os_include/os_ucontext.h
index f6f54b9f344..556bbdbbe45 100644
--- a/dep/ACE_wrappers/ace/os_include/os_ucontext.h
+++ b/dep/ACE_wrappers/ace/os_include/os_ucontext.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_ucontext.h
@@ -11,28 +12,38 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_UCONTEXT_H
#define ACE_OS_INCLUDE_OS_UCONTEXT_H
+
#include /**/ "ace/pre.h"
+
#include "ace/config-lite.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/os_signal.h"
+
#if !defined (ACE_LACKS_UCONTEXT_H)
# include /**/ <ucontext.h>
#endif /* !ACE_LACKS_ucontext_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
# if !defined (ACE_HAS_UCONTEXT_T)
typedef int ucontext_t;
# endif /* ACE_HAS_UCONTEXT_T */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_UCONTEXT_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_ulimit.h b/dep/ACE_wrappers/ace/os_include/os_ulimit.h
index eb2a9da6cfe..ad18c8a18d2 100644
--- a/dep/ACE_wrappers/ace/os_include/os_ulimit.h
+++ b/dep/ACE_wrappers/ace/os_include/os_ulimit.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_ulimit.h
@@ -11,24 +12,32 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_ULIMIT_H
#define ACE_OS_INCLUDE_OS_ULIMIT_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if !defined (ACE_LACKS_ULIMIT_H)
# include /**/ <ulimit.h>
#endif /* !ACE_LACKS_ULIMIT_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_ULIMIT_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_unistd.h b/dep/ACE_wrappers/ace/os_include/os_unistd.h
index de26589b795..6e2d4a5c537 100644
--- a/dep/ACE_wrappers/ace/os_include/os_unistd.h
+++ b/dep/ACE_wrappers/ace/os_include/os_unistd.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_unistd.h
@@ -11,28 +12,38 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_UNISTD_H
#define ACE_OS_INCLUDE_OS_UNISTD_H
+
#include /**/ "ace/pre.h"
+
#include "ace/config-lite.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/sys/os_types.h"
#include "ace/os_include/os_inttypes.h"
+
#if defined (__BORLANDC__)
# include "ace/os_include/os_fcntl.h"
#endif /* __BORLANDC */
+
#if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)
# include /**/ <process.h>
# include /**/ <io.h>
#endif /* ACE_WIN32 && !ACE_HAS_WINCE */
+
#if defined (ACE_HAS_SYS_SYSTEMINFO_H)
# include /**/ <sys/systeminfo.h>
#endif /* ACE_HAS_SYS_SYSTEMINFO_H */
+
#if !defined (ACE_LACKS_UNISTD_H)
# include /**/ <unistd.h>
#endif /* !ACE_LACKS_UNISTD_H */
+
#if defined (ACE_VXWORKS)
# if !defined (__RTP__)
// for unlink(), close(), read(), write(), lseek(), chdir(), getcwd(),
@@ -42,11 +53,13 @@
// for gethostname()
# include /**/ <hostLib.h>
#endif /* ACE_VXWORKS */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#if defined (ACE_WIN32)
// The following are #defines and #includes that are specific to
// WIN32.
@@ -77,24 +90,30 @@ extern "C"
# define ACE_STDERR 2
# endif
#endif /* ACE_WIN32 */
+
#if (!defined (_BSD_SOURCE) && \
!defined (_XOPEN_SOURCE) && !defined (_XOPEN_SOURCE_EXTENDED)) \
|| (defined (_XOPEN_SOURCE) && defined (__GNUC__))
+
# if defined (ACE_LACKS_SETREUID_PROTOTYPE)
extern int setreuid (uid_t ruid, uid_t euid);
# endif /* ACE_LACKS_SETREUID_PROTOTYPE */
+
# if defined (ACE_LACKS_SETREGID_PROTOTYPE)
extern int setregid (gid_t rgid, gid_t egid);
# endif /* ACE_LACKS_SETREGID_PROTOTYPE */
#endif /* !_BSD_SOURCE && !_XOPEN_SOURCE && !_XOPEN_SOURCE_EXTENDED
|| _XOPEN_SOURCE && __GNUC__ */
+
// for use by access()
# if !defined (R_OK)
# define R_OK 04 /* Test for Read permission. */
# endif /* R_OK */
+
# if !defined (W_OK)
# define W_OK 02 /* Test for Write permission. */
# endif /* W_OK */
+
# if !defined (X_OK)
# if defined (ACE_WIN32)
/* Windows has no test for X_OK - use R_OK instead */
@@ -103,12 +122,15 @@ extern "C"
# define X_OK 01 /* Test for eXecute permission. */
# endif /* ACE_WIN32 */
# endif /* X_OK */
+
# if !defined (F_OK)
# define F_OK 0 /* Test for existence of File. */
# endif /* F_OK */
+
#if defined (ACE_LACKS_UALARM_PROTOTYPE)
u_int ualarm (u_int usecs, u_int interval);
#endif /* ACE_LACKS_UALARM_PROTOTYPE */
+
#if defined (ACE_LACKS_PREAD_PROTOTYPE) && (_XOPEN_SOURCE - 0) < 500
// _XOPEN_SOURCE == 500 Single Unix conformance
// It seems that _XOPEN_SOURCE == 500 means that the prototypes are
@@ -117,16 +139,19 @@ extern "C"
void *buf,
size_t nbytes,
ACE_OFF_T offset);
+
ssize_t pwrite (int fd,
const void *buf,
size_t n,
ACE_OFF_T offset);
#endif /* ACE_LACKS_PREAD_PROTOTYPE && (_XOPEN_SOURCE - 0) < 500 */
+
#if defined (ACE_LACKS_GETPGID_PROTOTYPE) && \
!defined (_XOPEN_SOURCE) && !defined (_XOPEN_SOURCE_EXTENDED)
pid_t getpgid (pid_t pid);
#endif /* ACE_LACKS_GETPGID_PROTOTYPE &&
!_XOPEN_SOURCE && !_XOPEN_SOURCE_EXTENDED */
+
#if !defined (_LARGEFILE64_SOURCE)
# if defined (ACE_LACKS_LSEEK64_PROTOTYPE) && \
defined (ACE_LACKS_LLSEEK_PROTOTYPE)
@@ -137,6 +162,7 @@ extern "C"
ACE_LOFF_T llseek (int fd, ACE_LOFF_T offset, int whence);
# endif
#endif /* _LARGEFILE64_SOURCE */
+
#if defined (__BORLANDC__)
# if (__BORLANDC__ <= 0x540)
# define _getcwd getcwd
@@ -146,25 +172,33 @@ extern "C"
# endif
# define _isatty isatty
#endif /* __BORLANDC__ */
+
# if defined (ACE_LACKS_TIMEDWAIT_PROTOTYPES)
+
ssize_t read_timedwait (ACE_HANDLE handle,
char *buf,
size_t n,
struct timespec *timeout);
+
ssize_t write_timedwait (ACE_HANDLE handle,
const void *buf,
size_t n,
struct timespec *timeout);
+
# endif /* ACE_LACKS_TIMEDWAIT_PROTOTYPES */
+
#if defined (ACE_LACKS_SWAB_PROTOTYPE)
void swab(const void *, void *, ssize_t);
#endif /* ACE_LACKS_SWAB_PROTOTYPE */
+
#if defined (ACE_LACKS_GETOPT_PROTOTYPE)
int getopt(int, char * const [], const char *);
#endif /* ACE_LACKS_GETOPT_PROTOTYPE */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_UNISTD_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_utime.h b/dep/ACE_wrappers/ace/os_include/os_utime.h
index d38072e497d..4cf719e34f9 100644
--- a/dep/ACE_wrappers/ace/os_include/os_utime.h
+++ b/dep/ACE_wrappers/ace/os_include/os_utime.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_utime.h
@@ -11,25 +12,34 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_UTIME_H
#define ACE_OS_INCLUDE_OS_UTIME_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/sys/os_types.h"
+
#if !defined (ACE_LACKS_UTIME_H)
# include /**/ <utime.h>
#endif /* !ACE_LACKS_UTIME_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_UTIME_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_utmpx.h b/dep/ACE_wrappers/ace/os_include/os_utmpx.h
index 653b4794c96..234351366fb 100644
--- a/dep/ACE_wrappers/ace/os_include/os_utmpx.h
+++ b/dep/ACE_wrappers/ace/os_include/os_utmpx.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_utmpx.h
@@ -11,25 +12,34 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_UTMPX_H
#define ACE_OS_INCLUDE_OS_UTMPX_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/sys/os_time.h"
+
#if !defined (ACE_LACKS_UTMPX_H)
# include /**/ <utmpx.h>
#endif /* !ACE_LACKS_UTMPX_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_UTMPX_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_wchar.h b/dep/ACE_wrappers/ace/os_include/os_wchar.h
index ae655133893..a020715876f 100644
--- a/dep/ACE_wrappers/ace/os_include/os_wchar.h
+++ b/dep/ACE_wrappers/ace/os_include/os_wchar.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_wchar.h
@@ -11,30 +12,39 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_WCHAR_H
#define ACE_OS_INCLUDE_OS_WCHAR_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
// ctype.h, string.h, stdarg.h, stdio.h, stdlib.h, time.h
#include "ace/os_include/os_stdio.h"
#include "ace/os_include/os_stdlib.h"
#include "ace/os_include/os_time.h"
#include "ace/os_include/os_string.h"
#include "ace/os_include/os_ctype.h"
+
#if !defined (ACE_LACKS_WCHAR_H)
# include /**/ <wchar.h>
#endif /* !ACE_LACKS_WCHAR_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_WCHAR_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_wctype.h b/dep/ACE_wrappers/ace/os_include/os_wctype.h
index 22679dbc7ee..5f385e0fc63 100644
--- a/dep/ACE_wrappers/ace/os_include/os_wctype.h
+++ b/dep/ACE_wrappers/ace/os_include/os_wctype.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_wctype.h
@@ -11,26 +12,35 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_WCTYPE_H
#define ACE_OS_INCLUDE_OS_WCTYPE_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
// ctype.h, string.h, stdarg.h, stdio.h, stdlib.h, time.h
#include "ace/os_include/os_wchar.h"
+
#if !defined (ACE_LACKS_WCTYPE_H)
# include /**/ <wctype.h>
#endif /* !ACE_LACKS_WCTYPE_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_WCTYPE_H */
diff --git a/dep/ACE_wrappers/ace/os_include/os_wordexp.h b/dep/ACE_wrappers/ace/os_include/os_wordexp.h
index c0d749e978c..885893861a2 100644
--- a/dep/ACE_wrappers/ace/os_include/os_wordexp.h
+++ b/dep/ACE_wrappers/ace/os_include/os_wordexp.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_wordexp.h
@@ -11,25 +12,34 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_OS_WORDEXP_H
#define ACE_OS_INCLUDE_OS_WORDEXP_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/os_stddef.h" // size_t
+
#if !defined (ACE_LACKS_WORDEXP_H)
# include /**/ <wordexp.h>
#endif /* !ACE_LACKS_WORDEXP_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_WORDEXP_H */
diff --git a/dep/ACE_wrappers/ace/os_include/sys/os_ipc.h b/dep/ACE_wrappers/ace/os_include/sys/os_ipc.h
index cf2fd568f44..99401b724cb 100644
--- a/dep/ACE_wrappers/ace/os_include/sys/os_ipc.h
+++ b/dep/ACE_wrappers/ace/os_include/sys/os_ipc.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_ipc.h
@@ -11,48 +12,64 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_SYS_OS_IPC_H
#define ACE_OS_INCLUDE_SYS_OS_IPC_H
+
#include /**/ "ace/pre.h"
+
#include "ace/config-lite.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/sys/os_types.h"
+
#if !defined (ACE_LACKS_SYS_IPC_H)
# include /**/ <sys/ipc.h>
#endif /* !ACE_LACKS_SYS_IPC_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#if defined (ACE_WIN32)
# define ACE_INVALID_SEM_KEY 0
#else /* !ACE_WIN32 */
# define ACE_INVALID_SEM_KEY -1
#endif /* ACE_WIN32 */
+
#if !defined (IPC_PRIVATE)
# define IPC_PRIVATE ACE_INVALID_SEM_KEY
#endif /* IPC_PRIVATE */
+
#if !defined (IPC_STAT)
# define IPC_STAT 0
#endif /* IPC_STAT */
+
#if !defined (IPC_CREAT)
# define IPC_CREAT 0
#endif /* IPC_CREAT */
+
#if !defined (IPC_NOWAIT)
# define IPC_NOWAIT 0
#endif /* IPC_NOWAIT */
+
#if !defined (IPC_RMID)
# define IPC_RMID 0
#endif /* IPC_RMID */
+
#if !defined (IPC_EXCL)
# define IPC_EXCL 0
#endif /* IPC_EXCL */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_SYS_OS_IPC_H */
diff --git a/dep/ACE_wrappers/ace/os_include/sys/os_loadavg.h b/dep/ACE_wrappers/ace/os_include/sys/os_loadavg.h
index 444a5a178e1..151f400e2c2 100644
--- a/dep/ACE_wrappers/ace/os_include/sys/os_loadavg.h
+++ b/dep/ACE_wrappers/ace/os_include/sys/os_loadavg.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_loadavg.h
@@ -10,24 +11,32 @@
* @author Johnny Willemsen <jwillemsen@remedy.nl>
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_SYS_OS_LOADAVG_H
#define ACE_OS_INCLUDE_SYS_OS_LOADAVG_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_SYS_LOADAVG_H)
# include /**/ <sys/loadavg.h>
#endif /* ACE_HAS_SYS_LOADAVG_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_SYS_OS_LOADAVG_H */
diff --git a/dep/ACE_wrappers/ace/os_include/sys/os_mman.h b/dep/ACE_wrappers/ace/os_include/sys/os_mman.h
index c66f175f3a6..c100d52fafe 100644
--- a/dep/ACE_wrappers/ace/os_include/sys/os_mman.h
+++ b/dep/ACE_wrappers/ace/os_include/sys/os_mman.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_mman.h
@@ -11,17 +12,24 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_SYS_OS_MMAN_H
#define ACE_OS_INCLUDE_SYS_OS_MMAN_H
+
#include /**/ "ace/pre.h"
+
#include "ace/config-lite.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/sys/os_types.h"
+
#if defined (ACE_LACKS_MMAP)
# define ACE_LACKS_SYS_MMAN_H
#endif /* ACE_LACKS_MMAP */
+
#if !defined (ACE_LACKS_SYS_MMAN_H)
// Fixes a problem with HP/UX.
# if defined (ACE_HAS_BROKEN_MMAP_H)
@@ -32,11 +40,13 @@
}
# endif /* ACE_HAS_BROKEN_MMAP_H */
#endif /* ACE_LACKS_SYS_MMAN_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#if defined (ACE_LACKS_SYS_MMAN_H) && !defined (ACE_WIN32)
# define PROT_READ 0
# define PROT_WRITE 0
@@ -65,15 +75,19 @@ PAGE_GUARD
PAGE_NOACCESS
PAGE_NOCACHE */
#endif /* !ACE_LACKS_SYS_MMAN_H && !ACE_WIN32*/
+
# if !defined (ACE_MAP_PRIVATE)
# define ACE_MAP_PRIVATE MAP_PRIVATE
# endif /* ! ACE_MAP_PRIVATE */
+
# if !defined (ACE_MAP_SHARED)
# define ACE_MAP_SHARED MAP_SHARED
# endif /* ! ACE_MAP_SHARED */
+
# if !defined (ACE_MAP_FIXED)
# define ACE_MAP_FIXED MAP_FIXED
# endif /* ! ACE_MAP_FIXED */
+
# if !defined (MAP_FAILED) || defined (ACE_HAS_BROKEN_MAP_FAILED)
# undef MAP_FAILED
# define MAP_FAILED ((void *) -1)
@@ -81,23 +95,29 @@ PAGE_NOCACHE */
# undef MAP_FAILED
# define MAP_FAILED ((void *) -1L)
# endif /* !MAP_FAILED || ACE_HAS_BROKEN_MAP_FAILED */
+
#if !defined (PROT_RDWR)
# define PROT_RDWR (PROT_READ|PROT_WRITE)
#endif /* PROT_RDWR */
+
# if defined (ACE_WIN32)
// Needed to map calls to NT transparently.
# define MS_ASYNC 0
# define MS_INVALIDATE 0
# endif /* ACE_WIN32 */
+
# if !defined (MS_SYNC)
# define MS_SYNC 0x0
# endif /* !MS_SYNC */
+
#if !defined (ACE_LACKS_MADVISE) && defined (ACE_LACKS_MADVISE_PROTOTYPE)
extern "C" int madvise(caddr_t, size_t, int);
#endif /* !ACE_LACKS_MADVISE && ACE_LACKS_MADVISE_PROTOTYPE */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_SYS_OS_MMAN_H */
diff --git a/dep/ACE_wrappers/ace/os_include/sys/os_msg.h b/dep/ACE_wrappers/ace/os_include/sys/os_msg.h
index 3fea009b6c6..57341dba97d 100644
--- a/dep/ACE_wrappers/ace/os_include/sys/os_msg.h
+++ b/dep/ACE_wrappers/ace/os_include/sys/os_msg.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_msg.h
@@ -11,34 +12,45 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_SYS_OS_MSG_H
#define ACE_OS_INCLUDE_SYS_OS_MSG_H
+
#include /**/ "ace/pre.h"
+
#include "ace/config-lite.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/sys/os_ipc.h"
+
#if !defined (ACE_LACKS_SYS_MSG_H)
# include /**/ <sys/msg.h>
#endif /* !ACE_LACKS_SYS_MSG_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
// Declare opaque type. Needed for ACE_OS wrappers on systems
// without SysV IPC.
struct msqid_ds;
+
#if defined (ACE_LACKS_SYSV_MSQ_PROTOS)
int msgget (key_t, int);
int msgrcv (int, void *, size_t, long, int);
int msgsnd (int, const void *, size_t, int);
int msgctl (int, int, struct msqid_ds *);
#endif /* ACE_LACKS_SYSV_MSQ_PROTOS */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_SYS_OS_MSG_H */
diff --git a/dep/ACE_wrappers/ace/os_include/sys/os_pstat.h b/dep/ACE_wrappers/ace/os_include/sys/os_pstat.h
index 051683a7ab9..253b8127979 100644
--- a/dep/ACE_wrappers/ace/os_include/sys/os_pstat.h
+++ b/dep/ACE_wrappers/ace/os_include/sys/os_pstat.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_pstat.h
@@ -10,25 +11,33 @@
* @author Johnny Willemsen <jwillemsen@remedy.nl>
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_SYS_OS_PSTAT_H
#define ACE_OS_INCLUDE_SYS_OS_PSTAT_H
+
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_SYS_PSTAT_H)
# include /**/ <sys/param.h>
# include /**/ <sys/pstat.h>
#endif /* ACE_HAS_SYS_PSTAT_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_SYS_OS_PSTAT_H */
diff --git a/dep/ACE_wrappers/ace/os_include/sys/os_resource.h b/dep/ACE_wrappers/ace/os_include/sys/os_resource.h
index 5b2f13f6022..a724ed2e0eb 100644
--- a/dep/ACE_wrappers/ace/os_include/sys/os_resource.h
+++ b/dep/ACE_wrappers/ace/os_include/sys/os_resource.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_resource.h
@@ -11,33 +12,44 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_SYS_OS_RESOURCE_H
#define ACE_OS_INCLUDE_SYS_OS_RESOURCE_H
+
#include /**/ "ace/pre.h"
+
#include "ace/config-lite.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/sys/os_time.h"
#include "ace/os_include/sys/os_types.h"
+
#if !defined (ACE_LACKS_SYS_RESOURCE_H)
# include /**/ <sys/resource.h>
#endif /* !ACE_LACKS_SYS_RESOURCE_H */
+
#if defined (ACE_HAS_SYS_SYSTEMINFO_H)
# include /**/ <sys/systeminfo.h>
#endif /* ACE_HAS_SYS_SYSTEMINFO_H */
+
#if defined (ACE_HAS_SYS_SYSCALL_H)
# include /**/ <sys/syscall.h>
#endif /* ACE_HAS_SYS_SYSCALL_H */
+
// prusage_t is defined in <sys/procfs.h>
#if defined (ACE_HAS_PROC_FS)
# include /**/ <sys/procfs.h>
#endif /* ACE_HAS_PROC_FS */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
// There must be a better way to do this...
#if !defined (RLIMIT_NOFILE) && !defined (ACE_LACKS_RLIMIT_NOFILE)
# if defined (linux) || defined (AIX) || defined (SCO)
@@ -48,6 +60,7 @@ extern "C"
# endif /* RLIMIT_OFILE */
# endif /* defined (linux) || defined (AIX) || defined (SCO) */
#endif /* RLIMIT_NOFILE */
+
#if defined (ACE_WIN32)
# define RUSAGE_SELF 1
/// Fake the UNIX rusage structure. Perhaps we can add more to this
@@ -58,10 +71,12 @@ extern "C"
FILETIME ru_stime;
};
#endif /* ACE_WIN32 */
+
#if defined (ACE_LACKS_RLIMIT_PROTOTYPE)
int getrlimit (int resource, struct rlimit *rlp);
int setrlimit (int resource, const struct rlimit *rlp);
#endif /* ACE_LACKS_RLIMIT_PROTOTYPE */
+
#if defined (ACE_HAS_PRUSAGE_T)
typedef prusage_t ACE_Rusage;
#elif defined (ACE_HAS_GETRUSAGE)
@@ -69,18 +84,22 @@ extern "C"
#else
typedef int ACE_Rusage;
#endif /* ACE_HAS_PRUSAGE_T */
+
#if !defined (ACE_WIN32)
// These prototypes are chronically lacking from many versions of UNIX.
# if !defined (ACE_HAS_GETRUSAGE_PROTOTYPE)
int getrusage (int who, struct rusage *rusage);
# endif /* ! ACE_HAS_GETRUSAGE_PROTOTYPE */
+
# if defined (ACE_LACKS_SYSCALL)
int syscall (int, ACE_HANDLE, struct rusage *);
# endif /* ACE_LACKS_SYSCALL */
#endif /* !ACE_WIN32 */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_SYS_OS_RESOURCE_H */
diff --git a/dep/ACE_wrappers/ace/os_include/sys/os_select.h b/dep/ACE_wrappers/ace/os_include/sys/os_select.h
index 4abacec9a75..f3e999831fd 100644
--- a/dep/ACE_wrappers/ace/os_include/sys/os_select.h
+++ b/dep/ACE_wrappers/ace/os_include/sys/os_select.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_select.h
@@ -11,27 +12,36 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_SYS_OS_SELECT_H
#define ACE_OS_INCLUDE_SYS_OS_SELECT_H
+
#include /**/ "ace/pre.h"
+
#include "ace/config-lite.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/sys/os_time.h"
#include "ace/os_include/os_signal.h"
#include "ace/os_include/os_unistd.h"
+
#if !defined (ACE_LACKS_SYS_SELECT_H)
# include /**/ <sys/select.h>
#endif /* !ACE_LACKS_SYS_SELECT_H */
+
#if defined (ACE_VXWORKS) && defined (ACE_LACKS_SYS_SELECT_H)
# include /**/ <selectLib.h>
#endif /* ACE_VXWORKS */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#if defined (ACE_WIN32)
// This will help until we figure out everything:
# define NFDBITS 32 /* only used in unused functions... */
@@ -40,9 +50,11 @@ extern "C"
# define NFDBITS (sizeof(fd_mask) * NBBY) /* bits per mask */
# endif /* ! NFDBITS */
#endif /* ACE_WIN32 */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_SYS_OS_SELECT_H */
diff --git a/dep/ACE_wrappers/ace/os_include/sys/os_sem.h b/dep/ACE_wrappers/ace/os_include/sys/os_sem.h
index ace2f78e747..92153e2fcea 100644
--- a/dep/ACE_wrappers/ace/os_include/sys/os_sem.h
+++ b/dep/ACE_wrappers/ace/os_include/sys/os_sem.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_sem.h
@@ -11,48 +12,64 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_SYS_OS_SEM_H
#define ACE_OS_INCLUDE_SYS_OS_SEM_H
+
#include /**/ "ace/pre.h"
+
#include "ace/config-lite.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/sys/os_ipc.h"
+
#if !defined (ACE_LACKS_SYS_SEM_H)
# include /**/ <sys/sem.h>
#endif /* !ACE_LACKS_SYS_SEM_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
# if !defined (GETVAL)
# define GETVAL 0
# endif /* GETVAL */
+
# if !defined (SETVAL)
# define SETVAL 0
# endif /* SETVAL */
+
# if !defined (GETALL)
# define GETALL 0
# endif /* GETALL */
+
# if !defined (SETALL)
# define SETALL 0
# endif /* SETALL */
+
# if !defined (SEM_UNDO)
# define SEM_UNDO 0
# endif /* SEM_UNDO */
+
#if defined (ACE_LACKS_SEMBUF_T)
struct sembuf
{
/// semaphore #
unsigned short sem_num;
+
/// semaphore operation
short sem_op;
+
/// operation flags
short sem_flg;
};
#endif /* ACE_LACKS_SEMBUF_T */
+
#if !defined (ACE_HAS_SEMUN) || (defined (__GLIBC__) && defined (_SEM_SEMUN_UNDEFINED))
union semun
{
@@ -64,9 +81,11 @@ extern "C"
u_short *array;
};
#endif /* !ACE_HAS_SEMUN || (defined (__GLIBC__) && defined (_SEM_SEMUN_UNDEFINED)) */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_SYS_OS_SEM_H */
diff --git a/dep/ACE_wrappers/ace/os_include/sys/os_shm.h b/dep/ACE_wrappers/ace/os_include/sys/os_shm.h
index 11e7e306fae..83e32486cb6 100644
--- a/dep/ACE_wrappers/ace/os_include/sys/os_shm.h
+++ b/dep/ACE_wrappers/ace/os_include/sys/os_shm.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_shm.h
@@ -11,28 +12,38 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_SYS_OS_SHM_H
#define ACE_OS_INCLUDE_SYS_OS_SHM_H
+
#include /**/ "ace/pre.h"
+
#include "ace/config-lite.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/sys/os_ipc.h"
+
#if !defined (ACE_LACKS_SYS_SHM_H)
# include /**/ <sys/shm.h>
#endif /* !ACE_LACKS_SYS_SHM_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
// Declare opaque type. Needed for ACE_OS wrappers on systems
// without SysV IPC.
struct shmid_ds;
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_SYS_OS_SHM_H */
diff --git a/dep/ACE_wrappers/ace/os_include/sys/os_socket.h b/dep/ACE_wrappers/ace/os_include/sys/os_socket.h
index e5377824f65..cefc28c2134 100644
--- a/dep/ACE_wrappers/ace/os_include/sys/os_socket.h
+++ b/dep/ACE_wrappers/ace/os_include/sys/os_socket.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_socket.h
@@ -11,38 +12,50 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_SYS_OS_SOCKET_H
#define ACE_OS_INCLUDE_SYS_OS_SOCKET_H
+
#include /**/ "ace/pre.h"
+
#include "ace/config-lite.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/sys/os_uio.h"
+
#if !defined (ACE_LACKS_SYS_SOCKET_H)
# include /**/ <sys/socket.h>
#endif /* !ACE_LACKS_SYS_SOCKET_H */
+
#if defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x620)
# include /**/ <sockLib.h>
#endif /* ACE_VXWORKS */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#if !defined (ACE_HAS_MSG) && !defined (SCO)
struct msghdr {};
#endif /* ACE_HAS_MSG */
+
#if defined (ACE_HAS_MSG) && defined (ACE_LACKS_MSG_ACCRIGHTS)
# if !defined (msg_accrights)
# undef msg_control
# define msg_accrights msg_control
# endif /* ! msg_accrights */
+
# if !defined (msg_accrightslen)
# undef msg_controllen
# define msg_accrightslen msg_controllen
# endif /* ! msg_accrightslen */
#endif /* ACE_HAS_MSG && ACE_LACKS_MSG_ACCRIGHTS */
+
# if defined (ACE_LACKS_SOCKADDR)
struct sockaddr {
u_char sa_len; /* total length */
@@ -50,110 +63,143 @@ extern "C"
char sa_data[14]; /* actually longer; address value */
};
# endif /* ACE_LACKS_SOCKADDR */
+
# if defined (ACE_LACKS_LINGER)
struct linger {
int l_onoff; /* option on/off */
int l_linger; /* linger time */
};
# endif /* ACE_LACKS_LINGER */
+
#if defined (ACE_WIN32)
struct msghdr
{
/// Optional address
sockaddr * msg_name;
+
/// Size of address
int msg_namelen;
+
/// Scatter/gather array
iovec *msg_iov;
+
/// # elements in msg_iov
int msg_iovlen;
+
/// Access rights sent/received
caddr_t msg_accrights;
+
int msg_accrightslen;
};
#endif /* ACE_WIN32 */
+
#if defined (ACE_HAS_4_4BSD_SENDMSG_RECVMSG)
// Control message size to pass a file descriptor.
# define ACE_BSD_CONTROL_MSG_LEN sizeof (struct cmsghdr) + sizeof (ACE_HANDLE)
#endif /* ACE_HAS_4_4BSD_SENDMSG_RECVMSG */
+
// Increase the range of "address families". Please note that this
// must appear _after_ the include of sys/socket.h, for the AF_FILE
// definition on Linux/glibc2.
#if !defined (AF_ANY)
# define AF_ANY (-1)
#endif /* AF_ANY */
+
#if !defined (AF_UNSPEC)
# define AF_UNSPEC 0
#endif /* AF_UNSPEC */
+
#if !defined (AF_LOCAL)
# define AF_LOCAL 1
#endif /* AF_LOCAL */
+
#if !defined (AF_UNIX)
# define AF_UNIX AF_LOCAL
#endif /* AF_UNIX */
+
#if !defined (AF_INET)
# define AF_INET 2
#endif /* AF_INET */
+
#if !defined (PF_INET)
# define PF_INET AF_INET
#endif /* PF_INET */
+
#if !defined (PF_LOCAL)
# define PF_LOCAL AF_LOCAL
#endif /* PF_LOCAL */
+
#if !defined (PF_UNIX)
# define PF_UNIX PF_LOCAL
#endif /* PF_UNIX */
+
#if !defined (AF_MAX)
# define AF_MAX 29
#endif /* AF_MAX */
+
#if !defined (PF_UNSPEC)
# define PF_UNSPEC 0
#endif /* PF_UNSPEC */
+
#define AF_SPIPE (AF_MAX + 1)
#if !defined (AF_FILE)
# define AF_FILE (AF_MAX + 2)
#endif /* ! AF_FILE */
#define AF_DEV (AF_MAX + 3)
#define AF_UPIPE (AF_SPIPE)
+
#if !defined (MSG_OOB)
# define MSG_OOB 0x1
#endif /* MSG_OOB */
+
#if !defined (MSG_PEEK)
# define MSG_PEEK 0x2
#endif /* MSG_PEEK */
+
#if !defined (SOCK_STREAM)
# define SOCK_STREAM 1
#endif /* SOCK_STREAM */
+
#if !defined (SOCK_DGRAM)
# define SOCK_DGRAM 2
#endif /* SOCK_DGRAM */
+
#if !defined (SOCK_SEQPACKET)
# define SOCK_SEQPACKET 5
#endif /* SOCK_SEQPACKET */
+
#if !defined (SOL_SOCKET)
# define SOL_SOCKET 0xffff
#endif /* SOL_SOCKET */
+
#if !defined (SO_REUSEADDR)
# define SO_REUSEADDR 0x0004
#endif /* SO_REUSEADDR */
+
#if !defined (SO_LINGER)
# define SO_LINGER 0x0080
#endif /* SO_LINGER */
+
#if !defined (SO_SNDBUF)
# define SO_SNDBUF 0x1001
#endif /* SO_SNDBUF */
+
#if !defined (SO_RCVBUF)
# define SO_RCVBUF 0x1002
#endif /* SO_RCVBUF */
+
#if !defined (SO_BROADCAST)
# define SO_BROADCAST 0x0020
#endif /* SO_BROADCAST */
+
#if !defined (SO_ERROR)
# define SO_ERROR 0x1007
#endif /* SO_ERROR */
+
#if !defined (SCM_RIGHTS)
# define SCM_RIGHTS 0x01
#endif /* SCM_RIGHTS */
+
#if defined (ACE_HAS_IPV6)
# if defined (ACE_USES_IPV4_IPV6_MIGRATION)
# define ACE_ADDRESS_FAMILY_INET AF_UNSPEC
@@ -166,9 +212,11 @@ extern "C"
# define ACE_ADDRESS_FAMILY_INET AF_INET
# define ACE_PROTOCOL_FAMILY_INET PF_INET
#endif /* ACE_HAS_IPV6 */
+
#if !defined (ACE_HAS_SOCK_BUF_SIZE_MAX_VALUE)
#define ACE_HAS_SOCK_BUF_SIZE_MAX_VALUE SSIZE_MAX
#endif /* ACE_HAS_SOCK_BUF_SIZE_MAX_VALUE */
+
#if defined (ACE_HAS_SOCKLEN_T)
# if defined (__hpux)
/*
@@ -194,11 +242,13 @@ typedef size_t ACE_SOCKET_LEN;
#else
typedef int ACE_SOCKET_LEN;
#endif /* ACE_HAS_SIZET_SOCKET_LEN */
+
#if defined (ACE_HAS_NETLINK)
# include /**/ <asm/types.h>
# include /**/ <linux/netlink.h>
# define ACE_PROTOCOL_FAMILY_NETLINK AF_NETLINK
#endif
+
#if defined (ACE_HAS_LKSCTP)
extern "C"
{
@@ -206,16 +256,20 @@ extern "C"
#include /**/ <netinet/sctp.h>
}
#endif /* ACE_HAS_LKSCTP */
+
# if defined (ACE_LACKS_TIMEDWAIT_PROTOTYPES)
+
ssize_t recv_timedwait (ACE_HANDLE handle,
char *buf,
int len,
int flags,
struct timespec *timeout);
+
ssize_t recvmsg_timedwait (ACE_HANDLE handle,
struct msghdr *msg,
int flags,
struct timespec *timeout);
+
ssize_t recvfrom_timedwait (ACE_HANDLE handle,
char *buf,
int len,
@@ -223,15 +277,18 @@ extern "C"
struct sockaddr *addr,
int *addrlen,
struct timespec *timeout);
+
ssize_t send_timedwait (ACE_HANDLE handle,
const char *buf,
int len,
int flags,
struct timespec *timeout);
+
ssize_t sendmsg_timedwait (ACE_HANDLE handle,
const struct msghdr *msg,
int flags,
struct timespec *timeout);
+
ssize_t sendto_timedwait (ACE_HANDLE handle,
const char *buf,
int len,
@@ -239,10 +296,13 @@ extern "C"
const struct sockaddr *addr,
int addrlen,
struct timespec *timeout);
+
# endif /* ACE_LACKS_TIMEDWAIT_PROTOTYPES */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_SYS_OS_SOCKET_H */
diff --git a/dep/ACE_wrappers/ace/os_include/sys/os_stat.h b/dep/ACE_wrappers/ace/os_include/sys/os_stat.h
index 47f4eca2101..edd43d3932a 100644
--- a/dep/ACE_wrappers/ace/os_include/sys/os_stat.h
+++ b/dep/ACE_wrappers/ace/os_include/sys/os_stat.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_stat.h
@@ -11,28 +12,39 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_SYS_OS_STAT_H
#define ACE_OS_INCLUDE_SYS_OS_STAT_H
+
#include /**/ "ace/pre.h"
+
#include "ace/config-lite.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/sys/os_types.h"
+
#if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)
# include /**/ <direct.h>
#endif /* ACE_WIN32 && !ACE_HAS_WINCE */
+
#if !defined (ACE_LACKS_SYS_STAT_H)
# include /**/ <sys/stat.h>
#endif /* !ACE_LACKS_SYS_STAT_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#if defined (ACE_LACKS_MODE_MASKS)
// MODE MASKS
+
// the following macros are for POSIX conformance.
+
# if !defined (ACE_HAS_USER_MODE_MASKS)
# define S_IRWXU 00700 /* read, write, execute: owner. */
# define S_IRUSR 00400 /* read permission: owner. */
@@ -47,11 +59,14 @@ extern "C"
# define S_IROTH 00004 /* read permission: other. */
# define S_IWOTH 00002 /* write permission: other. */
# define S_IXOTH 00001 /* execute permission: other. */
+
// WinCE's S_IFLNK is defined with the other bits, below.
#if !defined (S_IFLNK) && !defined (ACE_HAS_WINCE)
#define S_IFLNK 0200000
#endif /* S_IFLNK && !ACE_HAS_WINCE */
+
#endif /* ACE_LACKS_MODE_MASKS */
+
// Some systems (VxWorks) don't define S_ISLNK
#if !defined (S_ISLNK)
# if defined (S_IFLNK)
@@ -60,8 +75,10 @@ extern "C"
# define S_ISLNK(mode) 0
# endif /* S_IFLNK */
#endif /* S_ISLNK */
+
#if defined (ACE_HAS_WINCE)
# include "ace/Time_Value.h"
+
// Translate the WinCE bits into names expected by our callers.
// The dwFileAttributes parameter doesn't have protection info, so
// S_IFMT is the whole thing. Since there are no symbolic links, S_IFLNK is 0.
@@ -69,32 +86,43 @@ extern "C"
# define S_IFDIR FILE_ATTRIBUTE_DIRECTORY
# define S_IFREG FILE_ATTRIBUTE_NORMAL
# define S_IFLNK 0
+
struct stat
{
/// always 0 on Windows platforms
dev_t st_dev;
+
/// always 0 on Windows platforms
dev_t st_rdev;
+
/// file attribute
unsigned short st_mode;
+
/// number of hard links
short st_nlink;
+
/// time of last access
ACE_Time_Value st_atime;
+
/// time of last data modification
ACE_Time_Value st_mtime;
+
/// time of creation
ACE_Time_Value st_ctime;
+
/// file size, in bytes
ACE_OFF_T st_size;
+
// Following members do not have direct conversion in Window platforms.
//u_long st_blksize; // optimal blocksize for I/O
//u_long st_flags; // user defined flags for file
};
#endif /* ACE_HAS_WINCE */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_SYS_OS_STAT_H */
diff --git a/dep/ACE_wrappers/ace/os_include/sys/os_statvfs.h b/dep/ACE_wrappers/ace/os_include/sys/os_statvfs.h
index d53e5c072c0..6661aa437d9 100644
--- a/dep/ACE_wrappers/ace/os_include/sys/os_statvfs.h
+++ b/dep/ACE_wrappers/ace/os_include/sys/os_statvfs.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_statvfs.h
@@ -11,24 +12,32 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_SYS_OS_STATVFS_H
#define ACE_OS_INCLUDE_SYS_OS_STATVFS_H
+
#include /**/ "ace/pre.h"
+
#include "ace/config-lite.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if !defined (ACE_LACKS_SYS_STATVFS_H)
# include /**/ <sys/statvfs.h>
#endif /* !ACE_LACKS_SYS_STATVFS_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_SYS_OS_STATVFS_H */
diff --git a/dep/ACE_wrappers/ace/os_include/sys/os_sysctl.h b/dep/ACE_wrappers/ace/os_include/sys/os_sysctl.h
index e68095fe35a..630c9de345b 100644
--- a/dep/ACE_wrappers/ace/os_include/sys/os_sysctl.h
+++ b/dep/ACE_wrappers/ace/os_include/sys/os_sysctl.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_sysctl.h
@@ -10,24 +11,32 @@
* @author Johnny Willemsen <jwillemsen@remedy.nl>
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_SYS_OS_SYSCTL_H
#define ACE_OS_INCLUDE_SYS_OS_SYSCTL_H
+
#include /**/ "ace/pre.h"
+
#include "ace/config-lite.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if !defined (ACE_LACKS_SYS_SYSCTL_H)
# include /**/ <sys/sysctl.h>
#endif /* !ACE_LACKS_SYS_SYSCTL_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_SYS_OS_SYSCTL_H */
diff --git a/dep/ACE_wrappers/ace/os_include/sys/os_sysinfo.h b/dep/ACE_wrappers/ace/os_include/sys/os_sysinfo.h
index 0212536e942..19d57e984f9 100644
--- a/dep/ACE_wrappers/ace/os_include/sys/os_sysinfo.h
+++ b/dep/ACE_wrappers/ace/os_include/sys/os_sysinfo.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_sysinfo.h
@@ -8,24 +9,32 @@
* @author Johnny Willemsen <jwillemsen@remedy.nl>
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_SYS_OS_SYSINFO_H
#define ACE_OS_INCLUDE_SYS_OS_SYSINFO_H
+
#include /**/ "ace/pre.h"
+
#include "ace/config-lite.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if defined (ACE_HAS_SYS_SYSINFO_H)
# include /**/ <sys/sysinfo.h>
#endif /* ACE_HAS_SYS_SYSINFO_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_SYS_OS_SYSINFO_H */
diff --git a/dep/ACE_wrappers/ace/os_include/sys/os_time.h b/dep/ACE_wrappers/ace/os_include/sys/os_time.h
index c3f72cfc9d3..130a8265ac2 100644
--- a/dep/ACE_wrappers/ace/os_include/sys/os_time.h
+++ b/dep/ACE_wrappers/ace/os_include/sys/os_time.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_time.h
@@ -11,25 +12,34 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_SYS_OS_TIME_H
#define ACE_OS_INCLUDE_SYS_OS_TIME_H
+
#include /**/ "ace/pre.h"
+
#include "ace/config-lite.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/sys/os_types.h"
+
#if !defined (ACE_LACKS_SYS_TIME_H)
# include /**/ <sys/time.h>
#endif /* !ACE_LACKS_SYS_TIME_H */
+
#if defined (ACE_VXWORKS) && (ACE_VXWORKS == 0x620)
# include /**/ <time.h> // VxWorks 6.2 defined timeval in time.h
#endif
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#if defined (ACE_HAS_SVR4_GETTIMEOFDAY)
# if !defined (SCO)
int gettimeofday (struct timeval *tp, void * = 0);
@@ -41,9 +51,11 @@ extern "C"
#elif defined (ACE_HAS_VOIDPTR_GETTIMEOFDAY)
# define ACE_HAS_SVR4_GETTIMEOFDAY
#endif /* ACE_HAS_SVR4_GETTIMEOFDAY */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_SYS_OS_TIME_H */
diff --git a/dep/ACE_wrappers/ace/os_include/sys/os_timeb.h b/dep/ACE_wrappers/ace/os_include/sys/os_timeb.h
index 4a6ac1ef04a..c8c0d74043c 100644
--- a/dep/ACE_wrappers/ace/os_include/sys/os_timeb.h
+++ b/dep/ACE_wrappers/ace/os_include/sys/os_timeb.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_timeb.h
@@ -11,29 +12,39 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_SYS_OS_TIMEB_H
#define ACE_OS_INCLUDE_SYS_OS_TIMEB_H
+
#include /**/ "ace/pre.h"
+
#include "ace/config-lite.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/sys/os_types.h"
+
#if !defined (ACE_LACKS_SYS_TIMEB_H)
# include /**/ <sys/timeb.h>
#endif /* !ACE_LACKS_SYS_TIMEB_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#if defined (__BORLANDC__) && (__BORLANDC__ <= 0x560)
# define _ftime ftime
# define _timeb timeb
#endif /* __BORLANDC__ */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_SYS_OS_TIMEB_H */
diff --git a/dep/ACE_wrappers/ace/os_include/sys/os_times.h b/dep/ACE_wrappers/ace/os_include/sys/os_times.h
index ce6614b8490..d6769f7eb8d 100644
--- a/dep/ACE_wrappers/ace/os_include/sys/os_times.h
+++ b/dep/ACE_wrappers/ace/os_include/sys/os_times.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_times.h
@@ -11,25 +12,34 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_SYS_OS_TIMES_H
#define ACE_OS_INCLUDE_SYS_OS_TIMES_H
+
#include /**/ "ace/pre.h"
+
#include "ace/config-lite.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/sys/os_types.h"
+
#if !defined (ACE_LACKS_SYS_TIMES_H)
# include /**/ <sys/times.h>
#endif /* !ACE_LACKS_SYS_TIMES_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_SYS_OS_TIMES_H */
diff --git a/dep/ACE_wrappers/ace/os_include/sys/os_types.h b/dep/ACE_wrappers/ace/os_include/sys/os_types.h
index d5ef4964abd..0377e024b69 100644
--- a/dep/ACE_wrappers/ace/os_include/sys/os_types.h
+++ b/dep/ACE_wrappers/ace/os_include/sys/os_types.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_types.h
@@ -11,30 +12,41 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_SYS_OS_TYPES_H
#define ACE_OS_INCLUDE_SYS_OS_TYPES_H
+
#include /**/ "ace/pre.h"
+
#include "ace/config-lite.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/os_stddef.h"
+
#if !defined (ACE_LACKS_SYS_TYPES_H)
# include /**/ <sys/types.h>
#endif /* !ACE_LACKS_SYS_TYPES_H */
+
#if defined (ACE_HAS_WINCE)
# include /**/ <types.h>
#endif /* ACE_HAS_WINCE */
+
# if defined (ACE_USES_STD_NAMESPACE_FOR_STDC_LIB) && \
(ACE_USES_STD_NAMESPACE_FOR_STDC_LIB != 0)
using std::time_t;
# endif /* ACE_USES_STD_NAMESPACE_FOR_STDC_LIB */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
typedef double ACE_timer_t;
+
// todo: don't forget to clean this up! ;-)
#if !defined (ACE_HAS_CLOCK_GETTIME) && !(defined (_CLOCKID_T_) || defined (_CLOCKID_T))
typedef int clockid_t;
@@ -42,24 +54,30 @@ typedef double ACE_timer_t;
# define CLOCK_REALTIME 0
# endif /* CLOCK_REALTIME */
#endif /* ! ACE_HAS_CLOCK_GETTIME && ! _CLOCKID_T_ */
+
#if defined (ACE_HAS_WINCE)
+
// CE's add-on for c-style fstat/stat functionalities. This struct is
// by no mean complete compared to what you usually find in UNIX
// platforms. Only members that have direct conversion using Win32's
// BY_HANDLE_FILE_INFORMATION are defined so that users can discover
// non-supported members at compile time. Time values are of type
// ACE_Time_Value for easy comparison.
+
// Since CE does not have _stat by default as NT/2000 does, the 'stat'
// struct defined here will be used. Also note that CE file system
// struct is only for the CE 3.0 or later.
// Refer to the WCHAR.H from Visual C++ and WIBASE.H from eVC 3.0.
+
typedef unsigned int dev_t;
#endif /* ACE_HAS_WINCE */
+
#if defined(ACE_WIN32) && defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS==64)
typedef __int64 ACE_OFF_T;
#else
typedef off_t ACE_OFF_T;
#endif
+
#if defined (ACE_SIZEOF_LONG) && ACE_SIZEOF_LONG == 8
typedef off_t ACE_LOFF_T;
#elif defined (ACE_HAS_RTEMS) || defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) || defined (__APPLE__) || \
@@ -79,6 +97,7 @@ typedef double ACE_timer_t;
#else
typedef loff_t ACE_LOFF_T;
#endif
+
#if defined (ACE_WIN32)
# if !defined (__BORLANDC__)
typedef DWORD nlink_t;
@@ -90,6 +109,7 @@ typedef double ACE_timer_t;
# endif /* __BORLANDC__ */
typedef char *caddr_t;
#endif /* ACE_WIN32 */
+
#if defined (ACE_LACKS_KEY_T)
# if defined (ACE_WIN32)
// Win32 doesn't use numeric values to name its semaphores, it uses
@@ -99,6 +119,7 @@ typedef double ACE_timer_t;
typedef int key_t;
# endif /* ACE_WIN32 */
#endif /* ACE_LACKS_KEY_T */
+
#if !defined (ACE_HAS_SSIZE_T)
# if defined (ACE_WIN64)
typedef SSIZE_T ssize_t;
@@ -106,26 +127,33 @@ typedef double ACE_timer_t;
typedef int ssize_t;
# endif /* ACE_WIN64 */
#endif /* ACE_HAS_SSIZE_T */
+
#if defined (ACE_WIN32)
typedef DWORD ACE_exitcode;
#else
typedef int ACE_exitcode;
#endif /* ACE_WIN32 */
+
#if defined (ACE_LACKS_SUSECONDS_T)
typedef long suseconds_t;
#endif
+
#if defined (ACE_LACKS_USECONDS_T)
typedef unsigned long useconds_t;
#endif
+
#if defined (ACE_WIN32) && !defined(__MINGW32__)
typedef int pid_t;
#endif /* ACE_WIN32 */
+
# if !defined (ACE_INVALID_PID)
# define ACE_INVALID_PID ((pid_t) -1)
# endif /* ACE_INVALID_PID */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_SYS_OS_TYPES_H */
diff --git a/dep/ACE_wrappers/ace/os_include/sys/os_uio.h b/dep/ACE_wrappers/ace/os_include/sys/os_uio.h
index abffee236d6..ccc5bbeb12e 100644
--- a/dep/ACE_wrappers/ace/os_include/sys/os_uio.h
+++ b/dep/ACE_wrappers/ace/os_include/sys/os_uio.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_uio.h
@@ -11,23 +12,31 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_SYS_OS_UIO_H
#define ACE_OS_INCLUDE_SYS_OS_UIO_H
+
#include /**/ "ace/pre.h"
+
#include "ace/config-lite.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/sys/os_types.h"
#include "ace/os_include/os_limits.h"
+
#if !defined (ACE_LACKS_SYS_UIO_H)
# include /**/ <sys/uio.h>
#endif /* !ACE_LACKS_SYS_UIO_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#if defined (ACE_LACKS_IOVEC)
/// The ordering of the fields in this struct is important. It has to
/// match those in WSABUF.
@@ -37,6 +46,7 @@ extern "C"
u_long iov_len;
/// data to be read/written
char *iov_base;
+
// WSABUF is a Winsock2-only type.
# if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
operator WSABUF &(void) { return *((WSABUF *) this); }
@@ -44,19 +54,25 @@ extern "C"
};
#endif /* ACE_LACKS_IOVEC */
+
# if defined (ACE_LACKS_TIMEDWAIT_PROTOTYPES)
+
ssize_t readv_timedwait (ACE_HANDLE handle,
const iovec *iov,
int iovcnt,
struct timespec* timeout);
+
ssize_t writev_timedwait (ACE_HANDLE handle,
const iovec *iov,
int iovcnt,
struct timespec *timeout);
+
# endif /* ACE_LACKS_TIMEDWAIT_PROTOTYPES */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_SYS_OS_UIO_H */
diff --git a/dep/ACE_wrappers/ace/os_include/sys/os_un.h b/dep/ACE_wrappers/ace/os_include/sys/os_un.h
index 995d13e3609..00b07315249 100644
--- a/dep/ACE_wrappers/ace/os_include/sys/os_un.h
+++ b/dep/ACE_wrappers/ace/os_include/sys/os_un.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_un.h
@@ -11,22 +12,30 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_SYS_OS_UN_H
#define ACE_OS_INCLUDE_SYS_OS_UN_H
+
#include /**/ "ace/pre.h"
+
#include "ace/config-lite.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/sys/os_socket.h"
+
#if !defined (ACE_LACKS_SYS_UN_H)
# include /**/ <sys/un.h>
#endif /* !ACE_LACKS_SYS_UN_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#if defined (ACE_VXWORKS) && (ACE_VXWORKS <= 0x600)
struct sockaddr_un {
short sun_family; // AF_UNIX.
@@ -34,9 +43,11 @@ struct sockaddr_un {
};
#endif /* ACE_VXWORKS */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_SYS_OS_UN_H */
diff --git a/dep/ACE_wrappers/ace/os_include/sys/os_utsname.h b/dep/ACE_wrappers/ace/os_include/sys/os_utsname.h
index f1e24c758a2..23748bb7160 100644
--- a/dep/ACE_wrappers/ace/os_include/sys/os_utsname.h
+++ b/dep/ACE_wrappers/ace/os_include/sys/os_utsname.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_utsname.h
@@ -11,24 +12,32 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_SYS_OS_UTSNAME_H
#define ACE_OS_INCLUDE_SYS_OS_UTSNAME_H
+
#include /**/ "ace/pre.h"
+
#include "ace/config-lite.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#if !defined (ACE_LACKS_SYS_UTSNAME_H)
# include /**/ <sys/utsname.h>
#endif /* !ACE_LACKS_SYS_UTSNAME_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_SYS_OS_UTSNAME_H */
diff --git a/dep/ACE_wrappers/ace/os_include/sys/os_wait.h b/dep/ACE_wrappers/ace/os_include/sys/os_wait.h
index 253e49c7cd5..fd42e2cdf90 100644
--- a/dep/ACE_wrappers/ace/os_include/sys/os_wait.h
+++ b/dep/ACE_wrappers/ace/os_include/sys/os_wait.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file os_wait.h
@@ -11,31 +12,42 @@
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
+
#ifndef ACE_OS_INCLUDE_SYS_OS_WAIT_H
#define ACE_OS_INCLUDE_SYS_OS_WAIT_H
+
#include /**/ "ace/pre.h"
+
#include "ace/config-lite.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "ace/os_include/os_signal.h"
#include "ace/os_include/sys/os_resource.h"
+
#if !defined (ACE_LACKS_SYS_WAIT_H)
# include /**/ <sys/wait.h>
#endif /* !ACE_LACKS_SYS_WAIT_H */
+
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
+
// Wrapping around wait status <wstat> macros for platforms that
// lack them.
+
# if !defined (WCOREDUMP)
# define WCOREDUMP(stat) 0
# endif /* WCOREDUMP */
+
# if !defined (WNOHANG)
# define WNOHANG 0100
# endif /* !WNOHANG */
+
// If the value of WIFEXITED(stat) is non-zero, this macro evaluates
// to the exit code that the child process exit(3C), or the value
// that the child process returned from main. Peaceful exit code is
@@ -43,36 +55,44 @@ extern "C"
# if !defined (WEXITSTATUS)
# define WEXITSTATUS(stat) stat
# endif /* WEXITSTATUS */
+
# if !defined (WIFCONTINUED)
# define WIFCONTINUED(stat) 0
# endif /* WIFCONTINUED */
+
// Evaluates to a non-zero value if status was returned for a child
// process that terminated normally. 0 means status wasn't
// returned.
# if !defined (WIFEXITED)
# define WIFEXITED(stat) 1
# endif /* WIFEXITED */
+
// Evaluates to a non-zero value if status was returned for a child
// process that terminated due to the receipt of a signal. 0 means
// status wasnt returned.
# if !defined (WIFSIGNALED)
# define WIFSIGNALED(stat) 0
# endif /* WIFSIGNALED */
+
# if !defined (WIFSTOPPED)
# define WIFSTOPPED(stat) 0
# endif /* WIFSTOPPED */
+
# if !defined (WSTOPSIG)
# define WSTOPSIG(stat) 0
# endif /* WSTOPSIG */
+
// If the value of WIFSIGNALED(stat) is non-zero, this macro
// evaluates to the number of the signal that caused the
// termination of the child process.
# if !defined (WTERMSIG)
# define WTERMSIG(stat) 0
# endif /* WTERMSIG */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
+
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_SYS_OS_WAIT_H */
diff --git a/dep/ACE_wrappers/ace/post.h b/dep/ACE_wrappers/ace/post.h
index d2f3ef278c7..7c77af216ad 100644
--- a/dep/ACE_wrappers/ace/post.h
+++ b/dep/ACE_wrappers/ace/post.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file post.h
@@ -10,6 +11,7 @@
* This file restores the original alignment rules.
*/
//=============================================================================
+
// No header guard
#if defined (_MSC_VER)
# pragma pack (pop)
diff --git a/dep/ACE_wrappers/ace/pre.h b/dep/ACE_wrappers/ace/pre.h
index 24ba0e6db1a..6984b22804e 100644
--- a/dep/ACE_wrappers/ace/pre.h
+++ b/dep/ACE_wrappers/ace/pre.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file pre.h
@@ -11,6 +12,7 @@
* boundary to ACE's default.
*/
//=============================================================================
+
// No header guard
#if defined (_MSC_VER)
# pragma warning (disable:4103)
diff --git a/dep/ACE_wrappers/ace/streams.h b/dep/ACE_wrappers/ace/streams.h
index 68c007d30a7..2b3ae4390fa 100644
--- a/dep/ACE_wrappers/ace/streams.h
+++ b/dep/ACE_wrappers/ace/streams.h
@@ -1,4 +1,5 @@
// -*- C++ -*-
+
//=============================================================================
/**
* @file streams.h
@@ -17,26 +18,34 @@
*/
//=============================================================================
+
#ifndef ACE_STREAMS_H
#define ACE_STREAMS_H
#include /**/ "ace/pre.h"
+
#include /**/ "ace/config-all.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
// Do this so the #pragma warning in the MSVC headers do not
// affect our #pragma warning settings
#if defined (_MSC_VER)
#pragma warning(push)
#endif /* _MSC_VER*/
+
#if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
+
# if defined (ACE_HAS_STANDARD_CPP_LIBRARY) && \
(ACE_HAS_STANDARD_CPP_LIBRARY != 0)
+
# if defined (_MSC_VER)
# pragma warning(disable: 4018 4114 4146 4245)
# pragma warning(disable: 4663 4664 4665 4511 4512)
# endif /* _MSC_VER */
+
# if defined (ACE_USES_OLD_IOSTREAMS)
# include /**/ <iostream.h>
# include /**/ <fstream.h>
@@ -54,8 +63,10 @@
# include /**/ <iomanip>
# include /**/ <ios>
# endif /* ACE_USES_OLD_IOSTREAMS */
+
# if defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB) && \
(ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB != 0)
+
# if !defined (ACE_USES_OLD_IOSTREAMS)
// Make these available in the global name space
using std::ios;
@@ -68,32 +79,42 @@
using std::ifstream;
using std::ofstream;
using std::fstream;
+
using std::cin;
using std::cout;
using std::cerr;
using std::clog;
+
using std::endl;
using std::ends;
using std::flush;
+
using std::ws;
+
using std::resetiosflags;
using std::setfill;
using std::setiosflags;
using std::setprecision;
using std::setw;
+
using std::dec;
using std::hex;
using std::oct;
# endif /* ! ACE_USES_OLD_IOSTREAMS */
+
# endif /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */
+
# if defined (_MSC_VER)
# pragma warning(4: 4018 4114 4146 4245)
# pragma warning(4: 4663 4664 4665 4512 4511)
# endif /* _MSC_VER */
+
# else /* ! ACE_HAS_STANDARD_CPP_LIBRARY */
+
# include /**/ <fstream.h>
# include /**/ <iostream.h>
# include /**/ <iomanip.h>
+
# if defined (ACE_WIN32) && !defined(__MINGW32__)
# if defined(_MSC_VER) // VSB
# include /**/ <ios.h>
@@ -102,13 +123,17 @@
# include /**/ <ostream.h>
# endif /* _MSC_VER */
# endif /* ACE_WIN32 && !__MINGW32__ */
+
# endif /* ! ACE_HAS_STANDARD_CPP_LIBRARY */
+
#endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */
+
// Do this so the #pragma warning in the MSVC headers do not
// affect our #pragma warning settings
#if defined (_MSC_VER)
#pragma warning(pop)
#endif /* _MSC_VER */
+
#include /**/ "ace/post.h"
#endif /* ACE_STREAMS_H */
diff --git a/dep/ACE_wrappers/ace/svc_export.h b/dep/ACE_wrappers/ace/svc_export.h
index 5626dc02640..33fa67cd80b 100644
--- a/dep/ACE_wrappers/ace/svc_export.h
+++ b/dep/ACE_wrappers/ace/svc_export.h
@@ -1,20 +1,26 @@
// -*- C++ -*-
// $Id: svc_export.h 80826 2008-03-04 14:51:23Z wotte $
// Definition for Win32 Export directives.
+
// This file was generated by generate_export_file.pl
// but needed to be altered to support ACE_BUILD_SVC_DLL
// instead of ACE_SVC_BUILD_DLL which was already being
// used.
+
// ------------------------------
#if !defined (ACE_SVC_EXPORT_H)
#define ACE_SVC_EXPORT_H
+
#include /**/ "ace/config-all.h"
+
#if defined (ACE_AS_STATIC_LIBS) && !defined (ACE_SVC_HAS_DLL)
# define ACE_SVC_HAS_DLL 0
#endif /* ACE_AS_STATIC_LIBS && ACE_SVC_HAS_DLL */
+
#if !defined (ACE_SVC_HAS_DLL)
#define ACE_SVC_HAS_DLL 1
#endif /* ! ACE_SVC_HAS_DLL */
+
#if defined (ACE_SVC_HAS_DLL)
# if (ACE_SVC_HAS_DLL == 1)
# if defined (ACE_BUILD_SVC_DLL) || defined (ACE_SVC_BUILD_DLL)
@@ -32,6 +38,8 @@
# define ACE_Svc_Export
# define ACE_SVC_SINGLETON_DECLARATION(T)
#endif /* ACE_SVC_HAS_DLL */
+
#endif /* ACE_SVC_EXPORT_H */
+
// End of auto generated file.