Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include <sys/types.h>
00016 #include <sys/ipc.h>
00017 #include <sys/msg.h>
00018 #include <errno.h>
00019 #include <string.h>
00020
00021
00022 #include "FWCore/Framework/interface/MessageReceiverForSource.h"
00023 #include "FWCore/Framework/src/MessageForSource.h"
00024 #include "FWCore/Utilities/interface/Exception.h"
00025
00026 using namespace edm::multicore;
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 MessageReceiverForSource::MessageReceiverForSource(int iQueueID):
00039 m_queueID(iQueueID),
00040 m_startIndex(0),
00041 m_numberOfConsecutiveIndices(0),
00042 m_numberToSkip(0)
00043 {
00044 }
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081 void
00082 MessageReceiverForSource::receive()
00083 {
00084 unsigned long previousStartIndex = m_startIndex;
00085 unsigned long previousConsecutiveIndices = m_numberOfConsecutiveIndices;
00086
00087
00088
00089
00090
00091
00092
00093
00094 MessageForSource message;
00095 errno = 0;
00096 int value = msgrcv(m_queueID, &message, MessageForSource::sizeForBuffer(), MessageForSource::messageType(), 0);
00097 if (value < 0 ) {
00098 m_numberOfConsecutiveIndices=0;
00099 throw cms::Exception("MulticoreCommunicationFailure")<<"failed to receive data from controller: errno="<<errno<<" : "<<strerror(errno);
00100 }
00101 m_startIndex = message.startIndex;
00102 m_numberOfConsecutiveIndices = message.nIndices;
00103
00104 m_numberToSkip = m_startIndex-previousStartIndex-previousConsecutiveIndices;
00105 return;
00106 }
00107
00108
00109
00110
00111
00112
00113
00114