Initial Async notify code changes
Initial API implemented for notifying applications that an ASYNC_JOB has completed. Currently only s_server is using this. The Dummy Async engine "cheats" in that it notifies that it has completed *before* it pauses the job. A normal async engine would not do that. Only the posix version of this has been implemented so far, so it will probably fail to compile on Windows at the moment. Reviewed-by: Rich Salz <rsalz@openssl.org>
This commit is contained in:
@@ -57,6 +57,7 @@
|
||||
#ifdef ASYNC_SYSV
|
||||
# include <stddef.h>
|
||||
# include <ucontext.h>
|
||||
# include <unistd.h>
|
||||
# include <openssl/crypto.h>
|
||||
# include <openssl/async.h>
|
||||
|
||||
@@ -85,4 +86,29 @@ void ASYNC_FIBRE_free(ASYNC_FIBRE *fibre)
|
||||
if (fibre->fibre.uc_stack.ss_sp)
|
||||
OPENSSL_free(fibre->fibre.uc_stack.ss_sp);
|
||||
}
|
||||
|
||||
int async_pipe(int *pipefds)
|
||||
{
|
||||
if (pipe(pipefds) == 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int async_write1(int fd, const void *buf)
|
||||
{
|
||||
if (write(fd, buf, 1) > 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int async_read1(int fd, void *buf)
|
||||
{
|
||||
if (read(fd, buf, 1) > 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -99,5 +99,10 @@ static inline int ASYNC_FIBRE_swapcontext(ASYNC_FIBRE *o, ASYNC_FIBRE *n, int r)
|
||||
int ASYNC_FIBRE_init(ASYNC_FIBRE *fibre);
|
||||
void ASYNC_FIBRE_free(ASYNC_FIBRE *fibre);
|
||||
|
||||
int async_pipe(int *pipefds);
|
||||
int async_write1(int fd, const void *buf);
|
||||
int async_read1(int fd, void *buf);
|
||||
|
||||
|
||||
# endif
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user