{"id":13894410,"url":"https://github.com/LuaLanes/lanes","last_synced_at":"2025-07-17T09:32:33.425Z","repository":{"id":1058115,"uuid":"1257578","full_name":"LuaLanes/lanes","owner":"LuaLanes","description":"Lanes is a lightweight, native, lazy evaluating multithreading library for Lua 5.1 to 5.4.","archived":false,"fork":false,"pushed_at":"2024-04-11T14:00:30.000Z","size":3190,"stargazers_count":424,"open_issues_count":0,"forks_count":91,"subscribers_count":22,"default_branch":"master","last_synced_at":"2024-04-12T15:30:46.174Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LuaLanes.png","metadata":{"files":{"readme":"README","changelog":"CHANGES","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2011-01-15T12:57:58.000Z","updated_at":"2024-04-14T17:43:02.868Z","dependencies_parsed_at":"2024-03-19T18:29:44.067Z","dependency_job_id":"f36de820-9a82-4457-af4e-e3296161317e","html_url":"https://github.com/LuaLanes/lanes","commit_stats":{"total_commits":424,"total_committers":22,"mean_commits":"19.272727272727273","dds":"0.33018867924528306","last_synced_commit":"49ef9d50d475921aab0c50b13b857f8cb990fcc0"},"previous_names":[],"tags_count":43,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LuaLanes%2Flanes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LuaLanes%2Flanes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LuaLanes%2Flanes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LuaLanes%2Flanes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LuaLanes","download_url":"https://codeload.github.com/LuaLanes/lanes/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226248357,"owners_count":17595158,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-06T18:01:32.530Z","updated_at":"2024-11-24T23:30:46.604Z","avatar_url":"https://github.com/LuaLanes.png","language":"C++","funding_links":[],"categories":["C++","资源","Resources","Processes and Threads"],"sub_categories":["Concurrency and Multithreading","Multitasking"],"readme":"Documentation is available online at http://lualanes.github.io/lanes/\n(should be the same as what is in the docs folder of the distribution).\n\n=====================\n  Usage on Windows:\n=====================\n\nFor once, Win32 thread prioritazion scheme is actually a good one, and\nit works. :)  Windows users, feel yourself as VIP citizens!!\n\n-------------------\n  Windows / MSYS:\n-------------------\n\nOn MSYS, 'stderr' output seems to be buffered. You might want to make\nit auto-flush, to help you track \u0026 debug your scripts. Like this:\n\n    io.stderr:setvbuf \"no\"\n\nEven after this, MSYS insists on linewise buffering; it will flush at\neach newline only.\n\n\n===================\n  Usage on Linux:\n===================\n\nLinux NTPL 2.5 (Ubuntu 7.04) was used in the testing of Lua Lanes.\n\nThis document (http://www.icir.org/gregor/tools/pthread-scheduling.html)\ndescribes fairly well, what (all) is wrong with Linux threading, even today.\n\nFor other worthy links:\n    http://kerneltrap.org/node/6080\n    http://en.wikipedia.org/wiki/Native_POSIX_Thread_Library\n\nIn short, you cannot use thread prioritation in Linux. Unless you run as\nroot, and I _truly_ would not recommend that. Lobby for yet-another thread\nimplementation for Linux, and mail -\u003e akauppi@gmail.com about it. :)\n\nCAVEAT: Anyone sufficiently knowledgeable with pthread scheduling is free to\ncontact me bnt DOT germain AT gmail DOT com)  with a suitable edit\nif this no longer applies on more recent kernels.\n\n\n======================\n  Usage on Mac OS X:\n======================\n\nNo real problems in OS X, _once_ everything is set up right...\n\nIn short, have your Lua core compiled with LUA_USE_DLOPEN and LUA_USE_POSIX\ninstead of the (default as of 5.1) LUA_DL_DYLD and LUA_USE_MACOSX. This is\ncrucial to have each module loaded only once (even if initialized separately\nfor each thread) and for the static \u0026 global variables within the modules to\nactually be process-wide. Lua Lanes cannot live without...\nLua 5.2 is fine in that regard (check luaconf.h to be safe).\n\nAnother issue is making sure you only have _one_ Lua core. Your 'lua' binary\nmust link dynamically to a .dylib, it must _not_ carry a personal copy of Lua\ncore with itself. If it does, you will gain many mysterious malloc errors\nwhen entering multithreading realm.\n\n\u003c\u003c\nlua-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\n\u003c\u003c\n\nrm lua.o luac.o\ngcc -dynamiclib -install_name /usr/local/lib/liblua.5.1.dylib \\\n    -compatibility_version 5.1 -current_version 5.1.2 \\\n    -o liblua.5.1.2.dylib *.o\n\ngcc -fno-common -DLUA_USE_POSIX -DLUA_USE_DLOPEN -DLUA_USE_READLINE -lreadline -L. -llua.5.1.2 lua.c -o lua\n\nThat should be it. :)\n\nFink 'lua51' packaging has the necessary changes since 5.1.2-3.\n\n\n=====================\n  Usage on FreeBSD:\n=====================\n\nUnlike in Linux, also the Lua engine used with Lanes needs to be compiled with\n'-lpthread'. Otherwise, the following malloc errors are received:\n\n    \u003c\u003c\n    lua in free(): warning: recursive call\n    PANIC: unprotected error in call to Lua API (not enough memory)\n    \u003c\u003c\n\nHere are the Lua compilation steps that proved to work (FreeBSD 6.2 i386):\n\n    gmake freebsd\n    rm lua.o luac.o liblua.a\n    gcc -shared -lm -Wl,-E -o liblua.5.1.2.so *.o\n    gcc -O2 -Wall -DLUA_USE_LINUX -lm -Wl,-E -lpthread -lreadline -L. -llua.5.1.2 lua.c -o lua\n\nTo compile Lanes, use 'gmake' or simply:\n\n    cc -O2 -Wall -llua.5.1.2 -lpthread -shared -o out/bsd-x86/lua51-lanes.so \\\n        -DGLUA_LUA51 gluax.c lanes.c\n\nTo place Lua into ~/local, set the following environment variables (this is\njust a reminder for myself...):\n\n    export CPATH=.../local/include\n    export LIBRARY_PATH=.../local/lib\n    export LD_LIBRARY_PATH=.../local/lib\n\n=======================\n  Manual installation\n=======================\n\nAfter running GNU make, in directory `src` you will find files\n`lanes.lua` and `lanes/core.so`.  The first goes into a directory on\nyour LUA_PATH, and the `lanes` directory goes into a directory on your\nLUA_CPATH.  If you are not sure how this works, try creating\n\n   /usr/local/share/lua/5.1/lanes.lua\n   /usr/local/lib/lua/5.1/lanes/core.so\n\n=======================\n  Note about LuaJIT\n=======================\nIt looks like LuaJIT makes some assumptions about the usage of its allocator.\nNamely, when a Lua state closes, memory allocated from its alloc function might be freed, even if said memory\nisn't actually owned by the state (for example if the allocator was used explicitly after retrieving if with lua_getallocf)\nTherefore it seems to be a bad idea, when creating a new lua_State, to propagate the allocator\nfrom another state, as closing the first state would invalidate all the memory used by the second one...\nThe best is therefore to leave the 'allocator' configuration option unset when running LuaJIT.\n\n(end)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLuaLanes%2Flanes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FLuaLanes%2Flanes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLuaLanes%2Flanes/lists"}