CGI-SpeedyCGI

 view release on metacpan or  search on metacpan

src/speedy_frontend.c  view on Meta::CPAN

    /* Install sig handlers */
    sig_handler_setup();

    /* Put ourself at the end of the fe queue */
    speedy_slot_append(fslotnum,
	&(FILE_SLOT(gr_slot, gslotnum).fe_head),
	&(FILE_SLOT(gr_slot, gslotnum).fe_tail));

    while (1) {
	/* Send signals to frontends */
	speedy_group_sendsigs(gslotnum);

	sent_sig = FILE_SLOT(fe_slot, fslotnum).sent_sig;
	FILE_SLOT(fe_slot, fslotnum).sent_sig = 0;

	/* If our sent_sig flag is set, and there are be's for us to use ,
	 * then all done.
	*/
	if (sent_sig &&
	    (*bslotnum = speedy_backend_be_wait_get(gslotnum)))
	{

src/speedy_group.c  view on Meta::CPAN

    pid_t be_pid = gslot->be_starting;

    if (be_pid) {
	if (speedy_util_kill(be_pid, 0) != -1)
	    return be_pid;
	gslot->be_starting = 0;
    }
    return 0;
}

void speedy_group_sendsigs(slotnum_t gslotnum) {
    gr_slot_t *gslot = &FILE_SLOT(gr_slot, gslotnum);
    slotnum_t fslotnum, bslotnum;

    /* Get first slot in the fe list */
    fslotnum = gslot->fe_head;

    /* Loop over each backend slot in the wait list */
    for (bslotnum = gslot->be_head;
	 bslotnum && fslotnum && !FILE_SLOT(be_slot, bslotnum).fe_running;
         bslotnum = speedy_slot_next(bslotnum))

src/speedy_group.h  view on Meta::CPAN

 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 */

void speedy_group_invalidate(slotnum_t gslotnum);
void speedy_group_sendsigs(slotnum_t gslotnum);
void speedy_group_cleanup(slotnum_t gslotnum);
int speedy_group_connect_locked(slotnum_t gslotnum);
slotnum_t speedy_group_create(void);
pid_t speedy_group_be_starting(slotnum_t gslotnum);
int speedy_group_parent_sig(slotnum_t gslotnum, int sig);
int speedy_group_start_be(slotnum_t gslotnum);
int speedy_group_lock(slotnum_t gslotnum);

#define speedy_group_name_match(gslotnum) \
    (FILE_SLOT(gr_slot, (gslotnum)).name_slot && \

src/speedy_perl.c  view on Meta::CPAN

	FILE_SLOT(be_slot, bslotnum).maturity = numrun ? 2 : 1;

	/* Put ourself onto the be_wait list */
	speedy_backend_be_wait_put(gslotnum, bslotnum);

	/* If we were listed as starting, turn that off */
	if (FILE_SLOT(gr_slot, gslotnum).be_starting == speedy_util_getpid())
	    FILE_SLOT(gr_slot, gslotnum).be_starting = 0;

	/* Send out alarm signal to frontends */
	speedy_group_sendsigs(gslotnum);

	/* Fix our listener fd */
	speedy_ipc_listen_fixfd(bslotnum);

	/* Unlock file */
	speedy_file_set_state(FS_HAVESLOTS);

	/* Do an accept on our socket */
	backend_accept();

	/* Lock file.  If our group is invalid, exit quietly */
	if (!speedy_group_lock(gslotnum))
	    all_done();

	/* If we were listed as starting, turn that off */
	if (FILE_SLOT(gr_slot, gslotnum).be_starting == speedy_util_getpid())
	    FILE_SLOT(gr_slot, gslotnum).be_starting = 0;

	/* Wake up any waiting frontends */
	speedy_group_sendsigs(gslotnum);

	/* Unlock the file */
	speedy_file_set_state(FS_HAVESLOTS);

	/* Run the perl code once */
	exit_val = onerun(single_script);

	/* Send the exit status to the frontend */
	speedy_file_set_state(FS_CORRUPT);
	speedy_backend_exited(bslotnum, 0, exit_val);



( run in 0.726 second using v1.01-cache-2.11-cpan-71847e10f99 )