aboutsummaryrefslogtreecommitdiff
path: root/README
diff options
context:
space:
mode:
Diffstat (limited to 'README')
-rw-r--r--README106
1 files changed, 106 insertions, 0 deletions
diff --git a/README b/README
new file mode 100644
index 0000000..b29d43d
--- /dev/null
+++ b/README
@@ -0,0 +1,106 @@
1
2=====================
3 Usage on Windows:
4=====================
5
6For once, Win32 thread prioritazion scheme is actually a good one, and
7it works. :) Windows users, feel yourself as VIP citizens!!
8
9-------------------
10 Windows / MSYS:
11-------------------
12
13On MSYS, 'stderr' output seems to be buffered. You might want to make
14it auto-flush, to help you track & debug your scripts. Like this:
15
16 io.stderr:setvbuf "no"
17
18Even after this, MSYS insists on linewise buffering; it will flush at
19each newline only.
20
21
22===================
23 Usage on Linux:
24===================
25
26Linux NTPL 2.5 (Ubuntu 7.04) was used in the testing of Lua Lanes.
27
28This document (http://www.net.in.tum.de/~gregor/docs/pthread-scheduling.html)
29describes fairly well, what (all) is wrong with Linux threading, even today.
30
31For other worthy links:
32 http://kerneltrap.org/node/6080
33 http://en.wikipedia.org/wiki/Native_POSIX_Thread_Library
34
35In short, you cannot use thread prioritation in Linux. Unless you run as
36root, and I _truly_ would not recommend that. Lobby for yet-another thread
37implementation for Linux, and mail -> akauppi@gmail.com about it. :)
38
39
40======================
41 Usage on Mac OS X:
42======================
43
44No real problems in OS X, _once_ everything is set up right...
45
46In short, have your Lua core compiled with LUA_USE_DLOPEN and LUA_USE_POSIX
47instead of the (default as of 5.1) LUA_DL_DYLD and LUA_USE_MACOSX. This is
48crucial to have each module loaded only once (even if initialized separately
49for each thread) and for the static & global variables within the modules to
50actually be process-wide. Lua Lanes cannot live without (and hopefully,
51LUA_DL_DYLD is long gone by Lua 5.2)...
52
53Another issue is making sure you only have _one_ Lua core. Your 'lua' binary
54must link dynamically to a .dylib, it must _not_ carry a personal copy of Lua
55core with itself. If it does, you will gain many mysterious malloc errors
56when entering multithreading realm.
57
58<<
59lua-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
60<<
61
62rm lua.o luac.o
63gcc -dynamiclib -install_name /usr/local/lib/liblua.5.1.dylib \
64 -compatibility_version 5.1 -current_version 5.1.2 \
65 -o liblua.5.1.2.dylib *.o
66
67gcc -fno-common -DLUA_USE_POSIX -DLUA_USE_DLOPEN -DLUA_USE_READLINE -lreadline -L. -llua.5.1.2 lua.c -o lua
68
69That should be it. :)
70
71Fink 'lua51' packaging has the necessary changes since 5.1.2-3.
72
73
74=====================
75 Usage on FreeBSD:
76=====================
77
78Unlike in Linux, also the Lua engine used with Lanes needs to be compiled with
79'-lpthread'. Otherwise, the following malloc errors are received:
80
81 <<
82 lua in free(): warning: recursive call
83 PANIC: unprotected error in call to Lua API (not enough memory)
84 <<
85
86Here are the Lua compilation steps that proved to work (FreeBSD 6.2 i386):
87
88 gmake freebsd
89 rm lua.o luac.o liblua.a
90 gcc -shared -lm -Wl,-E -o liblua.5.1.2.so *.o
91 gcc -O2 -Wall -DLUA_USE_LINUX -lm -Wl,-E -lpthread -lreadline -L. -llua.5.1.2 lua.c -o lua
92
93To compile Lanes, use 'gmake' or simply:
94
95 cc -O2 -Wall -llua.5.1.2 -lpthread -shared -o out/bsd-x86/lua51-lanes.so \
96 -DGLUA_LUA51 gluax.c lanes.c
97
98To place Lua into ~/local, set the following environment variables (this is
99just a reminder for myself...):
100
101 export CPATH=.../local/include
102 export LIBRARY_PATH=.../local/lib
103 export LD_LIBRARY_PATH=.../local/lib
104
105
106(end)