Changeset bd9d5eb in rtems


Ignore:
Timestamp:
Mar 31, 2017, 7:23:47 PM (2 years ago)
Author:
Gedare Bloom <gedare@…>
Branches:
master
Children:
8290f95
Parents:
889eb76
git-author:
Gedare Bloom <gedare@…> (03/31/17 19:23:47)
git-committer:
Gedare Bloom <gedare@…> (05/05/17 14:34:08)
Message:

posix/shm: replace threadq with mutex (allocator lock)

Closes #2957.

Location:
cpukit/posix
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpukit/posix/include/rtems/posix/shmimpl.h

    r889eb76 rbd9d5eb  
    3333
    3434extern Objects_Information _POSIX_Shm_Information;
    35 
    36 RTEMS_INLINE_ROUTINE void _POSIX_Shm_Acquire(
    37   POSIX_Shm_Control                 *the_shm,
    38   Thread_queue_Context              *queue_context
    39 )
    40 {
    41   _Thread_queue_Acquire(
    42     &the_shm->Wait_queue,
    43     queue_context
    44   );
    45 }
    46 
    47 RTEMS_INLINE_ROUTINE void _POSIX_Shm_Release(
    48   POSIX_Shm_Control                 *the_shm,
    49   Thread_queue_Context              *queue_context
    50 )
    51 {
    52   _Thread_queue_Release( &the_shm->Wait_queue, queue_context );
    53 }
    5435
    5536RTEMS_INLINE_ROUTINE POSIX_Shm_Control *_POSIX_Shm_Allocate_unprotected( void )
  • cpukit/posix/src/shmopen.c

    r889eb76 rbd9d5eb  
    5656static ssize_t shm_read( rtems_libio_t *iop, void *buffer, size_t count )
    5757{
    58   Thread_queue_Context queue_context;
    5958  ssize_t bytes_read;
    6059  POSIX_Shm_Control *shm = iop_to_shm( iop );
    6160
    62   _Thread_queue_Context_initialize( &queue_context );
    63   _POSIX_Shm_Acquire( shm, &queue_context );
     61  _Objects_Allocator_lock();
    6462  bytes_read = (*shm->shm_object.ops->object_read)(
    6563      &shm->shm_object,
     
    6866  );
    6967  _POSIX_Shm_Update_atime( shm );
    70   _POSIX_Shm_Release( shm, &queue_context );
    71 
     68
     69  _Objects_Allocator_unlock();
    7270  return bytes_read;
    7371}
     
    7573static int shm_ftruncate( rtems_libio_t *iop, off_t length )
    7674{
    77   Thread_queue_Context queue_context;
    7875  int err;
    7976  POSIX_Shm_Control *shm = iop_to_shm( iop );
    8077
    81   _Thread_queue_Context_initialize( &queue_context );
    82   _POSIX_Shm_Acquire( shm, &queue_context );
     78  _Objects_Allocator_lock();
    8379
    8480  err = (*shm->shm_object.ops->object_resize)( &shm->shm_object, length );
    8581
    8682  if ( err != 0 ) {
    87     _POSIX_Shm_Release( shm, &queue_context );
     83    _Objects_Allocator_unlock();
    8884    rtems_set_errno_and_return_minus_one( err );
    8985  }
     
    9187  _POSIX_Shm_Update_mtime_ctime( shm );
    9288
    93   _POSIX_Shm_Release( shm, &queue_context );
     89  _Objects_Allocator_unlock();
    9490  return 0;
    9591}
Note: See TracChangeset for help on using the changeset viewer.