Exemple #1
0
int ioBlockOps(int block) {
	ee_thread_status_t status;
	int ThreadID;

	if (block && !isIOBlocked) {
		isIOBlocked = 1;

		ThreadID=GetThreadId();
		ReferThreadStatus(ThreadID, &status);
		ChangeThreadPriority(ThreadID, 90);

		// wait for all io to finish
		while (ioHasPendingRequests()) {};

		ChangeThreadPriority(ThreadID, status.current_priority);

		// now all io should be blocked
	} else if (!block && isIOBlocked) {
		isIOBlocked = 0;
	}

	return IO_OK;
}
Exemple #2
0
int ioBlockOps(int block) {
	if (block && !isIOBlocked) {
		isIOBlocked = 1;
		
		// wait for all io to finish
		while (ioHasPendingRequests()) {
			// TODO: This is in seconds, so can be too coarse
			sleep(1);
		}
		
		// now all io should be blocked
		// stop the timer as well...
		stopIOTimer = 1;
		ReleaseAlarm(alarmID);
	} else if (!block && isIOBlocked) {
		isIOBlocked = 0;
		stopIOTimer = 0;
		// create the alarm again
		alarmID = SetAlarm( 625, &ioAlarmFunc, NULL); 
	}
	

	return IO_OK;
}