Hi,
reason to fix pthread_key_create_speculative_5_1:
1: keys[5] is a static array that is far too small. It is expected to
hold the cumulative keys from each iteration of the loop, which on my
system should execute 1025 times. It crashed immediately.
2. The test is just wrong and will always fail. The only valid result
from that loop is i == NUM_OF_KEYS && rc == EAGAIN. The generic test
against rc isn't skipped when that result is found. It goes on to report
a failure if rc is anything other than 0 without respect to the value of i.
Thanks,
--
Yi Xu [email protected]
SUSE LINUX Products GmbH R&D-OPS-QA
Maxfeldstr. 5 +49 (0)911-74053 - 607
D-90409 Nuernberg http://www.suse.de
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nuernberg)
--- 5-1.c.orig 2009-02-05 15:36:51.785602000 +0100
+++ 5-1.c 2009-02-05 15:38:31.798489000 +0100
@@ -36,7 +36,6 @@
int NUM_OF_KEYS = PTHREAD_KEYS_MAX;
-static pthread_key_t keys[5];
int main()
{
@@ -44,7 +43,8 @@ int main()
for(i = 0;i<=NUM_OF_KEYS;i++)
{
- rc = pthread_key_create(&keys[i], NULL);
+ pthread_key_t key;
+ rc = pthread_key_create(&key, NULL);
if(i == NUM_OF_KEYS)
{
if(rc != EAGAIN)
@@ -54,7 +54,7 @@ int main()
}
}
- if(rc != 0)
+ else if(rc != 0)
{
if(rc != EAGAIN)
{
------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list