* Fixed wrong use of MutexLocker as pointed out by Korli - nice catch! This
could have caused a number of problems. * Fixed coding style violation Ingo introduced. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29378 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -297,7 +297,7 @@ get_fd_locked(struct io_context *context, int fd)
|
|||||||
struct file_descriptor *
|
struct file_descriptor *
|
||||||
get_fd(struct io_context *context, int fd)
|
get_fd(struct io_context *context, int fd)
|
||||||
{
|
{
|
||||||
MutexLocker(context->io_mutex);
|
MutexLocker _(context->io_mutex);
|
||||||
|
|
||||||
return get_fd_locked(context, fd);
|
return get_fd_locked(context, fd);
|
||||||
}
|
}
|
||||||
@@ -306,7 +306,7 @@ get_fd(struct io_context *context, int fd)
|
|||||||
struct file_descriptor *
|
struct file_descriptor *
|
||||||
get_open_fd(struct io_context *context, int fd)
|
get_open_fd(struct io_context *context, int fd)
|
||||||
{
|
{
|
||||||
MutexLocker(context->io_mutex);
|
MutexLocker _(context->io_mutex);
|
||||||
|
|
||||||
file_descriptor *descriptor = get_fd_locked(context, fd);
|
file_descriptor *descriptor = get_fd_locked(context, fd);
|
||||||
if (descriptor == NULL)
|
if (descriptor == NULL)
|
||||||
|
|||||||
@@ -4744,13 +4744,15 @@ vfs_free_io_context(io_context* context)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void vfs_get_io_context(io_context *context)
|
void
|
||||||
|
vfs_get_io_context(io_context* context)
|
||||||
{
|
{
|
||||||
atomic_add(&context->ref_count, 1);
|
atomic_add(&context->ref_count, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void vfs_put_io_context(io_context *context)
|
void
|
||||||
|
vfs_put_io_context(io_context* context)
|
||||||
{
|
{
|
||||||
if (atomic_add(&context->ref_count, -1) == 1)
|
if (atomic_add(&context->ref_count, -1) == 1)
|
||||||
vfs_free_io_context(context);
|
vfs_free_io_context(context);
|
||||||
|
|||||||
Reference in New Issue
Block a user