Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

example usage and documentation of mailbox module #174

Open
sav opened this issue Sep 3, 2024 · 5 comments
Open

example usage and documentation of mailbox module #174

sav opened this issue Sep 3, 2024 · 5 comments

Comments

@sav
Copy link
Collaborator

sav commented Sep 3, 2024

provide an example and documentation of the mailbox module (lib/mailbox.lua).

@lneto
Copy link
Contributor

lneto commented Sep 4, 2024

I think we can adapt echod example to use it

@lneto
Copy link
Contributor

lneto commented Sep 5, 2024

actually, I think it's a good opportunity to apply mailbox to systrack example and change luaprobe to .sleep = false, splitting systrack in two separate runtimes (one for the probes and another to the chardev).. perhaps this could fix its termination.. (it's hanging.. by bet is a deadlock between driver and probe)..

@lneto
Copy link
Contributor

lneto commented Sep 5, 2024

@glk0 btw, are you still interested to tackle this? #96 (comment) If so, I can help you on using mailbox to implement this separation..

@lneto
Copy link
Contributor

lneto commented Sep 5, 2024

basically, we would need to move the driver code to something like systrack/driver.lua and the probes to systrack/probe.lua, than we should create a mailbox and return its queue in a function returned by probe.lua, e.g.,

-- probe.lua
...
local mbox = mailbox.outbox(size)

local function attacher()
  return mbox.queue
end

return mbox

then, we can create a runtime for probes in the driver and resume it to receive its mailbox, e.g.,

-- driver.lua
...
local probe = lunatik.runtime("systrack/probe", false)
local mbox = mailbox.inbox(probe:resume())

then, we can poll the mbox in the driver.. similarly to https://github.com/ring0networks/dome/blob/master/daemon.lua#L41

@glk0
Copy link
Contributor

glk0 commented Sep 5, 2024

@glk0 btw, are you still interested to tackle this? #96 (comment) If so, I can help you on using mailbox to implement this separation..

Yeah. I'll get back to you in a few days about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants