Customized version of luaproc


Luaproc is one of the multi-thread implementation for Lua. Compared with other lua multi-thread implementation, it provides several interesting features. See this paper: http://www.inf.puc-rio.br/~roberto/docs/ry08-05.pdf , which is written by the big names of Lua commnunity.

Recently, I want to rewrite the multi-thread module for one of  my project to support the distribution computation. After considering several lua multi-task implementation ( LuaTask, luaproc, lane etc ), I decided to use luaproc as the base to build my module. However, I found that luaproc do not provide the interfaces to manage the life cycle of lua processes. After calling luaproc.newproc(), the only thing I can do is waiting for its end. I even can not identify a process, because there is no identifier for lua process. Since the management of process life cycle is very important for my module, I modified luaproc to support these requirements. Two new functions were added to both of the parent process and child process.

luaproc.id()   returns the id of the running lua process. Process id is a number from 0 to 4096.

luaproc.exist(<id>)   finds out whether there exists a process with the given process id.

The original luaproc.newproc() function now returns a process id for further usage.

<process id> luaproc.newproc()

This might be useful for those who want to customize luaproc.  The source code can be found at the following link:

http://www.bhoustudio.com/products/luaproc_bhou_modif/luaproc_bhoustudio_modif.zip

It is under the same license as luaproc

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s