Changeset ea2c1d6 in rtems


Ignore:
Timestamp:
Jan 12, 2000, 8:22:04 PM (21 years ago)
Author:
Jennifer Averett <Jennifer.Averett@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
bd9e482a
Parents:
e38cb52
Message:

+ Added code for waiting send
+ Yellow lined tested routine with Posix message queue test (01)

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • c/src/exec/score/src/coremsgseize.c

    re38cb52 rea2c1d6  
    6262  unsigned32                      *size,
    6363  boolean                          wait,
    64   CORE_message_queue_Submit_types *priority,
    6564  Watchdog_Interval                timeout
    6665)
     
    6968  CORE_message_queue_Buffer_control *the_message;
    7069  Thread_Control                    *executing;
     70  Thread_Control                    *the_thread;
    7171
    7272  executing = _Thread_Executing;
     
    7878    the_message = _CORE_message_queue_Get_pending_message( the_message_queue );
    7979    _ISR_Enable( level );
     80
    8081    *size = the_message->Contents.size;
    81     *priority = the_message->priority;
    82     _CORE_message_queue_Copy_buffer(the_message->Contents.buffer,buffer,*size );
    83     _CORE_message_queue_Free_message_buffer(the_message_queue, the_message );
     82    _Thread_Executing->Wait.count = the_message->priority;
     83    _CORE_message_queue_Copy_buffer(the_message->Contents.buffer,buffer,*size);
     84
     85    /*
     86     *  There could be a thread waiting to send a message.  If there
     87     *  is not, then we can go ahead and free the buffer.
     88     *
     89     *  NOTE: If we note that the queue was not full before this receive,
     90     *  then we can avoid this dequeue.
     91     */
     92
     93    the_thread = _Thread_queue_Dequeue( &the_message_queue->Wait_queue );
     94    if ( !the_thread ) {
     95      _CORE_message_queue_Free_message_buffer( the_message_queue, the_message );
     96      return;
     97    }
     98
     99    /*
     100     *  There was a thread waiting to send a message.  This code
     101     *  puts the messages in the message queue on behalf of the
     102     *  waiting task.
     103     */
     104
     105    the_message->priority  = the_thread->Wait.count;
     106    the_message->Contents.size = (unsigned32)the_thread->Wait.return_argument_1;
     107    _CORE_message_queue_Copy_buffer(
     108      the_thread->Wait.return_argument,
     109      the_message->Contents.buffer,
     110      the_message->Contents.size
     111    );
     112
     113    _CORE_message_queue_Insert_message(
     114       the_message_queue,
     115       the_message,
     116       the_message->priority
     117    );
    84118    return;
    85119  }
     
    96130  executing->Wait.return_argument    = (void *)buffer;
    97131  executing->Wait.return_argument_1  = (void *)size;
     132  /* Wait.count will be filled in with the message priority */
    98133  _ISR_Enable( level );
    99134
  • cpukit/score/src/coremsgseize.c

    re38cb52 rea2c1d6  
    6262  unsigned32                      *size,
    6363  boolean                          wait,
    64   CORE_message_queue_Submit_types *priority,
    6564  Watchdog_Interval                timeout
    6665)
     
    6968  CORE_message_queue_Buffer_control *the_message;
    7069  Thread_Control                    *executing;
     70  Thread_Control                    *the_thread;
    7171
    7272  executing = _Thread_Executing;
     
    7878    the_message = _CORE_message_queue_Get_pending_message( the_message_queue );
    7979    _ISR_Enable( level );
     80
    8081    *size = the_message->Contents.size;
    81     *priority = the_message->priority;
    82     _CORE_message_queue_Copy_buffer(the_message->Contents.buffer,buffer,*size );
    83     _CORE_message_queue_Free_message_buffer(the_message_queue, the_message );
     82    _Thread_Executing->Wait.count = the_message->priority;
     83    _CORE_message_queue_Copy_buffer(the_message->Contents.buffer,buffer,*size);
     84
     85    /*
     86     *  There could be a thread waiting to send a message.  If there
     87     *  is not, then we can go ahead and free the buffer.
     88     *
     89     *  NOTE: If we note that the queue was not full before this receive,
     90     *  then we can avoid this dequeue.
     91     */
     92
     93    the_thread = _Thread_queue_Dequeue( &the_message_queue->Wait_queue );
     94    if ( !the_thread ) {
     95      _CORE_message_queue_Free_message_buffer( the_message_queue, the_message );
     96      return;
     97    }
     98
     99    /*
     100     *  There was a thread waiting to send a message.  This code
     101     *  puts the messages in the message queue on behalf of the
     102     *  waiting task.
     103     */
     104
     105    the_message->priority  = the_thread->Wait.count;
     106    the_message->Contents.size = (unsigned32)the_thread->Wait.return_argument_1;
     107    _CORE_message_queue_Copy_buffer(
     108      the_thread->Wait.return_argument,
     109      the_message->Contents.buffer,
     110      the_message->Contents.size
     111    );
     112
     113    _CORE_message_queue_Insert_message(
     114       the_message_queue,
     115       the_message,
     116       the_message->priority
     117    );
    84118    return;
    85119  }
     
    96130  executing->Wait.return_argument    = (void *)buffer;
    97131  executing->Wait.return_argument_1  = (void *)size;
     132  /* Wait.count will be filled in with the message priority */
    98133  _ISR_Enable( level );
    99134
Note: See TracChangeset for help on using the changeset viewer.