pkarashchenko commented on code in PR #2468:
URL: https://github.com/apache/nuttx-apps/pull/2468#discussion_r1704964623
##########
testing/memstress/memorystress_main.c:
##########
@@ -448,14 +455,40 @@ static void init(FAR struct memorystress_context_s
*context, int argc,
{
free(func);
free(config);
- free(context->node_array);
syslog(LOG_ERR, MEMSTRESS_PREFIX "Malloc Node Array Failed\n");
exit(EXIT_FAILURE);
}
+ context->threads = zalloc(context->nthreads * sizeof(pthread_t));
+ if (context->threads == NULL)
+ {
+ free(func);
+ free(config);
+ free(context->node_array);
+ syslog(LOG_ERR, MEMSTRESS_PREFIX "Malloc threads Failed\n");
+ exit(EXIT_FAILURE);
+ }
+
srand(time(NULL));
}
+/****************************************************************************
+ * Name: memorystress_thread
+ ****************************************************************************/
+
+FAR void *memorystress_thread(void *arg)
+{
+ FAR struct memorystress_context_s *context;
+
+ context = (struct memorystress_context_s *)arg;
Review Comment:
```suggestion
context = (FAR struct memorystress_context_s *)arg;
```
##########
testing/memstress/memorystress_main.c:
##########
@@ -448,14 +455,40 @@ static void init(FAR struct memorystress_context_s
*context, int argc,
{
free(func);
free(config);
- free(context->node_array);
syslog(LOG_ERR, MEMSTRESS_PREFIX "Malloc Node Array Failed\n");
exit(EXIT_FAILURE);
}
+ context->threads = zalloc(context->nthreads * sizeof(pthread_t));
+ if (context->threads == NULL)
+ {
+ free(func);
+ free(config);
+ free(context->node_array);
+ syslog(LOG_ERR, MEMSTRESS_PREFIX "Malloc threads Failed\n");
+ exit(EXIT_FAILURE);
+ }
+
srand(time(NULL));
}
+/****************************************************************************
+ * Name: memorystress_thread
+ ****************************************************************************/
+
+FAR void *memorystress_thread(void *arg)
Review Comment:
```suggestion
FAR void *memorystress_thread(FAR void *arg)
```
##########
testing/memstress/memorystress_main.c:
##########
@@ -100,7 +100,9 @@ struct memorystress_context_s
struct memorystress_node_s *node_array;
struct memorystress_config_s *config;
struct memorystress_error_s error;
+ pthread_t *threads;
Review Comment:
```suggestion
FAR pthread_t *threads;
```
##########
testing/memstress/memorystress_main.c:
##########
@@ -100,7 +100,9 @@ struct memorystress_context_s
struct memorystress_node_s *node_array;
Review Comment:
```suggestion
FAR struct memorystress_node_s *node_array;
```
##########
testing/memstress/memorystress_main.c:
##########
@@ -100,7 +100,9 @@ struct memorystress_context_s
struct memorystress_node_s *node_array;
struct memorystress_config_s *config;
Review Comment:
```suggestion
FAR struct memorystress_config_s *config;
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]