The Student Room Group
Reply 15380
Has this thread just turned into you talking to yourself? :p:
I know I shouldn't be in here really, but I like to have a read every now and again, just to see what the Cam peeps are up to :smile:
Less of the compsci talk would be nice though! :biggrin:
Ellie4
Has this thread just turned into you talking to yourself? :p:
I know I shouldn't be in here really, but I like to have a read every now and again, just to see what the Cam peeps are up to :smile:
Less of the compsci talk would be nice though! :biggrin:

It appears to be me talking to me about me at the moment. I need to lock my computer up so I can concentrate on my work.
Reply 15382
well i'm still waiting for someone to answer my last compsci question

but on a less computer related cambridge bit of news...i just had a really crap outing in a 4. Grrr it's so frustrating when the boats so unstable. I'm not in a good mood!
Reply 15383
Willa
well i'm still waiting for someone to answer my last compsci question

Are you just wanting to show when it preempts, or does each Thread have to do something useful AND detect?

A.
Reply 15384
well if you must know, the two threads are simultaneously trying to read from the same file. I want to signal when control of the output switches from one thread to the other, how can I do this? It's obvious in the output cos the output text has sudden breaks where it jumps back to some previous part, but I want a formal way of signalling the change!
Reply 15385
Willa
well if you must know, the two threads are simultaneously trying to read from the same file. I want to signal when control of the output switches from one thread to the other, how can I do this? It's obvious in the output cos the output text has sudden breaks where it jumps back to some previous part, but I want a formal way of signalling the change!

Signalling to who/what?

There is Thread.currentThread() (I think it's that) which returns the currently executing thread (ie whichever thread you are executing the call from), so in the two executing threads you can check that against a stored value of the last known executing thread and if it's equal to you you haven't just been scheduled, otherwise if it's different you have and can 'signal' it. The problem is that afaik the JVM makes no guarantees (in fact would be stupid to) preempt between statements, so it may finish executing a command even if you've put these checks inbetween every statement of code. I don't see how you get around that bit, note this also doesn't scale for processors > 1 and is ugly.

A.
Reply 15386
well i wanted it to signal with just a System.out.println. And I've got two instances of the thread class running, is that the correct way to do threads? Or can you run multiple threads by creating only one instance of the thread extended class?

urgh, either way i'm going to bed! Erging tomorrow = yawn!
Reply 15387
As you know, the General Election is today (Thursday, 5 May). CUSU has been running a campaign to "get the vote out".

1) ALL students are registered to vote - you do NOT need a polling card, just bring some ID.

2) Students with a postal vote are still entitled to vote in Cambridge so
long as they have not yet used the postal vote. It is perfectly legal to be
registered in two places, but not to use a vote in both places for the
Parliamentary election.

3) Local elections are being held tomorrow too - students (including EU
students) may vote in these elections both here AND at home.

4) Look out for organised walks to the polling stations. Meeting after meal times would be ideal.
Can't be bothered.
How about just can't? :p:
visesh
How about just can't? :p:

I can if I want to. By doing something dramatic. Something like hold Michael Howard hostage and say "If you don't let me vote, your next prime minister is going to be Tony Blair for sure!"
How does this buying college wine thing work? Can I just work into a college bar and say, "can I have a bottle of the college wine?"
Reply 15392
Ticki

4) Look out for organised walks to the polling stations. Meeting after meal times would be ideal.


Huh?

Aren't we meant to be intelligent enough to find the Guildehall on our own? it's hardly out of the way..
crana9
Huh?

Aren't we meant to be intelligent enough to find the Guildehall on our own? it's hardly out of the way..

Not for people from Girton. Phenyl Girton!!:biggrin:
Reply 15394
if i was at girton i would have postal votes, no queston
crana9
if i was at girton i would have postal votes, no queston

Are they in another constituency?
Reply 15396
country?
Reply 15397
crana9
Huh?

Aren't we meant to be intelligent enough to find the Guildehall on our own? it's hardly out of the way..

My Polling station isn't the guildhall, nevertheless, despite it being in locally held territory, I might be able to find it and capture it.

A.
Reply 15398
i respectfully suggest that any student incapable of finding their polling station should not be allowed to vote
crana9
i respectfully suggest that any student incapable of finding their polling station should not be allowed to vote

Mine is about 200 yards away, but I'll struggle to find it. It is actually ON my street:|

Latest

Trending

Trending