On Thu, 08 Sep 2011 08:44:17 +0800 Li SuXia <[email protected]> said:
attached is a test case... no crashes. no valgrind complaints... could you
modify this test case to show your crash? without a test case we can't fix
anything. my tests show ecore_thread is working as it should.
> Sorry for reply late, the sample is very simple.
> 1. create 1st thread by ecore_thread_run, then cancel it.
> 2. create 2nd thread by ecore_thread_feedback_run, crash happened after it
> end.
>
> And we also find another problem, here is the cases:
> 1. create 1st thread by ecore_thread_run, it keep running,
> 2. create 2nd thread by ecore_thread_run, it doesn't start at all, except the
> 1st thread end, why ?
>
> Another issues, if we create the 2nd thread, then cancel it, then repeat
> create & cancel operation, Sometimes crash after thread_cancel cb. But even
> we do nothing in cancel_cb.
>
> Hmmm~~
> -----邮件原件-----
> 发件人: Cedric BAIL [mailto:[email protected]]
> 发送时间: 2011年9月6日 16:16
> 收件人: Enlightenment developer list
> 主题: Re: [E-devel] 答复: Questions about ecore_thread_feedback_run
>
> Hi,
>
> Could you send me an example of the code that trigger the issue ? No problem
> if you send it directly to me. So I can understand what is going on.
>
> Thanks,
>
> 2011/9/6 Li SuXia <[email protected]>:
> > Hi, I tied as you said, remove the '!' in
> > ecore/src/lib/ecore/ecore_thread.c
> > at line 1099 and use EINA_TRUE for try_no_queue. The first time, the
> > thead works well, but the second time, the BS happened after thread end.
> > I try do nothing in thread and end, it also crahsed. We try
> > ecore_thread_run, no crash. Could you please help me for this? Thanks~
> >
> > -----邮件原件-----
> > 发件人: Cedric BAIL [mailto:[email protected]]
> > 发送时间: 2011年9月3日 16:54
> > 收件人: Enlightenment developer list
> > 主题: Re: [E-devel] Questions about ecore_thread_feedback_run
> >
> > Hi,
> >
> > On Sat, Sep 3, 2011 at 3:25 AM, suxia li <[email protected]> wrote:
> >> Hi there, here i have a weired problem. i create 2 threads by
> > ecore_thread_feedback_run, the try_no_queue are both set as EINA_TRUE.
> > the second one is run after the 1st one end, but the second one does
> > run? i try to change the second one by ecore_thread_run, it works.
> >> and i also try to change the try_no_queue of second one as
> >> EINA_FALSE, it
> > also run.
> >> but i don't understand the problem, who can help explain it?
> >
> > We have a bug either in the doc or in the code. I just checked and
> > try_no_queue should be set to EINA_FALSE to mean don't use the thread pool.
> > I think that the doc is right and that the behaviour you want with
> > EINA_TRUE, should be fixed accordingly. I will shortly fix it. I don't
> > know how I didn't spot it earlier. If you want to fix it locally, just
> > open ecore/src/lib/ecore/ecore_thread.c at line 1099 and remove the '!'.
> > --
> > Cedric BAIL
> >
> > ----------------------------------------------------------------------
> > ------
> > --
> > Special Offer -- Download ArcSight Logger for FREE!
> > Finally, a world-class log management solution at an even better price-free!
> > And you'll get a free "Love Thy Logs" t-shirt when you download Logger.
> > Secure your free ArcSight Logger TODAY!
> > http://p.sf.net/sfu/arcsisghtdev2dev
> > _______________________________________________
> > enlightenment-devel mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
> >
> >
> > ----------------------------------------------------------------------
> > -------- Special Offer -- Download ArcSight Logger for FREE!
> > Finally, a world-class log management solution at an even better
> > price-free! And you'll get a free "Love Thy Logs" t-shirt when you
> > download Logger. Secure your free ArcSight Logger TODAY!
> > http://p.sf.net/sfu/arcsisghtdev2dev
> > _______________________________________________
> > enlightenment-devel mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
> >
>
>
>
> --
> Cedric BAIL
>
> ------------------------------------------------------------------------------
> Special Offer -- Download ArcSight Logger for FREE!
> Finally, a world-class log management solution at an even better price-free!
> And you'll get a free "Love Thy Logs" t-shirt when you download Logger.
> Secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsisghtdev2dev
> _______________________________________________ enlightenment-devel mailing
> list [email protected]
> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
>
>
> ------------------------------------------------------------------------------
> Doing More with Less: The Next Generation Virtual Desktop
> What are the key obstacles that have prevented many mid-market businesses
> from deploying virtual desktops? How do next-generation virtual desktops
> provide companies an easier-to-deploy, easier-to-manage and more affordable
> virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/
> _______________________________________________
> enlightenment-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
--
------------- Codito, ergo sum - "I code, therefore I am" --------------
The Rasterman (Carsten Haitzler) [email protected]
/*
gcc -o thx thx.c `pkg-config --cflags --libs ecore ecore-evas evas` -lm
*/
#include <stdio.h>
#include <stdlib.h>
#include <dirent.h>
#include <Evas.h>
#include <Ecore.h>
#include <Ecore_Evas.h>
#include <math.h>
#include <unistd.h>
static Ecore_Thread *th = NULL;
static Ecore_Thread *th2 = NULL;
static Ecore_Evas *ee = NULL;
static Evas_Object *rect = NULL;
struct info
{
double x, y;
};
///// BEGIN - code running in my custom pthread instance
//
//
static void
th2_do(void *data, Ecore_Thread *th)
{
for (;;)
{
printf("sleep...\n");
sleep(1);
printf("...done\n");
if (ecore_thread_check(th)) break;
}
}
//
//
///// END - code running in my custom pthread instance
// BONUS (optional): called after th_do returns and has NOT been cancelled
static void th2_end(void *data, Ecore_Thread *th) { printf("thread2 ended\n"); }
// BONUS (optional): called in mainloop AFTER thread has finished cancelling
static void th2_cancel(void *data, Ecore_Thread *th) { printf("thread2 cancelled\n"); }
static void
th_do(void *data, Ecore_Thread *th)
{
double t = 0.0;
// inside our "do" function for the ecore thread, lets do the real work
for (;;)
{
struct info *inf = malloc(sizeof(struct info));
if (inf)
{
inf->x = 200 + (200 * sin(t));
inf->y = 200 + (200 * cos(t));
// now we have recorded the timepoint we pass it as feedback
// back to the mainloop. it will free it when done
ecore_thread_feedback(th, inf);
}
// and sleep and loop
usleep(1000);
t += 0.02;
// in case someone has asked us to cancel - then cacnel this loop
// co-operatively (cancelling is co-operative)
if (ecore_thread_check(th)) break;
}
}
//
//
///// END - code running in my custom pthread instance
static void // when mainloop gets feedback from worker
th_feedback(void *data, Ecore_Thread *th, void *msg)
{
struct info *inf = msg;
evas_object_move(rect, inf->x - 50, inf->y - 50);
free(inf);
}
// BONUS (optional): called after th_do returns and has NOT been cancelled
static void th_end(void *data, Ecore_Thread *th) { printf("thread ended\n"); }
// BONUS (optional): called in mainloop AFTER thread has finished cancelling
static void th_cancel(void *data, Ecore_Thread *th) { printf("thread cancelled\n"); }
// just test cancelling the thread worker
static void
down(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
ecore_thread_cancel(th);
}
static Eina_Bool
delay(void *data)
{
ecore_thread_cancel(th2);
th2 = NULL;
return EINA_FALSE;
}
int
main(int argc, char **argv)
{
Evas_Object *o;
// init efl - just ecore needed here (normally you'd init more or use elm)
ecore_init();
ecore_evas_init();
ecore_thread_max_set(1);
ee = ecore_evas_new(NULL, 0, 0, 400, 400, NULL);
ecore_evas_show(ee);
o = evas_object_rectangle_add(ecore_evas_get(ee));
evas_object_color_set(o, 255, 240, 230, 255);
evas_object_resize(o, 9999, 9999);
evas_object_show(o);
o = evas_object_rectangle_add(ecore_evas_get(ee));
evas_object_color_set(o, 50, 80, 180, 255);
evas_object_resize(o, 100, 100);
evas_object_show(o);
// new in the examples - we have a mouse down on the blue box cancel
// the thread
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, down, NULL);
rect = o;
th2 = ecore_thread_run(th2_do, th2_end, th2_cancel, NULL);
ecore_timer_add(0.2, delay, th2);
// ecore_thread_cancel(th2);
// explicitly create ecore thread to do some "work on the side" and pass in NULL as data ptr to callbacks and true at the end means to actually make a new thread and not use the thread pool (there is a thread pool with as many thread workers as there are cpu's so this means you do not overload the cpu's with more work than you actually have processing units *IF* your threads do actually spend their time doing actual heavy computation)
th = ecore_thread_feedback_run(th_do, th_feedback, th_end, th_cancel,
NULL, EINA_FALSE);
// begin mainloop
ecore_main_loop_begin();
// shutdown
ecore_evas_shutdown();
ecore_shutdown();
return 0;
}
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel