Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Multithreading support in pluggable module, but with problems

On Feb 11, 12:14pm, Sebastian Gniazdowski wrote:
} I think I got code close to working state. Can consecutively spawn 32
} threads one hundred times. Have functions without queue_signals() etc.
} copied from Zsh. What is to stop conflicts are helper variables.

So, what you mean is that what stops conflicts is well-written shell
scripts that remember to check the semaphores.

} > In particular you *might* need to call either movefd() or redup()
} > rather than call dup2() directly, and you should otherwise be using
} > addmodulefd() to protect the fd from exec.c:closeallelse().  Examples
} > in Src/Modules/tcp.c.
} Good to know, thanks. I might reserve 32 file descriptors.

There's no reason to reserve descriptors just add them as you open them,
and close them with zclose().  Also, you shouldn't add any that aren't
actually open.

Please, take a look at the way tcp.c or even socket.c manages file
descriptors, it'll probably save you a lot of thrashing.

Messages sorted by: Reverse Date, Date, Thread, Author