***SPAM*** Re: [ofa-general] [PATCH] libibmad: remove functions which use pthread

Ira Weiny weiny2 at llnl.gov
Tue Feb 17 20:38:58 PST 2009


On Wed, 18 Feb 2009 03:49:55 +0200
Sasha Khapyorsky <sashak at voltaire.com> wrote:

> On 17:23 Tue 17 Feb     , Ira Weiny wrote:
> > 
> > Neither interface is thread safe without the user implementing some
> > sort of locking around the calls.
> 
> Really? What about this:
> 
> int plus_three(int a)
> {
> 	return a + 3;
> }
> 
> We could extrapolate of course.
> 

I don't get it?

Having static data like:

static int mad_portid = -1;
static int class_agent[MAX_CLASS];

Makes some functions dangerous.

Then the other interface does not provide any locking...  Oh I guess you are
saying that "a" is ibmad_port thingy...  Then yes if you don't have threads
modifying it at the same time you will be ok.

Ira




More information about the general mailing list