Hi,

Thanks a lot Feng for your quick answer. Well at the moment, we are only 
planning to use it in a single threaded application where we write/read 
messages sequentially, instead of in parallel. So I guess we are safe for 
now.

Regards,
Safi

On Monday, October 21, 2013 7:32:19 PM UTC+3, Feng Xiao wrote:
>
>
>
>
> On Mon, Oct 21, 2013 at 1:05 AM, Safi Ali <safi...@gmail.com <javascript:>
> > wrote:
>
>> Hi,
>>
>> I have been trying to compile google protocol buffers 2.5.0 on solaris 
>> (sparc) environment. It seems I have to use 
>> the GOOGLE_PROTOBUF_NO_THREAD_SAFETY macro in order to make it compile 
>> properly. So I follow these steps to compile protobuf:-
>>
>> ./configure CPPFLAGS="-DGOOGLE_PROTOBUF_NO_THREAD_SAFETY"
>> make 
>> make check
>>
>> In 'make check', all tests pass. 
>> Can anyone shed some light on what are the caveats of using the 
>> no_thread_safety macro? What, if any, problems can I expect from protobufs 
>> with no thread safety. I have some apprehensions about it and it would be 
>> great if someone could clarify those for me:-
>>
>> 1. Is the thread safety only an issue during compilation of .proto files 
>> to java/c++ source files? or does protobuf also rely on thread safety 
>> during execution of compiled code?
>>
> Protobuf uses mutex/locks at runtime to protect certain data structures in 
> multi-threading environment.
>  
>
>> 2. If I dont use thread safety, does protobuf gracefully fall back to 
>> single threaded model where needed, or still try to use threads but in 
>> somewhat "unsafe" fashion which can lead to bugs such as deadlocks if im 
>> unlucky?
>>
> Protobuf doesn't create threads, but with no_thread_safety macro, all 
> mutex/locks will be turned into nop. That means you can only use protobuf 
> in a single threaded binary. If you try to use messages in multiple 
> threads, the code may break unexpectedly.
>  
>
>> 3. How is the performance affected while using thread unsafe code? if 
>> anyone has done some benchmarking, would be good to see the results.
>>
>> Regards,
>> Safi
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Protocol Buffers" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to protobuf+u...@googlegroups.com <javascript:>.
>> To post to this group, send email to prot...@googlegroups.com<javascript:>
>> .
>> Visit this group at http://groups.google.com/group/protobuf.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to