Sponsored Content
Top Forums Programming creating multiple threads using single thread id Post 302496765 by zing_foru on Tuesday 15th of February 2011 08:06:58 AM
Old 02-15-2011
creating multiple threads using single thread id

Hi all,

Can I create multiple threads using single thread_id

like

Code:
pthread_t thread_id;
pthread_create(&thread_id, NULL, &print_xs, NULL);
pthread_create(&thread_id, NULL, &print_ys, NULL);
pthread_create(&thread_id, NULL, &print_zs, NULL);
pthread_join(thread_id, NULL);

what will be the impact of this? please suggest...

Thanks......
 

8 More Discussions You Might Find Interesting

1. IP Networking

How to choose Multiple process or Multiple threads?

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

Can we write a multiple thread to receive from a single socket file descriptor

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

Run in single thread

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

Multiple lines in a single column to be merged as a single line for a record

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

Child threads communicating with main thread via pipes

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

Creating single pattern for matching multiple files.

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

How to kill a thread among several threads belongs to a process?

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

How to get number of threads for single java process on HP-UX OS?

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
MYSQLND_MS_GET_LAST_USED_CONNECTION(3)					 1				    MYSQLND_MS_GET_LAST_USED_CONNECTION(3)

mysqlnd_ms_get_last_used_connection - Returns an array which describes the last used connection

SYNOPSIS
array mysqlnd_ms_get_last_used_connection (mixed $connection) DESCRIPTION
Returns an array which describes the last used connection from the plugins connection pool currently pointed to by the user connection handle. If using the plugin, a user connection handle represents a pool of database connections. It is not possible to tell from the user connection handles properties to which database server from the pool the user connection handle points. The function can be used to debug or monitor PECL mysqlnd_ms. PARAMETERS
o $connection - A MySQL connection handle obtained from any of the connect functions of the mysqli, mysql or PDO_MYSQL extensions. RETURN VALUES
FALSE on error. Otherwise, an array which describes the connection used to execute the last statement on. Array which describes the connection. +---------------+--------------------------------------+---+ | Property | | | | | | | | | Description | | | | | | | | Version | | | | | | +---------------+--------------------------------------+---+ | | | | | scheme | | | | | | | | | Connection scheme. Either | | | | tcp://host:port or | | | | unix://host:socket. If you want to | | | | distinguish connections from each | | | | other use a combination of scheme | | | | and thread_id as a unique key. Nei- | | | | ther scheme nor thread_id alone are | | | | sufficient to distinguish two con- | | | | nections from each other. Two | | | | servers may assign the same | | | | thread_id to two different connec- | | | | tions. Thus, connections in the pool | | | | may have the same thread_id. Also, | | | | do not rely on uniqueness of scheme | | | | in a pool. Your QA engineers may use | | | | the same MySQL server instance for | | | | two distinct logical roles and add | | | | it multiple times to the pool. This | | | | hack is used, for example, in the | | | | test suite. | | | | | | | | Since 1.1.0. | | | | | | | | | | | host | | | | | | | | | Database server host used with the | | | | connection. The host is only set | | | | with TCP/IP connections. It is empty | | | | with Unix domain or Windows named | | | | pipe connections, | | | | | | | | Since 1.1.0. | | | | | | | | | | | host_info | | | | | | | | | A character string representing the | | | | server hostname and the connection | | | | type. | | | | | | | | Since 1.1.2. | | | | | | | | | | | port | | | | | | | | | Database server port used with the | | | | connection. | | | | | | | | Since 1.1.0. | | | | | | | | | | |socket_or_pipe | | | | | | | | | Unix domain socket or Windows named | | | | pipe used with the connection. The | | | | value is empty for TCP/IP connec- | | | | tions. | | | | | | | | Since 1.1.2. | | | | | | | | | | | thread_id | | | | | | | | | Connection thread id. | | | | | | | | Since 1.1.0. | | | | | | | | | | | last_message | | | | | | | | | Info message obtained from the | | | | MySQL C API function mysql_info(). | | | | Please, see mysqli_info(3) for a | | | | description. | | | | | | | | Since 1.1.0. | | | | | | | | | | | errno | | | | | | | | | Error code. | | | | | | | | Since 1.1.0. | | | | | | | | | | | error | | | | | | | | | Error message. | | | | | | | | Since 1.1.0. | | | | | | | | | | | sqlstate | | | | | | | | | Error SQLstate code. | | | | | | | | Since 1.1.0. | | | | | | +---------------+--------------------------------------+---+ NOTES
Note mysqlnd_ms_get_last_used_connection(3) requires PHP >= 5.4.0 and PECL mysqlnd_ms >> 1.1.0. Internally, it is using a mysqlnd library C call not available with PHP 5.3. EXAMPLES
The example assumes that myapp refers to a plugin configuration file section and represents a connection pool. Example #1 mysqlnd_ms_get_last_used_connection(3) example <?php $link = new mysqli("myapp", "user", "password", "database"); $res = $link->query("SELECT 1 FROM DUAL"); var_dump(mysqlnd_ms_get_last_used_connection($link)); ?> The above example will output: array(10) { ["scheme"]=> string(22) "unix:///tmp/mysql.sock" ["host_info"]=> string(25) "Localhost via UNIX socket" ["host"]=> string(0) "" ["port"]=> int(3306) ["socket_or_pipe"]=> string(15) "/tmp/mysql.sock" ["thread_id"]=> int(46253) ["last_message"]=> string(0) "" ["errno"]=> int(0) ["error"]=> string(0) "" ["sqlstate"]=> string(5) "00000" } PHP Documentation Group MYSQLND_MS_GET_LAST_USED_CONNECTION(3)
All times are GMT -4. The time now is 06:30 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy