Programming :: Program Hang Stuck There Signal Handling On POSIX Message Queue UNIX C Pr

Jun 14, 2011

In a single main() function,so need signal handling. Use Posix Message Queue IPC mechanism , can ignore the priority and other linked list message,to implement the scenario:

View 1 Replies


ADVERTISEMENT

Programming :: Signal Handling In Pthread?

Mar 12, 2011

I have created a pthread, and installed a signal handler inside that, same way as we do in main( ) function. The thread's signal handler is a separate function. Surprisingly, it is not working, that is the thread's signal handler is not able to catch signals. Here is the code:

Code: #include <unistd.h>
#include <sys/types.h>
#include <stdio.h>
#include <signal.h>
typedef struct data

[Code]...

View 1 Replies View Related

Programming :: Closing / Unlinking POSIX Message Queues?

Apr 15, 2011

I have a pthread waiting forever on a POSIX message queue and then call mq_close and mq_unlink on the POSIX message queue. I've found that the pthread never wakes up from it's call to mq_receive and remains blocked indefinitely. Is there a way to wakeup all pthreads blocked on a POSIX message queue after calling mq_close/mq_unlink? The goal is to include error handling during message queue deletion to avoid leaving any pthreads blocked forever.

View 2 Replies View Related

Programming :: Posix Message Queues - Communicate Between Two Threads?

Jan 3, 2011

I want to communicate between two threads, each belonging to a different process. Iam using message queues for this. I use mq_open()call. I created the queues with the same queue name starting with a '/'. But when I open the queue, the queue ID is different in both the process. What should I do so that both the process have the same queue ID?

View 1 Replies View Related

Programming :: Designing A Signal Handler With Sigwait In UNIX?

Jan 20, 2010

I'm new to Unix and every signal handler algorithm I've seen is more or less a copy of what I'm trying to do.[URL] designing a signal handler with sigwait in UNIX?

View 1 Replies View Related

Programming :: Block Messages On A Message Queue ?

Dec 3, 2010

I'm facing a scenario in which i need to block messages from being passed onto a message queue when my code is running. how to proceed.

View 8 Replies View Related

Programming :: How To Communicate Between Two Threads Using Message Queue

Jun 7, 2011

How to communicate between two threads using message queue?

View 4 Replies View Related

Programming :: Theoretical Limit On Message Queue Sizes ?

Jun 4, 2010

Following function obtains the system-maintained structure for a message queue:

Code:

And following function simply resizes a message queue to a user-defined value, namely, "size":

Code:

My question is if there is a theoretical limit on user-defined message queue sizes.

To put in other words, is it possible to increase the default message queue size to any user-defined value as long as that certain value does not exceed the size of system's physical memory ?

I use 64-bit Ubuntu 9.04.

View 2 Replies View Related

Debian :: Iptables - Netfilter Queue Handling

Jul 17, 2015

I have created a nfq handler via nfq_open() and using the returned qhandle to bind my application program to a specific queue number that is configured in iptables. when i invoke nfq_create_queue() my program is stuck there and the back trace shows it is blocked in recvfrom()

bt

in recvfrom () from /lib/x86_64-linux-gnu/libpthread.so.0
in nfnl_recv () from /usr/lib/libnfnetlink.so.0
in nfnl_catch () from /usr/lib/libnfnetlink.so.0

View 0 Replies View Related

Programming :: C Program In Unix Environment?

Jan 12, 2011

my instructor gave me a project in c programming language, the probelem i don't have a c program combiler and i don't have a unix os on my computer, and my knowledge in c program is soo weak i took it years ago, i have this code but it does't compile on Dev-C++ on Windows OS, so if you just help me out with this program:

#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>

[code]....

View 5 Replies View Related

General :: Find The Sequence For Signal Handling Mechanism In Kernel?

Apr 28, 2011

I am working on tracing the signal handling mechanism in linux kernel internallly. For that, i build the kernel. Now, i want to trace the signal handling mechanism in the old kernel. I got to about SYSLOG and PRINTK for this. But, how to use these tools exactly in tracing the handling of signals internally ?. Is, there any tool similar to backtrace to do that?. How the call flow is done internally ?

View 1 Replies View Related

Programming :: Get Length Of Run Queue And Swap Queue?

Nov 3, 2010

is it possible to get the length or even the items of both queues, the run queue and the swap queue? I've googled a lot but had no luck. Maybe I havn't used the correct search words...

Is there any header and/or code example to use structures or any API to get these information from the kernel or the scheduler?

View 1 Replies View Related

Programming :: Create A Message Forwarder Program That Receive A Message On Port A And Pass It On T Port B?

Sep 6, 2010

We are trying to create a message forwarder program that receive a message on Port A and pass it on t Port B. Also receive a message from Port C and Pass it on to Port D as follows.

[Code]...

View 4 Replies View Related

Ubuntu :: Print Jobs Stuck In Queue?

Mar 28, 2010

I have 2 printers plugged into a Windows XP PC (an Epson Stylus Photo RX580, and an HP Laserjet 1020) with full sharing on and everything, and is shared with other Windows PCs via the network I have set up. It has worked perfect. But today I added a PC running Ubuntu 9.10 and and can't figure out for the life of me what I am doing wrong. I installed both of the printers via the GUI in Administration, and both of them are detected and Ubuntu says they're working. But when I put something in the queue to print it stays there with the status "pending".

View 8 Replies View Related

General :: Printer Queue Stuck - Can't Completely Delete

Aug 27, 2010

I am printing from an Acer to an HP. I can't completely delete the queue and now can't print anything.

View 4 Replies View Related

Server :: Messages Stuck In Sendmail Queue Beyond ConfTO_QUEUERETURN Lifetime?

Sep 2, 2010

Messages are stuck in my server's /var/spool/mqueue/ folder beyond the lifetime I have specified in confTO_QUEUERETURN (5d). Any idea why this could be? The file permissions appear fine; files in the mqueue folder show rights of: Code:-rw------- 1 root smmspThis is causing an issue because the queues are slowly getting larger and larger. I'm seeing the queue size consistently growing. maillog shows entries like: Code:grew WorkList for /var/spool/mqueue to 28000Just thinking outloud -- could the queue runner not be completing it's job in time? Maybe I could check with time sendmail -q

View 1 Replies View Related

CentOS 5 Server :: Cron Send Mail But Stuck In Queue

Aug 5, 2010

I recently install CentOS 5.5 on my small server. Unfortunately, I have problems with my mail configuration. I don't know anything about sendmail and dns configuration so I am just looking for something easy to set up. I use cron to perform automatic task. I set up the variable $MAILTO in cron to my regular mail. Cron send the mail but it is stuck in the queue.

View 11 Replies View Related

Debian :: Handling Virtualisation And Finding Program(s) To Alternative To VMware?

Mar 13, 2009

I currently run a home sever using windows server 2008. On it I'm using VMware to run 2 virtual machines (currently running CentOS (which is Red Hat based) as web and mail servers. It's not a big setup, we only host our personal websites and a couple for some friends. Although server 2008 handles resouces much better than server 2003, it's still running windows, which as we know is far more inferior to a Linux server. I'm trying to convince the husband to let me run everything on Debian, but he wants to run it on Red Hat (which okay, isn't bad but our household is devided. We have long running arguments because he likes his boxes Red Hat based running KDE, and I like my Debian distros running Gnome!)

The host server is running on a standard pc box, it's got a 2.5 gigahertz dual core processor and 3 gig of ram, almost one TB storage. (don't ask why I'm including this drastically important info!) I want to run the entire network on Debian. So that would be the main host running Debian and the two virtual machines also. The host itself would need to run as a file and app server for our home network and the two vertuals as web and mail servers. (we run about 12 domains three of which are under heavy usage with Mysql databases, so we run two servers so we can dedicate more rescources to the virtual server that sucks the most juice.) I was wondering how Debian handles virtualisation and what program(s) would be a good alternative to VMware?

View 2 Replies View Related

Programming :: Synchronize 2 Posix Threads ?

Mar 15, 2011

I have 2 threads and both of them are deleting memory at the end nedded by both.

My problem is that maybe it can happen that a thread start and finish before the other one starts and so it deletes the memory nedded by the other thread. How can I synchronize them so that this can't happend.

As a design my threads look like this:

Code:

The other thread looks the same, but this isn't unoff to stop thread1 to finish before thread2 starts.

View 4 Replies View Related

Programming :: Proper Implementation Of POSIX Threads

Apr 6, 2011

I've implemented a program URL... which reads digital IF data from a radio receiver through a named pipe, measures power levels, and sends the result to stdout. The program is interactive; there is a thread that reads from stdin to watch for commands, a thread that constantly either reads data from the named pipe or throws data away, and an array of processing threads. The program uses GTK+extra to plot the signals. The IF data stream bandwidth exists at the limits of today's technology (is very very fast).

Problem Statement:The program works fine with a few bugs. I've learned since I've made it that using global state variables to coordinate threads isn't a good way of doing it. I also only had knowledge of mutexes and polled the state variable instead of using other methods.My reimplementation will use the following:

- One "Stdin Command Monitoring" thread
- One "Get data from named pipe" thread
- One post-processor thread
- N Processing threads

All threads are alive during the life of main()There are N buffers. Data will come in from the named pipe, and the "Get data" thread will write the data to an "available" buffer. When the buffer is full it will be marked as "full". There will be N processing threads, one for each buffer. When a processing threads' buffer is full, it will process the buffer and save the result to a final buffer. At the end of a number of averages, the post-processor thread will perform a final process on the final buffer and send the results to stdout.

View 2 Replies View Related

Programming :: Find Number Of Child Processes (C / POSIX)?

May 26, 2010

I'm in the process of writing a program that is a server- it will accept connections and stuff, and spawn a child process for each. However, i've run into a small problem. I do NOT want to bother with keeping track of the processes unless i need to. So, i set SA_NOCLDWAIT (#ifdef) on a SIG_IGN to the SIGCHLD handler through sigaction interface. The standard says that it the kernel will then keep track of reaping zombie processes for me (a HUGE plus). However, upon receiving a SIGINT signal, i want to stop the server from accepting new connections (done), and then wait for there to be no new connections. I was thinking of just putting a loop like so:

Code:

while((wait(NULL) != (pid_t)-1) && errno != ECHILD);

However, I'm not *sure* that this will work, especially with SIGCHLD still ignored. So how can i tell if there are still child processes? I can't find any call like int getnumchld(pid_t proc); (i wish). Plus it would be inefficient to spin on that function anyway. OTOH, i would rather *NOT* have to do the same thing in a loop with a system("ps |...>file"); read(file); etc. either. Is there a way i can portably implement this feature (I was hoping i could run it on linux and the major BSDs, at least).

TO SUM IT UP:

How can i tell if a process has no child processes if i've SIG_IGN'd SA_NOCLDWAIT'd the SIGCHLD? Is there a _reasonably_ portable way to do so? I *don't* want to manually wait for EVERY process. Maybe only those still active at the time of SIGTERM, but that requires keeping track of the number of connections and whether those have terminated...

EDIT: Does anyone know if the above code *would* work, even with SIGCHLD ignored and the kernel cleaning up zombies *for* me? I checked the manpage and it doesn't say much.

EDIT1: Note that all of the processes are in the same process group and session. SO i can find them through this as well. Perhaps even setting the uid/gid and finding all processes run by that group?

EDIT2: i have an idea if the above isn't feasible. If there is no "elegant" way to do it, i could reduce the complexity by sending a SIGUSR1 to the whole process group. Each process would then set a flag telling it to send a SIGUSR1 in reply and send a SIGUSR2 when it is done executing. Then i could keep a count of signals. Maybe that would be *easier*. Or perhaps a count of all child processes and just a termination signal to decrement the counter.

View 2 Replies View Related

Programming :: Related To Pthreads And Timers In POSIX Standard

Feb 17, 2010

I have created two threads:
Thread 1 and thread 2

In the main thread, i have put up a timer which generates a signal periodically when it expires, which reults in execution going to signal catcher function.when this function is invoked, under certain condition it goes to thread 1 and under another condition it goes to thread 2. The problem lies here that when it goes to thread2,i have a loop to process but it doesnt come out of the loop and hence from thread2, even though timer has expired.

View 2 Replies View Related

Server :: POSTFIX Server New Domain Emails Stuck In Queue

Apr 20, 2010

I am newbie to postfix. I added a new domain to my postfix server in the main.cf under mydestinations variable and the relay_domains file. Also, added this domain to my backend exchange server. When I send a test message from the new domain, my messages from that domain appear to be stuck in the "queue active". What does it mean when you are stuck in this queue? Does this mean that my backend email server (exchange 2003) isn't allowing messages from this new domain OR that the POSTFIX server still needs configuring.

View 2 Replies View Related

Programming :: C++: Getting And Handling Web Data?

Jan 29, 2010

I'm just starting out on a project relating to web search, to be done in C++. Which library should I use to help with downloading web pages into memory so that I can process them? The big thing is I want to be able to download the pages into variables/structures without actually putting them onto the hard disk.I googled and saw libcurl, but I was confused by some of the examples and wondering if this was really what I wanted.

View 2 Replies View Related

Programming :: How Error Handling Is Done In C

Jan 3, 2010

I wonder how error handling is done in C in real applications, by returning a error code when something goes wrong, or by using setjmp and longjmp, or something else?

View 10 Replies View Related

Ubuntu Installation :: Update Stops With Python Message And Hang

Mar 25, 2011

I was doing a update via Synaptic Package Manager, after it is nearly finished i get that message: Processing triggers for python-central ... Nothing happend so i ctrl-c it and the packet manger shows me no other errors or something else, even all the packages who was marked for upgrade are now upgraded but what about that python message? Do i have to do some check ? or maybe even a repair or even worse re install the OS?

[Code]...

View 2 Replies View Related

OpenSUSE Hardware :: Monitor Not Working - No Signal Message

Feb 19, 2010

I usually log out from my account, let the pc working and close the monitor. When after some hours I try to open again the monitor I get the msg "No Signal" I move the mouse I press some buttons at the keyboard but nothing.. I have to reboot again to see the monitor working.. What can I do?

View 7 Replies View Related

Ubuntu Installation :: Monitor Gives No Signal Message During Install

May 23, 2010

So my computer works reasonably fast running XP (old 3GHz processor with 512RAM), but every so often it simply freezes. I've tried all I can to fix this, but sometimes when I boot up XP it'll get to the window's logo then freeze, sometimes it'll get all the way to the desktop and then freeze, and sometimes it'll start up, run fine for an hour or two then freeze. By freeze, I mean the screen doesn't update, the keyboard and mouse do nothing. Updating NVIDIA drivers doesn't seem to help - some make it worse! So I've had enough, and decided to download Wubi to try Ubuntu on it. I'm not ready to remove windows just yet (lots of data on this machine) and so I don't really want to try dual-booting yet.

Wubi downloads and runs in Windows fine. When I go to restart, after picking Ubuntu from the menu it shows a little text (I think about installation, and press Esc for menu) then my monitor gives a "No Signal" message. So I try restarting (pressing the button), and pressing Esc to bring up the menu. I tried all 5ish options, and "Safe graphics mode" and "ACPI workarounds" seem to last longer, but the same error occurs, before it has even prompted me (still doing its own thing). So I can get up to GRUB, and even get into the grub> prompt. I tried adding irqpoll and/or all_generic_ide to the boot thing (pressing e in the grub menu), but that hasn't helped. I'm unsure of how to find what hardware my computer has (only computer, don't have receipt), but I know "NVIDIA GeForce 6600 GT".

View 9 Replies View Related

Programming :: Exception Handling In Perl?

May 12, 2010

I writed Quote:

#!/usr/bin/perl -w
use Error qw(:try);
try {

[code]....

View 1 Replies View Related

Programming :: Try/except Error Handling In Bash?

Jun 30, 2011

I found, in bash, something similar to 'try/except' in python. I've been using something like this:

Code:
if ! 'command';then
echo 'damn, there was an error'

[code]....

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved