* deadlock in 1.7.91 ?
@ 2006-02-20 13:33 Stanislav Ievlev
2006-02-26 9:58 ` Stanislav Ievlev
0 siblings, 1 reply; 4+ messages in thread
From: Stanislav Ievlev @ 2006-02-20 13:33 UTC (permalink / raw)
Greetings!
I've tried to made guile module with glib's main_loop.
Following example below shows some strange interpreter freeze
--
# cat test.c
#include <glib.h>
#include <libguile.h>
SCM scm_test_mainloop()
{
GMainLoop *loop= g_main_loop_new(NULL, FALSE);
g_main_loop_run(loop);
}
void scm_init_test(void)
{
scm_c_define_gsubr("test-mainloop", 0, 0, 0,(SCM(*)())scm_test_mainloop);
}
---
# gcc -fpic -shared `pkg-config glib-2.0 --cflags --libs` test.c -o
# libguile-test.so
# LD_LIBRARY_PATH=`pwd` guile
guile> (+ 1 2)
3
guile> (dynamic-call "scm_init_test" (dynamic-link "libguile-test.so"))
guile> (+ 1 2)
3
guile> (define z (begin-thread (test-mainloop)))
guile> +
#<primitive-generic +>
guile> (+ 1 2)
....
<freezing here>
--
In strace log we see:
--
....... <guile eats (+ 1 2) here> .............
23004 read(0, "\r", 1) = 1
23004 write(17, "\n", 1) = 1
23004 rt_sigprocmask(SIG_BLOCK, [INT], [RTMIN], 8) = 0
23004 ioctl(16, SNDCTL_TMR_STOP or TCSETSW, {B38400 opost isig icanon echo
...}) = 0
23004 rt_sigprocmask(SIG_SETMASK, [RTMIN], NULL, 8) = 0
23004 rt_sigaction(SIGINT, {0xb7e17d90, [], SA_RESTART}, {0xb7e17d90, [],
0}, 8) = 0
23004 rt_sigaction(SIGTERM, {SIG_DFL}, {0xb7e17d90, [], 0}, 8) = 0
23004 rt_sigaction(SIGQUIT, {SIG_DFL}, {0xb7e17d90, [], 0}, 8) = 0
23004 rt_sigaction(SIGALRM, {SIG_DFL}, {0xb7e17d90, [], 0}, 8) = 0
23004 rt_sigaction(SIGTSTP, {SIG_DFL}, {0xb7e17d90, [], 0}, 8) = 0
23004 rt_sigaction(SIGTTOU, {SIG_DFL}, {0xb7e17d90, [], 0}, 8) = 0
23004 rt_sigaction(SIGTTIN, {SIG_DFL}, {0xb7e17d90, [], 0}, 8) = 0
23004 rt_sigaction(SIGWINCH, {SIG_DFL}, {0xb7e17d90, [], SA_RESTART}, 8) =
0
23004 close(16) = 0
23004 munmap(0xb7fd1000, 4096) = 0
23004 close(17) = 0
23004 munmap(0xb7fd0000, 4096) = 0
23004 time(NULL) = 1140441331
23004 rt_sigprocmask(SIG_SETMASK, NULL, [RTMIN], 8) = 0
23004 rt_sigsuspend([] <unfinished ...>
...... <main guile thread suspends and never returns> ...
23005 poll([{fd=10, events=POLLIN}], 1, 2000) = 0
23005 getppid() = 23004
23005 poll([{fd=10, events=POLLIN}], 1, 2000) = 0
23005 getppid() = 23004
23005 poll([{fd=10, events=POLLIN}], 1, 2000) = 0
23005 getppid() = 23004
23005 poll([{fd=10, events=POLLIN}], 1, 2000) = 0
.... <etc.>
--
---
With best regards
Stanislav Ievlev.
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: deadlock in 1.7.91 ?
2006-02-20 13:33 deadlock in 1.7.91 ? Stanislav Ievlev
@ 2006-02-26 9:58 ` Stanislav Ievlev
2006-03-06 9:27 ` Stanislav Ievlev
0 siblings, 1 reply; 4+ messages in thread
From: Stanislav Ievlev @ 2006-02-26 9:58 UTC (permalink / raw)
Hi!
What about this problem?
--
Stanislav Ievlev.
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: deadlock in 1.7.91 ?
2006-02-26 9:58 ` Stanislav Ievlev
@ 2006-03-06 9:27 ` Stanislav Ievlev
2006-03-06 19:57 ` Ken Raeburn
0 siblings, 1 reply; 4+ messages in thread
From: Stanislav Ievlev @ 2006-03-06 9:27 UTC (permalink / raw)
On Sun, Feb 26, 2006 at 12:58:46PM +0300, Stanislav Ievlev wrote:
> Hi!
>
> What about this problem?
Problem was in hidden select in g_main_loop (thanks to myself)
We really need enter_guile(), leave_guile() for such cases.
with-guile/without-guile will not work.
Are you planning to fix this problem?
--
Stanislav Ievlev.
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: deadlock in 1.7.91 ?
2006-03-06 9:27 ` Stanislav Ievlev
@ 2006-03-06 19:57 ` Ken Raeburn
0 siblings, 0 replies; 4+ messages in thread
From: Ken Raeburn @ 2006-03-06 19:57 UTC (permalink / raw)
Cc: guile-devel
On Mar 6, 2006, at 4:27, Stanislav Ievlev wrote:
> On Sun, Feb 26, 2006 at 12:58:46PM +0300, Stanislav Ievlev wrote:
>> Hi!
>>
>> What about this problem?
> Problem was in hidden select in g_main_loop (thanks to myself)
>
> We really need enter_guile(), leave_guile() for such cases.
> with-guile/without-guile will not work.
>
> Are you planning to fix this problem?
But scm_leave_guile can result in garbage collection bugs in
multithreaded programs. Look in threads.c for a copy of the email
message I wrote on the problem. (There may be similar issues with
scm_enter_guile, I haven't thought as hard about it.) I doubt this
can be fixed with that API, but if you spot something I missed, I'd
be glad to hear about it.
The list archives seem to be missing some messages at the end of
February. Why will with/without-guile not work for you? In the
message dated 20 Feb in the archive, can you not call g_main_loop_run
via scm_without_guile?
Ken
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-03-06 19:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-20 13:33 deadlock in 1.7.91 ? Stanislav Ievlev
2006-02-26 9:58 ` Stanislav Ievlev
2006-03-06 9:27 ` Stanislav Ievlev
2006-03-06 19:57 ` Ken Raeburn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).