Esempio n. 1
0
void GLAPIENTRY
_mesa_WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
{
   GET_CURRENT_CONTEXT(ctx);
   struct gl_sync_object *syncObj;

   if (flags != 0) {
      _mesa_error(ctx, GL_INVALID_VALUE, "glWaitSync(flags=0x%x)", flags);
      return;
   }

   if (timeout != GL_TIMEOUT_IGNORED) {
      _mesa_error(ctx, GL_INVALID_VALUE, "glWaitSync(timeout=0x%" PRIx64 ")",
                  (uint64_t) timeout);
      return;
   }

   syncObj = _mesa_get_and_ref_sync(ctx, sync, true);
   if (!syncObj) {
      _mesa_error(ctx, GL_INVALID_VALUE,
                  "glWaitSync (not a valid sync object)");
      return;
   }

   wait_sync(ctx, syncObj, flags, timeout);
}
Esempio n. 2
0
void GLAPIENTRY
_mesa_WaitSync_no_error(GLsync sync, GLbitfield flags, GLuint64 timeout)
{
   GET_CURRENT_CONTEXT(ctx);

   struct gl_sync_object *syncObj = _mesa_get_and_ref_sync(ctx, sync, true);
   wait_sync(ctx, syncObj, flags, timeout);
}
Esempio n. 3
0
void a_wireframe_tween(Tween_state *tween,
	int frames, int speed, 
	Pixel dit_color, Pixel dash_color, Boolean closed,
	int play_mode)
/* Go do a wire-frame simulation of what tween move will look like
   so user can get a sense of what the timing will be before
   he goes to the pixel perfect (and slow) preview or even
   (gasp) to render it. */
{
int i;
long clock;
int scale; 
Marqihdr mh;
Errcode err = Success;
Tw_tlist tlist;
Short_xyz *points;
int point_count;

if (frames < 0)
	return;

if ((err = ts_to_tw_list(tween, closed, &tlist)) < Success)
	goto OUTBUF;
cinit_marqihdr(&mh,dit_color,dash_color,TRUE);

hide_mouse();
clock = pj_clock_1000();
do
	{
	for (i=0; i<frames; i++)
		{
		scale = calc_time_scale(i, frames);
		calc_tween_points(&tlist, closed, scale, &points, &point_count);
		msome_vector((void *)points,point_count,mh.pdot,&mh,
			!closed, sizeof(Short_xyz));
		err = poll_abort();
		clock += speed;
		do wait_sync(); while (clock > pj_clock_1000());
		if (clock < pj_clock_1000())
			clock = pj_clock_1000();
		msome_vector((void *)points, point_count,undo_marqidot,&mh,
			!closed, sizeof(Short_xyz));
		if(err < Success) /* abort */
			goto OUTLOOP;
		}
	} while (play_mode == TWEEN_LOOP);
OUTLOOP:
show_mouse();
OUTBUF:
trash_tw_list(&tlist);
softerr(err, NULL);
}
Esempio n. 4
0
// thread function to wait for the decoders to finish decoding and
// print output. Only used when decoding
static void print_output (struct write_out_args args)
{
    size_t bytes_left = args.bytes;
    size_t current_block = 0;
    uint16_t last_symbol = 0;
    std::unique_lock<std::mutex> lock (*args.mtx, std::defer_lock);
    while (*args.status == Out_Status::WORKING ||
                                    *args.status == Out_Status::GRACEFUL_STOP) {
        lock.lock();
        auto dec_it = args.decoders->find (current_block);
        if (dec_it == args.decoders->end()) {
            if (*args.status == Out_Status::GRACEFUL_STOP) {
                lock.unlock();
                break;
            }
            args.cond->wait (lock);
            lock.unlock();
            continue;
        }
        auto dec = dec_it->second.get();
        if (!dec->can_decode()) {
            if (*args.status == Out_Status::GRACEFUL_STOP) {
                *args.status = Out_Status::ERROR;
                return;
            }
            args.cond->wait (lock);
            lock.unlock();
            continue;
        }
        lock.unlock();
        auto pair = dec->wait_sync();
        if (pair.first == RaptorQ__v1::Error::NEED_DATA) {
            if (*args.status == Out_Status::GRACEFUL_STOP) {
                lock.lock();
                if (dec->poll().first == RaptorQ__v1::Error::NONE)
                    continue;
                *args.status = Out_Status::ERROR;
                return;
            }
            continue;
        }
        if (pair.first != RaptorQ__v1::Error::NONE) {
            // internal error or interrupted computation
            lock.lock();
            *args.status = Out_Status::ERROR;
            return;
        }
        size_t sym_size = dec->symbol_size();
        std::vector<uint8_t> buffer (sym_size);;
        for (; last_symbol < pair.second; ++last_symbol) {
            buffer.clear();
            buffer.insert (buffer.begin(), sym_size, 0);
            auto buf_start = buffer.begin();
            auto to_write = dec->decode_symbol (buf_start, buffer.end(),
                                                                last_symbol);
            if (to_write != RaptorQ__v1::Error::NONE) {
                std::cerr << "ERR: partial or empty symbol from decoder\n";
                lock.lock();
                *args.status = Out_Status::ERROR;
                return;
            }
            size_t writes_left = std::min (bytes_left,
                                            static_cast<size_t> (sym_size));
            #pragma clang diagnostic push
            #pragma clang diagnostic ignored "-Wshorten-64-to-32"
            args.output->write (reinterpret_cast<char *> (buffer.data()),
                                            static_cast<int64_t> (writes_left));
            #pragma clang diagnostic pop
            bytes_left -= writes_left;
            if (bytes_left == 0) {
                // early exit. we wrote everything.
                last_symbol = dec->symbols();
                break;
            }
        }
        if (last_symbol == dec->symbols()) {
            lock.lock();
            dec_it = args.decoders->find (current_block);
            dec_it->second.reset (nullptr);
            lock.unlock();
            ++current_block;
            last_symbol = 0;
        }
    }
    lock.lock();
    *args.status = Out_Status::EXITED;
}
Esempio n. 5
0
 void wait()
 { wait_sync(); }