ProductPromotion
Logo

Lua

made by https://0x3d.site

GitHub - LuaLanes/lanes: Lanes is a lightweight, native, lazy evaluating multithreading library for Lua 5.1 to 5.4.
Lanes is a lightweight, native, lazy evaluating multithreading library for Lua 5.1 to 5.4. - LuaLanes/lanes
Visit Site

GitHub - LuaLanes/lanes: Lanes is a lightweight, native, lazy evaluating multithreading library for Lua 5.1 to 5.4.

GitHub - LuaLanes/lanes: Lanes is a lightweight, native, lazy evaluating multithreading library for Lua 5.1 to 5.4.

Documentation is available online at http://lualanes.github.io/lanes/ (should be the same as what is in the docs folder of the distribution).

===================== Usage on Windows:

For once, Win32 thread prioritazion scheme is actually a good one, and it works. :) Windows users, feel yourself as VIP citizens!!


Windows / MSYS:

On MSYS, 'stderr' output seems to be buffered. You might want to make it auto-flush, to help you track & debug your scripts. Like this:

io.stderr:setvbuf "no"

Even after this, MSYS insists on linewise buffering; it will flush at each newline only.

=================== Usage on Linux:

Linux NTPL 2.5 (Ubuntu 7.04) was used in the testing of Lua Lanes.

This document (http://www.icir.org/gregor/tools/pthread-scheduling.html) describes fairly well, what (all) is wrong with Linux threading, even today.

For other worthy links: http://kerneltrap.org/node/6080 http://en.wikipedia.org/wiki/Native_POSIX_Thread_Library

In short, you cannot use thread prioritation in Linux. Unless you run as root, and I truly would not recommend that. Lobby for yet-another thread implementation for Linux, and mail -> [email protected] about it. :)

CAVEAT: Anyone sufficiently knowledgeable with pthread scheduling is free to contact me bnt DOT germain AT gmail DOT com) with a suitable edit if this no longer applies on more recent kernels.

====================== Usage on Mac OS X:

No real problems in OS X, once everything is set up right...

In short, have your Lua core compiled with LUA_USE_DLOPEN and LUA_USE_POSIX instead of the (default as of 5.1) LUA_DL_DYLD and LUA_USE_MACOSX. This is crucial to have each module loaded only once (even if initialized separately for each thread) and for the static & global variables within the modules to actually be process-wide. Lua Lanes cannot live without... Lua 5.2 is fine in that regard (check luaconf.h to be safe).

Another issue is making sure you only have one Lua core. Your 'lua' binary must link dynamically to a .dylib, it must not carry a personal copy of Lua core with itself. If it does, you will gain many mysterious malloc errors when entering multithreading realm.

<< lua-xcode2(9473,0xa000ed88) malloc: *** Deallocation of a pointer not malloced: 0xe9fc0; This could be a double free(), or free() called with the middle of an allocated block; Try setting environment variable MallocHelp to see tools to help debug <<

rm lua.o luac.o gcc -dynamiclib -install_name /usr/local/lib/liblua.5.1.dylib
-compatibility_version 5.1 -current_version 5.1.2
-o liblua.5.1.2.dylib *.o

gcc -fno-common -DLUA_USE_POSIX -DLUA_USE_DLOPEN -DLUA_USE_READLINE -lreadline -L. -llua.5.1.2 lua.c -o lua

That should be it. :)

Fink 'lua51' packaging has the necessary changes since 5.1.2-3.

===================== Usage on FreeBSD:

Unlike in Linux, also the Lua engine used with Lanes needs to be compiled with '-lpthread'. Otherwise, the following malloc errors are received:

<<
lua in free(): warning: recursive call
PANIC: unprotected error in call to Lua API (not enough memory)
<<

Here are the Lua compilation steps that proved to work (FreeBSD 6.2 i386):

gmake freebsd
rm lua.o luac.o liblua.a
gcc -shared -lm -Wl,-E -o liblua.5.1.2.so *.o
gcc -O2 -Wall -DLUA_USE_LINUX -lm -Wl,-E -lpthread -lreadline -L. -llua.5.1.2 lua.c -o lua

To compile Lanes, use 'gmake' or simply:

cc -O2 -Wall -llua.5.1.2 -lpthread -shared -o out/bsd-x86/lua51-lanes.so \
    -DGLUA_LUA51 gluax.c lanes.c

To place Lua into ~/local, set the following environment variables (this is just a reminder for myself...):

export CPATH=.../local/include
export LIBRARY_PATH=.../local/lib
export LD_LIBRARY_PATH=.../local/lib

======================= Manual installation

After running GNU make, in directory src you will find files lanes.lua and lanes/core.so. The first goes into a directory on your LUA_PATH, and the lanes directory goes into a directory on your LUA_CPATH. If you are not sure how this works, try creating

/usr/local/share/lua/5.1/lanes.lua /usr/local/lib/lua/5.1/lanes/core.so

======================= Note about LuaJIT

It looks like LuaJIT makes some assumptions about the usage of its allocator. Namely, when a Lua state closes, memory allocated from its alloc function might be freed, even if said memory isn't actually owned by the state (for example if the allocator was used explicitly after retrieving if with lua_getallocf) Therefore it seems to be a bad idea, when creating a new lua_State, to propagate the allocator from another state, as closing the first state would invalidate all the memory used by the second one... The best is therefore to leave the 'allocator' configuration option unset when running LuaJIT.

(end)

More Resources
to explore the angular.

mail [email protected] to add your project or resources here 🔥.

Related Articles
to learn about angular.

FAQ's
to learn more about Angular JS.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory