02-13-2006
Quote:
Originally Posted by jim mcnamara
You want write-execlusive locking, correct?
Otherwise read-shared locking.
I need read-write locks of the kind described by Butenhof in his "Programming with Posix Threads" book. These provide read-shared and write-exclusive access to a resource (not at the same time, naturally) within a process. I need to extend this concept to multiple processes.
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
helo i make one process for com port . in that i create two thread one for reading data and another for writing data to com port.
now i want to write a script which create 30 processes for handling 30 com port.
is it good solution for handling 30 com port.
Thx & Regards,
Amit (2 Replies)
Discussion started by: amitpansuria
2 Replies
2. Shell Programming and Scripting
I need to find all the files that have group Read or Write permission or files that have user write permission.
This is what I have so far:
find . -exec ls -l {} \; | awk '/-...rw..w./ {print $1 " " $3 " " $4 " " $9}'
It shows me all files where group read = true, group write = true... (5 Replies)
Discussion started by: shunter63
5 Replies
3. HP-UX
Hi,
I read a set of processes with:
ps -eaf|grep oracleTRLV
The result is:
oracle 23253 1 0 15:14:11 ? 0:00 oracleTRLV (LOCAL=NO)
oracle 23301 1 0 15:15:07 ? 0:00 oracleTRLV (LOCAL=NO)
oracle 22914 1 0 15:11:19 ? 0:00 oracleTRLV (LOCAL=NO)
How to I kill the "oracleTRLV" ones? Is there... (17 Replies)
Discussion started by: NicoMan
17 Replies
4. IP Networking
Hi,
We have smb client running on two of the linux boxes and smb server on another linux system. During a backup operation which uses smb, read of a file was allowed while write to the same file was going on.Also simultaneous writes to the same file were allowed.Following are the settings in the... (1 Reply)
Discussion started by: swatidas11
1 Replies
5. IP Networking
hi
am newbie to unix and socket programing
I am trying to figuring out syntax for read and write
to send data from server to client and client can read it
I have to send two integers
write(newsockfd,buffer,"%d %d",x,y,0) writing from client where x and y are two integers..
... (7 Replies)
Discussion started by: karthik1238
7 Replies
6. Programming
I need help!Many Thanks!
Now,I try to manage the shared memory inter-process .
Inevitably,I have to deal with the synchronous.
I know the pthread_rwlock in posix,and I compile ,then run successfully in Red Hat Enterprise 4.
I have a doubt about whether the Posix supports the system such as... (1 Reply)
Discussion started by: weizh
1 Replies
7. UNIX for Advanced & Expert Users
If we have 3 process to write to same log file at the same time like below. will it cause the data outdated because the multiple process writing same time? It this a safe way to keep the log for multiple process?
p1 >> test.log &;
p2 >> test.log &;
p3 >> test.log &
Thanks, (1 Reply)
Discussion started by: casttree
1 Replies
8. Programming
HI
I need to implement a client/server TCP application. the customer is the client and the bartender is the server.
When the customer enter the Bar, client connects to the server
Server should reply the client immediately. Other wise if the server is busy, it should send an update message... (10 Replies)
Discussion started by: lixiao1212
10 Replies
9. Shell Programming and Scripting
I have got a file in following format:
AAAAAAA
BBBBBBBB
CCCCCCC
DDDDDDD
I am trying to read this file and out put it in following format:
AAAAAAA,BBBBBBB,CCCCCCC,DDDDDD
Preferred method is shell or Perl.
Any help appreciated. (11 Replies)
Discussion started by: Araoki
11 Replies
10. Programming
Can someone help me to write this program in C in QNX?
Using the FIFO queues write a simple communication system consisting of programs write and read. The program write the parameters given strings enclosed in single quotes. These strings are written to the FIFO file. Reads the program read... (1 Reply)
Discussion started by: ebasse2
1 Replies
LEARN ABOUT OSF1
pthread_rwlockattr_setpshared
pthread_rwlockattr_setpshared(3) Library Functions Manual pthread_rwlockattr_setpshared(3)
NAME
pthread_rwlockattr_setpshared - Sets the process-shared attribute in a read-write lock attributes object.
LIBRARY
DECthreads POSIX 1003.1c Library (libpthread.so)
SYNOPSIS
#include <pthread.h>
int pthread_rwlockattr_setpshared(
pthread_rwlockattr_t *attr,
int pshared);
PARAMETERS
Address of the read-write lock attributes object whose process-shared attribute is to be set. Value to set in the process-shared attribute
of attr. Must be the value PTHREAD_PROCESS_SHARED, to permit access to the read-write lock by any thread in any process that can access the
memory where the lock object is allocated, or PTHREAD_PROCESS_PRIVATE, to permit access to the read-write lock only by threads in the same
process as the thread that initialized the read-write lock object.
DESCRIPTION
This routine uses the value in pshared to set the process-shared attribute in the read-write lock attributes object referenced by attr. The
object referenced by attr must be initialized before this routine is called. The value of pshared must be either PTHREAD_PROCESS_SHARED or
PTHREAD_PROCESS_PRIVATE, as defined in the pthread.h include file.
If the process-shared attribute is set to PTHREAD_PROCESS_PRIVATE, the read-write lock object can only be operated upon by threads created
within the same process as the thread that initialized the read-write lock object. If threads of differing processes attempt to operate on
such a read-write lock object, the behavior is undefined.
The default value of the process-shared attribute of a read-write lock attributes object is PTHREAD_PROCESS_PRIVATE.
If the process-shared attribute of a read-write lock attributes object is set to PTHREAD_PROCESS_SHARED, the read-write lock object can be
operated upon by any thread that has access to the memory where that object is allocated, even if that object is allocated in memory that
is shared by multiple processes.
RETURN VALUES
If an error condition occurs, this routine returns an integer value indicating the type of error. Possible return values are as follows:
Successful completion. The value specified by attr is not a valid attributes object, or the value pshared is outside the range of legal
values for that attribute.
ERRORS
None
RELATED INFORMATION
Functions: pthread_rwlockattr_getpshared(3), pthread_rwlockattr_init(3)
Manuals: Guide to DECthreads and Programmer's Guide
delim off
pthread_rwlockattr_setpshared(3)