Esempio n. 1
0
        /// <summary>
        /// Cleans up this task
        /// </summary>
        public void Cleanup()
        {
            // Cleanup child threads
            Thread current = FirstThread;

            while (current.NextThread != FirstThread)
            {
                current.Cleanup();
                Heap.Free(current);
                current = current.NextThread;
            }

            // Cleanup signals
            for (int i = 0; i < Signals.NSIG; i++)
            {
                SignalAction action = m_signalActions[i];
                if (action != null)
                {
                    Heap.Free(action);
                }
            }
            Heap.Free(m_signalActions);

            // Cleanup virtual addresses claimed by this task
            int count = m_usedAddresses.Count;

            for (int i = 0; i < count; i++)
            {
                Heap.Free(m_usedAddresses.Item[i]);
            }
            m_usedAddresses.Dispose();
            Heap.Free(m_usedAddresses);

            // Filesystem stuff
            FileDescriptors.Cleanup();
            Heap.Free(FileDescriptors);
            Heap.Free(m_currentDirectory);

            // Context
            Context.Cleanup();
            Heap.Free(Context);
        }
Esempio n. 2
0
 /// <summary>
 /// Replaces the current file descriptors
 /// </summary>
 /// <param name="fileDescriptors">The new file descriptors</param>
 public void SetFileDescriptors(FileDescriptors fileDescriptors)
 {
     FileDescriptors.Cleanup();
     Heap.Free(FileDescriptors);
     FileDescriptors = fileDescriptors;
 }