10-02-2009
How to see a FIFO from all the threads?
Hello C programming fellows!!!
I'm doing a program with multiple threads in gnu/linux, ubuntu for beeing precise...
This program consist in multiple threads, as logical each thread do different things and communicate to each other using IPC.
The problem is that in "process 1" I have a FIFO, an ordinary one (using malloc), and I need the same FIFO to be poped a pushed from all the threads... I've been trying different things but nothing work...
Is this possible??? Where can I read something about this???
The other possibility is to make a FIFO for each thread and keep them updated using some invented protocol between threads, but I would prefer not doing this because I'm wasting lots of memory.
Someone have (is correct or I have to use has??) any idea???
Thanks in advance!!!
bye!
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
Hi All
L2000-44
HP-UX 11.00
I am attempting to setup a FIFO over NFS. Directing and reading from the FIFO works fine on the local machine - however when I direct to the FIFO from a server which has the directory NFS mounted it does not work. The a process to read from the FIFO on the local... (2 Replies)
Discussion started by: saabir
2 Replies
2. Programming
hello i am making a client server program
that communicates via FIFOS and i cannot get it to not hang
i also am forking exec-ing the client from the server
my logic (i will spare you the code )
in the server
i make two fifos in my server my file permissions
are 0644
i then open both... (1 Reply)
Discussion started by: runawayNinja
1 Replies
3. Programming
hi, I have a problem. I've done a lil program which gets from the server the given persons username a personal folder. I made it with a pipe calling popen with a command, but how can i make the same thing using fifo. I make the fifo with mkfifo() func. and than what. How do I tell the sertver using... (3 Replies)
Discussion started by: atticus
3 Replies
4. UNIX for Advanced & Expert Users
Hi all,
How can I get the list of all Threads and the Total count of threads under a particular process ?
Do suggest !!
Awaiting for the replies !!
Thanks
Varun:b: (2 Replies)
Discussion started by: varungupta
2 Replies
5. UNIX for Dummies Questions & Answers
Hi ,
I m beginner for Unix and i want to use FIFO in my 2 Scripts . I want 1 script to read data from FIFO and other will write into FIFO.
Despite reading so many articles/posts i am still unable sunchronize my scripts.
My doubts are
1> Do We require both scripts as daemons to use... (0 Replies)
Discussion started by: Akshay
0 Replies
6. Programming
hi, my problem is
i have 10 thread for produces double two dimensional array these will produces 2d array 400 times ,then i have a thread to takes a two dimensional array then it inverse , and most 10 array can be in the fifo , and threads given takes one by one, now my problem is , i cant... (0 Replies)
Discussion started by: bblackened
0 Replies
7. Programming
Dear friends
i'm want to implement a program which one file is split into fragments by the server (by some random size) and sent to some processes, so these processes get randomly the fragments of the original file from the server, then the downloader randomly connects to some of these processes... (0 Replies)
Discussion started by: saman_glorious
0 Replies
8. Programming
=server.c=
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include <string.h>
#include <signal.h>
#define MSGSIZE 50 (1 Reply)
Discussion started by: sponge
1 Replies
9. UNIX and Linux Applications
Hello ,
I am working on unix FIFO IPC. i have a doubt regarding that.
If the fifo is updated(write()) through one process....can we able to send any signal that fifo is updated and ready to get read...to other process.?? (0 Replies)
Discussion started by: Harry443
0 Replies
10. UNIX for Beginners Questions & Answers
Hi all,
First of all, sorry for the pastebin link. The code tags aren't working for me.
#!/bin/bash # while-menu-dialog: a menu driven - Pastebin.com
This is a channel "changer" shell script i'm working on. It uses dialog to display the menus.
It... (3 Replies)
Discussion started by: ignatius
3 Replies
LEARN ABOUT CENTOS
xlockdisplay
XInitThreads(3) XLIB FUNCTIONS XInitThreads(3)
NAME
XInitThreads, XLockDisplay, XUnlockDisplay - multi-threading support
SYNTAX
Status XInitThreads(void);
void XLockDisplay(Display *display);
void XUnlockDisplay(Display *display);
ARGUMENTS
display Specifies the connection to the X server.
DESCRIPTION
The XInitThreads function initializes Xlib support for concurrent threads. This function must be the first Xlib function a multi-threaded
program calls, and it must complete before any other Xlib call is made. This function returns a nonzero status if initialization was suc-
cessful; otherwise, it returns zero. On systems that do not support threads, this function always returns zero.
It is only necessary to call this function if multiple threads might use Xlib concurrently. If all calls to Xlib functions are protected
by some other access mechanism (for example, a mutual exclusion lock in a toolkit or through explicit client programming), Xlib thread ini-
tialization is not required. It is recommended that single-threaded programs not call this function.
The XLockDisplay function locks out all other threads from using the specified display. Other threads attempting to use the display will
block until the display is unlocked by this thread. Nested calls to XLockDisplay work correctly; the display will not actually be unlocked
until XUnlockDisplay has been called the same number of times as XLockDisplay. This function has no effect unless Xlib was successfully
initialized for threads using XInitThreads.
The XUnlockDisplay function allows other threads to use the specified display again. Any threads that have blocked on the display are
allowed to continue. Nested locking works correctly; if XLockDisplay has been called multiple times by a thread, then XUnlockDisplay must
be called an equal number of times before the display is actually unlocked. This function has no effect unless Xlib was successfully ini-
tialized for threads using XInitThreads.
SEE ALSO
Xlib - C Language X Interface
X Version 11 libX11 1.6.0 XInitThreads(3)