1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using tool;
- namespace chutian_parking_terminal.data_buffer
- {
- class Ground_radar_data_buffer
- {
- public Ground_radar_data_buffer()
- {
- }
- public void ground_radar_data_buffer_init()
- {
- m_ground_status_msg = new Message.Ground_status_msg();
- m_has_ground_statu_msg = false;
- }
- public bool has_ground_statu_msg()
- {
- return m_has_ground_statu_msg;
- }
- //设置消息
- public void set_ground_status_msg(Message.Ground_status_msg msg)
- {
- lock (m_data_lock)
- {
- m_ground_status_msg = msg;
- }
- m_has_ground_statu_msg = true;
- }
- //获取消息
- public Message.Ground_status_msg get_ground_status_msg()
- {
- return m_ground_status_msg;
- }
- //数据锁
- //作用:将会锁住代码块的内容,并阻止其他线程进入该代码块,直到该代码块运行完成,释放该锁。
- //注意:定义的锁对象应该是 私有的,静态的,只读的,引用类型的对象,这样可以防止外部改变锁对象
- private static readonly object m_data_lock = new object();
- //地面雷达状态消息
- private Message.Ground_status_msg m_ground_status_msg;
- //是否被赋值过(是否是有效数据)
- private bool m_has_ground_statu_msg;
- }
- }
|