EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  <20162017  2018  2019  2020  2021  2022  2023  2024  Index 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  <20162017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: [PATCH RFC] Fix race when creating opMsgQueue
From: Henrique Dante de Almeida <[email protected]>
To: [email protected]
Cc: Henrique Dante de Almeida <[email protected]>
Date: Thu, 28 Jan 2016 16:30:20 -0200
The message queue is the shared resource between threads, so
create it before any thread needs to use it, including the
main thread.

This fixes the segmentation fault that may happen by calling
the command fdbrestore in st.cmd right after create_*_set.
---
 asApp/src/save_restore.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/asApp/src/save_restore.c b/asApp/src/save_restore.c
index 7717a4f..0998545 100644
--- a/asApp/src/save_restore.c
+++ b/asApp/src/save_restore.c
@@ -828,7 +828,6 @@ STATIC int save_restore(void)
 	if (save_restoreDebug > 1)
 			printf("save_restore:save_restore: entry; status_prefix='%s'\n", status_prefix);
 
-	opMsgQueue = epicsMessageQueueCreate(OP_MSG_QUEUE_SIZE, OP_MSG_SIZE);
 	epicsTimeGetCurrent(&currTime);
 	last_seq_check = remount_check_time = currTime; /* struct copy */
 
@@ -2150,6 +2149,7 @@ STATIC int create_data_set(
 			printf("save_restore:create_data_set: could not create list header mutex");
 			return(ERROR);
 		}
+		opMsgQueue = epicsMessageQueueCreate(OP_MSG_QUEUE_SIZE, OP_MSG_SIZE);
 		taskID = epicsThreadCreate("save_restore", taskPriority,
 			epicsThreadGetStackSize(epicsThreadStackBig),
 			(EPICSTHREADFUNC)save_restore, 0);
-- 
2.2.0.rc1.18.gf6f61cb


Navigate by Date:
Prev: Re: Autosave called epicsMessageQueueSend with opMsgQueue==NULL Henrique Almeida
Next: Jenkins build became unstable: epics-base-3.16 #57 APS Jenkins
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  <20162017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: Autosave called epicsMessageQueueSend with opMsgQueue==NULL Henrique Almeida
Next: Jenkins build became unstable: epics-base-3.16 #57 APS Jenkins
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  <20162017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 08 Feb 2016 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·