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
We must put the location where we copy the task
[simgrid.git]
/
src
/
bindings
/
ruby
/
rb_msg_task.c
diff --git
a/src/bindings/ruby/rb_msg_task.c
b/src/bindings/ruby/rb_msg_task.c
index
3806870
..
ad934b4
100644
(file)
--- a/
src/bindings/ruby/rb_msg_task.c
+++ b/
src/bindings/ruby/rb_msg_task.c
@@
-65,11
+65,16
@@
void rb_task_send(VALUE class,VALUE task,VALUE mailbox) {
// Receiving Task (returns a Task)
VALUE rb_task_receive(VALUE class, VALUE mailbox) {
// Receiving Task (returns a Task)
VALUE rb_task_receive(VALUE class, VALUE mailbox) {
- // Task
- m_task_t task = NULL;
+ // We must put the location where we copy the task
+ // pointer to on the heap, because the stack may move
+ // during the context switches (damn ruby internals)
+ m_task_t *ptask = malloc(sizeof(m_task_t));
+ m_task_t task;
+ *ptask = NULL;
INFO2("Receiving a task on mailbox '%s', store it into %p",RSTRING(mailbox)->ptr,&task);
INFO2("Receiving a task on mailbox '%s', store it into %p",RSTRING(mailbox)->ptr,&task);
- MSG_task_receive(&task,RSTRING(mailbox)->ptr);
- INFO2("XXXXXXXXReceived a task %p %s",task,task->name);
+ MSG_task_receive(ptask,RSTRING(mailbox)->ptr);
+ task = *ptask;
+ free(ptask);
return Data_Wrap_Struct(class, 0, rb_task_free, task);
}
return Data_Wrap_Struct(class, 0, rb_task_free, task);
}