Simple lock up with delay + semaphore - not fixed with 0006576

Tom Phoenix rootbeer at redcat.com
Sat Jan 5 03:53:34 UTC 2008


On Jan 4, 2008 6:57 PM, Georg Köster <georg.koester at gmail.com> wrote:

> I have another question:
> Semaphore>>waitTimeoutMSecs:
> | d |
>     d := Delay timeoutSemaphore: self afterMSecs: (anInteger max: 0).
>     self wait.
>     "Signaling by the Delay here would over-signal the Sem."
>     d unschedule.
>
> A fix would need a sem for the sem I think... is that method usable?

Is that the source in your image for that method? Here's what I have:

	waitTimeoutMSecs: anInteger
		"Wait on this semaphore for up to the given number of milliseconds,
then timeout. It is up to the sender to determine the difference
between the expected event and a timeout."
	
		| waitingProcess wakeupProcess |
		waitingProcess _ Processor activeProcess.
		wakeupProcess _
			[(Delay forMilliseconds: (anInteger max: 0)) wait.
			self resumeProcess: waitingProcess] fork.
	
		self wait.
		wakeupProcess terminate.

Cheers!

--Tom Phoenix



More information about the Squeak-dev mailing list