Hi all,
I have an Producer/Consumer program in C(using shared memory and semaphores).It is working fine with sleep calls after every read/write operation.Each one is a independent program.Now if i remove the sleep calls in consumer,it goes on waiting in the loop till the producer puts some valid... (3 Replies)
I would like to loop through a set of directories, performing operation(s) on each one. The basic script** is
dirs=`find . -name .svn -print`
for f in $dirs; do
echo "Processing $f directory .."
done
Fine and dandy, but here is the problem: the find expression must complete... (2 Replies)
Control two exclusively shared resources. The two resources are two files. The producer will write even numbers to one file, and odd numbers to another one. The consumer respectively reads from each file until it gets 5 even numbers and 5 odd numbers.
Can any one help me with the code.
... (0 Replies)
Control two exclusively shared resources. The two resources are two files. The producer will write even numbers to one file, and odd numbers to another one. The consumer respectively reads from each file until it gets 5 even numbers and 5 odd numbers.
Can any one help me with the code.
... (1 Reply)
Control two exclusively shared resources(semaphore). The two resources are two files. The producer will write even numbers to one file, and odd numbers to another one. The consumer respectively reads from each file until it gets 5 even numbers and 5 odd numbers.
Can any one help me with the... (0 Replies)
Control two exclusively shared resources(semaphore). The two resources are two files. The producer will write even numbers to one file, and odd numbers to another one. The consumer respectively reads from each file until it gets 5 even numbers and 5 odd numbers.
Can any one help me with the... (0 Replies)
Control two exclusively shared resources. The two resources are two files. The producer will write even numbers to one file, and odd numbers to another one. The consumer respectively reads from each file until it gets 5 even numbers and 5 odd numbers.
Can any one help me with the code.
... (3 Replies)
Control two exclusively shared resources(semaphore). The two resources are two files. The producer will write even numbers to one file, and odd numbers to another one. The consumer respectively reads from each file until it gets 5 even numbers and 5 odd numbers.
Can any one help me with the... (1 Reply)
normally, i hate asking someone to do my homework for me but am getting desperate right now.
i have a project about consumer producer problem. the deadline is tonight at 23:55. but i havent gotten it working yet. i just COULDNT get it to work right yet.
the problem is as follows: the C - program... (0 Replies)
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
normally, i hate asking someone to do my homework for me but am getting desperate right now.
i have a project... (1 Reply)
Discussion started by: alexantosh
1 Replies
LEARN ABOUT HPUX
pthread_rwlockattr_setpshared
pthread_rwlockattr_getpshared(3T)pthread_rwlockattr_getpshared(3T)NAME
pthread_rwlockattr_getpshared(), pthread_rwlockattr_setpshared() - get or set the process-shared attribute
SYNOPSIS PARAMETERS
attr Pointer to the read-write lock attributes object whose attributes are to be set/retrieved.
pshared This parameter either specifies the new value of the process-shared attribute (set function) or points to the memory loca-
tion where the process-shared attribute of attr is to be returned (get function).
DESCRIPTION
The attributes object attr must have been previously initialized with the function before these functions are called.
Read-Write locks can be used only by threads within the process or shared by threads in multiple processes. The process-shared attribute in
a read-write lock attributes object describes who may use the read-write lock. The legal values for the process-shared attribute are:
This option permits a read-write lock to be operated upon by any thread
that has access to the memory where the read-write lock is allocated. The application is responsible for allocating the
read-write lock in memory that multiple processes can access.
The read-write lock can only be operated upon by threads created within
the same process as the thread that initialized the read-write lock. If threads of differing processes attempt to operate on
such read-write lock, the behavior is undefined.
The default value of process-shared is
is used to set the process-shared attribute in the initialized attributes object attr. The new value of the process-shared attribute of
attr is set to the value specified in the pshared parameter.
retrieves the value of the process-shared attribute from the read-write lock attributes object attr. The value of the process-shared
attribute of attr is returned in the pshared parameter.
RETURN VALUE
Upon successful completion, and return zero. Otherwise, an error number is returned to indicate the error (the variable is not set).
ERRORS
If any of the following occur, the and functions return the corresponding error number:
is not defined and these functions are not supported.
For each of the following conditions, if the condition is detected, the and functions return the corresponding error number:
The value specified by
attr is invalid.
The value specified by
pshared is not a legal value.
The value pshared points to an illegal address.
WARNINGS
If a read-write lock is created with the process-shared attribute defined as the cooperating processes should have access to the memory in
which the read-write lock is allocated.
AUTHOR
and were developed by X/Open.
SEE ALSO pthread_create(3T), pthread_rwlockattr_init(3T), pthread_rwlock_init(3T).
STANDARDS CONFORMANCE
Pthread Library pthread_rwlockattr_getpshared(3T)