Turn on thread page Beta
    Offline

    2
    ReputationRep:
    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
    Less of the compsci talk would be nice though!
    Offline

    1
    ReputationRep:
    (Original post by 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
    Less of the compsci talk would be nice though!
    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.
    Offline

    0
    ReputationRep:
    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!
    Offline

    1
    ReputationRep:
    (Original post by 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.
    Offline

    0
    ReputationRep:
    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!
    Offline

    1
    ReputationRep:
    (Original post by 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.
    Offline

    0
    ReputationRep:
    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!
    Offline

    1
    ReputationRep:
    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.
    Offline

    1
    ReputationRep:
    Can't be bothered.
    Offline

    17
    ReputationRep:
    How about just can't? :p:
    Offline

    1
    ReputationRep:
    (Original post by 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!"
    Offline

    1
    ReputationRep:
    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?"
    Offline

    2
    ReputationRep:
    (Original post by 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..
    Offline

    1
    ReputationRep:
    (Original post by 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!!
    Offline

    2
    ReputationRep:
    if i was at girton i would have postal votes, no queston
    Offline

    17
    ReputationRep:
    (Original post by crana9)
    if i was at girton i would have postal votes, no queston
    Are they in another constituency?
    Offline

    2
    ReputationRep:
    country?
    Offline

    1
    ReputationRep:
    (Original post by 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.
    Offline

    2
    ReputationRep:
    i respectfully suggest that any student incapable of finding their polling station should not be allowed to vote
    Offline

    17
    ReputationRep:
    (Original post by 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:|
 
 
 

University open days

  1. University of Cambridge
    Christ's College Undergraduate
    Wed, 26 Sep '18
Poll
Which accompaniment is best?

The Student Room, Get Revising and Marked by Teachers are trading names of The Student Room Group Ltd.

Register Number: 04666380 (England and Wales), VAT No. 806 8067 22 Registered Office: International House, Queens Road, Brighton, BN1 3XE

Write a reply...
Reply
Hide
Reputation gems: You get these gems as you gain rep from other members for making good contributions and giving helpful advice.