Skip to content

jmodjeska/pgplus-threads

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PG+ Threading [WIP]

Simple threading support for PG+ talkers. Tested on AMI Linux (RHEL). YMMV.

Requirements

A functioning Playground Plus talk server.

Installation

NOTE: These instructions require more testing with out-of-the-box PG+.

  1. Add src/threads.c provided in this repo to your talker's src directory.

  2. Add src/threads-example.c provided in this repo to your talker's src directory. This contains an example of a command that takes advantage of threads.

  3. Replace src/configure/Configure.help with the one provided in this repo (or add the help items for THREADS and MAX_THREADS at the end).

  4. Update src/configure/Configure.options by inserting the following code at ~line 35:

    #
    comment 'Threaded commands'
    bool 'Allow development of threaded commands' THREADS
    if [ "$THREADS" = "y" ]; then
      int '  Max threads' MAX_THREADS
    fi
    
  5. Update src/include/proto.h by inserting the following code at ~line 380:

    #ifdef THREADS
    extern void threads_version(void);
    #endif /* THREADS */
    
  6. Update src/include/proto.h by inserting the following code at ~line 498:

    #ifdef THREADS
    struct thread_task 
    {
      int status;
      player *p;
      char cmd[512];
      char ret[2048];
      int (*report)(struct thread_task*);
    };
    #endif /* THREADS */
    
  7. Update src/version.c by inserting the following code at ~line 161:

    #ifdef THREADS
    threads_version();
    #endif /* THREADS */
    
  8. Update src/glue.c by inserting the following code at ~line 269:

    #ifdef THREADS
    #include "threads.c"
    #endif /* THREADS */
    

Configuration

During make config, set the MAX_THREADS option as you see fit. You shouldn't need more than 4-8 unless you're really going crazy with threading.

  1. Recompile using the standard PG+ compilation process.

You might also like

About

Command threading for Playground Plus talkers (experimental)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages