diff options
author | Peter Drahoš <drahosp@gmail.com> | 2010-10-01 03:22:32 +0200 |
---|---|---|
committer | Peter Drahoš <drahosp@gmail.com> | 2010-10-01 03:22:32 +0200 |
commit | 89d9c98af1ac352ba4d49d660e61b0853d6e1a86 (patch) | |
tree | 15c56d2ce66b4ab147171c0f674cdb4a435ff13f /README | |
download | lanes-89d9c98af1ac352ba4d49d660e61b0853d6e1a86.tar.gz lanes-89d9c98af1ac352ba4d49d660e61b0853d6e1a86.tar.bz2 lanes-89d9c98af1ac352ba4d49d660e61b0853d6e1a86.zip |
Import to git
Diffstat (limited to 'README')
-rw-r--r-- | README | 106 |
1 files changed, 106 insertions, 0 deletions
@@ -0,0 +1,106 @@ | |||
1 | |||
2 | ===================== | ||
3 | Usage on Windows: | ||
4 | ===================== | ||
5 | |||
6 | For once, Win32 thread prioritazion scheme is actually a good one, and | ||
7 | it works. :) Windows users, feel yourself as VIP citizens!! | ||
8 | |||
9 | ------------------- | ||
10 | Windows / MSYS: | ||
11 | ------------------- | ||
12 | |||
13 | On MSYS, 'stderr' output seems to be buffered. You might want to make | ||
14 | it auto-flush, to help you track & debug your scripts. Like this: | ||
15 | |||
16 | io.stderr:setvbuf "no" | ||
17 | |||
18 | Even after this, MSYS insists on linewise buffering; it will flush at | ||
19 | each newline only. | ||
20 | |||
21 | |||
22 | =================== | ||
23 | Usage on Linux: | ||
24 | =================== | ||
25 | |||
26 | Linux NTPL 2.5 (Ubuntu 7.04) was used in the testing of Lua Lanes. | ||
27 | |||
28 | This document (http://www.net.in.tum.de/~gregor/docs/pthread-scheduling.html) | ||
29 | describes fairly well, what (all) is wrong with Linux threading, even today. | ||
30 | |||
31 | For other worthy links: | ||
32 | http://kerneltrap.org/node/6080 | ||
33 | http://en.wikipedia.org/wiki/Native_POSIX_Thread_Library | ||
34 | |||
35 | In short, you cannot use thread prioritation in Linux. Unless you run as | ||
36 | root, and I _truly_ would not recommend that. Lobby for yet-another thread | ||
37 | implementation for Linux, and mail -> akauppi@gmail.com about it. :) | ||
38 | |||
39 | |||
40 | ====================== | ||
41 | Usage on Mac OS X: | ||
42 | ====================== | ||
43 | |||
44 | No real problems in OS X, _once_ everything is set up right... | ||
45 | |||
46 | In short, have your Lua core compiled with LUA_USE_DLOPEN and LUA_USE_POSIX | ||
47 | instead of the (default as of 5.1) LUA_DL_DYLD and LUA_USE_MACOSX. This is | ||
48 | crucial to have each module loaded only once (even if initialized separately | ||
49 | for each thread) and for the static & global variables within the modules to | ||
50 | actually be process-wide. Lua Lanes cannot live without (and hopefully, | ||
51 | LUA_DL_DYLD is long gone by Lua 5.2)... | ||
52 | |||
53 | Another issue is making sure you only have _one_ Lua core. Your 'lua' binary | ||
54 | must link dynamically to a .dylib, it must _not_ carry a personal copy of Lua | ||
55 | core with itself. If it does, you will gain many mysterious malloc errors | ||
56 | when entering multithreading realm. | ||
57 | |||
58 | << | ||
59 | 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 | ||
60 | << | ||
61 | |||
62 | rm lua.o luac.o | ||
63 | gcc -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 | |||
67 | gcc -fno-common -DLUA_USE_POSIX -DLUA_USE_DLOPEN -DLUA_USE_READLINE -lreadline -L. -llua.5.1.2 lua.c -o lua | ||
68 | |||
69 | That should be it. :) | ||
70 | |||
71 | Fink 'lua51' packaging has the necessary changes since 5.1.2-3. | ||
72 | |||
73 | |||
74 | ===================== | ||
75 | Usage on FreeBSD: | ||
76 | ===================== | ||
77 | |||
78 | Unlike 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 | |||
86 | Here 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 | |||
93 | To 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 | |||
98 | To place Lua into ~/local, set the following environment variables (this is | ||
99 | just 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) | ||