A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
[simgrid.git]
/
src
/
bindings
/
lua
/
lua_task.c
diff --git
a/src/bindings/lua/lua_task.c
b/src/bindings/lua/lua_task.c
index
cfdf114
..
62eee82
100644
(file)
--- a/
src/bindings/lua/lua_task.c
+++ b/
src/bindings/lua/lua_task.c
@@
-23,14
+23,14
@@
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(lua_task, bindings, "Lua bindings (task module)"
* \param index an index in the Lua stack
* \return the C task corresponding to this Lua task
*/
* \param index an index in the Lua stack
* \return the C task corresponding to this Lua task
*/
-m_task_t sglua_check_task(lua_State* L, int index)
+m
sg
_task_t sglua_check_task(lua_State* L, int index)
{
sglua_stack_dump("check task: ", L);
luaL_checktype(L, index, LUA_TTABLE);
/* ... task ... */
lua_getfield(L, index, "__simgrid_task");
/* ... task ... ctask */
{
sglua_stack_dump("check task: ", L);
luaL_checktype(L, index, LUA_TTABLE);
/* ... task ... */
lua_getfield(L, index, "__simgrid_task");
/* ... task ... ctask */
- m
_task_t task = *((m
_task_t*) luaL_checkudata(L, -1, TASK_MODULE_NAME));
+ m
sg_task_t task = *((msg
_task_t*) luaL_checkudata(L, -1, TASK_MODULE_NAME));
lua_pop(L, 1);
/* ... task ... */
lua_pop(L, 1);
/* ... task ... */
@@
-66,7
+66,7
@@
static int l_task_new(lua_State* L)
/* name comp comm */
lua_settop(L, 0);
/* -- */
/* name comp comm */
lua_settop(L, 0);
/* -- */
- m_task_t msg_task = MSG_task_create(name, comp_size, msg_size, NULL);
+ m
sg
_task_t msg_task = MSG_task_create(name, comp_size, msg_size, NULL);
lua_newtable(L);
/* task */
lua_newtable(L);
/* task */
@@
-74,7
+74,7
@@
static int l_task_new(lua_State* L)
/* task mt */
lua_setmetatable(L, -2);
/* task */
/* task mt */
lua_setmetatable(L, -2);
/* task */
- m
_task_t* lua_task = (m_task_t*) lua_newuserdata(L, sizeof(m
_task_t));
+ m
sg_task_t* lua_task = (msg_task_t*) lua_newuserdata(L, sizeof(msg
_task_t));
/* task ctask */
*lua_task = msg_task;
luaL_getmetatable(L, TASK_MODULE_NAME);
/* task ctask */
*lua_task = msg_task;
luaL_getmetatable(L, TASK_MODULE_NAME);
@@
-96,7
+96,7
@@
static int l_task_new(lua_State* L)
*/
static int l_task_get_name(lua_State* L)
{
*/
static int l_task_get_name(lua_State* L)
{
- m_task_t task = sglua_check_task(L, 1);
+ m
sg
_task_t task = sglua_check_task(L, 1);
lua_pushstring(L, MSG_task_get_name(task));
return 1;
}
lua_pushstring(L, MSG_task_get_name(task));
return 1;
}
@@
-111,7
+111,7
@@
static int l_task_get_name(lua_State* L)
*/
static int l_task_get_computation_duration(lua_State* L)
{
*/
static int l_task_get_computation_duration(lua_State* L)
{
- m_task_t task = sglua_check_task(L, 1);
+ m
sg
_task_t task = sglua_check_task(L, 1);
lua_pushnumber(L, MSG_task_get_compute_duration(task));
return 1;
}
lua_pushnumber(L, MSG_task_get_compute_duration(task));
return 1;
}
@@
-128,8
+128,8
@@
static int l_task_get_computation_duration(lua_State* L)
*/
static int l_task_execute(lua_State* L)
{
*/
static int l_task_execute(lua_State* L)
{
- m_task_t task = sglua_check_task(L, 1);
-
MSG
_error_t res = MSG_task_execute(task);
+ m
sg
_task_t task = sglua_check_task(L, 1);
+
msg
_error_t res = MSG_task_execute(task);
if (res == MSG_OK) {
return 0;
if (res == MSG_OK) {
return 0;
@@
-147,7
+147,7
@@
static int l_task_execute(lua_State* L)
*/
void sglua_task_register(lua_State* L) {
*/
void sglua_task_register(lua_State* L) {
- m_task_t task = sglua_check_task(L, -1);
+ m
sg
_task_t task = sglua_check_task(L, -1);
/* ... task */
/* put in the C task a ref to the lua task so that the receiver finds it */
unsigned long ref = luaL_ref(L, LUA_REGISTRYINDEX);
/* ... task */
/* put in the C task a ref to the lua task so that the receiver finds it */
unsigned long ref = luaL_ref(L, LUA_REGISTRYINDEX);
@@
-164,7
+164,7
@@
void sglua_task_register(lua_State* L) {
* \param L a lua state
* \param task a C task
*/
* \param L a lua state
* \param task a C task
*/
-void sglua_task_unregister(lua_State* L, m_task_t task) {
+void sglua_task_unregister(lua_State* L, m
sg
_task_t task) {
/* ... */
/* the task is in my registry, put it onto my stack */
/* ... */
/* the task is in my registry, put it onto my stack */
@@
-192,8
+192,8
@@
void sglua_task_unregister(lua_State* L, m_task_t task) {
* \param src_process the sender
* \param dst_process the receiver
*/
* \param src_process the sender
* \param dst_process the receiver
*/
-static void task_copy_callback(m
_task_t task, m
_process_t src_process,
- m_process_t dst_process) {
+static void task_copy_callback(m
sg_task_t task, msg
_process_t src_process,
+ m
sg
_process_t dst_process) {
lua_State* src = MSG_process_get_data(src_process);
lua_State* dst = MSG_process_get_data(dst_process);
lua_State* src = MSG_process_get_data(src_process);
lua_State* dst = MSG_process_get_data(dst_process);
@@
-212,7
+212,7
@@
static void task_copy_callback(m_task_t task, m_process_t src_process,
* make the sender forget the C task so that it doesn't garbage */
lua_getfield(src, -1, "__simgrid_task");
/* src: ... task ctask */
* make the sender forget the C task so that it doesn't garbage */
lua_getfield(src, -1, "__simgrid_task");
/* src: ... task ctask */
- m
_task_t* udata = (m
_task_t*) luaL_checkudata(src, -1, TASK_MODULE_NAME);
+ m
sg_task_t* udata = (msg
_task_t*) luaL_checkudata(src, -1, TASK_MODULE_NAME);
*udata = NULL;
lua_pop(src, 2);
/* src: ... */
*udata = NULL;
lua_pop(src, 2);
/* src: ... */
@@
-233,7
+233,7
@@
static void task_copy_callback(m_task_t task, m_process_t src_process,
*/
static int l_task_send(lua_State* L)
{
*/
static int l_task_send(lua_State* L)
{
- m_task_t task = sglua_check_task(L, 1);
+ m
sg
_task_t task = sglua_check_task(L, 1);
const char* mailbox = luaL_checkstring(L, 2);
double timeout;
if (lua_gettop(L) >= 3) {
const char* mailbox = luaL_checkstring(L, 2);
double timeout;
if (lua_gettop(L) >= 3) {
@@
-247,7
+247,7
@@
static int l_task_send(lua_State* L)
/* task */
sglua_task_register(L);
/* -- */
/* task */
sglua_task_register(L);
/* -- */
-
MSG
_error_t res = MSG_task_send_with_timeout(task, mailbox, timeout);
+
msg
_error_t res = MSG_task_send_with_timeout(task, mailbox, timeout);
if (res == MSG_OK) {
lua_pushboolean(L, 1);
if (res == MSG_OK) {
lua_pushboolean(L, 1);
@@
-281,7
+281,7
@@
static int l_task_send(lua_State* L)
*/
static int l_task_isend(lua_State* L)
{
*/
static int l_task_isend(lua_State* L)
{
- m_task_t task = sglua_check_task(L, 1);
+ m
sg
_task_t task = sglua_check_task(L, 1);
const char* mailbox = luaL_checkstring(L, 2);
/* task mailbox ... */
lua_settop(L, 1);
const char* mailbox = luaL_checkstring(L, 2);
/* task mailbox ... */
lua_settop(L, 1);
@@
-312,7
+312,7
@@
static int l_task_isend(lua_State* L)
*/
static int l_task_dsend(lua_State* L)
{
*/
static int l_task_dsend(lua_State* L)
{
- m_task_t task = sglua_check_task(L, 1);
+ m
sg
_task_t task = sglua_check_task(L, 1);
const char* mailbox = luaL_checkstring(L, 2);
/* task mailbox ... */
lua_settop(L, 1);
const char* mailbox = luaL_checkstring(L, 2);
/* task mailbox ... */
lua_settop(L, 1);
@@
-336,7
+336,7
@@
static int l_task_dsend(lua_State* L)
*/
static int l_task_recv(lua_State* L)
{
*/
static int l_task_recv(lua_State* L)
{
- m_task_t task = NULL;
+ m
sg
_task_t task = NULL;
const char* mailbox = luaL_checkstring(L, 1);
double timeout;
if (lua_gettop(L) >= 2) {
const char* mailbox = luaL_checkstring(L, 1);
double timeout;
if (lua_gettop(L) >= 2) {
@@
-349,7
+349,7
@@
static int l_task_recv(lua_State* L)
/* no timeout by default */
}
/* mailbox ... */
/* no timeout by default */
}
/* mailbox ... */
-
MSG
_error_t res = MSG_task_receive_with_timeout(&task, mailbox, timeout);
+
msg
_error_t res = MSG_task_receive_with_timeout(&task, mailbox, timeout);
if (res == MSG_OK) {
sglua_task_unregister(L, task);
if (res == MSG_OK) {
sglua_task_unregister(L, task);
@@
-383,7
+383,7
@@
static int l_task_irecv(lua_State* L)
{
const char* mailbox = luaL_checkstring(L, 1);
/* mailbox ... */
{
const char* mailbox = luaL_checkstring(L, 1);
/* mailbox ... */
- m
_task_t* task = xbt_new0(m
_task_t, 1); // FIXME fix this leak
+ m
sg_task_t* task = xbt_new0(msg
_task_t, 1); // FIXME fix this leak
msg_comm_t comm = MSG_task_irecv(task, mailbox);
sglua_push_comm(L, comm);
/* mailbox ... comm */
msg_comm_t comm = MSG_task_irecv(task, mailbox);
sglua_push_comm(L, comm);
/* mailbox ... comm */
@@
-414,7
+414,7
@@
static const luaL_reg task_functions[] = {
static int l_task_gc(lua_State* L)
{
/* ctask */
static int l_task_gc(lua_State* L)
{
/* ctask */
- m
_task_t task = *((m
_task_t*) luaL_checkudata(L, 1, TASK_MODULE_NAME));
+ m
sg_task_t task = *((msg
_task_t*) luaL_checkudata(L, 1, TASK_MODULE_NAME));
/* the task is NULL if I sent it to someone else */
if (task != NULL) {
MSG_task_destroy(task);
/* the task is NULL if I sent it to someone else */
if (task != NULL) {
MSG_task_destroy(task);
@@
-432,7
+432,7
@@
static int l_task_gc(lua_State* L)
*/
static int l_task_tostring(lua_State* L)
{
*/
static int l_task_tostring(lua_State* L)
{
- m
_task_t task = *((m
_task_t*) luaL_checkudata(L, 1, TASK_MODULE_NAME));
+ m
sg_task_t task = *((msg
_task_t*) luaL_checkudata(L, 1, TASK_MODULE_NAME));
lua_pushfstring(L, "Task: %p", task);
return 1;
}
lua_pushfstring(L, "Task: %p", task);
return 1;
}