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

SVCD::write [NOT READY] #39

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

cearto
Copy link

@cearto cearto commented Mar 1, 2015

This is the same SCVD write pull request, except with a cleaned commit log. Please comment on either.
#36

resolve_table(L, "TIMEOUT");
int timeout = (int) lua_tonumber(L, -1);

resolve_table(L, "handlers"); // 7
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While it is a good abstraction for development, this may add extra overhead to the embedded system since SVCD need to be load/unload every time this function is called, but in reality, it only need to be load once.

Untitled

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with Jack that this adds unnecessary overhead. The point of these C functions is that although they are ugly to write, you spend the time trying to optimise them. Development and prototyping would be done in Lua, in C you should be trying to be as efficient as possible

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is experimental code that we forgot to remove.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please remove it before your final pull request due in 1 hour and 20 minutes?

@immesys
Copy link
Contributor

immesys commented Mar 1, 2015

I am not convinced that this code was tested, how does anon_function get visible in the global scope? Can you detail how this was tested?

@immesys immesys mentioned this pull request Mar 2, 2015
@immesys immesys changed the title svcd-write-cleaned SVCD::write Mar 2, 2015
storm.os.invokeLater(timeout_ms*storm.os.MILLISECOND, function()
if SVCD.handlers[ivkid] ~= nil then
SVCD.handlers[ivkid](SVCD.TIMEOUT)
SVCD.handlers[ivkid] = nil
end
end)
storm.net.sendto(SVCD.wcsock, storm.mp.pack({svcid, attrid, ivkid, payload}), targetip, 2526)
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really sure what is going on with this bit of Lua left over. Do you still require it?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, we still require the invoke later. We were trying to switch it over to C and we got stuck.

@immesys immesys changed the title SVCD::write SVCD::write [NOT READY] Mar 2, 2015

/* SEND TO */
lua_pushlightfunction(L, libstorm_net_sendto);
// resolve_table(L, "print_sendto");
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove this line; It was a special debugging statement. Was resolving a lua function SVCD.print_sendto...

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

Successfully merging this pull request may close these issues.

4 participants