<commit_before>/* $Id$ */

package ibis.satin.impl;

/** The master-worker distribution algorithm. */

final class MasterWorker extends Algorithm {

    MasterWorker(Satin s) {
        super(s);
    }

    public InvocationRecord clientIteration() {
        Victim v;

        if (satin.master) {
            return null;
        }

        synchronized (satin) {
            v = satin.victims.getVictim(satin.masterIdent);
        }

        return satin.stealJob(v, true); // blocks at the server side
    }

    void jobAdded() {
        synchronized (satin) {
            satin.notifyAll();
        }
    }

    public void exit() {
        synchronized (satin) {
            satin.notifyAll();
        }
    }<commit_msg>Wait until master is present before trying to steal from it<commit_after>/* $Id$ */

package ibis.satin.impl;

/** The master-worker distribution algorithm. */

final class MasterWorker extends Algorithm {

    MasterWorker(Satin s) {
        super(s);
    }

    public InvocationRecord clientIteration() {
        Victim v;

        if (satin.master) {
            return null;
        }

        synchronized (satin) {
            v = satin.getVictimWait(satin.masterIdent);
        }

        return satin.stealJob(v, true); // blocks at the server side
    }

    void jobAdded() {
        synchronized (satin) {
            satin.notifyAll();
        }
    }

    public void exit() {
        synchronized (satin) {
            satin.notifyAll();
        }
    }
{'fraction_non_alphanumeric': 0.10642570281124498, 'fraction_numerical': 0.0, 'mean_word_length': 1.778810408921933, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7375632', 'n_tokens_mistral': 448, 'n_tokens_neox': 443, 'n_words': 106}