综合编程

Java For Loop in a table

微信扫一扫,分享到朋友圈

Java For Loop in a table
0

This question is probably best suited towards anyone with some insight into disk read scheduling.

I have the code:

for(int i = readqueue_tail; i<readqueue_head; i++)

I then use i to access elements in a readqueue array, which goes up to 255. However, once the queue is filled, it starts filling again from 0 (as these requests will have been serviced it doesn’t matter).

The issue I’m having is searching from the tail up to the readqueue_head as when the head loops round and goes past 0 again the loop condition fails. How would I go about fixing this?

Other options is just use modulo.

int i = readqueue_tail;
while (i != readqueue_head)
{
    i = (i + 1) % 256;
}
阅读原文...

Hello, buddy!

Java捕获非检查异常----UncaughtExceptionHandler的使用

上一篇

Short note on being busy

下一篇

您也可能喜欢

评论已经被关闭。

插入图片
Java For Loop in a table

长按储存图像,分享给朋友