[SVN-NetXMS] revision 3307

From: NetXMS.org SVN Server <svn_at_DOMAIN_REMOVED>
Date: Mon, 16 Jun 2008 00:00:23 +0300

* { font-family: Consolas, Lucida Console, Courier New; font-size: 100%; }
h1 { font-size: 150%; }
td.linenos { background-color: #f0f0f0; padding-right: 10px; }
span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; }
pre { line-height: 100%; width: 100%; }
.highlight span { width: 100%; display:-moz-inline-stack; display:inline-block; zoom:1; *display:inline; }
body { background: #ffffff; }
body .c { color: #999988; font-style: italic } /* Comment */
body .err { color: #a61717; background-color: #e3d2d2 } /* Error */
body .k { font-weight: bold } /* Keyword */
body .o { font-weight: bold } /* Operator */
body .cm { color: #999988; font-style: italic } /* Comment.Multiline */
body .cp { color: #999999; font-weight: bold } /* Comment.Preproc */
body .c1 { color: #999988; font-style: italic } /* Comment.Single */
body .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */
body .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
body .ge { font-style: italic } /* Generic.Emph */
body .gr { color: #aa0000 } /* Generic.Error */
body .gh { color: #999999 } /* Generic.Heading */
body .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
body .go { color: #888888 } /* Generic.Output */
body .gp { color: #555555 } /* Generic.Prompt */
body .gs { font-weight: bold } /* Generic.Strong */
body .gu { color: #aaaaaa } /* Generic.Subheading */
body .gt { color: #aa0000 } /* Generic.Traceback */
body .kc { font-weight: bold } /* Keyword.Constant */
body .kd { font-weight: bold } /* Keyword.Declaration */
body .kp { font-weight: bold } /* Keyword.Pseudo */
body .kr { font-weight: bold } /* Keyword.Reserved */
body .kt { color: #445588; font-weight: bold } /* Keyword.Type */
body .m { color: #009999 } /* Literal.Number */
body .s { color: #bb8844 } /* Literal.String */
body .na { color: #008080 } /* Name.Attribute */
body .nb { color: #999999 } /* Name.Builtin */
body .nc { color: #445588; font-weight: bold } /* Name.Class */
body .no { color: #008080 } /* Name.Constant */
body .ni { color: #800080 } /* Name.Entity */
body .ne { color: #990000; font-weight: bold } /* Name.Exception */
body .nf { color: #990000; font-weight: bold } /* Name.Function */
body .nn { color: #555555 } /* Name.Namespace */
body .nt { color: #000080 } /* Name.Tag */
body .nv { color: #008080 } /* Name.Variable */
body .ow { font-weight: bold } /* Operator.Word */
body .w { color: #bbbbbb } /* Text.Whitespace */
body .mf { color: #009999 } /* Literal.Number.Float */
body .mh { color: #009999 } /* Literal.Number.Hex */
body .mi { color: #009999 } /* Literal.Number.Integer */
body .mo { color: #009999 } /* Literal.Number.Oct */
body .sb { color: #bb8844 } /* Literal.String.Backtick */
body .sc { color: #bb8844 } /* Literal.String.Char */
body .sd { color: #bb8844 } /* Literal.String.Doc */
body .s2 { color: #bb8844 } /* Literal.String.Double */
body .se { color: #bb8844 } /* Literal.String.Escape */
body .sh { color: #bb8844 } /* Literal.String.Heredoc */
body .si { color: #bb8844 } /* Literal.String.Interpol */
body .sx { color: #bb8844 } /* Literal.String.Other */
body .sr { color: #808000 } /* Literal.String.Regex */
body .s1 { color: #bb8844 } /* Literal.String.Single */
body .ss { color: #bb8844 } /* Literal.String.Symbol */
body .bp { color: #999999 } /* Name.Builtin.Pseudo */
body .vc { color: #008080 } /* Name.Variable.Class */
body .vg { color: #008080 } /* Name.Variable.Global */
body .vi { color: #008080 } /* Name.Variable.Instance */
body .il { color: #009999 } /* Literal.Number.Integer.Long */

Info

Revision:3307
Author:victor

Date:2008-06-16 00:00:22 +0300 (Mon, 16 Jun 2008)

Comment:minor changes

Changes
U trunk/include/nms_agent.h
U trunk/include/nms_threads.h
U trunk/src/agent/core/subagent.cpp

Diff
Modified: trunk/include/nms_agent.h
===================================================================
--- trunk/include/nms_agent.h 2008-06-13 21:09:57 UTC (rev 3306)
+++ trunk/include/nms_agent.h 2008-06-15 21:00:22 UTC (rev 3307)
@@ -89,6 +89,7 @@
 #define ERR_MAILFORMED_COMMAND ((DWORD)911)
 #define ERR_SOCKET_ERROR ((DWORD)912)
 #define ERR_BAD_ARGUMENTS ((DWORD)913)
+#define ERR_SUBAGENT_LOAD_FAILED ((DWORD)914)
 
 
 //

Modified: trunk/include/nms_threads.h
===================================================================
--- trunk/include/nms_threads.h 2008-06-13 21:09:57 UTC (rev 3306)
+++ trunk/include/nms_threads.h 2008-06-15 21:00:22 UTC (rev 3307)
@@ -1,6 +1,6 @@
 /*
 ** NetXMS - Network Management System
-** Copyright (C) 2003 Victor Kirhenshtein
+** Copyright (C) 2003-2008 Victor Kirhenshtein
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@
 ** along with this program; if not, write to the Free Software
 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 **
-** $module: nms_threads.h
+** File: nms_threads.h
 **
 **/
 
@@ -37,10 +37,6 @@
 // Related datatypes and constants
 //
 
-typedef HANDLE MUTEX;
-typedef HANDLE THREAD;
-typedef HANDLE CONDITION;
-
 #define INVALID_MUTEX_HANDLE INVALID_HANDLE_VALUE
 #define INVALID_CONDITION_HANDLE INVALID_HANDLE_VALUE
 #define INVALID_THREAD_HANDLE (NULL)
@@ -60,6 +56,15 @@
 #else
 #define THREAD_CALL __stdcall
 
+typedef HANDLE MUTEX;
+typedef HANDLE CONDITION;
+struct netxms_thread_t
+{
+ HANDLE handle;
+ THREAD_ID id;
+};
+typedef struct netxms_thread_t *THREAD;
+
 typedef struct
 {
         THREAD_RESULT (THREAD_CALL *start_address)(void *);
@@ -119,16 +124,26 @@
 
 inline THREAD ThreadCreateEx(THREAD_RESULT (THREAD_CALL *start_address)(void *), int stack_size, void *args)
 {
- THREAD_ID dwThreadId;
+ THREAD thread;
 
+ thread = (THREAD)malloc(sizeof(struct netxms_thread_t));
 #ifdef UNDER_CE
- return CreateThread(NULL, (DWORD)stack_size, start_address, args, 0, &amp;dwThreadId);
+ thread-&gt;handle = CreateThread(NULL, (DWORD)stack_size, start_address, args, 0, &amp;thread-&gt;id);
+ if (thread-&gt;handle == NULL)
+ {
 #else
         THREAD_START_DATA *data = (THREAD_START_DATA *)malloc(sizeof(THREAD_START_DATA));
         data-&gt;start_address = start_address;
         data-&gt;args = args;
- return (HANDLE)_beginthreadex(NULL, stack_size, SEHThreadStarter, data, 0, &amp;dwThreadId);
+ thread-&gt;handle = (HANDLE)_beginthreadex(NULL, stack_size, SEHThreadStarter, data, 0, &amp;thread-&gt;id);
+ if ((thread-&gt;handle == (HANDLE)-1) || (thread-&gt;handle == 0))
+ {
+ free(data);
 #endif
+ free(thread);
+ thread = INVALID_THREAD_HANDLE;
+ }
+ return thread;
 }
 
 inline void ThreadExit(void)
@@ -140,15 +155,21 @@
 #endif
 }
 
-inline void ThreadJoin(THREAD hThread)
+inline void ThreadJoin(THREAD thread)
 {
- if (hThread != INVALID_THREAD_HANDLE)
+ if (thread != INVALID_THREAD_HANDLE)
    {
- WaitForSingleObject(hThread, INFINITE);
- CloseHandle(hThread);
+ WaitForSingleObject(thread-&gt;handle, INFINITE);
+ CloseHandle(thread-&gt;handle);
+ free(thread);
    }
 }
 
+inline THREAD_ID ThreadId(THREAD thread)
+{
+ return (thread != INVALID_THREAD_HANDLE) ? thread-&gt;id : 0;
+}
+
 inline MUTEX MutexCreate(void)
 {
    return CreateMutex(NULL, FALSE, NULL);

Modified: trunk/src/agent/core/subagent.cpp
===================================================================
--- trunk/src/agent/core/subagent.cpp 2008-06-13 21:09:57 UTC (rev 3306)
+++ trunk/src/agent/core/subagent.cpp 2008-06-15 21:00:22 UTC (rev 3307)
@@ -1,6 +1,6 @@
 /*
 ** NetXMS multiplatform core agent
-** Copyright (C) 2003, 2004, 2005, 2006, 2007 Victor Kirhenshtein
+** Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Victor Kirhenshtein
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
Received on Mon Jun 16 2008 - 00:00:23 EEST

This archive was generated by hypermail 2.2.0 : Sun Jun 15 2008 - 23:56:44 EEST