Sponsored Content
Top Forums Programming Deallocating memory in multi-threaded environment. Post 302518395 by gngrwzrd on Friday 29th of April 2011 01:36:08 PM
Old 04-29-2011
I lost track of what you were saying in the last paragraph. Are you suggesting that I have a separate thread that does deallocation? There could still be a problem with that - it could be added twice to the deallocation thread.

Have you ever been able to find examples of this type of situation. Most pthread references I look at don't go into any detail about complicated situations like this - they just show you what a mutex is and leave it at that.
 

10 More Discussions You Might Find Interesting

1. Programming

problem deallocating memory for 3d aray

Can anyone tell me why this section of code causes a segmentation fault when 'deallocate' is called?. Although it works when n>=number. This code segment is intended to be used in a program in which the tensor is very large, (5x512x512) or greater. i tryed to compile this using gcc version... (2 Replies)
Discussion started by: bongobonga
2 Replies

2. Programming

multi-threaded server, pthreads, sleep

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

3. Programming

HOWTO: Calculate the balance of work in multi-threaded app.

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

4. AIX

multi threaded program is hanging

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. Programming

Questions about timer in multi-threads environment

Hi I have questions about timer function in multi-threads environment. My application has multi-threads, in one thread, I set a timer, when the timer expires, the timer function will interrupt other thread and execute. I am not clear which thread will be interrupted by the timer function ?... (2 Replies)
Discussion started by: longskys
2 Replies

6. Shell Programming and Scripting

In need of multi threaded perl assistance

I need to write a perl script to execute external programs and grab the output and return code. Each program should be killed if it has not completed within X seconds. Imagine that the script goes something like this : @commands = &get_commands(); foreach $cmd (@commands) { $pid =... (4 Replies)
Discussion started by: SandmanCL
4 Replies

7. UNIX for Advanced & Expert Users

Multi-threaded encryption @ Fedora 11

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

8. Linux

Multi-threaded encryption @ Fedora 11

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

9. Programming

multi-threaded memory leak

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

10. Shell Programming and Scripting

script for multi-threaded bash processes

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
PTHREAD_MUTEX_UNLOCK(3) 				   BSD Library Functions Manual 				   PTHREAD_MUTEX_UNLOCK(3)

NAME
pthread_mutex_unlock -- unlock a mutex SYNOPSIS
#include <pthread.h> int pthread_mutex_unlock(pthread_mutex_t *mutex); DESCRIPTION
If the current thread holds the lock on mutex, then the pthread_mutex_unlock() function unlocks mutex. Calling pthread_mutex_unlock() with a mutex that the calling thread does not hold will result in undefined behavior. RETURN VALUES
If successful, pthread_mutex_unlock() will return zero, otherwise an error number will be returned to indicate the error. ERRORS
The pthread_mutex_unlock() function will fail if: [EINVAL] The value specified by mutex is invalid. [EPERM] The current thread does not hold a lock on mutex. SEE ALSO
pthread_mutex_destroy(3), pthread_mutex_init(3), pthread_mutex_lock(3), pthread_mutex_trylock(3) STANDARDS
The pthread_mutex_unlock() function conforms to ISO/IEC 9945-1:1996 (``POSIX.1''). BSD
July 30, 1998 BSD
All times are GMT -4. The time now is 03:12 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy