 a powerful display of unity and caring.
“But families are busy!” you say. I know, trust me, I know. Yet, we must make the time whether it’s an hour, a couple of commitment. year-round.
In Stockton, the Stockton/San Joaquin Emergency Food Bank and Reinvent South Stockton Coalition, for example, offer volunteer activities the whole family can participate in.
If you are volunteering now, read this post to Maximize Your Volunteering Efforts.
You must log in to post a comment.Yayiee! There's one good news for all PeeCee fans out there. Avengers: Endgame co-director, Joe Russo admits that he is in talks with Priyanka Chopra for a project. "Priyanka is transitioning into global status now. She is fantastic... (I would) Love to work with her... I am potentially talking to Priyanka for something. I am not going to say what it is," said Russo in a group interview in Mumbai.
Last year, Marvel Studios chief Kevin Feige had said that they are planning to make a standalone on superhero Ms Marvel aka Kamala Khan. After the news broke, many fans on social media expressed their desire to see Priyanka playing the character of Marvel's first Muslim superhero.
Russo also revealed that the climax of Marvel's 2015 film Avengers: Age of Ultron almost had a scene inspired by Rajinikanth's 2010 blockbuster Robot (Enthiran).
Why Kangana Ranaut's Panga Taking Longer To Complete?
He was quoted as saying, "'Robot' almost influenced the climatic moments in 'Avengers: Age of Ultron'... In one of the final scenes all the Ultrons were suppose to form a large Ultron and Avengers were set to fight that but the sequence got cut for time. It was this close. I was inspired directly by 'Robot'."
/*
 * This file is part of the Screentouch project. It is subject to the GPLv3
 * license terms in the LICENSE file found in the top-level directory of this
 * distribution and at
 * https://github.com/jjackowski/screentouch/blob/master/LICENSE.
 * No part of the Screentouch project, including this file, may be copied,
 * modified, propagated, or distributed except according to the terms
 * contained in the LICENSE file.
 *
 * Copyright (C) 2020  Jeff Jackowski
 */
#include <boost/exception/errinfo_errno.hpp>
#include <duds/os/linux/Poller.hpp>
#include <duds/general/Errors.hpp>
#include <assert.h>

namespace duds { namespace os { namespace linux {

Poller::Poller(int reserveSize) {
	epfd = epoll_create(1);
	if (epfd < 0) {
		DUDS_THROW_EXCEPTION(PollerCreateError() <<
			boost::errinfo_errno(errno)
		);
	}
	if (reserveSize) {
		responders.reserve(reserveSize);
		flist.reserve(reserveSize);
	}
}

Poller::Poller(Poller &&p) :
responders(std::move(p.responders)),
flist(std::move(p.flist)),
epfd(p.epfd) {
	p.epfd = -1;
}

Poller::~Poller() {
	std::lock_guard<std::mutex> lock(block);
	close(epfd);
}

Poller &Poller::operator=(Poller &&p) noexcept {
	std::lock_guard<std::mutex> lock(block);
	std::lock_guard<std::mutex> plock(p.block);
	responders = std::move(p.responders);
	flist = std::move(flist);
	epfd = p.epfd;
	p.epfd = -1;
	return *this;
}

void Poller::add(const PollResponderSptr &prs, int fd, int events) {
	if (!prs) {
		DUDS_THROW_EXCEPTION(PollResponderDoesNotExist());
	}
	epoll_event event;
	event.events = events;
	std::lock_guard<std::mutex> lock(block);
	// set event.data.u32 to the index inside responders that will hold the
	// responder record for this file descriptor
	if (flist.empty()) {
		event.data.u32 = responders.size();
	} else {
		event.data.u32 = flist.back();
	}
	if (epoll_ctl(epfd, EPOLL_CTL_ADD, fd, &event)) {
		DUDS_THROW_EXCEPTION(PollerError() <<
			boost::errinfo_errno(errno) << PollerFileDescriptor(fd)
		);
	}
	// put the responder record in place
	if (flist.empty()) {
		responders.emplace_back(prs, fd);
	} else {
		responders[event.data.u32].responder = prs;
		responders[event.data.u32].fd = fd;
		flist.pop_back();
	}
}

void Poller::remove(int fd) {
	int err = 0;
	std::lock_guard<std::mutex> lock(block);
	// find the file descriptor in the ResponderRecord objects
	ResponderVec::iterator iter = std::find_if(
		responders.begin(),
		responders.end(),
		[fd](const ResponderRecord &rr) {
			return rr.fd == fd;
		}
	);
	if (iter!= responders.end()) {
		errno = 0;
		// Attempt the removal and check for any error other than not finding
		// the given file descriptor. If the descriptor is already closed, it
		// may not be possible to remove the descriptor.
		if (epoll_ctl(epfd, EPOLL_CTL_DEL, fd, nullptr) && ((err = errno)!= ENOENT)) {
			DUDS_THROW_EXCEPTION(PollerError() <<
				boost::errinfo_errno(err) << PollerFileDescriptor(fd)
			);
		}
		// remove the descriptor and handler even if it cannot be removed from
		// what epoll will check
		iter->responder.reset();
		iter->fd = -1;
		// make it available for re-use
		flist.push_back(iter - responders.begin());
		assert(responders[flist.back()].fd == -1);
		// report ENOENT below
		if (!err) {
			return;
		}
	}
	// report ENOENT or other lack of fd
	DUDS_THROW_EXCEPTION(PollerLacksFileDescriptor() <<
		boost::errinfo_errno(err) << PollerFileDescriptor(fd)
	);
}

// Holds response data temporarily.
struct ResponseRecord {
	PollResponderSptr prs;
	int fd;
	ResponseRecord(PollResponderSptr &&p, int f) : prs(std::move(p)), fd(f) { }
};

int Poller::wait(std::chrono::milliseconds timeout) {
	epoll_event events[32];
	int count = epoll_wait(epfd, events, 32, timeout.count());
	if (!count) {
		// all done
		return 0;
	} else if (count < 0) {
		DUDS_THROW_EXCEPTION(PollerError() <<
			boost::errinfo_errno(errno)
		);
	}
	// might be better if this was an array of 32 unconstructed objects to avoid
	// dynamic memory allocation
	std::vector<ResponseRecord> resprec;
	resprec.reserve(count);
	{ // accessing responders needs a lock
		std::lock_guard<std::mutex> lock(block);
		for (int loop = 0; loop < count; ++loop) {
			ResponderVec::iterator iter =
				responders.begin() + events[loop].data.u32;
			PollResponderSptr prs = iter->responder.lock();
			// if the responder still exists...
			if (prs) {
				//... prepare to invoke it
				resprec.emplace_back(std::move(prs), iter->fd);
			}
			// If the responder does not exist, do nothing. Anything would make
			// this function slower, and would need to handle the possibility of
			// occuring multiple times. Removing the file desriptor is a
			