Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Is there any way to prioratize a task in TPL.

Is there any way to prioratize a task in TPL.

Scheduled Pinned Locked Moved C#
tutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    prasadbuddhika
    wrote on last edited by
    #1

    i'm new to TPL and , trying to achieve prioritization in tasks using TPL. which means for example , i have to start two tasks parallel (t1 and t2) but i need to give the priority to t1 means both are having messages to deliver but t1 got the highest priority messages so i need to send them before t2 messages. is this possible, thanx in advance

    D 1 Reply Last reply
    0
    • P prasadbuddhika

      i'm new to TPL and , trying to achieve prioritization in tasks using TPL. which means for example , i have to start two tasks parallel (t1 and t2) but i need to give the priority to t1 means both are having messages to deliver but t1 got the highest priority messages so i need to send them before t2 messages. is this possible, thanx in advance

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      About the only option you have is in the Task.CreationOptions property. The TaskCreationOptions enum can tell the scheduler to PreferFairness, meaning that tasks created earlier tend to run sooner than tasks created later. Other than that, you'd have to setup some communication between tasks so they can work out whos going to send messages first. But, if you have to schedule messages being sent, that sounds like a seperate thread that should maintain it's own message scheduler. Your other tasks would have to submit their messages (with a some priority token) to the scheduler to be sent out.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups