diff options
author | Matt Caswell <matt@openssl.org> | 2015-11-12 11:42:08 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2015-11-21 00:37:17 +0100 |
commit | e8dfb5bf8e525c9799820d01b2df5fde098a9c4c (patch) | |
tree | 3f8dc36c25a36b3bf07d55cea8cccdd2a993b716 /doc | |
parent | Remove ASYNC NOEXIST functions from libeay.num (diff) | |
download | openssl-e8dfb5bf8e525c9799820d01b2df5fde098a9c4c.tar.xz openssl-e8dfb5bf8e525c9799820d01b2df5fde098a9c4c.zip |
Add ASYNC_block_pause and ASYNC_unblock_pause
There are potential deadlock situations that can occur if code executing
within the context of a job aquires a lock, and then pauses the job. This
adds an ability to temporarily block pauses from occuring whilst performing
work and holding a lock.
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/crypto/ASYNC_start_job.pod | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/doc/crypto/ASYNC_start_job.pod b/doc/crypto/ASYNC_start_job.pod index 4abe017263..86134b598f 100644 --- a/doc/crypto/ASYNC_start_job.pod +++ b/doc/crypto/ASYNC_start_job.pod @@ -4,7 +4,8 @@ ASYNC_init_pool, ASYNC_free_pool, ASYNC_start_job, ASYNC_pause_job, ASYNC_in_job, ASYNC_get_wait_fd, ASYNC_get_current_job, ASYNC_wake, -ASYNC_clear_wake - asynchronous job management functions +ASYNC_clear_wake, ASYNC_block_pause, ASYNC_unblock_pause - asynchronous job +management functions =head1 SYNOPSIS @@ -21,6 +22,8 @@ ASYNC_clear_wake - asynchronous job management functions ASYNC_JOB *ASYNC_get_current_job(void); void ASYNC_wake(ASYNC_JOB *job); void ASYNC_clear_wake(ASYNC_JOB *job); + void ASYNC_block_pause(void); + void ASYNC_unblock_pause(void); =head1 DESCRIPTION @@ -121,6 +124,20 @@ engine can signal to the user code that the job should be resumed using ASYNC_wake(). Once resumed the engine would clear the wake signal by calling ASYNC_clear_wake(). +The ASYNC_block_pause() function will prevent the currently active job from +pausing. The block will remain in place until a subsequent call to +ASYNC_unblock_pause(). These functions can be nested, e.g. if you call +ASYNC_block_pause() twice then you must call ASYNC_unblock_pause() twice in +order to reenable pausing. If these functions are called while there is no +currently active job then they have no effect. This functionality can be useful +to avoid deadlock scenarios. For example during the execution of an ASYNC_JOB an +application aquires a lock. It then calls some cryptographic function which +invokes ASYNC_pause_job(). This returns control back to the code that created +the ASYNC_JOB. If that code then attempts to aquire the same lock before +resuming the original job then a deadlock can occur. By calling +ASYNC_block_pause() immediately after aquiring the lock and +ASYNC_unblock_pause() immediately before releasing it then this situation cannot +occur. =head1 RETURN VALUES |