Quantcast

pthread_key_create and !-lpthreads binaries

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

pthread_key_create and !-lpthreads binaries

rwatson

Dear threading folk:

This afternoon I wrote some threaded code for Mac OS X, and then checked it
out on FreeBSD and was a bit surprised when it compiled but didn't work.
Turns out, of course, that on Mac OS X I'd omitted -lpthread and not noticed,
as the thread primitives are in libSystem.  It ran, and the reason I ran into
trouble is that, although no-op locking calls are fine, getting back "success"
from pthread_key_create() when it has actually failed is problematic.

Would it be possible to make the thread stub for pthread_key_create() return
an error, instead of succeeding (but not actually succeeding)?  Or, perhaps
better yet, I should get a link-time error for that function, even though I
shouldn't get one for lock/unlock?

Thanks,

Robert N M Watson
Computer Laboratory
University of Cambridge
_______________________________________________
[hidden email] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-threads
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: pthread_key_create and !-lpthreads binaries

Daniel Eischen-2


Sent from my iPhone

On Mar 13, 2011, at 3:33 PM, Robert Watson <[hidden email]> wrote:

>
> Dear threading folk:
>
> This afternoon I wrote some threaded code for Mac OS X, and then checked it out on FreeBSD and was a bit surprised when it compiled but didn't work. Turns out, of course, that on Mac OS X I'd omitted -lpthread and not noticed, as the thread primitives are in libSystem.  It ran, and the reason I ran into trouble is that, although no-op locking calls are fine, getting back "success" from pthread_key_create() when it has actually failed is problematic.
>
> Would it be possible to make the thread stub for pthread_key_create() return an error, instead of succeeding (but not actually succeeding)?  Or, perhaps better yet, I should get a link-time error for that function, even though I shouldn't get one for lock/unlock?
>
> Thanks,
>
> Robert N M Watson
> Computer Laboratory
> University of Cambridge
> _______________________________________________
> [hidden email] mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-threads
> To unsubscribe, send any mail to "[hidden email]"
>
_______________________________________________
[hidden email] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-threads
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: pthread_key_create and !-lpthreads binaries

Daniel Eischen
In reply to this post by rwatson
On Sun, 13 Mar 2011, Robert Watson wrote:

>
> Dear threading folk:
>
> This afternoon I wrote some threaded code for Mac OS X, and then checked it
> out on FreeBSD and was a bit surprised when it compiled but didn't work.
> Turns out, of course, that on Mac OS X I'd omitted -lpthread and not noticed,
> as the thread primitives are in libSystem.  It ran, and the reason I ran into
> trouble is that, although no-op locking calls are fine, getting back
> "success" from pthread_key_create() when it has actually failed is
> problematic.
>
> Would it be possible to make the thread stub for pthread_key_create() return
> an error, instead of succeeding (but not actually succeeding)?  Or, perhaps
> better yet, I should get a link-time error for that function, even though I
> shouldn't get one for lock/unlock?

I think returning an error in this case is probably correct.
I can look into it if no one else gets to it before me.

--
DE
_______________________________________________
[hidden email] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-threads
To unsubscribe, send any mail to "[hidden email]"
Loading...