Re: [Owfs-developers] [GIT PULL] Fix race conditions in ow_regcomp

2017-11-12 Thread Justin Brewer
Thanks for the review.

On Sun, Nov 12, 2017 at 04:19:00PM +0100, Johan Ström wrote:
> Looks good to me, much cleaner indeed! Given that pthread_once is available
> everywhere?

pthread_once is part of standard POSIX thread support, so any libc implementing 
pthreads should include it. All the supported platforms/libc's on the owfs 
porting page do.

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers


Re: [Owfs-developers] [GIT PULL] Fix race conditions in ow_regcomp

2017-11-12 Thread Johan Ström
Looks good to me, much cleaner indeed! Given that pthread_once is 
available everywhere?



On 11/11/17 18:53, Justin Brewer wrote:

I have been experiencing crashes, or other random failures, while developing an 
application using libowcapi. Backtracing shows that these issues occur during 
ow_regcomp. Ultimately, the cause is the tsearch algorithm being misused for 
performing lazy initialization, resulting in race conditions.

This pull request replaces this algorithm with pthread_once, which was 
specifically designed for this use case. Also included is a small gitignore fix 
and a follow-on patch that may or may not be necessary, but was included for 
POSIX compliance.

The following changes since commit c4911a3a825b24727d923874a843fb804c3379db:

   LINK: unbreak non-ftdi access mode (2017-09-12 19:29:21 +0200)

are available in the Git repository at:

   https://gitlab.com/justinbrewer/owfs.git regex-init

for you to fetch changes up to dd39e5e8d9aefd4aa50ef77b9954500bef464b1d:

   Free regexes at exit (2017-11-08 13:34:21 -0600)


Justin Brewer (3):
   Ignore man3/IBLSS.3
   Fix race conditions in ow_regcomp
   Free regexes at exit

  module/owlib/src/c/ow_arg.c   |  41 +++---
  module/owlib/src/c/ow_lib_stop.c  |   3 -
  module/owlib/src/c/ow_parse_address.c |  62 +-
  module/owlib/src/c/ow_parse_sn.c  |  20 -
  module/owlib/src/c/ow_parsename.c | 148 +++---
  module/owlib/src/c/ow_regex.c | 113 ++
  module/owlib/src/include/ow_regex.h   |   2 -
  src/man/.gitignore|   1 +
  8 files changed, 178 insertions(+), 212 deletions(-)

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers



--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers