コード例 #1
0
    def send_sync_to(self, from_tcb: TaskletControlBlock, target_tid: int,
                     obj: object, handler: callable):
        """
        Called from tasklet. Send a sync message from local tasklet to target tasklet
        """
        if not S.isLocal(target_tid):
            raise NotImplementedError("No IPC for now, sorry!")

        smsg = SynchronousMessage(obj, from_tcb.tid, target_tid,
                                  self.uuidgen.next())

        with S.syslock:
            if target_tid not in S.tcbs:
                S.schedule(from_tcb, handler, Tasklet.DoesNotExist)
            else:
                S.schedule(S.tcbs[target_tid],
                           S.tcb_inst[target_tid].on_message, from_tcb.tid,
                           smsg)

        with self.metalock:
            self.messages[smsg.uuid] = (from_tcb.tid, handler)
            self.rev_uuids_by_tid[target_tid].append(smsg.uuid)
            self.uuids_by_tid[from_tcb.tid].append(smsg.uuid)

        from_tcb.handlers += 1
コード例 #2
0
 def open(tid: int, result1: callable):
     if not S.isLocal(tid):
         raise NotImplementedError("Sorry, no IPC yet")
     
     current_tcb = S.loc.tcb
     
     try:
         tcb = S.tcbs[tid]
         if not tcb.is_alive:
             raise KeyError
             
     except KeyError:
         S.schedule(current_tcb, result1, Tasklet.DoesNotExist)
     else:
         S.schedule(current_tcb, result1, Tasklet(tcb.tid, tcb.user, tcb.group, tcb.name))
コード例 #3
0
    def open(tid: int, result1: callable):
        if not S.isLocal(tid):
            raise NotImplementedError("Sorry, no IPC yet")

        current_tcb = S.loc.tcb

        try:
            tcb = S.tcbs[tid]
            if not tcb.is_alive:
                raise KeyError

        except KeyError:
            S.schedule(current_tcb, result1, Tasklet.DoesNotExist)
        else:
            S.schedule(current_tcb, result1,
                       Tasklet(tcb.tid, tcb.user, tcb.group, tcb.name))
コード例 #4
0
 def send_to(tid, obj: object, result1: callable=None):
     if not S.isLocal(tid):
         raise NotImplementedError("Sorry, no IPC yet")
     
     current_tcb = S.loc.tcb
     
     try:
         tcb = S.tcbs[tid]
         if not tcb.is_alive:
             raise KeyError
         tcb_inst = S.tcb_inst[tid]
     except KeyError:
         if result1 != None:
             S.schedule(current_tcb, result1, Tasklet.DoesNotExist)
     else:
         if result1 != None:
             S.schedule(current_tcb, result1, Tasklet(tcb.tid, tcb.user, tcb.group, tcb.name))
         S.schedule(tcb, tcb_inst.on_message, current_tcb.tid, obj)
コード例 #5
0
    def send_to(tid, obj: object, result1: callable = None):
        if not S.isLocal(tid):
            raise NotImplementedError("Sorry, no IPC yet")

        current_tcb = S.loc.tcb

        try:
            tcb = S.tcbs[tid]
            if not tcb.is_alive:
                raise KeyError
            tcb_inst = S.tcb_inst[tid]
        except KeyError:
            if result1 != None:
                S.schedule(current_tcb, result1, Tasklet.DoesNotExist)
        else:
            if result1 != None:
                S.schedule(current_tcb, result1,
                           Tasklet(tcb.tid, tcb.user, tcb.group, tcb.name))
            S.schedule(tcb, tcb_inst.on_message, current_tcb.tid, obj)
コード例 #6
0
ファイル: SMP.py プロジェクト: piotrmaslanka/systemy
    def send_sync_to(self, from_tcb: TaskletControlBlock, target_tid: int, obj: object, handler: callable):
        """
        Called from tasklet. Send a sync message from local tasklet to target tasklet
        """
        if not S.isLocal(target_tid):
            raise NotImplementedError("No IPC for now, sorry!")

        smsg = SynchronousMessage(obj, from_tcb.tid, target_tid, self.uuidgen.next())
        
        with S.syslock:
            if target_tid not in S.tcbs:
                S.schedule(from_tcb, handler, Tasklet.DoesNotExist)
            else:
                S.schedule(S.tcbs[target_tid], S.tcb_inst[target_tid].on_message, from_tcb.tid, smsg)
        
        with self.metalock:
            self.messages[smsg.uuid] = (from_tcb.tid, handler)
            self.rev_uuids_by_tid[target_tid].append(smsg.uuid)
            self.uuids_by_tid[from_tcb.tid].append(smsg.uuid)
            
        from_tcb.handlers += 1
コード例 #7
0
    def send_sync_to(tid: int, obj: object, result1: callable):
        if not S.isLocal(tid):
            raise NotImplementedError("Sorry, no IPC yet")

        S.getSMP(S.loc.tcb.tid).send_sync_to(S.loc.tcb, tid, obj, result1)
コード例 #8
0
 def send_sync_to(tid: int, obj: object, result1: callable):
     if not S.isLocal(tid):
         raise NotImplementedError("Sorry, no IPC yet")
     
     S.getSMP(S.loc.tcb.tid).send_sync_to(S.loc.tcb, tid, obj, result1)