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  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list

Reply via email to