It may be that an object has a refcount of 2, and is then released twice.
The current code may then destroy the object twice, because both threads
see that the refcount is now 0. The user code is legal, this is an error in
pocl.
-erik
On Fri, Jan 11, 2013 at 3:57 AM, Pekka Jääskeläinen <
[email protected]> wrote:
> On 01/11/2013 10:44 AM, Vincent Danjean wrote:
> > For such simple task, an atomic operation when available would be
> > far more efficient (new __atomic... or old __sync... operations of
> > gcc to avoid to code assembly for each processor)
>
> Sure, if the refcounting was a bottleneck we should use the
> atomic instructions, if available. But I think it will never be one in
> a realistic OpenCL app so I wouldn't worry about this.
>
> >> If your two threads release the same object "handle" more times than
> they
> >> have called the retain functions, it is a bug in your OpenCL
> application,
> >> isn't it?
> >
> > I agree.
> > If the lock is extented to include the test that release the data,
> > you will then always release the data. But the final refcount will still
> > be -1, something that indicate a bug from my point of view.
>
> Yes, we can add a min() or a saturating decrement there if this is problem.
>
> However, I fail to see the issue: when the refcount reaches 0 the
> object is freed by the clReleaseXXX(objecT). If your other thread again
> decrements the refcount (of the free'd object) and manages to decrement
> it to -1 without crashing, then your buggy OpenCL app has just made an
> invalid OpenCL object more invalid.
>
> --
> Pekka
>
>
> ------------------------------------------------------------------------------
> Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
> much more. Get web development skills now with LearnDevNow -
> 350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
> SALE $99.99 this month only -- learn more at:
> http://p.sf.net/sfu/learnmore_122812
> _______________________________________________
> pocl-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/pocl-devel
>
--
Erik Schnetter <[email protected]>
http://www.perimeterinstitute.ca/personal/eschnetter/
AIM: eschnett247, Skype: eschnett, Google Talk: [email protected]
------------------------------------------------------------------------------
Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
much more. Get web development skills now with LearnDevNow -
350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122812
_______________________________________________
pocl-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pocl-devel