Культурный офтопик
 help / color / mirror / Atom feed
* [room] Убить поток С/С++
@ 2009-11-04 19:42 Rinat Bikov
  2009-11-04 21:31 ` Rinat Bikov
  0 siblings, 1 reply; 6+ messages in thread
From: Rinat Bikov @ 2009-11-04 19:42 UTC (permalink / raw)
  To: Культурный
	офтопик

Здравствуйте, уважаемые!
А вообще реально в C/C++ под линуксом убить порождённый зациклившийся поток?
В pthread есть метод pthread_cancel, однако он на зациклившихся
потоках не работает, он работает только на потоках, которые вызвали
sleep, как в примере man pthread_cancel, а pthread_kill убивает весь
процесс (что и написано в документации)...
Просто для теста я использую функцию, которая состоит из одного цикла:
for (i = 0; ; i++){
i--;
}, её ни в какую не убивает...
Так можно ли чем-то создать поток с возможностью его убить по таймауту?
В Java есть такой способ, однако нужно в C/C++...

P.S. Если честно, не знаю, куда обращаться с таким вопросом, в гугле
пока не нашёл ответа...

-- 
С уважением, Ринат Биков.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-11-05  6:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-04 19:42 [room] Убить поток С/С++ Rinat Bikov
2009-11-04 21:31 ` Rinat Bikov
2009-11-04 21:59   ` Rinat Bikov
2009-11-04 22:22     ` Rinat Bikov
2009-11-05  3:51       ` Igor V.Marenkov
2009-11-05  6:24         ` Rinat Bikov

Культурный офтопик

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/smoke-room/0 smoke-room/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 smoke-room smoke-room/ http://lore.altlinux.org/smoke-room \
		smoke-room@lists.altlinux.org smoke-room@lists.altlinux.ru smoke-room@lists.altlinux.com smoke-room@altlinux.ru smoke-room@altlinux.org smoke-room@altlinux.com
	public-inbox-index smoke-room

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.smoke-room


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git