Event thread safety

.NET library for SMPP protocol
Locked
norman
Posts: 2
Joined: Wed Feb 26, 2014 4:58 am

Event thread safety

Post by norman » Wed Jun 25, 2014 8:21 am

Hi,

Must the client_evSubmitComplete event be thread safe?
i.e. in a async model is it possible for the event to be fired again before the preceding event has completed?

Thanks!
alt
Site Admin
Posts: 985
Joined: Tue Apr 25, 2006 9:45 am

Re: Event thread safety

Post by alt » Wed Jun 25, 2014 9:42 am

Hi norman,

SmppClient has by default 3 working threads that process received messages. When SubmitSmResp received one of the thread raises evSubmitComplete event.
Therefore evSubmitComplete event can be fired again before the preceiding event has completed.
norman
Posts: 2
Joined: Wed Feb 26, 2014 4:58 am

Re: Event thread safety

Post by norman » Wed Jun 25, 2014 11:39 am

Thanks, that probably explains why I am losing data. I will lock the event handler - unless someone has a better suggestion.
Locked