mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-13 05:17:13 +02:00
bug fixed, rapidjson parse error
This commit is contained in:
@ -1053,6 +1053,7 @@ void UDPStandardImplementation::stopReceiver(){
|
||||
}
|
||||
|
||||
//semaphore destroy
|
||||
cout<<"gonna destroy writerguisemphore"<<endl;
|
||||
for(int i=0; i < numberofWriterThreads; i++){
|
||||
sem_destroy(&writerGuiSemaphore[i]);
|
||||
sem_destroy(&dataCallbackWriterSemaphore[i]);
|
||||
@ -1665,7 +1666,8 @@ void* UDPStandardImplementation::startWritingThread(void* this_pointer){
|
||||
|
||||
|
||||
|
||||
void UDPStandardImplementation::startDataCallback(){cprintf(MAGENTA,"start data call back thread started %d\n",currentThreadIndex);
|
||||
void UDPStandardImplementation::startDataCallback(){
|
||||
cprintf(MAGENTA,"start data call back thread started %d\n",currentThreadIndex);
|
||||
FILE_LOG(logDEBUG) << __AT__ << " called";
|
||||
|
||||
//set current thread value index
|
||||
@ -1711,6 +1713,7 @@ void UDPStandardImplementation::startDataCallback(){cprintf(MAGENTA,"start data
|
||||
|
||||
//let the writer thread continue, while we process carry over if any
|
||||
sem_post(&writerGuiSemaphore[ithread]);
|
||||
if(!ithread) cout<<"*** posted writerguisemiphore (callback)"<<endl;
|
||||
//wait for receiver to send more data
|
||||
sem_wait(&dataCallbackWriterSemaphore[ithread]);
|
||||
|
||||
@ -1723,20 +1726,24 @@ void UDPStandardImplementation::startDataCallback(){cprintf(MAGENTA,"start data
|
||||
/*if (checkJoinThread()){for different scans
|
||||
break;
|
||||
}*/
|
||||
|
||||
ostringstream header;
|
||||
header << "{\"htype\":[\"chunk-1.0\"], "
|
||||
<< "\"type\":" << "\"" << type << "\", "
|
||||
<< "\"shape\":" << shape
|
||||
<< "}";
|
||||
//cout<<ithread << "header:"<< header.str()<<endl;
|
||||
//send header
|
||||
zmq_send(zmqsocket, header.str().c_str(), header.str().length(), ZMQ_SNDMORE);
|
||||
sleep(1);
|
||||
//send data
|
||||
zmq_send (zmqsocket, "end", 3, 0);
|
||||
|
||||
pthread_mutex_lock(&statusMutex);
|
||||
dataCallbackThreadsMask^=(1<<ithread);
|
||||
pthread_mutex_unlock(&statusMutex);
|
||||
|
||||
sem_post(&writerGuiSemaphore[ithread]);
|
||||
if(!ithread) cout<<"*** posted writerguisemiphore (callback dummy)"<<endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1784,9 +1791,9 @@ void UDPStandardImplementation::startDataCallback(){cprintf(MAGENTA,"start data
|
||||
<< "\"type\":" << "\"" << type << "\", "
|
||||
<< "\"shape\":" << shape
|
||||
<< "}";
|
||||
//cout<<ithread << "header:"<< header.str()<<endl;
|
||||
//send header
|
||||
zmq_send(zmqsocket, header.str().c_str(), header.str().length(), ZMQ_SNDMORE);
|
||||
sleep(1);
|
||||
//send data
|
||||
zmq_send(zmqsocket, buffer, oneframesize, 0);
|
||||
#ifdef DEBUG
|
||||
@ -1809,9 +1816,9 @@ void UDPStandardImplementation::startDataCallback(){cprintf(MAGENTA,"start data
|
||||
<< "\"type\":" << "\"" << type << "\", "
|
||||
<< "\"shape\":" << shape
|
||||
<< "}";
|
||||
//cout<<ithread << "header:"<< header.str()<<endl;
|
||||
//send header
|
||||
zmq_send(zmqsocket, header.str().c_str(), header.str().length(), ZMQ_SNDMORE);
|
||||
sleep(1);
|
||||
//send data
|
||||
zmq_send(zmqsocket, buffer, oneframesize, 0);
|
||||
#ifdef DEBUG
|
||||
@ -1836,18 +1843,17 @@ void UDPStandardImplementation::startDataCallback(){cprintf(MAGENTA,"start data
|
||||
|
||||
}/*--end of loop for each buffer (inner loop)*/
|
||||
|
||||
//free resources
|
||||
usleep(1000*1000);
|
||||
delete[] buffer;
|
||||
zmq_unbind(zmqsocket, hostName);
|
||||
zmq_close(zmqsocket);
|
||||
zmq_ctx_destroy(context);
|
||||
|
||||
|
||||
|
||||
//end of acquisition, wait for next acquisition/change of parameters
|
||||
sem_wait(&dataCallbackSemaphore[ithread]);
|
||||
|
||||
//free resources (only at the next start so that socket not closed before client gets end of packet)
|
||||
delete[] buffer;
|
||||
zmq_unbind(zmqsocket, hostName);
|
||||
zmq_close(zmqsocket);
|
||||
zmq_ctx_destroy(context);
|
||||
|
||||
|
||||
//check to exit thread (for change of parameters) - only EXIT possibility
|
||||
if(killAllDataCallbackThreads){
|
||||
@ -2498,7 +2504,9 @@ void UDPStandardImplementation::stopWriting(int ithread, char* wbuffer){
|
||||
|
||||
if(dataStreamEnable){
|
||||
//ensure previous frame was processed
|
||||
if(!ithread) cout<<"*** waiting for writerguisemiphore (stopwriting)"<<endl;
|
||||
sem_wait(&writerGuiSemaphore[ithread]);
|
||||
if(!ithread) cout<<"*** got post for writerguisemiphore (stopwriting)"<<endl;
|
||||
guiNumPackets[ithread] = dummyPacketValue;
|
||||
//let it know its got data
|
||||
sem_post(&dataCallbackWriterSemaphore[ithread]);
|
||||
@ -2801,8 +2809,9 @@ void UDPStandardImplementation::copyFrameToGui(int ithread, char* buffer, uint32
|
||||
cprintf(GREEN,"Writing_Thread: CopyingFrame: Going to copy data\n");
|
||||
#endif
|
||||
//ensure previous frame was processed
|
||||
if(!ithread) cout<<"*** waiting for writerguisemiphore (copyfrmae)"<<endl;
|
||||
sem_wait(&writerGuiSemaphore[ithread]);
|
||||
|
||||
if(!ithread) cout<<"*** got post for writerguisemiphore (copyframe)"<<endl;
|
||||
//copy date
|
||||
guiNumPackets[ithread] = numpackets;
|
||||
strcpy(guiFileName[ithread],completeFileName[ithread]);
|
||||
|
Reference in New Issue
Block a user