2024-12-10 09:20:18

A first production test with threads in KC3

Today we deployed the KC3 git master branch to our production servers : https://www.kmx.io/ and https://kc3-lang.org/.

The latest patches include full support for threads with a brand new env_fork C module.

Threads are accessible from KC3 :

defmodule ThreadTest do

  def thread_count = 4

  def thread_run = fn () { puts("ok from thread") }

  def start = fn () {
    if (thread_count > 1) do
      threads = List.map(List.count(ThreadTest.thread_count - 1),
        fn (x) { Thread.new(ThreadTest.thread_run) })
      thread_run()
      List.each(threads, Thread.delete)
    end
  }

end