Home Bug Reports

Ice-1.0.1/C++/compilation

Hi,

"changes" say

- For posix threads, PTHREAD_MUTEX_RECURSIVE_NP is now only used if __linux__ is defined. Otherwise, PTHREAD_MUTEX_RECURSIVE is used.

But this code is commented in RecMutex.cpp, and there is another code which uses just PTHREAD_MUTEX_RECURSIVE and also pthread_mutexattr_settype which are undefined and compilation failed. Those are defined in pthread.h only if __USE_UNIX98 is defined.

What I did is I commented new code and uncommented what was commented. Went just fine.

So, why "#ifdef __linux__" code was commented?

Ivan

Comments

  • IvanIvan Member
    Forgot to mention the platform: Red Hat Linux release 7.2
    Compiler: gcc 2.96
  • marlowamarlowa Member Andrew MarlowOrganization: Wellabove LtdProject: study into feasibility of ice on WINCE project ✭✭
    Re: Ice-1.0.1/C++/compilation
    Originally posted by Ivan
    Hi,

    "changes" say

    - For posix threads, PTHREAD_MUTEX_RECURSIVE_NP is now only used if __linux__ is defined. Otherwise, PTHREAD_MUTEX_RECURSIVE is used.

    But this code is commented in RecMutex.cpp, and there is another code which uses just PTHREAD_MUTEX_RECURSIVE and also pthread_mutexattr_settype which are undefined and compilation failed. Those are defined in pthread.h only if __USE_UNIX98 is defined.
    Ivan

    The problem is that the original code failed to compile on Solaris using Forte because Ice was setting the mutex attribute in a non-std way. However the std way is only std as of POSIX 1.c. I submitted a fix but my fix was bad because I did not check properly that the environment conforms to POSIX 1.c (so blame me!). The std way to do this check is to compare _POSIX_VERSION with 199506L. This means that when/if Linux conforms to POSIX 1.c then Linux will also use pthread_mutexattr_settype. Can Ice developers make this change for Ice v1.0.2 please?

    Regards,

    Andrew M.
Sign In or Register to comment.