- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Re: Use Pthread[CMA-F-EXIT_THREAD]
Operating System - OpenVMS
1753834
Members
8407
Online
108806
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2009 06:15 AM
08-20-2009 06:15 AM
Re: Use Pthread[CMA-F-EXIT_THREAD]
What is the declaration of szSendSocketBuf here?
memset(&szSendSocketBuf, DEFINE_NULL, sizeof(szSendSocketBuf));
I can guess what DEFINE_NULL is, but do confirm that, too.
This memcpy statement may be an innocent bystander, too; the fault could be upstream.
I'd look to examine the values here, and see if I can find some code upstream to set watchpoints or to program the debugger to detect (the debugger supports conditionals) and break on the run-up to the error.
If the buffer is shared among threads, it's possible there's a collision. Interlocking among threads is required; it seems reasonable to expect untoward application behavior when a memset goes flying past when some other thread is busy reading the buffer, for instance.
I prefer to honor errors and signals (and compiler warnings). My general preference here (and unless I have specific reasons to the contrary) is to catch an (unexpected) error and to exit the application with a diagnostic. I've worked with more than a few cases where continuing after an error has shown a nasty habit of contributing to an error avalanche, or to triggering secondary and more subtle errors, Employing "catch and release" programming with errors is certainly possible, but requires great care.
memset(&szSendSocketBuf, DEFINE_NULL, sizeof(szSendSocketBuf));
I can guess what DEFINE_NULL is, but do confirm that, too.
This memcpy statement may be an innocent bystander, too; the fault could be upstream.
I'd look to examine the values here, and see if I can find some code upstream to set watchpoints or to program the debugger to detect (the debugger supports conditionals) and break on the run-up to the error.
If the buffer is shared among threads, it's possible there's a collision. Interlocking among threads is required; it seems reasonable to expect untoward application behavior when a memset goes flying past when some other thread is busy reading the buffer, for instance.
I prefer to honor errors and signals (and compiler warnings). My general preference here (and unless I have specific reasons to the contrary) is to catch an (unexpected) error and to exit the application with a diagnostic. I've worked with more than a few cases where continuing after an error has shown a nasty habit of contributing to an error avalanche, or to triggering secondary and more subtle errors, Employing "catch and release" programming with errors is certainly possible, but requires great care.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2009 09:38 PM
08-20-2009 09:38 PM
Re: Use Pthread[CMA-F-EXIT_THREAD]
Dear Hoff~
#define DEF_SEND_MSG_LENGTH 64000
char szSendSocketBuf[DEF_SEND_MSG_LENGTH+1]; /*Send Buffer(Socket)*/
There's only stThreadParam global variable in the application, and there's 16 of QueueSyncThread threads running concurrent.
The thread structure as follows:
----------------------------------------
typedef struct
{
char szStage[10];
char szGlobalSectionName[10];
}stThreadParam;
void* QueueSyncThread(void* pstthparam)
{
char szSendSocketBuf[DEF_SEND_MSG_LENGTH+1];
...(other variables)
/*get pstthparam value to local variable Process*/
/*Read Ini Process*/
/*Socket Connect to another Host*/
/*Initial Variable(memset)*/
while(1)
{
memset(&szSendSocketBuf, DEFINE_NULL, sizeof(szSendSocketBuf));
...(initial other variables)
/*mapping global section1*/
/*mapping global section2*/
/*socket send*/
/*socket recv*/
/*mapping global section3*/
/*mapping global section1*/
}
pthread_exit(NULL);
}
----------------------------------------
I didn't use the mutex in the thread(16 threads do the same things, but mapping different global section).
May I ask all variables in QueueSyncThread is share among threads?
#define DEF_SEND_MSG_LENGTH 64000
char szSendSocketBuf[DEF_SEND_MSG_LENGTH+1]; /*Send Buffer(Socket)*/
There's only stThreadParam global variable in the application, and there's 16 of QueueSyncThread threads running concurrent.
The thread structure as follows:
----------------------------------------
typedef struct
{
char szStage[10];
char szGlobalSectionName[10];
}stThreadParam;
void* QueueSyncThread(void* pstthparam)
{
char szSendSocketBuf[DEF_SEND_MSG_LENGTH+1];
...(other variables)
/*get pstthparam value to local variable Process*/
/*Read Ini Process*/
/*Socket Connect to another Host*/
/*Initial Variable(memset)*/
while(1)
{
memset(&szSendSocketBuf, DEFINE_NULL, sizeof(szSendSocketBuf));
...(initial other variables)
/*mapping global section1*/
/*mapping global section2*/
/*socket send*/
/*socket recv*/
/*mapping global section3*/
/*mapping global section1*/
}
pthread_exit(NULL);
}
----------------------------------------
I didn't use the mutex in the thread(16 threads do the same things, but mapping different global section).
May I ask all variables in QueueSyncThread is share among threads?
- « Previous
-
- 1
- 2
- Next »
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP