Hello, James Strachan said the following on 10.10.2006 15:38:
>> It seems that this mailing list doesn't accept attachments... :-( > > yeah - though you can attach stuff to the website wiki or JIRA Should I create issue regarding compact framework compatibility in jira? >> >> NMS project building is fine, but there are small problems >> >> with activemq project - it uses Monitor.PulseAll and Monitor.Wait >> >> methods not supported by compact framework. I'll try to investigate if >> >> it is possible to avoid these methods usage. >> > >> > I wonder if there's an alternative way of doing these kinds of >> > monitors / semaphores in .Net? >> >> Yes. Possibly it could be done just with plain locks. I'm currently >> trying to do so. > > Note that we use lock a fair bit, we're using Monitor for inter-thread > notifications rather than mutually exclusive locking. Or idd I > misunderstand you there? I think it is possible to replace Monitor.Wait(semaphore, maxWait) with: Monitor.Exit(semaphore); autoResetEvent.WaitOne(maxWait, false); Monitor.Enter(semaphore); and Monitor.PulseAll(semaphore) with: Monitor.Exit(semaphore); autoResetEvent.Set(); Monitor.Enter(semaphore); but maybe, class which uses AutoResetEvent should implement IDisposable interface and call autoResetEvent.Close() in Dispose method. -- Oleg
