[zeromq-dev] Problems with errno on Win32

Brian Granger ellisonbg at gmail.com
Thu Feb 18 17:48:00 CET 2010


Martin,

I added the line to print the pointer of errno in thread.cpp.  In my
simple example that is
showing the error, that message gets printed twice and each time I see
a different &errno
value and a different thread id.

I also print &errno inside the recv block where xrecv is returning -
different value again.

Don't know what to think...

Cheers,

Brian



On Thu, Feb 18, 2010 at 8:17 AM, Brian Granger <ellisonbg at gmail.com> wrote:
> Martin,
>
>> One of the ideas I have is this: Python is single-threaded, right?
>
> No, not really.  It really does have full blown native threading
> support.  But it also has the global
> interpreter lock, which restricts only 1 thread to executing Python
> code at a time.  But other
> threads that don't call into Python itself can run concurrently.
> Thus, I am guessing that Python
> does link against the multi-threaded CRT.
>
> Cheers,
>
> Brian
>
>> Thus it
>> uses single-threaded CRT. Then it gets linked dynamically with libzmq.dll
>> whitch uses multi-threaded CRT. Now, when libzmq uses errno, which one it
>> is? One defined in ST CRT or the one from MT CRT?
>>
>> Just an idea though.
>>
>> Martin
>>
>> Brian Granger wrote:
>>>
>>> Martin,
>>>
>>> I am in class most of the day today, but will try this later.  One
>>> comment though: my feeling is that
>>> if the problem I am seeing is related to thread safety, the conflict
>>> is between the IO thread
>>> and the app thread.
>>>
>>> Cheers,
>>>
>>> Brian
>>>
>>> On Thu, Feb 18, 2010 at 4:36 AM, Martin Sustrik <sustrik at 250bpm.com>
>>> wrote:
>>>>
>>>> Hi Brian,
>>>>
>>>> Regarding the discussion we had yesterday about thread-safeness of errno
>>>> on Win32: I've did a check today and it seems that address of errno is
>>>> different for each thread - as it should be. I've run the test on WinXP.
>>>> How does it look like on your system?
>>>>
>>>> To check it, just open thread.cpp and following piece of code on line 53:
>>>>
>>>> printf ("%p\n", (void*) &errno);
>>>>
>>>> Then run any 0MQ test with multiple I/O threads. Each I/O thread will
>>>> print out the address of it's errno. Are they all the same?
>>>>
>>>> Thanks.
>>>> Martin
>>>> _______________________________________________
>>>> zeromq-dev mailing list
>>>> zeromq-dev at lists.zeromq.org
>>>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>>>
>>>
>>>
>>>
>>
>>
>
>
>
> --
> Brian E. Granger, Ph.D.
> Assistant Professor of Physics
> Cal Poly State University, San Luis Obispo
> bgranger at calpoly.edu
> ellisonbg at gmail.com
>



-- 
Brian E. Granger, Ph.D.
Assistant Professor of Physics
Cal Poly State University, San Luis Obispo
bgranger at calpoly.edu
ellisonbg at gmail.com



More information about the zeromq-dev mailing list