• 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
Threading and instance data (copying)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Threading and instance data (copying)


  • Subject: Threading and instance data (copying)
  • From: Jeffrey Drake <email@hidden>
  • Date: Mon, 28 Jun 2004 00:04:56 -0400

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Here I was trying to do multithreading in cocoa for the first time. But my problem seemed to confound people who looked at it in #macdev as well as myself. Proper locking is in place.

Now with the discovery of the problem, but no solution yet.

main self pointer: 0x360ad0
main pid: 1fc4
main event_cond: 0x36fbb0
main event_list: 0x326640
main message_lock: 0x36fe00
main message_list: 0x301430

thread self pointer: 0x360ad0
thread pid: 1fc4
thread event_cond: 0x360d80
thread event_list: 0x301430
thread message_lock: 0x360ee0
thread message_list: 0x301450

This basically says it all - the instance variables in the controller class are all different between threads.

The code I have is available here: http://paste.lisp.org/display/1487
It is not the most up to date, but same problem. (changes: separate class for thread now, and using accessors).

What is basically supposed to happen:
Thread two starts, calls getMessage which waits on an event condition.
Thread one eventually sends a message with addMessage (from a click event on a view) and changes the event condition.
- -- this is where it breaks down presumably because of the copying
Thread two resumes as it sees the event condition changed.
Thread two obtains event structure and posts a message of event received to a table in the main window.

A full project (and up to date) is available here: http://homepage.mac.com/wackysteak/.Public/Pedestal.zip

Any help on this matter would be appreciated.
- - Jeff

Jacquin's Postulate on Democratic Government: No man's life, liberty, or property are safe while the legislature is in session.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)

iD8DBQFA35jp0noMGorKkKgRAktuAJ4yoTBEFJLBtcVa+OSCjNmxUy+bWQCePt9C
78EunBncPg9V6ogesedPVEE=
=I8Dk
-----END PGP SIGNATURE-----
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Prev by Date: Re: Is that really a bug at all? (was: Re: Ugly bug in Foundation, beware!)
  • Next by Date: IB Palette List?
  • Previous by thread: Re: Resizing NSButton doesn't clear previous size
  • Next by thread: IB Palette List?
  • Index(es):
    • Date
    • Thread