diff options
author | jim <jim@13f79535-47bb-0310-9956-ffa450edef68> | 2002-04-05 13:49:45 +0000 |
---|---|---|
committer | jim <jim@13f79535-47bb-0310-9956-ffa450edef68> | 2002-04-05 13:49:45 +0000 |
commit | dc1c29e396bff57793b9e12c0906d234226b4ff8 (patch) | |
tree | 371510380aa321c098b8cd70eab8ba1cabd18f90 /locks | |
parent | e64b634a4c3c5e51c319a4ea3321a271aed8e7b3 (diff) | |
download | libapr-dc1c29e396bff57793b9e12c0906d234226b4ff8.tar.gz |
Be a bit more clear about the FIXME statement and the exact
window we're concerned about.
When oh when will we depreciate the old locking stuff :)
PR:
Obtained from:
Submitted by:
Reviewed by:
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@63225 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'locks')
-rw-r--r-- | locks/unix/crossproc.c | 10 | ||||
-rw-r--r-- | locks/unix/proc_mutex.c | 10 |
2 files changed, 14 insertions, 6 deletions
diff --git a/locks/unix/crossproc.c b/locks/unix/crossproc.c index e7988cd4a..78af3f1c5 100644 --- a/locks/unix/crossproc.c +++ b/locks/unix/crossproc.c @@ -98,9 +98,13 @@ static apr_status_t posix_create(apr_lock_t *new, const char *fname) * * Because of this, we ignore fname and craft our own. * - * FIXME: if we try to create another semaphore within a second - * of creating this on, we won't get a new one but another - * reference to this one. + * FIXME: There is a small window of opportunity where + * instead of getting a new semaphore descriptor, we get + * a previously obtained one. This can happen if the requests + * are made at the "same time" (within a second, due to the + * apr_time_now() call) and in the small span of time between + * the sem_open and the sem_unlink. Use of O_EXCL does not + * help here however... */ epoch = apr_time_now() / APR_USEC_PER_SEC; apr_snprintf(semname, sizeof(semname), "/ApR.%lx", epoch); diff --git a/locks/unix/proc_mutex.c b/locks/unix/proc_mutex.c index ae7000e3c..e1a548598 100644 --- a/locks/unix/proc_mutex.c +++ b/locks/unix/proc_mutex.c @@ -99,9 +99,13 @@ static apr_status_t proc_mutex_posix_create(apr_proc_mutex_t *new_mutex, * * Because of this, we ignore fname and craft our own. * - * FIXME: if we try to create another semaphore within a second - * of creating this on, we won't get a new one but another - * reference to this one. + * FIXME: There is a small window of opportunity where + * instead of getting a new semaphore descriptor, we get + * a previously obtained one. This can happen if the requests + * are made at the "same time" (within a second, due to the + * apr_time_now() call) and in the small span of time between + * the sem_open and the sem_unlink. Use of O_EXCL does not + * help here however... */ epoch = apr_time_now() / APR_USEC_PER_SEC; apr_snprintf(semname, sizeof(semname), "/ApR.%lx", epoch); |