Sponsored Content
Top Forums Programming Question on creation of Thread pool Post 302115334 by Radha on Tuesday 24th of April 2007 03:55:44 AM
Old 04-24-2007
Question on creation of Thread pool

dear sir/madam
presently i am in a process of creating a multithread pool using

clone() system call in unix with c programming.
i am facing some problem ie., i am able create multithread pool and

able to keep all the threads in wait state,but when i call kill

(afunction revoke a thread after stopping it through raise

function) all the threads in the pool are revoking instead of only

one.In order to make only single thread to invoke and keep the

rest in wait condition i need to set a flag in clone system call

but i am unable to find that flag.I tried it with all flags that i

got in man and internet but i could not get it.so can anyone send

me the code for the same?

Thanks
Radha
 

9 More Discussions You Might Find Interesting

1. Solaris

Thread creation in c++

Hi all! Is there a function in c++ to create new threads.I have writen a class "Thread" in which I will be calling this thread function to creat threads. Also is there a function to synchronize threads .I know that we can create objects like semaphores and critical sections to synchronize in... (2 Replies)
Discussion started by: vijlak
2 Replies

2. Solaris

DiskSuite 4.2.1 Database creation question

I'm trying to figure out how to simply create a 500Gb ufs file system named /rec using DiskSuite 4.2.1 on a Solaris 8 platform via command line using two 250Gb partitions on two different disks. Does anyone know what the proper command string and options are to perform this task? Would I use the... (2 Replies)
Discussion started by: ruger14
2 Replies

3. Infrastructure Monitoring

zfs - migrate from pool to pool

Here are the details. cnjr-opennms>root$ zfs list NAME USED AVAIL REFER MOUNTPOINT openpool 20.6G 46.3G 35.5K /openpool openpool/ROOT 15.4G 46.3G 18K legacy openpool/ROOT/rds 15.4G 46.3G 15.3G / openpool/ROOT/rds/var 102M ... (3 Replies)
Discussion started by: pupp
3 Replies

4. Shell Programming and Scripting

thread creation

#include <stdio.h> #include <stdlib.h> #include <pthread.h> void *fork_thread(void *ptr ); main() { pthread_t thread1; char *message1 = "Thread 1"; int iret1; iret1 = pthread_create( &thread1, NULL, fork_thread, (void*) message1); exit(0); } Void *fork_thread(... (3 Replies)
Discussion started by: annapurna konga
3 Replies

5. Shell Programming and Scripting

thread creation

Void *fork_thread( void *ptr ) i am getting error in this line please help me out (1 Reply)
Discussion started by: annapurna konga
1 Replies

6. Solaris

ZFS pool question

I created a pool the other day. I created a 10 gig files just for a test, then deleted it. I proceeded to create a few files systems. But for some reason the pool shows 10% full, but the files systems are both at 1%? Both files systems share the same pool. When I ls -al the pool I just... (6 Replies)
Discussion started by: mrlayance
6 Replies

7. Solaris

need some help in resource pool creation

i have server carry more than 50 zone i want to create 2 resource pool assign 40 zone to resource pool number 1 assign 10 zone to resource pool number 2 how can i do that (1 Reply)
Discussion started by: coxmanchester
1 Replies

8. UNIX for Dummies Questions & Answers

thread pool problem

hello everyone. I want to implement a thread pool, with 10 threads most. Inside main,I call a function (lets say it foo) wich creates (if it is needed) or uses an existing thread from the pool and sends it to do a job.My problem is that I dont know how to pass the argument from the main to the... (2 Replies)
Discussion started by: garag11
2 Replies

9. UNIX for Dummies Questions & Answers

Question about lvm file creation

Hi, I have below code for disk creation disk_list=$(ls /dev/sd) for disk in $disk_list do pvcreate $i done So what my understanding is first it is checking the disk under /dev sdb,sdc,sdd,...sdz whether 25 disk are existing if not then its creating the 25 physical volume. I... (4 Replies)
Discussion started by: stew
4 Replies
door_bind(3C)						   Standard C Library Functions 					     door_bind(3C)

NAME
door_bind, door_unbind - bind or unbind the current thread with the door server pool SYNOPSIS
cc -mt [ flag... ] file... [ library... ] #include <door.h> int door_bind(int did); int door_unbind(void); DESCRIPTION
The door_bind() function associates the current thread with a door server pool. A door server pool is a private pool of server threads that is available to serve door invocations associated with the door did. The door_unbind() function breaks the association of door_bind() by removing any private door pool binding that is associated with the cur- rent thread. Normally, door server threads are placed in a global pool of available threads that invocations on any door can use to dispatch a door invocation. A door that has been created with DOOR_PRIVATE only uses server threads that have been associated with the door by door_bind(). It is therefore necessary to bind at least one server thread to doors created with DOOR_PRIVATE. The server thread create function, door_server_create(), is initially called by the system during a door_create() operation. See door_server_create(3C) and door_create(3C). The current thread is added to the private pool of server threads associated with a door during the next door_return() (that has been issued by the current thread after an associated door_bind()). See door_return(3C). A server thread performing a door_bind() on a door that is already bound to a different door performs an implicit door_unbind() of the previous door. If a process containing threads that have been bound to a door calls fork(2), the threads in the child process will be bound to an invalid door, and any calls to door_return(3C) will result in an error. RETURN VALUES
Upon successful completion, a 0 is returned. Otherwise, -1 is returned and errno is set to indicate the error. ERRORS
The door_bind() and door_unbind() functions fail if: EBADF The did argument is not a valid door. EBADF The door_unbind() function was called by a thread that is currently not bound. EINVAL did was not created with the DOOR_PRIVATE attribute. EXAMPLES
Example 1 Use door_bind() to create private server pools for two doors. The following example shows the use of door_bind() to create private server pools for two doors, d1 and d2. Function my_create() is called when a new server thread is needed; it creates a thread running function, my_server_create(), which binds itself to one of the two doors. #include <door.h> #include <thread.h> #include <pthread.h> thread_key_t door_key; int d1 = -1; int d2 = -1; cond_t cv; /* statically initialized to zero */ mutex_t lock; /* statically initialized to zero */ extern void foo(void *, char *, size_t, door_desc_t *, uint_t); extern void bar(void *, char *, size_t, door_desc_t *, uint_t); static void * my_server_create(void *arg) { /* wait for d1 & d2 to be initialized */ mutex_lock(&lock); while (d1 == -1 || d2 == -1) cond_wait(&cv, &lock); mutex_unlock(&lock); if (arg == (void *)foo){ /* bind thread with pool associated with d1 */ thr_setspecific(door_key, (void *)foo); if (door_bind(d1) < 0) { perror("door_bind"); exit (-1); } } else if (arg == (void *)bar) { /* bind thread with pool associated with d2 */ thr_setspecific(door_key, (void *)bar); if (door_bind(d2) < 0) { /* bind thread to d2 thread pool */ perror("door_bind"); exit (-1); } } pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL); door_return(NULL, 0, NULL, 0); /* Wait for door invocation */ } static void my_create(door_info_t *dip) { /* Pass the door identity information to create function */ thr_create(NULL, 0, my_server_create, (void *)dip->di_proc, THR_BOUND | THR_DETACHED, NULL); } main() { (void) door_server_create(my_create); if (thr_keycreate(&door_key, NULL) != 0) { perror("thr_keycreate"); exit(1); } mutex_lock(&lock); d1 = door_create(foo, NULL, DOOR_PRIVATE); /* Private pool */ d2 = door_create(bar, NULL, DOOR_PRIVATE); /* Private pool */ cond_signal(&cv); mutex_unlock(&lock); while(1) pause(); } ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Architecture |all | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ |Interface Stability |Stable | +-----------------------------+-----------------------------+ |MT-Level |Safe | +-----------------------------+-----------------------------+ SEE ALSO
fork(2),door_create(3C), door_return(3C), door_server_create(3C), attributes(5) SunOS 5.11 22 Mar 2005 door_bind(3C)
All times are GMT -4. The time now is 01:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy