18.10.2014 Views

Object-oriented Software in Ada 95

Object-oriented Software in Ada 95

Object-oriented Software in Ada 95

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

370 Appendix A<br />

select<br />

accept option1 do<br />

...<br />

end;<br />

or<br />

accept option2 do<br />

...<br />

end;<br />

end select;<br />

select<br />

accept ...<br />

else<br />

statements;<br />

end select;<br />

select<br />

accept ...<br />

or<br />

delay n.m;<br />

statements;<br />

end select;<br />

Protected type<br />

protected type PT_Buffer is --Task type specification<br />

entry Put( Ch:<strong>in</strong> Character );<br />

entry Get( Ch:out Character );<br />

private<br />

-- variables which cannot be simultaneous accessed<br />

end PT_Buffer;<br />

protected body PT_Buffer is<br />

entry Put( Ch:<strong>in</strong> Character )<br />

when No_In_Queue < Queue_Size is<br />

beg<strong>in</strong><br />

. . .<br />

end Put;<br />

entry Get( Ch:<strong>in</strong> out Character )<br />

when No_In_Queue > 0 is<br />

beg<strong>in</strong><br />

. . .<br />

end Get;<br />

© M A Smith - May not be reproduced without permission

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!