Skip to content

Commit

Permalink
Remove references to no-longer-existing "Service.yield()" method; upd…
Browse files Browse the repository at this point in the history
…ate the todo list
  • Loading branch information
Gene Gleyzer committed Oct 21, 2024
1 parent c508c85 commit 6dc7947
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 32 deletions.
18 changes: 0 additions & 18 deletions doc/todo-list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
- CP: add API support for multi-part body, for example (Body.x):
conditional Body[] multipart() = False;

- CP: need to implement "persistent" mutators for HasherMap

- GG: add the following method to Tuple
/**
* Obtain a `List` view of this Tuple. Note, that the type check will be performed only
Expand All @@ -31,16 +29,9 @@
- GG: consider changing Service.callLater() API to
<Result> Future<Result> callLater(function Result doLater());

- consider a @Proxy annotation for mutable service properties to create a delegation pattern (see
SessionImpl.attributes)

- add a method to Map API to evaluate the "worst lookup cost" based on the current content
(Mark's suggestion to evaluated keys' hashCode distribution)

- how to move ecstasy.mgmt package to a separate module? FileTemplate depends on ModuleRepository...

- GG: enum ClassCompositions without type parameters could be made into CanonicalCompositions

- consider allowing comparison between T and T?; for example making Null always "Lesser"

- consider using (new ConcurrentSection()) to get "pre-switching" notification
Expand All @@ -65,16 +56,8 @@

- CP: consider adding specialized String.append(Char c) and String.append(String s)

- consider not needing the ^ for a return of a tail-call invocation (except in a try block?)
"return foo();" should be equivalent to "return foo^();"

- CP: consider a compiler warning if a return value of Closeable type is ignored (@Adopt annotation)

- consider a new Async mixin:
mixin Async into Object implements Service {}
allowing to turn a mutable class into a service:
ErrorList errs = new @Async ErrorList(10);

- add compiler support for conditional Tuple

- consider adding a V_GET opcode that would combine the functionality of L_GET and MOVE_THIS for
Expand All @@ -92,4 +75,3 @@
- what if timer.schedule() lambda throws? (exception is invisible)
- infinite loop detection
- upon a Future's gc report if an exception has not been handled
- allow injection of Console to specify a history file (or do it by default?)
3 changes: 1 addition & 2 deletions lib_ecstasy/src/main/x/ecstasy/Service.x
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@
* * The runtime itself may provide events to the service, enqueuing them so that if the service is
* running, the event does not interrupt the execution. These events will be automatically
* processed by a service when it is not busy processing, such as when the current service
* invocation returns, calls [yield], or even potentially when another service is invoked by
* this service. Runtime events may be processed even if [reentrant] evaluates to `False`.
* invocation returns, or even potentially when another service is invoked by this service.
* Runtime events include only:
* * * Future completion events, for previous asynchronous invocations initiated by this service.
* * * Timeout notification for the currently executing service invocation, although the runtime
Expand Down
14 changes: 7 additions & 7 deletions lib_ecstasy/src/main/x/ecstasy/annotations/Concurrent.x
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@
* class, property, or method **is safe** for concurrent/reentrant execution.
*
* Imagine a simple, provably reentrant- and concurrent-safe counter implementation, with silly
* calls to `yield()` added, for purposes of this example:
* 'doSomething()' blocking call to another service added, for purposes of this example:
*
* class Counter {
* private Int counter = 0;
* private Int counter;
* private SomeService svc;
* Int next() {
* this:service.yield();
* Int n = ++counter; // read, modify, and write the value without interruption
* this:service.yield();
* svc.doSomething();
* return n;
* }
* }
*
* In most cases, one would expect that an instance of this class is mutable. As such, the class
* (and thus the method) are implicitly `@Synchronized`, and thus the call to `yield()` does not
* actually yield, and thus it does not allow other fibers to execute.
* (and thus the method) are implicitly `@Synchronized`, and thus the call to `doSomething()` does
* not actually allow other fibers to execute.
*
* Any one of the following actions would mark this code "safe" for executing other fibers during
* the call to `yield()`:
* the call to `doSomething()`:
*
* * The `next()` method could be annotated with `@Concurrent`;
*
Expand Down
11 changes: 6 additions & 5 deletions lib_ecstasy/src/main/x/ecstasy/annotations/Synchronized.x
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@
* Imagine a demonstrably concurrent-unsafe implementation of a counter:
*
* @Concurrent class Counter {
* private Int counter = 0;
* private Int counter;
* private SomeService svc;
* Int next() {
* Int n = counter + 1;
* this:service.yield(); // allows other fibers to execute before this line completes
* counter = n; // possible corruption: storing a stale value
* svc.doSomething(); // allows other fibers to execute before this line completes
* counter = n; // possible corruption: storing a stale value
* return n;
* }
* }
*
* Any one of the following three actions would disallow the `yield()` call in the above example
* from executing other fibers:
* Any one of the following three actions would disallow other fibers' execution on the `Counter`
* service while `next()` method is blocked waiting for `doSomething()` method to return.
*
* * The `next()` method could be annotated with `@Synchronized`;
*
Expand Down

0 comments on commit 6dc7947

Please sign in to comment.