⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 thread.h

📁 initial working phase of the design of said editor, featuring multicasting, advanced linux keyboard
💻 H
字号:
#ifndef __THREAD_H
#define __THREAD_H

#include "vector.h"

extern volatile struct thread
{
   void(vector::* addr)( void* );
   void* state;
   thread* next;
}* top_thread;

#define BUSY_THREAD ( thread* )1

#include <stdio.h> // printf

void term( int );

inline void spawn( void(vector::* v)( void* ), void* state )
{
   thread* next = ( thread* )top_thread;

//   printf( "+" );
//   fflush( stdout );

   while( next == BUSY_THREAD )

      next = ( thread* )top_thread;

   ( thread* )top_thread = BUSY_THREAD;

//   printf( "-" );
//   fflush( stdout );

//   printf( "%%" );
//   fflush( stdout );

   thread* top = new thread;

//   printf( "%%" );
//   fflush( stdout );

   top -> next = next;
   top -> addr = v; // failure centers on this
   top -> state = state;

   ( thread* )top_thread = top;
}

#endif // __THREAD_H

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -