[Oberon] Re: Oberon Digest, Vol 36, Issue 5

Søren Renner soren.renner at gmail.com
Mon Sep 18 18:07:25 CEST 2006


What is wrong with using threads in the following way in Bluebottle Oberon?
*****************************************************
MODULE threads;

TYPE workthread=OBJECT

BEGIN{ACTIVE, normal priority}
REPEAT
    AWAIT(gothreads);
    work;
    INC(threadsdone);
    AWAIT(~gothreads);
END;

VAR
   threadsdone:INTEGER;
   gothreads:BOOLEAN
(*main thread*)

PROCEDURE go*;
BEGIN
     gothreads:=TRUE;
     AWAIT(threadsdone=n); (* for n threads*)
     gothreads:=FALSE
END go;

BEGIN
     create n thread objects
END threads;

each time "go" is called every thread does its work once before "go"
returns to the caller. why does this create traps in the kernel log
that trace to the AWAIT statement?


More information about the Oberon mailing list