Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

pthread-win64 patch and VS2008

I. K.
2009-06-19
2013-06-06
  • I. K.
    I. K.
    2009-06-19

    pthread patch works fine with mingw64, but now I need build this library with Microsoft compiler from VS2008.. pthreadVC2.dll and pthreadVC2.lib must be produced.

    Following parts of patch causes some build errors:

    #ifndef HAVE_STRUCT_TIMESPEC
    #define HAVE_STRUCT_TIMESPEC 1
    -struct timespec {
    -        long tv_sec;
    -        long tv_nsec;
    -};
    #endif /* HAVE_STRUCT_TIMESPEC */

    Why structure definition removed? -DHAVE_STRUCT_TIMESPEC compiler key enough for use timespec structure from mingw64-runtime headers.

    +#if defined(_WIN64)
    +  /*
    +   * Microsoft Visual C++ 7.1 and newer have _Interlocked intrinsics
    +   */  
    +    {
    +        result = InterlockedCompareExchange(LONG volatile *Destination,LONG ExChange,LONG Comperand)
    +;
    +    }
    +    else
    +    {
    +        result = InterlockedCompareExchange(LONG volatile *Destination,LONG ExChange,LONG Comperand);
    +    }

    What code I must insert here instead of this for MSVC build ?

     
    • Kai Tietz
      Kai Tietz
      2009-06-19

      Well, the first part of your question is answered easlily. I updated the patch and the structure is removed here by no intention. I protected the structure definition by our internal runtime define-closure.

      The second part should be the default case, possible even the Interlocked stuff should be used for vc, too.

      For the updated patch you can take a look on pthread-win32's open discussion ML, or you can sent me an mail (to ktietz70 at googlemail dot com) and I forward you my current version. We didn't put it up to our SF download section as we wish to put it into pthread-win32's head cvs version.

      Cheers,
      Kai

       
    • Kai Tietz
      Kai Tietz
      2009-06-24

      Well, the old version removed the timespec definition at all. Newer version (which is posted already to pthreads-win32 ML) just checks w64 specific protection closure.
      In general you should be able to use for VC the same lines here as for w64.

      Cheers,
      Kai