[ 
https://issues.apache.org/jira/browse/AVRO-1092?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13277626#comment-13277626
 ] 

Pugachev Maxim commented on AVRO-1092:
--------------------------------------

> 1. Are THREAD_LIBRARIES and THREADSAFE cmake intrinsic definitions or are 
> they your definitions?

This is mine definitions.


> 2. I didn't see why the definition _REENTRANT was set. It isn't used anywhere 
> in the source. Is it a requirement of pthreads?

Defining _REENTRANT causes the compiler to use thread safe (i.e. re-entrant) 
versions of several functions in the C library. This is not a requirement, but 
it should be used in MT code.


> 3. How do you disable or enable threads (under Linux)?

You need to pass a THREADSAFE flag to cmake: "cmake -DTHREADSAFE=true ."


> Is there a reason you didn't use the syntax similar to the zlib and lzma 
> codecs?

There is no flag named "Threads_FOUND" in cmake`s module FindThreads.cmake. In 
perfect scenario this code should be like this:

if(THREADSAFE)
    find_package(Threads)
    add_definitions(-DTHREADSAFE -D_REENTRANT)
    set(THREADS_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})

    #check for Unix/Win32 and add extra definitions
endif(THREADSAFE)

${CMAKE_THREAD_LIBS_INIT} contains correct thread library (pthreads or win32 
threads).
                
> avro-c: improving thread safety in error management code
> --------------------------------------------------------
>
>                 Key: AVRO-1092
>                 URL: https://issues.apache.org/jira/browse/AVRO-1092
>             Project: Avro
>          Issue Type: Bug
>          Components: c
>    Affects Versions: 1.6.3, 1.7.0
>            Reporter: Pugachev Maxim
>            Priority: Critical
>         Attachments: AVRO-1092-patch-2.patch, AVRO-1092.patch
>
>
> Error management code isn`t thread safe at all. I wrote a patch for this 
> issue, but it works only for *nix systems.
> Affected functions: avro_set_error(), avro_prefix_error()

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to