Opened 16 years ago

Closed 16 years ago

#471 closed defect (fixed)

Compilation error if pthread_mutexattr_set_type() is not present

Reported by: bennylp Owned by: bennylp
Priority: normal Milestone: release-0.9.0
Component: pjlib Version: trunk
Keywords: Cc:
Backport to 1.x milestone: Backported:

Description

PJLIB's os_core_unix.c needs to set the mutex type to either simple or recursive, and this is done by calling pthread_mutexattr_set_type().

Unfortunately pthread_mutexattr_set_type() may not be available in all cases (e.g. in Newlib, IIRC), and this will cause compilation to fail.

The configure script should detect if this feature is available and set the appropriate flags.

Change History (1)

comment:1 Changed 16 years ago by bennylp

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in r1783:

  • Added PJ_HAS_PTHREAD_MUTEXATTR_SETTYPE macro which is checked by the configure script. This macro specifies whether pthread_mutexattr_settype() is present.
  • Also added PJ_PTHREAD_MUTEXATTR_T_HAS_RECURSIVE macro which is checked by the configure script. This macro specifies whether pthread_mutexattr_t as the recursive field.
  • If pthread_mutexattr_settype() is not present, and when recursive mutex is needed, os_core_unix.c will set pthread_mutexattr_t.recursive to 1 if PJ_PTHREAD_MUTEXATTR_T_HAS_RECURSIVE macro is set.
Note: See TracTickets for help on using tickets.