Better HN
topnewbestaskshowjobs
Log inSign up

jrick

12 karma · joined Jul 16, 2013 (13y ago) · 5 submissions

Submissions

comment 13y ago · link · parent

We do try to deal with concurrency and goroutines as much as we can. I'd recommend taking a look at the (rather simple) goroutine example as part of the gtk package. Unfortunately though, as you said, GTK is not thread safe (calling GTK from multiple threads was deprecated as of the last release I believe) and calls must be made using glib.IdleAdd() to run the functions in GTK's main loop context.

comment 13y ago · link · parent

Actually, some of my coworkers had tried it previously and couldn't get it working either. I just didn't know they had tried it, and they didn't ask me to play around with it to try and get it in shape (this may have been before I started working full time with Conformal).

So this was just me not being aware of it, but others of us at Conformal were, and due to the above issues we decided to do our own.

comment 13y ago · link · parent

I'm actually a huge fan of Rust's memory model and wished Go had something similar, since it's faster to use smart pointers, and less calls to the garbage collector are required. I also love how rust uses three different kinds of pointers depending on how the memory is managed, and although it adds some complexity, it gives more semantic value to the data you are working with.

Unfortunately for me, the rust compiler is written in rust, so I would have to adventure to grab a Linux and try my hand at a cross compile before I can play with it on my OpenBSD box.

comment 13y ago · link · parent

I use channels all the time in actual code using gotk3. Unfortunately, it means using glib.IdleAdd() a lot (because GTK is not thread safe), but it works.

comment 13y ago · link · parent

In short, we weren't aware of the project.

I just gave it a try now, but the code will not compile on my dev box (OpenBSD, go tip). Even after making some minor fixes (I fixed an #include directive, removed a call to a deprecated function, etc.) there appear to be some serious issues (one error I got mentioned the size of an array being negative).

It appears this code has not been updated in a year, and we wished to target a recent GTK version (3.8, to be precise) with our bindings. Had we known about the project, we probably would have considered submitted patches to fix its issue and bring it up to date with newer dependencies, but even then, I feel that it would be almost as much or perhaps even more to fix and verify an unfamiliar and broken code base than rolling our own.

But I'm glad to see this project seems to be doing memory management in a Go-like manner.