diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2013-10-18 15:29:06 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2013-10-18 15:29:06 -0400 |
commit | 7b7ed90176e8ab19b039285398cde2f04ac076df (patch) | |
tree | 480a7cbe7882b2083086f5f867689d282d710a2f /gpsd.c | |
parent | bcd1084e6efdb66d5d3d9144c9384a329e7a9fd1 (diff) | |
download | gpsd-7b7ed90176e8ab19b039285398cde2f04ac076df.tar.gz |
Thread-lock the code for writing JSON to clients...
...which means it can be called safely from both the main and PPS-handling
threads.
All regression testts pass.
Diffstat (limited to 'gpsd.c')
-rw-r--r-- | gpsd.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -601,7 +601,14 @@ static ssize_t throttled_write(struct subscriber_t *sub, char *buf, } } +#if defined(PPS_ENABLE) + gpsd_acquire_reporting_lock(); +#endif /* PPS_ENABLE */ status = send(sub->fd, buf, len, 0); +#if defined(PPS_ENABLE) + gpsd_release_reporting_lock(); + +#endif /* PPS_ENABLE */ if (status == (ssize_t) len) return status; else if (status > -1) { |