예제 #1
0
int main(int argc, char *argv[])
{
    int infd, numenodes = 0;
    struct enode root;
    struct inotify_event *ev;

    if(argc <= 1) 
    {
        write(2, "Can't guess what you'd like me to watch.\n", 41);
        _exit(1);
    }

    infd = inotify_init();

 
    if(walk(infd, &root, argv[1]) <= 0)
    {
       write(2, "Nothing to watch.\n", 18);
        _exit(1);
    }


    ev = malloc(EVLEN);
    while(nextevent(infd, &root, ev));

    free(ev);
    close(infd);
    free_enode_tree(&root);
    _exit(0);
}
예제 #2
0
int main(int argc, char **argv)
{
	struct event *ev;

	nproc = 128;
	ncycmax = 10;
	dtc = 0.01;
	dts = 0.0;
	alpha = 0.1;

	init();

	while ((ev = nextevent()) != NULL) {
		doevent(ev);
	}

	term();
	tst_resm(TPASS, "PASS");
	tst_exit();
}
예제 #3
0
void producer::run (void)
{
	while (true)
	{
		exclusivesection (db)
		{
			db.clear ();
			for (int i=0; i<64; ++i)
			{
				statstring key = strutil::uuid ();
				string value = strutil::uuid ();
				
				db[key] = value;
			}
		}
		core.sh ("/usr/bin/true");
		value v = nextevent ();
		if (v.type() == "shutdown")
		{
			shutcond.broadcast();
			return;
		}
	}
}