FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian GCC

 
 
LinkBack Thread Tools
 
Old 04-05-2010, 04:06 AM
Miles Bader
 
Default Bug#576485: Acknowledgement (libstdc++: std::thread completely broken)

BTW, one thing I noticed is that the "error code" field in the
std::system_error exception which is raised, seems to be set to EPERM
("Operation not permitted"), but this code is not apparently caused by a
system call (determined by stracing the process).

For instance, changing the test case to this:

#include <cerrno>
#include <iostream>
#include <thread>

int g = 0;

void f ()
{
g++;
}

int main ()
{
std::cerr << "before thread creation..." << std::endl;
try {
errno = 0;
std::thread t (f);
std::cerr << "after thread creation..." << std::endl;
t.join ();
} catch (const std::system_error &e) {
std::cerr << "caught std::system_error, what = ""
<< e.what ()
<< "", code = " << e.code().message ()
<< std::endl;
}
std::cout << "after joing, g = " << g << std::endl;
return 0;
}

Results in this:

$ g++-4.5 -std=c++0x -o t t.cc
$ ./t
before thread creation...
caught std::system_error, what = "", code = Operation not permitted
after joing, g = 0

strace shows this:

$ strace ./t 2>&1 | tail -20
mprotect(0x7f2036a9c000, 16384, PROT_READ) = 0
mprotect(0x7f2036f3c000, 4096, PROT_READ) = 0
mprotect(0x7f2037229000, 32768, PROT_READ) = 0
mprotect(0x7f2037464000, 4096, PROT_READ) = 0
munmap(0x7f203744b000, 90011) = 0
write(2, "before thread creation...", 25before thread creation...) = 25
write(2, "
", 1
) = 1
brk(0) = 0x18b2000
brk(0x18d3000) = 0x18d3000
write(2, "caught std::system_error, what ="..., 34caught std::system_error, what = ") = 34
write(2, "", code = ", 10", code = ) = 10
write(2, "Operation not permitted", 23Operation not permitted) = 23
write(2, "
", 1
) = 1
fstat(1, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2037460000
write(1, "after joing, g = 0
", 19after joing, g = 0
) = 19
exit_group(0) = ?


Thanks,

-Miles

--
Cabbage, n. A familiar kitchen-garden vegetable about as large and wise as a
man's head.



--
To UNSUBSCRIBE, email to debian-gcc-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: buozl1i7dc0.fsf@dhlpc061.dev.necel.com">http://lists.debian.org/buozl1i7dc0.fsf@dhlpc061.dev.necel.com
 

Thread Tools




All times are GMT. The time now is 09:36 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org