Skip to content

Commit 66f9dc3

Browse files
committed
CI test prior to release
1 parent ea14d83 commit 66f9dc3

File tree

6 files changed

+5
-165
lines changed

6 files changed

+5
-165
lines changed

Changes

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
Revision history for OO-Monitors
22

33
{{$NEXT}}
4+
- Remove all features that depend on experimental macros:
5+
is conditioned trait, meet-condition, wait-condition.
6+
They do not appear to be used in any ecosystem modules,
7+
and will break this module when RakuAST is bootstrapped
48

59
1.1.4 2025-02-12T14:04:41+01:00
610
- Adapt build logic to also allow for the new

README.md

-30
Original file line numberDiff line numberDiff line change
@@ -58,36 +58,6 @@ monitor IPFilter {
5858

5959
That's about all there is to it. The monitor meta-object enforces mutual exclusion.
6060

61-
Conditions
62-
----------
63-
64-
Condition variables are declared with the `conditioned` trait on the monitor. To wait on a condition, use `wait-condition`. To signal that a condition has been met, use `meet-condition`. Here is an example of a bounded queue.
65-
66-
```raku
67-
monitor BoundedQueue is conditioned(<not-full not-empty>) {
68-
has @!tasks;
69-
has $.limit = die "Must specify a limit";
70-
71-
method add-task($task) {
72-
while @!tasks.elems == $!limit {
73-
wait-condition <not-full>;
74-
}
75-
@!tasks.push($task);
76-
meet-condition <not-empty>;
77-
}
78-
79-
method take-task() {
80-
until @!tasks {
81-
wait-condition <not-empty>;
82-
}
83-
meet-condition <not-full>;
84-
return @!tasks.shift;
85-
}
86-
}
87-
```
88-
89-
When `wait-condition` is used, the lock is released and the thread blocks until the condition is met by some other thread. By contrast, `meet-condition` just marks a waiting thread as unblocked, but retains the lock until the method is over.
90-
9161
Circular waiting
9262
----------------
9363

doc/OO-Monitors.rakudoc

-37
Original file line numberDiff line numberDiff line change
@@ -63,43 +63,6 @@ monitor IPFilter {
6363
That's about all there is to it. The monitor meta-object enforces mutual
6464
exclusion.
6565

66-
=head2 Conditions
67-
68-
Condition variables are declared with the C<conditioned> trait on the
69-
monitor. To wait on a condition, use C<wait-condition>. To signal that
70-
a condition has been met, use C<meet-condition>. Here is an example of
71-
a bounded queue.
72-
73-
=begin code :lang<raku>
74-
75-
monitor BoundedQueue is conditioned(<not-full not-empty>) {
76-
has @!tasks;
77-
has $.limit = die "Must specify a limit";
78-
79-
method add-task($task) {
80-
while @!tasks.elems == $!limit {
81-
wait-condition <not-full>;
82-
}
83-
@!tasks.push($task);
84-
meet-condition <not-empty>;
85-
}
86-
87-
method take-task() {
88-
until @!tasks {
89-
wait-condition <not-empty>;
90-
}
91-
meet-condition <not-full>;
92-
return @!tasks.shift;
93-
}
94-
}
95-
96-
=end code
97-
98-
When C<wait-condition> is used, the lock is released and the thread
99-
blocks until the condition is met by some other thread. By contrast,
100-
C<meet-condition> just marks a waiting thread as unblocked, but retains
101-
the lock until the method is over.
102-
10366
=head2 Circular waiting
10467

10568
Monitors are vulnerable to deadlock, if you set up a circular dependency. Keep

lib/OO/Monitors.rakumod

-52
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
use experimental :macros;
2-
31
class MetamodelX::MonitorHOW is Metamodel::ClassHOW {
42
has $!lock-attr;
53
has %!condition-attrs;
@@ -38,25 +36,6 @@ class MetamodelX::MonitorHOW is Metamodel::ClassHOW {
3836
self.Metamodel::ClassHOW::add_method(type, $name, $meth);
3937
}
4038

41-
method add_condition(Mu \type, $name) {
42-
die "Already have a condition variable $name"
43-
if %!condition-attrs{$name}:exists;
44-
my $attr = Attribute.new(
45-
name => '$!MONITR-CONDITION-' ~ $name,
46-
type => Any,
47-
package => type,
48-
build => -> \SELF, | { $!lock-attr.get_value(SELF).condition }
49-
);
50-
self.add_attribute(type, $attr);
51-
%!condition-attrs{$name} = $attr;
52-
}
53-
54-
method lookup_condition(Mu \type, $name) {
55-
die "No such condition variable $name; did you mean: " ~ %!condition-attrs.keys.join(', ')
56-
unless %!condition-attrs{$name}:exists;
57-
%!condition-attrs{$name}
58-
}
59-
6039
method compose(Mu \type) {
6140
my &callsame := CORE::<&callsame>; # Workaround for RT #127858
6241
if self.method_table(type)<BUILDALL>:exists {
@@ -84,37 +63,6 @@ class MetamodelX::MonitorHOW is Metamodel::ClassHOW {
8463
}
8564
}
8665

87-
sub add_cond_var(Mu:U $type, $name) {
88-
die "Can only add a condition variable to a monitor"
89-
unless $type.HOW ~~ MetamodelX::MonitorHOW;
90-
$type.HOW.add_condition($type, $name);
91-
}
92-
93-
multi trait_mod:<is>(Mu:U $type, :@conditioned!) is export {
94-
add_cond_var($type, $_) for @conditioned;
95-
}
96-
97-
multi trait_mod:<is>(Mu:U $type, :$conditioned!) is export {
98-
add_cond_var($type, $conditioned);
99-
}
100-
101-
sub get-cond-attr($cond, $user) {
102-
my $cond-canon = $cond.Str.subst(/<-alpha-[-]>+/, '', :g);
103-
die "Can only use $user in a monitor"
104-
unless $*PACKAGE.HOW ~~ MetamodelX::MonitorHOW;
105-
return $*PACKAGE.HOW.lookup_condition($*PACKAGE, $cond-canon);
106-
}
107-
108-
macro wait-condition($cond) is export {
109-
my $cond-attr = get-cond-attr($cond, 'wait-condition');
110-
quasi { $cond-attr.get_value($*MONITOR).wait() }
111-
}
112-
113-
macro meet-condition($cond) is export {
114-
my $cond-attr = get-cond-attr($cond, 'meet-condition');
115-
quasi { $cond-attr.get_value($*MONITOR).signal() }
116-
}
117-
11866
my package EXPORTHOW {
11967
package DECLARE {
12068
constant monitor = MetamodelX::MonitorHOW;

run-tests

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ say ""
6262
|| $enable-spesh-log;
6363

6464
say "Testing {
65-
"dist.ini".IO.lines.head.substr(7)
65+
(try "dist.ini".IO.lines.head.substr(7)) // "..."
6666
}{
6767
" including author tests" if $author
6868
}";

t/condition.rakutest

-45
This file was deleted.

0 commit comments

Comments
 (0)