On Thu, January 14, 2010 21:22, JM wrote:
> Looks like closures and threads are incompatible right now.
I came across exactly the same issue when trying to pass a parameter
to a thread. The problem is to maintain a reference to the closure
which can be released when the closure is no longer neede
Am Freitag, den 15.01.2010, 12:16 +0100 schrieb Jan Hudec:
> Of course. You can't just add 'owned' to a delegate parameter and think
> things will work -- it changes the corresponding C signature by adding
> the destroy notify callback.
>
Hello Jan
I didn't realize the incompatibility in the begi
On Thu, January 14, 2010 01:12, JM wrote:
> Hi Ĺukas
> Thanks for your reply! This somehow does not work as soon as I add
> another thread.
>
> class HHH : Object {
> private ThreadFunc f;
> public void run() {
> string test = "test";
> try {
>
On Thu, January 14, 2010 21:22, JM wrote:
> Hi all
> Looks like closures and threads are incompatible right now.
> This is the ccode generated from vala.
Of course. You can't just add 'owned' to a delegate parameter and think
things will work -- it changes the corresponding C signature by adding
Hi all
Looks like closures and threads are incompatible right now.
This is the ccode generated from vala.
VALA:
Thread.create( ()=> { Thread.usleep(1000); print("in thread : %s \n",
test); }, false);
CCODE:
g_thread_create (__lambda0__gthread_func, _data1_, FALSE,
&_inner_error_);
CCODE (with own
Hello all
Thanks Łukasz for your reply!
That explains the behavior. But then, shouldn't a thread also own the
thread function or will that lead to other issues?
Should the vapi binding be:
public static weak Thread create (owned ThreadFunc func, bool joinable)
throws ThreadError;
instdead of:
pu
JM writes:
> If I do the same thing with an Idle, the behavior is significantly
> different, as the block data is not destroyed as soon as the run()
> function is left. Why is that?
>
> Well working example:
>
> class HHH : Object {
> public void run() {
> string test = "test"
If I do the same thing with an Idle, the behavior is significantly
different, as the block data is not destroyed as soon as the run()
function is left. Why is that?
Well working example:
class HHH : Object {
public void run() {
string test = "test";
Idle.a
The problem gets worse, as soon as I use a class variable:
class HHH : Object {
private ThreadFunc f;
public int t;
public void run() {
t = 4;
string test = "test";
try {
f = ()=> { Thread.usleep(1000);
Hi Łukas
Thanks for your reply! This somehow does not work as soon as I add
another thread.
class HHH : Object {
private ThreadFunc f;
public void run() {
string test = "test";
try {
f = ()=> { print("in thread : %s \n", test
JM writes:
> Hi all
> I just played around with closures as thread functions. I'm not sure if
> this example is supposed to work, but at least it compiles.
>
>
> class HHH : Object {
> public void run() {
> string test = "test";
> try {
> Th
Hi all
I just played around with closures as thread functions. I'm not sure if
this example is supposed to work, but at least it compiles.
class HHH : Object {
public void run() {
string test = "test";
try {
Thread.create( ()=> { pr
12 matches
Mail list logo