• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
The mutex is twice locked in different threads
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

The mutex is twice locked in different threads


  • Subject: The mutex is twice locked in different threads
  • From: Eugene Karpov <email@hidden>
  • Date: Thu, 16 Jul 2009 18:50:15 +0400

Brothers,

Our application often use posix mutex for synchronization. Sometimes we are looking problem with sync access to protected data. After investigation of darwin source and inserting trace messages we detected problem with double locking of mutex in different threads.

Initialization:
pthread_mutex_init(&m_mutex, NULL)

Locking trace:

corrected locking about 7030 times

PreLock thread(1817c00) id(sync_report_9AC72CBD) owner(0) lock_count(0)
Lock thread(1817c00) id(sync_report_9AC72CBD) owner(1817c00) lock_count(1) error(0)
PreUnlock thread(1817c00) id(sync_report_9AC72CBD) owner(1817c00) lock_count(1)
Unlock thread(1817c00) id(sync_report_9AC72CBD) owner(0) lock_count(0) error(0)

-----------
double locking

PreLock thread(1822400) id(sync_report_9AC72CBD) owner(0) lock_count(0)
Lock thread(1822400) id(sync_report_9AC72CBD) owner(1822400) lock_count(1) error(0)
PreLock thread(181be00) id(sync_report_9AC72CBD) owner(1822400) lock_count(1)
Lock thread(181be00) id(sync_report_9AC72CBD) owner(181be00) lock_count(1) error(0)
PreUnlock thread(1822400) id(sync_report_9AC72CBD) owner(181be00) lock_count(1)
Unlock thread(1822400) id(sync_report_9AC72CBD) owner(181be00) lock_count(1) error(1)

thread - executable thread
id - mutex id
owner, lock_count - protected members of mutex
error - result

Why it is happing?

Darwin 8.11.1
Mac OS 10.4.11
Intel Core 2 Duo

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: The mutex is twice locked in different threads
      • From: Wade Tregaskis <email@hidden>
  • Prev by Date: Re: 2048 bug
  • Next by Date: Re: The mutex is twice locked in different threads
  • Previous by thread: Re: Query on start function with dump_syms result
  • Next by thread: Re: The mutex is twice locked in different threads
  • Index(es):
    • Date
    • Thread