Embedded api thread usage

Jonathan Mitchell <[email protected]>
Newsgroups gmane.comp.gnome.mono.general
Message-ID <[email protected]>
I call my managed code via the embedded API and have hit a lock issue,.
The following statement gets called from my Objective C app’a main thread and from a managed worker thread.
Tracing seems to suggest that after the managed worker thread has accessed the lock the main C thread always fails to acquire the lock even after the managed thread has apparently exited the statement block. The lock is only used in this statement.

lock (SaveChangesLock) {
	value = base.SaveChanges(options);
}

If I replace the lock with Monitor.TryEnter  (SaveChangesLock) the lock is not acquired at first attempt but a subsequent attempt does succeed.

Is there anything I should be aware of here?
I am not quite sure how managed and native threads should interact.

Thanks

J


_______________________________________________
Mono-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.