diff options
Diffstat (limited to 'netsvcs/clients/Tokens/mutex')
-rw-r--r-- | netsvcs/clients/Tokens/mutex/Makefile | 86 | ||||
-rw-r--r-- | netsvcs/clients/Tokens/mutex/README | 23 | ||||
-rw-r--r-- | netsvcs/clients/Tokens/mutex/test_mutex.cpp | 144 |
3 files changed, 0 insertions, 253 deletions
diff --git a/netsvcs/clients/Tokens/mutex/Makefile b/netsvcs/clients/Tokens/mutex/Makefile deleted file mode 100644 index 7a623947ca0..00000000000 --- a/netsvcs/clients/Tokens/mutex/Makefile +++ /dev/null @@ -1,86 +0,0 @@ -#---------------------------------------------------------------------------- -# @(#)Makefile 1.1 10/18/96 -# -# Makefile for repeating token client application -#---------------------------------------------------------------------------- - -#---------------------------------------------------------------------------- -# Local macros -#---------------------------------------------------------------------------- - -BIN = test_mutex - -FILES = test_mutex - -LSRC = $(addsuffix .cpp,$(FILES)) -LOBJ = $(LSRC:%.cpp=$(VDIR)%.o) -SHOBJ = $(addsuffix .so,$(FILES)) - -BUILD = $(VBIN) - -#---------------------------------------------------------------------------- -# Include macros and targets -#---------------------------------------------------------------------------- - -include $(WRAPPER_ROOT)/include/makeinclude/wrapper_macros.GNU -include $(WRAPPER_ROOT)/include/makeinclude/macros.GNU -include $(WRAPPER_ROOT)/include/makeinclude/rules.common.GNU -include $(WRAPPER_ROOT)/include/makeinclude/rules.nonested.GNU -include $(WRAPPER_ROOT)/include/makeinclude/rules.lib.GNU -include $(WRAPPER_ROOT)/include/makeinclude/rules.bin.GNU -include $(WRAPPER_ROOT)/include/makeinclude/rules.local.GNU - -#---------------------------------------------------------------------------- -# Local targets -#---------------------------------------------------------------------------- - -#---------------------------------------------------------------------------- -# Dependencies -#---------------------------------------------------------------------------- - -# IF YOU PUT ANYTHING HERE IT WILL GO AWAY -# DO NOT DELETE THIS LINE -- g++dep uses it. -# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. - -.obj/test_mutex.o .shobj/test_mutex.so: test_mutex.cpp \ - $(WRAPPER_ROOT)/ace/OS.h \ - $(WRAPPER_ROOT)/ace/Time_Value.h \ - $(WRAPPER_ROOT)/ace/config.h \ - $(WRAPPER_ROOT)/ace/stdcpp.h \ - $(WRAPPER_ROOT)/ace/Trace.h \ - $(WRAPPER_ROOT)/ace/Log_Msg.h \ - $(WRAPPER_ROOT)/ace/Log_Record.h \ - $(WRAPPER_ROOT)/ace/Log_Priority.h \ - $(WRAPPER_ROOT)/ace/ACE.h \ - $(WRAPPER_ROOT)/ace/ACE.i \ - $(WRAPPER_ROOT)/ace/Log_Record.i \ - $(WRAPPER_ROOT)/ace/Get_Opt.h \ - $(WRAPPER_ROOT)/ace/Local_Tokens.h \ - $(WRAPPER_ROOT)/ace/Synch.h \ - $(WRAPPER_ROOT)/ace/SV_Semaphore_Complex.h \ - $(WRAPPER_ROOT)/ace/SV_Semaphore_Simple.h \ - $(WRAPPER_ROOT)/ace/SV_Semaphore_Simple.i \ - $(WRAPPER_ROOT)/ace/SV_Semaphore_Complex.i \ - $(WRAPPER_ROOT)/ace/Synch_T.h \ - $(WRAPPER_ROOT)/ace/Event_Handler.h \ - $(WRAPPER_ROOT)/ace/Stack.h \ - $(WRAPPER_ROOT)/ace/Synch_Options.h \ - $(WRAPPER_ROOT)/ace/Map_Manager.h \ - $(WRAPPER_ROOT)/ace/Remote_Tokens.h \ - $(WRAPPER_ROOT)/ace/INET_Addr.h \ - $(WRAPPER_ROOT)/ace/Addr.h \ - $(WRAPPER_ROOT)/ace/SOCK_Connector.h \ - $(WRAPPER_ROOT)/ace/SOCK_Stream.h \ - $(WRAPPER_ROOT)/ace/SOCK_IO.h \ - $(WRAPPER_ROOT)/ace/SOCK.h \ - $(WRAPPER_ROOT)/ace/IPC_SAP.h \ - $(WRAPPER_ROOT)/ace/IPC_SAP.i \ - $(WRAPPER_ROOT)/ace/SOCK.i \ - $(WRAPPER_ROOT)/ace/SOCK_IO.i \ - $(WRAPPER_ROOT)/ace/SOCK_Stream.i \ - $(WRAPPER_ROOT)/ace/SOCK_Connector.i \ - $(WRAPPER_ROOT)/ace/Token_Request_Reply.h \ - $(WRAPPER_ROOT)/ace/Thread.h \ - $(WRAPPER_ROOT)/ace/Thread_Manager.h - -# IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff --git a/netsvcs/clients/Tokens/mutex/README b/netsvcs/clients/Tokens/mutex/README deleted file mode 100644 index cbd1e9c7d6c..00000000000 --- a/netsvcs/clients/Tokens/mutex/README +++ /dev/null @@ -1,23 +0,0 @@ - -test_mutex - -test_mutex tests ACE_Local_Mutex and ACE_Remote_Mutex with both local -and global proxies. "Local proxies" mean that each thread uses its -own proxy (but same logical token.) "Global proxy" means that all -threads access the same proxy (and, of course, the same logical -token.) - -test_mutex can take the number of threads to run from the -command-line. Thus, to run the test with one thread and local -mutexes, type: - -% ./test_mutex - -To run the test with 10 threads and local mutexes, type: - -% ./test_mutex -t 10 - -To run the test with 10 threads and remote mutexes, type: - -% ./test_mutex -t 10 -r - diff --git a/netsvcs/clients/Tokens/mutex/test_mutex.cpp b/netsvcs/clients/Tokens/mutex/test_mutex.cpp deleted file mode 100644 index 6dbe1c66611..00000000000 --- a/netsvcs/clients/Tokens/mutex/test_mutex.cpp +++ /dev/null @@ -1,144 +0,0 @@ -// ============================================================================ -// $Id$ - -// -// = LIBRARY -// examples -// -// = FILENAME -// test_mutex.cpp -// -// = DESCRIPTION -// -// = AUTHOR -// Tim Harrison -// -// ============================================================================ - -#include "ace/OS.h" - -#include "ace/Get_Opt.h" -#include "ace/Local_Tokens.h" -#include "ace/Remote_Tokens.h" -#include "ace/Thread.h" -#include "ace/Thread_Manager.h" - -#if defined (ACE_HAS_THREADS) - -static ACE_Token_Proxy *mutex; -static int remote_mutexes = 0; -static char *server_host = ACE_DEFAULT_SERVER_HOST; -static int server_port = ACE_DEFAULT_SERVER_PORT; -static int iterations = 100; -static int spawn_count = 2; - -static void * -run_test (void *vp) -{ - ACE_Thread_Manager *thr_mgr = (ACE_Thread_Manager*) vp; - ACE_Thread_Control tc (thr_mgr); - - int count = iterations; - // test recursive acquisition of a global proxy - while (count--) - { - if (mutex->acquire () == -1) - { - ACE_ERROR ((LM_ERROR, "(%t) %p acquire failed\n","test_mutex")); - return (void *) -1; - } - -// mutex->acquire (); - if (mutex->renew () == -1) - { - ACE_ERROR ((LM_ERROR, "(%t) %p renew failed\n","test_mutex")); - return (void *) -1; - } - - if (mutex->release () == -1) - { - ACE_ERROR ((LM_ERROR, "(%t) %p release failed\n","test_mutex")); - return (void *) -1; - } - -// mutex->release (); - } - - return 0; -} - -static int -parse_args (int argc, char *argv[]) -{ - ACE_LOG_MSG->open (argv[0]); - - ACE_Get_Opt get_opt (argc, argv, "t:uh:p:n:", 1); - - for (int c; (c = get_opt ()) != -1; ) - { - switch (c) - { - case 't': - spawn_count = ACE_OS::atoi (get_opt.optarg); - break; - case 'h': // specify the host machine on which the server is running - server_host = get_opt.optarg; - remote_mutexes = 1; - break; - case 'p': // specify the port on which the server is running - server_port = ACE_OS::atoi (get_opt.optarg); - remote_mutexes = 1; - break; - case 'n': // specify the port on which the server is running - iterations = ACE_OS::atoi (get_opt.optarg); - break; - case 'u': - default: - ACE_ERROR_RETURN ((LM_ERROR, - "%n:\n" - "[-h <remote host>]\n" - "[-p <remote port>]\n" - "[-n <iterations>]\n" - "[-t <threads>]\n" - "[-h <remote host>]\n" - "[-p <remote port>]\n", 1), -1); - break; - } - } - - return 0; -} - -int -main (int argc, char* argv[]) -{ - ACE_Thread_Manager thread_mgr; - - if (parse_args (argc, argv) == -1) - return -1; - - if (remote_mutexes) - { - ACE_Remote_Mutex::set_server_address (ACE_INET_Addr (server_port, server_host)); - mutex = new ACE_Remote_Mutex ("Remote TOKEN", 0, 1); - } - else - { - mutex = new ACE_Local_Mutex ("Local TOKEN", 0, 1); - } - - if (thread_mgr.spawn_n (spawn_count, - ACE_THR_FUNC (run_test), - (void *) &thread_mgr, THR_BOUND) == -1) - ACE_ERROR_RETURN ((LM_DEBUG, "%p\n", "spawn"), -1); - - thread_mgr.wait (); - - return 42; -} -#else -int main (void) -{ - ACE_ERROR_RETURN ((LM_ERROR, "you must have threads to run this test program\n"), -1); -} -#endif /* ACE_HAS_THREADS */ |