05:10
<
tankf33der >
Morning all
05:11
<
tankf33der >
you are right, pil64 returns tag error too
05:12
<
abu[7] >
Good to know
05:13
<
tankf33der >
Do know exactly string, will paste in several hours
05:13
<
tankf33der >
do -> dont
05:15
<
abu[7] >
Pil64 used different algorithms here, so not comparable
06:28
msavoritias has joined #picolisp
06:30
rob_w has joined #picolisp
06:56
<
abu[7] >
Added a check for terminated originator in 'yield'
06:56
<
abu[7] >
'a' is the originator coroutine of 'b'
06:57
beneroth has quit [Quit: Leaving]
06:57
<
abu[7] >
and when 'b' returns from 'yield', 'a' is already gone and the c
06:57
<
abu[7] >
stacks cannot be restored
06:59
<
abu[7] >
I see no other way how 'b' could recover from that situation
07:23
<
tankf33der >
Checking
07:27
<
tankf33der >
Tests failed
07:28
<
tankf33der >
i will paste error asap
07:30
<
abu[7] >
The check is not 100% correct anyway, because meanwhile another co may occupy the stack frame
07:31
<
abu[7] >
It is hard to check for disappeared coroutines
07:47
msavoritias has quit [Ping timeout: 268 seconds]
07:49
<
tankf33der >
abu[7]: crashing this code
07:50
<
abu[7] >
Meetng, back in a few hours.
08:07
<
tankf33der >
found shorter or similar way:
08:11
msavoritias has joined #picolisp
09:30
msavoritias has quit [Remote host closed the connection]
10:13
<
abu[7] >
I see, a yield from the main routine to itself
10:13
<
abu[7] >
So a different issue
10:14
<
abu[7] >
I'm more worried about the disappeared coroutines
10:14
<
abu[7] >
How to detect this in general
10:21
<
abu[7] >
I investigate the yield to T first
10:21
<
abu[7] >
Can be shorter btw: (co 'a 7) (yield T T)
10:50
rob_w has quit [Remote host closed the connection]
10:51
<
abu[7] >
Fixed it. My change this morning was in ther wrong place by one line off!
10:56
<
tankf33der >
Passed
10:56
gahr has quit [Ping timeout: 260 seconds]
10:56
<
tankf33der >
now i have another illegal issue, pasting
10:56
gahr has joined #picolisp
10:58
<
abu[7] >
Too small stack segment size?
10:59
<
tankf33der >
Maybe :)
10:59
<
tankf33der >
it was simple error before
10:59
<
tankf33der >
stack overflow etc
11:00
<
abu[7] >
I use 8 as minimum
11:01
<
abu[7] >
If the stack is such small, even erro handhing is not doable
11:02
<
abu[7] >
I'm still thinking about the terminated onignator coroutines
11:02
<
abu[7] >
This is ugly
11:03
<
abu[7] >
I cannot check
11:04
<
abu[7] >
(co 'a (co 'b (throw (yield))))
11:04
<
abu[7] >
'a' is gone
11:06
<
abu[7] >
At first ok, but the segment might be used by a new coroutine when 'b' continues
11:07
<
abu[7] >
Then some stack links in 'b' might be faulty
11:08
<
abu[7] >
The check from today does not notice that
11:09
<
abu[7] >
Because coroutines run completely independent from each other, a check is not possible currently
11:11
<
abu[7] >
When a coroutine terminates, it does not care if any child routines are still running (and this even may be desired)
11:47
<
tankf33der >
? (stack)
11:47
<
tankf33der >
-> ((a . 63) ((NIL) . 57) ((NIL) . 57) ((NIL) . 57) (T . 249) . 64)
11:47
<
tankf33der >
illegal play
11:50
<
tankf33der >
this is russian word
11:52
<
tankf33der >
dick or penis
11:52
<
abu[7] >
Uh, sorry ;)
11:52
<
abu[7] >
How did you mess up the stack?
11:53
<
tankf33der >
(co (cons) (yield))
11:54
<
abu[7] >
Ah, ok, so not messed up
11:55
<
abu[7] >
Tag may be anything
11:55
<
abu[7] >
a symbol is just more efficient
12:40
msavoritias has joined #picolisp
12:56
<
tankf33der >
Bus error (core dumped)
12:56
<
tankf33der >
never seen this before
12:58
<
tankf33der >
now hang
12:59
<
tankf33der >
i am close
13:06
<
tankf33der >
like this
13:09
<
abu[7] >
Why the "'a" in (co (stack) 'a ... ?
13:09
<
abu[7] >
Ignored, right?
13:09
<
tankf33der >
first time yes
13:10
<
abu[7] >
Why not second time?
13:10
<
tankf33der >
unknown
13:11
<
abu[7] >
You mean "second versipn"?
13:12
<
abu[7] >
Anyway, no idea what exactly is relevant
13:13
<
tankf33der >
first version hang, second version coredumps
13:13
<
abu[7] >
Why does the second example have (stack)? You did not (co ...
13:14
<
tankf33der >
Stream of consciousness.
13:17
<
tankf33der >
exhausted
13:17
<
abu[7] >
(co (stack) 'a (stack 3)) is OK
13:17
<
abu[7] >
It is (co 64 (stack))
13:17
<
abu[7] >
Meaningless though
13:18
<
abu[7] >
So what exactly is illegal?
13:20
<
abu[7] >
Is it starting 'co' inside error handler?
13:20
<
tankf33der >
i pasted snapshot what i typed
13:22
<
abu[7] >
Probably starting 'co' inside error handler is a problem, because the co is in an unknown state? And it is reentrant then
13:25
<
tankf33der >
with 3 different behaviour - hang, segmentation and bus error
13:26
<
abu[7] >
The concrete behavior is random I think
13:27
<
abu[7] >
The point is what exactly is the illegal operation?
13:27
<
abu[7] >
What destoys which structure
13:28
<
abu[7] >
(co 'a (yield 'a 'a)) terminates and starts/stops 'a' while
*in* 'a' (in error handler)
13:29
<
abu[7] >
No idea what happens exactly ;)
13:30
<
abu[7] >
Maybe the stack frame of 'a' is freed and reused while in the error
13:32
<
abu[7] >
In general it is dangerous to continue processing while in an error break. Remember your case (let (* 3 4)
13:32
<
abu[7] >
then calling '*' while still in error
13:33
<
abu[7] >
because '*' is bound to 3 until you rewind to top level
13:34
<
abu[7] >
An error break is to *inspect' the state of the program that caused it
13:34
<
tankf33der >
bus error without errors
13:37
<
abu[7] >
The calls (co '((((T . 254) . 64) . 6... just create many (inaccessible) coroutines
13:37
<
abu[7] >
So is (co 'bc (co 'b (yield 'b 'b))) the problem?
13:38
<
abu[7] >
Looks legal to me
13:40
<
tankf33der >
two calls is enough
13:43
<
abu[7] >
Does not crash or Termux but gives "b -- Coroutine not found"
13:43
<
tankf33der >
try debian then
13:44
<
abu[7] >
Ah, hangs also
13:47
<
abu[7] >
As (co 'bc ...) seems legal, perhaps the lists as coroutine tasks are a problem?
13:47
fuxoft has joined #picolisp
13:48
<
abu[7] >
Tag is 'any', but perhaps there is an assdmption somewhere that they are symbols?
13:48
<
abu[7] >
Hi fuxoft!
13:53
<
abu[7] >
Is this wrong?
13:53
<
fuxoft >
Yeah, I expected the expression in parentheses to increase from ("unique counter" 1) to ("unique counter" 7)
13:54
<
abu[7] >
You are in 2 processes
13:54
<
abu[7] >
So the counters are per process
13:55
<
fuxoft >
I thought the counter is in separate 3rd process ("pipe")
13:56
<
abu[7] >
Yes, but you don't know which process reads what
13:57
<
fuxoft >
Oh, I thought that both printing processes read one item from the counting process.
13:57
<
abu[7] >
It is a single pipe
13:58
<
fuxoft >
So it's a problem for 2 processes to read from a single pipe?
13:58
<
abu[7] >
you
*do* get unique nums
13:59
<
abu[7] >
but the reads are not atomic
13:59
<
abu[7] >
So yes, gives garbage ;)
14:00
<
fuxoft >
Is there a way to do something similar atomically, I.e. one process providing a stream of general values and several other processes taking the next available item from this stream?
14:02
<
abu[7] >
A pipe is a stream of blocks of 512 bytes
14:03
<
abu[7] >
buffered by the receivers
14:04
<
abu[7] >
Hmm, what is the best way?
14:05
<
abu[7] >
Best would be a pipe to each receiver
14:07
<
abu[7] >
(for Pid (kids) (tell Pid 'println (inc 'N]
14:10
<
fuxoft >
But in this case, would it work if one process consumes the counter e.g. at twice the rate of another process?
14:11
<
abu[7] >
No, it is the senden who controls it
14:13
<
abu[7] >
There must be a way
14:14
fuxoft has quit [Quit: Client closed]
14:14
fuxoft has joined #picolisp
14:14
<
fuxoft >
I was thinking about inter-process messages similar to Erlang. Clearly pipes work quite differently...
14:15
<
abu[7] >
In pil interprocess messages are done via 'tell'
14:15
<
abu[7] >
But that's the sender
14:16
<
abu[7] >
It needs some handshaking then
14:17
<
abu[7] >
A receiver 'tells' the sender to 'tell' to him
14:17
<
abu[7] >
(tell *SendPid 'tell *Pid ...
14:17
<
fuxoft >
BTW the docs for (tell) say "See also kids, detach and hear." - And the docs for "hear" don't exist
14:18
<
abu[7] >
No, there is a ref for 'hear'
14:19
<
abu[7] >
the link works for me
14:20
<
fuxoft >
Strange, when I click the "hear" link, I see the top of refH.html file
14:20
<
abu[7] >
here it works software-lab.de/doc/refT.html#tell
14:21
<
fuxoft >
Oh, sorry, scratch that, it was problem with my browser
14:21
<
abu[7] >
I never use the index
14:22
<
fuxoft >
I have to learn more about tell and hear.
14:23
<
fuxoft >
Are there more examples for these somewhere?
14:24
<
abu[7] >
(tell *SendPid 'tell *Pid '(list 'println '*Pid '(inc 'N]
14:24
<
abu[7] >
Something like that :)
14:25
<
abu[7] >
Needs careful thinking about the right quoting, not tested
14:25
<
fuxoft >
To receive the (tell) program, the child has to be in the (wait) state?
14:25
<
tankf33der >
i see more tell examples
14:28
<
abu[7] >
(tell *SendPid 'tell *Pid '(list 'println '*Pid (inc 'N]
14:28
<
abu[7] >
better perhaps
14:29
<
abu[7] >
Without parens rather
14:30
<
fuxoft >
Is the (task) system related to this in any way?
14:30
<
abu[7] >
(tell *SendPid 'tell *Pid 'list ''println ''*Pid '(inc 'N]
14:31
<
abu[7] >
Only internally
14:31
<
abu[7] >
It is the same place that handles tasks and IPC
14:34
<
tankf33der >
fuxoft: this is all rosettacode.org tasks in one file
14:34
<
abu[7] >
It is the rosetta code project, covering
*very* many langs
14:35
<
tankf33der >
fuxoft: i have not small codebase but never played with IPC, cannot help you here
14:36
<
fuxoft >
For the (task) function, the first argument (when negative) is the invocation interval and this is also the id of the task? So I cannot have two different tasks with the same invocation interval?
14:39
<
abu[7] >
You can add the bodies
14:40
<
abu[7] >
in one task then
14:40
<
fuxoft >
It just seemed weird at the first sight :)
14:40
<
abu[7] >
Or use slightly different times
14:41
<
abu[7] >
*Run does not care
14:41
<
abu[7] >
'task' is just a front end
14:41
<
abu[7] >
See you tankf33der!
14:46
<
fuxoft >
No (fork)ing involved?
14:48
<
fuxoft >
Heureka! :)
14:48
<
abu[7] >
A somewhat conceived example
14:50
<
abu[7] >
Better with task and co
14:51
<
fuxoft >
Let's say I want to do a system that handles incoming data from various endlessly running Linux commands (e.g. mosquitto_sub) from various sources. I can do all this using *Run, in a single process, without forking?
14:52
<
fuxoft >
That's great.
14:52
<
abu[7] >
(task -2000 0 (co 'cnt (for I 6 (println I) (yield)) (task -2000)))
14:53
<
fuxoft >
And back to processes: Is there a simple way to (kill) a process and all its children and all their children etc... (the whole subtree)?
14:54
<
abu[7] >
Yes, just kill the parent
14:55
<
fuxoft >
Oh, so I have to do (detach) to prevent the child being killed?
14:56
<
abu[7] >
I don't remember the details
14:56
<
fuxoft >
Never mind. Thank you again for all your help
14:56
<
abu[7] >
Welcome :)
14:56
fuxoft has quit [Quit: Client closed]
14:59
<
abu[7] >
For the records: (vi 'llvm~sighandler)
14:59
<
abu[7] >
((val (setq P (ofs $Signal SIGTERM)))
14:59
<
abu[7] >
So 'detach' will prevent killing
15:23
msavoritias has quit [Ping timeout: 255 seconds]
16:07
<
abu[7] >
tankf33der: I said I cannot well check for terminated originator coroutines, but at least I added a plausibility check that it is a coroutine with the same tag
16:08
<
abu[7] >
Can you run all your tests to make sure I did not break it?
16:23
<
tankf33der >
Passed
16:23
<
tankf33der >
What about the rest?
16:24
<
abu[7] >
Great! Thanks.
16:24
<
abu[7] >
I investigate the list tag issue
16:25
<
tankf33der >
Good, thanks
17:21
<
abu[7] >
Minimal so far:
17:21
<
abu[7] >
(do 2 (co (1) 7)) (co 'bc (co 'b (yield)))
17:21
<
abu[7] >
Still no idea
17:42
<
tankf33der >
did you checked structures?
17:43
<
abu[7] >
Not directly
17:43
<
abu[7] >
I know where it fails
17:44
<
abu[7] >
(co 'bc (co 'b (yield))) should first terminate 'bc'
17:44
<
abu[7] >
(and then 'b' waits in yield and would error if continued)
17:45
<
abu[7] >
But: It first tries to stop 'b'
17:46
<
abu[7] >
Makes no sense, so the co frames must be corrupt somewhere
17:46
<
abu[7] >
I give up for today and have a beer
17:47
<
abu[7] >
Let's see tomorrow ...
18:01
fuxoft has joined #picolisp
18:05
<
abu[7] >
Yes, very good, I would also check for NIL (end of file) and then close FD and task
18:06
<
abu[7] >
(in @ (ifn (line T) (task (close ..)) (prnitln ...
18:08
<
fuxoft >
Why exactly is the '@' correctly populated here, is that some "task" magic?
18:09
<
abu[7] >
Yes, just for convenience, cause it is almost always needed
18:11
<
fuxoft >
At 20:06:35, why is there "(task (close ..." and not just "(close ..." ?
18:11
<
abu[7] >
To stop also the task
18:11
<
fuxoft >
Oh, because "(close ..." returns the number and then it stops the task
18:11
<
abu[7] >
close returs the FD
18:13
<
abu[7] >
This pattern is often in the system, e.g. @lib/http.l
18:16
fuxoft has quit [Ping timeout: 250 seconds]
18:45
pablo_escoberg has joined #picolisp
21:15
pablo_escoberg has quit [Quit: Client closed]