Vladimir N. Dzhivsanoff wrote:
Source:
declare X in
thread
X = 5
end
{Browse X}
After translating into core syntax:
declare X in
local Proc1 in
proc dynamic {Proc1}
X = 5
end
{`Thread.create` Proc1}
{Browse X}
end
1. What is "dynamic" in proc definition ?
Excellent question! Let's hope one of the guru's will have the answer to
this.
What else can be instead of "dynamic" ?
It seems that anything can be placed over there. If that anything is not
meaningful, then it will be just ignored. For instance, if you feed the
following code
declare
proc ignore this {Foo}
{Browse foo}
end
The compiler will tell you.
%*********************** flag check warning *********************
%**
%** unrecognized flag ignore was ignored
%**
%** in file "Oz", line 21, column 0
%*********************** flag check warning *********************
%**
%** unrecognized flag this was ignored
%**
%** in file "Oz", line 21, column 0
Declared variables:
Foo: procedure/0
% -------------------- accepted
Oh, now that I remember, this warning will just appear in Mozart-1.3.2.
It was just skip until 1.3.1. Looking at the code, the relevant keywords
would be instantiate, dynamic and sited, but I don't know what's the
meaning of each one.
2. Where can be found definition of "Thread.create" ? I cann`t find in Mozart
documentation about it.
True, there is no documentation of "Thread.create", BUT, there is a lot
of documentation of thread ... end, which is actually the same.
Thread.create is the builtin that implements thread <s> end, where the
statement <s> is puts as the body of a procedure, and this procedure is
given as the argument to the builtin. The code of this builtin can be
found in mozart/platform/emulator/builtins.cc starting at line 1482, but
don't take this as a suggestion for going and have a look at the
source code. What it basically does is to create a Thread entity
associating the <s> statement, and put it into the task scheduler to be
run later.
I hope it helps
cheers
Boriss
_________________________________________________________________________________
mozart-users mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users
_________________________________________________________________________________
mozart-users mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users