01-29-2009
I should have mentioned that I have to stick with 5.8.5 compatible code here. This needs to get deployed on multiple servers where a perl upgrade is not an option.
Currently I am moving away from threads and just using good old fork & exec. Not as platform independent as I had hoped but I'll cross that barrier when I need to.
10 More Discussions You Might Find Interesting
1. Programming
I am trying to writa a multi-client & multi-threaded TCP server.
There is a thread pool. Each thread in the pool will handle
requests of multiple clients.
But here I have a problem. I find a solution but it is not how
it must be... i think. When threads working without sleep(1)
I can't... (0 Replies)
Discussion started by: Parahat Melayev
0 Replies
2. Programming
I was wondering if anyone could give me a good idea how to calculate how balanced the threading is on a multi-threaded application. I want a percentage, such as "threads are 80% balanced."
This is the way I am currently going about it, maybe it is good, maybe not.
First, whenever a thread... (2 Replies)
Discussion started by: DreamWarrior
2 Replies
3. Shell Programming and Scripting
I need to query a http site and then parse the xml results, this works well if I use the string in IE but I require an automated solution.
I have tried using the following as well as HTTP::Request, nothing seems to work any suggestions would be appreciated, I have tried diffrnt things I found on... (7 Replies)
Discussion started by: bryanthomas
7 Replies
4. AIX
I have a Multithreaded program which is hanging on AIX.
OS Version: AIX 5.2 and thread library version : 5.2.0.75
We Initiate the process with 50 threads..when we are disconnecting from the process it hangs.There is lots of other stuff involved here.I am just sending the piece of the problem with... (0 Replies)
Discussion started by: hikrishn
0 Replies
5. UNIX for Advanced & Expert Users
Hello, are any of the encryption programs capable of true multi-threading ? Friend of mine tells me that he's been running some testing on Fedora 11 and that the kernel doesn't support multi-threading at that level.
I've been looking into TrueCrypt, encfs and both calm to support... (0 Replies)
Discussion started by: TehOne
0 Replies
6. Linux
Hello, are any of the encryption programs capable of true multi-threading ? Friend of mine tells me that he's been running some testing on Fedora 11 and that the kernel doesn't support multi-threading at that level.
I've been looking into TrueCrypt, encfs and both calm to support... (1 Reply)
Discussion started by: TehOne
1 Replies
7. Programming
Hello All :
I write a .c program to test the exactually resource the memory leak
as follows:
1 #include <stdio.h>
2 #define NUM 100000
3 void *Thread_Run(void * arg){
4 //TODO
5 //pthread_datch(pthread_self());
6 int socket= (int)arg;
7 ... (1 Reply)
Discussion started by: aobai
1 Replies
8. UNIX for Dummies Questions & Answers
Good morning. I have a piece of code that is currently taking multiple files and using the CAT.exe command to combine into one file that is then sorted in reverse order based on the 3rd field of the file, then displayed on screen. I am trying to change this so that the files are being combined into... (4 Replies)
Discussion started by: jaacmmason
4 Replies
9. Programming
I'm having a hard time figuring out how to manage deallocation of memory in multithreaded environments. Specifically what I'm having a hard time with is using a lock to protect a structure, but when it's time to free the structure, you have to unlock the lock to destroy the lock itself. Which will... (5 Replies)
Discussion started by: gngrwzrd
5 Replies
10. Shell Programming and Scripting
hey everyone,
I'm having some trouble breaking down some code. It's simple a control script that takes machines meant to be backed up from a list. Then according to that will run multi-threaded processes up until the specified thread limit.
for example if there are 4 machines to be backed up,... (2 Replies)
Discussion started by: terrell
2 Replies
LEARN ABOUT FREEBSD
pthread_barrier_init
PTHREAD_BARRIER(3) BSD Library Functions Manual PTHREAD_BARRIER(3)
NAME
pthread_barrier_destroy, pthread_barrier_init, pthread_barrier_wait -- destroy, initialize or wait on a barrier object
LIBRARY
POSIX Threads Library (libpthread, -lpthread)
SYNOPSIS
#include <pthread.h>
int
pthread_barrier_destroy(pthread_barrier_t *barrier);
int
pthread_barrier_init(pthread_barrier_t *barrier, const pthread_barrierattr_t *attr, unsigned count);
int
pthread_barrier_wait(pthread_barrier_t *barrier);
DESCRIPTION
The pthread_barrier_init() function will initialize barrier with attributes specified in attr, or if it is NULL, with default attributes.
The number of threads that must call pthread_barrier_wait() before any of the waiting threads can be released is specified by count. The
pthread_barrier_destroy() function will destroy barrier and release any resources that may have been allocated on its behalf.
The pthread_barrier_wait() function will synchronize calling threads at barrier. The threads will be blocked from making further progress
until a sufficient number of threads calls this function. The number of threads that must call it before any of them will be released is
determined by the count argument to pthread_barrier_init(). Once the threads have been released the barrier will be reset.
IMPLEMENTATION NOTES
In both N:M Threading Library (libkse, -lkse) and 1:1 Threading Library (libthr, -lthr) the PTHREAD_BARRIER_SERIAL_THREAD return value will
always be returned by the last thread to reach the barrier.
RETURN VALUES
If successful, both pthread_barrier_destroy() and pthread_barrier_init() will return zero. Otherwise, an error number will be returned to
indicate the error. If the call to pthread_barrier_wait() is successful, all but one of the threads will return zero. That one thread will
return PTHREAD_BARRIER_SERIAL_THREAD. Otherwise, an error number will be returned to indicate the error.
None of these functions will return EINTR.
ERRORS
The pthread_barrier_destroy() function will fail if:
[EBUSY] An attempt was made to destroy barrier while it was in use.
The pthread_barrier_destroy() and pthread_barrier_wait() functions may fail if:
[EINVAL] The value specified by barrier is invalid.
The pthread_barrier_init() function will fail if:
[EAGAIN] The system lacks resources, other than memory, to initialize barrier.
[EINVAL] The count argument is less than 1.
[ENOMEM] Insufficient memory to initialize barrier.
SEE ALSO
pthread_barrierattr(3)
HISTORY
The pthread_barrier_destroy(), pthread_barrier_init() and pthread_barrier_wait() functions first appeared in N:M Threading Library (libkse,
-lkse) in FreeBSD 5.2, and in 1:1 Threading Library (libthr, -lthr) in FreeBSD 5.3.
BSD
February 19, 2004 BSD