From: David Pirotte <david@altosw.be>
To: Chris Vine <chris@cvine.freeserve.co.uk>
Cc: guile-user@gnu.org
Subject: Re: Potluck - thread safe event loop with await semantics
Date: Tue, 23 Feb 2016 03:25:52 -0300 [thread overview]
Message-ID: <20160223032552.620074ed@capac> (raw)
In-Reply-To: <20160223003121.4ae217f1@dell.homenet>
[-- Attachment #1: Type: text/plain, Size: 2968 bytes --]
Hi Chris,
> When I tested guile-gnome a few years ago I could reliably get
> g-idle-add to crash when calling it from a worker thread. If that is
> no longer the case I am pleased to hear it. However, the little test
> program at the end[1], which prints to the screen every 1/10th of a
> second, will also segfault for me
Ah. no, it segfaults here too, but as you know, this example makes a new <gclosure>
and a new (g-idle-source-new), sets and attach the source ... every call: I guess
the problem is none are freed/released, or at least not 'properly' ? I don't
know. Would an 'exact same' C program using pthread work fine? Probably, but it
would be nice to confirm. In anycase, I will need Andy's help to debug and patch
this. Did you talked to him back then?
Note that this works fine [1]. I understand it is not 'the same thing' but just
wanted to test this and it does not fail, to be confirmed but I did leave it run for
a while. So, I don't think it is because Guile-gnome 'turns glib thread unsafe',
but because something is missing in our implementation [ that make these
gobject closures and sources properly freed? ].
> As it happens, I am familiar with GTK+/glib thread safety. I have
> written a library which depends on it. g_idle_add(), and the other
> glib main loop functions, are and always have been completely thread
> safe.
Ok, I see: I thought you wanted/ment to use threads to interact with gdk/gtk, I
missunderstood, sorry, and I see you know more then I here, good!
> As it happens, g-thread-init isn't wrapped, but there is no need
> to call g_thread_init() anyway since glib >= 2.32.
> ...
Ok
> On a separate matter, can you fix g-io-add-watch if that has not yet
> happened? If you try to call it, compilation errors with:
>
> ERROR: In procedure module-lookup: Unbound variable: <gio-channel>
I don't know much [almost nothing] about that part, but it fails here too. I'll see
what I can do but don't hold your breath, <gio-channel> and friends use special
wrappers, so the help of Andy would be precious here too ...
I wish you'd know more about our implementation and be more efficient as well :)
> It is off topic, but what guile-gnome really needs is a wrapper for
> gobject-introspection.
No doubt: there is sbank [2], but I could not find the time to even look at it so
far... There was also guile-gir [it was on gitorious, I have a local copy, 6y old]
Cheers,
David
[1]
#! /bin/sh
# -*- mode: scheme; coding: utf-8 -*-
exec guile -e main -s "$0" "$@"
!#
(use-modules (gnome-2)
(gnome glib))
(define (main args)
(let ((loop (g-main-loop-new #f #f)))
(call-with-new-thread
(lambda ()
(g-timeout-add 100
(lambda ()
(display "running ")
#t)))) ;; yes, keep the timeout
(display "Starting main loop\n")
(g-main-loop-run loop)))
[2]
http://rotty.xx.vu/software/sbank/
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
next prev parent reply other threads:[~2016-02-23 6:25 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-16 21:45 Potluck - thread safe event loop with await semantics Chris Vine
2016-02-22 12:01 ` Ludovic Courtès
2016-02-22 16:36 ` Marko Rauhamaa
2016-02-22 17:40 ` Chris Vine
2016-02-22 17:53 ` Thompson, David
2016-02-22 18:12 ` Chris Vine
2016-02-22 19:54 ` Christopher Allan Webber
2016-02-22 20:28 ` David Pirotte
2016-02-23 0:31 ` Chris Vine
2016-02-23 1:30 ` Chris Vine
2016-02-23 19:55 ` David Pirotte
2016-02-23 6:25 ` David Pirotte [this message]
2016-02-23 12:09 ` Chris Vine
2016-02-23 16:49 ` Chris Vine
2016-02-25 23:22 ` David Pirotte
2016-02-23 4:58 ` Chris Vine
2016-03-01 20:39 ` Amirouche Boubekki
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
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160223032552.620074ed@capac \
--to=david@altosw.be \
--cc=chris@cvine.freeserve.co.uk \
--cc=guile-user@gnu.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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).