28.10.2014 Views

Synergy User Manual and Tutorial. - THE CORE MEMORY

Synergy User Manual and Tutorial. - THE CORE MEMORY

Synergy User Manual and Tutorial. - THE CORE MEMORY

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Synergy</strong> <strong>User</strong> <strong>Manual</strong> <strong>and</strong> <strong>Tutorial</strong><br />

}<br />

// Read problem from problem tuple space<br />

tplength = cnf_tsget(tsd, tpname, &num, 0);<br />

// Record the data type received<br />

strcpy(sendMsg, tpname);<br />

// Display the data<br />

printf("Worker: took %s '%d'\n", tpname, num);<br />

// Send reply back to master<br />

// Set size of entry<br />

tplength = sizeof(sendMsg);<br />

// Set name to host<br />

strcpy(tpname, host);<br />

printf("Worker: Put '%s' Length %d Name %s\n",<br />

sendMsg, tplength, tpname);<br />

// Put response in result tuple space<br />

status = cnf_tsput(res, tpname, sendMsg, tplength);<br />

printf("Worker: Reply sent\n");<br />

// Get int lnum from ts<br />

else if(!strcmp(tpname, "D_lnum")){<br />

// Read problem from problem tuple space<br />

tplength = cnf_tsget(tsd, tpname, &lnum, 0);<br />

// Record the data type recieve<br />

strcpy(sendMsg, tpname);<br />

// Display the data<br />

printf("Worker: took %s '%ld'\n", tpname, lnum);<br />

// Send reply back to master<br />

// Set size of entry<br />

tplength = sizeof(sendMsg);<br />

// Set name to host<br />

strcpy(tpname, host);<br />

printf("Worker: Put '%s' Length %d Name %s\n",<br />

sendMsg, tplength, tpname);<br />

// Put response in result tuple space<br />

status = cnf_tsput(res, tpname, sendMsg, tplength);<br />

printf("Worker: Reply sent\n");<br />

}<br />

// Get int frac from ts<br />

else if(!strcmp(tpname, "D_frac")){<br />

// Read problem from problem tuple space<br />

tplength = cnf_tsget(tsd, tpname, &frac, 0);<br />

// Record the data type received<br />

strcpy(sendMsg, tpname);<br />

// Display the data<br />

printf("Worker: took %s '%f'\n", tpname, frac);<br />

// Send reply back to master<br />

// Set size of entry<br />

tplength = sizeof(sendMsg);<br />

// Set name to host<br />

strcpy(tpname, host);<br />

printf("Worker: Put '%s' Length %d Name %s\n",<br />

sendMsg, tplength, tpname);<br />

// Put response in result tuple space<br />

status = cnf_tsput(res, tpname, sendMsg, tplength);<br />

printf("Worker: Reply sent\n");<br />

145

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!