Fork thread, Assertion failed. X11.


 
Thread Tools Search this Thread
Top Forums Programming Fork thread, Assertion failed. X11.
# 1  
Old 01-28-2011
Fork thread, Assertion failed. X11.

Hi all.
I wrote a program with the Motif Widget Toolkit. It has a
button and a scrollbar. When the user hits the button the
callback creates a new fork() thread. The new thread sleeps
for a while and then changes the position of the scrollbar.
It does this in an endless loop.

I need the fork thread because part of application must
go back to the event loop, dispatch all events and run
the callbacks.

Well, when the new thread tries to modify the scrollbar I get
Code:
main: xcb_io.c:221: poll_for_event: Assertion `(((long) (event_sequence) - (long) (dpy->request)) <= 0)' failed.

It works well if the scrollbar is modified inside the
original thread, but I get this error if I create the new
thread.

The code is posted here. C | #include <Xm/Xm.h> #include <Xm/XmAll.h> #incl - Main.c

Can anyone help? Thanks!
# 2  
Old 01-28-2011
Quote:
Originally Posted by mghis
Hi all.
I wrote a program with the Motif Widget Toolkit. It has a
button and a scrollbar. When the user hits the button the
callback creates a new fork() thread.
That's no thread. fork() creates a completely new process, with duplicates of all memory and open files therein. It doesn't even share your variables -- modify a variable in one, it won't be reflected in the other.
Quote:
The new thread sleeps for a while and then changes the position of the scrollbar. It does this in an endless loop.
Try creating an actual thread-thread. See man pthread_create.
This User Gave Thanks to Corona688 For This Post:
# 3  
Old 01-28-2011
Quote:
Originally Posted by Corona688
That's no thread. fork() creates a completely new process, with duplicates of all memory and open files therein. It doesn't even share your variables -- modify a variable in one, it won't be reflected in the other. Try creating an actual thread-thread. See man pthread_create.
Thanks so much, Corona. Now all works fine! Smilie
This User Gave Thanks to mghis For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. AIX

Fork Function Failed on 4GB ?

Hello, I am running Oracle Database and after a while I keep getting this message whenever I execute any command. I cannot execute any command even shutdown, whenever I execute any command , I get this message /usr/bin/ksh: 0403-031 The fork function failed. There is not enough memory... (7 Replies)
Discussion started by: filosophizer
7 Replies

2. UNIX for Advanced & Expert Users

[Solved] putty+x11:How do I pass X11 display rights to "su"?

I can log into a unix system with Putty. I've set the "X11 forwarding" checkbox, and I've verified that I can display an X11 window back on my laptop. What I need to be able to do is "su" to another uid after logging in and then run something which display a window back on my laptop, with the... (2 Replies)
Discussion started by: dkarr
2 Replies

3. SCO

SLD: Failed to start the PMD Connection thread. (PM_THREAD_FAILED_TO_START).

Hello, I have a client with an 18 year old SCO Openserver 5.0.5 server. They can't find their installation media. They are experiencing an error at login: *LOGIN: ERROR- Failed to initialize policy manager. (IFOR_PM_FATAL) The status from the policy manager daemon (PMD -... (10 Replies)
Discussion started by: brhunt
10 Replies

4. SCO

-sh: fork failed - too many processes in sco unix 5.0.5

Dear experts, I have done a re-installation of sco unix openserver 5.0.5 and managed to create users. The problem am facing is that of one user logging in more than 5 times. How can i overcome this problem. the system give the error below. -sh: fork failed - too many processes in sco unix... (5 Replies)
Discussion started by: njoroge
5 Replies

5. UNIX for Advanced & Expert Users

Use fork() in thread

Hi experts, I have a plan to implement following schema: multi-threaded pthreads application with exactly 3 threads. One thread calls from time to time fork(), and from the child process it executes an unix command by execv(). Is that safe design? I've heard rumors that mixing threads and... (3 Replies)
Discussion started by: Pavel.Bures
3 Replies

6. Windows & DOS: Issues & Discussions

cygwin-x/can't install xorg-x11-f100 & xorg-x11-fnts

Hello All. Really a newbie to Linux/Unix. Trying to get into Linux. Using XP PE currently. Installed cygwin and trying to intall cygwin-x. Everything else is setup nice but i can't seem to install these two packages (without whom xwin won't start) 1. xorg-x11-f100 2. xorg-x11-fnts Tried the... (1 Reply)
Discussion started by: binodbdrchand
1 Replies

7. UNIX for Advanced & Expert Users

SFTP error Assertion failed

I get this error when I try to FTP from an HP Alpha Server to a UNIX box. FATAL: BUILD13$:SSHFC_TRANSFER.C;1:1835 SshFCTransfer (function name unavailable) Assertion failed: tdata ->current_dest_file->attributes->flags & 0x00000004 the sftp /put fails just before it does the actual transfer.... (2 Replies)
Discussion started by: NoelSacay
2 Replies

8. Shell Programming and Scripting

Endless loop - Fork function failed?

I need a quick script that will serve as a sort of "real time monitor" for watching some log files. I am using Bourne shell in HP-UX 10.20. I have basically created a script that never ends, unless of course I manually terminate it. Here's the script (it's called qhistory): clear echo "REAL... (3 Replies)
Discussion started by: cdunavent
3 Replies
Login or Register to Ask a Question