Saturday, March 28, 2009

comp.programming.threads - 11 new messages in 7 topics - digest

comp.programming.threads
http://groups.google.com/group/comp.programming.threads?hl=en

comp.programming.threads@googlegroups.com

Today's topics:

* Hopscotch Hashing - new version - 1 messages, 1 author
http://groups.google.com/group/comp.programming.threads/t/cb69d4304c75f463?hl=en
* Bluetooth Sunglasses - 1 messages, 1 author
http://groups.google.com/group/comp.programming.threads/t/0072f598f7f227e8?hl=en
* Knitted Belt Brand Belt V Belts - 1 messages, 1 author
http://groups.google.com/group/comp.programming.threads/t/b1afb052ef80d954?hl=en
* Air Jordans 16 (paypal payment)( www.sneaker-shop08 - 1 messages, 1 author
http://groups.google.com/group/comp.programming.threads/t/e881baef7d0e10d5?hl=en
* invalid conversion from 'void* (*)()' to 'void* (*)(void*)' when using
pthread in C++ - 5 messages, 4 authors
http://groups.google.com/group/comp.programming.threads/t/8fddb216a36daa87?hl=en
* www.stefsclothes.com Wholesale Nike AirMax,nike shox,Air Jordan,air force
one,dunk Free Shipping Paypal payment - 1 messages, 1 author
http://groups.google.com/group/comp.programming.threads/t/96f000ef72a432c7?hl=en
* Hogan shoes (paypal payment)( www.niketrade08.cn ) - 1 messages, 1 author
http://groups.google.com/group/comp.programming.threads/t/d3f275105e08f72d?hl=en

==============================================================================
TOPIC: Hopscotch Hashing - new version
http://groups.google.com/group/comp.programming.threads/t/cb69d4304c75f463?hl=en
==============================================================================

== 1 of 1 ==
Date: Thurs, Mar 26 2009 3:12 am
From: Dmitriy Vyukov


On Mar 25, 5:55 pm, "Chris M. Thomasson" <n...@spam.invalid> wrote:

> Right. Also, even on SPARC TSO, some loads in the critical-section can be
> hoisted up above the CAS in the lock function of TTASLock. AFAICT, the CAS
> (e.g., CASIO) is naked in their implementation. IIRC, #StoreLoad is the only
> membar that is not a NOP on TSO SPARC. For instance, you need it for
> Petersons Algorihtm, even if you use atomic RMW. This differs from Intel
> where a LOCK instruction acts like a #StoreLoad for WB memory.

Here is one moment I don't quite understand.
CAS includes both load and store. Let's assume that there is no
#StoreLoad after CAS, only #LoadLoad | #LoadStore (i.e. load-acquire).
Here is pseudo code for mutex unlock followed by mutex lock:

// some code from previous critical section:
tmp = data;
data = tmp + 1;
// mutex unlock:
membar #StoreStore | #LoadStore;
lock = UNLOCKED;

// mutex lock (unrolled CAS):
tmp = lock;
if (tmp != UNLOCKED) goto retry;
lock = LOCKED;
membar #LoadLoad | #LoadStore;
// critical section:
tmp = data;
data = tmp + 1;

At maximum this can be reordered as:

// mutex lock (unrolled CAS):
tmp = lock;
if (tmp != UNLOCKED) goto retry;
membar #LoadLoad | #LoadStore;
// critical section:
tmp = data;
data = tmp + 1;
lock = LOCKED;

The question is: can this reordering lead to some problem?

Code from previous critical section and from current critical section
can not be interleaved (as I understand), because load that yield
UNLOCKED can not hoist above store of UNLOCKED.

Consider following simplified "one-shot" mutex:

initially lock = LOCKED

thread 1:
tmp = data;
data = tmp + 1;
membar #StoreStore | #LoadStore;
lock = UNLOCKED;

thread 2:
if (lock == UNLOCKED)
{
membar #LoadLoad | #LoadStore;
tmp = data;
data = tmp + 1;
}

Here #LoadLoad | #LoadStore is enough in thread 2, because there is
just no stores to lock in thread 2. So why #LoadLoad | #LoadStore is
not enough in general mutex lock() implementation?

--
Dmitriy V'jukov

==============================================================================
TOPIC: Bluetooth Sunglasses
http://groups.google.com/group/comp.programming.threads/t/0072f598f7f227e8?hl=en
==============================================================================

== 1 of 1 ==
Date: Fri, Mar 27 2009 4:01 am
From: fthytjuk@163.com

Branded Sunglasses (paypal payment)( www.sneaker-shop08.com )
Bluetooth Sunglasses (paypal payment)( www.sneaker-shop08.com )
New Sunglasses (paypal payment)( www.sneaker-shop08.com )
Fashion Acetate Sunglasses (paypal payment)( www.sneaker-shop08.com
)
Stainless Steel Sunglass Sports Sunglasses (paypal payment)
( www.sneaker-shop08.com ) Cool Sunglasses (paypal payment)
( www.sneaker-shop08.com )
Acetate Sunglass Men's Sunglasses (paypal payment)( www.sneaker-shop08.com
) Sunglass Retailer Lady's Sunglass Copper Sunglass

==============================================================================
TOPIC: Knitted Belt Brand Belt V Belts
http://groups.google.com/group/comp.programming.threads/t/b1afb052ef80d954?hl=en
==============================================================================

== 1 of 1 ==
Date: Fri, Mar 27 2009 4:03 am
From: fthytjuk@163.com


Fashionable Belts (paypal payment)( www.sneaker-shop08.com )
Ladies' Belt Leather Belts (paypal payment)( www.sneaker-shop08.com
)
PU Belt Men's Belts (paypal payment)( www.sneaker-shop08.com )
Genuine Leather Belts (paypal payment)( www.sneaker-shop08.com )
Waist Belts (paypal payment)( www.sneaker-shop08.com )
Women's Belts (paypal payment)( www.sneaker-shop08.com )
Ladies' Fashion Belt Canvas Belts (paypal payment)( www.sneaker-shop08.com
) Lady Belts (paypal payment)( www.sneaker-shop08.com )
Conveyors Belting Cotton Belt Costume Belt Fabric Belts (paypal
payment)( www.sneaker-shop08.com ) Knitted Belt Brand Belt V Belts
(paypal payment)( www.sneaker-shop08.com )
Belts (paypal payment)( www.sneaker-shop08.com ) Buckles Woven Belts
(paypal payment)( www.sneaker-shop08.com )

Fashionable Belts (paypal payment)( www.sneaker-shop08.com )
Ladies' Belt Leather Belts (paypal payment)( www.sneaker-shop08.com
)
PU Belt Men's Belts (paypal payment)( www.sneaker-shop08.com )
Genuine Leather Belts (paypal payment)( www.sneaker-shop08.com )
Waist Belts (paypal payment)( www.sneaker-shop08.com )
Women's Belts (paypal payment)( www.sneaker-shop08.com )
Ladies' Fashion Belt Canvas Belts (paypal payment)( www.sneaker-shop08.com
) Lady Belts (paypal payment)( www.sneaker-shop08.com )
Conveyors Belting Cotton Belt Costume Belt Fabric Belts (paypal
payment)( www.sneaker-shop08.com ) Knitted Belt Brand Belt V Belts
(paypal payment)( www.sneaker-shop08.com )
Belts (paypal payment)( www.sneaker-shop08.com ) Buckles Woven Belts
(paypal payment)( www.sneaker-shop08.com )

==============================================================================
TOPIC: Air Jordans 16 (paypal payment)( www.sneaker-shop08
http://groups.google.com/group/comp.programming.threads/t/e881baef7d0e10d5?hl=en
==============================================================================

== 1 of 1 ==
Date: Fri, Mar 27 2009 4:04 am
From: fthytjuk@163.com


Air Jordans 1 shoes
Air Jordans 2 shoes (paypal payment)( www.sneaker-shop08.com )
Air Jordans 3 shoes
Air Jordans 3.5 shoes
Air Jordans 4 shoes (paypal payment)( www.sneaker-shop08.com )
Air Jordans 5 shoes
Air Jordans 6 shoes (paypal payment)( www.sneaker-shop08.com )
Air Jordans 7 shoes
Air Jordans 8 shoes (paypal payment)( www.sneaker-shop08.com )
Air Jordans 9 shoes
Air Jordans 10
Air Jordans 11 shoes (paypal payment)( www.sneaker-shop08.com )
Air Jordans 12 shoes
Air Jordans 13 shoes
Air Jordans 14 shoes (paypal payment)( www.sneaker-shop08.com )
Air Jordans 15 shoes
Air Jordans 16 (paypal payment)( www.sneaker-shop08.com )
Air Jordans 17 shoes (paypal payment)( www.sneaker-shop08.com )
Air Jordans 18 shoes
Air Jordans 19 shoes (paypal payment)( www.sneaker-shop08.com )
Air Jordans 21 shoes
Air Jordans 23 shoes (paypal payment)( www.sneaker-shop08.com )
Air Jordans DMP shoes (paypal payment)( www.sneaker-shop08.com )
Air Jordans 15.5 shoes
Air Jordans 19.5 shoes
Air Jordans 9 & Air Jordans 23 shoes (paypal payment)( www.sneaker-shop08.com
)
Air Jordans 13 & Air Jordans 11 shoes
Air Jordans 13 & Air Jordans 23 shoes
Air Jordans 1 & Air Jordans 6 shoes (paypal payment)( www.sneaker-shop08.com
)
Air Jordans 21 & Air Jordans 23 shoes (paypal payment)( www.sneaker-shop08.com
)
Air Jordans 18 & Air Jordans 23 shoes
Air Jordans 24 shoes (paypal payment)( www.sneaker-shop08.com )
Air Jordans 1.5 shoes

==============================================================================
TOPIC: invalid conversion from 'void* (*)()' to 'void* (*)(void*)' when using
pthread in C++
http://groups.google.com/group/comp.programming.threads/t/8fddb216a36daa87?hl=en
==============================================================================

== 1 of 5 ==
Date: Fri, Mar 27 2009 9:19 am
From: Tim


Hi,
I am using pthread in my main.cpp file and got error in the following
code. Thank you very much for your help!

#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>

pthread_mutex_t count_mutex = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t condition_mutex = PTHREAD_MUTEX_INITIALIZER;
pthread_cond_t condition_cond = PTHREAD_COND_INITIALIZER;

void *functionCount1();
void *functionCount2();
int count = 0;
#define COUNT_DONE 10
#define COUNT_HALT1 3
#define COUNT_HALT2 6

int main()
{
pthread_t thread1, thread2;

pthread_create( &thread1, NULL, &functionCount1, NULL);
pthread_create( &thread2, NULL, &functionCount2, NULL);
pthread_join( thread1, NULL);
pthread_join( thread2, NULL);

return 0;
}

void *functionCount1()
{
for(;;)
{
pthread_mutex_lock( &condition_mutex );
while( count >= COUNT_HALT1 && count <= COUNT_HALT2 )
{
pthread_cond_wait( &condition_cond, &condition_mutex );
}
pthread_mutex_unlock( &condition_mutex );

pthread_mutex_lock( &count_mutex );
count++;
printf("Counter value functionCount1: %d\n",count);
pthread_mutex_unlock( &count_mutex );

if(count >= COUNT_DONE) return(NULL);
}
}

void *functionCount2()
{
for(;;)
{
pthread_mutex_lock( &condition_mutex );
if( count < COUNT_HALT1 || count > COUNT_HALT2 )
{
pthread_cond_signal( &condition_cond );
}
pthread_mutex_unlock( &condition_mutex );

pthread_mutex_lock( &count_mutex );
count++;
printf("Counter value functionCount2: %d\n",count);
pthread_mutex_unlock( &count_mutex );

if(count >= COUNT_DONE) return(NULL);
}

}

g++ gives error:

/home/C/test/main.cpp|96|error: invalid conversion from 'void* (*)()'
to 'void* (*)(void*)'|
/home/C/test/main.cpp|96|error: initializing argument 3 of 'int
pthread_create(pthread_t*, const pthread_attr_t*, void* (*)(void*),
void*)'|
/home/C/test/main.cpp|97|error: invalid conversion from 'void* (*)()'
to 'void* (*)(void*)'|
/home/C/test/main.cpp|97|error: initializing argument 3 of 'int
pthread_create(pthread_t*, const pthread_attr_t*, void* (*)(void*),
void*)'|

== 2 of 5 ==
Date: Fri, Mar 27 2009 11:22 am
From: Torsten Robitzki


Hi Tim,

Tim schrieb:
> g++ gives error:
>
> /home/C/test/main.cpp|96|error: invalid conversion from 'void* (*)()'
> to 'void* (*)(void*)'|
> /home/C/test/main.cpp|96|error: initializing argument 3 of 'int
> pthread_create(pthread_t*, const pthread_attr_t*, void* (*)(void*),
> void*)'|
> /home/C/test/main.cpp|97|error: invalid conversion from 'void* (*)()'
> to 'void* (*)(void*)'|
> /home/C/test/main.cpp|97|error: initializing argument 3 of 'int
> pthread_create(pthread_t*, const pthread_attr_t*, void* (*)(void*),
> void*)'|
>

change
> void *functionCount1();
> void *functionCount2();

to

void *functionCount1(void*);
void *functionCount2(void*);

best regards
Torsten

--
kostenlose Wirtschaftssimulation: http://www.financial-rumors.de


== 3 of 5 ==
Date: Fri, Mar 27 2009 11:57 am
From: Steve Watt


In article <511bdaf3-eb07-44c4-8e01-eac2bf668bcc@r28g2000vbp.googlegroups.com>,
Tim <timlee126@yahoo.com> wrote:
>Hi,
>I am using pthread in my main.cpp file and got error in the following
>code. Thank you very much for your help!

[ ... ]

>void *functionCount1();
>void *functionCount2();

These prototypes don't agree with

> pthread_create( &thread1, NULL, &functionCount1, NULL);
> pthread_create( &thread2, NULL, &functionCount2, NULL);

the argument type that is expected to pthread_create().

The pthread_* functions are C language. The C++ prototype for
a thread function is

extern "C" void *thread_function(void *);

Enjoy,
--
Steve Watt KD6GGD PP-ASEL-IA ICBM: 121W 56' 57.5" / 37N 20' 15.3"
Internet: steve @ Watt.COM Whois: SW32-ARIN
Free time? There's no such thing. It just comes in varying prices...


== 4 of 5 ==
Date: Fri, Mar 27 2009 3:10 pm
From: Tim


Thanks Torsten and Steve. You solved my problem!


== 5 of 5 ==
Date: Fri, Mar 27 2009 3:50 pm
From: David Schwartz


On Mar 27, 9:19 am, Tim <timlee...@yahoo.com> wrote:

Others have pointed out the mistake that caused you to post. However,
you have a very serious misunderstanding about how to use condition
variables:

> void *functionCount1()
> {
>    for(;;)
>    {
>       pthread_mutex_lock( &condition_mutex );
>       while( count >= COUNT_HALT1 && count <= COUNT_HALT2 )
>       {
>          pthread_cond_wait( &condition_cond, &condition_mutex );
>       }

The point of the 'while' loop is to keep looping until you know the
condition is true. You check it again when 'pthread_cond_wait' returns
because just because it was true in the past doesn't mean it's true in
the future.

The whole point of this code is to make absolutely sure that the
following code does not execute unless the condition is true.

>       pthread_mutex_unlock( &condition_mutex );

Whoops! You just unlocked the mutex. Now the condition may no longer
be true. This completely defeats the point of the 'while' loop as the
code below here may run whether or not the condition is true.

>       pthread_mutex_lock( &count_mutex );
>       count++;
>       printf("Counter value functionCount1: %d\n",count);
>       pthread_mutex_unlock( &count_mutex );
>
>       if(count >= COUNT_DONE) return(NULL);
>     }
> }

Why do you have two mutexes, both protecting the count?

And now you can see your 'while' loop is busted too:

> void *functionCount2()
> {
>     for(;;)
>     {
>        pthread_mutex_lock( &condition_mutex );
>        if( count < COUNT_HALT1 || count > COUNT_HALT2 )
>        {
>           pthread_cond_signal( &condition_cond );
>        }
>        pthread_mutex_unlock( &condition_mutex );
>
>        pthread_mutex_lock( &count_mutex );
>        count++;

Here, you modify 'count' without holding the condition_mutex. But the
other thread *reads* 'count' holding only the condition mutex. Boom.

One thread may not modify a variable while another thread is or may be
reading it. This thread may modify 'count' while the first thread is
reading it in the 'while' loop.

>        printf("Counter value functionCount2: %d\n",count);
>        pthread_mutex_unlock( &count_mutex );
>
>        if(count >= COUNT_DONE) return(NULL);
>     }
>
> }

You must use the same mutex to protect the predicate as you acquire/
release with the condition variable. Otherwise, the code makes no
sense.

DS

==============================================================================
TOPIC: www.stefsclothes.com Wholesale Nike AirMax,nike shox,Air Jordan,air
force one,dunk Free Shipping Paypal payment
http://groups.google.com/group/comp.programming.threads/t/96f000ef72a432c7?hl=en
==============================================================================

== 1 of 1 ==
Date: Fri, Mar 27 2009 12:10 pm
From: "kdsajfjisdhf@gmail.com"


discount Air max 95 shoeswww.stefsclothes.com
wholesale Air Max 87 shoes
discount Air MAX LTD shoes
sell Air max 90 shoes
discount Air Max 88 shoeswww.stefsclothes.com
discount Air MAX 89 shoes
discount Air max tn shoes
discount Air Max tn8 shoes
discount Air MAX tn9 shoeswww.stefsclothes.com
discount MEN'S WOMEN'S Shox R5 R4 trainers
discount Men's women's shocks OZ NZ TL trainers
For more products pls visit:www.stefsclothes.com
discount Air max 95 shoeswww.stefsclothes.com
wholesale Air Max 87 shoes
discount Air MAX LTD shoes
sell Air max 90 shoes
discount Air Max 88 shoeswww.stefsclothes.com
discount Air MAX 89 shoes
discount Air max tn shoes
discount Air Max tn8 shoes
discount Air MAX tn9 shoeswww.stefsclothes.com
discount MEN'S WOMEN'S Shox R5 R4 trainers
discount Men's women's shocks OZ NZ TL trainers
For more products pls visit:www.stefsclothes.com
discount Air max 95 shoeswww.stefsclothes.com
wholesale Air Max 87 shoes
discount Air MAX LTD shoes
sell Air max 90 shoes
discount Air Max 88 shoeswww.stefsclothes.com
discount Air MAX 89 shoes
discount Air max tn shoes
discount Air Max tn8 shoes
discount Air MAX tn9 shoeswww.stefsclothes.com
discount MEN'S WOMEN'S Shox R5 R4 trainers
discount Men's women's shocks OZ NZ TL trainers
For more products pls visit:www.stefsclothes.com
discount Air max 95 shoeswww.stefsclothes.com
wholesale Air Max 87 shoes
discount Air MAX LTD shoes
sell Air max 90 shoes
discount Air Max 88 shoeswww.stefsclothes.com
discount Air MAX 89 shoes
discount Air max tn shoes
discount Air Max tn8 shoes
discount Air MAX tn9 shoeswww.stefsclothes.com
discount MEN'S WOMEN'S Shox R5 R4 trainers
discount Men's women's shocks OZ NZ TL trainers
For more products pls visit:www.stefsclothes.com

==============================================================================
TOPIC: Hogan shoes (paypal payment)( www.niketrade08.cn )
http://groups.google.com/group/comp.programming.threads/t/d3f275105e08f72d?hl=en
==============================================================================

== 1 of 1 ==
Date: Fri, Mar 27 2009 8:34 pm
From: wholesajeans1@sina.com


Footwear (paypal payment)( www.sneaker-shop08.com )
Paul Smith shoes
Jordan shoes
Bape shoes
Chanel shoes (paypal payment)( www.sneaker-shop08.com )
D&G shoes
Dior shoes
ED hardy shoes
Evisu shoes
Fendi shoes (paypal payment)( www.sneaker-shop08.com )
Gucci shoes `
Hogan shoes (paypal payment)( www.sneaker-shop08.com )
Lv shoes
Prada shoes (paypal payment)( www.sneaker-shop08.com )
Timberland shoes
Tous shoes
Ugg shoes (paypal payment)( www.sneaker-shop08.com )
Ice cream shoes
Sebago shoes (paypal payment)( www.sneaker-shop08.com )
Lacoste shoes
Air force one shoes (paypal payment)( www.sneaker-shop08.com )
TODS shoes
AF shoes


Footwear (paypal payment)( www.niketrade08.cn )
Paul Smith shoes
Jordan shoes
Bape shoes
Chanel shoes (paypal payment)( www.niketrade08.cn )
D&G shoes
Dior shoes
ED hardy shoes
Evisu shoes
Fendi shoes (paypal payment)( www.niketrade08.cn )
Gucci shoes `
Hogan shoes (paypal payment)( www.niketrade08.cn )
Lv shoes
Prada shoes (paypal payment)( www.niketrade08.cn )
Timberland shoes
Tous shoes
Ugg shoes (paypal payment)( www.niketrade08.cn )
Ice cream shoes
Sebago shoes (paypal payment)( www.niketrade08.cn )
Lacoste shoes
Air force one shoes (paypal payment)( www.niketrade08.cn )
TODS shoes
AF shoes


Footwear (paypal payment)( www.sneaker-shop08.com )
Paul Smith shoes
Jordan shoes
Bape shoes
Chanel shoes (paypal payment)( www.sneaker-shop08.com )
D&G shoes
Dior shoes
ED hardy shoes
Evisu shoes
Fendi shoes (paypal payment)( www.sneaker-shop08.com )
Gucci shoes `
Hogan shoes (paypal payment)( www.sneaker-shop08.com )
Lv shoes
Prada shoes (paypal payment)( www.sneaker-shop08.com )
Timberland shoes
Tous shoes
Ugg shoes (paypal payment)( www.sneaker-shop08.com )
Ice cream shoes
Sebago shoes (paypal payment)( www.sneaker-shop08.com )
Lacoste shoes
Air force one shoes (paypal payment)( www.sneaker-shop08.com )
TODS shoes
AF shoes


Footwear (paypal payment)( www.niketrade08.cn )
Paul Smith shoes
Jordan shoes
Bape shoes
Chanel shoes (paypal payment)( www.niketrade08.cn )
D&G shoes
Dior shoes
ED hardy shoes
Evisu shoes
Fendi shoes (paypal payment)( www.niketrade08.cn )
Gucci shoes `
Hogan shoes (paypal payment)( www.niketrade08.cn )
Lv shoes
Prada shoes (paypal payment)( www.niketrade08.cn )
Timberland shoes
Tous shoes
Ugg shoes (paypal payment)( www.niketrade08.cn )
Ice cream shoes
Sebago shoes (paypal payment)( www.niketrade08.cn )
Lacoste shoes
Air force one shoes (paypal payment)( www.niketrade08.cn )
TODS shoes
AF shoes


==============================================================================

You received this message because you are subscribed to the Google Groups "comp.programming.threads"
group.

To post to this group, visit http://groups.google.com/group/comp.programming.threads?hl=en

To unsubscribe from this group, send email to comp.programming.threads+unsubscribe@googlegroups.com

To change the way you get mail from this group, visit:
http://groups.google.com/group/comp.programming.threads/subscribe?hl=en

To report abuse, send email explaining the problem to abuse@googlegroups.com

==============================================================================
Google Groups: http://groups.google.com/?hl=en

No comments: