Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: segmentation fault while using thread and gtk2

by SuicideJunkie (Vicar)
on Jan 07, 2015 at 16:05 UTC ( [id://1112504]=note: print w/replies, xml ) Need Help??


in reply to segmentation fault while using thread and gtk2

What is it you're trying to do there?

Bad things tend to happen if you try to mix threads and Tk.

A much safer way to go about it is to start your threads up front and keep them isolated from each other. Have one thread which does all of the GUI & Tk stuff. Have another thread (or thread pool) for doing background processing. Only the single GUI thread should ever touch the Tk elements, and the processing threads should pass their results to the GUI thread (eg: via shared memory) and let it draw the results.

Don't spawn new threads from the GUI thread, and definitely don't do it after you have started creating Tk elements unless you like coding in the Twilight Zone.

PS: The word you're looking for is segmentation, not sigmentation. Searches won't work very well that way.

  • Comment on Re: segmentation fault while using thread and gtk2

Replies are listed 'Best First'.
Re^2: segmentation fault while using thread and gtk2
by Muskovitz (Scribe) on Jan 07, 2015 at 16:14 UTC
    do you mean that i must execute a thread before those Gtk2 codes but what i am trying to do is when that button clicked a thread will start and execute!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1112504]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2024-04-24 21:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found