Add option to disable async
[openssl.git] / crypto / async / arch / async_posix.h
index 36fae2478865603558b4c6d72f666b0ef4cae108..85d033f8516076e5e843678859f35885265f819d 100644 (file)
@@ -1,4 +1,3 @@
-/* crypto/async/arch/async_posix.h */
 /*
  * Written by Matt Caswell (matt@openssl.org) for the OpenSSL project.
  */
  * OF THE POSSIBILITY OF SUCH DAMAGE.
  * ====================================================================
  */
+#ifndef OPENSSL_ASYNC_ARCH_ASYNC_POSIX_H
+#define OPENSSL_ASYNC_ARCH_ASYNC_POSIX_H
 #include <openssl/e_os2.h>
 
-#if defined(OPENSSL_SYS_UNIX) && defined(OPENSSL_THREADS)
+#if (defined(OPENSSL_SYS_UNIX) || defined(OPENSSL_SYS_CYGWIN)) && defined(OPENSSL_THREADS) && !defined(OPENSSL_NO_ASYNC)
 
 # include <unistd.h>
 
 #  define ASYNC_POSIX
 #  define ASYNC_ARCH
 
-/*
- * Some platforms complain (e.g. OS-X) that setcontext/getcontext/makecontext
- * are deprecated without the following defined. We know its deprecated but
- * there is no alternative.
- */
-#  define _XOPEN_SOURCE
-#  pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-
 #  include <ucontext.h>
 #  include <setjmp.h>
 #  include "e_os.h"
@@ -103,14 +96,11 @@ static inline int async_fibre_swapcontext(async_fibre *o, async_fibre *n, int r)
     return 1;
 }
 
-#  define async_fibre_makecontext(c) \
-            (!getcontext(&(c)->fibre) \
-            && async_fibre_init(c) \
-            && (makecontext(&(c)->fibre, async_start_func, 0), 1))
 #  define async_fibre_init_dispatcher(d)
 
-int async_fibre_init(async_fibre *fibre);
+int async_fibre_makecontext(async_fibre *fibre);
 void async_fibre_free(async_fibre *fibre);
 
 # endif
 #endif
+#endif /* OPENSSL_ASYNC_ARCH_ASYNC_POSIX_H */