diff options
author | Gedare Bloom <gedare@rtems.org> | 2017-03-31 15:23:47 -0400 |
---|---|---|
committer | Gedare Bloom <gedare@rtems.org> | 2017-05-05 10:34:08 -0400 |
commit | bd9d5ebc33c35d91b5ca0746b6b78a365eeb726d (patch) | |
tree | 8de9a3f3b45c1f428de403530c866b01f13da1bf /cpukit | |
parent | posix/mman: update atime on shared memory read call (diff) | |
download | rtems-bd9d5ebc33c35d91b5ca0746b6b78a365eeb726d.tar.bz2 |
posix/shm: replace threadq with mutex (allocator lock)
Closes #2957.
Diffstat (limited to '')
-rw-r--r-- | cpukit/posix/include/rtems/posix/shmimpl.h | 19 | ||||
-rw-r--r-- | cpukit/posix/src/shmopen.c | 14 |
2 files changed, 5 insertions, 28 deletions
diff --git a/cpukit/posix/include/rtems/posix/shmimpl.h b/cpukit/posix/include/rtems/posix/shmimpl.h index ff3299ebe0..6d81e5eb27 100644 --- a/cpukit/posix/include/rtems/posix/shmimpl.h +++ b/cpukit/posix/include/rtems/posix/shmimpl.h @@ -33,25 +33,6 @@ extern "C" { extern Objects_Information _POSIX_Shm_Information; -RTEMS_INLINE_ROUTINE void _POSIX_Shm_Acquire( - POSIX_Shm_Control *the_shm, - Thread_queue_Context *queue_context -) -{ - _Thread_queue_Acquire( - &the_shm->Wait_queue, - queue_context - ); -} - -RTEMS_INLINE_ROUTINE void _POSIX_Shm_Release( - POSIX_Shm_Control *the_shm, - Thread_queue_Context *queue_context -) -{ - _Thread_queue_Release( &the_shm->Wait_queue, queue_context ); -} - RTEMS_INLINE_ROUTINE POSIX_Shm_Control *_POSIX_Shm_Allocate_unprotected( void ) { return (POSIX_Shm_Control *) diff --git a/cpukit/posix/src/shmopen.c b/cpukit/posix/src/shmopen.c index 4c86535c6d..bedde1513f 100644 --- a/cpukit/posix/src/shmopen.c +++ b/cpukit/posix/src/shmopen.c @@ -55,42 +55,38 @@ static int shm_fstat( /* read() is unspecified for shared memory objects */ static ssize_t shm_read( rtems_libio_t *iop, void *buffer, size_t count ) { - Thread_queue_Context queue_context; ssize_t bytes_read; POSIX_Shm_Control *shm = iop_to_shm( iop ); - _Thread_queue_Context_initialize( &queue_context ); - _POSIX_Shm_Acquire( shm, &queue_context ); + _Objects_Allocator_lock(); bytes_read = (*shm->shm_object.ops->object_read)( &shm->shm_object, buffer, count ); _POSIX_Shm_Update_atime( shm ); - _POSIX_Shm_Release( shm, &queue_context ); + _Objects_Allocator_unlock(); return bytes_read; } static int shm_ftruncate( rtems_libio_t *iop, off_t length ) { - Thread_queue_Context queue_context; int err; POSIX_Shm_Control *shm = iop_to_shm( iop ); - _Thread_queue_Context_initialize( &queue_context ); - _POSIX_Shm_Acquire( shm, &queue_context ); + _Objects_Allocator_lock(); err = (*shm->shm_object.ops->object_resize)( &shm->shm_object, length ); if ( err != 0 ) { - _POSIX_Shm_Release( shm, &queue_context ); + _Objects_Allocator_unlock(); rtems_set_errno_and_return_minus_one( err ); } _POSIX_Shm_Update_mtime_ctime( shm ); - _POSIX_Shm_Release( shm, &queue_context ); + _Objects_Allocator_unlock(); return 0; } |