Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.programming.threads > #677
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news.glorb.com!dotsrc.org!filter.dotsrc.org!news.dotsrc.org!not-for-mail |
|---|---|
| Message-ID | <4EC9C581.405E@2ndquadrant.com> (permalink) |
| Date | Mon, 21 Nov 2011 03:29:05 +0000 |
| From | Johann 'Myrkraverk' Oskarsson <johann@2ndquadrant.com> |
| Organization | 2ndQuadrant Ltd. |
| X-Mailer | Mozilla 3.04Gold (X11; I; SunOS 5.11 i86pc) |
| MIME-Version | 1.0 |
| Newsgroups | comp.programming.threads |
| Subject | Is pthread_create( id, 0, f, &something_on_my_stack ); safe? |
| Content-Type | text/plain; charset=us-ascii |
| Content-Transfer-Encoding | 7bit |
| Lines | 33 |
| NNTP-Posting-Host | 157.157.209.138 |
| X-Trace | news.sunsite.dk DXC=IHj:ADQ?OLV0Sc_VCmP]hZYSB=nbEKnk[Nh09X@4FY\RV5j\<TfG75S:oZ4CGDm2@SeIE@ENl9YRRI``Bg6EXj7V_fc\PcFJ:e^KY6:KA_C^i] |
| X-Complaints-To | staff@sunsite.dk |
| Xref | x330-a1.tempe.blueboxinc.net comp.programming.threads:677 |
Show key headers only | View raw
Hi all,
Given
void *f( void *j )
{
int i = *((int *)j);
//..
}
void g( void )
{
pthread_t *id = ...;
int something_on_my_stack = 42; // Life, universe & everything
pthread_create( id, 0, f, &something_on_my_stack );
is there any guarantee the value has been copied to f()s stack by the
time pthread_create() returns?
Or, to be a little bit more explicit, is there anything I can use for
safe argument passing to newly created threads without allocating new
memory and (presumably) have the threads free it?
My current design calls for two integers passed to the newly created
threads. I want something both safe and clean. That is, minimum of
code clutter.
--
Johann Oskarsson http://www.2ndquadrant.com/ |[]
PostgreSQL Development, 24x7 Support, Training and Services --+--
|
Blog: http://my.opera.com/myrkraverk/blog/
Back to comp.programming.threads | Previous | Next — Next in thread | Find similar | Unroll thread
Is pthread_create( id, 0, f, &something_on_my_stack ); safe? Johann 'Myrkraverk' Oskarsson <johann@2ndquadrant.com> - 2011-11-21 03:29 +0000
Re: Is pthread_create( id, 0, f, &something_on_my_stack ); safe? Ian Collins <ian-news@hotmail.com> - 2011-11-21 20:00 +1300
Re: Is pthread_create( id, 0, f, &something_on_my_stack ); safe? Marcel Müller <news.5.maazl@spamgourmet.com> - 2011-11-21 08:48 +0100
Re: Is pthread_create( id, 0, f, &something_on_my_stack ); safe? Johann 'Myrkraverk' Oskarsson <johann@2ndquadrant.com> - 2011-11-21 07:56 +0000
Re: Is pthread_create( id, 0, f, &something_on_my_stack ); safe? Ian Collins <ian-news@hotmail.com> - 2011-11-21 21:01 +1300
Re: Is pthread_create( id, 0, f, &something_on_my_stack ); safe? David Schwartz <davids@webmaster.com> - 2011-11-21 12:06 -0800
Re: Is pthread_create( id, 0, f, &something_on_my_stack ); safe? Johann 'Myrkraverk' Oskarsson <johann@2ndquadrant.com> - 2011-11-21 20:30 +0000
Re: Is pthread_create( id, 0, f, &something_on_my_stack ); safe? Casper H.S. Dik <Casper.Dik@OrSPaMcle.COM> - 2011-11-21 23:07 +0000
Re: Is pthread_create( id, 0, f, &something_on_my_stack ); safe? Johann 'Myrkraverk' Oskarsson <johann@2ndquadrant.com> - 2011-11-22 05:31 +0000
Re: Is pthread_create( id, 0, f, &something_on_my_stack ); safe? blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-11-25 17:49 +0000
Re: Is pthread_create( id, 0, f, &something_on_my_stack ); safe? David Schwartz <davids@webmaster.com> - 2011-11-23 12:53 -0800
Re: Is pthread_create( id, 0, f, &something_on_my_stack ); safe? Robert Wessel <robertwessel2@yahoo.com> - 2011-11-21 02:28 -0600
Re: Is pthread_create( id, 0, f, &something_on_my_stack ); safe? "Ersek, Laszlo" <lacos@caesar.elte.hu> - 2011-11-22 21:06 +0100
csiph-web