02-15-2011
Quote:
Originally Posted by
zing_foru
Hi all,
Can I create multiple threads using single thread_id
pthread_create does not
take a thread ID, it
overwrites the value of thread_id. That's why it's a pointer, you're telling it what memory to overwrite.
So you could create lots with the same variable, but you'd just be overwriting the same value every time and losing track of everything but the last created thread, not creating threads with the same ID.
8 More Discussions You Might Find Interesting
1. IP Networking
Hi All,
Please explain me when i have to use multiple process and when I have to use Multiple threads? Please give me an example.It will be very helpful for me.
Thanks in advance. (0 Replies)
Discussion started by: ashleykumar
0 Replies
2. IP Networking
Hi Friends,
I have written a program which will listener for more than 1000 requests per second from a single socket descriptor and then it will process those requestes. Its taking X amount of time. Now i want to reduce that time. Will I can write multiple threads to receive the... (2 Replies)
Discussion started by: pa.chidhambaram
2 Replies
3. Solaris
We're just migrating a large application from a Sun E6900 to T5440. One of the component parts is not playing, and despite a pretty detailed truss trace, it's not obvious why we're getting a SEGV fault! Just wondering if it's running multithreaded and the threads are getting mixed up, so 2... (1 Reply)
Discussion started by: JerryHone
1 Replies
4. Shell Programming and Scripting
Hi,
I have a requirement with,
No~Dt~Notes
1~2011/08/1~"aaa
bbb
ccc
ddd
eee
fff
ggg
hhh"
Single column alone got splitted into multiple lines.
I require the output as
No~Dt~Notes
1~2011/08/1~"aaa<>bbb<>ccc<>ddd<>eee<>fff<>ggg<>hhh"
mean to say those new lines to be... (1 Reply)
Discussion started by: Bhuvaneswari
1 Replies
5. Programming
I have a simple client/server program I am using for learning purposes.
I have it setup so that after server is setup and listening it than goes into a loop where it accepts incoming client connections. After each connection, the client socket is than passed to a thread routine where it can be... (3 Replies)
Discussion started by: Majortom71
3 Replies
6. Shell Programming and Scripting
Hi friends,
I have a some files in a directory. for example
856-abc
856-def
851-abc
945-def
956-abc
852-abc
i want to display only those files whose name starts with 856* 945* and 851* using a single pattern.
i.e
856-abc
856-def
851-abc
945-def
the rest of the two files... (2 Replies)
Discussion started by: Little
2 Replies
7. UNIX for Advanced & Expert Users
I would like to know is there any we can kill a single thread among multiple threads belongs to process?
Since Signal action is process wise not per thread, i strongly feel that we can not or for that mater from external sources as well single thread can not be killed which is critical section... (2 Replies)
Discussion started by: murali242512
2 Replies
8. HP-UX
Hi All,
When i was trying to get total number of threads per java process using this command ps -o NLWP PID, I'm not getting any output. Could someone help me in this issue.
Thanks,
GMar (1 Reply)
Discussion started by: mgangumolu
1 Replies
LEARN ABOUT PHP
maxdb_thread_id
MAXDB_THREAD_ID(3) 1 MAXDB_THREAD_ID(3)
maxdb_thread_id - Returns the thread ID for the current connection
Procedural style
SYNOPSIS
int maxdb_thread_id (resource $link)
DESCRIPTION
Object oriented style
int$maxdb->thread_id ()
The maxdb_thread_id(3) function returns the thread ID for the current connection which can then be killed using the maxdb_kill(3) func-
tion. If the connection is lost and you reconnect with maxdb_ping(3), the thread ID will be other. Therefore you should get the thread ID
only when you need it.
Note
The thread ID is assigned on a connection-by-connection basis. Hence, if the connection is broken and then re-established a new
thread ID will be assigned.
RETURN VALUES
maxdb_thread_id(3) returns the Thread ID for the current connection.
EXAMPLES
Example #1
Object oriented style
<?php
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
/* check connection */
if (maxdb_connect_errno()) {
printf("Connect failed: %s
", maxdb_connect_error());
exit();
}
/* determine our thread id */
$thread_id = $maxdb->thread_id;
/* Kill connection */
$maxdb->kill($thread_id);
/* This should produce an error */
if (!$maxdb->query("CREATE TABLE mycity LIKE hotel.city")) {
printf("Error: %s
", $maxdb->error);
exit;
}
/* close connection */
$maxdb->close();
?>
Example #2
Procedural style
<?php
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
/* check connection */
if (maxdb_connect_errno()) {
printf("Connect failed: %s
", maxdb_connect_error());
exit();
}
/* determine our thread id */
$thread_id = maxdb_thread_id($link);
/* Kill connection */
maxdb_kill($link, $thread_id);
/* This should produce an error */
if (!maxdb_query($link, "CREATE TABLE mycity LIKE hotel.city")) {
printf("Error: %s
", maxdb_error($link));
exit;
}
/* close connection */
maxdb_close($link);
?>
The above example will output something similar to:
Warning: maxdb_query(): -10821 Session not connected <...>
Error: Session not connected
SEE ALSO
maxdb_kill(3).
PHP Documentation Group MAXDB_THREAD_ID(3)