lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Maybe my DarkSideSync (DSS) library can help? Its a Lua library, that provides async thread support for Lua.

The goal is to make it easier to write multi-platform bindings for multi-platform libraries. In my own use case, my binding for the (multi threaded, multi platform) pupnp library does not have any platform dependent code at all as that is all provided by DSS.
Unfortunately the wrappers for socket, mutex and semaphore/waithandle only have the windows code ready as I haven't finished it yet. Posixs/pthreads will be next, so if Haiku is compliant with those it shouldn't be very hard to fix.

DSS provides a queue for incoming threads/data. It can support just data delivery (incoming thread won't be blocked), or return results from Lua (incoming thread will be blocked until Lua posts the results).

Writing this of my phone, hence no direct links, but google for darksidesync + github and it will pop up.
Look for;
- darksidesync_api.h
- darksidesync_aux.c (not sure about this one...)
Additionally google for LuaUPnP + github for a sample use
Look for;
- callback.c
The last 3 (one not implemented) callbacks are blocking, waiting for Lua results, the others are delivery only.

It works by storing a predefined struct, containing the dss-api, as a userdata in the registry, any other c library can collect it there and call its functions. Check the mentioned darksidesync_aux.c file, which is intended for use in client libraries (like in LuaUPnP), how it collects and uses the api struct.

Thijs
--
This email was send from the poolside on a Tuscan hilltop

Rob Hoelz <rob@hoelz.ro> schreef:
I've been following the Haiku project for a while now, and I expressed
some interest in a Lua API for Haiku a while back. I'd be happy to
have a Lua/Haiku community! =)

I think the biggest issue with a Lua API on Haiku is the fact that the
Haiku API is heavily dependent on threads, so handling that from within
Lua would be difficult. Not to mention that the API is all C++, and we
would have to make Lua and virtual methods play nice.

-Rob

On Fri, 10 Aug 2012 19:19:30 +0200
sergei karhof <karhof21@gmail.com> wrote:

> Although Lua was ported to Haiku OS already a couple of years ago, I
> have yet to see some Lua-related activity in the Haiku/BeOS userland.
> Probably this has to do with the fact that no Lua bindings for the
> Haiku API are available as yet (Haiku/BeOS programming is very much
> oriented towards the use of native API features, because the operating
> system provides a lot out of the box, although third-party tools can
> also be used, of course).
> There was an attempt to create the Lua bindings, but it was
> discontinued. What a pity! We are left waiting for someone to step
> forward and do the bindings.
>
> I am curious to know if anyone has tried using Lua on Haiku/BeOS.
> I look forward to starting a Lua-related Haiku community, if someone
> joins me.
>
> Serg
>
> P.S. Haiku is a wonderful operating system for desktop use ;)
>