diff options
author | dgaudet <dgaudet@13f79535-47bb-0310-9956-ffa450edef68> | 2000-04-14 01:54:14 +0000 |
---|---|---|
committer | dgaudet <dgaudet@13f79535-47bb-0310-9956-ffa450edef68> | 2000-04-14 01:54:14 +0000 |
commit | 185f54a0db73953164608ae4bf5a2945a605c7a1 (patch) | |
tree | cadce1eb40db1e2176aa61f837d7a6f9cda914b5 | |
parent | ddd0b3a8769007d95de5ea03fd8d9e03a4c082fe (diff) | |
download | libapr-185f54a0db73953164608ae4bf5a2945a605c7a1.tar.gz |
thread cancellation is essentially the same as signals -- a form of
asynchronous notification. the apache threading model doesn't have
asynchronous notification, so we don't need this part of the API.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@59844 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | include/apr_thread_proc.h | 9 | ||||
-rw-r--r-- | threadproc/beos/Makefile.in | 8 | ||||
-rw-r--r-- | threadproc/beos/threadcancel.c | 88 | ||||
-rw-r--r-- | threadproc/os2/Makefile.in | 6 | ||||
-rw-r--r-- | threadproc/os2/threadcancel.c | 85 | ||||
-rw-r--r-- | threadproc/unix/Makefile.in | 6 | ||||
-rw-r--r-- | threadproc/unix/threadcancel.c | 114 | ||||
-rw-r--r-- | threadproc/win32/threadcancel.c | 86 |
8 files changed, 0 insertions, 402 deletions
diff --git a/include/apr_thread_proc.h b/include/apr_thread_proc.h index 8a2fa7e7f..7dcad2591 100644 --- a/include/apr_thread_proc.h +++ b/include/apr_thread_proc.h @@ -72,11 +72,6 @@ typedef enum {APR_WAIT, APR_NOWAIT} ap_wait_how_e; #define APR_PARENT_BLOCK 3 #define APR_CHILD_BLOCK 4 -#define APR_CANCEL_ASYNCH 1 -#define APR_CANCEL_DEFER 2 -#define APR_CANCEL_ENABLE 3 -#define APR_CANCEL_DISABLE 4 - #define APR_OC_REASON_DEATH 0 /* child has died, caller must call * unregister still */ #define APR_OC_REASON_UNWRITABLE 1 /* write_fd is unwritable */ @@ -162,10 +157,6 @@ ap_status_t ap_thread_join(ap_status_t *retval, ap_thread_t *thd); */ ap_status_t ap_thread_detach(ap_thread_t *thd); -ap_status_t ap_cancel_thread(ap_thread_t *thd); -ap_status_t ap_setcanceltype(ap_int32_t type, ap_context_t *cont); -ap_status_t ap_setcancelstate(ap_int32_t type, ap_context_t *cont); - /* ***APRDOC******************************************************** * ap_status_t ap_get_threaddata(void **data, char *key, ap_thread_t *thread) * Return the context associated with the current thread. diff --git a/threadproc/beos/Makefile.in b/threadproc/beos/Makefile.in index c1f34d369..bbe8ae04f 100644 --- a/threadproc/beos/Makefile.in +++ b/threadproc/beos/Makefile.in @@ -16,7 +16,6 @@ LIB=libthreadproc.a OBJS=proc.o \ thread.o \ - threadcancel.o \ threadpriv.o \ threadproc_common.o \ procsup.o \ @@ -88,13 +87,6 @@ thread.o: thread.c threadproc.h $(INCDIR)/apr_thread_proc.h \ $(INCDIR)/apr_config.h $(INCDIR)/apr_lib.h \ $(INCDIR)/apr_portable.h $(INCDIR)/apr_network_io.h \ $(INCDIR)/apr_lock.h -threadcancel.o: threadcancel.c threadproc.h \ - $(INCDIR)/apr_thread_proc.h $(INCDIR)/apr_file_io.h \ - $(INCDIR)/apr_general.h $(INCDIR)/apr.h \ - $(INCDIR)/apr_errno.h $(INCDIR)/apr_time.h \ - ../../file_io/unix/fileio.h $(INCDIR)/apr_config.h \ - $(INCDIR)/apr_lib.h $(INCDIR)/apr_portable.h \ - $(INCDIR)/apr_network_io.h $(INCDIR)/apr_lock.h threadpriv.o: threadpriv.c threadproc.h \ $(INCDIR)/apr_thread_proc.h $(INCDIR)/apr_file_io.h \ $(INCDIR)/apr_general.h $(INCDIR)/apr.h \ diff --git a/threadproc/beos/threadcancel.c b/threadproc/beos/threadcancel.c deleted file mode 100644 index 5eed0bbf8..000000000 --- a/threadproc/beos/threadcancel.c +++ /dev/null @@ -1,88 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * <http://www.apache.org/>. - */ - -#include "threadproc.h" - - -ap_status_t ap_cancel_thread(ap_thread_t *thd) -{ - if (kill_thread(thd->td) == 0) { - return APR_SUCCESS; - } - else { - return errno; - } -} - - -ap_status_t ap_setcanceltype(ap_int32_t type, ap_context_t *cont) -{ -/* if (pthread_setcanceltype(type, NULL) == 0) {*/ - return APR_SUCCESS; -/* } - else { - return APR_FAILURE; - }*/ -} - -ap_status_t ap_setcancelstate(ap_int32_t type, ap_context_t *cont) -{ -/* if (pthread_setcanceltype(type, NULL) == 0) {*/ - return APR_SUCCESS; -/* } - else { - return APR_FAILURE; - }*/ -} - diff --git a/threadproc/os2/Makefile.in b/threadproc/os2/Makefile.in index 1f269fb7c..691e02ce0 100644 --- a/threadproc/os2/Makefile.in +++ b/threadproc/os2/Makefile.in @@ -17,7 +17,6 @@ LIB=threadproc.a OBJS=proc.o \ thread.o \ - threadcancel.o \ threadpriv.o \ signals.o @@ -73,11 +72,6 @@ thread.o: thread.c threadproc.h $(INCDIR1)/apr_thread_proc.h \ $(INCDIR1)/apr.h $(INCDIR1)/apr_errno.h \ $(INCDIR1)/apr_time.h $(INCDIR1)/apr_lib.h \ $(INCDIR2)/fileio.h $(INCDIR1)/apr_config.h -threadcancel.o: threadcancel.c threadproc.h \ - $(INCDIR1)/apr_thread_proc.h $(INCDIR1)/apr_file_io.h \ - $(INCDIR1)/apr_general.h $(INCDIR1)/apr.h \ - $(INCDIR1)/apr_errno.h $(INCDIR1)/apr_time.h \ - $(INCDIR2)/fileio.h $(INCDIR1)/apr_config.h threadpriv.o: threadpriv.c threadproc.h \ $(INCDIR1)/apr_thread_proc.h $(INCDIR1)/apr_file_io.h \ $(INCDIR1)/apr_general.h $(INCDIR1)/apr.h \ diff --git a/threadproc/os2/threadcancel.c b/threadproc/os2/threadcancel.c deleted file mode 100644 index 1e4cd4e6f..000000000 --- a/threadproc/os2/threadcancel.c +++ /dev/null @@ -1,85 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * <http://www.apache.org/>. - */ - -#include "threadproc.h" -#include "apr_thread_proc.h" -#include "apr_general.h" -#include "fileio.h" - -ap_status_t ap_cancel_thread(ap_thread_t *thd) -{ - return APR_OS2_STATUS(DosKillThread(thd->tid)); -} - - - -ap_status_t ap_setcanceltype(ap_int32_t type, ap_context_t *cont) -{ - ULONG rc, nesting; - - if (type == APR_CANCEL_DEFER) - rc = DosEnterMustComplete(&nesting); - else - rc = DosExitMustComplete(&nesting); - - return APR_OS2_STATUS(rc); -} - - - -ap_status_t ap_setcancelstate(ap_int32_t type, ap_context_t *cont) -{ -/* There's no way to ignore thread kills altogether in OS/2 (that I know of) */ - return APR_ENOTIMPL; -} diff --git a/threadproc/unix/Makefile.in b/threadproc/unix/Makefile.in index 50f51e073..a764c7ecc 100644 --- a/threadproc/unix/Makefile.in +++ b/threadproc/unix/Makefile.in @@ -18,7 +18,6 @@ LIB=libthreadproc.a OBJS=proc.o \ procsup.o \ thread.o \ - threadcancel.o \ threadpriv.o \ signals.o @@ -79,11 +78,6 @@ thread.o: thread.c threadproc.h $(INCDIR)/apr_config.h \ ../../file_io/unix/fileio.h $(INCDIR)/apr_lib.h \ $(INCDIR)/apr_portable.h $(INCDIR)/apr_network_io.h \ $(INCDIR)/apr_lock.h -threadcancel.o: threadcancel.c threadproc.h $(INCDIR)/apr_config.h \ - $(INCDIR)/apr_thread_proc.h $(INCDIR)/apr_file_io.h \ - $(INCDIR)/apr_general.h $(INCDIR)/apr.h \ - $(INCDIR)/apr_errno.h $(INCDIR)/apr_time.h \ - ../../file_io/unix/fileio.h $(INCDIR)/apr_lib.h threadpriv.o: threadpriv.c threadproc.h $(INCDIR)/apr_config.h \ $(INCDIR)/apr_thread_proc.h $(INCDIR)/apr_file_io.h \ $(INCDIR)/apr_general.h $(INCDIR)/apr.h \ diff --git a/threadproc/unix/threadcancel.c b/threadproc/unix/threadcancel.c deleted file mode 100644 index 242241015..000000000 --- a/threadproc/unix/threadcancel.c +++ /dev/null @@ -1,114 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * <http://www.apache.org/>. - */ - -#include "threadproc.h" -#if APR_HAS_THREADS - -#ifdef HAVE_PTHREAD_H - -#if 0 /* some platforms, e.g. FreeBSD 2.2.8, do not have pthread_cancel (they do have an undocumented pthread_kill, though) */ -/* ***APRDOC******************************************************** - * ap_status_t ap_cancel_thread(ap_thread_t *thd) - * Asynchronously kill a thread - * arg 1) The thread to kill. - */ -ap_status_t ap_cancel_thread(ap_thread_t *thd) -{ - ap_status_t stat; - if ((stat = pthread_cancel(*thd->td)) == 0) { - return APR_SUCCESS; - } - else { - return stat; - } -} -#endif - -/* ***APRDOC******************************************************** - * ap_status_t ap_setcanceltype(ap_int32_t type, ap_context_t *cont) - * Determine how threads are cancelable. - * arg 1) how are threads cancelable. One of: - * APR_CANCEL_ASYNCH -- cancel it no matter where it is - * APR_CANCEL_DEFER -- only cancel the thread if it is safe. - * arg 2) The context to operate on - */ -ap_status_t ap_setcanceltype(ap_int32_t type, ap_context_t *cont) -{ - ap_status_t stat; - if ((stat = pthread_setcanceltype(type, NULL)) == 0) { - return APR_SUCCESS; - } - else { - return stat; - } -} - -/* ***APRDOC******************************************************** - * ap_status_t ap_setcancelstate(ap_int32_t type, ap_context_t *cont) - * Determine if threads will be cancelable. - * arg 1) Are threads cancelable. - * arg 2) The context to operate on - */ -ap_status_t ap_setcancelstate(ap_int32_t type, ap_context_t *cont) -{ - ap_status_t stat; - if ((stat = pthread_setcanceltype(type, NULL)) == 0) { - return APR_SUCCESS; - } - else { - return stat; - } -} -#endif -#endif diff --git a/threadproc/win32/threadcancel.c b/threadproc/win32/threadcancel.c deleted file mode 100644 index a4d80637f..000000000 --- a/threadproc/win32/threadcancel.c +++ /dev/null @@ -1,86 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * <http://www.apache.org/>. - */ - -#include "threadproc.h" -#include "apr_thread_proc.h" -#include "apr_general.h" - - -ap_status_t ap_cancel_thread(ap_thread_t *thd) -{ - if (TerminateThread(thd->td, APR_SUCCESS) == 0) { - return APR_EEXIST; - } - else { - return APR_SUCCESS; - } -} - -/* Not sure of the best way to do this just yet. -ap_status_t ap_setcanceltype(ap_int32_t type, ap_context_t *cont) -{ - -} - -ap_status_t ap_setcancelstate(ap_int32_t type, ap_context_t *cont) -{ - ap_status_t stat; - if ((stat = pthread_setcanceltype(type, NULL)) == 0) { - return APR_SUCCESS; - } - else { - return stat; - } -} -*/ |