kersing / packet_forwarder

Multi protocol packet forwarder supporting the TTN gateway-connector protocol.
Other
86 stars 56 forks source link

mp_pkt_forwarder gps mutex #5

Closed grahamehorner closed 7 years ago

grahamehorner commented 7 years ago

mp_pkt_forwarder mutex needs to protect the result from the call to lgw_gps_get(NULL, NULL, &coord, &gpserr) (also for consistency with similar code above)

kersing commented 7 years ago

The mutex is required to protect the three global variables that are being set to the gateway location to make sure those are not accessed while being updated (as the update of three variables is not an atomic operation). The call to get the information does not need protection as that code uses only local variables (i is also a local variable). The code is correct as is in my opinion.