Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 81a8c301 authored by Sharvil Nanavati's avatar Sharvil Nanavati
Browse files

Fix calls to pthread_setschedparam.

When the scheduling priority is set to SCHED_NORMAL, you may not
specify a non-zero priority. The current implementation does
exactly that resulting in the call failing and returning EINVAL.
This change ensures that a priority of 0 is set when the desired
scheduler policy is set to SCHED_NORMAL.

http://b/12304174

Change-Id: I945cae175b7bdd29dd8fc130ff6396b88ec33fcb
parent c5f49bfb
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -313,6 +313,8 @@ UINT8 GKI_create_task (TASKPTR task_entry, UINT8 task_id, INT8 *taskname, UINT16
             policy = GKI_LINUX_BASE_POLICY;
#if (GKI_LINUX_BASE_POLICY != GKI_SCHED_NORMAL)
             param.sched_priority = GKI_LINUX_BASE_PRIORITY - task_id - 2;
#else
             param.sched_priority = 0;
#endif
         }
         pthread_setschedparam(gki_cb.os.thread_id[task_id], policy, &param);
+3 −1
Original line number Diff line number Diff line
@@ -239,6 +239,8 @@ static int init(const bt_hc_callbacks_t* p_cb, unsigned char *local_bdaddr)
        policy = BTHC_LINUX_BASE_POLICY;
#if (BTHC_LINUX_BASE_POLICY != SCHED_NORMAL)
        param.sched_priority = BTHC_MAIN_THREAD_PRIORITY;
#else
        param.sched_priority = 0;
#endif
        result = pthread_setschedparam(hc_cb.worker_thread, policy, &param);
        if (result != 0)
+3 −1
Original line number Diff line number Diff line
@@ -403,6 +403,8 @@ uint8_t userial_open(uint8_t port)
        policy = BTHC_LINUX_BASE_POLICY;
#if (BTHC_LINUX_BASE_POLICY != SCHED_NORMAL)
        param.sched_priority = BTHC_USERIAL_READ_THREAD_PRIORITY;
#else
        param.sched_priority = 0;
#endif
        result = pthread_setschedparam(userial_cb.read_thread, policy, &param);
        if (result != 0)
+4 −2
Original line number Diff line number Diff line
@@ -323,6 +323,8 @@ uint8_t userial_open(uint8_t port)
        policy = BTHC_LINUX_BASE_POLICY;
#if (BTHC_LINUX_BASE_POLICY != SCHED_NORMAL)
        param.sched_priority = BTHC_USERIAL_READ_THREAD_PRIORITY;
#else
        param.sched_priority = 0;
#endif
        result = pthread_setschedparam(userial_cb.read_thread, policy, &param);
        if (result != 0)