• Yorick Peterse's avatar
    Allow migrating process from one pool to another · affb100c
    Yorick Peterse authored
    This can be used to run slow or blocking operations on the secondary
    pool without having to start an entirely separate process. While the
    latter might feel more natural it requires more memory (at least 32 KB
    the moment this new process allocates an object) and requires copying of
    data sent between these processes. On the other hand moving a process
    from one pool to another is cheap and doesn't suffer from any of these
    issues.
    
    Using this mechanism one could implement a file reading method like so:
    
        def read -> String {
          process.run_in_secondary_pool {
            _INKOC.file_read(@File)
          }
        }
    
    With this change the method `process.spawn_io` is removed as it most
    likely won't be used for a while (if ever).
    affb100c
move_to_pool.rb 457 Bytes