ALT Linux Community general discussions
 help / color / mirror / Atom feed
From: Rinat Bikov <bikoz.r@gmail.com>
To: ALT Linux Community general discussions <community@lists.altlinux.org>
Subject: Re: [Comm] pthread, gcc vs g++: seg fault
Date: Thu, 5 Nov 2009 23:20:43 +0400
Message-ID: <f725ea640911051120r28aaa4dcj3e0a5a995335c7ec@mail.gmail.com> (raw)
In-Reply-To: <20091105130416.GC10512@newmaster.mivlgu.local>

5 ноября 2009 г. 17:04 пользователь Sergey Vlasov написал:
[...]
>  1) Аккуратно писать код, который нужно прерывать[...]
Это решение мне точно не подходит, так как по задумке прерываться
должен не мой код... + код на любом языке программирования,
поддерживающий создание динамических библиотек и как минимум для 2-х
платформ: Linux и Windows.

>  2) Создавать для выполнения кода, который необходимо прерывать, не
>    поток, а полноценный процесс [..]
Ммм... В таком случае будет сложнее взаимодействие: для того, чтобы
освободить модулеписателей от необходимости изучать межпроцессовое
взаимодействие, мне нужно будет написать как минимум ещё 2 модуля:
один со стороны моей программы, вызывающий процесс, другой -
вызываемый процесс, используемый для загрузки динамической
библиотеки... .oO(интересно, это решение будет портируемо под Win?..)

Спасибо большое за подробное разъяснение! Буду иметь ввиду...

P.S. А пока я написал какой-то хак для GCC, так как работает то, что
не должно работать :-). Если убрать вывод в поток ошибок из
обработчика сигнала SIGTERM, то программа, скомпилированная под GCC
также завершается с segmentation fault... :-)
P.P.S. А всё это я задумал только для того, чтобы научиться выгружать
динамические библиотеки из Java-программы :-)... Хотя, для этого есть
ещё один вариант: убивать из Java поток вместе с моей библиотекой, а в
самой библиотеке не использовать pthread... (чего хотелось было
избежать для красоты решения, однако сейчас этот способ выглядит для
меня наиболее простым и безопасным, но решение с процессами интересное
с точки зрения изучения :-)).

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

      reply	other threads:[~2009-11-05 19:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-05 13:04 ` Sergey Vlasov
2009-11-05 19:20   ` Rinat Bikov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f725ea640911051120r28aaa4dcj3e0a5a995335c7ec@mail.gmail.com \
    --to=bikoz.r@gmail.com \
    --cc=community@lists.altlinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Community general discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/community/0 community/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 community community/ http://lore.altlinux.org/community \
		mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com
	public-inbox-index community

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


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